From 6f87a19714057e370a6b970bbfb82af5abd968f9 Mon Sep 17 00:00:00 2001 From: nicosomb Date: Sun, 21 Apr 2013 18:42:20 +0200 Subject: Fixed #64 - nettoyage de MyTool --- inc/functions.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'inc/functions.php') 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; -- cgit v1.2.3