$dao->setLinksAndRulers($book_id, json_encode($nlinks), json_encode($nrulers), 'Restore links from ' . date('Y-m-d H:i:s', $time), $core->user->utilisateur_id);\r
}\r
\r
-\r
-\r
public static function importLinksAsExcel($args) {\r
global $core;\r
$book_id = $args[1];\r
\r
file_put_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $time . '/composition.json', json_encode($compiler->collection->datas));\r
\r
+\r
+\r
$c = $core->con->openCursor('book_collection_compile');\r
$c->collection_id = $id;\r
$c->compile_date = $time;\r
$c->online = 0;\r
$c->insert();\r
\r
+ if (true) {\r
+ self::collectionVersionPublish(array('collectionVersionPublish', $id, $time), new cubeAjax());\r
+ }\r
+\r
$x->addReload();\r
}\r
\r
}\r
\r
}\r
+\r
?>
\ No newline at end of file
public function collection() {\r
global $core;\r
$id = $this->callArgs[0];\r
+ $local = (isset($this->callArgs[1])) ? $this->callArgs[1] : null;\r
+\r
$this->outputXML = false;\r
header('Content-type: application/json');\r
\r
$cache = WS_COLLECTIONS . '/ws/' . $id . '.json';\r
- $limit = TIME - 7200;\r
- if (!file_exists($cache) || filemtime($cache) < $limit) {\r
+ $update = WS_COLLECTIONS . '/ws/' . $id . '.update';\r
+\r
+ if (!is_null($local) && file_exists($update) && file_get_contents($update) == $local) {\r
+ echo 'false';\r
+ exit;\r
+ }\r
+\r
+ $limit = TIME - 72000;\r
+ if (!file_exists($cache) || !file_exists($update) || filemtime($cache) < $limit) {\r
$r = $core->con->select('SELECT * FROM book_collection_compile WHERE online=1 AND collection_id=\'' . $core->con->escape($id) . '\'');\r
$r->fetch();\r
$version = $r->compile_date;\r
$json = json_encode($d);\r
file_put_contents($cache, $json);\r
echo $json;\r
+ file_put_contents($update, $version);\r
} else {\r
echo file_get_contents($cache);\r
}\r
return;
}
- $videosExtensions = $this->getVideosFormats(false);
- foreach ($videosExtensions as $e) {
- $videos[$e] = array();
- }
$cacheFile = $this->vdir . '/cache.appcache';
$lines[] = 'index.html* index.html';
$lines[] = '';
$lines[] = 'CACHE:';
- $assets = array('images', 'style', 'swf', 'data/style', 'data/images', 'data/fluidbook.js', 'data/datas.js');
-
- $pages = $this->book->parametres->pages + 1;
-
- for ($i = 0; $i <= $pages; $i++) {
- $assets[] = 'data/background/150/' . $this->backgroundsPrefix . $i . '.jpg';
- $assets[] = 'data/contents/p' . $i . '.svg';
- }
- $assets[] = 'data/thumbnails';
- $assets[] = 'data/links';
- foreach ($assets as $a) {
- $ap = $dest . '/' . $a;
-
- if (!file_exists($ap)) {
+ $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dest), RecursiveIteratorIterator::SELF_FIRST);
+
+ $exclude=array('index.html','indexu.html','widget.html','indext.html');
+
+ foreach ($iterator as $path) {
+ if (!$path->isFile()) {
continue;
}
- if (is_file($ap)) {
- $lines[] = str_replace($dest . '/', '', $ap);
- } else if (is_dir($ap)) {
- $iterator = new RecursiveDirectoryIterator($ap);
- foreach ($iterator as $path) {
- if (!$path->isFile()) {
- continue;
- }
- $p = str_replace($dest . '/', '', $path);
- $lines[] = $p;
- }
+
+ $p = str_replace($dest . '/', '', $path);
+ if (in_array($p, $exclude)) {
+ continue;
}
+ $lines[] = $p;
}
$lines[] = '';
$lines = array_merge($lines, $network);
file_put_contents($cacheFile, implode("\n", $lines));
-
- foreach ($videos as $format => $v) {
- if (!count($v)) {
- continue;
- }
- $cacheFile = $dest . '/data/links/video.' . $format . '.appcache';
- $htmlFile = $dest . '/data/links/video.' . $format . '.html';
-
- $html = '<!DOCTYPE html><html manifest="video.' . $format . '.appcache"><head></head><body></body></html>';
- file_put_contents($htmlFile, $html);
-
- $lines = array();
- $lines[] = 'CACHE MANIFEST';
- $lines[] = '# ' . date('Y-m-d H:i:s');
- $lines[] = '';
- $lines[] = 'CACHE:';
- foreach ($v as $video) {
- $lines[] = $video;
- }
- file_put_contents($cacheFile, implode("\n", $lines));
- }
}
protected function writeIndex($numCSS) {