diff options
author | Thomas Citharel <tcit@tcit.fr> | 2015-02-13 17:14:08 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2015-02-13 17:14:08 +0100 |
commit | 57068585c0a1164f1ae7ae399f3d5a68a4e9d46d (patch) | |
tree | 479969a1a9888c34285e0f84a8186561ebe980e7 /inc | |
parent | 1be071f9f0fba7c93f114a886ff19199955a3f02 (diff) | |
parent | af13787e74ea45d7edc1005810f15a8baa428a77 (diff) | |
download | wallabag-57068585c0a1164f1ae7ae399f3d5a68a4e9d46d.tar.gz wallabag-57068585c0a1164f1ae7ae399f3d5a68a4e9d46d.tar.zst wallabag-57068585c0a1164f1ae7ae399f3d5a68a4e9d46d.zip |
Merge branch 'dev' into sendmailatregistration
Diffstat (limited to 'inc')
-rwxr-xr-x | inc/3rdparty/site_config/standard/gist.github.com.txt | 8 | ||||
-rw-r--r-- | inc/3rdparty/site_config/standard/jungle-world.com.txt | 3 | ||||
-rwxr-xr-x | inc/3rdparty/site_config/standard/toolinux.com.txt | 5 | ||||
-rwxr-xr-x | inc/poche/Database.class.php | 4 | ||||
-rwxr-xr-x | inc/poche/Poche.class.php | 53 | ||||
-rwxr-xr-x | inc/poche/Routing.class.php | 3 | ||||
-rw-r--r-- | inc/poche/WallabagEBooks.class.php | 3 | ||||
-rwxr-xr-x | inc/poche/config.inc.default.php | 2 |
8 files changed, 60 insertions, 21 deletions
diff --git a/inc/3rdparty/site_config/standard/gist.github.com.txt b/inc/3rdparty/site_config/standard/gist.github.com.txt index 90207862..f11b7b42 100755 --- a/inc/3rdparty/site_config/standard/gist.github.com.txt +++ b/inc/3rdparty/site_config/standard/gist.github.com.txt | |||
@@ -1,6 +1,4 @@ | |||
1 | body: //div[@class="highlight"]/pre | ||
2 | 1 | ||
3 | prune: no | 2 | title: //div[contains(@class,'gist-description')] |
4 | tidy: no | 3 | body: //div[contains(@class,'blob-wrapper')] |
5 | 4 | test_url: https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 | |
6 | test_url: https://gist.github.com/1258908 \ No newline at end of file | ||
diff --git a/inc/3rdparty/site_config/standard/jungle-world.com.txt b/inc/3rdparty/site_config/standard/jungle-world.com.txt new file mode 100644 index 00000000..61e0087f --- /dev/null +++ b/inc/3rdparty/site_config/standard/jungle-world.com.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | title: //h1 | ||
2 | body: //div[contains(@class,'story')] | ||
3 | test_url: http://jungle-world.com/artikel/2015/02/51207.html | ||
diff --git a/inc/3rdparty/site_config/standard/toolinux.com.txt b/inc/3rdparty/site_config/standard/toolinux.com.txt new file mode 100755 index 00000000..3f1a8405 --- /dev/null +++ b/inc/3rdparty/site_config/standard/toolinux.com.txt | |||
@@ -0,0 +1,5 @@ | |||
1 | title: //h2[contains(@class,'news')] | ||
2 | body: //div[contains(@class,'articleContent')] | ||
3 | date: substring-after(//div[@class = 'SupaDate']/text(), 'le') | ||
4 | |||
5 | test_url: http://www.toolinux.com/Wi-Fi-Linksys-WRT-la-legende-de | ||
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index f6ba4708..6bac0f5d 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -293,7 +293,7 @@ class Database { | |||
293 | $sql_limit = "LIMIT ".$limit." OFFSET 0"; | 293 | $sql_limit = "LIMIT ".$limit." OFFSET 0"; |
294 | } | 294 | } |
295 | 295 | ||
296 | $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=? ORDER BY id " . $sql_limit; | 296 | $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE '%Import%' AND user_id=? ORDER BY id " . $sql_limit; |
297 | $query = $this->executeQuery($sql, array($user_id)); | 297 | $query = $this->executeQuery($sql, array($user_id)); |
298 | $entries = $query->fetchAll(); | 298 | $entries = $query->fetchAll(); |
299 | 299 | ||
@@ -302,7 +302,7 @@ class Database { | |||
302 | 302 | ||
303 | public function retrieveUnfetchedEntriesCount($user_id) | 303 | public function retrieveUnfetchedEntriesCount($user_id) |
304 | { | 304 | { |
305 | $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=?"; | 305 | $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE '%Import%' AND user_id=?"; |
306 | $query = $this->executeQuery($sql, array($user_id)); | 306 | $query = $this->executeQuery($sql, array($user_id)); |
307 | list($count) = $query->fetch(); | 307 | list($count) = $query->fetch(); |
308 | 308 | ||
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e89e9d30..b26826f1 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -214,9 +214,9 @@ class Poche | |||
214 | } | 214 | } |
215 | 215 | ||
216 | if ($autoclose == TRUE) { | 216 | if ($autoclose == TRUE) { |
217 | Tools::redirect('?view=home'); | 217 | Tools::redirect('?view=home&closewin=true'); |
218 | } else { | 218 | } else { |
219 | Tools::redirect('?view=home&closewin=true'); | 219 | Tools::redirect('?view=home'); |
220 | } | 220 | } |
221 | return $last_id; | 221 | return $last_id; |
222 | break; | 222 | break; |
@@ -356,6 +356,27 @@ class Poche | |||
356 | $this->messages->add('s', _('The tag has been successfully deleted')); | 356 | $this->messages->add('s', _('The tag has been successfully deleted')); |
357 | Tools::redirect(); | 357 | Tools::redirect(); |
358 | break; | 358 | break; |
359 | |||
360 | case 'reload_article' : | ||
361 | Tools::logm('reload article'); | ||
362 | $id = $_GET['id']; | ||
363 | $entry = $this->store->retrieveOneById($id, $this->user->getId()); | ||
364 | Tools::logm('reload url ' . $entry['url']); | ||
365 | $url = new Url(base64_encode($entry['url'])); | ||
366 | $this->action('add', $url); | ||
367 | break; | ||
368 | |||
369 | /* For some unknown reason I can't get displayView() to work here (it redirects to home view afterwards). So here's a dirty fix which redirects directly to URL */ | ||
370 | case 'random': | ||
371 | $id = 0; | ||
372 | while ($this->store->retrieveOneById($id,$this->user->getId()) == null) { | ||
373 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId()); | ||
374 | $id = rand(1,$count); | ||
375 | } | ||
376 | Tools::logm('get a random article'); | ||
377 | Tools::redirect('?view=view&id=' . $id); | ||
378 | //$this->displayView('view', $id); | ||
379 | break; | ||
359 | default: | 380 | default: |
360 | break; | 381 | break; |
361 | } | 382 | } |
@@ -738,17 +759,23 @@ class Poche | |||
738 | $purifier = $this->_getPurifier(); | 759 | $purifier = $this->_getPurifier(); |
739 | foreach($items as $item) { | 760 | foreach($items as $item) { |
740 | $url = new Url(base64_encode($item['url'])); | 761 | $url = new Url(base64_encode($item['url'])); |
741 | Tools::logm('Fetching article ' . $item['id']); | 762 | if( $url->isCorrect() ) |
742 | $content = Tools::getPageContent($url); | 763 | { |
743 | $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); | 764 | Tools::logm('Fetching article ' . $item['id']); |
744 | $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); | 765 | $content = Tools::getPageContent($url); |
745 | 766 | $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); | |
746 | // clean content to prevent xss attack | 767 | $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); |
747 | 768 | ||
748 | $title = $purifier->purify($title); | 769 | // clean content to prevent xss attack |
749 | $body = $purifier->purify($body); | 770 | |
750 | $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); | 771 | $title = $purifier->purify($title); |
751 | Tools::logm('Article ' . $item['id'] . ' updated.'); | 772 | $body = $purifier->purify($body); |
773 | $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); | ||
774 | Tools::logm('Article ' . $item['id'] . ' updated.'); | ||
775 | } else | ||
776 | { | ||
777 | Tools::logm('Unvalid URL (' . $item['url'] .') to fetch for article ' . $item['id']); | ||
778 | } | ||
752 | } | 779 | } |
753 | } | 780 | } |
754 | } | 781 | } |
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index b8cab0ec..82ff20d6 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php | |||
@@ -33,6 +33,7 @@ class Routing | |||
33 | $this->view = Tools::checkVar('view', 'home'); | 33 | $this->view = Tools::checkVar('view', 'home'); |
34 | $this->action = Tools::checkVar('action'); | 34 | $this->action = Tools::checkVar('action'); |
35 | $this->id = Tools::checkVar('id'); | 35 | $this->id = Tools::checkVar('id'); |
36 | $this->autoclose = Tools::checkVar('autoclose',FALSE); | ||
36 | $_SESSION['sort'] = Tools::checkVar('sort', 'id'); | 37 | $_SESSION['sort'] = Tools::checkVar('sort', 'id'); |
37 | $this->url = new Url((isset ($_GET['url'])) ? $_GET['url'] : ''); | 38 | $this->url = new Url((isset ($_GET['url'])) ? $_GET['url'] : ''); |
38 | } | 39 | } |
@@ -64,7 +65,7 @@ class Routing | |||
64 | $tplVars = array(); | 65 | $tplVars = array(); |
65 | 66 | ||
66 | if (\Session::isLogged()) { | 67 | if (\Session::isLogged()) { |
67 | $this->wallabag->action($this->action, $this->url, $this->id); | 68 | $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose); |
68 | $tplFile = Tools::getTplFile($this->view); | 69 | $tplFile = Tools::getTplFile($this->view); |
69 | $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); | 70 | $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); |
70 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { | 71 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { |
diff --git a/inc/poche/WallabagEBooks.class.php b/inc/poche/WallabagEBooks.class.php index d31939a1..55831571 100644 --- a/inc/poche/WallabagEBooks.class.php +++ b/inc/poche/WallabagEBooks.class.php | |||
@@ -202,6 +202,9 @@ class WallabagMobi extends WallabagEBooks | |||
202 | } | 202 | } |
203 | $mobi->setContentProvider($content); | 203 | $mobi->setContentProvider($content); |
204 | 204 | ||
205 | // the browser inside Kindle Devices doesn't likes special caracters either, we limit to A-z/0-9 | ||
206 | $this->bookFileName = preg_replace('/[^A-Za-z0-9\-]/', '', $this->bookFileName); | ||
207 | |||
205 | // we offer file to download | 208 | // we offer file to download |
206 | $mobi->download($this->bookFileName.'.mobi'); | 209 | $mobi->download($this->bookFileName.'.mobi'); |
207 | Tools::logm('Mobi file produced'); | 210 | Tools::logm('Mobi file produced'); |
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index a159e713..91b50c24 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php | |||
@@ -44,6 +44,7 @@ | |||
44 | @define ('SHARE_MAIL', TRUE); | 44 | @define ('SHARE_MAIL', TRUE); |
45 | @define ('SHARE_SHAARLI', FALSE); | 45 | @define ('SHARE_SHAARLI', FALSE); |
46 | @define ('SHAARLI_URL', 'http://myshaarliurl.com'); | 46 | @define ('SHAARLI_URL', 'http://myshaarliurl.com'); |
47 | @define ('SHARE_EVERNOTE', FALSE); | ||
47 | @define ('SHARE_DIASPORA', FALSE); | 48 | @define ('SHARE_DIASPORA', FALSE); |
48 | @define ('DIASPORA_URL', 'http://diasporapod.com'); # Don't add a / at the end | 49 | @define ('DIASPORA_URL', 'http://diasporapod.com'); # Don't add a / at the end |
49 | @define ('FLATTR', TRUE); | 50 | @define ('FLATTR', TRUE); |
@@ -62,6 +63,7 @@ | |||
62 | @define ('SHOW_PRINTLINK', '1'); | 63 | @define ('SHOW_PRINTLINK', '1'); |
63 | // display or not percent of read in article view. Affects only default theme. | 64 | // display or not percent of read in article view. Affects only default theme. |
64 | @define ('SHOW_READPERCENT', '1'); | 65 | @define ('SHOW_READPERCENT', '1'); |
66 | @define ('RELOAD_ARTICLE', TRUE); | ||
65 | @define ('ABS_PATH', 'assets/'); | 67 | @define ('ABS_PATH', 'assets/'); |
66 | 68 | ||
67 | @define ('DEFAULT_THEME', 'baggy'); | 69 | @define ('DEFAULT_THEME', 'baggy'); |