@@ -294,6 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | /** |
296 | 296 | * @brief Supported languages (was procInstallAdminSaveLangSelected) |
297 | + * @param string $selected_lang |
|
297 | 298 | */ |
298 | 299 | function saveLangSelected($selected_lang) |
299 | 300 | { |
@@ -311,6 +312,10 @@ discard block |
||
311 | 312 | } |
312 | 313 | |
313 | 314 | /* 썸내일 보여주기 방식 변경.*/ |
315 | + |
|
316 | + /** |
|
317 | + * @param stdClass $config |
|
318 | + */ |
|
314 | 319 | function setModulesConfig($config) |
315 | 320 | { |
316 | 321 | $args = new stdClass(); |
@@ -331,6 +336,10 @@ discard block |
||
331 | 336 | return $output; |
332 | 337 | } |
333 | 338 | |
339 | + /** |
|
340 | + * @param string $icon |
|
341 | + * @param string $iconname |
|
342 | + */ |
|
334 | 343 | private function saveIconTmp($icon, $iconname) |
335 | 344 | { |
336 | 345 | |
@@ -377,6 +386,9 @@ discard block |
||
377 | 386 | return $relative_filename; |
378 | 387 | } |
379 | 388 | |
389 | + /** |
|
390 | + * @param string $iconname |
|
391 | + */ |
|
380 | 392 | private function updateIcon($iconname, $deleteIcon = false) { |
381 | 393 | |
382 | 394 | $site_info = Context::get('site_module_info'); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class installAdminController |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief admin controller class of the install module |
|
7 | - */ |
|
4 | + * @class installAdminController |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief admin controller class of the install module |
|
7 | + */ |
|
8 | 8 | class installAdminController extends install |
9 | 9 | { |
10 | 10 | /** |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | function procInstallAdminInstall() |
21 | 21 | { |
22 | 22 | $module_name = Context::get('module_name'); |
23 | - if(!$module_name) return new object(-1, 'invalid_request'); |
|
23 | + if (!$module_name) return new object(-1, 'invalid_request'); |
|
24 | 24 | |
25 | 25 | $oInstallController = getController('install'); |
26 | - $oInstallController->installModule($module_name, './modules/'.$module_name); |
|
26 | + $oInstallController->installModule($module_name, './modules/' . $module_name); |
|
27 | 27 | |
28 | 28 | $this->setMessage('success_installed'); |
29 | 29 | } |
@@ -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 object(-1, 'invalid_request'); |
|
38 | + if (!$module_name) return new object(-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 Object(-1, 'invalid_request'); |
43 | 43 | |
44 | 44 | return $output; |
@@ -53,25 +53,25 @@ 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 | 64 | $admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR']; |
65 | - $admin_ip_list = explode(',',trim($admin_ip_list, ',')); |
|
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 Object(-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 | 77 | require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
@@ -79,25 +79,25 @@ discard block |
||
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 | $http_port = Context::get('http_port'); |
85 | 85 | $https_port = Context::get('https_port'); |
86 | 86 | |
87 | 87 | $use_rewrite = Context::get('use_rewrite'); |
88 | - if($use_rewrite!='Y') $use_rewrite = 'N'; |
|
88 | + if ($use_rewrite != 'Y') $use_rewrite = 'N'; |
|
89 | 89 | |
90 | 90 | $use_sso = Context::get('use_sso'); |
91 | - if($use_sso !='Y') $use_sso = 'N'; |
|
91 | + if ($use_sso != 'Y') $use_sso = 'N'; |
|
92 | 92 | |
93 | 93 | $use_db_session = Context::get('use_db_session'); |
94 | - if($use_db_session!='Y') $use_db_session = 'N'; |
|
94 | + if ($use_db_session != 'Y') $use_db_session = 'N'; |
|
95 | 95 | |
96 | 96 | $qmail_compatibility = Context::get('qmail_compatibility'); |
97 | - if($qmail_compatibility!='Y') $qmail_compatibility = 'N'; |
|
97 | + if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N'; |
|
98 | 98 | |
99 | 99 | $use_html5 = Context::get('use_html5'); |
100 | - if(!$use_html5) $use_html5 = 'N'; |
|
100 | + if (!$use_html5) $use_html5 = 'N'; |
|
101 | 101 | |
102 | 102 | $db_info->default_url = $default_url; |
103 | 103 | $db_info->qmail_compatibility = $qmail_compatibility; |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | $db_info->use_html5 = $use_html5; |
109 | 109 | $db_info->admin_ip_list = $admin_ip_list; |
110 | 110 | |
111 | - if($http_port) $db_info->http_port = (int) $http_port; |
|
112 | - else if($db_info->http_port) unset($db_info->http_port); |
|
111 | + if ($http_port) $db_info->http_port = (int) $http_port; |
|
112 | + else if ($db_info->http_port) unset($db_info->http_port); |
|
113 | 113 | |
114 | - if($https_port) $db_info->https_port = (int) $https_port; |
|
115 | - else if($db_info->https_port) unset($db_info->https_port); |
|
114 | + if ($https_port) $db_info->https_port = (int) $https_port; |
|
115 | + else if ($db_info->https_port) unset($db_info->https_port); |
|
116 | 116 | |
117 | 117 | unset($db_info->lang_type); |
118 | 118 | |
119 | 119 | $oInstallController = getController('install'); |
120 | - if(!$oInstallController->makeConfigFile()) |
|
120 | + if (!$oInstallController->makeConfigFile()) |
|
121 | 121 | { |
122 | 122 | return new Object(-1, 'msg_invalid_request'); |
123 | 123 | } |
124 | 124 | else |
125 | 125 | { |
126 | 126 | Context::setDBInfo($db_info); |
127 | - if($default_url) |
|
127 | + if ($default_url) |
|
128 | 128 | { |
129 | 129 | $site_args = new stdClass; |
130 | 130 | $site_args->site_srl = 0; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | function procInstallAdminUpdateIndexModule() |
140 | 140 | { |
141 | - if(!Context::get('index_module_srl') || !Context::get('menu_item_srl')) |
|
141 | + if (!Context::get('index_module_srl') || !Context::get('menu_item_srl')) |
|
142 | 142 | { |
143 | 143 | return new Object(-1, 'msg_invalid_request'); |
144 | 144 | } |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | // update homeSitemap.php cache file |
158 | 158 | $oMenuAdminController = getAdminController('menu'); |
159 | 159 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
160 | - if(file_exists($homeMenuCacheFile)) |
|
160 | + if (file_exists($homeMenuCacheFile)) |
|
161 | 161 | { |
162 | 162 | include($homeMenuCacheFile); |
163 | 163 | } |
164 | 164 | |
165 | - if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl) |
|
165 | + if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl) |
|
166 | 166 | { |
167 | 167 | $oMenuAdminController->makeHomemenuCacheFile($output->menu_srl); |
168 | 168 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | function procInstallAdminRemoveFTPInfo() |
174 | 174 | { |
175 | 175 | $ftp_config_file = Context::getFTPConfigFile(); |
176 | - if(file_exists($ftp_config_file)) unlink($ftp_config_file); |
|
177 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
176 | + if (file_exists($ftp_config_file)) unlink($ftp_config_file); |
|
177 | + if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
178 | 178 | $this->setMessage('success_deleted'); |
179 | 179 | } |
180 | 180 | |
@@ -185,38 +185,38 @@ discard block |
||
185 | 185 | $ftp_info->ftp_port = Context::get('ftp_port'); |
186 | 186 | $ftp_info->ftp_host = Context::get('ftp_host'); |
187 | 187 | $ftp_info->ftp_pasv = Context::get('ftp_pasv'); |
188 | - if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N"; |
|
188 | + if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N"; |
|
189 | 189 | $ftp_info->sftp = Context::get('sftp'); |
190 | 190 | |
191 | 191 | $ftp_root_path = Context::get('ftp_root_path'); |
192 | - if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/") |
|
192 | + if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/") |
|
193 | 193 | { |
194 | 194 | $ftp_info->ftp_root_path = $ftp_root_path; |
195 | 195 | } |
196 | 196 | else |
197 | 197 | { |
198 | - $ftp_info->ftp_root_path = $ftp_root_path.'/'; |
|
198 | + $ftp_info->ftp_root_path = $ftp_root_path . '/'; |
|
199 | 199 | } |
200 | 200 | |
201 | - if(ini_get('safe_mode')) |
|
201 | + if (ini_get('safe_mode')) |
|
202 | 202 | { |
203 | 203 | $ftp_info->ftp_password = Context::get('ftp_password'); |
204 | 204 | } |
205 | 205 | |
206 | - $buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n"; |
|
207 | - foreach($ftp_info as $key => $val) |
|
206 | + $buff = '<?php if(!defined("__XE__")) exit();' . "\n\$ftp_info = new stdClass;\n"; |
|
207 | + foreach ($ftp_info as $key => $val) |
|
208 | 208 | { |
209 | - if(!$val) continue; |
|
210 | - 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))) |
|
209 | + if (!$val) continue; |
|
210 | + 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))) |
|
211 | 211 | { |
212 | 212 | continue; |
213 | 213 | } |
214 | - $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
214 | + $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
215 | 215 | } |
216 | 216 | $buff .= "?>"; |
217 | 217 | $config_file = Context::getFTPConfigFile(); |
218 | 218 | FileHandler::WriteFile($config_file, $buff); |
219 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
219 | + if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
220 | 220 | |
221 | 221 | $this->setMessage('success_updated'); |
222 | 222 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | function procInstallAdminConfig() |
227 | 227 | { |
228 | 228 | $use_mobile_view = Context::get('use_mobile_view'); |
229 | - if($use_mobile_view!='Y') $use_mobile_view = 'N'; |
|
229 | + if ($use_mobile_view != 'Y') $use_mobile_view = 'N'; |
|
230 | 230 | |
231 | 231 | $time_zone = Context::get('time_zone'); |
232 | 232 | |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | unset($db_info->lang_type); |
238 | 238 | Context::setDBInfo($db_info); |
239 | 239 | $oInstallController = getController('install'); |
240 | - if(!$oInstallController->makeConfigFile()) |
|
240 | + if (!$oInstallController->makeConfigFile()) |
|
241 | 241 | { |
242 | 242 | return new Object(-1, 'msg_invalid_request'); |
243 | 243 | } |
244 | 244 | |
245 | 245 | $site_args = new stdClass(); |
246 | 246 | $site_args->site_srl = 0; |
247 | - $site_args->index_module_srl = Context::get('index_module_srl');// |
|
248 | - $site_args->default_language = Context::get('change_lang_type');// |
|
247 | + $site_args->index_module_srl = Context::get('index_module_srl'); // |
|
248 | + $site_args->default_language = Context::get('change_lang_type'); // |
|
249 | 249 | $oModuleController = getController('module'); |
250 | 250 | $oModuleController->updateSite($site_args); |
251 | 251 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | $deleteFavicon = Context::get('is_delete_favicon'); |
258 | 258 | $deleteMobicon = Context::get('is_delete_mobicon'); |
259 | 259 | |
260 | - $this->updateIcon('favicon.ico',$deleteFavicon); |
|
261 | - $this->updateIcon('mobicon.png',$deleteMobicon); |
|
260 | + $this->updateIcon('favicon.ico', $deleteFavicon); |
|
261 | + $this->updateIcon('mobicon.png', $deleteMobicon); |
|
262 | 262 | |
263 | 263 | //모듈 설정 저장(썸네일, 풋터스크립트) |
264 | 264 | $config = new stdClass(); |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | public function procInstallAdminConfigIconUpload() { |
274 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
274 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
275 | 275 | $this->setTemplateFile("after_upload_config_image.html"); |
276 | 276 | |
277 | 277 | $favicon = Context::get('favicon'); |
278 | 278 | $mobicon = Context::get('mobicon'); |
279 | - if(!$favicon && !$mobicon) { |
|
279 | + if (!$favicon && !$mobicon) { |
|
280 | 280 | Context::set('msg', Context::getLang("msg_invalid_format")); |
281 | 281 | return; |
282 | 282 | } |
283 | - if($favicon) { |
|
283 | + if ($favicon) { |
|
284 | 284 | $name = 'favicon'; |
285 | - $tmpFileName = $this->saveIconTmp($favicon,'favicon.ico'); |
|
285 | + $tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico'); |
|
286 | 286 | } else { |
287 | 287 | $name = 'mobicon'; |
288 | - $tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png'); |
|
288 | + $tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png'); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | Context::set('name', $name); |
292 | - Context::set('tmpFileName', $tmpFileName.'?'.$_SERVER['REQUEST_TIME']); |
|
292 | + Context::set('tmpFileName', $tmpFileName . '?' . $_SERVER['REQUEST_TIME']); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | |
302 | 302 | $lang_supported = Context::loadLangSupported(); |
303 | 303 | $buff = null; |
304 | - for($i=0;$i<count($langs);$i++) |
|
304 | + for ($i = 0; $i < count($langs); $i++) |
|
305 | 305 | { |
306 | 306 | $buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]); |
307 | 307 | |
308 | 308 | } |
309 | - FileHandler::writeFile(_XE_PATH_.'files/config/lang_selected.info', trim($buff)); |
|
309 | + FileHandler::writeFile(_XE_PATH_ . 'files/config/lang_selected.info', trim($buff)); |
|
310 | 310 | //$this->setMessage('success_updated'); |
311 | 311 | } |
312 | 312 | |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | { |
316 | 316 | $args = new stdClass(); |
317 | 317 | |
318 | - if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) $args->thumbnail_type = 'crop'; |
|
318 | + if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio') $args->thumbnail_type = 'crop'; |
|
319 | 319 | else $args->thumbnail_type = 'ratio'; |
320 | 320 | |
321 | 321 | $oModuleController = getController('module'); |
322 | - $oModuleController->insertModuleConfig('document',$args); |
|
322 | + $oModuleController->insertModuleConfig('document', $args); |
|
323 | 323 | |
324 | 324 | unset($args); |
325 | 325 | |
326 | 326 | $args = new stdClass; |
327 | 327 | $args->htmlFooter = $config->htmlFooter; |
328 | 328 | $args->siteTitle = $config->siteTitle; |
329 | - $oModuleController->updateModuleConfig('module',$args); |
|
329 | + $oModuleController->updateModuleConfig('module', $args); |
|
330 | 330 | |
331 | 331 | return $output; |
332 | 332 | } |
@@ -336,32 +336,32 @@ discard block |
||
336 | 336 | |
337 | 337 | $site_info = Context::get('site_module_info'); |
338 | 338 | $virtual_site = ''; |
339 | - if($site_info->site_srl) |
|
339 | + if ($site_info->site_srl) |
|
340 | 340 | { |
341 | 341 | $virtual_site = $site_info->site_srl . '/'; |
342 | 342 | } |
343 | 343 | |
344 | 344 | $target_file = $icon['tmp_name']; |
345 | 345 | $type = $icon['type']; |
346 | - $relative_filename = 'files/attach/xeicon/'.$virtual_site.'tmp/'.$iconname; |
|
347 | - $target_filename = _XE_PATH_.$relative_filename; |
|
346 | + $relative_filename = 'files/attach/xeicon/' . $virtual_site . 'tmp/' . $iconname; |
|
347 | + $target_filename = _XE_PATH_ . $relative_filename; |
|
348 | 348 | |
349 | 349 | list($width, $height, $type_no, $attrs) = @getimagesize($target_file); |
350 | - if($iconname == 'favicon.ico') |
|
350 | + if ($iconname == 'favicon.ico') |
|
351 | 351 | { |
352 | - if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) { |
|
353 | - Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); |
|
352 | + if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) { |
|
353 | + Context::set('msg', '*.ico ' . Context::getLang('msg_possible_only_file')); |
|
354 | 354 | return; |
355 | 355 | } |
356 | 356 | } |
357 | - else if($iconname == 'mobicon.png') |
|
357 | + else if ($iconname == 'mobicon.png') |
|
358 | 358 | { |
359 | - if(!preg_match('/^.*(png).*$/',$type)) { |
|
360 | - Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file')); |
|
359 | + if (!preg_match('/^.*(png).*$/', $type)) { |
|
360 | + Context::set('msg', '*.png ' . Context::getLang('msg_possible_only_file')); |
|
361 | 361 | return; |
362 | 362 | } |
363 | - if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) { |
|
364 | - Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)'); |
|
363 | + if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) { |
|
364 | + Context::set('msg', Context::getLang('msg_invalid_format') . ' (size : 57x57, 114x114)'); |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | } |
@@ -381,21 +381,21 @@ discard block |
||
381 | 381 | |
382 | 382 | $site_info = Context::get('site_module_info'); |
383 | 383 | $virtual_site = ''; |
384 | - if($site_info->site_srl) |
|
384 | + if ($site_info->site_srl) |
|
385 | 385 | { |
386 | 386 | $virtual_site = $site_info->site_srl . '/'; |
387 | 387 | } |
388 | 388 | |
389 | - $image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site; |
|
389 | + $image_filepath = _XE_PATH_ . 'files/attach/xeicon/' . $virtual_site; |
|
390 | 390 | |
391 | - if($deleteIcon) { |
|
392 | - FileHandler::removeFile($image_filepath.$iconname); |
|
391 | + if ($deleteIcon) { |
|
392 | + FileHandler::removeFile($image_filepath . $iconname); |
|
393 | 393 | return; |
394 | 394 | } |
395 | 395 | |
396 | - $tmpicon_filepath = $image_filepath.'tmp/'.$iconname; |
|
397 | - $icon_filepath = $image_filepath.$iconname; |
|
398 | - if(file_exists($tmpicon_filepath)) |
|
396 | + $tmpicon_filepath = $image_filepath . 'tmp/' . $iconname; |
|
397 | + $icon_filepath = $image_filepath . $iconname; |
|
398 | + if (file_exists($tmpicon_filepath)) |
|
399 | 399 | { |
400 | 400 | FileHandler::moveFile($tmpicon_filepath, $icon_filepath); |
401 | 401 | } |
@@ -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 object(-1, 'invalid_request'); |
|
23 | + if(!$module_name) { |
|
24 | + return new object(-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 object(-1, 'invalid_request'); |
|
40 | + if(!$module_name) { |
|
41 | + return new object(-1, 'invalid_request'); |
|
42 | + } |
|
39 | 43 | |
40 | 44 | $oModule = getModule($module_name, 'class'); |
41 | - if($oModule) $output = $oModule->moduleUpdate(); |
|
42 | - else $output = new Object(-1, 'invalid_request'); |
|
45 | + if($oModule) { |
|
46 | + $output = $oModule->moduleUpdate(); |
|
47 | + } else { |
|
48 | + $output = new Object(-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,25 +90,37 @@ 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 | $http_port = Context::get('http_port'); |
85 | 98 | $https_port = Context::get('https_port'); |
86 | 99 | |
87 | 100 | $use_rewrite = Context::get('use_rewrite'); |
88 | - if($use_rewrite!='Y') $use_rewrite = 'N'; |
|
101 | + if($use_rewrite!='Y') { |
|
102 | + $use_rewrite = 'N'; |
|
103 | + } |
|
89 | 104 | |
90 | 105 | $use_sso = Context::get('use_sso'); |
91 | - if($use_sso !='Y') $use_sso = 'N'; |
|
106 | + if($use_sso !='Y') { |
|
107 | + $use_sso = 'N'; |
|
108 | + } |
|
92 | 109 | |
93 | 110 | $use_db_session = Context::get('use_db_session'); |
94 | - if($use_db_session!='Y') $use_db_session = 'N'; |
|
111 | + if($use_db_session!='Y') { |
|
112 | + $use_db_session = 'N'; |
|
113 | + } |
|
95 | 114 | |
96 | 115 | $qmail_compatibility = Context::get('qmail_compatibility'); |
97 | - if($qmail_compatibility!='Y') $qmail_compatibility = 'N'; |
|
116 | + if($qmail_compatibility!='Y') { |
|
117 | + $qmail_compatibility = 'N'; |
|
118 | + } |
|
98 | 119 | |
99 | 120 | $use_html5 = Context::get('use_html5'); |
100 | - if(!$use_html5) $use_html5 = 'N'; |
|
121 | + if(!$use_html5) { |
|
122 | + $use_html5 = 'N'; |
|
123 | + } |
|
101 | 124 | |
102 | 125 | $db_info->default_url = $default_url; |
103 | 126 | $db_info->qmail_compatibility = $qmail_compatibility; |
@@ -108,11 +131,17 @@ discard block |
||
108 | 131 | $db_info->use_html5 = $use_html5; |
109 | 132 | $db_info->admin_ip_list = $admin_ip_list; |
110 | 133 | |
111 | - if($http_port) $db_info->http_port = (int) $http_port; |
|
112 | - else if($db_info->http_port) unset($db_info->http_port); |
|
134 | + if($http_port) { |
|
135 | + $db_info->http_port = (int) $http_port; |
|
136 | + } else if($db_info->http_port) { |
|
137 | + unset($db_info->http_port); |
|
138 | + } |
|
113 | 139 | |
114 | - if($https_port) $db_info->https_port = (int) $https_port; |
|
115 | - else if($db_info->https_port) unset($db_info->https_port); |
|
140 | + if($https_port) { |
|
141 | + $db_info->https_port = (int) $https_port; |
|
142 | + } else if($db_info->https_port) { |
|
143 | + unset($db_info->https_port); |
|
144 | + } |
|
116 | 145 | |
117 | 146 | unset($db_info->lang_type); |
118 | 147 | |
@@ -120,8 +149,7 @@ discard block |
||
120 | 149 | if(!$oInstallController->makeConfigFile()) |
121 | 150 | { |
122 | 151 | return new Object(-1, 'msg_invalid_request'); |
123 | - } |
|
124 | - else |
|
152 | + } else |
|
125 | 153 | { |
126 | 154 | Context::setDBInfo($db_info); |
127 | 155 | if($default_url) |
@@ -173,8 +201,12 @@ discard block |
||
173 | 201 | function procInstallAdminRemoveFTPInfo() |
174 | 202 | { |
175 | 203 | $ftp_config_file = Context::getFTPConfigFile(); |
176 | - if(file_exists($ftp_config_file)) unlink($ftp_config_file); |
|
177 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
204 | + if(file_exists($ftp_config_file)) { |
|
205 | + unlink($ftp_config_file); |
|
206 | + } |
|
207 | + if($_SESSION['ftp_password']) { |
|
208 | + unset($_SESSION['ftp_password']); |
|
209 | + } |
|
178 | 210 | $this->setMessage('success_deleted'); |
179 | 211 | } |
180 | 212 | |
@@ -185,15 +217,16 @@ discard block |
||
185 | 217 | $ftp_info->ftp_port = Context::get('ftp_port'); |
186 | 218 | $ftp_info->ftp_host = Context::get('ftp_host'); |
187 | 219 | $ftp_info->ftp_pasv = Context::get('ftp_pasv'); |
188 | - if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N"; |
|
220 | + if(!$ftp_info->ftp_pasv) { |
|
221 | + $ftp_info->ftp_pasv = "N"; |
|
222 | + } |
|
189 | 223 | $ftp_info->sftp = Context::get('sftp'); |
190 | 224 | |
191 | 225 | $ftp_root_path = Context::get('ftp_root_path'); |
192 | 226 | if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/") |
193 | 227 | { |
194 | 228 | $ftp_info->ftp_root_path = $ftp_root_path; |
195 | - } |
|
196 | - else |
|
229 | + } else |
|
197 | 230 | { |
198 | 231 | $ftp_info->ftp_root_path = $ftp_root_path.'/'; |
199 | 232 | } |
@@ -206,7 +239,9 @@ discard block |
||
206 | 239 | $buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n"; |
207 | 240 | foreach($ftp_info as $key => $val) |
208 | 241 | { |
209 | - if(!$val) continue; |
|
242 | + if(!$val) { |
|
243 | + continue; |
|
244 | + } |
|
210 | 245 | 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))) |
211 | 246 | { |
212 | 247 | continue; |
@@ -216,7 +251,9 @@ discard block |
||
216 | 251 | $buff .= "?>"; |
217 | 252 | $config_file = Context::getFTPConfigFile(); |
218 | 253 | FileHandler::WriteFile($config_file, $buff); |
219 | - if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']); |
|
254 | + if($_SESSION['ftp_password']) { |
|
255 | + unset($_SESSION['ftp_password']); |
|
256 | + } |
|
220 | 257 | |
221 | 258 | $this->setMessage('success_updated'); |
222 | 259 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp'); |
@@ -226,7 +263,9 @@ discard block |
||
226 | 263 | function procInstallAdminConfig() |
227 | 264 | { |
228 | 265 | $use_mobile_view = Context::get('use_mobile_view'); |
229 | - if($use_mobile_view!='Y') $use_mobile_view = 'N'; |
|
266 | + if($use_mobile_view!='Y') { |
|
267 | + $use_mobile_view = 'N'; |
|
268 | + } |
|
230 | 269 | |
231 | 270 | $time_zone = Context::get('time_zone'); |
232 | 271 | |
@@ -315,8 +354,11 @@ discard block |
||
315 | 354 | { |
316 | 355 | $args = new stdClass(); |
317 | 356 | |
318 | - if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) $args->thumbnail_type = 'crop'; |
|
319 | - else $args->thumbnail_type = 'ratio'; |
|
357 | + if(!$config->thumbnail_type || $config->thumbnail_type != 'ratio' ) { |
|
358 | + $args->thumbnail_type = 'crop'; |
|
359 | + } else { |
|
360 | + $args->thumbnail_type = 'ratio'; |
|
361 | + } |
|
320 | 362 | |
321 | 363 | $oModuleController = getController('module'); |
322 | 364 | $oModuleController->insertModuleConfig('document',$args); |
@@ -353,8 +395,7 @@ discard block |
||
353 | 395 | Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file')); |
354 | 396 | return; |
355 | 397 | } |
356 | - } |
|
357 | - else if($iconname == 'mobicon.png') |
|
398 | + } else if($iconname == 'mobicon.png') |
|
358 | 399 | { |
359 | 400 | if(!preg_match('/^.*(png).*$/',$type)) { |
360 | 401 | Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file')); |
@@ -364,8 +405,7 @@ discard block |
||
364 | 405 | Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)'); |
365 | 406 | return; |
366 | 407 | } |
367 | - } |
|
368 | - else |
|
408 | + } else |
|
369 | 409 | { |
370 | 410 | Context::set('msg', Context::getLang('msg_invalid_format')); |
371 | 411 | return; |
@@ -545,6 +545,7 @@ discard block |
||
545 | 545 | |
546 | 546 | /** |
547 | 547 | * @brief Install an each module |
548 | + * @param string $module_path |
|
548 | 549 | */ |
549 | 550 | function installModule($module, $module_path) |
550 | 551 | { |
@@ -614,6 +615,7 @@ discard block |
||
614 | 615 | /** |
615 | 616 | * @brief Create etc config file |
616 | 617 | * Create the config file when all settings are completed |
618 | + * @param stdClass $config_info |
|
617 | 619 | */ |
618 | 620 | function makeEtcConfigFile($config_info) |
619 | 621 | { |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class installController |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @brief install module of the Controller class |
|
7 | - */ |
|
4 | + * @class installController |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @brief install module of the Controller class |
|
7 | + */ |
|
8 | 8 | class installController extends install |
9 | 9 | { |
10 | 10 | var $db_tmp_config_file = ''; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * make a file to files/config and check url approach by ".htaccess" rules |
414 | 414 | * |
415 | 415 | * @return bool |
416 | - */ |
|
416 | + */ |
|
417 | 417 | function checkRewriteUsable() { |
418 | 418 | $checkString = "isApproached"; |
419 | 419 | $checkFilePath = 'files/config/tmpRewriteCheck.txt'; |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // Error occurs if already installed |
20 | - if(Context::isInstalled()) |
|
20 | + if (Context::isInstalled()) |
|
21 | 21 | { |
22 | 22 | return new Object(-1, 'msg_already_installed'); |
23 | 23 | } |
24 | 24 | |
25 | - $this->db_tmp_config_file = _XE_PATH_.'files/config/tmpDB.config.php'; |
|
26 | - $this->etc_tmp_config_file = _XE_PATH_.'files/config/tmpEtc.config.php'; |
|
25 | + $this->db_tmp_config_file = _XE_PATH_ . 'files/config/tmpDB.config.php'; |
|
26 | + $this->etc_tmp_config_file = _XE_PATH_ . 'files/config/tmpEtc.config.php'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | function _procDBSetting() |
87 | 87 | { |
88 | 88 | // Get DB-related variables |
89 | - $con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); |
|
89 | + $con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix'); |
|
90 | 90 | |
91 | 91 | $db_info = new stdClass(); |
92 | 92 | $db_info->master_db = get_object_vars($con_string); |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | // Check if available to connect to the DB |
102 | 102 | $oDB = &DB::getInstance(); |
103 | 103 | $output = $oDB->getError(); |
104 | - if(!$output->toBool()) return $output; |
|
105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
104 | + if (!$output->toBool()) return $output; |
|
105 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
106 | 106 | |
107 | 107 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
108 | + if (!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
109 | 109 | |
110 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
110 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
111 | 111 | { |
112 | 112 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm'); |
113 | - header('location:'.$returnUrl); |
|
113 | + header('location:' . $returnUrl); |
|
114 | 114 | return; |
115 | 115 | } |
116 | 116 | } |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | function procConfigSetting() |
122 | 122 | { |
123 | 123 | // Get variables |
124 | - $config_info = Context::gets('use_rewrite','time_zone'); |
|
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
124 | + $config_info = Context::gets('use_rewrite', 'time_zone'); |
|
125 | + if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N'; |
|
126 | 126 | |
127 | 127 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
128 | + if (!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
129 | 129 | |
130 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
130 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
131 | 131 | { |
132 | 132 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); |
133 | - header('location:'.$returnUrl); |
|
133 | + header('location:' . $returnUrl); |
|
134 | 134 | return; |
135 | 135 | } |
136 | 136 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | function procInstall() |
142 | 142 | { |
143 | 143 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
144 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
145 | 145 | |
146 | 146 | // Assign a temporary administrator when installing |
147 | 147 | $logged_info = new stdClass(); |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | Context::set('logged_info', $logged_info); |
150 | 150 | |
151 | 151 | // check install config |
152 | - if(Context::get('install_config')) |
|
152 | + if (Context::get('install_config')) |
|
153 | 153 | { |
154 | 154 | $db_info = $this->_makeDbInfoByInstallConfig(); |
155 | 155 | } |
156 | 156 | // install by default XE UI |
157 | 157 | else |
158 | 158 | { |
159 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
159 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // Set DB type and information |
@@ -165,27 +165,27 @@ discard block |
||
165 | 165 | // Create DB Instance |
166 | 166 | $oDB = &DB::getInstance(); |
167 | 167 | // Check if available to connect to the DB |
168 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
168 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
169 | 169 | |
170 | 170 | // Install all the modules |
171 | 171 | try { |
172 | 172 | $oDB->begin(); |
173 | 173 | $this->installDownloadedModule(); |
174 | 174 | $oDB->commit(); |
175 | - } catch(Exception $e) { |
|
175 | + } catch (Exception $e) { |
|
176 | 176 | $oDB->rollback(); |
177 | 177 | return new Object(-1, $e->getMessage()); |
178 | 178 | } |
179 | 179 | |
180 | 180 | // Create a config file |
181 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
181 | + if (!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
182 | 182 | |
183 | 183 | // load script |
184 | 184 | $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
185 | - if(count($scripts)>0) |
|
185 | + if (count($scripts) > 0) |
|
186 | 186 | { |
187 | 187 | sort($scripts); |
188 | - foreach($scripts as $script) |
|
188 | + foreach ($scripts as $script) |
|
189 | 189 | { |
190 | 190 | $script_path = FileHandler::getRealPath('./modules/install/script/'); |
191 | 191 | $output = include($script_path . $script); |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | |
202 | 202 | unset($_SESSION['use_rewrite']); |
203 | 203 | |
204 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
204 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
205 | 205 | { |
206 | 206 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); |
207 | - header('location:'.$returnUrl); |
|
207 | + header('location:' . $returnUrl); |
|
208 | 208 | return new Object(); |
209 | 209 | } |
210 | 210 | } |
@@ -239,57 +239,57 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function procInstallFTP() |
241 | 241 | { |
242 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
243 | - $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
|
244 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
245 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
242 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
243 | + $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); |
|
244 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
245 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
248 | 248 | |
249 | 249 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
250 | 250 | $buff[] = "\$ftp_info = new stdClass();"; |
251 | - foreach($ftp_info as $key => $val) |
|
251 | + foreach ($ftp_info as $key => $val) |
|
252 | 252 | { |
253 | - $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); |
|
253 | + $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // If safe_mode |
257 | - if(ini_get('safe_mode')) |
|
257 | + if (ini_get('safe_mode')) |
|
258 | 258 | { |
259 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
259 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
260 | 260 | |
261 | - require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
261 | + require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
262 | 262 | $oFtp = new ftp(); |
263 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
263 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
264 | 264 | |
265 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
265 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
266 | 266 | { |
267 | 267 | $oFtp->ftp_quit(); |
268 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
268 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
269 | 269 | } |
270 | 270 | |
271 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
271 | + if (!is_dir(_XE_PATH_ . 'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path . 'files')) |
|
272 | 272 | { |
273 | 273 | $oFtp->ftp_quit(); |
274 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
274 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
275 | 275 | } |
276 | 276 | |
277 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
277 | + if (!$oFtp->ftp_site("CHMOD 777 " . $ftp_info->ftp_root_path . 'files')) |
|
278 | 278 | { |
279 | 279 | $oFtp->ftp_quit(); |
280 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
280 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
281 | 281 | } |
282 | 282 | |
283 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
283 | + if (!is_dir(_XE_PATH_ . 'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path . 'files/config')) |
|
284 | 284 | { |
285 | 285 | $oFtp->ftp_quit(); |
286 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
286 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
287 | 287 | } |
288 | 288 | |
289 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
289 | + if (!$oFtp->ftp_site("CHMOD 777 " . $ftp_info->ftp_root_path . 'files/config')) |
|
290 | 290 | { |
291 | 291 | $oFtp->ftp_quit(); |
292 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
292 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $oFtp->ftp_quit(); |
@@ -300,31 +300,31 @@ discard block |
||
300 | 300 | |
301 | 301 | function procInstallCheckFtp() |
302 | 302 | { |
303 | - $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
|
304 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
305 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
303 | + $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); |
|
304 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
305 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
307 | 307 | |
308 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
308 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
309 | 309 | |
310 | - if($ftp_info->sftp == 'Y') |
|
310 | + if ($ftp_info->sftp == 'Y') |
|
311 | 311 | { |
312 | 312 | $connection = ssh2_connect('localhost', $ftp_info->ftp_port); |
313 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
313 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
314 | 314 | { |
315 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
315 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | else |
319 | 319 | { |
320 | - require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
320 | + require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
321 | 321 | $oFtp = new ftp(); |
322 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
322 | + if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
323 | 323 | |
324 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
324 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
325 | 325 | { |
326 | 326 | $oFtp->ftp_quit(); |
327 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
327 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
328 | 328 | } |
329 | 329 | $oFtp->ftp_quit(); |
330 | 330 | } |
@@ -341,36 +341,36 @@ discard block |
||
341 | 341 | $checklist = array(); |
342 | 342 | // 0. check your version of php (5.2.4 or higher) |
343 | 343 | $checklist['php_version'] = true; |
344 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
344 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
345 | 345 | { |
346 | 346 | $checklist['php_version'] = false; |
347 | 347 | } |
348 | 348 | |
349 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
349 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
350 | 350 | { |
351 | 351 | Context::set('phpversion_warning', true); |
352 | 352 | } |
353 | 353 | |
354 | 354 | // 1. Check permission |
355 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
355 | + if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; |
|
356 | 356 | else $checklist['permission'] = false; |
357 | 357 | // 2. Check if xml_parser_create exists |
358 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
358 | + if (function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
359 | 359 | else $checklist['xml'] = false; |
360 | 360 | // 3. Check if ini_get (session.auto_start) == 1 |
361 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
361 | + if (ini_get('session.auto_start') != 1) $checklist['session'] = true; |
|
362 | 362 | else $checklist['session'] = false; |
363 | 363 | // 4. Check if iconv exists |
364 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
364 | + if (function_exists('iconv')) $checklist['iconv'] = true; |
|
365 | 365 | else $checklist['iconv'] = false; |
366 | 366 | // 5. Check gd(imagecreatefromgif function) |
367 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
367 | + if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
368 | 368 | else $checklist['gd'] = false; |
369 | 369 | // 6. Check DB |
370 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
370 | + if (DB::getEnableList()) $checklist['db'] = true; |
|
371 | 371 | else $checklist['db'] = false; |
372 | 372 | |
373 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
373 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
374 | 374 | else $install_enable = true; |
375 | 375 | |
376 | 376 | // Save the checked result to the Context |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false; |
392 | 392 | |
393 | - if($license_agreement) |
|
393 | + if ($license_agreement) |
|
394 | 394 | { |
395 | 395 | $currentTime = $_SERVER['REQUEST_TIME']; |
396 | 396 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | return new Object(-1, 'msg_must_accept_license_agreement'); |
402 | 402 | } |
403 | 403 | |
404 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
404 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
405 | 405 | { |
406 | 406 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); |
407 | 407 | $this->setRedirectUrl($returnUrl); |
@@ -418,13 +418,13 @@ discard block |
||
418 | 418 | $checkString = "isApproached"; |
419 | 419 | $checkFilePath = 'files/config/tmpRewriteCheck.txt'; |
420 | 420 | |
421 | - FileHandler::writeFile(_XE_PATH_.$checkFilePath, trim($checkString)); |
|
421 | + FileHandler::writeFile(_XE_PATH_ . $checkFilePath, trim($checkString)); |
|
422 | 422 | |
423 | 423 | $scheme = ($_SERVER['HTTPS'] === 'on') ? 'https' : 'http'; |
424 | 424 | $hostname = $_SERVER['SERVER_NAME']; |
425 | 425 | $port = $_SERVER['SERVER_PORT']; |
426 | 426 | $str_port = ''; |
427 | - if($port) |
|
427 | + if ($port) |
|
428 | 428 | { |
429 | 429 | $str_port = ':' . $port; |
430 | 430 | } |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | $tmpPath = $_SERVER['DOCUMENT_ROOT']; |
433 | 433 | |
434 | 434 | //if DIRECTORY_SEPARATOR is not /(IIS) |
435 | - if(DIRECTORY_SEPARATOR !== '/') |
|
435 | + if (DIRECTORY_SEPARATOR !== '/') |
|
436 | 436 | { |
437 | 437 | //change to slash for compare |
438 | 438 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; |
442 | 442 | $currentPath = str_replace($tmpPath, "", _XE_PATH_); |
443 | - if($currentPath != "") |
|
443 | + if ($currentPath != "") |
|
444 | 444 | { |
445 | 445 | $query = $currentPath . $query; |
446 | 446 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | $requestConfig['ssl_verify_peer'] = false; |
450 | 450 | $buff = FileHandler::getRemoteResource($requestUrl, null, 3, 'GET', null, array(), array(), array(), $requestConfig); |
451 | 451 | |
452 | - FileHandler::removeFile(_XE_PATH_.$checkFilePath); |
|
452 | + FileHandler::removeFile(_XE_PATH_ . $checkFilePath); |
|
453 | 453 | |
454 | 454 | return (trim($buff) == $checkString); |
455 | 455 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | './files/cache/template_compiled', |
468 | 468 | ); |
469 | 469 | |
470 | - foreach($directory_list as $dir) |
|
470 | + foreach ($directory_list as $dir) |
|
471 | 471 | { |
472 | 472 | FileHandler::makeDir($dir); |
473 | 473 | } |
@@ -483,57 +483,57 @@ discard block |
||
483 | 483 | $oModuleModel = getModel('module'); |
484 | 484 | // Create a table ny finding schemas/*.xml file in each module |
485 | 485 | $module_list = FileHandler::readDir('./modules/', NULL, false, true); |
486 | - foreach($module_list as $module_path) |
|
486 | + foreach ($module_list as $module_path) |
|
487 | 487 | { |
488 | 488 | // Get module name |
489 | - $tmp_arr = explode('/',$module_path); |
|
490 | - $module = $tmp_arr[count($tmp_arr)-1]; |
|
489 | + $tmp_arr = explode('/', $module_path); |
|
490 | + $module = $tmp_arr[count($tmp_arr) - 1]; |
|
491 | 491 | |
492 | 492 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
493 | - if(!$xml_info) continue; |
|
493 | + if (!$xml_info) continue; |
|
494 | 494 | $modules[$xml_info->category][] = $module; |
495 | 495 | } |
496 | 496 | // Install "module" module in advance |
497 | - $this->installModule('module','./modules/module'); |
|
497 | + $this->installModule('module', './modules/module'); |
|
498 | 498 | $oModule = getClass('module'); |
499 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
499 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
500 | 500 | // Determine the order of module installation depending on category |
501 | - $install_step = array('system','content','member'); |
|
501 | + $install_step = array('system', 'content', 'member'); |
|
502 | 502 | // Install all the remaining modules |
503 | - foreach($install_step as $category) |
|
503 | + foreach ($install_step as $category) |
|
504 | 504 | { |
505 | - if(count($modules[$category])) |
|
505 | + if (count($modules[$category])) |
|
506 | 506 | { |
507 | - foreach($modules[$category] as $module) |
|
507 | + foreach ($modules[$category] as $module) |
|
508 | 508 | { |
509 | - if($module == 'module') continue; |
|
509 | + if ($module == 'module') continue; |
|
510 | 510 | $this->installModule($module, sprintf('./modules/%s', $module)); |
511 | 511 | |
512 | 512 | $oModule = getClass($module); |
513 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
513 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
514 | 514 | { |
515 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
515 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | unset($modules[$category]); |
519 | 519 | } |
520 | 520 | } |
521 | 521 | // Install all the remaining modules |
522 | - if(count($modules)) |
|
522 | + if (count($modules)) |
|
523 | 523 | { |
524 | - foreach($modules as $category => $module_list) |
|
524 | + foreach ($modules as $category => $module_list) |
|
525 | 525 | { |
526 | - if(count($module_list)) |
|
526 | + if (count($module_list)) |
|
527 | 527 | { |
528 | - foreach($module_list as $module) |
|
528 | + foreach ($module_list as $module) |
|
529 | 529 | { |
530 | - if($module == 'module') continue; |
|
530 | + if ($module == 'module') continue; |
|
531 | 531 | $this->installModule($module, sprintf('./modules/%s', $module)); |
532 | 532 | |
533 | 533 | $oModule = getClass($module); |
534 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
534 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
535 | 535 | { |
536 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
536 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | } |
@@ -555,31 +555,31 @@ discard block |
||
555 | 555 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); |
556 | 556 | |
557 | 557 | $file_cnt = count($schema_files); |
558 | - for($i=0;$i<$file_cnt;$i++) |
|
558 | + for ($i = 0; $i < $file_cnt; $i++) |
|
559 | 559 | { |
560 | 560 | $file = trim($schema_files[$i]); |
561 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
561 | + if (!$file || substr($file, -4) != '.xml') continue; |
|
562 | 562 | $output = $oDB->createTableByXmlFile($file); |
563 | - if($output === false) |
|
563 | + if ($output === false) |
|
564 | 564 | throw new Exception('msg_create_table_failed'); |
565 | 565 | } |
566 | 566 | // Create a table and module instance and then execute install() method |
567 | 567 | unset($oModule); |
568 | 568 | $oModule = getClass($module); |
569 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
569 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
570 | 570 | return new Object(); |
571 | 571 | } |
572 | 572 | |
573 | 573 | function _getDBConfigFileContents($db_info) |
574 | 574 | { |
575 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
575 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
576 | 576 | { |
577 | 577 | $db_info->master_db['db_table_prefix'] .= '_'; |
578 | 578 | } |
579 | 579 | |
580 | - foreach($db_info->slave_db as &$slave) |
|
580 | + foreach ($db_info->slave_db as &$slave) |
|
581 | 581 | { |
582 | - if(substr($slave['db_table_prefix'], -1) != '_') |
|
582 | + if (substr($slave['db_table_prefix'], -1) != '_') |
|
583 | 583 | { |
584 | 584 | $slave['db_table_prefix'] .= '_'; |
585 | 585 | } |
@@ -601,13 +601,13 @@ discard block |
||
601 | 601 | $db_tmp_config_file = $this->db_tmp_config_file; |
602 | 602 | |
603 | 603 | $db_info = Context::getDbInfo(); |
604 | - if(!$db_info) return; |
|
604 | + if (!$db_info) return; |
|
605 | 605 | |
606 | 606 | $buff = $this->_getDBConfigFileContents($db_info); |
607 | 607 | |
608 | 608 | FileHandler::writeFile($db_tmp_config_file, $buff); |
609 | 609 | |
610 | - if(@file_exists($db_tmp_config_file)) return true; |
|
610 | + if (@file_exists($db_tmp_config_file)) return true; |
|
611 | 611 | return false; |
612 | 612 | } |
613 | 613 | |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | { |
620 | 620 | $etc_tmp_config_file = $this->etc_tmp_config_file; |
621 | 621 | |
622 | - $buff = '<?php if(!defined("__XE__")) exit();'."\n"; |
|
623 | - foreach($config_info as $key => $val) |
|
622 | + $buff = '<?php if(!defined("__XE__")) exit();' . "\n"; |
|
623 | + foreach ($config_info as $key => $val) |
|
624 | 624 | { |
625 | - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
625 | + $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
629 | 629 | |
630 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
630 | + if (@file_exists($etc_tmp_config_file)) return true; |
|
631 | 631 | return false; |
632 | 632 | } |
633 | 633 | |
@@ -642,13 +642,13 @@ discard block |
||
642 | 642 | //if(file_exists($config_file)) return; |
643 | 643 | |
644 | 644 | $db_info = Context::getDbInfo(); |
645 | - if(!$db_info) return; |
|
645 | + if (!$db_info) return; |
|
646 | 646 | |
647 | 647 | $buff = $this->_getDBConfigFileContents($db_info); |
648 | 648 | |
649 | 649 | FileHandler::writeFile($config_file, $buff); |
650 | 650 | |
651 | - if(@file_exists($config_file)) |
|
651 | + if (@file_exists($config_file)) |
|
652 | 652 | { |
653 | 653 | FileHandler::removeFile($this->db_tmp_config_file); |
654 | 654 | FileHandler::removeFile($this->etc_tmp_config_file); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | function installByConfig($install_config_file) |
664 | 664 | { |
665 | 665 | include $install_config_file; |
666 | - if(!is_array($auto_config)) return false; |
|
666 | + if (!is_array($auto_config)) return false; |
|
667 | 667 | |
668 | 668 | $auto_config['module'] = 'install'; |
669 | 669 | $auto_config['act'] = 'procInstall'; |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n"; |
672 | 672 | $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n"; |
673 | 673 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
674 | - foreach($auto_config as $k => $v) |
|
674 | + foreach ($auto_config as $k => $v) |
|
675 | 675 | { |
676 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
676 | + if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); |
|
677 | 677 | } |
678 | 678 | $body .= "</params>\r\n</methodCall>"; |
679 | 679 | |
680 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); |
|
680 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body); |
|
681 | 681 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); |
682 | 682 | |
683 | - if($fp) |
|
683 | + if ($fp) |
|
684 | 684 | { |
685 | 685 | fputs($fp, $header); |
686 | - while(!feof($fp)) |
|
686 | + while (!feof($fp)) |
|
687 | 687 | { |
688 | 688 | $line = trim(fgets($fp, 4096)); |
689 | - if(strncmp('<error>', $line, 7) === 0) |
|
689 | + if (strncmp('<error>', $line, 7) === 0) |
|
690 | 690 | { |
691 | 691 | fclose($fp); |
692 | 692 | return false; |
@@ -101,11 +101,17 @@ discard block |
||
101 | 101 | // Check if available to connect to the DB |
102 | 102 | $oDB = &DB::getInstance(); |
103 | 103 | $output = $oDB->getError(); |
104 | - if(!$output->toBool()) return $output; |
|
105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
104 | + if(!$output->toBool()) { |
|
105 | + return $output; |
|
106 | + } |
|
107 | + if(!$oDB->isConnected()) { |
|
108 | + return $oDB->getError(); |
|
109 | + } |
|
106 | 110 | |
107 | 111 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
112 | + if(!$this->makeDBConfigFile()) { |
|
113 | + return new Object(-1, 'msg_install_failed'); |
|
114 | + } |
|
109 | 115 | |
110 | 116 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
111 | 117 | { |
@@ -122,10 +128,14 @@ discard block |
||
122 | 128 | { |
123 | 129 | // Get variables |
124 | 130 | $config_info = Context::gets('use_rewrite','time_zone'); |
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
131 | + if($config_info->use_rewrite!='Y') { |
|
132 | + $config_info->use_rewrite = 'N'; |
|
133 | + } |
|
126 | 134 | |
127 | 135 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
136 | + if(!$this->makeEtcConfigFile($config_info)) { |
|
137 | + return new Object(-1, 'msg_install_failed'); |
|
138 | + } |
|
129 | 139 | |
130 | 140 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
131 | 141 | { |
@@ -141,7 +151,9 @@ discard block |
||
141 | 151 | function procInstall() |
142 | 152 | { |
143 | 153 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
154 | + if(Context::isInstalled()) { |
|
155 | + return new Object(-1, 'msg_already_installed'); |
|
156 | + } |
|
145 | 157 | |
146 | 158 | // Assign a temporary administrator when installing |
147 | 159 | $logged_info = new stdClass(); |
@@ -156,8 +168,12 @@ discard block |
||
156 | 168 | // install by default XE UI |
157 | 169 | else |
158 | 170 | { |
159 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
171 | + if(FileHandler::exists($this->db_tmp_config_file)) { |
|
172 | + include $this->db_tmp_config_file; |
|
173 | + } |
|
174 | + if(FileHandler::exists($this->etc_tmp_config_file)) { |
|
175 | + include $this->etc_tmp_config_file; |
|
176 | + } |
|
161 | 177 | } |
162 | 178 | |
163 | 179 | // Set DB type and information |
@@ -165,7 +181,9 @@ discard block |
||
165 | 181 | // Create DB Instance |
166 | 182 | $oDB = &DB::getInstance(); |
167 | 183 | // Check if available to connect to the DB |
168 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
184 | + if(!$oDB->isConnected()) { |
|
185 | + return $oDB->getError(); |
|
186 | + } |
|
169 | 187 | |
170 | 188 | // Install all the modules |
171 | 189 | try { |
@@ -178,7 +196,9 @@ discard block |
||
178 | 196 | } |
179 | 197 | |
180 | 198 | // Create a config file |
181 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
199 | + if(!$this->makeConfigFile()) { |
|
200 | + return new Object(-1, 'msg_install_failed'); |
|
201 | + } |
|
182 | 202 | |
183 | 203 | // load script |
184 | 204 | $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
@@ -239,12 +259,20 @@ discard block |
||
239 | 259 | */ |
240 | 260 | function procInstallFTP() |
241 | 261 | { |
242 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
262 | + if(Context::isInstalled()) { |
|
263 | + return new Object(-1, 'msg_already_installed'); |
|
264 | + } |
|
243 | 265 | $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
244 | 266 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
245 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
267 | + if(!$ftp_info->ftp_port) { |
|
268 | + $ftp_info->ftp_port = 21; |
|
269 | + } |
|
270 | + if(!$ftp_info->ftp_host) { |
|
271 | + $ftp_info->ftp_host = '127.0.0.1'; |
|
272 | + } |
|
273 | + if(!$ftp_info->ftp_root_path) { |
|
274 | + $ftp_info->ftp_root_path = '/'; |
|
275 | + } |
|
248 | 276 | |
249 | 277 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
250 | 278 | $buff[] = "\$ftp_info = new stdClass();"; |
@@ -256,11 +284,15 @@ discard block |
||
256 | 284 | // If safe_mode |
257 | 285 | if(ini_get('safe_mode')) |
258 | 286 | { |
259 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
287 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
288 | + return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
289 | + } |
|
260 | 290 | |
261 | 291 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
262 | 292 | $oFtp = new ftp(); |
263 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
293 | + if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { |
|
294 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host)); |
|
295 | + } |
|
264 | 296 | |
265 | 297 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
266 | 298 | { |
@@ -302,10 +334,16 @@ discard block |
||
302 | 334 | { |
303 | 335 | $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
304 | 336 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
305 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
337 | + if(!$ftp_info->ftp_port) { |
|
338 | + $ftp_info->ftp_port = 21; |
|
339 | + } |
|
340 | + if(!$ftp_info->sftp) { |
|
341 | + $ftp_info->sftp = 'N'; |
|
342 | + } |
|
307 | 343 | |
308 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
344 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
345 | + return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
346 | + } |
|
309 | 347 | |
310 | 348 | if($ftp_info->sftp == 'Y') |
311 | 349 | { |
@@ -314,12 +352,13 @@ discard block |
||
314 | 352 | { |
315 | 353 | return new Object(-1,'msg_ftp_invalid_auth_info'); |
316 | 354 | } |
317 | - } |
|
318 | - else |
|
355 | + } else |
|
319 | 356 | { |
320 | 357 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
321 | 358 | $oFtp = new ftp(); |
322 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
359 | + if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) { |
|
360 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
361 | + } |
|
323 | 362 | |
324 | 363 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
325 | 364 | { |
@@ -352,26 +391,47 @@ discard block |
||
352 | 391 | } |
353 | 392 | |
354 | 393 | // 1. Check permission |
355 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
356 | - else $checklist['permission'] = false; |
|
394 | + if(is_writable('./')||is_writable('./files')) { |
|
395 | + $checklist['permission'] = true; |
|
396 | + } else { |
|
397 | + $checklist['permission'] = false; |
|
398 | + } |
|
357 | 399 | // 2. Check if xml_parser_create exists |
358 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
359 | - else $checklist['xml'] = false; |
|
400 | + if(function_exists('xml_parser_create')) { |
|
401 | + $checklist['xml'] = true; |
|
402 | + } else { |
|
403 | + $checklist['xml'] = false; |
|
404 | + } |
|
360 | 405 | // 3. Check if ini_get (session.auto_start) == 1 |
361 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
362 | - else $checklist['session'] = false; |
|
406 | + if(ini_get('session.auto_start')!=1) { |
|
407 | + $checklist['session'] = true; |
|
408 | + } else { |
|
409 | + $checklist['session'] = false; |
|
410 | + } |
|
363 | 411 | // 4. Check if iconv exists |
364 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
365 | - else $checklist['iconv'] = false; |
|
412 | + if(function_exists('iconv')) { |
|
413 | + $checklist['iconv'] = true; |
|
414 | + } else { |
|
415 | + $checklist['iconv'] = false; |
|
416 | + } |
|
366 | 417 | // 5. Check gd(imagecreatefromgif function) |
367 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
368 | - else $checklist['gd'] = false; |
|
418 | + if(function_exists('imagecreatefromgif')) { |
|
419 | + $checklist['gd'] = true; |
|
420 | + } else { |
|
421 | + $checklist['gd'] = false; |
|
422 | + } |
|
369 | 423 | // 6. Check DB |
370 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
371 | - else $checklist['db'] = false; |
|
424 | + if(DB::getEnableList()) { |
|
425 | + $checklist['db'] = true; |
|
426 | + } else { |
|
427 | + $checklist['db'] = false; |
|
428 | + } |
|
372 | 429 | |
373 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
374 | - else $install_enable = true; |
|
430 | + if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) { |
|
431 | + $install_enable = false; |
|
432 | + } else { |
|
433 | + $install_enable = true; |
|
434 | + } |
|
375 | 435 | |
376 | 436 | // Save the checked result to the Context |
377 | 437 | Context::set('checklist', $checklist); |
@@ -394,8 +454,7 @@ discard block |
||
394 | 454 | { |
395 | 455 | $currentTime = $_SERVER['REQUEST_TIME']; |
396 | 456 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
397 | - } |
|
398 | - else |
|
457 | + } else |
|
399 | 458 | { |
400 | 459 | FileHandler::removeFile($this->flagLicenseAgreement); |
401 | 460 | return new Object(-1, 'msg_must_accept_license_agreement'); |
@@ -490,13 +549,17 @@ discard block |
||
490 | 549 | $module = $tmp_arr[count($tmp_arr)-1]; |
491 | 550 | |
492 | 551 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
493 | - if(!$xml_info) continue; |
|
552 | + if(!$xml_info) { |
|
553 | + continue; |
|
554 | + } |
|
494 | 555 | $modules[$xml_info->category][] = $module; |
495 | 556 | } |
496 | 557 | // Install "module" module in advance |
497 | 558 | $this->installModule('module','./modules/module'); |
498 | 559 | $oModule = getClass('module'); |
499 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
560 | + if($oModule->checkUpdate()) { |
|
561 | + $oModule->moduleUpdate(); |
|
562 | + } |
|
500 | 563 | // Determine the order of module installation depending on category |
501 | 564 | $install_step = array('system','content','member'); |
502 | 565 | // Install all the remaining modules |
@@ -506,13 +569,17 @@ discard block |
||
506 | 569 | { |
507 | 570 | foreach($modules[$category] as $module) |
508 | 571 | { |
509 | - if($module == 'module') continue; |
|
572 | + if($module == 'module') { |
|
573 | + continue; |
|
574 | + } |
|
510 | 575 | $this->installModule($module, sprintf('./modules/%s', $module)); |
511 | 576 | |
512 | 577 | $oModule = getClass($module); |
513 | 578 | if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
514 | 579 | { |
515 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
580 | + if($oModule->checkUpdate()) { |
|
581 | + $oModule->moduleUpdate(); |
|
582 | + } |
|
516 | 583 | } |
517 | 584 | } |
518 | 585 | unset($modules[$category]); |
@@ -527,13 +594,17 @@ discard block |
||
527 | 594 | { |
528 | 595 | foreach($module_list as $module) |
529 | 596 | { |
530 | - if($module == 'module') continue; |
|
597 | + if($module == 'module') { |
|
598 | + continue; |
|
599 | + } |
|
531 | 600 | $this->installModule($module, sprintf('./modules/%s', $module)); |
532 | 601 | |
533 | 602 | $oModule = getClass($module); |
534 | 603 | if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
535 | 604 | { |
536 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
605 | + if($oModule->checkUpdate()) { |
|
606 | + $oModule->moduleUpdate(); |
|
607 | + } |
|
537 | 608 | } |
538 | 609 | } |
539 | 610 | } |
@@ -558,15 +629,20 @@ discard block |
||
558 | 629 | for($i=0;$i<$file_cnt;$i++) |
559 | 630 | { |
560 | 631 | $file = trim($schema_files[$i]); |
561 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
632 | + if(!$file || substr($file,-4)!='.xml') { |
|
633 | + continue; |
|
634 | + } |
|
562 | 635 | $output = $oDB->createTableByXmlFile($file); |
563 | - if($output === false) |
|
564 | - throw new Exception('msg_create_table_failed'); |
|
636 | + if($output === false) { |
|
637 | + throw new Exception('msg_create_table_failed'); |
|
638 | + } |
|
565 | 639 | } |
566 | 640 | // Create a table and module instance and then execute install() method |
567 | 641 | unset($oModule); |
568 | 642 | $oModule = getClass($module); |
569 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
643 | + if(method_exists($oModule, 'moduleInstall')) { |
|
644 | + $oModule->moduleInstall(); |
|
645 | + } |
|
570 | 646 | return new Object(); |
571 | 647 | } |
572 | 648 | |
@@ -601,13 +677,17 @@ discard block |
||
601 | 677 | $db_tmp_config_file = $this->db_tmp_config_file; |
602 | 678 | |
603 | 679 | $db_info = Context::getDbInfo(); |
604 | - if(!$db_info) return; |
|
680 | + if(!$db_info) { |
|
681 | + return; |
|
682 | + } |
|
605 | 683 | |
606 | 684 | $buff = $this->_getDBConfigFileContents($db_info); |
607 | 685 | |
608 | 686 | FileHandler::writeFile($db_tmp_config_file, $buff); |
609 | 687 | |
610 | - if(@file_exists($db_tmp_config_file)) return true; |
|
688 | + if(@file_exists($db_tmp_config_file)) { |
|
689 | + return true; |
|
690 | + } |
|
611 | 691 | return false; |
612 | 692 | } |
613 | 693 | |
@@ -627,7 +707,9 @@ discard block |
||
627 | 707 | |
628 | 708 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
629 | 709 | |
630 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
710 | + if(@file_exists($etc_tmp_config_file)) { |
|
711 | + return true; |
|
712 | + } |
|
631 | 713 | return false; |
632 | 714 | } |
633 | 715 | |
@@ -642,7 +724,9 @@ discard block |
||
642 | 724 | //if(file_exists($config_file)) return; |
643 | 725 | |
644 | 726 | $db_info = Context::getDbInfo(); |
645 | - if(!$db_info) return; |
|
727 | + if(!$db_info) { |
|
728 | + return; |
|
729 | + } |
|
646 | 730 | |
647 | 731 | $buff = $this->_getDBConfigFileContents($db_info); |
648 | 732 | |
@@ -663,7 +747,9 @@ discard block |
||
663 | 747 | function installByConfig($install_config_file) |
664 | 748 | { |
665 | 749 | include $install_config_file; |
666 | - if(!is_array($auto_config)) return false; |
|
750 | + if(!is_array($auto_config)) { |
|
751 | + return false; |
|
752 | + } |
|
667 | 753 | |
668 | 754 | $auto_config['module'] = 'install'; |
669 | 755 | $auto_config['act'] = 'procInstall'; |
@@ -673,7 +759,9 @@ discard block |
||
673 | 759 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
674 | 760 | foreach($auto_config as $k => $v) |
675 | 761 | { |
676 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
762 | + if(!in_array($k,array('host','port','path'))) { |
|
763 | + $body .= sprintf($fstr,$k,$v,$k); |
|
764 | + } |
|
677 | 765 | } |
678 | 766 | $body .= "</params>\r\n</methodCall>"; |
679 | 767 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | /** |
31 | 31 | * Search Result |
32 | 32 | * |
33 | - * @return Object |
|
33 | + * @return Object|null |
|
34 | 34 | */ |
35 | 35 | function IS() |
36 | 36 | { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * The view class of the integration_search module |
|
5 | - * |
|
6 | - * @author NAVER ([email protected]) |
|
7 | - */ |
|
4 | + * The view class of the integration_search module |
|
5 | + * |
|
6 | + * @author NAVER ([email protected]) |
|
7 | + */ |
|
8 | 8 | class integration_searchView extends integration_search |
9 | 9 | { |
10 | 10 | /** |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | $logged_info = Context::get('logged_info'); |
40 | 40 | |
41 | 41 | // Check permissions |
42 | - if(!$this->grant->access) return new Object(-1,'msg_not_permitted'); |
|
42 | + if (!$this->grant->access) return new Object(-1, 'msg_not_permitted'); |
|
43 | 43 | |
44 | 44 | $config = $oModuleModel->getModuleConfig('integration_search'); |
45 | - if(!$config) $config = new stdClass; |
|
46 | - if(!$config->skin) |
|
45 | + if (!$config) $config = new stdClass; |
|
46 | + if (!$config->skin) |
|
47 | 47 | { |
48 | 48 | $config->skin = 'default'; |
49 | 49 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
@@ -67,16 +67,16 @@ discard block |
||
67 | 67 | Context::set('module_info', $skin_vars); |
68 | 68 | |
69 | 69 | $target = $config->target; |
70 | - if(!$target) $target = 'include'; |
|
70 | + if (!$target) $target = 'include'; |
|
71 | 71 | |
72 | - if(empty($config->target_module_srl)) |
|
72 | + if (empty($config->target_module_srl)) |
|
73 | 73 | $module_srl_list = array(); |
74 | 74 | else |
75 | - $module_srl_list = explode(',',$config->target_module_srl); |
|
75 | + $module_srl_list = explode(',', $config->target_module_srl); |
|
76 | 76 | |
77 | 77 | // https://github.com/xpressengine/xe-core/issues/1522 |
78 | 78 | // 검색 대상을 지정하지 않았을 때 검색 제한 |
79 | - if($target === 'include' && !count($module_srl_list)) |
|
79 | + if ($target === 'include' && !count($module_srl_list)) |
|
80 | 80 | { |
81 | 81 | $oMessageObject = ModuleHandler::getModuleInstance('message'); |
82 | 82 | $oMessageObject->setError(-1); |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | // Set a variable for search keyword |
91 | 91 | $is_keyword = Context::get('is_keyword'); |
92 | 92 | // Set page variables |
93 | - $page = (int)Context::get('page'); |
|
94 | - if(!$page) $page = 1; |
|
93 | + $page = (int) Context::get('page'); |
|
94 | + if (!$page) $page = 1; |
|
95 | 95 | // Search by search tab |
96 | 96 | $where = Context::get('where'); |
97 | 97 | // Create integration search model object |
98 | - if($is_keyword) |
|
98 | + if ($is_keyword) |
|
99 | 99 | { |
100 | 100 | $oIS = getModel('integration_search'); |
101 | - switch($where) |
|
101 | + switch ($where) |
|
102 | 102 | { |
103 | 103 | case 'document' : |
104 | 104 | $search_target = Context::get('search_target'); |
105 | - if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title'; |
|
105 | + if (!in_array($search_target, array('title', 'content', 'title_content', 'tag'))) $search_target = 'title'; |
|
106 | 106 | Context::set('search_target', $search_target); |
107 | 107 | |
108 | 108 | $output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | break; |
117 | 117 | case 'trackback' : |
118 | 118 | $search_target = Context::get('search_target'); |
119 | - if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title'; |
|
119 | + if (!in_array($search_target, array('title', 'url', 'blog_name', 'excerpt'))) $search_target = 'title'; |
|
120 | 120 | Context::set('search_target', $search_target); |
121 | 121 | |
122 | 122 | $output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->setTemplateFile("trackback", $page); |
125 | 125 | break; |
126 | 126 | case 'multimedia' : |
127 | - $output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20); |
|
127 | + $output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 20); |
|
128 | 128 | Context::set('output', $output); |
129 | 129 | $this->setTemplateFile("multimedia", $page); |
130 | 130 | break; |
@@ -39,24 +39,26 @@ discard block |
||
39 | 39 | $logged_info = Context::get('logged_info'); |
40 | 40 | |
41 | 41 | // Check permissions |
42 | - if(!$this->grant->access) return new Object(-1,'msg_not_permitted'); |
|
42 | + if(!$this->grant->access) { |
|
43 | + return new Object(-1,'msg_not_permitted'); |
|
44 | + } |
|
43 | 45 | |
44 | 46 | $config = $oModuleModel->getModuleConfig('integration_search'); |
45 | - if(!$config) $config = new stdClass; |
|
47 | + if(!$config) { |
|
48 | + $config = new stdClass; |
|
49 | + } |
|
46 | 50 | if(!$config->skin) |
47 | 51 | { |
48 | 52 | $config->skin = 'default'; |
49 | 53 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
50 | - } |
|
51 | - else |
|
54 | + } else |
|
52 | 55 | { |
53 | 56 | //check theme |
54 | 57 | $config_parse = explode('|@|', $config->skin); |
55 | 58 | if (count($config_parse) > 1) |
56 | 59 | { |
57 | 60 | $template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]); |
58 | - } |
|
59 | - else |
|
61 | + } else |
|
60 | 62 | { |
61 | 63 | $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); |
62 | 64 | } |
@@ -67,12 +69,15 @@ discard block |
||
67 | 69 | Context::set('module_info', $skin_vars); |
68 | 70 | |
69 | 71 | $target = $config->target; |
70 | - if(!$target) $target = 'include'; |
|
72 | + if(!$target) { |
|
73 | + $target = 'include'; |
|
74 | + } |
|
71 | 75 | |
72 | - if(empty($config->target_module_srl)) |
|
73 | - $module_srl_list = array(); |
|
74 | - else |
|
75 | - $module_srl_list = explode(',',$config->target_module_srl); |
|
76 | + if(empty($config->target_module_srl)) { |
|
77 | + $module_srl_list = array(); |
|
78 | + } else { |
|
79 | + $module_srl_list = explode(',',$config->target_module_srl); |
|
80 | + } |
|
76 | 81 | |
77 | 82 | // https://github.com/xpressengine/xe-core/issues/1522 |
78 | 83 | // 검색 대상을 지정하지 않았을 때 검색 제한 |
@@ -91,7 +96,9 @@ discard block |
||
91 | 96 | $is_keyword = Context::get('is_keyword'); |
92 | 97 | // Set page variables |
93 | 98 | $page = (int)Context::get('page'); |
94 | - if(!$page) $page = 1; |
|
99 | + if(!$page) { |
|
100 | + $page = 1; |
|
101 | + } |
|
95 | 102 | // Search by search tab |
96 | 103 | $where = Context::get('where'); |
97 | 104 | // Create integration search model object |
@@ -102,7 +109,9 @@ discard block |
||
102 | 109 | { |
103 | 110 | case 'document' : |
104 | 111 | $search_target = Context::get('search_target'); |
105 | - if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title'; |
|
112 | + if(!in_array($search_target, array('title','content','title_content','tag'))) { |
|
113 | + $search_target = 'title'; |
|
114 | + } |
|
106 | 115 | Context::set('search_target', $search_target); |
107 | 116 | |
108 | 117 | $output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -116,7 +125,9 @@ discard block |
||
116 | 125 | break; |
117 | 126 | case 'trackback' : |
118 | 127 | $search_target = Context::get('search_target'); |
119 | - if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title'; |
|
128 | + if(!in_array($search_target, array('title','url','blog_name','excerpt'))) { |
|
129 | + $search_target = 'title'; |
|
130 | + } |
|
120 | 131 | Context::set('search_target', $search_target); |
121 | 132 | |
122 | 133 | $output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10); |
@@ -144,8 +155,7 @@ discard block |
||
144 | 155 | $this->setTemplateFile("index", $page); |
145 | 156 | break; |
146 | 157 | } |
147 | - } |
|
148 | - else |
|
158 | + } else |
|
149 | 159 | { |
150 | 160 | $this->setTemplateFile("no_keywords"); |
151 | 161 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | |
339 | 339 | /** |
340 | 340 | * Adding Layout Code |
341 | - * @return void|Object (void : success, Object : fail) |
|
341 | + * @return Object|null (void : success, Object : fail) |
|
342 | 342 | */ |
343 | 343 | function procLayoutAdminCodeUpdate() |
344 | 344 | { |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | /** |
373 | 373 | * Reset layout code |
374 | - * @return void|Object (void : success, Object : fail) |
|
374 | + * @return Object|null (void : success, Object : fail) |
|
375 | 375 | */ |
376 | 376 | function procLayoutAdminCodeReset() |
377 | 377 | { |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * insert image into user layout |
422 | 422 | * @param int $layout_srl |
423 | - * @param object $source file data |
|
423 | + * @param string $source file data |
|
424 | 424 | * @return boolean (true : success, false : fail) |
425 | 425 | */ |
426 | 426 | function insertUserLayoutImage($layout_srl,$source) |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * Save layout configuration |
476 | 476 | * save in "ini" format for faceoff |
477 | 477 | * @deprecated |
478 | - * @return void|Object (void : success, Object : fail) |
|
478 | + * @return Object|null (void : success, Object : fail) |
|
479 | 479 | */ |
480 | 480 | function procLayoutAdminUserValueInsert() |
481 | 481 | { |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | /** |
545 | 545 | * Add the widget code for faceoff into user layout file |
546 | 546 | * @param int $layout_srl |
547 | - * @param object $arg |
|
547 | + * @param null|stdClass $arg |
|
548 | 548 | * @param string $content |
549 | 549 | * @return string |
550 | 550 | */ |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | |
587 | 587 | /** |
588 | 588 | * export user layout |
589 | - * @return void |
|
589 | + * @return Object|null |
|
590 | 590 | */ |
591 | 591 | function procLayoutAdminUserLayoutExport() |
592 | 592 | { |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | /** |
683 | 683 | * faceoff import |
684 | 684 | * @deprecated |
685 | - * @return void |
|
685 | + * @return ModuleObject|null |
|
686 | 686 | */ |
687 | 687 | function procLayoutAdminUserLayoutImport() |
688 | 688 | { |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | /** |
844 | 844 | * Layout file copy |
845 | 845 | * @param $sourceLayoutSrl origin layout number |
846 | - * @param $targetLayoutSrl origin layout number |
|
846 | + * @param integer $targetLayoutSrl origin layout number |
|
847 | 847 | * @return void |
848 | 848 | */ |
849 | 849 | function _copyLayoutFile($sourceLayoutSrl, $targetLayoutSrl) |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class layoutAdminController |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * admin controller class of the layout module |
|
7 | - */ |
|
4 | + * @class layoutAdminController |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * admin controller class of the layout module |
|
7 | + */ |
|
8 | 8 | class layoutAdminController extends layout |
9 | 9 | { |
10 | 10 | /** |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function procLayoutAdminInsert() |
25 | 25 | { |
26 | - if(Context::get('layout') == 'faceoff') return $this->stop('not supported'); |
|
26 | + if (Context::get('layout') == 'faceoff') return $this->stop('not supported'); |
|
27 | 27 | |
28 | 28 | // Get information to create a layout |
29 | 29 | $site_module_info = Context::get('site_module_info'); |
30 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
30 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
31 | 31 | $args->layout_srl = getNextSequence(); |
32 | 32 | $args->layout = Context::get('layout'); |
33 | 33 | $args->title = Context::get('title'); |
34 | 34 | $args->layout_type = Context::get('_layout_type'); |
35 | - if(!$args->layout_type) $args->layout_type = "P"; |
|
35 | + if (!$args->layout_type) $args->layout_type = "P"; |
|
36 | 36 | |
37 | 37 | // Insert into the DB |
38 | 38 | $output = $this->insertLayout($args); |
39 | - if(!$output->toBool()) return $output; |
|
39 | + if (!$output->toBool()) return $output; |
|
40 | 40 | |
41 | 41 | // initiate if it is faceoff layout |
42 | 42 | $this->initLayout($args->layout_srl, $args->layout); |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | { |
71 | 71 | $oLayoutModel = getModel('layout'); |
72 | 72 | // Import a sample layout if it is faceoff |
73 | - if($oLayoutModel->useDefaultLayout($layout_name)) |
|
73 | + if ($oLayoutModel->useDefaultLayout($layout_name)) |
|
74 | 74 | { |
75 | - $this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar'); |
|
75 | + $this->importLayout($layout_srl, $this->module_path . 'tpl/faceOff_sample.tar'); |
|
76 | 76 | // Remove a directory |
77 | 77 | } |
78 | 78 | else |
@@ -101,25 +101,25 @@ discard block |
||
101 | 101 | $is_sitemap = $extra_vars->is_sitemap; |
102 | 102 | unset($extra_vars->is_sitemap); |
103 | 103 | |
104 | - $args = Context::gets('layout_srl','title'); |
|
104 | + $args = Context::gets('layout_srl', 'title'); |
|
105 | 105 | // Get layout information |
106 | 106 | $oLayoutModel = getModel('layout'); |
107 | 107 | $oMenuAdminModel = getAdminModel('menu'); |
108 | 108 | $layout_info = $oLayoutModel->getLayout($args->layout_srl); |
109 | 109 | |
110 | - if($layout_info->menu) |
|
110 | + if ($layout_info->menu) |
|
111 | 111 | { |
112 | 112 | $menus = get_object_vars($layout_info->menu); |
113 | 113 | } |
114 | - if(count($menus)) |
|
114 | + if (count($menus)) |
|
115 | 115 | { |
116 | - foreach($menus as $menu_id => $val) |
|
116 | + foreach ($menus as $menu_id => $val) |
|
117 | 117 | { |
118 | 118 | $menu_srl = Context::get($menu_id); |
119 | - if(!$menu_srl) continue; |
|
119 | + if (!$menu_srl) continue; |
|
120 | 120 | |
121 | 121 | // if menu is -1, get default menu in site |
122 | - if($menu_srl == -1) |
|
122 | + if ($menu_srl == -1) |
|
123 | 123 | { |
124 | 124 | $oModuleModel = getModel('module'); |
125 | 125 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $tmpArgs->url = $start_module->mid; |
128 | 128 | $tmpArgs->site_srl = 0; |
129 | 129 | $output = executeQuery('menu.getMenuItemByUrl', $tmpArgs); |
130 | - if(!$output->toBool()) |
|
130 | + if (!$output->toBool()) |
|
131 | 131 | { |
132 | 132 | return new Object(-1, 'fail_to_update'); |
133 | 133 | } |
@@ -143,31 +143,31 @@ discard block |
||
143 | 143 | $apply_layout = Context::get('apply_layout'); |
144 | 144 | $apply_mobile_view = Context::get('apply_mobile_view'); |
145 | 145 | |
146 | - if($apply_layout=='Y' || $apply_mobile_view=='Y') |
|
146 | + if ($apply_layout == 'Y' || $apply_mobile_view == 'Y') |
|
147 | 147 | { |
148 | 148 | $menu_args = new stdClass(); |
149 | 149 | $menu_args->menu_srl = $menu_srl; |
150 | 150 | $menu_args->site_srl = $layout_info->site_srl; |
151 | 151 | $output = executeQueryArray('layout.getLayoutModules', $menu_args); |
152 | - if($output->data) |
|
152 | + if ($output->data) |
|
153 | 153 | { |
154 | 154 | $modules = array(); |
155 | - for($i=0;$i<count($output->data);$i++) |
|
155 | + for ($i = 0; $i < count($output->data); $i++) |
|
156 | 156 | { |
157 | 157 | $modules[] = $output->data[$i]->module_srl; |
158 | 158 | } |
159 | 159 | |
160 | - if(count($modules)) |
|
160 | + if (count($modules)) |
|
161 | 161 | { |
162 | 162 | $update_args = new stdClass(); |
163 | - $update_args->module_srls = implode(',',$modules); |
|
164 | - if($apply_layout == "Y") |
|
163 | + $update_args->module_srls = implode(',', $modules); |
|
164 | + if ($apply_layout == "Y") |
|
165 | 165 | { |
166 | 166 | $update_args->layout_srl = $args->layout_srl; |
167 | 167 | } |
168 | - if($layout_info->layout_type == "M") |
|
168 | + if ($layout_info->layout_type == "M") |
|
169 | 169 | { |
170 | - if(Context::get('apply_mobile_view') == "Y") |
|
170 | + if (Context::get('apply_mobile_view') == "Y") |
|
171 | 171 | { |
172 | 172 | $update_args->use_mobile = "Y"; |
173 | 173 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
182 | - if($oCacheHandler->isSupport()) |
|
182 | + if ($oCacheHandler->isSupport()) |
|
183 | 183 | { |
184 | 184 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
185 | 185 | } |
@@ -191,21 +191,21 @@ discard block |
||
191 | 191 | |
192 | 192 | $tmpDir = sprintf('./files/attach/images/%s/tmp', $args->layout_srl); |
193 | 193 | // Separately handle if a type of extra_vars is an image |
194 | - if($layout_info->extra_var) |
|
194 | + if ($layout_info->extra_var) |
|
195 | 195 | { |
196 | - foreach($layout_info->extra_var as $name => $vars) |
|
196 | + foreach ($layout_info->extra_var as $name => $vars) |
|
197 | 197 | { |
198 | - if($vars->type!='image') continue; |
|
198 | + if ($vars->type != 'image') continue; |
|
199 | 199 | |
200 | 200 | $fileName = $extra_vars->{$name}; |
201 | - if($vars->value == $fileName) |
|
201 | + if ($vars->value == $fileName) |
|
202 | 202 | { |
203 | 203 | continue; |
204 | 204 | } |
205 | 205 | |
206 | 206 | FileHandler::removeFile($vars->value); |
207 | 207 | |
208 | - if(!$fileName) |
|
208 | + if (!$fileName) |
|
209 | 209 | { |
210 | 210 | continue; |
211 | 211 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $pathInfo = pathinfo($fileName); |
214 | 214 | $tmpFileName = sprintf('%s/tmp/%s', $pathInfo['dirname'], $pathInfo['basename']); |
215 | 215 | |
216 | - if(!FileHandler::moveFile($tmpFileName, $fileName)) |
|
216 | + if (!FileHandler::moveFile($tmpFileName, $fileName)) |
|
217 | 217 | { |
218 | 218 | unset($extra_vars->{$name}); |
219 | 219 | } |
@@ -225,21 +225,21 @@ discard block |
||
225 | 225 | $oModuleController = getController('module'); |
226 | 226 | $layout_config = new stdClass(); |
227 | 227 | $layout_config->header_script = Context::get('header_script'); |
228 | - $oModuleController->insertModulePartConfig('layout',$args->layout_srl,$layout_config); |
|
228 | + $oModuleController->insertModulePartConfig('layout', $args->layout_srl, $layout_config); |
|
229 | 229 | // Save a title of the menu |
230 | 230 | $extra_vars->menu_name_list = $menu_name_list; |
231 | 231 | // Variable setting for DB insert |
232 | 232 | $args->extra_vars = serialize($extra_vars); |
233 | 233 | |
234 | 234 | $output = $this->updateLayout($args); |
235 | - if(!$output->toBool()) |
|
235 | + if (!$output->toBool()) |
|
236 | 236 | { |
237 | 237 | return $output; |
238 | 238 | } |
239 | 239 | |
240 | 240 | FileHandler::removeDir($tmpDir); |
241 | 241 | |
242 | - if(!$is_sitemap) |
|
242 | + if (!$is_sitemap) |
|
243 | 243 | { |
244 | 244 | return $this->setRedirectUrl(Context::get('error_return_url'), $output); |
245 | 245 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | function updateLayout($args) { |
260 | 260 | $output = executeQuery('layout.updateLayout', $args); |
261 | - if($output->toBool()) |
|
261 | + if ($output->toBool()) |
|
262 | 262 | { |
263 | 263 | $oLayoutModel = getModel('layout'); |
264 | 264 | $cache_file = $oLayoutModel->getUserLayoutCache($args->layout_srl, Context::getLangType()); |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | { |
290 | 290 | $oLayoutModel = getModel('layout'); |
291 | 291 | |
292 | - if($force) |
|
292 | + if ($force) |
|
293 | 293 | { |
294 | 294 | $layoutInfo = $oLayoutModel->getLayout($layout_srl); |
295 | - if($layoutInfo) |
|
295 | + if ($layoutInfo) |
|
296 | 296 | { |
297 | 297 | $layoutList = $oLayoutModel->getLayoutInstanceList($layoutInfo->site_srl, $layoutInfo->layout_type, $layoutInfo->layout, array('layout_srl', 'layout')); |
298 | - if(count($layoutList) <= 1) |
|
298 | + if (count($layoutList) <= 1) |
|
299 | 299 | { |
300 | 300 | // uninstall package |
301 | 301 | $path = $layoutInfo->path; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($path); |
305 | 305 | $oAutoinstallAdminController = getAdminController('autoinstall'); |
306 | 306 | |
307 | - if($packageSrl) |
|
307 | + if ($packageSrl) |
|
308 | 308 | { |
309 | 309 | $output = $oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl); |
310 | 310 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | $output = $oAutoinstallAdminController->uninstallPackageByPath($path); |
314 | 314 | } |
315 | 315 | |
316 | - if(!$output->toBool()) |
|
316 | + if (!$output->toBool()) |
|
317 | 317 | { |
318 | 318 | return new Object(-1, $output->message); |
319 | 319 | } |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | $args->layout_srl = $layout_srl; |
332 | 332 | $output = executeQuery("layout.deleteLayout", $args); |
333 | 333 | |
334 | - if(!$output->toBool()) return $output; |
|
334 | + if (!$output->toBool()) return $output; |
|
335 | 335 | |
336 | - return new Object(0,'success_deleted'); |
|
336 | + return new Object(0, 'success_deleted'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $code_css = Context::get('code_css'); |
354 | 354 | $is_post = ($_SERVER['REQUEST_METHOD'] == 'POST'); |
355 | 355 | |
356 | - if(!$layout_srl || !$code || !$is_post) |
|
356 | + if (!$layout_srl || !$code || !$is_post) |
|
357 | 357 | { |
358 | 358 | return new Object(-1, 'msg_invalid_request'); |
359 | 359 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | function procLayoutAdminCodeReset() |
377 | 377 | { |
378 | 378 | $layout_srl = Context::get('layout_srl'); |
379 | - if(!$layout_srl) return new Object(-1, 'msg_invalid_request'); |
|
379 | + if (!$layout_srl) return new Object(-1, 'msg_invalid_request'); |
|
380 | 380 | |
381 | 381 | // delete user layout file |
382 | 382 | $oLayoutModel = getModel('layout'); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $info = $oLayoutModel->getLayout($layout_srl); |
387 | 387 | |
388 | 388 | // if face off delete, tmp file |
389 | - if($oLayoutModel->useDefaultLayout($info->layout)) |
|
389 | + if ($oLayoutModel->useDefaultLayout($info->layout)) |
|
390 | 390 | { |
391 | 391 | $this->deleteUserLayoutTempFile($layout_srl); |
392 | 392 | $faceoff_css = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl); |
@@ -404,14 +404,14 @@ discard block |
||
404 | 404 | */ |
405 | 405 | function procLayoutAdminUserImageUpload() |
406 | 406 | { |
407 | - if(!Context::isUploaded()) exit(); |
|
407 | + if (!Context::isUploaded()) exit(); |
|
408 | 408 | |
409 | 409 | $image = Context::get('user_layout_image'); |
410 | 410 | $layout_srl = Context::get('layout_srl'); |
411 | - if(!is_uploaded_file($image['tmp_name'])) exit(); |
|
411 | + if (!is_uploaded_file($image['tmp_name'])) exit(); |
|
412 | 412 | |
413 | 413 | $this->insertUserLayoutImage($layout_srl, $image); |
414 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
414 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
415 | 415 | $this->setTemplateFile("top_refresh.html"); |
416 | 416 | |
417 | 417 | $this->setRedirectUrl(Context::get('error_return_url')); |
@@ -423,24 +423,24 @@ discard block |
||
423 | 423 | * @param object $source file data |
424 | 424 | * @return boolean (true : success, false : fail) |
425 | 425 | */ |
426 | - function insertUserLayoutImage($layout_srl,$source) |
|
426 | + function insertUserLayoutImage($layout_srl, $source) |
|
427 | 427 | { |
428 | 428 | $oLayoutModel = getModel('layout'); |
429 | 429 | $path = $oLayoutModel->getUserLayoutImagePath($layout_srl); |
430 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
430 | + if (!is_dir($path)) FileHandler::makeDir($path); |
|
431 | 431 | |
432 | 432 | $filename = strtolower($source['name']); |
433 | - if($filename != urlencode($filename)) |
|
433 | + if ($filename != urlencode($filename)) |
|
434 | 434 | { |
435 | - $ext = substr(strrchr($filename,'.'),1); |
|
435 | + $ext = substr(strrchr($filename, '.'), 1); |
|
436 | 436 | $filename = sprintf('%s.%s', md5($filename), $ext); |
437 | 437 | } |
438 | 438 | |
439 | 439 | // Check uploaded file |
440 | - if(!checkUploadedFile($source['tmp_name'])) return false; |
|
440 | + if (!checkUploadedFile($source['tmp_name'])) return false; |
|
441 | 441 | |
442 | - if(file_exists($path .'/'. $filename)) @unlink($path . $filename); |
|
443 | - if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false; |
|
442 | + if (file_exists($path . '/' . $filename)) @unlink($path . $filename); |
|
443 | + if (!move_uploaded_file($source['tmp_name'], $path . $filename)) return false; |
|
444 | 444 | return true; |
445 | 445 | } |
446 | 446 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | { |
453 | 453 | $filename = Context::get('filename'); |
454 | 454 | $layout_srl = Context::get('layout_srl'); |
455 | - $this->removeUserLayoutImage($layout_srl,$filename); |
|
455 | + $this->removeUserLayoutImage($layout_srl, $filename); |
|
456 | 456 | $this->setMessage('success_deleted'); |
457 | 457 | $this->setRedirectUrl(Context::get('error_return_url')); |
458 | 458 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param string $filename |
464 | 464 | * @return void |
465 | 465 | */ |
466 | - function removeUserLayoutImage($layout_srl,$filename) |
|
466 | + function removeUserLayoutImage($layout_srl, $filename) |
|
467 | 467 | { |
468 | 468 | $oLayoutModel = getModel('layout'); |
469 | 469 | $path = $oLayoutModel->getUserLayoutImagePath($layout_srl); |
@@ -482,19 +482,19 @@ discard block |
||
482 | 482 | $oModuleModel = getModel('module'); |
483 | 483 | |
484 | 484 | $mid = Context::get('mid'); |
485 | - if(!$mid) return new Object(-1, 'msg_invalid_request'); |
|
485 | + if (!$mid) return new Object(-1, 'msg_invalid_request'); |
|
486 | 486 | |
487 | 487 | $site_module_info = Context::get('site_module_info'); |
488 | 488 | $columnList = array('layout_srl'); |
489 | 489 | $module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList); |
490 | 490 | $layout_srl = $module_info->layout_srl; |
491 | - if(!$layout_srl) return new Object(-1, 'msg_invalid_request'); |
|
491 | + if (!$layout_srl) return new Object(-1, 'msg_invalid_request'); |
|
492 | 492 | |
493 | 493 | $oLayoutModel = getModel('layout'); |
494 | 494 | |
495 | 495 | // save tmp? |
496 | 496 | $temp = Context::get('saveTemp'); |
497 | - if($temp =='Y') |
|
497 | + if ($temp == 'Y') |
|
498 | 498 | { |
499 | 499 | $oLayoutModel->setUseUserLayoutTemp(); |
500 | 500 | } |
@@ -504,28 +504,28 @@ discard block |
||
504 | 504 | $this->deleteUserLayoutTempFile($layout_srl); |
505 | 505 | } |
506 | 506 | |
507 | - $this->add('saveTemp',$temp); |
|
507 | + $this->add('saveTemp', $temp); |
|
508 | 508 | |
509 | 509 | // write user layout |
510 | - $extension_obj = Context::gets('e1','e2','neck','knee'); |
|
510 | + $extension_obj = Context::gets('e1', 'e2', 'neck', 'knee'); |
|
511 | 511 | |
512 | 512 | $file = $oLayoutModel->getUserLayoutHtml($layout_srl); |
513 | 513 | $content = FileHandler::readFile($file); |
514 | - $content = $this->addExtension($layout_srl,$extension_obj,$content); |
|
515 | - FileHandler::writeFile($file,$content); |
|
514 | + $content = $this->addExtension($layout_srl, $extension_obj, $content); |
|
515 | + FileHandler::writeFile($file, $content); |
|
516 | 516 | |
517 | 517 | // write faceoff.css |
518 | 518 | $css = stripslashes(Context::get('css')); |
519 | 519 | |
520 | 520 | $css_file = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl); |
521 | - FileHandler::writeFile($css_file,$css); |
|
521 | + FileHandler::writeFile($css_file, $css); |
|
522 | 522 | |
523 | 523 | // write ini |
524 | - $obj = Context::gets('type','align','column'); |
|
525 | - $obj = (array)$obj; |
|
524 | + $obj = Context::gets('type', 'align', 'column'); |
|
525 | + $obj = (array) $obj; |
|
526 | 526 | $src = $oLayoutModel->getUserLayoutIniConfig($layout_srl); |
527 | - foreach($obj as $key => $val) $src[$key] = $val; |
|
528 | - $this->insertUserLayoutValue($layout_srl,$src); |
|
527 | + foreach ($obj as $key => $val) $src[$key] = $val; |
|
528 | + $this->insertUserLayoutValue($layout_srl, $src); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @param object $arr layout ini |
535 | 535 | * @return void |
536 | 536 | */ |
537 | - function insertUserLayoutValue($layout_srl,$arr) |
|
537 | + function insertUserLayoutValue($layout_srl, $arr) |
|
538 | 538 | { |
539 | 539 | $oLayoutModel = getModel('layout'); |
540 | 540 | $file = $oLayoutModel->getUserLayoutIni($layout_srl); |
@@ -548,24 +548,24 @@ discard block |
||
548 | 548 | * @param string $content |
549 | 549 | * @return string |
550 | 550 | */ |
551 | - function addExtension($layout_srl,$arg,$content) |
|
551 | + function addExtension($layout_srl, $arg, $content) |
|
552 | 552 | { |
553 | 553 | $oLayoutModel = getModel('layout'); |
554 | 554 | $reg = '/(<\!\-\- start\-e1 \-\->)(.*)(<\!\-\- end\-e1 \-\->)/i'; |
555 | - $extension_content = '\1' .stripslashes($arg->e1) . '\3'; |
|
556 | - $content = preg_replace($reg,$extension_content,$content); |
|
555 | + $extension_content = '\1' . stripslashes($arg->e1) . '\3'; |
|
556 | + $content = preg_replace($reg, $extension_content, $content); |
|
557 | 557 | |
558 | 558 | $reg = '/(<\!\-\- start\-e2 \-\->)(.*)(<\!\-\- end\-e2 \-\->)/i'; |
559 | - $extension_content = '\1' .stripslashes($arg->e2) . '\3'; |
|
560 | - $content = preg_replace($reg,$extension_content,$content); |
|
559 | + $extension_content = '\1' . stripslashes($arg->e2) . '\3'; |
|
560 | + $content = preg_replace($reg, $extension_content, $content); |
|
561 | 561 | |
562 | 562 | $reg = '/(<\!\-\- start\-neck \-\->)(.*)(<\!\-\- end\-neck \-\->)/i'; |
563 | - $extension_content = '\1' .stripslashes($arg->neck) . '\3'; |
|
564 | - $content = preg_replace($reg,$extension_content,$content); |
|
563 | + $extension_content = '\1' . stripslashes($arg->neck) . '\3'; |
|
564 | + $content = preg_replace($reg, $extension_content, $content); |
|
565 | 565 | |
566 | 566 | $reg = '/(<\!\-\- start\-knee \-\->)(.*)(<\!\-\- end\-knee \-\->)/i'; |
567 | - $extension_content = '\1' .stripslashes($arg->knee) . '\3'; |
|
568 | - $content = preg_replace($reg,$extension_content,$content); |
|
567 | + $extension_content = '\1' . stripslashes($arg->knee) . '\3'; |
|
568 | + $content = preg_replace($reg, $extension_content, $content); |
|
569 | 569 | return $content; |
570 | 570 | } |
571 | 571 | |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | { |
579 | 579 | $oLayoutModel = getModel('layout'); |
580 | 580 | $file_list = $oLayoutModel->getUserLayoutTempFileList($layout_srl); |
581 | - foreach($file_list as $key => $file) |
|
581 | + foreach ($file_list as $key => $file) |
|
582 | 582 | { |
583 | 583 | FileHandler::removeFile($file); |
584 | 584 | } |
@@ -591,9 +591,9 @@ discard block |
||
591 | 591 | function procLayoutAdminUserLayoutExport() |
592 | 592 | { |
593 | 593 | $layout_srl = Context::get('layout_srl'); |
594 | - if(!$layout_srl) return new Object('-1','msg_invalid_request'); |
|
594 | + if (!$layout_srl) return new Object('-1', 'msg_invalid_request'); |
|
595 | 595 | |
596 | - require_once(_XE_PATH_.'libs/tar.class.php'); |
|
596 | + require_once(_XE_PATH_ . 'libs/tar.class.php'); |
|
597 | 597 | $oLayoutModel = getModel('layout'); |
598 | 598 | |
599 | 599 | // Copy files to temp path |
@@ -606,21 +606,21 @@ discard block |
||
606 | 606 | $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl); |
607 | 607 | unset($file_list[2]); |
608 | 608 | |
609 | - foreach($file_list as $file) |
|
609 | + foreach ($file_list as $file) |
|
610 | 610 | { |
611 | - if(strncasecmp('images', $file, 6) === 0) continue; |
|
611 | + if (strncasecmp('images', $file, 6) === 0) continue; |
|
612 | 612 | |
613 | 613 | // replace path |
614 | 614 | $file = $target_path . $file; |
615 | 615 | $content = FileHandler::readFile($file); |
616 | 616 | $pattern = '/(http:\/\/[^ ]+)?(\.\/)?' . str_replace('/', '\/', (str_replace('./', '', $file_path))) . '/'; |
617 | - if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css') |
|
617 | + if (basename($file) == 'faceoff.css' || basename($file) == 'layout.css') |
|
618 | 618 | $content = preg_replace($pattern, '../', $content); |
619 | 619 | else |
620 | 620 | $content = preg_replace($pattern, './', $content); |
621 | 621 | |
622 | 622 | // replace ini config |
623 | - foreach($ini_config as $key => $value) |
|
623 | + foreach ($ini_config as $key => $value) |
|
624 | 624 | { |
625 | 625 | $content = str_replace('{$layout_info->faceoff_ini_config[\'' . $key . '\']}', $value, $content); |
626 | 626 | } |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $tar = new tar(); |
659 | 659 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0)); |
660 | 660 | chdir($user_layout_path); |
661 | - foreach($file_list as $key => $file) $tar->addFile($file); |
|
661 | + foreach ($file_list as $key => $file) $tar->addFile($file); |
|
662 | 662 | |
663 | 663 | $stream = $tar->toTarStream(); |
664 | 664 | $filename = 'faceoff_' . date('YmdHis') . '.tar'; |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | header("Content-Type: application/x-compressed"); |
668 | 668 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
669 | 669 | // header("Content-Length: " .strlen($stream)); ?? why?? |
670 | - header('Content-Disposition: attachment; filename="'. $filename .'"'); |
|
670 | + header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
671 | 671 | header("Content-Transfer-Encoding: binary\n"); |
672 | 672 | echo $stream; |
673 | 673 | // Close Context and then exit |
@@ -689,20 +689,20 @@ discard block |
||
689 | 689 | return $this->stop('not supported'); |
690 | 690 | |
691 | 691 | // check upload |
692 | - if(!Context::isUploaded()) exit(); |
|
692 | + if (!Context::isUploaded()) exit(); |
|
693 | 693 | $file = Context::get('file'); |
694 | - if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit(); |
|
694 | + if (!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit(); |
|
695 | 695 | |
696 | - if(substr_compare($file['name'], '.tar', -4) !== 0) exit(); |
|
696 | + if (substr_compare($file['name'], '.tar', -4) !== 0) exit(); |
|
697 | 697 | |
698 | 698 | $layout_srl = Context::get('layout_srl'); |
699 | - if(!$layout_srl) exit(); |
|
699 | + if (!$layout_srl) exit(); |
|
700 | 700 | |
701 | 701 | $oLayoutModel = getModel('layout'); |
702 | 702 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl)); |
703 | - if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) exit(); |
|
703 | + if (!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) exit(); |
|
704 | 704 | |
705 | - $this->importLayout($layout_srl, $user_layout_path.'faceoff.tar'); |
|
705 | + $this->importLayout($layout_srl, $user_layout_path . 'faceoff.tar'); |
|
706 | 706 | |
707 | 707 | $this->setRedirectUrl(Context::get('error_return_url')); |
708 | 708 | } |
@@ -714,12 +714,12 @@ discard block |
||
714 | 714 | function procLayoutAdminCopyLayout() |
715 | 715 | { |
716 | 716 | $sourceArgs = Context::getRequestVars(); |
717 | - if($sourceArgs->layout == 'faceoff') |
|
717 | + if ($sourceArgs->layout == 'faceoff') |
|
718 | 718 | { |
719 | 719 | return $this->stop('not supported'); |
720 | 720 | } |
721 | 721 | |
722 | - if(!$sourceArgs->layout_srl) |
|
722 | + if (!$sourceArgs->layout_srl) |
|
723 | 723 | { |
724 | 724 | return $this->stop('msg_empty_origin_layout'); |
725 | 725 | } |
@@ -727,12 +727,12 @@ discard block |
||
727 | 727 | $oLayoutModel = getModel('layout'); |
728 | 728 | $layout = $oLayoutModel->getLayout($sourceArgs->layout_srl); |
729 | 729 | |
730 | - if(!$sourceArgs->title) |
|
730 | + if (!$sourceArgs->title) |
|
731 | 731 | { |
732 | - $sourceArgs->title = array($layout->title.'_'.$this->_makeRandomMid()); |
|
732 | + $sourceArgs->title = array($layout->title . '_' . $this->_makeRandomMid()); |
|
733 | 733 | } |
734 | 734 | |
735 | - if(!is_array($sourceArgs->title) || count($sourceArgs->title) == 0) |
|
735 | + if (!is_array($sourceArgs->title) || count($sourceArgs->title) == 0) |
|
736 | 736 | { |
737 | 737 | return $this->stop('msg_empty_target_layout'); |
738 | 738 | } |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | $args->extra_vars = $output->extra_vars; |
743 | 743 | $extra_vars = unserialize($args->extra_vars); |
744 | 744 | |
745 | - if($layout->extra_var_count) { |
|
745 | + if ($layout->extra_var_count) { |
|
746 | 746 | $reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/"; |
747 | - if($extra_vars) foreach($extra_vars as $key => $val) { |
|
748 | - if($layout->extra_var->{$key}->type == 'image') { |
|
749 | - if(!preg_match($reg,$val,$matches)) continue; |
|
747 | + if ($extra_vars) foreach ($extra_vars as $key => $val) { |
|
748 | + if ($layout->extra_var->{$key}->type == 'image') { |
|
749 | + if (!preg_match($reg, $val, $matches)) continue; |
|
750 | 750 | $image_list[$key]->filename = $matches[2]; |
751 | 751 | $image_list[$key]->old_file = $val; |
752 | 752 | } |
@@ -758,19 +758,19 @@ discard block |
||
758 | 758 | $layout_config->header_script = $extra_vars->header_script; |
759 | 759 | |
760 | 760 | // Get information to create a layout |
761 | - $args->site_srl = (int)$layout->site_srl; |
|
761 | + $args->site_srl = (int) $layout->site_srl; |
|
762 | 762 | $args->layout = $layout->layout; |
763 | 763 | $args->layout_type = $layout->layout_type; |
764 | - if(!$args->layout_type) $args->layout_type = "P"; |
|
764 | + if (!$args->layout_type) $args->layout_type = "P"; |
|
765 | 765 | |
766 | 766 | $oDB = &DB::getInstance(); |
767 | 767 | $oDB->begin(); |
768 | 768 | |
769 | - if(is_array($sourceArgs->title)) |
|
769 | + if (is_array($sourceArgs->title)) |
|
770 | 770 | { |
771 | - foreach($sourceArgs->title AS $key=>$value) |
|
771 | + foreach ($sourceArgs->title AS $key=>$value) |
|
772 | 772 | { |
773 | - if(!trim($value)) |
|
773 | + if (!trim($value)) |
|
774 | 774 | { |
775 | 775 | continue; |
776 | 776 | } |
@@ -778,9 +778,9 @@ discard block |
||
778 | 778 | $args->layout_srl = getNextSequence(); |
779 | 779 | $args->title = $value; |
780 | 780 | |
781 | - if(is_array($image_list)) { |
|
782 | - foreach($image_list as $key=>$val) { |
|
783 | - $new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl,$val->filename); |
|
781 | + if (is_array($image_list)) { |
|
782 | + foreach ($image_list as $key=>$val) { |
|
783 | + $new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl, $val->filename); |
|
784 | 784 | FileHandler::copyFile($val->old_file, $new_file); |
785 | 785 | $extra_vars->{$key} = $new_file; |
786 | 786 | } |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | // Insert into the DB |
794 | 794 | $output = $this->insertLayout($args); |
795 | - if(!$output->toBool()) |
|
795 | + if (!$output->toBool()) |
|
796 | 796 | { |
797 | 797 | $oDB->rollback(); |
798 | 798 | return $output; |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | $oDB->commit(); |
816 | 816 | |
817 | 817 | $this->setMessage('success_registed'); |
818 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { |
|
818 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) { |
|
819 | 819 | global $lang; |
820 | 820 | htmlHeader(); |
821 | 821 | alertScript($lang->success_registed); |
@@ -831,13 +831,13 @@ discard block |
||
831 | 831 | { |
832 | 832 | $time = $_SERVER['REQUEST_TIME']; |
833 | 833 | $randomString = ""; |
834 | - for($i=0;$i<4;$i++) |
|
834 | + for ($i = 0; $i < 4; $i++) |
|
835 | 835 | { |
836 | - $doc = rand()%26+65; |
|
836 | + $doc = rand() % 26 + 65; |
|
837 | 837 | $randomString .= chr($doc); |
838 | 838 | } |
839 | 839 | |
840 | - return $randomString.substr($time, -4); |
|
840 | + return $randomString . substr($time, -4); |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | /** |
@@ -857,14 +857,14 @@ discard block |
||
857 | 857 | FileHandler::makeDir($targetImagePath); |
858 | 858 | |
859 | 859 | $sourceFileList = $oLayoutModel->getUserLayoutFileList($sourceLayoutSrl); |
860 | - foreach($sourceFileList as $key => $file) |
|
860 | + foreach ($sourceFileList as $key => $file) |
|
861 | 861 | { |
862 | - if(is_readable($sourceLayoutPath.$file)) |
|
862 | + if (is_readable($sourceLayoutPath . $file)) |
|
863 | 863 | { |
864 | - FileHandler::copyFile($sourceLayoutPath.$file, $targetLayoutPath.$file); |
|
865 | - if($file == 'layout.html' || $file == 'layout.css') |
|
864 | + FileHandler::copyFile($sourceLayoutPath . $file, $targetLayoutPath . $file); |
|
865 | + if ($file == 'layout.html' || $file == 'layout.css') |
|
866 | 866 | { |
867 | - $this->_changeFilepathInSource($targetLayoutPath.$file, $sourceImagePath, $targetImagePath); |
|
867 | + $this->_changeFilepathInSource($targetLayoutPath . $file, $sourceImagePath, $targetImagePath); |
|
868 | 868 | } |
869 | 869 | } |
870 | 870 | } |
@@ -893,23 +893,23 @@ discard block |
||
893 | 893 | $oLayoutModel = getModel('layout'); |
894 | 894 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl)); |
895 | 895 | $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl); |
896 | - foreach($file_list as $key => $file) |
|
896 | + foreach ($file_list as $key => $file) |
|
897 | 897 | { |
898 | 898 | FileHandler::removeFile($user_layout_path . $file); |
899 | 899 | } |
900 | 900 | |
901 | - require_once(_XE_PATH_.'libs/tar.class.php'); |
|
901 | + require_once(_XE_PATH_ . 'libs/tar.class.php'); |
|
902 | 902 | $image_path = $oLayoutModel->getUserLayoutImagePath($layout_srl); |
903 | 903 | FileHandler::makeDir($image_path); |
904 | 904 | $tar = new tar(); |
905 | 905 | $tar->openTAR($source_file); |
906 | 906 | // If layout.ini file does not exist |
907 | - if(!$tar->getFile('layout.ini')) return; |
|
907 | + if (!$tar->getFile('layout.ini')) return; |
|
908 | 908 | |
909 | - $replace_path = getNumberingPath($layout_srl,3); |
|
910 | - foreach($tar->files as $key => $info) |
|
909 | + $replace_path = getNumberingPath($layout_srl, 3); |
|
910 | + foreach ($tar->files as $key => $info) |
|
911 | 911 | { |
912 | - FileHandler::writeFile($user_layout_path . $info['name'],str_replace('__LAYOUT_PATH__',$replace_path,$info['file'])); |
|
912 | + FileHandler::writeFile($user_layout_path . $info['name'], str_replace('__LAYOUT_PATH__', $replace_path, $info['file'])); |
|
913 | 913 | } |
914 | 914 | // Remove uploaded file |
915 | 915 | FileHandler::removeFile($source_file); |
@@ -924,16 +924,16 @@ discard block |
||
924 | 924 | $name = Context::get('name'); |
925 | 925 | $img = Context::get('img'); |
926 | 926 | |
927 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
927 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
928 | 928 | $this->setTemplateFile("after_upload_config_image.html"); |
929 | 929 | |
930 | - if(!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name'])) |
|
930 | + if (!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name'])) |
|
931 | 931 | { |
932 | 932 | Context::set('msg', Context::getLang('upload failed')); |
933 | 933 | return; |
934 | 934 | } |
935 | 935 | |
936 | - if(!preg_match('/\.(jpg|jpeg|gif|png|swf)$/i', $img['name'])) |
|
936 | + if (!preg_match('/\.(jpg|jpeg|gif|png|swf)$/i', $img['name'])) |
|
937 | 937 | { |
938 | 938 | Context::set('msg', Context::getLang('msg_layout_image_target')); |
939 | 939 | return; |
@@ -941,18 +941,18 @@ discard block |
||
941 | 941 | |
942 | 942 | $path = sprintf('./files/attach/images/%s/', $layoutSrl); |
943 | 943 | $tmpPath = $path . 'tmp/'; |
944 | - if(!FileHandler::makeDir($tmpPath)) |
|
944 | + if (!FileHandler::makeDir($tmpPath)) |
|
945 | 945 | { |
946 | 946 | Context::set('msg', Context::getLang('make directory failed')); |
947 | 947 | return; |
948 | 948 | } |
949 | 949 | |
950 | - $ext = substr(strrchr($img['name'],'.'),1); |
|
951 | - $_fileName = md5(crypt(rand(1000000,900000), rand(0,100))).'.'.$ext; |
|
950 | + $ext = substr(strrchr($img['name'], '.'), 1); |
|
951 | + $_fileName = md5(crypt(rand(1000000, 900000), rand(0, 100))) . '.' . $ext; |
|
952 | 952 | $fileName = $path . $_fileName; |
953 | 953 | $tmpFileName = $tmpPath . $_fileName; |
954 | 954 | |
955 | - if(!move_uploaded_file($img['tmp_name'], $tmpFileName)) |
|
955 | + if (!move_uploaded_file($img['tmp_name'], $tmpFileName)) |
|
956 | 956 | { |
957 | 957 | Context::set('msg', Context::getLang('move file failed')); |
958 | 958 | return; |
@@ -971,15 +971,15 @@ discard block |
||
971 | 971 | $layoutSrl = Context::get('layout_srl'); |
972 | 972 | $name = Context::get('name'); |
973 | 973 | |
974 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
974 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
975 | 975 | $this->setTemplateFile("after_delete_config_image.html"); |
976 | 976 | |
977 | 977 | $oModel = getModel('layout'); |
978 | 978 | $layoutInfo = $oModel->getLayout($layoutSrl); |
979 | 979 | |
980 | - if($layoutInfo->extra_var_count) |
|
980 | + if ($layoutInfo->extra_var_count) |
|
981 | 981 | { |
982 | - foreach($layoutInfo->extra_var as $varId => $val) |
|
982 | + foreach ($layoutInfo->extra_var as $varId => $val) |
|
983 | 983 | { |
984 | 984 | $newLayoutInfo->{$varId} = $val->value; |
985 | 985 | } |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | $args->layout_srl = $layoutSrl; |
991 | 991 | $args->extra_vars = serialize($newLayoutInfo); |
992 | 992 | $output = $this->updateLayout($args); |
993 | - if(!$output->toBool()) |
|
993 | + if (!$output->toBool()) |
|
994 | 994 | { |
995 | 995 | Context::set('msg', Context::getLang($output->getMessage())); |
996 | 996 | return $output; |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function procLayoutAdminInsert() |
25 | 25 | { |
26 | - if(Context::get('layout') == 'faceoff') return $this->stop('not supported'); |
|
26 | + if(Context::get('layout') == 'faceoff') { |
|
27 | + return $this->stop('not supported'); |
|
28 | + } |
|
27 | 29 | |
28 | 30 | // Get information to create a layout |
29 | 31 | $site_module_info = Context::get('site_module_info'); |
@@ -32,11 +34,15 @@ discard block |
||
32 | 34 | $args->layout = Context::get('layout'); |
33 | 35 | $args->title = Context::get('title'); |
34 | 36 | $args->layout_type = Context::get('_layout_type'); |
35 | - if(!$args->layout_type) $args->layout_type = "P"; |
|
37 | + if(!$args->layout_type) { |
|
38 | + $args->layout_type = "P"; |
|
39 | + } |
|
36 | 40 | |
37 | 41 | // Insert into the DB |
38 | 42 | $output = $this->insertLayout($args); |
39 | - if(!$output->toBool()) return $output; |
|
43 | + if(!$output->toBool()) { |
|
44 | + return $output; |
|
45 | + } |
|
40 | 46 | |
41 | 47 | // initiate if it is faceoff layout |
42 | 48 | $this->initLayout($args->layout_srl, $args->layout); |
@@ -44,7 +50,9 @@ discard block |
||
44 | 50 | // update layout info |
45 | 51 | Context::set('layout_srl', $args->layout_srl); |
46 | 52 | $output = $this->procLayoutAdminUpdate(); |
47 | - if (!$output->toBool()) return $output; |
|
53 | + if (!$output->toBool()) { |
|
54 | + return $output; |
|
55 | + } |
|
48 | 56 | |
49 | 57 | return $this->setRedirectUrl(Context::get('success_return_url'), $output); |
50 | 58 | } |
@@ -74,8 +82,7 @@ discard block |
||
74 | 82 | { |
75 | 83 | $this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar'); |
76 | 84 | // Remove a directory |
77 | - } |
|
78 | - else |
|
85 | + } else |
|
79 | 86 | { |
80 | 87 | FileHandler::removeDir($oLayoutModel->getUserLayoutPath($layout_srl)); |
81 | 88 | } |
@@ -116,7 +123,9 @@ discard block |
||
116 | 123 | foreach($menus as $menu_id => $val) |
117 | 124 | { |
118 | 125 | $menu_srl = Context::get($menu_id); |
119 | - if(!$menu_srl) continue; |
|
126 | + if(!$menu_srl) { |
|
127 | + continue; |
|
128 | + } |
|
120 | 129 | |
121 | 130 | // if menu is -1, get default menu in site |
122 | 131 | if($menu_srl == -1) |
@@ -172,8 +181,7 @@ discard block |
||
172 | 181 | $update_args->use_mobile = "Y"; |
173 | 182 | } |
174 | 183 | $output = executeQuery('layout.updateModuleMLayout', $update_args); |
175 | - } |
|
176 | - else |
|
184 | + } else |
|
177 | 185 | { |
178 | 186 | $output = executeQuery('layout.updateModuleLayout', $update_args); |
179 | 187 | } |
@@ -195,7 +203,9 @@ discard block |
||
195 | 203 | { |
196 | 204 | foreach($layout_info->extra_var as $name => $vars) |
197 | 205 | { |
198 | - if($vars->type!='image') continue; |
|
206 | + if($vars->type!='image') { |
|
207 | + continue; |
|
208 | + } |
|
199 | 209 | |
200 | 210 | $fileName = $extra_vars->{$name}; |
201 | 211 | if($vars->value == $fileName) |
@@ -242,8 +252,7 @@ discard block |
||
242 | 252 | if(!$is_sitemap) |
243 | 253 | { |
244 | 254 | return $this->setRedirectUrl(Context::get('error_return_url'), $output); |
245 | - } |
|
246 | - else |
|
255 | + } else |
|
247 | 256 | { |
248 | 257 | $context = Context::getInstance(); |
249 | 258 | $context->setRequestMethod('JSON'); |
@@ -307,8 +316,7 @@ discard block |
||
307 | 316 | if($packageSrl) |
308 | 317 | { |
309 | 318 | $output = $oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl); |
310 | - } |
|
311 | - else |
|
319 | + } else |
|
312 | 320 | { |
313 | 321 | $output = $oAutoinstallAdminController->uninstallPackageByPath($path); |
314 | 322 | } |
@@ -331,7 +339,9 @@ discard block |
||
331 | 339 | $args->layout_srl = $layout_srl; |
332 | 340 | $output = executeQuery("layout.deleteLayout", $args); |
333 | 341 | |
334 | - if(!$output->toBool()) return $output; |
|
342 | + if(!$output->toBool()) { |
|
343 | + return $output; |
|
344 | + } |
|
335 | 345 | |
336 | 346 | return new Object(0,'success_deleted'); |
337 | 347 | } |
@@ -376,7 +386,9 @@ discard block |
||
376 | 386 | function procLayoutAdminCodeReset() |
377 | 387 | { |
378 | 388 | $layout_srl = Context::get('layout_srl'); |
379 | - if(!$layout_srl) return new Object(-1, 'msg_invalid_request'); |
|
389 | + if(!$layout_srl) { |
|
390 | + return new Object(-1, 'msg_invalid_request'); |
|
391 | + } |
|
380 | 392 | |
381 | 393 | // delete user layout file |
382 | 394 | $oLayoutModel = getModel('layout'); |
@@ -404,11 +416,15 @@ discard block |
||
404 | 416 | */ |
405 | 417 | function procLayoutAdminUserImageUpload() |
406 | 418 | { |
407 | - if(!Context::isUploaded()) exit(); |
|
419 | + if(!Context::isUploaded()) { |
|
420 | + exit(); |
|
421 | + } |
|
408 | 422 | |
409 | 423 | $image = Context::get('user_layout_image'); |
410 | 424 | $layout_srl = Context::get('layout_srl'); |
411 | - if(!is_uploaded_file($image['tmp_name'])) exit(); |
|
425 | + if(!is_uploaded_file($image['tmp_name'])) { |
|
426 | + exit(); |
|
427 | + } |
|
412 | 428 | |
413 | 429 | $this->insertUserLayoutImage($layout_srl, $image); |
414 | 430 | $this->setTemplatePath($this->module_path.'tpl'); |
@@ -427,7 +443,9 @@ discard block |
||
427 | 443 | { |
428 | 444 | $oLayoutModel = getModel('layout'); |
429 | 445 | $path = $oLayoutModel->getUserLayoutImagePath($layout_srl); |
430 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
446 | + if(!is_dir($path)) { |
|
447 | + FileHandler::makeDir($path); |
|
448 | + } |
|
431 | 449 | |
432 | 450 | $filename = strtolower($source['name']); |
433 | 451 | if($filename != urlencode($filename)) |
@@ -437,10 +455,16 @@ discard block |
||
437 | 455 | } |
438 | 456 | |
439 | 457 | // Check uploaded file |
440 | - if(!checkUploadedFile($source['tmp_name'])) return false; |
|
458 | + if(!checkUploadedFile($source['tmp_name'])) { |
|
459 | + return false; |
|
460 | + } |
|
441 | 461 | |
442 | - if(file_exists($path .'/'. $filename)) @unlink($path . $filename); |
|
443 | - if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false; |
|
462 | + if(file_exists($path .'/'. $filename)) { |
|
463 | + @unlink($path . $filename); |
|
464 | + } |
|
465 | + if(!move_uploaded_file($source['tmp_name'], $path . $filename )) { |
|
466 | + return false; |
|
467 | + } |
|
444 | 468 | return true; |
445 | 469 | } |
446 | 470 | |
@@ -482,13 +506,17 @@ discard block |
||
482 | 506 | $oModuleModel = getModel('module'); |
483 | 507 | |
484 | 508 | $mid = Context::get('mid'); |
485 | - if(!$mid) return new Object(-1, 'msg_invalid_request'); |
|
509 | + if(!$mid) { |
|
510 | + return new Object(-1, 'msg_invalid_request'); |
|
511 | + } |
|
486 | 512 | |
487 | 513 | $site_module_info = Context::get('site_module_info'); |
488 | 514 | $columnList = array('layout_srl'); |
489 | 515 | $module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList); |
490 | 516 | $layout_srl = $module_info->layout_srl; |
491 | - if(!$layout_srl) return new Object(-1, 'msg_invalid_request'); |
|
517 | + if(!$layout_srl) { |
|
518 | + return new Object(-1, 'msg_invalid_request'); |
|
519 | + } |
|
492 | 520 | |
493 | 521 | $oLayoutModel = getModel('layout'); |
494 | 522 | |
@@ -497,8 +525,7 @@ discard block |
||
497 | 525 | if($temp =='Y') |
498 | 526 | { |
499 | 527 | $oLayoutModel->setUseUserLayoutTemp(); |
500 | - } |
|
501 | - else |
|
528 | + } else |
|
502 | 529 | { |
503 | 530 | // delete temp files |
504 | 531 | $this->deleteUserLayoutTempFile($layout_srl); |
@@ -524,7 +551,9 @@ discard block |
||
524 | 551 | $obj = Context::gets('type','align','column'); |
525 | 552 | $obj = (array)$obj; |
526 | 553 | $src = $oLayoutModel->getUserLayoutIniConfig($layout_srl); |
527 | - foreach($obj as $key => $val) $src[$key] = $val; |
|
554 | + foreach($obj as $key => $val) { |
|
555 | + $src[$key] = $val; |
|
556 | + } |
|
528 | 557 | $this->insertUserLayoutValue($layout_srl,$src); |
529 | 558 | } |
530 | 559 | |
@@ -591,7 +620,9 @@ discard block |
||
591 | 620 | function procLayoutAdminUserLayoutExport() |
592 | 621 | { |
593 | 622 | $layout_srl = Context::get('layout_srl'); |
594 | - if(!$layout_srl) return new Object('-1','msg_invalid_request'); |
|
623 | + if(!$layout_srl) { |
|
624 | + return new Object('-1','msg_invalid_request'); |
|
625 | + } |
|
595 | 626 | |
596 | 627 | require_once(_XE_PATH_.'libs/tar.class.php'); |
597 | 628 | $oLayoutModel = getModel('layout'); |
@@ -608,16 +639,19 @@ discard block |
||
608 | 639 | |
609 | 640 | foreach($file_list as $file) |
610 | 641 | { |
611 | - if(strncasecmp('images', $file, 6) === 0) continue; |
|
642 | + if(strncasecmp('images', $file, 6) === 0) { |
|
643 | + continue; |
|
644 | + } |
|
612 | 645 | |
613 | 646 | // replace path |
614 | 647 | $file = $target_path . $file; |
615 | 648 | $content = FileHandler::readFile($file); |
616 | 649 | $pattern = '/(http:\/\/[^ ]+)?(\.\/)?' . str_replace('/', '\/', (str_replace('./', '', $file_path))) . '/'; |
617 | - if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css') |
|
618 | - $content = preg_replace($pattern, '../', $content); |
|
619 | - else |
|
620 | - $content = preg_replace($pattern, './', $content); |
|
650 | + if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css') { |
|
651 | + $content = preg_replace($pattern, '../', $content); |
|
652 | + } else { |
|
653 | + $content = preg_replace($pattern, './', $content); |
|
654 | + } |
|
621 | 655 | |
622 | 656 | // replace ini config |
623 | 657 | foreach($ini_config as $key => $value) |
@@ -658,7 +692,9 @@ discard block |
||
658 | 692 | $tar = new tar(); |
659 | 693 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0)); |
660 | 694 | chdir($user_layout_path); |
661 | - foreach($file_list as $key => $file) $tar->addFile($file); |
|
695 | + foreach($file_list as $key => $file) { |
|
696 | + $tar->addFile($file); |
|
697 | + } |
|
662 | 698 | |
663 | 699 | $stream = $tar->toTarStream(); |
664 | 700 | $filename = 'faceoff_' . date('YmdHis') . '.tar'; |
@@ -689,18 +725,28 @@ discard block |
||
689 | 725 | return $this->stop('not supported'); |
690 | 726 | |
691 | 727 | // check upload |
692 | - if(!Context::isUploaded()) exit(); |
|
728 | + if(!Context::isUploaded()) { |
|
729 | + exit(); |
|
730 | + } |
|
693 | 731 | $file = Context::get('file'); |
694 | - if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit(); |
|
732 | + if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) { |
|
733 | + exit(); |
|
734 | + } |
|
695 | 735 | |
696 | - if(substr_compare($file['name'], '.tar', -4) !== 0) exit(); |
|
736 | + if(substr_compare($file['name'], '.tar', -4) !== 0) { |
|
737 | + exit(); |
|
738 | + } |
|
697 | 739 | |
698 | 740 | $layout_srl = Context::get('layout_srl'); |
699 | - if(!$layout_srl) exit(); |
|
741 | + if(!$layout_srl) { |
|
742 | + exit(); |
|
743 | + } |
|
700 | 744 | |
701 | 745 | $oLayoutModel = getModel('layout'); |
702 | 746 | $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl)); |
703 | - if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) exit(); |
|
747 | + if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) { |
|
748 | + exit(); |
|
749 | + } |
|
704 | 750 | |
705 | 751 | $this->importLayout($layout_srl, $user_layout_path.'faceoff.tar'); |
706 | 752 | |
@@ -744,9 +790,11 @@ discard block |
||
744 | 790 | |
745 | 791 | if($layout->extra_var_count) { |
746 | 792 | $reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/"; |
747 | - if($extra_vars) foreach($extra_vars as $key => $val) { |
|
793 | + if($extra_vars) { |
|
794 | + foreach($extra_vars as $key => $val) { |
|
748 | 795 | if($layout->extra_var->{$key}->type == 'image') { |
749 | 796 | if(!preg_match($reg,$val,$matches)) continue; |
797 | + } |
|
750 | 798 | $image_list[$key]->filename = $matches[2]; |
751 | 799 | $image_list[$key]->old_file = $val; |
752 | 800 | } |
@@ -761,7 +809,9 @@ discard block |
||
761 | 809 | $args->site_srl = (int)$layout->site_srl; |
762 | 810 | $args->layout = $layout->layout; |
763 | 811 | $args->layout_type = $layout->layout_type; |
764 | - if(!$args->layout_type) $args->layout_type = "P"; |
|
812 | + if(!$args->layout_type) { |
|
813 | + $args->layout_type = "P"; |
|
814 | + } |
|
765 | 815 | |
766 | 816 | $oDB = &DB::getInstance(); |
767 | 817 | $oDB->begin(); |
@@ -904,7 +954,9 @@ discard block |
||
904 | 954 | $tar = new tar(); |
905 | 955 | $tar->openTAR($source_file); |
906 | 956 | // If layout.ini file does not exist |
907 | - if(!$tar->getFile('layout.ini')) return; |
|
957 | + if(!$tar->getFile('layout.ini')) { |
|
958 | + return; |
|
959 | + } |
|
908 | 960 | |
909 | 961 | $replace_path = getNumberingPath($layout_srl,3); |
910 | 962 | foreach($tar->files as $key => $info) |
@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | * get layout setting view. |
19 | - * @return void |
|
19 | + * @return string|null |
|
20 | 20 | */ |
21 | 21 | public function getLayoutAdminSetInfoView() |
22 | 22 | { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class layoutAdminView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * admin view class of the layout module |
|
7 | - */ |
|
4 | + * @class layoutAdminView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * admin view class of the layout module |
|
7 | + */ |
|
8 | 8 | class layoutAdminModel extends layout |
9 | 9 | { |
10 | 10 | /** |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | Context::set('is_sitemap', '1'); |
26 | 26 | $script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>'; |
27 | 27 | $oTemplate = TemplateHandler::getInstance(); |
28 | - $html = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view'); |
|
28 | + $html = $oTemplate->compile($this->module_path . 'tpl/', 'layout_info_view'); |
|
29 | 29 | |
30 | 30 | preg_match_all('/<!--#JSPLUGIN:(.*)-->/', $html, $m); |
31 | 31 | $pluginList = $m[1]; |
32 | 32 | |
33 | - foreach($pluginList as $plugin) |
|
33 | + foreach ($pluginList as $plugin) |
|
34 | 34 | { |
35 | 35 | $info = Context::getJavascriptPluginInfo($plugin); |
36 | - if(!$info) |
|
36 | + if (!$info) |
|
37 | 37 | { |
38 | 38 | continue; |
39 | 39 | } |
40 | 40 | |
41 | - foreach($info->jsList as $js) |
|
41 | + foreach ($info->jsList as $js) |
|
42 | 42 | { |
43 | 43 | $script .= sprintf('<script src="%s"></script>', $js); |
44 | 44 | } |
45 | - foreach($info->cssList as $css) |
|
45 | + foreach ($info->cssList as $css) |
|
46 | 46 | { |
47 | 47 | $csss .= sprintf('<link rel="stylesheet" href="%s" />', $css); |
48 | 48 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $this->add('html', $csss . $script . $html); |
52 | 52 | |
53 | - if($isReturn) |
|
53 | + if ($isReturn) |
|
54 | 54 | { |
55 | 55 | return $this->get('html'); |
56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
66 | 66 | |
67 | 67 | // Error appears if there is no layout information is registered |
68 | - if(!$layout_info) |
|
68 | + if (!$layout_info) |
|
69 | 69 | { |
70 | 70 | return $this->stop('msg_invalid_request'); |
71 | 71 | } |
@@ -82,14 +82,14 @@ discard block |
||
82 | 82 | $layout_info = $security->encodeHTML('.', 'author..', 'extra_var..'); |
83 | 83 | |
84 | 84 | $layout_info->description = nl2br(trim($layout_info->description)); |
85 | - if(!is_object($layout_info->extra_var)) |
|
85 | + if (!is_object($layout_info->extra_var)) |
|
86 | 86 | { |
87 | 87 | $layout_info->extra_var = new StdClass(); |
88 | 88 | } |
89 | 89 | |
90 | - foreach($layout_info->extra_var as $var_name => $val) |
|
90 | + foreach ($layout_info->extra_var as $var_name => $val) |
|
91 | 91 | { |
92 | - if(isset($layout_info->{$var_name}->description)) |
|
92 | + if (isset($layout_info->{$var_name}->description)) |
|
93 | 93 | { |
94 | 94 | $layout_info->{$var_name}->description = nl2br(trim($val->description)); |
95 | 95 | } |
@@ -105,27 +105,27 @@ discard block |
||
105 | 105 | $oLayoutModel = getModel('layout'); |
106 | 106 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
107 | 107 | // Error appears if there is no layout information is registered |
108 | - if(!$layout_info) |
|
108 | + if (!$layout_info) |
|
109 | 109 | { |
110 | 110 | return $this->dispLayoutAdminInstalledList(); |
111 | 111 | } |
112 | 112 | |
113 | 113 | // Get Layout Code |
114 | - if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
|
114 | + if ($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
|
115 | 115 | { |
116 | - $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
|
117 | - $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
|
116 | + $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
|
117 | + $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
|
118 | 118 | } |
119 | 119 | else |
120 | 120 | { |
121 | 121 | $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
122 | 122 | $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl); |
123 | 123 | |
124 | - if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
125 | - if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
124 | + if (!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
125 | + if (!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
126 | 126 | } |
127 | 127 | |
128 | - if(file_exists($layout_css_file)) |
|
128 | + if (file_exists($layout_css_file)) |
|
129 | 129 | { |
130 | 130 | $layout_code_css = FileHandler::readFile($layout_css_file); |
131 | 131 | Context::set('layout_code_css', $layout_code_css); |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | |
160 | 160 | $script = '<script src="./modules/layout/tpl/js/layout_admin_set_html.js"></script>'; |
161 | 161 | $oTemplate = &TemplateHandler::getInstance(); |
162 | - $html = $oTemplate->compile($this->module_path.'tpl/', 'layout_html_css_view'); |
|
162 | + $html = $oTemplate->compile($this->module_path . 'tpl/', 'layout_html_css_view'); |
|
163 | 163 | |
164 | - $this->add('html', $script.$html); |
|
164 | + $this->add('html', $script . $html); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | public function getLayoutAdminSiteDefaultLayout() |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | { |
183 | 183 | $target = ($viewType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
184 | 184 | $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $siteSrl); |
185 | - if(FileHandler::exists($designInfoFile)) include($designInfoFile); |
|
185 | + if (FileHandler::exists($designInfoFile)) include($designInfoFile); |
|
186 | 186 | |
187 | - if(!$designInfo || !$designInfo->{$target}) |
|
187 | + if (!$designInfo || !$designInfo->{$target}) |
|
188 | 188 | { |
189 | 189 | return 0; |
190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $oModel = getModel('layout'); |
193 | 193 | $layout_info = $oModel->getLayout($designInfo->{$target}); |
194 | 194 | |
195 | - if(!$layout_info) |
|
195 | + if (!$layout_info) |
|
196 | 196 | { |
197 | 197 | return 0; |
198 | 198 | } |
@@ -115,14 +115,17 @@ discard block |
||
115 | 115 | { |
116 | 116 | $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
117 | 117 | $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
118 | - } |
|
119 | - else |
|
118 | + } else |
|
120 | 119 | { |
121 | 120 | $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
122 | 121 | $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl); |
123 | 122 | |
124 | - if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
125 | - if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
123 | + if(!file_exists($layout_file)) { |
|
124 | + $layout_file = $layout_info->path . 'layout.html'; |
|
125 | + } |
|
126 | + if(!file_exists($layout_css_file)) { |
|
127 | + $layout_css_file = $layout_info->path . 'layout.css'; |
|
128 | + } |
|
126 | 129 | } |
127 | 130 | |
128 | 131 | if(file_exists($layout_css_file)) |
@@ -182,7 +185,9 @@ discard block |
||
182 | 185 | { |
183 | 186 | $target = ($viewType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
184 | 187 | $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $siteSrl); |
185 | - if(FileHandler::exists($designInfoFile)) include($designInfoFile); |
|
188 | + if(FileHandler::exists($designInfoFile)) { |
|
189 | + include($designInfoFile); |
|
190 | + } |
|
186 | 191 | |
187 | 192 | if(!$designInfo || !$designInfo->{$target}) |
188 | 193 | { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | /** |
134 | 134 | * Display list of pc layout instance |
135 | - * @return void|Object (void : success, Object : fail) |
|
135 | + * @return ModuleObject|null (void : success, Object : fail) |
|
136 | 136 | */ |
137 | 137 | function dispLayoutAdminInstanceList() |
138 | 138 | { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | /** |
162 | 162 | * Layout setting page |
163 | 163 | * Once select a layout with empty value in the DB, then adjust values |
164 | - * @return void|Object (void : success, Object : fail) |
|
164 | + * @return ModuleObject|null (void : success, Object : fail) |
|
165 | 165 | */ |
166 | 166 | function dispLayoutAdminInsert() |
167 | 167 | { |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * Preview a layout |
291 | - * @return void|Object (void : success, Object : fail) |
|
291 | + * @return Object|null (void : success, Object : fail) |
|
292 | 292 | */ |
293 | 293 | function dispLayoutAdminPreview() |
294 | 294 | { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class layoutAdminView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * admin view class of the layout module |
|
7 | - */ |
|
4 | + * @class layoutAdminView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * admin view class of the layout module |
|
7 | + */ |
|
8 | 8 | class layoutAdminView extends layout |
9 | 9 | { |
10 | 10 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function init() |
15 | 15 | { |
16 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
16 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | // Set a layout list |
29 | 29 | $oLayoutModel = getModel('layout'); |
30 | 30 | $layout_list = $oLayoutModel->getDownloadedLayoutList($type, true); |
31 | - if(!is_array($layout_list)) |
|
31 | + if (!is_array($layout_list)) |
|
32 | 32 | { |
33 | 33 | $layout_list = array(); |
34 | 34 | } |
35 | 35 | |
36 | - if($type == 'P') |
|
36 | + if ($type == 'P') |
|
37 | 37 | { |
38 | 38 | // get Theme layout |
39 | 39 | $oAdminModel = getAdminModel('admin'); |
40 | 40 | $themeList = $oAdminModel->getThemeList(); |
41 | 41 | $themeLayoutList = array(); |
42 | - foreach($themeList as $themeInfo) |
|
42 | + foreach ($themeList as $themeInfo) |
|
43 | 43 | { |
44 | - if(strpos($themeInfo->layout_info->name, '.') === false) continue; |
|
44 | + if (strpos($themeInfo->layout_info->name, '.') === false) continue; |
|
45 | 45 | $themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P'); |
46 | 46 | } |
47 | 47 | $layout_list = array_merge($layout_list, $themeLayoutList); |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | //Security |
61 | 61 | $security = new Security(); |
62 | - $security->encodeHTML('layout_list..layout','layout_list..title'); |
|
62 | + $security->encodeHTML('layout_list..layout', 'layout_list..title'); |
|
63 | 63 | |
64 | - foreach($layout_list as $no => $layout_info) |
|
64 | + foreach ($layout_list as $no => $layout_info) |
|
65 | 65 | { |
66 | 66 | $layout_list[$no]->description = nl2br(trim($layout_info->description)); |
67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $type = Context::get('type'); |
78 | 78 | |
79 | - if(!in_array($type, array('P', 'M'))) $type = 'P'; |
|
79 | + if (!in_array($type, array('P', 'M'))) $type = 'P'; |
|
80 | 80 | |
81 | 81 | $oLayoutModel = getModel('layout'); |
82 | 82 | |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList); |
90 | 90 | |
91 | 91 | $layout_list = array(); |
92 | - foreach($_layout_list as $item) |
|
92 | + foreach ($_layout_list as $item) |
|
93 | 93 | { |
94 | - if(!$layout_list[$item->layout]) |
|
94 | + if (!$layout_list[$item->layout]) |
|
95 | 95 | { |
96 | 96 | $layout_list[$item->layout] = array(); |
97 | 97 | $layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $aTitle = strtolower($a['title']); |
123 | 123 | $bTitle = strtolower($b['title']); |
124 | 124 | |
125 | - if($aTitle == $bTitle) |
|
125 | + if ($aTitle == $bTitle) |
|
126 | 126 | { |
127 | 127 | return 0; |
128 | 128 | } |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | $type = Context::get('type'); |
140 | 140 | $layout = Context::get('layout'); |
141 | 141 | |
142 | - if(!in_array($type, array('P', 'M'))) $type = 'P'; |
|
143 | - if(!$layout) return $this->stop('msg_invalid_request'); |
|
142 | + if (!in_array($type, array('P', 'M'))) $type = 'P'; |
|
143 | + if (!$layout) return $this->stop('msg_invalid_request'); |
|
144 | 144 | |
145 | 145 | $oLayoutModel = getModel('layout'); |
146 | 146 | $layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type); |
147 | - if(!$layout_info) return $this->stop('msg_invalid_request'); |
|
147 | + if (!$layout_info) return $this->stop('msg_invalid_request'); |
|
148 | 148 | |
149 | 149 | Context::set('layout_info', $layout_info); |
150 | 150 | |
@@ -167,18 +167,18 @@ discard block |
||
167 | 167 | { |
168 | 168 | $oModel = getModel('layout'); |
169 | 169 | $type = Context::get('type'); |
170 | - if(!in_array($type, array('P', 'M'))) $type = 'P'; |
|
170 | + if (!in_array($type, array('P', 'M'))) $type = 'P'; |
|
171 | 171 | |
172 | 172 | //Security |
173 | 173 | $security = new Security(); |
174 | - $security->encodeHTML('layout_list..layout','layout_list..title'); |
|
174 | + $security->encodeHTML('layout_list..layout', 'layout_list..title'); |
|
175 | 175 | |
176 | 176 | // Get layout info |
177 | 177 | $layout = Context::get('layout'); |
178 | - if($layout == 'faceoff') return $this->stop('not supported'); |
|
178 | + if ($layout == 'faceoff') return $this->stop('not supported'); |
|
179 | 179 | |
180 | 180 | $layout_info = $oModel->getLayoutInfo($layout, null, $type); |
181 | - if(!$layout_info) return $this->stop('msg_invalid_request'); |
|
181 | + if (!$layout_info) return $this->stop('msg_invalid_request'); |
|
182 | 182 | |
183 | 183 | // get Menu list |
184 | 184 | $oMenuAdminModel = getAdminModel('menu'); |
@@ -192,10 +192,10 @@ discard block |
||
192 | 192 | $layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....'); |
193 | 193 | |
194 | 194 | $layout_info->description = nl2br(trim($layout_info->description)); |
195 | - if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass(); |
|
196 | - foreach($layout_info->extra_var as $var_name => $val) |
|
195 | + if (!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass(); |
|
196 | + foreach ($layout_info->extra_var as $var_name => $val) |
|
197 | 197 | { |
198 | - if(isset($layout_info->{$var_name}->description)) |
|
198 | + if (isset($layout_info->{$var_name}->description)) |
|
199 | 199 | $layout_info->{$var_name}->description = nl2br(trim($val->description)); |
200 | 200 | } |
201 | 201 | Context::set('selected_layout', $layout_info); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | Context::set('is_sitemap', '0'); |
216 | 216 | $script = '<script src="./modules/layout/tpl/js/layout_modify.js"></script>'; |
217 | 217 | $oTemplate = &TemplateHandler::getInstance(); |
218 | - $content = $oTemplate->compile($this->module_path.'tpl/', 'layout_info_view'); |
|
218 | + $content = $oTemplate->compile($this->module_path . 'tpl/', 'layout_info_view'); |
|
219 | 219 | |
220 | 220 | Context::set('content', $content); |
221 | 221 | |
@@ -234,24 +234,24 @@ discard block |
||
234 | 234 | $oLayoutModel = getModel('layout'); |
235 | 235 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
236 | 236 | // Error appears if there is no layout information is registered |
237 | - if(!$layout_info) return $this->dispLayoutAdminInstalledList(); |
|
237 | + if (!$layout_info) return $this->dispLayoutAdminInstalledList(); |
|
238 | 238 | |
239 | 239 | // Get Layout Code |
240 | - if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
|
240 | + if ($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
|
241 | 241 | { |
242 | - $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
|
243 | - $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
|
242 | + $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
|
243 | + $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
|
244 | 244 | } |
245 | 245 | else |
246 | 246 | { |
247 | 247 | $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
248 | 248 | $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl); |
249 | 249 | |
250 | - if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
251 | - if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
250 | + if (!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
251 | + if (!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
252 | 252 | } |
253 | 253 | |
254 | - if(file_exists($layout_css_file)) |
|
254 | + if (file_exists($layout_css_file)) |
|
255 | 255 | { |
256 | 256 | $layout_code_css = FileHandler::readFile($layout_css_file); |
257 | 257 | Context::set('layout_code_css', $layout_code_css); |
@@ -295,30 +295,30 @@ discard block |
||
295 | 295 | $layout_srl = Context::get('layout_srl'); |
296 | 296 | $code = Context::get('code'); |
297 | 297 | $code_css = Context::get('code_css'); |
298 | - if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); |
|
298 | + if (!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); |
|
299 | 299 | // Get the layout information |
300 | 300 | $oLayoutModel = getModel('layout'); |
301 | 301 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
302 | - if(!$layout_info) return new Object(-1, 'msg_invalid_request'); |
|
302 | + if (!$layout_info) return new Object(-1, 'msg_invalid_request'); |
|
303 | 303 | // Separately handle the layout if its type is faceoff |
304 | - if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
304 | + if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
305 | 305 | // Apply CSS directly |
306 | - Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>"); |
|
306 | + Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">" . $code_css . "</style>"); |
|
307 | 307 | // Set names and values of extra_vars to $layout_info |
308 | - if($layout_info->extra_var_count) |
|
308 | + if ($layout_info->extra_var_count) |
|
309 | 309 | { |
310 | - foreach($layout_info->extra_var as $var_id => $val) |
|
310 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
311 | 311 | { |
312 | 312 | $layout_info->{$var_id} = $val->value; |
313 | 313 | } |
314 | 314 | } |
315 | 315 | // menu in layout information becomes an argument for Context:: set |
316 | - if($layout_info->menu_count) |
|
316 | + if ($layout_info->menu_count) |
|
317 | 317 | { |
318 | - foreach($layout_info->menu as $menu_id => $menu) |
|
318 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
319 | 319 | { |
320 | 320 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
321 | - if(FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
321 | + if (FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
322 | 322 | Context::set($menu_id, $menu); |
323 | 323 | } |
324 | 324 | } |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | $layout_file = 'layout'; |
337 | 337 | |
338 | 338 | $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); |
339 | - Context::set('layout','none'); |
|
339 | + Context::set('layout', 'none'); |
|
340 | 340 | // Convert widgets and others |
341 | 341 | $oContext = &Context::getInstance(); |
342 | 342 | Context::set('layout_tpl', $layout_tpl); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | // Remove the remaining tmp files because of temporarily saving |
360 | 360 | // This part needs to be modified |
361 | 361 | $delete_tmp = Context::get('delete_tmp'); |
362 | - if($delete_tmp =='Y') |
|
362 | + if ($delete_tmp == 'Y') |
|
363 | 363 | { |
364 | 364 | $oLayoutAdminController = getAdminController('layout'); |
365 | 365 | $oLayoutAdminController->deleteUserLayoutTempFile($layout_srl); |
@@ -373,24 +373,24 @@ discard block |
||
373 | 373 | |
374 | 374 | $css = FileHandler::readFile($faceoffcss); |
375 | 375 | $match = null; |
376 | - preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match); |
|
377 | - for($i=0,$c=count($match[1]);$i<$c;$i++) |
|
376 | + preg_match_all('/([^\{]+)\{([^\}]*)\}/is', $css, $match); |
|
377 | + for ($i = 0, $c = count($match[1]); $i < $c; $i++) |
|
378 | 378 | { |
379 | 379 | $name = trim($match[1][$i]); |
380 | 380 | $css = trim($match[2][$i]); |
381 | - if(!$css) continue; |
|
382 | - $css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css); |
|
383 | - $style[] .= sprintf('"%s":"%s"',$name,$css); |
|
381 | + if (!$css) continue; |
|
382 | + $css = str_replace('./images/', Context::getRequestUri() . $oLayoutModel->getUserLayoutImagePath($layout_srl), $css); |
|
383 | + $style[] .= sprintf('"%s":"%s"', $name, $css); |
|
384 | 384 | } |
385 | 385 | |
386 | - if(count($style)) |
|
386 | + if (count($style)) |
|
387 | 387 | { |
388 | - $script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>'; |
|
388 | + $script = '<script type="text/javascript"> var faceOffStyle = {' . implode(',', $style) . '}; </script>'; |
|
389 | 389 | Context::addHtmlHeader($script); |
390 | 390 | } |
391 | 391 | |
392 | 392 | $oTemplate = &TemplateHandler::getInstance(); |
393 | - Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff')); |
|
393 | + Context::set('content', $oTemplate->compile($this->module_path . 'tpl', 'about_faceoff')); |
|
394 | 394 | // Change widget codes in Javascript mode |
395 | 395 | $oWidgetController = getController('widget'); |
396 | 396 | $oWidgetController->setWidgetCodeInJavascriptMode(); |
@@ -41,7 +41,9 @@ discard block |
||
41 | 41 | $themeLayoutList = array(); |
42 | 42 | foreach($themeList as $themeInfo) |
43 | 43 | { |
44 | - if(strpos($themeInfo->layout_info->name, '.') === false) continue; |
|
44 | + if(strpos($themeInfo->layout_info->name, '.') === false) { |
|
45 | + continue; |
|
46 | + } |
|
45 | 47 | $themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P'); |
46 | 48 | } |
47 | 49 | $layout_list = array_merge($layout_list, $themeLayoutList); |
@@ -76,7 +78,9 @@ discard block |
||
76 | 78 | { |
77 | 79 | $type = Context::get('type'); |
78 | 80 | |
79 | - if(!in_array($type, array('P', 'M'))) $type = 'P'; |
|
81 | + if(!in_array($type, array('P', 'M'))) { |
|
82 | + $type = 'P'; |
|
83 | + } |
|
80 | 84 | |
81 | 85 | $oLayoutModel = getModel('layout'); |
82 | 86 | |
@@ -139,12 +143,18 @@ discard block |
||
139 | 143 | $type = Context::get('type'); |
140 | 144 | $layout = Context::get('layout'); |
141 | 145 | |
142 | - if(!in_array($type, array('P', 'M'))) $type = 'P'; |
|
143 | - if(!$layout) return $this->stop('msg_invalid_request'); |
|
146 | + if(!in_array($type, array('P', 'M'))) { |
|
147 | + $type = 'P'; |
|
148 | + } |
|
149 | + if(!$layout) { |
|
150 | + return $this->stop('msg_invalid_request'); |
|
151 | + } |
|
144 | 152 | |
145 | 153 | $oLayoutModel = getModel('layout'); |
146 | 154 | $layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type); |
147 | - if(!$layout_info) return $this->stop('msg_invalid_request'); |
|
155 | + if(!$layout_info) { |
|
156 | + return $this->stop('msg_invalid_request'); |
|
157 | + } |
|
148 | 158 | |
149 | 159 | Context::set('layout_info', $layout_info); |
150 | 160 | |
@@ -167,7 +177,9 @@ discard block |
||
167 | 177 | { |
168 | 178 | $oModel = getModel('layout'); |
169 | 179 | $type = Context::get('type'); |
170 | - if(!in_array($type, array('P', 'M'))) $type = 'P'; |
|
180 | + if(!in_array($type, array('P', 'M'))) { |
|
181 | + $type = 'P'; |
|
182 | + } |
|
171 | 183 | |
172 | 184 | //Security |
173 | 185 | $security = new Security(); |
@@ -175,10 +187,14 @@ discard block |
||
175 | 187 | |
176 | 188 | // Get layout info |
177 | 189 | $layout = Context::get('layout'); |
178 | - if($layout == 'faceoff') return $this->stop('not supported'); |
|
190 | + if($layout == 'faceoff') { |
|
191 | + return $this->stop('not supported'); |
|
192 | + } |
|
179 | 193 | |
180 | 194 | $layout_info = $oModel->getLayoutInfo($layout, null, $type); |
181 | - if(!$layout_info) return $this->stop('msg_invalid_request'); |
|
195 | + if(!$layout_info) { |
|
196 | + return $this->stop('msg_invalid_request'); |
|
197 | + } |
|
182 | 198 | |
183 | 199 | // get Menu list |
184 | 200 | $oMenuAdminModel = getAdminModel('menu'); |
@@ -192,11 +208,14 @@ discard block |
||
192 | 208 | $layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....'); |
193 | 209 | |
194 | 210 | $layout_info->description = nl2br(trim($layout_info->description)); |
195 | - if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass(); |
|
211 | + if(!is_object($layout_info->extra_var)) { |
|
212 | + $layout_info->extra_var = new StdClass(); |
|
213 | + } |
|
196 | 214 | foreach($layout_info->extra_var as $var_name => $val) |
197 | 215 | { |
198 | - if(isset($layout_info->{$var_name}->description)) |
|
199 | - $layout_info->{$var_name}->description = nl2br(trim($val->description)); |
|
216 | + if(isset($layout_info->{$var_name}->description)) { |
|
217 | + $layout_info->{$var_name}->description = nl2br(trim($val->description)); |
|
218 | + } |
|
200 | 219 | } |
201 | 220 | Context::set('selected_layout', $layout_info); |
202 | 221 | |
@@ -234,21 +253,26 @@ discard block |
||
234 | 253 | $oLayoutModel = getModel('layout'); |
235 | 254 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
236 | 255 | // Error appears if there is no layout information is registered |
237 | - if(!$layout_info) return $this->dispLayoutAdminInstalledList(); |
|
256 | + if(!$layout_info) { |
|
257 | + return $this->dispLayoutAdminInstalledList(); |
|
258 | + } |
|
238 | 259 | |
239 | 260 | // Get Layout Code |
240 | 261 | if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)) |
241 | 262 | { |
242 | 263 | $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); |
243 | 264 | $layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout); |
244 | - } |
|
245 | - else |
|
265 | + } else |
|
246 | 266 | { |
247 | 267 | $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
248 | 268 | $layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl); |
249 | 269 | |
250 | - if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html'; |
|
251 | - if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css'; |
|
270 | + if(!file_exists($layout_file)) { |
|
271 | + $layout_file = $layout_info->path . 'layout.html'; |
|
272 | + } |
|
273 | + if(!file_exists($layout_css_file)) { |
|
274 | + $layout_css_file = $layout_info->path . 'layout.css'; |
|
275 | + } |
|
252 | 276 | } |
253 | 277 | |
254 | 278 | if(file_exists($layout_css_file)) |
@@ -295,13 +319,19 @@ discard block |
||
295 | 319 | $layout_srl = Context::get('layout_srl'); |
296 | 320 | $code = Context::get('code'); |
297 | 321 | $code_css = Context::get('code_css'); |
298 | - if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); |
|
322 | + if(!$layout_srl || !$code) { |
|
323 | + return new Object(-1, 'msg_invalid_request'); |
|
324 | + } |
|
299 | 325 | // Get the layout information |
300 | 326 | $oLayoutModel = getModel('layout'); |
301 | 327 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
302 | - if(!$layout_info) return new Object(-1, 'msg_invalid_request'); |
|
328 | + if(!$layout_info) { |
|
329 | + return new Object(-1, 'msg_invalid_request'); |
|
330 | + } |
|
303 | 331 | // Separately handle the layout if its type is faceoff |
304 | - if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
332 | + if($layout_info && $layout_info->type == 'faceoff') { |
|
333 | + $oLayoutModel->doActivateFaceOff($layout_info); |
|
334 | + } |
|
305 | 335 | // Apply CSS directly |
306 | 336 | Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>"); |
307 | 337 | // Set names and values of extra_vars to $layout_info |
@@ -318,7 +348,9 @@ discard block |
||
318 | 348 | foreach($layout_info->menu as $menu_id => $menu) |
319 | 349 | { |
320 | 350 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
321 | - if(FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
351 | + if(FileHandler::exists($menu->php_file)) { |
|
352 | + include($menu->php_file); |
|
353 | + } |
|
322 | 354 | Context::set($menu_id, $menu); |
323 | 355 | } |
324 | 356 | } |
@@ -378,7 +410,9 @@ discard block |
||
378 | 410 | { |
379 | 411 | $name = trim($match[1][$i]); |
380 | 412 | $css = trim($match[2][$i]); |
381 | - if(!$css) continue; |
|
413 | + if(!$css) { |
|
414 | + continue; |
|
415 | + } |
|
382 | 416 | $css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css); |
383 | 417 | $style[] .= sprintf('"%s":"%s"',$name,$css); |
384 | 418 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * It uses caching to reduce time for xml parsing .. |
436 | 436 | * @param string $layout |
437 | 437 | * @param object $info |
438 | - * @param string $layoutType (P : PC, M : Mobile) |
|
438 | + * @param string $layout_type (P : PC, M : Mobile) |
|
439 | 439 | * @return object info of layout |
440 | 440 | */ |
441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | /** |
738 | 738 | * Return a list of images which are uploaded on the layout setting page |
739 | 739 | * @param int $layout_srl |
740 | - * @return array image list in layout |
|
740 | + * @return string[] image list in layout |
|
741 | 741 | */ |
742 | 742 | function getUserLayoutImageList($layout_srl) |
743 | 743 | { |
@@ -892,7 +892,6 @@ discard block |
||
892 | 892 | |
893 | 893 | /** |
894 | 894 | * layout cache |
895 | - * @param int $layout_srl |
|
896 | 895 | * @param string $lang_type |
897 | 896 | * @return string |
898 | 897 | */ |
@@ -972,7 +971,7 @@ discard block |
||
972 | 971 | /** |
973 | 972 | * Temp file list for User Layout |
974 | 973 | * @param int $layout_srl |
975 | - * @return array temp files info |
|
974 | + * @return string[] temp files info |
|
976 | 975 | */ |
977 | 976 | function getUserLayoutTempFileList($layout_srl) |
978 | 977 | { |
@@ -986,7 +985,7 @@ discard block |
||
986 | 985 | /** |
987 | 986 | * Saved file list for User Layout |
988 | 987 | * @param int $layout_srl |
989 | - * @return array files info |
|
988 | + * @return string[] files info |
|
990 | 989 | */ |
991 | 990 | function getUserLayoutFileList($layout_srl) |
992 | 991 | { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class layoutModel |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * @version 0.1 |
|
7 | - * Model class of the layout module |
|
8 | - */ |
|
4 | + * @class layoutModel |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * @version 0.1 |
|
7 | + * Model class of the layout module |
|
8 | + */ |
|
9 | 9 | class layoutModel extends layout |
10 | 10 | { |
11 | 11 | /** |
@@ -31,21 +31,21 @@ discard block |
||
31 | 31 | * @param array $columnList |
32 | 32 | * @return array layout lists in site |
33 | 33 | */ |
34 | - function getLayoutList($site_srl = 0, $layout_type="P", $columnList = array()) |
|
34 | + function getLayoutList($site_srl = 0, $layout_type = "P", $columnList = array()) |
|
35 | 35 | { |
36 | - if(!$site_srl) |
|
36 | + if (!$site_srl) |
|
37 | 37 | { |
38 | 38 | $site_module_info = Context::get('site_module_info'); |
39 | - $site_srl = (int)$site_module_info->site_srl; |
|
39 | + $site_srl = (int) $site_module_info->site_srl; |
|
40 | 40 | } |
41 | 41 | $args = new stdClass(); |
42 | 42 | $args->site_srl = $site_srl; |
43 | 43 | $args->layout_type = $layout_type; |
44 | 44 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
45 | 45 | |
46 | - foreach($output->data as $no => &$val) |
|
46 | + foreach ($output->data as $no => &$val) |
|
47 | 47 | { |
48 | - if(!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
48 | + if (!$this->isExistsLayoutFile($val->layout, $layout_type)) |
|
49 | 49 | { |
50 | 50 | unset($output->data[$no]); |
51 | 51 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $oLayoutAdminModel = getAdminModel('layout'); |
55 | 55 | $siteDefaultLayoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($layout_type, $site_srl); |
56 | - if($siteDefaultLayoutSrl) |
|
56 | + if ($siteDefaultLayoutSrl) |
|
57 | 57 | { |
58 | 58 | $siteDefaultLayoutInfo = $this->getlayout($siteDefaultLayoutSrl); |
59 | 59 | $newLayout = sprintf('%s, %s', $siteDefaultLayoutInfo->title, $siteDefaultLayoutInfo->layout); |
@@ -80,24 +80,24 @@ discard block |
||
80 | 80 | $layoutList = $this->getLayoutInstanceList($siteSrl, $layoutType); |
81 | 81 | $thumbs = array(); |
82 | 82 | |
83 | - foreach($layoutList as $key => $val) |
|
83 | + foreach ($layoutList as $key => $val) |
|
84 | 84 | { |
85 | - if($thumbs[$val->layouts]) |
|
85 | + if ($thumbs[$val->layouts]) |
|
86 | 86 | { |
87 | 87 | $val->thumbnail = $thumbs[$val->layouts]; |
88 | 88 | continue; |
89 | 89 | } |
90 | 90 | |
91 | 91 | $token = explode('|@|', $val->layout); |
92 | - if(count($token) == 2) |
|
92 | + if (count($token) == 2) |
|
93 | 93 | { |
94 | - $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
|
94 | + $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png', $token[0], $token[1]); |
|
95 | 95 | } |
96 | 96 | else |
97 | 97 | { |
98 | - $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
|
98 | + $thumbnailPath = sprintf('./layouts/%s/thumbnail.png', $val->layout); |
|
99 | 99 | } |
100 | - if(is_readable($thumbnailPath)) |
|
100 | + if (is_readable($thumbnailPath)) |
|
101 | 101 | { |
102 | 102 | $val->thumbnail = $thumbnailPath; |
103 | 103 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | if (!$siteSrl) |
124 | 124 | { |
125 | 125 | $siteModuleInfo = Context::get('site_module_info'); |
126 | - $siteSrl = (int)$siteModuleInfo->site_srl; |
|
126 | + $siteSrl = (int) $siteModuleInfo->site_srl; |
|
127 | 127 | } |
128 | 128 | $args = new stdClass(); |
129 | 129 | $args->site_srl = $siteSrl; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | |
134 | 134 | // Create instance name list |
135 | 135 | $instanceList = array(); |
136 | - if(is_array($output->data)) |
|
136 | + if (is_array($output->data)) |
|
137 | 137 | { |
138 | - foreach($output->data as $no => $iInfo) |
|
138 | + foreach ($output->data as $no => $iInfo) |
|
139 | 139 | { |
140 | - if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
140 | + if ($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
141 | 141 | { |
142 | 142 | $instanceList[] = $iInfo->layout; |
143 | 143 | } |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | $downloadedList = array(); |
153 | 153 | $titleList = array(); |
154 | 154 | $_downloadedList = $this->getDownloadedLayoutList($layoutType); |
155 | - if(is_array($_downloadedList)) |
|
155 | + if (is_array($_downloadedList)) |
|
156 | 156 | { |
157 | - foreach($_downloadedList as $dLayoutInfo) |
|
157 | + foreach ($_downloadedList as $dLayoutInfo) |
|
158 | 158 | { |
159 | 159 | $downloadedList[$dLayoutInfo->layout] = $dLayoutInfo->layout; |
160 | 160 | $titleList[$dLayoutInfo->layout] = $dLayoutInfo->title; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - if($layout) |
|
164 | + if ($layout) |
|
165 | 165 | { |
166 | - if(count($instanceList) < 1 && $downloadedList[$layout]) |
|
166 | + if (count($instanceList) < 1 && $downloadedList[$layout]) |
|
167 | 167 | { |
168 | 168 | $insertArgs = new stdClass(); |
169 | 169 | $insertArgs->site_srl = $siteSrl; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | // Get downloaded name list have no instance |
183 | 183 | $noInstanceList = array_diff($downloadedList, $instanceList); |
184 | - foreach($noInstanceList as $layoutName) |
|
184 | + foreach ($noInstanceList as $layoutName) |
|
185 | 185 | { |
186 | 186 | $insertArgs = new stdClass(); |
187 | 187 | $insertArgs->site_srl = $siteSrl; |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | } |
198 | 198 | |
199 | 199 | // If create layout instance, reload instance list |
200 | - if($isCreateInstance) |
|
200 | + if ($isCreateInstance) |
|
201 | 201 | { |
202 | 202 | $output = executeQueryArray('layout.getLayoutList', $args, $columnList); |
203 | 203 | |
204 | - if(is_array($output->data)) |
|
204 | + if (is_array($output->data)) |
|
205 | 205 | { |
206 | - foreach($output->data as $no => $iInfo) |
|
206 | + foreach ($output->data as $no => $iInfo) |
|
207 | 207 | { |
208 | - if(!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
208 | + if (!$this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
|
209 | 209 | { |
210 | 210 | unset($output->data[$no]); |
211 | 211 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | function isExistsLayoutFile($layout, $layoutType) |
227 | 227 | { |
228 | 228 | //TODO If remove a support themes, remove this codes also. |
229 | - if($layoutType == 'P') |
|
229 | + if ($layoutType == 'P') |
|
230 | 230 | { |
231 | 231 | $pathPrefix = _XE_PATH_ . 'layouts/'; |
232 | 232 | $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
238 | 238 | } |
239 | 239 | |
240 | - if(strpos($layout, '|@|') !== FALSE) |
|
240 | + if (strpos($layout, '|@|') !== FALSE) |
|
241 | 241 | { |
242 | 242 | list($themeName, $layoutName) = explode('|@|', $layout); |
243 | 243 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $args = new stdClass(); |
263 | 263 | $args->layout_srl = $layout_srl; |
264 | 264 | $output = executeQuery('layout.getLayout', $args); |
265 | - if(!$output->data) return; |
|
265 | + if (!$output->data) return; |
|
266 | 266 | |
267 | 267 | // Return xml file informaton after listing up the layout and extra_vars |
268 | 268 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $args = new stdClass(); |
276 | 276 | $args->layout_srl = $layout_srl; |
277 | 277 | $output = executeQuery('layout.getLayout', $args, $columnList); |
278 | - if(!$output->toBool()) |
|
278 | + if (!$output->toBool()) |
|
279 | 279 | { |
280 | 280 | return; |
281 | 281 | } |
@@ -292,15 +292,15 @@ discard block |
||
292 | 292 | function getLayoutPath($layout_name, $layout_type = "P") |
293 | 293 | { |
294 | 294 | $layout_parse = explode('|@|', $layout_name); |
295 | - if(count($layout_parse) > 1) |
|
295 | + if (count($layout_parse) > 1) |
|
296 | 296 | { |
297 | - $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
|
297 | + $class_path = './themes/' . $layout_parse[0] . '/layouts/' . $layout_parse[1] . '/'; |
|
298 | 298 | } |
299 | - else if($layout_name == 'faceoff') |
|
299 | + else if ($layout_name == 'faceoff') |
|
300 | 300 | { |
301 | 301 | $class_path = './modules/layout/faceoff/'; |
302 | 302 | } |
303 | - else if($layout_type == "M") |
|
303 | + else if ($layout_type == "M") |
|
304 | 304 | { |
305 | 305 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
306 | 306 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | $class_path = sprintf('./layouts/%s/', $layout_name); |
310 | 310 | } |
311 | - if(is_dir($class_path)) return $class_path; |
|
311 | + if (is_dir($class_path)) return $class_path; |
|
312 | 312 | return ""; |
313 | 313 | } |
314 | 314 | |
@@ -326,24 +326,24 @@ discard block |
||
326 | 326 | // Get a list of downloaded layout and installed layout |
327 | 327 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
328 | 328 | $searched_count = count($searched_list); |
329 | - if(!$searched_count) return; |
|
329 | + if (!$searched_count) return; |
|
330 | 330 | |
331 | 331 | // natcasesort($searched_list); |
332 | 332 | // Return information for looping searched list of layouts |
333 | 333 | $list = array(); |
334 | - for($i=0;$i<$searched_count;$i++) |
|
334 | + for ($i = 0; $i < $searched_count; $i++) |
|
335 | 335 | { |
336 | 336 | // Name of the layout |
337 | 337 | $layout = $searched_list[$i]; |
338 | 338 | // Get information of the layout |
339 | 339 | $layout_info = $this->getLayoutInfo($layout, null, $layout_type); |
340 | 340 | |
341 | - if(!$layout_info) |
|
341 | + if (!$layout_info) |
|
342 | 342 | { |
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | - if($withAutoinstallInfo) |
|
346 | + if ($withAutoinstallInfo) |
|
347 | 347 | { |
348 | 348 | // get easyinstall remove url |
349 | 349 | $packageSrl = $oAutoinstallModel->getPackageSrlByPath($layout_info->path); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $layout_info->need_update = $package[$packageSrl]->need_update; |
355 | 355 | |
356 | 356 | // get easyinstall update url |
357 | - if($layout_info->need_update) |
|
357 | + if ($layout_info->need_update) |
|
358 | 358 | { |
359 | 359 | $layout_info->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl); |
360 | 360 | } |
@@ -371,12 +371,12 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function sortLayoutByTitle($a, $b) |
373 | 373 | { |
374 | - if(!$a->title) |
|
374 | + if (!$a->title) |
|
375 | 375 | { |
376 | 376 | $a->title = $a->layout; |
377 | 377 | } |
378 | 378 | |
379 | - if(!$b->title) |
|
379 | + if (!$b->title) |
|
380 | 380 | { |
381 | 381 | $b->title = $b->layout; |
382 | 382 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $aTitle = strtolower($a->title); |
385 | 385 | $bTitle = strtolower($b->title); |
386 | 386 | |
387 | - if($aTitle == $bTitle) |
|
387 | + if ($aTitle == $bTitle) |
|
388 | 388 | { |
389 | 389 | return 0; |
390 | 390 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | */ |
411 | 411 | function _getInstalledLayoutDirectories($layoutType = 'P') |
412 | 412 | { |
413 | - if($layoutType == 'M') |
|
413 | + if ($layoutType == 'M') |
|
414 | 414 | { |
415 | 415 | $directory = './m.layouts'; |
416 | 416 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
422 | 422 | } |
423 | 423 | |
424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
424 | + if ($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
425 | 425 | |
426 | 426 | $searchedList = FileHandler::readDir($directory); |
427 | 427 | if (!$searchedList) $searchedList = array(); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | function getLayoutInfo($layout, $info = null, $layout_type = "P") |
442 | 442 | { |
443 | - if($info) |
|
443 | + if ($info) |
|
444 | 444 | { |
445 | 445 | $layout_title = $info->title; |
446 | 446 | $layout = $info->layout; |
@@ -448,35 +448,35 @@ discard block |
||
448 | 448 | $site_srl = $info->site_srl; |
449 | 449 | $vars = unserialize($info->extra_vars); |
450 | 450 | |
451 | - if($info->module_srl) |
|
451 | + if ($info->module_srl) |
|
452 | 452 | { |
453 | - $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/','',$info->layout_path); |
|
453 | + $layout_path = preg_replace('/([a-zA-Z0-9\_\.]+)(\.html)$/', '', $info->layout_path); |
|
454 | 454 | $xml_file = sprintf('%sskin.xml', $layout_path); |
455 | 455 | } |
456 | 456 | } |
457 | 457 | |
458 | 458 | // Get a path of the requested module. Return if not exists. |
459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
460 | - if(!is_dir($layout_path)) return; |
|
459 | + if (!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
460 | + if (!is_dir($layout_path)) return; |
|
461 | 461 | |
462 | 462 | // Read the xml file for module skin information |
463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
464 | - if(!file_exists($xml_file)) |
|
463 | + if (!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
464 | + if (!file_exists($xml_file)) |
|
465 | 465 | { |
466 | 466 | $layout_info = new stdClass; |
467 | 467 | $layout_info->title = $layout; |
468 | 468 | $layout_info->layout = $layout; |
469 | 469 | $layout_info->path = $layout_path; |
470 | 470 | $layout_info->layout_title = $layout_title; |
471 | - if(!$layout_info->layout_type) |
|
471 | + if (!$layout_info->layout_type) |
|
472 | 472 | { |
473 | - $layout_info->layout_type = $layout_type; |
|
473 | + $layout_info->layout_type = $layout_type; |
|
474 | 474 | } |
475 | 475 | return $layout_info; |
476 | 476 | } |
477 | 477 | |
478 | 478 | // Include the cache file if it is valid and then return $layout_info variable |
479 | - if(!$layout_srl) |
|
479 | + if (!$layout_srl) |
|
480 | 480 | { |
481 | 481 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
482 | 482 | } |
@@ -485,22 +485,22 @@ discard block |
||
485 | 485 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
486 | 486 | } |
487 | 487 | |
488 | - if(file_exists($cache_file)&&filemtime($cache_file)>filemtime($xml_file)) |
|
488 | + if (file_exists($cache_file) && filemtime($cache_file) > filemtime($xml_file)) |
|
489 | 489 | { |
490 | 490 | include($cache_file); |
491 | 491 | |
492 | - if($layout_info->extra_var && $vars) |
|
492 | + if ($layout_info->extra_var && $vars) |
|
493 | 493 | { |
494 | - foreach($vars as $key => $value) |
|
494 | + foreach ($vars as $key => $value) |
|
495 | 495 | { |
496 | - if(!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
496 | + if (!$layout_info->extra_var->{$key} && !$layout_info->{$key}) |
|
497 | 497 | { |
498 | 498 | $layout_info->{$key} = $value; |
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | - if(!$layout_info->title) |
|
503 | + if (!$layout_info->title) |
|
504 | 504 | { |
505 | 505 | $layout_info->title = $layout; |
506 | 506 | } |
@@ -511,16 +511,16 @@ discard block |
||
511 | 511 | $oXmlParser = new XmlParser(); |
512 | 512 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
513 | 513 | |
514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
514 | + if ($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
515 | + elseif ($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
516 | 516 | |
517 | - if(!$xml_obj) return; |
|
517 | + if (!$xml_obj) return; |
|
518 | 518 | |
519 | 519 | $buff = array(); |
520 | 520 | $buff[] = '$layout_info = new stdClass;'; |
521 | 521 | $buff[] = sprintf('$layout_info->site_srl = "%s";', $site_srl); |
522 | 522 | |
523 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
523 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
524 | 524 | { |
525 | 525 | // Layout title, version and other information |
526 | 526 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -540,11 +540,11 @@ discard block |
||
540 | 540 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
541 | 541 | |
542 | 542 | // Author information |
543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
543 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
544 | 544 | else $author_list = $xml_obj->author; |
545 | 545 | |
546 | 546 | $buff[] = '$layout_info->author = array();'; |
547 | - for($i=0, $c=count($author_list); $i<$c; $i++) |
|
547 | + for ($i = 0, $c = count($author_list); $i < $c; $i++) |
|
548 | 548 | { |
549 | 549 | $buff[] = sprintf('$layout_info->author[%d] = new stdClass;', $i); |
550 | 550 | $buff[] = sprintf('$layout_info->author[%d]->name = "%s";', $i, $author_list[$i]->name->body); |
@@ -554,22 +554,22 @@ discard block |
||
554 | 554 | |
555 | 555 | // Extra vars (user defined variables to use in a template) |
556 | 556 | $extra_var_groups = $xml_obj->extra_vars->group; |
557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
557 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
558 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
559 | 559 | |
560 | 560 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
561 | 561 | $extra_var_count = 0; |
562 | - foreach($extra_var_groups as $group) |
|
562 | + foreach ($extra_var_groups as $group) |
|
563 | 563 | { |
564 | 564 | $extra_vars = $group->var; |
565 | - if($extra_vars) |
|
565 | + if ($extra_vars) |
|
566 | 566 | { |
567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
567 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
568 | 568 | |
569 | 569 | $count = count($extra_vars); |
570 | 570 | $extra_var_count += $count; |
571 | 571 | |
572 | - for($i=0;$i<$count;$i++) |
|
572 | + for ($i = 0; $i < $count; $i++) |
|
573 | 573 | { |
574 | 574 | unset($var, $options); |
575 | 575 | $var = $extra_vars[$i]; |
@@ -580,26 +580,26 @@ discard block |
||
580 | 580 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
581 | 581 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
582 | 582 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
583 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
583 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
584 | 584 | |
585 | 585 | $options = $var->options; |
586 | - if(!$options) continue; |
|
587 | - if(!is_array($options)) $options = array($options); |
|
586 | + if (!$options) continue; |
|
587 | + if (!is_array($options)) $options = array($options); |
|
588 | 588 | |
589 | 589 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
590 | 590 | $options_count = count($options); |
591 | 591 | $thumbnail_exist = false; |
592 | - for($j=0; $j < $options_count; $j++) |
|
592 | + for ($j = 0; $j < $options_count; $j++) |
|
593 | 593 | { |
594 | 594 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"] = new stdClass;', $var->attrs->name, $options[$j]->attrs->value); |
595 | 595 | $thumbnail = $options[$j]->attrs->src; |
596 | - if($thumbnail) |
|
596 | + if ($thumbnail) |
|
597 | 597 | { |
598 | - $thumbnail = $layout_path.$thumbnail; |
|
599 | - if(file_exists($thumbnail)) |
|
598 | + $thumbnail = $layout_path . $thumbnail; |
|
599 | + if (file_exists($thumbnail)) |
|
600 | 600 | { |
601 | 601 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail); |
602 | - if(!$thumbnail_exist) |
|
602 | + if (!$thumbnail_exist) |
|
603 | 603 | { |
604 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name); |
605 | 605 | $thumbnail_exist = true; |
@@ -613,26 +613,26 @@ discard block |
||
613 | 613 | } |
614 | 614 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
615 | 615 | // Menu |
616 | - if($xml_obj->menus->menu) |
|
616 | + if ($xml_obj->menus->menu) |
|
617 | 617 | { |
618 | 618 | $menus = $xml_obj->menus->menu; |
619 | - if(!is_array($menus)) $menus = array($menus); |
|
619 | + if (!is_array($menus)) $menus = array($menus); |
|
620 | 620 | |
621 | 621 | $menu_count = count($menus); |
622 | 622 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
623 | 623 | $buff[] = '$layout_info->menu = new stdClass;'; |
624 | - for($i=0;$i<$menu_count;$i++) |
|
624 | + for ($i = 0; $i < $menu_count; $i++) |
|
625 | 625 | { |
626 | 626 | $name = $menus[$i]->attrs->name; |
627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
627 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
628 | 628 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
629 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
|
630 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
631 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->attrs->maxdepth); |
|
629 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $menus[$i]->attrs->name); |
|
630 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
631 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->attrs->maxdepth); |
|
632 | 632 | |
633 | 633 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
634 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
635 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
634 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
635 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | } |
@@ -655,19 +655,19 @@ discard block |
||
655 | 655 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
656 | 656 | // Extra vars (user defined variables to use in a template) |
657 | 657 | $extra_var_groups = $xml_obj->extra_vars->group; |
658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
660 | - foreach($extra_var_groups as $group) |
|
658 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
659 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
660 | + foreach ($extra_var_groups as $group) |
|
661 | 661 | { |
662 | 662 | $extra_vars = $group->var; |
663 | - if($extra_vars) |
|
663 | + if ($extra_vars) |
|
664 | 664 | { |
665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
665 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
666 | 666 | |
667 | 667 | $extra_var_count = count($extra_vars); |
668 | 668 | |
669 | 669 | $buff[] = sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count); |
670 | - for($i=0;$i<$extra_var_count;$i++) |
|
670 | + for ($i = 0; $i < $extra_var_count; $i++) |
|
671 | 671 | { |
672 | 672 | unset($var, $options); |
673 | 673 | $var = $extra_vars[$i]; |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | $buff[] = sprintf('$layout_info->extra_var->%s->title = "%s";', $name, $var->title->body); |
678 | 678 | $buff[] = sprintf('$layout_info->extra_var->%s->type = "%s";', $name, $var->attrs->type); |
679 | 679 | $buff[] = sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $name, $name); |
680 | - $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
|
680 | + $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"', '\"', $var->description->body)); |
|
681 | 681 | |
682 | 682 | $options = $var->options; |
683 | - if(!$options) continue; |
|
683 | + if (!$options) continue; |
|
684 | 684 | |
685 | - if(!is_array($options)) $options = array($options); |
|
685 | + if (!is_array($options)) $options = array($options); |
|
686 | 686 | $options_count = count($options); |
687 | - for($j=0;$j<$options_count;$j++) |
|
687 | + for ($j = 0; $j < $options_count; $j++) |
|
688 | 688 | { |
689 | 689 | $buff[] = sprintf('$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->value->body, $options[$j]->title->body); |
690 | 690 | } |
@@ -692,23 +692,23 @@ discard block |
||
692 | 692 | } |
693 | 693 | } |
694 | 694 | // Menu |
695 | - if($xml_obj->menus->menu) |
|
695 | + if ($xml_obj->menus->menu) |
|
696 | 696 | { |
697 | 697 | $menus = $xml_obj->menus->menu; |
698 | - if(!is_array($menus)) $menus = array($menus); |
|
698 | + if (!is_array($menus)) $menus = array($menus); |
|
699 | 699 | |
700 | 700 | $menu_count = count($menus); |
701 | 701 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
702 | - for($i=0;$i<$menu_count;$i++) |
|
702 | + for ($i = 0; $i < $menu_count; $i++) |
|
703 | 703 | { |
704 | 704 | $name = $menus[$i]->attrs->name; |
705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
706 | - $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
|
707 | - $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
|
708 | - $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
|
705 | + if ($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
706 | + $buff[] = sprintf('$layout_info->menu->%s->name = "%s";', $name, $name); |
|
707 | + $buff[] = sprintf('$layout_info->menu->%s->title = "%s";', $name, $menus[$i]->title->body); |
|
708 | + $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";', $name, $menus[$i]->maxdepth->body); |
|
709 | 709 | $buff[] = sprintf('$layout_info->menu->%s->menu_srl = $vars->%s;', $name, $name); |
710 | - $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";',$name, $name); |
|
711 | - $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
|
710 | + $buff[] = sprintf('$layout_info->menu->%s->xml_file = "./files/cache/menu/".$vars->%s.".xml.php";', $name, $name); |
|
711 | + $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";', $name, $name); |
|
712 | 712 | } |
713 | 713 | } |
714 | 714 | } |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | $layout_config = $oModuleModel->getModulePartConfig('layout', $layout_srl); |
719 | 719 | $header_script = trim($layout_config->header_script); |
720 | 720 | |
721 | - if($header_script) |
|
721 | + if ($header_script) |
|
722 | 722 | { |
723 | - $buff[] = sprintf(' $layout_info->header_script = "%s"; ', str_replace(array('$','"'),array('\$','\\"'),$header_script)); |
|
723 | + $buff[] = sprintf(' $layout_info->header_script = "%s"; ', str_replace(array('$', '"'), array('\$', '\\"'), $header_script)); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
727 | + if (FileHandler::exists($cache_file)) include($cache_file); |
|
728 | 728 | |
729 | - if(!$layout_info->title) |
|
729 | + if (!$layout_info->title) |
|
730 | 730 | { |
731 | 731 | $layout_info->title = $layout; |
732 | 732 | } |
@@ -750,12 +750,12 @@ discard block |
||
750 | 750 | * @param string $layout_name |
751 | 751 | * @return array |
752 | 752 | */ |
753 | - function getUserLayoutIniConfig($layout_srl, $layout_name=null) |
|
753 | + function getUserLayoutIniConfig($layout_srl, $layout_name = null) |
|
754 | 754 | { |
755 | 755 | $file = $this->getUserLayoutIni($layout_srl); |
756 | - if($layout_name && FileHandler::exists($file) === FALSE) |
|
756 | + if ($layout_name && FileHandler::exists($file) === FALSE) |
|
757 | 757 | { |
758 | - FileHandler::copyFile($this->getDefaultLayoutIni($layout_name),$this->getUserLayoutIni($layout_srl)); |
|
758 | + FileHandler::copyFile($this->getDefaultLayoutIni($layout_name), $this->getUserLayoutIni($layout_srl)); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | return FileHandler::readIniFile($file); |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | */ |
769 | 769 | function getUserLayoutPath($layout_srl) |
770 | 770 | { |
771 | - return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl,3)); |
|
771 | + return sprintf("./files/faceOff/%s", getNumberingPath($layout_srl, 3)); |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | /** |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | */ |
779 | 779 | function getUserLayoutImagePath($layout_srl) |
780 | 780 | { |
781 | - return $this->getUserLayoutPath($layout_srl). 'images/'; |
|
781 | + return $this->getUserLayoutPath($layout_srl) . 'images/'; |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | function getUserLayoutCss($layout_srl) |
790 | 790 | { |
791 | - return $this->getUserLayoutPath($layout_srl). 'layout.css'; |
|
791 | + return $this->getUserLayoutPath($layout_srl) . 'layout.css'; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | */ |
799 | 799 | function getUserLayoutFaceOffCss($layout_srl) |
800 | 800 | { |
801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
801 | + if ($this->useUserLayoutTemp == 'temp') return; |
|
802 | 802 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
803 | 803 | } |
804 | 804 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | */ |
810 | 810 | function _getUserLayoutFaceOffCss($layout_srl) |
811 | 811 | { |
812 | - return $this->getUserLayoutPath($layout_srl). 'faceoff.css'; |
|
812 | + return $this->getUserLayoutPath($layout_srl) . 'faceoff.css'; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | /** |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | */ |
820 | 820 | function getUserLayoutTempFaceOffCss($layout_srl) |
821 | 821 | { |
822 | - return $this->getUserLayoutPath($layout_srl). 'tmp.faceoff.css'; |
|
822 | + return $this->getUserLayoutPath($layout_srl) . 'tmp.faceoff.css'; |
|
823 | 823 | } |
824 | 824 | |
825 | 825 | /** |
@@ -829,11 +829,11 @@ discard block |
||
829 | 829 | */ |
830 | 830 | function getUserLayoutHtml($layout_srl) |
831 | 831 | { |
832 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.html'; |
|
833 | - if($this->useUserLayoutTemp == 'temp') |
|
832 | + $src = $this->getUserLayoutPath($layout_srl) . 'layout.html'; |
|
833 | + if ($this->useUserLayoutTemp == 'temp') |
|
834 | 834 | { |
835 | 835 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
836 | + if (FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src, $temp); |
|
837 | 837 | return $temp; |
838 | 838 | } |
839 | 839 | |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | */ |
848 | 848 | function getUserLayoutTempHtml($layout_srl) |
849 | 849 | { |
850 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.html'; |
|
850 | + return $this->getUserLayoutPath($layout_srl) . 'tmp.layout.html'; |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | /** |
@@ -857,11 +857,11 @@ discard block |
||
857 | 857 | */ |
858 | 858 | function getUserLayoutIni($layout_srl) |
859 | 859 | { |
860 | - $src = $this->getUserLayoutPath($layout_srl). 'layout.ini'; |
|
861 | - if($this->useUserLayoutTemp == 'temp') |
|
860 | + $src = $this->getUserLayoutPath($layout_srl) . 'layout.ini'; |
|
861 | + if ($this->useUserLayoutTemp == 'temp') |
|
862 | 862 | { |
863 | 863 | $temp = $this->getUserLayoutTempIni($layout_srl); |
864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
864 | + if (!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src, $temp); |
|
865 | 865 | return $temp; |
866 | 866 | } |
867 | 867 | |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | */ |
876 | 876 | function getUserLayoutTempIni($layout_srl) |
877 | 877 | { |
878 | - return $this->getUserLayoutPath($layout_srl). 'tmp.layout.ini'; |
|
878 | + return $this->getUserLayoutPath($layout_srl) . 'tmp.layout.ini'; |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | /** |
@@ -885,9 +885,9 @@ discard block |
||
885 | 885 | * @param string $lang_type |
886 | 886 | * @return string |
887 | 887 | */ |
888 | - function getUserLayoutCache($layout_srl,$lang_type) |
|
888 | + function getUserLayoutCache($layout_srl, $lang_type) |
|
889 | 889 | { |
890 | - return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; |
|
890 | + return $this->getUserLayoutPath($layout_srl) . "{$lang_type}.cache.php"; |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | /** |
@@ -896,15 +896,15 @@ discard block |
||
896 | 896 | * @param string $lang_type |
897 | 897 | * @return string |
898 | 898 | */ |
899 | - function getLayoutCache($layout_name,$lang_type,$layout_type='P') |
|
899 | + function getLayoutCache($layout_name, $lang_type, $layout_type = 'P') |
|
900 | 900 | { |
901 | - if($layout_type=='P') |
|
901 | + if ($layout_type == 'P') |
|
902 | 902 | { |
903 | - return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
903 | + return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
904 | 904 | } |
905 | 905 | else |
906 | 906 | { |
907 | - return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
|
907 | + return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name, $lang_type); |
|
908 | 908 | } |
909 | 909 | } |
910 | 910 | |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | */ |
916 | 916 | function getDefaultLayoutIni($layout_name) |
917 | 917 | { |
918 | - return $this->getDefaultLayoutPath($layout_name). 'layout.ini'; |
|
918 | + return $this->getDefaultLayoutPath($layout_name) . 'layout.ini'; |
|
919 | 919 | } |
920 | 920 | |
921 | 921 | /** |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | */ |
926 | 926 | function getDefaultLayoutHtml($layout_name) |
927 | 927 | { |
928 | - return $this->getDefaultLayoutPath($layout_name). 'layout.html'; |
|
928 | + return $this->getDefaultLayoutPath($layout_name) . 'layout.html'; |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | /** |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | */ |
936 | 936 | function getDefaultLayoutCss($layout_name) |
937 | 937 | { |
938 | - return $this->getDefaultLayoutPath($layout_name). 'css/layout.css'; |
|
938 | + return $this->getDefaultLayoutPath($layout_name) . 'css/layout.css'; |
|
939 | 939 | } |
940 | 940 | |
941 | 941 | /** |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | * @param string $flag (default 'temp') |
965 | 965 | * @return void |
966 | 966 | */ |
967 | - function setUseUserLayoutTemp($flag='temp') |
|
967 | + function setUseUserLayoutTemp($flag = 'temp') |
|
968 | 968 | { |
969 | 969 | $this->useUserLayoutTemp = $flag; |
970 | 970 | } |
@@ -998,9 +998,9 @@ discard block |
||
998 | 998 | ); |
999 | 999 | |
1000 | 1000 | $image_path = $this->getUserLayoutImagePath($layout_srl); |
1001 | - $image_list = FileHandler::readDir($image_path,'/(.*(?:swf|jpg|jpeg|gif|bmp|png)$)/i'); |
|
1001 | + $image_list = FileHandler::readDir($image_path, '/(.*(?:swf|jpg|jpeg|gif|bmp|png)$)/i'); |
|
1002 | 1002 | |
1003 | - foreach($image_list as $image) |
|
1003 | + foreach ($image_list as $image) |
|
1004 | 1004 | { |
1005 | 1005 | $file_list[] = 'images/' . $image; |
1006 | 1006 | } |
@@ -1020,23 +1020,23 @@ discard block |
||
1020 | 1020 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
1021 | 1021 | // CSS generated in the layout manager |
1022 | 1022 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
1023 | + if ($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
1024 | 1024 | // CSS output for the widget |
1025 | - Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
|
1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1027 | - else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1025 | + Context::loadFile($this->module_path . '/tpl/css/widget.css', true); |
|
1026 | + if ($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path . '/tpl/css/[email protected]', true); |
|
1027 | + else Context::loadFile($this->module_path . '/tpl/css/[email protected]', true); |
|
1028 | 1028 | // Different page displayed upon user's permission |
1029 | 1029 | $logged_info = Context::get('logged_info'); |
1030 | 1030 | // Display edit button for faceoff layout |
1031 | - if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1031 | + if (Context::get('module') != 'admin' && strpos(Context::get('act'), 'Admin') === false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1032 | 1032 | { |
1033 | - Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="'.getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y').'">'.Context::getLang('cmd_layout_edit').'</a></div>'); |
|
1033 | + Context::addHtmlFooter('<div class="faceOffManager" style="height: 23px; position: fixed; right: 3px; top: 3px;"><a href="' . getUrl('', 'mid', Context::get('mid'), 'act', 'dispLayoutAdminLayoutModify', 'delete_tmp', 'Y') . '">' . Context::getLang('cmd_layout_edit') . '</a></div>'); |
|
1034 | 1034 | } |
1035 | 1035 | // Display menu when editing the faceOff page |
1036 | - if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1036 | + if (Context::get('act') == 'dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) |
|
1037 | 1037 | { |
1038 | 1038 | $oTemplate = &TemplateHandler::getInstance(); |
1039 | - Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu')); |
|
1039 | + Context::addBodyHeader($oTemplate->compile($this->module_path . '/tpl', 'faceoff_layout_menu')); |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | } |
@@ -92,16 +92,14 @@ discard block |
||
92 | 92 | if(count($token) == 2) |
93 | 93 | { |
94 | 94 | $thumbnailPath = sprintf('./themes/%s/layouts/%s/thumbnail.png' , $token[0], $token[1]); |
95 | - } |
|
96 | - else |
|
95 | + } else |
|
97 | 96 | { |
98 | 97 | $thumbnailPath = sprintf('./layouts/%s/thumbnail.png' , $val->layout); |
99 | 98 | } |
100 | 99 | if(is_readable($thumbnailPath)) |
101 | 100 | { |
102 | 101 | $val->thumbnail = $thumbnailPath; |
103 | - } |
|
104 | - else |
|
102 | + } else |
|
105 | 103 | { |
106 | 104 | $val->thumbnail = sprintf('./modules/layout/tpl/img/noThumbnail.png'); |
107 | 105 | } |
@@ -140,8 +138,7 @@ discard block |
||
140 | 138 | if($this->isExistsLayoutFile($iInfo->layout, $layoutType)) |
141 | 139 | { |
142 | 140 | $instanceList[] = $iInfo->layout; |
143 | - } |
|
144 | - else |
|
141 | + } else |
|
145 | 142 | { |
146 | 143 | unset($output->data[$no]); |
147 | 144 | } |
@@ -176,8 +173,7 @@ discard block |
||
176 | 173 | $oLayoutAdminController->insertLayout($insertArgs); |
177 | 174 | $isCreateInstance = TRUE; |
178 | 175 | } |
179 | - } |
|
180 | - else |
|
176 | + } else |
|
181 | 177 | { |
182 | 178 | // Get downloaded name list have no instance |
183 | 179 | $noInstanceList = array_diff($downloadedList, $instanceList); |
@@ -230,8 +226,7 @@ discard block |
||
230 | 226 | { |
231 | 227 | $pathPrefix = _XE_PATH_ . 'layouts/'; |
232 | 228 | $themePathFormat = _XE_PATH_ . 'themes/%s/layouts/%s'; |
233 | - } |
|
234 | - else |
|
229 | + } else |
|
235 | 230 | { |
236 | 231 | $pathPrefix = _XE_PATH_ . 'm.layouts/'; |
237 | 232 | $themePathFormat = _XE_PATH_ . 'themes/%s/m.layouts/%s'; |
@@ -241,8 +236,7 @@ discard block |
||
241 | 236 | { |
242 | 237 | list($themeName, $layoutName) = explode('|@|', $layout); |
243 | 238 | $path = sprintf($themePathFormat, $themeName, $layoutName); |
244 | - } |
|
245 | - else |
|
239 | + } else |
|
246 | 240 | { |
247 | 241 | $path = $pathPrefix . $layout; |
248 | 242 | } |
@@ -262,7 +256,9 @@ discard block |
||
262 | 256 | $args = new stdClass(); |
263 | 257 | $args->layout_srl = $layout_srl; |
264 | 258 | $output = executeQuery('layout.getLayout', $args); |
265 | - if(!$output->data) return; |
|
259 | + if(!$output->data) { |
|
260 | + return; |
|
261 | + } |
|
266 | 262 | |
267 | 263 | // Return xml file informaton after listing up the layout and extra_vars |
268 | 264 | $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); |
@@ -295,20 +291,19 @@ discard block |
||
295 | 291 | if(count($layout_parse) > 1) |
296 | 292 | { |
297 | 293 | $class_path = './themes/'.$layout_parse[0].'/layouts/'.$layout_parse[1].'/'; |
298 | - } |
|
299 | - else if($layout_name == 'faceoff') |
|
294 | + } else if($layout_name == 'faceoff') |
|
300 | 295 | { |
301 | 296 | $class_path = './modules/layout/faceoff/'; |
302 | - } |
|
303 | - else if($layout_type == "M") |
|
297 | + } else if($layout_type == "M") |
|
304 | 298 | { |
305 | 299 | $class_path = sprintf("./m.layouts/%s/", $layout_name); |
306 | - } |
|
307 | - else |
|
300 | + } else |
|
308 | 301 | { |
309 | 302 | $class_path = sprintf('./layouts/%s/', $layout_name); |
310 | 303 | } |
311 | - if(is_dir($class_path)) return $class_path; |
|
304 | + if(is_dir($class_path)) { |
|
305 | + return $class_path; |
|
306 | + } |
|
312 | 307 | return ""; |
313 | 308 | } |
314 | 309 | |
@@ -321,12 +316,16 @@ discard block |
||
321 | 316 | */ |
322 | 317 | function getDownloadedLayoutList($layout_type = "P", $withAutoinstallInfo = false) |
323 | 318 | { |
324 | - if ($withAutoinstallInfo) $oAutoinstallModel = getModel('autoinstall'); |
|
319 | + if ($withAutoinstallInfo) { |
|
320 | + $oAutoinstallModel = getModel('autoinstall'); |
|
321 | + } |
|
325 | 322 | |
326 | 323 | // Get a list of downloaded layout and installed layout |
327 | 324 | $searched_list = $this->_getInstalledLayoutDirectories($layout_type); |
328 | 325 | $searched_count = count($searched_list); |
329 | - if(!$searched_count) return; |
|
326 | + if(!$searched_count) { |
|
327 | + return; |
|
328 | + } |
|
330 | 329 | |
331 | 330 | // natcasesort($searched_list); |
332 | 331 | // Return information for looping searched list of layouts |
@@ -414,17 +413,20 @@ discard block |
||
414 | 413 | { |
415 | 414 | $directory = './m.layouts'; |
416 | 415 | $globalValueKey = 'MOBILE_LAYOUT_DIRECTOIES'; |
417 | - } |
|
418 | - else |
|
416 | + } else |
|
419 | 417 | { |
420 | 418 | $directory = './layouts'; |
421 | 419 | $globalValueKey = 'PC_LAYOUT_DIRECTORIES'; |
422 | 420 | } |
423 | 421 | |
424 | - if($GLOBALS[$globalValueKey]) return $GLOBALS[$globalValueKey]; |
|
422 | + if($GLOBALS[$globalValueKey]) { |
|
423 | + return $GLOBALS[$globalValueKey]; |
|
424 | + } |
|
425 | 425 | |
426 | 426 | $searchedList = FileHandler::readDir($directory); |
427 | - if (!$searchedList) $searchedList = array(); |
|
427 | + if (!$searchedList) { |
|
428 | + $searchedList = array(); |
|
429 | + } |
|
428 | 430 | $GLOBALS[$globalValueKey] = $searchedList; |
429 | 431 | |
430 | 432 | return $searchedList; |
@@ -456,11 +458,17 @@ discard block |
||
456 | 458 | } |
457 | 459 | |
458 | 460 | // Get a path of the requested module. Return if not exists. |
459 | - if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
460 | - if(!is_dir($layout_path)) return; |
|
461 | + if(!$layout_path) { |
|
462 | + $layout_path = $this->getLayoutPath($layout, $layout_type); |
|
463 | + } |
|
464 | + if(!is_dir($layout_path)) { |
|
465 | + return; |
|
466 | + } |
|
461 | 467 | |
462 | 468 | // Read the xml file for module skin information |
463 | - if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
469 | + if(!$xml_file) { |
|
470 | + $xml_file = sprintf("%sconf/info.xml", $layout_path); |
|
471 | + } |
|
464 | 472 | if(!file_exists($xml_file)) |
465 | 473 | { |
466 | 474 | $layout_info = new stdClass; |
@@ -479,8 +487,7 @@ discard block |
||
479 | 487 | if(!$layout_srl) |
480 | 488 | { |
481 | 489 | $cache_file = $this->getLayoutCache($layout, Context::getLangType(), $layout_type); |
482 | - } |
|
483 | - else |
|
490 | + } else |
|
484 | 491 | { |
485 | 492 | $cache_file = $this->getUserLayoutCache($layout_srl, Context::getLangType()); |
486 | 493 | } |
@@ -511,10 +518,15 @@ discard block |
||
511 | 518 | $oXmlParser = new XmlParser(); |
512 | 519 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
513 | 520 | |
514 | - if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; |
|
515 | - elseif($tmp_xml_obj->skin) $xml_obj = $tmp_xml_obj->skin; |
|
521 | + if($tmp_xml_obj->layout) { |
|
522 | + $xml_obj = $tmp_xml_obj->layout; |
|
523 | + } elseif($tmp_xml_obj->skin) { |
|
524 | + $xml_obj = $tmp_xml_obj->skin; |
|
525 | + } |
|
516 | 526 | |
517 | - if(!$xml_obj) return; |
|
527 | + if(!$xml_obj) { |
|
528 | + return; |
|
529 | + } |
|
518 | 530 | |
519 | 531 | $buff = array(); |
520 | 532 | $buff[] = '$layout_info = new stdClass;'; |
@@ -540,8 +552,11 @@ discard block |
||
540 | 552 | $buff[] = sprintf('$layout_info->layout_type = "%s";', $layout_type); |
541 | 553 | |
542 | 554 | // Author information |
543 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
544 | - else $author_list = $xml_obj->author; |
|
555 | + if(!is_array($xml_obj->author)) { |
|
556 | + $author_list[] = $xml_obj->author; |
|
557 | + } else { |
|
558 | + $author_list = $xml_obj->author; |
|
559 | + } |
|
545 | 560 | |
546 | 561 | $buff[] = '$layout_info->author = array();'; |
547 | 562 | for($i=0, $c=count($author_list); $i<$c; $i++) |
@@ -554,8 +569,12 @@ discard block |
||
554 | 569 | |
555 | 570 | // Extra vars (user defined variables to use in a template) |
556 | 571 | $extra_var_groups = $xml_obj->extra_vars->group; |
557 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
558 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
572 | + if(!$extra_var_groups) { |
|
573 | + $extra_var_groups = $xml_obj->extra_vars; |
|
574 | + } |
|
575 | + if(!is_array($extra_var_groups)) { |
|
576 | + $extra_var_groups = array($extra_var_groups); |
|
577 | + } |
|
559 | 578 | |
560 | 579 | $buff[] = '$layout_info->extra_var = new stdClass;'; |
561 | 580 | $extra_var_count = 0; |
@@ -564,7 +583,9 @@ discard block |
||
564 | 583 | $extra_vars = $group->var; |
565 | 584 | if($extra_vars) |
566 | 585 | { |
567 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
586 | + if(!is_array($extra_vars)) { |
|
587 | + $extra_vars = array($extra_vars); |
|
588 | + } |
|
568 | 589 | |
569 | 590 | $count = count($extra_vars); |
570 | 591 | $extra_var_count += $count; |
@@ -583,8 +604,12 @@ discard block |
||
583 | 604 | $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
584 | 605 | |
585 | 606 | $options = $var->options; |
586 | - if(!$options) continue; |
|
587 | - if(!is_array($options)) $options = array($options); |
|
607 | + if(!$options) { |
|
608 | + continue; |
|
609 | + } |
|
610 | + if(!is_array($options)) { |
|
611 | + $options = array($options); |
|
612 | + } |
|
588 | 613 | |
589 | 614 | $buff[] = sprintf('$layout_info->extra_var->%s->options = array();', $var->attrs->name); |
590 | 615 | $options_count = count($options); |
@@ -616,7 +641,9 @@ discard block |
||
616 | 641 | if($xml_obj->menus->menu) |
617 | 642 | { |
618 | 643 | $menus = $xml_obj->menus->menu; |
619 | - if(!is_array($menus)) $menus = array($menus); |
|
644 | + if(!is_array($menus)) { |
|
645 | + $menus = array($menus); |
|
646 | + } |
|
620 | 647 | |
621 | 648 | $menu_count = count($menus); |
622 | 649 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
@@ -624,7 +651,9 @@ discard block |
||
624 | 651 | for($i=0;$i<$menu_count;$i++) |
625 | 652 | { |
626 | 653 | $name = $menus[$i]->attrs->name; |
627 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
654 | + if($menus[$i]->attrs->default == "true") { |
|
655 | + $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
656 | + } |
|
628 | 657 | $buff[] = sprintf('$layout_info->menu->%s = new stdClass;', $name); |
629 | 658 | $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $menus[$i]->attrs->name); |
630 | 659 | $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
@@ -635,8 +664,7 @@ discard block |
||
635 | 664 | $buff[] = sprintf('$layout_info->menu->%s->php_file = "./files/cache/menu/".$vars->%s.".php";',$name, $name); |
636 | 665 | } |
637 | 666 | } |
638 | - } |
|
639 | - else |
|
667 | + } else |
|
640 | 668 | { |
641 | 669 | // Layout title, version and other information |
642 | 670 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -655,14 +683,20 @@ discard block |
||
655 | 683 | $buff[] = sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); |
656 | 684 | // Extra vars (user defined variables to use in a template) |
657 | 685 | $extra_var_groups = $xml_obj->extra_vars->group; |
658 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
659 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
686 | + if(!$extra_var_groups) { |
|
687 | + $extra_var_groups = $xml_obj->extra_vars; |
|
688 | + } |
|
689 | + if(!is_array($extra_var_groups)) { |
|
690 | + $extra_var_groups = array($extra_var_groups); |
|
691 | + } |
|
660 | 692 | foreach($extra_var_groups as $group) |
661 | 693 | { |
662 | 694 | $extra_vars = $group->var; |
663 | 695 | if($extra_vars) |
664 | 696 | { |
665 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
697 | + if(!is_array($extra_vars)) { |
|
698 | + $extra_vars = array($extra_vars); |
|
699 | + } |
|
666 | 700 | |
667 | 701 | $extra_var_count = count($extra_vars); |
668 | 702 | |
@@ -680,9 +714,13 @@ discard block |
||
680 | 714 | $buff[] = sprintf('$layout_info->extra_var->%s->description = "%s";', $name, str_replace('"','\"',$var->description->body)); |
681 | 715 | |
682 | 716 | $options = $var->options; |
683 | - if(!$options) continue; |
|
717 | + if(!$options) { |
|
718 | + continue; |
|
719 | + } |
|
684 | 720 | |
685 | - if(!is_array($options)) $options = array($options); |
|
721 | + if(!is_array($options)) { |
|
722 | + $options = array($options); |
|
723 | + } |
|
686 | 724 | $options_count = count($options); |
687 | 725 | for($j=0;$j<$options_count;$j++) |
688 | 726 | { |
@@ -695,14 +733,18 @@ discard block |
||
695 | 733 | if($xml_obj->menus->menu) |
696 | 734 | { |
697 | 735 | $menus = $xml_obj->menus->menu; |
698 | - if(!is_array($menus)) $menus = array($menus); |
|
736 | + if(!is_array($menus)) { |
|
737 | + $menus = array($menus); |
|
738 | + } |
|
699 | 739 | |
700 | 740 | $menu_count = count($menus); |
701 | 741 | $buff[] = sprintf('$layout_info->menu_count = "%s";', $menu_count); |
702 | 742 | for($i=0;$i<$menu_count;$i++) |
703 | 743 | { |
704 | 744 | $name = $menus[$i]->attrs->name; |
705 | - if($menus[$i]->attrs->default == "true") $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
745 | + if($menus[$i]->attrs->default == "true") { |
|
746 | + $buff[] = sprintf('$layout_info->default_menu = "%s";', $name); |
|
747 | + } |
|
706 | 748 | $buff[] = sprintf('$layout_info->menu->%s->name = "%s";',$name, $name); |
707 | 749 | $buff[] = sprintf('$layout_info->menu->%s->title = "%s";',$name, $menus[$i]->title->body); |
708 | 750 | $buff[] = sprintf('$layout_info->menu->%s->maxdepth = "%s";',$name, $menus[$i]->maxdepth->body); |
@@ -724,7 +766,9 @@ discard block |
||
724 | 766 | } |
725 | 767 | |
726 | 768 | FileHandler::writeFile($cache_file, '<?php if(!defined("__XE__")) exit(); ' . join(PHP_EOL, $buff)); |
727 | - if(FileHandler::exists($cache_file)) include($cache_file); |
|
769 | + if(FileHandler::exists($cache_file)) { |
|
770 | + include($cache_file); |
|
771 | + } |
|
728 | 772 | |
729 | 773 | if(!$layout_info->title) |
730 | 774 | { |
@@ -798,7 +842,9 @@ discard block |
||
798 | 842 | */ |
799 | 843 | function getUserLayoutFaceOffCss($layout_srl) |
800 | 844 | { |
801 | - if($this->useUserLayoutTemp == 'temp') return; |
|
845 | + if($this->useUserLayoutTemp == 'temp') { |
|
846 | + return; |
|
847 | + } |
|
802 | 848 | return $this->_getUserLayoutFaceOffCss($layout_srl); |
803 | 849 | } |
804 | 850 | |
@@ -833,7 +879,9 @@ discard block |
||
833 | 879 | if($this->useUserLayoutTemp == 'temp') |
834 | 880 | { |
835 | 881 | $temp = $this->getUserLayoutTempHtml($layout_srl); |
836 | - if(FileHandler::exists($temp) === FALSE) FileHandler::copyFile($src,$temp); |
|
882 | + if(FileHandler::exists($temp) === FALSE) { |
|
883 | + FileHandler::copyFile($src,$temp); |
|
884 | + } |
|
837 | 885 | return $temp; |
838 | 886 | } |
839 | 887 | |
@@ -861,7 +909,9 @@ discard block |
||
861 | 909 | if($this->useUserLayoutTemp == 'temp') |
862 | 910 | { |
863 | 911 | $temp = $this->getUserLayoutTempIni($layout_srl); |
864 | - if(!file_exists(FileHandler::getRealPath($temp))) FileHandler::copyFile($src,$temp); |
|
912 | + if(!file_exists(FileHandler::getRealPath($temp))) { |
|
913 | + FileHandler::copyFile($src,$temp); |
|
914 | + } |
|
865 | 915 | return $temp; |
866 | 916 | } |
867 | 917 | |
@@ -901,8 +951,7 @@ discard block |
||
901 | 951 | if($layout_type=='P') |
902 | 952 | { |
903 | 953 | return sprintf("%sfiles/cache/layout/%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
904 | - } |
|
905 | - else |
|
954 | + } else |
|
906 | 955 | { |
907 | 956 | return sprintf("%sfiles/cache/layout/m.%s.%s.cache.php", _XE_PATH_, $layout_name,$lang_type); |
908 | 957 | } |
@@ -1020,11 +1069,16 @@ discard block |
||
1020 | 1069 | Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); |
1021 | 1070 | // CSS generated in the layout manager |
1022 | 1071 | $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); |
1023 | - if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); |
|
1072 | + if($faceoff_layout_css) { |
|
1073 | + Context::addCSSFile($faceoff_layout_css); |
|
1074 | + } |
|
1024 | 1075 | // CSS output for the widget |
1025 | 1076 | Context::loadFile($this->module_path.'/tpl/css/widget.css', true); |
1026 | - if($layout_info->extra_var->colorset->value == 'black') Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1027 | - else Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1077 | + if($layout_info->extra_var->colorset->value == 'black') { |
|
1078 | + Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1079 | + } else { |
|
1080 | + Context::loadFile($this->module_path.'/tpl/css/[email protected]', true); |
|
1081 | + } |
|
1028 | 1082 | // Different page displayed upon user's permission |
1029 | 1083 | $logged_info = Context::get('logged_info'); |
1030 | 1084 | // Display edit button for faceoff layout |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | /** |
314 | 314 | * Preview a layout |
315 | - * @return void|Object (void : success, Object : fail) |
|
315 | + * @return Object|null (void : success, Object : fail) |
|
316 | 316 | */ |
317 | 317 | function dispLayoutPreview() |
318 | 318 | { |
@@ -376,6 +376,9 @@ discard block |
||
376 | 376 | $this->setTemplateFile('layout_preview'); |
377 | 377 | } |
378 | 378 | |
379 | + /** |
|
380 | + * @return string |
|
381 | + */ |
|
379 | 382 | private function getRealLayoutFile($layoutSrl) |
380 | 383 | { |
381 | 384 | $oLayoutModel = getModel('layout'); |
@@ -392,6 +395,9 @@ discard block |
||
392 | 395 | |
393 | 396 | } |
394 | 397 | |
398 | + /** |
|
399 | + * @return string |
|
400 | + */ |
|
395 | 401 | private function getRealLayoutCSS($layoutSrl) |
396 | 402 | { |
397 | 403 | $oLayoutModel = getModel('layout'); |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
3 | 3 | /** |
4 | - * @class layoutView |
|
5 | - * @author NAVER ([email protected]) |
|
6 | - * admin view class of the layout module |
|
7 | - */ |
|
4 | + * @class layoutView |
|
5 | + * @author NAVER ([email protected]) |
|
6 | + * admin view class of the layout module |
|
7 | + */ |
|
8 | 8 | class layoutView extends layout |
9 | 9 | { |
10 | 10 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function init() |
15 | 15 | { |
16 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
16 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Get the layout information |
26 | 26 | $oLayoutModel = getModel('layout'); |
27 | 27 | $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); |
28 | - if(!$layout_info) exit(); |
|
28 | + if (!$layout_info) exit(); |
|
29 | 29 | Context::set('layout_info', $layout_info); |
30 | 30 | // Set the layout to be pop-up |
31 | 31 | $this->setLayoutFile('popup_layout'); |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | // admin check |
54 | 54 | // this act is admin view but in normal view because do not load admin css/js files |
55 | 55 | $logged_info = Context::get('logged_info'); |
56 | - if($logged_info->is_admin != 'Y') |
|
56 | + if ($logged_info->is_admin != 'Y') |
|
57 | 57 | { |
58 | 58 | throw new Exception(Context::getLang('msg_invalid_request')); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // if module is 'ARTiCLE' and from site design setting, make content directly |
62 | - if($module == 'ARTICLE' && !$mid) |
|
62 | + if ($module == 'ARTICLE' && !$mid) |
|
63 | 63 | { |
64 | 64 | $oDocumentModel = getModel('document'); |
65 | 65 | $oDocument = $oDocumentModel->getDocument(0, true); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $t = Context::getLang('article_preview_title'); |
68 | 68 | |
69 | 69 | $c = ''; |
70 | - for($i = 0; $i < 4; $i++) |
|
70 | + for ($i = 0; $i < 4; $i++) |
|
71 | 71 | { |
72 | 72 | $c .= '<p>'; |
73 | - for($j = 0; $j < 20; $j++) |
|
73 | + for ($j = 0; $j < 20; $j++) |
|
74 | 74 | { |
75 | 75 | $c .= Context::getLang('article_preview_content') . ' '; |
76 | 76 | } |
@@ -108,15 +108,15 @@ discard block |
||
108 | 108 | Context::set('content', $content); |
109 | 109 | |
110 | 110 | // find layout |
111 | - if($layoutSrl) |
|
111 | + if ($layoutSrl) |
|
112 | 112 | { |
113 | - if($layoutSrl == -1) |
|
113 | + if ($layoutSrl == -1) |
|
114 | 114 | { |
115 | 115 | $site_srl = ($oModule) ? $oModule->module_info->site_srl : 0; |
116 | 116 | $designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl); |
117 | 117 | include($designInfoFile); |
118 | 118 | |
119 | - if($skinType == 'M') |
|
119 | + if ($skinType == 'M') |
|
120 | 120 | { |
121 | 121 | $layoutSrl = $designInfo->mlayout_srl; |
122 | 122 | } |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | $layoutInfo = $oLayoutModel->getLayout($layoutSrl); |
131 | 131 | |
132 | 132 | // If there is no layout, pass it. |
133 | - if($layoutInfo) |
|
133 | + if ($layoutInfo) |
|
134 | 134 | { |
135 | 135 | // Adhoc... |
136 | 136 | |
137 | 137 | // Input extra_vars into $layout_info |
138 | - if($layoutInfo->extra_var_count) |
|
138 | + if ($layoutInfo->extra_var_count) |
|
139 | 139 | { |
140 | 140 | |
141 | - foreach($layoutInfo->extra_var as $var_id => $val) |
|
141 | + foreach ($layoutInfo->extra_var as $var_id => $val) |
|
142 | 142 | { |
143 | - if($val->type == 'image') |
|
143 | + if ($val->type == 'image') |
|
144 | 144 | { |
145 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
145 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
146 | 146 | { |
147 | 147 | $val->value = Context::getRequestUri() . substr($val->value, 2); |
148 | 148 | } |
@@ -152,22 +152,22 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | // Set menus into context |
155 | - if($layoutInfo->menu_count) |
|
155 | + if ($layoutInfo->menu_count) |
|
156 | 156 | { |
157 | - foreach($layoutInfo->menu as $menu_id => $menu) |
|
157 | + foreach ($layoutInfo->menu as $menu_id => $menu) |
|
158 | 158 | { |
159 | 159 | // set default menu set(included home menu) |
160 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
160 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
161 | 161 | { |
162 | 162 | $oMenuAdminController = getAdminController('menu'); |
163 | 163 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
164 | 164 | |
165 | - if(file_exists($homeMenuCacheFile)) |
|
165 | + if (file_exists($homeMenuCacheFile)) |
|
166 | 166 | { |
167 | 167 | include($homeMenuCacheFile); |
168 | 168 | } |
169 | 169 | |
170 | - if(!$menu->menu_srl) |
|
170 | + if (!$menu->menu_srl) |
|
171 | 171 | { |
172 | 172 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
173 | 173 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | |
183 | 183 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
184 | - if(FileHandler::exists($menu->php_file)) |
|
184 | + if (FileHandler::exists($menu->php_file)) |
|
185 | 185 | { |
186 | 186 | include($menu->php_file); |
187 | 187 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | } |
194 | 194 | } |
195 | 195 | } |
196 | - catch(Exception $e) |
|
196 | + catch (Exception $e) |
|
197 | 197 | { |
198 | 198 | $content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>'; |
199 | 199 | Context::set('content', $content); |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | $oTemplate = TemplateHandler::getInstance(); |
205 | 205 | Context::clearHtmlHeader(); |
206 | 206 | |
207 | - if($layoutInfo) |
|
207 | + if ($layoutInfo) |
|
208 | 208 | { |
209 | 209 | $layout_path = $layoutInfo->path; |
210 | 210 | $editLayoutTPL = $this->getRealLayoutFile($layoutSrl); |
211 | 211 | $editLayoutCSS = $this->getRealLayoutCSS($layoutSrl); |
212 | - if($editLayoutCSS != '') |
|
212 | + if ($editLayoutCSS != '') |
|
213 | 213 | { |
214 | 214 | Context::addCSSFile($editLayoutCSS); |
215 | 215 | } |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL); |
228 | - Context::set('layout','none'); |
|
228 | + Context::set('layout', 'none'); |
|
229 | 229 | |
230 | 230 | // Convert widgets and others |
231 | 231 | $oContext = Context::getInstance(); |
232 | 232 | Context::set('layout_tpl', $layout_tpl); |
233 | - $this->setTemplatePath($this->module_path.'tpl'); |
|
233 | + $this->setTemplatePath($this->module_path . 'tpl'); |
|
234 | 234 | $this->setTemplateFile('layout_preview'); |
235 | 235 | } |
236 | 236 | |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | private function procRealModule($module, $mid, $skin, $skinType) |
247 | 247 | { |
248 | 248 | // if form site design and preview module, find target module |
249 | - if($module && !$mid) |
|
249 | + if ($module && !$mid) |
|
250 | 250 | { |
251 | 251 | $args = new stdClass(); |
252 | 252 | $args->module = $module; |
253 | 253 | $output = executeQuery('layout.getOneModuleInstanceByModuleName', $args); |
254 | - if(!$output->toBool()) |
|
254 | + if (!$output->toBool()) |
|
255 | 255 | { |
256 | 256 | throw new Exception($output->getMessage()); |
257 | 257 | } |
258 | 258 | |
259 | 259 | // if there is no module instance, error... |
260 | - if(!$output->data) |
|
260 | + if (!$output->data) |
|
261 | 261 | { |
262 | 262 | throw new Exception(Context::getLang('msg_unabled_preview')); |
263 | 263 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | |
268 | 268 | // if form site design and preview layout, find start module |
269 | - elseif(!$module && !$mid) |
|
269 | + elseif (!$module && !$mid) |
|
270 | 270 | { |
271 | 271 | $oModuleModel = getModel('module'); |
272 | 272 | $columnList = array('modules.mid', 'sites.index_module_srl'); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $oModuleHandler->module_info->is_skin_fix = 'Y'; |
287 | 287 | $oModuleHandler->module_info->is_mskin_fix = 'Y'; |
288 | 288 | |
289 | - if($skinType == 'M') |
|
289 | + if ($skinType == 'M') |
|
290 | 290 | { |
291 | 291 | Mobile::setMobile(TRUE); |
292 | 292 | $oModuleHandler->module_info->mskin = $skin; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | // Proc module |
301 | 301 | $oModule = $oModuleHandler->procModule(); |
302 | - if(!$oModule->toBool()) |
|
302 | + if (!$oModule->toBool()) |
|
303 | 303 | { |
304 | 304 | throw new Exception(Context::getLang('not_support_layout_preview')); |
305 | 305 | } |
@@ -319,36 +319,36 @@ discard block |
||
319 | 319 | // admin check |
320 | 320 | // this act is admin view but in normal view because do not load admin css/js files |
321 | 321 | $logged_info = Context::get('logged_info'); |
322 | - if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request'); |
|
322 | + if ($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request'); |
|
323 | 323 | |
324 | 324 | $layout_srl = Context::get('layout_srl'); |
325 | 325 | $code = Context::get('code'); |
326 | 326 | |
327 | 327 | $code_css = Context::get('code_css'); |
328 | - if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); |
|
328 | + if (!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); |
|
329 | 329 | // Get the layout information |
330 | 330 | $oLayoutModel = getModel('layout'); |
331 | 331 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
332 | - if(!$layout_info) return new Object(-1, 'msg_invalid_request'); |
|
332 | + if (!$layout_info) return new Object(-1, 'msg_invalid_request'); |
|
333 | 333 | // Separately handle the layout if its type is faceoff |
334 | - if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
334 | + if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
335 | 335 | // Apply CSS directly |
336 | - Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>"); |
|
336 | + Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">" . $code_css . "</style>"); |
|
337 | 337 | // Set names and values of extra_vars to $layout_info |
338 | - if($layout_info->extra_var_count) |
|
338 | + if ($layout_info->extra_var_count) |
|
339 | 339 | { |
340 | - foreach($layout_info->extra_var as $var_id => $val) |
|
340 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
341 | 341 | { |
342 | 342 | $layout_info->{$var_id} = $val->value; |
343 | 343 | } |
344 | 344 | } |
345 | 345 | // menu in layout information becomes an argument for Context:: set |
346 | - if($layout_info->menu_count) |
|
346 | + if ($layout_info->menu_count) |
|
347 | 347 | { |
348 | - foreach($layout_info->menu as $menu_id => $menu) |
|
348 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
349 | 349 | { |
350 | 350 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
351 | - if(FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
351 | + if (FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
352 | 352 | |
353 | 353 | Context::set($menu_id, $menu); |
354 | 354 | } |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $layout_file = 'layout'; |
368 | 368 | |
369 | 369 | $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); |
370 | - Context::set('layout','none'); |
|
370 | + Context::set('layout', 'none'); |
|
371 | 371 | // Convert widgets and others |
372 | 372 | $oContext = &Context::getInstance(); |
373 | 373 | Context::set('layout_tpl', $layout_tpl); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $oLayoutModel = getModel('layout'); |
382 | 382 | $layoutFile = $oLayoutModel->getUserLayoutHtml($layoutSrl); |
383 | 383 | |
384 | - if(file_exists($layoutFile)) |
|
384 | + if (file_exists($layoutFile)) |
|
385 | 385 | { |
386 | 386 | return $layoutFile; |
387 | 387 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $oLayoutModel = getModel('layout'); |
398 | 398 | $cssFile = $oLayoutModel->getUserLayoutCss($layoutSrl); |
399 | 399 | |
400 | - if(file_exists($cssFile)) |
|
400 | + if (file_exists($cssFile)) |
|
401 | 401 | { |
402 | 402 | return $cssFile; |
403 | 403 | } |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | // Get the layout information |
26 | 26 | $oLayoutModel = getModel('layout'); |
27 | 27 | $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); |
28 | - if(!$layout_info) exit(); |
|
28 | + if(!$layout_info) { |
|
29 | + exit(); |
|
30 | + } |
|
29 | 31 | Context::set('layout_info', $layout_info); |
30 | 32 | // Set the layout to be pop-up |
31 | 33 | $this->setLayoutFile('popup_layout'); |
@@ -89,8 +91,7 @@ discard block |
||
89 | 91 | { |
90 | 92 | $templatePath = _XE_PATH_ . 'modules/page/m.skins/' . $skin; |
91 | 93 | $templateFile = 'mobile'; |
92 | - } |
|
93 | - else |
|
94 | + } else |
|
94 | 95 | { |
95 | 96 | $templatePath = _XE_PATH_ . 'modules/page/skins/' . $skin; |
96 | 97 | $templateFile = 'content'; |
@@ -119,8 +120,7 @@ discard block |
||
119 | 120 | if($skinType == 'M') |
120 | 121 | { |
121 | 122 | $layoutSrl = $designInfo->mlayout_srl; |
122 | - } |
|
123 | - else |
|
123 | + } else |
|
124 | 124 | { |
125 | 125 | $layoutSrl = $designInfo->layout_srl; |
126 | 126 | } |
@@ -172,8 +172,7 @@ discard block |
||
172 | 172 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
173 | 173 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
174 | 174 | $layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
175 | - } |
|
176 | - else |
|
175 | + } else |
|
177 | 176 | { |
178 | 177 | $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file); |
179 | 178 | $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file); |
@@ -192,8 +191,7 @@ discard block |
||
192 | 191 | Context::set('layout_info', $layoutInfo); |
193 | 192 | } |
194 | 193 | } |
195 | - } |
|
196 | - catch(Exception $e) |
|
194 | + } catch(Exception $e) |
|
197 | 195 | { |
198 | 196 | $content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>'; |
199 | 197 | Context::set('content', $content); |
@@ -217,8 +215,7 @@ discard block |
||
217 | 215 | $oModuleModel = getModel('module'); |
218 | 216 | $part_config = $oModuleModel->getModulePartConfig('layout', $layoutSrl); |
219 | 217 | Context::addHtmlHeader($part_config->header_script); |
220 | - } |
|
221 | - else |
|
218 | + } else |
|
222 | 219 | { |
223 | 220 | $layout_path = './common/tpl'; |
224 | 221 | $layout_file = 'default_layout'; |
@@ -290,8 +287,7 @@ discard block |
||
290 | 287 | { |
291 | 288 | Mobile::setMobile(TRUE); |
292 | 289 | $oModuleHandler->module_info->mskin = $skin; |
293 | - } |
|
294 | - else |
|
290 | + } else |
|
295 | 291 | { |
296 | 292 | Mobile::setMobile(FALSE); |
297 | 293 | $oModuleHandler->module_info->skin = $skin; |
@@ -319,19 +315,27 @@ discard block |
||
319 | 315 | // admin check |
320 | 316 | // this act is admin view but in normal view because do not load admin css/js files |
321 | 317 | $logged_info = Context::get('logged_info'); |
322 | - if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request'); |
|
318 | + if($logged_info->is_admin != 'Y') { |
|
319 | + return $this->stop('msg_invalid_request'); |
|
320 | + } |
|
323 | 321 | |
324 | 322 | $layout_srl = Context::get('layout_srl'); |
325 | 323 | $code = Context::get('code'); |
326 | 324 | |
327 | 325 | $code_css = Context::get('code_css'); |
328 | - if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); |
|
326 | + if(!$layout_srl || !$code) { |
|
327 | + return new Object(-1, 'msg_invalid_request'); |
|
328 | + } |
|
329 | 329 | // Get the layout information |
330 | 330 | $oLayoutModel = getModel('layout'); |
331 | 331 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
332 | - if(!$layout_info) return new Object(-1, 'msg_invalid_request'); |
|
332 | + if(!$layout_info) { |
|
333 | + return new Object(-1, 'msg_invalid_request'); |
|
334 | + } |
|
333 | 335 | // Separately handle the layout if its type is faceoff |
334 | - if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); |
|
336 | + if($layout_info && $layout_info->type == 'faceoff') { |
|
337 | + $oLayoutModel->doActivateFaceOff($layout_info); |
|
338 | + } |
|
335 | 339 | // Apply CSS directly |
336 | 340 | Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>"); |
337 | 341 | // Set names and values of extra_vars to $layout_info |
@@ -348,7 +352,9 @@ discard block |
||
348 | 352 | foreach($layout_info->menu as $menu_id => $menu) |
349 | 353 | { |
350 | 354 | $menu->php_file = FileHandler::getRealPath($menu->php_file); |
351 | - if(FileHandler::exists($menu->php_file)) include($menu->php_file); |
|
355 | + if(FileHandler::exists($menu->php_file)) { |
|
356 | + include($menu->php_file); |
|
357 | + } |
|
352 | 358 | |
353 | 359 | Context::set($menu_id, $menu); |
354 | 360 | } |
@@ -384,8 +390,7 @@ discard block |
||
384 | 390 | if(file_exists($layoutFile)) |
385 | 391 | { |
386 | 392 | return $layoutFile; |
387 | - } |
|
388 | - else |
|
393 | + } else |
|
389 | 394 | { |
390 | 395 | return ''; |
391 | 396 | } |
@@ -400,8 +405,7 @@ discard block |
||
400 | 405 | if(file_exists($cssFile)) |
401 | 406 | { |
402 | 407 | return $cssFile; |
403 | - } |
|
404 | - else |
|
408 | + } else |
|
405 | 409 | { |
406 | 410 | return ''; |
407 | 411 | } |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | /** |
1116 | 1116 | * Insert a group |
1117 | - * @param object $args |
|
1117 | + * @param null|stdClass $args |
|
1118 | 1118 | * @return Object |
1119 | 1119 | */ |
1120 | 1120 | function insertGroup($args) |
@@ -1311,6 +1311,9 @@ discard block |
||
1311 | 1311 | return executeQuery('member.insertDeniedID', $args); |
1312 | 1312 | } |
1313 | 1313 | |
1314 | + /** |
|
1315 | + * @param string $nick_name |
|
1316 | + */ |
|
1314 | 1317 | function insertDeniedNickName($nick_name, $description = '') |
1315 | 1318 | { |
1316 | 1319 | $args = new stdClass(); |
@@ -1284,7 +1284,7 @@ |
||
1284 | 1284 | /** |
1285 | 1285 | * Delete cached group data |
1286 | 1286 | * @return void |
1287 | - */ |
|
1287 | + */ |
|
1288 | 1288 | function _deleteMemberGroupCache($site_srl = 0) |
1289 | 1289 | { |
1290 | 1290 | //remove from cache |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | // if(Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request"); |
25 | 25 | // Extract the necessary information in advance |
26 | 26 | $logged_info = Context::get('logged_info'); |
27 | - if($logged_info->is_admin != 'Y' || !checkCSRF()) |
|
27 | + if ($logged_info->is_admin != 'Y' || !checkCSRF()) |
|
28 | 28 | { |
29 | 29 | return new Object(-1, 'msg_invalid_request'); |
30 | 30 | } |
31 | 31 | |
32 | - $args = Context::gets('member_srl','email_address','find_account_answer', 'allow_mailing','allow_message','denied','is_admin','description','group_srl_list','limit_date'); |
|
33 | - $oMemberModel = &getModel ('member'); |
|
34 | - $config = $oMemberModel->getMemberConfig (); |
|
32 | + $args = Context::gets('member_srl', 'email_address', 'find_account_answer', 'allow_mailing', 'allow_message', 'denied', 'is_admin', 'description', 'group_srl_list', 'limit_date'); |
|
33 | + $oMemberModel = &getModel('member'); |
|
34 | + $config = $oMemberModel->getMemberConfig(); |
|
35 | 35 | $getVars = array(); |
36 | - if($config->signupForm) |
|
36 | + if ($config->signupForm) |
|
37 | 37 | { |
38 | - foreach($config->signupForm as $formInfo) |
|
38 | + foreach ($config->signupForm as $formInfo) |
|
39 | 39 | { |
40 | - if($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
40 | + if ($formInfo->isDefaultForm && ($formInfo->isUse || $formInfo->required || $formInfo->mustRequired)) |
|
41 | 41 | { |
42 | 42 | $getVars[] = $formInfo->name; |
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | - foreach($getVars as $val) |
|
46 | + foreach ($getVars as $val) |
|
47 | 47 | { |
48 | 48 | $args->{$val} = Context::get($val); |
49 | 49 | } |
50 | 50 | $args->member_srl = Context::get('member_srl'); |
51 | - if(Context::get('reset_password')) |
|
51 | + if (Context::get('reset_password')) |
|
52 | 52 | $args->password = Context::get('reset_password'); |
53 | 53 | else unset($args->password); |
54 | 54 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | unset($all_args->error_return_url); |
61 | 61 | unset($all_args->success_return_url); |
62 | 62 | unset($all_args->ruleset); |
63 | - if(!isset($args->limit_date)) $args->limit_date = ""; |
|
63 | + if (!isset($args->limit_date)) $args->limit_date = ""; |
|
64 | 64 | unset($all_args->password); |
65 | 65 | unset($all_args->password2); |
66 | 66 | unset($all_args->reset_password); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $extra_vars = delObjectVars($all_args, $args); |
69 | 69 | $args->extra_vars = serialize($extra_vars); |
70 | 70 | // Check if an original member exists having the member_srl |
71 | - if($args->member_srl) |
|
71 | + if ($args->member_srl) |
|
72 | 72 | { |
73 | 73 | // Create a member model object |
74 | 74 | $oMemberModel = getModel('member'); |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | $columnList = array('member_srl'); |
77 | 77 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl, 0, $columnList); |
78 | 78 | // If no original member exists, make a new one |
79 | - if($member_info->member_srl != $args->member_srl) unset($args->member_srl); |
|
79 | + if ($member_info->member_srl != $args->member_srl) unset($args->member_srl); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // remove whitespace |
83 | 83 | $checkInfos = array('user_id', 'user_name', 'nick_name', 'email_address'); |
84 | - foreach($checkInfos as $val) |
|
84 | + foreach ($checkInfos as $val) |
|
85 | 85 | { |
86 | - if(isset($args->{$val})) |
|
86 | + if (isset($args->{$val})) |
|
87 | 87 | { |
88 | 88 | $args->{$val} = preg_replace('/[\pZ\pC]+/u', '', $args->{$val}); |
89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $oMemberController = getController('member'); |
93 | 93 | // Execute insert or update depending on the value of member_srl |
94 | - if(!$args->member_srl) |
|
94 | + if (!$args->member_srl) |
|
95 | 95 | { |
96 | 96 | $args->password = Context::get('password'); |
97 | 97 | $output = $oMemberController->insertMember($args); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $msg_code = 'success_updated'; |
104 | 104 | } |
105 | 105 | |
106 | - if(!$output->toBool()) return $output; |
|
106 | + if (!$output->toBool()) return $output; |
|
107 | 107 | // Save Signature |
108 | 108 | $signature = Context::get('signature'); |
109 | 109 | $oMemberController->putSignature($args->member_srl, $signature); |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | $this->setMessage($msg_code); |
113 | 113 | |
114 | 114 | $profile_image = $_FILES['profile_image']; |
115 | - if(is_uploaded_file($profile_image['tmp_name'])) |
|
115 | + if (is_uploaded_file($profile_image['tmp_name'])) |
|
116 | 116 | { |
117 | 117 | $oMemberController->insertProfileImage($args->member_srl, $profile_image['tmp_name']); |
118 | 118 | } |
119 | 119 | |
120 | 120 | $image_mark = $_FILES['image_mark']; |
121 | - if(is_uploaded_file($image_mark['tmp_name'])) |
|
121 | + if (is_uploaded_file($image_mark['tmp_name'])) |
|
122 | 122 | { |
123 | 123 | $oMemberController->insertImageMark($args->member_srl, $image_mark['tmp_name']); |
124 | 124 | } |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | |
145 | 145 | $oMemberController = getController('member'); |
146 | 146 | $output = $oMemberController->deleteMember($member_srl); |
147 | - if(!$output->toBool()) return $output; |
|
147 | + if (!$output->toBool()) return $output; |
|
148 | 148 | |
149 | - $this->add('page',Context::get('page')); |
|
149 | + $this->add('page', Context::get('page')); |
|
150 | 150 | $this->setMessage("success_deleted"); |
151 | 151 | } |
152 | 152 | |
@@ -165,26 +165,26 @@ discard block |
||
165 | 165 | ); |
166 | 166 | |
167 | 167 | $oPassword = new Password(); |
168 | - if(!array_key_exists($args->password_hashing_algorithm, $oPassword->getSupportedAlgorithms())) |
|
168 | + if (!array_key_exists($args->password_hashing_algorithm, $oPassword->getSupportedAlgorithms())) |
|
169 | 169 | { |
170 | 170 | $args->password_hashing_algorithm = 'md5'; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $args->password_hashing_work_factor = intval($args->password_hashing_work_factor, 10); |
174 | - if($args->password_hashing_work_factor < 4) |
|
174 | + if ($args->password_hashing_work_factor < 4) |
|
175 | 175 | { |
176 | 176 | $args->password_hashing_work_factor = 4; |
177 | 177 | } |
178 | - if($args->password_hashing_work_factor > 16) |
|
178 | + if ($args->password_hashing_work_factor > 16) |
|
179 | 179 | { |
180 | 180 | $args->password_hashing_work_factor = 16; |
181 | 181 | } |
182 | - if($args->password_hashing_auto_upgrade != 'Y') |
|
182 | + if ($args->password_hashing_auto_upgrade != 'Y') |
|
183 | 183 | { |
184 | 184 | $args->password_hashing_auto_upgrade = 'N'; |
185 | 185 | } |
186 | 186 | |
187 | - if((!$args->webmaster_name || !$args->webmaster_email) && $args->enable_confirm == 'Y') |
|
187 | + if ((!$args->webmaster_name || !$args->webmaster_email) && $args->enable_confirm == 'Y') |
|
188 | 188 | { |
189 | 189 | return new Object(-1, 'msg_mail_authorization'); |
190 | 190 | } |
@@ -219,25 +219,25 @@ discard block |
||
219 | 219 | $usable_list = Context::get('usable_list'); |
220 | 220 | $all_args = Context::getRequestVars(); |
221 | 221 | |
222 | - $args->limit_day = (int)$args->limit_day; |
|
223 | - if(!trim(strip_tags($args->agreement))) |
|
222 | + $args->limit_day = (int) $args->limit_day; |
|
223 | + if (!trim(strip_tags($args->agreement))) |
|
224 | 224 | { |
225 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
225 | + $agreement_file = _XE_PATH_ . 'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
226 | 226 | FileHandler::removeFile($agreement_file); |
227 | 227 | $args->agreement = NULL; |
228 | 228 | } |
229 | 229 | |
230 | - if($args->redirect_url) |
|
230 | + if ($args->redirect_url) |
|
231 | 231 | { |
232 | 232 | $oModuleModel = getModel('module'); |
233 | 233 | $redirectModuleInfo = $oModuleModel->getModuleInfoByModuleSrl($args->redirect_url, array('mid')); |
234 | 234 | |
235 | - if(!$redirectModuleInfo) |
|
235 | + if (!$redirectModuleInfo) |
|
236 | 236 | { |
237 | 237 | return new Object('-1', 'msg_exist_selected_module'); |
238 | 238 | } |
239 | 239 | |
240 | - $args->redirect_url = Context::getDefaultUrl().$redirectModuleInfo->mid; |
|
240 | + $args->redirect_url = Context::getDefaultUrl() . $redirectModuleInfo->mid; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | $args->profile_image = $args->profile_image ? 'Y' : 'N'; |
@@ -256,43 +256,43 @@ discard block |
||
256 | 256 | $items = array('user_id', 'password', 'user_name', 'nick_name', 'email_address', 'find_account_question', 'homepage', 'blog', 'birthday', 'signature', 'profile_image', 'image_name', 'image_mark', 'profile_image_max_width', 'profile_image_max_height', 'image_name_max_width', 'image_name_max_height', 'image_mark_max_width', 'image_mark_max_height'); |
257 | 257 | $mustRequireds = array('email_address', 'nick_name', 'password', 'find_account_question'); |
258 | 258 | $extendItems = $oMemberModel->getJoinFormList(); |
259 | - foreach($list_order as $key) |
|
259 | + foreach ($list_order as $key) |
|
260 | 260 | { |
261 | 261 | $signupItem = new stdClass(); |
262 | 262 | $signupItem->isIdentifier = ($key == $all_args->identifier); |
263 | 263 | $signupItem->isDefaultForm = in_array($key, $items); |
264 | 264 | |
265 | 265 | $signupItem->name = $key; |
266 | - if(!in_array($key, $items)) $signupItem->title = $key; |
|
266 | + if (!in_array($key, $items)) $signupItem->title = $key; |
|
267 | 267 | else $signupItem->title = $lang->{$key}; |
268 | 268 | $signupItem->mustRequired = in_array($key, $mustRequireds); |
269 | 269 | $signupItem->imageType = (strpos($key, 'image') !== false); |
270 | 270 | $signupItem->required = ($all_args->{$key} == 'required') || $signupItem->mustRequired || $signupItem->isIdentifier; |
271 | 271 | $signupItem->isUse = in_array($key, $usable_list) || $signupItem->required; |
272 | - $signupItem->isPublic = ($all_args->{'is_'.$key.'_public'} == 'Y' && $signupItem->isUse) ? 'Y' : 'N'; |
|
273 | - if($signupItem->imageType) |
|
272 | + $signupItem->isPublic = ($all_args->{'is_' . $key . '_public'} == 'Y' && $signupItem->isUse) ? 'Y' : 'N'; |
|
273 | + if ($signupItem->imageType) |
|
274 | 274 | { |
275 | - $signupItem->max_width = $all_args->{$key.'_max_width'}; |
|
276 | - $signupItem->max_height = $all_args->{$key.'_max_height'}; |
|
275 | + $signupItem->max_width = $all_args->{$key . '_max_width'}; |
|
276 | + $signupItem->max_height = $all_args->{$key . '_max_height'}; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // set extends form |
280 | - if(!$signupItem->isDefaultForm) |
|
280 | + if (!$signupItem->isDefaultForm) |
|
281 | 281 | { |
282 | - $extendItem = $extendItems[$all_args->{$key.'_member_join_form_srl'}]; |
|
282 | + $extendItem = $extendItems[$all_args->{$key . '_member_join_form_srl'}]; |
|
283 | 283 | $signupItem->type = $extendItem->column_type; |
284 | 284 | $signupItem->member_join_form_srl = $extendItem->member_join_form_srl; |
285 | 285 | $signupItem->title = $extendItem->column_title; |
286 | 286 | $signupItem->description = $extendItem->description; |
287 | 287 | |
288 | 288 | // check usable value change, required/option |
289 | - if($signupItem->isUse != ($extendItem->is_active == 'Y') || $signupItem->required != ($extendItem->required == 'Y')) |
|
289 | + if ($signupItem->isUse != ($extendItem->is_active == 'Y') || $signupItem->required != ($extendItem->required == 'Y')) |
|
290 | 290 | { |
291 | 291 | unset($update_args); |
292 | 292 | $update_args = new stdClass; |
293 | 293 | $update_args->member_join_form_srl = $extendItem->member_join_form_srl; |
294 | - $update_args->is_active = $signupItem->isUse?'Y':'N'; |
|
295 | - $update_args->required = $signupItem->required?'Y':'N'; |
|
294 | + $update_args->is_active = $signupItem->isUse ? 'Y' : 'N'; |
|
295 | + $update_args->required = $signupItem->required ? 'Y' : 'N'; |
|
296 | 296 | |
297 | 297 | $update_output = executeQuery('member.updateJoinForm', $update_args); |
298 | 298 | } |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | $this->_createFindAccountByQuestion($args->identifier); |
310 | 310 | |
311 | 311 | // check agreement value exist |
312 | - if($args->agreement) |
|
312 | + if ($args->agreement) |
|
313 | 313 | { |
314 | - $agreement_file = _XE_PATH_.'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
314 | + $agreement_file = _XE_PATH_ . 'files/member_extra_info/agreement_' . Context::get('lang_type') . '.txt'; |
|
315 | 315 | $output = FileHandler::writeFile($agreement_file, $args->agreement); |
316 | 316 | |
317 | 317 | unset($args->agreement); |
@@ -339,16 +339,16 @@ discard block |
||
339 | 339 | 'after_logout_url' |
340 | 340 | ); |
341 | 341 | |
342 | - if(!$args->change_password_date) |
|
342 | + if (!$args->change_password_date) |
|
343 | 343 | { |
344 | 344 | $args->change_password_date = 0; |
345 | 345 | } |
346 | 346 | |
347 | - if(!trim(strip_tags($args->after_login_url))) |
|
347 | + if (!trim(strip_tags($args->after_login_url))) |
|
348 | 348 | { |
349 | 349 | $args->after_login_url = NULL; |
350 | 350 | } |
351 | - if(!trim(strip_tags($args->after_logout_url))) |
|
351 | + if (!trim(strip_tags($args->after_logout_url))) |
|
352 | 352 | { |
353 | 353 | $args->after_logout_url = NULL; |
354 | 354 | } |
@@ -375,17 +375,17 @@ discard block |
||
375 | 375 | ); |
376 | 376 | |
377 | 377 | $args->layout_srl = $args->layout_srl ? $args->layout_srl : NULL; |
378 | - if(!$args->skin) |
|
378 | + if (!$args->skin) |
|
379 | 379 | { |
380 | 380 | $args->skin = 'default'; |
381 | 381 | } |
382 | - if(!$args->colorset) |
|
382 | + if (!$args->colorset) |
|
383 | 383 | { |
384 | 384 | $args->colorset = 'white'; |
385 | 385 | } |
386 | 386 | |
387 | 387 | $args->mlayout_srl = $args->mlayout_srl ? $args->mlayout_srl : NULL; |
388 | - if(!$args->mskin) |
|
388 | + if (!$args->mskin) |
|
389 | 389 | { |
390 | 390 | $args->mskin = 'default'; |
391 | 391 | } |
@@ -408,12 +408,12 @@ discard block |
||
408 | 408 | $extendItems = $oMemberModel->getJoinFormList(); |
409 | 409 | |
410 | 410 | $items = array('user_id', 'password', 'user_name', 'nick_name', 'email_address', 'find_account_question', 'homepage', 'blog', 'birthday', 'signature', 'profile_image', 'image_name', 'image_mark'); |
411 | - $mustRequireds = array('email_address', 'nick_name','password', 'find_account_question'); |
|
411 | + $mustRequireds = array('email_address', 'nick_name', 'password', 'find_account_question'); |
|
412 | 412 | $orgRequireds = array('email_address', 'password', 'find_account_question', 'user_id', 'nick_name', 'user_name'); |
413 | 413 | $orgUse = array('email_address', 'password', 'find_account_question', 'user_id', 'nick_name', 'user_name', 'homepage', 'blog', 'birthday'); |
414 | 414 | $list_order = array(); |
415 | 415 | |
416 | - foreach($items as $key) |
|
416 | + foreach ($items as $key) |
|
417 | 417 | { |
418 | 418 | unset($signupItem); |
419 | 419 | $signupItem = new stdClass; |
@@ -425,23 +425,23 @@ discard block |
||
425 | 425 | $signupItem->required = in_array($key, $orgRequireds); |
426 | 426 | $signupItem->isUse = ($config->{$key} == 'Y') || in_array($key, $orgUse); |
427 | 427 | $signupItem->isPublic = ($signupItem->isUse) ? 'Y' : 'N'; |
428 | - if($key == 'find_account_question' || $key == 'password') |
|
428 | + if ($key == 'find_account_question' || $key == 'password') |
|
429 | 429 | { |
430 | 430 | $signupItem->isPublic = 'N'; |
431 | 431 | } |
432 | 432 | $signupItem->isIdentifier = ($key == $identifier); |
433 | - if ($signupItem->imageType){ |
|
434 | - $signupItem->max_width = $config->{$key.'_max_width'}; |
|
435 | - $signupItem->max_height = $config->{$key.'_max_height'}; |
|
433 | + if ($signupItem->imageType) { |
|
434 | + $signupItem->max_width = $config->{$key . '_max_width'}; |
|
435 | + $signupItem->max_height = $config->{$key . '_max_height'}; |
|
436 | 436 | } |
437 | - if($signupItem->isIdentifier) |
|
437 | + if ($signupItem->isIdentifier) |
|
438 | 438 | array_unshift($list_order, $signupItem); |
439 | 439 | else |
440 | 440 | $list_order[] = $signupItem; |
441 | 441 | } |
442 | - if(is_array($extendItems)) |
|
442 | + if (is_array($extendItems)) |
|
443 | 443 | { |
444 | - foreach($extendItems as $form_srl=>$item_info) |
|
444 | + foreach ($extendItems as $form_srl=>$item_info) |
|
445 | 445 | { |
446 | 446 | unset($signupItem); |
447 | 447 | $signupItem = new stdClass; |
@@ -454,10 +454,10 @@ discard block |
||
454 | 454 | $signupItem->isUse = ($item_info->is_active == 'Y'); |
455 | 455 | $signupItem->isPublic = ($signupItem->isUse) ? 'Y' : 'N'; |
456 | 456 | $signupItem->description = $item_info->description; |
457 | - if($signupItem->imageType) |
|
457 | + if ($signupItem->imageType) |
|
458 | 458 | { |
459 | - $signupItem->max_width = $config->{$key.'_max_width'}; |
|
460 | - $signupItem->max_height = $config->{$key.'_max_height'}; |
|
459 | + $signupItem->max_width = $config->{$key . '_max_width'}; |
|
460 | + $signupItem->max_height = $config->{$key . '_max_height'}; |
|
461 | 461 | } |
462 | 462 | $list_order[] = $signupItem; |
463 | 463 | } |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | * @param string $agreement |
473 | 473 | * @return void |
474 | 474 | */ |
475 | - function _createSignupRuleset($signupForm, $agreement = null){ |
|
475 | + function _createSignupRuleset($signupForm, $agreement = null) { |
|
476 | 476 | $xml_file = './files/ruleset/insertMember.xml'; |
477 | - $buff = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL. |
|
478 | - '<ruleset version="1.5.0">' . PHP_EOL. |
|
479 | - '<customrules>' . PHP_EOL. |
|
480 | - '</customrules>' . PHP_EOL. |
|
481 | - '<fields>' . PHP_EOL . '%s' . PHP_EOL . '</fields>' . PHP_EOL. |
|
477 | + $buff = '<?xml version="1.0" encoding="utf-8"?>' . PHP_EOL . |
|
478 | + '<ruleset version="1.5.0">' . PHP_EOL . |
|
479 | + '<customrules>' . PHP_EOL . |
|
480 | + '</customrules>' . PHP_EOL . |
|
481 | + '<fields>' . PHP_EOL . '%s' . PHP_EOL . '</fields>' . PHP_EOL . |
|
482 | 482 | '</ruleset>'; |
483 | 483 | |
484 | 484 | $fields = array(); |
@@ -487,41 +487,41 @@ discard block |
||
487 | 487 | { |
488 | 488 | $fields[] = '<field name="accept_agreement"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /></field>'; |
489 | 489 | } |
490 | - foreach($signupForm as $formInfo) |
|
490 | + foreach ($signupForm as $formInfo) |
|
491 | 491 | { |
492 | - if($formInfo->required || $formInfo->mustRequired) |
|
492 | + if ($formInfo->required || $formInfo->mustRequired) |
|
493 | 493 | { |
494 | - if($formInfo->type == 'tel' || $formInfo->type == 'kr_zip') |
|
494 | + if ($formInfo->type == 'tel' || $formInfo->type == 'kr_zip') |
|
495 | 495 | { |
496 | 496 | $fields[] = sprintf('<field name="%s[]" required="true" />', $formInfo->name); |
497 | 497 | } |
498 | - else if($formInfo->name == 'password') |
|
498 | + else if ($formInfo->name == 'password') |
|
499 | 499 | { |
500 | 500 | $fields[] = '<field name="password"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /><if test="$act == \'procMemberInsert\'" attr="length" value="4:20" /></field>'; |
501 | 501 | $fields[] = '<field name="password2"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /><if test="$act == \'procMemberInsert\'" attr="equalto" value="password" /></field>'; |
502 | 502 | } |
503 | - else if($formInfo->name == 'find_account_question') |
|
503 | + else if ($formInfo->name == 'find_account_question') |
|
504 | 504 | { |
505 | 505 | $fields[] = '<field name="find_account_question" required="true" />'; |
506 | 506 | $fields[] = '<field name="find_account_answer" required="true" length=":250" />'; |
507 | 507 | } |
508 | - else if($formInfo->name == 'email_address') |
|
508 | + else if ($formInfo->name == 'email_address') |
|
509 | 509 | { |
510 | 510 | $fields[] = sprintf('<field name="%s" required="true" rule="email"/>', $formInfo->name); |
511 | 511 | } |
512 | - else if($formInfo->name == 'user_id') |
|
512 | + else if ($formInfo->name == 'user_id') |
|
513 | 513 | { |
514 | 514 | $fields[] = sprintf('<field name="%s" required="true" rule="userid" length="3:20" />', $formInfo->name); |
515 | 515 | } |
516 | - else if($formInfo->name == 'nick_name') |
|
516 | + else if ($formInfo->name == 'nick_name') |
|
517 | 517 | { |
518 | 518 | $fields[] = sprintf('<field name="%s" required="true" length="2:20" />', $formInfo->name); |
519 | 519 | } |
520 | - else if(strpos($formInfo->name, 'image') !== false) |
|
520 | + else if (strpos($formInfo->name, 'image') !== false) |
|
521 | 521 | { |
522 | 522 | $fields[] = sprintf('<field name="%s"><if test="$act != \'procMemberAdminInsert\' && $__%s_exist != \'true\'" attr="required" value="true" /></field>', $formInfo->name, $formInfo->name); |
523 | 523 | } |
524 | - else if($formInfo->name == 'signature') |
|
524 | + else if ($formInfo->name == 'signature') |
|
525 | 525 | { |
526 | 526 | $fields[] = '<field name="signature"><if test="$member_srl" attr="required" value="true" /></field>'; |
527 | 527 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | FileHandler::writeFile($xml_file, $xml_buff); |
537 | 537 | unset($xml_buff); |
538 | 538 | |
539 | - $validator = new Validator($xml_file); |
|
539 | + $validator = new Validator($xml_file); |
|
540 | 540 | $validator->setCacheDir('files/cache'); |
541 | 541 | $validator->getJsPath(); |
542 | 542 | } |
@@ -549,11 +549,11 @@ discard block |
||
549 | 549 | function _createLoginRuleset($identifier) |
550 | 550 | { |
551 | 551 | $xml_file = './files/ruleset/login.xml'; |
552 | - $buff = '<?xml version="1.0" encoding="utf-8"?>'. |
|
553 | - '<ruleset version="1.5.0">'. |
|
554 | - '<customrules>'. |
|
555 | - '</customrules>'. |
|
556 | - '<fields>%s</fields>'. |
|
552 | + $buff = '<?xml version="1.0" encoding="utf-8"?>' . |
|
553 | + '<ruleset version="1.5.0">' . |
|
554 | + '<customrules>' . |
|
555 | + '</customrules>' . |
|
556 | + '<fields>%s</fields>' . |
|
557 | 557 | '</ruleset>'; |
558 | 558 | |
559 | 559 | $fields = array(); |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $xml_buff = sprintf($buff, implode('', $fields)); |
565 | 565 | Filehandler::writeFile($xml_file, $xml_buff); |
566 | 566 | |
567 | - $validator = new Validator($xml_file); |
|
567 | + $validator = new Validator($xml_file); |
|
568 | 568 | $validator->setCacheDir('files/cache'); |
569 | 569 | $validator->getJsPath(); |
570 | 570 | } |
@@ -577,15 +577,15 @@ discard block |
||
577 | 577 | function _createFindAccountByQuestion($identifier) |
578 | 578 | { |
579 | 579 | $xml_file = './files/ruleset/find_member_account_by_question.xml'; |
580 | - $buff = '<?xml version="1.0" encoding="utf-8"?>'. |
|
581 | - '<ruleset version="1.5.0">'. |
|
582 | - '<customrules>'. |
|
583 | - '</customrules>'. |
|
584 | - '<fields>%s</fields>'. |
|
580 | + $buff = '<?xml version="1.0" encoding="utf-8"?>' . |
|
581 | + '<ruleset version="1.5.0">' . |
|
582 | + '<customrules>' . |
|
583 | + '</customrules>' . |
|
584 | + '<fields>%s</fields>' . |
|
585 | 585 | '</ruleset>'; |
586 | 586 | |
587 | 587 | $fields = array(); |
588 | - if($identifier == 'user_id') |
|
588 | + if ($identifier == 'user_id') |
|
589 | 589 | $fields[] = '<field name="user_id" required="true" rule="userid" />'; |
590 | 590 | |
591 | 591 | $fields[] = '<field name="email_address" required="true" rule="email" />'; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | $xml_buff = sprintf($buff, implode('', $fields)); |
596 | 596 | Filehandler::writeFile($xml_file, $xml_buff); |
597 | 597 | |
598 | - $validator = new Validator($xml_file); |
|
598 | + $validator = new Validator($xml_file); |
|
599 | 599 | $validator->setCacheDir('files/cache'); |
600 | 600 | $validator->getJsPath(); |
601 | 601 | } |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | */ |
607 | 607 | function procMemberAdminInsertGroup() |
608 | 608 | { |
609 | - $args = Context::gets('title','description','is_default','image_mark'); |
|
609 | + $args = Context::gets('title', 'description', 'is_default', 'image_mark'); |
|
610 | 610 | $output = $this->insertGroup($args); |
611 | - if(!$output->toBool()) return $output; |
|
611 | + if (!$output->toBool()) return $output; |
|
612 | 612 | |
613 | - $this->add('group_srl',''); |
|
614 | - $this->add('page',Context::get('page')); |
|
613 | + $this->add('group_srl', ''); |
|
614 | + $this->add('page', Context::get('page')); |
|
615 | 615 | $this->setMessage('success_registed'); |
616 | 616 | |
617 | 617 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | { |
627 | 627 | $group_srl = Context::get('group_srl'); |
628 | 628 | |
629 | - $args = Context::gets('group_srl','title','description','is_default','image_mark'); |
|
629 | + $args = Context::gets('group_srl', 'title', 'description', 'is_default', 'image_mark'); |
|
630 | 630 | $args->site_srl = 0; |
631 | 631 | $output = $this->updateGroup($args); |
632 | - if(!$output->toBool()) return $output; |
|
632 | + if (!$output->toBool()) return $output; |
|
633 | 633 | |
634 | - $this->add('group_srl',''); |
|
635 | - $this->add('page',Context::get('page')); |
|
634 | + $this->add('group_srl', ''); |
|
635 | + $this->add('page', Context::get('page')); |
|
636 | 636 | $this->setMessage('success_updated'); |
637 | 637 | |
638 | 638 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | $group_srl = Context::get('group_srl'); |
649 | 649 | |
650 | 650 | $output = $this->deleteGroup($group_srl); |
651 | - if(!$output->toBool()) return $output; |
|
651 | + if (!$output->toBool()) return $output; |
|
652 | 652 | |
653 | - $this->add('group_srl',''); |
|
654 | - $this->add('page',Context::get('page')); |
|
653 | + $this->add('group_srl', ''); |
|
654 | + $this->add('page', Context::get('page')); |
|
655 | 655 | $this->setMessage('success_deleted'); |
656 | 656 | |
657 | 657 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
@@ -673,10 +673,10 @@ discard block |
||
673 | 673 | $args->default_value = explode("\n", str_replace("\r", '', Context::get('default_value'))); |
674 | 674 | $args->required = Context::get('required'); |
675 | 675 | $args->is_active = (isset($args->required)); |
676 | - if(!in_array(strtoupper($args->required), array('Y','N')))$args->required = 'N'; |
|
676 | + if (!in_array(strtoupper($args->required), array('Y', 'N')))$args->required = 'N'; |
|
677 | 677 | $args->description = Context::get('description') ? Context::get('description') : ''; |
678 | 678 | // Default values |
679 | - if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value)) |
|
679 | + if (in_array($args->column_type, array('checkbox', 'select', 'radio')) && count($args->default_value)) |
|
680 | 680 | { |
681 | 681 | $args->default_value = serialize($args->default_value); |
682 | 682 | } |
@@ -688,17 +688,17 @@ discard block |
||
688 | 688 | // Check ID duplicated |
689 | 689 | $oMemberModel = getModel('member'); |
690 | 690 | $config = $oMemberModel->getMemberConfig(); |
691 | - foreach($config->signupForm as $item) |
|
691 | + foreach ($config->signupForm as $item) |
|
692 | 692 | { |
693 | - if($item->name == $args->column_name) |
|
693 | + if ($item->name == $args->column_name) |
|
694 | 694 | { |
695 | - if($args->member_join_form_srl && $args->member_join_form_srl == $item->member_join_form_srl) continue; |
|
696 | - return new Object(-1,'msg_exists_user_id'); |
|
695 | + if ($args->member_join_form_srl && $args->member_join_form_srl == $item->member_join_form_srl) continue; |
|
696 | + return new Object(-1, 'msg_exists_user_id'); |
|
697 | 697 | } |
698 | 698 | } |
699 | 699 | // Fix if member_join_form_srl exists. Add if not exists. |
700 | 700 | $isInsert; |
701 | - if(!$args->member_join_form_srl) |
|
701 | + if (!$args->member_join_form_srl) |
|
702 | 702 | { |
703 | 703 | $isInsert = true; |
704 | 704 | $args->list_order = $args->member_join_form_srl = getNextSequence(); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | $output = executeQuery('member.updateJoinForm', $args); |
710 | 710 | } |
711 | 711 | |
712 | - if(!$output->toBool()) return $output; |
|
712 | + if (!$output->toBool()) return $output; |
|
713 | 713 | |
714 | 714 | // memberConfig update |
715 | 715 | $signupItem = new stdClass(); |
@@ -726,15 +726,15 @@ discard block |
||
726 | 726 | $config = $oMemberModel->getMemberConfig(); |
727 | 727 | unset($config->agreement); |
728 | 728 | |
729 | - if($isInsert) |
|
729 | + if ($isInsert) |
|
730 | 730 | { |
731 | 731 | $config->signupForm[] = $signupItem; |
732 | 732 | } |
733 | 733 | else |
734 | 734 | { |
735 | - foreach($config->signupForm as $key=>$val) |
|
735 | + foreach ($config->signupForm as $key=>$val) |
|
736 | 736 | { |
737 | - if($val->member_join_form_srl == $signupItem->member_join_form_srl) |
|
737 | + if ($val->member_join_form_srl == $signupItem->member_join_form_srl) |
|
738 | 738 | { |
739 | 739 | $config->signupForm[$key] = $signupItem; |
740 | 740 | } |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | $config = $oMemberModel->getMemberConfig(); |
763 | 763 | unset($config->agreement); |
764 | 764 | |
765 | - foreach($config->signupForm as $key=>$val) |
|
765 | + foreach ($config->signupForm as $key=>$val) |
|
766 | 766 | { |
767 | - if($val->member_join_form_srl == $member_join_form_srl) |
|
767 | + if ($val->member_join_form_srl == $member_join_form_srl) |
|
768 | 768 | { |
769 | 769 | unset($config->signupForm[$key]); |
770 | 770 | break; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $member_join_form_srl = Context::get('member_join_form_srl'); |
785 | 785 | $mode = Context::get('mode'); |
786 | 786 | |
787 | - switch($mode) |
|
787 | + switch ($mode) |
|
788 | 788 | { |
789 | 789 | case 'up' : |
790 | 790 | $output = $this->moveJoinFormUp($member_join_form_srl); |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | case 'update' : |
802 | 802 | break; |
803 | 803 | } |
804 | - if(!$output->toBool()) return $output; |
|
804 | + if (!$output->toBool()) return $output; |
|
805 | 805 | |
806 | 806 | $this->setMessage($msg_code); |
807 | 807 | } |
@@ -820,40 +820,40 @@ discard block |
||
820 | 820 | $oDB->begin(); |
821 | 821 | |
822 | 822 | $oMemberController = getController('member'); |
823 | - foreach($members as $key=>$member_srl) |
|
823 | + foreach ($members as $key=>$member_srl) |
|
824 | 824 | { |
825 | 825 | $args = new stdClass(); |
826 | 826 | $args->member_srl = $member_srl; |
827 | - switch($var->type) |
|
827 | + switch ($var->type) |
|
828 | 828 | { |
829 | 829 | case 'modify': |
830 | 830 | { |
831 | - if(count($groups) > 0) |
|
831 | + if (count($groups) > 0) |
|
832 | 832 | { |
833 | 833 | $args->site_srl = 0; |
834 | 834 | // One of its members to delete all the group |
835 | 835 | $output = executeQuery('member.deleteMemberGroupMember', $args); |
836 | - if(!$output->toBool()) |
|
836 | + if (!$output->toBool()) |
|
837 | 837 | { |
838 | 838 | $oDB->rollback(); |
839 | 839 | return $output; |
840 | 840 | } |
841 | 841 | // Enter one of the loop a |
842 | - foreach($groups as $group_srl) |
|
842 | + foreach ($groups as $group_srl) |
|
843 | 843 | { |
844 | - $output = $oMemberController->addMemberToGroup($args->member_srl,$group_srl); |
|
845 | - if(!$output->toBool()) |
|
844 | + $output = $oMemberController->addMemberToGroup($args->member_srl, $group_srl); |
|
845 | + if (!$output->toBool()) |
|
846 | 846 | { |
847 | 847 | $oDB->rollback(); |
848 | 848 | return $output; |
849 | 849 | } |
850 | 850 | } |
851 | 851 | } |
852 | - if($var->denied) |
|
852 | + if ($var->denied) |
|
853 | 853 | { |
854 | 854 | $args->denied = $var->denied; |
855 | 855 | $output = executeQuery('member.updateMemberDeniedInfo', $args); |
856 | - if(!$output->toBool()) |
|
856 | + if (!$output->toBool()) |
|
857 | 857 | { |
858 | 858 | $oDB->rollback(); |
859 | 859 | return $output; |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | { |
867 | 867 | $oMemberController->memberInfo = null; |
868 | 868 | $output = $oMemberController->deleteMember($member_srl); |
869 | - if(!$output->toBool()) |
|
869 | + if (!$output->toBool()) |
|
870 | 870 | { |
871 | 871 | $oDB->rollback(); |
872 | 872 | return $output; |
@@ -879,15 +879,15 @@ discard block |
||
879 | 879 | |
880 | 880 | $message = $var->message; |
881 | 881 | // Send a message |
882 | - if($message) |
|
882 | + if ($message) |
|
883 | 883 | { |
884 | 884 | $oCommunicationController = getController('communication'); |
885 | 885 | |
886 | 886 | $logged_info = Context::get('logged_info'); |
887 | - $title = cut_str($message,10,'...'); |
|
887 | + $title = cut_str($message, 10, '...'); |
|
888 | 888 | $sender_member_srl = $logged_info->member_srl; |
889 | 889 | |
890 | - foreach($members as $member_srl) |
|
890 | + foreach ($members as $member_srl) |
|
891 | 891 | { |
892 | 892 | $oCommunicationController->sendMessage($sender_member_srl, $member_srl, $title, $message, false); |
893 | 893 | } |
@@ -904,14 +904,14 @@ discard block |
||
904 | 904 | function procMemberAdminDeleteMembers() |
905 | 905 | { |
906 | 906 | $target_member_srls = Context::get('target_member_srls'); |
907 | - if(!$target_member_srls) return new Object(-1, 'msg_invalid_request'); |
|
907 | + if (!$target_member_srls) return new Object(-1, 'msg_invalid_request'); |
|
908 | 908 | $member_srls = explode(',', $target_member_srls); |
909 | 909 | $oMemberController = getController('member'); |
910 | 910 | |
911 | - foreach($member_srls as $member) |
|
911 | + foreach ($member_srls as $member) |
|
912 | 912 | { |
913 | 913 | $output = $oMemberController->deleteMember($member); |
914 | - if(!$output->toBool()) |
|
914 | + if (!$output->toBool()) |
|
915 | 915 | { |
916 | 916 | $this->setMessage('failed_deleted'); |
917 | 917 | return $output; |
@@ -928,11 +928,11 @@ discard block |
||
928 | 928 | function procMemberAdminUpdateMembersGroup() |
929 | 929 | { |
930 | 930 | $member_srl = Context::get('member_srl'); |
931 | - if(!$member_srl) return new Object(-1,'msg_invalid_request'); |
|
932 | - $member_srls = explode(',',$member_srl); |
|
931 | + if (!$member_srl) return new Object(-1, 'msg_invalid_request'); |
|
932 | + $member_srls = explode(',', $member_srl); |
|
933 | 933 | |
934 | 934 | $group_srl = Context::get('group_srls'); |
935 | - if(!is_array($group_srl)) $group_srls = explode('|@|', $group_srl); |
|
935 | + if (!is_array($group_srl)) $group_srls = explode('|@|', $group_srl); |
|
936 | 936 | else $group_srls = $group_srl; |
937 | 937 | |
938 | 938 | $oDB = &DB::getInstance(); |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | $args = new stdClass; |
942 | 942 | $args->member_srl = $member_srl; |
943 | 943 | $output = executeQuery('member.deleteMembersGroup', $args); |
944 | - if(!$output->toBool()) |
|
944 | + if (!$output->toBool()) |
|
945 | 945 | { |
946 | 946 | $oDB->rollback(); |
947 | 947 | return $output; |
@@ -949,21 +949,21 @@ discard block |
||
949 | 949 | // Add to a selected group |
950 | 950 | $group_count = count($group_srls); |
951 | 951 | $member_count = count($member_srls); |
952 | - for($j=0;$j<$group_count;$j++) |
|
952 | + for ($j = 0; $j < $group_count; $j++) |
|
953 | 953 | { |
954 | - $group_srl = (int)trim($group_srls[$j]); |
|
955 | - if(!$group_srl) continue; |
|
956 | - for($i=0;$i<$member_count;$i++) |
|
954 | + $group_srl = (int) trim($group_srls[$j]); |
|
955 | + if (!$group_srl) continue; |
|
956 | + for ($i = 0; $i < $member_count; $i++) |
|
957 | 957 | { |
958 | - $member_srl = (int)trim($member_srls[$i]); |
|
959 | - if(!$member_srl) continue; |
|
958 | + $member_srl = (int) trim($member_srls[$i]); |
|
959 | + if (!$member_srl) continue; |
|
960 | 960 | |
961 | 961 | $args = new stdClass; |
962 | 962 | $args->member_srl = $member_srl; |
963 | 963 | $args->group_srl = $group_srl; |
964 | 964 | |
965 | 965 | $output = executeQuery('member.addMemberToGroup', $args); |
966 | - if(!$output->toBool()) |
|
966 | + if (!$output->toBool()) |
|
967 | 967 | { |
968 | 968 | $oDB->rollback(); |
969 | 969 | return $output; |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | |
977 | 977 | $this->setMessage('success_updated'); |
978 | 978 | |
979 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
979 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
980 | 980 | { |
981 | 981 | global $lang; |
982 | 982 | htmlHeader(); |
@@ -997,19 +997,19 @@ discard block |
||
997 | 997 | { |
998 | 998 | $user_ids = Context::get('user_id'); |
999 | 999 | |
1000 | - $user_ids = explode(',',$user_ids); |
|
1000 | + $user_ids = explode(',', $user_ids); |
|
1001 | 1001 | $success_ids = array(); |
1002 | 1002 | |
1003 | - foreach($user_ids as $val) |
|
1003 | + foreach ($user_ids as $val) |
|
1004 | 1004 | { |
1005 | 1005 | $val = trim($val); |
1006 | - if(!$val) continue; |
|
1006 | + if (!$val) continue; |
|
1007 | 1007 | |
1008 | 1008 | $output = $this->insertDeniedID($val, ''); |
1009 | - if($output->toBool()) $success_ids[] = $val; |
|
1009 | + if ($output->toBool()) $success_ids[] = $val; |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | - $this->add('user_ids', implode(',',$success_ids)); |
|
1012 | + $this->add('user_ids', implode(',', $success_ids)); |
|
1013 | 1013 | |
1014 | 1014 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminDeniedIDList'); |
1015 | 1015 | $this->setRedirectUrl($returnUrl); |
@@ -1026,10 +1026,10 @@ discard block |
||
1026 | 1026 | $mode = Context::get('mode'); |
1027 | 1027 | $mode = $mode ? $mode : 'insert'; |
1028 | 1028 | |
1029 | - if($mode == 'delete') |
|
1029 | + if ($mode == 'delete') |
|
1030 | 1030 | { |
1031 | 1031 | $output = $this->deleteDeniedNickName($nick_name); |
1032 | - if(!$output->toBool()) |
|
1032 | + if (!$output->toBool()) |
|
1033 | 1033 | { |
1034 | 1034 | return $output; |
1035 | 1035 | } |
@@ -1038,19 +1038,19 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | else |
1040 | 1040 | { |
1041 | - $nick_names = explode(',',$nick_name); |
|
1041 | + $nick_names = explode(',', $nick_name); |
|
1042 | 1042 | $success_nick_names = array(); |
1043 | 1043 | |
1044 | - foreach($nick_names as $val) |
|
1044 | + foreach ($nick_names as $val) |
|
1045 | 1045 | { |
1046 | 1046 | $val = trim($val); |
1047 | - if(!$val) continue; |
|
1047 | + if (!$val) continue; |
|
1048 | 1048 | |
1049 | 1049 | $output = $this->insertDeniedNickName($val, ''); |
1050 | - if($output->toBool()) $success_nick_names[] = $val; |
|
1050 | + if ($output->toBool()) $success_nick_names[] = $val; |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | - $this->add('nick_names', implode(',',$success_nick_names)); |
|
1053 | + $this->add('nick_names', implode(',', $success_nick_names)); |
|
1054 | 1054 | } |
1055 | 1055 | } |
1056 | 1056 | |
@@ -1063,16 +1063,16 @@ discard block |
||
1063 | 1063 | $user_id = Context::get('user_id'); |
1064 | 1064 | $mode = Context::get('mode'); |
1065 | 1065 | |
1066 | - switch($mode) |
|
1066 | + switch ($mode) |
|
1067 | 1067 | { |
1068 | 1068 | case 'delete' : |
1069 | 1069 | $output = $this->deleteDeniedID($user_id); |
1070 | - if(!$output->toBool()) return $output; |
|
1070 | + if (!$output->toBool()) return $output; |
|
1071 | 1071 | $msg_code = 'success_deleted'; |
1072 | 1072 | break; |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - $this->add('page',Context::get('page')); |
|
1075 | + $this->add('page', Context::get('page')); |
|
1076 | 1076 | $this->setMessage($msg_code); |
1077 | 1077 | } |
1078 | 1078 | |
@@ -1119,24 +1119,24 @@ discard block |
||
1119 | 1119 | */ |
1120 | 1120 | function insertGroup($args) |
1121 | 1121 | { |
1122 | - if(!$args->site_srl) $args->site_srl = 0; |
|
1122 | + if (!$args->site_srl) $args->site_srl = 0; |
|
1123 | 1123 | // Check the value of is_default. |
1124 | - if($args->is_default != 'Y') |
|
1124 | + if ($args->is_default != 'Y') |
|
1125 | 1125 | { |
1126 | 1126 | $args->is_default = 'N'; |
1127 | 1127 | } |
1128 | 1128 | else |
1129 | 1129 | { |
1130 | 1130 | $output = executeQuery('member.updateGroupDefaultClear', $args); |
1131 | - if(!$output->toBool()) return $output; |
|
1131 | + if (!$output->toBool()) return $output; |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | - if(!isset($args->list_order) || $args->list_order=='') |
|
1134 | + if (!isset($args->list_order) || $args->list_order == '') |
|
1135 | 1135 | { |
1136 | 1136 | $args->list_order = $args->group_srl; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | - if(!$args->group_srl) $args->group_srl = getNextSequence(); |
|
1139 | + if (!$args->group_srl) $args->group_srl = getNextSequence(); |
|
1140 | 1140 | $args->list_order = $args->group_srl; |
1141 | 1141 | $output = executeQuery('member.insertGroup', $args); |
1142 | 1142 | $this->_deleteMemberGroupCache($args->site_srl); |
@@ -1151,17 +1151,17 @@ discard block |
||
1151 | 1151 | */ |
1152 | 1152 | function updateGroup($args) |
1153 | 1153 | { |
1154 | - if(!$args->site_srl) $args->site_srl = 0; |
|
1154 | + if (!$args->site_srl) $args->site_srl = 0; |
|
1155 | 1155 | // Check the value of is_default. |
1156 | - if(!$args->group_srl) return new Object(-1, 'lang->msg_not_founded'); |
|
1157 | - if($args->is_default!='Y') |
|
1156 | + if (!$args->group_srl) return new Object(-1, 'lang->msg_not_founded'); |
|
1157 | + if ($args->is_default != 'Y') |
|
1158 | 1158 | { |
1159 | 1159 | $args->is_default = 'N'; |
1160 | 1160 | } |
1161 | 1161 | else |
1162 | 1162 | { |
1163 | 1163 | $output = executeQuery('member.updateGroupDefaultClear', $args); |
1164 | - if(!$output->toBool()) return $output; |
|
1164 | + if (!$output->toBool()) return $output; |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | $output = executeQuery('member.updateGroup', $args); |
@@ -1184,8 +1184,8 @@ discard block |
||
1184 | 1184 | $columnList = array('group_srl', 'is_default'); |
1185 | 1185 | $group_info = $oMemberModel->getGroup($group_srl, $columnList); |
1186 | 1186 | |
1187 | - if(!$group_info) return new Object(-1, 'lang->msg_not_founded'); |
|
1188 | - if($group_info->is_default == 'Y') return new Object(-1, 'msg_not_delete_default'); |
|
1187 | + if (!$group_info) return new Object(-1, 'lang->msg_not_founded'); |
|
1188 | + if ($group_info->is_default == 'Y') return new Object(-1, 'msg_not_delete_default'); |
|
1189 | 1189 | |
1190 | 1190 | // Get groups where is_default == 'Y' |
1191 | 1191 | $columnList = array('site_srl', 'group_srl'); |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | $defaultGroup = $oMemberModel->getDefaultGroup(0); |
1223 | 1223 | $defaultGroupSrl = $defaultGroup->group_srl; |
1224 | 1224 | $group_srls = $vars->group_srls; |
1225 | - foreach($group_srls as $order=>$group_srl) |
|
1225 | + foreach ($group_srls as $order=>$group_srl) |
|
1226 | 1226 | { |
1227 | 1227 | $isInsert = false; |
1228 | 1228 | $update_args = new stdClass(); |
@@ -1231,9 +1231,9 @@ discard block |
||
1231 | 1231 | $update_args->image_mark = $vars->image_marks[$order]; |
1232 | 1232 | $update_args->list_order = $order + 1; |
1233 | 1233 | |
1234 | - if(!$update_args->title) continue; |
|
1234 | + if (!$update_args->title) continue; |
|
1235 | 1235 | |
1236 | - if(is_numeric($group_srl)) { |
|
1236 | + if (is_numeric($group_srl)) { |
|
1237 | 1237 | $update_args->group_srl = $group_srl; |
1238 | 1238 | $output = $this->updateGroup($update_args); |
1239 | 1239 | } |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | $output = $this->insertGroup($update_args); |
1243 | 1243 | } |
1244 | 1244 | |
1245 | - if($vars->defaultGroup == $group_srl) { |
|
1245 | + if ($vars->defaultGroup == $group_srl) { |
|
1246 | 1246 | $defaultGroupSrl = $update_args->group_srl; |
1247 | 1247 | } |
1248 | 1248 | } |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | $default_args->group_srl = $defaultGroupSrl; |
1254 | 1254 | $output = $this->updateGroup($default_args); |
1255 | 1255 | |
1256 | - $this->setMessage(Context::getLang('success_updated').' ('.Context::getLang('msg_insert_group_name_detail').')'); |
|
1256 | + $this->setMessage(Context::getLang('success_updated') . ' (' . Context::getLang('msg_insert_group_name_detail') . ')'); |
|
1257 | 1257 | |
1258 | 1258 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispMemberAdminGroupList'); |
1259 | 1259 | $this->setRedirectUrl($returnUrl); |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | { |
1269 | 1269 | $vars = Context::getRequestVars(); |
1270 | 1270 | |
1271 | - foreach($vars->group_srls as $key => $val) |
|
1271 | + foreach ($vars->group_srls as $key => $val) |
|
1272 | 1272 | { |
1273 | 1273 | $args = new stdClass; |
1274 | 1274 | $args->group_srl = $val; |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | { |
1290 | 1290 | //remove from cache |
1291 | 1291 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1292 | - if($oCacheHandler->isSupport()) |
|
1292 | + if ($oCacheHandler->isSupport()) |
|
1293 | 1293 | { |
1294 | 1294 | $oCacheHandler->invalidateGroupKey('member'); |
1295 | 1295 | } |
@@ -1306,7 +1306,7 @@ discard block |
||
1306 | 1306 | $args = new stdClass(); |
1307 | 1307 | $args->user_id = $user_id; |
1308 | 1308 | $args->description = $description; |
1309 | - $args->list_order = -1*getNextSequence(); |
|
1309 | + $args->list_order = -1 * getNextSequence(); |
|
1310 | 1310 | |
1311 | 1311 | return executeQuery('member.insertDeniedID', $args); |
1312 | 1312 | } |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | */ |
1328 | 1328 | function deleteDeniedID($user_id) |
1329 | 1329 | { |
1330 | - if(!$user_id) unset($user_id); |
|
1330 | + if (!$user_id) unset($user_id); |
|
1331 | 1331 | |
1332 | 1332 | $args = new stdClass; |
1333 | 1333 | $args->user_id = $user_id; |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | */ |
1342 | 1342 | function deleteDeniedNickName($nick_name) |
1343 | 1343 | { |
1344 | - if(!$nick_name) unset($nick_name); |
|
1344 | + if (!$nick_name) unset($nick_name); |
|
1345 | 1345 | |
1346 | 1346 | $args = new stdClass; |
1347 | 1347 | $args->nick_name = $nick_name; |
@@ -1380,16 +1380,16 @@ discard block |
||
1380 | 1380 | // Get a list of all join forms |
1381 | 1381 | $join_form_list = $oMemberModel->getJoinFormList(); |
1382 | 1382 | $join_form_srl_list = array_keys($join_form_list); |
1383 | - if(count($join_form_srl_list)<2) return new Object(); |
|
1383 | + if (count($join_form_srl_list) < 2) return new Object(); |
|
1384 | 1384 | |
1385 | 1385 | $prev_member_join_form = NULL; |
1386 | - foreach($join_form_list as $key => $val) |
|
1386 | + foreach ($join_form_list as $key => $val) |
|
1387 | 1387 | { |
1388 | - if($val->member_join_form_srl == $member_join_form_srl) break; |
|
1388 | + if ($val->member_join_form_srl == $member_join_form_srl) break; |
|
1389 | 1389 | $prev_member_join_form = $val; |
1390 | 1390 | } |
1391 | 1391 | // Return if no previous join form exists |
1392 | - if(!$prev_member_join_form) return new Object(); |
|
1392 | + if (!$prev_member_join_form) return new Object(); |
|
1393 | 1393 | // Information of the join form |
1394 | 1394 | $cur_args = new stdClass; |
1395 | 1395 | $cur_args->member_join_form_srl = $member_join_form_srl; |
@@ -1400,10 +1400,10 @@ discard block |
||
1400 | 1400 | $prev_args->list_order = $list_order; |
1401 | 1401 | // Execute Query |
1402 | 1402 | $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); |
1403 | - if(!$output->toBool()) return $output; |
|
1403 | + if (!$output->toBool()) return $output; |
|
1404 | 1404 | |
1405 | 1405 | executeQuery('member.updateMemberJoinFormListorder', $prev_args); |
1406 | - if(!$output->toBool()) return $output; |
|
1406 | + if (!$output->toBool()) return $output; |
|
1407 | 1407 | |
1408 | 1408 | return new Object(); |
1409 | 1409 | } |
@@ -1427,16 +1427,16 @@ discard block |
||
1427 | 1427 | // Get information of all join forms |
1428 | 1428 | $join_form_list = $oMemberModel->getJoinFormList(); |
1429 | 1429 | $join_form_srl_list = array_keys($join_form_list); |
1430 | - if(count($join_form_srl_list)<2) return new Object(); |
|
1430 | + if (count($join_form_srl_list) < 2) return new Object(); |
|
1431 | 1431 | |
1432 | - for($i=0;$i<count($join_form_srl_list);$i++) |
|
1432 | + for ($i = 0; $i < count($join_form_srl_list); $i++) |
|
1433 | 1433 | { |
1434 | - if($join_form_srl_list[$i]==$member_join_form_srl) break; |
|
1434 | + if ($join_form_srl_list[$i] == $member_join_form_srl) break; |
|
1435 | 1435 | } |
1436 | 1436 | |
1437 | - $next_member_join_form_srl = $join_form_srl_list[$i+1]; |
|
1437 | + $next_member_join_form_srl = $join_form_srl_list[$i + 1]; |
|
1438 | 1438 | // Return if no previous join form exists |
1439 | - if(!$next_member_join_form_srl) return new Object(); |
|
1439 | + if (!$next_member_join_form_srl) return new Object(); |
|
1440 | 1440 | $next_member_join_form = $join_form_list[$next_member_join_form_srl]; |
1441 | 1441 | // Information of the join form |
1442 | 1442 | $cur_args = new stdClass; |
@@ -1448,10 +1448,10 @@ discard block |
||
1448 | 1448 | $next_args->list_order = $list_order; |
1449 | 1449 | // Execute Query |
1450 | 1450 | $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); |
1451 | - if(!$output->toBool()) return $output; |
|
1451 | + if (!$output->toBool()) return $output; |
|
1452 | 1452 | |
1453 | 1453 | $output = executeQuery('member.updateMemberJoinFormListorder', $next_args); |
1454 | - if(!$output->toBool()) return $output; |
|
1454 | + if (!$output->toBool()) return $output; |
|
1455 | 1455 | |
1456 | 1456 | return new Object(); |
1457 | 1457 | } |
@@ -48,9 +48,11 @@ discard block |
||
48 | 48 | $args->{$val} = Context::get($val); |
49 | 49 | } |
50 | 50 | $args->member_srl = Context::get('member_srl'); |
51 | - if(Context::get('reset_password')) |
|
52 | - $args->password = Context::get('reset_password'); |
|
53 | - else unset($args->password); |
|
51 | + if(Context::get('reset_password')) { |
|
52 | + $args->password = Context::get('reset_password'); |
|
53 | + } else { |
|
54 | + unset($args->password); |
|
55 | + } |
|
54 | 56 | |
55 | 57 | // Remove some unnecessary variables from all the vars |
56 | 58 | $all_args = Context::getRequestVars(); |
@@ -60,7 +62,9 @@ discard block |
||
60 | 62 | unset($all_args->error_return_url); |
61 | 63 | unset($all_args->success_return_url); |
62 | 64 | unset($all_args->ruleset); |
63 | - if(!isset($args->limit_date)) $args->limit_date = ""; |
|
65 | + if(!isset($args->limit_date)) { |
|
66 | + $args->limit_date = ""; |
|
67 | + } |
|
64 | 68 | unset($all_args->password); |
65 | 69 | unset($all_args->password2); |
66 | 70 | unset($all_args->reset_password); |
@@ -76,7 +80,9 @@ discard block |
||
76 | 80 | $columnList = array('member_srl'); |
77 | 81 | $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl, 0, $columnList); |
78 | 82 | // If no original member exists, make a new one |
79 | - if($member_info->member_srl != $args->member_srl) unset($args->member_srl); |
|
83 | + if($member_info->member_srl != $args->member_srl) { |
|
84 | + unset($args->member_srl); |
|
85 | + } |
|
80 | 86 | } |
81 | 87 | |
82 | 88 | // remove whitespace |
@@ -96,14 +102,15 @@ discard block |
||
96 | 102 | $args->password = Context::get('password'); |
97 | 103 | $output = $oMemberController->insertMember($args); |
98 | 104 | $msg_code = 'success_registed'; |
99 | - } |
|
100 | - else |
|
105 | + } else |
|
101 | 106 | { |
102 | 107 | $output = $oMemberController->updateMember($args); |
103 | 108 | $msg_code = 'success_updated'; |
104 | 109 | } |
105 | 110 | |
106 | - if(!$output->toBool()) return $output; |
|
111 | + if(!$output->toBool()) { |
|
112 | + return $output; |
|
113 | + } |
|
107 | 114 | // Save Signature |
108 | 115 | $signature = Context::get('signature'); |
109 | 116 | $oMemberController->putSignature($args->member_srl, $signature); |
@@ -144,7 +151,9 @@ discard block |
||
144 | 151 | |
145 | 152 | $oMemberController = getController('member'); |
146 | 153 | $output = $oMemberController->deleteMember($member_srl); |
147 | - if(!$output->toBool()) return $output; |
|
154 | + if(!$output->toBool()) { |
|
155 | + return $output; |
|
156 | + } |
|
148 | 157 | |
149 | 158 | $this->add('page',Context::get('page')); |
150 | 159 | $this->setMessage("success_deleted"); |
@@ -263,8 +272,11 @@ discard block |
||
263 | 272 | $signupItem->isDefaultForm = in_array($key, $items); |
264 | 273 | |
265 | 274 | $signupItem->name = $key; |
266 | - if(!in_array($key, $items)) $signupItem->title = $key; |
|
267 | - else $signupItem->title = $lang->{$key}; |
|
275 | + if(!in_array($key, $items)) { |
|
276 | + $signupItem->title = $key; |
|
277 | + } else { |
|
278 | + $signupItem->title = $lang->{$key}; |
|
279 | + } |
|
268 | 280 | $signupItem->mustRequired = in_array($key, $mustRequireds); |
269 | 281 | $signupItem->imageType = (strpos($key, 'image') !== false); |
270 | 282 | $signupItem->required = ($all_args->{$key} == 'required') || $signupItem->mustRequired || $signupItem->isIdentifier; |
@@ -434,10 +446,11 @@ discard block |
||
434 | 446 | $signupItem->max_width = $config->{$key.'_max_width'}; |
435 | 447 | $signupItem->max_height = $config->{$key.'_max_height'}; |
436 | 448 | } |
437 | - if($signupItem->isIdentifier) |
|
438 | - array_unshift($list_order, $signupItem); |
|
439 | - else |
|
440 | - $list_order[] = $signupItem; |
|
449 | + if($signupItem->isIdentifier) { |
|
450 | + array_unshift($list_order, $signupItem); |
|
451 | + } else { |
|
452 | + $list_order[] = $signupItem; |
|
453 | + } |
|
441 | 454 | } |
442 | 455 | if(is_array($extendItems)) |
443 | 456 | { |
@@ -494,38 +507,30 @@ discard block |
||
494 | 507 | if($formInfo->type == 'tel' || $formInfo->type == 'kr_zip') |
495 | 508 | { |
496 | 509 | $fields[] = sprintf('<field name="%s[]" required="true" />', $formInfo->name); |
497 | - } |
|
498 | - else if($formInfo->name == 'password') |
|
510 | + } else if($formInfo->name == 'password') |
|
499 | 511 | { |
500 | 512 | $fields[] = '<field name="password"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /><if test="$act == \'procMemberInsert\'" attr="length" value="4:20" /></field>'; |
501 | 513 | $fields[] = '<field name="password2"><if test="$act == \'procMemberInsert\'" attr="required" value="true" /><if test="$act == \'procMemberInsert\'" attr="equalto" value="password" /></field>'; |
502 | - } |
|
503 | - else if($formInfo->name == 'find_account_question') |
|
514 | + } else if($formInfo->name == 'find_account_question') |
|
504 | 515 | { |
505 | 516 | $fields[] = '<field name="find_account_question" required="true" />'; |
506 | 517 | $fields[] = '<field name="find_account_answer" required="true" length=":250" />'; |
507 | - } |
|
508 | - else if($formInfo->name == 'email_address') |
|
518 | + } else if($formInfo->name == 'email_address') |
|
509 | 519 | { |
510 | 520 | $fields[] = sprintf('<field name="%s" required="true" rule="email"/>', $formInfo->name); |
511 | - } |
|
512 | - else if($formInfo->name == 'user_id') |
|
521 | + } else if($formInfo->name == 'user_id') |
|
513 | 522 | { |
514 | 523 | $fields[] = sprintf('<field name="%s" required="true" rule="userid" length="3:20" />', $formInfo->name); |
515 | - } |
|
516 | - else if($formInfo->name == 'nick_name') |
|
524 | + } else if($formInfo->name == 'nick_name') |
|
517 | 525 | { |
518 | 526 | $fields[] = sprintf('<field name="%s" required="true" length="2:20" />', $formInfo->name); |
519 | - } |
|
520 | - else if(strpos($formInfo->name, 'image') !== false) |
|
527 | + } else if(strpos($formInfo->name, 'image') !== false) |
|
521 | 528 | { |
522 | 529 | $fields[] = sprintf('<field name="%s"><if test="$act != \'procMemberAdminInsert\' && $__%s_exist != \'true\'" attr="required" value="true" /></field>', $formInfo->name, $formInfo->name); |
523 | - } |
|
524 | - else if($formInfo->name == 'signature') |
|
530 | + } else if($formInfo->name == 'signature') |
|
525 | 531 | { |
526 | 532 | $fields[] = '<field name="signature"><if test="$member_srl" attr="required" value="true" /></field>'; |
527 | - } |
|
528 | - else |
|
533 | + } else |
|
529 | 534 | { |
530 | 535 | $fields[] = sprintf('<field name="%s" required="true" />', $formInfo->name); |
531 | 536 | } |
@@ -585,8 +590,9 @@ discard block |
||
585 | 590 | '</ruleset>'; |
586 | 591 | |
587 | 592 | $fields = array(); |
588 | - if($identifier == 'user_id') |
|
589 | - $fields[] = '<field name="user_id" required="true" rule="userid" />'; |
|
593 | + if($identifier == 'user_id') { |
|
594 | + $fields[] = '<field name="user_id" required="true" rule="userid" />'; |
|
595 | + } |
|
590 | 596 | |
591 | 597 | $fields[] = '<field name="email_address" required="true" rule="email" />'; |
592 | 598 | $fields[] = '<field name="find_account_question" required="true" />'; |
@@ -608,7 +614,9 @@ discard block |
||
608 | 614 | { |
609 | 615 | $args = Context::gets('title','description','is_default','image_mark'); |
610 | 616 | $output = $this->insertGroup($args); |
611 | - if(!$output->toBool()) return $output; |
|
617 | + if(!$output->toBool()) { |
|
618 | + return $output; |
|
619 | + } |
|
612 | 620 | |
613 | 621 | $this->add('group_srl',''); |
614 | 622 | $this->add('page',Context::get('page')); |
@@ -629,7 +637,9 @@ discard block |
||
629 | 637 | $args = Context::gets('group_srl','title','description','is_default','image_mark'); |
630 | 638 | $args->site_srl = 0; |
631 | 639 | $output = $this->updateGroup($args); |
632 | - if(!$output->toBool()) return $output; |
|
640 | + if(!$output->toBool()) { |
|
641 | + return $output; |
|
642 | + } |
|
633 | 643 | |
634 | 644 | $this->add('group_srl',''); |
635 | 645 | $this->add('page',Context::get('page')); |
@@ -648,7 +658,9 @@ discard block |
||
648 | 658 | $group_srl = Context::get('group_srl'); |
649 | 659 | |
650 | 660 | $output = $this->deleteGroup($group_srl); |
651 | - if(!$output->toBool()) return $output; |
|
661 | + if(!$output->toBool()) { |
|
662 | + return $output; |
|
663 | + } |
|
652 | 664 | |
653 | 665 | $this->add('group_srl',''); |
654 | 666 | $this->add('page',Context::get('page')); |
@@ -673,14 +685,15 @@ discard block |
||
673 | 685 | $args->default_value = explode("\n", str_replace("\r", '', Context::get('default_value'))); |
674 | 686 | $args->required = Context::get('required'); |
675 | 687 | $args->is_active = (isset($args->required)); |
676 | - if(!in_array(strtoupper($args->required), array('Y','N')))$args->required = 'N'; |
|
688 | + if(!in_array(strtoupper($args->required), array('Y','N'))) { |
|
689 | + $args->required = 'N'; |
|
690 | + } |
|
677 | 691 | $args->description = Context::get('description') ? Context::get('description') : ''; |
678 | 692 | // Default values |
679 | 693 | if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value)) |
680 | 694 | { |
681 | 695 | $args->default_value = serialize($args->default_value); |
682 | - } |
|
683 | - else |
|
696 | + } else |
|
684 | 697 | { |
685 | 698 | $args->default_value = ''; |
686 | 699 | } |
@@ -692,7 +705,9 @@ discard block |
||
692 | 705 | { |
693 | 706 | if($item->name == $args->column_name) |
694 | 707 | { |
695 | - if($args->member_join_form_srl && $args->member_join_form_srl == $item->member_join_form_srl) continue; |
|
708 | + if($args->member_join_form_srl && $args->member_join_form_srl == $item->member_join_form_srl) { |
|
709 | + continue; |
|
710 | + } |
|
696 | 711 | return new Object(-1,'msg_exists_user_id'); |
697 | 712 | } |
698 | 713 | } |
@@ -703,13 +718,14 @@ discard block |
||
703 | 718 | $isInsert = true; |
704 | 719 | $args->list_order = $args->member_join_form_srl = getNextSequence(); |
705 | 720 | $output = executeQuery('member.insertJoinForm', $args); |
706 | - } |
|
707 | - else |
|
721 | + } else |
|
708 | 722 | { |
709 | 723 | $output = executeQuery('member.updateJoinForm', $args); |
710 | 724 | } |
711 | 725 | |
712 | - if(!$output->toBool()) return $output; |
|
726 | + if(!$output->toBool()) { |
|
727 | + return $output; |
|
728 | + } |
|
713 | 729 | |
714 | 730 | // memberConfig update |
715 | 731 | $signupItem = new stdClass(); |
@@ -729,8 +745,7 @@ discard block |
||
729 | 745 | if($isInsert) |
730 | 746 | { |
731 | 747 | $config->signupForm[] = $signupItem; |
732 | - } |
|
733 | - else |
|
748 | + } else |
|
734 | 749 | { |
735 | 750 | foreach($config->signupForm as $key=>$val) |
736 | 751 | { |
@@ -801,7 +816,9 @@ discard block |
||
801 | 816 | case 'update' : |
802 | 817 | break; |
803 | 818 | } |
804 | - if(!$output->toBool()) return $output; |
|
819 | + if(!$output->toBool()) { |
|
820 | + return $output; |
|
821 | + } |
|
805 | 822 | |
806 | 823 | $this->setMessage($msg_code); |
807 | 824 | } |
@@ -904,7 +921,9 @@ discard block |
||
904 | 921 | function procMemberAdminDeleteMembers() |
905 | 922 | { |
906 | 923 | $target_member_srls = Context::get('target_member_srls'); |
907 | - if(!$target_member_srls) return new Object(-1, 'msg_invalid_request'); |
|
924 | + if(!$target_member_srls) { |
|
925 | + return new Object(-1, 'msg_invalid_request'); |
|
926 | + } |
|
908 | 927 | $member_srls = explode(',', $target_member_srls); |
909 | 928 | $oMemberController = getController('member'); |
910 | 929 | |
@@ -928,12 +947,17 @@ discard block |
||
928 | 947 | function procMemberAdminUpdateMembersGroup() |
929 | 948 | { |
930 | 949 | $member_srl = Context::get('member_srl'); |
931 | - if(!$member_srl) return new Object(-1,'msg_invalid_request'); |
|
950 | + if(!$member_srl) { |
|
951 | + return new Object(-1,'msg_invalid_request'); |
|
952 | + } |
|
932 | 953 | $member_srls = explode(',',$member_srl); |
933 | 954 | |
934 | 955 | $group_srl = Context::get('group_srls'); |
935 | - if(!is_array($group_srl)) $group_srls = explode('|@|', $group_srl); |
|
936 | - else $group_srls = $group_srl; |
|
956 | + if(!is_array($group_srl)) { |
|
957 | + $group_srls = explode('|@|', $group_srl); |
|
958 | + } else { |
|
959 | + $group_srls = $group_srl; |
|
960 | + } |
|
937 | 961 | |
938 | 962 | $oDB = &DB::getInstance(); |
939 | 963 | $oDB->begin(); |
@@ -952,11 +976,15 @@ discard block |
||
952 | 976 | for($j=0;$j<$group_count;$j++) |
953 | 977 | { |
954 | 978 | $group_srl = (int)trim($group_srls[$j]); |
955 | - if(!$group_srl) continue; |
|
979 | + if(!$group_srl) { |
|
980 | + continue; |
|
981 | + } |
|
956 | 982 | for($i=0;$i<$member_count;$i++) |
957 | 983 | { |
958 | 984 | $member_srl = (int)trim($member_srls[$i]); |
959 | - if(!$member_srl) continue; |
|
985 | + if(!$member_srl) { |
|
986 | + continue; |
|
987 | + } |
|
960 | 988 | |
961 | 989 | $args = new stdClass; |
962 | 990 | $args->member_srl = $member_srl; |
@@ -1003,10 +1031,14 @@ discard block |
||
1003 | 1031 | foreach($user_ids as $val) |
1004 | 1032 | { |
1005 | 1033 | $val = trim($val); |
1006 | - if(!$val) continue; |
|
1034 | + if(!$val) { |
|
1035 | + continue; |
|
1036 | + } |
|
1007 | 1037 | |
1008 | 1038 | $output = $this->insertDeniedID($val, ''); |
1009 | - if($output->toBool()) $success_ids[] = $val; |
|
1039 | + if($output->toBool()) { |
|
1040 | + $success_ids[] = $val; |
|
1041 | + } |
|
1010 | 1042 | } |
1011 | 1043 | |
1012 | 1044 | $this->add('user_ids', implode(',',$success_ids)); |
@@ -1035,8 +1067,7 @@ discard block |
||
1035 | 1067 | } |
1036 | 1068 | $msg_code = 'success_deleted'; |
1037 | 1069 | $this->setMessage($msg_code); |
1038 | - } |
|
1039 | - else |
|
1070 | + } else |
|
1040 | 1071 | { |
1041 | 1072 | $nick_names = explode(',',$nick_name); |
1042 | 1073 | $success_nick_names = array(); |
@@ -1044,10 +1075,14 @@ discard block |
||
1044 | 1075 | foreach($nick_names as $val) |
1045 | 1076 | { |
1046 | 1077 | $val = trim($val); |
1047 | - if(!$val) continue; |
|
1078 | + if(!$val) { |
|
1079 | + continue; |
|
1080 | + } |
|
1048 | 1081 | |
1049 | 1082 | $output = $this->insertDeniedNickName($val, ''); |
1050 | - if($output->toBool()) $success_nick_names[] = $val; |
|
1083 | + if($output->toBool()) { |
|
1084 | + $success_nick_names[] = $val; |
|
1085 | + } |
|
1051 | 1086 | } |
1052 | 1087 | |
1053 | 1088 | $this->add('nick_names', implode(',',$success_nick_names)); |
@@ -1067,7 +1102,9 @@ discard block |
||
1067 | 1102 | { |
1068 | 1103 | case 'delete' : |
1069 | 1104 | $output = $this->deleteDeniedID($user_id); |
1070 | - if(!$output->toBool()) return $output; |
|
1105 | + if(!$output->toBool()) { |
|
1106 | + return $output; |
|
1107 | + } |
|
1071 | 1108 | $msg_code = 'success_deleted'; |
1072 | 1109 | break; |
1073 | 1110 | } |
@@ -1119,16 +1156,19 @@ discard block |
||
1119 | 1156 | */ |
1120 | 1157 | function insertGroup($args) |
1121 | 1158 | { |
1122 | - if(!$args->site_srl) $args->site_srl = 0; |
|
1159 | + if(!$args->site_srl) { |
|
1160 | + $args->site_srl = 0; |
|
1161 | + } |
|
1123 | 1162 | // Check the value of is_default. |
1124 | 1163 | if($args->is_default != 'Y') |
1125 | 1164 | { |
1126 | 1165 | $args->is_default = 'N'; |
1127 | - } |
|
1128 | - else |
|
1166 | + } else |
|
1129 | 1167 | { |
1130 | 1168 | $output = executeQuery('member.updateGroupDefaultClear', $args); |
1131 | - if(!$output->toBool()) return $output; |
|
1169 | + if(!$output->toBool()) { |
|
1170 | + return $output; |
|
1171 | + } |
|
1132 | 1172 | } |
1133 | 1173 | |
1134 | 1174 | if(!isset($args->list_order) || $args->list_order=='') |
@@ -1136,7 +1176,9 @@ discard block |
||
1136 | 1176 | $args->list_order = $args->group_srl; |
1137 | 1177 | } |
1138 | 1178 | |
1139 | - if(!$args->group_srl) $args->group_srl = getNextSequence(); |
|
1179 | + if(!$args->group_srl) { |
|
1180 | + $args->group_srl = getNextSequence(); |
|
1181 | + } |
|
1140 | 1182 | $args->list_order = $args->group_srl; |
1141 | 1183 | $output = executeQuery('member.insertGroup', $args); |
1142 | 1184 | $this->_deleteMemberGroupCache($args->site_srl); |
@@ -1151,17 +1193,22 @@ discard block |
||
1151 | 1193 | */ |
1152 | 1194 | function updateGroup($args) |
1153 | 1195 | { |
1154 | - if(!$args->site_srl) $args->site_srl = 0; |
|
1196 | + if(!$args->site_srl) { |
|
1197 | + $args->site_srl = 0; |
|
1198 | + } |
|
1155 | 1199 | // Check the value of is_default. |
1156 | - if(!$args->group_srl) return new Object(-1, 'lang->msg_not_founded'); |
|
1200 | + if(!$args->group_srl) { |
|
1201 | + return new Object(-1, 'lang->msg_not_founded'); |
|
1202 | + } |
|
1157 | 1203 | if($args->is_default!='Y') |
1158 | 1204 | { |
1159 | 1205 | $args->is_default = 'N'; |
1160 | - } |
|
1161 | - else |
|
1206 | + } else |
|
1162 | 1207 | { |
1163 | 1208 | $output = executeQuery('member.updateGroupDefaultClear', $args); |
1164 | - if(!$output->toBool()) return $output; |
|
1209 | + if(!$output->toBool()) { |
|
1210 | + return $output; |
|
1211 | + } |
|
1165 | 1212 | } |
1166 | 1213 | |
1167 | 1214 | $output = executeQuery('member.updateGroup', $args); |
@@ -1184,8 +1231,12 @@ discard block |
||
1184 | 1231 | $columnList = array('group_srl', 'is_default'); |
1185 | 1232 | $group_info = $oMemberModel->getGroup($group_srl, $columnList); |
1186 | 1233 | |
1187 | - if(!$group_info) return new Object(-1, 'lang->msg_not_founded'); |
|
1188 | - if($group_info->is_default == 'Y') return new Object(-1, 'msg_not_delete_default'); |
|
1234 | + if(!$group_info) { |
|
1235 | + return new Object(-1, 'lang->msg_not_founded'); |
|
1236 | + } |
|
1237 | + if($group_info->is_default == 'Y') { |
|
1238 | + return new Object(-1, 'msg_not_delete_default'); |
|
1239 | + } |
|
1189 | 1240 | |
1190 | 1241 | // Get groups where is_default == 'Y' |
1191 | 1242 | $columnList = array('site_srl', 'group_srl'); |
@@ -1231,13 +1282,14 @@ discard block |
||
1231 | 1282 | $update_args->image_mark = $vars->image_marks[$order]; |
1232 | 1283 | $update_args->list_order = $order + 1; |
1233 | 1284 | |
1234 | - if(!$update_args->title) continue; |
|
1285 | + if(!$update_args->title) { |
|
1286 | + continue; |
|
1287 | + } |
|
1235 | 1288 | |
1236 | 1289 | if(is_numeric($group_srl)) { |
1237 | 1290 | $update_args->group_srl = $group_srl; |
1238 | 1291 | $output = $this->updateGroup($update_args); |
1239 | - } |
|
1240 | - else { |
|
1292 | + } else { |
|
1241 | 1293 | $update_args->group_srl = getNextSequence(); |
1242 | 1294 | $output = $this->insertGroup($update_args); |
1243 | 1295 | } |
@@ -1327,7 +1379,9 @@ discard block |
||
1327 | 1379 | */ |
1328 | 1380 | function deleteDeniedID($user_id) |
1329 | 1381 | { |
1330 | - if(!$user_id) unset($user_id); |
|
1382 | + if(!$user_id) { |
|
1383 | + unset($user_id); |
|
1384 | + } |
|
1331 | 1385 | |
1332 | 1386 | $args = new stdClass; |
1333 | 1387 | $args->user_id = $user_id; |
@@ -1341,7 +1395,9 @@ discard block |
||
1341 | 1395 | */ |
1342 | 1396 | function deleteDeniedNickName($nick_name) |
1343 | 1397 | { |
1344 | - if(!$nick_name) unset($nick_name); |
|
1398 | + if(!$nick_name) { |
|
1399 | + unset($nick_name); |
|
1400 | + } |
|
1345 | 1401 | |
1346 | 1402 | $args = new stdClass; |
1347 | 1403 | $args->nick_name = $nick_name; |
@@ -1380,16 +1436,22 @@ discard block |
||
1380 | 1436 | // Get a list of all join forms |
1381 | 1437 | $join_form_list = $oMemberModel->getJoinFormList(); |
1382 | 1438 | $join_form_srl_list = array_keys($join_form_list); |
1383 | - if(count($join_form_srl_list)<2) return new Object(); |
|
1439 | + if(count($join_form_srl_list)<2) { |
|
1440 | + return new Object(); |
|
1441 | + } |
|
1384 | 1442 | |
1385 | 1443 | $prev_member_join_form = NULL; |
1386 | 1444 | foreach($join_form_list as $key => $val) |
1387 | 1445 | { |
1388 | - if($val->member_join_form_srl == $member_join_form_srl) break; |
|
1446 | + if($val->member_join_form_srl == $member_join_form_srl) { |
|
1447 | + break; |
|
1448 | + } |
|
1389 | 1449 | $prev_member_join_form = $val; |
1390 | 1450 | } |
1391 | 1451 | // Return if no previous join form exists |
1392 | - if(!$prev_member_join_form) return new Object(); |
|
1452 | + if(!$prev_member_join_form) { |
|
1453 | + return new Object(); |
|
1454 | + } |
|
1393 | 1455 | // Information of the join form |
1394 | 1456 | $cur_args = new stdClass; |
1395 | 1457 | $cur_args->member_join_form_srl = $member_join_form_srl; |
@@ -1400,10 +1462,14 @@ discard block |
||
1400 | 1462 | $prev_args->list_order = $list_order; |
1401 | 1463 | // Execute Query |
1402 | 1464 | $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); |
1403 | - if(!$output->toBool()) return $output; |
|
1465 | + if(!$output->toBool()) { |
|
1466 | + return $output; |
|
1467 | + } |
|
1404 | 1468 | |
1405 | 1469 | executeQuery('member.updateMemberJoinFormListorder', $prev_args); |
1406 | - if(!$output->toBool()) return $output; |
|
1470 | + if(!$output->toBool()) { |
|
1471 | + return $output; |
|
1472 | + } |
|
1407 | 1473 | |
1408 | 1474 | return new Object(); |
1409 | 1475 | } |
@@ -1427,16 +1493,22 @@ discard block |
||
1427 | 1493 | // Get information of all join forms |
1428 | 1494 | $join_form_list = $oMemberModel->getJoinFormList(); |
1429 | 1495 | $join_form_srl_list = array_keys($join_form_list); |
1430 | - if(count($join_form_srl_list)<2) return new Object(); |
|
1496 | + if(count($join_form_srl_list)<2) { |
|
1497 | + return new Object(); |
|
1498 | + } |
|
1431 | 1499 | |
1432 | 1500 | for($i=0;$i<count($join_form_srl_list);$i++) |
1433 | 1501 | { |
1434 | - if($join_form_srl_list[$i]==$member_join_form_srl) break; |
|
1502 | + if($join_form_srl_list[$i]==$member_join_form_srl) { |
|
1503 | + break; |
|
1504 | + } |
|
1435 | 1505 | } |
1436 | 1506 | |
1437 | 1507 | $next_member_join_form_srl = $join_form_srl_list[$i+1]; |
1438 | 1508 | // Return if no previous join form exists |
1439 | - if(!$next_member_join_form_srl) return new Object(); |
|
1509 | + if(!$next_member_join_form_srl) { |
|
1510 | + return new Object(); |
|
1511 | + } |
|
1440 | 1512 | $next_member_join_form = $join_form_list[$next_member_join_form_srl]; |
1441 | 1513 | // Information of the join form |
1442 | 1514 | $cur_args = new stdClass; |
@@ -1448,10 +1520,14 @@ discard block |
||
1448 | 1520 | $next_args->list_order = $list_order; |
1449 | 1521 | // Execute Query |
1450 | 1522 | $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); |
1451 | - if(!$output->toBool()) return $output; |
|
1523 | + if(!$output->toBool()) { |
|
1524 | + return $output; |
|
1525 | + } |
|
1452 | 1526 | |
1453 | 1527 | $output = executeQuery('member.updateMemberJoinFormListorder', $next_args); |
1454 | - if(!$output->toBool()) return $output; |
|
1528 | + if(!$output->toBool()) { |
|
1529 | + return $output; |
|
1530 | + } |
|
1455 | 1531 | |
1456 | 1532 | return new Object(); |
1457 | 1533 | } |