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
Pull Request — develop (#1958)
by
unknown
17:21
created
classes/module/ModuleHandler.class.php 2 patches
Braces   +30 added lines, -45 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@  discard block
 block discarded – undo
107 107
 		$called_position = 'before_module_init';
108 108
 		$oAddonController = getController('addon');
109 109
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc');
110
-		if(file_exists($addon_file)) include($addon_file);
110
+		if(file_exists($addon_file)) {
111
+			include($addon_file);
112
+		}
111 113
 	}
112 114
 
113 115
 	/**
@@ -160,8 +162,7 @@  discard block
 block discarded – undo
160 162
 			if(!$module_info)
161 163
 			{
162 164
 				unset($this->document_srl);
163
-			}
164
-			else
165
+			} else
165 166
 			{
166 167
 				// If it exists, compare mid based on the module information
167 168
 				// if mids are not matching, set it as the document's mid
@@ -173,8 +174,7 @@  discard block
 block discarded – undo
173 174
 						$this->mid = $module_info->mid;
174 175
 						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
175 176
 						return FALSE;
176
-					}
177
-					else
177
+					} else
178 178
 					{
179 179
 						$this->mid = $module_info->mid;
180 180
 						Context::set('mid', $this->mid);
@@ -225,15 +225,13 @@  discard block
 block discarded – undo
225 225
 				$site_info = $oModuleModel->getSiteInfo($module_info->site_srl);
226 226
 				$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'));
227 227
 				// If it's called from a virtual site, though it's not a module of the virtual site
228
-			}
229
-			else
228
+			} else
230 229
 			{
231 230
 				$db_info = Context::getDBInfo();
232 231
 				if(!$db_info->default_url)
233 232
 				{
234 233
 					return Context::getLang('msg_default_url_is_not_defined');
235
-				}
236
-				else
234
+				} else
237 235
 				{
238 236
 					$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'));
239 237
 				}
@@ -258,8 +256,7 @@  discard block
 block discarded – undo
258 256
 			{
259 257
 				$oLayoutAdminModel = getAdminModel('layout');
260 258
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
261
-			}
262
-			else
259
+			} else
263 260
 			{
264 261
 				$layoutSrl = $module_info->{$targetSrl};
265 262
 			}
@@ -386,8 +383,7 @@  discard block
 block discarded – undo
386 383
 			if(!$allowedMethod)
387 384
 			{
388 385
 				$allowedMethodList[0] = 'POST';
389
-			}
390
-			else
386
+			} else
391 387
 			{
392 388
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
393 389
 			}
@@ -445,8 +441,7 @@  discard block
 block discarded – undo
445 441
 				Mobile::setMobile(FALSE);
446 442
 				$oModule = $this->getModuleInstance($this->module, $type, $kind);
447 443
 			}
448
-		}
449
-		else
444
+		} else
450 445
 		{
451 446
 			// create a module instance
452 447
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
@@ -499,8 +494,7 @@  discard block
 block discarded – undo
499 494
 					$forward->type = $xml_info->action->{$this->act}->type;
500 495
 					$forward->ruleset = $xml_info->action->{$this->act}->ruleset;
501 496
 					$forward->act = $this->act;
502
-				}
503
-				else
497
+				} else
504 498
 				{
505 499
 					$this->error = 'msg_invalid_request';
506 500
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -536,8 +530,7 @@  discard block
 block discarded – undo
536 530
 					if(!$allowedMethod)
537 531
 					{
538 532
 						$allowedMethodList[0] = 'POST';
539
-					}
540
-					else
533
+					} else
541 534
 					{
542 535
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
543 536
 					}
@@ -565,8 +558,7 @@  discard block
 block discarded – undo
565 558
 						Mobile::setMobile(FALSE);
566 559
 						$oModule = $this->getModuleInstance($forward->module, $type, $kind);
567 560
 					}
568
-				}
569
-				else
561
+				} else
570 562
 				{
571 563
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
572 564
 				}
@@ -596,8 +588,7 @@  discard block
 block discarded – undo
596 588
 							$oModule->setLayoutPath("./modules/admin/tpl");
597 589
 							$oModule->setLayoutFile("layout.html");
598 590
 						}
599
-					}
600
-					else
591
+					} else
601 592
 					{
602 593
 						$this->_setInputErrorToContext();
603 594
 
@@ -621,8 +612,7 @@  discard block
 block discarded – undo
621 612
 						$oMessageObject->setMessage($this->error);
622 613
 						$oMessageObject->dispMessage();
623 614
 						return $oMessageObject;
624
-					}
625
-					else
615
+					} else
626 616
 					{
627 617
 						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
628 618
 						{
@@ -636,12 +626,10 @@  discard block
 block discarded – undo
636 626
 						}
637 627
 					}
638 628
 				}
639
-			}
640
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
629
+			} else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
641 630
 			{
642 631
 				$this->act = $xml_info->default_index_act;
643
-			}
644
-			else
632
+			} else
645 633
 			{
646 634
 				$this->error = 'msg_invalid_request';
647 635
 				$oModule->setError(-1);
@@ -739,7 +727,9 @@  discard block
 block discarded – undo
739 727
 			$message = $oModule->getMessage();
740 728
 			$messageType = $oModule->getMessageType();
741 729
 			$redirectUrl = $oModule->getRedirectUrl();
742
-			if($messageType == 'error') debugPrint($message, 'ERROR');
730
+			if($messageType == 'error') {
731
+				debugPrint($message, 'ERROR');
732
+			}
743 733
 
744 734
 			if(!$procResult)
745 735
 			{
@@ -749,8 +739,7 @@  discard block
 block discarded – undo
749 739
 					$redirectUrl = Context::get('error_return_url');
750 740
 				}
751 741
 				$this->_setInputValueToSession();
752
-			}
753
-			else
742
+			} else
754 743
 			{
755 744
 
756 745
 			}
@@ -898,8 +887,7 @@  discard block
 block discarded – undo
898 887
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
899 888
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
900 889
 					// Otherwise, set message instance as the target module
901
-				}
902
-				else
890
+				} else
903 891
 				{
904 892
 					$oModule = $oMessageObject;
905 893
 				}
@@ -911,8 +899,7 @@  discard block
 block discarded – undo
911 899
 			if(Mobile::isFromMobilePhone())
912 900
 			{
913 901
 				$layout_srl = $oModule->module_info->mlayout_srl;
914
-			}
915
-			else
902
+			} else
916 903
 			{
917 904
 				$layout_srl = $oModule->module_info->layout_srl;
918 905
 			}
@@ -971,8 +958,7 @@  discard block
 block discarded – undo
971 958
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
972 959
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
973 960
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
974
-								}
975
-								else
961
+								} else
976 962
 								{
977 963
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
978 964
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -1009,8 +995,7 @@  discard block
 block discarded – undo
1009 995
 				if($kind == 'admin')
1010 996
 				{
1011 997
 					$oModule->setLayoutFile('popup_layout');
1012
-				}
1013
-				else
998
+				} else
1014 999
 				{
1015 1000
 					$oModule->setLayoutPath('common/tpl');
1016 1001
 					$oModule->setLayoutFile('default_layout');
@@ -1144,13 +1129,11 @@  discard block
 block discarded – undo
1144 1129
 		{
1145 1130
 			$instanceName = '%s';
1146 1131
 			$classFile = '%s%s.%s.php';
1147
-		}
1148
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1132
+		} elseif($kind == 'admin' && array_search($type, $types) < 3)
1149 1133
 		{
1150 1134
 			$instanceName = '%sAdmin%s';
1151 1135
 			$classFile = '%s%s.admin.%s.php';
1152
-		}
1153
-		else
1136
+		} else
1154 1137
 		{
1155 1138
 			$instanceName = '%s%s';
1156 1139
 			$classFile = '%s%s.%s.php';
@@ -1213,7 +1196,9 @@  discard block
 block discarded – undo
1213 1196
 			$slowlog->caller = $trigger_name . '.' . $called_position;
1214 1197
 			$slowlog->called = $module . '.' . $called_method;
1215 1198
 			$slowlog->called_extension = $module;
1216
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1199
+			if($trigger_name != 'XE.writeSlowlog') {
1200
+				writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1201
+			}
1217 1202
 
1218 1203
 			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1219 1204
 			{
Please login to merge, or discard this patch.
Spacing   +178 added lines, -178 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	function ModuleHandler($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,10 +43,10 @@  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
 			$logged_info = Context::get('logged_info');
49
-			if($logged_info->is_admin != "Y")
49
+			if ($logged_info->is_admin != "Y")
50 50
 			{
51 51
 				$this->error = 'msg_invalid_request';
52 52
 				return;
@@ -59,26 +59,26 @@  discard block
 block discarded – undo
59 59
 		$this->mid = $mid ? $mid : Context::get('mid');
60 60
 		$this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl');
61 61
 		$this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl');
62
-        if($entry = Context::get('entry'))
62
+        if ($entry = Context::get('entry'))
63 63
         {
64 64
             $this->entry = Context::convertEncodingStr($entry);
65 65
         }
66 66
 
67 67
 		// Validate variables to prevent XSS
68 68
 		$isInvalid = NULL;
69
-		if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
69
+		if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module))
70 70
 		{
71 71
 			$isInvalid = TRUE;
72 72
 		}
73
-		if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
73
+		if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid))
74 74
 		{
75 75
 			$isInvalid = TRUE;
76 76
 		}
77
-		if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
77
+		if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act))
78 78
 		{
79 79
 			$isInvalid = TRUE;
80 80
 		}
81
-		if($isInvalid)
81
+		if ($isInvalid)
82 82
 		{
83 83
 			htmlHeader();
84 84
 			echo Context::getLang("msg_invalid_request");
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
 			exit;
88 88
 		}
89 89
 
90
-		if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
90
+		if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0))
91 91
 		{
92
-			if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
92
+			if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on')
93 93
 			{
94
-				if(Context::get('_https_port')!=null) {
95
-					header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']);
94
+				if (Context::get('_https_port') != null) {
95
+					header('location:https://'.$_SERVER['HTTP_HOST'].':'.Context::get('_https_port').$_SERVER['REQUEST_URI']);
96 96
 				} else {
97
-					header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
97
+					header('location:https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
98 98
 				}
99 99
 				return;
100 100
 			}
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// call a trigger before moduleHandler init
104 104
 		ModuleHandler::triggerCall('moduleHandler.init', 'before', $this);
105
-		if(__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
105
+		if (__ERROR_LOG__ == 1 && __DEBUG_OUTPUT__ == 0)
106 106
 		{
107
-			if(__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
107
+			if (__DEBUG_PROTECT__ === 0 || __DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ == $_SERVER['REMOTE_ADDR'])
108 108
 			{
109 109
 				set_error_handler(array($this, 'xeErrorLog'), E_WARNING);
110 110
 				register_shutdown_function(array($this, 'shutdownHandler'));
@@ -115,40 +115,40 @@  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)) include($addon_file);
119 119
 	}
120 120
 
121 121
 	public static function xeErrorLog($errnumber, $errormassage, $errorfile, $errorline, $errorcontext)
122 122
 	{
123
-		if(($errnumber & 3) == 0 || error_reporting() == 0)
123
+		if (($errnumber & 3) == 0 || error_reporting() == 0)
124 124
 		{
125 125
 			return false;
126 126
 		}
127 127
 
128 128
 		set_error_handler(function() { }, ~0);
129 129
 
130
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
131
-		if(!file_exists($debug_file))
130
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
131
+		if (!file_exists($debug_file))
132 132
 		{
133 133
 			$print[] = '<?php exit() ?>';
134 134
 		}
135 135
 
136 136
 		$errorname = self::getErrorType($errnumber);
137
-		$print[] = '['.date('Y-m-d H:i:s').'] ' . $errorname . ' : ' . $errormassage;
137
+		$print[] = '['.date('Y-m-d H:i:s').'] '.$errorname.' : '.$errormassage;
138 138
 		$backtrace_args = defined('DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
139 139
 		$backtrace = debug_backtrace($backtrace_args);
140
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
140
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'xeErrorLog' && !$backtrace[1]['class'])
141 141
 		{
142 142
 			array_shift($backtrace);
143 143
 		}
144 144
 
145
-		foreach($backtrace as $key => $value)
145
+		foreach ($backtrace as $key => $value)
146 146
 		{
147
-			$message = '    - ' . $value['file'] . ' : ' . $value['line'];
147
+			$message = '    - '.$value['file'].' : '.$value['line'];
148 148
 			$print[] = $message;
149 149
 		}
150 150
 		$print[] = PHP_EOL;
151
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
151
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
152 152
 		restore_error_handler();
153 153
 
154 154
 		return true;
@@ -164,21 +164,21 @@  discard block
 block discarded – undo
164 164
 
165 165
 		set_error_handler(function() { }, ~0);
166 166
 
167
-		$debug_file = _XE_PATH_ . 'files/_debug_message.php';
168
-		if(!file_exists($debug_file))
167
+		$debug_file = _XE_PATH_.'files/_debug_message.php';
168
+		if (!file_exists($debug_file))
169 169
 		{
170 170
 			$print[] = '<?php exit() ?>';
171 171
 		}
172 172
 
173 173
 		$errorname = self::getErrorType($errinfo['type']);
174 174
 		$print[] = '['.date('Y-m-d H:i:s').']';
175
-		$print[] = $errorname . ' : ' . $errinfo['message'];
175
+		$print[] = $errorname.' : '.$errinfo['message'];
176 176
 
177
-		$message = '    - ' . $errinfo['file'] . ' : ' . $errinfo['line'];
177
+		$message = '    - '.$errinfo['file'].' : '.$errinfo['line'];
178 178
 		$print[] = $message;
179 179
 
180 180
 		$print[] = PHP_EOL;
181
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
181
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
182 182
 		set_error_handler(array($this, 'dummyHandler'), ~0);
183 183
 
184 184
 		return true;
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 
219 219
 		// if success_return_url and error_return_url is incorrect
220 220
 		$urls = array(Context::get('success_return_url'), Context::get('error_return_url'));
221
-		foreach($urls as $url)
221
+		foreach ($urls as $url)
222 222
 		{
223
-			if(empty($url))
223
+			if (empty($url))
224 224
 			{
225 225
 				continue;
226 226
 			}
@@ -232,29 +232,29 @@  discard block
 block discarded – undo
232 232
 			$defaultUrlInfo = parse_url($dbInfo->default_url);
233 233
 			$defaultHost = $defaultUrlInfo['host'];
234 234
 		
235
-			if($host && ($host != $defaultHost && $host != $site_module_info->domain))
235
+			if ($host && ($host != $defaultHost && $host != $site_module_info->domain))
236 236
 			{
237 237
 				throw new Exception('msg_default_url_is_null');
238 238
 			}
239 239
 		}
240 240
 		
241
-		if(!$this->document_srl && $this->mid && $this->entry)
241
+		if (!$this->document_srl && $this->mid && $this->entry)
242 242
 		{
243 243
 			$oDocumentModel = getModel('document');
244 244
 			$this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry);
245
-			if($this->document_srl)
245
+			if ($this->document_srl)
246 246
 			{
247 247
 				Context::set('document_srl', $this->document_srl);
248 248
 			}
249 249
 		}
250 250
 
251 251
 		// Get module's information based on document_srl, if it's specified
252
-		if($this->document_srl)
252
+		if ($this->document_srl)
253 253
 		{
254 254
 			
255 255
 			$module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl);
256 256
 			// If the document does not exist, remove document_srl
257
-			if(!$module_info)
257
+			if (!$module_info)
258 258
 			{
259 259
 				unset($this->document_srl);
260 260
 			}
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 			{
263 263
 				// If it exists, compare mid based on the module information
264 264
 				// if mids are not matching, set it as the document's mid
265
-				if(!$this->mid || ($this->mid != $module_info->mid))
265
+				if (!$this->mid || ($this->mid != $module_info->mid))
266 266
 				{
267 267
 					
268
-					if(Context::getRequestMethod() == 'GET')
268
+					if (Context::getRequestMethod() == 'GET')
269 269
 					{
270 270
 						$this->mid = $module_info->mid;
271
-						header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
271
+						header('location:'.getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl));
272 272
 						return FALSE;
273 273
 					}
274 274
 					else
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 					
280 280
 				}
281 281
 				// if requested module is different from one of the document, remove the module information retrieved based on the document number
282
-				if($this->module && $module_info->module != $this->module)
282
+				if ($this->module && $module_info->module != $this->module)
283 283
 				{
284 284
 					unset($module_info);
285 285
 				}
@@ -288,36 +288,36 @@  discard block
 block discarded – undo
288 288
 		}
289 289
 
290 290
 		// If module_info is not set yet, and there exists mid information, get module information based on the mid
291
-		if(!$module_info && $this->mid)
291
+		if (!$module_info && $this->mid)
292 292
 		{
293 293
 			$module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl);
294 294
 			//if($this->module && $module_info->module != $this->module) unset($module_info);
295 295
 		}
296 296
 
297 297
 		// redirect, if module_site_srl and site_srl are different
298
-		if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
298
+		if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0)
299 299
 		{
300 300
 			$site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl);
301
-			header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
301
+			header("location:".getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid));
302 302
 			return FALSE;
303 303
 		}
304 304
 
305 305
 		// If module_info is not set still, and $module does not exist, find the default module
306
-		if(!$module_info && !$this->module && !$this->mid)
306
+		if (!$module_info && !$this->module && !$this->mid)
307 307
 		{
308 308
 			$module_info = $site_module_info;
309 309
 		}
310 310
 
311
-		if(!$module_info && !$this->module && $site_module_info->module_site_srl)
311
+		if (!$module_info && !$this->module && $site_module_info->module_site_srl)
312 312
 		{
313 313
 			$module_info = $site_module_info;
314 314
 		}
315 315
 
316 316
 		// redirect, if site_srl of module_info is different from one of site's module_info
317
-		if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
317
+		if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler())
318 318
 		{
319 319
 			// If the module is of virtual site
320
-			if($module_info->site_srl)
320
+			if ($module_info->site_srl)
321 321
 			{
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'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 			else
327 327
 			{
328 328
 				$db_info = Context::getDBInfo();
329
-				if(!$db_info->default_url)
329
+				if (!$db_info->default_url)
330 330
 				{
331 331
 					return Context::getLang('msg_default_url_is_not_defined');
332 332
 				}
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 					$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 336
 				}
337 337
 			}
338
-			header("location:" . $redirect_url);
338
+			header("location:".$redirect_url);
339 339
 			return FALSE;
340 340
 		}
341 341
 
342 342
 		// If module info was set, retrieve variables from the module information
343
-		if($module_info)
343
+		if ($module_info)
344 344
 		{
345 345
 			$this->module = $module_info->module;
346 346
 			$this->mid = $module_info->mid;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			$targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl';
352 352
 
353 353
 			// use the site default layout.
354
-			if($module_info->{$targetSrl} == -1)
354
+			if ($module_info->{$targetSrl} == -1)
355 355
 			{
356 356
 				$oLayoutAdminModel = getAdminModel('layout');
357 357
 				$layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		// Set module and mid into module_info
372
-		if(!isset($this->module_info))
372
+		if (!isset($this->module_info))
373 373
 		{
374 374
 			$this->module_info = new stdClass();
375 375
 		}
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 		$this->module_info->site_srl = $site_module_info->site_srl;
381 381
 
382 382
 		// Still no module? it's an error
383
-		if(!$this->module)
383
+		if (!$this->module)
384 384
 		{
385 385
 			$this->error = 'msg_module_is_not_exists';
386 386
 			$this->httpStatusCode = '404';
387 387
 		}
388 388
 
389 389
 		// If mid exists, set mid into context
390
-		if($this->mid)
390
+		if ($this->mid)
391 391
 		{
392 392
 			Context::set('mid', $this->mid, TRUE);
393 393
 		}
394 394
 		
395 395
 		// Call a trigger after moduleHandler init
396 396
 		$output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info);
397
-		if(!$output->toBool())
397
+		if (!$output->toBool())
398 398
 		{
399 399
 			$this->error = $output->getMessage();
400 400
 			return TRUE;
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 		$display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
417 417
 
418 418
 		// If error occurred while preparation, return a message instance
419
-		if($this->error)
419
+		if ($this->error)
420 420
 		{
421 421
 			$this->_setInputErrorToContext();
422 422
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
423 423
 			$oMessageObject->setError(-1);
424 424
 			$oMessageObject->setMessage($this->error);
425 425
 			$oMessageObject->dispMessage();
426
-			if($this->httpStatusCode)
426
+			if ($this->httpStatusCode)
427 427
 			{
428 428
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
429 429
 			}
@@ -434,22 +434,22 @@  discard block
 block discarded – undo
434 434
 		$xml_info = $oModuleModel->getModuleActionXml($this->module);
435 435
 
436 436
 		// If not installed yet, modify act
437
-		if($this->module == "install")
437
+		if ($this->module == "install")
438 438
 		{
439
-			if(!$this->act || !$xml_info->action->{$this->act})
439
+			if (!$this->act || !$xml_info->action->{$this->act})
440 440
 			{
441 441
 				$this->act = $xml_info->default_index_act;
442 442
 			}
443 443
 		}
444 444
 
445 445
 		// if act exists, find type of the action, if not use default index act
446
-		if(!$this->act)
446
+		if (!$this->act)
447 447
 		{
448 448
 			$this->act = $xml_info->default_index_act;
449 449
 		}
450 450
 
451 451
 		// still no act means error
452
-		if(!$this->act)
452
+		if (!$this->act)
453 453
 		{
454 454
 			$this->error = 'msg_module_is_not_exists';
455 455
 			$this->httpStatusCode = '404';
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 			$oMessageObject->setError(-1);
460 460
 			$oMessageObject->setMessage($this->error);
461 461
 			$oMessageObject->dispMessage();
462
-			if($this->httpStatusCode)
462
+			if ($this->httpStatusCode)
463 463
 			{
464 464
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
465 465
 			}
@@ -470,17 +470,17 @@  discard block
 block discarded – undo
470 470
 		$type = $xml_info->action->{$this->act}->type;
471 471
 		$ruleset = $xml_info->action->{$this->act}->ruleset;
472 472
 		$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
473
-		if(!$kind && $this->module == 'admin')
473
+		if (!$kind && $this->module == 'admin')
474 474
 		{
475 475
 			$kind = 'admin';
476 476
 		}
477 477
 
478 478
 		// check REQUEST_METHOD in controller
479
-		if($type == 'controller')
479
+		if ($type == 'controller')
480 480
 		{
481 481
 			$allowedMethod = $xml_info->action->{$this->act}->method;
482 482
 
483
-			if(!$allowedMethod)
483
+			if (!$allowedMethod)
484 484
 			{
485 485
 				$allowedMethodList[0] = 'POST';
486 486
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 				$allowedMethodList = explode('|', strtoupper($allowedMethod));
490 490
 			}
491 491
 
492
-			if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
492
+			if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
493 493
 			{
494 494
 				$this->error = "msg_invalid_request";
495 495
 				$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 			}
501 501
 		}
502 502
 
503
-		if($this->module_info->use_mobile != "Y")
503
+		if ($this->module_info->use_mobile != "Y")
504 504
 		{
505 505
 			Mobile::setMobile(FALSE);
506 506
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		$logged_info = Context::get('logged_info');
509 509
 
510 510
 		// check CSRF for POST actions
511
-		if($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
511
+		if ($_SERVER['REQUEST_METHOD'] !== 'GET' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) {
512 512
 			$this->error = 'msg_invalid_request';
513 513
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
514 514
 			$oMessageObject->setError(-1);
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 		}
519 519
 
520 520
 		// Admin ip
521
-		if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
521
+		if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y')
522 522
 		{
523 523
 			$this->_setInputErrorToContext();
524 524
 			$this->error = "msg_not_permitted_act";
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 		}
531 531
 
532 532
 		// if(type == view, and case for using mobilephone)
533
-		if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
533
+		if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled())
534 534
 		{
535 535
 			$orig_type = "view";
536 536
 			$type = "mobile";
537 537
 			// create a module instance
538 538
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
539
-			if(!is_object($oModule) || !method_exists($oModule, $this->act))
539
+			if (!is_object($oModule) || !method_exists($oModule, $this->act))
540 540
 			{
541 541
 				$type = $orig_type;
542 542
 				Mobile::setMobile(FALSE);
@@ -549,14 +549,14 @@  discard block
 block discarded – undo
549 549
 			$oModule = $this->getModuleInstance($this->module, $type, $kind);
550 550
 		}
551 551
 
552
-		if(!is_object($oModule))
552
+		if (!is_object($oModule))
553 553
 		{
554 554
 			$this->_setInputErrorToContext();
555 555
 			$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
556 556
 			$oMessageObject->setError(-1);
557 557
 			$oMessageObject->setMessage($this->error);
558 558
 			$oMessageObject->dispMessage();
559
-			if($this->httpStatusCode)
559
+			if ($this->httpStatusCode)
560 560
 			{
561 561
 				$oMessageObject->setHttpStatusCode($this->httpStatusCode);
562 562
 			}
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
 		}
565 565
 
566 566
 		// If there is no such action in the module object
567
-		if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
567
+		if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act))
568 568
 		{
569 569
 
570
-			if(!Context::isInstalled())
570
+			if (!Context::isInstalled())
571 571
 			{
572 572
 				$this->_setInputErrorToContext();
573 573
 				$this->error = 'msg_invalid_request';
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 				$oMessageObject->setError(-1);
576 576
 				$oMessageObject->setMessage($this->error);
577 577
 				$oMessageObject->dispMessage();
578
-				if($this->httpStatusCode)
578
+				if ($this->httpStatusCode)
579 579
 				{
580 580
 					$oMessageObject->setHttpStatusCode($this->httpStatusCode);
581 581
 				}
@@ -584,12 +584,12 @@  discard block
 block discarded – undo
584 584
 
585 585
 			$forward = NULL;
586 586
 			// 1. Look for the module with action name
587
-			if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
587
+			if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches))
588 588
 			{
589
-				$module = strtolower($matches[2] . $matches[3]);
589
+				$module = strtolower($matches[2].$matches[3]);
590 590
 				$xml_info = $oModuleModel->getModuleActionXml($module);
591 591
 
592
-				if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
592
+				if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false'))
593 593
 				{
594 594
 					$forward = new stdClass();
595 595
 					$forward->module = $module;
@@ -609,12 +609,12 @@  discard block
 block discarded – undo
609 609
 				}
610 610
 			}
611 611
 
612
-			if(!$forward)
612
+			if (!$forward)
613 613
 			{
614 614
 				$forward = $oModuleModel->getActionForward($this->act);
615 615
 			}
616 616
 
617
-			if($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
617
+			if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act)
618 618
 			{
619 619
 				$kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : '';
620 620
 				$type = $forward->type;
@@ -626,11 +626,11 @@  discard block
 block discarded – undo
626 626
 
627 627
 				// SECISSUE also check foward act method
628 628
 				// check REQUEST_METHOD in controller
629
-				if($type == 'controller')
629
+				if ($type == 'controller')
630 630
 				{
631 631
 					$allowedMethod = $xml_info->action->{$forward->act}->method;
632 632
 
633
-					if(!$allowedMethod)
633
+					if (!$allowedMethod)
634 634
 					{
635 635
 						$allowedMethodList[0] = 'POST';
636 636
 					}
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 						$allowedMethodList = explode('|', strtoupper($allowedMethod));
640 640
 					}
641 641
 
642
-					if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
642
+					if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList))
643 643
 					{
644 644
 						$this->error = "msg_invalid_request";
645 645
 						$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
 					}
651 651
 				}
652 652
 
653
-				if($type == "view" && Mobile::isFromMobilePhone())
653
+				if ($type == "view" && Mobile::isFromMobilePhone())
654 654
 				{
655 655
 					$orig_type = "view";
656 656
 					$type = "mobile";
657 657
 					// create a module instance
658 658
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
659
-					if(!is_object($oModule) || !method_exists($oModule, $this->act))
659
+					if (!is_object($oModule) || !method_exists($oModule, $this->act))
660 660
 					{
661 661
 						$type = $orig_type;
662 662
 						Mobile::setMobile(FALSE);
@@ -668,25 +668,25 @@  discard block
 block discarded – undo
668 668
 					$oModule = $this->getModuleInstance($forward->module, $type, $kind);
669 669
 				}
670 670
 
671
-				if(!is_object($oModule))
671
+				if (!is_object($oModule))
672 672
 				{
673 673
 					$this->_setInputErrorToContext();
674 674
 					$oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode);
675 675
 					$oMessageObject->setError(-1);
676 676
 					$oMessageObject->setMessage('msg_module_is_not_exists');
677 677
 					$oMessageObject->dispMessage();
678
-					if($this->httpStatusCode)
678
+					if ($this->httpStatusCode)
679 679
 					{
680 680
 						$oMessageObject->setHttpStatusCode($this->httpStatusCode);
681 681
 					}
682 682
 					return $oMessageObject;
683 683
 				}
684 684
 
685
-				if($this->module == "admin" && $type == "view")
685
+				if ($this->module == "admin" && $type == "view")
686 686
 				{
687
-					if($logged_info->is_admin == 'Y')
687
+					if ($logged_info->is_admin == 'Y')
688 688
 					{
689
-						if($this->act != 'dispLayoutAdminLayoutModify')
689
+						if ($this->act != 'dispLayoutAdminLayoutModify')
690 690
 						{
691 691
 							$oAdminView = getAdminView('admin');
692 692
 							$oAdminView->makeGnbUrl($forward->module);
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 						return $oMessageObject;
707 707
 					}
708 708
 				}
709
-				if($kind == 'admin')
709
+				if ($kind == 'admin')
710 710
 				{
711 711
 					$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
712
-					if(!$grant->manager)
712
+					if (!$grant->manager)
713 713
 					{
714 714
 						$this->_setInputErrorToContext();
715 715
 						$this->error = 'msg_is_not_manager';
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 					}
722 722
 					else
723 723
 					{
724
-						if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
724
+						if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager')
725 725
 						{
726 726
 							$this->_setInputErrorToContext();
727 727
 							$this->error = 'msg_is_not_administrator';
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 					}
735 735
 				}
736 736
 			}
737
-			else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
737
+			else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act))
738 738
 			{
739 739
 				$this->act = $xml_info->default_index_act;
740 740
 			}
@@ -748,16 +748,16 @@  discard block
 block discarded – undo
748 748
 		}
749 749
 
750 750
 		// ruleset check...
751
-		if(!empty($ruleset))
751
+		if (!empty($ruleset))
752 752
 		{
753 753
 			$rulesetModule = $forward->module ? $forward->module : $this->module;
754 754
 			$rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid);
755
-			if(!empty($rulesetFile))
755
+			if (!empty($rulesetFile))
756 756
 			{
757
-				if($_SESSION['XE_VALIDATOR_ERROR_LANG'])
757
+				if ($_SESSION['XE_VALIDATOR_ERROR_LANG'])
758 758
 				{
759 759
 					$errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG'];
760
-					foreach($errorLang as $key => $val)
760
+					foreach ($errorLang as $key => $val)
761 761
 					{
762 762
 						Context::setLang($key, $val);
763 763
 					}
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 
767 767
 				$Validator = new Validator($rulesetFile);
768 768
 				$result = $Validator->validate();
769
-				if(!$result)
769
+				if (!$result)
770 770
 				{
771 771
 					$lastError = $Validator->getLastError();
772 772
 					$returnUrl = Context::get('error_return_url');
@@ -798,26 +798,26 @@  discard block
 block discarded – undo
798 798
 				'dispLayoutPreviewWithModule' => 1
799 799
 		);
800 800
 		$db_use_mobile = Mobile::isMobileEnabled();
801
-		if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
801
+		if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true)
802 802
 		{
803 803
 			global $lang;
804 804
 			$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>';
805
-			$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>';
805
+			$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>';
806 806
 			Context::addHtmlHeader($header);
807 807
 			Context::addHtmlFooter($footer);
808 808
 		}
809 809
 
810
-		if($type == "view" && $kind != 'admin')
810
+		if ($type == "view" && $kind != 'admin')
811 811
 		{
812 812
 			$module_config = $oModuleModel->getModuleConfig('module');
813
-			if($module_config->htmlFooter)
813
+			if ($module_config->htmlFooter)
814 814
 			{
815 815
 				Context::addHtmlFooter($module_config->htmlFooter);
816 816
 			}
817
-			if($module_config->siteTitle)
817
+			if ($module_config->siteTitle)
818 818
 			{
819 819
 				$siteTitle = Context::getBrowserTitle();
820
-				if(!$siteTitle)
820
+				if (!$siteTitle)
821 821
 				{
822 822
 					Context::setBrowserTitle($module_config->siteTitle);
823 823
 				}
@@ -830,18 +830,18 @@  discard block
 block discarded – undo
830 830
 		$procResult = $oModule->proc();
831 831
 
832 832
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
833
-		if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
833
+		if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()]))
834 834
 		{
835 835
 			$error = $oModule->getError();
836 836
 			$message = $oModule->getMessage();
837 837
 			$messageType = $oModule->getMessageType();
838 838
 			$redirectUrl = $oModule->getRedirectUrl();
839
-			if($messageType == 'error') debugPrint($message, 'ERROR');
839
+			if ($messageType == 'error') debugPrint($message, 'ERROR');
840 840
 
841
-			if(!$procResult)
841
+			if (!$procResult)
842 842
 			{
843 843
 				$this->error = $message;
844
-				if(!$redirectUrl && Context::get('error_return_url'))
844
+				if (!$redirectUrl && Context::get('error_return_url'))
845 845
 				{
846 846
 					$redirectUrl = Context::get('error_return_url');
847 847
 				}
@@ -854,13 +854,13 @@  discard block
 block discarded – undo
854 854
 
855 855
 			$_SESSION['XE_VALIDATOR_ERROR'] = $error;
856 856
 			$_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id');
857
-			if($message != 'success')
857
+			if ($message != 'success')
858 858
 			{
859 859
 				$_SESSION['XE_VALIDATOR_MESSAGE'] = $message;
860 860
 			}
861 861
 			$_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType;
862 862
 
863
-			if(Context::get('xeVirtualRequestMethod') != 'xml')
863
+			if (Context::get('xeVirtualRequestMethod') != 'xml')
864 864
 			{
865 865
 				$_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl;
866 866
 			}
@@ -876,27 +876,27 @@  discard block
 block discarded – undo
876 876
 	 * */
