diff options
author | nicosomb <nicolas@loeuillet.org> | 2013-04-21 18:42:20 +0200 |
---|---|---|
committer | nicosomb <nicolas@loeuillet.org> | 2013-04-21 18:42:20 +0200 |
commit | 6f87a19714057e370a6b970bbfb82af5abd968f9 (patch) | |
tree | da361e8de0c275e7ae4735fedff6ce414ecb781d | |
parent | 44e77bfa2481090e559b56fd8ffbe5b175ab55ca (diff) | |
download | wallabag-6f87a19714057e370a6b970bbfb82af5abd968f9.tar.gz wallabag-6f87a19714057e370a6b970bbfb82af5abd968f9.tar.zst wallabag-6f87a19714057e370a6b970bbfb82af5abd968f9.zip |
Fixed #64 - nettoyage de MyTool
-rw-r--r-- | inc/MyTool.class.php | 9 | ||||
-rw-r--r-- | inc/functions.php | 25 | ||||
-rw-r--r-- | index.php | 3 |
3 files changed, 30 insertions, 7 deletions
diff --git a/inc/MyTool.class.php b/inc/MyTool.class.php index 8206f3f7..1f5051a4 100644 --- a/inc/MyTool.class.php +++ b/inc/MyTool.class.php | |||
@@ -1,4 +1,13 @@ | |||
1 | <?php | 1 | <?php |
2 | /** | ||
3 | * poche, a read it later open source system | ||
4 | * | ||
5 | * @category poche | ||
6 | * @author Nicolas Lœuillet <support@inthepoche.com> | ||
7 | * @copyright 2013 | ||
8 | * @license http://www.wtfpl.net/ see COPYING file | ||
9 | */ | ||
10 | |||
2 | class MyTool | 11 | class MyTool |
3 | { | 12 | { |
4 | public static function initPhp() | 13 | public static function initPhp() |
diff --git a/inc/functions.php b/inc/functions.php index abf70a93..ec5b3d6a 100644 --- a/inc/functions.php +++ b/inc/functions.php | |||
@@ -1,4 +1,12 @@ | |||
1 | <?php | 1 | <?php |
2 | /** | ||
3 | * poche, a read it later open source system | ||
4 | * | ||
5 | * @category poche | ||
6 | * @author Nicolas Lœuillet <support@inthepoche.com> | ||
7 | * @copyright 2013 | ||
8 | * @license http://www.wtfpl.net/ see COPYING file | ||
9 | */ | ||
2 | 10 | ||
3 | /** | 11 | /** |
4 | * Permet de générer l'URL de poche pour le bookmarklet | 12 | * Permet de générer l'URL de poche pour le bookmarklet |
@@ -234,7 +242,7 @@ function display_view($view, $id = 0, $full_head = 'yes') | |||
234 | { | 242 | { |
235 | case 'export': | 243 | case 'export': |
236 | $entries = $store->retrieveAll(); | 244 | $entries = $store->retrieveAll(); |
237 | $tpl->assign('export', json_encode($entries)); | 245 | $tpl->assign('export', myTool::renderJson($entries)); |
238 | $tpl->draw('export'); | 246 | $tpl->draw('export'); |
239 | logm('export view'); | 247 | logm('export view'); |
240 | break; | 248 | break; |
@@ -300,13 +308,18 @@ function action_to_do($action, $url, $id = 0) | |||
300 | if ($url == '') | 308 | if ($url == '') |
301 | continue; | 309 | continue; |
302 | 310 | ||
303 | if($parametres_url = prepare_url($url)) { | 311 | if (MyTool::isUrl($url)) { |
304 | $store->add($url, $parametres_url['title'], $parametres_url['content']); | 312 | if($parametres_url = prepare_url($url)) { |
305 | $last_id = $store->getLastId(); | 313 | $store->add($url, $parametres_url['title'], $parametres_url['content']); |
306 | if (DOWNLOAD_PICTURES) { | 314 | $last_id = $store->getLastId(); |
307 | $content = filtre_picture($parametres_url['content'], $url, $last_id); | 315 | if (DOWNLOAD_PICTURES) { |
316 | $content = filtre_picture($parametres_url['content'], $url, $last_id); | ||
317 | } | ||
308 | } | 318 | } |
309 | } | 319 | } |
320 | else { | ||
321 | logm($url . ' is not a valid url'); | ||
322 | } | ||
310 | 323 | ||
311 | logm('add link ' . $url); | 324 | logm('add link ' . $url); |
312 | break; | 325 | break; |
@@ -11,6 +11,7 @@ | |||
11 | include dirname(__FILE__).'/inc/config.php'; | 11 | include dirname(__FILE__).'/inc/config.php'; |
12 | 12 | ||
13 | # initialize session | 13 | # initialize session |
14 | myTool::initPhp(); | ||
14 | Session::init(); | 15 | Session::init(); |
15 | # XSRF protection with token | 16 | # XSRF protection with token |
16 | if (!empty($_POST)) { | 17 | if (!empty($_POST)) { |
@@ -61,7 +62,7 @@ $url = (isset ($_GET['url'])) ? $_GET['url'] : ''; | |||
61 | $tpl->assign('isLogged', Session::isLogged()); | 62 | $tpl->assign('isLogged', Session::isLogged()); |
62 | $tpl->assign('referer', $ref); | 63 | $tpl->assign('referer', $ref); |
63 | $tpl->assign('view', $view); | 64 | $tpl->assign('view', $view); |
64 | $tpl->assign('poche_url', get_poche_url()); | 65 | $tpl->assign('poche_url', myTool::getUrl()); |
65 | $tpl->assign('title', 'poche, a read it later open source system'); | 66 | $tpl->assign('title', 'poche, a read it later open source system'); |
66 | 67 | ||
67 | if (Session::isLogged()) { | 68 | if (Session::isLogged()) { |