From bc1ee8524e0769ad37e3c4c02cfe96d2f60e52f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Wed, 7 Aug 2013 14:24:07 +0200 Subject: postgres --- inc/poche/Poche.class.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index ce5bb54a..0a43df71 100644 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -16,9 +16,9 @@ class Poche public $messages; public $pagination; - function __construct($storage_type) + function __construct() { - $this->store = new $storage_type(); + $this->store = new Database(); $this->init(); $this->messages = new Messages(); @@ -52,9 +52,13 @@ class Poche # template engine $loader = new Twig_Loader_Filesystem(TPL); - $this->tpl = new Twig_Environment($loader, array( - 'cache' => CACHE, - )); + if (DEBUG_POCHE) { + $twig_params = array(); + } + else { + $twig_params = array('cache' => CACHE); + } + $this->tpl = new Twig_Environment($loader, $twig_params); $this->tpl->addExtension(new Twig_Extensions_Extension_I18n()); # filter to display domain name of an url $filter = new Twig_SimpleFilter('getDomain', 'Tools::getDomain'); @@ -124,18 +128,19 @@ class Poche Tools::redirect(); break; case 'delete': + $msg = 'delete link #' . $id; if ($this->store->deleteById($id, $this->user->getId())) { if (DOWNLOAD_PICTURES) { remove_directory(ABS_PATH . $id); } $this->messages->add('s', _('the link has been deleted successfully')); - Tools::logm('delete link #' . $id); } else { $this->messages->add('e', _('the link wasn\'t deleted')); - Tools::logm('error : can\'t delete link #' . $id); + $msg = 'error : can\'t delete link #' . $id; } - Tools::redirect(); + Tools::logm($msg); + Tools::redirect('?'); break; case 'toggle_fav' : $this->store->favoriteById($id, $this->user->getId()); @@ -385,7 +390,7 @@ class Poche if (file_exists($cache_file) && (filemtime($cache_file) > (time() - 86400 ))) { $version = file_get_contents($cache_file); } else { - $version = file_get_contents('http://www.inthepoche.com/' . $which); + $version = file_get_contents('http://static.inthepoche.com/versions/' . $which); file_put_contents($cache_file, $version, LOCK_EX); } return $version; -- cgit v1.2.3