877 877
 	function _setInputErrorToContext()
878 878
 	{
879
-		if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
879
+		if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
880 880
 		{
881 881
 			Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
882 882
 		}
883
-		if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
883
+		if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
884 884
 		{
885 885
 			Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
886 886
 		}
887
-		if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
887
+		if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
888 888
 		{
889 889
 			Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
890 890
 		}
891
-		if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
891
+		if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
892 892
 		{
893 893
 			Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
894 894
 		}
895
-		if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
895
+		if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
896 896
 		{
897 897
 			Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
898 898
 		}
899
-		if(count($_SESSION['INPUT_ERROR']))
899
+		if (count($_SESSION['INPUT_ERROR']))
900 900
 		{
901 901
 			Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
902 902
 		}
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 	{
927 927
 		$requestVars = Context::getRequestVars();
928 928
 		unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url);
929
-		foreach($requestVars AS $key => $value)
929
+		foreach ($requestVars AS $key => $value)
930 930
 		{
931 931
 			$_SESSION['INPUT_ERROR'][$key] = $value;
932 932
 		}
@@ -940,41 +940,41 @@  discard block
 block discarded – undo
940 940
 	function displayContent($oModule = NULL)
941 941
 	{
942 942
 		// If the module is not set or not an object, set error
943
-		if(!$oModule || !is_object($oModule))
943
+		if (!$oModule || !is_object($oModule))
944 944
 		{
945 945
 			$this->error = 'msg_module_is_not_exists';
946 946
 			$this->httpStatusCode = '404';
947 947
 		}
948 948
 
949 949
 		// If connection to DB has a problem even though it's not install module, set error
950
-		if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
950
+		if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE)
951 951
 		{
952 952
 			$this->error = 'msg_dbconnect_failed';
953 953
 		}
954 954
 
955 955
 		// Call trigger after moduleHandler proc
956 956
 		$output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule);
