1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-12-24 08:18:48 -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
/**
* 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()

View 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,6 +308,7 @@ function action_to_do($action, $url, $id = 0)
if ($url == '')
continue;
if (MyTool::isUrl($url)) {
if($parametres_url = prepare_url($url)) {
$store->add($url, $parametres_url['title'], $parametres_url['content']);
$last_id = $store->getLastId();
@ -307,6 +316,10 @@ function action_to_do($action, $url, $id = 0)
$content = filtre_picture($parametres_url['content'], $url, $last_id);
}
}
}
else {
logm($url . ' is not a valid url');
}
logm('add link ' . $url);
break;

View File

@ -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()) {