try {
$c->insert();
} catch (Exception $e) {
- // fb($e);
+// fb($e);
}
}
}
public static function importFromOldWS($args) {
global $core;
- // Import des fluidbooks
- // Donc le dernier importé est le max dont le numéro est inférieur à 10000
+// Import des fluidbooks
+// Donc le dernier importÃ\83© est le max dont le numÃ\83©ro est infÃ\83©rieur Ã\83 10000
$r = $core->con->select('SELECT MAX(book_id) AS book_id FROM books WHERE book_id<10000');
$lastImported = $r->book_id;
- // On recherche maintenant les fluidbook dans la vieille base
+// On recherche maintenant les fluidbook dans la vieille base
$r = $core->con->select('SELECT bid FROM ws.book WHERE bid>' . $lastImported);
$oldBooks = array();
while ($r->fetch()) {
public static function importLangs($oldBooks) {
global $core, $allTrads, $trads;
- // On regarde d'abord les langues que nous avons déjÃ
+// On regarde d'abord les langues que nous avons dÃ\83©jÃ\83Â
$r = $core->con->select('SELECT lang_id FROM langues');
$already = array();
while ($r->fetch()) {
$r = $core->con->select('SELECT MAX(theme_id) AS theme_id FROM themes WHERE theme_id<1000');
$lastImported = $r->theme_id;
- // Import des thèmes
+// Import des thÃ\83¨mes
$r = $core->con->select('SELECT * FROM ws.theme WHERE tid IN (SELECT tid FROM ws.book WHERE bid ' . self::_sqlIn($oldBooks) . ') AND tid>' . $lastImported);
$theme = new wsTheme();
while ($r->fetch()) {
public static function importDocs($oldBooks) {
global $core;
- // On cherche maintenant à savoir si l'on doit importer de nouveaux documents associés
+// On cherche maintenant Ã\83 savoir si l'on doit importer de nouveaux documents associÃ\83©s
$oldDocuments = array();
$r = $core->con->select('SELECT DISTINCT did FROM ws.book_pages WHERE bid ' . self::_sqlIn($oldBooks) . '');
while ($r->fetch()) {
$tolinks = array_merge($tolinks, $fromlinks);
$torulers = array_merge($torulers, $fromrulers);
+ $wt = WS_BOOKS . '/working/' . $to;
+ $wf = WS_BOOKS . '/working/' . $from;
+
+ if (file_exists($wf)) {
+ $wf1 = $wf . '/*';
+ if (!file_exists($wt)) {
+ mkdir($wt, 0777, true);
+ }
+
+ $cmd = "cp -r $wf1 $wt";
+ echo `$cmd`;
+ }
$dao->setLinksAndRulers($to, $tolinks, $torulers, 'Copy links from #' . $from . ' to #' . $to, $core->user->utilisateur_id);
}
public static function importBooks($oldBooks) {
global $core, $allTrads, $signatures;
- // Importe les fluidbooks
+// Importe les fluidbooks
$r = $core->con->select('SELECT * FROM ws.book WHERE bid ' . self::_sqlIn($oldBooks) . ' ORDER BY bid');
if (!$r->count()) {
return;
}
- // .
+// .
while ($r->fetch()) {
$c = $core->con->openCursor('books');
$c->book_id = $r->bid;
}
$n = array();
- // Pages sans numéro
+// Pages sans numÃ\83©ro
$offset = $r->first_page_nr - 1;
for ($i = 0; $i < $offset; $i++) {
$n[] = '';
}
- // Pages avec numero
+// Pages avec numero
for ($j = 1; $j + $offset <= $r->pages; $j++) {
$n[] = $j;
}
$c->version = 1;
$c->insert();
}
- // Import des pages
+// Import des pages
$core->con->execute('INSERT INTO book_pages (book_id,book_page,document_id,document_page) SELECT bid,bpid,did,dpid FROM ws.book_pages WHERE bid ' . self::_sqlIn($oldBooks));
$dao = new wsDAOBook($core->con);
protected static function _getAllUsers() {
global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs;
$grades = array(0 => 1, 0.4 => 1, '0.4' => 1, 0.5 => 1, '0.5' => 1, 1 => 1, 2 => 2, 3 => 3, 4 => 5);
- // Contrôle des entreprises déjà dans la base extranet
+// ContrÃ\83´le des entreprises dÃ\83©jÃ\83 dans la base extranet
$entreprises = array();
$entreprise_id = 0;
$r = $core->con->select('SELECT entreprise_id,nom FROM entreprises');
}
$entreprise_id++;
- // Obtient les emails des utilisateurs
+// Obtient les emails des utilisateurs
$utilisateur_id = 0;
$utilisateurs = array();
$r = $core->con->select('SELECT utilisateur_id,email FROM utilisateurs');
protected static function _importOldUser($oldid) {
global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs;
- // Get user from old
+// Get user from old
$r = $core->con->select('SELECT * FROM ws.user WHERE uid=\'' . $core->con->escape($oldid) . '\'');
if ($r->extranet != 0) {
$ws2ext[$r->uid] = $r->extranet;
return;
}
- // On s'occupe de l'entreprise
+// On s'occupe de l'entreprise
$email = trim(mb_strtolower($r->email));
$rs = trim($r->rs);
$c->ws_admin = self::_getWsUser($r->admin);
$c->update('WHERE entreprise_id=\'' . $e . '\'');
}
- // Puis de l'utilisateur
+// Puis de l'utilisateur
if (isset($utilisateurs[$email])) {
$c = $core->con->openCursor('utilisateurs');
$c->ws_password = $r->password;
$c->lang = $r->lang;
$c->telephone = $r->telephone;
$c->date_creation = $r->date;
- $c->notes = 'Inséré à l\'import vers le nouveau Fluidbook Workshop';
+ $c->notes = 'InsÃ\83©rÃ\83© Ã\83 l\'import vers le nouveau Fluidbook Workshop';
$c->ws_password = $r->password;
$c->ws_id = $r->uid;
$c->insert();
public static function cleanPackages() {
$limit = TIME - (4 * 3600); // 4 heures avant maintenant*
- //
+//
$dirs = array(ROOT . '/cache/download',
WS_FILES . '/packager/download/',
WS_FILES . '/packager/',
'/home/ws/www/download');
- // Clean downloads
+// Clean downloads
foreach ($dirs as $dir) {
if (!file_exists($dir)) {
$ext = mb_strtolower(files::getExtension($init['alternative']));
- if (in_array($ext, array('oam', 'zip'))) {
+ if (in_array($ext, array('oam', 'zip', 'html'))) {
if ($init['inline']) {
return new htmlMultimediaLink($id, $init, $compiler);
} else {
if ($ext == 'oam') {
$d = $this->unzipFile($this->alternative, true);
$this->_config = $this->getConfigOAM($d['dir']);
- } else {
+ } elseif ($ext == 'zip') {
$d = $this->unzipFile($this->alternative, false);
$this->_config = $this->getConfigZIP($d['dir']);
+ } elseif ($ext == 'html') {
+ $fdir = 'data/links';
+ $dir = $this->compiler->vdir . '/' . $fdir;
+ $d = array('fdir' => $fdir, 'dir' => $dir);
+ copy($this->compiler->wdir . '/' . $this->alternative, $d['dir'] . '/' . $this->alternative);
+ $this->_config = $this->getConfigHTML($d['dir'], $this->alternative);
}
$w = $this->width * $this->getCssScale();
}
public function getConfigZIP($d) {
-
-
$res = array('width' => $this->video_width, 'height' => $this->video_height);
if (file_exists($d . '/index.html')) {
$r = array('html' => 'index.html', 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
return array_merge($res, $r);
}
+ public function getConfigHTML($d, $html) {
+ $res = array('width' => $this->video_width, 'height' => $this->video_height);
+ $r = array('html' => $html, 'inject' => array(), 'injectcss' => array(), 'injectjs' => array());
+
+ return array_merge($res, $r);
+ }
+
public function getConfigOAM($d) {
$x = simplexml_load_file($d . '/config.xml');
$config = (string) $x->oamfile['src'];