From 26b77483ee7545c0e4f8eeb205a5743bf3589adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 12 Jul 2014 16:39:31 +0200 Subject: remove PicoFarad MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’ll implement it an other day. --- inc/3rdparty/PicoFarad/Request.php | 78 ------------------ inc/3rdparty/PicoFarad/Response.php | 156 ----------------------------------- inc/3rdparty/PicoFarad/Router.php | 157 ------------------------------------ inc/3rdparty/PicoFarad/Session.php | 57 ------------- inc/3rdparty/PicoFarad/Template.php | 36 --------- inc/poche/Routing.class.php | 8 +- inc/poche/global.inc.php | 13 --- 7 files changed, 4 insertions(+), 501 deletions(-) delete mode 100644 inc/3rdparty/PicoFarad/Request.php delete mode 100644 inc/3rdparty/PicoFarad/Response.php delete mode 100644 inc/3rdparty/PicoFarad/Router.php delete mode 100644 inc/3rdparty/PicoFarad/Session.php delete mode 100644 inc/3rdparty/PicoFarad/Template.php (limited to 'inc') diff --git a/inc/3rdparty/PicoFarad/Request.php b/inc/3rdparty/PicoFarad/Request.php deleted file mode 100644 index 46c82bca..00000000 --- a/inc/3rdparty/PicoFarad/Request.php +++ /dev/null @@ -1,78 +0,0 @@ - $_FILES[$field]['name'], - 'mimetype' => $_FILES[$field]['type'], - 'size' => $_FILES[$field]['size'], - ); - } - - return false; -} - - -function file_move($field, $destination) -{ - if (isset($_FILES[$field]) && ! file_exists($destination)) { - @mkdir(dirname($destination), 0777, true); - move_uploaded_file($_FILES[$field]['tmp_name'], $destination); - } -} \ No newline at end of file diff --git a/inc/3rdparty/PicoFarad/Response.php b/inc/3rdparty/PicoFarad/Response.php deleted file mode 100644 index 9114fde0..00000000 --- a/inc/3rdparty/PicoFarad/Response.php +++ /dev/null @@ -1,156 +0,0 @@ - $hosts) { - - if (is_array($hosts)) { - - $acl = ''; - - foreach ($hosts as &$host) { - - if ($host === '*' || $host === 'self' || strpos($host, 'http') === 0) { - $acl .= $host.' '; - } - } - } - else { - - $acl = $hosts; - } - - $values .= $policy.' '.trim($acl).'; '; - } - - header('Content-Security-Policy: '.$values); -} - - -function nosniff() -{ - header('X-Content-Type-Options: nosniff'); -} - - -function xss() -{ - header('X-XSS-Protection: 1; mode=block'); -} - - -function hsts() -{ - header('Strict-Transport-Security: max-age=31536000'); -} - - -function xframe($mode = 'DENY', array $urls = array()) -{ - header('X-Frame-Options: '.$mode.' '.implode(' ', $urls)); -} \ No newline at end of file diff --git a/inc/3rdparty/PicoFarad/Router.php b/inc/3rdparty/PicoFarad/Router.php deleted file mode 100644 index b62b8e2d..00000000 --- a/inc/3rdparty/PicoFarad/Router.php +++ /dev/null @@ -1,157 +0,0 @@ - 'value']); -function load() -{ - if (func_num_args() < 1 || func_num_args() > 2) { - die('Invalid template arguments'); - } - - if (! file_exists(PATH.func_get_arg(0).'.php')) { - die('Unable to load the template: "'.func_get_arg(0).'"'); - } - - if (func_num_args() === 2) { - - if (! is_array(func_get_arg(1))) { - die('Template variables must be an array'); - } - - extract(func_get_arg(1)); - } - - ob_start(); - include PATH.func_get_arg(0).'.php'; - return ob_get_clean(); -} - - -function layout($template_name, array $template_args = array(), $layout_name = 'layout') -{ - return load($layout_name, $template_args + array('content_for_layout' => load($template_name, $template_args))); -} diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index 6e2c046b..8c2f38e3 100644 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php @@ -11,8 +11,8 @@ class Routing { protected $wallabag; - public $referer; - public $view; + protected $referer; + protected $view; protected $action; protected $id; protected $url; @@ -55,7 +55,7 @@ class Routing # because messages can be added in $poche->action(), we have to add this entry now (we can add it before) $this->vars = array_merge($this->vars, array('messages' => $this->wallabag->messages->display('all', FALSE))); - $this->render($this->file, $this->vars); + $this->_render($this->file, $this->vars); } private function _defineTplInformation() @@ -142,7 +142,7 @@ class Routing } } - public function render($file, $vars) + public function _render($file, $vars) { echo $this->wallabag->tpl->render($file, $vars); } diff --git a/inc/poche/global.inc.php b/inc/poche/global.inc.php index 9d710b6c..3eb64df0 100755 --- a/inc/poche/global.inc.php +++ b/inc/poche/global.inc.php @@ -40,12 +40,6 @@ require_once INCLUDES . '/3rdparty/libraries/PHPePub/Logger.php'; require_once INCLUDES . '/3rdparty/libraries/PHPePub/EPub.php'; require_once INCLUDES . '/3rdparty/libraries/PHPePub/EPubChapterSplitter.php'; -require_once INCLUDES . '/3rdparty/PicoFarad/Request.php'; -require_once INCLUDES . '/3rdparty/PicoFarad/Response.php'; -require_once INCLUDES . '/3rdparty/PicoFarad/Router.php'; -require_once INCLUDES . '/3rdparty/PicoFarad/Session.php'; -require_once INCLUDES . '/3rdparty/PicoFarad/Template.php'; - # system configuration; database credentials et caetera require_once INCLUDES . '/poche/config.inc.php'; require_once INCLUDES . '/poche/config.inc.default.php'; @@ -61,10 +55,3 @@ if (!ini_get('date.timezone') || !@date_default_timezone_set(ini_get('date.timez if (defined('ERROR_REPORTING')) { error_reporting(ERROR_REPORTING); } - -// Start session -Session::$sessionName = 'wallabag'; -Session::init(); - -// Let's rock ! -$wallabag = new Poche(); -- cgit v1.2.3