@@ -579,7 +579,7 @@ |
||
579 | 579 | |
580 | 580 | /** |
581 | 581 | * Get module's detail setup contents |
582 | - * @return void |
|
582 | + * @return BaseObject|null |
|
583 | 583 | */ |
584 | 584 | public function getMenuAdminDetailSetup() |
585 | 585 | { |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function getMenuList($obj) |
29 | 29 | { |
30 | - if(!$obj->site_srl) |
|
30 | + if (!$obj->site_srl) |
|
31 | 31 | { |
32 | 32 | $site_module_info = Context::get('site_module_info'); |
33 | - $obj->site_srl = (int)$site_module_info->site_srl; |
|
33 | + $obj->site_srl = (int) $site_module_info->site_srl; |
|
34 | 34 | } |
35 | 35 | $args = new stdClass; |
36 | 36 | $args->site_srl = $obj->site_srl; |
37 | 37 | $args->sort_index = $obj->sort_index; |
38 | - $args->page = $obj->page?$obj->page:1; |
|
39 | - $args->list_count = $obj->list_count?$obj->list_count:20; |
|
40 | - $args->page_count = $obj->page_count?$obj->page_count:10; |
|
38 | + $args->page = $obj->page ? $obj->page : 1; |
|
39 | + $args->list_count = $obj->list_count ? $obj->list_count : 20; |
|
40 | + $args->page_count = $obj->page_count ? $obj->page_count : 10; |
|
41 | 41 | // document.getDocumentList query execution |
42 | 42 | $output = executeQuery('menu.getMenuList', $args); |
43 | 43 | // Return if no result or an error occurs |
44 | - if(!$output->toBool()||!count($output->data)) return $output; |
|
44 | + if (!$output->toBool() || !count($output->data)) return $output; |
|
45 | 45 | |
46 | 46 | return $output; |
47 | 47 | } |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | */ |
54 | 54 | function getMenus($site_srl = null) |
55 | 55 | { |
56 | - if(!isset($site_srl)) |
|
56 | + if (!isset($site_srl)) |
|
57 | 57 | { |
58 | 58 | $site_module_info = Context::get('site_module_info'); |
59 | - $site_srl = (int)$site_module_info->site_srl; |
|
59 | + $site_srl = (int) $site_module_info->site_srl; |
|
60 | 60 | } |
61 | 61 | // Get information from the DB |
62 | 62 | $args = new stdClass(); |
63 | - $args->site_srl = $site_srl ; |
|
63 | + $args->site_srl = $site_srl; |
|
64 | 64 | $args->menu_srl = $menu_srl; |
65 | 65 | $output = executeQueryArray('menu.getMenus', $args); |
66 | - if(!$output->data) return; |
|
66 | + if (!$output->data) return; |
|
67 | 67 | $menus = $output->data; |
68 | 68 | return $menus; |
69 | 69 | } |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | $args = new stdClass(); |
81 | 81 | $args->menu_srl = $menu_srl; |
82 | 82 | $output = executeQuery('menu.getMenu', $args); |
83 | - if(!$output->data) return; |
|
83 | + if (!$output->data) return; |
|
84 | 84 | |
85 | 85 | $menu_info = $output->data; |
86 | - $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_srl); |
|
87 | - $menu_info->php_file = sprintf('./files/cache/menu/%s.php',$menu_srl); |
|
86 | + $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php', $menu_srl); |
|
87 | + $menu_info->php_file = sprintf('./files/cache/menu/%s.php', $menu_srl); |
|
88 | 88 | return $menu_info; |
89 | 89 | } |
90 | 90 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | function getMenuByTitle($title, $site_srl = 0) |
98 | 98 | { |
99 | 99 | // Get information from the DB |
100 | - if(!is_array($title)) |
|
100 | + if (!is_array($title)) |
|
101 | 101 | { |
102 | 102 | $title = array($title); |
103 | 103 | } |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | $args->title = $title; |
106 | 106 | $args->site_srl = $site_srl; |
107 | 107 | $output = executeQuery('menu.getMenuByTitle', $args); |
108 | - if(!$output->data) return; |
|
108 | + if (!$output->data) return; |
|
109 | 109 | |
110 | - if(is_array($output->data)) $menu_info = $output->data[0]; |
|
110 | + if (is_array($output->data)) $menu_info = $output->data[0]; |
|
111 | 111 | else $menu_info = $output->data; |
112 | 112 | |
113 | - if($menu_info->menu_srl) |
|
113 | + if ($menu_info->menu_srl) |
|
114 | 114 | { |
115 | - $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php',$menu_info->menu_srl); |
|
116 | - $menu_info->php_file = sprintf('./files/cache/menu/%s.php',$menu_info->menu_srl); |
|
115 | + $menu_info->xml_file = sprintf('./files/cache/menu/%s.xml.php', $menu_info->menu_srl); |
|
116 | + $menu_info->php_file = sprintf('./files/cache/menu/%s.php', $menu_info->menu_srl); |
|
117 | 117 | } |
118 | 118 | return $menu_info; |
119 | 119 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $args = new stdClass(); |
131 | 131 | $args->title = $title; |
132 | 132 | $output = executeQueryArray('menu.getMenuByTitle', $args); |
133 | - if(!$output->data) |
|
133 | + if (!$output->data) |
|
134 | 134 | { |
135 | 135 | return array(); |
136 | 136 | } |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $args->menu_item_srl = $menu_item_srl; |
152 | 152 | $output = executeQuery('menu.getMenuItem', $args); |
153 | 153 | $node = $output->data; |
154 | - settype($node,'object'); |
|
155 | - if($node->group_srls) $node->group_srls = explode(',',$node->group_srls); |
|
154 | + settype($node, 'object'); |
|
155 | + if ($node->group_srls) $node->group_srls = explode(',', $node->group_srls); |
|
156 | 156 | else $node->group_srls = array(); |
157 | 157 | |
158 | 158 | $tmp_name = unserialize($node->name); |
159 | - if($tmp_name && count($tmp_name)) |
|
159 | + if ($tmp_name && count($tmp_name)) |
|
160 | 160 | { |
161 | 161 | $selected_lang = array(); |
162 | 162 | $rand_name = $tmp_name[Context::getLangType()]; |
163 | - if(!$rand_name) $rand_name = array_shift($tmp_name); |
|
163 | + if (!$rand_name) $rand_name = array_shift($tmp_name); |
|
164 | 164 | $node->name = $rand_name; |
165 | 165 | } |
166 | 166 | return $node; |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | $menuItemSrl = Context::get('menu_item_srl'); |
176 | 176 | $menuItem = $this->getMenuItemInfo($menuItemSrl); |
177 | 177 | |
178 | - if(!$menuItem->url) |
|
178 | + if (!$menuItem->url) |
|
179 | 179 | { |
180 | 180 | $menuItem->moduleType = null; |
181 | 181 | } |
182 | - else if(strncasecmp('http', $menuItem->url, 4) !== 0) |
|
182 | + else if (strncasecmp('http', $menuItem->url, 4) !== 0) |
|
183 | 183 | { |
184 | 184 | $oModuleModel = getModel('module'); |
185 | 185 | $moduleInfo = $oModuleModel->getModuleInfoByMid($menuItem->url, 0); |
186 | - if(!$moduleInfo) $menuItem->moduleType = 'url'; |
|
186 | + if (!$moduleInfo) $menuItem->moduleType = 'url'; |
|
187 | 187 | else |
188 | 188 | { |
189 | - if($moduleInfo->mid == $menuItem->url) |
|
189 | + if ($moduleInfo->mid == $menuItem->url) |
|
190 | 190 | { |
191 | 191 | $menuItem->moduleType = $moduleInfo->module; |
192 | 192 | $menuItem->pageType = $moduleInfo->page_type; |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | else $menuItem->moduleType = 'url'; |
198 | 198 | |
199 | 199 | // grant setting |
200 | - if(is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0) |
|
200 | + if (is_array($menuItem->group_srls) && count($menuItem->group_srls) > 0) |
|
201 | 201 | { |
202 | - if($menuItem->group_srls[0] == -1) |
|
202 | + if ($menuItem->group_srls[0] == -1) |
|
203 | 203 | { |
204 | 204 | $menuItem->grant = 'member'; |
205 | 205 | } |
206 | - else if($menuItem->group_srls[0] == -3) |
|
206 | + else if ($menuItem->group_srls[0] == -3) |
|
207 | 207 | { |
208 | 208 | $menuItem->grant = 'manager'; |
209 | 209 | } |
@@ -217,21 +217,21 @@ discard block |
||
217 | 217 | $oMemberModel = getModel('member'); |
218 | 218 | $oModuleAdminModel = getAdminModel('module'); |
219 | 219 | $output = $oMemberModel->getGroups(); |
220 | - if(is_array($output)) |
|
220 | + if (is_array($output)) |
|
221 | 221 | { |
222 | 222 | $groupList = array(); |
223 | - foreach($output AS $key=>$value) |
|
223 | + foreach ($output AS $key=>$value) |
|
224 | 224 | { |
225 | 225 | $groupList[$value->group_srl] = new stdClass(); |
226 | 226 | $groupList[$value->group_srl]->group_srl = $value->group_srl; |
227 | - if(substr($value->title,0,12)=='$user_lang->') |
|
227 | + if (substr($value->title, 0, 12) == '$user_lang->') |
|
228 | 228 | { |
229 | 229 | $tmp = $oModuleAdminModel->getLangCode(0, $value->title); |
230 | 230 | $groupList[$value->group_srl]->title = $tmp[Context::getLangType()]; |
231 | 231 | } |
232 | 232 | else $groupList[$value->group_srl]->title = $value->title; |
233 | 233 | |
234 | - if(in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true; |
|
234 | + if (in_array($key, $menuItem->group_srls)) $groupList[$value->group_srl]->isChecked = true; |
|
235 | 235 | else $groupList[$value->group_srl]->isChecked = false; |
236 | 236 | } |
237 | 237 | } |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | */ |
270 | 270 | function getMenuItemNames($source_name, $site_srl = null) |
271 | 271 | { |
272 | - if(!$site_srl) |
|
272 | + if (!$site_srl) |
|
273 | 273 | { |
274 | 274 | $site_module_info = Context::get('site_module_info'); |
275 | - $site_srl = (int)$site_module_info->site_srl; |
|
275 | + $site_srl = (int) $site_module_info->site_srl; |
|
276 | 276 | } |
277 | 277 | // Get language code |
278 | 278 | $oModuleAdminModel = getAdminModel('module'); |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | // Add a sub-menu if there is parent_srl but not menu_item_srl |
298 | 298 | $item_info = new stdClass; |
299 | - if(!$menu_item_srl && $parent_srl) |
|
299 | + if (!$menu_item_srl && $parent_srl) |
|
300 | 300 | { |
301 | 301 | // Get information of the parent menu |
302 | 302 | $parent_info = $this->getMenuItemInfo($parent_srl); |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | else |
310 | 310 | { |
311 | 311 | // Get information of the menu if menu_item_srl exists |
312 | - if($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl); |
|
312 | + if ($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl); |
|
313 | 313 | // Get only menu_item_srl if no values found, considering it as adding a new menu |
314 | - if(!$item_info->menu_item_srl) |
|
314 | + if (!$item_info->menu_item_srl) |
|
315 | 315 | { |
316 | 316 | $item_info->menu_item_srl = getNextSequence(); |
317 | 317 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $oTemplate = &TemplateHandler::getInstance(); |
328 | 328 | $tpl = $oTemplate->compile($this->module_path.'tpl', 'menu_item_info'); |
329 | 329 | |
330 | - $this->add('tpl', str_replace("\n"," ",$tpl)); |
|
330 | + $this->add('tpl', str_replace("\n", " ", $tpl)); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | |
347 | 347 | Context::loadLang('modules/page/lang'); |
348 | 348 | |
349 | - foreach($_allModules as $module_name) |
|
349 | + foreach ($_allModules as $module_name) |
|
350 | 350 | { |
351 | 351 | $module = $oModuleModel->getModuleInfoXml($module_name); |
352 | - if(!isset($module)) continue; |
|
352 | + if (!isset($module)) continue; |
|
353 | 353 | $defaultSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'P'); |
354 | 354 | $defaultMobileSkin = $oModuleModel->getModuleDefaultSkin($module_name, 'M'); |
355 | 355 | $skinInfo = $oModuleModel->loadSkinInfo(ModuleHandler::getModulePath($module_name), $defaultSkin); |
@@ -361,10 +361,10 @@ discard block |
||
361 | 361 | $module->defaultMobileSkin->skin = $defaultMobileSkin; |
362 | 362 | $module->defaultMobileSkin->title = $mobileSkinInfo->title ? $mobileSkinInfo->title : $defaultMobileSkin; |
363 | 363 | |
364 | - $module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/' . $module_name); |
|
365 | - $module->url = _XE_LOCATION_SITE_ . '?mid=download&package_srl=' . $module->package_srl; |
|
364 | + $module->package_srl = $oAutoinstallModel->getPackageSrlByPath('./modules/'.$module_name); |
|
365 | + $module->url = _XE_LOCATION_SITE_.'?mid=download&package_srl='.$module->package_srl; |
|
366 | 366 | |
367 | - if($module_name == 'page') |
|
367 | + if ($module_name == 'page') |
|
368 | 368 | { |
369 | 369 | $pageTypeName = Context::getLang('page_type_name'); |
370 | 370 | $module->title = $pageTypeName['ARTICLE']; |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | $moduleList = array('page'); |
402 | 402 | |
403 | 403 | $output = $oModuleModel->getModuleListByInstance($site_srl); |
404 | - if(is_array($output->data)) |
|
404 | + if (is_array($output->data)) |
|
405 | 405 | { |
406 | - foreach($output->data as $value) |
|
406 | + foreach ($output->data as $value) |
|
407 | 407 | { |
408 | - if($value->instanceCount > 1) |
|
408 | + if ($value->instanceCount > 1) |
|
409 | 409 | { |
410 | 410 | $moduleList[] = $value->module; |
411 | 411 | } |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | // after trigger |
416 | 416 | $output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList); |
417 | - if(!$output->toBool()) return $output; |
|
417 | + if (!$output->toBool()) return $output; |
|
418 | 418 | |
419 | 419 | $localModuleList = array_unique($moduleList); |
420 | 420 | |
@@ -423,9 +423,9 @@ discard block |
||
423 | 423 | // get have instance |
424 | 424 | $remotePackageList = $oAutoinstallModel->getHaveInstance(array('path')); |
425 | 425 | $remoteModuleList = array(); |
426 | - foreach($remotePackageList as $package) |
|
426 | + foreach ($remotePackageList as $package) |
|
427 | 427 | { |
428 | - if(strpos($package->path, './modules/') !== 0) continue; |
|
428 | + if (strpos($package->path, './modules/') !== 0) continue; |
|
429 | 429 | |
430 | 430 | $pathInfo = explode('/', $package->path); |
431 | 431 | $remoteModuleList[] = $pathInfo[2]; |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | |
444 | 444 | $moduleInfoList = array(); |
445 | 445 | Context::loadLang('modules/page/lang'); |
446 | - if(is_array($moduleList)) |
|
446 | + if (is_array($moduleList)) |
|
447 | 447 | { |
448 | - foreach($moduleList as $value) |
|
448 | + foreach ($moduleList as $value) |
|
449 | 449 | { |
450 | 450 | $moduleInfo = $oModuleModel->getModuleInfoXml($value); |
451 | 451 | |
452 | - if($value == 'page') |
|
452 | + if ($value == 'page') |
|
453 | 453 | { |
454 | 454 | $pageTypeName = Context::getLang('page_type_name'); |
455 | 455 | $moduleInfo->title = $pageTypeName['ARTICLE']; |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | $siteSrl = Context::get('site_srl'); |
481 | 481 | $menuSrl = Context::get('menu_srl'); |
482 | 482 | |
483 | - if(!isset($siteSrl)) |
|
483 | + if (!isset($siteSrl)) |
|
484 | 484 | { |
485 | 485 | $site_module_info = Context::get('site_module_info'); |
486 | - $siteSrl = (int)$site_module_info->site_srl; |
|
486 | + $siteSrl = (int) $site_module_info->site_srl; |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | $oModuleModel = getModel('module'); |
@@ -492,24 +492,24 @@ discard block |
||
492 | 492 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
493 | 493 | |
494 | 494 | $menuList = array(); |
495 | - if($menuSrl) |
|
495 | + if ($menuSrl) |
|
496 | 496 | { |
497 | 497 | $isMenuFixed = false; |
498 | 498 | $output = $this->getMenu($menuSrl); |
499 | - $php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$output->menu_srl); |
|
500 | - if(file_exists($php_file)) include($php_file); |
|
499 | + $php_file = sprintf(_XE_PATH_.'files/cache/menu/%s.php', $output->menu_srl); |
|
500 | + if (file_exists($php_file)) include($php_file); |
|
501 | 501 | else $oMenuAdminController->makeXmlFile($menuSrl); |
502 | 502 | |
503 | - if(count($menu->list)>0) |
|
503 | + if (count($menu->list) > 0) |
|
504 | 504 | { |
505 | - foreach($menu->list AS $key=>$value) |
|
505 | + foreach ($menu->list AS $key=>$value) |
|
506 | 506 | { |
507 | - $this->_menuInfoSetting($menu->list[$key], $start_module, $isMenuFixed, $menuSrl,$siteSrl); |
|
507 | + $this->_menuInfoSetting($menu->list[$key], $start_module, $isMenuFixed, $menuSrl, $siteSrl); |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
511 | 511 | // menu recreate |
512 | - if($isMenuFixed) |
|
512 | + if ($isMenuFixed) |
|
513 | 513 | { |
514 | 514 | $oMenuAdminController->makeXmlFile($menuSrl); |
515 | 515 | } |
@@ -522,18 +522,18 @@ discard block |
||
522 | 522 | else |
523 | 523 | { |
524 | 524 | $menuListFromDB = $this->getMenus($siteSrl); |
525 | - if(is_array($menuListFromDB)) |
|
525 | + if (is_array($menuListFromDB)) |
|
526 | 526 | { |
527 | 527 | $oAdmin = getClass('admin'); |
528 | - foreach($menuListFromDB AS $key=>$value) |
|
528 | + foreach ($menuListFromDB AS $key=>$value) |
|
529 | 529 | { |
530 | - if($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]); |
|
530 | + if ($value->title == $oAdmin->getAdminMenuName()) unset($output[$key]); |
|
531 | 531 | else |
532 | 532 | { |
533 | 533 | unset($menu); |
534 | 534 | unset($menuItems); |
535 | - $value->php_file = sprintf(_XE_PATH_ . 'files/cache/menu/%s.php',$value->menu_srl); |
|
536 | - if(!file_exists($value->php_file)) |
|
535 | + $value->php_file = sprintf(_XE_PATH_.'files/cache/menu/%s.php', $value->menu_srl); |
|
536 | + if (!file_exists($value->php_file)) |
|
537 | 537 | { |
538 | 538 | $oMenuAdminController->makeXmlFile($value->menu_srl); |
539 | 539 | } |
@@ -541,16 +541,16 @@ discard block |
||
541 | 541 | include($value->php_file); |
542 | 542 | |
543 | 543 | $isMenuFixed = false; |
544 | - if(count($menu->list) > 0) |
|
544 | + if (count($menu->list) > 0) |
|
545 | 545 | { |
546 | - foreach($menu->list AS $key2=>$value2) |
|
546 | + foreach ($menu->list AS $key2=>$value2) |
|
547 | 547 | { |
548 | - $this->_menuInfoSetting($menu->list[$key2], $start_module, $isMenuFixed, $value->menu_srl,$siteSrl); |
|
548 | + $this->_menuInfoSetting($menu->list[$key2], $start_module, $isMenuFixed, $value->menu_srl, $siteSrl); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | 552 | // menu recreate |
553 | - if($isMenuFixed) |
|
553 | + if ($isMenuFixed) |
|
554 | 554 | { |
555 | 555 | $oMenuAdminController->makeXmlFile($value->menu_srl); |
556 | 556 | } |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $menuItems->menuItems = $menu; |
562 | 562 | |
563 | 563 | // If include home menu, move first |
564 | - if($value->menu_srl == $this->menuSrlWithinHome) |
|
564 | + if ($value->menu_srl == $this->menuSrlWithinHome) |
|
565 | 565 | { |
566 | 566 | $menuList[-1] = $menuItems; |
567 | 567 | } |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | public function getMenuAdminDetailSetup() |
585 | 585 | { |
586 | 586 | $menuItemSrl = Context::get('menu_item_srl'); |
587 | - if(!$menuItemSrl) |
|
587 | + if (!$menuItemSrl) |
|
588 | 588 | { |
589 | 589 | return new BaseObject(-1, 'msg_invalid_request'); |
590 | 590 | } |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $menuItemInfo = $this->getMenuItemInfo($menuItemSrl); |
593 | 593 | |
594 | 594 | // if menu is shortcut |
595 | - if($menuItemInfo->is_shortcut == 'Y') |
|
595 | + if ($menuItemInfo->is_shortcut == 'Y') |
|
596 | 596 | { |
597 | 597 | return new BaseObject(-1, 'msg_invalid_request'); |
598 | 598 | } |
@@ -604,18 +604,18 @@ discard block |
||
604 | 604 | // get xml info |
605 | 605 | $moduleConfInfo = $oModuleModel->getModuleInfoXml($moduleInfo->module); |
606 | 606 | |
607 | - if($moduleConfInfo->setup_index_act) |
|
607 | + if ($moduleConfInfo->setup_index_act) |
|
608 | 608 | { |
609 | 609 | $setupUrl = getNotEncodedUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl, 'isLayoutDrop', '1'); |
610 | 610 | } |
611 | 611 | |
612 | - if($moduleConfInfo->simple_setup_index_act) |
|
612 | + if ($moduleConfInfo->simple_setup_index_act) |
|
613 | 613 | { |
614 | 614 | $oTargetmoduleAdminModel = getAdminModel($moduleInfo->module); |
615 | 615 | $advancedSetupUrl = getUrl('', 'module', 'admin', 'act', $moduleConfInfo->setup_index_act, 'module_srl', $moduleInfo->module_srl); |
616 | 616 | $simpleSetupHtml = $oTargetmoduleAdminModel->{$moduleConfInfo->simple_setup_index_act}($moduleInfo->module_srl, $advancedSetupUrl); |
617 | 617 | |
618 | - if($simpleSetupHtml) |
|
618 | + if ($simpleSetupHtml) |
|
619 | 619 | { |
620 | 620 | $this->add('simpleSetupHtml', $simpleSetupHtml); |
621 | 621 | } |
@@ -628,18 +628,18 @@ discard block |
||
628 | 628 | * @param array $menu |
629 | 629 | * @return void |
630 | 630 | */ |
631 | - private function _menuInfoSetting(&$menu, &$start_module, &$isMenuFixed, $menuSrl,$siteSrl = 0) |
|
631 | + private function _menuInfoSetting(&$menu, &$start_module, &$isMenuFixed, $menuSrl, $siteSrl = 0) |
|
632 | 632 | { |
633 | 633 | $oModuleModel = getModel('module'); |
634 | 634 | // if url is empty and is_shortcut is 'N', change to is_shortcut 'Y' |
635 | - if(!$menu['url'] && $menu['is_shortcut'] == 'N') |
|
635 | + if (!$menu['url'] && $menu['is_shortcut'] == 'N') |
|
636 | 636 | { |
637 | 637 | $menu['is_shortcut'] = 'Y'; |
638 | 638 | |
639 | 639 | $args = new stdClass; |
640 | 640 | $args->menu_item_srl = $menu['node_srl']; |
641 | 641 | $args->is_shortcut = 'Y'; |
642 | - if($menu['menu_name_key']) $args->name = $menu['menu_name_key']; |
|
642 | + if ($menu['menu_name_key']) $args->name = $menu['menu_name_key']; |
|
643 | 643 | else $args->name = $menu['menu_name']; |
644 | 644 | $output = executeQuery('menu.updateMenuItem', $args); |
645 | 645 | |
@@ -648,17 +648,17 @@ discard block |
||
648 | 648 | |
649 | 649 | //if menu type is module menu |
650 | 650 | //if(!empty($menu['url']) && !preg_match('/^http/i', $menu['url'])) |
651 | - if($menu['is_shortcut'] != 'Y') |
|
651 | + if ($menu['is_shortcut'] != 'Y') |
|
652 | 652 | { |
653 | 653 | unset($midInfo, $moduleInfo); |
654 | 654 | $midInfo = $oModuleModel->getModuleInfoByMid($menu['url'], $siteSrl); |
655 | 655 | $moduleInfo = $oModuleModel->getModuleInfoXml($midInfo->module); |
656 | 656 | |
657 | - if($midInfo) |
|
657 | + if ($midInfo) |
|
658 | 658 | { |
659 | 659 | $menu['module_srl'] = $midInfo->module_srl; |
660 | 660 | $menu['module'] = $midInfo->module; |
661 | - if($midInfo->page_type) |
|
661 | + if ($midInfo->page_type) |
|
662 | 662 | { |
663 | 663 | $menu['module_type'] = $midInfo->page_type; |
664 | 664 | } |
@@ -668,16 +668,16 @@ discard block |
||
668 | 668 | } |
669 | 669 | } |
670 | 670 | |
671 | - if($moduleInfo->setup_index_act) |
|
671 | + if ($moduleInfo->setup_index_act) |
|
672 | 672 | { |
673 | 673 | $menu['setup_index_act'] = $moduleInfo->setup_index_act; |
674 | 674 | } |
675 | - else if($moduleInfo->default_index_act) |
|
675 | + else if ($moduleInfo->default_index_act) |
|
676 | 676 | { |
677 | 677 | $menu['setup_index_act'] = $moduleInfo->default_index_act; |
678 | 678 | } |
679 | 679 | |
680 | - if($menu['is_shortcut'] == 'N' && $midInfo->mid == $start_module->mid) |
|
680 | + if ($menu['is_shortcut'] == 'N' && $midInfo->mid == $start_module->mid) |
|
681 | 681 | { |
682 | 682 | $menu['is_start_module'] = true; |
683 | 683 | $this->menuSrlWithinHome = $menuSrl; |
@@ -686,9 +686,9 @@ discard block |
||
686 | 686 | $menu['layout_srl'] = $midInfo->layout_srl; |
687 | 687 | $menu['browser_title'] = $midInfo->browser_title; |
688 | 688 | } |
689 | - if(count($menu['list']) > 0) |
|
689 | + if (count($menu['list']) > 0) |
|
690 | 690 | { |
691 | - foreach($menu['list'] as $key=>$value) |
|
691 | + foreach ($menu['list'] as $key=>$value) |
|
692 | 692 | { |
693 | 693 | $this->_menuInfoSetting($menu['list'][$key], $start_module, $isMenuFixed, $menuSrl, $siteSrl); |
694 | 694 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | /** |
111 | 111 | * RSS Module configurations |
112 | 112 | * |
113 | - * @return void |
|
113 | + * @return BaseObject|null |
|
114 | 114 | */ |
115 | 115 | function procRssAdminInsertModuleConfig() |
116 | 116 | { |
@@ -27,41 +27,41 @@ discard block |
||
27 | 27 | $total_config = $oModuleModel->getModuleConfig('rss'); |
28 | 28 | |
29 | 29 | $config_vars = Context::getRequestVars(); |
30 | - $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
|
30 | + $config_vars->feed_document_count = (int) $config_vars->feed_document_count; |
|
31 | 31 | |
32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
32 | + if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
33 | + if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y'; |
|
34 | 34 | |
35 | - if($config_vars->image || $config_vars->del_image) |
|
35 | + if ($config_vars->image || $config_vars->del_image) |
|
36 | 36 | { |
37 | 37 | $image_obj = $config_vars->image; |
38 | 38 | $config_vars->image = $total_config->image; |
39 | 39 | // Get a variable for the delete request |
40 | - if($config_vars->del_image == 'Y' || $image_obj) |
|
40 | + if ($config_vars->del_image == 'Y' || $image_obj) |
|
41 | 41 | { |
42 | 42 | FileHandler::removeFile($config_vars->image); |
43 | 43 | $config_vars->image = ''; |
44 | 44 | $total_config->image = ''; |
45 | 45 | } |
46 | 46 | // Ignore if the file is not the one which has been successfully uploaded |
47 | - if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
47 | + if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
48 | 48 | { |
49 | 49 | // Ignore if the file is not an image |
50 | 50 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
51 | 51 | |
52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
52 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
53 | 53 | else |
54 | 54 | { |
55 | 55 | // Upload the file to a path |
56 | 56 | $path = './files/attach/images/rss/'; |
57 | 57 | // Create a directory |
58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
58 | + if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
59 | 59 | else |
60 | 60 | { |
61 | 61 | $filename = $path.$image_obj['name']; |
62 | 62 | |
63 | 63 | // Move the file |
64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
64 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
65 | 65 | else |
66 | 66 | { |
67 | 67 | $config_vars->image = $filename; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
73 | + if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
74 | 74 | |
75 | 75 | $output = $this->setFeedConfig($config_vars); |
76 | 76 | |
77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
77 | + if (!$alt_message) $alt_message = 'success_updated'; |
|
78 | 78 | |
79 | 79 | $alt_message = Context::getLang($alt_message); |
80 | 80 | $this->setMessage($alt_message, 'info'); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $originConfig = $oModuleModel->getModuleConfig('rss'); |
97 | 97 | |
98 | 98 | // Get a variable for the delete request |
99 | - if($delImage == 'Y') |
|
99 | + if ($delImage == 'Y') |
|
100 | 100 | { |
101 | 101 | FileHandler::removeFile($originConfig->image); |
102 | 102 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $feedCopyrightList = $config_vars->feed_copyright; |
123 | 123 | $targetModuleSrl = $config_vars->target_module_srl; |
124 | 124 | |
125 | - if($targetModuleSrl && !is_array($openRssList)) |
|
125 | + if ($targetModuleSrl && !is_array($openRssList)) |
|
126 | 126 | { |
127 | 127 | $openRssList = array($targetModuleSrl => $openRssList); |
128 | 128 | $openTotalFeedList = array($targetModuleSrl => $openTotalFeedList); |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | $feedCopyrightList = array($targetModuleSrl => $feedCopyrightList); |
131 | 131 | } |
132 | 132 | |
133 | - if(is_array($openRssList)) |
|
133 | + if (is_array($openRssList)) |
|
134 | 134 | { |
135 | - foreach($openRssList AS $module_srl=>$open_rss) |
|
135 | + foreach ($openRssList AS $module_srl=>$open_rss) |
|
136 | 136 | { |
137 | - if(!$module_srl || !$open_rss) |
|
137 | + if (!$module_srl || !$open_rss) |
|
138 | 138 | { |
139 | 139 | return new BaseObject(-1, 'msg_invalid_request'); |
140 | 140 | } |
141 | 141 | |
142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
142 | + if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N'; |
|
143 | 143 | |
144 | 144 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
145 | 145 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | function setFeedConfig($config) |
162 | 162 | { |
163 | 163 | $oModuleController = getController('module'); |
164 | - $oModuleController->insertModuleConfig('rss',$config); |
|
164 | + $oModuleController->insertModuleConfig('rss', $config); |
|
165 | 165 | return new BaseObject(); |
166 | 166 | } |
167 | 167 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | $config = new stdClass; |
182 | 182 | $config->open_rss = $open_rss; |
183 | 183 | $config->open_total_feed = $open_total_feed; |
184 | - if($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
185 | - if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
186 | - $oModuleController->insertModulePartConfig('rss',$module_srl,$config); |
|
184 | + if ($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
185 | + if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
186 | + $oModuleController->insertModulePartConfig('rss', $module_srl, $config); |
|
187 | 187 | return new BaseObject(); |
188 | 188 | } |
189 | 189 | } |
@@ -29,8 +29,12 @@ discard block |
||
29 | 29 | $config_vars = Context::getRequestVars(); |
30 | 30 | $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
31 | 31 | |
32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
32 | + if(!$config_vars->use_total_feed) { |
|
33 | + $alt_message = 'msg_invalid_request'; |
|
34 | + } |
|
35 | + if(!in_array($config_vars->use_total_feed, array('Y','N'))) { |
|
36 | + $config_vars->open_rss = 'Y'; |
|
37 | + } |
|
34 | 38 | |
35 | 39 | if($config_vars->image || $config_vars->del_image) |
36 | 40 | { |
@@ -49,20 +53,23 @@ discard block |
||
49 | 53 | // Ignore if the file is not an image |
50 | 54 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
51 | 55 | |
52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
53 | - else |
|
56 | + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { |
|
57 | + $alt_message = 'msg_rss_invalid_image_format'; |
|
58 | + } else |
|
54 | 59 | { |
55 | 60 | // Upload the file to a path |
56 | 61 | $path = './files/attach/images/rss/'; |
57 | 62 | // Create a directory |
58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
59 | - else |
|
63 | + if(!FileHandler::makeDir($path)) { |
|
64 | + $alt_message = 'msg_error_occured'; |
|
65 | + } else |
|
60 | 66 | { |
61 | 67 | $filename = $path.$image_obj['name']; |
62 | 68 | |
63 | 69 | // Move the file |
64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
65 | - else |
|
70 | + if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { |
|
71 | + $alt_message = 'msg_error_occured'; |
|
72 | + } else |
|
66 | 73 | { |
67 | 74 | $config_vars->image = $filename; |
68 | 75 | } |
@@ -70,11 +77,15 @@ discard block |
||
70 | 77 | } |
71 | 78 | } |
72 | 79 | } |
73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
80 | + if(!$config_vars->image && $config_vars->del_image != 'Y') { |
|
81 | + $config_vars->image = $total_config->image; |
|
82 | + } |
|
74 | 83 | |
75 | 84 | $output = $this->setFeedConfig($config_vars); |
76 | 85 | |
77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
86 | + if(!$alt_message) { |
|
87 | + $alt_message = 'success_updated'; |
|
88 | + } |
|
78 | 89 | |
79 | 90 | $alt_message = Context::getLang($alt_message); |
80 | 91 | $this->setMessage($alt_message, 'info'); |
@@ -139,7 +150,9 @@ discard block |
||
139 | 150 | return new BaseObject(-1, 'msg_invalid_request'); |
140 | 151 | } |
141 | 152 | |
142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
153 | + if(!in_array($open_rss, array('Y','H','N'))) { |
|
154 | + $open_rss = 'N'; |
|
155 | + } |
|
143 | 156 | |
144 | 157 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
145 | 158 | } |
@@ -697,6 +697,9 @@ discard block |
||
697 | 697 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
698 | 698 | } |
699 | 699 | |
700 | + /** |
|
701 | + * @param boolean $javascript_mode |
|
702 | + */ |
|
700 | 703 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
701 | 704 | { |
702 | 705 | if(!$widgetStyle) return $widget_content_body; |
@@ -737,6 +740,7 @@ discard block |
||
737 | 740 | |
738 | 741 | /** |
739 | 742 | * @brief request parameters and variables sort through the information widget |
743 | + * @param BaseObject $request_vars |
|
740 | 744 | */ |
741 | 745 | function arrangeWidgetVars($widget, $request_vars, &$vars) |
742 | 746 | { |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | $oModuleModel = getModel('module'); |
35 | 35 | $skin_info = $oModuleModel->loadSkinInfo($path, $skin); |
36 | 36 | |
37 | - for($i=0;$i<count($skin_info->colorset);$i++) |
|
37 | + for ($i = 0; $i < count($skin_info->colorset); $i++) |
|
38 | 38 | { |
39 | 39 | $colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title); |
40 | 40 | $colorset_list[] = $colorset; |
41 | 41 | } |
42 | 42 | |
43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
43 | + if (count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
44 | 44 | $this->add('colorset_list', $colorsets); |
45 | 45 | } |
46 | 46 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function procWidgetGenerateCode() |
51 | 51 | { |
52 | 52 | $widget = Context::get('selected_widget'); |
53 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
54 | - if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
53 | + if (!$widget) return new BaseObject(-1, 'msg_invalid_request'); |
|
54 | + if (!Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null')); |
|
55 | 55 | |
56 | 56 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
57 | 57 | |
58 | - $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute)); |
|
58 | + $widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ', $attribute)); |
|
59 | 59 | // Code output |
60 | 60 | $this->add('widget_code', $widget_code); |
61 | 61 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | function procWidgetGenerateCodeInPage() |
67 | 67 | { |
68 | 68 | $widget = Context::get('selected_widget'); |
69 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
69 | + if (!$widget) return new BaseObject(-1, 'msg_invalid_request'); |
|
70 | 70 | |
71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
71 | + if (!in_array($widget, array('widgetBox', 'widgetContent')) && !Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null')); |
|
72 | 72 | |
73 | 73 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
74 | 74 | // Wanted results |
@@ -107,26 +107,26 @@ discard block |
||
107 | 107 | $err = 0; |
108 | 108 | $oLayoutModel = getModel('layout'); |
109 | 109 | $layout_info = $oLayoutModel->getLayout($module_srl); |
110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
110 | + if (!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
111 | 111 | |
112 | 112 | // Destination Information Wanted page module |
113 | 113 | $oModuleModel = getModel('module'); |
114 | 114 | $columnList = array('module_srl', 'module'); |
115 | 115 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
116 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
116 | + if (!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
117 | 117 | |
118 | - if($err > 1) return new BaseObject(-1,'msg_invalid_request'); |
|
118 | + if ($err > 1) return new BaseObject(-1, 'msg_invalid_request'); |
|
119 | 119 | |
120 | 120 | // Check permissions |
121 | 121 | $logged_info = Context::get('logged_info'); |
122 | - if(!$logged_info->member_srl) |
|
122 | + if (!$logged_info->member_srl) |
|
123 | 123 | { |
124 | - return new BaseObject(-1,'msg_not_permitted'); |
|
124 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
125 | 125 | } |
126 | 126 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
127 | - if(!$module_grant->manager) |
|
127 | + if (!$module_grant->manager) |
|
128 | 128 | { |
129 | - return new BaseObject(-1,'msg_not_permitted'); |
|
129 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // Enter post |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $obj->document_srl = $document_srl; |
140 | 140 | |
141 | 141 | $oDocument = $oDocumentModel->getDocument($obj->document_srl); |
142 | - if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
142 | + if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
|
143 | 143 | { |
144 | 144 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
145 | 145 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | // Stop when an error occurs |
153 | - if(!$output->toBool()) return $output; |
|
153 | + if (!$output->toBool()) return $output; |
|
154 | 154 | |
155 | 155 | // Return results |
156 | 156 | $this->add('document_srl', $obj->document_srl); |
@@ -169,29 +169,29 @@ discard block |
||
169 | 169 | $oDocumentAdminController = getAdminController('document'); |
170 | 170 | |
171 | 171 | $oDocument = $oDocumentModel->getDocument($document_srl); |
172 | - if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request'); |
|
172 | + if (!$oDocument->isExists()) return new BaseObject(-1, 'msg_invalid_request'); |
|
173 | 173 | $module_srl = $oDocument->get('module_srl'); |
174 | 174 | |
175 | 175 | // Destination Information Wanted page module |
176 | 176 | $oModuleModel = getModel('module'); |
177 | 177 | $columnList = array('module_srl', 'module'); |
178 | 178 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
179 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
179 | + if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request'); |
|
180 | 180 | |
181 | 181 | // Check permissions |
182 | 182 | $logged_info = Context::get('logged_info'); |
183 | - if(!$logged_info->member_srl) |
|
183 | + if (!$logged_info->member_srl) |
|
184 | 184 | { |
185 | - return new BaseObject(-1,'msg_not_permitted'); |
|
185 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
186 | 186 | } |
187 | 187 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
188 | - if(!$module_grant->manager) |
|
188 | + if (!$module_grant->manager) |
|
189 | 189 | { |
190 | - return new BaseObject(-1,'msg_not_permitted'); |
|
190 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
191 | 191 | } |
192 | 192 | |
193 | - $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
|
194 | - if(!$output->toBool()) return $output; |
|
193 | + $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'), 0); |
|
194 | + if (!$output->toBool()) return $output; |
|
195 | 195 | |
196 | 196 | // Return results |
197 | 197 | $copied_srls = $output->get('copied_srls'); |
@@ -210,28 +210,28 @@ discard block |
||
210 | 210 | $oDocumentController = getController('document'); |
211 | 211 | |
212 | 212 | $oDocument = $oDocumentModel->getDocument($document_srl); |
213 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
213 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
214 | 214 | $module_srl = $oDocument->get('module_srl'); |
215 | 215 | |
216 | 216 | // Destination Information Wanted page module |
217 | 217 | $oModuleModel = getModel('module'); |
218 | 218 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
219 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
219 | + if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request'); |
|
220 | 220 | |
221 | 221 | // Check permissions |
222 | 222 | $logged_info = Context::get('logged_info'); |
223 | - if(!$logged_info->member_srl) |
|
223 | + if (!$logged_info->member_srl) |
|
224 | 224 | { |
225 | 225 | return new BaseObject(-1, 'msg_not_permitted'); |
226 | 226 | } |
227 | 227 | $module_grant = $oModuleModel->getGrant($page_info, $logged_info); |
228 | - if(!$module_grant->manager) |
|
228 | + if (!$module_grant->manager) |
|
229 | 229 | { |
230 | 230 | return new BaseObject(-1, 'msg_not_permitted'); |
231 | 231 | } |
232 | 232 | |
233 | 233 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); |
234 | - if(!$output->toBool()) return $output; |
|
234 | + if (!$output->toBool()) return $output; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function triggerWidgetCompile(&$content) |
250 | 250 | { |
251 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
251 | + if (Context::getResponseMethod() != 'HTML') return new BaseObject(); |
|
252 | 252 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
253 | 253 | return new BaseObject(); |
254 | 254 | } |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | // Check whether to include information about editing |
265 | 265 | $this->javascript_mode = $javascript_mode; |
266 | 266 | // Widget code box change |
267 | - $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content); |
|
267 | + $content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content); |
|
268 | 268 | // Widget code information byeogyeong |
269 | - $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content); |
|
269 | + $content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this, 'transWidget'), $content); |
|
270 | 270 | |
271 | 271 | return $content; |
272 | 272 | } |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | $oXmlParser = new XmlParser(); |
282 | 282 | $xml_doc = $oXmlParser->parse(trim($buff)); |
283 | 283 | |
284 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
284 | + if ($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
285 | 285 | else $vars = $xml_doc->attrs; |
286 | 286 | |
287 | 287 | $widget = $vars->widget; |
288 | - if(!$widget) return $matches[0]; |
|
288 | + if (!$widget) return $matches[0]; |
|
289 | 289 | unset($vars->widget); |
290 | 290 | |
291 | 291 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function transWidgetBox($matches) |
298 | 298 | { |
299 | - $buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]); |
|
299 | + $buff = preg_replace('/<div><div>(.*)$/i', '</div>', $matches[0]); |
|
300 | 300 | $oXmlParser = new XmlParser(); |
301 | 301 | $xml_doc = $oXmlParser->parse($buff); |
302 | 302 | |
303 | 303 | $vars = $xml_doc->div->attrs; |
304 | 304 | $widget = $vars->widget; |
305 | - if(!$widget) return $matches[0]; |
|
305 | + if (!$widget) return $matches[0]; |
|
306 | 306 | unset($vars->widget); |
307 | 307 | |
308 | 308 | $vars->widgetbox_content = $matches[3]; |
@@ -323,28 +323,28 @@ discard block |
||
323 | 323 | $oXmlParser = new XmlParser(); |
324 | 324 | |
325 | 325 | $cnt = count($matches[1]); |
326 | - for($i=0;$i<$cnt;$i++) |
|
326 | + for ($i = 0; $i < $cnt; $i++) |
|
327 | 327 | { |
328 | 328 | $buff = $matches[0][$i]; |
329 | 329 | $xml_doc = $oXmlParser->parse(trim($buff)); |
330 | 330 | |
331 | 331 | $args = $xml_doc->img->attrs; |
332 | - if(!$args) continue; |
|
332 | + if (!$args) continue; |
|
333 | 333 | // If you are not caching path |
334 | 334 | $widget = $args->widget; |
335 | 335 | $sequence = $args->widget_sequence; |
336 | 336 | $cache = $args->widget_cache; |
337 | - if(!$sequence || !$cache) continue; |
|
337 | + if (!$sequence || !$cache) continue; |
|
338 | 338 | |
339 | - if(count($args)) |
|
339 | + if (count($args)) |
|
340 | 340 | { |
341 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
341 | + foreach ($args as $k => $v) $args->{$k} = urldecode($v); |
|
342 | 342 | } |
343 | 343 | // If the cache file for each language widget regeneration |
344 | - foreach($lang_list as $lang_type => $val) |
|
344 | + foreach ($lang_list as $lang_type => $val) |
|
345 | 345 | { |
346 | 346 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
347 | - if(!file_exists($cache_file)) continue; |
|
347 | + if (!file_exists($cache_file)) continue; |
|
348 | 348 | $this->getCache($widget, $args, $lang_type, true); |
349 | 349 | } |
350 | 350 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
357 | 357 | { |
358 | 358 | // If the specified language specifies the current language |
359 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
359 | + if (!$lang_type) $lang_type = Context::getLangType(); |
|
360 | 360 | // widget, the cache number and cache values are set |
361 | 361 | $widget_sequence = $args->widget_sequence; |
362 | 362 | $widget_cache = $args->widget_cache; |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | /** |
365 | 365 | * Even if the cache number and value of the cache and return it to extract data |
366 | 366 | */ |
367 | - if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
367 | + if (!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
|
368 | 368 | { |
369 | 369 | $oWidget = $this->getWidgetObject($widget); |
370 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
370 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
371 | 371 | |
372 | 372 | $widget_content = $oWidget->proc($args); |
373 | 373 | $oModuleController = getController('module'); |
@@ -376,15 +376,15 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | $oCacheHandler = CacheHandler::getInstance('template'); |
379 | - if($oCacheHandler->isSupport()) |
|
379 | + if ($oCacheHandler->isSupport()) |
|
380 | 380 | { |
381 | - $key = 'widget_cache:' . $widget_sequence; |
|
381 | + $key = 'widget_cache:'.$widget_sequence; |
|
382 | 382 | |
383 | 383 | $cache_body = $oCacheHandler->get($key); |
384 | 384 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
385 | 385 | } |
386 | 386 | |
387 | - if($cache_body) |
|
387 | + if ($cache_body) |
|
388 | 388 | { |
389 | 389 | return $cache_body; |
390 | 390 | } |
@@ -397,11 +397,11 @@ discard block |
||
397 | 397 | // Wanted cache file |
398 | 398 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type); |
399 | 399 | // If the file exists in the cache, the file validation |
400 | - if(!$ignore_cache && file_exists($cache_file)) |
|
400 | + if (!$ignore_cache && file_exists($cache_file)) |
|
401 | 401 | { |
402 | 402 | $filemtime = filemtime($cache_file); |
403 | 403 | // Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache |
404 | - if($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
404 | + if ($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php')) |
|
405 | 405 | { |
406 | 406 | $cache_body = FileHandler::readFile($cache_file); |
407 | 407 | $cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body); |
@@ -410,18 +410,18 @@ discard block |
||
410 | 410 | } |
411 | 411 | } |
412 | 412 | // cache update and cache renewal of the file mtime |
413 | - if(!$oCacheHandler->isSupport()) |
|
413 | + if (!$oCacheHandler->isSupport()) |
|
414 | 414 | { |
415 | 415 | touch($cache_file); |
416 | 416 | } |
417 | 417 | |
418 | 418 | $oWidget = $this->getWidgetObject($widget); |
419 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
419 | + if (!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
420 | 420 | |
421 | 421 | $widget_content = $oWidget->proc($args); |
422 | 422 | $oModuleController = getController('module'); |
423 | 423 | $oModuleController->replaceDefinedLangCode($widget_content); |
424 | - if($oCacheHandler->isSupport()) |
|
424 | + if ($oCacheHandler->isSupport()) |
|
425 | 425 | { |
426 | 426 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
427 | 427 | } |
@@ -443,16 +443,16 @@ discard block |
||
443 | 443 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
444 | 444 | { |
445 | 445 | // Save for debug run-time widget |
446 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
446 | + if (__DEBUG__ == 3) $start = getMicroTime(); |
|
447 | 447 | $before = microtime(true); |
448 | 448 | // urldecode the value of args haejum |
449 | 449 | $object_vars = get_object_vars($args); |
450 | - if(count($object_vars)) |
|
450 | + if (count($object_vars)) |
|
451 | 451 | { |
452 | - foreach($object_vars as $key => $val) |
|
452 | + foreach ($object_vars as $key => $val) |
|
453 | 453 | { |
454 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
455 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
454 | + if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) continue; |
|
455 | + if ($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
456 | 456 | } |
457 | 457 | } |
458 | 458 | |
@@ -461,14 +461,14 @@ discard block |
||
461 | 461 | * Widgets widgetContent/widgetBox Wanted If you are not content |
462 | 462 | */ |
463 | 463 | $widget_content = ''; |
464 | - if($widget != 'widgetContent' && $widget != 'widgetBox') |
|
464 | + if ($widget != 'widgetContent' && $widget != 'widgetBox') |
|
465 | 465 | { |
466 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
466 | + if (!is_dir(sprintf(_XE_PATH_.'widgets/%s/', $widget))) return; |
|
467 | 467 | // Hold the contents of the widget parameter |
468 | 468 | $widget_content = $this->getCache($widget, $args); |
469 | 469 | } |
470 | 470 | |
471 | - if($widget == 'widgetBox') |
|
471 | + if ($widget == 'widgetBox') |
|
472 | 472 | { |
473 | 473 | $widgetbox_content = $args->widgetbox_content; |
474 | 474 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * Wanted specified by the administrator of the widget style |
478 | 478 | */ |
479 | 479 | // Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed |
480 | - $style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style); |
|
480 | + $style = preg_replace('/url\((.+)(\/?)none\)/is', '', $args->style); |
|
481 | 481 | // Find a style statement that based on the internal margin dropping pre-change |
482 | 482 | $widget_padding_left = $args->widget_padding_left; |
483 | 483 | $widget_padding_right = $args->widget_padding_right; |
@@ -493,18 +493,18 @@ discard block |
||
493 | 493 | $widget_content_body = ''; |
494 | 494 | $widget_content_footer = ''; |
495 | 495 | // If general call is given on page styles should return immediately dreamin ' |
496 | - if(!$javascript_mode) |
|
496 | + if (!$javascript_mode) |
|
497 | 497 | { |
498 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
499 | - switch($widget) |
|
498 | + if ($args->id) $args->id = ' id="'.$args->id.'" '; |
|
499 | + switch ($widget) |
|
500 | 500 | { |
501 | 501 | // If a direct orthogonal addition information |
502 | 502 | case 'widgetContent' : |
503 | - if($args->document_srl) |
|
503 | + if ($args->document_srl) |
|
504 | 504 | { |
505 | 505 | $oDocumentModel = getModel('document'); |
506 | 506 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
507 | - $body = $oDocument->getContent(false,false,false, false); |
|
507 | + $body = $oDocument->getContent(false, false, false, false); |
|
508 | 508 | } |
509 | 509 | else |
510 | 510 | { |
@@ -514,21 +514,21 @@ discard block |
||
514 | 514 | $oEditorController = getController('editor'); |
515 | 515 | $body = $oEditorController->transComponent($body); |
516 | 516 | |
517 | - $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
517 | + $widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper '.$args->css_class.'" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style); |
|
518 | 518 | $widget_content_body = $body; |
519 | 519 | $widget_content_footer = '</div></div>'; |
520 | 520 | |
521 | 521 | break; |
522 | 522 | // If the widget box; it could |
523 | 523 | case 'widgetBox' : |
524 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
524 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style); |
|
525 | 525 | $widget_content_body = $widgetbox_content; |
526 | 526 | |
527 | 527 | break; |
528 | 528 | // If the General wijetil |
529 | 529 | default : |
530 | - $widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style); |
|
531 | - $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content); |
|
530 | + $widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s">', $args->id, $style); |
|
531 | + $widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content); |
|
532 | 532 | $widget_content_footer = '</div>'; |
533 | 533 | break; |
534 | 534 | } |
@@ -536,15 +536,15 @@ discard block |
||
536 | 536 | } |
537 | 537 | else |
538 | 538 | { |
539 | - switch($widget) |
|
539 | + switch ($widget) |
|
540 | 540 | { |
541 | 541 | // If a direct orthogonal addition information |
542 | 542 | case 'widgetContent' : |
543 | - if($args->document_srl) |
|
543 | + if ($args->document_srl) |
|
544 | 544 | { |
545 | 545 | $oDocumentModel = getModel('document'); |
546 | 546 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
547 | - $body = $oDocument->getContent(false,false,false); |
|
547 | + $body = $oDocument->getContent(false, false, false); |
|
548 | 548 | } |
549 | 549 | else |
550 | 550 | { |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | } |
553 | 553 | // by args |
554 | 554 | $attribute = array(); |
555 | - if($args) |
|
555 | + if ($args) |
|
556 | 556 | { |
557 | - foreach($args as $key => $val) |
|
557 | + foreach ($args as $key => $val) |
|
558 | 558 | { |
559 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
560 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
559 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
560 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
561 | 561 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
562 | 562 | } |
563 | 563 | } |
@@ -565,44 +565,44 @@ discard block |
||
565 | 565 | $oWidgetController = getController('widget'); |
566 | 566 | |
567 | 567 | $widget_content_header = sprintf( |
568 | - '<div class="xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
568 | + '<div class="xe_content widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'. |
|
569 | 569 | '<div class="widgetResize"></div>'. |
570 | 570 | '<div class="widgetResizeLeft"></div>'. |
571 | 571 | '<div class="widgetBorder">'. |
572 | - '<div style="%s">',$args->widgetstyle, |
|
572 | + '<div style="%s">', $args->widgetstyle, |
|
573 | 573 | $style, |
574 | 574 | $args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom, |
575 | 575 | $args->document_srl, |
576 | - implode(' ',$attribute), |
|
576 | + implode(' ', $attribute), |
|
577 | 577 | $inner_style); |
578 | 578 | |
579 | 579 | $widget_content_body = $body; |
580 | 580 | $widget_content_footer = sprintf('</div>'. |
581 | 581 | '</div>'. |
582 | 582 | '<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'. |
583 | - '</div>',base64_encode($body)); |
|
583 | + '</div>', base64_encode($body)); |
|
584 | 584 | |
585 | 585 | break; |
586 | 586 | // If the widget box; it could |
587 | 587 | case 'widgetBox' : |
588 | 588 | // by args |
589 | 589 | $attribute = array(); |
590 | - if($args) |
|
590 | + if ($args) |
|
591 | 591 | { |
592 | - foreach($args as $key => $val) |
|
592 | + foreach ($args as $key => $val) |
|
593 | 593 | { |
594 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
595 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
596 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
594 | + if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue; |
|
595 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
596 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
597 | 597 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
598 | 598 | } |
599 | 599 | } |
600 | 600 | |
601 | 601 | $widget_content_header = sprintf( |
602 | - '<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
602 | + '<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'. |
|
603 | 603 | '<div class="widgetBoxResize"></div>'. |
604 | 604 | '<div class="widgetBoxResizeLeft"></div>'. |
605 | - '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style); |
|
605 | + '<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style); |
|
606 | 606 | |
607 | 607 | $widget_content_body = $widgetbox_content; |
608 | 608 | |
@@ -611,26 +611,26 @@ discard block |
||
611 | 611 | default : |
612 | 612 | // by args |
613 | 613 | $attribute = array(); |
614 | - if($args) |
|
614 | + if ($args) |
|
615 | 615 | { |
616 | - $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
|
617 | - foreach($args as $key => $val) |
|
616 | + $allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget'); |
|
617 | + foreach ($args as $key => $val) |
|
618 | 618 | { |
619 | - if(in_array($key, $allowed_key)) continue; |
|
620 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
621 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
619 | + if (in_array($key, $allowed_key)) continue; |
|
620 | + if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue; |
|
621 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
622 | 622 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
626 | - $widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
626 | + $widget_content_header = sprintf('<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'. |
|
627 | 627 | '<div class="widgetResize"></div>'. |
628 | 628 | '<div class="widgetResizeLeft"></div>'. |
629 | - '<div class="widgetBorder">',$args->widgetstyle,$style, |
|
629 | + '<div class="widgetBorder">', $args->widgetstyle, $style, |
|
630 | 630 | $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, |
631 | - $widget, implode(' ',$attribute)); |
|
631 | + $widget, implode(' ', $attribute)); |
|
632 | 632 | |
633 | - $widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content); |
|
633 | + $widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content); |
|
634 | 634 | |
635 | 635 | $widget_content_footer = '</div></div>'; |
636 | 636 | |
@@ -638,11 +638,11 @@ discard block |
||
638 | 638 | } |
639 | 639 | } |
640 | 640 | // Compile the widget style. |
641 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
641 | + if ($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode); |
|
642 | 642 | |
643 | - $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
|
643 | + $output = $widget_content_header.$widget_content_body.$widget_content_footer; |
|
644 | 644 | // Debug widget creation time information added to the results |
645 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
645 | + if (__DEBUG__ == 3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
646 | 646 | |
647 | 647 | $after = microtime(true); |
648 | 648 | |
@@ -663,32 +663,32 @@ discard block |
||
663 | 663 | */ |
664 | 664 | function getWidgetObject($widget) |
665 | 665 | { |
666 | - if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
666 | + if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget)) |
|
667 | 667 | { |
668 | 668 | return Context::getLang('msg_invalid_request'); |
669 | 669 | } |
670 | 670 | |
671 | - if(!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
671 | + if (!$GLOBALS['_xe_loaded_widgets_'][$widget]) |
|
672 | 672 | { |
673 | 673 | // Finding the location of a widget |
674 | 674 | $oWidgetModel = getModel('widget'); |
675 | 675 | $path = $oWidgetModel->getWidgetPath($widget); |
676 | 676 | // If you do not find the class file error output widget (html output) |
677 | 677 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
678 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
678 | + if (!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
679 | 679 | // Widget classes include |
680 | 680 | require_once($class_file); |
681 | 681 | |
682 | 682 | // Creating Objects |
683 | - if(!class_exists($widget, false)) |
|
683 | + if (!class_exists($widget, false)) |
|
684 | 684 | { |
685 | 685 | return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
686 | 686 | } |
687 | 687 | |
688 | 688 | $oWidget = new $widget(); |
689 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
689 | + if (!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
690 | 690 | |
691 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
691 | + if (!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
692 | 692 | |
693 | 693 | $oWidget->widget_path = $path; |
694 | 694 | |
@@ -697,29 +697,29 @@ discard block |
||
697 | 697 | return $GLOBALS['_xe_loaded_widgets_'][$widget]; |
698 | 698 | } |
699 | 699 | |
700 | - function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
|
700 | + function compileWidgetStyle($widgetStyle, $widget, $widget_content_body, $args, $javascript_mode) |
|
701 | 701 | { |
702 | - if(!$widgetStyle) return $widget_content_body; |
|
702 | + if (!$widgetStyle) return $widget_content_body; |
|
703 | 703 | |
704 | 704 | $oWidgetModel = getModel('widget'); |
705 | 705 | // Bring extra_var widget style tie |
706 | 706 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
707 | - if(!$widgetstyle_info) return $widget_content_body; |
|
707 | + if (!$widgetstyle_info) return $widget_content_body; |
|
708 | 708 | |
709 | 709 | $widgetstyle_extra_var = new stdClass(); |
710 | 710 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
711 | - if(count($widgetstyle_extra_var_key['extra_var'])) |
|
711 | + if (count($widgetstyle_extra_var_key['extra_var'])) |
|
712 | 712 | { |
713 | - foreach($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
713 | + foreach ($widgetstyle_extra_var_key['extra_var'] as $key => $val) |
|
714 | 714 | { |
715 | - $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
715 | + $widgetstyle_extra_var->{$key} = $args->{$key}; |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 | Context::set('widgetstyle_extra_var', $widgetstyle_extra_var); |
719 | 719 | // #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated |
720 | 720 | Context::set('widgetstyle_extar_var', $widgetstyle_extra_var); |
721 | 721 | |
722 | - if($javascript_mode && $widget=='widgetBox') |
|
722 | + if ($javascript_mode && $widget == 'widgetBox') |
|
723 | 723 | { |
724 | 724 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
725 | 725 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | $oWidgetModel = getModel('widget'); |
744 | 744 | $widget_info = $oWidgetModel->getWidgetInfo($widget); |
745 | 745 | |
746 | - if(!$vars) |
|
746 | + if (!$vars) |
|
747 | 747 | { |
748 | 748 | $vars = new stdClass(); |
749 | 749 | } |
@@ -754,31 +754,31 @@ discard block |
||
754 | 754 | |
755 | 755 | $vars->skin = trim($request_vars->skin); |
756 | 756 | $vars->colorset = trim($request_vars->colorset); |
757 | - $vars->widget_sequence = (int)($request_vars->widget_sequence); |
|
758 | - $vars->widget_cache = (int)($request_vars->widget_cache); |
|
757 | + $vars->widget_sequence = (int) ($request_vars->widget_sequence); |
|
758 | + $vars->widget_cache = (int) ($request_vars->widget_cache); |
|
759 | 759 | $vars->style = trim($request_vars->style); |
760 | 760 | $vars->widget_padding_left = trim($request_vars->widget_padding_left); |
761 | 761 | $vars->widget_padding_right = trim($request_vars->widget_padding_right); |
762 | 762 | $vars->widget_padding_top = trim($request_vars->widget_padding_top); |
763 | 763 | $vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom); |
764 | - $vars->document_srl= trim($request_vars->document_srl); |
|
764 | + $vars->document_srl = trim($request_vars->document_srl); |
|
765 | 765 | |
766 | - if(count($widget_info->extra_var)) |
|
766 | + if (count($widget_info->extra_var)) |
|
767 | 767 | { |
768 | - foreach($widget_info->extra_var as $key=>$val) |
|
768 | + foreach ($widget_info->extra_var as $key=>$val) |
|
769 | 769 | { |
770 | 770 | $vars->{$key} = trim($request_vars->{$key}); |
771 | 771 | } |
772 | 772 | } |
773 | 773 | // If the widget style |
774 | - if($request_vars->widgetstyle) |
|
774 | + if ($request_vars->widgetstyle) |
|
775 | 775 | { |
776 | 776 | $widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle); |
777 | - if(count($widgetStyle_info->extra_var)) |
|
777 | + if (count($widgetStyle_info->extra_var)) |
|
778 | 778 | { |
779 | - foreach($widgetStyle_info->extra_var as $key=>$val) |
|
779 | + foreach ($widgetStyle_info->extra_var as $key=>$val) |
|
780 | 780 | { |
781 | - if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea') |
|
781 | + if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea') |
|
782 | 782 | { |
783 | 783 | $vars->{$key} = trim($request_vars->{$key}); |
784 | 784 | } |
@@ -786,23 +786,23 @@ discard block |
||
786 | 786 | } |
787 | 787 | } |
788 | 788 | |
789 | - if($vars->widget_sequence) |
|
789 | + if ($vars->widget_sequence) |
|
790 | 790 | { |
791 | 791 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType()); |
792 | 792 | FileHandler::removeFile($cache_file); |
793 | 793 | } |
794 | 794 | |
795 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
795 | + if ($vars->widget_cache > 0) $vars->widget_sequence = getNextSequence(); |
|
796 | 796 | |
797 | 797 | $attribute = array(); |
798 | - foreach($vars as $key => $val) |
|
798 | + foreach ($vars as $key => $val) |
|
799 | 799 | { |
800 | - if(!$val) |
|
800 | + if (!$val) |
|
801 | 801 | { |
802 | 802 | unset($vars->{$key}); |
803 | 803 | continue; |
804 | 804 | } |
805 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
805 | + if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
806 | 806 | $vars->{$key} = Context::convertEncodingStr($val); |
807 | 807 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
808 | 808 | } |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | $colorset_list[] = $colorset; |
41 | 41 | } |
42 | 42 | |
43 | - if(count($colorset_list)) $colorsets = implode("\n", $colorset_list); |
|
43 | + if(count($colorset_list)) { |
|
44 | + $colorsets = implode("\n", $colorset_list); |
|
45 | + } |
|
44 | 46 | $this->add('colorset_list', $colorsets); |
45 | 47 | } |
46 | 48 | |
@@ -50,8 +52,12 @@ discard block |
||
50 | 52 | function procWidgetGenerateCode() |
51 | 53 | { |
52 | 54 | $widget = Context::get('selected_widget'); |
53 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
54 | - if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
55 | + if(!$widget) { |
|
56 | + return new BaseObject(-1,'msg_invalid_request'); |
|
57 | + } |
|
58 | + if(!Context::get('skin')) { |
|
59 | + return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
60 | + } |
|
55 | 61 | |
56 | 62 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
57 | 63 | |
@@ -66,9 +72,13 @@ discard block |
||
66 | 72 | function procWidgetGenerateCodeInPage() |
67 | 73 | { |
68 | 74 | $widget = Context::get('selected_widget'); |
69 | - if(!$widget) return new BaseObject(-1,'msg_invalid_request'); |
|
75 | + if(!$widget) { |
|
76 | + return new BaseObject(-1,'msg_invalid_request'); |
|
77 | + } |
|
70 | 78 | |
71 | - if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
79 | + if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) { |
|
80 | + return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null')); |
|
81 | + } |
|
72 | 82 | |
73 | 83 | $attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars); |
74 | 84 | // Wanted results |
@@ -107,15 +117,21 @@ discard block |
||
107 | 117 | $err = 0; |
108 | 118 | $oLayoutModel = getModel('layout'); |
109 | 119 | $layout_info = $oLayoutModel->getLayout($module_srl); |
110 | - if(!$layout_info || $layout_info->type != 'faceoff') $err++; |
|
120 | + if(!$layout_info || $layout_info->type != 'faceoff') { |
|
121 | + $err++; |
|
122 | + } |
|
111 | 123 | |
112 | 124 | // Destination Information Wanted page module |
113 | 125 | $oModuleModel = getModel('module'); |
114 | 126 | $columnList = array('module_srl', 'module'); |
115 | 127 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
116 | - if(!$page_info->module_srl || $page_info->module != 'page') $err++; |
|
128 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
129 | + $err++; |
|
130 | + } |
|
117 | 131 | |
118 | - if($err > 1) return new BaseObject(-1,'msg_invalid_request'); |
|
132 | + if($err > 1) { |
|
133 | + return new BaseObject(-1,'msg_invalid_request'); |
|
134 | + } |
|
119 | 135 | |
120 | 136 | // Check permissions |
121 | 137 | $logged_info = Context::get('logged_info'); |
@@ -142,15 +158,16 @@ discard block |
||
142 | 158 | if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) |
143 | 159 | { |
144 | 160 | $output = $oDocumentController->updateDocument($oDocument, $obj); |
145 | - } |
|
146 | - else |
|
161 | + } else |
|
147 | 162 | { |
148 | 163 | $output = $oDocumentController->insertDocument($obj); |
149 | 164 | $obj->document_srl = $output->get('document_srl'); |
150 | 165 | } |
151 | 166 | |
152 | 167 | // Stop when an error occurs |
153 | - if(!$output->toBool()) return $output; |
|
168 | + if(!$output->toBool()) { |
|
169 | + return $output; |
|
170 | + } |
|
154 | 171 | |
155 | 172 | // Return results |
156 | 173 | $this->add('document_srl', $obj->document_srl); |
@@ -169,14 +186,18 @@ discard block |
||
169 | 186 | $oDocumentAdminController = getAdminController('document'); |
170 | 187 | |
171 | 188 | $oDocument = $oDocumentModel->getDocument($document_srl); |
172 | - if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request'); |
|
189 | + if(!$oDocument->isExists()) { |
|
190 | + return new BaseObject(-1,'msg_invalid_request'); |
|
191 | + } |
|
173 | 192 | $module_srl = $oDocument->get('module_srl'); |
174 | 193 | |
175 | 194 | // Destination Information Wanted page module |
176 | 195 | $oModuleModel = getModel('module'); |
177 | 196 | $columnList = array('module_srl', 'module'); |
178 | 197 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
179 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
198 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
199 | + return new BaseObject(-1,'msg_invalid_request'); |
|
200 | + } |
|
180 | 201 | |
181 | 202 | // Check permissions |
182 | 203 | $logged_info = Context::get('logged_info'); |
@@ -191,7 +212,9 @@ discard block |
||
191 | 212 | } |
192 | 213 | |
193 | 214 | $output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0); |
194 | - if(!$output->toBool()) return $output; |
|
215 | + if(!$output->toBool()) { |
|
216 | + return $output; |
|
217 | + } |
|
195 | 218 | |
196 | 219 | // Return results |
197 | 220 | $copied_srls = $output->get('copied_srls'); |
@@ -210,13 +233,17 @@ discard block |
||
210 | 233 | $oDocumentController = getController('document'); |
211 | 234 | |
212 | 235 | $oDocument = $oDocumentModel->getDocument($document_srl); |
213 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
236 | + if(!$oDocument->isExists()) { |
|
237 | + return new BaseObject(); |
|
238 | + } |
|
214 | 239 | $module_srl = $oDocument->get('module_srl'); |
215 | 240 | |
216 | 241 | // Destination Information Wanted page module |
217 | 242 | $oModuleModel = getModel('module'); |
218 | 243 | $page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
219 | - if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request'); |
|
244 | + if(!$page_info->module_srl || $page_info->module != 'page') { |
|
245 | + return new BaseObject(-1,'msg_invalid_request'); |
|
246 | + } |
|
220 | 247 | |
221 | 248 | // Check permissions |
222 | 249 | $logged_info = Context::get('logged_info'); |
@@ -231,7 +258,9 @@ discard block |
||
231 | 258 | } |
232 | 259 | |
233 | 260 | $output = $oDocumentController->deleteDocument($oDocument->get('document_srl')); |
234 | - if(!$output->toBool()) return $output; |
|
261 | + if(!$output->toBool()) { |
|
262 | + return $output; |
|
263 | + } |
|
235 | 264 | } |
236 | 265 | |
237 | 266 | /** |
@@ -248,7 +277,9 @@ discard block |
||
248 | 277 | */ |
249 | 278 | function triggerWidgetCompile(&$content) |
250 | 279 | { |
251 | - if(Context::getResponseMethod()!='HTML') return new BaseObject(); |
|
280 | + if(Context::getResponseMethod()!='HTML') { |
|
281 | + return new BaseObject(); |
|
282 | + } |
|
252 | 283 | $content = $this->transWidgetCode($content, $this->layout_javascript_mode); |
253 | 284 | return new BaseObject(); |
254 | 285 | } |
@@ -281,11 +312,16 @@ discard block |
||
281 | 312 | $oXmlParser = new XmlParser(); |
282 | 313 | $xml_doc = $oXmlParser->parse(trim($buff)); |
283 | 314 | |
284 | - if($xml_doc->img) $vars = $xml_doc->img->attrs; |
|
285 | - else $vars = $xml_doc->attrs; |
|
315 | + if($xml_doc->img) { |
|
316 | + $vars = $xml_doc->img->attrs; |
|
317 | + } else { |
|
318 | + $vars = $xml_doc->attrs; |
|
319 | + } |
|
286 | 320 | |
287 | 321 | $widget = $vars->widget; |
288 | - if(!$widget) return $matches[0]; |
|
322 | + if(!$widget) { |
|
323 | + return $matches[0]; |
|
324 | + } |
|
289 | 325 | unset($vars->widget); |
290 | 326 | |
291 | 327 | return $this->execute($widget, $vars, $this->javascript_mode); |
@@ -302,7 +338,9 @@ discard block |
||
302 | 338 | |
303 | 339 | $vars = $xml_doc->div->attrs; |
304 | 340 | $widget = $vars->widget; |
305 | - if(!$widget) return $matches[0]; |
|
341 | + if(!$widget) { |
|
342 | + return $matches[0]; |
|
343 | + } |
|
306 | 344 | unset($vars->widget); |
307 | 345 | |
308 | 346 | $vars->widgetbox_content = $matches[3]; |
@@ -329,22 +367,30 @@ discard block |
||
329 | 367 | $xml_doc = $oXmlParser->parse(trim($buff)); |
330 | 368 | |
331 | 369 | $args = $xml_doc->img->attrs; |
332 | - if(!$args) continue; |
|
370 | + if(!$args) { |
|
371 | + continue; |
|
372 | + } |
|
333 | 373 | // If you are not caching path |
334 | 374 | $widget = $args->widget; |
335 | 375 | $sequence = $args->widget_sequence; |
336 | 376 | $cache = $args->widget_cache; |
337 | - if(!$sequence || !$cache) continue; |
|
377 | + if(!$sequence || !$cache) { |
|
378 | + continue; |
|
379 | + } |
|
338 | 380 | |
339 | 381 | if(count($args)) |
340 | 382 | { |
341 | - foreach($args as $k => $v) $args->{$k} = urldecode($v); |
|
383 | + foreach($args as $k => $v) { |
|
384 | + $args->{$k} = urldecode($v); |
|
385 | + } |
|
342 | 386 | } |
343 | 387 | // If the cache file for each language widget regeneration |
344 | 388 | foreach($lang_list as $lang_type => $val) |
345 | 389 | { |
346 | 390 | $cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type); |
347 | - if(!file_exists($cache_file)) continue; |
|
391 | + if(!file_exists($cache_file)) { |
|
392 | + continue; |
|
393 | + } |
|
348 | 394 | $this->getCache($widget, $args, $lang_type, true); |
349 | 395 | } |
350 | 396 | } |
@@ -356,7 +402,9 @@ discard block |
||
356 | 402 | function getCache($widget, $args, $lang_type = null, $ignore_cache = false) |
357 | 403 | { |
358 | 404 | // If the specified language specifies the current language |
359 | - if(!$lang_type) $lang_type = Context::getLangType(); |
|
405 | + if(!$lang_type) { |
|
406 | + $lang_type = Context::getLangType(); |
|
407 | + } |
|
360 | 408 | // widget, the cache number and cache values are set |
361 | 409 | $widget_sequence = $args->widget_sequence; |
362 | 410 | $widget_cache = $args->widget_cache; |
@@ -367,7 +415,9 @@ discard block |
||
367 | 415 | if(!$ignore_cache && (!$widget_cache || !$widget_sequence)) |
368 | 416 | { |
369 | 417 | $oWidget = $this->getWidgetObject($widget); |
370 | - if(!$oWidget || !method_exists($oWidget, 'proc')) return; |
|
418 | + if(!$oWidget || !method_exists($oWidget, 'proc')) { |
|
419 | + return; |
|
420 | + } |
|
371 | 421 | |
372 | 422 | $widget_content = $oWidget->proc($args); |
373 | 423 | $oModuleController = getController('module'); |
@@ -387,8 +437,7 @@ discard block |
||
387 | 437 | if($cache_body) |
388 | 438 | { |
389 | 439 | return $cache_body; |
390 | - } |
|
391 | - else |
|
440 | + } else |
|
392 | 441 | { |
393 | 442 | /** |
394 | 443 | * Cache number and cache values are set so that the cache file should call |
@@ -416,7 +465,9 @@ discard block |
||
416 | 465 | } |
417 | 466 | |
418 | 467 | $oWidget = $this->getWidgetObject($widget); |
419 | - if(!$oWidget || !method_exists($oWidget,'proc')) return; |
|
468 | + if(!$oWidget || !method_exists($oWidget,'proc')) { |
|
469 | + return; |
|
470 | + } |
|
420 | 471 | |
421 | 472 | $widget_content = $oWidget->proc($args); |
422 | 473 | $oModuleController = getController('module'); |
@@ -424,8 +475,7 @@ discard block |
||
424 | 475 | if($oCacheHandler->isSupport()) |
425 | 476 | { |
426 | 477 | $oCacheHandler->put($key, $widget_content, $widget_cache * 60); |
427 | - } |
|
428 | - else |
|
478 | + } else |
|
429 | 479 | { |
430 | 480 | FileHandler::writeFile($cache_file, $widget_content); |
431 | 481 | } |
@@ -443,7 +493,9 @@ discard block |
||
443 | 493 | function execute($widget, $args, $javascript_mode = false, $escaped = true) |
444 | 494 | { |
445 | 495 | // Save for debug run-time widget |
446 | - if(__DEBUG__==3) $start = getMicroTime(); |
|
496 | + if(__DEBUG__==3) { |
|
497 | + $start = getMicroTime(); |
|
498 | + } |
|
447 | 499 | $before = microtime(true); |
448 | 500 | // urldecode the value of args haejum |
449 | 501 | $object_vars = get_object_vars($args); |
@@ -451,8 +503,12 @@ discard block |
||
451 | 503 | { |
452 | 504 | foreach($object_vars as $key => $val) |
453 | 505 | { |
454 | - if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue; |
|
455 | - if($escaped) $args->{$key} = utf8RawUrlDecode($val); |
|
506 | + if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) { |
|
507 | + continue; |
|
508 | + } |
|
509 | + if($escaped) { |
|
510 | + $args->{$key} = utf8RawUrlDecode($val); |
|
511 | + } |
|
456 | 512 | } |
457 | 513 | } |
458 | 514 | |
@@ -463,7 +519,9 @@ discard block |
||
463 | 519 | $widget_content = ''; |
464 | 520 | if($widget != 'widgetContent' && $widget != 'widgetBox') |
465 | 521 | { |
466 | - if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return; |
|
522 | + if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) { |
|
523 | + return; |
|
524 | + } |
|
467 | 525 | // Hold the contents of the widget parameter |
468 | 526 | $widget_content = $this->getCache($widget, $args); |
469 | 527 | } |
@@ -495,7 +553,9 @@ discard block |
||
495 | 553 | // If general call is given on page styles should return immediately dreamin ' |
496 | 554 | if(!$javascript_mode) |
497 | 555 | { |
498 | - if($args->id) $args->id = ' id="'.$args->id.'" '; |
|
556 | + if($args->id) { |
|
557 | + $args->id = ' id="'.$args->id.'" '; |
|
558 | + } |
|
499 | 559 | switch($widget) |
500 | 560 | { |
501 | 561 | // If a direct orthogonal addition information |
@@ -505,8 +565,7 @@ discard block |
||
505 | 565 | $oDocumentModel = getModel('document'); |
506 | 566 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
507 | 567 | $body = $oDocument->getContent(false,false,false, false); |
508 | - } |
|
509 | - else |
|
568 | + } else |
|
510 | 569 | { |
511 | 570 | $body = base64_decode($args->body); |
512 | 571 | } |
@@ -533,8 +592,7 @@ discard block |
||
533 | 592 | break; |
534 | 593 | } |
535 | 594 | // Edit page is called when a widget if you add the code for handling |
536 | - } |
|
537 | - else |
|
595 | + } else |
|
538 | 596 | { |
539 | 597 | switch($widget) |
540 | 598 | { |
@@ -545,8 +603,7 @@ discard block |
||
545 | 603 | $oDocumentModel = getModel('document'); |
546 | 604 | $oDocument = $oDocumentModel->getDocument($args->document_srl); |
547 | 605 | $body = $oDocument->getContent(false,false,false); |
548 | - } |
|
549 | - else |
|
606 | + } else |
|
550 | 607 | { |
551 | 608 | $body = base64_decode($args->body); |
552 | 609 | } |
@@ -556,8 +613,12 @@ discard block |
||
556 | 613 | { |
557 | 614 | foreach($args as $key => $val) |
558 | 615 | { |
559 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
560 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
616 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
617 | + continue; |
|
618 | + } |
|
619 | + if(strpos($val,'|@|')>0) { |
|
620 | + $val = str_replace('|@|',',',$val); |
|
621 | + } |
|
561 | 622 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
562 | 623 | } |
563 | 624 | } |
@@ -591,9 +652,15 @@ discard block |
||
591 | 652 | { |
592 | 653 | foreach($args as $key => $val) |
593 | 654 | { |
594 | - if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue; |
|
595 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
596 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
655 | + if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) { |
|
656 | + continue; |
|
657 | + } |
|
658 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
659 | + continue; |
|
660 | + } |
|
661 | + if(strpos($val,'|@|')>0) { |
|
662 | + $val = str_replace('|@|',',',$val); |
|
663 | + } |
|
597 | 664 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
598 | 665 | } |
599 | 666 | } |
@@ -616,9 +683,15 @@ discard block |
||
616 | 683 | $allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget'); |
617 | 684 | foreach($args as $key => $val) |
618 | 685 | { |
619 | - if(in_array($key, $allowed_key)) continue; |
|
620 | - if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue; |
|
621 | - if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val); |
|
686 | + if(in_array($key, $allowed_key)) { |
|
687 | + continue; |
|
688 | + } |
|
689 | + if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) { |
|
690 | + continue; |
|
691 | + } |
|
692 | + if(strpos($val,'|@|')>0) { |
|
693 | + $val = str_replace('|@|',',',$val); |
|
694 | + } |
|
622 | 695 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
623 | 696 | } |
624 | 697 | } |
@@ -638,11 +711,15 @@ discard block |
||
638 | 711 | } |
639 | 712 | } |
640 | 713 | // Compile the widget style. |
641 | - if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
714 | + if($args->widgetstyle) { |
|
715 | + $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode); |
|
716 | + } |
|
642 | 717 | |
643 | 718 | $output = $widget_content_header . $widget_content_body . $widget_content_footer; |
644 | 719 | // Debug widget creation time information added to the results |
645 | - if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
720 | + if(__DEBUG__==3) { |
|
721 | + $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start; |
|
722 | + } |
|
646 | 723 | |
647 | 724 | $after = microtime(true); |
648 | 725 | |
@@ -675,7 +752,9 @@ discard block |
||
675 | 752 | $path = $oWidgetModel->getWidgetPath($widget); |
676 | 753 | // If you do not find the class file error output widget (html output) |
677 | 754 | $class_file = sprintf('%s%s.class.php', $path, $widget); |
678 | - if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
755 | + if(!file_exists($class_file)) { |
|
756 | + return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget); |
|
757 | + } |
|
679 | 758 | // Widget classes include |
680 | 759 | require_once($class_file); |
681 | 760 | |
@@ -686,9 +765,13 @@ discard block |
||
686 | 765 | } |
687 | 766 | |
688 | 767 | $oWidget = new $widget(); |
689 | - if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
768 | + if(!is_object($oWidget)) { |
|
769 | + return sprintf(Context::getLang('msg_widget_object_is_null'), $widget); |
|
770 | + } |
|
690 | 771 | |
691 | - if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
772 | + if(!method_exists($oWidget, 'proc')) { |
|
773 | + return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget); |
|
774 | + } |
|
692 | 775 | |
693 | 776 | $oWidget->widget_path = $path; |
694 | 777 | |
@@ -699,12 +782,16 @@ discard block |
||
699 | 782 | |
700 | 783 | function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode) |
701 | 784 | { |
702 | - if(!$widgetStyle) return $widget_content_body; |
|
785 | + if(!$widgetStyle) { |
|
786 | + return $widget_content_body; |
|
787 | + } |
|
703 | 788 | |
704 | 789 | $oWidgetModel = getModel('widget'); |
705 | 790 | // Bring extra_var widget style tie |
706 | 791 | $widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle); |
707 | - if(!$widgetstyle_info) return $widget_content_body; |
|
792 | + if(!$widgetstyle_info) { |
|
793 | + return $widget_content_body; |
|
794 | + } |
|
708 | 795 | |
709 | 796 | $widgetstyle_extra_var = new stdClass(); |
710 | 797 | $widgetstyle_extra_var_key = get_object_vars($widgetstyle_info); |
@@ -722,8 +809,7 @@ discard block |
||
722 | 809 | if($javascript_mode && $widget=='widgetBox') |
723 | 810 | { |
724 | 811 | Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>'); |
725 | - } |
|
726 | - else |
|
812 | + } else |
|
727 | 813 | { |
728 | 814 | Context::set('widget_content', $widget_content_body); |
729 | 815 | } |
@@ -792,7 +878,9 @@ discard block |
||
792 | 878 | FileHandler::removeFile($cache_file); |
793 | 879 | } |
794 | 880 | |
795 | - if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence(); |
|
881 | + if($vars->widget_cache>0) { |
|
882 | + $vars->widget_sequence = getNextSequence(); |
|
883 | + } |
|
796 | 884 | |
797 | 885 | $attribute = array(); |
798 | 886 | foreach($vars as $key => $val) |
@@ -802,7 +890,9 @@ discard block |
||
802 | 890 | unset($vars->{$key}); |
803 | 891 | continue; |
804 | 892 | } |
805 | - if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val); |
|
893 | + if(strpos($val,'|@|') > 0) { |
|
894 | + $val = str_replace('|@|', ',', $val); |
|
895 | + } |
|
806 | 896 | $vars->{$key} = Context::convertEncodingStr($val); |
807 | 897 | $attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
808 | 898 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | parent::__construct("{$file}({$line_no}):\n\t$message"); |
97 | 97 | |
98 | - $this->xml_file = $file; |
|
98 | + $this->xml_file = $file; |
|
99 | 99 | $this->xml_line_no = $line_no; |
100 | 100 | $this->xml_message = $message; |
101 | 101 | } |
@@ -133,32 +133,32 @@ discard block |
||
133 | 133 | |
134 | 134 | $libXmlErrors = libxml_get_errors(); |
135 | 135 | |
136 | - if(count($libXmlErrors)) |
|
136 | + if (count($libXmlErrors)) |
|
137 | 137 | { |
138 | - if(!$filename) |
|
138 | + if (!$filename) |
|
139 | 139 | { |
140 | 140 | $filename = $libXmlErrors[0]->file; |
141 | 141 | } |
142 | 142 | |
143 | 143 | $msg = ''; |
144 | 144 | |
145 | - foreach($libXmlErrors as $libXmlError) |
|
145 | + foreach ($libXmlErrors as $libXmlError) |
|
146 | 146 | { |
147 | 147 | $msg .= "{$libXmlError->file}({$libXmlError->line}):\n\t {$libXmlError->message}"; |
148 | 148 | } |
149 | 149 | |
150 | - if($throw_error) |
|
150 | + if ($throw_error) |
|
151 | 151 | { |
152 | 152 | throw new ErrorMessage($msg); |
153 | 153 | } |
154 | 154 | else |
155 | 155 | { |
156 | - fwrite(STDERR, $msg . "\n"); |
|
156 | + fwrite(STDERR, $msg."\n"); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | else |
160 | 160 | { |
161 | - if($throw_error) |
|
161 | + if ($throw_error) |
|
162 | 162 | { |
163 | 163 | throw new ErrorMessage('Schema validation failed.'); |
164 | 164 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | { |
180 | 180 | $children = $node->getElementsByTagName($child_tag); |
181 | 181 | |
182 | - if($children->length > 1) |
|
182 | + if ($children->length > 1) |
|
183 | 183 | { |
184 | 184 | throw |
185 | 185 | new XmlSchemaError( |
@@ -217,21 +217,21 @@ discard block |
||
217 | 217 | { |
218 | 218 | $key_values = array(); |
219 | 219 | |
220 | - foreach($node->childNodes as $child_node) |
|
220 | + foreach ($node->childNodes as $child_node) |
|
221 | 221 | { |
222 | - if($child_node->nodeType == XML_ELEMENT_NODE |
|
222 | + if ($child_node->nodeType == XML_ELEMENT_NODE |
|
223 | 223 | && |
224 | 224 | in_array($child_node->tagName, $child_tags)) |
225 | 225 | { |
226 | 226 | $key_value = NULL; |
227 | 227 | |
228 | - foreach($attr_tags as $attr_tag) |
|
228 | + foreach ($attr_tags as $attr_tag) |
|
229 | 229 | { |
230 | - if($child_node->hasAttribute($attr_tag)) |
|
230 | + if ($child_node->hasAttribute($attr_tag)) |
|
231 | 231 | { |
232 | 232 | $key_value = $child_node->getAttribute($attr_tag); |
233 | 233 | |
234 | - if(array_key_exists($key_value, $key_values)) |
|
234 | + if (array_key_exists($key_value, $key_values)) |
|
235 | 235 | { |
236 | 236 | throw |
237 | 237 | new XmlSchemaError( |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | - if(!$key_value && $key) |
|
249 | + if (!$key_value && $key) |
|
250 | 250 | { |
251 | 251 | throw |
252 | 252 | new XmlSchemaError( |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $child_node->getLineNo(), |
255 | 255 | "<{$child_node->tagName}>: at least one of the following attributes is expected: " |
256 | 256 | . |
257 | - implode(', ', $attr_tags) . '.' |
|
257 | + implode(', ', $attr_tags).'.' |
|
258 | 258 | ); |
259 | 259 | } |
260 | 260 | } |
@@ -282,19 +282,19 @@ discard block |
||
282 | 282 | $table_name = NULL; |
283 | 283 | $join_type = NULL; |
284 | 284 | |
285 | - if($table_element->hasAttribute('name')) |
|
285 | + if ($table_element->hasAttribute('name')) |
|
286 | 286 | { |
287 | 287 | $table_name = $table_element->getAttribute('name'); |
288 | 288 | } |
289 | 289 | |
290 | - if($table_element->hasAttribute('type')) |
|
290 | + if ($table_element->hasAttribute('type')) |
|
291 | 291 | { |
292 | 292 | $join_type = $table_element->getAttribute('type'); |
293 | 293 | } |
294 | 294 | |
295 | - if($table_element->getAttribute('query') == 'true') |
|
295 | + if ($table_element->getAttribute('query') == 'true') |
|
296 | 296 | { |
297 | - if($table_name !== NULL) |
|
297 | + if ($table_name !== NULL) |
|
298 | 298 | { |
299 | 299 | throw |
300 | 300 | new XmlSchemaError( |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | ); |
305 | 305 | } |
306 | 306 | |
307 | - if($join_type !== NULL) |
|
307 | + if ($join_type !== NULL) |
|
308 | 308 | { |
309 | 309 | throw |
310 | 310 | new XmlSchemaError( |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | // check contents for a select list or a table-specification |
323 | 323 | $has_query_clauses = FALSE; |
324 | 324 | |
325 | - foreach($table_element->childNodes as $query_clause) |
|
325 | + foreach ($table_element->childNodes as $query_clause) |
|
326 | 326 | { |
327 | - if($query_clause->nodeType == XML_ELEMENT_NODE |
|
327 | + if ($query_clause->nodeType == XML_ELEMENT_NODE |
|
328 | 328 | && |
329 | 329 | ( |
330 | 330 | $query_clause->tagName == 'columns' |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | } |
336 | 336 | } |
337 | 337 | |
338 | - if(!$has_query_clauses) |
|
338 | + if (!$has_query_clauses) |
|
339 | 339 | { |
340 | 340 | throw |
341 | 341 | new XmlSchemaError( |
@@ -351,17 +351,17 @@ discard block |
||
351 | 351 | { |
352 | 352 | // base table or view |
353 | 353 | |
354 | - if($join_type !== NULL) |
|
354 | + if ($join_type !== NULL) |
|
355 | 355 | { |
356 | 356 | $has_conditions_element = FALSE; |
357 | 357 | |
358 | - foreach($table_element->childNodes as $child_node) |
|
358 | + foreach ($table_element->childNodes as $child_node) |
|
359 | 359 | { |
360 | - if($child_node->nodeType == XML_ELEMENT_NODE) |
|
360 | + if ($child_node->nodeType == XML_ELEMENT_NODE) |
|
361 | 361 | { |
362 | - if($child_node->tagName == 'conditions') |
|
362 | + if ($child_node->tagName == 'conditions') |
|
363 | 363 | { |
364 | - if($has_conditions_element) |
|
364 | + if ($has_conditions_element) |
|
365 | 365 | { |
366 | 366 | throw |
367 | 367 | new XmlSchemaError( |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
390 | - if(!$has_conditions_element) |
|
390 | + if (!$has_conditions_element) |
|
391 | 391 | { |
392 | 392 | throw |
393 | 393 | new XmlSchemaError( |
@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | } |
400 | 400 | else |
401 | 401 | { |
402 | - foreach($table_element->childNodes as $child_node) |
|
402 | + foreach ($table_element->childNodes as $child_node) |
|
403 | 403 | { |
404 | - if($child_node->nodeType == XML_ELEMENT_NODE) |
|
404 | + if ($child_node->nodeType == XML_ELEMENT_NODE) |
|
405 | 405 | { |
406 | 406 | throw |
407 | 407 | new XmlSchemaError( |
@@ -429,26 +429,25 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function checkTablesClause($xml_file, $tables_element) |
431 | 431 | { |
432 | - checkUniqueKey |
|
433 | - ( |
|
432 | + checkUniqueKey( |
|
434 | 433 | $xml_file, |
435 | 434 | $tables_element, |
436 | - array('table'), // child elements to be checked |
|
437 | - array('alias', 'name'), // attributes to be checked |
|
435 | + array('table'), // child elements to be checked |
|
436 | + array('alias', 'name'), // attributes to be checked |
|
438 | 437 | TRUE // attributes are required |
439 | 438 | ); |
440 | 439 | |
441 | - foreach($tables_element->childNodes as $table) |
|
440 | + foreach ($tables_element->childNodes as $table) |
|
442 | 441 | { |
443 | - if($table->nodeType == XML_ELEMENT_NODE |
|
442 | + if ($table->nodeType == XML_ELEMENT_NODE |
|
444 | 443 | && |
445 | 444 | $table->tagName == 'table') |
446 | 445 | { |
447 | 446 | checkTableExpression($xml_file, $table); |
448 | 447 | |
449 | - if($table->getAttribute('query') == 'true') |
|
448 | + if ($table->getAttribute('query') == 'true') |
|
450 | 449 | { |
451 | - validate_select_query($xml_file, $table); // recursive call |
|
450 | + validate_select_query($xml_file, $table); // recursive call |
|
452 | 451 | } |
453 | 452 | } |
454 | 453 | } |
@@ -470,12 +469,11 @@ discard block |
||
470 | 469 | */ |
471 | 470 | function checkSelectListClause($xml_file, $columns_element) |
472 | 471 | { |
473 | - checkUniqueKey |
|
474 | - ( |
|
472 | + checkUniqueKey( |
|
475 | 473 | $xml_file, |
476 | 474 | $columns_element, |
477 | - array('column', 'query'), // child elements |
|
478 | - array('alias', 'name'), // attributes |
|
475 | + array('column', 'query'), // child elements |
|
476 | + array('alias', 'name'), // attributes |
|
479 | 477 | FALSE // ignore if no attributes present |
480 | 478 | ); |
481 | 479 | } |
@@ -491,8 +489,7 @@ discard block |
||
491 | 489 | @param $container_element |
492 | 490 | @param $child_tag |
493 | 491 | */ |
494 | -function checkVarContentsValidation |
|
495 | - ( |
|
492 | +function checkVarContentsValidation( |
|
496 | 493 | $xml_file, |
497 | 494 | $container_element, |
498 | 495 | $child_tag |
@@ -503,23 +500,22 @@ discard block |
||
503 | 500 | |
504 | 501 | static |
505 | 502 | $var_attrs = |
506 | - array |
|
507 | - ( |
|
503 | + array( |
|
508 | 504 | 'filter', 'notnull', 'minlength', |
509 | 505 | 'maxlength' |
510 | 506 | ); |
511 | 507 | |
512 | - foreach($container_element->childNodes as $child_node) |
|
508 | + foreach ($container_element->childNodes as $child_node) |
|
513 | 509 | { |
514 | - if($child_node->nodeType == XML_ELEMENT_NODE |
|
510 | + if ($child_node->nodeType == XML_ELEMENT_NODE |
|
515 | 511 | && |
516 | 512 | $child_node->tagName == $child_tag) |
517 | 513 | { |
518 | - if(!$child_node->hasAttribute($key_attr)) |
|
514 | + if (!$child_node->hasAttribute($key_attr)) |
|
519 | 515 | { |
520 | - foreach($var_attrs as $var_attr) |
|
516 | + foreach ($var_attrs as $var_attr) |
|
521 | 517 | { |
522 | - if($child_node->hasAttribute($var_attr)) |
|
518 | + if ($child_node->hasAttribute($var_attr)) |
|
523 | 519 | { |
524 | 520 | throw |
525 | 521 | new XmlSchemaError( |
@@ -551,9 +547,9 @@ discard block |
||
551 | 547 | $has_var_attribute = $condition->hasAttribute('var') || $condition->hasAttribute('default'); |
552 | 548 | $query_line_no = -1; |
553 | 549 | |
554 | - foreach($condition->childNodes as $query_node) |
|
550 | + foreach ($condition->childNodes as $query_node) |
|
555 | 551 | { |
556 | - if($query_node->nodeType == XML_ELEMENT_NODE |
|
552 | + if ($query_node->nodeType == XML_ELEMENT_NODE |
|
557 | 553 | && |
558 | 554 | $query_node->tagName == 'query') |
559 | 555 | { |
@@ -564,7 +560,7 @@ discard block |
||
564 | 560 | } |
565 | 561 | } |
566 | 562 | |
567 | - if($child_query_node && $has_var_attribute) |
|
563 | + if ($child_query_node && $has_var_attribute) |
|
568 | 564 | { |
569 | 565 | throw |
570 | 566 | new XmlSchemaError( |
@@ -574,7 +570,7 @@ discard block |
||
574 | 570 | ); |
575 | 571 | } |
576 | 572 | |
577 | - if(!($child_query_node || $has_var_attribute)) |
|
573 | + if (!($child_query_node || $has_var_attribute)) |
|
578 | 574 | { |
579 | 575 | throw |
580 | 576 | new XmlSchemaError( |
@@ -601,18 +597,18 @@ discard block |
||
601 | 597 | { |
602 | 598 | $first_child = TRUE; |
603 | 599 | |
604 | - foreach($conditions->childNodes as $child_node) |
|
600 | + foreach ($conditions->childNodes as $child_node) |
|
605 | 601 | { |
606 | - if($child_node->nodeType == XML_ELEMENT_NODE) |
|
602 | + if ($child_node->nodeType == XML_ELEMENT_NODE) |
|
607 | 603 | { |
608 | 604 | // check for 'pipe' attribute |
609 | - if($first_child) |
|
605 | + if ($first_child) |
|
610 | 606 | { |
611 | 607 | $first_child = FALSE; |
612 | 608 | } |
613 | 609 | else |
614 | 610 | { |
615 | - if(!$child_node->hasAttribute('pipe')) |
|
611 | + if (!$child_node->hasAttribute('pipe')) |
|
616 | 612 | { |
617 | 613 | throw |
618 | 614 | new XmlSchemaError( |
@@ -626,19 +622,19 @@ discard block |
||
626 | 622 | } |
627 | 623 | |
628 | 624 | // recurse in condition groups/queries |
629 | - if($child_node->tagName == 'group') |
|
625 | + if ($child_node->tagName == 'group') |
|
630 | 626 | { |
631 | 627 | checkConditionsGroup($xml_file, $child_node); |
632 | 628 | } |
633 | 629 | else |
634 | 630 | { |
635 | - if($child_node->tagName == 'query') |
|
631 | + if ($child_node->tagName == 'query') |
|
636 | 632 | { |
637 | 633 | validate_select_query($xml_file, $child_node); |
638 | 634 | } |
639 | 635 | else |
640 | 636 | { |
641 | - if($child_node->tagName == 'condition') |
|
637 | + if ($child_node->tagName == 'condition') |
|
642 | 638 | { |
643 | 639 | checkConditionElement($xml_file, $child_node); |
644 | 640 | } |
@@ -664,12 +660,11 @@ discard block |
||
664 | 660 | */ |
665 | 661 | function checkNavigationClauses($xml_file, $navigation_element) |
666 | 662 | { |
667 | - foreach(array('list_count', 'page_count', 'page') |
|
663 | + foreach (array('list_count', 'page_count', 'page') |
|
668 | 664 | as |
669 | 665 | $navigation_el) |
670 | 666 | { |
671 | - checkDuplicateDescendants |
|
672 | - ( |
|
667 | + checkDuplicateDescendants( |
|
673 | 668 | $xml_file, |
674 | 669 | $navigation_element, |
675 | 670 | $navigation_el |
@@ -693,11 +688,11 @@ discard block |
||
693 | 688 | */ |
694 | 689 | function validate_select_query($xml_file, $query_element) |
695 | 690 | { |
696 | - foreach($query_element->childNodes as $select_clause) |
|
691 | + foreach ($query_element->childNodes as $select_clause) |
|
697 | 692 | { |
698 | - if($select_clause->nodeType == XML_ELEMENT_NODE) |
|
693 | + if ($select_clause->nodeType == XML_ELEMENT_NODE) |
|
699 | 694 | { |
700 | - switch($select_clause->tagName) |
|
695 | + switch ($select_clause->tagName) |
|
701 | 696 | { |
702 | 697 | case 'columns': |
703 | 698 | checkSelectListClause($xml_file, $select_clause); |
@@ -728,11 +723,11 @@ discard block |
||
728 | 723 | */ |
729 | 724 | function validate_update_query($xml_file, $query_element) |
730 | 725 | { |
731 | - foreach($query_element->childNodes as $update_clause) |
|
726 | + foreach ($query_element->childNodes as $update_clause) |
|
732 | 727 | { |
733 | - if($update_clause->nodeType == XML_ELEMENT_NODE) |
|
728 | + if ($update_clause->nodeType == XML_ELEMENT_NODE) |
|
734 | 729 | { |
735 | - switch($update_clause->tagName) |
|
730 | + switch ($update_clause->tagName) |
|
736 | 731 | { |
737 | 732 | case 'tables': |
738 | 733 | checkTablesClause($xml_file, $update_clause); |
@@ -755,11 +750,11 @@ discard block |
||
755 | 750 | */ |
756 | 751 | function validate_delete_query($xml_file, $query_element) |
757 | 752 | { |
758 | - foreach($query_element->childNodes as $delete_clause) |
|
753 | + foreach ($query_element->childNodes as $delete_clause) |
|
759 | 754 | { |
760 | - if($delete_clause->nodeType == XML_ELEMENT_NODE) |
|
755 | + if ($delete_clause->nodeType == XML_ELEMENT_NODE) |
|
761 | 756 | { |
762 | - switch($delete_clause->tagName) |
|
757 | + switch ($delete_clause->tagName) |
|
763 | 758 | { |
764 | 759 | case 'conditions': |
765 | 760 | checkConditionsGroup($xml_file, $delete_clause); |
@@ -778,11 +773,11 @@ discard block |
||
778 | 773 | */ |
779 | 774 | function validate_insert_select_query($xml_file, $query_element) |
780 | 775 | { |
781 | - foreach($query_element->childNodes as $statement_clause) |
|
776 | + foreach ($query_element->childNodes as $statement_clause) |
|
782 | 777 | { |
783 | - if($statement_clause->nodeType == XML_ELEMENT_NODE) |
|
778 | + if ($statement_clause->nodeType == XML_ELEMENT_NODE) |
|
784 | 779 | { |
785 | - switch($statement_clause->tagName) |
|
780 | + switch ($statement_clause->tagName) |
|
786 | 781 | { |
787 | 782 | case 'query': |
788 | 783 | validate_select_query($xml_file, $statement_clause); |
@@ -793,8 +788,7 @@ discard block |
||
793 | 788 | } |
794 | 789 | |
795 | 790 | $validate_query_type = |
796 | - array |
|
797 | - ( |
|
791 | + array( |
|
798 | 792 | // 'insert' => |
799 | 793 | // there is currently nothing special to check |
800 | 794 | // for a plain insert, all the needed checks |
@@ -818,13 +812,13 @@ discard block |
||
818 | 812 | |
819 | 813 | $action = $query_element->getAttribute('action'); |
820 | 814 | |
821 | - if(array_key_exists($action, $validate_query_type)) |
|
815 | + if (array_key_exists($action, $validate_query_type)) |
|
822 | 816 | { |
823 | 817 | $validate_query_type[$action]($xml_file, $query_element); |
824 | 818 | } |
825 | 819 | } |
826 | 820 | |
827 | -if(strpos(PHP_SAPI, 'cli') !== FALSE |
|
821 | +if (strpos(PHP_SAPI, 'cli') !== FALSE |
|
828 | 822 | || |
829 | 823 | strpos(PHP_SAPI, 'cgi') !== FALSE) |
830 | 824 | { |
@@ -857,7 +851,7 @@ discard block |
||
857 | 851 | print "Failed to restore working dir {$this->dirname}."; |
858 | 852 | } |
859 | 853 | |
860 | - if(!$success) |
|
854 | + if (!$success) |
|
861 | 855 | { |
862 | 856 | print "Failed to restore working dir {$this->dirname}."; |
863 | 857 | } |
@@ -873,7 +867,7 @@ discard block |
||
873 | 867 | { |
874 | 868 | $this->dirname = getcwd(); |
875 | 869 | |
876 | - if(!$this->dirname) |
|
870 | + if (!$this->dirname) |
|
877 | 871 | { |
878 | 872 | throw new ErrorMessage("Failed to get current directory."); |
879 | 873 | } |
@@ -903,7 +897,7 @@ discard block |
||
903 | 897 | $lowercase_name = strtolower($xml_path_info['basename']); |
904 | 898 | $uppercase_name = strtoupper($xml_path_info['basename']); |
905 | 899 | |
906 | - if(strlen($lowercase_name) != $filename_len |
|
900 | + if (strlen($lowercase_name) != $filename_len |
|
907 | 901 | || |
908 | 902 | strlen($uppercase_name) != $filename_len) |
909 | 903 | { |
@@ -916,9 +910,9 @@ discard block |
||
916 | 910 | |
917 | 911 | $varing_case_filename = ''; |
918 | 912 | |
919 | - for($i = 0; $i < $filename_len; $i++) |
|
913 | + for ($i = 0; $i < $filename_len; $i++) |
|
920 | 914 | { |
921 | - if($lowercase_name[$i] != $uppercase_name[$i]) |
|
915 | + if ($lowercase_name[$i] != $uppercase_name[$i]) |
|
922 | 916 | { |
923 | 917 | $varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]"; |
924 | 918 | } |
@@ -932,13 +926,13 @@ discard block |
||
932 | 926 | |
933 | 927 | $restoreWorkDir = new RestoreWorkDir(); |
934 | 928 | |
935 | - if($glob_pattern) |
|
929 | + if ($glob_pattern) |
|
936 | 930 | { |
937 | 931 | // change current dir to the xml file directory to keep |
938 | 932 | // glob pattern shorter (maximum 260 chars). |
939 | 933 | $success = chdir($glob_pattern); |
940 | 934 | |
941 | - if(!$success) |
|
935 | + if (!$success) |
|
942 | 936 | { |
943 | 937 | throw new ErrorMessage("Failed to change work dir to {$glob_pattern}."); |
944 | 938 | } |
@@ -950,14 +944,14 @@ discard block |
||
950 | 944 | // realpath() would have the same effect, but it is not documented as such |
951 | 945 | $matched_files = glob($glob_pattern, GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR); |
952 | 946 | |
953 | - unset($RestoreWorkDir); // restore work dir after call to glob() |
|
947 | + unset($RestoreWorkDir); // restore work dir after call to glob() |
|
954 | 948 | |
955 | - if($matched_files === FALSE || !is_array($matched_files)) |
|
949 | + if ($matched_files === FALSE || !is_array($matched_files)) |
|
956 | 950 | { |
957 | 951 | throw new ErrorMessage("Directory listing for $xml_file failed."); |
958 | 952 | } |
959 | 953 | |
960 | - switch(count($matched_files)) |
|
954 | + switch (count($matched_files)) |
|
961 | 955 | { |
962 | 956 | case 0: |
963 | 957 | throw new ErrorMessage("Directory listing for $xml_file failed."); |
@@ -968,9 +962,9 @@ discard block |
||
968 | 962 | default: |
969 | 963 | // more than one files with the same name and different case |
970 | 964 | // case-sensitive file system |
971 | - foreach($mached_files as $matched_file) |
|
965 | + foreach ($mached_files as $matched_file) |
|
972 | 966 | { |
973 | - if(pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename']) |
|
967 | + if (pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename']) |
|
974 | 968 | { |
975 | 969 | return ($xml_path_info['filename'] == $query_id); |
976 | 970 | } |
@@ -979,7 +973,7 @@ discard block |
||
979 | 973 | |
980 | 974 | } |
981 | 975 | |
982 | - throw new ErrorMessage("Internal application error."); // unreachable |
|
976 | + throw new ErrorMessage("Internal application error."); // unreachable |
|
983 | 977 | } |
984 | 978 | |
985 | 979 | /** |
@@ -1000,9 +994,9 @@ discard block |
||
1000 | 994 | */ |
1001 | 995 | function validate_schema_doc($xml_file, $table_element) |
1002 | 996 | { |
1003 | - foreach($table_element->childNodes as $col_node) |
|
997 | + foreach ($table_element->childNodes as $col_node) |
|
1004 | 998 | { |
1005 | - if($col_node->nodeType == XML_ELEMENT_NODE |
|
999 | + if ($col_node->nodeType == XML_ELEMENT_NODE |
|
1006 | 1000 | && |
1007 | 1001 | $col_node->tagName == 'column') |
1008 | 1002 | { |
@@ -1010,12 +1004,11 @@ discard block |
||
1010 | 1004 | $col_size = NULL; |
1011 | 1005 | |
1012 | 1006 | // check auto-increment column |
1013 | - if($col_node->hasAttribute('auto_increment')) |
|
1007 | + if ($col_node->hasAttribute('auto_increment')) |
|
1014 | 1008 | { |
1015 | - fwrite |
|
1016 | - ( |
|
1009 | + fwrite( |
|
1017 | 1010 | fopen('php://stdout', 'wt'), |
1018 | - $xml_file . '(' . $col_node->getLineNo() . ")\n\t" |
|
1011 | + $xml_file.'('.$col_node->getLineNo().")\n\t" |
|
1019 | 1012 | . |
1020 | 1013 | "<column>: attribute 'auto_increment' is currently supported only by SQL Server and mysql backends.\n" |
1021 | 1014 | ); |
@@ -1023,7 +1016,7 @@ discard block |
||
1023 | 1016 | static |
1024 | 1017 | $autoinc_types = array('number', 'bignumber'); |
1025 | 1018 | |
1026 | - if(!in_array($col_type, $autoinc_types)) |
|
1019 | + if (!in_array($col_type, $autoinc_types)) |
|
1027 | 1020 | { |
1028 | 1021 | throw |
1029 | 1022 | new XmlSchemaError( |
@@ -1031,30 +1024,29 @@ discard block |
||
1031 | 1024 | $col_node->getLineNo(), |
1032 | 1025 | "<column>: attribute 'auto_increment' only expected for one of the following types: " |
1033 | 1026 | . |
1034 | - implode(', ', $autoinc_types) . '.' |
|
1027 | + implode(', ', $autoinc_types).'.' |
|
1035 | 1028 | ); |
1036 | 1029 | } |
1037 | 1030 | } |
1038 | 1031 | |
1039 | 1032 | // check tinytext |
1040 | - if($col_type == 'tinytext') |
|
1033 | + if ($col_type == 'tinytext') |
|
1041 | 1034 | { |
1042 | - fwrite |
|
1043 | - ( |
|
1035 | + fwrite( |
|
1044 | 1036 | fopen('php://stdout', 'wt'), |
1045 | - $xml_file . '(' . $col_node->getLineNo() . ")\n\t" |
|
1037 | + $xml_file.'('.$col_node->getLineNo().")\n\t" |
|
1046 | 1038 | . |
1047 | 1039 | "<column>: type \"tinytext\" is supported only by CUBRID.\n" |
1048 | 1040 | ); |
1049 | 1041 | } |
1050 | 1042 | |
1051 | 1043 | // check size attribute |
1052 | - if($col_node->hasAttribute('size')) |
|
1044 | + if ($col_node->hasAttribute('size')) |
|
1053 | 1045 | { |
1054 | 1046 | $col_size = $col_node->getAttribute('size'); |
1055 | 1047 | } |
1056 | 1048 | |
1057 | - if($col_type == 'varchar' && $col_size === NULL) |
|
1049 | + if ($col_type == 'varchar' && $col_size === NULL) |
|
1058 | 1050 | { |
1059 | 1051 | throw |
1060 | 1052 | new XmlSchemaError( |
@@ -1068,7 +1060,7 @@ discard block |
||
1068 | 1060 | $varsize_types = array('char', 'varchar', 'float'); |
1069 | 1061 | |
1070 | 1062 | |
1071 | - if($col_size !== NULL && !in_array($col_type, $varsize_types)) |
|
1063 | + if ($col_size !== NULL && !in_array($col_type, $varsize_types)) |
|
1072 | 1064 | { |
1073 | 1065 | throw |
1074 | 1066 | new XmlSchemaError( |
@@ -1076,7 +1068,7 @@ discard block |
||
1076 | 1068 | $col_node->getLineNo(), |
1077 | 1069 | "<column>: 'size' attribute only expected for the following types: " |
1078 | 1070 | . |
1079 | - implode(', ', $varsize_types) . "." |
|
1071 | + implode(', ', $varsize_types)."." |
|
1080 | 1072 | ); |
1081 | 1073 | } |
1082 | 1074 | } |
@@ -1102,8 +1094,8 @@ discard block |
||
1102 | 1094 | const RETCODE_GENERIC_XML_SYNTAX = 50; |
1103 | 1095 | const RETCODE_QUERY_ELEMENT = 40; |
1104 | 1096 | const RETCODE_XSD_VALIDATION = 30; |
1105 | - const RETCODE_BUILTIN_CHECKS = 20; |
|
1106 | - const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented. |
|
1097 | + const RETCODE_BUILTIN_CHECKS = 20; |
|
1098 | + const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented. |
|
1107 | 1099 | const RETCODE_SUCCESS = 0; |
1108 | 1100 | |
1109 | 1101 | |
@@ -1116,13 +1108,13 @@ discard block |
||
1116 | 1108 | */ |
1117 | 1109 | public function code($val = -1) |
1118 | 1110 | { |
1119 | - if($val == -1) |
|
1111 | + if ($val == -1) |
|
1120 | 1112 | { |
1121 | 1113 | return $this->exit_code; |
1122 | 1114 | } |
1123 | 1115 | else |
1124 | 1116 | { |
1125 | - if($this->exit_code < $val) |
|
1117 | + if ($this->exit_code < $val) |
|
1126 | 1118 | { |
1127 | 1119 | $this->exit_code = $val; |
1128 | 1120 | } |
@@ -1184,7 +1176,7 @@ discard block |
||
1184 | 1176 | */ |
1185 | 1177 | public function __destruct() |
1186 | 1178 | { |
1187 | - if($this->file_name) |
|
1179 | + if ($this->file_name) |
|
1188 | 1180 | { |
1189 | 1181 | unlink($this->file_name); |
1190 | 1182 | $this->file_name = NULL; |
@@ -1214,12 +1206,12 @@ discard block |
||
1214 | 1206 | $cmdname = CMD_NAME; |
1215 | 1207 | |
1216 | 1208 | // php manual says resources should not normally be declared constant |
1217 | - if(!defined('STDERR')) |
|
1209 | + if (!defined('STDERR')) |
|
1218 | 1210 | { |
1219 | 1211 | define('STDERR', fopen('php://stderr', 'wt')); |
1220 | 1212 | } |
1221 | 1213 | |
1222 | - if(!defined('__DIR__')) |
|
1214 | + if (!defined('__DIR__')) |
|
1223 | 1215 | { |
1224 | 1216 | define('__DIR__', dirname(__FILE__)); |
1225 | 1217 | } |
@@ -1234,7 +1226,7 @@ discard block |
||
1234 | 1226 | $query_args = NULL; |
1235 | 1227 | $query_args_file = NULL; |
1236 | 1228 | |
1237 | - while($argc >= 2 && $argv[1][0] == '-') |
|
1229 | + while ($argc >= 2 && $argv[1][0] == '-') |
|
1238 | 1230 | { |
1239 | 1231 | $option = $argv[1]; |
1240 | 1232 | |
@@ -1242,17 +1234,17 @@ discard block |
||
1242 | 1234 | $argv = array_values($argv); |
1243 | 1235 | $argc = count($argv); |
1244 | 1236 | |
1245 | - switch($option) |
|
1237 | + switch ($option) |
|
1246 | 1238 | { |
1247 | 1239 | case '-s': |
1248 | 1240 | case '--schema': |
1249 | 1241 | case '--schema-language': |
1250 | - if($query_args !== NULL) |
|
1242 | + if ($query_args !== NULL) |
|
1251 | 1243 | { |
1252 | 1244 | throw new SyntaxError("Both --args-string and --schema-language options given."); |
1253 | 1245 | } |
1254 | 1246 | |
1255 | - if($query_args_file !== NULL) |
|
1247 | + if ($query_args_file !== NULL) |
|
1256 | 1248 | { |
1257 | 1249 | throw new SyntaxError("Both --args-file and --schema-language options given."); |
1258 | 1250 | } |
@@ -1272,7 +1264,7 @@ discard block |
||
1272 | 1264 | |
1273 | 1265 | case '--xe-path': |
1274 | 1266 | case '--xe': |
1275 | - if($argc < 2) |
|
1267 | + if ($argc < 2) |
|
1276 | 1268 | { |
1277 | 1269 | throw |
1278 | 1270 | new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`"); |
@@ -1290,17 +1282,17 @@ discard block |
||
1290 | 1282 | case '--args-string': |
1291 | 1283 | case '--arguments': |
1292 | 1284 | case '--args': |
1293 | - if($schema_language !== NULL) |
|
1285 | + if ($schema_language !== NULL) |
|
1294 | 1286 | { |
1295 | 1287 | throw new SyntaxError("Both --schema-language and --args-string options given."); |
1296 | 1288 | } |
1297 | 1289 | |
1298 | - if($query_args_file !== NULL) |
|
1290 | + if ($query_args_file !== NULL) |
|
1299 | 1291 | { |
1300 | 1292 | throw new SyntaxError("Both --args-string and --args-file options given."); |
1301 | 1293 | } |
1302 | 1294 | |
1303 | - if($argc < 2) |
|
1295 | + if ($argc < 2) |
|
1304 | 1296 | { |
1305 | 1297 | throw |
1306 | 1298 | new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`"); |
@@ -1316,17 +1308,17 @@ discard block |
||
1316 | 1308 | |
1317 | 1309 | case '--arguments-file': |
1318 | 1310 | case '--args-file': |
1319 | - if($schema_language !== NULL) |
|
1311 | + if ($schema_language !== NULL) |
|
1320 | 1312 | { |
1321 | 1313 | throw new SyntaxError("Both --schema-language and --args-file options given."); |
1322 | 1314 | } |
1323 | 1315 | |
1324 | - if($query_args !== NULL) |
|
1316 | + if ($query_args !== NULL) |
|
1325 | 1317 | { |
1326 | 1318 | throw new SyntaxError("Both --args-string and --args-file options given."); |
1327 | 1319 | } |
1328 | 1320 | |
1329 | - if($argc < 2) |
|
1321 | + if ($argc < 2) |
|
1330 | 1322 | { |
1331 | 1323 | throw |
1332 | 1324 | new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`"); |
@@ -1357,7 +1349,7 @@ discard block |
||
1357 | 1349 | } |
1358 | 1350 | } |
1359 | 1351 | |
1360 | - if($argc < 2 || |
|
1352 | + if ($argc < 2 || |
|
1361 | 1353 | ( |
1362 | 1354 | $argc == 2 |
1363 | 1355 | && |
@@ -1366,48 +1358,48 @@ discard block |
||
1366 | 1358 | { |
1367 | 1359 | throw |
1368 | 1360 | new SyntaxError( |
1369 | - "Validates an XML document against a given schema definition (XSD), using the standard php library.\n" . |
|
1370 | - "Syntax:\n" . |
|
1371 | - " {$cmdname} schema.xsd document.xml...\n" . |
|
1372 | - " {$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n" . |
|
1373 | - "Where:\n" . |
|
1374 | - " --schema-language\n" . |
|
1375 | - " --schema\n" . |
|
1376 | - " -s\n" . |
|
1377 | - " If given, the document(s) are validated against XE XML Schema Language,\n" . |
|
1378 | - " otherwise document(s) are validated against XE XML Query Language.\n" . |
|
1379 | - "\n" . |
|
1380 | - " --skip-query-id\n" . |
|
1381 | - " Do not check the query id, which should normally match the file name.\n" . |
|
1382 | - "\n" . |
|
1383 | - " --xe-path\n" . |
|
1384 | - " --xe\n" . |
|
1385 | - " Path to XE installation. Used to load the database-specific parsers to generate\n" . |
|
1386 | - " SQL from the XML language files.\n" . |
|
1387 | - "\n" . |
|
1388 | - " --validate-only\n" . |
|
1389 | - " Only check XML schemas, no SQL generated with the database-specific parsers.\n" . |
|
1390 | - "\n" . |
|
1391 | - " --args-string \" 'name' => 'val..', 'name' => 'val...' \"\n" . |
|
1392 | - " --args-file args/file/name.php\n" . |
|
1393 | - " Variables and values for the query, if it has any (only for XML Query Language).\n" . |
|
1394 | - " Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n" . |
|
1395 | - " array constructor. The validator script will directly eval()/include() this content.\n" . |
|
1396 | - " The file named with --args-file should include an array() constructor around the\n" . |
|
1397 | - " name-value list, and should immediately return it, without a named array variable.\n" . |
|
1398 | - " E.g.:\n" . |
|
1399 | - " return \n" . |
|
1400 | - " array\n" . |
|
1401 | - " (\n" . |
|
1402 | - " 'name' => 'val',\n" . |
|
1403 | - " 'name' => 'val',\n" . |
|
1404 | - " ...\n" . |
|
1405 | - " );\n" . |
|
1406 | - "\n" . |
|
1407 | - " schema.xsd if given, is the file name for the schema definition to validate the\n" . |
|
1408 | - " document against\n" . |
|
1409 | - "\n" . |
|
1410 | - " document.xml is the file name for the XML document to be validated against the schema.\n" . |
|
1361 | + "Validates an XML document against a given schema definition (XSD), using the standard php library.\n". |
|
1362 | + "Syntax:\n". |
|
1363 | + " {$cmdname} schema.xsd document.xml...\n". |
|
1364 | + " {$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n". |
|
1365 | + "Where:\n". |
|
1366 | + " --schema-language\n". |
|
1367 | + " --schema\n". |
|
1368 | + " -s\n". |
|
1369 | + " If given, the document(s) are validated against XE XML Schema Language,\n". |
|
1370 | + " otherwise document(s) are validated against XE XML Query Language.\n". |
|
1371 | + "\n". |
|
1372 | + " --skip-query-id\n". |
|
1373 | + " Do not check the query id, which should normally match the file name.\n". |
|
1374 | + "\n". |
|
1375 | + " --xe-path\n". |
|
1376 | + " --xe\n". |
|
1377 | + " Path to XE installation. Used to load the database-specific parsers to generate\n". |
|
1378 | + " SQL from the XML language files.\n". |
|
1379 | + "\n". |
|
1380 | + " --validate-only\n". |
|
1381 | + " Only check XML schemas, no SQL generated with the database-specific parsers.\n". |
|
1382 | + "\n". |
|
1383 | + " --args-string \" 'name' => 'val..', 'name' => 'val...' \"\n". |
|
1384 | + " --args-file args/file/name.php\n". |
|
1385 | + " Variables and values for the query, if it has any (only for XML Query Language).\n". |
|
1386 | + " Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n". |
|
1387 | + " array constructor. The validator script will directly eval()/include() this content.\n". |
|
1388 | + " The file named with --args-file should include an array() constructor around the\n". |
|
1389 | + " name-value list, and should immediately return it, without a named array variable.\n". |
|
1390 | + " E.g.:\n". |
|
1391 | + " return \n". |
|
1392 | + " array\n". |
|
1393 | + " (\n". |
|
1394 | + " 'name' => 'val',\n". |
|
1395 | + " 'name' => 'val',\n". |
|
1396 | + " ...\n". |
|
1397 | + " );\n". |
|
1398 | + "\n". |
|
1399 | + " schema.xsd if given, is the file name for the schema definition to validate the\n". |
|
1400 | + " document against\n". |
|
1401 | + "\n". |
|
1402 | + " document.xml is the file name for the XML document to be validated against the schema.\n". |
|
1411 | 1403 | " Multiple .xml files can be given.\n" |
1412 | 1404 | ); |
1413 | 1405 | } |
@@ -1415,23 +1407,23 @@ discard block |
||
1415 | 1407 | $query_user_args = array(); |
1416 | 1408 | |
1417 | 1409 | // check $xe_path, $query_args |
1418 | - if(!$validate_only) |
|
1410 | + if (!$validate_only) |
|
1419 | 1411 | { |
1420 | - if($xe_path == NULL) |
|
1412 | + if ($xe_path == NULL) |
|
1421 | 1413 | { |
1422 | 1414 | // assume validator.php is in directory .../xe/tools/dbxml_validator/ in an XE installation |
1423 | 1415 | $xe_path = dirname(dirname(realpath(__DIR__))); |
1424 | 1416 | } |
1425 | 1417 | |
1426 | - if(!file_exists($xe_path . '/index.php')) |
|
1418 | + if (!file_exists($xe_path.'/index.php')) |
|
1427 | 1419 | { |
1428 | 1420 | throw |
1429 | 1421 | new ErrorMessage("File index.php not found in {$xe_path}."); |
1430 | 1422 | } |
1431 | 1423 | |
1432 | - if(!defined('_XE_PATH_')) |
|
1424 | + if (!defined('_XE_PATH_')) |
|
1433 | 1425 | { |
1434 | - define('_XE_PATH_', $xe_path . '/'); |
|
1426 | + define('_XE_PATH_', $xe_path.'/'); |
|
1435 | 1427 | } |
1436 | 1428 | |
1437 | 1429 | /** |
@@ -1485,7 +1477,7 @@ discard block |
||
1485 | 1477 | */ |
1486 | 1478 | public static function getDBType() |
1487 | 1479 | { |
1488 | - if(self::$db_info) |
|
1480 | + if (self::$db_info) |
|
1489 | 1481 | { |
1490 | 1482 | return self::$db_info->master_db['db_type']; |
1491 | 1483 | } |
@@ -1538,10 +1530,9 @@ discard block |
||
1538 | 1530 | */ |
1539 | 1531 | public static function setNoDBInfo() |
1540 | 1532 | { |
1541 | - $db_info = (object)NULL; |
|
1533 | + $db_info = (object) NULL; |
|
1542 | 1534 | $db_info->master_db = |
1543 | - array |
|
1544 | - ( |
|
1535 | + array( |
|
1545 | 1536 | 'db_type' => NULL, |
1546 | 1537 | 'db_hostname' => NULL, |
1547 | 1538 | 'db_port' => NULL, |
@@ -1565,10 +1556,9 @@ discard block |
||
1565 | 1556 | */ |
1566 | 1557 | public static function setMysqlDBInfo() |
1567 | 1558 | { |
1568 | - $db_info = (object)NULL; |
|
1559 | + $db_info = (object) NULL; |
|
1569 | 1560 | $db_info->master_db = |
1570 | - array |
|
1571 | - ( |
|
1561 | + array( |
|
1572 | 1562 | 'db_type' => 'mysql', |
1573 | 1563 | 'db_hostname' => NULL, |
1574 | 1564 | 'db_port' => NULL, |
@@ -1584,7 +1574,7 @@ discard block |
||
1584 | 1574 | |
1585 | 1575 | self::setDBInfo($db_info); |
1586 | 1576 | |
1587 | - if(array_key_exists('__DB__', $GLOBALS) |
|
1577 | + if (array_key_exists('__DB__', $GLOBALS) |
|
1588 | 1578 | && |
1589 | 1579 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1590 | 1580 | { |
@@ -1607,10 +1597,9 @@ discard block |
||
1607 | 1597 | */ |
1608 | 1598 | public static function setMysqliDBInfo() |
1609 | 1599 | { |
1610 | - $db_info = (object)NULL; |
|
1600 | + $db_info = (object) NULL; |
|
1611 | 1601 | $db_info->master_db = |
1612 | - array |
|
1613 | - ( |
|
1602 | + array( |
|
1614 | 1603 | 'db_type' => 'mysqli', |
1615 | 1604 | 'db_hostname' => NULL, |
1616 | 1605 | 'db_port' => NULL, |
@@ -1626,7 +1615,7 @@ discard block |
||
1626 | 1615 | |
1627 | 1616 | self::setDBInfo($db_info); |
1628 | 1617 | |
1629 | - if(array_key_exists('__DB__', $GLOBALS) |
|
1618 | + if (array_key_exists('__DB__', $GLOBALS) |
|
1630 | 1619 | && |
1631 | 1620 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1632 | 1621 | { |
@@ -1649,10 +1638,9 @@ discard block |
||
1649 | 1638 | */ |
1650 | 1639 | public static function setCubridDBInfo() |
1651 | 1640 | { |
1652 | - $db_info = (object)NULL; |
|
1641 | + $db_info = (object) NULL; |
|
1653 | 1642 | $db_info->master_db = |
1654 | - array |
|
1655 | - ( |
|
1643 | + array( |
|
1656 | 1644 | 'db_type' => 'cubrid', |
1657 | 1645 | 'db_hostname' => NULL, |
1658 | 1646 | 'db_port' => NULL, |
@@ -1668,7 +1656,7 @@ discard block |
||
1668 | 1656 | |
1669 | 1657 | self::setDBInfo($db_info); |
1670 | 1658 | |
1671 | - if(array_key_exists('__DB__', $GLOBALS) |
|
1659 | + if (array_key_exists('__DB__', $GLOBALS) |
|
1672 | 1660 | && |
1673 | 1661 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1674 | 1662 | { |
@@ -1691,10 +1679,9 @@ discard block |
||
1691 | 1679 | */ |
1692 | 1680 | public static function setMssqlDBInfo() |
1693 | 1681 | { |
1694 | - $db_info = (object)NULL; |
|
1682 | + $db_info = (object) NULL; |
|
1695 | 1683 | $db_info->master_db = |
1696 | - array |
|
1697 | - ( |
|
1684 | + array( |
|
1698 | 1685 | 'db_type' => 'mssql', |
1699 | 1686 | 'db_hostname' => NULL, |
1700 | 1687 | 'db_port' => NULL, |
@@ -1710,7 +1697,7 @@ discard block |
||
1710 | 1697 | |
1711 | 1698 | self::setDBInfo($db_info); |
1712 | 1699 | |
1713 | - if(array_key_exists('__DB__', $GLOBALS) |
|
1700 | + if (array_key_exists('__DB__', $GLOBALS) |
|
1714 | 1701 | && |
1715 | 1702 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1716 | 1703 | { |
@@ -1765,49 +1752,49 @@ discard block |
||
1765 | 1752 | } |
1766 | 1753 | |
1767 | 1754 | global $lang; |
1768 | - $lang = new Any_prop_obj_base(); // to return NULL on non-existent properties |
|
1755 | + $lang = new Any_prop_obj_base(); // to return NULL on non-existent properties |
|
1769 | 1756 | $lang->filter = New LangArgFilterErrorMessage(); |
1770 | 1757 | |
1771 | - if(!defined('__XE__')) |
|
1758 | + if (!defined('__XE__')) |
|
1772 | 1759 | { |
1773 | 1760 | define('__XE__', TRUE); |
1774 | 1761 | } |
1775 | 1762 | |
1776 | - if(!defined('__ZBXE__')) |
|
1763 | + if (!defined('__ZBXE__')) |
|
1777 | 1764 | { |
1778 | 1765 | define('__ZBXE__', TRUE); |
1779 | 1766 | } |
1780 | 1767 | |
1781 | - if(!defined('__DEBUG__')) |
|
1768 | + if (!defined('__DEBUG__')) |
|
1782 | 1769 | { |
1783 | 1770 | define('__DEBUG__', 0); |
1784 | 1771 | } |
1785 | 1772 | |
1786 | - if(!defined('__DEBUG_QUERY__')) |
|
1773 | + if (!defined('__DEBUG_QUERY__')) |
|
1787 | 1774 | { |
1788 | 1775 | define('__DEBUG_QUERY__', 0); |
1789 | 1776 | } |
1790 | 1777 | |
1791 | - include(_XE_PATH_ . 'classes/object/BaseObject.class.php'); |
|
1792 | - include(_XE_PATH_ . 'classes/handler/Handler.class.php'); |
|
1793 | - include(_XE_PATH_ . 'classes/file/FileHandler.class.php'); |
|
1794 | - include(_XE_PATH_ . 'classes/page/PageHandler.class.php'); |
|
1778 | + include(_XE_PATH_.'classes/object/BaseObject.class.php'); |
|
1779 | + include(_XE_PATH_.'classes/handler/Handler.class.php'); |
|
1780 | + include(_XE_PATH_.'classes/file/FileHandler.class.php'); |
|
1781 | + include(_XE_PATH_.'classes/page/PageHandler.class.php'); |
|
1795 | 1782 | |
1796 | 1783 | Context::setNoDBInfo(); |
1797 | 1784 | |
1798 | - require_once(_XE_PATH_ . 'classes/db/DB.class.php'); |
|
1799 | - require_once(_XE_PATH_ . 'classes/db/DBMysql.class.php'); |
|
1800 | - require_once(_XE_PATH_ . 'classes/db/DBMysqli.class.php'); |
|
1801 | - require_once(_XE_PATH_ . 'classes/db/DBMysql_innodb.class.php'); |
|
1802 | - require_once(_XE_PATH_ . 'classes/db/DBCubrid.class.php'); |
|
1803 | - require_once(_XE_PATH_ . 'classes/db/DBMssql.class.php'); |
|
1804 | - require_once(_XE_PATH_ . 'classes/xml/XmlParser.class.php'); |
|
1805 | - require_once(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php'); |
|
1785 | + require_once(_XE_PATH_.'classes/db/DB.class.php'); |
|
1786 | + require_once(_XE_PATH_.'classes/db/DBMysql.class.php'); |
|
1787 | + require_once(_XE_PATH_.'classes/db/DBMysqli.class.php'); |
|
1788 | + require_once(_XE_PATH_.'classes/db/DBMysql_innodb.class.php'); |
|
1789 | + require_once(_XE_PATH_.'classes/db/DBCubrid.class.php'); |
|
1790 | + require_once(_XE_PATH_.'classes/db/DBMssql.class.php'); |
|
1791 | + require_once(_XE_PATH_.'classes/xml/XmlParser.class.php'); |
|
1792 | + require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php'); |
|
1806 | 1793 | |
1807 | - require_once(__DIR__ . '/connect_wrapper.php'); |
|
1794 | + require_once(__DIR__.'/connect_wrapper.php'); |
|
1808 | 1795 | |
1809 | 1796 | // check $query_args, $query_args_file |
1810 | - if($query_args_file) |
|
1797 | + if ($query_args_file) |
|
1811 | 1798 | { |
1812 | 1799 | try |
1813 | 1800 | { |
@@ -1821,11 +1808,11 @@ discard block |
||
1821 | 1808 | } |
1822 | 1809 | else |
1823 | 1810 | { |
1824 | - if($query_args) |
|
1811 | + if ($query_args) |
|
1825 | 1812 | { |
1826 | 1813 | try |
1827 | 1814 | { |
1828 | - eval('$query_user_args = array(' . $query_args . ');'); |
|
1815 | + eval('$query_user_args = array('.$query_args.');'); |
|
1829 | 1816 | } |
1830 | 1817 | catch (Exception $exc) |
1831 | 1818 | { |
@@ -1841,26 +1828,25 @@ discard block |
||
1841 | 1828 | |
1842 | 1829 | $schema_file = NULL; |
1843 | 1830 | $schemas_set = |
1844 | - array |
|
1845 | - ( |
|
1846 | - 'delete' => __DIR__ . '/xml_delete.xsd', |
|
1847 | - 'update' => __DIR__ . '/xml_update.xsd', |
|
1848 | - 'select' => __DIR__ . '/xml_select.xsd', |
|
1849 | - 'insert' => __DIR__ . '/xml_insert.xsd', |
|
1850 | - 'insert-select' => __DIR__ . '/xml_insert_select.xsd' |
|
1831 | + array( |
|
1832 | + 'delete' => __DIR__.'/xml_delete.xsd', |
|
1833 | + 'update' => __DIR__.'/xml_update.xsd', |
|
1834 | + 'select' => __DIR__.'/xml_select.xsd', |
|
1835 | + 'insert' => __DIR__.'/xml_insert.xsd', |
|
1836 | + 'insert-select' => __DIR__.'/xml_insert_select.xsd' |
|
1851 | 1837 | ); |
1852 | - $table_schema = __DIR__ . '/xml_create_table.xsd'; |
|
1838 | + $table_schema = __DIR__.'/xml_create_table.xsd'; |
|
1853 | 1839 | |
1854 | 1840 | $domDocument = new DOMDocument(); |
1855 | 1841 | |
1856 | 1842 | $i = 1; |
1857 | 1843 | |
1858 | - if(pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd') |
|
1844 | + if (pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd') |
|
1859 | 1845 | { |
1860 | 1846 | $schema_file = $argv[$i++]; |
1861 | 1847 | } |
1862 | 1848 | |
1863 | - for(; $i < count($argv); $i++) |
|
1849 | + for (; $i < count($argv); $i++) |
|
1864 | 1850 | { |
1865 | 1851 | try |
1866 | 1852 | { |
@@ -1869,7 +1855,7 @@ discard block |
||
1869 | 1855 | $use_schema_language = $schema_language; |
1870 | 1856 | |
1871 | 1857 | $retcode->push(ReturnCode::RETCODE_GENERIC_XML_SYNTAX); |
1872 | - if($domDocument->load($argv[$i])) |
|
1858 | + if ($domDocument->load($argv[$i])) |
|
1873 | 1859 | { |
1874 | 1860 | $retcode->pop(); |
1875 | 1861 | |
@@ -1883,7 +1869,7 @@ discard block |
||
1883 | 1869 | } |
1884 | 1870 | } |
1885 | 1871 | |
1886 | - if(!$schema_file && !$use_schema_language |
|
1872 | + if (!$schema_file && !$use_schema_language |
|
1887 | 1873 | && |
1888 | 1874 | ( |
1889 | 1875 | $queryElement->tagName != 'query' |
@@ -1895,15 +1881,15 @@ discard block |
||
1895 | 1881 | |
1896 | 1882 | throw |
1897 | 1883 | new ErrorMessage( |
1898 | - "{$argv[$i]}:" . |
|
1899 | - " Root element should be <query> and should have an action attribute of:" . |
|
1900 | - " insert, insert-select, select, update or delete." . |
|
1901 | - " Otherwise an explicit schema, to validate the document with, should be" . |
|
1884 | + "{$argv[$i]}:". |
|
1885 | + " Root element should be <query> and should have an action attribute of:". |
|
1886 | + " insert, insert-select, select, update or delete.". |
|
1887 | + " Otherwise an explicit schema, to validate the document with, should be". |
|
1902 | 1888 | " specified as first argument on the command line." |
1903 | 1889 | ); |
1904 | 1890 | } |
1905 | 1891 | |
1906 | - if(!$schema_file && !$use_schema_language && !$skip_query_id |
|
1892 | + if (!$schema_file && !$use_schema_language && !$skip_query_id |
|
1907 | 1893 | && |
1908 | 1894 | !validate_query_id($argv[$i], $queryElement->getAttribute('id'))) |
1909 | 1895 | { |
@@ -1912,28 +1898,28 @@ discard block |
||
1912 | 1898 | |
1913 | 1899 | throw |
1914 | 1900 | new ErrorMessage( |
1915 | - "{$argv[$i]}(" . $queryElement->getLineNo() . "):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name." |
|
1901 | + "{$argv[$i]}(".$queryElement->getLineNo()."):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name." |
|
1916 | 1902 | ); |
1917 | 1903 | } |
1918 | 1904 | |
1919 | - if($use_schema_language) |
|
1905 | + if ($use_schema_language) |
|
1920 | 1906 | { |
1921 | 1907 | $document_schema = $table_schema; |
1922 | 1908 | } |
1923 | 1909 | else |
1924 | 1910 | { |
1925 | - if(!$document_schema) |
|
1911 | + if (!$document_schema) |
|
1926 | 1912 | { |
1927 | 1913 | $document_schema = $schemas_set[$queryElement->getAttribute('action')]; |
1928 | 1914 | } |
1929 | 1915 | } |
1930 | 1916 | |
1931 | 1917 | $retcode->push(ReturnCode::RETCODE_XSD_VALIDATION); |
1932 | - if($domDocument->schemaValidate($document_schema)) |
|
1918 | + if ($domDocument->schemaValidate($document_schema)) |
|
1933 | 1919 | { |
1934 | 1920 | $retcode->pop(); |
1935 | 1921 | |
1936 | - if($use_schema_language) |
|
1922 | + if ($use_schema_language) |
|
1937 | 1923 | { |
1938 | 1924 | validate_schema_doc($argv[$i], $domDocument->documentElement); |
1939 | 1925 | } |
@@ -1944,22 +1930,22 @@ discard block |
||
1944 | 1930 | $success = TRUE; |
1945 | 1931 | } |
1946 | 1932 | |
1947 | - if(!$validate_only) |
|
1933 | + if (!$validate_only) |
|
1948 | 1934 | { |
1949 | 1935 | // Generate SQL with the db provider back-ends |
1950 | 1936 | |
1951 | - if(function_exists('sys_get_temp_dir')) |
|
1937 | + if (function_exists('sys_get_temp_dir')) |
|
1952 | 1938 | { |
1953 | 1939 | $tmpdir = sys_get_temp_dir(); |
1954 | 1940 | } |
1955 | 1941 | else |
1956 | 1942 | { |
1957 | 1943 | $tmpdir = getenv('TEMP'); |
1958 | - if(!$tmpdir) |
|
1944 | + if (!$tmpdir) |
|
1959 | 1945 | { |
1960 | 1946 | $tmpdir = getenv('TMP'); |
1961 | 1947 | } |
1962 | - if(!$tmpdir) |
|
1948 | + if (!$tmpdir) |
|
1963 | 1949 | { |
1964 | 1950 | $tmpdir = '/tmp'; |
1965 | 1951 | } |
@@ -1968,30 +1954,29 @@ discard block |
||
1968 | 1954 | |
1969 | 1955 | global $_SERVER; |
1970 | 1956 | |
1971 | - if(!is_array($_SERVER)) |
|
1957 | + if (!is_array($_SERVER)) |
|
1972 | 1958 | { |
1973 | 1959 | $_SERVER = array(); |
1974 | 1960 | } |
1975 | 1961 | |
1976 | - if(!array_key_exists('REMOTE_ADDR', $_SERVER)) |
|
1962 | + if (!array_key_exists('REMOTE_ADDR', $_SERVER)) |
|
1977 | 1963 | { |
1978 | 1964 | $_SERVER['REMOTE_ADDR'] = '127.0.0.1'; |
1979 | 1965 | } |
1980 | 1966 | |
1981 | 1967 | $set_db_info_methods = |
1982 | - array |
|
1983 | - ( |
|
1968 | + array( |
|
1984 | 1969 | 'mysql' => 'setMysqlDBInfo', |
1985 | 1970 | 'mysqli' => 'setMysqliDBInfo', |
1986 | 1971 | 'cubrid' => 'setCubridDBInfo', |
1987 | 1972 | 'mssql' => 'setMssqlDBInfo' |
1988 | 1973 | ); |
1989 | 1974 | |
1990 | - foreach($set_db_info_methods as $db_type => $set_info_method) |
|
1975 | + foreach ($set_db_info_methods as $db_type => $set_info_method) |
|
1991 | 1976 | { |
1992 | 1977 | Context::$set_info_method(); // calls setMysqlDBInfo()/setCubridDBInfo()/... |
1993 | 1978 | |
1994 | - if($use_schema_language) |
|
1979 | + if ($use_schema_language) |
|
1995 | 1980 | { |
1996 | 1981 | $GLOBALS['__DB__'][$db_type]->queries = ''; |
1997 | 1982 | $GLOBALS['__DB__'][$db_type]->createTableByXmlFile($argv[$i]); |
@@ -2010,39 +1995,38 @@ discard block |
||
2010 | 1995 | // copied from classes/db/DB.class.php |
2011 | 1996 | $oParser = new XmlQueryParser(); |
2012 | 1997 | $args_array = |
2013 | - $oParser->parse_xml_query |
|
2014 | - ( |
|
1998 | + $oParser->parse_xml_query( |
|
2015 | 1999 | pathinfo($argv[$i], PATHINFO_FILENAME), // query id |
2016 | - $argv[$i], // xml file |
|
2000 | + $argv[$i], // xml file |
|
2017 | 2001 | $unlink_tmpfile->file_name // cache file |
2018 | 2002 | ); |
2019 | 2003 | $args_array = $args_array->queryTag->getArguments(); |
2020 | 2004 | |
2021 | 2005 | $GLOBALS['__DB__'][$db_type]->queries = ''; |
2022 | 2006 | $k = 1; |
2023 | - foreach($args_array as $arg) |
|
2007 | + foreach ($args_array as $arg) |
|
2024 | 2008 | { |
2025 | - if(// why would there be a query arg without a var name ? |
|
2009 | + if (// why would there be a query arg without a var name ? |
|
2026 | 2010 | isset($arg->variable_name) |
2027 | 2011 | && |
2028 | 2012 | !array_key_exists($arg->variable_name, $query_user_args)) |
2029 | 2013 | { |
2030 | - if(isset($arg->argument_validator)) |
|
2014 | + if (isset($arg->argument_validator)) |
|
2031 | 2015 | { |
2032 | - if(FALSE // some default values are to be parsed by php, some are not... |
|
2016 | + if (FALSE // some default values are to be parsed by php, some are not... |
|
2033 | 2017 | && |
2034 | 2018 | isset($arg->argument_validator->default_value) |
2035 | 2019 | && |
2036 | 2020 | isset($arg->argument_validator->default_value->value)) |
2037 | 2021 | { |
2038 | 2022 | $query_user_args[$arg->variable_name] = |
2039 | - eval('return ' . $arg->argument_validator->default_value->toString() . ';'); |
|
2023 | + eval('return '.$arg->argument_validator->default_value->toString().';'); |
|
2040 | 2024 | } |
2041 | 2025 | else |
2042 | 2026 | { |
2043 | - if($arg->argument_validator->filter) |
|
2027 | + if ($arg->argument_validator->filter) |
|
2044 | 2028 | { |
2045 | - switch($arg->argument_validator->filter) |
|
2029 | + switch ($arg->argument_validator->filter) |
|
2046 | 2030 | { |
2047 | 2031 | case 'email': |
2048 | 2032 | case 'email_address': |
@@ -2081,18 +2065,17 @@ discard block |
||
2081 | 2065 | } |
2082 | 2066 | } |
2083 | 2067 | |
2084 | - if(!array_key_exists($arg->variable_name, $query_user_args)) |
|
2068 | + if (!array_key_exists($arg->variable_name, $query_user_args)) |
|
2085 | 2069 | { |
2086 | 2070 | $query_user_args[$arg->variable_name] = sprintf('%06d', $k); |
2087 | 2071 | } |
2088 | 2072 | |
2089 | - if(isset($arg->argument_validator)) |
|
2073 | + if (isset($arg->argument_validator)) |
|
2090 | 2074 | { |
2091 | - if(isset($arg->argument_validator->min_length)) |
|
2075 | + if (isset($arg->argument_validator->min_length)) |
|
2092 | 2076 | { |
2093 | 2077 | $query_user_args[$arg->variable_name] = |
2094 | - str_pad |
|
2095 | - ( |
|
2078 | + str_pad( |
|
2096 | 2079 | $query_user_args[$arg->variable_name], |
2097 | 2080 | $arg->argument_validator->min_length, |
2098 | 2081 | isset($arg->argument_validator->filter) && |
@@ -2105,11 +2088,10 @@ discard block |
||
2105 | 2088 | ); |
2106 | 2089 | } |
2107 | 2090 | |
2108 | - if(isset($arg->argument_validator->max_length)) |
|
2091 | + if (isset($arg->argument_validator->max_length)) |
|
2109 | 2092 | { |
2110 | 2093 | $query_user_args[$arg->variable_name] = |
2111 | - substr |
|
2112 | - ( |
|
2094 | + substr( |
|
2113 | 2095 | $query_user_args[$arg->variable_name], |
2114 | 2096 | 0, |
2115 | 2097 | $arg->argument_validator->max_length |
@@ -2122,15 +2104,14 @@ discard block |
||
2122 | 2104 | } |
2123 | 2105 | |
2124 | 2106 | $resultset = |
2125 | - $GLOBALS['__DB__'][$db_type]->_executeQuery |
|
2126 | - ( |
|
2127 | - $unlink_tmpfile->file_name, // cache_file |
|
2128 | - (object)$query_user_args, // source_args |
|
2129 | - basename($argv[$i]), // query_id |
|
2107 | + $GLOBALS['__DB__'][$db_type]->_executeQuery( |
|
2108 | + $unlink_tmpfile->file_name, // cache_file |
|
2109 | + (object) $query_user_args, // source_args |
|
2110 | + basename($argv[$i]), // query_id |
|
2130 | 2111 | array() // arg_columns |
2131 | 2112 | ); |
2132 | 2113 | |
2133 | - if(is_a($resultset, 'BaseObject') && !$resultset->toBool()) |
|
2114 | + if (is_a($resultset, 'BaseObject') && !$resultset->toBool()) |
|
2134 | 2115 | { |
2135 | 2116 | throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed'); |
2136 | 2117 | } |
@@ -2147,7 +2128,7 @@ discard block |
||
2147 | 2128 | } |
2148 | 2129 | } |
2149 | 2130 | |
2150 | - if(!$success) |
|
2131 | + if (!$success) |
|
2151 | 2132 | { |
2152 | 2133 | libXmlDisplayError($argv[$i], TRUE); |
2153 | 2134 | } |
@@ -2156,21 +2137,21 @@ discard block |
||
2156 | 2137 | { |
2157 | 2138 | $retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS); |
2158 | 2139 | |
2159 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
2140 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
2160 | 2141 | } |
2161 | 2142 | catch (ErrorMessage $exc) |
2162 | 2143 | { |
2163 | - if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
2144 | + if ($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
2164 | 2145 | { |
2165 | 2146 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
2166 | 2147 | } |
2167 | 2148 | |
2168 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
2149 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
2169 | 2150 | libXmlDisplayError($argv[$i]); |
2170 | 2151 | } |
2171 | 2152 | catch (ErrorException $exc) |
2172 | 2153 | { |
2173 | - if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
2154 | + if ($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
|
2174 | 2155 | { |
2175 | 2156 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
2176 | 2157 | } |
@@ -2183,7 +2164,7 @@ discard block |
||
2183 | 2164 | { |
2184 | 2165 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
2185 | 2166 | |
2186 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
2167 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
2187 | 2168 | fwrite(STDERR, $exc->getTraceAsString()); |
2188 | 2169 | libXmlDisplayError($argv[$i]); |
2189 | 2170 | } |
@@ -2193,22 +2174,22 @@ discard block |
||
2193 | 2174 | } |
2194 | 2175 | catch (SyntaxError $syntax) |
2195 | 2176 | { |
2196 | - fwrite(STDERR, $syntax->getMessage() . "\n"); |
|
2197 | - exit(254); // wrong command line |
|
2177 | + fwrite(STDERR, $syntax->getMessage()."\n"); |
|
2178 | + exit(254); // wrong command line |
|
2198 | 2179 | // 255 is reserved by php (for parse errors, etc.) |
2199 | 2180 | } |
2200 | 2181 | catch (ErrorMessage $exc) |
2201 | 2182 | { |
2202 | - fwrite(STDERR, $exc->getMessage() . "\n"); |
|
2183 | + fwrite(STDERR, $exc->getMessage()."\n"); |
|
2203 | 2184 | libXmlDisplayError(); |
2204 | - exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
2185 | + exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
2205 | 2186 | } |
2206 | 2187 | catch (Exception $exc) |
2207 | 2188 | { |
2208 | - fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n"); |
|
2189 | + fwrite(STDERR, $exc->getFile().'('.$exc->getLine().")\n\t".$exc->getMessage()."\n"); |
|
2209 | 2190 | fwrite(STDERR, $exc->getTraceAsString()); |
2210 | 2191 | libXmlDisplayError(); |
2211 | - exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
2192 | + exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
|
2212 | 2193 | } |
2213 | 2194 | |
2214 | 2195 | /* End of file validate.php */ |
@@ -150,13 +150,11 @@ discard block |
||
150 | 150 | if($throw_error) |
151 | 151 | { |
152 | 152 | throw new ErrorMessage($msg); |
153 | - } |
|
154 | - else |
|
153 | + } else |
|
155 | 154 | { |
156 | 155 | fwrite(STDERR, $msg . "\n"); |
157 | 156 | } |
158 | - } |
|
159 | - else |
|
157 | + } else |
|
160 | 158 | { |
161 | 159 | if($throw_error) |
162 | 160 | { |
@@ -346,8 +344,7 @@ discard block |
||
346 | 344 | "\nANSI SQL-99 declares the table specification as required." |
347 | 345 | ); |
348 | 346 | } |
349 | - } |
|
350 | - else |
|
347 | + } else |
|
351 | 348 | { |
352 | 349 | // base table or view |
353 | 350 | |
@@ -369,13 +366,11 @@ discard block |
||
369 | 366 | $child_node->getLineNo(), |
370 | 367 | 'Duplicate <conditions> elements.' |
371 | 368 | ); |
372 | - } |
|
373 | - else |
|
369 | + } else |
|
374 | 370 | { |
375 | 371 | $has_conditions_element = TRUE; |
376 | 372 | } |
377 | - } |
|
378 | - else |
|
373 | + } else |
|
379 | 374 | { |
380 | 375 | throw |
381 | 376 | new XmlSchemaError( |
@@ -396,8 +391,7 @@ discard block |
||
396 | 391 | 'Expected <conditions> element as content.' |
397 | 392 | ); |
398 | 393 | } |
399 | - } |
|
400 | - else |
|
394 | + } else |
|
401 | 395 | { |
402 | 396 | foreach($table_element->childNodes as $child_node) |
403 | 397 | { |
@@ -609,8 +603,7 @@ discard block |
||
609 | 603 | if($first_child) |
610 | 604 | { |
611 | 605 | $first_child = FALSE; |
612 | - } |
|
613 | - else |
|
606 | + } else |
|
614 | 607 | { |
615 | 608 | if(!$child_node->hasAttribute('pipe')) |
616 | 609 | { |
@@ -629,14 +622,12 @@ discard block |
||
629 | 622 | if($child_node->tagName == 'group') |
630 | 623 | { |
631 | 624 | checkConditionsGroup($xml_file, $child_node); |
632 | - } |
|
633 | - else |
|
625 | + } else |
|
634 | 626 | { |
635 | 627 | if($child_node->tagName == 'query') |
636 | 628 | { |
637 | 629 | validate_select_query($xml_file, $child_node); |
638 | - } |
|
639 | - else |
|
630 | + } else |
|
640 | 631 | { |
641 | 632 | if($child_node->tagName == 'condition') |
642 | 633 | { |
@@ -851,8 +842,7 @@ discard block |
||
851 | 842 | try |
852 | 843 | { |
853 | 844 | $success = chdir($this->dirname); |
854 | - } |
|
855 | - catch (Exception $e) |
|
845 | + } catch (Exception $e) |
|
856 | 846 | { |
857 | 847 | print "Failed to restore working dir {$this->dirname}."; |
858 | 848 | } |
@@ -921,8 +911,7 @@ discard block |
||
921 | 911 | if($lowercase_name[$i] != $uppercase_name[$i]) |
922 | 912 | { |
923 | 913 | $varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]"; |
924 | - } |
|
925 | - else |
|
914 | + } else |
|
926 | 915 | { |
927 | 916 | $varing_case_filename .= $lowercase_name[$i]; |
928 | 917 | } |
@@ -1119,8 +1108,7 @@ discard block |
||
1119 | 1108 | if($val == -1) |
1120 | 1109 | { |
1121 | 1110 | return $this->exit_code; |
1122 | - } |
|
1123 | - else |
|
1111 | + } else |
|
1124 | 1112 | { |
1125 | 1113 | if($this->exit_code < $val) |
1126 | 1114 | { |
@@ -1488,8 +1476,7 @@ discard block |
||
1488 | 1476 | if(self::$db_info) |
1489 | 1477 | { |
1490 | 1478 | return self::$db_info->master_db['db_type']; |
1491 | - } |
|
1492 | - else |
|
1479 | + } else |
|
1493 | 1480 | { |
1494 | 1481 | return NULL; |
1495 | 1482 | } |
@@ -1588,8 +1575,7 @@ discard block |
||
1588 | 1575 | && |
1589 | 1576 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1590 | 1577 | { |
1591 | - } |
|
1592 | - else |
|
1578 | + } else |
|
1593 | 1579 | { |
1594 | 1580 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
1595 | 1581 | new DBMysqlConnectWrapper(); |
@@ -1630,8 +1616,7 @@ discard block |
||
1630 | 1616 | && |
1631 | 1617 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1632 | 1618 | { |
1633 | - } |
|
1634 | - else |
|
1619 | + } else |
|
1635 | 1620 | { |
1636 | 1621 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
1637 | 1622 | new DBMysqliConnectWrapper(); |
@@ -1672,8 +1657,7 @@ discard block |
||
1672 | 1657 | && |
1673 | 1658 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1674 | 1659 | { |
1675 | - } |
|
1676 | - else |
|
1660 | + } else |
|
1677 | 1661 | { |
1678 | 1662 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
1679 | 1663 | new DBCubridConnectWrapper(); |
@@ -1714,8 +1698,7 @@ discard block |
||
1714 | 1698 | && |
1715 | 1699 | array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__'])) |
1716 | 1700 | { |
1717 | - } |
|
1718 | - else |
|
1701 | + } else |
|
1719 | 1702 | { |
1720 | 1703 | $GLOBALS['__DB__'][$db_info->master_db['db_type']] = |
1721 | 1704 | new DBMssqlConnectWrapper(); |
@@ -1812,22 +1795,19 @@ discard block |
||
1812 | 1795 | try |
1813 | 1796 | { |
1814 | 1797 | $query_user_args = require($query_args_file); |
1815 | - } |
|
1816 | - catch (Exception $exc) |
|
1798 | + } catch (Exception $exc) |
|
1817 | 1799 | { |
1818 | 1800 | fwrite(STDERR, "Error in arguments file.\n"); |
1819 | 1801 | throw $exc; |
1820 | 1802 | } |
1821 | - } |
|
1822 | - else |
|
1803 | + } else |
|
1823 | 1804 | { |
1824 | 1805 | if($query_args) |
1825 | 1806 | { |
1826 | 1807 | try |
1827 | 1808 | { |
1828 | 1809 | eval('$query_user_args = array(' . $query_args . ');'); |
1829 | - } |
|
1830 | - catch (Exception $exc) |
|
1810 | + } catch (Exception $exc) |
|
1831 | 1811 | { |
1832 | 1812 | fwrite(STDERR, "Error in arguments string.\n"); |
1833 | 1813 | throw $exc; |
@@ -1919,8 +1899,7 @@ discard block |
||
1919 | 1899 | if($use_schema_language) |
1920 | 1900 | { |
1921 | 1901 | $document_schema = $table_schema; |
1922 | - } |
|
1923 | - else |
|
1902 | + } else |
|
1924 | 1903 | { |
1925 | 1904 | if(!$document_schema) |
1926 | 1905 | { |
@@ -1936,8 +1915,7 @@ discard block |
||
1936 | 1915 | if($use_schema_language) |
1937 | 1916 | { |
1938 | 1917 | validate_schema_doc($argv[$i], $domDocument->documentElement); |
1939 | - } |
|
1940 | - else |
|
1918 | + } else |
|
1941 | 1919 | { |
1942 | 1920 | validate_xml_query($argv[$i], $domDocument->documentElement); |
1943 | 1921 | } |
@@ -1951,8 +1929,7 @@ discard block |
||
1951 | 1929 | if(function_exists('sys_get_temp_dir')) |
1952 | 1930 | { |
1953 | 1931 | $tmpdir = sys_get_temp_dir(); |
1954 | - } |
|
1955 | - else |
|
1932 | + } else |
|
1956 | 1933 | { |
1957 | 1934 | $tmpdir = getenv('TEMP'); |
1958 | 1935 | if(!$tmpdir) |
@@ -2001,8 +1978,7 @@ discard block |
||
2001 | 1978 | print " {$db_type} query:\n"; |
2002 | 1979 | print $GLOBALS['__DB__'][$db_type]->queries; |
2003 | 1980 | print "\n"; |
2004 | - } |
|
2005 | - else |
|
1981 | + } else |
|
2006 | 1982 | { |
2007 | 1983 | $unlink_tmpfile = |
2008 | 1984 | new UnlinkFile(tempnam($tmpdir, 'xe_')); |
@@ -2037,8 +2013,7 @@ discard block |
||
2037 | 2013 | { |
2038 | 2014 | $query_user_args[$arg->variable_name] = |
2039 | 2015 | eval('return ' . $arg->argument_validator->default_value->toString() . ';'); |
2040 | - } |
|
2041 | - else |
|
2016 | + } else |
|
2042 | 2017 | { |
2043 | 2018 | if($arg->argument_validator->filter) |
2044 | 2019 | { |
@@ -2133,8 +2108,7 @@ discard block |
||
2133 | 2108 | if(is_a($resultset, 'BaseObject') && !$resultset->toBool()) |
2134 | 2109 | { |
2135 | 2110 | throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed'); |
2136 | - } |
|
2137 | - else |
|
2111 | + } else |
|
2138 | 2112 | { |
2139 | 2113 | print "\n"; |
2140 | 2114 | print pathinfo($argv[$i], PATHINFO_FILENAME); |
@@ -2151,14 +2125,12 @@ discard block |
||
2151 | 2125 | { |
2152 | 2126 | libXmlDisplayError($argv[$i], TRUE); |
2153 | 2127 | } |
2154 | - } |
|
2155 | - catch (XmlSchemaError $exc) |
|
2128 | + } catch (XmlSchemaError $exc) |
|
2156 | 2129 | { |
2157 | 2130 | $retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS); |
2158 | 2131 | |
2159 | 2132 | fwrite(STDERR, $exc->getMessage() . "\n"); |
2160 | - } |
|
2161 | - catch (ErrorMessage $exc) |
|
2133 | + } catch (ErrorMessage $exc) |
|
2162 | 2134 | { |
2163 | 2135 | if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
2164 | 2136 | { |
@@ -2167,8 +2139,7 @@ discard block |
||
2167 | 2139 | |
2168 | 2140 | fwrite(STDERR, $exc->getMessage() . "\n"); |
2169 | 2141 | libXmlDisplayError($argv[$i]); |
2170 | - } |
|
2171 | - catch (ErrorException $exc) |
|
2142 | + } catch (ErrorException $exc) |
|
2172 | 2143 | { |
2173 | 2144 | if($retcode->code() == ReturnCode::RETCODE_SUCCESS) |
2174 | 2145 | { |
@@ -2178,8 +2149,7 @@ discard block |
||
2178 | 2149 | fwrite(STDERR, "{$exc->getFile()}({$exc->getLine()}):\n\t{$exc->getMessage()}.\n"); |
2179 | 2150 | fwrite(STDERR, $exc->getTraceAsString()); |
2180 | 2151 | libXmlDisplayError($argv[$i]); |
2181 | - } |
|
2182 | - catch (Exception $exc) |
|
2152 | + } catch (Exception $exc) |
|
2183 | 2153 | { |
2184 | 2154 | $retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL); |
2185 | 2155 | |
@@ -2190,20 +2160,17 @@ discard block |
||
2190 | 2160 | } |
2191 | 2161 | |
2192 | 2162 | exit($retcode->code()); |
2193 | -} |
|
2194 | -catch (SyntaxError $syntax) |
|
2163 | +} catch (SyntaxError $syntax) |
|
2195 | 2164 | { |
2196 | 2165 | fwrite(STDERR, $syntax->getMessage() . "\n"); |
2197 | 2166 | exit(254); // wrong command line |
2198 | 2167 | // 255 is reserved by php (for parse errors, etc.) |
2199 | -} |
|
2200 | -catch (ErrorMessage $exc) |
|
2168 | +} catch (ErrorMessage $exc) |
|
2201 | 2169 | { |
2202 | 2170 | fwrite(STDERR, $exc->getMessage() . "\n"); |
2203 | 2171 | libXmlDisplayError(); |
2204 | 2172 | exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error |
2205 | -} |
|
2206 | -catch (Exception $exc) |
|
2173 | +} catch (Exception $exc) |
|
2207 | 2174 | { |
2208 | 2175 | fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n"); |
2209 | 2176 | fwrite(STDERR, $exc->getTraceAsString()); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @file config/config.inc.php |
8 | 8 | * @author NAVER ([email protected]) |
9 | 9 | */ |
10 | -if(version_compare(PHP_VERSION, '5.4.0', '<')) |
|
10 | +if (version_compare(PHP_VERSION, '5.4.0', '<')) |
|
11 | 11 | { |
12 | 12 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING); |
13 | 13 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | @error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_WARNING ^ E_STRICT); |
17 | 17 | } |
18 | 18 | |
19 | -if(!defined('__XE__')) |
|
19 | +if (!defined('__XE__')) |
|
20 | 20 | { |
21 | 21 | exit(); |
22 | 22 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | ini_set('session.use_only_cookies', 0); |
54 | 54 | |
55 | 55 | |
56 | -if(file_exists(_XE_PATH_ . 'config/package.inc.php')) |
|
56 | +if (file_exists(_XE_PATH_.'config/package.inc.php')) |
|
57 | 57 | { |
58 | - require _XE_PATH_ . 'config/package.inc.php'; |
|
58 | + require _XE_PATH_.'config/package.inc.php'; |
|
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | * define('__ENABLE_PHPUNIT_TEST__', 0); |
98 | 98 | * define('__PROXY_SERVER__', 'http://domain:port/path'); |
99 | 99 | */ |
100 | -if(file_exists(_XE_PATH_ . 'config/config.user.inc.php')) |
|
100 | +if (file_exists(_XE_PATH_.'config/config.user.inc.php')) |
|
101 | 101 | { |
102 | - require _XE_PATH_ . 'config/config.user.inc.php'; |
|
102 | + require _XE_PATH_.'config/config.user.inc.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | -if(!defined('__DEBUG__')) |
|
105 | +if (!defined('__DEBUG__')) |
|
106 | 106 | { |
107 | 107 | /** |
108 | 108 | * output debug message(bit value) |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | define('__DEBUG__', 0); |
118 | 118 | } |
119 | 119 | |
120 | -if(!defined('__DEBUG_OUTPUT__')) |
|
120 | +if (!defined('__DEBUG_OUTPUT__')) |
|
121 | 121 | { |
122 | 122 | /** |
123 | 123 | * output location of debug message |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | define('__DEBUG_OUTPUT__', 0); |
132 | 132 | } |
133 | 133 | |
134 | -if(!defined('__DEBUG_PROTECT__')) |
|
134 | +if (!defined('__DEBUG_PROTECT__')) |
|
135 | 135 | { |
136 | 136 | /** |
137 | 137 | * output comments of the firePHP console and browser |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | define('__DEBUG_PROTECT__', 1); |
145 | 145 | } |
146 | 146 | |
147 | -if(!defined('__DEBUG_PROTECT_IP__')) |
|
147 | +if (!defined('__DEBUG_PROTECT_IP__')) |
|
148 | 148 | { |
149 | 149 | /** |
150 | 150 | * Set a ip address to allow debug |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | define('__DEBUG_PROTECT_IP__', '127.0.0.1'); |
153 | 153 | } |
154 | 154 | |
155 | -if(!defined('__DEBUG_DB_OUTPUT__')) |
|
155 | +if (!defined('__DEBUG_DB_OUTPUT__')) |
|
156 | 156 | { |
157 | 157 | /** |
158 | 158 | * DB error message definition |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | define('__DEBUG_DB_OUTPUT__', 0); |
166 | 166 | } |
167 | 167 | |
168 | -if(!defined('__LOG_SLOW_QUERY__')) |
|
168 | +if (!defined('__LOG_SLOW_QUERY__')) |
|
169 | 169 | { |
170 | 170 | /** |
171 | 171 | * Query log for only timeout query among DB queries |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | define('__LOG_SLOW_QUERY__', 0); |
180 | 180 | } |
181 | 181 | |
182 | -if(!defined('__LOG_SLOW_TRIGGER__')) |
|
182 | +if (!defined('__LOG_SLOW_TRIGGER__')) |
|
183 | 183 | { |
184 | 184 | /** |
185 | 185 | * Trigger excute time log |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | define('__LOG_SLOW_TRIGGER__', 0); |
194 | 194 | } |
195 | 195 | |
196 | -if(!defined('__LOG_SLOW_ADDON__')) |
|
196 | +if (!defined('__LOG_SLOW_ADDON__')) |
|
197 | 197 | { |
198 | 198 | /** |
199 | 199 | * Addon excute time log |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | define('__LOG_SLOW_ADDON__', 0); |
208 | 208 | } |
209 | 209 | |
210 | -if(!defined('__LOG_SLOW_WIDGET__')) |
|
210 | +if (!defined('__LOG_SLOW_WIDGET__')) |
|
211 | 211 | { |
212 | 212 | /** |
213 | 213 | * Widget excute time log |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | define('__LOG_SLOW_WIDGET__', 0); |
222 | 222 | } |
223 | 223 | |
224 | -if(!defined('__DEBUG_QUERY__')) |
|
224 | +if (!defined('__DEBUG_QUERY__')) |
|
225 | 225 | { |
226 | 226 | /** |
227 | 227 | * Leave DB query information |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | define('__DEBUG_QUERY__', 0); |
235 | 235 | } |
236 | 236 | |
237 | -if(!defined('__OB_GZHANDLER_ENABLE__')) |
|
237 | +if (!defined('__OB_GZHANDLER_ENABLE__')) |
|
238 | 238 | { |
239 | 239 | /** |
240 | 240 | * option to enable/disable a compression feature using ob_gzhandler |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | define('__OB_GZHANDLER_ENABLE__', 1); |
249 | 249 | } |
250 | 250 | |
251 | -if(!defined('__ENABLE_PHPUNIT_TEST__')) |
|
251 | +if (!defined('__ENABLE_PHPUNIT_TEST__')) |
|
252 | 252 | { |
253 | 253 | /** |
254 | 254 | * decide to use/not use the php unit test (Path/tests/index.php) |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | define('__ENABLE_PHPUNIT_TEST__', 0); |
262 | 262 | } |
263 | 263 | |
264 | -if(!defined('__PROXY_SERVER__')) |
|
264 | +if (!defined('__PROXY_SERVER__')) |
|
265 | 265 | { |
266 | 266 | /** |
267 | 267 | * __PROXY_SERVER__ has server information to request to the external through the target server |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | define('__PROXY_SERVER__', NULL); |
271 | 271 | } |
272 | 272 | |
273 | -if(!defined('__ERROR_LOG__')) |
|
273 | +if (!defined('__ERROR_LOG__')) |
|
274 | 274 | { |
275 | 275 | /** |
276 | 276 | * __ERROR_LOG__ 는 PHP의 에러로그를 출력하는 기능입니다. 개발시 워닝에러이상의 에러부터 잡기 시작합니다. |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | define('__ERROR_LOG__', 0); |
282 | 282 | } |
283 | 283 | |
284 | -if(!defined('__DISABLE_DEFAULT_CSS__')) |
|
284 | +if (!defined('__DISABLE_DEFAULT_CSS__')) |
|
285 | 285 | { |
286 | 286 | /** |
287 | 287 | * XE의 기본 CSS 스타일을 로드하지 않도록 합니다. |
@@ -297,25 +297,25 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | // Require specific files when using Firebug console output |
300 | -if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
300 | +if ((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) |
|
301 | 301 | { |
302 | - require _XE_PATH_ . 'libs/FirePHPCore/FirePHP.class.php'; |
|
302 | + require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php'; |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | // Set Timezone as server time |
306 | -if(version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
306 | +if (version_compare(PHP_VERSION, '5.3.0') >= 0) |
|
307 | 307 | { |
308 | 308 | date_default_timezone_set(@date_default_timezone_get()); |
309 | 309 | } |
310 | 310 | |
311 | 311 | // Require a function-defined-file for simple use |
312 | -require(_XE_PATH_ . 'config/func.inc.php'); |
|
312 | +require(_XE_PATH_.'config/func.inc.php'); |
|
313 | 313 | |
314 | -if(__DEBUG__) { |
|
314 | +if (__DEBUG__) { |
|
315 | 315 | define('__StartTime__', getMicroTime()); |
316 | 316 | } |
317 | 317 | |
318 | -if(__DEBUG__) { |
|
318 | +if (__DEBUG__) { |
|
319 | 319 | $GLOBALS['__elapsed_class_load__'] = 0; |
320 | 320 | } |
321 | 321 | |
@@ -418,43 +418,43 @@ discard block |
||
418 | 418 | |
419 | 419 | function __xe_autoload($class_name) |
420 | 420 | { |
421 | - if(__DEBUG__) { |
|
421 | + if (__DEBUG__) { |
|
422 | 422 | $time_at = getMicroTime(); |
423 | 423 | } |
424 | 424 | |
425 | - if(isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
425 | + if (isset($GLOBALS['__xe_autoload_file_map'][strtolower($class_name)])) |
|
426 | 426 | { |
427 | - require _XE_PATH_ . $GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
427 | + require _XE_PATH_.$GLOBALS['__xe_autoload_file_map'][strtolower($class_name)]; |
|
428 | 428 | } |
429 | - elseif(preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
429 | + elseif (preg_match('/^([a-zA-Z0-9_]+?)(Admin)?(View|Controller|Model|Api|Wap|Mobile)?$/', $class_name, $matches)) |
|
430 | 430 | { |
431 | 431 | $candidate_filename = array(); |
432 | - $candidate_filename[] = 'modules/' . $matches[1] . '/' . $matches[1]; |
|
433 | - if(isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
432 | + $candidate_filename[] = 'modules/'.$matches[1].'/'.$matches[1]; |
|
433 | + if (isset($matches[2]) && $matches[2]) $candidate_filename[] = 'admin'; |
|
434 | 434 | $candidate_filename[] = (isset($matches[3]) && $matches[3]) ? strtolower($matches[3]) : 'class'; |
435 | 435 | $candidate_filename[] = 'php'; |
436 | 436 | |
437 | 437 | $candidate_filename = implode('.', $candidate_filename); |
438 | 438 | |
439 | - if(file_exists(_XE_PATH_ . $candidate_filename)) |
|
439 | + if (file_exists(_XE_PATH_.$candidate_filename)) |
|
440 | 440 | { |
441 | - require _XE_PATH_ . $candidate_filename; |
|
441 | + require _XE_PATH_.$candidate_filename; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | - if(__DEBUG__) { |
|
445 | + if (__DEBUG__) { |
|
446 | 446 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $time_at; |
447 | 447 | } |
448 | 448 | } |
449 | 449 | spl_autoload_register('__xe_autoload'); |
450 | 450 | |
451 | -if(version_compare(PHP_VERSION, '7.2', '<')) |
|
451 | +if (version_compare(PHP_VERSION, '7.2', '<')) |
|
452 | 452 | { |
453 | 453 | class_alias('BaseObject', 'Object', true); |
454 | 454 | } |
455 | 455 | |
456 | -if(file_exists(_XE_PATH_ . '/vendor/autoload.php')) { |
|
457 | - require _XE_PATH_ . '/vendor/autoload.php'; |
|
456 | +if (file_exists(_XE_PATH_.'/vendor/autoload.php')) { |
|
457 | + require _XE_PATH_.'/vendor/autoload.php'; |
|
458 | 458 | } |
459 | 459 | /* End of file config.inc.php */ |
460 | 460 | /* Location: ./config/config.inc.php */ |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
36 | 36 | { |
37 | 37 | // If XE has not installed yet, set module as install |
38 | - if(!Context::isInstalled()) |
|
38 | + if (!Context::isInstalled()) |
|
39 | 39 | { |
40 | 40 | $this->module = 'install'; |
41 | 41 | $this->act = Context::get('act'); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | $oContext = Context::getInstance(); |
46 | - if($oContext->isSuccessInit == FALSE) |
|
46 | + if ($oContext->isSuccessInit == FALSE) |
|
47 | 47 | { |
48 | 48 | $logged_info = Context::get('logged_info'); |
49 | - if($logged_info->is_admin != "Y") |
|
49 | + if ($logged_info->is_admin != "Y") |
|
50 | 50 | { |
51 | 51 | $this->error = 'msg_invalid_request'; |
52 | 52 | return; |
@@ -59,26 +59,26 @@ discard block |
||
59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
62 | - if($entry = Context::get('entry')) |
|
62 | + if ($entry = Context::get('entry')) |
|
63 | 63 | { |
64 | 64 | $this->entry = Context::convertEncodingStr($entry); |
65 | 65 | } |
66 | 66 | |
67 | 67 | // Validate variables to prevent XSS |
68 | 68 | $isInvalid = NULL; |
69 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
69 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
70 | 70 | { |
71 | 71 | $isInvalid = TRUE; |
72 | 72 | } |
73 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
73 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
74 | 74 | { |
75 | 75 | $isInvalid = TRUE; |
76 | 76 | } |
77 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
77 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
78 | 78 | { |
79 | 79 | $isInvalid = TRUE; |
80 | 80 | } |
81 | - if($isInvalid) |
|
81 | + if ($isInvalid) |
|
82 | 82 | { |
83 | 83 | htmlHeader(); |
84 | 84 | echo Context::getLang("msg_invalid_request"); |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | exit; |
88 | 88 | } |
89 | 89 | |
90 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
90 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
91 | 91 | { |
92 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
92 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
93 | 93 | { |
94 | - if(Context::get('_https_port')!=null) { |
|
95 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
94 | + if (Context::get('_https_port') != null) { |
|
95 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
96 | 96 | } else { |
97 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
97 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
98 | 98 | } |
99 | 99 | return; |
100 | 100 | } |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | |
103 | 103 | // call a trigger before moduleHandler init |
104 | 104 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
105 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
105 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
106 | 106 | { |
107 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
107 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
108 | 108 | { |
109 | 109 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
110 | 110 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -115,40 +115,40 @@ discard block |
||
115 | 115 | $called_position = 'before_module_init'; |
116 | 116 | $oAddonController = getController('addon'); |
117 | 117 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
118 | - if(file_exists($addon_file)) include($addon_file); |
|
118 | + if (file_exists($addon_file)) include($addon_file); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
122 | 122 | { |
123 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
123 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
124 | 124 | { |
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | 128 | set_error_handler(function() { }, ~0); |
129 | 129 | |
130 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
131 | - if(!file_exists($debug_file)) |
|
130 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
131 | + if (!file_exists($debug_file)) |
|
132 | 132 | { |
133 | 133 | $print[] = '<?php exit() ?>'; |
134 | 134 | } |
135 | 135 | |
136 | 136 | $errorname = self::getErrorType($errnumber); |
137 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
137 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
138 | 138 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
139 | 139 | $backtrace = debug_backtrace($backtrace_args); |
140 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
140 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
141 | 141 | { |
142 | 142 | array_shift($backtrace); |
143 | 143 | } |
144 | 144 | |
145 | - foreach($backtrace as $key => $value) |
|
145 | + foreach ($backtrace as $key => $value) |
|
146 | 146 | { |
147 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
147 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
148 | 148 | $print[] = $message; |
149 | 149 | } |
150 | 150 | $print[] = PHP_EOL; |
151 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
151 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
152 | 152 | restore_error_handler(); |
153 | 153 | |
154 | 154 | return true; |
@@ -164,21 +164,21 @@ discard block |
||
164 | 164 | |
165 | 165 | set_error_handler(function() { }, ~0); |
166 | 166 | |
167 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
168 | - if(!file_exists($debug_file)) |
|
167 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
168 | + if (!file_exists($debug_file)) |
|
169 | 169 | { |
170 | 170 | $print[] = '<?php exit() ?>'; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $errorname = self::getErrorType($errinfo['type']); |
174 | 174 | $print[] = '['.date('Y-m-d H:i:s').']'; |
175 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
175 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
176 | 176 | |
177 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
177 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
178 | 178 | $print[] = $message; |
179 | 179 | |
180 | 180 | $print[] = PHP_EOL; |
181 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
181 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
182 | 182 | set_error_handler(array($this, 'dummyHandler'), ~0); |
183 | 183 | |
184 | 184 | return true; |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
223 | 223 | $defaultHost = $defaultUrlInfo['host']; |
224 | 224 | |
225 | - foreach($urls as $url) |
|
225 | + foreach ($urls as $url) |
|
226 | 226 | { |
227 | - if(empty($url)) |
|
227 | + if (empty($url)) |
|
228 | 228 | { |
229 | 229 | continue; |
230 | 230 | } |
@@ -232,29 +232,29 @@ discard block |
||
232 | 232 | $urlInfo = parse_url($url); |
233 | 233 | $host = $urlInfo['host']; |
234 | 234 | |
235 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
235 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
236 | 236 | { |
237 | 237 | throw new Exception('msg_default_url_is_null'); |
238 | 238 | } |
239 | 239 | } |
240 | 240 | |
241 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
241 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
242 | 242 | { |
243 | 243 | $oDocumentModel = getModel('document'); |
244 | 244 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
245 | - if($this->document_srl) |
|
245 | + if ($this->document_srl) |
|
246 | 246 | { |
247 | 247 | Context::set('document_srl', $this->document_srl); |
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | 251 | // Get module's information based on document_srl, if it's specified |
252 | - if($this->document_srl) |
|
252 | + if ($this->document_srl) |
|
253 | 253 | { |
254 | 254 | |
255 | 255 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
256 | 256 | // If the document does not exist, remove document_srl |
257 | - if(!$module_info) |
|
257 | + if (!$module_info) |
|
258 | 258 | { |
259 | 259 | unset($this->document_srl); |
260 | 260 | } |
@@ -262,13 +262,13 @@ discard block |
||
262 | 262 | { |
263 | 263 | // If it exists, compare mid based on the module information |
264 | 264 | // if mids are not matching, set it as the document's mid |
265 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
265 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
266 | 266 | { |
267 | 267 | |
268 | - if(Context::getRequestMethod() == 'GET') |
|
268 | + if (Context::getRequestMethod() == 'GET') |
|
269 | 269 | { |
270 | 270 | $this->mid = $module_info->mid; |
271 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
271 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
272 | 272 | return FALSE; |
273 | 273 | } |
274 | 274 | else |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | } |
281 | 281 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
282 | - if($this->module && $module_info->module != $this->module) |
|
282 | + if ($this->module && $module_info->module != $this->module) |
|
283 | 283 | { |
284 | 284 | unset($module_info); |
285 | 285 | } |
@@ -288,36 +288,36 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
291 | - if(!$module_info && $this->mid) |
|
291 | + if (!$module_info && $this->mid) |
|
292 | 292 | { |
293 | 293 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
294 | 294 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
295 | 295 | } |
296 | 296 | |
297 | 297 | // redirect, if module_site_srl and site_srl are different |
298 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
298 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
299 | 299 | { |
300 | 300 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
301 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
301 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
302 | 302 | return FALSE; |
303 | 303 | } |
304 | 304 | |
305 | 305 | // If module_info is not set still, and $module does not exist, find the default module |
306 | - if(!$module_info && !$this->module && !$this->mid) |
|
306 | + if (!$module_info && !$this->module && !$this->mid) |
|
307 | 307 | { |
308 | 308 | $module_info = $site_module_info; |
309 | 309 | } |
310 | 310 | |
311 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
311 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
312 | 312 | { |
313 | 313 | $module_info = $site_module_info; |
314 | 314 | } |
315 | 315 | |
316 | 316 | // redirect, if site_srl of module_info is different from one of site's module_info |
317 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
317 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
318 | 318 | { |
319 | 319 | // If the module is of virtual site |
320 | - if($module_info->site_srl) |
|
320 | + if ($module_info->site_srl) |
|
321 | 321 | { |
322 | 322 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
323 | 323 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | else |
327 | 327 | { |
328 | 328 | $db_info = Context::getDBInfo(); |
329 | - if(!$db_info->default_url) |
|
329 | + if (!$db_info->default_url) |
|
330 | 330 | { |
331 | 331 | return Context::getLang('msg_default_url_is_not_defined'); |
332 | 332 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
336 | 336 | } |
337 | 337 | } |
338 | - header("location:" . $redirect_url); |
|
338 | + header("location:".$redirect_url); |
|
339 | 339 | return FALSE; |
340 | 340 | } |
341 | 341 | |
342 | 342 | // If module info was set, retrieve variables from the module information |
343 | - if($module_info) |
|
343 | + if ($module_info) |
|
344 | 344 | { |
345 | 345 | $this->module = $module_info->module; |
346 | 346 | $this->mid = $module_info->mid; |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
352 | 352 | |
353 | 353 | // use the site default layout. |
354 | - if($module_info->{$targetSrl} == -1) |
|
354 | + if ($module_info->{$targetSrl} == -1) |
|
355 | 355 | { |
356 | 356 | $oLayoutAdminModel = getAdminModel('layout'); |
357 | 357 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | } |
370 | 370 | |
371 | 371 | // Set module and mid into module_info |
372 | - if(!isset($this->module_info)) |
|
372 | + if (!isset($this->module_info)) |
|
373 | 373 | { |
374 | 374 | $this->module_info = new stdClass(); |
375 | 375 | } |
@@ -380,21 +380,21 @@ discard block |
||
380 | 380 | $this->module_info->site_srl = $site_module_info->site_srl; |
381 | 381 | |
382 | 382 | // Still no module? it's an error |
383 | - if(!$this->module) |
|
383 | + if (!$this->module) |
|
384 | 384 | { |
385 | 385 | $this->error = 'msg_module_is_not_exists'; |
386 | 386 | $this->httpStatusCode = '404'; |
387 | 387 | } |
388 | 388 | |
389 | 389 | // If mid exists, set mid into context |
390 | - if($this->mid) |
|
390 | + if ($this->mid) |
|
391 | 391 | { |
392 | 392 | Context::set('mid', $this->mid, TRUE); |
393 | 393 | } |
394 | 394 | |
395 | 395 | // Call a trigger after moduleHandler init |
396 | 396 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
397 | - if(!$output->toBool()) |
|
397 | + if (!$output->toBool()) |
|
398 | 398 | { |
399 | 399 | $this->error = $output->getMessage(); |
400 | 400 | return TRUE; |
@@ -416,14 +416,14 @@ discard block |
||
416 | 416 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
417 | 417 | |
418 | 418 | // If error occurred while preparation, return a message instance |
419 | - if($this->error) |
|
419 | + if ($this->error) |
|
420 | 420 | { |
421 | 421 | $this->_setInputErrorToContext(); |
422 | 422 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
423 | 423 | $oMessageObject->setError(-1); |
424 | 424 | $oMessageObject->setMessage($this->error); |
425 | 425 | $oMessageObject->dispMessage(); |
426 | - if($this->httpStatusCode) |
|
426 | + if ($this->httpStatusCode) |
|
427 | 427 | { |
428 | 428 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
429 | 429 | } |
@@ -434,22 +434,22 @@ discard block |
||
434 | 434 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
435 | 435 | |
436 | 436 | // If not installed yet, modify act |
437 | - if($this->module == "install") |
|
437 | + if ($this->module == "install") |
|
438 | 438 | { |
439 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
439 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
440 | 440 | { |
441 | 441 | $this->act = $xml_info->default_index_act; |
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | 445 | // if act exists, find type of the action, if not use default index act |
446 | - if(!$this->act) |
|
446 | + if (!$this->act) |
|
447 | 447 | { |
448 | 448 | $this->act = $xml_info->default_index_act; |
449 | 449 | } |
450 | 450 | |
451 | 451 | // still no act means error |
452 | - if(!$this->act) |
|
452 | + if (!$this->act) |
|
453 | 453 | { |
454 | 454 | $this->error = 'msg_module_is_not_exists'; |
455 | 455 | $this->httpStatusCode = '404'; |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | $oMessageObject->setError(-1); |
460 | 460 | $oMessageObject->setMessage($this->error); |
461 | 461 | $oMessageObject->dispMessage(); |
462 | - if($this->httpStatusCode) |
|
462 | + if ($this->httpStatusCode) |
|
463 | 463 | { |
464 | 464 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
465 | 465 | } |
@@ -470,17 +470,17 @@ discard block |
||
470 | 470 | $type = $xml_info->action->{$this->act}->type; |
471 | 471 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
472 | 472 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
473 | - if(!$kind && $this->module == 'admin') |
|
473 | + if (!$kind && $this->module == 'admin') |
|
474 | 474 | { |
475 | 475 | $kind = 'admin'; |
476 | 476 | } |
477 | 477 | |
478 | 478 | // check REQUEST_METHOD in controller |
479 | - if($type == 'controller') |
|
479 | + if ($type == 'controller') |
|
480 | 480 | { |
481 | 481 | $allowedMethod = $xml_info->action->{$this->act}->method; |
482 | 482 | |
483 | - if(!$allowedMethod) |
|
483 | + if (!$allowedMethod) |
|
484 | 484 | { |
485 | 485 | $allowedMethodList[0] = 'POST'; |
486 | 486 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
490 | 490 | } |
491 | 491 | |
492 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
492 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
493 | 493 | { |
494 | 494 | $this->error = "msg_invalid_request"; |
495 | 495 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | - if($this->module_info->use_mobile != "Y") |
|
503 | + if ($this->module_info->use_mobile != "Y") |
|
504 | 504 | { |
505 | 505 | Mobile::setMobile(FALSE); |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | |
510 | 510 | // check CSRF for non-GET actions |
511 | 511 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
512 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
512 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
513 | 513 | { |
514 | 514 | $this->error = 'msg_invalid_request'; |
515 | 515 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | // Admin ip |
523 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
523 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
524 | 524 | { |
525 | 525 | $this->_setInputErrorToContext(); |
526 | 526 | $this->error = "msg_not_permitted_act"; |
@@ -532,13 +532,13 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | // if(type == view, and case for using mobilephone) |
535 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
535 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
536 | 536 | { |
537 | 537 | $orig_type = "view"; |
538 | 538 | $type = "mobile"; |
539 | 539 | // create a module instance |
540 | 540 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
541 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
541 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
542 | 542 | { |
543 | 543 | $type = $orig_type; |
544 | 544 | Mobile::setMobile(FALSE); |
@@ -551,14 +551,14 @@ discard block |
||
551 | 551 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
552 | 552 | } |
553 | 553 | |
554 | - if(!is_object($oModule)) |
|
554 | + if (!is_object($oModule)) |
|
555 | 555 | { |
556 | 556 | $this->_setInputErrorToContext(); |
557 | 557 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
558 | 558 | $oMessageObject->setError(-1); |
559 | 559 | $oMessageObject->setMessage($this->error); |
560 | 560 | $oMessageObject->dispMessage(); |
561 | - if($this->httpStatusCode) |
|
561 | + if ($this->httpStatusCode) |
|
562 | 562 | { |
563 | 563 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
564 | 564 | } |
@@ -566,10 +566,10 @@ discard block |
||
566 | 566 | } |
567 | 567 | |
568 | 568 | // If there is no such action in the module object |
569 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
569 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
570 | 570 | { |
571 | 571 | |
572 | - if(!Context::isInstalled()) |
|
572 | + if (!Context::isInstalled()) |
|
573 | 573 | { |
574 | 574 | $this->_setInputErrorToContext(); |
575 | 575 | $this->error = 'msg_invalid_request'; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | $oMessageObject->setError(-1); |
578 | 578 | $oMessageObject->setMessage($this->error); |
579 | 579 | $oMessageObject->dispMessage(); |
580 | - if($this->httpStatusCode) |
|
580 | + if ($this->httpStatusCode) |
|
581 | 581 | { |
582 | 582 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
583 | 583 | } |
@@ -586,12 +586,12 @@ discard block |
||
586 | 586 | |
587 | 587 | $forward = NULL; |
588 | 588 | // 1. Look for the module with action name |
589 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
589 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
590 | 590 | { |
591 | - $module = strtolower($matches[2] . $matches[3]); |
|
591 | + $module = strtolower($matches[2].$matches[3]); |
|
592 | 592 | $xml_info = $oModuleModel->getModuleActionXml($module); |
593 | 593 | |
594 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
594 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
595 | 595 | { |
596 | 596 | $forward = new stdClass(); |
597 | 597 | $forward->module = $module; |
@@ -611,12 +611,12 @@ discard block |
||
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | - if(!$forward) |
|
614 | + if (!$forward) |
|
615 | 615 | { |
616 | 616 | $forward = $oModuleModel->getActionForward($this->act); |
617 | 617 | } |
618 | 618 | |
619 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
619 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
620 | 620 | { |
621 | 621 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
622 | 622 | $type = $forward->type; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | |
629 | 629 | // check CSRF for non-GET actions |
630 | 630 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
631 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
631 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
632 | 632 | { |
633 | 633 | $this->error = 'msg_invalid_request'; |
634 | 634 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -640,11 +640,11 @@ discard block |
||
640 | 640 | |
641 | 641 | // SECISSUE also check foward act method |
642 | 642 | // check REQUEST_METHOD in controller |
643 | - if($type == 'controller') |
|
643 | + if ($type == 'controller') |
|
644 | 644 | { |
645 | 645 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
646 | 646 | |
647 | - if(!$allowedMethod) |
|
647 | + if (!$allowedMethod) |
|
648 | 648 | { |
649 | 649 | $allowedMethodList[0] = 'POST'; |
650 | 650 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
654 | 654 | } |
655 | 655 | |
656 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
656 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
657 | 657 | { |
658 | 658 | $this->error = "msg_invalid_request"; |
659 | 659 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -664,13 +664,13 @@ discard block |
||
664 | 664 | } |
665 | 665 | } |
666 | 666 | |
667 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
667 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
668 | 668 | { |
669 | 669 | $orig_type = "view"; |
670 | 670 | $type = "mobile"; |
671 | 671 | // create a module instance |
672 | 672 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
673 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
673 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
674 | 674 | { |
675 | 675 | $type = $orig_type; |
676 | 676 | Mobile::setMobile(FALSE); |
@@ -682,25 +682,25 @@ discard block |
||
682 | 682 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
683 | 683 | } |
684 | 684 | |
685 | - if(!is_object($oModule)) |
|
685 | + if (!is_object($oModule)) |
|
686 | 686 | { |
687 | 687 | $this->_setInputErrorToContext(); |
688 | 688 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
689 | 689 | $oMessageObject->setError(-1); |
690 | 690 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
691 | 691 | $oMessageObject->dispMessage(); |
692 | - if($this->httpStatusCode) |
|
692 | + if ($this->httpStatusCode) |
|
693 | 693 | { |
694 | 694 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
695 | 695 | } |
696 | 696 | return $oMessageObject; |
697 | 697 | } |
698 | 698 | |
699 | - if($this->module == "admin" && $type == "view") |
|
699 | + if ($this->module == "admin" && $type == "view") |
|
700 | 700 | { |
701 | - if($logged_info->is_admin == 'Y') |
|
701 | + if ($logged_info->is_admin == 'Y') |
|
702 | 702 | { |
703 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
703 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
704 | 704 | { |
705 | 705 | $oAdminView = getAdminView('admin'); |
706 | 706 | $oAdminView->makeGnbUrl($forward->module); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | return $oMessageObject; |
721 | 721 | } |
722 | 722 | } |
723 | - if($kind == 'admin') |
|
723 | + if ($kind == 'admin') |
|
724 | 724 | { |
725 | 725 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
726 | - if(!$grant->manager) |
|
726 | + if (!$grant->manager) |
|
727 | 727 | { |
728 | 728 | $this->_setInputErrorToContext(); |
729 | 729 | $this->error = 'msg_is_not_manager'; |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | } |
736 | 736 | else |
737 | 737 | { |
738 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
738 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
739 | 739 | { |
740 | 740 | $this->_setInputErrorToContext(); |
741 | 741 | $this->error = 'msg_is_not_administrator'; |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | } |
749 | 749 | } |
750 | 750 | } |
751 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
751 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
752 | 752 | { |
753 | 753 | $this->act = $xml_info->default_index_act; |
754 | 754 | } |
@@ -762,16 +762,16 @@ discard block |
||
762 | 762 | } |
763 | 763 | |
764 | 764 | // ruleset check... |
765 | - if(!empty($ruleset)) |
|
765 | + if (!empty($ruleset)) |
|
766 | 766 | { |
767 | 767 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
768 | 768 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
769 | - if(!empty($rulesetFile)) |
|
769 | + if (!empty($rulesetFile)) |
|
770 | 770 | { |
771 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
771 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
772 | 772 | { |
773 | 773 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
774 | - foreach($errorLang as $key => $val) |
|
774 | + foreach ($errorLang as $key => $val) |
|
775 | 775 | { |
776 | 776 | Context::setLang($key, $val); |
777 | 777 | } |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | |
781 | 781 | $Validator = new Validator($rulesetFile); |
782 | 782 | $result = $Validator->validate(); |
783 | - if(!$result) |
|
783 | + if (!$result) |
|
784 | 784 | { |
785 | 785 | $lastError = $Validator->getLastError(); |
786 | 786 | $returnUrl = Context::get('error_return_url'); |
@@ -812,26 +812,26 @@ discard block |
||
812 | 812 | 'dispLayoutPreviewWithModule' => 1 |
813 | 813 | ); |
814 | 814 | $db_use_mobile = Mobile::isMobileEnabled(); |
815 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
815 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
816 | 816 | { |
817 | 817 | global $lang; |
818 | 818 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
819 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
819 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
820 | 820 | Context::addHtmlHeader($header); |
821 | 821 | Context::addHtmlFooter($footer); |
822 | 822 | } |
823 | 823 | |
824 | - if($type == "view" && $kind != 'admin') |
|
824 | + if ($type == "view" && $kind != 'admin') |
|
825 | 825 | { |
826 | 826 | $module_config = $oModuleModel->getModuleConfig('module'); |
827 | - if($module_config->htmlFooter) |
|
827 | + if ($module_config->htmlFooter) |
|
828 | 828 | { |
829 | 829 | Context::addHtmlFooter($module_config->htmlFooter); |
830 | 830 | } |
831 | - if($module_config->siteTitle) |
|
831 | + if ($module_config->siteTitle) |
|
832 | 832 | { |
833 | 833 | $siteTitle = Context::getBrowserTitle(); |
834 | - if(!$siteTitle) |
|
834 | + if (!$siteTitle) |
|
835 | 835 | { |
836 | 836 | Context::setBrowserTitle($module_config->siteTitle); |
837 | 837 | } |
@@ -844,18 +844,18 @@ discard block |
||
844 | 844 | $procResult = $oModule->proc(); |
845 | 845 | |
846 | 846 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
847 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
847 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
848 | 848 | { |
849 | 849 | $error = $oModule->getError(); |
850 | 850 | $message = $oModule->getMessage(); |
851 | 851 | $messageType = $oModule->getMessageType(); |
852 | 852 | $redirectUrl = $oModule->getRedirectUrl(); |
853 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
853 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
854 | 854 | |
855 | - if(!$procResult) |
|
855 | + if (!$procResult) |
|
856 | 856 | { |
857 | 857 | $this->error = $message; |
858 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
858 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
859 | 859 | { |
860 | 860 | $redirectUrl = Context::get('error_return_url'); |
861 | 861 | } |
@@ -868,13 +868,13 @@ discard block |
||
868 | 868 | |
869 | 869 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
870 | 870 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
871 | - if($message != 'success') |
|
871 | + if ($message != 'success') |
|
872 | 872 | { |
873 | 873 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
874 | 874 | } |
875 | 875 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
876 | 876 | |
877 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
877 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
878 | 878 | { |
879 | 879 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
880 | 880 | } |
@@ -890,27 +890,27 @@ discard block |
||
890 | 890 | * */ |
891 | 891 | function _setInputErrorToContext() |
892 | 892 | { |
893 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
893 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
894 | 894 | { |
895 | 895 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
896 | 896 | } |
897 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
897 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
898 | 898 | { |
899 | 899 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
900 | 900 | } |
901 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
901 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
902 | 902 | { |
903 | 903 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
904 | 904 | } |
905 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
905 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
906 | 906 | { |
907 | 907 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
908 | 908 | } |
909 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
909 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
910 | 910 | { |
911 | 911 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
912 | 912 | } |
913 | - if(count($_SESSION['INPUT_ERROR'])) |
|
913 | + if (count($_SESSION['INPUT_ERROR'])) |
|
914 | 914 | { |
915 | 915 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
916 | 916 | } |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | { |
941 | 941 | $requestVars = Context::getRequestVars(); |
942 | 942 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
943 | - foreach($requestVars AS $key => $value) |
|
943 | + foreach ($requestVars AS $key => $value) |
|
944 | 944 | { |
945 | 945 | $_SESSION['INPUT_ERROR'][$key] = $value; |
946 | 946 | } |
@@ -954,41 +954,41 @@ discard block |
||
954 | 954 | function displayContent($oModule = NULL) |
955 | 955 | { |
956 | 956 | // If the module is not set or not an object, set error |
957 | - if(!$oModule || !is_object($oModule)) |
|
957 | + if (!$oModule || !is_object($oModule)) |
|
958 | 958 | { |
959 | 959 | $this->error = 'msg_module_is_not_exists'; |
960 | 960 | $this->httpStatusCode = '404'; |
961 | 961 | } |
962 | 962 | |
963 | 963 | // If connection to DB has a problem even though it's not install module, set error |
964 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
964 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
965 | 965 | { |
966 | 966 | $this->error = 'msg_dbconnect_failed'; |
967 | 967 | } |
968 | 968 | |
969 | 969 | // Call trigger after moduleHandler proc |
970 | 970 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
971 | - if(!$output->toBool()) |
|
971 | + if (!$output->toBool()) |
|
972 | 972 | { |
973 | 973 | $this->error = $output->getMessage(); |
974 | 974 | } |
975 | 975 | |
976 | 976 | // Use message view object, if HTML call |
977 | 977 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
978 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
978 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
979 | 979 | { |
980 | 980 | |
981 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
981 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
982 | 982 | { |
983 | 983 | $display_handler = new DisplayHandler(); |
984 | 984 | $display_handler->_debugOutput(); |
985 | 985 | |
986 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
986 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
987 | 987 | return; |
988 | 988 | } |
989 | 989 | |
990 | 990 | // If error occurred, handle it |
991 | - if($this->error) |
|
991 | + if ($this->error) |
|
992 | 992 | { |
993 | 993 | // display content with message module instance |
994 | 994 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $oMessageObject->setMessage($this->error); |
998 | 998 | $oMessageObject->dispMessage(); |
999 | 999 | |
1000 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1000 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1001 | 1001 | { |
1002 | 1002 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
1003 | 1003 | $oMessageObject->setTemplateFile('http_status_code'); |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // If module was called normally, change the templates of the module into ones of the message view module |
1007 | - if($oModule) |
|
1007 | + if ($oModule) |
|
1008 | 1008 | { |
1009 | 1009 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
1010 | 1010 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | // Check if layout_srl exists for the module |
1022 | - if(Mobile::isFromMobilePhone()) |
|
1022 | + if (Mobile::isFromMobilePhone()) |
|
1023 | 1023 | { |
1024 | 1024 | $layout_srl = $oModule->module_info->mlayout_srl; |
1025 | 1025 | } |
@@ -1029,58 +1029,58 @@ discard block |
||
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | // if layout_srl is rollback by module, set default layout |
1032 | - if($layout_srl == -1) |
|
1032 | + if ($layout_srl == -1) |
|
1033 | 1033 | { |
1034 | 1034 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
1035 | 1035 | $oLayoutAdminModel = getAdminModel('layout'); |
1036 | 1036 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
1039 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
1040 | 1040 | { |
1041 | 1041 | |
1042 | 1042 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
1043 | 1043 | $oLayoutModel = getModel('layout'); |
1044 | 1044 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
1045 | - if($layout_info) |
|
1045 | + if ($layout_info) |
|
1046 | 1046 | { |
1047 | 1047 | |
1048 | 1048 | // Input extra_vars into $layout_info |
1049 | - if($layout_info->extra_var_count) |
|
1049 | + if ($layout_info->extra_var_count) |
|
1050 | 1050 | { |
1051 | 1051 | |
1052 | - foreach($layout_info->extra_var as $var_id => $val) |
|
1052 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
1053 | 1053 | { |
1054 | - if($val->type == 'image') |
|
1054 | + if ($val->type == 'image') |
|
1055 | 1055 | { |
1056 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1056 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1057 | 1057 | { |
1058 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
1058 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | $layout_info->{$var_id} = $val->value; |
1062 | 1062 | } |
1063 | 1063 | } |
1064 | 1064 | // Set menus into context |
1065 | - if($layout_info->menu_count) |
|
1065 | + if ($layout_info->menu_count) |
|
1066 | 1066 | { |
1067 | - foreach($layout_info->menu as $menu_id => $menu) |
|
1067 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
1068 | 1068 | { |
1069 | 1069 | // set default menu set(included home menu) |
1070 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
1070 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
1071 | 1071 | { |
1072 | 1072 | $oMenuAdminController = getAdminController('menu'); |
1073 | 1073 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
1074 | 1074 | |
1075 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
1075 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
1076 | 1076 | { |
1077 | 1077 | include($homeMenuCacheFile); |
1078 | 1078 | } |
1079 | 1079 | |
1080 | - if(!$menu->menu_srl) |
|
1080 | + if (!$menu->menu_srl) |
|
1081 | 1081 | { |
1082 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
1083 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
1082 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
1083 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
1084 | 1084 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
1085 | 1085 | } |
1086 | 1086 | else |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | $php_file = FileHandler::exists($menu->php_file); |
1094 | - if($php_file) |
|
1094 | + if ($php_file) |
|
1095 | 1095 | { |
1096 | 1096 | include($php_file); |
1097 | 1097 | } |
@@ -1107,17 +1107,17 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | // If layout was modified, use the modified version |
1109 | 1109 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
1110 | - if(file_exists($edited_layout)) |
|
1110 | + if (file_exists($edited_layout)) |
|
1111 | 1111 | { |
1112 | 1112 | $oModule->setEditedLayoutFile($edited_layout); |
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | $isLayoutDrop = Context::get('isLayoutDrop'); |
1117 | - if($isLayoutDrop) |
|
1117 | + if ($isLayoutDrop) |
|
1118 | 1118 | { |
1119 | 1119 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
1120 | - if($kind == 'admin') |
|
1120 | + if ($kind == 'admin') |
|
1121 | 1121 | { |
1122 | 1122 | $oModule->setLayoutFile('popup_layout'); |
1123 | 1123 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | function &getModuleInstance($module, $type = 'view', $kind = '') |
1156 | 1156 | { |
1157 | 1157 | |
1158 | - if(__DEBUG__ == 3) |
|
1158 | + if (__DEBUG__ == 3) |
|
1159 | 1159 | { |
1160 | 1160 | $start_time = getMicroTime(); |
1161 | 1161 | } |
@@ -1165,51 +1165,51 @@ discard block |
||
1165 | 1165 | $type = strtolower($type); |
1166 | 1166 | |
1167 | 1167 | $kinds = array('svc' => 1, 'admin' => 1); |
1168 | - if(!isset($kinds[$kind])) |
|
1168 | + if (!isset($kinds[$kind])) |
|
1169 | 1169 | { |
1170 | 1170 | $kind = 'svc'; |
1171 | 1171 | } |
1172 | 1172 | |
1173 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
1173 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
1174 | 1174 | |
1175 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1175 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1176 | 1176 | { |
1177 | 1177 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | // if there is no instance of the module in global variable, create a new one |
1181 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1181 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1182 | 1182 | { |
1183 | 1183 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1184 | 1184 | |
1185 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1185 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1186 | 1186 | { |
1187 | 1187 | $module = $parent_module; |
1188 | 1188 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Check if the base class and instance class exist |
1192 | - if(!class_exists($module, true)) |
|
1192 | + if (!class_exists($module, true)) |
|
1193 | 1193 | { |
1194 | 1194 | return NULL; |
1195 | 1195 | } |
1196 | - if(!class_exists($instance_name, true)) |
|
1196 | + if (!class_exists($instance_name, true)) |
|
1197 | 1197 | { |
1198 | 1198 | return NULL; |
1199 | 1199 | } |
1200 | 1200 | |
1201 | 1201 | // Create an instance |
1202 | 1202 | $oModule = new $instance_name(); |
1203 | - if(!is_object($oModule)) |
|
1203 | + if (!is_object($oModule)) |
|
1204 | 1204 | { |
1205 | 1205 | return NULL; |
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | // Load language files for the class |
1209 | - Context::loadLang($class_path . 'lang'); |
|
1210 | - if($extend_module) |
|
1209 | + Context::loadLang($class_path.'lang'); |
|
1210 | + if ($extend_module) |
|
1211 | 1211 | { |
1212 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
1212 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | // Set variables to the instance |
@@ -1217,10 +1217,10 @@ discard block |
||
1217 | 1217 | $oModule->setModulePath($class_path); |
1218 | 1218 | |
1219 | 1219 | // If the module has a constructor, run it. |
1220 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1220 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1221 | 1221 | { |
1222 | 1222 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
1223 | - if(@method_exists($oModule, $instance_name)) |
|
1223 | + if (@method_exists($oModule, $instance_name)) |
|
1224 | 1224 | { |
1225 | 1225 | $oModule->{$instance_name}(); |
1226 | 1226 | } |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - if(__DEBUG__ == 3) |
|
1233 | + if (__DEBUG__ == 3) |
|
1234 | 1234 | { |
1235 | 1235 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
1236 | 1236 | } |
@@ -1246,17 +1246,17 @@ discard block |
||
1246 | 1246 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
1247 | 1247 | $highClassFile = FileHandler::getRealPath($highClassFile); |
1248 | 1248 | |
1249 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
1250 | - if(!in_array($type, $types)) |
|
1249 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
1250 | + if (!in_array($type, $types)) |
|
1251 | 1251 | { |
1252 | 1252 | $type = $types[0]; |
1253 | 1253 | } |
1254 | - if($type == 'class') |
|
1254 | + if ($type == 'class') |
|
1255 | 1255 | { |
1256 | 1256 | $instanceName = '%s'; |
1257 | 1257 | $classFile = '%s%s.%s.php'; |
1258 | 1258 | } |
1259 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1259 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
1260 | 1260 | { |
1261 | 1261 | $instanceName = '%sAdmin%s'; |
1262 | 1262 | $classFile = '%s%s.admin.%s.php'; |
@@ -1281,26 +1281,26 @@ discard block |
||
1281 | 1281 | function triggerCall($trigger_name, $called_position, &$obj) |
1282 | 1282 | { |
1283 | 1283 | // skip if not installed |
1284 | - if(!Context::isInstalled()) |
|
1284 | + if (!Context::isInstalled()) |
|
1285 | 1285 | { |
1286 | 1286 | return new BaseObject(); |
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | $oModuleModel = getModel('module'); |
1290 | 1290 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
1291 | - if(!$triggers || count($triggers) < 1) |
|
1291 | + if (!$triggers || count($triggers) < 1) |
|
1292 | 1292 | { |
1293 | 1293 | return new BaseObject(); |
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | //store before trigger call time |
1297 | 1297 | $before_trigger_time = NULL; |
1298 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
1298 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
1299 | 1299 | { |
1300 | 1300 | $before_trigger_time = microtime(true); |
1301 | 1301 | } |
1302 | 1302 | |
1303 | - foreach($triggers as $item) |
|
1303 | + foreach ($triggers as $item) |
|
1304 | 1304 | { |
1305 | 1305 | $module = $item->module; |
1306 | 1306 | $type = $item->type; |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | |
1309 | 1309 | // todo why don't we call a normal class object ? |
1310 | 1310 | $oModule = getModule($module, $type); |
1311 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
1311 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
1312 | 1312 | { |
1313 | 1313 | continue; |
1314 | 1314 | } |
@@ -1321,12 +1321,12 @@ discard block |
||
1321 | 1321 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
1322 | 1322 | |
1323 | 1323 | $slowlog = new stdClass; |
1324 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
1325 | - $slowlog->called = $module . '.' . $called_method; |
|
1324 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
1325 | + $slowlog->called = $module.'.'.$called_method; |
|
1326 | 1326 | $slowlog->called_extension = $module; |
1327 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1327 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1328 | 1328 | |
1329 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1329 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1330 | 1330 | { |
1331 | 1331 | return $output; |
1332 | 1332 | } |
@@ -1411,9 +1411,9 @@ discard block |
||
1411 | 1411 | '511' => 'Network Authentication Required', |
1412 | 1412 | ); |
1413 | 1413 | $statusMessage = $statusMessageList[$code]; |
1414 | - if(!$statusMessage) |
|
1414 | + if (!$statusMessage) |
|
1415 | 1415 | { |
1416 | - $statusMessage = 'HTTP ' . $code; |
|
1416 | + $statusMessage = 'HTTP '.$code; |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | Context::set('http_status_code', $code); |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * */ |
45 | 45 | function setModulePath($path) |
46 | 46 | { |
47 | - if(substr_compare($path, '/', -1) !== 0) |
|
47 | + if (substr_compare($path, '/', -1) !== 0) |
|
48 | 48 | { |
49 | - $path.='/'; |
|
49 | + $path .= '/'; |
|
50 | 50 | } |
51 | 51 | $this->module_path = $path; |
52 | 52 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | function setRedirectUrl($url = './', $output = NULL) |
61 | 61 | { |
62 | 62 | $ajaxRequestMethod = array_flip($this->ajaxRequestMethod); |
63 | - if(!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
63 | + if (!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
64 | 64 | { |
65 | 65 | $this->add('redirect_url', $url); |
66 | 66 | } |
67 | 67 | |
68 | - if($output !== NULL && is_object($output)) |
|
68 | + if ($output !== NULL && is_object($output)) |
|
69 | 69 | { |
70 | 70 | return $output; |
71 | 71 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $type = $this->get('message_type'); |
112 | 112 | $typeList = array('error' => 1, 'info' => 1, 'update' => 1); |
113 | - if(!isset($typeList[$type])) |
|
113 | + if (!isset($typeList[$type])) |
|
114 | 114 | { |
115 | 115 | $type = $this->getError() ? 'error' : 'info'; |
116 | 116 | } |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | $oModuleModel = getModel('module'); |
162 | 162 | // permission settings. access, manager(== is_admin) are fixed and privilege name in XE |
163 | 163 | $module_srl = Context::get('module_srl'); |
164 | - if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
164 | + if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
165 | 165 | { |
166 | 166 | $request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
167 | - if($request_module->module_srl == $module_srl) |
|
167 | + if ($request_module->module_srl == $module_srl) |
|
168 | 168 | { |
169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
175 | 175 | // have at least access grant |
176 | - if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
176 | + if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
177 | 177 | { |
178 | 178 | $grant->access = 1; |
179 | 179 | } |
@@ -181,24 +181,24 @@ discard block |
||
181 | 181 | // display no permission if the current module doesn't have an access privilege |
182 | 182 | //if(!$grant->access) return $this->stop("msg_not_permitted"); |
183 | 183 | // checks permission and action if you don't have an admin privilege |
184 | - if(!$grant->manager) |
|
184 | + if (!$grant->manager) |
|
185 | 185 | { |
186 | 186 | // get permission types(guest, member, manager, root) of the currently requested action |
187 | 187 | $permission_target = $xml_info->permission->{$this->act}; |
188 | 188 | // check manager if a permission in module.xml otherwise action if no permission |
189 | - if(!$permission_target && substr_count($this->act, 'Admin')) |
|
189 | + if (!$permission_target && substr_count($this->act, 'Admin')) |
|
190 | 190 | { |
191 | 191 | $permission_target = 'manager'; |
192 | 192 | } |
193 | 193 | // Check permissions |
194 | - switch($permission_target) |
|
194 | + switch ($permission_target) |
|
195 | 195 | { |
196 | 196 | case 'root' : |
197 | 197 | case 'manager' : |
198 | 198 | $this->stop('msg_is_not_administrator'); |
199 | 199 | return; |
200 | 200 | case 'member' : |
201 | - if(!$is_logged) |
|
201 | + if (!$is_logged) |
|
202 | 202 | { |
203 | 203 | $this->stop('msg_not_permitted_act'); |
204 | 204 | return; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | $this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl); |
215 | 215 | |
216 | - if(method_exists($this, 'init')) |
|
216 | + if (method_exists($this, 'init')) |
|
217 | 217 | { |
218 | 218 | $this->init(); |
219 | 219 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * */ |
252 | 252 | function setTemplateFile($filename) |
253 | 253 | { |
254 | - if(isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
254 | + if (isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
255 | 255 | { |
256 | 256 | $filename .= '.html'; |
257 | 257 | } |
@@ -274,14 +274,14 @@ discard block |
||
274 | 274 | * */ |
275 | 275 | function setTemplatePath($path) |
276 | 276 | { |
277 | - if(!$path) return; |
|
277 | + if (!$path) return; |
|
278 | 278 | |
279 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
279 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
280 | 280 | { |
281 | - $path = './' . $path; |
|
281 | + $path = './'.$path; |
|
282 | 282 | } |
283 | 283 | |
284 | - if(substr_compare($path, '/', -1) !== 0) |
|
284 | + if (substr_compare($path, '/', -1) !== 0) |
|
285 | 285 | { |
286 | 286 | $path .= '/'; |
287 | 287 | } |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | * */ |
305 | 305 | function setEditedLayoutFile($filename) |
306 | 306 | { |
307 | - if(!$filename) return; |
|
307 | + if (!$filename) return; |
|
308 | 308 | |
309 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
309 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
310 | 310 | { |
311 | 311 | $filename .= '.html'; |
312 | 312 | } |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * */ |
330 | 330 | function setLayoutFile($filename) |
331 | 331 | { |
332 | - if(!$filename) return; |
|
332 | + if (!$filename) return; |
|
333 | 333 | |
334 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
334 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
335 | 335 | { |
336 | 336 | $filename .= '.html'; |
337 | 337 | } |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * */ |
354 | 354 | function setLayoutPath($path) |
355 | 355 | { |
356 | - if(!$path) return; |
|
356 | + if (!$path) return; |
|
357 | 357 | |
358 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
358 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
359 | 359 | { |
360 | - $path = './' . $path; |
|
360 | + $path = './'.$path; |
|
361 | 361 | } |
362 | - if(substr_compare($path, '/', -1) !== 0) |
|
362 | + if (substr_compare($path, '/', -1) !== 0) |
|
363 | 363 | { |
364 | 364 | $path .= '/'; |
365 | 365 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | function proc() |
383 | 383 | { |
384 | 384 | // pass if stop_proc is true |
385 | - if($this->stop_proc) |
|
385 | + if ($this->stop_proc) |
|
386 | 386 | { |
387 | 387 | debugPrint($this->message, 'ERROR'); |
388 | 388 | return FALSE; |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | // trigger call |
392 | 392 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); |
393 | - if(!$triggerOutput->toBool()) |
|
393 | + if (!$triggerOutput->toBool()) |
|
394 | 394 | { |
395 | 395 | $this->setError($triggerOutput->getError()); |
396 | 396 | $this->setMessage($triggerOutput->getMessage()); |
@@ -401,12 +401,12 @@ discard block |
||
401 | 401 | $called_position = 'before_module_proc'; |
402 | 402 | $oAddonController = getController('addon'); |
403 | 403 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
404 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
405 | 405 | |
406 | - if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
406 | + if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
407 | 407 | { |
408 | 408 | // Check permissions |
409 | - if($this->module_srl && !$this->grant->access) |
|
409 | + if ($this->module_srl && !$this->grant->access) |
|
410 | 410 | { |
411 | 411 | $this->stop("msg_not_permitted_act"); |
412 | 412 | return FALSE; |
@@ -415,21 +415,21 @@ discard block |
||
415 | 415 | // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) |
416 | 416 | $is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N')); |
417 | 417 | $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); |
418 | - if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
418 | + if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
419 | 419 | { |
420 | 420 | $dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins'; |
421 | 421 | $valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin'; |
422 | 422 | $oModuleModel = getModel('module'); |
423 | 423 | $skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
424 | 424 | $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); |
425 | - if($this->module == 'page') |
|
425 | + if ($this->module == 'page') |
|
426 | 426 | { |
427 | 427 | $this->module_info->{$valueName} = $skinName; |
428 | 428 | } |
429 | 429 | else |
430 | 430 | { |
431 | 431 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
432 | - if(!$isTemplatPath) |
|
432 | + if (!$isTemplatPath) |
|
433 | 433 | { |
434 | 434 | $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); |
435 | 435 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | // trigger call |
451 | 451 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); |
452 | - if(!$triggerOutput->toBool()) |
|
452 | + if (!$triggerOutput->toBool()) |
|
453 | 453 | { |
454 | 454 | $this->setError($triggerOutput->getError()); |
455 | 455 | $this->setMessage($triggerOutput->getMessage()); |
@@ -460,25 +460,25 @@ discard block |
||
460 | 460 | $called_position = 'after_module_proc'; |
461 | 461 | $oAddonController = getController('addon'); |
462 | 462 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
463 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
464 | 464 | |
465 | - if(is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) |
|
465 | + if (is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) |
|
466 | 466 | { |
467 | 467 | $this->setError($output->getError()); |
468 | 468 | $this->setMessage($output->getMessage()); |
469 | 469 | |
470 | - if(!$output->toBool()) |
|
470 | + if (!$output->toBool()) |
|
471 | 471 | { |
472 | 472 | return FALSE; |
473 | 473 | } |
474 | 474 | } |
475 | 475 | // execute api methods of the module if view action is and result is XMLRPC or JSON |
476 | - if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile') |
|
476 | + if ($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile') |
|
477 | 477 | { |
478 | - if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
478 | + if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
479 | 479 | { |
480 | 480 | $oAPI = getAPI($this->module_info->module, 'api'); |
481 | - if(method_exists($oAPI, $this->act)) |
|
481 | + if (method_exists($oAPI, $this->act)) |
|
482 | 482 | { |
483 | 483 | $oAPI->{$this->act}($this); |
484 | 484 | } |
@@ -168,8 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
170 | 170 | } |
171 | - } |
|
172 | - else |
|
171 | + } else |
|
173 | 172 | { |
174 | 173 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
175 | 174 | // have at least access grant |
@@ -274,7 +273,9 @@ discard block |
||
274 | 273 | * */ |
275 | 274 | function setTemplatePath($path) |
276 | 275 | { |
277 | - if(!$path) return; |
|
276 | + if(!$path) { |
|
277 | + return; |
|
278 | + } |
|
278 | 279 | |
279 | 280 | if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
280 | 281 | { |
@@ -304,7 +305,9 @@ discard block |
||
304 | 305 | * */ |
305 | 306 | function setEditedLayoutFile($filename) |
306 | 307 | { |
307 | - if(!$filename) return; |
|
308 | + if(!$filename) { |
|
309 | + return; |
|
310 | + } |
|
308 | 311 | |
309 | 312 | if(substr_compare($filename, '.html', -5) !== 0) |
310 | 313 | { |
@@ -329,7 +332,9 @@ discard block |
||
329 | 332 | * */ |
330 | 333 | function setLayoutFile($filename) |
331 | 334 | { |
332 | - if(!$filename) return; |
|
335 | + if(!$filename) { |
|
336 | + return; |
|
337 | + } |
|
333 | 338 | |
334 | 339 | if(substr_compare($filename, '.html', -5) !== 0) |
335 | 340 | { |
@@ -353,7 +358,9 @@ discard block |
||
353 | 358 | * */ |
354 | 359 | function setLayoutPath($path) |
355 | 360 | { |
356 | - if(!$path) return; |
|
361 | + if(!$path) { |
|
362 | + return; |
|
363 | + } |
|
357 | 364 | |
358 | 365 | if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
359 | 366 | { |
@@ -401,7 +408,9 @@ discard block |
||
401 | 408 | $called_position = 'before_module_proc'; |
402 | 409 | $oAddonController = getController('addon'); |
403 | 410 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
411 | + if(FileHandler::exists($addon_file)) { |
|
412 | + include($addon_file); |
|
413 | + } |
|
405 | 414 | |
406 | 415 | if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
407 | 416 | { |
@@ -425,8 +434,7 @@ discard block |
||
425 | 434 | if($this->module == 'page') |
426 | 435 | { |
427 | 436 | $this->module_info->{$valueName} = $skinName; |
428 | - } |
|
429 | - else |
|
437 | + } else |
|
430 | 438 | { |
431 | 439 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
432 | 440 | if(!$isTemplatPath) |
@@ -441,8 +449,7 @@ discard block |
||
441 | 449 | Context::set('module_info', $this->module_info); |
442 | 450 | // Run |
443 | 451 | $output = $this->{$this->act}(); |
444 | - } |
|
445 | - else |
|
452 | + } else |
|
446 | 453 | { |
447 | 454 | return FALSE; |
448 | 455 | } |
@@ -460,7 +467,9 @@ discard block |
||
460 | 467 | $called_position = 'after_module_proc'; |
461 | 468 | $oAddonController = getController('addon'); |
462 | 469 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
470 | + if(FileHandler::exists($addon_file)) { |
|
471 | + include($addon_file); |
|
472 | + } |
|
464 | 473 | |
465 | 474 | if(is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) |
466 | 475 | { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * constructor |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function XEHttpRequest($host, $port, $scheme='') |
|
44 | + function XEHttpRequest($host, $port, $scheme = '') |
|
45 | 45 | { |
46 | 46 | $this->m_host = $host; |
47 | 47 | $this->m_port = $port; |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $this->addToHeader('Connection', 'close'); |
77 | 77 | |
78 | 78 | $method = strtoupper($method); |
79 | - if(!$allow_methods) |
|
79 | + if (!$allow_methods) |
|
80 | 80 | { |
81 | 81 | $allow_methods = explode(' ', 'GET POST PUT'); |
82 | 82 | } |
83 | - if(!in_array($method, $allow_methods)) |
|
83 | + if (!in_array($method, $allow_methods)) |
|
84 | 84 | { |
85 | 85 | $method = $allow_methods[0]; |
86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $timout = max((int) $timeout, 0); |
90 | 90 | |
91 | 91 | // list of post variables |
92 | - if(!is_array($post_vars)) |
|
92 | + if (!is_array($post_vars)) |
|
93 | 93 | { |
94 | 94 | $post_vars = array(); |
95 | 95 | } |
96 | 96 | |
97 | - if(FALSE && is_callable('curl_init')) |
|
97 | + if (FALSE && is_callable('curl_init')) |
|
98 | 98 | { |
99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
100 | 100 | } |
@@ -117,30 +117,30 @@ discard block |
||
117 | 117 | static $crlf = "\r\n"; |
118 | 118 | |
119 | 119 | $scheme = ''; |
120 | - if($this->m_scheme=='https') |
|
120 | + if ($this->m_scheme == 'https') |
|
121 | 121 | { |
122 | 122 | $scheme = 'ssl://'; |
123 | 123 | } |
124 | 124 | |
125 | - $sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
126 | - if(!$sock) |
|
125 | + $sock = @fsockopen($scheme.$this->m_host, $this->m_port, $errno, $errstr, $timeout); |
|
126 | + if (!$sock) |
|
127 | 127 | { |
128 | 128 | return new BaseObject(-1, 'socket_connect_failed'); |
129 | 129 | } |
130 | 130 | |
131 | 131 | $headers = $this->m_headers + array(); |
132 | - if(!isset($headers['Accept-Encoding'])) |
|
132 | + if (!isset($headers['Accept-Encoding'])) |
|
133 | 133 | { |
134 | 134 | $headers['Accept-Encoding'] = 'identity'; |
135 | 135 | } |
136 | 136 | |
137 | 137 | // post body |
138 | 138 | $post_body = ''; |
139 | - if($method == 'POST' && count($post_vars)) |
|
139 | + if ($method == 'POST' && count($post_vars)) |
|
140 | 140 | { |
141 | - foreach($post_vars as $key => $value) |
|
141 | + foreach ($post_vars as $key => $value) |
|
142 | 142 | { |
143 | - $post_body .= urlencode($key) . '=' . urlencode($value) . '&'; |
|
143 | + $post_body .= urlencode($key).'='.urlencode($value).'&'; |
|
144 | 144 | } |
145 | 145 | $post_body = substr($post_body, 0, -1); |
146 | 146 | |
@@ -149,35 +149,35 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $request = "$method $target HTTP/1.1$crlf"; |
152 | - foreach($headers as $equiv => $content) |
|
152 | + foreach ($headers as $equiv => $content) |
|
153 | 153 | { |
154 | 154 | $request .= "$equiv: $content$crlf"; |
155 | 155 | } |
156 | - $request .= $crlf . $post_body; |
|
156 | + $request .= $crlf.$post_body; |
|
157 | 157 | fwrite($sock, $request); |
158 | 158 | |
159 | 159 | list($httpver, $code, $status) = preg_split('/ +/', rtrim(fgets($sock)), 3); |
160 | 160 | |
161 | 161 | // read response headers |
162 | 162 | $is_chunked = FALSE; |
163 | - while(strlen(trim($line = fgets($sock)))) |
|
163 | + while (strlen(trim($line = fgets($sock)))) |
|
164 | 164 | { |
165 | 165 | list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2); |
166 | - if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
166 | + if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
167 | 167 | { |
168 | 168 | $is_chunked = TRUE; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | 172 | $body = ''; |
173 | - while(!feof($sock)) |
|
173 | + while (!feof($sock)) |
|
174 | 174 | { |
175 | - if($is_chunked) |
|
175 | + if ($is_chunked) |
|
176 | 176 | { |
177 | 177 | $chunk_size = hexdec(fgets($sock)); |
178 | - if($chunk_size) |
|
178 | + if ($chunk_size) |
|
179 | 179 | { |
180 | - $body .= fgets($sock, $chunk_size+1); |
|
180 | + $body .= fgets($sock, $chunk_size + 1); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | else |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
220 | 220 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
221 | 221 | |
222 | - switch($method) |
|
222 | + switch ($method) |
|
223 | 223 | { |
224 | 224 | case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true); |
225 | 225 | break; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | $arr_headers = array(); |
235 | - foreach($headers as $key => $value) |
|
235 | + foreach ($headers as $key => $value) |
|
236 | 236 | { |
237 | 237 | $arr_headers[] = "$key: $value"; |
238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers); |
241 | 241 | |
242 | 242 | $body = curl_exec($ch); |
243 | - if(curl_errno($ch)) |
|
243 | + if (curl_errno($ch)) |
|
244 | 244 | { |
245 | 245 | return new BaseObject(-1, 'socket_connect_failed'); |
246 | 246 | } |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | |
74 | 74 | function getType() |
75 | 75 | { |
76 | - if(isset($this->type)) |
|
76 | + if (isset($this->type)) |
|
77 | 77 | { |
78 | 78 | return $this->type; |
79 | 79 | } |
80 | - if(is_string($this->value)) |
|
80 | + if (is_string($this->value)) |
|
81 | 81 | { |
82 | 82 | return 'column_name'; |
83 | 83 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | function getValue() |
104 | 104 | { |
105 | - if(!isset($this->_value)) |
|
105 | + if (!isset($this->_value)) |
|
106 | 106 | { |
107 | 107 | $value = $this->getEscapedValue(); |
108 | 108 | $this->_value = $this->toString($value); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | function getUnescapedValue() |
129 | 129 | { |
130 | - if($this->value === 'null') |
|
130 | + if ($this->value === 'null') |
|
131 | 131 | { |
132 | 132 | return null; |
133 | 133 | } |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | */ |
142 | 142 | function toString($value) |
143 | 143 | { |
144 | - if(is_array($value)) |
|
144 | + if (is_array($value)) |
|
145 | 145 | { |
146 | - if(count($value) === 0) |
|
146 | + if (count($value) === 0) |
|
147 | 147 | { |
148 | 148 | return ''; |
149 | 149 | } |
150 | - if(count($value) === 1 && $value[0] === '') |
|
150 | + if (count($value) === 1 && $value[0] === '') |
|
151 | 151 | { |
152 | 152 | return ''; |
153 | 153 | } |
154 | - return '(' . implode(',', $value) . ')'; |
|
154 | + return '('.implode(',', $value).')'; |
|
155 | 155 | } |
156 | 156 | return $value; |
157 | 157 | } |
@@ -164,42 +164,42 @@ discard block |
||
164 | 164 | function escapeValue($value) |
165 | 165 | { |
166 | 166 | $column_type = $this->getType(); |
167 | - if($column_type == 'column_name') |
|
167 | + if ($column_type == 'column_name') |
|
168 | 168 | { |
169 | 169 | $dbParser = DB::getParser(); |
170 | 170 | return $dbParser->parseExpression($value); |
171 | 171 | } |
172 | - if(!isset($value)) |
|
172 | + if (!isset($value)) |
|
173 | 173 | { |
174 | 174 | return null; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $columnTypeList = array('date' => 1, 'varchar' => 1, 'char' => 1, 'text' => 1, 'bigtext' => 1); |
178 | - if(isset($columnTypeList[$column_type])) |
|
178 | + if (isset($columnTypeList[$column_type])) |
|
179 | 179 | { |
180 | - if(!is_array($value)) |
|
180 | + if (!is_array($value)) |
|
181 | 181 | { |
182 | 182 | $value = $this->_escapeStringValue($value); |
183 | 183 | } |
184 | 184 | else |
185 | 185 | { |
186 | - foreach($value as $key=>$val) |
|
186 | + foreach ($value as $key=>$val) |
|
187 | 187 | { |
188 | 188 | $value[$key] = $this->_escapeStringValue($val); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | - if($this->uses_default_value) |
|
192 | + if ($this->uses_default_value) |
|
193 | 193 | { |
194 | 194 | return $value; |
195 | 195 | } |
196 | - if($column_type == 'number') |
|
196 | + if ($column_type == 'number') |
|
197 | 197 | { |
198 | - if(is_array($value)) |
|
198 | + if (is_array($value)) |
|
199 | 199 | { |
200 | - foreach($value AS $key => $val) |
|
200 | + foreach ($value AS $key => $val) |
|
201 | 201 | { |
202 | - if(isset($val) && $val !== '') |
|
202 | + if (isset($val) && $val !== '') |
|
203 | 203 | { |
204 | 204 | $value[$key] = (int) $val; |
205 | 205 | } |
@@ -227,20 +227,20 @@ discard block |
||
227 | 227 | $value = preg_replace_callback($regex, array($this, 'utf8Replacer'), $value); |
228 | 228 | $db = DB::getInstance(); |
229 | 229 | $value = $db->addQuotes($value); |
230 | - return '\'' . $value . '\''; |
|
230 | + return '\''.$value.'\''; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | function utf8Replacer($captures) |
234 | 234 | { |
235 | - if(strlen($captures[1])) |
|
235 | + if (strlen($captures[1])) |
|
236 | 236 | { |
237 | 237 | // Valid byte sequence. Return unmodified. |
238 | 238 | return $captures[1]; |
239 | 239 | } |
240 | - else if(strlen($captures[2])) |
|
240 | + else if (strlen($captures[2])) |
|
241 | 241 | { |
242 | 242 | // Remove user defined area |
243 | - if("\xF3\xB0\x80\x80" <= $captures[2]) |
|
243 | + if ("\xF3\xB0\x80\x80" <= $captures[2]) |
|
244 | 244 | { |
245 | 245 | return; |
246 | 246 | } |
@@ -262,15 +262,15 @@ discard block |
||
262 | 262 | { |
263 | 263 | $type = $this->getType(); |
264 | 264 | $value = $this->getUnescapedValue(); |
265 | - if($type == 'column_name') |
|
265 | + if ($type == 'column_name') |
|
266 | 266 | { |
267 | 267 | return TRUE; |
268 | 268 | } |
269 | - if($type == 'number' && is_null($value)) |
|
269 | + if ($type == 'number' && is_null($value)) |
|
270 | 270 | { |
271 | 271 | return FALSE; |
272 | 272 | } |
273 | - if($type == 'number' && !is_numeric($value) && $this->uses_default_value) |
|
273 | + if ($type == 'number' && !is_numeric($value) && $this->uses_default_value) |
|
274 | 274 | { |
275 | 275 | return TRUE; |
276 | 276 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | function ensureDefaultValue($default_value) |
286 | 286 | { |
287 | - if($this->value === NULL || $this->value === '') |
|
287 | + if ($this->value === NULL || $this->value === '') |
|
288 | 288 | { |
289 | 289 | $this->value = $default_value; |
290 | 290 | $this->uses_default_value = TRUE; |
@@ -298,23 +298,23 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function checkFilter($filter_type) |
300 | 300 | { |
301 | - if(isset($this->value) && $this->value != '') |
|
301 | + if (isset($this->value) && $this->value != '') |
|
302 | 302 | { |
303 | 303 | global $lang; |
304 | 304 | $val = $this->value; |
305 | 305 | $key = $this->name; |
306 | - switch($filter_type) |
|
306 | + switch ($filter_type) |
|
307 | 307 | { |
308 | 308 | case 'email' : |
309 | 309 | case 'email_address' : |
310 | - if(!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val)) |
|
310 | + if (!preg_match('/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/is', $val)) |
|
311 | 311 | { |
312 | 312 | $this->isValid = FALSE; |
313 | 313 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_email, $lang->{$key} ? $lang->{$key} : $key)); |
314 | 314 | } |
315 | 315 | break; |
316 | 316 | case 'homepage' : |
317 | - if(!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) |
|
317 | + if (!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) |
|
318 | 318 | { |
319 | 319 | $this->isValid = FALSE; |
320 | 320 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key} ? $lang->{$key} : $key)); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | break; |
323 | 323 | case 'userid' : |
324 | 324 | case 'user_id' : |
325 | - if(!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) |
|
325 | + if (!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) |
|
326 | 326 | { |
327 | 327 | $this->isValid = FALSE; |
328 | 328 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_userid, $lang->{$key} ? $lang->{$key} : $key)); |
@@ -330,25 +330,25 @@ discard block |
||
330 | 330 | break; |
331 | 331 | case 'number' : |
332 | 332 | case 'numbers' : |
333 | - if(is_array($val)) |
|
333 | + if (is_array($val)) |
|
334 | 334 | { |
335 | 335 | $val = join(',', $val); |
336 | 336 | } |
337 | - if(!preg_match('/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val)) |
|
337 | + if (!preg_match('/^(-?)[0-9]+(,\-?[0-9]+)*$/is', $val)) |
|
338 | 338 | { |
339 | 339 | $this->isValid = FALSE; |
340 | 340 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_number, $lang->{$key} ? $lang->{$key} : $key)); |
341 | 341 | } |
342 | 342 | break; |
343 | 343 | case 'alpha' : |
344 | - if(!preg_match('/^[a-z]+$/is', $val)) |
|
344 | + if (!preg_match('/^[a-z]+$/is', $val)) |
|
345 | 345 | { |
346 | 346 | $this->isValid = FALSE; |
347 | 347 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key} ? $lang->{$key} : $key)); |
348 | 348 | } |
349 | 349 | break; |
350 | 350 | case 'alpha_number' : |
351 | - if(!preg_match('/^[0-9a-z]+$/is', $val)) |
|
351 | + if (!preg_match('/^[0-9a-z]+$/is', $val)) |
|
352 | 352 | { |
353 | 353 | $this->isValid = FALSE; |
354 | 354 | $this->errorMessage = new BaseObject(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key} ? $lang->{$key} : $key)); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | function checkMaxLength($length) |
362 | 362 | { |
363 | - if($this->value && (strlen($this->value) > $length)) |
|
363 | + if ($this->value && (strlen($this->value) > $length)) |
|
364 | 364 | { |
365 | 365 | global $lang; |
366 | 366 | $this->isValid = FALSE; |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | |
372 | 372 | function checkMinLength($length) |
373 | 373 | { |
374 | - if($this->value && (strlen($this->value) < $length)) |
|
374 | + if ($this->value && (strlen($this->value) < $length)) |
|
375 | 375 | { |
376 | 376 | global $lang; |
377 | 377 | $this->isValid = FALSE; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | function checkNotNull() |
384 | 384 | { |
385 | - if(!isset($this->value)) |
|
385 | + if (!isset($this->value)) |
|
386 | 386 | { |
387 | 387 | global $lang; |
388 | 388 | $this->isValid = FALSE; |