@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | function procInstallAdminInstall() |
21 | 21 | { |
22 | 22 | $module_name = Context::get('module_name'); |
23 | - if(!$module_name) return new BaseObject(-1, 'invalid_request'); |
|
23 | + if (!$module_name) return new BaseObject(-1, 'invalid_request'); |
|
24 | 24 | |
25 | 25 | $oInstallController = getController('install'); |
26 | 26 | $oInstallController->installModule($module_name, './modules/'.$module_name); |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | { |
36 | 36 | @set_time_limit(0); |
37 | 37 | $module_name = Context::get('module_name'); |
38 | - if(!$module_name) return new BaseObject(-1, 'invalid_request'); |
|
38 | + if (!$module_name) return new BaseObject(-1, 'invalid_request'); |
|
39 | 39 | |
40 | 40 | $oModule = getModule($module_name, 'class'); |
41 | - if($oModule) $output = $oModule->moduleUpdate(); |
|
41 | + if ($oModule) $output = $oModule->moduleUpdate(); |
|
42 | 42 | else $output = new BaseObject(-1, 'invalid_request'); |
43 | 43 | |
44 | 44 | return $output; |
@@ -53,54 +53,54 @@ discard block |
||
53 | 53 | |
54 | 54 | $admin_ip_list = Context::get('admin_ip_list'); |
55 | 55 | |
56 | - if($admin_ip_list) |
|
56 | + if ($admin_ip_list) |
|
57 | 57 | { |
58 | - $admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list); |
|
59 | - $admin_ip_list = preg_replace("/\s+/","",$admin_ip_list); |
|
60 | - if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list)) |
|
58 | + $admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list); |
|
59 | + $admin_ip_list = preg_replace("/\s+/", "", $admin_ip_list); |
|
60 | + if (preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list)) |
|
61 | 61 | { |
62 | 62 | $admin_ip_list = ''; |
63 | 63 | } |
64 | - $admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR']; |
|
65 | - $admin_ip_list = explode(',',trim($admin_ip_list, ',')); |
|
64 | + $admin_ip_list .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR']; |
|
65 | + $admin_ip_list = explode(',', trim($admin_ip_list, ',')); |
|
66 | 66 | $admin_ip_list = array_unique($admin_ip_list); |
67 | - if(!IpFilter::validate($admin_ip_list)) { |
|
67 | + if (!IpFilter::validate($admin_ip_list)) { |
|
68 | 68 | return new BaseObject(-1, 'msg_invalid_ip'); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | $default_url = Context::get('default_url'); |
73 | - if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; |
|
74 | - if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/'; |
|
73 | + if ($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; |
|
74 | + if ($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/'; |
|
75 | 75 | |
76 | 76 | /* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */ |
77 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
77 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
78 | 78 | $IDN = new idna_convert(array('idn_version' => 2008)); |
79 | 79 | $default_url = $IDN->encode($default_url); |
80 | 80 | |
81 | 81 | $use_ssl = Context::get('use_ssl'); |
82 | - if(!$use_ssl) $use_ssl = 'none'; |
|
82 | + if (!$use_ssl) $use_ssl = 'none'; |
|
83 | 83 | |
84 | 84 | $use_nofollow = Context::get('use_nofollow'); |
85 | - if($use_nofollow != 'Y') $use_nofollow = 'N'; |
|
85 | + if ($use_nofollow != 'Y') $use_nofollow = 'N'; |
|
86 | 86 | |
87 | 87 | $http_port = Context::get('http_port'); |
88 | 88 | $https_port = Context::get('https_port'); |
89 | 89 | |
90 | 90 | $use_rewrite = Context::get('use_rewrite'); |
91 | - if($use_rewrite!='Y') $use_rewrite = 'N'; |
|
91 | + if ($use_rewrite != 'Y') $use_rewrite = 'N'; |
|
92 | 92 | |
93 | 93 | $use_sso = Context::get('use_sso'); |
94 | - if($use_sso !='Y') $use_sso = 'N'; |
|
94 | + if ($use_sso != 'Y') $use_sso = 'N'; |
|
95 | 95 | |
96 | 96 | $use_db_session = Context::get('use_db_session'); |
97 | - if($use_db_session!='Y') $use_db_session = 'N'; |
|
97 | + if ($use_db_session != 'Y') $use_db_session = 'N'; |
|
98 | 98 | |
99 | 99 | $qmail_compatibility = Context::get('qmail_compatibility'); |
100 | - if($qmail_compatibility!='Y') $qmail_compatibility = 'N'; |
|
100 | + if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N'; |
|
101 | 101 | |
102 | 102 | $use_html5 = Context::get('use_html5'); |
103 | - if(!$use_html5) $use_html5 = 'N'; |
|
103 | + if (!$use_html5) $use_html5 = 'N'; |
|
104 | 104 | |
105 | 105 | $db_info->default_url = $default_url; |
106 | 106 | $db_info->qmail_compatibility = $qmail_compatibility; |
@@ -112,23 +112,23 @@ discard block |
||
112 | 112 | $db_info->use_html5 = $use_html5; |
113 | 113 | $db_info->admin_ip_list = $admin_ip_list; |
114 | 114 | |
115 | - if($http_port) $db_info->http_port = (int) $http_port; |
|
116 | - else if($db_info->http_port) unset($db_info->http_port); |
|
115 | + if ($http_port) $db_info->http_port = (int) $http_port; |
|
116 | + else if ($db_info->http_port) unset($db_info->http_port); |
|
117 | 117 | |
118 | - if($https_port) $db_info->https_port = (int) $https_port; |
|
119 | - else if($db_info->https_port) unset($db_info->https_port); |
|
118 | + if ($https_port) $db_info->https_port = (int) $https_port; |
|
119 | + else if ($db_info->https_port) unset($db_info->https_port); |
|
120 | 120 | |
121 | 121 | unset($db_info->lang_type); |
122 | 122 | |
123 | 123 | $oInstallController = getController('install'); |
124 | - if(!$oInstallController->makeConfigFile()) |
|
124 | + if (!$oInstallController->makeConfigFile()) |
|
125 | 125 | { |
126 | 126 | return new BaseObject(-1, 'msg_invalid_request'); |
127 | 127 | } |
128 | 128 | else |
129 | 129 | { |
130 | 130 | Context::setDBInfo($db_info); |
131 | - if($default_url) |
|
131 | + if ($default_url) |
|
132 | 132 | { |
133 | 133 | $site_args = new stdClass; |
134 | 134 | $site_args->site_srl = 0; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | function procInstallAdminUpdateIndexModule() |
144 | 144 | { |
145 | - if(!Context::get('index_module_srl') || !Context::get('menu_item_srl')) |
|
145 | + if (!Context::get('index_module_srl') || !Context::get('menu_item_srl')) |
|
146 | 146 | { |
147 | 147 | return new BaseObject(-1, 'msg_invalid_request'); |
148 | 148 | } |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | // update homeSitemap.php cache file |
162 | 162 | $oMenuAdminController = getAdminController('menu'); |
163 | 163 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
164 | - if(file_exists($homeMenuCacheFile)) |
|
164 | + if (file_exists($homeMenuCacheFile)) |
|
165 | 165 | { |
166 | 166 | include($homeMenuCacheFile); |
167 | 167 | } |
168 | 168 | |
169 | - if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl) |
|
169 | + if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl) |
|
170 | 170 | { |
171 | 171 | $oMenuAdminController->makeHomemenuCacheFile($output->menu_srl); |
172 | 172 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | function procInstallAdminRemoveFTPInfo() |
178 | 178 | { |
179 | 179 | $ftp_config_file = Context::getFTPConfigFile(); |
180 | - if(file_exists($ftp_config_file)) unlink($ftp_config_file); |
|
181 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
180 | + if (file_exists($ftp_config_file)) unlink($ftp_config_file); |
|
181 | + if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
182 | 182 | $this->setMessage('success_deleted'); |
183 | 183 | } |
184 | 184 | |
@@ -189,11 +189,11 @@ discard block |
||
189 | 189 | $ftp_info->ftp_port = Context::get('ftp_port'); |
190 | 190 | $ftp_info->ftp_host = Context::get('ftp_host'); |
191 | 191 | $ftp_info->ftp_pasv = Context::get('ftp_pasv'); |
192 | - if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N"; |
|
192 | + if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N"; |
|
193 | 193 | $ftp_info->sftp = Context::get('sftp'); |
194 | 194 | |
195 | 195 | $ftp_root_path = Context::get('ftp_root_path'); |
196 | - if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/") |
|
196 | + if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/") |
|
197 | 197 | { |
198 | 198 | $ftp_info->ftp_root_path = $ftp_root_path; |
199 | 199 | } |
@@ -202,25 +202,25 @@ discard block |
||
202 | 202 | $ftp_info->ftp_root_path = $ftp_root_path.'/'; |
203 | 203 | } |
204 | 204 | |
205 | - if(ini_get('safe_mode')) |
|
205 | + if (ini_get('safe_mode')) |
|
206 | 206 | { |
207 | 207 | $ftp_info->ftp_password = Context::get('ftp_password'); |
208 | 208 | } |
209 | 209 | |
210 | 210 | $buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n"; |
211 | - foreach($ftp_info as $key => $val) |
|
211 | + foreach ($ftp_info as $key => $val) |
|
212 | 212 | { |
213 | - if(!$val) continue; |
|
214 | - if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val))) |
|
213 | + if (!$val) continue; |
|
214 | + if (preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val))) |
|
215 | 215 | { |
216 | 216 | continue; |
217 | 217 | } |
218 | - $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
218 | + $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
219 | 219 | } |
220 | 220 | $buff .= "?>"; |
221 | 221 | $config_file = Context::getFTPConfigFile(); |
222 | 222 | FileHandler::WriteFile($config_file, $buff); |
223 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
223 | + if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
224 | 224 | |
225 | 225 | $this->setMessage('success_updated'); |
226 | 226 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | function procInstallAdminConfig() |
231 | 231 | { |
232 | 232 | $use_mobile_view = Context::get('use_mobile_view'); |
233 | - if($use_mobile_view!='Y') $use_mobile_view = 'N'; |
|
233 | + if ($use_mobile_view != 'Y') $use_mobile_view = 'N'; |
|
234 | 234 | |
235 | 235 | $time_zone = Context::get('time_zone'); |
236 | 236 | |
@@ -241,15 +241,15 @@ discard block |
||
241 | 241 | unset($db_info->lang_type); |
242 | 242 | Context::setDBInfo($db_info); |
243 | 243 | $oInstallController = getController('install'); |
244 | - if(!$oInstallController->makeConfigFile()) |
|
244 | + if (!$oInstallController->makeConfigFile()) |
|
245 | 245 | { |
246 | 246 | return new BaseObject(-1, 'msg_invalid_request'); |
247 | 247 | } |
248 | 248 | |
249 | 249 | $site_args = new stdClass(); |
250 | 250 | $site_args->site_srl = 0; |
251 | - $site_args->index_module_srl = Context::get('index_module_srl');// |
|
252 | - $site_args->default_language = Context::get('change_lang_type');// |
|
251 | + $site_args->index_module_srl = Context::get('index_module_srl'); // |
|
252 | + $site_args->default_language = Context::get('change_lang_type'); // |
|
253 | 253 | $oModuleController = getController('module'); |
254 | 254 | $oModuleController->updateSite($site_args); |
255 | 255 | |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $deleteFavicon = Context::get('is_delete_favicon'); |
262 | 262 | $deleteMobicon = Context::get('is_delete_mobicon'); |
263 | 263 | |
264 | - $this->updateIcon('favicon.ico',$deleteFavicon); |
|
265 | - $this->updateIcon('mobicon.png',$deleteMobicon); |
|
264 | + $this->updateIcon('favicon.ico', $deleteFavicon); |
|
265 | + $this->updateIcon('mobicon.png', $deleteMobicon); |
|
266 | 266 | |
267 | 267 | //모듈 설정 저장(썸네일, 풋터스크립트) |
268 | 268 | $config = new stdClass(); |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | |
281 | 281 | $favicon = Context::get('favicon'); |
282 | 282 | $mobicon = Context::get('mobicon'); |
283 | - if(!$favicon && !$mobicon) { |
|
283 | + if (!$favicon && !$mobicon) { |
|
284 | 284 | Context::set('msg', Context::getLang("msg_invalid_format")); |
285 | 285 | return; |
286 | 286 | } |
287 | - if($favicon) { |
|
287 | + if ($favicon) { |
|
288 | 288 | $name = 'favicon'; |
289 | - $tmpFileName = $this->saveIconTmp($favicon,'favicon.ico'); |
|
289 | + $tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico'); |
|
290 | 290 | } else { |
291 | 291 | $name = 'mobicon'; |
292 | - $tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png'); |
|
292 | + $tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | Context::set('name', $name); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | $lang_supported = Context::loadLangSupported(); |
307 | 307 | $buff = null; |
308 | - for($i=0;$i<count($langs);$i++) |
|
308 | + for ($i = 0; $i < count($langs); $i++) |
|
309 | 309 | { |
310 | 310 | $buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]); |
311 | 311 | |
@@ -333,12 +333,12 @@ discard block |
||
333 | 333 | } |
334 | 334 | |
335 | 335 | $oModuleController = getController('module'); |
336 | - $oModuleController->insertModuleConfig('document',$documentConfig); |
|
336 | + $oModuleController->insertModuleConfig('document', $documentConfig); |
|
337 | 337 | |
338 | 338 | $args = new stdClass; |
339 | 339 | $args->htmlFooter = $config->htmlFooter; |
340 | 340 | $args->siteTitle = $config->siteTitle; |
341 | - $oModuleController->updateModuleConfig('module',$args); |
|
341 | + $oModuleController->updateModuleConfig('module', $args); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | private function saveIconTmp($icon, $iconname) |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | |
347 | 347 | $site_info = Context::get('site_module_info'); |
348 | 348 | $virtual_site = ''; |
349 | - if($site_info->site_srl) |
|
349 | + if ($site_info->site_srl) |
|
350 | 350 | { |
351 | - $virtual_site = $site_info->site_srl . '/'; |
|
351 | + $virtual_site = $site_info->site_srl.'/'; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | $target_file = $icon['tmp_name']; |
@@ -357,20 +357,20 @@ discard block |
||
357 | 357 | $target_filename = _XE_PATH_.$relative_filename; |
358 | 358 | |
359 | 359 | list($width, $height, $type_no, $attrs) = @getimagesize($target_file); |
360 | - if($iconname == 'favicon.ico') |
|
360 | + if ($iconname == 'favicon.ico') |
|
361 | 361 | { |
362 | - if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) { |
|
362 | + if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) { |
|
363 | 363 | Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); |
364 | 364 | return; |
365 | 365 | } |
366 | 366 | } |
367 | - else if($iconname == 'mobicon.png') |
|
367 | + else if ($iconname == 'mobicon.png') |
|
368 | 368 | { |
369 | - if(!preg_match('/^.*(png).*$/',$type)) { |
|
369 | + if (!preg_match('/^.*(png).*$/', $type)) { |
|
370 | 370 | Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file')); |
371 | 371 | return; |
372 | 372 | } |
373 | - if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) { |
|
373 | + if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) { |
|
374 | 374 | Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)'); |
375 | 375 | return; |
376 | 376 | } |
@@ -391,21 +391,21 @@ discard block |
||
391 | 391 | |
392 | 392 | $site_info = Context::get('site_module_info'); |
393 | 393 | $virtual_site = ''; |
394 | - if($site_info->site_srl) |
|
394 | + if ($site_info->site_srl) |
|
395 | 395 | { |
396 | - $virtual_site = $site_info->site_srl . '/'; |
|
396 | + $virtual_site = $site_info->site_srl.'/'; |
|
397 | 397 | } |
398 | 398 | |
399 | - $image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site; |
|
399 | + $image_filepath = _XE_PATH_.'files/attach/xeicon/'.$virtual_site; |
|
400 | 400 | |
401 | - if($deleteIcon) { |
|
401 | + if ($deleteIcon) { |
|
402 | 402 | FileHandler::removeFile($image_filepath.$iconname); |
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | 406 | $tmpicon_filepath = $image_filepath.'tmp/'.$iconname; |
407 | 407 | $icon_filepath = $image_filepath.$iconname; |
408 | - if(file_exists($tmpicon_filepath)) |
|
408 | + if (file_exists($tmpicon_filepath)) |
|
409 | 409 | { |
410 | 410 | FileHandler::moveFile($tmpicon_filepath, $icon_filepath); |
411 | 411 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | function procInstallAdminInstall() |
21 | 21 | { |
22 | 22 | $module_name = Context::get('module_name'); |
23 | - if(!$module_name) return new BaseObject(-1, 'invalid_request'); |
|
23 | + if(!$module_name) { |
|
24 | + return new BaseObject(-1, 'invalid_request'); |
|
25 | + } |
|
24 | 26 | |
25 | 27 | $oInstallController = getController('install'); |
26 | 28 | $oInstallController->installModule($module_name, './modules/'.$module_name); |
@@ -35,11 +37,16 @@ discard block |
||
35 | 37 | { |
36 | 38 | @set_time_limit(0); |
37 | 39 | $module_name = Context::get('module_name'); |
38 | - if(!$module_name) return new BaseObject(-1, 'invalid_request'); |
|
40 | + if(!$module_name) { |
|
41 | + return new BaseObject(-1, 'invalid_request'); |
|
42 | + } |
|
39 | 43 | |
40 | 44 | $oModule = getModule($module_name, 'class'); |
41 | - if($oModule) $output = $oModule->moduleUpdate(); |
|
42 | - else $output = new BaseObject(-1, 'invalid_request'); |
|
45 | + if($oModule) { |
|
46 | + $output = $oModule->moduleUpdate(); |
|
47 | + } else { |
|
48 | + $output = new BaseObject(-1, 'invalid_request'); |
|
49 | + } |
|
43 | 50 | |
44 | 51 | return $output; |
45 | 52 | } |
@@ -70,8 +77,12 @@ discard block |
||
70 | 77 | } |
71 | 78 | |
72 | 79 | $default_url = Context::get('default_url'); |
73 | - if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url; |
|
74 | - if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/'; |
|
80 | + if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) { |
|
81 | + $default_url = 'http://'.$default_url; |
|
82 | + } |
|
83 | + if($default_url && substr($default_url, -1) !== '/') { |
|
84 | + $default_url = $default_url.'/'; |
|
85 | + } |
|
75 | 86 | |
76 | 87 | /* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */ |
77 | 88 | require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
@@ -79,28 +90,42 @@ discard block |
||
79 | 90 | $default_url = $IDN->encode($default_url); |
80 | 91 | |
81 | 92 | $use_ssl = Context::get('use_ssl'); |
82 | - if(!$use_ssl) $use_ssl = 'none'; |
|
93 | + if(!$use_ssl) { |
|
94 | + $use_ssl = 'none'; |
|
95 | + } |
|
83 | 96 | |
84 | 97 | $use_nofollow = Context::get('use_nofollow'); |
85 | - if($use_nofollow != 'Y') $use_nofollow = 'N'; |
|
98 | + if($use_nofollow != 'Y') { |
|
99 | + $use_nofollow = 'N'; |
|
100 | + } |
|
86 | 101 | |
87 | 102 | $http_port = Context::get('http_port'); |
88 | 103 | $https_port = Context::get('https_port'); |
89 | 104 | |
90 | 105 | $use_rewrite = Context::get('use_rewrite'); |
91 | - if($use_rewrite!='Y') $use_rewrite = 'N'; |
|
106 | + if($use_rewrite!='Y') { |
|
107 | + $use_rewrite = 'N'; |
|
108 | + } |
|
92 | 109 | |
93 | 110 | $use_sso = Context::get('use_sso'); |
94 | - if($use_sso !='Y') $use_sso = 'N'; |
|
111 | + if($use_sso !='Y') { |
|
112 | + $use_sso = 'N'; |
|
113 | + } |
|
95 | 114 | |
96 | 115 | $use_db_session = Context::get('use_db_session'); |
97 | - if($use_db_session!='Y') $use_db_session = 'N'; |
|
116 | + if($use_db_session!='Y') { |
|
117 | + $use_db_session = 'N'; |
|
118 | + } |
|
98 | 119 | |
99 | 120 | $qmail_compatibility = Context::get('qmail_compatibility'); |
100 | - if($qmail_compatibility!='Y') $qmail_compatibility = 'N'; |
|
121 | + if($qmail_compatibility!='Y') { |
|
122 | + $qmail_compatibility = 'N'; |
|
123 | + } |
|
101 | 124 | |
102 | 125 | $use_html5 = Context::get('use_html5'); |
103 | - if(!$use_html5) $use_html5 = 'N'; |
|
126 | + if(!$use_html5) { |
|
127 | + $use_html5 = 'N'; |
|
128 | + } |
|
104 | 129 | |
105 | 130 | $db_info->default_url = $default_url; |
106 | 131 | $db_info->qmail_compatibility = $qmail_compatibility; |
@@ -112,11 +137,17 @@ discard block |
||
112 | 137 | $db_info->use_html5 = $use_html5; |
113 | 138 | $db_info->admin_ip_list = $admin_ip_list; |
114 | 139 | |
115 | - if($http_port) $db_info->http_port = (int) $http_port; |
|
116 | - else if($db_info->http_port) unset($db_info->http_port); |
|
140 | + if($http_port) { |
|
141 | + $db_info->http_port = (int) $http_port; |
|
142 | + } else if($db_info->http_port) { |
|
143 | + unset($db_info->http_port); |
|
144 | + } |
|
117 | 145 | |
118 | - if($https_port) $db_info->https_port = (int) $https_port; |
|
119 | - else if($db_info->https_port) unset($db_info->https_port); |
|
146 | + if($https_port) { |
|
147 | + $db_info->https_port = (int) $https_port; |
|
148 | + } else if($db_info->https_port) { |
|
149 | + unset($db_info->https_port); |
|
150 | + } |
|
120 | 151 | |
121 | 152 | unset($db_info->lang_type); |
122 | 153 | |
@@ -124,8 +155,7 @@ discard block |
||
124 | 155 | if(!$oInstallController->makeConfigFile()) |
125 | 156 | { |
126 | 157 | return new BaseObject(-1, 'msg_invalid_request'); |
127 | - } |
|
128 | - else |
|
158 | + } else |
|
129 | 159 | { |
130 | 160 | Context::setDBInfo($db_info); |
131 | 161 | if($default_url) |
@@ -177,8 +207,12 @@ discard block |
||
177 | 207 | function procInstallAdminRemoveFTPInfo() |
178 | 208 | { |
179 | 209 | $ftp_config_file = Context::getFTPConfigFile(); |
180 | - if(file_exists($ftp_config_file)) unlink($ftp_config_file); |
|
181 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
210 | + if(file_exists($ftp_config_file)) { |
|
211 | + unlink($ftp_config_file); |
|
212 | + } |
|
213 | + if($_SESSION['ftp_password']) { |
|
214 | + unset($_SESSION['ftp_password']); |
|
215 | + } |
|
182 | 216 | $this->setMessage('success_deleted'); |
183 | 217 | } |
184 | 218 | |
@@ -189,15 +223,16 @@ discard block |
||
189 | 223 | $ftp_info->ftp_port = Context::get('ftp_port'); |
190 | 224 | $ftp_info->ftp_host = Context::get('ftp_host'); |
191 | 225 | $ftp_info->ftp_pasv = Context::get('ftp_pasv'); |
192 | - if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N"; |
|
226 | + if(!$ftp_info->ftp_pasv) { |
|
227 | + $ftp_info->ftp_pasv = "N"; |
|
228 | + } |
|
193 | 229 | $ftp_info->sftp = Context::get('sftp'); |
194 | 230 | |
195 | 231 | $ftp_root_path = Context::get('ftp_root_path'); |
196 | 232 | if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/") |
197 | 233 | { |
198 | 234 | $ftp_info->ftp_root_path = $ftp_root_path; |
199 | - } |
|
200 | - else |
|
235 | + } else |
|
201 | 236 | { |
202 | 237 | $ftp_info->ftp_root_path = $ftp_root_path.'/'; |
203 | 238 | } |
@@ -210,7 +245,9 @@ discard block |
||
210 | 245 | $buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n"; |
211 | 246 | foreach($ftp_info as $key => $val) |
212 | 247 | { |
213 | - if(!$val) continue; |
|
248 | + if(!$val) { |
|
249 | + continue; |
|
250 | + } |
|
214 | 251 | if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val))) |
215 | 252 | { |
216 | 253 | continue; |
@@ -220,7 +257,9 @@ discard block |
||
220 | 257 | $buff .= "?>"; |
221 | 258 | $config_file = Context::getFTPConfigFile(); |
222 | 259 | FileHandler::WriteFile($config_file, $buff); |
223 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
260 | + if($_SESSION['ftp_password']) { |
|
261 | + unset($_SESSION['ftp_password']); |
|
262 | + } |
|
224 | 263 | |
225 | 264 | $this->setMessage('success_updated'); |
226 | 265 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); |
@@ -230,7 +269,9 @@ discard block |
||
230 | 269 | function procInstallAdminConfig() |
231 | 270 | { |
232 | 271 | $use_mobile_view = Context::get('use_mobile_view'); |
233 | - if($use_mobile_view!='Y') $use_mobile_view = 'N'; |
|
272 | + if($use_mobile_view!='Y') { |
|
273 | + $use_mobile_view = 'N'; |
|
274 | + } |
|
234 | 275 | |
235 | 276 | $time_zone = Context::get('time_zone'); |
236 | 277 | |
@@ -326,8 +367,7 @@ discard block |
||
326 | 367 | if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio') |
327 | 368 | { |
328 | 369 | $documentConfig->thumbnail_type = 'crop'; |
329 | - } |
|
330 | - else |
|
370 | + } else |
|
331 | 371 | { |
332 | 372 | $documentConfig->thumbnail_type = 'ratio'; |
333 | 373 | } |
@@ -363,8 +403,7 @@ discard block |
||
363 | 403 | Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); |
364 | 404 | return; |
365 | 405 | } |
366 | - } |
|
367 | - else if($iconname == 'mobicon.png') |
|
406 | + } else if($iconname == 'mobicon.png') |
|
368 | 407 | { |
369 | 408 | if(!preg_match('/^.*(png).*$/',$type)) { |
370 | 409 | Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file')); |
@@ -374,8 +413,7 @@ discard block |
||
374 | 413 | Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)'); |
375 | 414 | return; |
376 | 415 | } |
377 | - } |
|
378 | - else |
|
416 | + } else |
|
379 | 417 | { |
380 | 418 | Context::set('msg', Context::getLang('msg_invalid_format')); |
381 | 419 | return; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | $db_info = Context::getDBInfo(); |
30 | 30 | |
31 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
31 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
32 | 32 | { |
33 | 33 | $xe_default_url = Context::decodeIdna($db_info->default_url); |
34 | 34 | } |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | // forbit access if the user is not an administrator |
49 | 49 | $oMemberModel = getModel('member'); |
50 | 50 | $logged_info = $oMemberModel->getLoggedInfo(); |
51 | - if($logged_info->is_admin != 'Y') |
|
51 | + if ($logged_info->is_admin != 'Y') |
|
52 | 52 | { |
53 | 53 | return $this->stop("msg_is_not_administrator"); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // change into administration layout |
57 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
57 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
58 | 58 | $this->setLayoutPath($this->getTemplatePath()); |
59 | 59 | $this->setLayoutFile('layout.html'); |
60 | 60 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N'); |
76 | 76 | Context::set('use_ssl', $db_info->use_ssl ? $db_info->use_ssl : "none"); |
77 | 77 | Context::set('use_nofollow', $db_info->use_nofollow == 'N' ? 'N' : 'Y'); |
78 | - if($db_info->http_port) |
|
78 | + if ($db_info->http_port) |
|
79 | 79 | { |
80 | 80 | Context::set('http_port', $db_info->http_port); |
81 | 81 | } |
82 | - if($db_info->https_port) |
|
82 | + if ($db_info->https_port) |
|
83 | 83 | { |
84 | 84 | Context::set('https_port', $db_info->https_port); |
85 | 85 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | function checkEasyinstall() |
96 | 96 | { |
97 | 97 | $lastTime = (int) FileHandler::readFile($this->easyinstallCheckFile); |
98 | - if($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
98 | + if ($lastTime > $_SERVER['REQUEST_TIME'] - 60 * 60 * 24 * 30) |
|
99 | 99 | { |
100 | 100 | return; |
101 | 101 | } |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | $lUpdateDoc = $xml_lUpdate->parse($buff); |
110 | 110 | $updateDate = $lUpdateDoc->response->updatedate->body; |
111 | 111 | |
112 | - if(!$updateDate) |
|
112 | + if (!$updateDate) |
|
113 | 113 | { |
114 | 114 | $this->_markingCheckEasyinstall(); |
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | 118 | $item = $oAutoinstallModel->getLatestPackage(); |
119 | - if(!$item || $item->updatedate < $updateDate) |
|
119 | + if (!$item || $item->updatedate < $updateDate) |
|
120 | 120 | { |
121 | 121 | $oController = getAdminController('autoinstall'); |
122 | 122 | $oController->_updateinfo(); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | // Check is_shortcut column |
147 | 147 | $oDB = DB::getInstance(); |
148 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
148 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
149 | 149 | { |
150 | 150 | return; |
151 | 151 | } |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | $currentAct = Context::get('act'); |
164 | 164 | $subMenuTitle = ''; |
165 | 165 | |
166 | - foreach((array) $moduleActionInfo->menu as $key => $value) |
|
166 | + foreach ((array) $moduleActionInfo->menu as $key => $value) |
|
167 | 167 | { |
168 | - if(isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
168 | + if (isset($value->acts) && is_array($value->acts) && in_array($currentAct, $value->acts)) |
|
169 | 169 | { |
170 | 170 | $subMenuTitle = $value->title; |
171 | 171 | break; |
@@ -174,21 +174,21 @@ discard block |
||
174 | 174 | // get current menu's srl(=parentSrl) |
175 | 175 | $parentSrl = 0; |
176 | 176 | $oMenuAdminConroller = getAdminController('menu'); |
177 | - foreach((array) $menu->list as $parentKey => $parentMenu) |
|
177 | + foreach ((array) $menu->list as $parentKey => $parentMenu) |
|
178 | 178 | { |
179 | - if(!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
179 | + if (!is_array($parentMenu['list']) || !count($parentMenu['list'])) |
|
180 | 180 | { |
181 | 181 | continue; |
182 | 182 | } |
183 | - if($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
183 | + if ($parentMenu['href'] == '#' && count($parentMenu['list'])) |
|
184 | 184 | { |
185 | 185 | $firstChild = current($parentMenu['list']); |
186 | 186 | $menu->list[$parentKey]['href'] = $firstChild['href']; |
187 | 187 | } |
188 | 188 | |
189 | - foreach($parentMenu['list'] as $childKey => $childMenu) |
|
189 | + foreach ($parentMenu['list'] as $childKey => $childMenu) |
|
190 | 190 | { |
191 | - if($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
191 | + if ($subMenuTitle == $childMenu['text'] && $parentSrl == 0) |
|
192 | 192 | { |
193 | 193 | $parentSrl = $childMenu['parent_srl']; |
194 | 194 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $gnbTitleInfo->adminTitle = $objConfig->adminTitle ? $objConfig->adminTitle : 'XE Admin'; |
202 | 202 | $gnbTitleInfo->adminLogo = $objConfig->adminLogo ? $objConfig->adminLogo : 'modules/admin/tpl/img/xe.h1.png'; |
203 | 203 | |
204 | - $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard') . ' - ' . $gnbTitleInfo->adminTitle; |
|
204 | + $browserTitle = ($subMenuTitle ? $subMenuTitle : 'Dashboard').' - '.$gnbTitleInfo->adminTitle; |
|
205 | 205 | |
206 | 206 | // Get list of favorite |
207 | 207 | $oAdminAdminModel = getAdminModel('admin'); |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | // move from index method, because use in admin footer |
213 | 213 | $newest_news_url = sprintf("http://news.xpressengine.com/%s/news.php?version=%s&package=%s", _XE_LOCATION_, __XE_VERSION__, _XE_PACKAGE_); |
214 | 214 | $cache_file = sprintf("%sfiles/cache/newest_news.%s.cache.php", _XE_PATH_, _XE_LOCATION_); |
215 | - if(!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
215 | + if (!file_exists($cache_file) || filemtime($cache_file) + 60 * 60 < $_SERVER['REQUEST_TIME']) |
|
216 | 216 | { |
217 | 217 | // Considering if data cannot be retrieved due to network problem, modify filemtime to prevent trying to reload again when refreshing administration page |
218 | 218 | // Ensure to access the administration page even though news cannot be displayed |
@@ -220,20 +220,20 @@ discard block |
||
220 | 220 | FileHandler::getRemoteFile($newest_news_url, $cache_file, null, 1, 'GET', 'text/html', array('REQUESTURL' => getFullUrl(''))); |
221 | 221 | } |
222 | 222 | |
223 | - if(file_exists($cache_file)) |
|
223 | + if (file_exists($cache_file)) |
|
224 | 224 | { |
225 | 225 | $oXml = new XmlParser(); |
226 | 226 | $buff = $oXml->parse(FileHandler::readFile($cache_file)); |
227 | 227 | |
228 | 228 | $item = $buff->zbxe_news->item; |
229 | - if($item) |
|
229 | + if ($item) |
|
230 | 230 | { |
231 | - if(!is_array($item)) |
|
231 | + if (!is_array($item)) |
|
232 | 232 | { |
233 | 233 | $item = array($item); |
234 | 234 | } |
235 | 235 | |
236 | - foreach($item as $key => $val) |
|
236 | + foreach ($item as $key => $val) |
|
237 | 237 | { |
238 | 238 | $obj = new stdClass(); |
239 | 239 | $obj->title = $val->body; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $news[] = $obj; |
243 | 243 | } |
244 | 244 | Context::set('news', $news); |
245 | - if(isset($news) && is_array($news)) |
|
245 | + if (isset($news) && is_array($news)) |
|
246 | 246 | { |
247 | 247 | Context::set('latestVersion', array_shift($news)); |
248 | 248 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | function dispAdminIndex() |
266 | 266 | { |
267 | 267 | $db_info = Context::getDBInfo(); |
268 | - Context::set('db_info',$db_info); |
|
268 | + Context::set('db_info', $db_info); |
|
269 | 269 | |
270 | 270 | // Get statistics |
271 | 271 | $args = new stdClass(); |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | $args = new stdClass(); |
303 | 303 | $args->list_count = 5; |
304 | 304 | $output = $oCommentModel->getNewestCommentList($args, $columnList); |
305 | - if(is_array($output)) |
|
305 | + if (is_array($output)) |
|
306 | 306 | { |
307 | - foreach($output AS $key => $value) |
|
307 | + foreach ($output AS $key => $value) |
|
308 | 308 | { |
309 | 309 | $value->content = strip_tags($value->content); |
310 | 310 | } |
@@ -315,17 +315,17 @@ discard block |
||
315 | 315 | // Get list of modules |
316 | 316 | $oModuleModel = getModel('module'); |
317 | 317 | $module_list = $oModuleModel->getModuleList(); |
318 | - if(is_array($module_list)) |
|
318 | + if (is_array($module_list)) |
|
319 | 319 | { |
320 | 320 | $needUpdate = FALSE; |
321 | 321 | $addTables = FALSE; |
322 | - foreach($module_list AS $key => $value) |
|
322 | + foreach ($module_list AS $key => $value) |
|
323 | 323 | { |
324 | - if($value->need_install) |
|
324 | + if ($value->need_install) |
|
325 | 325 | { |
326 | 326 | $addTables = TRUE; |
327 | 327 | } |
328 | - if($value->need_update) |
|
328 | + if ($value->need_update) |
|
329 | 329 | { |
330 | 330 | $needUpdate = TRUE; |
331 | 331 | } |
@@ -336,12 +336,12 @@ discard block |
||
336 | 336 | $oAutoinstallAdminModel = getAdminModel('autoinstall'); |
337 | 337 | $needUpdateList = $oAutoinstallAdminModel->getNeedUpdateList(); |
338 | 338 | |
339 | - if(is_array($needUpdateList)) |
|
339 | + if (is_array($needUpdateList)) |
|
340 | 340 | { |
341 | - foreach($needUpdateList AS $key => $value) |
|
341 | + foreach ($needUpdateList AS $key => $value) |
|
342 | 342 | { |
343 | 343 | $helpUrl = './admin/help/index.html#'; |
344 | - switch($value->type) |
|
344 | + switch ($value->type) |
|
345 | 345 | { |
346 | 346 | case 'addon': |
347 | 347 | $helpUrl .= 'UMAN_terminology_addon'; |
@@ -368,8 +368,8 @@ discard block |
||
368 | 368 | |
369 | 369 | $site_module_info = Context::get('site_module_info'); |
370 | 370 | $oAddonAdminModel = getAdminModel('addon'); |
371 | - $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl ); |
|
372 | - if(!$counterAddonActivated) |
|
371 | + $counterAddonActivated = $oAddonAdminModel->isActivatedAddon('counter', $site_module_info->site_srl); |
|
372 | + if (!$counterAddonActivated) |
|
373 | 373 | { |
374 | 374 | $columnList = array('member_srl', 'nick_name', 'user_name', 'user_id', 'email_address'); |
375 | 375 | $args = new stdClass; |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | |
393 | 393 | // gathering enviroment check |
394 | 394 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
395 | - $path = FileHandler::getRealPath('./files/env/' . $mainVersion); |
|
395 | + $path = FileHandler::getRealPath('./files/env/'.$mainVersion); |
|
396 | 396 | $isEnviromentGatheringAgreement = FALSE; |
397 | - if(file_exists($path)) |
|
397 | + if (file_exists($path)) |
|
398 | 398 | { |
399 | 399 | $isEnviromentGatheringAgreement = TRUE; |
400 | 400 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $isLicenseAgreement = FALSE; |
405 | 405 | $path = FileHandler::getRealPath('./files/env/license_agreement'); |
406 | 406 | $isLicenseAgreement = FALSE; |
407 | - if(file_exists($path)) |
|
407 | + if (file_exists($path)) |
|
408 | 408 | { |
409 | 409 | $isLicenseAgreement = TRUE; |
410 | 410 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | |
427 | 427 | Context::set('selected_lang', $db_info->lang_type); |
428 | 428 | |
429 | - if(strpos($db_info->default_url, 'xn--') !== FALSE) |
|
429 | + if (strpos($db_info->default_url, 'xn--') !== FALSE) |
|
430 | 430 | { |
431 | 431 | $db_info->default_url = Context::decodeIdna($db_info->default_url); |
432 | 432 | } |
@@ -435,9 +435,9 @@ discard block |
||
435 | 435 | |
436 | 436 | // site lock |
437 | 437 | Context::set('IP', $_SERVER['REMOTE_ADDR']); |
438 | - if(!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
439 | - if(!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
440 | - if(!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
438 | + if (!$db_info->sitelock_title) $db_info->sitelock_title = 'Maintenance in progress...'; |
|
439 | + if (!in_array('127.0.0.1', $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = '127.0.0.1'; |
|
440 | + if (!in_array($_SERVER['REMOTE_ADDR'], $db_info->sitelock_whitelist)) $db_info->sitelock_whitelist[] = $_SERVER['REMOTE_ADDR']; |
|
441 | 441 | $db_info->sitelock_whitelist = array_unique($db_info->sitelock_whitelist); |
442 | 442 | Context::set('remote_addr', $_SERVER['REMOTE_ADDR']); |
443 | 443 | Context::set('use_sitelock', $db_info->use_sitelock); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | Context::set('sitelock_whitelist', $whitelist); |
449 | 449 | |
450 | 450 | |
451 | - if($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
451 | + if ($db_info->admin_ip_list) $admin_ip_list = implode("\r\n", $db_info->admin_ip_list); |
|
452 | 452 | else $admin_ip_list = ''; |
453 | 453 | Context::set('admin_ip_list', $admin_ip_list); |
454 | 454 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | Context::set('htmlFooter', htmlspecialchars($config->htmlFooter)); |
472 | 472 | |
473 | 473 | // embed filter |
474 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
474 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
475 | 475 | $oEmbedFilter = EmbedFilter::getInstance(); |
476 | 476 | context::set('embed_white_object', implode(PHP_EOL, $oEmbedFilter->whiteUrlList)); |
477 | 477 | context::set('embed_white_iframe', implode(PHP_EOL, $oEmbedFilter->whiteIframeUrlList)); |
@@ -530,36 +530,36 @@ discard block |
||
530 | 530 | */ |
531 | 531 | function showSendEnv() |
532 | 532 | { |
533 | - if(Context::getResponseMethod() != 'HTML') |
|
533 | + if (Context::getResponseMethod() != 'HTML') |
|
534 | 534 | { |
535 | 535 | return; |
536 | 536 | } |
537 | 537 | |
538 | 538 | $server = 'http://collect.xpressengine.com/env/img.php?'; |
539 | 539 | $path = './files/env/'; |
540 | - $install_env = $path . 'install'; |
|
540 | + $install_env = $path.'install'; |
|
541 | 541 | $mainVersion = join('.', array_slice(explode('.', __XE_VERSION__), 0, 2)); |
542 | 542 | |
543 | - if(file_exists(FileHandler::getRealPath($install_env))) |
|
543 | + if (file_exists(FileHandler::getRealPath($install_env))) |
|
544 | 544 | { |
545 | 545 | $oAdminAdminModel = getAdminModel('admin'); |
546 | 546 | $params = $oAdminAdminModel->getEnv('INSTALL'); |
547 | - $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
|
547 | + $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); |
|
548 | 548 | Context::addHtmlFooter($img); |
549 | 549 | |
550 | - FileHandler::writeFile($path . $mainVersion, '1'); |
|
550 | + FileHandler::writeFile($path.$mainVersion, '1'); |
|
551 | 551 | } |
552 | - else if(isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path . $mainVersion))) |
|
552 | + else if (isset($_SESSION['enviroment_gather']) && !file_exists(FileHandler::getRealPath($path.$mainVersion))) |
|
553 | 553 | { |
554 | - if($_SESSION['enviroment_gather'] == 'Y') |
|
554 | + if ($_SESSION['enviroment_gather'] == 'Y') |
|
555 | 555 | { |
556 | 556 | $oAdminAdminModel = getAdminModel('admin'); |
557 | 557 | $params = $oAdminAdminModel->getEnv(); |
558 | - $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server . $params); |
|
558 | + $img = sprintf('<img src="%s" alt="" style="height:0px;width:0px" />', $server.$params); |
|
559 | 559 | Context::addHtmlFooter($img); |
560 | 560 | } |
561 | 561 | |
562 | - FileHandler::writeFile($path . $mainVersion, '1'); |
|
562 | + FileHandler::writeFile($path.$mainVersion, '1'); |
|
563 | 563 | unset($_SESSION['enviroment_gather']); |
564 | 564 | } |
565 | 565 | } |
@@ -577,64 +577,64 @@ discard block |
||
577 | 577 | $tmp = explode("&", $envInfo); |
578 | 578 | $arrInfo = array(); |
579 | 579 | $xe_check_env = array(); |
580 | - foreach($tmp as $value) { |
|
580 | + foreach ($tmp as $value) { |
|
581 | 581 | $arr = explode("=", $value); |
582 | - if($arr[0]=="type") { |
|
582 | + if ($arr[0] == "type") { |
|
583 | 583 | continue; |
584 | - }elseif($arr[0]=="phpext" ) { |
|
584 | + }elseif ($arr[0] == "phpext") { |
|
585 | 585 | $str = urldecode($arr[1]); |
586 | - $xe_check_env[$arr[0]]= str_replace("|", ", ", $str); |
|
587 | - } elseif($arr[0]=="module" ) { |
|
586 | + $xe_check_env[$arr[0]] = str_replace("|", ", ", $str); |
|
587 | + } elseif ($arr[0] == "module") { |
|
588 | 588 | $str = urldecode($arr[1]); |
589 | 589 | $arrModuleName = explode("|", $str); |
590 | 590 | $oModuleModel = getModel("module"); |
591 | 591 | $mInfo = array(); |
592 | - foreach($arrModuleName as $moduleName) { |
|
592 | + foreach ($arrModuleName as $moduleName) { |
|
593 | 593 | $moduleInfo = $oModuleModel->getModuleInfoXml($moduleName); |
594 | 594 | $mInfo[] = "{$moduleName}({$moduleInfo->version})"; |
595 | 595 | } |
596 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
597 | - } elseif($arr[0]=="addon") { |
|
596 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
597 | + } elseif ($arr[0] == "addon") { |
|
598 | 598 | $str = urldecode($arr[1]); |
599 | 599 | $arrAddonName = explode("|", $str); |
600 | 600 | $oAddonModel = getAdminModel("addon"); |
601 | 601 | $mInfo = array(); |
602 | - foreach($arrAddonName as $addonName) { |
|
602 | + foreach ($arrAddonName as $addonName) { |
|
603 | 603 | $addonInfo = $oAddonModel->getAddonInfoXml($addonName); |
604 | 604 | $mInfo[] = "{$addonName}({$addonInfo->version})"; |
605 | 605 | } |
606 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
607 | - } elseif($arr[0]=="widget") { |
|
606 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
607 | + } elseif ($arr[0] == "widget") { |
|
608 | 608 | $str = urldecode($arr[1]); |
609 | 609 | $arrWidgetName = explode("|", $str); |
610 | 610 | $oWidgetModel = getModel("widget"); |
611 | 611 | $mInfo = array(); |
612 | - foreach($arrWidgetName as $widgetName) { |
|
612 | + foreach ($arrWidgetName as $widgetName) { |
|
613 | 613 | $widgetInfo = $oWidgetModel->getWidgetInfo($widgetName); |
614 | 614 | $mInfo[] = "{$widgetName}({$widgetInfo->version})"; |
615 | 615 | } |
616 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
617 | - } elseif($arr[0]=="widgetstyle") { |
|
616 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
617 | + } elseif ($arr[0] == "widgetstyle") { |
|
618 | 618 | $str = urldecode($arr[1]); |
619 | 619 | $arrWidgetstyleName = explode("|", $str); |
620 | 620 | $oWidgetModel = getModel("widget"); |
621 | 621 | $mInfo = array(); |
622 | - foreach($arrWidgetstyleName as $widgetstyleName) { |
|
622 | + foreach ($arrWidgetstyleName as $widgetstyleName) { |
|
623 | 623 | $widgetstyleInfo = $oWidgetModel->getWidgetStyleInfo($widgetstyleName); |
624 | 624 | $mInfo[] = "{$widgetstyleName}({$widgetstyleInfo->version})"; |
625 | 625 | } |
626 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
626 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
627 | 627 | |
628 | - } elseif($arr[0]=="layout") { |
|
628 | + } elseif ($arr[0] == "layout") { |
|
629 | 629 | $str = urldecode($arr[1]); |
630 | 630 | $arrLayoutName = explode("|", $str); |
631 | 631 | $oLayoutModel = getModel("layout"); |
632 | 632 | $mInfo = array(); |
633 | - foreach($arrLayoutName as $layoutName) { |
|
633 | + foreach ($arrLayoutName as $layoutName) { |
|
634 | 634 | $layoutInfo = $oLayoutModel->getLayoutInfo($layoutName); |
635 | 635 | $mInfo[] = "{$layoutName}({$layoutInfo->version})"; |
636 | 636 | } |
637 | - $xe_check_env[$arr[0]]= join(", ", $mInfo); |
|
637 | + $xe_check_env[$arr[0]] = join(", ", $mInfo); |
|
638 | 638 | } else { |
639 | 639 | $xe_check_env[$arr[0]] = urldecode($arr[1]); |
640 | 640 | } |
@@ -648,15 +648,15 @@ discard block |
||
648 | 648 | $php_core['memory_limit'] = "{$ini_info['memory_limit']['local_value']}"; |
649 | 649 | $info['PHP_Core'] = $php_core; |
650 | 650 | |
651 | - $str_info = "[XE Server Environment " . date("Y-m-d") . "]\n\n"; |
|
651 | + $str_info = "[XE Server Environment ".date("Y-m-d")."]\n\n"; |
|
652 | 652 | $str_info .= "realpath : ".realpath('./')."\n"; |
653 | - foreach( $info as $key=>$value ) |
|
653 | + foreach ($info as $key=>$value) |
|
654 | 654 | { |
655 | - if( is_array( $value ) == false ) { |
|
655 | + if (is_array($value) == false) { |
|
656 | 656 | $str_info .= "{$key} : {$value}\n"; |
657 | 657 | } else { |
658 | 658 | //$str_info .= "\n{$key} \n"; |
659 | - foreach( $value as $key2=>$value2 ) |
|
659 | + foreach ($value as $key2=>$value2) |
|
660 | 660 | $str_info .= "{$key2} : {$value2}\n"; |
661 | 661 | } |
662 | 662 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | Context::set('use_rewrite', $useRewrite); |
674 | 674 | |
675 | 675 | // nginx 체크, rewrite 사용법 안내 |
676 | - if($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
676 | + if ($useRewrite == 'N' && stripos($_SERVER['SERVER_SOFTWARE'], 'nginx') !== false) Context::set('use_nginx', 'Y'); |
|
677 | 677 | |
678 | 678 | Context::set('useable', $oInstallController->checkInstallEnv()); |
679 | 679 | $this->setTemplateFile('check_env.html'); |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | * |
7 | 7 | * @author NAVER ([email protected]) |
8 | 8 | */ |
9 | -if(!defined('__XE__')) |
|
9 | +if (!defined('__XE__')) |
|
10 | 10 | { |
11 | 11 | exit(); |
12 | 12 | } |
13 | 13 | |
14 | 14 | // define an empty function to avoid errors when iconv function doesn't exist |
15 | -if(!function_exists('iconv')) |
|
15 | +if (!function_exists('iconv')) |
|
16 | 16 | { |
17 | 17 | eval(' |
18 | 18 | function iconv($in_charset, $out_charset, $str) |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | $oDB = DB::getInstance(); |
222 | 222 | $output = $oDB->executeQuery($query_id, $args, $arg_columns); |
223 | - if(!is_array($output->data) && count($output->data) > 0) |
|
223 | + if (!is_array($output->data) && count($output->data) > 0) |
|
224 | 224 | { |
225 | 225 | $output->data = array($output->data); |
226 | 226 | } |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | function setUserSequence($seq) |
251 | 251 | { |
252 | 252 | $arr_seq = array(); |
253 | - if(isset($_SESSION['seq'])) |
|
253 | + if (isset($_SESSION['seq'])) |
|
254 | 254 | { |
255 | - if(!is_array($_SESSION['seq'])) { |
|
255 | + if (!is_array($_SESSION['seq'])) { |
|
256 | 256 | $_SESSION['seq'] = array($_SESSION['seq']); |
257 | 257 | } |
258 | 258 | $arr_seq = $_SESSION['seq']; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function checkUserSequence($seq) |
271 | 271 | { |
272 | - if(!isset($_SESSION['seq'])) |
|
272 | + if (!isset($_SESSION['seq'])) |
|
273 | 273 | { |
274 | 274 | return false; |
275 | 275 | } |
276 | - if(!in_array($seq, $_SESSION['seq'])) |
|
276 | + if (!in_array($seq, $_SESSION['seq'])) |
|
277 | 277 | { |
278 | 278 | return false; |
279 | 279 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $num_args = func_num_args(); |
300 | 300 | $args_list = func_get_args(); |
301 | 301 | |
302 | - if($num_args) |
|
302 | + if ($num_args) |
|
303 | 303 | $url = Context::getUrl($num_args, $args_list); |
304 | 304 | else |
305 | 305 | $url = Context::getRequestUri(); |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $num_args = func_num_args(); |
319 | 319 | $args_list = func_get_args(); |
320 | 320 | |
321 | - if($num_args) |
|
321 | + if ($num_args) |
|
322 | 322 | { |
323 | 323 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
324 | 324 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | $num_args = func_num_args(); |
342 | 342 | $args_list = func_get_args(); |
343 | 343 | |
344 | - if($num_args) |
|
344 | + if ($num_args) |
|
345 | 345 | { |
346 | 346 | $url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE); |
347 | 347 | } |
@@ -363,16 +363,16 @@ discard block |
||
363 | 363 | $num_args = func_num_args(); |
364 | 364 | $args_list = func_get_args(); |
365 | 365 | $request_uri = Context::getRequestUri(); |
366 | - if(!$num_args) |
|
366 | + if (!$num_args) |
|
367 | 367 | { |
368 | 368 | return $request_uri; |
369 | 369 | } |
370 | 370 | |
371 | 371 | $url = Context::getUrl($num_args, $args_list); |
372 | - if(strncasecmp('http', $url, 4) !== 0) |
|
372 | + if (strncasecmp('http', $url, 4) !== 0) |
|
373 | 373 | { |
374 | 374 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
375 | - return substr($match[0], 0, -1) . $url; |
|
375 | + return substr($match[0], 0, -1).$url; |
|
376 | 376 | } |
377 | 377 | return $url; |
378 | 378 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | $num_args = func_num_args(); |
388 | 388 | $args_list = func_get_args(); |
389 | 389 | $request_uri = Context::getRequestUri(); |
390 | - if(!$num_args) |
|
390 | + if (!$num_args) |
|
391 | 391 | { |
392 | 392 | return $request_uri; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
396 | - if(strncasecmp('http', $url, 4) !== 0) |
|
396 | + if (strncasecmp('http', $url, 4) !== 0) |
|
397 | 397 | { |
398 | 398 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
399 | 399 | $url = Context::getUrl($num_args, $args_list, NULL, FALSE); |
400 | - return substr($match[0], 0, -1) . $url; |
|
400 | + return substr($match[0], 0, -1).$url; |
|
401 | 401 | } |
402 | 402 | return $url; |
403 | 403 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $num_args = func_num_args(); |
414 | 414 | $args_list = func_get_args(); |
415 | 415 | |
416 | - if(!$num_args) |
|
416 | + if (!$num_args) |
|
417 | 417 | { |
418 | 418 | return Context::getRequestUri(); |
419 | 419 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $num_args = func_num_args(); |
436 | 436 | $args_list = func_get_args(); |
437 | 437 | |
438 | - if(!$num_args) |
|
438 | + if (!$num_args) |
|
439 | 439 | { |
440 | 440 | return Context::getRequestUri(); |
441 | 441 | } |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $args_list = func_get_args(); |
458 | 458 | |
459 | 459 | $request_uri = Context::getRequestUri(); |
460 | - if(!$num_args) |
|
460 | + if (!$num_args) |
|
461 | 461 | { |
462 | 462 | return $request_uri; |
463 | 463 | } |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | $num_args = count($args_list); |
467 | 467 | |
468 | 468 | $url = Context::getUrl($num_args, $args_list, $domain); |
469 | - if(strncasecmp('http', $url, 4) !== 0) |
|
469 | + if (strncasecmp('http', $url, 4) !== 0) |
|
470 | 470 | { |
471 | 471 | preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match); |
472 | - return substr($match[0], 0, -1) . $url; |
|
472 | + return substr($match[0], 0, -1).$url; |
|
473 | 473 | } |
474 | 474 | return $url; |
475 | 475 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | function getCurrentPageUrl() |
483 | 483 | { |
484 | 484 | $protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://'; |
485 | - $url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
485 | + $url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']); |
|
486 | 486 | return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE); |
487 | 487 | } |
488 | 488 | |
@@ -507,12 +507,12 @@ discard block |
||
507 | 507 | */ |
508 | 508 | function cut_str($string, $cut_size = 0, $tail = '...') |
509 | 509 | { |
510 | - if($cut_size < 1 || !$string) |
|
510 | + if ($cut_size < 1 || !$string) |
|
511 | 511 | { |
512 | 512 | return $string; |
513 | 513 | } |
514 | 514 | |
515 | - if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
515 | + if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth')) |
|
516 | 516 | { |
517 | 517 | $GLOBALS['use_mb_strimwidth'] = TRUE; |
518 | 518 | return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8'); |
@@ -526,16 +526,16 @@ discard block |
||
526 | 526 | $char_count = 0; |
527 | 527 | |
528 | 528 | $idx = 0; |
529 | - while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
529 | + while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width) |
|
530 | 530 | { |
531 | 531 | $c = ord(substr($string, $idx, 1)); |
532 | 532 | $char_count++; |
533 | - if($c < 128) |
|
533 | + if ($c < 128) |
|
534 | 534 | { |
535 | 535 | $char_width += (int) $chars[$c - 32]; |
536 | 536 | $idx++; |
537 | 537 | } |
538 | - else if(191 < $c && $c < 224) |
|
538 | + else if (191 < $c && $c < 224) |
|
539 | 539 | { |
540 | 540 | $char_width += $chars[4]; |
541 | 541 | $idx += 2; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | } |
549 | 549 | |
550 | 550 | $output = substr($string, 0, $idx); |
551 | - if(strlen($output) < $string_length) |
|
551 | + if (strlen($output) < $string_length) |
|
552 | 552 | { |
553 | 553 | $output .= $tail; |
554 | 554 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | function zgap() |
565 | 565 | { |
566 | 566 | $time_zone = $GLOBALS['_time_zone']; |
567 | - if($time_zone < 0) |
|
567 | + if ($time_zone < 0) |
|
568 | 568 | { |
569 | 569 | $to = -1; |
570 | 570 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $t_min = substr($time_zone, 3, 2) * $to; |
578 | 578 | |
579 | 579 | $server_time_zone = date("O"); |
580 | - if($server_time_zone < 0) |
|
580 | + if ($server_time_zone < 0) |
|
581 | 581 | { |
582 | 582 | $so = -1; |
583 | 583 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | function ztime($str) |
606 | 606 | { |
607 | - if(!$str) |
|
607 | + if (!$str) |
|
608 | 608 | { |
609 | 609 | return; |
610 | 610 | } |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | $year = (int) substr($str, 0, 4); |
620 | 620 | $month = (int) substr($str, 4, 2); |
621 | 621 | $day = (int) substr($str, 6, 2); |
622 | - if(strlen($str) <= 8) |
|
622 | + if (strlen($str) <= 8) |
|
623 | 623 | { |
624 | 624 | $gap = 0; |
625 | 625 | } |
@@ -643,19 +643,19 @@ discard block |
||
643 | 643 | $gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date); |
644 | 644 | |
645 | 645 | $lang_time_gap = Context::getLang('time_gap'); |
646 | - if($gap < 60) |
|
646 | + if ($gap < 60) |
|
647 | 647 | { |
648 | 648 | $buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1); |
649 | 649 | } |
650 | - elseif($gap < 60 * 60) |
|
650 | + elseif ($gap < 60 * 60) |
|
651 | 651 | { |
652 | 652 | $buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1); |
653 | 653 | } |
654 | - elseif($gap < 60 * 60 * 2) |
|
654 | + elseif ($gap < 60 * 60 * 2) |
|
655 | 655 | { |
656 | 656 | $buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1); |
657 | 657 | } |
658 | - elseif($gap < 60 * 60 * 24) |
|
658 | + elseif ($gap < 60 * 60 * 24) |
|
659 | 659 | { |
660 | 660 | $buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1); |
661 | 661 | } |
@@ -692,40 +692,40 @@ discard block |
||
692 | 692 | function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE) |
693 | 693 | { |
694 | 694 | // return null if no target time is specified |
695 | - if(!$str) |
|
695 | + if (!$str) |
|
696 | 696 | { |
697 | 697 | return; |
698 | 698 | } |
699 | 699 | // convert the date format according to the language |
700 | - if($conversion == TRUE) |
|
700 | + if ($conversion == TRUE) |
|
701 | 701 | { |
702 | - switch(Context::getLangType()) |
|
702 | + switch (Context::getLangType()) |
|
703 | 703 | { |
704 | 704 | case 'en' : |
705 | 705 | case 'es' : |
706 | - if($format == 'Y-m-d') |
|
706 | + if ($format == 'Y-m-d') |
|
707 | 707 | { |
708 | 708 | $format = 'M d, Y'; |
709 | 709 | } |
710 | - elseif($format == 'Y-m-d H:i:s') |
|
710 | + elseif ($format == 'Y-m-d H:i:s') |
|
711 | 711 | { |
712 | 712 | $format = 'M d, Y H:i:s'; |
713 | 713 | } |
714 | - elseif($format == 'Y-m-d H:i') |
|
714 | + elseif ($format == 'Y-m-d H:i') |
|
715 | 715 | { |
716 | 716 | $format = 'M d, Y H:i'; |
717 | 717 | } |
718 | 718 | break; |
719 | 719 | case 'vi' : |
720 | - if($format == 'Y-m-d') |
|
720 | + if ($format == 'Y-m-d') |
|
721 | 721 | { |
722 | 722 | $format = 'd-m-Y'; |
723 | 723 | } |
724 | - elseif($format == 'Y-m-d H:i:s') |
|
724 | + elseif ($format == 'Y-m-d H:i:s') |
|
725 | 725 | { |
726 | 726 | $format = 'H:i:s d-m-Y'; |
727 | 727 | } |
728 | - elseif($format == 'Y-m-d H:i') |
|
728 | + elseif ($format == 'Y-m-d H:i') |
|
729 | 729 | { |
730 | 730 | $format = 'H:i d-m-Y'; |
731 | 731 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | |
736 | 736 | // If year value is less than 1970, handle it separately. |
737 | - if((int) substr($str, 0, 4) < 1970) |
|
737 | + if ((int) substr($str, 0, 4) < 1970) |
|
738 | 738 | { |
739 | 739 | $hour = (int) substr($str, 8, 2); |
740 | 740 | $min = (int) substr($str, 10, 2); |
@@ -784,9 +784,9 @@ discard block |
||
784 | 784 | function getEncodeEmailAddress($email) |
785 | 785 | { |
786 | 786 | $return = ''; |
787 | - for($i = 0, $c = strlen($email); $i < $c; $i++) |
|
787 | + for ($i = 0, $c = strlen($email); $i < $c; $i++) |
|
788 | 788 | { |
789 | - $return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';'; |
|
789 | + $return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';'; |
|
790 | 790 | } |
791 | 791 | return $return; |
792 | 792 | } |
@@ -806,25 +806,25 @@ discard block |
||
806 | 806 | { |
807 | 807 | static $debug_file; |
808 | 808 | |
809 | - if(!(__DEBUG__ & 1)) |
|
809 | + if (!(__DEBUG__ & 1)) |
|
810 | 810 | { |
811 | 811 | return; |
812 | 812 | } |
813 | 813 | |
814 | 814 | static $firephp; |
815 | 815 | $bt = debug_backtrace(); |
816 | - if(is_array($bt)) |
|
816 | + if (is_array($bt)) |
|
817 | 817 | { |
818 | 818 | $bt_debug_print = array_shift($bt); |
819 | 819 | $bt_called_function = array_shift($bt); |
820 | 820 | } |
821 | 821 | $file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']); |
822 | 822 | $line_num = $bt_debug_print['line']; |
823 | - $function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function']; |
|
823 | + $function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function']; |
|
824 | 824 | |
825 | - if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
825 | + if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
826 | 826 | { |
827 | - if(!isset($firephp)) |
|
827 | + if (!isset($firephp)) |
|
828 | 828 | { |
829 | 829 | $firephp = FirePHP::getInstance(TRUE); |
830 | 830 | } |
@@ -833,16 +833,16 @@ discard block |
||
833 | 833 | $label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage())); |
834 | 834 | |
835 | 835 | // Check a FirePHP option |
836 | - if($display_option === 'TABLE') |
|
836 | + if ($display_option === 'TABLE') |
|
837 | 837 | { |
838 | 838 | $label = $display_option; |
839 | 839 | } |
840 | - if($display_option === 'ERROR') |
|
840 | + if ($display_option === 'ERROR') |
|
841 | 841 | { |
842 | 842 | $type = $display_option; |
843 | 843 | } |
844 | 844 | // Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP. |
845 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
845 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
846 | 846 | { |
847 | 847 | $debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php'; |
848 | 848 | $label = NULL; |
@@ -852,52 +852,52 @@ discard block |
||
852 | 852 | } |
853 | 853 | else |
854 | 854 | { |
855 | - if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
855 | + if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) |
|
856 | 856 | { |
857 | 857 | return; |
858 | 858 | } |
859 | 859 | |
860 | 860 | $print = array(); |
861 | - if(!$debug_file) |
|
861 | + if (!$debug_file) |
|
862 | 862 | { |
863 | - $debug_file = _XE_PATH_ . 'files/' . $file; |
|
863 | + $debug_file = _XE_PATH_.'files/'.$file; |
|
864 | 864 | } |
865 | - if(!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
865 | + if (!file_exists($debug_file)) $print[] = '<?php exit() ?>'; |
|
866 | 866 | |
867 | - if($display_option === TRUE || $display_option === 'ERROR') |
|
867 | + if ($display_option === TRUE || $display_option === 'ERROR') |
|
868 | 868 | { |
869 | - $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));; |
|
869 | + $print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ; |
|
870 | 870 | $print[] = str_repeat('=', 80); |
871 | 871 | } |
872 | 872 | $type = gettype($debug_output); |
873 | - if(!in_array($type, array('array', 'object', 'resource'))) |
|
873 | + if (!in_array($type, array('array', 'object', 'resource'))) |
|
874 | 874 | { |
875 | - if($display_option === 'ERROR') |
|
875 | + if ($display_option === 'ERROR') |
|
876 | 876 | { |
877 | - $print[] = 'ERROR : ' . var_export($debug_output, TRUE); |
|
877 | + $print[] = 'ERROR : '.var_export($debug_output, TRUE); |
|
878 | 878 | } |
879 | 879 | else |
880 | 880 | { |
881 | - $print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')'; |
|
881 | + $print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')'; |
|
882 | 882 | } |
883 | 883 | } |
884 | 884 | else |
885 | 885 | { |
886 | - $print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . ' ', print_r($debug_output, true))); |
|
886 | + $print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".' ', print_r($debug_output, true))); |
|
887 | 887 | } |
888 | 888 | $backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
889 | 889 | $backtrace = debug_backtrace($backtrace_args); |
890 | 890 | |
891 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
891 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class']) |
|
892 | 892 | { |
893 | 893 | array_shift($backtrace); |
894 | 894 | } |
895 | - foreach($backtrace as $val) |
|
895 | + foreach ($backtrace as $val) |
|
896 | 896 | { |
897 | - $print[] = ' - ' . $val['file'] . ' : ' . $val['line']; |
|
897 | + $print[] = ' - '.$val['file'].' : '.$val['line']; |
|
898 | 898 | } |
899 | 899 | $print[] = PHP_EOL; |
900 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
900 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | */ |
909 | 909 | function writeSlowlog($type, $elapsed_time, $obj) |
910 | 910 | { |
911 | - if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
911 | + if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return; |
|
912 | 912 | |
913 | 913 | static $log_filename = array( |
914 | 914 | 'query' => 'files/_slowlog_query.php', |
@@ -918,47 +918,47 @@ discard block |
||
918 | 918 | ); |
919 | 919 | $write_file = true; |
920 | 920 | |
921 | - $log_file = _XE_PATH_ . $log_filename[$type]; |
|
921 | + $log_file = _XE_PATH_.$log_filename[$type]; |
|
922 | 922 | |
923 | 923 | $buff = array(); |
924 | 924 | $buff[] = '<?php exit(); ?>'; |
925 | 925 | $buff[] = date('c'); |
926 | 926 | |
927 | - if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
927 | + if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__) |
|
928 | 928 | { |
929 | - $buff[] = "\tCaller : " . $obj->caller; |
|
930 | - $buff[] = "\tCalled : " . $obj->called; |
|
929 | + $buff[] = "\tCaller : ".$obj->caller; |
|
930 | + $buff[] = "\tCalled : ".$obj->called; |
|
931 | 931 | } |
932 | - else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
932 | + else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__) |
|
933 | 933 | { |
934 | - $buff[] = "\tAddon : " . $obj->called; |
|
935 | - $buff[] = "\tCalled position : " . $obj->caller; |
|
934 | + $buff[] = "\tAddon : ".$obj->called; |
|
935 | + $buff[] = "\tCalled position : ".$obj->caller; |
|
936 | 936 | } |
937 | - else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
937 | + else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__) |
|
938 | 938 | { |
939 | - $buff[] = "\tWidget : " . $obj->called; |
|
939 | + $buff[] = "\tWidget : ".$obj->called; |
|
940 | 940 | } |
941 | - else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
941 | + else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__) |
|
942 | 942 | { |
943 | 943 | |
944 | 944 | $buff[] = $obj->query; |
945 | - $buff[] = "\tQuery ID : " . $obj->query_id; |
|
946 | - $buff[] = "\tCaller : " . $obj->caller; |
|
947 | - $buff[] = "\tConnection : " . $obj->connection; |
|
945 | + $buff[] = "\tQuery ID : ".$obj->query_id; |
|
946 | + $buff[] = "\tCaller : ".$obj->caller; |
|
947 | + $buff[] = "\tConnection : ".$obj->connection; |
|
948 | 948 | } |
949 | 949 | else |
950 | 950 | { |
951 | 951 | $write_file = false; |
952 | 952 | } |
953 | 953 | |
954 | - if($write_file) |
|
954 | + if ($write_file) |
|
955 | 955 | { |
956 | 956 | $buff[] = sprintf("\t%0.6f sec", $elapsed_time); |
957 | - $buff[] = PHP_EOL . PHP_EOL; |
|
957 | + $buff[] = PHP_EOL.PHP_EOL; |
|
958 | 958 | file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND); |
959 | 959 | } |
960 | 960 | |
961 | - if($type != 'query') |
|
961 | + if ($type != 'query') |
|
962 | 962 | { |
963 | 963 | $trigger_args = $obj; |
964 | 964 | $trigger_args->_log_type = $type; |
@@ -998,11 +998,11 @@ discard block |
||
998 | 998 | */ |
999 | 999 | function delObjectVars($target_obj, $del_obj) |
1000 | 1000 | { |
1001 | - if(!is_object($target_obj)) |
|
1001 | + if (!is_object($target_obj)) |
|
1002 | 1002 | { |
1003 | 1003 | return; |
1004 | 1004 | } |
1005 | - if(!is_object($del_obj)) |
|
1005 | + if (!is_object($del_obj)) |
|
1006 | 1006 | { |
1007 | 1007 | return; |
1008 | 1008 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | |
1013 | 1013 | $target = array_keys($target_vars); |
1014 | 1014 | $del = array_keys($del_vars); |
1015 | - if(!count($target) || !count($del)) |
|
1015 | + if (!count($target) || !count($del)) |
|
1016 | 1016 | { |
1017 | 1017 | return $target_obj; |
1018 | 1018 | } |
@@ -1020,10 +1020,10 @@ discard block |
||
1020 | 1020 | $return_obj = new stdClass(); |
1021 | 1021 | |
1022 | 1022 | $target_count = count($target); |
1023 | - for($i = 0; $i < $target_count; $i++) |
|
1023 | + for ($i = 0; $i < $target_count; $i++) |
|
1024 | 1024 | { |
1025 | 1025 | $target_key = $target[$i]; |
1026 | - if(!in_array($target_key, $del)) |
|
1026 | + if (!in_array($target_key, $del)) |
|
1027 | 1027 | { |
1028 | 1028 | $return_obj->{$target_key} = $target_obj->{$target_key}; |
1029 | 1029 | } |
@@ -1036,10 +1036,10 @@ discard block |
||
1036 | 1036 | { |
1037 | 1037 | $del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id'); |
1038 | 1038 | |
1039 | - foreach($del_vars as $var) |
|
1039 | + foreach ($del_vars as $var) |
|
1040 | 1040 | { |
1041 | - if(is_array($vars)) unset($vars[$var]); |
|
1042 | - else if(is_object($vars)) unset($vars->$var); |
|
1041 | + if (is_array($vars)) unset($vars[$var]); |
|
1042 | + else if (is_object($vars)) unset($vars->$var); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | return $vars; |
@@ -1056,12 +1056,12 @@ discard block |
||
1056 | 1056 | */ |
1057 | 1057 | function handleError($errno, $errstr, $file, $line) |
1058 | 1058 | { |
1059 | - if(!__DEBUG__) |
|
1059 | + if (!__DEBUG__) |
|
1060 | 1060 | { |
1061 | 1061 | return; |
1062 | 1062 | } |
1063 | 1063 | $errors = array(E_USER_ERROR, E_ERROR, E_PARSE); |
1064 | - if(!in_array($errno, $errors)) |
|
1064 | + if (!in_array($errno, $errors)) |
|
1065 | 1065 | { |
1066 | 1066 | return; |
1067 | 1067 | } |
@@ -1081,8 +1081,8 @@ discard block |
||
1081 | 1081 | function getNumberingPath($no, $size = 3) |
1082 | 1082 | { |
1083 | 1083 | $mod = pow(10, $size); |
1084 | - $output = sprintf('%0' . $size . 'd/', $no % $mod); |
|
1085 | - if($no >= $mod) |
|
1084 | + $output = sprintf('%0'.$size.'d/', $no % $mod); |
|
1085 | + if ($no >= $mod) |
|
1086 | 1086 | { |
1087 | 1087 | $output .= getNumberingPath((int) $no / $mod, $size); |
1088 | 1088 | } |
@@ -1102,13 +1102,13 @@ discard block |
||
1102 | 1102 | |
1103 | 1103 | function purifierHtml(&$content) |
1104 | 1104 | { |
1105 | - require_once(_XE_PATH_ . 'classes/security/Purifier.class.php'); |
|
1105 | + require_once(_XE_PATH_.'classes/security/Purifier.class.php'); |
|
1106 | 1106 | $oPurifier = Purifier::getInstance(); |
1107 | 1107 | |
1108 | 1108 | // @see https://github.com/xpressengine/xe-core/issues/2278 |
1109 | 1109 | $logged_info = Context::get('logged_info'); |
1110 | 1110 | $db_info = Context::getDBInfo(); |
1111 | - if($logged_info->is_admin !== 'Y' && $db_info->use_nofollow !== 'N') |
|
1111 | + if ($logged_info->is_admin !== 'Y' && $db_info->use_nofollow !== 'N') |
|
1112 | 1112 | { |
1113 | 1113 | $oPurifier->setConfig('HTML.Nofollow', true); |
1114 | 1114 | } |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | */ |
1125 | 1125 | function removeHackTag($content) |
1126 | 1126 | { |
1127 | - require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php'); |
|
1127 | + require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php'); |
|
1128 | 1128 | $oEmbedFilter = EmbedFilter::getInstance(); |
1129 | 1129 | $oEmbedFilter->check($content); |
1130 | 1130 | |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | */ |
1167 | 1167 | function checkUploadedFile($file) |
1168 | 1168 | { |
1169 | - require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php'); |
|
1169 | + require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php'); |
|
1170 | 1170 | return UploadFileFilter::check($file); |
1171 | 1171 | } |
1172 | 1172 | |
@@ -1180,13 +1180,13 @@ discard block |
||
1180 | 1180 | { |
1181 | 1181 | $content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content); |
1182 | 1182 | |
1183 | - if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1183 | + if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE) |
|
1184 | 1184 | { |
1185 | - if(($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1185 | + if (($close_xmp = strrpos($content, '</xmp>')) === FALSE) |
|
1186 | 1186 | { |
1187 | 1187 | $content .= '</xmp>'; |
1188 | 1188 | } |
1189 | - else if($close_xmp < $start_xmp) |
|
1189 | + else if ($close_xmp < $start_xmp) |
|
1190 | 1190 | { |
1191 | 1191 | $content .= '</xmp>'; |
1192 | 1192 | } |
@@ -1206,33 +1206,33 @@ discard block |
||
1206 | 1206 | $tag = strtolower($match[2]); |
1207 | 1207 | |
1208 | 1208 | // xmp tag ?뺣━ |
1209 | - if($tag == 'xmp') |
|
1209 | + if ($tag == 'xmp') |
|
1210 | 1210 | { |
1211 | 1211 | return "<{$match[1]}xmp>"; |
1212 | 1212 | } |
1213 | - if($match[1]) |
|
1213 | + if ($match[1]) |
|
1214 | 1214 | { |
1215 | 1215 | return $match[0]; |
1216 | 1216 | } |
1217 | - if($match[4]) |
|
1217 | + if ($match[4]) |
|
1218 | 1218 | { |
1219 | - $match[4] = ' ' . $match[4]; |
|
1219 | + $match[4] = ' '.$match[4]; |
|
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | $attrs = array(); |
1223 | - if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1223 | + if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m)) |
|
1224 | 1224 | { |
1225 | - foreach($m[1] as $idx => $name) |
|
1225 | + foreach ($m[1] as $idx => $name) |
|
1226 | 1226 | { |
1227 | - if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1227 | + if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0) |
|
1228 | 1228 | { |
1229 | 1229 | continue; |
1230 | 1230 | } |
1231 | 1231 | |
1232 | - $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]); |
|
1232 | + $val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]); |
|
1233 | 1233 | $val = preg_replace('/^\s+|[\t\n\r]+/', '', $val); |
1234 | 1234 | |
1235 | - if(preg_match('/^[a-z]+script:/i', $val)) |
|
1235 | + if (preg_match('/^[a-z]+script:/i', $val)) |
|
1236 | 1236 | { |
1237 | 1237 | continue; |
1238 | 1238 | } |
@@ -1243,60 +1243,60 @@ discard block |
||
1243 | 1243 | |
1244 | 1244 | $filter_arrts = array('style', 'src', 'href'); |
1245 | 1245 | |
1246 | - if($tag === 'object') array_push($filter_arrts, 'data'); |
|
1247 | - if($tag === 'param') array_push($filter_arrts, 'value'); |
|
1246 | + if ($tag === 'object') array_push($filter_arrts, 'data'); |
|
1247 | + if ($tag === 'param') array_push($filter_arrts, 'value'); |
|
1248 | 1248 | |
1249 | - foreach($filter_arrts as $attr) |
|
1249 | + foreach ($filter_arrts as $attr) |
|
1250 | 1250 | { |
1251 | - if(!isset($attrs[$attr])) continue; |
|
1251 | + if (!isset($attrs[$attr])) continue; |
|
1252 | 1252 | |
1253 | 1253 | $attr_value = rawurldecode($attrs[$attr]); |
1254 | 1254 | $attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT); |
1255 | 1255 | $attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value); |
1256 | - if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1256 | + if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload') |
|
1257 | 1257 | { |
1258 | 1258 | unset($attrs[$attr]); |
1259 | 1259 | } |
1260 | 1260 | } |
1261 | 1261 | |
1262 | - if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1262 | + if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style'])) |
|
1263 | 1263 | { |
1264 | 1264 | unset($attrs['style']); |
1265 | 1265 | } |
1266 | 1266 | |
1267 | 1267 | $attr = array(); |
1268 | - foreach($attrs as $name => $val) |
|
1268 | + foreach ($attrs as $name => $val) |
|
1269 | 1269 | { |
1270 | - if($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1270 | + if ($tag == 'object' || $tag == 'embed' || $tag == 'a') |
|
1271 | 1271 | { |
1272 | 1272 | $attribute = strtolower(trim($name)); |
1273 | - if($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1273 | + if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href') |
|
1274 | 1274 | { |
1275 | - if(stripos($val, 'data:') === 0) |
|
1275 | + if (stripos($val, 'data:') === 0) |
|
1276 | 1276 | { |
1277 | 1277 | continue; |
1278 | 1278 | } |
1279 | 1279 | } |
1280 | 1280 | } |
1281 | 1281 | |
1282 | - if($tag == 'img') |
|
1282 | + if ($tag == 'img') |
|
1283 | 1283 | { |
1284 | 1284 | $attribute = strtolower(trim($name)); |
1285 | - if(stripos($val, 'data:') === 0) |
|
1285 | + if (stripos($val, 'data:') === 0) |
|
1286 | 1286 | { |
1287 | 1287 | continue; |
1288 | 1288 | } |
1289 | 1289 | } |
1290 | 1290 | $val = str_replace('"', '"', $val); |
1291 | - $attr[] = $name . "=\"{$val}\""; |
|
1291 | + $attr[] = $name."=\"{$val}\""; |
|
1292 | 1292 | } |
1293 | - $attr = count($attr) ? ' ' . implode(' ', $attr) : ''; |
|
1293 | + $attr = count($attr) ? ' '.implode(' ', $attr) : ''; |
|
1294 | 1294 | |
1295 | 1295 | return "<{$match[1]}{$tag}{$attr}{$match[4]}>"; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | // convert hexa value to RGB |
1299 | -if(!function_exists('hexrgb')) |
|
1299 | +if (!function_exists('hexrgb')) |
|
1300 | 1300 | { |
1301 | 1301 | |
1302 | 1302 | /** |
@@ -1332,9 +1332,9 @@ discard block |
||
1332 | 1332 | |
1333 | 1333 | settype($password, "string"); |
1334 | 1334 | |
1335 | - for($i = 0; $i < strlen($password); $i++) |
|
1335 | + for ($i = 0; $i < strlen($password); $i++) |
|
1336 | 1336 | { |
1337 | - if($password[$i] == ' ' || $password[$i] == '\t') |
|
1337 | + if ($password[$i] == ' ' || $password[$i] == '\t') |
|
1338 | 1338 | { |
1339 | 1339 | continue; |
1340 | 1340 | } |
@@ -1346,11 +1346,11 @@ discard block |
||
1346 | 1346 | $result1 = sprintf("%08lx", $nr & ((1 << 31) - 1)); |
1347 | 1347 | $result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1)); |
1348 | 1348 | |
1349 | - if($result1 == '80000000') |
|
1349 | + if ($result1 == '80000000') |
|
1350 | 1350 | { |
1351 | 1351 | $nr += 0x80000000; |
1352 | 1352 | } |
1353 | - if($result2 == '80000000') |
|
1353 | + if ($result2 == '80000000') |
|
1354 | 1354 | { |
1355 | 1355 | $nr2 += 0x80000000; |
1356 | 1356 | } |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | function getScriptPath() |
1367 | 1367 | { |
1368 | 1368 | static $url = NULL; |
1369 | - if($url == NULL) |
|
1369 | + if ($url == NULL) |
|
1370 | 1370 | { |
1371 | 1371 | $script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING); |
1372 | 1372 | $url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path))); |
@@ -1397,14 +1397,14 @@ discard block |
||
1397 | 1397 | $decodedStr = ''; |
1398 | 1398 | $pos = 0; |
1399 | 1399 | $len = strlen($source); |
1400 | - while($pos < $len) |
|
1400 | + while ($pos < $len) |
|
1401 | 1401 | { |
1402 | 1402 | $charAt = substr($source, $pos, 1); |
1403 | - if($charAt == '%') |
|
1403 | + if ($charAt == '%') |
|
1404 | 1404 | { |
1405 | 1405 | $pos++; |
1406 | 1406 | $charAt = substr($source, $pos, 1); |
1407 | - if($charAt == 'u') |
|
1407 | + if ($charAt == 'u') |
|
1408 | 1408 | { |
1409 | 1409 | // we got a unicode character |
1410 | 1410 | $pos++; |
@@ -1438,21 +1438,21 @@ discard block |
||
1438 | 1438 | */ |
1439 | 1439 | function _code2utf($num) |
1440 | 1440 | { |
1441 | - if($num < 128) |
|
1441 | + if ($num < 128) |
|
1442 | 1442 | { |
1443 | 1443 | return chr($num); |
1444 | 1444 | } |
1445 | - if($num < 2048) |
|
1445 | + if ($num < 2048) |
|
1446 | 1446 | { |
1447 | - return chr(($num >> 6) + 192) . chr(($num & 63) + 128); |
|
1447 | + return chr(($num >> 6) + 192).chr(($num & 63) + 128); |
|
1448 | 1448 | } |
1449 | - if($num < 65536) |
|
1449 | + if ($num < 65536) |
|
1450 | 1450 | { |
1451 | - return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1451 | + return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1452 | 1452 | } |
1453 | - if($num < 2097152) |
|
1453 | + if ($num < 2097152) |
|
1454 | 1454 | { |
1455 | - return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); |
|
1455 | + return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128); |
|
1456 | 1456 | } |
1457 | 1457 | return ''; |
1458 | 1458 | } |
@@ -1467,7 +1467,7 @@ discard block |
||
1467 | 1467 | */ |
1468 | 1468 | function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE) |
1469 | 1469 | { |
1470 | - if($urldecode) |
|
1470 | + if ($urldecode) |
|
1471 | 1471 | { |
1472 | 1472 | $string = urldecode($string); |
1473 | 1473 | } |
@@ -1475,12 +1475,12 @@ discard block |
||
1475 | 1475 | $sample = iconv('utf-8', 'utf-8', $string); |
1476 | 1476 | $is_utf8 = (md5($sample) === md5($string)); |
1477 | 1477 | |
1478 | - if(!$urldecode) |
|
1478 | + if (!$urldecode) |
|
1479 | 1479 | { |
1480 | 1480 | $string = urldecode($string); |
1481 | 1481 | } |
1482 | 1482 | |
1483 | - if($return_convert) |
|
1483 | + if ($return_convert) |
|
1484 | 1484 | { |
1485 | 1485 | return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string); |
1486 | 1486 | } |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | */ |
1497 | 1497 | function json_encode2($data) |
1498 | 1498 | { |
1499 | - switch(gettype($data)) |
|
1499 | + switch (gettype($data)) |
|
1500 | 1500 | { |
1501 | 1501 | case 'boolean': |
1502 | 1502 | return $data ? 'true' : 'false'; |
@@ -1504,15 +1504,15 @@ discard block |
||
1504 | 1504 | case 'double': |
1505 | 1505 | return $data; |
1506 | 1506 | case 'string': |
1507 | - return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"'; |
|
1507 | + return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"'; |
|
1508 | 1508 | case 'object': |
1509 | 1509 | $data = get_object_vars($data); |
1510 | 1510 | case 'array': |
1511 | 1511 | $rel = FALSE; // relative array? |
1512 | 1512 | $key = array_keys($data); |
1513 | - foreach($key as $v) |
|
1513 | + foreach ($key as $v) |
|
1514 | 1514 | { |
1515 | - if(!is_int($v)) |
|
1515 | + if (!is_int($v)) |
|
1516 | 1516 | { |
1517 | 1517 | $rel = TRUE; |
1518 | 1518 | break; |
@@ -1520,12 +1520,12 @@ discard block |
||
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | $arr = array(); |
1523 | - foreach($data as $k => $v) |
|
1523 | + foreach ($data as $k => $v) |
|
1524 | 1524 | { |
1525 | - $arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v); |
|
1525 | + $arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v); |
|
1526 | 1526 | } |
1527 | 1527 | |
1528 | - return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']'; |
|
1528 | + return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']'; |
|
1529 | 1529 | default: |
1530 | 1530 | return '""'; |
1531 | 1531 | } |
@@ -1539,7 +1539,7 @@ discard block |
||
1539 | 1539 | */ |
1540 | 1540 | function isCrawler($agent = NULL) |
1541 | 1541 | { |
1542 | - if(!$agent) |
|
1542 | + if (!$agent) |
|
1543 | 1543 | { |
1544 | 1544 | $agent = $_SERVER['HTTP_USER_AGENT']; |
1545 | 1545 | } |
@@ -1549,9 +1549,9 @@ discard block |
||
1549 | 1549 | /*'211.245.21.110-211.245.21.119' mixsh is closed */ |
1550 | 1550 | ); |
1551 | 1551 | |
1552 | - foreach($check_agent as $str) |
|
1552 | + foreach ($check_agent as $str) |
|
1553 | 1553 | { |
1554 | - if(stristr($agent, $str) != FALSE) |
|
1554 | + if (stristr($agent, $str) != FALSE) |
|
1555 | 1555 | { |
1556 | 1556 | return TRUE; |
1557 | 1557 | } |
@@ -1569,7 +1569,7 @@ discard block |
||
1569 | 1569 | */ |
1570 | 1570 | function stripEmbedTagForAdmin(&$content, $writer_member_srl) |
1571 | 1571 | { |
1572 | - if(!Context::get('is_logged')) |
|
1572 | + if (!Context::get('is_logged')) |
|
1573 | 1573 | { |
1574 | 1574 | return; |
1575 | 1575 | } |
@@ -1577,18 +1577,18 @@ discard block |
||
1577 | 1577 | $oModuleModel = getModel('module'); |
1578 | 1578 | $logged_info = Context::get('logged_info'); |
1579 | 1579 | |
1580 | - if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1580 | + if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info))) |
|
1581 | 1581 | { |
1582 | - if($writer_member_srl) |
|
1582 | + if ($writer_member_srl) |
|
1583 | 1583 | { |
1584 | 1584 | $oMemberModel = getModel('member'); |
1585 | 1585 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl); |
1586 | - if($member_info->is_admin == "Y") |
|
1586 | + if ($member_info->is_admin == "Y") |
|
1587 | 1587 | { |
1588 | 1588 | return; |
1589 | 1589 | } |
1590 | 1590 | } |
1591 | - $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>"; |
|
1591 | + $security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>"; |
|
1592 | 1592 | $content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content); |
1593 | 1593 | $content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content); |
1594 | 1594 | $content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content); |
@@ -1605,18 +1605,18 @@ discard block |
||
1605 | 1605 | function requirePear() |
1606 | 1606 | { |
1607 | 1607 | static $required = false; |
1608 | - if($required) |
|
1608 | + if ($required) |
|
1609 | 1609 | { |
1610 | 1610 | return; |
1611 | 1611 | } |
1612 | 1612 | |
1613 | - if(version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1613 | + if (version_compare(PHP_VERSION, "5.3.0") < 0) |
|
1614 | 1614 | { |
1615 | - set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path()); |
|
1615 | + set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path()); |
|
1616 | 1616 | } |
1617 | 1617 | else |
1618 | 1618 | { |
1619 | - set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path()); |
|
1619 | + set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path()); |
|
1620 | 1620 | } |
1621 | 1621 | |
1622 | 1622 | $required = true; |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | |
1625 | 1625 | function checkCSRF() |
1626 | 1626 | { |
1627 | - if($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1627 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
1628 | 1628 | { |
1629 | 1629 | return FALSE; |
1630 | 1630 | } |
@@ -1632,9 +1632,9 @@ discard block |
||
1632 | 1632 | $default_url = Context::getDefaultUrl(); |
1633 | 1633 | $referer = $_SERVER["HTTP_REFERER"]; |
1634 | 1634 | |
1635 | - if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1635 | + if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE) |
|
1636 | 1636 | { |
1637 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
1637 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
1638 | 1638 | $IDN = new idna_convert(array('idn_version' => 2008)); |
1639 | 1639 | $referer = $IDN->encode($referer); |
1640 | 1640 | } |
@@ -1645,9 +1645,9 @@ discard block |
||
1645 | 1645 | $oModuleModel = getModel('module'); |
1646 | 1646 | $siteModuleInfo = $oModuleModel->getDefaultMid(); |
1647 | 1647 | |
1648 | - if($siteModuleInfo->site_srl == 0) |
|
1648 | + if ($siteModuleInfo->site_srl == 0) |
|
1649 | 1649 | { |
1650 | - if($default_url['host'] !== $referer['host']) |
|
1650 | + if ($default_url['host'] !== $referer['host']) |
|
1651 | 1651 | { |
1652 | 1652 | return FALSE; |
1653 | 1653 | } |
@@ -1655,7 +1655,7 @@ discard block |
||
1655 | 1655 | else |
1656 | 1656 | { |
1657 | 1657 | $virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl); |
1658 | - if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1658 | + if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host']))) |
|
1659 | 1659 | { |
1660 | 1660 | return FALSE; |
1661 | 1661 | } |
@@ -1671,15 +1671,15 @@ discard block |
||
1671 | 1671 | */ |
1672 | 1672 | function recurciveExposureCheck(&$menu) |
1673 | 1673 | { |
1674 | - if(is_array($menu)) |
|
1674 | + if (is_array($menu)) |
|
1675 | 1675 | { |
1676 | - foreach($menu AS $key=>$value) |
|
1676 | + foreach ($menu AS $key=>$value) |
|
1677 | 1677 | { |
1678 | - if(!$value['isShow']) |
|
1678 | + if (!$value['isShow']) |
|
1679 | 1679 | { |
1680 | 1680 | unset($menu[$key]); |
1681 | 1681 | } |
1682 | - if(is_array($value['list']) && count($value['list']) > 0) |
|
1682 | + if (is_array($value['list']) && count($value['list']) > 0) |
|
1683 | 1683 | { |
1684 | 1684 | recurciveExposureCheck($menu[$key]['list']); |
1685 | 1685 | } |
@@ -1689,14 +1689,14 @@ discard block |
||
1689 | 1689 | |
1690 | 1690 | function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url') |
1691 | 1691 | { |
1692 | - if($requestKey != $dbKey) |
|
1692 | + if ($requestKey != $dbKey) |
|
1693 | 1693 | { |
1694 | 1694 | $arrayUrl = parse_url(Context::get('success_return_url')); |
1695 | - if($arrayUrl['query']) |
|
1695 | + if ($arrayUrl['query']) |
|
1696 | 1696 | { |
1697 | 1697 | parse_str($arrayUrl['query'], $parsedStr); |
1698 | 1698 | |
1699 | - if(isset($parsedStr[$key])) |
|
1699 | + if (isset($parsedStr[$key])) |
|
1700 | 1700 | { |
1701 | 1701 | $parsedStr[$key] = $requestKey; |
1702 | 1702 | $successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr); |
@@ -1739,14 +1739,14 @@ discard block |
||
1739 | 1739 | */ |
1740 | 1740 | function alertScript($msg) |
1741 | 1741 | { |
1742 | - if(!$msg) |
|
1742 | + if (!$msg) |
|
1743 | 1743 | { |
1744 | 1744 | return; |
1745 | 1745 | } |
1746 | 1746 | |
1747 | 1747 | echo '<script type="text/javascript"> |
1748 | 1748 | //<![CDATA[ |
1749 | -alert("' . $msg . '"); |
|
1749 | +alert("' . $msg.'"); |
|
1750 | 1750 | //]]> |
1751 | 1751 | </script>'; |
1752 | 1752 | } |
@@ -1777,7 +1777,7 @@ discard block |
||
1777 | 1777 | |
1778 | 1778 | echo '<script type="text/javascript"> |
1779 | 1779 | //<![CDATA[ |
1780 | -' . $reloadScript . ' |
|
1780 | +' . $reloadScript.' |
|
1781 | 1781 | //]]> |
1782 | 1782 | </script>'; |
1783 | 1783 | } |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | */ |
1801 | 1801 | function escape($str, $double_escape = true, $escape_defined_lang_code = false) |
1802 | 1802 | { |
1803 | - if(!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1803 | + if (!$escape_defined_lang_code && isDefinedLangCode($str)) return $str; |
|
1804 | 1804 | |
1805 | 1805 | $flags = ENT_QUOTES | ENT_SUBSTITUTE; |
1806 | 1806 | return htmlspecialchars($str, $flags, 'UTF-8', $double_escape); |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | function escape_js($str) |
1833 | 1833 | { |
1834 | 1834 | $flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE; |
1835 | - $str = json_encode((string)$str, $flags); |
|
1835 | + $str = json_encode((string) $str, $flags); |
|
1836 | 1836 | return substr($str, 1, strlen($str) - 2); |
1837 | 1837 | } |
1838 | 1838 | |
@@ -1884,12 +1884,12 @@ discard block |
||
1884 | 1884 | { |
1885 | 1885 | if ($limit < 1) $limit = null; |
1886 | 1886 | $result = array(); |
1887 | - $split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit); |
|
1887 | + $split = preg_split('/(?<!'.preg_quote($escape_char, '/').')'.preg_quote($delimiter, '/').'/', $str, $limit); |
|
1888 | 1888 | foreach ($split as $piece) |
1889 | 1889 | { |
1890 | 1890 | if (trim($piece) !== '') |
1891 | 1891 | { |
1892 | - $result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece)); |
|
1892 | + $result[] = trim(str_replace($escape_char.$delimiter, $delimiter, $piece)); |
|
1893 | 1893 | } |
1894 | 1894 | } |
1895 | 1895 | return $result; |