957
-		if(!$output->toBool())
957
+		if (!$output->toBool())
958 958
 		{
959 959
 			$this->error = $output->getMessage();
960 960
 		}
961 961
 
962 962
 		// Use message view object, if HTML call
963 963
 		$methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1);
964
-		if(!isset($methodList[Context::getRequestMethod()]))
964
+		if (!isset($methodList[Context::getRequestMethod()]))
965 965
 		{
966 966
 
967
-			if($_SESSION['XE_VALIDATOR_RETURN_URL'])
967
+			if ($_SESSION['XE_VALIDATOR_RETURN_URL'])
968 968
 			{
969 969
 				$display_handler = new DisplayHandler();
970 970
 				$display_handler->_debugOutput();
971 971
 
972
-				header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
972
+				header('location:'.$_SESSION['XE_VALIDATOR_RETURN_URL']);
973 973
 				return;
974 974
 			}
975 975
 
976 976
 			// If error occurred, handle it
977
-			if($this->error)
977
+			if ($this->error)
978 978
 			{
979 979
 				// display content with message module instance
980 980
 				$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
@@ -983,14 +983,14 @@  discard block
 block discarded – undo
983 983
 				$oMessageObject->setMessage($this->error);
984 984
 				$oMessageObject->dispMessage();
985 985
 
986
-				if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
986
+				if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200')
987 987
 				{
988 988
 					$this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode());
989 989
 					$oMessageObject->setTemplateFile('http_status_code');
990 990
 				}
991 991
 
992 992
 				// If module was called normally, change the templates of the module into ones of the message view module
993
-				if($oModule)
993
+				if ($oModule)
994 994
 				{
995 995
 					$oModule->setTemplatePath($oMessageObject->getTemplatePath());
996 996
 					$oModule->setTemplateFile($oMessageObject->getTemplateFile());
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 			}
1006 1006
 
1007 1007
 			// Check if layout_srl exists for the module
1008
-			if(Mobile::isFromMobilePhone())
1008
+			if (Mobile::isFromMobilePhone())
1009 1009
 			{
1010 1010
 				$layout_srl = $oModule->module_info->mlayout_srl;
1011 1011
 			}
@@ -1015,58 +1015,58 @@  discard block
 block discarded – undo
1015 1015
 			}
1016 1016
 
1017 1017
 			// if layout_srl is rollback by module, set default layout
1018
-			if($layout_srl == -1)
1018
+			if ($layout_srl == -1)
1019 1019
 			{
1020 1020
 				$viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
1021 1021
 				$oLayoutAdminModel = getAdminModel('layout');
1022 1022
 				$layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl);
1023 1023
 			}
1024 1024
 
