GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a47a81...50dc3a )
by gyeong-won
06:20
created
index.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * @brief Declare constants for generic use and for checking to avoid a direct call from the Web
34 34
  **/
35
-define('__XE__',   TRUE);
35
+define('__XE__', TRUE);
36 36
 /**
37 37
  * @brief Include the necessary configuration files
38 38
  **/
39
-require dirname(__FILE__) . '/config/config.inc.php';
39
+require dirname(__FILE__).'/config/config.inc.php';
40 40
 
41 41
 /**
42 42
  * @brief Initialize by creating Context object
@@ -48,18 +48,18 @@  discard block
 block discarded – undo
48 48
 /**
49 49
  * @brief If default_url is set and it is different from the current url, attempt to redirect for SSO authentication and then process the module
50 50
  **/
51
-if($oContext->checkSSO())
51
+if ($oContext->checkSSO())
52 52
 {
53 53
 	$oModuleHandler = new ModuleHandler();
54 54
 
55 55
 	try
56 56
 	{
57
-		if($oModuleHandler->init())
57
+		if ($oModuleHandler->init())
58 58
 		{
59 59
 			$oModuleHandler->displayContent($oModuleHandler->procModule());
60 60
 		}
61 61
 	}
62
-	catch(Exception $e)
62
+	catch (Exception $e)
63 63
 	{
64 64
 		htmlHeader();
65 65
 		echo Context::getLang($e->getMessage());
Please login to merge, or discard this patch.
modules/comment/comment.item.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	function _loadFromDB()
51 51
 	{
52
-		if(!$this->comment_srl)
52
+		if (!$this->comment_srl)
53 53
 		{
54 54
 			return;
55 55
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	function setAttribute($attribute)
69 69
 	{
70
-		if(!$attribute->comment_srl)
70
+		if (!$attribute->comment_srl)
71 71
 		{
72 72
 			$this->comment_srl = NULL;
73 73
 			return;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		$this->adds($attribute);
78 78
 
79 79
 		// define vars on the object for backward compatibility of skins
80
-		if(count($attribute))
80
+		if (count($attribute))
81 81
 		{
82
-			foreach($attribute as $key => $val)
82
+			foreach ($attribute as $key => $val)
83 83
 			{
84 84
 				$this->{$key} = $val;
85 85
 			}
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 
94 94
 	function isGranted()
95 95
 	{
96
-		if($_SESSION['own_comment'][$this->comment_srl])
96
+		if ($_SESSION['own_comment'][$this->comment_srl])
97 97
 		{
98 98
 			return TRUE;
99 99
 		}
100 100
 
101
-		if(!Context::get('is_logged'))
101
+		if (!Context::get('is_logged'))
102 102
 		{
103 103
 			return FALSE;
104 104
 		}
105 105
 
106 106
 		$logged_info = Context::get('logged_info');
107
-		if($logged_info->is_admin == 'Y')
107
+		if ($logged_info->is_admin == 'Y')
108 108
 		{
109 109
 			return TRUE;
110 110
 		}
111 111
 
112 112
 		$grant = Context::get('grant');
113
-		if($grant->manager)
113
+		if ($grant->manager)
114 114
 		{
115 115
 			return TRUE;
116 116
 		}
117 117
 
118
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
118
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
119 119
 		{
120 120
 			return TRUE;
121 121
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 	function isEditable()
138 138
 	{
139
-		if($this->isGranted() || !$this->get('member_srl'))
139
+		if ($this->isGranted() || !$this->get('member_srl'))
140 140
 		{
141 141
 			return TRUE;
142 142
 		}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 
151 151
 	function isAccessible()
152 152
 	{
153
-		if($_SESSION['accessibled_comment'][$this->comment_srl])
153
+		if ($_SESSION['accessibled_comment'][$this->comment_srl])
154 154
 		{
155 155
 			return TRUE;
156 156
 		}
157 157
 
158
-		if($this->isGranted() || !$this->isSecret())
158
+		if ($this->isGranted() || !$this->isSecret())
159 159
 		{
160 160
 			$this->setAccessible();
161 161
 			return TRUE;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oDocumentModel = getModel('document');
165 165
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
166
-		if($oDocument->isGranted())
166
+		if ($oDocument->isGranted())
167 167
 		{
168 168
 			$this->setAccessible();
169 169
 			return TRUE;
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
 	function notify($type, $content)
185 185
 	{
186 186
 		// return if not useNotify
187
-		if(!$this->useNotify())
187
+		if (!$this->useNotify())
188 188
 		{
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		// pass if the author is not logged-in user 
193
-		if(!$this->get('member_srl'))
193
+		if (!$this->get('member_srl'))
194 194
 		{
195 195
 			return;
196 196
 		}
197 197
 
198 198
 		// return if the currently logged-in user is an author of the comment.
199 199
 		$logged_info = Context::get('logged_info');
200
-		if($logged_info->member_srl == $this->get('member_srl'))
200
+		if ($logged_info->member_srl == $this->get('member_srl'))
201 201
 		{
202 202
 			return;
203 203
 		}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
208 208
 
209 209
 		// Variables
210
-		if($type)
210
+		if ($type)
211 211
 		{
212
-			$title = "[" . $type . "] ";
212
+			$title = "[".$type."] ";
213 213
 		}
214 214
 
215 215
 		$title .= cut_str(strip_tags($content), 30, '...');
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 
225 225
 	function getIpAddress()
226 226
 	{
227
-		if($this->isGranted())
227
+		if ($this->isGranted())
228 228
 		{
229 229
 			return $this->get('ipaddress');
230 230
 		}
231 231
 
232
-		return '*' . strstr($this->get('ipaddress'), '.');
232
+		return '*'.strstr($this->get('ipaddress'), '.');
233 233
 	}
234 234
 
235 235
 	function isExistsHomepage()
236 236
 	{
237
-		if(trim($this->get('homepage')))
237
+		if (trim($this->get('homepage')))
238 238
 		{
239 239
 			return TRUE;
240 240
 		}
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 	function getHomepageUrl()
246 246
 	{
247 247
 		$url = trim($this->get('homepage'));
248
-		if(!$url)
248
+		if (!$url)
249 249
 		{
250 250
 			return;
251 251
 		}
252 252
 
253
-		if(strncasecmp('http://', $url, 7) !== 0)
253
+		if (strncasecmp('http://', $url, 7) !== 0)
254 254
 		{
255
-			$url = "http://" . $url;
255
+			$url = "http://".$url;
256 256
 		}
257 257
 
258 258
 		return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function getContentText($strlen = 0)
286 286
 	{
287
-		if($this->isSecret() && !$this->isAccessible())
287
+		if ($this->isSecret() && !$this->isAccessible())
288 288
 		{
289 289
 			return Context::getLang('msg_is_secret');
290 290
 		}
291 291
 
292 292
 		$content = $this->get('content');
293 293
 
294
-		if($strlen)
294
+		if ($strlen)
295 295
 		{
296 296
 			return cut_str(strip_tags($content), $strlen, '...');
297 297
 		}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE)
307 307
 	{
308
-		if($this->isSecret() && !$this->isAccessible())
308
+		if ($this->isSecret() && !$this->isAccessible())
309 309
 		{
310 310
 			return Context::getLang('msg_is_secret');
311 311
 		}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		stripEmbedTagForAdmin($content, $this->get('member_srl'));
315 315
 
316 316
 		// when displaying the comment on the pop-up menu
317
-		if($add_popup_menu && Context::get('is_logged'))
317
+		if ($add_popup_menu && Context::get('is_logged'))
318 318
 		{
319 319
 			$content = sprintf(
320 320
 					'%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do')
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 		}
323 323
 
324 324
 		// if additional information which can access contents is set
325
-		if($add_content_info)
325
+		if ($add_content_info)
326 326
 		{
327 327
 			$memberSrl = $this->get('member_srl');
328
-			if($memberSrl < 0)
328
+			if ($memberSrl < 0)
329 329
 			{
330 330
 				$memberSrl = 0;
331 331
 			}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 		else
338 338
 		{
339
-			if($add_xe_content_class)
339
+			if ($add_xe_content_class)
340 340
 			{
341 341
 				$content = sprintf('<div class="xe_content">%s</div>', $content);
342 342
 			}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 	function getRegdateGM()
398 398
 	{
399
-		return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone'];
399
+		return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
400 400
 	}
401 401
 
402 402
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 	function getPermanentUrl()
408 408
 	{
409
-		return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl');
409
+		return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl');
410 410
 	}
411 411
 
412 412
 	function getUpdateTime()
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
 	function hasUploadedFiles()
429 429
 	{
430
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
430
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
431 431
 		{
432 432
 			return FALSE;
433 433
 		}
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 
437 437
 	function getUploadedFiles()
438 438
 	{
439
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
439
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
440 440
 		{
441 441
 			return;
442 442
 		}
443 443
 
444
-		if(!$this->get('uploaded_count'))
444
+		if (!$this->get('uploaded_count'))
445 445
 		{
446 446
 			return;
447 447
 		}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	function getEditor()
459 459
 	{
460 460
 		$module_srl = $this->get('module_srl');
461
-		if(!$module_srl)
461
+		if (!$module_srl)
462 462
 		{
463 463
 			$module_srl = Context::get('module_srl');
464 464
 		}
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	function getProfileImage()
474 474
 	{
475
-		if(!$this->isExists() || !$this->get('member_srl'))
475
+		if (!$this->isExists() || !$this->get('member_srl'))
476 476
 		{
477 477
 			return;
478 478
 		}
479 479
 		$oMemberModel = getModel('member');
480 480
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
481
-		if(!$profile_info)
481
+		if (!$profile_info)
482 482
 		{
483 483
 			return;
484 484
 		}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	function getSignature()
494 494
 	{
495 495
 		// pass if the posting not exists.
496
-		if(!$this->isExists() || !$this->get('member_srl'))
496
+		if (!$this->isExists() || !$this->get('member_srl'))
497 497
 		{
498 498
 			return;
499 499
 		}
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
504 504
 
505 505
 		// check if max height of the signiture is specified on the member module
506
-		if(!isset($GLOBALS['__member_signature_max_height']))
506
+		if (!isset($GLOBALS['__member_signature_max_height']))
507 507
 		{
508 508
 			$oModuleModel = getModel('module');
509 509
 			$member_config = $oModuleModel->getModuleConfig('member');
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$max_signature_height = $GLOBALS['__member_signature_max_height'];
514 514
 
515
-		if($max_signature_height)
515
+		if ($max_signature_height)
516 516
 		{
517 517
 			$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
518 518
 		}
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 
523 523
 	function thumbnailExists($width = 80, $height = 0, $type = '')
524 524
 	{
525
-		if(!$this->comment_srl)
525
+		if (!$this->comment_srl)
526 526
 		{
527 527
 			return FALSE;
528 528
 		}
529 529
 
530
-		if(!$this->getThumbnail($width, $height, $type))
530
+		if (!$this->getThumbnail($width, $height, $type))
531 531
 		{
532 532
 			return FALSE;
533 533
 		}
@@ -538,42 +538,42 @@  discard block
 block discarded – undo
538 538
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
539 539
 	{
540 540
 		// return false if no doc exists
541
-		if(!$this->comment_srl)
541
+		if (!$this->comment_srl)
542 542
 		{
543 543
 			return;
544 544
 		}
545 545
 
546
-		if($this->isSecret() && !$this->isGranted())
546
+		if ($this->isSecret() && !$this->isGranted())
547 547
 		{
548 548
 			return;
549 549
 		}
550 550
 
551 551
 		// If signiture height setting is omitted, create a square
552
-		if(!$height)
552
+		if (!$height)
553 553
 		{
554 554
 			$height = $width;
555 555
 		}
556 556
 
557 557
 		$content = $this->get('content');
558
-		if(!$this->hasUploadedFiles())
558
+		if (!$this->hasUploadedFiles())
559 559
 		{
560
-			if(!$content)
560
+			if (!$content)
561 561
 			{
562 562
 				$args = new stdClass();
563 563
 				$args->comment_srl = $this->comment_srl;
564 564
 				$output = executeQuery('document.getComment', $args, array('content'));
565
-				if($output->toBool() && $output->data)
565
+				if ($output->toBool() && $output->data)
566 566
 				{
567 567
 					$content = $output->data->content;
568 568
 					$this->add('content', $content);
569 569
 				}
570 570
 			}
571 571
 
572
-			if(!preg_match("!<img!is", $content)) return;
572
+			if (!preg_match("!<img!is", $content)) return;
573 573
 		}
574 574
 
575 575
 		// get thumbail generation info on the doc module configuration.
576
-		if(!in_array($thumbnail_type, array('crop', 'ratio')))
576
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
577 577
 		{
578 578
 			$thumbnail_type = 'crop';
579 579
 		}
@@ -582,18 +582,18 @@  discard block
 block discarded – undo
582 582
 		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3));
583 583
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
584 584
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
585
-		$thumbnail_url = Context::getRequestUri() . $thumbnail_file;
585
+		$thumbnail_url = Context::getRequestUri().$thumbnail_file;
586 586
 
587 587
 		// return false if a size of existing thumbnail file is 0. otherwise return the file path
588
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
588
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
589 589
 		{
590
-			if(filesize($thumbnail_file) < 1)
590
+			if (filesize($thumbnail_file) < 1)
591 591
 			{
592 592
 				return FALSE;
593 593
 			}
594 594
 			else
595 595
 			{
596
-				return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
596
+				return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file));
597 597
 			}
598 598
 		}
599 599
 
@@ -605,33 +605,33 @@  discard block
 block discarded – undo
605 605
 		$is_tmp_file = FALSE;
606 606
 
607 607
 		// find an image file among attached files
608
-		if($this->hasUploadedFiles())
608
+		if ($this->hasUploadedFiles())
609 609
 		{
610 610
 			$file_list = $this->getUploadedFiles();
611 611
 
612 612
 			$first_image = null;
613
-			foreach($file_list as $file)
613
+			foreach ($file_list as $file)
614 614
 			{
615
-				if($file->direct_download !== 'Y') continue;
615
+				if ($file->direct_download !== 'Y') continue;
616 616
 
617
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
617
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
618 618
 				{
619 619
 					$source_file = $file->uploaded_filename;
620 620
 					break;
621 621
 				}
622 622
 
623
-				if($first_image) continue;
623
+				if ($first_image) continue;
624 624
 
625
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
625
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
626 626
 				{
627
-					if(file_exists($file->uploaded_filename))
627
+					if (file_exists($file->uploaded_filename))
628 628
 					{
629 629
 						$first_image = $file->uploaded_filename;
630 630
 					}
631 631
 				}
632 632
 			}
633 633
 
634
-			if(!$source_file && $first_image)
634
+			if (!$source_file && $first_image)
635 635
 			{
636 636
 				$source_file = $first_image;
637 637
 			}
@@ -639,31 +639,31 @@  discard block
 block discarded – undo
639 639
 
640 640
 		// get an image file from the doc content if no file attached. 
641 641
 		$is_tmp_file = false;
642
-		if(!$source_file)
642
+		if (!$source_file)
643 643
 		{
644 644
 			$random = new Password();
645 645
 
646 646
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
647 647
 
648
-			foreach($matches as $target_image)
648
+			foreach ($matches as $target_image)
649 649
 			{
650 650
 				$target_src = trim($target_image[1]);
651
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
651
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
652 652
 
653
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
653
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
654 654
 				{
655 655
 					$target_src = Context::getRequestUri().$target_src;
656 656
 				}
657 657
 
658 658
 				$target_src = htmlspecialchars_decode($target_src);
659 659
 
660
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
660
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
661 661
 				FileHandler::getRemoteFile($target_src, $tmp_file);
662
-				if(!file_exists($tmp_file)) continue;
662
+				if (!file_exists($tmp_file)) continue;
663 663
 
664 664
 				$imageinfo = getimagesize($tmp_file);
665 665
 				list($_w, $_h) = $imageinfo;
666
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
666
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
667 667
 					FileHandler::removeFile($tmp_file);
668 668
 					continue;
669 669
 				}
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
678 678
 
679 679
 		// Remove source file if it was temporary
680
-		if($is_tmp_file)
680
+		if ($is_tmp_file)
681 681
 		{
682 682
 			FileHandler::removeFile($source_file);
683 683
 		}
@@ -686,12 +686,12 @@  discard block
 block discarded – undo
686 686
 		FileHandler::removeFile($thumbnail_lockfile);
687 687
 
688 688
 		// Create an empty file if thumbnail generation failed
689
-		if(!$output)
689
+		if (!$output)
690 690
 		{
691
-			FileHandler::writeFile($thumbnail_file, '','w');
691
+			FileHandler::writeFile($thumbnail_file, '', 'w');
692 692
 		}
693 693
 
694
-		return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
694
+		return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file));
695 695
 	}
696 696
 
697 697
 	function isCarted()
Please login to merge, or discard this patch.
Braces   +17 added lines, -9 removed lines patch added patch discarded remove patch
@@ -333,8 +333,7 @@  discard block
 block discarded – undo
333 333
 					'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', $this->comment_srl, $memberSrl, $this->comment_srl, $memberSrl, $content, $this->comment_srl, $memberSrl
334 334
 			);
335 335
 			// xe_content class name should be specified although content access is not necessary.
336
-		}
337
-		else
336
+		} else
338 337
 		{
339 338
 			if($add_xe_content_class)
340 339
 			{
@@ -569,7 +568,9 @@  discard block
 block discarded – undo
569 568
 				}
570 569
 			}
571 570
 
572
-			if(!preg_match("!<img!is", $content)) return;
571
+			if(!preg_match("!<img!is", $content)) {
572
+				return;
573
+			}
573 574
 		}
574 575
 
575 576
 		// get thumbail generation info on the doc module configuration.
@@ -590,8 +591,7 @@  discard block
 block discarded – undo
590 591
 			if(filesize($thumbnail_file) < 1)
591 592
 			{
592 593
 				return FALSE;
593
-			}
594
-			else
594
+			} else
595 595
 			{
596 596
 				return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
597 597
 			}
@@ -612,7 +612,9 @@  discard block
 block discarded – undo
612 612
 			$first_image = null;
613 613
 			foreach($file_list as $file)
614 614
 			{
615
-				if($file->direct_download !== 'Y') continue;
615
+				if($file->direct_download !== 'Y') {
616
+					continue;
617
+				}
616 618
 
617 619
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
618 620
 				{
@@ -620,7 +622,9 @@  discard block
 block discarded – undo
620 622
 					break;
621 623
 				}
622 624
 
623
-				if($first_image) continue;
625
+				if($first_image) {
626
+					continue;
627
+				}
624 628
 
625 629
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
626 630
 				{
@@ -648,7 +652,9 @@  discard block
 block discarded – undo
648 652
 			foreach($matches as $target_image)
649 653
 			{
650 654
 				$target_src = trim($target_image[1]);
651
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
655
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
656
+					continue;
657
+				}
652 658
 
653 659
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
654 660
 				{
@@ -659,7 +665,9 @@  discard block
 block discarded – undo
659 665
 
660 666
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
661 667
 				FileHandler::getRemoteFile($target_src, $tmp_file);
662
-				if(!file_exists($tmp_file)) continue;
668
+				if(!file_exists($tmp_file)) {
669
+					continue;
670
+				}
663 671
 
664 672
 				$imageinfo = getimagesize($tmp_file);
665 673
 				list($_w, $_h) = $imageinfo;
Please login to merge, or discard this patch.
modules/document/document.item.php 2 patches
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if (!$this->document_srl) return;
83 83
 
84 84
 		$document_item = false;
85 85
 		$cache_put = false;
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 		// cache controll
90 90
 		$oCacheHandler = CacheHandler::getInstance('object');
91
-		if($oCacheHandler->isSupport())
91
+		if ($oCacheHandler->isSupport())
92 92
 		{
93
-			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
93
+			$cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl;
94 94
 			$document_item = $oCacheHandler->get($cache_key);
95
-			if($document_item !== false)
95
+			if ($document_item !== false)
96 96
 			{
97 97
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
98 98
 			}
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 		$args->document_srl = $this->document_srl;
103 103
 		$output = executeQuery('document.getDocument', $args, $columnList);
104 104
 
105
-		if($document_item === false)
105
+		if ($document_item === false)
106 106
 		{
107 107
 			$document_item = $output->data;
108 108
 
109 109
 				//insert in cache
110
-			if($document_item && $oCacheHandler->isSupport())
110
+			if ($document_item && $oCacheHandler->isSupport())
111 111
 			{
112 112
 				$oCacheHandler->put($cache_key, $document_item);
113 113
 			}
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		$this->setAttribute($document_item, $load_extra_vars);
125 125
 	}
126 126
 
127
-	function setAttribute($attribute, $load_extra_vars=true)
127
+	function setAttribute($attribute, $load_extra_vars = true)
128 128
 	{
129
-		if(!$attribute->document_srl)
129
+		if (!$attribute->document_srl)
130 130
 		{
131 131
 			$this->document_srl = null;
132 132
 			return;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$this->adds($attribute);
137 137
 
138 138
 		// Tags
139
-		if($this->get('tags'))
139
+		if ($this->get('tags'))
140 140
 		{
141 141
 			$tag_list = explode(',', $this->get('tags'));
142 142
 			$tag_list = array_map('trim', $tag_list);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		$oDocumentModel = getModel('document');
147
-		if($load_extra_vars)
147
+		if ($load_extra_vars)
148 148
 		{
149 149
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
150 150
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
 
160 160
 	function isGranted()
161 161
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
162
+		if ($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163 163
 
164
-		if($this->grant_cache !== null)
164
+		if ($this->grant_cache !== null)
165 165
 		{
166 166
 			return $this->grant_cache;
167 167
 		}
168 168
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
169
+		if (!Context::get('is_logged')) return $this->grant_cache = false;
170 170
 
171 171
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
172
+		if ($logged_info->is_admin == 'Y') return $this->grant_cache = true;
173 173
 
174 174
 		$oModuleModel = getModel('module');
175 175
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
176
+		if ($grant->manager) return $this->grant_cache = true;
177 177
 
178
-		if($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl)
178
+		if ($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl)
179 179
 		{
180 180
 			return $this->grant_cache = true;
181 181
 		}
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 
192 192
 	function isAccessible()
193 193
 	{
194
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
194
+		return $_SESSION['accessible'][$this->document_srl] == true ?true:false;
195 195
 	}
196 196
 
197 197
 	function allowComment()
198 198
 	{
199 199
 		// init write, document is not exists. so allow comment status is true
200
-		if(!$this->isExists()) return true;
200
+		if (!$this->isExists()) return true;
201 201
 
202 202
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
203 203
 	}
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	function allowTrackback()
206 206
 	{
207 207
 		static $allow_trackback_status = null;
208
-		if(is_null($allow_trackback_status))
208
+		if (is_null($allow_trackback_status))
209 209
 		{
210 210
 			
211 211
 			// Check the tarckback module exist
212
-			if(!getClass('trackback'))
212
+			if (!getClass('trackback'))
213 213
 			{
214 214
 				$allow_trackback_status = false;
215 215
 			}
@@ -219,20 +219,20 @@  discard block
 block discarded – undo
219 219
 				$oModuleModel = getModel('module');
220 220
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
221 221
 				
222
-				if(!$trackback_config)
222
+				if (!$trackback_config)
223 223
 				{
224 224
 					$trackback_config = new stdClass();
225 225
 				}
226 226
 				
227
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
228
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
227
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
228
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
229 229
 				else
230 230
 				{
231 231
 					$module_srl = $this->get('module_srl');
232 232
 					// Check settings of each module
233 233
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
234
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
235
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
234
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
235
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
236 236
 				}
237 237
 			}
238 238
 		}
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 
242 242
 	function isLocked()
243 243
 	{
244
-		if(!$this->isExists()) return false;
244
+		if (!$this->isExists()) return false;
245 245
 
246 246
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
247 247
 	}
248 248
 
249 249
 	function isEditable()
250 250
 	{
251
-		if($this->isGranted() || !$this->get('member_srl')) return true;
251
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
252 252
 		return false;
253 253
 	}
254 254
 
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 
266 266
 	function useNotify()
267 267
 	{
268
-		return $this->get('notify_message')=='Y' ? true : false;
268
+		return $this->get('notify_message') == 'Y' ? true : false;
269 269
 	}
270 270
 
271 271
 	function doCart()
272 272
 	{
273
-		if(!$this->document_srl) return false;
274
-		if($this->isCarted()) $this->removeCart();
273
+		if (!$this->document_srl) return false;
274
+		if ($this->isCarted()) $this->removeCart();
275 275
 		else $this->addCart();
276 276
 	}
277 277
 
@@ -298,18 +298,18 @@  discard block
 block discarded – undo
298 298
 	 */
299 299
 	function notify($type, $content)
300 300
 	{
301
-		if(!$this->document_srl) return;
301
+		if (!$this->document_srl) return;
302 302
 		// return if it is not useNotify
303
-		if(!$this->useNotify()) return;
303
+		if (!$this->useNotify()) return;
304 304
 		// Pass if an author is not a logged-in user
305
-		if(!$this->get('member_srl')) return;
305
+		if (!$this->get('member_srl')) return;
306 306
 		// Return if the currently logged-in user is an author
307 307
 		$logged_info = Context::get('logged_info');
308
-		if($logged_info->member_srl == $this->get('member_srl')) return;
308
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
309 309
 		// List variables
310
-		if($type) $title = "[".$type."] ";
310
+		if ($type) $title = "[".$type."] ";
311 311
 		$title .= cut_str(strip_tags($content), 10, '...');
312
-		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
312
+		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
313 313
 		$receiver_srl = $this->get('member_srl');
314 314
 		$sender_member_srl = $logged_info->member_srl;
315 315
 		// Send a message
@@ -324,26 +324,26 @@  discard block
 block discarded – undo
324 324
 
325 325
 	function getIpAddress()
326 326
 	{
327
-		if($this->isGranted())
327
+		if ($this->isGranted())
328 328
 		{
329 329
 			return $this->get('ipaddress');
330 330
 		}
331 331
 
332
-		return '*' . strstr($this->get('ipaddress'), '.');
332
+		return '*'.strstr($this->get('ipaddress'), '.');
333 333
 	}
334 334
 
335 335
 	function isExistsHomepage()
336 336
 	{
337
-		if(trim($this->get('homepage'))) return true;
337
+		if (trim($this->get('homepage'))) return true;
338 338
 		return false;
339 339
 	}
340 340
 
341 341
 	function getHomepageUrl()
342 342
 	{
343 343
 		$url = trim($this->get('homepage'));
344
-		if(!$url) return;
344
+		if (!$url) return;
345 345
 
346
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
346
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://'.$url;
347 347
 
348 348
 		return $url;
349 349
 	}
@@ -373,52 +373,52 @@  discard block
 block discarded – undo
373 373
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
374 374
 	}
375 375
 
376
-	function getTitleText($cut_size = 0, $tail='...')
376
+	function getTitleText($cut_size = 0, $tail = '...')
377 377
 	{
378
-		if(!$this->document_srl) return;
378
+		if (!$this->document_srl) return;
379 379
 
380
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
380
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
381 381
 		else $title = $this->get('title');
382 382
 
383 383
 		return $title;
384 384
 	}
385 385
 
386
-	function getTitle($cut_size = 0, $tail='...')
386
+	function getTitle($cut_size = 0, $tail = '...')
387 387
 	{
388
-		if(!$this->document_srl) return;
388
+		if (!$this->document_srl) return;
389 389
 
390 390
 		$title = $this->getTitleText($cut_size, $tail);
391 391
 
392 392
 		$attrs = array();
393 393
 		$this->add('title_color', trim($this->get('title_color')));
394
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
395
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
394
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
395
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
396 396
 
397
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
397
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
398 398
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
399 399
 	}
400 400
 
401 401
 	function getContentText($strlen = 0)
402 402
 	{
403
-		if(!$this->document_srl) return;
403
+		if (!$this->document_srl) return;
404 404
 
405
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
405
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
406 406
 
407 407
 		$result = $this->_checkAccessibleFromStatus();
408
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
408
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
409 409
 
410 410
 		$content = $this->get('content');
411 411
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
412 412
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
413 413
 
414
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
414
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
415 415
 
416 416
 		return htmlspecialchars($content);
417 417
 	}
418 418
 
419 419
 	function _addAllowScriptAccess($m)
420 420
 	{
421
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
421
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
422 422
 		{
423 423
 			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
424 424
 		}
@@ -428,26 +428,26 @@  discard block
 block discarded – undo
428 428
 
429 429
 	function _checkAllowScriptAccess($m)
430 430
 	{
431
-		if($m[1] == 'object')
431
+		if ($m[1] == 'object')
432 432
 		{
433 433
 			$this->allowscriptaccessList[] = 1;
434 434
 		}
435 435
 
436
-		if($m[1] == 'param')
436
+		if ($m[1] == 'param')
437 437
 		{
438
-			if(stripos($m[0], 'allowscriptaccess'))
438
+			if (stripos($m[0], 'allowscriptaccess'))
439 439
 			{
440 440
 				$m[0] = '<param name="allowscriptaccess" value="never"';
441
-				if(substr($m[0], -1) == '/')
441
+				if (substr($m[0], -1) == '/')
442 442
 				{
443 443
 					$m[0] .= '/';
444 444
 				}
445
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
445
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
446 446
 			}
447 447
 		}
448
-		else if($m[1] == 'embed')
448
+		else if ($m[1] == 'embed')
449 449
 		{
450
-			if(stripos($m[0], 'allowscriptaccess'))
450
+			if (stripos($m[0], 'allowscriptaccess'))
451 451
 			{
452 452
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
453 453
 			}
@@ -461,24 +461,24 @@  discard block
 block discarded – undo
461 461
 
462 462
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
463 463
 	{
464
-		if(!$this->document_srl) return;
464
+		if (!$this->document_srl) return;
465 465
 
466
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
466
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
467 467
 
468 468
 		$result = $this->_checkAccessibleFromStatus();
469
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
469
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
470 470
 
471 471
 		$content = $this->get('content');
472
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
472
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
473 473
 
474 474
 		// Define a link if using a rewrite module
475 475
 		$oContext = &Context::getInstance();
476
-		if($oContext->allow_rewrite)
476
+		if ($oContext->allow_rewrite)
477 477
 		{
478
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
478
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content);
479 479
 		}
480 480
 		// To display a pop-up menu
481
-		if($add_popup_menu)
481
+		if ($add_popup_menu)
482 482
 		{
483 483
 			$content = sprintf(
484 484
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -487,10 +487,10 @@  discard block
 block discarded – undo
487 487
 			);
488 488
 		}
489 489
 		// If additional content information is set
490
-		if($add_content_info)
490
+		if ($add_content_info)
491 491
 		{
492 492
 			$memberSrl = $this->get('member_srl');
493
-			if($memberSrl < 0)
493
+			if ($memberSrl < 0)
494 494
 			{
495 495
 				$memberSrl = 0;
496 496
 			}
@@ -506,12 +506,12 @@  discard block
 block discarded – undo
506 506
 		}
507 507
 		else
508 508
 		{
509
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
509
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
510 510
 		}
511 511
 		// Change the image path to a valid absolute path if resource_realpath is true
512
-		if($resource_realpath)
512
+		if ($resource_realpath)
513 513
 		{
514
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
514
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
515 515
 		}
516 516
 
517 517
 		return $content;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 		$content = trim(cut_str($content, $str_size, $tail));
561 561
 
562 562
 		// Replace back < , <, "
563
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
563
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
564 564
 
565 565
 		return $content;
566 566
 	}
@@ -573,13 +573,13 @@  discard block
 block discarded – undo
573 573
 	function getRegdateTime()
574 574
 	{
575 575
 		$regdate = $this->get('regdate');
576
-		$year = substr($regdate,0,4);
577
-		$month = substr($regdate,4,2);
578
-		$day = substr($regdate,6,2);
579
-		$hour = substr($regdate,8,2);
580
-		$min = substr($regdate,10,2);
581
-		$sec = substr($regdate,12,2);
582
-		return mktime($hour,$min,$sec,$month,$day,$year);
576
+		$year = substr($regdate, 0, 4);
577
+		$month = substr($regdate, 4, 2);
578
+		$day = substr($regdate, 6, 2);
579
+		$hour = substr($regdate, 8, 2);
580
+		$min = substr($regdate, 10, 2);
581
+		$sec = substr($regdate, 12, 2);
582
+		return mktime($hour, $min, $sec, $month, $day, $year);
583 583
 	}
584 584
 
585 585
 	function getRegdateGM()
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 
590 590
 	function getRegdateDT()
591 591
 	{
592
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
592
+		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
593 593
 	}
594 594
 
595 595
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -599,13 +599,13 @@  discard block
 block discarded – undo
599 599
 
600 600
 	function getUpdateTime()
601 601
 	{
602
-		$year = substr($this->get('last_update'),0,4);
603
-		$month = substr($this->get('last_update'),4,2);
604
-		$day = substr($this->get('last_update'),6,2);
605
-		$hour = substr($this->get('last_update'),8,2);
606
-		$min = substr($this->get('last_update'),10,2);
607
-		$sec = substr($this->get('last_update'),12,2);
608
-		return mktime($hour,$min,$sec,$month,$day,$year);
602
+		$year = substr($this->get('last_update'), 0, 4);
603
+		$month = substr($this->get('last_update'), 4, 2);
604
+		$day = substr($this->get('last_update'), 6, 2);
605
+		$hour = substr($this->get('last_update'), 8, 2);
606
+		$min = substr($this->get('last_update'), 10, 2);
607
+		$sec = substr($this->get('last_update'), 12, 2);
608
+		return mktime($hour, $min, $sec, $month, $day, $year);
609 609
 	}
610 610
 
611 611
 	function getUpdateGM()
@@ -615,21 +615,21 @@  discard block
 block discarded – undo
615 615
 
616 616
 	function getUpdateDT()
617 617
 	{
618
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
618
+		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
619 619
 	}
620 620
 
621 621
 	function getPermanentUrl()
622 622
 	{
623
-		return getFullUrl('','mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl'));
623
+		return getFullUrl('', 'mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl'));
624 624
 	}
625 625
 
626 626
 	function getTrackbackUrl()
627 627
 	{
628
-		if(!$this->document_srl) return;
628
+		if (!$this->document_srl) return;
629 629
 
630 630
 		// Generate a key to prevent spams
631 631
 		$oTrackbackModel = getModel('trackback');
632
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
632
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
633 633
 	}
634 634
 
635 635
 	/**
@@ -639,24 +639,24 @@  discard block
 block discarded – undo
639 639
 	function updateReadedCount()
640 640
 	{
641 641
 		$oDocumentController = getController('document');
642
-		if($oDocumentController->updateReadedCount($this))
642
+		if ($oDocumentController->updateReadedCount($this))
643 643
 		{
644 644
 			$readed_count = $this->get('readed_count');
645
-			$this->add('readed_count', $readed_count+1);
645
+			$this->add('readed_count', $readed_count + 1);
646 646
 		}
647 647
 	}
648 648
 
649 649
 	function isExtraVarsExists()
650 650
 	{
651
-		if(!$this->get('module_srl')) return false;
651
+		if (!$this->get('module_srl')) return false;
652 652
 		$oDocumentModel = getModel('document');
653 653
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
654
-		return count($extra_keys)?true:false;
654
+		return count($extra_keys) ?true:false;
655 655
 	}
656 656
 
657 657
 	function getExtraVars()
658 658
 	{
659
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
659
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
660 660
 
661 661
 		$oDocumentModel = getModel('document');
662 662
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	function getExtraValue($idx)
666 666
 	{
667 667
 		$extra_vars = $this->getExtraVars();
668
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
668
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
669 669
 		{
670 670
 			return $extra_vars[$idx]->getValue();
671 671
 		}
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	function getExtraValueHTML($idx)
679 679
 	{
680 680
 		$extra_vars = $this->getExtraVars();
681
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
681
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
682 682
 		{
683 683
 			return $extra_vars[$idx]->getValueHTML();
684 684
 		}
@@ -692,16 +692,16 @@  discard block
 block discarded – undo
692 692
 	{
693 693
 		$extra_vars = $this->getExtraVars();
694 694
 
695
-		if($extra_vars)
695
+		if ($extra_vars)
696 696
 		{
697 697
 			// Handle extra variable(eid)
698
-			foreach($extra_vars as $idx => $key)
698
+			foreach ($extra_vars as $idx => $key)
699 699
 			{
700 700
 				$extra_eid[$key->eid] = $key;
701 701
 			}
702 702
 		}
703 703
 		
704
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
704
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
705 705
 		{
706 706
 			return $extra_eid[$eid]->getValue();
707 707
 		}
@@ -715,12 +715,12 @@  discard block
 block discarded – undo
715 715
 	{
716 716
 		$extra_vars = $this->getExtraVars();
717 717
 		// Handle extra variable(eid)
718
-		foreach($extra_vars as $idx => $key)
718
+		foreach ($extra_vars as $idx => $key)
719 719
 		{
720 720
 			$extra_eid[$key->eid] = $key;
721 721
 		}
722 722
 		
723
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
723
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
724 724
 		{
725 725
 			return $extra_eid[$eid]->getValueHTML();
726 726
 		}
@@ -744,13 +744,13 @@  discard block
 block discarded – undo
744 744
 
745 745
 	function getComments()
746 746
 	{
747
-		if(!$this->getCommentCount()) return;
748
-		if(!$this->isGranted() && $this->isSecret()) return;
747
+		if (!$this->getCommentCount()) return;
748
+		if (!$this->isGranted() && $this->isSecret()) return;
749 749
 		// cpage is a number of comment pages
750 750
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
751 751
 		$cpage = Context::get($cpageStr);
752 752
 
753
-		if(!$cpage)
753
+		if (!$cpage)
754 754
 		{
755 755
 			$cpage = Context::get('cpage');
756 756
 		}
@@ -758,19 +758,19 @@  discard block
 block discarded – undo
758 758
 		// Get a list of comments
759 759
 		$oCommentModel = getModel('comment');
760 760
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
761
-		if(!$output->toBool() || !count($output->data)) return;
761
+		if (!$output->toBool() || !count($output->data)) return;
762 762
 		// Create commentItem object from a comment list
763 763
 		// If admin priviledge is granted on parent posts, you can read its child posts.
764 764
 		$accessible = array();
765 765
 		$comment_list = array();
766
-		foreach($output->data as $key => $val)
766
+		foreach ($output->data as $key => $val)
767 767
 		{
768 768
 			$oCommentItem = new commentItem();
769 769
 			$oCommentItem->setAttribute($val);
770 770
 			// If permission is granted to the post, you can access it temporarily
771
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
771
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
772 772
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
773
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
773
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
774 774
 			{
775 775
 				$oCommentItem->setAccessible();
776 776
 			}
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 		// Variable setting to be displayed on the skin
780 780
 		Context::set($cpageStr, $output->page_navigation->cur_page);
781 781
 		Context::set('cpage', $output->page_navigation->cur_page);
782
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
782
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
783 783
 
784 784
 		return $comment_list;
785 785
 	}
@@ -791,9 +791,9 @@  discard block
 block discarded – undo
791 791
 
792 792
 	function getTrackbacks()
793 793
 	{
794
-		if(!$this->document_srl) return;
794
+		if (!$this->document_srl) return;
795 795
 
796
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
796
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
797 797
 
798 798
 		$oTrackbackModel = getModel('trackback');
799 799
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -801,47 +801,47 @@  discard block
 block discarded – undo
801 801
 
802 802
 	function thumbnailExists($width = 80, $height = 0, $type = '')
803 803
 	{
804
-		if(!$this->document_srl) return false;
805
-		if(!$this->getThumbnail($width, $height, $type)) return false;
804
+		if (!$this->document_srl) return false;
805
+		if (!$this->getThumbnail($width, $height, $type)) return false;
806 806
 		return true;
807 807
 	}
808 808
 
809 809
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
810 810
 	{
811 811
 		// Return false if the document doesn't exist
812
-		if(!$this->document_srl) return;
812
+		if (!$this->document_srl) return;
813 813
 
814
-		if($this->isSecret() && !$this->isGranted())
814
+		if ($this->isSecret() && !$this->isGranted())
815 815
 		{
816 816
 			return;
817 817
 		}
818 818
 
819 819
 		// If not specify its height, create a square
820
-		if(!$height) $height = $width;
820
+		if (!$height) $height = $width;
821 821
 
822 822
 		// Return false if neither attachement nor image files in the document
823 823
 		$content = $this->get('content');
824
-		if(!$this->get('uploaded_count'))
824
+		if (!$this->get('uploaded_count'))
825 825
 		{
826
-			if(!$content)
826
+			if (!$content)
827 827
 			{
828 828
 				$args = new stdClass();
829 829
 				$args->document_srl = $this->document_srl;
830 830
 				$output = executeQuery('document.getDocument', $args, array('content'));
831
-				if($output->toBool() && $output->data)
831
+				if ($output->toBool() && $output->data)
832 832
 				{
833 833
 					$content = $output->data->content;
834 834
 					$this->add('content', $content);
835 835
 				}
836 836
 			}
837 837
 
838
-			if(!preg_match("!<img!is", $content)) return;
838
+			if (!preg_match("!<img!is", $content)) return;
839 839
 		}
840 840
 		// Get thumbnai_type information from document module's configuration
841
-		if(!in_array($thumbnail_type, array('crop','ratio')))
841
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
842 842
 		{
843 843
 			$config = $GLOBALS['__document_config__'];
844
-			if(!$config)
844
+			if (!$config)
845 845
 			{
846 846
 				$oDocumentModel = getModel('document');
847 847
 				$config = $oDocumentModel->getDocumentConfig();
@@ -851,21 +851,21 @@  discard block
 block discarded – undo
851 851
 		}
852 852
 
853 853
 		// Define thumbnail information
854
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
854
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
855 855
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
856 856
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
857 857
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
858 858
 
859 859
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
860
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
860
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
861 861
 		{
862
-			if(filesize($thumbnail_file) < 1)
862
+			if (filesize($thumbnail_file) < 1)
863 863
 			{
864 864
 				return FALSE;
865 865
 			}
866 866
 			else
867 867
 			{
868
-				return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
868
+				return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file));
869 869
 			}
870 870
 		}
871 871
 
@@ -877,64 +877,64 @@  discard block
 block discarded – undo
877 877
 		$is_tmp_file = false;
878 878
 
879 879
 		// Find an iamge file among attached files if exists
880
-		if($this->hasUploadedFiles())
880
+		if ($this->hasUploadedFiles())
881 881
 		{
882 882
 			$file_list = $this->getUploadedFiles();
883 883
 
884 884
 			$first_image = null;
885
-			foreach($file_list as $file)
885
+			foreach ($file_list as $file)
886 886
 			{
887
-				if($file->direct_download !== 'Y') continue;
887
+				if ($file->direct_download !== 'Y') continue;
888 888
 
889
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
889
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
890 890
 				{
891 891
 					$source_file = $file->uploaded_filename;
892 892
 					break;
893 893
 				}
894 894
 
895
-				if($first_image) continue;
895
+				if ($first_image) continue;
896 896
 
897
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
897
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
898 898
 				{
899
-					if(file_exists($file->uploaded_filename))
899
+					if (file_exists($file->uploaded_filename))
900 900
 					{
901 901
 						$first_image = $file->uploaded_filename;
902 902
 					}
903 903
 				}
904 904
 			}
905 905
 
906
-			if(!$source_file && $first_image)
906
+			if (!$source_file && $first_image)
907 907
 			{
908 908
 				$source_file = $first_image;
909 909
 			}
910 910
 		}
911 911
 		// If not exists, file an image file from the content
912 912
 		$is_tmp_file = false;
913
-		if(!$source_file)
913
+		if (!$source_file)
914 914
 		{
915 915
 			$random = new Password();
916 916
 
917 917
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
918 918
 
919
-			foreach($matches as $target_image)
919
+			foreach ($matches as $target_image)
920 920
 			{
921 921
 				$target_src = trim($target_image[1]);
922
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
922
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
923 923
 
924
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
924
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
925 925
 				{
926 926
 					$target_src = Context::getRequestUri().$target_src;
927 927
 				}
928 928
 
929 929
 				$target_src = htmlspecialchars_decode($target_src);
930 930
 
931
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
931
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
932 932
 				FileHandler::getRemoteFile($target_src, $tmp_file);
933
-				if(!file_exists($tmp_file)) continue;
933
+				if (!file_exists($tmp_file)) continue;
934 934
 
935 935
 				$imageinfo = getimagesize($tmp_file);
936 936
 				list($_w, $_h) = $imageinfo;
937
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
937
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
938 938
 					FileHandler::removeFile($tmp_file);
939 939
 					continue;
940 940
 				}
@@ -945,13 +945,13 @@  discard block
 block discarded – undo
945 945
 			}
946 946
 		}
947 947
 
948
-		if($source_file)
948
+		if ($source_file)
949 949
 		{
950 950
 			$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
951 951
 		}
952 952
 
953 953
 		// Remove source file if it was temporary
954
-		if($is_tmp_file)
954
+		if ($is_tmp_file)
955 955
 		{
956 956
 			FileHandler::removeFile($source_file);
957 957
 		}
@@ -960,12 +960,12 @@  discard block
 block discarded – undo
960 960
 		FileHandler::removeFile($thumbnail_lockfile);
961 961
 
962 962
 		// Create an empty file if thumbnail generation failed
963
-		if(!$output_file)
963
+		if (!$output_file)
964 964
 		{
965
-			FileHandler::writeFile($thumbnail_file, '','w');
965
+			FileHandler::writeFile($thumbnail_file, '', 'w');
966 966
 		}
967 967
 
968
-		return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
968
+		return $thumbnail_url.'?'.date('YmdHis', filemtime($thumbnail_file));
969 969
 	}
970 970
 
971 971
 	/**
@@ -976,21 +976,21 @@  discard block
 block discarded – undo
976 976
 	 */
977 977
 	function getExtraImages($time_interval = 43200)
978 978
 	{
979
-		if(!$this->document_srl) return;
979
+		if (!$this->document_srl) return;
980 980
 		// variables for icon list
981 981
 		$buffs = array();
982 982
 
983 983
 		$check_files = false;
984 984
 
985 985
 		// Check if secret post is
986
-		if($this->isSecret()) $buffs[] = "secret";
986
+		if ($this->isSecret()) $buffs[] = "secret";
987 987
 
988 988
 		// Set the latest time
989
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
989
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
990 990
 
991 991
 		// Check new post
992
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
993
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
992
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
993
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
994 994
 
995 995
 		/*
996 996
 		   $content = $this->get('content');
@@ -1013,14 +1013,14 @@  discard block
 block discarded – undo
1013 1013
 		 */
1014 1014
 
1015 1015
 		// Check the attachment
1016
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1016
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
1017 1017
 
1018 1018
 		return $buffs;
1019 1019
 	}
1020 1020
 
1021 1021
 	function getStatus()
1022 1022
 	{
1023
-		if(!$this->get('status')) {
1023
+		if (!$this->get('status')) {
1024 1024
 			$oDocumentClass = getClass('document');
1025 1025
 			return $oDocumentClass->getDefaultStatus();
1026 1026
 		}
@@ -1034,11 +1034,11 @@  discard block
 block discarded – undo
1034 1034
 	 */
1035 1035
 	function printExtraImages($time_check = 43200)
1036 1036
 	{
1037
-		if(!$this->document_srl) return;
1037
+		if (!$this->document_srl) return;
1038 1038
 
1039 1039
 		$oDocumentModel = getModel('document');
1040 1040
 		$documentConfig = $oDocumentModel->getDocumentConfig();
1041
-		if(Mobile::isFromMobilePhone())
1041
+		if (Mobile::isFromMobilePhone())
1042 1042
 		{
1043 1043
 			$iconSkin = $documentConfig->micons;
1044 1044
 		}
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
 		{
1047 1047
 			$iconSkin = $documentConfig->icons;
1048 1048
 		}
1049
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1049
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1050 1050
 
1051 1051
 		$buffs = $this->getExtraImages($time_check);
1052
-		if(!count($buffs)) return;
1052
+		if (!count($buffs)) return;
1053 1053
 
1054 1054
 		$buff = array();
1055
-		foreach($buffs as $key => $val)
1055
+		foreach ($buffs as $key => $val)
1056 1056
 		{
1057 1057
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1058 1058
 		}
@@ -1061,20 +1061,20 @@  discard block
 block discarded – undo
1061 1061
 
1062 1062
 	function hasUploadedFiles()
1063 1063
 	{
1064
-		if(!$this->document_srl) return;
1064
+		if (!$this->document_srl) return;
1065 1065
 
1066
-		if($this->isSecret() && !$this->isGranted()) return false;
1067
-		return $this->get('uploaded_count')? true : false;
1066
+		if ($this->isSecret() && !$this->isGranted()) return false;
1067
+		return $this->get('uploaded_count') ? true : false;
1068 1068
 	}
1069 1069
 
1070 1070
 	function getUploadedFiles($sortIndex = 'file_srl')
1071 1071
 	{
1072
-		if(!$this->document_srl) return;
1072
+		if (!$this->document_srl) return;
1073 1073
 
1074
-		if($this->isSecret() && !$this->isGranted()) return;
1075
-		if(!$this->get('uploaded_count')) return;
1074
+		if ($this->isSecret() && !$this->isGranted()) return;
1075
+		if (!$this->get('uploaded_count')) return;
1076 1076
 
1077
-		if(!$this->uploadedFiles[$sortIndex])
1077
+		if (!$this->uploadedFiles[$sortIndex])
1078 1078
 		{
1079 1079
 			$oFileModel = getModel('file');
1080 1080
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 	function getEditor()
1091 1091
 	{
1092 1092
 		$module_srl = $this->get('module_srl');
1093
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1093
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1094 1094
 
1095 1095
 		$oEditorModel = getModel('editor');
1096 1096
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	{
1106 1106
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1107 1107
 		if (!$this->allowComment()) return false;
1108
-		if(!$this->isGranted() && $this->isSecret()) return false;
1108
+		if (!$this->isGranted() && $this->isSecret()) return false;
1109 1109
 
1110 1110
 		return true;
1111 1111
 	}
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	 */
1117 1117
 	function getCommentEditor()
1118 1118
 	{
1119
-		if(!$this->isEnableComment()) return;
1119
+		if (!$this->isEnableComment()) return;
1120 1120
 
1121 1121
 		$oEditorModel = getModel('editor');
1122 1122
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 	 */
1129 1129
 	function getProfileImage()
1130 1130
 	{
1131
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1131
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1132 1132
 		$oMemberModel = getModel('member');
1133 1133
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1134
-		if(!$profile_info) return;
1134
+		if (!$profile_info) return;
1135 1135
 
1136 1136
 		return $profile_info->src;
1137 1137
 	}
@@ -1143,21 +1143,21 @@  discard block
 block discarded – undo
1143 1143
 	function getSignature()
1144 1144
 	{
1145 1145
 		// Pass if a document doesn't exist
1146
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1146
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1147 1147
 		// Get signature information
1148 1148
 		$oMemberModel = getModel('member');
1149 1149
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1150 1150
 		// Check if a maximum height of signiture is set in the member module
1151
-		if(!isset($GLOBALS['__member_signature_max_height']))
1151
+		if (!isset($GLOBALS['__member_signature_max_height']))
1152 1152
 		{
1153 1153
 			$oModuleModel = getModel('module');
1154 1154
 			$member_config = $oModuleModel->getModuleConfig('member');
1155 1155
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1156 1156
 		}
1157
-		if($signature)
1157
+		if ($signature)
1158 1158
 		{
1159 1159
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1160
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1160
+			if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1161 1161
 		}
1162 1162
 
1163 1163
 		return $signature;
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 	 */
1171 1171
 	function replaceResourceRealPath($matches)
1172 1172
 	{
1173
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1173
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1174 1174
 	}
1175 1175
 
1176 1176
 	/**
@@ -1181,19 +1181,19 @@  discard block
 block discarded – undo
1181 1181
 	function _checkAccessibleFromStatus()
1182 1182
 	{
1183 1183
 		$logged_info = Context::get('logged_info');
1184
-		if($logged_info->is_admin == 'Y') return true;
1184
+		if ($logged_info->is_admin == 'Y') return true;
1185 1185
 
1186 1186
 		$status = $this->get('status');
1187
-		if(empty($status)) return false;
1187
+		if (empty($status)) return false;
1188 1188
 
1189 1189
 		$oDocumentModel = getModel('document');
1190 1190
 		$configStatusList = $oDocumentModel->getStatusList();
1191 1191
 
1192
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1192
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1193 1193
 			return true;
1194
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1194
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1195 1195
 		{
1196
-			if($this->get('member_srl') == $logged_info->member_srl)
1196
+			if ($this->get('member_srl') == $logged_info->member_srl)
1197 1197
 				return true;
1198 1198
 		}
1199 1199
 		return false;
Please login to merge, or discard this patch.
Braces   +258 added lines, -110 removed lines patch added patch discarded remove patch
@@ -79,7 +79,9 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if(!$this->document_srl) {
83
+			return;
84
+		}
83 85
 
84 86
 		$document_item = false;
85 87
 		$cache_put = false;
@@ -111,8 +113,7 @@  discard block
 block discarded – undo
111 113
 			{
112 114
 				$oCacheHandler->put($cache_key, $document_item);
113 115
 			}
114
-		}
115
-		else
116
+		} else
116 117
 		{
117 118
 			$document_item->readed_count = $output->data->readed_count;
118 119
 			$document_item->voted_count = $output->data->voted_count;
@@ -159,21 +160,29 @@  discard block
 block discarded – undo
159 160
 
160 161
 	function isGranted()
161 162
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163
+		if($_SESSION['own_document'][$this->document_srl]) {
164
+			return $this->grant_cache = true;
165
+		}
163 166
 
164 167
 		if($this->grant_cache !== null)
165 168
 		{
166 169
 			return $this->grant_cache;
167 170
 		}
168 171
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
172
+		if(!Context::get('is_logged')) {
173
+			return $this->grant_cache = false;
174
+		}
170 175
 
171 176
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
177
+		if($logged_info->is_admin == 'Y') {
178
+			return $this->grant_cache = true;
179
+		}
173 180
 
174 181
 		$oModuleModel = getModel('module');
175 182
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
183
+		if($grant->manager) {
184
+			return $this->grant_cache = true;
185
+		}
177 186
 
178 187
 		if($this->get('member_srl') && abs($this->get('member_srl')) == $logged_info->member_srl)
179 188
 		{
@@ -197,7 +206,9 @@  discard block
 block discarded – undo
197 206
 	function allowComment()
198 207
 	{
199 208
 		// init write, document is not exists. so allow comment status is true
200
-		if(!$this->isExists()) return true;
209
+		if(!$this->isExists()) {
210
+			return true;
211
+		}
201 212
 
202 213
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
203 214
 	}
@@ -212,8 +223,7 @@  discard block
 block discarded – undo
212 223
 			if(!getClass('trackback'))
213 224
 			{
214 225
 				$allow_trackback_status = false;
215
-			}
216
-			else
226
+			} else
217 227
 			{
218 228
 				// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
219 229
 				$oModuleModel = getModel('module');
@@ -224,15 +234,21 @@  discard block
 block discarded – undo
224 234
 					$trackback_config = new stdClass();
225 235
 				}
226 236
 				
227
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
228
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
229
-				else
237
+				if(!isset($trackback_config->enable_trackback)) {
238
+					$trackback_config->enable_trackback = 'Y';
239
+				}
240
+				if($trackback_config->enable_trackback != 'Y') {
241
+					$allow_trackback_status = false;
242
+				} else
230 243
 				{
231 244
 					$module_srl = $this->get('module_srl');
232 245
 					// Check settings of each module
233 246
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
234
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
235
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
247
+					if($module_config->enable_trackback == 'N') {
248
+						$allow_trackback_status = false;
249
+					} else if($this->get('allow_trackback')=='Y' || !$this->isExists()) {
250
+						$allow_trackback_status = true;
251
+					}
236 252
 				}
237 253
 			}
238 254
 		}
@@ -241,14 +257,18 @@  discard block
 block discarded – undo
241 257
 
242 258
 	function isLocked()
243 259
 	{
244
-		if(!$this->isExists()) return false;
260
+		if(!$this->isExists()) {
261
+			return false;
262
+		}
245 263
 
246 264
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
247 265
 	}
248 266
 
249 267
 	function isEditable()
250 268
 	{
251
-		if($this->isGranted() || !$this->get('member_srl')) return true;
269
+		if($this->isGranted() || !$this->get('member_srl')) {
270
+			return true;
271
+		}
252 272
 		return false;
253 273
 	}
254 274
 
@@ -270,9 +290,14 @@  discard block
 block discarded – undo
270 290
 
271 291
 	function doCart()
272 292
 	{
273
-		if(!$this->document_srl) return false;
274
-		if($this->isCarted()) $this->removeCart();
275
-		else $this->addCart();
293
+		if(!$this->document_srl) {
294
+			return false;
295
+		}
296
+		if($this->isCarted()) {
297
+			$this->removeCart();
298
+		} else {
299
+			$this->addCart();
300
+		}
276 301
 	}
277 302
 
278 303
 	function addCart()
@@ -298,16 +323,26 @@  discard block
 block discarded – undo
298 323
 	 */
299 324
 	function notify($type, $content)
300 325
 	{
301
-		if(!$this->document_srl) return;
326
+		if(!$this->document_srl) {
327
+			return;
328
+		}
302 329
 		// return if it is not useNotify
303
-		if(!$this->useNotify()) return;
330
+		if(!$this->useNotify()) {
331
+			return;
332
+		}
304 333
 		// Pass if an author is not a logged-in user
305
-		if(!$this->get('member_srl')) return;
334
+		if(!$this->get('member_srl')) {
335
+			return;
336
+		}
306 337
 		// Return if the currently logged-in user is an author
307 338
 		$logged_info = Context::get('logged_info');
308
-		if($logged_info->member_srl == $this->get('member_srl')) return;
339
+		if($logged_info->member_srl == $this->get('member_srl')) {
340
+			return;
341
+		}
309 342
 		// List variables
310
-		if($type) $title = "[".$type."] ";
343
+		if($type) {
344
+			$title = "[".$type."] ";
345
+		}
311 346
 		$title .= cut_str(strip_tags($content), 10, '...');
312 347
 		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
313 348
 		$receiver_srl = $this->get('member_srl');
@@ -334,16 +369,22 @@  discard block
 block discarded – undo
334 369
 
335 370
 	function isExistsHomepage()
336 371
 	{
337
-		if(trim($this->get('homepage'))) return true;
372
+		if(trim($this->get('homepage'))) {
373
+			return true;
374
+		}
338 375
 		return false;
339 376
 	}
340 377
 
341 378
 	function getHomepageUrl()
342 379
 	{
343 380
 		$url = trim($this->get('homepage'));
344
-		if(!$url) return;
381
+		if(!$url) {
382
+			return;
383
+		}
345 384
 
346
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
385
+		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) {
386
+			$url = 'http://' . $url;
387
+		}
347 388
 
348 389
 		return $url;
349 390
 	}
@@ -375,43 +416,65 @@  discard block
 block discarded – undo
375 416
 
376 417
 	function getTitleText($cut_size = 0, $tail='...')
377 418
 	{
378
-		if(!$this->document_srl) return;
419
+		if(!$this->document_srl) {
420
+			return;
421
+		}
379 422
 
380
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
381
-		else $title = $this->get('title');
423
+		if($cut_size) {
424
+			$title = cut_str($this->get('title'), $cut_size, $tail);
425
+		} else {
426
+			$title = $this->get('title');
427
+		}
382 428
 
383 429
 		return $title;
384 430
 	}
385 431
 
386 432
 	function getTitle($cut_size = 0, $tail='...')
387 433
 	{
388
-		if(!$this->document_srl) return;
434
+		if(!$this->document_srl) {
435
+			return;
436
+		}
389 437
 
390 438
 		$title = $this->getTitleText($cut_size, $tail);
391 439
 
392 440
 		$attrs = array();
393 441
 		$this->add('title_color', trim($this->get('title_color')));
394
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
395
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
442
+		if($this->get('title_bold')=='Y') {
443
+			$attrs[] = "font-weight:bold;";
444
+		}
445
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
446
+			$attrs[] = "color:#".$this->get('title_color');
447
+		}
396 448
 
397
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
398
-		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
449
+		if(count($attrs)) {
450
+			return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
451
+		} else {
452
+			return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
453
+		}
399 454
 	}
400 455
 
401 456
 	function getContentText($strlen = 0)
402 457
 	{
403
-		if(!$this->document_srl) return;
458
+		if(!$this->document_srl) {
459
+			return;
460
+		}
404 461
 
405
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
462
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
463
+			return Context::getLang('msg_is_secret');
464
+		}
406 465
 
407 466
 		$result = $this->_checkAccessibleFromStatus();
408
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
467
+		if($result) {
468
+			$_SESSION['accessible'][$this->document_srl] = true;
469
+		}
409 470
 
410 471
 		$content = $this->get('content');
411 472
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
412 473
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
413 474
 
414
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
475
+		if($strlen) {
476
+			return cut_str(strip_tags($content),$strlen,'...');
477
+		}
415 478
 
416 479
 		return htmlspecialchars($content);
417 480
 	}
@@ -444,14 +507,12 @@  discard block
 block discarded – undo
444 507
 				}
445 508
 				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
446 509
 			}
447
-		}
448
-		else if($m[1] == 'embed')
510
+		} else if($m[1] == 'embed')
449 511
 		{
450 512
 			if(stripos($m[0], 'allowscriptaccess'))
451 513
 			{
452 514
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
453
-			}
454
-			else
515
+			} else
455 516
 			{
456 517
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
457 518
 			}
@@ -461,15 +522,23 @@  discard block
 block discarded – undo
461 522
 
462 523
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
463 524
 	{
464
-		if(!$this->document_srl) return;
525
+		if(!$this->document_srl) {
526
+			return;
527
+		}
465 528
 
466
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
529
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
530
+			return Context::getLang('msg_is_secret');
531
+		}
467 532
 
468 533
 		$result = $this->_checkAccessibleFromStatus();
469
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
534
+		if($result) {
535
+			$_SESSION['accessible'][$this->document_srl] = true;
536
+		}
470 537
 
471 538
 		$content = $this->get('content');
472
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
539
+		if(!$stripEmbedTagException) {
540
+			stripEmbedTagForAdmin($content, $this->get('member_srl'));
541
+		}
473 542
 
474 543
 		// Define a link if using a rewrite module
475 544
 		$oContext = &Context::getInstance();
@@ -503,10 +572,11 @@  discard block
 block discarded – undo
503 572
 				$this->document_srl, $memberSrl
504 573
 			);
505 574
 			// Add xe_content class although accessing content is not required
506
-		}
507
-		else
575
+		} else
508 576
 		{
509
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
577
+			if($add_xe_content_class) {
578
+				$content = sprintf('<div class="xe_content">%s</div>', $content);
579
+			}
510 580
 		}
511 581
 		// Change the image path to a valid absolute path if resource_realpath is true
512 582
 		if($resource_realpath)
@@ -625,11 +695,15 @@  discard block
 block discarded – undo
625 695
 
626 696
 	function getTrackbackUrl()
627 697
 	{
628
-		if(!$this->document_srl) return;
698
+		if(!$this->document_srl) {
699
+			return;
700
+		}
629 701
 
630 702
 		// Generate a key to prevent spams
631 703
 		$oTrackbackModel = getModel('trackback');
632
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
704
+		if($oTrackbackModel) {
705
+			return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
706
+		}
633 707
 	}
634 708
 
635 709
 	/**
@@ -648,7 +722,9 @@  discard block
 block discarded – undo
648 722
 
649 723
 	function isExtraVarsExists()
650 724
 	{
651
-		if(!$this->get('module_srl')) return false;
725
+		if(!$this->get('module_srl')) {
726
+			return false;
727
+		}
652 728
 		$oDocumentModel = getModel('document');
653 729
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
654 730
 		return count($extra_keys)?true:false;
@@ -656,7 +732,9 @@  discard block
 block discarded – undo
656 732
 
657 733
 	function getExtraVars()
658 734
 	{
659
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
735
+		if(!$this->get('module_srl') || !$this->document_srl) {
736
+			return null;
737
+		}
660 738
 
661 739
 		$oDocumentModel = getModel('document');
662 740
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -668,8 +746,7 @@  discard block
 block discarded – undo
668 746
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
669 747
 		{
670 748
 			return $extra_vars[$idx]->getValue();
671
-		}
672
-		else
749
+		} else
673 750
 		{
674 751
 			return '';
675 752
 		}
@@ -681,8 +758,7 @@  discard block
 block discarded – undo
681 758
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
682 759
 		{
683 760
 			return $extra_vars[$idx]->getValueHTML();
684
-		}
685
-		else
761
+		} else
686 762
 		{
687 763
 			return '';
688 764
 		}
@@ -704,8 +780,7 @@  discard block
 block discarded – undo
704 780
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
705 781
 		{
706 782
 			return $extra_eid[$eid]->getValue();
707
-		}
708
-		else
783
+		} else
709 784
 		{
710 785
 			return '';
711 786
 		}
@@ -723,8 +798,7 @@  discard block
 block discarded – undo
723 798
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
724 799
 		{
725 800
 			return $extra_eid[$eid]->getValueHTML();
726
-		}
727
-		else
801
+		} else
728 802
 		{
729 803
 			return '';
730 804
 		}
@@ -744,8 +818,12 @@  discard block
 block discarded – undo
744 818
 
745 819
 	function getComments()
746 820
 	{
747
-		if(!$this->getCommentCount()) return;
748
-		if(!$this->isGranted() && $this->isSecret()) return;
821
+		if(!$this->getCommentCount()) {
822
+			return;
823
+		}
824
+		if(!$this->isGranted() && $this->isSecret()) {
825
+			return;
826
+		}
749 827
 		// cpage is a number of comment pages
750 828
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
751 829
 		$cpage = Context::get($cpageStr);
@@ -758,7 +836,9 @@  discard block
 block discarded – undo
758 836
 		// Get a list of comments
759 837
 		$oCommentModel = getModel('comment');
760 838
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
761
-		if(!$output->toBool() || !count($output->data)) return;
839
+		if(!$output->toBool() || !count($output->data)) {
840
+			return;
841
+		}
762 842
 		// Create commentItem object from a comment list
763 843
 		// If admin priviledge is granted on parent posts, you can read its child posts.
764 844
 		$accessible = array();
@@ -768,7 +848,9 @@  discard block
 block discarded – undo
768 848
 			$oCommentItem = new commentItem();
769 849
 			$oCommentItem->setAttribute($val);
770 850
 			// If permission is granted to the post, you can access it temporarily
771
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
851
+			if($oCommentItem->isGranted()) {
852
+				$accessible[$val->comment_srl] = true;
853
+			}
772 854
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
773 855
 			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
774 856
 			{
@@ -779,7 +861,9 @@  discard block
 block discarded – undo
779 861
 		// Variable setting to be displayed on the skin
780 862
 		Context::set($cpageStr, $output->page_navigation->cur_page);
781 863
 		Context::set('cpage', $output->page_navigation->cur_page);
782
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
864
+		if($output->total_page>1) {
865
+			$this->comment_page_navigation = $output->page_navigation;
866
+		}
783 867
 
784 868
 		return $comment_list;
785 869
 	}
@@ -791,9 +875,13 @@  discard block
 block discarded – undo
791 875
 
792 876
 	function getTrackbacks()
793 877
 	{
794
-		if(!$this->document_srl) return;
878
+		if(!$this->document_srl) {
879
+			return;
880
+		}
795 881
 
796
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
882
+		if(!$this->allowTrackback() || !$this->get('trackback_count')) {
883
+			return;
884
+		}
797 885
 
798 886
 		$oTrackbackModel = getModel('trackback');
799 887
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -801,15 +889,21 @@  discard block
 block discarded – undo
801 889
 
802 890
 	function thumbnailExists($width = 80, $height = 0, $type = '')
803 891
 	{
804
-		if(!$this->document_srl) return false;
805
-		if(!$this->getThumbnail($width, $height, $type)) return false;
892
+		if(!$this->document_srl) {
893
+			return false;
894
+		}
895
+		if(!$this->getThumbnail($width, $height, $type)) {
896
+			return false;
897
+		}
806 898
 		return true;
807 899
 	}
808 900
 
809 901
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
810 902
 	{
811 903
 		// Return false if the document doesn't exist
812
-		if(!$this->document_srl) return;
904
+		if(!$this->document_srl) {
905
+			return;
906
+		}
813 907
 
814 908
 		if($this->isSecret() && !$this->isGranted())
815 909
 		{
@@ -817,7 +911,9 @@  discard block
 block discarded – undo
817 911
 		}
818 912
 
819 913
 		// If not specify its height, create a square
820
-		if(!$height) $height = $width;
914
+		if(!$height) {
915
+			$height = $width;
916
+		}
821 917
 
822 918
 		// Return false if neither attachement nor image files in the document
823 919
 		$content = $this->get('content');
@@ -835,7 +931,9 @@  discard block
 block discarded – undo
835 931
 				}
836 932
 			}
837 933
 
838
-			if(!preg_match("!<img!is", $content)) return;
934
+			if(!preg_match("!<img!is", $content)) {
935
+				return;
936
+			}
839 937
 		}
840 938
 		// Get thumbnai_type information from document module's configuration
841 939
 		if(!in_array($thumbnail_type, array('crop','ratio')))
@@ -862,8 +960,7 @@  discard block
 block discarded – undo
862 960
 			if(filesize($thumbnail_file) < 1)
863 961
 			{
864 962
 				return FALSE;
865
-			}
866
-			else
963
+			} else
867 964
 			{
868 965
 				return $thumbnail_url . '?' . date('YmdHis', filemtime($thumbnail_file));
869 966
 			}
@@ -884,7 +981,9 @@  discard block
 block discarded – undo
884 981
 			$first_image = null;
885 982
 			foreach($file_list as $file)
886 983
 			{
887
-				if($file->direct_download !== 'Y') continue;
984
+				if($file->direct_download !== 'Y') {
985
+					continue;
986
+				}
888 987
 
889 988
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
890 989
 				{
@@ -892,7 +991,9 @@  discard block
 block discarded – undo
892 991
 					break;
893 992
 				}
894 993
 
895
-				if($first_image) continue;
994
+				if($first_image) {
995
+					continue;
996
+				}
896 997
 
897 998
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
898 999
 				{
@@ -919,7 +1020,9 @@  discard block
 block discarded – undo
919 1020
 			foreach($matches as $target_image)
920 1021
 			{
921 1022
 				$target_src = trim($target_image[1]);
922
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
1023
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
1024
+					continue;
1025
+				}
923 1026
 
924 1027
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
925 1028
 				{
@@ -930,7 +1033,9 @@  discard block
 block discarded – undo
930 1033
 
931 1034
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
932 1035
 				FileHandler::getRemoteFile($target_src, $tmp_file);
933
-				if(!file_exists($tmp_file)) continue;
1036
+				if(!file_exists($tmp_file)) {
1037
+					continue;
1038
+				}
934 1039
 
935 1040
 				$imageinfo = getimagesize($tmp_file);
936 1041
 				list($_w, $_h) = $imageinfo;
@@ -976,21 +1081,28 @@  discard block
 block discarded – undo
976 1081
 	 */
977 1082
 	function getExtraImages($time_interval = 43200)
978 1083
 	{
979
-		if(!$this->document_srl) return;
1084
+		if(!$this->document_srl) {
1085
+			return;
1086
+		}
980 1087
 		// variables for icon list
981 1088
 		$buffs = array();
982 1089
 
983 1090
 		$check_files = false;
984 1091
 
985 1092
 		// Check if secret post is
986
-		if($this->isSecret()) $buffs[] = "secret";
1093
+		if($this->isSecret()) {
1094
+			$buffs[] = "secret";
1095
+		}
987 1096
 
988 1097
 		// Set the latest time
989 1098
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
990 1099
 
991 1100
 		// Check new post
992
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
993
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1101
+		if($this->get('regdate')>$time_check) {
1102
+			$buffs[] = "new";
1103
+		} else if($this->get('last_update')>$time_check) {
1104
+			$buffs[] = "update";
1105
+		}
994 1106
 
995 1107
 		/*
996 1108
 		   $content = $this->get('content');
@@ -1013,7 +1125,9 @@  discard block
 block discarded – undo
1013 1125
 		 */
1014 1126
 
1015 1127
 		// Check the attachment
1016
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1128
+		if($this->hasUploadedFiles()) {
1129
+			$buffs[] = "file";
1130
+		}
1017 1131
 
1018 1132
 		return $buffs;
1019 1133
 	}
@@ -1034,22 +1148,25 @@  discard block
 block discarded – undo
1034 1148
 	 */
1035 1149
 	function printExtraImages($time_check = 43200)
1036 1150
 	{
1037
-		if(!$this->document_srl) return;
1151
+		if(!$this->document_srl) {
1152
+			return;
1153
+		}
1038 1154
 
1039 1155
 		$oDocumentModel = getModel('document');
1040 1156
 		$documentConfig = $oDocumentModel->getDocumentConfig();
1041 1157
 		if(Mobile::isFromMobilePhone())
1042 1158
 		{
1043 1159
 			$iconSkin = $documentConfig->micons;
1044
-		}
1045
-		else
1160
+		} else
1046 1161
 		{
1047 1162
 			$iconSkin = $documentConfig->icons;
1048 1163
 		}
1049 1164
 		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1050 1165
 
1051 1166
 		$buffs = $this->getExtraImages($time_check);
1052
-		if(!count($buffs)) return;
1167
+		if(!count($buffs)) {
1168
+			return;
1169
+		}
1053 1170
 
1054 1171
 		$buff = array();
1055 1172
 		foreach($buffs as $key => $val)
@@ -1061,18 +1178,28 @@  discard block
 block discarded – undo
1061 1178
 
1062 1179
 	function hasUploadedFiles()
1063 1180
 	{
1064
-		if(!$this->document_srl) return;
1181
+		if(!$this->document_srl) {
1182
+			return;
1183
+		}
1065 1184
 
1066
-		if($this->isSecret() && !$this->isGranted()) return false;
1185
+		if($this->isSecret() && !$this->isGranted()) {
1186
+			return false;
1187
+		}
1067 1188
 		return $this->get('uploaded_count')? true : false;
1068 1189
 	}
1069 1190
 
1070 1191
 	function getUploadedFiles($sortIndex = 'file_srl')
1071 1192
 	{
1072
-		if(!$this->document_srl) return;
1193
+		if(!$this->document_srl) {
1194
+			return;
1195
+		}
1073 1196
 
1074
-		if($this->isSecret() && !$this->isGranted()) return;
1075
-		if(!$this->get('uploaded_count')) return;
1197
+		if($this->isSecret() && !$this->isGranted()) {
1198
+			return;
1199
+		}
1200
+		if(!$this->get('uploaded_count')) {
1201
+			return;
1202
+		}
1076 1203
 
1077 1204
 		if(!$this->uploadedFiles[$sortIndex])
1078 1205
 		{
@@ -1090,7 +1217,9 @@  discard block
 block discarded – undo
1090 1217
 	function getEditor()
1091 1218
 	{
1092 1219
 		$module_srl = $this->get('module_srl');
1093
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1220
+		if(!$module_srl) {
1221
+			$module_srl = Context::get('module_srl');
1222
+		}
1094 1223
 
1095 1224
 		$oEditorModel = getModel('editor');
1096 1225
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1104,8 +1233,12 @@  discard block
 block discarded – undo
1104 1233
 	function isEnableComment()
1105 1234
 	{
1106 1235
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1107
-		if (!$this->allowComment()) return false;
1108
-		if(!$this->isGranted() && $this->isSecret()) return false;
1236
+		if (!$this->allowComment()) {
1237
+			return false;
1238
+		}
1239
+		if(!$this->isGranted() && $this->isSecret()) {
1240
+			return false;
1241
+		}
1109 1242
 
1110 1243
 		return true;
1111 1244
 	}
@@ -1116,7 +1249,9 @@  discard block
 block discarded – undo
1116 1249
 	 */
1117 1250
 	function getCommentEditor()
1118 1251
 	{
1119
-		if(!$this->isEnableComment()) return;
1252
+		if(!$this->isEnableComment()) {
1253
+			return;
1254
+		}
1120 1255
 
1121 1256
 		$oEditorModel = getModel('editor');
1122 1257
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1128,10 +1263,14 @@  discard block
 block discarded – undo
1128 1263
 	 */
1129 1264
 	function getProfileImage()
1130 1265
 	{
1131
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1266
+		if(!$this->isExists() || !$this->get('member_srl')) {
1267
+			return;
1268
+		}
1132 1269
 		$oMemberModel = getModel('member');
1133 1270
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1134
-		if(!$profile_info) return;
1271
+		if(!$profile_info) {
1272
+			return;
1273
+		}
1135 1274
 
1136 1275
 		return $profile_info->src;
1137 1276
 	}
@@ -1143,7 +1282,9 @@  discard block
 block discarded – undo
1143 1282
 	function getSignature()
1144 1283
 	{
1145 1284
 		// Pass if a document doesn't exist
1146
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1285
+		if(!$this->isExists() || !$this->get('member_srl')) {
1286
+			return;
1287
+		}
1147 1288
 		// Get signature information
1148 1289
 		$oMemberModel = getModel('member');
1149 1290
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1157,7 +1298,9 @@  discard block
 block discarded – undo
1157 1298
 		if($signature)
1158 1299
 		{
1159 1300
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1160
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1301
+			if($max_signature_height) {
1302
+				$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1303
+			}
1161 1304
 		}
1162 1305
 
1163 1306
 		return $signature;
@@ -1181,20 +1324,25 @@  discard block
 block discarded – undo
1181 1324
 	function _checkAccessibleFromStatus()
1182 1325
 	{
1183 1326
 		$logged_info = Context::get('logged_info');
1184
-		if($logged_info->is_admin == 'Y') return true;
1327
+		if($logged_info->is_admin == 'Y') {
1328
+			return true;
1329
+		}
1185 1330
 
1186 1331
 		$status = $this->get('status');
1187
-		if(empty($status)) return false;
1332
+		if(empty($status)) {
1333
+			return false;
1334
+		}
1188 1335
 
1189 1336
 		$oDocumentModel = getModel('document');
1190 1337
 		$configStatusList = $oDocumentModel->getStatusList();
1191 1338
 
1192
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1193
-			return true;
1194
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1339
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1340
+					return true;
1341
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1195 1342
 		{
1196
-			if($this->get('member_srl') == $logged_info->member_srl)
1197
-				return true;
1343
+			if($this->get('member_srl') == $logged_info->member_srl) {
1344
+							return true;
1345
+			}
1198 1346
 		}
1199 1347
 		return false;
1200 1348
 	}
Please login to merge, or discard this patch.
classes/module/ModuleHandler.class.php 2 patches
Braces   +30 added lines, -45 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
 		$called_position = 'before_module_init';
116 116
 		$oAddonController = getController('addon');
117 117
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
118
-		if(file_exists($addon_file)) include($addon_file);
118
+		if(file_exists($addon_file)) {
119
+			include($addon_file);
120
+		}
119 121
 	}
120 122
 
121 123
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
@@ -257,8 +259,7 @@  discard block
 block discarded – undo
257 259
 			if(!$module_info)
258 260
 			{
259 261
 				unset($this->document_srl);
260
-			}
261
-			else
262
+			} else
262 263
 			{
263 264
 				// If it exists, compare mid based on the module information
264 265
 				// if mids are not matching, set it as the document's mid
@@ -270,8 +271,7 @@  discard block
 block discarded – undo
270 271
 						$this->mid = $module_info->mid;
271 272
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 273
 						return FALSE;
273
-					}
274
-					else
274
+					} else
275 275
 					{
276 276
 						$this->mid = $module_info->mid;
277 277
 						Context::set('mid', $this->mid);
@@ -322,15 +322,13 @@  discard block
 block discarded – undo
322 322
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
323 323
 				$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'));
324 324
 				// If it's called from a virtual site, though it's not a module of the virtual site
325
-			}
326
-			else
325
+			} else
327 326
 			{
328 327
 				$db_info = Context::getDBInfo();
329 328
 				if(!$db_info->default_url)
330 329
 				{
331 330
 					return Context::getLang('msg_default_url_is_not_defined');
332
-				}
333
-				else
331
+				} else
334 332
 				{
335 333
 					$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'));
336 334
 				}
@@ -355,8 +353,7 @@  discard block
 block discarded – undo
355 353
 			{
356 354
 				$oLayoutAdminModel = getAdminModel('layout');
357 355
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
358
-			}
359
-			else
356
+			} else
360 357
 			{
361 358
 				$layoutSrl = $module_info->{$targetSrl};
362 359
 			}
@@ -490,8 +487,7 @@  discard block
 block discarded – undo
490 487
 			if(!$allowedMethod)
491 488
 			{
492 489
 				$allowedMethodList[0] = 'POST';
493
-			}
494
-			else
490
+			} else
495 491
 			{
496 492
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
497 493
 			}
@@ -551,8 +547,7 @@  discard block
 block discarded – undo
551 547
 				Mobile::setMobile(FALSE);
552 548
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
553 549
 			}
554
-		}
555
-		else
550
+		} else
556 551
 		{
557 552
 			// create a module instance
558 553
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -606,8 +601,7 @@  discard block
 block discarded – undo
606 601
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
607 602
 					$forward->meta_noindex = $xml_info->action->{$this->act}->meta_noindex;
608 603
 					$forward->act = $this->act;
609
-				}
610
-				else
604
+				} else
611 605
 				{
612 606
 					$this->error = 'msg_invalid_request';
613 607
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -659,8 +653,7 @@  discard block
 block discarded – undo
659 653
 					if(!$allowedMethod)
660 654
 					{
661 655
 						$allowedMethodList[0] = 'POST';
662
-					}
663
-					else
656
+					} else
664 657
 					{
665 658
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
666 659
 					}
@@ -688,8 +681,7 @@  discard block
 block discarded – undo
688 681
 						Mobile::setMobile(FALSE);
689 682
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
690 683
 					}
691
-				}
692
-				else
684
+				} else
693 685
 				{
694 686
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
695 687
 				}
@@ -719,8 +711,7 @@  discard block
 block discarded – undo
719 711
 							$oModule->setLayoutPath("./modules/admin/tpl");
720 712
 							$oModule->setLayoutFile("layout.html");
721 713
 						}
722
-					}
723
-					else
714
+					} else
724 715
 					{
725 716
 						$this->_setInputErrorToContext();
726 717
 
@@ -744,8 +735,7 @@  discard block
 block discarded – undo
744 735
 						$oMessageObject->setMessage($this->error);
745 736
 						$oMessageObject->dispMessage();
746 737
 						return $oMessageObject;
747
-					}
748
-					else
738
+					} else
749 739
 					{
750 740
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
751 741
 						{
@@ -759,12 +749,10 @@  discard block
 block discarded – undo
759 749
 						}
760 750
 					}
761 751
 				}
762
-			}
763
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
752
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
764 753
 			{
765 754
 				$this->act = $xml_info->default_index_act;
766
-			}
767
-			else
755
+			} else
768 756
 			{
769 757
 				$this->error = 'msg_invalid_request';
770 758
 				$oModule->setError(-1);
@@ -866,7 +854,9 @@  discard block
 block discarded – undo
866 854
 			$message = $oModule->getMessage();
867 855
 			$messageType = $oModule->getMessageType();
868 856
 			$redirectUrl = $oModule->getRedirectUrl();
869
-			if($messageType == 'error') debugPrint($message, 'ERROR');
857
+			if($messageType == 'error') {
858
+				debugPrint($message, 'ERROR');
859
+			}
870 860
 
871 861
 			if(!$procResult)
872 862
 			{
@@ -876,8 +866,7 @@  discard block
 block discarded – undo
876 866
 					$redirectUrl = Context::get('error_return_url');
877 867
 				}
878 868
 				$this->_setInputValueToSession();
879
-			}
880
-			else
869
+			} else
881 870
 			{
882 871
 
883 872
 			}
@@ -1025,8 +1014,7 @@  discard block
 block discarded – undo
1025 1014
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1026 1015
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
1027 1016
 					// Otherwise, set message instance as the target module
1028
-				}
1029
-				else
1017
+				} else
1030 1018
 				{
1031 1019
 					$oModule = $oMessageObject;
1032 1020
 				}
@@ -1038,8 +1026,7 @@  discard block
 block discarded – undo
1038 1026
 			if(Mobile::isFromMobilePhone())
1039 1027
 			{
1040 1028
 				$layout_srl = $oModule->module_info->mlayout_srl;
1041
-			}
1042
-			else
1029
+			} else
1043 1030
 			{
1044 1031
 				$layout_srl = $oModule->module_info->layout_srl;
1045 1032
 			}
@@ -1098,8 +1085,7 @@  discard block
 block discarded – undo
1098 1085
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1099 1086
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1100 1087
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1101
-								}
1102
-								else
1088
+								} else
1103 1089
 								{
1104 1090
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
1105 1091
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1136,8 +1122,7 @@  discard block
 block discarded – undo
1136 1122
 				if($kind == 'admin')
1137 1123
 				{
1138 1124
 					$oModule->setLayoutFile('popup_layout');
1139
-				}
1140
-				else
1125
+				} else
1141 1126
 				{
1142 1127
 					$oModule->setLayoutPath('common/tpl');
1143 1128
 					$oModule->setLayoutFile('default_layout');
@@ -1271,13 +1256,11 @@  discard block
 block discarded – undo
1271 1256
 		{
1272 1257
 			$instanceName = '%s';
1273 1258
 			$classFile = '%s%s.%s.php';
1274
-		}
1275
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1259
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1276 1260
 		{
1277 1261
 			$instanceName = '%sAdmin%s';
1278 1262
 			$classFile = '%s%s.admin.%s.php';
1279
-		}
1280
-		else
1263
+		} else
1281 1264
 		{
1282 1265
 			$instanceName = '%s%s';
1283 1266
 			$classFile = '%s%s.%s.php';
@@ -1340,7 +1323,9 @@  discard block
 block discarded – undo
1340 1323
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1341 1324
 			$slowlog->called = $module . '.' . $called_method;
1342 1325
 			$slowlog->called_extension = $module;
1343
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1326
+			if($trigger_name != 'XE.writeSlowlog') {
1327
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1328
+			}
1344 1329
 
1345 1330
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1346 1331
 			{
Please login to merge, or discard this patch.
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
 		$defaultUrlInfo = parse_url($dbInfo->default_url);
220 220
 		$defaultHost = $defaultUrlInfo['host'];
221 221
 
222
-		foreach($urls as $url)
222
+		foreach ($urls as $url)
223 223
 		{
224
-			if(empty($url))
224
+			if (empty($url))
225 225
 			{
226 226
 				continue;
227 227
 			}
@@ -229,29 +229,29 @@  discard block
 block discarded – undo
229 229
 			$urlInfo = parse_url($url);
230 230
 			$host = $urlInfo['host'];
231 231
 
232
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
232
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
233 233
 			{
234 234
 				throw new Exception('msg_default_url_is_null');
235 235
 			}
236 236
 		}
237 237
 
238
-		if(!$this->document_srl && $this->mid && $this->entry)
238
+		if (!$this->document_srl && $this->mid && $this->entry)
239 239
 		{
240 240
 			$oDocumentModel = getModel('document');
241 241
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
242
-			if($this->document_srl)
242
+			if ($this->document_srl)
243 243
 			{
244 244
 				Context::set('document_srl', $this->document_srl);
245 245
 			}
246 246
 		}
247 247
 
248 248
 		// Get module's information based on document_srl, if it's specified
249
-		if($this->document_srl)
249
+		if ($this->document_srl)
250 250
 		{
251 251
 
252 252
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
253 253
 			// If the document does not exist, remove document_srl
254
-			if(!$module_info)
254
+			if (!$module_info)
255 255
 			{
256 256
 				unset($this->document_srl);
257 257
 			}
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 			{
260 260
 				// If it exists, compare mid based on the module information
261 261
 				// if mids are not matching, set it as the document's mid
262
-				if(!$this->mid || ($this->mid != $module_info->mid))
262
+				if (!$this->mid || ($this->mid != $module_info->mid))
263 263
 				{
264 264
 
265
-					if(Context::getRequestMethod() == 'GET')
265
+					if (Context::getRequestMethod() == 'GET')
266 266
 					{
267 267
 						$this->mid = $module_info->mid;
268
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
268
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
269 269
 						return FALSE;
270 270
 					}
271 271
 					else
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 				}
278 278
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
279
-				if($this->module && $module_info->module != $this->module)
279
+				if ($this->module && $module_info->module != $this->module)
280 280
 				{
281 281
 					unset($module_info);
282 282
 				}
@@ -285,36 +285,36 @@  discard block
 block discarded – undo
285 285
 		}
286 286
 
287 287
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
288
-		if(!$module_info && $this->mid)
288
+		if (!$module_info && $this->mid)
289 289
 		{
290 290
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
291 291
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
292 292
 		}
293 293
 
294 294
 		// redirect, if module_site_srl and site_srl are different
295
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
295
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
296 296
 		{
297 297
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
298
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
298
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
299 299
 			return FALSE;
300 300
 		}
301 301
 
302 302
 		// If module_info is not set still, and $module does not exist, find the default module
303
-		if(!$module_info && !$this->module && !$this->mid)
303
+		if (!$module_info && !$this->module && !$this->mid)
304 304
 		{
305 305
 			$module_info = $site_module_info;
306 306
 		}
307 307
 
308
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
308
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
309 309
 		{
310 310
 			$module_info = $site_module_info;
311 311
 		}
312 312
 
313 313
 		// redirect, if site_srl of module_info is different from one of site's module_info
314
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
314
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
315 315
 		{
316 316
 			// If the module is of virtual site
317
-			if($module_info->site_srl)
317
+			if ($module_info->site_srl)
318 318
 			{
319 319
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
320 320
 				$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'));
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			else
324 324
 			{
325 325
 				$db_info = Context::getDBInfo();
326
-				if(!$db_info->default_url)
326
+				if (!$db_info->default_url)
327 327
 				{
328 328
 					return Context::getLang('msg_default_url_is_not_defined');
329 329
 				}
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 					$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'));
333 333
 				}
334 334
 			}
335
-			header("location:" . $redirect_url);
335
+			header("location:".$redirect_url);
336 336
 			return FALSE;
337 337
 		}
338 338
 
339 339
 		// If module info was set, retrieve variables from the module information
340
-		if($module_info)
340
+		if ($module_info)
341 341
 		{
342 342
 			$this->module = $module_info->module;
343 343
 			$this->mid = $module_info->mid;
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
349 349
 
350 350
 			// use the site default layout.
351
-			if($module_info->{$targetSrl} == -1)
351
+			if ($module_info->{$targetSrl} == -1)
352 352
 			{
353 353
 				$oLayoutAdminModel = getAdminModel('layout');
354 354
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		}
367 367
 
368 368
 		// Set module and mid into module_info
369
-		if(!isset($this->module_info))
369
+		if (!isset($this->module_info))
370 370
 		{
371 371
 			$this->module_info = new stdClass();
372 372
 		}
@@ -377,21 +377,21 @@  discard block
 block discarded – undo
377 377
 		$this->module_info->site_srl = $site_module_info->site_srl;
378 378
 
379 379
 		// Still no module? it's an error
380
-		if(!$this->module)
380
+		if (!$this->module)
381 381
 		{
382 382
 			$this->error = 'msg_module_is_not_exists';
383 383
 			$this->httpStatusCode = '404';
384 384
 		}
385 385
 
386 386
 		// If mid exists, set mid into context
387
-		if($this->mid)
387
+		if ($this->mid)
388 388
 		{
389 389
 			Context::set('mid', $this->mid, TRUE);
390 390
 		}
391 391
 
392 392
 		// Call a trigger after moduleHandler init
393 393
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
394
-		if(!$output->toBool())
394
+		if (!$output->toBool())
395 395
 		{
396 396
 			$this->error = $output->getMessage();
397 397
 			return TRUE;
@@ -413,14 +413,14 @@  discard block
 block discarded – undo
413 413
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
414 414
 
415 415
 		// If error occurred while preparation, return a message instance
416
-		if($this->error)
416
+		if ($this->error)
417 417
 		{
418 418
 			$this->_setInputErrorToContext();
419 419
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
420 420
 			$oMessageObject->setError(-1);
421 421
 			$oMessageObject->setMessage($this->error);
422 422
 			$oMessageObject->dispMessage();
423
-			if($this->httpStatusCode)
423
+			if ($this->httpStatusCode)
424 424
 			{
425 425
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
426 426
 			}
@@ -431,22 +431,22 @@  discard block
 block discarded – undo
431 431
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
432 432
 
433 433
 		// If not installed yet, modify act
434
-		if($this->module == "install")
434
+		if ($this->module == "install")
435 435
 		{
436
-			if(!$this->act || !$xml_info->action->{$this->act})
436
+			if (!$this->act || !$xml_info->action->{$this->act})
437 437
 			{
438 438
 				$this->act = $xml_info->default_index_act;
439 439
 			}
440 440
 		}
441 441
 
442 442
 		// if act exists, find type of the action, if not use default index act
443
-		if(!$this->act)
443
+		if (!$this->act)
444 444
 		{
445 445
 			$this->act = $xml_info->default_index_act;
446 446
 		}
447 447
 
448 448
 		// still no act means error
449
-		if(!$this->act)
449
+		if (!$this->act)
450 450
 		{
451 451
 			$this->error = 'msg_module_is_not_exists';
452 452
 			$this->httpStatusCode = '404';
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			$oMessageObject->setError(-1);
457 457
 			$oMessageObject->setMessage($this->error);
458 458
 			$oMessageObject->dispMessage();
459
-			if($this->httpStatusCode)
459
+			if ($this->httpStatusCode)
460 460
 			{
461 461
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
462 462
 			}
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
 			Context::addMetaTag('robots', 'noindex');
475 475
 		}
476 476
 
477
-		if(!$kind && $this->module == 'admin')
477
+		if (!$kind && $this->module == 'admin')
478 478
 		{
479 479
 			$kind = 'admin';
480 480
 		}
481 481
 
482 482
 		// check REQUEST_METHOD in controller
483
-		if($type == 'controller')
483
+		if ($type == 'controller')
484 484
 		{
485 485
 			$allowedMethod = $xml_info->action->{$this->act}->method;
486 486
 
487
-			if(!$allowedMethod)
487
+			if (!$allowedMethod)
488 488
 			{
489 489
 				$allowedMethodList[0] = 'POST';
490 490
 			}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
494 494
 			}
495 495
 
496
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
496
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
497 497
 			{
498 498
 				$this->error = "msg_invalid_request";
499 499
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			}
505 505
 		}
506 506
 
507
-		if($this->module_info->use_mobile != "Y")
507
+		if ($this->module_info->use_mobile != "Y")
508 508
 		{
509 509
 			Mobile::setMobile(FALSE);
510 510
 		}
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 
514 514
 		// check CSRF for non-GET actions
515 515
 		$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
516
-		if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
516
+		if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
517 517
 		{
518 518
 			$this->error = 'msg_invalid_request';
519 519
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		}
525 525
 
526 526
 		// Admin ip
527
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
527
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
528 528
 		{
529 529
 			$this->_setInputErrorToContext();
530 530
 			$this->error = "msg_not_permitted_act";
@@ -536,13 +536,13 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		// if(type == view, and case for using mobilephone)
539
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
539
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
540 540
 		{
541 541
 			$orig_type = "view";
542 542
 			$type = "mobile";
543 543
 			// create a module instance
544 544
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
545
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
545
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
546 546
 			{
547 547
 				$type = $orig_type;
548 548
 				Mobile::setMobile(FALSE);
@@ -555,14 +555,14 @@  discard block
 block discarded – undo
555 555
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
556 556
 		}
557 557
 
558
-		if(!is_object($oModule))
558
+		if (!is_object($oModule))
559 559
 		{
560 560
 			$this->_setInputErrorToContext();
561 561
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
562 562
 			$oMessageObject->setError(-1);
563 563
 			$oMessageObject->setMessage($this->error);
564 564
 			$oMessageObject->dispMessage();
565
-			if($this->httpStatusCode)
565
+			if ($this->httpStatusCode)
566 566
 			{
567 567
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
568 568
 			}
@@ -570,10 +570,10 @@  discard block
 block discarded – undo
570 570
 		}
571 571
 
572 572
 		// If there is no such action in the module object
573
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
573
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
574 574
 		{
575 575
 
576
-			if(!Context::isInstalled())
576
+			if (!Context::isInstalled())
577 577
 			{
578 578
 				$this->_setInputErrorToContext();
579 579
 				$this->error = 'msg_invalid_request';
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 				$oMessageObject->setError(-1);
582 582
 				$oMessageObject->setMessage($this->error);
583 583
 				$oMessageObject->dispMessage();
584
-				if($this->httpStatusCode)
584
+				if ($this->httpStatusCode)
585 585
 				{
586 586
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
587 587
 				}
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 
591 591
 			$forward = NULL;
592 592
 			// 1. Look for the module with action name
593
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
593
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
594 594
 			{
595
-				$module = strtolower($matches[2] . $matches[3]);
595
+				$module = strtolower($matches[2].$matches[3]);
596 596
 				$xml_info = $oModuleModel->getModuleActionXml($module);
597 597
 
598
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
598
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
599 599
 				{
600 600
 					$forward = new stdClass();
601 601
 					$forward->module = $module;
@@ -616,12 +616,12 @@  discard block
 block discarded – undo
616 616
 				}
617 617
 			}
618 618
 
619
-			if(!$forward)
619
+			if (!$forward)
620 620
 			{
621 621
 				$forward = $oModuleModel->getActionForward($this->act);
622 622
 			}
623 623
 
624
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
624
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
625 625
 			{
626 626
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
627 627
 				$type = $forward->type;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 				$tpl_path = $oModule->getTemplatePath();
630 630
 				$orig_module = $oModule;
631 631
 
632
-				if($forward->meta_noindex === 'true') {
632
+				if ($forward->meta_noindex === 'true') {
633 633
 					Context::addMetaTag('robots', 'noindex');
634 634
 				}
635 635
 
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 
638 638
 				// check CSRF for non-GET actions
639 639
 				$use_check_csrf = isset($xml_info->action->{$this->act}) && $xml_info->action->{$this->act}->check_csrf !== 'false';
640
-				if($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
640
+				if ($use_check_csrf && $_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && !checkCSRF())
641 641
 				{
642 642
 					$this->error = 'msg_invalid_request';
643 643
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -649,11 +649,11 @@  discard block
 block discarded – undo
649 649
 
650 650
 				// SECISSUE also check foward act method
651 651
 				// check REQUEST_METHOD in controller
652
-				if($type == 'controller')
652
+				if ($type == 'controller')
653 653
 				{
654 654
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
655 655
 
656
-					if(!$allowedMethod)
656
+					if (!$allowedMethod)
657 657
 					{
658 658
 						$allowedMethodList[0] = 'POST';
659 659
 					}
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
663 663
 					}
664 664
 
665
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
665
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
666 666
 					{
667 667
 						$this->error = "msg_invalid_request";
668 668
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -673,13 +673,13 @@  discard block
 block discarded – undo
673 673
 					}
674 674
 				}
675 675
 
676
-				if($type == "view" && Mobile::isFromMobilePhone())
676
+				if ($type == "view" && Mobile::isFromMobilePhone())
677 677
 				{
678 678
 					$orig_type = "view";
679 679
 					$type = "mobile";
680 680
 					// create a module instance
681 681
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
682
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
682
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
683 683
 					{
684 684
 						$type = $orig_type;
685 685
 						Mobile::setMobile(FALSE);
@@ -691,25 +691,25 @@  discard block
 block discarded – undo
691 691
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
692 692
 				}
693 693
 
694
-				if(!is_object($oModule))
694
+				if (!is_object($oModule))
695 695
 				{
696 696
 					$this->_setInputErrorToContext();
697 697
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
698 698
 					$oMessageObject->setError(-1);
699 699
 					$oMessageObject->setMessage('msg_module_is_not_exists');
700 700
 					$oMessageObject->dispMessage();
701
-					if($this->httpStatusCode)
701
+					if ($this->httpStatusCode)
702 702
 					{
703 703
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
704 704
 					}
705 705
 					return $oMessageObject;
706 706
 				}
707 707
 
708
-				if($this->module == "admin" && $type == "view")
708
+				if ($this->module == "admin" && $type == "view")
709 709
 				{
710
-					if($logged_info->is_admin == 'Y')
710
+					if ($logged_info->is_admin == 'Y')
711 711
 					{
712
-						if($this->act != 'dispLayoutAdminLayoutModify')
712
+						if ($this->act != 'dispLayoutAdminLayoutModify')
713 713
 						{
714 714
 							$oAdminView = getAdminView('admin');
715 715
 							$oAdminView->makeGnbUrl($forward->module);
@@ -729,10 +729,10 @@  discard block
 block discarded – undo
729 729
 						return $oMessageObject;
730 730
 					}
731 731
 				}
732
-				if($kind == 'admin')
732
+				if ($kind == 'admin')
733 733
 				{
734 734
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
735
-					if(!$grant->manager)
735
+					if (!$grant->manager)
736 736
 					{
737 737
 						$this->_setInputErrorToContext();
738 738
 						$this->error = 'msg_is_not_manager';
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 					}
745 745
 					else
746 746
 					{
747
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
747
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
748 748
 						{
749 749
 							$this->_setInputErrorToContext();
750 750
 							$this->error = 'msg_is_not_administrator';
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 					}
758 758
 				}
759 759
 			}
760
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
760
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
761 761
 			{
762 762
 				$this->act = $xml_info->default_index_act;
763 763
 			}
@@ -771,16 +771,16 @@  discard block
 block discarded – undo
771 771
 		}
772 772
 
773 773
 		// ruleset check...
774
-		if(!empty($ruleset))
774
+		if (!empty($ruleset))
775 775
 		{
776 776
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
777 777
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
778
-			if(!empty($rulesetFile))
778
+			if (!empty($rulesetFile))
779 779
 			{
780
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
780
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
781 781
 				{
782 782
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
783
-					foreach($errorLang as $key => $val)
783
+					foreach ($errorLang as $key => $val)
784 784
 					{
785 785
 						Context::setLang($key, $val);
786 786
 					}
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 
790 790
 				$Validator = new Validator($rulesetFile);
791 791
 				$result = $Validator->validate();
792
-				if(!$result)
792
+				if (!$result)
793 793
 				{
794 794
 					$lastError = $Validator->getLastError();
795 795
 					$returnUrl = Context::get('error_return_url');
@@ -821,26 +821,26 @@  discard block
 block discarded – undo
821 821
 				'dispLayoutPreviewWithModule' => 1
822 822
 		);
823 823
 		$db_use_mobile = Mobile::isMobileEnabled();
824
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
824
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
825 825
 		{
826 826
 			global $lang;
827 827
 			$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>';
828
-			$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>';
828
+			$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>';
829 829
 			Context::addHtmlHeader($header);
830 830
 			Context::addHtmlFooter($footer);
831 831
 		}
832 832
 
833
-		if(($type == 'view' || $type == 'mobile') && $kind != 'admin')
833
+		if (($type == 'view' || $type == 'mobile') && $kind != 'admin')
834 834
 		{
835 835
 			$module_config = $oModuleModel->getModuleConfig('module');
836
-			if($module_config->htmlFooter)
836
+			if ($module_config->htmlFooter)
837 837
 			{
838 838
 				Context::addHtmlFooter($module_config->htmlFooter);
839 839
 			}
840
-			if($module_config->siteTitle)
840
+			if ($module_config->siteTitle)
841 841
 			{
842 842
 				$siteTitle = Context::getBrowserTitle();
843
-				if(!$siteTitle)
843
+				if (!$siteTitle)
844 844
 				{
845 845
 					Context::setBrowserTitle($module_config->siteTitle);
846 846
 				}
@@ -857,18 +857,18 @@  discard block
 block discarded – undo
857 857
 		$procResult = $oModule->proc();
858 858
 
859 859
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
860
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
860
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
861 861
 		{
862 862
 			$error = $oModule->getError();
863 863
 			$message = $oModule->getMessage();
864 864
 			$messageType = $oModule->getMessageType();
865 865
 			$redirectUrl = $oModule->getRedirectUrl();
866
-			if($messageType == 'error') debugPrint($message, 'ERROR');
866
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
867 867
 
868
-			if(!$procResult)
868
+			if (!$procResult)
869 869
 			{
870 870
 				$this->error = $message;
871
-				if(!$redirectUrl && Context::get('error_return_url'))
871
+				if (!$redirectUrl && Context::get('error_return_url'))
872 872
 				{
873 873
 					$redirectUrl = Context::get('error_return_url');
874 874
 				}
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 
882 882
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
883 883
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
884
-			if($message != 'success')
884
+			if ($message != 'success')
885 885
 			{
886 886
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
887 887
 			}
888 888
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
889 889
 
890
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
890
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
891 891
 			{
892 892
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
893 893
 			}
@@ -903,27 +903,27 @@  discard block
 block discarded – undo
903 903
 	 * */
904 904
 	function _setInputErrorToContext()
905 905
 	{
906
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
906
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
907 907
 		{
908 908
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
909 909
 		}
910
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
910
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
911 911
 		{
912 912
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
913 913
 		}
914
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
914
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
915 915
 		{
916 916
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
917 917
 		}
918
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
918
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
919 919
 		{
920 920
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
921 921
 		}
922
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
922
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
923 923
 		{
924 924
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
925 925
 		}
926
-		if(count($_SESSION['INPUT_ERROR']))
926
+		if (count($_SESSION['INPUT_ERROR']))
927 927
 		{
928 928
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
929 929
 		}
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
 	{
954 954
 		$requestVars = Context::getRequestVars();
955 955
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
956
-		foreach($requestVars AS $key => $value)
956
+		foreach ($requestVars AS $key => $value)
957 957
 		{
958 958
 			$_SESSION['INPUT_ERROR'][$key] = $value;
959 959
 		}
@@ -967,41 +967,41 @@  discard block
 block discarded – undo
967 967
 	function displayContent($oModule = NULL)
968 968
 	{
969 969
 		// If the module is not set or not an object, set error
970
-		if(!$oModule || !is_object($oModule))
970
+		if (!$oModule || !is_object($oModule))
971 971
 		{
972 972
 			$this->error = 'msg_module_is_not_exists';
973 973
 			$this->httpStatusCode = '404';
974 974
 		}
975 975
 
976 976
 		// If connection to DB has a problem even though it's not install module, set error
977
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
977
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
978 978
 		{
979 979
 			$this->error = 'msg_dbconnect_failed';
980 980
 		}
981 981
 
982 982
 		// Call trigger after moduleHandler proc
983 983
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
984
-		if(!$output->toBool())
984
+		if (!$output->toBool())
985 985
 		{
986 986
 			$this->error = $output->getMessage();
987 987
 		}
988 988
 
989 989
 		// Use message view object, if HTML call
990 990
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
991
-		if(!isset($methodList[Context::getRequestMethod()]))
991
+		if (!isset($methodList[Context::getRequestMethod()]))
992 992
 		{
993 993
 
994
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
994
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
995 995
 			{
996 996
 				$display_handler = new DisplayHandler();
997 997
 				$display_handler->_debugOutput();
998 998
 
999
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
999
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
1000 1000
 				return;
1001 1001
 			}
1002 1002
 
1003 1003
 			// If error occurred, handle it
1004
-			if($this->error)
1004
+			if ($this->error)
1005 1005
 			{
1006 1006
 				// display content with message module instance
1007 1007
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -1010,14 +1010,14 @@  discard block
 block discarded – undo
1010 1010
 				$oMessageObject->setMessage($this->error);
1011 1011
 				$oMessageObject->dispMessage();
1012 1012
 
1013
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1013
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
1014 1014
 				{
1015 1015
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
1016 1016
 					$oMessageObject->setTemplateFile('http_status_code');
1017 1017
 				}
1018 1018
 
1019 1019
 				// If module was called normally, change the templates of the module into ones of the message view module
1020
-				if($oModule)
1020
+				if ($oModule)
1021 1021
 				{
1022 1022
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
1023 1023
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 			}
1033 1033
 
1034 1034
 			// Check if layout_srl exists for the module
1035
-			if(Mobile::isFromMobilePhone())
1035
+			if (Mobile::isFromMobilePhone())
1036 1036
 			{
1037 1037
 				$layout_srl = $oModule->module_info->mlayout_srl;
1038 1038
 			}
@@ -1042,58 +1042,58 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 
1044 1044
 			// if layout_srl is rollback by module, set default layout
1045
-			if($layout_srl == -1)
1045
+			if ($layout_srl == -1)
1046 1046
 			{
1047 1047
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1048 1048
 				$oLayoutAdminModel = getAdminModel('layout');
1049 1049
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1050 1050
 			}
1051 1051
 
1052
-			if($layout_srl && !$oModule->getLayoutFile())
1052
+			if ($layout_srl && !$oModule->getLayoutFile())
1053 1053
 			{
1054 1054
 
1055 1055
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1056 1056
 				$oLayoutModel = getModel('layout');
1057 1057
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1058
-				if($layout_info)
1058
+				if ($layout_info)
1059 1059
 				{
1060 1060
 
1061 1061
 					// Input extra_vars into $layout_info
1062
-					if($layout_info->extra_var_count)
1062
+					if ($layout_info->extra_var_count)
1063 1063
 					{
1064 1064
 
1065
-						foreach($layout_info->extra_var as $var_id => $val)
1065
+						foreach ($layout_info->extra_var as $var_id => $val)
1066 1066
 						{
1067
-							if($val->type == 'image')
1067
+							if ($val->type == 'image')
1068 1068
 							{
1069
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1069
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1070 1070
 								{
1071
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1071
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1072 1072
 								}
1073 1073
 							}
1074 1074
 							$layout_info->{$var_id} = $val->value;
1075 1075
 						}
1076 1076
 					}
1077 1077
 					// Set menus into context
1078
-					if($layout_info->menu_count)
1078
+					if ($layout_info->menu_count)
1079 1079
 					{
1080
-						foreach($layout_info->menu as $menu_id => $menu)
1080
+						foreach ($layout_info->menu as $menu_id => $menu)
1081 1081
 						{
1082 1082
 							// set default menu set(included home menu)
1083
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1083
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1084 1084
 							{
1085 1085
 								$oMenuAdminController = getAdminController('menu');
1086 1086
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1087 1087
 
1088
-								if(FileHandler::exists($homeMenuCacheFile))
1088
+								if (FileHandler::exists($homeMenuCacheFile))
1089 1089
 								{
1090 1090
 									include($homeMenuCacheFile);
1091 1091
 								}
1092 1092
 
1093
-								if(!$menu->menu_srl)
1093
+								if (!$menu->menu_srl)
1094 1094
 								{
1095
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1096
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1095
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1096
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1097 1097
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1098 1098
 								}
1099 1099
 								else
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 							}
1105 1105
 
1106 1106
 							$php_file = FileHandler::exists($menu->php_file);
1107
-							if($php_file)
1107
+							if ($php_file)
1108 1108
 							{
1109 1109
 								include($php_file);
1110 1110
 							}
@@ -1120,17 +1120,17 @@  discard block
 block discarded – undo
1120 1120
 
1121 1121
 					// If layout was modified, use the modified version
1122 1122
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1123
-					if(file_exists($edited_layout))
1123
+					if (file_exists($edited_layout))
1124 1124
 					{
1125 1125
 						$oModule->setEditedLayoutFile($edited_layout);
1126 1126
 					}
1127 1127
 				}
1128 1128
 			}
1129 1129
 			$isLayoutDrop = Context::get('isLayoutDrop');
1130
-			if($isLayoutDrop)
1130
+			if ($isLayoutDrop)
1131 1131
 			{
1132 1132
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1133
-				if($kind == 'admin')
1133
+				if ($kind == 'admin')
1134 1134
 				{
1135 1135
 					$oModule->setLayoutFile('popup_layout');
1136 1136
 				}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1169 1169
 	{
1170 1170
 
1171
-		if(__DEBUG__ == 3)
1171
+		if (__DEBUG__ == 3)
1172 1172
 		{
1173 1173
 			$start_time = getMicroTime();
1174 1174
 		}
@@ -1178,51 +1178,51 @@  discard block
 block discarded – undo
1178 1178
 		$type = strtolower($type);
1179 1179
 
1180 1180
 		$kinds = array('svc' => 1, 'admin' => 1);
1181
-		if(!isset($kinds[$kind]))
1181
+		if (!isset($kinds[$kind]))
1182 1182
 		{
1183 1183
 			$kind = 'svc';
1184 1184
 		}
1185 1185
 
1186
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1186
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1187 1187
 
1188
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1188
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1189 1189
 		{
1190 1190
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1191 1191
 		}
1192 1192
 
1193 1193
 		// if there is no instance of the module in global variable, create a new one
1194
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1194
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1195 1195
 		{
1196 1196
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1197 1197
 
1198
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1198
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1199 1199
 			{
1200 1200
 				$module = $parent_module;
1201 1201
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1202 1202
 			}
1203 1203
 
1204 1204
 			// Check if the base class and instance class exist
1205
-			if(!class_exists($module, true))
1205
+			if (!class_exists($module, true))
1206 1206
 			{
1207 1207
 				return NULL;
1208 1208
 			}
1209
-			if(!class_exists($instance_name, true))
1209
+			if (!class_exists($instance_name, true))
1210 1210
 			{
1211 1211
 				return NULL;
1212 1212
 			}
1213 1213
 
1214 1214
 			// Create an instance
1215 1215
 			$oModule = new $instance_name();
1216
-			if(!is_object($oModule))
1216
+			if (!is_object($oModule))
1217 1217
 			{
1218 1218
 				return NULL;
1219 1219
 			}
1220 1220
 
1221 1221
 			// Load language files for the class
1222
-			Context::loadLang($class_path . 'lang');
1223
-			if($extend_module)
1222
+			Context::loadLang($class_path.'lang');
1223
+			if ($extend_module)
1224 1224
 			{
1225
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1225
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1226 1226
 			}
1227 1227
 
1228 1228
 			// Set variables to the instance
@@ -1230,10 +1230,10 @@  discard block
 block discarded – undo
1230 1230
 			$oModule->setModulePath($class_path);
1231 1231
 
1232 1232
 			// If the module has a constructor, run it.
1233
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1233
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1234 1234
 			{
1235 1235
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1236
-				if(@method_exists($oModule, $instance_name))
1236
+				if (@method_exists($oModule, $instance_name))
1237 1237
 				{
1238 1238
 					$oModule->{$instance_name}();
1239 1239
 				}
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1244 1244
 		}
1245 1245
 
1246
-		if(__DEBUG__ == 3)
1246
+		if (__DEBUG__ == 3)
1247 1247
 		{
1248 1248
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1249 1249
 		}
@@ -1259,17 +1259,17 @@  discard block
 block discarded – undo
1259 1259
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1260 1260
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1261 1261
 
1262
-		$types = array('view','controller','model','api','wap','mobile','class');
1263
-		if(!in_array($type, $types))
1262
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1263
+		if (!in_array($type, $types))
1264 1264
 		{
1265 1265
 			$type = $types[0];
1266 1266
 		}
1267
-		if($type == 'class')
1267
+		if ($type == 'class')
1268 1268
 		{
1269 1269
 			$instanceName = '%s';
1270 1270
 			$classFile = '%s%s.%s.php';
1271 1271
 		}
1272
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1272
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1273 1273
 		{
1274 1274
 			$instanceName = '%sAdmin%s';
1275 1275
 			$classFile = '%s%s.admin.%s.php';
@@ -1294,26 +1294,26 @@  discard block
 block discarded – undo
1294 1294
 	function triggerCall($trigger_name, $called_position, &$obj)
1295 1295
 	{
1296 1296
 		// skip if not installed
1297
-		if(!Context::isInstalled())
1297
+		if (!Context::isInstalled())
1298 1298
 		{
1299 1299
 			return new BaseObject();
1300 1300
 		}
1301 1301
 
1302 1302
 		$oModuleModel = getModel('module');
1303 1303
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1304
-		if(!$triggers || count($triggers) < 1)
1304
+		if (!$triggers || count($triggers) < 1)
1305 1305
 		{
1306 1306
 			return new BaseObject();
1307 1307
 		}
1308 1308
 
1309 1309
 		//store before trigger call time
1310 1310
 		$before_trigger_time = NULL;
1311
-		if(__LOG_SLOW_TRIGGER__> 0)
1311
+		if (__LOG_SLOW_TRIGGER__ > 0)
1312 1312
 		{
1313 1313
 			$before_trigger_time = microtime(true);
1314 1314
 		}
1315 1315
 
1316
-		foreach($triggers as $item)
1316
+		foreach ($triggers as $item)
1317 1317
 		{
1318 1318
 			$module = $item->module;
1319 1319
 			$type = $item->type;
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 
1322 1322
 			// todo why don't we call a normal class object ?
1323 1323
 			$oModule = getModule($module, $type);
1324
-			if(!$oModule || !method_exists($oModule, $called_method))
1324
+			if (!$oModule || !method_exists($oModule, $called_method))
1325 1325
 			{
1326 1326
 				continue;
1327 1327
 			}
@@ -1334,12 +1334,12 @@  discard block
 block discarded – undo
1334 1334
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1335 1335
 
1336 1336
 			$slowlog = new stdClass;
1337
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1338
-			$slowlog->called = $module . '.' . $called_method;
1337
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1338
+			$slowlog->called = $module.'.'.$called_method;
1339 1339
 			$slowlog->called_extension = $module;
1340
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1340
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1341 1341
 
1342
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1342
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1343 1343
 			{
1344 1344
 				return $output;
1345 1345
 			}
@@ -1424,9 +1424,9 @@  discard block
 block discarded – undo
1424 1424
 			'511' => 'Network Authentication Required',
1425 1425
 		);
1426 1426
 		$statusMessage = $statusMessageList[$code];
1427
-		if(!$statusMessage)
1427
+		if (!$statusMessage)
1428 1428
 		{
1429
-			$statusMessage = 'HTTP ' . $code;
1429
+			$statusMessage = 'HTTP '.$code;
1430 1430
 		}
1431 1431
 
1432 1432
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.
modules/seo/seo.controller.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		if (Context::getResponseMethod() != 'HTML') return;
45 45
 		if (Context::get('module') == 'admin') return;
46 46
 
47
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
47
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
48 48
 
49 49
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
50 50
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 		$piece->image = array();
89 89
 		$piece->author = null;
90 90
 
91
-		if(stristr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') != FALSE) {
91
+		if (stristr($_SERVER['HTTP_USER_AGENT'], 'facebookexternalhit') != FALSE) {
92 92
 			$single_image = true;
93 93
 		}
94 94
 
95 95
 
96
-		if($current_module_info->module_srl !== $site_module_info->module_srl) {
96
+		if ($current_module_info->module_srl !== $site_module_info->module_srl) {
97 97
 			$mdoulePartConfig = $oModuleModel->getModulePartConfig('seo', $current_module_info->module_srl);
98
-			if($mdoulePartConfig && isset($mdoulePartConfig->meta_description) && trim($mdoulePartConfig->meta_description)) {
98
+			if ($mdoulePartConfig && isset($mdoulePartConfig->meta_description) && trim($mdoulePartConfig->meta_description)) {
99 99
 				$piece->description = trim($mdoulePartConfig->meta_description);
100 100
 			}
101 101
 		}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		if ($is_article) {
117 117
 			if (!$oDocument->isSecret()) {
118 118
 				$piece->document_title = $oDocument->getTitleText();
119
-				$piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl',$document_srl);
119
+				$piece->url = getFullUrl('', 'mid', $current_module_info->mid, 'document_srl', $document_srl);
120 120
 				$piece->type = 'article';
121 121
 				$piece->description = trim(str_replace('&nbsp;', ' ', $oDocument->getContentText(400)));
122 122
 				$piece->author = $oDocument->getNickName();
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 				if (count($tags)) $piece->tags = $tags;
125 125
 
126 126
 				$document_images = false;
127
-				if($oCacheHandler->isSupport()) {
128
-					$cache_key_document_images = 'seo:document_images:' . $document_srl;
127
+				if ($oCacheHandler->isSupport()) {
128
+					$cache_key_document_images = 'seo:document_images:'.$document_srl;
129 129
 					$document_images = $oCacheHandler->get($cache_key_document_images);
130 130
 				}
131 131
 
132
-				if($document_images === false && $oDocument->hasUploadedFiles()) {
132
+				if ($document_images === false && $oDocument->hasUploadedFiles()) {
133 133
 					$image_ext = array('bmp', 'gif', 'jpg', 'jpeg', 'png');
134 134
 					$document_images = array();
135 135
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 						if (!in_array(strtolower($ext), $image_ext)) continue;
142 142
 						list($width, $height) = @getimagesize($file->uploaded_filename);
143
-						if($width < 100 && $height < 100) continue;
143
+						if ($width < 100 && $height < 100) continue;
144 144
 
145 145
 						$image = array(
146 146
 							'filepath' => $file->uploaded_filename,
@@ -148,35 +148,35 @@  discard block
 block discarded – undo
148 148
 							'height' => $height
149 149
 						);
150 150
 
151
-						if($file->cover_image === 'Y') {
151
+						if ($file->cover_image === 'Y') {
152 152
 							array_unshift($document_images, $image);
153 153
 						} else {
154 154
 							$document_images[] = $image;
155 155
 						}
156 156
 					}
157 157
 
158
-					if($oCacheHandler->isSupport()) {
158
+					if ($oCacheHandler->isSupport()) {
159 159
 						$oCacheHandler->put($cache_key_document_images, $document_images);
160 160
 					}
161 161
 				}
162 162
 
163
-				if($document_images) $piece->image = $document_images;
163
+				if ($document_images) $piece->image = $document_images;
164 164
 			} else {
165 165
 				$piece->url = getFullUrl('', 'mid', $current_module_info->mid);
166 166
 			}
167 167
 		} else {
168 168
 			if (!$is_index) {
169 169
 				$page = (Context::get('page') > 1) ? Context::get('page') : null;
170
-				$piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page',$page);
170
+				$piece->url = getNotEncodedFullUrl('mid', $current_module_info->mid, 'page', $page);
171 171
 			}
172 172
 		}
173 173
 
174 174
 		$piece->title = $this->getBrowserTitle($piece->document_title);
175 175
 
176
-		if($oCacheHandler->isSupport()) {
176
+		if ($oCacheHandler->isSupport()) {
177 177
 			$cache_key = 'seo:site_image';
178 178
 			$site_image = $oCacheHandler->get($cache_key);
179
-			if($site_image) {
179
+			if ($site_image) {
180 180
 				$site_image['url'] = $config->site_image_url;
181 181
 			}
182 182
 			$piece->image[] = $site_image;
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 		$this->addMeta('og:site_name', $config->site_name);
194 194
 		$this->addMeta('og:title', $piece->title);
195 195
 		$this->addMeta('og:description', $piece->description);
196
-		if($is_article) {
197
-			if(Context::getLangType() !== $oDocument->getLangCode()) {
196
+		if ($is_article) {
197
+			if (Context::getLangType() !== $oDocument->getLangCode()) {
198 198
 				$this->addMeta('og:locale:alternate', $locales[$oDocument->getLangCode()]);
199 199
 			}
200 200
 			$this->addMeta('article:published_time', $oDocument->getRegdate('c'));
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 		}
206 206
 
207 207
 		foreach ($piece->image as $img) {
208
-			if(!$img['url']) {
209
-				if(!$img['filepath']) continue;
210
-				$img['url'] = $request_uri . $img['filepath'];
208
+			if (!$img['url']) {
209
+				if (!$img['filepath']) continue;
210
+				$img['url'] = $request_uri.$img['filepath'];
211 211
 			}
212 212
 
213 213
 			$this->addMeta('og:image', $img['url']);
214 214
 			$this->addMeta('og:image:width', $img['width']);
215 215
 			$this->addMeta('og:image:height', $img['height']);
216
-			if($single_image) break;
216
+			if ($single_image) break;
217 217
 		}
218 218
 
219 219
 		$this->canonical_url = $piece->url;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	function triggerAfterFileDeleteFile($data)
227 227
 	{
228 228
 		$document_srl = $data->upload_target_srl;
229
-		if(!$document_srl) return $this->makeObject();
229
+		if (!$document_srl) return $this->makeObject();
230 230
 
231 231
 		$this->deleteCacheDocumentImages($document_srl);
232 232
 	}
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 	private function deleteCacheDocumentImages($document_srl)
247 247
 	{
248 248
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
249
-		if($oCacheHandler->isSupport()) {
250
-			$cache_key_document_images = 'seo:document_images:' . $document_srl;
249
+		if ($oCacheHandler->isSupport()) {
250
+			$cache_key_document_images = 'seo:document_images:'.$document_srl;
251 251
 			$oCacheHandler->delete($cache_key_document_images);
252 252
 		}
253 253
 	}
Please login to merge, or discard this patch.
modules/module/module.model.php 1 patch
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374
-			$object_key = 'mid_info:' . $module_srl;
374
+			$object_key = 'mid_info:'.$module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507
-				$object_key = 'module:mid_list_' . $args->site_srl;
507
+				$object_key = 'module:mid_list_'.$args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
509 509
 				$list = $oCacheHandler->get($cache_key);
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685 685
 		$key = $parent_module.'.'.$kind.'.'.$type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,23 +918,23 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// actions
921
-			if($actions)
921
+			if ($actions)
922 922
 			{
923
-				if(is_array($actions)) $action_list = $actions;
923
+				if (is_array($actions)) $action_list = $actions;
924 924
 				else $action_list[] = $actions;
925 925
 
926 926
 				$buff[] = '$info->action = new stdClass;';
927 927
 				$info->action = new stdClass();
928
-				foreach($action_list as $action)
928
+				foreach ($action_list as $action)
929 929
 				{
930 930
 					$name = $action->attrs->name;
931 931
 
932 932
 					$type = $action->attrs->type;
933
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
934
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
935
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
936
-					$method = $action->attrs->method?$action->attrs->method:'';
937
-					$check_csrf = $action->attrs->check_csrf=='false'?'false':'true';
933
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
934
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
935
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
936
+					$method = $action->attrs->method ? $action->attrs->method : '';
937
+					$check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true';
938 938
 					$meta_noindex = $action->attrs->{'meta-noindex'} === 'true' ? 'true' : 'false';
939 939
 
940 940
 					$index = $action->attrs->index;
@@ -951,14 +951,14 @@  discard block
 block discarded – undo
951 951
 					$info->action->{$name}->method = $method;
952 952
 					$info->action->{$name}->check_csrf = $check_csrf;
953 953
 					$info->action->{$name}->meta_noindex = $meta_noindex;
954
-					if($action->attrs->menu_name)
954
+					if ($action->attrs->menu_name)
955 955
 					{
956
-						if($menu_index == 'true')
956
+						if ($menu_index == 'true')
957 957
 						{
958 958
 							$info->menu->{$action->attrs->menu_name}->index = $name;
959 959
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
960 960
 						}
961
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
961
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
962 962
 						{
963 963
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
964 964
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -977,22 +977,22 @@  discard block
 block discarded – undo
977 977
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
978 978
 					$buff[] = sprintf('$info->action->%s->meta_noindex=\'%s\';', $name, $meta_noindex);
979 979
 
980
-					if($index=='true')
980
+					if ($index == 'true')
981 981
 					{
982 982
 						$default_index_act = $name;
983 983
 						$info->default_index_act = $name;
984 984
 					}
985
-					if($admin_index=='true')
985
+					if ($admin_index == 'true')
986 986
 					{
987 987
 						$admin_index_act = $name;
988 988
 						$info->admin_index_act = $name;
989 989
 					}
990
-					if($setup_index=='true')
990
+					if ($setup_index == 'true')
991 991
 					{
992 992
 						$setup_index_act = $name;
993 993
 						$info->setup_index_act = $name;
994 994
 					}
995
-					if($simple_setup_index=='true')
995
+					if ($simple_setup_index == 'true')
996 996
 					{
997 997
 						$simple_setup_index_act = $name;
998 998
 						$info->simple_setup_index_act = $name;
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 			return $info;
1014 1014
 		}
1015 1015
 
1016
-		if(file_exists($cache_file)) return include($cache_file);
1016
+		if (file_exists($cache_file)) return include($cache_file);
1017 1017
 	}
1018 1018
 
1019 1019
 	/**
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	{
1025 1025
 		$module = Context::get('module_type');
1026 1026
 
1027
-		if($module == 'ARTICLE')
1027
+		if ($module == 'ARTICLE')
1028 1028
 		{
1029 1029
 			$module = 'page';
1030 1030
 		}
@@ -1044,26 +1044,26 @@  discard block
 block discarded – undo
1044 1044
 	 */
1045 1045
 	function getSkins($path, $dir = 'skins')
1046 1046
 	{
1047
-		if(substr($path, -1) == '/')
1047
+		if (substr($path, -1) == '/')
1048 1048
 		{
1049 1049
 			$path = substr($path, 0, -1);
1050 1050
 		}
1051 1051
 
1052 1052
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1053 1053
 		$list = FileHandler::readDir($skin_path);
1054
-		if(!count($list)) return;
1054
+		if (!count($list)) return;
1055 1055
 
1056 1056
 		natcasesort($list);
1057 1057
 
1058
-		foreach($list as $skin_name)
1058
+		foreach ($list as $skin_name)
1059 1059
 		{
1060
-			if(!is_dir($skin_path . $skin_name))
1060
+			if (!is_dir($skin_path.$skin_name))
1061 1061
 			{
1062 1062
 				continue;
1063 1063
 			}
1064 1064
 			unset($skin_info);
1065 1065
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1066
-			if(!$skin_info)
1066
+			if (!$skin_info)
1067 1067
 			{
1068 1068
 				$skin_info = new stdClass();
1069 1069
 				$skin_info->title = $skin_name;
@@ -1076,15 +1076,15 @@  discard block
 block discarded – undo
1076 1076
 		$tmpPath = trim($tmpPath);
1077 1077
 		$module = array_pop(explode(' ', $tmpPath));
1078 1078
 
1079
-		if($dir == 'skins')
1079
+		if ($dir == 'skins')
1080 1080
 		{
1081 1081
 			$oAdminModel = getAdminModel('admin');
1082 1082
 			$themesInfo = $oAdminModel->getThemeList();
1083 1083
 
1084
-			foreach($themesInfo as $themeName => $info)
1084
+			foreach ($themesInfo as $themeName => $info)
1085 1085
 			{
1086 1086
 				$skinInfos = $info->skin_infos;
1087
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1087
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1088 1088
 				{
1089 1089
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1090 1090
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1096,13 +1096,13 @@  discard block
 block discarded – undo
1096 1096
 		$oMenuAdminModel = getAdminModel('menu');
1097 1097
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1098 1098
 		$moduleName = $module;
1099
-		if($moduleName === 'page')
1099
+		if ($moduleName === 'page')
1100 1100
 		{
1101 1101
 			$moduleName = 'ARTICLE';
1102 1102
 		}
1103
-		if(array_key_exists($moduleName, $installedMenuTypes))
1103
+		if (array_key_exists($moduleName, $installedMenuTypes))
1104 1104
 		{
1105
-			if($dir == 'skins')
1105
+			if ($dir == 'skins')
1106 1106
 			{
1107 1107
 				$type = 'P';
1108 1108
 			}
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
 			}
1113 1113
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1114 1114
 
1115
-			if(isset($defaultSkinName))
1115
+			if (isset($defaultSkinName))
1116 1116
 			{
1117 1117
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1118 1118
 
1119 1119
 				$useDefault = new stdClass();
1120
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1120
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1121 1121
 
1122 1122
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1123 1123
 
@@ -1134,20 +1134,20 @@  discard block
 block discarded – undo
1134 1134
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1135 1135
 	{
1136 1136
 		// Read xml file having skin information
1137
-		if(substr($path,-1)!='/') $path .= '/';
1137
+		if (substr($path, -1) != '/') $path .= '/';
1138 1138
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1139
-		if(!file_exists($skin_xml_file)) return;
1139
+		if (!file_exists($skin_xml_file)) return;
1140 1140
 		// Create XmlParser object
1141 1141
 		$oXmlParser = new XmlParser();
1142 1142
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1143 1143
 		// Return if no skin information is
1144
-		if(!$_xml_obj->skin) return;
1144
+		if (!$_xml_obj->skin) return;
1145 1145
 		$xml_obj = $_xml_obj->skin;
1146 1146
 		// Skin Name
1147 1147
 		$skin_info = new stdClass();
1148 1148
 		$skin_info->title = $xml_obj->title->body;
1149 1149
 		// Author information
1150
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1150
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1151 1151
 		{
1152 1152
 			// skin format v0.2
1153 1153
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1158,10 +1158,10 @@  discard block
 block discarded – undo
1158 1158
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1159 1159
 			$skin_info->description = $xml_obj->description->body;
1160 1160
 
1161
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1161
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1162 1162
 			else $author_list = $xml_obj->author;
1163 1163
 
1164
-			foreach($author_list as $author)
1164
+			foreach ($author_list as $author)
1165 1165
 			{
1166 1166
 				$author_obj = new stdClass();
1167 1167
 				$author_obj->name = $author->name->body;
@@ -1170,25 +1170,25 @@  discard block
 block discarded – undo
1170 1170
 				$skin_info->author[] = $author_obj;
1171 1171
 			}
1172 1172
 			// List extra vars
1173
-			if($xml_obj->extra_vars)
1173
+			if ($xml_obj->extra_vars)
1174 1174
 			{
1175 1175
 				$extra_var_groups = $xml_obj->extra_vars->group;
1176
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1177
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1176
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1177
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1178 1178
 
1179
-				foreach($extra_var_groups as $group)
1179
+				foreach ($extra_var_groups as $group)
1180 1180
 				{
1181 1181
 					$extra_vars = $group->var;
1182
-					if(!$extra_vars)
1182
+					if (!$extra_vars)
1183 1183
 					{
1184 1184
 						continue;
1185 1185
 					}
1186
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1186
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1187 1187
 
1188
-					foreach($extra_vars as $key => $val)
1188
+					foreach ($extra_vars as $key => $val)
1189 1189
 					{
1190 1190
 						$obj = new stdClass();
1191
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1191
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1192 1192
 
1193 1193
 						$obj->group = $group->title->body;
1194 1194
 						$obj->name = $val->attrs->name;
@@ -1197,14 +1197,14 @@  discard block
 block discarded – undo
1197 1197
 						$obj->description = $val->description->body;
1198 1198
 						$obj->value = $extra_vals->{$obj->name};
1199 1199
 						$obj->default = $val->attrs->default;
1200
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1201
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1200
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1201
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1202 1202
 						// Get an option list from 'select'type
1203
-						if(is_array($val->options))
1203
+						if (is_array($val->options))
1204 1204
 						{
1205 1205
 							$option_count = count($val->options);
1206 1206
 
1207
-							for($i = 0; $i < $option_count; $i++)
1207
+							for ($i = 0; $i < $option_count; $i++)
1208 1208
 							{
1209 1209
 								$obj->options[$i] = new stdClass();
1210 1210
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1241,18 +1241,18 @@  discard block
 block discarded – undo
1241 1241
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1242 1242
 			// Variables used in the skin
1243 1243
 			$extra_var_groups = $xml_obj->extra_vars->group;
1244
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1245
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1244
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1245
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1246 1246
 
1247
-			foreach($extra_var_groups as $group)
1247
+			foreach ($extra_var_groups as $group)
1248 1248
 			{
1249 1249
 				$extra_vars = $group->var;
1250 1250
 
1251
-				if($extra_vars)
1251
+				if ($extra_vars)
1252 1252
 				{
1253
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1253
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1254 1254
 
1255
-					foreach($extra_vars as $var)
1255
+					foreach ($extra_vars as $var)
1256 1256
 					{
1257 1257
 						unset($obj);
1258 1258
 						unset($options);
@@ -1263,11 +1263,11 @@  discard block
 block discarded – undo
1263 1263
 						$title = $var->title->body;
1264 1264
 						$description = $var->description->body;
1265 1265
 						// Get an option list from 'select'type.
1266
-						if(is_array($var->default))
1266
+						if (is_array($var->default))
1267 1267
 						{
1268 1268
 							$option_count = count($var->default);
1269 1269
 
1270
-							for($i = 0; $i < $option_count; $i++)
1270
+							for ($i = 0; $i < $option_count; $i++)
1271 1271
 							{
1272 1272
 								$options[$i]->title = $var->default[$i]->body;
1273 1273
 								$options[$i]->value = $var->default[$i]->body;
@@ -1301,19 +1301,19 @@  discard block
 block discarded – undo
1301 1301
 
1302 1302
 		// colorset
1303 1303
 		$colorset = $xml_obj->colorset->color;
1304
-		if($colorset)
1304
+		if ($colorset)
1305 1305
 		{
1306
-			if(!is_array($colorset)) $colorset = array($colorset);
1306
+			if (!is_array($colorset)) $colorset = array($colorset);
1307 1307
 
1308
-			foreach($colorset as $color)
1308
+			foreach ($colorset as $color)
1309 1309
 			{
1310 1310
 				$name = $color->attrs->name;
1311 1311
 				$title = $color->title->body;
1312 1312
 				$screenshot = $color->attrs->src;
1313
-				if($screenshot)
1313
+				if ($screenshot)
1314 1314
 				{
1315 1315
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1316
-					if(!file_exists($screenshot)) $screenshot = "";
1316
+					if (!file_exists($screenshot)) $screenshot = "";
1317 1317
 				}
1318 1318
 				else $screenshot = "";
1319 1319
 
@@ -1325,19 +1325,19 @@  discard block
 block discarded – undo
1325 1325
 			}
1326 1326
 		}
1327 1327
 		// Menu type (settings for layout)
1328
-		if($xml_obj->menus->menu)
1328
+		if ($xml_obj->menus->menu)
1329 1329
 		{
1330 1330
 			$menus = $xml_obj->menus->menu;
1331
-			if(!is_array($menus)) $menus = array($menus);
1331
+			if (!is_array($menus)) $menus = array($menus);
1332 1332
 
1333 1333
 			$menu_count = count($menus);
1334 1334
 			$skin_info->menu_count = $menu_count;
1335
-			for($i=0;$i<$menu_count;$i++)
1335
+			for ($i = 0; $i < $menu_count; $i++)
1336 1336
 			{
1337 1337
 				unset($obj);
1338 1338
 
1339 1339
 				$obj->name = $menus[$i]->attrs->name;
1340
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1340
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1341 1341
 				$obj->title = $menus[$i]->title->body;
1342 1342
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1343 1343
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 		}
1347 1347
 
1348 1348
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1349
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1349
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1350 1350
 		return $skin_info;
1351 1351
 	}
1352 1352
 
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 	{
1358 1358
 		$args = new stdClass;
1359 1359
 		$args->site_srl = $site_srl;
1360
-		if(!is_null($module)) $args->module = $module;
1360
+		if (!is_null($module)) $args->module = $module;
1361 1361
 		$output = executeQuery('module.getModuleCount', $args);
1362 1362
 		return $output->data->count;
1363 1363
 	}
@@ -1371,26 +1371,26 @@  discard block
 block discarded – undo
1371 1371
 		$config = false;
1372 1372
 		// cache controll
1373 1373
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1374
-		if($oCacheHandler->isSupport())
1374
+		if ($oCacheHandler->isSupport())
1375 1375
 		{
1376
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1376
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1377 1377
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1378 1378
 			$config = $oCacheHandler->get($cache_key);
1379 1379
 		}
1380 1380
 
1381
-		if($config === false)
1381
+		if ($config === false)
1382 1382
 		{
1383
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1383
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1384 1384
 			{
1385 1385
 				$args = new stdClass();
1386 1386
 				$args->module = $module;
1387 1387
 				$args->site_srl = $site_srl;
1388 1388
 				$output = executeQuery('module.getModuleConfig', $args);
1389
-				if($output->data->config) $config = unserialize($output->data->config);
1389
+				if ($output->data->config) $config = unserialize($output->data->config);
1390 1390
 				else $config = null;
1391 1391
 
1392 1392
 				//insert in cache
1393
-				if($oCacheHandler->isSupport())
1393
+				if ($oCacheHandler->isSupport())
1394 1394
 				{
1395 1395
 					$oCacheHandler->put($cache_key, $config);
1396 1396
 				}
@@ -1411,26 +1411,26 @@  discard block
 block discarded – undo
1411 1411
 		$config = false;
1412 1412
 		// cache controll
1413 1413
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1414
-		if($oCacheHandler->isSupport())
1414
+		if ($oCacheHandler->isSupport())
1415 1415
 		{
1416 1416
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1417 1417
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1418 1418
 			$config = $oCacheHandler->get($cache_key);
1419 1419
 		}
1420 1420
 
1421
-		if($config === false)
1421
+		if ($config === false)
1422 1422
 		{
1423
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1423
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1424 1424
 			{
1425 1425
 				$args = new stdClass();
1426 1426
 				$args->module = $module;
1427 1427
 				$args->module_srl = $module_srl;
1428 1428
 				$output = executeQuery('module.getModulePartConfig', $args);
1429
-				if($output->data->config) $config = unserialize($output->data->config);
1429
+				if ($output->data->config) $config = unserialize($output->data->config);
1430 1430
 				else $config = null;
1431 1431
 
1432 1432
 				//insert in cache
1433
-				if($oCacheHandler->isSupport())
1433
+				if ($oCacheHandler->isSupport())
1434 1434
 				{
1435 1435
 					$oCacheHandler->put($cache_key, $config);
1436 1436
 				}
@@ -1449,11 +1449,11 @@  discard block
 block discarded – undo
1449 1449
 	{
1450 1450
 		$args = new stdClass();
1451 1451
 		$args->module = $module;
1452
-		if($site_srl) $args->site_srl = $site_srl;
1452
+		if ($site_srl) $args->site_srl = $site_srl;
1453 1453
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1454
-		if(!$output->toBool() || !$output->data) return array();
1454
+		if (!$output->toBool() || !$output->data) return array();
1455 1455
 
1456
-		foreach($output->data as $key => $val)
1456
+		foreach ($output->data as $key => $val)
1457 1457
 		{
1458 1458
 			$result[$val->module_srl] = unserialize($val->config);
1459 1459
 		}
@@ -1469,12 +1469,12 @@  discard block
 block discarded – undo
1469 1469
 		$args->moduleCategorySrl = $moduleCategorySrl;
1470 1470
 		// Get data from the DB
1471 1471
 		$output = executeQuery('module.getModuleCategories', $args);
1472
-		if(!$output->toBool()) return $output;
1472
+		if (!$output->toBool()) return $output;
1473 1473
 		$list = $output->data;
1474
-		if(!$list) return;
1475
-		if(!is_array($list)) $list = array($list);
1474
+		if (!$list) return;
1475
+		if (!is_array($list)) $list = array($list);
1476 1476
 
1477
-		foreach($list as $val)
1477
+		foreach ($list as $val)
1478 1478
 		{
1479 1479
 			$category_list[$val->module_category_srl] = $val;
1480 1480
 		}
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
 		$args = new stdClass;
1491 1491
 		$args->module_category_srl = $module_category_srl;
1492 1492
 		$output = executeQuery('module.getModuleCategory', $args);
1493
-		if(!$output->toBool()) return $output;
1493
+		if (!$output->toBool()) return $output;
1494 1494
 		return $output->data;
1495 1495
 	}
1496 1496
 
@@ -1502,10 +1502,10 @@  discard block
 block discarded – undo
1502 1502
 		// Get a list of downloaded and installed modules
1503 1503
 		$searched_list = FileHandler::readDir('./modules');
1504 1504
 		$searched_count = count($searched_list);
1505
-		if(!$searched_count) return;
1505
+		if (!$searched_count) return;
1506 1506
 		sort($searched_list);
1507 1507
 
1508
-		for($i=0;$i<$searched_count;$i++)
1508
+		for ($i = 0; $i < $searched_count; $i++)
1509 1509
 		{
1510 1510
 			// Module name
1511 1511
 			$module_name = $searched_list[$i];
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 			$info = $this->getModuleInfoXml($module_name);
1516 1516
 			unset($obj);
1517 1517
 
1518
-			if(!isset($info)) continue;
1518
+			if (!isset($info)) continue;
1519 1519
 			$info->module = $module_name;
1520 1520
 			$info->created_table_count = $created_table_count;
1521 1521
 			$info->table_count = $table_count;
@@ -1532,19 +1532,19 @@  discard block
 block discarded – undo
1532 1532
 		$info = null;
1533 1533
 
1534 1534
 		$moduledir = ModuleHandler::getModulePath($module_name);
1535
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1535
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1536 1536
 		{
1537 1537
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1538 1538
 			$table_count = count($tmp_files);
1539 1539
 			// Check if the table is created
1540 1540
 			$created_table_count = 0;
1541
-			for($j=0;$j<count($tmp_files);$j++)
1541
+			for ($j = 0; $j < count($tmp_files); $j++)
1542 1542
 			{
1543
-				list($table_name) = explode(".",$tmp_files[$j]);
1544
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1543
+				list($table_name) = explode(".", $tmp_files[$j]);
1544
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1545 1545
 			}
1546 1546
 			// Check if DB is installed
1547
-			if($table_count > $created_table_count) return true;
1547
+			if ($table_count > $created_table_count) return true;
1548 1548
 			else return false;
1549 1549
 		}
1550 1550
 		return false;
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 	{
1555 1555
 		// Check if it is upgraded to module.class.php on each module
1556 1556
 		$oDummy = getModule($module_name, 'class');
1557
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1557
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1558 1558
 		{
1559 1559
 			return $oDummy->checkUpdate();
1560 1560
 		}
@@ -1568,15 +1568,15 @@  discard block
 block discarded – undo
1568 1568
 	 */
1569 1569
 	public function needUpdate($update_id)
1570 1570
 	{
1571
-		if(!is_array($update_id)) $update_id = array($update_id);
1571
+		if (!is_array($update_id)) $update_id = array($update_id);
1572 1572
 
1573 1573
 		$args = new stdClass();
1574 1574
 		$args->update_id = implode(',', $update_id);
1575 1575
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1576 1576
 
1577
-		if(!!$output->error) return false;
1578
-		if(!$output->data) $output->data = array();
1579
-		if(count($update_id) === count($output->data)) return false;
1577
+		if (!!$output->error) return false;
1578
+		if (!$output->data) $output->data = array();
1579
+		if (count($update_id) === count($output->data)) return false;
1580 1580
 
1581 1581
 		return true;
1582 1582
 	}
@@ -1593,31 +1593,31 @@  discard block
 block discarded – undo
1593 1593
 		sort($searched_list);
1594 1594
 
1595 1595
 		$searched_count = count($searched_list);
1596
-		if(!$searched_count) return;
1596
+		if (!$searched_count) return;
1597 1597
 
1598
-		for($i=0;$i<$searched_count;$i++)
1598
+		for ($i = 0; $i < $searched_count; $i++)
1599 1599
 		{
1600 1600
 			// module name
1601 1601
 			$module_name = $searched_list[$i];
1602 1602
 
1603 1603
 			$path = ModuleHandler::getModulePath($module_name);
1604
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1604
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1605 1605
 
1606 1606
 			// Get the number of xml files to create a table in schemas
1607 1607
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1608 1608
 			$table_count = count($tmp_files);
1609 1609
 			// Check if the table is created
1610 1610
 			$created_table_count = 0;
1611
-			for($j=0;$j<$table_count;$j++)
1611
+			for ($j = 0; $j < $table_count; $j++)
1612 1612
 			{
1613
-				list($table_name) = explode('.',$tmp_files[$j]);
1614
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1613
+				list($table_name) = explode('.', $tmp_files[$j]);
1614
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1615 1615
 			}
1616 1616
 			// Get information of the module
1617 1617
 			$info = NULL;
1618 1618
 			$info = $this->getModuleInfoXml($module_name);
1619 1619
 
1620
-			if(!$info) continue;
1620
+			if (!$info) continue;
1621 1621
 
1622 1622
 			$info->module = $module_name;
1623 1623
 			$info->category = $info->category;
@@ -1626,12 +1626,12 @@  discard block
 block discarded – undo
1626 1626
 			$info->path = $path;
1627 1627
 			$info->admin_index_act = $info->admin_index_act;
1628 1628
 			// Check if DB is installed
1629
-			if($table_count > $created_table_count) $info->need_install = true;
1629
+			if ($table_count > $created_table_count) $info->need_install = true;
1630 1630
 			else $info->need_install = false;
1631 1631
 			// Check if it is upgraded to module.class.php on each module
1632 1632
 			$oDummy = null;
1633 1633
 			$oDummy = getModule($module_name, 'class');
1634
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1634
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1635 1635
 			{
1636 1636
 				$info->need_update = $oDummy->checkUpdate();
1637 1637
 			}
@@ -1652,15 +1652,15 @@  discard block
 block discarded – undo
1652 1652
 	 */
1653 1653
 	function syncModuleToSite(&$data)
1654 1654
 	{
1655
-		if(!$data) return;
1655
+		if (!$data) return;
1656 1656
 
1657
-		if(is_array($data))
1657
+		if (is_array($data))
1658 1658
 		{
1659
-			foreach($data as $key => $val)
1659
+			foreach ($data as $key => $val)
1660 1660
 			{
1661 1661
 				$module_srls[] = $val->module_srl;
1662 1662
 			}
1663
-			if(!count($module_srls)) return;
1663
+			if (!count($module_srls)) return;
1664 1664
 		}
1665 1665
 		else
1666 1666
 		{
@@ -1668,17 +1668,17 @@  discard block
 block discarded – undo
1668 1668
 		}
1669 1669
 
1670 1670
 		$args = new stdClass();
1671
-		$args->module_srls = implode(',',$module_srls);
1671
+		$args->module_srls = implode(',', $module_srls);
1672 1672
 		$output = executeQueryArray('module.getModuleSites', $args);
1673
-		if(!$output->data) return array();
1674
-		foreach($output->data as $key => $val)
1673
+		if (!$output->data) return array();
1674
+		foreach ($output->data as $key => $val)
1675 1675
 		{
1676 1676
 			$modules[$val->module_srl] = $val;
1677 1677
 		}
1678 1678
 
1679
-		if(is_array($data))
1679
+		if (is_array($data))
1680 1680
 		{
1681
-			foreach($data as $key => $val)
1681
+			foreach ($data as $key => $val)
1682 1682
 			{
1683 1683
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1684 1684
 			}
@@ -1694,14 +1694,14 @@  discard block
 block discarded – undo
1694 1694
 	 */
1695 1695
 	function isSiteAdmin($member_info, $site_srl = null)
1696 1696
 	{
1697
-		if(!$member_info->member_srl) return false;
1698
-		if($member_info->is_admin == 'Y') return true;
1697
+		if (!$member_info->member_srl) return false;
1698
+		if ($member_info->is_admin == 'Y') return true;
1699 1699
 
1700 1700
 		$args = new stdClass();
1701
-		if(!isset($site_srl))
1701
+		if (!isset($site_srl))
1702 1702
 		{
1703 1703
 			$site_module_info = Context::get('site_module_info');
1704
-			if(!$site_module_info) return;
1704
+			if (!$site_module_info) return;
1705 1705
 			$args->site_srl = $site_module_info->site_srl;
1706 1706
 		}
1707 1707
 		else
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 		$args->member_srl = $member_info->member_srl;
1713 1713
 		$output = executeQuery('module.isSiteAdmin', $args);
1714
-		if($output->data->member_srl == $args->member_srl) return true;
1714
+		if ($output->data->member_srl == $args->member_srl) return true;
1715 1715
 		return false;
1716 1716
 	}
1717 1717
 
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 		$obj = new stdClass();
1735 1735
 		$obj->module_srl = $module_srl;
1736 1736
 		$output = executeQueryArray('module.getAdminID', $obj);
1737
-		if(!$output->toBool() || !$output->data) return;
1737
+		if (!$output->toBool() || !$output->data) return;
1738 1738
 
1739 1739
 		return $output->data;
1740 1740
 	}
@@ -1747,20 +1747,20 @@  discard block
 block discarded – undo
1747 1747
 	{
1748 1748
 		$extra_vars = array();
1749 1749
 		$get_module_srls = array();
1750
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1750
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1751 1751
 
1752 1752
 		$vars = false;
1753 1753
 		// cache controll
1754 1754
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1755
-		if($oCacheHandler->isSupport())
1755
+		if ($oCacheHandler->isSupport())
1756 1756
 		{
1757
-			foreach($list_module_srl as $module_srl)
1757
+			foreach ($list_module_srl as $module_srl)
1758 1758
 			{
1759 1759
 				$object_key = 'module_extra_vars:'.$module_srl;
1760 1760
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1761 1761
 				$vars = $oCacheHandler->get($cache_key);
1762 1762
 
1763
-				if($vars)
1763
+				if ($vars)
1764 1764
 				{
1765 1765
 					$extra_vars[$module_srl] = $vars;
1766 1766
 				}
@@ -1775,35 +1775,35 @@  discard block
 block discarded – undo
1775 1775
 			$get_module_srls = $list_module_srl;
1776 1776
 		}
1777 1777
 
1778
-		if(count($get_module_srls) > 0)
1778
+		if (count($get_module_srls) > 0)
1779 1779
 		{
1780 1780
 			$args = new stdClass();
1781 1781
 			$args->module_srl = implode(',', $get_module_srls);
1782 1782
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1783 1783
 
1784
-			if(!$output->toBool())
1784
+			if (!$output->toBool())
1785 1785
 			{
1786 1786
 				return;
1787 1787
 			}
1788 1788
 
1789
-			if(!$output->data)
1789
+			if (!$output->data)
1790 1790
 			{
1791
-				foreach($get_module_srls as $module_srl)
1791
+				foreach ($get_module_srls as $module_srl)
1792 1792
 				{
1793 1793
 					$extra_vars[$module_srl] = new stdClass;
1794 1794
 				}
1795 1795
 			}
1796
-			foreach($output->data as $key => $val)
1796
+			foreach ($output->data as $key => $val)
1797 1797
 			{
1798
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1798
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1799 1799
 
1800
-				if(!isset($extra_vars[$val->module_srl]))
1800
+				if (!isset($extra_vars[$val->module_srl]))
1801 1801
 				{
1802 1802
 					$extra_vars[$val->module_srl] = new stdClass();
1803 1803
 				}
1804 1804
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1805 1805
 
1806
-				if($oCacheHandler->isSupport())
1806
+				if ($oCacheHandler->isSupport())
1807 1807
 				{
1808 1808
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1809 1809
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1822,27 +1822,27 @@  discard block
 block discarded – undo
1822 1822
 	{
1823 1823
 		$skin_vars = false;
1824 1824
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1825
-		if($oCacheHandler->isSupport())
1825
+		if ($oCacheHandler->isSupport())
1826 1826
 		{
1827 1827
 			$object_key = 'module_skin_vars:'.$module_srl;
1828 1828
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1829 1829
 			$skin_vars = $oCacheHandler->get($cache_key);
1830 1830
 		}
1831 1831
 
1832
-		if($skin_vars === false)
1832
+		if ($skin_vars === false)
1833 1833
 		{
1834 1834
 			$args = new stdClass();
1835 1835
 			$args->module_srl = $module_srl;
1836
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1837
-			if(!$output->toBool()) return;
1836
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1837
+			if (!$output->toBool()) return;
1838 1838
 
1839 1839
 			$skin_vars = array();
1840
-			foreach($output->data as $vars)
1840
+			foreach ($output->data as $vars)
1841 1841
 			{
1842 1842
 				$skin_vars[$vars->name] = $vars;
1843 1843
 			}
1844 1844
 
1845
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1845
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1846 1846
 		}
1847 1847
 
1848 1848
 		return $skin_vars;
@@ -1854,32 +1854,32 @@  discard block
 block discarded – undo
1854 1854
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1855 1855
 	{
1856 1856
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1857
-		if(!$site_srl) $site_srl = 0;
1857
+		if (!$site_srl) $site_srl = 0;
1858 1858
 
1859 1859
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1860
-		if(is_readable($designInfoFile))
1860
+		if (is_readable($designInfoFile))
1861 1861
 		{
1862 1862
 			include($designInfoFile);
1863 1863
 
1864 1864
 			$skinName = $designInfo->module->{$module_name}->{$target};
1865 1865
 		}
1866
-		if(!$skinName)
1866
+		if (!$skinName)
1867 1867
 		{
1868 1868
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1869 1869
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1870 1870
 
1871
-			if(is_dir($moduleSkinPath.'default'))
1871
+			if (is_dir($moduleSkinPath.'default'))
1872 1872
 			{
1873 1873
 				$skinName = 'default';
1874 1874
 			}
1875
-			else if(is_dir($moduleSkinPath.'xe_default'))
1875
+			else if (is_dir($moduleSkinPath.'xe_default'))
1876 1876
 			{
1877 1877
 				$skinName = 'xe_default';
1878 1878
 			}
1879 1879
 			else
1880 1880
 			{
1881 1881
 				$skins = FileHandler::readDir($moduleSkinPath);
1882
-				if(count($skins) > 0)
1882
+				if (count($skins) > 0)
1883 1883
 				{
1884 1884
 					$skinName = $skins[0];
1885 1885
 				}
@@ -1889,9 +1889,9 @@  discard block
 block discarded – undo
1889 1889
 				}
1890 1890
 			}
1891 1891
 
1892
-			if($updateCache && $skinName)
1892
+			if ($updateCache && $skinName)
1893 1893
 			{
1894
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1894
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1895 1895
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1896 1896
 
1897 1897
 				$oAdminController = getAdminController('admin');
@@ -1907,10 +1907,10 @@  discard block
 block discarded – undo
1907 1907
 	 */
1908 1908
 	function syncSkinInfoToModuleInfo(&$module_info)
1909 1909
 	{
1910
-		if(!$module_info->module_srl) return;
1910
+		if (!$module_info->module_srl) return;
1911 1911
 
1912 1912
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1913
-		if(Mobile::isFromMobilePhone())
1913
+		if (Mobile::isFromMobilePhone())
1914 1914
 		{
1915 1915
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1916 1916
 		}
@@ -1919,11 +1919,11 @@  discard block
 block discarded – undo
1919 1919
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1920 1920
 		}
1921 1921
 
1922
-		if(!$skin_vars) return;
1922
+		if (!$skin_vars) return;
1923 1923
 
1924
-		foreach($skin_vars as $name => $val)
1924
+		foreach ($skin_vars as $name => $val)
1925 1925
 		{
1926
-			if(isset($module_info->{$name})) continue;
1926
+			if (isset($module_info->{$name})) continue;
1927 1927
 			$module_info->{$name} = $val->value;
1928 1928
 		}
1929 1929
 	}
@@ -1937,27 +1937,27 @@  discard block
 block discarded – undo
1937 1937
 	{
1938 1938
 		$skin_vars = false;
1939 1939
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1940
-		if($oCacheHandler->isSupport())
1940
+		if ($oCacheHandler->isSupport())
1941 1941
 		{
1942 1942
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1943 1943
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1944 1944
 			$skin_vars = $oCacheHandler->get($cache_key);
1945 1945
 		}
1946 1946
 
1947
-		if($skin_vars === false)
1947
+		if ($skin_vars === false)
1948 1948
 		{
1949 1949
 			$args = new stdClass();
1950 1950
 			$args->module_srl = $module_srl;
1951
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1952
-			if(!$output->toBool() || !$output->data) return;
1951
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1952
+			if (!$output->toBool() || !$output->data) return;
1953 1953
 
1954 1954
 			$skin_vars = array();
1955
-			foreach($output->data as $vars)
1955
+			foreach ($output->data as $vars)
1956 1956
 			{
1957 1957
 				$skin_vars[$vars->name] = $vars;
1958 1958
 			}
1959 1959
 
1960
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1960
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1961 1961
 		}
1962 1962
 
1963 1963
 		return $skin_vars;
@@ -1969,32 +1969,32 @@  discard block
 block discarded – undo
1969 1969
 	 */
1970 1970
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1971 1971
 	{
1972
-		if(!$module_info->module_srl) return;
1972
+		if (!$module_info->module_srl) return;
1973 1973
 		$skin_vars = false;
1974 1974
 		// cache controll
1975 1975
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1976
-		if($oCacheHandler->isSupport())
1976
+		if ($oCacheHandler->isSupport())
1977 1977
 		{
1978 1978
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1979 1979
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1980 1980
 			$skin_vars = $oCacheHandler->get($cache_key);
1981 1981
 		}
1982
-		if($skin_vars === false)
1982
+		if ($skin_vars === false)
1983 1983
 		{
1984 1984
 			$args = new stdClass;
1985 1985
 			$args->module_srl = $module_info->module_srl;
1986
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1987
-			if(!$output->toBool()) return;
1986
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1987
+			if (!$output->toBool()) return;
1988 1988
 			$skin_vars = $output->data;
1989 1989
 
1990 1990
 			//insert in cache
1991
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1991
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1992 1992
 		}
1993
-		if(!$skin_vars) return;
1993
+		if (!$skin_vars) return;
1994 1994
 
1995
-		foreach($output->data as $val)
1995
+		foreach ($output->data as $val)
1996 1996
 		{
1997
-			if(isset($module_info->{$val->name})) continue;
1997
+			if (isset($module_info->{$val->name})) continue;
1998 1998
 			$module_info->{$val->name} = $val->value;
1999 1999
 		}
2000 2000
 	}
@@ -2006,7 +2006,7 @@  discard block
 block discarded – undo
2006 2006
 	{
2007 2007
 		$grant = new stdClass();
2008 2008
 
2009
-		if(!$xml_info)
2009
+		if (!$xml_info)
2010 2010
 		{
2011 2011
 			$module = $module_info->module;
2012 2012
 			$xml_info = $this->getModuleActionXml($module);
@@ -2014,9 +2014,9 @@  discard block
 block discarded – undo
2014 2014
 		// Set variables to grant group permission
2015 2015
 		$module_srl = $module_info->module_srl;
2016 2016
 		$grant_info = $xml_info->grant;
2017
-		if($member_info->member_srl)
2017
+		if ($member_info->member_srl)
2018 2018
 		{
2019
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2019
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2020 2020
 			else $group_list = array();
2021 2021
 		}
2022 2022
 		else
@@ -2024,10 +2024,10 @@  discard block
 block discarded – undo
2024 2024
 			$group_list = array();
2025 2025
 		}
2026 2026
 		// If module_srl doesn't exist(if unable to set permissions)
2027
-		if(!$module_srl)
2027
+		if (!$module_srl)
2028 2028
 		{
2029 2029
 			$grant->access = true;
2030
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2030
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2031 2031
 			{
2032 2032
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2033 2033
 			}
@@ -2038,23 +2038,23 @@  discard block
 block discarded – undo
2038 2038
 		{
2039 2039
 			// If module_srl exists
2040 2040
 			// Get a type of granted permission
2041
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2041
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false;
2042 2042
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2043 2043
 			// If a just logged-in member is, check if the member is a module administrator
2044
-			if(!$grant->manager && $member_info->member_srl)
2044
+			if (!$grant->manager && $member_info->member_srl)
2045 2045
 			{
2046 2046
 				$args = new stdClass();
2047 2047
 				$args->module_srl = $module_srl;
2048 2048
 				$args->member_srl = $member_info->member_srl;
2049
-				$output = executeQuery('module.getModuleAdmin',$args);
2050
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2049
+				$output = executeQuery('module.getModuleAdmin', $args);
2050
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2051 2051
 			}
2052 2052
 			// If not an administrator, get information from the DB and grant manager privilege.
2053
-			if(!$grant->manager)
2053
+			if (!$grant->manager)
2054 2054
 			{
2055 2055
 				$args = new stdClass();
2056 2056
 				// If planet, get permission settings from the planet home
2057
-				if($module_info->module == 'planet')
2057
+				if ($module_info->module == 'planet')
2058 2058
 				{
2059 2059
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2060 2060
 				}
@@ -2067,42 +2067,42 @@  discard block
 block discarded – undo
2067 2067
 
2068 2068
 				$grant_exists = $granted = array();
2069 2069
 
2070
-				if($output->data)
2070
+				if ($output->data)
2071 2071
 				{
2072 2072
 					// Arrange names and groups who has privileges
2073
-					foreach($output->data as $val)
2073
+					foreach ($output->data as $val)
2074 2074
 					{
2075 2075
 						$grant_exists[$val->name] = true;
2076
-						if($granted[$val->name]) continue;
2076
+						if ($granted[$val->name]) continue;
2077 2077
 						// Log-in member only
2078
-						if($val->group_srl == -1)
2078
+						if ($val->group_srl == -1)
2079 2079
 						{
2080 2080
 							$granted[$val->name] = true;
2081
-							if($member_info->member_srl) $grant->{$val->name} = true;
2081
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2082 2082
 							// Site-joined member only
2083 2083
 						}
2084
-						elseif($val->group_srl == -2)
2084
+						elseif ($val->group_srl == -2)
2085 2085
 						{
2086 2086
 							$granted[$val->name] = true;
2087 2087
 							// Do not grant any permission for non-logged member
2088
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2088
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2089 2089
 							// Log-in member
2090 2090
 							else
2091 2091
 							{
2092 2092
 								$site_module_info = Context::get('site_module_info');
2093 2093
 								// Permission granted if no information of the currently connected site exists
2094
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2094
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2095 2095
 								// Permission is not granted if information of the currently connected site exists
2096
-								elseif(count($group_list)) $grant->{$val->name} = true;
2096
+								elseif (count($group_list)) $grant->{$val->name} = true;
2097 2097
 							}
2098 2098
 							// All of non-logged members
2099 2099
 						}
2100
-						elseif($val->group_srl == -3)
2100
+						elseif ($val->group_srl == -3)
2101 2101
 						{
2102 2102
 							$granted[$val->name] = true;
2103 2103
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2104 2104
 						}
2105
-						elseif($val->group_srl == 0)
2105
+						elseif ($val->group_srl == 0)
2106 2106
 						{
2107 2107
 							$granted[$val->name] = true;
2108 2108
 							$grant->{$val->name} = true;
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 						}
2111 2111
 						else
2112 2112
 						{
2113
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2113
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2114 2114
 							{
2115 2115
 								$grant->{$val->name} = true;
2116 2116
 								$granted[$val->name] = true;
@@ -2119,29 +2119,29 @@  discard block
 block discarded – undo
2119 2119
 					}
2120 2120
 				}
2121 2121
 				// Separate processing for the virtual group access
2122
-				if(!$grant_exists['access']) $grant->access = true;
2123
-				if(count($grant_info))
2122
+				if (!$grant_exists['access']) $grant->access = true;
2123
+				if (count($grant_info))
2124 2124
 				{
2125
-					foreach($grant_info as  $grant_name => $grant_item)
2125
+					foreach ($grant_info as  $grant_name => $grant_item)
2126 2126
 					{
2127
-						if($grant_exists[$grant_name]) continue;
2128
-						switch($grant_item->default)
2127
+						if ($grant_exists[$grant_name]) continue;
2128
+						switch ($grant_item->default)
2129 2129
 						{
2130 2130
 							case 'guest' :
2131 2131
 								$grant->{$grant_name} = true;
2132 2132
 								break;
2133 2133
 							case 'member' :
2134
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2134
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2135 2135
 								else $grant->{$grant_name} = false;
2136 2136
 								break;
2137 2137
 							case 'site' :
2138 2138
 								$site_module_info = Context::get('site_module_info');
2139
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2139
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2140 2140
 								else $grant->{$grant_name} = false;
2141 2141
 								break;
2142 2142
 							case 'manager' :
2143 2143
 							case 'root' :
2144
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2144
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2145 2145
 								else $grant->{$grant_name} = false;
2146 2146
 								break;
2147 2147
 						}
@@ -2149,12 +2149,12 @@  discard block
 block discarded – undo
2149 2149
 				}
2150 2150
 			}
2151 2151
 			// Set true to grant all privileges if an administrator is
2152
-			if($grant->manager)
2152
+			if ($grant->manager)
2153 2153
 			{
2154 2154
 				$grant->access = true;
2155
-				if(count($grant_info))
2155
+				if (count($grant_info))
2156 2156
 				{
2157
-					foreach($grant_info as $key => $val)
2157
+					foreach ($grant_info as $key => $val)
2158 2158
 					{
2159 2159
 						$grant->{$key} = true;
2160 2160
 					}
@@ -2186,27 +2186,27 @@  discard block
 block discarded – undo
2186 2186
 
2187 2187
 	function unserializeAttributes($module_filebox_list)
2188 2188
 	{
2189
-		if(is_array($module_filebox_list->data))
2189
+		if (is_array($module_filebox_list->data))
2190 2190
 		{
2191
-			foreach($module_filebox_list->data as &$item)
2191
+			foreach ($module_filebox_list->data as &$item)
2192 2192
 			{
2193
-				if(empty($item->comment))
2193
+				if (empty($item->comment))
2194 2194
 				{
2195 2195
 					continue;
2196 2196
 				}
2197 2197
 
2198 2198
 				$attributes = explode(';', $item->comment);
2199
-				foreach($attributes as $attribute)
2199
+				foreach ($attributes as $attribute)
2200 2200
 				{
2201 2201
 					$values = explode(':', $attribute);
2202
-					if((count($values) % 2) ==1)
2202
+					if ((count($values) % 2) == 1)
2203 2203
 					{
2204
-						for($i=2;$i<count($values);$i++)
2204
+						for ($i = 2; $i < count($values); $i++)
2205 2205
 						{
2206
-							$values[1].=":".$values[$i];
2206
+							$values[1] .= ":".$values[$i];
2207 2207
 						}
2208 2208
 					}
2209
-					$atts[$values[0]]=$values[1];
2209
+					$atts[$values[0]] = $values[1];
2210 2210
 				}
2211 2211
 				$item->attributes = $atts;
2212 2212
 				unset($atts);
@@ -2218,16 +2218,16 @@  discard block
 block discarded – undo
2218 2218
 	function getFileBoxListHtml()
2219 2219
 	{
2220 2220
 		$logged_info = Context::get('logged_info');
2221
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2221
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2222 2222
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2223
-		$link_params = explode('&',$link['query']);
2223
+		$link_params = explode('&', $link['query']);
2224 2224
 		foreach ($link_params as $param)
2225 2225
 		{
2226
-			$param = explode("=",$param);
2227
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2226
+			$param = explode("=", $param);
2227
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2228 2228
 		}
2229 2229
 		$oWidgetModel = getModel('widget');
2230
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2230
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2231 2231
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2232 2232
 
2233 2233
 		$oModuleModel = getModel('module');
@@ -2243,24 +2243,24 @@  discard block
 block discarded – undo
2243 2243
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2244 2244
 
2245 2245
 		$oTemplate = &TemplateHandler::getInstance();
2246
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2246
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2247 2247
 
2248 2248
 		$this->add('html', $html);
2249 2249
 	}
2250 2250
 
2251 2251
 	function getModuleFileBoxPath($module_filebox_srl)
2252 2252
 	{
2253
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2253
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2254 2254
 	}
2255 2255
 
2256 2256
 	/**
2257 2257
 	 * @brief Return ruleset cache file path
2258 2258
 	 * @param module, act
2259 2259
 	 */
2260
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2260
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2261 2261
 	{
2262 2262
 		// load dynamic ruleset xml file
2263
-		if(strpos($ruleset, '@') !== false)
2263
+		if (strpos($ruleset, '@') !== false)
2264 2264
 		{
2265 2265
 			$rulsetFile = str_replace('@', '', $ruleset);
2266 2266
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2270,20 +2270,20 @@  discard block
 block discarded – undo
2270 2270
 		{
2271 2271
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2272 2272
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2273
-			if(is_readable($xml_file))
2273
+			if (is_readable($xml_file))
2274 2274
 				return FileHandler::getRealPath($xml_file);
2275
-			else{
2275
+			else {
2276 2276
 				$ruleset = str_replace('#', '', $ruleset);
2277 2277
 			}
2278 2278
 
2279 2279
 		}
2280 2280
 		// Get a path of the requested module. Return if not exists.
2281 2281
 		$class_path = ModuleHandler::getModulePath($module);
2282
-		if(!$class_path) return;
2282
+		if (!$class_path) return;
2283 2283
 
2284 2284
 		// Check if module.xml exists in the path. Return if not exist
2285 2285
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2286
-		if(!file_exists($xml_file)) return;
2286
+		if (!file_exists($xml_file)) return;
2287 2287
 
2288 2288
 		return $xml_file;
2289 2289
 	}
@@ -2295,7 +2295,7 @@  discard block
 block discarded – undo
2295 2295
 		$requestVars = Context::getRequestVars();
2296 2296
 
2297 2297
 		$args = new stdClass;
2298
-		$args->site_srl = (int)$requestVars->site_srl;
2298
+		$args->site_srl = (int) $requestVars->site_srl;
2299 2299
 		$args->page = 1; // /< Page
2300 2300
 		$args->list_count = 100; // /< the number of posts to display on a single page
2301 2301
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2307,9 +2307,9 @@  discard block
 block discarded – undo
2307 2307
 
2308 2308
 		$list = array();
2309 2309
 
2310
-		if($output->toBool())
2310
+		if ($output->toBool())
2311 2311
 		{
2312
-			foreach((array)$output->data as $code_info)
2312
+			foreach ((array) $output->data as $code_info)
2313 2313
 			{
2314 2314
 				unset($codeInfo);
2315 2315
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
classes/security/Purifier.class.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$this->_checkCacheDir();
15 15
 
16 16
 		// purifier setting
17
-		require_once _XE_PATH_ . 'classes/security/htmlpurifier/library/HTMLPurifier.auto.php';
17
+		require_once _XE_PATH_.'classes/security/htmlpurifier/library/HTMLPurifier.auto.php';
18 18
 		require_once 'HTMLPurifier.func.php';
19 19
 
20 20
 		$this->_setConfig();
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public function getInstance()
24 24
 	{
25
-		if(!isset($GLOBALS['__PURIFIER_INSTANCE__']))
25
+		if (!isset($GLOBALS['__PURIFIER_INSTANCE__']))
26 26
 		{
27 27
 			$GLOBALS['__PURIFIER_INSTANCE__'] = new Purifier();
28 28
 		}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 	public function setConfig($name, $value)
56 56
 	{
57
-		if($this->_config->isFinalized()) return;
57
+		if ($this->_config->isFinalized()) return;
58 58
 
59 59
 		$this->_config->set($name, $value);
60 60
 	}
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	{
64 64
 		// add attribute for edit component
65 65
 		$editComponentAttrs = $this->_searchEditComponent($content);
66
-		if(is_array($editComponentAttrs))
66
+		if (is_array($editComponentAttrs))
67 67
 		{
68
-			foreach($editComponentAttrs AS $k => $v)
68
+			foreach ($editComponentAttrs AS $k => $v)
69 69
 			{
70 70
 				$this->_def->addAttribute('img', $v, 'CDATA');
71 71
 				$this->_def->addAttribute('div', $v, 'CDATA');
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// add attribute for widget component
76 76
 		$widgetAttrs = $this->_searchWidget($content);
77
-		if(is_array($widgetAttrs))
77
+		if (is_array($widgetAttrs))
78 78
 		{
79
-			foreach($widgetAttrs AS $k => $v)
79
+			foreach ($widgetAttrs AS $k => $v)
80 80
 			{
81 81
 				$this->_def->addAttribute('img', $v, 'CDATA');
82 82
 			}
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 		preg_match_all('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', $content, $m);
94 94
 
95 95
 		$attributeList = array();
96
-		if(is_array($m[2]))
96
+		if (is_array($m[2]))
97 97
 		{
98
-			foreach($m[2] as $key => $value)
98
+			foreach ($m[2] as $key => $value)
99 99
 			{
100 100
 				unset($script, $m2);
101 101
 				$script = " {$m[2][$key]} editor_component={$m[3][$key]}";
102 102
 
103
-				if(preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
103
+				if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $script, $m2))
104 104
 				{
105
-					foreach($m2[1] as $value2)
105
+					foreach ($m2[1] as $value2)
106 106
 					{
107 107
 						//SECISSUE check style attr
108
-						if($value2 == 'style')
108
+						if ($value2 == 'style')
109 109
 						{
110 110
 							continue;
111 111
 						}
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
 		preg_match_all('!<(?:(div)|img)([^>]*)class="zbxe_widget_output"([^>]*)>(?(1)(.*?)</div>)!is', $content, $m);
129 129
 
130 130
 		$attributeList = array();
131
-		if(is_array($m[3]))
131
+		if (is_array($m[3]))
132 132
 		{
133 133
 			$content = str_replace('<img class="zbxe_widget_output"', '<img src="" class="zbxe_widget_output"', $content);
134 134
 
135
-			foreach($m[3] as $key => $value)
135
+			foreach ($m[3] as $key => $value)
136 136
 			{
137 137
 				if (preg_match_all('/([a-z0-9_-]+)="([^"]+)"/is', $m[3][$key], $m2))
138 138
 				{
139
-					foreach($m2[1] as $value2)
139
+					foreach ($m2[1] as $value2)
140 140
 					{
141 141
 						//SECISSUE check style attr
142
-						if($value2 == 'style')
142
+						if ($value2 == 'style')
143 143
 						{
144 144
 							continue;
145 145
 						}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		$whiteIframeUrlList = $oEmbedFilter->getWhiteIframeUrlList();
158 158
 
159 159
 		$whiteDomain = array();
160
-		foreach($whiteIframeUrlList as $value)
160
+		foreach ($whiteIframeUrlList as $value)
161 161
 		{
162 162
 			$whiteDomain[] = preg_quote($value, '%');
163 163
 		}
164 164
 
165
-		$whiteDomainRegex = '%^(' . implode('|', $whiteDomain) . ')%';
165
+		$whiteDomainRegex = '%^('.implode('|', $whiteDomain).')%';
166 166
 
167 167
 		return $whiteDomainRegex;
168 168
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	private function _checkCacheDir()
171 171
 	{
172 172
 		// check htmlpurifier cache directory
173
-		$this->_cacheDir = _XE_PATH_ . 'files/cache/htmlpurifier';
173
+		$this->_cacheDir = _XE_PATH_.'files/cache/htmlpurifier';
174 174
 		FileHandler::makeDir($this->_cacheDir);
175 175
 	}
176 176
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@
 block discarded – undo
54 54
 
55 55
 	public function setConfig($name, $value)
56 56
 	{
57
-		if($this->_config->isFinalized()) return;
57
+		if($this->_config->isFinalized()) {
58
+			return;
59
+		}
58 60
 
59 61
 		$this->_config->set($name, $value);
60 62
 	}
Please login to merge, or discard this patch.
classes/context/Context.class.php 3 patches
Doc Comments   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	/**
158 158
 	 * returns static context object (Singleton). It's to use Context without declaration of an object
159 159
 	 *
160
-	 * @return object Instance
160
+	 * @return Context Instance
161 161
 	 */
162 162
 	function &getInstance()
163 163
 	{
@@ -891,6 +891,7 @@  discard block
 block discarded – undo
891 891
 	 * Evaluation of xml language file
892 892
 	 *
893 893
 	 * @param string Path of the language file
894
+	 * @param string $path
894 895
 	 * @return void
895 896
 	 */
896 897
 	function _evalxmlLang($path)
@@ -1030,7 +1031,7 @@  discard block
 block discarded – undo
1030 1031
 	/**
1031 1032
 	 * Convert strings of variables in $source_object into UTF-8
1032 1033
 	 *
1033
-	 * @param object $source_obj Conatins strings to convert
1034
+	 * @param stdClass $source_obj Conatins strings to convert
1034 1035
 	 * @return object converted object
1035 1036
 	 */
1036 1037
 	function convertEncoding($source_obj)
@@ -1065,11 +1066,11 @@  discard block
 block discarded – undo
1065 1066
 	/**
1066 1067
 	 * Check flag
1067 1068
 	 *
1068
-	 * @param mixed $val
1069
+	 * @param boolean $val
1069 1070
 	 * @param string $key
1070 1071
 	 * @param mixed $charset charset
1071 1072
 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
1072
-	 * @return void
1073
+	 * @return null|boolean
1073 1074
 	 */
1074 1075
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1075 1076
 	{
@@ -1935,7 +1936,7 @@  discard block
 block discarded – undo
1935 1936
 	 *
1936 1937
 	 * @param string $key Key
1937 1938
 	 * @param mixed $val Value
1938
-	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars.
1939
+	 * @param integer $set_to_get_vars If not FALSE, Set to get vars.
1939 1940
 	 * @return void
1940 1941
 	 */
1941 1942
 	function set($key, $val, $set_to_get_vars = 0)
@@ -1977,7 +1978,7 @@  discard block
 block discarded – undo
1977 1978
 	/**
1978 1979
 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...)
1979 1980
 	 *
1980
-	 * @return object
1981
+	 * @return null|stdClass
1981 1982
 	 */
1982 1983
 	function gets()
1983 1984
 	{
@@ -2050,7 +2051,7 @@  discard block
 block discarded – undo
2050 2051
 	/**
2051 2052
 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
2052 2053
 	 *
2053
-	 * @param string $action act name
2054
+	 * @param string[] $action_array
2054 2055
 	 * @return void
2055 2056
 	 */
2056 2057
 	function addSSLActions($action_array)
@@ -2221,7 +2222,7 @@  discard block
 block discarded – undo
2221 2222
 	 * @param string $file File name with path
2222 2223
 	 * @param string $optimized optimized (That seems to not use)
2223 2224
 	 * @param string $targetie target IE
2224
-	 * @param string $index index
2225
+	 * @param integer $index index
2225 2226
 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
2226 2227
 	 * @param bool $isRuleset Use ruleset
2227 2228
 	 * @param string $autoPath If path not readed, set the path automatically.
@@ -2331,7 +2332,7 @@  discard block
 block discarded – undo
2331 2332
 	 * @param string $optimized optimized (That seems to not use)
2332 2333
 	 * @param string $media Media query
2333 2334
 	 * @param string $targetie target IE
2334
-	 * @param string $index index
2335
+	 * @param integer $index index
2335 2336
 	 * @return void
2336 2337
 	 *
2337 2338
 	 */
Please login to merge, or discard this patch.
Spacing   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		$self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		ob_end_clean();
458 458
 
459 459
 		// If master_db information does not exist, the config file needs to be updated
460
-		if(!isset($db_info->master_db))
460
+		if (!isset($db_info->master_db))
461 461
 		{
462 462
 			$db_info->master_db = array();
463 463
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
476 476
 			unset($db_info->db_table_prefix);
477 477
 
478
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
478
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
479 479
 			{
480 480
 				$db_info->master_db["db_table_prefix"] .= '_';
481 481
 			}
@@ -487,33 +487,33 @@  discard block
 block discarded – undo
487 487
 			$oInstallController->makeConfigFile();
488 488
 		}
489 489
 
490
-		if(!$db_info->use_prepared_statements)
490
+		if (!$db_info->use_prepared_statements)
491 491
 		{
492 492
 			$db_info->use_prepared_statements = 'Y';
493 493
 		}
494 494
 
495
-		if(!$db_info->time_zone)
495
+		if (!$db_info->time_zone)
496 496
 			$db_info->time_zone = date('O');
497 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 498
 
499
-		if($db_info->qmail_compatibility != 'Y')
499
+		if ($db_info->qmail_compatibility != 'Y')
500 500
 			$db_info->qmail_compatibility = 'N';
501 501
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 502
 
503
-		if(!$db_info->use_db_session)
503
+		if (!$db_info->use_db_session)
504 504
 			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
505
+		if (!$db_info->use_ssl)
506 506
 			$db_info->use_ssl = 'none';
507 507
 		$this->set('_use_ssl', $db_info->use_ssl);
508 508
 
509 509
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
510 510
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
511 511
 
512
-		if(!$db_info->sitelock_whitelist) {
512
+		if (!$db_info->sitelock_whitelist) {
513 513
 			$db_info->sitelock_whitelist = '127.0.0.1';
514 514
 		}
515 515
 
516
-		if(is_string($db_info->sitelock_whitelist)) {
516
+		if (is_string($db_info->sitelock_whitelist)) {
517 517
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
518 518
 		}
519 519
 
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
 	function loadLangSupported()
585 585
 	{
586 586
 		static $lang_supported = null;
587
-		if(!$lang_supported)
587
+		if (!$lang_supported)
588 588
 		{
589
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
590
-			foreach($langs as $val)
589
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
590
+			foreach ($langs as $val)
591 591
 			{
592 592
 				list($lang_prefix, $lang_text) = explode(',', $val);
593 593
 				$lang_text = trim($lang_text);
@@ -605,17 +605,17 @@  discard block
 block discarded – undo
605 605
 	function loadLangSelected()
606 606
 	{
607 607
 		static $lang_selected = null;
608
-		if(!$lang_selected)
608
+		if (!$lang_selected)
609 609
 		{
610
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
611
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
612
-			if(!FileHandler::hasContent($selected_lang_file))
610
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
611
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
612
+			if (!FileHandler::hasContent($selected_lang_file))
613 613
 			{
614
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
614
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
615 615
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
616 616
 			}
617 617
 
618
-			if(!FileHandler::hasContent($selected_lang_file))
618
+			if (!FileHandler::hasContent($selected_lang_file))
619 619
 			{
620 620
 				$buff = FileHandler::readFile($orig_lang_file);
621 621
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 			else
625 625
 			{
626 626
 				$langs = file($selected_lang_file);
627
-				foreach($langs as $val)
627
+				foreach ($langs as $val)
628 628
 				{
629 629
 					list($lang_prefix, $lang_text) = explode(',', $val);
630 630
 					$lang_text = trim($lang_text);
@@ -643,56 +643,56 @@  discard block
 block discarded – undo
643 643
 	function checkSSO()
644 644
 	{
645 645
 		// pass if it's not GET request or XE is not yet installed
646
-		if($this->db_info->use_sso != 'Y' || isCrawler())
646
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
647 647
 		{
648 648
 			return TRUE;
649 649
 		}
650 650
 		$checkActList = array('rss' => 1, 'atom' => 1);
651
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
651
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
652 652
 		{
653 653
 			return TRUE;
654 654
 		}
655 655
 
656 656
 		// pass if default URL is not set
657 657
 		$default_url = trim($this->db_info->default_url);
658
-		if(!$default_url)
658
+		if (!$default_url)
659 659
 		{
660 660
 			return TRUE;
661 661
 		}
662 662
 
663
-		if(substr_compare($default_url, '/', -1) !== 0)
663
+		if (substr_compare($default_url, '/', -1) !== 0)
664 664
 		{
665 665
 			$default_url .= '/';
666 666
 		}
667 667
 
668 668
 		// for sites recieving SSO valdiation
669
-		if($default_url == self::getRequestUri())
669
+		if ($default_url == self::getRequestUri())
670 670
 		{
671
-			if(self::get('url'))
671
+			if (self::get('url'))
672 672
 			{
673 673
 				$url = base64_decode(self::get('url'));
674 674
 				$url_info = parse_url($url);
675
-				if(!Password::checkSignature($url, self::get('sig')))
675
+				if (!Password::checkSignature($url, self::get('sig')))
676 676
 				{
677 677
 					echo self::get('lang')->msg_invalid_request;
678 678
 					return false;
679 679
 				}
680 680
 
681 681
 				$oModuleModel = getModel('module');
682
-				$domain = $url_info['host'] . $url_info['path'];
683
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
682
+				$domain = $url_info['host'].$url_info['path'];
683
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
684 684
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
685 685
 
686
-				if($site_info->site_srl)
686
+				if ($site_info->site_srl)
687 687
 				{
688
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
689
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
688
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
689
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
690 690
 				}
691 691
 				else
692 692
 				{
693 693
 					$redirect_url = $url;
694 694
 				}
695
-				header('location:' . $redirect_url);
695
+				header('location:'.$redirect_url);
696 696
 
697 697
 				return FALSE;
698 698
 			}
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 		else
702 702
 		{
703 703
 			// result handling : set session_name()
704
-			if($session_name = self::get('SSOID'))
704
+			if ($session_name = self::get('SSOID'))
705 705
 			{
706
-				if(!Password::checkSignature($session_name, self::get('sig')))
706
+				if (!Password::checkSignature($session_name, self::get('sig')))
707 707
 				{
708 708
 					echo self::get('lang')->msg_invalid_request;
709 709
 					return false;
@@ -712,17 +712,17 @@  discard block
 block discarded – undo
712 712
 				setcookie(session_name(), $session_name);
713 713
 
714 714
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
715
-				header('location:' . $url);
715
+				header('location:'.$url);
716 716
 				return FALSE;
717 717
 				// send SSO request
718 718
 			}
719
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
719
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720 720
 			{
721 721
 				setcookie('sso', md5(self::getRequestUri()));
722 722
 				$origin_url = self::getRequestUrl();
723 723
 				$origin_sig = Password::createSignature($origin_url);
724 724
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
725
-				header('location:' . $url);
725
+				header('location:'.$url);
726 726
 				return FALSE;
727 727
 			}
728 728
 		}
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	{
750 750
 		$self = self::getInstance();
751 751
 
752
-		if(!$self->isFTPRegisted())
752
+		if (!$self->isFTPRegisted())
753 753
 		{
754 754
 			return null;
755 755
 		}
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
 	 */
768 768
 	function addBrowserTitle($site_title)
769 769
 	{
770
-		if(!$site_title)
770
+		if (!$site_title)
771 771
 		{
772 772
 			return;
773 773
 		}
774 774
 		$self = self::getInstance();
775 775
 
776
-		if($self->site_title)
776
+		if ($self->site_title)
777 777
 		{
778
-			$self->site_title .= ' - ' . $site_title;
778
+			$self->site_title .= ' - '.$site_title;
779 779
 		}
780 780
 		else
781 781
 		{
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 */
792 792
 	function setBrowserTitle($site_title)
793 793
 	{
794
-		if(!$site_title)
794
+		if (!$site_title)
795 795
 		{
796 796
 			return;
797 797
 		}
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		$oModuleModel = getModel('module');
824 824
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
825 825
 
826
-		if(isset($moduleConfig->siteTitle))
826
+		if (isset($moduleConfig->siteTitle))
827 827
 		{
828 828
 			return $moduleConfig->siteTitle;
829 829
 		}
@@ -850,30 +850,30 @@  discard block
 block discarded – undo
850 850
 		global $lang;
851 851
 
852 852
 		$self = self::getInstance();
853
-		if(!$self->lang_type)
853
+		if (!$self->lang_type)
854 854
 		{
855 855
 			return;
856 856
 		}
857
-		if(!is_object($lang))
857
+		if (!is_object($lang))
858 858
 		{
859 859
 			$lang = new stdClass;
860 860
 		}
861 861
 
862
-		if(!($filename = $self->_loadXmlLang($path)))
862
+		if (!($filename = $self->_loadXmlLang($path)))
863 863
 		{
864 864
 			$filename = $self->_loadPhpLang($path);
865 865
 		}
866 866
 
867
-		if(!is_array($self->loaded_lang_files))
867
+		if (!is_array($self->loaded_lang_files))
868 868
 		{
869 869
 			$self->loaded_lang_files = array();
870 870
 		}
871
-		if(in_array($filename, $self->loaded_lang_files))
871
+		if (in_array($filename, $self->loaded_lang_files))
872 872
 		{
873 873
 			return;
874 874
 		}
875 875
 
876
-		if($filename && is_readable($filename))
876
+		if ($filename && is_readable($filename))
877 877
 		{
878 878
 			$self->loaded_lang_files[] = $filename;
879 879
 			include($filename);
@@ -894,24 +894,24 @@  discard block
 block discarded – undo
894 894
 	{
895 895
 		global $lang;
896 896
 
897
-		if(!$path) return;
897
+		if (!$path) return;
898 898
 
899
-		$_path = 'eval://' . $path;
899
+		$_path = 'eval://'.$path;
900 900
 
901
-		if(in_array($_path, $this->loaded_lang_files))
901
+		if (in_array($_path, $this->loaded_lang_files))
902 902
 		{
903 903
 			return;
904 904
 		}
905 905
 
906
-		if(substr_compare($path, '/', -1) !== 0)
906
+		if (substr_compare($path, '/', -1) !== 0)
907 907
 		{
908 908
 			$path .= '/';
909 909
 		}
910 910
 
911
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
911
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
912 912
 		$content = $oXmlLangParser->getCompileContent();
913 913
 
914
-		if($content)
914
+		if ($content)
915 915
 		{
916 916
 			$this->loaded_lang_files[] = $_path;
917 917
 			eval($content);
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
 	 */
927 927
 	function _loadXmlLang($path)
928 928
 	{
929
-		if(!$path) return;
929
+		if (!$path) return;
930 930
 
931
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
931
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
932 932
 		return $oXmlLangParser->compile();
933 933
 	}
934 934
 
@@ -940,22 +940,22 @@  discard block
 block discarded – undo
940 940
 	 */
941 941
 	function _loadPhpLang($path)
942 942
 	{
943
-		if(!$path) return;
943
+		if (!$path) return;
944 944
 
945
-		if(substr_compare($path, '/', -1) !== 0)
945
+		if (substr_compare($path, '/', -1) !== 0)
946 946
 		{
947 947
 			$path .= '/';
948 948
 		}
949
-		$path_tpl = $path . '%s.lang.php';
949
+		$path_tpl = $path.'%s.lang.php';
950 950
 		$file = sprintf($path_tpl, $this->lang_type);
951 951
 
952 952
 		$langs = array('ko', 'en'); // this will be configurable.
953
-		while(!is_readable($file) && $langs[0])
953
+		while (!is_readable($file) && $langs[0])
954 954
 		{
955 955
 			$file = sprintf($path_tpl, array_shift($langs));
956 956
 		}
957 957
 
958
-		if(!is_readable($file))
958
+		if (!is_readable($file))
959 959
 		{
960 960
 			return FALSE;
961 961
 		}
@@ -997,11 +997,11 @@  discard block
 block discarded – undo
997 997
 	 */
998 998
 	function getLang($code)
999 999
 	{
1000
-		if(!$code)
1000
+		if (!$code)
1001 1001
 		{
1002 1002
 			return;
1003 1003
 		}
1004
-		if($GLOBALS['lang']->{$code})
1004
+		if ($GLOBALS['lang']->{$code})
1005 1005
 		{
1006 1006
 			return $GLOBALS['lang']->{$code};
1007 1007
 		}
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	 */
1018 1018
 	function setLang($code, $val)
1019 1019
 	{
1020
-		if(!isset($GLOBALS['lang']))
1020
+		if (!isset($GLOBALS['lang']))
1021 1021
 		{
1022 1022
 			$GLOBALS['lang'] = new stdClass();
1023 1023
 		}
@@ -1042,17 +1042,17 @@  discard block
 block discarded – undo
1042 1042
 
1043 1043
 		$obj = clone $source_obj;
1044 1044
 
1045
-		foreach($charset_list as $charset)
1045
+		foreach ($charset_list as $charset)
1046 1046
 		{
1047
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1047
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1048 1048
 			$flag = self::checkConvertFlag($flag = TRUE);
1049
-			if($flag)
1049
+			if ($flag)
1050 1050
 			{
1051
-				if($charset == 'UTF-8')
1051
+				if ($charset == 'UTF-8')
1052 1052
 				{
1053 1053
 					return $obj;
1054 1054
 				}
1055
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1055
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1056 1056
 				return $obj;
1057 1057
 			}
1058 1058
 		}
@@ -1071,11 +1071,11 @@  discard block
 block discarded – undo
1071 1071
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1072 1072
 	{
1073 1073
 		static $flag = TRUE;
1074
-		if($charset)
1074
+		if ($charset)
1075 1075
 		{
1076
-			if(is_array($val))
1077
-				array_walk($val,'Context::checkConvertFlag',$charset);
1078
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1076
+			if (is_array($val))
1077
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1078
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1079 1079
 			else $flag = FALSE;
1080 1080
 		}
1081 1081
 		else
@@ -1099,9 +1099,9 @@  discard block
 block discarded – undo
1099 1099
 	{
1100 1100
 		if (is_array($val))
1101 1101
 		{
1102
-			array_walk($val,'Context::doConvertEncoding',$charset);
1102
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1103 1103
 		}
1104
-		else $val = iconv($charset,'UTF-8',$val);
1104
+		else $val = iconv($charset, 'UTF-8', $val);
1105 1105
 	}
1106 1106
 
1107 1107
 	/**
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 	 */
1113 1113
 	function convertEncodingStr($str)
1114 1114
 	{
1115
-        if(!$str) return null;
1115
+        if (!$str) return null;
1116 1116
 		$obj = new stdClass();
1117 1117
 		$obj->str = $str;
1118 1118
 		$obj = self::convertEncoding($obj);
@@ -1121,9 +1121,9 @@  discard block
 block discarded – undo
1121 1121
 
1122 1122
 	function decodeIdna($domain)
1123 1123
 	{
1124
-		if(strpos($domain, 'xn--') !== FALSE)
1124
+		if (strpos($domain, 'xn--') !== FALSE)
1125 1125
 		{
1126
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1126
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1127 1127
 			$IDN = new idna_convert(array('idn_version' => 2008));
1128 1128
 			$domain = $IDN->decode($domain);
1129 1129
 		}
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 	{
1155 1155
 		$self = self::getInstance();
1156 1156
 
1157
-		if($self->response_method)
1157
+		if ($self->response_method)
1158 1158
 		{
1159 1159
 			return $self->response_method;
1160 1160
 		}
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1195 1195
 
1196 1196
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1197
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1197
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1198 1198
 		{
1199 1199
 			$this->isSuccessInit = FALSE;
1200 1200
 		}
@@ -1207,30 +1207,30 @@  discard block
 block discarded – undo
1207 1207
 	 */
1208 1208
 	function _setRequestArgument()
1209 1209
 	{
1210
-		if(!count($_REQUEST))
1210
+		if (!count($_REQUEST))
1211 1211
 		{
1212 1212
 			return;
1213 1213
 		}
1214 1214
 
1215 1215
 		$requestMethod = $this->getRequestMethod();
1216
-		foreach($_REQUEST as $key => $val)
1216
+		foreach ($_REQUEST as $key => $val)
1217 1217
 		{
1218
-			if($val === '' || self::get($key))
1218
+			if ($val === '' || self::get($key))
1219 1219
 			{
1220 1220
 				continue;
1221 1221
 			}
1222 1222
 			$key = htmlentities($key);
1223 1223
 			$val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET'));
1224 1224
 
1225
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1225
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1226 1226
 			{
1227 1227
 				$set_to_vars = TRUE;
1228 1228
 			}
1229
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1229
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1230 1230
 			{
1231 1231
 				$set_to_vars = TRUE;
1232 1232
 			}
1233
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1233
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1234 1234
 			{
1235 1235
 				$set_to_vars = TRUE;
1236 1236
 			}
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
 				$set_to_vars = FALSE;
1240 1240
 			}
1241 1241
 
1242
-			if($set_to_vars)
1242
+			if ($set_to_vars)
1243 1243
 			{
1244 1244
 				$this->_recursiveCheckVar($val);
1245 1245
 			}
@@ -1250,20 +1250,20 @@  discard block
 block discarded – undo
1250 1250
 
1251 1251
 	function _recursiveCheckVar($val)
1252 1252
 	{
1253
-		if(is_string($val))
1253
+		if (is_string($val))
1254 1254
 		{
1255
-			foreach($this->patterns as $pattern)
1255
+			foreach ($this->patterns as $pattern)
1256 1256
 			{
1257
-				if(preg_match($pattern, $val))
1257
+				if (preg_match($pattern, $val))
1258 1258
 				{
1259 1259
 					$this->isSuccessInit = FALSE;
1260 1260
 					return;
1261 1261
 				}
1262 1262
 			}
1263 1263
 		}
1264
-		else if(is_array($val))
1264
+		else if (is_array($val))
1265 1265
 		{
1266
-			foreach($val as $val2)
1266
+			foreach ($val as $val2)
1267 1267
 			{
1268 1268
 				$this->_recursiveCheckVar($val2);
1269 1269
 			}
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
 	 */
1278 1278
 	function _setJSONRequestArgument()
1279 1279
 	{
1280
-		if($this->getRequestMethod() != 'JSON')
1280
+		if ($this->getRequestMethod() != 'JSON')
1281 1281
 		{
1282 1282
 			return;
1283 1283
 		}
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 		$params = array();
1286 1286
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1287 1287
 
1288
-		foreach($params as $key => $val)
1288
+		foreach ($params as $key => $val)
1289 1289
 		{
1290 1290
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1291 1291
 		}
@@ -1298,13 +1298,13 @@  discard block
 block discarded – undo
1298 1298
 	 */
1299 1299
 	function _setXmlRpcArgument()
1300 1300
 	{
1301
-		if($this->getRequestMethod() != 'XMLRPC')
1301
+		if ($this->getRequestMethod() != 'XMLRPC')
1302 1302
 		{
1303 1303
 			return;
1304 1304
 		}
1305 1305
 
1306 1306
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1307
-		if(Security::detectingXEE($xml))
1307
+		if (Security::detectingXEE($xml))
1308 1308
 		{
1309 1309
 			header("HTTP/1.0 400 Bad Request");
1310 1310
 			exit;
@@ -1316,12 +1316,12 @@  discard block
 block discarded – undo
1316 1316
 		$params = $xml_obj->methodcall->params;
1317 1317
 		unset($params->node_name, $params->attrs, $params->body);
1318 1318
 
1319
-		if(!count(get_object_vars($params)))
1319
+		if (!count(get_object_vars($params)))
1320 1320
 		{
1321 1321
 			return;
1322 1322
 		}
1323 1323
 
1324
-		foreach($params as $key => $val)
1324
+		foreach ($params as $key => $val)
1325 1325
 		{
1326 1326
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1327 1327
 		}
@@ -1336,10 +1336,10 @@  discard block
 block discarded – undo
1336 1336
 	 */
1337 1337
 	function _filterXmlVars($key, $val)
1338 1338
 	{
1339
-		if(is_array($val))
1339
+		if (is_array($val))
1340 1340
 		{
1341 1341
 			$stack = array();
1342
-			foreach($val as $k => $v)
1342
+			foreach ($val as $k => $v)
1343 1343
 			{
1344 1344
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1345 1345
 			}
@@ -1349,20 +1349,20 @@  discard block
 block discarded – undo
1349 1349
 
1350 1350
 		$body = $val->body;
1351 1351
 		unset($val->node_name, $val->attrs, $val->body);
1352
-		if(!count(get_object_vars($val)))
1352
+		if (!count(get_object_vars($val)))
1353 1353
 		{
1354 1354
 			return $this->_filterRequestVar($key, $body, 0);
1355 1355
 		}
1356 1356
 
1357 1357
 		$stack = new stdClass();
1358
-		foreach($val as $k => $v)
1358
+		foreach ($val as $k => $v)
1359 1359
 		{
1360 1360
 			$output = $this->_filterXmlVars($k, $v);
1361
-			if(is_object($v) && $v->attrs->type == 'array')
1361
+			if (is_object($v) && $v->attrs->type == 'array')
1362 1362
 			{
1363 1363
 				$output = array($output);
1364 1364
 			}
1365
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1365
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1366 1366
 			{
1367 1367
 				return $output;
1368 1368
 			}
@@ -1370,7 +1370,7 @@  discard block
 block discarded – undo
1370 1370
 			$stack->{$k} = $output;
1371 1371
 		}
1372 1372
 
1373
-		if(!count(get_object_vars($stack)))
1373
+		if (!count(get_object_vars($stack)))
1374 1374
 		{
1375 1375
 			return NULL;
1376 1376
 		}
@@ -1389,16 +1389,16 @@  discard block
 block discarded – undo
1389 1389
 	 */
1390 1390
 	function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false)
1391 1391
 	{
1392
-		if(!($isArray = is_array($val)))
1392
+		if (!($isArray = is_array($val)))
1393 1393
 		{
1394 1394
 			$val = array($val);
1395 1395
 		}
1396 1396
 
1397 1397
 		$result = array();
1398
-		foreach($val as $k => $v)
1398
+		foreach ($val as $k => $v)
1399 1399
 		{
1400
-			if($remove_hack && !is_array($v)) {
1401
-				if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1400
+			if ($remove_hack && !is_array($v)) {
1401
+				if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript'))
1402 1402
 				{
1403 1403
 					$result[$k] = escape($v);
1404 1404
 					continue;
@@ -1406,18 +1406,18 @@  discard block
 block discarded – undo
1406 1406
 			}
1407 1407
 
1408 1408
 			$k = htmlentities($k);
1409
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1409
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1410 1410
 			{
1411 1411
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1412 1412
 			}
1413
-			elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1413
+			elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) {
1414 1414
 				$result[$k] = escape($v, false);
1415 1415
 			}
1416
-			elseif($key === 'vid')
1416
+			elseif ($key === 'vid')
1417 1417
 			{
1418 1418
 				$result[$k] = urlencode($v);
1419 1419
 			}
1420
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1420
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1421 1421
 			{
1422 1422
 				unset($result[$k]);
1423 1423
 			}
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 			{
1426 1426
 				$result[$k] = $v;
1427 1427
 
1428
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1428
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1429 1429
 				{
1430 1430
 					if (is_array($result[$k]))
1431 1431
 					{
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 					}
1438 1438
 				}
1439 1439
 
1440
-				if(is_array($result[$k]))
1440
+				if (is_array($result[$k]))
1441 1441
 				{
1442 1442
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1443 1443
 				}
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
 					$result[$k] = trim($result[$k]);
1447 1447
 				}
1448 1448
 
1449
-				if($remove_hack)
1449
+				if ($remove_hack)
1450 1450
 				{
1451 1451
 					$result[$k] = escape($result[$k], false);
1452 1452
 				}
@@ -1474,17 +1474,17 @@  discard block
 block discarded – undo
1474 1474
 	 */
1475 1475
 	function _setUploadedArgument()
1476 1476
 	{
1477
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1477
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1478 1478
 		{
1479 1479
 			return;
1480 1480
 		}
1481 1481
 
1482
-		foreach($_FILES as $key => $val)
1482
+		foreach ($_FILES as $key => $val)
1483 1483
 		{
1484 1484
 			$tmp_name = $val['tmp_name'];
1485
-			if(!is_array($tmp_name))
1485
+			if (!is_array($tmp_name))
1486 1486
 			{
1487
-				if(!UploadFileFilter::check($tmp_name, $val['name']))
1487
+				if (!UploadFileFilter::check($tmp_name, $val['name']))
1488 1488
 				{
1489 1489
 					continue;
1490 1490
 				}
@@ -1497,7 +1497,7 @@  discard block
 block discarded – undo
1497 1497
 				$files = array();
1498 1498
 				foreach ($tmp_name as $i => $j)
1499 1499
 				{
1500
-					if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i]))
1500
+					if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i]))
1501 1501
 					{
1502 1502
 						$files = array();
1503 1503
 						unset($_FILES[$key]);
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 					$file['size'] = $val['size'][$i];
1512 1512
 					$files[] = $file;
1513 1513
 				}
1514
-				if(count($files))
1514
+				if (count($files))
1515 1515
 				{
1516 1516
 					self::set($key, $files, true);
1517 1517
 				}
@@ -1536,16 +1536,16 @@  discard block
 block discarded – undo
1536 1536
 	function getRequestUrl()
1537 1537
 	{
1538 1538
 		static $url = null;
1539
-		if(is_null($url))
1539
+		if (is_null($url))
1540 1540
 		{
1541 1541
 			$url = self::getRequestUri();
1542
-			if(count($_GET) > 0)
1542
+			if (count($_GET) > 0)
1543 1543
 			{
1544
-				foreach($_GET as $key => $val)
1544
+				foreach ($_GET as $key => $val)
1545 1545
 				{
1546
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1546
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1547 1547
 				}
1548
-				$url .= '?' . join('&', $vars);
1548
+				$url .= '?'.join('&', $vars);
1549 1549
 			}
1550 1550
 		}
1551 1551
 		return $url;
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 		$self = self::getInstance();
1561 1561
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1562 1562
 
1563
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1563
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1564 1564
 		{
1565 1565
 			unset($js_callback_func);
1566 1566
 			unset($_GET['xe_js_callback']);
@@ -1588,22 +1588,22 @@  discard block
 block discarded – undo
1588 1588
 		$self = self::getInstance();
1589 1589
 
1590 1590
 		// retrieve virtual site information
1591
-		if(is_null($site_module_info))
1591
+		if (is_null($site_module_info))
1592 1592
 		{
1593 1593
 			$site_module_info = self::get('site_module_info');
1594 1594
 		}
1595 1595
 
1596 1596
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1597
-		if($domain && isSiteID($domain))
1597
+		if ($domain && isSiteID($domain))
1598 1598
 		{
1599 1599
 			$vid = $domain;
1600 1600
 			$domain = '';
1601 1601
 		}
1602 1602
 
1603 1603
 		// If $domain, $vid are not set, use current site information
1604
-		if(!$domain && !$vid)
1604
+		if (!$domain && !$vid)
1605 1605
 		{
1606
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1606
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1607 1607
 			{
1608 1608
 				$vid = $site_module_info->domain;
1609 1609
 			}
@@ -1614,21 +1614,21 @@  discard block
 block discarded – undo
1614 1614
 		}
1615 1615
 
1616 1616
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1617
-		if($domain)
1617
+		if ($domain)
1618 1618
 		{
1619 1619
 			$domain_info = parse_url($domain);
1620
-			if(is_null($current_info))
1620
+			if (is_null($current_info))
1621 1621
 			{
1622
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1622
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1623 1623
 			}
1624
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1624
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1625 1625
 			{
1626 1626
 				unset($domain);
1627 1627
 			}
1628 1628
 			else
1629 1629
 			{
1630 1630
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1631
-				if(substr_compare($domain, '/', -1) !== 0)
1631
+				if (substr_compare($domain, '/', -1) !== 0)
1632 1632
 				{
1633 1633
 					$domain .= '/';
1634 1634
 				}
@@ -1638,41 +1638,41 @@  discard block
 block discarded – undo
1638 1638
 		$get_vars = array();
1639 1639
 
1640 1640
 		// If there is no GET variables or first argument is '' to reset variables
1641
-		if(!$self->get_vars || $args_list[0] == '')
1641
+		if (!$self->get_vars || $args_list[0] == '')
1642 1642
 		{
1643 1643
 			// rearrange args_list
1644
-			if(is_array($args_list) && $args_list[0] == '')
1644
+			if (is_array($args_list) && $args_list[0] == '')
1645 1645
 			{
1646 1646
 				array_shift($args_list);
1647 1647
 			}
1648 1648
 		}
1649
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1649
+		elseif ($_SERVER['REQUEST_METHOD'] == 'GET')
1650 1650
 		{
1651 1651
 			// Otherwise, make GET variables into array
1652 1652
 			$get_vars = get_object_vars($self->get_vars);
1653 1653
 		}
1654 1654
 		else
1655 1655
 		{
1656
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1657
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1658
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1659
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1660
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1661
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1662
-			if($get_vars['act'] == 'IS')
1656
+			if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1657
+			if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1658
+			if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1659
+			if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1660
+			if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1661
+			if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1662
+			if ($get_vars['act'] == 'IS')
1663 1663
 			{
1664
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1664
+				if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1665 1665
 			}
1666 1666
 		}
1667 1667
 
1668 1668
 		// arrange args_list
1669
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1669
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1670 1670
 		{
1671 1671
 			$key = $args_list[$i];
1672 1672
 			$val = trim($args_list[$i + 1]);
1673 1673
 
1674 1674
 			// If value is not set, remove the key
1675
-			if(!isset($val) || !strlen($val))
1675
+			if (!isset($val) || !strlen($val))
1676 1676
 			{
1677 1677
 				unset($get_vars[$key]);
1678 1678
 				continue;
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 
1684 1684
 		// remove vid, rnd
1685 1685
 		unset($get_vars['rnd']);
1686
-		if($vid)
1686
+		if ($vid)
1687 1687
 		{
1688 1688
 			$get_vars['vid'] = $vid;
1689 1689
 		}
@@ -1700,17 +1700,17 @@  discard block
 block discarded – undo
1700 1700
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1701 1701
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1702 1702
 		);
1703
-		if($act_alias[$act])
1703
+		if ($act_alias[$act])
1704 1704
 		{
1705 1705
 			$get_vars['act'] = $act_alias[$act];
1706 1706
 		}
1707 1707
 
1708 1708
 		// organize URL
1709 1709
 		$query = '';
1710
-		if(count($get_vars) > 0)
1710
+		if (count($get_vars) > 0)
1711 1711
 		{
1712 1712
 			// if using rewrite mod
1713
-			if($self->allow_rewrite)
1713
+			if ($self->allow_rewrite)
1714 1714
 			{
1715 1715
 				$var_keys = array_keys($get_vars);
1716 1716
 				sort($var_keys);
@@ -1730,8 +1730,8 @@  discard block
 block discarded – undo
1730 1730
 					'vid' => $vid,
1731 1731
 					'mid' => $mid,
1732 1732
 					'mid.vid' => "$vid/$mid",
1733
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1734
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1733
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1734
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1735 1735
 					'document_srl' => $srl,
1736 1736
 					'document_srl.mid' => "$mid/$srl",
1737 1737
 					'document_srl.vid' => "$vid/$srl",
@@ -1748,66 +1748,66 @@  discard block
 block discarded – undo
1748 1748
 				$query = $target_map[$target];
1749 1749
 			}
1750 1750
 
1751
-			if(!$query)
1751
+			if (!$query)
1752 1752
 			{
1753 1753
 				$queries = array();
1754
-				foreach($get_vars as $key => $val)
1754
+				foreach ($get_vars as $key => $val)
1755 1755
 				{
1756
-					if(is_array($val) && count($val) > 0)
1756
+					if (is_array($val) && count($val) > 0)
1757 1757
 					{
1758
-						foreach($val as $k => $v)
1758
+						foreach ($val as $k => $v)
1759 1759
 						{
1760
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1760
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1761 1761
 						}
1762 1762
 					}
1763
-					elseif(!is_array($val))
1763
+					elseif (!is_array($val))
1764 1764
 					{
1765
-						$queries[] = $key . '=' . urlencode($val);
1765
+						$queries[] = $key.'='.urlencode($val);
1766 1766
 					}
1767 1767
 				}
1768
-				if(count($queries) > 0)
1768
+				if (count($queries) > 0)
1769 1769
 				{
1770
-					$query = 'index.php?' . join('&', $queries);
1770
+					$query = 'index.php?'.join('&', $queries);
1771 1771
 				}
1772 1772
 			}
1773 1773
 		}
1774 1774
 
1775 1775
 		// If using SSL always
1776 1776
 		$_use_ssl = $self->get('_use_ssl');
1777
-		if($_use_ssl == 'always')
1777
+		if ($_use_ssl == 'always')
1778 1778
 		{
1779
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1779
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1780 1780
 			// optional SSL use
1781 1781
 		}
1782
-		elseif($_use_ssl == 'optional')
1782
+		elseif ($_use_ssl == 'optional')
1783 1783
 		{
1784 1784
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1785
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1785
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1786 1786
 			// no SSL
1787 1787
 		}
1788 1788
 		else
1789 1789
 		{
1790 1790
 			// currently on SSL but target is not based on SSL
1791
-			if($_SERVER['HTTPS'] == 'on')
1791
+			if ($_SERVER['HTTPS'] == 'on')
1792 1792
 			{
1793
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1793
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1794 1794
 			}
1795
-			else if($domain) // if $domain is set
1795
+			else if ($domain) // if $domain is set
1796 1796
 			{
1797
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1797
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1798 1798
 			}
1799 1799
 			else
1800 1800
 			{
1801
-				$query = getScriptPath() . $query;
1801
+				$query = getScriptPath().$query;
1802 1802
 			}
1803 1803
 		}
1804 1804
 
1805
-		if(!$encode)
1805
+		if (!$encode)
1806 1806
 		{
1807 1807
 			return $query;
1808 1808
 		}
1809 1809
 
1810
-		if(!$autoEncode)
1810
+		if (!$autoEncode)
1811 1811
 		{
1812 1812
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1813 1813
 		}
@@ -1816,16 +1816,16 @@  discard block
 block discarded – undo
1816 1816
 		$encode_queries = array();
1817 1817
 		$parsedUrl = parse_url($query);
1818 1818
 		parse_str($parsedUrl['query'], $output);
1819
-		foreach($output as $key => $value)
1819
+		foreach ($output as $key => $value)
1820 1820
 		{
1821
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1821
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1822 1822
 			{
1823 1823
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1824 1824
 			}
1825
-			$encode_queries[] = $key . '=' . $value;
1825
+			$encode_queries[] = $key.'='.$value;
1826 1826
 		}
1827 1827
 
1828
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1828
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1829 1829
 	}
1830 1830
 
1831 1831
 	/**
@@ -1840,17 +1840,17 @@  discard block
 block discarded – undo
1840 1840
 		static $url = array();
1841 1841
 
1842 1842
 		// Check HTTP Request
1843
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1843
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1844 1844
 		{
1845 1845
 			return;
1846 1846
 		}
1847 1847
 
1848
-		if(self::get('_use_ssl') == 'always')
1848
+		if (self::get('_use_ssl') == 'always')
1849 1849
 		{
1850 1850
 			$ssl_mode = ENFORCE_SSL;
1851 1851
 		}
1852 1852
 
1853
-		if($domain)
1853
+		if ($domain)
1854 1854
 		{
1855 1855
 			$domain_key = md5($domain);
1856 1856
 		}
@@ -1859,14 +1859,14 @@  discard block
 block discarded – undo
1859 1859
 			$domain_key = 'default';
1860 1860
 		}
1861 1861
 
1862
-		if(isset($url[$ssl_mode][$domain_key]))
1862
+		if (isset($url[$ssl_mode][$domain_key]))
1863 1863
 		{
1864 1864
 			return $url[$ssl_mode][$domain_key];
1865 1865
 		}
1866 1866
 
1867 1867
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1868 1868
 
1869
-		switch($ssl_mode)
1869
+		switch ($ssl_mode)
1870 1870
 		{
1871 1871
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1872 1872
 				break;
@@ -1876,34 +1876,34 @@  discard block
 block discarded – undo
1876 1876
 				break;
1877 1877
 		}
1878 1878
 
1879
-		if($domain)
1879
+		if ($domain)
1880 1880
 		{
1881 1881
 			$target_url = trim($domain);
1882
-			if(substr_compare($target_url, '/', -1) !== 0)
1882
+			if (substr_compare($target_url, '/', -1) !== 0)
1883 1883
 			{
1884
-				$target_url.= '/';
1884
+				$target_url .= '/';
1885 1885
 			}
1886 1886
 		}
1887 1887
 		else
1888 1888
 		{
1889
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1889
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1890 1890
 		}
1891 1891
 
1892
-		$url_info = parse_url('http://' . $target_url);
1892
+		$url_info = parse_url('http://'.$target_url);
1893 1893
 
1894
-		if($current_use_ssl != $use_ssl)
1894
+		if ($current_use_ssl != $use_ssl)
1895 1895
 		{
1896 1896
 			unset($url_info['port']);
1897 1897
 		}
1898 1898
 
1899
-		if($use_ssl)
1899
+		if ($use_ssl)
1900 1900
 		{
1901 1901
 			$port = self::get('_https_port');
1902
-			if($port && $port != 443)
1902
+			if ($port && $port != 443)
1903 1903
 			{
1904 1904
 				$url_info['port'] = $port;
1905 1905
 			}
1906
-			elseif($url_info['port'] == 443)
1906
+			elseif ($url_info['port'] == 443)
1907 1907
 			{
1908 1908
 				unset($url_info['port']);
1909 1909
 			}
@@ -1911,17 +1911,17 @@  discard block
 block discarded – undo
1911 1911
 		else
1912 1912
 		{
1913 1913
 			$port = self::get('_http_port');
1914
-			if($port && $port != 80)
1914
+			if ($port && $port != 80)
1915 1915
 			{
1916 1916
 				$url_info['port'] = $port;
1917 1917
 			}
1918
-			elseif($url_info['port'] == 80)
1918
+			elseif ($url_info['port'] == 80)
1919 1919
 			{
1920 1920
 				unset($url_info['port']);
1921 1921
 			}
1922 1922
 		}
1923 1923
 
1924
-		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']);
1924
+		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']);
1925 1925
 
1926 1926
 		return $url[$ssl_mode][$domain_key];
1927 1927
 	}
@@ -1938,16 +1938,16 @@  discard block
 block discarded – undo
1938 1938
 	{
1939 1939
 		$self = self::getInstance();
1940 1940
 		$self->context->{$key} = $val;
1941
-		if($set_to_get_vars === FALSE)
1941
+		if ($set_to_get_vars === FALSE)
1942 1942
 		{
1943 1943
 			return;
1944 1944
 		}
1945
-		if($val === NULL || $val === '')
1945
+		if ($val === NULL || $val === '')
1946 1946
 		{
1947 1947
 			unset($self->get_vars->{$key});
1948 1948
 			return;
1949 1949
 		}
1950
-		if($set_to_get_vars || $self->get_vars->{$key})
1950
+		if ($set_to_get_vars || $self->get_vars->{$key})
1951 1951
 		{
1952 1952
 			$self->get_vars->{$key} = $val;
1953 1953
 		}
@@ -1963,7 +1963,7 @@  discard block
 block discarded – undo
1963 1963
 	{
1964 1964
 		$self = self::getInstance();
1965 1965
 
1966
-		if(!isset($self->context->{$key}))
1966
+		if (!isset($self->context->{$key}))
1967 1967
 		{
1968 1968
 			return null;
1969 1969
 		}
@@ -1978,7 +1978,7 @@  discard block
 block discarded – undo
1978 1978
 	function gets()
1979 1979
 	{
1980 1980
 		$num_args = func_num_args();
1981
-		if($num_args < 1)
1981
+		if ($num_args < 1)
1982 1982
 		{
1983 1983
 			return;
1984 1984
 		}
@@ -1986,7 +1986,7 @@  discard block
 block discarded – undo
1986 1986
 
1987 1987
 		$args_list = func_get_args();
1988 1988
 		$output = new stdClass();
1989
-		foreach($args_list as $v)
1989
+		foreach ($args_list as $v)
1990 1990
 		{
1991 1991
 			$output->{$v} = $self->get($v);
1992 1992
 		}
@@ -2012,7 +2012,7 @@  discard block
 block discarded – undo
2012 2012
 	function getRequestVars()
2013 2013
 	{
2014 2014
 		$self = self::getInstance();
2015
-		if($self->get_vars)
2015
+		if ($self->get_vars)
2016 2016
 		{
2017 2017
 			return clone($self->get_vars);
2018 2018
 		}
@@ -2029,13 +2029,13 @@  discard block
 block discarded – undo
2029 2029
 	{
2030 2030
 		$self = self::getInstance();
2031 2031
 
2032
-		if(!is_readable($self->sslActionCacheFile))
2032
+		if (!is_readable($self->sslActionCacheFile))
2033 2033
 		{
2034 2034
 			$buff = '<?php if(!defined("__XE__"))exit;';
2035 2035
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2036 2036
 		}
2037 2037
 
2038
-		if(!isset($self->ssl_actions[$action]))
2038
+		if (!isset($self->ssl_actions[$action]))
2039 2039
 		{
2040 2040
 			$self->ssl_actions[$action] = 1;
2041 2041
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2053,16 +2053,16 @@  discard block
 block discarded – undo
2053 2053
 	{
2054 2054
 		$self = self::getInstance();
2055 2055
 
2056
-		if(!is_readable($self->sslActionCacheFile))
2056
+		if (!is_readable($self->sslActionCacheFile))
2057 2057
 		{
2058 2058
 			unset($self->ssl_actions);
2059 2059
 			$buff = '<?php if(!defined("__XE__"))exit;';
2060 2060
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2061 2061
 		}
2062 2062
 
2063
-		foreach($action_array as $action)
2063
+		foreach ($action_array as $action)
2064 2064
 		{
2065
-			if(!isset($self->ssl_actions[$action]))
2065
+			if (!isset($self->ssl_actions[$action]))
2066 2066
 			{
2067 2067
 				$self->ssl_actions[$action] = 1;
2068 2068
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2081,7 +2081,7 @@  discard block
 block discarded – undo
2081 2081
 	{
2082 2082
 		$self = self::getInstance();
2083 2083
 
2084
-		if($self->isExistsSSLAction($action))
2084
+		if ($self->isExistsSSLAction($action))
2085 2085
 		{
2086 2086
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2087 2087
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2098,7 +2098,7 @@  discard block
 block discarded – undo
2098 2098
 	function getSSLActions()
2099 2099
 	{
2100 2100
 		$self = self::getInstance();
2101
-		if($self->getSslStatus() == 'optional')
2101
+		if ($self->getSslStatus() == 'optional')
2102 2102
 		{
2103 2103
 			return $self->ssl_actions;
2104 2104
 		}
@@ -2125,12 +2125,12 @@  discard block
 block discarded – undo
2125 2125
 	 */
2126 2126
 	function normalizeFilePath($file)
2127 2127
 	{
2128
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2128
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2129 2129
 		{
2130
-			$file = './' . $file;
2130
+			$file = './'.$file;
2131 2131
 		}
2132 2132
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2133
-		while(strpos($file, '/../') !== FALSE)
2133
+		while (strpos($file, '/../') !== FALSE)
2134 2134
 		{
2135 2135
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2136 2136
 		}
@@ -2149,13 +2149,13 @@  discard block
 block discarded – undo
2149 2149
 	{
2150 2150
 		$file = self::normalizeFilePath($file);
2151 2151
 		$script_path = getScriptPath();
2152
-		if(strpos($file, './') === 0)
2152
+		if (strpos($file, './') === 0)
2153 2153
 		{
2154
-			$file = $script_path . substr($file, 2);
2154
+			$file = $script_path.substr($file, 2);
2155 2155
 		}
2156
-		elseif(strpos($file, '../') === 0)
2156
+		elseif (strpos($file, '../') === 0)
2157 2157
 		{
2158
-			$file = self::normalizeFilePath($script_path . $file);
2158
+			$file = self::normalizeFilePath($script_path.$file);
2159 2159
 		}
2160 2160
 
2161 2161
 		return $file;
@@ -2225,12 +2225,12 @@  discard block
 block discarded – undo
2225 2225
 	 */
2226 2226
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2227 2227
 	{
2228
-		if($isRuleset)
2228
+		if ($isRuleset)
2229 2229
 		{
2230
-			if(strpos($file, '#') !== FALSE)
2230
+			if (strpos($file, '#') !== FALSE)
2231 2231
 			{
2232 2232
 				$file = str_replace('#', '', $file);
2233
-				if(!is_readable($file))
2233
+				if (!is_readable($file))
2234 2234
 				{
2235 2235
 					$file = $autoPath;
2236 2236
 				}
@@ -2295,9 +2295,9 @@  discard block
 block discarded – undo
2295 2295
 		ksort($files);
2296 2296
 		$files = array_values($files);
2297 2297
 		$filenames = array();
2298
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2298
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2299 2299
 		{
2300
-			if(in_array($files[$i]['file'], $filenames))
2300
+			if (in_array($files[$i]['file'], $filenames))
2301 2301
 			{
2302 2302
 				unset($files[$i]);
2303 2303
 			}
@@ -2382,14 +2382,14 @@  discard block
 block discarded – undo
2382 2382
 	 */
2383 2383
 	function getJavascriptPluginInfo($pluginName)
2384 2384
 	{
2385
-		if($plugin_name == 'ui.datepicker')
2385
+		if ($plugin_name == 'ui.datepicker')
2386 2386
 		{
2387 2387
 			$plugin_name = 'ui';
2388 2388
 		}
2389 2389
 
2390
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2391
-		$info_file = $plugin_path . 'plugin.load';
2392
-		if(!is_readable($info_file))
2390
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2391
+		$info_file = $plugin_path.'plugin.load';
2392
+		if (!is_readable($info_file))
2393 2393
 		{
2394 2394
 			return;
2395 2395
 		}
@@ -2399,32 +2399,32 @@  discard block
 block discarded – undo
2399 2399
 		$result->jsList = array();
2400 2400
 		$result->cssList = array();
2401 2401
 
2402
-		foreach($list as $filename)
2402
+		foreach ($list as $filename)
2403 2403
 		{
2404 2404
 			$filename = trim($filename);
2405
-			if(!$filename)
2405
+			if (!$filename)
2406 2406
 			{
2407 2407
 				continue;
2408 2408
 			}
2409 2409
 
2410
-			if(strncasecmp('./', $filename, 2) === 0)
2410
+			if (strncasecmp('./', $filename, 2) === 0)
2411 2411
 			{
2412 2412
 				$filename = substr($filename, 2);
2413 2413
 			}
2414 2414
 
2415
-			if(substr_compare($filename, '.js', -3) === 0)
2415
+			if (substr_compare($filename, '.js', -3) === 0)
2416 2416
 			{
2417
-				$result->jsList[] = $plugin_path . $filename;
2417
+				$result->jsList[] = $plugin_path.$filename;
2418 2418
 			}
2419
-			elseif(substr_compare($filename, '.css', -4) === 0)
2419
+			elseif (substr_compare($filename, '.css', -4) === 0)
2420 2420
 			{
2421
-				$result->cssList[] = $plugin_path . $filename;
2421
+				$result->cssList[] = $plugin_path.$filename;
2422 2422
 			}
2423 2423
 		}
2424 2424
 
2425
-		if(is_dir($plugin_path . 'lang'))
2425
+		if (is_dir($plugin_path.'lang'))
2426 2426
 		{
2427
-			$result->langPath = $plugin_path . 'lang';
2427
+			$result->langPath = $plugin_path.'lang';
2428 2428
 		}
2429 2429
 
2430 2430
 		return $result;
@@ -2440,50 +2440,50 @@  discard block
 block discarded – undo
2440 2440
 		static $loaded_plugins = array();
2441 2441
 
2442 2442
 		$self = self::getInstance();
2443
-		if($plugin_name == 'ui.datepicker')
2443
+		if ($plugin_name == 'ui.datepicker')
2444 2444
 		{
2445 2445
 			$plugin_name = 'ui';
2446 2446
 		}
2447 2447
 
2448
-		if($loaded_plugins[$plugin_name])
2448
+		if ($loaded_plugins[$plugin_name])
2449 2449
 		{
2450 2450
 			return;
2451 2451
 		}
2452 2452
 		$loaded_plugins[$plugin_name] = TRUE;
2453 2453
 
2454
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2455
-		$info_file = $plugin_path . 'plugin.load';
2456
-		if(!is_readable($info_file))
2454
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2455
+		$info_file = $plugin_path.'plugin.load';
2456
+		if (!is_readable($info_file))
2457 2457
 		{
2458 2458
 			return;
2459 2459
 		}
2460 2460
 
2461 2461
 		$list = file($info_file);
2462
-		foreach($list as $filename)
2462
+		foreach ($list as $filename)
2463 2463
 		{
2464 2464
 			$filename = trim($filename);
2465
-			if(!$filename)
2465
+			if (!$filename)
2466 2466
 			{
2467 2467
 				continue;
2468 2468
 			}
2469 2469
 
2470
-			if(strncasecmp('./', $filename, 2) === 0)
2470
+			if (strncasecmp('./', $filename, 2) === 0)
2471 2471
 			{
2472 2472
 				$filename = substr($filename, 2);
2473 2473
 			}
2474
-			if(substr_compare($filename, '.js', -3) === 0)
2474
+			if (substr_compare($filename, '.js', -3) === 0)
2475 2475
 			{
2476
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2476
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2477 2477
 			}
2478
-			if(substr_compare($filename, '.css', -4) === 0)
2478
+			if (substr_compare($filename, '.css', -4) === 0)
2479 2479
 			{
2480
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2480
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2481 2481
 			}
2482 2482
 		}
2483 2483
 
2484
-		if(is_dir($plugin_path . 'lang'))
2484
+		if (is_dir($plugin_path.'lang'))
2485 2485
 		{
2486
-			$self->loadLang($plugin_path . 'lang');
2486
+			$self->loadLang($plugin_path.'lang');
2487 2487
 		}
2488 2488
 	}
2489 2489
 
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
 	function addHtmlHeader($header)
2497 2497
 	{
2498 2498
 		$self = self::getInstance();
2499
-		$self->html_header .= "\n" . $header;
2499
+		$self->html_header .= "\n".$header;
2500 2500
 	}
2501 2501
 
2502 2502
 	function clearHtmlHeader()
@@ -2548,7 +2548,7 @@  discard block
 block discarded – undo
2548 2548
 	function addBodyHeader($header)
2549 2549
 	{
2550 2550
 		$self = self::getInstance();
2551
-		$self->body_header .= "\n" . $header;
2551
+		$self->body_header .= "\n".$header;
2552 2552
 	}
2553 2553
 
2554 2554
 	/**
@@ -2570,7 +2570,7 @@  discard block
 block discarded – undo
2570 2570
 	function addHtmlFooter($footer)
2571 2571
 	{
2572 2572
 		$self = self::getInstance();
2573
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2573
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2574 2574
 	}
2575 2575
 
2576 2576
 	/**
@@ -2591,7 +2591,7 @@  discard block
 block discarded – undo
2591 2591
 	 */
2592 2592
 	function getConfigFile()
2593 2593
 	{
2594
-		return _XE_PATH_ . 'files/config/db.config.php';
2594
+		return _XE_PATH_.'files/config/db.config.php';
2595 2595
 	}
2596 2596
 
2597 2597
 	/**
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
 	 */
2602 2602
 	function getFTPConfigFile()
2603 2603
 	{
2604
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2604
+		return _XE_PATH_.'files/config/ftp.config.php';
2605 2605
 	}
2606 2606
 
2607 2607
 	/**
@@ -2653,14 +2653,14 @@  discard block
 block discarded – undo
2653 2653
 		$_path = explode('/', $path);
2654 2654
 		$_base = explode('/', $base_url);
2655 2655
 
2656
-		if(!$_base[count($_base) - 1])
2656
+		if (!$_base[count($_base) - 1])
2657 2657
 		{
2658 2658
 			array_pop($_base);
2659 2659
 		}
2660 2660
 
2661
-		foreach($_xe as $idx => $dir)
2661
+		foreach ($_xe as $idx => $dir)
2662 2662
 		{
2663
-			if($_path[0] != $dir)
2663
+			if ($_path[0] != $dir)
2664 2664
 			{
2665 2665
 				break;
2666 2666
 			}
@@ -2668,9 +2668,9 @@  discard block
 block discarded – undo
2668 2668
 		}
2669 2669
 
2670 2670
 		$idx = count($_xe) - $idx - 1;
2671
-		while($idx--)
2671
+		while ($idx--)
2672 2672
 		{
2673
-			if(count($_base) > 0)
2673
+			if (count($_base) > 0)
2674 2674
 			{
2675 2675
 				array_shift($_base);
2676 2676
 			}
@@ -2680,13 +2680,13 @@  discard block
 block discarded – undo
2680 2680
 			}
2681 2681
 		}
2682 2682
 
2683
-		if(count($_base) > 0)
2683
+		if (count($_base) > 0)
2684 2684
 		{
2685 2685
 			array_unshift($_path, join('/', $_base));
2686 2686
 		}
2687 2687
 
2688
-		$path = '/' . join('/', $_path);
2689
-		if(substr_compare($path, '/', -1) !== 0)
2688
+		$path = '/'.join('/', $_path);
2689
+		if (substr_compare($path, '/', -1) !== 0)
2690 2690
 		{
2691 2691
 			$path .= '/';
2692 2692
 		}
@@ -2701,13 +2701,13 @@  discard block
 block discarded – undo
2701 2701
 	{
2702 2702
 		$self = self::getInstance();
2703 2703
 
2704
-		if(!is_array($self->meta_tags))
2704
+		if (!is_array($self->meta_tags))
2705 2705
 		{
2706 2706
 			$self->meta_tags = array();
2707 2707
 		}
2708 2708
 
2709 2709
 		$ret = array();
2710
-		foreach($self->meta_tags as $key => $val)
2710
+		foreach ($self->meta_tags as $key => $val)
2711 2711
 		{
2712 2712
 			list($name, $is_http_equiv) = explode("\t", $key);
2713 2713
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2728 2728
 	{
2729 2729
 		$self = self::getInstance();
2730
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2730
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2731 2731
 	}
2732 2732
 
2733 2733
 }
Please login to merge, or discard this patch.
Braces   +108 added lines, -109 removed lines patch added patch discarded remove patch
@@ -230,7 +230,9 @@  discard block
 block discarded – undo
230 230
 		$this->loadDBInfo();
231 231
 		if($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if(is_array($this->db_info->sitelock_whitelist)) {
234
+				$whitelist = $this->db_info->sitelock_whitelist;
235
+			}
234 236
 
235 237
 			if(!IpFilter::filter($whitelist))
236 238
 			{
@@ -245,8 +247,7 @@  discard block
 block discarded – undo
245 247
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
246 248
 				{
247 249
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
248
-				}
249
-				else
250
+				} else
250 251
 				{
251 252
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
252 253
 				}
@@ -303,8 +304,7 @@  discard block
 block discarded – undo
303 304
 			{
304 305
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 306
 			}
306
-		}
307
-		elseif($_COOKIE['lang_type'])
307
+		} elseif($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
@@ -341,7 +341,9 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if($sess = $_POST[session_name()]) {
345
+			session_id($sess);
346
+		}
345 347
 		session_start();
346 348
 
347 349
 		// set authentication information in Context and session
@@ -394,22 +396,21 @@  discard block
 block discarded – undo
394 396
 						{
395 397
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
396 398
 						}
397
-					}
398
-					elseif($val)
399
+					} elseif($val)
399 400
 					{
400 401
 						$url[] = $key . '=' . urlencode($val);
401 402
 					}
402 403
 				}
403 404
 
404 405
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
406
-			}
407
-			else
406
+				if($url) {
407
+					$current_url .= '?' . join('&', $url);
408
+				}
409
+			} else
408 410
 			{
409 411
 				$current_url = $this->getUrl();
410 412
 			}
411
-		}
412
-		else
413
+		} else
413 414
 		{
414 415
 			$current_url = self::getRequestUri();
415 416
 		}
@@ -492,18 +493,22 @@  discard block
 block discarded – undo
492 493
 			$db_info->use_prepared_statements = 'Y';
493 494
 		}
494 495
 
495
-		if(!$db_info->time_zone)
496
-			$db_info->time_zone = date('O');
496
+		if(!$db_info->time_zone) {
497
+					$db_info->time_zone = date('O');
498
+		}
497 499
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 500
 
499
-		if($db_info->qmail_compatibility != 'Y')
500
-			$db_info->qmail_compatibility = 'N';
501
+		if($db_info->qmail_compatibility != 'Y') {
502
+					$db_info->qmail_compatibility = 'N';
503
+		}
501 504
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 505
 
503
-		if(!$db_info->use_db_session)
504
-			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
506
-			$db_info->use_ssl = 'none';
506
+		if(!$db_info->use_db_session) {
507
+					$db_info->use_db_session = 'N';
508
+		}
509
+		if(!$db_info->use_ssl) {
510
+					$db_info->use_ssl = 'none';
511
+		}
507 512
 		$this->set('_use_ssl', $db_info->use_ssl);
508 513
 
509 514
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -620,8 +625,7 @@  discard block
 block discarded – undo
620 625
 				$buff = FileHandler::readFile($orig_lang_file);
621 626
 				FileHandler::writeFile($selected_lang_file, $buff);
622 627
 				$lang_selected = self::loadLangSupported();
623
-			}
624
-			else
628
+			} else
625 629
 			{
626 630
 				$langs = file($selected_lang_file);
627 631
 				foreach($langs as $val)
@@ -680,15 +684,16 @@  discard block
 block discarded – undo
680 684
 
681 685
 				$oModuleModel = getModel('module');
682 686
 				$domain = $url_info['host'] . $url_info['path'];
683
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
687
+				if(substr_compare($domain, '/', -1) === 0) {
688
+					$domain = substr($domain, 0, -1);
689
+				}
684 690
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
685 691
 
686 692
 				if($site_info->site_srl)
687 693
 				{
688 694
 				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
689 695
 				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
690
-				}
691
-				else
696
+				} else
692 697
 				{
693 698
 					$redirect_url = $url;
694 699
 				}
@@ -697,8 +702,7 @@  discard block
 block discarded – undo
697 702
 				return FALSE;
698 703
 			}
699 704
 			// for sites requesting SSO validation
700
-		}
701
-		else
705
+		} else
702 706
 		{
703 707
 			// result handling : set session_name()
704 708
 			if($session_name = self::get('SSOID'))
@@ -715,8 +719,7 @@  discard block
 block discarded – undo
715 719
 				header('location:' . $url);
716 720
 				return FALSE;
717 721
 				// send SSO request
718
-			}
719
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
722
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720 723
 			{
721 724
 				setcookie('sso', md5(self::getRequestUri()));
722 725
 				$origin_url = self::getRequestUrl();
@@ -776,8 +779,7 @@  discard block
 block discarded – undo
776 779
 		if($self->site_title)
777 780
 		{
778 781
 			$self->site_title .= ' - ' . $site_title;
779
-		}
780
-		else
782
+		} else
781 783
 		{
782 784
 			$self->site_title = $site_title;
783 785
 		}
@@ -877,8 +879,7 @@  discard block
 block discarded – undo
877 879
 		{
878 880
 			$self->loaded_lang_files[] = $filename;
879 881
 			include($filename);
880
-		}
881
-		else
882
+		} else
882 883
 		{
883 884
 			$self->_evalxmlLang($path);
884 885
 		}
@@ -894,7 +895,9 @@  discard block
 block discarded – undo
894 895
 	{
895 896
 		global $lang;
896 897
 
897
-		if(!$path) return;
898
+		if(!$path) {
899
+			return;
900
+		}
898 901
 
899 902
 		$_path = 'eval://' . $path;
900 903
 
@@ -926,7 +929,9 @@  discard block
 block discarded – undo
926 929
 	 */
927 930
 	function _loadXmlLang($path)
928 931
 	{
929
-		if(!$path) return;
932
+		if(!$path) {
933
+			return;
934
+		}
930 935
 
931 936
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
932 937
 		return $oXmlLangParser->compile();
@@ -940,7 +945,9 @@  discard block
 block discarded – undo
940 945
 	 */
941 946
 	function _loadPhpLang($path)
942 947
 	{
943
-		if(!$path) return;
948
+		if(!$path) {
949
+			return;
950
+		}
944 951
 
945 952
 		if(substr_compare($path, '/', -1) !== 0)
946 953
 		{
@@ -1073,12 +1080,14 @@  discard block
 block discarded – undo
1073 1080
 		static $flag = TRUE;
1074 1081
 		if($charset)
1075 1082
 		{
1076
-			if(is_array($val))
1077
-				array_walk($val,'Context::checkConvertFlag',$charset);
1078
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1079
-			else $flag = FALSE;
1080
-		}
1081
-		else
1083
+			if(is_array($val)) {
1084
+							array_walk($val,'Context::checkConvertFlag',$charset);
1085
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1086
+				$flag = FALSE;
1087
+			} else {
1088
+				$flag = FALSE;
1089
+			}
1090
+		} else
1082 1091
 		{
1083 1092
 			$return = $flag;
1084 1093
 			$flag = TRUE;
@@ -1100,8 +1109,9 @@  discard block
 block discarded – undo
1100 1109
 		if (is_array($val))
1101 1110
 		{
1102 1111
 			array_walk($val,'Context::doConvertEncoding',$charset);
1112
+		} else {
1113
+			$val = iconv($charset,'UTF-8',$val);
1103 1114
 		}
1104
-		else $val = iconv($charset,'UTF-8',$val);
1105 1115
 	}
1106 1116
 
1107 1117
 	/**
@@ -1112,7 +1122,9 @@  discard block
 block discarded – undo
1112 1122
 	 */
1113 1123
 	function convertEncodingStr($str)
1114 1124
 	{
1115
-        if(!$str) return null;
1125
+        if(!$str) {
1126
+        	return null;
1127
+        }
1116 1128
 		$obj = new stdClass();
1117 1129
 		$obj->str = $str;
1118 1130
 		$obj = self::convertEncoding($obj);
@@ -1225,16 +1237,13 @@  discard block
 block discarded – undo
1225 1237
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1226 1238
 			{
1227 1239
 				$set_to_vars = TRUE;
1228
-			}
1229
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1240
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1230 1241
 			{
1231 1242
 				$set_to_vars = TRUE;
1232
-			}
1233
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1243
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1234 1244
 			{
1235 1245
 				$set_to_vars = TRUE;
1236
-			}
1237
-			else
1246
+			} else
1238 1247
 			{
1239 1248
 				$set_to_vars = FALSE;
1240 1249
 			}
@@ -1260,8 +1269,7 @@  discard block
 block discarded – undo
1260 1269
 					return;
1261 1270
 				}
1262 1271
 			}
1263
-		}
1264
-		else if(is_array($val))
1272
+		} else if(is_array($val))
1265 1273
 		{
1266 1274
 			foreach($val as $val2)
1267 1275
 			{
@@ -1409,19 +1417,15 @@  discard block
 block discarded – undo
1409 1417
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1410 1418
 			{
1411 1419
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1412
-			}
1413
-			elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1420
+			} elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) {
1414 1421
 				$result[$k] = escape($v, false);
1415
-			}
1416
-			elseif($key === 'vid')
1422
+			} elseif($key === 'vid')
1417 1423
 			{
1418 1424
 				$result[$k] = urlencode($v);
1419
-			}
1420
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1425
+			} elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1421 1426
 			{
1422 1427
 				unset($result[$k]);
1423
-			}
1424
-			else
1428
+			} else
1425 1429
 			{
1426 1430
 				$result[$k] = $v;
1427 1431
 
@@ -1430,8 +1434,7 @@  discard block
 block discarded – undo
1430 1434
 					if (is_array($result[$k]))
1431 1435
 					{
1432 1436
 						array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); });
1433
-					}
1434
-					else
1437
+					} else
1435 1438
 					{
1436 1439
 						$result[$k] = stripslashes($result[$k]);
1437 1440
 					}
@@ -1440,8 +1443,7 @@  discard block
 block discarded – undo
1440 1443
 				if(is_array($result[$k]))
1441 1444
 				{
1442 1445
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1443
-				}
1444
-				else
1446
+				} else
1445 1447
 				{
1446 1448
 					$result[$k] = trim($result[$k]);
1447 1449
 				}
@@ -1491,8 +1493,7 @@  discard block
 block discarded – undo
1491 1493
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1492 1494
 				$this->set($key, $val, TRUE);
1493 1495
 				$this->is_uploaded = TRUE;
1494
-			}
1495
-			else
1496
+			} else
1496 1497
 			{
1497 1498
 				$files = array();
1498 1499
 				foreach ($tmp_name as $i => $j)
@@ -1606,8 +1607,7 @@  discard block
 block discarded – undo
1606 1607
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1607 1608
 			{
1608 1609
 				$vid = $site_module_info->domain;
1609
-			}
1610
-			else
1610
+			} else
1611 1611
 			{
1612 1612
 				$domain = $site_module_info->domain;
1613 1613
 			}
@@ -1624,8 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1625 1625
 			{
1626 1626
 				unset($domain);
1627
-			}
1628
-			else
1627
+			} else
1629 1628
 			{
1630 1629
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1631 1630
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1645,23 +1644,35 @@  discard block
 block discarded – undo
1645 1644
 			{
1646 1645
 				array_shift($args_list);
1647 1646
 			}
1648
-		}
1649
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1647
+		} elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1650 1648
 		{
1651 1649
 			// Otherwise, make GET variables into array
1652 1650
 			$get_vars = get_object_vars($self->get_vars);
1653
-		}
1654
-		else
1651
+		} else
1655 1652
 		{
1656
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1657
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1658
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1659
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1660
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1661
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1653
+			if(!!$self->get_vars->module) {
1654
+				$get_vars['module'] = $self->get_vars->module;
1655
+			}
1656
+			if(!!$self->get_vars->mid) {
1657
+				$get_vars['mid'] = $self->get_vars->mid;
1658
+			}
1659
+			if(!!$self->get_vars->act) {
1660
+				$get_vars['act'] = $self->get_vars->act;
1661
+			}
1662
+			if(!!$self->get_vars->page) {
1663
+				$get_vars['page'] = $self->get_vars->page;
1664
+			}
1665
+			if(!!$self->get_vars->search_target) {
1666
+				$get_vars['search_target'] = $self->get_vars->search_target;
1667
+			}
1668
+			if(!!$self->get_vars->search_keyword) {
1669
+				$get_vars['search_keyword'] = $self->get_vars->search_keyword;
1670
+			}
1662 1671
 			if($get_vars['act'] == 'IS')
1663 1672
 			{
1664
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1673
+				if(!!$self->get_vars->is_keyword) {
1674
+					$get_vars['is_keyword'] = $self->get_vars->is_keyword;
1675
+				}
1665 1676
 			}
1666 1677
 		}
1667 1678
 
@@ -1686,8 +1697,7 @@  discard block
 block discarded – undo
1686 1697
 		if($vid)
1687 1698
 		{
1688 1699
 			$get_vars['vid'] = $vid;
1689
-		}
1690
-		else
1700
+		} else
1691 1701
 		{
1692 1702
 			unset($get_vars['vid']);
1693 1703
 		}
@@ -1759,8 +1769,7 @@  discard block
 block discarded – undo
1759 1769
 						{
1760 1770
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1761 1771
 						}
1762
-					}
1763
-					elseif(!is_array($val))
1772
+					} elseif(!is_array($val))
1764 1773
 					{
1765 1774
 						$queries[] = $key . '=' . urlencode($val);
1766 1775
 					}
@@ -1778,25 +1787,23 @@  discard block
 block discarded – undo
1778 1787
 		{
1779 1788
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1780 1789
 			// optional SSL use
1781
-		}
1782
-		elseif($_use_ssl == 'optional')
1790
+		} elseif($_use_ssl == 'optional')
1783 1791
 		{
1784 1792
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1785 1793
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1786 1794
 			// no SSL
1787
-		}
1788
-		else
1795
+		} else
1789 1796
 		{
1790 1797
 			// currently on SSL but target is not based on SSL
1791 1798
 			if($_SERVER['HTTPS'] == 'on')
1792 1799
 			{
1793 1800
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1794
-			}
1795
-			else if($domain) // if $domain is set
1801
+			} else if($domain) {
1802
+				// if $domain is set
1796 1803
 			{
1797 1804
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1798 1805
 			}
1799
-			else
1806
+			} else
1800 1807
 			{
1801 1808
 				$query = getScriptPath() . $query;
1802 1809
 			}
@@ -1853,8 +1860,7 @@  discard block
 block discarded – undo
1853 1860
 		if($domain)
1854 1861
 		{
1855 1862
 			$domain_key = md5($domain);
1856
-		}
1857
-		else
1863
+		} else
1858 1864
 		{
1859 1865
 			$domain_key = 'default';
1860 1866
 		}
@@ -1883,8 +1889,7 @@  discard block
 block discarded – undo
1883 1889
 			{
1884 1890
 				$target_url.= '/';
1885 1891
 			}
1886
-		}
1887
-		else
1892
+		} else
1888 1893
 		{
1889 1894
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1890 1895
 		}
@@ -1902,20 +1907,17 @@  discard block
 block discarded – undo
1902 1907
 			if($port && $port != 443)
1903 1908
 			{
1904 1909
 				$url_info['port'] = $port;
1905
-			}
1906
-			elseif($url_info['port'] == 443)
1910
+			} elseif($url_info['port'] == 443)
1907 1911
 			{
1908 1912
 				unset($url_info['port']);
1909 1913
 			}
1910
-		}
1911
-		else
1914
+		} else
1912 1915
 		{
1913 1916
 			$port = self::get('_http_port');
1914 1917
 			if($port && $port != 80)
1915 1918
 			{
1916 1919
 				$url_info['port'] = $port;
1917
-			}
1918
-			elseif($url_info['port'] == 80)
1920
+			} elseif($url_info['port'] == 80)
1919 1921
 			{
1920 1922
 				unset($url_info['port']);
1921 1923
 			}
@@ -2152,8 +2154,7 @@  discard block
 block discarded – undo
2152 2154
 		if(strpos($file, './') === 0)
2153 2155
 		{
2154 2156
 			$file = $script_path . substr($file, 2);
2155
-		}
2156
-		elseif(strpos($file, '../') === 0)
2157
+		} elseif(strpos($file, '../') === 0)
2157 2158
 		{
2158 2159
 			$file = self::normalizeFilePath($script_path . $file);
2159 2160
 		}
@@ -2415,8 +2416,7 @@  discard block
 block discarded – undo
2415 2416
 			if(substr_compare($filename, '.js', -3) === 0)
2416 2417
 			{
2417 2418
 				$result->jsList[] = $plugin_path . $filename;
2418
-			}
2419
-			elseif(substr_compare($filename, '.css', -4) === 0)
2419
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2420 2420
 			{
2421 2421
 				$result->cssList[] = $plugin_path . $filename;
2422 2422
 			}
@@ -2673,8 +2673,7 @@  discard block
 block discarded – undo
2673 2673
 			if(count($_base) > 0)
2674 2674
 			{
2675 2675
 				array_shift($_base);
2676
-			}
2677
-			else
2676
+			} else
2678 2677
 			{
2679 2678
 				array_unshift($_base, '..');
2680 2679
 			}
Please login to merge, or discard this patch.
config/func.inc.php 3 patches
Doc Comments   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  * @param string $module_name The module name to get a instance
75 75
  * @param string $type disp, proc, controller, class
76 76
  * @param string $kind admin, null
77
- * @return mixed Module instance
77
+ * @return ModuleObject Module instance
78 78
  */
79 79
 function getModule($module_name, $type = 'view', $kind = '')
80 80
 {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
  * Create a controller instance of the module
86 86
  *
87 87
  * @param string $module_name The module name to get a controller instance
88
- * @return mixed Module controller instance
88
+ * @return ModuleObject Module controller instance
89 89
  */
90 90
 function getController($module_name)
91 91
 {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
  * Create a admin controller instance of the module
97 97
  *
98 98
  * @param string $module_name The module name to get a admin controller instance
99
- * @return mixed Module admin controller instance
99
+ * @return ModuleObject Module admin controller instance
100 100
  */
101 101
 function getAdminController($module_name)
102 102
 {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
  * Create a view instance of the module
108 108
  *
109 109
  * @param string $module_name The module name to get a view instance
110
- * @return mixed Module view instance
110
+ * @return ModuleObject Module view instance
111 111
  */
112 112
 function getView($module_name)
113 113
 {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
  * Create a mobile instance of the module
119 119
  *
120 120
  * @param string $module_name The module name to get a mobile instance
121
- * @return mixed Module mobile instance
121
+ * @return ModuleObject Module mobile instance
122 122
  */
123 123
 function &getMobile($module_name)
124 124
 {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * Create a admin view instance of the module
130 130
  *
131 131
  * @param string $module_name The module name to get a admin view instance
132
- * @return mixed Module admin view instance
132
+ * @return ModuleObject Module admin view instance
133 133
  */
134 134
 function getAdminView($module_name)
135 135
 {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
  * Create a model instance of the module
141 141
  *
142 142
  * @param string $module_name The module name to get a model instance
143
- * @return mixed Module model instance
143
+ * @return ModuleObject Module model instance
144 144
  */
145 145
 function getModel($module_name)
146 146
 {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  * Create an admin model instance of the module
152 152
  *
153 153
  * @param string $module_name The module name to get a admin model instance
154
- * @return mixed Module admin model instance
154
+ * @return ModuleObject Module admin model instance
155 155
  */
156 156
 function getAdminModel($module_name)
157 157
 {
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
  * Create an api instance of the module
163 163
  *
164 164
  * @param string $module_name The module name to get a api instance
165
- * @return mixed Module api class instance
165
+ * @return ModuleObject Module api class instance
166 166
  */
167 167
 function getAPI($module_name)
168 168
 {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  * Create a wap instance of the module
174 174
  *
175 175
  * @param string $module_name The module name to get a wap instance
176
- * @return mixed Module wap class instance
176
+ * @return ModuleObject Module wap class instance
177 177
  */
178 178
 function getWAP($module_name)
179 179
 {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
  * Create a class instance of the module
185 185
  *
186 186
  * @param string $module_name The module name to get a class instance
187
- * @return mixed Module class instance
187
+ * @return ModuleObject Module class instance
188 188
  */
189 189
 function getClass($module_name)
190 190
 {
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
  * Return if domain of the virtual site is url type or id type
491 491
  *
492 492
  * @param string $domain
493
- * @return bool
493
+ * @return integer
494 494
  */
495 495
 function isSiteID($domain)
496 496
 {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 /**
560 560
  * Get a time gap between server's timezone and XE's timezone
561 561
  *
562
- * @return int
562
+ * @return double
563 563
  */
564 564
 function zgap()
565 565
 {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
  * Display $buff contents into the file ./files/_debug_message.php.
798 798
  * You can see the file on your prompt by command: tail-f./files/_debug_message.php
799 799
  *
800
- * @param mixed $debug_output Target object to be printed
800
+ * @param string $debug_output Target object to be printed
801 801
  * @param bool $display_option boolean Flag whether to print seperator (default:true)
802 802
  * @param string $file Target file name
803 803
  * @return void
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 /**
905 905
  * @param string $type query, trigger
906 906
  * @param float $elapsed_time
907
- * @param object $obj
907
+ * @param stdClass $obj
908 908
  */
909 909
 function writeSlowlog($type, $elapsed_time, $obj)
910 910
 {
@@ -1685,6 +1685,9 @@  discard block
 block discarded – undo
1685 1685
 	}
1686 1686
 }
1687 1687
 
1688
+/**
1689
+ * @param string $key
1690
+ */
1688 1691
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1689 1692
 {
1690 1693
 	if($requestKey != $dbKey)
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
  *
7 7
  * @author NAVER ([email protected])
8 8
  */
9
-if(!defined('__XE__'))
9
+if (!defined('__XE__'))
10 10
 {
11 11
 	exit();
12 12
 }
13 13
 
14 14
 // define an empty function to avoid errors when iconv function doesn't exist
15
-if(!function_exists('iconv'))
15
+if (!function_exists('iconv'))
16 16
 {
17 17
 	eval('
18 18
 		function iconv($in_charset, $out_charset, $str)
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 {
221 221
 	$oDB = DB::getInstance();
222 222
 	$output = $oDB->executeQuery($query_id, $args, $arg_columns);
223
-	if(!is_array($output->data) && count($output->data) > 0)
223
+	if (!is_array($output->data) && count($output->data) > 0)
224 224
 	{
225 225
 		$output->data = array($output->data);
226 226
 	}
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 function setUserSequence($seq)
251 251
 {
252 252
 	$arr_seq = array();
253
-	if(isset($_SESSION['seq']))
253
+	if (isset($_SESSION['seq']))
254 254
 	{
255
-		if(!is_array($_SESSION['seq'])) {
255
+		if (!is_array($_SESSION['seq'])) {
256 256
 			$_SESSION['seq'] = array($_SESSION['seq']);
257 257
 		}
258 258
 		$arr_seq = $_SESSION['seq'];
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function checkUserSequence($seq)
271 271
 {
272
-	if(!isset($_SESSION['seq']))
272
+	if (!isset($_SESSION['seq']))
273 273
 	{
274 274
 		return false;
275 275
 	}
276
-	if(!in_array($seq, $_SESSION['seq']))
276
+	if (!in_array($seq, $_SESSION['seq']))
277 277
 	{
278 278
 		return false;
279 279
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	$num_args = func_num_args();
300 300
 	$args_list = func_get_args();
301 301
 
302
-	if($num_args)
302
+	if ($num_args)
303 303
 		$url = Context::getUrl($num_args, $args_list);
304 304
 	else
305 305
 		$url = Context::getRequestUri();
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	$num_args = func_num_args();
319 319
 	$args_list = func_get_args();
320 320
 
321
-	if($num_args)
321
+	if ($num_args)
322 322
 	{
323 323
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
324 324
 	}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	$num_args = func_num_args();
342 342
 	$args_list = func_get_args();
343 343
 
344
-	if($num_args)
344
+	if ($num_args)
345 345
 	{
346 346
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
347 347
 	}
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
 	$num_args = func_num_args();
364 364
 	$args_list = func_get_args();
365 365
 	$request_uri = Context::getRequestUri();
366
-	if(!$num_args)
366
+	if (!$num_args)
367 367
 	{
368 368
 		return $request_uri;
369 369
 	}
370 370
 
371 371
 	$url = Context::getUrl($num_args, $args_list);
372
-	if(strncasecmp('http', $url, 4) !== 0)
372
+	if (strncasecmp('http', $url, 4) !== 0)
373 373
 	{
374 374
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
375
-		return substr($match[0], 0, -1) . $url;
375
+		return substr($match[0], 0, -1).$url;
376 376
 	}
377 377
 	return $url;
378 378
 }
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
 	$num_args = func_num_args();
388 388
 	$args_list = func_get_args();
389 389
 	$request_uri = Context::getRequestUri();
390
-	if(!$num_args)
390
+	if (!$num_args)
391 391
 	{
392 392
 		return $request_uri;
393 393
 	}
394 394
 
395 395
 	$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
396
-	if(strncasecmp('http', $url, 4) !== 0)
396
+	if (strncasecmp('http', $url, 4) !== 0)
397 397
 	{
398 398
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
399 399
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
400
-		return substr($match[0], 0, -1) . $url;
400
+		return substr($match[0], 0, -1).$url;
401 401
 	}
402 402
 	return $url;
403 403
 }
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 	$num_args = func_num_args();
414 414
 	$args_list = func_get_args();
415 415
 
416
-	if(!$num_args)
416
+	if (!$num_args)
417 417
 	{
418 418
 		return Context::getRequestUri();
419 419
 	}
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 	$num_args = func_num_args();
436 436
 	$args_list = func_get_args();
437 437
 
438
-	if(!$num_args)
438
+	if (!$num_args)
439 439
 	{
440 440
 		return Context::getRequestUri();
441 441
 	}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	$args_list = func_get_args();
458 458
 
459 459
 	$request_uri = Context::getRequestUri();
460
-	if(!$num_args)
460
+	if (!$num_args)
461 461
 	{
462 462
 		return $request_uri;
463 463
 	}
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	$num_args = count($args_list);
467 467
 
468 468
 	$url = Context::getUrl($num_args, $args_list, $domain);
469
-	if(strncasecmp('http', $url, 4) !== 0)
469
+	if (strncasecmp('http', $url, 4) !== 0)
470 470
 	{
471 471
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
472
-		return substr($match[0], 0, -1) . $url;
472
+		return substr($match[0], 0, -1).$url;
473 473
 	}
474 474
 	return $url;
475 475
 }
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 function getCurrentPageUrl()
483 483
 {
484 484
 	$protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
485
-	$url = $protocol . $_SERVER['HTTP_HOST'] . preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']);
485
+	$url = $protocol.$_SERVER['HTTP_HOST'].preg_replace('/[<>"]/', '', $_SERVER['REQUEST_URI']);
486 486
 	return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);
487 487
 }
488 488
 
@@ -507,12 +507,12 @@  discard block
 block discarded – undo
507 507
  */
508 508
 function cut_str($string, $cut_size = 0, $tail = '...')
509 509
 {
510
-	if($cut_size < 1 || !$string)
510
+	if ($cut_size < 1 || !$string)
511 511
 	{
512 512
 		return $string;
513 513
 	}
514 514
 
515
-	if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth'))
515
+	if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth'))
516 516
 	{
517 517
 		$GLOBALS['use_mb_strimwidth'] = TRUE;
518 518
 		return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8');
@@ -526,16 +526,16 @@  discard block
 block discarded – undo
526 526
 	$char_count = 0;
527 527
 
528 528
 	$idx = 0;
529
-	while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
529
+	while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
530 530
 	{
531 531
 		$c = ord(substr($string, $idx, 1));
532 532
 		$char_count++;
533
-		if($c < 128)
533
+		if ($c < 128)
534 534
 		{
535 535
 			$char_width += (int) $chars[$c - 32];
536 536
 			$idx++;
537 537
 		}
538
-		else if(191 < $c && $c < 224)
538
+		else if (191 < $c && $c < 224)
539 539
 		{
540 540
 			$char_width += $chars[4];
541 541
 			$idx += 2;
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 	}
549 549
 
550 550
 	$output = substr($string, 0, $idx);
551
-	if(strlen($output) < $string_length)
551
+	if (strlen($output) < $string_length)
552 552
 	{
553 553
 		$output .= $tail;
554 554
 	}
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 function zgap()
565 565
 {
566 566
 	$time_zone = $GLOBALS['_time_zone'];
567
-	if($time_zone < 0)
567
+	if ($time_zone < 0)
568 568
 	{
569 569
 		$to = -1;
570 570
 	}
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	$t_min = substr($time_zone, 3, 2) * $to;
578 578
 
579 579
 	$server_time_zone = date("O");
580
-	if($server_time_zone < 0)
580
+	if ($server_time_zone < 0)
581 581
 	{
582 582
 		$so = -1;
583 583
 	}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
  */
605 605
 function ztime($str)
606 606
 {
607
-	if(!$str)
607
+	if (!$str)
608 608
 	{
609 609
 		return;
610 610
 	}
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 	$year = (int) substr($str, 0, 4);
620 620
 	$month = (int) substr($str, 4, 2);
621 621
 	$day = (int) substr($str, 6, 2);
622
-	if(strlen($str) <= 8)
622
+	if (strlen($str) <= 8)
623 623
 	{
624 624
 		$gap = 0;
625 625
 	}
@@ -643,19 +643,19 @@  discard block
 block discarded – undo
643 643
 	$gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);
644 644
 
645 645
 	$lang_time_gap = Context::getLang('time_gap');
646
-	if($gap < 60)
646
+	if ($gap < 60)
647 647
 	{
648 648
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
649 649
 	}
650
-	elseif($gap < 60 * 60)
650
+	elseif ($gap < 60 * 60)
651 651
 	{
652 652
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
653 653
 	}
654
-	elseif($gap < 60 * 60 * 2)
654
+	elseif ($gap < 60 * 60 * 2)
655 655
 	{
656 656
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
657 657
 	}
658
-	elseif($gap < 60 * 60 * 24)
658
+	elseif ($gap < 60 * 60 * 24)
659 659
 	{
660 660
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
661 661
 	}
@@ -692,40 +692,40 @@  discard block
 block discarded – undo
692 692
 function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
693 693
 {
694 694
 	// return null if no target time is specified
695
-	if(!$str)
695
+	if (!$str)
696 696
 	{
697 697
 		return;
698 698
 	}
699 699
 	// convert the date format according to the language
700
-	if($conversion == TRUE)
700
+	if ($conversion == TRUE)
701 701
 	{
702
-		switch(Context::getLangType())
702
+		switch (Context::getLangType())
703 703
 		{
704 704
 			case 'en' :
705 705
 			case 'es' :
706
-				if($format == 'Y-m-d')
706
+				if ($format == 'Y-m-d')
707 707
 				{
708 708
 					$format = 'M d, Y';
709 709
 				}
710
-				elseif($format == 'Y-m-d H:i:s')
710
+				elseif ($format == 'Y-m-d H:i:s')
711 711
 				{
712 712
 					$format = 'M d, Y H:i:s';
713 713
 				}
714
-				elseif($format == 'Y-m-d H:i')
714
+				elseif ($format == 'Y-m-d H:i')
715 715
 				{
716 716
 					$format = 'M d, Y H:i';
717 717
 				}
718 718
 				break;
719 719
 			case 'vi' :
720
-				if($format == 'Y-m-d')
720
+				if ($format == 'Y-m-d')
721 721
 				{
722 722
 					$format = 'd-m-Y';
723 723
 				}
724
-				elseif($format == 'Y-m-d H:i:s')
724
+				elseif ($format == 'Y-m-d H:i:s')
725 725
 				{
726 726
 					$format = 'H:i:s d-m-Y';
727 727
 				}
728
-				elseif($format == 'Y-m-d H:i')
728
+				elseif ($format == 'Y-m-d H:i')
729 729
 				{
730 730
 					$format = 'H:i d-m-Y';
731 731
 				}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 	}
735 735
 
736 736
 	// If year value is less than 1970, handle it separately.
737
-	if((int) substr($str, 0, 4) < 1970)
737
+	if ((int) substr($str, 0, 4) < 1970)
738 738
 	{
739 739
 		$hour = (int) substr($str, 8, 2);
740 740
 		$min = (int) substr($str, 10, 2);
@@ -784,9 +784,9 @@  discard block
 block discarded – undo
784 784
 function getEncodeEmailAddress($email)
785 785
 {
786 786
 	$return = '';
787
-	for($i = 0, $c = strlen($email); $i < $c; $i++)
787
+	for ($i = 0, $c = strlen($email); $i < $c; $i++)
788 788
 	{
789
-		$return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';';
789
+		$return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';';
790 790
 	}
791 791
 	return $return;
792 792
 }
@@ -806,25 +806,25 @@  discard block
 block discarded – undo
806 806
 {
807 807
 	static $debug_file;
808 808
 
809
-	if(!(__DEBUG__ & 1))
809
+	if (!(__DEBUG__ & 1))
810 810
 	{
811 811
 		return;
812 812
 	}
813 813
 
814 814
 	static $firephp;
815 815
 	$bt = debug_backtrace();
816
-	if(is_array($bt))
816
+	if (is_array($bt))
817 817
 	{
818 818
 		$bt_debug_print = array_shift($bt);
819 819
 		$bt_called_function = array_shift($bt);
820 820
 	}
821 821
 	$file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);
822 822
 	$line_num = $bt_debug_print['line'];
823
-	$function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];
823
+	$function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function'];
824 824
 
825
-	if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
825
+	if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
826 826
 	{
827
-		if(!isset($firephp))
827
+		if (!isset($firephp))
828 828
 		{
829 829
 			$firephp = FirePHP::getInstance(TRUE);
830 830
 		}
@@ -833,16 +833,16 @@  discard block
 block discarded – undo
833 833
 		$label = sprintf('[%s:%d] %s() (Memory usage: current=%s, peak=%s)', $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()), FileHandler::filesize(memory_get_peak_usage()));
834 834
 
835 835
 		// Check a FirePHP option
836
-		if($display_option === 'TABLE')
836
+		if ($display_option === 'TABLE')
837 837
 		{
838 838
 			$label = $display_option;
839 839
 		}
840
-		if($display_option === 'ERROR')
840
+		if ($display_option === 'ERROR')
841 841
 		{
842 842
 			$type = $display_option;
843 843
 		}
844 844
 		// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
845
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
845
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
846 846
 		{
847 847
 			$debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
848 848
 			$label = NULL;
@@ -852,52 +852,52 @@  discard block
 block discarded – undo
852 852
 	}
853 853
 	else
854 854
 	{
855
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
855
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
856 856
 		{
857 857
 			return;
858 858
 		}
859 859
 
860 860
 		$print = array();
861
-		if(!$debug_file)
861
+		if (!$debug_file)
862 862
 		{
863
-			$debug_file = _XE_PATH_ . 'files/' . $file;
863
+			$debug_file = _XE_PATH_.'files/'.$file;
864 864
 		}
865
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
865
+		if (!file_exists($debug_file)) $print[] = '<?php exit() ?>';
866 866
 
867
-		if($display_option === TRUE || $display_option === 'ERROR')
867
+		if ($display_option === TRUE || $display_option === 'ERROR')
868 868
 		{
869
-			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage()));;
869
+			$print[] = sprintf("[%s %s:%d] %s() - mem(%s)", date('Y-m-d H:i:s'), $file_name, $line_num, $function, FileHandler::filesize(memory_get_usage())); ;
870 870
 			$print[] = str_repeat('=', 80);
871 871
 		}
872 872
 		$type = gettype($debug_output);
873
-		if(!in_array($type, array('array', 'object', 'resource')))
873
+		if (!in_array($type, array('array', 'object', 'resource')))
874 874
 		{
875
-			if($display_option === 'ERROR')
875
+			if ($display_option === 'ERROR')
876 876
 			{
877
-				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
877
+				$print[] = 'ERROR : '.var_export($debug_output, TRUE);
878 878
 			}
879 879
 			else
880 880
 			{
881
-				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
881
+				$print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')';
882 882
 			}
883 883
 		}
884 884
 		else
885 885
 		{
886
-			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
886
+			$print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".'        ', print_r($debug_output, true)));
887 887
 		}
888 888
 		$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
889 889
 		$backtrace = debug_backtrace($backtrace_args);
890 890
 
891
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
891
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
892 892
 		{
893 893
 			array_shift($backtrace);
894 894
 		}
895
-		foreach($backtrace as $val)
895
+		foreach ($backtrace as $val)
896 896
 		{
897
-			$print[] = '        - ' . $val['file'] . ' : ' . $val['line'];
897
+			$print[] = '        - '.$val['file'].' : '.$val['line'];
898 898
 		}
899 899
 		$print[] = PHP_EOL;
900
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
900
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
901 901
 	}
902 902
 }
903 903
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
  */
909 909
 function writeSlowlog($type, $elapsed_time, $obj)
910 910
 {
911
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
911
+	if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
912 912
 
913 913
 	static $log_filename = array(
914 914
 		'query' => 'files/_slowlog_query.php',
@@ -918,47 +918,47 @@  discard block
 block discarded – undo
918 918
 	);
919 919
 	$write_file = true;
920 920
 
921
-	$log_file = _XE_PATH_ . $log_filename[$type];
921
+	$log_file = _XE_PATH_.$log_filename[$type];
922 922
 
923 923
 	$buff = array();
924 924
 	$buff[] = '<?php exit(); ?>';
925 925
 	$buff[] = date('c');
926 926
 
927
-	if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
927
+	if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
928 928
 	{
929
-		$buff[] = "\tCaller : " . $obj->caller;
930
-		$buff[] = "\tCalled : " . $obj->called;
929
+		$buff[] = "\tCaller : ".$obj->caller;
930
+		$buff[] = "\tCalled : ".$obj->called;
931 931
 	}
932
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
932
+	else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
933 933
 	{
934
-		$buff[] = "\tAddon : " . $obj->called;
935
-		$buff[] = "\tCalled position : " . $obj->caller;
934
+		$buff[] = "\tAddon : ".$obj->called;
935
+		$buff[] = "\tCalled position : ".$obj->caller;
936 936
 	}
937
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
937
+	else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
938 938
 	{
939
-		$buff[] = "\tWidget : " . $obj->called;
939
+		$buff[] = "\tWidget : ".$obj->called;
940 940
 	}
941
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
941
+	else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
942 942
 	{
943 943
 
944 944
 		$buff[] = $obj->query;
945
-		$buff[] = "\tQuery ID   : " . $obj->query_id;
946
-		$buff[] = "\tCaller     : " . $obj->caller;
947
-		$buff[] = "\tConnection : " . $obj->connection;
945
+		$buff[] = "\tQuery ID   : ".$obj->query_id;
946
+		$buff[] = "\tCaller     : ".$obj->caller;
947
+		$buff[] = "\tConnection : ".$obj->connection;
948 948
 	}
949 949
 	else
950 950
 	{
951 951
 		$write_file = false;
952 952
 	}
953 953
 
954
-	if($write_file)
954
+	if ($write_file)
955 955
 	{
956 956
 		$buff[] = sprintf("\t%0.6f sec", $elapsed_time);
957
-		$buff[] = PHP_EOL . PHP_EOL;
957
+		$buff[] = PHP_EOL.PHP_EOL;
958 958
 		file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);
959 959
 	}
960 960
 
961
-	if($type != 'query')
961
+	if ($type != 'query')
962 962
 	{
963 963
 		$trigger_args = $obj;
964 964
 		$trigger_args->_log_type = $type;
@@ -998,11 +998,11 @@  discard block
 block discarded – undo
998 998
  */
999 999
 function delObjectVars($target_obj, $del_obj)
1000 1000
 {
1001
-	if(!is_object($target_obj))
1001
+	if (!is_object($target_obj))
1002 1002
 	{
1003 1003
 		return;
1004 1004
 	}
1005
-	if(!is_object($del_obj))
1005
+	if (!is_object($del_obj))
1006 1006
 	{
1007 1007
 		return;
1008 1008
 	}
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
 
1013 1013
 	$target = array_keys($target_vars);
1014 1014
 	$del = array_keys($del_vars);
1015
-	if(!count($target) || !count($del))
1015
+	if (!count($target) || !count($del))
1016 1016
 	{
1017 1017
 		return $target_obj;
1018 1018
 	}
@@ -1020,10 +1020,10 @@  discard block
 block discarded – undo
1020 1020
 	$return_obj = new stdClass();
1021 1021
 
1022 1022
 	$target_count = count($target);
1023
-	for($i = 0; $i < $target_count; $i++)
1023
+	for ($i = 0; $i < $target_count; $i++)
1024 1024
 	{
1025 1025
 		$target_key = $target[$i];
1026
-		if(!in_array($target_key, $del))
1026
+		if (!in_array($target_key, $del))
1027 1027
 		{
1028 1028
 			$return_obj->{$target_key} = $target_obj->{$target_key};
1029 1029
 		}
@@ -1036,10 +1036,10 @@  discard block
 block discarded – undo
1036 1036
 {
1037 1037
 	$del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id');
1038 1038
 
1039
-	foreach($del_vars as $var)
1039
+	foreach ($del_vars as $var)
1040 1040
 	{
1041
-		if(is_array($vars)) unset($vars[$var]);
1042
-		else if(is_object($vars)) unset($vars->$var);
1041
+		if (is_array($vars)) unset($vars[$var]);
1042
+		else if (is_object($vars)) unset($vars->$var);
1043 1043
 	}
1044 1044
 
1045 1045
 	return $vars;
@@ -1056,12 +1056,12 @@  discard block
 block discarded – undo
1056 1056
  */
1057 1057
 function handleError($errno, $errstr, $file, $line)
1058 1058
 {
1059
-	if(!__DEBUG__)
1059
+	if (!__DEBUG__)
1060 1060
 	{
1061 1061
 		return;
1062 1062
 	}
1063 1063
 	$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
1064
-	if(!in_array($errno, $errors))
1064
+	if (!in_array($errno, $errors))
1065 1065
 	{
1066 1066
 		return;
1067 1067
 	}
@@ -1081,8 +1081,8 @@  discard block
 block discarded – undo
1081 1081
 function getNumberingPath($no, $size = 3)
1082 1082
 {
1083 1083
 	$mod = pow(10, $size);
1084
-	$output = sprintf('%0' . $size . 'd/', $no % $mod);
1085
-	if($no >= $mod)
1084
+	$output = sprintf('%0'.$size.'d/', $no % $mod);
1085
+	if ($no >= $mod)
1086 1086
 	{
1087 1087
 		$output .= getNumberingPath((int) $no / $mod, $size);
1088 1088
 	}
@@ -1102,12 +1102,12 @@  discard block
 block discarded – undo
1102 1102
 
1103 1103
 function purifierHtml(&$content)
1104 1104
 {
1105
-	require_once(_XE_PATH_ . 'classes/security/Purifier.class.php');
1105
+	require_once(_XE_PATH_.'classes/security/Purifier.class.php');
1106 1106
 	$oPurifier = Purifier::getInstance();
1107 1107
 
1108 1108
 	// @see https://github.com/xpressengine/xe-core/issues/2278
1109 1109
 	$logged_info = Context::get('logged_info');
1110
-	if($logged_info->is_admin !== 'Y') {
1110
+	if ($logged_info->is_admin !== 'Y') {
1111 1111
 		$oPurifier->setConfig('HTML.Nofollow', true);
1112 1112
 	}
1113 1113
 
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
  */
1123 1123
 function removeHackTag($content)
1124 1124
 {
1125
-	require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
1125
+	require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
1126 1126
 	$oEmbedFilter = EmbedFilter::getInstance();
1127 1127
 	$oEmbedFilter->check($content);
1128 1128
 
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
  */
1165 1165
 function checkUploadedFile($file)
1166 1166
 {
1167
-	require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php');
1167
+	require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php');
1168 1168
 	return UploadFileFilter::check($file);
1169 1169
 }
1170 1170
 
@@ -1178,13 +1178,13 @@  discard block
 block discarded – undo
1178 1178
 {
1179 1179
 	$content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content);
1180 1180
 
1181
-	if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1181
+	if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1182 1182
 	{
1183
-		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1183
+		if (($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1184 1184
 		{
1185 1185
 			$content .= '</xmp>';
1186 1186
 		}
1187
-		else if($close_xmp < $start_xmp)
1187
+		else if ($close_xmp < $start_xmp)
1188 1188
 		{
1189 1189
 			$content .= '</xmp>';
1190 1190
 		}
@@ -1204,33 +1204,33 @@  discard block
 block discarded – undo
1204 1204
 	$tag = strtolower($match[2]);
1205 1205
 
1206 1206
 	// xmp tag ?뺣━
1207
-	if($tag == 'xmp')
1207
+	if ($tag == 'xmp')
1208 1208
 	{
1209 1209
 		return "<{$match[1]}xmp>";
1210 1210
 	}
1211
-	if($match[1])
1211
+	if ($match[1])
1212 1212
 	{
1213 1213
 		return $match[0];
1214 1214
 	}
1215
-	if($match[4])
1215
+	if ($match[4])
1216 1216
 	{
1217
-		$match[4] = ' ' . $match[4];
1217
+		$match[4] = ' '.$match[4];
1218 1218
 	}
1219 1219
 
1220 1220
 	$attrs = array();
1221
-	if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1221
+	if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1222 1222
 	{
1223
-		foreach($m[1] as $idx => $name)
1223
+		foreach ($m[1] as $idx => $name)
1224 1224
 		{
1225
-			if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1225
+			if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1226 1226
 			{
1227 1227
 				continue;
1228 1228
 			}
1229 1229
 
1230
-			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00' . $n[1]) : ($n[2] + 0)); }, $m[3][$idx] . $m[4][$idx]);
1230
+			$val = preg_replace_callback('/&#(?:x([a-fA-F0-9]+)|0*(\d+));/', function($n) {return chr($n[1] ? ('0x00'.$n[1]) : ($n[2] + 0)); }, $m[3][$idx].$m[4][$idx]);
1231 1231
 			$val = preg_replace('/^\s+|[\t\n\r]+/', '', $val);
1232 1232
 
1233
-			if(preg_match('/^[a-z]+script:/i', $val))
1233
+			if (preg_match('/^[a-z]+script:/i', $val))
1234 1234
 			{
1235 1235
 				continue;
1236 1236
 			}
@@ -1241,60 +1241,60 @@  discard block
 block discarded – undo
1241 1241
 
1242 1242
 	$filter_arrts = array('style', 'src', 'href');
1243 1243
 
1244
-	if($tag === 'object') array_push($filter_arrts, 'data');
1245
-	if($tag === 'param') array_push($filter_arrts, 'value');
1244
+	if ($tag === 'object') array_push($filter_arrts, 'data');
1245
+	if ($tag === 'param') array_push($filter_arrts, 'value');
1246 1246
 
1247
-	foreach($filter_arrts as $attr)
1247
+	foreach ($filter_arrts as $attr)
1248 1248
 	{
1249
-		if(!isset($attrs[$attr])) continue;
1249
+		if (!isset($attrs[$attr])) continue;
1250 1250
 
1251 1251
 		$attr_value = rawurldecode($attrs[$attr]);
1252 1252
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
1253 1253
 		$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value);
1254
-		if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1254
+		if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1255 1255
 		{
1256 1256
 			unset($attrs[$attr]);
1257 1257
 		}
1258 1258
 	}
1259 1259
 
1260
-	if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1260
+	if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1261 1261
 	{
1262 1262
 		unset($attrs['style']);
1263 1263
 	}
1264 1264
 
1265 1265
 	$attr = array();
1266
-	foreach($attrs as $name => $val)
1266
+	foreach ($attrs as $name => $val)
1267 1267
 	{
1268
-		if($tag == 'object' || $tag == 'embed' || $tag == 'a')
1268
+		if ($tag == 'object' || $tag == 'embed' || $tag == 'a')
1269 1269
 		{
1270 1270
 			$attribute = strtolower(trim($name));
1271
-			if($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1271
+			if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1272 1272
 			{
1273
-				if(stripos($val, 'data:') === 0)
1273
+				if (stripos($val, 'data:') === 0)
1274 1274
 				{
1275 1275
 					continue;
1276 1276
 				}
1277 1277
 			}
1278 1278
 		}
1279 1279
 
1280
-		if($tag == 'img')
1280
+		if ($tag == 'img')
1281 1281
 		{
1282 1282
 			$attribute = strtolower(trim($name));
1283
-			if(stripos($val, 'data:') === 0)
1283
+			if (stripos($val, 'data:') === 0)
1284 1284
 			{
1285 1285
 				continue;
1286 1286
 			}
1287 1287
 		}
1288 1288
 		$val = str_replace('"', '&quot;', $val);
1289
-		$attr[] = $name . "=\"{$val}\"";
1289
+		$attr[] = $name."=\"{$val}\"";
1290 1290
 	}
1291
-	$attr = count($attr) ? ' ' . implode(' ', $attr) : '';
1291
+	$attr = count($attr) ? ' '.implode(' ', $attr) : '';
1292 1292
 
1293 1293
 	return "<{$match[1]}{$tag}{$attr}{$match[4]}>";
1294 1294
 }
1295 1295
 
1296 1296
 // convert hexa value to RGB
1297
-if(!function_exists('hexrgb'))
1297
+if (!function_exists('hexrgb'))
1298 1298
 {
1299 1299
 
1300 1300
 	/**
@@ -1330,9 +1330,9 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 	settype($password, "string");
1332 1332
 
1333
-	for($i = 0; $i < strlen($password); $i++)
1333
+	for ($i = 0; $i < strlen($password); $i++)
1334 1334
 	{
1335
-		if($password[$i] == ' ' || $password[$i] == '\t')
1335
+		if ($password[$i] == ' ' || $password[$i] == '\t')
1336 1336
 		{
1337 1337
 			continue;
1338 1338
 		}
@@ -1344,11 +1344,11 @@  discard block
 block discarded – undo
1344 1344
 	$result1 = sprintf("%08lx", $nr & ((1 << 31) - 1));
1345 1345
 	$result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1));
1346 1346
 
1347
-	if($result1 == '80000000')
1347
+	if ($result1 == '80000000')
1348 1348
 	{
1349 1349
 		$nr += 0x80000000;
1350 1350
 	}
1351
-	if($result2 == '80000000')
1351
+	if ($result2 == '80000000')
1352 1352
 	{
1353 1353
 		$nr2 += 0x80000000;
1354 1354
 	}
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 function getScriptPath()
1365 1365
 {
1366 1366
 	static $url = NULL;
1367
-	if($url == NULL)
1367
+	if ($url == NULL)
1368 1368
 	{
1369 1369
 		$script_path = filter_var($_SERVER['SCRIPT_NAME'], FILTER_SANITIZE_STRING);
1370 1370
 		$url = str_ireplace('/tools/', '/', preg_replace('/index.php.*/i', '', str_replace('\\', '/', $script_path)));
@@ -1395,14 +1395,14 @@  discard block
 block discarded – undo
1395 1395
 	$decodedStr = '';
1396 1396
 	$pos = 0;
1397 1397
 	$len = strlen($source);
1398
-	while($pos < $len)
1398
+	while ($pos < $len)
1399 1399
 	{
1400 1400
 		$charAt = substr($source, $pos, 1);
1401
-		if($charAt == '%')
1401
+		if ($charAt == '%')
1402 1402
 		{
1403 1403
 			$pos++;
1404 1404
 			$charAt = substr($source, $pos, 1);
1405
-			if($charAt == 'u')
1405
+			if ($charAt == 'u')
1406 1406
 			{
1407 1407
 				// we got a unicode character
1408 1408
 				$pos++;
@@ -1436,21 +1436,21 @@  discard block
 block discarded – undo
1436 1436
  */
1437 1437
 function _code2utf($num)
1438 1438
 {
1439
-	if($num < 128)
1439
+	if ($num < 128)
1440 1440
 	{
1441 1441
 		return chr($num);
1442 1442
 	}
1443
-	if($num < 2048)
1443
+	if ($num < 2048)
1444 1444
 	{
1445
-		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
1445
+		return chr(($num >> 6) + 192).chr(($num & 63) + 128);
1446 1446
 	}
1447
-	if($num < 65536)
1447
+	if ($num < 65536)
1448 1448
 	{
1449
-		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1449
+		return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1450 1450
 	}
1451
-	if($num < 2097152)
1451
+	if ($num < 2097152)
1452 1452
 	{
1453
-		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1453
+		return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1454 1454
 	}
1455 1455
 	return '';
1456 1456
 }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
  */
1466 1466
 function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)
1467 1467
 {
1468
-	if($urldecode)
1468
+	if ($urldecode)
1469 1469
 	{
1470 1470
 		$string = urldecode($string);
1471 1471
 	}
@@ -1473,12 +1473,12 @@  discard block
 block discarded – undo
1473 1473
 	$sample = iconv('utf-8', 'utf-8', $string);
1474 1474
 	$is_utf8 = (md5($sample) === md5($string));
1475 1475
 
1476
-	if(!$urldecode)
1476
+	if (!$urldecode)
1477 1477
 	{
1478 1478
 		$string = urldecode($string);
1479 1479
 	}
1480 1480
 
1481
-	if($return_convert)
1481
+	if ($return_convert)
1482 1482
 	{
1483 1483
 		return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string);
1484 1484
 	}
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
  */
1495 1495
 function json_encode2($data)
1496 1496
 {
1497
-	switch(gettype($data))
1497
+	switch (gettype($data))
1498 1498
 	{
1499 1499
 		case 'boolean':
1500 1500
 			return $data ? 'true' : 'false';
@@ -1502,15 +1502,15 @@  discard block
 block discarded – undo
1502 1502
 		case 'double':
1503 1503
 			return $data;
1504 1504
 		case 'string':
1505
-			return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"';
1505
+			return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"';
1506 1506
 		case 'object':
1507 1507
 			$data = get_object_vars($data);
1508 1508
 		case 'array':
1509 1509
 			$rel = FALSE; // relative array?
1510 1510
 			$key = array_keys($data);
1511
-			foreach($key as $v)
1511
+			foreach ($key as $v)
1512 1512
 			{
1513
-				if(!is_int($v))
1513
+				if (!is_int($v))
1514 1514
 				{
1515 1515
 					$rel = TRUE;
1516 1516
 					break;
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
 			}
1519 1519
 
1520 1520
 			$arr = array();
1521
-			foreach($data as $k => $v)
1521
+			foreach ($data as $k => $v)
1522 1522
 			{
1523
-				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v);
1523
+				$arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v);
1524 1524
 			}
1525 1525
 
1526
-			return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']';
1526
+			return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']';
1527 1527
 		default:
1528 1528
 			return '""';
1529 1529
 	}
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
  */
1538 1538
 function isCrawler($agent = NULL)
1539 1539
 {
1540
-	if(!$agent)
1540
+	if (!$agent)
1541 1541
 	{
1542 1542
 		$agent = $_SERVER['HTTP_USER_AGENT'];
1543 1543
 	}
@@ -1547,9 +1547,9 @@  discard block
 block discarded – undo
1547 1547
 		/*'211.245.21.110-211.245.21.119' mixsh is closed */
1548 1548
 	);
1549 1549
 
1550
-	foreach($check_agent as $str)
1550
+	foreach ($check_agent as $str)
1551 1551
 	{
1552
-		if(stristr($agent, $str) != FALSE)
1552
+		if (stristr($agent, $str) != FALSE)
1553 1553
 		{
1554 1554
 			return TRUE;
1555 1555
 		}
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
  */
1568 1568
 function stripEmbedTagForAdmin(&$content, $writer_member_srl)
1569 1569
 {
1570
-	if(!Context::get('is_logged'))
1570
+	if (!Context::get('is_logged'))
1571 1571
 	{
1572 1572
 		return;
1573 1573
 	}
@@ -1575,18 +1575,18 @@  discard block
 block discarded – undo
1575 1575
 	$oModuleModel = getModel('module');
1576 1576
 	$logged_info = Context::get('logged_info');
1577 1577
 
1578
-	if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1578
+	if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1579 1579
 	{
1580
-		if($writer_member_srl)
1580
+		if ($writer_member_srl)
1581 1581
 		{
1582 1582
 			$oMemberModel = getModel('member');
1583 1583
 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);
1584
-			if($member_info->is_admin == "Y")
1584
+			if ($member_info->is_admin == "Y")
1585 1585
 			{
1586 1586
 				return;
1587 1587
 			}
1588 1588
 		}
1589
-		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>" . Context::getLang('security_warning_embed') . "</p></div>";
1589
+		$security_msg = "<div style='border: 1px solid #DDD; background: #FAFAFA; text-align:center; margin: 1em 0;'><p style='margin: 1em;'>".Context::getLang('security_warning_embed')."</p></div>";
1590 1590
 		$content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content);
1591 1591
 		$content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content);
1592 1592
 		$content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content);
@@ -1603,18 +1603,18 @@  discard block
 block discarded – undo
1603 1603
 function requirePear()
1604 1604
 {
1605 1605
 	static $required = false;
1606
-	if($required)
1606
+	if ($required)
1607 1607
 	{
1608 1608
 		return;
1609 1609
 	}
1610 1610
 
1611
-	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1611
+	if (version_compare(PHP_VERSION, "5.3.0") < 0)
1612 1612
 	{
1613
-		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1613
+		set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path());
1614 1614
 	}
1615 1615
 	else
1616 1616
 	{
1617
-		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1617
+		set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path());
1618 1618
 	}
1619 1619
 
1620 1620
 	$required = true;
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
 function checkCSRF()
1624 1624
 {
1625
-	if($_SERVER['REQUEST_METHOD'] != 'POST')
1625
+	if ($_SERVER['REQUEST_METHOD'] != 'POST')
1626 1626
 	{
1627 1627
 		return FALSE;
1628 1628
 	}
@@ -1630,9 +1630,9 @@  discard block
 block discarded – undo
1630 1630
 	$default_url = Context::getDefaultUrl();
1631 1631
 	$referer = $_SERVER["HTTP_REFERER"];
1632 1632
 
1633
-	if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1633
+	if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1634 1634
 	{
1635
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1635
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1636 1636
 		$IDN = new idna_convert(array('idn_version' => 2008));
1637 1637
 		$referer = $IDN->encode($referer);
1638 1638
 	}
@@ -1643,9 +1643,9 @@  discard block
 block discarded – undo
1643 1643
 	$oModuleModel = getModel('module');
1644 1644
 	$siteModuleInfo = $oModuleModel->getDefaultMid();
1645 1645
 
1646
-	if($siteModuleInfo->site_srl == 0)
1646
+	if ($siteModuleInfo->site_srl == 0)
1647 1647
 	{
1648
-		if($default_url['host'] !== $referer['host'])
1648
+		if ($default_url['host'] !== $referer['host'])
1649 1649
 		{
1650 1650
 			return FALSE;
1651 1651
 		}
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 	else
1654 1654
 	{
1655 1655
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1656
-		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1656
+		if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1657 1657
 		{
1658 1658
 			return FALSE;
1659 1659
 		}
@@ -1669,15 +1669,15 @@  discard block
 block discarded – undo
1669 1669
  */
1670 1670
 function recurciveExposureCheck(&$menu)
1671 1671
 {
1672
-	if(is_array($menu))
1672
+	if (is_array($menu))
1673 1673
 	{
1674
-		foreach($menu AS $key=>$value)
1674
+		foreach ($menu AS $key=>$value)
1675 1675
 		{
1676
-			if(!$value['isShow'])
1676
+			if (!$value['isShow'])
1677 1677
 			{
1678 1678
 				unset($menu[$key]);
1679 1679
 			}
1680
-			if(is_array($value['list']) && count($value['list']) > 0)
1680
+			if (is_array($value['list']) && count($value['list']) > 0)
1681 1681
 			{
1682 1682
 				recurciveExposureCheck($menu[$key]['list']);
1683 1683
 			}
@@ -1687,14 +1687,14 @@  discard block
 block discarded – undo
1687 1687
 
1688 1688
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1689 1689
 {
1690
-	if($requestKey != $dbKey)
1690
+	if ($requestKey != $dbKey)
1691 1691
 	{
1692 1692
 		$arrayUrl = parse_url(Context::get('success_return_url'));
1693
-		if($arrayUrl['query'])
1693
+		if ($arrayUrl['query'])
1694 1694
 		{
1695 1695
 			parse_str($arrayUrl['query'], $parsedStr);
1696 1696
 
1697
-			if(isset($parsedStr[$key]))
1697
+			if (isset($parsedStr[$key]))
1698 1698
 			{
1699 1699
 				$parsedStr[$key] = $requestKey;
1700 1700
 				$successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);
@@ -1737,14 +1737,14 @@  discard block
 block discarded – undo
1737 1737
  */
1738 1738
 function alertScript($msg)
1739 1739
 {
1740
-	if(!$msg)
1740
+	if (!$msg)
1741 1741
 	{
1742 1742
 		return;
1743 1743
 	}
1744 1744
 
1745 1745
 	echo '<script type="text/javascript">
1746 1746
 //<![CDATA[
1747
-alert("' . $msg . '");
1747
+alert("' . $msg.'");
1748 1748
 //]]>
1749 1749
 </script>';
1750 1750
 }
@@ -1775,7 +1775,7 @@  discard block
 block discarded – undo
1775 1775
 
1776 1776
 	echo '<script type="text/javascript">
1777 1777
 //<![CDATA[
1778
-' . $reloadScript . '
1778
+' . $reloadScript.'
1779 1779
 //]]>
1780 1780
 </script>';
1781 1781
 }
@@ -1822,7 +1822,7 @@  discard block
 block discarded – undo
1822 1822
 function escape_js($str)
1823 1823
 {
1824 1824
 	$flags = JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE;
1825
-	$str = json_encode((string)$str, $flags);
1825
+	$str = json_encode((string) $str, $flags);
1826 1826
 	return substr($str, 1, strlen($str) - 2);
1827 1827
 }
1828 1828
 
@@ -1874,12 +1874,12 @@  discard block
 block discarded – undo
1874 1874
 {
1875 1875
 	if ($limit < 1) $limit = null;
1876 1876
 	$result = array();
1877
-	$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit);
1877
+	$split = preg_split('/(?<!'.preg_quote($escape_char, '/').')'.preg_quote($delimiter, '/').'/', $str, $limit);
1878 1878
 	foreach ($split as $piece)
1879 1879
 	{
1880 1880
 		if (trim($piece) !== '')
1881 1881
 		{
1882
-			$result[] = trim(str_replace($escape_char . $delimiter, $delimiter, $piece));
1882
+			$result[] = trim(str_replace($escape_char.$delimiter, $delimiter, $piece));
1883 1883
 		}
1884 1884
 	}
1885 1885
 	return $result;
Please login to merge, or discard this patch.
Braces   +56 added lines, -68 removed lines patch added patch discarded remove patch
@@ -299,10 +299,11 @@  discard block
 block discarded – undo
299 299
 	$num_args = func_num_args();
300 300
 	$args_list = func_get_args();
301 301
 
302
-	if($num_args)
303
-		$url = Context::getUrl($num_args, $args_list);
304
-	else
305
-		$url = Context::getRequestUri();
302
+	if($num_args) {
303
+			$url = Context::getUrl($num_args, $args_list);
304
+	} else {
305
+			$url = Context::getRequestUri();
306
+	}
306 307
 
307 308
 	return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url);
308 309
 }
@@ -321,8 +322,7 @@  discard block
 block discarded – undo
321 322
 	if($num_args)
322 323
 	{
323 324
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
324
-	}
325
-	else
325
+	} else
326 326
 	{
327 327
 		$url = Context::getRequestUri();
328 328
 	}
@@ -344,8 +344,7 @@  discard block
 block discarded – undo
344 344
 	if($num_args)
345 345
 	{
346 346
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
347
-	}
348
-	else
347
+	} else
349 348
 	{
350 349
 		$url = Context::getRequestUri();
351 350
 	}
@@ -534,13 +533,11 @@  discard block
 block discarded – undo
534 533
 		{
535 534
 			$char_width += (int) $chars[$c - 32];
536 535
 			$idx++;
537
-		}
538
-		else if(191 < $c && $c < 224)
536
+		} else if(191 < $c && $c < 224)
539 537
 		{
540 538
 			$char_width += $chars[4];
541 539
 			$idx += 2;
542
-		}
543
-		else
540
+		} else
544 541
 		{
545 542
 			$char_width += $chars[0];
546 543
 			$idx += 3;
@@ -567,8 +564,7 @@  discard block
 block discarded – undo
567 564
 	if($time_zone < 0)
568 565
 	{
569 566
 		$to = -1;
570
-	}
571
-	else
567
+	} else
572 568
 	{
573 569
 		$to = 1;
574 570
 	}
@@ -580,8 +576,7 @@  discard block
 block discarded – undo
580 576
 	if($server_time_zone < 0)
581 577
 	{
582 578
 		$so = -1;
583
-	}
584
-	else
579
+	} else
585 580
 	{
586 581
 		$so = 1;
587 582
 	}
@@ -622,8 +617,7 @@  discard block
 block discarded – undo
622 617
 	if(strlen($str) <= 8)
623 618
 	{
624 619
 		$gap = 0;
625
-	}
626
-	else
620
+	} else
627 621
 	{
628 622
 		$gap = zgap();
629 623
 	}
@@ -646,20 +640,16 @@  discard block
 block discarded – undo
646 640
 	if($gap < 60)
647 641
 	{
648 642
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
649
-	}
650
-	elseif($gap < 60 * 60)
643
+	} elseif($gap < 60 * 60)
651 644
 	{
652 645
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
653
-	}
654
-	elseif($gap < 60 * 60 * 2)
646
+	} elseif($gap < 60 * 60 * 2)
655 647
 	{
656 648
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
657
-	}
658
-	elseif($gap < 60 * 60 * 24)
649
+	} elseif($gap < 60 * 60 * 24)
659 650
 	{
660 651
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
661
-	}
662
-	else
652
+	} else
663 653
 	{
664 654
 		$buff = zdate($date, $format);
665 655
 	}
@@ -706,12 +696,10 @@  discard block
 block discarded – undo
706 696
 				if($format == 'Y-m-d')
707 697
 				{
708 698
 					$format = 'M d, Y';
709
-				}
710
-				elseif($format == 'Y-m-d H:i:s')
699
+				} elseif($format == 'Y-m-d H:i:s')
711 700
 				{
712 701
 					$format = 'M d, Y H:i:s';
713
-				}
714
-				elseif($format == 'Y-m-d H:i')
702
+				} elseif($format == 'Y-m-d H:i')
715 703
 				{
716 704
 					$format = 'M d, Y H:i';
717 705
 				}
@@ -720,12 +708,10 @@  discard block
 block discarded – undo
720 708
 				if($format == 'Y-m-d')
721 709
 				{
722 710
 					$format = 'd-m-Y';
723
-				}
724
-				elseif($format == 'Y-m-d H:i:s')
711
+				} elseif($format == 'Y-m-d H:i:s')
725 712
 				{
726 713
 					$format = 'H:i:s d-m-Y';
727
-				}
728
-				elseif($format == 'Y-m-d H:i')
714
+				} elseif($format == 'Y-m-d H:i')
729 715
 				{
730 716
 					$format = 'H:i d-m-Y';
731 717
 				}
@@ -761,8 +747,7 @@  discard block
 block discarded – undo
761 747
 		);
762 748
 
763 749
 		$string = strtr($format, $trans);
764
-	}
765
-	else
750
+	} else
766 751
 	{
767 752
 		// if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. 
768 753
 		$string = date($format, ztime($str));
@@ -849,8 +834,7 @@  discard block
 block discarded – undo
849 834
 		}
850 835
 
851 836
 		$firephp->fb($debug_output, $label, $type);
852
-	}
853
-	else
837
+	} else
854 838
 	{
855 839
 		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
856 840
 		{
@@ -862,7 +846,9 @@  discard block
 block discarded – undo
862 846
 		{
863 847
 			$debug_file = _XE_PATH_ . 'files/' . $file;
864 848
 		}
865
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
849
+		if(!file_exists($debug_file)) {
850
+			$print[] = '<?php exit() ?>';
851
+		}
866 852
 
867 853
 		if($display_option === TRUE || $display_option === 'ERROR')
868 854
 		{
@@ -875,13 +861,11 @@  discard block
 block discarded – undo
875 861
 			if($display_option === 'ERROR')
876 862
 			{
877 863
 				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
878
-			}
879
-			else
864
+			} else
880 865
 			{
881 866
 				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
882 867
 			}
883
-		}
884
-		else
868
+		} else
885 869
 		{
886 870
 			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
887 871
 		}
@@ -908,7 +892,9 @@  discard block
 block discarded – undo
908 892
  */
909 893
 function writeSlowlog($type, $elapsed_time, $obj)
910 894
 {
911
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
895
+	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) {
896
+		return;
897
+	}
912 898
 
913 899
 	static $log_filename = array(
914 900
 		'query' => 'files/_slowlog_query.php',
@@ -928,25 +914,21 @@  discard block
 block discarded – undo
928 914
 	{
929 915
 		$buff[] = "\tCaller : " . $obj->caller;
930 916
 		$buff[] = "\tCalled : " . $obj->called;
931
-	}
932
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
917
+	} else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
933 918
 	{
934 919
 		$buff[] = "\tAddon : " . $obj->called;
935 920
 		$buff[] = "\tCalled position : " . $obj->caller;
936
-	}
937
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
921
+	} else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
938 922
 	{
939 923
 		$buff[] = "\tWidget : " . $obj->called;
940
-	}
941
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
924
+	} else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
942 925
 	{
943 926
 
944 927
 		$buff[] = $obj->query;
945 928
 		$buff[] = "\tQuery ID   : " . $obj->query_id;
946 929
 		$buff[] = "\tCaller     : " . $obj->caller;
947 930
 		$buff[] = "\tConnection : " . $obj->connection;
948
-	}
949
-	else
931
+	} else
950 932
 	{
951 933
 		$write_file = false;
952 934
 	}
@@ -1038,8 +1020,11 @@  discard block
 block discarded – undo
1038 1020
 
1039 1021
 	foreach($del_vars as $var)
1040 1022
 	{
1041
-		if(is_array($vars)) unset($vars[$var]);
1042
-		else if(is_object($vars)) unset($vars->$var);
1023
+		if(is_array($vars)) {
1024
+			unset($vars[$var]);
1025
+		} else if(is_object($vars)) {
1026
+			unset($vars->$var);
1027
+		}
1043 1028
 	}
1044 1029
 
1045 1030
 	return $vars;
@@ -1183,8 +1168,7 @@  discard block
 block discarded – undo
1183 1168
 		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1184 1169
 		{
1185 1170
 			$content .= '</xmp>';
1186
-		}
1187
-		else if($close_xmp < $start_xmp)
1171
+		} else if($close_xmp < $start_xmp)
1188 1172
 		{
1189 1173
 			$content .= '</xmp>';
1190 1174
 		}
@@ -1241,12 +1225,18 @@  discard block
 block discarded – undo
1241 1225
 
1242 1226
 	$filter_arrts = array('style', 'src', 'href');
1243 1227
 
1244
-	if($tag === 'object') array_push($filter_arrts, 'data');
1245
-	if($tag === 'param') array_push($filter_arrts, 'value');
1228
+	if($tag === 'object') {
1229
+		array_push($filter_arrts, 'data');
1230
+	}
1231
+	if($tag === 'param') {
1232
+		array_push($filter_arrts, 'value');
1233
+	}
1246 1234
 
1247 1235
 	foreach($filter_arrts as $attr)
1248 1236
 	{
1249
-		if(!isset($attrs[$attr])) continue;
1237
+		if(!isset($attrs[$attr])) {
1238
+			continue;
1239
+		}
1250 1240
 
1251 1241
 		$attr_value = rawurldecode($attrs[$attr]);
1252 1242
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
@@ -1410,16 +1400,14 @@  discard block
 block discarded – undo
1410 1400
 				$unicode = hexdec($unicodeHexVal);
1411 1401
 				$decodedStr .= _code2utf($unicode);
1412 1402
 				$pos += 4;
1413
-			}
1414
-			else
1403
+			} else
1415 1404
 			{
1416 1405
 				// we have an escaped ascii character
1417 1406
 				$hexVal = substr($source, $pos, 2);
1418 1407
 				$decodedStr .= chr(hexdec($hexVal));
1419 1408
 				$pos += 2;
1420 1409
 			}
1421
-		}
1422
-		else
1410
+		} else
1423 1411
 		{
1424 1412
 			$decodedStr .= $charAt;
1425 1413
 			$pos++;
@@ -1611,8 +1599,7 @@  discard block
 block discarded – undo
1611 1599
 	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1612 1600
 	{
1613 1601
 		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1614
-	}
1615
-	else
1602
+	} else
1616 1603
 	{
1617 1604
 		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1618 1605
 	}
@@ -1649,8 +1636,7 @@  discard block
 block discarded – undo
1649 1636
 		{
1650 1637
 			return FALSE;
1651 1638
 		}
1652
-	}
1653
-	else
1639
+	} else
1654 1640
 	{
1655 1641
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1656 1642
 		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
@@ -1872,7 +1858,9 @@  discard block
 block discarded – undo
1872 1858
  */
1873 1859
 function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\')
1874 1860
 {
1875
-	if ($limit < 1) $limit = null;
1861
+	if ($limit < 1) {
1862
+		$limit = null;
1863
+	}
1876 1864
 	$result = array();
1877 1865
 	$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit);
1878 1866
 	foreach ($split as $piece)
Please login to merge, or discard this patch.