@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $output = executeQuery('module.insertActionForward', $args); |
30 | 30 | |
31 | 31 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
32 | - if($oCacheHandler->isSupport()) |
|
32 | + if ($oCacheHandler->isSupport()) |
|
33 | 33 | { |
34 | 34 | $cache_key = 'action_forward'; |
35 | 35 | $oCacheHandler->delete($cache_key); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $output = executeQuery('module.deleteActionForward', $args); |
52 | 52 | |
53 | 53 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
54 | - if($oCacheHandler->isSupport()) |
|
54 | + if ($oCacheHandler->isSupport()) |
|
55 | 55 | { |
56 | 56 | $cache_key = 'action_forward'; |
57 | 57 | $oCacheHandler->delete($cache_key); |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | $args->called_position = $called_position; |
76 | 76 | |
77 | 77 | $output = executeQuery('module.insertTrigger', $args); |
78 | - if($output->toBool()) |
|
78 | + if ($output->toBool()) |
|
79 | 79 | { |
80 | 80 | //remove from cache |
81 | 81 | $GLOBALS['__triggers__'] = NULL; |
82 | 82 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
83 | - if($oCacheHandler->isSupport()) |
|
83 | + if ($oCacheHandler->isSupport()) |
|
84 | 84 | { |
85 | 85 | $cache_key = 'triggers'; |
86 | 86 | $oCacheHandler->delete($cache_key); |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | $args->called_position = $called_position; |
105 | 105 | |
106 | 106 | $output = executeQuery('module.deleteTrigger', $args); |
107 | - if($output->toBool()) |
|
107 | + if ($output->toBool()) |
|
108 | 108 | { |
109 | 109 | //remove from cache |
110 | 110 | $GLOBALS['__triggers__'] = NULL; |
111 | 111 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
112 | - if($oCacheHandler->isSupport()) |
|
112 | + if ($oCacheHandler->isSupport()) |
|
113 | 113 | { |
114 | 114 | $cache_key = 'triggers'; |
115 | 115 | $oCacheHandler->delete($cache_key); |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $args->module = $module; |
130 | 130 | |
131 | 131 | $output = executeQuery('module.deleteModuleTriggers', $args); |
132 | - if($output->toBool()) |
|
132 | + if ($output->toBool()) |
|
133 | 133 | { |
134 | 134 | //remove from cache |
135 | 135 | $GLOBALS['__triggers__'] = NULL; |
136 | 136 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
137 | - if($oCacheHandler->isSupport()) |
|
137 | + if ($oCacheHandler->isSupport()) |
|
138 | 138 | { |
139 | 139 | $cache_key = 'triggers'; |
140 | 140 | $oCacheHandler->delete($cache_key); |
@@ -148,11 +148,11 @@ discard block |
||
148 | 148 | * @brief Add module extend |
149 | 149 | * |
150 | 150 | */ |
151 | - function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
151 | + function insertModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
152 | 152 | { |
153 | - if($kind != 'admin') $kind = ''; |
|
154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
153 | + if ($kind != 'admin') $kind = ''; |
|
154 | + if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false; |
|
155 | + if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false; |
|
156 | 156 | |
157 | 157 | $cache_file = './files/config/module_extend.php'; |
158 | 158 | FileHandler::removeFile($cache_file); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $args->kind = $kind; |
165 | 165 | |
166 | 166 | $output = executeQuery('module.getModuleExtendCount', $args); |
167 | - if($output->data->count>0) return false; |
|
167 | + if ($output->data->count > 0) return false; |
|
168 | 168 | |
169 | 169 | $output = executeQuery('module.insertModuleExtend', $args); |
170 | 170 | return $output; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @brief Delete module extend |
175 | 175 | * |
176 | 176 | */ |
177 | - function deleteModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
177 | + function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
178 | 178 | { |
179 | 179 | $cache_file = './files/config/module_extend.php'; |
180 | 180 | FileHandler::removeFile($cache_file); |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | $oModuleModel = getModel('module'); |
200 | 200 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
201 | 201 | |
202 | - if(!$origin_config) $origin_config = new stdClass; |
|
202 | + if (!$origin_config) $origin_config = new stdClass; |
|
203 | 203 | |
204 | - foreach($config as $key => $val) |
|
204 | + foreach ($config as $key => $val) |
|
205 | 205 | { |
206 | 206 | $origin_config->{$key} = $val; |
207 | 207 | } |
@@ -215,19 +215,19 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function insertModuleConfig($module, $config, $site_srl = 0) |
217 | 217 | { |
218 | - $args =new stdClass(); |
|
218 | + $args = new stdClass(); |
|
219 | 219 | $args->module = $module; |
220 | 220 | $args->config = serialize($config); |
221 | 221 | $args->site_srl = $site_srl; |
222 | 222 | |
223 | 223 | $output = executeQuery('module.deleteModuleConfig', $args); |
224 | - if(!$output->toBool()) return $output; |
|
224 | + if (!$output->toBool()) return $output; |
|
225 | 225 | |
226 | 226 | $output = executeQuery('module.insertModuleConfig', $args); |
227 | 227 | |
228 | 228 | //remove from cache |
229 | 229 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
230 | - if($oCacheHandler->isSupport()) |
|
230 | + if ($oCacheHandler->isSupport()) |
|
231 | 231 | { |
232 | 232 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
233 | 233 | } |
@@ -246,13 +246,13 @@ discard block |
||
246 | 246 | $args->config = serialize($config); |
247 | 247 | |
248 | 248 | $output = executeQuery('module.deleteModulePartConfig', $args); |
249 | - if(!$output->toBool()) return $output; |
|
249 | + if (!$output->toBool()) return $output; |
|
250 | 250 | |
251 | 251 | $output = executeQuery('module.insertModulePartConfig', $args); |
252 | 252 | |
253 | 253 | //remove from cache |
254 | 254 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
255 | - if($oCacheHandler->isSupport()) |
|
255 | + if ($oCacheHandler->isSupport()) |
|
256 | 256 | { |
257 | 257 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
258 | 258 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function insertSite($domain, $index_module_srl) |
267 | 267 | { |
268 | - if(isSiteID($domain)) |
|
268 | + if (isSiteID($domain)) |
|
269 | 269 | { |
270 | 270 | $oModuleModel = getModel('module'); |
271 | - if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid'); |
|
271 | + if ($oModuleModel->isIDExists($domain, 0)) return new Object(-1, 'msg_already_registed_vid'); |
|
272 | 272 | } |
273 | 273 | else |
274 | 274 | { |
@@ -284,10 +284,10 @@ discard block |
||
284 | 284 | $columnList = array('modules.site_srl'); |
285 | 285 | $oModuleModel = getModel('module'); |
286 | 286 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
287 | - if($output) return new Object(-1,'msg_already_registed_vid'); |
|
287 | + if ($output) return new Object(-1, 'msg_already_registed_vid'); |
|
288 | 288 | |
289 | 289 | $output = executeQuery('module.insertSite', $args); |
290 | - if(!$output->toBool()) return $output; |
|
290 | + if (!$output->toBool()) return $output; |
|
291 | 291 | |
292 | 292 | $output->add('site_srl', $args->site_srl); |
293 | 293 | return $output; |
@@ -302,32 +302,32 @@ discard block |
||
302 | 302 | $columnList = array('sites.site_srl', 'sites.domain'); |
303 | 303 | $site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList); |
304 | 304 | |
305 | - if(!$args->domain && $site_info->site_srl == $args->site_srl) |
|
305 | + if (!$args->domain && $site_info->site_srl == $args->site_srl) |
|
306 | 306 | { |
307 | 307 | $args->domain = $site_info->domain; |
308 | 308 | } |
309 | 309 | |
310 | - if($site_info->domain != $args->domain) |
|
310 | + if ($site_info->domain != $args->domain) |
|
311 | 311 | { |
312 | 312 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain'); |
|
314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid'); |
|
313 | + if ($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1, 'msg_already_registed_domain'); |
|
314 | + if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1, 'msg_already_registed_vid'); |
|
315 | 315 | |
316 | - if($args->domain && !isSiteID($args->domain)) |
|
316 | + if ($args->domain && !isSiteID($args->domain)) |
|
317 | 317 | { |
318 | 318 | $args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain; |
319 | 319 | } |
320 | 320 | } |
321 | 321 | $output = executeQuery('module.updateSite', $args); |
322 | 322 | //clear cache for default mid |
323 | - if($args->site_srl == 0) $vid=''; |
|
324 | - else $vid=$args->domain; |
|
323 | + if ($args->site_srl == 0) $vid = ''; |
|
324 | + else $vid = $args->domain; |
|
325 | 325 | |
326 | 326 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
327 | 327 | $mid = $module_info->mid; |
328 | 328 | |
329 | 329 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
330 | - if($oCacheHandler->isSupport()) |
|
330 | + if ($oCacheHandler->isSupport()) |
|
331 | 331 | { |
332 | 332 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
333 | 333 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | unset($args->act); |
346 | 346 | unset($args->page); |
347 | 347 | // Test mid value |
348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
348 | + if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
349 | 349 | // Test variables (separate basic vars and other vars in modules) |
350 | 350 | $extra_vars = clone($args); |
351 | 351 | unset($extra_vars->module_srl); |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function insertModule($args) |
381 | 381 | { |
382 | - if(isset($args->isMenuCreate)) |
|
382 | + if (isset($args->isMenuCreate)) |
|
383 | 383 | { |
384 | 384 | $isMenuCreate = $args->isMenuCreate; |
385 | 385 | } |
@@ -389,11 +389,11 @@ discard block |
||
389 | 389 | } |
390 | 390 | |
391 | 391 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
392 | - if(!$output->toBool()) return $output; |
|
392 | + if (!$output->toBool()) return $output; |
|
393 | 393 | // Check whether the module name already exists |
394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
394 | + if (!$args->site_srl) $args->site_srl = 0; |
|
395 | 395 | $oModuleModel = getModel('module'); |
396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
396 | + if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
397 | 397 | |
398 | 398 | // begin transaction |
399 | 399 | $oDB = &DB::getInstance(); |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | $skin_vars = new stdClass(); |
405 | 405 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
406 | 406 | // Arrange variables and then execute a query |
407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
407 | + if (!$args->module_srl) $args->module_srl = getNextSequence(); |
|
408 | 408 | |
409 | 409 | // default value |
410 | - if($args->skin == '/USE_DEFAULT/') |
|
410 | + if ($args->skin == '/USE_DEFAULT/') |
|
411 | 411 | { |
412 | 412 | $args->is_skin_fix = 'N'; |
413 | 413 | } |
414 | 414 | else |
415 | 415 | { |
416 | - if(isset($args->is_skin_fix)) |
|
416 | + if (isset($args->is_skin_fix)) |
|
417 | 417 | { |
418 | 418 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
419 | 419 | } |
@@ -423,13 +423,13 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | - if($args->mskin == '/USE_DEFAULT/') |
|
426 | + if ($args->mskin == '/USE_DEFAULT/') |
|
427 | 427 | { |
428 | 428 | $args->is_mskin_fix = 'N'; |
429 | 429 | } |
430 | 430 | else |
431 | 431 | { |
432 | - if(isset($args->is_mskin_fix)) |
|
432 | + if (isset($args->is_mskin_fix)) |
|
433 | 433 | { |
434 | 434 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
435 | 435 | } |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | |
444 | 444 | $args->browser_title = strip_tags($args->browser_title); |
445 | 445 | |
446 | - if($isMenuCreate === TRUE) |
|
446 | + if ($isMenuCreate === TRUE) |
|
447 | 447 | { |
448 | 448 | $menuArgs = new stdClass; |
449 | 449 | $menuArgs->menu_srl = $args->menu_srl; |
450 | 450 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
451 | 451 | |
452 | 452 | // if menu is not created, create menu also. and does not supported that in virtual site. |
453 | - if(!$menuOutput->data && !$args->site_srl) |
|
453 | + if (!$menuOutput->data && !$args->site_srl) |
|
454 | 454 | { |
455 | 455 | $oMenuAdminModel = getAdminModel('menu'); |
456 | 456 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $menuArgs->listorder = $args->menu_item_srl * -1; |
469 | 469 | |
470 | 470 | $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); |
471 | - if(!$menuItemOutput->toBool()) |
|
471 | + if (!$menuItemOutput->toBool()) |
|
472 | 472 | { |
473 | 473 | $oDB->rollback(); |
474 | 474 | return $menuItemOutput; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | // Insert a module |
482 | 482 | $args->menu_srl = $menuArgs->menu_srl; |
483 | 483 | $output = executeQuery('module.insertModule', $args); |
484 | - if(!$output->toBool()) |
|
484 | + if (!$output->toBool()) |
|
485 | 485 | { |
486 | 486 | $oDB->rollback(); |
487 | 487 | return $output; |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | $oDB->commit(); |
494 | 494 | |
495 | 495 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
496 | - if($oCacheHandler->isSupport()) |
|
496 | + if ($oCacheHandler->isSupport()) |
|
497 | 497 | { |
498 | 498 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
499 | 499 | } |
500 | 500 | |
501 | - $output->add('module_srl',$args->module_srl); |
|
501 | + $output->add('module_srl', $args->module_srl); |
|
502 | 502 | return $output; |
503 | 503 | } |
504 | 504 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | function updateModule($args) |
509 | 509 | { |
510 | - if(isset($args->isMenuCreate)) |
|
510 | + if (isset($args->isMenuCreate)) |
|
511 | 511 | { |
512 | 512 | $isMenuCreate = $args->isMenuCreate; |
513 | 513 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
520 | - if(!$output->toBool()) return $output; |
|
520 | + if (!$output->toBool()) return $output; |
|
521 | 521 | // begin transaction |
522 | 522 | $oDB = &DB::getInstance(); |
523 | 523 | $oDB->begin(); |
@@ -526,29 +526,29 @@ discard block |
||
526 | 526 | $columnList = array('module_srl', 'site_srl', 'browser_title', 'mid'); |
527 | 527 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
528 | 528 | |
529 | - if(!$args->site_srl || !$args->browser_title) |
|
529 | + if (!$args->site_srl || !$args->browser_title) |
|
530 | 530 | { |
531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
531 | + if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl; |
|
532 | + if (!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $args->browser_title = strip_tags($args->browser_title); |
536 | 536 | |
537 | 537 | $output = executeQuery('module.isExistsModuleName', $args); |
538 | - if(!$output->toBool() || $output->data->count) |
|
538 | + if (!$output->toBool() || $output->data->count) |
|
539 | 539 | { |
540 | 540 | $oDB->rollback(); |
541 | 541 | return new Object(-1, 'msg_module_name_exists'); |
542 | 542 | } |
543 | 543 | |
544 | 544 | // default value |
545 | - if($args->skin == '/USE_DEFAULT/') |
|
545 | + if ($args->skin == '/USE_DEFAULT/') |
|
546 | 546 | { |
547 | 547 | $args->is_skin_fix = 'N'; |
548 | 548 | } |
549 | 549 | else |
550 | 550 | { |
551 | - if(isset($args->is_skin_fix)) |
|
551 | + if (isset($args->is_skin_fix)) |
|
552 | 552 | { |
553 | 553 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
554 | 554 | } |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | - if($args->mskin == '/USE_DEFAULT/') |
|
561 | + if ($args->mskin == '/USE_DEFAULT/') |
|
562 | 562 | { |
563 | 563 | $args->is_mskin_fix = 'N'; |
564 | 564 | } |
565 | 565 | else |
566 | 566 | { |
567 | - if(isset($args->is_mskin_fix)) |
|
567 | + if (isset($args->is_mskin_fix)) |
|
568 | 568 | { |
569 | 569 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
570 | 570 | } |
@@ -574,27 +574,27 @@ discard block |
||
574 | 574 | } |
575 | 575 | } |
576 | 576 | $output = executeQuery('module.updateModule', $args); |
577 | - if(!$output->toBool()) |
|
577 | + if (!$output->toBool()) |
|
578 | 578 | { |
579 | 579 | $oDB->rollback(); |
580 | 580 | return $output; |
581 | 581 | } |
582 | 582 | |
583 | - if($isMenuCreate === TRUE) |
|
583 | + if ($isMenuCreate === TRUE) |
|
584 | 584 | { |
585 | 585 | $menuArgs = new stdClass; |
586 | 586 | $menuArgs->url = $module_info->mid; |
587 | 587 | $menuArgs->site_srl = $module_info->site_srl; |
588 | 588 | $menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs); |
589 | - if($menuOutput->data && count($menuOutput->data)) |
|
589 | + if ($menuOutput->data && count($menuOutput->data)) |
|
590 | 590 | { |
591 | 591 | $oMenuAdminController = getAdminController('menu'); |
592 | - foreach($menuOutput->data as $itemInfo) |
|
592 | + foreach ($menuOutput->data as $itemInfo) |
|
593 | 593 | { |
594 | 594 | $itemInfo->url = $args->mid; |
595 | 595 | |
596 | 596 | $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); |
597 | - if(!$updateMenuItemOutput->toBool()) |
|
597 | + if (!$updateMenuItemOutput->toBool()) |
|
598 | 598 | { |
599 | 599 | $oDB->rollback(); |
600 | 600 | return $updateMenuItemOutput; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | |
606 | 606 | // if mid changed, change mid of success_return_url to new mid |
607 | - if($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
607 | + if ($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
608 | 608 | { |
609 | 609 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
610 | 610 | } |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | |
615 | 615 | $oDB->commit(); |
616 | 616 | |
617 | - $output->add('module_srl',$args->module_srl); |
|
617 | + $output->add('module_srl', $args->module_srl); |
|
618 | 618 | |
619 | 619 | //remove from cache |
620 | 620 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
621 | - if($oCacheHandler->isSupport()) |
|
621 | + if ($oCacheHandler->isSupport()) |
|
622 | 622 | { |
623 | 623 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
624 | 624 | } |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $args->update_id = $update_id; |
638 | 638 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
639 | 639 | |
640 | - if(!!$output->error) return false; |
|
640 | + if (!!$output->error) return false; |
|
641 | 641 | |
642 | 642 | return true; |
643 | 643 | } |
@@ -652,11 +652,11 @@ discard block |
||
652 | 652 | $args->site_srl = $site_srl; |
653 | 653 | $args->layout_srl = $layout_srl; |
654 | 654 | $output = executeQuery('module.updateModuleSite', $args); |
655 | - if(!$output->toBool()) return $output; |
|
655 | + if (!$output->toBool()) return $output; |
|
656 | 656 | |
657 | 657 | //remove from cache |
658 | 658 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
659 | - if($oCacheHandler->isSupport()) |
|
659 | + if ($oCacheHandler->isSupport()) |
|
660 | 660 | { |
661 | 661 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
662 | 662 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | */ |
672 | 672 | function deleteModule($module_srl, $site_srl = 0) |
673 | 673 | { |
674 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
674 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
675 | 675 | |
676 | 676 | $site_module_info = Context::get('site_module_info'); |
677 | 677 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $args = new stdClass(); |
682 | 682 | $args->url = $output->mid; |
683 | 683 | $args->is_shortcut = 'N'; |
684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
684 | + if (!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
685 | 685 | else $args->site_srl = $site_srl; |
686 | 686 | |
687 | 687 | unset($output); |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | $menuOutput = $oMenuAdminModel->getMenuList($args); |
691 | 691 | |
692 | 692 | // get menu_srl by site_srl |
693 | - if(is_array($menuOutput->data)) |
|
693 | + if (is_array($menuOutput->data)) |
|
694 | 694 | { |
695 | - foreach($menuOutput->data AS $key=>$value) |
|
695 | + foreach ($menuOutput->data AS $key=>$value) |
|
696 | 696 | { |
697 | 697 | $args->menu_srl = $value->menu_srl; |
698 | 698 | break; |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
703 | 703 | // menu delete |
704 | - if($output->data) |
|
704 | + if ($output->data) |
|
705 | 705 | { |
706 | 706 | unset($args); |
707 | 707 | $args = new stdClass; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $oMenuAdminController = getAdminController('menu'); |
713 | 713 | $output = $oMenuAdminController->deleteItem($args); |
714 | 714 | |
715 | - if($output->isSuccess) |
|
715 | + if ($output->isSuccess) |
|
716 | 716 | { |
717 | 717 | return new Object(0, 'success_deleted'); |
718 | 718 | } |
@@ -734,19 +734,19 @@ discard block |
||
734 | 734 | */ |
735 | 735 | public function onlyDeleteModule($module_srl) |
736 | 736 | { |
737 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
737 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
738 | 738 | |
739 | 739 | // check start module |
740 | 740 | $oModuleModel = getModel('module'); |
741 | 741 | $columnList = array('sites.index_module_srl'); |
742 | 742 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
743 | - if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
743 | + if ($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
744 | 744 | |
745 | 745 | // Call a trigger (before) |
746 | 746 | $trigger_obj = new stdClass(); |
747 | 747 | $trigger_obj->module_srl = $module_srl; |
748 | 748 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
749 | - if(!$output->toBool()) return $output; |
|
749 | + if (!$output->toBool()) return $output; |
|
750 | 750 | |
751 | 751 | // begin transaction |
752 | 752 | $oDB = &DB::getInstance(); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $args->module_srl = $module_srl; |
757 | 757 | // Delete module information from the DB |
758 | 758 | $output = executeQuery('module.deleteModule', $args); |
759 | - if(!$output->toBool()) |
|
759 | + if (!$output->toBool()) |
|
760 | 760 | { |
761 | 761 | $oDB->rollback(); |
762 | 762 | return $output; |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | // Remove the module manager |
771 | 771 | $this->deleteAdminId($module_srl); |
772 | 772 | // Call a trigger (after) |
773 | - if($output->toBool()) |
|
773 | + if ($output->toBool()) |
|
774 | 774 | { |
775 | 775 | $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); |
776 | - if(!$trigger_output->toBool()) |
|
776 | + if (!$trigger_output->toBool()) |
|
777 | 777 | { |
778 | 778 | $oDB->rollback(); |
779 | 779 | return $trigger_output; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | |
786 | 786 | //remove from cache |
787 | 787 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
788 | - if($oCacheHandler->isSupport()) |
|
788 | + if ($oCacheHandler->isSupport()) |
|
789 | 789 | { |
790 | 790 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
791 | 791 | } |
@@ -807,10 +807,10 @@ discard block |
||
807 | 807 | function clearDefaultModule() |
808 | 808 | { |
809 | 809 | $output = executeQuery('module.clearDefaultModule'); |
810 | - if(!$output->toBool()) return $output; |
|
810 | + if (!$output->toBool()) return $output; |
|
811 | 811 | |
812 | 812 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
813 | - if($oCacheHandler->isSupport()) |
|
813 | + if ($oCacheHandler->isSupport()) |
|
814 | 814 | { |
815 | 815 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
816 | 816 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | $output = executeQuery('module.updateModuleMenu', $args); |
827 | 827 | |
828 | 828 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
829 | - if($oCacheHandler->isSupport()) |
|
829 | + if ($oCacheHandler->isSupport()) |
|
830 | 830 | { |
831 | 831 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
832 | 832 | } |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | */ |
840 | 840 | function updateModuleLayout($layout_srl, $menu_srl_list) |
841 | 841 | { |
842 | - if(!count($menu_srl_list)) return; |
|
842 | + if (!count($menu_srl_list)) return; |
|
843 | 843 | |
844 | 844 | $args = new stdClass; |
845 | 845 | $args->layout_srl = $layout_srl; |
846 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
846 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
847 | 847 | $output = executeQuery('module.updateModuleLayout', $args); |
848 | 848 | |
849 | 849 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
850 | - if($oCacheHandler->isSupport()) |
|
850 | + if ($oCacheHandler->isSupport()) |
|
851 | 851 | { |
852 | 852 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
853 | 853 | } |
@@ -866,37 +866,37 @@ discard block |
||
866 | 866 | |
867 | 867 | $output = executeQuery('module.deleteSiteAdmin', $args); |
868 | 868 | |
869 | - if(!$output->toBool()) return $output; |
|
869 | + if (!$output->toBool()) return $output; |
|
870 | 870 | // Get user id of an administrator |
871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
872 | - foreach($arr_admins as $key => $user_id) |
|
871 | + if (!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
872 | + foreach ($arr_admins as $key => $user_id) |
|
873 | 873 | { |
874 | - if(!trim($user_id)) continue; |
|
874 | + if (!trim($user_id)) continue; |
|
875 | 875 | $admins[] = trim($user_id); |
876 | 876 | } |
877 | - if(!count($admins)) return new Object(); |
|
877 | + if (!count($admins)) return new Object(); |
|
878 | 878 | |
879 | 879 | $oMemberModel = getModel('member'); |
880 | 880 | $member_config = $oMemberModel->getMemberConfig(); |
881 | - if($member_config->identifier == 'email_address') |
|
881 | + if ($member_config->identifier == 'email_address') |
|
882 | 882 | { |
883 | - $args->email_address = '\''.implode('\',\'',$admins).'\''; |
|
883 | + $args->email_address = '\''.implode('\',\'', $admins).'\''; |
|
884 | 884 | } |
885 | 885 | else |
886 | 886 | { |
887 | - $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
|
887 | + $args->user_ids = '\''.implode('\',\'', $admins).'\''; |
|
888 | 888 | } |
889 | 889 | $output = executeQueryArray('module.getAdminSrls', $args); |
890 | - if(!$output->toBool()||!$output->data) return $output; |
|
890 | + if (!$output->toBool() || !$output->data) return $output; |
|
891 | 891 | |
892 | - foreach($output->data as $key => $val) |
|
892 | + foreach ($output->data as $key => $val) |
|
893 | 893 | { |
894 | 894 | unset($args); |
895 | 895 | $args = new stdClass; |
896 | 896 | $args->site_srl = $site_srl; |
897 | 897 | $args->member_srl = $val->member_srl; |
898 | 898 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
899 | - if(!$output->toBool()) return $output; |
|
899 | + if (!$output->toBool()) return $output; |
|
900 | 900 | } |
901 | 901 | return new Object(); |
902 | 902 | } |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | $oMemberModel = getModel('member'); |
910 | 910 | $member_config = $oMemberModel->getMemberConfig(); |
911 | 911 | |
912 | - if($member_config->identifier == 'email_address') |
|
912 | + if ($member_config->identifier == 'email_address') |
|
913 | 913 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
914 | 914 | else |
915 | 915 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
916 | 916 | |
917 | - if(!$member_info->member_srl) return; |
|
917 | + if (!$member_info->member_srl) return; |
|
918 | 918 | $args = new stdClass(); |
919 | 919 | $args->module_srl = $module_srl; |
920 | 920 | $args->member_srl = $member_info->member_srl; |
@@ -929,11 +929,11 @@ discard block |
||
929 | 929 | $args = new stdClass(); |
930 | 930 | $args->module_srl = $module_srl; |
931 | 931 | |
932 | - if($admin_id) |
|
932 | + if ($admin_id) |
|
933 | 933 | { |
934 | 934 | $oMemberModel = getModel('member'); |
935 | 935 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
936 | + if ($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
937 | 937 | } |
938 | 938 | return executeQuery('module.deleteAdminId', $args); |
939 | 939 | } |
@@ -970,18 +970,18 @@ discard block |
||
970 | 970 | $oDB->begin(); |
971 | 971 | |
972 | 972 | $output = $this->_deleteModuleSkinVars($module_srl, $mode); |
973 | - if(!$output->toBool()) |
|
973 | + if (!$output->toBool()) |
|
974 | 974 | { |
975 | 975 | $oDB->rollback(); |
976 | 976 | return $output; |
977 | 977 | } |
978 | 978 | |
979 | 979 | getDestroyXeVars($obj); |
980 | - if(!$obj || !count($obj)) return new Object(); |
|
980 | + if (!$obj || !count($obj)) return new Object(); |
|
981 | 981 | |
982 | 982 | $args = new stdClass; |
983 | 983 | $args->module_srl = $module_srl; |
984 | - foreach($obj as $key => $val) |
|
984 | + foreach ($obj as $key => $val) |
|
985 | 985 | { |
986 | 986 | // #17927989 For an old board which used the old blog module |
987 | 987 | // it often saved menu item(stdClass) on the skin info column |
@@ -992,9 +992,9 @@ discard block |
||
992 | 992 | |
993 | 993 | $args->name = trim($key); |
994 | 994 | $args->value = trim($val); |
995 | - if(!$args->name || !$args->value) continue; |
|
995 | + if (!$args->name || !$args->value) continue; |
|
996 | 996 | |
997 | - if($mode === 'P') |
|
997 | + if ($mode === 'P') |
|
998 | 998 | { |
999 | 999 | $output = executeQuery('module.insertModuleSkinVars', $args); |
1000 | 1000 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | { |
1003 | 1003 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
1004 | 1004 | } |
1005 | - if(!$output->toBool()) |
|
1005 | + if (!$output->toBool()) |
|
1006 | 1006 | { |
1007 | 1007 | return $output; |
1008 | 1008 | $oDB->rollback(); |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | $args->module_srl = $module_srl; |
1042 | 1042 | $mode = $mode === 'P' ? 'P' : 'M'; |
1043 | 1043 | |
1044 | - if($mode === 'P') |
|
1044 | + if ($mode === 'P') |
|
1045 | 1045 | { |
1046 | 1046 | $object_key = 'module_skin_vars:'.$module_srl; |
1047 | 1047 | $query = 'module.deleteModuleSkinVars'; |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | //remove from cache |
1056 | 1056 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1057 | 1057 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1058 | - if($oCacheHandler->isSupport()) |
|
1058 | + if ($oCacheHandler->isSupport()) |
|
1059 | 1059 | { |
1060 | 1060 | $oCacheHandler->delete($cache_key); |
1061 | 1061 | } |
@@ -1070,22 +1070,22 @@ discard block |
||
1070 | 1070 | { |
1071 | 1071 | $this->deleteModuleExtraVars($module_srl); |
1072 | 1072 | getDestroyXeVars($obj); |
1073 | - if(!$obj || !count($obj)) return; |
|
1073 | + if (!$obj || !count($obj)) return; |
|
1074 | 1074 | |
1075 | - foreach($obj as $key => $val) |
|
1075 | + foreach ($obj as $key => $val) |
|
1076 | 1076 | { |
1077 | - if(is_object($val) || is_array($val)) continue; |
|
1077 | + if (is_object($val) || is_array($val)) continue; |
|
1078 | 1078 | |
1079 | 1079 | $args = new stdClass(); |
1080 | 1080 | $args->module_srl = $module_srl; |
1081 | 1081 | $args->name = trim($key); |
1082 | 1082 | $args->value = trim($val); |
1083 | - if(!$args->name || !$args->value) continue; |
|
1083 | + if (!$args->name || !$args->value) continue; |
|
1084 | 1084 | $output = executeQuery('module.insertModuleExtraVars', $args); |
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1088 | - if($oCacheHandler->isSupport()) |
|
1088 | + if ($oCacheHandler->isSupport()) |
|
1089 | 1089 | { |
1090 | 1090 | $object_key = 'module_extra_vars:'.$module_srl; |
1091 | 1091 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | |
1105 | 1105 | //remove from cache |
1106 | 1106 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1107 | - if($oCacheHandler->isSupport()) |
|
1107 | + if ($oCacheHandler->isSupport()) |
|
1108 | 1108 | { |
1109 | 1109 | $object_key = 'module_extra_vars:'.$module_srl; |
1110 | 1110 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1120,19 +1120,19 @@ discard block |
||
1120 | 1120 | function insertModuleGrants($module_srl, $obj) |
1121 | 1121 | { |
1122 | 1122 | $this->deleteModuleGrants($module_srl); |
1123 | - if(!$obj || !count($obj)) return; |
|
1123 | + if (!$obj || !count($obj)) return; |
|
1124 | 1124 | |
1125 | - foreach($obj as $name => $val) |
|
1125 | + foreach ($obj as $name => $val) |
|
1126 | 1126 | { |
1127 | - if(!$val || !count($val)) continue; |
|
1127 | + if (!$val || !count($val)) continue; |
|
1128 | 1128 | |
1129 | - foreach($val as $group_srl) |
|
1129 | + foreach ($val as $group_srl) |
|
1130 | 1130 | { |
1131 | 1131 | $args = new stdClass(); |
1132 | 1132 | $args->module_srl = $module_srl; |
1133 | 1133 | $args->name = $name; |
1134 | 1134 | $args->group_srl = trim($group_srl); |
1135 | - if(!$args->name || !$args->group_srl) continue; |
|
1135 | + if (!$args->name || !$args->group_srl) continue; |
|
1136 | 1136 | executeQuery('module.insertModuleGrant', $args); |
1137 | 1137 | } |
1138 | 1138 | } |
@@ -1153,9 +1153,9 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) |
1155 | 1155 | { |
1156 | - if($isReplaceLangCode) |
|
1156 | + if ($isReplaceLangCode) |
|
1157 | 1157 | { |
1158 | - $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); |
|
1158 | + $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output); |
|
1159 | 1159 | } |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1163,27 +1163,27 @@ discard block |
||
1163 | 1163 | { |
1164 | 1164 | static $lang = null; |
1165 | 1165 | |
1166 | - if(is_null($lang)) |
|
1166 | + if (is_null($lang)) |
|
1167 | 1167 | { |
1168 | 1168 | $site_module_info = Context::get('site_module_info'); |
1169 | - if(!$site_module_info) |
|
1169 | + if (!$site_module_info) |
|
1170 | 1170 | { |
1171 | 1171 | $oModuleModel = getModel('module'); |
1172 | 1172 | $site_module_info = $oModuleModel->getDefaultMid(); |
1173 | 1173 | Context::set('site_module_info', $site_module_info); |
1174 | 1174 | } |
1175 | 1175 | $cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType()); |
1176 | - if(!file_exists($cache_file)) |
|
1176 | + if (!file_exists($cache_file)) |
|
1177 | 1177 | { |
1178 | 1178 | $oModuleAdminController = getAdminController('module'); |
1179 | 1179 | $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
1180 | 1180 | } |
1181 | 1181 | |
1182 | - if(file_exists($cache_file)) |
|
1182 | + if (file_exists($cache_file)) |
|
1183 | 1183 | { |
1184 | - $moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php'); |
|
1184 | + $moduleAdminControllerMtime = filemtime(_XE_PATH_.'modules/module/module.admin.controller.php'); |
|
1185 | 1185 | $cacheFileMtime = filemtime($cache_file); |
1186 | - if($cacheFileMtime < $moduleAdminControllerMtime) |
|
1186 | + if ($cacheFileMtime < $moduleAdminControllerMtime) |
|
1187 | 1187 | { |
1188 | 1188 | $oModuleAdminController = getAdminController('module'); |
1189 | 1189 | $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
@@ -1192,9 +1192,9 @@ discard block |
||
1192 | 1192 | require_once($cache_file); |
1193 | 1193 | } |
1194 | 1194 | } |
1195 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1195 | + if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1196 | 1196 | |
1197 | - return str_replace('$user_lang->','',$matches[0]); |
|
1197 | + return str_replace('$user_lang->', '', $matches[0]); |
|
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | |
@@ -1207,17 +1207,17 @@ discard block |
||
1207 | 1207 | if ($ajax) Context::setRequestMethod('JSON'); |
1208 | 1208 | |
1209 | 1209 | $logged_info = Context::get('logged_info'); |
1210 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
1210 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
1211 | 1211 | |
1212 | - $vars = Context::gets('addfile','filter'); |
|
1212 | + $vars = Context::gets('addfile', 'filter'); |
|
1213 | 1213 | $attributeNames = Context::get('attribute_name'); |
1214 | 1214 | $attributeValues = Context::get('attribute_value'); |
1215 | - if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
1215 | + if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
1216 | 1216 | { |
1217 | 1217 | $attributes = array(); |
1218 | - foreach($attributeNames as $no => $name) |
|
1218 | + foreach ($attributeNames as $no => $name) |
|
1219 | 1219 | { |
1220 | - if(empty($name)) |
|
1220 | + if (empty($name)) |
|
1221 | 1221 | { |
1222 | 1222 | continue; |
1223 | 1223 | } |
@@ -1229,16 +1229,16 @@ discard block |
||
1229 | 1229 | $vars->comment = $attributes; |
1230 | 1230 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1231 | 1231 | |
1232 | - $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1232 | + $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1233 | 1233 | $vars->ext = $ext; |
1234 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
1235 | - else $filter = array('jpg','jpeg','gif','png'); |
|
1236 | - if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured'); |
|
1234 | + if ($vars->filter) $filter = explode(',', $vars->filter); |
|
1235 | + else $filter = array('jpg', 'jpeg', 'gif', 'png'); |
|
1236 | + if (!in_array($ext, $filter)) return new Object(-1, 'msg_error_occured'); |
|
1237 | 1237 | |
1238 | 1238 | $vars->member_srl = $logged_info->member_srl; |
1239 | 1239 | |
1240 | 1240 | // update |
1241 | - if($module_filebox_srl > 0) |
|
1241 | + if ($module_filebox_srl > 0) |
|
1242 | 1242 | { |
1243 | 1243 | $vars->module_filebox_srl = $module_filebox_srl; |
1244 | 1244 | $output = $this->updateModuleFileBox($vars); |
@@ -1246,10 +1246,10 @@ discard block |
||
1246 | 1246 | // insert |
1247 | 1247 | else |
1248 | 1248 | { |
1249 | - if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
1249 | + if (!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
1250 | 1250 | $addfile = Context::get('addfile'); |
1251 | - if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
1252 | - if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
1251 | + if (!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
1252 | + if ($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
1253 | 1253 | $output = $this->insertModuleFileBox($vars); |
1254 | 1254 | } |
1255 | 1255 | |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | } |
1264 | 1264 | else |
1265 | 1265 | { |
1266 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
1266 | + if ($output) $this->add('save_filename', $output->get('save_filename')); |
|
1267 | 1267 | else $this->add('save_filename', ''); |
1268 | 1268 | } |
1269 | 1269 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | { |
1276 | 1276 | $args = new stdClass; |
1277 | 1277 | // have file |
1278 | - if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
1278 | + if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
1279 | 1279 | { |
1280 | 1280 | $oModuleModel = getModel('module'); |
1281 | 1281 | $output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl); |
@@ -1284,18 +1284,18 @@ discard block |
||
1284 | 1284 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
1285 | 1285 | FileHandler::makeDir($path); |
1286 | 1286 | |
1287 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext); |
|
1287 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext); |
|
1288 | 1288 | $tmp = $vars->addfile['tmp_name']; |
1289 | 1289 | |
1290 | 1290 | // Check uploaded file |
1291 | - if(!checkUploadedFile($tmp)) return false; |
|
1291 | + if (!checkUploadedFile($tmp)) return false; |
|
1292 | 1292 | |
1293 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
1293 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
1294 | 1294 | { |
1295 | 1295 | return false; |
1296 | 1296 | } |
1297 | 1297 | |
1298 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1298 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1299 | 1299 | $args->filename = $save_filename; |
1300 | 1300 | $args->filesize = $vars->addfile['size']; |
1301 | 1301 | } |
@@ -1321,14 +1321,14 @@ discard block |
||
1321 | 1321 | $oModuleModel = getModel('module'); |
1322 | 1322 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
1323 | 1323 | FileHandler::makeDir($path); |
1324 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext); |
|
1324 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext); |
|
1325 | 1325 | $tmp = $vars->addfile['tmp_name']; |
1326 | 1326 | |
1327 | 1327 | // Check uploaded file |
1328 | - if(!checkUploadedFile($tmp)) return false; |
|
1328 | + if (!checkUploadedFile($tmp)) return false; |
|
1329 | 1329 | |
1330 | 1330 | // upload |
1331 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
1331 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
1332 | 1332 | { |
1333 | 1333 | return false; |
1334 | 1334 | } |
@@ -1339,7 +1339,7 @@ discard block |
||
1339 | 1339 | $args->member_srl = $vars->member_srl; |
1340 | 1340 | $args->comment = $vars->comment; |
1341 | 1341 | $args->filename = $save_filename; |
1342 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1342 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1343 | 1343 | $args->filesize = $vars->addfile['size']; |
1344 | 1344 | |
1345 | 1345 | $output = executeQuery('module.insertModuleFileBox', $args); |
@@ -1354,14 +1354,14 @@ discard block |
||
1354 | 1354 | function procModuleFileBoxDelete() |
1355 | 1355 | { |
1356 | 1356 | $logged_info = Context::get('logged_info'); |
1357 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
1357 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
1358 | 1358 | |
1359 | 1359 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1360 | - if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
1360 | + if (!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
1361 | 1361 | $vars = new stdClass(); |
1362 | 1362 | $vars->module_filebox_srl = $module_filebox_srl; |
1363 | 1363 | $output = $this->deleteModuleFileBox($vars); |
1364 | - if(!$output->toBool()) return $output; |
|
1364 | + if (!$output->toBool()) return $output; |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | function deleteModuleFileBox($vars) |
@@ -1384,11 +1384,11 @@ discard block |
||
1384 | 1384 | $this->unlockTimeoutPassed(); |
1385 | 1385 | $args = new stdClass; |
1386 | 1386 | $args->lock_name = $lock_name; |
1387 | - if(!$timeout) $timeout = 60; |
|
1387 | + if (!$timeout) $timeout = 60; |
|
1388 | 1388 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
1389 | - if($member_srl) $args->member_srl = $member_srl; |
|
1389 | + if ($member_srl) $args->member_srl = $member_srl; |
|
1390 | 1390 | $output = executeQuery('module.insertLock', $args); |
1391 | - if($output->toBool()) |
|
1391 | + if ($output->toBool()) |
|
1392 | 1392 | { |
1393 | 1393 | $output->add('lock_name', $lock_name); |
1394 | 1394 | $output->add('deadline', $args->deadline); |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | $output = executeQuery('module.updateModuleInSites', $args); |
1418 | 1418 | |
1419 | 1419 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1420 | - if($oCacheHandler->isSupport()) |
|
1420 | + if ($oCacheHandler->isSupport()) |
|
1421 | 1421 | { |
1422 | 1422 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
1423 | 1423 | } |
@@ -150,9 +150,15 @@ discard block |
||
150 | 150 | */ |
151 | 151 | function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
152 | 152 | { |
153 | - if($kind != 'admin') $kind = ''; |
|
154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
153 | + if($kind != 'admin') { |
|
154 | + $kind = ''; |
|
155 | + } |
|
156 | + if(!in_array($type,array('model','controller','view','api','mobile'))) { |
|
157 | + return false; |
|
158 | + } |
|
159 | + if(in_array($parent_module, array('module','addon','widget','layout'))) { |
|
160 | + return false; |
|
161 | + } |
|
156 | 162 | |
157 | 163 | $cache_file = './files/config/module_extend.php'; |
158 | 164 | FileHandler::removeFile($cache_file); |
@@ -164,7 +170,9 @@ discard block |
||
164 | 170 | $args->kind = $kind; |
165 | 171 | |
166 | 172 | $output = executeQuery('module.getModuleExtendCount', $args); |
167 | - if($output->data->count>0) return false; |
|
173 | + if($output->data->count>0) { |
|
174 | + return false; |
|
175 | + } |
|
168 | 176 | |
169 | 177 | $output = executeQuery('module.insertModuleExtend', $args); |
170 | 178 | return $output; |
@@ -199,7 +207,9 @@ discard block |
||
199 | 207 | $oModuleModel = getModel('module'); |
200 | 208 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
201 | 209 | |
202 | - if(!$origin_config) $origin_config = new stdClass; |
|
210 | + if(!$origin_config) { |
|
211 | + $origin_config = new stdClass; |
|
212 | + } |
|
203 | 213 | |
204 | 214 | foreach($config as $key => $val) |
205 | 215 | { |
@@ -221,7 +231,9 @@ discard block |
||
221 | 231 | $args->site_srl = $site_srl; |
222 | 232 | |
223 | 233 | $output = executeQuery('module.deleteModuleConfig', $args); |
224 | - if(!$output->toBool()) return $output; |
|
234 | + if(!$output->toBool()) { |
|
235 | + return $output; |
|
236 | + } |
|
225 | 237 | |
226 | 238 | $output = executeQuery('module.insertModuleConfig', $args); |
227 | 239 | |
@@ -246,7 +258,9 @@ discard block |
||
246 | 258 | $args->config = serialize($config); |
247 | 259 | |
248 | 260 | $output = executeQuery('module.deleteModulePartConfig', $args); |
249 | - if(!$output->toBool()) return $output; |
|
261 | + if(!$output->toBool()) { |
|
262 | + return $output; |
|
263 | + } |
|
250 | 264 | |
251 | 265 | $output = executeQuery('module.insertModulePartConfig', $args); |
252 | 266 | |
@@ -268,9 +282,10 @@ discard block |
||
268 | 282 | if(isSiteID($domain)) |
269 | 283 | { |
270 | 284 | $oModuleModel = getModel('module'); |
271 | - if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid'); |
|
272 | - } |
|
273 | - else |
|
285 | + if($oModuleModel->isIDExists($domain, 0)) { |
|
286 | + return new Object(-1,'msg_already_registed_vid'); |
|
287 | + } |
|
288 | + } else |
|
274 | 289 | { |
275 | 290 | $domain = strtolower($domain); |
276 | 291 | } |
@@ -284,10 +299,14 @@ discard block |
||
284 | 299 | $columnList = array('modules.site_srl'); |
285 | 300 | $oModuleModel = getModel('module'); |
286 | 301 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
287 | - if($output) return new Object(-1,'msg_already_registed_vid'); |
|
302 | + if($output) { |
|
303 | + return new Object(-1,'msg_already_registed_vid'); |
|
304 | + } |
|
288 | 305 | |
289 | 306 | $output = executeQuery('module.insertSite', $args); |
290 | - if(!$output->toBool()) return $output; |
|
307 | + if(!$output->toBool()) { |
|
308 | + return $output; |
|
309 | + } |
|
291 | 310 | |
292 | 311 | $output->add('site_srl', $args->site_srl); |
293 | 312 | return $output; |
@@ -310,8 +329,12 @@ discard block |
||
310 | 329 | if($site_info->domain != $args->domain) |
311 | 330 | { |
312 | 331 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain'); |
|
314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid'); |
|
332 | + if($info->site_srl && $info->site_srl != $args->site_srl) { |
|
333 | + return new Object(-1,'msg_already_registed_domain'); |
|
334 | + } |
|
335 | + if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) { |
|
336 | + return new Object(-1,'msg_already_registed_vid'); |
|
337 | + } |
|
315 | 338 | |
316 | 339 | if($args->domain && !isSiteID($args->domain)) |
317 | 340 | { |
@@ -320,8 +343,11 @@ discard block |
||
320 | 343 | } |
321 | 344 | $output = executeQuery('module.updateSite', $args); |
322 | 345 | //clear cache for default mid |
323 | - if($args->site_srl == 0) $vid=''; |
|
324 | - else $vid=$args->domain; |
|
346 | + if($args->site_srl == 0) { |
|
347 | + $vid=''; |
|
348 | + } else { |
|
349 | + $vid=$args->domain; |
|
350 | + } |
|
325 | 351 | |
326 | 352 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
327 | 353 | $mid = $module_info->mid; |
@@ -345,7 +371,9 @@ discard block |
||
345 | 371 | unset($args->act); |
346 | 372 | unset($args->page); |
347 | 373 | // Test mid value |
348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
374 | + if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) { |
|
375 | + return new Object(-1, 'msg_limit_mid'); |
|
376 | + } |
|
349 | 377 | // Test variables (separate basic vars and other vars in modules) |
350 | 378 | $extra_vars = clone($args); |
351 | 379 | unset($extra_vars->module_srl); |
@@ -382,18 +410,23 @@ discard block |
||
382 | 410 | if(isset($args->isMenuCreate)) |
383 | 411 | { |
384 | 412 | $isMenuCreate = $args->isMenuCreate; |
385 | - } |
|
386 | - else |
|
413 | + } else |
|
387 | 414 | { |
388 | 415 | $isMenuCreate = TRUE; |
389 | 416 | } |
390 | 417 | |
391 | 418 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
392 | - if(!$output->toBool()) return $output; |
|
419 | + if(!$output->toBool()) { |
|
420 | + return $output; |
|
421 | + } |
|
393 | 422 | // Check whether the module name already exists |
394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
423 | + if(!$args->site_srl) { |
|
424 | + $args->site_srl = 0; |
|
425 | + } |
|
395 | 426 | $oModuleModel = getModel('module'); |
396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
427 | + if($oModuleModel->isIDExists($args->mid, $args->site_srl)) { |
|
428 | + return new Object(-1, 'msg_module_name_exists'); |
|
429 | + } |
|
397 | 430 | |
398 | 431 | // begin transaction |
399 | 432 | $oDB = &DB::getInstance(); |
@@ -404,20 +437,20 @@ discard block |
||
404 | 437 | $skin_vars = new stdClass(); |
405 | 438 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
406 | 439 | // Arrange variables and then execute a query |
407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
440 | + if(!$args->module_srl) { |
|
441 | + $args->module_srl = getNextSequence(); |
|
442 | + } |
|
408 | 443 | |
409 | 444 | // default value |
410 | 445 | if($args->skin == '/USE_DEFAULT/') |
411 | 446 | { |
412 | 447 | $args->is_skin_fix = 'N'; |
413 | - } |
|
414 | - else |
|
448 | + } else |
|
415 | 449 | { |
416 | 450 | if(isset($args->is_skin_fix)) |
417 | 451 | { |
418 | 452 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
419 | - } |
|
420 | - else |
|
453 | + } else |
|
421 | 454 | { |
422 | 455 | $args->is_skin_fix = 'Y'; |
423 | 456 | } |
@@ -426,14 +459,12 @@ discard block |
||
426 | 459 | if($args->mskin == '/USE_DEFAULT/') |
427 | 460 | { |
428 | 461 | $args->is_mskin_fix = 'N'; |
429 | - } |
|
430 | - else |
|
462 | + } else |
|
431 | 463 | { |
432 | 464 | if(isset($args->is_mskin_fix)) |
433 | 465 | { |
434 | 466 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
435 | - } |
|
436 | - else |
|
467 | + } else |
|
437 | 468 | { |
438 | 469 | $args->is_mskin_fix = 'Y'; |
439 | 470 | } |
@@ -510,14 +541,15 @@ discard block |
||
510 | 541 | if(isset($args->isMenuCreate)) |
511 | 542 | { |
512 | 543 | $isMenuCreate = $args->isMenuCreate; |
513 | - } |
|
514 | - else |
|
544 | + } else |
|
515 | 545 | { |
516 | 546 | $isMenuCreate = TRUE; |
517 | 547 | } |
518 | 548 | |
519 | 549 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
520 | - if(!$output->toBool()) return $output; |
|
550 | + if(!$output->toBool()) { |
|
551 | + return $output; |
|
552 | + } |
|
521 | 553 | // begin transaction |
522 | 554 | $oDB = &DB::getInstance(); |
523 | 555 | $oDB->begin(); |
@@ -528,8 +560,12 @@ discard block |
||
528 | 560 | |
529 | 561 | if(!$args->site_srl || !$args->browser_title) |
530 | 562 | { |
531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
563 | + if(!$args->site_srl) { |
|
564 | + $args->site_srl = (int)$module_info->site_srl; |
|
565 | + } |
|
566 | + if(!$args->browser_title) { |
|
567 | + $args->browser_title = $module_info->browser_title; |
|
568 | + } |
|
533 | 569 | } |
534 | 570 | |
535 | 571 | $args->browser_title = strip_tags($args->browser_title); |
@@ -545,14 +581,12 @@ discard block |
||
545 | 581 | if($args->skin == '/USE_DEFAULT/') |
546 | 582 | { |
547 | 583 | $args->is_skin_fix = 'N'; |
548 | - } |
|
549 | - else |
|
584 | + } else |
|
550 | 585 | { |
551 | 586 | if(isset($args->is_skin_fix)) |
552 | 587 | { |
553 | 588 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
554 | - } |
|
555 | - else |
|
589 | + } else |
|
556 | 590 | { |
557 | 591 | $args->is_skin_fix = 'Y'; |
558 | 592 | } |
@@ -561,14 +595,12 @@ discard block |
||
561 | 595 | if($args->mskin == '/USE_DEFAULT/') |
562 | 596 | { |
563 | 597 | $args->is_mskin_fix = 'N'; |
564 | - } |
|
565 | - else |
|
598 | + } else |
|
566 | 599 | { |
567 | 600 | if(isset($args->is_mskin_fix)) |
568 | 601 | { |
569 | 602 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
570 | - } |
|
571 | - else |
|
603 | + } else |
|
572 | 604 | { |
573 | 605 | $args->is_mskin_fix = 'Y'; |
574 | 606 | } |
@@ -637,7 +669,9 @@ discard block |
||
637 | 669 | $args->update_id = $update_id; |
638 | 670 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
639 | 671 | |
640 | - if(!!$output->error) return false; |
|
672 | + if(!!$output->error) { |
|
673 | + return false; |
|
674 | + } |
|
641 | 675 | |
642 | 676 | return true; |
643 | 677 | } |
@@ -652,7 +686,9 @@ discard block |
||
652 | 686 | $args->site_srl = $site_srl; |
653 | 687 | $args->layout_srl = $layout_srl; |
654 | 688 | $output = executeQuery('module.updateModuleSite', $args); |
655 | - if(!$output->toBool()) return $output; |
|
689 | + if(!$output->toBool()) { |
|
690 | + return $output; |
|
691 | + } |
|
656 | 692 | |
657 | 693 | //remove from cache |
658 | 694 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -671,7 +707,9 @@ discard block |
||
671 | 707 | */ |
672 | 708 | function deleteModule($module_srl, $site_srl = 0) |
673 | 709 | { |
674 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
710 | + if(!$module_srl) { |
|
711 | + return new Object(-1,'msg_invalid_request'); |
|
712 | + } |
|
675 | 713 | |
676 | 714 | $site_module_info = Context::get('site_module_info'); |
677 | 715 | |
@@ -681,8 +719,11 @@ discard block |
||
681 | 719 | $args = new stdClass(); |
682 | 720 | $args->url = $output->mid; |
683 | 721 | $args->is_shortcut = 'N'; |
684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
685 | - else $args->site_srl = $site_srl; |
|
722 | + if(!$site_srl) { |
|
723 | + $args->site_srl = $site_module_info->site_srl; |
|
724 | + } else { |
|
725 | + $args->site_srl = $site_srl; |
|
726 | + } |
|
686 | 727 | |
687 | 728 | unset($output); |
688 | 729 | |
@@ -715,8 +756,7 @@ discard block |
||
715 | 756 | if($output->isSuccess) |
716 | 757 | { |
717 | 758 | return new Object(0, 'success_deleted'); |
718 | - } |
|
719 | - else |
|
759 | + } else |
|
720 | 760 | { |
721 | 761 | return new Object($output->error, $output->message); |
722 | 762 | } |
@@ -734,19 +774,25 @@ discard block |
||
734 | 774 | */ |
735 | 775 | public function onlyDeleteModule($module_srl) |
736 | 776 | { |
737 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
777 | + if(!$module_srl) { |
|
778 | + return new Object(-1,'msg_invalid_request'); |
|
779 | + } |
|
738 | 780 | |
739 | 781 | // check start module |
740 | 782 | $oModuleModel = getModel('module'); |
741 | 783 | $columnList = array('sites.index_module_srl'); |
742 | 784 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
743 | - if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
785 | + if($module_srl == $start_module->index_module_srl) { |
|
786 | + return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
787 | + } |
|
744 | 788 | |
745 | 789 | // Call a trigger (before) |
746 | 790 | $trigger_obj = new stdClass(); |
747 | 791 | $trigger_obj->module_srl = $module_srl; |
748 | 792 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
749 | - if(!$output->toBool()) return $output; |
|
793 | + if(!$output->toBool()) { |
|
794 | + return $output; |
|
795 | + } |
|
750 | 796 | |
751 | 797 | // begin transaction |
752 | 798 | $oDB = &DB::getInstance(); |
@@ -807,7 +853,9 @@ discard block |
||
807 | 853 | function clearDefaultModule() |
808 | 854 | { |
809 | 855 | $output = executeQuery('module.clearDefaultModule'); |
810 | - if(!$output->toBool()) return $output; |
|
856 | + if(!$output->toBool()) { |
|
857 | + return $output; |
|
858 | + } |
|
811 | 859 | |
812 | 860 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
813 | 861 | if($oCacheHandler->isSupport()) |
@@ -839,7 +887,9 @@ discard block |
||
839 | 887 | */ |
840 | 888 | function updateModuleLayout($layout_srl, $menu_srl_list) |
841 | 889 | { |
842 | - if(!count($menu_srl_list)) return; |
|
890 | + if(!count($menu_srl_list)) { |
|
891 | + return; |
|
892 | + } |
|
843 | 893 | |
844 | 894 | $args = new stdClass; |
845 | 895 | $args->layout_srl = $layout_srl; |
@@ -866,28 +916,37 @@ discard block |
||
866 | 916 | |
867 | 917 | $output = executeQuery('module.deleteSiteAdmin', $args); |
868 | 918 | |
869 | - if(!$output->toBool()) return $output; |
|
919 | + if(!$output->toBool()) { |
|
920 | + return $output; |
|
921 | + } |
|
870 | 922 | // Get user id of an administrator |
871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
923 | + if(!is_array($arr_admins) || !count($arr_admins)) { |
|
924 | + return new Object(); |
|
925 | + } |
|
872 | 926 | foreach($arr_admins as $key => $user_id) |
873 | 927 | { |
874 | - if(!trim($user_id)) continue; |
|
928 | + if(!trim($user_id)) { |
|
929 | + continue; |
|
930 | + } |
|
875 | 931 | $admins[] = trim($user_id); |
876 | 932 | } |
877 | - if(!count($admins)) return new Object(); |
|
933 | + if(!count($admins)) { |
|
934 | + return new Object(); |
|
935 | + } |
|
878 | 936 | |
879 | 937 | $oMemberModel = getModel('member'); |
880 | 938 | $member_config = $oMemberModel->getMemberConfig(); |
881 | 939 | if($member_config->identifier == 'email_address') |
882 | 940 | { |
883 | 941 | $args->email_address = '\''.implode('\',\'',$admins).'\''; |
884 | - } |
|
885 | - else |
|
942 | + } else |
|
886 | 943 | { |
887 | 944 | $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
888 | 945 | } |
889 | 946 | $output = executeQueryArray('module.getAdminSrls', $args); |
890 | - if(!$output->toBool()||!$output->data) return $output; |
|
947 | + if(!$output->toBool()||!$output->data) { |
|
948 | + return $output; |
|
949 | + } |
|
891 | 950 | |
892 | 951 | foreach($output->data as $key => $val) |
893 | 952 | { |
@@ -896,7 +955,9 @@ discard block |
||
896 | 955 | $args->site_srl = $site_srl; |
897 | 956 | $args->member_srl = $val->member_srl; |
898 | 957 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
899 | - if(!$output->toBool()) return $output; |
|
958 | + if(!$output->toBool()) { |
|
959 | + return $output; |
|
960 | + } |
|
900 | 961 | } |
901 | 962 | return new Object(); |
902 | 963 | } |
@@ -909,12 +970,15 @@ discard block |
||
909 | 970 | $oMemberModel = getModel('member'); |
910 | 971 | $member_config = $oMemberModel->getMemberConfig(); |
911 | 972 | |
912 | - if($member_config->identifier == 'email_address') |
|
913 | - $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
914 | - else |
|
915 | - $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
973 | + if($member_config->identifier == 'email_address') { |
|
974 | + $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
975 | + } else { |
|
976 | + $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
977 | + } |
|
916 | 978 | |
917 | - if(!$member_info->member_srl) return; |
|
979 | + if(!$member_info->member_srl) { |
|
980 | + return; |
|
981 | + } |
|
918 | 982 | $args = new stdClass(); |
919 | 983 | $args->module_srl = $module_srl; |
920 | 984 | $args->member_srl = $member_info->member_srl; |
@@ -933,7 +997,9 @@ discard block |
||
933 | 997 | { |
934 | 998 | $oMemberModel = getModel('member'); |
935 | 999 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
1000 | + if($member_info->member_srl) { |
|
1001 | + $args->member_srl = $member_info->member_srl; |
|
1002 | + } |
|
937 | 1003 | } |
938 | 1004 | return executeQuery('module.deleteAdminId', $args); |
939 | 1005 | } |
@@ -977,7 +1043,9 @@ discard block |
||
977 | 1043 | } |
978 | 1044 | |
979 | 1045 | getDestroyXeVars($obj); |
980 | - if(!$obj || !count($obj)) return new Object(); |
|
1046 | + if(!$obj || !count($obj)) { |
|
1047 | + return new Object(); |
|
1048 | + } |
|
981 | 1049 | |
982 | 1050 | $args = new stdClass; |
983 | 1051 | $args->module_srl = $module_srl; |
@@ -987,18 +1055,23 @@ discard block |
||
987 | 1055 | // it often saved menu item(stdClass) on the skin info column |
988 | 1056 | // When updating the module on XE core 1.2.0 later versions, it occurs an error |
989 | 1057 | // fixed the error |
990 | - if (is_object($val)) continue; |
|
991 | - if (is_array($val)) $val = serialize($val); |
|
1058 | + if (is_object($val)) { |
|
1059 | + continue; |
|
1060 | + } |
|
1061 | + if (is_array($val)) { |
|
1062 | + $val = serialize($val); |
|
1063 | + } |
|
992 | 1064 | |
993 | 1065 | $args->name = trim($key); |
994 | 1066 | $args->value = trim($val); |
995 | - if(!$args->name || !$args->value) continue; |
|
1067 | + if(!$args->name || !$args->value) { |
|
1068 | + continue; |
|
1069 | + } |
|
996 | 1070 | |
997 | 1071 | if($mode === 'P') |
998 | 1072 | { |
999 | 1073 | $output = executeQuery('module.insertModuleSkinVars', $args); |
1000 | - } |
|
1001 | - else |
|
1074 | + } else |
|
1002 | 1075 | { |
1003 | 1076 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
1004 | 1077 | } |
@@ -1045,8 +1118,7 @@ discard block |
||
1045 | 1118 | { |
1046 | 1119 | $object_key = 'module_skin_vars:'.$module_srl; |
1047 | 1120 | $query = 'module.deleteModuleSkinVars'; |
1048 | - } |
|
1049 | - else |
|
1121 | + } else |
|
1050 | 1122 | { |
1051 | 1123 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1052 | 1124 | $query = 'module.deleteModuleMobileSkinVars'; |
@@ -1070,17 +1142,23 @@ discard block |
||
1070 | 1142 | { |
1071 | 1143 | $this->deleteModuleExtraVars($module_srl); |
1072 | 1144 | getDestroyXeVars($obj); |
1073 | - if(!$obj || !count($obj)) return; |
|
1145 | + if(!$obj || !count($obj)) { |
|
1146 | + return; |
|
1147 | + } |
|
1074 | 1148 | |
1075 | 1149 | foreach($obj as $key => $val) |
1076 | 1150 | { |
1077 | - if(is_object($val) || is_array($val)) continue; |
|
1151 | + if(is_object($val) || is_array($val)) { |
|
1152 | + continue; |
|
1153 | + } |
|
1078 | 1154 | |
1079 | 1155 | $args = new stdClass(); |
1080 | 1156 | $args->module_srl = $module_srl; |
1081 | 1157 | $args->name = trim($key); |
1082 | 1158 | $args->value = trim($val); |
1083 | - if(!$args->name || !$args->value) continue; |
|
1159 | + if(!$args->name || !$args->value) { |
|
1160 | + continue; |
|
1161 | + } |
|
1084 | 1162 | $output = executeQuery('module.insertModuleExtraVars', $args); |
1085 | 1163 | } |
1086 | 1164 | |
@@ -1120,11 +1198,15 @@ discard block |
||
1120 | 1198 | function insertModuleGrants($module_srl, $obj) |
1121 | 1199 | { |
1122 | 1200 | $this->deleteModuleGrants($module_srl); |
1123 | - if(!$obj || !count($obj)) return; |
|
1201 | + if(!$obj || !count($obj)) { |
|
1202 | + return; |
|
1203 | + } |
|
1124 | 1204 | |
1125 | 1205 | foreach($obj as $name => $val) |
1126 | 1206 | { |
1127 | - if(!$val || !count($val)) continue; |
|
1207 | + if(!$val || !count($val)) { |
|
1208 | + continue; |
|
1209 | + } |
|
1128 | 1210 | |
1129 | 1211 | foreach($val as $group_srl) |
1130 | 1212 | { |
@@ -1132,7 +1214,9 @@ discard block |
||
1132 | 1214 | $args->module_srl = $module_srl; |
1133 | 1215 | $args->name = $name; |
1134 | 1216 | $args->group_srl = trim($group_srl); |
1135 | - if(!$args->name || !$args->group_srl) continue; |
|
1217 | + if(!$args->name || !$args->group_srl) { |
|
1218 | + continue; |
|
1219 | + } |
|
1136 | 1220 | executeQuery('module.insertModuleGrant', $args); |
1137 | 1221 | } |
1138 | 1222 | } |
@@ -1192,7 +1276,9 @@ discard block |
||
1192 | 1276 | require_once($cache_file); |
1193 | 1277 | } |
1194 | 1278 | } |
1195 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1279 | + if(!Context::get($matches[1]) && $lang[$matches[1]]) { |
|
1280 | + return $lang[$matches[1]]; |
|
1281 | + } |
|
1196 | 1282 | |
1197 | 1283 | return str_replace('$user_lang->','',$matches[0]); |
1198 | 1284 | } |
@@ -1204,10 +1290,14 @@ discard block |
||
1204 | 1290 | function procModuleFileBoxAdd() |
1205 | 1291 | { |
1206 | 1292 | $ajax = Context::get('ajax'); |
1207 | - if ($ajax) Context::setRequestMethod('JSON'); |
|
1293 | + if ($ajax) { |
|
1294 | + Context::setRequestMethod('JSON'); |
|
1295 | + } |
|
1208 | 1296 | |
1209 | 1297 | $logged_info = Context::get('logged_info'); |
1210 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
1298 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
1299 | + return new Object(-1, 'msg_not_permitted'); |
|
1300 | + } |
|
1211 | 1301 | |
1212 | 1302 | $vars = Context::gets('addfile','filter'); |
1213 | 1303 | $attributeNames = Context::get('attribute_name'); |
@@ -1231,9 +1321,14 @@ discard block |
||
1231 | 1321 | |
1232 | 1322 | $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
1233 | 1323 | $vars->ext = $ext; |
1234 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
1235 | - else $filter = array('jpg','jpeg','gif','png'); |
|
1236 | - if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured'); |
|
1324 | + if($vars->filter) { |
|
1325 | + $filter = explode(',',$vars->filter); |
|
1326 | + } else { |
|
1327 | + $filter = array('jpg','jpeg','gif','png'); |
|
1328 | + } |
|
1329 | + if(!in_array($ext,$filter)) { |
|
1330 | + return new Object(-1, 'msg_error_occured'); |
|
1331 | + } |
|
1237 | 1332 | |
1238 | 1333 | $vars->member_srl = $logged_info->member_srl; |
1239 | 1334 | |
@@ -1246,10 +1341,16 @@ discard block |
||
1246 | 1341 | // insert |
1247 | 1342 | else |
1248 | 1343 | { |
1249 | - if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
1344 | + if(!Context::isUploaded()) { |
|
1345 | + return new Object(-1, 'msg_error_occured'); |
|
1346 | + } |
|
1250 | 1347 | $addfile = Context::get('addfile'); |
1251 | - if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
1252 | - if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
1348 | + if(!is_uploaded_file($addfile['tmp_name'])) { |
|
1349 | + return new Object(-1, 'msg_error_occured'); |
|
1350 | + } |
|
1351 | + if($vars->addfile['error'] != 0) { |
|
1352 | + return new Object(-1, 'msg_error_occured'); |
|
1353 | + } |
|
1253 | 1354 | $output = $this->insertModuleFileBox($vars); |
1254 | 1355 | } |
1255 | 1356 | |
@@ -1260,11 +1361,13 @@ discard block |
||
1260 | 1361 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); |
1261 | 1362 | $this->setRedirectUrl($returnUrl); |
1262 | 1363 | return; |
1263 | - } |
|
1264 | - else |
|
1364 | + } else |
|
1265 | 1365 | { |
1266 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
1267 | - else $this->add('save_filename', ''); |
|
1366 | + if($output) { |
|
1367 | + $this->add('save_filename', $output->get('save_filename')); |
|
1368 | + } else { |
|
1369 | + $this->add('save_filename', ''); |
|
1370 | + } |
|
1268 | 1371 | } |
1269 | 1372 | } |
1270 | 1373 | |
@@ -1288,7 +1391,9 @@ discard block |
||
1288 | 1391 | $tmp = $vars->addfile['tmp_name']; |
1289 | 1392 | |
1290 | 1393 | // Check uploaded file |
1291 | - if(!checkUploadedFile($tmp)) return false; |
|
1394 | + if(!checkUploadedFile($tmp)) { |
|
1395 | + return false; |
|
1396 | + } |
|
1292 | 1397 | |
1293 | 1398 | if(!@move_uploaded_file($tmp, $save_filename)) |
1294 | 1399 | { |
@@ -1325,7 +1430,9 @@ discard block |
||
1325 | 1430 | $tmp = $vars->addfile['tmp_name']; |
1326 | 1431 | |
1327 | 1432 | // Check uploaded file |
1328 | - if(!checkUploadedFile($tmp)) return false; |
|
1433 | + if(!checkUploadedFile($tmp)) { |
|
1434 | + return false; |
|
1435 | + } |
|
1329 | 1436 | |
1330 | 1437 | // upload |
1331 | 1438 | if(!@move_uploaded_file($tmp, $save_filename)) |
@@ -1354,14 +1461,20 @@ discard block |
||
1354 | 1461 | function procModuleFileBoxDelete() |
1355 | 1462 | { |
1356 | 1463 | $logged_info = Context::get('logged_info'); |
1357 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
1464 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
1465 | + return new Object(-1, 'msg_not_permitted'); |
|
1466 | + } |
|
1358 | 1467 | |
1359 | 1468 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1360 | - if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
1469 | + if(!$module_filebox_srl) { |
|
1470 | + return new Object(-1, 'msg_invalid_request'); |
|
1471 | + } |
|
1361 | 1472 | $vars = new stdClass(); |
1362 | 1473 | $vars->module_filebox_srl = $module_filebox_srl; |
1363 | 1474 | $output = $this->deleteModuleFileBox($vars); |
1364 | - if(!$output->toBool()) return $output; |
|
1475 | + if(!$output->toBool()) { |
|
1476 | + return $output; |
|
1477 | + } |
|
1365 | 1478 | } |
1366 | 1479 | |
1367 | 1480 | function deleteModuleFileBox($vars) |
@@ -1384,9 +1497,13 @@ discard block |
||
1384 | 1497 | $this->unlockTimeoutPassed(); |
1385 | 1498 | $args = new stdClass; |
1386 | 1499 | $args->lock_name = $lock_name; |
1387 | - if(!$timeout) $timeout = 60; |
|
1500 | + if(!$timeout) { |
|
1501 | + $timeout = 60; |
|
1502 | + } |
|
1388 | 1503 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
1389 | - if($member_srl) $args->member_srl = $member_srl; |
|
1504 | + if($member_srl) { |
|
1505 | + $args->member_srl = $member_srl; |
|
1506 | + } |
|
1390 | 1507 | $output = executeQuery('module.insertLock', $args); |
1391 | 1508 | if($output->toBool()) |
1392 | 1509 | { |