1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-12-25 00:38:51 -05:00

Fixed #64 - nettoyage de MyTool

This commit is contained in:
nicosomb 2013-04-21 18:42:20 +02:00
parent 44e77bfa24
commit 6f87a19714
3 changed files with 30 additions and 7 deletions

View File

@ -1,4 +1,13 @@
<?php <?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 class MyTool
{ {
public static function initPhp() public static function initPhp()

View File

@ -1,4 +1,12 @@
<?php <?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 * 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': case 'export':
$entries = $store->retrieveAll(); $entries = $store->retrieveAll();
$tpl->assign('export', json_encode($entries)); $tpl->assign('export', myTool::renderJson($entries));
$tpl->draw('export'); $tpl->draw('export');
logm('export view'); logm('export view');
break; break;
@ -300,13 +308,18 @@ function action_to_do($action, $url, $id = 0)
if ($url == '') if ($url == '')
continue; continue;
if($parametres_url = prepare_url($url)) { if (MyTool::isUrl($url)) {
$store->add($url, $parametres_url['title'], $parametres_url['content']); if($parametres_url = prepare_url($url)) {
$last_id = $store->getLastId(); $store->add($url, $parametres_url['title'], $parametres_url['content']);
if (DOWNLOAD_PICTURES) { $last_id = $store->getLastId();
$content = filtre_picture($parametres_url['content'], $url, $last_id); if (DOWNLOAD_PICTURES) {
$content = filtre_picture($parametres_url['content'], $url, $last_id);
}
} }
} }
else {
logm($url . ' is not a valid url');
}
logm('add link ' . $url); logm('add link ' . $url);
break; break;

View File

@ -11,6 +11,7 @@
include dirname(__FILE__).'/inc/config.php'; include dirname(__FILE__).'/inc/config.php';
# initialize session # initialize session
myTool::initPhp();
Session::init(); Session::init();
# XSRF protection with token # XSRF protection with token
if (!empty($_POST)) { if (!empty($_POST)) {
@ -61,7 +62,7 @@ $url = (isset ($_GET['url'])) ? $_GET['url'] : '';
$tpl->assign('isLogged', Session::isLogged()); $tpl->assign('isLogged', Session::isLogged());
$tpl->assign('referer', $ref); $tpl->assign('referer', $ref);
$tpl->assign('view', $view); $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'); $tpl->assign('title', 'poche, a read it later open source system');
if (Session::isLogged()) { if (Session::isLogged()) {