aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--inc/MyTool.class.php9
-rw-r--r--inc/functions.php25
-rw-r--r--index.php3
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
2class MyTool 11class 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;
diff --git a/index.php b/index.php
index 954d9224..f64a0418 100644
--- a/index.php
+++ b/index.php
@@ -11,6 +11,7 @@
11include dirname(__FILE__).'/inc/config.php'; 11include dirname(__FILE__).'/inc/config.php';
12 12
13# initialize session 13# initialize session
14myTool::initPhp();
14Session::init(); 15Session::init();
15# XSRF protection with token 16# XSRF protection with token
16if (!empty($_POST)) { 17if (!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
67if (Session::isLogged()) { 68if (Session::isLogged()) {