From d91a92434f516a9e25bf0dca608a0221094d0489 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 18 Jan 2015 11:47:16 +0100 Subject: Fix Minz_Error and error_Controller - Error code and logs was not propagated from Minz_Error to the controller - header was bad (200 instead of 404 or 403) Related to https://github.com/FreshRSS/FreshRSS/issues/751 --- lib/Minz/Error.php | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) (limited to 'lib') diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php index 3eadc6d98..3e4a3e8f3 100644 --- a/lib/Minz/Error.php +++ b/lib/Minz/Error.php @@ -23,42 +23,13 @@ class Minz_Error { $logs = self::processLogs ($logs); $error_filename = APP_PATH . '/Controllers/errorController.php'; - switch ($code) { - case 200 : - header('HTTP/1.1 200 OK'); - break; - case 403 : - header('HTTP/1.1 403 Forbidden'); - break; - case 404 : - header('HTTP/1.1 404 Not Found'); - break; - case 500 : - header('HTTP/1.1 500 Internal Server Error'); - break; - case 503 : - header('HTTP/1.1 503 Service Unavailable'); - break; - default : - header('HTTP/1.1 500 Internal Server Error'); - } - if (file_exists ($error_filename)) { - $params = array ( - 'code' => $code, - 'logs' => $logs - ); + Minz_Session::_param('error_code', $code); + Minz_Session::_param('error_logs', $logs); - if ($redirect) { - Minz_Request::forward (array ( - 'c' => 'error' - ), true); - } else { - Minz_Request::forward (array ( - 'c' => 'error', - 'params' => $params - ), false); - } + Minz_Request::forward (array ( + 'c' => 'error' + ), $redirect); } else { echo '

An error occured

' . "\n"; -- cgit v1.2.3 From d30b3becfa50b96982a3b4880c07cc2b770d7eed Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 19 Jan 2015 13:54:57 +0100 Subject: Addressed warnings when reading from new files There were warnings when reading extensions (trying to use e.g. README and .gitignore as directories), and when reading update file. https://github.com/FreshRSS/FreshRSS/issues/733 --- app/Controllers/updateController.php | 5 ++++- lib/Minz/ExtensionManager.php | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 61b62773b..4797a3486 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -28,7 +28,10 @@ class FreshRSS_update_Controller extends Minz_ActionController { ); } elseif (file_exists(UPDATE_FILENAME)) { // There is an update file to apply! - $version = file_get_contents(join_path(DATA_PATH, 'last_update.txt')); + $version = @file_get_contents(join_path(DATA_PATH, 'last_update.txt')); + if (empty($version)) { + $version = 'unknown'; + } $this->view->update_to_apply = true; $this->view->message = array( 'status' => 'good', diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index 7edc7afaa..f00453f6c 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -56,6 +56,9 @@ class Minz_ExtensionManager { foreach ($list_potential_extensions as $ext_dir) { $ext_pathname = EXTENSIONS_PATH . '/' . $ext_dir; + if (!is_dir($ext_pathname)) { + continue; + } $metadata_filename = $ext_pathname . '/' . self::$ext_metaname; // Try to load metadata file. -- cgit v1.2.3 From 12081f7ba2089c8046dacac23ebe44ea843d7ef1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 20 Jan 2015 23:29:04 +0100 Subject: Quick fix cron actualization due to problematic FreshRSS constructor/init https://github.com/FreshRSS/FreshRSS/issues/759 Suggestion: the static objects should be user-independent (or at least with the possibility to be re-set), while the FreshRSS object and its attributes should be user-dependent. --- app/actualize_script.php | 3 ++- lib/Minz/Configuration.php | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/app/actualize_script.php b/app/actualize_script.php index c7959be82..bae40aa56 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -22,7 +22,6 @@ $_SERVER['HTTP_HOST'] = ''; $app = new FreshRSS(); -$app->init(); $system_conf = Minz_Configuration::get('system'); $system_conf->auth_type = 'none'; // avoid necessity to be logged in (not saved!) @@ -56,7 +55,9 @@ foreach ($users as $user) { Minz_Session::_param('currentUser', $user); + new Minz_ModelPdo($user); //TODO: FIXME: Quick-fix while waiting for a better FreshRSS() constructor/init FreshRSS_Auth::giveAccess(); + $app->init(); $app->run(); diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index fe415e22b..ab5bb4fc2 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -16,16 +16,9 @@ class Minz_Configuration { * @param $config_filename the filename of the configuration * @param $default_filename a filename containing default values for the configuration * @param $configuration_setter an optional helper to set values in configuration - * @throws Minz_ConfigurationNamespaceException if the namespace already exists. */ public static function register($namespace, $config_filename, $default_filename = null, $configuration_setter = null) { - if (isset(self::$config_list[$namespace])) { - throw new Minz_ConfigurationNamespaceException( - $namespace . ' namespace already exists' - ); - } - self::$config_list[$namespace] = new Minz_Configuration( $namespace, $config_filename, $default_filename, $configuration_setter ); -- cgit v1.2.3 From 211569ef85f50891035e3e2645ec0c87badec1e1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 21 Jan 2015 00:44:26 +0100 Subject: Minz: missing URL key/param encoding Caused searches such as "intitle:&" to fail after paging, and possible XSS vulnerabilities. Discovered during https://github.com/FreshRSS/FreshRSS/issues/754 --- app/layout/header.phtml | 3 +-- app/layout/nav_menu.phtml | 3 +-- lib/Minz/Url.php | 34 +++++++++++++++++----------------- 3 files changed, 19 insertions(+), 21 deletions(-) (limited to 'lib') diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 2b968252b..41a63a565 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -25,8 +25,7 @@ if (FreshRSS_Auth::accessNeedsAction()) { allow_anonymous) { ?>
- - + diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index d35a0b5fb..3a755b560 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -156,8 +156,7 @@