1025
-			if($layout_srl && !$oModule->getLayoutFile())
1025
+			if ($layout_srl && !$oModule->getLayoutFile())
1026 1026
 			{
1027 1027
 
1028 1028
 				// If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file
1029 1029
 				$oLayoutModel = getModel('layout');
1030 1030
 				$layout_info = $oLayoutModel->getLayout($layout_srl);
1031
-				if($layout_info)
1031
+				if ($layout_info)
1032 1032
 				{
1033 1033
 
1034 1034
 					// Input extra_vars into $layout_info
1035
-					if($layout_info->extra_var_count)
1035
+					if ($layout_info->extra_var_count)
1036 1036
 					{
1037 1037
 
1038
-						foreach($layout_info->extra_var as $var_id => $val)
1038
+						foreach ($layout_info->extra_var as $var_id => $val)
1039 1039
 						{
1040
-							if($val->type == 'image')
1040
+							if ($val->type == 'image')
1041 1041
 							{
1042
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
1042
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
1043 1043
 								{
1044
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
1044
+									$val->value = Context::getRequestUri().substr($val->value, 2);
1045 1045
 								}
1046 1046
 							}
1047 1047
 							$layout_info->{$var_id} = $val->value;
1048 1048
 						}
1049 1049
 					}
1050 1050
 					// Set menus into context
1051
-					if($layout_info->menu_count)
1051
+					if ($layout_info->menu_count)
1052 1052
 					{
1053
-						foreach($layout_info->menu as $menu_id => $menu)
1053
+						foreach ($layout_info->menu as $menu_id => $menu)
1054 1054
 						{
1055 1055
 							// set default menu set(included home menu)
1056
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
1056
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
1057 1057
 							{
1058 1058
 								$oMenuAdminController = getAdminController('menu');
1059 1059
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
1060 1060
 
1061
-								if(FileHandler::exists($homeMenuCacheFile))
1061
+								if (FileHandler::exists($homeMenuCacheFile))
1062 1062
 								{
1063 1063
 									include($homeMenuCacheFile);
1064 1064
 								}
1065 1065
 
1066
-								if(!$menu->menu_srl)
1066
+								if (!$menu->menu_srl)
1067 1067
 								{
1068
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
1069
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
1068
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
1069
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
1070 1070
 									$layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl;
1071 1071
 								}
1072 1072
 								else
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 							}
1078 1078
 
1079 1079
 							$php_file = FileHandler::exists($menu->php_file);
1080
-							if($php_file)
1080
+							if ($php_file)
1081 1081
 							{
1082 1082
 								include($php_file);
1083 1083
 							}
@@ -1093,17 +1093,17 @@  discard block
 block discarded – undo
1093 1093
 
1094 1094
 					// If layout was modified, use the modified version
1095 1095
 					$edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
1096
-					if(file_exists($edited_layout))
1096
+					if (file_exists($edited_layout))
1097 1097
 					{
1098 1098
 						$oModule->setEditedLayoutFile($edited_layout);
1099 1099
 					}
1100 1100
 				}
1101 1101
 			}
1102 1102
 			$isLayoutDrop = Context::get('isLayoutDrop');
1103
-			if($isLayoutDrop)
1103
+			if ($isLayoutDrop)
1104 1104
 			{
1105 1105
 				$kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : '';
1106
-				if($kind == 'admin')
1106
+				if ($kind == 'admin')
1107 1107
 				{
1108 1108
 					$oModule->setLayoutFile('popup_layout');
1109 1109
 				}
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	function &getModuleInstance($module, $type = 'view', $kind = '')
1142 1142
 	{
1143 1143
 
1144
-		if(__DEBUG__ == 3)
1144
+		if (__DEBUG__ == 3)
1145 1145
 		{
1146 1146
 			$start_time = getMicroTime();
1147 1147
 		}
@@ -1151,51 +1151,51 @@  discard block
 block discarded – undo
1151 1151
 		$type = strtolower($type);
1152 1152
 
1153 1153
 		$kinds = array('svc' => 1, 'admin' => 1);
1154
-		if(!isset($kinds[$kind]))
1154
+		if (!isset($kinds[$kind]))
1155 1155
 		{
1156 1156
 			$kind = 'svc';
1157 1157
 		}
1158 1158
 
1159
-		$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
1159
+		$key = $module.'.'.($kind != 'admin' ? '' : 'admin').'.'.$type;
1160 1160
 
1161
-		if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1161
+		if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__']))
1162 1162
 		{
1163 1163
 			$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
1164 1164
 		}
1165 1165
 
1166 1166
 		// if there is no instance of the module in global variable, create a new one
1167
-		if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1167
+		if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind]))
1168 1168
 		{
1169 1169
 			ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1170 1170
 
1171
-			if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1171
+			if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file)))
1172 1172
 			{
1173 1173
 				$module = $parent_module;
1174 1174
 				ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
1175 1175
 			}
1176 1176
 
1177 1177
 			// Check if the base class and instance class exist
1178
-			if(!class_exists($module, true))
1178
+			if (!class_exists($module, true))
1179 1179
 			{
1180 1180
 				return NULL;
1181 1181
 			}
1182
-			if(!class_exists($instance_name, true))
1182
+			if (!class_exists($instance_name, true))
1183 1183
 			{
1184 1184
 				return NULL;
1185 1185
 			}
1186 1186
 
1187 1187
 			// Create an instance
1188 1188
 			$oModule = new $instance_name();
1189
-			if(!is_object($oModule))
1189
+			if (!is_object($oModule))
1190 1190
 			{
1191 1191
 				return NULL;
1192 1192
 			}
1193 1193
 
1194 1194
 			// Load language files for the class
1195
-			Context::loadLang($class_path . 'lang');
1196
-			if($extend_module)
1195
+			Context::loadLang($class_path.'lang');
1196
+			if ($extend_module)
1197 1197
 			{
1198
-				Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
1198
+				Context::loadLang(ModuleHandler::getModulePath($parent_module).'lang');
1199 1199
 			}
1200 1200
 
1201 1201
 			// Set variables to the instance
@@ -1203,10 +1203,10 @@  discard block
 block discarded – undo
1203 1203
 			$oModule->setModulePath($class_path);
1204 1204
 
1205 1205
 			// If the module has a constructor, run it.
1206
-			if(!isset($GLOBALS['_called_constructor'][$instance_name]))
1206
+			if (!isset($GLOBALS['_called_constructor'][$instance_name]))
1207 1207
 			{
1208 1208
 				$GLOBALS['_called_constructor'][$instance_name] = TRUE;
1209
-				if(@method_exists($oModule, $instance_name))
1209
+				if (@method_exists($oModule, $instance_name))
1210 1210
 				{
1211 1211
 					$oModule->{$instance_name}();
1212 1212
 				}
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 			$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
1217 1217
 		}
1218 1218
 
1219
-		if(__DEBUG__ == 3)
1219
+		if (__DEBUG__ == 3)
1220 1220
 		{
1221 1221
 			$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
1222 1222
 		}
@@ -1232,17 +1232,17 @@  discard block
 block discarded – undo
1232 1232
 		$highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module);
1233 1233
 		$highClassFile = FileHandler::getRealPath($highClassFile);
1234 1234
 
1235
-		$types = array('view','controller','model','api','wap','mobile','class');
1236
-		if(!in_array($type, $types))
1235
+		$types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class');
1236
+		if (!in_array($type, $types))
1237 1237
 		{
1238 1238
 			$type = $types[0];
1239 1239
 		}
1240
-		if($type == 'class')
1240
+		if ($type == 'class')
1241 1241
 		{
1242 1242
 			$instanceName = '%s';
1243 1243
 			$classFile = '%s%s.%s.php';
1244 1244
 		}
1245
-		elseif($kind == 'admin' && array_search($type, $types) < 3)
1245
+		elseif ($kind == 'admin' && array_search($type, $types) < 3)
1246 1246
 		{
1247 1247
 			$instanceName = '%sAdmin%s';
1248 1248
 			$classFile = '%s%s.admin.%s.php';
@@ -1267,26 +1267,26 @@  discard block
 block discarded – undo
1267 1267
 	function triggerCall($trigger_name, $called_position, &$obj)
1268 1268
 	{
1269 1269
 		// skip if not installed
1270
-		if(!Context::isInstalled())
1270
+		if (!Context::isInstalled())
1271 1271
 		{
1272 1272
 			return new Object();
1273 1273
 		}
1274 1274
 
1275 1275
 		$oModuleModel = getModel('module');
1276 1276
 		$triggers = $oModuleModel->getTriggers($trigger_name, $called_position);
1277
-		if(!$triggers || count($triggers) < 1)
1277
+		if (!$triggers || count($triggers) < 1)
1278 1278
 		{
1279 1279
 			return new Object();
1280 1280
 		}
1281 1281
 		
1282 1282
 		//store before trigger call time
1283 1283
 		$before_trigger_time = NULL;
1284
-		if(__LOG_SLOW_TRIGGER__> 0)
1284
+		if (__LOG_SLOW_TRIGGER__ > 0)
1285 1285
 		{
1286 1286
 			$before_trigger_time = microtime(true);
1287 1287
 		}
1288 1288
 
1289
-		foreach($triggers as $item)
1289
+		foreach ($triggers as $item)
1290 1290
 		{
1291 1291
 			$module = $item->module;
1292 1292
 			$type = $item->type;
@@ -1294,7 +1294,7 @@  discard block
 block discarded – undo
1294 1294
 
1295 1295
 			// todo why don't we call a normal class object ?
1296 1296
 			$oModule = getModule($module, $type);
1297
-			if(!$oModule || !method_exists($oModule, $called_method))
1297
+			if (!$oModule || !method_exists($oModule, $called_method))
1298 1298
 			{
1299 1299
 				continue;
1300 1300
 			}
@@ -1307,12 +1307,12 @@  discard block
 block discarded – undo
1307 1307
 			$elapsed_time_trigger = $after_each_trigger_time - $before_each_trigger_time;
1308 1308
 
1309 1309
 			$slowlog = new stdClass;
1310
-			$slowlog->caller = $trigger_name . '.' . $called_position;
1311
-			$slowlog->called = $module . '.' . $called_method;
1310
+			$slowlog->caller = $trigger_name.'.'.$called_position;
1311
+			$slowlog->called = $module.'.'.$called_method;
1312 1312
 			$slowlog->called_extension = $module;
1313
-			if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1313
+			if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog);
1314 1314
 
1315
-			if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1315
+			if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool())
1316 1316
 			{
1317 1317
 				return $output;
1318 1318
 			}
@@ -1397,9 +1397,9 @@  discard block
 block discarded – undo
1397 1397
 			'511' => 'Network Authentication Required',
1398 1398
 		);
1399 1399
 		$statusMessage = $statusMessageList[$code];
1400
-		if(!$statusMessage)
1400
+		if (!$statusMessage)
1401 1401
 		{
1402
-			$statusMessage = 'HTTP ' . $code;
1402
+			$statusMessage = 'HTTP '.$code;
1403 1403
 		}
1404 1404
 
1405 1405
 		Context::set('http_status_code', $code);
Please login to merge, or discard this patch.
config/func.inc.php 2 patches
Spacing   +182 added lines, -182 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,7 +250,7 @@  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 255
 		$arr_seq = $_SESSION['seq'];
256 256
 	}
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
  */
267 267
 function checkUserSequence($seq)
268 268
 {
269
-	if(!isset($_SESSION['seq']))
269
+	if (!isset($_SESSION['seq']))
270 270
 	{
271 271
 		return false;
272 272
 	}
273
-	if(!in_array($seq, $_SESSION['seq']))
273
+	if (!in_array($seq, $_SESSION['seq']))
274 274
 	{
275 275
 		return false;
276 276
 	}
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	$num_args = func_num_args();
297 297
 	$args_list = func_get_args();
298 298
 
299
-	if($num_args)
299
+	if ($num_args)
300 300
 		$url = Context::getUrl($num_args, $args_list);
301 301
 	else
302 302
 		$url = Context::getRequestUri();
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	$num_args = func_num_args();
316 316
 	$args_list = func_get_args();
317 317
 
318
-	if($num_args)
318
+	if ($num_args)
319 319
 	{
320 320
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
321 321
 	}
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	$num_args = func_num_args();
339 339
 	$args_list = func_get_args();
340 340
 
341
-	if($num_args)
341
+	if ($num_args)
342 342
 	{
343 343
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
344 344
 	}
@@ -360,16 +360,16 @@  discard block
 block discarded – undo
360 360
 	$num_args = func_num_args();
361 361
 	$args_list = func_get_args();
362 362
 	$request_uri = Context::getRequestUri();
363
-	if(!$num_args)
363
+	if (!$num_args)
364 364
 	{
365 365
 		return $request_uri;
366 366
 	}
367 367
 
368 368
 	$url = Context::getUrl($num_args, $args_list);
369
-	if(strncasecmp('http', $url, 4) !== 0)
369
+	if (strncasecmp('http', $url, 4) !== 0)
370 370
 	{
371 371
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
372
-		return substr($match[0], 0, -1) . $url;
372
+		return substr($match[0], 0, -1).$url;
373 373
 	}
374 374
 	return $url;
375 375
 }
@@ -384,17 +384,17 @@  discard block
 block discarded – undo
384 384
 	$num_args = func_num_args();
385 385
 	$args_list = func_get_args();
386 386
 	$request_uri = Context::getRequestUri();
387
-	if(!$num_args)
387
+	if (!$num_args)
388 388
 	{
389 389
 		return $request_uri;
390 390
 	}
391 391
 
392 392
 	$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
393
-	if(strncasecmp('http', $url, 4) !== 0)
393
+	if (strncasecmp('http', $url, 4) !== 0)
394 394
 	{
395 395
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
396 396
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
397
-		return substr($match[0], 0, -1) . $url;
397
+		return substr($match[0], 0, -1).$url;
398 398
 	}
