@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $args = new stdClass(); |
| 23 | 23 | $args->title = Context::get('title'); |
| 24 | 24 | $output = executeQuery('module.insertModuleCategory', $args); |
| 25 | - if(!$output->toBool()) return $output; |
|
| 25 | + if (!$output->toBool()) return $output; |
|
| 26 | 26 | |
| 27 | 27 | $this->setMessage("success_registed"); |
| 28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | function procModuleAdminUpdateCategory() |
| 37 | 37 | { |
| 38 | 38 | $output = $this->doUpdateModuleCategory(); |
| 39 | - if(!$output->toBool()) return $output; |
|
| 39 | + if (!$output->toBool()) return $output; |
|
| 40 | 40 | |
| 41 | 41 | $this->setMessage('success_updated'); |
| 42 | 42 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | function procModuleAdminDeleteCategory() |
| 51 | 51 | { |
| 52 | 52 | $output = $this->doDeleteModuleCategory(); |
| 53 | - if(!$output->toBool()) return $output; |
|
| 53 | + if (!$output->toBool()) return $output; |
|
| 54 | 54 | |
| 55 | 55 | $this->setMessage('success_deleted'); |
| 56 | 56 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | function procModuleAdminCopyModule($args = NULL) |
| 86 | 86 | { |
| 87 | 87 | $isProc = false; |
| 88 | - if(!$args) |
|
| 88 | + if (!$args) |
|
| 89 | 89 | { |
| 90 | 90 | $isProc = true; |
| 91 | 91 | // Get information of the target module to copy |
@@ -97,24 +97,24 @@ discard block |
||
| 97 | 97 | $module_srl = $args->module_srl; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(!$module_srl) |
|
| 100 | + if (!$module_srl) |
|
| 101 | 101 | { |
| 102 | 102 | return $this->_returnByProc($isProc); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // Get module name to create and browser title |
| 106 | 106 | $clones = array(); |
| 107 | - for($i=1;$i<=10;$i++) |
|
| 107 | + for ($i = 1; $i <= 10; $i++) |
|
| 108 | 108 | { |
| 109 | 109 | $mid = trim($args->{"mid_".$i}); |
| 110 | - if(!$mid) continue; |
|
| 111 | - if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 110 | + if (!$mid) continue; |
|
| 111 | + if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new Object(-1, 'msg_limit_mid'); |
|
| 112 | 112 | $browser_title = $args->{"browser_title_".$i}; |
| 113 | - if(!$mid) continue; |
|
| 114 | - if($mid && !$browser_title) $browser_title = $mid; |
|
| 113 | + if (!$mid) continue; |
|
| 114 | + if ($mid && !$browser_title) $browser_title = $mid; |
|
| 115 | 115 | $clones[$mid] = $browser_title; |
| 116 | 116 | } |
| 117 | - if(count($clones) < 1) |
|
| 117 | + if (count($clones) < 1) |
|
| 118 | 118 | { |
| 119 | 119 | return $this->_returnByProc($isProc); |
| 120 | 120 | } |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | $module_args->module_srl = $module_srl; |
| 130 | 130 | $output = executeQueryArray('module.getModuleGrants', $module_args); |
| 131 | 131 | $grant = array(); |
| 132 | - if($output->data) |
|
| 132 | + if ($output->data) |
|
| 133 | 133 | { |
| 134 | - foreach($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
| 134 | + foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | // get Extra Vars |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | $extra_args->module_srl = $module_srl; |
| 140 | 140 | $extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args); |
| 141 | 141 | $extra_vars = new stdClass(); |
| 142 | - if($extra_output->toBool() && is_array($extra_output->data)) |
|
| 142 | + if ($extra_output->toBool() && is_array($extra_output->data)) |
|
| 143 | 143 | { |
| 144 | - foreach($extra_output->data as $info) |
|
| 144 | + foreach ($extra_output->data as $info) |
|
| 145 | 145 | { |
| 146 | 146 | $extra_vars->{$info->name} = $info->value; |
| 147 | 147 | } |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | $tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl); |
| 151 | 151 | $tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
| 152 | 152 | |
| 153 | - if($tmpModuleSkinVars) |
|
| 153 | + if ($tmpModuleSkinVars) |
|
| 154 | 154 | { |
| 155 | - foreach($tmpModuleSkinVars as $key=>$value) |
|
| 155 | + foreach ($tmpModuleSkinVars as $key=>$value) |
|
| 156 | 156 | { |
| 157 | 157 | $moduleSkinVars->{$key} = $value->value; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if($tmpModuleMobileSkinVars) |
|
| 161 | + if ($tmpModuleMobileSkinVars) |
|
| 162 | 162 | { |
| 163 | - foreach($tmpModuleMobileSkinVars as $key=>$value) |
|
| 163 | + foreach ($tmpModuleMobileSkinVars as $key=>$value) |
|
| 164 | 164 | { |
| 165 | 165 | $moduleMobileSkinVars->{$key} = $value->value; |
| 166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $triggerObj->moduleSrlList = array(); |
| 175 | 175 | |
| 176 | 176 | $errorLog = array(); |
| 177 | - foreach($clones as $mid => $browser_title) |
|
| 177 | + foreach ($clones as $mid => $browser_title) |
|
| 178 | 178 | { |
| 179 | 179 | $clone_args = new stdClass; |
| 180 | 180 | $clone_args = clone $module_info; |
@@ -188,29 +188,29 @@ discard block |
||
| 188 | 188 | // Create a module |
| 189 | 189 | $output = $oModuleController->insertModule($clone_args); |
| 190 | 190 | |
| 191 | - if(!$output->toBool()) |
|
| 191 | + if (!$output->toBool()) |
|
| 192 | 192 | { |
| 193 | - $errorLog[] = $mid . ' : '. $output->message; |
|
| 193 | + $errorLog[] = $mid.' : '.$output->message; |
|
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | $module_srl = $output->get('module_srl'); |
| 197 | 197 | |
| 198 | - if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE') |
|
| 198 | + if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE') |
|
| 199 | 199 | { |
| 200 | 200 | // copy document |
| 201 | 201 | $oDocumentAdminController = getAdminController('document'); |
| 202 | 202 | $copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl); |
| 203 | 203 | $document_srls = $copyOutput->get('copied_srls'); |
| 204 | - if($document_srls && count($document_srls) > 0) |
|
| 204 | + if ($document_srls && count($document_srls) > 0) |
|
| 205 | 205 | { |
| 206 | 206 | $extra_vars->document_srl = array_pop($document_srls); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if($extra_vars->mdocument_srl) |
|
| 209 | + if ($extra_vars->mdocument_srl) |
|
| 210 | 210 | { |
| 211 | 211 | $copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl); |
| 212 | 212 | $copiedSrls = $copyOutput->get('copied_srls'); |
| 213 | - if($copiedSrls && count($copiedSrls) > 0) |
|
| 213 | + if ($copiedSrls && count($copiedSrls) > 0) |
|
| 214 | 214 | { |
| 215 | 215 | $extra_vars->mdocument_srl = array_pop($copiedSrls); |
| 216 | 216 | } |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Grant module permissions |
| 221 | - if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
| 222 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 221 | + if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
| 222 | + if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
| 223 | 223 | |
| 224 | - if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
| 225 | - if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
| 224 | + if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
| 225 | + if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
| 226 | 226 | |
| 227 | 227 | $triggerObj->moduleSrlList[] = $module_srl; |
| 228 | 228 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $oDB->commit(); |
| 233 | 233 | |
| 234 | - if(count($errorLog) > 0) |
|
| 234 | + if (count($errorLog) > 0) |
|
| 235 | 235 | { |
| 236 | 236 | $message = implode('\n', $errorLog); |
| 237 | 237 | $this->setMessage($message); |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | $this->setMessage('success_registed'); |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if($isProc) |
|
| 245 | + if ($isProc) |
|
| 246 | 246 | { |
| 247 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 247 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 248 | 248 | { |
| 249 | 249 | global $lang; |
| 250 | 250 | htmlHeader(); |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | return $module_srl; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - private function _returnByProc($isProc, $msg='msg_invalid_request') |
|
| 263 | + private function _returnByProc($isProc, $msg = 'msg_invalid_request') |
|
| 264 | 264 | { |
| 265 | - if(!$isProc) |
|
| 265 | + if (!$isProc) |
|
| 266 | 266 | return; |
| 267 | 267 | else |
| 268 | 268 | { |
@@ -282,17 +282,17 @@ discard block |
||
| 282 | 282 | // Get information of the module |
| 283 | 283 | $columnList = array('module_srl', 'module'); |
| 284 | 284 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 285 | - if(!$module_info) return new Object(-1,'msg_invalid_request'); |
|
| 285 | + if (!$module_info) return new Object(-1, 'msg_invalid_request'); |
|
| 286 | 286 | // Register Admin ID |
| 287 | 287 | $oModuleController->deleteAdminId($module_srl); |
| 288 | 288 | $admin_member = Context::get('admin_member'); |
| 289 | - if($admin_member) |
|
| 289 | + if ($admin_member) |
|
| 290 | 290 | { |
| 291 | - $admin_members = explode(',',$admin_member); |
|
| 292 | - foreach($admin_members as $admin_id) |
|
| 291 | + $admin_members = explode(',', $admin_member); |
|
| 292 | + foreach ($admin_members as $admin_id) |
|
| 293 | 293 | { |
| 294 | 294 | $admin_id = trim($admin_id); |
| 295 | - if(!$admin_id) continue; |
|
| 295 | + if (!$admin_id) continue; |
|
| 296 | 296 | $oModuleController->insertAdminId($module_srl, $admin_id); |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -307,13 +307,13 @@ discard block |
||
| 307 | 307 | $grant_list->manager->default = 'manager'; |
| 308 | 308 | |
| 309 | 309 | $grant = new stdClass(); |
| 310 | - foreach($grant_list as $grant_name => $grant_info) |
|
| 310 | + foreach ($grant_list as $grant_name => $grant_info) |
|
| 311 | 311 | { |
| 312 | 312 | // Get the default value |
| 313 | 313 | $default = Context::get($grant_name.'_default'); |
| 314 | 314 | // -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users |
| 315 | 315 | $grant->{$grant_name} = array(); |
| 316 | - if(strlen($default)) |
|
| 316 | + if (strlen($default)) |
|
| 317 | 317 | { |
| 318 | 318 | $grant->{$grant_name}[] = $default; |
| 319 | 319 | continue; |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | else |
| 323 | 323 | { |
| 324 | 324 | $group_srls = Context::get($grant_name); |
| 325 | - if($group_srls) |
|
| 325 | + if ($group_srls) |
|
| 326 | 326 | { |
| 327 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
| 328 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
| 327 | + if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls); |
|
| 328 | + elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls); |
|
| 329 | 329 | else $group_srls = array($group_srls); |
| 330 | 330 | $grant->{$grant_name} = $group_srls; |
| 331 | 331 | } |
@@ -338,18 +338,18 @@ discard block |
||
| 338 | 338 | $args = new stdClass(); |
| 339 | 339 | $args->module_srl = $module_srl; |
| 340 | 340 | $output = executeQuery('module.deleteModuleGrants', $args); |
| 341 | - if(!$output->toBool()) return $output; |
|
| 341 | + if (!$output->toBool()) return $output; |
|
| 342 | 342 | // Permissions stored in the DB |
| 343 | - foreach($grant as $grant_name => $group_srls) |
|
| 343 | + foreach ($grant as $grant_name => $group_srls) |
|
| 344 | 344 | { |
| 345 | - foreach($group_srls as $val) |
|
| 345 | + foreach ($group_srls as $val) |
|
| 346 | 346 | { |
| 347 | 347 | $args = new stdClass(); |
| 348 | 348 | $args->module_srl = $module_srl; |
| 349 | 349 | $args->name = $grant_name; |
| 350 | 350 | $args->group_srl = $val; |
| 351 | 351 | $output = executeQuery('module.insertModuleGrant', $args); |
| 352 | - if(!$output->toBool()) return $output; |
|
| 352 | + if (!$output->toBool()) return $output; |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | $this->setMessage('success_registed'); |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | $oModuleModel = getModel('module'); |
| 369 | 369 | $columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix'); |
| 370 | 370 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 371 | - if($module_info->module_srl) |
|
| 371 | + if ($module_info->module_srl) |
|
| 372 | 372 | { |
| 373 | - if($mode === 'M') |
|
| 373 | + if ($mode === 'M') |
|
| 374 | 374 | { |
| 375 | - if($module_info->is_mskin_fix == 'Y') |
|
| 375 | + if ($module_info->is_mskin_fix == 'Y') |
|
| 376 | 376 | { |
| 377 | 377 | $skin = $module_info->mskin; |
| 378 | 378 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | else |
| 385 | 385 | { |
| 386 | - if($module_info->is_skin_fix == 'Y') |
|
| 386 | + if ($module_info->is_skin_fix == 'Y') |
|
| 387 | 387 | { |
| 388 | 388 | $skin = $module_info->skin; |
| 389 | 389 | } |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Get skin information (to check extra_vars) |
| 397 | - $module_path = _XE_PATH_ . 'modules/'.$module_info->module; |
|
| 397 | + $module_path = _XE_PATH_.'modules/'.$module_info->module; |
|
| 398 | 398 | |
| 399 | - if($mode === 'M') |
|
| 399 | + if ($mode === 'M') |
|
| 400 | 400 | { |
| 401 | 401 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
| 402 | 402 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
@@ -417,35 +417,35 @@ discard block |
||
| 417 | 417 | unset($obj->module); |
| 418 | 418 | unset($obj->_mode); |
| 419 | 419 | // Separately handle if a type of extra_vars is an image in the original skin_info |
| 420 | - if($skin_info->extra_vars) |
|
| 420 | + if ($skin_info->extra_vars) |
|
| 421 | 421 | { |
| 422 | - foreach($skin_info->extra_vars as $vars) |
|
| 422 | + foreach ($skin_info->extra_vars as $vars) |
|
| 423 | 423 | { |
| 424 | - if($vars->type!='image') continue; |
|
| 424 | + if ($vars->type != 'image') continue; |
|
| 425 | 425 | |
| 426 | 426 | $image_obj = $obj->{$vars->name}; |
| 427 | 427 | // Get a variable to delete |
| 428 | 428 | $del_var = $obj->{"del_".$vars->name}; |
| 429 | 429 | unset($obj->{"del_".$vars->name}); |
| 430 | - if($del_var == 'Y') |
|
| 430 | + if ($del_var == 'Y') |
|
| 431 | 431 | { |
| 432 | 432 | FileHandler::removeFile($skin_vars[$vars->name]->value); |
| 433 | 433 | continue; |
| 434 | 434 | } |
| 435 | 435 | // Use the previous data if not uploaded |
| 436 | - if(!$image_obj['tmp_name']) |
|
| 436 | + if (!$image_obj['tmp_name']) |
|
| 437 | 437 | { |
| 438 | 438 | $obj->{$vars->name} = $skin_vars[$vars->name]->value; |
| 439 | 439 | continue; |
| 440 | 440 | } |
| 441 | 441 | // Ignore if the file is not successfully uploaded |
| 442 | - if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
| 442 | + if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name'])) |
|
| 443 | 443 | { |
| 444 | 444 | unset($obj->{$vars->name}); |
| 445 | 445 | continue; |
| 446 | 446 | } |
| 447 | 447 | // Ignore if the file is not an image |
| 448 | - if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
| 448 | + if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) |
|
| 449 | 449 | { |
| 450 | 450 | unset($obj->{$vars->name}); |
| 451 | 451 | continue; |
@@ -453,11 +453,11 @@ discard block |
||
| 453 | 453 | // Upload the file to a path |
| 454 | 454 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
| 455 | 455 | // Create a directory |
| 456 | - if(!FileHandler::makeDir($path)) return false; |
|
| 456 | + if (!FileHandler::makeDir($path)) return false; |
|
| 457 | 457 | |
| 458 | 458 | $filename = $path.$image_obj['name']; |
| 459 | 459 | // Move the file |
| 460 | - if(!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
| 460 | + if (!move_uploaded_file($image_obj['tmp_name'], $filename)) |
|
| 461 | 461 | { |
| 462 | 462 | unset($obj->{$vars->name}); |
| 463 | 463 | continue; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | */ |
| 482 | 482 | $oModuleController = getController('module'); |
| 483 | 483 | |
| 484 | - if($mode === 'M') |
|
| 484 | + if ($mode === 'M') |
|
| 485 | 485 | { |
| 486 | 486 | $output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj); |
| 487 | 487 | } |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | { |
| 490 | 490 | $output = $oModuleController->insertModuleSkinVars($module_srl, $obj); |
| 491 | 491 | } |
| 492 | - if(!$output->toBool()) |
|
| 492 | + if (!$output->toBool()) |
|
| 493 | 493 | { |
| 494 | 494 | return $output; |
| 495 | 495 | } |
@@ -506,29 +506,29 @@ discard block |
||
| 506 | 506 | { |
| 507 | 507 | $vars = Context::getRequestVars(); |
| 508 | 508 | |
| 509 | - if(!$vars->module_srls) return new Object(-1,'msg_invalid_request'); |
|
| 509 | + if (!$vars->module_srls) return new Object(-1, 'msg_invalid_request'); |
|
| 510 | 510 | |
| 511 | - $module_srls = explode(',',$vars->module_srls); |
|
| 512 | - if(count($module_srls) < 1) return new Object(-1,'msg_invalid_request'); |
|
| 511 | + $module_srls = explode(',', $vars->module_srls); |
|
| 512 | + if (count($module_srls) < 1) return new Object(-1, 'msg_invalid_request'); |
|
| 513 | 513 | |
| 514 | 514 | $oModuleModel = getModel('module'); |
| 515 | - $oModuleController= getController('module'); |
|
| 515 | + $oModuleController = getController('module'); |
|
| 516 | 516 | $columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate'); |
| 517 | - $updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile'); |
|
| 518 | - foreach($updateList as $key=>$val) |
|
| 517 | + $updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile'); |
|
| 518 | + foreach ($updateList as $key=>$val) |
|
| 519 | 519 | { |
| 520 | - if(!strlen($vars->{$val})) |
|
| 520 | + if (!strlen($vars->{$val})) |
|
| 521 | 521 | { |
| 522 | 522 | unset($updateList[$key]); |
| 523 | 523 | $columnList[] = $val; |
| 524 | 524 | } |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - foreach($module_srls as $module_srl) |
|
| 527 | + foreach ($module_srls as $module_srl) |
|
| 528 | 528 | { |
| 529 | 529 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
| 530 | 530 | |
| 531 | - foreach($updateList as $val) |
|
| 531 | + foreach ($updateList as $val) |
|
| 532 | 532 | { |
| 533 | 533 | $module_info->{$val} = $vars->{$val}; |
| 534 | 534 | } |
@@ -536,9 +536,9 @@ discard block |
||
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | $this->setMessage('success_registed'); |
| 539 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 539 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 540 | 540 | { |
| 541 | - if(Context::get('success_return_url')) |
|
| 541 | + if (Context::get('success_return_url')) |
|
| 542 | 542 | { |
| 543 | 543 | $this->setRedirectUrl(Context::get('success_return_url')); |
| 544 | 544 | } |
@@ -561,10 +561,10 @@ discard block |
||
| 561 | 561 | function procModuleAdminModuleGrantSetup() |
| 562 | 562 | { |
| 563 | 563 | $module_srls = Context::get('module_srls'); |
| 564 | - if(!$module_srls) return new Object(-1,'msg_invalid_request'); |
|
| 564 | + if (!$module_srls) return new Object(-1, 'msg_invalid_request'); |
|
| 565 | 565 | |
| 566 | - $modules = explode(',',$module_srls); |
|
| 567 | - if(count($modules) < 1) return new Object(-1,'msg_invalid_request'); |
|
| 566 | + $modules = explode(',', $module_srls); |
|
| 567 | + if (count($modules) < 1) return new Object(-1, 'msg_invalid_request'); |
|
| 568 | 568 | |
| 569 | 569 | $oModuleController = getController('module'); |
| 570 | 570 | $oModuleModel = getModel('module'); |
@@ -581,13 +581,13 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | $grant = new stdClass; |
| 583 | 583 | |
| 584 | - foreach($grant_list as $grant_name => $grant_info) |
|
| 584 | + foreach ($grant_list as $grant_name => $grant_info) |
|
| 585 | 585 | { |
| 586 | 586 | // Get the default value |
| 587 | 587 | $default = Context::get($grant_name.'_default'); |
| 588 | 588 | // -1 = Sign only, 0 = all users |
| 589 | 589 | $grant->{$grant_name} = array(); |
| 590 | - if(strlen($default)) |
|
| 590 | + if (strlen($default)) |
|
| 591 | 591 | { |
| 592 | 592 | $grant->{$grant_name}[] = $default; |
| 593 | 593 | continue; |
@@ -596,12 +596,12 @@ discard block |
||
| 596 | 596 | else |
| 597 | 597 | { |
| 598 | 598 | $group_srls = Context::get($grant_name); |
| 599 | - if($group_srls) |
|
| 599 | + if ($group_srls) |
|
| 600 | 600 | { |
| 601 | - if(!is_array($group_srls)) |
|
| 601 | + if (!is_array($group_srls)) |
|
| 602 | 602 | { |
| 603 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
| 604 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
| 603 | + if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls); |
|
| 604 | + elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls); |
|
| 605 | 605 | else $group_srls = array($group_srls); |
| 606 | 606 | } |
| 607 | 607 | $grant->{$grant_name} = $group_srls; |
@@ -612,30 +612,30 @@ discard block |
||
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | // Stored in the DB |
| 615 | - foreach($modules as $module_srl) |
|
| 615 | + foreach ($modules as $module_srl) |
|
| 616 | 616 | { |
| 617 | 617 | $args = new stdClass(); |
| 618 | 618 | $args->module_srl = $module_srl; |
| 619 | 619 | $output = executeQuery('module.deleteModuleGrants', $args); |
| 620 | - if(!$output->toBool()) continue; |
|
| 620 | + if (!$output->toBool()) continue; |
|
| 621 | 621 | // Permissions stored in the DB |
| 622 | - foreach($grant as $grant_name => $group_srls) |
|
| 622 | + foreach ($grant as $grant_name => $group_srls) |
|
| 623 | 623 | { |
| 624 | - foreach($group_srls as $val) |
|
| 624 | + foreach ($group_srls as $val) |
|
| 625 | 625 | { |
| 626 | 626 | $args = new stdClass(); |
| 627 | 627 | $args->module_srl = $module_srl; |
| 628 | 628 | $args->name = $grant_name; |
| 629 | 629 | $args->group_srl = $val; |
| 630 | 630 | $output = executeQuery('module.insertModuleGrant', $args); |
| 631 | - if(!$output->toBool()) return $output; |
|
| 631 | + if (!$output->toBool()) return $output; |
|
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | $this->setMessage('success_registed'); |
| 636 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
| 636 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
| 637 | 637 | { |
| 638 | - if(Context::get('success_return_url')) |
|
| 638 | + if (Context::get('success_return_url')) |
|
| 639 | 639 | { |
| 640 | 640 | $this->setRedirectUrl(Context::get('success_return_url')); |
| 641 | 641 | } |
@@ -662,38 +662,38 @@ discard block |
||
| 662 | 662 | $target = Context::get('target'); |
| 663 | 663 | $module = Context::get('module'); |
| 664 | 664 | $args = new stdClass(); |
| 665 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 666 | - $args->name = str_replace(' ','_',Context::get('lang_code')); |
|
| 667 | - $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
|
| 668 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 665 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 666 | + $args->name = str_replace(' ', '_', Context::get('lang_code')); |
|
| 667 | + $args->lang_name = str_replace(' ', '_', Context::get('lang_name')); |
|
| 668 | + if (!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 669 | 669 | |
| 670 | 670 | // if args->name is empty, random generate for user define language |
| 671 | - if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
| 671 | + if (empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
| 672 | 672 | |
| 673 | - if(!$args->name) return new Object(-1,'msg_invalid_request'); |
|
| 673 | + if (!$args->name) return new Object(-1, 'msg_invalid_request'); |
|
| 674 | 674 | // Check whether a language code exists |
| 675 | 675 | $output = executeQueryArray('module.getLang', $args); |
| 676 | - if(!$output->toBool()) return $output; |
|
| 676 | + if (!$output->toBool()) return $output; |
|
| 677 | 677 | // If exists, clear the old values for updating |
| 678 | - if($output->data) $output = executeQuery('module.deleteLang', $args); |
|
| 679 | - if(!$output->toBool()) return $output; |
|
| 678 | + if ($output->data) $output = executeQuery('module.deleteLang', $args); |
|
| 679 | + if (!$output->toBool()) return $output; |
|
| 680 | 680 | // Enter |
| 681 | 681 | $lang_supported = Context::get('lang_supported'); |
| 682 | - foreach($lang_supported as $key => $val) |
|
| 682 | + foreach ($lang_supported as $key => $val) |
|
| 683 | 683 | { |
| 684 | 684 | $args->lang_code = $key; |
| 685 | 685 | $args->value = trim(Context::get($key)); |
| 686 | 686 | |
| 687 | 687 | // if request method is json, strip slashes |
| 688 | - if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 688 | + if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc()) |
|
| 689 | 689 | { |
| 690 | 690 | $args->value = stripslashes($args->value); |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | - if($args->value) |
|
| 693 | + if ($args->value) |
|
| 694 | 694 | { |
| 695 | 695 | $output = executeQuery('module.insertLang', $args); |
| 696 | - if(!$output->toBool()) return $output; |
|
| 696 | + if (!$output->toBool()) return $output; |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | $this->makeCacheDefinedLangCode($args->site_srl); |
@@ -713,14 +713,14 @@ discard block |
||
| 713 | 713 | // Get language code |
| 714 | 714 | $site_module_info = Context::get('site_module_info'); |
| 715 | 715 | $args = new stdClass(); |
| 716 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 717 | - $args->name = str_replace(' ','_',Context::get('name')); |
|
| 718 | - $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
|
| 719 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 720 | - if(!$args->name) return new Object(-1,'msg_invalid_request'); |
|
| 716 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 717 | + $args->name = str_replace(' ', '_', Context::get('name')); |
|
| 718 | + $args->lang_name = str_replace(' ', '_', Context::get('lang_name')); |
|
| 719 | + if (!empty($args->lang_name)) $args->name = $args->lang_name; |
|
| 720 | + if (!$args->name) return new Object(-1, 'msg_invalid_request'); |
|
| 721 | 721 | |
| 722 | 722 | $output = executeQuery('module.deleteLang', $args); |
| 723 | - if(!$output->toBool()) return $output; |
|
| 723 | + if (!$output->toBool()) return $output; |
|
| 724 | 724 | $this->makeCacheDefinedLangCode($args->site_srl); |
| 725 | 725 | |
| 726 | 726 | $this->setMessage("success_deleted", 'info'); |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | |
| 732 | 732 | function procModuleAdminGetList() |
| 733 | 733 | { |
| 734 | - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 734 | + if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); |
|
| 735 | 735 | |
| 736 | 736 | $oModuleController = getController('module'); |
| 737 | 737 | $oModuleModel = getModel('module'); |
@@ -744,12 +744,12 @@ discard block |
||
| 744 | 744 | $args = new stdClass; |
| 745 | 745 | $logged_info = Context::get('logged_info'); |
| 746 | 746 | $site_module_info = Context::get('site_module_info'); |
| 747 | - if($site_keyword) $args->site_keyword = $site_keyword; |
|
| 747 | + if ($site_keyword) $args->site_keyword = $site_keyword; |
|
| 748 | 748 | |
| 749 | - if(!$site_srl) |
|
| 749 | + if (!$site_srl) |
|
| 750 | 750 | { |
| 751 | - if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
| 752 | - else $args->site_srl = (int)$site_module_info->site_srl; |
|
| 751 | + if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0; |
|
| 752 | + else $args->site_srl = (int) $site_module_info->site_srl; |
|
| 753 | 753 | } |
| 754 | 754 | else $args->site_srl = $site_srl; |
| 755 | 755 | |
@@ -759,12 +759,12 @@ discard block |
||
| 759 | 759 | // Get a list of modules at the site |
| 760 | 760 | $output = executeQueryArray('module.getSiteModules', $args); |
| 761 | 761 | $mid_list = array(); |
| 762 | - if(count($output->data) > 0) |
|
| 762 | + if (count($output->data) > 0) |
|
| 763 | 763 | { |
| 764 | - foreach($output->data as $val) |
|
| 764 | + foreach ($output->data as $val) |
|
| 765 | 765 | { |
| 766 | 766 | $module = trim($val->module); |
| 767 | - if(!$module) continue; |
|
| 767 | + if (!$module) continue; |
|
| 768 | 768 | |
| 769 | 769 | // replace user defined lang. |
| 770 | 770 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $obj->browser_title = $val->browser_title; |
| 776 | 776 | $obj->mid = $val->mid; |
| 777 | 777 | $obj->module_category_srl = $val->module_category_srl; |
| 778 | - if($val->module_category_srl > 0) |
|
| 778 | + if ($val->module_category_srl > 0) |
|
| 779 | 779 | { |
| 780 | 780 | $moduleCategorySrl[] = $val->module_category_srl; |
| 781 | 781 | } |
@@ -787,23 +787,23 @@ discard block |
||
| 787 | 787 | $moduleCategorySrl = array_unique($moduleCategorySrl); |
| 788 | 788 | $output = $oModuleModel->getModuleCategories($moduleCategorySrl); |
| 789 | 789 | $categoryNameList = array(); |
| 790 | - if(is_array($output)) |
|
| 790 | + if (is_array($output)) |
|
| 791 | 791 | { |
| 792 | - foreach($output as $value) |
|
| 792 | + foreach ($output as $value) |
|
| 793 | 793 | { |
| 794 | 794 | $categoryNameList[$value->module_category_srl] = $value->title; |
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | 798 | $selected_module = Context::get('selected_module'); |
| 799 | - if(count($mid_list) > 0) |
|
| 799 | + if (count($mid_list) > 0) |
|
| 800 | 800 | { |
| 801 | - foreach($mid_list as $module => $val) |
|
| 801 | + foreach ($mid_list as $module => $val) |
|
| 802 | 802 | { |
| 803 | - if(!$selected_module) $selected_module = $module; |
|
| 803 | + if (!$selected_module) $selected_module = $module; |
|
| 804 | 804 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
| 805 | 805 | |
| 806 | - if(!$xml_info) |
|
| 806 | + if (!$xml_info) |
|
| 807 | 807 | { |
| 808 | 808 | unset($mid_list[$module]); |
| 809 | 809 | continue; |
@@ -812,14 +812,14 @@ discard block |
||
| 812 | 812 | $mid_list[$module]->title = $xml_info->title; |
| 813 | 813 | |
| 814 | 814 | // change module category srl to title |
| 815 | - if(is_array($val->list)) |
|
| 815 | + if (is_array($val->list)) |
|
| 816 | 816 | { |
| 817 | - foreach($val->list as $key=>$value) |
|
| 817 | + foreach ($val->list as $key=>$value) |
|
| 818 | 818 | { |
| 819 | - if($value->module_category_srl > 0) |
|
| 819 | + if ($value->module_category_srl > 0) |
|
| 820 | 820 | { |
| 821 | 821 | $categorySrl = $mid_list[$module]->list[$key]->module_category_srl; |
| 822 | - if(isset($categoryNameList[$categorySrl])) |
|
| 822 | + if (isset($categoryNameList[$categorySrl])) |
|
| 823 | 823 | { |
| 824 | 824 | $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl]; |
| 825 | 825 | } |
@@ -847,23 +847,23 @@ discard block |
||
| 847 | 847 | $args = new stdClass(); |
| 848 | 848 | |
| 849 | 849 | // Get the language file of the current site |
| 850 | - if(!$site_srl) |
|
| 850 | + if (!$site_srl) |
|
| 851 | 851 | { |
| 852 | 852 | $site_module_info = Context::get('site_module_info'); |
| 853 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
| 853 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
| 854 | 854 | } |
| 855 | 855 | else |
| 856 | 856 | { |
| 857 | 857 | $args->site_srl = $site_srl; |
| 858 | 858 | } |
| 859 | 859 | $output = executeQueryArray('module.getLang', $args); |
| 860 | - if(!$output->toBool() || !$output->data) return; |
|
| 860 | + if (!$output->toBool() || !$output->data) return; |
|
| 861 | 861 | // Set the cache directory |
| 862 | 862 | $cache_path = _XE_PATH_.'files/cache/lang_defined/'; |
| 863 | 863 | FileHandler::makeDir($cache_path); |
| 864 | 864 | |
| 865 | 865 | $langMap = array(); |
| 866 | - foreach($output->data as $val) |
|
| 866 | + foreach ($output->data as $val) |
|
| 867 | 867 | { |
| 868 | 868 | $langMap[$val->lang_code][$val->name] = $val->value; |
| 869 | 869 | } |
@@ -872,27 +872,27 @@ discard block |
||
| 872 | 872 | $dbInfo = Context::getDBInfo(); |
| 873 | 873 | $defaultLang = $dbInfo->lang_type; |
| 874 | 874 | |
| 875 | - if(!is_array($langMap[$defaultLang])) |
|
| 875 | + if (!is_array($langMap[$defaultLang])) |
|
| 876 | 876 | { |
| 877 | 877 | $langMap[$defaultLang] = array(); |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - foreach($lang_supported as $langCode => $langName) |
|
| 880 | + foreach ($lang_supported as $langCode => $langName) |
|
| 881 | 881 | { |
| 882 | - if(!is_array($langMap[$langCode])) |
|
| 882 | + if (!is_array($langMap[$langCode])) |
|
| 883 | 883 | { |
| 884 | 884 | $langMap[$langCode] = array(); |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | $langMap[$langCode] += $langMap[$defaultLang]; |
| 888 | - foreach($lang_supported as $targetLangCode => $targetLangName) |
|
| 888 | + foreach ($lang_supported as $targetLangCode => $targetLangName) |
|
| 889 | 889 | { |
| 890 | - if($langCode == $targetLangCode || $langCode == $defaultLang) |
|
| 890 | + if ($langCode == $targetLangCode || $langCode == $defaultLang) |
|
| 891 | 891 | { |
| 892 | 892 | continue; |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | - if(!is_array($langMap[$targetLangCode])) |
|
| 895 | + if (!is_array($langMap[$targetLangCode])) |
|
| 896 | 896 | { |
| 897 | 897 | $langMap[$targetLangCode] = array(); |
| 898 | 898 | } |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | } |
| 902 | 902 | |
| 903 | 903 | $buff = array("<?php if(!defined('__XE__')) exit();"); |
| 904 | - foreach($langMap[$langCode] as $code => $value) |
|
| 904 | + foreach ($langMap[$langCode] as $code => $value) |
|
| 905 | 905 | { |
| 906 | 906 | $buff[] = sprintf('$lang[\'%s\'] = \'%s\';', $code, addcslashes(stripcslashes($value), "'")); |
| 907 | 907 | } |
@@ -924,7 +924,7 @@ discard block |
||
| 924 | 924 | |
| 925 | 925 | $isSkinFix = Context::get('is_skin_fix'); |
| 926 | 926 | |
| 927 | - if($isSkinFix) |
|
| 927 | + if ($isSkinFix) |
|
| 928 | 928 | { |
| 929 | 929 | $isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y'; |
| 930 | 930 | } |
@@ -940,14 +940,14 @@ discard block |
||
| 940 | 940 | |
| 941 | 941 | public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL) |
| 942 | 942 | { |
| 943 | - if(!$moduleSrl && !$mid) |
|
| 943 | + if (!$moduleSrl && !$mid) |
|
| 944 | 944 | { |
| 945 | 945 | return $this->stop(-1, 'msg_invalid_request'); |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | $oModuleModel = getModel('module'); |
| 949 | 949 | |
| 950 | - if($mid) |
|
| 950 | + if ($mid) |
|
| 951 | 951 | { |
| 952 | 952 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
| 953 | 953 | } |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
| 957 | 957 | } |
| 958 | 958 | |
| 959 | - if(!$moduleInfo) |
|
| 959 | + if (!$moduleInfo) |
|
| 960 | 960 | { |
| 961 | 961 | return $this->stop(-1, 'msg_module_not_exists'); |
| 962 | 962 | } |
@@ -965,26 +965,26 @@ discard block |
||
| 965 | 965 | $layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
| 966 | 966 | $skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix'; |
| 967 | 967 | |
| 968 | - if(strlen($layoutSrl)) |
|
| 968 | + if (strlen($layoutSrl)) |
|
| 969 | 969 | { |
| 970 | 970 | $moduleInfo->{$layoutTargetValue} = $layoutSrl; |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | - if(strlen($isSkinFix)) |
|
| 973 | + if (strlen($isSkinFix)) |
|
| 974 | 974 | { |
| 975 | 975 | $moduleInfo->{$skinFixTargetValue} = $isSkinFix; |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | - if($isSkinFix == 'Y') |
|
| 978 | + if ($isSkinFix == 'Y') |
|
| 979 | 979 | { |
| 980 | 980 | $moduleInfo->{$skinTargetValue} = $skinName; |
| 981 | 981 | $skinVars = json_decode($skinVars); |
| 982 | 982 | |
| 983 | - if(is_array($skinVars)) |
|
| 983 | + if (is_array($skinVars)) |
|
| 984 | 984 | { |
| 985 | - foreach($skinVars as $key => $val) |
|
| 985 | + foreach ($skinVars as $key => $val) |
|
| 986 | 986 | { |
| 987 | - if(empty($val)) |
|
| 987 | + if (empty($val)) |
|
| 988 | 988 | { |
| 989 | 989 | continue; |
| 990 | 990 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | $menuItemSrl = Context::get('menu_item_srl'); |
| 1006 | 1006 | $useMobile = Context::get('use_mobile'); |
| 1007 | 1007 | |
| 1008 | - if(!$menuItemSrl) |
|
| 1008 | + if (!$menuItemSrl) |
|
| 1009 | 1009 | { |
| 1010 | 1010 | return $this->stop(-1, 'msg_invalid_request'); |
| 1011 | 1011 | } |