@@ -933,6 +933,7 @@ discard block |
||
| 933 | 933 | |
| 934 | 934 | /** |
| 935 | 935 | * @brief Insert skin vars to a module |
| 936 | + * @param string $mode |
|
| 936 | 937 | */ |
| 937 | 938 | function _insertModuleSkinVars($module_srl, $obj, $mode) |
| 938 | 939 | { |
@@ -1006,6 +1007,7 @@ discard block |
||
| 1006 | 1007 | |
| 1007 | 1008 | /** |
| 1008 | 1009 | * @brief Remove skin vars of a module |
| 1010 | + * @param string $mode |
|
| 1009 | 1011 | */ |
| 1010 | 1012 | function _deleteModuleSkinVars($module_srl, $mode) |
| 1011 | 1013 | { |
@@ -1242,6 +1244,7 @@ discard block |
||
| 1242 | 1244 | |
| 1243 | 1245 | /** |
| 1244 | 1246 | * @brief Update a file into the file box |
| 1247 | + * @param stdClass $vars |
|
| 1245 | 1248 | */ |
| 1246 | 1249 | function updateModuleFileBox($vars) |
| 1247 | 1250 | { |
@@ -1283,6 +1286,7 @@ discard block |
||
| 1283 | 1286 | |
| 1284 | 1287 | /** |
| 1285 | 1288 | * @brief Add a file into the file box |
| 1289 | + * @param stdClass $vars |
|
| 1286 | 1290 | */ |
| 1287 | 1291 | function insertModuleFileBox($vars) |
| 1288 | 1292 | { |
@@ -1336,6 +1340,9 @@ discard block |
||
| 1336 | 1340 | if(!$output->toBool()) return $output; |
| 1337 | 1341 | } |
| 1338 | 1342 | |
| 1343 | + /** |
|
| 1344 | + * @param stdClass $vars |
|
| 1345 | + */ |
|
| 1339 | 1346 | function deleteModuleFileBox($vars) |
| 1340 | 1347 | { |
| 1341 | 1348 | // delete real file |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $output = executeQuery('module.insertActionForward', $args); |
| 30 | 30 | |
| 31 | 31 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 32 | - if($oCacheHandler->isSupport()) |
|
| 32 | + if ($oCacheHandler->isSupport()) |
|
| 33 | 33 | { |
| 34 | 34 | $cache_key = 'action_forward'; |
| 35 | 35 | $oCacheHandler->delete($cache_key); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $output = executeQuery('module.deleteActionForward', $args); |
| 52 | 52 | |
| 53 | 53 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 54 | - if($oCacheHandler->isSupport()) |
|
| 54 | + if ($oCacheHandler->isSupport()) |
|
| 55 | 55 | { |
| 56 | 56 | $cache_key = 'action_forward'; |
| 57 | 57 | $oCacheHandler->delete($cache_key); |
@@ -75,12 +75,12 @@ discard block |
||
| 75 | 75 | $args->called_position = $called_position; |
| 76 | 76 | |
| 77 | 77 | $output = executeQuery('module.insertTrigger', $args); |
| 78 | - if($output->toBool()) |
|
| 78 | + if ($output->toBool()) |
|
| 79 | 79 | { |
| 80 | 80 | //remove from cache |
| 81 | 81 | $GLOBALS['__triggers__'] = NULL; |
| 82 | 82 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 83 | - if($oCacheHandler->isSupport()) |
|
| 83 | + if ($oCacheHandler->isSupport()) |
|
| 84 | 84 | { |
| 85 | 85 | $cache_key = 'triggers'; |
| 86 | 86 | $oCacheHandler->delete($cache_key); |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | $args->called_position = $called_position; |
| 105 | 105 | |
| 106 | 106 | $output = executeQuery('module.deleteTrigger', $args); |
| 107 | - if($output->toBool()) |
|
| 107 | + if ($output->toBool()) |
|
| 108 | 108 | { |
| 109 | 109 | //remove from cache |
| 110 | 110 | $GLOBALS['__triggers__'] = NULL; |
| 111 | 111 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 112 | - if($oCacheHandler->isSupport()) |
|
| 112 | + if ($oCacheHandler->isSupport()) |
|
| 113 | 113 | { |
| 114 | 114 | $cache_key = 'triggers'; |
| 115 | 115 | $oCacheHandler->delete($cache_key); |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $args->module = $module; |
| 130 | 130 | |
| 131 | 131 | $output = executeQuery('module.deleteModuleTriggers', $args); |
| 132 | - if($output->toBool()) |
|
| 132 | + if ($output->toBool()) |
|
| 133 | 133 | { |
| 134 | 134 | //remove from cache |
| 135 | 135 | $GLOBALS['__triggers__'] = NULL; |
| 136 | 136 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 137 | - if($oCacheHandler->isSupport()) |
|
| 137 | + if ($oCacheHandler->isSupport()) |
|
| 138 | 138 | { |
| 139 | 139 | $cache_key = 'triggers'; |
| 140 | 140 | $oCacheHandler->delete($cache_key); |
@@ -148,11 +148,11 @@ discard block |
||
| 148 | 148 | * @brief Add module extend |
| 149 | 149 | * |
| 150 | 150 | */ |
| 151 | - function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
| 151 | + function insertModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
| 152 | 152 | { |
| 153 | - if($kind != 'admin') $kind = ''; |
|
| 154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
| 155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
| 153 | + if ($kind != 'admin') $kind = ''; |
|
| 154 | + if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false; |
|
| 155 | + if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false; |
|
| 156 | 156 | |
| 157 | 157 | $cache_file = './files/config/module_extend.php'; |
| 158 | 158 | FileHandler::removeFile($cache_file); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $args->kind = $kind; |
| 165 | 165 | |
| 166 | 166 | $output = executeQuery('module.getModuleExtendCount', $args); |
| 167 | - if($output->data->count>0) return false; |
|
| 167 | + if ($output->data->count > 0) return false; |
|
| 168 | 168 | |
| 169 | 169 | $output = executeQuery('module.insertModuleExtend', $args); |
| 170 | 170 | return $output; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @brief Delete module extend |
| 175 | 175 | * |
| 176 | 176 | */ |
| 177 | - function deleteModuleExtend($parent_module, $extend_module, $type, $kind='') |
|
| 177 | + function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '') |
|
| 178 | 178 | { |
| 179 | 179 | $cache_file = './files/config/module_extend.php'; |
| 180 | 180 | FileHandler::removeFile($cache_file); |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | $oModuleModel = getModel('module'); |
| 200 | 200 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
| 201 | 201 | |
| 202 | - if(!$origin_config) $origin_config = new stdClass; |
|
| 202 | + if (!$origin_config) $origin_config = new stdClass; |
|
| 203 | 203 | |
| 204 | - foreach($config as $key => $val) |
|
| 204 | + foreach ($config as $key => $val) |
|
| 205 | 205 | { |
| 206 | 206 | $origin_config->{$key} = $val; |
| 207 | 207 | } |
@@ -215,19 +215,19 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | function insertModuleConfig($module, $config, $site_srl = 0) |
| 217 | 217 | { |
| 218 | - $args =new stdClass(); |
|
| 218 | + $args = new stdClass(); |
|
| 219 | 219 | $args->module = $module; |
| 220 | 220 | $args->config = serialize($config); |
| 221 | 221 | $args->site_srl = $site_srl; |
| 222 | 222 | |
| 223 | 223 | $output = executeQuery('module.deleteModuleConfig', $args); |
| 224 | - if(!$output->toBool()) return $output; |
|
| 224 | + if (!$output->toBool()) return $output; |
|
| 225 | 225 | |
| 226 | 226 | $output = executeQuery('module.insertModuleConfig', $args); |
| 227 | 227 | |
| 228 | 228 | //remove from cache |
| 229 | 229 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 230 | - if($oCacheHandler->isSupport()) |
|
| 230 | + if ($oCacheHandler->isSupport()) |
|
| 231 | 231 | { |
| 232 | 232 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 233 | 233 | } |
@@ -246,13 +246,13 @@ discard block |
||
| 246 | 246 | $args->config = serialize($config); |
| 247 | 247 | |
| 248 | 248 | $output = executeQuery('module.deleteModulePartConfig', $args); |
| 249 | - if(!$output->toBool()) return $output; |
|
| 249 | + if (!$output->toBool()) return $output; |
|
| 250 | 250 | |
| 251 | 251 | $output = executeQuery('module.insertModulePartConfig', $args); |
| 252 | 252 | |
| 253 | 253 | //remove from cache |
| 254 | 254 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
| 255 | - if($oCacheHandler->isSupport()) |
|
| 255 | + if ($oCacheHandler->isSupport()) |
|
| 256 | 256 | { |
| 257 | 257 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 258 | 258 | } |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | */ |
| 266 | 266 | function insertSite($domain, $index_module_srl) |
| 267 | 267 | { |
| 268 | - if(isSiteID($domain)) |
|
| 268 | + if (isSiteID($domain)) |
|
| 269 | 269 | { |
| 270 | 270 | $oModuleModel = getModel('module'); |
| 271 | - if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid'); |
|
| 271 | + if ($oModuleModel->isIDExists($domain, 0)) return new Object(-1, 'msg_already_registed_vid'); |
|
| 272 | 272 | } |
| 273 | 273 | else |
| 274 | 274 | { |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | $columnList = array('modules.site_srl'); |
| 285 | 285 | $oModuleModel = getModel('module'); |
| 286 | 286 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 287 | - if($output) return new Object(-1,'msg_already_registed_vid'); |
|
| 287 | + if ($output) return new Object(-1, 'msg_already_registed_vid'); |
|
| 288 | 288 | |
| 289 | 289 | $output = executeQuery('module.insertSite', $args); |
| 290 | - if(!$output->toBool()) return $output; |
|
| 290 | + if (!$output->toBool()) return $output; |
|
| 291 | 291 | |
| 292 | 292 | $output->add('site_srl', $args->site_srl); |
| 293 | 293 | return $output; |
@@ -302,32 +302,32 @@ discard block |
||
| 302 | 302 | $columnList = array('sites.site_srl', 'sites.domain'); |
| 303 | 303 | $site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList); |
| 304 | 304 | |
| 305 | - if(!$args->domain && $site_info->site_srl == $args->site_srl) |
|
| 305 | + if (!$args->domain && $site_info->site_srl == $args->site_srl) |
|
| 306 | 306 | { |
| 307 | 307 | $args->domain = $site_info->domain; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if($site_info->domain != $args->domain) |
|
| 310 | + if ($site_info->domain != $args->domain) |
|
| 311 | 311 | { |
| 312 | 312 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain'); |
|
| 314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid'); |
|
| 313 | + if ($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1, 'msg_already_registed_domain'); |
|
| 314 | + if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1, 'msg_already_registed_vid'); |
|
| 315 | 315 | |
| 316 | - if($args->domain && !isSiteID($args->domain)) |
|
| 316 | + if ($args->domain && !isSiteID($args->domain)) |
|
| 317 | 317 | { |
| 318 | 318 | $args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain; |
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | $output = executeQuery('module.updateSite', $args); |
| 322 | 322 | //clear cache for default mid |
| 323 | - if($args->site_srl == 0) $vid=''; |
|
| 324 | - else $vid=$args->domain; |
|
| 323 | + if ($args->site_srl == 0) $vid = ''; |
|
| 324 | + else $vid = $args->domain; |
|
| 325 | 325 | |
| 326 | 326 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
| 327 | 327 | $mid = $module_info->mid; |
| 328 | 328 | |
| 329 | 329 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 330 | - if($oCacheHandler->isSupport()) |
|
| 330 | + if ($oCacheHandler->isSupport()) |
|
| 331 | 331 | { |
| 332 | 332 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 333 | 333 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | unset($args->act); |
| 346 | 346 | unset($args->page); |
| 347 | 347 | // Test mid value |
| 348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 348 | + if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 349 | 349 | // Test variables (separate basic vars and other vars in modules) |
| 350 | 350 | $extra_vars = clone($args); |
| 351 | 351 | unset($extra_vars->module_srl); |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | */ |
| 380 | 380 | function insertModule($args) |
| 381 | 381 | { |
| 382 | - if(isset($args->isMenuCreate)) |
|
| 382 | + if (isset($args->isMenuCreate)) |
|
| 383 | 383 | { |
| 384 | 384 | $isMenuCreate = $args->isMenuCreate; |
| 385 | 385 | } |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 392 | - if(!$output->toBool()) return $output; |
|
| 392 | + if (!$output->toBool()) return $output; |
|
| 393 | 393 | // Check whether the module name already exists |
| 394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 394 | + if (!$args->site_srl) $args->site_srl = 0; |
|
| 395 | 395 | $oModuleModel = getModel('module'); |
| 396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
| 396 | + if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
| 397 | 397 | |
| 398 | 398 | // begin transaction |
| 399 | 399 | $oDB = &DB::getInstance(); |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | $skin_vars = new stdClass(); |
| 405 | 405 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
| 406 | 406 | // Arrange variables and then execute a query |
| 407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 407 | + if (!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 408 | 408 | |
| 409 | 409 | // default value |
| 410 | - if($args->skin == '/USE_DEFAULT/') |
|
| 410 | + if ($args->skin == '/USE_DEFAULT/') |
|
| 411 | 411 | { |
| 412 | 412 | $args->is_skin_fix = 'N'; |
| 413 | 413 | } |
| 414 | 414 | else |
| 415 | 415 | { |
| 416 | - if(isset($args->is_skin_fix)) |
|
| 416 | + if (isset($args->is_skin_fix)) |
|
| 417 | 417 | { |
| 418 | 418 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 419 | 419 | } |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - if($args->mskin == '/USE_DEFAULT/') |
|
| 426 | + if ($args->mskin == '/USE_DEFAULT/') |
|
| 427 | 427 | { |
| 428 | 428 | $args->is_mskin_fix = 'N'; |
| 429 | 429 | } |
| 430 | 430 | else |
| 431 | 431 | { |
| 432 | - if(isset($args->is_mskin_fix)) |
|
| 432 | + if (isset($args->is_mskin_fix)) |
|
| 433 | 433 | { |
| 434 | 434 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 435 | 435 | } |
@@ -443,14 +443,14 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | $args->browser_title = strip_tags($args->browser_title); |
| 445 | 445 | |
| 446 | - if($isMenuCreate == TRUE) |
|
| 446 | + if ($isMenuCreate == TRUE) |
|
| 447 | 447 | { |
| 448 | 448 | $menuArgs = new stdClass; |
| 449 | 449 | $menuArgs->menu_srl = $args->menu_srl; |
| 450 | 450 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
| 451 | 451 | |
| 452 | 452 | // if menu is not created, create menu also. and does not supported that in virtual site. |
| 453 | - if(!$menuOutput->data && !$args->site_srl) |
|
| 453 | + if (!$menuOutput->data && !$args->site_srl) |
|
| 454 | 454 | { |
| 455 | 455 | $oMenuAdminModel = getAdminModel('menu'); |
| 456 | 456 | |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | $menuArgs->listorder = $args->menu_item_srl * -1; |
| 469 | 469 | |
| 470 | 470 | $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); |
| 471 | - if(!$menuItemOutput->toBool()) |
|
| 471 | + if (!$menuItemOutput->toBool()) |
|
| 472 | 472 | { |
| 473 | 473 | $oDB->rollback(); |
| 474 | 474 | return $menuItemOutput; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // Insert a module |
| 482 | 482 | $args->menu_srl = $menuArgs->menu_srl; |
| 483 | 483 | $output = executeQuery('module.insertModule', $args); |
| 484 | - if(!$output->toBool()) |
|
| 484 | + if (!$output->toBool()) |
|
| 485 | 485 | { |
| 486 | 486 | $oDB->rollback(); |
| 487 | 487 | return $output; |
@@ -493,12 +493,12 @@ discard block |
||
| 493 | 493 | $oDB->commit(); |
| 494 | 494 | |
| 495 | 495 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 496 | - if($oCacheHandler->isSupport()) |
|
| 496 | + if ($oCacheHandler->isSupport()) |
|
| 497 | 497 | { |
| 498 | 498 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - $output->add('module_srl',$args->module_srl); |
|
| 501 | + $output->add('module_srl', $args->module_srl); |
|
| 502 | 502 | return $output; |
| 503 | 503 | } |
| 504 | 504 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | function updateModule($args) |
| 509 | 509 | { |
| 510 | 510 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 511 | - if(!$output->toBool()) return $output; |
|
| 511 | + if (!$output->toBool()) return $output; |
|
| 512 | 512 | // begin transaction |
| 513 | 513 | $oDB = &DB::getInstance(); |
| 514 | 514 | $oDB->begin(); |
@@ -517,29 +517,29 @@ discard block |
||
| 517 | 517 | $columnList = array('module_srl', 'site_srl', 'browser_title', 'mid'); |
| 518 | 518 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
| 519 | 519 | |
| 520 | - if(!$args->site_srl || !$args->browser_title) |
|
| 520 | + if (!$args->site_srl || !$args->browser_title) |
|
| 521 | 521 | { |
| 522 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
| 523 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 522 | + if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl; |
|
| 523 | + if (!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | $args->browser_title = strip_tags($args->browser_title); |
| 527 | 527 | |
| 528 | 528 | $output = executeQuery('module.isExistsModuleName', $args); |
| 529 | - if(!$output->toBool() || $output->data->count) |
|
| 529 | + if (!$output->toBool() || $output->data->count) |
|
| 530 | 530 | { |
| 531 | 531 | $oDB->rollback(); |
| 532 | 532 | return new Object(-1, 'msg_module_name_exists'); |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | // default value |
| 536 | - if($args->skin == '/USE_DEFAULT/') |
|
| 536 | + if ($args->skin == '/USE_DEFAULT/') |
|
| 537 | 537 | { |
| 538 | 538 | $args->is_skin_fix = 'N'; |
| 539 | 539 | } |
| 540 | 540 | else |
| 541 | 541 | { |
| 542 | - if(isset($args->is_skin_fix)) |
|
| 542 | + if (isset($args->is_skin_fix)) |
|
| 543 | 543 | { |
| 544 | 544 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 545 | 545 | } |
@@ -549,13 +549,13 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - if($args->mskin == '/USE_DEFAULT/') |
|
| 552 | + if ($args->mskin == '/USE_DEFAULT/') |
|
| 553 | 553 | { |
| 554 | 554 | $args->is_mskin_fix = 'N'; |
| 555 | 555 | } |
| 556 | 556 | else |
| 557 | 557 | { |
| 558 | - if(isset($args->is_mskin_fix)) |
|
| 558 | + if (isset($args->is_mskin_fix)) |
|
| 559 | 559 | { |
| 560 | 560 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 561 | 561 | } |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | $output = executeQuery('module.updateModule', $args); |
| 568 | - if(!$output->toBool()) |
|
| 568 | + if (!$output->toBool()) |
|
| 569 | 569 | { |
| 570 | 570 | $oDB->rollback(); |
| 571 | 571 | return $output; |
@@ -575,15 +575,15 @@ discard block |
||
| 575 | 575 | $menuArgs->url = $module_info->mid; |
| 576 | 576 | $menuArgs->site_srl = $module_info->site_srl; |
| 577 | 577 | $menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs); |
| 578 | - if($menuOutput->data && count($menuOutput->data)) |
|
| 578 | + if ($menuOutput->data && count($menuOutput->data)) |
|
| 579 | 579 | { |
| 580 | 580 | $oMenuAdminController = getAdminController('menu'); |
| 581 | - foreach($menuOutput->data as $itemInfo) |
|
| 581 | + foreach ($menuOutput->data as $itemInfo) |
|
| 582 | 582 | { |
| 583 | 583 | $itemInfo->url = $args->mid; |
| 584 | 584 | |
| 585 | 585 | $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); |
| 586 | - if(!$updateMenuItemOutput->toBool()) |
|
| 586 | + if (!$updateMenuItemOutput->toBool()) |
|
| 587 | 587 | { |
| 588 | 588 | $oDB->rollback(); |
| 589 | 589 | return $updateMenuItemOutput; |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | // if mid changed, change mid of success_return_url to new mid |
| 595 | - if($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
| 595 | + if ($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
| 596 | 596 | { |
| 597 | 597 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
| 598 | 598 | } |
@@ -602,11 +602,11 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | $oDB->commit(); |
| 604 | 604 | |
| 605 | - $output->add('module_srl',$args->module_srl); |
|
| 605 | + $output->add('module_srl', $args->module_srl); |
|
| 606 | 606 | |
| 607 | 607 | //remove from cache |
| 608 | 608 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 609 | - if($oCacheHandler->isSupport()) |
|
| 609 | + if ($oCacheHandler->isSupport()) |
|
| 610 | 610 | { |
| 611 | 611 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 612 | 612 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | $args->update_id = $update_id; |
| 626 | 626 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
| 627 | 627 | |
| 628 | - if(!!$output->error) return false; |
|
| 628 | + if (!!$output->error) return false; |
|
| 629 | 629 | |
| 630 | 630 | return true; |
| 631 | 631 | } |
@@ -640,11 +640,11 @@ discard block |
||
| 640 | 640 | $args->site_srl = $site_srl; |
| 641 | 641 | $args->layout_srl = $layout_srl; |
| 642 | 642 | $output = executeQuery('module.updateModuleSite', $args); |
| 643 | - if(!$output->toBool()) return $output; |
|
| 643 | + if (!$output->toBool()) return $output; |
|
| 644 | 644 | |
| 645 | 645 | //remove from cache |
| 646 | 646 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 647 | - if($oCacheHandler->isSupport()) |
|
| 647 | + if ($oCacheHandler->isSupport()) |
|
| 648 | 648 | { |
| 649 | 649 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 650 | 650 | } |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | */ |
| 660 | 660 | function deleteModule($module_srl, $site_srl = 0) |
| 661 | 661 | { |
| 662 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 662 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 663 | 663 | |
| 664 | 664 | $site_module_info = Context::get('site_module_info'); |
| 665 | 665 | |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $args = new stdClass(); |
| 670 | 670 | $args->url = $output->mid; |
| 671 | 671 | $args->is_shortcut = 'N'; |
| 672 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 672 | + if (!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 673 | 673 | else $args->site_srl = $site_srl; |
| 674 | 674 | |
| 675 | 675 | unset($output); |
@@ -678,9 +678,9 @@ discard block |
||
| 678 | 678 | $menuOutput = $oMenuAdminModel->getMenuList($args); |
| 679 | 679 | |
| 680 | 680 | // get menu_srl by site_srl |
| 681 | - if(is_array($menuOutput->data)) |
|
| 681 | + if (is_array($menuOutput->data)) |
|
| 682 | 682 | { |
| 683 | - foreach($menuOutput->data AS $key=>$value) |
|
| 683 | + foreach ($menuOutput->data AS $key=>$value) |
|
| 684 | 684 | { |
| 685 | 685 | $args->menu_srl = $value->menu_srl; |
| 686 | 686 | break; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
| 691 | 691 | // menu delete |
| 692 | - if($output->data) |
|
| 692 | + if ($output->data) |
|
| 693 | 693 | { |
| 694 | 694 | unset($args); |
| 695 | 695 | $args = new stdClass; |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | $oMenuAdminController = getAdminController('menu'); |
| 701 | 701 | $output = $oMenuAdminController->deleteItem($args); |
| 702 | 702 | |
| 703 | - if($output->isSuccess) |
|
| 703 | + if ($output->isSuccess) |
|
| 704 | 704 | { |
| 705 | 705 | return new Object(0, 'success_deleted'); |
| 706 | 706 | } |
@@ -722,19 +722,19 @@ discard block |
||
| 722 | 722 | */ |
| 723 | 723 | public function onlyDeleteModule($module_srl) |
| 724 | 724 | { |
| 725 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 725 | + if (!$module_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 726 | 726 | |
| 727 | 727 | // check start module |
| 728 | 728 | $oModuleModel = getModel('module'); |
| 729 | 729 | $columnList = array('sites.index_module_srl'); |
| 730 | 730 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 731 | - if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 731 | + if ($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 732 | 732 | |
| 733 | 733 | // Call a trigger (before) |
| 734 | 734 | $trigger_obj = new stdClass(); |
| 735 | 735 | $trigger_obj->module_srl = $module_srl; |
| 736 | 736 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
| 737 | - if(!$output->toBool()) return $output; |
|
| 737 | + if (!$output->toBool()) return $output; |
|
| 738 | 738 | |
| 739 | 739 | // begin transaction |
| 740 | 740 | $oDB = &DB::getInstance(); |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $args->module_srl = $module_srl; |
| 745 | 745 | // Delete module information from the DB |
| 746 | 746 | $output = executeQuery('module.deleteModule', $args); |
| 747 | - if(!$output->toBool()) |
|
| 747 | + if (!$output->toBool()) |
|
| 748 | 748 | { |
| 749 | 749 | $oDB->rollback(); |
| 750 | 750 | return $output; |
@@ -758,10 +758,10 @@ discard block |
||
| 758 | 758 | // Remove the module manager |
| 759 | 759 | $this->deleteAdminId($module_srl); |
| 760 | 760 | // Call a trigger (after) |
| 761 | - if($output->toBool()) |
|
| 761 | + if ($output->toBool()) |
|
| 762 | 762 | { |
| 763 | 763 | $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); |
| 764 | - if(!$trigger_output->toBool()) |
|
| 764 | + if (!$trigger_output->toBool()) |
|
| 765 | 765 | { |
| 766 | 766 | $oDB->rollback(); |
| 767 | 767 | return $trigger_output; |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | //remove from cache |
| 775 | 775 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 776 | - if($oCacheHandler->isSupport()) |
|
| 776 | + if ($oCacheHandler->isSupport()) |
|
| 777 | 777 | { |
| 778 | 778 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 779 | 779 | } |
@@ -795,10 +795,10 @@ discard block |
||
| 795 | 795 | function clearDefaultModule() |
| 796 | 796 | { |
| 797 | 797 | $output = executeQuery('module.clearDefaultModule'); |
| 798 | - if(!$output->toBool()) return $output; |
|
| 798 | + if (!$output->toBool()) return $output; |
|
| 799 | 799 | |
| 800 | 800 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 801 | - if($oCacheHandler->isSupport()) |
|
| 801 | + if ($oCacheHandler->isSupport()) |
|
| 802 | 802 | { |
| 803 | 803 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 804 | 804 | } |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | $output = executeQuery('module.updateModuleMenu', $args); |
| 815 | 815 | |
| 816 | 816 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 817 | - if($oCacheHandler->isSupport()) |
|
| 817 | + if ($oCacheHandler->isSupport()) |
|
| 818 | 818 | { |
| 819 | 819 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 820 | 820 | } |
@@ -827,15 +827,15 @@ discard block |
||
| 827 | 827 | */ |
| 828 | 828 | function updateModuleLayout($layout_srl, $menu_srl_list) |
| 829 | 829 | { |
| 830 | - if(!count($menu_srl_list)) return; |
|
| 830 | + if (!count($menu_srl_list)) return; |
|
| 831 | 831 | |
| 832 | 832 | $args = new stdClass; |
| 833 | 833 | $args->layout_srl = $layout_srl; |
| 834 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
| 834 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
| 835 | 835 | $output = executeQuery('module.updateModuleLayout', $args); |
| 836 | 836 | |
| 837 | 837 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 838 | - if($oCacheHandler->isSupport()) |
|
| 838 | + if ($oCacheHandler->isSupport()) |
|
| 839 | 839 | { |
| 840 | 840 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 841 | 841 | } |
@@ -854,37 +854,37 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | $output = executeQuery('module.deleteSiteAdmin', $args); |
| 856 | 856 | |
| 857 | - if(!$output->toBool()) return $output; |
|
| 857 | + if (!$output->toBool()) return $output; |
|
| 858 | 858 | // Get user id of an administrator |
| 859 | - if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
| 860 | - foreach($arr_admins as $key => $user_id) |
|
| 859 | + if (!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
| 860 | + foreach ($arr_admins as $key => $user_id) |
|
| 861 | 861 | { |
| 862 | - if(!trim($user_id)) continue; |
|
| 862 | + if (!trim($user_id)) continue; |
|
| 863 | 863 | $admins[] = trim($user_id); |
| 864 | 864 | } |
| 865 | - if(!count($admins)) return new Object(); |
|
| 865 | + if (!count($admins)) return new Object(); |
|
| 866 | 866 | |
| 867 | 867 | $oMemberModel = getModel('member'); |
| 868 | 868 | $member_config = $oMemberModel->getMemberConfig(); |
| 869 | - if($member_config->identifier == 'email_address') |
|
| 869 | + if ($member_config->identifier == 'email_address') |
|
| 870 | 870 | { |
| 871 | - $args->email_address = '\''.implode('\',\'',$admins).'\''; |
|
| 871 | + $args->email_address = '\''.implode('\',\'', $admins).'\''; |
|
| 872 | 872 | } |
| 873 | 873 | else |
| 874 | 874 | { |
| 875 | - $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
|
| 875 | + $args->user_ids = '\''.implode('\',\'', $admins).'\''; |
|
| 876 | 876 | } |
| 877 | 877 | $output = executeQueryArray('module.getAdminSrls', $args); |
| 878 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 878 | + if (!$output->toBool() || !$output->data) return $output; |
|
| 879 | 879 | |
| 880 | - foreach($output->data as $key => $val) |
|
| 880 | + foreach ($output->data as $key => $val) |
|
| 881 | 881 | { |
| 882 | 882 | unset($args); |
| 883 | 883 | $args = new stdClass; |
| 884 | 884 | $args->site_srl = $site_srl; |
| 885 | 885 | $args->member_srl = $val->member_srl; |
| 886 | 886 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
| 887 | - if(!$output->toBool()) return $output; |
|
| 887 | + if (!$output->toBool()) return $output; |
|
| 888 | 888 | } |
| 889 | 889 | return new Object(); |
| 890 | 890 | } |
@@ -897,12 +897,12 @@ discard block |
||
| 897 | 897 | $oMemberModel = getModel('member'); |
| 898 | 898 | $member_config = $oMemberModel->getMemberConfig(); |
| 899 | 899 | |
| 900 | - if($member_config->identifier == 'email_address') |
|
| 900 | + if ($member_config->identifier == 'email_address') |
|
| 901 | 901 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
| 902 | 902 | else |
| 903 | 903 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 904 | 904 | |
| 905 | - if(!$member_info->member_srl) return; |
|
| 905 | + if (!$member_info->member_srl) return; |
|
| 906 | 906 | $args = new stdClass(); |
| 907 | 907 | $args->module_srl = $module_srl; |
| 908 | 908 | $args->member_srl = $member_info->member_srl; |
@@ -917,11 +917,11 @@ discard block |
||
| 917 | 917 | $args = new stdClass(); |
| 918 | 918 | $args->module_srl = $module_srl; |
| 919 | 919 | |
| 920 | - if($admin_id) |
|
| 920 | + if ($admin_id) |
|
| 921 | 921 | { |
| 922 | 922 | $oMemberModel = getModel('member'); |
| 923 | 923 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 924 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 924 | + if ($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 925 | 925 | } |
| 926 | 926 | return executeQuery('module.deleteAdminId', $args); |
| 927 | 927 | } |
@@ -958,18 +958,18 @@ discard block |
||
| 958 | 958 | $oDB->begin(); |
| 959 | 959 | |
| 960 | 960 | $output = $this->_deleteModuleSkinVars($module_srl, $mode); |
| 961 | - if(!$output->toBool()) |
|
| 961 | + if (!$output->toBool()) |
|
| 962 | 962 | { |
| 963 | 963 | $oDB->rollback(); |
| 964 | 964 | return $output; |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | getDestroyXeVars($obj); |
| 968 | - if(!$obj || !count($obj)) return new Object(); |
|
| 968 | + if (!$obj || !count($obj)) return new Object(); |
|
| 969 | 969 | |
| 970 | 970 | $args = new stdClass; |
| 971 | 971 | $args->module_srl = $module_srl; |
| 972 | - foreach($obj as $key => $val) |
|
| 972 | + foreach ($obj as $key => $val) |
|
| 973 | 973 | { |
| 974 | 974 | // #17927989 For an old board which used the old blog module |
| 975 | 975 | // it often saved menu item(stdClass) on the skin info column |
@@ -980,9 +980,9 @@ discard block |
||
| 980 | 980 | |
| 981 | 981 | $args->name = trim($key); |
| 982 | 982 | $args->value = trim($val); |
| 983 | - if(!$args->name || !$args->value) continue; |
|
| 983 | + if (!$args->name || !$args->value) continue; |
|
| 984 | 984 | |
| 985 | - if($mode === 'P') |
|
| 985 | + if ($mode === 'P') |
|
| 986 | 986 | { |
| 987 | 987 | $output = executeQuery('module.insertModuleSkinVars', $args); |
| 988 | 988 | } |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | { |
| 991 | 991 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
| 992 | 992 | } |
| 993 | - if(!$output->toBool()) |
|
| 993 | + if (!$output->toBool()) |
|
| 994 | 994 | { |
| 995 | 995 | return $output; |
| 996 | 996 | $oDB->rollback(); |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | $args->module_srl = $module_srl; |
| 1030 | 1030 | $mode = $mode === 'P' ? 'P' : 'M'; |
| 1031 | 1031 | |
| 1032 | - if($mode === 'P') |
|
| 1032 | + if ($mode === 'P') |
|
| 1033 | 1033 | { |
| 1034 | 1034 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1035 | 1035 | $query = 'module.deleteModuleSkinVars'; |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | //remove from cache |
| 1044 | 1044 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1045 | 1045 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
| 1046 | - if($oCacheHandler->isSupport()) |
|
| 1046 | + if ($oCacheHandler->isSupport()) |
|
| 1047 | 1047 | { |
| 1048 | 1048 | $oCacheHandler->delete($cache_key); |
| 1049 | 1049 | } |
@@ -1058,22 +1058,22 @@ discard block |
||
| 1058 | 1058 | { |
| 1059 | 1059 | $this->deleteModuleExtraVars($module_srl); |
| 1060 | 1060 | getDestroyXeVars($obj); |
| 1061 | - if(!$obj || !count($obj)) return; |
|
| 1061 | + if (!$obj || !count($obj)) return; |
|
| 1062 | 1062 | |
| 1063 | - foreach($obj as $key => $val) |
|
| 1063 | + foreach ($obj as $key => $val) |
|
| 1064 | 1064 | { |
| 1065 | - if(is_object($val) || is_array($val)) continue; |
|
| 1065 | + if (is_object($val) || is_array($val)) continue; |
|
| 1066 | 1066 | |
| 1067 | 1067 | $args = new stdClass(); |
| 1068 | 1068 | $args->module_srl = $module_srl; |
| 1069 | 1069 | $args->name = trim($key); |
| 1070 | 1070 | $args->value = trim($val); |
| 1071 | - if(!$args->name || !$args->value) continue; |
|
| 1071 | + if (!$args->name || !$args->value) continue; |
|
| 1072 | 1072 | $output = executeQuery('module.insertModuleExtraVars', $args); |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1076 | - if($oCacheHandler->isSupport()) |
|
| 1076 | + if ($oCacheHandler->isSupport()) |
|
| 1077 | 1077 | { |
| 1078 | 1078 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1079 | 1079 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | |
| 1093 | 1093 | //remove from cache |
| 1094 | 1094 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1095 | - if($oCacheHandler->isSupport()) |
|
| 1095 | + if ($oCacheHandler->isSupport()) |
|
| 1096 | 1096 | { |
| 1097 | 1097 | $object_key = 'module_extra_vars:'.$module_srl; |
| 1098 | 1098 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1108,19 +1108,19 @@ discard block |
||
| 1108 | 1108 | function insertModuleGrants($module_srl, $obj) |
| 1109 | 1109 | { |
| 1110 | 1110 | $this->deleteModuleGrants($module_srl); |
| 1111 | - if(!$obj || !count($obj)) return; |
|
| 1111 | + if (!$obj || !count($obj)) return; |
|
| 1112 | 1112 | |
| 1113 | - foreach($obj as $name => $val) |
|
| 1113 | + foreach ($obj as $name => $val) |
|
| 1114 | 1114 | { |
| 1115 | - if(!$val || !count($val)) continue; |
|
| 1115 | + if (!$val || !count($val)) continue; |
|
| 1116 | 1116 | |
| 1117 | - foreach($val as $group_srl) |
|
| 1117 | + foreach ($val as $group_srl) |
|
| 1118 | 1118 | { |
| 1119 | 1119 | $args = new stdClass(); |
| 1120 | 1120 | $args->module_srl = $module_srl; |
| 1121 | 1121 | $args->name = $name; |
| 1122 | 1122 | $args->group_srl = trim($group_srl); |
| 1123 | - if(!$args->name || !$args->group_srl) continue; |
|
| 1123 | + if (!$args->name || !$args->group_srl) continue; |
|
| 1124 | 1124 | executeQuery('module.insertModuleGrant', $args); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
@@ -1141,9 +1141,9 @@ discard block |
||
| 1141 | 1141 | */ |
| 1142 | 1142 | function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) |
| 1143 | 1143 | { |
| 1144 | - if($isReplaceLangCode) |
|
| 1144 | + if ($isReplaceLangCode) |
|
| 1145 | 1145 | { |
| 1146 | - $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); |
|
| 1146 | + $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | } |
| 1149 | 1149 | |
@@ -1151,27 +1151,27 @@ discard block |
||
| 1151 | 1151 | { |
| 1152 | 1152 | static $lang = null; |
| 1153 | 1153 | |
| 1154 | - if(is_null($lang)) |
|
| 1154 | + if (is_null($lang)) |
|
| 1155 | 1155 | { |
| 1156 | 1156 | $site_module_info = Context::get('site_module_info'); |
| 1157 | - if(!$site_module_info) |
|
| 1157 | + if (!$site_module_info) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | $oModuleModel = getModel('module'); |
| 1160 | 1160 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 1161 | 1161 | Context::set('site_module_info', $site_module_info); |
| 1162 | 1162 | } |
| 1163 | 1163 | $cache_file = sprintf('%sfiles/cache/lang_defined/%d.%s.php', _XE_PATH_, $site_module_info->site_srl, Context::getLangType()); |
| 1164 | - if(!file_exists($cache_file)) |
|
| 1164 | + if (!file_exists($cache_file)) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $oModuleAdminController = getAdminController('module'); |
| 1167 | 1167 | $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | - if(file_exists($cache_file)) |
|
| 1170 | + if (file_exists($cache_file)) |
|
| 1171 | 1171 | { |
| 1172 | - $moduleAdminControllerMtime = filemtime(_XE_PATH_ . 'modules/module/module.admin.controller.php'); |
|
| 1172 | + $moduleAdminControllerMtime = filemtime(_XE_PATH_.'modules/module/module.admin.controller.php'); |
|
| 1173 | 1173 | $cacheFileMtime = filemtime($cache_file); |
| 1174 | - if($cacheFileMtime < $moduleAdminControllerMtime) |
|
| 1174 | + if ($cacheFileMtime < $moduleAdminControllerMtime) |
|
| 1175 | 1175 | { |
| 1176 | 1176 | $oModuleAdminController = getAdminController('module'); |
| 1177 | 1177 | $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
@@ -1180,9 +1180,9 @@ discard block |
||
| 1180 | 1180 | require_once($cache_file); |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
| 1183 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1183 | + if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1184 | 1184 | |
| 1185 | - return str_replace('$user_lang->','',$matches[0]); |
|
| 1185 | + return str_replace('$user_lang->', '', $matches[0]); |
|
| 1186 | 1186 | } |
| 1187 | 1187 | |
| 1188 | 1188 | |
@@ -1195,17 +1195,17 @@ discard block |
||
| 1195 | 1195 | if ($ajax) Context::setRequestMethod('JSON'); |
| 1196 | 1196 | |
| 1197 | 1197 | $logged_info = Context::get('logged_info'); |
| 1198 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1198 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1199 | 1199 | |
| 1200 | - $vars = Context::gets('addfile','filter'); |
|
| 1200 | + $vars = Context::gets('addfile', 'filter'); |
|
| 1201 | 1201 | $attributeNames = Context::get('attribute_name'); |
| 1202 | 1202 | $attributeValues = Context::get('attribute_value'); |
| 1203 | - if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
| 1203 | + if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | $attributes = array(); |
| 1206 | - foreach($attributeNames as $no => $name) |
|
| 1206 | + foreach ($attributeNames as $no => $name) |
|
| 1207 | 1207 | { |
| 1208 | - if(empty($name)) |
|
| 1208 | + if (empty($name)) |
|
| 1209 | 1209 | { |
| 1210 | 1210 | continue; |
| 1211 | 1211 | } |
@@ -1217,16 +1217,16 @@ discard block |
||
| 1217 | 1217 | $vars->comment = $attributes; |
| 1218 | 1218 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1219 | 1219 | |
| 1220 | - $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1220 | + $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1221 | 1221 | $vars->ext = $ext; |
| 1222 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
| 1223 | - else $filter = array('jpg','jpeg','gif','png'); |
|
| 1224 | - if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured'); |
|
| 1222 | + if ($vars->filter) $filter = explode(',', $vars->filter); |
|
| 1223 | + else $filter = array('jpg', 'jpeg', 'gif', 'png'); |
|
| 1224 | + if (!in_array($ext, $filter)) return new Object(-1, 'msg_error_occured'); |
|
| 1225 | 1225 | |
| 1226 | 1226 | $vars->member_srl = $logged_info->member_srl; |
| 1227 | 1227 | |
| 1228 | 1228 | // update |
| 1229 | - if($module_filebox_srl > 0) |
|
| 1229 | + if ($module_filebox_srl > 0) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1232 | 1232 | $output = $this->updateModuleFileBox($vars); |
@@ -1234,10 +1234,10 @@ discard block |
||
| 1234 | 1234 | // insert |
| 1235 | 1235 | else |
| 1236 | 1236 | { |
| 1237 | - if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
| 1237 | + if (!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
| 1238 | 1238 | $addfile = Context::get('addfile'); |
| 1239 | - if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
| 1240 | - if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
| 1239 | + if (!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
| 1240 | + if ($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
| 1241 | 1241 | $output = $this->insertModuleFileBox($vars); |
| 1242 | 1242 | } |
| 1243 | 1243 | |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | } |
| 1252 | 1252 | else |
| 1253 | 1253 | { |
| 1254 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1254 | + if ($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1255 | 1255 | else $this->add('save_filename', ''); |
| 1256 | 1256 | } |
| 1257 | 1257 | } |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | { |
| 1264 | 1264 | $args = new stdClass; |
| 1265 | 1265 | // have file |
| 1266 | - if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
| 1266 | + if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
| 1267 | 1267 | { |
| 1268 | 1268 | $oModuleModel = getModel('module'); |
| 1269 | 1269 | $output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl); |
@@ -1272,18 +1272,18 @@ discard block |
||
| 1272 | 1272 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
| 1273 | 1273 | FileHandler::makeDir($path); |
| 1274 | 1274 | |
| 1275 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext); |
|
| 1275 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext); |
|
| 1276 | 1276 | $tmp = $vars->addfile['tmp_name']; |
| 1277 | 1277 | |
| 1278 | 1278 | // Check uploaded file |
| 1279 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1279 | + if (!checkUploadedFile($tmp)) return false; |
|
| 1280 | 1280 | |
| 1281 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
| 1281 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
| 1282 | 1282 | { |
| 1283 | 1283 | return false; |
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1286 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1287 | 1287 | $args->filename = $save_filename; |
| 1288 | 1288 | $args->filesize = $vars->addfile['size']; |
| 1289 | 1289 | } |
@@ -1309,14 +1309,14 @@ discard block |
||
| 1309 | 1309 | $oModuleModel = getModel('module'); |
| 1310 | 1310 | $path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl); |
| 1311 | 1311 | FileHandler::makeDir($path); |
| 1312 | - $save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext); |
|
| 1312 | + $save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext); |
|
| 1313 | 1313 | $tmp = $vars->addfile['tmp_name']; |
| 1314 | 1314 | |
| 1315 | 1315 | // Check uploaded file |
| 1316 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1316 | + if (!checkUploadedFile($tmp)) return false; |
|
| 1317 | 1317 | |
| 1318 | 1318 | // upload |
| 1319 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
| 1319 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
| 1320 | 1320 | { |
| 1321 | 1321 | return false; |
| 1322 | 1322 | } |
@@ -1327,7 +1327,7 @@ discard block |
||
| 1327 | 1327 | $args->member_srl = $vars->member_srl; |
| 1328 | 1328 | $args->comment = $vars->comment; |
| 1329 | 1329 | $args->filename = $save_filename; |
| 1330 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
| 1330 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
| 1331 | 1331 | $args->filesize = $vars->addfile['size']; |
| 1332 | 1332 | |
| 1333 | 1333 | $output = executeQuery('module.insertModuleFileBox', $args); |
@@ -1342,14 +1342,14 @@ discard block |
||
| 1342 | 1342 | function procModuleFileBoxDelete() |
| 1343 | 1343 | { |
| 1344 | 1344 | $logged_info = Context::get('logged_info'); |
| 1345 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1345 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1346 | 1346 | |
| 1347 | 1347 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1348 | - if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1348 | + if (!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1349 | 1349 | $vars = new stdClass(); |
| 1350 | 1350 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1351 | 1351 | $output = $this->deleteModuleFileBox($vars); |
| 1352 | - if(!$output->toBool()) return $output; |
|
| 1352 | + if (!$output->toBool()) return $output; |
|
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | 1355 | function deleteModuleFileBox($vars) |
@@ -1372,11 +1372,11 @@ discard block |
||
| 1372 | 1372 | $this->unlockTimeoutPassed(); |
| 1373 | 1373 | $args = new stdClass; |
| 1374 | 1374 | $args->lock_name = $lock_name; |
| 1375 | - if(!$timeout) $timeout = 60; |
|
| 1375 | + if (!$timeout) $timeout = 60; |
|
| 1376 | 1376 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
| 1377 | - if($member_srl) $args->member_srl = $member_srl; |
|
| 1377 | + if ($member_srl) $args->member_srl = $member_srl; |
|
| 1378 | 1378 | $output = executeQuery('module.insertLock', $args); |
| 1379 | - if($output->toBool()) |
|
| 1379 | + if ($output->toBool()) |
|
| 1380 | 1380 | { |
| 1381 | 1381 | $output->add('lock_name', $lock_name); |
| 1382 | 1382 | $output->add('deadline', $args->deadline); |
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | $output = executeQuery('module.updateModuleInSites', $args); |
| 1406 | 1406 | |
| 1407 | 1407 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 1408 | - if($oCacheHandler->isSupport()) |
|
| 1408 | + if ($oCacheHandler->isSupport()) |
|
| 1409 | 1409 | { |
| 1410 | 1410 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
| 1411 | 1411 | } |
@@ -150,9 +150,15 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | function insertModuleExtend($parent_module, $extend_module, $type, $kind='') |
| 152 | 152 | { |
| 153 | - if($kind != 'admin') $kind = ''; |
|
| 154 | - if(!in_array($type,array('model','controller','view','api','mobile'))) return false; |
|
| 155 | - if(in_array($parent_module, array('module','addon','widget','layout'))) return false; |
|
| 153 | + if($kind != 'admin') { |
|
| 154 | + $kind = ''; |
|
| 155 | + } |
|
| 156 | + if(!in_array($type,array('model','controller','view','api','mobile'))) { |
|
| 157 | + return false; |
|
| 158 | + } |
|
| 159 | + if(in_array($parent_module, array('module','addon','widget','layout'))) { |
|
| 160 | + return false; |
|
| 161 | + } |
|
| 156 | 162 | |
| 157 | 163 | $cache_file = './files/config/module_extend.php'; |
| 158 | 164 | FileHandler::removeFile($cache_file); |
@@ -164,7 +170,9 @@ discard block |
||
| 164 | 170 | $args->kind = $kind; |
| 165 | 171 | |
| 166 | 172 | $output = executeQuery('module.getModuleExtendCount', $args); |
| 167 | - if($output->data->count>0) return false; |
|
| 173 | + if($output->data->count>0) { |
|
| 174 | + return false; |
|
| 175 | + } |
|
| 168 | 176 | |
| 169 | 177 | $output = executeQuery('module.insertModuleExtend', $args); |
| 170 | 178 | return $output; |
@@ -199,7 +207,9 @@ discard block |
||
| 199 | 207 | $oModuleModel = getModel('module'); |
| 200 | 208 | $origin_config = $oModuleModel->getModuleConfig($module, $site_srl); |
| 201 | 209 | |
| 202 | - if(!$origin_config) $origin_config = new stdClass; |
|
| 210 | + if(!$origin_config) { |
|
| 211 | + $origin_config = new stdClass; |
|
| 212 | + } |
|
| 203 | 213 | |
| 204 | 214 | foreach($config as $key => $val) |
| 205 | 215 | { |
@@ -221,7 +231,9 @@ discard block |
||
| 221 | 231 | $args->site_srl = $site_srl; |
| 222 | 232 | |
| 223 | 233 | $output = executeQuery('module.deleteModuleConfig', $args); |
| 224 | - if(!$output->toBool()) return $output; |
|
| 234 | + if(!$output->toBool()) { |
|
| 235 | + return $output; |
|
| 236 | + } |
|
| 225 | 237 | |
| 226 | 238 | $output = executeQuery('module.insertModuleConfig', $args); |
| 227 | 239 | |
@@ -246,7 +258,9 @@ discard block |
||
| 246 | 258 | $args->config = serialize($config); |
| 247 | 259 | |
| 248 | 260 | $output = executeQuery('module.deleteModulePartConfig', $args); |
| 249 | - if(!$output->toBool()) return $output; |
|
| 261 | + if(!$output->toBool()) { |
|
| 262 | + return $output; |
|
| 263 | + } |
|
| 250 | 264 | |
| 251 | 265 | $output = executeQuery('module.insertModulePartConfig', $args); |
| 252 | 266 | |
@@ -268,9 +282,10 @@ discard block |
||
| 268 | 282 | if(isSiteID($domain)) |
| 269 | 283 | { |
| 270 | 284 | $oModuleModel = getModel('module'); |
| 271 | - if($oModuleModel->isIDExists($domain, 0)) return new Object(-1,'msg_already_registed_vid'); |
|
| 272 | - } |
|
| 273 | - else |
|
| 285 | + if($oModuleModel->isIDExists($domain, 0)) { |
|
| 286 | + return new Object(-1,'msg_already_registed_vid'); |
|
| 287 | + } |
|
| 288 | + } else |
|
| 274 | 289 | { |
| 275 | 290 | $domain = strtolower($domain); |
| 276 | 291 | } |
@@ -284,10 +299,14 @@ discard block |
||
| 284 | 299 | $columnList = array('modules.site_srl'); |
| 285 | 300 | $oModuleModel = getModel('module'); |
| 286 | 301 | $output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 287 | - if($output) return new Object(-1,'msg_already_registed_vid'); |
|
| 302 | + if($output) { |
|
| 303 | + return new Object(-1,'msg_already_registed_vid'); |
|
| 304 | + } |
|
| 288 | 305 | |
| 289 | 306 | $output = executeQuery('module.insertSite', $args); |
| 290 | - if(!$output->toBool()) return $output; |
|
| 307 | + if(!$output->toBool()) { |
|
| 308 | + return $output; |
|
| 309 | + } |
|
| 291 | 310 | |
| 292 | 311 | $output->add('site_srl', $args->site_srl); |
| 293 | 312 | return $output; |
@@ -310,8 +329,12 @@ discard block |
||
| 310 | 329 | if($site_info->domain != $args->domain) |
| 311 | 330 | { |
| 312 | 331 | $info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList); |
| 313 | - if($info->site_srl && $info->site_srl != $args->site_srl) return new Object(-1,'msg_already_registed_domain'); |
|
| 314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new Object(-1,'msg_already_registed_vid'); |
|
| 332 | + if($info->site_srl && $info->site_srl != $args->site_srl) { |
|
| 333 | + return new Object(-1,'msg_already_registed_domain'); |
|
| 334 | + } |
|
| 335 | + if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) { |
|
| 336 | + return new Object(-1,'msg_already_registed_vid'); |
|
| 337 | + } |
|
| 315 | 338 | |
| 316 | 339 | if($args->domain && !isSiteID($args->domain)) |
| 317 | 340 | { |
@@ -320,8 +343,11 @@ discard block |
||
| 320 | 343 | } |
| 321 | 344 | $output = executeQuery('module.updateSite', $args); |
| 322 | 345 | //clear cache for default mid |
| 323 | - if($args->site_srl == 0) $vid=''; |
|
| 324 | - else $vid=$args->domain; |
|
| 346 | + if($args->site_srl == 0) { |
|
| 347 | + $vid=''; |
|
| 348 | + } else { |
|
| 349 | + $vid=$args->domain; |
|
| 350 | + } |
|
| 325 | 351 | |
| 326 | 352 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl); |
| 327 | 353 | $mid = $module_info->mid; |
@@ -345,7 +371,9 @@ discard block |
||
| 345 | 371 | unset($args->act); |
| 346 | 372 | unset($args->page); |
| 347 | 373 | // Test mid value |
| 348 | - if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 374 | + if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) { |
|
| 375 | + return new Object(-1, 'msg_limit_mid'); |
|
| 376 | + } |
|
| 349 | 377 | // Test variables (separate basic vars and other vars in modules) |
| 350 | 378 | $extra_vars = clone($args); |
| 351 | 379 | unset($extra_vars->module_srl); |
@@ -382,18 +410,23 @@ discard block |
||
| 382 | 410 | if(isset($args->isMenuCreate)) |
| 383 | 411 | { |
| 384 | 412 | $isMenuCreate = $args->isMenuCreate; |
| 385 | - } |
|
| 386 | - else |
|
| 413 | + } else |
|
| 387 | 414 | { |
| 388 | 415 | $isMenuCreate = TRUE; |
| 389 | 416 | } |
| 390 | 417 | |
| 391 | 418 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 392 | - if(!$output->toBool()) return $output; |
|
| 419 | + if(!$output->toBool()) { |
|
| 420 | + return $output; |
|
| 421 | + } |
|
| 393 | 422 | // Check whether the module name already exists |
| 394 | - if(!$args->site_srl) $args->site_srl = 0; |
|
| 423 | + if(!$args->site_srl) { |
|
| 424 | + $args->site_srl = 0; |
|
| 425 | + } |
|
| 395 | 426 | $oModuleModel = getModel('module'); |
| 396 | - if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); |
|
| 427 | + if($oModuleModel->isIDExists($args->mid, $args->site_srl)) { |
|
| 428 | + return new Object(-1, 'msg_module_name_exists'); |
|
| 429 | + } |
|
| 397 | 430 | |
| 398 | 431 | // begin transaction |
| 399 | 432 | $oDB = &DB::getInstance(); |
@@ -404,20 +437,20 @@ discard block |
||
| 404 | 437 | $skin_vars = new stdClass(); |
| 405 | 438 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
| 406 | 439 | // Arrange variables and then execute a query |
| 407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
| 440 | + if(!$args->module_srl) { |
|
| 441 | + $args->module_srl = getNextSequence(); |
|
| 442 | + } |
|
| 408 | 443 | |
| 409 | 444 | // default value |
| 410 | 445 | if($args->skin == '/USE_DEFAULT/') |
| 411 | 446 | { |
| 412 | 447 | $args->is_skin_fix = 'N'; |
| 413 | - } |
|
| 414 | - else |
|
| 448 | + } else |
|
| 415 | 449 | { |
| 416 | 450 | if(isset($args->is_skin_fix)) |
| 417 | 451 | { |
| 418 | 452 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 419 | - } |
|
| 420 | - else |
|
| 453 | + } else |
|
| 421 | 454 | { |
| 422 | 455 | $args->is_skin_fix = 'Y'; |
| 423 | 456 | } |
@@ -426,14 +459,12 @@ discard block |
||
| 426 | 459 | if($args->mskin == '/USE_DEFAULT/') |
| 427 | 460 | { |
| 428 | 461 | $args->is_mskin_fix = 'N'; |
| 429 | - } |
|
| 430 | - else |
|
| 462 | + } else |
|
| 431 | 463 | { |
| 432 | 464 | if(isset($args->is_mskin_fix)) |
| 433 | 465 | { |
| 434 | 466 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 435 | - } |
|
| 436 | - else |
|
| 467 | + } else |
|
| 437 | 468 | { |
| 438 | 469 | $args->is_mskin_fix = 'Y'; |
| 439 | 470 | } |
@@ -508,7 +539,9 @@ discard block |
||
| 508 | 539 | function updateModule($args) |
| 509 | 540 | { |
| 510 | 541 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
| 511 | - if(!$output->toBool()) return $output; |
|
| 542 | + if(!$output->toBool()) { |
|
| 543 | + return $output; |
|
| 544 | + } |
|
| 512 | 545 | // begin transaction |
| 513 | 546 | $oDB = &DB::getInstance(); |
| 514 | 547 | $oDB->begin(); |
@@ -519,8 +552,12 @@ discard block |
||
| 519 | 552 | |
| 520 | 553 | if(!$args->site_srl || !$args->browser_title) |
| 521 | 554 | { |
| 522 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
| 523 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
| 555 | + if(!$args->site_srl) { |
|
| 556 | + $args->site_srl = (int)$module_info->site_srl; |
|
| 557 | + } |
|
| 558 | + if(!$args->browser_title) { |
|
| 559 | + $args->browser_title = $module_info->browser_title; |
|
| 560 | + } |
|
| 524 | 561 | } |
| 525 | 562 | |
| 526 | 563 | $args->browser_title = strip_tags($args->browser_title); |
@@ -536,14 +573,12 @@ discard block |
||
| 536 | 573 | if($args->skin == '/USE_DEFAULT/') |
| 537 | 574 | { |
| 538 | 575 | $args->is_skin_fix = 'N'; |
| 539 | - } |
|
| 540 | - else |
|
| 576 | + } else |
|
| 541 | 577 | { |
| 542 | 578 | if(isset($args->is_skin_fix)) |
| 543 | 579 | { |
| 544 | 580 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
| 545 | - } |
|
| 546 | - else |
|
| 581 | + } else |
|
| 547 | 582 | { |
| 548 | 583 | $args->is_skin_fix = 'Y'; |
| 549 | 584 | } |
@@ -552,14 +587,12 @@ discard block |
||
| 552 | 587 | if($args->mskin == '/USE_DEFAULT/') |
| 553 | 588 | { |
| 554 | 589 | $args->is_mskin_fix = 'N'; |
| 555 | - } |
|
| 556 | - else |
|
| 590 | + } else |
|
| 557 | 591 | { |
| 558 | 592 | if(isset($args->is_mskin_fix)) |
| 559 | 593 | { |
| 560 | 594 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
| 561 | - } |
|
| 562 | - else |
|
| 595 | + } else |
|
| 563 | 596 | { |
| 564 | 597 | $args->is_mskin_fix = 'Y'; |
| 565 | 598 | } |
@@ -625,7 +658,9 @@ discard block |
||
| 625 | 658 | $args->update_id = $update_id; |
| 626 | 659 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
| 627 | 660 | |
| 628 | - if(!!$output->error) return false; |
|
| 661 | + if(!!$output->error) { |
|
| 662 | + return false; |
|
| 663 | + } |
|
| 629 | 664 | |
| 630 | 665 | return true; |
| 631 | 666 | } |
@@ -640,7 +675,9 @@ discard block |
||
| 640 | 675 | $args->site_srl = $site_srl; |
| 641 | 676 | $args->layout_srl = $layout_srl; |
| 642 | 677 | $output = executeQuery('module.updateModuleSite', $args); |
| 643 | - if(!$output->toBool()) return $output; |
|
| 678 | + if(!$output->toBool()) { |
|
| 679 | + return $output; |
|
| 680 | + } |
|
| 644 | 681 | |
| 645 | 682 | //remove from cache |
| 646 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -659,7 +696,9 @@ discard block |
||
| 659 | 696 | */ |
| 660 | 697 | function deleteModule($module_srl, $site_srl = 0) |
| 661 | 698 | { |
| 662 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 699 | + if(!$module_srl) { |
|
| 700 | + return new Object(-1,'msg_invalid_request'); |
|
| 701 | + } |
|
| 663 | 702 | |
| 664 | 703 | $site_module_info = Context::get('site_module_info'); |
| 665 | 704 | |
@@ -669,8 +708,11 @@ discard block |
||
| 669 | 708 | $args = new stdClass(); |
| 670 | 709 | $args->url = $output->mid; |
| 671 | 710 | $args->is_shortcut = 'N'; |
| 672 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
| 673 | - else $args->site_srl = $site_srl; |
|
| 711 | + if(!$site_srl) { |
|
| 712 | + $args->site_srl = $site_module_info->site_srl; |
|
| 713 | + } else { |
|
| 714 | + $args->site_srl = $site_srl; |
|
| 715 | + } |
|
| 674 | 716 | |
| 675 | 717 | unset($output); |
| 676 | 718 | |
@@ -703,8 +745,7 @@ discard block |
||
| 703 | 745 | if($output->isSuccess) |
| 704 | 746 | { |
| 705 | 747 | return new Object(0, 'success_deleted'); |
| 706 | - } |
|
| 707 | - else |
|
| 748 | + } else |
|
| 708 | 749 | { |
| 709 | 750 | return new Object($output->error, $output->message); |
| 710 | 751 | } |
@@ -722,19 +763,25 @@ discard block |
||
| 722 | 763 | */ |
| 723 | 764 | public function onlyDeleteModule($module_srl) |
| 724 | 765 | { |
| 725 | - if(!$module_srl) return new Object(-1,'msg_invalid_request'); |
|
| 766 | + if(!$module_srl) { |
|
| 767 | + return new Object(-1,'msg_invalid_request'); |
|
| 768 | + } |
|
| 726 | 769 | |
| 727 | 770 | // check start module |
| 728 | 771 | $oModuleModel = getModel('module'); |
| 729 | 772 | $columnList = array('sites.index_module_srl'); |
| 730 | 773 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
| 731 | - if($module_srl == $start_module->index_module_srl) return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 774 | + if($module_srl == $start_module->index_module_srl) { |
|
| 775 | + return new Object(-1, 'msg_cannot_delete_startmodule'); |
|
| 776 | + } |
|
| 732 | 777 | |
| 733 | 778 | // Call a trigger (before) |
| 734 | 779 | $trigger_obj = new stdClass(); |
| 735 | 780 | $trigger_obj->module_srl = $module_srl; |
| 736 | 781 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
| 737 | - if(!$output->toBool()) return $output; |
|
| 782 | + if(!$output->toBool()) { |
|
| 783 | + return $output; |
|
| 784 | + } |
|
| 738 | 785 | |
| 739 | 786 | // begin transaction |
| 740 | 787 | $oDB = &DB::getInstance(); |
@@ -795,7 +842,9 @@ discard block |
||
| 795 | 842 | function clearDefaultModule() |
| 796 | 843 | { |
| 797 | 844 | $output = executeQuery('module.clearDefaultModule'); |
| 798 | - if(!$output->toBool()) return $output; |
|
| 845 | + if(!$output->toBool()) { |
|
| 846 | + return $output; |
|
| 847 | + } |
|
| 799 | 848 | |
| 800 | 849 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 801 | 850 | if($oCacheHandler->isSupport()) |
@@ -827,7 +876,9 @@ discard block |
||
| 827 | 876 | */ |
| 828 | 877 | function updateModuleLayout($layout_srl, $menu_srl_list) |
| 829 | 878 | { |
| 830 | - if(!count($menu_srl_list)) return; |
|
| 879 | + if(!count($menu_srl_list)) { |
|
| 880 | + return; |
|
| 881 | + } |
|
| 831 | 882 | |
| 832 | 883 | $args = new stdClass; |
| 833 | 884 | $args->layout_srl = $layout_srl; |
@@ -854,28 +905,37 @@ discard block |
||
| 854 | 905 | |
| 855 | 906 | $output = executeQuery('module.deleteSiteAdmin', $args); |
| 856 | 907 | |
| 857 | - if(!$output->toBool()) return $output; |
|
| 908 | + if(!$output->toBool()) { |
|
| 909 | + return $output; |
|
| 910 | + } |
|
| 858 | 911 | // Get user id of an administrator |
| 859 | - if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); |
|
| 912 | + if(!is_array($arr_admins) || !count($arr_admins)) { |
|
| 913 | + return new Object(); |
|
| 914 | + } |
|
| 860 | 915 | foreach($arr_admins as $key => $user_id) |
| 861 | 916 | { |
| 862 | - if(!trim($user_id)) continue; |
|
| 917 | + if(!trim($user_id)) { |
|
| 918 | + continue; |
|
| 919 | + } |
|
| 863 | 920 | $admins[] = trim($user_id); |
| 864 | 921 | } |
| 865 | - if(!count($admins)) return new Object(); |
|
| 922 | + if(!count($admins)) { |
|
| 923 | + return new Object(); |
|
| 924 | + } |
|
| 866 | 925 | |
| 867 | 926 | $oMemberModel = getModel('member'); |
| 868 | 927 | $member_config = $oMemberModel->getMemberConfig(); |
| 869 | 928 | if($member_config->identifier == 'email_address') |
| 870 | 929 | { |
| 871 | 930 | $args->email_address = '\''.implode('\',\'',$admins).'\''; |
| 872 | - } |
|
| 873 | - else |
|
| 931 | + } else |
|
| 874 | 932 | { |
| 875 | 933 | $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
| 876 | 934 | } |
| 877 | 935 | $output = executeQueryArray('module.getAdminSrls', $args); |
| 878 | - if(!$output->toBool()||!$output->data) return $output; |
|
| 936 | + if(!$output->toBool()||!$output->data) { |
|
| 937 | + return $output; |
|
| 938 | + } |
|
| 879 | 939 | |
| 880 | 940 | foreach($output->data as $key => $val) |
| 881 | 941 | { |
@@ -884,7 +944,9 @@ discard block |
||
| 884 | 944 | $args->site_srl = $site_srl; |
| 885 | 945 | $args->member_srl = $val->member_srl; |
| 886 | 946 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
| 887 | - if(!$output->toBool()) return $output; |
|
| 947 | + if(!$output->toBool()) { |
|
| 948 | + return $output; |
|
| 949 | + } |
|
| 888 | 950 | } |
| 889 | 951 | return new Object(); |
| 890 | 952 | } |
@@ -897,12 +959,15 @@ discard block |
||
| 897 | 959 | $oMemberModel = getModel('member'); |
| 898 | 960 | $member_config = $oMemberModel->getMemberConfig(); |
| 899 | 961 | |
| 900 | - if($member_config->identifier == 'email_address') |
|
| 901 | - $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
| 902 | - else |
|
| 903 | - $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
| 962 | + if($member_config->identifier == 'email_address') { |
|
| 963 | + $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
| 964 | + } else { |
|
| 965 | + $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
| 966 | + } |
|
| 904 | 967 | |
| 905 | - if(!$member_info->member_srl) return; |
|
| 968 | + if(!$member_info->member_srl) { |
|
| 969 | + return; |
|
| 970 | + } |
|
| 906 | 971 | $args = new stdClass(); |
| 907 | 972 | $args->module_srl = $module_srl; |
| 908 | 973 | $args->member_srl = $member_info->member_srl; |
@@ -921,7 +986,9 @@ discard block |
||
| 921 | 986 | { |
| 922 | 987 | $oMemberModel = getModel('member'); |
| 923 | 988 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
| 924 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
| 989 | + if($member_info->member_srl) { |
|
| 990 | + $args->member_srl = $member_info->member_srl; |
|
| 991 | + } |
|
| 925 | 992 | } |
| 926 | 993 | return executeQuery('module.deleteAdminId', $args); |
| 927 | 994 | } |
@@ -965,7 +1032,9 @@ discard block |
||
| 965 | 1032 | } |
| 966 | 1033 | |
| 967 | 1034 | getDestroyXeVars($obj); |
| 968 | - if(!$obj || !count($obj)) return new Object(); |
|
| 1035 | + if(!$obj || !count($obj)) { |
|
| 1036 | + return new Object(); |
|
| 1037 | + } |
|
| 969 | 1038 | |
| 970 | 1039 | $args = new stdClass; |
| 971 | 1040 | $args->module_srl = $module_srl; |
@@ -975,18 +1044,23 @@ discard block |
||
| 975 | 1044 | // it often saved menu item(stdClass) on the skin info column |
| 976 | 1045 | // When updating the module on XE core 1.2.0 later versions, it occurs an error |
| 977 | 1046 | // fixed the error |
| 978 | - if (is_object($val)) continue; |
|
| 979 | - if (is_array($val)) $val = serialize($val); |
|
| 1047 | + if (is_object($val)) { |
|
| 1048 | + continue; |
|
| 1049 | + } |
|
| 1050 | + if (is_array($val)) { |
|
| 1051 | + $val = serialize($val); |
|
| 1052 | + } |
|
| 980 | 1053 | |
| 981 | 1054 | $args->name = trim($key); |
| 982 | 1055 | $args->value = trim($val); |
| 983 | - if(!$args->name || !$args->value) continue; |
|
| 1056 | + if(!$args->name || !$args->value) { |
|
| 1057 | + continue; |
|
| 1058 | + } |
|
| 984 | 1059 | |
| 985 | 1060 | if($mode === 'P') |
| 986 | 1061 | { |
| 987 | 1062 | $output = executeQuery('module.insertModuleSkinVars', $args); |
| 988 | - } |
|
| 989 | - else |
|
| 1063 | + } else |
|
| 990 | 1064 | { |
| 991 | 1065 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
| 992 | 1066 | } |
@@ -1033,8 +1107,7 @@ discard block |
||
| 1033 | 1107 | { |
| 1034 | 1108 | $object_key = 'module_skin_vars:'.$module_srl; |
| 1035 | 1109 | $query = 'module.deleteModuleSkinVars'; |
| 1036 | - } |
|
| 1037 | - else |
|
| 1110 | + } else |
|
| 1038 | 1111 | { |
| 1039 | 1112 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
| 1040 | 1113 | $query = 'module.deleteModuleMobileSkinVars'; |
@@ -1058,17 +1131,23 @@ discard block |
||
| 1058 | 1131 | { |
| 1059 | 1132 | $this->deleteModuleExtraVars($module_srl); |
| 1060 | 1133 | getDestroyXeVars($obj); |
| 1061 | - if(!$obj || !count($obj)) return; |
|
| 1134 | + if(!$obj || !count($obj)) { |
|
| 1135 | + return; |
|
| 1136 | + } |
|
| 1062 | 1137 | |
| 1063 | 1138 | foreach($obj as $key => $val) |
| 1064 | 1139 | { |
| 1065 | - if(is_object($val) || is_array($val)) continue; |
|
| 1140 | + if(is_object($val) || is_array($val)) { |
|
| 1141 | + continue; |
|
| 1142 | + } |
|
| 1066 | 1143 | |
| 1067 | 1144 | $args = new stdClass(); |
| 1068 | 1145 | $args->module_srl = $module_srl; |
| 1069 | 1146 | $args->name = trim($key); |
| 1070 | 1147 | $args->value = trim($val); |
| 1071 | - if(!$args->name || !$args->value) continue; |
|
| 1148 | + if(!$args->name || !$args->value) { |
|
| 1149 | + continue; |
|
| 1150 | + } |
|
| 1072 | 1151 | $output = executeQuery('module.insertModuleExtraVars', $args); |
| 1073 | 1152 | } |
| 1074 | 1153 | |
@@ -1108,11 +1187,15 @@ discard block |
||
| 1108 | 1187 | function insertModuleGrants($module_srl, $obj) |
| 1109 | 1188 | { |
| 1110 | 1189 | $this->deleteModuleGrants($module_srl); |
| 1111 | - if(!$obj || !count($obj)) return; |
|
| 1190 | + if(!$obj || !count($obj)) { |
|
| 1191 | + return; |
|
| 1192 | + } |
|
| 1112 | 1193 | |
| 1113 | 1194 | foreach($obj as $name => $val) |
| 1114 | 1195 | { |
| 1115 | - if(!$val || !count($val)) continue; |
|
| 1196 | + if(!$val || !count($val)) { |
|
| 1197 | + continue; |
|
| 1198 | + } |
|
| 1116 | 1199 | |
| 1117 | 1200 | foreach($val as $group_srl) |
| 1118 | 1201 | { |
@@ -1120,7 +1203,9 @@ discard block |
||
| 1120 | 1203 | $args->module_srl = $module_srl; |
| 1121 | 1204 | $args->name = $name; |
| 1122 | 1205 | $args->group_srl = trim($group_srl); |
| 1123 | - if(!$args->name || !$args->group_srl) continue; |
|
| 1206 | + if(!$args->name || !$args->group_srl) { |
|
| 1207 | + continue; |
|
| 1208 | + } |
|
| 1124 | 1209 | executeQuery('module.insertModuleGrant', $args); |
| 1125 | 1210 | } |
| 1126 | 1211 | } |
@@ -1180,7 +1265,9 @@ discard block |
||
| 1180 | 1265 | require_once($cache_file); |
| 1181 | 1266 | } |
| 1182 | 1267 | } |
| 1183 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
| 1268 | + if(!Context::get($matches[1]) && $lang[$matches[1]]) { |
|
| 1269 | + return $lang[$matches[1]]; |
|
| 1270 | + } |
|
| 1184 | 1271 | |
| 1185 | 1272 | return str_replace('$user_lang->','',$matches[0]); |
| 1186 | 1273 | } |
@@ -1192,10 +1279,14 @@ discard block |
||
| 1192 | 1279 | function procModuleFileBoxAdd() |
| 1193 | 1280 | { |
| 1194 | 1281 | $ajax = Context::get('ajax'); |
| 1195 | - if ($ajax) Context::setRequestMethod('JSON'); |
|
| 1282 | + if ($ajax) { |
|
| 1283 | + Context::setRequestMethod('JSON'); |
|
| 1284 | + } |
|
| 1196 | 1285 | |
| 1197 | 1286 | $logged_info = Context::get('logged_info'); |
| 1198 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1287 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 1288 | + return new Object(-1, 'msg_not_permitted'); |
|
| 1289 | + } |
|
| 1199 | 1290 | |
| 1200 | 1291 | $vars = Context::gets('addfile','filter'); |
| 1201 | 1292 | $attributeNames = Context::get('attribute_name'); |
@@ -1219,9 +1310,14 @@ discard block |
||
| 1219 | 1310 | |
| 1220 | 1311 | $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
| 1221 | 1312 | $vars->ext = $ext; |
| 1222 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
| 1223 | - else $filter = array('jpg','jpeg','gif','png'); |
|
| 1224 | - if(!in_array($ext,$filter)) return new Object(-1, 'msg_error_occured'); |
|
| 1313 | + if($vars->filter) { |
|
| 1314 | + $filter = explode(',',$vars->filter); |
|
| 1315 | + } else { |
|
| 1316 | + $filter = array('jpg','jpeg','gif','png'); |
|
| 1317 | + } |
|
| 1318 | + if(!in_array($ext,$filter)) { |
|
| 1319 | + return new Object(-1, 'msg_error_occured'); |
|
| 1320 | + } |
|
| 1225 | 1321 | |
| 1226 | 1322 | $vars->member_srl = $logged_info->member_srl; |
| 1227 | 1323 | |
@@ -1234,10 +1330,16 @@ discard block |
||
| 1234 | 1330 | // insert |
| 1235 | 1331 | else |
| 1236 | 1332 | { |
| 1237 | - if(!Context::isUploaded()) return new Object(-1, 'msg_error_occured'); |
|
| 1333 | + if(!Context::isUploaded()) { |
|
| 1334 | + return new Object(-1, 'msg_error_occured'); |
|
| 1335 | + } |
|
| 1238 | 1336 | $addfile = Context::get('addfile'); |
| 1239 | - if(!is_uploaded_file($addfile['tmp_name'])) return new Object(-1, 'msg_error_occured'); |
|
| 1240 | - if($vars->addfile['error'] != 0) return new Object(-1, 'msg_error_occured'); |
|
| 1337 | + if(!is_uploaded_file($addfile['tmp_name'])) { |
|
| 1338 | + return new Object(-1, 'msg_error_occured'); |
|
| 1339 | + } |
|
| 1340 | + if($vars->addfile['error'] != 0) { |
|
| 1341 | + return new Object(-1, 'msg_error_occured'); |
|
| 1342 | + } |
|
| 1241 | 1343 | $output = $this->insertModuleFileBox($vars); |
| 1242 | 1344 | } |
| 1243 | 1345 | |
@@ -1248,11 +1350,13 @@ discard block |
||
| 1248 | 1350 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); |
| 1249 | 1351 | $this->setRedirectUrl($returnUrl); |
| 1250 | 1352 | return; |
| 1251 | - } |
|
| 1252 | - else |
|
| 1353 | + } else |
|
| 1253 | 1354 | { |
| 1254 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
| 1255 | - else $this->add('save_filename', ''); |
|
| 1355 | + if($output) { |
|
| 1356 | + $this->add('save_filename', $output->get('save_filename')); |
|
| 1357 | + } else { |
|
| 1358 | + $this->add('save_filename', ''); |
|
| 1359 | + } |
|
| 1256 | 1360 | } |
| 1257 | 1361 | } |
| 1258 | 1362 | |
@@ -1276,7 +1380,9 @@ discard block |
||
| 1276 | 1380 | $tmp = $vars->addfile['tmp_name']; |
| 1277 | 1381 | |
| 1278 | 1382 | // Check uploaded file |
| 1279 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1383 | + if(!checkUploadedFile($tmp)) { |
|
| 1384 | + return false; |
|
| 1385 | + } |
|
| 1280 | 1386 | |
| 1281 | 1387 | if(!@move_uploaded_file($tmp, $save_filename)) |
| 1282 | 1388 | { |
@@ -1313,7 +1419,9 @@ discard block |
||
| 1313 | 1419 | $tmp = $vars->addfile['tmp_name']; |
| 1314 | 1420 | |
| 1315 | 1421 | // Check uploaded file |
| 1316 | - if(!checkUploadedFile($tmp)) return false; |
|
| 1422 | + if(!checkUploadedFile($tmp)) { |
|
| 1423 | + return false; |
|
| 1424 | + } |
|
| 1317 | 1425 | |
| 1318 | 1426 | // upload |
| 1319 | 1427 | if(!@move_uploaded_file($tmp, $save_filename)) |
@@ -1342,14 +1450,20 @@ discard block |
||
| 1342 | 1450 | function procModuleFileBoxDelete() |
| 1343 | 1451 | { |
| 1344 | 1452 | $logged_info = Context::get('logged_info'); |
| 1345 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); |
|
| 1453 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
| 1454 | + return new Object(-1, 'msg_not_permitted'); |
|
| 1455 | + } |
|
| 1346 | 1456 | |
| 1347 | 1457 | $module_filebox_srl = Context::get('module_filebox_srl'); |
| 1348 | - if(!$module_filebox_srl) return new Object(-1, 'msg_invalid_request'); |
|
| 1458 | + if(!$module_filebox_srl) { |
|
| 1459 | + return new Object(-1, 'msg_invalid_request'); |
|
| 1460 | + } |
|
| 1349 | 1461 | $vars = new stdClass(); |
| 1350 | 1462 | $vars->module_filebox_srl = $module_filebox_srl; |
| 1351 | 1463 | $output = $this->deleteModuleFileBox($vars); |
| 1352 | - if(!$output->toBool()) return $output; |
|
| 1464 | + if(!$output->toBool()) { |
|
| 1465 | + return $output; |
|
| 1466 | + } |
|
| 1353 | 1467 | } |
| 1354 | 1468 | |
| 1355 | 1469 | function deleteModuleFileBox($vars) |
@@ -1372,9 +1486,13 @@ discard block |
||
| 1372 | 1486 | $this->unlockTimeoutPassed(); |
| 1373 | 1487 | $args = new stdClass; |
| 1374 | 1488 | $args->lock_name = $lock_name; |
| 1375 | - if(!$timeout) $timeout = 60; |
|
| 1489 | + if(!$timeout) { |
|
| 1490 | + $timeout = 60; |
|
| 1491 | + } |
|
| 1376 | 1492 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
| 1377 | - if($member_srl) $args->member_srl = $member_srl; |
|
| 1493 | + if($member_srl) { |
|
| 1494 | + $args->member_srl = $member_srl; |
|
| 1495 | + } |
|
| 1378 | 1496 | $output = executeQuery('module.insertLock', $args); |
| 1379 | 1497 | if($output->toBool()) |
| 1380 | 1498 | { |
@@ -1035,6 +1035,7 @@ discard block |
||
| 1035 | 1035 | /** |
| 1036 | 1036 | * @brief Get a list of skins for the module |
| 1037 | 1037 | * Return file analysis of skin and skin.xml |
| 1038 | + * @param string $path |
|
| 1038 | 1039 | */ |
| 1039 | 1040 | function getSkins($path, $dir = 'skins') |
| 1040 | 1041 | { |
@@ -1359,6 +1360,8 @@ discard block |
||
| 1359 | 1360 | /** |
| 1360 | 1361 | * @brief Return module configurations |
| 1361 | 1362 | * Global configuration is used to manage board, member and others |
| 1363 | + * @param string $module |
|
| 1364 | + * @return string |
|
| 1362 | 1365 | */ |
| 1363 | 1366 | function getModuleConfig($module, $site_srl = 0) |
| 1364 | 1367 | { |
@@ -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); |
@@ -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); |
@@ -129,6 +129,8 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * @brief Save the file and return if a file is requested by http |
| 132 | + * @param integer $caching_interval |
|
| 133 | + * @param string $cache_file |
|
| 132 | 134 | */ |
| 133 | 135 | function getHtmlPage($path, $caching_interval, $cache_file) |
| 134 | 136 | { |
@@ -167,6 +169,8 @@ discard block |
||
| 167 | 169 | |
| 168 | 170 | /** |
| 169 | 171 | * @brief Create a cache file in order to include if it is an internal file |
| 172 | + * @param integer $caching_interval |
|
| 173 | + * @param string $cache_file |
|
| 170 | 174 | */ |
| 171 | 175 | function executeFile($target_file, $caching_interval, $cache_file) |
| 172 | 176 | { |
@@ -46,12 +46,17 @@ discard block |
||
| 46 | 46 | function dispPageIndex() |
| 47 | 47 | { |
| 48 | 48 | // Variables used in the template Context:: set() |
| 49 | - if($this->module_srl) Context::set('module_srl',$this->module_srl); |
|
| 49 | + if($this->module_srl) { |
|
| 50 | + Context::set('module_srl',$this->module_srl); |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | $page_type_name = strtolower($this->module_info->page_type); |
| 52 | 54 | $method = '_get' . ucfirst($page_type_name) . 'Content'; |
| 53 | - if(method_exists($this, $method)) $page_content = $this->{$method}(); |
|
| 54 | - else return new Object(-1, sprintf('%s method is not exists', $method)); |
|
| 55 | + if(method_exists($this, $method)) { |
|
| 56 | + $page_content = $this->{$method}(); |
|
| 57 | + } else { |
|
| 58 | + return new Object(-1, sprintf('%s method is not exists', $method)); |
|
| 59 | + } |
|
| 55 | 60 | |
| 56 | 61 | Context::set('module_info', $this->module_info); |
| 57 | 62 | Context::set('page_content', $page_content); |
@@ -63,24 +68,27 @@ discard block |
||
| 63 | 68 | { |
| 64 | 69 | if($this->interval>0) |
| 65 | 70 | { |
| 66 | - if(!file_exists($this->cache_file)) $mtime = 0; |
|
| 67 | - else $mtime = filemtime($this->cache_file); |
|
| 71 | + if(!file_exists($this->cache_file)) { |
|
| 72 | + $mtime = 0; |
|
| 73 | + } else { |
|
| 74 | + $mtime = filemtime($this->cache_file); |
|
| 75 | + } |
|
| 68 | 76 | |
| 69 | 77 | if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) |
| 70 | 78 | { |
| 71 | 79 | $page_content = FileHandler::readFile($this->cache_file); |
| 72 | 80 | $page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content); |
| 73 | - } |
|
| 74 | - else |
|
| 81 | + } else |
|
| 75 | 82 | { |
| 76 | 83 | $oWidgetController = getController('widget'); |
| 77 | 84 | $page_content = $oWidgetController->transWidgetCode($this->module_info->content); |
| 78 | 85 | FileHandler::writeFile($this->cache_file, $page_content); |
| 79 | 86 | } |
| 80 | - } |
|
| 81 | - else |
|
| 87 | + } else |
|
| 82 | 88 | { |
| 83 | - if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
| 89 | + if(file_exists($this->cache_file)) { |
|
| 90 | + FileHandler::removeFile($this->cache_file); |
|
| 91 | + } |
|
| 84 | 92 | $page_content = $this->module_info->content; |
| 85 | 93 | } |
| 86 | 94 | return $page_content; |
@@ -104,8 +112,7 @@ discard block |
||
| 104 | 112 | if ($this->module_info->skin) |
| 105 | 113 | { |
| 106 | 114 | $templatePath = (sprintf($this->module_path.'skins/%s', $this->module_info->skin)); |
| 107 | - } |
|
| 108 | - else |
|
| 115 | + } else |
|
| 109 | 116 | { |
| 110 | 117 | $templatePath = ($this->module_path.'skins/default'); |
| 111 | 118 | } |
@@ -120,8 +127,11 @@ discard block |
||
| 120 | 127 | // check if it is http or internal file |
| 121 | 128 | if($this->path) |
| 122 | 129 | { |
| 123 | - if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
| 124 | - else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
|
| 130 | + if(preg_match("/^([a-z]+):\/\//i",$this->path)) { |
|
| 131 | + $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
| 132 | + } else { |
|
| 133 | + $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
|
| 134 | + } |
|
| 125 | 135 | } |
| 126 | 136 | |
| 127 | 137 | return $content; |
@@ -136,8 +146,7 @@ discard block |
||
| 136 | 146 | if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME']) |
| 137 | 147 | { |
| 138 | 148 | $content = FileHandler::readFile($cache_file); |
| 139 | - } |
|
| 140 | - else |
|
| 149 | + } else |
|
| 141 | 150 | { |
| 142 | 151 | FileHandler::getRemoteFile($path, $cache_file); |
| 143 | 152 | $content = FileHandler::readFile($cache_file); |
@@ -154,13 +163,19 @@ discard block |
||
| 154 | 163 | $content = $buff->content; |
| 155 | 164 | // Extract a title |
| 156 | 165 | $title = $oPageController->getTitle($content); |
| 157 | - if($title) Context::setBrowserTitle($title); |
|
| 166 | + if($title) { |
|
| 167 | + Context::setBrowserTitle($title); |
|
| 168 | + } |
|
| 158 | 169 | // Extract header script |
| 159 | 170 | $head_script = $oPageController->getHeadScript($content); |
| 160 | - if($head_script) Context::addHtmlHeader($head_script); |
|
| 171 | + if($head_script) { |
|
| 172 | + Context::addHtmlHeader($head_script); |
|
| 173 | + } |
|
| 161 | 174 | // Extract content from the body |
| 162 | 175 | $body_script = $oPageController->getBodyScript($content); |
| 163 | - if(!$body_script) $body_script = $content; |
|
| 176 | + if(!$body_script) { |
|
| 177 | + $body_script = $content; |
|
| 178 | + } |
|
| 164 | 179 | |
| 165 | 180 | return $content; |
| 166 | 181 | } |
@@ -171,7 +186,9 @@ discard block |
||
| 171 | 186 | function executeFile($target_file, $caching_interval, $cache_file) |
| 172 | 187 | { |
| 173 | 188 | // Cancel if the file doesn't exist |
| 174 | - if(!file_exists(FileHandler::getRealPath($target_file))) return; |
|
| 189 | + if(!file_exists(FileHandler::getRealPath($target_file))) { |
|
| 190 | + return; |
|
| 191 | + } |
|
| 175 | 192 | |
| 176 | 193 | // Get a path and filename |
| 177 | 194 | $tmp_path = explode('/',$cache_file); |
@@ -183,7 +200,9 @@ discard block |
||
| 183 | 200 | // Verify cache |
| 184 | 201 | if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file)) |
| 185 | 202 | { |
| 186 | - if(file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
| 203 | + if(file_exists($cache_file)) { |
|
| 204 | + FileHandler::removeFile($cache_file); |
|
| 205 | + } |
|
| 187 | 206 | |
| 188 | 207 | // Read a target file and get content |
| 189 | 208 | ob_start(); |
@@ -196,7 +215,9 @@ discard block |
||
| 196 | 215 | |
| 197 | 216 | FileHandler::writeFile($cache_file, $content); |
| 198 | 217 | // Include and then Return the result |
| 199 | - if(!file_exists($cache_file)) return; |
|
| 218 | + if(!file_exists($cache_file)) { |
|
| 219 | + return; |
|
| 220 | + } |
|
| 200 | 221 | // Attempt to compile |
| 201 | 222 | $oTemplate = &TemplateHandler::getInstance(); |
| 202 | 223 | $script = $oTemplate->compileDirect($filepath, $filename); |
@@ -227,14 +248,15 @@ discard block |
||
| 227 | 248 | { |
| 228 | 249 | return $matches[0]; |
| 229 | 250 | // In case of .. , get a path |
| 230 | - } |
|
| 231 | - else if(strncasecmp('..', $val, 2) === 0) |
|
| 251 | + } else if(strncasecmp('..', $val, 2) === 0) |
|
| 232 | 252 | { |
| 233 | 253 | $p = Context::pathToUrl($this->path); |
| 234 | 254 | return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
| 235 | 255 | } |
| 236 | 256 | |
| 237 | - if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); |
|
| 257 | + if(strncasecmp('..', $val, 2) === 0) { |
|
| 258 | + $val = substr($val,2); |
|
| 259 | + } |
|
| 238 | 260 | $p = Context::pathToUrl($this->path); |
| 239 | 261 | $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
| 240 | 262 | |
@@ -22,18 +22,18 @@ discard block |
||
| 22 | 22 | // Get a template path (page in the administrative template tpl putting together) |
| 23 | 23 | $this->setTemplatePath($this->module_path.'tpl'); |
| 24 | 24 | |
| 25 | - switch($this->module_info->page_type) |
|
| 25 | + switch ($this->module_info->page_type) |
|
| 26 | 26 | { |
| 27 | 27 | case 'WIDGET' : |
| 28 | 28 | { |
| 29 | 29 | $this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus()); |
| 30 | - $this->interval = (int)($this->module_info->page_caching_interval); |
|
| 30 | + $this->interval = (int) ($this->module_info->page_caching_interval); |
|
| 31 | 31 | break; |
| 32 | 32 | } |
| 33 | 33 | case 'OUTSIDE' : |
| 34 | 34 | { |
| 35 | 35 | $this->cache_file = sprintf("%sfiles/cache/opage/%d.%s.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getSslStatus()); |
| 36 | - $this->interval = (int)($this->module_info->page_caching_interval); |
|
| 36 | + $this->interval = (int) ($this->module_info->page_caching_interval); |
|
| 37 | 37 | $this->path = $this->module_info->path; |
| 38 | 38 | break; |
| 39 | 39 | } |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | function dispPageIndex() |
| 47 | 47 | { |
| 48 | 48 | // Variables used in the template Context:: set() |
| 49 | - if($this->module_srl) Context::set('module_srl',$this->module_srl); |
|
| 49 | + if ($this->module_srl) Context::set('module_srl', $this->module_srl); |
|
| 50 | 50 | |
| 51 | 51 | $page_type_name = strtolower($this->module_info->page_type); |
| 52 | - $method = '_get' . ucfirst($page_type_name) . 'Content'; |
|
| 53 | - if(method_exists($this, $method)) $page_content = $this->{$method}(); |
|
| 52 | + $method = '_get'.ucfirst($page_type_name).'Content'; |
|
| 53 | + if (method_exists($this, $method)) $page_content = $this->{$method}(); |
|
| 54 | 54 | else return new Object(-1, sprintf('%s method is not exists', $method)); |
| 55 | 55 | |
| 56 | 56 | Context::set('module_info', $this->module_info); |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | function _getWidgetContent() |
| 63 | 63 | { |
| 64 | - if($this->interval>0) |
|
| 64 | + if ($this->interval > 0) |
|
| 65 | 65 | { |
| 66 | - if(!file_exists($this->cache_file)) $mtime = 0; |
|
| 66 | + if (!file_exists($this->cache_file)) $mtime = 0; |
|
| 67 | 67 | else $mtime = filemtime($this->cache_file); |
| 68 | 68 | |
| 69 | - if($mtime + $this->interval*60 > $_SERVER['REQUEST_TIME']) |
|
| 69 | + if ($mtime + $this->interval * 60 > $_SERVER['REQUEST_TIME']) |
|
| 70 | 70 | { |
| 71 | 71 | $page_content = FileHandler::readFile($this->cache_file); |
| 72 | 72 | $page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | else |
| 82 | 82 | { |
| 83 | - if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
| 83 | + if (file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file); |
|
| 84 | 84 | $page_content = $this->module_info->content; |
| 85 | 85 | } |
| 86 | 86 | return $page_content; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $oDocumentModel = getModel('document'); |
| 94 | 94 | $oDocument = $oDocumentModel->getDocument(0, true); |
| 95 | 95 | |
| 96 | - if($this->module_info->document_srl) |
|
| 96 | + if ($this->module_info->document_srl) |
|
| 97 | 97 | { |
| 98 | 98 | $document_srl = $this->module_info->document_srl; |
| 99 | 99 | $oDocument->setDocument($document_srl); |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | function _getOutsideContent() |
| 119 | 119 | { |
| 120 | 120 | // check if it is http or internal file |
| 121 | - if($this->path) |
|
| 121 | + if ($this->path) |
|
| 122 | 122 | { |
| 123 | - if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
| 123 | + if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file); |
|
| 124 | 124 | else $content = $this->executeFile($this->path, $this->interval, $this->cache_file); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | function getHtmlPage($path, $caching_interval, $cache_file) |
| 134 | 134 | { |
| 135 | 135 | // Verify cache |
| 136 | - if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > $_SERVER['REQUEST_TIME']) |
|
| 136 | + if ($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval * 60 > $_SERVER['REQUEST_TIME']) |
|
| 137 | 137 | { |
| 138 | 138 | $content = FileHandler::readFile($cache_file); |
| 139 | 139 | } |
@@ -154,13 +154,13 @@ discard block |
||
| 154 | 154 | $content = $buff->content; |
| 155 | 155 | // Extract a title |
| 156 | 156 | $title = $oPageController->getTitle($content); |
| 157 | - if($title) Context::setBrowserTitle($title); |
|
| 157 | + if ($title) Context::setBrowserTitle($title); |
|
| 158 | 158 | // Extract header script |
| 159 | 159 | $head_script = $oPageController->getHeadScript($content); |
| 160 | - if($head_script) Context::addHtmlHeader($head_script); |
|
| 160 | + if ($head_script) Context::addHtmlHeader($head_script); |
|
| 161 | 161 | // Extract content from the body |
| 162 | 162 | $body_script = $oPageController->getBodyScript($content); |
| 163 | - if(!$body_script) $body_script = $content; |
|
| 163 | + if (!$body_script) $body_script = $content; |
|
| 164 | 164 | |
| 165 | 165 | return $content; |
| 166 | 166 | } |
@@ -171,32 +171,32 @@ discard block |
||
| 171 | 171 | function executeFile($target_file, $caching_interval, $cache_file) |
| 172 | 172 | { |
| 173 | 173 | // Cancel if the file doesn't exist |
| 174 | - if(!file_exists(FileHandler::getRealPath($target_file))) return; |
|
| 174 | + if (!file_exists(FileHandler::getRealPath($target_file))) return; |
|
| 175 | 175 | |
| 176 | 176 | // Get a path and filename |
| 177 | - $tmp_path = explode('/',$cache_file); |
|
| 178 | - $filename = $tmp_path[count($tmp_path)-1]; |
|
| 179 | - $filepath = preg_replace('/'.$filename."$/i","",$cache_file); |
|
| 177 | + $tmp_path = explode('/', $cache_file); |
|
| 178 | + $filename = $tmp_path[count($tmp_path) - 1]; |
|
| 179 | + $filepath = preg_replace('/'.$filename."$/i", "", $cache_file); |
|
| 180 | 180 | $cache_file = FileHandler::getRealPath($cache_file); |
| 181 | 181 | |
| 182 | 182 | $level = ob_get_level(); |
| 183 | 183 | // Verify cache |
| 184 | - if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file)<filemtime($target_file)) |
|
| 184 | + if ($caching_interval < 1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval * 60 <= $_SERVER['REQUEST_TIME'] || filemtime($cache_file) < filemtime($target_file)) |
|
| 185 | 185 | { |
| 186 | - if(file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
| 186 | + if (file_exists($cache_file)) FileHandler::removeFile($cache_file); |
|
| 187 | 187 | |
| 188 | 188 | // Read a target file and get content |
| 189 | 189 | ob_start(); |
| 190 | 190 | include(FileHandler::getRealPath($target_file)); |
| 191 | 191 | $content = ob_get_clean(); |
| 192 | 192 | // Replace relative path to the absolute path |
| 193 | - $this->path = str_replace('\\', '/', realpath(dirname($target_file))) . '/'; |
|
| 194 | - $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content); |
|
| 195 | - $content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is',array($this,'_replacePath'),$content); |
|
| 193 | + $this->path = str_replace('\\', '/', realpath(dirname($target_file))).'/'; |
|
| 194 | + $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is', array($this, '_replacePath'), $content); |
|
| 195 | + $content = preg_replace_callback('/(<!--%import\()(\")([^"]+)(\")/is', array($this, '_replacePath'), $content); |
|
| 196 | 196 | |
| 197 | 197 | FileHandler::writeFile($cache_file, $content); |
| 198 | 198 | // Include and then Return the result |
| 199 | - if(!file_exists($cache_file)) return; |
|
| 199 | + if (!file_exists($cache_file)) return; |
|
| 200 | 200 | // Attempt to compile |
| 201 | 201 | $oTemplate = &TemplateHandler::getInstance(); |
| 202 | 202 | $script = $oTemplate->compileDirect($filepath, $filename); |
@@ -223,20 +223,20 @@ discard block |
||
| 223 | 223 | $val = trim($matches[3]); |
| 224 | 224 | // Pass if the path is external or starts with /, #, { characters |
| 225 | 225 | // /=absolute path, #=hash in a page, {=Template syntax |
| 226 | - if(strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i',$val)) |
|
| 226 | + if (strpos($val, '.') === FALSE || preg_match('@^((?:http|https|ftp|telnet|mms)://|(?:mailto|javascript):|[/#{])@i', $val)) |
|
| 227 | 227 | { |
| 228 | 228 | return $matches[0]; |
| 229 | 229 | // In case of .. , get a path |
| 230 | 230 | } |
| 231 | - else if(strncasecmp('..', $val, 2) === 0) |
|
| 231 | + else if (strncasecmp('..', $val, 2) === 0) |
|
| 232 | 232 | { |
| 233 | 233 | $p = Context::pathToUrl($this->path); |
| 234 | - return sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
|
| 234 | + return sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - if(strncasecmp('..', $val, 2) === 0) $val = substr($val,2); |
|
| 237 | + if (strncasecmp('..', $val, 2) === 0) $val = substr($val, 2); |
|
| 238 | 238 | $p = Context::pathToUrl($this->path); |
| 239 | - $path = sprintf("%s%s%s%s",$matches[1],$matches[2],$p.$val,$matches[4]); |
|
| 239 | + $path = sprintf("%s%s%s%s", $matches[1], $matches[2], $p.$val, $matches[4]); |
|
| 240 | 240 | |
| 241 | 241 | return $path; |
| 242 | 242 | } |
@@ -478,6 +478,7 @@ |
||
| 478 | 478 | |
| 479 | 479 | /** |
| 480 | 480 | * @brief Set points |
| 481 | + * @param string $mode |
|
| 481 | 482 | */ |
| 482 | 483 | function setPoint($member_srl, $point, $mode = null) |
| 483 | 484 | { |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $point = $config->signup_point; |
| 32 | 32 | // Increase the point |
| 33 | 33 | $cur_point += $point; |
| 34 | - $this->setPoint($member_srl,$cur_point, 'signup'); |
|
| 34 | + $this->setPoint($member_srl, $cur_point, 'signup'); |
|
| 35 | 35 | |
| 36 | 36 | return new Object(); |
| 37 | 37 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | function triggerAfterLogin(&$obj) |
| 43 | 43 | { |
| 44 | 44 | $member_srl = $obj->member_srl; |
| 45 | - if(!$member_srl) return new Object(); |
|
| 45 | + if (!$member_srl) return new Object(); |
|
| 46 | 46 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
| 47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new Object(); |
|
| 48 | 48 | // Get the point module information |
| 49 | 49 | $oModuleModel = getModel('module'); |
| 50 | 50 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $point = $config->login_point; |
| 56 | 56 | // Increase the point |
| 57 | 57 | $cur_point += $point; |
| 58 | - $this->setPoint($member_srl,$cur_point); |
|
| 58 | + $this->setPoint($member_srl, $cur_point); |
|
| 59 | 59 | |
| 60 | 60 | return new Object(); |
| 61 | 61 | } |
@@ -66,30 +66,30 @@ discard block |
||
| 66 | 66 | function triggerInsertDocument(&$obj) |
| 67 | 67 | { |
| 68 | 68 | $oDocumentModel = getModel('document'); |
| 69 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 69 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 70 | 70 | { |
| 71 | 71 | $module_srl = $obj->module_srl; |
| 72 | 72 | $member_srl = $obj->member_srl; |
| 73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 73 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 74 | 74 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new Object(); |
|
| 75 | + if ($module_srl == $member_srl) return new Object(); |
|
| 76 | 76 | // Get the point module information |
| 77 | 77 | $oModuleModel = getModel('module'); |
| 78 | 78 | $config = $oModuleModel->getModuleConfig('point'); |
| 79 | - $module_config = $oModuleModel->getModulePartConfig('point',$module_srl); |
|
| 79 | + $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
|
| 80 | 80 | // Get the points of the member |
| 81 | 81 | $oPointModel = getModel('point'); |
| 82 | 82 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 83 | 83 | |
| 84 | 84 | $point = $module_config['insert_document']; |
| 85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 85 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 86 | 86 | $cur_point += $point; |
| 87 | 87 | // Add points for attaching a file |
| 88 | 88 | $point = $module_config['upload_file']; |
| 89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 89 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 91 | 91 | // Increase the point |
| 92 | - $this->setPoint($member_srl,$cur_point); |
|
| 92 | + $this->setPoint($member_srl, $cur_point); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | return new Object(); |
@@ -106,24 +106,24 @@ discard block |
||
| 106 | 106 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 107 | 107 | |
| 108 | 108 | // if status is TEMP or PUBLIC... give not point, only status is empty |
| 109 | - if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 109 | + if ($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 110 | 110 | { |
| 111 | 111 | $oModuleModel = getModel('module'); |
| 112 | 112 | |
| 113 | 113 | // Get the point module information |
| 114 | 114 | $config = $oModuleModel->getModuleConfig('point'); |
| 115 | - $module_config = $oModuleModel->getModulePartConfig('point',$obj->module_srl); |
|
| 115 | + $module_config = $oModuleModel->getModulePartConfig('point', $obj->module_srl); |
|
| 116 | 116 | // Get the points of the member |
| 117 | 117 | $oPointModel = getModel('point'); |
| 118 | 118 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
| 119 | 119 | |
| 120 | 120 | $point = $module_config['insert_document']; |
| 121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 121 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 122 | 122 | $cur_point += $point; |
| 123 | 123 | // Add points for attaching a file |
| 124 | 124 | $point = $module_config['upload_file']; |
| 125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 125 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | + if ($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 127 | 127 | // Increase the point |
| 128 | 128 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
| 129 | 129 | } |
@@ -141,42 +141,42 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $oDocumentModel = getModel('document'); |
| 143 | 143 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 144 | - if(!$oDocument->isExists()) return new Object(); |
|
| 144 | + if (!$oDocument->isExists()) return new Object(); |
|
| 145 | 145 | // Get the point module information |
| 146 | 146 | $oModuleModel = getModel('module'); |
| 147 | 147 | $config = $oModuleModel->getModuleConfig('point'); |
| 148 | - $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
|
| 148 | + $module_config = $oModuleModel->getModulePartConfig('point', $oDocument->get('module_srl')); |
|
| 149 | 149 | // The process related to clearing the post comments |
| 150 | 150 | $comment_point = $module_config['insert_comment']; |
| 151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 151 | + if (strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 152 | 152 | // If there are comment points, attempt to deduct |
| 153 | - if($comment_point>0) return new Object(); |
|
| 153 | + if ($comment_point > 0) return new Object(); |
|
| 154 | 154 | // Get all the comments related to this post |
| 155 | 155 | $cp_args = new stdClass(); |
| 156 | 156 | $cp_args->document_srl = $document_srl; |
| 157 | 157 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
| 158 | 158 | // Return if there is no object |
| 159 | - if(!$output->data) return new Object(); |
|
| 159 | + if (!$output->data) return new Object(); |
|
| 160 | 160 | // Organize the member number |
| 161 | 161 | $member_srls = array(); |
| 162 | 162 | $cnt = count($output->data); |
| 163 | - for($i=0;$i<$cnt;$i++) |
|
| 163 | + for ($i = 0; $i < $cnt; $i++) |
|
| 164 | 164 | { |
| 165 | - if($output->data[$i]->member_srl<1) continue; |
|
| 165 | + if ($output->data[$i]->member_srl < 1) continue; |
|
| 166 | 166 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
| 167 | 167 | } |
| 168 | 168 | // Remove the member number who has written the original post |
| 169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | - if(!count($member_srls)) return new Object(); |
|
| 169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | + if (!count($member_srls)) return new Object(); |
|
| 171 | 171 | // Remove all the points for each member |
| 172 | 172 | $oPointModel = getModel('point'); |
| 173 | 173 | // Get the points |
| 174 | 174 | $point = $module_config['download_file']; |
| 175 | - foreach($member_srls as $member_srl => $cnt) |
|
| 175 | + foreach ($member_srls as $member_srl => $cnt) |
|
| 176 | 176 | { |
| 177 | 177 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 178 | 178 | $cur_point -= $cnt * $comment_point; |
| 179 | - $this->setPoint($member_srl,$cur_point); |
|
| 179 | + $this->setPoint($member_srl, $cur_point); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | return new Object(); |
@@ -189,15 +189,15 @@ discard block |
||
| 189 | 189 | { |
| 190 | 190 | $oDocumentModel = getModel('document'); |
| 191 | 191 | |
| 192 | - if($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 192 | + if ($obj->status != $oDocumentModel->getConfigStatus('temp')) |
|
| 193 | 193 | { |
| 194 | 194 | $module_srl = $obj->module_srl; |
| 195 | 195 | $member_srl = $obj->member_srl; |
| 196 | 196 | // The process related to clearing the post object |
| 197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 197 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 198 | 198 | // Run only when logged in |
| 199 | 199 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new Object(); |
|
| 200 | + if (!$logged_info->member_srl) return new Object(); |
|
| 201 | 201 | // Get the points of the member |
| 202 | 202 | $oPointModel = getModel('point'); |
| 203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 208 | 208 | |
| 209 | 209 | $point = $module_config['insert_document']; |
| 210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 210 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 211 | 211 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
| 212 | - if($point < 0) return new Object(); |
|
| 212 | + if ($point < 0) return new Object(); |
|
| 213 | 213 | $cur_point -= $point; |
| 214 | 214 | // Add points related to deleting an attachment |
| 215 | 215 | $point = $module_config['upload_file']; |
| 216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
| 216 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 217 | + if ($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
| 218 | 218 | // Increase the point |
| 219 | - $this->setPoint($member_srl,$cur_point); |
|
| 219 | + $this->setPoint($member_srl, $cur_point); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | return new Object(); |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | { |
| 230 | 230 | $module_srl = $obj->module_srl; |
| 231 | 231 | $member_srl = $obj->member_srl; |
| 232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 232 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 233 | 233 | // Do not increase the points if the member is the author of the post |
| 234 | 234 | $document_srl = $obj->document_srl; |
| 235 | 235 | $oDocumentModel = getModel('document'); |
| 236 | 236 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
| 237 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new Object(); |
|
| 238 | 238 | // Get the point module information |
| 239 | 239 | $oModuleModel = getModel('module'); |
| 240 | 240 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 245 | 245 | |
| 246 | 246 | $point = $module_config['insert_comment']; |
| 247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 247 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 248 | 248 | // Increase the point |
| 249 | 249 | $cur_point += $point; |
| 250 | - $this->setPoint($member_srl,$cur_point); |
|
| 250 | + $this->setPoint($member_srl, $cur_point); |
|
| 251 | 251 | |
| 252 | 252 | return new Object(); |
| 253 | 253 | } |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | $module_srl = $obj->module_srl; |
| 265 | 265 | $member_srl = abs($obj->member_srl); |
| 266 | 266 | $document_srl = $obj->document_srl; |
| 267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 267 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 268 | 268 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
| 269 | 269 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 270 | - if(!$oDocument->isExists()) return new Object(); |
|
| 271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
| 270 | + if (!$oDocument->isExists()) return new Object(); |
|
| 271 | + if ($oDocument->get('member_srl') == $member_srl) return new Object(); |
|
| 272 | 272 | // Get the point module information |
| 273 | 273 | $config = $oModuleModel->getModuleConfig('point'); |
| 274 | 274 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,12 +276,12 @@ discard block |
||
| 276 | 276 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 277 | 277 | |
| 278 | 278 | $point = $module_config['insert_comment']; |
| 279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 279 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 280 | 280 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
| 281 | - if($point < 0) return new Object(); |
|
| 281 | + if ($point < 0) return new Object(); |
|
| 282 | 282 | // Increase the point |
| 283 | 283 | $cur_point -= $point; |
| 284 | - $this->setPoint($member_srl,$cur_point); |
|
| 284 | + $this->setPoint($member_srl, $cur_point); |
|
| 285 | 285 | |
| 286 | 286 | return new Object(); |
| 287 | 287 | } |
@@ -301,11 +301,11 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | function triggerDeleteFile(&$obj) |
| 303 | 303 | { |
| 304 | - if($obj->isvalid != 'Y') return new Object(); |
|
| 304 | + if ($obj->isvalid != 'Y') return new Object(); |
|
| 305 | 305 | |
| 306 | 306 | $module_srl = $obj->module_srl; |
| 307 | 307 | $member_srl = $obj->member_srl; |
| 308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 308 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 309 | 309 | // Get the point module information |
| 310 | 310 | $oModuleModel = getModel('module'); |
| 311 | 311 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 316 | 316 | |
| 317 | 317 | $point = $module_config['upload_file']; |
| 318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 318 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 319 | 319 | // Increase the point |
| 320 | 320 | $cur_point -= $point; |
| 321 | - $this->setPoint($member_srl,$cur_point); |
|
| 321 | + $this->setPoint($member_srl, $cur_point); |
|
| 322 | 322 | |
| 323 | 323 | return new Object(); |
| 324 | 324 | } |
@@ -331,10 +331,10 @@ discard block |
||
| 331 | 331 | $logged_info = Context::get('logged_info'); |
| 332 | 332 | $member_srl = $logged_info->member_srl; |
| 333 | 333 | $module_srl = $obj->module_srl; |
| 334 | - if(!$module_srl) return new Object(); |
|
| 334 | + if (!$module_srl) return new Object(); |
|
| 335 | 335 | |
| 336 | 336 | // Pass if it is your file |
| 337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
| 337 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
| 338 | 338 | $oModuleModel = getModel('module'); |
| 339 | 339 | $config = $oModuleModel->getModuleConfig('point'); |
| 340 | 340 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | // If the user is not logged in and download requires points, deny access. |
| 351 | - if(!Context::get('is_logged')) |
|
| 351 | + if (!Context::get('is_logged')) |
|
| 352 | 352 | { |
| 353 | - if($config->disable_download == 'Y' && $point) |
|
| 353 | + if ($config->disable_download == 'Y' && $point) |
|
| 354 | 354 | { |
| 355 | - return new Object(-1,'msg_not_permitted_download'); |
|
| 355 | + return new Object(-1, 'msg_not_permitted_download'); |
|
| 356 | 356 | } |
| 357 | 357 | else |
| 358 | 358 | { |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | // If the member does not have enough points, deny access. |
| 368 | 368 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
| 369 | 369 | { |
| 370 | - return new Object(-1,'msg_cannot_download'); |
|
| 370 | + return new Object(-1, 'msg_cannot_download'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -381,13 +381,13 @@ discard block |
||
| 381 | 381 | { |
| 382 | 382 | // Run only when logged in |
| 383 | 383 | $logged_info = Context::get('logged_info'); |
| 384 | - if(!$logged_info->member_srl) return new Object(); |
|
| 384 | + if (!$logged_info->member_srl) return new Object(); |
|
| 385 | 385 | $module_srl = $obj->module_srl; |
| 386 | 386 | $member_srl = $logged_info->member_srl; |
| 387 | - if(!$module_srl) return new Object(); |
|
| 387 | + if (!$module_srl) return new Object(); |
|
| 388 | 388 | |
| 389 | 389 | // Pass if it is your file |
| 390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
| 390 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
| 391 | 391 | |
| 392 | 392 | // Get the point module information |
| 393 | 393 | $oModuleModel = getModel('module'); |
@@ -428,22 +428,22 @@ discard block |
||
| 428 | 428 | // Get the original author number |
| 429 | 429 | $target_member_srl = abs($obj->get('member_srl')); |
| 430 | 430 | // Pass without increasing the hits if the viewer is the same as the author |
| 431 | - if($target_member_srl == $member_srl) return new Object(); |
|
| 431 | + if ($target_member_srl == $member_srl) return new Object(); |
|
| 432 | 432 | // Get the point information for each module |
| 433 | 433 | $config = $oModuleModel->getModuleConfig('point'); |
| 434 | 434 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 435 | 435 | // Get hits points |
| 436 | 436 | $point = $module_config['read_document']; |
| 437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 437 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 438 | 438 | // Pass if there are no requested points |
| 439 | - if(!$point) return new Object(); |
|
| 439 | + if (!$point) return new Object(); |
|
| 440 | 440 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 441 | - if($member_srl) |
|
| 441 | + if ($member_srl) |
|
| 442 | 442 | { |
| 443 | 443 | $args->member_srl = $member_srl; |
| 444 | 444 | $args->document_srl = $obj->document_srl; |
| 445 | 445 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 446 | - if($output->data->count) return new Object(); |
|
| 446 | + if ($output->data->count) return new Object(); |
|
| 447 | 447 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 448 | 448 | } |
| 449 | 449 | else |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $config = $oModuleModel->getModuleConfig('point'); |
| 455 | 455 | // When the requested points are negative, compared it with the current point |
| 456 | 456 | $_SESSION['banned_document'][$obj->document_srl] = false; |
| 457 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
| 457 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
| 458 | 458 | { |
| 459 | 459 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
| 460 | 460 | $obj->add('content', $message); |
@@ -462,14 +462,14 @@ discard block |
||
| 462 | 462 | return new Object(-1, $message); |
| 463 | 463 | } |
| 464 | 464 | // If not logged in, pass |
| 465 | - if(!$logged_info->member_srl) return new Object(); |
|
| 465 | + if (!$logged_info->member_srl) return new Object(); |
|
| 466 | 466 | // Pass, if there are no requested points |
| 467 | - if(!$point) return new Object(); |
|
| 467 | + if (!$point) return new Object(); |
|
| 468 | 468 | // If the read record is missing, leave it |
| 469 | 469 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 470 | 470 | // Increase the point |
| 471 | 471 | $cur_point += $point; |
| 472 | - $this->setPoint($member_srl,$cur_point); |
|
| 472 | + $this->setPoint($member_srl, $cur_point); |
|
| 473 | 473 | |
| 474 | 474 | return new Object(); |
| 475 | 475 | } |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | { |
| 482 | 482 | $module_srl = $obj->module_srl; |
| 483 | 483 | $member_srl = $obj->member_srl; |
| 484 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 484 | + if (!$module_srl || !$member_srl) return new Object(); |
|
| 485 | 485 | |
| 486 | 486 | $oModuleModel = getModel('module'); |
| 487 | 487 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -490,21 +490,21 @@ discard block |
||
| 490 | 490 | $oPointModel = getModel('point'); |
| 491 | 491 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 492 | 492 | |
| 493 | - if( $obj->point > 0 ) |
|
| 493 | + if ($obj->point > 0) |
|
| 494 | 494 | { |
| 495 | 495 | $point = $module_config['voted']; |
| 496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 496 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 497 | 497 | } |
| 498 | 498 | else |
| 499 | 499 | { |
| 500 | 500 | $point = $module_config['blamed']; |
| 501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 501 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - if(!$point) return new Object(); |
|
| 504 | + if (!$point) return new Object(); |
|
| 505 | 505 | // Increase the point |
| 506 | 506 | $cur_point += $point; |
| 507 | - $this->setPoint($member_srl,$cur_point); |
|
| 507 | + $this->setPoint($member_srl, $cur_point); |
|
| 508 | 508 | |
| 509 | 509 | return new Object(); |
| 510 | 510 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | { |
| 517 | 517 | $member_srl = abs($member_srl); |
| 518 | 518 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 519 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
| 520 | 520 | |
| 521 | 521 | // Get configuration information |
| 522 | 522 | $oMemberModel = getModel('member'); |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $args->member_srl = $member_srl; |
| 534 | 534 | $args->point = $current_point; |
| 535 | 535 | |
| 536 | - switch($mode) |
|
| 536 | + switch ($mode) |
|
| 537 | 537 | { |
| 538 | 538 | case 'add' : |
| 539 | 539 | $args->point += $point; |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $args->point = $point; |
| 547 | 547 | break; |
| 548 | 548 | } |
| 549 | - if($args->point < 0) $args->point = 0; |
|
| 549 | + if ($args->point < 0) $args->point = 0; |
|
| 550 | 550 | $point = $args->point; |
| 551 | 551 | |
| 552 | 552 | // Call a trigger (before) |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | $trigger_obj->current_level = $current_level; |
| 558 | 558 | $trigger_obj->set_point = $point; |
| 559 | 559 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
| 560 | - if(!$trigger_output->toBool()) |
|
| 560 | + if (!$trigger_output->toBool()) |
|
| 561 | 561 | { |
| 562 | 562 | return $trigger_output; |
| 563 | 563 | } |
@@ -568,19 +568,19 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | // If there are points, update, if no, insert |
| 570 | 570 | $oPointModel = getModel('point'); |
| 571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 571 | + if ($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 572 | 572 | else executeQuery("point.insertPoint", $args); |
| 573 | 573 | |
| 574 | 574 | // Get a new level |
| 575 | 575 | $level = $oPointModel->getLevel($point, $config->level_step); |
| 576 | 576 | |
| 577 | 577 | // If existing level and a new one are different attempt to set a point group |
| 578 | - if($level != $current_level) |
|
| 578 | + if ($level != $current_level) |
|
| 579 | 579 | { |
| 580 | 580 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
| 581 | 581 | $point_group = $config->point_group; |
| 582 | 582 | // If the point group exists |
| 583 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
| 583 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
| 584 | 584 | { |
| 585 | 585 | // Get the default group |
| 586 | 586 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -590,29 +590,29 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | asort($point_group); |
| 592 | 592 | // Reset group after initialization |
| 593 | - if($config->group_reset != 'N') |
|
| 593 | + if ($config->group_reset != 'N') |
|
| 594 | 594 | { |
| 595 | 595 | // If the new level is in the right group |
| 596 | - if(in_array($level, $point_group)) |
|
| 596 | + if (in_array($level, $point_group)) |
|
| 597 | 597 | { |
| 598 | 598 | // Delete all groups except the one which the current level belongs to |
| 599 | - foreach($point_group as $group_srl => $target_level) |
|
| 599 | + foreach ($point_group as $group_srl => $target_level) |
|
| 600 | 600 | { |
| 601 | 601 | $del_group_list[] = $group_srl; |
| 602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 602 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | // Otherwise, in case the level is reduced, add the recent group |
| 606 | 606 | else |
| 607 | 607 | { |
| 608 | 608 | $i = $level; |
| 609 | - while($i > 0) |
|
| 609 | + while ($i > 0) |
|
| 610 | 610 | { |
| 611 | - if(in_array($i, $point_group)) |
|
| 611 | + if (in_array($i, $point_group)) |
|
| 612 | 612 | { |
| 613 | - foreach($point_group as $group_srl => $target_level) |
|
| 613 | + foreach ($point_group as $group_srl => $target_level) |
|
| 614 | 614 | { |
| 615 | - if($target_level == $i) |
|
| 615 | + if ($target_level == $i) |
|
| 616 | 616 | { |
| 617 | 617 | $new_group_list[] = $group_srl; |
| 618 | 618 | } |
@@ -623,9 +623,9 @@ discard block |
||
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | // Delete the group of a level which is higher than the current level |
| 626 | - foreach($point_group as $group_srl => $target_level) |
|
| 626 | + foreach ($point_group as $group_srl => $target_level) |
|
| 627 | 627 | { |
| 628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 628 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
| 629 | 629 | } |
| 630 | 630 | $del_group_list[] = $default_group->group_srl; |
| 631 | 631 | } |
@@ -633,16 +633,16 @@ discard block |
||
| 633 | 633 | else |
| 634 | 634 | { |
| 635 | 635 | // Check until the current level by rotating setting the configurations of the point groups |
| 636 | - foreach($point_group as $group_srl => $target_level) |
|
| 636 | + foreach ($point_group as $group_srl => $target_level) |
|
| 637 | 637 | { |
| 638 | 638 | $del_group_list[] = $group_srl; |
| 639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 639 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | // If there is no a new group, granted the default group |
| 643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 643 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 644 | 644 | // Remove linkage group |
| 645 | - if($del_group_list && count($del_group_list)) |
|
| 645 | + if ($del_group_list && count($del_group_list)) |
|
| 646 | 646 | { |
| 647 | 647 | $del_group_args = new stdClass; |
| 648 | 648 | $del_group_args->member_srl = $member_srl; |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
| 651 | 651 | } |
| 652 | 652 | // Grant a new group |
| 653 | - foreach($new_group_list as $group_srl) |
|
| 653 | + foreach ($new_group_list as $group_srl) |
|
| 654 | 654 | { |
| 655 | 655 | $new_group_args = new stdClass; |
| 656 | 656 | $new_group_args->member_srl = $member_srl; |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | $trigger_obj->del_group_list = $del_group_list; |
| 666 | 666 | $trigger_obj->new_level = $level; |
| 667 | 667 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
| 668 | - if(!$trigger_output->toBool()) |
|
| 668 | + if (!$trigger_output->toBool()) |
|
| 669 | 669 | { |
| 670 | 670 | $oDB->rollback(); |
| 671 | 671 | return $trigger_output; |
@@ -681,17 +681,17 @@ discard block |
||
| 681 | 681 | FileHandler::writeFile($cache_filename, $point); |
| 682 | 682 | |
| 683 | 683 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
| 684 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 684 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 685 | 685 | { |
| 686 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
| 686 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
| 687 | 687 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 688 | 688 | $oCacheHandler->delete($cache_key); |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | $oCacheHandler = CacheHandler::getInstance('object'); |
| 692 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 692 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
| 693 | 693 | { |
| 694 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
| 694 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
| 695 | 695 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
| 696 | 696 | $oCacheHandler->delete($cache_key); |
| 697 | 697 | } |
@@ -705,9 +705,9 @@ discard block |
||
| 705 | 705 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
| 706 | 706 | |
| 707 | 707 | $oModuleController = getController('module'); |
| 708 | - if(is_array($obj->moduleSrlList)) |
|
| 708 | + if (is_array($obj->moduleSrlList)) |
|
| 709 | 709 | { |
| 710 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 710 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
| 711 | 711 | { |
| 712 | 712 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
| 713 | 713 | } |
@@ -42,9 +42,13 @@ discard block |
||
| 42 | 42 | function triggerAfterLogin(&$obj) |
| 43 | 43 | { |
| 44 | 44 | $member_srl = $obj->member_srl; |
| 45 | - if(!$member_srl) return new Object(); |
|
| 45 | + if(!$member_srl) { |
|
| 46 | + return new Object(); |
|
| 47 | + } |
|
| 46 | 48 | // If the last login is not today, give the points |
| 47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new Object(); |
|
| 49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
| 50 | + return new Object(); |
|
| 51 | + } |
|
| 48 | 52 | // Get the point module information |
| 49 | 53 | $oModuleModel = getModel('module'); |
| 50 | 54 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -70,9 +74,13 @@ discard block |
||
| 70 | 74 | { |
| 71 | 75 | $module_srl = $obj->module_srl; |
| 72 | 76 | $member_srl = $obj->member_srl; |
| 73 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 77 | + if(!$module_srl || !$member_srl) { |
|
| 78 | + return new Object(); |
|
| 79 | + } |
|
| 74 | 80 | // The fix to disable giving points for saving the document temporarily |
| 75 | - if($module_srl == $member_srl) return new Object(); |
|
| 81 | + if($module_srl == $member_srl) { |
|
| 82 | + return new Object(); |
|
| 83 | + } |
|
| 76 | 84 | // Get the point module information |
| 77 | 85 | $oModuleModel = getModel('module'); |
| 78 | 86 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -82,12 +90,18 @@ discard block |
||
| 82 | 90 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 83 | 91 | |
| 84 | 92 | $point = $module_config['insert_document']; |
| 85 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 93 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 94 | + $point = $config->insert_document; |
|
| 95 | + } |
|
| 86 | 96 | $cur_point += $point; |
| 87 | 97 | // Add points for attaching a file |
| 88 | 98 | $point = $module_config['upload_file']; |
| 89 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 90 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 99 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 100 | + $point = $config->upload_file; |
|
| 101 | + } |
|
| 102 | + if($obj->uploaded_count) { |
|
| 103 | + $cur_point += $point * $obj->uploaded_count; |
|
| 104 | + } |
|
| 91 | 105 | // Increase the point |
| 92 | 106 | $this->setPoint($member_srl,$cur_point); |
| 93 | 107 | } |
@@ -118,12 +132,18 @@ discard block |
||
| 118 | 132 | $cur_point = $oPointModel->getPoint($oDocument->get('member_srl'), true); |
| 119 | 133 | |
| 120 | 134 | $point = $module_config['insert_document']; |
| 121 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 135 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 136 | + $point = $config->insert_document; |
|
| 137 | + } |
|
| 122 | 138 | $cur_point += $point; |
| 123 | 139 | // Add points for attaching a file |
| 124 | 140 | $point = $module_config['upload_file']; |
| 125 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 126 | - if($obj->uploaded_count) $cur_point += $point * $obj->uploaded_count; |
|
| 141 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 142 | + $point = $config->upload_file; |
|
| 143 | + } |
|
| 144 | + if($obj->uploaded_count) { |
|
| 145 | + $cur_point += $point * $obj->uploaded_count; |
|
| 146 | + } |
|
| 127 | 147 | // Increase the point |
| 128 | 148 | $this->setPoint($oDocument->get('member_srl'), $cur_point); |
| 129 | 149 | } |
@@ -141,33 +161,47 @@ discard block |
||
| 141 | 161 | |
| 142 | 162 | $oDocumentModel = getModel('document'); |
| 143 | 163 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 144 | - if(!$oDocument->isExists()) return new Object(); |
|
| 164 | + if(!$oDocument->isExists()) { |
|
| 165 | + return new Object(); |
|
| 166 | + } |
|
| 145 | 167 | // Get the point module information |
| 146 | 168 | $oModuleModel = getModel('module'); |
| 147 | 169 | $config = $oModuleModel->getModuleConfig('point'); |
| 148 | 170 | $module_config = $oModuleModel->getModulePartConfig('point',$oDocument->get('module_srl')); |
| 149 | 171 | // The process related to clearing the post comments |
| 150 | 172 | $comment_point = $module_config['insert_comment']; |
| 151 | - if(strlen($comment_point) == 0 && !is_int($comment_point)) $comment_point = $config->insert_comment; |
|
| 173 | + if(strlen($comment_point) == 0 && !is_int($comment_point)) { |
|
| 174 | + $comment_point = $config->insert_comment; |
|
| 175 | + } |
|
| 152 | 176 | // If there are comment points, attempt to deduct |
| 153 | - if($comment_point>0) return new Object(); |
|
| 177 | + if($comment_point>0) { |
|
| 178 | + return new Object(); |
|
| 179 | + } |
|
| 154 | 180 | // Get all the comments related to this post |
| 155 | 181 | $cp_args = new stdClass(); |
| 156 | 182 | $cp_args->document_srl = $document_srl; |
| 157 | 183 | $output = executeQueryArray('point.getCommentUsers', $cp_args); |
| 158 | 184 | // Return if there is no object |
| 159 | - if(!$output->data) return new Object(); |
|
| 185 | + if(!$output->data) { |
|
| 186 | + return new Object(); |
|
| 187 | + } |
|
| 160 | 188 | // Organize the member number |
| 161 | 189 | $member_srls = array(); |
| 162 | 190 | $cnt = count($output->data); |
| 163 | 191 | for($i=0;$i<$cnt;$i++) |
| 164 | 192 | { |
| 165 | - if($output->data[$i]->member_srl<1) continue; |
|
| 193 | + if($output->data[$i]->member_srl<1) { |
|
| 194 | + continue; |
|
| 195 | + } |
|
| 166 | 196 | $member_srls[abs($output->data[$i]->member_srl)] = $output->data[$i]->count; |
| 167 | 197 | } |
| 168 | 198 | // Remove the member number who has written the original post |
| 169 | - if($member_srl) unset($member_srls[abs($member_srl)]); |
|
| 170 | - if(!count($member_srls)) return new Object(); |
|
| 199 | + if($member_srl) { |
|
| 200 | + unset($member_srls[abs($member_srl)]); |
|
| 201 | + } |
|
| 202 | + if(!count($member_srls)) { |
|
| 203 | + return new Object(); |
|
| 204 | + } |
|
| 171 | 205 | // Remove all the points for each member |
| 172 | 206 | $oPointModel = getModel('point'); |
| 173 | 207 | // Get the points |
@@ -194,10 +228,14 @@ discard block |
||
| 194 | 228 | $module_srl = $obj->module_srl; |
| 195 | 229 | $member_srl = $obj->member_srl; |
| 196 | 230 | // The process related to clearing the post object |
| 197 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 231 | + if(!$module_srl || !$member_srl) { |
|
| 232 | + return new Object(); |
|
| 233 | + } |
|
| 198 | 234 | // Run only when logged in |
| 199 | 235 | $logged_info = Context::get('logged_info'); |
| 200 | - if(!$logged_info->member_srl) return new Object(); |
|
| 236 | + if(!$logged_info->member_srl) { |
|
| 237 | + return new Object(); |
|
| 238 | + } |
|
| 201 | 239 | // Get the points of the member |
| 202 | 240 | $oPointModel = getModel('point'); |
| 203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,14 +245,22 @@ discard block |
||
| 207 | 245 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 208 | 246 | |
| 209 | 247 | $point = $module_config['insert_document']; |
| 210 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_document; |
|
| 248 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 249 | + $point = $config->insert_document; |
|
| 250 | + } |
|
| 211 | 251 | // if the point is set to decrease when writing a document, make sure it does not increase the points when deleting an article |
| 212 | - if($point < 0) return new Object(); |
|
| 252 | + if($point < 0) { |
|
| 253 | + return new Object(); |
|
| 254 | + } |
|
| 213 | 255 | $cur_point -= $point; |
| 214 | 256 | // Add points related to deleting an attachment |
| 215 | 257 | $point = $module_config['upload_file']; |
| 216 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 217 | - if($obj->uploaded_count) $cur_point -= $point * $obj->uploaded_count; |
|
| 258 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 259 | + $point = $config->upload_file; |
|
| 260 | + } |
|
| 261 | + if($obj->uploaded_count) { |
|
| 262 | + $cur_point -= $point * $obj->uploaded_count; |
|
| 263 | + } |
|
| 218 | 264 | // Increase the point |
| 219 | 265 | $this->setPoint($member_srl,$cur_point); |
| 220 | 266 | } |
@@ -229,12 +275,16 @@ discard block |
||
| 229 | 275 | { |
| 230 | 276 | $module_srl = $obj->module_srl; |
| 231 | 277 | $member_srl = $obj->member_srl; |
| 232 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 278 | + if(!$module_srl || !$member_srl) { |
|
| 279 | + return new Object(); |
|
| 280 | + } |
|
| 233 | 281 | // Do not increase the points if the member is the author of the post |
| 234 | 282 | $document_srl = $obj->document_srl; |
| 235 | 283 | $oDocumentModel = getModel('document'); |
| 236 | 284 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 237 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new Object(); |
|
| 285 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
| 286 | + return new Object(); |
|
| 287 | + } |
|
| 238 | 288 | // Get the point module information |
| 239 | 289 | $oModuleModel = getModel('module'); |
| 240 | 290 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -244,7 +294,9 @@ discard block |
||
| 244 | 294 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 245 | 295 | |
| 246 | 296 | $point = $module_config['insert_comment']; |
| 247 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 297 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 298 | + $point = $config->insert_comment; |
|
| 299 | + } |
|
| 248 | 300 | // Increase the point |
| 249 | 301 | $cur_point += $point; |
| 250 | 302 | $this->setPoint($member_srl,$cur_point); |
@@ -264,11 +316,17 @@ discard block |
||
| 264 | 316 | $module_srl = $obj->module_srl; |
| 265 | 317 | $member_srl = abs($obj->member_srl); |
| 266 | 318 | $document_srl = $obj->document_srl; |
| 267 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 319 | + if(!$module_srl || !$member_srl) { |
|
| 320 | + return new Object(); |
|
| 321 | + } |
|
| 268 | 322 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
| 269 | 323 | $oDocument = $oDocumentModel->getDocument($document_srl); |
| 270 | - if(!$oDocument->isExists()) return new Object(); |
|
| 271 | - if($oDocument->get('member_srl')==$member_srl) return new Object(); |
|
| 324 | + if(!$oDocument->isExists()) { |
|
| 325 | + return new Object(); |
|
| 326 | + } |
|
| 327 | + if($oDocument->get('member_srl')==$member_srl) { |
|
| 328 | + return new Object(); |
|
| 329 | + } |
|
| 272 | 330 | // Get the point module information |
| 273 | 331 | $config = $oModuleModel->getModuleConfig('point'); |
| 274 | 332 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -276,9 +334,13 @@ discard block |
||
| 276 | 334 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 277 | 335 | |
| 278 | 336 | $point = $module_config['insert_comment']; |
| 279 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
| 337 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 338 | + $point = $config->insert_comment; |
|
| 339 | + } |
|
| 280 | 340 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
| 281 | - if($point < 0) return new Object(); |
|
| 341 | + if($point < 0) { |
|
| 342 | + return new Object(); |
|
| 343 | + } |
|
| 282 | 344 | // Increase the point |
| 283 | 345 | $cur_point -= $point; |
| 284 | 346 | $this->setPoint($member_srl,$cur_point); |
@@ -301,11 +363,15 @@ discard block |
||
| 301 | 363 | */ |
| 302 | 364 | function triggerDeleteFile(&$obj) |
| 303 | 365 | { |
| 304 | - if($obj->isvalid != 'Y') return new Object(); |
|
| 366 | + if($obj->isvalid != 'Y') { |
|
| 367 | + return new Object(); |
|
| 368 | + } |
|
| 305 | 369 | |
| 306 | 370 | $module_srl = $obj->module_srl; |
| 307 | 371 | $member_srl = $obj->member_srl; |
| 308 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 372 | + if(!$module_srl || !$member_srl) { |
|
| 373 | + return new Object(); |
|
| 374 | + } |
|
| 309 | 375 | // Get the point module information |
| 310 | 376 | $oModuleModel = getModel('module'); |
| 311 | 377 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -315,7 +381,9 @@ discard block |
||
| 315 | 381 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 316 | 382 | |
| 317 | 383 | $point = $module_config['upload_file']; |
| 318 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
| 384 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 385 | + $point = $config->upload_file; |
|
| 386 | + } |
|
| 319 | 387 | // Increase the point |
| 320 | 388 | $cur_point -= $point; |
| 321 | 389 | $this->setPoint($member_srl,$cur_point); |
@@ -331,18 +399,21 @@ discard block |
||
| 331 | 399 | $logged_info = Context::get('logged_info'); |
| 332 | 400 | $member_srl = $logged_info->member_srl; |
| 333 | 401 | $module_srl = $obj->module_srl; |
| 334 | - if(!$module_srl) return new Object(); |
|
| 402 | + if(!$module_srl) { |
|
| 403 | + return new Object(); |
|
| 404 | + } |
|
| 335 | 405 | |
| 336 | 406 | // Pass if it is your file |
| 337 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
| 407 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
| 408 | + return new Object(); |
|
| 409 | + } |
|
| 338 | 410 | $oModuleModel = getModel('module'); |
| 339 | 411 | $config = $oModuleModel->getModuleConfig('point'); |
| 340 | 412 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
| 341 | 413 | if (isset($module_config['download_file'])) |
| 342 | 414 | { |
| 343 | 415 | $point = intval($module_config['download_file']); |
| 344 | - } |
|
| 345 | - else |
|
| 416 | + } else |
|
| 346 | 417 | { |
| 347 | 418 | $point = intval($config->download_file); |
| 348 | 419 | } |
@@ -353,8 +424,7 @@ discard block |
||
| 353 | 424 | if($config->disable_download == 'Y' && $point) |
| 354 | 425 | { |
| 355 | 426 | return new Object(-1,'msg_not_permitted_download'); |
| 356 | - } |
|
| 357 | - else |
|
| 427 | + } else |
|
| 358 | 428 | { |
| 359 | 429 | return new Object(); |
| 360 | 430 | } |
@@ -381,13 +451,19 @@ discard block |
||
| 381 | 451 | { |
| 382 | 452 | // Run only when logged in |
| 383 | 453 | $logged_info = Context::get('logged_info'); |
| 384 | - if(!$logged_info->member_srl) return new Object(); |
|
| 454 | + if(!$logged_info->member_srl) { |
|
| 455 | + return new Object(); |
|
| 456 | + } |
|
| 385 | 457 | $module_srl = $obj->module_srl; |
| 386 | 458 | $member_srl = $logged_info->member_srl; |
| 387 | - if(!$module_srl) return new Object(); |
|
| 459 | + if(!$module_srl) { |
|
| 460 | + return new Object(); |
|
| 461 | + } |
|
| 388 | 462 | |
| 389 | 463 | // Pass if it is your file |
| 390 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new Object(); |
|
| 464 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
| 465 | + return new Object(); |
|
| 466 | + } |
|
| 391 | 467 | |
| 392 | 468 | // Get the point module information |
| 393 | 469 | $oModuleModel = getModel('module'); |
@@ -396,8 +472,7 @@ discard block |
||
| 396 | 472 | if (isset($module_config['download_file'])) |
| 397 | 473 | { |
| 398 | 474 | $point = intval($module_config['download_file']); |
| 399 | - } |
|
| 400 | - else |
|
| 475 | + } else |
|
| 401 | 476 | { |
| 402 | 477 | $point = intval($config->download_file); |
| 403 | 478 | } |
@@ -428,25 +503,32 @@ discard block |
||
| 428 | 503 | // Get the original author number |
| 429 | 504 | $target_member_srl = abs($obj->get('member_srl')); |
| 430 | 505 | // Pass without increasing the hits if the viewer is the same as the author |
| 431 | - if($target_member_srl == $member_srl) return new Object(); |
|
| 506 | + if($target_member_srl == $member_srl) { |
|
| 507 | + return new Object(); |
|
| 508 | + } |
|
| 432 | 509 | // Get the point information for each module |
| 433 | 510 | $config = $oModuleModel->getModuleConfig('point'); |
| 434 | 511 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
| 435 | 512 | // Get hits points |
| 436 | 513 | $point = $module_config['read_document']; |
| 437 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
| 514 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 515 | + $point = $config->read_document; |
|
| 516 | + } |
|
| 438 | 517 | // Pass if there are no requested points |
| 439 | - if(!$point) return new Object(); |
|
| 518 | + if(!$point) { |
|
| 519 | + return new Object(); |
|
| 520 | + } |
|
| 440 | 521 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
| 441 | 522 | if($member_srl) |
| 442 | 523 | { |
| 443 | 524 | $args->member_srl = $member_srl; |
| 444 | 525 | $args->document_srl = $obj->document_srl; |
| 445 | 526 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
| 446 | - if($output->data->count) return new Object(); |
|
| 527 | + if($output->data->count) { |
|
| 528 | + return new Object(); |
|
| 529 | + } |
|
| 447 | 530 | $cur_point = $oPointModel->getPoint($member_srl, true); |
| 448 | - } |
|
| 449 | - else |
|
| 531 | + } else |
|
| 450 | 532 | { |
| 451 | 533 | $cur_point = 0; |
| 452 | 534 | } |
@@ -462,9 +544,13 @@ discard block |
||
| 462 | 544 | return new Object(-1, $message); |
| 463 | 545 | } |
| 464 | 546 | // If not logged in, pass |
| 465 | - if(!$logged_info->member_srl) return new Object(); |
|
| 547 | + if(!$logged_info->member_srl) { |
|
| 548 | + return new Object(); |
|
| 549 | + } |
|
| 466 | 550 | // Pass, if there are no requested points |
| 467 | - if(!$point) return new Object(); |
|
| 551 | + if(!$point) { |
|
| 552 | + return new Object(); |
|
| 553 | + } |
|
| 468 | 554 | // If the read record is missing, leave it |
| 469 | 555 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
| 470 | 556 | // Increase the point |
@@ -481,7 +567,9 @@ discard block |
||
| 481 | 567 | { |
| 482 | 568 | $module_srl = $obj->module_srl; |
| 483 | 569 | $member_srl = $obj->member_srl; |
| 484 | - if(!$module_srl || !$member_srl) return new Object(); |
|
| 570 | + if(!$module_srl || !$member_srl) { |
|
| 571 | + return new Object(); |
|
| 572 | + } |
|
| 485 | 573 | |
| 486 | 574 | $oModuleModel = getModel('module'); |
| 487 | 575 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -493,15 +581,20 @@ discard block |
||
| 493 | 581 | if( $obj->point > 0 ) |
| 494 | 582 | { |
| 495 | 583 | $point = $module_config['voted']; |
| 496 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
| 497 | - } |
|
| 498 | - else |
|
| 584 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 585 | + $point = $config->voted; |
|
| 586 | + } |
|
| 587 | + } else |
|
| 499 | 588 | { |
| 500 | 589 | $point = $module_config['blamed']; |
| 501 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
| 590 | + if(strlen($point) == 0 && !is_int($point)) { |
|
| 591 | + $point = $config->blamed; |
|
| 592 | + } |
|
| 502 | 593 | } |
| 503 | 594 | |
| 504 | - if(!$point) return new Object(); |
|
| 595 | + if(!$point) { |
|
| 596 | + return new Object(); |
|
| 597 | + } |
|
| 505 | 598 | // Increase the point |
| 506 | 599 | $cur_point += $point; |
| 507 | 600 | $this->setPoint($member_srl,$cur_point); |
@@ -516,7 +609,9 @@ discard block |
||
| 516 | 609 | { |
| 517 | 610 | $member_srl = abs($member_srl); |
| 518 | 611 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
| 519 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
| 612 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
| 613 | + $mode = 'update'; |
|
| 614 | + } |
|
| 520 | 615 | |
| 521 | 616 | // Get configuration information |
| 522 | 617 | $oMemberModel = getModel('member'); |
@@ -546,7 +641,9 @@ discard block |
||
| 546 | 641 | $args->point = $point; |
| 547 | 642 | break; |
| 548 | 643 | } |
| 549 | - if($args->point < 0) $args->point = 0; |
|
| 644 | + if($args->point < 0) { |
|
| 645 | + $args->point = 0; |
|
| 646 | + } |
|
| 550 | 647 | $point = $args->point; |
| 551 | 648 | |
| 552 | 649 | // Call a trigger (before) |
@@ -568,8 +665,11 @@ discard block |
||
| 568 | 665 | |
| 569 | 666 | // If there are points, update, if no, insert |
| 570 | 667 | $oPointModel = getModel('point'); |
| 571 | - if($oPointModel->isExistsPoint($member_srl)) executeQuery("point.updatePoint", $args); |
|
| 572 | - else executeQuery("point.insertPoint", $args); |
|
| 668 | + if($oPointModel->isExistsPoint($member_srl)) { |
|
| 669 | + executeQuery("point.updatePoint", $args); |
|
| 670 | + } else { |
|
| 671 | + executeQuery("point.insertPoint", $args); |
|
| 672 | + } |
|
| 573 | 673 | |
| 574 | 674 | // Get a new level |
| 575 | 675 | $level = $oPointModel->getLevel($point, $config->level_step); |
@@ -599,7 +699,9 @@ discard block |
||
| 599 | 699 | foreach($point_group as $group_srl => $target_level) |
| 600 | 700 | { |
| 601 | 701 | $del_group_list[] = $group_srl; |
| 602 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
| 702 | + if($target_level == $level) { |
|
| 703 | + $new_group_list[] = $group_srl; |
|
| 704 | + } |
|
| 603 | 705 | } |
| 604 | 706 | } |
| 605 | 707 | // Otherwise, in case the level is reduced, add the recent group |
@@ -625,7 +727,9 @@ discard block |
||
| 625 | 727 | // Delete the group of a level which is higher than the current level |
| 626 | 728 | foreach($point_group as $group_srl => $target_level) |
| 627 | 729 | { |
| 628 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
| 730 | + if($target_level > $level) { |
|
| 731 | + $del_group_list[] = $group_srl; |
|
| 732 | + } |
|
| 629 | 733 | } |
| 630 | 734 | $del_group_list[] = $default_group->group_srl; |
| 631 | 735 | } |
@@ -636,11 +740,15 @@ discard block |
||
| 636 | 740 | foreach($point_group as $group_srl => $target_level) |
| 637 | 741 | { |
| 638 | 742 | $del_group_list[] = $group_srl; |
| 639 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
| 743 | + if($target_level <= $level) { |
|
| 744 | + $new_group_list[] = $group_srl; |
|
| 745 | + } |
|
| 640 | 746 | } |
| 641 | 747 | } |
| 642 | 748 | // If there is no a new group, granted the default group |
| 643 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
| 749 | + if(!$new_group_list[0]) { |
|
| 750 | + $new_group_list[0] = $default_group->group_srl; |
|
| 751 | + } |
|
| 644 | 752 | // Remove linkage group |
| 645 | 753 | if($del_group_list && count($del_group_list)) |
| 646 | 754 | { |
@@ -85,6 +85,7 @@ |
||
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * @brief Delete the poll (when several questions are registered in one poll, delete this question) |
| 88 | + * @param string $poll_index_srl |
|
| 88 | 89 | */ |
| 89 | 90 | function deletePollTitle($poll_index_srl) |
| 90 | 91 | { |
@@ -40,22 +40,22 @@ discard block |
||
| 40 | 40 | // Display an error no post is selected |
| 41 | 41 | $cart = Context::get('cart'); |
| 42 | 42 | |
| 43 | - if(is_array($cart)) $poll_srl_list = $cart; |
|
| 44 | - else $poll_srl_list= explode('|@|', $cart); |
|
| 43 | + if (is_array($cart)) $poll_srl_list = $cart; |
|
| 44 | + else $poll_srl_list = explode('|@|', $cart); |
|
| 45 | 45 | |
| 46 | 46 | $poll_count = count($poll_srl_list); |
| 47 | - if(!$poll_count) return $this->stop('msg_cart_is_null'); |
|
| 47 | + if (!$poll_count) return $this->stop('msg_cart_is_null'); |
|
| 48 | 48 | // Delete the post |
| 49 | - for($i=0;$i<$poll_count;$i++) |
|
| 49 | + for ($i = 0; $i < $poll_count; $i++) |
|
| 50 | 50 | { |
| 51 | 51 | $poll_index_srl = trim($poll_srl_list[$i]); |
| 52 | - if(!$poll_index_srl) continue; |
|
| 52 | + if (!$poll_index_srl) continue; |
|
| 53 | 53 | |
| 54 | 54 | $output = $this->deletePollTitle($poll_index_srl, true); |
| 55 | - if(!$output->toBool()) return $output; |
|
| 55 | + if (!$output->toBool()) return $output; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) ); |
|
| 58 | + $this->setMessage(sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count)); |
|
| 59 | 59 | |
| 60 | 60 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList'); |
| 61 | 61 | $this->setRedirectUrl($returnUrl); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | function procPollAdminAddCart() |
| 65 | 65 | { |
| 66 | - $poll_index_srl = (int)Context::get('poll_index_srl'); |
|
| 66 | + $poll_index_srl = (int) Context::get('poll_index_srl'); |
|
| 67 | 67 | |
| 68 | 68 | $oPollAdminModel = getAdminModel('poll'); |
| 69 | 69 | //$columnList = array('comment_srl'); |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | $output = $oPollAdminModel->getPollList($args); |
| 75 | 75 | |
| 76 | - if(is_array($output->data)) |
|
| 76 | + if (is_array($output->data)) |
|
| 77 | 77 | { |
| 78 | - foreach($output->data AS $key=>$value) |
|
| 78 | + foreach ($output->data AS $key=>$value) |
|
| 79 | 79 | { |
| 80 | - if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
| 80 | + if ($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
| 81 | 81 | else $_SESSION['poll_management'][$value->poll_index_srl] = true; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -97,36 +97,36 @@ discard block |
||
| 97 | 97 | $oDB->begin(); |
| 98 | 98 | |
| 99 | 99 | $output = executeQueryArray('poll.getPollByDeletePollTitle', $args); |
| 100 | - if($output->toBool() && $output->data && $output->data[0]->count == 1) |
|
| 100 | + if ($output->toBool() && $output->data && $output->data[0]->count == 1) |
|
| 101 | 101 | { |
| 102 | 102 | $dargs->poll_srl = $output->data[0]->poll_srl; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | $output = $oDB->executeQuery('poll.deletePollTitle', $args); |
| 106 | - if(!$output) |
|
| 106 | + if (!$output) |
|
| 107 | 107 | { |
| 108 | 108 | $oDB->rollback(); |
| 109 | 109 | return $output; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $output = $oDB->executeQuery('poll.deletePollItem', $args); |
| 113 | - if(!$output) |
|
| 113 | + if (!$output) |
|
| 114 | 114 | { |
| 115 | 115 | $oDB->rollback(); |
| 116 | 116 | return $output; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if($dargs->poll_srl) |
|
| 119 | + if ($dargs->poll_srl) |
|
| 120 | 120 | { |
| 121 | 121 | $output = executeQuery('poll.deletePoll', $dargs); |
| 122 | - if(!$output) |
|
| 122 | + if (!$output) |
|
| 123 | 123 | { |
| 124 | 124 | $oDB->rollback(); |
| 125 | 125 | return $output; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | $output = executeQuery('poll.deletePollLog', $dargs); |
| 129 | - if(!$output) |
|
| 129 | + if (!$output) |
|
| 130 | 130 | { |
| 131 | 131 | $oDB->rollback(); |
| 132 | 132 | return $output; |
@@ -149,21 +149,21 @@ discard block |
||
| 149 | 149 | $oDB->begin(); |
| 150 | 150 | |
| 151 | 151 | $output = $oDB->executeQuery('poll.deletePoll', $args); |
| 152 | - if(!$output) |
|
| 152 | + if (!$output) |
|
| 153 | 153 | { |
| 154 | 154 | $oDB->rollback(); |
| 155 | 155 | return $output; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $output = $oDB->executeQuery('poll.deletePollTitle', $args); |
| 159 | - if(!$output) |
|
| 159 | + if (!$output) |
|
| 160 | 160 | { |
| 161 | 161 | $oDB->rollback(); |
| 162 | 162 | return $output; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $output = $oDB->executeQuery('poll.deletePollItem', $args); |
| 166 | - if(!$output) |
|
| 166 | + if (!$output) |
|
| 167 | 167 | { |
| 168 | 168 | $oDB->rollback(); |
| 169 | 169 | return $output; |
@@ -40,19 +40,28 @@ discard block |
||
| 40 | 40 | // Display an error no post is selected |
| 41 | 41 | $cart = Context::get('cart'); |
| 42 | 42 | |
| 43 | - if(is_array($cart)) $poll_srl_list = $cart; |
|
| 44 | - else $poll_srl_list= explode('|@|', $cart); |
|
| 43 | + if(is_array($cart)) { |
|
| 44 | + $poll_srl_list = $cart; |
|
| 45 | + } else { |
|
| 46 | + $poll_srl_list= explode('|@|', $cart); |
|
| 47 | + } |
|
| 45 | 48 | |
| 46 | 49 | $poll_count = count($poll_srl_list); |
| 47 | - if(!$poll_count) return $this->stop('msg_cart_is_null'); |
|
| 50 | + if(!$poll_count) { |
|
| 51 | + return $this->stop('msg_cart_is_null'); |
|
| 52 | + } |
|
| 48 | 53 | // Delete the post |
| 49 | 54 | for($i=0;$i<$poll_count;$i++) |
| 50 | 55 | { |
| 51 | 56 | $poll_index_srl = trim($poll_srl_list[$i]); |
| 52 | - if(!$poll_index_srl) continue; |
|
| 57 | + if(!$poll_index_srl) { |
|
| 58 | + continue; |
|
| 59 | + } |
|
| 53 | 60 | |
| 54 | 61 | $output = $this->deletePollTitle($poll_index_srl, true); |
| 55 | - if(!$output->toBool()) return $output; |
|
| 62 | + if(!$output->toBool()) { |
|
| 63 | + return $output; |
|
| 64 | + } |
|
| 56 | 65 | } |
| 57 | 66 | |
| 58 | 67 | $this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) ); |
@@ -77,8 +86,11 @@ discard block |
||
| 77 | 86 | { |
| 78 | 87 | foreach($output->data AS $key=>$value) |
| 79 | 88 | { |
| 80 | - if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
| 81 | - else $_SESSION['poll_management'][$value->poll_index_srl] = true; |
|
| 89 | + if($_SESSION['poll_management'][$value->poll_index_srl]) { |
|
| 90 | + unset($_SESSION['poll_management'][$value->poll_index_srl]); |
|
| 91 | + } else { |
|
| 92 | + $_SESSION['poll_management'][$value->poll_index_srl] = true; |
|
| 93 | + } |
|
| 82 | 94 | } |
| 83 | 95 | } |
| 84 | 96 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | /** |
| 111 | 111 | * RSS Module configurations |
| 112 | 112 | * |
| 113 | - * @return void |
|
| 113 | + * @return Object|null |
|
| 114 | 114 | */ |
| 115 | 115 | function procRssAdminInsertModuleConfig() |
| 116 | 116 | { |
@@ -27,41 +27,41 @@ discard block |
||
| 27 | 27 | $total_config = $oModuleModel->getModuleConfig('rss'); |
| 28 | 28 | |
| 29 | 29 | $config_vars = Context::getRequestVars(); |
| 30 | - $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
|
| 30 | + $config_vars->feed_document_count = (int) $config_vars->feed_document_count; |
|
| 31 | 31 | |
| 32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
| 33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
| 32 | + if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
| 33 | + if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y'; |
|
| 34 | 34 | |
| 35 | - if($config_vars->image || $config_vars->del_image) |
|
| 35 | + if ($config_vars->image || $config_vars->del_image) |
|
| 36 | 36 | { |
| 37 | 37 | $image_obj = $config_vars->image; |
| 38 | 38 | $config_vars->image = $total_config->image; |
| 39 | 39 | // Get a variable for the delete request |
| 40 | - if($config_vars->del_image == 'Y' || $image_obj) |
|
| 40 | + if ($config_vars->del_image == 'Y' || $image_obj) |
|
| 41 | 41 | { |
| 42 | 42 | FileHandler::removeFile($config_vars->image); |
| 43 | 43 | $config_vars->image = ''; |
| 44 | 44 | $total_config->image = ''; |
| 45 | 45 | } |
| 46 | 46 | // Ignore if the file is not the one which has been successfully uploaded |
| 47 | - if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
| 47 | + if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name'])) |
|
| 48 | 48 | { |
| 49 | 49 | // Ignore if the file is not an image |
| 50 | 50 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
| 51 | 51 | |
| 52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
| 52 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
| 53 | 53 | else |
| 54 | 54 | { |
| 55 | 55 | // Upload the file to a path |
| 56 | 56 | $path = './files/attach/images/rss/'; |
| 57 | 57 | // Create a directory |
| 58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
| 58 | + if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
| 59 | 59 | else |
| 60 | 60 | { |
| 61 | 61 | $filename = $path.$image_obj['name']; |
| 62 | 62 | |
| 63 | 63 | // Move the file |
| 64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
| 64 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
| 65 | 65 | else |
| 66 | 66 | { |
| 67 | 67 | $config_vars->image = $filename; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
| 73 | + if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
| 74 | 74 | |
| 75 | 75 | $output = $this->setFeedConfig($config_vars); |
| 76 | 76 | |
| 77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
| 77 | + if (!$alt_message) $alt_message = 'success_updated'; |
|
| 78 | 78 | |
| 79 | 79 | $alt_message = Context::getLang($alt_message); |
| 80 | 80 | $this->setMessage($alt_message, 'info'); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $originConfig = $oModuleModel->getModuleConfig('rss'); |
| 97 | 97 | |
| 98 | 98 | // Get a variable for the delete request |
| 99 | - if($delImage == 'Y') |
|
| 99 | + if ($delImage == 'Y') |
|
| 100 | 100 | { |
| 101 | 101 | FileHandler::removeFile($originConfig->image); |
| 102 | 102 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $feedCopyrightList = $config_vars->feed_copyright; |
| 123 | 123 | $targetModuleSrl = $config_vars->target_module_srl; |
| 124 | 124 | |
| 125 | - if($targetModuleSrl && !is_array($openRssList)) |
|
| 125 | + if ($targetModuleSrl && !is_array($openRssList)) |
|
| 126 | 126 | { |
| 127 | 127 | $openRssList = array($targetModuleSrl => $openRssList); |
| 128 | 128 | $openTotalFeedList = array($targetModuleSrl => $openTotalFeedList); |
@@ -130,16 +130,16 @@ discard block |
||
| 130 | 130 | $feedCopyrightList = array($targetModuleSrl => $feedCopyrightList); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if(is_array($openRssList)) |
|
| 133 | + if (is_array($openRssList)) |
|
| 134 | 134 | { |
| 135 | - foreach($openRssList AS $module_srl=>$open_rss) |
|
| 135 | + foreach ($openRssList AS $module_srl=>$open_rss) |
|
| 136 | 136 | { |
| 137 | - if(!$module_srl || !$open_rss) |
|
| 137 | + if (!$module_srl || !$open_rss) |
|
| 138 | 138 | { |
| 139 | 139 | return new Object(-1, 'msg_invalid_request'); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
| 142 | + if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N'; |
|
| 143 | 143 | |
| 144 | 144 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
| 145 | 145 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | function setFeedConfig($config) |
| 162 | 162 | { |
| 163 | 163 | $oModuleController = getController('module'); |
| 164 | - $oModuleController->insertModuleConfig('rss',$config); |
|
| 164 | + $oModuleController->insertModuleConfig('rss', $config); |
|
| 165 | 165 | return new Object(); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | $config = new stdClass; |
| 182 | 182 | $config->open_rss = $open_rss; |
| 183 | 183 | $config->open_total_feed = $open_total_feed; |
| 184 | - if($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
| 185 | - if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
| 186 | - $oModuleController->insertModulePartConfig('rss',$module_srl,$config); |
|
| 184 | + if ($feed_description != 'N') { $config->feed_description = $feed_description; } |
|
| 185 | + if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; } |
|
| 186 | + $oModuleController->insertModulePartConfig('rss', $module_srl, $config); |
|
| 187 | 187 | return new Object(); |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -29,8 +29,12 @@ discard block |
||
| 29 | 29 | $config_vars = Context::getRequestVars(); |
| 30 | 30 | $config_vars->feed_document_count = (int)$config_vars->feed_document_count; |
| 31 | 31 | |
| 32 | - if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request'; |
|
| 33 | - if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y'; |
|
| 32 | + if(!$config_vars->use_total_feed) { |
|
| 33 | + $alt_message = 'msg_invalid_request'; |
|
| 34 | + } |
|
| 35 | + if(!in_array($config_vars->use_total_feed, array('Y','N'))) { |
|
| 36 | + $config_vars->open_rss = 'Y'; |
|
| 37 | + } |
|
| 34 | 38 | |
| 35 | 39 | if($config_vars->image || $config_vars->del_image) |
| 36 | 40 | { |
@@ -49,20 +53,23 @@ discard block |
||
| 49 | 53 | // Ignore if the file is not an image |
| 50 | 54 | $image_obj['name'] = Context::convertEncodingStr($image_obj['name']); |
| 51 | 55 | |
| 52 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format'; |
|
| 53 | - else |
|
| 56 | + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { |
|
| 57 | + $alt_message = 'msg_rss_invalid_image_format'; |
|
| 58 | + } else |
|
| 54 | 59 | { |
| 55 | 60 | // Upload the file to a path |
| 56 | 61 | $path = './files/attach/images/rss/'; |
| 57 | 62 | // Create a directory |
| 58 | - if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured'; |
|
| 59 | - else |
|
| 63 | + if(!FileHandler::makeDir($path)) { |
|
| 64 | + $alt_message = 'msg_error_occured'; |
|
| 65 | + } else |
|
| 60 | 66 | { |
| 61 | 67 | $filename = $path.$image_obj['name']; |
| 62 | 68 | |
| 63 | 69 | // Move the file |
| 64 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured'; |
|
| 65 | - else |
|
| 70 | + if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { |
|
| 71 | + $alt_message = 'msg_error_occured'; |
|
| 72 | + } else |
|
| 66 | 73 | { |
| 67 | 74 | $config_vars->image = $filename; |
| 68 | 75 | } |
@@ -70,11 +77,15 @@ discard block |
||
| 70 | 77 | } |
| 71 | 78 | } |
| 72 | 79 | } |
| 73 | - if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image; |
|
| 80 | + if(!$config_vars->image && $config_vars->del_image != 'Y') { |
|
| 81 | + $config_vars->image = $total_config->image; |
|
| 82 | + } |
|
| 74 | 83 | |
| 75 | 84 | $output = $this->setFeedConfig($config_vars); |
| 76 | 85 | |
| 77 | - if(!$alt_message) $alt_message = 'success_updated'; |
|
| 86 | + if(!$alt_message) { |
|
| 87 | + $alt_message = 'success_updated'; |
|
| 88 | + } |
|
| 78 | 89 | |
| 79 | 90 | $alt_message = Context::getLang($alt_message); |
| 80 | 91 | $this->setMessage($alt_message, 'info'); |
@@ -139,7 +150,9 @@ discard block |
||
| 139 | 150 | return new Object(-1, 'msg_invalid_request'); |
| 140 | 151 | } |
| 141 | 152 | |
| 142 | - if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N'; |
|
| 153 | + if(!in_array($open_rss, array('Y','H','N'))) { |
|
| 154 | + $open_rss = 'N'; |
|
| 155 | + } |
|
| 143 | 156 | |
| 144 | 157 | $this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]); |
| 145 | 158 | } |
@@ -98,6 +98,7 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * @brief Delete IP |
| 100 | 100 | * Remove the IP address which was previously registered as a spammers |
| 101 | + * @param string $ipaddress |
|
| 101 | 102 | */ |
| 102 | 103 | function deleteIP($ipaddress) |
| 103 | 104 | { |
@@ -111,6 +112,7 @@ discard block |
||
| 111 | 112 | /** |
| 112 | 113 | * @brief Register the spam word |
| 113 | 114 | * The post, which contains the newly registered spam word, should be considered as a spam |
| 115 | + * @param string $word_list |
|
| 114 | 116 | */ |
| 115 | 117 | function insertWord($word_list) |
| 116 | 118 | { |
@@ -141,6 +143,7 @@ discard block |
||
| 141 | 143 | /** |
| 142 | 144 | * @brief Remove the spam word |
| 143 | 145 | * Remove the word which was previously registered as a spam word |
| 146 | + * @param string $word |
|
| 144 | 147 | */ |
| 145 | 148 | function deleteWord($word) |
| 146 | 149 | { |
@@ -20,12 +20,18 @@ discard block |
||
| 20 | 20 | $argsConfig = Context::gets('limits','check_trackback'); |
| 21 | 21 | $flag = Context::get('flag'); |
| 22 | 22 | //interval, limit_count |
| 23 | - if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N'; |
|
| 24 | - if($argsConfig->limits!='Y') $argsConfig->limits = 'N'; |
|
| 23 | + if($argsConfig->check_trackback!='Y') { |
|
| 24 | + $argsConfig->check_trackback = 'N'; |
|
| 25 | + } |
|
| 26 | + if($argsConfig->limits!='Y') { |
|
| 27 | + $argsConfig->limits = 'N'; |
|
| 28 | + } |
|
| 25 | 29 | // Create and insert the module Controller object |
| 26 | 30 | $oModuleController = getController('module'); |
| 27 | 31 | $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig); |
| 28 | - if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput; |
|
| 32 | + if(!$moduleConfigOutput->toBool()) { |
|
| 33 | + return $moduleConfigOutput; |
|
| 34 | + } |
|
| 29 | 35 | |
| 30 | 36 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock'); |
| 31 | 37 | $this->setRedirectUrl($returnUrl); |
@@ -39,9 +45,13 @@ discard block |
||
| 39 | 45 | if($ipaddress_list) |
| 40 | 46 | { |
| 41 | 47 | $output = $oSpamfilterController->insertIP($ipaddress_list); |
| 42 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
| 48 | + if(!$output->toBool() && !$output->get('fail_list')) { |
|
| 49 | + return $output; |
|
| 50 | + } |
|
| 43 | 51 | |
| 44 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
| 52 | + if($output->get('fail_list')) { |
|
| 53 | + $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
| 54 | + } |
|
| 45 | 55 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
| 46 | 56 | } |
| 47 | 57 | |
@@ -57,9 +67,13 @@ discard block |
||
| 57 | 67 | if($word_list) |
| 58 | 68 | { |
| 59 | 69 | $output = $this->insertWord($word_list); |
| 60 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
| 70 | + if(!$output->toBool() && !$output->get('fail_list')) { |
|
| 71 | + return $output; |
|
| 72 | + } |
|
| 61 | 73 | |
| 62 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
| 74 | + if($output->get('fail_list')) { |
|
| 75 | + $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
| 76 | + } |
|
| 63 | 77 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
| 64 | 78 | } |
| 65 | 79 | |
@@ -73,7 +87,9 @@ discard block |
||
| 73 | 87 | function procSpamfilterAdminDeleteDeniedIP() |
| 74 | 88 | { |
| 75 | 89 | $ipAddressList = Context::get('ipaddress'); |
| 76 | - if($ipAddressList) $this->deleteIP($ipAddressList); |
|
| 90 | + if($ipAddressList) { |
|
| 91 | + $this->deleteIP($ipAddressList); |
|
| 92 | + } |
|
| 77 | 93 | |
| 78 | 94 | $this->setMessage(Context::getLang('success_deleted')); |
| 79 | 95 | |
@@ -101,7 +117,9 @@ discard block |
||
| 101 | 117 | */ |
| 102 | 118 | function deleteIP($ipaddress) |
| 103 | 119 | { |
| 104 | - if(!$ipaddress) return; |
|
| 120 | + if(!$ipaddress) { |
|
| 121 | + return; |
|
| 122 | + } |
|
| 105 | 123 | |
| 106 | 124 | $args = new stdClass; |
| 107 | 125 | $args->ipaddress = $ipaddress; |
@@ -130,9 +148,13 @@ discard block |
||
| 130 | 148 | foreach($word_list as $word) |
| 131 | 149 | { |
| 132 | 150 | $args = new stdClass; |
| 133 | - if(trim($word)) $args->word = $word; |
|
| 151 | + if(trim($word)) { |
|
| 152 | + $args->word = $word; |
|
| 153 | + } |
|
| 134 | 154 | $output = executeQuery('spamfilter.insertDeniedWord', $args); |
| 135 | - if(!$output->toBool()) $fail_word .= $word.'<br />'; |
|
| 155 | + if(!$output->toBool()) { |
|
| 156 | + $fail_word .= $word.'<br />'; |
|
| 157 | + } |
|
| 136 | 158 | } |
| 137 | 159 | $output->add('fail_list',$fail_word); |
| 138 | 160 | return $output; |
@@ -144,7 +166,9 @@ discard block |
||
| 144 | 166 | */ |
| 145 | 167 | function deleteWord($word) |
| 146 | 168 | { |
| 147 | - if(!$word) return; |
|
| 169 | + if(!$word) { |
|
| 170 | + return; |
|
| 171 | + } |
|
| 148 | 172 | $args = new stdClass; |
| 149 | 173 | $args->word = $word; |
| 150 | 174 | return executeQuery('spamfilter.deleteDeniedWord', $args); |
@@ -17,15 +17,15 @@ discard block |
||
| 17 | 17 | function procSpamfilterAdminInsertConfig() |
| 18 | 18 | { |
| 19 | 19 | // Get the default information |
| 20 | - $argsConfig = Context::gets('limits','check_trackback'); |
|
| 20 | + $argsConfig = Context::gets('limits', 'check_trackback'); |
|
| 21 | 21 | $flag = Context::get('flag'); |
| 22 | 22 | //interval, limit_count |
| 23 | - if($argsConfig->check_trackback!='Y') $argsConfig->check_trackback = 'N'; |
|
| 24 | - if($argsConfig->limits!='Y') $argsConfig->limits = 'N'; |
|
| 23 | + if ($argsConfig->check_trackback != 'Y') $argsConfig->check_trackback = 'N'; |
|
| 24 | + if ($argsConfig->limits != 'Y') $argsConfig->limits = 'N'; |
|
| 25 | 25 | // Create and insert the module Controller object |
| 26 | 26 | $oModuleController = getController('module'); |
| 27 | - $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter',$argsConfig); |
|
| 28 | - if(!$moduleConfigOutput->toBool()) return $moduleConfigOutput; |
|
| 27 | + $moduleConfigOutput = $oModuleController->insertModuleConfig('spamfilter', $argsConfig); |
|
| 28 | + if (!$moduleConfigOutput->toBool()) return $moduleConfigOutput; |
|
| 29 | 29 | |
| 30 | 30 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminConfigBlock'); |
| 31 | 31 | $this->setRedirectUrl($returnUrl); |
@@ -36,12 +36,12 @@ discard block |
||
| 36 | 36 | //스팸IP 추가 |
| 37 | 37 | $ipaddress_list = Context::get('ipaddress_list'); |
| 38 | 38 | $oSpamfilterController = getController('spamfilter'); |
| 39 | - if($ipaddress_list) |
|
| 39 | + if ($ipaddress_list) |
|
| 40 | 40 | { |
| 41 | 41 | $output = $oSpamfilterController->insertIP($ipaddress_list); |
| 42 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
| 42 | + if (!$output->toBool() && !$output->get('fail_list')) return $output; |
|
| 43 | 43 | |
| 44 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
| 44 | + if ($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')).'</em>'; |
|
| 45 | 45 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | //스팸 키워드 추가 |
| 56 | 56 | $word_list = Context::get('word_list'); |
| 57 | - if($word_list) |
|
| 57 | + if ($word_list) |
|
| 58 | 58 | { |
| 59 | 59 | $output = $this->insertWord($word_list); |
| 60 | - if(!$output->toBool() && !$output->get('fail_list')) return $output; |
|
| 60 | + if (!$output->toBool() && !$output->get('fail_list')) return $output; |
|
| 61 | 61 | |
| 62 | - if($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'),$output->get('fail_list')).'</em>'; |
|
| 62 | + if ($output->get('fail_list')) $message_fail = '<em>'.sprintf(Context::getLang('msg_faillist'), $output->get('fail_list')).'</em>'; |
|
| 63 | 63 | $this->setMessage(Context::getLang('success_registed').$message_fail); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | function procSpamfilterAdminDeleteDeniedIP() |
| 74 | 74 | { |
| 75 | 75 | $ipAddressList = Context::get('ipaddress'); |
| 76 | - if($ipAddressList) $this->deleteIP($ipAddressList); |
|
| 76 | + if ($ipAddressList) $this->deleteIP($ipAddressList); |
|
| 77 | 77 | |
| 78 | 78 | $this->setMessage(Context::getLang('success_deleted')); |
| 79 | 79 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $this->setMessage(Context::getLang('success_deleted')); |
| 93 | 93 | |
| 94 | - $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList','active','word'); |
|
| 94 | + $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispSpamfilterAdminDeniedWordList', 'active', 'word'); |
|
| 95 | 95 | return $this->setRedirectUrl($returnUrl); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | function deleteIP($ipaddress) |
| 103 | 103 | { |
| 104 | - if(!$ipaddress) return; |
|
| 104 | + if (!$ipaddress) return; |
|
| 105 | 105 | |
| 106 | 106 | $args = new stdClass; |
| 107 | 107 | $args->ipaddress = $ipaddress; |
@@ -115,26 +115,26 @@ discard block |
||
| 115 | 115 | function insertWord($word_list) |
| 116 | 116 | { |
| 117 | 117 | |
| 118 | - $word_list = str_replace("\r","",$word_list); |
|
| 119 | - $word_list = explode("\n",$word_list); |
|
| 118 | + $word_list = str_replace("\r", "", $word_list); |
|
| 119 | + $word_list = explode("\n", $word_list); |
|
| 120 | 120 | |
| 121 | - foreach($word_list as $word) |
|
| 121 | + foreach ($word_list as $word) |
|
| 122 | 122 | { |
| 123 | - if(!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word)) |
|
| 123 | + if (!preg_match("/^(.{2,40}[\r\n]+)*.{2,40}$/", $word)) |
|
| 124 | 124 | { |
| 125 | 125 | return new Object(-1, 'msg_invalid'); |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | $fail_word = ''; |
| 130 | - foreach($word_list as $word) |
|
| 130 | + foreach ($word_list as $word) |
|
| 131 | 131 | { |
| 132 | 132 | $args = new stdClass; |
| 133 | - if(trim($word)) $args->word = $word; |
|
| 133 | + if (trim($word)) $args->word = $word; |
|
| 134 | 134 | $output = executeQuery('spamfilter.insertDeniedWord', $args); |
| 135 | - if(!$output->toBool()) $fail_word .= $word.'<br />'; |
|
| 135 | + if (!$output->toBool()) $fail_word .= $word.'<br />'; |
|
| 136 | 136 | } |
| 137 | - $output->add('fail_list',$fail_word); |
|
| 137 | + $output->add('fail_list', $fail_word); |
|
| 138 | 138 | return $output; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | function deleteWord($word) |
| 146 | 146 | { |
| 147 | - if(!$word) return; |
|
| 147 | + if (!$word) return; |
|
| 148 | 148 | $args = new stdClass; |
| 149 | 149 | $args->word = $word; |
| 150 | 150 | return executeQuery('spamfilter.deleteDeniedWord', $args); |
@@ -161,6 +161,8 @@ |
||
| 161 | 161 | /** |
| 162 | 162 | * @brief IP registration |
| 163 | 163 | * The registered IP address is considered as a spammer |
| 164 | + * @param string $ipaddress_list |
|
| 165 | + * @param string $description |
|
| 164 | 166 | */ |
| 165 | 167 | function insertIP($ipaddress_list, $description = null) |
| 166 | 168 | { |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function triggerInsertDocument(&$obj) |
| 29 | 29 | { |
| 30 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 30 | + if($_SESSION['avoid_log']) { |
|
| 31 | + return new Object(); |
|
| 32 | + } |
|
| 31 | 33 | // Check the login status, login information, and permission |
| 32 | 34 | $is_logged = Context::get('is_logged'); |
| 33 | 35 | $logged_info = Context::get('logged_info'); |
@@ -35,31 +37,40 @@ discard block |
||
| 35 | 37 | // In case logged in, check if it is an administrator |
| 36 | 38 | if($is_logged) |
| 37 | 39 | { |
| 38 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
| 39 | - if($grant->manager) return new Object(); |
|
| 40 | + if($logged_info->is_admin == 'Y') { |
|
| 41 | + return new Object(); |
|
| 42 | + } |
|
| 43 | + if($grant->manager) { |
|
| 44 | + return new Object(); |
|
| 45 | + } |
|
| 40 | 46 | } |
| 41 | 47 | |
| 42 | 48 | $oFilterModel = getModel('spamfilter'); |
| 43 | 49 | // Check if the IP is prohibited |
| 44 | 50 | $output = $oFilterModel->isDeniedIP(); |
| 45 | - if(!$output->toBool()) return $output; |
|
| 51 | + if(!$output->toBool()) { |
|
| 52 | + return $output; |
|
| 53 | + } |
|
| 46 | 54 | // Check if there is a ban on the word |
| 47 | 55 | $text = ''; |
| 48 | 56 | if($is_logged) |
| 49 | 57 | { |
| 50 | 58 | $text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags; |
| 51 | - } |
|
| 52 | - else |
|
| 59 | + } else |
|
| 53 | 60 | { |
| 54 | 61 | $text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags; |
| 55 | 62 | } |
| 56 | 63 | $output = $oFilterModel->isDeniedWord($text); |
| 57 | - if(!$output->toBool()) return $output; |
|
| 64 | + if(!$output->toBool()) { |
|
| 65 | + return $output; |
|
| 66 | + } |
|
| 58 | 67 | // Check the specified time beside the modificaiton time |
| 59 | 68 | if($obj->document_srl == 0) |
| 60 | 69 | { |
| 61 | 70 | $output = $oFilterModel->checkLimited(); |
| 62 | - if(!$output->toBool()) return $output; |
|
| 71 | + if(!$output->toBool()) { |
|
| 72 | + return $output; |
|
| 73 | + } |
|
| 63 | 74 | } |
| 64 | 75 | // Save a log |
| 65 | 76 | $this->insertLog(); |
@@ -72,7 +83,9 @@ discard block |
||
| 72 | 83 | */ |
| 73 | 84 | function triggerInsertComment(&$obj) |
| 74 | 85 | { |
| 75 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 86 | + if($_SESSION['avoid_log']) { |
|
| 87 | + return new Object(); |
|
| 88 | + } |
|
| 76 | 89 | // Check the login status, login information, and permission |
| 77 | 90 | $is_logged = Context::get('is_logged'); |
| 78 | 91 | $logged_info = Context::get('logged_info'); |
@@ -80,31 +93,40 @@ discard block |
||
| 80 | 93 | // In case logged in, check if it is an administrator |
| 81 | 94 | if($is_logged) |
| 82 | 95 | { |
| 83 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
| 84 | - if($grant->manager) return new Object(); |
|
| 96 | + if($logged_info->is_admin == 'Y') { |
|
| 97 | + return new Object(); |
|
| 98 | + } |
|
| 99 | + if($grant->manager) { |
|
| 100 | + return new Object(); |
|
| 101 | + } |
|
| 85 | 102 | } |
| 86 | 103 | |
| 87 | 104 | $oFilterModel = getModel('spamfilter'); |
| 88 | 105 | // Check if the IP is prohibited |
| 89 | 106 | $output = $oFilterModel->isDeniedIP(); |
| 90 | - if(!$output->toBool()) return $output; |
|
| 107 | + if(!$output->toBool()) { |
|
| 108 | + return $output; |
|
| 109 | + } |
|
| 91 | 110 | // Check if there is a ban on the word |
| 92 | 111 | $text = ''; |
| 93 | 112 | if($is_logged) |
| 94 | 113 | { |
| 95 | 114 | $text = $obj->content; |
| 96 | - } |
|
| 97 | - else |
|
| 115 | + } else |
|
| 98 | 116 | { |
| 99 | 117 | $text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage; |
| 100 | 118 | } |
| 101 | 119 | $output = $oFilterModel->isDeniedWord($text); |
| 102 | - if(!$output->toBool()) return $output; |
|
| 120 | + if(!$output->toBool()) { |
|
| 121 | + return $output; |
|
| 122 | + } |
|
| 103 | 123 | // If the specified time check is not modified |
| 104 | 124 | if(!$obj->__isupdate) |
| 105 | 125 | { |
| 106 | 126 | $output = $oFilterModel->checkLimited(); |
| 107 | - if(!$output->toBool()) return $output; |
|
| 127 | + if(!$output->toBool()) { |
|
| 128 | + return $output; |
|
| 129 | + } |
|
| 108 | 130 | } |
| 109 | 131 | unset($obj->__isupdate); |
| 110 | 132 | // Save a log |
@@ -118,20 +140,28 @@ discard block |
||
| 118 | 140 | */ |
| 119 | 141 | function triggerInsertTrackback(&$obj) |
| 120 | 142 | { |
| 121 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 143 | + if($_SESSION['avoid_log']) { |
|
| 144 | + return new Object(); |
|
| 145 | + } |
|
| 122 | 146 | |
| 123 | 147 | $oFilterModel = getModel('spamfilter'); |
| 124 | 148 | // Confirm if the trackbacks have been added more than once to your document |
| 125 | 149 | $output = $oFilterModel->isInsertedTrackback($obj->document_srl); |
| 126 | - if(!$output->toBool()) return $output; |
|
| 150 | + if(!$output->toBool()) { |
|
| 151 | + return $output; |
|
| 152 | + } |
|
| 127 | 153 | |
| 128 | 154 | // Check if the IP is prohibited |
| 129 | 155 | $output = $oFilterModel->isDeniedIP(); |
| 130 | - if(!$output->toBool()) return $output; |
|
| 156 | + if(!$output->toBool()) { |
|
| 157 | + return $output; |
|
| 158 | + } |
|
| 131 | 159 | // Check if there is a ban on the word |
| 132 | 160 | $text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url; |
| 133 | 161 | $output = $oFilterModel->isDeniedWord($text); |
| 134 | - if(!$output->toBool()) return $output; |
|
| 162 | + if(!$output->toBool()) { |
|
| 163 | + return $output; |
|
| 164 | + } |
|
| 135 | 165 | // Start Filtering |
| 136 | 166 | $oTrackbackModel = getModel('trackback'); |
| 137 | 167 | $oTrackbackController = getController('trackback'); |
@@ -165,7 +195,9 @@ discard block |
||
| 165 | 195 | function insertIP($ipaddress_list, $description = null) |
| 166 | 196 | { |
| 167 | 197 | $regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/"; |
| 168 | - if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid'); |
|
| 198 | + if(!preg_match($regExr,$ipaddress_list)) { |
|
| 199 | + return new Object(-1, 'msg_invalid'); |
|
| 200 | + } |
|
| 169 | 201 | $ipaddress_list = str_replace("\r","",$ipaddress_list); |
| 170 | 202 | $ipaddress_list = explode("\n",$ipaddress_list); |
| 171 | 203 | foreach($ipaddress_list as $ipaddressValue) |
@@ -175,11 +207,16 @@ discard block |
||
| 175 | 207 | if($ipaddress=trim($matches[1])) |
| 176 | 208 | { |
| 177 | 209 | $args->ipaddress = $ipaddress; |
| 178 | - if(!$description && $matches[4]) $args->description = $matches[4]; |
|
| 179 | - else $args->description = $description; |
|
| 210 | + if(!$description && $matches[4]) { |
|
| 211 | + $args->description = $matches[4]; |
|
| 212 | + } else { |
|
| 213 | + $args->description = $description; |
|
| 214 | + } |
|
| 180 | 215 | } |
| 181 | 216 | $output = executeQuery('spamfilter.insertDeniedIP', $args); |
| 182 | - if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>'; |
|
| 217 | + if(!$output->toBool()) { |
|
| 218 | + $fail_list .= $ipaddress.'<br/>'; |
|
| 219 | + } |
|
| 183 | 220 | } |
| 184 | 221 | |
| 185 | 222 | $output->add('fail_list',$fail_list); |
@@ -191,22 +228,32 @@ discard block |
||
| 191 | 228 | */ |
| 192 | 229 | function triggerSendMessage(&$obj) |
| 193 | 230 | { |
| 194 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 231 | + if($_SESSION['avoid_log']) { |
|
| 232 | + return new Object(); |
|
| 233 | + } |
|
| 195 | 234 | |
| 196 | 235 | $logged_info = Context::get('logged_info'); |
| 197 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
| 236 | + if($logged_info->is_admin == 'Y') { |
|
| 237 | + return new Object(); |
|
| 238 | + } |
|
| 198 | 239 | |
| 199 | 240 | $oFilterModel = getModel('spamfilter'); |
| 200 | 241 | // Check if the IP is prohibited |
| 201 | 242 | $output = $oFilterModel->isDeniedIP(); |
| 202 | - if(!$output->toBool()) return $output; |
|
| 243 | + if(!$output->toBool()) { |
|
| 244 | + return $output; |
|
| 245 | + } |
|
| 203 | 246 | // Check if there is a ban on the word |
| 204 | 247 | $text = $obj->title . ' ' . $obj->content; |
| 205 | 248 | $output = $oFilterModel->isDeniedWord($text); |
| 206 | - if(!$output->toBool()) return $output; |
|
| 249 | + if(!$output->toBool()) { |
|
| 250 | + return $output; |
|
| 251 | + } |
|
| 207 | 252 | // Check the specified time |
| 208 | 253 | $output = $oFilterModel->checkLimited(TRUE); |
| 209 | - if(!$output->toBool()) return $output; |
|
| 254 | + if(!$output->toBool()) { |
|
| 255 | + return $output; |
|
| 256 | + } |
|
| 210 | 257 | // Save a log |
| 211 | 258 | $this->insertLog(); |
| 212 | 259 | |
@@ -27,39 +27,39 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | function triggerInsertDocument(&$obj) |
| 29 | 29 | { |
| 30 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 30 | + if ($_SESSION['avoid_log']) return new Object(); |
|
| 31 | 31 | // Check the login status, login information, and permission |
| 32 | 32 | $is_logged = Context::get('is_logged'); |
| 33 | 33 | $logged_info = Context::get('logged_info'); |
| 34 | 34 | $grant = Context::get('grant'); |
| 35 | 35 | // In case logged in, check if it is an administrator |
| 36 | - if($is_logged) |
|
| 36 | + if ($is_logged) |
|
| 37 | 37 | { |
| 38 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
| 39 | - if($grant->manager) return new Object(); |
|
| 38 | + if ($logged_info->is_admin == 'Y') return new Object(); |
|
| 39 | + if ($grant->manager) return new Object(); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $oFilterModel = getModel('spamfilter'); |
| 43 | 43 | // Check if the IP is prohibited |
| 44 | 44 | $output = $oFilterModel->isDeniedIP(); |
| 45 | - if(!$output->toBool()) return $output; |
|
| 45 | + if (!$output->toBool()) return $output; |
|
| 46 | 46 | // Check if there is a ban on the word |
| 47 | 47 | $text = ''; |
| 48 | - if($is_logged) |
|
| 48 | + if ($is_logged) |
|
| 49 | 49 | { |
| 50 | - $text = $obj->title . ' ' . $obj->content . ' ' . $obj->tags; |
|
| 50 | + $text = $obj->title.' '.$obj->content.' '.$obj->tags; |
|
| 51 | 51 | } |
| 52 | 52 | else |
| 53 | 53 | { |
| 54 | - $text = $obj->title . ' ' . $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage . ' ' . $obj->tags; |
|
| 54 | + $text = $obj->title.' '.$obj->content.' '.$obj->nick_name.' '.$obj->homepage.' '.$obj->tags; |
|
| 55 | 55 | } |
| 56 | 56 | $output = $oFilterModel->isDeniedWord($text); |
| 57 | - if(!$output->toBool()) return $output; |
|
| 57 | + if (!$output->toBool()) return $output; |
|
| 58 | 58 | // Check the specified time beside the modificaiton time |
| 59 | - if($obj->document_srl == 0) |
|
| 59 | + if ($obj->document_srl == 0) |
|
| 60 | 60 | { |
| 61 | 61 | $output = $oFilterModel->checkLimited(); |
| 62 | - if(!$output->toBool()) return $output; |
|
| 62 | + if (!$output->toBool()) return $output; |
|
| 63 | 63 | } |
| 64 | 64 | // Save a log |
| 65 | 65 | $this->insertLog(); |
@@ -72,39 +72,39 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function triggerInsertComment(&$obj) |
| 74 | 74 | { |
| 75 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 75 | + if ($_SESSION['avoid_log']) return new Object(); |
|
| 76 | 76 | // Check the login status, login information, and permission |
| 77 | 77 | $is_logged = Context::get('is_logged'); |
| 78 | 78 | $logged_info = Context::get('logged_info'); |
| 79 | 79 | $grant = Context::get('grant'); |
| 80 | 80 | // In case logged in, check if it is an administrator |
| 81 | - if($is_logged) |
|
| 81 | + if ($is_logged) |
|
| 82 | 82 | { |
| 83 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
| 84 | - if($grant->manager) return new Object(); |
|
| 83 | + if ($logged_info->is_admin == 'Y') return new Object(); |
|
| 84 | + if ($grant->manager) return new Object(); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $oFilterModel = getModel('spamfilter'); |
| 88 | 88 | // Check if the IP is prohibited |
| 89 | 89 | $output = $oFilterModel->isDeniedIP(); |
| 90 | - if(!$output->toBool()) return $output; |
|
| 90 | + if (!$output->toBool()) return $output; |
|
| 91 | 91 | // Check if there is a ban on the word |
| 92 | 92 | $text = ''; |
| 93 | - if($is_logged) |
|
| 93 | + if ($is_logged) |
|
| 94 | 94 | { |
| 95 | 95 | $text = $obj->content; |
| 96 | 96 | } |
| 97 | 97 | else |
| 98 | 98 | { |
| 99 | - $text = $obj->content . ' ' . $obj->nick_name . ' ' . $obj->homepage; |
|
| 99 | + $text = $obj->content.' '.$obj->nick_name.' '.$obj->homepage; |
|
| 100 | 100 | } |
| 101 | 101 | $output = $oFilterModel->isDeniedWord($text); |
| 102 | - if(!$output->toBool()) return $output; |
|
| 102 | + if (!$output->toBool()) return $output; |
|
| 103 | 103 | // If the specified time check is not modified |
| 104 | - if(!$obj->__isupdate) |
|
| 104 | + if (!$obj->__isupdate) |
|
| 105 | 105 | { |
| 106 | 106 | $output = $oFilterModel->checkLimited(); |
| 107 | - if(!$output->toBool()) return $output; |
|
| 107 | + if (!$output->toBool()) return $output; |
|
| 108 | 108 | } |
| 109 | 109 | unset($obj->__isupdate); |
| 110 | 110 | // Save a log |
@@ -118,32 +118,32 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | function triggerInsertTrackback(&$obj) |
| 120 | 120 | { |
| 121 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 121 | + if ($_SESSION['avoid_log']) return new Object(); |
|
| 122 | 122 | |
| 123 | 123 | $oFilterModel = getModel('spamfilter'); |
| 124 | 124 | // Confirm if the trackbacks have been added more than once to your document |
| 125 | 125 | $output = $oFilterModel->isInsertedTrackback($obj->document_srl); |
| 126 | - if(!$output->toBool()) return $output; |
|
| 126 | + if (!$output->toBool()) return $output; |
|
| 127 | 127 | |
| 128 | 128 | // Check if the IP is prohibited |
| 129 | 129 | $output = $oFilterModel->isDeniedIP(); |
| 130 | - if(!$output->toBool()) return $output; |
|
| 130 | + if (!$output->toBool()) return $output; |
|
| 131 | 131 | // Check if there is a ban on the word |
| 132 | - $text = $obj->blog_name . ' ' . $obj->title . ' ' . $obj->excerpt . ' ' . $obj->url; |
|
| 132 | + $text = $obj->blog_name.' '.$obj->title.' '.$obj->excerpt.' '.$obj->url; |
|
| 133 | 133 | $output = $oFilterModel->isDeniedWord($text); |
| 134 | - if(!$output->toBool()) return $output; |
|
| 134 | + if (!$output->toBool()) return $output; |
|
| 135 | 135 | // Start Filtering |
| 136 | 136 | $oTrackbackModel = getModel('trackback'); |
| 137 | 137 | $oTrackbackController = getController('trackback'); |
| 138 | 138 | |
| 139 | - list($ipA,$ipB,$ipC,$ipD) = explode('.',$_SERVER['REMOTE_ADDR']); |
|
| 139 | + list($ipA, $ipB, $ipC, $ipD) = explode('.', $_SERVER['REMOTE_ADDR']); |
|
| 140 | 140 | $ipaddress = $ipA.'.'.$ipB.'.'.$ipC; |
| 141 | 141 | // In case the title and the blog name are indentical, investigate the IP address of the last 6 hours, delete and ban it. |
| 142 | - if($obj->title == $obj->excerpt) |
|
| 142 | + if ($obj->title == $obj->excerpt) |
|
| 143 | 143 | { |
| 144 | - $oTrackbackController->deleteTrackbackSender(60*60*6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt); |
|
| 144 | + $oTrackbackController->deleteTrackbackSender(60 * 60 * 6, $ipaddress, $obj->url, $obj->blog_name, $obj->title, $obj->excerpt); |
|
| 145 | 145 | $this->insertIP($ipaddress.'.*', 'AUTO-DENIED : trackback.insertTrackback'); |
| 146 | - return new Object(-1,'msg_alert_trackback_denied'); |
|
| 146 | + return new Object(-1, 'msg_alert_trackback_denied'); |
|
| 147 | 147 | } |
| 148 | 148 | // If trackbacks have been registered by one C-class IP address more than once for the last 30 minutes, ban the IP address and delete all the posts |
| 149 | 149 | /* 호스팅 환경을 감안하여 일단 이 부분은 동작하지 않도록 주석 처리 |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | function insertIP($ipaddress_list, $description = null) |
| 166 | 166 | { |
| 167 | 167 | $regExr = "/^((\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?)*\s*$/"; |
| 168 | - if(!preg_match($regExr,$ipaddress_list)) return new Object(-1, 'msg_invalid'); |
|
| 169 | - $ipaddress_list = str_replace("\r","",$ipaddress_list); |
|
| 170 | - $ipaddress_list = explode("\n",$ipaddress_list); |
|
| 171 | - foreach($ipaddress_list as $ipaddressValue) |
|
| 168 | + if (!preg_match($regExr, $ipaddress_list)) return new Object(-1, 'msg_invalid'); |
|
| 169 | + $ipaddress_list = str_replace("\r", "", $ipaddress_list); |
|
| 170 | + $ipaddress_list = explode("\n", $ipaddress_list); |
|
| 171 | + foreach ($ipaddress_list as $ipaddressValue) |
|
| 172 | 172 | { |
| 173 | 173 | $args = new stdClass(); |
| 174 | - preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/",$ipaddressValue,$matches); |
|
| 175 | - if($ipaddress=trim($matches[1])) |
|
| 174 | + preg_match("/(\d{1,3}(?:.(\d{1,3}|\*)){3})\s*(\/\/(.*)\s*)?/", $ipaddressValue, $matches); |
|
| 175 | + if ($ipaddress = trim($matches[1])) |
|
| 176 | 176 | { |
| 177 | 177 | $args->ipaddress = $ipaddress; |
| 178 | - if(!$description && $matches[4]) $args->description = $matches[4]; |
|
| 178 | + if (!$description && $matches[4]) $args->description = $matches[4]; |
|
| 179 | 179 | else $args->description = $description; |
| 180 | 180 | } |
| 181 | 181 | $output = executeQuery('spamfilter.insertDeniedIP', $args); |
| 182 | - if(!$output->toBool()) $fail_list .= $ipaddress.'<br/>'; |
|
| 182 | + if (!$output->toBool()) $fail_list .= $ipaddress.'<br/>'; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $output->add('fail_list',$fail_list); |
|
| 185 | + $output->add('fail_list', $fail_list); |
|
| 186 | 186 | return $output; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -191,22 +191,22 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | function triggerSendMessage(&$obj) |
| 193 | 193 | { |
| 194 | - if($_SESSION['avoid_log']) return new Object(); |
|
| 194 | + if ($_SESSION['avoid_log']) return new Object(); |
|
| 195 | 195 | |
| 196 | 196 | $logged_info = Context::get('logged_info'); |
| 197 | - if($logged_info->is_admin == 'Y') return new Object(); |
|
| 197 | + if ($logged_info->is_admin == 'Y') return new Object(); |
|
| 198 | 198 | |
| 199 | 199 | $oFilterModel = getModel('spamfilter'); |
| 200 | 200 | // Check if the IP is prohibited |
| 201 | 201 | $output = $oFilterModel->isDeniedIP(); |
| 202 | - if(!$output->toBool()) return $output; |
|
| 202 | + if (!$output->toBool()) return $output; |
|
| 203 | 203 | // Check if there is a ban on the word |
| 204 | - $text = $obj->title . ' ' . $obj->content; |
|
| 204 | + $text = $obj->title.' '.$obj->content; |
|
| 205 | 205 | $output = $oFilterModel->isDeniedWord($text); |
| 206 | - if(!$output->toBool()) return $output; |
|
| 206 | + if (!$output->toBool()) return $output; |
|
| 207 | 207 | // Check the specified time |
| 208 | 208 | $output = $oFilterModel->checkLimited(TRUE); |
| 209 | - if(!$output->toBool()) return $output; |
|
| 209 | + if (!$output->toBool()) return $output; |
|
| 210 | 210 | // Save a log |
| 211 | 211 | $this->insertLog(); |
| 212 | 212 | |
@@ -49,6 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @brief document_srl the import tag |
| 52 | + * @param stdClass $obj |
|
| 52 | 53 | */ |
| 53 | 54 | function getDocumentSrlByTag($obj) |
| 54 | 55 | { |
@@ -70,6 +71,7 @@ discard block |
||
| 70 | 71 | |
| 71 | 72 | /** |
| 72 | 73 | * @brief document used in the import tag |
| 74 | + * @param stdClass $obj |
|
| 73 | 75 | */ |
| 74 | 76 | function getDocumentsTagList($obj) |
| 75 | 77 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | function getTagList($obj) |
| 22 | 22 | { |
| 23 | - if($obj->mid) |
|
| 23 | + if ($obj->mid) |
|
| 24 | 24 | { |
| 25 | 25 | $oModuleModel = getModel('module'); |
| 26 | 26 | $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // Module_srl passed the array may be a check whether the array |
| 31 | 31 | $args = new stdClass; |
| 32 | - if(is_array($obj->module_srl)) |
|
| 32 | + if (is_array($obj->module_srl)) |
|
| 33 | 33 | { |
| 34 | 34 | $args->module_srl = implode(',', $obj->module_srl); |
| 35 | 35 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $args->count = $obj->sort_index; |
| 43 | 43 | |
| 44 | 44 | $output = executeQueryArray('tag.getTagList', $args); |
| 45 | - if(!$output->toBool()) return $output; |
|
| 45 | + if (!$output->toBool()) return $output; |
|
| 46 | 46 | |
| 47 | 47 | return $output; |
| 48 | 48 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | function getDocumentSrlByTag($obj) |
| 54 | 54 | { |
| 55 | 55 | $args = new stdClass; |
| 56 | - if(is_array($obj->module_srl)) |
|
| 56 | + if (is_array($obj->module_srl)) |
|
| 57 | 57 | { |
| 58 | 58 | $args->module_srl = implode(',', $obj->module_srl); |
| 59 | 59 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | function getDocumentsTagList($obj) |
| 75 | 75 | { |
| 76 | 76 | $args = new stdClass; |
| 77 | - if(is_array($obj->document_srl)) |
|
| 77 | + if (is_array($obj->document_srl)) |
|
| 78 | 78 | { |
| 79 | 79 | $args->document_srl = implode(',', $obj->document_srl); |
| 80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $output = executeQueryArray('tag.getDocumentsTagList', $args); |
| 87 | - if(!$output->toBool()) return $output; |
|
| 87 | + if (!$output->toBool()) return $output; |
|
| 88 | 88 | |
| 89 | 89 | return $output; |
| 90 | 90 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | function getTagWithUsedList($obj) |
| 96 | 96 | { |
| 97 | 97 | $args = new stdClass; |
| 98 | - if(is_array($obj->module_srl)) |
|
| 98 | + if (is_array($obj->module_srl)) |
|
| 99 | 99 | { |
| 100 | 100 | $args->module_srl = implode(',', $obj->module_srl); |
| 101 | 101 | } |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | $output = $this->getDocumentSrlByTag($args); |
| 109 | 109 | $document_srl = array(); |
| 110 | 110 | |
| 111 | - if($output->data) |
|
| 111 | + if ($output->data) |
|
| 112 | 112 | { |
| 113 | - foreach($output->data as $k => $v) $document_srl[] = $v->document_srl; |
|
| 113 | + foreach ($output->data as $k => $v) $document_srl[] = $v->document_srl; |
|
| 114 | 114 | } |
| 115 | 115 | unset($args); |
| 116 | 116 | |
@@ -32,8 +32,7 @@ discard block |
||
| 32 | 32 | if(is_array($obj->module_srl)) |
| 33 | 33 | { |
| 34 | 34 | $args->module_srl = implode(',', $obj->module_srl); |
| 35 | - } |
|
| 36 | - else |
|
| 35 | + } else |
|
| 37 | 36 | { |
| 38 | 37 | $args->module_srl = $obj->module_srl; |
| 39 | 38 | } |
@@ -42,7 +41,9 @@ discard block |
||
| 42 | 41 | $args->count = $obj->sort_index; |
| 43 | 42 | |
| 44 | 43 | $output = executeQueryArray('tag.getTagList', $args); |
| 45 | - if(!$output->toBool()) return $output; |
|
| 44 | + if(!$output->toBool()) { |
|
| 45 | + return $output; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | return $output; |
| 48 | 49 | } |
@@ -56,8 +57,7 @@ discard block |
||
| 56 | 57 | if(is_array($obj->module_srl)) |
| 57 | 58 | { |
| 58 | 59 | $args->module_srl = implode(',', $obj->module_srl); |
| 59 | - } |
|
| 60 | - else |
|
| 60 | + } else |
|
| 61 | 61 | { |
| 62 | 62 | $args->module_srl = $obj->module_srl; |
| 63 | 63 | } |
@@ -77,14 +77,15 @@ discard block |
||
| 77 | 77 | if(is_array($obj->document_srl)) |
| 78 | 78 | { |
| 79 | 79 | $args->document_srl = implode(',', $obj->document_srl); |
| 80 | - } |
|
| 81 | - else |
|
| 80 | + } else |
|
| 82 | 81 | { |
| 83 | 82 | $args->document_srl = $obj->document_srl; |
| 84 | 83 | } |
| 85 | 84 | |
| 86 | 85 | $output = executeQueryArray('tag.getDocumentsTagList', $args); |
| 87 | - if(!$output->toBool()) return $output; |
|
| 86 | + if(!$output->toBool()) { |
|
| 87 | + return $output; |
|
| 88 | + } |
|
| 88 | 89 | |
| 89 | 90 | return $output; |
| 90 | 91 | } |
@@ -98,8 +99,7 @@ discard block |
||
| 98 | 99 | if(is_array($obj->module_srl)) |
| 99 | 100 | { |
| 100 | 101 | $args->module_srl = implode(',', $obj->module_srl); |
| 101 | - } |
|
| 102 | - else |
|
| 102 | + } else |
|
| 103 | 103 | { |
| 104 | 104 | $args->module_srl = $obj->module_srl; |
| 105 | 105 | } |
@@ -110,7 +110,9 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | if($output->data) |
| 112 | 112 | { |
| 113 | - foreach($output->data as $k => $v) $document_srl[] = $v->document_srl; |
|
| 113 | + foreach($output->data as $k => $v) { |
|
| 114 | + $document_srl[] = $v->document_srl; |
|
| 115 | + } |
|
| 114 | 116 | } |
| 115 | 117 | unset($args); |
| 116 | 118 | |