@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function __construct($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
36 | 36 | { |
37 | 37 | // If XE has not installed yet, set module as install |
38 | - if(!Context::isInstalled()) |
|
38 | + if (!Context::isInstalled()) |
|
39 | 39 | { |
40 | 40 | $this->module = 'install'; |
41 | 41 | $this->act = Context::get('act'); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | $oContext = Context::getInstance(); |
46 | - if($oContext->isSuccessInit == FALSE) |
|
46 | + if ($oContext->isSuccessInit == FALSE) |
|
47 | 47 | { |
48 | 48 | // @see https://github.com/xpressengine/xe-core/issues/2304 |
49 | 49 | $this->error = 'msg_invalid_request'; |
@@ -56,26 +56,26 @@ discard block |
||
56 | 56 | $this->mid = $mid ? $mid : Context::get('mid'); |
57 | 57 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
58 | 58 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
59 | - if($entry = Context::get('entry')) |
|
59 | + if ($entry = Context::get('entry')) |
|
60 | 60 | { |
61 | 61 | $this->entry = Context::convertEncodingStr($entry); |
62 | 62 | } |
63 | 63 | |
64 | 64 | // Validate variables to prevent XSS |
65 | 65 | $isInvalid = NULL; |
66 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
66 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
67 | 67 | { |
68 | 68 | $isInvalid = TRUE; |
69 | 69 | } |
70 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
70 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
71 | 71 | { |
72 | 72 | $isInvalid = TRUE; |
73 | 73 | } |
74 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
74 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
75 | 75 | { |
76 | 76 | $isInvalid = TRUE; |
77 | 77 | } |
78 | - if($isInvalid) |
|
78 | + if ($isInvalid) |
|
79 | 79 | { |
80 | 80 | htmlHeader(); |
81 | 81 | echo Context::getLang("msg_invalid_request"); |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | exit; |
85 | 85 | } |
86 | 86 | |
87 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
87 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
88 | 88 | { |
89 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
89 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
90 | 90 | { |
91 | - if(Context::get('_https_port')!=null) { |
|
92 | - header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
|
91 | + if (Context::get('_https_port') != null) { |
|
92 | + header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']); |
|
93 | 93 | } else { |
94 | - header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
94 | + header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); |
|
95 | 95 | } |
96 | 96 | return; |
97 | 97 | } |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | |
100 | 100 | // call a trigger before moduleHandler init |
101 | 101 | ModuleHandler::triggerCall('moduleHandler.init', 'before', $this); |
102 | - if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
102 | + if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0) |
|
103 | 103 | { |
104 | - if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
104 | + if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR']) |
|
105 | 105 | { |
106 | 106 | set_error_handler(array($this, 'xeErrorLog'), E_WARNING); |
107 | 107 | register_shutdown_function(array($this, 'shutdownHandler')); |
@@ -112,40 +112,40 @@ discard block |
||
112 | 112 | $called_position = 'before_module_init'; |
113 | 113 | $oAddonController = getController('addon'); |
114 | 114 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
115 | - if(file_exists($addon_file)) include($addon_file); |
|
115 | + if (file_exists($addon_file)) include($addon_file); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext) |
119 | 119 | { |
120 | - if(($errnumber & 3) == 0 || error_reporting() == 0) |
|
120 | + if (($errnumber & 3) == 0 || error_reporting() == 0) |
|
121 | 121 | { |
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
125 | 125 | set_error_handler(function() { }, ~0); |
126 | 126 | |
127 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
128 | - if(!file_exists($debug_file)) |
|
127 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
128 | + if (!file_exists($debug_file)) |
|
129 | 129 | { |
130 | 130 | $print[] = '<?php exit() ?>'; |
131 | 131 | } |
132 | 132 | |
133 | 133 | $errorname = self::getErrorType($errnumber); |
134 | - $print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage; |
|
134 | + $print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage; |
|
135 | 135 | $backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0; |
136 | 136 | $backtrace = debug_backtrace($backtrace_args); |
137 | - if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
137 | + if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class']) |
|
138 | 138 | { |
139 | 139 | array_shift($backtrace); |
140 | 140 | } |
141 | 141 | |
142 | - foreach($backtrace as $key => $value) |
|
142 | + foreach ($backtrace as $key => $value) |
|
143 | 143 | { |
144 | - $message = ' - ' . $value['file'] . ' : ' . $value['line']; |
|
144 | + $message = ' - '.$value['file'].' : '.$value['line']; |
|
145 | 145 | $print[] = $message; |
146 | 146 | } |
147 | 147 | $print[] = PHP_EOL; |
148 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
148 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
149 | 149 | restore_error_handler(); |
150 | 150 | |
151 | 151 | return true; |
@@ -161,21 +161,21 @@ discard block |
||
161 | 161 | |
162 | 162 | set_error_handler(function() { }, ~0); |
163 | 163 | |
164 | - $debug_file = _XE_PATH_ . 'files/_debug_message.php'; |
|
165 | - if(!file_exists($debug_file)) |
|
164 | + $debug_file = _XE_PATH_.'files/_debug_message.php'; |
|
165 | + if (!file_exists($debug_file)) |
|
166 | 166 | { |
167 | 167 | $print[] = '<?php exit() ?>'; |
168 | 168 | } |
169 | 169 | |
170 | 170 | $errorname = self::getErrorType($errinfo['type']); |
171 | 171 | $print[] = '['.date('Y-m-d H:i:s').']'; |
172 | - $print[] = $errorname . ' : ' . $errinfo['message']; |
|
172 | + $print[] = $errorname.' : '.$errinfo['message']; |
|
173 | 173 | |
174 | - $message = ' - ' . $errinfo['file'] . ' : ' . $errinfo['line']; |
|
174 | + $message = ' - '.$errinfo['file'].' : '.$errinfo['line']; |
|
175 | 175 | $print[] = $message; |
176 | 176 | |
177 | 177 | $print[] = PHP_EOL; |
178 | - @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX); |
|
178 | + @file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX); |
|
179 | 179 | set_error_handler(array($this, 'dummyHandler'), ~0); |
180 | 180 | |
181 | 181 | return true; |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | $siteDomain = parse_url($site_module_info->domain); |
222 | 222 | $siteDomain = $siteDomain['host']; |
223 | 223 | |
224 | - foreach($urls as $url) |
|
224 | + foreach ($urls as $url) |
|
225 | 225 | { |
226 | - if(empty($url)) |
|
226 | + if (empty($url)) |
|
227 | 227 | { |
228 | 228 | continue; |
229 | 229 | } |
@@ -231,33 +231,33 @@ discard block |
||
231 | 231 | $urlInfo = parse_url(urldecode($url)); |
232 | 232 | $host = $urlInfo['host']; |
233 | 233 | |
234 | - if($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain))) |
|
234 | + if ($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain))) |
|
235 | 235 | { |
236 | 236 | throw new Exception('msg_default_url_is_null'); |
237 | 237 | } |
238 | - else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) |
|
238 | + else if ((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) |
|
239 | 239 | { |
240 | 240 | throw new exception('msg_invalid_request'); |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
244 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
245 | 245 | { |
246 | 246 | $oDocumentModel = getModel('document'); |
247 | 247 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
248 | - if($this->document_srl) |
|
248 | + if ($this->document_srl) |
|
249 | 249 | { |
250 | 250 | Context::set('document_srl', $this->document_srl); |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | 254 | // Get module's information based on document_srl, if it's specified |
255 | - if($this->document_srl) |
|
255 | + if ($this->document_srl) |
|
256 | 256 | { |
257 | 257 | |
258 | 258 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
259 | 259 | // If the document does not exist, remove document_srl |
260 | - if(!$module_info) |
|
260 | + if (!$module_info) |
|
261 | 261 | { |
262 | 262 | unset($this->document_srl); |
263 | 263 | } |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | { |
266 | 266 | // If it exists, compare mid based on the module information |
267 | 267 | // if mids are not matching, set it as the document's mid |
268 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
268 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
269 | 269 | { |
270 | 270 | |
271 | - if(Context::getRequestMethod() == 'GET') |
|
271 | + if (Context::getRequestMethod() == 'GET') |
|
272 | 272 | { |
273 | 273 | $this->mid = $module_info->mid; |
274 | - header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
274 | + header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
|
275 | 275 | return FALSE; |
276 | 276 | } |
277 | 277 | else |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | } |
284 | 284 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
285 | - if($this->module && $module_info->module != $this->module) |
|
285 | + if ($this->module && $module_info->module != $this->module) |
|
286 | 286 | { |
287 | 287 | unset($module_info); |
288 | 288 | } |
@@ -291,36 +291,36 @@ discard block |
||
291 | 291 | } |
292 | 292 | |
293 | 293 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
294 | - if(!$module_info && $this->mid) |
|
294 | + if (!$module_info && $this->mid) |
|
295 | 295 | { |
296 | 296 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
297 | 297 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
298 | 298 | } |
299 | 299 | |
300 | 300 | // redirect, if module_site_srl and site_srl are different |
301 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
301 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
302 | 302 | { |
303 | 303 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
304 | - header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
304 | + header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
|
305 | 305 | return FALSE; |
306 | 306 | } |
307 | 307 | |
308 | 308 | // If module_info is not set still, and $module does not exist, find the default module |
309 | - if(!$module_info && !$this->module && !$this->mid) |
|
309 | + if (!$module_info && !$this->module && !$this->mid) |
|
310 | 310 | { |
311 | 311 | $module_info = $site_module_info; |
312 | 312 | } |
313 | 313 | |
314 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
314 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
315 | 315 | { |
316 | 316 | $module_info = $site_module_info; |
317 | 317 | } |
318 | 318 | |
319 | 319 | // redirect, if site_srl of module_info is different from one of site's module_info |
320 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
320 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
321 | 321 | { |
322 | 322 | // If the module is of virtual site |
323 | - if($module_info->site_srl) |
|
323 | + if ($module_info->site_srl) |
|
324 | 324 | { |
325 | 325 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
326 | 326 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | else |
330 | 330 | { |
331 | 331 | $db_info = Context::getDBInfo(); |
332 | - if(!$db_info->default_url) |
|
332 | + if (!$db_info->default_url) |
|
333 | 333 | { |
334 | 334 | return Context::getLang('msg_default_url_is_not_defined'); |
335 | 335 | } |
@@ -338,12 +338,12 @@ discard block |
||
338 | 338 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
339 | 339 | } |
340 | 340 | } |
341 | - header("location:" . $redirect_url); |
|
341 | + header("location:".$redirect_url); |
|
342 | 342 | return FALSE; |
343 | 343 | } |
344 | 344 | |
345 | 345 | // If module info was set, retrieve variables from the module information |
346 | - if($module_info) |
|
346 | + if ($module_info) |
|
347 | 347 | { |
348 | 348 | $this->module = $module_info->module; |
349 | 349 | $this->mid = $module_info->mid; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
355 | 355 | |
356 | 356 | // use the site default layout. |
357 | - if($module_info->{$targetSrl} == -1) |
|
357 | + if ($module_info->{$targetSrl} == -1) |
|
358 | 358 | { |
359 | 359 | $oLayoutAdminModel = getAdminModel('layout'); |
360 | 360 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | // Set module and mid into module_info |
375 | - if(!isset($this->module_info)) |
|
375 | + if (!isset($this->module_info)) |
|
376 | 376 | { |
377 | 377 | $this->module_info = new stdClass(); |
378 | 378 | } |
@@ -383,21 +383,21 @@ discard block |
||
383 | 383 | $this->module_info->site_srl = $site_module_info->site_srl; |
384 | 384 | |
385 | 385 | // Still no module? it's an error |
386 | - if(!$this->module) |
|
386 | + if (!$this->module) |
|
387 | 387 | { |
388 | 388 | $this->error = 'msg_module_is_not_exists'; |
389 | 389 | $this->httpStatusCode = '404'; |
390 | 390 | } |
391 | 391 | |
392 | 392 | // If mid exists, set mid into context |
393 | - if($this->mid) |
|
393 | + if ($this->mid) |
|
394 | 394 | { |
395 | 395 | Context::set('mid', $this->mid, TRUE); |
396 | 396 | } |
397 | 397 | |
398 | 398 | // Call a trigger after moduleHandler init |
399 | 399 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
400 | - if(!$output->toBool()) |
|
400 | + if (!$output->toBool()) |
|
401 | 401 | { |
402 | 402 | $this->error = $output->getMessage(); |
403 | 403 | return TRUE; |
@@ -419,14 +419,14 @@ discard block |
||
419 | 419 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
420 | 420 | |
421 | 421 | // If error occurred while preparation, return a message instance |
422 | - if($this->error) |
|
422 | + if ($this->error) |
|
423 | 423 | { |
424 | 424 | $this->_setInputErrorToContext(); |
425 | 425 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
426 | 426 | $oMessageObject->setError(-1); |
427 | 427 | $oMessageObject->setMessage($this->error); |
428 | 428 | $oMessageObject->dispMessage(); |
429 | - if($this->httpStatusCode) |
|
429 | + if ($this->httpStatusCode) |
|
430 | 430 | { |
431 | 431 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
432 | 432 | } |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
438 | 438 | |
439 | 439 | // If not installed yet, modify act |
440 | - if($this->module == "install") |
|
440 | + if ($this->module == "install") |
|
441 | 441 | { |
442 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
442 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
443 | 443 | { |
444 | 444 | $this->act = $xml_info->default_index_act; |
445 | 445 | } |
446 | 446 | } |
447 | 447 | |
448 | 448 | // if act exists, find type of the action, if not use default index act |
449 | - if(!$this->act) |
|
449 | + if (!$this->act) |
|
450 | 450 | { |
451 | 451 | $this->act = $xml_info->default_index_act; |
452 | 452 | } |
453 | 453 | |
454 | 454 | // still no act means error |
455 | - if(!$this->act) |
|
455 | + if (!$this->act) |
|
456 | 456 | { |
457 | 457 | $this->error = 'msg_module_is_not_exists'; |
458 | 458 | $this->httpStatusCode = '404'; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $oMessageObject->setError(-1); |
463 | 463 | $oMessageObject->setMessage($this->error); |
464 | 464 | $oMessageObject->dispMessage(); |
465 | - if($this->httpStatusCode) |
|
465 | + if ($this->httpStatusCode) |
|
466 | 466 | { |
467 | 467 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
468 | 468 | } |
@@ -480,17 +480,17 @@ discard block |
||
480 | 480 | Context::addMetaTag('robots', 'noindex'); |
481 | 481 | } |
482 | 482 | |
483 | - if(!$kind && $this->module == 'admin') |
|
483 | + if (!$kind && $this->module == 'admin') |
|
484 | 484 | { |
485 | 485 | $kind = 'admin'; |
486 | 486 | } |
487 | 487 | |
488 | 488 | // check REQUEST_METHOD in controller |
489 | - if($type == 'controller') |
|
489 | + if ($type == 'controller') |
|
490 | 490 | { |
491 | 491 | $allowedMethod = $xml_info->action->{$this->act}->method; |
492 | 492 | |
493 | - if(!$allowedMethod) |
|
493 | + if (!$allowedMethod) |
|
494 | 494 | { |
495 | 495 | $allowedMethodList[0] = 'POST'; |
496 | 496 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
500 | 500 | } |
501 | 501 | |
502 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
502 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
503 | 503 | { |
504 | 504 | $this->error = "msg_invalid_request"; |
505 | 505 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | } |
511 | 511 | } |
512 | 512 | |
513 | - if($this->module_info->use_mobile != "Y") |
|
513 | + if ($this->module_info->use_mobile != "Y") |
|
514 | 514 | { |
515 | 515 | Mobile::setMobile(FALSE); |
516 | 516 | } |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | // check CSRF for non-GET actions |
521 | 521 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
522 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
522 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
523 | 523 | { |
524 | 524 | $this->error = 'msg_invalid_request'; |
525 | 525 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | // Admin ip |
533 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
533 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
534 | 534 | { |
535 | 535 | $this->_setInputErrorToContext(); |
536 | 536 | $this->error = "msg_not_permitted_act"; |
@@ -542,13 +542,13 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | // if(type == view, and case for using mobilephone) |
545 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
545 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
546 | 546 | { |
547 | 547 | $orig_type = "view"; |
548 | 548 | $type = "mobile"; |
549 | 549 | // create a module instance |
550 | 550 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
551 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
551 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
552 | 552 | { |
553 | 553 | $type = $orig_type; |
554 | 554 | Mobile::setMobile(FALSE); |
@@ -561,14 +561,14 @@ discard block |
||
561 | 561 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
562 | 562 | } |
563 | 563 | |
564 | - if(!is_object($oModule)) |
|
564 | + if (!is_object($oModule)) |
|
565 | 565 | { |
566 | 566 | $this->_setInputErrorToContext(); |
567 | 567 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
568 | 568 | $oMessageObject->setError(-1); |
569 | 569 | $oMessageObject->setMessage($this->error); |
570 | 570 | $oMessageObject->dispMessage(); |
571 | - if($this->httpStatusCode) |
|
571 | + if ($this->httpStatusCode) |
|
572 | 572 | { |
573 | 573 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
574 | 574 | } |
@@ -576,10 +576,10 @@ discard block |
||
576 | 576 | } |
577 | 577 | |
578 | 578 | // If there is no such action in the module object |
579 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
579 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
580 | 580 | { |
581 | 581 | |
582 | - if(!Context::isInstalled()) |
|
582 | + if (!Context::isInstalled()) |
|
583 | 583 | { |
584 | 584 | $this->_setInputErrorToContext(); |
585 | 585 | $this->error = 'msg_invalid_request'; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | $oMessageObject->setError(-1); |
588 | 588 | $oMessageObject->setMessage($this->error); |
589 | 589 | $oMessageObject->dispMessage(); |
590 | - if($this->httpStatusCode) |
|
590 | + if ($this->httpStatusCode) |
|
591 | 591 | { |
592 | 592 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
593 | 593 | } |
@@ -596,12 +596,12 @@ discard block |
||
596 | 596 | |
597 | 597 | $forward = NULL; |
598 | 598 | // 1. Look for the module with action name |
599 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
599 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
600 | 600 | { |
601 | - $module = strtolower($matches[2] . $matches[3]); |
|
601 | + $module = strtolower($matches[2].$matches[3]); |
|
602 | 602 | $xml_info = $oModuleModel->getModuleActionXml($module); |
603 | 603 | |
604 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
604 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
605 | 605 | { |
606 | 606 | $forward = new stdClass(); |
607 | 607 | $forward->module = $module; |
@@ -622,12 +622,12 @@ discard block |
||
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
625 | - if(!$forward) |
|
625 | + if (!$forward) |
|
626 | 626 | { |
627 | 627 | $forward = $oModuleModel->getActionForward($this->act); |
628 | 628 | } |
629 | 629 | |
630 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
630 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
631 | 631 | { |
632 | 632 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
633 | 633 | $type = $forward->type; |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | $tpl_path = $oModule->getTemplatePath(); |
636 | 636 | $orig_module = $oModule; |
637 | 637 | |
638 | - if($forward->meta_noindex === 'true') { |
|
638 | + if ($forward->meta_noindex === 'true') { |
|
639 | 639 | Context::addMetaTag('robots', 'noindex'); |
640 | 640 | } |
641 | 641 | |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | |
644 | 644 | // check CSRF for non-GET actions |
645 | 645 | $use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false'; |
646 | - if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
646 | + if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF()) |
|
647 | 647 | { |
648 | 648 | $this->error = 'msg_invalid_request'; |
649 | 649 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -655,11 +655,11 @@ discard block |
||
655 | 655 | |
656 | 656 | // SECISSUE also check foward act method |
657 | 657 | // check REQUEST_METHOD in controller |
658 | - if($type == 'controller') |
|
658 | + if ($type == 'controller') |
|
659 | 659 | { |
660 | 660 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
661 | 661 | |
662 | - if(!$allowedMethod) |
|
662 | + if (!$allowedMethod) |
|
663 | 663 | { |
664 | 664 | $allowedMethodList[0] = 'POST'; |
665 | 665 | } |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
669 | 669 | } |
670 | 670 | |
671 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
671 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
672 | 672 | { |
673 | 673 | $this->error = "msg_invalid_request"; |
674 | 674 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | } |
680 | 680 | } |
681 | 681 | |
682 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
682 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
683 | 683 | { |
684 | 684 | $orig_type = "view"; |
685 | 685 | $type = "mobile"; |
686 | 686 | // create a module instance |
687 | 687 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
688 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
688 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
689 | 689 | { |
690 | 690 | $type = $orig_type; |
691 | 691 | Mobile::setMobile(FALSE); |
@@ -697,25 +697,25 @@ discard block |
||
697 | 697 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
698 | 698 | } |
699 | 699 | |
700 | - if(!is_object($oModule)) |
|
700 | + if (!is_object($oModule)) |
|
701 | 701 | { |
702 | 702 | $this->_setInputErrorToContext(); |
703 | 703 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
704 | 704 | $oMessageObject->setError(-1); |
705 | 705 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
706 | 706 | $oMessageObject->dispMessage(); |
707 | - if($this->httpStatusCode) |
|
707 | + if ($this->httpStatusCode) |
|
708 | 708 | { |
709 | 709 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
710 | 710 | } |
711 | 711 | return $oMessageObject; |
712 | 712 | } |
713 | 713 | |
714 | - if($this->module == "admin" && $type == "view") |
|
714 | + if ($this->module == "admin" && $type == "view") |
|
715 | 715 | { |
716 | - if($logged_info->is_admin == 'Y') |
|
716 | + if ($logged_info->is_admin == 'Y') |
|
717 | 717 | { |
718 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
718 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
719 | 719 | { |
720 | 720 | $oAdminView = getAdminView('admin'); |
721 | 721 | $oAdminView->makeGnbUrl($forward->module); |
@@ -735,10 +735,10 @@ discard block |
||
735 | 735 | return $oMessageObject; |
736 | 736 | } |
737 | 737 | } |
738 | - if($kind == 'admin') |
|
738 | + if ($kind == 'admin') |
|
739 | 739 | { |
740 | 740 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
741 | - if(!$grant->manager) |
|
741 | + if (!$grant->manager) |
|
742 | 742 | { |
743 | 743 | $this->_setInputErrorToContext(); |
744 | 744 | $this->error = 'msg_is_not_manager'; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | } |
751 | 751 | else |
752 | 752 | { |
753 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
753 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
754 | 754 | { |
755 | 755 | $this->_setInputErrorToContext(); |
756 | 756 | $this->error = 'msg_is_not_administrator'; |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | } |
765 | 765 | } |
766 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
766 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
767 | 767 | { |
768 | 768 | $this->act = $xml_info->default_index_act; |
769 | 769 | } |
@@ -777,16 +777,16 @@ discard block |
||
777 | 777 | } |
778 | 778 | |
779 | 779 | // ruleset check... |
780 | - if(!empty($ruleset)) |
|
780 | + if (!empty($ruleset)) |
|
781 | 781 | { |
782 | 782 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
783 | 783 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
784 | - if(!empty($rulesetFile)) |
|
784 | + if (!empty($rulesetFile)) |
|
785 | 785 | { |
786 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
786 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
787 | 787 | { |
788 | 788 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
789 | - foreach($errorLang as $key => $val) |
|
789 | + foreach ($errorLang as $key => $val) |
|
790 | 790 | { |
791 | 791 | Context::setLang($key, $val); |
792 | 792 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | $Validator = new Validator($rulesetFile); |
797 | 797 | $result = $Validator->validate(); |
798 | - if(!$result) |
|
798 | + if (!$result) |
|
799 | 799 | { |
800 | 800 | $lastError = $Validator->getLastError(); |
801 | 801 | $returnUrl = Context::get('error_return_url'); |
@@ -827,26 +827,26 @@ discard block |
||
827 | 827 | 'dispLayoutPreviewWithModule' => 1 |
828 | 828 | ); |
829 | 829 | $db_use_mobile = Mobile::isMobileEnabled(); |
830 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
830 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
831 | 831 | { |
832 | 832 | global $lang; |
833 | 833 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
834 | - $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="' . getUrl('m', '1') . '">' . $lang->msg_pc_to_mobile . '</a></p></div>'; |
|
834 | + $footer = '<div class="xe_mobile"><p class="xe_mobile"><a class="xe_mobile" href="'.getUrl('m', '1').'">'.$lang->msg_pc_to_mobile.'</a></p></div>'; |
|
835 | 835 | Context::addHtmlHeader($header); |
836 | 836 | Context::addHtmlFooter($footer); |
837 | 837 | } |
838 | 838 | |
839 | - if(($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
839 | + if (($type == 'view' || $type == 'mobile') && $kind != 'admin') |
|
840 | 840 | { |
841 | 841 | $module_config = $oModuleModel->getModuleConfig('module'); |
842 | - if($module_config->htmlFooter) |
|
842 | + if ($module_config->htmlFooter) |
|
843 | 843 | { |
844 | 844 | Context::addHtmlFooter($module_config->htmlFooter); |
845 | 845 | } |
846 | - if($module_config->siteTitle) |
|
846 | + if ($module_config->siteTitle) |
|
847 | 847 | { |
848 | 848 | $siteTitle = Context::getBrowserTitle(); |
849 | - if(!$siteTitle) |
|
849 | + if (!$siteTitle) |
|
850 | 850 | { |
851 | 851 | Context::setBrowserTitle($module_config->siteTitle); |
852 | 852 | } |
@@ -863,18 +863,18 @@ discard block |
||
863 | 863 | $procResult = $oModule->proc(); |
864 | 864 | |
865 | 865 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
866 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
866 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
867 | 867 | { |
868 | 868 | $error = $oModule->getError(); |
869 | 869 | $message = $oModule->getMessage(); |
870 | 870 | $messageType = $oModule->getMessageType(); |
871 | 871 | $redirectUrl = $oModule->getRedirectUrl(); |
872 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
872 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
873 | 873 | |
874 | - if(!$procResult) |
|
874 | + if (!$procResult) |
|
875 | 875 | { |
876 | 876 | $this->error = $message; |
877 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
877 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
878 | 878 | { |
879 | 879 | $redirectUrl = Context::get('error_return_url'); |
880 | 880 | } |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | |
888 | 888 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
889 | 889 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
890 | - if($message != 'success') |
|
890 | + if ($message != 'success') |
|
891 | 891 | { |
892 | 892 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
893 | 893 | } |
894 | 894 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
895 | 895 | |
896 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
896 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
897 | 897 | { |
898 | 898 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
899 | 899 | } |
@@ -909,27 +909,27 @@ discard block |
||
909 | 909 | * */ |
910 | 910 | function _setInputErrorToContext() |
911 | 911 | { |
912 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
912 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
913 | 913 | { |
914 | 914 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
915 | 915 | } |
916 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
916 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
917 | 917 | { |
918 | 918 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
919 | 919 | } |
920 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
920 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
921 | 921 | { |
922 | 922 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
923 | 923 | } |
924 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
924 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
925 | 925 | { |
926 | 926 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
927 | 927 | } |
928 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
928 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
929 | 929 | { |
930 | 930 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
931 | 931 | } |
932 | - if(is_array($_SESSION['INPUT_ERROR']) && count($_SESSION['INPUT_ERROR'])) |
|
932 | + if (is_array($_SESSION['INPUT_ERROR']) && count($_SESSION['INPUT_ERROR'])) |
|
933 | 933 | { |
934 | 934 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
935 | 935 | } |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | { |
960 | 960 | $requestVars = Context::getRequestVars(); |
961 | 961 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
962 | - foreach($requestVars AS $key => $value) |
|
962 | + foreach ($requestVars AS $key => $value) |
|
963 | 963 | { |
964 | 964 | $_SESSION['INPUT_ERROR'][$key] = $value; |
965 | 965 | } |
@@ -973,41 +973,41 @@ discard block |
||
973 | 973 | function displayContent($oModule = NULL) |
974 | 974 | { |
975 | 975 | // If the module is not set or not an object, set error |
976 | - if(!$oModule || !is_object($oModule)) |
|
976 | + if (!$oModule || !is_object($oModule)) |
|
977 | 977 | { |
978 | 978 | $this->error = 'msg_module_is_not_exists'; |
979 | 979 | $this->httpStatusCode = '404'; |
980 | 980 | } |
981 | 981 | |
982 | 982 | // If connection to DB has a problem even though it's not install module, set error |
983 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
983 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
984 | 984 | { |
985 | 985 | $this->error = 'msg_dbconnect_failed'; |
986 | 986 | } |
987 | 987 | |
988 | 988 | // Call trigger after moduleHandler proc |
989 | 989 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
990 | - if(!$output->toBool()) |
|
990 | + if (!$output->toBool()) |
|
991 | 991 | { |
992 | 992 | $this->error = $output->getMessage(); |
993 | 993 | } |
994 | 994 | |
995 | 995 | // Use message view object, if HTML call |
996 | 996 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
997 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
997 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
998 | 998 | { |
999 | 999 | |
1000 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
1000 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
1001 | 1001 | { |
1002 | 1002 | $display_handler = new DisplayHandler(); |
1003 | 1003 | $display_handler->_debugOutput(); |
1004 | 1004 | |
1005 | - header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
1005 | + header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']); |
|
1006 | 1006 | return; |
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | // If error occurred, handle it |
1010 | - if($this->error) |
|
1010 | + if ($this->error) |
|
1011 | 1011 | { |
1012 | 1012 | // display content with message module instance |
1013 | 1013 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -1016,14 +1016,14 @@ discard block |
||
1016 | 1016 | $oMessageObject->setMessage($this->error); |
1017 | 1017 | $oMessageObject->dispMessage(); |
1018 | 1018 | |
1019 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1019 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
1020 | 1020 | { |
1021 | 1021 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
1022 | 1022 | $oMessageObject->setTemplateFile('http_status_code'); |
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | // If module was called normally, change the templates of the module into ones of the message view module |
1026 | - if($oModule) |
|
1026 | + if ($oModule) |
|
1027 | 1027 | { |
1028 | 1028 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
1029 | 1029 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | // Check if layout_srl exists for the module |
1041 | - if(Mobile::isFromMobilePhone()) |
|
1041 | + if (Mobile::isFromMobilePhone()) |
|
1042 | 1042 | { |
1043 | 1043 | $layout_srl = $oModule->module_info->mlayout_srl; |
1044 | 1044 | } |
@@ -1048,58 +1048,58 @@ discard block |
||
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | // if layout_srl is rollback by module, set default layout |
1051 | - if($layout_srl == -1) |
|
1051 | + if ($layout_srl == -1) |
|
1052 | 1052 | { |
1053 | 1053 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
1054 | 1054 | $oLayoutAdminModel = getAdminModel('layout'); |
1055 | 1055 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
1056 | 1056 | } |
1057 | 1057 | |
1058 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
1058 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
1059 | 1059 | { |
1060 | 1060 | |
1061 | 1061 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
1062 | 1062 | $oLayoutModel = getModel('layout'); |
1063 | 1063 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
1064 | - if($layout_info) |
|
1064 | + if ($layout_info) |
|
1065 | 1065 | { |
1066 | 1066 | |
1067 | 1067 | // Input extra_vars into $layout_info |
1068 | - if($layout_info->extra_var_count) |
|
1068 | + if ($layout_info->extra_var_count) |
|
1069 | 1069 | { |
1070 | 1070 | |
1071 | - foreach($layout_info->extra_var as $var_id => $val) |
|
1071 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
1072 | 1072 | { |
1073 | - if($val->type == 'image') |
|
1073 | + if ($val->type == 'image') |
|
1074 | 1074 | { |
1075 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1075 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
1076 | 1076 | { |
1077 | - $val->value = Context::getRequestUri() . substr($val->value, 2); |
|
1077 | + $val->value = Context::getRequestUri().substr($val->value, 2); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | $layout_info->{$var_id} = $val->value; |
1081 | 1081 | } |
1082 | 1082 | } |
1083 | 1083 | // Set menus into context |
1084 | - if($layout_info->menu_count) |
|
1084 | + if ($layout_info->menu_count) |
|
1085 | 1085 | { |
1086 | - foreach($layout_info->menu as $menu_id => $menu) |
|
1086 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
1087 | 1087 | { |
1088 | 1088 | // set default menu set(included home menu) |
1089 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
1089 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
1090 | 1090 | { |
1091 | 1091 | $oMenuAdminController = getAdminController('menu'); |
1092 | 1092 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
1093 | 1093 | |
1094 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
1094 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
1095 | 1095 | { |
1096 | 1096 | include($homeMenuCacheFile); |
1097 | 1097 | } |
1098 | 1098 | |
1099 | - if(!$menu->menu_srl) |
|
1099 | + if (!$menu->menu_srl) |
|
1100 | 1100 | { |
1101 | - $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
|
1102 | - $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
|
1101 | + $menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file); |
|
1102 | + $menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file); |
|
1103 | 1103 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
1104 | 1104 | } |
1105 | 1105 | else |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | $php_file = FileHandler::exists($menu->php_file); |
1113 | - if($php_file) |
|
1113 | + if ($php_file) |
|
1114 | 1114 | { |
1115 | 1115 | include($php_file); |
1116 | 1116 | } |
@@ -1126,17 +1126,17 @@ discard block |
||
1126 | 1126 | |
1127 | 1127 | // If layout was modified, use the modified version |
1128 | 1128 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
1129 | - if(file_exists($edited_layout)) |
|
1129 | + if (file_exists($edited_layout)) |
|
1130 | 1130 | { |
1131 | 1131 | $oModule->setEditedLayoutFile($edited_layout); |
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | } |
1135 | 1135 | $isLayoutDrop = Context::get('isLayoutDrop'); |
1136 | - if($isLayoutDrop) |
|
1136 | + if ($isLayoutDrop) |
|
1137 | 1137 | { |
1138 | 1138 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
1139 | - if($kind == 'admin') |
|
1139 | + if ($kind == 'admin') |
|
1140 | 1140 | { |
1141 | 1141 | $oModule->setLayoutFile('popup_layout'); |
1142 | 1142 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | function &getModuleInstance($module, $type = 'view', $kind = '') |
1175 | 1175 | { |
1176 | 1176 | |
1177 | - if(__DEBUG__ == 3) |
|
1177 | + if (__DEBUG__ == 3) |
|
1178 | 1178 | { |
1179 | 1179 | $start_time = getMicroTime(); |
1180 | 1180 | } |
@@ -1184,51 +1184,51 @@ discard block |
||
1184 | 1184 | $type = strtolower($type); |
1185 | 1185 | |
1186 | 1186 | $kinds = array('svc' => 1, 'admin' => 1); |
1187 | - if(!isset($kinds[$kind])) |
|
1187 | + if (!isset($kinds[$kind])) |
|
1188 | 1188 | { |
1189 | 1189 | $kind = 'svc'; |
1190 | 1190 | } |
1191 | 1191 | |
1192 | - $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
|
1192 | + $key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type; |
|
1193 | 1193 | |
1194 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1194 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1195 | 1195 | { |
1196 | 1196 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | // if there is no instance of the module in global variable, create a new one |
1200 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1200 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1201 | 1201 | { |
1202 | 1202 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1203 | 1203 | |
1204 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1204 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1205 | 1205 | { |
1206 | 1206 | $module = $parent_module; |
1207 | 1207 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | // Check if the base class and instance class exist |
1211 | - if(!class_exists($module, true)) |
|
1211 | + if (!class_exists($module, true)) |
|
1212 | 1212 | { |
1213 | 1213 | return NULL; |
1214 | 1214 | } |
1215 | - if(!class_exists($instance_name, true)) |
|
1215 | + if (!class_exists($instance_name, true)) |
|
1216 | 1216 | { |
1217 | 1217 | return NULL; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | // Create an instance |
1221 | 1221 | $oModule = new $instance_name(); |
1222 | - if(!is_object($oModule)) |
|
1222 | + if (!is_object($oModule)) |
|
1223 | 1223 | { |
1224 | 1224 | return NULL; |
1225 | 1225 | } |
1226 | 1226 | |
1227 | 1227 | // Load language files for the class |
1228 | - Context::loadLang($class_path . 'lang'); |
|
1229 | - if($extend_module) |
|
1228 | + Context::loadLang($class_path.'lang'); |
|
1229 | + if ($extend_module) |
|
1230 | 1230 | { |
1231 | - Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
|
1231 | + Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang'); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // Set variables to the instance |
@@ -1236,10 +1236,10 @@ discard block |
||
1236 | 1236 | $oModule->setModulePath($class_path); |
1237 | 1237 | |
1238 | 1238 | // If the module has a constructor, run it. |
1239 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1239 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1240 | 1240 | { |
1241 | 1241 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
1242 | - if(@method_exists($oModule, $instance_name)) |
|
1242 | + if (@method_exists($oModule, $instance_name)) |
|
1243 | 1243 | { |
1244 | 1244 | $oModule->{$instance_name}(); |
1245 | 1245 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
1250 | 1250 | } |
1251 | 1251 | |
1252 | - if(__DEBUG__ == 3) |
|
1252 | + if (__DEBUG__ == 3) |
|
1253 | 1253 | { |
1254 | 1254 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
1255 | 1255 | } |
@@ -1265,17 +1265,17 @@ discard block |
||
1265 | 1265 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
1266 | 1266 | $highClassFile = FileHandler::getRealPath($highClassFile); |
1267 | 1267 | |
1268 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
1269 | - if(!in_array($type, $types)) |
|
1268 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
1269 | + if (!in_array($type, $types)) |
|
1270 | 1270 | { |
1271 | 1271 | $type = $types[0]; |
1272 | 1272 | } |
1273 | - if($type == 'class') |
|
1273 | + if ($type == 'class') |
|
1274 | 1274 | { |
1275 | 1275 | $instanceName = '%s'; |
1276 | 1276 | $classFile = '%s%s.%s.php'; |
1277 | 1277 | } |
1278 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1278 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
1279 | 1279 | { |
1280 | 1280 | $instanceName = '%sAdmin%s'; |
1281 | 1281 | $classFile = '%s%s.admin.%s.php'; |
@@ -1300,26 +1300,26 @@ discard block |
||
1300 | 1300 | function triggerCall($trigger_name, $called_position, &$obj) |
1301 | 1301 | { |
1302 | 1302 | // skip if not installed |
1303 | - if(!Context::isInstalled()) |
|
1303 | + if (!Context::isInstalled()) |
|
1304 | 1304 | { |
1305 | 1305 | return new BaseObject(); |
1306 | 1306 | } |
1307 | 1307 | |
1308 | 1308 | $oModuleModel = getModel('module'); |
1309 | 1309 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
1310 | - if(!$triggers || count($triggers) < 1) |
|
1310 | + if (!$triggers || count($triggers) < 1) |
|
1311 | 1311 | { |
1312 | 1312 | return new BaseObject(); |
1313 | 1313 | } |
1314 | 1314 | |
1315 | 1315 | //store before trigger call time |
1316 | 1316 | $before_trigger_time = NULL; |
1317 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
1317 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
1318 | 1318 | { |
1319 | 1319 | $before_trigger_time = microtime(true); |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - foreach($triggers as $item) |
|
1322 | + foreach ($triggers as $item) |
|
1323 | 1323 | { |
1324 | 1324 | $module = $item->module; |
1325 | 1325 | $type = $item->type; |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | |
1328 | 1328 | // todo why don't we call a normal class object ? |
1329 | 1329 | $oModule = getModule($module, $type); |
1330 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
1330 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
1331 | 1331 | { |
1332 | 1332 | continue; |
1333 | 1333 | } |
@@ -1340,12 +1340,12 @@ discard block |
||
1340 | 1340 | $elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time; |
1341 | 1341 | |
1342 | 1342 | $slowlog = new stdClass; |
1343 | - $slowlog->caller = $trigger_name . '.' . $called_position; |
|
1344 | - $slowlog->called = $module . '.' . $called_method; |
|
1343 | + $slowlog->caller = $trigger_name.'.'.$called_position; |
|
1344 | + $slowlog->called = $module.'.'.$called_method; |
|
1345 | 1345 | $slowlog->called_extension = $module; |
1346 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1346 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1347 | 1347 | |
1348 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1348 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1349 | 1349 | { |
1350 | 1350 | return $output; |
1351 | 1351 | } |
@@ -1430,9 +1430,9 @@ discard block |
||
1430 | 1430 | '511' => 'Network Authentication Required', |
1431 | 1431 | ); |
1432 | 1432 | $statusMessage = $statusMessageList[$code]; |
1433 | - if(!$statusMessage) |
|
1433 | + if (!$statusMessage) |
|
1434 | 1434 | { |
1435 | - $statusMessage = 'HTTP ' . $code; |
|
1435 | + $statusMessage = 'HTTP '.$code; |
|
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | Context::set('http_status_code', $code); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $this->action = $action; |
109 | 109 | $this->priority = $priority; |
110 | 110 | |
111 | - if(!isset($tables)) |
|
111 | + if (!isset($tables)) |
|
112 | 112 | { |
113 | 113 | return; |
114 | 114 | } |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | function setColumnList($columnList) |
145 | 145 | { |
146 | 146 | $this->columnList = $columnList; |
147 | - if(is_array($this->columnList) && count($this->columnList) > 0) |
|
147 | + if (is_array($this->columnList) && count($this->columnList) > 0) |
|
148 | 148 | { |
149 | 149 | $selectColumns = array(); |
150 | 150 | $dbParser = DB::getParser(); |
151 | 151 | |
152 | - foreach($this->columnList as $columnName) |
|
152 | + foreach ($this->columnList as $columnName) |
|
153 | 153 | { |
154 | 154 | $columnName = $dbParser->escapeColumn($columnName); |
155 | 155 | $selectColumns[] = new SelectExpression($columnName); |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | |
162 | 162 | function setColumns($columns) |
163 | 163 | { |
164 | - if(!isset($columns) || (is_array($columns) && count($columns) === 0)) |
|
164 | + if (!isset($columns) || (is_array($columns) && count($columns) === 0)) |
|
165 | 165 | { |
166 | 166 | $this->columns = array(new StarExpression()); |
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - if(!is_array($columns)) |
|
170 | + if (!is_array($columns)) |
|
171 | 171 | { |
172 | 172 | $columns = array($columns); |
173 | 173 | } |
@@ -177,14 +177,14 @@ discard block |
||
177 | 177 | |
178 | 178 | function setTables($tables) |
179 | 179 | { |
180 | - if(!isset($tables) || (is_array($tables) && count($tables) === 0)) |
|
180 | + if (!isset($tables) || (is_array($tables) && count($tables) === 0)) |
|
181 | 181 | { |
182 | 182 | $this->setError(TRUE); |
183 | 183 | $this->setMessage("You must provide at least one table for the query."); |
184 | 184 | return; |
185 | 185 | } |
186 | 186 | |
187 | - if(!is_array($tables)) |
|
187 | + if (!is_array($tables)) |
|
188 | 188 | { |
189 | 189 | $tables = array($tables); |
190 | 190 | } |
@@ -200,18 +200,18 @@ discard block |
||
200 | 200 | function setConditions($conditions) |
201 | 201 | { |
202 | 202 | $this->conditions = array(); |
203 | - if(!isset($conditions) || (is_array($conditions) && count($conditions) === 0)) |
|
203 | + if (!isset($conditions) || (is_array($conditions) && count($conditions) === 0)) |
|
204 | 204 | { |
205 | 205 | return; |
206 | 206 | } |
207 | - if(!is_array($conditions)) |
|
207 | + if (!is_array($conditions)) |
|
208 | 208 | { |
209 | 209 | $conditions = array($conditions); |
210 | 210 | } |
211 | 211 | |
212 | - foreach($conditions as $conditionGroup) |
|
212 | + foreach ($conditions as $conditionGroup) |
|
213 | 213 | { |
214 | - if($conditionGroup->show()) |
|
214 | + if ($conditionGroup->show()) |
|
215 | 215 | { |
216 | 216 | $this->conditions[] = $conditionGroup; |
217 | 217 | } |
@@ -220,11 +220,11 @@ discard block |
||
220 | 220 | |
221 | 221 | function setGroups($groups) |
222 | 222 | { |
223 | - if(!isset($groups) || (is_array($groups) && count($groups) === 0)) |
|
223 | + if (!isset($groups) || (is_array($groups) && count($groups) === 0)) |
|
224 | 224 | { |
225 | 225 | return; |
226 | 226 | } |
227 | - if(!is_array($groups)) |
|
227 | + if (!is_array($groups)) |
|
228 | 228 | { |
229 | 229 | $groups = array($groups); |
230 | 230 | } |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | |
235 | 235 | function setOrder($order) |
236 | 236 | { |
237 | - if(!isset($order) || (is_array($order) && count($order) === 0)) |
|
237 | + if (!isset($order) || (is_array($order) && count($order) === 0)) |
|
238 | 238 | { |
239 | 239 | return; |
240 | 240 | } |
241 | - if(!is_array($order)) |
|
241 | + if (!is_array($order)) |
|
242 | 242 | { |
243 | 243 | $order = array($order); |
244 | 244 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | function setLimit($limit = NULL) |
255 | 255 | { |
256 | - if(!isset($limit)) |
|
256 | + if (!isset($limit)) |
|
257 | 257 | { |
258 | 258 | return; |
259 | 259 | } |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | function getClickCountColumns() |
355 | 355 | { |
356 | 356 | $click_count_columns = array(); |
357 | - foreach($this->columns as $column) |
|
357 | + foreach ($this->columns as $column) |
|
358 | 358 | { |
359 | - if($column->show() && is_a($column, 'ClickCountExpression')) |
|
359 | + if ($column->show() && is_a($column, 'ClickCountExpression')) |
|
360 | 360 | { |
361 | 361 | $click_count_columns[] = $column; |
362 | 362 | } |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | */ |
372 | 372 | function getSelectString($with_values = TRUE) |
373 | 373 | { |
374 | - foreach($this->columns as $column) |
|
374 | + foreach ($this->columns as $column) |
|
375 | 375 | { |
376 | - if($column->show()) |
|
376 | + if ($column->show()) |
|
377 | 377 | { |
378 | - if($column->isSubquery()) |
|
378 | + if ($column->isSubquery()) |
|
379 | 379 | { |
380 | - $select[] = $column->toString($with_values) . ' as ' . $column->getAlias(); |
|
380 | + $select[] = $column->toString($with_values).' as '.$column->getAlias(); |
|
381 | 381 | } |
382 | 382 | else |
383 | 383 | { |
@@ -395,15 +395,15 @@ discard block |
||
395 | 395 | */ |
396 | 396 | function getUpdateString($with_values = TRUE) |
397 | 397 | { |
398 | - foreach($this->columns as $column) |
|
398 | + foreach ($this->columns as $column) |
|
399 | 399 | { |
400 | - if($column->show()) |
|
400 | + if ($column->show()) |
|
401 | 401 | { |
402 | 402 | $update[] = $column->getExpression($with_values); |
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | - if(!$update) return; |
|
406 | + if (!$update) return; |
|
407 | 407 | return trim(implode($update, ', ')); |
408 | 408 | } |
409 | 409 | |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | { |
417 | 417 | $columnsList = ''; |
418 | 418 | // means we have insert-select |
419 | - if($this->subquery) |
|
419 | + if ($this->subquery) |
|
420 | 420 | { |
421 | - foreach($this->columns as $column) |
|
421 | + foreach ($this->columns as $column) |
|
422 | 422 | { |
423 | - $columnsList .= $column->getColumnName() . ', '; |
|
423 | + $columnsList .= $column->getColumnName().', '; |
|
424 | 424 | } |
425 | 425 | $columnsList = substr($columnsList, 0, -2); |
426 | 426 | $selectStatement = $this->subquery->toString($with_values); |
@@ -429,12 +429,12 @@ discard block |
||
429 | 429 | } |
430 | 430 | |
431 | 431 | $valuesList = ''; |
432 | - foreach($this->columns as $column) |
|
432 | + foreach ($this->columns as $column) |
|
433 | 433 | { |
434 | - if($column->show()) |
|
434 | + if ($column->show()) |
|
435 | 435 | { |
436 | - $columnsList .= $column->getColumnName() . ', '; |
|
437 | - $valuesList .= $column->getValue($with_values) . ', '; |
|
436 | + $columnsList .= $column->getColumnName().', '; |
|
437 | + $valuesList .= $column->getValue($with_values).', '; |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | $columnsList = substr($columnsList, 0, -2); |
@@ -460,25 +460,25 @@ discard block |
||
460 | 460 | { |
461 | 461 | $from = ''; |
462 | 462 | $simple_table_count = 0; |
463 | - foreach($this->tables as $table) |
|
463 | + foreach ($this->tables as $table) |
|
464 | 464 | { |
465 | - if($table->isJoinTable() || !$simple_table_count) |
|
465 | + if ($table->isJoinTable() || !$simple_table_count) |
|
466 | 466 | { |
467 | - $from .= $table->toString($with_values) . ' '; |
|
467 | + $from .= $table->toString($with_values).' '; |
|
468 | 468 | } |
469 | 469 | else |
470 | 470 | { |
471 | - $from .= ', ' . $table->toString($with_values) . ' '; |
|
471 | + $from .= ', '.$table->toString($with_values).' '; |
|
472 | 472 | } |
473 | 473 | |
474 | - if(is_a($table, 'Subquery')) |
|
474 | + if (is_a($table, 'Subquery')) |
|
475 | 475 | { |
476 | - $from .= $table->getAlias() ? ' as ' . $table->getAlias() . ' ' : ' '; |
|
476 | + $from .= $table->getAlias() ? ' as '.$table->getAlias().' ' : ' '; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $simple_table_count++; |
480 | 480 | } |
481 | - if(trim($from) == '') |
|
481 | + if (trim($from) == '') |
|
482 | 482 | { |
483 | 483 | return ''; |
484 | 484 | } |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | $where = ''; |
497 | 497 | $condition_count = 0; |
498 | 498 | |
499 | - foreach($this->conditions as $conditionGroup) |
|
499 | + foreach ($this->conditions as $conditionGroup) |
|
500 | 500 | { |
501 | - if($condition_count === 0) |
|
501 | + if ($condition_count === 0) |
|
502 | 502 | { |
503 | 503 | $conditionGroup->setPipe(""); |
504 | 504 | } |
@@ -507,26 +507,26 @@ discard block |
||
507 | 507 | $condition_count++; |
508 | 508 | } |
509 | 509 | |
510 | - if($with_optimization && |
|
510 | + if ($with_optimization && |
|
511 | 511 | (strstr($this->getOrderByString(), 'list_order') || strstr($this->getOrderByString(), 'update_order'))) |
512 | 512 | { |
513 | 513 | |
514 | - if($condition_count !== 0) |
|
514 | + if ($condition_count !== 0) |
|
515 | 515 | { |
516 | - $where = '(' . $where . ') '; |
|
516 | + $where = '('.$where.') '; |
|
517 | 517 | } |
518 | 518 | |
519 | - foreach($this->orderby as $order) |
|
519 | + foreach ($this->orderby as $order) |
|
520 | 520 | { |
521 | 521 | $colName = $order->getColumnName(); |
522 | - if(strstr($colName, 'list_order') || strstr($colName, 'update_order')) |
|
522 | + if (strstr($colName, 'list_order') || strstr($colName, 'update_order')) |
|
523 | 523 | { |
524 | 524 | $opt_condition = new ConditionWithoutArgument($colName, 2100000000, 'less', 'and'); |
525 | - if($condition_count === 0) |
|
525 | + if ($condition_count === 0) |
|
526 | 526 | { |
527 | 527 | $opt_condition->setPipe(""); |
528 | 528 | } |
529 | - $where .= $opt_condition->toString($with_values) . ' '; |
|
529 | + $where .= $opt_condition->toString($with_values).' '; |
|
530 | 530 | $condition_count++; |
531 | 531 | } |
532 | 532 | } |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | function getGroupByString() |
543 | 543 | { |
544 | 544 | $groupBy = ''; |
545 | - if($this->groups) |
|
545 | + if ($this->groups) |
|
546 | 546 | { |
547 | - if($this->groups[0] !== "") |
|
547 | + if ($this->groups[0] !== "") |
|
548 | 548 | { |
549 | 549 | $groupBy = implode(', ', $this->groups); |
550 | 550 | } |
@@ -558,16 +558,16 @@ discard block |
||
558 | 558 | */ |
559 | 559 | function getOrderByString() |
560 | 560 | { |
561 | - if(!$this->_orderByString) |
|
561 | + if (!$this->_orderByString) |
|
562 | 562 | { |
563 | - if(!is_array($this->orderby) || count($this->orderby) === 0) |
|
563 | + if (!is_array($this->orderby) || count($this->orderby) === 0) |
|
564 | 564 | { |
565 | 565 | return ''; |
566 | 566 | } |
567 | 567 | $orderBy = ''; |
568 | - foreach($this->orderby as $order) |
|
568 | + foreach ($this->orderby as $order) |
|
569 | 569 | { |
570 | - $orderBy .= $order->toString() . ', '; |
|
570 | + $orderBy .= $order->toString().', '; |
|
571 | 571 | } |
572 | 572 | $orderBy = substr($orderBy, 0, -2); |
573 | 573 | $this->_orderByString = $orderBy; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | function getLimitString() |
588 | 588 | { |
589 | 589 | $limit = ''; |
590 | - if($this->limit) |
|
590 | + if ($this->limit) |
|
591 | 591 | { |
592 | 592 | $limit = ''; |
593 | 593 | $limit .= $this->limit->toString(); |
@@ -606,19 +606,19 @@ discard block |
||
606 | 606 | */ |
607 | 607 | function getArguments() |
608 | 608 | { |
609 | - if(!isset($this->arguments)) |
|
609 | + if (!isset($this->arguments)) |
|
610 | 610 | { |
611 | 611 | $this->arguments = array(); |
612 | 612 | |
613 | 613 | // Join table arguments |
614 | - if(is_array($this->tables) && count($this->tables) > 0) |
|
614 | + if (is_array($this->tables) && count($this->tables) > 0) |
|
615 | 615 | { |
616 | - foreach($this->tables as $table) |
|
616 | + foreach ($this->tables as $table) |
|
617 | 617 | { |
618 | - if($table->isJoinTable() || is_a($table, 'Subquery')) |
|
618 | + if ($table->isJoinTable() || is_a($table, 'Subquery')) |
|
619 | 619 | { |
620 | 620 | $args = $table->getArguments(); |
621 | - if($args) |
|
621 | + if ($args) |
|
622 | 622 | { |
623 | 623 | $this->arguments = array_merge($this->arguments, $args); |
624 | 624 | } |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | |
629 | 629 | // Column arguments |
630 | 630 | // The if is for delete statements, all others must have columns |
631 | - if(is_array($this->columns) && count($this->columns) > 0) |
|
631 | + if (is_array($this->columns) && count($this->columns) > 0) |
|
632 | 632 | { |
633 | - foreach($this->columns as $column) |
|
633 | + foreach ($this->columns as $column) |
|
634 | 634 | { |
635 | - if($column->show()) |
|
635 | + if ($column->show()) |
|
636 | 636 | { |
637 | 637 | $args = $column->getArguments(); |
638 | - if($args) |
|
638 | + if ($args) |
|
639 | 639 | { |
640 | 640 | $this->arguments = array_merge($this->arguments, $args); |
641 | 641 | } |
@@ -644,12 +644,12 @@ discard block |
||
644 | 644 | } |
645 | 645 | |
646 | 646 | // Condition arguments |
647 | - if(is_array($this->conditions) && count($this->conditions) > 0) |
|
647 | + if (is_array($this->conditions) && count($this->conditions) > 0) |
|
648 | 648 | { |
649 | - foreach($this->conditions as $conditionGroup) |
|
649 | + foreach ($this->conditions as $conditionGroup) |
|
650 | 650 | { |
651 | 651 | $args = $conditionGroup->getArguments(); |
652 | - if(count($args) > 0) |
|
652 | + if (count($args) > 0) |
|
653 | 653 | { |
654 | 654 | $this->arguments = array_merge($this->arguments, $args); |
655 | 655 | } |
@@ -657,12 +657,12 @@ discard block |
||
657 | 657 | } |
658 | 658 | |
659 | 659 | // Navigation arguments |
660 | - if(is_array($this->orderby) && count($this->orderby) > 0) |
|
660 | + if (is_array($this->orderby) && count($this->orderby) > 0) |
|
661 | 661 | { |
662 | - foreach($this->orderby as $order) |
|
662 | + foreach ($this->orderby as $order) |
|
663 | 663 | { |
664 | 664 | $args = $order->getArguments(); |
665 | - if(count($args) > 0) |
|
665 | + if (count($args) > 0) |
|
666 | 666 | { |
667 | 667 | $this->arguments = array_merge($this->arguments, $args); |
668 | 668 | } |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function isIDExists($id, $site_srl = 0) |
21 | 21 | { |
22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
22 | + if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true; |
|
23 | 23 | // directory and rss/atom/api reserved checking, etc. |
24 | 24 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 25 | $dirs[] = 'rss'; |
26 | 26 | $dirs[] = 'atom'; |
27 | 27 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
28 | + if (in_array($id, $dirs)) return true; |
|
29 | 29 | // mid test |
30 | 30 | $args = new stdClass(); |
31 | 31 | $args->mid = $id; |
32 | 32 | $args->site_srl = $site_srl; |
33 | 33 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
34 | + if ($output->data->count) return true; |
|
35 | 35 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | - if(!$site_srl) |
|
36 | + if (!$site_srl) |
|
37 | 37 | { |
38 | 38 | $site_args = new stdClass(); |
39 | 39 | $site_args->domain = $id; |
40 | 40 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
41 | + if ($output->data->count) return true; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | return false; |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | function getDefaultMid() |
83 | 83 | { |
84 | 84 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
85 | + if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
86 | 86 | |
87 | 87 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
88 | + if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
89 | 89 | |
90 | 90 | $default_url_parse = parse_url($default_url); |
91 | 91 | $request_url_parse = parse_url($request_url); |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | // Set up |
96 | 96 | $domain = ''; |
97 | 97 | $site_info = NULL; |
98 | - if($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
98 | + if ($default_url && $default_url_parse['host'] != $request_url_parse['host']) |
|
99 | 99 | { |
100 | 100 | $hostname = $request_url_parse['host']; |
101 | 101 | $path = $request_url_parse['path']; |
102 | 102 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
103 | + if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
104 | 104 | |
105 | - $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
|
105 | + $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path); |
|
106 | 106 | } |
107 | 107 | |
108 | - if($domain === '') |
|
108 | + if ($domain === '') |
|
109 | 109 | { |
110 | - if(!$vid) $vid = $mid; |
|
111 | - if($vid) |
|
110 | + if (!$vid) $vid = $mid; |
|
111 | + if ($vid) |
|
112 | 112 | { |
113 | 113 | $domain = $vid; |
114 | 114 | } |
@@ -116,89 +116,89 @@ discard block |
||
116 | 116 | |
117 | 117 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
118 | 118 | // If domain is set, look for subsite |
119 | - if($domain !== '') |
|
119 | + if ($domain !== '') |
|
120 | 120 | { |
121 | 121 | $site_info = false; |
122 | - if($oCacheHandler->isSupport()) |
|
122 | + if ($oCacheHandler->isSupport()) |
|
123 | 123 | { |
124 | - $object_key = 'site_info:' . md5($domain); |
|
124 | + $object_key = 'site_info:'.md5($domain); |
|
125 | 125 | $domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
126 | 126 | $site_info = $oCacheHandler->get($domain_cache_key); |
127 | 127 | } |
128 | 128 | |
129 | - if($site_info === false) |
|
129 | + if ($site_info === false) |
|
130 | 130 | { |
131 | 131 | $args = new stdClass(); |
132 | 132 | $args->domain = $domain; |
133 | 133 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 134 | $site_info = $output->data; |
135 | 135 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
136 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
137 | 137 | } |
138 | 138 | |
139 | - if($site_info && $vid) |
|
139 | + if ($site_info && $vid) |
|
140 | 140 | { |
141 | 141 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
142 | + if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true); |
|
143 | 143 | } |
144 | - if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
144 | + if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | // If no virtual website was found, get default website |
148 | - if($domain === '') |
|
148 | + if ($domain === '') |
|
149 | 149 | { |
150 | 150 | $site_info = false; |
151 | - if($oCacheHandler->isSupport()) |
|
151 | + if ($oCacheHandler->isSupport()) |
|
152 | 152 | { |
153 | 153 | $object_key = 'default_site'; |
154 | 154 | $default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
155 | 155 | $site_info = $oCacheHandler->get($default_site_cache_key); |
156 | 156 | } |
157 | 157 | |
158 | - if($site_info === false) |
|
158 | + if ($site_info === false) |
|
159 | 159 | { |
160 | 160 | $args = new stdClass(); |
161 | 161 | $args->site_srl = 0; |
162 | 162 | $output = executeQuery('module.getSiteInfo', $args); |
163 | 163 | // Update the related informaion if there is no default site info |
164 | - if(!$output->data) |
|
164 | + if (!$output->data) |
|
165 | 165 | { |
166 | 166 | // Create a table if sites table doesn't exist |
167 | 167 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
168 | + if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | + if (!$oDB->isTableExists('sites')) return; |
|
170 | 170 | |
171 | 171 | // Get mid, language |
172 | 172 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
173 | 173 | $db_info = Context::getDBInfo(); |
174 | 174 | $domain = Context::getDefaultUrl(); |
175 | 175 | $url_info = parse_url($domain); |
176 | - $domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path']; |
|
176 | + $domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path']; |
|
177 | 177 | |
178 | 178 | $site_args = new stdClass; |
179 | 179 | $site_args->site_srl = 0; |
180 | - $site_args->index_module_srl = $mid_output->data->module_srl; |
|
180 | + $site_args->index_module_srl = $mid_output->data->module_srl; |
|
181 | 181 | $site_args->domain = $domain; |
182 | 182 | $site_args->default_language = $db_info->lang_type; |
183 | 183 | |
184 | - if($output->data && !$output->data->index_module_srl) |
|
184 | + if ($output->data && !$output->data->index_module_srl) |
|
185 | 185 | { |
186 | 186 | $output = executeQuery('module.updateSite', $site_args); |
187 | 187 | } |
188 | 188 | else |
189 | 189 | { |
190 | 190 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
191 | + if (!$output->toBool()) return $output; |
|
192 | 192 | } |
193 | 193 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 194 | } |
195 | 195 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
196 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
200 | + if (!$site_info->module_srl) return $site_info; |
|
201 | + if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
202 | 202 | return $this->addModuleExtraVars($site_info); |
203 | 203 | } |
204 | 204 | |
@@ -207,48 +207,48 @@ discard block |
||
207 | 207 | */ |
208 | 208 | function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array()) |
209 | 209 | { |
210 | - if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
210 | + if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid))) |
|
211 | 211 | { |
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
215 | 215 | $args = new stdClass(); |
216 | 216 | $args->mid = $mid; |
217 | - $args->site_srl = (int)$site_srl; |
|
217 | + $args->site_srl = (int) $site_srl; |
|
218 | 218 | |
219 | 219 | $module_srl = false; |
220 | 220 | $module_info = false; |
221 | 221 | |
222 | 222 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
223 | - if($oCacheHandler->isSupport()) |
|
223 | + if ($oCacheHandler->isSupport()) |
|
224 | 224 | { |
225 | 225 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
226 | 226 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
227 | 227 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
228 | - if($module_srl) |
|
228 | + if ($module_srl) |
|
229 | 229 | { |
230 | - $object_key = 'mid_info:' . $module_srl; |
|
230 | + $object_key = 'mid_info:'.$module_srl; |
|
231 | 231 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
232 | 232 | $module_info = $oCacheHandler->get($module_info_cache_key); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - if($module_info === false) |
|
236 | + if ($module_info === false) |
|
237 | 237 | { |
238 | 238 | $output = executeQuery('module.getMidInfo', $args); |
239 | 239 | $module_info = $output->data; |
240 | - if($oCacheHandler->isSupport()) |
|
240 | + if ($oCacheHandler->isSupport()) |
|
241 | 241 | { |
242 | 242 | $oCacheHandler->put($module_srl_cache_key, $module_info->module_srl); |
243 | 243 | |
244 | - $object_key = 'mid_info:' . $module_info->module_srl; |
|
244 | + $object_key = 'mid_info:'.$module_info->module_srl; |
|
245 | 245 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
246 | 246 | $oCacheHandler->put($module_info_cache_key, $module_info); |
247 | 247 | } |
248 | 248 | } |
249 | 249 | |
250 | 250 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
251 | + if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
252 | 252 | return $this->addModuleExtraVars($module_info); |
253 | 253 | } |
254 | 254 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $menuItemSrl = Context::get('menu_item_srl'); |
265 | 265 | $menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl; |
266 | 266 | |
267 | - if(!$menuItemSrl) |
|
267 | + if (!$menuItemSrl) |
|
268 | 268 | { |
269 | 269 | $this->stop(-1, 'msg_invalid_request'); |
270 | 270 | return; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $args = new stdClass(); |
274 | 274 | $args->menu_item_srl = $menuItemSrl; |
275 | 275 | $output = executeQuery('module.getModuleInfoByMenuItemSrl', $args); |
276 | - if(!$output->toBool()) |
|
276 | + if (!$output->toBool()) |
|
277 | 277 | { |
278 | 278 | return $output; |
279 | 279 | } |
@@ -297,12 +297,12 @@ discard block |
||
297 | 297 | $layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL; |
298 | 298 | $skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc); |
299 | 299 | $skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins'); |
300 | - if(!$skinInfoPc) |
|
300 | + if (!$skinInfoPc) |
|
301 | 301 | { |
302 | 302 | $skinInfoPc = new stdClass(); |
303 | 303 | $skinInfoPc->title = $skinNamePc; |
304 | 304 | } |
305 | - if(!$skinInfoMobile) |
|
305 | + if (!$skinInfoMobile) |
|
306 | 306 | { |
307 | 307 | $skinInfoMobile = new stdClass(); |
308 | 308 | $skinInfoMobile->title = $skinNameMobile; |
@@ -321,23 +321,23 @@ discard block |
||
321 | 321 | $mid_info = false; |
322 | 322 | |
323 | 323 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
324 | - if($oCacheHandler->isSupport()) |
|
324 | + if ($oCacheHandler->isSupport()) |
|
325 | 325 | { |
326 | 326 | $object_key = 'module_srl:'.$mid.'_'.$site_srl; |
327 | 327 | $module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
328 | 328 | $module_srl = $oCacheHandler->get($module_srl_cache_key); |
329 | - if($module_srl) |
|
329 | + if ($module_srl) |
|
330 | 330 | { |
331 | - $object_key = 'mid_info:' . $module_srl; |
|
331 | + $object_key = 'mid_info:'.$module_srl; |
|
332 | 332 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
333 | 333 | $mid_info = $oCacheHandler->get($module_info_cache_key); |
334 | 334 | } |
335 | 335 | |
336 | - if($mid_info === false) |
|
336 | + if ($mid_info === false) |
|
337 | 337 | { |
338 | 338 | $oCacheHandler->put($module_srl_cache_key, $output->data->module_srl); |
339 | 339 | |
340 | - $object_key = 'mid_info:' . $output->data->module_srl; |
|
340 | + $object_key = 'mid_info:'.$output->data->module_srl; |
|
341 | 341 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 342 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | 343 | } |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $moduleInfo = $this->addModuleExtraVars($moduleInfo); |
352 | 352 | |
353 | - if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
353 | + if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE') |
|
354 | 354 | { |
355 | 355 | unset($moduleInfo->skin); |
356 | 356 | unset($moduleInfo->mskin); |
@@ -369,32 +369,32 @@ discard block |
||
369 | 369 | $mid_info = false; |
370 | 370 | |
371 | 371 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
372 | - if($oCacheHandler->isSupport()) |
|
372 | + if ($oCacheHandler->isSupport()) |
|
373 | 373 | { |
374 | - $object_key = 'mid_info:' . $module_srl; |
|
374 | + $object_key = 'mid_info:'.$module_srl; |
|
375 | 375 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
376 | 376 | $mid_info = $oCacheHandler->get($cache_key); |
377 | 377 | } |
378 | 378 | |
379 | - if($mid_info === false) |
|
379 | + if ($mid_info === false) |
|
380 | 380 | { |
381 | 381 | // Get data |
382 | 382 | $args = new stdClass(); |
383 | 383 | $args->module_srl = $module_srl; |
384 | 384 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
385 | + if (!$output->toBool()) return; |
|
386 | 386 | |
387 | 387 | $mid_info = $output->data; |
388 | 388 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
389 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
390 | 390 | } |
391 | 391 | |
392 | - if($mid_info && count($columnList)) |
|
392 | + if ($mid_info && count($columnList)) |
|
393 | 393 | { |
394 | 394 | $module_info = new stdClass(); |
395 | - foreach($mid_info as $key => $item) |
|
395 | + foreach ($mid_info as $key => $item) |
|
396 | 396 | { |
397 | - if(in_array($key, $columnList)) |
|
397 | + if (in_array($key, $columnList)) |
|
398 | 398 | { |
399 | 399 | $module_info->$key = $item; |
400 | 400 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | */ |
416 | 416 | private function applyDefaultSkin(&$moduleInfo) |
417 | 417 | { |
418 | - if($moduleInfo->is_skin_fix == 'N') |
|
418 | + if ($moduleInfo->is_skin_fix == 'N') |
|
419 | 419 | { |
420 | 420 | $moduleInfo->skin = '/USE_DEFAULT/'; |
421 | 421 | } |
422 | 422 | |
423 | - if($moduleInfo->is_mskin_fix == 'N') |
|
423 | + if ($moduleInfo->is_mskin_fix == 'N') |
|
424 | 424 | { |
425 | 425 | $moduleInfo->mskin = '/USE_DEFAULT/'; |
426 | 426 | } |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $count = count($output->data); |
439 | 439 | |
440 | 440 | $modules = array(); |
441 | - for($i=0;$i<$count;$i++) |
|
441 | + for ($i = 0; $i < $count; $i++) |
|
442 | 442 | { |
443 | 443 | $modules[] = $output->data[$i]; |
444 | 444 | } |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | */ |
451 | 451 | function getModulesInfo($module_srls, $columnList = array()) |
452 | 452 | { |
453 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
453 | + if (is_array($module_srls)) $module_srls = implode(',', $module_srls); |
|
454 | 454 | $args = new stdClass(); |
455 | 455 | $args->module_srls = $module_srls; |
456 | 456 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
457 | - if(!$output->toBool()) return; |
|
457 | + if (!$output->toBool()) return; |
|
458 | 458 | return $this->addModuleExtraVars($output->data); |
459 | 459 | } |
460 | 460 | |
@@ -464,31 +464,31 @@ discard block |
||
464 | 464 | function addModuleExtraVars($module_info) |
465 | 465 | { |
466 | 466 | // Process although one or more module informaion is requested |
467 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
467 | + if (!is_array($module_info)) $target_module_info = array($module_info); |
|
468 | 468 | else $target_module_info = $module_info; |
469 | 469 | // Get module_srl |
470 | 470 | $module_srls = array(); |
471 | - foreach($target_module_info as $key => $val) |
|
471 | + foreach ($target_module_info as $key => $val) |
|
472 | 472 | { |
473 | 473 | $module_srl = $val->module_srl; |
474 | - if(!$module_srl) continue; |
|
474 | + if (!$module_srl) continue; |
|
475 | 475 | $module_srls[] = $val->module_srl; |
476 | 476 | } |
477 | 477 | // Extract extra information of the module and skin |
478 | 478 | $extra_vars = $this->getModuleExtraVars($module_srls); |
479 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
479 | + if (!count($module_srls) || !count($extra_vars)) return $module_info; |
|
480 | 480 | |
481 | - foreach($target_module_info as $key => $val) |
|
481 | + foreach ($target_module_info as $key => $val) |
|
482 | 482 | { |
483 | - if(!$extra_vars[$val->module_srl] || !count(get_object_vars($extra_vars[$val->module_srl]))) continue; |
|
484 | - foreach($extra_vars[$val->module_srl] as $k => $v) |
|
483 | + if (!$extra_vars[$val->module_srl] || !count(get_object_vars($extra_vars[$val->module_srl]))) continue; |
|
484 | + foreach ($extra_vars[$val->module_srl] as $k => $v) |
|
485 | 485 | { |
486 | - if($target_module_info[$key]->{$k}) continue; |
|
486 | + if ($target_module_info[$key]->{$k}) continue; |
|
487 | 487 | $target_module_info[$key]->{$k} = $v; |
488 | 488 | } |
489 | 489 | } |
490 | 490 | |
491 | - if(is_array($module_info)) return $target_module_info; |
|
491 | + if (is_array($module_info)) return $target_module_info; |
|
492 | 492 | return $target_module_info[0]; |
493 | 493 | } |
494 | 494 | |
@@ -499,37 +499,37 @@ discard block |
||
499 | 499 | { |
500 | 500 | $list = false; |
501 | 501 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
502 | - if($oCacheHandler->isSupport()) |
|
502 | + if ($oCacheHandler->isSupport()) |
|
503 | 503 | { |
504 | - if(count($args) === 1 && isset($args->site_srl)) |
|
504 | + if (count($args) === 1 && isset($args->site_srl)) |
|
505 | 505 | { |
506 | - $object_key = 'module:mid_list_' . $args->site_srl; |
|
506 | + $object_key = 'module:mid_list_'.$args->site_srl; |
|
507 | 507 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
508 | 508 | $list = $oCacheHandler->get($cache_key); |
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
512 | - if($list === false) |
|
512 | + if ($list === false) |
|
513 | 513 | { |
514 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
514 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
515 | 515 | { |
516 | 516 | $columnList = array(); |
517 | 517 | } |
518 | 518 | |
519 | 519 | $output = executeQuery('module.getMidList', $args, $columnList); |
520 | - if(!$output->toBool()) return $output; |
|
520 | + if (!$output->toBool()) return $output; |
|
521 | 521 | $list = $output->data; |
522 | 522 | |
523 | - if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
523 | + if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
|
524 | 524 | { |
525 | 525 | $oCacheHandler->put($cache_key, $list); |
526 | 526 | } |
527 | 527 | } |
528 | - if(!$list) return; |
|
528 | + if (!$list) return; |
|
529 | 529 | |
530 | - if(!is_array($list)) $list = array($list); |
|
530 | + if (!is_array($list)) $list = array($list); |
|
531 | 531 | |
532 | - foreach($list as $val) |
|
532 | + foreach ($list as $val) |
|
533 | 533 | { |
534 | 534 | $mid_list[$val->mid] = $val; |
535 | 535 | } |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | function getModuleSrlList($args = null, $columnList = array()) |
544 | 544 | { |
545 | 545 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
546 | - if(!$output->toBool()) return $output; |
|
546 | + if (!$output->toBool()) return $output; |
|
547 | 547 | |
548 | 548 | $list = $output->data; |
549 | - if(!$list) return; |
|
549 | + if (!$list) return; |
|
550 | 550 | |
551 | 551 | return $list; |
552 | 552 | } |
@@ -556,22 +556,22 @@ discard block |
||
556 | 556 | */ |
557 | 557 | function getModuleSrlByMid($mid) |
558 | 558 | { |
559 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
560 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
559 | + if ($mid && !is_array($mid)) $mid = explode(',', $mid); |
|
560 | + if (is_array($mid)) $mid = "'".implode("','", $mid)."'"; |
|
561 | 561 | |
562 | 562 | $site_module_info = Context::get('site_module_info'); |
563 | 563 | |
564 | 564 | $args = new stdClass; |
565 | 565 | $args->mid = $mid; |
566 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
566 | + if ($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
567 | 567 | $output = executeQuery('module.getModuleSrlByMid', $args); |
568 | - if(!$output->toBool()) return $output; |
|
568 | + if (!$output->toBool()) return $output; |
|
569 | 569 | |
570 | 570 | $list = $output->data; |
571 | - if(!$list) return; |
|
572 | - if(!is_array($list)) $list = array($list); |
|
571 | + if (!$list) return; |
|
572 | + if (!is_array($list)) $list = array($list); |
|
573 | 573 | |
574 | - foreach($list as $key => $val) |
|
574 | + foreach ($list as $key => $val) |
|
575 | 575 | { |
576 | 576 | $module_srl_list[] = $val->module_srl; |
577 | 577 | } |
@@ -587,33 +587,33 @@ discard block |
||
587 | 587 | $action_forward = false; |
588 | 588 | // cache controll |
589 | 589 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
590 | - if($oCacheHandler->isSupport()) |
|
590 | + if ($oCacheHandler->isSupport()) |
|
591 | 591 | { |
592 | 592 | $cache_key = 'action_forward'; |
593 | 593 | $action_forward = $oCacheHandler->get($cache_key); |
594 | 594 | } |
595 | 595 | |
596 | 596 | // retrieve and caching all registered action_forward |
597 | - if($action_forward === false) |
|
597 | + if ($action_forward === false) |
|
598 | 598 | { |
599 | 599 | $args = new stdClass(); |
600 | - $output = executeQueryArray('module.getActionForward',$args); |
|
601 | - if(!$output->toBool()) return new stdClass; |
|
602 | - if(!$output->data) $output->data = array(); |
|
600 | + $output = executeQueryArray('module.getActionForward', $args); |
|
601 | + if (!$output->toBool()) return new stdClass; |
|
602 | + if (!$output->data) $output->data = array(); |
|
603 | 603 | |
604 | 604 | $action_forward = array(); |
605 | - foreach($output->data as $item) |
|
605 | + foreach ($output->data as $item) |
|
606 | 606 | { |
607 | 607 | $action_forward[$item->act] = $item; |
608 | 608 | } |
609 | 609 | |
610 | - if($oCacheHandler->isSupport()) |
|
610 | + if ($oCacheHandler->isSupport()) |
|
611 | 611 | { |
612 | 612 | $oCacheHandler->put($cache_key, $action_forward); |
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | - if($action_forward[$act]) |
|
616 | + if ($action_forward[$act]) |
|
617 | 617 | { |
618 | 618 | return $action_forward[$act]; |
619 | 619 | } |
@@ -628,25 +628,25 @@ discard block |
||
628 | 628 | */ |
629 | 629 | function getTriggers($trigger_name, $called_position) |
630 | 630 | { |
631 | - if(is_null($GLOBALS['__triggers__'])) |
|
631 | + if (is_null($GLOBALS['__triggers__'])) |
|
632 | 632 | { |
633 | 633 | $triggers = FALSE; |
634 | 634 | $oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE); |
635 | - if($oCacheHandler->isSupport()) |
|
635 | + if ($oCacheHandler->isSupport()) |
|
636 | 636 | { |
637 | 637 | $cache_key = 'triggers'; |
638 | 638 | $triggers = $oCacheHandler->get($cache_key); |
639 | 639 | } |
640 | - if($triggers === FALSE) |
|
640 | + if ($triggers === FALSE) |
|
641 | 641 | { |
642 | 642 | $output = executeQueryArray('module.getTriggers'); |
643 | 643 | $triggers = $output->data; |
644 | - if($output->toBool() && $oCacheHandler->isSupport()) |
|
644 | + if ($output->toBool() && $oCacheHandler->isSupport()) |
|
645 | 645 | { |
646 | 646 | $oCacheHandler->put($cache_key, $triggers); |
647 | 647 | } |
648 | 648 | } |
649 | - foreach($triggers as $item) |
|
649 | + foreach ($triggers as $item) |
|
650 | 650 | { |
651 | 651 | $GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item; |
652 | 652 | } |
@@ -662,11 +662,11 @@ discard block |
||
662 | 662 | { |
663 | 663 | $triggers = $this->getTriggers($trigger_name, $called_position); |
664 | 664 | |
665 | - if($triggers && is_array($triggers)) |
|
665 | + if ($triggers && is_array($triggers)) |
|
666 | 666 | { |
667 | - foreach($triggers as $item) |
|
667 | + foreach ($triggers as $item) |
|
668 | 668 | { |
669 | - if($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
669 | + if ($item->module == $module && $item->type == $type && $item->called_method == $called_method) |
|
670 | 670 | { |
671 | 671 | return $item; |
672 | 672 | } |
@@ -679,12 +679,12 @@ discard block |
||
679 | 679 | /** |
680 | 680 | * @brief Get module extend |
681 | 681 | */ |
682 | - function getModuleExtend($parent_module, $type, $kind='') |
|
682 | + function getModuleExtend($parent_module, $type, $kind = '') |
|
683 | 683 | { |
684 | 684 | $key = $parent_module.'.'.$kind.'.'.$type; |
685 | 685 | |
686 | 686 | $module_extend_info = $this->loadModuleExtends(); |
687 | - if(array_key_exists($key, $module_extend_info)) |
|
687 | + if (array_key_exists($key, $module_extend_info)) |
|
688 | 688 | { |
689 | 689 | return $module_extend_info[$key]; |
690 | 690 | } |
@@ -700,29 +700,29 @@ discard block |
||
700 | 700 | $cache_file = './files/config/module_extend.php'; |
701 | 701 | $cache_file = FileHandler::getRealPath($cache_file); |
702 | 702 | |
703 | - if(!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
703 | + if (!isset($GLOBALS['__MODULE_EXTEND__'])) |
|
704 | 704 | { |
705 | 705 | // check pre install |
706 | - if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
706 | + if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file)) |
|
707 | 707 | { |
708 | 708 | $arr = array(); |
709 | 709 | $output = executeQueryArray('module.getModuleExtend'); |
710 | - if($output->data) |
|
710 | + if ($output->data) |
|
711 | 711 | { |
712 | - foreach($output->data as $v) |
|
712 | + foreach ($output->data as $v) |
|
713 | 713 | { |
714 | 714 | $arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module); |
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
718 | 718 | $str = '<?PHP return array(%s); ?>'; |
719 | - $str = sprintf($str, join(',',$arr)); |
|
719 | + $str = sprintf($str, join(',', $arr)); |
|
720 | 720 | |
721 | 721 | FileHandler::writeFile($cache_file, $str); |
722 | 722 | } |
723 | 723 | |
724 | 724 | |
725 | - if(file_exists($cache_file)) |
|
725 | + if (file_exists($cache_file)) |
|
726 | 726 | { |
727 | 727 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
728 | 728 | } |
@@ -742,20 +742,20 @@ discard block |
||
742 | 742 | { |
743 | 743 | // Get a path of the requested module. Return if not exists. |
744 | 744 | $module_path = ModuleHandler::getModulePath($module); |
745 | - if(!$module_path) return; |
|
745 | + if (!$module_path) return; |
|
746 | 746 | // Read the xml file for module skin information |
747 | 747 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
748 | - if(!file_exists($xml_file)) return; |
|
748 | + if (!file_exists($xml_file)) return; |
|
749 | 749 | |
750 | 750 | $oXmlParser = new XmlParser(); |
751 | 751 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
752 | 752 | $xml_obj = $tmp_xml_obj->module; |
753 | 753 | |
754 | - if(!$xml_obj) return; |
|
754 | + if (!$xml_obj) return; |
|
755 | 755 | |
756 | 756 | // Module Information |
757 | 757 | $module_info = new stdClass(); |
758 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
758 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
759 | 759 | { |
760 | 760 | // module format 0.2 |
761 | 761 | $module_info->title = $xml_obj->title->body; |
@@ -763,16 +763,16 @@ discard block |
||
763 | 763 | $module_info->version = $xml_obj->version->body; |
764 | 764 | $module_info->homepage = $xml_obj->link->body; |
765 | 765 | $module_info->category = $xml_obj->category->body; |
766 | - if(!$module_info->category) $module_info->category = 'service'; |
|
766 | + if (!$module_info->category) $module_info->category = 'service'; |
|
767 | 767 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
768 | 768 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 769 | $module_info->license = $xml_obj->license->body; |
770 | 770 | $module_info->license_link = $xml_obj->license->attrs->link; |
771 | 771 | |
772 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
772 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
773 | 773 | else $author_list = $xml_obj->author; |
774 | 774 | |
775 | - foreach($author_list as $author) |
|
775 | + foreach ($author_list as $author) |
|
776 | 776 | { |
777 | 777 | $author_obj = new stdClass(); |
778 | 778 | $author_obj->name = $author->name->body; |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | $module_info->description = $xml_obj->author->description->body; |
789 | 789 | $module_info->version = $xml_obj->attrs->version; |
790 | 790 | $module_info->category = $xml_obj->attrs->category; |
791 | - if(!$module_info->category) $module_info->category = 'service'; |
|
791 | + if (!$module_info->category) $module_info->category = 'service'; |
|
792 | 792 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
793 | 793 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 794 | $author_obj = new stdClass(); |
@@ -817,17 +817,17 @@ discard block |
||
817 | 817 | { |
818 | 818 | // Get a path of the requested module. Return if not exists. |
819 | 819 | $class_path = ModuleHandler::getModulePath($module); |
820 | - if(!$class_path) return; |
|
820 | + if (!$class_path) return; |
|
821 | 821 | |
822 | 822 | // Check if module.xml exists in the path. Return if not exist |
823 | 823 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
824 | - if(!file_exists($xml_file)) return; |
|
824 | + if (!file_exists($xml_file)) return; |
|
825 | 825 | |
826 | 826 | // Check if cached file exists |
827 | - $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
827 | + $cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
|
828 | 828 | |
829 | 829 | // Update if no cache file exists or it is older than xml file |
830 | - if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
830 | + if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache) |
|
831 | 831 | { |
832 | 832 | $info = new stdClass(); |
833 | 833 | $buff = array(); // /< Set buff variable to use in the cache file |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | |
841 | 841 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
842 | 842 | |
843 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
843 | + if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
844 | 844 | |
845 | 845 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
846 | 846 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -850,17 +850,17 @@ discard block |
||
850 | 850 | $default_index = $admin_index = ''; |
851 | 851 | |
852 | 852 | // Arrange permission information |
853 | - if($grants) |
|
853 | + if ($grants) |
|
854 | 854 | { |
855 | - if(is_array($grants)) $grant_list = $grants; |
|
855 | + if (is_array($grants)) $grant_list = $grants; |
|
856 | 856 | else $grant_list[] = $grants; |
857 | 857 | |
858 | 858 | $info->grant = new stdClass(); |
859 | 859 | $buff[] = '$info->grant = new stdClass;'; |
860 | - foreach($grant_list as $grant) |
|
860 | + foreach ($grant_list as $grant) |
|
861 | 861 | { |
862 | 862 | $name = $grant->attrs->name; |
863 | - $default = $grant->attrs->default?$grant->attrs->default:'guest'; |
|
863 | + $default = $grant->attrs->default ? $grant->attrs->default : 'guest'; |
|
864 | 864 | $title = $grant->title->body; |
865 | 865 | |
866 | 866 | $info->grant->{$name} = new stdClass(); |
@@ -873,15 +873,15 @@ discard block |
||
873 | 873 | } |
874 | 874 | } |
875 | 875 | // Permissions to grant |
876 | - if($permissions) |
|
876 | + if ($permissions) |
|
877 | 877 | { |
878 | - if(is_array($permissions)) $permission_list = $permissions; |
|
878 | + if (is_array($permissions)) $permission_list = $permissions; |
|
879 | 879 | else $permission_list[] = $permissions; |
880 | 880 | |
881 | 881 | $buff[] = '$info->permission = new stdClass;'; |
882 | 882 | |
883 | 883 | $info->permission = new stdClass(); |
884 | - foreach($permission_list as $permission) |
|
884 | + foreach ($permission_list as $permission) |
|
885 | 885 | { |
886 | 886 | $action = $permission->attrs->action; |
887 | 887 | $target = $permission->attrs->target; |
@@ -892,14 +892,14 @@ discard block |
||
892 | 892 | } |
893 | 893 | } |
894 | 894 | // for admin menus |
895 | - if($menus) |
|
895 | + if ($menus) |
|
896 | 896 | { |
897 | - if(is_array($menus)) $menu_list = $menus; |
|
897 | + if (is_array($menus)) $menu_list = $menus; |
|
898 | 898 | else $menu_list[] = $menus; |
899 | 899 | |
900 | 900 | $buff[] = '$info->menu = new stdClass;'; |
901 | 901 | $info->menu = new stdClass(); |
902 | - foreach($menu_list as $menu) |
|
902 | + foreach ($menu_list as $menu) |
|
903 | 903 | { |
904 | 904 | $menu_name = $menu->attrs->name; |
905 | 905 | $menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body; |
@@ -917,23 +917,23 @@ discard block |
||
917 | 917 | } |
918 | 918 | |
919 | 919 | // actions |
920 | - if($actions) |
|
920 | + if ($actions) |
|
921 | 921 | { |
922 | - if(is_array($actions)) $action_list = $actions; |
|
922 | + if (is_array($actions)) $action_list = $actions; |
|
923 | 923 | else $action_list[] = $actions; |
924 | 924 | |
925 | 925 | $buff[] = '$info->action = new stdClass;'; |
926 | 926 | $info->action = new stdClass(); |
927 | - foreach($action_list as $action) |
|
927 | + foreach ($action_list as $action) |
|
928 | 928 | { |
929 | 929 | $name = $action->attrs->name; |
930 | 930 | |
931 | 931 | $type = $action->attrs->type; |
932 | - $grant = $action->attrs->grant?$action->attrs->grant:'guest'; |
|
933 | - $standalone = $action->attrs->standalone=='false'?'false':'true'; |
|
934 | - $ruleset = $action->attrs->ruleset?$action->attrs->ruleset:''; |
|
935 | - $method = $action->attrs->method?$action->attrs->method:''; |
|
936 | - $check_csrf = $action->attrs->check_csrf=='false'?'false':'true'; |
|
932 | + $grant = $action->attrs->grant ? $action->attrs->grant : 'guest'; |
|
933 | + $standalone = $action->attrs->standalone == 'false' ? 'false' : 'true'; |
|
934 | + $ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : ''; |
|
935 | + $method = $action->attrs->method ? $action->attrs->method : ''; |
|
936 | + $check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true'; |
|
937 | 937 | $meta_noindex = $action->attrs->{'meta-noindex'} === 'true' ? 'true' : 'false'; |
938 | 938 | |
939 | 939 | $index = $action->attrs->index; |
@@ -950,14 +950,14 @@ discard block |
||
950 | 950 | $info->action->{$name}->method = $method; |
951 | 951 | $info->action->{$name}->check_csrf = $check_csrf; |
952 | 952 | $info->action->{$name}->meta_noindex = $meta_noindex; |
953 | - if($action->attrs->menu_name) |
|
953 | + if ($action->attrs->menu_name) |
|
954 | 954 | { |
955 | - if($menu_index == 'true') |
|
955 | + if ($menu_index == 'true') |
|
956 | 956 | { |
957 | 957 | $info->menu->{$action->attrs->menu_name}->index = $name; |
958 | 958 | $buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name); |
959 | 959 | } |
960 | - if(is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
960 | + if (is_array($info->menu->{$action->attrs->menu_name}->acts)) |
|
961 | 961 | { |
962 | 962 | $info->menu->{$action->attrs->menu_name}->acts[] = $name; |
963 | 963 | $currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts); |
@@ -976,22 +976,22 @@ discard block |
||
976 | 976 | $buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf); |
977 | 977 | $buff[] = sprintf('$info->action->%s->meta_noindex=\'%s\';', $name, $meta_noindex); |
978 | 978 | |
979 | - if($index=='true') |
|
979 | + if ($index == 'true') |
|
980 | 980 | { |
981 | 981 | $default_index_act = $name; |
982 | 982 | $info->default_index_act = $name; |
983 | 983 | } |
984 | - if($admin_index=='true') |
|
984 | + if ($admin_index == 'true') |
|
985 | 985 | { |
986 | 986 | $admin_index_act = $name; |
987 | 987 | $info->admin_index_act = $name; |
988 | 988 | } |
989 | - if($setup_index=='true') |
|
989 | + if ($setup_index == 'true') |
|
990 | 990 | { |
991 | 991 | $setup_index_act = $name; |
992 | 992 | $info->setup_index_act = $name; |
993 | 993 | } |
994 | - if($simple_setup_index=='true') |
|
994 | + if ($simple_setup_index == 'true') |
|
995 | 995 | { |
996 | 996 | $simple_setup_index_act = $name; |
997 | 997 | $info->simple_setup_index_act = $name; |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | return $info; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - if(file_exists($cache_file)) return include($cache_file); |
|
1015 | + if (file_exists($cache_file)) return include($cache_file); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | /** |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | { |
1024 | 1024 | $module = Context::get('module_type'); |
1025 | 1025 | |
1026 | - if($module == 'ARTICLE') |
|
1026 | + if ($module == 'ARTICLE') |
|
1027 | 1027 | { |
1028 | 1028 | $module = 'page'; |
1029 | 1029 | } |
@@ -1043,26 +1043,26 @@ discard block |
||
1043 | 1043 | */ |
1044 | 1044 | function getSkins($path, $dir = 'skins') |
1045 | 1045 | { |
1046 | - if(substr($path, -1) == '/') |
|
1046 | + if (substr($path, -1) == '/') |
|
1047 | 1047 | { |
1048 | 1048 | $path = substr($path, 0, -1); |
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1052 | 1052 | $list = FileHandler::readDir($skin_path); |
1053 | - if(!count($list)) return; |
|
1053 | + if (!count($list)) return; |
|
1054 | 1054 | |
1055 | 1055 | natcasesort($list); |
1056 | 1056 | |
1057 | - foreach($list as $skin_name) |
|
1057 | + foreach ($list as $skin_name) |
|
1058 | 1058 | { |
1059 | - if(!is_dir($skin_path . $skin_name)) |
|
1059 | + if (!is_dir($skin_path.$skin_name)) |
|
1060 | 1060 | { |
1061 | 1061 | continue; |
1062 | 1062 | } |
1063 | 1063 | unset($skin_info); |
1064 | 1064 | $skin_info = $this->loadSkinInfo($path, $skin_name, $dir); |
1065 | - if(!$skin_info) |
|
1065 | + if (!$skin_info) |
|
1066 | 1066 | { |
1067 | 1067 | $skin_info = new stdClass(); |
1068 | 1068 | $skin_info->title = $skin_name; |
@@ -1075,15 +1075,15 @@ discard block |
||
1075 | 1075 | $tmpPath = trim($tmpPath); |
1076 | 1076 | $module = array_pop(explode(' ', $tmpPath)); |
1077 | 1077 | |
1078 | - if($dir == 'skins') |
|
1078 | + if ($dir == 'skins') |
|
1079 | 1079 | { |
1080 | 1080 | $oAdminModel = getAdminModel('admin'); |
1081 | 1081 | $themesInfo = $oAdminModel->getThemeList(); |
1082 | 1082 | |
1083 | - foreach($themesInfo as $themeName => $info) |
|
1083 | + foreach ($themesInfo as $themeName => $info) |
|
1084 | 1084 | { |
1085 | 1085 | $skinInfos = $info->skin_infos; |
1086 | - if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1086 | + if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) |
|
1087 | 1087 | { |
1088 | 1088 | $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; |
1089 | 1089 | $skin_list[$skinInfos[$module]->name] = $themeSkinInfo; |
@@ -1095,13 +1095,13 @@ discard block |
||
1095 | 1095 | $oMenuAdminModel = getAdminModel('menu'); |
1096 | 1096 | $installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl); |
1097 | 1097 | $moduleName = $module; |
1098 | - if($moduleName === 'page') |
|
1098 | + if ($moduleName === 'page') |
|
1099 | 1099 | { |
1100 | 1100 | $moduleName = 'ARTICLE'; |
1101 | 1101 | } |
1102 | - if(array_key_exists($moduleName, $installedMenuTypes)) |
|
1102 | + if (array_key_exists($moduleName, $installedMenuTypes)) |
|
1103 | 1103 | { |
1104 | - if($dir == 'skins') |
|
1104 | + if ($dir == 'skins') |
|
1105 | 1105 | { |
1106 | 1106 | $type = 'P'; |
1107 | 1107 | } |
@@ -1111,12 +1111,12 @@ discard block |
||
1111 | 1111 | } |
1112 | 1112 | $defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl); |
1113 | 1113 | |
1114 | - if(isset($defaultSkinName)) |
|
1114 | + if (isset($defaultSkinName)) |
|
1115 | 1115 | { |
1116 | 1116 | $defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir); |
1117 | 1117 | |
1118 | 1118 | $useDefault = new stdClass(); |
1119 | - $useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')'; |
|
1119 | + $useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')'; |
|
1120 | 1120 | |
1121 | 1121 | $useDefaultList['/USE_DEFAULT/'] = $useDefault; |
1122 | 1122 | |
@@ -1133,20 +1133,20 @@ discard block |
||
1133 | 1133 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1134 | 1134 | { |
1135 | 1135 | // Read xml file having skin information |
1136 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1136 | + if (substr($path, -1) != '/') $path .= '/'; |
|
1137 | 1137 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1138 | - if(!file_exists($skin_xml_file)) return; |
|
1138 | + if (!file_exists($skin_xml_file)) return; |
|
1139 | 1139 | // Create XmlParser object |
1140 | 1140 | $oXmlParser = new XmlParser(); |
1141 | 1141 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1142 | 1142 | // Return if no skin information is |
1143 | - if(!$_xml_obj->skin) return; |
|
1143 | + if (!$_xml_obj->skin) return; |
|
1144 | 1144 | $xml_obj = $_xml_obj->skin; |
1145 | 1145 | // Skin Name |
1146 | 1146 | $skin_info = new stdClass(); |
1147 | 1147 | $skin_info->title = $xml_obj->title->body; |
1148 | 1148 | // Author information |
1149 | - if($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1149 | + if ($xml_obj->version && $xml_obj->attrs->version == '0.2') |
|
1150 | 1150 | { |
1151 | 1151 | // skin format v0.2 |
1152 | 1152 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1157,10 +1157,10 @@ discard block |
||
1157 | 1157 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1158 | 1158 | $skin_info->description = $xml_obj->description->body; |
1159 | 1159 | |
1160 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1160 | + if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1161 | 1161 | else $author_list = $xml_obj->author; |
1162 | 1162 | |
1163 | - foreach($author_list as $author) |
|
1163 | + foreach ($author_list as $author) |
|
1164 | 1164 | { |
1165 | 1165 | $author_obj = new stdClass(); |
1166 | 1166 | $author_obj->name = $author->name->body; |
@@ -1169,25 +1169,25 @@ discard block |
||
1169 | 1169 | $skin_info->author[] = $author_obj; |
1170 | 1170 | } |
1171 | 1171 | // List extra vars |
1172 | - if($xml_obj->extra_vars) |
|
1172 | + if ($xml_obj->extra_vars) |
|
1173 | 1173 | { |
1174 | 1174 | $extra_var_groups = $xml_obj->extra_vars->group; |
1175 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1176 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1175 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1176 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1177 | 1177 | |
1178 | - foreach($extra_var_groups as $group) |
|
1178 | + foreach ($extra_var_groups as $group) |
|
1179 | 1179 | { |
1180 | 1180 | $extra_vars = $group->var; |
1181 | - if(!$extra_vars) |
|
1181 | + if (!$extra_vars) |
|
1182 | 1182 | { |
1183 | 1183 | continue; |
1184 | 1184 | } |
1185 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1185 | + if (!is_array($group->var)) $extra_vars = array($group->var); |
|
1186 | 1186 | |
1187 | - foreach($extra_vars as $key => $val) |
|
1187 | + foreach ($extra_vars as $key => $val) |
|
1188 | 1188 | { |
1189 | 1189 | $obj = new stdClass(); |
1190 | - if(!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1190 | + if (!$val->attrs->type) { $val->attrs->type = 'text'; } |
|
1191 | 1191 | |
1192 | 1192 | $obj->group = $group->title->body; |
1193 | 1193 | $obj->name = $val->attrs->name; |
@@ -1196,14 +1196,14 @@ discard block |
||
1196 | 1196 | $obj->description = $val->description->body; |
1197 | 1197 | $obj->value = $extra_vals->{$obj->name}; |
1198 | 1198 | $obj->default = $val->attrs->default; |
1199 | - if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1200 | - if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1199 | + if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } |
|
1200 | + if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } |
|
1201 | 1201 | // Get an option list from 'select'type |
1202 | - if(is_array($val->options)) |
|
1202 | + if (is_array($val->options)) |
|
1203 | 1203 | { |
1204 | 1204 | $option_count = count($val->options); |
1205 | 1205 | |
1206 | - for($i = 0; $i < $option_count; $i++) |
|
1206 | + for ($i = 0; $i < $option_count; $i++) |
|
1207 | 1207 | { |
1208 | 1208 | $obj->options[$i] = new stdClass(); |
1209 | 1209 | $obj->options[$i]->title = $val->options[$i]->title->body; |
@@ -1240,18 +1240,18 @@ discard block |
||
1240 | 1240 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1241 | 1241 | // Variables used in the skin |
1242 | 1242 | $extra_var_groups = $xml_obj->extra_vars->group; |
1243 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1244 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1243 | + if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1244 | + if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1245 | 1245 | |
1246 | - foreach($extra_var_groups as $group) |
|
1246 | + foreach ($extra_var_groups as $group) |
|
1247 | 1247 | { |
1248 | 1248 | $extra_vars = $group->var; |
1249 | 1249 | |
1250 | - if($extra_vars) |
|
1250 | + if ($extra_vars) |
|
1251 | 1251 | { |
1252 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1252 | + if (!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1253 | 1253 | |
1254 | - foreach($extra_vars as $var) |
|
1254 | + foreach ($extra_vars as $var) |
|
1255 | 1255 | { |
1256 | 1256 | unset($obj); |
1257 | 1257 | unset($options); |
@@ -1262,11 +1262,11 @@ discard block |
||
1262 | 1262 | $title = $var->title->body; |
1263 | 1263 | $description = $var->description->body; |
1264 | 1264 | // Get an option list from 'select'type. |
1265 | - if(is_array($var->default)) |
|
1265 | + if (is_array($var->default)) |
|
1266 | 1266 | { |
1267 | 1267 | $option_count = count($var->default); |
1268 | 1268 | |
1269 | - for($i = 0; $i < $option_count; $i++) |
|
1269 | + for ($i = 0; $i < $option_count; $i++) |
|
1270 | 1270 | { |
1271 | 1271 | $options[$i]->title = $var->default[$i]->body; |
1272 | 1272 | $options[$i]->value = $var->default[$i]->body; |
@@ -1300,19 +1300,19 @@ discard block |
||
1300 | 1300 | |
1301 | 1301 | // colorset |
1302 | 1302 | $colorset = $xml_obj->colorset->color; |
1303 | - if($colorset) |
|
1303 | + if ($colorset) |
|
1304 | 1304 | { |
1305 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1305 | + if (!is_array($colorset)) $colorset = array($colorset); |
|
1306 | 1306 | |
1307 | - foreach($colorset as $color) |
|
1307 | + foreach ($colorset as $color) |
|
1308 | 1308 | { |
1309 | 1309 | $name = $color->attrs->name; |
1310 | 1310 | $title = $color->title->body; |
1311 | 1311 | $screenshot = $color->attrs->src; |
1312 | - if($screenshot) |
|
1312 | + if ($screenshot) |
|
1313 | 1313 | { |
1314 | 1314 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1315 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1315 | + if (!file_exists($screenshot)) $screenshot = ""; |
|
1316 | 1316 | } |
1317 | 1317 | else $screenshot = ""; |
1318 | 1318 | |
@@ -1324,19 +1324,19 @@ discard block |
||
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 | // Menu type (settings for layout) |
1327 | - if($xml_obj->menus->menu) |
|
1327 | + if ($xml_obj->menus->menu) |
|
1328 | 1328 | { |
1329 | 1329 | $menus = $xml_obj->menus->menu; |
1330 | - if(!is_array($menus)) $menus = array($menus); |
|
1330 | + if (!is_array($menus)) $menus = array($menus); |
|
1331 | 1331 | |
1332 | 1332 | $menu_count = count($menus); |
1333 | 1333 | $skin_info->menu_count = $menu_count; |
1334 | - for($i=0;$i<$menu_count;$i++) |
|
1334 | + for ($i = 0; $i < $menu_count; $i++) |
|
1335 | 1335 | { |
1336 | 1336 | unset($obj); |
1337 | 1337 | |
1338 | 1338 | $obj->name = $menus[$i]->attrs->name; |
1339 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1339 | + if ($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1340 | 1340 | $obj->title = $menus[$i]->title->body; |
1341 | 1341 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1342 | 1342 | |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin); |
1348 | - $skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null; |
|
1348 | + $skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null; |
|
1349 | 1349 | return $skin_info; |
1350 | 1350 | } |
1351 | 1351 | |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | { |
1357 | 1357 | $args = new stdClass; |
1358 | 1358 | $args->site_srl = $site_srl; |
1359 | - if(!is_null($module)) $args->module = $module; |
|
1359 | + if (!is_null($module)) $args->module = $module; |
|
1360 | 1360 | $output = executeQuery('module.getModuleCount', $args); |
1361 | 1361 | return $output->data->count; |
1362 | 1362 | } |
@@ -1370,26 +1370,26 @@ discard block |
||
1370 | 1370 | $config = false; |
1371 | 1371 | // cache controll |
1372 | 1372 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1373 | - if($oCacheHandler->isSupport()) |
|
1373 | + if ($oCacheHandler->isSupport()) |
|
1374 | 1374 | { |
1375 | - $object_key = 'module_config:' . $module . '_' . $site_srl; |
|
1375 | + $object_key = 'module_config:'.$module.'_'.$site_srl; |
|
1376 | 1376 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1377 | 1377 | $config = $oCacheHandler->get($cache_key); |
1378 | 1378 | } |
1379 | 1379 | |
1380 | - if($config === false) |
|
1380 | + if ($config === false) |
|
1381 | 1381 | { |
1382 | - if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1382 | + if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module]) |
|
1383 | 1383 | { |
1384 | 1384 | $args = new stdClass(); |
1385 | 1385 | $args->module = $module; |
1386 | 1386 | $args->site_srl = $site_srl; |
1387 | 1387 | $output = executeQuery('module.getModuleConfig', $args); |
1388 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1388 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1389 | 1389 | else $config = null; |
1390 | 1390 | |
1391 | 1391 | //insert in cache |
1392 | - if($oCacheHandler->isSupport()) |
|
1392 | + if ($oCacheHandler->isSupport()) |
|
1393 | 1393 | { |
1394 | 1394 | $oCacheHandler->put($cache_key, $config); |
1395 | 1395 | } |
@@ -1410,26 +1410,26 @@ discard block |
||
1410 | 1410 | $config = false; |
1411 | 1411 | // cache controll |
1412 | 1412 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1413 | - if($oCacheHandler->isSupport()) |
|
1413 | + if ($oCacheHandler->isSupport()) |
|
1414 | 1414 | { |
1415 | 1415 | $object_key = 'module_part_config:'.$module.'_'.$module_srl; |
1416 | 1416 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1417 | 1417 | $config = $oCacheHandler->get($cache_key); |
1418 | 1418 | } |
1419 | 1419 | |
1420 | - if($config === false) |
|
1420 | + if ($config === false) |
|
1421 | 1421 | { |
1422 | - if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1422 | + if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl])) |
|
1423 | 1423 | { |
1424 | 1424 | $args = new stdClass(); |
1425 | 1425 | $args->module = $module; |
1426 | 1426 | $args->module_srl = $module_srl; |
1427 | 1427 | $output = executeQuery('module.getModulePartConfig', $args); |
1428 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1428 | + if ($output->data->config) $config = unserialize($output->data->config); |
|
1429 | 1429 | else $config = null; |
1430 | 1430 | |
1431 | 1431 | //insert in cache |
1432 | - if($oCacheHandler->isSupport()) |
|
1432 | + if ($oCacheHandler->isSupport()) |
|
1433 | 1433 | { |
1434 | 1434 | $oCacheHandler->put($cache_key, $config); |
1435 | 1435 | } |
@@ -1448,11 +1448,11 @@ discard block |
||
1448 | 1448 | { |
1449 | 1449 | $args = new stdClass(); |
1450 | 1450 | $args->module = $module; |
1451 | - if($site_srl) $args->site_srl = $site_srl; |
|
1451 | + if ($site_srl) $args->site_srl = $site_srl; |
|
1452 | 1452 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1453 | - if(!$output->toBool() || !$output->data) return array(); |
|
1453 | + if (!$output->toBool() || !$output->data) return array(); |
|
1454 | 1454 | |
1455 | - foreach($output->data as $key => $val) |
|
1455 | + foreach ($output->data as $key => $val) |
|
1456 | 1456 | { |
1457 | 1457 | $result[$val->module_srl] = unserialize($val->config); |
1458 | 1458 | } |
@@ -1468,12 +1468,12 @@ discard block |
||
1468 | 1468 | $args->moduleCategorySrl = $moduleCategorySrl; |
1469 | 1469 | // Get data from the DB |
1470 | 1470 | $output = executeQuery('module.getModuleCategories', $args); |
1471 | - if(!$output->toBool()) return $output; |
|
1471 | + if (!$output->toBool()) return $output; |
|
1472 | 1472 | $list = $output->data; |
1473 | - if(!$list) return; |
|
1474 | - if(!is_array($list)) $list = array($list); |
|
1473 | + if (!$list) return; |
|
1474 | + if (!is_array($list)) $list = array($list); |
|
1475 | 1475 | |
1476 | - foreach($list as $val) |
|
1476 | + foreach ($list as $val) |
|
1477 | 1477 | { |
1478 | 1478 | $category_list[$val->module_category_srl] = $val; |
1479 | 1479 | } |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | $args = new stdClass; |
1490 | 1490 | $args->module_category_srl = $module_category_srl; |
1491 | 1491 | $output = executeQuery('module.getModuleCategory', $args); |
1492 | - if(!$output->toBool()) return $output; |
|
1492 | + if (!$output->toBool()) return $output; |
|
1493 | 1493 | return $output->data; |
1494 | 1494 | } |
1495 | 1495 | |
@@ -1501,10 +1501,10 @@ discard block |
||
1501 | 1501 | // Get a list of downloaded and installed modules |
1502 | 1502 | $searched_list = FileHandler::readDir('./modules'); |
1503 | 1503 | $searched_count = count($searched_list); |
1504 | - if(!$searched_count) return; |
|
1504 | + if (!$searched_count) return; |
|
1505 | 1505 | sort($searched_list); |
1506 | 1506 | |
1507 | - for($i=0;$i<$searched_count;$i++) |
|
1507 | + for ($i = 0; $i < $searched_count; $i++) |
|
1508 | 1508 | { |
1509 | 1509 | // Module name |
1510 | 1510 | $module_name = $searched_list[$i]; |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | $info = $this->getModuleInfoXml($module_name); |
1515 | 1515 | unset($obj); |
1516 | 1516 | |
1517 | - if(!isset($info)) continue; |
|
1517 | + if (!isset($info)) continue; |
|
1518 | 1518 | $info->module = $module_name; |
1519 | 1519 | $info->created_table_count = $created_table_count; |
1520 | 1520 | $info->table_count = $table_count; |
@@ -1531,19 +1531,19 @@ discard block |
||
1531 | 1531 | $info = null; |
1532 | 1532 | |
1533 | 1533 | $moduledir = ModuleHandler::getModulePath($module_name); |
1534 | - if(file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1534 | + if (file_exists(FileHandler::getRealPath($moduledir."schemas"))) |
|
1535 | 1535 | { |
1536 | 1536 | $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); |
1537 | 1537 | $table_count = count($tmp_files); |
1538 | 1538 | // Check if the table is created |
1539 | 1539 | $created_table_count = 0; |
1540 | - for($j=0;$j<count($tmp_files);$j++) |
|
1540 | + for ($j = 0; $j < count($tmp_files); $j++) |
|
1541 | 1541 | { |
1542 | - list($table_name) = explode(".",$tmp_files[$j]); |
|
1543 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1542 | + list($table_name) = explode(".", $tmp_files[$j]); |
|
1543 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1544 | 1544 | } |
1545 | 1545 | // Check if DB is installed |
1546 | - if($table_count > $created_table_count) return true; |
|
1546 | + if ($table_count > $created_table_count) return true; |
|
1547 | 1547 | else return false; |
1548 | 1548 | } |
1549 | 1549 | return false; |
@@ -1553,7 +1553,7 @@ discard block |
||
1553 | 1553 | { |
1554 | 1554 | // Check if it is upgraded to module.class.php on each module |
1555 | 1555 | $oDummy = getModule($module_name, 'class'); |
1556 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1556 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1557 | 1557 | { |
1558 | 1558 | return $oDummy->checkUpdate(); |
1559 | 1559 | } |
@@ -1567,15 +1567,15 @@ discard block |
||
1567 | 1567 | */ |
1568 | 1568 | public function needUpdate($update_id) |
1569 | 1569 | { |
1570 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
1570 | + if (!is_array($update_id)) $update_id = array($update_id); |
|
1571 | 1571 | |
1572 | 1572 | $args = new stdClass(); |
1573 | 1573 | $args->update_id = implode(',', $update_id); |
1574 | 1574 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
1575 | 1575 | |
1576 | - if(!!$output->error) return false; |
|
1577 | - if(!$output->data) $output->data = array(); |
|
1578 | - if(count($update_id) === count($output->data)) return false; |
|
1576 | + if (!!$output->error) return false; |
|
1577 | + if (!$output->data) $output->data = array(); |
|
1578 | + if (count($update_id) === count($output->data)) return false; |
|
1579 | 1579 | |
1580 | 1580 | return true; |
1581 | 1581 | } |
@@ -1592,31 +1592,31 @@ discard block |
||
1592 | 1592 | sort($searched_list); |
1593 | 1593 | |
1594 | 1594 | $searched_count = count($searched_list); |
1595 | - if(!$searched_count) return; |
|
1595 | + if (!$searched_count) return; |
|
1596 | 1596 | |
1597 | - for($i=0;$i<$searched_count;$i++) |
|
1597 | + for ($i = 0; $i < $searched_count; $i++) |
|
1598 | 1598 | { |
1599 | 1599 | // module name |
1600 | 1600 | $module_name = $searched_list[$i]; |
1601 | 1601 | |
1602 | 1602 | $path = ModuleHandler::getModulePath($module_name); |
1603 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1603 | + if (!is_dir(FileHandler::getRealPath($path))) continue; |
|
1604 | 1604 | |
1605 | 1605 | // Get the number of xml files to create a table in schemas |
1606 | 1606 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
1607 | 1607 | $table_count = count($tmp_files); |
1608 | 1608 | // Check if the table is created |
1609 | 1609 | $created_table_count = 0; |
1610 | - for($j=0;$j<$table_count;$j++) |
|
1610 | + for ($j = 0; $j < $table_count; $j++) |
|
1611 | 1611 | { |
1612 | - list($table_name) = explode('.',$tmp_files[$j]); |
|
1613 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1612 | + list($table_name) = explode('.', $tmp_files[$j]); |
|
1613 | + if ($oDB->isTableExists($table_name)) $created_table_count++; |
|
1614 | 1614 | } |
1615 | 1615 | // Get information of the module |
1616 | 1616 | $info = NULL; |
1617 | 1617 | $info = $this->getModuleInfoXml($module_name); |
1618 | 1618 | |
1619 | - if(!$info) continue; |
|
1619 | + if (!$info) continue; |
|
1620 | 1620 | |
1621 | 1621 | $info->module = $module_name; |
1622 | 1622 | $info->category = $info->category; |
@@ -1625,12 +1625,12 @@ discard block |
||
1625 | 1625 | $info->path = $path; |
1626 | 1626 | $info->admin_index_act = $info->admin_index_act; |
1627 | 1627 | // Check if DB is installed |
1628 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1628 | + if ($table_count > $created_table_count) $info->need_install = true; |
|
1629 | 1629 | else $info->need_install = false; |
1630 | 1630 | // Check if it is upgraded to module.class.php on each module |
1631 | 1631 | $oDummy = null; |
1632 | 1632 | $oDummy = getModule($module_name, 'class'); |
1633 | - if($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1633 | + if ($oDummy && method_exists($oDummy, "checkUpdate")) |
|
1634 | 1634 | { |
1635 | 1635 | $info->need_update = $oDummy->checkUpdate(); |
1636 | 1636 | } |
@@ -1651,15 +1651,15 @@ discard block |
||
1651 | 1651 | */ |
1652 | 1652 | function syncModuleToSite(&$data) |
1653 | 1653 | { |
1654 | - if(!$data) return; |
|
1654 | + if (!$data) return; |
|
1655 | 1655 | |
1656 | - if(is_array($data)) |
|
1656 | + if (is_array($data)) |
|
1657 | 1657 | { |
1658 | - foreach($data as $key => $val) |
|
1658 | + foreach ($data as $key => $val) |
|
1659 | 1659 | { |
1660 | 1660 | $module_srls[] = $val->module_srl; |
1661 | 1661 | } |
1662 | - if(!count($module_srls)) return; |
|
1662 | + if (!count($module_srls)) return; |
|
1663 | 1663 | } |
1664 | 1664 | else |
1665 | 1665 | { |
@@ -1667,17 +1667,17 @@ discard block |
||
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | $args = new stdClass(); |
1670 | - $args->module_srls = implode(',',$module_srls); |
|
1670 | + $args->module_srls = implode(',', $module_srls); |
|
1671 | 1671 | $output = executeQueryArray('module.getModuleSites', $args); |
1672 | - if(!$output->data) return array(); |
|
1673 | - foreach($output->data as $key => $val) |
|
1672 | + if (!$output->data) return array(); |
|
1673 | + foreach ($output->data as $key => $val) |
|
1674 | 1674 | { |
1675 | 1675 | $modules[$val->module_srl] = $val; |
1676 | 1676 | } |
1677 | 1677 | |
1678 | - if(is_array($data)) |
|
1678 | + if (is_array($data)) |
|
1679 | 1679 | { |
1680 | - foreach($data as $key => $val) |
|
1680 | + foreach ($data as $key => $val) |
|
1681 | 1681 | { |
1682 | 1682 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1683 | 1683 | } |
@@ -1693,14 +1693,14 @@ discard block |
||
1693 | 1693 | */ |
1694 | 1694 | function isSiteAdmin($member_info, $site_srl = null) |
1695 | 1695 | { |
1696 | - if(!$member_info->member_srl) return false; |
|
1697 | - if($member_info->is_admin == 'Y') return true; |
|
1696 | + if (!$member_info->member_srl) return false; |
|
1697 | + if ($member_info->is_admin == 'Y') return true; |
|
1698 | 1698 | |
1699 | 1699 | $args = new stdClass(); |
1700 | - if(!isset($site_srl)) |
|
1700 | + if (!isset($site_srl)) |
|
1701 | 1701 | { |
1702 | 1702 | $site_module_info = Context::get('site_module_info'); |
1703 | - if(!$site_module_info) return; |
|
1703 | + if (!$site_module_info) return; |
|
1704 | 1704 | $args->site_srl = $site_module_info->site_srl; |
1705 | 1705 | } |
1706 | 1706 | else |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | |
1711 | 1711 | $args->member_srl = $member_info->member_srl; |
1712 | 1712 | $output = executeQuery('module.isSiteAdmin', $args); |
1713 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1713 | + if ($output->data->member_srl == $args->member_srl) return true; |
|
1714 | 1714 | return false; |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | $obj = new stdClass(); |
1734 | 1734 | $obj->module_srl = $module_srl; |
1735 | 1735 | $output = executeQueryArray('module.getAdminID', $obj); |
1736 | - if(!$output->toBool() || !$output->data) return; |
|
1736 | + if (!$output->toBool() || !$output->data) return; |
|
1737 | 1737 | |
1738 | 1738 | return $output->data; |
1739 | 1739 | } |
@@ -1746,20 +1746,20 @@ discard block |
||
1746 | 1746 | { |
1747 | 1747 | $extra_vars = array(); |
1748 | 1748 | $get_module_srls = array(); |
1749 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1749 | + if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1750 | 1750 | |
1751 | 1751 | $vars = false; |
1752 | 1752 | // cache controll |
1753 | 1753 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1754 | - if($oCacheHandler->isSupport()) |
|
1754 | + if ($oCacheHandler->isSupport()) |
|
1755 | 1755 | { |
1756 | - foreach($list_module_srl as $module_srl) |
|
1756 | + foreach ($list_module_srl as $module_srl) |
|
1757 | 1757 | { |
1758 | 1758 | $object_key = 'module_extra_vars:'.$module_srl; |
1759 | 1759 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1760 | 1760 | $vars = $oCacheHandler->get($cache_key); |
1761 | 1761 | |
1762 | - if($vars) |
|
1762 | + if ($vars) |
|
1763 | 1763 | { |
1764 | 1764 | $extra_vars[$module_srl] = $vars; |
1765 | 1765 | } |
@@ -1774,35 +1774,35 @@ discard block |
||
1774 | 1774 | $get_module_srls = $list_module_srl; |
1775 | 1775 | } |
1776 | 1776 | |
1777 | - if(count($get_module_srls) > 0) |
|
1777 | + if (count($get_module_srls) > 0) |
|
1778 | 1778 | { |
1779 | 1779 | $args = new stdClass(); |
1780 | 1780 | $args->module_srl = implode(',', $get_module_srls); |
1781 | 1781 | $output = executeQueryArray('module.getModuleExtraVars', $args); |
1782 | 1782 | |
1783 | - if(!$output->toBool()) |
|
1783 | + if (!$output->toBool()) |
|
1784 | 1784 | { |
1785 | 1785 | return array(); |
1786 | 1786 | } |
1787 | 1787 | |
1788 | - if(!$output->data) |
|
1788 | + if (!$output->data) |
|
1789 | 1789 | { |
1790 | - foreach($get_module_srls as $module_srl) |
|
1790 | + foreach ($get_module_srls as $module_srl) |
|
1791 | 1791 | { |
1792 | 1792 | $extra_vars[$module_srl] = new stdClass; |
1793 | 1793 | } |
1794 | 1794 | } |
1795 | - foreach($output->data as $key => $val) |
|
1795 | + foreach ($output->data as $key => $val) |
|
1796 | 1796 | { |
1797 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1797 | + if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue; |
|
1798 | 1798 | |
1799 | - if(!isset($extra_vars[$val->module_srl])) |
|
1799 | + if (!isset($extra_vars[$val->module_srl])) |
|
1800 | 1800 | { |
1801 | 1801 | $extra_vars[$val->module_srl] = new stdClass(); |
1802 | 1802 | } |
1803 | 1803 | $extra_vars[$val->module_srl]->{$val->name} = $val->value; |
1804 | 1804 | |
1805 | - if($oCacheHandler->isSupport()) |
|
1805 | + if ($oCacheHandler->isSupport()) |
|
1806 | 1806 | { |
1807 | 1807 | $object_key = 'module_extra_vars:'.$val->module_srl; |
1808 | 1808 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
@@ -1821,27 +1821,27 @@ discard block |
||
1821 | 1821 | { |
1822 | 1822 | $skin_vars = false; |
1823 | 1823 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1824 | - if($oCacheHandler->isSupport()) |
|
1824 | + if ($oCacheHandler->isSupport()) |
|
1825 | 1825 | { |
1826 | 1826 | $object_key = 'module_skin_vars:'.$module_srl; |
1827 | 1827 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1828 | 1828 | $skin_vars = $oCacheHandler->get($cache_key); |
1829 | 1829 | } |
1830 | 1830 | |
1831 | - if($skin_vars === false) |
|
1831 | + if ($skin_vars === false) |
|
1832 | 1832 | { |
1833 | 1833 | $args = new stdClass(); |
1834 | 1834 | $args->module_srl = $module_srl; |
1835 | - $output = executeQueryArray('module.getModuleSkinVars',$args); |
|
1836 | - if(!$output->toBool()) return; |
|
1835 | + $output = executeQueryArray('module.getModuleSkinVars', $args); |
|
1836 | + if (!$output->toBool()) return; |
|
1837 | 1837 | |
1838 | 1838 | $skin_vars = array(); |
1839 | - foreach($output->data as $vars) |
|
1839 | + foreach ($output->data as $vars) |
|
1840 | 1840 | { |
1841 | 1841 | $skin_vars[$vars->name] = $vars; |
1842 | 1842 | } |
1843 | 1843 | |
1844 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1844 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | return $skin_vars; |
@@ -1853,32 +1853,32 @@ discard block |
||
1853 | 1853 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1854 | 1854 | { |
1855 | 1855 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1856 | - if(!$site_srl) $site_srl = 0; |
|
1856 | + if (!$site_srl) $site_srl = 0; |
|
1857 | 1857 | |
1858 | 1858 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1859 | - if(is_readable($designInfoFile)) |
|
1859 | + if (is_readable($designInfoFile)) |
|
1860 | 1860 | { |
1861 | 1861 | include($designInfoFile); |
1862 | 1862 | |
1863 | 1863 | $skinName = $designInfo->module->{$module_name}->{$target}; |
1864 | 1864 | } |
1865 | - if(!$skinName) |
|
1865 | + if (!$skinName) |
|
1866 | 1866 | { |
1867 | 1867 | $dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/'; |
1868 | 1868 | $moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir; |
1869 | 1869 | |
1870 | - if(is_dir($moduleSkinPath.'default')) |
|
1870 | + if (is_dir($moduleSkinPath.'default')) |
|
1871 | 1871 | { |
1872 | 1872 | $skinName = 'default'; |
1873 | 1873 | } |
1874 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
1874 | + else if (is_dir($moduleSkinPath.'xe_default')) |
|
1875 | 1875 | { |
1876 | 1876 | $skinName = 'xe_default'; |
1877 | 1877 | } |
1878 | 1878 | else |
1879 | 1879 | { |
1880 | 1880 | $skins = FileHandler::readDir($moduleSkinPath); |
1881 | - if(count($skins) > 0) |
|
1881 | + if (count($skins) > 0) |
|
1882 | 1882 | { |
1883 | 1883 | $skinName = $skins[0]; |
1884 | 1884 | } |
@@ -1888,9 +1888,9 @@ discard block |
||
1888 | 1888 | } |
1889 | 1889 | } |
1890 | 1890 | |
1891 | - if($updateCache && $skinName) |
|
1891 | + if ($updateCache && $skinName) |
|
1892 | 1892 | { |
1893 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1893 | + if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
1894 | 1894 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1895 | 1895 | |
1896 | 1896 | $oAdminController = getAdminController('admin'); |
@@ -1906,10 +1906,10 @@ discard block |
||
1906 | 1906 | */ |
1907 | 1907 | function syncSkinInfoToModuleInfo(&$module_info) |
1908 | 1908 | { |
1909 | - if(!$module_info->module_srl) return; |
|
1909 | + if (!$module_info->module_srl) return; |
|
1910 | 1910 | |
1911 | 1911 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1912 | - if(Mobile::isFromMobilePhone()) |
|
1912 | + if (Mobile::isFromMobilePhone()) |
|
1913 | 1913 | { |
1914 | 1914 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1915 | 1915 | } |
@@ -1918,11 +1918,11 @@ discard block |
||
1918 | 1918 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1919 | 1919 | } |
1920 | 1920 | |
1921 | - if(!$skin_vars) return; |
|
1921 | + if (!$skin_vars) return; |
|
1922 | 1922 | |
1923 | - foreach($skin_vars as $name => $val) |
|
1923 | + foreach ($skin_vars as $name => $val) |
|
1924 | 1924 | { |
1925 | - if(isset($module_info->{$name})) continue; |
|
1925 | + if (isset($module_info->{$name})) continue; |
|
1926 | 1926 | $module_info->{$name} = $val->value; |
1927 | 1927 | } |
1928 | 1928 | } |
@@ -1936,27 +1936,27 @@ discard block |
||
1936 | 1936 | { |
1937 | 1937 | $skin_vars = false; |
1938 | 1938 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1939 | - if($oCacheHandler->isSupport()) |
|
1939 | + if ($oCacheHandler->isSupport()) |
|
1940 | 1940 | { |
1941 | 1941 | $object_key = 'module_mobile_skin_vars:'.$module_srl; |
1942 | 1942 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1943 | 1943 | $skin_vars = $oCacheHandler->get($cache_key); |
1944 | 1944 | } |
1945 | 1945 | |
1946 | - if($skin_vars === false) |
|
1946 | + if ($skin_vars === false) |
|
1947 | 1947 | { |
1948 | 1948 | $args = new stdClass(); |
1949 | 1949 | $args->module_srl = $module_srl; |
1950 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1951 | - if(!$output->toBool() || !$output->data) return; |
|
1950 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1951 | + if (!$output->toBool() || !$output->data) return; |
|
1952 | 1952 | |
1953 | 1953 | $skin_vars = array(); |
1954 | - foreach($output->data as $vars) |
|
1954 | + foreach ($output->data as $vars) |
|
1955 | 1955 | { |
1956 | 1956 | $skin_vars[$vars->name] = $vars; |
1957 | 1957 | } |
1958 | 1958 | |
1959 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1959 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1960 | 1960 | } |
1961 | 1961 | |
1962 | 1962 | return $skin_vars; |
@@ -1968,32 +1968,32 @@ discard block |
||
1968 | 1968 | */ |
1969 | 1969 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1970 | 1970 | { |
1971 | - if(!$module_info->module_srl) return; |
|
1971 | + if (!$module_info->module_srl) return; |
|
1972 | 1972 | $skin_vars = false; |
1973 | 1973 | // cache controll |
1974 | 1974 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1975 | - if($oCacheHandler->isSupport()) |
|
1975 | + if ($oCacheHandler->isSupport()) |
|
1976 | 1976 | { |
1977 | 1977 | $object_key = 'module_mobile_skin_vars:'.$module_info->module_srl; |
1978 | 1978 | $cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
1979 | 1979 | $skin_vars = $oCacheHandler->get($cache_key); |
1980 | 1980 | } |
1981 | - if($skin_vars === false) |
|
1981 | + if ($skin_vars === false) |
|
1982 | 1982 | { |
1983 | 1983 | $args = new stdClass; |
1984 | 1984 | $args->module_srl = $module_info->module_srl; |
1985 | - $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
|
1986 | - if(!$output->toBool()) return; |
|
1985 | + $output = executeQueryArray('module.getModuleMobileSkinVars', $args); |
|
1986 | + if (!$output->toBool()) return; |
|
1987 | 1987 | $skin_vars = $output->data; |
1988 | 1988 | |
1989 | 1989 | //insert in cache |
1990 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1990 | + if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
1991 | 1991 | } |
1992 | - if(!$skin_vars) return; |
|
1992 | + if (!$skin_vars) return; |
|
1993 | 1993 | |
1994 | - foreach($output->data as $val) |
|
1994 | + foreach ($output->data as $val) |
|
1995 | 1995 | { |
1996 | - if(isset($module_info->{$val->name})) continue; |
|
1996 | + if (isset($module_info->{$val->name})) continue; |
|
1997 | 1997 | $module_info->{$val->name} = $val->value; |
1998 | 1998 | } |
1999 | 1999 | } |
@@ -2005,7 +2005,7 @@ discard block |
||
2005 | 2005 | { |
2006 | 2006 | $grant = new stdClass(); |
2007 | 2007 | |
2008 | - if(!$xml_info) |
|
2008 | + if (!$xml_info) |
|
2009 | 2009 | { |
2010 | 2010 | $module = $module_info->module; |
2011 | 2011 | $xml_info = $this->getModuleActionXml($module); |
@@ -2013,9 +2013,9 @@ discard block |
||
2013 | 2013 | // Set variables to grant group permission |
2014 | 2014 | $module_srl = $module_info->module_srl; |
2015 | 2015 | $grant_info = $xml_info->grant; |
2016 | - if($member_info->member_srl) |
|
2016 | + if ($member_info->member_srl) |
|
2017 | 2017 | { |
2018 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
2018 | + if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
2019 | 2019 | else $group_list = array(); |
2020 | 2020 | } |
2021 | 2021 | else |
@@ -2023,10 +2023,10 @@ discard block |
||
2023 | 2023 | $group_list = array(); |
2024 | 2024 | } |
2025 | 2025 | // If module_srl doesn't exist(if unable to set permissions) |
2026 | - if(!$module_srl) |
|
2026 | + if (!$module_srl) |
|
2027 | 2027 | { |
2028 | 2028 | $grant->access = true; |
2029 | - if($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2029 | + if ($this->isSiteAdmin($member_info, $module_info->site_srl)) |
|
2030 | 2030 | { |
2031 | 2031 | $grant->access = $grant->manager = $grant->is_site_admin = true; |
2032 | 2032 | } |
@@ -2037,23 +2037,23 @@ discard block |
||
2037 | 2037 | { |
2038 | 2038 | // If module_srl exists |
2039 | 2039 | // Get a type of granted permission |
2040 | - $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false; |
|
2040 | + $grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false; |
|
2041 | 2041 | $grant->is_admin = ($member_info->is_admin == 'Y') ? true : false; |
2042 | 2042 | // If a just logged-in member is, check if the member is a module administrator |
2043 | - if(!$grant->manager && $member_info->member_srl) |
|
2043 | + if (!$grant->manager && $member_info->member_srl) |
|
2044 | 2044 | { |
2045 | 2045 | $args = new stdClass(); |
2046 | 2046 | $args->module_srl = $module_srl; |
2047 | 2047 | $args->member_srl = $member_info->member_srl; |
2048 | - $output = executeQuery('module.getModuleAdmin',$args); |
|
2049 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2048 | + $output = executeQuery('module.getModuleAdmin', $args); |
|
2049 | + if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2050 | 2050 | } |
2051 | 2051 | // If not an administrator, get information from the DB and grant manager privilege. |
2052 | - if(!$grant->manager) |
|
2052 | + if (!$grant->manager) |
|
2053 | 2053 | { |
2054 | 2054 | $args = new stdClass(); |
2055 | 2055 | // If planet, get permission settings from the planet home |
2056 | - if($module_info->module == 'planet') |
|
2056 | + if ($module_info->module == 'planet') |
|
2057 | 2057 | { |
2058 | 2058 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2059 | 2059 | } |
@@ -2066,42 +2066,42 @@ discard block |
||
2066 | 2066 | |
2067 | 2067 | $grant_exists = $granted = array(); |
2068 | 2068 | |
2069 | - if($output->data) |
|
2069 | + if ($output->data) |
|
2070 | 2070 | { |
2071 | 2071 | // Arrange names and groups who has privileges |
2072 | - foreach($output->data as $val) |
|
2072 | + foreach ($output->data as $val) |
|
2073 | 2073 | { |
2074 | 2074 | $grant_exists[$val->name] = true; |
2075 | - if($granted[$val->name]) continue; |
|
2075 | + if ($granted[$val->name]) continue; |
|
2076 | 2076 | // Log-in member only |
2077 | - if($val->group_srl == -1) |
|
2077 | + if ($val->group_srl == -1) |
|
2078 | 2078 | { |
2079 | 2079 | $granted[$val->name] = true; |
2080 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2080 | + if ($member_info->member_srl) $grant->{$val->name} = true; |
|
2081 | 2081 | // Site-joined member only |
2082 | 2082 | } |
2083 | - elseif($val->group_srl == -2) |
|
2083 | + elseif ($val->group_srl == -2) |
|
2084 | 2084 | { |
2085 | 2085 | $granted[$val->name] = true; |
2086 | 2086 | // Do not grant any permission for non-logged member |
2087 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2087 | + if (!$member_info->member_srl) $grant->{$val->name} = false; |
|
2088 | 2088 | // Log-in member |
2089 | 2089 | else |
2090 | 2090 | { |
2091 | 2091 | $site_module_info = Context::get('site_module_info'); |
2092 | 2092 | // Permission granted if no information of the currently connected site exists |
2093 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2093 | + if (!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2094 | 2094 | // Permission is not granted if information of the currently connected site exists |
2095 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2095 | + elseif (count($group_list)) $grant->{$val->name} = true; |
|
2096 | 2096 | } |
2097 | 2097 | // All of non-logged members |
2098 | 2098 | } |
2099 | - elseif($val->group_srl == -3) |
|
2099 | + elseif ($val->group_srl == -3) |
|
2100 | 2100 | { |
2101 | 2101 | $granted[$val->name] = true; |
2102 | 2102 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
2103 | 2103 | } |
2104 | - elseif($val->group_srl == 0) |
|
2104 | + elseif ($val->group_srl == 0) |
|
2105 | 2105 | { |
2106 | 2106 | $granted[$val->name] = true; |
2107 | 2107 | $grant->{$val->name} = true; |
@@ -2109,7 +2109,7 @@ discard block |
||
2109 | 2109 | } |
2110 | 2110 | else |
2111 | 2111 | { |
2112 | - if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2112 | + if ($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
|
2113 | 2113 | { |
2114 | 2114 | $grant->{$val->name} = true; |
2115 | 2115 | $granted[$val->name] = true; |
@@ -2118,29 +2118,29 @@ discard block |
||
2118 | 2118 | } |
2119 | 2119 | } |
2120 | 2120 | // Separate processing for the virtual group access |
2121 | - if(!$grant_exists['access']) $grant->access = true; |
|
2122 | - if(count($grant_info)) |
|
2121 | + if (!$grant_exists['access']) $grant->access = true; |
|
2122 | + if (count($grant_info)) |
|
2123 | 2123 | { |
2124 | - foreach($grant_info as $grant_name => $grant_item) |
|
2124 | + foreach ($grant_info as $grant_name => $grant_item) |
|
2125 | 2125 | { |
2126 | - if($grant_exists[$grant_name]) continue; |
|
2127 | - switch($grant_item->default) |
|
2126 | + if ($grant_exists[$grant_name]) continue; |
|
2127 | + switch ($grant_item->default) |
|
2128 | 2128 | { |
2129 | 2129 | case 'guest' : |
2130 | 2130 | $grant->{$grant_name} = true; |
2131 | 2131 | break; |
2132 | 2132 | case 'member' : |
2133 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2133 | + if ($member_info->member_srl) $grant->{$grant_name} = true; |
|
2134 | 2134 | else $grant->{$grant_name} = false; |
2135 | 2135 | break; |
2136 | 2136 | case 'site' : |
2137 | 2137 | $site_module_info = Context::get('site_module_info'); |
2138 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2138 | + if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2139 | 2139 | else $grant->{$grant_name} = false; |
2140 | 2140 | break; |
2141 | 2141 | case 'manager' : |
2142 | 2142 | case 'root' : |
2143 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2143 | + if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2144 | 2144 | else $grant->{$grant_name} = false; |
2145 | 2145 | break; |
2146 | 2146 | } |
@@ -2148,12 +2148,12 @@ discard block |
||
2148 | 2148 | } |
2149 | 2149 | } |
2150 | 2150 | // Set true to grant all privileges if an administrator is |
2151 | - if($grant->manager) |
|
2151 | + if ($grant->manager) |
|
2152 | 2152 | { |
2153 | 2153 | $grant->access = true; |
2154 | - if(count($grant_info)) |
|
2154 | + if (count($grant_info)) |
|
2155 | 2155 | { |
2156 | - foreach($grant_info as $key => $val) |
|
2156 | + foreach ($grant_info as $key => $val) |
|
2157 | 2157 | { |
2158 | 2158 | $grant->{$key} = true; |
2159 | 2159 | } |
@@ -2185,27 +2185,27 @@ discard block |
||
2185 | 2185 | |
2186 | 2186 | function unserializeAttributes($module_filebox_list) |
2187 | 2187 | { |
2188 | - if(is_array($module_filebox_list->data)) |
|
2188 | + if (is_array($module_filebox_list->data)) |
|
2189 | 2189 | { |
2190 | - foreach($module_filebox_list->data as &$item) |
|
2190 | + foreach ($module_filebox_list->data as &$item) |
|
2191 | 2191 | { |
2192 | - if(empty($item->comment)) |
|
2192 | + if (empty($item->comment)) |
|
2193 | 2193 | { |
2194 | 2194 | continue; |
2195 | 2195 | } |
2196 | 2196 | |
2197 | 2197 | $attributes = explode(';', $item->comment); |
2198 | - foreach($attributes as $attribute) |
|
2198 | + foreach ($attributes as $attribute) |
|
2199 | 2199 | { |
2200 | 2200 | $values = explode(':', $attribute); |
2201 | - if((count($values) % 2) ==1) |
|
2201 | + if ((count($values) % 2) == 1) |
|
2202 | 2202 | { |
2203 | - for($i=2;$i<count($values);$i++) |
|
2203 | + for ($i = 2; $i < count($values); $i++) |
|
2204 | 2204 | { |
2205 | - $values[1].=":".$values[$i]; |
|
2205 | + $values[1] .= ":".$values[$i]; |
|
2206 | 2206 | } |
2207 | 2207 | } |
2208 | - $atts[$values[0]]=$values[1]; |
|
2208 | + $atts[$values[0]] = $values[1]; |
|
2209 | 2209 | } |
2210 | 2210 | $item->attributes = $atts; |
2211 | 2211 | unset($atts); |
@@ -2217,16 +2217,16 @@ discard block |
||
2217 | 2217 | function getFileBoxListHtml() |
2218 | 2218 | { |
2219 | 2219 | $logged_info = Context::get('logged_info'); |
2220 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
2220 | + if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
2221 | 2221 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2222 | - $link_params = explode('&',$link['query']); |
|
2222 | + $link_params = explode('&', $link['query']); |
|
2223 | 2223 | foreach ($link_params as $param) |
2224 | 2224 | { |
2225 | - $param = explode("=",$param); |
|
2226 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2225 | + $param = explode("=", $param); |
|
2226 | + if ($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2227 | 2227 | } |
2228 | 2228 | $oWidgetModel = getModel('widget'); |
2229 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2229 | + if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2230 | 2230 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2231 | 2231 | |
2232 | 2232 | $oModuleModel = getModel('module'); |
@@ -2242,24 +2242,24 @@ discard block |
||
2242 | 2242 | $security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.'); |
2243 | 2243 | |
2244 | 2244 | $oTemplate = &TemplateHandler::getInstance(); |
2245 | - $html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html'); |
|
2245 | + $html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html'); |
|
2246 | 2246 | |
2247 | 2247 | $this->add('html', $html); |
2248 | 2248 | } |
2249 | 2249 | |
2250 | 2250 | function getModuleFileBoxPath($module_filebox_srl) |
2251 | 2251 | { |
2252 | - return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3)); |
|
2252 | + return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3)); |
|
2253 | 2253 | } |
2254 | 2254 | |
2255 | 2255 | /** |
2256 | 2256 | * @brief Return ruleset cache file path |
2257 | 2257 | * @param module, act |
2258 | 2258 | */ |
2259 | - function getValidatorFilePath($module, $ruleset, $mid=null) |
|
2259 | + function getValidatorFilePath($module, $ruleset, $mid = null) |
|
2260 | 2260 | { |
2261 | 2261 | // load dynamic ruleset xml file |
2262 | - if(strpos($ruleset, '@') !== false) |
|
2262 | + if (strpos($ruleset, '@') !== false) |
|
2263 | 2263 | { |
2264 | 2264 | $rulsetFile = str_replace('@', '', $ruleset); |
2265 | 2265 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
@@ -2269,20 +2269,20 @@ discard block |
||
2269 | 2269 | { |
2270 | 2270 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2271 | 2271 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2272 | - if(is_readable($xml_file)) |
|
2272 | + if (is_readable($xml_file)) |
|
2273 | 2273 | return FileHandler::getRealPath($xml_file); |
2274 | - else{ |
|
2274 | + else { |
|
2275 | 2275 | $ruleset = str_replace('#', '', $ruleset); |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | } |
2279 | 2279 | // Get a path of the requested module. Return if not exists. |
2280 | 2280 | $class_path = ModuleHandler::getModulePath($module); |
2281 | - if(!$class_path) return; |
|
2281 | + if (!$class_path) return; |
|
2282 | 2282 | |
2283 | 2283 | // Check if module.xml exists in the path. Return if not exist |
2284 | 2284 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2285 | - if(!file_exists($xml_file)) return; |
|
2285 | + if (!file_exists($xml_file)) return; |
|
2286 | 2286 | |
2287 | 2287 | return $xml_file; |
2288 | 2288 | } |
@@ -2294,7 +2294,7 @@ discard block |
||
2294 | 2294 | $requestVars = Context::getRequestVars(); |
2295 | 2295 | |
2296 | 2296 | $args = new stdClass; |
2297 | - $args->site_srl = (int)$requestVars->site_srl; |
|
2297 | + $args->site_srl = (int) $requestVars->site_srl; |
|
2298 | 2298 | $args->page = 1; // /< Page |
2299 | 2299 | $args->list_count = 100; // /< the number of posts to display on a single page |
2300 | 2300 | $args->page_count = 5; // /< the number of pages that appear in the page navigation |
@@ -2306,9 +2306,9 @@ discard block |
||
2306 | 2306 | |
2307 | 2307 | $list = array(); |
2308 | 2308 | |
2309 | - if($output->toBool()) |
|
2309 | + if ($output->toBool()) |
|
2310 | 2310 | { |
2311 | - foreach((array)$output->data as $code_info) |
|
2311 | + foreach ((array) $output->data as $code_info) |
|
2312 | 2312 | { |
2313 | 2313 | unset($codeInfo); |
2314 | 2314 | $codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value); |
@@ -19,26 +19,34 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function isIDExists($id, $site_srl = 0) |
21 | 21 | { |
22 | - if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; |
|
22 | + if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) { |
|
23 | + return true; |
|
24 | + } |
|
23 | 25 | // directory and rss/atom/api reserved checking, etc. |
24 | 26 | $dirs = FileHandler::readDir(_XE_PATH_); |
25 | 27 | $dirs[] = 'rss'; |
26 | 28 | $dirs[] = 'atom'; |
27 | 29 | $dirs[] = 'api'; |
28 | - if(in_array($id, $dirs)) return true; |
|
30 | + if(in_array($id, $dirs)) { |
|
31 | + return true; |
|
32 | + } |
|
29 | 33 | // mid test |
30 | 34 | $args = new stdClass(); |
31 | 35 | $args->mid = $id; |
32 | 36 | $args->site_srl = $site_srl; |
33 | 37 | $output = executeQuery('module.isExistsModuleName', $args); |
34 | - if($output->data->count) return true; |
|
38 | + if($output->data->count) { |
|
39 | + return true; |
|
40 | + } |
|
35 | 41 | // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) |
36 | 42 | if(!$site_srl) |
37 | 43 | { |
38 | 44 | $site_args = new stdClass(); |
39 | 45 | $site_args->domain = $id; |
40 | 46 | $output = executeQuery('module.isExistsSiteDomain', $site_args); |
41 | - if($output->data->count) return true; |
|
47 | + if($output->data->count) { |
|
48 | + return true; |
|
49 | + } |
|
42 | 50 | } |
43 | 51 | |
44 | 52 | return false; |
@@ -82,10 +90,14 @@ discard block |
||
82 | 90 | function getDefaultMid() |
83 | 91 | { |
84 | 92 | $default_url = Context::getDefaultUrl(); |
85 | - if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1); |
|
93 | + if($default_url && substr_compare($default_url, '/', -1) === 0) { |
|
94 | + $default_url = substr($default_url, 0, -1); |
|
95 | + } |
|
86 | 96 | |
87 | 97 | $request_url = Context::getRequestUri(); |
88 | - if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1); |
|
98 | + if($request_url && substr_compare($request_url, '/', -1) === 0) { |
|
99 | + $request_url = substr($request_url, 0, -1); |
|
100 | + } |
|
89 | 101 | |
90 | 102 | $default_url_parse = parse_url($default_url); |
91 | 103 | $request_url_parse = parse_url($request_url); |
@@ -100,14 +112,18 @@ discard block |
||
100 | 112 | $hostname = $request_url_parse['host']; |
101 | 113 | $path = $request_url_parse['path']; |
102 | 114 | $port = $request_url_parse['port']; |
103 | - if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1); |
|
115 | + if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) { |
|
116 | + $path = substr($path, 0, -1); |
|
117 | + } |
|
104 | 118 | |
105 | 119 | $domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port : '', $path); |
106 | 120 | } |
107 | 121 | |
108 | 122 | if($domain === '') |
109 | 123 | { |
110 | - if(!$vid) $vid = $mid; |
|
124 | + if(!$vid) { |
|
125 | + $vid = $mid; |
|
126 | + } |
|
111 | 127 | if($vid) |
112 | 128 | { |
113 | 129 | $domain = $vid; |
@@ -133,13 +149,17 @@ discard block |
||
133 | 149 | $output = executeQuery('module.getSiteInfoByDomain', $args); |
134 | 150 | $site_info = $output->data; |
135 | 151 | |
136 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info); |
|
152 | + if($oCacheHandler->isSupport()) { |
|
153 | + $oCacheHandler->put($domain_cache_key, $site_info); |
|
154 | + } |
|
137 | 155 | } |
138 | 156 | |
139 | 157 | if($site_info && $vid) |
140 | 158 | { |
141 | 159 | Context::set('vid', $site_info->domain, true); |
142 | - if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true); |
|
160 | + if(strtolower($mid)==strtolower($site_info->domain)) { |
|
161 | + Context::set('mid', $site_info->mid,true); |
|
162 | + } |
|
143 | 163 | } |
144 | 164 | if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); } |
145 | 165 | } |
@@ -165,8 +185,12 @@ discard block |
||
165 | 185 | { |
166 | 186 | // Create a table if sites table doesn't exist |
167 | 187 | $oDB = &DB::getInstance(); |
168 | - if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
169 | - if(!$oDB->isTableExists('sites')) return; |
|
188 | + if(!$oDB->isTableExists('sites')) { |
|
189 | + $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); |
|
190 | + } |
|
191 | + if(!$oDB->isTableExists('sites')) { |
|
192 | + return; |
|
193 | + } |
|
170 | 194 | |
171 | 195 | // Get mid, language |
172 | 196 | $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); |
@@ -184,21 +208,28 @@ discard block |
||
184 | 208 | if($output->data && !$output->data->index_module_srl) |
185 | 209 | { |
186 | 210 | $output = executeQuery('module.updateSite', $site_args); |
187 | - } |
|
188 | - else |
|
211 | + } else |
|
189 | 212 | { |
190 | 213 | $output = executeQuery('module.insertSite', $site_args); |
191 | - if(!$output->toBool()) return $output; |
|
214 | + if(!$output->toBool()) { |
|
215 | + return $output; |
|
216 | + } |
|
192 | 217 | } |
193 | 218 | $output = executeQuery('module.getSiteInfo', $args); |
194 | 219 | } |
195 | 220 | $site_info = $output->data; |
196 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info); |
|
221 | + if($oCacheHandler->isSupport()) { |
|
222 | + $oCacheHandler->put($default_site_cache_key, $site_info); |
|
223 | + } |
|
197 | 224 | } |
198 | 225 | } |
199 | 226 | |
200 | - if(!$site_info->module_srl) return $site_info; |
|
201 | - if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0]; |
|
227 | + if(!$site_info->module_srl) { |
|
228 | + return $site_info; |
|
229 | + } |
|
230 | + if(is_array($site_info) && $site_info->data[0]) { |
|
231 | + $site_info = $site_info[0]; |
|
232 | + } |
|
202 | 233 | return $this->addModuleExtraVars($site_info); |
203 | 234 | } |
204 | 235 | |
@@ -248,7 +279,9 @@ discard block |
||
248 | 279 | } |
249 | 280 | |
250 | 281 | $this->applyDefaultSkin($module_info); |
251 | - if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0]; |
|
282 | + if(!$module_info->module_srl && $module_info->data[0]) { |
|
283 | + $module_info = $module_info->data[0]; |
|
284 | + } |
|
252 | 285 | return $this->addModuleExtraVars($module_info); |
253 | 286 | } |
254 | 287 | |
@@ -340,8 +373,7 @@ discard block |
||
340 | 373 | $object_key = 'mid_info:' . $output->data->module_srl; |
341 | 374 | $module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key); |
342 | 375 | $oCacheHandler->put($module_info_cache_key, $moduleInfo); |
343 | - } |
|
344 | - else |
|
376 | + } else |
|
345 | 377 | { |
346 | 378 | $mid_info->designSettings = $moduleInfo->designSettings; |
347 | 379 | $moduleInfo = $mid_info; |
@@ -382,11 +414,15 @@ discard block |
||
382 | 414 | $args = new stdClass(); |
383 | 415 | $args->module_srl = $module_srl; |
384 | 416 | $output = executeQuery('module.getMidInfo', $args); |
385 | - if(!$output->toBool()) return; |
|
417 | + if(!$output->toBool()) { |
|
418 | + return; |
|
419 | + } |
|
386 | 420 | |
387 | 421 | $mid_info = $output->data; |
388 | 422 | $this->applyDefaultSkin($mid_info); |
389 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info); |
|
423 | + if($oCacheHandler->isSupport()) { |
|
424 | + $oCacheHandler->put($cache_key, $mid_info); |
|
425 | + } |
|
390 | 426 | } |
391 | 427 | |
392 | 428 | if($mid_info && count($columnList)) |
@@ -399,8 +435,9 @@ discard block |
||
399 | 435 | $module_info->$key = $item; |
400 | 436 | } |
401 | 437 | } |
438 | + } else { |
|
439 | + $module_info = $mid_info; |
|
402 | 440 | } |
403 | - else $module_info = $mid_info; |
|
404 | 441 | |
405 | 442 | $oModuleController = getController('module'); |
406 | 443 | |
@@ -450,11 +487,15 @@ discard block |
||
450 | 487 | */ |
451 | 488 | function getModulesInfo($module_srls, $columnList = array()) |
452 | 489 | { |
453 | - if(is_array($module_srls)) $module_srls = implode(',',$module_srls); |
|
490 | + if(is_array($module_srls)) { |
|
491 | + $module_srls = implode(',',$module_srls); |
|
492 | + } |
|
454 | 493 | $args = new stdClass(); |
455 | 494 | $args->module_srls = $module_srls; |
456 | 495 | $output = executeQueryArray('module.getModulesInfo', $args, $columnList); |
457 | - if(!$output->toBool()) return; |
|
496 | + if(!$output->toBool()) { |
|
497 | + return; |
|
498 | + } |
|
458 | 499 | return $this->addModuleExtraVars($output->data); |
459 | 500 | } |
460 | 501 | |
@@ -464,31 +505,44 @@ discard block |
||
464 | 505 | function addModuleExtraVars($module_info) |
465 | 506 | { |
466 | 507 | // Process although one or more module informaion is requested |
467 | - if(!is_array($module_info)) $target_module_info = array($module_info); |
|
468 | - else $target_module_info = $module_info; |
|
508 | + if(!is_array($module_info)) { |
|
509 | + $target_module_info = array($module_info); |
|
510 | + } else { |
|
511 | + $target_module_info = $module_info; |
|
512 | + } |
|
469 | 513 | // Get module_srl |
470 | 514 | $module_srls = array(); |
471 | 515 | foreach($target_module_info as $key => $val) |
472 | 516 | { |
473 | 517 | $module_srl = $val->module_srl; |
474 | - if(!$module_srl) continue; |
|
518 | + if(!$module_srl) { |
|
519 | + continue; |
|
520 | + } |
|
475 | 521 | $module_srls[] = $val->module_srl; |
476 | 522 | } |
477 | 523 | // Extract extra information of the module and skin |
478 | 524 | $extra_vars = $this->getModuleExtraVars($module_srls); |
479 | - if(!count($module_srls) || !count($extra_vars)) return $module_info; |
|
525 | + if(!count($module_srls) || !count($extra_vars)) { |
|
526 | + return $module_info; |
|
527 | + } |
|
480 | 528 | |
481 | 529 | foreach($target_module_info as $key => $val) |
482 | 530 | { |
483 | - if(!$extra_vars[$val->module_srl] || !count(get_object_vars($extra_vars[$val->module_srl]))) continue; |
|
531 | + if(!$extra_vars[$val->module_srl] || !count(get_object_vars($extra_vars[$val->module_srl]))) { |
|
532 | + continue; |
|
533 | + } |
|
484 | 534 | foreach($extra_vars[$val->module_srl] as $k => $v) |
485 | 535 | { |
486 | - if($target_module_info[$key]->{$k}) continue; |
|
536 | + if($target_module_info[$key]->{$k}) { |
|
537 | + continue; |
|
538 | + } |
|
487 | 539 | $target_module_info[$key]->{$k} = $v; |
488 | 540 | } |
489 | 541 | } |
490 | 542 | |
491 | - if(is_array($module_info)) return $target_module_info; |
|
543 | + if(is_array($module_info)) { |
|
544 | + return $target_module_info; |
|
545 | + } |
|
492 | 546 | return $target_module_info[0]; |
493 | 547 | } |
494 | 548 | |
@@ -517,7 +571,9 @@ discard block |
||
517 | 571 | } |
518 | 572 | |
519 | 573 | $output = executeQuery('module.getMidList', $args, $columnList); |
520 | - if(!$output->toBool()) return $output; |
|
574 | + if(!$output->toBool()) { |
|
575 | + return $output; |
|
576 | + } |
|
521 | 577 | $list = $output->data; |
522 | 578 | |
523 | 579 | if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl)) |
@@ -525,9 +581,13 @@ discard block |
||
525 | 581 | $oCacheHandler->put($cache_key, $list); |
526 | 582 | } |
527 | 583 | } |
528 | - if(!$list) return; |
|
584 | + if(!$list) { |
|
585 | + return; |
|
586 | + } |
|
529 | 587 | |
530 | - if(!is_array($list)) $list = array($list); |
|
588 | + if(!is_array($list)) { |
|
589 | + $list = array($list); |
|
590 | + } |
|
531 | 591 | |
532 | 592 | foreach($list as $val) |
533 | 593 | { |
@@ -543,10 +603,14 @@ discard block |
||
543 | 603 | function getModuleSrlList($args = null, $columnList = array()) |
544 | 604 | { |
545 | 605 | $output = executeQueryArray('module.getMidList', $args, $columnList); |
546 | - if(!$output->toBool()) return $output; |
|
606 | + if(!$output->toBool()) { |
|
607 | + return $output; |
|
608 | + } |
|
547 | 609 | |
548 | 610 | $list = $output->data; |
549 | - if(!$list) return; |
|
611 | + if(!$list) { |
|
612 | + return; |
|
613 | + } |
|
550 | 614 | |
551 | 615 | return $list; |
552 | 616 | } |
@@ -556,20 +620,32 @@ discard block |
||
556 | 620 | */ |
557 | 621 | function getModuleSrlByMid($mid) |
558 | 622 | { |
559 | - if($mid && !is_array($mid)) $mid = explode(',',$mid); |
|
560 | - if(is_array($mid)) $mid = "'".implode("','",$mid)."'"; |
|
623 | + if($mid && !is_array($mid)) { |
|
624 | + $mid = explode(',',$mid); |
|
625 | + } |
|
626 | + if(is_array($mid)) { |
|
627 | + $mid = "'".implode("','",$mid)."'"; |
|
628 | + } |
|
561 | 629 | |
562 | 630 | $site_module_info = Context::get('site_module_info'); |
563 | 631 | |
564 | 632 | $args = new stdClass; |
565 | 633 | $args->mid = $mid; |
566 | - if($site_module_info) $args->site_srl = $site_module_info->site_srl; |
|
634 | + if($site_module_info) { |
|
635 | + $args->site_srl = $site_module_info->site_srl; |
|
636 | + } |
|
567 | 637 | $output = executeQuery('module.getModuleSrlByMid', $args); |
568 | - if(!$output->toBool()) return $output; |
|
638 | + if(!$output->toBool()) { |
|
639 | + return $output; |
|
640 | + } |
|
569 | 641 | |
570 | 642 | $list = $output->data; |
571 | - if(!$list) return; |
|
572 | - if(!is_array($list)) $list = array($list); |
|
643 | + if(!$list) { |
|
644 | + return; |
|
645 | + } |
|
646 | + if(!is_array($list)) { |
|
647 | + $list = array($list); |
|
648 | + } |
|
573 | 649 | |
574 | 650 | foreach($list as $key => $val) |
575 | 651 | { |
@@ -598,8 +674,12 @@ discard block |
||
598 | 674 | { |
599 | 675 | $args = new stdClass(); |
600 | 676 | $output = executeQueryArray('module.getActionForward',$args); |
601 | - if(!$output->toBool()) return new stdClass; |
|
602 | - if(!$output->data) $output->data = array(); |
|
677 | + if(!$output->toBool()) { |
|
678 | + return new stdClass; |
|
679 | + } |
|
680 | + if(!$output->data) { |
|
681 | + $output->data = array(); |
|
682 | + } |
|
603 | 683 | |
604 | 684 | $action_forward = array(); |
605 | 685 | foreach($output->data as $item) |
@@ -616,8 +696,7 @@ discard block |
||
616 | 696 | if($action_forward[$act]) |
617 | 697 | { |
618 | 698 | return $action_forward[$act]; |
619 | - } |
|
620 | - else |
|
699 | + } else |
|
621 | 700 | { |
622 | 701 | return new stdClass(); |
623 | 702 | } |
@@ -725,8 +804,7 @@ discard block |
||
725 | 804 | if(file_exists($cache_file)) |
726 | 805 | { |
727 | 806 | $GLOBALS['__MODULE_EXTEND__'] = include($cache_file); |
728 | - } |
|
729 | - else |
|
807 | + } else |
|
730 | 808 | { |
731 | 809 | $GLOBALS['__MODULE_EXTEND__'] = array(); |
732 | 810 | } |
@@ -742,16 +820,22 @@ discard block |
||
742 | 820 | { |
743 | 821 | // Get a path of the requested module. Return if not exists. |
744 | 822 | $module_path = ModuleHandler::getModulePath($module); |
745 | - if(!$module_path) return; |
|
823 | + if(!$module_path) { |
|
824 | + return; |
|
825 | + } |
|
746 | 826 | // Read the xml file for module skin information |
747 | 827 | $xml_file = sprintf("%s/conf/info.xml", $module_path); |
748 | - if(!file_exists($xml_file)) return; |
|
828 | + if(!file_exists($xml_file)) { |
|
829 | + return; |
|
830 | + } |
|
749 | 831 | |
750 | 832 | $oXmlParser = new XmlParser(); |
751 | 833 | $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); |
752 | 834 | $xml_obj = $tmp_xml_obj->module; |
753 | 835 | |
754 | - if(!$xml_obj) return; |
|
836 | + if(!$xml_obj) { |
|
837 | + return; |
|
838 | + } |
|
755 | 839 | |
756 | 840 | // Module Information |
757 | 841 | $module_info = new stdClass(); |
@@ -763,14 +847,19 @@ discard block |
||
763 | 847 | $module_info->version = $xml_obj->version->body; |
764 | 848 | $module_info->homepage = $xml_obj->link->body; |
765 | 849 | $module_info->category = $xml_obj->category->body; |
766 | - if(!$module_info->category) $module_info->category = 'service'; |
|
850 | + if(!$module_info->category) { |
|
851 | + $module_info->category = 'service'; |
|
852 | + } |
|
767 | 853 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
768 | 854 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
769 | 855 | $module_info->license = $xml_obj->license->body; |
770 | 856 | $module_info->license_link = $xml_obj->license->attrs->link; |
771 | 857 | |
772 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
773 | - else $author_list = $xml_obj->author; |
|
858 | + if(!is_array($xml_obj->author)) { |
|
859 | + $author_list[] = $xml_obj->author; |
|
860 | + } else { |
|
861 | + $author_list = $xml_obj->author; |
|
862 | + } |
|
774 | 863 | |
775 | 864 | foreach($author_list as $author) |
776 | 865 | { |
@@ -780,15 +869,16 @@ discard block |
||
780 | 869 | $author_obj->homepage = $author->attrs->link; |
781 | 870 | $module_info->author[] = $author_obj; |
782 | 871 | } |
783 | - } |
|
784 | - else |
|
872 | + } else |
|
785 | 873 | { |
786 | 874 | // module format 0.1 |
787 | 875 | $module_info->title = $xml_obj->title->body; |
788 | 876 | $module_info->description = $xml_obj->author->description->body; |
789 | 877 | $module_info->version = $xml_obj->attrs->version; |
790 | 878 | $module_info->category = $xml_obj->attrs->category; |
791 | - if(!$module_info->category) $module_info->category = 'service'; |
|
879 | + if(!$module_info->category) { |
|
880 | + $module_info->category = 'service'; |
|
881 | + } |
|
792 | 882 | sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); |
793 | 883 | $module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
794 | 884 | $author_obj = new stdClass(); |
@@ -817,11 +907,15 @@ discard block |
||
817 | 907 | { |
818 | 908 | // Get a path of the requested module. Return if not exists. |
819 | 909 | $class_path = ModuleHandler::getModulePath($module); |
820 | - if(!$class_path) return; |
|
910 | + if(!$class_path) { |
|
911 | + return; |
|
912 | + } |
|
821 | 913 | |
822 | 914 | // Check if module.xml exists in the path. Return if not exist |
823 | 915 | $xml_file = sprintf("%sconf/module.xml", $class_path); |
824 | - if(!file_exists($xml_file)) return; |
|
916 | + if(!file_exists($xml_file)) { |
|
917 | + return; |
|
918 | + } |
|
825 | 919 | |
826 | 920 | // Check if cached file exists |
827 | 921 | $cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__); |
@@ -840,7 +934,10 @@ discard block |
||
840 | 934 | |
841 | 935 | $xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object |
842 | 936 | |
843 | - if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml |
|
937 | + if(!count($xml_obj->module)) { |
|
938 | + return; |
|
939 | + } |
|
940 | + // /< Error occurs if module tag doesn't included in the xml |
|
844 | 941 | |
845 | 942 | $grants = $xml_obj->module->grants->grant; // /< Permission information |
846 | 943 | $permissions = $xml_obj->module->permissions->permission; // /< Acting permission |
@@ -852,8 +949,11 @@ discard block |
||
852 | 949 | // Arrange permission information |
853 | 950 | if($grants) |
854 | 951 | { |
855 | - if(is_array($grants)) $grant_list = $grants; |
|
856 | - else $grant_list[] = $grants; |
|
952 | + if(is_array($grants)) { |
|
953 | + $grant_list = $grants; |
|
954 | + } else { |
|
955 | + $grant_list[] = $grants; |
|
956 | + } |
|
857 | 957 | |
858 | 958 | $info->grant = new stdClass(); |
859 | 959 | $buff[] = '$info->grant = new stdClass;'; |
@@ -875,8 +975,11 @@ discard block |
||
875 | 975 | // Permissions to grant |
876 | 976 | if($permissions) |
877 | 977 | { |
878 | - if(is_array($permissions)) $permission_list = $permissions; |
|
879 | - else $permission_list[] = $permissions; |
|
978 | + if(is_array($permissions)) { |
|
979 | + $permission_list = $permissions; |
|
980 | + } else { |
|
981 | + $permission_list[] = $permissions; |
|
982 | + } |
|
880 | 983 | |
881 | 984 | $buff[] = '$info->permission = new stdClass;'; |
882 | 985 | |
@@ -894,8 +997,11 @@ discard block |
||
894 | 997 | // for admin menus |
895 | 998 | if($menus) |
896 | 999 | { |
897 | - if(is_array($menus)) $menu_list = $menus; |
|
898 | - else $menu_list[] = $menus; |
|
1000 | + if(is_array($menus)) { |
|
1001 | + $menu_list = $menus; |
|
1002 | + } else { |
|
1003 | + $menu_list[] = $menus; |
|
1004 | + } |
|
899 | 1005 | |
900 | 1006 | $buff[] = '$info->menu = new stdClass;'; |
901 | 1007 | $info->menu = new stdClass(); |
@@ -919,8 +1025,11 @@ discard block |
||
919 | 1025 | // actions |
920 | 1026 | if($actions) |
921 | 1027 | { |
922 | - if(is_array($actions)) $action_list = $actions; |
|
923 | - else $action_list[] = $actions; |
|
1028 | + if(is_array($actions)) { |
|
1029 | + $action_list = $actions; |
|
1030 | + } else { |
|
1031 | + $action_list[] = $actions; |
|
1032 | + } |
|
924 | 1033 | |
925 | 1034 | $buff[] = '$info->action = new stdClass;'; |
926 | 1035 | $info->action = new stdClass(); |
@@ -1012,7 +1121,9 @@ discard block |
||
1012 | 1121 | return $info; |
1013 | 1122 | } |
1014 | 1123 | |
1015 | - if(file_exists($cache_file)) return include($cache_file); |
|
1124 | + if(file_exists($cache_file)) { |
|
1125 | + return include($cache_file); |
|
1126 | + } |
|
1016 | 1127 | } |
1017 | 1128 | |
1018 | 1129 | /** |
@@ -1050,7 +1161,9 @@ discard block |
||
1050 | 1161 | |
1051 | 1162 | $skin_path = sprintf("%s/%s/", $path, $dir); |
1052 | 1163 | $list = FileHandler::readDir($skin_path); |
1053 | - if(!count($list)) return; |
|
1164 | + if(!count($list)) { |
|
1165 | + return; |
|
1166 | + } |
|
1054 | 1167 | |
1055 | 1168 | natcasesort($list); |
1056 | 1169 | |
@@ -1104,8 +1217,7 @@ discard block |
||
1104 | 1217 | if($dir == 'skins') |
1105 | 1218 | { |
1106 | 1219 | $type = 'P'; |
1107 | - } |
|
1108 | - else |
|
1220 | + } else |
|
1109 | 1221 | { |
1110 | 1222 | $type = 'M'; |
1111 | 1223 | } |
@@ -1133,14 +1245,20 @@ discard block |
||
1133 | 1245 | function loadSkinInfo($path, $skin, $dir = 'skins') |
1134 | 1246 | { |
1135 | 1247 | // Read xml file having skin information |
1136 | - if(substr($path,-1)!='/') $path .= '/'; |
|
1248 | + if(substr($path,-1)!='/') { |
|
1249 | + $path .= '/'; |
|
1250 | + } |
|
1137 | 1251 | $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); |
1138 | - if(!file_exists($skin_xml_file)) return; |
|
1252 | + if(!file_exists($skin_xml_file)) { |
|
1253 | + return; |
|
1254 | + } |
|
1139 | 1255 | // Create XmlParser object |
1140 | 1256 | $oXmlParser = new XmlParser(); |
1141 | 1257 | $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); |
1142 | 1258 | // Return if no skin information is |
1143 | - if(!$_xml_obj->skin) return; |
|
1259 | + if(!$_xml_obj->skin) { |
|
1260 | + return; |
|
1261 | + } |
|
1144 | 1262 | $xml_obj = $_xml_obj->skin; |
1145 | 1263 | // Skin Name |
1146 | 1264 | $skin_info = new stdClass(); |
@@ -1157,8 +1275,11 @@ discard block |
||
1157 | 1275 | $skin_info->license_link = $xml_obj->license->attrs->link; |
1158 | 1276 | $skin_info->description = $xml_obj->description->body; |
1159 | 1277 | |
1160 | - if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; |
|
1161 | - else $author_list = $xml_obj->author; |
|
1278 | + if(!is_array($xml_obj->author)) { |
|
1279 | + $author_list[] = $xml_obj->author; |
|
1280 | + } else { |
|
1281 | + $author_list = $xml_obj->author; |
|
1282 | + } |
|
1162 | 1283 | |
1163 | 1284 | foreach($author_list as $author) |
1164 | 1285 | { |
@@ -1172,8 +1293,12 @@ discard block |
||
1172 | 1293 | if($xml_obj->extra_vars) |
1173 | 1294 | { |
1174 | 1295 | $extra_var_groups = $xml_obj->extra_vars->group; |
1175 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1176 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1296 | + if(!$extra_var_groups) { |
|
1297 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1298 | + } |
|
1299 | + if(!is_array($extra_var_groups)) { |
|
1300 | + $extra_var_groups = array($extra_var_groups); |
|
1301 | + } |
|
1177 | 1302 | |
1178 | 1303 | foreach($extra_var_groups as $group) |
1179 | 1304 | { |
@@ -1182,7 +1307,9 @@ discard block |
||
1182 | 1307 | { |
1183 | 1308 | continue; |
1184 | 1309 | } |
1185 | - if(!is_array($group->var)) $extra_vars = array($group->var); |
|
1310 | + if(!is_array($group->var)) { |
|
1311 | + $extra_vars = array($group->var); |
|
1312 | + } |
|
1186 | 1313 | |
1187 | 1314 | foreach($extra_vars as $key => $val) |
1188 | 1315 | { |
@@ -1209,8 +1336,7 @@ discard block |
||
1209 | 1336 | $obj->options[$i]->title = $val->options[$i]->title->body; |
1210 | 1337 | $obj->options[$i]->value = $val->options[$i]->attrs->value; |
1211 | 1338 | } |
1212 | - } |
|
1213 | - else |
|
1339 | + } else |
|
1214 | 1340 | { |
1215 | 1341 | $obj->options[0] = new stdClass(); |
1216 | 1342 | $obj->options[0]->title = $val->options->title->body; |
@@ -1221,8 +1347,7 @@ discard block |
||
1221 | 1347 | } |
1222 | 1348 | } |
1223 | 1349 | } |
1224 | - } |
|
1225 | - else |
|
1350 | + } else |
|
1226 | 1351 | { |
1227 | 1352 | // skin format v0.1 |
1228 | 1353 | sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
@@ -1240,8 +1365,12 @@ discard block |
||
1240 | 1365 | $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; |
1241 | 1366 | // Variables used in the skin |
1242 | 1367 | $extra_var_groups = $xml_obj->extra_vars->group; |
1243 | - if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; |
|
1244 | - if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); |
|
1368 | + if(!$extra_var_groups) { |
|
1369 | + $extra_var_groups = $xml_obj->extra_vars; |
|
1370 | + } |
|
1371 | + if(!is_array($extra_var_groups)) { |
|
1372 | + $extra_var_groups = array($extra_var_groups); |
|
1373 | + } |
|
1245 | 1374 | |
1246 | 1375 | foreach($extra_var_groups as $group) |
1247 | 1376 | { |
@@ -1249,7 +1378,9 @@ discard block |
||
1249 | 1378 | |
1250 | 1379 | if($extra_vars) |
1251 | 1380 | { |
1252 | - if(!is_array($extra_vars)) $extra_vars = array($extra_vars); |
|
1381 | + if(!is_array($extra_vars)) { |
|
1382 | + $extra_vars = array($extra_vars); |
|
1383 | + } |
|
1253 | 1384 | |
1254 | 1385 | foreach($extra_vars as $var) |
1255 | 1386 | { |
@@ -1271,8 +1402,7 @@ discard block |
||
1271 | 1402 | $options[$i]->title = $var->default[$i]->body; |
1272 | 1403 | $options[$i]->value = $var->default[$i]->body; |
1273 | 1404 | } |
1274 | - } |
|
1275 | - else |
|
1405 | + } else |
|
1276 | 1406 | { |
1277 | 1407 | $options[0]->title = $var->default->body; |
1278 | 1408 | $options[0]->value = $var->default->body; |
@@ -1302,7 +1432,9 @@ discard block |
||
1302 | 1432 | $colorset = $xml_obj->colorset->color; |
1303 | 1433 | if($colorset) |
1304 | 1434 | { |
1305 | - if(!is_array($colorset)) $colorset = array($colorset); |
|
1435 | + if(!is_array($colorset)) { |
|
1436 | + $colorset = array($colorset); |
|
1437 | + } |
|
1306 | 1438 | |
1307 | 1439 | foreach($colorset as $color) |
1308 | 1440 | { |
@@ -1312,9 +1444,12 @@ discard block |
||
1312 | 1444 | if($screenshot) |
1313 | 1445 | { |
1314 | 1446 | $screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot); |
1315 | - if(!file_exists($screenshot)) $screenshot = ""; |
|
1447 | + if(!file_exists($screenshot)) { |
|
1448 | + $screenshot = ""; |
|
1449 | + } |
|
1450 | + } else { |
|
1451 | + $screenshot = ""; |
|
1316 | 1452 | } |
1317 | - else $screenshot = ""; |
|
1318 | 1453 | |
1319 | 1454 | $obj = new stdClass(); |
1320 | 1455 | $obj->name = $name; |
@@ -1327,7 +1462,9 @@ discard block |
||
1327 | 1462 | if($xml_obj->menus->menu) |
1328 | 1463 | { |
1329 | 1464 | $menus = $xml_obj->menus->menu; |
1330 | - if(!is_array($menus)) $menus = array($menus); |
|
1465 | + if(!is_array($menus)) { |
|
1466 | + $menus = array($menus); |
|
1467 | + } |
|
1331 | 1468 | |
1332 | 1469 | $menu_count = count($menus); |
1333 | 1470 | $skin_info->menu_count = $menu_count; |
@@ -1336,7 +1473,9 @@ discard block |
||
1336 | 1473 | unset($obj); |
1337 | 1474 | |
1338 | 1475 | $obj->name = $menus[$i]->attrs->name; |
1339 | - if($menus[$i]->attrs->default == "true") $obj->default = true; |
|
1476 | + if($menus[$i]->attrs->default == "true") { |
|
1477 | + $obj->default = true; |
|
1478 | + } |
|
1340 | 1479 | $obj->title = $menus[$i]->title->body; |
1341 | 1480 | $obj->maxdepth = $menus[$i]->maxdepth->body; |
1342 | 1481 | |
@@ -1356,7 +1495,9 @@ discard block |
||
1356 | 1495 | { |
1357 | 1496 | $args = new stdClass; |
1358 | 1497 | $args->site_srl = $site_srl; |
1359 | - if(!is_null($module)) $args->module = $module; |
|
1498 | + if(!is_null($module)) { |
|
1499 | + $args->module = $module; |
|
1500 | + } |
|
1360 | 1501 | $output = executeQuery('module.getModuleCount', $args); |
1361 | 1502 | return $output->data->count; |
1362 | 1503 | } |
@@ -1385,8 +1526,11 @@ discard block |
||
1385 | 1526 | $args->module = $module; |
1386 | 1527 | $args->site_srl = $site_srl; |
1387 | 1528 | $output = executeQuery('module.getModuleConfig', $args); |
1388 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1389 | - else $config = null; |
|
1529 | + if($output->data->config) { |
|
1530 | + $config = unserialize($output->data->config); |
|
1531 | + } else { |
|
1532 | + $config = null; |
|
1533 | + } |
|
1390 | 1534 | |
1391 | 1535 | //insert in cache |
1392 | 1536 | if($oCacheHandler->isSupport()) |
@@ -1425,8 +1569,11 @@ discard block |
||
1425 | 1569 | $args->module = $module; |
1426 | 1570 | $args->module_srl = $module_srl; |
1427 | 1571 | $output = executeQuery('module.getModulePartConfig', $args); |
1428 | - if($output->data->config) $config = unserialize($output->data->config); |
|
1429 | - else $config = null; |
|
1572 | + if($output->data->config) { |
|
1573 | + $config = unserialize($output->data->config); |
|
1574 | + } else { |
|
1575 | + $config = null; |
|
1576 | + } |
|
1430 | 1577 | |
1431 | 1578 | //insert in cache |
1432 | 1579 | if($oCacheHandler->isSupport()) |
@@ -1448,9 +1595,13 @@ discard block |
||
1448 | 1595 | { |
1449 | 1596 | $args = new stdClass(); |
1450 | 1597 | $args->module = $module; |
1451 | - if($site_srl) $args->site_srl = $site_srl; |
|
1598 | + if($site_srl) { |
|
1599 | + $args->site_srl = $site_srl; |
|
1600 | + } |
|
1452 | 1601 | $output = executeQueryArray('module.getModulePartConfigs', $args); |
1453 | - if(!$output->toBool() || !$output->data) return array(); |
|
1602 | + if(!$output->toBool() || !$output->data) { |
|
1603 | + return array(); |
|
1604 | + } |
|
1454 | 1605 | |
1455 | 1606 | foreach($output->data as $key => $val) |
1456 | 1607 | { |
@@ -1468,10 +1619,16 @@ discard block |
||
1468 | 1619 | $args->moduleCategorySrl = $moduleCategorySrl; |
1469 | 1620 | // Get data from the DB |
1470 | 1621 | $output = executeQuery('module.getModuleCategories', $args); |
1471 | - if(!$output->toBool()) return $output; |
|
1622 | + if(!$output->toBool()) { |
|
1623 | + return $output; |
|
1624 | + } |
|
1472 | 1625 | $list = $output->data; |
1473 | - if(!$list) return; |
|
1474 | - if(!is_array($list)) $list = array($list); |
|
1626 | + if(!$list) { |
|
1627 | + return; |
|
1628 | + } |
|
1629 | + if(!is_array($list)) { |
|
1630 | + $list = array($list); |
|
1631 | + } |
|
1475 | 1632 | |
1476 | 1633 | foreach($list as $val) |
1477 | 1634 | { |
@@ -1489,7 +1646,9 @@ discard block |
||
1489 | 1646 | $args = new stdClass; |
1490 | 1647 | $args->module_category_srl = $module_category_srl; |
1491 | 1648 | $output = executeQuery('module.getModuleCategory', $args); |
1492 | - if(!$output->toBool()) return $output; |
|
1649 | + if(!$output->toBool()) { |
|
1650 | + return $output; |
|
1651 | + } |
|
1493 | 1652 | return $output->data; |
1494 | 1653 | } |
1495 | 1654 | |
@@ -1501,7 +1660,9 @@ discard block |
||
1501 | 1660 | // Get a list of downloaded and installed modules |
1502 | 1661 | $searched_list = FileHandler::readDir('./modules'); |
1503 | 1662 | $searched_count = count($searched_list); |
1504 | - if(!$searched_count) return; |
|
1663 | + if(!$searched_count) { |
|
1664 | + return; |
|
1665 | + } |
|
1505 | 1666 | sort($searched_list); |
1506 | 1667 | |
1507 | 1668 | for($i=0;$i<$searched_count;$i++) |
@@ -1514,7 +1675,9 @@ discard block |
||
1514 | 1675 | $info = $this->getModuleInfoXml($module_name); |
1515 | 1676 | unset($obj); |
1516 | 1677 | |
1517 | - if(!isset($info)) continue; |
|
1678 | + if(!isset($info)) { |
|
1679 | + continue; |
|
1680 | + } |
|
1518 | 1681 | $info->module = $module_name; |
1519 | 1682 | $info->created_table_count = $created_table_count; |
1520 | 1683 | $info->table_count = $table_count; |
@@ -1540,11 +1703,16 @@ discard block |
||
1540 | 1703 | for($j=0;$j<count($tmp_files);$j++) |
1541 | 1704 | { |
1542 | 1705 | list($table_name) = explode(".",$tmp_files[$j]); |
1543 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1706 | + if($oDB->isTableExists($table_name)) { |
|
1707 | + $created_table_count ++; |
|
1708 | + } |
|
1544 | 1709 | } |
1545 | 1710 | // Check if DB is installed |
1546 | - if($table_count > $created_table_count) return true; |
|
1547 | - else return false; |
|
1711 | + if($table_count > $created_table_count) { |
|
1712 | + return true; |
|
1713 | + } else { |
|
1714 | + return false; |
|
1715 | + } |
|
1548 | 1716 | } |
1549 | 1717 | return false; |
1550 | 1718 | } |
@@ -1567,15 +1735,23 @@ discard block |
||
1567 | 1735 | */ |
1568 | 1736 | public function needUpdate($update_id) |
1569 | 1737 | { |
1570 | - if(!is_array($update_id)) $update_id = array($update_id); |
|
1738 | + if(!is_array($update_id)) { |
|
1739 | + $update_id = array($update_id); |
|
1740 | + } |
|
1571 | 1741 | |
1572 | 1742 | $args = new stdClass(); |
1573 | 1743 | $args->update_id = implode(',', $update_id); |
1574 | 1744 | $output = executeQueryArray('module.getModuleUpdateLog', $args); |
1575 | 1745 | |
1576 | - if(!!$output->error) return false; |
|
1577 | - if(!$output->data) $output->data = array(); |
|
1578 | - if(count($update_id) === count($output->data)) return false; |
|
1746 | + if(!!$output->error) { |
|
1747 | + return false; |
|
1748 | + } |
|
1749 | + if(!$output->data) { |
|
1750 | + $output->data = array(); |
|
1751 | + } |
|
1752 | + if(count($update_id) === count($output->data)) { |
|
1753 | + return false; |
|
1754 | + } |
|
1579 | 1755 | |
1580 | 1756 | return true; |
1581 | 1757 | } |
@@ -1592,7 +1768,9 @@ discard block |
||
1592 | 1768 | sort($searched_list); |
1593 | 1769 | |
1594 | 1770 | $searched_count = count($searched_list); |
1595 | - if(!$searched_count) return; |
|
1771 | + if(!$searched_count) { |
|
1772 | + return; |
|
1773 | + } |
|
1596 | 1774 | |
1597 | 1775 | for($i=0;$i<$searched_count;$i++) |
1598 | 1776 | { |
@@ -1600,7 +1778,9 @@ discard block |
||
1600 | 1778 | $module_name = $searched_list[$i]; |
1601 | 1779 | |
1602 | 1780 | $path = ModuleHandler::getModulePath($module_name); |
1603 | - if(!is_dir(FileHandler::getRealPath($path))) continue; |
|
1781 | + if(!is_dir(FileHandler::getRealPath($path))) { |
|
1782 | + continue; |
|
1783 | + } |
|
1604 | 1784 | |
1605 | 1785 | // Get the number of xml files to create a table in schemas |
1606 | 1786 | $tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/'); |
@@ -1610,13 +1790,17 @@ discard block |
||
1610 | 1790 | for($j=0;$j<$table_count;$j++) |
1611 | 1791 | { |
1612 | 1792 | list($table_name) = explode('.',$tmp_files[$j]); |
1613 | - if($oDB->isTableExists($table_name)) $created_table_count ++; |
|
1793 | + if($oDB->isTableExists($table_name)) { |
|
1794 | + $created_table_count ++; |
|
1795 | + } |
|
1614 | 1796 | } |
1615 | 1797 | // Get information of the module |
1616 | 1798 | $info = NULL; |
1617 | 1799 | $info = $this->getModuleInfoXml($module_name); |
1618 | 1800 | |
1619 | - if(!$info) continue; |
|
1801 | + if(!$info) { |
|
1802 | + continue; |
|
1803 | + } |
|
1620 | 1804 | |
1621 | 1805 | $info->module = $module_name; |
1622 | 1806 | $info->category = $info->category; |
@@ -1625,16 +1809,18 @@ discard block |
||
1625 | 1809 | $info->path = $path; |
1626 | 1810 | $info->admin_index_act = $info->admin_index_act; |
1627 | 1811 | // Check if DB is installed |
1628 | - if($table_count > $created_table_count) $info->need_install = true; |
|
1629 | - else $info->need_install = false; |
|
1812 | + if($table_count > $created_table_count) { |
|
1813 | + $info->need_install = true; |
|
1814 | + } else { |
|
1815 | + $info->need_install = false; |
|
1816 | + } |
|
1630 | 1817 | // Check if it is upgraded to module.class.php on each module |
1631 | 1818 | $oDummy = null; |
1632 | 1819 | $oDummy = getModule($module_name, 'class'); |
1633 | 1820 | if($oDummy && method_exists($oDummy, "checkUpdate")) |
1634 | 1821 | { |
1635 | 1822 | $info->need_update = $oDummy->checkUpdate(); |
1636 | - } |
|
1637 | - else |
|
1823 | + } else |
|
1638 | 1824 | { |
1639 | 1825 | continue; |
1640 | 1826 | } |
@@ -1651,7 +1837,9 @@ discard block |
||
1651 | 1837 | */ |
1652 | 1838 | function syncModuleToSite(&$data) |
1653 | 1839 | { |
1654 | - if(!$data) return; |
|
1840 | + if(!$data) { |
|
1841 | + return; |
|
1842 | + } |
|
1655 | 1843 | |
1656 | 1844 | if(is_array($data)) |
1657 | 1845 | { |
@@ -1659,9 +1847,10 @@ discard block |
||
1659 | 1847 | { |
1660 | 1848 | $module_srls[] = $val->module_srl; |
1661 | 1849 | } |
1662 | - if(!count($module_srls)) return; |
|
1663 | - } |
|
1664 | - else |
|
1850 | + if(!count($module_srls)) { |
|
1851 | + return; |
|
1852 | + } |
|
1853 | + } else |
|
1665 | 1854 | { |
1666 | 1855 | $module_srls[] = $data->module_srl; |
1667 | 1856 | } |
@@ -1669,7 +1858,9 @@ discard block |
||
1669 | 1858 | $args = new stdClass(); |
1670 | 1859 | $args->module_srls = implode(',',$module_srls); |
1671 | 1860 | $output = executeQueryArray('module.getModuleSites', $args); |
1672 | - if(!$output->data) return array(); |
|
1861 | + if(!$output->data) { |
|
1862 | + return array(); |
|
1863 | + } |
|
1673 | 1864 | foreach($output->data as $key => $val) |
1674 | 1865 | { |
1675 | 1866 | $modules[$val->module_srl] = $val; |
@@ -1681,8 +1872,7 @@ discard block |
||
1681 | 1872 | { |
1682 | 1873 | $data[$key]->domain = $modules[$val->module_srl]->domain; |
1683 | 1874 | } |
1684 | - } |
|
1685 | - else |
|
1875 | + } else |
|
1686 | 1876 | { |
1687 | 1877 | $data->domain = $modules[$data->module_srl]->domain; |
1688 | 1878 | } |
@@ -1693,24 +1883,31 @@ discard block |
||
1693 | 1883 | */ |
1694 | 1884 | function isSiteAdmin($member_info, $site_srl = null) |
1695 | 1885 | { |
1696 | - if(!$member_info->member_srl) return false; |
|
1697 | - if($member_info->is_admin == 'Y') return true; |
|
1886 | + if(!$member_info->member_srl) { |
|
1887 | + return false; |
|
1888 | + } |
|
1889 | + if($member_info->is_admin == 'Y') { |
|
1890 | + return true; |
|
1891 | + } |
|
1698 | 1892 | |
1699 | 1893 | $args = new stdClass(); |
1700 | 1894 | if(!isset($site_srl)) |
1701 | 1895 | { |
1702 | 1896 | $site_module_info = Context::get('site_module_info'); |
1703 | - if(!$site_module_info) return; |
|
1897 | + if(!$site_module_info) { |
|
1898 | + return; |
|
1899 | + } |
|
1704 | 1900 | $args->site_srl = $site_module_info->site_srl; |
1705 | - } |
|
1706 | - else |
|
1901 | + } else |
|
1707 | 1902 | { |
1708 | 1903 | $args->site_srl = $site_srl; |
1709 | 1904 | } |
1710 | 1905 | |
1711 | 1906 | $args->member_srl = $member_info->member_srl; |
1712 | 1907 | $output = executeQuery('module.isSiteAdmin', $args); |
1713 | - if($output->data->member_srl == $args->member_srl) return true; |
|
1908 | + if($output->data->member_srl == $args->member_srl) { |
|
1909 | + return true; |
|
1910 | + } |
|
1714 | 1911 | return false; |
1715 | 1912 | } |
1716 | 1913 | |
@@ -1733,7 +1930,9 @@ discard block |
||
1733 | 1930 | $obj = new stdClass(); |
1734 | 1931 | $obj->module_srl = $module_srl; |
1735 | 1932 | $output = executeQueryArray('module.getAdminID', $obj); |
1736 | - if(!$output->toBool() || !$output->data) return; |
|
1933 | + if(!$output->toBool() || !$output->data) { |
|
1934 | + return; |
|
1935 | + } |
|
1737 | 1936 | |
1738 | 1937 | return $output->data; |
1739 | 1938 | } |
@@ -1746,7 +1945,9 @@ discard block |
||
1746 | 1945 | { |
1747 | 1946 | $extra_vars = array(); |
1748 | 1947 | $get_module_srls = array(); |
1749 | - if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl); |
|
1948 | + if(!is_array($list_module_srl)) { |
|
1949 | + $list_module_srl = array($list_module_srl); |
|
1950 | + } |
|
1750 | 1951 | |
1751 | 1952 | $vars = false; |
1752 | 1953 | // cache controll |
@@ -1762,14 +1963,12 @@ discard block |
||
1762 | 1963 | if($vars) |
1763 | 1964 | { |
1764 | 1965 | $extra_vars[$module_srl] = $vars; |
1765 | - } |
|
1766 | - else |
|
1966 | + } else |
|
1767 | 1967 | { |
1768 | 1968 | $get_module_srls[] = $module_srl; |
1769 | 1969 | } |
1770 | 1970 | } |
1771 | - } |
|
1772 | - else |
|
1971 | + } else |
|
1773 | 1972 | { |
1774 | 1973 | $get_module_srls = $list_module_srl; |
1775 | 1974 | } |
@@ -1794,7 +1993,9 @@ discard block |
||
1794 | 1993 | } |
1795 | 1994 | foreach($output->data as $key => $val) |
1796 | 1995 | { |
1797 | - if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue; |
|
1996 | + if(in_array($val->name, array('mid','module')) || $val->value == 'Array') { |
|
1997 | + continue; |
|
1998 | + } |
|
1798 | 1999 | |
1799 | 2000 | if(!isset($extra_vars[$val->module_srl])) |
1800 | 2001 | { |
@@ -1833,7 +2034,9 @@ discard block |
||
1833 | 2034 | $args = new stdClass(); |
1834 | 2035 | $args->module_srl = $module_srl; |
1835 | 2036 | $output = executeQueryArray('module.getModuleSkinVars',$args); |
1836 | - if(!$output->toBool()) return; |
|
2037 | + if(!$output->toBool()) { |
|
2038 | + return; |
|
2039 | + } |
|
1837 | 2040 | |
1838 | 2041 | $skin_vars = array(); |
1839 | 2042 | foreach($output->data as $vars) |
@@ -1841,7 +2044,9 @@ discard block |
||
1841 | 2044 | $skin_vars[$vars->name] = $vars; |
1842 | 2045 | } |
1843 | 2046 | |
1844 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2047 | + if($oCacheHandler->isSupport()) { |
|
2048 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2049 | + } |
|
1845 | 2050 | } |
1846 | 2051 | |
1847 | 2052 | return $skin_vars; |
@@ -1853,7 +2058,9 @@ discard block |
||
1853 | 2058 | function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true) |
1854 | 2059 | { |
1855 | 2060 | $target = ($skin_type == 'M') ? 'mskin' : 'skin'; |
1856 | - if(!$site_srl) $site_srl = 0; |
|
2061 | + if(!$site_srl) { |
|
2062 | + $site_srl = 0; |
|
2063 | + } |
|
1857 | 2064 | |
1858 | 2065 | $designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl); |
1859 | 2066 | if(is_readable($designInfoFile)) |
@@ -1870,19 +2077,16 @@ discard block |
||
1870 | 2077 | if(is_dir($moduleSkinPath.'default')) |
1871 | 2078 | { |
1872 | 2079 | $skinName = 'default'; |
1873 | - } |
|
1874 | - else if(is_dir($moduleSkinPath.'xe_default')) |
|
2080 | + } else if(is_dir($moduleSkinPath.'xe_default')) |
|
1875 | 2081 | { |
1876 | 2082 | $skinName = 'xe_default'; |
1877 | - } |
|
1878 | - else |
|
2083 | + } else |
|
1879 | 2084 | { |
1880 | 2085 | $skins = FileHandler::readDir($moduleSkinPath); |
1881 | 2086 | if(count($skins) > 0) |
1882 | 2087 | { |
1883 | 2088 | $skinName = $skins[0]; |
1884 | - } |
|
1885 | - else |
|
2089 | + } else |
|
1886 | 2090 | { |
1887 | 2091 | $skinName = NULL; |
1888 | 2092 | } |
@@ -1890,7 +2094,9 @@ discard block |
||
1890 | 2094 | |
1891 | 2095 | if($updateCache && $skinName) |
1892 | 2096 | { |
1893 | - if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass(); |
|
2097 | + if(!isset($designInfo->module->{$module_name})) { |
|
2098 | + $designInfo->module->{$module_name} = new stdClass(); |
|
2099 | + } |
|
1894 | 2100 | $designInfo->module->{$module_name}->{$target} = $skinName; |
1895 | 2101 | |
1896 | 2102 | $oAdminController = getAdminController('admin'); |
@@ -1906,23 +2112,28 @@ discard block |
||
1906 | 2112 | */ |
1907 | 2113 | function syncSkinInfoToModuleInfo(&$module_info) |
1908 | 2114 | { |
1909 | - if(!$module_info->module_srl) return; |
|
2115 | + if(!$module_info->module_srl) { |
|
2116 | + return; |
|
2117 | + } |
|
1910 | 2118 | |
1911 | 2119 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
1912 | 2120 | if(Mobile::isFromMobilePhone()) |
1913 | 2121 | { |
1914 | 2122 | $skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl); |
1915 | - } |
|
1916 | - else |
|
2123 | + } else |
|
1917 | 2124 | { |
1918 | 2125 | $skin_vars = $this->getModuleSkinVars($module_info->module_srl); |
1919 | 2126 | } |
1920 | 2127 | |
1921 | - if(!$skin_vars) return; |
|
2128 | + if(!$skin_vars) { |
|
2129 | + return; |
|
2130 | + } |
|
1922 | 2131 | |
1923 | 2132 | foreach($skin_vars as $name => $val) |
1924 | 2133 | { |
1925 | - if(isset($module_info->{$name})) continue; |
|
2134 | + if(isset($module_info->{$name})) { |
|
2135 | + continue; |
|
2136 | + } |
|
1926 | 2137 | $module_info->{$name} = $val->value; |
1927 | 2138 | } |
1928 | 2139 | } |
@@ -1948,7 +2159,9 @@ discard block |
||
1948 | 2159 | $args = new stdClass(); |
1949 | 2160 | $args->module_srl = $module_srl; |
1950 | 2161 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1951 | - if(!$output->toBool() || !$output->data) return; |
|
2162 | + if(!$output->toBool() || !$output->data) { |
|
2163 | + return; |
|
2164 | + } |
|
1952 | 2165 | |
1953 | 2166 | $skin_vars = array(); |
1954 | 2167 | foreach($output->data as $vars) |
@@ -1956,7 +2169,9 @@ discard block |
||
1956 | 2169 | $skin_vars[$vars->name] = $vars; |
1957 | 2170 | } |
1958 | 2171 | |
1959 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2172 | + if($oCacheHandler->isSupport()) { |
|
2173 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2174 | + } |
|
1960 | 2175 | } |
1961 | 2176 | |
1962 | 2177 | return $skin_vars; |
@@ -1968,7 +2183,9 @@ discard block |
||
1968 | 2183 | */ |
1969 | 2184 | function syncMobileSkinInfoToModuleInfo(&$module_info) |
1970 | 2185 | { |
1971 | - if(!$module_info->module_srl) return; |
|
2186 | + if(!$module_info->module_srl) { |
|
2187 | + return; |
|
2188 | + } |
|
1972 | 2189 | $skin_vars = false; |
1973 | 2190 | // cache controll |
1974 | 2191 | $oCacheHandler = CacheHandler::getInstance('object', null, true); |
@@ -1983,17 +2200,25 @@ discard block |
||
1983 | 2200 | $args = new stdClass; |
1984 | 2201 | $args->module_srl = $module_info->module_srl; |
1985 | 2202 | $output = executeQueryArray('module.getModuleMobileSkinVars',$args); |
1986 | - if(!$output->toBool()) return; |
|
2203 | + if(!$output->toBool()) { |
|
2204 | + return; |
|
2205 | + } |
|
1987 | 2206 | $skin_vars = $output->data; |
1988 | 2207 | |
1989 | 2208 | //insert in cache |
1990 | - if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars); |
|
2209 | + if($oCacheHandler->isSupport()) { |
|
2210 | + $oCacheHandler->put($cache_key, $skin_vars); |
|
2211 | + } |
|
2212 | + } |
|
2213 | + if(!$skin_vars) { |
|
2214 | + return; |
|
1991 | 2215 | } |
1992 | - if(!$skin_vars) return; |
|
1993 | 2216 | |
1994 | 2217 | foreach($output->data as $val) |
1995 | 2218 | { |
1996 | - if(isset($module_info->{$val->name})) continue; |
|
2219 | + if(isset($module_info->{$val->name})) { |
|
2220 | + continue; |
|
2221 | + } |
|
1997 | 2222 | $module_info->{$val->name} = $val->value; |
1998 | 2223 | } |
1999 | 2224 | } |
@@ -2015,10 +2240,12 @@ discard block |
||
2015 | 2240 | $grant_info = $xml_info->grant; |
2016 | 2241 | if($member_info->member_srl) |
2017 | 2242 | { |
2018 | - if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list); |
|
2019 | - else $group_list = array(); |
|
2020 | - } |
|
2021 | - else |
|
2243 | + if(is_array($member_info->group_list)) { |
|
2244 | + $group_list = array_keys($member_info->group_list); |
|
2245 | + } else { |
|
2246 | + $group_list = array(); |
|
2247 | + } |
|
2248 | + } else |
|
2022 | 2249 | { |
2023 | 2250 | $group_list = array(); |
2024 | 2251 | } |
@@ -2032,8 +2259,7 @@ discard block |
||
2032 | 2259 | } |
2033 | 2260 | |
2034 | 2261 | $grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false; |
2035 | - } |
|
2036 | - else |
|
2262 | + } else |
|
2037 | 2263 | { |
2038 | 2264 | // If module_srl exists |
2039 | 2265 | // Get a type of granted permission |
@@ -2046,7 +2272,9 @@ discard block |
||
2046 | 2272 | $args->module_srl = $module_srl; |
2047 | 2273 | $args->member_srl = $member_info->member_srl; |
2048 | 2274 | $output = executeQuery('module.getModuleAdmin',$args); |
2049 | - if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true; |
|
2275 | + if($output->data && $output->data->member_srl == $member_info->member_srl) { |
|
2276 | + $grant->manager = true; |
|
2277 | + } |
|
2050 | 2278 | } |
2051 | 2279 | // If not an administrator, get information from the DB and grant manager privilege. |
2052 | 2280 | if(!$grant->manager) |
@@ -2056,8 +2284,7 @@ discard block |
||
2056 | 2284 | if($module_info->module == 'planet') |
2057 | 2285 | { |
2058 | 2286 | $output = executeQueryArray('module.getPlanetGrants', $args); |
2059 | - } |
|
2060 | - else |
|
2287 | + } else |
|
2061 | 2288 | { |
2062 | 2289 | $args = new stdClass; |
2063 | 2290 | $args->module_srl = $module_srl; |
@@ -2072,42 +2299,48 @@ discard block |
||
2072 | 2299 | foreach($output->data as $val) |
2073 | 2300 | { |
2074 | 2301 | $grant_exists[$val->name] = true; |
2075 | - if($granted[$val->name]) continue; |
|
2302 | + if($granted[$val->name]) { |
|
2303 | + continue; |
|
2304 | + } |
|
2076 | 2305 | // Log-in member only |
2077 | 2306 | if($val->group_srl == -1) |
2078 | 2307 | { |
2079 | 2308 | $granted[$val->name] = true; |
2080 | - if($member_info->member_srl) $grant->{$val->name} = true; |
|
2309 | + if($member_info->member_srl) { |
|
2310 | + $grant->{$val->name} = true; |
|
2311 | + } |
|
2081 | 2312 | // Site-joined member only |
2082 | - } |
|
2083 | - elseif($val->group_srl == -2) |
|
2313 | + } elseif($val->group_srl == -2) |
|
2084 | 2314 | { |
2085 | 2315 | $granted[$val->name] = true; |
2086 | 2316 | // Do not grant any permission for non-logged member |
2087 | - if(!$member_info->member_srl) $grant->{$val->name} = false; |
|
2317 | + if(!$member_info->member_srl) { |
|
2318 | + $grant->{$val->name} = false; |
|
2319 | + } |
|
2088 | 2320 | // Log-in member |
2089 | 2321 | else |
2090 | 2322 | { |
2091 | 2323 | $site_module_info = Context::get('site_module_info'); |
2092 | 2324 | // Permission granted if no information of the currently connected site exists |
2093 | - if(!$site_module_info->site_srl) $grant->{$val->name} = true; |
|
2325 | + if(!$site_module_info->site_srl) { |
|
2326 | + $grant->{$val->name} = true; |
|
2327 | + } |
|
2094 | 2328 | // Permission is not granted if information of the currently connected site exists |
2095 | - elseif(count($group_list)) $grant->{$val->name} = true; |
|
2329 | + elseif(count($group_list)) { |
|
2330 | + $grant->{$val->name} = true; |
|
2331 | + } |
|
2096 | 2332 | } |
2097 | 2333 | // All of non-logged members |
2098 | - } |
|
2099 | - elseif($val->group_srl == -3) |
|
2334 | + } elseif($val->group_srl == -3) |
|
2100 | 2335 | { |
2101 | 2336 | $granted[$val->name] = true; |
2102 | 2337 | $grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin); |
2103 | - } |
|
2104 | - elseif($val->group_srl == 0) |
|
2338 | + } elseif($val->group_srl == 0) |
|
2105 | 2339 | { |
2106 | 2340 | $granted[$val->name] = true; |
2107 | 2341 | $grant->{$val->name} = true; |
2108 | 2342 | // If a target is a group |
2109 | - } |
|
2110 | - else |
|
2343 | + } else |
|
2111 | 2344 | { |
2112 | 2345 | if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) |
2113 | 2346 | { |
@@ -2118,30 +2351,43 @@ discard block |
||
2118 | 2351 | } |
2119 | 2352 | } |
2120 | 2353 | // Separate processing for the virtual group access |
2121 | - if(!$grant_exists['access']) $grant->access = true; |
|
2354 | + if(!$grant_exists['access']) { |
|
2355 | + $grant->access = true; |
|
2356 | + } |
|
2122 | 2357 | if(count($grant_info)) |
2123 | 2358 | { |
2124 | 2359 | foreach($grant_info as $grant_name => $grant_item) |
2125 | 2360 | { |
2126 | - if($grant_exists[$grant_name]) continue; |
|
2361 | + if($grant_exists[$grant_name]) { |
|
2362 | + continue; |
|
2363 | + } |
|
2127 | 2364 | switch($grant_item->default) |
2128 | 2365 | { |
2129 | 2366 | case 'guest' : |
2130 | 2367 | $grant->{$grant_name} = true; |
2131 | 2368 | break; |
2132 | 2369 | case 'member' : |
2133 | - if($member_info->member_srl) $grant->{$grant_name} = true; |
|
2134 | - else $grant->{$grant_name} = false; |
|
2370 | + if($member_info->member_srl) { |
|
2371 | + $grant->{$grant_name} = true; |
|
2372 | + } else { |
|
2373 | + $grant->{$grant_name} = false; |
|
2374 | + } |
|
2135 | 2375 | break; |
2136 | 2376 | case 'site' : |
2137 | 2377 | $site_module_info = Context::get('site_module_info'); |
2138 | - if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true; |
|
2139 | - else $grant->{$grant_name} = false; |
|
2378 | + if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) { |
|
2379 | + $grant->{$grant_name} = true; |
|
2380 | + } else { |
|
2381 | + $grant->{$grant_name} = false; |
|
2382 | + } |
|
2140 | 2383 | break; |
2141 | 2384 | case 'manager' : |
2142 | 2385 | case 'root' : |
2143 | - if($member_info->is_admin == 'Y') $grant->{$grant_name} = true; |
|
2144 | - else $grant->{$grant_name} = false; |
|
2386 | + if($member_info->is_admin == 'Y') { |
|
2387 | + $grant->{$grant_name} = true; |
|
2388 | + } else { |
|
2389 | + $grant->{$grant_name} = false; |
|
2390 | + } |
|
2145 | 2391 | break; |
2146 | 2392 | } |
2147 | 2393 | } |
@@ -2217,16 +2463,22 @@ discard block |
||
2217 | 2463 | function getFileBoxListHtml() |
2218 | 2464 | { |
2219 | 2465 | $logged_info = Context::get('logged_info'); |
2220 | - if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted'); |
|
2466 | + if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) { |
|
2467 | + return new BaseObject(-1, 'msg_not_permitted'); |
|
2468 | + } |
|
2221 | 2469 | $link = parse_url($_SERVER["HTTP_REFERER"]); |
2222 | 2470 | $link_params = explode('&',$link['query']); |
2223 | 2471 | foreach ($link_params as $param) |
2224 | 2472 | { |
2225 | 2473 | $param = explode("=",$param); |
2226 | - if($param[0] == 'selected_widget') $selected_widget = $param[1]; |
|
2474 | + if($param[0] == 'selected_widget') { |
|
2475 | + $selected_widget = $param[1]; |
|
2476 | + } |
|
2227 | 2477 | } |
2228 | 2478 | $oWidgetModel = getModel('widget'); |
2229 | - if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2479 | + if($selected_widget) { |
|
2480 | + $widget_info = $oWidgetModel->getWidgetInfo($selected_widget); |
|
2481 | + } |
|
2230 | 2482 | Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple); |
2231 | 2483 | |
2232 | 2484 | $oModuleModel = getModel('module'); |
@@ -2234,7 +2486,9 @@ discard block |
||
2234 | 2486 | Context::set('filebox_list', $output->data); |
2235 | 2487 | |
2236 | 2488 | $page = Context::get('page'); |
2237 | - if (!$page) $page = 1; |
|
2489 | + if (!$page) { |
|
2490 | + $page = 1; |
|
2491 | + } |
|
2238 | 2492 | Context::set('page', $page); |
2239 | 2493 | Context::set('page_navigation', $output->page_navigation); |
2240 | 2494 | |
@@ -2264,25 +2518,28 @@ discard block |
||
2264 | 2518 | $rulsetFile = str_replace('@', '', $ruleset); |
2265 | 2519 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2266 | 2520 | return FileHandler::getRealPath($xml_file); |
2267 | - } |
|
2268 | - else if (strpos($ruleset, '#') !== false) |
|
2521 | + } else if (strpos($ruleset, '#') !== false) |
|
2269 | 2522 | { |
2270 | 2523 | $rulsetFile = str_replace('#', '', $ruleset).'.'.$mid; |
2271 | 2524 | $xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile); |
2272 | - if(is_readable($xml_file)) |
|
2273 | - return FileHandler::getRealPath($xml_file); |
|
2274 | - else{ |
|
2525 | + if(is_readable($xml_file)) { |
|
2526 | + return FileHandler::getRealPath($xml_file); |
|
2527 | + } else{ |
|
2275 | 2528 | $ruleset = str_replace('#', '', $ruleset); |
2276 | 2529 | } |
2277 | 2530 | |
2278 | 2531 | } |
2279 | 2532 | // Get a path of the requested module. Return if not exists. |
2280 | 2533 | $class_path = ModuleHandler::getModulePath($module); |
2281 | - if(!$class_path) return; |
|
2534 | + if(!$class_path) { |
|
2535 | + return; |
|
2536 | + } |
|
2282 | 2537 | |
2283 | 2538 | // Check if module.xml exists in the path. Return if not exist |
2284 | 2539 | $xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset); |
2285 | - if(!file_exists($xml_file)) return; |
|
2540 | + if(!file_exists($xml_file)) { |
|
2541 | + return; |
|
2542 | + } |
|
2286 | 2543 | |
2287 | 2544 | return $xml_file; |
2288 | 2545 | } |
@@ -2332,7 +2589,9 @@ discard block |
||
2332 | 2589 | function getLangByLangcode() |
2333 | 2590 | { |
2334 | 2591 | $langCode = Context::get('langCode'); |
2335 | - if (!$langCode) return; |
|
2592 | + if (!$langCode) { |
|
2593 | + return; |
|
2594 | + } |
|
2336 | 2595 | |
2337 | 2596 | $oModuleController = getController('module'); |
2338 | 2597 | $oModuleController->replaceDefinedLangCode($langCode); |