GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 8a2f54...8e2d68 )
by gyeong-won
07:47
created
config/config.inc.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @file   config/config.inc.php
8 8
  * @author NAVER ([email protected])
9 9
  */
10
-if(version_compare(PHP_VERSION, '5.4.0', '<'))
10
+if (version_compare(PHP_VERSION, '5.4.0', '<'))
11 11
 {
12 12
 	@error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING);
13 13
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	@error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT);
17 17
 }
18 18
 
19
-if(!defined('__XE__'))
19
+if (!defined('__XE__'))
20 20
 {
21 21
 	exit();
22 22
 }
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 // Set can use other method instead cookie to store session id(for file upload)
53 53
 ini_set('session.use_only_cookies', 0);
54 54
 
55
-if(file_exists(_XE_PATH_ . 'config/package.inc.php'))
55
+if (file_exists(_XE_PATH_.'config/package.inc.php'))
56 56
 {
57
-	require _XE_PATH_ . 'config/package.inc.php';
57
+	require _XE_PATH_.'config/package.inc.php';
58 58
 }
59 59
 else
60 60
 {
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
  * define('__ENABLE_PHPUNIT_TEST__', 0);
97 97
  * define('__PROXY_SERVER__', 'http://domain:port/path');
98 98
  */
99
-if(file_exists(_XE_PATH_ . 'config/config.user.inc.php'))
99
+if (file_exists(_XE_PATH_.'config/config.user.inc.php'))
100 100
 {
101
-	require _XE_PATH_ . 'config/config.user.inc.php';
101
+	require _XE_PATH_.'config/config.user.inc.php';
102 102
 }
103 103
 
104
-if(!defined('__DEBUG__'))
104
+if (!defined('__DEBUG__'))
105 105
 {
106 106
 	/**
107 107
 	 * output debug message(bit value)
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	define('__DEBUG__', 0);
117 117
 }
118 118
 
119
-if(!defined('__DEBUG_OUTPUT__'))
119
+if (!defined('__DEBUG_OUTPUT__'))
120 120
 {
121 121
 	/**
122 122
 	 * output location of debug message
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	define('__DEBUG_OUTPUT__', 0);
131 131
 }
132 132
 
133
-if(!defined('__DEBUG_PROTECT__'))
133
+if (!defined('__DEBUG_PROTECT__'))
134 134
 {
135 135
 	/**
136 136
 	 * output comments of the firePHP console and browser
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	define('__DEBUG_PROTECT__', 1);
144 144
 }
145 145
 
146
-if(!defined('__DEBUG_PROTECT_IP__'))
146
+if (!defined('__DEBUG_PROTECT_IP__'))
147 147
 {
148 148
 	/**
149 149
 	 * Set a ip address to allow debug
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	define('__DEBUG_PROTECT_IP__', '127.0.0.1');
152 152
 }
153 153
 
154
-if(!defined('__DEBUG_DB_OUTPUT__'))
154
+if (!defined('__DEBUG_DB_OUTPUT__'))
155 155
 {
156 156
 	/**
157 157
 	 * DB error message definition
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	define('__DEBUG_DB_OUTPUT__', 0);
165 165
 }
166 166
 
167
-if(!defined('__LOG_SLOW_QUERY__'))
167
+if (!defined('__LOG_SLOW_QUERY__'))
168 168
 {
169 169
 	/**
170 170
 	 * Query log for only timeout query among DB queries
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	define('__LOG_SLOW_QUERY__', 0);
179 179
 }
180 180
 
181
-if(!defined('__LOG_SLOW_TRIGGER__'))
181
+if (!defined('__LOG_SLOW_TRIGGER__'))
182 182
 {
183 183
 	/**
184 184
 	 * Trigger excute time log
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	define('__LOG_SLOW_TRIGGER__', 0);
193 193
 }
194 194
 
195
-if(!defined('__LOG_SLOW_ADDON__'))
195
+if (!defined('__LOG_SLOW_ADDON__'))
196 196
 {
197 197
 	/**
198 198
 	 * Addon excute time log
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	define('__LOG_SLOW_ADDON__', 0);
207 207
 }
208 208
 
209
-if(!defined('__LOG_SLOW_WIDGET__'))
209
+if (!defined('__LOG_SLOW_WIDGET__'))
210 210
 {
211 211
 	/**
212 212
 	 * Widget excute time log
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	define('__LOG_SLOW_WIDGET__', 0);
221 221
 }
222 222
 
223
-if(!defined('__DEBUG_QUERY__'))
223
+if (!defined('__DEBUG_QUERY__'))
224 224
 {
225 225
 	/**
226 226
 	 * Leave DB query information
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	define('__DEBUG_QUERY__', 0);
234 234
 }
235 235
 
236
-if(!defined('__OB_GZHANDLER_ENABLE__'))
236
+if (!defined('__OB_GZHANDLER_ENABLE__'))
237 237
 {
238 238
 	/**
239 239
 	 * option to enable/disable a compression feature using ob_gzhandler
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 	define('__OB_GZHANDLER_ENABLE__', 1);
248 248
 }
249 249
 
250
-if(!defined('__ENABLE_PHPUNIT_TEST__'))
250
+if (!defined('__ENABLE_PHPUNIT_TEST__'))
251 251
 {
252 252
 	/**
253 253
 	 * decide to use/not use the php unit test (Path/tests/index.php)
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	define('__ENABLE_PHPUNIT_TEST__', 0);
261 261
 }
262 262
 
263
-if(!defined('__PROXY_SERVER__'))
263
+if (!defined('__PROXY_SERVER__'))
264 264
 {
265 265
 	/**
266 266
 	 * __PROXY_SERVER__ has server information to request to the external through the target server
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	define('__PROXY_SERVER__', NULL);
270 270
 }
271 271
 
272
-if(!defined('__ERROR_LOG__'))
272
+if (!defined('__ERROR_LOG__'))
273 273
 {
274 274
 	/**
275 275
 	 * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다.
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	define('__ERROR_LOG__', 0);
281 281
 }
282 282
 
283
-if(!defined('__DISABLE_DEFAULT_CSS__'))
283
+if (!defined('__DISABLE_DEFAULT_CSS__'))
284 284
 {
285 285
 	/**
286 286
 	 * XE의 기본 CSS 스타일을 로드하지 않도록 합니다.
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 }
297 297
 
298 298
 // Require specific files when using Firebug console output
299
-if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1)
299
+if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1)
300 300
 {
301
-	require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php';
301
+	require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';
302 302
 }
303 303
 
304 304
 // Set Timezone as server time
305
-if(version_compare(PHP_VERSION, '5.3.0') >= 0)
305
+if (version_compare(PHP_VERSION, '5.3.0') >= 0)
306 306
 {
307 307
 	date_default_timezone_set(@date_default_timezone_get());
308 308
 }
@@ -408,68 +408,68 @@  discard block
 block discarded – undo
408 408
  * Invalidates a cached script of OPcache when version is changed.
409 409
  * @see https://github.com/xpressengine/xe-core/issues/2189
410 410
  **/
411
-if(
412
-	!is_dir(_XE_PATH_ . 'files/cache/store/' . __XE_VERSION__)
411
+if (
412
+	!is_dir(_XE_PATH_.'files/cache/store/'.__XE_VERSION__)
413 413
 	&& function_exists('opcache_get_status')
414 414
 	&& function_exists('opcache_invalidate')
415 415
 )
416 416
 {
417
-	foreach($GLOBALS['__xe_autoload_file_map'] as $script) {
418
-		opcache_invalidate(_XE_PATH_ . $script, true);
417
+	foreach ($GLOBALS['__xe_autoload_file_map'] as $script) {
418
+		opcache_invalidate(_XE_PATH_.$script, true);
419 419
 	}
420
-	opcache_invalidate(_XE_PATH_ . 'config/func.inc.php', true);
420
+	opcache_invalidate(_XE_PATH_.'config/func.inc.php', true);
421 421
 }
422 422
 
423 423
 // Require a function-defined-file for simple use
424
-require(_XE_PATH_ . 'config/func.inc.php');
424
+require(_XE_PATH_.'config/func.inc.php');
425 425
 
426
-if(__DEBUG__) {
426
+if (__DEBUG__) {
427 427
 	define('__StartTime__', getMicroTime());
428 428
 }
429 429
 
430
-if(__DEBUG__) {
430
+if (__DEBUG__) {
431 431
 	$GLOBALS['__elapsed_class_load__'] = 0;
432 432
 }
433 433
 
434 434
 function __xe_autoload($class_name)
435 435
 {
436
-	if(__DEBUG__) {
436
+	if (__DEBUG__) {
437 437
 		$time_at = getMicroTime();
438 438
 	}
439 439
 
440
-	if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]))
440
+	if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]))
441 441
 	{
442
-		require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)];
442
+		require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)];
443 443
 	}
444
-	elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches))
444
+	elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches))
445 445
 	{
446 446
 		$candidate_filename = array();
447
-		$candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1];
448
-		if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin';
447
+		$candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1];
448
+		if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin';
449 449
 		$candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class';
450 450
 		$candidate_filename[] = 'php';
451 451
 
452 452
 		$candidate_filename = implode('.', $candidate_filename);
453 453
 
454
-		if(file_exists(_XE_PATH_ . $candidate_filename))
454
+		if (file_exists(_XE_PATH_.$candidate_filename))
455 455
 		{
456
-			require _XE_PATH_ . $candidate_filename;
456
+			require _XE_PATH_.$candidate_filename;
457 457
 		}
458 458
 	}
459 459
 