399 399
 	return $url;
400 400
 }
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	$num_args = func_num_args();
411 411
 	$args_list = func_get_args();
412 412
 
413
-	if(!$num_args)
413
+	if (!$num_args)
414 414
 	{
415 415
 		return Context::getRequestUri();
416 416
 	}
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	$num_args = func_num_args();
433 433
 	$args_list = func_get_args();
434 434
 
435
-	if(!$num_args)
435
+	if (!$num_args)
436 436
 	{
437 437
 		return Context::getRequestUri();
438 438
 	}
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	$args_list = func_get_args();
455 455
 
456 456
 	$request_uri = Context::getRequestUri();
457
-	if(!$num_args)
457
+	if (!$num_args)
458 458
 	{
459 459
 		return $request_uri;
460 460
 	}
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
 	$num_args = count($args_list);
464 464
 
465 465
 	$url = Context::getUrl($num_args, $args_list, $domain);
466
-	if(strncasecmp('http', $url, 4) !== 0)
466
+	if (strncasecmp('http', $url, 4) !== 0)
467 467
 	{
468 468
 		preg_match('/^(http|https):\/\/([^\/]+)\//', $request_uri, $match);
469
-		return substr($match[0], 0, -1) . $url;
469
+		return substr($match[0], 0, -1).$url;
470 470
 	}
471 471
 	return $url;
472 472
 }
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 function getCurrentPageUrl()
480 480
 {
481 481
 	$protocol = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
482
-	$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
482
+	$url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
483 483
 	return htmlspecialchars($url, ENT_COMPAT, 'UTF-8', FALSE);
484 484
 }
485 485
 
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
  */
505 505
 function cut_str($string, $cut_size = 0, $tail = '...')
