aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Frans de Jonge <fransdejonge@gmail.com> 2017-09-22 12:13:46 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-09-22 12:13:46 +0200
commit4e174ed9dd84ce4f8de410baf6a6e0fde9160055 (patch)
tree535a1ab9c37301e0b38527c7e86ce0b8bbef7b0a /lib
parent3ce2b4d1a8d70309ed353105b3fef617541a4b08 (diff)
[ci] Add Travis (#1619)
* [ci] Add Travis * Exclude some libs * Semi-auto whitespace fixes * line length in SQLite * Exclude tests from line length * Feed.php line length * Feed.php: get rid of unnecessary concat * Feed.php: line length * bootstrap.php: no newline at end of file * Allow concatenating across multiple lines * Add Travis badge * do-install line length * update-or-create-user line length * cli/create-user line length * tests/app/Models/SearchTest.php fix indentation * tests/app/Models/UserQueryTest.php fix indentation * tests/app/Models/CategoryTest.php fix indentation * [fix] PHP 5.3 on precise * cli/do-install no spaces * cli/list-users line length * cli/reconfigure line length * empty catch statements * api/index line length nonsense * spaces before semicolon * app/Models/EntryDAO bunch of indentation * extra blank lines * spaces before comma in function call * testing tabwidth * increase to 10 * comment out tabwidth line * try older phpcs version 3.0.0RC4 * line length exception for app/install.php * proper spaces * stray spaces in i18n * Minz/ModelPdo line length * Minz whitespace * greader line length * greader elseif placement * app/Models/Feed.php spacing in function argument * ignore php 5.3 * app/Models/ConfigurationSetter.php stray whitespace * EntryDAOSQLite line length * I vote for higher max line length =P * ignore SQL * remove classname complaint * line length/more legible SQL * ignore line length nonsense * greader line length * feedController issues * uppercase TRUE, FALSE, NULL * revert * importExportController lowercase null * Share.php default value not necessary because ! is_array () a few lines down * CategoryDAO constants should be UPPERCASE * EntryDAO reduce line length * contentious autofix * Allow failures on all versions of PHP except 7.1 because reasons
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/ActionController.php6
-rw-r--r--lib/Minz/ActionException.php2
-rw-r--r--lib/Minz/Configuration.php4
-rw-r--r--lib/Minz/ControllerNotActionControllerException.php2
-rw-r--r--lib/Minz/ControllerNotExistException.php2
-rw-r--r--lib/Minz/CurrentPagePaginationException.php2
-rw-r--r--lib/Minz/Dispatcher.php2
-rw-r--r--lib/Minz/FileNotExistException.php2
-rw-r--r--lib/Minz/FrontController.php4
-rw-r--r--lib/Minz/Helper.php4
-rw-r--r--lib/Minz/Model.php2
-rw-r--r--lib/Minz/ModelArray.php3
-rw-r--r--lib/Minz/ModelPdo.php2
-rw-r--r--lib/Minz/PDOConnectionException.php2
-rw-r--r--lib/Minz/Paginator.php8
-rw-r--r--lib/Minz/Translate.php4
-rw-r--r--lib/Minz/View.php2
-rw-r--r--lib/favicons.php1
-rw-r--r--lib/lib_date.php3
-rw-r--r--lib/lib_install.php3
-rw-r--r--lib/lib_rss.php2
21 files changed, 29 insertions, 33 deletions
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 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -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 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
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 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -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 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
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 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -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 @@
<?php
-/**
+/**
* MINZ - Copyright 2011 Marien Fressinaud
* Sous licence AGPL3 <http://www.gnu.org/licenses/>
*/
@@ -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;
}