460
-	if(__DEBUG__) {
460
+	if (__DEBUG__) {
461 461
 		$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at;
462 462
 	}
463 463
 }
464 464
 spl_autoload_register('__xe_autoload');
465 465
 
466
-if(version_compare(PHP_VERSION, '7.2', '<'))
466
+if (version_compare(PHP_VERSION, '7.2', '<'))
467 467
 {
468 468
 	class_alias('BaseObject', 'Object', true);
469 469
 }
470 470
 
471
-if(file_exists(_XE_PATH_  . '/vendor/autoload.php')) {
472
-	require _XE_PATH_  . '/vendor/autoload.php';
471
+if (file_exists(_XE_PATH_.'/vendor/autoload.php')) {
472
+	require _XE_PATH_.'/vendor/autoload.php';
473 473
 }
474 474
 /* End of file config.inc.php */
475 475
 /* Location: ./config/config.inc.php */
Please login to merge, or discard this patch.
classes/file/FileHandler.class.php 2 patches
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 */
18 18
 	function getRealPath($source)
19 19
 	{
20
-		if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
20
+		if (strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
21 21
 		{
22
-			return _XE_PATH_ . substr($source, 2);
22
+			return _XE_PATH_.substr($source, 2);
23 23
 		}
24 24
 
25 25
 		return $source;
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	{
41 41
 		$source_dir = self::getRealPath($source_dir);
42 42
 		$target_dir = self::getRealPath($target_dir);
43
-		if(!is_dir($source_dir))
43
+		if (!is_dir($source_dir))
44 44
 		{
45 45
 			return FALSE;
46 46
 		}
@@ -48,44 +48,44 @@  discard block
 block discarded – undo
48 48
 		// generate when no target exists
49 49
 		self::makeDir($target_dir);
50 50
 
51
-		if(substr($source_dir, -1) != DIRECTORY_SEPARATOR)
51
+		if (substr($source_dir, -1) != DIRECTORY_SEPARATOR)
52 52
 		{
53 53
 			$source_dir .= DIRECTORY_SEPARATOR;
54 54
 		}
55 55
 
56
-		if(substr($target_dir, -1) != DIRECTORY_SEPARATOR)
56
+		if (substr($target_dir, -1) != DIRECTORY_SEPARATOR)
57 57
 		{
58 58
 			$target_dir .= DIRECTORY_SEPARATOR;
59 59
 		}
60 60
 
61 61
 		$oDir = dir($source_dir);
62
-		while($file = $oDir->read())
62
+		while ($file = $oDir->read())
63 63
 		{
64
-			if($file{0} == '.')
64
+			if ($file{0} == '.')
65 65
 			{
66 66
 				continue;
67 67
 			}
68 68
 
69
-			if($filter && preg_match($filter, $file))
69
+			if ($filter && preg_match($filter, $file))
70 70
 			{
71 71
 				continue;
72 72
 			}
73 73
 
74
-			if(is_dir($source_dir . $file))
74
+			if (is_dir($source_dir.$file))
75 75
 			{
76
-				self::copyDir($source_dir . $file, $target_dir . $file, $type);
76
+				self::copyDir($source_dir.$file, $target_dir.$file, $type);
77 77
 			}
78 78
 			else
79 79
 			{
80
-				if($type == 'force')
80
+				if ($type == 'force')
81 81
 				{
82
-					@unlink($target_dir . $file);
82
+					@unlink($target_dir.$file);
83 83
 				}
84 84
 				else
85 85
 				{
86
-					if(!file_exists($target_dir . $file))
86
+					if (!file_exists($target_dir.$file))
87 87
 					{
88
-						@copy($source_dir . $file, $target_dir . $file);
88
+						@copy($source_dir.$file, $target_dir.$file);
89 89
 					}
90 90
 				}
91 91
 			}
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 
111 111
 		self::makeDir($target_dir);
112 112
 
113
-		if($force == 'Y')
113
+		if ($force == 'Y')
114 114
 		{
115
-			@unlink($target_dir . DIRECTORY_SEPARATOR . $target);
115
+			@unlink($target_dir.DIRECTORY_SEPARATOR.$target);
116 116
 		}
117 117
 
118
-		@copy($source, $target_dir . DIRECTORY_SEPARATOR . $target);
118
+		@copy($source, $target_dir.DIRECTORY_SEPARATOR.$target);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	function readFile($filename)
128 128
 	{
129
-		if(($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
129
+		if (($filename = self::exists($filename)) === FALSE || filesize($filename) < 1)
130 130
 		{
131 131
 			return;
132 132
 		}
@@ -149,12 +149,12 @@  discard block
 block discarded – undo
149 149
 		self::makeDir($pathinfo['dirname']);
150 150
 
151 151
 		$flags = 0;
152
-		if(strtolower($mode) == 'a')
152
+		if (strtolower($mode) == 'a')
153 153
 		{
154 154
 			$flags = FILE_APPEND;
155 155
 		}
156 156
 
157
-		@file_put_contents($filename, $buff, $flags|LOCK_EX);
157
+		@file_put_contents($filename, $buff, $flags | LOCK_EX);
158 158
 		@chmod($filename, 0644);
159 159
 		self::clearStatCache($filename);
160 160
 		self::invalidateOpcache($filename);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	function moveFile($source, $target)
196 196
 	{
197
-		if(($source = self::exists($source)) !== FALSE)
197
+		if (($source = self::exists($source)) !== FALSE)
198 198
 		{
199 199
 			self::removeFile($target);
200 200
 			return self::rename($source, $target);
@@ -232,35 +232,35 @@  discard block
 block discarded – undo
232 232
 		$path = self::getRealPath($path);
233 233
 		$output = array();
234 234
 
235
-		if(substr($path, -1) != '/')
235
+		if (substr($path, -1) != '/')
236 236
 		{
237 237
 			$path .= '/';
238 238
 		}
239 239
 
240
-		if(!is_dir($path))
240
+		if (!is_dir($path))
241 241
 		{
242 242
 			return $output;
243 243
 		}
244 244
 
245 245
 		$files = scandir($path);
246
-		foreach($files as $file)
246
+		foreach ($files as $file)
247 247
 		{
248
-			if($file{0} == '.' || ($filter && !preg_match($filter, $file)))
248
+			if ($file{0} == '.' || ($filter && !preg_match($filter, $file)))
249 249
 			{
250 250
 				continue;
251 251
 			}
252 252
 
253
-			if($to_lower)
253
+			if ($to_lower)
254 254
 			{
255 255
 				$file = strtolower($file);
256 256
 			}
257 257
 
258
-			if($filter)
258
+			if ($filter)
259 259
 			{
260 260
 				$file = preg_replace($filter, '$1', $file);
261 261
 			}
262 262
 
263
-			if($concat_prefix)
263
+			if ($concat_prefix)
264 264
 			{
265 265
 				$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
266 266
 			}
@@ -281,12 +281,12 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	function makeDir($path_string)
283 283
 	{
284
-		if(self::exists($path_string) !== FALSE)
284
+		if (self::exists($path_string) !== FALSE)
285 285
 		{
286 286
 			return TRUE;
287 287
 		}
288 288
 
289
-		if(!ini_get('safe_mode'))
289
+		if (!ini_get('safe_mode'))
290 290
 		{
291 291
 			@mkdir($path_string, 0755, TRUE);
292 292
 			@chmod($path_string, 0755);
@@ -297,35 +297,35 @@  discard block
 block discarded – undo
297 297
 			static $oFtp = NULL;
298 298
 
299 299
 			$ftp_info = Context::getFTPInfo();
300
-			if($oFtp == NULL)
300
+			if ($oFtp == NULL)
301 301
 			{
302
-				if(!Context::isFTPRegisted())
302
+				if (!Context::isFTPRegisted())
303 303
 				{
304 304
 					return;
305 305
 				}
306 306
 
307
-				require_once(_XE_PATH_ . 'libs/ftp.class.php');
307
+				require_once(_XE_PATH_.'libs/ftp.class.php');
308 308
 				$oFtp = new ftp();
309
-				if(!$ftp_info->ftp_host)
309
+				if (!$ftp_info->ftp_host)
310 310
 				{
311 311
 					$ftp_info->ftp_host = "127.0.0.1";
312 312
 				}
313
-				if(!$ftp_info->ftp_port)
313
+				if (!$ftp_info->ftp_port)
314 314
 				{
315 315
 					$ftp_info->ftp_port = 21;
316 316
 				}
317
-				if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
317
+				if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
318 318
 				{
319 319
 					return;
320 320
 				}
321
-				if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
321
+				if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
322 322
 				{
323 323
 					$oFtp->ftp_quit();
324 324
 					return;
325 325
 				}
326 326
 			}
327 327
 
328
-			if(!($ftp_path = $ftp_info->ftp_root_path))
328
+			if (!($ftp_path = $ftp_info->ftp_root_path))
329 329
 			{
330 330
 				$ftp_path = DIRECTORY_SEPARATOR;
331 331
 			}
@@ -334,19 +334,19 @@  discard block
 block discarded – undo
334 334
 			$path_list = explode(DIRECTORY_SEPARATOR, $path_string);
335 335
 
336 336
 			$path = _XE_PATH_;
337
-			for($i = 0, $c = count($path_list); $i < $c; $i++)
337
+			for ($i = 0, $c = count($path_list); $i < $c; $i++)
338 338
 			{
339
-				if(!$path_list[$i])
339
+				if (!$path_list[$i])
340 340
 				{
341 341
 					continue;
342 342
 				}
343 343
 
344
-				$path .= $path_list[$i] . DIRECTORY_SEPARATOR;
345
-				$ftp_path .= $path_list[$i] . DIRECTORY_SEPARATOR;
346
-				if(!is_dir($path))
344
+				$path .= $path_list[$i].DIRECTORY_SEPARATOR;
345
+				$ftp_path .= $path_list[$i].DIRECTORY_SEPARATOR;
346
+				if (!is_dir($path))
347 347
 				{
348 348
 					$oFtp->ftp_mkdir($ftp_path);
349
-					$oFtp->ftp_site("CHMOD 777 " . $ftp_path);
349
+					$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
350 350
 				}
351 351
 			}
352 352
 		}
@@ -362,23 +362,23 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	function removeDir($path)
364 364
 	{
365
-		if(($path = self::isDir($path)) === FALSE)
365
+		if (($path = self::isDir($path)) === FALSE)
366 366
 		{
367 367
 			return;
368 368
 		}
369 369
 
370
-		if(self::isDir($path))
370
+		if (self::isDir($path))
371 371
 		{
372 372
 			$files = array_diff(scandir($path), array('..', '.'));
373 373
 
374
-			foreach($files as $file)
374
+			foreach ($files as $file)
375 375
 			{
376
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
376
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
377 377
 				{
378 378
 					continue;
379 379
 				}
380 380
 
381
-				if(is_dir($target))
381
+				if (is_dir($target))
382 382
 				{
383 383
 					self::removeDir($target);
384 384
 				}
@@ -403,22 +403,22 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function removeBlankDir($path)
405 405
 	{
406
-		if(($path = self::isDir($path)) === FALSE)
406
+		if (($path = self::isDir($path)) === FALSE)
407 407
 		{
408 408
 			return;
409 409
 		}
410 410
 
411 411
 		$files = array_diff(scandir($path), array('..', '.'));
412 412
 
413
-		if(count($files) < 1)
413
+		if (count($files) < 1)
414 414
 		{
415 415
 			rmdir($path);
416 416
 			return;
417 417
 		}
418 418
 
419
-		foreach($files as $file)
419
+		foreach ($files as $file)
420 420
 		{
421
-			if(($target = self::isDir($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
421
+			if (($target = self::isDir($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
422 422
 			{
423 423
 				continue;
424 424
 			}
@@ -437,23 +437,23 @@  discard block
 block discarded – undo
437 437
 	 */
438 438
 	function removeFilesInDir($path)
439 439
 	{
440
-		if(($path = self::getRealPath($path)) === FALSE)
440
+		if (($path = self::getRealPath($path)) === FALSE)
441 441
 		{
442 442
 			return;
443 443
 		}
444 444
 
445
-		if(is_dir($path))
445
+		if (is_dir($path))
446 446
 		{
447 447
 			$files = array_diff(scandir($path), array('..', '.'));
448 448
 
449
-			foreach($files as $file)
449
+			foreach ($files as $file)
450 450
 			{
451
-				if(($target = self::getRealPath($path . DIRECTORY_SEPARATOR . $file)) === FALSE)
451
+				if (($target = self::getRealPath($path.DIRECTORY_SEPARATOR.$file)) === FALSE)
452 452
 				{
453 453
 					continue;
454 454
 				}
455 455
 
456
-				if(is_dir($target))
456
+				if (is_dir($target))
457 457
 				{
458 458
 					self::removeFilesInDir($target);
459 459
 				}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		}
466 466
 		else
467 467
 		{
468
-			if(self::exists($path)) unlink($path);
468
+			if (self::exists($path)) unlink($path);
469 469
 		}
470 470
 
471 471
 	}
@@ -479,22 +479,22 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	function filesize($size)
481 481
 	{
482
-		if(!$size)
482
+		if (!$size)
483 483
 		{
484 484
 			return '0Byte';
485 485
 		}
486 486
 
487
-		if($size === 1)
487
+		if ($size === 1)
488 488
 		{
489 489
 			return '1Byte';
490 490
 		}
491 491
 
492
-		if($size < 1024)
492
+		if ($size < 1024)
493 493
 		{
494
-			return $size . 'Bytes';
494
+			return $size.'Bytes';
495 495
 		}
496 496
 
497
-		if($size >= 1024 && $size < 1024 * 1024)
497
+		if ($size >= 1024 && $size < 1024 * 1024)
498 498
 		{
499 499
 			return sprintf("%0.1fKB", $size / 1024);
500 500
 		}
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 	 */
520 520
 	function getRemoteResource($url, $body = null, $timeout = 3, $method = 'GET', $content_type = null, $headers = array(), $cookies = array(), $post_data = array(), $request_config = array())
521 521
 	{
522
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
522
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
523 523
 		$IDN = new idna_convert(array('idn_version' => 2008));
524 524
 		$url = $IDN->encode($url);
525 525
 
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			require_once('HTTP/Request.php');
530 530
 
531 531
 			$parsed_url = parse_url(__PROXY_SERVER__);
532
-			if($parsed_url["host"] && $parsed_url["path"])
532
+			if ($parsed_url["host"] && $parsed_url["path"])
533 533
 			{
534 534
 				// Old style proxy server support (POST payload to proxy script)
535 535
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 				$oRequest = new HTTP_Request($url);
542 542
 
543 543
 				// New style proxy server support (Use HTTP_Request2 native config format)
544
-				if($parsed_url['host'])
544
+				if ($parsed_url['host'])
545 545
 				{
546 546
 					$request_config['proxy_host'] = $parsed_url['host'];
547 547
 					$request_config['proxy_port'] = $parsed_url['port'] ? $parsed_url['port'] : '';
@@ -550,13 +550,13 @@  discard block
 block discarded – undo
550 550
 					$request_config['proxy_type'] = $parsed_url['scheme'] ? $parsed_url['scheme'] : 'http';
551 551
 				}
552 552
 
553
-				if(count($request_config) && method_exists($oRequest, 'setConfig'))
553
+				if (count($request_config) && method_exists($oRequest, 'setConfig'))
554 554
 				{
555
-					foreach($request_config as $key=>$val)
555
+					foreach ($request_config as $key=>$val)
556 556
 					{
557
-						if($key === 'observers')
557
+						if ($key === 'observers')
558 558
 						{
559
-							foreach($val as $observer)
559
+							foreach ($val as $observer)
560 560
 							{
561 561
 								$oRequest->attach($observer);
562 562
 							}
@@ -567,58 +567,58 @@  discard block
 block discarded – undo
567 567
 						}
568 568
 					}
569 569
 				}
570
-				if(method_exists($oRequest, 'setConfig'))
570
+				if (method_exists($oRequest, 'setConfig'))
571 571
 				{
572
-					if(extension_loaded('curl'))
572
+					if (extension_loaded('curl'))
573 573
 					{
574 574
 						$oRequest->setConfig('adapter', 'curl');
575 575
 					}
576
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
576
+					elseif (version_compare(PHP_VERSION, '5.6', '<'))
577 577
 					{
578 578
 						$oRequest->setConfig('ssl_verify_host', false);
579 579
 					}
580
-					if(file_exists(_XE_PATH_ . 'libs/cacert/cacert.pem'))
580
+					if (file_exists(_XE_PATH_.'libs/cacert/cacert.pem'))
581 581
 					{
582
-						$oRequest->setConfig('ssl_cafile', _XE_PATH_ . 'libs/cacert/cacert.pem');
582
+						$oRequest->setConfig('ssl_cafile', _XE_PATH_.'libs/cacert/cacert.pem');
583 583
 					}
584 584
 				}
585 585
 
586
-				if(count($headers) > 0)
586
+				if (count($headers) > 0)
587 587
 				{
588
-					foreach($headers as $key => $val)
588
+					foreach ($headers as $key => $val)
589 589
 					{
590 590
 						$oRequest->addHeader($key, $val);
591 591
 					}
592 592
 				}
593 593
 				$host = parse_url($url, PHP_URL_HOST);
594
-				if($cookies[$host])
594
+				if ($cookies[$host])
595 595
 				{
596
-					foreach($cookies[$host] as $key => $val)
596
+					foreach ($cookies[$host] as $key => $val)
597 597
 					{
598 598
 						$oRequest->addCookie($key, $val);
599 599
 					}
600 600
 				}
601
-				if(count($post_data) > 0)
601
+				if (count($post_data) > 0)
602 602
 				{
603
-					foreach($post_data as $key => $val)
603
+					foreach ($post_data as $key => $val)
604 604
 					{
605 605
 						$oRequest->addPostData($key, $val);
606 606
 					}
607 607
 				}
608
-				if(!$content_type)
608
+				if (!$content_type)
609 609
 					$oRequest->addHeader('Content-Type', 'text/html');
610 610
 				else
611 611
 					$oRequest->addHeader('Content-Type', $content_type);
612 612
 				$oRequest->setMethod($method);
613
-				if($body)
613
+				if ($body)
614 614
 					$oRequest->setBody($body);
615 615
 			}
616 616
 			
617
-			if(method_exists($oRequest, 'setConfig'))
617
+			if (method_exists($oRequest, 'setConfig'))
618 618
 			{
619 619
 				$oRequest->setConfig('timeout', $timeout);
620 620
 			}
621
-			elseif(property_exists($oRequest, '_timeout'))
621
+			elseif (property_exists($oRequest, '_timeout'))
622 622
 			{
623 623
 				$oRequest->_timeout = $timeout;
624 624
 			}
@@ -628,25 +628,25 @@  discard block
 block discarded – undo
628 628
 			$code = $oRequest->getResponseCode();
629 629
 			$header = $oRequest->getResponseHeader();
630 630
 			$response = $oRequest->getResponseBody();
631
-			if($c = $oRequest->getResponseCookies())
631
+			if ($c = $oRequest->getResponseCookies())
632 632
 			{
633
-				foreach($c as $k => $v)
633
+				foreach ($c as $k => $v)
634 634
 				{
635 635
 					$cookies[$host][$v['name']] = $v['value'];
636 636
 				}
637 637
 			}
638 638
 
639
-			if($code > 300 && $code < 399 && $header['location'])
639
+			if ($code > 300 && $code < 399 && $header['location'])
640 640
 			{
641 641
 				return self::getRemoteResource($header['location'], $body, $timeout, $method, $content_type, $headers, $cookies, $post_data);
642 642
 			}
643 643
 
644
-			if($code != 200)
644
+			if ($code != 200)
645 645
 			{
646 646
 				return;
647 647
 			}
648 648
 
649
-			if(isset($request_config['store_body']) && !$request_config['store_body'])
649
+			if (isset($request_config['store_body']) && !$request_config['store_body'])
650 650
 			{
651 651
 				return TRUE;
652 652
 			}
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 				return $response;
656 656
 			}
657 657
 		}
658
-		catch(Exception $e)
658
+		catch (Exception $e)
659 659
 		{
660 660
 			return NULL;
661 661
 		}
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 		{
688 688
 			$result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
689 689
 		}
690
-		catch(Exception $e)
690
+		catch (Exception $e)
691 691
 		{
692 692
 			return FALSE;
693 693
 		}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	function returnBytes($val)
705 705
 	{
706 706
 		$unit = strtoupper(substr($val, -1));
707
-		$val = (float)$val;
707
+		$val = (float) $val;
708 708
 
709 709
 		switch ($unit)
710 710
 		{
@@ -727,13 +727,13 @@  discard block
 block discarded – undo
727 727
 		$K64 = 65536;
728 728
 		$TWEAKFACTOR = 2.0;
729 729
 		$channels = $imageInfo['channels'];
730
-		if(!$channels)
730
+		if (!$channels)
731 731
 		{
732 732
 			$channels = 6; //for png
733 733
 		}
734
-		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64 ) * $TWEAKFACTOR);
734
+		$memoryNeeded = round(($imageInfo[0] * $imageInfo[1] * $imageInfo['bits'] * $channels / 8 + $K64) * $TWEAKFACTOR);
735 735
 		$availableMemory = self::returnBytes(ini_get('memory_limit')) - memory_get_usage();
736
-		if($availableMemory < $memoryNeeded)
736
+		if ($availableMemory < $memoryNeeded)
737 737
 		{
738 738
 			return FALSE;
739 739
 		}
@@ -760,30 +760,30 @@  discard block
 block discarded – undo
760 760
 		}
761 761
 
762 762
 		$target_file = self::getRealPath($target_file);
763
-		if(!$resize_width)
763
+		if (!$resize_width)
764 764
 		{
765 765
 			$resize_width = 100;
766 766
 		}
767 767
 
768
-		if(!$resize_height)
768
+		if (!$resize_height)
769 769
 		{
770 770
 			$resize_height = $resize_width;
771 771
 		}
772 772
 
773 773
 		// retrieve source image's information
774 774
 		$imageInfo = getimagesize($source_file);
775
-		if(!self::checkMemoryLoadImage($imageInfo))
775
+		if (!self::checkMemoryLoadImage($imageInfo))
776 776
 		{
777 777
 			return FALSE;
778 778
 		}
779 779
 
780 780
 		list($width, $height, $type, $attrs) = $imageInfo;
781
-		if($width < 1 || $height < 1)
781
+		if ($width < 1 || $height < 1)
782 782
 		{
783 783
 			return;
784 784
 		}
785 785
 
786
-		switch($type)
786
+		switch ($type)
787 787
 		{
788 788
 			case '1' :
789 789
 				$type = 'gif';
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 				return;
802 802
 		}
803 803
 
804
-		if(!$target_type)
804
+		if (!$target_type)
805 805
 		{
806 806
 			$target_type = $type;
807 807
 		}
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 		$height_per = ($resize_height > 0 && $height >= $resize_height) ? $resize_height / $height : 1;
813 813
 
814 814
 		$per = NULL;
815
-		if($thumbnail_type == 'ratio')
815
+		if ($thumbnail_type == 'ratio')
816 816
 		{
817 817
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
818 818
 			$resize_width = $width * $per;
@@ -825,16 +825,16 @@  discard block
 block discarded – undo
825 825
 
826 826
 		// create temporary image with target size
827 827
 		$thumb = NULL;
828
-		if(function_exists('imagecreateTRUEcolor'))
828
+		if (function_exists('imagecreateTRUEcolor'))
829 829
 		{
830 830
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
831 831
 		}
832
-		else if(function_exists('imagecreate'))
832
+		else if (function_exists('imagecreate'))
833 833
 		{
834 834
 			$thumb = imagecreate($resize_width, $resize_height);
835 835
 		}
836 836
 
837
-		if(!$thumb)
837
+		if (!$thumb)
838 838
 		{
839 839
 			return FALSE;
840 840
 		}
@@ -843,37 +843,37 @@  discard block
 block discarded – undo
843 843
 
844 844
 		// create temporary image having original type
845 845
 		$source = NULL;
846
-		switch($type)
846
+		switch ($type)
847 847
 		{
848 848
 			case 'gif' :
849
-				if(function_exists('imagecreatefromgif'))
849
+				if (function_exists('imagecreatefromgif'))
850 850
 				{
851 851
 					$source = @imagecreatefromgif($source_file);
852 852
 				}
853 853
 				break;
854 854
 			case 'jpeg' :
855 855
 			case 'jpg' :
856
-				if(function_exists('imagecreatefromjpeg'))
856
+				if (function_exists('imagecreatefromjpeg'))
857 857
 				{
858 858
 					$source = @imagecreatefromjpeg($source_file);
859 859
 				}
860 860
 				break;
861 861
 			case 'png' :
862
-				if(function_exists('imagecreatefrompng'))
862
+				if (function_exists('imagecreatefrompng'))
863 863
 				{
864 864
 					$source = @imagecreatefrompng($source_file);
865 865
 				}
866 866
 				break;
867 867
 			case 'wbmp' :
868 868
 			case 'bmp' :
869
-				if(function_exists('imagecreatefromwbmp'))
869
+				if (function_exists('imagecreatefromwbmp'))
870 870
 				{
871 871
 					$source = @imagecreatefromwbmp($source_file);
872 872
 				}
873 873
 				break;
874 874
 		}
875 875
 
876
-		if(!$source)
876
+		if (!$source)
877 877
 		{
878 878
 			imagedestroy($thumb);
879 879
 			return FALSE;
@@ -885,13 +885,13 @@  discard block
 block discarded – undo
885 885
 
886 886
 		$x = 0;
887 887
 		$y = 0;
888
-		if($thumbnail_type == 'crop')
888
+		if ($thumbnail_type == 'crop')
889 889
 		{
890 890
 			$x = (int) ($resize_width / 2 - $new_width / 2);
891 891
 			$y = (int) ($resize_height / 2 - $new_height / 2);
892 892
 		}
893 893
 
894
-		if(function_exists('imagecopyresampled'))
894
+		if (function_exists('imagecopyresampled'))
895 895
 		{
896 896
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
897 897
 		}
@@ -905,30 +905,30 @@  discard block
 block discarded – undo
905 905
 
906 906
 		// write into the file
907 907
 		$output = NULL;
908
-		switch($target_type)
908
+		switch ($target_type)
909 909
 		{
910 910
 			case 'gif' :
911
-				if(function_exists('imagegif'))
911
+				if (function_exists('imagegif'))
912 912
 				{
913 913
 					$output = imagegif($thumb, $target_file);
914 914
 				}
915 915
 				break;
916 916
 			case 'jpeg' :
917 917
 			case 'jpg' :
918
-				if(function_exists('imagejpeg'))
918
+				if (function_exists('imagejpeg'))
919 919
 				{
920 920
 					$output = imagejpeg($thumb, $target_file, 100);
921 921
 				}
922 922
 				break;
923 923
 			case 'png' :
924
-				if(function_exists('imagepng'))
924
+				if (function_exists('imagepng'))
925 925
 				{
926 926
 					$output = imagepng($thumb, $target_file, 9);
927 927
 				}
928 928
 				break;
929 929
 			case 'wbmp' :
930 930
 			case 'bmp' :
931
-				if(function_exists('imagewbmp'))
931
+				if (function_exists('imagewbmp'))
932 932
 				{
933 933
 					$output = imagewbmp($thumb, $target_file, 100);
934 934
 				}
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 		imagedestroy($thumb);
939 939
 		imagedestroy($source);
940 940
 
941
-		if(!$output)
941
+		if (!$output)
942 942
 		{
943 943
 			return FALSE;
944 944
 		}
@@ -956,12 +956,12 @@  discard block
 block discarded – undo
956 956
 	 */
957 957
 	function readIniFile($filename)
958 958
 	{
959
-		if(($filename = self::exists($filename)) === FALSE)
959
+		if (($filename = self::exists($filename)) === FALSE)
960 960
 		{
961 961
 			return FALSE;
962 962
 		}
963 963
 		$arr = parse_ini_file($filename, TRUE);
964
-		if(is_array($arr) && count($arr) > 0)
964
+		if (is_array($arr) && count($arr) > 0)
965 965
 		{
966 966
 			return $arr;
967 967
 		}
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 	 */
988 988
 	function writeIniFile($filename, $arr)
989 989
 	{
990
-		if(!is_array($arr) || count($arr) == 0)
990
+		if (!is_array($arr) || count($arr) == 0)
991 991
 		{
992 992
 			return FALSE;
993 993
 		}
@@ -1004,19 +1004,19 @@  discard block
 block discarded – undo
1004 1004
 	function _makeIniBuff($arr)
1005 1005
 	{
1006 1006
 		$return = array();
1007
-		foreach($arr as $key => $val)
1007
+		foreach ($arr as $key => $val)
1008 1008
 		{
1009 1009
 			// section
1010
-			if(is_array($val))
1010
+			if (is_array($val))
1011 1011
 			{
1012 1012
 				$return[] = sprintf("[%s]", $key);
1013
-				foreach($val as $k => $v)
1013
+				foreach ($val as $k => $v)
1014 1014
 				{
1015 1015
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1016 1016
 				}
1017 1017
 				// value
1018 1018
 			}
1019
-			else if(is_object($val))
1019
+			else if (is_object($val))
1020 1020
 			{
1021 1021
 				continue;
1022 1022
 			}
@@ -1091,15 +1091,15 @@  discard block
 block discarded – undo
1091 1091
 	function isWritableDir($path)
1092 1092
 	{
1093 1093
 		$path = self::getRealPath($path);
1094
-		if(is_dir($path)==FALSE)
1094
+		if (is_dir($path) == FALSE)
1095 1095
 		{
1096 1096
 			return FALSE;
1097 1097
 		}
1098 1098
 
1099
-		$checkFile = $path . '/_CheckWritableDir';
1099
+		$checkFile = $path.'/_CheckWritableDir';
1100 1100
 
1101 1101
 		$fp = fopen($checkFile, 'w');
1102
-		if(!is_resource($fp))
1102
+		if (!is_resource($fp))
1103 1103
 		{
1104 1104
 			return FALSE;
1105 1105
 		}
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	 **/
1118 1118
 	static public function clearStatCache($target, $include = false)
1119 1119
 	{
1120
-		if(is_array($target))
1120
+		if (is_array($target))
1121 1121
 		{
1122 1122
 			array_map('self::clearStatCache', $target);
1123 1123
 			return;
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 		$target = self::getRealPath($target);
1127 1127
 
1128
-		if($include && self::isDir($target))
1128
+		if ($include && self::isDir($target))
1129 1129
 		{
1130 1130
 			self::clearStatCache(self::readDir($target, '', false, true), $include);
1131 1131
 		}
@@ -1143,27 +1143,27 @@  discard block
 block discarded – undo
1143 1143
 	{
1144 1144
 		static $opcache = null;
1145 1145
 
1146
-		if($opcache === null)
1146
+		if ($opcache === null)
1147 1147
 		{
1148 1148
 			$opcache = (function_exists('opcache_get_status') && function_exists('opcache_invalidate'));
1149 1149
 		}
1150 1150
 
1151
-		if($opcache === false)
1151
+		if ($opcache === false)
1152 1152
 		{
1153 1153
 			return;
1154 1154
 		}
1155 1155
 
1156
-		if(is_array($target))
1156
+		if (is_array($target))
1157 1157
 		{
1158 1158
 			array_map('self::invalidateOpcache', $target);
1159 1159
 			return;
1160 1160
 		}
1161 1161
 
1162
-		if(substr($target, -4) === '.php')
1162
+		if (substr($target, -4) === '.php')
1163 1163
 		{
1164 1164
 			opcache_invalidate(self::getRealPath($target), $force);
1165 1165
 		}
1166
-		else if($path = self::isDir($target))
1166
+		else if ($path = self::isDir($target))
1167 1167
 		{
1168 1168
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1169 1169
 		}
Please login to merge, or discard this patch.
Braces   +31 added lines, -47 removed lines patch added patch discarded remove patch
@@ -74,14 +74,12 @@  discard block
 block discarded – undo
74 74
 			if(is_dir($source_dir . $file))
75 75
 			{
76 76
 				self::copyDir($source_dir . $file, $target_dir . $file, $type);
77
-			}
78
-			else
77
+			} else
79 78
 			{
80 79
 				if($type == 'force')
81 80
 				{
82 81
 					@unlink($target_dir . $file);
83
-				}
84
-				else
82
+				} else
85 83
 				{
86 84
 					if(!file_exists($target_dir . $file))
87 85
 					{
@@ -381,15 +379,13 @@  discard block
 block discarded – undo
381 379
 				if(is_dir($target))
382 380
 				{
383 381
 					self::removeDir($target);
384
-				}
385
-				else
382
+				} else
386 383
 				{
387 384
 					unlink($target);
388 385
 				}
389 386
 			}
390 387
 			rmdir($path);
391
-		}
392
-		else
388
+		} else
393 389
 		{
394 390
 			unlink($path);
395 391
 		}
@@ -456,16 +452,16 @@  discard block
 block discarded – undo
456 452
 				if(is_dir($target))
457 453
 				{
458 454
 					self::removeFilesInDir($target);
459
-				}
460
-				else
455
+				} else
461 456
 				{
462 457
 					unlink($target);
463 458
 				}
464 459
 			}
465
-		}
466
-		else
460
+		} else
467 461
 		{
468
-			if(self::exists($path)) unlink($path);
462
+			if(self::exists($path)) {
463
+				unlink($path);
464
+			}
469 465
 		}
470 466
 
471 467
 	}
@@ -535,8 +531,7 @@  discard block
 block discarded – undo
535 531
 				$oRequest = new HTTP_Request(__PROXY_SERVER__);
536 532
 				$oRequest->setMethod('POST');
537 533
 				$oRequest->addPostData('arg', serialize(array('Destination' => $url, 'method' => $method, 'body' => $body, 'content_type' => $content_type, "headers" => $headers, "post_data" => $post_data)));
538
-			}
539
-			else
534
+			} else
540 535
 			{
541 536
 				$oRequest = new HTTP_Request($url);
542 537
 
@@ -560,8 +555,7 @@  discard block
 block discarded – undo
560 555
 							{
561 556
 								$oRequest->attach($observer);
562 557
 							}
563
-						}
564
-						else
558
+						} else
565 559
 						{
566 560
 							$oRequest->setConfig($key, $val);
567 561
 						}
@@ -572,8 +566,7 @@  discard block
 block discarded – undo
572 566
 					if(extension_loaded('curl'))
573 567
 					{
574 568
 						$oRequest->setConfig('adapter', 'curl');
575
-					}
576
-					elseif(version_compare(PHP_VERSION, '5.6', '<'))
569
+					} elseif(version_compare(PHP_VERSION, '5.6', '<'))
577 570
 					{
578 571
 						$oRequest->setConfig('ssl_verify_host', false);
579 572
 					}
@@ -605,20 +598,21 @@  discard block
 block discarded – undo
605 598
 						$oRequest->addPostData($key, $val);
606 599
 					}
607 600
 				}
608
-				if(!$content_type)
609
-					$oRequest->addHeader('Content-Type', 'text/html');
610
-				else
611
-					$oRequest->addHeader('Content-Type', $content_type);
601
+				if(!$content_type) {
602
+									$oRequest->addHeader('Content-Type', 'text/html');
603
+				} else {
604
+									$oRequest->addHeader('Content-Type', $content_type);
605
+				}
612 606
 				$oRequest->setMethod($method);
613
-				if($body)
614
-					$oRequest->setBody($body);
607
+				if($body) {
608
+									$oRequest->setBody($body);
609
+				}
615 610
 			}
616 611
 			
617 612
 			if(method_exists($oRequest, 'setConfig'))
618 613
 			{
619 614
 				$oRequest->setConfig('timeout', $timeout);
620
-			}
621
-			elseif(property_exists($oRequest, '_timeout'))
615
+			} elseif(property_exists($oRequest, '_timeout'))
622 616
 			{
623 617
 				$oRequest->_timeout = $timeout;
624 618
 			}
@@ -649,13 +643,11 @@  discard block
 block discarded – undo
649 643
 			if(isset($request_config['store_body']) && !$request_config['store_body'])
650 644
 			{
651 645
 				return TRUE;
652
-			}
653
-			else
646
+			} else
654 647
 			{
655 648
 				return $response;
656 649
 			}
657
-		}
658
-		catch(Exception $e)
650
+		} catch(Exception $e)
659 651
 		{
660 652
 			return NULL;
661 653
 		}
@@ -686,8 +678,7 @@  discard block
 block discarded – undo
686 678
 		try
687 679
 		{
688 680
 			$result = self::getRemoteResource($url, $body, $timeout, $method, $content_type, $headers, $cookies, $post_data, $request_config);
689
-		}
690
-		catch(Exception $e)
681
+		} catch(Exception $e)
691 682
 		{
692 683
 			return FALSE;
693 684
 		}
@@ -817,8 +808,7 @@  discard block
 block discarded – undo
817 808
 			$per = ($width_per > $height_per) ? $height_per : $width_per;
818 809
 			$resize_width = $width * $per;
819 810
 			$resize_height = $height * $per;
820
-		}
821
-		else
811
+		} else
822 812
 		{
823 813
 			$per = ($width_per < $height_per) ? $height_per : $width_per;
824 814
 		}
@@ -828,8 +818,7 @@  discard block
 block discarded – undo
828 818
 		if(function_exists('imagecreateTRUEcolor'))
829 819
 		{
830 820
 			$thumb = imagecreateTRUEcolor($resize_width, $resize_height);
831
-		}
832
-		else if(function_exists('imagecreate'))
821
+		} else if(function_exists('imagecreate'))
833 822
 		{
834 823
 			$thumb = imagecreate($resize_width, $resize_height);
835 824
 		}
@@ -894,8 +883,7 @@  discard block
 block discarded – undo
894 883
 		if(function_exists('imagecopyresampled'))
895 884
 		{
896 885
 			imagecopyresampled($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
897
-		}
898
-		else
886
+		} else
899 887
 		{
900 888
 			imagecopyresized($thumb, $source, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
901 889
 		}
@@ -964,8 +952,7 @@  discard block
 block discarded – undo
964 952
 		if(is_array($arr) && count($arr) > 0)
965 953
 		{
966 954
 			return $arr;
967
-		}
968
-		else
955
+		} else
969 956
 		{
970 957
 			return array();
971 958
 		}
@@ -1015,12 +1002,10 @@  discard block
 block discarded – undo
1015 1002
 					$return[] = sprintf("%s=\"%s\"", $k, $v);
1016 1003
 				}
1017 1004
 				// value
1018
-			}
1019
-			else if(is_object($val))
1005
+			} else if(is_object($val))
1020 1006
 			{
1021 1007
 				continue;
1022
-			}
1023
-			else
1008
+			} else
1024 1009
 			{
1025 1010
 				$return[] = sprintf("%s=\"%s\"", $key, $val);
1026 1011
 			}
@@ -1162,8 +1147,7 @@  discard block
 block discarded – undo
1162 1147
 		if(substr($target, -4) === '.php')
1163 1148
 		{
1164 1149
 			opcache_invalidate(self::getRealPath($target), $force);
1165
-		}
1166
-		else if($path = self::isDir($target))
1150
+		} else if($path = self::isDir($target))
1167 1151
 		{
1168 1152
 			self::invalidateOpcache(self::readDir($path, '', false, true));
1169 1153
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.lib.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'libs/ftp.class.php');
4
+require_once(_XE_PATH_.'libs/ftp.class.php');
5 5
 
6 6
 /**
7 7
  * Module installer
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$oModel = getModel('autoinstall');
80 80
 		$type = $oModel->getTypeFromPath($this->package->path);
81
-		if($type == "module")
81
+		if ($type == "module")
82 82
 		{
83 83
 			$output = $this->uninstallModule();
84
-			if(!$output->toBool())
84
+			if (!$output->toBool())
85 85
 			{
86 86
 				return $output;
87 87
 			}
88 88
 		}
89 89
 
90 90
 		$output = $this->_connect();
91
-		if(!$output->toBool())
91
+		if (!$output->toBool())
92 92
 		{
93 93
 			return $output;
94 94
 		}
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function _download()
118 118
 	{
119
-		if($this->package->path == ".")
119
+		if ($this->package->path == ".")
120 120
 		{
121
-			$this->download_file = $this->temp_dir . "xe.tar";
121
+			$this->download_file = $this->temp_dir."xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124 124
 		}
125 125
 		else
126 126
 		{
127 127
 			$subpath = trim(substr($this->package->path, 2), '/');
128
-			$this->download_file = $this->temp_dir . $subpath . ".tar";
128
+			$this->download_file = $this->temp_dir.$subpath.".tar";
129 129
 			$subpatharr = explode("/", $subpath);
130 130
 			array_pop($subpatharr);
131
-			$this->download_path = $this->temp_dir . implode("/", $subpatharr);
131
+			$this->download_path = $this->temp_dir.implode("/", $subpatharr);
132 132
 			$this->target_path = implode("/", $subpatharr);
133 133
 		}
134 134
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$path_array = explode("/", $this->package->path);
153 153
 		$target_name = array_pop($path_array);
154 154
 		$oModule = getModule($target_name, "class");
155
-		if(!$oModule)
155
+		if (!$oModule)
156 156
 		{
157 157
 			return new BaseObject(-1, 'msg_invalid_request');
158 158
 		}
159
-		if(!method_exists($oModule, "moduleUninstall"))
159
+		if (!method_exists($oModule, "moduleUninstall"))
160 160
 		{
161 161
 			return new BaseObject(-1, 'msg_invalid_request');
162 162
 		}
163 163
 
164 164
 		$output = $oModule->moduleUninstall();
165
-		if(is_subclass_of($output, 'BaseObject') && !$output->toBool())
165
+		if (is_subclass_of($output, 'BaseObject') && !$output->toBool())
166 166
 		{
167 167
 			return $output;
168 168
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		$schema_dir = sprintf('%s/schemas/', $this->package->path);
171 171
 		$schema_files = FileHandler::readDir($schema_dir);
172 172
 		$oDB = DB::getInstance();
173
-		if(is_array($schema_files))
173
+		if (is_array($schema_files))
174 174
 		{
175
-			foreach($schema_files as $file)
175
+			foreach ($schema_files as $file)
176 176
 			{
177 177
 				$filename_arr = explode(".", $file);
178 178
 				$filename = array_shift($filename_arr);
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 	function installModule()
193 193
 	{
194 194
 		$path = $this->package->path;
195
-		if($path != ".")
195
+		if ($path != ".")
196 196
 		{
197 197
 			$path_array = explode("/", $path);
198 198
 			$target_name = array_pop($path_array);
199 199
 			$type = substr(array_pop($path_array), 0, -1);
200 200
 		}
201 201
 
202
-		if($type == "module")
202
+		if ($type == "module")
203 203
 		{
204 204
 			$oModuleModel = getModel('module');
205 205
 			$oInstallController = getController('install');
206 206
 			$module_path = ModuleHandler::getModulePath($target_name);
207
-			if($oModuleModel->checkNeedInstall($target_name))
207
+			if ($oModuleModel->checkNeedInstall($target_name))
208 208
 			{
209 209
 				$oInstallController->installModule($target_name, $module_path);
210 210
 			}
211
-			if($oModuleModel->checkNeedUpdate($target_name))
211
+			if ($oModuleModel->checkNeedUpdate($target_name))
212 212
 			{
213 213
 				$oModule = getModule($target_name, 'class');
214
-				if(method_exists($oModule, 'moduleUpdate'))
214
+				if (method_exists($oModule, 'moduleUpdate'))
215 215
 				{
216 216
 					$oModule->moduleUpdate();
217 217
 				}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$this->_download();
232 232
 		$file_list = $this->_unPack();
233 233
 		$output = $this->_copyDir($file_list);
234
-		if(!$output->toBool())
234
+		if (!$output->toBool())
235 235
 		{
236 236
 			FileHandler::removeDir($this->temp_dir);
237 237
 			return $output;
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	function _unPack()
251 251
 	{
252
-		require_once(_XE_PATH_ . 'libs/tar.class.php');
252
+		require_once(_XE_PATH_.'libs/tar.class.php');
253 253
 
254 254
 		$oTar = new tar();
255 255
 		$oTar->openTAR($this->download_file);
256 256
 
257 257
 		$_files = $oTar->files;
258 258
 		$file_list = array();
259
-		if(is_array($_files))
259
+		if (is_array($_files))
260 260
 		{
261
-			foreach($_files as $key => $info)
261
+			foreach ($_files as $key => $info)
262 262
 			{
263
-				FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
263
+				FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
264 264
 				$file_list[] = $info['name'];
265 265
 			}
266 266
 		}
@@ -278,22 +278,22 @@  discard block
 block discarded – undo
278 278
 		$real_path = FileHandler::getRealPath($path);
279 279
 		$oDir = dir($path);
280 280
 		$files = array();
281
-		while($file = $oDir->read())
281
+		while ($file = $oDir->read())
282 282
 		{
283
-			if($file == "." || $file == "..")
283
+			if ($file == "." || $file == "..")
284 284
 			{
285 285
 				continue;
286 286
 			}
287 287
 			$files[] = $file;
288 288
 		}
289 289
 
290
-		foreach($files as $file)
290
+		foreach ($files as $file)
291 291
 		{
292
-			$file_path = $path . "/" . $file;
293
-			if(is_dir(FileHandler::getRealPath($file_path)))
292
+			$file_path = $path."/".$file;
293
+			if (is_dir(FileHandler::getRealPath($file_path)))
294 294
 			{
295 295
 				$output = $this->_removeDir($file_path);
296
-				if(!$output->toBool())
296
+				if (!$output->toBool())
297 297
 				{
298 298
 					return $output;
299 299
 				}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			else
302 302
 			{
303 303
 				$output = $this->_removeFile($file_path);
304
-				if(!$output->toBool())
304
+				if (!$output->toBool())
305 305
 				{
306 306
 					return $output;
307 307
 				}
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function _connect()
359 359
 	{
360
-		if(!function_exists('ssh2_connect'))
360
+		if (!function_exists('ssh2_connect'))
361 361
 		{
362 362
 			return new BaseObject(-1, 'msg_sftp_not_supported');
363 363
 		}
364 364
 
365
-		if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
365
+		if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
366 366
 		{
367 367
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
368 368
 		}
369 369
 
370
-		if($this->ftp_info->ftp_host)
370
+		if ($this->ftp_info->ftp_host)
371 371
 		{
372 372
 			$ftp_host = $this->ftp_info->ftp_host;
373 373
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$ftp_host = "127.0.0.1";
377 377
 		}
378 378
 		$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
379
-		if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
379
+		if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
380 380
 		{
381 381
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
382 382
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function _removeFile($path)
405 405
 	{
406
-		if(substr($path, 0, 2) == "./")
406
+		if (substr($path, 0, 2) == "./")
407 407
 		{
408 408
 			$path = substr($path, 2);
409 409
 		}
410
-		$target_path = $this->ftp_info->ftp_root_path . $path;
410
+		$target_path = $this->ftp_info->ftp_root_path.$path;
411 411
 
412
-		if(!@ssh2_sftp_unlink($this->sftp, $target_path))
412
+		if (!@ssh2_sftp_unlink($this->sftp, $target_path))
413 413
 		{
414 414
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
415 415
 		}
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	function _removeDir_real($path)
426 426
 	{
427
-		if(substr($path, 0, 2) == "./")
427
+		if (substr($path, 0, 2) == "./")
428 428
 		{
429 429
 			$path = substr($path, 2);
430 430
 		}
431
-		$target_path = $this->ftp_info->ftp_root_path . $path;
431
+		$target_path = $this->ftp_info->ftp_root_path.$path;
432 432
 
433
-		if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
433
+		if (!@ssh2_sftp_rmdir($this->sftp, $target_path))
434 434
 		{
435 435
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
436 436
 		}
@@ -445,37 +445,37 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	function _copyDir(&$file_list)
447 447
 	{
448
-		if(!$this->ftp_password)
448
+		if (!$this->ftp_password)
449 449
 		{
450 450
 			return new BaseObject(-1, 'msg_ftp_password_input');
451 451
 		}
452 452
 
453 453
 		$output = $this->_connect();
454
-		if(!$output->toBool())
454
+		if (!$output->toBool())
455 455
 		{
456 456
 			return $output;
457 457
 		}
458
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
458
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
459 459
 		$copied = array();
460 460
 
461
-		if(is_array($file_list))
461
+		if (is_array($file_list))
462 462
 		{
463
-			foreach($file_list as $k => $file)
463
+			foreach ($file_list as $k => $file)
464 464
 			{
465 465
 				$org_file = $file;
466
-				if($this->package->path == ".")
466
+				if ($this->package->path == ".")
467 467
 				{
468 468
 					$file = substr($file, 3);
469 469
 				}
470
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
471
-				$pathname = dirname($target_dir . "/" . $file);
470
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
471
+				$pathname = dirname($target_dir."/".$file);
472 472
 
473
-				if(!file_exists(FileHandler::getRealPath($real_path)))
473
+				if (!file_exists(FileHandler::getRealPath($real_path)))
474 474
 				{
475 475
 					ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
476 476
 				}
477 477
 
478
-				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
478
+				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
479 479
 				$copied[] = $path;
480 480
 			}
481 481
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	function _connect()
528 528
 	{
529
-		if($this->ftp_info->ftp_host)
529
+		if ($this->ftp_info->ftp_host)
530 530
 		{
531 531
 			$ftp_host = $this->ftp_info->ftp_host;
532 532
 		}
@@ -536,20 +536,20 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
539
-		if(!$this->connection)
539
+		if (!$this->connection)
540 540
 		{
541 541
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
542 542
 		}
543 543
 
544 544
 		$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
545
-		if(!$login_result)
545
+		if (!$login_result)
546 546
 		{
547 547
 			$this->_close();
548 548
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
549 549
 		}
550 550
 
551 551
 		$_SESSION['ftp_password'] = $this->ftp_password;
552
-		if($this->ftp_info->ftp_pasv != "N")
552
+		if ($this->ftp_info->ftp_pasv != "N")
553 553
 		{
554 554
 			ftp_pasv($this->connection, TRUE);
555 555
 		}
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	function _removeFile($path)
566 566
 	{
567
-		if(substr($path, 0, 2) == "./")
567
+		if (substr($path, 0, 2) == "./")
568 568
 		{
569 569
 			$path = substr($path, 2);
570 570
 		}
571
-		$target_path = $this->ftp_info->ftp_root_path . $path;
571
+		$target_path = $this->ftp_info->ftp_root_path.$path;
572 572
 
573
-		if(!@ftp_delete($this->connection, $target_path))
573
+		if (!@ftp_delete($this->connection, $target_path))
574 574
 		{
575
-			return new BaseObject(-1, "failed to delete file " . $path);
575
+			return new BaseObject(-1, "failed to delete file ".$path);
576 576
 		}
577 577
 		return new BaseObject();
578 578
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	function _removeDir_real($path)
587 587
 	{
588
-		if(substr($path, 0, 2) == "./")
588
+		if (substr($path, 0, 2) == "./")
589 589
 		{
590 590
 			$path = substr($path, 2);
591 591
 		}
592
-		$target_path = $this->ftp_info->ftp_root_path . $path;
592
+		$target_path = $this->ftp_info->ftp_root_path.$path;
593 593
 
594
-		if(!@ftp_rmdir($this->connection, $target_path))
594
+		if (!@ftp_rmdir($this->connection, $target_path))
595 595
 		{
596
-			return new BaseObject(-1, "failed to delete directory " . $path);
596
+			return new BaseObject(-1, "failed to delete directory ".$path);
597 597
 		}
598 598
 		return new BaseObject();
599 599
 	}
@@ -616,74 +616,74 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	function _copyDir(&$file_list)
618 618
 	{
619
-		if(!$this->ftp_password)
619
+		if (!$this->ftp_password)
620 620
 		{
621 621
 			return new BaseObject(-1, 'msg_ftp_password_input');
622 622
 		}
623 623
 
624 624
 		$output = $this->_connect();
625
-		if(!$output->toBool())
625
+		if (!$output->toBool())
626 626
 		{
627 627
 			return $output;
628 628
 		}
629 629
 
630
-		if(!$this->target_path)
630
+		if (!$this->target_path)
631 631
 		{
632 632
 			$this->target_path = '.';
633 633
 		}
634
-		if(substr($this->download_path, -1) == '/')
634
+		if (substr($this->download_path, -1) == '/')
635 635
 		{
636 636
 			$this->download_path = substr($this->download_path, 0, -1);
637 637
 		}
638
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
638
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
639 639
 		$copied = array();
640 640
 
641
-		if(is_array($file_list))
641
+		if (is_array($file_list))
642 642
 		{
643
-			foreach($file_list as $k => $file)
643
+			foreach ($file_list as $k => $file)
644 644
 			{
645
-				if(!$file)
645
+				if (!$file)
646 646
 				{
647 647
 					continue;
648 648
 				}
649 649
 				$org_file = $file;
650
-				if($this->package->path == ".")
650
+				if ($this->package->path == ".")
651 651
 				{
652 652
 					$file = substr($file, 3);
653 653
 				}
654
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
655
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
654
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
655
+				$path_list = explode('/', dirname($this->target_path."/".$file));
656 656
 
657 657
 				$real_path = "./";
658 658
 				$ftp_path = $this->ftp_info->ftp_root_path;
659 659
 
660
-				for($i = 0; $i < count($path_list); $i++)
660
+				for ($i = 0; $i < count($path_list); $i++)
661 661
 				{
662
-					if($path_list == "")
662
+					if ($path_list == "")
663 663
 					{
664 664
 						continue;
665 665
 					}
666
-					$real_path .= $path_list[$i] . "/";
667
-					$ftp_path .= $path_list[$i] . "/";
668
-					if(!file_exists(FileHandler::getRealPath($real_path)))
666
+					$real_path .= $path_list[$i]."/";
667
+					$ftp_path .= $path_list[$i]."/";
668
+					if (!file_exists(FileHandler::getRealPath($real_path)))
669 669
 					{
670
-						if(!@ftp_mkdir($this->connection, $ftp_path))
670
+						if (!@ftp_mkdir($this->connection, $ftp_path))
671 671
 						{
672 672
 							return new BaseObject(-1, "msg_make_directory_failed");
673 673
 						}
674 674
 
675
-						if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
675
+						if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
676 676
 						{
677
-							if(function_exists('ftp_chmod'))
677
+							if (function_exists('ftp_chmod'))
678 678
 							{
679
-								if(!ftp_chmod($this->connection, 0755, $ftp_path))
679
+								if (!ftp_chmod($this->connection, 0755, $ftp_path))
680 680
 								{
681 681
 									return new BaseObject(-1, "msg_permission_adjust_failed");
682 682
 								}
683 683
 							}
684 684
 							else
685 685
 							{
686
-								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
686
+								if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
687 687
 								{
688 688
 									return new BaseObject(-1, "msg_permission_adjust_failed");
689 689
 								}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 						}
692 692
 					}
693 693
 				}
694
-				if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
694
+				if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
695 695
 				{
696 696
 					return new BaseObject(-1, "msg_ftp_upload_failed");
697 697
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	function _connect()
747 747
 	{
748
-		if($this->ftp_info->ftp_host)
748
+		if ($this->ftp_info->ftp_host)
749 749
 		{
750 750
 			$ftp_host = $this->ftp_info->ftp_host;
751 751
 		}
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 
757 757
 		$this->oFtp = new ftp();
758
-		if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
758
+		if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
759 759
 		{
760 760
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
761 761
 		}
762
-		if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
762
+		if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
763 763
 		{
764 764
 			$this->_close();
765 765
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
@@ -776,13 +776,13 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	function _removeFile($path)
778 778
 	{
779
-		if(substr($path, 0, 2) == "./")
779
+		if (substr($path, 0, 2) == "./")
780 780
 		{
781 781
 			$path = substr($path, 2);
782 782
 		}
783
-		$target_path = $this->ftp_info->ftp_root_path . $path;
783
+		$target_path = $this->ftp_info->ftp_root_path.$path;
784 784
 
785
-		if(!$this->oFtp->ftp_delete($target_path))
785
+		if (!$this->oFtp->ftp_delete($target_path))
786 786
 		{
787 787
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
788 788
 		}
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	function _removeDir_real($path)
798 798
 	{
799
-		if(substr($path, 0, 2) == "./")
799
+		if (substr($path, 0, 2) == "./")
800 800
 		{
801 801
 			$path = substr($path, 2);
802 802
 		}
803
-		$target_path = $this->ftp_info->ftp_root_path . $path;
803
+		$target_path = $this->ftp_info->ftp_root_path.$path;
804 804
 
805
-		if(!$this->oFtp->ftp_rmdir($target_path))
805
+		if (!$this->oFtp->ftp_rmdir($target_path))
806 806
 		{
807 807
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
808 808
 		}
@@ -827,52 +827,52 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	function _copyDir(&$file_list)
829 829
 	{
830
-		if(!$this->ftp_password)
830
+		if (!$this->ftp_password)
831 831
 		{
832 832
 			return new BaseObject(-1, 'msg_ftp_password_input');
833 833
 		}
834 834
 
835 835
 		$output = $this->_connect();
836
-		if(!$output->toBool())
836
+		if (!$output->toBool())
837 837
 		{
838 838
 			return $output;
839 839
 		}
840 840
 
841 841
 		$oFtp = &$this->oFtp;
842
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
842
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
843 843
 
844 844
 		$copied = array();
845 845
 
846
-		if(is_array($file_list))
846
+		if (is_array($file_list))
847 847
 		{
848
-			foreach($file_list as $k => $file)
848
+			foreach ($file_list as $k => $file)
849 849
 			{
850 850
 				$org_file = $file;
851
-				if($this->package->path == ".")
851
+				if ($this->package->path == ".")
852 852
 				{
853 853
 					$file = substr($file, 3);
854 854
 				}
855
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
856
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
855
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
856
+				$path_list = explode('/', dirname($this->target_path."/".$file));
857 857
 
858 858
 				$real_path = "./";
859 859
 				$ftp_path = $this->ftp_info->ftp_root_path;
860 860
 
861
-				for($i = 0; $i < count($path_list); $i++)
861
+				for ($i = 0; $i < count($path_list); $i++)
862 862
 				{
863
-					if($path_list == "")
863
+					if ($path_list == "")
864 864
 					{
865 865
 						continue;
866 866
 					}
867
-					$real_path .= $path_list[$i] . "/";
868
-					$ftp_path .= $path_list[$i] . "/";
869
-					if(!file_exists(FileHandler::getRealPath($real_path)))
867
+					$real_path .= $path_list[$i]."/";
868
+					$ftp_path .= $path_list[$i]."/";
869
+					if (!file_exists(FileHandler::getRealPath($real_path)))
870 870
 					{
871 871
 						$oFtp->ftp_mkdir($ftp_path);
872
-						$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
872
+						$oFtp->ftp_site("CHMOD 755 ".$ftp_path);
873 873
 					}
874 874
 				}
875
-				$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
875
+				$oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file));
876 876
 				$copied[] = $path;
877 877
 			}
878 878
 		}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	function _removeFile($path)
923 923
 	{
924
-		if(substr($path, 0, 2) == "./")
924
+		if (substr($path, 0, 2) == "./")
925 925
 		{
926 926
 			$path = substr($path, 2);
927 927
 		}
928 928
 		$target_path = FileHandler::getRealPath($path);
929 929
 
930
-		if(!FileHandler::removeFile($target_path))
930
+		if (!FileHandler::removeFile($target_path))
931 931
 		{
932 932
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
933 933
 		}
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	function _removeDir_real($path)
943 943
 	{
944
-		if(substr($path, 0, 2) == "./")
944
+		if (substr($path, 0, 2) == "./")
945 945
 		{
946 946
 			$path = substr($path, 2);
947 947
 		}
@@ -970,39 +970,39 @@  discard block
 block discarded – undo
970 970
 	function _copyDir(&$file_list)
971 971
 	{
972 972
 		$output = $this->_connect();
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			return $output;
976 976
 		}
977 977
 		$target_dir = $this->target_path;
978 978
 		$copied = array();
979 979
 
980
-		if(is_array($file_list))
980
+		if (is_array($file_list))
981 981
 		{
982
-			foreach($file_list as $k => $file)
982
+			foreach ($file_list as $k => $file)
983 983
 			{
984 984
 				$org_file = $file;
985
-				if($this->package->path == ".")
985
+				if ($this->package->path == ".")
986 986
 				{
987 987
 					$file = substr($file, 3);
988 988
 				}
989
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
990
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
989
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
990
+				$path_list = explode('/', dirname($this->target_path."/".$file));
991 991
 				$real_path = "./";
992 992
 
993
-				for($i = 0; $i < count($path_list); $i++)
993
+				for ($i = 0; $i < count($path_list); $i++)
994 994
 				{
995
-					if($path_list == "")
995
+					if ($path_list == "")
996 996
 					{
997 997
 						continue;
998 998
 					}
999
-					$real_path .= $path_list[$i] . "/";
1000
-					if(!file_exists(FileHandler::getRealPath($real_path)))
999
+					$real_path .= $path_list[$i]."/";
1000
+					if (!file_exists(FileHandler::getRealPath($real_path)))
1001 1001
 					{
1002 1002
 						FileHandler::makeDir($real_path);
1003 1003
 					}
1004 1004
 				}
1005
-				FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
1005
+				FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file));
1006 1006
 				$copied[] = $path;
1007 1007
 			}
1008 1008
 		}
Please login to merge, or discard this patch.
modules/addon/addon.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
 		$oModuleModel = getModel('module');
38 38
 		$oModuleController = getController('module');
39 39
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
40
-		if($oModuleModel->needUpdate($version_update_id))
40
+		if ($oModuleModel->needUpdate($version_update_id))
41 41
 		{
42
-			if(!$oDB->isColumnExists("addons", "is_used_m"))
42
+			if (!$oDB->isColumnExists("addons", "is_used_m"))
43 43
 			{
44 44
 				return TRUE;
45 45
 			}
46
-			if(!$oDB->isColumnExists("addons_site", "is_used_m"))
46
+			if (!$oDB->isColumnExists("addons_site", "is_used_m"))
47 47
 			{
48 48
 				return TRUE;
49 49
 			}
50 50
 
51 51
 			// 2011. 7. 29. add is_fixed column
52
-			if(!$oDB->isColumnExists('addons', 'is_fixed'))
52
+			if (!$oDB->isColumnExists('addons', 'is_fixed'))
53 53
 			{
54 54
 				return TRUE;
55 55
 			}
@@ -72,27 +72,27 @@  discard block
 block discarded – undo
72 72
 		$oModuleModel = getModel('module');
73 73
 		$oModuleController = getController('module');
74 74
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
75
-		if($oModuleModel->needUpdate($version_update_id))
75
+		if ($oModuleModel->needUpdate($version_update_id))
76 76
 		{
77
-			if(!$oDB->isColumnExists("addons", "is_used_m"))
77
+			if (!$oDB->isColumnExists("addons", "is_used_m"))
78 78
 			{
79 79
 				$oDB->addColumn("addons", "is_used_m", "char", 1, "N", TRUE);
80 80
 			}
81
-			if(!$oDB->isColumnExists("addons_site", "is_used_m"))
81
+			if (!$oDB->isColumnExists("addons_site", "is_used_m"))
82 82
 			{
83 83
 				$oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", TRUE);
84 84
 			}
85 85
 
86 86
 			// 2011. 7. 29. add is_fixed column
87
-			if(!$oDB->isColumnExists('addons', 'is_fixed'))
87
+			if (!$oDB->isColumnExists('addons', 'is_fixed'))
88 88
 			{
89 89
 				$oDB->addColumn('addons', 'is_fixed', 'char', 1, 'N', TRUE);
90 90
 
91 91
 				// move addon info to addon_site table
92 92
 				$output = executeQueryArray('addon.getAddons');
93
-				if($output->data)
93
+				if ($output->data)
94 94
 				{
95
-					foreach($output->data as $row)
95
+					foreach ($output->data as $row)
96 96
 					{
97 97
 						$args = new stdClass();
98 98
 						$args->site_srl = 0;
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * @brief Declare constants for generic use and for checking to avoid a direct call from the Web
34 34
  **/
35
-define('__XE__',   TRUE);
35
+define('__XE__', TRUE);
36 36
 /**
37 37
  * @brief Include the necessary configuration files
38 38
  **/
39
-if(function_exists('opcache_invalidate'))
39
+if (function_exists('opcache_invalidate'))
40 40
 {
41
-	opcache_invalidate(dirname(__FILE__) . '/config/config.inc.php', true);
41
+	opcache_invalidate(dirname(__FILE__).'/config/config.inc.php', true);
42 42
 }
43
-require dirname(__FILE__) . '/config/config.inc.php';
43
+require dirname(__FILE__).'/config/config.inc.php';
44 44
 
45 45
 /**
46 46
  * @brief Initialize by creating Context object
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 /**
53 53
  * @brief If default_url is set and it is different from the current url, attempt to redirect for SSO authentication and then process the module
54 54
  **/
55
-if($oContext->checkSSO())
55
+if ($oContext->checkSSO())
56 56
 {
57 57
 	$oModuleHandler = new ModuleHandler();
58 58
 
59 59
 	try
60 60
 	{
61
-		if($oModuleHandler->init())
61
+		if ($oModuleHandler->init())
62 62
 		{
63 63
 			$oModuleHandler->displayContent($oModuleHandler->procModule());
64 64
 		}
65 65
 	}
66
-	catch(Exception $e)
66
+	catch (Exception $e)
67 67
 	{
68 68
 		htmlHeader();
69 69
 		echo Context::getLang($e->getMessage());
Please login to merge, or discard this patch.