@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @filesource |
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | - if(! function_exists('get_random_string')){ |
|
| 42 | + if (!function_exists('get_random_string')) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Generate a random string |
| 45 | 45 | * @param string $type the type of generation. It can take the values: "alpha" for alphabetic characters, |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * @param boolean $lower if we return the generated string in lowercase (true). By default it's false. |
| 50 | 50 | * @return string the generated string. |
| 51 | 51 | */ |
| 52 | - function get_random_string($type = 'alnum', $length = 10, $lower = false){ |
|
| 52 | + function get_random_string($type = 'alnum', $length = 10, $lower = false) { |
|
| 53 | 53 | $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; |
| 54 | - switch($type){ |
|
| 54 | + switch ($type) { |
|
| 55 | 55 | case 'alpha': |
| 56 | 56 | $str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| 57 | 57 | break; |
@@ -63,10 +63,10 @@ discard block |
||
| 63 | 63 | break; |
| 64 | 64 | } |
| 65 | 65 | $random = null; |
| 66 | - for($i = 0; $i < $length; $i++){ |
|
| 66 | + for ($i = 0; $i < $length; $i++) { |
|
| 67 | 67 | $random .= $str[mt_rand() % strlen($str)]; |
| 68 | 68 | } |
| 69 | - if($lower){ |
|
| 69 | + if ($lower) { |
|
| 70 | 70 | $random = strtolower($random); |
| 71 | 71 | } |
| 72 | 72 | return $random; |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 7 | 7 | <meta name="description" content=""> |
| 8 | 8 | <meta name="author" content="Tony NGUEREZA"> |
| 9 | - <title><?php echo $title;?></title> |
|
| 9 | + <title><?php echo $title; ?></title> |
|
| 10 | 10 | <style type = 'text/css'> |
| 11 | 11 | /* reset */ |
| 12 | 12 | *{ |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | <body> |
| 65 | 65 | <div class="container"> |
| 66 | 66 | <div class = "title"> |
| 67 | - <h2><?php echo $title;?></h2> |
|
| 67 | + <h2><?php echo $title; ?></h2> |
|
| 68 | 68 | </div> |
| 69 | 69 | <div class = "body"> |
| 70 | - <p><?php echo $error;?></p> |
|
| 70 | + <p><?php echo $error; ?></p> |
|
| 71 | 71 | </div> |
| 72 | 72 | </div> <!-- ./container--> |
| 73 | 73 | </body> |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | /** |
| 4 | 4 | * Form validation language message (English) |
| 5 | 5 | */ |
| 6 | - $lang['fv_required'] = 'Field %1 is required.'; |
|
| 6 | + $lang['fv_required'] = 'Field %1 is required.'; |
|
| 7 | 7 | $lang['fv_min_length'] = 'Field %1 must contain at least %2 characters.'; |
| 8 | 8 | $lang['fv_max_length'] = 'Field %1 must contain at most %2 characters.'; |
| 9 | 9 | $lang['fv_exact_length'] = 'Field %1 must contain exactly %2 characters.'; |
| 10 | - $lang['fv_less_than'] = 'Field %1 must less than %2.'; |
|
| 10 | + $lang['fv_less_than'] = 'Field %1 must less than %2.'; |
|
| 11 | 11 | $lang['fv_greater_than'] = 'Field %1 must greater than %2.'; |
| 12 | 12 | $lang['fv_matches'] = 'Field %1 must be identical to field %2.'; |
| 13 | 13 | $lang['fv_valid_email'] = 'Field %1 must contain a valid E-mail address.'; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $lang['fv_depends'] = 'Field %1 depends on field %2 which is not valid.'; |
| 17 | 17 | $lang['fv_is_unique'] = 'The value of field %1 already exists.'; |
| 18 | 18 | $lang['fv_is_unique_update'] = 'The value of field %1 already exists for another record.'; |
| 19 | - $lang['fv_exists'] = 'The value of the field %1 does not exist.'; |
|
| 19 | + $lang['fv_exists'] = 'The value of the field %1 does not exist.'; |
|
| 20 | 20 | $lang['fv_regex'] = 'The value of the field %1 does not use the correct format.'; |
| 21 | 21 | $lang['fv_in_list'] = 'The value of field %1 must be one of the list (%2).'; |
| 22 | 22 | $lang['fv_numeric'] = 'The value of field %1 must be a number.'; |
@@ -6,11 +6,11 @@ |
||
| 6 | 6 | $lang['fu_upload_err_ini_size'] = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.'; |
| 7 | 7 | $lang['fu_upload_err_form_size'] = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'; |
| 8 | 8 | $lang['fu_upload_err_partial'] = 'The uploaded file was only partially uploaded.'; |
| 9 | - $lang['fu_upload_err_no_file'] = 'No file was choosed. Please select one.'; |
|
| 9 | + $lang['fu_upload_err_no_file'] = 'No file was choosed. Please select one.'; |
|
| 10 | 10 | $lang['fu_upload_err_no_tmp_dir'] = 'Missing a temporary folder.'; |
| 11 | - $lang['fu_upload_err_cant_write'] = 'Failed to write file to disk.'; |
|
| 11 | + $lang['fu_upload_err_cant_write'] = 'Failed to write file to disk.'; |
|
| 12 | 12 | $lang['fu_upload_err_extension'] = 'A PHP extension stopped the file upload.'; |
| 13 | - $lang['fu_accept_file_types'] = 'Filetype not allowed'; |
|
| 13 | + $lang['fu_accept_file_types'] = 'Filetype not allowed'; |
|
| 14 | 14 | $lang['fu_file_uploads_disabled'] = 'File uploading option is disabled in php.ini'; |
| 15 | 15 | $lang['fu_max_file_size'] = 'The uploaded file size is too big max size is %s'; |
| 16 | 16 | $lang['fu_overwritten_not_allowed'] = 'You don\'t allow overwriting existing file'; |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Function to test private & protected method |
| 5 | 5 | */ |
| 6 | - function runPrivateOrProtectedMethod($object, $method, array $args = array()){ |
|
| 6 | + function runPrivateOrProtectedMethod($object, $method, array $args = array()) { |
|
| 7 | 7 | $r = new ReflectionClass(get_class($object)); |
| 8 | 8 | $m = $r->getMethod($method); |
| 9 | 9 | $m->setAccessible(true); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | 43 | |
| 44 | - if(! function_exists('get_ip')){ |
|
| 44 | + if (!function_exists('get_ip')) { |
|
| 45 | 45 | /** |
| 46 | 46 | * Retrieves the user's IP address |
| 47 | 47 | * |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return string the IP address. |
| 52 | 52 | */ |
| 53 | - function get_ip(){ |
|
| 53 | + function get_ip() { |
|
| 54 | 54 | $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; |
| 55 | 55 | |
| 56 | 56 | if (isset($_SERVER["HTTP_CLIENT_IP"])) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | protected $sessionTableColumns = array(); |
| 47 | 47 | |
| 48 | - public function __construct(Database $db = null){ |
|
| 48 | + public function __construct(Database $db = null) { |
|
| 49 | 49 | parent::__construct($db); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * Return the session database table columns |
| 54 | 54 | * @return array |
| 55 | 55 | */ |
| 56 | - public function getSessionTableColumns(){ |
|
| 56 | + public function getSessionTableColumns() { |
|
| 57 | 57 | return $this->sessionTableColumns; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * Set the session database table columns |
| 62 | 62 | * @param array $columns the columns definition |
| 63 | 63 | */ |
| 64 | - public function setSessionTableColumns(array $columns){ |
|
| 64 | + public function setSessionTableColumns(array $columns) { |
|
| 65 | 65 | $this->sessionTableColumns = $columns; |
| 66 | 66 | return $this; |
| 67 | 67 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | 43 | //if the application is running in CLI mode $_SESSION global variable is not available |
| 44 | - if(IS_CLI){ |
|
| 44 | + if (IS_CLI) { |
|
| 45 | 45 | $_SESSION = array(); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * The Benchmark class |
| 62 | 62 | */ |
| 63 | - $BENCHMARK =& class_loader('Benchmark'); |
|
| 63 | + $BENCHMARK = & class_loader('Benchmark'); |
|
| 64 | 64 | |
| 65 | 65 | $BENCHMARK->mark('APP_EXECUTION_START'); |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * instance of the Log class |
| 69 | 69 | */ |
| 70 | - $LOGGER =& class_loader('Log', 'classes'); |
|
| 70 | + $LOGGER = & class_loader('Log', 'classes'); |
|
| 71 | 71 | |
| 72 | 72 | $LOGGER->setLogger('ApplicationBootstrap'); |
| 73 | 73 | |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | /** |
| 77 | 77 | * Verification of the PHP environment: minimum and maximum version |
| 78 | 78 | */ |
| 79 | - if (version_compare(phpversion(), TNH_REQUIRED_PHP_MIN_VERSION, '<')){ |
|
| 79 | + if (version_compare(phpversion(), TNH_REQUIRED_PHP_MIN_VERSION, '<')) { |
|
| 80 | 80 | show_error('Your PHP Version [' . phpversion() . '] is less than [' . TNH_REQUIRED_PHP_MIN_VERSION . '], please install a new version or update your PHP to the latest.', 'PHP Error environment'); |
| 81 | 81 | } |
| 82 | - else if(version_compare(phpversion(), TNH_REQUIRED_PHP_MAX_VERSION, '>')){ |
|
| 82 | + else if (version_compare(phpversion(), TNH_REQUIRED_PHP_MAX_VERSION, '>')) { |
|
| 83 | 83 | show_error('Your PHP Version [' . phpversion() . '] is greather than [' . TNH_REQUIRED_PHP_MAX_VERSION . '] please install a PHP version that is compatible.', 'PHP Error environment'); |
| 84 | 84 | } |
| 85 | 85 | $LOGGER->info('PHP version [' . phpversion() . '] is OK [REQUIRED MINIMUM: ' . TNH_REQUIRED_PHP_MIN_VERSION . ', REQUIRED MAXIMUM: ' . TNH_REQUIRED_PHP_MAX_VERSION . '], application can work without any issue'); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | //if user have some composer packages |
| 103 | 103 | $LOGGER->debug('Check for composer autoload'); |
| 104 | - if(file_exists(VENDOR_PATH . 'autoload.php')){ |
|
| 104 | + if (file_exists(VENDOR_PATH . 'autoload.php')) { |
|
| 105 | 105 | $LOGGER->info('The composer autoload file exists include it'); |
| 106 | 106 | require_once VENDOR_PATH . 'autoload.php'; |
| 107 | 107 | } |
| 108 | - else{ |
|
| 108 | + else { |
|
| 109 | 109 | $LOGGER->info('The composer autoload file does not exist skipping'); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * Load configurations and using the |
| 122 | 122 | * static method "init()" to initialize the Config class . |
| 123 | 123 | */ |
| 124 | - $CONFIG =& class_loader('Config', 'classes'); |
|
| 124 | + $CONFIG = & class_loader('Config', 'classes'); |
|
| 125 | 125 | $CONFIG->init(); |
| 126 | 126 | $BENCHMARK->mark('CONFIG_INIT_END'); |
| 127 | 127 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * Load modules and using the |
| 131 | 131 | * static method "init()" to initialize the Module class. |
| 132 | 132 | */ |
| 133 | - $MODULE =& class_loader('Module', 'classes'); |
|
| 133 | + $MODULE = & class_loader('Module', 'classes'); |
|
| 134 | 134 | $MODULE->init(); |
| 135 | 135 | $BENCHMARK->mark('MODULE_INIT_END'); |
| 136 | 136 | |
@@ -149,34 +149,34 @@ discard block |
||
| 149 | 149 | /** |
| 150 | 150 | * Loading Security class |
| 151 | 151 | */ |
| 152 | - $SECURITY =& class_loader('Security', 'classes'); |
|
| 152 | + $SECURITY = & class_loader('Security', 'classes'); |
|
| 153 | 153 | $SECURITY->checkWhiteListIpAccess(); |
| 154 | 154 | |
| 155 | 155 | /** |
| 156 | 156 | * Loading Url class |
| 157 | 157 | */ |
| 158 | - $URL =& class_loader('Url', 'classes'); |
|
| 158 | + $URL = & class_loader('Url', 'classes'); |
|
| 159 | 159 | |
| 160 | - if(get_config('cache_enable', false)){ |
|
| 160 | + if (get_config('cache_enable', false)) { |
|
| 161 | 161 | /** |
| 162 | 162 | * Load Cache interface file |
| 163 | 163 | */ |
| 164 | 164 | require_once CORE_CLASSES_CACHE_PATH . 'CacheInterface.php'; |
| 165 | 165 | $cacheHandler = get_config('cache_handler'); |
| 166 | - if(! $cacheHandler){ |
|
| 166 | + if (!$cacheHandler) { |
|
| 167 | 167 | show_error('The cache feature is enabled in the configuration but the cache handler class is not set.'); |
| 168 | 168 | } |
| 169 | 169 | $CACHE = null; |
| 170 | 170 | //first check if the cache handler is the system driver |
| 171 | - if(file_exists(CORE_CLASSES_CACHE_PATH . $cacheHandler . '.php')){ |
|
| 172 | - $CACHE =& class_loader($cacheHandler, 'classes/cache'); |
|
| 171 | + if (file_exists(CORE_CLASSES_CACHE_PATH . $cacheHandler . '.php')) { |
|
| 172 | + $CACHE = & class_loader($cacheHandler, 'classes/cache'); |
|
| 173 | 173 | } |
| 174 | - else{ |
|
| 174 | + else { |
|
| 175 | 175 | //it's not a system driver use user library |
| 176 | - $CACHE =& class_loader($cacheHandler); |
|
| 176 | + $CACHE = & class_loader($cacheHandler); |
|
| 177 | 177 | } |
| 178 | 178 | //check if the page already cached |
| 179 | - if(! empty($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'get'){ |
|
| 179 | + if (!empty($_SERVER['REQUEST_METHOD']) && strtolower($_SERVER['REQUEST_METHOD']) == 'get') { |
|
| 180 | 180 | $RESPONSE = & class_loader('Response', 'classes'); |
| 181 | 181 | $RESPONSE->renderFinalPageFromCache($CACHE); |
| 182 | 182 | } |
@@ -24,20 +24,20 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - public function testFunctionGetConfigKeyNotExist(){ |
|
| 27 | + public function testFunctionGetConfigKeyNotExist() { |
|
| 28 | 28 | $key = 'foo'; |
| 29 | 29 | $cfg = get_config($key); |
| 30 | 30 | $this->assertNull($cfg); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function testFunctionGetConfigKeyNotExistUsingDefaultValue(){ |
|
| 33 | + public function testFunctionGetConfigKeyNotExistUsingDefaultValue() { |
|
| 34 | 34 | $key = 'foo'; |
| 35 | 35 | $expected = 'bar'; |
| 36 | 36 | $cfg = get_config($key, $expected); |
| 37 | 37 | $this->assertEquals($cfg, $expected); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function testFunctionGetConfigAfterSet(){ |
|
| 40 | + public function testFunctionGetConfigAfterSet() { |
|
| 41 | 41 | $key = 'foo'; |
| 42 | 42 | $expected = 'bar'; |
| 43 | 43 | $c = new Config(); |