@@ -19,26 +19,26 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function isIDExists($id, $site_srl = 0) |
| 21 | 21 | { |
| 22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
| 22 | + if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true; |
|
| 23 | 23 | // directory and rss/atom/api reserved checking, etc. |
| 24 | 24 | $dirs = FileHandler::readDir(_XE_PATH_); |
| 25 | 25 | $dirs[] = 'rss'; |
| 26 | 26 | $dirs[] = 'atom'; |
| 27 | 27 | $dirs[] = 'api'; |
| 28 | - if(in_array($id, $dirs)) return true; |
|
| 28 | + if (in_array($id, $dirs)) return true; |
|
| 29 | 29 | // mid test |
| 30 | 30 | $args = new stdClass(); |
| 31 | 31 | $args->mid = $id; |
| 32 | 32 | $args->site_srl = $site_srl; |
| 33 | 33 | $output = executeQuery('module.isExistsModuleName', $args); |
| 34 | - if($output->data->count) return true; |
|
| 34 | + if ($output->data->count) return true; |
|
| 35 | 35 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
| 36 | - if(!$site_srl) |
|
| 36 | + if (!$site_srl) |
|
| 37 | 37 | { |
| 38 | 38 | $site_args = new stdClass(); |
| 39 | 39 | $site_args->domain = $id; |
| 40 | 40 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
| 41 | - if($output->data->count) return true; |
|
| 41 | + if ($output->data->count) return true; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | return false; |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | function getDefaultMid() |
| 83 | 83 | { |
| 84 | 84 | $default_url = Context::getDefaultUrl(); |
| 85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 85 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 86 | 86 | |
| 87 | 87 | $request_url = Context::getRequestUri(); |
| 88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 88 | + if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 89 | 89 | |
| 90 | 90 | $default_url_parse = parse_url($default_url); |
| 91 | 91 | $request_url_parse = parse_url($request_url); |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | // Set up |
| 96 | 96 | $domain = ''; |
| 97 | 97 | $site_info = NULL; |
| 98 | - if($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
| 98 | + if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
| 99 | 99 | { |
| 100 | 100 | $hostname = $request_url_parse['host']; |
| 101 | 101 | $path = $request_url_parse['path']; |
| 102 | 102 | $port = $request_url_parse['port']; |
| 103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 103 | + if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 104 | 104 | |
| 105 | - $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
|
| 105 | + $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if($domain === '') |
|
| 108 | + if ($domain === '') |
|
| 109 | 109 | { |
| 110 | - if(!$vid) $vid = $mid; |
|
| 111 | - if($vid) |
|
| 110 | + if (!$vid) $vid = $mid; |
|
| 111 | + if ($vid) |
|
| 112 | 112 | { |
| 113 | 113 | $domain = $vid; |
| 114 | 114 | } |
@@ -116,89 +116,89 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 118 | 118 | // If domain is set, look for subsite |
| 119 | - if($domain !== '') |
|
| 119 | + if ($domain !== '') |
|
| 120 | 120 | { |
| 121 | 121 | $site_info = false; |
| 122 | - if($oCacheHandler->isSupport()) |
|
| 122 | + if ($oCacheHandler->isSupport()) |
|
| 123 | 123 | { |
| 124 | - $object_key = 'site_info:' . md5($domain); |
|
| 124 | + $object_key = 'site_info:'.md5($domain); |
|
| 125 | 125 | $domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 126 | 126 | $site_info = $oCacheHandler->get($domain_cache_key); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - if($site_info === false) |
|
| 129 | + if ($site_info === false) |
|
| 130 | 130 | { |
| 131 | 131 | $args = new stdClass(); |
| 132 | 132 | $args->domain = $domain; |
| 133 | 133 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
| 134 | 134 | $site_info = $output->data; |
| 135 | 135 | |
| 136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 136 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if($site_info && $vid) |
|
| 139 | + if ($site_info && $vid) |
|
| 140 | 140 | { |
| 141 | 141 | Context::set('vid', $site_info->domain, true); |
| 142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
| 142 | + if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true); |
|
| 143 | 143 | } |
| 144 | - if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
| 144 | + if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // If no virtual website was found, get default website |
| 148 | - if($domain === '') |
|
| 148 | + if ($domain === '') |
|
| 149 | 149 | { |
| 150 | 150 | $site_info = false; |
| 151 | - if($oCacheHandler->isSupport()) |
|
| 151 | + if ($oCacheHandler->isSupport()) |
|
| 152 | 152 | { |
| 153 | 153 | $object_key = 'default_site'; |
| 154 | 154 | $default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 155 | 155 | $site_info = $oCacheHandler->get($default_site_cache_key); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if($site_info === false) |
|
| 158 | + if ($site_info === false) |
|
| 159 | 159 | { |
| 160 | 160 | $args = new stdClass(); |
| 161 | 161 | $args->site_srl = 0; |
| 162 | 162 | $output = executeQuery('module.getSiteInfo', $args); |
| 163 | 163 | // Update the related informaion if there is no default site info |
| 164 | - if(!$output->data) |
|
| 164 | + if (!$output->data) |
|
| 165 | 165 | { |
| 166 | 166 | // Create a table if sites table doesn't exist |
| 167 | 167 | $oDB = &DB::getInstance(); |
| 168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | - if(!$oDB->isTableExists('sites')) return; |
|
| 168 | + if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | + if (!$oDB->isTableExists('sites')) return; |
|
| 170 | 170 | |
| 171 | 171 | // Get mid, language |
| 172 | 172 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
| 173 | 173 | $db_info = Context::getDBInfo(); |
| 174 | 174 | $domain = Context::getDefaultUrl(); |
| 175 | 175 | $url_info = parse_url($domain); |
| 176 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
| 176 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
| 177 | 177 | |
| 178 | 178 | $site_args = new stdClass; |
| 179 | 179 | $site_args->site_srl = 0; |
| 180 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 180 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
| 181 | 181 | $site_args->domain = $domain; |
| 182 | 182 | $site_args->default_language = $db_info->lang_type; |
| 183 | 183 | |
| 184 | - if($output->data && !$output->data->index_module_srl) |
|
| 184 | + if ($output->data && !$output->data->index_module_srl) |
|
| 185 | 185 | { |
| 186 | 186 | $output = executeQuery('module.updateSite', $site_args); |
| 187 | 187 | } |
| 188 | 188 | else |
| 189 | 189 | { |
| 190 | 190 | $output = executeQuery('module.insertSite', $site_args); |
| 191 | - if(!$output->toBool()) return $output; |
|
| 191 | + if (!$output->toBool()) return $output; |
|
| 192 | 192 | } |
| 193 | 193 | $output = executeQuery('module.getSiteInfo', $args); |
| 194 | 194 | } |
| 195 | 195 | $site_info = $output->data; |
| 196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 196 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if(!$site_info->module_srl) return $site_info; |
|
| 201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 200 | + if (!$site_info->module_srl) return $site_info; |
|
| 201 | + if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 202 | 202 | return $this->addModuleExtraVars($site_info); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -207,48 +207,48 @@ discard block |
||
| 207 | 207 | */ |
| 208 | 208 | function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array()) |
| 209 | 209 | { |
| 210 | - if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
| 210 | + if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
| 211 | 211 | { |
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $args = new stdClass(); |
| 216 | 216 | $args->mid = $mid; |
| 217 | - $args->site_srl = (int)$site_srl; |
|
| 217 | + $args->site_srl = (int) $site_srl; |
|
| 218 | 218 | |
| 219 | 219 | $module_srl = false; |
| 220 | 220 | $module_info = false; |
| 221 | 221 | |
| 222 | 222 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 223 | - if($oCacheHandler->isSupport()) |
|
| 223 | + if ($oCacheHandler->isSupport()) |
|
| 224 | 224 | { |
| 225 | 225 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
| 226 | 226 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 227 | 227 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
| 228 | - if($module_srl) |
|
| 228 | + if ($module_srl) |
|
| 229 | 229 | { |
| 230 | - $object_key = 'mid_info:' . $module_srl; |
|
| 230 | + $object_key = 'mid_info:'.$module_srl; |
|
| 231 | 231 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 232 | 232 | $module_info = $oCacheHandler->get($module_info_cache_key); |
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if($module_info === false) |
|
| 236 | + if ($module_info === false) |
|
| 237 | 237 | { |
| 238 | 238 | $output = executeQuery('module.getMidInfo', $args); |
| 239 | 239 | $module_info = $output->data; |
| 240 | - if($oCacheHandler->isSupport()) |
|
| 240 | + if ($oCacheHandler->isSupport()) |
|
| 241 | 241 | { |
| 242 | 242 | $oCacheHandler->put($module_srl_cache_key, $module_info->module_srl); |
| 243 | 243 | |
| 244 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
| 244 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
| 245 | 245 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 246 | 246 | $oCacheHandler->put($module_info_cache_key, $module_info); |
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $this->applyDefaultSkin($module_info); |
| 251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 251 | + if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 252 | 252 | return $this->addModuleExtraVars($module_info); |
| 253 | 253 | } |
| 254 | 254 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $menuItemSrl = Context::get('menu_item_srl'); |
| 265 | 265 | $menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl; |
| 266 | 266 | |
| 267 | - if(!$menuItemSrl) |
|
| 267 | + if (!$menuItemSrl) |
|
| 268 | 268 | { |
| 269 | 269 | $this->stop(-1, 'msg_invalid_request'); |
| 270 | 270 | return; |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $args = new stdClass(); |
| 274 | 274 | $args->menu_item_srl = $menuItemSrl; |
| 275 | 275 | $output = executeQuery('module.getModuleInfoByMenuItemSrl', $args); |
| 276 | - if(!$output->toBool()) |
|
| 276 | + if (!$output->toBool()) |
|
| 277 | 277 | { |
| 278 | 278 | return $output; |
| 279 | 279 | } |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | $layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL; |
| 298 | 298 | $skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc); |
| 299 | 299 | $skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins'); |
| 300 | - if(!$skinInfoPc) |
|
| 300 | + if (!$skinInfoPc) |
|
| 301 | 301 | { |
| 302 | 302 | $skinInfoPc = new stdClass(); |
| 303 | 303 | $skinInfoPc->title = $skinNamePc; |
| 304 | 304 | } |
| 305 | - if(!$skinInfoMobile) |
|
| 305 | + if (!$skinInfoMobile) |
|
| 306 | 306 | { |
| 307 | 307 | $skinInfoMobile = new stdClass(); |
| 308 | 308 | $skinInfoMobile->title = $skinNameMobile; |
@@ -321,23 +321,23 @@ discard block |
||
| 321 | 321 | $mid_info = false; |
| 322 | 322 | |
| 323 | 323 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 324 | - if($oCacheHandler->isSupport()) |
|
| 324 | + if ($oCacheHandler->isSupport()) |
|
| 325 | 325 | { |
| 326 | 326 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
| 327 | 327 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 328 | 328 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
| 329 | - if($module_srl) |
|
| 329 | + if ($module_srl) |
|
| 330 | 330 | { |
| 331 | - $object_key = 'mid_info:' . $module_srl; |
|
| 331 | + $object_key = 'mid_info:'.$module_srl; |
|
| 332 | 332 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 333 | 333 | $mid_info = $oCacheHandler->get($module_info_cache_key); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if($mid_info === false) |
|
| 336 | + if ($mid_info === false) |
|
| 337 | 337 | { |
| 338 | 338 | $oCacheHandler->put($module_srl_cache_key, $output->data->module_srl); |
| 339 | 339 | |
| 340 | - $object_key = 'mid_info:' . $output->data->module_srl; |
|
| 340 | + $object_key = 'mid_info:'.$output->data->module_srl; |
|
| 341 | 341 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 342 | 342 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
| 343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | $moduleInfo = $this->addModuleExtraVars($moduleInfo); |
| 352 | 352 | |
| 353 | - if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
| 353 | + if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
| 354 | 354 | { |
| 355 | 355 | unset($moduleInfo->skin); |
| 356 | 356 | unset($moduleInfo->mskin); |
@@ -369,32 +369,32 @@ discard block |
||
| 369 | 369 | $mid_info = false; |
| 370 | 370 | |
| 371 | 371 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 372 | - if($oCacheHandler->isSupport()) |
|
| 372 | + if ($oCacheHandler->isSupport()) |
|
| 373 | 373 | { |
| 374 | - $object_key = 'mid_info:' . $module_srl; |
|
| 374 | + $object_key = 'mid_info:'.$module_srl; |
|
| 375 | 375 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 376 | 376 | $mid_info = $oCacheHandler->get($cache_key); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if($mid_info === false) |
|
| 379 | + if ($mid_info === false) |
|
| 380 | 380 | { |
| 381 | 381 | // Get data |
| 382 | 382 | $args = new stdClass(); |
| 383 | 383 | $args->module_srl = $module_srl; |
| 384 | 384 | $output = executeQuery('module.getMidInfo', $args); |
| 385 | - if(!$output->toBool()) return; |
|
| 385 | + if (!$output->toBool()) return; |
|
| 386 | 386 | |
| 387 | 387 | $mid_info = $output->data; |
| 388 | 388 | $this->applyDefaultSkin($mid_info); |
| 389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 389 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - if($mid_info && count($columnList)) |
|
| 392 | + if ($mid_info && count($columnList)) |
|
| 393 | 393 | { |
| 394 | 394 | $module_info = new stdClass(); |
| 395 | - foreach($mid_info as $key => $item) |
|
| 395 | + foreach ($mid_info as $key => $item) |
|
| 396 | 396 | { |
| 397 | - if(in_array($key, $columnList)) |
|
| 397 | + if (in_array($key, $columnList)) |
|
| 398 | 398 | { |
| 399 | 399 | $module_info->$key = $item; |
| 400 | 400 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | else $module_info = $mid_info; |
| 404 | 404 | |
| 405 | 405 | $oModuleController = getController('module'); |
| 406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 406 | + if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 407 | 407 | |
| 408 | 408 | $this->applyDefaultSkin($module_info); |
| 409 | 409 | return $this->addModuleExtraVars($module_info); |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | */ |
| 417 | 417 | private function applyDefaultSkin(&$moduleInfo) |
| 418 | 418 | { |
| 419 | - if($moduleInfo->is_skin_fix == 'N') |
|
| 419 | + if ($moduleInfo->is_skin_fix == 'N') |
|
| 420 | 420 | { |
| 421 | 421 | $moduleInfo->skin = '/USE_DEFAULT/'; |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if($moduleInfo->is_mskin_fix == 'N') |
|
| 424 | + if ($moduleInfo->is_mskin_fix == 'N') |
|
| 425 | 425 | { |
| 426 | 426 | $moduleInfo->mskin = '/USE_DEFAULT/'; |
| 427 | 427 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $count = count($output->data); |
| 440 | 440 | |
| 441 | 441 | $modules = array(); |
| 442 | - for($i=0;$i<$count;$i++) |
|
| 442 | + for ($i = 0; $i < $count; $i++) |
|
| 443 | 443 | { |
| 444 | 444 | $modules[] = $output->data[$i]; |
| 445 | 445 | } |
@@ -451,11 +451,11 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | function getModulesInfo($module_srls, $columnList = array()) |
| 453 | 453 | { |
| 454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
| 454 | + if (is_array($module_srls)) $module_srls = implode(',', $module_srls); |
|
| 455 | 455 | $args = new stdClass(); |
| 456 | 456 | $args->module_srls = $module_srls; |
| 457 | 457 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
| 458 | - if(!$output->toBool()) return; |
|
| 458 | + if (!$output->toBool()) return; |
|
| 459 | 459 | return $this->addModuleExtraVars($output->data); |
| 460 | 460 | } |
| 461 | 461 | |
@@ -465,31 +465,31 @@ discard block |
||
| 465 | 465 | function addModuleExtraVars($module_info) |
| 466 | 466 | { |
| 467 | 467 | // Process although one or more module informaion is requested |
| 468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
| 468 | + if (!is_array($module_info)) $target_module_info = array($module_info); |
|
| 469 | 469 | else $target_module_info = $module_info; |
| 470 | 470 | // Get module_srl |
| 471 | 471 | $module_srls = array(); |
| 472 | - foreach($target_module_info as $key => $val) |
|
| 472 | + foreach ($target_module_info as $key => $val) |
|
| 473 | 473 | { |
| 474 | 474 | $module_srl = $val->module_srl; |
| 475 | - if(!$module_srl) continue; |
|
| 475 | + if (!$module_srl) continue; |
|
| 476 | 476 | $module_srls[] = $val->module_srl; |
| 477 | 477 | } |
| 478 | 478 | // Extract extra information of the module and skin |
| 479 | 479 | $extra_vars = $this->getModuleExtraVars($module_srls); |
| 480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 480 | + if (!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 481 | 481 | |
| 482 | - foreach($target_module_info as $key => $val) |
|
| 482 | + foreach ($target_module_info as $key => $val) |
|
| 483 | 483 | { |
| 484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 485 | - foreach($extra_vars[$val->module_srl] as $k => $v) |
|
| 484 | + if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 485 | + foreach ($extra_vars[$val->module_srl] as $k => $v) |
|
| 486 | 486 | { |
| 487 | - if($target_module_info[$key]->{$k}) continue; |
|
| 487 | + if ($target_module_info[$key]->{$k}) continue; |
|
| 488 | 488 | $target_module_info[$key]->{$k} = $v; |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(is_array($module_info)) return $target_module_info; |
|
| 492 | + if (is_array($module_info)) return $target_module_info; |
|
| 493 | 493 | return $target_module_info[0]; |
| 494 | 494 | } |
| 495 | 495 | |
@@ -500,37 +500,37 @@ discard block |
||
| 500 | 500 | { |
| 501 | 501 | $list = false; |
| 502 | 502 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 503 | - if($oCacheHandler->isSupport()) |
|
| 503 | + if ($oCacheHandler->isSupport()) |
|
| 504 | 504 | { |
| 505 | - if(count($args) === 1 && isset($args->site_srl)) |
|
| 505 | + if (count($args) === 1 && isset($args->site_srl)) |
|
| 506 | 506 | { |
| 507 | - $object_key = 'module:mid_list_' . $args->site_srl; |
|
| 507 | + $object_key = 'module:mid_list_'.$args->site_srl; |
|
| 508 | 508 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 509 | 509 | $list = $oCacheHandler->get($cache_key); |
| 510 | 510 | } |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - if($list === false) |
|
| 513 | + if ($list === false) |
|
| 514 | 514 | { |
| 515 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 515 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 516 | 516 | { |
| 517 | 517 | $columnList = array(); |
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | $output = executeQuery('module.getMidList', $args, $columnList); |
| 521 | - if(!$output->toBool()) return $output; |
|
| 521 | + if (!$output->toBool()) return $output; |
|
| 522 | 522 | $list = $output->data; |
| 523 | 523 | |
| 524 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 524 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
| 525 | 525 | { |
| 526 | 526 | $oCacheHandler->put($cache_key, $list); |
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | - if(!$list) return; |
|
| 529 | + if (!$list) return; |
|
| 530 | 530 | |
| 531 | - if(!is_array($list)) $list = array($list); |
|
| 531 | + if (!is_array($list)) $list = array($list); |
|
| 532 | 532 | |
| 533 | - foreach($list as $val) |
|
| 533 | + foreach ($list as $val) |
|
| 534 | 534 | { |
| 535 | 535 | $mid_list[$val->mid] = $val; |
| 536 | 536 | } |
@@ -544,10 +544,10 @@ discard block |
||
| 544 | 544 | function getModuleSrlList($args = null, $columnList = array()) |
| 545 | 545 | { |
| 546 | 546 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
| 547 | - if(!$output->toBool()) return $output; |
|
| 547 | + if (!$output->toBool()) return $output; |
|
| 548 | 548 | |
| 549 | 549 | $list = $output->data; |
| 550 | - if(!$list) return; |
|
| 550 | + if (!$list) return; |
|
| 551 | 551 | |
| 552 | 552 | return $list; |
| 553 | 553 | } |
@@ -557,22 +557,22 @@ discard block |
||
| 557 | 557 | */ |
| 558 | 558 | function getModuleSrlByMid($mid) |
| 559 | 559 | { |
| 560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
| 561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
| 560 | + if ($mid && !is_array($mid)) $mid = explode(',', $mid); |
|
| 561 | + if (is_array($mid)) $mid = "'".implode("','", $mid)."'"; |
|
| 562 | 562 | |
| 563 | 563 | $site_module_info = Context::get('site_module_info'); |
| 564 | 564 | |
| 565 | 565 | $args = new stdClass; |
| 566 | 566 | $args->mid = $mid; |
| 567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 567 | + if ($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 568 | 568 | $output = executeQuery('module.getModuleSrlByMid', $args); |
| 569 | - if(!$output->toBool()) return $output; |
|
| 569 | + if (!$output->toBool()) return $output; |
|
| 570 | 570 | |
| 571 | 571 | $list = $output->data; |
| 572 | - if(!$list) return; |
|
| 573 | - if(!is_array($list)) $list = array($list); |
|
| 572 | + if (!$list) return; |
|
| 573 | + if (!is_array($list)) $list = array($list); |
|
| 574 | 574 | |
| 575 | - foreach($list as $key => $val) |
|
| 575 | + foreach ($list as $key => $val) |
|
| 576 | 576 | { |
| 577 | 577 | $module_srl_list[] = $val->module_srl; |
| 578 | 578 | } |
@@ -588,33 +588,33 @@ discard block |
||
| 588 | 588 | $action_forward = false; |
| 589 | 589 | // cache controll |
| 590 | 590 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 591 | - if($oCacheHandler->isSupport()) |
|
| 591 | + if ($oCacheHandler->isSupport()) |
|
| 592 | 592 | { |
| 593 | 593 | $cache_key = 'action_forward'; |
| 594 | 594 | $action_forward = $oCacheHandler->get($cache_key); |
| 595 | 595 | } |
| 596 | 596 | |
| 597 | 597 | // retrieve and caching all registered action_forward |
| 598 | - if($action_forward === false) |
|
| 598 | + if ($action_forward === false) |
|
| 599 | 599 | { |
| 600 | 600 | $args = new stdClass(); |
| 601 | - $output = executeQueryArray('module.getActionForward',$args); |
|
| 602 | - if(!$output->toBool()) return new stdClass; |
|
| 603 | - if(!$output->data) $output->data = array(); |
|
| 601 | + $output = executeQueryArray('module.getActionForward', $args); |
|
| 602 | + if (!$output->toBool()) return new stdClass; |
|
| 603 | + if (!$output->data) $output->data = array(); |
|
| 604 | 604 | |
| 605 | 605 | $action_forward = array(); |
| 606 | - foreach($output->data as $item) |
|
| 606 | + foreach ($output->data as $item) |
|
| 607 | 607 | { |
| 608 | 608 | $action_forward[$item->act] = $item; |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if($oCacheHandler->isSupport()) |
|
| 611 | + if ($oCacheHandler->isSupport()) |
|
| 612 | 612 | { |
| 613 | 613 | $oCacheHandler->put($cache_key, $action_forward); |
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | - if($action_forward[$act]) |
|
| 617 | + if ($action_forward[$act]) |
|
| 618 | 618 | { |
| 619 | 619 | return $action_forward[$act]; |
| 620 | 620 | } |
@@ -629,25 +629,25 @@ discard block |
||
| 629 | 629 | */ |
| 630 | 630 | function getTriggers($trigger_name, $called_position) |
| 631 | 631 | { |
| 632 | - if(is_null($GLOBALS['__triggers__'])) |
|
| 632 | + if (is_null($GLOBALS['__triggers__'])) |
|
| 633 | 633 | { |
| 634 | 634 | $triggers = FALSE; |
| 635 | 635 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 636 | - if($oCacheHandler->isSupport()) |
|
| 636 | + if ($oCacheHandler->isSupport()) |
|
| 637 | 637 | { |
| 638 | 638 | $cache_key = 'triggers'; |
| 639 | 639 | $triggers = $oCacheHandler->get($cache_key); |
| 640 | 640 | } |
| 641 | - if($triggers === FALSE) |
|
| 641 | + if ($triggers === FALSE) |
|
| 642 | 642 | { |
| 643 | 643 | $output = executeQueryArray('module.getTriggers'); |
| 644 | 644 | $triggers = $output->data; |
| 645 | - if($output->toBool() && $oCacheHandler->isSupport()) |
|
| 645 | + if ($output->toBool() && $oCacheHandler->isSupport()) |
|
| 646 | 646 | { |
| 647 | 647 | $oCacheHandler->put($cache_key, $triggers); |
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | - foreach($triggers as $item) |
|
| 650 | + foreach ($triggers as $item) |
|
| 651 | 651 | { |
| 652 | 652 | $GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item; |
| 653 | 653 | } |
@@ -663,11 +663,11 @@ discard block |
||
| 663 | 663 | { |
| 664 | 664 | $triggers = $this->getTriggers($trigger_name, $called_position); |
| 665 | 665 | |
| 666 | - if($triggers && is_array($triggers)) |
|
| 666 | + if ($triggers && is_array($triggers)) |
|
| 667 | 667 | { |
| 668 | - foreach($triggers as $item) |
|
| 668 | + foreach ($triggers as $item) |
|
| 669 | 669 | { |
| 670 | - if($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
| 670 | + if ($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
| 671 | 671 | { |
| 672 | 672 | return $item; |
| 673 | 673 | } |
@@ -680,12 +680,12 @@ discard block |
||
| 680 | 680 | /** |
| 681 | 681 | * @brief Get module extend |
| 682 | 682 | */ |
| 683 | - function getModuleExtend($parent_module, $type, $kind='') |
|
| 683 | + function getModuleExtend($parent_module, $type, $kind = '') |
|
| 684 | 684 | { |
| 685 | 685 | $key = $parent_module.'.'.$kind.'.'.$type; |
| 686 | 686 | |
| 687 | 687 | $module_extend_info = $this->loadModuleExtends(); |
| 688 | - if(array_key_exists($key, $module_extend_info)) |
|
| 688 | + if (array_key_exists($key, $module_extend_info)) |
|
| 689 | 689 | { |
| 690 | 690 | return $module_extend_info[$key]; |
| 691 | 691 | } |
@@ -701,29 +701,29 @@ discard block |
||
| 701 | 701 | $cache_file = './files/config/module_extend.php'; |
| 702 | 702 | $cache_file = FileHandler::getRealPath($cache_file); |
| 703 | 703 | |
| 704 | - if(!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
| 704 | + if (!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
| 705 | 705 | { |
| 706 | 706 | // check pre install |
| 707 | - if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
| 707 | + if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
| 708 | 708 | { |
| 709 | 709 | $arr = array(); |
| 710 | 710 | $output = executeQueryArray('module.getModuleExtend'); |
| 711 | - if($output->data) |
|
| 711 | + if ($output->data) |
|
| 712 | 712 | { |
| 713 | - foreach($output->data as $v) |
|
| 713 | + foreach ($output->data as $v) |
|
| 714 | 714 | { |
| 715 | 715 | $arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module); |
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | $str = '<?PHP return array(%s); ?>'; |
| 720 | - $str = sprintf($str, join(',',$arr)); |
|
| 720 | + $str = sprintf($str, join(',', $arr)); |
|
| 721 | 721 | |
| 722 | 722 | FileHandler::writeFile($cache_file, $str); |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | 725 | |
| 726 | - if(file_exists($cache_file)) |
|
| 726 | + if (file_exists($cache_file)) |
|
| 727 | 727 | { |
| 728 | 728 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
| 729 | 729 | } |
@@ -743,20 +743,20 @@ discard block |
||
| 743 | 743 | { |
| 744 | 744 | // Get a path of the requested module. Return if not exists. |
| 745 | 745 | $module_path = ModuleHandler::getModulePath($module); |
| 746 | - if(!$module_path) return; |
|
| 746 | + if (!$module_path) return; |
|
| 747 | 747 | // Read the xml file for module skin information |
| 748 | 748 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
| 749 | - if(!file_exists($xml_file)) return; |
|
| 749 | + if (!file_exists($xml_file)) return; |
|
| 750 | 750 | |
| 751 | 751 | $oXmlParser = new XmlParser(); |
| 752 | 752 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 753 | 753 | $xml_obj = $tmp_xml_obj->module; |
| 754 | 754 | |
| 755 | - if(!$xml_obj) return; |
|
| 755 | + if (!$xml_obj) return; |
|
| 756 | 756 | |
| 757 | 757 | // Module Information |
| 758 | 758 | $module_info = new stdClass(); |
| 759 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 759 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 760 | 760 | { |
| 761 | 761 | // module format 0.2 |
| 762 | 762 | $module_info->title = $xml_obj->title->body; |
@@ -764,16 +764,16 @@ discard block |
||
| 764 | 764 | $module_info->version = $xml_obj->version->body; |
| 765 | 765 | $module_info->homepage = $xml_obj->link->body; |
| 766 | 766 | $module_info->category = $xml_obj->category->body; |
| 767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 767 | + if (!$module_info->category) $module_info->category = 'service'; |
|
| 768 | 768 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 769 | 769 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 770 | 770 | $module_info->license = $xml_obj->license->body; |
| 771 | 771 | $module_info->license_link = $xml_obj->license->attrs->link; |
| 772 | 772 | |
| 773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 773 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 774 | 774 | else $author_list = $xml_obj->author; |
| 775 | 775 | |
| 776 | - foreach($author_list as $author) |
|
| 776 | + foreach ($author_list as $author) |
|
| 777 | 777 | { |
| 778 | 778 | $author_obj = new stdClass(); |
| 779 | 779 | $author_obj->name = $author->name->body; |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | $module_info->description = $xml_obj->author->description->body; |
| 790 | 790 | $module_info->version = $xml_obj->attrs->version; |
| 791 | 791 | $module_info->category = $xml_obj->attrs->category; |
| 792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 792 | + if (!$module_info->category) $module_info->category = 'service'; |
|
| 793 | 793 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 794 | 794 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 795 | 795 | $author_obj = new stdClass(); |
@@ -818,17 +818,17 @@ discard block |
||
| 818 | 818 | { |
| 819 | 819 | // Get a path of the requested module. Return if not exists. |
| 820 | 820 | $class_path = ModuleHandler::getModulePath($module); |
| 821 | - if(!$class_path) return; |
|
| 821 | + if (!$class_path) return; |
|
| 822 | 822 | |
| 823 | 823 | // Check if module.xml exists in the path. Return if not exist |
| 824 | 824 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
| 825 | - if(!file_exists($xml_file)) return; |
|
| 825 | + if (!file_exists($xml_file)) return; |
|
| 826 | 826 | |
| 827 | 827 | // Check if cached file exists |
| 828 | - $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
| 828 | + $cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
| 829 | 829 | |
| 830 | 830 | // Update if no cache file exists or it is older than xml file |
| 831 | - if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
| 831 | + if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
| 832 | 832 | { |
| 833 | 833 | $info = new stdClass(); |
| 834 | 834 | $buff = array(); // /< Set buff variable to use in the cache file |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | |
| 842 | 842 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
| 843 | 843 | |
| 844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 844 | + if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 845 | 845 | |
| 846 | 846 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
| 847 | 847 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -851,17 +851,17 @@ discard block |
||
| 851 | 851 | $default_index = $admin_index = ''; |
| 852 | 852 | |
| 853 | 853 | // Arrange permission information |
| 854 | - if($grants) |
|
| 854 | + if ($grants) |
|
| 855 | 855 | { |
| 856 | - if(is_array($grants)) $grant_list = $grants; |
|
| 856 | + if (is_array($grants)) $grant_list = $grants; |
|
| 857 | 857 | else $grant_list[] = $grants; |
| 858 | 858 | |
| 859 | 859 | $info->grant = new stdClass(); |
| 860 | 860 | $buff[] = '$info->grant = new stdClass;'; |
| 861 | - foreach($grant_list as $grant) |
|
| 861 | + foreach ($grant_list as $grant) |
|
| 862 | 862 | { |
| 863 | 863 | $name = $grant->attrs->name; |
| 864 | - $default = $grant->attrs->default?$grant->attrs->default:'guest'; |
|
| 864 | + $default = $grant->attrs->default ? $grant->attrs->default : 'guest'; |
|
| 865 | 865 | $title = $grant->title->body; |
| 866 | 866 | |
| 867 | 867 | $info->grant->{$name} = new stdClass(); |
@@ -874,15 +874,15 @@ discard block |
||
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | // Permissions to grant |
| 877 | - if($permissions) |
|
| 877 | + if ($permissions) |
|
| 878 | 878 | { |
| 879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
| 879 | + if (is_array($permissions)) $permission_list = $permissions; |
|
| 880 | 880 | else $permission_list[] = $permissions; |
| 881 | 881 | |
| 882 | 882 | $buff[] = '$info->permission = new stdClass;'; |
| 883 | 883 | |
| 884 | 884 | $info->permission = new stdClass(); |
| 885 | - foreach($permission_list as $permission) |
|
| 885 | + foreach ($permission_list as $permission) |
|
| 886 | 886 | { |
| 887 | 887 | $action = $permission->attrs->action; |
| 888 | 888 | $target = $permission->attrs->target; |
@@ -893,14 +893,14 @@ discard block |
||
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | // for admin menus |
| 896 | - if($menus) |
|
| 896 | + if ($menus) |
|
| 897 | 897 | { |
| 898 | - if(is_array($menus)) $menu_list = $menus; |
|
| 898 | + if (is_array($menus)) $menu_list = $menus; |
|
| 899 | 899 | else $menu_list[] = $menus; |
| 900 | 900 | |
| 901 | 901 | $buff[] = '$info->menu = new stdClass;'; |
| 902 | 902 | $info->menu = new stdClass(); |
| 903 | - foreach($menu_list as $menu) |
|
| 903 | + foreach ($menu_list as $menu) |
|
| 904 | 904 | { |
| 905 | 905 | $menu_name = $menu->attrs->name; |
| 906 | 906 | $menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body; |
@@ -918,23 +918,23 @@ discard block |
||
| 918 | 918 | } |
| 919 | 919 | |
| 920 | 920 | // actions |
| 921 | - if($actions) |
|
| 921 | + if ($actions) |
|
| 922 | 922 | { |
| 923 | - if(is_array($actions)) $action_list = $actions; |
|
| 923 | + if (is_array($actions)) $action_list = $actions; |
|
| 924 | 924 | else $action_list[] = $actions; |
| 925 | 925 | |
| 926 | 926 | $buff[] = '$info->action = new stdClass;'; |
| 927 | 927 | $info->action = new stdClass(); |
| 928 | - foreach($action_list as $action) |
|
| 928 | + foreach ($action_list as $action) |
|
| 929 | 929 | { |
| 930 | 930 | $name = $action->attrs->name; |
| 931 | 931 | |
| 932 | 932 | $type = $action->attrs->type; |
| 933 | - $grant = $action->attrs->grant?$action->attrs->grant:'guest'; |
|
| 934 | - $standalone = $action->attrs->standalone=='false'?'false':'true'; |
|
| 935 | - $ruleset = $action->attrs->ruleset?$action->attrs->ruleset:''; |
|
| 936 | - $method = $action->attrs->method?$action->attrs->method:''; |
|
| 937 | - $check_csrf = $action->attrs->check_csrf=='false'?'false':'true'; |
|
| 933 | + $grant = $action->attrs->grant ? $action->attrs->grant : 'guest'; |
|
| 934 | + $standalone = $action->attrs->standalone == 'false' ? 'false' : 'true'; |
|
| 935 | + $ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : ''; |
|
| 936 | + $method = $action->attrs->method ? $action->attrs->method : ''; |
|
| 937 | + $check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true'; |
|
| 938 | 938 | |
| 939 | 939 | $index = $action->attrs->index; |
| 940 | 940 | $admin_index = $action->attrs->admin_index; |
@@ -949,14 +949,14 @@ discard block |
||
| 949 | 949 | $info->action->{$name}->ruleset = $ruleset; |
| 950 | 950 | $info->action->{$name}->method = $method; |
| 951 | 951 | $info->action->{$name}->check_csrf = $check_csrf; |
| 952 | - if($action->attrs->menu_name) |
|
| 952 | + if ($action->attrs->menu_name) |
|
| 953 | 953 | { |
| 954 | - if($menu_index == 'true') |
|
| 954 | + if ($menu_index == 'true') |
|
| 955 | 955 | { |
| 956 | 956 | $info->menu->{$action->attrs->menu_name}->index = $name; |
| 957 | 957 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
| 958 | 958 | } |
| 959 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
| 959 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
| 960 | 960 | { |
| 961 | 961 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
| 962 | 962 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -974,22 +974,22 @@ discard block |
||
| 974 | 974 | $buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method); |
| 975 | 975 | $buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf); |
| 976 | 976 | |
| 977 | - if($index=='true') |
|
| 977 | + if ($index == 'true') |
|
| 978 | 978 | { |
| 979 | 979 | $default_index_act = $name; |
| 980 | 980 | $info->default_index_act = $name; |
| 981 | 981 | } |
| 982 | - if($admin_index=='true') |
|
| 982 | + if ($admin_index == 'true') |
|
| 983 | 983 | { |
| 984 | 984 | $admin_index_act = $name; |
| 985 | 985 | $info->admin_index_act = $name; |
| 986 | 986 | } |
| 987 | - if($setup_index=='true') |
|
| 987 | + if ($setup_index == 'true') |
|
| 988 | 988 | { |
| 989 | 989 | $setup_index_act = $name; |
| 990 | 990 | $info->setup_index_act = $name; |
| 991 | 991 | } |
| 992 | - if($simple_setup_index=='true') |
|
| 992 | + if ($simple_setup_index == 'true') |
|
| 993 | 993 | { |
| 994 | 994 | $simple_setup_index_act = $name; |
| 995 | 995 | $info->simple_setup_index_act = $name; |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | return $info; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
| 1013 | + if (file_exists($cache_file)) return include($cache_file); |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | /** |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | { |
| 1022 | 1022 | $module = Context::get('module_type'); |
| 1023 | 1023 | |
| 1024 | - if($module == 'ARTICLE') |
|
| 1024 | + if ($module == 'ARTICLE') |
|
| 1025 | 1025 | { |
| 1026 | 1026 | $module = 'page'; |
| 1027 | 1027 | } |
@@ -1041,26 +1041,26 @@ discard block |
||
| 1041 | 1041 | */ |
| 1042 | 1042 | function getSkins($path, $dir = 'skins') |
| 1043 | 1043 | { |
| 1044 | - if(substr($path, -1) == '/') |
|
| 1044 | + if (substr($path, -1) == '/') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | $path = substr($path, 0, -1); |
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | $skin_path = sprintf("%s/%s/", $path, $dir); |
| 1050 | 1050 | $list = FileHandler::readDir($skin_path); |
| 1051 | - if(!count($list)) return; |
|
| 1051 | + if (!count($list)) return; |
|
| 1052 | 1052 | |
| 1053 | 1053 | natcasesort($list); |
| 1054 | 1054 | |
| 1055 | - foreach($list as $skin_name) |
|
| 1055 | + foreach ($list as $skin_name) |
|
| 1056 | 1056 | { |
| 1057 | - if(!is_dir($skin_path . $skin_name)) |
|
| 1057 | + if (!is_dir($skin_path.$skin_name)) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | continue; |
| 1060 | 1060 | } |
| 1061 | 1061 | unset($skin_info); |
| 1062 | 1062 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
| 1063 | - if(!$skin_info) |
|
| 1063 | + if (!$skin_info) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | $skin_info = new stdClass(); |
| 1066 | 1066 | $skin_info->title = $skin_name; |
@@ -1073,15 +1073,15 @@ discard block |
||
| 1073 | 1073 | $tmpPath = trim($tmpPath); |
| 1074 | 1074 | $module = array_pop(explode(' ', $tmpPath)); |
| 1075 | 1075 | |
| 1076 | - if($dir == 'skins') |
|
| 1076 | + if ($dir == 'skins') |
|
| 1077 | 1077 | { |
| 1078 | 1078 | $oAdminModel = getAdminModel('admin'); |
| 1079 | 1079 | $themesInfo = $oAdminModel->getThemeList(); |
| 1080 | 1080 | |
| 1081 | - foreach($themesInfo as $themeName => $info) |
|
| 1081 | + foreach ($themesInfo as $themeName => $info) |
|
| 1082 | 1082 | { |
| 1083 | 1083 | $skinInfos = $info->skin_infos; |
| 1084 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
| 1084 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
| 1085 | 1085 | { |
| 1086 | 1086 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
| 1087 | 1087 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1093,13 +1093,13 @@ discard block |
||
| 1093 | 1093 | $oMenuAdminModel = getAdminModel('menu'); |
| 1094 | 1094 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
| 1095 | 1095 | $moduleName = $module; |
| 1096 | - if($moduleName === 'page') |
|
| 1096 | + if ($moduleName === 'page') |
|
| 1097 | 1097 | { |
| 1098 | 1098 | $moduleName = 'ARTICLE'; |
| 1099 | 1099 | } |
| 1100 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
| 1100 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
| 1101 | 1101 | { |
| 1102 | - if($dir == 'skins') |
|
| 1102 | + if ($dir == 'skins') |
|
| 1103 | 1103 | { |
| 1104 | 1104 | $type = 'P'; |
| 1105 | 1105 | } |
@@ -1109,12 +1109,12 @@ discard block |
||
| 1109 | 1109 | } |
| 1110 | 1110 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
| 1111 | 1111 | |
| 1112 | - if(isset($defaultSkinName)) |
|
| 1112 | + if (isset($defaultSkinName)) |
|
| 1113 | 1113 | { |
| 1114 | 1114 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
| 1115 | 1115 | |
| 1116 | 1116 | $useDefault = new stdClass(); |
| 1117 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
| 1117 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
| 1118 | 1118 | |
| 1119 | 1119 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
| 1120 | 1120 | |
@@ -1131,20 +1131,20 @@ discard block |
||
| 1131 | 1131 | function loadSkinInfo($path, $skin, $dir = 'skins') |
| 1132 | 1132 | { |
| 1133 | 1133 | // Read xml file having skin information |
| 1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
| 1134 | + if (substr($path, -1) != '/') $path .= '/'; |
|
| 1135 | 1135 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
| 1136 | - if(!file_exists($skin_xml_file)) return; |
|
| 1136 | + if (!file_exists($skin_xml_file)) return; |
|
| 1137 | 1137 | // Create XmlParser object |
| 1138 | 1138 | $oXmlParser = new XmlParser(); |
| 1139 | 1139 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
| 1140 | 1140 | // Return if no skin information is |
| 1141 | - if(!$_xml_obj->skin) return; |
|
| 1141 | + if (!$_xml_obj->skin) return; |
|
| 1142 | 1142 | $xml_obj = $_xml_obj->skin; |
| 1143 | 1143 | // Skin Name |
| 1144 | 1144 | $skin_info = new stdClass(); |
| 1145 | 1145 | $skin_info->title = $xml_obj->title->body; |
| 1146 | 1146 | // Author information |
| 1147 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 1147 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
| 1148 | 1148 | { |
| 1149 | 1149 | // skin format v0.2 |
| 1150 | 1150 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1155,10 +1155,10 @@ discard block |
||
| 1155 | 1155 | $skin_info->license_link = $xml_obj->license->attrs->link; |
| 1156 | 1156 | $skin_info->description = $xml_obj->description->body; |
| 1157 | 1157 | |
| 1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1158 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1159 | 1159 | else $author_list = $xml_obj->author; |
| 1160 | 1160 | |
| 1161 | - foreach($author_list as $author) |
|
| 1161 | + foreach ($author_list as $author) |
|
| 1162 | 1162 | { |
| 1163 | 1163 | $author_obj = new stdClass(); |
| 1164 | 1164 | $author_obj->name = $author->name->body; |
@@ -1167,25 +1167,25 @@ discard block |
||
| 1167 | 1167 | $skin_info->author[] = $author_obj; |
| 1168 | 1168 | } |
| 1169 | 1169 | // List extra vars |
| 1170 | - if($xml_obj->extra_vars) |
|
| 1170 | + if ($xml_obj->extra_vars) |
|
| 1171 | 1171 | { |
| 1172 | 1172 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1173 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1175 | 1175 | |
| 1176 | - foreach($extra_var_groups as $group) |
|
| 1176 | + foreach ($extra_var_groups as $group) |
|
| 1177 | 1177 | { |
| 1178 | 1178 | $extra_vars = $group->var; |
| 1179 | - if(!$extra_vars) |
|
| 1179 | + if (!$extra_vars) |
|
| 1180 | 1180 | { |
| 1181 | 1181 | continue; |
| 1182 | 1182 | } |
| 1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1183 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1184 | 1184 | |
| 1185 | - foreach($extra_vars as $key => $val) |
|
| 1185 | + foreach ($extra_vars as $key => $val) |
|
| 1186 | 1186 | { |
| 1187 | 1187 | $obj = new stdClass(); |
| 1188 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
| 1188 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
| 1189 | 1189 | |
| 1190 | 1190 | $obj->group = $group->title->body; |
| 1191 | 1191 | $obj->name = $val->attrs->name; |
@@ -1194,14 +1194,14 @@ discard block |
||
| 1194 | 1194 | $obj->description = $val->description->body; |
| 1195 | 1195 | $obj->value = $extra_vals->{$obj->name}; |
| 1196 | 1196 | $obj->default = $val->attrs->default; |
| 1197 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
| 1198 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
| 1197 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
| 1198 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
| 1199 | 1199 | // Get an option list from 'select'type |
| 1200 | - if(is_array($val->options)) |
|
| 1200 | + if (is_array($val->options)) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | $option_count = count($val->options); |
| 1203 | 1203 | |
| 1204 | - for($i = 0; $i < $option_count; $i++) |
|
| 1204 | + for ($i = 0; $i < $option_count; $i++) |
|
| 1205 | 1205 | { |
| 1206 | 1206 | $obj->options[$i] = new stdClass(); |
| 1207 | 1207 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1238,18 +1238,18 @@ discard block |
||
| 1238 | 1238 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
| 1239 | 1239 | // Variables used in the skin |
| 1240 | 1240 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1241 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1243 | 1243 | |
| 1244 | - foreach($extra_var_groups as $group) |
|
| 1244 | + foreach ($extra_var_groups as $group) |
|
| 1245 | 1245 | { |
| 1246 | 1246 | $extra_vars = $group->var; |
| 1247 | 1247 | |
| 1248 | - if($extra_vars) |
|
| 1248 | + if ($extra_vars) |
|
| 1249 | 1249 | { |
| 1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1250 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1251 | 1251 | |
| 1252 | - foreach($extra_vars as $var) |
|
| 1252 | + foreach ($extra_vars as $var) |
|
| 1253 | 1253 | { |
| 1254 | 1254 | unset($obj); |
| 1255 | 1255 | unset($options); |
@@ -1260,11 +1260,11 @@ discard block |
||
| 1260 | 1260 | $title = $var->title->body; |
| 1261 | 1261 | $description = $var->description->body; |
| 1262 | 1262 | // Get an option list from 'select'type. |
| 1263 | - if(is_array($var->default)) |
|
| 1263 | + if (is_array($var->default)) |
|
| 1264 | 1264 | { |
| 1265 | 1265 | $option_count = count($var->default); |
| 1266 | 1266 | |
| 1267 | - for($i = 0; $i < $option_count; $i++) |
|
| 1267 | + for ($i = 0; $i < $option_count; $i++) |
|
| 1268 | 1268 | { |
| 1269 | 1269 | $options[$i]->title = $var->default[$i]->body; |
| 1270 | 1270 | $options[$i]->value = $var->default[$i]->body; |
@@ -1298,19 +1298,19 @@ discard block |
||
| 1298 | 1298 | |
| 1299 | 1299 | // colorset |
| 1300 | 1300 | $colorset = $xml_obj->colorset->color; |
| 1301 | - if($colorset) |
|
| 1301 | + if ($colorset) |
|
| 1302 | 1302 | { |
| 1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
| 1303 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
| 1304 | 1304 | |
| 1305 | - foreach($colorset as $color) |
|
| 1305 | + foreach ($colorset as $color) |
|
| 1306 | 1306 | { |
| 1307 | 1307 | $name = $color->attrs->name; |
| 1308 | 1308 | $title = $color->title->body; |
| 1309 | 1309 | $screenshot = $color->attrs->src; |
| 1310 | - if($screenshot) |
|
| 1310 | + if ($screenshot) |
|
| 1311 | 1311 | { |
| 1312 | 1312 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
| 1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
| 1313 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
| 1314 | 1314 | } |
| 1315 | 1315 | else $screenshot = ""; |
| 1316 | 1316 | |
@@ -1322,19 +1322,19 @@ discard block |
||
| 1322 | 1322 | } |
| 1323 | 1323 | } |
| 1324 | 1324 | // Menu type (settings for layout) |
| 1325 | - if($xml_obj->menus->menu) |
|
| 1325 | + if ($xml_obj->menus->menu) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | $menus = $xml_obj->menus->menu; |
| 1328 | - if(!is_array($menus)) $menus = array($menus); |
|
| 1328 | + if (!is_array($menus)) $menus = array($menus); |
|
| 1329 | 1329 | |
| 1330 | 1330 | $menu_count = count($menus); |
| 1331 | 1331 | $skin_info->menu_count = $menu_count; |
| 1332 | - for($i=0;$i<$menu_count;$i++) |
|
| 1332 | + for ($i = 0; $i < $menu_count; $i++) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | unset($obj); |
| 1335 | 1335 | |
| 1336 | 1336 | $obj->name = $menus[$i]->attrs->name; |
| 1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1337 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1338 | 1338 | $obj->title = $menus[$i]->title->body; |
| 1339 | 1339 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
| 1340 | 1340 | |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | } |
| 1344 | 1344 | |
| 1345 | 1345 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
| 1346 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
| 1346 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
| 1347 | 1347 | return $skin_info; |
| 1348 | 1348 | } |
| 1349 | 1349 | |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | { |
| 1355 | 1355 | $args = new stdClass; |
| 1356 | 1356 | $args->site_srl = $site_srl; |
| 1357 | - if(!is_null($module)) $args->module = $module; |
|
| 1357 | + if (!is_null($module)) $args->module = $module; |
|
| 1358 | 1358 | $output = executeQuery('module.getModuleCount', $args); |
| 1359 | 1359 | return $output->data->count; |
| 1360 | 1360 | } |
@@ -1368,26 +1368,26 @@ discard block |
||
| 1368 | 1368 | $config = false; |
| 1369 | 1369 | // cache controll |
| 1370 | 1370 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1371 | - if($oCacheHandler->isSupport()) |
|
| 1371 | + if ($oCacheHandler->isSupport()) |
|
| 1372 | 1372 | { |
| 1373 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
| 1373 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
| 1374 | 1374 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1375 | 1375 | $config = $oCacheHandler->get($cache_key); |
| 1376 | 1376 | } |
| 1377 | 1377 | |
| 1378 | - if($config === false) |
|
| 1378 | + if ($config === false) |
|
| 1379 | 1379 | { |
| 1380 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
| 1380 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
| 1381 | 1381 | { |
| 1382 | 1382 | $args = new stdClass(); |
| 1383 | 1383 | $args->module = $module; |
| 1384 | 1384 | $args->site_srl = $site_srl; |
| 1385 | 1385 | $output = executeQuery('module.getModuleConfig', $args); |
| 1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1386 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
| 1387 | 1387 | else $config = null; |
| 1388 | 1388 | |
| 1389 | 1389 | //insert in cache |
| 1390 | - if($oCacheHandler->isSupport()) |
|
| 1390 | + if ($oCacheHandler->isSupport()) |
|
| 1391 | 1391 | { |
| 1392 | 1392 | $oCacheHandler->put($cache_key, $config); |
| 1393 | 1393 | } |
@@ -1408,26 +1408,26 @@ discard block |
||
| 1408 | 1408 | $config = false; |
| 1409 | 1409 | // cache controll |
| 1410 | 1410 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1411 | - if($oCacheHandler->isSupport()) |
|
| 1411 | + if ($oCacheHandler->isSupport()) |
|
| 1412 | 1412 | { |
| 1413 | 1413 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
| 1414 | 1414 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1415 | 1415 | $config = $oCacheHandler->get($cache_key); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
| 1418 | - if($config === false) |
|
| 1418 | + if ($config === false) |
|
| 1419 | 1419 | { |
| 1420 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
| 1420 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | $args = new stdClass(); |
| 1423 | 1423 | $args->module = $module; |
| 1424 | 1424 | $args->module_srl = $module_srl; |
| 1425 | 1425 | $output = executeQuery('module.getModulePartConfig', $args); |
| 1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1426 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
| 1427 | 1427 | else $config = null; |
| 1428 | 1428 | |
| 1429 | 1429 | //insert in cache |
| 1430 | - if($oCacheHandler->isSupport()) |
|
| 1430 | + if ($oCacheHandler->isSupport()) |
|
| 1431 | 1431 | { |
| 1432 | 1432 | $oCacheHandler->put($cache_key, $config); |
| 1433 | 1433 | } |
@@ -1446,11 +1446,11 @@ discard block |
||
| 1446 | 1446 | { |
| 1447 | 1447 | $args = new stdClass(); |
| 1448 | 1448 | $args->module = $module; |
| 1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1449 | + if ($site_srl) $args->site_srl = $site_srl; |
|
| 1450 | 1450 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
| 1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
| 1451 | + if (!$output->toBool() || !$output->data) return array(); |
|
| 1452 | 1452 | |
| 1453 | - foreach($output->data as $key => $val) |
|
| 1453 | + foreach ($output->data as $key => $val) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | $result[$val->module_srl] = unserialize($val->config); |
| 1456 | 1456 | } |
@@ -1466,12 +1466,12 @@ discard block |
||
| 1466 | 1466 | $args->moduleCategorySrl = $moduleCategorySrl; |
| 1467 | 1467 | // Get data from the DB |
| 1468 | 1468 | $output = executeQuery('module.getModuleCategories', $args); |
| 1469 | - if(!$output->toBool()) return $output; |
|
| 1469 | + if (!$output->toBool()) return $output; |
|
| 1470 | 1470 | $list = $output->data; |
| 1471 | - if(!$list) return; |
|
| 1472 | - if(!is_array($list)) $list = array($list); |
|
| 1471 | + if (!$list) return; |
|
| 1472 | + if (!is_array($list)) $list = array($list); |
|
| 1473 | 1473 | |
| 1474 | - foreach($list as $val) |
|
| 1474 | + foreach ($list as $val) |
|
| 1475 | 1475 | { |
| 1476 | 1476 | $category_list[$val->module_category_srl] = $val; |
| 1477 | 1477 | } |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | $args = new stdClass; |
| 1488 | 1488 | $args->module_category_srl = $module_category_srl; |
| 1489 | 1489 | $output = executeQuery('module.getModuleCategory', $args); |
| 1490 | - if(!$output->toBool()) return $output; |
|
| 1490 | + if (!$output->toBool()) return $output; |
|
| 1491 | 1491 | return $output->data; |
| 1492 | 1492 | } |
| 1493 | 1493 | |
@@ -1499,10 +1499,10 @@ discard block |
||
| 1499 | 1499 | // Get a list of downloaded and installed modules |
| 1500 | 1500 | $searched_list = FileHandler::readDir('./modules'); |
| 1501 | 1501 | $searched_count = count($searched_list); |
| 1502 | - if(!$searched_count) return; |
|
| 1502 | + if (!$searched_count) return; |
|
| 1503 | 1503 | sort($searched_list); |
| 1504 | 1504 | |
| 1505 | - for($i=0;$i<$searched_count;$i++) |
|
| 1505 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 1506 | 1506 | { |
| 1507 | 1507 | // Module name |
| 1508 | 1508 | $module_name = $searched_list[$i]; |
@@ -1512,7 +1512,7 @@ discard block |
||
| 1512 | 1512 | $info = $this->getModuleInfoXml($module_name); |
| 1513 | 1513 | unset($obj); |
| 1514 | 1514 | |
| 1515 | - if(!isset($info)) continue; |
|
| 1515 | + if (!isset($info)) continue; |
|
| 1516 | 1516 | $info->module = $module_name; |
| 1517 | 1517 | $info->created_table_count = $created_table_count; |
| 1518 | 1518 | $info->table_count = $table_count; |
@@ -1529,19 +1529,19 @@ discard block |
||
| 1529 | 1529 | $info = null; |
| 1530 | 1530 | |
| 1531 | 1531 | $moduledir = ModuleHandler::getModulePath($module_name); |
| 1532 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
| 1532 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
| 1533 | 1533 | { |
| 1534 | 1534 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
| 1535 | 1535 | $table_count = count($tmp_files); |
| 1536 | 1536 | // Check if the table is created |
| 1537 | 1537 | $created_table_count = 0; |
| 1538 | - for($j=0;$j<count($tmp_files);$j++) |
|
| 1538 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
| 1539 | 1539 | { |
| 1540 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
| 1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1540 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
| 1541 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
| 1542 | 1542 | } |
| 1543 | 1543 | // Check if DB is installed |
| 1544 | - if($table_count > $created_table_count) return true; |
|
| 1544 | + if ($table_count > $created_table_count) return true; |
|
| 1545 | 1545 | else return false; |
| 1546 | 1546 | } |
| 1547 | 1547 | return false; |
@@ -1551,7 +1551,7 @@ discard block |
||
| 1551 | 1551 | { |
| 1552 | 1552 | // Check if it is upgraded to module.class.php on each module |
| 1553 | 1553 | $oDummy = getModule($module_name, 'class'); |
| 1554 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1554 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1555 | 1555 | { |
| 1556 | 1556 | return $oDummy->checkUpdate(); |
| 1557 | 1557 | } |
@@ -1565,15 +1565,15 @@ discard block |
||
| 1565 | 1565 | */ |
| 1566 | 1566 | public function needUpdate($update_id) |
| 1567 | 1567 | { |
| 1568 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
| 1568 | + if (!is_array($update_id)) $update_id = array($update_id); |
|
| 1569 | 1569 | |
| 1570 | 1570 | $args = new stdClass(); |
| 1571 | 1571 | $args->update_id = implode(',', $update_id); |
| 1572 | 1572 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
| 1573 | 1573 | |
| 1574 | - if(!!$output->error) return false; |
|
| 1575 | - if(!$output->data) $output->data = array(); |
|
| 1576 | - if(count($update_id) === count($output->data)) return false; |
|
| 1574 | + if (!!$output->error) return false; |
|
| 1575 | + if (!$output->data) $output->data = array(); |
|
| 1576 | + if (count($update_id) === count($output->data)) return false; |
|
| 1577 | 1577 | |
| 1578 | 1578 | return true; |
| 1579 | 1579 | } |
@@ -1590,31 +1590,31 @@ discard block |
||
| 1590 | 1590 | sort($searched_list); |
| 1591 | 1591 | |
| 1592 | 1592 | $searched_count = count($searched_list); |
| 1593 | - if(!$searched_count) return; |
|
| 1593 | + if (!$searched_count) return; |
|
| 1594 | 1594 | |
| 1595 | - for($i=0;$i<$searched_count;$i++) |
|
| 1595 | + for ($i = 0; $i < $searched_count; $i++) |
|
| 1596 | 1596 | { |
| 1597 | 1597 | // module name |
| 1598 | 1598 | $module_name = $searched_list[$i]; |
| 1599 | 1599 | |
| 1600 | 1600 | $path = ModuleHandler::getModulePath($module_name); |
| 1601 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1601 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1602 | 1602 | |
| 1603 | 1603 | // Get the number of xml files to create a table in schemas |
| 1604 | 1604 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
| 1605 | 1605 | $table_count = count($tmp_files); |
| 1606 | 1606 | // Check if the table is created |
| 1607 | 1607 | $created_table_count = 0; |
| 1608 | - for($j=0;$j<$table_count;$j++) |
|
| 1608 | + for ($j = 0; $j < $table_count; $j++) |
|
| 1609 | 1609 | { |
| 1610 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
| 1611 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1610 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
| 1611 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
| 1612 | 1612 | } |
| 1613 | 1613 | // Get information of the module |
| 1614 | 1614 | $info = NULL; |
| 1615 | 1615 | $info = $this->getModuleInfoXml($module_name); |
| 1616 | 1616 | |
| 1617 | - if(!$info) continue; |
|
| 1617 | + if (!$info) continue; |
|
| 1618 | 1618 | |
| 1619 | 1619 | $info->module = $module_name; |
| 1620 | 1620 | $info->category = $info->category; |
@@ -1623,12 +1623,12 @@ discard block |
||
| 1623 | 1623 | $info->path = $path; |
| 1624 | 1624 | $info->admin_index_act = $info->admin_index_act; |
| 1625 | 1625 | // Check if DB is installed |
| 1626 | - if($table_count > $created_table_count) $info->need_install = true; |
|
| 1626 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
| 1627 | 1627 | else $info->need_install = false; |
| 1628 | 1628 | // Check if it is upgraded to module.class.php on each module |
| 1629 | 1629 | $oDummy = null; |
| 1630 | 1630 | $oDummy = getModule($module_name, 'class'); |
| 1631 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1631 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
| 1632 | 1632 | { |
| 1633 | 1633 | $info->need_update = $oDummy->checkUpdate(); |
| 1634 | 1634 | } |
@@ -1649,15 +1649,15 @@ discard block |
||
| 1649 | 1649 | */ |
| 1650 | 1650 | function syncModuleToSite(&$data) |
| 1651 | 1651 | { |
| 1652 | - if(!$data) return; |
|
| 1652 | + if (!$data) return; |
|
| 1653 | 1653 | |
| 1654 | - if(is_array($data)) |
|
| 1654 | + if (is_array($data)) |
|
| 1655 | 1655 | { |
| 1656 | - foreach($data as $key => $val) |
|
| 1656 | + foreach ($data as $key => $val) |
|
| 1657 | 1657 | { |
| 1658 | 1658 | $module_srls[] = $val->module_srl; |
| 1659 | 1659 | } |
| 1660 | - if(!count($module_srls)) return; |
|
| 1660 | + if (!count($module_srls)) return; |
|
| 1661 | 1661 | } |
| 1662 | 1662 | else |
| 1663 | 1663 | { |
@@ -1665,17 +1665,17 @@ discard block |
||
| 1665 | 1665 | } |
| 1666 | 1666 | |
| 1667 | 1667 | $args = new stdClass(); |
| 1668 | - $args->module_srls = implode(',',$module_srls); |
|
| 1668 | + $args->module_srls = implode(',', $module_srls); |
|
| 1669 | 1669 | $output = executeQueryArray('module.getModuleSites', $args); |
| 1670 | - if(!$output->data) return array(); |
|
| 1671 | - foreach($output->data as $key => $val) |
|
| 1670 | + if (!$output->data) return array(); |
|
| 1671 | + foreach ($output->data as $key => $val) |
|
| 1672 | 1672 | { |
| 1673 | 1673 | $modules[$val->module_srl] = $val; |
| 1674 | 1674 | } |
| 1675 | 1675 | |
| 1676 | - if(is_array($data)) |
|
| 1676 | + if (is_array($data)) |
|
| 1677 | 1677 | { |
| 1678 | - foreach($data as $key => $val) |
|
| 1678 | + foreach ($data as $key => $val) |
|
| 1679 | 1679 | { |
| 1680 | 1680 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
| 1681 | 1681 | } |
@@ -1691,14 +1691,14 @@ discard block |
||
| 1691 | 1691 | */ |
| 1692 | 1692 | function isSiteAdmin($member_info, $site_srl = null) |
| 1693 | 1693 | { |
| 1694 | - if(!$member_info->member_srl) return false; |
|
| 1695 | - if($member_info->is_admin == 'Y') return true; |
|
| 1694 | + if (!$member_info->member_srl) return false; |
|
| 1695 | + if ($member_info->is_admin == 'Y') return true; |
|
| 1696 | 1696 | |
| 1697 | 1697 | $args = new stdClass(); |
| 1698 | - if(!isset($site_srl)) |
|
| 1698 | + if (!isset($site_srl)) |
|
| 1699 | 1699 | { |
| 1700 | 1700 | $site_module_info = Context::get('site_module_info'); |
| 1701 | - if(!$site_module_info) return; |
|
| 1701 | + if (!$site_module_info) return; |
|
| 1702 | 1702 | $args->site_srl = $site_module_info->site_srl; |
| 1703 | 1703 | } |
| 1704 | 1704 | else |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | |
| 1709 | 1709 | $args->member_srl = $member_info->member_srl; |
| 1710 | 1710 | $output = executeQuery('module.isSiteAdmin', $args); |
| 1711 | - if($output->data->member_srl == $args->member_srl) return true; |
|
| 1711 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
| 1712 | 1712 | return false; |
| 1713 | 1713 | } |
| 1714 | 1714 | |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | $obj = new stdClass(); |
| 1732 | 1732 | $obj->module_srl = $module_srl; |
| 1733 | 1733 | $output = executeQueryArray('module.getAdminID', $obj); |
| 1734 | - if(!$output->toBool() || !$output->data) return; |
|
| 1734 | + if (!$output->toBool() || !$output->data) return; |
|
| 1735 | 1735 | |
| 1736 | 1736 | return $output->data; |
| 1737 | 1737 | } |
@@ -1744,20 +1744,20 @@ discard block |
||
| 1744 | 1744 | { |
| 1745 | 1745 | $extra_vars = array(); |
| 1746 | 1746 | $get_module_srls = array(); |
| 1747 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1747 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1748 | 1748 | |
| 1749 | 1749 | $vars = false; |
| 1750 | 1750 | // cache controll |
| 1751 | 1751 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1752 | - if($oCacheHandler->isSupport()) |
|
| 1752 | + if ($oCacheHandler->isSupport()) |
|
| 1753 | 1753 | { |
| 1754 | - foreach($list_module_srl as $module_srl) |
|
| 1754 | + foreach ($list_module_srl as $module_srl) |
|
| 1755 | 1755 | { |
| 1756 | 1756 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1757 | 1757 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1758 | 1758 | $vars = $oCacheHandler->get($cache_key); |
| 1759 | 1759 | |
| 1760 | - if($vars) |
|
| 1760 | + if ($vars) |
|
| 1761 | 1761 | { |
| 1762 | 1762 | $extra_vars[$module_srl] = $vars; |
| 1763 | 1763 | } |
@@ -1772,35 +1772,35 @@ discard block |
||
| 1772 | 1772 | $get_module_srls = $list_module_srl; |
| 1773 | 1773 | } |
| 1774 | 1774 | |
| 1775 | - if(count($get_module_srls) > 0) |
|
| 1775 | + if (count($get_module_srls) > 0) |
|
| 1776 | 1776 | { |
| 1777 | 1777 | $args = new stdClass(); |
| 1778 | 1778 | $args->module_srl = implode(',', $get_module_srls); |
| 1779 | 1779 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
| 1780 | 1780 | |
| 1781 | - if(!$output->toBool()) |
|
| 1781 | + if (!$output->toBool()) |
|
| 1782 | 1782 | { |
| 1783 | 1783 | return; |
| 1784 | 1784 | } |
| 1785 | 1785 | |
| 1786 | - if(!$output->data) |
|
| 1786 | + if (!$output->data) |
|
| 1787 | 1787 | { |
| 1788 | - foreach($get_module_srls as $module_srl) |
|
| 1788 | + foreach ($get_module_srls as $module_srl) |
|
| 1789 | 1789 | { |
| 1790 | 1790 | $extra_vars[$module_srl] = new stdClass; |
| 1791 | 1791 | } |
| 1792 | 1792 | } |
| 1793 | - foreach($output->data as $key => $val) |
|
| 1793 | + foreach ($output->data as $key => $val) |
|
| 1794 | 1794 | { |
| 1795 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
| 1795 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
| 1796 | 1796 | |
| 1797 | - if(!isset($extra_vars[$val->module_srl])) |
|
| 1797 | + if (!isset($extra_vars[$val->module_srl])) |
|
| 1798 | 1798 | { |
| 1799 | 1799 | $extra_vars[$val->module_srl] = new stdClass(); |
| 1800 | 1800 | } |
| 1801 | 1801 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
| 1802 | 1802 | |
| 1803 | - if($oCacheHandler->isSupport()) |
|
| 1803 | + if ($oCacheHandler->isSupport()) |
|
| 1804 | 1804 | { |
| 1805 | 1805 | $object_key = 'module_extra_vars:'.$val->module_srl; |
| 1806 | 1806 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1819,27 +1819,27 @@ discard block |
||
| 1819 | 1819 | { |
| 1820 | 1820 | $skin_vars = false; |
| 1821 | 1821 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1822 | - if($oCacheHandler->isSupport()) |
|
| 1822 | + if ($oCacheHandler->isSupport()) |
|
| 1823 | 1823 | { |
| 1824 | 1824 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1825 | 1825 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1826 | 1826 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1827 | 1827 | } |
| 1828 | 1828 | |
| 1829 | - if($skin_vars === false) |
|
| 1829 | + if ($skin_vars === false) |
|
| 1830 | 1830 | { |
| 1831 | 1831 | $args = new stdClass(); |
| 1832 | 1832 | $args->module_srl = $module_srl; |
| 1833 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
| 1834 | - if(!$output->toBool()) return; |
|
| 1833 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
| 1834 | + if (!$output->toBool()) return; |
|
| 1835 | 1835 | |
| 1836 | 1836 | $skin_vars = array(); |
| 1837 | - foreach($output->data as $vars) |
|
| 1837 | + foreach ($output->data as $vars) |
|
| 1838 | 1838 | { |
| 1839 | 1839 | $skin_vars[$vars->name] = $vars; |
| 1840 | 1840 | } |
| 1841 | 1841 | |
| 1842 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1842 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | 1845 | return $skin_vars; |
@@ -1851,32 +1851,32 @@ discard block |
||
| 1851 | 1851 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
| 1852 | 1852 | { |
| 1853 | 1853 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
| 1854 | - if(!$site_srl) $site_srl = 0; |
|
| 1854 | + if (!$site_srl) $site_srl = 0; |
|
| 1855 | 1855 | |
| 1856 | 1856 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
| 1857 | - if(is_readable($designInfoFile)) |
|
| 1857 | + if (is_readable($designInfoFile)) |
|
| 1858 | 1858 | { |
| 1859 | 1859 | include($designInfoFile); |
| 1860 | 1860 | |
| 1861 | 1861 | $skinName = $designInfo->module->{$module_name}->{$target}; |
| 1862 | 1862 | } |
| 1863 | - if(!$skinName) |
|
| 1863 | + if (!$skinName) |
|
| 1864 | 1864 | { |
| 1865 | 1865 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
| 1866 | 1866 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
| 1867 | 1867 | |
| 1868 | - if(is_dir($moduleSkinPath.'default')) |
|
| 1868 | + if (is_dir($moduleSkinPath.'default')) |
|
| 1869 | 1869 | { |
| 1870 | 1870 | $skinName = 'default'; |
| 1871 | 1871 | } |
| 1872 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 1872 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
| 1873 | 1873 | { |
| 1874 | 1874 | $skinName = 'xe_default'; |
| 1875 | 1875 | } |
| 1876 | 1876 | else |
| 1877 | 1877 | { |
| 1878 | 1878 | $skins = FileHandler::readDir($moduleSkinPath); |
| 1879 | - if(count($skins) > 0) |
|
| 1879 | + if (count($skins) > 0) |
|
| 1880 | 1880 | { |
| 1881 | 1881 | $skinName = $skins[0]; |
| 1882 | 1882 | } |
@@ -1886,9 +1886,9 @@ discard block |
||
| 1886 | 1886 | } |
| 1887 | 1887 | } |
| 1888 | 1888 | |
| 1889 | - if($updateCache && $skinName) |
|
| 1889 | + if ($updateCache && $skinName) |
|
| 1890 | 1890 | { |
| 1891 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 1891 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 1892 | 1892 | $designInfo->module->{$module_name}->{$target} = $skinName; |
| 1893 | 1893 | |
| 1894 | 1894 | $oAdminController = getAdminController('admin'); |
@@ -1904,10 +1904,10 @@ discard block |
||
| 1904 | 1904 | */ |
| 1905 | 1905 | function syncSkinInfoToModuleInfo(&$module_info) |
| 1906 | 1906 | { |
| 1907 | - if(!$module_info->module_srl) return; |
|
| 1907 | + if (!$module_info->module_srl) return; |
|
| 1908 | 1908 | |
| 1909 | 1909 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1910 | - if(Mobile::isFromMobilePhone()) |
|
| 1910 | + if (Mobile::isFromMobilePhone()) |
|
| 1911 | 1911 | { |
| 1912 | 1912 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
| 1913 | 1913 | } |
@@ -1916,11 +1916,11 @@ discard block |
||
| 1916 | 1916 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | - if(!$skin_vars) return; |
|
| 1919 | + if (!$skin_vars) return; |
|
| 1920 | 1920 | |
| 1921 | - foreach($skin_vars as $name => $val) |
|
| 1921 | + foreach ($skin_vars as $name => $val) |
|
| 1922 | 1922 | { |
| 1923 | - if(isset($module_info->{$name})) continue; |
|
| 1923 | + if (isset($module_info->{$name})) continue; |
|
| 1924 | 1924 | $module_info->{$name} = $val->value; |
| 1925 | 1925 | } |
| 1926 | 1926 | } |
@@ -1934,27 +1934,27 @@ discard block |
||
| 1934 | 1934 | { |
| 1935 | 1935 | $skin_vars = false; |
| 1936 | 1936 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1937 | - if($oCacheHandler->isSupport()) |
|
| 1937 | + if ($oCacheHandler->isSupport()) |
|
| 1938 | 1938 | { |
| 1939 | 1939 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
| 1940 | 1940 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1941 | 1941 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1942 | 1942 | } |
| 1943 | 1943 | |
| 1944 | - if($skin_vars === false) |
|
| 1944 | + if ($skin_vars === false) |
|
| 1945 | 1945 | { |
| 1946 | 1946 | $args = new stdClass(); |
| 1947 | 1947 | $args->module_srl = $module_srl; |
| 1948 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
| 1949 | - if(!$output->toBool() || !$output->data) return; |
|
| 1948 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
| 1949 | + if (!$output->toBool() || !$output->data) return; |
|
| 1950 | 1950 | |
| 1951 | 1951 | $skin_vars = array(); |
| 1952 | - foreach($output->data as $vars) |
|
| 1952 | + foreach ($output->data as $vars) |
|
| 1953 | 1953 | { |
| 1954 | 1954 | $skin_vars[$vars->name] = $vars; |
| 1955 | 1955 | } |
| 1956 | 1956 | |
| 1957 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1957 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1958 | 1958 | } |
| 1959 | 1959 | |
| 1960 | 1960 | return $skin_vars; |
@@ -1966,32 +1966,32 @@ discard block |
||
| 1966 | 1966 | */ |
| 1967 | 1967 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
| 1968 | 1968 | { |
| 1969 | - if(!$module_info->module_srl) return; |
|
| 1969 | + if (!$module_info->module_srl) return; |
|
| 1970 | 1970 | $skin_vars = false; |
| 1971 | 1971 | // cache controll |
| 1972 | 1972 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1973 | - if($oCacheHandler->isSupport()) |
|
| 1973 | + if ($oCacheHandler->isSupport()) |
|
| 1974 | 1974 | { |
| 1975 | 1975 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
| 1976 | 1976 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1977 | 1977 | $skin_vars = $oCacheHandler->get($cache_key); |
| 1978 | 1978 | } |
| 1979 | - if($skin_vars === false) |
|
| 1979 | + if ($skin_vars === false) |
|
| 1980 | 1980 | { |
| 1981 | 1981 | $args = new stdClass; |
| 1982 | 1982 | $args->module_srl = $module_info->module_srl; |
| 1983 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
| 1984 | - if(!$output->toBool()) return; |
|
| 1983 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
| 1984 | + if (!$output->toBool()) return; |
|
| 1985 | 1985 | $skin_vars = $output->data; |
| 1986 | 1986 | |
| 1987 | 1987 | //insert in cache |
| 1988 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1988 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 1989 | 1989 | } |
| 1990 | - if(!$skin_vars) return; |
|
| 1990 | + if (!$skin_vars) return; |
|
| 1991 | 1991 | |
| 1992 | - foreach($output->data as $val) |
|
| 1992 | + foreach ($output->data as $val) |
|
| 1993 | 1993 | { |
| 1994 | - if(isset($module_info->{$val->name})) continue; |
|
| 1994 | + if (isset($module_info->{$val->name})) continue; |
|
| 1995 | 1995 | $module_info->{$val->name} = $val->value; |
| 1996 | 1996 | } |
| 1997 | 1997 | } |
@@ -2003,7 +2003,7 @@ discard block |
||
| 2003 | 2003 | { |
| 2004 | 2004 | $grant = new stdClass(); |
| 2005 | 2005 | |
| 2006 | - if(!$xml_info) |
|
| 2006 | + if (!$xml_info) |
|
| 2007 | 2007 | { |
| 2008 | 2008 | $module = $module_info->module; |
| 2009 | 2009 | $xml_info = $this->getModuleActionXml($module); |
@@ -2011,9 +2011,9 @@ discard block |
||
| 2011 | 2011 | // Set variables to grant group permission |
| 2012 | 2012 | $module_srl = $module_info->module_srl; |
| 2013 | 2013 | $grant_info = $xml_info->grant; |
| 2014 | - if($member_info->member_srl) |
|
| 2014 | + if ($member_info->member_srl) |
|
| 2015 | 2015 | { |
| 2016 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 2016 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 2017 | 2017 | else $group_list = array(); |
| 2018 | 2018 | } |
| 2019 | 2019 | else |
@@ -2021,10 +2021,10 @@ discard block |
||
| 2021 | 2021 | $group_list = array(); |
| 2022 | 2022 | } |
| 2023 | 2023 | // If module_srl doesn't exist(if unable to set permissions) |
| 2024 | - if(!$module_srl) |
|
| 2024 | + if (!$module_srl) |
|
| 2025 | 2025 | { |
| 2026 | 2026 | $grant->access = true; |
| 2027 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
| 2027 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
| 2028 | 2028 | { |
| 2029 | 2029 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
| 2030 | 2030 | } |
@@ -2035,23 +2035,23 @@ discard block |
||
| 2035 | 2035 | { |
| 2036 | 2036 | // If module_srl exists |
| 2037 | 2037 | // Get a type of granted permission |
| 2038 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
| 2038 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ? true : false; |
|
| 2039 | 2039 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
| 2040 | 2040 | // If a just logged-in member is, check if the member is a module administrator |
| 2041 | - if(!$grant->manager && $member_info->member_srl) |
|
| 2041 | + if (!$grant->manager && $member_info->member_srl) |
|
| 2042 | 2042 | { |
| 2043 | 2043 | $args = new stdClass(); |
| 2044 | 2044 | $args->module_srl = $module_srl; |
| 2045 | 2045 | $args->member_srl = $member_info->member_srl; |
| 2046 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
| 2047 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2046 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
| 2047 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2048 | 2048 | } |
| 2049 | 2049 | // If not an administrator, get information from the DB and grant manager privilege. |
| 2050 | - if(!$grant->manager) |
|
| 2050 | + if (!$grant->manager) |
|
| 2051 | 2051 | { |
| 2052 | 2052 | $args = new stdClass(); |
| 2053 | 2053 | // If planet, get permission settings from the planet home |
| 2054 | - if($module_info->module == 'planet') |
|
| 2054 | + if ($module_info->module == 'planet') |
|
| 2055 | 2055 | { |
| 2056 | 2056 | $output = executeQueryArray('module.getPlanetGrants', $args); |
| 2057 | 2057 | } |
@@ -2064,42 +2064,42 @@ discard block |
||
| 2064 | 2064 | |
| 2065 | 2065 | $grant_exists = $granted = array(); |
| 2066 | 2066 | |
| 2067 | - if($output->data) |
|
| 2067 | + if ($output->data) |
|
| 2068 | 2068 | { |
| 2069 | 2069 | // Arrange names and groups who has privileges |
| 2070 | - foreach($output->data as $val) |
|
| 2070 | + foreach ($output->data as $val) |
|
| 2071 | 2071 | { |
| 2072 | 2072 | $grant_exists[$val->name] = true; |
| 2073 | - if($granted[$val->name]) continue; |
|
| 2073 | + if ($granted[$val->name]) continue; |
|
| 2074 | 2074 | // Log-in member only |
| 2075 | - if($val->group_srl == -1) |
|
| 2075 | + if ($val->group_srl == -1) |
|
| 2076 | 2076 | { |
| 2077 | 2077 | $granted[$val->name] = true; |
| 2078 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2078 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2079 | 2079 | // Site-joined member only |
| 2080 | 2080 | } |
| 2081 | - elseif($val->group_srl == -2) |
|
| 2081 | + elseif ($val->group_srl == -2) |
|
| 2082 | 2082 | { |
| 2083 | 2083 | $granted[$val->name] = true; |
| 2084 | 2084 | // Do not grant any permission for non-logged member |
| 2085 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2085 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2086 | 2086 | // Log-in member |
| 2087 | 2087 | else |
| 2088 | 2088 | { |
| 2089 | 2089 | $site_module_info = Context::get('site_module_info'); |
| 2090 | 2090 | // Permission granted if no information of the currently connected site exists |
| 2091 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2091 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2092 | 2092 | // Permission is not granted if information of the currently connected site exists |
| 2093 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
| 2093 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
| 2094 | 2094 | } |
| 2095 | 2095 | // All of non-logged members |
| 2096 | 2096 | } |
| 2097 | - elseif($val->group_srl == -3) |
|
| 2097 | + elseif ($val->group_srl == -3) |
|
| 2098 | 2098 | { |
| 2099 | 2099 | $granted[$val->name] = true; |
| 2100 | 2100 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
| 2101 | 2101 | } |
| 2102 | - elseif($val->group_srl == 0) |
|
| 2102 | + elseif ($val->group_srl == 0) |
|
| 2103 | 2103 | { |
| 2104 | 2104 | $granted[$val->name] = true; |
| 2105 | 2105 | $grant->{$val->name} = true; |
@@ -2107,7 +2107,7 @@ discard block |
||
| 2107 | 2107 | } |
| 2108 | 2108 | else |
| 2109 | 2109 | { |
| 2110 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
| 2110 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
| 2111 | 2111 | { |
| 2112 | 2112 | $grant->{$val->name} = true; |
| 2113 | 2113 | $granted[$val->name] = true; |
@@ -2116,29 +2116,29 @@ discard block |
||
| 2116 | 2116 | } |
| 2117 | 2117 | } |
| 2118 | 2118 | // Separate processing for the virtual group access |
| 2119 | - if(!$grant_exists['access']) $grant->access = true; |
|
| 2120 | - if(count($grant_info)) |
|
| 2119 | + if (!$grant_exists['access']) $grant->access = true; |
|
| 2120 | + if (count($grant_info)) |
|
| 2121 | 2121 | { |
| 2122 | - foreach($grant_info as $grant_name => $grant_item) |
|
| 2122 | + foreach ($grant_info as $grant_name => $grant_item) |
|
| 2123 | 2123 | { |
| 2124 | - if($grant_exists[$grant_name]) continue; |
|
| 2125 | - switch($grant_item->default) |
|
| 2124 | + if ($grant_exists[$grant_name]) continue; |
|
| 2125 | + switch ($grant_item->default) |
|
| 2126 | 2126 | { |
| 2127 | 2127 | case 'guest' : |
| 2128 | 2128 | $grant->{$grant_name} = true; |
| 2129 | 2129 | break; |
| 2130 | 2130 | case 'member' : |
| 2131 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2131 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2132 | 2132 | else $grant->{$grant_name} = false; |
| 2133 | 2133 | break; |
| 2134 | 2134 | case 'site' : |
| 2135 | 2135 | $site_module_info = Context::get('site_module_info'); |
| 2136 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2136 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2137 | 2137 | else $grant->{$grant_name} = false; |
| 2138 | 2138 | break; |
| 2139 | 2139 | case 'manager' : |
| 2140 | 2140 | case 'root' : |
| 2141 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2141 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2142 | 2142 | else $grant->{$grant_name} = false; |
| 2143 | 2143 | break; |
| 2144 | 2144 | } |
@@ -2146,12 +2146,12 @@ discard block |
||
| 2146 | 2146 | } |
| 2147 | 2147 | } |
| 2148 | 2148 | // Set true to grant all privileges if an administrator is |
| 2149 | - if($grant->manager) |
|
| 2149 | + if ($grant->manager) |
|
| 2150 | 2150 | { |
| 2151 | 2151 | $grant->access = true; |
| 2152 | - if(count($grant_info)) |
|
| 2152 | + if (count($grant_info)) |
|
| 2153 | 2153 | { |
| 2154 | - foreach($grant_info as $key => $val) |
|
| 2154 | + foreach ($grant_info as $key => $val) |
|
| 2155 | 2155 | { |
| 2156 | 2156 | $grant->{$key} = true; |
| 2157 | 2157 | } |
@@ -2183,27 +2183,27 @@ discard block |
||
| 2183 | 2183 | |
| 2184 | 2184 | function unserializeAttributes($module_filebox_list) |
| 2185 | 2185 | { |
| 2186 | - if(is_array($module_filebox_list->data)) |
|
| 2186 | + if (is_array($module_filebox_list->data)) |
|
| 2187 | 2187 | { |
| 2188 | - foreach($module_filebox_list->data as &$item) |
|
| 2188 | + foreach ($module_filebox_list->data as &$item) |
|
| 2189 | 2189 | { |
| 2190 | - if(empty($item->comment)) |
|
| 2190 | + if (empty($item->comment)) |
|
| 2191 | 2191 | { |
| 2192 | 2192 | continue; |
| 2193 | 2193 | } |
| 2194 | 2194 | |
| 2195 | 2195 | $attributes = explode(';', $item->comment); |
| 2196 | - foreach($attributes as $attribute) |
|
| 2196 | + foreach ($attributes as $attribute) |
|
| 2197 | 2197 | { |
| 2198 | 2198 | $values = explode(':', $attribute); |
| 2199 | - if((count($values) % 2) ==1) |
|
| 2199 | + if ((count($values) % 2) == 1) |
|
| 2200 | 2200 | { |
| 2201 | - for($i=2;$i<count($values);$i++) |
|
| 2201 | + for ($i = 2; $i < count($values); $i++) |
|
| 2202 | 2202 | { |
| 2203 | - $values[1].=":".$values[$i]; |
|
| 2203 | + $values[1] .= ":".$values[$i]; |
|
| 2204 | 2204 | } |
| 2205 | 2205 | } |
| 2206 | - $atts[$values[0]]=$values[1]; |
|
| 2206 | + $atts[$values[0]] = $values[1]; |
|
| 2207 | 2207 | } |
| 2208 | 2208 | $item->attributes = $atts; |
| 2209 | 2209 | unset($atts); |
@@ -2215,16 +2215,16 @@ discard block |
||
| 2215 | 2215 | function getFileBoxListHtml() |
| 2216 | 2216 | { |
| 2217 | 2217 | $logged_info = Context::get('logged_info'); |
| 2218 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2218 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2219 | 2219 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
| 2220 | - $link_params = explode('&',$link['query']); |
|
| 2220 | + $link_params = explode('&', $link['query']); |
|
| 2221 | 2221 | foreach ($link_params as $param) |
| 2222 | 2222 | { |
| 2223 | - $param = explode("=",$param); |
|
| 2224 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2223 | + $param = explode("=", $param); |
|
| 2224 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2225 | 2225 | } |
| 2226 | 2226 | $oWidgetModel = getModel('widget'); |
| 2227 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2227 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2228 | 2228 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
| 2229 | 2229 | |
| 2230 | 2230 | $oModuleModel = getModel('module'); |
@@ -2240,24 +2240,24 @@ discard block |
||
| 2240 | 2240 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
| 2241 | 2241 | |
| 2242 | 2242 | $oTemplate = &TemplateHandler::getInstance(); |
| 2243 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
| 2243 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
| 2244 | 2244 | |
| 2245 | 2245 | $this->add('html', $html); |
| 2246 | 2246 | } |
| 2247 | 2247 | |
| 2248 | 2248 | function getModuleFileBoxPath($module_filebox_srl) |
| 2249 | 2249 | { |
| 2250 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
| 2250 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
| 2251 | 2251 | } |
| 2252 | 2252 | |
| 2253 | 2253 | /** |
| 2254 | 2254 | * @brief Return ruleset cache file path |
| 2255 | 2255 | * @param module, act |
| 2256 | 2256 | */ |
| 2257 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
| 2257 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
| 2258 | 2258 | { |
| 2259 | 2259 | // load dynamic ruleset xml file |
| 2260 | - if(strpos($ruleset, '@') !== false) |
|
| 2260 | + if (strpos($ruleset, '@') !== false) |
|
| 2261 | 2261 | { |
| 2262 | 2262 | $rulsetFile = str_replace('@', '', $ruleset); |
| 2263 | 2263 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2267,20 +2267,20 @@ discard block |
||
| 2267 | 2267 | { |
| 2268 | 2268 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
| 2269 | 2269 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2270 | - if(is_readable($xml_file)) |
|
| 2270 | + if (is_readable($xml_file)) |
|
| 2271 | 2271 | return FileHandler::getRealPath($xml_file); |
| 2272 | - else{ |
|
| 2272 | + else { |
|
| 2273 | 2273 | $ruleset = str_replace('#', '', $ruleset); |
| 2274 | 2274 | } |
| 2275 | 2275 | |
| 2276 | 2276 | } |
| 2277 | 2277 | // Get a path of the requested module. Return if not exists. |
| 2278 | 2278 | $class_path = ModuleHandler::getModulePath($module); |
| 2279 | - if(!$class_path) return; |
|
| 2279 | + if (!$class_path) return; |
|
| 2280 | 2280 | |
| 2281 | 2281 | // Check if module.xml exists in the path. Return if not exist |
| 2282 | 2282 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
| 2283 | - if(!file_exists($xml_file)) return; |
|
| 2283 | + if (!file_exists($xml_file)) return; |
|
| 2284 | 2284 | |
| 2285 | 2285 | return $xml_file; |
| 2286 | 2286 | } |
@@ -2292,7 +2292,7 @@ discard block |
||
| 2292 | 2292 | $requestVars = Context::getRequestVars(); |
| 2293 | 2293 | |
| 2294 | 2294 | $args = new stdClass; |
| 2295 | - $args->site_srl = (int)$requestVars->site_srl; |
|
| 2295 | + $args->site_srl = (int) $requestVars->site_srl; |
|
| 2296 | 2296 | $args->page = 1; // /< Page |
| 2297 | 2297 | $args->list_count = 100; // /< the number of posts to display on a single page |
| 2298 | 2298 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2304,9 +2304,9 @@ discard block |
||
| 2304 | 2304 | |
| 2305 | 2305 | $list = array(); |
| 2306 | 2306 | |
| 2307 | - if($output->toBool()) |
|
| 2307 | + if ($output->toBool()) |
|
| 2308 | 2308 | { |
| 2309 | - foreach((array)$output->data as $code_info) |
|
| 2309 | + foreach ((array) $output->data as $code_info) |
|
| 2310 | 2310 | { |
| 2311 | 2311 | unset($codeInfo); |
| 2312 | 2312 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -19,26 +19,34 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | function isIDExists($id, $site_srl = 0) |
| 21 | 21 | { |
| 22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
| 22 | + if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 23 | 25 | // directory and rss/atom/api reserved checking, etc. |
| 24 | 26 | $dirs = FileHandler::readDir(_XE_PATH_); |
| 25 | 27 | $dirs[] = 'rss'; |
| 26 | 28 | $dirs[] = 'atom'; |
| 27 | 29 | $dirs[] = 'api'; |
| 28 | - if(in_array($id, $dirs)) return true; |
|
| 30 | + if(in_array($id, $dirs)) { |
|
| 31 | + return true; |
|
| 32 | + } |
|
| 29 | 33 | // mid test |
| 30 | 34 | $args = new stdClass(); |
| 31 | 35 | $args->mid = $id; |
| 32 | 36 | $args->site_srl = $site_srl; |
| 33 | 37 | $output = executeQuery('module.isExistsModuleName', $args); |
| 34 | - if($output->data->count) return true; |
|
| 38 | + if($output->data->count) { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 35 | 41 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
| 36 | 42 | if(!$site_srl) |
| 37 | 43 | { |
| 38 | 44 | $site_args = new stdClass(); |
| 39 | 45 | $site_args->domain = $id; |
| 40 | 46 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
| 41 | - if($output->data->count) return true; |
|
| 47 | + if($output->data->count) { |
|
| 48 | + return true; |
|
| 49 | + } |
|
| 42 | 50 | } |
| 43 | 51 | |
| 44 | 52 | return false; |
@@ -82,10 +90,14 @@ discard block |
||
| 82 | 90 | function getDefaultMid() |
| 83 | 91 | { |
| 84 | 92 | $default_url = Context::getDefaultUrl(); |
| 85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
| 93 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
| 94 | + $default_url = substr($default_url, 0, -1); |
|
| 95 | + } |
|
| 86 | 96 | |
| 87 | 97 | $request_url = Context::getRequestUri(); |
| 88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
| 98 | + if($request_url && substr_compare($request_url, '/', -1) === 0) { |
|
| 99 | + $request_url = substr($request_url, 0, -1); |
|
| 100 | + } |
|
| 89 | 101 | |
| 90 | 102 | $default_url_parse = parse_url($default_url); |
| 91 | 103 | $request_url_parse = parse_url($request_url); |
@@ -100,14 +112,18 @@ discard block |
||
| 100 | 112 | $hostname = $request_url_parse['host']; |
| 101 | 113 | $path = $request_url_parse['path']; |
| 102 | 114 | $port = $request_url_parse['port']; |
| 103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
| 115 | + if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) { |
|
| 116 | + $path = substr($path, 0, -1); |
|
| 117 | + } |
|
| 104 | 118 | |
| 105 | 119 | $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
| 106 | 120 | } |
| 107 | 121 | |
| 108 | 122 | if($domain === '') |
| 109 | 123 | { |
| 110 | - if(!$vid) $vid = $mid; |
|
| 124 | + if(!$vid) { |
|
| 125 | + $vid = $mid; |
|
| 126 | + } |
|
| 111 | 127 | if($vid) |
| 112 | 128 | { |
| 113 | 129 | $domain = $vid; |
@@ -133,13 +149,17 @@ discard block |
||
| 133 | 149 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
| 134 | 150 | $site_info = $output->data; |
| 135 | 151 | |
| 136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 152 | + if($oCacheHandler->isSupport()) { |
|
| 153 | + $oCacheHandler->put($domain_cache_key, $site_info); |
|
| 154 | + } |
|
| 137 | 155 | } |
| 138 | 156 | |
| 139 | 157 | if($site_info && $vid) |
| 140 | 158 | { |
| 141 | 159 | Context::set('vid', $site_info->domain, true); |
| 142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
| 160 | + if(strtolower($mid)==strtolower($site_info->domain)) { |
|
| 161 | + Context::set('mid', $site_info->mid,true); |
|
| 162 | + } |
|
| 143 | 163 | } |
| 144 | 164 | if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
| 145 | 165 | } |
@@ -165,8 +185,12 @@ discard block |
||
| 165 | 185 | { |
| 166 | 186 | // Create a table if sites table doesn't exist |
| 167 | 187 | $oDB = &DB::getInstance(); |
| 168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 169 | - if(!$oDB->isTableExists('sites')) return; |
|
| 188 | + if(!$oDB->isTableExists('sites')) { |
|
| 189 | + $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
| 190 | + } |
|
| 191 | + if(!$oDB->isTableExists('sites')) { |
|
| 192 | + return; |
|
| 193 | + } |
|
| 170 | 194 | |
| 171 | 195 | // Get mid, language |
| 172 | 196 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
@@ -184,21 +208,28 @@ discard block |
||
| 184 | 208 | if($output->data && !$output->data->index_module_srl) |
| 185 | 209 | { |
| 186 | 210 | $output = executeQuery('module.updateSite', $site_args); |
| 187 | - } |
|
| 188 | - else |
|
| 211 | + } else |
|
| 189 | 212 | { |
| 190 | 213 | $output = executeQuery('module.insertSite', $site_args); |
| 191 | - if(!$output->toBool()) return $output; |
|
| 214 | + if(!$output->toBool()) { |
|
| 215 | + return $output; |
|
| 216 | + } |
|
| 192 | 217 | } |
| 193 | 218 | $output = executeQuery('module.getSiteInfo', $args); |
| 194 | 219 | } |
| 195 | 220 | $site_info = $output->data; |
| 196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 221 | + if($oCacheHandler->isSupport()) { |
|
| 222 | + $oCacheHandler->put($default_site_cache_key, $site_info); |
|
| 223 | + } |
|
| 197 | 224 | } |
| 198 | 225 | } |
| 199 | 226 | |
| 200 | - if(!$site_info->module_srl) return $site_info; |
|
| 201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
| 227 | + if(!$site_info->module_srl) { |
|
| 228 | + return $site_info; |
|
| 229 | + } |
|
| 230 | + if(is_array($site_info) && $site_info->data[0]) { |
|
| 231 | + $site_info = $site_info[0]; |
|
| 232 | + } |
|
| 202 | 233 | return $this->addModuleExtraVars($site_info); |
| 203 | 234 | } |
| 204 | 235 | |
@@ -248,7 +279,9 @@ discard block |
||
| 248 | 279 | } |
| 249 | 280 | |
| 250 | 281 | $this->applyDefaultSkin($module_info); |
| 251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
| 282 | + if(!$module_info->module_srl && $module_info->data[0]) { |
|
| 283 | + $module_info = $module_info->data[0]; |
|
| 284 | + } |
|
| 252 | 285 | return $this->addModuleExtraVars($module_info); |
| 253 | 286 | } |
| 254 | 287 | |
@@ -340,8 +373,7 @@ discard block |
||
| 340 | 373 | $object_key = 'mid_info:' . $output->data->module_srl; |
| 341 | 374 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 342 | 375 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
| 343 | - } |
|
| 344 | - else |
|
| 376 | + } else |
|
| 345 | 377 | { |
| 346 | 378 | $mid_info->designSettings = $moduleInfo->designSettings; |
| 347 | 379 | $moduleInfo = $mid_info; |
@@ -382,11 +414,15 @@ discard block |
||
| 382 | 414 | $args = new stdClass(); |
| 383 | 415 | $args->module_srl = $module_srl; |
| 384 | 416 | $output = executeQuery('module.getMidInfo', $args); |
| 385 | - if(!$output->toBool()) return; |
|
| 417 | + if(!$output->toBool()) { |
|
| 418 | + return; |
|
| 419 | + } |
|
| 386 | 420 | |
| 387 | 421 | $mid_info = $output->data; |
| 388 | 422 | $this->applyDefaultSkin($mid_info); |
| 389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
| 423 | + if($oCacheHandler->isSupport()) { |
|
| 424 | + $oCacheHandler->put($cache_key, $mid_info); |
|
| 425 | + } |
|
| 390 | 426 | } |
| 391 | 427 | |
| 392 | 428 | if($mid_info && count($columnList)) |
@@ -399,11 +435,14 @@ discard block |
||
| 399 | 435 | $module_info->$key = $item; |
| 400 | 436 | } |
| 401 | 437 | } |
| 438 | + } else { |
|
| 439 | + $module_info = $mid_info; |
|
| 402 | 440 | } |
| 403 | - else $module_info = $mid_info; |
|
| 404 | 441 | |
| 405 | 442 | $oModuleController = getController('module'); |
| 406 | - if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 443 | + if(isset($module_info->browser_title)) { |
|
| 444 | + $oModuleController->replaceDefinedLangCode($module_info->browser_title); |
|
| 445 | + } |
|
| 407 | 446 | |
| 408 | 447 | $this->applyDefaultSkin($module_info); |
| 409 | 448 | return $this->addModuleExtraVars($module_info); |
@@ -451,11 +490,15 @@ discard block |
||
| 451 | 490 | */ |
| 452 | 491 | function getModulesInfo($module_srls, $columnList = array()) |
| 453 | 492 | { |
| 454 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
| 493 | + if(is_array($module_srls)) { |
|
| 494 | + $module_srls = implode(',',$module_srls); |
|
| 495 | + } |
|
| 455 | 496 | $args = new stdClass(); |
| 456 | 497 | $args->module_srls = $module_srls; |
| 457 | 498 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
| 458 | - if(!$output->toBool()) return; |
|
| 499 | + if(!$output->toBool()) { |
|
| 500 | + return; |
|
| 501 | + } |
|
| 459 | 502 | return $this->addModuleExtraVars($output->data); |
| 460 | 503 | } |
| 461 | 504 | |
@@ -465,31 +508,44 @@ discard block |
||
| 465 | 508 | function addModuleExtraVars($module_info) |
| 466 | 509 | { |
| 467 | 510 | // Process although one or more module informaion is requested |
| 468 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
| 469 | - else $target_module_info = $module_info; |
|
| 511 | + if(!is_array($module_info)) { |
|
| 512 | + $target_module_info = array($module_info); |
|
| 513 | + } else { |
|
| 514 | + $target_module_info = $module_info; |
|
| 515 | + } |
|
| 470 | 516 | // Get module_srl |
| 471 | 517 | $module_srls = array(); |
| 472 | 518 | foreach($target_module_info as $key => $val) |
| 473 | 519 | { |
| 474 | 520 | $module_srl = $val->module_srl; |
| 475 | - if(!$module_srl) continue; |
|
| 521 | + if(!$module_srl) { |
|
| 522 | + continue; |
|
| 523 | + } |
|
| 476 | 524 | $module_srls[] = $val->module_srl; |
| 477 | 525 | } |
| 478 | 526 | // Extract extra information of the module and skin |
| 479 | 527 | $extra_vars = $this->getModuleExtraVars($module_srls); |
| 480 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
| 528 | + if(!count($module_srls) || !count($extra_vars)) { |
|
| 529 | + return $module_info; |
|
| 530 | + } |
|
| 481 | 531 | |
| 482 | 532 | foreach($target_module_info as $key => $val) |
| 483 | 533 | { |
| 484 | - if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue; |
|
| 534 | + if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) { |
|
| 535 | + continue; |
|
| 536 | + } |
|
| 485 | 537 | foreach($extra_vars[$val->module_srl] as $k => $v) |
| 486 | 538 | { |
| 487 | - if($target_module_info[$key]->{$k}) continue; |
|
| 539 | + if($target_module_info[$key]->{$k}) { |
|
| 540 | + continue; |
|
| 541 | + } |
|
| 488 | 542 | $target_module_info[$key]->{$k} = $v; |
| 489 | 543 | } |
| 490 | 544 | } |
| 491 | 545 | |
| 492 | - if(is_array($module_info)) return $target_module_info; |
|
| 546 | + if(is_array($module_info)) { |
|
| 547 | + return $target_module_info; |
|
| 548 | + } |
|
| 493 | 549 | return $target_module_info[0]; |
| 494 | 550 | } |
| 495 | 551 | |
@@ -518,7 +574,9 @@ discard block |
||
| 518 | 574 | } |
| 519 | 575 | |
| 520 | 576 | $output = executeQuery('module.getMidList', $args, $columnList); |
| 521 | - if(!$output->toBool()) return $output; |
|
| 577 | + if(!$output->toBool()) { |
|
| 578 | + return $output; |
|
| 579 | + } |
|
| 522 | 580 | $list = $output->data; |
| 523 | 581 | |
| 524 | 582 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -526,9 +584,13 @@ discard block |
||
| 526 | 584 | $oCacheHandler->put($cache_key, $list); |
| 527 | 585 | } |
| 528 | 586 | } |
| 529 | - if(!$list) return; |
|
| 587 | + if(!$list) { |
|
| 588 | + return; |
|
| 589 | + } |
|
| 530 | 590 | |
| 531 | - if(!is_array($list)) $list = array($list); |
|
| 591 | + if(!is_array($list)) { |
|
| 592 | + $list = array($list); |
|
| 593 | + } |
|
| 532 | 594 | |
| 533 | 595 | foreach($list as $val) |
| 534 | 596 | { |
@@ -544,10 +606,14 @@ discard block |
||
| 544 | 606 | function getModuleSrlList($args = null, $columnList = array()) |
| 545 | 607 | { |
| 546 | 608 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
| 547 | - if(!$output->toBool()) return $output; |
|
| 609 | + if(!$output->toBool()) { |
|
| 610 | + return $output; |
|
| 611 | + } |
|
| 548 | 612 | |
| 549 | 613 | $list = $output->data; |
| 550 | - if(!$list) return; |
|
| 614 | + if(!$list) { |
|
| 615 | + return; |
|
| 616 | + } |
|
| 551 | 617 | |
| 552 | 618 | return $list; |
| 553 | 619 | } |
@@ -557,20 +623,32 @@ discard block |
||
| 557 | 623 | */ |
| 558 | 624 | function getModuleSrlByMid($mid) |
| 559 | 625 | { |
| 560 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
| 561 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
| 626 | + if($mid && !is_array($mid)) { |
|
| 627 | + $mid = explode(',',$mid); |
|
| 628 | + } |
|
| 629 | + if(is_array($mid)) { |
|
| 630 | + $mid = "'".implode("','",$mid)."'"; |
|
| 631 | + } |
|
| 562 | 632 | |
| 563 | 633 | $site_module_info = Context::get('site_module_info'); |
| 564 | 634 | |
| 565 | 635 | $args = new stdClass; |
| 566 | 636 | $args->mid = $mid; |
| 567 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
| 637 | + if($site_module_info) { |
|
| 638 | + $args->site_srl = $site_module_info->site_srl; |
|
| 639 | + } |
|
| 568 | 640 | $output = executeQuery('module.getModuleSrlByMid', $args); |
| 569 | - if(!$output->toBool()) return $output; |
|
| 641 | + if(!$output->toBool()) { |
|
| 642 | + return $output; |
|
| 643 | + } |
|
| 570 | 644 | |
| 571 | 645 | $list = $output->data; |
| 572 | - if(!$list) return; |
|
| 573 | - if(!is_array($list)) $list = array($list); |
|
| 646 | + if(!$list) { |
|
| 647 | + return; |
|
| 648 | + } |
|
| 649 | + if(!is_array($list)) { |
|
| 650 | + $list = array($list); |
|
| 651 | + } |
|
| 574 | 652 | |
| 575 | 653 | foreach($list as $key => $val) |
| 576 | 654 | { |
@@ -599,8 +677,12 @@ discard block |
||
| 599 | 677 | { |
| 600 | 678 | $args = new stdClass(); |
| 601 | 679 | $output = executeQueryArray('module.getActionForward',$args); |
| 602 | - if(!$output->toBool()) return new stdClass; |
|
| 603 | - if(!$output->data) $output->data = array(); |
|
| 680 | + if(!$output->toBool()) { |
|
| 681 | + return new stdClass; |
|
| 682 | + } |
|
| 683 | + if(!$output->data) { |
|
| 684 | + $output->data = array(); |
|
| 685 | + } |
|
| 604 | 686 | |
| 605 | 687 | $action_forward = array(); |
| 606 | 688 | foreach($output->data as $item) |
@@ -617,8 +699,7 @@ discard block |
||
| 617 | 699 | if($action_forward[$act]) |
| 618 | 700 | { |
| 619 | 701 | return $action_forward[$act]; |
| 620 | - } |
|
| 621 | - else |
|
| 702 | + } else |
|
| 622 | 703 | { |
| 623 | 704 | return new stdClass(); |
| 624 | 705 | } |
@@ -726,8 +807,7 @@ discard block |
||
| 726 | 807 | if(file_exists($cache_file)) |
| 727 | 808 | { |
| 728 | 809 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
| 729 | - } |
|
| 730 | - else |
|
| 810 | + } else |
|
| 731 | 811 | { |
| 732 | 812 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
| 733 | 813 | } |
@@ -743,16 +823,22 @@ discard block |
||
| 743 | 823 | { |
| 744 | 824 | // Get a path of the requested module. Return if not exists. |
| 745 | 825 | $module_path = ModuleHandler::getModulePath($module); |
| 746 | - if(!$module_path) return; |
|
| 826 | + if(!$module_path) { |
|
| 827 | + return; |
|
| 828 | + } |
|
| 747 | 829 | // Read the xml file for module skin information |
| 748 | 830 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
| 749 | - if(!file_exists($xml_file)) return; |
|
| 831 | + if(!file_exists($xml_file)) { |
|
| 832 | + return; |
|
| 833 | + } |
|
| 750 | 834 | |
| 751 | 835 | $oXmlParser = new XmlParser(); |
| 752 | 836 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
| 753 | 837 | $xml_obj = $tmp_xml_obj->module; |
| 754 | 838 | |
| 755 | - if(!$xml_obj) return; |
|
| 839 | + if(!$xml_obj) { |
|
| 840 | + return; |
|
| 841 | + } |
|
| 756 | 842 | |
| 757 | 843 | // Module Information |
| 758 | 844 | $module_info = new stdClass(); |
@@ -764,14 +850,19 @@ discard block |
||
| 764 | 850 | $module_info->version = $xml_obj->version->body; |
| 765 | 851 | $module_info->homepage = $xml_obj->link->body; |
| 766 | 852 | $module_info->category = $xml_obj->category->body; |
| 767 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 853 | + if(!$module_info->category) { |
|
| 854 | + $module_info->category = 'service'; |
|
| 855 | + } |
|
| 768 | 856 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 769 | 857 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 770 | 858 | $module_info->license = $xml_obj->license->body; |
| 771 | 859 | $module_info->license_link = $xml_obj->license->attrs->link; |
| 772 | 860 | |
| 773 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 774 | - else $author_list = $xml_obj->author; |
|
| 861 | + if(!is_array($xml_obj->author)) { |
|
| 862 | + $author_list[] = $xml_obj->author; |
|
| 863 | + } else { |
|
| 864 | + $author_list = $xml_obj->author; |
|
| 865 | + } |
|
| 775 | 866 | |
| 776 | 867 | foreach($author_list as $author) |
| 777 | 868 | { |
@@ -781,15 +872,16 @@ discard block |
||
| 781 | 872 | $author_obj->homepage = $author->attrs->link; |
| 782 | 873 | $module_info->author[] = $author_obj; |
| 783 | 874 | } |
| 784 | - } |
|
| 785 | - else |
|
| 875 | + } else |
|
| 786 | 876 | { |
| 787 | 877 | // module format 0.1 |
| 788 | 878 | $module_info->title = $xml_obj->title->body; |
| 789 | 879 | $module_info->description = $xml_obj->author->description->body; |
| 790 | 880 | $module_info->version = $xml_obj->attrs->version; |
| 791 | 881 | $module_info->category = $xml_obj->attrs->category; |
| 792 | - if(!$module_info->category) $module_info->category = 'service'; |
|
| 882 | + if(!$module_info->category) { |
|
| 883 | + $module_info->category = 'service'; |
|
| 884 | + } |
|
| 793 | 885 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 794 | 886 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
| 795 | 887 | $author_obj = new stdClass(); |
@@ -818,11 +910,15 @@ discard block |
||
| 818 | 910 | { |
| 819 | 911 | // Get a path of the requested module. Return if not exists. |
| 820 | 912 | $class_path = ModuleHandler::getModulePath($module); |
| 821 | - if(!$class_path) return; |
|
| 913 | + if(!$class_path) { |
|
| 914 | + return; |
|
| 915 | + } |
|
| 822 | 916 | |
| 823 | 917 | // Check if module.xml exists in the path. Return if not exist |
| 824 | 918 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
| 825 | - if(!file_exists($xml_file)) return; |
|
| 919 | + if(!file_exists($xml_file)) { |
|
| 920 | + return; |
|
| 921 | + } |
|
| 826 | 922 | |
| 827 | 923 | // Check if cached file exists |
| 828 | 924 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -841,7 +937,10 @@ discard block |
||
| 841 | 937 | |
| 842 | 938 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
| 843 | 939 | |
| 844 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
| 940 | + if(!count($xml_obj->module)) { |
|
| 941 | + return; |
|
| 942 | + } |
|
| 943 | + // /< Error occurs if module tag doesn't included in the xml |
|
| 845 | 944 | |
| 846 | 945 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
| 847 | 946 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -853,8 +952,11 @@ discard block |
||
| 853 | 952 | // Arrange permission information |
| 854 | 953 | if($grants) |
| 855 | 954 | { |
| 856 | - if(is_array($grants)) $grant_list = $grants; |
|
| 857 | - else $grant_list[] = $grants; |
|
| 955 | + if(is_array($grants)) { |
|
| 956 | + $grant_list = $grants; |
|
| 957 | + } else { |
|
| 958 | + $grant_list[] = $grants; |
|
| 959 | + } |
|
| 858 | 960 | |
| 859 | 961 | $info->grant = new stdClass(); |
| 860 | 962 | $buff[] = '$info->grant = new stdClass;'; |
@@ -876,8 +978,11 @@ discard block |
||
| 876 | 978 | // Permissions to grant |
| 877 | 979 | if($permissions) |
| 878 | 980 | { |
| 879 | - if(is_array($permissions)) $permission_list = $permissions; |
|
| 880 | - else $permission_list[] = $permissions; |
|
| 981 | + if(is_array($permissions)) { |
|
| 982 | + $permission_list = $permissions; |
|
| 983 | + } else { |
|
| 984 | + $permission_list[] = $permissions; |
|
| 985 | + } |
|
| 881 | 986 | |
| 882 | 987 | $buff[] = '$info->permission = new stdClass;'; |
| 883 | 988 | |
@@ -895,8 +1000,11 @@ discard block |
||
| 895 | 1000 | // for admin menus |
| 896 | 1001 | if($menus) |
| 897 | 1002 | { |
| 898 | - if(is_array($menus)) $menu_list = $menus; |
|
| 899 | - else $menu_list[] = $menus; |
|
| 1003 | + if(is_array($menus)) { |
|
| 1004 | + $menu_list = $menus; |
|
| 1005 | + } else { |
|
| 1006 | + $menu_list[] = $menus; |
|
| 1007 | + } |
|
| 900 | 1008 | |
| 901 | 1009 | $buff[] = '$info->menu = new stdClass;'; |
| 902 | 1010 | $info->menu = new stdClass(); |
@@ -920,8 +1028,11 @@ discard block |
||
| 920 | 1028 | // actions |
| 921 | 1029 | if($actions) |
| 922 | 1030 | { |
| 923 | - if(is_array($actions)) $action_list = $actions; |
|
| 924 | - else $action_list[] = $actions; |
|
| 1031 | + if(is_array($actions)) { |
|
| 1032 | + $action_list = $actions; |
|
| 1033 | + } else { |
|
| 1034 | + $action_list[] = $actions; |
|
| 1035 | + } |
|
| 925 | 1036 | |
| 926 | 1037 | $buff[] = '$info->action = new stdClass;'; |
| 927 | 1038 | $info->action = new stdClass(); |
@@ -1010,7 +1121,9 @@ discard block |
||
| 1010 | 1121 | return $info; |
| 1011 | 1122 | } |
| 1012 | 1123 | |
| 1013 | - if(file_exists($cache_file)) return include($cache_file); |
|
| 1124 | + if(file_exists($cache_file)) { |
|
| 1125 | + return include($cache_file); |
|
| 1126 | + } |
|
| 1014 | 1127 | } |
| 1015 | 1128 | |
| 1016 | 1129 | /** |
@@ -1048,7 +1161,9 @@ discard block |
||
| 1048 | 1161 | |
| 1049 | 1162 | $skin_path = sprintf("%s/%s/", $path, $dir); |
| 1050 | 1163 | $list = FileHandler::readDir($skin_path); |
| 1051 | - if(!count($list)) return; |
|
| 1164 | + if(!count($list)) { |
|
| 1165 | + return; |
|
| 1166 | + } |
|
| 1052 | 1167 | |
| 1053 | 1168 | natcasesort($list); |
| 1054 | 1169 | |
@@ -1102,8 +1217,7 @@ discard block |
||
| 1102 | 1217 | if($dir == 'skins') |
| 1103 | 1218 | { |
| 1104 | 1219 | $type = 'P'; |
| 1105 | - } |
|
| 1106 | - else |
|
| 1220 | + } else |
|
| 1107 | 1221 | { |
| 1108 | 1222 | $type = 'M'; |
| 1109 | 1223 | } |
@@ -1131,14 +1245,20 @@ discard block |
||
| 1131 | 1245 | function loadSkinInfo($path, $skin, $dir = 'skins') |
| 1132 | 1246 | { |
| 1133 | 1247 | // Read xml file having skin information |
| 1134 | - if(substr($path,-1)!='/') $path .= '/'; |
|
| 1248 | + if(substr($path,-1)!='/') { |
|
| 1249 | + $path .= '/'; |
|
| 1250 | + } |
|
| 1135 | 1251 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
| 1136 | - if(!file_exists($skin_xml_file)) return; |
|
| 1252 | + if(!file_exists($skin_xml_file)) { |
|
| 1253 | + return; |
|
| 1254 | + } |
|
| 1137 | 1255 | // Create XmlParser object |
| 1138 | 1256 | $oXmlParser = new XmlParser(); |
| 1139 | 1257 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
| 1140 | 1258 | // Return if no skin information is |
| 1141 | - if(!$_xml_obj->skin) return; |
|
| 1259 | + if(!$_xml_obj->skin) { |
|
| 1260 | + return; |
|
| 1261 | + } |
|
| 1142 | 1262 | $xml_obj = $_xml_obj->skin; |
| 1143 | 1263 | // Skin Name |
| 1144 | 1264 | $skin_info = new stdClass(); |
@@ -1155,8 +1275,11 @@ discard block |
||
| 1155 | 1275 | $skin_info->license_link = $xml_obj->license->attrs->link; |
| 1156 | 1276 | $skin_info->description = $xml_obj->description->body; |
| 1157 | 1277 | |
| 1158 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
| 1159 | - else $author_list = $xml_obj->author; |
|
| 1278 | + if(!is_array($xml_obj->author)) { |
|
| 1279 | + $author_list[] = $xml_obj->author; |
|
| 1280 | + } else { |
|
| 1281 | + $author_list = $xml_obj->author; |
|
| 1282 | + } |
|
| 1160 | 1283 | |
| 1161 | 1284 | foreach($author_list as $author) |
| 1162 | 1285 | { |
@@ -1170,8 +1293,12 @@ discard block |
||
| 1170 | 1293 | if($xml_obj->extra_vars) |
| 1171 | 1294 | { |
| 1172 | 1295 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1173 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1174 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1296 | + if(!$extra_var_groups) { |
|
| 1297 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 1298 | + } |
|
| 1299 | + if(!is_array($extra_var_groups)) { |
|
| 1300 | + $extra_var_groups = array($extra_var_groups); |
|
| 1301 | + } |
|
| 1175 | 1302 | |
| 1176 | 1303 | foreach($extra_var_groups as $group) |
| 1177 | 1304 | { |
@@ -1180,7 +1307,9 @@ discard block |
||
| 1180 | 1307 | { |
| 1181 | 1308 | continue; |
| 1182 | 1309 | } |
| 1183 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
| 1310 | + if(!is_array($group->var)) { |
|
| 1311 | + $extra_vars = array($group->var); |
|
| 1312 | + } |
|
| 1184 | 1313 | |
| 1185 | 1314 | foreach($extra_vars as $key => $val) |
| 1186 | 1315 | { |
@@ -1207,8 +1336,7 @@ discard block |
||
| 1207 | 1336 | $obj->options[$i]->title = $val->options[$i]->title->body; |
| 1208 | 1337 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
| 1209 | 1338 | } |
| 1210 | - } |
|
| 1211 | - else |
|
| 1339 | + } else |
|
| 1212 | 1340 | { |
| 1213 | 1341 | $obj->options[0] = new stdClass(); |
| 1214 | 1342 | $obj->options[0]->title = $val->options->title->body; |
@@ -1219,8 +1347,7 @@ discard block |
||
| 1219 | 1347 | } |
| 1220 | 1348 | } |
| 1221 | 1349 | } |
| 1222 | - } |
|
| 1223 | - else |
|
| 1350 | + } else |
|
| 1224 | 1351 | { |
| 1225 | 1352 | // skin format v0.1 |
| 1226 | 1353 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1238,8 +1365,12 @@ discard block |
||
| 1238 | 1365 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
| 1239 | 1366 | // Variables used in the skin |
| 1240 | 1367 | $extra_var_groups = $xml_obj->extra_vars->group; |
| 1241 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
| 1242 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
| 1368 | + if(!$extra_var_groups) { |
|
| 1369 | + $extra_var_groups = $xml_obj->extra_vars; |
|
| 1370 | + } |
|
| 1371 | + if(!is_array($extra_var_groups)) { |
|
| 1372 | + $extra_var_groups = array($extra_var_groups); |
|
| 1373 | + } |
|
| 1243 | 1374 | |
| 1244 | 1375 | foreach($extra_var_groups as $group) |
| 1245 | 1376 | { |
@@ -1247,7 +1378,9 @@ discard block |
||
| 1247 | 1378 | |
| 1248 | 1379 | if($extra_vars) |
| 1249 | 1380 | { |
| 1250 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
| 1381 | + if(!is_array($extra_vars)) { |
|
| 1382 | + $extra_vars = array($extra_vars); |
|
| 1383 | + } |
|
| 1251 | 1384 | |
| 1252 | 1385 | foreach($extra_vars as $var) |
| 1253 | 1386 | { |
@@ -1269,8 +1402,7 @@ discard block |
||
| 1269 | 1402 | $options[$i]->title = $var->default[$i]->body; |
| 1270 | 1403 | $options[$i]->value = $var->default[$i]->body; |
| 1271 | 1404 | } |
| 1272 | - } |
|
| 1273 | - else |
|
| 1405 | + } else |
|
| 1274 | 1406 | { |
| 1275 | 1407 | $options[0]->title = $var->default->body; |
| 1276 | 1408 | $options[0]->value = $var->default->body; |
@@ -1300,7 +1432,9 @@ discard block |
||
| 1300 | 1432 | $colorset = $xml_obj->colorset->color; |
| 1301 | 1433 | if($colorset) |
| 1302 | 1434 | { |
| 1303 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
| 1435 | + if(!is_array($colorset)) { |
|
| 1436 | + $colorset = array($colorset); |
|
| 1437 | + } |
|
| 1304 | 1438 | |
| 1305 | 1439 | foreach($colorset as $color) |
| 1306 | 1440 | { |
@@ -1310,9 +1444,12 @@ discard block |
||
| 1310 | 1444 | if($screenshot) |
| 1311 | 1445 | { |
| 1312 | 1446 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
| 1313 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
| 1447 | + if(!file_exists($screenshot)) { |
|
| 1448 | + $screenshot = ""; |
|
| 1449 | + } |
|
| 1450 | + } else { |
|
| 1451 | + $screenshot = ""; |
|
| 1314 | 1452 | } |
| 1315 | - else $screenshot = ""; |
|
| 1316 | 1453 | |
| 1317 | 1454 | $obj = new stdClass(); |
| 1318 | 1455 | $obj->name = $name; |
@@ -1325,7 +1462,9 @@ discard block |
||
| 1325 | 1462 | if($xml_obj->menus->menu) |
| 1326 | 1463 | { |
| 1327 | 1464 | $menus = $xml_obj->menus->menu; |
| 1328 | - if(!is_array($menus)) $menus = array($menus); |
|
| 1465 | + if(!is_array($menus)) { |
|
| 1466 | + $menus = array($menus); |
|
| 1467 | + } |
|
| 1329 | 1468 | |
| 1330 | 1469 | $menu_count = count($menus); |
| 1331 | 1470 | $skin_info->menu_count = $menu_count; |
@@ -1334,7 +1473,9 @@ discard block |
||
| 1334 | 1473 | unset($obj); |
| 1335 | 1474 | |
| 1336 | 1475 | $obj->name = $menus[$i]->attrs->name; |
| 1337 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
| 1476 | + if($menus[$i]->attrs->default == "true") { |
|
| 1477 | + $obj->default = true; |
|
| 1478 | + } |
|
| 1338 | 1479 | $obj->title = $menus[$i]->title->body; |
| 1339 | 1480 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
| 1340 | 1481 | |
@@ -1354,7 +1495,9 @@ discard block |
||
| 1354 | 1495 | { |
| 1355 | 1496 | $args = new stdClass; |
| 1356 | 1497 | $args->site_srl = $site_srl; |
| 1357 | - if(!is_null($module)) $args->module = $module; |
|
| 1498 | + if(!is_null($module)) { |
|
| 1499 | + $args->module = $module; |
|
| 1500 | + } |
|
| 1358 | 1501 | $output = executeQuery('module.getModuleCount', $args); |
| 1359 | 1502 | return $output->data->count; |
| 1360 | 1503 | } |
@@ -1383,8 +1526,11 @@ discard block |
||
| 1383 | 1526 | $args->module = $module; |
| 1384 | 1527 | $args->site_srl = $site_srl; |
| 1385 | 1528 | $output = executeQuery('module.getModuleConfig', $args); |
| 1386 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1387 | - else $config = null; |
|
| 1529 | + if($output->data->config) { |
|
| 1530 | + $config = unserialize($output->data->config); |
|
| 1531 | + } else { |
|
| 1532 | + $config = null; |
|
| 1533 | + } |
|
| 1388 | 1534 | |
| 1389 | 1535 | //insert in cache |
| 1390 | 1536 | if($oCacheHandler->isSupport()) |
@@ -1423,8 +1569,11 @@ discard block |
||
| 1423 | 1569 | $args->module = $module; |
| 1424 | 1570 | $args->module_srl = $module_srl; |
| 1425 | 1571 | $output = executeQuery('module.getModulePartConfig', $args); |
| 1426 | - if($output->data->config) $config = unserialize($output->data->config); |
|
| 1427 | - else $config = null; |
|
| 1572 | + if($output->data->config) { |
|
| 1573 | + $config = unserialize($output->data->config); |
|
| 1574 | + } else { |
|
| 1575 | + $config = null; |
|
| 1576 | + } |
|
| 1428 | 1577 | |
| 1429 | 1578 | //insert in cache |
| 1430 | 1579 | if($oCacheHandler->isSupport()) |
@@ -1446,9 +1595,13 @@ discard block |
||
| 1446 | 1595 | { |
| 1447 | 1596 | $args = new stdClass(); |
| 1448 | 1597 | $args->module = $module; |
| 1449 | - if($site_srl) $args->site_srl = $site_srl; |
|
| 1598 | + if($site_srl) { |
|
| 1599 | + $args->site_srl = $site_srl; |
|
| 1600 | + } |
|
| 1450 | 1601 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
| 1451 | - if(!$output->toBool() || !$output->data) return array(); |
|
| 1602 | + if(!$output->toBool() || !$output->data) { |
|
| 1603 | + return array(); |
|
| 1604 | + } |
|
| 1452 | 1605 | |
| 1453 | 1606 | foreach($output->data as $key => $val) |
| 1454 | 1607 | { |
@@ -1466,10 +1619,16 @@ discard block |
||
| 1466 | 1619 | $args->moduleCategorySrl = $moduleCategorySrl; |
| 1467 | 1620 | // Get data from the DB |
| 1468 | 1621 | $output = executeQuery('module.getModuleCategories', $args); |
| 1469 | - if(!$output->toBool()) return $output; |
|
| 1622 | + if(!$output->toBool()) { |
|
| 1623 | + return $output; |
|
| 1624 | + } |
|
| 1470 | 1625 | $list = $output->data; |
| 1471 | - if(!$list) return; |
|
| 1472 | - if(!is_array($list)) $list = array($list); |
|
| 1626 | + if(!$list) { |
|
| 1627 | + return; |
|
| 1628 | + } |
|
| 1629 | + if(!is_array($list)) { |
|
| 1630 | + $list = array($list); |
|
| 1631 | + } |
|
| 1473 | 1632 | |
| 1474 | 1633 | foreach($list as $val) |
| 1475 | 1634 | { |
@@ -1487,7 +1646,9 @@ discard block |
||
| 1487 | 1646 | $args = new stdClass; |
| 1488 | 1647 | $args->module_category_srl = $module_category_srl; |
| 1489 | 1648 | $output = executeQuery('module.getModuleCategory', $args); |
| 1490 | - if(!$output->toBool()) return $output; |
|
| 1649 | + if(!$output->toBool()) { |
|
| 1650 | + return $output; |
|
| 1651 | + } |
|
| 1491 | 1652 | return $output->data; |
| 1492 | 1653 | } |
| 1493 | 1654 | |
@@ -1499,7 +1660,9 @@ discard block |
||
| 1499 | 1660 | // Get a list of downloaded and installed modules |
| 1500 | 1661 | $searched_list = FileHandler::readDir('./modules'); |
| 1501 | 1662 | $searched_count = count($searched_list); |
| 1502 | - if(!$searched_count) return; |
|
| 1663 | + if(!$searched_count) { |
|
| 1664 | + return; |
|
| 1665 | + } |
|
| 1503 | 1666 | sort($searched_list); |
| 1504 | 1667 | |
| 1505 | 1668 | for($i=0;$i<$searched_count;$i++) |
@@ -1512,7 +1675,9 @@ discard block |
||
| 1512 | 1675 | $info = $this->getModuleInfoXml($module_name); |
| 1513 | 1676 | unset($obj); |
| 1514 | 1677 | |
| 1515 | - if(!isset($info)) continue; |
|
| 1678 | + if(!isset($info)) { |
|
| 1679 | + continue; |
|
| 1680 | + } |
|
| 1516 | 1681 | $info->module = $module_name; |
| 1517 | 1682 | $info->created_table_count = $created_table_count; |
| 1518 | 1683 | $info->table_count = $table_count; |
@@ -1538,11 +1703,16 @@ discard block |
||
| 1538 | 1703 | for($j=0;$j<count($tmp_files);$j++) |
| 1539 | 1704 | { |
| 1540 | 1705 | list($table_name) = explode(".",$tmp_files[$j]); |
| 1541 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1706 | + if($oDB->isTableExists($table_name)) { |
|
| 1707 | + $created_table_count ++; |
|
| 1708 | + } |
|
| 1542 | 1709 | } |
| 1543 | 1710 | // Check if DB is installed |
| 1544 | - if($table_count > $created_table_count) return true; |
|
| 1545 | - else return false; |
|
| 1711 | + if($table_count > $created_table_count) { |
|
| 1712 | + return true; |
|
| 1713 | + } else { |
|
| 1714 | + return false; |
|
| 1715 | + } |
|
| 1546 | 1716 | } |
| 1547 | 1717 | return false; |
| 1548 | 1718 | } |
@@ -1565,15 +1735,23 @@ discard block |
||
| 1565 | 1735 | */ |
| 1566 | 1736 | public function needUpdate($update_id) |
| 1567 | 1737 | { |
| 1568 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
| 1738 | + if(!is_array($update_id)) { |
|
| 1739 | + $update_id = array($update_id); |
|
| 1740 | + } |
|
| 1569 | 1741 | |
| 1570 | 1742 | $args = new stdClass(); |
| 1571 | 1743 | $args->update_id = implode(',', $update_id); |
| 1572 | 1744 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
| 1573 | 1745 | |
| 1574 | - if(!!$output->error) return false; |
|
| 1575 | - if(!$output->data) $output->data = array(); |
|
| 1576 | - if(count($update_id) === count($output->data)) return false; |
|
| 1746 | + if(!!$output->error) { |
|
| 1747 | + return false; |
|
| 1748 | + } |
|
| 1749 | + if(!$output->data) { |
|
| 1750 | + $output->data = array(); |
|
| 1751 | + } |
|
| 1752 | + if(count($update_id) === count($output->data)) { |
|
| 1753 | + return false; |
|
| 1754 | + } |
|
| 1577 | 1755 | |
| 1578 | 1756 | return true; |
| 1579 | 1757 | } |
@@ -1590,7 +1768,9 @@ discard block |
||
| 1590 | 1768 | sort($searched_list); |
| 1591 | 1769 | |
| 1592 | 1770 | $searched_count = count($searched_list); |
| 1593 | - if(!$searched_count) return; |
|
| 1771 | + if(!$searched_count) { |
|
| 1772 | + return; |
|
| 1773 | + } |
|
| 1594 | 1774 | |
| 1595 | 1775 | for($i=0;$i<$searched_count;$i++) |
| 1596 | 1776 | { |
@@ -1598,7 +1778,9 @@ discard block |
||
| 1598 | 1778 | $module_name = $searched_list[$i]; |
| 1599 | 1779 | |
| 1600 | 1780 | $path = ModuleHandler::getModulePath($module_name); |
| 1601 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
| 1781 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
| 1782 | + continue; |
|
| 1783 | + } |
|
| 1602 | 1784 | |
| 1603 | 1785 | // Get the number of xml files to create a table in schemas |
| 1604 | 1786 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1608,13 +1790,17 @@ discard block |
||
| 1608 | 1790 | for($j=0;$j<$table_count;$j++) |
| 1609 | 1791 | { |
| 1610 | 1792 | list($table_name) = explode('.',$tmp_files[$j]); |
| 1611 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
| 1793 | + if($oDB->isTableExists($table_name)) { |
|
| 1794 | + $created_table_count ++; |
|
| 1795 | + } |
|
| 1612 | 1796 | } |
| 1613 | 1797 | // Get information of the module |
| 1614 | 1798 | $info = NULL; |
| 1615 | 1799 | $info = $this->getModuleInfoXml($module_name); |
| 1616 | 1800 | |
| 1617 | - if(!$info) continue; |
|
| 1801 | + if(!$info) { |
|
| 1802 | + continue; |
|
| 1803 | + } |
|
| 1618 | 1804 | |
| 1619 | 1805 | $info->module = $module_name; |
| 1620 | 1806 | $info->category = $info->category; |
@@ -1623,16 +1809,18 @@ discard block |
||
| 1623 | 1809 | $info->path = $path; |
| 1624 | 1810 | $info->admin_index_act = $info->admin_index_act; |
| 1625 | 1811 | // Check if DB is installed |
| 1626 | - if($table_count > $created_table_count) $info->need_install = true; |
|
| 1627 | - else $info->need_install = false; |
|
| 1812 | + if($table_count > $created_table_count) { |
|
| 1813 | + $info->need_install = true; |
|
| 1814 | + } else { |
|
| 1815 | + $info->need_install = false; |
|
| 1816 | + } |
|
| 1628 | 1817 | // Check if it is upgraded to module.class.php on each module |
| 1629 | 1818 | $oDummy = null; |
| 1630 | 1819 | $oDummy = getModule($module_name, 'class'); |
| 1631 | 1820 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
| 1632 | 1821 | { |
| 1633 | 1822 | $info->need_update = $oDummy->checkUpdate(); |
| 1634 | - } |
|
| 1635 | - else |
|
| 1823 | + } else |
|
| 1636 | 1824 | { |
| 1637 | 1825 | continue; |
| 1638 | 1826 | } |
@@ -1649,7 +1837,9 @@ discard block |
||
| 1649 | 1837 | */ |
| 1650 | 1838 | function syncModuleToSite(&$data) |
| 1651 | 1839 | { |
| 1652 | - if(!$data) return; |
|
| 1840 | + if(!$data) { |
|
| 1841 | + return; |
|
| 1842 | + } |
|
| 1653 | 1843 | |
| 1654 | 1844 | if(is_array($data)) |
| 1655 | 1845 | { |
@@ -1657,9 +1847,10 @@ discard block |
||
| 1657 | 1847 | { |
| 1658 | 1848 | $module_srls[] = $val->module_srl; |
| 1659 | 1849 | } |
| 1660 | - if(!count($module_srls)) return; |
|
| 1661 | - } |
|
| 1662 | - else |
|
| 1850 | + if(!count($module_srls)) { |
|
| 1851 | + return; |
|
| 1852 | + } |
|
| 1853 | + } else |
|
| 1663 | 1854 | { |
| 1664 | 1855 | $module_srls[] = $data->module_srl; |
| 1665 | 1856 | } |
@@ -1667,7 +1858,9 @@ discard block |
||
| 1667 | 1858 | $args = new stdClass(); |
| 1668 | 1859 | $args->module_srls = implode(',',$module_srls); |
| 1669 | 1860 | $output = executeQueryArray('module.getModuleSites', $args); |
| 1670 | - if(!$output->data) return array(); |
|
| 1861 | + if(!$output->data) { |
|
| 1862 | + return array(); |
|
| 1863 | + } |
|
| 1671 | 1864 | foreach($output->data as $key => $val) |
| 1672 | 1865 | { |
| 1673 | 1866 | $modules[$val->module_srl] = $val; |
@@ -1679,8 +1872,7 @@ discard block |
||
| 1679 | 1872 | { |
| 1680 | 1873 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
| 1681 | 1874 | } |
| 1682 | - } |
|
| 1683 | - else |
|
| 1875 | + } else |
|
| 1684 | 1876 | { |
| 1685 | 1877 | $data->domain = $modules[$data->module_srl]->domain; |
| 1686 | 1878 | } |
@@ -1691,24 +1883,31 @@ discard block |
||
| 1691 | 1883 | */ |
| 1692 | 1884 | function isSiteAdmin($member_info, $site_srl = null) |
| 1693 | 1885 | { |
| 1694 | - if(!$member_info->member_srl) return false; |
|
| 1695 | - if($member_info->is_admin == 'Y') return true; |
|
| 1886 | + if(!$member_info->member_srl) { |
|
| 1887 | + return false; |
|
| 1888 | + } |
|
| 1889 | + if($member_info->is_admin == 'Y') { |
|
| 1890 | + return true; |
|
| 1891 | + } |
|
| 1696 | 1892 | |
| 1697 | 1893 | $args = new stdClass(); |
| 1698 | 1894 | if(!isset($site_srl)) |
| 1699 | 1895 | { |
| 1700 | 1896 | $site_module_info = Context::get('site_module_info'); |
| 1701 | - if(!$site_module_info) return; |
|
| 1897 | + if(!$site_module_info) { |
|
| 1898 | + return; |
|
| 1899 | + } |
|
| 1702 | 1900 | $args->site_srl = $site_module_info->site_srl; |
| 1703 | - } |
|
| 1704 | - else |
|
| 1901 | + } else |
|
| 1705 | 1902 | { |
| 1706 | 1903 | $args->site_srl = $site_srl; |
| 1707 | 1904 | } |
| 1708 | 1905 | |
| 1709 | 1906 | $args->member_srl = $member_info->member_srl; |
| 1710 | 1907 | $output = executeQuery('module.isSiteAdmin', $args); |
| 1711 | - if($output->data->member_srl == $args->member_srl) return true; |
|
| 1908 | + if($output->data->member_srl == $args->member_srl) { |
|
| 1909 | + return true; |
|
| 1910 | + } |
|
| 1712 | 1911 | return false; |
| 1713 | 1912 | } |
| 1714 | 1913 | |
@@ -1731,7 +1930,9 @@ discard block |
||
| 1731 | 1930 | $obj = new stdClass(); |
| 1732 | 1931 | $obj->module_srl = $module_srl; |
| 1733 | 1932 | $output = executeQueryArray('module.getAdminID', $obj); |
| 1734 | - if(!$output->toBool() || !$output->data) return; |
|
| 1933 | + if(!$output->toBool() || !$output->data) { |
|
| 1934 | + return; |
|
| 1935 | + } |
|
| 1735 | 1936 | |
| 1736 | 1937 | return $output->data; |
| 1737 | 1938 | } |
@@ -1744,7 +1945,9 @@ discard block |
||
| 1744 | 1945 | { |
| 1745 | 1946 | $extra_vars = array(); |
| 1746 | 1947 | $get_module_srls = array(); |
| 1747 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
| 1948 | + if(!is_array($list_module_srl)) { |
|
| 1949 | + $list_module_srl = array($list_module_srl); |
|
| 1950 | + } |
|
| 1748 | 1951 | |
| 1749 | 1952 | $vars = false; |
| 1750 | 1953 | // cache controll |
@@ -1760,14 +1963,12 @@ discard block |
||
| 1760 | 1963 | if($vars) |
| 1761 | 1964 | { |
| 1762 | 1965 | $extra_vars[$module_srl] = $vars; |
| 1763 | - } |
|
| 1764 | - else |
|
| 1966 | + } else |
|
| 1765 | 1967 | { |
| 1766 | 1968 | $get_module_srls[] = $module_srl; |
| 1767 | 1969 | } |
| 1768 | 1970 | } |
| 1769 | - } |
|
| 1770 | - else |
|
| 1971 | + } else |
|
| 1771 | 1972 | { |
| 1772 | 1973 | $get_module_srls = $list_module_srl; |
| 1773 | 1974 | } |
@@ -1792,7 +1993,9 @@ discard block |
||
| 1792 | 1993 | } |
| 1793 | 1994 | foreach($output->data as $key => $val) |
| 1794 | 1995 | { |
| 1795 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
| 1996 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
| 1997 | + continue; |
|
| 1998 | + } |
|
| 1796 | 1999 | |
| 1797 | 2000 | if(!isset($extra_vars[$val->module_srl])) |
| 1798 | 2001 | { |
@@ -1831,7 +2034,9 @@ discard block |
||
| 1831 | 2034 | $args = new stdClass(); |
| 1832 | 2035 | $args->module_srl = $module_srl; |
| 1833 | 2036 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
| 1834 | - if(!$output->toBool()) return; |
|
| 2037 | + if(!$output->toBool()) { |
|
| 2038 | + return; |
|
| 2039 | + } |
|
| 1835 | 2040 | |
| 1836 | 2041 | $skin_vars = array(); |
| 1837 | 2042 | foreach($output->data as $vars) |
@@ -1839,7 +2044,9 @@ discard block |
||
| 1839 | 2044 | $skin_vars[$vars->name] = $vars; |
| 1840 | 2045 | } |
| 1841 | 2046 | |
| 1842 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2047 | + if($oCacheHandler->isSupport()) { |
|
| 2048 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2049 | + } |
|
| 1843 | 2050 | } |
| 1844 | 2051 | |
| 1845 | 2052 | return $skin_vars; |
@@ -1851,7 +2058,9 @@ discard block |
||
| 1851 | 2058 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
| 1852 | 2059 | { |
| 1853 | 2060 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
| 1854 | - if(!$site_srl) $site_srl = 0; |
|
| 2061 | + if(!$site_srl) { |
|
| 2062 | + $site_srl = 0; |
|
| 2063 | + } |
|
| 1855 | 2064 | |
| 1856 | 2065 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
| 1857 | 2066 | if(is_readable($designInfoFile)) |
@@ -1868,19 +2077,16 @@ discard block |
||
| 1868 | 2077 | if(is_dir($moduleSkinPath.'default')) |
| 1869 | 2078 | { |
| 1870 | 2079 | $skinName = 'default'; |
| 1871 | - } |
|
| 1872 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 2080 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
| 1873 | 2081 | { |
| 1874 | 2082 | $skinName = 'xe_default'; |
| 1875 | - } |
|
| 1876 | - else |
|
| 2083 | + } else |
|
| 1877 | 2084 | { |
| 1878 | 2085 | $skins = FileHandler::readDir($moduleSkinPath); |
| 1879 | 2086 | if(count($skins) > 0) |
| 1880 | 2087 | { |
| 1881 | 2088 | $skinName = $skins[0]; |
| 1882 | - } |
|
| 1883 | - else |
|
| 2089 | + } else |
|
| 1884 | 2090 | { |
| 1885 | 2091 | $skinName = NULL; |
| 1886 | 2092 | } |
@@ -1888,7 +2094,9 @@ discard block |
||
| 1888 | 2094 | |
| 1889 | 2095 | if($updateCache && $skinName) |
| 1890 | 2096 | { |
| 1891 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
| 2097 | + if(!isset($designInfo->module->{$module_name})) { |
|
| 2098 | + $designInfo->module->{$module_name} = new stdClass(); |
|
| 2099 | + } |
|
| 1892 | 2100 | $designInfo->module->{$module_name}->{$target} = $skinName; |
| 1893 | 2101 | |
| 1894 | 2102 | $oAdminController = getAdminController('admin'); |
@@ -1904,23 +2112,28 @@ discard block |
||
| 1904 | 2112 | */ |
| 1905 | 2113 | function syncSkinInfoToModuleInfo(&$module_info) |
| 1906 | 2114 | { |
| 1907 | - if(!$module_info->module_srl) return; |
|
| 2115 | + if(!$module_info->module_srl) { |
|
| 2116 | + return; |
|
| 2117 | + } |
|
| 1908 | 2118 | |
| 1909 | 2119 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1910 | 2120 | if(Mobile::isFromMobilePhone()) |
| 1911 | 2121 | { |
| 1912 | 2122 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
| 1913 | - } |
|
| 1914 | - else |
|
| 2123 | + } else |
|
| 1915 | 2124 | { |
| 1916 | 2125 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
| 1917 | 2126 | } |
| 1918 | 2127 | |
| 1919 | - if(!$skin_vars) return; |
|
| 2128 | + if(!$skin_vars) { |
|
| 2129 | + return; |
|
| 2130 | + } |
|
| 1920 | 2131 | |
| 1921 | 2132 | foreach($skin_vars as $name => $val) |
| 1922 | 2133 | { |
| 1923 | - if(isset($module_info->{$name})) continue; |
|
| 2134 | + if(isset($module_info->{$name})) { |
|
| 2135 | + continue; |
|
| 2136 | + } |
|
| 1924 | 2137 | $module_info->{$name} = $val->value; |
| 1925 | 2138 | } |
| 1926 | 2139 | } |
@@ -1946,7 +2159,9 @@ discard block |
||
| 1946 | 2159 | $args = new stdClass(); |
| 1947 | 2160 | $args->module_srl = $module_srl; |
| 1948 | 2161 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
| 1949 | - if(!$output->toBool() || !$output->data) return; |
|
| 2162 | + if(!$output->toBool() || !$output->data) { |
|
| 2163 | + return; |
|
| 2164 | + } |
|
| 1950 | 2165 | |
| 1951 | 2166 | $skin_vars = array(); |
| 1952 | 2167 | foreach($output->data as $vars) |
@@ -1954,7 +2169,9 @@ discard block |
||
| 1954 | 2169 | $skin_vars[$vars->name] = $vars; |
| 1955 | 2170 | } |
| 1956 | 2171 | |
| 1957 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2172 | + if($oCacheHandler->isSupport()) { |
|
| 2173 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2174 | + } |
|
| 1958 | 2175 | } |
| 1959 | 2176 | |
| 1960 | 2177 | return $skin_vars; |
@@ -1966,7 +2183,9 @@ discard block |
||
| 1966 | 2183 | */ |
| 1967 | 2184 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
| 1968 | 2185 | { |
| 1969 | - if(!$module_info->module_srl) return; |
|
| 2186 | + if(!$module_info->module_srl) { |
|
| 2187 | + return; |
|
| 2188 | + } |
|
| 1970 | 2189 | $skin_vars = false; |
| 1971 | 2190 | // cache controll |
| 1972 | 2191 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1981,17 +2200,25 @@ discard block |
||
| 1981 | 2200 | $args = new stdClass; |
| 1982 | 2201 | $args->module_srl = $module_info->module_srl; |
| 1983 | 2202 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
| 1984 | - if(!$output->toBool()) return; |
|
| 2203 | + if(!$output->toBool()) { |
|
| 2204 | + return; |
|
| 2205 | + } |
|
| 1985 | 2206 | $skin_vars = $output->data; |
| 1986 | 2207 | |
| 1987 | 2208 | //insert in cache |
| 1988 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2209 | + if($oCacheHandler->isSupport()) { |
|
| 2210 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
| 2211 | + } |
|
| 2212 | + } |
|
| 2213 | + if(!$skin_vars) { |
|
| 2214 | + return; |
|
| 1989 | 2215 | } |
| 1990 | - if(!$skin_vars) return; |
|
| 1991 | 2216 | |
| 1992 | 2217 | foreach($output->data as $val) |
| 1993 | 2218 | { |
| 1994 | - if(isset($module_info->{$val->name})) continue; |
|
| 2219 | + if(isset($module_info->{$val->name})) { |
|
| 2220 | + continue; |
|
| 2221 | + } |
|
| 1995 | 2222 | $module_info->{$val->name} = $val->value; |
| 1996 | 2223 | } |
| 1997 | 2224 | } |
@@ -2013,10 +2240,12 @@ discard block |
||
| 2013 | 2240 | $grant_info = $xml_info->grant; |
| 2014 | 2241 | if($member_info->member_srl) |
| 2015 | 2242 | { |
| 2016 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
| 2017 | - else $group_list = array(); |
|
| 2018 | - } |
|
| 2019 | - else |
|
| 2243 | + if(is_array($member_info->group_list)) { |
|
| 2244 | + $group_list = array_keys($member_info->group_list); |
|
| 2245 | + } else { |
|
| 2246 | + $group_list = array(); |
|
| 2247 | + } |
|
| 2248 | + } else |
|
| 2020 | 2249 | { |
| 2021 | 2250 | $group_list = array(); |
| 2022 | 2251 | } |
@@ -2030,8 +2259,7 @@ discard block |
||
| 2030 | 2259 | } |
| 2031 | 2260 | |
| 2032 | 2261 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
| 2033 | - } |
|
| 2034 | - else |
|
| 2262 | + } else |
|
| 2035 | 2263 | { |
| 2036 | 2264 | // If module_srl exists |
| 2037 | 2265 | // Get a type of granted permission |
@@ -2044,7 +2272,9 @@ discard block |
||
| 2044 | 2272 | $args->module_srl = $module_srl; |
| 2045 | 2273 | $args->member_srl = $member_info->member_srl; |
| 2046 | 2274 | $output = executeQuery('module.getModuleAdmin',$args); |
| 2047 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
| 2275 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
| 2276 | + $grant->manager = true; |
|
| 2277 | + } |
|
| 2048 | 2278 | } |
| 2049 | 2279 | // If not an administrator, get information from the DB and grant manager privilege. |
| 2050 | 2280 | if(!$grant->manager) |
@@ -2054,8 +2284,7 @@ discard block |
||
| 2054 | 2284 | if($module_info->module == 'planet') |
| 2055 | 2285 | { |
| 2056 | 2286 | $output = executeQueryArray('module.getPlanetGrants', $args); |
| 2057 | - } |
|
| 2058 | - else |
|
| 2287 | + } else |
|
| 2059 | 2288 | { |
| 2060 | 2289 | $args = new stdClass; |
| 2061 | 2290 | $args->module_srl = $module_srl; |
@@ -2070,42 +2299,48 @@ discard block |
||
| 2070 | 2299 | foreach($output->data as $val) |
| 2071 | 2300 | { |
| 2072 | 2301 | $grant_exists[$val->name] = true; |
| 2073 | - if($granted[$val->name]) continue; |
|
| 2302 | + if($granted[$val->name]) { |
|
| 2303 | + continue; |
|
| 2304 | + } |
|
| 2074 | 2305 | // Log-in member only |
| 2075 | 2306 | if($val->group_srl == -1) |
| 2076 | 2307 | { |
| 2077 | 2308 | $granted[$val->name] = true; |
| 2078 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
| 2309 | + if($member_info->member_srl) { |
|
| 2310 | + $grant->{$val->name} = true; |
|
| 2311 | + } |
|
| 2079 | 2312 | // Site-joined member only |
| 2080 | - } |
|
| 2081 | - elseif($val->group_srl == -2) |
|
| 2313 | + } elseif($val->group_srl == -2) |
|
| 2082 | 2314 | { |
| 2083 | 2315 | $granted[$val->name] = true; |
| 2084 | 2316 | // Do not grant any permission for non-logged member |
| 2085 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
| 2317 | + if(!$member_info->member_srl) { |
|
| 2318 | + $grant->{$val->name} = false; |
|
| 2319 | + } |
|
| 2086 | 2320 | // Log-in member |
| 2087 | 2321 | else |
| 2088 | 2322 | { |
| 2089 | 2323 | $site_module_info = Context::get('site_module_info'); |
| 2090 | 2324 | // Permission granted if no information of the currently connected site exists |
| 2091 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
| 2325 | + if(!$site_module_info->site_srl) { |
|
| 2326 | + $grant->{$val->name} = true; |
|
| 2327 | + } |
|
| 2092 | 2328 | // Permission is not granted if information of the currently connected site exists |
| 2093 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
| 2329 | + elseif(count($group_list)) { |
|
| 2330 | + $grant->{$val->name} = true; |
|
| 2331 | + } |
|
| 2094 | 2332 | } |
| 2095 | 2333 | // All of non-logged members |
| 2096 | - } |
|
| 2097 | - elseif($val->group_srl == -3) |
|
| 2334 | + } elseif($val->group_srl == -3) |
|
| 2098 | 2335 | { |
| 2099 | 2336 | $granted[$val->name] = true; |
| 2100 | 2337 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
| 2101 | - } |
|
| 2102 | - elseif($val->group_srl == 0) |
|
| 2338 | + } elseif($val->group_srl == 0) |
|
| 2103 | 2339 | { |
| 2104 | 2340 | $granted[$val->name] = true; |
| 2105 | 2341 | $grant->{$val->name} = true; |
| 2106 | 2342 | // If a target is a group |
| 2107 | - } |
|
| 2108 | - else |
|
| 2343 | + } else |
|
| 2109 | 2344 | { |
| 2110 | 2345 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
| 2111 | 2346 | { |
@@ -2116,30 +2351,43 @@ discard block |
||
| 2116 | 2351 | } |
| 2117 | 2352 | } |
| 2118 | 2353 | // Separate processing for the virtual group access |
| 2119 | - if(!$grant_exists['access']) $grant->access = true; |
|
| 2354 | + if(!$grant_exists['access']) { |
|
| 2355 | + $grant->access = true; |
|
| 2356 | + } |
|
| 2120 | 2357 | if(count($grant_info)) |
| 2121 | 2358 | { |
| 2122 | 2359 | foreach($grant_info as $grant_name => $grant_item) |
| 2123 | 2360 | { |
| 2124 | - if($grant_exists[$grant_name]) continue; |
|
| 2361 | + if($grant_exists[$grant_name]) { |
|
| 2362 | + continue; |
|
| 2363 | + } |
|
| 2125 | 2364 | switch($grant_item->default) |
| 2126 | 2365 | { |
| 2127 | 2366 | case 'guest' : |
| 2128 | 2367 | $grant->{$grant_name} = true; |
| 2129 | 2368 | break; |
| 2130 | 2369 | case 'member' : |
| 2131 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
| 2132 | - else $grant->{$grant_name} = false; |
|
| 2370 | + if($member_info->member_srl) { |
|
| 2371 | + $grant->{$grant_name} = true; |
|
| 2372 | + } else { |
|
| 2373 | + $grant->{$grant_name} = false; |
|
| 2374 | + } |
|
| 2133 | 2375 | break; |
| 2134 | 2376 | case 'site' : |
| 2135 | 2377 | $site_module_info = Context::get('site_module_info'); |
| 2136 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
| 2137 | - else $grant->{$grant_name} = false; |
|
| 2378 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
| 2379 | + $grant->{$grant_name} = true; |
|
| 2380 | + } else { |
|
| 2381 | + $grant->{$grant_name} = false; |
|
| 2382 | + } |
|
| 2138 | 2383 | break; |
| 2139 | 2384 | case 'manager' : |
| 2140 | 2385 | case 'root' : |
| 2141 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
| 2142 | - else $grant->{$grant_name} = false; |
|
| 2386 | + if($member_info->is_admin == 'Y') { |
|
| 2387 | + $grant->{$grant_name} = true; |
|
| 2388 | + } else { |
|
| 2389 | + $grant->{$grant_name} = false; |
|
| 2390 | + } |
|
| 2143 | 2391 | break; |
| 2144 | 2392 | } |
| 2145 | 2393 | } |
@@ -2215,16 +2463,22 @@ discard block |
||
| 2215 | 2463 | function getFileBoxListHtml() |
| 2216 | 2464 | { |
| 2217 | 2465 | $logged_info = Context::get('logged_info'); |
| 2218 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 2466 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 2467 | + return new Object(-1, 'msg_not_permitted'); |
|
| 2468 | + } |
|
| 2219 | 2469 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
| 2220 | 2470 | $link_params = explode('&',$link['query']); |
| 2221 | 2471 | foreach ($link_params as $param) |
| 2222 | 2472 | { |
| 2223 | 2473 | $param = explode("=",$param); |
| 2224 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
| 2474 | + if($param[0] == 'selected_widget') { |
|
| 2475 | + $selected_widget = $param[1]; |
|
| 2476 | + } |
|
| 2225 | 2477 | } |
| 2226 | 2478 | $oWidgetModel = getModel('widget'); |
| 2227 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2479 | + if($selected_widget) { |
|
| 2480 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
| 2481 | + } |
|
| 2228 | 2482 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
| 2229 | 2483 | |
| 2230 | 2484 | $oModuleModel = getModel('module'); |
@@ -2232,7 +2486,9 @@ discard block |
||
| 2232 | 2486 | Context::set('filebox_list', $output->data); |
| 2233 | 2487 | |
| 2234 | 2488 | $page = Context::get('page'); |
| 2235 | - if (!$page) $page = 1; |
|
| 2489 | + if (!$page) { |
|
| 2490 | + $page = 1; |
|
| 2491 | + } |
|
| 2236 | 2492 | Context::set('page', $page); |
| 2237 | 2493 | Context::set('page_navigation', $output->page_navigation); |
| 2238 | 2494 | |
@@ -2262,25 +2518,28 @@ discard block |
||
| 2262 | 2518 | $rulsetFile = str_replace('@', '', $ruleset); |
| 2263 | 2519 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2264 | 2520 | return FileHandler::getRealPath($xml_file); |
| 2265 | - } |
|
| 2266 | - else if (strpos($ruleset, '#') !== false) |
|
| 2521 | + } else if (strpos($ruleset, '#') !== false) |
|
| 2267 | 2522 | { |
| 2268 | 2523 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
| 2269 | 2524 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
| 2270 | - if(is_readable($xml_file)) |
|
| 2271 | - return FileHandler::getRealPath($xml_file); |
|
| 2272 | - else{ |
|
| 2525 | + if(is_readable($xml_file)) { |
|
| 2526 | + return FileHandler::getRealPath($xml_file); |
|
| 2527 | + } else{ |
|
| 2273 | 2528 | $ruleset = str_replace('#', '', $ruleset); |
| 2274 | 2529 | } |
| 2275 | 2530 | |
| 2276 | 2531 | } |
| 2277 | 2532 | // Get a path of the requested module. Return if not exists. |
| 2278 | 2533 | $class_path = ModuleHandler::getModulePath($module); |
| 2279 | - if(!$class_path) return; |
|
| 2534 | + if(!$class_path) { |
|
| 2535 | + return; |
|
| 2536 | + } |
|
| 2280 | 2537 | |
| 2281 | 2538 | // Check if module.xml exists in the path. Return if not exist |
| 2282 | 2539 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
| 2283 | - if(!file_exists($xml_file)) return; |
|
| 2540 | + if(!file_exists($xml_file)) { |
|
| 2541 | + return; |
|
| 2542 | + } |
|
| 2284 | 2543 | |
| 2285 | 2544 | return $xml_file; |
| 2286 | 2545 | } |
@@ -2330,7 +2589,9 @@ discard block |
||
| 2330 | 2589 | function getLangByLangcode() |
| 2331 | 2590 | { |
| 2332 | 2591 | $langCode = Context::get('langCode'); |
| 2333 | - if (!$langCode) return; |
|
| 2592 | + if (!$langCode) { |
|
| 2593 | + return; |
|
| 2594 | + } |
|
| 2334 | 2595 | |
| 2335 | 2596 | $oModuleController = getController('module'); |
| 2336 | 2597 | $oModuleController->replaceDefinedLangCode($langCode); |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | $oModuleModel = getModel('module'); |
| 33 | 33 | $oModuleController = getController('module'); |
| 34 | 34 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 35 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 35 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 36 | 36 | { |
| 37 | 37 | // 2009. 02. 11 menu added to the table site_srl |
| 38 | - if(!$oDB->isColumnExists('menu', 'site_srl')) return true; |
|
| 38 | + if (!$oDB->isColumnExists('menu', 'site_srl')) return true; |
|
| 39 | 39 | |
| 40 | 40 | // 2012. 02. 01 title index check |
| 41 | - if(!$oDB->isIndexExists("menu", "idx_title")) return true; |
|
| 41 | + if (!$oDB->isIndexExists("menu", "idx_title")) return true; |
|
| 42 | 42 | |
| 43 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 43 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 44 | 44 | { |
| 45 | 45 | return TRUE; |
| 46 | 46 | } |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | $args = new stdClass(); |
| 50 | 50 | $args->title = array("Temporary menu"); |
| 51 | 51 | $temp_menus = executeQueryArray('menu.getMenuByTitle', $args); |
| 52 | - if($temp_menus->toBool() && count($temp_menus->data)) return true; |
|
| 52 | + if ($temp_menus->toBool() && count($temp_menus->data)) return true; |
|
| 53 | 53 | |
| 54 | 54 | // 2015. 06. 15 add column desc |
| 55 | - if(!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 55 | + if (!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 56 | 56 | { |
| 57 | 57 | return true; |
| 58 | 58 | } |
@@ -72,28 +72,28 @@ discard block |
||
| 72 | 72 | $oModuleModel = getModel('module'); |
| 73 | 73 | $oModuleController = getController('module'); |
| 74 | 74 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 75 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 75 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 76 | 76 | { |
| 77 | 77 | // 2009. 02. 11 menu added to the table site_srl |
| 78 | - if(!$oDB->isColumnExists('menu', 'site_srl')) |
|
| 78 | + if (!$oDB->isColumnExists('menu', 'site_srl')) |
|
| 79 | 79 | { |
| 80 | - $oDB->addColumn('menu','site_srl','number',11,0,true); |
|
| 80 | + $oDB->addColumn('menu', 'site_srl', 'number', 11, 0, true); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // 2012. 02. 01 title index check |
| 84 | - if(!$oDB->isIndexExists("menu","idx_title")) |
|
| 84 | + if (!$oDB->isIndexExists("menu", "idx_title")) |
|
| 85 | 85 | { |
| 86 | 86 | $oDB->addIndex('menu', 'idx_title', array('title')); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // 2015. 06. 15 add column desc |
| 90 | - if(!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 90 | + if (!$oDB->isColumnExists('menu_item', 'desc')) |
|
| 91 | 91 | { |
| 92 | - $oDB->addColumn('menu_item', 'desc','varchar',250,"",true); |
|
| 92 | + $oDB->addColumn('menu_item', 'desc', 'varchar', 250, "", true); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // 1.7(maserati) shortcut column add and mirgration |
| 96 | - if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 96 | + if (!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
|
| 97 | 97 | { |
| 98 | 98 | $oDB->addColumn('menu_item', 'is_shortcut', 'char', 1, 'N'); |
| 99 | 99 | |
@@ -101,27 +101,27 @@ discard block |
||
| 101 | 101 | $oMenuAdminModel = getAdminModel('menu'); |
| 102 | 102 | $output = $oMenuAdminModel->getMenus(); |
| 103 | 103 | |
| 104 | - if(is_array($output)) |
|
| 104 | + if (is_array($output)) |
|
| 105 | 105 | { |
| 106 | 106 | $menuItemUniqueList = array(); |
| 107 | 107 | $menuItemAllList = array(); |
| 108 | - foreach($output AS $key=>$value) |
|
| 108 | + foreach ($output AS $key=>$value) |
|
| 109 | 109 | { |
| 110 | 110 | unset($args); |
| 111 | 111 | $args->menu_srl = $value->menu_srl; |
| 112 | 112 | $output2 = executeQueryArray('menu.getMenuItems', $args); |
| 113 | - if(is_array($output2->data)) |
|
| 113 | + if (is_array($output2->data)) |
|
| 114 | 114 | { |
| 115 | - foreach($output2->data AS $key2=>$value2) |
|
| 115 | + foreach ($output2->data AS $key2=>$value2) |
|
| 116 | 116 | { |
| 117 | 117 | $menuItemAllList[$value2->menu_item_srl] = $value2->url; |
| 118 | - if(!in_array($value2->url, $menuItemUniqueList)) |
|
| 118 | + if (!in_array($value2->url, $menuItemUniqueList)) |
|
| 119 | 119 | { |
| 120 | 120 | $menuItemUniqueList[$value2->menu_item_srl] = $value2->url; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // if url is empty, change type to shortcurt |
| 124 | - if($value2->is_shortcut == 'N' && (!$value2->url || strncasecmp('http', $value2->url, 4) === 0)) |
|
| 124 | + if ($value2->is_shortcut == 'N' && (!$value2->url || strncasecmp('http', $value2->url, 4) === 0)) |
|
| 125 | 125 | { |
| 126 | 126 | $value2->is_shortcut = 'Y'; |
| 127 | 127 | $output3 = executeQuery('menu.updateMenuItem', $value2); |
@@ -133,29 +133,29 @@ discard block |
||
| 133 | 133 | $oModuleModel = getModel('module'); |
| 134 | 134 | // if duplicate reference, change type to shortcut |
| 135 | 135 | $shortcutItemList = array_diff_assoc($menuItemAllList, $menuItemUniqueList); |
| 136 | - foreach($output AS $key=>$value) |
|
| 136 | + foreach ($output AS $key=>$value) |
|
| 137 | 137 | { |
| 138 | 138 | unset($args); |
| 139 | 139 | $args->menu_srl = $value->menu_srl; |
| 140 | 140 | $output2 = executeQueryArray('menu.getMenuItems', $args); |
| 141 | - if(is_array($output2->data)) |
|
| 141 | + if (is_array($output2->data)) |
|
| 142 | 142 | { |
| 143 | - foreach($output2->data AS $key2=>$value2) |
|
| 143 | + foreach ($output2->data AS $key2=>$value2) |
|
| 144 | 144 | { |
| 145 | - if(!empty($value2->url) && strncasecmp('http', $value2->url, 4) !== 0) |
|
| 145 | + if (!empty($value2->url) && strncasecmp('http', $value2->url, 4) !== 0) |
|
| 146 | 146 | { |
| 147 | 147 | $moduleInfo = $oModuleModel->getModuleInfoByMid($value2->url); |
| 148 | - if(!$moduleInfo->module_srl) |
|
| 148 | + if (!$moduleInfo->module_srl) |
|
| 149 | 149 | { |
| 150 | 150 | $value2->url = Context::getDefaultUrl(); |
| 151 | - if(!$value2->url) $value2->url = '#'; |
|
| 151 | + if (!$value2->url) $value2->url = '#'; |
|
| 152 | 152 | $value2->is_shortcut = 'Y'; |
| 153 | 153 | |
| 154 | 154 | $updateOutput = executeQuery('menu.updateMenuItem', $value2); |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if($shortcutItemList[$value2->menu_item_srl]) |
|
| 158 | + if ($shortcutItemList[$value2->menu_item_srl]) |
|
| 159 | 159 | { |
| 160 | 160 | $value2->is_shortcut = 'Y'; |
| 161 | 161 | $output3 = executeQuery('menu.updateMenuItem', $value2); |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | $temp_menus = executeQueryArray('menu.getMenuByTitle', $args); |
| 176 | 176 | |
| 177 | 177 | $args = new stdClass(); |
| 178 | - if($temp_menus->toBool() && count($temp_menus->data)) |
|
| 178 | + if ($temp_menus->toBool() && count($temp_menus->data)) |
|
| 179 | 179 | { |
| 180 | 180 | $oMenuAdminController = getAdminController('menu'); |
| 181 | - foreach($temp_menus->data as $menu) |
|
| 181 | + foreach ($temp_menus->data as $menu) |
|
| 182 | 182 | { |
| 183 | 183 | $args->current_menu_srl = $menu->menu_srl; |
| 184 | 184 | $args->menu_srl = $oMenuAdminController->getUnlinkedMenu(); |
| 185 | 185 | $output3 = executeQuery('menu.updateMenuItems', $args); |
| 186 | 186 | |
| 187 | - if($output3->toBool()) |
|
| 187 | + if ($output3->toBool()) |
|
| 188 | 188 | { |
| 189 | 189 | // delete |
| 190 | 190 | $oMenuAdminController->deleteMenu($menu->menu_srl); |
@@ -219,23 +219,23 @@ discard block |
||
| 219 | 219 | // Wanted list of all the blog module |
| 220 | 220 | $output = executeQueryArray("menu.getMenus"); |
| 221 | 221 | $list = $output->data; |
| 222 | - if(!count($list)) return; |
|
| 222 | + if (!count($list)) return; |
|
| 223 | 223 | // The menu module is used in the re-create all the menu list |
| 224 | - foreach($list as $menu_item) |
|
| 224 | + foreach ($list as $menu_item) |
|
| 225 | 225 | { |
| 226 | 226 | $menu_srl = $menu_item->menu_srl; |
| 227 | 227 | $oMenuAdminController->makeXmlFile($menu_srl); |
| 228 | 228 | |
| 229 | 229 | // for homeSitemap.php regenrate |
| 230 | - if(!$homeMenuSrl) |
|
| 230 | + if (!$homeMenuSrl) |
|
| 231 | 231 | { |
| 232 | 232 | $menuItemList = $oMenuAdminModel->getMenuItems($menu_srl); |
| 233 | 233 | |
| 234 | - if(is_array($menuItemList->data)) |
|
| 234 | + if (is_array($menuItemList->data)) |
|
| 235 | 235 | { |
| 236 | - foreach($menuItemList->data AS $key=>$value) |
|
| 236 | + foreach ($menuItemList->data AS $key=>$value) |
|
| 237 | 237 | { |
| 238 | - if($homeModuleMid == $value->url) |
|
| 238 | + if ($homeModuleMid == $value->url) |
|
| 239 | 239 | { |
| 240 | 240 | $homeMenuSrl = $menu_srl; |
| 241 | 241 | break; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if($homeMenuSrl) |
|
| 248 | + if ($homeMenuSrl) |
|
| 249 | 249 | { |
| 250 | 250 | $oMenuAdminController->makeHomemenuCacheFile($homeMenuSrl); |
| 251 | 251 | } |
@@ -35,10 +35,14 @@ discard block |
||
| 35 | 35 | if($oModuleModel->needUpdate($version_update_id)) |
| 36 | 36 | { |
| 37 | 37 | // 2009. 02. 11 menu added to the table site_srl |
| 38 | - if(!$oDB->isColumnExists('menu', 'site_srl')) return true; |
|
| 38 | + if(!$oDB->isColumnExists('menu', 'site_srl')) { |
|
| 39 | + return true; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | // 2012. 02. 01 title index check |
| 41 | - if(!$oDB->isIndexExists("menu", "idx_title")) return true; |
|
| 43 | + if(!$oDB->isIndexExists("menu", "idx_title")) { |
|
| 44 | + return true; |
|
| 45 | + } |
|
| 42 | 46 | |
| 43 | 47 | if(!$oDB->isColumnExists('menu_item', 'is_shortcut')) |
| 44 | 48 | { |
@@ -49,7 +53,9 @@ discard block |
||
| 49 | 53 | $args = new stdClass(); |
| 50 | 54 | $args->title = array("Temporary menu"); |
| 51 | 55 | $temp_menus = executeQueryArray('menu.getMenuByTitle', $args); |
| 52 | - if($temp_menus->toBool() && count($temp_menus->data)) return true; |
|
| 56 | + if($temp_menus->toBool() && count($temp_menus->data)) { |
|
| 57 | + return true; |
|
| 58 | + } |
|
| 53 | 59 | |
| 54 | 60 | // 2015. 06. 15 add column desc |
| 55 | 61 | if(!$oDB->isColumnExists('menu_item', 'desc')) |
@@ -148,7 +154,9 @@ discard block |
||
| 148 | 154 | if(!$moduleInfo->module_srl) |
| 149 | 155 | { |
| 150 | 156 | $value2->url = Context::getDefaultUrl(); |
| 151 | - if(!$value2->url) $value2->url = '#'; |
|
| 157 | + if(!$value2->url) { |
|
| 158 | + $value2->url = '#'; |
|
| 159 | + } |
|
| 152 | 160 | $value2->is_shortcut = 'Y'; |
| 153 | 161 | |
| 154 | 162 | $updateOutput = executeQuery('menu.updateMenuItem', $value2); |
@@ -219,7 +227,9 @@ discard block |
||
| 219 | 227 | // Wanted list of all the blog module |
| 220 | 228 | $output = executeQueryArray("menu.getMenus"); |
| 221 | 229 | $list = $output->data; |
| 222 | - if(!count($list)) return; |
|
| 230 | + if(!count($list)) { |
|
| 231 | + return; |
|
| 232 | + } |
|
| 223 | 233 | // The menu module is used in the re-create all the menu list |
| 224 | 234 | foreach($list as $menu_item) |
| 225 | 235 | { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | function session() |
| 17 | 17 | { |
| 18 | - if(Context::isInstalled()) $this->session_started= true; |
|
| 18 | + if (Context::isInstalled()) $this->session_started = true; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | function moduleInstall() |
| 25 | 25 | { |
| 26 | 26 | $oDB = &DB::getInstance(); |
| 27 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
| 27 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
| 28 | 28 | |
| 29 | 29 | return new Object(); |
| 30 | 30 | } |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $oModuleModel = getModel('module'); |
| 39 | 39 | $oModuleController = getController('module'); |
| 40 | 40 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 41 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 41 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 42 | 42 | { |
| 43 | - if(!$oDB->isTableExists('session')) return true; |
|
| 44 | - if(!$oDB->isColumnExists("session","cur_mid")) return true; |
|
| 45 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true; |
|
| 43 | + if (!$oDB->isTableExists('session')) return true; |
|
| 44 | + if (!$oDB->isColumnExists("session", "cur_mid")) return true; |
|
| 45 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) return true; |
|
| 46 | 46 | |
| 47 | 47 | $oModuleController->insertUpdatedLog($version_update_id); |
| 48 | 48 | } |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | $oModuleModel = getModel('module'); |
| 60 | 60 | $oModuleController = getController('module'); |
| 61 | 61 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 62 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 62 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 63 | 63 | { |
| 64 | - if(!$oDB->isTableExists('session')) |
|
| 64 | + if (!$oDB->isTableExists('session')) |
|
| 65 | 65 | { |
| 66 | 66 | $oDB->createTableByXmlFile($this->module_path.'schemas/session.xml'); |
| 67 | 67 | } |
| 68 | - if(!$oDB->isColumnExists("session","cur_mid")) |
|
| 68 | + if (!$oDB->isColumnExists("session", "cur_mid")) |
|
| 69 | 69 | { |
| 70 | - $oDB->addColumn('session',"cur_mid","varchar",128); |
|
| 70 | + $oDB->addColumn('session', "cur_mid", "varchar", 128); |
|
| 71 | 71 | } |
| 72 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) |
|
| 72 | + if (!$oDB->isIndexExists("session", "idx_session_update_mid")) |
|
| 73 | 73 | { |
| 74 | - $oDB->addIndex("session","idx_session_update_mid", array("member_srl","last_update","cur_mid")); |
|
| 74 | + $oDB->addIndex("session", "idx_session_update_mid", array("member_srl", "last_update", "cur_mid")); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $oModuleController->insertUpdatedLog($version_update_id); |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function unSerializeSession($val) |
| 87 | 87 | { |
| 88 | - $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
| 89 | - for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 88 | + $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
|
| 89 | + for ($i = 0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 90 | 90 | return $result; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | function serializeSession($data) |
| 97 | 97 | { |
| 98 | - if(!count($data)) return; |
|
| 98 | + if (!count($data)) return; |
|
| 99 | 99 | |
| 100 | 100 | $str = ''; |
| 101 | - foreach($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
| 102 | - return substr($str, 0, strlen($str)-1).'}'; |
|
| 101 | + foreach ($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
| 102 | + return substr($str, 0, strlen($str) - 1).'}'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | function session() |
| 17 | 17 | { |
| 18 | - if(Context::isInstalled()) $this->session_started= true; |
|
| 18 | + if(Context::isInstalled()) { |
|
| 19 | + $this->session_started= true; |
|
| 20 | + } |
|
| 19 | 21 | } |
| 20 | 22 | |
| 21 | 23 | /** |
@@ -40,9 +42,15 @@ discard block |
||
| 40 | 42 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 41 | 43 | if($oModuleModel->needUpdate($version_update_id)) |
| 42 | 44 | { |
| 43 | - if(!$oDB->isTableExists('session')) return true; |
|
| 44 | - if(!$oDB->isColumnExists("session","cur_mid")) return true; |
|
| 45 | - if(!$oDB->isIndexExists("session","idx_session_update_mid")) return true; |
|
| 45 | + if(!$oDB->isTableExists('session')) { |
|
| 46 | + return true; |
|
| 47 | + } |
|
| 48 | + if(!$oDB->isColumnExists("session","cur_mid")) { |
|
| 49 | + return true; |
|
| 50 | + } |
|
| 51 | + if(!$oDB->isIndexExists("session","idx_session_update_mid")) { |
|
| 52 | + return true; |
|
| 53 | + } |
|
| 46 | 54 | |
| 47 | 55 | $oModuleController->insertUpdatedLog($version_update_id); |
| 48 | 56 | } |
@@ -86,7 +94,9 @@ discard block |
||
| 86 | 94 | function unSerializeSession($val) |
| 87 | 95 | { |
| 88 | 96 | $vars = preg_split('/([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff^|]*)\|/', $val,-1,PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); |
| 89 | - for($i=0; $vars[$i]; $i++) $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 97 | + for($i=0; $vars[$i]; $i++) { |
|
| 98 | + $result[$vars[$i++]] = unserialize($vars[$i]); |
|
| 99 | + } |
|
| 90 | 100 | return $result; |
| 91 | 101 | } |
| 92 | 102 | |
@@ -95,10 +105,14 @@ discard block |
||
| 95 | 105 | */ |
| 96 | 106 | function serializeSession($data) |
| 97 | 107 | { |
| 98 | - if(!count($data)) return; |
|
| 108 | + if(!count($data)) { |
|
| 109 | + return; |
|
| 110 | + } |
|
| 99 | 111 | |
| 100 | 112 | $str = ''; |
| 101 | - foreach($data as $key => $val) $str .= $key.'|'.serialize($val); |
|
| 113 | + foreach($data as $key => $val) { |
|
| 114 | + $str .= $key.'|'.serialize($val); |
|
| 115 | + } |
|
| 102 | 116 | return substr($str, 0, strlen($str)-1).'}'; |
| 103 | 117 | } |
| 104 | 118 | |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | $oModuleModel = getModel('module'); |
| 38 | 38 | $oModuleController = getController('module'); |
| 39 | 39 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 40 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 40 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 41 | 41 | { |
| 42 | - if(!$oDB->isColumnExists("admin_favorite", "type")) |
|
| 42 | + if (!$oDB->isColumnExists("admin_favorite", "type")) |
|
| 43 | 43 | { |
| 44 | 44 | return TRUE; |
| 45 | 45 | } |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | $oModuleModel = getModel('module'); |
| 61 | 61 | $oModuleController = getController('module'); |
| 62 | 62 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 63 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 63 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 64 | 64 | { |
| 65 | - if(!$oDB->isColumnExists("admin_favorite", "type")) |
|
| 65 | + if (!$oDB->isColumnExists("admin_favorite", "type")) |
|
| 66 | 66 | { |
| 67 | 67 | $oAdminAdminModel = getAdminModel('admin'); |
| 68 | 68 | $output = $oAdminAdminModel->getFavoriteList(); |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | $oDB->dropColumn('admin_favorite', 'admin_favorite_srl'); |
| 72 | 72 | $oDB->addColumn('admin_favorite', "admin_favorite_srl", "number", 11, 0); |
| 73 | 73 | $oDB->addColumn('admin_favorite', "type", "varchar", 30, 'module'); |
| 74 | - if(is_array($favoriteList)) |
|
| 74 | + if (is_array($favoriteList)) |
|
| 75 | 75 | { |
| 76 | 76 | $oAdminAdminController = getAdminController('admin'); |
| 77 | 77 | $oAdminAdminController->_deleteAllFavorite(); |
| 78 | - foreach($favoriteList AS $key => $value) |
|
| 78 | + foreach ($favoriteList AS $key => $value) |
|
| 79 | 79 | { |
| 80 | 80 | $oAdminAdminController->_insertFavorite($value->site_srl, $value->module); |
| 81 | 81 | } |
@@ -99,19 +99,19 @@ discard block |
||
| 99 | 99 | public function checkAdminMenu() |
| 100 | 100 | { |
| 101 | 101 | // for admin menu |
| 102 | - if(Context::isInstalled()) |
|
| 102 | + if (Context::isInstalled()) |
|
| 103 | 103 | { |
| 104 | 104 | $oMenuAdminModel = getAdminModel('menu'); |
| 105 | 105 | $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName); |
| 106 | 106 | |
| 107 | - if(!$output->menu_srl) |
|
| 107 | + if (!$output->menu_srl) |
|
| 108 | 108 | { |
| 109 | 109 | $this->createXeAdminMenu(); |
| 110 | 110 | $output = $oMenuAdminModel->getMenuByTitle($this->adminMenuName); |
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - if(!is_readable(FileHandler::getRealPath($output->php_file))) |
|
| 114 | + if (!is_readable(FileHandler::getRealPath($output->php_file))) |
|
| 115 | 115 | { |
| 116 | 116 | $oMenuAdminController = getAdminController('menu'); |
| 117 | 117 | $oMenuAdminController->makeXmlFile($output->menu_srl); |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | // gnb item create |
| 148 | 148 | $gnbList = array('dashboard', 'menu', 'user', 'content', 'configuration', 'advanced'); |
| 149 | - foreach($gnbList AS $key => $value) |
|
| 149 | + foreach ($gnbList AS $key => $value) |
|
| 150 | 150 | { |
| 151 | 151 | //insert menu item |
| 152 | 152 | $args = new stdClass(); |
| 153 | 153 | $args->menu_srl = $menuSrl; |
| 154 | 154 | $args->menu_item_srl = getNextSequence(); |
| 155 | - $args->name = '{$lang->menu_gnb[\'' . $value . '\']}'; |
|
| 156 | - if($value == 'dashboard') |
|
| 155 | + $args->name = '{$lang->menu_gnb[\''.$value.'\']}'; |
|
| 156 | + if ($value == 'dashboard') |
|
| 157 | 157 | { |
| 158 | 158 | $args->url = 'index.php?module=admin'; |
| 159 | 159 | } |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | $oMenuAdminModel = getAdminModel('menu'); |
| 169 | 169 | $columnList = array('menu_item_srl', 'name'); |
| 170 | 170 | $output = $oMenuAdminModel->getMenuItems($menuSrl, 0, $columnList); |
| 171 | - if(is_array($output->data)) |
|
| 171 | + if (is_array($output->data)) |
|
| 172 | 172 | { |
| 173 | - foreach($output->data AS $key => $value) |
|
| 173 | + foreach ($output->data AS $key => $value) |
|
| 174 | 174 | { |
| 175 | 175 | preg_match('/\{\$lang->menu_gnb\[(.*?)\]\}/i', $value->name, $m); |
| 176 | 176 | $gnbDBList[$m[1]] = $value->menu_item_srl; |
@@ -281,20 +281,20 @@ discard block |
||
| 281 | 281 | $args->group_srls = $adminGroupSrl; |
| 282 | 282 | $oModuleModel = getModel('module'); |
| 283 | 283 | |
| 284 | - foreach($gnbModuleList AS $key => $value) |
|
| 284 | + foreach ($gnbModuleList AS $key => $value) |
|
| 285 | 285 | { |
| 286 | - if(is_array($value['subMenu'])) |
|
| 286 | + if (is_array($value['subMenu'])) |
|
| 287 | 287 | { |
| 288 | 288 | $moduleActionInfo = $oModuleModel->getModuleActionXml($value['module']); |
| 289 | - foreach($value['subMenu'] AS $key2 => $value2) |
|
| 289 | + foreach ($value['subMenu'] AS $key2 => $value2) |
|
| 290 | 290 | { |
| 291 | - $gnbKey = "'" . $this->_getGnbKey($value2) . "'"; |
|
| 291 | + $gnbKey = "'".$this->_getGnbKey($value2)."'"; |
|
| 292 | 292 | |
| 293 | 293 | //insert menu item |
| 294 | 294 | $args->menu_item_srl = getNextSequence(); |
| 295 | 295 | $args->parent_srl = $gnbDBList[$gnbKey]; |
| 296 | - $args->name = '{$lang->menu_gnb_sub[\'' . $value2 . '\']}'; |
|
| 297 | - $args->url = 'index.php?module=admin&act=' . $moduleActionInfo->menu->{$value2}->index; |
|
| 296 | + $args->name = '{$lang->menu_gnb_sub[\''.$value2.'\']}'; |
|
| 297 | + $args->url = 'index.php?module=admin&act='.$moduleActionInfo->menu->{$value2}->index; |
|
| 298 | 298 | $args->listorder = -1 * $args->menu_item_srl; |
| 299 | 299 | $output = executeQuery('menu.insertMenuItem', $args); |
| 300 | 300 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function _getGnbKey($menuName) |
| 317 | 317 | { |
| 318 | - switch($menuName) |
|
| 318 | + switch ($menuName) |
|
| 319 | 319 | { |
| 320 | 320 | case 'siteMap': |
| 321 | 321 | case 'siteDesign': |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | function _getOldGnbKey($menuName) |
| 366 | 366 | { |
| 367 | - switch($menuName) |
|
| 367 | + switch ($menuName) |
|
| 368 | 368 | { |
| 369 | 369 | case 'siteMap': |
| 370 | 370 | return 'menu'; |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 414 | $newAdminmenuSrl = $output->menu_srl; |
| 415 | 415 | $output = $oMenuAdminModel->getMenuItems($newAdminmenuSrl, 0); |
| 416 | 416 | $newAdminParentMenuList = array(); |
| 417 | - if(is_array($output->data)) |
|
| 417 | + if (is_array($output->data)) |
|
| 418 | 418 | { |
| 419 | - foreach($output->data AS $key => $value) |
|
| 419 | + foreach ($output->data AS $key => $value) |
|
| 420 | 420 | { |
| 421 | 421 | $tmp = explode('\'', $value->name); |
| 422 | 422 | $newAdminParentMenuList[$tmp[1]] = $value; |
@@ -429,15 +429,15 @@ discard block |
||
| 429 | 429 | $menuSrl = $output->menu_srl; |
| 430 | 430 | |
| 431 | 431 | $oMenuAdminController = getAdminController('menu'); |
| 432 | - if($menuSrl) |
|
| 432 | + if ($menuSrl) |
|
| 433 | 433 | { |
| 434 | 434 | $output = $oMenuAdminModel->getMenuItems($menuSrl); |
| 435 | - if(is_array($output->data)) |
|
| 435 | + if (is_array($output->data)) |
|
| 436 | 436 | { |
| 437 | 437 | $parentMenu = array(); |
| 438 | - foreach($output->data AS $key => $menuItem) |
|
| 438 | + foreach ($output->data AS $key => $menuItem) |
|
| 439 | 439 | { |
| 440 | - if($menuItem->parent_srl == 0) |
|
| 440 | + if ($menuItem->parent_srl == 0) |
|
| 441 | 441 | { |
| 442 | 442 | $tmp = explode('\'', $menuItem->name); |
| 443 | 443 | $parentMenuKey = $tmp[1]; |
@@ -446,15 +446,15 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | |
| 448 | 448 | $isUserAddedMenuMoved = FALSE; |
| 449 | - foreach($output->data AS $key => $menuItem) |
|
| 449 | + foreach ($output->data AS $key => $menuItem) |
|
| 450 | 450 | { |
| 451 | - if($menuItem->parent_srl != 0) |
|
| 451 | + if ($menuItem->parent_srl != 0) |
|
| 452 | 452 | { |
| 453 | 453 | $tmp = explode('\'', $menuItem->name); |
| 454 | 454 | $menuKey = $tmp[1]; |
| 455 | 455 | |
| 456 | 456 | $result = $this->_getOldGnbKey($menuKey); |
| 457 | - if($result == 'user_added_menu') |
|
| 457 | + if ($result == 'user_added_menu') |
|
| 458 | 458 | { |
| 459 | 459 | // theme menu use not anymore |
| 460 | 460 | /* if($parentMenu[$menuItem->parent_srl] == 'theme') |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $newParentItem = $newAdminParentMenuList['menu']; |
| 463 | 463 | } |
| 464 | 464 | else */ |
| 465 | - if($parentMenu[$menuItem->parent_srl] == 'extensions') |
|
| 465 | + if ($parentMenu[$menuItem->parent_srl] == 'extensions') |
|
| 466 | 466 | { |
| 467 | 467 | $newParentItem = $newAdminParentMenuList['advanced']; |
| 468 | 468 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - if($isUserAddedMenuMoved) |
|
| 482 | + if ($isUserAddedMenuMoved) |
|
| 483 | 483 | { |
| 484 | 484 | $oMenuAdminController->makeXmlFile($newAdminmenuSrl); |
| 485 | 485 | } |
@@ -488,9 +488,9 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | // all old admin menu delete |
| 490 | 490 | $output = $oMenuAdminModel->getMenuListByTitle('__XE_ADMIN__'); |
| 491 | - if(is_array($output)) |
|
| 491 | + if (is_array($output)) |
|
| 492 | 492 | { |
| 493 | - foreach($output AS $key=>$value) |
|
| 493 | + foreach ($output AS $key=>$value) |
|
| 494 | 494 | { |
| 495 | 495 | $oMenuAdminController->deleteMenu($value->menu_srl); |
| 496 | 496 | } |
@@ -57,32 +57,32 @@ discard block |
||
| 57 | 57 | $oModuleModel = getModel('module'); |
| 58 | 58 | $oModuleController = getController('module'); |
| 59 | 59 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 60 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 60 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 61 | 61 | { |
| 62 | 62 | // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments |
| 63 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; |
|
| 64 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; |
|
| 65 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; |
|
| 66 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; |
|
| 67 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; |
|
| 68 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; |
|
| 69 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; |
|
| 70 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; |
|
| 71 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; |
|
| 72 | - if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true; |
|
| 63 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; |
|
| 64 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; |
|
| 65 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; |
|
| 66 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; |
|
| 67 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; |
|
| 68 | + if (!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; |
|
| 69 | + if (!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; |
|
| 70 | + if (!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; |
|
| 71 | + if (!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; |
|
| 72 | + if (!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true; |
|
| 73 | 73 | // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted |
| 74 | - if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; |
|
| 74 | + if (!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; |
|
| 75 | 75 | // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted |
| 76 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true; |
|
| 76 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true; |
|
| 77 | 77 | // 2007. 10. 19 Call a trigger to set up the file permissions before displaying |
| 78 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true; |
|
| 78 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true; |
|
| 79 | 79 | // A column to determine a target type |
| 80 | - if(!$oDB->isColumnExists('files', 'upload_target_type')) return true; |
|
| 80 | + if (!$oDB->isColumnExists('files', 'upload_target_type')) return true; |
|
| 81 | 81 | |
| 82 | 82 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 83 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 83 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 84 | 84 | |
| 85 | - if(!$oDB->isColumnExists('files', 'cover_image')) return true; |
|
| 85 | + if (!$oDB->isColumnExists('files', 'cover_image')) return true; |
|
| 86 | 86 | |
| 87 | 87 | $oModuleController->insertUpdatedLog($version_update_id); |
| 88 | 88 | } |
@@ -101,57 +101,57 @@ discard block |
||
| 101 | 101 | $oModuleModel = getModel('module'); |
| 102 | 102 | $oModuleController = getController('module'); |
| 103 | 103 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 104 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 104 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 105 | 105 | { |
| 106 | 106 | // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments |
| 107 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) |
|
| 107 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) |
|
| 108 | 108 | $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); |
| 109 | 109 | |
| 110 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) |
|
| 110 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) |
|
| 111 | 111 | $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); |
| 112 | 112 | |
| 113 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) |
|
| 113 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) |
|
| 114 | 114 | $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); |
| 115 | 115 | |
| 116 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) |
|
| 116 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) |
|
| 117 | 117 | $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); |
| 118 | 118 | |
| 119 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) |
|
| 119 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) |
|
| 120 | 120 | $oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'); |
| 121 | 121 | |
| 122 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) |
|
| 122 | + if (!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) |
|
| 123 | 123 | $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); |
| 124 | 124 | |
| 125 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) |
|
| 125 | + if (!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) |
|
| 126 | 126 | $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); |
| 127 | 127 | |
| 128 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) |
|
| 128 | + if (!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) |
|
| 129 | 129 | $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); |
| 130 | 130 | |
| 131 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) |
|
| 131 | + if (!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) |
|
| 132 | 132 | $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); |
| 133 | 133 | |
| 134 | - if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) |
|
| 134 | + if (!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) |
|
| 135 | 135 | $oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); |
| 136 | 136 | // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted |
| 137 | - if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) |
|
| 137 | + if (!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) |
|
| 138 | 138 | $oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'); |
| 139 | 139 | // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted |
| 140 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) |
|
| 140 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) |
|
| 141 | 141 | $oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'); |
| 142 | 142 | // 2007. 10. 19 Call a trigger to set up the file permissions before displaying |
| 143 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) |
|
| 143 | + if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) |
|
| 144 | 144 | $oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'); |
| 145 | 145 | // A column to determine a target type |
| 146 | - if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3'); |
|
| 146 | + if (!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3'); |
|
| 147 | 147 | |
| 148 | 148 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 149 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) |
|
| 149 | + if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) |
|
| 150 | 150 | { |
| 151 | 151 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if(!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N'); |
|
| 154 | + if (!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N'); |
|
| 155 | 155 | |
| 156 | 156 | $oModuleController->insertUpdatedLog($version_update_id); |
| 157 | 157 | } |
@@ -60,29 +60,61 @@ discard block |
||
| 60 | 60 | if($oModuleModel->needUpdate($version_update_id)) |
| 61 | 61 | { |
| 62 | 62 | // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments |
| 63 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; |
|
| 64 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; |
|
| 65 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; |
|
| 66 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; |
|
| 67 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; |
|
| 68 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; |
|
| 69 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; |
|
| 70 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; |
|
| 71 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; |
|
| 72 | - if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true; |
|
| 63 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) { |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 66 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) { |
|
| 67 | + return true; |
|
| 68 | + } |
|
| 69 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) { |
|
| 70 | + return true; |
|
| 71 | + } |
|
| 72 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) { |
|
| 73 | + return true; |
|
| 74 | + } |
|
| 75 | + if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) { |
|
| 76 | + return true; |
|
| 77 | + } |
|
| 78 | + if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) { |
|
| 79 | + return true; |
|
| 80 | + } |
|
| 81 | + if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) { |
|
| 82 | + return true; |
|
| 83 | + } |
|
| 84 | + if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) { |
|
| 85 | + return true; |
|
| 86 | + } |
|
| 87 | + if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) { |
|
| 88 | + return true; |
|
| 89 | + } |
|
| 90 | + if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) { |
|
| 91 | + return true; |
|
| 92 | + } |
|
| 73 | 93 | // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted |
| 74 | - if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; |
|
| 94 | + if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) { |
|
| 95 | + return true; |
|
| 96 | + } |
|
| 75 | 97 | // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted |
| 76 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true; |
|
| 98 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) { |
|
| 99 | + return true; |
|
| 100 | + } |
|
| 77 | 101 | // 2007. 10. 19 Call a trigger to set up the file permissions before displaying |
| 78 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true; |
|
| 102 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) { |
|
| 103 | + return true; |
|
| 104 | + } |
|
| 79 | 105 | // A column to determine a target type |
| 80 | - if(!$oDB->isColumnExists('files', 'upload_target_type')) return true; |
|
| 106 | + if(!$oDB->isColumnExists('files', 'upload_target_type')) { |
|
| 107 | + return true; |
|
| 108 | + } |
|
| 81 | 109 | |
| 82 | 110 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 83 | - if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) return true; |
|
| 111 | + if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) { |
|
| 112 | + return true; |
|
| 113 | + } |
|
| 84 | 114 | |
| 85 | - if(!$oDB->isColumnExists('files', 'cover_image')) return true; |
|
| 115 | + if(!$oDB->isColumnExists('files', 'cover_image')) { |
|
| 116 | + return true; |
|
| 117 | + } |
|
| 86 | 118 | |
| 87 | 119 | $oModuleController->insertUpdatedLog($version_update_id); |
| 88 | 120 | } |
@@ -104,46 +136,61 @@ discard block |
||
| 104 | 136 | if($oModuleModel->needUpdate($version_update_id)) |
| 105 | 137 | { |
| 106 | 138 | // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments |
| 107 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) |
|
| 108 | - $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); |
|
| 139 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) { |
|
| 140 | + $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); |
|
| 141 | + } |
|
| 109 | 142 | |
| 110 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) |
|
| 111 | - $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); |
|
| 143 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) { |
|
| 144 | + $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); |
|
| 145 | + } |
|
| 112 | 146 | |
| 113 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) |
|
| 114 | - $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); |
|
| 147 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) { |
|
| 148 | + $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); |
|
| 149 | + } |
|
| 115 | 150 | |
| 116 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) |
|
| 117 | - $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); |
|
| 151 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) { |
|
| 152 | + $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); |
|
| 153 | + } |
|
| 118 | 154 | |
| 119 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) |
|
| 120 | - $oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'); |
|
| 155 | + if(!$oModuleModel->getTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after')) { |
|
| 156 | + $oModuleController->insertTrigger('document.deleteDocument', 'file', 'controller', 'triggerDeleteAttached', 'after'); |
|
| 157 | + } |
|
| 121 | 158 | |
| 122 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) |
|
| 123 | - $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); |
|
| 159 | + if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) { |
|
| 160 | + $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); |
|
| 161 | + } |
|
| 124 | 162 | |
| 125 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) |
|
| 126 | - $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); |
|
| 163 | + if(!$oModuleModel->getTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) { |
|
| 164 | + $oModuleController->insertTrigger('comment.insertComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); |
|
| 165 | + } |
|
| 127 | 166 | |
| 128 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) |
|
| 129 | - $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); |
|
| 167 | + if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) { |
|
| 168 | + $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); |
|
| 169 | + } |
|
| 130 | 170 | |
| 131 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) |
|
| 132 | - $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); |
|
| 171 | + if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) { |
|
| 172 | + $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); |
|
| 173 | + } |
|
| 133 | 174 | |
| 134 | - if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) |
|
| 135 | - $oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); |
|
| 175 | + if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) { |
|
| 176 | + $oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); |
|
| 177 | + } |
|
| 136 | 178 | // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted |
| 137 | - if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) |
|
| 138 | - $oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'); |
|
| 179 | + if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) { |
|
| 180 | + $oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'); |
|
| 181 | + } |
|
| 139 | 182 | // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted |
| 140 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) |
|
| 141 | - $oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'); |
|
| 183 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) { |
|
| 184 | + $oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'); |
|
| 185 | + } |
|
| 142 | 186 | // 2007. 10. 19 Call a trigger to set up the file permissions before displaying |
| 143 | - if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) |
|
| 144 | - $oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'); |
|
| 187 | + if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) { |
|
| 188 | + $oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'); |
|
| 189 | + } |
|
| 145 | 190 | // A column to determine a target type |
| 146 | - if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3'); |
|
| 191 | + if(!$oDB->isColumnExists('files', 'upload_target_type')) { |
|
| 192 | + $oDB->addColumn('files', 'upload_target_type', 'char', '3'); |
|
| 193 | + } |
|
| 147 | 194 | |
| 148 | 195 | // 2012. 08. 29 Add a trigger to copy additional setting when the module is copied |
| 149 | 196 | if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after')) |
@@ -151,7 +198,9 @@ discard block |
||
| 151 | 198 | $oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'file', 'controller', 'triggerCopyModule', 'after'); |
| 152 | 199 | } |
| 153 | 200 | |
| 154 | - if(!$oDB->isColumnExists('files', 'cover_image')) $oDB->addColumn('files', 'cover_image', 'char', '1', 'N'); |
|
| 201 | + if(!$oDB->isColumnExists('files', 'cover_image')) { |
|
| 202 | + $oDB->addColumn('files', 'cover_image', 'char', '1', 'N'); |
|
| 203 | + } |
|
| 155 | 204 | |
| 156 | 205 | $oModuleController->insertUpdatedLog($version_update_id); |
| 157 | 206 | } |
@@ -36,25 +36,25 @@ discard block |
||
| 36 | 36 | $oModuleModel = getModel('module'); |
| 37 | 37 | $oModuleController = getController('module'); |
| 38 | 38 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 39 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 39 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 40 | 40 | { |
| 41 | 41 | // 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered |
| 42 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true; |
|
| 43 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true; |
|
| 44 | - if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true; |
|
| 42 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true; |
|
| 43 | + if (!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true; |
|
| 44 | + if (!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true; |
|
| 45 | 45 | // 2008-12-17 Add a spamfilter for post modification actions |
| 46 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true; |
|
| 47 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true; |
|
| 46 | + if (!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true; |
|
| 47 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true; |
|
| 48 | 48 | // 2013-11-14 The trigger which try to perform spam filtering when new message are registered |
| 49 | - if(!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) return true; |
|
| 49 | + if (!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) return true; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Add the hit count field (hit) |
| 53 | 53 | */ |
| 54 | - if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true; |
|
| 55 | - if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true; |
|
| 54 | + if (!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true; |
|
| 55 | + if (!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true; |
|
| 56 | 56 | |
| 57 | - if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true; |
|
| 57 | + if (!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true; |
|
| 58 | 58 | |
| 59 | 59 | $oModuleController->insertUpdatedLog($version_update_id); |
| 60 | 60 | } |
@@ -71,27 +71,27 @@ discard block |
||
| 71 | 71 | $oModuleModel = getModel('module'); |
| 72 | 72 | $oModuleController = getController('module'); |
| 73 | 73 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 74 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 74 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 75 | 75 | { |
| 76 | 76 | // 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered |
| 77 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) |
|
| 77 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) |
|
| 78 | 78 | $oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'); |
| 79 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) |
|
| 79 | + if (!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) |
|
| 80 | 80 | $oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'); |
| 81 | - if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) |
|
| 81 | + if (!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) |
|
| 82 | 82 | $oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'); |
| 83 | 83 | // 2008-12-17 Add a spamfilter for post modification actions |
| 84 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) |
|
| 84 | + if (!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) |
|
| 85 | 85 | { |
| 86 | 86 | $oModuleController->insertTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'); |
| 87 | 87 | } |
| 88 | 88 | // 2008-12-17 Add a spamfilter for post modification actions |
| 89 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) |
|
| 89 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) |
|
| 90 | 90 | { |
| 91 | 91 | $oModuleController->insertTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'); |
| 92 | 92 | } |
| 93 | 93 | // 2013-11-14 The trigger which try to perform spam filtering when new message are registered |
| 94 | - if(!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) |
|
| 94 | + if (!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) |
|
| 95 | 95 | { |
| 96 | 96 | $oModuleController->insertTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before'); |
| 97 | 97 | } |
@@ -99,26 +99,26 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * Add the hit count field (hit) |
| 101 | 101 | */ |
| 102 | - if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) |
|
| 102 | + if (!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) |
|
| 103 | 103 | { |
| 104 | - $oDB->addColumn('spamfilter_denied_word','hit','number',12,0,true); |
|
| 105 | - $oDB->addIndex('spamfilter_denied_word','idx_hit', 'hit'); |
|
| 104 | + $oDB->addColumn('spamfilter_denied_word', 'hit', 'number', 12, 0, true); |
|
| 105 | + $oDB->addIndex('spamfilter_denied_word', 'idx_hit', 'hit'); |
|
| 106 | 106 | } |
| 107 | - if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) |
|
| 107 | + if (!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) |
|
| 108 | 108 | { |
| 109 | - $oDB->addColumn('spamfilter_denied_word','latest_hit','date'); |
|
| 110 | - $oDB->addIndex('spamfilter_denied_word','idx_latest_hit', 'latest_hit'); |
|
| 109 | + $oDB->addColumn('spamfilter_denied_word', 'latest_hit', 'date'); |
|
| 110 | + $oDB->addIndex('spamfilter_denied_word', 'idx_latest_hit', 'latest_hit'); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) |
|
| 113 | + if (!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) |
|
| 114 | 114 | { |
| 115 | - $oDB->addColumn('spamfilter_denied_ip','description','varchar', 250); |
|
| 115 | + $oDB->addColumn('spamfilter_denied_ip', 'description', 'varchar', 250); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $oModuleController->insertUpdatedLog($version_update_id); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - return new Object(0,'success_updated'); |
|
| 121 | + return new Object(0, 'success_updated'); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -39,22 +39,40 @@ discard block |
||
| 39 | 39 | if($oModuleModel->needUpdate($version_update_id)) |
| 40 | 40 | { |
| 41 | 41 | // 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered |
| 42 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true; |
|
| 43 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true; |
|
| 44 | - if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) return true; |
|
| 42 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) { |
|
| 43 | + return true; |
|
| 44 | + } |
|
| 45 | + if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) { |
|
| 46 | + return true; |
|
| 47 | + } |
|
| 48 | + if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) { |
|
| 49 | + return true; |
|
| 50 | + } |
|
| 45 | 51 | // 2008-12-17 Add a spamfilter for post modification actions |
| 46 | - if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) return true; |
|
| 47 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) return true; |
|
| 52 | + if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) { |
|
| 53 | + return true; |
|
| 54 | + } |
|
| 55 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) { |
|
| 56 | + return true; |
|
| 57 | + } |
|
| 48 | 58 | // 2013-11-14 The trigger which try to perform spam filtering when new message are registered |
| 49 | - if(!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) return true; |
|
| 59 | + if(!$oModuleModel->getTrigger('communication.sendMessage', 'spamfilter', 'controller', 'triggerSendMessage', 'before')) { |
|
| 60 | + return true; |
|
| 61 | + } |
|
| 50 | 62 | |
| 51 | 63 | /** |
| 52 | 64 | * Add the hit count field (hit) |
| 53 | 65 | */ |
| 54 | - if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) return true; |
|
| 55 | - if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) return true; |
|
| 66 | + if(!$oDB->isColumnExists('spamfilter_denied_word', 'hit')) { |
|
| 67 | + return true; |
|
| 68 | + } |
|
| 69 | + if(!$oDB->isColumnExists('spamfilter_denied_word', 'latest_hit')) { |
|
| 70 | + return true; |
|
| 71 | + } |
|
| 56 | 72 | |
| 57 | - if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) return true; |
|
| 73 | + if(!$oDB->isColumnExists('spamfilter_denied_ip', 'description')) { |
|
| 74 | + return true; |
|
| 75 | + } |
|
| 58 | 76 | |
| 59 | 77 | $oModuleController->insertUpdatedLog($version_update_id); |
| 60 | 78 | } |
@@ -74,12 +92,15 @@ discard block |
||
| 74 | 92 | if($oModuleModel->needUpdate($version_update_id)) |
| 75 | 93 | { |
| 76 | 94 | // 2007.12.7 The triggers which try to perform spam filtering when new posts/comments/trackbacks are registered |
| 77 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) |
|
| 78 | - $oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'); |
|
| 79 | - if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) |
|
| 80 | - $oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'); |
|
| 81 | - if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) |
|
| 82 | - $oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'); |
|
| 95 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before')) { |
|
| 96 | + $oModuleController->insertTrigger('document.insertDocument', 'spamfilter', 'controller', 'triggerInsertDocument', 'before'); |
|
| 97 | + } |
|
| 98 | + if(!$oModuleModel->getTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) { |
|
| 99 | + $oModuleController->insertTrigger('comment.insertComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before'); |
|
| 100 | + } |
|
| 101 | + if(!$oModuleModel->getTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before')) { |
|
| 102 | + $oModuleController->insertTrigger('trackback.insertTrackback', 'spamfilter', 'controller', 'triggerInsertTrackback', 'before'); |
|
| 103 | + } |
|
| 83 | 104 | // 2008-12-17 Add a spamfilter for post modification actions |
| 84 | 105 | if(!$oModuleModel->getTrigger('comment.updateComment', 'spamfilter', 'controller', 'triggerInsertComment', 'before')) |
| 85 | 106 | { |
@@ -42,17 +42,17 @@ discard block |
||
| 42 | 42 | $oModuleController = getController('module'); |
| 43 | 43 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 44 | 44 | { |
| 45 | - if(!$oDB->isColumnExists("addons", "is_used_m")) |
|
| 45 | + if (!$oDB->isColumnExists("addons", "is_used_m")) |
|
| 46 | 46 | { |
| 47 | 47 | return TRUE; |
| 48 | 48 | } |
| 49 | - if(!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
| 49 | + if (!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
| 50 | 50 | { |
| 51 | 51 | return TRUE; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | // 2011. 7. 29. add is_fixed column |
| 55 | - if(!$oDB->isColumnExists('addons', 'is_fixed')) |
|
| 55 | + if (!$oDB->isColumnExists('addons', 'is_fixed')) |
|
| 56 | 56 | { |
| 57 | 57 | return TRUE; |
| 58 | 58 | } |
@@ -75,27 +75,27 @@ discard block |
||
| 75 | 75 | $oModuleModel = getModel('module'); |
| 76 | 76 | $oModuleController = getController('module'); |
| 77 | 77 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 78 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 78 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 79 | 79 | { |
| 80 | - if(!$oDB->isColumnExists("addons", "is_used_m")) |
|
| 80 | + if (!$oDB->isColumnExists("addons", "is_used_m")) |
|
| 81 | 81 | { |
| 82 | 82 | $oDB->addColumn("addons", "is_used_m", "char", 1, "N", TRUE); |
| 83 | 83 | } |
| 84 | - if(!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
| 84 | + if (!$oDB->isColumnExists("addons_site", "is_used_m")) |
|
| 85 | 85 | { |
| 86 | 86 | $oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", TRUE); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | // 2011. 7. 29. add is_fixed column |
| 90 | - if(!$oDB->isColumnExists('addons', 'is_fixed')) |
|
| 90 | + if (!$oDB->isColumnExists('addons', 'is_fixed')) |
|
| 91 | 91 | { |
| 92 | 92 | $oDB->addColumn('addons', 'is_fixed', 'char', 1, 'N', TRUE); |
| 93 | 93 | |
| 94 | 94 | // move addon info to addon_site table |
| 95 | 95 | $output = executeQueryArray('addon.getAddons'); |
| 96 | - if($output->data) |
|
| 96 | + if ($output->data) |
|
| 97 | 97 | { |
| 98 | - foreach($output->data as $row) |
|
| 98 | + foreach ($output->data as $row) |
|
| 99 | 99 | { |
| 100 | 100 | $args = new stdClass(); |
| 101 | 101 | $args->site_srl = 0; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $oModuleController = getController('module'); |
| 16 | 16 | $oDB = &DB::getInstance(); |
| 17 | 17 | |
| 18 | - $oDB->addIndex("tags","idx_tag", array("document_srl","tag")); |
|
| 18 | + $oDB->addIndex("tags", "idx_tag", array("document_srl", "tag")); |
|
| 19 | 19 | // 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for |
| 20 | 20 | $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
| 21 | 21 | $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
@@ -37,18 +37,18 @@ discard block |
||
| 37 | 37 | $oModuleModel = getModel('module'); |
| 38 | 38 | $oModuleController = getController('module'); |
| 39 | 39 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 40 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 40 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 41 | 41 | { |
| 42 | 42 | // 2007. 10. 17 trigger registration, if registered upset |
| 43 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true; |
|
| 44 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true; |
|
| 45 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true; |
|
| 46 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true; |
|
| 47 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) return true; |
|
| 43 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true; |
|
| 44 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true; |
|
| 45 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true; |
|
| 46 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true; |
|
| 47 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) return true; |
|
| 48 | 48 | // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag |
| 49 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true; |
|
| 49 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true; |
|
| 50 | 50 | // tag in the index column of the table tag |
| 51 | - if(!$oDB->isIndexExists("tags","idx_tag")) return true; |
|
| 51 | + if (!$oDB->isIndexExists("tags", "idx_tag")) return true; |
|
| 52 | 52 | |
| 53 | 53 | $oModuleController->insertUpdatedLog($version_update_id); |
| 54 | 54 | } |
@@ -65,29 +65,29 @@ discard block |
||
| 65 | 65 | $oModuleModel = getModel('module'); |
| 66 | 66 | $oModuleController = getController('module'); |
| 67 | 67 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 68 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 68 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 69 | 69 | { |
| 70 | 70 | // 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for |
| 71 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) |
|
| 71 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) |
|
| 72 | 72 | $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
| 73 | 73 | |
| 74 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) |
|
| 74 | + if (!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) |
|
| 75 | 75 | $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
| 76 | 76 | |
| 77 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) |
|
| 77 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) |
|
| 78 | 78 | $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
| 79 | 79 | |
| 80 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) |
|
| 80 | + if (!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) |
|
| 81 | 81 | $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
| 82 | 82 | |
| 83 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) |
|
| 83 | + if (!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) |
|
| 84 | 84 | $oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after'); |
| 85 | 85 | // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag |
| 86 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) |
|
| 86 | + if (!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) |
|
| 87 | 87 | $oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'); |
| 88 | 88 | // tag in the index column of the table tag |
| 89 | - if(!$oDB->isIndexExists("tags","idx_tag")) |
|
| 90 | - $oDB->addIndex("tags","idx_tag", array("document_srl","tag")); |
|
| 89 | + if (!$oDB->isIndexExists("tags", "idx_tag")) |
|
| 90 | + $oDB->addIndex("tags", "idx_tag", array("document_srl", "tag")); |
|
| 91 | 91 | |
| 92 | 92 | $oModuleController->insertUpdatedLog($version_update_id); |
| 93 | 93 | } |
@@ -40,15 +40,29 @@ discard block |
||
| 40 | 40 | if($oModuleModel->needUpdate($version_update_id)) |
| 41 | 41 | { |
| 42 | 42 | // 2007. 10. 17 trigger registration, if registered upset |
| 43 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true; |
|
| 44 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true; |
|
| 45 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) return true; |
|
| 46 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) return true; |
|
| 47 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) return true; |
|
| 43 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) { |
|
| 44 | + return true; |
|
| 45 | + } |
|
| 46 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) { |
|
| 47 | + return true; |
|
| 48 | + } |
|
| 49 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) { |
|
| 50 | + return true; |
|
| 51 | + } |
|
| 52 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) { |
|
| 53 | + return true; |
|
| 54 | + } |
|
| 55 | + if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) { |
|
| 56 | + return true; |
|
| 57 | + } |
|
| 48 | 58 | // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag |
| 49 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) return true; |
|
| 59 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) { |
|
| 60 | + return true; |
|
| 61 | + } |
|
| 50 | 62 | // tag in the index column of the table tag |
| 51 | - if(!$oDB->isIndexExists("tags","idx_tag")) return true; |
|
| 63 | + if(!$oDB->isIndexExists("tags","idx_tag")) { |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 52 | 66 | |
| 53 | 67 | $oModuleController->insertUpdatedLog($version_update_id); |
| 54 | 68 | } |
@@ -68,26 +82,33 @@ discard block |
||
| 68 | 82 | if($oModuleModel->needUpdate($version_update_id)) |
| 69 | 83 | { |
| 70 | 84 | // 2007. 10. 17 document.insertDocument, updateDocument, deleteDocument trigger property for |
| 71 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) |
|
| 72 | - $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
|
| 85 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) { |
|
| 86 | + $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
|
| 87 | + } |
|
| 73 | 88 | |
| 74 | - if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) |
|
| 75 | - $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
|
| 89 | + if(!$oModuleModel->getTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) { |
|
| 90 | + $oModuleController->insertTrigger('document.insertDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
|
| 91 | + } |
|
| 76 | 92 | |
| 77 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) |
|
| 78 | - $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
|
| 93 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before')) { |
|
| 94 | + $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerArrangeTag', 'before'); |
|
| 95 | + } |
|
| 79 | 96 | |
| 80 | - if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) |
|
| 81 | - $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
|
| 97 | + if(!$oModuleModel->getTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after')) { |
|
| 98 | + $oModuleController->insertTrigger('document.updateDocument', 'tag', 'controller', 'triggerInsertTag', 'after'); |
|
| 99 | + } |
|
| 82 | 100 | |
| 83 | - if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) |
|
| 84 | - $oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after'); |
|
| 101 | + if(!$oModuleModel->getTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after')) { |
|
| 102 | + $oModuleController->insertTrigger('document.deleteDocument', 'tag', 'controller', 'triggerDeleteTag', 'after'); |
|
| 103 | + } |
|
| 85 | 104 | // 2007. 10. 17 modules are deleted when you delete all registered triggers that add tag |
| 86 | - if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) |
|
| 87 | - $oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'); |
|
| 105 | + if(!$oModuleModel->getTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after')) { |
|
| 106 | + $oModuleController->insertTrigger('module.deleteModule', 'tag', 'controller', 'triggerDeleteModuleTags', 'after'); |
|
| 107 | + } |
|
| 88 | 108 | // tag in the index column of the table tag |
| 89 | - if(!$oDB->isIndexExists("tags","idx_tag")) |
|
| 90 | - $oDB->addIndex("tags","idx_tag", array("document_srl","tag")); |
|
| 109 | + if(!$oDB->isIndexExists("tags","idx_tag")) { |
|
| 110 | + $oDB->addIndex("tags","idx_tag", array("document_srl","tag")); |
|
| 111 | + } |
|
| 91 | 112 | |
| 92 | 113 | $oModuleController->insertUpdatedLog($version_update_id); |
| 93 | 114 | } |
@@ -29,30 +29,30 @@ discard block |
||
| 29 | 29 | $oModuleModel = getModel('module'); |
| 30 | 30 | $oModuleController = getController('module'); |
| 31 | 31 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 32 | - if($oModuleModel->needUpdate($version_update_id)) |
|
| 32 | + if ($oModuleModel->needUpdate($version_update_id)) |
|
| 33 | 33 | { |
| 34 | 34 | // 2009. 02. 11 Add site_srl to layout table |
| 35 | - if(!$oDB->isColumnExists('layouts', 'site_srl')) return true; |
|
| 35 | + if (!$oDB->isColumnExists('layouts', 'site_srl')) return true; |
|
| 36 | 36 | // 2009. 02. 26 Move the previous layout for faceoff |
| 37 | 37 | $files = FileHandler::readDir('./files/cache/layout'); |
| 38 | - for($i=0,$c=count($files);$i<$c;$i++) |
|
| 38 | + for ($i = 0, $c = count($files); $i < $c; $i++) |
|
| 39 | 39 | { |
| 40 | 40 | $filename = $files[$i]; |
| 41 | - if(preg_match('/([0-9]+)\.html/i',$filename)) return true; |
|
| 41 | + if (preg_match('/([0-9]+)\.html/i', $filename)) return true; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if(!$oDB->isColumnExists('layouts', 'layout_type')) return true; |
|
| 44 | + if (!$oDB->isColumnExists('layouts', 'layout_type')) return true; |
|
| 45 | 45 | |
| 46 | 46 | $args = new stdClass(); |
| 47 | 47 | $args->layout = '.'; |
| 48 | 48 | $output = executeQueryArray('layout.getLayoutDotList', $args); |
| 49 | - if($output->data && count($output->data) > 0) |
|
| 49 | + if ($output->data && count($output->data) > 0) |
|
| 50 | 50 | { |
| 51 | - foreach($output->data as $layout) |
|
| 51 | + foreach ($output->data as $layout) |
|
| 52 | 52 | { |
| 53 | 53 | $layout_path = explode('.', $layout->layout); |
| 54 | - if(count($layout_path) != 2) continue; |
|
| 55 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true; |
|
| 54 | + if (count($layout_path) != 2) continue; |
|
| 55 | + if (is_dir(sprintf(_XE_PATH_.'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -74,39 +74,39 @@ discard block |
||
| 74 | 74 | $version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated')); |
| 75 | 75 | { |
| 76 | 76 | // 2009. 02. 11 Add site_srl to menu table |
| 77 | - if(!$oDB->isColumnExists('layouts', 'site_srl')) |
|
| 77 | + if (!$oDB->isColumnExists('layouts', 'site_srl')) |
|
| 78 | 78 | { |
| 79 | - $oDB->addColumn('layouts','site_srl','number',11,0,true); |
|
| 79 | + $oDB->addColumn('layouts', 'site_srl', 'number', 11, 0, true); |
|
| 80 | 80 | } |
| 81 | 81 | // 2009. 02. 26 Move the previous layout for faceoff |
| 82 | 82 | $oLayoutModel = getModel('layout'); |
| 83 | 83 | $files = FileHandler::readDir('./files/cache/layout'); |
| 84 | - for($i=0,$c=count($files);$i<$c;$i++) |
|
| 84 | + for ($i = 0, $c = count($files); $i < $c; $i++) |
|
| 85 | 85 | { |
| 86 | 86 | $filename = $files[$i]; |
| 87 | - if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) continue; |
|
| 87 | + if (!preg_match('/([0-9]+)\.html/i', $filename, $match)) continue; |
|
| 88 | 88 | $layout_srl = $match[1]; |
| 89 | - if(!$layout_srl) continue; |
|
| 89 | + if (!$layout_srl) continue; |
|
| 90 | 90 | $path = $oLayoutModel->getUserLayoutPath($layout_srl); |
| 91 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
| 91 | + if (!is_dir($path)) FileHandler::makeDir($path); |
|
| 92 | 92 | FileHandler::copyFile('./files/cache/layout/'.$filename, $path.'layout.html'); |
| 93 | 93 | @unlink('./files/cache/layout/'.$filename); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if(!$oDB->isColumnExists('layouts', 'layout_type')) |
|
| 96 | + if (!$oDB->isColumnExists('layouts', 'layout_type')) |
|
| 97 | 97 | { |
| 98 | - $oDB->addColumn('layouts','layout_type','char',1,'P',true); |
|
| 98 | + $oDB->addColumn('layouts', 'layout_type', 'char', 1, 'P', true); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $args->layout = '.'; |
| 102 | 102 | $output = executeQueryArray('layout.getLayoutDotList', $args); |
| 103 | - if($output->data && count($output->data) > 0) |
|
| 103 | + if ($output->data && count($output->data) > 0) |
|
| 104 | 104 | { |
| 105 | - foreach($output->data as $layout) |
|
| 105 | + foreach ($output->data as $layout) |
|
| 106 | 106 | { |
| 107 | 107 | $layout_path = explode('.', $layout->layout); |
| 108 | - if(count($layout_path) != 2) continue; |
|
| 109 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) |
|
| 108 | + if (count($layout_path) != 2) continue; |
|
| 109 | + if (is_dir(sprintf(_XE_PATH_.'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) |
|
| 110 | 110 | { |
| 111 | 111 | $args->layout = implode('|@|', $layout_path); |
| 112 | 112 | $args->layout_srl = $layout->layout_srl; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | function recompileCache() |
| 128 | 128 | { |
| 129 | 129 | $path = './files/cache/layout'; |
| 130 | - if(!is_dir($path)) |
|
| 130 | + if (!is_dir($path)) |
|
| 131 | 131 | { |
| 132 | 132 | FileHandler::makeDir($path); |
| 133 | 133 | return; |
@@ -32,16 +32,22 @@ discard block |
||
| 32 | 32 | if($oModuleModel->needUpdate($version_update_id)) |
| 33 | 33 | { |
| 34 | 34 | // 2009. 02. 11 Add site_srl to layout table |
| 35 | - if(!$oDB->isColumnExists('layouts', 'site_srl')) return true; |
|
| 35 | + if(!$oDB->isColumnExists('layouts', 'site_srl')) { |
|
| 36 | + return true; |
|
| 37 | + } |
|
| 36 | 38 | // 2009. 02. 26 Move the previous layout for faceoff |
| 37 | 39 | $files = FileHandler::readDir('./files/cache/layout'); |
| 38 | 40 | for($i=0,$c=count($files);$i<$c;$i++) |
| 39 | 41 | { |
| 40 | 42 | $filename = $files[$i]; |
| 41 | - if(preg_match('/([0-9]+)\.html/i',$filename)) return true; |
|
| 43 | + if(preg_match('/([0-9]+)\.html/i',$filename)) { |
|
| 44 | + return true; |
|
| 45 | + } |
|
| 42 | 46 | } |
| 43 | 47 | |
| 44 | - if(!$oDB->isColumnExists('layouts', 'layout_type')) return true; |
|
| 48 | + if(!$oDB->isColumnExists('layouts', 'layout_type')) { |
|
| 49 | + return true; |
|
| 50 | + } |
|
| 45 | 51 | |
| 46 | 52 | $args = new stdClass(); |
| 47 | 53 | $args->layout = '.'; |
@@ -51,8 +57,12 @@ discard block |
||
| 51 | 57 | foreach($output->data as $layout) |
| 52 | 58 | { |
| 53 | 59 | $layout_path = explode('.', $layout->layout); |
| 54 | - if(count($layout_path) != 2) continue; |
|
| 55 | - if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) return true; |
|
| 60 | + if(count($layout_path) != 2) { |
|
| 61 | + continue; |
|
| 62 | + } |
|
| 63 | + if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) { |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 56 | 66 | } |
| 57 | 67 | } |
| 58 | 68 | |
@@ -84,11 +94,17 @@ discard block |
||
| 84 | 94 | for($i=0,$c=count($files);$i<$c;$i++) |
| 85 | 95 | { |
| 86 | 96 | $filename = $files[$i]; |
| 87 | - if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) continue; |
|
| 97 | + if(!preg_match('/([0-9]+)\.html/i',$filename,$match)) { |
|
| 98 | + continue; |
|
| 99 | + } |
|
| 88 | 100 | $layout_srl = $match[1]; |
| 89 | - if(!$layout_srl) continue; |
|
| 101 | + if(!$layout_srl) { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 90 | 104 | $path = $oLayoutModel->getUserLayoutPath($layout_srl); |
| 91 | - if(!is_dir($path)) FileHandler::makeDir($path); |
|
| 105 | + if(!is_dir($path)) { |
|
| 106 | + FileHandler::makeDir($path); |
|
| 107 | + } |
|
| 92 | 108 | FileHandler::copyFile('./files/cache/layout/'.$filename, $path.'layout.html'); |
| 93 | 109 | @unlink('./files/cache/layout/'.$filename); |
| 94 | 110 | } |
@@ -105,7 +121,9 @@ discard block |
||
| 105 | 121 | foreach($output->data as $layout) |
| 106 | 122 | { |
| 107 | 123 | $layout_path = explode('.', $layout->layout); |
| 108 | - if(count($layout_path) != 2) continue; |
|
| 124 | + if(count($layout_path) != 2) { |
|
| 125 | + continue; |
|
| 126 | + } |
|
| 109 | 127 | if(is_dir(sprintf(_XE_PATH_ . 'themes/%s/layouts/%s', $layout_path[0], $layout_path[1]))) |
| 110 | 128 | { |
| 111 | 129 | $args->layout = implode('|@|', $layout_path); |