diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php
index c7f1008cd..15397f1f6 100644
--- a/cli/_update-or-create-user.php
+++ b/cli/_update-or-create-user.php
@@ -23,7 +23,8 @@ if (!$isUpdate) {
$options = getopt('', $params);
if (empty($options['user'])) {
- fail('Usage: ' . basename($_SERVER['SCRIPT_FILENAME']) . " --user username ( --password 'password' --api_password 'api_password'" .
+ fail('Usage: ' . basename($_SERVER['SCRIPT_FILENAME']) .
+ " --user username ( --password 'password' --api_password 'api_password'" .
" --language en --email user@example.net --token 'longRandomString'" .
($isUpdate ? '' : '--no_default_feeds') .
" --purge_after_months 3 --feed_min_articles_default 50 --feed_ttl_default 3600" .
diff --git a/cli/create-user.php b/cli/create-user.php
index add9c1b13..1b6be3153 100755
--- a/cli/create-user.php
+++ b/cli/create-user.php
@@ -5,7 +5,8 @@ require('_update-or-create-user.php');
$username = $options['user'];
if (!FreshRSS_user_Controller::checkUsername($username)) {
- fail('FreshRSS error: invalid username “' . $username . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
+ fail('FreshRSS error: invalid username “' . $username .
+ '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
}
$usernames = listUsers();
diff --git a/cli/do-install.php b/cli/do-install.php
index 54e3c3d4f..74bbdfcd4 100755
--- a/cli/do-install.php
+++ b/cli/do-install.php
@@ -81,14 +81,17 @@ if ($requirements['all'] !== 'ok') {
}
if (!FreshRSS_user_Controller::checkUsername($options['default_user'])) {
- fail('FreshRSS error: invalid default username “' . $options['default_user'] . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
+ fail('FreshRSS error: invalid default username “' . $options['default_user']
+ . '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
}
if (isset($options['auth_type']) && !in_array($options['auth_type'], array('form', 'http_auth', 'none'))) {
- fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }): ' . $options['auth_type']);
+ fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }): '
+ . $options['auth_type']);
}
-if (file_put_contents(join_path(DATA_PATH, 'config.php'), "default_user !== '' && in_array(FreshRSS_Context::$system_conf->default_user, $users, true)) {
+if (FreshRSS_Context::$system_conf->default_user !== ''
+ && in_array(FreshRSS_Context::$system_conf->default_user, $users, true)) {
array_unshift($users, FreshRSS_Context::$system_conf->default_user);
$users = array_unique($users);
}
diff --git a/cli/reconfigure.php b/cli/reconfigure.php
index c6902da67..466d35373 100755
--- a/cli/reconfigure.php
+++ b/cli/reconfigure.php
@@ -51,7 +51,8 @@ if (!FreshRSS_user_Controller::checkUsername($config->default_user)) {
}
if (isset($config->auth_type) && !in_array($config->auth_type, array('form', 'http_auth', 'none'))) {
- fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' . $config->auth_type);
+ fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: '
+ . $config->auth_type);
}
$config->save();
diff --git a/data/shares.php b/data/shares.php
index 16e528d14..d73ae3826 100644
--- a/data/shares.php
+++ b/data/shares.php
@@ -4,7 +4,7 @@
* This is a configuration file. You shouldn't modify it unless you know what
* you are doing. If you want to add a share type, this is where you need to do
* it.
- *
+ *
* For each share there is different configuration options. Here is the description
* of those options:
* - url is a mandatory option. It is a string representing the share URL. It
diff --git a/lib/Minz/ActionController.php b/lib/Minz/ActionController.php
index b47c54554..232a4ef9b 100644
--- a/lib/Minz/ActionController.php
+++ b/lib/Minz/ActionController.php
@@ -1,5 +1,5 @@
*/
@@ -24,7 +24,7 @@ class Minz_ActionController {
public function view () {
return $this->view;
}
-
+
/**
* Méthodes à redéfinir (ou non) par héritage
* firstAction est la première méthode exécutée par le Dispatcher
@@ -34,5 +34,3 @@ class Minz_ActionController {
public function firstAction () { }
public function lastAction () { }
}
-
-
diff --git a/lib/Minz/ActionException.php b/lib/Minz/ActionException.php
index c566a076f..f1f70c1bc 100644
--- a/lib/Minz/ActionException.php
+++ b/lib/Minz/ActionException.php
@@ -3,7 +3,7 @@ class Minz_ActionException extends Minz_Exception {
public function __construct ($controller_name, $action_name, $code = self::ERROR) {
$message = '`' . $action_name . '` cannot be invoked on `'
. $controller_name . '`';
-
+
parent::__construct ($message, $code);
}
}
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
index d695d4a53..5470dc85f 100644
--- a/lib/Minz/Configuration.php
+++ b/lib/Minz/Configuration.php
@@ -104,7 +104,7 @@ class Minz_Configuration {
/**
* Create a new Minz_Configuration object.
- *
+ *
* @param $namespace the name of the current configuration.
* @param $config_filename the file containing configuration values.
* @param $default_filename the file containing default values, null by default.
@@ -145,7 +145,7 @@ class Minz_Configuration {
/**
* Return the value of the given param.
- *
+ *
* @param $key the name of the param.
* @param $default default value to return if key does not exist.
* @return the value corresponding to the key.
diff --git a/lib/Minz/ControllerNotActionControllerException.php b/lib/Minz/ControllerNotActionControllerException.php
index 535a1377e..1a8e0729c 100644
--- a/lib/Minz/ControllerNotActionControllerException.php
+++ b/lib/Minz/ControllerNotActionControllerException.php
@@ -3,7 +3,7 @@ class Minz_ControllerNotActionControllerException extends Minz_Exception {
public function __construct ($controller_name, $code = self::ERROR) {
$message = 'Controller `' . $controller_name
. '` isn\'t instance of ActionController';
-
+
parent::__construct ($message, $code);
}
}
diff --git a/lib/Minz/ControllerNotExistException.php b/lib/Minz/ControllerNotExistException.php
index 523867d11..24a09a635 100644
--- a/lib/Minz/ControllerNotExistException.php
+++ b/lib/Minz/ControllerNotExistException.php
@@ -3,7 +3,7 @@ class Minz_ControllerNotExistException extends Minz_Exception {
public function __construct ($controller_name, $code = self::ERROR) {
$message = 'Controller `' . $controller_name
. '` doesn\'t exist';
-
+
parent::__construct ($message, $code);
}
}
diff --git a/lib/Minz/CurrentPagePaginationException.php b/lib/Minz/CurrentPagePaginationException.php
index 74214d879..3e3d9d1b4 100644
--- a/lib/Minz/CurrentPagePaginationException.php
+++ b/lib/Minz/CurrentPagePaginationException.php
@@ -2,7 +2,7 @@
class Minz_CurrentPagePaginationException extends Minz_Exception {
public function __construct ($page) {
$message = 'Page number `' . $page . '` doesn\'t exist';
-
+
parent::__construct ($message, self::ERROR);
}
}
diff --git a/lib/Minz/Dispatcher.php b/lib/Minz/Dispatcher.php
index 125ce5757..bdb1c76f6 100644
--- a/lib/Minz/Dispatcher.php
+++ b/lib/Minz/Dispatcher.php
@@ -1,5 +1,5 @@
*/
diff --git a/lib/Minz/FileNotExistException.php b/lib/Minz/FileNotExistException.php
index f8dfbdf66..f97f161af 100644
--- a/lib/Minz/FileNotExistException.php
+++ b/lib/Minz/FileNotExistException.php
@@ -2,7 +2,7 @@
class Minz_FileNotExistException extends Minz_Exception {
public function __construct ($file_name, $code = self::ERROR) {
$message = 'File not found: `' . $file_name.'`';
-
+
parent::__construct ($message, $code);
}
}
diff --git a/lib/Minz/FrontController.php b/lib/Minz/FrontController.php
index 952d983c9..066278b7c 100644
--- a/lib/Minz/FrontController.php
+++ b/lib/Minz/FrontController.php
@@ -119,12 +119,12 @@ class Minz_FrontController {
switch($conf->environment) {
case 'production':
error_reporting(E_ALL);
- ini_set('display_errors','Off');
+ ini_set('display_errors', 'Off');
ini_set('log_errors', 'On');
break;
case 'development':
error_reporting(E_ALL);
- ini_set('display_errors','On');
+ ini_set('display_errors', 'On');
ini_set('log_errors', 'On');
break;
case 'silent':
diff --git a/lib/Minz/Helper.php b/lib/Minz/Helper.php
index f4a547c4e..c328d9e6b 100644
--- a/lib/Minz/Helper.php
+++ b/lib/Minz/Helper.php
@@ -1,5 +1,5 @@
*/
@@ -13,7 +13,7 @@ class Minz_Helper {
* @param $var variable à traiter (tableau ou simple variable)
*/
public static function stripslashes_r($var) {
- if (is_array($var)){
+ if (is_array($var)) {
return array_map(array('Minz_Helper', 'stripslashes_r'), $var);
} else {
return stripslashes($var);
diff --git a/lib/Minz/Model.php b/lib/Minz/Model.php
index adbaba942..1310888cf 100644
--- a/lib/Minz/Model.php
+++ b/lib/Minz/Model.php
@@ -1,5 +1,5 @@
*/
diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.php
index ff23dbc83..1ac2b313d 100644
--- a/lib/Minz/ModelArray.php
+++ b/lib/Minz/ModelArray.php
@@ -25,8 +25,7 @@ class Minz_ModelArray {
protected function loadArray() {
if (!file_exists($this->filename)) {
throw new Minz_FileNotExistException($this->filename, Minz_Exception::WARNING);
- }
- elseif (($handle = $this->getLock()) === false) {
+ } elseif (($handle = $this->getLock()) === false) {
throw new Minz_PermissionDeniedException($this->filename);
} else {
$data = include($this->filename);
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php
index caab1d114..d769e0ff4 100644
--- a/lib/Minz/ModelPdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -39,7 +39,7 @@ class Minz_ModelPdo {
if ($currentUser === null) {
$currentUser = Minz_Session::param('currentUser');
}
- if (self::$useSharedBd && self::$sharedBd != null &&
+ if (self::$useSharedBd && self::$sharedBd != null &&
($currentUser == null || $currentUser === self::$sharedCurrentUser)) {
$this->bd = self::$sharedBd;
$this->prefix = self::$sharedPrefix;
diff --git a/lib/Minz/PDOConnectionException.php b/lib/Minz/PDOConnectionException.php
index faf2e0fe9..064748708 100644
--- a/lib/Minz/PDOConnectionException.php
+++ b/lib/Minz/PDOConnectionException.php
@@ -3,7 +3,7 @@ class Minz_PDOConnectionException extends Minz_Exception {
public function __construct ($string_connection, $user, $code = self::ERROR) {
$message = 'Access to database is denied for `' . $user . '`'
. ' (`' . $string_connection . '`)';
-
+
parent::__construct ($message, $code);
}
}
diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php
index 5858e76a5..795085a30 100644
--- a/lib/Minz/Paginator.php
+++ b/lib/Minz/Paginator.php
@@ -1,5 +1,5 @@
*/
@@ -51,7 +51,7 @@ class Minz_Paginator {
*/
public function render ($view, $getteur) {
$view = APP_PATH . '/views/helpers/'.$view;
-
+
if (file_exists ($view)) {
include ($view);
}
@@ -129,7 +129,7 @@ class Minz_Paginator {
$begin = ($this->currentPage - 1) * $this->nbItemsPerPage;
$counter = 0;
$i = 0;
-
+
foreach ($this->items as $key => $item) {
if ($i >= $begin) {
$array[$key] = $item;
@@ -164,7 +164,7 @@ class Minz_Paginator {
if (is_array ($items)) {
$this->items = $items;
}
-
+
$this->_nbPage ();
}
public function _nbItemsPerPage ($nbItemsPerPage) {
diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php
index baddcb424..d9cd59f7e 100644
--- a/lib/Minz/Translate.php
+++ b/lib/Minz/Translate.php
@@ -1,5 +1,5 @@
*/
@@ -153,7 +153,7 @@ class Minz_Translate {
* @param additional parameters for variable keys.
* @return the value corresponding to the key.
* If no value is found, return the key itself.
- */
+ */
public static function t($key) {
$group = explode('.', $key);
diff --git a/lib/Minz/View.php b/lib/Minz/View.php
index 8c5230ab6..d6bf6ea2c 100644
--- a/lib/Minz/View.php
+++ b/lib/Minz/View.php
@@ -262,5 +262,3 @@ class Minz_View {
}
}
}
-
-
diff --git a/lib/favicons.php b/lib/favicons.php
index 48f7c9fda..a7ed966a1 100644
--- a/lib/favicons.php
+++ b/lib/favicons.php
@@ -16,6 +16,7 @@ function isImgMime($content) {
$isImage = strpos(finfo_buffer($fInfo, $content), 'image') !== false;
finfo_close($fInfo);
} catch (Exception $e) {
+ echo 'Caught exception: ', $e->getMessage(), "\n";
}
return $isImage;
}
diff --git a/lib/lib_date.php b/lib/lib_date.php
index 9533711e3..a3f7efb46 100644
--- a/lib/lib_date.php
+++ b/lib/lib_date.php
@@ -63,8 +63,7 @@ function _dateCeiling($isoDate) {
}
function _noDelimit($isoDate) {
- return $isoDate === null || $isoDate === '' ? null :
- str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone
+ return $isoDate === null || $isoDate === '' ? null : str_replace(array('-', ':'), '', $isoDate); //FIXME: Bug with negative time zone
}
function _dateRelative($d1, $d2) {
diff --git a/lib/lib_install.php b/lib/lib_install.php
index cc0dc3128..7305d8e28 100644
--- a/lib/lib_install.php
+++ b/lib/lib_install.php
@@ -68,8 +68,7 @@ function checkRequirements($dbType = '') {
'http_referer' => $http_referer ? 'ok' : 'ko',
'message' => $message ?: 'ok',
'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $xml &&
- $data && $cache && $users && $favicons && $http_referer && $message == '' ?
- 'ok' : 'ko'
+ $data && $cache && $users && $favicons && $http_referer && $message == '' ? 'ok' : 'ko'
);
}
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index dcce8a02c..959cb064c 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -348,6 +348,7 @@ function get_user_configuration($username) {
join_path(FRESHRSS_PATH, 'config-user.default.php'));
} catch (Minz_ConfigurationNamespaceException $e) {
// namespace already exists, do nothing.
+ Minz_Log::warning($e->getMessage());
} catch (Minz_FileNotExistException $e) {
Minz_Log::warning($e->getMessage());
return null;
@@ -366,6 +367,7 @@ function cryptAvailable() {
$hash = '$2y$04$usesomesillystringfore7hnbRJHxXVLeakoG8K30oukPsA.ztMG';
return $hash === @crypt('password', $hash);
} catch (Exception $e) {
+ Minz_Log::warning($e->getMessage());
}
return false;
}
diff --git a/p/api/greader.php b/p/api/greader.php
index 7f6f0b04f..e5275b3a3 100644
--- a/p/api/greader.php
+++ b/p/api/greader.php
@@ -94,7 +94,16 @@ function debugInfo() {
}
}
global $ORIGINAL_INPUT;
- return print_r(array('date' => date('c'), 'headers' => $ALL_HEADERS, '_SERVER' => $_SERVER, '_GET' => $_GET, '_POST' => $_POST, '_COOKIE' => $_COOKIE, 'INPUT' => $ORIGINAL_INPUT), true);
+ return print_r(
+ array(
+ 'date' => date('c'),
+ 'headers' => $ALL_HEADERS,
+ '_SERVER' => $_SERVER,
+ '_GET' => $_GET,
+ '_POST' => $_POST,
+ '_COOKIE' => $_COOKIE,
+ 'INPUT' => $ORIGINAL_INPUT
+ ), true);
}
function badRequest() {
@@ -694,8 +703,8 @@ $pathInfo = empty($_SERVER['PATH_INFO']) ? '/Error' : urldecode($_SERVER['PATH_I
$pathInfos = explode('/', $pathInfo);
Minz_Configuration::register('system',
- DATA_PATH . '/config.php',
- FRESHRSS_PATH . '/config.default.php');
+ DATA_PATH . '/config.php',
+ FRESHRSS_PATH . '/config.default.php');
FreshRSS_Context::$system_conf = Minz_Configuration::get('system');
if (!FreshRSS_Context::$system_conf->api_enabled) {
serviceUnavailable();
@@ -715,24 +724,34 @@ Minz_Session::_param('currentUser', $user);
if (count($pathInfos) < 3) {
badRequest();
-}
-elseif ($pathInfos[1] === 'accounts') {
+} elseif ($pathInfos[1] === 'accounts') {
if (($pathInfos[2] === 'ClientLogin') && isset($_REQUEST['Email']) && isset($_REQUEST['Passwd'])) {
clientLogin($_REQUEST['Email'], $_REQUEST['Passwd']);
}
-}
-elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) {
+} elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfos[3]) && $pathInfos[3] === '0' && isset($pathInfos[4])) {
if ($user == '') {
unauthorized();
}
$timestamp = isset($_GET['ck']) ? intval($_GET['ck']) : 0; //ck=[unix timestamp] : Use the current Unix time here, helps Google with caching.
switch ($pathInfos[4]) {
case 'stream':
- $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : ''; //xt=[exclude target] : Used to exclude certain items from the feed. For example, using xt=user/-/state/com.google/read will exclude items that the current user has marked as read, or xt=feed/[feedurl] will exclude items from a particular feed (obviously not useful in this request, but xt appears in other listing requests).
+ /* xt=[exclude target] : Used to exclude certain items from the feed.
+ * For example, using xt=user/-/state/com.google/read will exclude items
+ * that the current user has marked as read, or xt=feed/[feedurl] will
+ * exclude items from a particular feed (obviously not useful in this
+ * request, but xt appears in other listing requests). */
+ $exclude_target = isset($_GET['xt']) ? $_GET['xt'] : '';
$count = isset($_GET['n']) ? intval($_GET['n']) : 20; //n=[integer] : The maximum number of results to return.
$order = isset($_GET['r']) ? $_GET['r'] : 'd'; //r=[d|n|o] : Sort order of item results. d or n gives items in descending date order, o in ascending order.
- $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0; //ot=[unix timestamp] : The time from which you want to retrieve items. Only items that have been crawled by Google Reader after this time will be returned.
- $continuation = isset($_GET['c']) ? $_GET['c'] : ''; //Continuation token. If a StreamContents response does not represent all items in a timestamp range, it will have a continuation attribute. The same request can be re-issued with the value of that attribute put in this parameter to get more items
+ /* ot=[unix timestamp] : The time from which you want to retrieve
+ * items. Only items that have been crawled by Google Reader after
+ * this time will be returned. */
+ $start_time = isset($_GET['ot']) ? intval($_GET['ot']) : 0;
+ /* Continuation token. If a StreamContents response does not represent
+ * all items in a timestamp range, it will have a continuation attribute.
+ * The same request can be re-issued with the value of that attribute put
+ * in this parameter to get more items */
+ $continuation = isset($_GET['c']) ? $_GET['c'] : '';
if (isset($pathInfos[5]) && $pathInfos[5] === 'contents' && isset($pathInfos[6])) {
if (isset($pathInfos[7])) {
if ($pathInfos[6] === 'feed') {
@@ -757,7 +776,10 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo
}
} elseif ($pathInfos[5] === 'items') {
if ($pathInfos[6] === 'ids' && isset($_GET['s'])) {
- $streamId = $_GET['s']; //StreamId for which to fetch the item IDs. The parameter may be repeated to fetch the item IDs from multiple streams at once (more efficient from a backend perspective than multiple requests).
+ /* StreamId for which to fetch the item IDs. The parameter may
+ * be repeated to fetch the item IDs from multiple streams at once
+ * (more efficient from a backend perspective than multiple requests). */
+ $streamId = $_GET['s'];
streamContentsItemsIds($streamId, $start_time, $count, $order, $exclude_target);
}
}
@@ -779,8 +801,12 @@ elseif ($pathInfos[1] === 'reader' && $pathInfos[2] === 'api' && isset($pathInfo
break;
case 'edit':
if (isset($_POST['s']) && isset($_POST['ac'])) {
- $streamNames = multiplePosts('s'); //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once
- $titles = multiplePosts('t'); //Title to use for the subscription. For the `subscribe` action, if not specified then the feed's current title will be used. Can be used with the `edit` action to rename a subscription
+ //StreamId to operate on. The parameter may be repeated to edit multiple subscriptions at once
+ $streamNames = multiplePosts('s');
+ /* Title to use for the subscription. For the `subscribe` action,
+ * if not specified then the feed's current title will be used. Can
+ * be used with the `edit` action to rename a subscription */
+ $titles = multiplePosts('t');
$action = $_POST['ac']; //Action to perform on the given StreamId. Possible values are `subscribe`, `unsubscribe` and `edit`
$add = isset($_POST['a']) ? $_POST['a'] : ''; //StreamId to add the subscription to (generally a user label)
$remove = isset($_POST['r']) ? $_POST['r'] : ''; //StreamId to remove the subscription from (generally a user label)
diff --git a/p/api/index.php b/p/api/index.php
index 580c90255..08f7b6b7b 100644
--- a/p/api/index.php
+++ b/p/api/index.php
@@ -22,7 +22,8 @@ echo Minz_Url::display('/api/greader.php', 'html', true);