]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fixed #64 - nettoyage de MyTool
authornicosomb <nicolas@loeuillet.org>
Sun, 21 Apr 2013 16:42:20 +0000 (18:42 +0200)
committernicosomb <nicolas@loeuillet.org>
Sun, 21 Apr 2013 16:42:20 +0000 (18:42 +0200)
inc/MyTool.class.php
inc/functions.php
index.php

index 8206f3f7fa233028a6094e5edcc92b962f81d774..1f5051a43c165cc19f32ec4bbb2c5e99ac92a133 100644 (file)
@@ -1,4 +1,13 @@
 <?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @copyright  2013
+ * @license    http://www.wtfpl.net/ see COPYING file
+ */
 class MyTool
 {
     public static function initPhp()
index abf70a93429794a5bc60fced734f07466e87dda6..ec5b3d6a300678518554382c83302a0ce24d5359 100644 (file)
@@ -1,4 +1,12 @@
 <?php
+/**
+ * poche, a read it later open source system
+ *
+ * @category   poche
+ * @author     Nicolas Lœuillet <support@inthepoche.com>
+ * @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;
index 954d922473808a9af4086d98a0ef81637a132cd0..f64a04187fd50563e85cecf2b174d23eb1482535 100644 (file)
--- 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()) {