diff options
Diffstat (limited to 'inc/poche')
-rw-r--r-- | inc/poche/Database.class.php | 14 | ||||
-rw-r--r-- | inc/poche/Poche.class.php | 25 | ||||
-rwxr-xr-x | inc/poche/config.inc.php.new | 14 |
3 files changed, 37 insertions, 16 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 4d664992..0662581b 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -113,9 +113,17 @@ class Database { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | public function updateUserConfig($userId, $key, $value) { | 115 | public function updateUserConfig($userId, $key, $value) { |
116 | $sql_update = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?"; | 116 | $config = $this->getConfigUser($userId); |
117 | $params_update = array($value, $userId, $key); | 117 | |
118 | $query = $this->executeQuery($sql_update, $params_update); | 118 | if (!isset ($user_config[$key])) { |
119 | $sql = "INSERT INTO users_config (`value`, `user_id`, `name`) VALUES (?, ?, ?)"; | ||
120 | } | ||
121 | else { | ||
122 | $sql = "UPDATE users_config SET `value`=? WHERE `user_id`=? AND `name`=?"; | ||
123 | } | ||
124 | |||
125 | $params = array($value, $userId, $key); | ||
126 | $query = $this->executeQuery($sql, $params); | ||
119 | } | 127 | } |
120 | 128 | ||
121 | private function executeQuery($sql, $params) { | 129 | private function executeQuery($sql, $params) { |
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 6907e649..8f54267d 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -109,6 +109,14 @@ class Poche | |||
109 | 109 | ||
110 | return false; | 110 | return false; |
111 | } | 111 | } |
112 | |||
113 | if (! is_writable(CACHE)) { | ||
114 | $this->notInstalledMessage = '<h1>error</h1><p>You don\'t have write access on cache directory.</p>'; | ||
115 | |||
116 | self::$canRenderTemplates = false; | ||
117 | |||
118 | return false; | ||
119 | } | ||
112 | 120 | ||
113 | # Check if the selected theme and its requirements are present | 121 | # Check if the selected theme and its requirements are present |
114 | if (! is_dir(THEME . '/' . $this->getTheme())) { | 122 | if (! is_dir(THEME . '/' . $this->getTheme())) { |
@@ -145,16 +153,11 @@ class Poche | |||
145 | 153 | ||
146 | if (empty($configSalt)) { | 154 | if (empty($configSalt)) { |
147 | $msg = '<h1>error</h1><p>You have not yet filled in the SALT value in the config.inc.php file.</p>'; | 155 | $msg = '<h1>error</h1><p>You have not yet filled in the SALT value in the config.inc.php file.</p>'; |
148 | } else if (! is_writable(CACHE)) { | ||
149 | Tools::logm('you don\'t have write access on cache directory'); | ||
150 | $msg = '<h1>error</h1><p>You don\'t have write access on cache directory.</p>'; | ||
151 | } else if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) { | 156 | } else if (STORAGE == 'sqlite' && ! file_exists(STORAGE_SQLITE)) { |
152 | Tools::logm('sqlite file doesn\'t exist'); | 157 | Tools::logm('sqlite file doesn\'t exist'); |
153 | $msg = '<h1>error</h1><p>sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.</p>'; | 158 | $msg = '<h1>error</h1><p>sqlite file doesn\'t exist, you can find it in install folder. Copy it in /db folder.</p>'; |
154 | } else if (file_exists(ROOT . '/install/update.php') && ! DEBUG_POCHE) { | ||
155 | $msg = '<h1>setup</h1><p><strong>It\'s your first time here?</strong> Please copy /install/poche.sqlite in db folder. Then, delete install folder.<br /><strong>If you have already installed poche</strong>, an update is needed <a href="install/update.php">by clicking here</a>.</p>'; | ||
156 | } else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) { | 159 | } else if (is_dir(ROOT . '/install') && ! DEBUG_POCHE) { |
157 | $msg = '<h1>setup</h1><p><strong>If you want to update your poche</strong>, you just have to delete /install folder. <br /><strong>To install your poche with sqlite</strong>, copy /install/poche.sqlite in /db and delete the folder /install. you have to delete the /install folder before using poche.</p>'; | 160 | $msg = '<h1>install folder</h1><p>you have to delete the /install folder before using poche.</p>'; |
158 | } else if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) { | 161 | } else if (STORAGE == 'sqlite' && ! is_writable(STORAGE_SQLITE)) { |
159 | Tools::logm('you don\'t have write access on sqlite file'); | 162 | Tools::logm('you don\'t have write access on sqlite file'); |
160 | $msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>'; | 163 | $msg = '<h1>error</h1><p>You don\'t have write access on sqlite file.</p>'; |
@@ -255,7 +258,7 @@ class Poche | |||
255 | while (($theme = readdir($handle)) !== false) { | 258 | while (($theme = readdir($handle)) !== false) { |
256 | # Themes are stored in a directory, so all directory names are themes | 259 | # Themes are stored in a directory, so all directory names are themes |
257 | # @todo move theme installation data to database | 260 | # @todo move theme installation data to database |
258 | if (! is_dir(THEME . '/' . $theme) || in_array($theme, array('..', '.'))) { | 261 | if (! is_dir(THEME . '/' . $theme) || in_array($theme, array('..', '.', '.git'))) { |
259 | continue; | 262 | continue; |
260 | } | 263 | } |
261 | 264 | ||
@@ -330,7 +333,7 @@ class Poche | |||
330 | $msg = 'error : can\'t delete link #' . $id; | 333 | $msg = 'error : can\'t delete link #' . $id; |
331 | } | 334 | } |
332 | Tools::logm($msg); | 335 | Tools::logm($msg); |
333 | Tools::redirect('?'); | 336 | Tools::redirect(); |
334 | break; | 337 | break; |
335 | case 'toggle_fav' : | 338 | case 'toggle_fav' : |
336 | $this->store->favoriteById($id, $this->user->getId()); | 339 | $this->store->favoriteById($id, $this->user->getId()); |
@@ -404,6 +407,12 @@ class Poche | |||
404 | 'page_links' => '', | 407 | 'page_links' => '', |
405 | 'nb_results' => '', | 408 | 'nb_results' => '', |
406 | ); | 409 | ); |
410 | |||
411 | # want to display a page too far? | ||
412 | if ((count($entries) % PAGINATION) + 1 < $_GET['p']) { | ||
413 | Tools::redirect(''); | ||
414 | } | ||
415 | |||
407 | if (count($entries) > 0) { | 416 | if (count($entries) > 0) { |
408 | $this->pagination->set_total(count($entries)); | 417 | $this->pagination->set_total(count($entries)); |
409 | $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'); | 418 | $page_links = $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . '&'); |
diff --git a/inc/poche/config.inc.php.new b/inc/poche/config.inc.php.new index 48cc5783..255b97e6 100755 --- a/inc/poche/config.inc.php.new +++ b/inc/poche/config.inc.php.new | |||
@@ -26,7 +26,7 @@ define ('STORAGE_PASSWORD', 'poche'); | |||
26 | ################################################################################# | 26 | ################################################################################# |
27 | 27 | ||
28 | define ('MODE_DEMO', FALSE); | 28 | define ('MODE_DEMO', FALSE); |
29 | define ('DEBUG_POCHE', true); | 29 | define ('DEBUG_POCHE', FALSE); |
30 | define ('DOWNLOAD_PICTURES', FALSE); | 30 | define ('DOWNLOAD_PICTURES', FALSE); |
31 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); | 31 | define ('CONVERT_LINKS_FOOTNOTES', FALSE); |
32 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); | 32 | define ('REVERT_FORCED_PARAGRAPH_ELEMENTS', FALSE); |
@@ -49,8 +49,12 @@ define ('CACHE', ROOT . '/cache'); | |||
49 | 49 | ||
50 | define ('PAGINATION', '10'); | 50 | define ('PAGINATION', '10'); |
51 | 51 | ||
52 | define ('POCHE_VERSION', '1.0-beta5'); | 52 | define ('POCHE_VERSION', '1.0.0'); |
53 | 53 | ||
54 | define ('IMPORT_POCKET_FILE', ROOT . '/ril_export.html'); | 54 | define ('POCKET_FILE', '/ril_export.html'); |
55 | define ('IMPORT_READABILITY_FILE', ROOT . '/readability'); | 55 | define ('READABILITY_FILE', '/readability'); |
56 | define ('IMPORT_INSTAPAPER_FILE', ROOT . '/instapaper-export.html'); \ No newline at end of file | 56 | define ('INSTAPAPER_FILE', '/instapaper-export.html'); |
57 | |||
58 | define ('IMPORT_POCKET_FILE', ROOT . POCKET_FILE); | ||
59 | define ('IMPORT_READABILITY_FILE', ROOT . READABILITY_FILE); | ||
60 | define ('IMPORT_INSTAPAPER_FILE', ROOT . INSTAPAPER_FILE); \ No newline at end of file | ||