506 506
 {
507
-	if($cut_size < 1 || !$string)
507
+	if ($cut_size < 1 || !$string)
508 508
 	{
509 509
 		return $string;
510 510
 	}
511 511
 
512
-	if($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth'))
512
+	if ($GLOBALS['use_mb_strimwidth'] || function_exists('mb_strimwidth'))
513 513
 	{
514 514
 		$GLOBALS['use_mb_strimwidth'] = TRUE;
515 515
 		return mb_strimwidth($string, 0, $cut_size + 4, $tail, 'utf-8');
@@ -523,16 +523,16 @@  discard block
 block discarded – undo
523 523
 	$char_count = 0;
524 524
 
525 525
 	$idx = 0;
526
-	while($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
526
+	while ($idx < $string_length && $char_count < $cut_size && $char_width <= $max_width)
527 527
 	{
528 528
 		$c = ord(substr($string, $idx, 1));
529 529
 		$char_count++;
530
-		if($c < 128)
530
+		if ($c < 128)
531 531
 		{
532 532
 			$char_width += (int) $chars[$c - 32];
533 533
 			$idx++;
534 534
 		}
535
-		else if(191 < $c && $c < 224)
535
+		else if (191 < $c && $c < 224)
536 536
 		{
537 537
 			$char_width += $chars[4];
538 538
 			$idx += 2;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	}
546 546
 
547 547
 	$output = substr($string, 0, $idx);
548
-	if(strlen($output) < $string_length)
548
+	if (strlen($output) < $string_length)
549 549
 	{
550 550
 		$output .= $tail;
551 551
 	}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 function zgap()
562 562
 {
563 563
 	$time_zone = $GLOBALS['_time_zone'];
564
-	if($time_zone < 0)
564
+	if ($time_zone < 0)
565 565
 	{
566 566
 		$to = -1;
567 567
 	}
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	$t_min = substr($time_zone, 3, 2) * $to;
575 575
 
576 576
 	$server_time_zone = date("O");
577
-	if($server_time_zone < 0)
577
+	if ($server_time_zone < 0)
578 578
 	{
579 579
 		$so = -1;
580 580
 	}
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
  */
602 602
 function ztime($str)
603 603
 {
604
-	if(!$str)
604
+	if (!$str)
605 605
 	{
606 606
 		return;
607 607
 	}
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	$year = (int) substr($str, 0, 4);
613 613
 	$month = (int) substr($str, 4, 2);
614 614
 	$day = (int) substr($str, 6, 2);
615
-	if(strlen($str) <= 8)
615
+	if (strlen($str) <= 8)
616 616
 	{
617 617
 		$gap = 0;
618 618
 	}
@@ -636,19 +636,19 @@  discard block
 block discarded – undo
636 636
 	$gap = $_SERVER['REQUEST_TIME'] + zgap() - ztime($date);
637 637
 
638 638
 	$lang_time_gap = Context::getLang('time_gap');
639
-	if($gap < 60)
639
+	if ($gap < 60)
640 640
 	{
641 641
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
642 642
 	}
643
-	elseif($gap < 60 * 60)
643
+	elseif ($gap < 60 * 60)
644 644
 	{
645 645
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
646 646
 	}
647
-	elseif($gap < 60 * 60 * 2)
647
+	elseif ($gap < 60 * 60 * 2)
648 648
 	{
649 649
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
650 650
 	}
651
-	elseif($gap < 60 * 60 * 24)
651
+	elseif ($gap < 60 * 60 * 24)
652 652
 	{
653 653
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
654 654
 	}
@@ -685,40 +685,40 @@  discard block
 block discarded – undo
685 685
 function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
686 686
 {
687 687
 	// return null if no target time is specified
688
-	if(!$str)
688
+	if (!$str)
689 689
 	{
690 690
 		return;
691 691
 	}
692 692
 	// convert the date format according to the language
693
-	if($conversion == TRUE)
693
+	if ($conversion == TRUE)
694 694
 	{
695
-		switch(Context::getLangType())
695
+		switch (Context::getLangType())
696 696
 		{
697 697
 			case 'en' :
698 698
 			case 'es' :
699
-				if($format == 'Y-m-d')
699
+				if ($format == 'Y-m-d')
700 700
 				{
701 701
 					$format = 'M d, Y';
702 702
 				}
703
-				elseif($format == 'Y-m-d H:i:s')
703
+				elseif ($format == 'Y-m-d H:i:s')
704 704
 				{
705 705
 					$format = 'M d, Y H:i:s';
706 706
 				}
707
-				elseif($format == 'Y-m-d H:i')
707
+				elseif ($format == 'Y-m-d H:i')
708 708
 				{
709 709
 					$format = 'M d, Y H:i';
710 710
 				}
711 711
 				break;
712 712
 			case 'vi' :
713
-				if($format == 'Y-m-d')
713
+				if ($format == 'Y-m-d')
714 714
 				{
715 715
 					$format = 'd-m-Y';
716 716
 				}
717
-				elseif($format == 'Y-m-d H:i:s')
717
+				elseif ($format == 'Y-m-d H:i:s')
718 718
 				{
719 719
 					$format = 'H:i:s d-m-Y';
720 720
 				}
721
-				elseif($format == 'Y-m-d H:i')
721
+				elseif ($format == 'Y-m-d H:i')
722 722
 				{
723 723
 					$format = 'H:i d-m-Y';
724 724
 				}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 	}
728 728
 
729 729
 	// If year value is less than 1970, handle it separately.
730
-	if((int) substr($str, 0, 4) < 1970)
730
+	if ((int) substr($str, 0, 4) < 1970)
731 731
 	{
732 732
 		$hour = (int) substr($str, 8, 2);
733 733
 		$min = (int) substr($str, 10, 2);
@@ -777,9 +777,9 @@  discard block
 block discarded – undo
777 777
 function getEncodeEmailAddress($email)
778 778
 {
779 779
 	$return = '';
780
-	for($i = 0, $c = strlen($email); $i < $c; $i++)
780
+	for ($i = 0, $c = strlen($email); $i < $c; $i++)
781 781
 	{
782
-		$return .= '&#' . (rand(0, 1) == 0 ? ord($email[$i]) : 'X' . dechex(ord($email[$i]))) . ';';
782
+		$return .= '&#'.(rand(0, 1) == 0 ? ord($email[$i]) : 'X'.dechex(ord($email[$i]))).';';
783 783
 	}
784 784
 	return $return;
785 785
 }
@@ -799,25 +799,25 @@  discard block
 block discarded – undo
799 799
 {
800 800
 	static $debug_file;
801 801
 
802
-	if(!(__DEBUG__ & 1))
802
+	if (!(__DEBUG__ & 1))
803 803
 	{
804 804
 		return;
805 805
 	}
806 806
 
807 807
 	static $firephp;
808 808
 	$bt = debug_backtrace();
809
-	if(is_array($bt))
809
+	if (is_array($bt))
810 810
 	{
811 811
 		$bt_debug_print = array_shift($bt);
812 812
 		$bt_called_function = array_shift($bt);
813 813
 	}
814 814
 	$file_name = str_replace(_XE_PATH_, '', $bt_debug_print['file']);
815 815
 	$line_num = $bt_debug_print['line'];
816
-	$function = $bt_called_function['class'] . $bt_called_function['type'] . $bt_called_function['function'];
816
+	$function = $bt_called_function['class'].$bt_called_function['type'].$bt_called_function['function'];
817 817
 
818
-	if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
818
+	if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1)
819 819
 	{
820
-		if(!isset($firephp))
820
+		if (!isset($firephp))
821 821
 		{
822 822
 			$firephp = FirePHP::getInstance(TRUE);
823 823
 		}
@@ -826,16 +826,16 @@  discard block
 block discarded – undo
826 826
 		$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()));
827 827
 
828 828
 		// Check a FirePHP option
829
-		if($display_option === 'TABLE')
829
+		if ($display_option === 'TABLE')
830 830
 		{
831 831
 			$label = $display_option;
832 832
 		}
833
-		if($display_option === 'ERROR')
833
+		if ($display_option === 'ERROR')
834 834
 		{
835 835
 			$type = $display_option;
836 836
 		}
837 837
 		// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
838
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
838
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
839 839
 		{
840 840
 			$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';
841 841
 			$label = NULL;
@@ -845,52 +845,52 @@  discard block
 block discarded – undo
845 845
 	}
846 846
 	else
847 847
 	{
848
-		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
848
+		if (__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
849 849
 		{
850 850
 			return;
851 851
 		}
852 852
 
853 853
 		$print = array();
854
-		if(!$debug_file)
854
+		if (!$debug_file)
855 855
 		{
856
-			$debug_file = _XE_PATH_ . 'files/' . $file;
856
+			$debug_file = _XE_PATH_.'files/'.$file;
857 857
 		}
858
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
858
+		if (!file_exists($debug_file)) $print[] = '<?php exit() ?>';
859 859
 
860
-		if($display_option === TRUE || $display_option === 'ERROR')
860
+		if ($display_option === TRUE || $display_option === 'ERROR')
861 861
 		{
862
-			$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()));;
862
+			$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())); ;
863 863
 			$print[] = str_repeat('=', 80);
864 864
 		}
865 865
 		$type = gettype($debug_output);
866
-		if(!in_array($type, array('array', 'object', 'resource')))
866
+		if (!in_array($type, array('array', 'object', 'resource')))
867 867
 		{
868
-			if($display_option === 'ERROR')
868
+			if ($display_option === 'ERROR')
869 869
 			{
870
-				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
870
+				$print[] = 'ERROR : '.var_export($debug_output, TRUE);
871 871
 			}
872 872
 			else
873 873
 			{
874
-				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
874
+				$print[] = 'DEBUG : '.$type.'('.var_export($debug_output, TRUE).')';
875 875
 			}
876 876
 		}
877 877
 		else
878 878
 		{
879
-			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
879
+			$print[] = 'DEBUG : '.trim(preg_replace('/\r?\n/', "\n".'        ', print_r($debug_output, true)));
880 880
 		}
881 881
 		$backtrace_args = defined('\DEBUG_BACKTRACE_IGNORE_ARGS') ? \DEBUG_BACKTRACE_IGNORE_ARGS : 0;
882 882
 		$backtrace = debug_backtrace($backtrace_args);
883 883
 
884
-		if(count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
884
+		if (count($backtrace) > 1 && $backtrace[1]['function'] === 'debugPrint' && !$backtrace[1]['class'])
885 885
 		{
886 886
 			array_shift($backtrace);
887 887
 		}
888
-		foreach($backtrace as $val)
888
+		foreach ($backtrace as $val)
889 889
 		{
890
-			$print[] = '        - ' . $val['file'] . ' : ' . $val['line'];
890
+			$print[] = '        - '.$val['file'].' : '.$val['line'];
891 891
 		}
892 892
 		$print[] = PHP_EOL;
893
-		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND|LOCK_EX);
893
+		@file_put_contents($debug_file, implode(PHP_EOL, $print), FILE_APPEND | LOCK_EX);
894 894
 	}
895 895
 }
896 896
 
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
  */
902 902
 function writeSlowlog($type, $elapsed_time, $obj)
903 903
 {
904
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
904
+	if (!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
905 905
 
906 906
 	static $log_filename = array(
907 907
 		'query' => 'files/_slowlog_query.php',
@@ -911,47 +911,47 @@  discard block
 block discarded – undo
911 911
 	);
912 912
 	$write_file = true;
913 913
 
914
-	$log_file = _XE_PATH_ . $log_filename[$type];
914
+	$log_file = _XE_PATH_.$log_filename[$type];
915 915
 
916 916
 	$buff = array();
917 917
 	$buff[] = '<?php exit(); ?>';
918 918
 	$buff[] = date('c');
919 919
 
920
-	if($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
920
+	if ($type == 'trigger' && __LOG_SLOW_TRIGGER__ > 0 && $elapsed_time > __LOG_SLOW_TRIGGER__)
921 921
 	{
922
-		$buff[] = "\tCaller : " . $obj->caller;
923
-		$buff[] = "\tCalled : " . $obj->called;
922
+		$buff[] = "\tCaller : ".$obj->caller;
923
+		$buff[] = "\tCalled : ".$obj->called;
924 924
 	}
925
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
925
+	else if ($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
926 926
 	{
927
-		$buff[] = "\tAddon : " . $obj->called;
928
-		$buff[] = "\tCalled position : " . $obj->caller;
927
+		$buff[] = "\tAddon : ".$obj->called;
928
+		$buff[] = "\tCalled position : ".$obj->caller;
929 929
 	}
930
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
930
+	else if ($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
931 931
 	{
932
-		$buff[] = "\tWidget : " . $obj->called;
932
+		$buff[] = "\tWidget : ".$obj->called;
933 933
 	}
934
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
934
+	else if ($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
935 935
 	{
936 936
 
937 937
 		$buff[] = $obj->query;
938
-		$buff[] = "\tQuery ID   : " . $obj->query_id;
939
-		$buff[] = "\tCaller     : " . $obj->caller;
940
-		$buff[] = "\tConnection : " . $obj->connection;
938
+		$buff[] = "\tQuery ID   : ".$obj->query_id;
939
+		$buff[] = "\tCaller     : ".$obj->caller;
940
+		$buff[] = "\tConnection : ".$obj->connection;
941 941
 	}
942 942
 	else
943 943
 	{
944 944
 		$write_file = false;
945 945
 	}
946 946
 
947
-	if($write_file)
947
+	if ($write_file)
948 948
 	{
949 949
 		$buff[] = sprintf("\t%0.6f sec", $elapsed_time);
950
-		$buff[] = PHP_EOL . PHP_EOL;
950
+		$buff[] = PHP_EOL.PHP_EOL;
951 951
 		file_put_contents($log_file, implode(PHP_EOL, $buff), FILE_APPEND);
952 952
 	}
953 953
 
954
-	if($type != 'query')
954
+	if ($type != 'query')
955 955
 	{
956 956
 		$trigger_args = $obj;
957 957
 		$trigger_args->_log_type = $type;
@@ -991,11 +991,11 @@  discard block
 block discarded – undo
991 991
  */
992 992
 function delObjectVars($target_obj, $del_obj)
993 993
 {
994
-	if(!is_object($target_obj))
994
+	if (!is_object($target_obj))
995 995
 	{
996 996
 		return;
997 997
 	}
998
-	if(!is_object($del_obj))
998
+	if (!is_object($del_obj))
999 999
 	{
1000 1000
 		return;
1001 1001
 	}
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 	$target = array_keys($target_vars);
1007 1007
 	$del = array_keys($del_vars);
1008
-	if(!count($target) || !count($del))
1008
+	if (!count($target) || !count($del))
1009 1009
 	{
1010 1010
 		return $target_obj;
1011 1011
 	}
@@ -1013,10 +1013,10 @@  discard block
 block discarded – undo
1013 1013
 	$return_obj = new stdClass();
1014 1014
 
1015 1015
 	$target_count = count($target);
1016
-	for($i = 0; $i < $target_count; $i++)
1016
+	for ($i = 0; $i < $target_count; $i++)
1017 1017
 	{
1018 1018
 		$target_key = $target[$i];
1019
-		if(!in_array($target_key, $del))
1019
+		if (!in_array($target_key, $del))
1020 1020
 		{
1021 1021
 			$return_obj->{$target_key} = $target_obj->{$target_key};
1022 1022
 		}
@@ -1029,10 +1029,10 @@  discard block
 block discarded – undo
1029 1029
 {
1030 1030
 	$del_vars = array('error_return_url', 'success_return_url', 'ruleset', 'xe_validator_id');
1031 1031
 
1032
-	foreach($del_vars as $var)
1032
+	foreach ($del_vars as $var)
1033 1033
 	{
1034
-		if(is_array($vars)) unset($vars[$var]);
1035
-		else if(is_object($vars)) unset($vars->$var);
1034
+		if (is_array($vars)) unset($vars[$var]);
1035
+		else if (is_object($vars)) unset($vars->$var);
1036 1036
 	}
1037 1037
 
1038 1038
 	return $vars;
@@ -1049,12 +1049,12 @@  discard block
 block discarded – undo
1049 1049
  */
1050 1050
 function handleError($errno, $errstr, $file, $line)
1051 1051
 {
1052
-	if(!__DEBUG__)
1052
+	if (!__DEBUG__)
1053 1053
 	{
1054 1054
 		return;
1055 1055
 	}
1056 1056
 	$errors = array(E_USER_ERROR, E_ERROR, E_PARSE);
1057
-	if(!in_array($errno, $errors))
1057
+	if (!in_array($errno, $errors))
1058 1058
 	{
1059 1059
 		return;
1060 1060
 	}
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 function getNumberingPath($no, $size = 3)
1075 1075
 {
1076 1076
 	$mod = pow(10, $size);
1077
-	$output = sprintf('%0' . $size . 'd/', $no % $mod);
1078
-	if($no >= $mod)
1077
+	$output = sprintf('%0'.$size.'d/', $no % $mod);
1078
+	if ($no >= $mod)
1079 1079
 	{
1080 1080
 		$output .= getNumberingPath((int) $no / $mod, $size);
1081 1081
 	}
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 
1096 1096
 function purifierHtml(&$content)
1097 1097
 {
1098
-	require_once(_XE_PATH_ . 'classes/security/Purifier.class.php');
1098
+	require_once(_XE_PATH_.'classes/security/Purifier.class.php');
1099 1099
 	$oPurifier = Purifier::getInstance();
1100 1100
 	$oPurifier->purify($content);
1101 1101
 }
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
  */
1109 1109
 function removeHackTag($content)
1110 1110
 {
1111
-	require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
1111
+	require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
1112 1112
 	$oEmbedFilter = EmbedFilter::getInstance();
1113 1113
 	$oEmbedFilter->check($content);
1114 1114
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
  */
1151 1151
 function checkUploadedFile($file)
1152 1152
 {
1153
-	require_once(_XE_PATH_ . 'classes/security/UploadFileFilter.class.php');
1153
+	require_once(_XE_PATH_.'classes/security/UploadFileFilter.class.php');
1154 1154
 	return UploadFileFilter::check($file);
1155 1155
 }
1156 1156
 
@@ -1164,13 +1164,13 @@  discard block
 block discarded – undo
1164 1164
 {
1165 1165
 	$content = preg_replace('@<(/?)xmp.*?>@i', '<\1xmp>', $content);
1166 1166
 
1167
-	if(($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1167
+	if (($start_xmp = strrpos($content, '<xmp>')) !== FALSE)
1168 1168
 	{
1169
-		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1169
+		if (($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1170 1170
 		{
1171 1171
 			$content .= '</xmp>';
1172 1172
 		}
1173
-		else if($close_xmp < $start_xmp)
1173
+		else if ($close_xmp < $start_xmp)
1174 1174
 		{
1175 1175
 			$content .= '</xmp>';
1176 1176
 		}
@@ -1190,33 +1190,33 @@  discard block
 block discarded – undo
1190 1190
 	$tag = strtolower($match[2]);
1191 1191
 
1192 1192
 	// xmp tag ?뺣━
1193
-	if($tag == 'xmp')
1193
+	if ($tag == 'xmp')
1194 1194
 	{
1195 1195
 		return "<{$match[1]}xmp>";
1196 1196
 	}
1197
-	if($match[1])
1197
+	if ($match[1])
1198 1198
 	{
1199 1199
 		return $match[0];
1200 1200
 	}
1201
-	if($match[4])
1201
+	if ($match[4])
1202 1202
 	{
1203
-		$match[4] = ' ' . $match[4];
1203
+		$match[4] = ' '.$match[4];
1204 1204
 	}
1205 1205
 
1206 1206
 	$attrs = array();
1207
-	if(preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1207
+	if (preg_match_all('/([\w:-]+)\s*=(?:\s*(["\']))?(?(2)(.*?)\2|([^ ]+))/s', $match[3], $m))
1208 1208
 	{
1209
-		foreach($m[1] as $idx => $name)
1209
+		foreach ($m[1] as $idx => $name)
1210 1210
 		{
1211
-			if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1211
+			if (strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
1212 1212
 			{
1213 1213
 				continue;
1214 1214
 			}
1215 1215
 
1216
-			$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]);
1216
+			$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]);
1217 1217
 			$val = preg_replace('/^\s+|[\t\n\r]+/', '', $val);
1218 1218
 
1219
-			if(preg_match('/^[a-z]+script:/i', $val))
1219
+			if (preg_match('/^[a-z]+script:/i', $val))
1220 1220
 			{
1221 1221
 				continue;
1222 1222
 			}
@@ -1227,60 +1227,60 @@  discard block
 block discarded – undo
1227 1227
 
1228 1228
 	$filter_arrts = array('style', 'src', 'href');
1229 1229
 
1230
-	if($tag === 'object') array_push($filter_arrts, 'data');
1231
-	if($tag === 'param') array_push($filter_arrts, 'value');
1230
+	if ($tag === 'object') array_push($filter_arrts, 'data');
1231
+	if ($tag === 'param') array_push($filter_arrts, 'value');
1232 1232
 
1233
-	foreach($filter_arrts as $attr)
1233
+	foreach ($filter_arrts as $attr)
1234 1234
 	{
1235
-		if(!isset($attrs[$attr])) continue;
1235
+		if (!isset($attrs[$attr])) continue;
1236 1236
 
1237 1237
 		$attr_value = rawurldecode($attrs[$attr]);
1238 1238
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
1239 1239
 		$attr_value = preg_replace('/\s+|[\t\n\r]+/', '', $attr_value);
1240
-		if(preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1240
+		if (preg_match('@(\?|&|;)(act=(\w+))@i', $attr_value, $m) && $m[3] !== 'procFileDownload')
1241 1241
 		{
1242 1242
 			unset($attrs[$attr]);
1243 1243
 		}
1244 1244
 	}
1245 1245
 
1246
-	if(isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1246
+	if (isset($attrs['style']) && preg_match('@(?:/\*|\*/|\n|:\s*expression\s*\()@i', $attrs['style']))
1247 1247
 	{
1248 1248
 		unset($attrs['style']);
1249 1249
 	}
1250 1250
 
1251 1251
 	$attr = array();
1252
-	foreach($attrs as $name => $val)
1252
+	foreach ($attrs as $name => $val)
1253 1253
 	{
1254
-		if($tag == 'object' || $tag == 'embed' || $tag == 'a')
1254
+		if ($tag == 'object' || $tag == 'embed' || $tag == 'a')
1255 1255
 		{
1256 1256
 			$attribute = strtolower(trim($name));
1257
-			if($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1257
+			if ($attribute == 'data' || $attribute == 'src' || $attribute == 'href')
1258 1258
 			{
1259
-				if(stripos($val, 'data:') === 0)
1259
+				if (stripos($val, 'data:') === 0)
1260 1260
 				{
1261 1261
 					continue;
1262 1262
 				}
1263 1263
 			}
1264 1264
 		}
1265 1265
 
1266
-		if($tag == 'img')
1266
+		if ($tag == 'img')
1267 1267
 		{
1268 1268
 			$attribute = strtolower(trim($name));
1269
-			if(stripos($val, 'data:') === 0)
1269
+			if (stripos($val, 'data:') === 0)
1270 1270
 			{
1271 1271
 				continue;
1272 1272
 			}
1273 1273
 		}
1274 1274
 		$val = str_replace('"', '&quot;', $val);
1275
-		$attr[] = $name . "=\"{$val}\"";
1275
+		$attr[] = $name."=\"{$val}\"";
1276 1276
 	}
1277
-	$attr = count($attr) ? ' ' . implode(' ', $attr) : '';
1277
+	$attr = count($attr) ? ' '.implode(' ', $attr) : '';
1278 1278
 
1279 1279
 	return "<{$match[1]}{$tag}{$attr}{$match[4]}>";
1280 1280
 }
1281 1281
 
1282 1282
 // convert hexa value to RGB
1283
-if(!function_exists('hexrgb'))
1283
+if (!function_exists('hexrgb'))
1284 1284
 {
1285 1285
 
1286 1286
 	/**
@@ -1316,9 +1316,9 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
 	settype($password, "string");
1318 1318
 
1319
-	for($i = 0; $i < strlen($password); $i++)
1319
+	for ($i = 0; $i < strlen($password); $i++)
1320 1320
 	{
1321
-		if($password[$i] == ' ' || $password[$i] == '\t')
1321
+		if ($password[$i] == ' ' || $password[$i] == '\t')
1322 1322
 		{
1323 1323
 			continue;
1324 1324
 		}
@@ -1330,11 +1330,11 @@  discard block
 block discarded – undo
1330 1330
 	$result1 = sprintf("%08lx", $nr & ((1 << 31) - 1));
1331 1331
 	$result2 = sprintf("%08lx", $nr2 & ((1 << 31) - 1));
1332 1332
 
1333
-	if($result1 == '80000000')
1333
+	if ($result1 == '80000000')
1334 1334
 	{
1335 1335
 		$nr += 0x80000000;
1336 1336
 	}
1337
-	if($result2 == '80000000')
1337
+	if ($result2 == '80000000')
1338 1338
 	{
1339 1339
 		$nr2 += 0x80000000;
1340 1340
 	}
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 function getScriptPath()
1351 1351
 {
1352 1352
 	static $url = NULL;
1353
-	if($url == NULL)
1353
+	if ($url == NULL)
1354 1354
 	{
1355 1355
 		$url = str_ireplace('/tools/', '/', preg_replace('/index.php$/i', '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME'])));
1356 1356
 	}
@@ -1380,14 +1380,14 @@  discard block
 block discarded – undo
1380 1380
 	$decodedStr = '';
1381 1381
 	$pos = 0;
1382 1382
 	$len = strlen($source);
1383
-	while($pos < $len)
1383
+	while ($pos < $len)
1384 1384
 	{
1385 1385
 		$charAt = substr($source, $pos, 1);
1386
-		if($charAt == '%')
1386
+		if ($charAt == '%')
1387 1387
 		{
1388 1388
 			$pos++;
1389 1389
 			$charAt = substr($source, $pos, 1);
1390
-			if($charAt == 'u')
1390
+			if ($charAt == 'u')
1391 1391
 			{
1392 1392
 				// we got a unicode character
1393 1393
 				$pos++;
@@ -1421,21 +1421,21 @@  discard block
 block discarded – undo
1421 1421
  */
1422 1422
 function _code2utf($num)
1423 1423
 {
1424
-	if($num < 128)
1424
+	if ($num < 128)
1425 1425
 	{
1426 1426
 		return chr($num);
1427 1427
 	}
1428
-	if($num < 2048)
1428
+	if ($num < 2048)
1429 1429
 	{
1430
-		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
1430
+		return chr(($num >> 6) + 192).chr(($num & 63) + 128);
1431 1431
 	}
1432
-	if($num < 65536)
1432
+	if ($num < 65536)
1433 1433
 	{
1434
-		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1434
+		return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1435 1435
 	}
1436
-	if($num < 2097152)
1436
+	if ($num < 2097152)
1437 1437
 	{
1438
-		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
1438
+		return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
1439 1439
 	}
1440 1440
 	return '';
1441 1441
 }
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
  */
1451 1451
 function detectUTF8($string, $return_convert = FALSE, $urldecode = TRUE)
1452 1452
 {
1453
-	if($urldecode)
1453
+	if ($urldecode)
1454 1454
 	{
1455 1455
 		$string = urldecode($string);
1456 1456
 	}
@@ -1458,12 +1458,12 @@  discard block
 block discarded – undo
1458 1458
 	$sample = iconv('utf-8', 'utf-8', $string);
1459 1459
 	$is_utf8 = (md5($sample) === md5($string));
1460 1460
 
1461
-	if(!$urldecode)
1461
+	if (!$urldecode)
1462 1462
 	{
1463 1463
 		$string = urldecode($string);
1464 1464
 	}
1465 1465
 
1466
-	if($return_convert)
1466
+	if ($return_convert)
1467 1467
 	{
1468 1468
 		return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string);
1469 1469
 	}
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
  */
1480 1480
 function json_encode2($data)
1481 1481
 {
1482
-	switch(gettype($data))
1482
+	switch (gettype($data))
1483 1483
 	{
1484 1484
 		case 'boolean':
1485 1485
 			return $data ? 'true' : 'false';
@@ -1487,15 +1487,15 @@  discard block
 block discarded – undo
1487 1487
 		case 'double':
1488 1488
 			return $data;
1489 1489
 		case 'string':
1490
-			return '"' . strtr($data, array('\\' => '\\\\', '"' => '\\"')) . '"';
1490
+			return '"'.strtr($data, array('\\' => '\\\\', '"' => '\\"')).'"';
1491 1491
 		case 'object':
1492 1492
 			$data = get_object_vars($data);
1493 1493
 		case 'array':
1494 1494
 			$rel = FALSE; // relative array?
1495 1495
 			$key = array_keys($data);
1496
-			foreach($key as $v)
1496
+			foreach ($key as $v)
1497 1497
 			{
1498
-				if(!is_int($v))
1498
+				if (!is_int($v))
1499 1499
 				{
1500 1500
 					$rel = TRUE;
1501 1501
 					break;
@@ -1503,12 +1503,12 @@  discard block
 block discarded – undo
1503 1503
 			}
1504 1504
 
1505 1505
 			$arr = array();
1506
-			foreach($data as $k => $v)
1506
+			foreach ($data as $k => $v)
1507 1507
 			{
1508
-				$arr[] = ($rel ? '"' . strtr($k, array('\\' => '\\\\', '"' => '\\"')) . '":' : '') . json_encode2($v);
1508
+				$arr[] = ($rel ? '"'.strtr($k, array('\\' => '\\\\', '"' => '\\"')).'":' : '').json_encode2($v);
1509 1509
 			}
1510 1510
 
1511
-			return $rel ? '{' . join(',', $arr) . '}' : '[' . join(',', $arr) . ']';
1511
+			return $rel ? '{'.join(',', $arr).'}' : '['.join(',', $arr).']';
1512 1512
 		default:
1513 1513
 			return '""';
1514 1514
 	}
@@ -1522,7 +1522,7 @@  discard block
 block discarded – undo
1522 1522
  */
1523 1523
 function isCrawler($agent = NULL)
1524 1524
 {
1525
-	if(!$agent)
1525
+	if (!$agent)
1526 1526
 	{
1527 1527
 		$agent = $_SERVER['HTTP_USER_AGENT'];
1528 1528
 	}
@@ -1532,9 +1532,9 @@  discard block
 block discarded – undo
1532 1532
 		/*'211.245.21.110-211.245.21.119' mixsh is closed */
1533 1533
 	);
1534 1534
 
1535
-	foreach($check_agent as $str)
1535
+	foreach ($check_agent as $str)
1536 1536
 	{
1537
-		if(stristr($agent, $str) != FALSE)
1537
+		if (stristr($agent, $str) != FALSE)
1538 1538
 		{
1539 1539
 			return TRUE;
1540 1540
 		}
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
  */
1553 1553
 function stripEmbedTagForAdmin(&$content, $writer_member_srl)
1554 1554
 {
1555
-	if(!Context::get('is_logged'))
1555
+	if (!Context::get('is_logged'))
1556 1556
 	{
1557 1557
 		return;
1558 1558
 	}
@@ -1560,18 +1560,18 @@  discard block
 block discarded – undo
1560 1560
 	$oModuleModel = getModel('module');
1561 1561
 	$logged_info = Context::get('logged_info');
1562 1562
 
1563
-	if($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1563
+	if ($writer_member_srl != $logged_info->member_srl && ($logged_info->is_admin == "Y" || $oModuleModel->isSiteAdmin($logged_info)))
1564 1564
 	{
1565
-		if($writer_member_srl)
1565
+		if ($writer_member_srl)
1566 1566
 		{
1567 1567
 			$oMemberModel = getModel('member');
1568 1568
 			$member_info = $oMemberModel->getMemberInfoByMemberSrl($writer_member_srl);
1569
-			if($member_info->is_admin == "Y")
1569
+			if ($member_info->is_admin == "Y")
1570 1570
 			{
1571 1571
 				return;
1572 1572
 			}
1573 1573
 		}
1574
-		$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>";
1574
+		$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>";
1575 1575
 		$content = preg_replace('/<object[^>]+>(.*?<\/object>)?/is', $security_msg, $content);
1576 1576
 		$content = preg_replace('/<embed[^>]+>(\s*<\/embed>)?/is', $security_msg, $content);
1577 1577
 		$content = preg_replace('/<img[^>]+editor_component="multimedia_link"[^>]*>(\s*<\/img>)?/is', $security_msg, $content);
@@ -1588,18 +1588,18 @@  discard block
 block discarded – undo
1588 1588
 function requirePear()
1589 1589
 {
1590 1590
 	static $required = false;
1591
-	if($required)
1591
+	if ($required)
1592 1592
 	{
1593 1593
 		return;
1594 1594
 	}
1595 1595
 
1596
-	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1596
+	if (version_compare(PHP_VERSION, "5.3.0") < 0)
1597 1597
 	{
1598
-		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1598
+		set_include_path(_XE_PATH_."libs/PEAR".PATH_SEPARATOR.get_include_path());
1599 1599
 	}
1600 1600
 	else
1601 1601
 	{
1602
-		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1602
+		set_include_path(_XE_PATH_."libs/PEAR.1.9.5".PATH_SEPARATOR.get_include_path());
1603 1603
 	}
1604 1604
 
1605 1605
 	$required = true;
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 
1608 1608
 function checkCSRF()
1609 1609
 {
1610
-	if($_SERVER['REQUEST_METHOD'] != 'POST')
1610
+	if ($_SERVER['REQUEST_METHOD'] != 'POST')
1611 1611
 	{
1612 1612
 		return FALSE;
1613 1613
 	}
@@ -1615,9 +1615,9 @@  discard block
 block discarded – undo
1615 1615
 	$default_url = Context::getDefaultUrl();
1616 1616
 	$referer = $_SERVER["HTTP_REFERER"];
1617 1617
 
1618
-	if(strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1618
+	if (strpos($default_url, 'xn--') !== FALSE && strpos($referer, 'xn--') === FALSE)
1619 1619
 	{
1620
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1620
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1621 1621
 		$IDN = new idna_convert(array('idn_version' => 2008));
1622 1622
 		$referer = $IDN->encode($referer);
1623 1623
 	}
@@ -1628,9 +1628,9 @@  discard block
 block discarded – undo
1628 1628
 	$oModuleModel = getModel('module');
1629 1629
 	$siteModuleInfo = $oModuleModel->getDefaultMid();
1630 1630
 
1631
-	if($siteModuleInfo->site_srl == 0)
1631
+	if ($siteModuleInfo->site_srl == 0)
1632 1632
 	{
1633
-		if($default_url['host'] !== $referer['host'])
1633
+		if ($default_url['host'] !== $referer['host'])
1634 1634
 		{
1635 1635
 			return FALSE;
1636 1636
 		}
@@ -1638,7 +1638,7 @@  discard block
 block discarded – undo
1638 1638
 	else
1639 1639
 	{
1640 1640
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1641
-		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1641
+		if (strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
1642 1642
 		{
1643 1643
 			return FALSE;
1644 1644
 		}
@@ -1654,15 +1654,15 @@  discard block
 block discarded – undo
1654 1654
  */
1655 1655
 function recurciveExposureCheck(&$menu)
1656 1656
 {
1657
-	if(is_array($menu))
1657
+	if (is_array($menu))
1658 1658
 	{
1659
-		foreach($menu AS $key=>$value)
1659
+		foreach ($menu AS $key=>$value)
1660 1660
 		{
1661
-			if(!$value['isShow'])
1661
+			if (!$value['isShow'])
1662 1662
 			{
1663 1663
 				unset($menu[$key]);
1664 1664
 			}
1665
-			if(is_array($value['list']) && count($value['list']) > 0)
1665
+			if (is_array($value['list']) && count($value['list']) > 0)
1666 1666
 			{
1667 1667
 				recurciveExposureCheck($menu[$key]['list']);
1668 1668
 			}
@@ -1672,14 +1672,14 @@  discard block
 block discarded – undo
1672 1672
 
1673 1673
 function changeValueInUrl($key, $requestKey, $dbKey, $urlName = 'success_return_url')
1674 1674
 {
1675
-	if($requestKey != $dbKey)
1675
+	if ($requestKey != $dbKey)
1676 1676
 	{
1677 1677
 		$arrayUrl = parse_url(Context::get('success_return_url'));
1678
-		if($arrayUrl['query'])
1678
+		if ($arrayUrl['query'])
1679 1679
 		{
1680 1680
 			parse_str($arrayUrl['query'], $parsedStr);
1681 1681
 
1682
-			if(isset($parsedStr[$key]))
1682
+			if (isset($parsedStr[$key]))
1683 1683
 			{
1684 1684
 				$parsedStr[$key] = $requestKey;
1685 1685
 				$successReturnUrl .= $arrayUrl['path'].'?'.http_build_query($parsedStr);
@@ -1722,14 +1722,14 @@  discard block
 block discarded – undo
1722 1722
  */
1723 1723
 function alertScript($msg)
1724 1724
 {
1725
-	if(!$msg)
1725
+	if (!$msg)
1726 1726
 	{
1727 1727
 		return;
1728 1728
 	}
1729 1729
 
1730 1730
 	echo '<script type="text/javascript">
1731 1731
 //<![CDATA[
1732
-alert("' . $msg . '");
1732
+alert("' . $msg.'");
1733 1733
 //]]>
1734 1734
 </script>';
1735 1735
 }
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 
1761 1761
 	echo '<script type="text/javascript">
1762 1762
 //<![CDATA[
1763
-' . $reloadScript . '
1763
+' . $reloadScript.'
1764 1764
 //]]>
1765 1765
 </script>';
1766 1766
 }
Please login to merge, or discard this patch.
Braces   +53 added lines, -67 removed lines patch added patch discarded remove patch
@@ -296,10 +296,11 @@  discard block
 block discarded – undo
296 296
 	$num_args = func_num_args();
297 297
 	$args_list = func_get_args();
298 298
 
299
-	if($num_args)
300
-		$url = Context::getUrl($num_args, $args_list);
301
-	else
302
-		$url = Context::getRequestUri();
299
+	if($num_args) {
300
+			$url = Context::getUrl($num_args, $args_list);
301
+	} else {
302
+			$url = Context::getRequestUri();
303
+	}
303 304
 
304 305
 	return preg_replace('@\berror_return_url=[^&]*|\w+=(?:&|$)@', '', $url);
305 306
 }
@@ -318,8 +319,7 @@  discard block
 block discarded – undo
318 319
 	if($num_args)
319 320
 	{
320 321
 		$url = Context::getUrl($num_args, $args_list, NULL, FALSE);
321
-	}
322
-	else
322
+	} else
323 323
 	{
324 324
 		$url = Context::getRequestUri();
325 325
 	}
@@ -341,8 +341,7 @@  discard block
 block discarded – undo
341 341
 	if($num_args)
342 342
 	{
343 343
 		$url = Context::getUrl($num_args, $args_list, NULL, TRUE, TRUE);
344
-	}
345
-	else
344
+	} else
346 345
 	{
347 346
 		$url = Context::getRequestUri();
348 347
 	}
@@ -531,13 +530,11 @@  discard block
 block discarded – undo
531 530
 		{
532 531
 			$char_width += (int) $chars[$c - 32];
533 532
 			$idx++;
534
-		}
535
-		else if(191 < $c && $c < 224)
533
+		} else if(191 < $c && $c < 224)
536 534
 		{
537 535
 			$char_width += $chars[4];
538 536
 			$idx += 2;
539
-		}
540
-		else
537
+		} else
541 538
 		{
542 539
 			$char_width += $chars[0];
543 540
 			$idx += 3;
@@ -564,8 +561,7 @@  discard block
 block discarded – undo
564 561
 	if($time_zone < 0)
565 562
 	{
566 563
 		$to = -1;
567
-	}
568
-	else
564
+	} else
569 565
 	{
570 566
 		$to = 1;
571 567
 	}
@@ -577,8 +573,7 @@  discard block
 block discarded – undo
577 573
 	if($server_time_zone < 0)
578 574
 	{
579 575
 		$so = -1;
580
-	}
581
-	else
576
+	} else
582 577
 	{
583 578
 		$so = 1;
584 579
 	}
@@ -615,8 +610,7 @@  discard block
 block discarded – undo
615 610
 	if(strlen($str) <= 8)
616 611
 	{
617 612
 		$gap = 0;
618
-	}
619
-	else
613
+	} else
620 614
 	{
621 615
 		$gap = zgap();
622 616
 	}
@@ -639,20 +633,16 @@  discard block
 block discarded – undo
639 633
 	if($gap < 60)
640 634
 	{
641 635
 		$buff = sprintf($lang_time_gap['min'], (int) ($gap / 60) + 1);
642
-	}
643
-	elseif($gap < 60 * 60)
636
+	} elseif($gap < 60 * 60)
644 637
 	{
645 638
 		$buff = sprintf($lang_time_gap['mins'], (int) ($gap / 60) + 1);
646
-	}
647
-	elseif($gap < 60 * 60 * 2)
639
+	} elseif($gap < 60 * 60 * 2)
648 640
 	{
649 641
 		$buff = sprintf($lang_time_gap['hour'], (int) ($gap / 60 / 60) + 1);
650
-	}
651
-	elseif($gap < 60 * 60 * 24)
642
+	} elseif($gap < 60 * 60 * 24)
652 643
 	{
653 644
 		$buff = sprintf($lang_time_gap['hours'], (int) ($gap / 60 / 60) + 1);
654
-	}
655
-	else
645
+	} else
656 646
 	{
657 647
 		$buff = zdate($date, $format);
658 648
 	}
@@ -699,12 +689,10 @@  discard block
 block discarded – undo
699 689
 				if($format == 'Y-m-d')
700 690
 				{
701 691
 					$format = 'M d, Y';
702
-				}
703
-				elseif($format == 'Y-m-d H:i:s')
692
+				} elseif($format == 'Y-m-d H:i:s')
704 693
 				{
705 694
 					$format = 'M d, Y H:i:s';
706
-				}
707
-				elseif($format == 'Y-m-d H:i')
695
+				} elseif($format == 'Y-m-d H:i')
708 696
 				{
709 697
 					$format = 'M d, Y H:i';
710 698
 				}
@@ -713,12 +701,10 @@  discard block
 block discarded – undo
713 701
 				if($format == 'Y-m-d')
714 702
 				{
715 703
 					$format = 'd-m-Y';
716
-				}
717
-				elseif($format == 'Y-m-d H:i:s')
704
+				} elseif($format == 'Y-m-d H:i:s')
718 705
 				{
719 706
 					$format = 'H:i:s d-m-Y';
720
-				}
721
-				elseif($format == 'Y-m-d H:i')
707
+				} elseif($format == 'Y-m-d H:i')
722 708
 				{
723 709
 					$format = 'H:i d-m-Y';
724 710
 				}
@@ -754,8 +740,7 @@  discard block
 block discarded – undo
754 740
 		);
755 741
 
756 742
 		$string = strtr($format, $trans);
757
-	}
758
-	else
743
+	} else
759 744
 	{
760 745
 		// if year value is greater than 1970, get unixtime by using ztime() for date() function's argument. 
761 746
 		$string = date($format, ztime($str));
@@ -842,8 +827,7 @@  discard block
 block discarded – undo
842 827
 		}
843 828
 
844 829
 		$firephp->fb($debug_output, $label, $type);
845
-	}
846
-	else
830
+	} else
847 831
 	{
848 832
 		if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR'])
849 833
 		{
@@ -855,7 +839,9 @@  discard block
 block discarded – undo
855 839
 		{
856 840
 			$debug_file = _XE_PATH_ . 'files/' . $file;
857 841
 		}
858
-		if(!file_exists($debug_file)) $print[] = '<?php exit() ?>';
842
+		if(!file_exists($debug_file)) {
843
+			$print[] = '<?php exit() ?>';
844
+		}
859 845
 
860 846
 		if($display_option === TRUE || $display_option === 'ERROR')
861 847
 		{
@@ -868,13 +854,11 @@  discard block
 block discarded – undo
868 854
 			if($display_option === 'ERROR')
869 855
 			{
870 856
 				$print[] = 'ERROR : ' . var_export($debug_output, TRUE);
871
-			}
872
-			else
857
+			} else
873 858
 			{
874 859
 				$print[] = 'DEBUG : ' . $type . '(' . var_export($debug_output, TRUE) . ')';
875 860
 			}
876
-		}
877
-		else
861
+		} else
878 862
 		{
879 863
 			$print[] = 'DEBUG : ' . trim(preg_replace('/\r?\n/', "\n" . '        ', print_r($debug_output, true)));
880 864
 		}
@@ -901,7 +885,9 @@  discard block
 block discarded – undo
901 885
  */
902 886
 function writeSlowlog($type, $elapsed_time, $obj)
903 887
 {
904
-	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) return;
888
+	if(!__LOG_SLOW_TRIGGER__ && !__LOG_SLOW_ADDON__ && !__LOG_SLOW_WIDGET__ && !__LOG_SLOW_QUERY__) {
889
+		return;
890
+	}
905 891
 
906 892
 	static $log_filename = array(
907 893
 		'query' => 'files/_slowlog_query.php',
@@ -921,25 +907,21 @@  discard block
 block discarded – undo
921 907
 	{
922 908
 		$buff[] = "\tCaller : " . $obj->caller;
923 909
 		$buff[] = "\tCalled : " . $obj->called;
924
-	}
925
-	else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
910
+	} else if($type == 'addon' && __LOG_SLOW_ADDON__ > 0 && $elapsed_time > __LOG_SLOW_ADDON__)
926 911
 	{
927 912
 		$buff[] = "\tAddon : " . $obj->called;
928 913
 		$buff[] = "\tCalled position : " . $obj->caller;
929
-	}
930
-	else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
914
+	} else if($type == 'widget' && __LOG_SLOW_WIDGET__ > 0 && $elapsed_time > __LOG_SLOW_WIDGET__)
931 915
 	{
932 916
 		$buff[] = "\tWidget : " . $obj->called;
933
-	}
934
-	else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
917
+	} else if($type == 'query' && __LOG_SLOW_QUERY__ > 0 && $elapsed_time > __LOG_SLOW_QUERY__)
935 918
 	{
936 919
 
937 920
 		$buff[] = $obj->query;
938 921
 		$buff[] = "\tQuery ID   : " . $obj->query_id;
939 922
 		$buff[] = "\tCaller     : " . $obj->caller;
940 923
 		$buff[] = "\tConnection : " . $obj->connection;
941
-	}
942
-	else
924
+	} else
943 925
 	{
944 926
 		$write_file = false;
945 927
 	}
@@ -1031,8 +1013,11 @@  discard block
 block discarded – undo
1031 1013
 
1032 1014
 	foreach($del_vars as $var)
1033 1015
 	{
1034
-		if(is_array($vars)) unset($vars[$var]);
1035
-		else if(is_object($vars)) unset($vars->$var);
1016
+		if(is_array($vars)) {
1017
+			unset($vars[$var]);
1018
+		} else if(is_object($vars)) {
1019
+			unset($vars->$var);
1020
+		}
1036 1021
 	}
1037 1022
 
1038 1023
 	return $vars;
@@ -1169,8 +1154,7 @@  discard block
 block discarded – undo
1169 1154
 		if(($close_xmp = strrpos($content, '</xmp>')) === FALSE)
1170 1155
 		{
1171 1156
 			$content .= '</xmp>';
1172
-		}
1173
-		else if($close_xmp < $start_xmp)
1157
+		} else if($close_xmp < $start_xmp)
1174 1158
 		{
1175 1159
 			$content .= '</xmp>';
1176 1160
 		}
@@ -1227,12 +1211,18 @@  discard block
 block discarded – undo
1227 1211
 
1228 1212
 	$filter_arrts = array('style', 'src', 'href');
1229 1213
 
1230
-	if($tag === 'object') array_push($filter_arrts, 'data');
1231
-	if($tag === 'param') array_push($filter_arrts, 'value');
1214
+	if($tag === 'object') {
1215
+		array_push($filter_arrts, 'data');
1216
+	}
1217
+	if($tag === 'param') {
1218
+		array_push($filter_arrts, 'value');
1219
+	}
1232 1220
 
1233 1221
 	foreach($filter_arrts as $attr)
1234 1222
 	{
1235
-		if(!isset($attrs[$attr])) continue;
1223
+		if(!isset($attrs[$attr])) {
1224
+			continue;
1225
+		}
1236 1226
 
1237 1227
 		$attr_value = rawurldecode($attrs[$attr]);
1238 1228
 		$attr_value = htmlspecialchars_decode($attr_value, ENT_COMPAT);
@@ -1395,16 +1385,14 @@  discard block
 block discarded – undo
1395 1385
 				$unicode = hexdec($unicodeHexVal);
1396 1386
 				$decodedStr .= _code2utf($unicode);
1397 1387
 				$pos += 4;
1398
-			}
1399
-			else
1388
+			} else
1400 1389
 			{
1401 1390
 				// we have an escaped ascii character
1402 1391
 				$hexVal = substr($source, $pos, 2);
1403 1392
 				$decodedStr .= chr(hexdec($hexVal));
1404 1393
 				$pos += 2;
1405 1394
 			}
1406
-		}
1407
-		else
1395
+		} else
1408 1396
 		{
1409 1397
 			$decodedStr .= $charAt;
1410 1398
 			$pos++;
@@ -1596,8 +1584,7 @@  discard block
 block discarded – undo
1596 1584
 	if(version_compare(PHP_VERSION, "5.3.0") < 0)
1597 1585
 	{
1598 1586
 		set_include_path(_XE_PATH_ . "libs/PEAR" . PATH_SEPARATOR . get_include_path());
1599
-	}
1600
-	else
1587
+	} else
1601 1588
 	{
1602 1589
 		set_include_path(_XE_PATH_ . "libs/PEAR.1.9.5" . PATH_SEPARATOR . get_include_path());
1603 1590
 	}
@@ -1634,8 +1621,7 @@  discard block
 block discarded – undo
1634 1621
 		{
1635 1622
 			return FALSE;
1636 1623
 		}
1637
-	}
1638
-	else
1624
+	} else
1639 1625
 	{
1640 1626
 		$virtualSiteInfo = $oModuleModel->getSiteInfo($siteModuleInfo->site_srl);
1641 1627
 		if(strtolower($virtualSiteInfo->domain) != strtolower(Context::get('vid')) && !strstr(strtolower($virtualSiteInfo->domain), strtolower($referer['host'])))
Please login to merge, or discard this patch.