@@ -260,6 +260,9 @@ discard block |
||
260 | 260 | return $module_srl; |
261 | 261 | } |
262 | 262 | |
263 | + /** |
|
264 | + * @param boolean $isProc |
|
265 | + */ |
|
263 | 266 | private function _returnByProc($isProc, $msg='msg_invalid_request') |
264 | 267 | { |
265 | 268 | if(!$isProc) |
@@ -938,6 +941,9 @@ discard block |
||
938 | 941 | |
939 | 942 | } |
940 | 943 | |
944 | + /** |
|
945 | + * @param string $skinVars |
|
946 | + */ |
|
941 | 947 | public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL) |
942 | 948 | { |
943 | 949 | if(!$moduleSrl && !$mid) |
@@ -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 BaseObject(-1, 'msg_limit_mid'); |
|
110 | + if (!$mid) continue; |
|
111 | + if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-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 BaseObject(-1,'msg_invalid_request'); |
|
285 | + if (!$module_info) return new BaseObject(-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 BaseObject(-1,'msg_invalid_request'); |
|
509 | + if (!$vars->module_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
510 | 510 | |
511 | - $module_srls = explode(',',$vars->module_srls); |
|
512 | - if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
511 | + $module_srls = explode(',', $vars->module_srls); |
|
512 | + if (count($module_srls) < 1) return new BaseObject(-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 BaseObject(-1,'msg_invalid_request'); |
|
564 | + if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request'); |
|
565 | 565 | |
566 | - $modules = explode(',',$module_srls); |
|
567 | - if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
566 | + $modules = explode(',', $module_srls); |
|
567 | + if (count($modules) < 1) return new BaseObject(-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 BaseObject(-1,'msg_invalid_request'); |
|
673 | + if (!$args->name) return new BaseObject(-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 BaseObject(-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 BaseObject(-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 BaseObject(-1, 'msg_not_permitted'); |
|
734 | + if (!Context::get('is_logged')) return new BaseObject(-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,20 +847,20 @@ 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 | |
862 | 862 | $langMap = array(); |
863 | - foreach($output->data as $lang) |
|
863 | + foreach ($output->data as $lang) |
|
864 | 864 | { |
865 | 865 | $langMap[$lang->lang_code][$lang->name] = $lang->value; |
866 | 866 | } |
@@ -869,29 +869,29 @@ discard block |
||
869 | 869 | $dbInfo = Context::getDBInfo(); |
870 | 870 | $defaultLang = $dbInfo->lang_type; |
871 | 871 | |
872 | - if(!is_array($langMap[$defaultLang])) |
|
872 | + if (!is_array($langMap[$defaultLang])) |
|
873 | 873 | { |
874 | 874 | $langMap[$defaultLang] = array(); |
875 | 875 | } |
876 | 876 | |
877 | 877 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
878 | 878 | |
879 | - foreach($lang_supported as $langCode => $langName) |
|
879 | + foreach ($lang_supported as $langCode => $langName) |
|
880 | 880 | { |
881 | - if(!is_array($langMap[$langCode])) |
|
881 | + if (!is_array($langMap[$langCode])) |
|
882 | 882 | { |
883 | 883 | $langMap[$langCode] = array(); |
884 | 884 | } |
885 | 885 | |
886 | 886 | $langMap[$langCode] += $langMap[$defaultLang]; |
887 | - foreach($lang_supported as $targetLangCode => $targetLangName) |
|
887 | + foreach ($lang_supported as $targetLangCode => $targetLangName) |
|
888 | 888 | { |
889 | - if($langCode == $targetLangCode || $langCode == $defaultLang) |
|
889 | + if ($langCode == $targetLangCode || $langCode == $defaultLang) |
|
890 | 890 | { |
891 | 891 | continue; |
892 | 892 | } |
893 | 893 | |
894 | - if(!is_array($langMap[$targetLangCode])) |
|
894 | + if (!is_array($langMap[$targetLangCode])) |
|
895 | 895 | { |
896 | 896 | $langMap[$targetLangCode] = array(); |
897 | 897 | } |
@@ -899,9 +899,9 @@ discard block |
||
899 | 899 | $langMap[$langCode] += $langMap[$targetLangCode]; |
900 | 900 | } |
901 | 901 | |
902 | - if($oCacheHandler->isSupport()) |
|
902 | + if ($oCacheHandler->isSupport()) |
|
903 | 903 | { |
904 | - $object_key = 'user_defined_langs:' . $args->site_srl . ':' . $langCode; |
|
904 | + $object_key = 'user_defined_langs:'.$args->site_srl.':'.$langCode; |
|
905 | 905 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
906 | 906 | $oCacheHandler->put($cache_key, $langMap[$langCode]); |
907 | 907 | } |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | |
923 | 923 | $isSkinFix = Context::get('is_skin_fix'); |
924 | 924 | |
925 | - if($isSkinFix) |
|
925 | + if ($isSkinFix) |
|
926 | 926 | { |
927 | 927 | $isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y'; |
928 | 928 | } |
@@ -938,14 +938,14 @@ discard block |
||
938 | 938 | |
939 | 939 | public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL) |
940 | 940 | { |
941 | - if(!$moduleSrl && !$mid) |
|
941 | + if (!$moduleSrl && !$mid) |
|
942 | 942 | { |
943 | 943 | return $this->stop(-1, 'msg_invalid_request'); |
944 | 944 | } |
945 | 945 | |
946 | 946 | $oModuleModel = getModel('module'); |
947 | 947 | |
948 | - if($mid) |
|
948 | + if ($mid) |
|
949 | 949 | { |
950 | 950 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
951 | 951 | } |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
955 | 955 | } |
956 | 956 | |
957 | - if(!$moduleInfo) |
|
957 | + if (!$moduleInfo) |
|
958 | 958 | { |
959 | 959 | return $this->stop(-1, 'msg_module_not_exists'); |
960 | 960 | } |
@@ -963,26 +963,26 @@ discard block |
||
963 | 963 | $layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl'; |
964 | 964 | $skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix'; |
965 | 965 | |
966 | - if(strlen($layoutSrl)) |
|
966 | + if (strlen($layoutSrl)) |
|
967 | 967 | { |
968 | 968 | $moduleInfo->{$layoutTargetValue} = $layoutSrl; |
969 | 969 | } |
970 | 970 | |
971 | - if(strlen($isSkinFix)) |
|
971 | + if (strlen($isSkinFix)) |
|
972 | 972 | { |
973 | 973 | $moduleInfo->{$skinFixTargetValue} = $isSkinFix; |
974 | 974 | } |
975 | 975 | |
976 | - if($isSkinFix == 'Y') |
|
976 | + if ($isSkinFix == 'Y') |
|
977 | 977 | { |
978 | 978 | $moduleInfo->{$skinTargetValue} = $skinName; |
979 | 979 | $skinVars = json_decode($skinVars); |
980 | 980 | |
981 | - if(is_array($skinVars)) |
|
981 | + if (is_array($skinVars)) |
|
982 | 982 | { |
983 | - foreach($skinVars as $key => $val) |
|
983 | + foreach ($skinVars as $key => $val) |
|
984 | 984 | { |
985 | - if(empty($val)) |
|
985 | + if (empty($val)) |
|
986 | 986 | { |
987 | 987 | continue; |
988 | 988 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | $menuItemSrl = Context::get('menu_item_srl'); |
1004 | 1004 | $useMobile = Context::get('use_mobile'); |
1005 | 1005 | |
1006 | - if(!$menuItemSrl) |
|
1006 | + if (!$menuItemSrl) |
|
1007 | 1007 | { |
1008 | 1008 | return $this->stop(-1, 'msg_invalid_request'); |
1009 | 1009 | } |
@@ -22,7 +22,9 @@ 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()) { |
|
26 | + return $output; |
|
27 | + } |
|
26 | 28 | |
27 | 29 | $this->setMessage("success_registed"); |
28 | 30 | |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | function procModuleAdminUpdateCategory() |
37 | 39 | { |
38 | 40 | $output = $this->doUpdateModuleCategory(); |
39 | - if(!$output->toBool()) return $output; |
|
41 | + if(!$output->toBool()) { |
|
42 | + return $output; |
|
43 | + } |
|
40 | 44 | |
41 | 45 | $this->setMessage('success_updated'); |
42 | 46 | |
@@ -50,7 +54,9 @@ discard block |
||
50 | 54 | function procModuleAdminDeleteCategory() |
51 | 55 | { |
52 | 56 | $output = $this->doDeleteModuleCategory(); |
53 | - if(!$output->toBool()) return $output; |
|
57 | + if(!$output->toBool()) { |
|
58 | + return $output; |
|
59 | + } |
|
54 | 60 | |
55 | 61 | $this->setMessage('success_deleted'); |
56 | 62 | |
@@ -91,8 +97,7 @@ discard block |
||
91 | 97 | // Get information of the target module to copy |
92 | 98 | $module_srl = Context::get('module_srl'); |
93 | 99 | $args = Context::getRequestVars(); |
94 | - } |
|
95 | - else |
|
100 | + } else |
|
96 | 101 | { |
97 | 102 | $module_srl = $args->module_srl; |
98 | 103 | } |
@@ -107,11 +112,19 @@ discard block |
||
107 | 112 | for($i=1;$i<=10;$i++) |
108 | 113 | { |
109 | 114 | $mid = trim($args->{"mid_".$i}); |
110 | - if(!$mid) continue; |
|
111 | - if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid'); |
|
115 | + if(!$mid) { |
|
116 | + continue; |
|
117 | + } |
|
118 | + if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) { |
|
119 | + return new BaseObject(-1, 'msg_limit_mid'); |
|
120 | + } |
|
112 | 121 | $browser_title = $args->{"browser_title_".$i}; |
113 | - if(!$mid) continue; |
|
114 | - if($mid && !$browser_title) $browser_title = $mid; |
|
122 | + if(!$mid) { |
|
123 | + continue; |
|
124 | + } |
|
125 | + if($mid && !$browser_title) { |
|
126 | + $browser_title = $mid; |
|
127 | + } |
|
115 | 128 | $clones[$mid] = $browser_title; |
116 | 129 | } |
117 | 130 | if(count($clones) < 1) |
@@ -131,7 +144,9 @@ discard block |
||
131 | 144 | $grant = array(); |
132 | 145 | if($output->data) |
133 | 146 | { |
134 | - foreach($output->data as $val) $grant[$val->name][] = $val->group_srl; |
|
147 | + foreach($output->data as $val) { |
|
148 | + $grant[$val->name][] = $val->group_srl; |
|
149 | + } |
|
135 | 150 | } |
136 | 151 | |
137 | 152 | // get Extra Vars |
@@ -218,11 +233,19 @@ discard block |
||
218 | 233 | } |
219 | 234 | |
220 | 235 | // Grant module permissions |
221 | - if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant); |
|
222 | - if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
236 | + if(count($grant) > 0) { |
|
237 | + $oModuleController->insertModuleGrants($module_srl, $grant); |
|
238 | + } |
|
239 | + if($extra_vars) { |
|
240 | + $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); |
|
241 | + } |
|
223 | 242 | |
224 | - if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
225 | - if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
243 | + if($moduleSkinVars) { |
|
244 | + $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars); |
|
245 | + } |
|
246 | + if($moduleMobileSkinVars) { |
|
247 | + $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars); |
|
248 | + } |
|
226 | 249 | |
227 | 250 | $triggerObj->moduleSrlList[] = $module_srl; |
228 | 251 | } |
@@ -235,8 +258,7 @@ discard block |
||
235 | 258 | { |
236 | 259 | $message = implode('\n', $errorLog); |
237 | 260 | $this->setMessage($message); |
238 | - } |
|
239 | - else |
|
261 | + } else |
|
240 | 262 | { |
241 | 263 | $message = $lang->success_registed; |
242 | 264 | $this->setMessage('success_registed'); |
@@ -262,9 +284,9 @@ discard block |
||
262 | 284 | |
263 | 285 | private function _returnByProc($isProc, $msg='msg_invalid_request') |
264 | 286 | { |
265 | - if(!$isProc) |
|
266 | - return; |
|
267 | - else |
|
287 | + if(!$isProc) { |
|
288 | + return; |
|
289 | + } else |
|
268 | 290 | { |
269 | 291 | return new BaseObject(-1, $msg); |
270 | 292 | } |
@@ -282,7 +304,9 @@ discard block |
||
282 | 304 | // Get information of the module |
283 | 305 | $columnList = array('module_srl', 'module'); |
284 | 306 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList); |
285 | - if(!$module_info) return new BaseObject(-1,'msg_invalid_request'); |
|
307 | + if(!$module_info) { |
|
308 | + return new BaseObject(-1,'msg_invalid_request'); |
|
309 | + } |
|
286 | 310 | // Register Admin ID |
287 | 311 | $oModuleController->deleteAdminId($module_srl); |
288 | 312 | $admin_member = Context::get('admin_member'); |
@@ -292,7 +316,9 @@ discard block |
||
292 | 316 | foreach($admin_members as $admin_id) |
293 | 317 | { |
294 | 318 | $admin_id = trim($admin_id); |
295 | - if(!$admin_id) continue; |
|
319 | + if(!$admin_id) { |
|
320 | + continue; |
|
321 | + } |
|
296 | 322 | $oModuleController->insertAdminId($module_srl, $admin_id); |
297 | 323 | } |
298 | 324 | } |
@@ -318,15 +344,18 @@ discard block |
||
318 | 344 | $grant->{$grant_name}[] = $default; |
319 | 345 | continue; |
320 | 346 | // users in a particular group |
321 | - } |
|
322 | - else |
|
347 | + } else |
|
323 | 348 | { |
324 | 349 | $group_srls = Context::get($grant_name); |
325 | 350 | if($group_srls) |
326 | 351 | { |
327 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
328 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
329 | - else $group_srls = array($group_srls); |
|
352 | + if(strpos($group_srls,'|@|')!==false) { |
|
353 | + $group_srls = explode('|@|',$group_srls); |
|
354 | + } elseif(strpos($group_srls,',')!==false) { |
|
355 | + $group_srls = explode(',',$group_srls); |
|
356 | + } else { |
|
357 | + $group_srls = array($group_srls); |
|
358 | + } |
|
330 | 359 | $grant->{$grant_name} = $group_srls; |
331 | 360 | } |
332 | 361 | continue; |
@@ -338,7 +367,9 @@ discard block |
||
338 | 367 | $args = new stdClass(); |
339 | 368 | $args->module_srl = $module_srl; |
340 | 369 | $output = executeQuery('module.deleteModuleGrants', $args); |
341 | - if(!$output->toBool()) return $output; |
|
370 | + if(!$output->toBool()) { |
|
371 | + return $output; |
|
372 | + } |
|
342 | 373 | // Permissions stored in the DB |
343 | 374 | foreach($grant as $grant_name => $group_srls) |
344 | 375 | { |
@@ -349,7 +380,9 @@ discard block |
||
349 | 380 | $args->name = $grant_name; |
350 | 381 | $args->group_srl = $val; |
351 | 382 | $output = executeQuery('module.insertModuleGrant', $args); |
352 | - if(!$output->toBool()) return $output; |
|
383 | + if(!$output->toBool()) { |
|
384 | + return $output; |
|
385 | + } |
|
353 | 386 | } |
354 | 387 | } |
355 | 388 | $this->setMessage('success_registed'); |
@@ -375,19 +408,16 @@ discard block |
||
375 | 408 | if($module_info->is_mskin_fix == 'Y') |
376 | 409 | { |
377 | 410 | $skin = $module_info->mskin; |
378 | - } |
|
379 | - else |
|
411 | + } else |
|
380 | 412 | { |
381 | 413 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M'); |
382 | 414 | } |
383 | - } |
|
384 | - else |
|
415 | + } else |
|
385 | 416 | { |
386 | 417 | if($module_info->is_skin_fix == 'Y') |
387 | 418 | { |
388 | 419 | $skin = $module_info->skin; |
389 | - } |
|
390 | - else |
|
420 | + } else |
|
391 | 421 | { |
392 | 422 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P'); |
393 | 423 | } |
@@ -400,8 +430,7 @@ discard block |
||
400 | 430 | { |
401 | 431 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
402 | 432 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
403 | - } |
|
404 | - else |
|
433 | + } else |
|
405 | 434 | { |
406 | 435 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
407 | 436 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
@@ -421,7 +450,9 @@ discard block |
||
421 | 450 | { |
422 | 451 | foreach($skin_info->extra_vars as $vars) |
423 | 452 | { |
424 | - if($vars->type!='image') continue; |
|
453 | + if($vars->type!='image') { |
|
454 | + continue; |
|
455 | + } |
|
425 | 456 | |
426 | 457 | $image_obj = $obj->{$vars->name}; |
427 | 458 | // Get a variable to delete |
@@ -453,7 +484,9 @@ discard block |
||
453 | 484 | // Upload the file to a path |
454 | 485 | $path = sprintf("./files/attach/images/%s/", $module_srl); |
455 | 486 | // Create a directory |
456 | - if(!FileHandler::makeDir($path)) return false; |
|
487 | + if(!FileHandler::makeDir($path)) { |
|
488 | + return false; |
|
489 | + } |
|
457 | 490 | |
458 | 491 | $filename = $path.$image_obj['name']; |
459 | 492 | // Move the file |
@@ -484,8 +517,7 @@ discard block |
||
484 | 517 | if($mode === 'M') |
485 | 518 | { |
486 | 519 | $output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj); |
487 | - } |
|
488 | - else |
|
520 | + } else |
|
489 | 521 | { |
490 | 522 | $output = $oModuleController->insertModuleSkinVars($module_srl, $obj); |
491 | 523 | } |
@@ -506,10 +538,14 @@ discard block |
||
506 | 538 | { |
507 | 539 | $vars = Context::getRequestVars(); |
508 | 540 | |
509 | - if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
541 | + if(!$vars->module_srls) { |
|
542 | + return new BaseObject(-1,'msg_invalid_request'); |
|
543 | + } |
|
510 | 544 | |
511 | 545 | $module_srls = explode(',',$vars->module_srls); |
512 | - if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
546 | + if(count($module_srls) < 1) { |
|
547 | + return new BaseObject(-1,'msg_invalid_request'); |
|
548 | + } |
|
513 | 549 | |
514 | 550 | $oModuleModel = getModel('module'); |
515 | 551 | $oModuleController= getController('module'); |
@@ -541,8 +577,7 @@ discard block |
||
541 | 577 | if(Context::get('success_return_url')) |
542 | 578 | { |
543 | 579 | $this->setRedirectUrl(Context::get('success_return_url')); |
544 | - } |
|
545 | - else |
|
580 | + } else |
|
546 | 581 | { |
547 | 582 | global $lang; |
548 | 583 | htmlHeader(); |
@@ -561,10 +596,14 @@ discard block |
||
561 | 596 | function procModuleAdminModuleGrantSetup() |
562 | 597 | { |
563 | 598 | $module_srls = Context::get('module_srls'); |
564 | - if(!$module_srls) return new BaseObject(-1,'msg_invalid_request'); |
|
599 | + if(!$module_srls) { |
|
600 | + return new BaseObject(-1,'msg_invalid_request'); |
|
601 | + } |
|
565 | 602 | |
566 | 603 | $modules = explode(',',$module_srls); |
567 | - if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request'); |
|
604 | + if(count($modules) < 1) { |
|
605 | + return new BaseObject(-1,'msg_invalid_request'); |
|
606 | + } |
|
568 | 607 | |
569 | 608 | $oModuleController = getController('module'); |
570 | 609 | $oModuleModel = getModel('module'); |
@@ -592,17 +631,20 @@ discard block |
||
592 | 631 | $grant->{$grant_name}[] = $default; |
593 | 632 | continue; |
594 | 633 | // Users in a particular group |
595 | - } |
|
596 | - else |
|
634 | + } else |
|
597 | 635 | { |
598 | 636 | $group_srls = Context::get($grant_name); |
599 | 637 | if($group_srls) |
600 | 638 | { |
601 | 639 | if(!is_array($group_srls)) |
602 | 640 | { |
603 | - if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls); |
|
604 | - elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls); |
|
605 | - else $group_srls = array($group_srls); |
|
641 | + if(strpos($group_srls,'|@|')!==false) { |
|
642 | + $group_srls = explode('|@|',$group_srls); |
|
643 | + } elseif(strpos($group_srls,',')!==false) { |
|
644 | + $group_srls = explode(',',$group_srls); |
|
645 | + } else { |
|
646 | + $group_srls = array($group_srls); |
|
647 | + } |
|
606 | 648 | } |
607 | 649 | $grant->{$grant_name} = $group_srls; |
608 | 650 | } |
@@ -617,7 +659,9 @@ discard block |
||
617 | 659 | $args = new stdClass(); |
618 | 660 | $args->module_srl = $module_srl; |
619 | 661 | $output = executeQuery('module.deleteModuleGrants', $args); |
620 | - if(!$output->toBool()) continue; |
|
662 | + if(!$output->toBool()) { |
|
663 | + continue; |
|
664 | + } |
|
621 | 665 | // Permissions stored in the DB |
622 | 666 | foreach($grant as $grant_name => $group_srls) |
623 | 667 | { |
@@ -628,7 +672,9 @@ discard block |
||
628 | 672 | $args->name = $grant_name; |
629 | 673 | $args->group_srl = $val; |
630 | 674 | $output = executeQuery('module.insertModuleGrant', $args); |
631 | - if(!$output->toBool()) return $output; |
|
675 | + if(!$output->toBool()) { |
|
676 | + return $output; |
|
677 | + } |
|
632 | 678 | } |
633 | 679 | } |
634 | 680 | } |
@@ -638,8 +684,7 @@ discard block |
||
638 | 684 | if(Context::get('success_return_url')) |
639 | 685 | { |
640 | 686 | $this->setRedirectUrl(Context::get('success_return_url')); |
641 | - } |
|
642 | - else |
|
687 | + } else |
|
643 | 688 | { |
644 | 689 | global $lang; |
645 | 690 | htmlHeader(); |
@@ -665,18 +710,30 @@ discard block |
||
665 | 710 | $args->site_srl = (int)$site_module_info->site_srl; |
666 | 711 | $args->name = str_replace(' ','_',Context::get('lang_code')); |
667 | 712 | $args->lang_name = str_replace(' ','_',Context::get('lang_name')); |
668 | - if(!empty($args->lang_name)) $args->name = $args->lang_name; |
|
713 | + if(!empty($args->lang_name)) { |
|
714 | + $args->name = $args->lang_name; |
|
715 | + } |
|
669 | 716 | |
670 | 717 | // 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)); |
|
718 | + if(empty($args->name)) { |
|
719 | + $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100)); |
|
720 | + } |
|
672 | 721 | |
673 | - if(!$args->name) return new BaseObject(-1,'msg_invalid_request'); |
|
722 | + if(!$args->name) { |
|
723 | + return new BaseObject(-1,'msg_invalid_request'); |
|
724 | + } |
|
674 | 725 | // Check whether a language code exists |
675 | 726 | $output = executeQueryArray('module.getLang', $args); |
676 | - if(!$output->toBool()) return $output; |
|
727 | + if(!$output->toBool()) { |
|
728 | + return $output; |
|
729 | + } |
|
677 | 730 | // If exists, clear the old values for updating |
678 | - if($output->data) $output = executeQuery('module.deleteLang', $args); |
|
679 | - if(!$output->toBool()) return $output; |
|
731 | + if($output->data) { |
|
732 | + $output = executeQuery('module.deleteLang', $args); |
|
733 | + } |
|
734 | + if(!$output->toBool()) { |
|
735 | + return $output; |
|
736 | + } |
|
680 | 737 | // Enter |
681 | 738 | $lang_supported = Context::get('lang_supported'); |
682 | 739 | foreach($lang_supported as $key => $val) |
@@ -693,7 +750,9 @@ discard block |
||
693 | 750 | if($args->value) |
694 | 751 | { |
695 | 752 | $output = executeQuery('module.insertLang', $args); |
696 | - if(!$output->toBool()) return $output; |
|
753 | + if(!$output->toBool()) { |
|
754 | + return $output; |
|
755 | + } |
|
697 | 756 | } |
698 | 757 | } |
699 | 758 | $this->makeCacheDefinedLangCode($args->site_srl); |
@@ -716,11 +775,17 @@ discard block |
||
716 | 775 | $args->site_srl = (int)$site_module_info->site_srl; |
717 | 776 | $args->name = str_replace(' ','_',Context::get('name')); |
718 | 777 | $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 BaseObject(-1,'msg_invalid_request'); |
|
778 | + if(!empty($args->lang_name)) { |
|
779 | + $args->name = $args->lang_name; |
|
780 | + } |
|
781 | + if(!$args->name) { |
|
782 | + return new BaseObject(-1,'msg_invalid_request'); |
|
783 | + } |
|
721 | 784 | |
722 | 785 | $output = executeQuery('module.deleteLang', $args); |
723 | - if(!$output->toBool()) return $output; |
|
786 | + if(!$output->toBool()) { |
|
787 | + return $output; |
|
788 | + } |
|
724 | 789 | $this->makeCacheDefinedLangCode($args->site_srl); |
725 | 790 | |
726 | 791 | $this->setMessage("success_deleted", 'info'); |
@@ -731,7 +796,9 @@ discard block |
||
731 | 796 | |
732 | 797 | function procModuleAdminGetList() |
733 | 798 | { |
734 | - if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted'); |
|
799 | + if(!Context::get('is_logged')) { |
|
800 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
801 | + } |
|
735 | 802 | |
736 | 803 | $oModuleController = getController('module'); |
737 | 804 | $oModuleModel = getModel('module'); |
@@ -744,14 +811,20 @@ discard block |
||
744 | 811 | $args = new stdClass; |
745 | 812 | $logged_info = Context::get('logged_info'); |
746 | 813 | $site_module_info = Context::get('site_module_info'); |
747 | - if($site_keyword) $args->site_keyword = $site_keyword; |
|
814 | + if($site_keyword) { |
|
815 | + $args->site_keyword = $site_keyword; |
|
816 | + } |
|
748 | 817 | |
749 | 818 | if(!$site_srl) |
750 | 819 | { |
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; |
|
820 | + if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) { |
|
821 | + $args->site_srl = 0; |
|
822 | + } else { |
|
823 | + $args->site_srl = (int)$site_module_info->site_srl; |
|
824 | + } |
|
825 | + } else { |
|
826 | + $args->site_srl = $site_srl; |
|
753 | 827 | } |
754 | - else $args->site_srl = $site_srl; |
|
755 | 828 | |
756 | 829 | $args->sort_index1 = 'sites.domain'; |
757 | 830 | |
@@ -764,7 +837,9 @@ discard block |
||
764 | 837 | foreach($output->data as $val) |
765 | 838 | { |
766 | 839 | $module = trim($val->module); |
767 | - if(!$module) continue; |
|
840 | + if(!$module) { |
|
841 | + continue; |
|
842 | + } |
|
768 | 843 | |
769 | 844 | // replace user defined lang. |
770 | 845 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
@@ -800,7 +875,9 @@ discard block |
||
800 | 875 | { |
801 | 876 | foreach($mid_list as $module => $val) |
802 | 877 | { |
803 | - if(!$selected_module) $selected_module = $module; |
|
878 | + if(!$selected_module) { |
|
879 | + $selected_module = $module; |
|
880 | + } |
|
804 | 881 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
805 | 882 | |
806 | 883 | if(!$xml_info) |
@@ -823,8 +900,7 @@ discard block |
||
823 | 900 | { |
824 | 901 | $mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl]; |
825 | 902 | } |
826 | - } |
|
827 | - else |
|
903 | + } else |
|
828 | 904 | { |
829 | 905 | $mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category'); |
830 | 906 | } |
@@ -851,13 +927,14 @@ discard block |
||
851 | 927 | { |
852 | 928 | $site_module_info = Context::get('site_module_info'); |
853 | 929 | $args->site_srl = (int)$site_module_info->site_srl; |
854 | - } |
|
855 | - else |
|
930 | + } else |
|
856 | 931 | { |
857 | 932 | $args->site_srl = $site_srl; |
858 | 933 | } |
859 | 934 | $output = executeQueryArray('module.getLang', $args); |
860 | - if(!$output->toBool() || !$output->data) return; |
|
935 | + if(!$output->toBool() || !$output->data) { |
|
936 | + return; |
|
937 | + } |
|
861 | 938 | |
862 | 939 | $langMap = array(); |
863 | 940 | foreach($output->data as $lang) |
@@ -948,8 +1025,7 @@ discard block |
||
948 | 1025 | if($mid) |
949 | 1026 | { |
950 | 1027 | $moduleInfo = $oModuleModel->getModuleInfoByMid($mid); |
951 | - } |
|
952 | - else |
|
1028 | + } else |
|
953 | 1029 | { |
954 | 1030 | $moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl); |
955 | 1031 | } |
@@ -56,6 +56,9 @@ discard block |
||
56 | 56 | return $output; |
57 | 57 | } |
58 | 58 | |
59 | + /** |
|
60 | + * @param string $modulePath |
|
61 | + */ |
|
59 | 62 | function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL) |
60 | 63 | { |
61 | 64 | if($modulePath) |
@@ -306,7 +309,7 @@ discard block |
||
306 | 309 | * Skin setting page for the module |
307 | 310 | * |
308 | 311 | * @param $module_srl sequence of module |
309 | - * @param $mode P or M |
|
312 | + * @param string $mode P or M |
|
310 | 313 | * @return string The HTML code |
311 | 314 | */ |
312 | 315 | function _getModuleSkinHTML($module_srl, $mode) |
@@ -395,6 +398,7 @@ discard block |
||
395 | 398 | /** |
396 | 399 | * @brief Get values for a particular language code |
397 | 400 | * Return its corresponding value if lang_code is specified. Otherwise return $name. |
401 | + * @param string $name |
|
398 | 402 | */ |
399 | 403 | function getLangCode($site_srl, $name, $isFullLanguage = FALSE) |
400 | 404 | { |
@@ -513,6 +517,7 @@ discard block |
||
513 | 517 | |
514 | 518 | /** |
515 | 519 | * @brief Return current lang list |
520 | + * @param stdClass $args |
|
516 | 521 | */ |
517 | 522 | function getLangListByLangcode($args) |
518 | 523 | { |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | $args = new stdClass; |
27 | 27 | $args->module_srls = Context::get('module_srls'); |
28 | 28 | $output = executeQueryArray('module.getModulesInfo', $args); |
29 | - if(!$output->toBool() || !$output->data) return new BaseObject(); |
|
29 | + if (!$output->toBool() || !$output->data) return new BaseObject(); |
|
30 | 30 | |
31 | - foreach($output->data as $key => $val) |
|
31 | + foreach ($output->data as $key => $val) |
|
32 | 32 | { |
33 | 33 | $info_xml = $oModuleModel->getModuleInfoXml($val->module); |
34 | 34 | $oModuleController->replaceDefinedLangCode($val->browser_title); |
35 | - $list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title); |
|
35 | + $list[$val->module_srl] = array('module_srl'=>$val->module_srl, 'mid'=>$val->mid, 'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title); |
|
36 | 36 | } |
37 | - $modules = explode(',',$args->module_srls); |
|
38 | - for($i=0;$i<count($modules);$i++) |
|
37 | + $modules = explode(',', $args->module_srls); |
|
38 | + for ($i = 0; $i < count($modules); $i++) |
|
39 | 39 | { |
40 | 40 | $module_list[$modules[$i]] = $list[$modules[$i]]; |
41 | 41 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $args->list_count = 20; |
50 | 50 | $args->page_count = 10; |
51 | 51 | $output = executeQueryArray('module.getModuleMidList', $args); |
52 | - if(!$output->toBool()) return $output; |
|
52 | + if (!$output->toBool()) return $output; |
|
53 | 53 | |
54 | 54 | ModuleModel::syncModuleToSite($output->data); |
55 | 55 | |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | |
59 | 59 | function getSelectedManageHTML($grantList, $tabChoice = array(), $modulePath = NULL) |
60 | 60 | { |
61 | - if($modulePath) |
|
61 | + if ($modulePath) |
|
62 | 62 | { |
63 | 63 | // get the skins path |
64 | 64 | $oModuleModel = getModel('module'); |
65 | 65 | $skin_list = $oModuleModel->getSkins($modulePath); |
66 | - Context::set('skin_list',$skin_list); |
|
66 | + Context::set('skin_list', $skin_list); |
|
67 | 67 | |
68 | 68 | $mskin_list = $oModuleModel->getSkins($modulePath, "m.skins"); |
69 | 69 | Context::set('mskin_list', $mskin_list); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $layout_list = $oLayoutModel->getLayoutList(); |
75 | 75 | Context::set('layout_list', $layout_list); |
76 | 76 | |
77 | - $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M"); |
|
77 | + $mobile_layout_list = $oLayoutModel->getLayoutList(0, "M"); |
|
78 | 78 | Context::set('mlayout_list', $mobile_layout_list); |
79 | 79 | |
80 | 80 | $security = new Security(); |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | $security->encodeHTML('skin_list..title'); |
84 | 84 | $security->encodeHTML('mskin_list..title'); |
85 | 85 | |
86 | - $grant_list =new stdClass(); |
|
86 | + $grant_list = new stdClass(); |
|
87 | 87 | // Grant virtual permission for access and manager |
88 | - if(!$grantList) |
|
88 | + if (!$grantList) |
|
89 | 89 | { |
90 | - $grantList =new stdClass(); |
|
90 | + $grantList = new stdClass(); |
|
91 | 91 | } |
92 | 92 | $grantList->access = new stdClass(); |
93 | 93 | $grantList->access->title = Context::getLang('grant_access'); |
94 | 94 | $grantList->access->default = 'guest'; |
95 | - if(count($grantList)) |
|
95 | + if (count($grantList)) |
|
96 | 96 | { |
97 | - foreach($grantList as $key => $val) |
|
97 | + foreach ($grantList as $key => $val) |
|
98 | 98 | { |
99 | - if(!$val->default) $val->default = 'guest'; |
|
100 | - if($val->default == 'root') $val->default = 'manager'; |
|
99 | + if (!$val->default) $val->default = 'guest'; |
|
100 | + if ($val->default == 'root') $val->default = 'manager'; |
|
101 | 101 | $grant_list->{$key} = $val; |
102 | 102 | } |
103 | 103 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); |
120 | 120 | Context::set('setup_content', $content); |
121 | 121 | |
122 | - if(count($tabChoice) == 0) |
|
122 | + if (count($tabChoice) == 0) |
|
123 | 123 | { |
124 | 124 | $tabChoice = array('tab1'=>1, 'tab2'=>1, 'tab3'=>1); |
125 | 125 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | */ |
137 | 137 | function getModuleGrantHTML($module_srl, $source_grant_list) |
138 | 138 | { |
139 | - if(!$module_srl) |
|
139 | + if (!$module_srl) |
|
140 | 140 | { |
141 | 141 | return; |
142 | 142 | } |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | $grant_list->access = new stdClass(); |
155 | 155 | $grant_list->access->title = Context::getLang('grant_access'); |
156 | 156 | $grant_list->access->default = 'guest'; |
157 | - if(count($source_grant_list)) |
|
157 | + if (count($source_grant_list)) |
|
158 | 158 | { |
159 | - foreach($source_grant_list as $key => $val) |
|
159 | + foreach ($source_grant_list as $key => $val) |
|
160 | 160 | { |
161 | - if(!$val->default) $val->default = 'guest'; |
|
162 | - if($val->default == 'root') $val->default = 'manager'; |
|
161 | + if (!$val->default) $val->default = 'guest'; |
|
162 | + if ($val->default == 'root') $val->default = 'manager'; |
|
163 | 163 | $grant_list->{$key} = $val; |
164 | 164 | } |
165 | 165 | } |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | $args = new stdClass(); |
173 | 173 | $args->module_srl = $module_srl; |
174 | 174 | $output = executeQueryArray('module.getModuleGrants', $args); |
175 | - if($output->data) |
|
175 | + if ($output->data) |
|
176 | 176 | { |
177 | - foreach($output->data as $val) |
|
177 | + foreach ($output->data as $val) |
|
178 | 178 | { |
179 | - if($val->group_srl == 0) $default_grant[$val->name] = 'all'; |
|
180 | - else if($val->group_srl == -1) $default_grant[$val->name] = 'member'; |
|
181 | - else if($val->group_srl == -2) $default_grant[$val->name] = 'site'; |
|
182 | - else if($val->group_srl == -3) $default_grant[$val->name] = 'manager'; |
|
179 | + if ($val->group_srl == 0) $default_grant[$val->name] = 'all'; |
|
180 | + else if ($val->group_srl == -1) $default_grant[$val->name] = 'member'; |
|
181 | + else if ($val->group_srl == -2) $default_grant[$val->name] = 'site'; |
|
182 | + else if ($val->group_srl == -3) $default_grant[$val->name] = 'manager'; |
|
183 | 183 | else |
184 | 184 | { |
185 | 185 | $selected_group[$val->name][] = $val->group_srl; |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | { |
214 | 214 | $targetModule = Context::get('target_module'); |
215 | 215 | $moduleSrl = Context::get('module_srl'); |
216 | - if(!$targetModule || !$moduleSrl) |
|
216 | + if (!$targetModule || !$moduleSrl) |
|
217 | 217 | { |
218 | 218 | return new BaseObject(-1, 'msg_invalid_request'); |
219 | 219 | } |
220 | 220 | |
221 | - if($targetModule == '_SHORTCUT') |
|
221 | + if ($targetModule == '_SHORTCUT') |
|
222 | 222 | { |
223 | 223 | return new BaseObject(0); |
224 | 224 | } |
@@ -231,12 +231,12 @@ discard block |
||
231 | 231 | $grantList->access = new stdClass(); |
232 | 232 | $grantList->access->title = Context::getLang('grant_access'); |
233 | 233 | $grantList->access->default = 'guest'; |
234 | - if(count($xmlInfo->grant)) |
|
234 | + if (count($xmlInfo->grant)) |
|
235 | 235 | { |
236 | - foreach($xmlInfo->grant as $key => $val) |
|
236 | + foreach ($xmlInfo->grant as $key => $val) |
|
237 | 237 | { |
238 | - if(!$val->default) $val->default = 'guest'; |
|
239 | - if($val->default == 'root') $val->default = 'manager'; |
|
238 | + if (!$val->default) $val->default = 'guest'; |
|
239 | + if ($val->default == 'root') $val->default = 'manager'; |
|
240 | 240 | $grantList->{$key} = $val; |
241 | 241 | } |
242 | 242 | } |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | $args = new stdClass(); |
250 | 250 | $args->module_srl = $moduleSrl; |
251 | 251 | $output = executeQueryArray('module.getModuleGrants', $args); |
252 | - if($output->data) |
|
252 | + if ($output->data) |
|
253 | 253 | { |
254 | - foreach($output->data as $val) |
|
254 | + foreach ($output->data as $val) |
|
255 | 255 | { |
256 | - if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all'; |
|
257 | - else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member'; |
|
258 | - else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site'; |
|
259 | - else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager'; |
|
256 | + if ($val->group_srl == 0) $defaultGrant->{$val->name} = 'all'; |
|
257 | + else if ($val->group_srl == -1) $defaultGrant->{$val->name} = 'member'; |
|
258 | + else if ($val->group_srl == -2) $defaultGrant->{$val->name} = 'site'; |
|
259 | + else if ($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager'; |
|
260 | 260 | else |
261 | 261 | { |
262 | 262 | $selectedGroup->{$val->name}[] = $val->group_srl; |
@@ -265,15 +265,15 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - if(is_object($grantList)) |
|
268 | + if (is_object($grantList)) |
|
269 | 269 | { |
270 | - foreach($grantList AS $key=>$value) |
|
270 | + foreach ($grantList AS $key=>$value) |
|
271 | 271 | { |
272 | - if(isset($defaultGrant->{$key})) |
|
272 | + if (isset($defaultGrant->{$key})) |
|
273 | 273 | { |
274 | 274 | $grantList->{$key}->grant = $defaultGrant->{$key}; |
275 | 275 | } |
276 | - if(isset($selectedGroup->{$key})) |
|
276 | + if (isset($selectedGroup->{$key})) |
|
277 | 277 | { |
278 | 278 | $grantList->{$key}->group_srls = $selectedGroup->{$key}; |
279 | 279 | } |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | |
316 | 316 | $oModuleModel = getModel('module'); |
317 | 317 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
318 | - if(!$module_info) return; |
|
318 | + if (!$module_info) return; |
|
319 | 319 | |
320 | - if($mode === 'P') |
|
320 | + if ($mode === 'P') |
|
321 | 321 | { |
322 | - if($module_info->is_skin_fix == 'N') |
|
322 | + if ($module_info->is_skin_fix == 'N') |
|
323 | 323 | { |
324 | 324 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl); |
325 | 325 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | else |
332 | 332 | { |
333 | - if($module_info->is_mskin_fix == 'N') |
|
333 | + if ($module_info->is_mskin_fix == 'N') |
|
334 | 334 | { |
335 | 335 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl); |
336 | 336 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $module_path = './modules/'.$module_info->module; |
344 | 344 | |
345 | 345 | // Get XML information of the skin and skin sinformation set in DB |
346 | - if($mode === 'P') |
|
346 | + if ($mode === 'P') |
|
347 | 347 | { |
348 | 348 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
349 | 349 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
@@ -354,25 +354,25 @@ discard block |
||
354 | 354 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
355 | 355 | } |
356 | 356 | |
357 | - if(count($skin_info->extra_vars)) |
|
357 | + if (count($skin_info->extra_vars)) |
|
358 | 358 | { |
359 | - foreach($skin_info->extra_vars as $key => $val) |
|
359 | + foreach ($skin_info->extra_vars as $key => $val) |
|
360 | 360 | { |
361 | 361 | $group = $val->group; |
362 | 362 | $name = $val->name; |
363 | 363 | $type = $val->type; |
364 | - if($skin_vars[$name]) |
|
364 | + if ($skin_vars[$name]) |
|
365 | 365 | { |
366 | 366 | $value = $skin_vars[$name]->value; |
367 | 367 | } |
368 | 368 | else $value = ''; |
369 | - if($type=="checkbox") |
|
369 | + if ($type == "checkbox") |
|
370 | 370 | { |
371 | - $value = $value?unserialize($value):array(); |
|
371 | + $value = $value ?unserialize($value) : array(); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $value = empty($value) ? $val->default : $value; |
375 | - $skin_info->extra_vars[$key]->value= $value; |
|
375 | + $skin_info->extra_vars[$key]->value = $value; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function getLangCode($site_srl, $name, $isFullLanguage = FALSE) |
400 | 400 | { |
401 | - if($isFullLanguage) |
|
401 | + if ($isFullLanguage) |
|
402 | 402 | { |
403 | 403 | $lang_supported = Context::loadLangSupported(); |
404 | 404 | } |
@@ -407,15 +407,15 @@ discard block |
||
407 | 407 | $lang_supported = Context::get('lang_supported'); |
408 | 408 | } |
409 | 409 | |
410 | - if(substr($name,0,12)=='$user_lang->') |
|
410 | + if (substr($name, 0, 12) == '$user_lang->') |
|
411 | 411 | { |
412 | 412 | $args = new stdClass(); |
413 | - $args->site_srl = (int)$site_srl; |
|
414 | - $args->name = substr($name,12); |
|
413 | + $args->site_srl = (int) $site_srl; |
|
414 | + $args->name = substr($name, 12); |
|
415 | 415 | $output = executeQueryArray('module.getLang', $args); |
416 | - if($output->data) |
|
416 | + if ($output->data) |
|
417 | 417 | { |
418 | - foreach($output->data as $key => $val) |
|
418 | + foreach ($output->data as $key => $val) |
|
419 | 419 | { |
420 | 420 | $selected_lang[$val->lang_code] = $val->value; |
421 | 421 | } |
@@ -424,24 +424,24 @@ discard block |
||
424 | 424 | else |
425 | 425 | { |
426 | 426 | $tmp = unserialize($name); |
427 | - if($tmp) |
|
427 | + if ($tmp) |
|
428 | 428 | { |
429 | 429 | $selected_lang = array(); |
430 | 430 | $rand_name = $tmp[Context::getLangType()]; |
431 | - if(!$rand_name) $rand_name = array_shift($tmp); |
|
432 | - if(is_array($lang_supported)) |
|
431 | + if (!$rand_name) $rand_name = array_shift($tmp); |
|
432 | + if (is_array($lang_supported)) |
|
433 | 433 | { |
434 | - foreach($lang_supported as $key => $val) |
|
435 | - $selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name; |
|
434 | + foreach ($lang_supported as $key => $val) |
|
435 | + $selected_lang[$key] = $tmp[$key] ? $tmp[$key] : $rand_name; |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | 440 | $output = array(); |
441 | - if(is_array($lang_supported)) |
|
441 | + if (is_array($lang_supported)) |
|
442 | 442 | { |
443 | - foreach($lang_supported as $key => $val) |
|
444 | - $output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name; |
|
443 | + foreach ($lang_supported as $key => $val) |
|
444 | + $output[$key] = $selected_lang[$key] ? $selected_lang[$key] : $name; |
|
445 | 445 | } |
446 | 446 | return $output; |
447 | 447 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | function getModuleAdminLangCode() |
453 | 453 | { |
454 | 454 | $name = Context::get('name'); |
455 | - if(!$name) return new BaseObject(-1,'msg_invalid_request'); |
|
455 | + if (!$name) return new BaseObject(-1, 'msg_invalid_request'); |
|
456 | 456 | $site_module_info = Context::get('site_module_info'); |
457 | 457 | $this->add('name', $name); |
458 | 458 | $output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name); |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | function getModuleAdminLangListByName() |
466 | 466 | { |
467 | 467 | $args = Context::getRequestVars(); |
468 | - if(!$args->site_srl) $args->site_srl = 0; |
|
468 | + if (!$args->site_srl) $args->site_srl = 0; |
|
469 | 469 | |
470 | 470 | $columnList = array('lang_code', 'name', 'value'); |
471 | 471 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | $args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name); |
475 | 475 | $output = executeQueryArray('module.getLangListByName', $args, $columnList); |
476 | - if($output->toBool()) $langList = $output->data; |
|
476 | + if ($output->toBool()) $langList = $output->data; |
|
477 | 477 | |
478 | 478 | $this->add('lang_list', $langList); |
479 | 479 | $this->add('lang_name', $args->langName); |
@@ -485,23 +485,23 @@ discard block |
||
485 | 485 | function getModuleAdminLangListByValue() |
486 | 486 | { |
487 | 487 | $args = Context::getRequestVars(); |
488 | - if(!$args->site_srl) $args->site_srl = 0; |
|
488 | + if (!$args->site_srl) $args->site_srl = 0; |
|
489 | 489 | |
490 | 490 | $langList = array(); |
491 | 491 | |
492 | 492 | // search value |
493 | 493 | $output = executeQueryArray('module.getLangNameByValue', $args); |
494 | - if($output->toBool() && is_array($output->data)) |
|
494 | + if ($output->toBool() && is_array($output->data)) |
|
495 | 495 | { |
496 | 496 | unset($args->value); |
497 | 497 | |
498 | - foreach($output->data as $data) |
|
498 | + foreach ($output->data as $data) |
|
499 | 499 | { |
500 | 500 | $args->langName = $data->name; |
501 | 501 | $columnList = array('lang_code', 'name', 'value'); |
502 | 502 | $outputByName = executeQueryArray('module.getLangListByName', $args, $columnList); |
503 | 503 | |
504 | - if($outputByName->toBool()) |
|
504 | + if ($outputByName->toBool()) |
|
505 | 505 | { |
506 | 506 | $langList = array_merge($langList, $outputByName->data); |
507 | 507 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | function getLangListByLangcode($args) |
518 | 518 | { |
519 | 519 | $output = executeQueryArray('module.getLangListByLangcode', $args); |
520 | - if(!$output->toBool()) return array(); |
|
520 | + if (!$output->toBool()) return array(); |
|
521 | 521 | |
522 | 522 | return $output; |
523 | 523 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | function getModuleAdminMultilingualHtml() |
529 | 529 | { |
530 | 530 | $oTemplate = TemplateHandler::getInstance(); |
531 | - $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17.html'); |
|
531 | + $tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17.html'); |
|
532 | 532 | |
533 | 533 | $this->add('html', $tpl); |
534 | 534 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | { |
541 | 541 | $site_module_info = Context::get('site_module_info'); |
542 | 542 | $args = new stdClass(); |
543 | - $args->site_srl = (int)$site_module_info->site_srl; |
|
543 | + $args->site_srl = (int) $site_module_info->site_srl; |
|
544 | 544 | $args->langCode = Context::get('lang_code'); |
545 | 545 | $args->page = Context::get('page'); |
546 | 546 | $args->sort_index = 'name'; |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | $args->list_count = Context::get('list_count'); |
551 | 551 | $args->page_count = 5; |
552 | 552 | |
553 | - if(!$args->langCode) |
|
553 | + if (!$args->langCode) |
|
554 | 554 | { |
555 | 555 | $args->langCode = Context::get('lang_type'); |
556 | 556 | } |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $oSecurity->encodeHTML('lang_code_list..'); |
568 | 568 | |
569 | 569 | $oTemplate = TemplateHandler::getInstance(); |
570 | - $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'multilingual_v17_list.html'); |
|
570 | + $tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'multilingual_v17_list.html'); |
|
571 | 571 | |
572 | 572 | $this->add('html', $tpl); |
573 | 573 | } |
@@ -577,9 +577,9 @@ discard block |
||
577 | 577 | */ |
578 | 578 | function getModuleAdminModuleSearcherHtml() |
579 | 579 | { |
580 | - Context::loadLang(_XE_PATH_ . 'modules/admin/lang'); |
|
580 | + Context::loadLang(_XE_PATH_.'modules/admin/lang'); |
|
581 | 581 | $oTemplate = TemplateHandler::getInstance(); |
582 | - $tpl = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl', 'module_searcher_v17.html'); |
|
582 | + $tpl = $oTemplate->compile(_XE_PATH_.'modules/module/tpl', 'module_searcher_v17.html'); |
|
583 | 583 | |
584 | 584 | $this->add('html', $tpl); |
585 | 585 | } |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | */ |
590 | 590 | function getModuleAdminModuleInfo() |
591 | 591 | { |
592 | - if(Context::get('search_module_srl')) |
|
592 | + if (Context::get('search_module_srl')) |
|
593 | 593 | { |
594 | 594 | $module_srl = Context::get('search_module_srl'); |
595 | 595 | } |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | $args = new stdClass; |
27 | 27 | $args->module_srls = Context::get('module_srls'); |
28 | 28 | $output = executeQueryArray('module.getModulesInfo', $args); |
29 | - if(!$output->toBool() || !$output->data) return new BaseObject(); |
|
29 | + if(!$output->toBool() || !$output->data) { |
|
30 | + return new BaseObject(); |
|
31 | + } |
|
30 | 32 | |
31 | 33 | foreach($output->data as $key => $val) |
32 | 34 | { |
@@ -49,7 +51,9 @@ discard block |
||
49 | 51 | $args->list_count = 20; |
50 | 52 | $args->page_count = 10; |
51 | 53 | $output = executeQueryArray('module.getModuleMidList', $args); |
52 | - if(!$output->toBool()) return $output; |
|
54 | + if(!$output->toBool()) { |
|
55 | + return $output; |
|
56 | + } |
|
53 | 57 | |
54 | 58 | ModuleModel::syncModuleToSite($output->data); |
55 | 59 | |
@@ -96,8 +100,12 @@ discard block |
||
96 | 100 | { |
97 | 101 | foreach($grantList as $key => $val) |
98 | 102 | { |
99 | - if(!$val->default) $val->default = 'guest'; |
|
100 | - if($val->default == 'root') $val->default = 'manager'; |
|
103 | + if(!$val->default) { |
|
104 | + $val->default = 'guest'; |
|
105 | + } |
|
106 | + if($val->default == 'root') { |
|
107 | + $val->default = 'manager'; |
|
108 | + } |
|
101 | 109 | $grant_list->{$key} = $val; |
102 | 110 | } |
103 | 111 | } |
@@ -158,8 +166,12 @@ discard block |
||
158 | 166 | { |
159 | 167 | foreach($source_grant_list as $key => $val) |
160 | 168 | { |
161 | - if(!$val->default) $val->default = 'guest'; |
|
162 | - if($val->default == 'root') $val->default = 'manager'; |
|
169 | + if(!$val->default) { |
|
170 | + $val->default = 'guest'; |
|
171 | + } |
|
172 | + if($val->default == 'root') { |
|
173 | + $val->default = 'manager'; |
|
174 | + } |
|
163 | 175 | $grant_list->{$key} = $val; |
164 | 176 | } |
165 | 177 | } |
@@ -176,11 +188,15 @@ discard block |
||
176 | 188 | { |
177 | 189 | foreach($output->data as $val) |
178 | 190 | { |
179 | - if($val->group_srl == 0) $default_grant[$val->name] = 'all'; |
|
180 | - else if($val->group_srl == -1) $default_grant[$val->name] = 'member'; |
|
181 | - else if($val->group_srl == -2) $default_grant[$val->name] = 'site'; |
|
182 | - else if($val->group_srl == -3) $default_grant[$val->name] = 'manager'; |
|
183 | - else |
|
191 | + if($val->group_srl == 0) { |
|
192 | + $default_grant[$val->name] = 'all'; |
|
193 | + } else if($val->group_srl == -1) { |
|
194 | + $default_grant[$val->name] = 'member'; |
|
195 | + } else if($val->group_srl == -2) { |
|
196 | + $default_grant[$val->name] = 'site'; |
|
197 | + } else if($val->group_srl == -3) { |
|
198 | + $default_grant[$val->name] = 'manager'; |
|
199 | + } else |
|
184 | 200 | { |
185 | 201 | $selected_group[$val->name][] = $val->group_srl; |
186 | 202 | $default_grant[$val->name] = 'group'; |
@@ -235,8 +251,12 @@ discard block |
||
235 | 251 | { |
236 | 252 | foreach($xmlInfo->grant as $key => $val) |
237 | 253 | { |
238 | - if(!$val->default) $val->default = 'guest'; |
|
239 | - if($val->default == 'root') $val->default = 'manager'; |
|
254 | + if(!$val->default) { |
|
255 | + $val->default = 'guest'; |
|
256 | + } |
|
257 | + if($val->default == 'root') { |
|
258 | + $val->default = 'manager'; |
|
259 | + } |
|
240 | 260 | $grantList->{$key} = $val; |
241 | 261 | } |
242 | 262 | } |
@@ -253,11 +273,15 @@ discard block |
||
253 | 273 | { |
254 | 274 | foreach($output->data as $val) |
255 | 275 | { |
256 | - if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all'; |
|
257 | - else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member'; |
|
258 | - else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site'; |
|
259 | - else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager'; |
|
260 | - else |
|
276 | + if($val->group_srl == 0) { |
|
277 | + $defaultGrant->{$val->name} = 'all'; |
|
278 | + } else if($val->group_srl == -1) { |
|
279 | + $defaultGrant->{$val->name} = 'member'; |
|
280 | + } else if($val->group_srl == -2) { |
|
281 | + $defaultGrant->{$val->name} = 'site'; |
|
282 | + } else if($val->group_srl == -3) { |
|
283 | + $defaultGrant->{$val->name} = 'manager'; |
|
284 | + } else |
|
261 | 285 | { |
262 | 286 | $selectedGroup->{$val->name}[] = $val->group_srl; |
263 | 287 | $defaultGrant->{$val->name} = 'group'; |
@@ -315,26 +339,25 @@ discard block |
||
315 | 339 | |
316 | 340 | $oModuleModel = getModel('module'); |
317 | 341 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
318 | - if(!$module_info) return; |
|
342 | + if(!$module_info) { |
|
343 | + return; |
|
344 | + } |
|
319 | 345 | |
320 | 346 | if($mode === 'P') |
321 | 347 | { |
322 | 348 | if($module_info->is_skin_fix == 'N') |
323 | 349 | { |
324 | 350 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl); |
325 | - } |
|
326 | - else |
|
351 | + } else |
|
327 | 352 | { |
328 | 353 | $skin = $module_info->skin; |
329 | 354 | } |
330 | - } |
|
331 | - else |
|
355 | + } else |
|
332 | 356 | { |
333 | 357 | if($module_info->is_mskin_fix == 'N') |
334 | 358 | { |
335 | 359 | $skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl); |
336 | - } |
|
337 | - else |
|
360 | + } else |
|
338 | 361 | { |
339 | 362 | $skin = $module_info->mskin; |
340 | 363 | } |
@@ -347,8 +370,7 @@ discard block |
||
347 | 370 | { |
348 | 371 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); |
349 | 372 | $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); |
350 | - } |
|
351 | - else |
|
373 | + } else |
|
352 | 374 | { |
353 | 375 | $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins'); |
354 | 376 | $skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl); |
@@ -364,8 +386,9 @@ discard block |
||
364 | 386 | if($skin_vars[$name]) |
365 | 387 | { |
366 | 388 | $value = $skin_vars[$name]->value; |
389 | + } else { |
|
390 | + $value = ''; |
|
367 | 391 | } |
368 | - else $value = ''; |
|
369 | 392 | if($type=="checkbox") |
370 | 393 | { |
371 | 394 | $value = $value?unserialize($value):array(); |
@@ -401,8 +424,7 @@ discard block |
||
401 | 424 | if($isFullLanguage) |
402 | 425 | { |
403 | 426 | $lang_supported = Context::loadLangSupported(); |
404 | - } |
|
405 | - else |
|
427 | + } else |
|
406 | 428 | { |
407 | 429 | $lang_supported = Context::get('lang_supported'); |
408 | 430 | } |
@@ -420,19 +442,21 @@ discard block |
||
420 | 442 | $selected_lang[$val->lang_code] = $val->value; |
421 | 443 | } |
422 | 444 | } |
423 | - } |
|
424 | - else |
|
445 | + } else |
|
425 | 446 | { |
426 | 447 | $tmp = unserialize($name); |
427 | 448 | if($tmp) |
428 | 449 | { |
429 | 450 | $selected_lang = array(); |
430 | 451 | $rand_name = $tmp[Context::getLangType()]; |
431 | - if(!$rand_name) $rand_name = array_shift($tmp); |
|
452 | + if(!$rand_name) { |
|
453 | + $rand_name = array_shift($tmp); |
|
454 | + } |
|
432 | 455 | if(is_array($lang_supported)) |
433 | 456 | { |
434 | - foreach($lang_supported as $key => $val) |
|
435 | - $selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name; |
|
457 | + foreach($lang_supported as $key => $val) { |
|
458 | + $selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name; |
|
459 | + } |
|
436 | 460 | } |
437 | 461 | } |
438 | 462 | } |
@@ -440,8 +464,9 @@ discard block |
||
440 | 464 | $output = array(); |
441 | 465 | if(is_array($lang_supported)) |
442 | 466 | { |
443 | - foreach($lang_supported as $key => $val) |
|
444 | - $output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name; |
|
467 | + foreach($lang_supported as $key => $val) { |
|
468 | + $output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name; |
|
469 | + } |
|
445 | 470 | } |
446 | 471 | return $output; |
447 | 472 | } |
@@ -452,7 +477,9 @@ discard block |
||
452 | 477 | function getModuleAdminLangCode() |
453 | 478 | { |
454 | 479 | $name = Context::get('name'); |
455 | - if(!$name) return new BaseObject(-1,'msg_invalid_request'); |
|
480 | + if(!$name) { |
|
481 | + return new BaseObject(-1,'msg_invalid_request'); |
|
482 | + } |
|
456 | 483 | $site_module_info = Context::get('site_module_info'); |
457 | 484 | $this->add('name', $name); |
458 | 485 | $output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name); |
@@ -465,7 +492,9 @@ discard block |
||
465 | 492 | function getModuleAdminLangListByName() |
466 | 493 | { |
467 | 494 | $args = Context::getRequestVars(); |
468 | - if(!$args->site_srl) $args->site_srl = 0; |
|
495 | + if(!$args->site_srl) { |
|
496 | + $args->site_srl = 0; |
|
497 | + } |
|
469 | 498 | |
470 | 499 | $columnList = array('lang_code', 'name', 'value'); |
471 | 500 | |
@@ -473,7 +502,9 @@ discard block |
||
473 | 502 | |
474 | 503 | $args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name); |
475 | 504 | $output = executeQueryArray('module.getLangListByName', $args, $columnList); |
476 | - if($output->toBool()) $langList = $output->data; |
|
505 | + if($output->toBool()) { |
|
506 | + $langList = $output->data; |
|
507 | + } |
|
477 | 508 | |
478 | 509 | $this->add('lang_list', $langList); |
479 | 510 | $this->add('lang_name', $args->langName); |
@@ -485,7 +516,9 @@ discard block |
||
485 | 516 | function getModuleAdminLangListByValue() |
486 | 517 | { |
487 | 518 | $args = Context::getRequestVars(); |
488 | - if(!$args->site_srl) $args->site_srl = 0; |
|
519 | + if(!$args->site_srl) { |
|
520 | + $args->site_srl = 0; |
|
521 | + } |
|
489 | 522 | |
490 | 523 | $langList = array(); |
491 | 524 | |
@@ -517,7 +550,9 @@ discard block |
||
517 | 550 | function getLangListByLangcode($args) |
518 | 551 | { |
519 | 552 | $output = executeQueryArray('module.getLangListByLangcode', $args); |
520 | - if(!$output->toBool()) return array(); |
|
553 | + if(!$output->toBool()) { |
|
554 | + return array(); |
|
555 | + } |
|
521 | 556 | |
522 | 557 | return $output; |
523 | 558 | } |
@@ -592,8 +627,7 @@ discard block |
||
592 | 627 | if(Context::get('search_module_srl')) |
593 | 628 | { |
594 | 629 | $module_srl = Context::get('search_module_srl'); |
595 | - } |
|
596 | - else |
|
630 | + } else |
|
597 | 631 | { |
598 | 632 | $module_srl = Context::get('module_srl'); |
599 | 633 | } |
@@ -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 |
@@ -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 BaseObject(-1,'msg_already_registed_vid'); |
|
272 | - } |
|
273 | - else |
|
285 | + if($oModuleModel->isIDExists($domain, 0)) { |
|
286 | + return new BaseObject(-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 BaseObject(-1,'msg_already_registed_vid'); |
|
302 | + if($output) { |
|
303 | + return new BaseObject(-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 BaseObject(-1,'msg_already_registed_domain'); |
|
314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
332 | + if($info->site_srl && $info->site_srl != $args->site_srl) { |
|
333 | + return new BaseObject(-1,'msg_already_registed_domain'); |
|
334 | + } |
|
335 | + if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) { |
|
336 | + return new BaseObject(-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 BaseObject(-1, 'msg_limit_mid'); |
|
374 | + if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) { |
|
375 | + return new BaseObject(-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 BaseObject(-1, 'msg_module_name_exists'); |
|
427 | + if($oModuleModel->isIDExists($args->mid, $args->site_srl)) { |
|
428 | + return new BaseObject(-1, 'msg_module_name_exists'); |
|
429 | + } |
|
397 | 430 | |
398 | 431 | // begin transaction |
399 | 432 | $oDB = &DB::getInstance(); |
@@ -404,20 +437,20 @@ discard block |
||
404 | 437 | $skin_vars = new stdClass(); |
405 | 438 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
406 | 439 | // Arrange variables and then execute a query |
407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
440 | + if(!$args->module_srl) { |
|
441 | + $args->module_srl = getNextSequence(); |
|
442 | + } |
|
408 | 443 | |
409 | 444 | // default value |
410 | 445 | if($args->skin == '/USE_DEFAULT/') |
411 | 446 | { |
412 | 447 | $args->is_skin_fix = 'N'; |
413 | - } |
|
414 | - else |
|
448 | + } else |
|
415 | 449 | { |
416 | 450 | if(isset($args->is_skin_fix)) |
417 | 451 | { |
418 | 452 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
419 | - } |
|
420 | - else |
|
453 | + } else |
|
421 | 454 | { |
422 | 455 | $args->is_skin_fix = 'Y'; |
423 | 456 | } |
@@ -426,14 +459,12 @@ discard block |
||
426 | 459 | if($args->mskin == '/USE_DEFAULT/') |
427 | 460 | { |
428 | 461 | $args->is_mskin_fix = 'N'; |
429 | - } |
|
430 | - else |
|
462 | + } else |
|
431 | 463 | { |
432 | 464 | if(isset($args->is_mskin_fix)) |
433 | 465 | { |
434 | 466 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
435 | - } |
|
436 | - else |
|
467 | + } else |
|
437 | 468 | { |
438 | 469 | $args->is_mskin_fix = 'Y'; |
439 | 470 | } |
@@ -510,14 +541,15 @@ discard block |
||
510 | 541 | if(isset($args->isMenuCreate)) |
511 | 542 | { |
512 | 543 | $isMenuCreate = $args->isMenuCreate; |
513 | - } |
|
514 | - else |
|
544 | + } else |
|
515 | 545 | { |
516 | 546 | $isMenuCreate = TRUE; |
517 | 547 | } |
518 | 548 | |
519 | 549 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
520 | - if(!$output->toBool()) return $output; |
|
550 | + if(!$output->toBool()) { |
|
551 | + return $output; |
|
552 | + } |
|
521 | 553 | // begin transaction |
522 | 554 | $oDB = &DB::getInstance(); |
523 | 555 | $oDB->begin(); |
@@ -528,8 +560,12 @@ discard block |
||
528 | 560 | |
529 | 561 | if(!$args->site_srl || !$args->browser_title) |
530 | 562 | { |
531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
563 | + if(!$args->site_srl) { |
|
564 | + $args->site_srl = (int)$module_info->site_srl; |
|
565 | + } |
|
566 | + if(!$args->browser_title) { |
|
567 | + $args->browser_title = $module_info->browser_title; |
|
568 | + } |
|
533 | 569 | } |
534 | 570 | |
535 | 571 | $args->browser_title = strip_tags($args->browser_title); |
@@ -545,14 +581,12 @@ discard block |
||
545 | 581 | if($args->skin == '/USE_DEFAULT/') |
546 | 582 | { |
547 | 583 | $args->is_skin_fix = 'N'; |
548 | - } |
|
549 | - else |
|
584 | + } else |
|
550 | 585 | { |
551 | 586 | if(isset($args->is_skin_fix)) |
552 | 587 | { |
553 | 588 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
554 | - } |
|
555 | - else |
|
589 | + } else |
|
556 | 590 | { |
557 | 591 | $args->is_skin_fix = 'Y'; |
558 | 592 | } |
@@ -561,14 +595,12 @@ discard block |
||
561 | 595 | if($args->mskin == '/USE_DEFAULT/') |
562 | 596 | { |
563 | 597 | $args->is_mskin_fix = 'N'; |
564 | - } |
|
565 | - else |
|
598 | + } else |
|
566 | 599 | { |
567 | 600 | if(isset($args->is_mskin_fix)) |
568 | 601 | { |
569 | 602 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
570 | - } |
|
571 | - else |
|
603 | + } else |
|
572 | 604 | { |
573 | 605 | $args->is_mskin_fix = 'Y'; |
574 | 606 | } |
@@ -637,7 +669,9 @@ discard block |
||
637 | 669 | $args->update_id = $update_id; |
638 | 670 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
639 | 671 | |
640 | - if(!!$output->error) return false; |
|
672 | + if(!!$output->error) { |
|
673 | + return false; |
|
674 | + } |
|
641 | 675 | |
642 | 676 | return true; |
643 | 677 | } |
@@ -652,7 +686,9 @@ discard block |
||
652 | 686 | $args->site_srl = $site_srl; |
653 | 687 | $args->layout_srl = $layout_srl; |
654 | 688 | $output = executeQuery('module.updateModuleSite', $args); |
655 | - if(!$output->toBool()) return $output; |
|
689 | + if(!$output->toBool()) { |
|
690 | + return $output; |
|
691 | + } |
|
656 | 692 | |
657 | 693 | //remove from cache |
658 | 694 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -671,7 +707,9 @@ discard block |
||
671 | 707 | */ |
672 | 708 | function deleteModule($module_srl, $site_srl = 0) |
673 | 709 | { |
674 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
710 | + if(!$module_srl) { |
|
711 | + return new BaseObject(-1,'msg_invalid_request'); |
|
712 | + } |
|
675 | 713 | |
676 | 714 | $site_module_info = Context::get('site_module_info'); |
677 | 715 | |
@@ -681,8 +719,11 @@ discard block |
||
681 | 719 | $args = new stdClass(); |
682 | 720 | $args->url = $output->mid; |
683 | 721 | $args->is_shortcut = 'N'; |
684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
685 | - else $args->site_srl = $site_srl; |
|
722 | + if(!$site_srl) { |
|
723 | + $args->site_srl = $site_module_info->site_srl; |
|
724 | + } else { |
|
725 | + $args->site_srl = $site_srl; |
|
726 | + } |
|
686 | 727 | |
687 | 728 | unset($output); |
688 | 729 | |
@@ -715,8 +756,7 @@ discard block |
||
715 | 756 | if($output->isSuccess) |
716 | 757 | { |
717 | 758 | return new BaseObject(0, 'success_deleted'); |
718 | - } |
|
719 | - else |
|
759 | + } else |
|
720 | 760 | { |
721 | 761 | return new BaseObject($output->error, $output->message); |
722 | 762 | } |
@@ -734,19 +774,25 @@ discard block |
||
734 | 774 | */ |
735 | 775 | public function onlyDeleteModule($module_srl) |
736 | 776 | { |
737 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
777 | + if(!$module_srl) { |
|
778 | + return new BaseObject(-1,'msg_invalid_request'); |
|
779 | + } |
|
738 | 780 | |
739 | 781 | // check start module |
740 | 782 | $oModuleModel = getModel('module'); |
741 | 783 | $columnList = array('sites.index_module_srl'); |
742 | 784 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
743 | - if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
785 | + if($module_srl == $start_module->index_module_srl) { |
|
786 | + return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
787 | + } |
|
744 | 788 | |
745 | 789 | // Call a trigger (before) |
746 | 790 | $trigger_obj = new stdClass(); |
747 | 791 | $trigger_obj->module_srl = $module_srl; |
748 | 792 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
749 | - if(!$output->toBool()) return $output; |
|
793 | + if(!$output->toBool()) { |
|
794 | + return $output; |
|
795 | + } |
|
750 | 796 | |
751 | 797 | // begin transaction |
752 | 798 | $oDB = &DB::getInstance(); |
@@ -807,7 +853,9 @@ discard block |
||
807 | 853 | function clearDefaultModule() |
808 | 854 | { |
809 | 855 | $output = executeQuery('module.clearDefaultModule'); |
810 | - if(!$output->toBool()) return $output; |
|
856 | + if(!$output->toBool()) { |
|
857 | + return $output; |
|
858 | + } |
|
811 | 859 | |
812 | 860 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
813 | 861 | if($oCacheHandler->isSupport()) |
@@ -839,7 +887,9 @@ discard block |
||
839 | 887 | */ |
840 | 888 | function updateModuleLayout($layout_srl, $menu_srl_list) |
841 | 889 | { |
842 | - if(!count($menu_srl_list)) return; |
|
890 | + if(!count($menu_srl_list)) { |
|
891 | + return; |
|
892 | + } |
|
843 | 893 | |
844 | 894 | $args = new stdClass; |
845 | 895 | $args->layout_srl = $layout_srl; |
@@ -866,28 +916,37 @@ discard block |
||
866 | 916 | |
867 | 917 | $output = executeQuery('module.deleteSiteAdmin', $args); |
868 | 918 | |
869 | - if(!$output->toBool()) return $output; |
|
919 | + if(!$output->toBool()) { |
|
920 | + return $output; |
|
921 | + } |
|
870 | 922 | // Get user id of an administrator |
871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
923 | + if(!is_array($arr_admins) || !count($arr_admins)) { |
|
924 | + return new BaseObject(); |
|
925 | + } |
|
872 | 926 | foreach($arr_admins as $key => $user_id) |
873 | 927 | { |
874 | - if(!trim($user_id)) continue; |
|
928 | + if(!trim($user_id)) { |
|
929 | + continue; |
|
930 | + } |
|
875 | 931 | $admins[] = trim($user_id); |
876 | 932 | } |
877 | - if(!count($admins)) return new BaseObject(); |
|
933 | + if(!count($admins)) { |
|
934 | + return new BaseObject(); |
|
935 | + } |
|
878 | 936 | |
879 | 937 | $oMemberModel = getModel('member'); |
880 | 938 | $member_config = $oMemberModel->getMemberConfig(); |
881 | 939 | if($member_config->identifier == 'email_address') |
882 | 940 | { |
883 | 941 | $args->email_address = '\''.implode('\',\'',$admins).'\''; |
884 | - } |
|
885 | - else |
|
942 | + } else |
|
886 | 943 | { |
887 | 944 | $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
888 | 945 | } |
889 | 946 | $output = executeQueryArray('module.getAdminSrls', $args); |
890 | - if(!$output->toBool()||!$output->data) return $output; |
|
947 | + if(!$output->toBool()||!$output->data) { |
|
948 | + return $output; |
|
949 | + } |
|
891 | 950 | |
892 | 951 | foreach($output->data as $key => $val) |
893 | 952 | { |
@@ -896,7 +955,9 @@ discard block |
||
896 | 955 | $args->site_srl = $site_srl; |
897 | 956 | $args->member_srl = $val->member_srl; |
898 | 957 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
899 | - if(!$output->toBool()) return $output; |
|
958 | + if(!$output->toBool()) { |
|
959 | + return $output; |
|
960 | + } |
|
900 | 961 | } |
901 | 962 | return new BaseObject(); |
902 | 963 | } |
@@ -909,12 +970,15 @@ discard block |
||
909 | 970 | $oMemberModel = getModel('member'); |
910 | 971 | $member_config = $oMemberModel->getMemberConfig(); |
911 | 972 | |
912 | - if($member_config->identifier == 'email_address') |
|
913 | - $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
914 | - else |
|
915 | - $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
973 | + if($member_config->identifier == 'email_address') { |
|
974 | + $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
|
975 | + } else { |
|
976 | + $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
|
977 | + } |
|
916 | 978 | |
917 | - if(!$member_info->member_srl) return; |
|
979 | + if(!$member_info->member_srl) { |
|
980 | + return; |
|
981 | + } |
|
918 | 982 | $args = new stdClass(); |
919 | 983 | $args->module_srl = $module_srl; |
920 | 984 | $args->member_srl = $member_info->member_srl; |
@@ -933,7 +997,9 @@ discard block |
||
933 | 997 | { |
934 | 998 | $oMemberModel = getModel('member'); |
935 | 999 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
1000 | + if($member_info->member_srl) { |
|
1001 | + $args->member_srl = $member_info->member_srl; |
|
1002 | + } |
|
937 | 1003 | } |
938 | 1004 | return executeQuery('module.deleteAdminId', $args); |
939 | 1005 | } |
@@ -977,7 +1043,9 @@ discard block |
||
977 | 1043 | } |
978 | 1044 | |
979 | 1045 | getDestroyXeVars($obj); |
980 | - if(!$obj || !count($obj)) return new BaseObject(); |
|
1046 | + if(!$obj || !count($obj)) { |
|
1047 | + return new BaseObject(); |
|
1048 | + } |
|
981 | 1049 | |
982 | 1050 | $args = new stdClass; |
983 | 1051 | $args->module_srl = $module_srl; |
@@ -987,18 +1055,23 @@ discard block |
||
987 | 1055 | // it often saved menu item(stdClass) on the skin info column |
988 | 1056 | // When updating the module on XE core 1.2.0 later versions, it occurs an error |
989 | 1057 | // fixed the error |
990 | - if (is_object($val)) continue; |
|
991 | - if (is_array($val)) $val = serialize($val); |
|
1058 | + if (is_object($val)) { |
|
1059 | + continue; |
|
1060 | + } |
|
1061 | + if (is_array($val)) { |
|
1062 | + $val = serialize($val); |
|
1063 | + } |
|
992 | 1064 | |
993 | 1065 | $args->name = trim($key); |
994 | 1066 | $args->value = trim($val); |
995 | - if(!$args->name || !$args->value) continue; |
|
1067 | + if(!$args->name || !$args->value) { |
|
1068 | + continue; |
|
1069 | + } |
|
996 | 1070 | |
997 | 1071 | if($mode === 'P') |
998 | 1072 | { |
999 | 1073 | $output = executeQuery('module.insertModuleSkinVars', $args); |
1000 | - } |
|
1001 | - else |
|
1074 | + } else |
|
1002 | 1075 | { |
1003 | 1076 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
1004 | 1077 | } |
@@ -1045,8 +1118,7 @@ discard block |
||
1045 | 1118 | { |
1046 | 1119 | $object_key = 'module_skin_vars:'.$module_srl; |
1047 | 1120 | $query = 'module.deleteModuleSkinVars'; |
1048 | - } |
|
1049 | - else |
|
1121 | + } else |
|
1050 | 1122 | { |
1051 | 1123 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1052 | 1124 | $query = 'module.deleteModuleMobileSkinVars'; |
@@ -1070,17 +1142,23 @@ discard block |
||
1070 | 1142 | { |
1071 | 1143 | $this->deleteModuleExtraVars($module_srl); |
1072 | 1144 | getDestroyXeVars($obj); |
1073 | - if(!$obj || !count($obj)) return; |
|
1145 | + if(!$obj || !count($obj)) { |
|
1146 | + return; |
|
1147 | + } |
|
1074 | 1148 | |
1075 | 1149 | foreach($obj as $key => $val) |
1076 | 1150 | { |
1077 | - if(is_object($val) || is_array($val)) continue; |
|
1151 | + if(is_object($val) || is_array($val)) { |
|
1152 | + continue; |
|
1153 | + } |
|
1078 | 1154 | |
1079 | 1155 | $args = new stdClass(); |
1080 | 1156 | $args->module_srl = $module_srl; |
1081 | 1157 | $args->name = trim($key); |
1082 | 1158 | $args->value = trim($val); |
1083 | - if(!$args->name || !$args->value) continue; |
|
1159 | + if(!$args->name || !$args->value) { |
|
1160 | + continue; |
|
1161 | + } |
|
1084 | 1162 | $output = executeQuery('module.insertModuleExtraVars', $args); |
1085 | 1163 | } |
1086 | 1164 | |
@@ -1120,11 +1198,15 @@ discard block |
||
1120 | 1198 | function insertModuleGrants($module_srl, $obj) |
1121 | 1199 | { |
1122 | 1200 | $this->deleteModuleGrants($module_srl); |
1123 | - if(!$obj || !count($obj)) return; |
|
1201 | + if(!$obj || !count($obj)) { |
|
1202 | + return; |
|
1203 | + } |
|
1124 | 1204 | |
1125 | 1205 | foreach($obj as $name => $val) |
1126 | 1206 | { |
1127 | - if(!$val || !count($val)) continue; |
|
1207 | + if(!$val || !count($val)) { |
|
1208 | + continue; |
|
1209 | + } |
|
1128 | 1210 | |
1129 | 1211 | foreach($val as $group_srl) |
1130 | 1212 | { |
@@ -1132,7 +1214,9 @@ discard block |
||
1132 | 1214 | $args->module_srl = $module_srl; |
1133 | 1215 | $args->name = $name; |
1134 | 1216 | $args->group_srl = trim($group_srl); |
1135 | - if(!$args->name || !$args->group_srl) continue; |
|
1217 | + if(!$args->name || !$args->group_srl) { |
|
1218 | + continue; |
|
1219 | + } |
|
1136 | 1220 | executeQuery('module.insertModuleGrant', $args); |
1137 | 1221 | } |
1138 | 1222 | } |
@@ -1184,7 +1268,9 @@ discard block |
||
1184 | 1268 | } |
1185 | 1269 | } |
1186 | 1270 | |
1187 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1271 | + if(!Context::get($matches[1]) && $lang[$matches[1]]) { |
|
1272 | + return $lang[$matches[1]]; |
|
1273 | + } |
|
1188 | 1274 | |
1189 | 1275 | return str_replace('$user_lang->','',$matches[0]); |
1190 | 1276 | } |
@@ -1196,10 +1282,14 @@ discard block |
||
1196 | 1282 | function procModuleFileBoxAdd() |
1197 | 1283 | { |
1198 | 1284 | $ajax = Context::get('ajax'); |
1199 | - if ($ajax) Context::setRequestMethod('JSON'); |
|
1285 | + if ($ajax) { |
|
1286 | + Context::setRequestMethod('JSON'); |
|
1287 | + } |
|
1200 | 1288 | |
1201 | 1289 | $logged_info = Context::get('logged_info'); |
1202 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1290 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
1291 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
1292 | + } |
|
1203 | 1293 | |
1204 | 1294 | $vars = Context::gets('addfile','filter'); |
1205 | 1295 | $attributeNames = Context::get('attribute_name'); |
@@ -1223,9 +1313,14 @@ discard block |
||
1223 | 1313 | |
1224 | 1314 | $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
1225 | 1315 | $vars->ext = $ext; |
1226 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
1227 | - else $filter = array('jpg','jpeg','gif','png'); |
|
1228 | - if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
1316 | + if($vars->filter) { |
|
1317 | + $filter = explode(',',$vars->filter); |
|
1318 | + } else { |
|
1319 | + $filter = array('jpg','jpeg','gif','png'); |
|
1320 | + } |
|
1321 | + if(!in_array($ext,$filter)) { |
|
1322 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1323 | + } |
|
1229 | 1324 | |
1230 | 1325 | $vars->member_srl = $logged_info->member_srl; |
1231 | 1326 | |
@@ -1238,10 +1333,16 @@ discard block |
||
1238 | 1333 | // insert |
1239 | 1334 | else |
1240 | 1335 | { |
1241 | - if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
1336 | + if(!Context::isUploaded()) { |
|
1337 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1338 | + } |
|
1242 | 1339 | $addfile = Context::get('addfile'); |
1243 | - if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
1244 | - if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
1340 | + if(!is_uploaded_file($addfile['tmp_name'])) { |
|
1341 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1342 | + } |
|
1343 | + if($vars->addfile['error'] != 0) { |
|
1344 | + return new BaseObject(-1, 'msg_error_occured'); |
|
1345 | + } |
|
1245 | 1346 | $output = $this->insertModuleFileBox($vars); |
1246 | 1347 | } |
1247 | 1348 | |
@@ -1252,11 +1353,13 @@ discard block |
||
1252 | 1353 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox'); |
1253 | 1354 | $this->setRedirectUrl($returnUrl); |
1254 | 1355 | return; |
1255 | - } |
|
1256 | - else |
|
1356 | + } else |
|
1257 | 1357 | { |
1258 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
1259 | - else $this->add('save_filename', ''); |
|
1358 | + if($output) { |
|
1359 | + $this->add('save_filename', $output->get('save_filename')); |
|
1360 | + } else { |
|
1361 | + $this->add('save_filename', ''); |
|
1362 | + } |
|
1260 | 1363 | } |
1261 | 1364 | } |
1262 | 1365 | |
@@ -1280,7 +1383,9 @@ discard block |
||
1280 | 1383 | $tmp = $vars->addfile['tmp_name']; |
1281 | 1384 | |
1282 | 1385 | // Check uploaded file |
1283 | - if(!checkUploadedFile($tmp)) return false; |
|
1386 | + if(!checkUploadedFile($tmp)) { |
|
1387 | + return false; |
|
1388 | + } |
|
1284 | 1389 | |
1285 | 1390 | if(!@move_uploaded_file($tmp, $save_filename)) |
1286 | 1391 | { |
@@ -1317,7 +1422,9 @@ discard block |
||
1317 | 1422 | $tmp = $vars->addfile['tmp_name']; |
1318 | 1423 | |
1319 | 1424 | // Check uploaded file |
1320 | - if(!checkUploadedFile($tmp)) return false; |
|
1425 | + if(!checkUploadedFile($tmp)) { |
|
1426 | + return false; |
|
1427 | + } |
|
1321 | 1428 | |
1322 | 1429 | // upload |
1323 | 1430 | if(!@move_uploaded_file($tmp, $save_filename)) |
@@ -1346,14 +1453,20 @@ discard block |
||
1346 | 1453 | function procModuleFileBoxDelete() |
1347 | 1454 | { |
1348 | 1455 | $logged_info = Context::get('logged_info'); |
1349 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1456 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
1457 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
1458 | + } |
|
1350 | 1459 | |
1351 | 1460 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1352 | - if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1461 | + if(!$module_filebox_srl) { |
|
1462 | + return new BaseObject(-1, 'msg_invalid_request'); |
|
1463 | + } |
|
1353 | 1464 | $vars = new stdClass(); |
1354 | 1465 | $vars->module_filebox_srl = $module_filebox_srl; |
1355 | 1466 | $output = $this->deleteModuleFileBox($vars); |
1356 | - if(!$output->toBool()) return $output; |
|
1467 | + if(!$output->toBool()) { |
|
1468 | + return $output; |
|
1469 | + } |
|
1357 | 1470 | } |
1358 | 1471 | |
1359 | 1472 | function deleteModuleFileBox($vars) |
@@ -1376,9 +1489,13 @@ discard block |
||
1376 | 1489 | $this->unlockTimeoutPassed(); |
1377 | 1490 | $args = new stdClass; |
1378 | 1491 | $args->lock_name = $lock_name; |
1379 | - if(!$timeout) $timeout = 60; |
|
1492 | + if(!$timeout) { |
|
1493 | + $timeout = 60; |
|
1494 | + } |
|
1380 | 1495 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
1381 | - if($member_srl) $args->member_srl = $member_srl; |
|
1496 | + if($member_srl) { |
|
1497 | + $args->member_srl = $member_srl; |
|
1498 | + } |
|
1382 | 1499 | $output = executeQuery('module.insertLock', $args); |
1383 | 1500 | if($output->toBool()) |
1384 | 1501 | { |
@@ -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 BaseObject(-1,'msg_already_registed_vid'); |
|
271 | + if ($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-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 BaseObject(-1,'msg_already_registed_vid'); |
|
287 | + if ($output) return new BaseObject(-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 BaseObject(-1,'msg_already_registed_domain'); |
|
314 | - if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid'); |
|
313 | + if ($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1, 'msg_already_registed_domain'); |
|
314 | + if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-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 BaseObject(-1, 'msg_limit_mid'); |
|
348 | + if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-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 BaseObject(-1, 'msg_module_name_exists'); |
|
396 | + if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists'); |
|
397 | 397 | |
398 | 398 | // begin transaction |
399 | 399 | $oDB = &DB::getInstance(); |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | $skin_vars = new stdClass(); |
405 | 405 | $skin_vars->colorset = $skin_info->colorset[0]->name; |
406 | 406 | // Arrange variables and then execute a query |
407 | - if(!$args->module_srl) $args->module_srl = getNextSequence(); |
|
407 | + if (!$args->module_srl) $args->module_srl = getNextSequence(); |
|
408 | 408 | |
409 | 409 | // default value |
410 | - if($args->skin == '/USE_DEFAULT/') |
|
410 | + if ($args->skin == '/USE_DEFAULT/') |
|
411 | 411 | { |
412 | 412 | $args->is_skin_fix = 'N'; |
413 | 413 | } |
414 | 414 | else |
415 | 415 | { |
416 | - if(isset($args->is_skin_fix)) |
|
416 | + if (isset($args->is_skin_fix)) |
|
417 | 417 | { |
418 | 418 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
419 | 419 | } |
@@ -423,13 +423,13 @@ discard block |
||
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
426 | - if($args->mskin == '/USE_DEFAULT/') |
|
426 | + if ($args->mskin == '/USE_DEFAULT/') |
|
427 | 427 | { |
428 | 428 | $args->is_mskin_fix = 'N'; |
429 | 429 | } |
430 | 430 | else |
431 | 431 | { |
432 | - if(isset($args->is_mskin_fix)) |
|
432 | + if (isset($args->is_mskin_fix)) |
|
433 | 433 | { |
434 | 434 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
435 | 435 | } |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | |
444 | 444 | $args->browser_title = strip_tags($args->browser_title); |
445 | 445 | |
446 | - if($isMenuCreate === TRUE) |
|
446 | + if ($isMenuCreate === TRUE) |
|
447 | 447 | { |
448 | 448 | $menuArgs = new stdClass; |
449 | 449 | $menuArgs->menu_srl = $args->menu_srl; |
450 | 450 | $menuOutput = executeQuery('menu.getMenu', $menuArgs); |
451 | 451 | |
452 | 452 | // if menu is not created, create menu also. and does not supported that in virtual site. |
453 | - if(!$menuOutput->data && !$args->site_srl) |
|
453 | + if (!$menuOutput->data && !$args->site_srl) |
|
454 | 454 | { |
455 | 455 | $oMenuAdminModel = getAdminModel('menu'); |
456 | 456 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $menuArgs->listorder = $args->menu_item_srl * -1; |
469 | 469 | |
470 | 470 | $menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs); |
471 | - if(!$menuItemOutput->toBool()) |
|
471 | + if (!$menuItemOutput->toBool()) |
|
472 | 472 | { |
473 | 473 | $oDB->rollback(); |
474 | 474 | return $menuItemOutput; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | // Insert a module |
482 | 482 | $args->menu_srl = $menuArgs->menu_srl; |
483 | 483 | $output = executeQuery('module.insertModule', $args); |
484 | - if(!$output->toBool()) |
|
484 | + if (!$output->toBool()) |
|
485 | 485 | { |
486 | 486 | $oDB->rollback(); |
487 | 487 | return $output; |
@@ -493,12 +493,12 @@ discard block |
||
493 | 493 | $oDB->commit(); |
494 | 494 | |
495 | 495 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
496 | - if($oCacheHandler->isSupport()) |
|
496 | + if ($oCacheHandler->isSupport()) |
|
497 | 497 | { |
498 | 498 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
499 | 499 | } |
500 | 500 | |
501 | - $output->add('module_srl',$args->module_srl); |
|
501 | + $output->add('module_srl', $args->module_srl); |
|
502 | 502 | return $output; |
503 | 503 | } |
504 | 504 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | function updateModule($args) |
509 | 509 | { |
510 | - if(isset($args->isMenuCreate)) |
|
510 | + if (isset($args->isMenuCreate)) |
|
511 | 511 | { |
512 | 512 | $isMenuCreate = $args->isMenuCreate; |
513 | 513 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | } |
518 | 518 | |
519 | 519 | $output = $this->arrangeModuleInfo($args, $extra_vars); |
520 | - if(!$output->toBool()) return $output; |
|
520 | + if (!$output->toBool()) return $output; |
|
521 | 521 | // begin transaction |
522 | 522 | $oDB = &DB::getInstance(); |
523 | 523 | $oDB->begin(); |
@@ -526,29 +526,29 @@ discard block |
||
526 | 526 | $columnList = array('module_srl', 'site_srl', 'browser_title', 'mid'); |
527 | 527 | $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); |
528 | 528 | |
529 | - if(!$args->site_srl || !$args->browser_title) |
|
529 | + if (!$args->site_srl || !$args->browser_title) |
|
530 | 530 | { |
531 | - if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl; |
|
532 | - if(!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
531 | + if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl; |
|
532 | + if (!$args->browser_title) $args->browser_title = $module_info->browser_title; |
|
533 | 533 | } |
534 | 534 | |
535 | 535 | $args->browser_title = strip_tags($args->browser_title); |
536 | 536 | |
537 | 537 | $output = executeQuery('module.isExistsModuleName', $args); |
538 | - if(!$output->toBool() || $output->data->count) |
|
538 | + if (!$output->toBool() || $output->data->count) |
|
539 | 539 | { |
540 | 540 | $oDB->rollback(); |
541 | 541 | return new BaseObject(-1, 'msg_module_name_exists'); |
542 | 542 | } |
543 | 543 | |
544 | 544 | // default value |
545 | - if($args->skin == '/USE_DEFAULT/') |
|
545 | + if ($args->skin == '/USE_DEFAULT/') |
|
546 | 546 | { |
547 | 547 | $args->is_skin_fix = 'N'; |
548 | 548 | } |
549 | 549 | else |
550 | 550 | { |
551 | - if(isset($args->is_skin_fix)) |
|
551 | + if (isset($args->is_skin_fix)) |
|
552 | 552 | { |
553 | 553 | $args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y'; |
554 | 554 | } |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | - if($args->mskin == '/USE_DEFAULT/') |
|
561 | + if ($args->mskin == '/USE_DEFAULT/') |
|
562 | 562 | { |
563 | 563 | $args->is_mskin_fix = 'N'; |
564 | 564 | } |
565 | 565 | else |
566 | 566 | { |
567 | - if(isset($args->is_mskin_fix)) |
|
567 | + if (isset($args->is_mskin_fix)) |
|
568 | 568 | { |
569 | 569 | $args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y'; |
570 | 570 | } |
@@ -574,27 +574,27 @@ discard block |
||
574 | 574 | } |
575 | 575 | } |
576 | 576 | $output = executeQuery('module.updateModule', $args); |
577 | - if(!$output->toBool()) |
|
577 | + if (!$output->toBool()) |
|
578 | 578 | { |
579 | 579 | $oDB->rollback(); |
580 | 580 | return $output; |
581 | 581 | } |
582 | 582 | |
583 | - if($isMenuCreate === TRUE) |
|
583 | + if ($isMenuCreate === TRUE) |
|
584 | 584 | { |
585 | 585 | $menuArgs = new stdClass; |
586 | 586 | $menuArgs->url = $module_info->mid; |
587 | 587 | $menuArgs->site_srl = $module_info->site_srl; |
588 | 588 | $menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs); |
589 | - if($menuOutput->data && count($menuOutput->data)) |
|
589 | + if ($menuOutput->data && count($menuOutput->data)) |
|
590 | 590 | { |
591 | 591 | $oMenuAdminController = getAdminController('menu'); |
592 | - foreach($menuOutput->data as $itemInfo) |
|
592 | + foreach ($menuOutput->data as $itemInfo) |
|
593 | 593 | { |
594 | 594 | $itemInfo->url = $args->mid; |
595 | 595 | |
596 | 596 | $updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo); |
597 | - if(!$updateMenuItemOutput->toBool()) |
|
597 | + if (!$updateMenuItemOutput->toBool()) |
|
598 | 598 | { |
599 | 599 | $oDB->rollback(); |
600 | 600 | return $updateMenuItemOutput; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | } |
605 | 605 | |
606 | 606 | // if mid changed, change mid of success_return_url to new mid |
607 | - if($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
607 | + if ($module_info->mid != $args->mid && Context::get('success_return_url')) |
|
608 | 608 | { |
609 | 609 | changeValueInUrl('mid', $args->mid, $module_info->mid); |
610 | 610 | } |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | |
615 | 615 | $oDB->commit(); |
616 | 616 | |
617 | - $output->add('module_srl',$args->module_srl); |
|
617 | + $output->add('module_srl', $args->module_srl); |
|
618 | 618 | |
619 | 619 | //remove from cache |
620 | 620 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
621 | - if($oCacheHandler->isSupport()) |
|
621 | + if ($oCacheHandler->isSupport()) |
|
622 | 622 | { |
623 | 623 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
624 | 624 | } |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $args->update_id = $update_id; |
638 | 638 | $output = executeQuery('module.insertModuleUpdateLog', $args); |
639 | 639 | |
640 | - if(!!$output->error) return false; |
|
640 | + if (!!$output->error) return false; |
|
641 | 641 | |
642 | 642 | return true; |
643 | 643 | } |
@@ -652,11 +652,11 @@ discard block |
||
652 | 652 | $args->site_srl = $site_srl; |
653 | 653 | $args->layout_srl = $layout_srl; |
654 | 654 | $output = executeQuery('module.updateModuleSite', $args); |
655 | - if(!$output->toBool()) return $output; |
|
655 | + if (!$output->toBool()) return $output; |
|
656 | 656 | |
657 | 657 | //remove from cache |
658 | 658 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
659 | - if($oCacheHandler->isSupport()) |
|
659 | + if ($oCacheHandler->isSupport()) |
|
660 | 660 | { |
661 | 661 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
662 | 662 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | */ |
672 | 672 | function deleteModule($module_srl, $site_srl = 0) |
673 | 673 | { |
674 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
674 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
675 | 675 | |
676 | 676 | $site_module_info = Context::get('site_module_info'); |
677 | 677 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $args = new stdClass(); |
682 | 682 | $args->url = $output->mid; |
683 | 683 | $args->is_shortcut = 'N'; |
684 | - if(!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
684 | + if (!$site_srl) $args->site_srl = $site_module_info->site_srl; |
|
685 | 685 | else $args->site_srl = $site_srl; |
686 | 686 | |
687 | 687 | unset($output); |
@@ -690,9 +690,9 @@ discard block |
||
690 | 690 | $menuOutput = $oMenuAdminModel->getMenuList($args); |
691 | 691 | |
692 | 692 | // get menu_srl by site_srl |
693 | - if(is_array($menuOutput->data)) |
|
693 | + if (is_array($menuOutput->data)) |
|
694 | 694 | { |
695 | - foreach($menuOutput->data AS $key=>$value) |
|
695 | + foreach ($menuOutput->data AS $key=>$value) |
|
696 | 696 | { |
697 | 697 | $args->menu_srl = $value->menu_srl; |
698 | 698 | break; |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | $output = executeQuery('menu.getMenuItemByUrl', $args); |
703 | 703 | // menu delete |
704 | - if($output->data) |
|
704 | + if ($output->data) |
|
705 | 705 | { |
706 | 706 | unset($args); |
707 | 707 | $args = new stdClass; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $oMenuAdminController = getAdminController('menu'); |
713 | 713 | $output = $oMenuAdminController->deleteItem($args); |
714 | 714 | |
715 | - if($output->isSuccess) |
|
715 | + if ($output->isSuccess) |
|
716 | 716 | { |
717 | 717 | return new BaseObject(0, 'success_deleted'); |
718 | 718 | } |
@@ -734,19 +734,19 @@ discard block |
||
734 | 734 | */ |
735 | 735 | public function onlyDeleteModule($module_srl) |
736 | 736 | { |
737 | - if(!$module_srl) return new BaseObject(-1,'msg_invalid_request'); |
|
737 | + if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
738 | 738 | |
739 | 739 | // check start module |
740 | 740 | $oModuleModel = getModel('module'); |
741 | 741 | $columnList = array('sites.index_module_srl'); |
742 | 742 | $start_module = $oModuleModel->getSiteInfo(0, $columnList); |
743 | - if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
743 | + if ($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule'); |
|
744 | 744 | |
745 | 745 | // Call a trigger (before) |
746 | 746 | $trigger_obj = new stdClass(); |
747 | 747 | $trigger_obj->module_srl = $module_srl; |
748 | 748 | $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); |
749 | - if(!$output->toBool()) return $output; |
|
749 | + if (!$output->toBool()) return $output; |
|
750 | 750 | |
751 | 751 | // begin transaction |
752 | 752 | $oDB = &DB::getInstance(); |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | $args->module_srl = $module_srl; |
757 | 757 | // Delete module information from the DB |
758 | 758 | $output = executeQuery('module.deleteModule', $args); |
759 | - if(!$output->toBool()) |
|
759 | + if (!$output->toBool()) |
|
760 | 760 | { |
761 | 761 | $oDB->rollback(); |
762 | 762 | return $output; |
@@ -770,10 +770,10 @@ discard block |
||
770 | 770 | // Remove the module manager |
771 | 771 | $this->deleteAdminId($module_srl); |
772 | 772 | // Call a trigger (after) |
773 | - if($output->toBool()) |
|
773 | + if ($output->toBool()) |
|
774 | 774 | { |
775 | 775 | $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); |
776 | - if(!$trigger_output->toBool()) |
|
776 | + if (!$trigger_output->toBool()) |
|
777 | 777 | { |
778 | 778 | $oDB->rollback(); |
779 | 779 | return $trigger_output; |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | |
786 | 786 | //remove from cache |
787 | 787 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
788 | - if($oCacheHandler->isSupport()) |
|
788 | + if ($oCacheHandler->isSupport()) |
|
789 | 789 | { |
790 | 790 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
791 | 791 | } |
@@ -807,10 +807,10 @@ discard block |
||
807 | 807 | function clearDefaultModule() |
808 | 808 | { |
809 | 809 | $output = executeQuery('module.clearDefaultModule'); |
810 | - if(!$output->toBool()) return $output; |
|
810 | + if (!$output->toBool()) return $output; |
|
811 | 811 | |
812 | 812 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
813 | - if($oCacheHandler->isSupport()) |
|
813 | + if ($oCacheHandler->isSupport()) |
|
814 | 814 | { |
815 | 815 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
816 | 816 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | $output = executeQuery('module.updateModuleMenu', $args); |
827 | 827 | |
828 | 828 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
829 | - if($oCacheHandler->isSupport()) |
|
829 | + if ($oCacheHandler->isSupport()) |
|
830 | 830 | { |
831 | 831 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
832 | 832 | } |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | */ |
840 | 840 | function updateModuleLayout($layout_srl, $menu_srl_list) |
841 | 841 | { |
842 | - if(!count($menu_srl_list)) return; |
|
842 | + if (!count($menu_srl_list)) return; |
|
843 | 843 | |
844 | 844 | $args = new stdClass; |
845 | 845 | $args->layout_srl = $layout_srl; |
846 | - $args->menu_srls = implode(',',$menu_srl_list); |
|
846 | + $args->menu_srls = implode(',', $menu_srl_list); |
|
847 | 847 | $output = executeQuery('module.updateModuleLayout', $args); |
848 | 848 | |
849 | 849 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
850 | - if($oCacheHandler->isSupport()) |
|
850 | + if ($oCacheHandler->isSupport()) |
|
851 | 851 | { |
852 | 852 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
853 | 853 | } |
@@ -866,37 +866,37 @@ discard block |
||
866 | 866 | |
867 | 867 | $output = executeQuery('module.deleteSiteAdmin', $args); |
868 | 868 | |
869 | - if(!$output->toBool()) return $output; |
|
869 | + if (!$output->toBool()) return $output; |
|
870 | 870 | // Get user id of an administrator |
871 | - if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
872 | - foreach($arr_admins as $key => $user_id) |
|
871 | + if (!is_array($arr_admins) || !count($arr_admins)) return new BaseObject(); |
|
872 | + foreach ($arr_admins as $key => $user_id) |
|
873 | 873 | { |
874 | - if(!trim($user_id)) continue; |
|
874 | + if (!trim($user_id)) continue; |
|
875 | 875 | $admins[] = trim($user_id); |
876 | 876 | } |
877 | - if(!count($admins)) return new BaseObject(); |
|
877 | + if (!count($admins)) return new BaseObject(); |
|
878 | 878 | |
879 | 879 | $oMemberModel = getModel('member'); |
880 | 880 | $member_config = $oMemberModel->getMemberConfig(); |
881 | - if($member_config->identifier == 'email_address') |
|
881 | + if ($member_config->identifier == 'email_address') |
|
882 | 882 | { |
883 | - $args->email_address = '\''.implode('\',\'',$admins).'\''; |
|
883 | + $args->email_address = '\''.implode('\',\'', $admins).'\''; |
|
884 | 884 | } |
885 | 885 | else |
886 | 886 | { |
887 | - $args->user_ids = '\''.implode('\',\'',$admins).'\''; |
|
887 | + $args->user_ids = '\''.implode('\',\'', $admins).'\''; |
|
888 | 888 | } |
889 | 889 | $output = executeQueryArray('module.getAdminSrls', $args); |
890 | - if(!$output->toBool()||!$output->data) return $output; |
|
890 | + if (!$output->toBool() || !$output->data) return $output; |
|
891 | 891 | |
892 | - foreach($output->data as $key => $val) |
|
892 | + foreach ($output->data as $key => $val) |
|
893 | 893 | { |
894 | 894 | unset($args); |
895 | 895 | $args = new stdClass; |
896 | 896 | $args->site_srl = $site_srl; |
897 | 897 | $args->member_srl = $val->member_srl; |
898 | 898 | $output = executeQueryArray('module.insertSiteAdmin', $args); |
899 | - if(!$output->toBool()) return $output; |
|
899 | + if (!$output->toBool()) return $output; |
|
900 | 900 | } |
901 | 901 | return new BaseObject(); |
902 | 902 | } |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | $oMemberModel = getModel('member'); |
910 | 910 | $member_config = $oMemberModel->getMemberConfig(); |
911 | 911 | |
912 | - if($member_config->identifier == 'email_address') |
|
912 | + if ($member_config->identifier == 'email_address') |
|
913 | 913 | $member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id); |
914 | 914 | else |
915 | 915 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
916 | 916 | |
917 | - if(!$member_info->member_srl) return; |
|
917 | + if (!$member_info->member_srl) return; |
|
918 | 918 | $args = new stdClass(); |
919 | 919 | $args->module_srl = $module_srl; |
920 | 920 | $args->member_srl = $member_info->member_srl; |
@@ -929,11 +929,11 @@ discard block |
||
929 | 929 | $args = new stdClass(); |
930 | 930 | $args->module_srl = $module_srl; |
931 | 931 | |
932 | - if($admin_id) |
|
932 | + if ($admin_id) |
|
933 | 933 | { |
934 | 934 | $oMemberModel = getModel('member'); |
935 | 935 | $member_info = $oMemberModel->getMemberInfoByUserID($admin_id); |
936 | - if($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
936 | + if ($member_info->member_srl) $args->member_srl = $member_info->member_srl; |
|
937 | 937 | } |
938 | 938 | return executeQuery('module.deleteAdminId', $args); |
939 | 939 | } |
@@ -970,18 +970,18 @@ discard block |
||
970 | 970 | $oDB->begin(); |
971 | 971 | |
972 | 972 | $output = $this->_deleteModuleSkinVars($module_srl, $mode); |
973 | - if(!$output->toBool()) |
|
973 | + if (!$output->toBool()) |
|
974 | 974 | { |
975 | 975 | $oDB->rollback(); |
976 | 976 | return $output; |
977 | 977 | } |
978 | 978 | |
979 | 979 | getDestroyXeVars($obj); |
980 | - if(!$obj || !count($obj)) return new BaseObject(); |
|
980 | + if (!$obj || !count($obj)) return new BaseObject(); |
|
981 | 981 | |
982 | 982 | $args = new stdClass; |
983 | 983 | $args->module_srl = $module_srl; |
984 | - foreach($obj as $key => $val) |
|
984 | + foreach ($obj as $key => $val) |
|
985 | 985 | { |
986 | 986 | // #17927989 For an old board which used the old blog module |
987 | 987 | // it often saved menu item(stdClass) on the skin info column |
@@ -992,9 +992,9 @@ discard block |
||
992 | 992 | |
993 | 993 | $args->name = trim($key); |
994 | 994 | $args->value = trim($val); |
995 | - if(!$args->name || !$args->value) continue; |
|
995 | + if (!$args->name || !$args->value) continue; |
|
996 | 996 | |
997 | - if($mode === 'P') |
|
997 | + if ($mode === 'P') |
|
998 | 998 | { |
999 | 999 | $output = executeQuery('module.insertModuleSkinVars', $args); |
1000 | 1000 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | { |
1003 | 1003 | $output = executeQuery('module.insertModuleMobileSkinVars', $args); |
1004 | 1004 | } |
1005 | - if(!$output->toBool()) |
|
1005 | + if (!$output->toBool()) |
|
1006 | 1006 | { |
1007 | 1007 | return $output; |
1008 | 1008 | $oDB->rollback(); |
@@ -1041,7 +1041,7 @@ discard block |
||
1041 | 1041 | $args->module_srl = $module_srl; |
1042 | 1042 | $mode = $mode === 'P' ? 'P' : 'M'; |
1043 | 1043 | |
1044 | - if($mode === 'P') |
|
1044 | + if ($mode === 'P') |
|
1045 | 1045 | { |
1046 | 1046 | $object_key = 'module_skin_vars:'.$module_srl; |
1047 | 1047 | $query = 'module.deleteModuleSkinVars'; |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | //remove from cache |
1056 | 1056 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1057 | 1057 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1058 | - if($oCacheHandler->isSupport()) |
|
1058 | + if ($oCacheHandler->isSupport()) |
|
1059 | 1059 | { |
1060 | 1060 | $oCacheHandler->delete($cache_key); |
1061 | 1061 | } |
@@ -1070,22 +1070,22 @@ discard block |
||
1070 | 1070 | { |
1071 | 1071 | $this->deleteModuleExtraVars($module_srl); |
1072 | 1072 | getDestroyXeVars($obj); |
1073 | - if(!$obj || !count($obj)) return; |
|
1073 | + if (!$obj || !count($obj)) return; |
|
1074 | 1074 | |
1075 | - foreach($obj as $key => $val) |
|
1075 | + foreach ($obj as $key => $val) |
|
1076 | 1076 | { |
1077 | - if(is_object($val) || is_array($val)) continue; |
|
1077 | + if (is_object($val) || is_array($val)) continue; |
|
1078 | 1078 | |
1079 | 1079 | $args = new stdClass(); |
1080 | 1080 | $args->module_srl = $module_srl; |
1081 | 1081 | $args->name = trim($key); |
1082 | 1082 | $args->value = trim($val); |
1083 | - if(!$args->name || !$args->value) continue; |
|
1083 | + if (!$args->name || !$args->value) continue; |
|
1084 | 1084 | $output = executeQuery('module.insertModuleExtraVars', $args); |
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1088 | - if($oCacheHandler->isSupport()) |
|
1088 | + if ($oCacheHandler->isSupport()) |
|
1089 | 1089 | { |
1090 | 1090 | $object_key = 'module_extra_vars:'.$module_srl; |
1091 | 1091 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | |
1105 | 1105 | //remove from cache |
1106 | 1106 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1107 | - if($oCacheHandler->isSupport()) |
|
1107 | + if ($oCacheHandler->isSupport()) |
|
1108 | 1108 | { |
1109 | 1109 | $object_key = 'module_extra_vars:'.$module_srl; |
1110 | 1110 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1120,19 +1120,19 @@ discard block |
||
1120 | 1120 | function insertModuleGrants($module_srl, $obj) |
1121 | 1121 | { |
1122 | 1122 | $this->deleteModuleGrants($module_srl); |
1123 | - if(!$obj || !count($obj)) return; |
|
1123 | + if (!$obj || !count($obj)) return; |
|
1124 | 1124 | |
1125 | - foreach($obj as $name => $val) |
|
1125 | + foreach ($obj as $name => $val) |
|
1126 | 1126 | { |
1127 | - if(!$val || !count($val)) continue; |
|
1127 | + if (!$val || !count($val)) continue; |
|
1128 | 1128 | |
1129 | - foreach($val as $group_srl) |
|
1129 | + foreach ($val as $group_srl) |
|
1130 | 1130 | { |
1131 | 1131 | $args = new stdClass(); |
1132 | 1132 | $args->module_srl = $module_srl; |
1133 | 1133 | $args->name = $name; |
1134 | 1134 | $args->group_srl = trim($group_srl); |
1135 | - if(!$args->name || !$args->group_srl) continue; |
|
1135 | + if (!$args->name || !$args->group_srl) continue; |
|
1136 | 1136 | executeQuery('module.insertModuleGrant', $args); |
1137 | 1137 | } |
1138 | 1138 | } |
@@ -1153,9 +1153,9 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | function replaceDefinedLangCode(&$output, $isReplaceLangCode = true) |
1155 | 1155 | { |
1156 | - if($isReplaceLangCode) |
|
1156 | + if ($isReplaceLangCode) |
|
1157 | 1157 | { |
1158 | - $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); |
|
1158 | + $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output); |
|
1159 | 1159 | } |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1164,29 +1164,29 @@ discard block |
||
1164 | 1164 | static $lang = false; |
1165 | 1165 | |
1166 | 1166 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1167 | - if($lang === false && $oCacheHandler->isSupport()) |
|
1167 | + if ($lang === false && $oCacheHandler->isSupport()) |
|
1168 | 1168 | { |
1169 | 1169 | $site_module_info = Context::get('site_module_info'); |
1170 | - if(!$site_module_info) |
|
1170 | + if (!$site_module_info) |
|
1171 | 1171 | { |
1172 | 1172 | $oModuleModel = getModel('module'); |
1173 | 1173 | $site_module_info = $oModuleModel->getDefaultMid(); |
1174 | 1174 | Context::set('site_module_info', $site_module_info); |
1175 | 1175 | } |
1176 | 1176 | |
1177 | - $object_key = 'user_defined_langs:' . $site_module_info->site_srl . ':' . Context::getLangType(); |
|
1177 | + $object_key = 'user_defined_langs:'.$site_module_info->site_srl.':'.Context::getLangType(); |
|
1178 | 1178 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1179 | 1179 | $lang = $oCacheHandler->get($cache_key); |
1180 | 1180 | |
1181 | - if($lang === false) { |
|
1181 | + if ($lang === false) { |
|
1182 | 1182 | $oModuleAdminController = getAdminController('module'); |
1183 | 1183 | $lang = $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl); |
1184 | 1184 | } |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1187 | + if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]]; |
|
1188 | 1188 | |
1189 | - return str_replace('$user_lang->','',$matches[0]); |
|
1189 | + return str_replace('$user_lang->', '', $matches[0]); |
|
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | |
@@ -1199,17 +1199,17 @@ discard block |
||
1199 | 1199 | if ($ajax) Context::setRequestMethod('JSON'); |
1200 | 1200 | |
1201 | 1201 | $logged_info = Context::get('logged_info'); |
1202 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1202 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1203 | 1203 | |
1204 | - $vars = Context::gets('addfile','filter'); |
|
1204 | + $vars = Context::gets('addfile', 'filter'); |
|
1205 | 1205 | $attributeNames = Context::get('attribute_name'); |
1206 | 1206 | $attributeValues = Context::get('attribute_value'); |
1207 | - if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
1207 | + if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues)) |
|
1208 | 1208 | { |
1209 | 1209 | $attributes = array(); |
1210 | - foreach($attributeNames as $no => $name) |
|
1210 | + foreach ($attributeNames as $no => $name) |
|
1211 | 1211 | { |
1212 | - if(empty($name)) |
|
1212 | + if (empty($name)) |
|
1213 | 1213 | { |
1214 | 1214 | continue; |
1215 | 1215 | } |
@@ -1221,16 +1221,16 @@ discard block |
||
1221 | 1221 | $vars->comment = $attributes; |
1222 | 1222 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1223 | 1223 | |
1224 | - $ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1224 | + $ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1225 | 1225 | $vars->ext = $ext; |
1226 | - if($vars->filter) $filter = explode(',',$vars->filter); |
|
1227 | - else $filter = array('jpg','jpeg','gif','png'); |
|
1228 | - if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
1226 | + if ($vars->filter) $filter = explode(',', $vars->filter); |
|
1227 | + else $filter = array('jpg', 'jpeg', 'gif', 'png'); |
|
1228 | + if (!in_array($ext, $filter)) return new BaseObject(-1, 'msg_error_occured'); |
|
1229 | 1229 | |
1230 | 1230 | $vars->member_srl = $logged_info->member_srl; |
1231 | 1231 | |
1232 | 1232 | // update |
1233 | - if($module_filebox_srl > 0) |
|
1233 | + if ($module_filebox_srl > 0) |
|
1234 | 1234 | { |
1235 | 1235 | $vars->module_filebox_srl = $module_filebox_srl; |
1236 | 1236 | $output = $this->updateModuleFileBox($vars); |
@@ -1238,10 +1238,10 @@ discard block |
||
1238 | 1238 | // insert |
1239 | 1239 | else |
1240 | 1240 | { |
1241 | - if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
1241 | + if (!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured'); |
|
1242 | 1242 | $addfile = Context::get('addfile'); |
1243 | - if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
1244 | - if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
1243 | + if (!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured'); |
|
1244 | + if ($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured'); |
|
1245 | 1245 | $output = $this->insertModuleFileBox($vars); |
1246 | 1246 | } |
1247 | 1247 | |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | } |
1256 | 1256 | else |
1257 | 1257 | { |
1258 | - if($output) $this->add('save_filename', $output->get('save_filename')); |
|
1258 | + if ($output) $this->add('save_filename', $output->get('save_filename')); |
|
1259 | 1259 | else $this->add('save_filename', ''); |
1260 | 1260 | } |
1261 | 1261 | } |
@@ -1267,7 +1267,7 @@ discard block |
||
1267 | 1267 | { |
1268 | 1268 | $args = new stdClass; |
1269 | 1269 | // have file |
1270 | - if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
1270 | + if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name'])) |
|
1271 | 1271 | { |
1272 | 1272 | $oModuleModel = getModel('module'); |
1273 | 1273 | $output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl); |
@@ -1284,9 +1284,9 @@ discard block |
||
1284 | 1284 | $tmp = $vars->addfile['tmp_name']; |
1285 | 1285 | |
1286 | 1286 | // Check uploaded file |
1287 | - if(!checkUploadedFile($tmp)) return false; |
|
1287 | + if (!checkUploadedFile($tmp)) return false; |
|
1288 | 1288 | |
1289 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
1289 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
1290 | 1290 | { |
1291 | 1291 | return false; |
1292 | 1292 | } |
@@ -1321,14 +1321,14 @@ discard block |
||
1321 | 1321 | $ext = explode($vars->addfile['name'], '.'); |
1322 | 1322 | $ext = strtolower(array_pop($ext)); |
1323 | 1323 | |
1324 | - $save_filename = sprintf('%s%s.%s',$path, $random->createSecureSalt(32, 'hex'), $vars->ext); |
|
1324 | + $save_filename = sprintf('%s%s.%s', $path, $random->createSecureSalt(32, 'hex'), $vars->ext); |
|
1325 | 1325 | $tmp = $vars->addfile['tmp_name']; |
1326 | 1326 | |
1327 | 1327 | // Check uploaded file |
1328 | - if(!checkUploadedFile($tmp)) return false; |
|
1328 | + if (!checkUploadedFile($tmp)) return false; |
|
1329 | 1329 | |
1330 | 1330 | // upload |
1331 | - if(!@move_uploaded_file($tmp, $save_filename)) |
|
1331 | + if (!@move_uploaded_file($tmp, $save_filename)) |
|
1332 | 1332 | { |
1333 | 1333 | return false; |
1334 | 1334 | } |
@@ -1339,7 +1339,7 @@ discard block |
||
1339 | 1339 | $args->member_srl = $vars->member_srl; |
1340 | 1340 | $args->comment = $vars->comment; |
1341 | 1341 | $args->filename = $save_filename; |
1342 | - $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1)); |
|
1342 | + $args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1)); |
|
1343 | 1343 | $args->filesize = $vars->addfile['size']; |
1344 | 1344 | |
1345 | 1345 | $output = executeQuery('module.insertModuleFileBox', $args); |
@@ -1354,14 +1354,14 @@ discard block |
||
1354 | 1354 | function procModuleFileBoxDelete() |
1355 | 1355 | { |
1356 | 1356 | $logged_info = Context::get('logged_info'); |
1357 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1357 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
1358 | 1358 | |
1359 | 1359 | $module_filebox_srl = Context::get('module_filebox_srl'); |
1360 | - if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1360 | + if (!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request'); |
|
1361 | 1361 | $vars = new stdClass(); |
1362 | 1362 | $vars->module_filebox_srl = $module_filebox_srl; |
1363 | 1363 | $output = $this->deleteModuleFileBox($vars); |
1364 | - if(!$output->toBool()) return $output; |
|
1364 | + if (!$output->toBool()) return $output; |
|
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | function deleteModuleFileBox($vars) |
@@ -1384,11 +1384,11 @@ discard block |
||
1384 | 1384 | $this->unlockTimeoutPassed(); |
1385 | 1385 | $args = new stdClass; |
1386 | 1386 | $args->lock_name = $lock_name; |
1387 | - if(!$timeout) $timeout = 60; |
|
1387 | + if (!$timeout) $timeout = 60; |
|
1388 | 1388 | $args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout); |
1389 | - if($member_srl) $args->member_srl = $member_srl; |
|
1389 | + if ($member_srl) $args->member_srl = $member_srl; |
|
1390 | 1390 | $output = executeQuery('module.insertLock', $args); |
1391 | - if($output->toBool()) |
|
1391 | + if ($output->toBool()) |
|
1392 | 1392 | { |
1393 | 1393 | $output->add('lock_name', $lock_name); |
1394 | 1394 | $output->add('deadline', $args->deadline); |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | $output = executeQuery('module.updateModuleInSites', $args); |
1418 | 1418 | |
1419 | 1419 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1420 | - if($oCacheHandler->isSupport()) |
|
1420 | + if ($oCacheHandler->isSupport()) |
|
1421 | 1421 | { |
1422 | 1422 | $oCacheHandler->invalidateGroupKey('site_and_module'); |
1423 | 1423 | } |
@@ -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 | { |
@@ -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 BaseObject(-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 | } |
@@ -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 BaseObject(-1, sprintf('%s method is not exists', $method)); |
|
55 | + if(method_exists($this, $method)) { |
|
56 | + $page_content = $this->{$method}(); |
|
57 | + } else { |
|
58 | + return new BaseObject(-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 |
@@ -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 BaseObject(); |
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 BaseObject(); |
|
45 | + if (!$member_srl) return new BaseObject(); |
|
46 | 46 | // If the last login is not today, give the points |
47 | - if(substr($obj->last_login,0,8)==date("Ymd")) return new BaseObject(); |
|
47 | + if (substr($obj->last_login, 0, 8) == date("Ymd")) return new BaseObject(); |
|
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 BaseObject(); |
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 BaseObject(); |
|
73 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
74 | 74 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
75 | + if ($module_srl == $member_srl) return new BaseObject(); |
|
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 BaseObject(); |
@@ -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 BaseObject(); |
|
144 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
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 BaseObject(); |
|
153 | + if ($comment_point > 0) return new BaseObject(); |
|
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 BaseObject(); |
|
159 | + if (!$output->data) return new BaseObject(); |
|
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 BaseObject(); |
|
169 | + if ($member_srl) unset($member_srls[abs($member_srl)]); |
|
170 | + if (!count($member_srls)) return new BaseObject(); |
|
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 BaseObject(); |
@@ -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 BaseObject(); |
|
197 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
198 | 198 | // Run only when logged in |
199 | 199 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
200 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
201 | 201 | // Get the points of the member |
202 | 202 | $oPointModel = getModel('point'); |
203 | 203 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,12 +207,12 @@ 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 BaseObject(); |
|
212 | + if ($point < 0) return new BaseObject(); |
|
213 | 213 | $cur_point -= $point; |
214 | 214 | // Increase the point |
215 | - $this->setPoint($member_srl,$cur_point); |
|
215 | + $this->setPoint($member_srl, $cur_point); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | return new BaseObject(); |
@@ -225,12 +225,12 @@ discard block |
||
225 | 225 | { |
226 | 226 | $module_srl = $obj->module_srl; |
227 | 227 | $member_srl = $obj->member_srl; |
228 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
228 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
229 | 229 | // Do not increase the points if the member is the author of the post |
230 | 230 | $document_srl = $obj->document_srl; |
231 | 231 | $oDocumentModel = getModel('document'); |
232 | 232 | $oDocument = $oDocumentModel->getDocument($document_srl); |
233 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
233 | + if (!$oDocument->isExists() || abs($oDocument->get('member_srl')) == abs($member_srl)) return new BaseObject(); |
|
234 | 234 | // Get the point module information |
235 | 235 | $oModuleModel = getModel('module'); |
236 | 236 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -240,10 +240,10 @@ discard block |
||
240 | 240 | $cur_point = $oPointModel->getPoint($member_srl, true); |
241 | 241 | |
242 | 242 | $point = $module_config['insert_comment']; |
243 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
243 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
244 | 244 | // Increase the point |
245 | 245 | $cur_point += $point; |
246 | - $this->setPoint($member_srl,$cur_point); |
|
246 | + $this->setPoint($member_srl, $cur_point); |
|
247 | 247 | |
248 | 248 | return new BaseObject(); |
249 | 249 | } |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | $module_srl = $obj->module_srl; |
261 | 261 | $member_srl = abs($obj->member_srl); |
262 | 262 | $document_srl = $obj->document_srl; |
263 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
263 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
264 | 264 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
265 | 265 | $oDocument = $oDocumentModel->getDocument($document_srl); |
266 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
267 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
266 | + if (!$oDocument->isExists()) return new BaseObject(); |
|
267 | + if ($oDocument->get('member_srl') == $member_srl) return new BaseObject(); |
|
268 | 268 | // Get the point module information |
269 | 269 | $config = $oModuleModel->getModuleConfig('point'); |
270 | 270 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | $cur_point = $oPointModel->getPoint($member_srl, true); |
273 | 273 | |
274 | 274 | $point = $module_config['insert_comment']; |
275 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
275 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
276 | 276 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
277 | - if($point < 0) return new BaseObject(); |
|
277 | + if ($point < 0) return new BaseObject(); |
|
278 | 278 | // Increase the point |
279 | 279 | $cur_point -= $point; |
280 | - $this->setPoint($member_srl,$cur_point); |
|
280 | + $this->setPoint($member_srl, $cur_point); |
|
281 | 281 | |
282 | 282 | return new BaseObject(); |
283 | 283 | } |
@@ -297,11 +297,11 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function triggerDeleteFile(&$obj) |
299 | 299 | { |
300 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
300 | + if ($obj->isvalid != 'Y') return new BaseObject(); |
|
301 | 301 | |
302 | 302 | $module_srl = $obj->module_srl; |
303 | 303 | $member_srl = $obj->member_srl; |
304 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
304 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
305 | 305 | // Get the point module information |
306 | 306 | $oModuleModel = getModel('module'); |
307 | 307 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | $cur_point = $oPointModel->getPoint($member_srl, true); |
312 | 312 | |
313 | 313 | $point = $module_config['upload_file']; |
314 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
314 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
315 | 315 | // Increase the point |
316 | 316 | $cur_point -= $point; |
317 | - $this->setPoint($member_srl,$cur_point); |
|
317 | + $this->setPoint($member_srl, $cur_point); |
|
318 | 318 | |
319 | 319 | return new BaseObject(); |
320 | 320 | } |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | $logged_info = Context::get('logged_info'); |
328 | 328 | $member_srl = $logged_info->member_srl; |
329 | 329 | $module_srl = $obj->module_srl; |
330 | - if(!$module_srl) return new BaseObject(); |
|
330 | + if (!$module_srl) return new BaseObject(); |
|
331 | 331 | |
332 | 332 | // Pass if it is your file |
333 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
333 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
334 | 334 | $oModuleModel = getModel('module'); |
335 | 335 | $config = $oModuleModel->getModuleConfig('point'); |
336 | 336 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -344,11 +344,11 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | // If the user is not logged in and download requires points, deny access. |
347 | - if(!Context::get('is_logged')) |
|
347 | + if (!Context::get('is_logged')) |
|
348 | 348 | { |
349 | - if($config->disable_download == 'Y' && $point) |
|
349 | + if ($config->disable_download == 'Y' && $point) |
|
350 | 350 | { |
351 | - return new BaseObject(-1,'msg_not_permitted_download'); |
|
351 | + return new BaseObject(-1, 'msg_not_permitted_download'); |
|
352 | 352 | } |
353 | 353 | else |
354 | 354 | { |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | // If the member does not have enough points, deny access. |
364 | 364 | if ($config->disable_download == 'Y' && $cur_point + $point < 0) |
365 | 365 | { |
366 | - return new BaseObject(-1,'msg_cannot_download'); |
|
366 | + return new BaseObject(-1, 'msg_cannot_download'); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | // Otherwise, points will be adjusted after downloading (triggerDownloadFile). |
@@ -377,13 +377,13 @@ discard block |
||
377 | 377 | { |
378 | 378 | // Run only when logged in |
379 | 379 | $logged_info = Context::get('logged_info'); |
380 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
380 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
381 | 381 | $module_srl = $obj->module_srl; |
382 | 382 | $member_srl = $logged_info->member_srl; |
383 | - if(!$module_srl) return new BaseObject(); |
|
383 | + if (!$module_srl) return new BaseObject(); |
|
384 | 384 | |
385 | 385 | // Pass if it is your file |
386 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
386 | + if ($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
387 | 387 | |
388 | 388 | // Get the point module information |
389 | 389 | $oModuleModel = getModel('module'); |
@@ -424,22 +424,22 @@ discard block |
||
424 | 424 | // Get the original author number |
425 | 425 | $target_member_srl = abs($obj->get('member_srl')); |
426 | 426 | // Pass without increasing the hits if the viewer is the same as the author |
427 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
427 | + if ($target_member_srl == $member_srl) return new BaseObject(); |
|
428 | 428 | // Get the point information for each module |
429 | 429 | $config = $oModuleModel->getModuleConfig('point'); |
430 | 430 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
431 | 431 | // Get hits points |
432 | 432 | $point = $module_config['read_document']; |
433 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
433 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
434 | 434 | // Pass if there are no requested points |
435 | - if(!$point) return new BaseObject(); |
|
435 | + if (!$point) return new BaseObject(); |
|
436 | 436 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
437 | - if($member_srl) |
|
437 | + if ($member_srl) |
|
438 | 438 | { |
439 | 439 | $args->member_srl = $member_srl; |
440 | 440 | $args->document_srl = $obj->document_srl; |
441 | 441 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
442 | - if($output->data->count) return new BaseObject(); |
|
442 | + if ($output->data->count) return new BaseObject(); |
|
443 | 443 | $cur_point = $oPointModel->getPoint($member_srl, true); |
444 | 444 | } |
445 | 445 | else |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $config = $oModuleModel->getModuleConfig('point'); |
451 | 451 | // When the requested points are negative, compared it with the current point |
452 | 452 | $_SESSION['banned_document'][$obj->document_srl] = false; |
453 | - if($config->disable_read_document == 'Y' && $point < 0 && abs($point)>$cur_point) |
|
453 | + if ($config->disable_read_document == 'Y' && $point < 0 && abs($point) > $cur_point) |
|
454 | 454 | { |
455 | 455 | $message = sprintf(Context::getLang('msg_disallow_by_point'), abs($point), $cur_point); |
456 | 456 | $obj->add('content', $message); |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | return new BaseObject(-1, $message); |
459 | 459 | } |
460 | 460 | // If not logged in, pass |
461 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
461 | + if (!$logged_info->member_srl) return new BaseObject(); |
|
462 | 462 | // Pass, if there are no requested points |
463 | - if(!$point) return new BaseObject(); |
|
463 | + if (!$point) return new BaseObject(); |
|
464 | 464 | // If the read record is missing, leave it |
465 | 465 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
466 | 466 | // Increase the point |
467 | 467 | $cur_point += $point; |
468 | - $this->setPoint($member_srl,$cur_point); |
|
468 | + $this->setPoint($member_srl, $cur_point); |
|
469 | 469 | |
470 | 470 | return new BaseObject(); |
471 | 471 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | { |
478 | 478 | $module_srl = $obj->module_srl; |
479 | 479 | $member_srl = $obj->member_srl; |
480 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
480 | + if (!$module_srl || !$member_srl) return new BaseObject(); |
|
481 | 481 | |
482 | 482 | $oModuleModel = getModel('module'); |
483 | 483 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -486,21 +486,21 @@ discard block |
||
486 | 486 | $oPointModel = getModel('point'); |
487 | 487 | $cur_point = $oPointModel->getPoint($member_srl, true); |
488 | 488 | |
489 | - if( $obj->point > 0 ) |
|
489 | + if ($obj->point > 0) |
|
490 | 490 | { |
491 | 491 | $point = $module_config['voted']; |
492 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
492 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
493 | 493 | } |
494 | 494 | else |
495 | 495 | { |
496 | 496 | $point = $module_config['blamed']; |
497 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
497 | + if (strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
498 | 498 | } |
499 | 499 | |
500 | - if(!$point) return new BaseObject(); |
|
500 | + if (!$point) return new BaseObject(); |
|
501 | 501 | // Increase the point |
502 | 502 | $cur_point += $point; |
503 | - $this->setPoint($member_srl,$cur_point); |
|
503 | + $this->setPoint($member_srl, $cur_point); |
|
504 | 504 | |
505 | 505 | return new BaseObject(); |
506 | 506 | } |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | { |
513 | 513 | $member_srl = abs($member_srl); |
514 | 514 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
515 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
515 | + if (!$mode || !in_array($mode, $mode_arr)) $mode = 'update'; |
|
516 | 516 | |
517 | 517 | // Get configuration information |
518 | 518 | $oMemberModel = getModel('member'); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $args->member_srl = $member_srl; |
530 | 530 | $args->point = $current_point; |
531 | 531 | |
532 | - switch($mode) |
|
532 | + switch ($mode) |
|
533 | 533 | { |
534 | 534 | case 'add' : |
535 | 535 | $args->point += $point; |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $args->point = $point; |
543 | 543 | break; |
544 | 544 | } |
545 | - if($args->point < 0) $args->point = 0; |
|
545 | + if ($args->point < 0) $args->point = 0; |
|
546 | 546 | $point = $args->point; |
547 | 547 | |
548 | 548 | // Call a trigger (before) |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $trigger_obj->current_level = $current_level; |
554 | 554 | $trigger_obj->set_point = $point; |
555 | 555 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'before', $trigger_obj); |
556 | - if(!$trigger_output->toBool()) |
|
556 | + if (!$trigger_output->toBool()) |
|
557 | 557 | { |
558 | 558 | return $trigger_output; |
559 | 559 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | $oDB->begin(); |
564 | 564 | |
565 | 565 | // If there are points, update, if no, insert |
566 | - if($current_point > 0) |
|
566 | + if ($current_point > 0) |
|
567 | 567 | { |
568 | 568 | $output = executeQuery("point.updatePoint", $args); |
569 | 569 | } |
@@ -571,13 +571,13 @@ discard block |
||
571 | 571 | { |
572 | 572 | // 많은 동접시 넣는 과정에서 insert가 미리 이루어졌지만 이 공간으로 넘어올 경우 다시 한번 더 업데이트를 처리. |
573 | 573 | $output = executeQuery("point.insertPoint", $args); |
574 | - if(!$output->toBool()) |
|
574 | + if (!$output->toBool()) |
|
575 | 575 | { |
576 | 576 | $output = executeQuery("point.updatePoint", $args); |
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
580 | - if(!$output->toBool()) |
|
580 | + if (!$output->toBool()) |
|
581 | 581 | { |
582 | 582 | $oDB->rollback(); |
583 | 583 | return $output; |
@@ -587,12 +587,12 @@ discard block |
||
587 | 587 | $level = $oPointModel->getLevel($point, $config->level_step); |
588 | 588 | |
589 | 589 | // If existing level and a new one are different attempt to set a point group |
590 | - if($level != $current_level) |
|
590 | + if ($level != $current_level) |
|
591 | 591 | { |
592 | 592 | // Check if the level, for which the current points are prepared, is calculate and set the correct group |
593 | 593 | $point_group = $config->point_group; |
594 | 594 | // If the point group exists |
595 | - if($point_group && is_array($point_group) && count($point_group) ) |
|
595 | + if ($point_group && is_array($point_group) && count($point_group)) |
|
596 | 596 | { |
597 | 597 | // Get the default group |
598 | 598 | $default_group = $oMemberModel->getDefaultGroup(); |
@@ -602,29 +602,29 @@ discard block |
||
602 | 602 | |
603 | 603 | asort($point_group); |
604 | 604 | // Reset group after initialization |
605 | - if($config->group_reset != 'N') |
|
605 | + if ($config->group_reset != 'N') |
|
606 | 606 | { |
607 | 607 | // If the new level is in the right group |
608 | - if(in_array($level, $point_group)) |
|
608 | + if (in_array($level, $point_group)) |
|
609 | 609 | { |
610 | 610 | // Delete all groups except the one which the current level belongs to |
611 | - foreach($point_group as $group_srl => $target_level) |
|
611 | + foreach ($point_group as $group_srl => $target_level) |
|
612 | 612 | { |
613 | 613 | $del_group_list[] = $group_srl; |
614 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
614 | + if ($target_level == $level) $new_group_list[] = $group_srl; |
|
615 | 615 | } |
616 | 616 | } |
617 | 617 | // Otherwise, in case the level is reduced, add the recent group |
618 | 618 | else |
619 | 619 | { |
620 | 620 | $i = $level; |
621 | - while($i > 0) |
|
621 | + while ($i > 0) |
|
622 | 622 | { |
623 | - if(in_array($i, $point_group)) |
|
623 | + if (in_array($i, $point_group)) |
|
624 | 624 | { |
625 | - foreach($point_group as $group_srl => $target_level) |
|
625 | + foreach ($point_group as $group_srl => $target_level) |
|
626 | 626 | { |
627 | - if($target_level == $i) |
|
627 | + if ($target_level == $i) |
|
628 | 628 | { |
629 | 629 | $new_group_list[] = $group_srl; |
630 | 630 | } |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | } |
636 | 636 | } |
637 | 637 | // Delete the group of a level which is higher than the current level |
638 | - foreach($point_group as $group_srl => $target_level) |
|
638 | + foreach ($point_group as $group_srl => $target_level) |
|
639 | 639 | { |
640 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
640 | + if ($target_level > $level) $del_group_list[] = $group_srl; |
|
641 | 641 | } |
642 | 642 | $del_group_list[] = $default_group->group_srl; |
643 | 643 | } |
@@ -645,16 +645,16 @@ discard block |
||
645 | 645 | else |
646 | 646 | { |
647 | 647 | // Check until the current level by rotating setting the configurations of the point groups |
648 | - foreach($point_group as $group_srl => $target_level) |
|
648 | + foreach ($point_group as $group_srl => $target_level) |
|
649 | 649 | { |
650 | 650 | $del_group_list[] = $group_srl; |
651 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
651 | + if ($target_level <= $level) $new_group_list[] = $group_srl; |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | // If there is no a new group, granted the default group |
655 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
655 | + if (!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
656 | 656 | // Remove linkage group |
657 | - if($del_group_list && count($del_group_list)) |
|
657 | + if ($del_group_list && count($del_group_list)) |
|
658 | 658 | { |
659 | 659 | $del_group_args = new stdClass; |
660 | 660 | $del_group_args->member_srl = $member_srl; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $del_group_output = executeQuery('point.deleteMemberGroup', $del_group_args); |
663 | 663 | } |
664 | 664 | // Grant a new group |
665 | - foreach($new_group_list as $group_srl) |
|
665 | + foreach ($new_group_list as $group_srl) |
|
666 | 666 | { |
667 | 667 | $new_group_args = new stdClass; |
668 | 668 | $new_group_args->member_srl = $member_srl; |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $trigger_obj->del_group_list = $del_group_list; |
678 | 678 | $trigger_obj->new_level = $level; |
679 | 679 | $trigger_output = ModuleHandler::triggerCall('point.setPoint', 'after', $trigger_obj); |
680 | - if(!$trigger_output->toBool()) |
|
680 | + if (!$trigger_output->toBool()) |
|
681 | 681 | { |
682 | 682 | $oDB->rollback(); |
683 | 683 | return $trigger_output; |
@@ -693,17 +693,17 @@ discard block |
||
693 | 693 | FileHandler::writeFile($cache_filename, $point); |
694 | 694 | |
695 | 695 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
696 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
696 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
697 | 697 | { |
698 | - $object_key = 'member_groups:' . getNumberingPath($member_srl) . $member_srl . '_0'; |
|
698 | + $object_key = 'member_groups:'.getNumberingPath($member_srl).$member_srl.'_0'; |
|
699 | 699 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
700 | 700 | $oCacheHandler->delete($cache_key); |
701 | 701 | } |
702 | 702 | |
703 | 703 | $oCacheHandler = CacheHandler::getInstance('object'); |
704 | - if($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
704 | + if ($new_group_list && $del_group_list && $oCacheHandler->isSupport()) |
|
705 | 705 | { |
706 | - $object_key = 'member_info:' . getNumberingPath($member_srl) . $member_srl; |
|
706 | + $object_key = 'member_info:'.getNumberingPath($member_srl).$member_srl; |
|
707 | 707 | $cache_key = $oCacheHandler->getGroupKey('member', $object_key); |
708 | 708 | $oCacheHandler->delete($cache_key); |
709 | 709 | } |
@@ -717,9 +717,9 @@ discard block |
||
717 | 717 | $pointConfig = $oModuleModel->getModulePartConfig('point', $obj->originModuleSrl); |
718 | 718 | |
719 | 719 | $oModuleController = getController('module'); |
720 | - if(is_array($obj->moduleSrlList)) |
|
720 | + if (is_array($obj->moduleSrlList)) |
|
721 | 721 | { |
722 | - foreach($obj->moduleSrlList AS $key=>$moduleSrl) |
|
722 | + foreach ($obj->moduleSrlList AS $key=>$moduleSrl) |
|
723 | 723 | { |
724 | 724 | $oModuleController->insertModulePartConfig('point', $moduleSrl, $pointConfig); |
725 | 725 | } |
@@ -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 BaseObject(); |
|
45 | + if(!$member_srl) { |
|
46 | + return new BaseObject(); |
|
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 BaseObject(); |
|
49 | + if(substr($obj->last_login,0,8)==date("Ymd")) { |
|
50 | + return new BaseObject(); |
|
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 BaseObject(); |
|
77 | + if(!$module_srl || !$member_srl) { |
|
78 | + return new BaseObject(); |
|
79 | + } |
|
74 | 80 | // The fix to disable giving points for saving the document temporarily |
75 | - if($module_srl == $member_srl) return new BaseObject(); |
|
81 | + if($module_srl == $member_srl) { |
|
82 | + return new BaseObject(); |
|
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 BaseObject(); |
|
164 | + if(!$oDocument->isExists()) { |
|
165 | + return new BaseObject(); |
|
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 BaseObject(); |
|
177 | + if($comment_point>0) { |
|
178 | + return new BaseObject(); |
|
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 BaseObject(); |
|
185 | + if(!$output->data) { |
|
186 | + return new BaseObject(); |
|
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 BaseObject(); |
|
199 | + if($member_srl) { |
|
200 | + unset($member_srls[abs($member_srl)]); |
|
201 | + } |
|
202 | + if(!count($member_srls)) { |
|
203 | + return new BaseObject(); |
|
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 BaseObject(); |
|
231 | + if(!$module_srl || !$member_srl) { |
|
232 | + return new BaseObject(); |
|
233 | + } |
|
198 | 234 | // Run only when logged in |
199 | 235 | $logged_info = Context::get('logged_info'); |
200 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
236 | + if(!$logged_info->member_srl) { |
|
237 | + return new BaseObject(); |
|
238 | + } |
|
201 | 239 | // Get the points of the member |
202 | 240 | $oPointModel = getModel('point'); |
203 | 241 | $cur_point = $oPointModel->getPoint($member_srl, true); |
@@ -207,9 +245,13 @@ 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 BaseObject(); |
|
252 | + if($point < 0) { |
|
253 | + return new BaseObject(); |
|
254 | + } |
|
213 | 255 | $cur_point -= $point; |
214 | 256 | // Increase the point |
215 | 257 | $this->setPoint($member_srl,$cur_point); |
@@ -225,12 +267,16 @@ discard block |
||
225 | 267 | { |
226 | 268 | $module_srl = $obj->module_srl; |
227 | 269 | $member_srl = $obj->member_srl; |
228 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
270 | + if(!$module_srl || !$member_srl) { |
|
271 | + return new BaseObject(); |
|
272 | + } |
|
229 | 273 | // Do not increase the points if the member is the author of the post |
230 | 274 | $document_srl = $obj->document_srl; |
231 | 275 | $oDocumentModel = getModel('document'); |
232 | 276 | $oDocument = $oDocumentModel->getDocument($document_srl); |
233 | - if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) return new BaseObject(); |
|
277 | + if(!$oDocument->isExists() || abs($oDocument->get('member_srl'))==abs($member_srl)) { |
|
278 | + return new BaseObject(); |
|
279 | + } |
|
234 | 280 | // Get the point module information |
235 | 281 | $oModuleModel = getModel('module'); |
236 | 282 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -240,7 +286,9 @@ discard block |
||
240 | 286 | $cur_point = $oPointModel->getPoint($member_srl, true); |
241 | 287 | |
242 | 288 | $point = $module_config['insert_comment']; |
243 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
289 | + if(strlen($point) == 0 && !is_int($point)) { |
|
290 | + $point = $config->insert_comment; |
|
291 | + } |
|
244 | 292 | // Increase the point |
245 | 293 | $cur_point += $point; |
246 | 294 | $this->setPoint($member_srl,$cur_point); |
@@ -260,11 +308,17 @@ discard block |
||
260 | 308 | $module_srl = $obj->module_srl; |
261 | 309 | $member_srl = abs($obj->member_srl); |
262 | 310 | $document_srl = $obj->document_srl; |
263 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
311 | + if(!$module_srl || !$member_srl) { |
|
312 | + return new BaseObject(); |
|
313 | + } |
|
264 | 314 | // Get the original article (if the original article is missing or if the member is its author, do not apply the points) |
265 | 315 | $oDocument = $oDocumentModel->getDocument($document_srl); |
266 | - if(!$oDocument->isExists()) return new BaseObject(); |
|
267 | - if($oDocument->get('member_srl')==$member_srl) return new BaseObject(); |
|
316 | + if(!$oDocument->isExists()) { |
|
317 | + return new BaseObject(); |
|
318 | + } |
|
319 | + if($oDocument->get('member_srl')==$member_srl) { |
|
320 | + return new BaseObject(); |
|
321 | + } |
|
268 | 322 | // Get the point module information |
269 | 323 | $config = $oModuleModel->getModuleConfig('point'); |
270 | 324 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
@@ -272,9 +326,13 @@ discard block |
||
272 | 326 | $cur_point = $oPointModel->getPoint($member_srl, true); |
273 | 327 | |
274 | 328 | $point = $module_config['insert_comment']; |
275 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->insert_comment; |
|
329 | + if(strlen($point) == 0 && !is_int($point)) { |
|
330 | + $point = $config->insert_comment; |
|
331 | + } |
|
276 | 332 | // if the point is set to decrease when writing a comment, make sure it does not increase the points when deleting a comment |
277 | - if($point < 0) return new BaseObject(); |
|
333 | + if($point < 0) { |
|
334 | + return new BaseObject(); |
|
335 | + } |
|
278 | 336 | // Increase the point |
279 | 337 | $cur_point -= $point; |
280 | 338 | $this->setPoint($member_srl,$cur_point); |
@@ -297,11 +355,15 @@ discard block |
||
297 | 355 | */ |
298 | 356 | function triggerDeleteFile(&$obj) |
299 | 357 | { |
300 | - if($obj->isvalid != 'Y') return new BaseObject(); |
|
358 | + if($obj->isvalid != 'Y') { |
|
359 | + return new BaseObject(); |
|
360 | + } |
|
301 | 361 | |
302 | 362 | $module_srl = $obj->module_srl; |
303 | 363 | $member_srl = $obj->member_srl; |
304 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
364 | + if(!$module_srl || !$member_srl) { |
|
365 | + return new BaseObject(); |
|
366 | + } |
|
305 | 367 | // Get the point module information |
306 | 368 | $oModuleModel = getModel('module'); |
307 | 369 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -311,7 +373,9 @@ discard block |
||
311 | 373 | $cur_point = $oPointModel->getPoint($member_srl, true); |
312 | 374 | |
313 | 375 | $point = $module_config['upload_file']; |
314 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->upload_file; |
|
376 | + if(strlen($point) == 0 && !is_int($point)) { |
|
377 | + $point = $config->upload_file; |
|
378 | + } |
|
315 | 379 | // Increase the point |
316 | 380 | $cur_point -= $point; |
317 | 381 | $this->setPoint($member_srl,$cur_point); |
@@ -327,18 +391,21 @@ discard block |
||
327 | 391 | $logged_info = Context::get('logged_info'); |
328 | 392 | $member_srl = $logged_info->member_srl; |
329 | 393 | $module_srl = $obj->module_srl; |
330 | - if(!$module_srl) return new BaseObject(); |
|
394 | + if(!$module_srl) { |
|
395 | + return new BaseObject(); |
|
396 | + } |
|
331 | 397 | |
332 | 398 | // Pass if it is your file |
333 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
399 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
400 | + return new BaseObject(); |
|
401 | + } |
|
334 | 402 | $oModuleModel = getModel('module'); |
335 | 403 | $config = $oModuleModel->getModuleConfig('point'); |
336 | 404 | $module_config = $oModuleModel->getModulePartConfig('point', $module_srl); |
337 | 405 | if (isset($module_config['download_file'])) |
338 | 406 | { |
339 | 407 | $point = intval($module_config['download_file']); |
340 | - } |
|
341 | - else |
|
408 | + } else |
|
342 | 409 | { |
343 | 410 | $point = intval($config->download_file); |
344 | 411 | } |
@@ -349,8 +416,7 @@ discard block |
||
349 | 416 | if($config->disable_download == 'Y' && $point) |
350 | 417 | { |
351 | 418 | return new BaseObject(-1,'msg_not_permitted_download'); |
352 | - } |
|
353 | - else |
|
419 | + } else |
|
354 | 420 | { |
355 | 421 | return new BaseObject(); |
356 | 422 | } |
@@ -377,13 +443,19 @@ discard block |
||
377 | 443 | { |
378 | 444 | // Run only when logged in |
379 | 445 | $logged_info = Context::get('logged_info'); |
380 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
446 | + if(!$logged_info->member_srl) { |
|
447 | + return new BaseObject(); |
|
448 | + } |
|
381 | 449 | $module_srl = $obj->module_srl; |
382 | 450 | $member_srl = $logged_info->member_srl; |
383 | - if(!$module_srl) return new BaseObject(); |
|
451 | + if(!$module_srl) { |
|
452 | + return new BaseObject(); |
|
453 | + } |
|
384 | 454 | |
385 | 455 | // Pass if it is your file |
386 | - if($member_srl && abs($obj->member_srl) == $member_srl) return new BaseObject(); |
|
456 | + if($member_srl && abs($obj->member_srl) == $member_srl) { |
|
457 | + return new BaseObject(); |
|
458 | + } |
|
387 | 459 | |
388 | 460 | // Get the point module information |
389 | 461 | $oModuleModel = getModel('module'); |
@@ -392,8 +464,7 @@ discard block |
||
392 | 464 | if (isset($module_config['download_file'])) |
393 | 465 | { |
394 | 466 | $point = intval($module_config['download_file']); |
395 | - } |
|
396 | - else |
|
467 | + } else |
|
397 | 468 | { |
398 | 469 | $point = intval($config->download_file); |
399 | 470 | } |
@@ -424,25 +495,32 @@ discard block |
||
424 | 495 | // Get the original author number |
425 | 496 | $target_member_srl = abs($obj->get('member_srl')); |
426 | 497 | // Pass without increasing the hits if the viewer is the same as the author |
427 | - if($target_member_srl == $member_srl) return new BaseObject(); |
|
498 | + if($target_member_srl == $member_srl) { |
|
499 | + return new BaseObject(); |
|
500 | + } |
|
428 | 501 | // Get the point information for each module |
429 | 502 | $config = $oModuleModel->getModuleConfig('point'); |
430 | 503 | $module_config = $oModuleModel->getModulePartConfig('point', $obj->get('module_srl')); |
431 | 504 | // Get hits points |
432 | 505 | $point = $module_config['read_document']; |
433 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->read_document; |
|
506 | + if(strlen($point) == 0 && !is_int($point)) { |
|
507 | + $point = $config->read_document; |
|
508 | + } |
|
434 | 509 | // Pass if there are no requested points |
435 | - if(!$point) return new BaseObject(); |
|
510 | + if(!$point) { |
|
511 | + return new BaseObject(); |
|
512 | + } |
|
436 | 513 | // In case of a registered member, if it is read but cannot just pass, then get the current points |
437 | 514 | if($member_srl) |
438 | 515 | { |
439 | 516 | $args->member_srl = $member_srl; |
440 | 517 | $args->document_srl = $obj->document_srl; |
441 | 518 | $output = executeQuery('document.getDocumentReadedLogInfo', $args); |
442 | - if($output->data->count) return new BaseObject(); |
|
519 | + if($output->data->count) { |
|
520 | + return new BaseObject(); |
|
521 | + } |
|
443 | 522 | $cur_point = $oPointModel->getPoint($member_srl, true); |
444 | - } |
|
445 | - else |
|
523 | + } else |
|
446 | 524 | { |
447 | 525 | $cur_point = 0; |
448 | 526 | } |
@@ -458,9 +536,13 @@ discard block |
||
458 | 536 | return new BaseObject(-1, $message); |
459 | 537 | } |
460 | 538 | // If not logged in, pass |
461 | - if(!$logged_info->member_srl) return new BaseObject(); |
|
539 | + if(!$logged_info->member_srl) { |
|
540 | + return new BaseObject(); |
|
541 | + } |
|
462 | 542 | // Pass, if there are no requested points |
463 | - if(!$point) return new BaseObject(); |
|
543 | + if(!$point) { |
|
544 | + return new BaseObject(); |
|
545 | + } |
|
464 | 546 | // If the read record is missing, leave it |
465 | 547 | $output = executeQuery('document.insertDocumentReadedLog', $args); |
466 | 548 | // Increase the point |
@@ -477,7 +559,9 @@ discard block |
||
477 | 559 | { |
478 | 560 | $module_srl = $obj->module_srl; |
479 | 561 | $member_srl = $obj->member_srl; |
480 | - if(!$module_srl || !$member_srl) return new BaseObject(); |
|
562 | + if(!$module_srl || !$member_srl) { |
|
563 | + return new BaseObject(); |
|
564 | + } |
|
481 | 565 | |
482 | 566 | $oModuleModel = getModel('module'); |
483 | 567 | $config = $oModuleModel->getModuleConfig('point'); |
@@ -489,15 +573,20 @@ discard block |
||
489 | 573 | if( $obj->point > 0 ) |
490 | 574 | { |
491 | 575 | $point = $module_config['voted']; |
492 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->voted; |
|
493 | - } |
|
494 | - else |
|
576 | + if(strlen($point) == 0 && !is_int($point)) { |
|
577 | + $point = $config->voted; |
|
578 | + } |
|
579 | + } else |
|
495 | 580 | { |
496 | 581 | $point = $module_config['blamed']; |
497 | - if(strlen($point) == 0 && !is_int($point)) $point = $config->blamed; |
|
582 | + if(strlen($point) == 0 && !is_int($point)) { |
|
583 | + $point = $config->blamed; |
|
584 | + } |
|
498 | 585 | } |
499 | 586 | |
500 | - if(!$point) return new BaseObject(); |
|
587 | + if(!$point) { |
|
588 | + return new BaseObject(); |
|
589 | + } |
|
501 | 590 | // Increase the point |
502 | 591 | $cur_point += $point; |
503 | 592 | $this->setPoint($member_srl,$cur_point); |
@@ -512,7 +601,9 @@ discard block |
||
512 | 601 | { |
513 | 602 | $member_srl = abs($member_srl); |
514 | 603 | $mode_arr = array('add', 'minus', 'update', 'signup'); |
515 | - if(!$mode || !in_array($mode,$mode_arr)) $mode = 'update'; |
|
604 | + if(!$mode || !in_array($mode,$mode_arr)) { |
|
605 | + $mode = 'update'; |
|
606 | + } |
|
516 | 607 | |
517 | 608 | // Get configuration information |
518 | 609 | $oMemberModel = getModel('member'); |
@@ -542,7 +633,9 @@ discard block |
||
542 | 633 | $args->point = $point; |
543 | 634 | break; |
544 | 635 | } |
545 | - if($args->point < 0) $args->point = 0; |
|
636 | + if($args->point < 0) { |
|
637 | + $args->point = 0; |
|
638 | + } |
|
546 | 639 | $point = $args->point; |
547 | 640 | |
548 | 641 | // Call a trigger (before) |
@@ -566,8 +659,7 @@ discard block |
||
566 | 659 | if($current_point > 0) |
567 | 660 | { |
568 | 661 | $output = executeQuery("point.updatePoint", $args); |
569 | - } |
|
570 | - else |
|
662 | + } else |
|
571 | 663 | { |
572 | 664 | // 많은 동접시 넣는 과정에서 insert가 미리 이루어졌지만 이 공간으로 넘어올 경우 다시 한번 더 업데이트를 처리. |
573 | 665 | $output = executeQuery("point.insertPoint", $args); |
@@ -611,7 +703,9 @@ discard block |
||
611 | 703 | foreach($point_group as $group_srl => $target_level) |
612 | 704 | { |
613 | 705 | $del_group_list[] = $group_srl; |
614 | - if($target_level == $level) $new_group_list[] = $group_srl; |
|
706 | + if($target_level == $level) { |
|
707 | + $new_group_list[] = $group_srl; |
|
708 | + } |
|
615 | 709 | } |
616 | 710 | } |
617 | 711 | // Otherwise, in case the level is reduced, add the recent group |
@@ -637,7 +731,9 @@ discard block |
||
637 | 731 | // Delete the group of a level which is higher than the current level |
638 | 732 | foreach($point_group as $group_srl => $target_level) |
639 | 733 | { |
640 | - if($target_level > $level) $del_group_list[] = $group_srl; |
|
734 | + if($target_level > $level) { |
|
735 | + $del_group_list[] = $group_srl; |
|
736 | + } |
|
641 | 737 | } |
642 | 738 | $del_group_list[] = $default_group->group_srl; |
643 | 739 | } |
@@ -648,11 +744,15 @@ discard block |
||
648 | 744 | foreach($point_group as $group_srl => $target_level) |
649 | 745 | { |
650 | 746 | $del_group_list[] = $group_srl; |
651 | - if($target_level <= $level) $new_group_list[] = $group_srl; |
|
747 | + if($target_level <= $level) { |
|
748 | + $new_group_list[] = $group_srl; |
|
749 | + } |
|
652 | 750 | } |
653 | 751 | } |
654 | 752 | // If there is no a new group, granted the default group |
655 | - if(!$new_group_list[0]) $new_group_list[0] = $default_group->group_srl; |
|
753 | + if(!$new_group_list[0]) { |
|
754 | + $new_group_list[0] = $default_group->group_srl; |
|
755 | + } |
|
656 | 756 | // Remove linkage group |
657 | 757 | if($del_group_list && count($del_group_list)) |
658 | 758 | { |
@@ -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 | } |
@@ -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 BaseObject(-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,39 +27,39 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function triggerInsertDocument(&$obj) |
29 | 29 | { |
30 | - if($_SESSION['avoid_log']) return new BaseObject(); |
|
30 | + if ($_SESSION['avoid_log']) return new BaseObject(); |
|
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 BaseObject(); |
|
39 | - if($grant->manager) return new BaseObject(); |
|
38 | + if ($logged_info->is_admin == 'Y') return new BaseObject(); |
|
39 | + if ($grant->manager) return new BaseObject(); |
|
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 BaseObject(); |
|
75 | + if ($_SESSION['avoid_log']) return new BaseObject(); |
|
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 BaseObject(); |
|
84 | - if($grant->manager) return new BaseObject(); |
|
83 | + if ($logged_info->is_admin == 'Y') return new BaseObject(); |
|
84 | + if ($grant->manager) return new BaseObject(); |
|
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 BaseObject(); |
|
121 | + if ($_SESSION['avoid_log']) return new BaseObject(); |
|
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 BaseObject(-1,'msg_alert_trackback_denied'); |
|
146 | + return new BaseObject(-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 BaseObject(-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 BaseObject(-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 BaseObject(); |
|
194 | + if ($_SESSION['avoid_log']) return new BaseObject(); |
|
195 | 195 | |
196 | 196 | $logged_info = Context::get('logged_info'); |
197 | - if($logged_info->is_admin == 'Y') return new BaseObject(); |
|
197 | + if ($logged_info->is_admin == 'Y') return new BaseObject(); |
|
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 |
@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | */ |
28 | 28 | function triggerInsertDocument(&$obj) |
29 | 29 | { |
30 | - if($_SESSION['avoid_log']) return new BaseObject(); |
|
30 | + if($_SESSION['avoid_log']) { |
|
31 | + return new BaseObject(); |
|
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 BaseObject(); |
|
39 | - if($grant->manager) return new BaseObject(); |
|
40 | + if($logged_info->is_admin == 'Y') { |
|
41 | + return new BaseObject(); |
|
42 | + } |
|
43 | + if($grant->manager) { |
|
44 | + return new BaseObject(); |
|
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 BaseObject(); |
|
86 | + if($_SESSION['avoid_log']) { |
|
87 | + return new BaseObject(); |
|
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 BaseObject(); |
|
84 | - if($grant->manager) return new BaseObject(); |
|
96 | + if($logged_info->is_admin == 'Y') { |
|
97 | + return new BaseObject(); |
|
98 | + } |
|
99 | + if($grant->manager) { |
|
100 | + return new BaseObject(); |
|
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 BaseObject(); |
|
143 | + if($_SESSION['avoid_log']) { |
|
144 | + return new BaseObject(); |
|
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 BaseObject(-1, 'msg_invalid'); |
|
198 | + if(!preg_match($regExr,$ipaddress_list)) { |
|
199 | + return new BaseObject(-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 BaseObject(); |
|
231 | + if($_SESSION['avoid_log']) { |
|
232 | + return new BaseObject(); |
|
233 | + } |
|
195 | 234 | |
196 | 235 | $logged_info = Context::get('logged_info'); |
197 | - if($logged_info->is_admin == 'Y') return new BaseObject(); |
|
236 | + if($logged_info->is_admin == 'Y') { |
|
237 | + return new BaseObject(); |
|
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 |
@@ -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 |