From: nicosomb Date: Sun, 21 Apr 2013 16:42:20 +0000 (+0200) Subject: Fixed #64 - nettoyage de MyTool X-Git-Tag: 0.2~1 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=6f87a19714057e370a6b970bbfb82af5abd968f9;p=github%2Fwallabag%2Fwallabag.git Fixed #64 - nettoyage de MyTool --- 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 @@ + * @copyright 2013 + * @license http://www.wtfpl.net/ see COPYING file + */ + class MyTool { 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 @@ + * @copyright 2013 + * @license http://www.wtfpl.net/ see COPYING file + */ /** * 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') { case 'export': $entries = $store->retrieveAll(); - $tpl->assign('export', json_encode($entries)); + $tpl->assign('export', myTool::renderJson($entries)); $tpl->draw('export'); logm('export view'); break; @@ -300,13 +308,18 @@ function action_to_do($action, $url, $id = 0) if ($url == '') continue; - if($parametres_url = prepare_url($url)) { - $store->add($url, $parametres_url['title'], $parametres_url['content']); - $last_id = $store->getLastId(); - if (DOWNLOAD_PICTURES) { - $content = filtre_picture($parametres_url['content'], $url, $last_id); + if (MyTool::isUrl($url)) { + if($parametres_url = prepare_url($url)) { + $store->add($url, $parametres_url['title'], $parametres_url['content']); + $last_id = $store->getLastId(); + if (DOWNLOAD_PICTURES) { + $content = filtre_picture($parametres_url['content'], $url, $last_id); + } } } + else { + logm($url . ' is not a valid url'); + } logm('add link ' . $url); break; diff --git a/index.php b/index.php index 954d9224..f64a0418 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,7 @@ include dirname(__FILE__).'/inc/config.php'; # initialize session +myTool::initPhp(); Session::init(); # XSRF protection with token if (!empty($_POST)) { @@ -61,7 +62,7 @@ $url = (isset ($_GET['url'])) ? $_GET['url'] : ''; $tpl->assign('isLogged', Session::isLogged()); $tpl->assign('referer', $ref); $tpl->assign('view', $view); -$tpl->assign('poche_url', get_poche_url()); +$tpl->assign('poche_url', myTool::getUrl()); $tpl->assign('title', 'poche, a read it later open source system'); if (Session::isLogged()) {