Passed
Branch 1.0.0-dev (4efac2)
by nguereza
04:41
created
core/views/errors.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
core/lang/en/lang_form_validation.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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.';
Please login to merge, or discard this patch.
core/lang/en/lang_file_upload.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
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';
Please login to merge, or discard this patch.
tests/include/testsUtil.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
core/functions/function_user_agent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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"])) {
Please login to merge, or discard this patch.
core/classes/model/DBSessionHandlerModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
core/bootstrap.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
tests/tnhfw/CommonTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
core/classes/cache/ApcCache.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25 25
 	*/
26 26
 	
27
-	class ApcCache implements CacheInterface{
27
+	class ApcCache implements CacheInterface {
28 28
 
29 29
 		/**
30 30
 		 * The logger instance
@@ -33,19 +33,19 @@  discard block
 block discarded – undo
33 33
 		private $logger;
34 34
 		
35 35
 		
36
-		public function __construct(Log $logger = null){
37
-			if(! $this->isSupported()){
36
+		public function __construct(Log $logger = null) {
37
+			if (!$this->isSupported()) {
38 38
 				show_error('The cache for APC[u] driver is not available. Check if APC[u] extension is loaded and enabled.');
39 39
 			}
40 40
 
41 41
 			/**
42 42
 	         * instance of the Log class
43 43
 	         */
44
-	        if(is_object($logger)){
44
+	        if (is_object($logger)) {
45 45
 	          $this->logger = $logger;
46 46
 	        }
47
-	        else{
48
-	            $this->logger =& class_loader('Log', 'classes');
47
+	        else {
48
+	            $this->logger = & class_loader('Log', 'classes');
49 49
 	            $this->logger->setLogger('Library::ApcCache');
50 50
 	        }
51 51
 		}
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
 		 * @param  string $key the key to identify the cache data
56 56
 		 * @return mixed      the cache data if exists else return false
57 57
 		 */
58
-		public function get($key){
59
-			$this->logger->debug('Getting cache data for key ['. $key .']');
58
+		public function get($key) {
59
+			$this->logger->debug('Getting cache data for key [' . $key . ']');
60 60
 			$success = false;
61 61
 			$data = apc_fetch($key, $success);
62
-			if($success === false){
63
-				$this->logger->info('No cache found for the key ['. $key .'], return false');
62
+			if ($success === false) {
63
+				$this->logger->info('No cache found for the key [' . $key . '], return false');
64 64
 				return false;
65 65
 			}
66
-			else{
66
+			else {
67 67
 				$cacheInfo = $this->_getCacheInfo($key);
68 68
 				$expire = time();
69
-				if($cacheInfo){
69
+				if ($cacheInfo) {
70 70
 					$expire = $cacheInfo['creation_time'] + $cacheInfo['ttl'];
71 71
 				}
72
-				$this->logger->info('The cache not yet expire, now return the cache data for key ['. $key .'], the cache will expire at [' . date('Y-m-d H:i:s', $expire) . ']');
72
+				$this->logger->info('The cache not yet expire, now return the cache data for key [' . $key . '], the cache will expire at [' . date('Y-m-d H:i:s', $expire) . ']');
73 73
 				return $data;
74 74
 			}
75 75
 		}
@@ -82,16 +82,16 @@  discard block
 block discarded – undo
82 82
 		 * @param integer $ttl  the cache life time
83 83
 		 * @return boolean true if success otherwise will return false
84 84
 		 */
85
-		public function set($key, $data, $ttl = 0){
85
+		public function set($key, $data, $ttl = 0) {
86 86
 			$expire = time() + $ttl;
87
-			$this->logger->debug('Setting cache data for key ['. $key .'], time to live [' .$ttl. '], expire at [' . date('Y-m-d H:i:s', $expire) . ']');
87
+			$this->logger->debug('Setting cache data for key [' . $key . '], time to live [' . $ttl . '], expire at [' . date('Y-m-d H:i:s', $expire) . ']');
88 88
 			$result = apc_store($key, $data, $ttl);
89
-			if($result === false){
90
-		    	$this->logger->error('Can not write cache data for the key ['. $key .'], return false');
89
+			if ($result === false) {
90
+		    	$this->logger->error('Can not write cache data for the key [' . $key . '], return false');
91 91
 		    	return false;
92 92
 		    }
93
-		    else{
94
-		    	$this->logger->info('Cache data saved for the key ['. $key .']');
93
+		    else {
94
+		    	$this->logger->info('Cache data saved for the key [' . $key . ']');
95 95
 		    	return true;
96 96
 		    }
97 97
 		}
@@ -103,15 +103,15 @@  discard block
 block discarded – undo
103 103
 		 * @return boolean      true if the cache is deleted, false if can't delete 
104 104
 		 * the cache or the cache with the given key not exist
105 105
 		 */
106
-		public function delete($key){
107
-			$this->logger->debug('Deleting of cache data for key [' .$key. ']');
106
+		public function delete($key) {
107
+			$this->logger->debug('Deleting of cache data for key [' . $key . ']');
108 108
 			$cacheInfo = $this->_getCacheInfo($key);
109
-			if($cacheInfo === false){
109
+			if ($cacheInfo === false) {
110 110
 				$this->logger->info('This cache data does not exists skipping');
111 111
 				return false;
112 112
 			}
113
-			else{
114
-				$this->logger->info('Found cache data for the key [' .$key. '] remove it');
113
+			else {
114
+				$this->logger->info('Found cache data for the key [' . $key . '] remove it');
115 115
 	      		return apc_delete($key) === true;
116 116
 			}
117 117
 		}
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 		 * 'expire' => expiration time of the cache (Unix timestamp),
125 125
 		 * 'ttl' => the time to live of the cache in second
126 126
 		 */
127
-		public function getInfo($key){
128
-			$this->logger->debug('Getting of cache info for key [' .$key. ']');
127
+		public function getInfo($key) {
128
+			$this->logger->debug('Getting of cache info for key [' . $key . ']');
129 129
 			$cacheInfos = $this->_getCacheInfo($key);
130
-			if($cacheInfos){
130
+			if ($cacheInfos) {
131 131
 				$data = array(
132 132
 							'mtime' => $cacheInfos['creation_time'],
133 133
 							'expire' => $cacheInfos['creation_time'] + $cacheInfos['ttl'],
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 							);
136 136
 				return $data;
137 137
 			}
138
-			else{
138
+			else {
139 139
 				$this->logger->info('This cache does not exists skipping');
140 140
 				return false;
141 141
 			}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		/**
146 146
 		 * Used to delete expired cache data
147 147
 		 */
148
-		public function deleteExpiredCache(){
148
+		public function deleteExpiredCache() {
149 149
 			//for APC[u] is done automatically
150 150
 			return true;
151 151
 		}
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 		/**
154 154
 		 * Remove all cache data
155 155
 		 */
156
-		public function clean(){
156
+		public function clean() {
157 157
 			$this->logger->debug('Deleting of all cache data');
158 158
 			$cacheInfos = apc_cache_info('user');
159
-			if(empty($cacheInfos['cache_list'])){
159
+			if (empty($cacheInfos['cache_list'])) {
160 160
 				$this->logger->info('No cache data were found skipping');
161 161
 				return false;
162 162
 			}
163
-			else{
163
+			else {
164 164
 				$this->logger->info('Found [' . count($cacheInfos) . '] cache data to remove');
165 165
 				return apc_clear_cache('user');
166 166
 			}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		 *
173 173
 		 * @return bool
174 174
 		 */
175
-		public function isSupported(){
175
+		public function isSupported() {
176 176
 			return (extension_loaded('apc') || extension_loaded('apcu')) && ini_get('apc.enabled');
177 177
 		}
178 178
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	     * Return the Log instance
181 181
 	     * @return Log
182 182
 	     */
183
-	    public function getLogger(){
183
+	    public function getLogger() {
184 184
 	      return $this->logger;
185 185
 	    }
186 186
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	     * Set the log instance
189 189
 	     * @param Log $logger the log object
190 190
 	     */
191
-	    public function setLogger(Log $logger){
191
+	    public function setLogger(Log $logger) {
192 192
 	      $this->logger = $logger;
193 193
 	      return $this;
194 194
 	    }
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 		* @param string $key the cache key to get the cache information 
200 200
 		* @return boolean|array
201 201
 		*/
202
-		private function _getCacheInfo($key){
202
+		private function _getCacheInfo($key) {
203 203
 			$caches = apc_cache_info('user');
204
-			if(! empty($caches['cache_list'])){
204
+			if (!empty($caches['cache_list'])) {
205 205
 				$cacheLists = $caches['cache_list'];
206
-				foreach ($cacheLists as $c){
207
-					if(isset($c['info']) && $c['info'] === $key){
206
+				foreach ($cacheLists as $c) {
207
+					if (isset($c['info']) && $c['info'] === $key) {
208 208
 						return $c;
209 209
 					}
210 210
 				}
Please login to merge, or discard this patch.