aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas@loeuillet.org>2014-02-13 19:49:25 +0100
committerNicolas Lœuillet <nicolas@loeuillet.org>2014-02-13 19:49:25 +0100
commit5e98c2183ae824ab6a1dd2dc22f8619a0d718977 (patch)
tree24ab567d403c967a8b33de8750053abeeca0125a /inc
parent38dafee05d52948fba4a06066d7b0343c8e3de9d (diff)
parent9f3148fec787a51f837549907130e8ec980a0547 (diff)
downloadwallabag-5e98c2183ae824ab6a1dd2dc22f8619a0d718977.tar.gz
wallabag-5e98c2183ae824ab6a1dd2dc22f8619a0d718977.tar.zst
wallabag-5e98c2183ae824ab6a1dd2dc22f8619a0d718977.zip
Merge pull request #450 from wallabag/dev1.5.0
1.5.0
Diffstat (limited to 'inc')
-rw-r--r--inc/3rdparty/Session.class.php4
-rw-r--r--inc/poche/Database.class.php6
-rw-r--r--inc/poche/Poche.class.php28
-rwxr-xr-xinc/poche/config.inc.php.new2
4 files changed, 25 insertions, 15 deletions
diff --git a/inc/3rdparty/Session.class.php b/inc/3rdparty/Session.class.php
index 32624559..b30a31f3 100644
--- a/inc/3rdparty/Session.class.php
+++ b/inc/3rdparty/Session.class.php
@@ -31,9 +31,9 @@ class Session
31 public static $sessionName = ''; 31 public static $sessionName = '';
32 // If the user does not access any page within this time, 32 // If the user does not access any page within this time,
33 // his/her session is considered expired (3600 sec. = 1 hour) 33 // his/her session is considered expired (3600 sec. = 1 hour)
34 public static $inactivityTimeout = 3600; 34 public static $inactivityTimeout = 86400;
35 // Extra timeout for long sessions (if enabled) (82800 sec. = 23 hours) 35 // Extra timeout for long sessions (if enabled) (82800 sec. = 23 hours)
36 public static $longSessionTimeout = 82800; 36 public static $longSessionTimeout = 31536000;
37 // If you get disconnected often or if your IP address changes often. 37 // If you get disconnected often or if your IP address changes often.
38 // Let you disable session cookie hijacking protection 38 // Let you disable session cookie hijacking protection
39 public static $disableSessionProtection = false; 39 public static $disableSessionProtection = false;
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 0457af69..9f553fa1 100644
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -318,6 +318,12 @@ class Database {
318 $query = $this->executeQuery($sql_action, $params_action); 318 $query = $this->executeQuery($sql_action, $params_action);
319 } 319 }
320 320
321 public function archiveAll($user_id) {
322 $sql_action = "UPDATE entries SET is_read=? WHERE user_id=? AND is_read=?";
323 $params_action = array($user_id, 1, 0);
324 $query = $this->executeQuery($sql_action, $params_action);
325 }
326
321 public function getLastId($column = '') { 327 public function getLastId($column = '') {
322 return $this->getHandle()->lastInsertId($column); 328 return $this->getHandle()->lastInsertId($column);
323 } 329 }
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 4df90067..5eba3564 100644
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -101,7 +101,7 @@ class Poche
101 $passTheme = TRUE; 101 $passTheme = TRUE;
102 # Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet 102 # Twig is an absolute requirement for Poche to function. Abort immediately if the Composer installer hasn't been run yet
103 if (! self::$canRenderTemplates) { 103 if (! self::$canRenderTemplates) {
104 $this->notInstalledMessage[] = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. Have a look at <a href="http://doc.wallabag.org/doku.php?id=users:begin:install">the documentation.</a>'; 104 $this->notInstalledMessage[] = 'Twig does not seem to be installed. Please initialize the Composer installation to automatically fetch dependencies. You can also download <a href="http://wllbg.org/vendor">vendor.zip</a> and extract it in your wallabag folder.';
105 $passTheme = FALSE; 105 $passTheme = FALSE;
106 } 106 }
107 107
@@ -228,10 +228,6 @@ class Poche
228 # filter for reading time 228 # filter for reading time
229 $filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime'); 229 $filter = new Twig_SimpleFilter('getReadingTime', 'Tools::getReadingTime');
230 $this->tpl->addFilter($filter); 230 $this->tpl->addFilter($filter);
231
232 # filter for simple filenames in config view
233 $filter = new Twig_SimpleFilter('getPrettyFilename', function($string) { return str_replace(ROOT, '', $string); });
234 $this->tpl->addFilter($filter);
235 } 231 }
236 232
237 private function install() 233 private function install()
@@ -438,6 +434,13 @@ class Poche
438 Tools::redirect(); 434 Tools::redirect();
439 } 435 }
440 break; 436 break;
437 case 'archive_all' :
438 $this->store->archiveAll($this->user->getId());
439 Tools::logm('archive all links');
440 if (!$import) {
441 Tools::redirect();
442 }
443 break;
441 case 'add_tag' : 444 case 'add_tag' :
442 $tags = explode(',', $_POST['value']); 445 $tags = explode(',', $_POST['value']);
443 $entry_id = $_POST['entry_id']; 446 $entry_id = $_POST['entry_id'];
@@ -480,8 +483,8 @@ class Poche
480 switch ($view) 483 switch ($view)
481 { 484 {
482 case 'config': 485 case 'config':
483 $dev = $this->getPocheVersion('dev'); 486 $dev = trim($this->getPocheVersion('dev'));
484 $prod = $this->getPocheVersion('prod'); 487 $prod = trim($this->getPocheVersion('prod'));
485 $compare_dev = version_compare(POCHE, $dev); 488 $compare_dev = version_compare(POCHE, $dev);
486 $compare_prod = version_compare(POCHE, $prod); 489 $compare_prod = version_compare(POCHE, $prod);
487 $themes = $this->getInstalledThemes(); 490 $themes = $this->getInstalledThemes();
@@ -565,7 +568,8 @@ class Poche
565 568
566 if (count($entries) > 0) { 569 if (count($entries) > 0) {
567 $this->pagination->set_total(count($entries)); 570 $this->pagination->set_total(count($entries));
568 $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'); 571 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')),
572 $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'));
569 $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit()); 573 $datas = $this->store->getEntriesByView($view, $this->user->getId(), $this->pagination->get_limit());
570 $tpl_vars['entries'] = $datas; 574 $tpl_vars['entries'] = $datas;
571 $tpl_vars['page_links'] = $page_links; 575 $tpl_vars['page_links'] = $page_links;
@@ -726,7 +730,7 @@ class Poche
726 $longlastingsession = isset($_POST['longlastingsession']); 730 $longlastingsession = isset($_POST['longlastingsession']);
727 $passwordTest = ($isauthenticated) ? $user['password'] : Tools::encodeString($password . $login); 731 $passwordTest = ($isauthenticated) ? $user['password'] : Tools::encodeString($password . $login);
728 Session::login($user['username'], $user['password'], $login, $passwordTest, $longlastingsession, array('poche_user' => new User($user))); 732 Session::login($user['username'], $user['password'], $login, $passwordTest, $longlastingsession, array('poche_user' => new User($user)));
729 $this->messages->add('s', _('welcome to your poche')); 733 $this->messages->add('s', _('welcome to your wallabag'));
730 Tools::logm('login successful'); 734 Tools::logm('login successful');
731 Tools::redirect($referer); 735 Tools::redirect($referer);
732 } 736 }
@@ -745,7 +749,6 @@ class Poche
745 { 749 {
746 $this->user = array(); 750 $this->user = array();
747 Session::logout(); 751 Session::logout();
748 $this->messages->add('s', _('see you soon!'));
749 Tools::logm('logout'); 752 Tools::logm('logout');
750 Tools::redirect(); 753 Tools::redirect();
751 } 754 }
@@ -1009,6 +1012,7 @@ class Poche
1009 $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); 1012 $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20);
1010 } 1013 }
1011 1014
1015 $token = str_replace('+', '', $token);
1012 $this->store->updateUserConfig($this->user->getId(), 'token', $token); 1016 $this->store->updateUserConfig($this->user->getId(), 'token', $token);
1013 $currentConfig = $_SESSION['poche_user']->config; 1017 $currentConfig = $_SESSION['poche_user']->config;
1014 $currentConfig['token'] = $token; 1018 $currentConfig['token'] = $token;
@@ -1027,10 +1031,10 @@ class Poche
1027 // Check the token 1031 // Check the token
1028 1032
1029 $feed = new FeedWriter(RSS2); 1033 $feed = new FeedWriter(RSS2);
1030 $feed->setTitle('poche - ' . $type . ' feed'); 1034 $feed->setTitle('wallabag ' . $type . ' feed');
1031 $feed->setLink(Tools::getPocheUrl()); 1035 $feed->setLink(Tools::getPocheUrl());
1032 $feed->setChannelElement('updated', date(DATE_RSS , time())); 1036 $feed->setChannelElement('updated', date(DATE_RSS , time()));
1033 $feed->setChannelElement('author', 'poche'); 1037 $feed->setChannelElement('author', 'wallabag');
1034 1038
1035 if ($type == 'tag') { 1039 if ($type == 'tag') {
1036 $entries = $this->store->retrieveEntriesByTag($tag_id); 1040 $entries = $this->store->retrieveEntriesByTag($tag_id);
diff --git a/inc/poche/config.inc.php.new b/inc/poche/config.inc.php.new
index 39cb2f2f..8d52497b 100755
--- a/inc/poche/config.inc.php.new
+++ b/inc/poche/config.inc.php.new
@@ -44,7 +44,7 @@ define ('FLATTRABLE', '1');
44define ('FLATTRED', '2'); 44define ('FLATTRED', '2');
45define ('ABS_PATH', 'assets/'); 45define ('ABS_PATH', 'assets/');
46 46
47define ('DEFAULT_THEME', 'default'); 47define ('DEFAULT_THEME', 'baggy');
48 48
49define ('THEME', ROOT . '/themes'); 49define ('THEME', ROOT . '/themes');
50define ('LOCALE', ROOT . '/locale'); 50define ('LOCALE', ROOT . '/locale');