if (isset($collection->settings['offline']) && $collection->settings['offline']) {
$p = $compiler->getPublishedVersionPath($os, $collection->settings['version']);
+ if ($p) {
+ $phonegap->addAdditionalSource('publications', $p);
+
+ $exs = explode("\n", $collection->settings['offline_exclude']);
+ foreach ($exs as $e) {
+ $e = trim($e);
+ if ($e == '') {
+ continue;
+ }
- $phonegap->addAdditionalSource('publications', $p);
-
- $exs = explode("\n", $collection->settings['offline_exclude']);
- foreach ($exs as $e) {
- $e = trim($e);
- if ($e == '') {
- continue;
- }
-
- if (stristr($e, '$id$')) {
- foreach ($allpub as $i) {
- $phonegap->addExclude('"' . str_replace('$id$', $i, $e) . '"');
+ if (stristr($e, '$id$')) {
+ foreach ($allpub as $i) {
+ $phonegap->addExclude('"' . str_replace('$id$', $i, $e) . '"');
+ }
+ } else {
+ $phonegap->addExclude('"' . $e . '"');
}
- } else {
- $phonegap->addExclude('"' . $e . '"');
}
- }
- $add = explode("\n", $collection->settings['offline_syncs']);
- foreach ($add as $a) {
- $a = trim($a);
- if ($a == '') {
- continue;
+ $add = explode("\n", $collection->settings['offline_syncs']);
+ foreach ($add as $a) {
+ $a = trim($a);
+ if ($a == '') {
+ continue;
+ }
+ list($to, $source) = explode(':', $a);
+ $phonegap->addAdditionalSource('publications' . '/' . $to, $p . $source);
}
- list($to, $source) = explode(':', $a);
- $phonegap->addAdditionalSource('publications' . '/' . $to, $p . $source);
}
}
-
-
-
-
$phonegap->run($run);
}
public function getPublishedVersionPath($os, $version) {
global $core;
- $r = $core->con->select('SELECT compile_date FROM book_collection_compile WHERE collection_id=\'' . $this->collectionId . '\'');
+ $r = $core->con->select('SELECT * FROM book_collection_compile WHERE collection_id=\'' . $this->collectionId . '\'');
while ($r->fetch()) {
$v = $r->{"online_" . $os};
if (!$v) {
}
return WS_COLLECTIONS . '/versions/' . $this->collectionId . '/' . $r->compile_date . '/' . $os . '/';
}
+ return false;
}
}