aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche')
-rwxr-xr-xinc/poche/Database.class.php3
-rwxr-xr-xinc/poche/Poche.class.php43
-rwxr-xr-xinc/poche/Tools.class.php6
-rwxr-xr-xinc/poche/config.inc.default.php4
4 files changed, 29 insertions, 27 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 9e901974..11cccb72 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -409,6 +409,7 @@ class Database {
409 public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) { 409 public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) {
410 $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)'; 410 $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)';
411 $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead); 411 $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead);
412
412 if ( !$this->executeQuery($sql_action, $params_action) ) { 413 if ( !$this->executeQuery($sql_action, $params_action) ) {
413 $id = null; 414 $id = null;
414 } 415 }
@@ -487,7 +488,7 @@ class Database {
487 $sql = 488 $sql =
488 "SELECT entries.* FROM entries 489 "SELECT entries.* FROM entries
489 LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id 490 LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id
490 WHERE tags_entries.tag_id = ? AND entries.user_id=?"; 491 WHERE tags_entries.tag_id = ? AND entries.user_id=? ORDER by entries.id DESC";
491 $query = $this->executeQuery($sql, array($tag_id, $user_id)); 492 $query = $this->executeQuery($sql, array($tag_id, $user_id));
492 $entries = $query->fetchAll(); 493 $entries = $query->fetchAll();
493 494
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 37cf66a3..09a9f5ff 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -1083,11 +1083,10 @@ class Poche
1083 $config = $this->store->getConfigUser($user_id); 1083 $config = $this->store->getConfigUser($user_id);
1084 1084
1085 if ($config == null) { 1085 if ($config == null) {
1086 die(_('User with this id (' . $user_id . ') does not exist.')); 1086 die(sprintf(_('User with this id (%d) does not exist.'), $user_id));
1087 } 1087 }
1088 1088
1089 if (!in_array($type, $allowed_types) || 1089 if (!in_array($type, $allowed_types) || $token != $config['token']) {
1090 $token != $config['token']) {
1091 die(_('Uh, there is a problem while generating feeds.')); 1090 die(_('Uh, there is a problem while generating feeds.'));
1092 } 1091 }
1093 // Check the token 1092 // Check the token
@@ -1145,17 +1144,18 @@ class Poche
1145 $config = HTMLPurifier_Config::createDefault(); 1144 $config = HTMLPurifier_Config::createDefault();
1146 $config->set('Cache.SerializerPath', CACHE); 1145 $config->set('Cache.SerializerPath', CACHE);
1147 $config->set('HTML.SafeIframe', true); 1146 $config->set('HTML.SafeIframe', true);
1147
1148 //allow YouTube, Vimeo and dailymotion videos 1148 //allow YouTube, Vimeo and dailymotion videos
1149 $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/|www\.dailymotion\.com/embed/video/)%'); 1149 $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/|www\.dailymotion\.com/embed/video/)%');
1150 1150
1151 return new HTMLPurifier($config); 1151 return new HTMLPurifier($config);
1152 } 1152 }
1153 1153
1154 /** 1154 /**
1155 * handle epub 1155 * handle epub
1156 */ 1156 */
1157 public function createEpub() { 1157 public function createEpub() {
1158 1158
1159 switch ($_GET['method']) { 1159 switch ($_GET['method']) {
1160 case 'id': 1160 case 'id':
1161 $entryID = filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT); 1161 $entryID = filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT);
@@ -1191,7 +1191,7 @@ class Poche
1191 break; 1191 break;
1192 case 'default': 1192 case 'default':
1193 die(_('Uh, there is a problem while generating epub.')); 1193 die(_('Uh, there is a problem while generating epub.'));
1194 1194
1195 } 1195 }
1196 1196
1197 $content_start = 1197 $content_start =
@@ -1204,19 +1204,18 @@ class Poche
1204 . "<body>\n"; 1204 . "<body>\n";
1205 1205
1206 $bookEnd = "</body>\n</html>\n"; 1206 $bookEnd = "</body>\n</html>\n";
1207 1207
1208 $log = new Logger("wallabag", TRUE); 1208 $log = new Logger("wallabag", TRUE);
1209 $fileDir = CACHE; 1209 $fileDir = CACHE;
1210
1211 1210
1212 $book = new EPub(EPub::BOOK_VERSION_EPUB3); 1211 $book = new EPub(EPub::BOOK_VERSION_EPUB3, DEBUG_POCHE);
1213 $log->logLine("new EPub()"); 1212 $log->logLine("new EPub()");
1214 $log->logLine("EPub class version: " . EPub::VERSION); 1213 $log->logLine("EPub class version: " . EPub::VERSION);
1215 $log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION); 1214 $log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION);
1216 $log->logLine("Zip version: " . Zip::VERSION); 1215 $log->logLine("Zip version: " . Zip::VERSION);
1217 $log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL()); 1216 $log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL());
1218 $log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL()); 1217 $log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL());
1219 1218
1220 $book->setTitle(_('wallabag\'s articles')); 1219 $book->setTitle(_('wallabag\'s articles'));
1221 $book->setIdentifier("http://$_SERVER[HTTP_HOST]", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID. 1220 $book->setIdentifier("http://$_SERVER[HTTP_HOST]", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID.
1222 //$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc. 1221 //$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc.
@@ -1226,39 +1225,39 @@ class Poche
1226 $book->setDate(time()); // Strictly not needed as the book date defaults to time(). 1225 $book->setDate(time()); // Strictly not needed as the book date defaults to time().
1227 //$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book. 1226 //$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book.
1228 $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); 1227 $book->setSourceURL("http://$_SERVER[HTTP_HOST]");
1229 1228
1230 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); 1229 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP");
1231 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag"); 1230 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag");
1232 1231
1233 $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; 1232 $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n";
1234 1233
1235 $log->logLine("Add Cover"); 1234 $log->logLine("Add Cover");
1236 1235
1237 $fullTitle = "<h1> " . $bookTitle . "</h1>\n"; 1236 $fullTitle = "<h1> " . $bookTitle . "</h1>\n";
1238 1237
1239 $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $fullTitle); 1238 $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $fullTitle);
1240 1239
1241 $cover = $content_start . '<div style="text-align:center;"><p>' . _('Produced by wallabag with PHPePub') . '</p><p>'. _('Please open <a href="https://github.com/wallabag/wallabag/issues" >an issue</a> if you have trouble with the display of this E-Book on your device.') . '</p></div>' . $bookEnd; 1240 $cover = $content_start . '<div style="text-align:center;"><p>' . _('Produced by wallabag with PHPePub') . '</p><p>'. _('Please open <a href="https://github.com/wallabag/wallabag/issues" >an issue</a> if you have trouble with the display of this E-Book on your device.') . '</p></div>' . $bookEnd;
1242 1241
1243 //$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE); 1242 //$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE);
1244 $book->addChapter("Notices", "Cover2.html", $cover); 1243 $book->addChapter("Notices", "Cover2.html", $cover);
1245 1244
1246 $book->buildTOC(); 1245 $book->buildTOC();
1247 1246
1248 foreach ($entries as $entry) { //set tags as subjects 1247 foreach ($entries as $entry) { //set tags as subjects
1249 $tags = $this->store->retrieveTagsByEntry($entry['id']); 1248 $tags = $this->store->retrieveTagsByEntry($entry['id']);
1250 foreach ($tags as $tag) { 1249 foreach ($tags as $tag) {
1251 $book->setSubject($tag['value']); 1250 $book->setSubject($tag['value']);
1252 } 1251 }
1253 1252
1254 $log->logLine("Set up parameters"); 1253 $log->logLine("Set up parameters");
1255 1254
1256 $chapter = $content_start . $entry['content'] . $bookEnd; 1255 $chapter = $content_start . $entry['content'] . $bookEnd;
1257 $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); 1256 $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD);
1258 $log->logLine("Added chapter " . $entry['title']); 1257 $log->logLine("Added chapter " . $entry['title']);
1259 } 1258 }
1260 1259
1261 if (DEBUG_POCHE) { 1260 if (DEBUG_POCHE) {
1262 $epuplog = $book->getLog(); 1261 $epuplog = $book->getLog();
1263 $book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n</pre>" . $bookEnd); // log generation 1262 $book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n</pre>" . $bookEnd); // log generation
1264 } 1263 }
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 8073a3fe..cc01f403 100755
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -18,8 +18,6 @@ class Tools
18 die(_('Oops, it seems you don\'t have PHP 5.')); 18 die(_('Oops, it seems you don\'t have PHP 5.'));
19 } 19 }
20 20
21 error_reporting(E_ALL);
22
23 function stripslashesDeep($value) { 21 function stripslashesDeep($value) {
24 return is_array($value) 22 return is_array($value)
25 ? array_map('stripslashesDeep', $value) 23 ? array_map('stripslashesDeep', $value)
@@ -64,7 +62,7 @@ class Tools
64 if (strpos($host, ':') !== false) { 62 if (strpos($host, ':') !== false) {
65 $serverport = ''; 63 $serverport = '';
66 } 64 }
67 65
68 return 'http' . ($https ? 's' : '') . '://' 66 return 'http' . ($https ? 's' : '') . '://'
69 . $host . $serverport . $scriptname; 67 . $host . $serverport . $scriptname;
70 } 68 }
@@ -218,7 +216,7 @@ class Tools
218 216
219 public static function getDomain($url) 217 public static function getDomain($url)
220 { 218 {
221 return parse_url($url, PHP_URL_HOST); 219 return parse_url($url, PHP_URL_HOST);
222 } 220 }
223 221
224 public static function getReadingTime($text) { 222 public static function getReadingTime($text) {
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php
index ffcd205d..95f727c6 100755
--- a/inc/poche/config.inc.default.php
+++ b/inc/poche/config.inc.default.php
@@ -30,6 +30,10 @@
30 30
31@define ('MODE_DEMO', FALSE); 31@define ('MODE_DEMO', FALSE);
32@define ('DEBUG_POCHE', FALSE); 32@define ('DEBUG_POCHE', FALSE);
33
34//default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL.
35@define ('ERROR_REPORTING', E_ALL & ~E_NOTICE);
36
33@define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles 37@define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles
34@define ('REGENERATE_PICTURES_QUALITY', 75); 38@define ('REGENERATE_PICTURES_QUALITY', 75);
35@define ('CONVERT_LINKS_FOOTNOTES', FALSE); 39@define ('CONVERT_LINKS_FOOTNOTES', FALSE);