GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( b130b6...8a2f54 )
by gyeong-won
07:36
created
modules/layout/layout.view.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -382,6 +382,9 @@  discard block
 block discarded – undo
382 382
 		$this->setTemplateFile('layout_preview');
383 383
 	}
384 384
 
385
+	/**
386
+	 * @return string
387
+	 */
385 388
 	private function getRealLayoutFile($layoutSrl)
386 389
 	{
387 390
 		$oLayoutModel = getModel('layout');
@@ -398,6 +401,9 @@  discard block
 block discarded – undo
398 401
 
399 402
 	}
400 403
 
404
+	/**
405
+	 * @return string
406
+	 */
401 407
 	private function getRealLayoutCSS($layoutSrl)
402 408
 	{
403 409
 		$oLayoutModel = getModel('layout');
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		// Get the layout information
26 26
 		$oLayoutModel = getModel('layout');
27 27
 		$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
28
-		if(!$layout_info) exit();
28
+		if (!$layout_info) exit();
29 29
 		Context::set('layout_info', $layout_info);
30 30
 		// Set the layout to be pop-up
31 31
 		$this->setLayoutFile('popup_layout');
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 			// admin check
54 54
 			// this act is admin view but in normal view because do not load admin css/js files
55 55
 			$logged_info = Context::get('logged_info');
56
-			if($logged_info->is_admin != 'Y')
56
+			if ($logged_info->is_admin != 'Y')
57 57
 			{
58 58
 				throw new Exception(Context::getLang('msg_invalid_request'));
59 59
 			}
60 60
 
61 61
 			// if module is 'ARTiCLE' and from site design setting, make content directly
62
-			if($module == 'ARTICLE' && !$mid)
62
+			if ($module == 'ARTICLE' && !$mid)
63 63
 			{
64 64
 				$oDocumentModel = getModel('document');
65 65
 				$oDocument = $oDocumentModel->getDocument(0, true);
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 				$t = Context::getLang('article_preview_title');
68 68
 
69 69
 				$c = '';
70
-				for($i = 0; $i < 4; $i++)
70
+				for ($i = 0; $i < 4; $i++)
71 71
 				{
72 72
 					$c .= '<p>';
73
-					for($j = 0; $j < 20; $j++)
73
+					for ($j = 0; $j < 20; $j++)
74 74
 					{
75
-						$c .= Context::getLang('article_preview_content') . ' ';
75
+						$c .= Context::getLang('article_preview_content').' ';
76 76
 					}
77 77
 					$c .= '</p>';
78 78
 				}
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 
88 88
 				if ($skinType == 'M')
89 89
 				{
90
-					$templatePath = _XE_PATH_ . 'modules/page/m.skins/' . $skin;
90
+					$templatePath = _XE_PATH_.'modules/page/m.skins/'.$skin;
91 91
 					$templateFile = 'mobile';
92 92
 				}
93 93
 				else
94 94
 				{
95
-					$templatePath = _XE_PATH_ . 'modules/page/skins/' . $skin;
95
+					$templatePath = _XE_PATH_.'modules/page/skins/'.$skin;
96 96
 					$templateFile = 'content';
97 97
 				}
98 98
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 			Context::set('content', $content);
109 109
 
110 110
 			// find layout
111
-			if($layoutSrl)
111
+			if ($layoutSrl)
112 112
 			{
113
-				if($layoutSrl == -1)
113
+				if ($layoutSrl == -1)
114 114
 				{
115 115
 					$site_srl = ($oModule) ? $oModule->module_info->site_srl : 0;
116
-					$designInfoFile = sprintf(_XE_PATH_ . 'files/site_design/design_%s.php', $site_srl);
116
+					$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
117 117
 					include($designInfoFile);
118 118
 
119
-					if($skinType == 'M')
119
+					if ($skinType == 'M')
120 120
 					{
121 121
 						$layoutSrl = $designInfo->mlayout_srl;
122 122
 					}
@@ -130,21 +130,21 @@  discard block
 block discarded – undo
130 130
 				$layoutInfo = $oLayoutModel->getLayout($layoutSrl);
131 131
 
132 132
 				// If there is no layout, pass it.
133
-				if($layoutInfo)
133
+				if ($layoutInfo)
134 134
 				{
135 135
 					// Adhoc...
136 136
 
137 137
 					// Input extra_vars into $layout_info
138
-					if($layoutInfo->extra_var_count)
138
+					if ($layoutInfo->extra_var_count)
139 139
 					{
140 140
 
141
-						foreach($layoutInfo->extra_var as $var_id => $val)
141
+						foreach ($layoutInfo->extra_var as $var_id => $val)
142 142
 						{
143
-							if($val->type == 'image')
143
+							if ($val->type == 'image')
144 144
 							{
145
-								if(strncmp('./files/attach/images/', $val->value, 22) === 0)
145
+								if (strncmp('./files/attach/images/', $val->value, 22) === 0)
146 146
 								{
147
-									$val->value = Context::getRequestUri() . substr($val->value, 2);
147
+									$val->value = Context::getRequestUri().substr($val->value, 2);
148 148
 								}
149 149
 							}
150 150
 							$layoutInfo->{$var_id} = $val->value;
@@ -152,25 +152,25 @@  discard block
 block discarded – undo
152 152
 					}
153 153
 
154 154
 					// Set menus into context
155
-					if($layoutInfo->menu_count)
155
+					if ($layoutInfo->menu_count)
156 156
 					{
157
-						foreach($layoutInfo->menu as $menu_id => $menu)
157
+						foreach ($layoutInfo->menu as $menu_id => $menu)
158 158
 						{
159 159
 							// set default menu set(included home menu)
160
-							if(!$menu->menu_srl || $menu->menu_srl == -1)
160
+							if (!$menu->menu_srl || $menu->menu_srl == -1)
161 161
 							{
162 162
 								$oMenuAdminController = getAdminController('menu');
163 163
 								$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
164 164
 
165
-								if(file_exists($homeMenuCacheFile))
165
+								if (file_exists($homeMenuCacheFile))
166 166
 								{
167 167
 									include($homeMenuCacheFile);
168 168
 								}
169 169
 
170
-								if(!$menu->menu_srl)
170
+								if (!$menu->menu_srl)
171 171
 								{
172
-									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
173
-									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
172
+									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl.'.xml.php', $menu->xml_file);
173
+									$menu->php_file = str_replace('.php', $homeMenuSrl.'.php', $menu->php_file);
174 174
 									$layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl;
175 175
 								}
176 176
 								else
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 							}
182 182
 
183 183
 							$menu->php_file = FileHandler::getRealPath($menu->php_file);
184
-							if(FileHandler::exists($menu->php_file))
184
+							if (FileHandler::exists($menu->php_file))
185 185
 							{
186 186
 								include($menu->php_file);
187 187
 							}
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 				}
194 194
 			}
195 195
 		}
196
-		catch(Exception $e)
196
+		catch (Exception $e)
197 197
 		{
198
-			$content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>';
198
+			$content = '<div class="message error"><p id="preview_error">'.$e->getMessage().'</p></div>';
199 199
 			Context::set('content', $content);
200 200
 			$layoutSrl = 0;
201 201
 		}
@@ -204,12 +204,12 @@  discard block
 block discarded – undo
204 204
 		$oTemplate = TemplateHandler::getInstance();
205 205
 		Context::clearHtmlHeader();
206 206
 
207
-		if($layoutInfo)
207
+		if ($layoutInfo)
208 208
 		{
209 209
 			$layout_path = $layoutInfo->path;
210 210
 			$editLayoutTPL = $this->getRealLayoutFile($layoutSrl);
211 211
 			$editLayoutCSS = $this->getRealLayoutCSS($layoutSrl);
212
-			if($editLayoutCSS != '')
212
+			if ($editLayoutCSS != '')
213 213
 			{
214 214
 				Context::addCSSFile($editLayoutCSS);
215 215
 			}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		}
226 226
 
227 227
 		$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $editLayoutTPL);
228
-		Context::set('layout','none');
228
+		Context::set('layout', 'none');
229 229
 
230 230
 		// Convert widgets and others
231 231
 		$oContext = Context::getInstance();
@@ -246,18 +246,18 @@  discard block
 block discarded – undo
246 246
 	private function procRealModule($module, $mid, $skin, $skinType)
247 247
 	{
248 248
 		// if form site design and preview module, find target module
249
-		if($module && !$mid)
249
+		if ($module && !$mid)
250 250
 		{
251 251
 			$args = new stdClass();
252 252
 			$args->module = $module;
253 253
 			$output = executeQuery('layout.getOneModuleInstanceByModuleName', $args);
254
-			if(!$output->toBool())
254
+			if (!$output->toBool())
255 255
 			{
256 256
 				throw new Exception($output->getMessage());
257 257
 			}
258 258
 
259 259
 			// if there is no module instance, error...
260
-			if(!$output->data)
260
+			if (!$output->data)
261 261
 			{
262 262
 				throw new Exception(Context::getLang('msg_unabled_preview'));
263 263
 			}
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		}
267 267
 
268 268
 		// if form site design and preview layout, find start module
269
-		elseif(!$module && !$mid)
269
+		elseif (!$module && !$mid)
270 270
 		{
271 271
 			$oModuleModel = getModel('module');
272 272
 			$columnList = array('modules.mid', 'sites.index_module_srl');
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		$oModuleHandler->module_info->is_skin_fix = 'Y';
287 287
 		$oModuleHandler->module_info->is_mskin_fix = 'Y';
288 288
 
289
-		if($skinType == 'M')
289
+		if ($skinType == 'M')
290 290
 		{
291 291
 			Mobile::setMobile(TRUE);
292 292
 			$oModuleHandler->module_info->mskin = $skin;
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
 
300 300
 		// Proc module
301 301
 		$oModule = $oModuleHandler->procModule();
302
-		if(!$oModule->toBool())
302
+		if (!$oModule->toBool())
303 303
 		{
304 304
 			throw new Exception(Context::getLang('not_support_layout_preview'));
305 305
 		}
306 306
 
307 307
 		// get module html
308
-		require_once(_XE_PATH_ . "classes/display/HTMLDisplayHandler.php");
308
+		require_once(_XE_PATH_."classes/display/HTMLDisplayHandler.php");
309 309
 		$handler = new HTMLDisplayHandler();
310 310
 		return $handler->toDoc($oModule);
311 311
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	function dispLayoutPreview()
318 318
 	{
319
-		if(!checkCSRF())
319
+		if (!checkCSRF())
320 320
 		{
321 321
 			$this->stop('msg_invalid_request');
322 322
 			return new BaseObject(-1, 'msg_invalid_request');
@@ -325,36 +325,36 @@  discard block
 block discarded – undo
325 325
 		// admin check
326 326
 		// this act is admin view but in normal view because do not load admin css/js files
327 327
 		$logged_info = Context::get('logged_info');
328
-		if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
328
+		if ($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
329 329
 
330 330
 		$layout_srl = Context::get('layout_srl');
331 331
 		$code = Context::get('code');
332 332
 
333 333
 		$code_css = Context::get('code_css');
334
-		if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
334
+		if (!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
335 335
 		// Get the layout information
336 336
 		$oLayoutModel = getModel('layout');
337 337
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
338
-		if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
338
+		if (!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
339 339
 		// Separately handle the layout if its type is faceoff
340
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
340
+		if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
341 341
 		// Apply CSS directly
342 342
 		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
343 343
 		// Set names and values of extra_vars to $layout_info
344
-		if($layout_info->extra_var_count)
344
+		if ($layout_info->extra_var_count)
345 345
 		{
346
-			foreach($layout_info->extra_var as $var_id => $val)
346
+			foreach ($layout_info->extra_var as $var_id => $val)
347 347
 			{
348 348
 				$layout_info->{$var_id} = $val->value;
349 349
 			}
350 350
 		}
351 351
 		// menu in layout information becomes an argument for Context:: set
352
-		if($layout_info->menu_count)
352
+		if ($layout_info->menu_count)
353 353
 		{
354
-			foreach($layout_info->menu as $menu_id => $menu)
354
+			foreach ($layout_info->menu as $menu_id => $menu)
355 355
 			{
356 356
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
357
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
357
+				if (FileHandler::exists($menu->php_file)) include($menu->php_file);
358 358
 
359 359
 				Context::set($menu_id, $menu);
360 360
 			}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		Context::set('layout_info', $layout_info);
364 364
 		Context::set('content', Context::getLang('layout_preview_content'));
365 365
 		// Temporary save the codes
366
-		$edited_layout_file = _XE_PATH_ . 'files/cache/layout/tmp.tpl';
366
+		$edited_layout_file = _XE_PATH_.'files/cache/layout/tmp.tpl';
367 367
 		FileHandler::writeFile($edited_layout_file, $code);
368 368
 
369 369
 		// Compile
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		$layout_file = 'layout';
374 374
 
375 375
 		$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
376
-		Context::set('layout','none');
376
+		Context::set('layout', 'none');
377 377
 		// Convert widgets and others
378 378
 		$oContext = &Context::getInstance();
379 379
 		Context::set('layout_tpl', $layout_tpl);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		$oLayoutModel = getModel('layout');
388 388
 		$layoutFile = $oLayoutModel->getUserLayoutHtml($layoutSrl);
389 389
 
390
-		if(file_exists($layoutFile))
390
+		if (file_exists($layoutFile))
391 391
 		{
392 392
 			return $layoutFile;
393 393
 		}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$oLayoutModel = getModel('layout');
404 404
 		$cssFile = $oLayoutModel->getUserLayoutCss($layoutSrl);
405 405
 
406
-		if(file_exists($cssFile))
406
+		if (file_exists($cssFile))
407 407
 		{
408 408
 			return $cssFile;
409 409
 		}
Please login to merge, or discard this patch.
Braces   +26 added lines, -22 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 		// Get the layout information
26 26
 		$oLayoutModel = getModel('layout');
27 27
 		$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
28
-		if(!$layout_info) exit();
28
+		if(!$layout_info) {
29
+			exit();
30
+		}
29 31
 		Context::set('layout_info', $layout_info);
30 32
 		// Set the layout to be pop-up
31 33
 		$this->setLayoutFile('popup_layout');
@@ -89,8 +91,7 @@  discard block
 block discarded – undo
89 91
 				{
90 92
 					$templatePath = _XE_PATH_ . 'modules/page/m.skins/' . $skin;
91 93
 					$templateFile = 'mobile';
92
-				}
93
-				else
94
+				} else
94 95
 				{
95 96
 					$templatePath = _XE_PATH_ . 'modules/page/skins/' . $skin;
96 97
 					$templateFile = 'content';
@@ -119,8 +120,7 @@  discard block
 block discarded – undo
119 120
 					if($skinType == 'M')
120 121
 					{
121 122
 						$layoutSrl = $designInfo->mlayout_srl;
122
-					}
123
-					else
123
+					} else
124 124
 					{
125 125
 						$layoutSrl = $designInfo->layout_srl;
126 126
 					}
@@ -172,8 +172,7 @@  discard block
 block discarded – undo
172 172
 									$menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file);
173 173
 									$menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file);
174 174
 									$layoutInfo->menu->{$menu_id}->menu_srl = $homeMenuSrl;
175
-								}
176
-								else
175
+								} else
177 176
 								{
178 177
 									$menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file);
179 178
 									$menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file);
@@ -192,8 +191,7 @@  discard block
 block discarded – undo
192 191
 					Context::set('layout_info', $layoutInfo);
193 192
 				}
194 193
 			}
195
-		}
196
-		catch(Exception $e)
194
+		} catch(Exception $e)
197 195
 		{
198 196
 			$content = '<div class="message error"><p id="preview_error">' . $e->getMessage() . '</p></div>';
199 197
 			Context::set('content', $content);
@@ -217,8 +215,7 @@  discard block
 block discarded – undo
217 215
 			$oModuleModel = getModel('module');
218 216
 			$part_config = $oModuleModel->getModulePartConfig('layout', $layoutSrl);
219 217
 			Context::addHtmlHeader($part_config->header_script);
220
-		}
221
-		else
218
+		} else
222 219
 		{
223 220
 			$layout_path = './common/tpl';
224 221
 			$layout_file = 'default_layout';
@@ -290,8 +287,7 @@  discard block
 block discarded – undo
290 287
 		{
291 288
 			Mobile::setMobile(TRUE);
292 289
 			$oModuleHandler->module_info->mskin = $skin;
293
-		}
294
-		else
290
+		} else
295 291
 		{
296 292
 			Mobile::setMobile(FALSE);
297 293
 			$oModuleHandler->module_info->skin = $skin;
@@ -325,19 +321,27 @@  discard block
 block discarded – undo
325 321
 		// admin check
326 322
 		// this act is admin view but in normal view because do not load admin css/js files
327 323
 		$logged_info = Context::get('logged_info');
328
-		if($logged_info->is_admin != 'Y') return $this->stop('msg_invalid_request');
324
+		if($logged_info->is_admin != 'Y') {
325
+			return $this->stop('msg_invalid_request');
326
+		}
329 327
 
330 328
 		$layout_srl = Context::get('layout_srl');
331 329
 		$code = Context::get('code');
332 330
 
333 331
 		$code_css = Context::get('code_css');
334
-		if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
332
+		if(!$layout_srl || !$code) {
333
+			return new BaseObject(-1, 'msg_invalid_request');
334
+		}
335 335
 		// Get the layout information
336 336
 		$oLayoutModel = getModel('layout');
337 337
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
338
-		if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
338
+		if(!$layout_info) {
339
+			return new BaseObject(-1, 'msg_invalid_request');
340
+		}
339 341
 		// Separately handle the layout if its type is faceoff
340
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
342
+		if($layout_info && $layout_info->type == 'faceoff') {
343
+			$oLayoutModel->doActivateFaceOff($layout_info);
344
+		}
341 345
 		// Apply CSS directly
342 346
 		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
343 347
 		// Set names and values of extra_vars to $layout_info
@@ -354,7 +358,9 @@  discard block
 block discarded – undo
354 358
 			foreach($layout_info->menu as $menu_id => $menu)
355 359
 			{
356 360
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
357
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
361
+				if(FileHandler::exists($menu->php_file)) {
362
+					include($menu->php_file);
363
+				}
358 364
 
359 365
 				Context::set($menu_id, $menu);
360 366
 			}
@@ -390,8 +396,7 @@  discard block
 block discarded – undo
390 396
 		if(file_exists($layoutFile))
391 397
 		{
392 398
 			return $layoutFile;
393
-		}
394
-		else
399
+		} else
395 400
 		{
396 401
 			return ''; 
397 402
 		}
@@ -406,8 +411,7 @@  discard block
 block discarded – undo
406 411
 		if(file_exists($cssFile))
407 412
 		{
408 413
 			return $cssFile;
409
-		}
410
-		else
414
+		} else
411 415
 		{
412 416
 			return ''; 
413 417
 		}
Please login to merge, or discard this patch.
modules/comment/comment.item.php 1 patch
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	function _loadFromDB()
51 51
 	{
52
-		if(!$this->comment_srl)
52
+		if (!$this->comment_srl)
53 53
 		{
54 54
 			return;
55 55
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	function setAttribute($attribute)
69 69
 	{
70
-		if(!$attribute->comment_srl)
70
+		if (!$attribute->comment_srl)
71 71
 		{
72 72
 			$this->comment_srl = NULL;
73 73
 			return;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 		$this->adds($attribute);
78 78
 
79 79
 		// define vars on the object for backward compatibility of skins
80
-		if(count($attribute))
80
+		if (count($attribute))
81 81
 		{
82
-			foreach($attribute as $key => $val)
82
+			foreach ($attribute as $key => $val)
83 83
 			{
84 84
 				$this->{$key} = $val;
85 85
 			}
@@ -93,29 +93,29 @@  discard block
 block discarded – undo
93 93
 
94 94
 	function isGranted()
95 95
 	{
96
-		if($_SESSION['own_comment'][$this->comment_srl])
96
+		if ($_SESSION['own_comment'][$this->comment_srl])
97 97
 		{
98 98
 			return TRUE;
99 99
 		}
100 100
 
101
-		if(!Context::get('is_logged'))
101
+		if (!Context::get('is_logged'))
102 102
 		{
103 103
 			return FALSE;
104 104
 		}
105 105
 
106 106
 		$logged_info = Context::get('logged_info');
107
-		if($logged_info->is_admin == 'Y')
107
+		if ($logged_info->is_admin == 'Y')
108 108
 		{
109 109
 			return TRUE;
110 110
 		}
111 111
 
112 112
 		$grant = Context::get('grant');
113
-		if($grant->manager)
113
+		if ($grant->manager)
114 114
 		{
115 115
 			return TRUE;
116 116
 		}
117 117
 
118
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
118
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl))
119 119
 		{
120 120
 			return TRUE;
121 121
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 	function isEditable()
138 138
 	{
139
-		if($this->isGranted() || !$this->get('member_srl'))
139
+		if ($this->isGranted() || !$this->get('member_srl'))
140 140
 		{
141 141
 			return TRUE;
142 142
 		}
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
 
151 151
 	function isAccessible()
152 152
 	{
153
-		if($_SESSION['accessibled_comment'][$this->comment_srl])
153
+		if ($_SESSION['accessibled_comment'][$this->comment_srl])
154 154
 		{
155 155
 			return TRUE;
156 156
 		}
157 157
 
158
-		if($this->isGranted() || !$this->isSecret())
158
+		if ($this->isGranted() || !$this->isSecret())
159 159
 		{
160 160
 			$this->setAccessible();
161 161
 			return TRUE;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oDocumentModel = getModel('document');
165 165
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
166
-		if($oDocument->isGranted())
166
+		if ($oDocument->isGranted())
167 167
 		{
168 168
 			$this->setAccessible();
169 169
 			return TRUE;
@@ -184,20 +184,20 @@  discard block
 block discarded – undo
184 184
 	function notify($type, $content)
185 185
 	{
186 186
 		// return if not useNotify
187
-		if(!$this->useNotify())
187
+		if (!$this->useNotify())
188 188
 		{
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		// pass if the author is not logged-in user 
193
-		if(!$this->get('member_srl'))
193
+		if (!$this->get('member_srl'))
194 194
 		{
195 195
 			return;
196 196
 		}
197 197
 
198 198
 		// return if the currently logged-in user is an author of the comment.
199 199
 		$logged_info = Context::get('logged_info');
200
-		if($logged_info->member_srl == $this->get('member_srl'))
200
+		if ($logged_info->member_srl == $this->get('member_srl'))
201 201
 		{
202 202
 			return;
203 203
 		}
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 		$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
208 208
 
209 209
 		// Variables
210
-		if($type)
210
+		if ($type)
211 211
 		{
212
-			$title = "[" . $type . "] ";
212
+			$title = "[".$type."] ";
213 213
 		}
214 214
 
215 215
 		$title .= cut_str(strip_tags($content), 30, '...');
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 
225 225
 	function getIpAddress()
226 226
 	{
227
-		if($this->isGranted())
227
+		if ($this->isGranted())
228 228
 		{
229 229
 			return $this->get('ipaddress');
230 230
 		}
231 231
 
232
-		return '*' . strstr($this->get('ipaddress'), '.');
232
+		return '*'.strstr($this->get('ipaddress'), '.');
233 233
 	}
234 234
 
235 235
 	function isExistsHomepage()
236 236
 	{
237
-		if(trim($this->get('homepage')))
237
+		if (trim($this->get('homepage')))
238 238
 		{
239 239
 			return TRUE;
240 240
 		}
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 	function getHomepageUrl()
246 246
 	{
247 247
 		$url = trim($this->get('homepage'));
248
-		if(!$url)
248
+		if (!$url)
249 249
 		{
250 250
 			return;
251 251
 		}
252 252
 
253
-		if(strncasecmp('http://', $url, 7) !== 0)
253
+		if (strncasecmp('http://', $url, 7) !== 0)
254 254
 		{
255
-			$url = "http://" . $url;
255
+			$url = "http://".$url;
256 256
 		}
257 257
 
258 258
 		return htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
@@ -284,14 +284,14 @@  discard block
 block discarded – undo
284 284
 	 */
285 285
 	function getContentText($strlen = 0)
286 286
 	{
287
-		if($this->isSecret() && !$this->isAccessible())
287
+		if ($this->isSecret() && !$this->isAccessible())
288 288
 		{
289 289
 			return Context::getLang('msg_is_secret');
290 290
 		}
291 291
 
292 292
 		$content = $this->get('content');
293 293
 
294
-		if($strlen)
294
+		if ($strlen)
295 295
 		{
296 296
 			return cut_str(strip_tags($content), $strlen, '...');
297 297
 		}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	 */
306 306
 	function getContent($add_popup_menu = TRUE, $add_content_info = TRUE, $add_xe_content_class = TRUE)
307 307
 	{
308
-		if($this->isSecret() && !$this->isAccessible())
308
+		if ($this->isSecret() && !$this->isAccessible())
309 309
 		{
310 310
 			return Context::getLang('msg_is_secret');
311 311
 		}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		stripEmbedTagForAdmin($content, $this->get('member_srl'));
315 315
 
316 316
 		// when displaying the comment on the pop-up menu
317
-		if($add_popup_menu && Context::get('is_logged'))
317
+		if ($add_popup_menu && Context::get('is_logged'))
318 318
 		{
319 319
 			$content = sprintf(
320 320
 					'%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>', $content, $this->comment_srl, Context::getLang('cmd_comment_do')
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 		}
323 323
 
324 324
 		// if additional information which can access contents is set
325
-		if($add_content_info)
325
+		if ($add_content_info)
326 326
 		{
327 327
 			$memberSrl = $this->get('member_srl');
328
-			if($memberSrl < 0)
328
+			if ($memberSrl < 0)
329 329
 			{
330 330
 				$memberSrl = 0;
331 331
 			}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		}
337 337
 		else
338 338
 		{
339
-			if($add_xe_content_class)
339
+			if ($add_xe_content_class)
340 340
 			{
341 341
 				$content = sprintf('<div class="xe_content">%s</div>', $content);
342 342
 			}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
 	function getRegdateGM()
398 398
 	{
399
-		return $this->getRegdate('D, d M Y H:i:s') . ' ' . $GLOBALS['_time_zone'];
399
+		return $this->getRegdate('D, d M Y H:i:s').' '.$GLOBALS['_time_zone'];
400 400
 	}
401 401
 
402 402
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 	function getPermanentUrl()
408 408
 	{
409
-		return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')) . '#comment_' . $this->get('comment_srl');
409
+		return getFullUrl('', 'mid', $this->getCommentMid(), 'document_srl', $this->get('document_srl')).'#comment_'.$this->get('comment_srl');
410 410
 	}
411 411
 
412 412
 	function getUpdateTime()
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 
428 428
 	function hasUploadedFiles()
429 429
 	{
430
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
430
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
431 431
 		{
432 432
 			return FALSE;
433 433
 		}
@@ -436,12 +436,12 @@  discard block
 block discarded – undo
436 436
 
437 437
 	function getUploadedFiles()
438 438
 	{
439
-		if(($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
439
+		if (($this->isSecret() && !$this->isAccessible()) && !$this->isGranted())
440 440
 		{
441 441
 			return;
442 442
 		}
443 443
 
444
-		if(!$this->get('uploaded_count'))
444
+		if (!$this->get('uploaded_count'))
445 445
 		{
446 446
 			return;
447 447
 		}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	function getEditor()
459 459
 	{
460 460
 		$module_srl = $this->get('module_srl');
461
-		if(!$module_srl)
461
+		if (!$module_srl)
462 462
 		{
463 463
 			$module_srl = Context::get('module_srl');
464 464
 		}
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	function getProfileImage()
474 474
 	{
475
-		if(!$this->isExists() || !$this->get('member_srl'))
475
+		if (!$this->isExists() || !$this->get('member_srl'))
476 476
 		{
477 477
 			return;
478 478
 		}
479 479
 		$oMemberModel = getModel('member');
480 480
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
481
-		if(!$profile_info)
481
+		if (!$profile_info)
482 482
 		{
483 483
 			return;
484 484
 		}
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	function getSignature()
494 494
 	{
495 495
 		// pass if the posting not exists.
496
-		if(!$this->isExists() || !$this->get('member_srl'))
496
+		if (!$this->isExists() || !$this->get('member_srl'))
497 497
 		{
498 498
 			return;
499 499
 		}
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
504 504
 
505 505
 		// check if max height of the signiture is specified on the member module
506
-		if(!isset($GLOBALS['__member_signature_max_height']))
506
+		if (!isset($GLOBALS['__member_signature_max_height']))
507 507
 		{
508 508
 			$oModuleModel = getModel('module');
509 509
 			$member_config = $oModuleModel->getModuleConfig('member');
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$max_signature_height = $GLOBALS['__member_signature_max_height'];
514 514
 
515
-		if($max_signature_height)
515
+		if ($max_signature_height)
516 516
 		{
517 517
 			$signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
518 518
 		}
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 
523 523
 	function thumbnailExists($width = 80, $height = 0, $type = '')
524 524
 	{
525
-		if(!$this->comment_srl)
525
+		if (!$this->comment_srl)
526 526
 		{
527 527
 			return FALSE;
528 528
 		}
529 529
 
530
-		if(!$this->getThumbnail($width, $height, $type))
530
+		if (!$this->getThumbnail($width, $height, $type))
531 531
 		{
532 532
 			return FALSE;
533 533
 		}
@@ -538,42 +538,42 @@  discard block
 block discarded – undo
538 538
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
539 539
 	{
540 540
 		// return false if no doc exists
541
-		if(!$this->comment_srl)
541
+		if (!$this->comment_srl)
542 542
 		{
543 543
 			return;
544 544
 		}
545 545
 
546
-		if($this->isSecret() && !$this->isGranted())
546
+		if ($this->isSecret() && !$this->isGranted())
547 547
 		{
548 548
 			return;
549 549
 		}
550 550
 
551 551
 		// If signiture height setting is omitted, create a square
552
-		if(!$height)
552
+		if (!$height)
553 553
 		{
554 554
 			$height = $width;
555 555
 		}
556 556
 
557 557
 		$content = $this->get('content');
558
-		if(!$this->hasUploadedFiles())
558
+		if (!$this->hasUploadedFiles())
559 559
 		{
560
-			if(!$content)
560
+			if (!$content)
561 561
 			{
562 562
 				$args = new stdClass();
563 563
 				$args->comment_srl = $this->comment_srl;
564 564
 				$output = executeQuery('document.getComment', $args, array('content'));
565
-				if($output->toBool() && $output->data)
565
+				if ($output->toBool() && $output->data)
566 566
 				{
567 567
 					$content = $output->data->content;
568 568
 					$this->add('content', $content);
569 569
 				}
570 570
 			}
571 571
 
572
-			if(!preg_match("!<img!is", $content)) return;
572
+			if (!preg_match("!<img!is", $content)) return;
573 573
 		}
574 574
 
575 575
 		// get thumbail generation info on the doc module configuration.
576
-		if(!in_array($thumbnail_type, array('crop', 'ratio')))
576
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
577 577
 		{
578 578
 			$thumbnail_type = 'crop';
579 579
 		}
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
 		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->comment_srl, 3));
583 583
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
584 584
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
585
-		$thumbnail_url = Context::getRequestUri() . $thumbnail_file;
585
+		$thumbnail_url = Context::getRequestUri().$thumbnail_file;
586 586
 
587 587
 		// return false if a size of existing thumbnail file is 0. otherwise return the file path
588
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
588
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
589 589
 		{
590
-			if(filesize($thumbnail_file) < 1)
590
+			if (filesize($thumbnail_file) < 1)
591 591
 			{
592 592
 				return FALSE;
593 593
 			}
@@ -605,33 +605,33 @@  discard block
 block discarded – undo
605 605
 		$is_tmp_file = FALSE;
606 606
 
607 607
 		// find an image file among attached files
608
-		if($this->hasUploadedFiles())
608
+		if ($this->hasUploadedFiles())
609 609
 		{
610 610
 			$file_list = $this->getUploadedFiles();
611 611
 
612 612
 			$first_image = null;
613
-			foreach($file_list as $file)
613
+			foreach ($file_list as $file)
614 614
 			{
615
-				if($file->direct_download !== 'Y') continue;
615
+				if ($file->direct_download !== 'Y') continue;
616 616
 
617
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
617
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
618 618
 				{
619 619
 					$source_file = $file->uploaded_filename;
620 620
 					break;
621 621
 				}
622 622
 
623
-				if($first_image) continue;
623
+				if ($first_image) continue;
624 624
 
625
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
625
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
626 626
 				{
627
-					if(file_exists($file->uploaded_filename))
627
+					if (file_exists($file->uploaded_filename))
628 628
 					{
629 629
 						$first_image = $file->uploaded_filename;
630 630
 					}
631 631
 				}
632 632
 			}
633 633
 
634
-			if(!$source_file && $first_image)
634
+			if (!$source_file && $first_image)
635 635
 			{
636 636
 				$source_file = $first_image;
637 637
 			}
@@ -639,31 +639,31 @@  discard block
 block discarded – undo
639 639
 
640 640
 		// get an image file from the doc content if no file attached. 
641 641
 		$is_tmp_file = false;
642
-		if(!$source_file)
642
+		if (!$source_file)
643 643
 		{
644 644
 			$random = new Password();
645 645
 
646 646
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
647 647
 
648
-			foreach($matches as $target_image)
648
+			foreach ($matches as $target_image)
649 649
 			{
650 650
 				$target_src = trim($target_image[1]);
651
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
651
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
652 652
 
653
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
653
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
654 654
 				{
655 655
 					$target_src = Context::getRequestUri().$target_src;
656 656
 				}
657 657
 
658 658
 				$target_src = htmlspecialchars_decode($target_src);
659 659
 
660
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
660
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
661 661
 				FileHandler::getRemoteFile($target_src, $tmp_file);
662
-				if(!file_exists($tmp_file)) continue;
662
+				if (!file_exists($tmp_file)) continue;
663 663
 
664 664
 				$imageinfo = getimagesize($tmp_file);
665 665
 				list($_w, $_h) = $imageinfo;
666
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
666
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
667 667
 					FileHandler::removeFile($tmp_file);
668 668
 					continue;
669 669
 				}
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 		$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
678 678
 
679 679
 		// Remove source file if it was temporary
680
-		if($is_tmp_file)
680
+		if ($is_tmp_file)
681 681
 		{
682 682
 			FileHandler::removeFile($source_file);
683 683
 		}
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 		FileHandler::removeFile($thumbnail_lockfile);
687 687
 
688 688
 		// Return the thumbnail path if it was successfully generated
689
-		if($output)
689
+		if ($output)
690 690
 		{
691 691
 			return $thumbnail_url;
692 692
 		}
693 693
 		// Create an empty file if thumbnail generation failed
694 694
 		else
695 695
 		{
696
-			FileHandler::writeFile($thumbnail_file, '','w');
696
+			FileHandler::writeFile($thumbnail_file, '', 'w');
697 697
 		}
698 698
 
699 699
 		return;
Please login to merge, or discard this patch.
widgets/content/content.class.php 1 patch
Spacing   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -18,48 +18,48 @@  discard block
 block discarded – undo
18 18
 	function proc($args)
19 19
 	{
20 20
 		// Targets to sort
21
-		if(!in_array($args->order_target, array('regdate','update_order'))) $args->order_target = 'regdate';
21
+		if (!in_array($args->order_target, array('regdate', 'update_order'))) $args->order_target = 'regdate';
22 22
 		// Sort order
23
-		if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc';
23
+		if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
24 24
 		// Pages
25
-		$args->page_count = (int)$args->page_count;
26
-		if(!$args->page_count) $args->page_count = 1;
25
+		$args->page_count = (int) $args->page_count;
26
+		if (!$args->page_count) $args->page_count = 1;
27 27
 		// The number of displayed lists
28
-		$args->list_count = (int)$args->list_count;
29
-		if(!$args->list_count) $args->list_count = 5;
28
+		$args->list_count = (int) $args->list_count;
29
+		if (!$args->list_count) $args->list_count = 5;
30 30
 		// The number of thumbnail columns
31
-		$args->cols_list_count = (int)$args->cols_list_count;
32
-		if(!$args->cols_list_count) $args->cols_list_count = 5;
31
+		$args->cols_list_count = (int) $args->cols_list_count;
32
+		if (!$args->cols_list_count) $args->cols_list_count = 5;
33 33
 		// Cut the length of the title
34
-		if(!$args->subject_cut_size) $args->subject_cut_size = 0;
34
+		if (!$args->subject_cut_size) $args->subject_cut_size = 0;
35 35
 		// Cut the length of contents
36
-		if(!$args->content_cut_size) $args->content_cut_size = 100;
36
+		if (!$args->content_cut_size) $args->content_cut_size = 100;
37 37
 		// Cut the length of nickname
38
-		if(!$args->nickname_cut_size) $args->nickname_cut_size = 0;
38
+		if (!$args->nickname_cut_size) $args->nickname_cut_size = 0;
39 39
 		// Display time of the latest post
40
-		if(!$args->duration_new) $args->duration_new = 12;
40
+		if (!$args->duration_new) $args->duration_new = 12;
41 41
 		// How to create thumbnails
42
-		if(!$args->thumbnail_type) $args->thumbnail_type = 'crop';
42
+		if (!$args->thumbnail_type) $args->thumbnail_type = 'crop';
43 43
 		// Horizontal size of thumbnails
44
-		if(!$args->thumbnail_width) $args->thumbnail_width = 100;
44
+		if (!$args->thumbnail_width) $args->thumbnail_width = 100;
45 45
 		// Vertical size of thumbnails
46
-		if(!$args->thumbnail_height) $args->thumbnail_height = 75;
46
+		if (!$args->thumbnail_height) $args->thumbnail_height = 75;
47 47
 		// Viewing options
48
-		$args->option_view_arr = explode(',',$args->option_view);
48
+		$args->option_view_arr = explode(',', $args->option_view);
49 49
 		// markup options
50
-		if(!$args->markup_type) $args->markup_type = 'table';
50
+		if (!$args->markup_type) $args->markup_type = 'table';
51 51
 		// Set variables used internally
52 52
 		$oModuleModel = getModel('module');
53 53
 		$module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array();
54 54
 		$site_module_info = Context::get('site_module_info');
55 55
 		// List URLs if a type is RSS
56
-		if($args->content_type == 'rss')
56
+		if ($args->content_type == 'rss')
57 57
 		{
58 58
 			$args->rss_urls = array();
59
-			$rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4));
60
-			for($i=0,$c=count($rss_urls);$i<$c;$i++)
59
+			$rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4));
60
+			for ($i = 0, $c = count($rss_urls); $i < $c; $i++)
61 61
 			{
62
-				if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
62
+				if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
63 63
 			}
64 64
 			// Get module information after listing module_srls if the module is not RSS
65 65
 		}
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 		{
68 68
 			$obj = new stdClass();
69 69
 			// Apply to all modules in the site if a target module is not specified
70
-			if(!$args->module_srls)
70
+			if (!$args->module_srls)
71 71
 			{
72
-				$obj->site_srl = (int)$site_module_info->site_srl;
72
+				$obj->site_srl = (int) $site_module_info->site_srl;
73 73
 				$output = executeQueryArray('widgets.content.getMids', $obj);
74
-				if($output->data)
74
+				if ($output->data)
75 75
 				{
76
-					foreach($output->data as $key => $val)
76
+					foreach ($output->data as $key => $val)
77 77
 					{
78 78
 						$args->modules_info[$val->mid] = $val;
79 79
 						$args->module_srls_info[$val->module_srl] = $val;
@@ -89,35 +89,35 @@  discard block
 block discarded – undo
89 89
 			{
90 90
 				$obj->module_srls = $args->module_srls;
91 91
 				$output = executeQueryArray('widgets.content.getMids', $obj);
92
-				if($output->data)
92
+				if ($output->data)
93 93
 				{
94
-					foreach($output->data as $key => $val)
94
+					foreach ($output->data as $key => $val)
95 95
 					{
96 96
 						$args->modules_info[$val->mid] = $val;
97 97
 						$args->module_srls_info[$val->module_srl] = $val;
98 98
 						$module_srls[] = $val->module_srl;
99 99
 					}
100
-					$idx = explode(',',$args->module_srls);
101
-					for($i=0,$c=count($idx);$i<$c;$i++)
100
+					$idx = explode(',', $args->module_srls);
101
+					for ($i = 0, $c = count($idx); $i < $c; $i++)
102 102
 					{
103 103
 						$srl = $idx[$i];
104
-						if(!$args->module_srls_info[$srl]) continue;
104
+						if (!$args->module_srls_info[$srl]) continue;
105 105
 						$args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid;
106 106
 					}
107 107
 				}
108 108
 			}
109 109
 			// Exit if no module is found
110
-			if(!count($args->modules_info)) return Context::get('msg_not_founded');
111
-			$args->module_srl = implode(',',$module_srls);
110
+			if (!count($args->modules_info)) return Context::get('msg_not_founded');
111
+			$args->module_srl = implode(',', $module_srls);
112 112
 		}
113 113
 
114 114
 		/**
115 115
 		 * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist
116 116
 		 */
117 117
 		// tab type
118
-		if($args->tab_type == 'none' || $args->tab_type == '')
118
+		if ($args->tab_type == 'none' || $args->tab_type == '')
119 119
 		{
120
-			switch($args->content_type)
120
+			switch ($args->content_type)
121 121
 			{
122 122
 				case 'comment':
123 123
 					$content_items = $this->_getCommentItems($args);
@@ -141,17 +141,17 @@  discard block
 block discarded – undo
141 141
 		{
142 142
 			$content_items = array();
143 143
 
144
-			switch($args->content_type)
144
+			switch ($args->content_type)
145 145
 			{
146 146
 				case 'comment':
147
-					foreach($args->mid_lists as $module_srl => $mid)
147
+					foreach ($args->mid_lists as $module_srl => $mid)
148 148
 					{
149 149
 						$args->module_srl = $module_srl;
150 150
 						$content_items[$module_srl] = $this->_getCommentItems($args);
151 151
 					}
152 152
 					break;
153 153
 				case 'image':
154
-					foreach($args->mid_lists as $module_srl => $mid)
154
+					foreach ($args->mid_lists as $module_srl => $mid)
155 155
 					{
156 156
 						$args->module_srl = $module_srl;
157 157
 						$content_items[$module_srl] = $this->_getImageItems($args);
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 					$content_items = $this->getRssItems($args);
162 162
 					break;
163 163
 				case 'trackback':
164
-					foreach($args->mid_lists as $module_srl => $mid)
164
+					foreach ($args->mid_lists as $module_srl => $mid)
165 165
 					{
166 166
 						$args->module_srl = $module_srl;
167 167
 						$content_items[$module_srl] = $this->_getTrackbackItems($args);
168 168
 					}
169 169
 					break;
170 170
 				default:
171
-					foreach($args->mid_lists as $module_srl => $mid)
171
+					foreach ($args->mid_lists as $module_srl => $mid)
172 172
 					{
173 173
 						$args->module_srl = $module_srl;
174 174
 						$content_items[$module_srl] = $this->_getDocumentItems($args);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			}
178 178
 		}
179 179
 
180
-		$output = $this->_compile($args,$content_items);
180
+		$output = $this->_compile($args, $content_items);
181 181
 		return $output;
182 182
 	}
183 183
 
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$content_items = array();
199 199
 
200
-		if(!count($output)) return;
200
+		if (!count($output)) return;
201 201
 
202
-		foreach($output as $key => $oComment)
202
+		foreach ($output as $key => $oComment)
203 203
 		{
204 204
 			$attribute = $oComment->getObjectVars();
205 205
 			$title = $oComment->getSummary($args->content_cut_size);
206
-			$thumbnail = $oComment->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type);
207
-			$url = sprintf("%s#comment_%s",getUrl('','mid', $args->mid_lists[$attribute->module_srl], 'document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl'));
206
+			$thumbnail = $oComment->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type);
207
+			$url = sprintf("%s#comment_%s", getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl'));
208 208
 
209 209
 			$attribute->mid = $args->mid_lists[$attribute->module_srl];
210 210
 			$browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title;
@@ -229,10 +229,10 @@  discard block
 block discarded – undo
229 229
 		// Get categories
230 230
 		$obj = new stdClass();
231 231
 		$obj->module_srl = $args->module_srl;
232
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
233
-		if($output->toBool() && $output->data)
232
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
233
+		if ($output->toBool() && $output->data)
234 234
 		{
235
-			foreach($output->data as $key => $val)
235
+			foreach ($output->data as $key => $val)
236 236
 			{
237 237
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
238 238
 			}
@@ -241,24 +241,24 @@  discard block
 block discarded – undo
241 241
 		$obj->module_srl = $args->module_srl;
242 242
 		$obj->category_srl = $args->category_srl;
243 243
 		$obj->sort_index = $args->order_target;
244
-		if($args->order_target == 'list_order' || $args->order_target == 'update_order')
244
+		if ($args->order_target == 'list_order' || $args->order_target == 'update_order')
245 245
 		{
246
-			$obj->order_type = $args->order_type=="desc"?"asc":"desc";
246
+			$obj->order_type = $args->order_type == "desc" ? "asc" : "desc";
247 247
 		}
248 248
 		else
249 249
 		{
250
-			$obj->order_type = $args->order_type=="desc"?"desc":"asc";
250
+			$obj->order_type = $args->order_type == "desc" ? "desc" : "asc";
251 251
 		}
252 252
 		$obj->list_count = $args->list_count * $args->page_count;
253 253
 		$obj->statusList = array('PUBLIC');
254 254
 		$output = executeQueryArray('widgets.content.getNewestDocuments', $obj);
255
-		if(!$output->toBool() || !$output->data) return;
255
+		if (!$output->toBool() || !$output->data) return;
256 256
 		// If the result exists, make each document as an object
257 257
 		$content_items = array();
258 258
 		$first_thumbnail_idx = -1;
259
-		if(count($output->data))
259
+		if (count($output->data))
260 260
 		{
261
-			foreach($output->data as $key => $attribute)
261
+			foreach ($output->data as $key => $attribute)
262 262
 			{
263 263
 				$oDocument = new documentItem();
264 264
 				$oDocument->setAttribute($attribute, false);
@@ -267,26 +267,26 @@  discard block
 block discarded – undo
267 267
 			}
268 268
 			$oDocumentModel->setToAllDocumentExtraVars();
269 269
 
270
-			for($i=0,$c=count($document_srls);$i<$c;$i++)
270
+			for ($i = 0, $c = count($document_srls); $i < $c; $i++)
271 271
 			{
272 272
 				$oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]];
273 273
 				$document_srl = $oDocument->document_srl;
274 274
 				$module_srl = $oDocument->get('module_srl');
275 275
 				$category_srl = $oDocument->get('category_srl');
276
-				$thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type);
276
+				$thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type);
277 277
 
278
-				$content_item = new contentItem( $args->module_srls_info[$module_srl]->browser_title );
278
+				$content_item = new contentItem($args->module_srls_info[$module_srl]->browser_title);
279 279
 				$content_item->adds($oDocument->getObjectVars());
280 280
 				$content_item->add('original_content', $oDocument->get('content'));
281 281
 				$content_item->setTitle($oDocument->getTitleText());
282
-				$content_item->setCategory( $category_lists[$module_srl][$category_srl]->title );
283
-				$content_item->setDomain( $args->module_srls_info[$module_srl]->domain );
282
+				$content_item->setCategory($category_lists[$module_srl][$category_srl]->title);
283
+				$content_item->setDomain($args->module_srls_info[$module_srl]->domain);
284 284
 				$content_item->setContent($oDocument->getSummary($args->content_cut_size));
285
-				$content_item->setLink( getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl],'document_srl',$document_srl) );
285
+				$content_item->setLink(getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl], 'document_srl', $document_srl));
286 286
 				$content_item->setThumbnail($thumbnail);
287 287
 				$content_item->setExtraImages($oDocument->printExtraImages($args->duration_new * 60 * 60));
288 288
 				$content_item->add('mid', $args->mid_lists[$module_srl]);
289
-				if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
289
+				if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i;
290 290
 				$content_items[] = $content_item;
291 291
 			}
292 292
 
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 		$obj->direct_download = 'Y';
308 308
 		$obj->isvalid = 'Y';
309 309
 		// Get categories
310
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
311
-		if($output->toBool() && $output->data)
310
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
311
+		if ($output->toBool() && $output->data)
312 312
 		{
313
-			foreach($output->data as $key => $val)
313
+			foreach ($output->data as $key => $val)
314 314
 			{
315 315
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
316 316
 			}
@@ -319,25 +319,25 @@  discard block
 block discarded – undo
319 319
 		$obj->list_count = $args->list_count * $args->page_count;
320 320
 		$files_output = executeQueryArray("file.getOneFileInDocument", $obj);
321 321
 		$files_count = count($files_output->data);
322
-		if(!$files_count) return;
322
+		if (!$files_count) return;
323 323
 
324 324
 		$content_items = array();
325 325
 
326
-		for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
326
+		for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
327 327
 
328 328
 		$tmp_document_list = $oDocumentModel->getDocuments($document_srl_list);
329 329
 
330
-		if(!count($tmp_document_list)) return;
330
+		if (!count($tmp_document_list)) return;
331 331
 
332
-		foreach($tmp_document_list as $oDocument)
332
+		foreach ($tmp_document_list as $oDocument)
333 333
 		{
334 334
 			$attribute = $oDocument->getObjectVars();
335 335
 			$browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title;
336 336
 			$domain = $args->module_srls_info[$attribute->module_srl]->domain;
337 337
 			$category = $category_lists[$attribute->module_srl]->text;
338 338
 			$content = $oDocument->getSummary($args->content_cut_size);
339
-			$url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount());
340
-			$thumbnail = $oDocument->getThumbnail($args->thumbnail_width,$args->thumbnail_height,$args->thumbnail_type);
339
+			$url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount());
340
+			$thumbnail = $oDocument->getThumbnail($args->thumbnail_width, $args->thumbnail_height, $args->thumbnail_type);
341 341
 			$extra_images = $oDocument->printExtraImages($args->duration_new);
342 342
 
343 343
 			$content_item = new contentItem($browser_title);
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 		$content_items = array();
361 361
 		$args->mid_lists = array();
362 362
 
363
-		foreach($args->rss_urls as $key => $rss)
363
+		foreach ($args->rss_urls as $key => $rss)
364 364
 		{
365 365
 			$args->rss_url = $rss;
366 366
 			$content_item = $this->_getRssItems($args);
367
-			if(count($content_item) > 0)
367
+			if (count($content_item) > 0)
368 368
 			{
369 369
 				$browser_title = $content_item[0]->getBrowserTitle();
370 370
 				$args->mid_lists[] = $browser_title;
@@ -372,37 +372,37 @@  discard block
 block discarded – undo
372 372
 			}
373 373
 		}
374 374
 		// If it is not a tab type
375
-		if($args->tab_type == 'none' || $args->tab_type == '')
375
+		if ($args->tab_type == 'none' || $args->tab_type == '')
376 376
 		{
377 377
 			$items = array();
378
-			foreach($content_items as $key => $val)
378
+			foreach ($content_items as $key => $val)
379 379
 			{
380
-				foreach($val as $k => $v)
380
+				foreach ($val as $k => $v)
381 381
 				{
382 382
 					$date = $v->get('regdate');
383
-					$i=0;
384
-					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++;
385
-					$items[sprintf('%s%02d',$date,$i)] = $v;
383
+					$i = 0;
384
+					while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++;
385
+					$items[sprintf('%s%02d', $date, $i)] = $v;
386 386
 				}
387 387
 			}
388
-			if($args->order_type =='asc') ksort($items);
388
+			if ($args->order_type == 'asc') ksort($items);
389 389
 			else krsort($items);
390
-			$content_items = array_slice(array_values($items),0,$args->list_count*$args->page_count);
390
+			$content_items = array_slice(array_values($items), 0, $args->list_count * $args->page_count);
391 391
 			// Tab Type
392 392
 		}
393 393
 		else
394 394
 		{
395
-			foreach($content_items as $key=> $content_item_list)
395
+			foreach ($content_items as $key=> $content_item_list)
396 396
 			{
397 397
 				$items = array();
398
-				foreach($content_item_list as $k => $content_item)
398
+				foreach ($content_item_list as $k => $content_item)
399 399
 				{
400 400
 					$date = $content_item->get('regdate');
401
-					$i=0;
402
-					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++;
403
-					$items[sprintf('%s%02d',$date,$i)] = $content_item;
401
+					$i = 0;
402
+					while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++;
403
+					$items[sprintf('%s%02d', $date, $i)] = $content_item;
404 404
 				}
405
-				if($args->order_type =='asc') ksort($items);
405
+				if ($args->order_type == 'asc') ksort($items);
406 406
 				else krsort($items);
407 407
 
408 408
 				$content_items[$key] = array_values($items);
@@ -413,19 +413,19 @@  discard block
 block discarded – undo
413 413
 
414 414
 	function _getRssBody($value)
415 415
 	{
416
-		if(!$value || is_string($value)) return $value;
417
-		if(is_object($value)) $value = get_object_vars($value);
416
+		if (!$value || is_string($value)) return $value;
417
+		if (is_object($value)) $value = get_object_vars($value);
418 418
 		$body = null;
419
-		if(!count($value)) return;
420
-		foreach($value as $key => $val)
419
+		if (!count($value)) return;
420
+		foreach ($value as $key => $val)
421 421
 		{
422
-			if($key == 'body')
422
+			if ($key == 'body')
423 423
 			{
424 424
 				$body = $val;
425 425
 				continue;
426 426
 			}
427
-			if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val);
428
-			if($body !== null) return $body;
427
+			if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val);
428
+			if ($body !== null) return $body;
429 429
 		}
430 430
 		return $body;
431 431
 	}
@@ -436,17 +436,17 @@  discard block
 block discarded – undo
436 436
 		// Replace tags such as </p> , </div> , </li> and others to a whitespace
437 437
 		$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
438 438
 		// Remove Tag
439
-		$content = preg_replace('!<([^>]*?)>!is','', $content);
439
+		$content = preg_replace('!<([^>]*?)>!is', '', $content);
440 440
 		// Replace tags to <, >, " and whitespace
441
-		$content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
441
+		$content = str_replace(array('&lt;', '&gt;', '&quot;', '&nbsp;'), array('<', '>', '"', ' '), $content);
442 442
 		// Delete  a series of whitespaces
443 443
 		$content = preg_replace('/ ( +)/is', ' ', $content);
444 444
 		// Truncate string
445 445
 		$content = trim(cut_str($content, $str_size, $tail));
446 446
 		// Replace back <, >, " to the original tags
447
-		$content = str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);
447
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
448 448
 		// Fixed to a newline bug for consecutive sets of English letters
449
-		$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content);
449
+		$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content);
450 450
 		return $content; 
451 451
 	}
452 452
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	function requestFeedContents($rss_url)
458 458
 	{
459
-		$rss_url = str_replace('&amp;','&',Context::convertEncodingStr($rss_url));
459
+		$rss_url = str_replace('&amp;', '&', Context::convertEncodingStr($rss_url));
460 460
 		return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml');
461 461
 	}
462 462
 
@@ -468,51 +468,51 @@  discard block
 block discarded – undo
468 468
 		$buff = $this->requestFeedContents($args->rss_url);
469 469
 
470 470
 		$encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
471
-		if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
471
+		if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
472 472
 
473 473
 		$buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
474 474
 
475 475
 		$oXmlParser = new XmlParser();
476 476
 		$xml_doc = $oXmlParser->parse($buff);
477
-		if($xml_doc->rss)
477
+		if ($xml_doc->rss)
478 478
 		{
479 479
 			$rss->title = $xml_doc->rss->channel->title->body;
480 480
 			$rss->link = $xml_doc->rss->channel->link->body;
481 481
 
482 482
 			$items = $xml_doc->rss->channel->item;
483 483
 
484
-			if(!$items) return;
485
-			if($items && !is_array($items)) $items = array($items);
484
+			if (!$items) return;
485
+			if ($items && !is_array($items)) $items = array($items);
486 486
 
487 487
 			$content_items = array();
488 488
 
489 489
 			foreach ($items as $key => $value)
490 490
 			{
491
-				if($key >= $args->list_count * $args->page_count) break;
491
+				if ($key >= $args->list_count * $args->page_count) break;
492 492
 				unset($item);
493 493
 
494
-				foreach($value as $key2 => $value2)
494
+				foreach ($value as $key2 => $value2)
495 495
 				{
496
-					if(is_array($value2)) $value2 = array_shift($value2);
496
+					if (is_array($value2)) $value2 = array_shift($value2);
497 497
 					$item->{$key2} = $this->_getRssBody($value2);
498 498
 				}
499 499
 
500 500
 				$content_item = new contentItem($rss->title);
501 501
 				$content_item->setContentsLink($rss->link);
502 502
 				$content_item->setTitle($item->title);
503
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
503
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
504 504
 				//$content_item->setCategory($item->category);
505
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
505
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
506 506
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
507 507
 				$content_item->setThumbnail($this->_getRssThumbnail($item->description));
508 508
 				$content_item->setLink($item->link);
509
-				$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
509
+				$date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
510 510
 				$content_item->setRegdate($date);
511 511
 
512 512
 				$content_items[] = $content_item;
513 513
 			}
514 514
 		}
515
-		else if($xml_doc->{'rdf:rdf'})
515
+		else if ($xml_doc->{'rdf:rdf'})
516 516
 		{
517 517
 			// rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters. Fixed by misol
518 518
 			$rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
@@ -520,102 +520,102 @@  discard block
 block discarded – undo
520 520
 
521 521
 			$items = $xml_doc->{'rdf:rdf'}->item;
522 522
 
523
-			if(!$items) return;
524
-			if($items && !is_array($items)) $items = array($items);
523
+			if (!$items) return;
524
+			if ($items && !is_array($items)) $items = array($items);
525 525
 
526 526
 			$content_items = array();
527 527
 
528 528
 			foreach ($items as $key => $value)
529 529
 			{
530
-				if($key >= $args->list_count * $args->page_count) break;
530
+				if ($key >= $args->list_count * $args->page_count) break;
531 531
 				unset($item);
532 532
 
533
-				foreach($value as $key2 => $value2)
533
+				foreach ($value as $key2 => $value2)
534 534
 				{
535
-					if(is_array($value2)) $value2 = array_shift($value2);
535
+					if (is_array($value2)) $value2 = array_shift($value2);
536 536
 					$item->{$key2} = $this->_getRssBody($value2);
537 537
 				}
538 538
 
539 539
 				$content_item = new contentItem($rss->title);
540 540
 				$content_item->setContentsLink($rss->link);
541 541
 				$content_item->setTitle($item->title);
542
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
542
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
543 543
 				//$content_item->setCategory($item->category);
544
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
544
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
545 545
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
546 546
 				$content_item->setThumbnail($this->_getRssThumbnail($item->description));
547 547
 				$content_item->setLink($item->link);
548
-				$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
548
+				$date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
549 549
 				$content_item->setRegdate($date);
550 550
 
551 551
 				$content_items[] = $content_item;
552 552
 			}
553 553
 		}
554
-		else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom')
554
+		else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom')
555 555
 		{
556 556
 			// Atom 1.0 spec supported by misol
557 557
 			$rss->title = $xml_doc->feed->title->body;
558 558
 			$links = $xml_doc->feed->link;
559
-			if(is_array($links))
559
+			if (is_array($links))
560 560
 			{
561 561
 				foreach ($links as $value)
562 562
 				{
563
-					if($value->attrs->rel == 'alternate')
563
+					if ($value->attrs->rel == 'alternate')
564 564
 					{
565 565
 						$rss->link = $value->attrs->href;
566 566
 						break;
567 567
 					}
568 568
 				}
569 569
 			}
570
-			else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
570
+			else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
571 571
 
572 572
 			$items = $xml_doc->feed->entry;
573 573
 
574
-			if(!$items) return;
575
-			if($items && !is_array($items)) $items = array($items);
574
+			if (!$items) return;
575
+			if ($items && !is_array($items)) $items = array($items);
576 576
 
577 577
 			$content_items = array();
578 578
 
579 579
 			foreach ($items as $key => $value)
580 580
 			{
581
-				if($key >= $args->list_count * $args->page_count) break;
581
+				if ($key >= $args->list_count * $args->page_count) break;
582 582
 				unset($item);
583 583
 
584
-				foreach($value as $key2 => $value2)
584
+				foreach ($value as $key2 => $value2)
585 585
 				{
586
-					if(is_array($value2)) $value2 = array_shift($value2);
586
+					if (is_array($value2)) $value2 = array_shift($value2);
587 587
 					$item->{$key2} = $this->_getRssBody($value2);
588 588
 				}
589 589
 
590 590
 				$content_item = new contentItem($rss->title);
591 591
 				$links = $value->link;
592
-				if(is_array($links))
592
+				if (is_array($links))
593 593
 				{
594 594
 					foreach ($links as $val)
595 595
 					{
596
-						if($val->attrs->rel == 'alternate')
596
+						if ($val->attrs->rel == 'alternate')
597 597
 						{
598 598
 							$item->link = $val->attrs->href;
599 599
 							break;
600 600
 						}
601 601
 					}
602 602
 				}
603
-				else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
603
+				else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
604 604
 
605 605
 				$content_item->setContentsLink($rss->link);
606
-				if($item->title)
606
+				if ($item->title)
607 607
 				{
608
-					if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
608
+					if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
609 609
 				}
610 610
 				$content_item->setTitle($item->title);
611
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
611
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
612 612
 				$content_item->setAuthorSite($value->author->uri->body);
613 613
 
614 614
 				//$content_item->setCategory($item->category);
615 615
 				$item->description = ($item->content) ? $item->content : $item->description = $item->summary;
616
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
616
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
617 617
 
618
-				if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
618
+				if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
619 619
 				{
620 620
 					$item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
621 621
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
625 625
 				$content_item->setThumbnail($this->_getRssThumbnail($item->description));
626 626
 				$content_item->setLink($item->link);
627
-				$date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'})));
627
+				$date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'})));
628 628
 				$content_item->setRegdate($date);
629 629
 
630 630
 				$content_items[] = $content_item;
@@ -637,15 +637,15 @@  discard block
 block discarded – undo
637 637
 	{
638 638
 		@preg_match('@<img[^>]+src\s*=\s*(?:"(.+)"|\'(.+)\'|([^\s>(?:/>)]+))@', $content, $matches);
639 639
 
640
-		if($matches[1])
640
+		if ($matches[1])
641 641
 		{
642 642
 			return $matches[1];
643 643
 		}
644
-		elseif($matches[2])
644
+		elseif ($matches[2])
645 645
 		{
646 646
 			return $matches[2];
647 647
 		}
648
-		elseif($matches[3])
648
+		elseif ($matches[3])
649 649
 		{
650 650
 			return $matches[3];
651 651
 		}
@@ -658,17 +658,17 @@  discard block
 block discarded – undo
658 658
 	function _getTrackbackItems($args)
659 659
 	{
660 660
 		$oTrackbackModel = getModel('trackback');
661
-		if(!$oTrackbackModel)
661
+		if (!$oTrackbackModel)
662 662
 		{
663 663
 			return;
664 664
 		}
665 665
 
666 666
 		$obj = new stdClass;
667 667
 		// Get categories
668
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
669
-		if($output->toBool() && $output->data)
668
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
669
+		if ($output->toBool() && $output->data)
670 670
 		{
671
-			foreach($output->data as $key => $val)
671
+			foreach ($output->data as $key => $val)
672 672
 			{
673 673
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
674 674
 			}
@@ -681,14 +681,14 @@  discard block
 block discarded – undo
681 681
 		// Get model object from the trackback module and execute getTrackbackList() method
682 682
 		$output = $oTrackbackModel->getNewestTrackbackList($obj);
683 683
 		// If an error occurs, just ignore it.
684
-		if(!$output->toBool() || !$output->data) return;
684
+		if (!$output->toBool() || !$output->data) return;
685 685
 		// If the result exists, make each document as an object
686 686
 		$content_items = array();
687
-		foreach($output->data as $key => $item)
687
+		foreach ($output->data as $key => $item)
688 688
 		{
689 689
 			$domain = $args->module_srls_info[$item->module_srl]->domain;
690 690
 			$category = $category_lists[$item->module_srl]->text;
691
-			$url = getSiteUrl($domain,'','document_srl',$item->document_srl);
691
+			$url = getSiteUrl($domain, '', 'document_srl', $item->document_srl);
692 692
 			$browser_title = $args->module_srls_info[$item->module_srl]->browser_title;
693 693
 
694 694
 			$content_item = new contentItem($browser_title);
@@ -696,8 +696,8 @@  discard block
 block discarded – undo
696 696
 			$content_item->setTitle($item->title);
697 697
 			$content_item->setCategory($category);
698 698
 			$content_item->setNickName($item->blog_name);
699
-			$content_item->setContent($item->excerpt);  ///<<
700
-			$content_item->setDomain($domain);  ///<<
699
+			$content_item->setContent($item->excerpt); ///<<
700
+			$content_item->setDomain($domain); ///<<
701 701
 			$content_item->setLink($url);
702 702
 			$content_item->add('mid', $args->mid_lists[$item->module_srl]);
703 703
 			$content_item->setRegdate($item->regdate);
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		return $content_items;
707 707
 	}
708 708
 
709
-	function _compile($args,$content_items)
709
+	function _compile($args, $content_items)
710 710
 	{
711 711
 		$oTemplate = &TemplateHandler::getInstance();
712 712
 		// Set variables for widget
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 		$widget_info->nickname_cut_size = $args->nickname_cut_size;
721 721
 		$widget_info->new_window = $args->new_window;
722 722
 
723
-		$widget_info->duration_new = $args->duration_new * 60*60;
723
+		$widget_info->duration_new = $args->duration_new * 60 * 60;
724 724
 		$widget_info->thumbnail_type = $args->thumbnail_type;
725 725
 		$widget_info->thumbnail_width = $args->thumbnail_width;
726 726
 		$widget_info->thumbnail_height = $args->thumbnail_height;
@@ -738,12 +738,12 @@  discard block
 block discarded – undo
738 738
 
739 739
 		$widget_info->markup_type = $args->markup_type;
740 740
 		// If it is a tab type, list up tab items and change key value(module_srl) to index 
741
-		if($args->tab_type != 'none' && $args->tab_type)
741
+		if ($args->tab_type != 'none' && $args->tab_type)
742 742
 		{
743 743
 			$tab = array();
744
-			foreach($args->mid_lists as $module_srl => $mid)
744
+			foreach ($args->mid_lists as $module_srl => $mid)
745 745
 			{
746
-				if(!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue;
746
+				if (!is_array($content_items[$module_srl]) || !count($content_items[$module_srl])) continue;
747 747
 
748 748
 				unset($tab_item);
749 749
 				$tab_item = new stdClass();
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 				$tab_item->content_items = $content_items[$module_srl];
752 752
 				$tab_item->domain = $content_items[$module_srl][0]->getDomain();
753 753
 				$tab_item->url = $content_items[$module_srl][0]->getContentsLink();
754
-				if(!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '','mid',$mid);
754
+				if (!$tab_item->url) $tab_item->url = getSiteUrl($tab_item->domain, '', 'mid', $mid);
755 755
 				$tab[] = $tab_item;
756 756
 			}
757 757
 			$widget_info->tab = $tab;
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 	var $contents_link = null;
780 780
 	var $domain = null;
781 781
 
782
-	function contentItem($browser_title='')
782
+	function contentItem($browser_title = '')
783 783
 	{
784 784
 		$this->browser_title = $browser_title;
785 785
 	}
@@ -789,22 +789,22 @@  discard block
 block discarded – undo
789 789
 	}
790 790
 	function setFirstThumbnailIdx($first_thumbnail_idx)
791 791
 	{
792
-		if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1)
792
+		if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1)
793 793
 		{
794 794
 			$this->has_first_thumbnail_idx = true;
795
-			$this->first_thumbnail_idx= $first_thumbnail_idx;
795
+			$this->first_thumbnail_idx = $first_thumbnail_idx;
796 796
 		}
797 797
 	}
798 798
 	function setExtraImages($extra_images)
799 799
 	{
800
-		$this->add('extra_images',$extra_images);
800
+		$this->add('extra_images', $extra_images);
801 801
 	}
802 802
 	function setDomain($domain)
803 803
 	{
804 804
 		static $default_domain = null;
805
-		if(!$domain)
805
+		if (!$domain)
806 806
 		{
807
-			if(is_null($default_domain)) $default_domain = Context::getDefaultUrl();
807
+			if (is_null($default_domain)) $default_domain = Context::getDefaultUrl();
808 808
 			$domain = $default_domain;
809 809
 		}
810 810
 		$this->domain = $domain;
@@ -868,17 +868,17 @@  discard block
 block discarded – undo
868 868
 	{
869 869
 		return $this->get('module_srl');
870 870
 	}
871
-	function getTitle($cut_size = 0, $tail='...')
871
+	function getTitle($cut_size = 0, $tail = '...')
872 872
 	{
873 873
 		$title = htmlspecialchars($this->get('title'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
874 874
 
875
-		if($cut_size) $title = cut_str($title, $cut_size, $tail);
875
+		if ($cut_size) $title = cut_str($title, $cut_size, $tail);
876 876
 
877 877
 		$attrs = array();
878
-		if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
879
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
878
+		if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
879
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
880 880
 
881
-		if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title);
881
+		if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), $title);
882 882
 
883 883
 		return $title;
884 884
 	}
@@ -890,9 +890,9 @@  discard block
 block discarded – undo
890 890
 	{
891 891
 		return $this->get('category');
892 892
 	}
893
-	function getNickName($cut_size = 0, $tail='...')
893
+	function getNickName($cut_size = 0, $tail = '...')
894 894
 	{
895
-		if($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail);
895
+		if ($cut_size) $nick_name = cut_str($this->get('nick_name'), $cut_size, $tail);
896 896
 		else $nick_name = $this->get('nick_name');
897 897
 
898 898
 		return $nick_name;
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
 	function getCommentCount()
905 905
 	{
906 906
 		$comment_count = $this->get('comment_count');
907
-		return $comment_count>0 ? $comment_count : '';
907
+		return $comment_count > 0 ? $comment_count : '';
908 908
 	}
909 909
 	function getTrackbackCount()
910 910
 	{
911 911
 		$trackback_count = $this->get('trackback_count');
912
-		return $trackback_count>0 ? $trackback_count : '';
912
+		return $trackback_count > 0 ? $trackback_count : '';
913 913
 	}
914 914
 	function getRegdate($format = 'Y.m.d H:i:s')
915 915
 	{
Please login to merge, or discard this patch.
classes/context/Context.class.php 2 patches
Doc Comments   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	/**
158 158
 	 * returns static context object (Singleton). It's to use Context without declaration of an object
159 159
 	 *
160
-	 * @return object Instance
160
+	 * @return Context Instance
161 161
 	 */
162 162
 	function &getInstance()
163 163
 	{
@@ -886,6 +886,7 @@  discard block
 block discarded – undo
886 886
 	 * Evaluation of xml language file
887 887
 	 *
888 888
 	 * @param string Path of the language file
889
+	 * @param string $path
889 890
 	 * @return void
890 891
 	 */
891 892
 	function _evalxmlLang($path)
@@ -1025,7 +1026,7 @@  discard block
 block discarded – undo
1025 1026
 	/**
1026 1027
 	 * Convert strings of variables in $source_object into UTF-8
1027 1028
 	 *
1028
-	 * @param object $source_obj Conatins strings to convert
1029
+	 * @param stdClass $source_obj Conatins strings to convert
1029 1030
 	 * @return object converted object
1030 1031
 	 */
1031 1032
 	function convertEncoding($source_obj)
@@ -1063,11 +1064,11 @@  discard block
 block discarded – undo
1063 1064
 	/**
1064 1065
 	 * Check flag
1065 1066
 	 *
1066
-	 * @param mixed $val
1067
+	 * @param boolean $val
1067 1068
 	 * @param string $key
1068 1069
 	 * @param mixed $charset charset
1069 1070
 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
1070
-	 * @return void
1071
+	 * @return null|boolean
1071 1072
 	 */
1072 1073
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1073 1074
 	{
@@ -1385,7 +1386,7 @@  discard block
 block discarded – undo
1385 1386
 	 * @see Cast variables, such as _srl, page, and cpage, into interger
1386 1387
 	 * @param string $key Variable key
1387 1388
 	 * @param string $val Variable value
1388
-	 * @param string $do_stripslashes Whether to strip slashes
1389
+	 * @param integer $do_stripslashes Whether to strip slashes
1389 1390
 	 * @return mixed filtered value. Type are string or array
1390 1391
 	 */
1391 1392
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
@@ -1920,7 +1921,7 @@  discard block
 block discarded – undo
1920 1921
 	 *
1921 1922
 	 * @param string $key Key
1922 1923
 	 * @param mixed $val Value
1923
-	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars.
1924
+	 * @param integer $set_to_get_vars If not FALSE, Set to get vars.
1924 1925
 	 * @return void
1925 1926
 	 */
1926 1927
 	function set($key, $val, $set_to_get_vars = 0)
@@ -1962,7 +1963,7 @@  discard block
 block discarded – undo
1962 1963
 	/**
1963 1964
 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...)
1964 1965
 	 *
1965
-	 * @return object
1966
+	 * @return null|stdClass
1966 1967
 	 */
1967 1968
 	function gets()
1968 1969
 	{
@@ -2035,7 +2036,7 @@  discard block
 block discarded – undo
2035 2036
 	/**
2036 2037
 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
2037 2038
 	 *
2038
-	 * @param string $action act name
2039
+	 * @param string[] $action_array
2039 2040
 	 * @return void
2040 2041
 	 */
2041 2042
 	function addSSLActions($action_array)
@@ -2206,7 +2207,7 @@  discard block
 block discarded – undo
2206 2207
 	 * @param string $file File name with path
2207 2208
 	 * @param string $optimized optimized (That seems to not use)
2208 2209
 	 * @param string $targetie target IE
2209
-	 * @param string $index index
2210
+	 * @param integer $index index
2210 2211
 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
2211 2212
 	 * @param bool $isRuleset Use ruleset
2212 2213
 	 * @param string $autoPath If path not readed, set the path automatically.
@@ -2316,7 +2317,7 @@  discard block
 block discarded – undo
2316 2317
 	 * @param string $optimized optimized (That seems to not use)
2317 2318
 	 * @param string $media Media query
2318 2319
 	 * @param string $targetie target IE
2319
-	 * @param string $index index
2320
+	 * @param integer $index index
2320 2321
 	 * @return void
2321 2322
 	 *
2322 2323
 	 */
Please login to merge, or discard this patch.
Spacing   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE)
205 205
 		{
206 206
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
207 207
 			
208 208
 			// If content is not XML JSON, unset
209
-			if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
209
+			if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE)
210 210
 			{
211 211
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
212 212
 			}
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 		$this->_setUploadedArgument();
229 229
 
230 230
 		$this->loadDBInfo();
231
-		if($this->db_info->use_sitelock == 'Y')
231
+		if ($this->db_info->use_sitelock == 'Y')
232 232
 		{
233
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
233
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
234 234
 
235
-			if(!IpFilter::filter($whitelist))
235
+			if (!IpFilter::filter($whitelist))
236 236
 			{
237 237
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
238 238
 				$message = $this->db_info->sitelock_message;
@@ -242,52 +242,52 @@  discard block
 block discarded – undo
242 242
 				define('_XE_SITELOCK_MESSAGE_', $message);
243 243
 
244 244
 				header("HTTP/1.1 403 Forbidden");
245
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
245
+				if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html'))
246 246
 				{
247
-					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
247
+					include _XE_PATH_.'common/tpl/sitelock.user.html';
248 248
 				}
249 249
 				else
250 250
 				{
251
-					include _XE_PATH_ . 'common/tpl/sitelock.html';
251
+					include _XE_PATH_.'common/tpl/sitelock.html';
252 252
 				}
253 253
 				exit;
254 254
 			}
255 255
 		}
256 256
 
257 257
 		// If XE is installed, get virtual site information
258
-		if(self::isInstalled())
258
+		if (self::isInstalled())
259 259
 		{
260 260
 			$oModuleModel = getModel('module');
261 261
 			$site_module_info = $oModuleModel->getDefaultMid();
262 262
 
263
-			if(!isset($site_module_info))
263
+			if (!isset($site_module_info))
264 264
 			{
265 265
 				$site_module_info = new stdClass();
266 266
 			}
267 267
 
268 268
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
269
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
269
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
270 270
 			{
271 271
 				$site_module_info->domain = $this->db_info->default_url;
272 272
 			}
273 273
 
274 274
 			$this->set('site_module_info', $site_module_info);
275
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
275
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
276 276
 			{
277 277
 				$this->set('vid', $site_module_info->domain, TRUE);
278 278
 			}
279 279
 
280
-			if(!isset($this->db_info))
280
+			if (!isset($this->db_info))
281 281
 			{
282 282
 				$this->db_info = new stdClass();
283 283
 			}
284 284
 
285 285
 			$this->db_info->lang_type = $site_module_info->default_language;
286
-			if(!$this->db_info->lang_type)
286
+			if (!$this->db_info->lang_type)
287 287
 			{
288 288
 				$this->db_info->lang_type = 'en';
289 289
 			}
290
-			if(!$this->db_info->use_db_session)
290
+			if (!$this->db_info->use_db_session)
291 291
 			{
292 292
 				$this->db_info->use_db_session = 'N';
293 293
 			}
@@ -297,30 +297,30 @@  discard block
 block discarded – undo
297 297
 		$lang_supported = $this->loadLangSelected();
298 298
 
299 299
 		// Retrieve language type set in user's cookie
300
-		if($this->lang_type = $this->get('l'))
300
+		if ($this->lang_type = $this->get('l'))
301 301
 		{
302
-			if($_COOKIE['lang_type'] != $this->lang_type)
302
+			if ($_COOKIE['lang_type'] != $this->lang_type)
303 303
 			{
304 304
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000);
305 305
 			}
306 306
 		}
307
-		elseif($_COOKIE['lang_type'])
307
+		elseif ($_COOKIE['lang_type'])
308 308
 		{
309 309
 			$this->lang_type = $_COOKIE['lang_type'];
310 310
 		}
311 311
 
312 312
 		// If it's not exists, follow default language type set in db_info
313
-		if(!$this->lang_type)
313
+		if (!$this->lang_type)
314 314
 		{
315 315
 			$this->lang_type = $this->db_info->lang_type;
316 316
 		}
317 317
 
318 318
 		// if still lang_type has not been set or has not-supported type , set as English.
319
-		if(!$this->lang_type)
319
+		if (!$this->lang_type)
320 320
 		{
321 321
 			$this->lang_type = 'en';
322 322
 		}
323
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
323
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
324 324
 		{
325 325
 			$this->lang_type = 'en';
326 326
 		}
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
 		$this->setLangType($this->lang_type);
330 330
 
331 331
 		// load module module's language file according to language setting
332
-		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
332
+		$this->loadLang(_XE_PATH_.'modules/module/lang');
333 333
 
334 334
 		// set session handler
335
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
335
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
336 336
 		{
337 337
 			$oSessionModel = getModel('session');
338 338
 			$oSessionController = getController('session');
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 			);
342 342
 		}
343 343
 
344
-		if($sess = $_POST[session_name()]) session_id($sess);
344
+		if ($sess = $_POST[session_name()]) session_id($sess);
345 345
 		session_start();
346 346
 
347 347
 		// set authentication information in Context and session
348
-		if(self::isInstalled())
348
+		if (self::isInstalled())
349 349
 		{
350 350
 			$oModuleModel = getModel('module');
351 351
 			$oModuleModel->loadModuleExtends();
@@ -353,15 +353,15 @@  discard block
 block discarded – undo
353 353
 			$oMemberModel = getModel('member');
354 354
 			$oMemberController = getController('member');
355 355
 
356
-			if($oMemberController && $oMemberModel)
356
+			if ($oMemberController && $oMemberModel)
357 357
 			{
358 358
 				// if signed in, validate it.
359
-				if($oMemberModel->isLogged())
359
+				if ($oMemberModel->isLogged())
360 360
 				{
361 361
 					$oMemberController->setSessionInfo();
362 362
 				}
363 363
 				// check auto sign-in
364
-				elseif($_COOKIE['xeak'])
364
+				elseif ($_COOKIE['xeak'])
365 365
 				{
366 366
 					$oMemberController->doAutologin();
367 367
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		// load common language file
375 375
 		$this->lang = &$GLOBALS['lang'];
376
-		$this->loadLang(_XE_PATH_ . 'common/lang/');
376
+		$this->loadLang(_XE_PATH_.'common/lang/');
377 377
 
378 378
 		// check if using rewrite module
379 379
 		$this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE);
@@ -381,28 +381,28 @@  discard block
 block discarded – undo
381 381
 		// set locations for javascript use
382 382
 		$url = array();
383 383
 		$current_url = self::getRequestUri();
384
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
384
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
385 385
 		{
386
-			if($this->get_vars)
386
+			if ($this->get_vars)
387 387
 			{
388 388
 				$url = array();
389
-				foreach($this->get_vars as $key => $val)
389
+				foreach ($this->get_vars as $key => $val)
390 390
 				{
391
-					if(is_array($val) && count($val) > 0)
391
+					if (is_array($val) && count($val) > 0)
392 392
 					{
393
-						foreach($val as $k => $v)
393
+						foreach ($val as $k => $v)
394 394
 						{
395
-							$url[] = $key . '[' . $k . ']=' . urlencode($v);
395
+							$url[] = $key.'['.$k.']='.urlencode($v);
396 396
 						}
397 397
 					}
398
-					elseif($val)
398
+					elseif ($val)
399 399
 					{
400
-						$url[] = $key . '=' . urlencode($val);
400
+						$url[] = $key.'='.urlencode($val);
401 401
 					}
402 402
 				}
403 403
 
404 404
 				$current_url = self::getRequestUri();
405
-				if($url) $current_url .= '?' . join('&', $url);
405
+				if ($url) $current_url .= '?'.join('&', $url);
406 406
 			}
407 407
 			else
408 408
 			{
@@ -417,12 +417,12 @@  discard block
 block discarded – undo
417 417
 		$this->set('current_url', $current_url);
418 418
 		$this->set('request_uri', self::getRequestUri());
419 419
 
420
-		if(strpos($current_url, 'xn--') !== FALSE)
420
+		if (strpos($current_url, 'xn--') !== FALSE)
421 421
 		{
422 422
 			$this->set('current_url', self::decodeIdna($current_url));
423 423
 		}
424 424
 
425
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
425
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
426 426
 		{
427 427
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
428 428
 		}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	{
448 448
 		$self = self::getInstance();
449 449
 
450
-		if(!$self->isInstalled())
450
+		if (!$self->isInstalled())
451 451
 		{
452 452
 			return;
453 453
 		}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 		ob_end_clean();
458 458
 
459 459
 		// If master_db information does not exist, the config file needs to be updated
460
-		if(!isset($db_info->master_db))
460
+		if (!isset($db_info->master_db))
461 461
 		{
462 462
 			$db_info->master_db = array();
463 463
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
476 476
 			unset($db_info->db_table_prefix);
477 477
 
478
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
478
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
479 479
 			{
480 480
 				$db_info->master_db["db_table_prefix"] .= '_';
481 481
 			}
@@ -487,33 +487,33 @@  discard block
 block discarded – undo
487 487
 			$oInstallController->makeConfigFile();
488 488
 		}
489 489
 
490
-		if(!$db_info->use_prepared_statements)
490
+		if (!$db_info->use_prepared_statements)
491 491
 		{
492 492
 			$db_info->use_prepared_statements = 'Y';
493 493
 		}
494 494
 
495
-		if(!$db_info->time_zone)
495
+		if (!$db_info->time_zone)
496 496
 			$db_info->time_zone = date('O');
497 497
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
498 498
 
499
-		if($db_info->qmail_compatibility != 'Y')
499
+		if ($db_info->qmail_compatibility != 'Y')
500 500
 			$db_info->qmail_compatibility = 'N';
501 501
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
502 502
 
503
-		if(!$db_info->use_db_session)
503
+		if (!$db_info->use_db_session)
504 504
 			$db_info->use_db_session = 'N';
505
-		if(!$db_info->use_ssl)
505
+		if (!$db_info->use_ssl)
506 506
 			$db_info->use_ssl = 'none';
507 507
 		$this->set('_use_ssl', $db_info->use_ssl);
508 508
 
509 509
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
510 510
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
511 511
 
512
-		if(!$db_info->sitelock_whitelist) {
512
+		if (!$db_info->sitelock_whitelist) {
513 513
 			$db_info->sitelock_whitelist = '127.0.0.1';
514 514
 		}
515 515
 
516
-		if(is_string($db_info->sitelock_whitelist)) {
516
+		if (is_string($db_info->sitelock_whitelist)) {
517 517
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
518 518
 		}
519 519
 
@@ -584,10 +584,10 @@  discard block
 block discarded – undo
584 584
 	function loadLangSupported()
585 585
 	{
586 586
 		static $lang_supported = null;
587
-		if(!$lang_supported)
587
+		if (!$lang_supported)
588 588
 		{
589
-			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
590
-			foreach($langs as $val)
589
+			$langs = file(_XE_PATH_.'common/lang/lang.info');
590
+			foreach ($langs as $val)
591 591
 			{
592 592
 				list($lang_prefix, $lang_text) = explode(',', $val);
593 593
 				$lang_text = trim($lang_text);
@@ -605,17 +605,17 @@  discard block
 block discarded – undo
605 605
 	function loadLangSelected()
606 606
 	{
607 607
 		static $lang_selected = null;
608
-		if(!$lang_selected)
608
+		if (!$lang_selected)
609 609
 		{
610
-			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
611
-			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
612
-			if(!FileHandler::hasContent($selected_lang_file))
610
+			$orig_lang_file = _XE_PATH_.'common/lang/lang.info';
611
+			$selected_lang_file = _XE_PATH_.'files/config/lang_selected.info';
612
+			if (!FileHandler::hasContent($selected_lang_file))
613 613
 			{
614
-				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
614
+				$old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info';
615 615
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
616 616
 			}
617 617
 
618
-			if(!FileHandler::hasContent($selected_lang_file))
618
+			if (!FileHandler::hasContent($selected_lang_file))
619 619
 			{
620 620
 				$buff = FileHandler::readFile($orig_lang_file);
621 621
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 			else
625 625
 			{
626 626
 				$langs = file($selected_lang_file);
627
-				foreach($langs as $val)
627
+				foreach ($langs as $val)
628 628
 				{
629 629
 					list($lang_prefix, $lang_text) = explode(',', $val);
630 630
 					$lang_text = trim($lang_text);
@@ -643,56 +643,56 @@  discard block
 block discarded – undo
643 643
 	function checkSSO()
644 644
 	{
645 645
 		// pass if it's not GET request or XE is not yet installed
646
-		if($this->db_info->use_sso != 'Y' || isCrawler())
646
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
647 647
 		{
648 648
 			return TRUE;
649 649
 		}
650 650
 		$checkActList = array('rss' => 1, 'atom' => 1);
651
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
651
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
652 652
 		{
653 653
 			return TRUE;
654 654
 		}
655 655
 
656 656
 		// pass if default URL is not set
657 657
 		$default_url = trim($this->db_info->default_url);
658
-		if(!$default_url)
658
+		if (!$default_url)
659 659
 		{
660 660
 			return TRUE;
661 661
 		}
662 662
 
663
-		if(substr_compare($default_url, '/', -1) !== 0)
663
+		if (substr_compare($default_url, '/', -1) !== 0)
664 664
 		{
665 665
 			$default_url .= '/';
666 666
 		}
667 667
 
668 668
 		// for sites recieving SSO valdiation
669
-		if($default_url == self::getRequestUri())
669
+		if ($default_url == self::getRequestUri())
670 670
 		{
671
-			if(self::get('url'))
671
+			if (self::get('url'))
672 672
 			{
673 673
 				$url = base64_decode(self::get('url'));
674 674
 				$url_info = parse_url($url);
675
-				if(!Password::checkSignature($url, self::get('sig')))
675
+				if (!Password::checkSignature($url, self::get('sig')))
676 676
 				{
677 677
 					echo self::get('lang')->msg_invalid_request;
678 678
 					return false;
679 679
 				}
680 680
 
681 681
 				$oModuleModel = getModel('module');
682
-				$domain = $url_info['host'] . $url_info['path'];
683
-				if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
682
+				$domain = $url_info['host'].$url_info['path'];
683
+				if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1);
684 684
 				$site_info = $oModuleModel->getSiteInfoByDomain($domain);
685 685
 
686
-				if($site_info->site_srl)
686
+				if ($site_info->site_srl)
687 687
 				{
688
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id()));
689
-				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
688
+				$url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id()));
689
+				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']);
690 690
 				}
691 691
 				else
692 692
 				{
693 693
 					$redirect_url = $url;
694 694
 				}
695
-				header('location:' . $redirect_url);
695
+				header('location:'.$redirect_url);
696 696
 
697 697
 				return FALSE;
698 698
 			}
@@ -701,9 +701,9 @@  discard block
 block discarded – undo
701 701
 		else
702 702
 		{
703 703
 			// result handling : set session_name()
704
-			if($session_name = self::get('SSOID'))
704
+			if ($session_name = self::get('SSOID'))
705 705
 			{
706
-				if(!Password::checkSignature($session_name, self::get('sig')))
706
+				if (!Password::checkSignature($session_name, self::get('sig')))
707 707
 				{
708 708
 					echo self::get('lang')->msg_invalid_request;
709 709
 					return false;
@@ -712,17 +712,17 @@  discard block
 block discarded – undo
712 712
 				setcookie(session_name(), $session_name);
713 713
 
714 714
 				$url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl());
715
-				header('location:' . $url);
715
+				header('location:'.$url);
716 716
 				return FALSE;
717 717
 				// send SSO request
718 718
 			}
719
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
719
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
720 720
 			{
721 721
 				setcookie('sso', md5(self::getRequestUri()));
722 722
 				$origin_url = self::getRequestUrl();
723 723
 				$origin_sig = Password::createSignature($origin_url);
724 724
 				$url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig));
725
-				header('location:' . $url);
725
+				header('location:'.$url);
726 726
 				return FALSE;
727 727
 			}
728 728
 		}
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	{
750 750
 		$self = self::getInstance();
751 751
 
752
-		if(!$self->isFTPRegisted())
752
+		if (!$self->isFTPRegisted())
753 753
 		{
754 754
 			return null;
755 755
 		}
@@ -767,15 +767,15 @@  discard block
 block discarded – undo
767 767
 	 */
768 768
 	function addBrowserTitle($site_title)
769 769
 	{
770
-		if(!$site_title)
770
+		if (!$site_title)
771 771
 		{
772 772
 			return;
773 773
 		}
774 774
 		$self = self::getInstance();
775 775
 
776
-		if($self->site_title)
776
+		if ($self->site_title)
777 777
 		{
778
-			$self->site_title .= ' - ' . $site_title;
778
+			$self->site_title .= ' - '.$site_title;
779 779
 		}
780 780
 		else
781 781
 		{
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 */
792 792
 	function setBrowserTitle($site_title)
793 793
 	{
794
-		if(!$site_title)
794
+		if (!$site_title)
795 795
 		{
796 796
 			return;
797 797
 		}
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		$oModuleModel = getModel('module');
824 824
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
825 825
 
826
-		if(isset($moduleConfig->siteTitle))
826
+		if (isset($moduleConfig->siteTitle))
827 827
 		{
828 828
 			return $moduleConfig->siteTitle;
829 829
 		}
@@ -850,30 +850,30 @@  discard block
 block discarded – undo
850 850
 		global $lang;
851 851
 
852 852
 		$self = self::getInstance();
853
-		if(!$self->lang_type)
853
+		if (!$self->lang_type)
854 854
 		{
855 855
 			return;
856 856
 		}
857
-		if(!is_object($lang))
857
+		if (!is_object($lang))
858 858
 		{
859 859
 			$lang = new stdClass;
860 860
 		}
861 861
 
862
-		if(!($filename = $self->_loadXmlLang($path)))
862
+		if (!($filename = $self->_loadXmlLang($path)))
863 863
 		{
864 864
 			$filename = $self->_loadPhpLang($path);
865 865
 		}
866 866
 
867
-		if(!is_array($self->loaded_lang_files))
867
+		if (!is_array($self->loaded_lang_files))
868 868
 		{
869 869
 			$self->loaded_lang_files = array();
870 870
 		}
871
-		if(in_array($filename, $self->loaded_lang_files))
871
+		if (in_array($filename, $self->loaded_lang_files))
872 872
 		{
873 873
 			return;
874 874
 		}
875 875
 
876
-		if($filename && is_readable($filename))
876
+		if ($filename && is_readable($filename))
877 877
 		{
878 878
 			$self->loaded_lang_files[] = $filename;
879 879
 			include($filename);
@@ -894,24 +894,24 @@  discard block
 block discarded – undo
894 894
 	{
895 895
 		global $lang;
896 896
 
897
-		if(!$path) return;
897
+		if (!$path) return;
898 898
 
899
-		$_path = 'eval://' . $path;
899
+		$_path = 'eval://'.$path;
900 900
 
901
-		if(in_array($_path, $this->loaded_lang_files))
901
+		if (in_array($_path, $this->loaded_lang_files))
902 902
 		{
903 903
 			return;
904 904
 		}
905 905
 
906
-		if(substr_compare($path, '/', -1) !== 0)
906
+		if (substr_compare($path, '/', -1) !== 0)
907 907
 		{
908 908
 			$path .= '/';
909 909
 		}
910 910
 
911
-		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
911
+		$oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type);
912 912
 		$content = $oXmlLangParser->getCompileContent();
913 913
 
914
-		if($content)
914
+		if ($content)
915 915
 		{
916 916
 			$this->loaded_lang_files[] = $_path;
917 917
 			eval($content);
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
 	 */
927 927
 	function _loadXmlLang($path)
928 928
 	{
929
-		if(!$path) return;
929
+		if (!$path) return;
930 930
 
931
-		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
931
+		$oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type);
932 932
 		return $oXmlLangParser->compile();
933 933
 	}
934 934
 
@@ -940,22 +940,22 @@  discard block
 block discarded – undo
940 940
 	 */
941 941
 	function _loadPhpLang($path)
942 942
 	{
943
-		if(!$path) return;
943
+		if (!$path) return;
944 944
 
945
-		if(substr_compare($path, '/', -1) !== 0)
945
+		if (substr_compare($path, '/', -1) !== 0)
946 946
 		{
947 947
 			$path .= '/';
948 948
 		}
949
-		$path_tpl = $path . '%s.lang.php';
949
+		$path_tpl = $path.'%s.lang.php';
950 950
 		$file = sprintf($path_tpl, $this->lang_type);
951 951
 
952 952
 		$langs = array('ko', 'en'); // this will be configurable.
953
-		while(!is_readable($file) && $langs[0])
953
+		while (!is_readable($file) && $langs[0])
954 954
 		{
955 955
 			$file = sprintf($path_tpl, array_shift($langs));
956 956
 		}
957 957
 
958
-		if(!is_readable($file))
958
+		if (!is_readable($file))
959 959
 		{
960 960
 			return FALSE;
961 961
 		}
@@ -997,11 +997,11 @@  discard block
 block discarded – undo
997 997
 	 */
998 998
 	function getLang($code)
999 999
 	{
1000
-		if(!$code)
1000
+		if (!$code)
1001 1001
 		{
1002 1002
 			return;
1003 1003
 		}
1004
-		if($GLOBALS['lang']->{$code})
1004
+		if ($GLOBALS['lang']->{$code})
1005 1005
 		{
1006 1006
 			return $GLOBALS['lang']->{$code};
1007 1007
 		}
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 	 */
1018 1018
 	function setLang($code, $val)
1019 1019
 	{
1020
-		if(!isset($GLOBALS['lang']))
1020
+		if (!isset($GLOBALS['lang']))
1021 1021
 		{
1022 1022
 			$GLOBALS['lang'] = new stdClass();
1023 1023
 		}
@@ -1045,17 +1045,17 @@  discard block
 block discarded – undo
1045 1045
 
1046 1046
 		$obj = clone $source_obj;
1047 1047
 
1048
-		foreach($charset_list as $charset)
1048
+		foreach ($charset_list as $charset)
1049 1049
 		{
1050
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1050
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1051 1051
 			$flag = self::checkConvertFlag($flag = TRUE);
1052
-			if($flag)
1052
+			if ($flag)
1053 1053
 			{
1054
-				if($charset == 'UTF-8')
1054
+				if ($charset == 'UTF-8')
1055 1055
 				{
1056 1056
 					return $obj;
1057 1057
 				}
1058
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1058
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1059 1059
 				return $obj;
1060 1060
 			}
1061 1061
 		}
@@ -1074,11 +1074,11 @@  discard block
 block discarded – undo
1074 1074
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1075 1075
 	{
1076 1076
 		static $flag = TRUE;
1077
-		if($charset)
1077
+		if ($charset)
1078 1078
 		{
1079
-			if(is_array($val))
1080
-				array_walk($val,'Context::checkConvertFlag',$charset);
1081
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1079
+			if (is_array($val))
1080
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1081
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1082 1082
 			else $flag = FALSE;
1083 1083
 		}
1084 1084
 		else
@@ -1102,9 +1102,9 @@  discard block
 block discarded – undo
1102 1102
 	{
1103 1103
 		if (is_array($val))
1104 1104
 		{
1105
-			array_walk($val,'Context::doConvertEncoding',$charset);
1105
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1106 1106
 		}
1107
-		else $val = iconv($charset,'UTF-8',$val);
1107
+		else $val = iconv($charset, 'UTF-8', $val);
1108 1108
 	}
1109 1109
 
1110 1110
 	/**
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 */
1116 1116
 	function convertEncodingStr($str)
1117 1117
 	{
1118
-        if(!$str) return null;
1118
+        if (!$str) return null;
1119 1119
 		$obj = new stdClass();
1120 1120
 		$obj->str = $str;
1121 1121
 		$obj = self::convertEncoding($obj);
@@ -1124,9 +1124,9 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
 	function decodeIdna($domain)
1126 1126
 	{
1127
-		if(strpos($domain, 'xn--') !== FALSE)
1127
+		if (strpos($domain, 'xn--') !== FALSE)
1128 1128
 		{
1129
-			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1129
+			require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
1130 1130
 			$IDN = new idna_convert(array('idn_version' => 2008));
1131 1131
 			$domain = $IDN->decode($domain);
1132 1132
 		}
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
 	{
1158 1158
 		$self = self::getInstance();
1159 1159
 
1160
-		if($self->response_method)
1160
+		if ($self->response_method)
1161 1161
 		{
1162 1162
 			return $self->response_method;
1163 1163
 		}
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1198 1198
 
1199 1199
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1200
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1200
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1201 1201
 		{
1202 1202
 			$this->isSuccessInit = FALSE;
1203 1203
 		}
@@ -1210,30 +1210,30 @@  discard block
 block discarded – undo
1210 1210
 	 */
1211 1211
 	function _setRequestArgument()
1212 1212
 	{
1213
-		if(!count($_REQUEST))
1213
+		if (!count($_REQUEST))
1214 1214
 		{
1215 1215
 			return;
1216 1216
 		}
1217 1217
 
1218 1218
 		$requestMethod = $this->getRequestMethod();
1219
-		foreach($_REQUEST as $key => $val)
1219
+		foreach ($_REQUEST as $key => $val)
1220 1220
 		{
1221
-			if($val === '' || self::get($key))
1221
+			if ($val === '' || self::get($key))
1222 1222
 			{
1223 1223
 				continue;
1224 1224
 			}
1225 1225
 			$key = htmlentities($key);
1226 1226
 			$val = $this->_filterRequestVar($key, $val);
1227 1227
 
1228
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1228
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1229 1229
 			{
1230 1230
 				$set_to_vars = TRUE;
1231 1231
 			}
1232
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1232
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1233 1233
 			{
1234 1234
 				$set_to_vars = TRUE;
1235 1235
 			}
1236
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1236
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1237 1237
 			{
1238 1238
 				$set_to_vars = TRUE;
1239 1239
 			}
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 				$set_to_vars = FALSE;
1243 1243
 			}
1244 1244
 
1245
-			if($set_to_vars)
1245
+			if ($set_to_vars)
1246 1246
 			{
1247 1247
 				$this->_recursiveCheckVar($val);
1248 1248
 			}
@@ -1253,20 +1253,20 @@  discard block
 block discarded – undo
1253 1253
 
1254 1254
 	function _recursiveCheckVar($val)
1255 1255
 	{
1256
-		if(is_string($val))
1256
+		if (is_string($val))
1257 1257
 		{
1258
-			foreach($this->patterns as $pattern)
1258
+			foreach ($this->patterns as $pattern)
1259 1259
 			{
1260
-				if(preg_match($pattern, $val))
1260
+				if (preg_match($pattern, $val))
1261 1261
 				{
1262 1262
 					$this->isSuccessInit = FALSE;
1263 1263
 					return;
1264 1264
 				}
1265 1265
 			}
1266 1266
 		}
1267
-		else if(is_array($val))
1267
+		else if (is_array($val))
1268 1268
 		{
1269
-			foreach($val as $val2)
1269
+			foreach ($val as $val2)
1270 1270
 			{
1271 1271
 				$this->_recursiveCheckVar($val2);
1272 1272
 			}
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 	 */
1281 1281
 	function _setJSONRequestArgument()
1282 1282
 	{
1283
-		if($this->getRequestMethod() != 'JSON')
1283
+		if ($this->getRequestMethod() != 'JSON')
1284 1284
 		{
1285 1285
 			return;
1286 1286
 		}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 		$params = array();
1289 1289
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1290 1290
 
1291
-		foreach($params as $key => $val)
1291
+		foreach ($params as $key => $val)
1292 1292
 		{
1293 1293
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1294 1294
 		}
@@ -1301,13 +1301,13 @@  discard block
 block discarded – undo
1301 1301
 	 */
1302 1302
 	function _setXmlRpcArgument()
1303 1303
 	{
1304
-		if($this->getRequestMethod() != 'XMLRPC')
1304
+		if ($this->getRequestMethod() != 'XMLRPC')
1305 1305
 		{
1306 1306
 			return;
1307 1307
 		}
1308 1308
 
1309 1309
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1310
-		if(Security::detectingXEE($xml))
1310
+		if (Security::detectingXEE($xml))
1311 1311
 		{
1312 1312
 			header("HTTP/1.0 400 Bad Request");
1313 1313
 			exit;
@@ -1319,12 +1319,12 @@  discard block
 block discarded – undo
1319 1319
 		$params = $xml_obj->methodcall->params;
1320 1320
 		unset($params->node_name, $params->attrs, $params->body);
1321 1321
 
1322
-		if(!count(get_object_vars($params)))
1322
+		if (!count(get_object_vars($params)))
1323 1323
 		{
1324 1324
 			return;
1325 1325
 		}
1326 1326
 
1327
-		foreach($params as $key => $val)
1327
+		foreach ($params as $key => $val)
1328 1328
 		{
1329 1329
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1330 1330
 		}
@@ -1339,10 +1339,10 @@  discard block
 block discarded – undo
1339 1339
 	 */
1340 1340
 	function _filterXmlVars($key, $val)
1341 1341
 	{
1342
-		if(is_array($val))
1342
+		if (is_array($val))
1343 1343
 		{
1344 1344
 			$stack = array();
1345
-			foreach($val as $k => $v)
1345
+			foreach ($val as $k => $v)
1346 1346
 			{
1347 1347
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1348 1348
 			}
@@ -1352,20 +1352,20 @@  discard block
 block discarded – undo
1352 1352
 
1353 1353
 		$body = $val->body;
1354 1354
 		unset($val->node_name, $val->attrs, $val->body);
1355
-		if(!count(get_object_vars($val)))
1355
+		if (!count(get_object_vars($val)))
1356 1356
 		{
1357 1357
 			return $this->_filterRequestVar($key, $body, 0);
1358 1358
 		}
1359 1359
 
1360 1360
 		$stack = new stdClass();
1361
-		foreach($val as $k => $v)
1361
+		foreach ($val as $k => $v)
1362 1362
 		{
1363 1363
 			$output = $this->_filterXmlVars($k, $v);
1364
-			if(is_object($v) && $v->attrs->type == 'array')
1364
+			if (is_object($v) && $v->attrs->type == 'array')
1365 1365
 			{
1366 1366
 				$output = array($output);
1367 1367
 			}
1368
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1368
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1369 1369
 			{
1370 1370
 				return $output;
1371 1371
 			}
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 			$stack->{$k} = $output;
1374 1374
 		}
1375 1375
 
1376
-		if(!count(get_object_vars($stack)))
1376
+		if (!count(get_object_vars($stack)))
1377 1377
 		{
1378 1378
 			return NULL;
1379 1379
 		}
@@ -1392,32 +1392,32 @@  discard block
 block discarded – undo
1392 1392
 	 */
1393 1393
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1394 1394
 	{
1395
-		if(!($isArray = is_array($val)))
1395
+		if (!($isArray = is_array($val)))
1396 1396
 		{
1397 1397
 			$val = array($val);
1398 1398
 		}
1399 1399
 
1400 1400
 		$result = array();
1401
-		foreach($val as $k => $v)
1401
+		foreach ($val as $k => $v)
1402 1402
 		{
1403 1403
 			$k = htmlentities($k);
1404
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1404
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1405 1405
 			{
1406 1406
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1407 1407
 			}
1408
-			elseif($key === 'mid' || $key === 'search_keyword')
1408
+			elseif ($key === 'mid' || $key === 'search_keyword')
1409 1409
 			{
1410 1410
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1411 1411
 			}
1412
-			elseif($key === 'vid')
1412
+			elseif ($key === 'vid')
1413 1413
 			{
1414 1414
 				$result[$k] = urlencode($v);
1415 1415
 			}
1416
-			elseif($key === 'xe_validator_id')
1416
+			elseif ($key === 'xe_validator_id')
1417 1417
 			{
1418 1418
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1419 1419
 			}
1420
-			elseif(stripos($key, 'XE_VALIDATOR', 0) === 0)
1420
+			elseif (stripos($key, 'XE_VALIDATOR', 0) === 0)
1421 1421
 			{
1422 1422
 				unset($result[$k]);
1423 1423
 			}
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
 			{
1426 1426
 				$result[$k] = $v;
1427 1427
 
1428
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1428
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1429 1429
 				{
1430 1430
 					if (is_array($result[$k]))
1431 1431
 					{
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 					}
1438 1438
 				}
1439 1439
 
1440
-				if(is_array($result[$k]))
1440
+				if (is_array($result[$k]))
1441 1441
 				{
1442 1442
 					array_walk_recursive($result[$k], function(&$val) { $val = trim($val); });
1443 1443
 				}
@@ -1469,17 +1469,17 @@  discard block
 block discarded – undo
1469 1469
 	 */
1470 1470
 	function _setUploadedArgument()
1471 1471
 	{
1472
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1472
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1473 1473
 		{
1474 1474
 			return;
1475 1475
 		}
1476 1476
 
1477
-		foreach($_FILES as $key => $val)
1477
+		foreach ($_FILES as $key => $val)
1478 1478
 		{
1479 1479
 			$tmp_name = $val['tmp_name'];
1480
-			if(!is_array($tmp_name))
1480
+			if (!is_array($tmp_name))
1481 1481
 			{
1482
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1482
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1483 1483
 				{
1484 1484
 					continue;
1485 1485
 				}
@@ -1492,9 +1492,9 @@  discard block
 block discarded – undo
1492 1492
 				$files = array();
1493 1493
 				$count_files = count($tmp_name);
1494 1494
 
1495
-				for($i = 0; $i < $count_files; $i++)
1495
+				for ($i = 0; $i < $count_files; $i++)
1496 1496
 				{
1497
-					if($val['size'][$i] > 0)
1497
+					if ($val['size'][$i] > 0)
1498 1498
 					{
1499 1499
 						$file = array();
1500 1500
 						$file['name'] = $val['name'][$i];
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
 						$files[] = $file;
1506 1506
 					}
1507 1507
 				}
1508
-				if($files) $this->set($key, $files, TRUE);
1508
+				if ($files) $this->set($key, $files, TRUE);
1509 1509
 			}
1510 1510
 		}
1511 1511
 	}
@@ -1527,16 +1527,16 @@  discard block
 block discarded – undo
1527 1527
 	function getRequestUrl()
1528 1528
 	{
1529 1529
 		static $url = null;
1530
-		if(is_null($url))
1530
+		if (is_null($url))
1531 1531
 		{
1532 1532
 			$url = self::getRequestUri();
1533
-			if(count($_GET) > 0)
1533
+			if (count($_GET) > 0)
1534 1534
 			{
1535
-				foreach($_GET as $key => $val)
1535
+				foreach ($_GET as $key => $val)
1536 1536
 				{
1537
-					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1537
+					$vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : '');
1538 1538
 				}
1539
-				$url .= '?' . join('&', $vars);
1539
+				$url .= '?'.join('&', $vars);
1540 1540
 			}
1541 1541
 		}
1542 1542
 		return $url;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 		$self = self::getInstance();
1552 1552
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1553 1553
 
1554
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1554
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1555 1555
 		{
1556 1556
 			unset($js_callback_func);
1557 1557
 			unset($_GET['xe_js_callback']);
@@ -1579,22 +1579,22 @@  discard block
 block discarded – undo
1579 1579
 		$self = self::getInstance();
1580 1580
 
1581 1581
 		// retrieve virtual site information
1582
-		if(is_null($site_module_info))
1582
+		if (is_null($site_module_info))
1583 1583
 		{
1584 1584
 			$site_module_info = self::get('site_module_info');
1585 1585
 		}
1586 1586
 
1587 1587
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1588
-		if($domain && isSiteID($domain))
1588
+		if ($domain && isSiteID($domain))
1589 1589
 		{
1590 1590
 			$vid = $domain;
1591 1591
 			$domain = '';
1592 1592
 		}
1593 1593
 
1594 1594
 		// If $domain, $vid are not set, use current site information
1595
-		if(!$domain && !$vid)
1595
+		if (!$domain && !$vid)
1596 1596
 		{
1597
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1597
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1598 1598
 			{
1599 1599
 				$vid = $site_module_info->domain;
1600 1600
 			}
@@ -1605,21 +1605,21 @@  discard block
 block discarded – undo
1605 1605
 		}
1606 1606
 
1607 1607
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1608
-		if($domain)
1608
+		if ($domain)
1609 1609
 		{
1610 1610
 			$domain_info = parse_url($domain);
1611
-			if(is_null($current_info))
1611
+			if (is_null($current_info))
1612 1612
 			{
1613
-				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1613
+				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath());
1614 1614
 			}
1615
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1615
+			if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path'])
1616 1616
 			{
1617 1617
 				unset($domain);
1618 1618
 			}
1619 1619
 			else
1620 1620
 			{
1621 1621
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1622
-				if(substr_compare($domain, '/', -1) !== 0)
1622
+				if (substr_compare($domain, '/', -1) !== 0)
1623 1623
 				{
1624 1624
 					$domain .= '/';
1625 1625
 				}
@@ -1629,41 +1629,41 @@  discard block
 block discarded – undo
1629 1629
 		$get_vars = array();
1630 1630
 
1631 1631
 		// If there is no GET variables or first argument is '' to reset variables
1632
-		if(!$self->get_vars || $args_list[0] == '')
1632
+		if (!$self->get_vars || $args_list[0] == '')
1633 1633
 		{
1634 1634
 			// rearrange args_list
1635
-			if(is_array($args_list) && $args_list[0] == '')
1635
+			if (is_array($args_list) && $args_list[0] == '')
1636 1636
 			{
1637 1637
 				array_shift($args_list);
1638 1638
 			}
1639 1639
 		}
1640
-		elseif($_SERVER['REQUEST_METHOD'] == 'GET')
1640
+		elseif ($_SERVER['REQUEST_METHOD'] == 'GET')
1641 1641
 		{
1642 1642
 			// Otherwise, make GET variables into array
1643 1643
 			$get_vars = get_object_vars($self->get_vars);
1644 1644
 		}
1645 1645
 		else
1646 1646
 		{
1647
-			if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1648
-			if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1649
-			if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1650
-			if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1651
-			if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1652
-			if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1653
-			if($get_vars['act'] == 'IS')
1647
+			if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module;
1648
+			if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid;
1649
+			if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act;
1650
+			if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page;
1651
+			if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target;
1652
+			if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword;
1653
+			if ($get_vars['act'] == 'IS')
1654 1654
 			{
1655
-				if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1655
+				if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword;
1656 1656
 			}
1657 1657
 		}
1658 1658
 
1659 1659
 		// arrange args_list
1660
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1660
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1661 1661
 		{
1662 1662
 			$key = $args_list[$i];
1663 1663
 			$val = trim($args_list[$i + 1]);
1664 1664
 
1665 1665
 			// If value is not set, remove the key
1666
-			if(!isset($val) || !strlen($val))
1666
+			if (!isset($val) || !strlen($val))
1667 1667
 			{
1668 1668
 				unset($get_vars[$key]);
1669 1669
 				continue;
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
 
1675 1675
 		// remove vid, rnd
1676 1676
 		unset($get_vars['rnd']);
1677
-		if($vid)
1677
+		if ($vid)
1678 1678
 		{
1679 1679
 			$get_vars['vid'] = $vid;
1680 1680
 		}
@@ -1691,17 +1691,17 @@  discard block
 block discarded – undo
1691 1691
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1692 1692
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1693 1693
 		);
1694
-		if($act_alias[$act])
1694
+		if ($act_alias[$act])
1695 1695
 		{
1696 1696
 			$get_vars['act'] = $act_alias[$act];
1697 1697
 		}
1698 1698
 
1699 1699
 		// organize URL
1700 1700
 		$query = '';
1701
-		if(count($get_vars) > 0)
1701
+		if (count($get_vars) > 0)
1702 1702
 		{
1703 1703
 			// if using rewrite mod
1704
-			if($self->allow_rewrite)
1704
+			if ($self->allow_rewrite)
1705 1705
 			{
1706 1706
 				$var_keys = array_keys($get_vars);
1707 1707
 				sort($var_keys);
@@ -1721,8 +1721,8 @@  discard block
 block discarded – undo
1721 1721
 					'vid' => $vid,
1722 1722
 					'mid' => $mid,
1723 1723
 					'mid.vid' => "$vid/$mid",
1724
-					'entry.mid' => "$mid/entry/" . $get_vars['entry'],
1725
-					'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'],
1724
+					'entry.mid' => "$mid/entry/".$get_vars['entry'],
1725
+					'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'],
1726 1726
 					'document_srl' => $srl,
1727 1727
 					'document_srl.mid' => "$mid/$srl",
1728 1728
 					'document_srl.vid' => "$vid/$srl",
@@ -1739,66 +1739,66 @@  discard block
 block discarded – undo
1739 1739
 				$query = $target_map[$target];
1740 1740
 			}
1741 1741
 
1742
-			if(!$query)
1742
+			if (!$query)
1743 1743
 			{
1744 1744
 				$queries = array();
1745
-				foreach($get_vars as $key => $val)
1745
+				foreach ($get_vars as $key => $val)
1746 1746
 				{
1747
-					if(is_array($val) && count($val) > 0)
1747
+					if (is_array($val) && count($val) > 0)
1748 1748
 					{
1749
-						foreach($val as $k => $v)
1749
+						foreach ($val as $k => $v)
1750 1750
 						{
1751
-							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1751
+							$queries[] = $key.'['.$k.']='.urlencode($v);
1752 1752
 						}
1753 1753
 					}
1754
-					elseif(!is_array($val))
1754
+					elseif (!is_array($val))
1755 1755
 					{
1756
-						$queries[] = $key . '=' . urlencode($val);
1756
+						$queries[] = $key.'='.urlencode($val);
1757 1757
 					}
1758 1758
 				}
1759
-				if(count($queries) > 0)
1759
+				if (count($queries) > 0)
1760 1760
 				{
1761
-					$query = 'index.php?' . join('&', $queries);
1761
+					$query = 'index.php?'.join('&', $queries);
1762 1762
 				}
1763 1763
 			}
1764 1764
 		}
1765 1765
 
1766 1766
 		// If using SSL always
1767 1767
 		$_use_ssl = $self->get('_use_ssl');
1768
-		if($_use_ssl == 'always')
1768
+		if ($_use_ssl == 'always')
1769 1769
 		{
1770
-			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1770
+			$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1771 1771
 			// optional SSL use
1772 1772
 		}
1773
-		elseif($_use_ssl == 'optional')
1773
+		elseif ($_use_ssl == 'optional')
1774 1774
 		{
1775 1775
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1776
-			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1776
+			$query = $self->getRequestUri($ssl_mode, $domain).$query;
1777 1777
 			// no SSL
1778 1778
 		}
1779 1779
 		else
1780 1780
 		{
1781 1781
 			// currently on SSL but target is not based on SSL
1782
-			if($_SERVER['HTTPS'] == 'on')
1782
+			if ($_SERVER['HTTPS'] == 'on')
1783 1783
 			{
1784
-				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1784
+				$query = $self->getRequestUri(ENFORCE_SSL, $domain).$query;
1785 1785
 			}
1786
-			else if($domain) // if $domain is set
1786
+			else if ($domain) // if $domain is set
1787 1787
 			{
1788
-				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1788
+				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query;
1789 1789
 			}
1790 1790
 			else
1791 1791
 			{
1792
-				$query = getScriptPath() . $query;
1792
+				$query = getScriptPath().$query;
1793 1793
 			}
1794 1794
 		}
1795 1795
 
1796
-		if(!$encode)
1796
+		if (!$encode)
1797 1797
 		{
1798 1798
 			return $query;
1799 1799
 		}
1800 1800
 
1801
-		if(!$autoEncode)
1801
+		if (!$autoEncode)
1802 1802
 		{
1803 1803
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1804 1804
 		}
@@ -1807,16 +1807,16 @@  discard block
 block discarded – undo
1807 1807
 		$encode_queries = array();
1808 1808
 		$parsedUrl = parse_url($query);
1809 1809
 		parse_str($parsedUrl['query'], $output);
1810
-		foreach($output as $key => $value)
1810
+		foreach ($output as $key => $value)
1811 1811
 		{
1812
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1812
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1813 1813
 			{
1814 1814
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1815 1815
 			}
1816
-			$encode_queries[] = $key . '=' . $value;
1816
+			$encode_queries[] = $key.'='.$value;
1817 1817
 		}
1818 1818
 
1819
-		return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1819
+		return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1820 1820
 	}
1821 1821
 
1822 1822
 	/**
@@ -1831,17 +1831,17 @@  discard block
 block discarded – undo
1831 1831
 		static $url = array();
1832 1832
 
1833 1833
 		// Check HTTP Request
1834
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1834
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1835 1835
 		{
1836 1836
 			return;
1837 1837
 		}
1838 1838
 
1839
-		if(self::get('_use_ssl') == 'always')
1839
+		if (self::get('_use_ssl') == 'always')
1840 1840
 		{
1841 1841
 			$ssl_mode = ENFORCE_SSL;
1842 1842
 		}
1843 1843
 
1844
-		if($domain)
1844
+		if ($domain)
1845 1845
 		{
1846 1846
 			$domain_key = md5($domain);
1847 1847
 		}
@@ -1850,14 +1850,14 @@  discard block
 block discarded – undo
1850 1850
 			$domain_key = 'default';
1851 1851
 		}
1852 1852
 
1853
-		if(isset($url[$ssl_mode][$domain_key]))
1853
+		if (isset($url[$ssl_mode][$domain_key]))
1854 1854
 		{
1855 1855
 			return $url[$ssl_mode][$domain_key];
1856 1856
 		}
1857 1857
 
1858 1858
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1859 1859
 
1860
-		switch($ssl_mode)
1860
+		switch ($ssl_mode)
1861 1861
 		{
1862 1862
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1863 1863
 				break;
@@ -1867,34 +1867,34 @@  discard block
 block discarded – undo
1867 1867
 				break;
1868 1868
 		}
1869 1869
 
1870
-		if($domain)
1870
+		if ($domain)
1871 1871
 		{
1872 1872
 			$target_url = trim($domain);
1873
-			if(substr_compare($target_url, '/', -1) !== 0)
1873
+			if (substr_compare($target_url, '/', -1) !== 0)
1874 1874
 			{
1875
-				$target_url.= '/';
1875
+				$target_url .= '/';
1876 1876
 			}
1877 1877
 		}
1878 1878
 		else
1879 1879
 		{
1880
-			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1880
+			$target_url = $_SERVER['HTTP_HOST'].getScriptPath();
1881 1881
 		}
1882 1882
 
1883
-		$url_info = parse_url('http://' . $target_url);
1883
+		$url_info = parse_url('http://'.$target_url);
1884 1884
 
1885
-		if($current_use_ssl != $use_ssl)
1885
+		if ($current_use_ssl != $use_ssl)
1886 1886
 		{
1887 1887
 			unset($url_info['port']);
1888 1888
 		}
1889 1889
 
1890
-		if($use_ssl)
1890
+		if ($use_ssl)
1891 1891
 		{
1892 1892
 			$port = self::get('_https_port');
1893
-			if($port && $port != 443)
1893
+			if ($port && $port != 443)
1894 1894
 			{
1895 1895
 				$url_info['port'] = $port;
1896 1896
 			}
1897
-			elseif($url_info['port'] == 443)
1897
+			elseif ($url_info['port'] == 443)
1898 1898
 			{
1899 1899
 				unset($url_info['port']);
1900 1900
 			}
@@ -1902,17 +1902,17 @@  discard block
 block discarded – undo
1902 1902
 		else
1903 1903
 		{
1904 1904
 			$port = self::get('_http_port');
1905
-			if($port && $port != 80)
1905
+			if ($port && $port != 80)
1906 1906
 			{
1907 1907
 				$url_info['port'] = $port;
1908 1908
 			}
1909
-			elseif($url_info['port'] == 80)
1909
+			elseif ($url_info['port'] == 80)
1910 1910
 			{
1911 1911
 				unset($url_info['port']);
1912 1912
 			}
1913 1913
 		}
1914 1914
 
1915
-		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']);
1915
+		$url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']);
1916 1916
 
1917 1917
 		return $url[$ssl_mode][$domain_key];
1918 1918
 	}
@@ -1929,16 +1929,16 @@  discard block
 block discarded – undo
1929 1929
 	{
1930 1930
 		$self = self::getInstance();
1931 1931
 		$self->context->{$key} = $val;
1932
-		if($set_to_get_vars === FALSE)
1932
+		if ($set_to_get_vars === FALSE)
1933 1933
 		{
1934 1934
 			return;
1935 1935
 		}
1936
-		if($val === NULL || $val === '')
1936
+		if ($val === NULL || $val === '')
1937 1937
 		{
1938 1938
 			unset($self->get_vars->{$key});
1939 1939
 			return;
1940 1940
 		}
1941
-		if($set_to_get_vars || $self->get_vars->{$key})
1941
+		if ($set_to_get_vars || $self->get_vars->{$key})
1942 1942
 		{
1943 1943
 			$self->get_vars->{$key} = $val;
1944 1944
 		}
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 	{
1955 1955
 		$self = self::getInstance();
1956 1956
 
1957
-		if(!isset($self->context->{$key}))
1957
+		if (!isset($self->context->{$key}))
1958 1958
 		{
1959 1959
 			return null;
1960 1960
 		}
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 	function gets()
1970 1970
 	{
1971 1971
 		$num_args = func_num_args();
1972
-		if($num_args < 1)
1972
+		if ($num_args < 1)
1973 1973
 		{
1974 1974
 			return;
1975 1975
 		}
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 
1978 1978
 		$args_list = func_get_args();
1979 1979
 		$output = new stdClass();
1980
-		foreach($args_list as $v)
1980
+		foreach ($args_list as $v)
1981 1981
 		{
1982 1982
 			$output->{$v} = $self->get($v);
1983 1983
 		}
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 	function getRequestVars()
2004 2004
 	{
2005 2005
 		$self = self::getInstance();
2006
-		if($self->get_vars)
2006
+		if ($self->get_vars)
2007 2007
 		{
2008 2008
 			return clone($self->get_vars);
2009 2009
 		}
@@ -2020,13 +2020,13 @@  discard block
 block discarded – undo
2020 2020
 	{
2021 2021
 		$self = self::getInstance();
2022 2022
 
2023
-		if(!is_readable($self->sslActionCacheFile))
2023
+		if (!is_readable($self->sslActionCacheFile))
2024 2024
 		{
2025 2025
 			$buff = '<?php if(!defined("__XE__"))exit;';
2026 2026
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2027 2027
 		}
2028 2028
 
2029
-		if(!isset($self->ssl_actions[$action]))
2029
+		if (!isset($self->ssl_actions[$action]))
2030 2030
 		{
2031 2031
 			$self->ssl_actions[$action] = 1;
2032 2032
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2044,16 +2044,16 @@  discard block
 block discarded – undo
2044 2044
 	{
2045 2045
 		$self = self::getInstance();
2046 2046
 
2047
-		if(!is_readable($self->sslActionCacheFile))
2047
+		if (!is_readable($self->sslActionCacheFile))
2048 2048
 		{
2049 2049
 			unset($self->ssl_actions);
2050 2050
 			$buff = '<?php if(!defined("__XE__"))exit;';
2051 2051
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2052 2052
 		}
2053 2053
 
2054
-		foreach($action_array as $action)
2054
+		foreach ($action_array as $action)
2055 2055
 		{
2056
-			if(!isset($self->ssl_actions[$action]))
2056
+			if (!isset($self->ssl_actions[$action]))
2057 2057
 			{
2058 2058
 				$self->ssl_actions[$action] = 1;
2059 2059
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2072,7 +2072,7 @@  discard block
 block discarded – undo
2072 2072
 	{
2073 2073
 		$self = self::getInstance();
2074 2074
 
2075
-		if($self->isExistsSSLAction($action))
2075
+		if ($self->isExistsSSLAction($action))
2076 2076
 		{
2077 2077
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2078 2078
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2089,7 +2089,7 @@  discard block
 block discarded – undo
2089 2089
 	function getSSLActions()
2090 2090
 	{
2091 2091
 		$self = self::getInstance();
2092
-		if($self->getSslStatus() == 'optional')
2092
+		if ($self->getSslStatus() == 'optional')
2093 2093
 		{
2094 2094
 			return $self->ssl_actions;
2095 2095
 		}
@@ -2116,12 +2116,12 @@  discard block
 block discarded – undo
2116 2116
 	 */
2117 2117
 	function normalizeFilePath($file)
2118 2118
 	{
2119
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2119
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2120 2120
 		{
2121
-			$file = './' . $file;
2121
+			$file = './'.$file;
2122 2122
 		}
2123 2123
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2124
-		while(strpos($file, '/../') !== FALSE)
2124
+		while (strpos($file, '/../') !== FALSE)
2125 2125
 		{
2126 2126
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2127 2127
 		}
@@ -2140,13 +2140,13 @@  discard block
 block discarded – undo
2140 2140
 	{
2141 2141
 		$file = self::normalizeFilePath($file);
2142 2142
 		$script_path = getScriptPath();
2143
-		if(strpos($file, './') === 0)
2143
+		if (strpos($file, './') === 0)
2144 2144
 		{
2145
-			$file = $script_path . substr($file, 2);
2145
+			$file = $script_path.substr($file, 2);
2146 2146
 		}
2147
-		elseif(strpos($file, '../') === 0)
2147
+		elseif (strpos($file, '../') === 0)
2148 2148
 		{
2149
-			$file = self::normalizeFilePath($script_path . $file);
2149
+			$file = self::normalizeFilePath($script_path.$file);
2150 2150
 		}
2151 2151
 
2152 2152
 		return $file;
@@ -2216,12 +2216,12 @@  discard block
 block discarded – undo
2216 2216
 	 */
2217 2217
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2218 2218
 	{
2219
-		if($isRuleset)
2219
+		if ($isRuleset)
2220 2220
 		{
2221
-			if(strpos($file, '#') !== FALSE)
2221
+			if (strpos($file, '#') !== FALSE)
2222 2222
 			{
2223 2223
 				$file = str_replace('#', '', $file);
2224
-				if(!is_readable($file))
2224
+				if (!is_readable($file))
2225 2225
 				{
2226 2226
 					$file = $autoPath;
2227 2227
 				}
@@ -2286,9 +2286,9 @@  discard block
 block discarded – undo
2286 2286
 		ksort($files);
2287 2287
 		$files = array_values($files);
2288 2288
 		$filenames = array();
2289
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2289
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2290 2290
 		{
2291
-			if(in_array($files[$i]['file'], $filenames))
2291
+			if (in_array($files[$i]['file'], $filenames))
2292 2292
 			{
2293 2293
 				unset($files[$i]);
2294 2294
 			}
@@ -2373,14 +2373,14 @@  discard block
 block discarded – undo
2373 2373
 	 */
2374 2374
 	function getJavascriptPluginInfo($pluginName)
2375 2375
 	{
2376
-		if($plugin_name == 'ui.datepicker')
2376
+		if ($plugin_name == 'ui.datepicker')
2377 2377
 		{
2378 2378
 			$plugin_name = 'ui';
2379 2379
 		}
2380 2380
 
2381
-		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2382
-		$info_file = $plugin_path . 'plugin.load';
2383
-		if(!is_readable($info_file))
2381
+		$plugin_path = './common/js/plugins/'.$pluginName.'/';
2382
+		$info_file = $plugin_path.'plugin.load';
2383
+		if (!is_readable($info_file))
2384 2384
 		{
2385 2385
 			return;
2386 2386
 		}
@@ -2390,32 +2390,32 @@  discard block
 block discarded – undo
2390 2390
 		$result->jsList = array();
2391 2391
 		$result->cssList = array();
2392 2392
 
2393
-		foreach($list as $filename)
2393
+		foreach ($list as $filename)
2394 2394
 		{
2395 2395
 			$filename = trim($filename);
2396
-			if(!$filename)
2396
+			if (!$filename)
2397 2397
 			{
2398 2398
 				continue;
2399 2399
 			}
2400 2400
 
2401
-			if(strncasecmp('./', $filename, 2) === 0)
2401
+			if (strncasecmp('./', $filename, 2) === 0)
2402 2402
 			{
2403 2403
 				$filename = substr($filename, 2);
2404 2404
 			}
2405 2405
 
2406
-			if(substr_compare($filename, '.js', -3) === 0)
2406
+			if (substr_compare($filename, '.js', -3) === 0)
2407 2407
 			{
2408
-				$result->jsList[] = $plugin_path . $filename;
2408
+				$result->jsList[] = $plugin_path.$filename;
2409 2409
 			}
2410
-			elseif(substr_compare($filename, '.css', -4) === 0)
2410
+			elseif (substr_compare($filename, '.css', -4) === 0)
2411 2411
 			{
2412
-				$result->cssList[] = $plugin_path . $filename;
2412
+				$result->cssList[] = $plugin_path.$filename;
2413 2413
 			}
2414 2414
 		}
2415 2415
 
2416
-		if(is_dir($plugin_path . 'lang'))
2416
+		if (is_dir($plugin_path.'lang'))
2417 2417
 		{
2418
-			$result->langPath = $plugin_path . 'lang';
2418
+			$result->langPath = $plugin_path.'lang';
2419 2419
 		}
2420 2420
 
2421 2421
 		return $result;
@@ -2431,50 +2431,50 @@  discard block
 block discarded – undo
2431 2431
 		static $loaded_plugins = array();
2432 2432
 
2433 2433
 		$self = self::getInstance();
2434
-		if($plugin_name == 'ui.datepicker')
2434
+		if ($plugin_name == 'ui.datepicker')
2435 2435
 		{
2436 2436
 			$plugin_name = 'ui';
2437 2437
 		}
2438 2438
 
2439
-		if($loaded_plugins[$plugin_name])
2439
+		if ($loaded_plugins[$plugin_name])
2440 2440
 		{
2441 2441
 			return;
2442 2442
 		}
2443 2443
 		$loaded_plugins[$plugin_name] = TRUE;
2444 2444
 
2445
-		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2446
-		$info_file = $plugin_path . 'plugin.load';
2447
-		if(!is_readable($info_file))
2445
+		$plugin_path = './common/js/plugins/'.$plugin_name.'/';
2446
+		$info_file = $plugin_path.'plugin.load';
2447
+		if (!is_readable($info_file))
2448 2448
 		{
2449 2449
 			return;
2450 2450
 		}
2451 2451
 
2452 2452
 		$list = file($info_file);
2453
-		foreach($list as $filename)
2453
+		foreach ($list as $filename)
2454 2454
 		{
2455 2455
 			$filename = trim($filename);
2456
-			if(!$filename)
2456
+			if (!$filename)
2457 2457
 			{
2458 2458
 				continue;
2459 2459
 			}
2460 2460
 
2461
-			if(strncasecmp('./', $filename, 2) === 0)
2461
+			if (strncasecmp('./', $filename, 2) === 0)
2462 2462
 			{
2463 2463
 				$filename = substr($filename, 2);
2464 2464
 			}
2465
-			if(substr_compare($filename, '.js', -3) === 0)
2465
+			if (substr_compare($filename, '.js', -3) === 0)
2466 2466
 			{
2467
-				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2467
+				$self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE);
2468 2468
 			}
2469
-			if(substr_compare($filename, '.css', -4) === 0)
2469
+			if (substr_compare($filename, '.css', -4) === 0)
2470 2470
 			{
2471
-				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2471
+				$self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE);
2472 2472
 			}
2473 2473
 		}
2474 2474
 
2475
-		if(is_dir($plugin_path . 'lang'))
2475
+		if (is_dir($plugin_path.'lang'))
2476 2476
 		{
2477
-			$self->loadLang($plugin_path . 'lang');
2477
+			$self->loadLang($plugin_path.'lang');
2478 2478
 		}
2479 2479
 	}
2480 2480
 
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
 	function addHtmlHeader($header)
2488 2488
 	{
2489 2489
 		$self = self::getInstance();
2490
-		$self->html_header .= "\n" . $header;
2490
+		$self->html_header .= "\n".$header;
2491 2491
 	}
2492 2492
 
2493 2493
 	function clearHtmlHeader()
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 	function addBodyHeader($header)
2540 2540
 	{
2541 2541
 		$self = self::getInstance();
2542
-		$self->body_header .= "\n" . $header;
2542
+		$self->body_header .= "\n".$header;
2543 2543
 	}
2544 2544
 
2545 2545
 	/**
@@ -2561,7 +2561,7 @@  discard block
 block discarded – undo
2561 2561
 	function addHtmlFooter($footer)
2562 2562
 	{
2563 2563
 		$self = self::getInstance();
2564
-		$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
2564
+		$self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer;
2565 2565
 	}
2566 2566
 
2567 2567
 	/**
@@ -2582,7 +2582,7 @@  discard block
 block discarded – undo
2582 2582
 	 */
2583 2583
 	function getConfigFile()
2584 2584
 	{
2585
-		return _XE_PATH_ . 'files/config/db.config.php';
2585
+		return _XE_PATH_.'files/config/db.config.php';
2586 2586
 	}
2587 2587
 
2588 2588
 	/**
@@ -2592,7 +2592,7 @@  discard block
 block discarded – undo
2592 2592
 	 */
2593 2593
 	function getFTPConfigFile()
2594 2594
 	{
2595
-		return _XE_PATH_ . 'files/config/ftp.config.php';
2595
+		return _XE_PATH_.'files/config/ftp.config.php';
2596 2596
 	}
2597 2597
 
2598 2598
 	/**
@@ -2644,14 +2644,14 @@  discard block
 block discarded – undo
2644 2644
 		$_path = explode('/', $path);
2645 2645
 		$_base = explode('/', $base_url);
2646 2646
 
2647
-		if(!$_base[count($_base) - 1])
2647
+		if (!$_base[count($_base) - 1])
2648 2648
 		{
2649 2649
 			array_pop($_base);
2650 2650
 		}
2651 2651
 
2652
-		foreach($_xe as $idx => $dir)
2652
+		foreach ($_xe as $idx => $dir)
2653 2653
 		{
2654
-			if($_path[0] != $dir)
2654
+			if ($_path[0] != $dir)
2655 2655
 			{
2656 2656
 				break;
2657 2657
 			}
@@ -2659,9 +2659,9 @@  discard block
 block discarded – undo
2659 2659
 		}
2660 2660
 
2661 2661
 		$idx = count($_xe) - $idx - 1;
2662
-		while($idx--)
2662
+		while ($idx--)
2663 2663
 		{
2664
-			if(count($_base) > 0)
2664
+			if (count($_base) > 0)
2665 2665
 			{
2666 2666
 				array_shift($_base);
2667 2667
 			}
@@ -2671,13 +2671,13 @@  discard block
 block discarded – undo
2671 2671
 			}
2672 2672
 		}
2673 2673
 
2674
-		if(count($_base) > 0)
2674
+		if (count($_base) > 0)
2675 2675
 		{
2676 2676
 			array_unshift($_path, join('/', $_base));
2677 2677
 		}
2678 2678
 
2679
-		$path = '/' . join('/', $_path);
2680
-		if(substr_compare($path, '/', -1) !== 0)
2679
+		$path = '/'.join('/', $_path);
2680
+		if (substr_compare($path, '/', -1) !== 0)
2681 2681
 		{
2682 2682
 			$path .= '/';
2683 2683
 		}
@@ -2692,13 +2692,13 @@  discard block
 block discarded – undo
2692 2692
 	{
2693 2693
 		$self = self::getInstance();
2694 2694
 
2695
-		if(!is_array($self->meta_tags))
2695
+		if (!is_array($self->meta_tags))
2696 2696
 		{
2697 2697
 			$self->meta_tags = array();
2698 2698
 		}
2699 2699
 
2700 2700
 		$ret = array();
2701
-		foreach($self->meta_tags as $key => $val)
2701
+		foreach ($self->meta_tags as $key => $val)
2702 2702
 		{
2703 2703
 			list($name, $is_http_equiv) = explode("\t", $key);
2704 2704
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
@@ -2718,7 +2718,7 @@  discard block
 block discarded – undo
2718 2718
 	function addMetaTag($name, $content, $is_http_equiv = FALSE)
2719 2719
 	{
2720 2720
 		$self = self::getInstance();
2721
-		$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;
2721
+		$self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content;
2722 2722
 	}
2723 2723
 
2724 2724
 }
Please login to merge, or discard this patch.
modules/editor/editor.model.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -113,6 +113,11 @@  discard block
 block discarded – undo
113 113
 		Context::set('drComponentList',$drComponentInfo);
114 114
 	}
115 115
 
116
+	/**
117
+	 * @param string $drComponentName
118
+	 *
119
+	 * @return string
120
+	 */
116 121
 	function getDrComponentXmlInfo($drComponentName)
117 122
 	{
118 123
 		$lang_type = Context::getLangType();
@@ -191,6 +196,7 @@  discard block
 block discarded – undo
191 196
 	 * @brief Return the editor template
192 197
 	 * You can call upload_target_srl when modifying content
193 198
 	 * The upload_target_srl is used for a routine to check if an attachment exists
199
+	 * @param stdClass $option
194 200
 	 */
195 201
 	function getEditor($upload_target_srl = 0, $option = null)
196 202
 	{
@@ -486,6 +492,7 @@  discard block
 block discarded – undo
486 492
 
487 493
 	/**
488 494
 	 * @brief Get information which has been auto-saved
495
+	 * @param integer $upload_target_srl
489 496
 	 */
490 497
 	function getSavedDoc($upload_target_srl)
491 498
 	{
Please login to merge, or discard this patch.
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getEditorConfig($module_srl = null)
25 25
 	{
26
-		if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
26
+		if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
27 27
 		{
28 28
 			// Get trackback settings of the selected module
29 29
 			$oModuleModel = getModel('module');
@@ -34,55 +34,55 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
37
+		if (!is_object($editor_config)) $editor_config = new stdClass();
38 38
 
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
39
+		if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
+		if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
+		if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
+		if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
+		if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
+		if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
+		if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
+		if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
+		if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array();
48 48
 
49
-		if(!$editor_config->editor_height)
49
+		if (!$editor_config->editor_height)
50 50
 		{
51 51
 			$editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500;
52 52
 		}
53
-		if(!$editor_config->comment_editor_height)
53
+		if (!$editor_config->comment_editor_height)
54 54
 		{
55 55
 			$editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120;
56 56
 		}
57
-		if(!$editor_config->editor_skin)
57
+		if (!$editor_config->editor_skin)
58 58
 		{
59 59
 			$editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor';
60 60
 		}
61
-		if(!$editor_config->comment_editor_skin)
61
+		if (!$editor_config->comment_editor_skin)
62 62
 		{
63 63
 			$editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor';
64 64
 		}
65
-		if(!$editor_config->content_style)
65
+		if (!$editor_config->content_style)
66 66
 		{
67 67
 			$editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light';
68 68
 		}
69
-		if(!$editor_config->content_font && $editor_default_config->content_font)
69
+		if (!$editor_config->content_font && $editor_default_config->content_font)
70 70
 		{
71 71
 			$editor_config->content_font = $editor_default_config->content_font;
72 72
 		}
73
-		if(!$editor_config->content_font_size && $editor_default_config->content_font_size)
73
+		if (!$editor_config->content_font_size && $editor_default_config->content_font_size)
74 74
 		{
75 75
 			$editor_config->content_font_size = $editor_default_config->content_font_size;
76 76
 		}
77
-		if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
77
+		if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
78 78
 		{
79 79
 			$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
80 80
 		}
81
-		if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
81
+		if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
82 82
 		{
83 83
 			$editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset;
84 84
 		}
85
-		if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
85
+		if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
86 86
 		{
87 87
 			$editor_config->comment_content_style = $editor_default_config->comment_content_style;
88 88
 		}
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 
93 93
 	function loadDrComponents()
94 94
 	{
95
-		$drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/';
95
+		$drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/';
96 96
 		$drComponentList = FileHandler::readDir($drComponentPath);
97 97
 
98 98
 		$oTemplate = &TemplateHandler::getInstance();
99 99
 
100 100
 		$drComponentInfo = array();
101
-		if($drComponentList)
101
+		if ($drComponentList)
102 102
 		{
103
-			foreach($drComponentList as $i => $drComponent)
103
+			foreach ($drComponentList as $i => $drComponent)
104 104
 			{
105 105
 				unset($obj);
106 106
 				$obj = $this->getDrComponentXmlInfo($drComponent);
107
-				Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent));
108
-				$path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent);
109
-				$obj->html = $oTemplate->compile($path,$drComponent);
107
+				Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent));
108
+				$path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent);
109
+				$obj->html = $oTemplate->compile($path, $drComponent);
110 110
 				$drComponentInfo[$drComponent] = $obj;
111 111
 			}
112 112
 		}
113
-		Context::set('drComponentList',$drComponentInfo);
113
+		Context::set('drComponentList', $drComponentInfo);
114 114
 	}
115 115
 
116 116
 	function getDrComponentXmlInfo($drComponentName)
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$xml_file = sprintf('%sinfo.xml', $component_path);
123 123
 		$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
124 124
 		// Return information after including it after cached xml file exists
125
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
125
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
126 126
 		{
127 127
 			include($cache_file);
128 128
 			return $xml_info;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 152
 
153 153
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
154
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155 155
 		else $author_list = $xml_doc->component->author;
156 156
 
157
-		for($i=0; $i < count($author_list); $i++)
157
+		for ($i = 0; $i < count($author_list); $i++)
158 158
 		{
159 159
 			$buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
160 160
 			$buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
 		// List extra variables (text type only in the editor component)
165 165
 		$extra_vars = $xml_doc->component->extra_vars->var;
166
-		if($extra_vars)
166
+		if ($extra_vars)
167 167
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
-			foreach($extra_vars as $key => $val)
168
+			if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
+			foreach ($extra_vars as $key => $val)
170 170
 			{
171 171
 				unset($obj);
172 172
 				$key = $val->attrs->name;
@@ -198,47 +198,47 @@  discard block
 block discarded – undo
198 198
 		 * Editor's default options
199 199
 		 */
200 200
 		// Option setting to allow file upload
201
-		if($upload_target_srl)
201
+		if ($upload_target_srl)
202 202
 		{
203 203
 			$option->editor_sequence = $upload_target_srl;
204 204
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
205
+		if (!$option->allow_fileupload) $allow_fileupload = false;
206 206
 		else $allow_fileupload = true;
207 207
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
208
+		if (!$option->content_style) $option->content_style = 'ckeditor_light';
209 209
 		Context::set('content_style', $option->content_style);
210
-		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
210
+		Context::set('content_style_path', getScriptPath().ltrim($this->module_path, './').'styles/'.$option->content_style);
211 211
 		// Default font setting
212 212
 		Context::set('content_font', addslashes($option->content_font));
213 213
 		Context::set('content_font_size', $option->content_font_size);
214 214
 
215 215
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
216
+		if (!$option->enable_autosave) $enable_autosave = false;
217
+		elseif (Context::get($option->primary_key_name)) $enable_autosave = false;
218 218
 		else $enable_autosave = true;
219 219
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
220
+		if (!$option->enable_default_component) $enable_default_component = false;
221 221
 		else $enable_default_component = true;
222 222
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
223
+		if (!$option->enable_component) $enable_component = false;
224 224
 		else $enable_component = true;
225 225
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
226
+		if ($option->disable_html) $html_mode = false;
227 227
 		else $html_mode = true;
228 228
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
229
+		if (!$option->height) $editor_height = 300;
230 230
 		else $editor_height = $option->height;
231 231
 		// Skin Setting
232 232
 		$skin = $option->skin;
233
-		if(!$skin) $skin = 'ckeditor';
233
+		if (!$skin) $skin = 'ckeditor';
234 234
 
235 235
 		$colorset = $option->colorset;
236
-		if(!$colorset) $colorset = 'moono';
236
+		if (!$colorset) $colorset = 'moono';
237 237
 		Context::set('colorset', $colorset);
238 238
 		Context::set('skin', $skin);
239 239
 		Context::set('module_type', $option->module_type);
240 240
 
241
-		if($skin=='dreditor')
241
+		if ($skin == 'dreditor')
242 242
 		{
243 243
 			$this->loadDrComponents();
244 244
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		/**
247 247
 		 * Check the automatic backup feature (do not use if the post is edited)
248 248
 		 */
249
-		if($enable_autosave)
249
+		if ($enable_autosave)
250 250
 		{
251 251
 			// Extract auto-saved data
252 252
 			$saved_doc = $this->getSavedDoc($upload_target_srl);
@@ -258,26 +258,26 @@  discard block
 block discarded – undo
258 258
 		/**
259 259
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
260 260
 		 */
261
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
261
+		if ($option->editor_sequence) $editor_sequence = $option->editor_sequence;
262 262
 		else
263 263
 		{
264
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
265
-			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
264
+			if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
265
+			$editor_sequence = $_SESSION['_editor_sequence_']++;
266 266
 		}
267 267
 
268 268
 		/**
269 269
 		 * Upload setting by using configuration of the file module internally
270 270
 		 */
271 271
 		$files_count = 0;
272
-		if($allow_fileupload)
272
+		if ($allow_fileupload)
273 273
 		{
274 274
 			$oFileModel = getModel('file');
275 275
 			// Get upload configuration to set on SWFUploader
276 276
 			$file_config = $oFileModel->getUploadConfig();
277
-			$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
278
-			$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
277
+			$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
278
+			$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
279 279
 
280
-			Context::set('file_config',$file_config);
280
+			Context::set('file_config', $file_config);
281 281
 			// Configure upload status such as file size
282 282
 			$upload_status = $oFileModel->getUploadStatus();
283 283
 			Context::set('upload_status', $upload_status);
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			$oFileController = getController('file');
286 286
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
287 287
 			// Check if the file already exists
288
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
288
+			if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
289 289
 		}
290
-		Context::set('files_count', (int)$files_count);
290
+		Context::set('files_count', (int) $files_count);
291 291
 
292 292
 		Context::set('allow_fileupload', $allow_fileupload);
293 293
 		// Set editor_sequence value
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		 * Check editor component
305 305
 		 */
306 306
 		$site_module_info = Context::get('site_module_info');
307
-		$site_srl = (int)$site_module_info->site_srl;
308
-		if($enable_component)
307
+		$site_srl = (int) $site_module_info->site_srl;
308
+		if ($enable_component)
309 309
 		{
310
-			if(!Context::get('component_list'))
310
+			if (!Context::get('component_list'))
311 311
 			{
312 312
 				$component_list = $this->getComponentList(true, $site_srl);
313 313
 				Context::set('component_list', $component_list);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
335 335
 		$tpl_file = 'editor.html';
336 336
 
337
-		if(!file_exists($tpl_path.$tpl_file))
337
+		if (!file_exists($tpl_path.$tpl_file))
338 338
 		{
339 339
 			$skin = 'ckeditor';
340 340
 			$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		$config->module_type = $type;
365 365
 
366 366
 		// Configurations listed according to a type
367
-		if($type == 'document')
367
+		if ($type == 'document')
368 368
 		{
369 369
 			$config->editor_skin = $editor_config->editor_skin;
370 370
 			$config->content_style = $editor_config->content_style;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			$config->enable_autosave = 'N';
394 394
 		}
395 395
 		// Check a group_list of the currently logged-in user for permission check
396
-		if(Context::get('is_logged'))
396
+		if (Context::get('is_logged'))
397 397
 		{
398 398
 			$logged_info = Context::get('logged_info');
399 399
 			$group_list = $logged_info->group_list;
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
 		$option->colorset = $config->sel_editor_colorset;
413 413
 		// Permission check for file upload
414 414
 		$option->allow_fileupload = false;
415
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
416
-		elseif(count($config->upload_file_grant))
415
+		if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true;
416
+		elseif (count($config->upload_file_grant))
417 417
 		{
418
-			foreach($group_list as $group_srl => $group_info)
418
+			foreach ($group_list as $group_srl => $group_info)
419 419
 			{
420
-				if(in_array($group_srl, $config->upload_file_grant))
420
+				if (in_array($group_srl, $config->upload_file_grant))
421 421
 				{
422 422
 					$option->allow_fileupload = true;
423 423
 					break;
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 		else $option->allow_fileupload = true;
428 428
 		// Permission check for using default components
429 429
 		$option->enable_default_component = false;
430
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
431
-		elseif(count($config->enable_default_component_grant))
430
+		if ($logged_info->is_admin == 'Y') $option->enable_default_component = true;
431
+		elseif (count($config->enable_default_component_grant))
432 432
 		{
433
-			foreach($group_list as $group_srl => $group_info)
433
+			foreach ($group_list as $group_srl => $group_info)
434 434
 			{
435
-				if(in_array($group_srl, $config->enable_default_component_grant))
435
+				if (in_array($group_srl, $config->enable_default_component_grant))
436 436
 				{
437 437
 					$option->enable_default_component = true;
438 438
 					break;
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 		else $option->enable_default_component = true;
443 443
 		// Permisshion check for using extended components
444 444
 		$option->enable_component = false;
445
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
446
-		elseif(count($config->enable_component_grant))
445
+		if ($logged_info->is_admin == 'Y') $option->enable_component = true;
446
+		elseif (count($config->enable_component_grant))
447 447
 		{
448
-			foreach($group_list as $group_srl => $group_info)
448
+			foreach ($group_list as $group_srl => $group_info)
449 449
 			{
450
-				if(in_array($group_srl, $config->enable_component_grant))
450
+				if (in_array($group_srl, $config->enable_component_grant))
451 451
 				{
452 452
 					$option->enable_component = true;
453 453
 					break;
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 		else $option->enable_component = true;
458 458
 		// HTML editing privileges
459 459
 		$enable_html = false;
460
-		if($logged_info->is_admin=='Y') $enable_html = true;
461
-		elseif(count($config->enable_html_grant))
460
+		if ($logged_info->is_admin == 'Y') $enable_html = true;
461
+		elseif (count($config->enable_html_grant))
462 462
 		{
463
-			foreach($group_list as $group_srl => $group_info)
463
+			foreach ($group_list as $group_srl => $group_info)
464 464
 			{
465
-				if(in_array($group_srl, $config->enable_html_grant))
465
+				if (in_array($group_srl, $config->enable_html_grant))
466 466
 				{
467 467
 					$enable_html = true;
468 468
 					break;
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 		else $enable_html = true;
473 473
 
474
-		if($enable_html) $option->disable_html = false;
474
+		if ($enable_html) $option->disable_html = false;
475 475
 		else $option->disable_html = true;
476 476
 		// Set Height
477 477
 		$option->height = $config->editor_height;
478 478
 		// Set an option for Auto-save
479
-		$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
479
+		$option->enable_autosave = $config->enable_autosave == 'Y' ?true:false;
480 480
 		// Other settings
481 481
 		$option->primary_key_name = $primary_key_name;
482 482
 		$option->content_key_name = $content_key_name;
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	{
492 492
 		$auto_save_args = new stdClass();
493 493
 		// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
494
-		if(Context::get('is_logged'))
494
+		if (Context::get('is_logged'))
495 495
 		{
496 496
 			$logged_info = Context::get('logged_info');
497 497
 			$auto_save_args->member_srl = $logged_info->member_srl;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 		}
503 503
 		$auto_save_args->module_srl = Context::get('module_srl');
504 504
 		// Get the current module if module_srl doesn't exist
505
-		if(!$auto_save_args->module_srl)
505
+		if (!$auto_save_args->module_srl)
506 506
 		{
507 507
 			$current_module_info = Context::get('current_module_info');
508 508
 			$auto_save_args->module_srl = $current_module_info->module_srl;
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
512 512
 		$saved_doc = $output->data;
513 513
 		// Return null if no result is auto-saved
514
-		if(!$saved_doc) return;
514
+		if (!$saved_doc) return;
515 515
 		// Check if the auto-saved document already exists
516 516
 		$oDocumentModel = getModel('document');
517 517
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
518
-		if($oSaved->isExists()) return;
518
+		if ($oSaved->isExists()) return;
519 519
 		// Move all the files if the auto-saved data contains document_srl and file
520 520
 		// Then set document_srl to editor_sequence
521
-		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
521
+		if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
522 522
 		{
523 523
 			$saved_doc->module_srl = $auto_save_args->module_srl;
524 524
 			$oFileController = getController('file');
525 525
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
526 526
 		}
527
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
527
+		else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
528 528
 		// Change auto-saved data
529 529
 		$oEditorController = getController('editor');
530 530
 		$oEditorController->deleteSavedDoc(false);
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
542 542
 	{
543
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
543
+		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return;
544 544
 
545
-		if(!$this->loaded_component_list[$component][$editor_sequence])
545
+		if (!$this->loaded_component_list[$component][$editor_sequence])
546 546
 		{
547 547
 			// Create an object of the component and execute
548 548
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
549 549
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
550
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
550
+			if (!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
551 551
 			// Create an object after loading the class file
552 552
 			require_once($class_file);
553 553
 			$oComponent = new $component($editor_sequence, $class_path);
554
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
554
+			if (!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
555 555
 			// Add configuration information
556 556
 			$component_info = $this->getComponent($component, $site_srl);
557 557
 			$oComponent->setInfo($component_info);
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 	/**
573 573
 	 * @brief Return the cache file name of editor component list
574 574
 	 */
575
-	function getCacheFile($filter_enabled= true, $site_srl = 0)
575
+	function getCacheFile($filter_enabled = true, $site_srl = 0)
576 576
 	{
577 577
 		$lang = Context::getLangType();
578 578
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
579 579
 		FileHandler::makeDir($cache_path);
580
-		$cache_file = $cache_path.'component_list.' . $lang .'.';
581
-		if($filter_enabled) $cache_file .= 'filter.';
582
-		if($site_srl) $cache_file .= $site_srl.'.';
580
+		$cache_file = $cache_path.'component_list.'.$lang.'.';
581
+		if ($filter_enabled) $cache_file .= 'filter.';
582
+		if ($site_srl) $cache_file .= $site_srl.'.';
583 583
 		$cache_file .= 'php';
584 584
 		return $cache_file;
585 585
 	}
@@ -587,19 +587,19 @@  discard block
 block discarded – undo
587 587
 	/**
588 588
 	 * @brief Return a component list (DB Information included)
589 589
 	 */
590
-	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
590
+	function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false)
591 591
 	{
592 592
 		$cache_file = $this->getCacheFile(false, $site_srl);
593
-		if($from_db || !file_exists($cache_file))
593
+		if ($from_db || !file_exists($cache_file))
594 594
 		{
595 595
 			$oEditorController = getController('editor');
596 596
 			$oEditorController->makeCache(false, $site_srl);
597 597
 		}
598 598
 
599
-		if(!file_exists($cache_file)) return;
599
+		if (!file_exists($cache_file)) return;
600 600
 		include($cache_file);
601 601
 		$logged_info = Context::get('logged_info');
602
-		if($logged_info && is_array($logged_info->group_list))
602
+		if ($logged_info && is_array($logged_info->group_list))
603 603
 		{
604 604
 			$group_list = array_keys($logged_info->group_list);
605 605
 		}
@@ -608,45 +608,45 @@  discard block
 block discarded – undo
608 608
 			$group_list = array();
609 609
 		}
610 610
 
611
-		if(count($component_list))
611
+		if (count($component_list))
612 612
 		{
613
-			foreach($component_list as $key => $val)
613
+			foreach ($component_list as $key => $val)
614 614
 			{
615
-				if(!trim($key)) continue;
616
-				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
615
+				if (!trim($key)) continue;
616
+				if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
617 617
 				{
618 618
 					FileHandler::removeFile($cache_file);
619 619
 					return $this->getComponentList($filter_enabled, $site_srl);
620 620
 				}
621
-				if(!$filter_enabled) continue;
622
-				if($val->enabled == "N")
621
+				if (!$filter_enabled) continue;
622
+				if ($val->enabled == "N")
623 623
 				{
624 624
 					unset($component_list->{$key});
625 625
 					continue;
626 626
 				}
627
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
628
-				if($val->target_group)
627
+				if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
628
+				if ($val->target_group)
629 629
 				{
630
-					if(!$logged_info)
630
+					if (!$logged_info)
631 631
 					{
632 632
 						$val->enabled = "N";
633 633
 					}
634 634
 					else
635 635
 					{
636 636
 						$is_granted = false;
637
-						foreach($group_list as $group_srl)
637
+						foreach ($group_list as $group_srl)
638 638
 						{
639
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
639
+							if (in_array($group_srl, $val->target_group)) $is_granted = true;
640 640
 						}
641
-						if(!$is_granted) $val->enabled = "N";
641
+						if (!$is_granted) $val->enabled = "N";
642 642
 					}
643 643
 				}
644
-				if($val->enabled != "N" && $val->mid_list)
644
+				if ($val->enabled != "N" && $val->mid_list)
645 645
 				{
646 646
 					$mid = Context::get('mid');
647
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
647
+					if (!in_array($mid, $val->mid_list)) $val->enabled = "N";
648 648
 				}
649
-				if($val->enabled == "N")
649
+				if ($val->enabled == "N")
650 650
 				{
651 651
 					unset($component_list->{$key});
652 652
 					continue;
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		$args = new stdClass();
665 665
 		$args->component_name = $component_name;
666 666
 
667
-		if($site_srl)
667
+		if ($site_srl)
668 668
 		{
669 669
 			$args->site_srl = $site_srl;
670 670
 			$output = executeQuery('editor.getSiteComponent', $args);
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		}
676 676
 		$component = $output->data;
677 677
 
678
-		if(!$output->data) return false;
678
+		if (!$output->data) return false;
679 679
 
680 680
 		$component_name = $component->component_name;
681 681
 
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 
688 688
 		$xml_info->mid_list = array();
689 689
 
690
-		if($component->extra_vars)
690
+		if ($component->extra_vars)
691 691
 		{
692 692
 			$extra_vars = unserialize($component->extra_vars);
693 693
 
694
-			if($extra_vars->target_group)
694
+			if ($extra_vars->target_group)
695 695
 			{
696 696
 				$xml_info->target_group = $extra_vars->target_group;
697 697
 				unset($extra_vars->target_group);
698 698
 			}
699 699
 
700
-			if($extra_vars->mid_list)
700
+			if ($extra_vars->mid_list)
701 701
 			{
702 702
 				$xml_info->mid_list = $extra_vars->mid_list;
703 703
 				unset($extra_vars->mid_list);
704 704
 			}
705 705
 
706
-			if($xml_info->extra_vars)
706
+			if ($xml_info->extra_vars)
707 707
 			{
708
-				foreach($xml_info->extra_vars as $key => $val)
708
+				foreach ($xml_info->extra_vars as $key => $val)
709 709
 				{
710 710
 					$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
711 711
 				}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
730 730
 
731 731
 		// Include and return xml file information if cached file exists
732
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
732
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
733 733
 		{
734 734
 			include($cache_file);
735 735
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 		$component_info->component_name = $component;
747 747
 		$component_info->title = $xml_doc->component->title->body;
748 748
 
749
-		if($xml_doc->component->version)
749
+		if ($xml_doc->component->version)
750 750
 		{
751 751
 			$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
752 752
 			$component_info->version = $xml_doc->component->version->body;
@@ -772,10 +772,10 @@  discard block
 block discarded – undo
772 772
 
773 773
 		// Author information
774 774
 		$author_list = array();
775
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
775
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
776 776
 		else $author_list = $xml_doc->component->author;
777 777
 
778
-		for($i = 0; $i < count($author_list); $i++)
778
+		for ($i = 0; $i < count($author_list); $i++)
779 779
 		{
780 780
 			$author = new stdClass;
781 781
 			$author->name = $author_list[$i]->name->body;
@@ -786,39 +786,39 @@  discard block
 block discarded – undo
786 786
 
787 787
 		// List extra variables (text type only for editor component)
788 788
 		$extra_vars = $xml_doc->component->extra_vars;
789
-		if($extra_vars)
789
+		if ($extra_vars)
790 790
 		{
791 791
 			$extra_var_groups = $extra_vars->group;
792
-			if(!$extra_var_groups)
792
+			if (!$extra_var_groups)
793 793
 			{
794 794
 				$extra_var_groups = $extra_vars;
795 795
 			}
796
-			if(!is_array($extra_var_groups))
796
+			if (!is_array($extra_var_groups))
797 797
 			{
798 798
 				$extra_var_groups = array($extra_var_groups);
799 799
 			}
800 800
 
801
-			foreach($extra_var_groups as $group)
801
+			foreach ($extra_var_groups as $group)
802 802
 			{
803 803
 				$extra_vars = $group->var;
804
-				if(!is_array($group->var))
804
+				if (!is_array($group->var))
805 805
 				{
806 806
 					$extra_vars = array($group->var);
807 807
 				}
808 808
 
809
-				foreach($extra_vars as $key => $val)
809
+				foreach ($extra_vars as $key => $val)
810 810
 				{
811
-					if(!$val)
811
+					if (!$val)
812 812
 					{
813 813
 						continue;
814 814
 					}
815 815
 
816 816
 					$obj = new stdClass();
817
-					if(!$val->attrs)
817
+					if (!$val->attrs)
818 818
 					{
819 819
 						$val->attrs = new stdClass();
820 820
 					}
821
-					if(!$val->attrs->type)
821
+					if (!$val->attrs->type)
822 822
 					{
823 823
 						$val->attrs->type = 'text';
824 824
 					}
@@ -828,26 +828,26 @@  discard block
 block discarded – undo
828 828
 					$obj->title = $val->title->body;
829 829
 					$obj->type = $val->attrs->type;
830 830
 					$obj->description = $val->description->body;
831
-					if($obj->name)
831
+					if ($obj->name)
832 832
 					{
833 833
 						$obj->value = $extra_vals->{$obj->name};
834 834
 					}
835
-					if(strpos($obj->value, '|@|') != FALSE)
835
+					if (strpos($obj->value, '|@|') != FALSE)
836 836
 					{
837 837
 						$obj->value = explode('|@|', $obj->value);
838 838
 					}
839
-					if($obj->type == 'mid_list' && !is_array($obj->value))
839
+					if ($obj->type == 'mid_list' && !is_array($obj->value))
840 840
 					{
841 841
 						$obj->value = array($obj->value);
842 842
 					}
843 843
 
844 844
 					// 'Select'type obtained from the option list.
845
-					if($val->options && !is_array($val->options))
845
+					if ($val->options && !is_array($val->options))
846 846
 					{
847 847
 						$val->options = array($val->options);
848 848
 					}
849 849
 
850
-					for($i = 0, $c = count($val->options); $i < $c; $i++)
850
+					for ($i = 0, $c = count($val->options); $i < $c; $i++)
851 851
 					{
852 852
 						$obj->options[$i] = new stdClass();
853 853
 						$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 
862 862
 		$buff = array();
863 863
 		$buff[] = '<?php if(!defined(\'__XE__\')) exit();';
864
-		$buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';';
864
+		$buff[] = '$xml_info = '.var_export($component_info, TRUE).';';
865 865
 		$buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff));
866 866
 
867 867
 		FileHandler::writeFile($cache_file, $buff, 'w');
Please login to merge, or discard this patch.
Braces   +173 added lines, -80 removed lines patch added patch discarded remove patch
@@ -34,17 +34,37 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
38
-
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
37
+		if(!is_object($editor_config)) {
38
+			$editor_config = new stdClass();
39
+		}
40
+
41
+		if($editor_config->enable_autosave != 'N') {
42
+			$editor_config->enable_autosave = 'Y';
43
+		}
44
+		if(!is_array($editor_config->enable_html_grant)) {
45
+			$editor_config->enable_html_grant = array();
46
+		}
47
+		if(!is_array($editor_config->enable_comment_html_grant)) {
48
+			$editor_config->enable_comment_html_grant = array();
49
+		}
50
+		if(!is_array($editor_config->upload_file_grant)) {
51
+			$editor_config->upload_file_grant = array();
52
+		}
53
+		if(!is_array($editor_config->comment_upload_file_grant)) {
54
+			$editor_config->comment_upload_file_grant = array();
55
+		}
56
+		if(!is_array($editor_config->enable_default_component_grant)) {
57
+			$editor_config->enable_default_component_grant = array();
58
+		}
59
+		if(!is_array($editor_config->enable_comment_default_component_grant)) {
60
+			$editor_config->enable_comment_default_component_grant = array();
61
+		}
62
+		if(!is_array($editor_config->enable_component_grant)) {
63
+			$editor_config->enable_component_grant = array();
64
+		}
65
+		if(!is_array($editor_config->enable_comment_component_grant)) {
66
+			$editor_config->enable_comment_component_grant= array();
67
+		}
48 68
 
49 69
 		if(!$editor_config->editor_height)
50 70
 		{
@@ -151,8 +171,11 @@  discard block
 block discarded – undo
151 171
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 172
 
153 173
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155
-		else $author_list = $xml_doc->component->author;
174
+		if(!is_array($xml_doc->component->author)) {
175
+			$author_list[] = $xml_doc->component->author;
176
+		} else {
177
+			$author_list = $xml_doc->component->author;
178
+		}
156 179
 
157 180
 		for($i=0; $i < count($author_list); $i++)
158 181
 		{
@@ -165,7 +188,9 @@  discard block
 block discarded – undo
165 188
 		$extra_vars = $xml_doc->component->extra_vars->var;
166 189
 		if($extra_vars)
167 190
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
191
+			if(!is_array($extra_vars)) {
192
+				$extra_vars = array($extra_vars);
193
+			}
169 194
 			foreach($extra_vars as $key => $val)
170 195
 			{
171 196
 				unset($obj);
@@ -202,10 +227,15 @@  discard block
 block discarded – undo
202 227
 		{
203 228
 			$option->editor_sequence = $upload_target_srl;
204 229
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
206
-		else $allow_fileupload = true;
230
+		if(!$option->allow_fileupload) {
231
+			$allow_fileupload = false;
232
+		} else {
233
+			$allow_fileupload = true;
234
+		}
207 235
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
236
+		if(!$option->content_style) {
237
+			$option->content_style = 'ckeditor_light';
238
+		}
209 239
 		Context::set('content_style', $option->content_style);
210 240
 		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
211 241
 		// Default font setting
@@ -213,27 +243,47 @@  discard block
 block discarded – undo
213 243
 		Context::set('content_font_size', $option->content_font_size);
214 244
 
215 245
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
218
-		else $enable_autosave = true;
246
+		if(!$option->enable_autosave) {
247
+			$enable_autosave = false;
248
+		} elseif(Context::get($option->primary_key_name)) {
249
+			$enable_autosave = false;
250
+		} else {
251
+			$enable_autosave = true;
252
+		}
219 253
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
221
-		else $enable_default_component = true;
254
+		if(!$option->enable_default_component) {
255
+			$enable_default_component = false;
256
+		} else {
257
+			$enable_default_component = true;
258
+		}
222 259
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
224
-		else $enable_component = true;
260
+		if(!$option->enable_component) {
261
+			$enable_component = false;
262
+		} else {
263
+			$enable_component = true;
264
+		}
225 265
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
227
-		else $html_mode = true;
266
+		if($option->disable_html) {
267
+			$html_mode = false;
268
+		} else {
269
+			$html_mode = true;
270
+		}
228 271
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
230
-		else $editor_height = $option->height;
272
+		if(!$option->height) {
273
+			$editor_height = 300;
274
+		} else {
275
+			$editor_height = $option->height;
276
+		}
231 277
 		// Skin Setting
232 278
 		$skin = $option->skin;
233
-		if(!$skin) $skin = 'ckeditor';
279
+		if(!$skin) {
280
+			$skin = 'ckeditor';
281
+		}
234 282
 
235 283
 		$colorset = $option->colorset;
236
-		if(!$colorset) $colorset = 'moono';
284
+		if(!$colorset) {
285
+			$colorset = 'moono';
286
+		}
237 287
 		Context::set('colorset', $colorset);
238 288
 		Context::set('skin', $skin);
239 289
 		Context::set('module_type', $option->module_type);
@@ -258,10 +308,13 @@  discard block
 block discarded – undo
258 308
 		/**
259 309
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
260 310
 		 */
261
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
262
-		else
311
+		if($option->editor_sequence) {
312
+			$editor_sequence = $option->editor_sequence;
313
+		} else
263 314
 		{
264
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
315
+			if(!$_SESSION['_editor_sequence_']) {
316
+				$_SESSION['_editor_sequence_'] = 1;
317
+			}
265 318
 			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
266 319
 		}
267 320
 
@@ -285,7 +338,9 @@  discard block
 block discarded – undo
285 338
 			$oFileController = getController('file');
286 339
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
287 340
 			// Check if the file already exists
288
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
341
+			if($upload_target_srl) {
342
+				$files_count = $oFileModel->getFilesCount($upload_target_srl);
343
+			}
289 344
 		}
290 345
 		Context::set('files_count', (int)$files_count);
291 346
 
@@ -377,8 +432,7 @@  discard block
 block discarded – undo
377 432
 			$config->enable_html_grant = $editor_config->enable_html_grant;
378 433
 			$config->editor_height = $editor_config->editor_height;
379 434
 			$config->enable_autosave = $editor_config->enable_autosave;
380
-		}
381
-		else
435
+		} else
382 436
 		{
383 437
 			$config->editor_skin = $editor_config->comment_editor_skin;
384 438
 			$config->content_style = $editor_config->comment_content_style;
@@ -397,8 +451,7 @@  discard block
 block discarded – undo
397 451
 		{
398 452
 			$logged_info = Context::get('logged_info');
399 453
 			$group_list = $logged_info->group_list;
400
-		}
401
-		else
454
+		} else
402 455
 		{
403 456
 			$group_list = array();
404 457
 		}
@@ -412,8 +465,9 @@  discard block
 block discarded – undo
412 465
 		$option->colorset = $config->sel_editor_colorset;
413 466
 		// Permission check for file upload
414 467
 		$option->allow_fileupload = false;
415
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
416
-		elseif(count($config->upload_file_grant))
468
+		if($logged_info->is_admin=='Y') {
469
+			$option->allow_fileupload = true;
470
+		} elseif(count($config->upload_file_grant))
417 471
 		{
418 472
 			foreach($group_list as $group_srl => $group_info)
419 473
 			{
@@ -423,12 +477,14 @@  discard block
 block discarded – undo
423 477
 					break;
424 478
 				}
425 479
 			}
480
+		} else {
481
+			$option->allow_fileupload = true;
426 482
 		}
427
-		else $option->allow_fileupload = true;
428 483
 		// Permission check for using default components
429 484
 		$option->enable_default_component = false;
430
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
431
-		elseif(count($config->enable_default_component_grant))
485
+		if($logged_info->is_admin=='Y') {
486
+			$option->enable_default_component = true;
487
+		} elseif(count($config->enable_default_component_grant))
432 488
 		{
433 489
 			foreach($group_list as $group_srl => $group_info)
434 490
 			{
@@ -438,12 +494,14 @@  discard block
 block discarded – undo
438 494
 					break;
439 495
 				}
440 496
 			}
497
+		} else {
498
+			$option->enable_default_component = true;
441 499
 		}
442
-		else $option->enable_default_component = true;
443 500
 		// Permisshion check for using extended components
444 501
 		$option->enable_component = false;
445
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
446
-		elseif(count($config->enable_component_grant))
502
+		if($logged_info->is_admin=='Y') {
503
+			$option->enable_component = true;
504
+		} elseif(count($config->enable_component_grant))
447 505
 		{
448 506
 			foreach($group_list as $group_srl => $group_info)
449 507
 			{
@@ -453,12 +511,14 @@  discard block
 block discarded – undo
453 511
 					break;
454 512
 				}
455 513
 			}
514
+		} else {
515
+			$option->enable_component = true;
456 516
 		}
457
-		else $option->enable_component = true;
458 517
 		// HTML editing privileges
459 518
 		$enable_html = false;
460
-		if($logged_info->is_admin=='Y') $enable_html = true;
461
-		elseif(count($config->enable_html_grant))
519
+		if($logged_info->is_admin=='Y') {
520
+			$enable_html = true;
521
+		} elseif(count($config->enable_html_grant))
462 522
 		{
463 523
 			foreach($group_list as $group_srl => $group_info)
464 524
 			{
@@ -468,11 +528,15 @@  discard block
 block discarded – undo
468 528
 					break;
469 529
 				}
470 530
 			}
531
+		} else {
532
+			$enable_html = true;
471 533
 		}
472
-		else $enable_html = true;
473 534
 
474
-		if($enable_html) $option->disable_html = false;
475
-		else $option->disable_html = true;
535
+		if($enable_html) {
536
+			$option->disable_html = false;
537
+		} else {
538
+			$option->disable_html = true;
539
+		}
476 540
 		// Set Height
477 541
 		$option->height = $config->editor_height;
478 542
 		// Set an option for Auto-save
@@ -495,8 +559,7 @@  discard block
 block discarded – undo
495 559
 		{
496 560
 			$logged_info = Context::get('logged_info');
497 561
 			$auto_save_args->member_srl = $logged_info->member_srl;
498
-		}
499
-		else
562
+		} else
500 563
 		{
501 564
 			$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
502 565
 		}
@@ -511,11 +574,15 @@  discard block
 block discarded – undo
511 574
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
512 575
 		$saved_doc = $output->data;
513 576
 		// Return null if no result is auto-saved
514
-		if(!$saved_doc) return;
577
+		if(!$saved_doc) {
578
+			return;
579
+		}
515 580
 		// Check if the auto-saved document already exists
516 581
 		$oDocumentModel = getModel('document');
517 582
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
518
-		if($oSaved->isExists()) return;
583
+		if($oSaved->isExists()) {
584
+			return;
585
+		}
519 586
 		// Move all the files if the auto-saved data contains document_srl and file
520 587
 		// Then set document_srl to editor_sequence
521 588
 		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@@ -523,8 +590,9 @@  discard block
 block discarded – undo
523 590
 			$saved_doc->module_srl = $auto_save_args->module_srl;
524 591
 			$oFileController = getController('file');
525 592
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
593
+		} else if($upload_target_srl) {
594
+			$saved_doc->document_srl = $upload_target_srl;
526 595
 		}
527
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
528 596
 		// Change auto-saved data
529 597
 		$oEditorController = getController('editor');
530 598
 		$oEditorController->deleteSavedDoc(false);
@@ -540,18 +608,24 @@  discard block
 block discarded – undo
540 608
 	 */
541 609
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
542 610
 	{
543
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
611
+		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) {
612
+			return;
613
+		}
544 614
 
545 615
 		if(!$this->loaded_component_list[$component][$editor_sequence])
546 616
 		{
547 617
 			// Create an object of the component and execute
548 618
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
549 619
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
550
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
620
+			if(!file_exists($class_file)) {
621
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
622
+			}
551 623
 			// Create an object after loading the class file
552 624
 			require_once($class_file);
553 625
 			$oComponent = new $component($editor_sequence, $class_path);
554
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
626
+			if(!$oComponent) {
627
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
628
+			}
555 629
 			// Add configuration information
556 630
 			$component_info = $this->getComponent($component, $site_srl);
557 631
 			$oComponent->setInfo($component_info);
@@ -578,8 +652,12 @@  discard block
 block discarded – undo
578 652
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
579 653
 		FileHandler::makeDir($cache_path);
580 654
 		$cache_file = $cache_path.'component_list.' . $lang .'.';
581
-		if($filter_enabled) $cache_file .= 'filter.';
582
-		if($site_srl) $cache_file .= $site_srl.'.';
655
+		if($filter_enabled) {
656
+			$cache_file .= 'filter.';
657
+		}
658
+		if($site_srl) {
659
+			$cache_file .= $site_srl.'.';
660
+		}
583 661
 		$cache_file .= 'php';
584 662
 		return $cache_file;
585 663
 	}
@@ -596,14 +674,15 @@  discard block
 block discarded – undo
596 674
 			$oEditorController->makeCache(false, $site_srl);
597 675
 		}
598 676
 
599
-		if(!file_exists($cache_file)) return;
677
+		if(!file_exists($cache_file)) {
678
+			return;
679
+		}
600 680
 		include($cache_file);
601 681
 		$logged_info = Context::get('logged_info');
602 682
 		if($logged_info && is_array($logged_info->group_list))
603 683
 		{
604 684
 			$group_list = array_keys($logged_info->group_list);
605
-		}
606
-		else
685
+		} else
607 686
 		{
608 687
 			$group_list = array();
609 688
 		}
@@ -612,39 +691,50 @@  discard block
 block discarded – undo
612 691
 		{
613 692
 			foreach($component_list as $key => $val)
614 693
 			{
615
-				if(!trim($key)) continue;
694
+				if(!trim($key)) {
695
+					continue;
696
+				}
616 697
 				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
617 698
 				{
618 699
 					FileHandler::removeFile($cache_file);
619 700
 					return $this->getComponentList($filter_enabled, $site_srl);
620 701
 				}
621
-				if(!$filter_enabled) continue;
702
+				if(!$filter_enabled) {
703
+					continue;
704
+				}
622 705
 				if($val->enabled == "N")
623 706
 				{
624 707
 					unset($component_list->{$key});
625 708
 					continue;
626 709
 				}
627
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
710
+				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") {
711
+					continue;
712
+				}
628 713
 				if($val->target_group)
629 714
 				{
630 715
 					if(!$logged_info)
631 716
 					{
632 717
 						$val->enabled = "N";
633
-					}
634
-					else
718
+					} else
635 719
 					{
636 720
 						$is_granted = false;
637 721
 						foreach($group_list as $group_srl)
638 722
 						{
639
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
723
+							if(in_array($group_srl, $val->target_group)) {
724
+								$is_granted = true;
725
+							}
726
+						}
727
+						if(!$is_granted) {
728
+							$val->enabled = "N";
640 729
 						}
641
-						if(!$is_granted) $val->enabled = "N";
642 730
 					}
643 731
 				}
644 732
 				if($val->enabled != "N" && $val->mid_list)
645 733
 				{
646 734
 					$mid = Context::get('mid');
647
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
735
+					if(!in_array($mid, $val->mid_list)) {
736
+						$val->enabled = "N";
737
+					}
648 738
 				}
649 739
 				if($val->enabled == "N")
650 740
 				{
@@ -668,14 +758,15 @@  discard block
 block discarded – undo
668 758
 		{
669 759
 			$args->site_srl = $site_srl;
670 760
 			$output = executeQuery('editor.getSiteComponent', $args);
671
-		}
672
-		else
761
+		} else
673 762
 		{
674 763
 			$output = executeQuery('editor.getComponent', $args);
675 764
 		}
676 765
 		$component = $output->data;
677 766
 
678
-		if(!$output->data) return false;
767
+		if(!$output->data) {
768
+			return false;
769
+		}
679 770
 
680 771
 		$component_name = $component->component_name;
681 772
 
@@ -754,8 +845,7 @@  discard block
 block discarded – undo
754 845
 			$component_info->homepage = $xml_doc->component->link->body;
755 846
 			$component_info->license = $xml_doc->component->license->body;
756 847
 			$component_info->license_link = $xml_doc->component->license->attrs->link;
757
-		}
758
-		else
848
+		} else
759 849
 		{
760 850
 			sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
761 851
 			$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -772,8 +862,11 @@  discard block
 block discarded – undo
772 862
 
773 863
 		// Author information
774 864
 		$author_list = array();
775
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
776
-		else $author_list = $xml_doc->component->author;
865
+		if(!is_array($xml_doc->component->author)) {
866
+			$author_list[] = $xml_doc->component->author;
867
+		} else {
868
+			$author_list = $xml_doc->component->author;
869
+		}
777 870
 
778 871
 		for($i = 0; $i < count($author_list); $i++)
779 872
 		{
Please login to merge, or discard this patch.
modules/member/member.admin.view.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -386,7 +386,7 @@
 block discarded – undo
386 386
 	/**
387 387
 	 * Get tags by the member info type 
388 388
 	 *
389
-	 * @param object $memberInfo
389
+	 * @param string $memberInfo
390 390
 	 * @param boolean $isAdmin (true : admin, false : not admin)
391 391
 	 *
392 392
 	 * @return array
Please login to merge, or discard this patch.
modules/module/module.model.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -1038,6 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 	/**
1039 1039
 	 * @brief Get a list of skins for the module
1040 1040
 	 * Return file analysis of skin and skin.xml
1041
+	 * @param string $path
1041 1042
 	 */
1042 1043
 	function getSkins($path, $dir = 'skins')
1043 1044
 	{
@@ -1362,6 +1363,7 @@  discard block
 block discarded – undo
1362 1363
 	/**
1363 1364
 	 * @brief Return module configurations
1364 1365
 	 * Global configuration is used to manage board, member and others
1366
+	 * @param string $module
1365 1367
 	 */
1366 1368
 	function getModuleConfig($module, $site_srl = 0)
1367 1369
 	{
Please login to merge, or discard this patch.
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true;
23 23
 		// directory and rss/atom/api reserved checking, etc.
24 24
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 25
 		$dirs[] = 'rss';
26 26
 		$dirs[] = 'atom';
27 27
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
28
+		if (in_array($id, $dirs)) return true;
29 29
 		// mid test
30 30
 		$args = new stdClass();
31 31
 		$args->mid = $id;
32 32
 		$args->site_srl = $site_srl;
33 33
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
34
+		if ($output->data->count) return true;
35 35
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_args = new stdClass();
39 39
 			$site_args->domain = $id;
40 40
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
41
+			if ($output->data->count) return true;
42 42
 		}
43 43
 
44 44
 		return false;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	function getDefaultMid()
83 83
 	{
84 84
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
85
+		if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
86 86
 
87 87
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
88
+		if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
89 89
 
90 90
 		$default_url_parse = parse_url($default_url);
91 91
 		$request_url_parse = parse_url($request_url);
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 		// Set up
96 96
 		$domain = '';
97 97
 		$site_info = NULL;
98
-		if($default_url && $default_url_parse['host'] != $request_url_parse['host'])
98
+		if ($default_url && $default_url_parse['host'] != $request_url_parse['host'])
99 99
 		{
100 100
 			$hostname = $request_url_parse['host'];
101 101
 			$path = $request_url_parse['path'];
102 102
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
103
+			if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
104 104
 
105
-			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
105
+			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path);
106 106
 		}
107 107
 
108
-		if($domain === '')
108
+		if ($domain === '')
109 109
 		{
110
-			if(!$vid) $vid = $mid;
111
-			if($vid)
110
+			if (!$vid) $vid = $mid;
111
+			if ($vid)
112 112
 			{
113 113
 				$domain = $vid;
114 114
 			}
@@ -116,89 +116,89 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
118 118
 		// If domain is set, look for subsite
119
-		if($domain !== '')
119
+		if ($domain !== '')
120 120
 		{
121 121
 			$site_info = false;
122
-			if($oCacheHandler->isSupport())
122
+			if ($oCacheHandler->isSupport())
123 123
 			{
124
-				$object_key = 'site_info:' . md5($domain);
124
+				$object_key = 'site_info:'.md5($domain);
125 125
 				$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
126 126
 				$site_info = $oCacheHandler->get($domain_cache_key);
127 127
 			}
128 128
 
129
-			if($site_info === false)
129
+			if ($site_info === false)
130 130
 			{
131 131
 				$args = new stdClass();
132 132
 				$args->domain = $domain;
133 133
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 134
 				$site_info = $output->data;
135 135
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
136
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
137 137
 			}
138 138
 
139
-			if($site_info && $vid)
139
+			if ($site_info && $vid)
140 140
 			{
141 141
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
142
+				if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true);
143 143
 			}
144
-			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
144
+			if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 145
 		}
146 146
 
147 147
 		// If no virtual website was found, get default website
148
-		if($domain === '')
148
+		if ($domain === '')
149 149
 		{
150 150
 			$site_info = false;
151
-			if($oCacheHandler->isSupport())
151
+			if ($oCacheHandler->isSupport())
152 152
 			{
153 153
 				$object_key = 'default_site';
154 154
 				$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
155 155
 				$site_info = $oCacheHandler->get($default_site_cache_key);
156 156
 			}
157 157
 
158
-			if($site_info === false)
158
+			if ($site_info === false)
159 159
 			{
160 160
 				$args = new stdClass();
161 161
 				$args->site_srl = 0;
162 162
 				$output = executeQuery('module.getSiteInfo', $args);
163 163
 				// Update the related informaion if there is no default site info
164
-				if(!$output->data)
164
+				if (!$output->data)
165 165
 				{
166 166
 					// Create a table if sites table doesn't exist
167 167
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
168
+					if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
+					if (!$oDB->isTableExists('sites')) return;
170 170
 
171 171
 					// Get mid, language
172 172
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
173 173
 					$db_info = Context::getDBInfo();
174 174
 					$domain = Context::getDefaultUrl();
175 175
 					$url_info = parse_url($domain);
176
-					$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
176
+					$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
177 177
 
178 178
 					$site_args = new stdClass;
179 179
 					$site_args->site_srl = 0;
180
-					$site_args->index_module_srl  = $mid_output->data->module_srl;
180
+					$site_args->index_module_srl = $mid_output->data->module_srl;
181 181
 					$site_args->domain = $domain;
182 182
 					$site_args->default_language = $db_info->lang_type;
183 183
 
184
-					if($output->data && !$output->data->index_module_srl)
184
+					if ($output->data && !$output->data->index_module_srl)
185 185
 					{
186 186
 						$output = executeQuery('module.updateSite', $site_args);
187 187
 					}
188 188
 					else
189 189
 					{
190 190
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
191
+						if (!$output->toBool()) return $output;
192 192
 					}
193 193
 					$output = executeQuery('module.getSiteInfo', $args);
194 194
 				}
195 195
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
196
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
197 197
 			}
198 198
 		}
199 199
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
200
+		if (!$site_info->module_srl) return $site_info;
201
+		if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
202 202
 		return $this->addModuleExtraVars($site_info);
203 203
 	}
204 204
 
@@ -207,48 +207,48 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array())
209 209
 	{
210
-		if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
210
+		if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
211 211
 		{
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		$args = new stdClass();
216 216
 		$args->mid = $mid;
217
-		$args->site_srl = (int)$site_srl;
217
+		$args->site_srl = (int) $site_srl;
218 218
 
219 219
 		$module_srl = false;
220 220
 		$module_info = false;
221 221
 
222 222
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
223
-		if($oCacheHandler->isSupport())
223
+		if ($oCacheHandler->isSupport())
224 224
 		{
225 225
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
226 226
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
227 227
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
228
-			if($module_srl)
228
+			if ($module_srl)
229 229
 			{
230
-				$object_key = 'mid_info:' . $module_srl;
230
+				$object_key = 'mid_info:'.$module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
232 232
 				$module_info = $oCacheHandler->get($module_info_cache_key);
233 233
 			}
234 234
 		}
235 235
 
236
-		if($module_info === false)
236
+		if ($module_info === false)
237 237
 		{
238 238
 			$output = executeQuery('module.getMidInfo', $args);
239 239
 			$module_info = $output->data;
240
-			if($oCacheHandler->isSupport())
240
+			if ($oCacheHandler->isSupport())
241 241
 			{
242 242
 				$oCacheHandler->put($module_srl_cache_key, $module_info->module_srl);
243 243
 
244
-				$object_key = 'mid_info:' . $module_info->module_srl;
244
+				$object_key = 'mid_info:'.$module_info->module_srl;
245 245
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
246 246
 				$oCacheHandler->put($module_info_cache_key, $module_info);
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
251
+		if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
252 252
 		return $this->addModuleExtraVars($module_info);
253 253
 	}
254 254
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$menuItemSrl = Context::get('menu_item_srl');
265 265
 		$menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl;
266 266
 
267
-		if(!$menuItemSrl)
267
+		if (!$menuItemSrl)
268 268
 		{
269 269
 			$this->stop(-1, 'msg_invalid_request');
270 270
 			return;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$args = new stdClass();
274 274
 		$args->menu_item_srl = $menuItemSrl;
275 275
 		$output = executeQuery('module.getModuleInfoByMenuItemSrl', $args);
276
-		if(!$output->toBool())
276
+		if (!$output->toBool())
277 277
 		{
278 278
 			return $output;
279 279
 		}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 		$layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL;
298 298
 		$skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc);
299 299
 		$skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins');
300
-		if(!$skinInfoPc)
300
+		if (!$skinInfoPc)
301 301
 		{
302 302
 			$skinInfoPc = new stdClass();
303 303
 			$skinInfoPc->title = $skinNamePc;
304 304
 		}
305
-		if(!$skinInfoMobile)
305
+		if (!$skinInfoMobile)
306 306
 		{
307 307
 			$skinInfoMobile = new stdClass();
308 308
 			$skinInfoMobile->title = $skinNameMobile;
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 		$mid_info = false;
322 322
 
323 323
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
324
-		if($oCacheHandler->isSupport())
324
+		if ($oCacheHandler->isSupport())
325 325
 		{
326 326
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
327 327
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
328 328
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
329
-			if($module_srl)
329
+			if ($module_srl)
330 330
 			{
331
-				$object_key = 'mid_info:' . $module_srl;
331
+				$object_key = 'mid_info:'.$module_srl;
332 332
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
333 333
 				$mid_info = $oCacheHandler->get($module_info_cache_key);
334 334
 			}
335 335
 
336
-			if($mid_info === false)
336
+			if ($mid_info === false)
337 337
 			{
338 338
 				$oCacheHandler->put($module_srl_cache_key, $output->data->module_srl);
339 339
 
340
-				$object_key = 'mid_info:' . $output->data->module_srl;
340
+				$object_key = 'mid_info:'.$output->data->module_srl;
341 341
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 342
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343 343
 			}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$moduleInfo = $this->addModuleExtraVars($moduleInfo);
352 352
 
353
-		if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
353
+		if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
354 354
 		{
355 355
 			unset($moduleInfo->skin);
356 356
 			unset($moduleInfo->mskin);
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374
-			$object_key = 'mid_info:' . $module_srl;
374
+			$object_key = 'mid_info:'.$module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507
-				$object_key = 'module:mid_list_' . $args->site_srl;
507
+				$object_key = 'module:mid_list_'.$args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
509 509
 				$list = $oCacheHandler->get($cache_key);
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685 685
 		$key = $parent_module.'.'.$kind.'.'.$type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,23 +918,23 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// actions
921
-			if($actions)
921
+			if ($actions)
922 922
 			{
923
-				if(is_array($actions)) $action_list = $actions;
923
+				if (is_array($actions)) $action_list = $actions;
924 924
 				else $action_list[] = $actions;
925 925
 
926 926
 				$buff[] = '$info->action = new stdClass;';
927 927
 				$info->action = new stdClass();
928
-				foreach($action_list as $action)
928
+				foreach ($action_list as $action)
929 929
 				{
930 930
 					$name = $action->attrs->name;
931 931
 
932 932
 					$type = $action->attrs->type;
933
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
934
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
935
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
936
-					$method = $action->attrs->method?$action->attrs->method:'';
937
-					$check_csrf = $action->attrs->check_csrf=='false'?'false':'true';
933
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
934
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
935
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
936
+					$method = $action->attrs->method ? $action->attrs->method : '';
937
+					$check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true';
938 938
 
939 939
 					$index = $action->attrs->index;
940 940
 					$admin_index = $action->attrs->admin_index;
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 					$info->action->{$name}->ruleset = $ruleset;
950 950
 					$info->action->{$name}->method = $method;
951 951
 					$info->action->{$name}->check_csrf = $check_csrf;
952
-					if($action->attrs->menu_name)
952
+					if ($action->attrs->menu_name)
953 953
 					{
954
-						if($menu_index == 'true')
954
+						if ($menu_index == 'true')
955 955
 						{
956 956
 							$info->menu->{$action->attrs->menu_name}->index = $name;
957 957
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
958 958
 						}
959
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
959
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
960 960
 						{
961 961
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
962 962
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -974,22 +974,22 @@  discard block
 block discarded – undo
974 974
 					$buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method);
975 975
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
976 976
 
977
-					if($index=='true')
977
+					if ($index == 'true')
978 978
 					{
979 979
 						$default_index_act = $name;
980 980
 						$info->default_index_act = $name;
981 981
 					}
982
-					if($admin_index=='true')
982
+					if ($admin_index == 'true')
983 983
 					{
984 984
 						$admin_index_act = $name;
985 985
 						$info->admin_index_act = $name;
986 986
 					}
987
-					if($setup_index=='true')
987
+					if ($setup_index == 'true')
988 988
 					{
989 989
 						$setup_index_act = $name;
990 990
 						$info->setup_index_act = $name;
991 991
 					}
992
-					if($simple_setup_index=='true')
992
+					if ($simple_setup_index == 'true')
993 993
 					{
994 994
 						$simple_setup_index_act = $name;
995 995
 						$info->simple_setup_index_act = $name;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			return $info;
1011 1011
 		}
1012 1012
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1013
+		if (file_exists($cache_file)) return include($cache_file);
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	{
1022 1022
 		$module = Context::get('module_type');
1023 1023
 
1024
-		if($module == 'ARTICLE')
1024
+		if ($module == 'ARTICLE')
1025 1025
 		{
1026 1026
 			$module = 'page';
1027 1027
 		}
@@ -1041,26 +1041,26 @@  discard block
 block discarded – undo
1041 1041
 	 */
1042 1042
 	function getSkins($path, $dir = 'skins')
1043 1043
 	{
1044
-		if(substr($path, -1) == '/')
1044
+		if (substr($path, -1) == '/')
1045 1045
 		{
1046 1046
 			$path = substr($path, 0, -1);
1047 1047
 		}
1048 1048
 
1049 1049
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1050
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1051
+		if (!count($list)) return;
1052 1052
 
1053 1053
 		natcasesort($list);
1054 1054
 
1055
-		foreach($list as $skin_name)
1055
+		foreach ($list as $skin_name)
1056 1056
 		{
1057
-			if(!is_dir($skin_path . $skin_name))
1057
+			if (!is_dir($skin_path.$skin_name))
1058 1058
 			{
1059 1059
 				continue;
1060 1060
 			}
1061 1061
 			unset($skin_info);
1062 1062
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1063
-			if(!$skin_info)
1063
+			if (!$skin_info)
1064 1064
 			{
1065 1065
 				$skin_info = new stdClass();
1066 1066
 				$skin_info->title = $skin_name;
@@ -1073,15 +1073,15 @@  discard block
 block discarded – undo
1073 1073
 		$tmpPath = trim($tmpPath);
1074 1074
 		$module = array_pop(explode(' ', $tmpPath));
1075 1075
 
1076
-		if($dir == 'skins')
1076
+		if ($dir == 'skins')
1077 1077
 		{
1078 1078
 			$oAdminModel = getAdminModel('admin');
1079 1079
 			$themesInfo = $oAdminModel->getThemeList();
1080 1080
 
1081
-			foreach($themesInfo as $themeName => $info)
1081
+			foreach ($themesInfo as $themeName => $info)
1082 1082
 			{
1083 1083
 				$skinInfos = $info->skin_infos;
1084
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1084
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1085 1085
 				{
1086 1086
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1087 1087
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		$oMenuAdminModel = getAdminModel('menu');
1094 1094
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1095 1095
 		$moduleName = $module;
1096
-		if($moduleName === 'page')
1096
+		if ($moduleName === 'page')
1097 1097
 		{
1098 1098
 			$moduleName = 'ARTICLE';
1099 1099
 		}
1100
-		if(array_key_exists($moduleName, $installedMenuTypes))
1100
+		if (array_key_exists($moduleName, $installedMenuTypes))
1101 1101
 		{
1102
-			if($dir == 'skins')
1102
+			if ($dir == 'skins')
1103 1103
 			{
1104 1104
 				$type = 'P';
1105 1105
 			}
@@ -1109,12 +1109,12 @@  discard block
 block discarded – undo
1109 1109
 			}
1110 1110
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1111 1111
 
1112
-			if(isset($defaultSkinName))
1112
+			if (isset($defaultSkinName))
1113 1113
 			{
1114 1114
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1115 1115
 
1116 1116
 				$useDefault = new stdClass();
1117
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1117
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1118 1118
 
1119 1119
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1120 1120
 
@@ -1131,20 +1131,20 @@  discard block
 block discarded – undo
1131 1131
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1132
 	{
1133 1133
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1134
+		if (substr($path, -1) != '/') $path .= '/';
1135 1135
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1136
+		if (!file_exists($skin_xml_file)) return;
1137 1137
 		// Create XmlParser object
1138 1138
 		$oXmlParser = new XmlParser();
1139 1139
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1140
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1141
+		if (!$_xml_obj->skin) return;
1142 1142
 		$xml_obj = $_xml_obj->skin;
1143 1143
 		// Skin Name
1144 1144
 		$skin_info = new stdClass();
1145 1145
 		$skin_info->title = $xml_obj->title->body;
1146 1146
 		// Author information
1147
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1147
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1148 1148
 		{
1149 1149
 			// skin format v0.2
1150 1150
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1155,10 +1155,10 @@  discard block
 block discarded – undo
1155 1155
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1156
 			$skin_info->description = $xml_obj->description->body;
1157 1157
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1158
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159 1159
 			else $author_list = $xml_obj->author;
1160 1160
 
1161
-			foreach($author_list as $author)
1161
+			foreach ($author_list as $author)
1162 1162
 			{
1163 1163
 				$author_obj = new stdClass();
1164 1164
 				$author_obj->name = $author->name->body;
@@ -1167,25 +1167,25 @@  discard block
 block discarded – undo
1167 1167
 				$skin_info->author[] = $author_obj;
1168 1168
 			}
1169 1169
 			// List extra vars
1170
-			if($xml_obj->extra_vars)
1170
+			if ($xml_obj->extra_vars)
1171 1171
 			{
1172 1172
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1173
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1175 1175
 
1176
-				foreach($extra_var_groups as $group)
1176
+				foreach ($extra_var_groups as $group)
1177 1177
 				{
1178 1178
 					$extra_vars = $group->var;
1179
-					if(!$extra_vars)
1179
+					if (!$extra_vars)
1180 1180
 					{
1181 1181
 						continue;
1182 1182
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1183
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1184 1184
 
1185
-					foreach($extra_vars as $key => $val)
1185
+					foreach ($extra_vars as $key => $val)
1186 1186
 					{
1187 1187
 						$obj = new stdClass();
1188
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1188
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1189 1189
 
1190 1190
 						$obj->group = $group->title->body;
1191 1191
 						$obj->name = $val->attrs->name;
@@ -1194,14 +1194,14 @@  discard block
 block discarded – undo
1194 1194
 						$obj->description = $val->description->body;
1195 1195
 						$obj->value = $extra_vals->{$obj->name};
1196 1196
 						$obj->default = $val->attrs->default;
1197
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1197
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1199 1199
 						// Get an option list from 'select'type
1200
-						if(is_array($val->options))
1200
+						if (is_array($val->options))
1201 1201
 						{
1202 1202
 							$option_count = count($val->options);
1203 1203
 
1204
-							for($i = 0; $i < $option_count; $i++)
1204
+							for ($i = 0; $i < $option_count; $i++)
1205 1205
 							{
1206 1206
 								$obj->options[$i] = new stdClass();
1207 1207
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1238,18 +1238,18 @@  discard block
 block discarded – undo
1238 1238
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1239
 			// Variables used in the skin
1240 1240
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1241
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1243 1243
 
1244
-			foreach($extra_var_groups as $group)
1244
+			foreach ($extra_var_groups as $group)
1245 1245
 			{
1246 1246
 				$extra_vars = $group->var;
1247 1247
 
1248
-				if($extra_vars)
1248
+				if ($extra_vars)
1249 1249
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1250
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1251 1251
 
1252
-					foreach($extra_vars as $var)
1252
+					foreach ($extra_vars as $var)
1253 1253
 					{
1254 1254
 						unset($obj);
1255 1255
 						unset($options);
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
 						$title = $var->title->body;
1261 1261
 						$description = $var->description->body;
1262 1262
 						// Get an option list from 'select'type.
1263
-						if(is_array($var->default))
1263
+						if (is_array($var->default))
1264 1264
 						{
1265 1265
 							$option_count = count($var->default);
1266 1266
 
1267
-							for($i = 0; $i < $option_count; $i++)
1267
+							for ($i = 0; $i < $option_count; $i++)
1268 1268
 							{
1269 1269
 								$options[$i]->title = $var->default[$i]->body;
1270 1270
 								$options[$i]->value = $var->default[$i]->body;
@@ -1298,19 +1298,19 @@  discard block
 block discarded – undo
1298 1298
 
1299 1299
 		// colorset
1300 1300
 		$colorset = $xml_obj->colorset->color;
1301
-		if($colorset)
1301
+		if ($colorset)
1302 1302
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1303
+			if (!is_array($colorset)) $colorset = array($colorset);
1304 1304
 
1305
-			foreach($colorset as $color)
1305
+			foreach ($colorset as $color)
1306 1306
 			{
1307 1307
 				$name = $color->attrs->name;
1308 1308
 				$title = $color->title->body;
1309 1309
 				$screenshot = $color->attrs->src;
1310
-				if($screenshot)
1310
+				if ($screenshot)
1311 1311
 				{
1312 1312
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1313
+					if (!file_exists($screenshot)) $screenshot = "";
1314 1314
 				}
1315 1315
 				else $screenshot = "";
1316 1316
 
@@ -1322,19 +1322,19 @@  discard block
 block discarded – undo
1322 1322
 			}
1323 1323
 		}
1324 1324
 		// Menu type (settings for layout)
1325
-		if($xml_obj->menus->menu)
1325
+		if ($xml_obj->menus->menu)
1326 1326
 		{
1327 1327
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1328
+			if (!is_array($menus)) $menus = array($menus);
1329 1329
 
1330 1330
 			$menu_count = count($menus);
1331 1331
 			$skin_info->menu_count = $menu_count;
1332
-			for($i=0;$i<$menu_count;$i++)
1332
+			for ($i = 0; $i < $menu_count; $i++)
1333 1333
 			{
1334 1334
 				unset($obj);
1335 1335
 
1336 1336
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1337
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1338 1338
 				$obj->title = $menus[$i]->title->body;
1339 1339
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1340
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		}
1344 1344
 
1345 1345
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1346
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1346
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1347 1347
 		return $skin_info;
1348 1348
 	}
1349 1349
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	{
1355 1355
 		$args = new stdClass;
1356 1356
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1357
+		if (!is_null($module)) $args->module = $module;
1358 1358
 		$output = executeQuery('module.getModuleCount', $args);
1359 1359
 		return $output->data->count;
1360 1360
 	}
@@ -1368,26 +1368,26 @@  discard block
 block discarded – undo
1368 1368
 		$config = false;
1369 1369
 		// cache controll
1370 1370
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1371
-		if($oCacheHandler->isSupport())
1371
+		if ($oCacheHandler->isSupport())
1372 1372
 		{
1373
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1373
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1374 1374
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1375 1375
 			$config = $oCacheHandler->get($cache_key);
1376 1376
 		}
1377 1377
 
1378
-		if($config === false)
1378
+		if ($config === false)
1379 1379
 		{
1380
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1380
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1381 1381
 			{
1382 1382
 				$args = new stdClass();
1383 1383
 				$args->module = $module;
1384 1384
 				$args->site_srl = $site_srl;
1385 1385
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1386
+				if ($output->data->config) $config = unserialize($output->data->config);
1387 1387
 				else $config = null;
1388 1388
 
1389 1389
 				//insert in cache
1390
-				if($oCacheHandler->isSupport())
1390
+				if ($oCacheHandler->isSupport())
1391 1391
 				{
1392 1392
 					$oCacheHandler->put($cache_key, $config);
1393 1393
 				}
@@ -1408,26 +1408,26 @@  discard block
 block discarded – undo
1408 1408
 		$config = false;
1409 1409
 		// cache controll
1410 1410
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1411
-		if($oCacheHandler->isSupport())
1411
+		if ($oCacheHandler->isSupport())
1412 1412
 		{
1413 1413
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1414 1414
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1415 1415
 			$config = $oCacheHandler->get($cache_key);
1416 1416
 		}
1417 1417
 
1418
-		if($config === false)
1418
+		if ($config === false)
1419 1419
 		{
1420
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1420
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1421 1421
 			{
1422 1422
 				$args = new stdClass();
1423 1423
 				$args->module = $module;
1424 1424
 				$args->module_srl = $module_srl;
1425 1425
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1426
+				if ($output->data->config) $config = unserialize($output->data->config);
1427 1427
 				else $config = null;
1428 1428
 
1429 1429
 				//insert in cache
1430
-				if($oCacheHandler->isSupport())
1430
+				if ($oCacheHandler->isSupport())
1431 1431
 				{
1432 1432
 					$oCacheHandler->put($cache_key, $config);
1433 1433
 				}
@@ -1446,11 +1446,11 @@  discard block
 block discarded – undo
1446 1446
 	{
1447 1447
 		$args = new stdClass();
1448 1448
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1449
+		if ($site_srl) $args->site_srl = $site_srl;
1450 1450
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1451
+		if (!$output->toBool() || !$output->data) return array();
1452 1452
 
1453
-		foreach($output->data as $key => $val)
1453
+		foreach ($output->data as $key => $val)
1454 1454
 		{
1455 1455
 			$result[$val->module_srl] = unserialize($val->config);
1456 1456
 		}
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1467
 		// Get data from the DB
1468 1468
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1469
+		if (!$output->toBool()) return $output;
1470 1470
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1471
+		if (!$list) return;
1472
+		if (!is_array($list)) $list = array($list);
1473 1473
 
1474
-		foreach($list as $val)
1474
+		foreach ($list as $val)
1475 1475
 		{
1476 1476
 			$category_list[$val->module_category_srl] = $val;
1477 1477
 		}
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		$args = new stdClass;
1488 1488
 		$args->module_category_srl = $module_category_srl;
1489 1489
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1490
+		if (!$output->toBool()) return $output;
1491 1491
 		return $output->data;
1492 1492
 	}
1493 1493
 
@@ -1499,10 +1499,10 @@  discard block
 block discarded – undo
1499 1499
 		// Get a list of downloaded and installed modules
1500 1500
 		$searched_list = FileHandler::readDir('./modules');
1501 1501
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1502
+		if (!$searched_count) return;
1503 1503
 		sort($searched_list);
1504 1504
 
1505
-		for($i=0;$i<$searched_count;$i++)
1505
+		for ($i = 0; $i < $searched_count; $i++)
1506 1506
 		{
1507 1507
 			// Module name
1508 1508
 			$module_name = $searched_list[$i];
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 			$info = $this->getModuleInfoXml($module_name);
1513 1513
 			unset($obj);
1514 1514
 
1515
-			if(!isset($info)) continue;
1515
+			if (!isset($info)) continue;
1516 1516
 			$info->module = $module_name;
1517 1517
 			$info->created_table_count = $created_table_count;
1518 1518
 			$info->table_count = $table_count;
@@ -1529,19 +1529,19 @@  discard block
 block discarded – undo
1529 1529
 		$info = null;
1530 1530
 
1531 1531
 		$moduledir = ModuleHandler::getModulePath($module_name);
1532
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1532
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1533 1533
 		{
1534 1534
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1535 1535
 			$table_count = count($tmp_files);
1536 1536
 			// Check if the table is created
1537 1537
 			$created_table_count = 0;
1538
-			for($j=0;$j<count($tmp_files);$j++)
1538
+			for ($j = 0; $j < count($tmp_files); $j++)
1539 1539
 			{
1540
-				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1540
+				list($table_name) = explode(".", $tmp_files[$j]);
1541
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1542 1542
 			}
1543 1543
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1544
+			if ($table_count > $created_table_count) return true;
1545 1545
 			else return false;
1546 1546
 		}
1547 1547
 		return false;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 	{
1552 1552
 		// Check if it is upgraded to module.class.php on each module
1553 1553
 		$oDummy = getModule($module_name, 'class');
1554
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1554
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1555 1555
 		{
1556 1556
 			return $oDummy->checkUpdate();
1557 1557
 		}
@@ -1565,15 +1565,15 @@  discard block
 block discarded – undo
1565 1565
 	 */
1566 1566
 	public function needUpdate($update_id)
1567 1567
 	{
1568
-		if(!is_array($update_id)) $update_id = array($update_id);
1568
+		if (!is_array($update_id)) $update_id = array($update_id);
1569 1569
 
1570 1570
 		$args = new stdClass();
1571 1571
 		$args->update_id = implode(',', $update_id);
1572 1572
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1573 1573
 
1574
-		if(!!$output->error) return false;
1575
-		if(!$output->data) $output->data = array();
1576
-		if(count($update_id) === count($output->data)) return false;
1574
+		if (!!$output->error) return false;
1575
+		if (!$output->data) $output->data = array();
1576
+		if (count($update_id) === count($output->data)) return false;
1577 1577
 
1578 1578
 		return true;
1579 1579
 	}
@@ -1590,31 +1590,31 @@  discard block
 block discarded – undo
1590 1590
 		sort($searched_list);
1591 1591
 
1592 1592
 		$searched_count = count($searched_list);
1593
-		if(!$searched_count) return;
1593
+		if (!$searched_count) return;
1594 1594
 
1595
-		for($i=0;$i<$searched_count;$i++)
1595
+		for ($i = 0; $i < $searched_count; $i++)
1596 1596
 		{
1597 1597
 			// module name
1598 1598
 			$module_name = $searched_list[$i];
1599 1599
 
1600 1600
 			$path = ModuleHandler::getModulePath($module_name);
1601
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1601
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1602 1602
 
1603 1603
 			// Get the number of xml files to create a table in schemas
1604 1604
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1605 1605
 			$table_count = count($tmp_files);
1606 1606
 			// Check if the table is created
1607 1607
 			$created_table_count = 0;
1608
-			for($j=0;$j<$table_count;$j++)
1608
+			for ($j = 0; $j < $table_count; $j++)
1609 1609
 			{
1610
-				list($table_name) = explode('.',$tmp_files[$j]);
1611
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1610
+				list($table_name) = explode('.', $tmp_files[$j]);
1611
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1612 1612
 			}
1613 1613
 			// Get information of the module
1614 1614
 			$info = NULL;
1615 1615
 			$info = $this->getModuleInfoXml($module_name);
1616 1616
 
1617
-			if(!$info) continue;
1617
+			if (!$info) continue;
1618 1618
 
1619 1619
 			$info->module = $module_name;
1620 1620
 			$info->category = $info->category;
@@ -1623,12 +1623,12 @@  discard block
 block discarded – undo
1623 1623
 			$info->path = $path;
1624 1624
 			$info->admin_index_act = $info->admin_index_act;
1625 1625
 			// Check if DB is installed
1626
-			if($table_count > $created_table_count) $info->need_install = true;
1626
+			if ($table_count > $created_table_count) $info->need_install = true;
1627 1627
 			else $info->need_install = false;
1628 1628
 			// Check if it is upgraded to module.class.php on each module
1629 1629
 			$oDummy = null;
1630 1630
 			$oDummy = getModule($module_name, 'class');
1631
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1631
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1632 1632
 			{
1633 1633
 				$info->need_update = $oDummy->checkUpdate();
1634 1634
 			}
@@ -1649,15 +1649,15 @@  discard block
 block discarded – undo
1649 1649
 	 */
1650 1650
 	function syncModuleToSite(&$data)
1651 1651
 	{
1652
-		if(!$data) return;
1652
+		if (!$data) return;
1653 1653
 
1654
-		if(is_array($data))
1654
+		if (is_array($data))
1655 1655
 		{
1656
-			foreach($data as $key => $val)
1656
+			foreach ($data as $key => $val)
1657 1657
 			{
1658 1658
 				$module_srls[] = $val->module_srl;
1659 1659
 			}
1660
-			if(!count($module_srls)) return;
1660
+			if (!count($module_srls)) return;
1661 1661
 		}
1662 1662
 		else
1663 1663
 		{
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
 		}
1666 1666
 
1667 1667
 		$args = new stdClass();
1668
-		$args->module_srls = implode(',',$module_srls);
1668
+		$args->module_srls = implode(',', $module_srls);
1669 1669
 		$output = executeQueryArray('module.getModuleSites', $args);
1670
-		if(!$output->data) return array();
1671
-		foreach($output->data as $key => $val)
1670
+		if (!$output->data) return array();
1671
+		foreach ($output->data as $key => $val)
1672 1672
 		{
1673 1673
 			$modules[$val->module_srl] = $val;
1674 1674
 		}
1675 1675
 
1676
-		if(is_array($data))
1676
+		if (is_array($data))
1677 1677
 		{
1678
-			foreach($data as $key => $val)
1678
+			foreach ($data as $key => $val)
1679 1679
 			{
1680 1680
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1681 1681
 			}
@@ -1691,14 +1691,14 @@  discard block
 block discarded – undo
1691 1691
 	 */
1692 1692
 	function isSiteAdmin($member_info, $site_srl = null)
1693 1693
 	{
1694
-		if(!$member_info->member_srl) return false;
1695
-		if($member_info->is_admin == 'Y') return true;
1694
+		if (!$member_info->member_srl) return false;
1695
+		if ($member_info->is_admin == 'Y') return true;
1696 1696
 
1697 1697
 		$args = new stdClass();
1698
-		if(!isset($site_srl))
1698
+		if (!isset($site_srl))
1699 1699
 		{
1700 1700
 			$site_module_info = Context::get('site_module_info');
1701
-			if(!$site_module_info) return;
1701
+			if (!$site_module_info) return;
1702 1702
 			$args->site_srl = $site_module_info->site_srl;
1703 1703
 		}
1704 1704
 		else
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 
1709 1709
 		$args->member_srl = $member_info->member_srl;
1710 1710
 		$output = executeQuery('module.isSiteAdmin', $args);
1711
-		if($output->data->member_srl == $args->member_srl) return true;
1711
+		if ($output->data->member_srl == $args->member_srl) return true;
1712 1712
 		return false;
1713 1713
 	}
1714 1714
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		$obj = new stdClass();
1732 1732
 		$obj->module_srl = $module_srl;
1733 1733
 		$output = executeQueryArray('module.getAdminID', $obj);
1734
-		if(!$output->toBool() || !$output->data) return;
1734
+		if (!$output->toBool() || !$output->data) return;
1735 1735
 
1736 1736
 		return $output->data;
1737 1737
 	}
@@ -1744,20 +1744,20 @@  discard block
 block discarded – undo
1744 1744
 	{
1745 1745
 		$extra_vars = array();
1746 1746
 		$get_module_srls = array();
1747
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1747
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1748 1748
 
1749 1749
 		$vars = false;
1750 1750
 		// cache controll
1751 1751
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1752
-		if($oCacheHandler->isSupport())
1752
+		if ($oCacheHandler->isSupport())
1753 1753
 		{
1754
-			foreach($list_module_srl as $module_srl)
1754
+			foreach ($list_module_srl as $module_srl)
1755 1755
 			{
1756 1756
 				$object_key = 'module_extra_vars:'.$module_srl;
1757 1757
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1758 1758
 				$vars = $oCacheHandler->get($cache_key);
1759 1759
 
1760
-				if($vars)
1760
+				if ($vars)
1761 1761
 				{
1762 1762
 					$extra_vars[$module_srl] = $vars;
1763 1763
 				}
@@ -1772,35 +1772,35 @@  discard block
 block discarded – undo
1772 1772
 			$get_module_srls = $list_module_srl;
1773 1773
 		}
1774 1774
 
1775
-		if(count($get_module_srls) > 0)
1775
+		if (count($get_module_srls) > 0)
1776 1776
 		{
1777 1777
 			$args = new stdClass();
1778 1778
 			$args->module_srl = implode(',', $get_module_srls);
1779 1779
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1780 1780
 
1781
-			if(!$output->toBool())
1781
+			if (!$output->toBool())
1782 1782
 			{
1783 1783
 				return;
1784 1784
 			}
1785 1785
 
1786
-			if(!$output->data)
1786
+			if (!$output->data)
1787 1787
 			{
1788
-				foreach($get_module_srls as $module_srl)
1788
+				foreach ($get_module_srls as $module_srl)
1789 1789
 				{
1790 1790
 					$extra_vars[$module_srl] = new stdClass;
1791 1791
 				}
1792 1792
 			}
1793
-			foreach($output->data as $key => $val)
1793
+			foreach ($output->data as $key => $val)
1794 1794
 			{
1795
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1795
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1796 1796
 
1797
-				if(!isset($extra_vars[$val->module_srl]))
1797
+				if (!isset($extra_vars[$val->module_srl]))
1798 1798
 				{
1799 1799
 					$extra_vars[$val->module_srl] = new stdClass();
1800 1800
 				}
1801 1801
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1802 1802
 
1803
-				if($oCacheHandler->isSupport())
1803
+				if ($oCacheHandler->isSupport())
1804 1804
 				{
1805 1805
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1806 1806
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1819,27 +1819,27 @@  discard block
 block discarded – undo
1819 1819
 	{
1820 1820
 		$skin_vars = false;
1821 1821
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1822
-		if($oCacheHandler->isSupport())
1822
+		if ($oCacheHandler->isSupport())
1823 1823
 		{
1824 1824
 			$object_key = 'module_skin_vars:'.$module_srl;
1825 1825
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1826 1826
 			$skin_vars = $oCacheHandler->get($cache_key);
1827 1827
 		}
1828 1828
 
1829
-		if($skin_vars === false)
1829
+		if ($skin_vars === false)
1830 1830
 		{
1831 1831
 			$args = new stdClass();
1832 1832
 			$args->module_srl = $module_srl;
1833
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1834
-			if(!$output->toBool()) return;
1833
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1834
+			if (!$output->toBool()) return;
1835 1835
 
1836 1836
 			$skin_vars = array();
1837
-			foreach($output->data as $vars)
1837
+			foreach ($output->data as $vars)
1838 1838
 			{
1839 1839
 				$skin_vars[$vars->name] = $vars;
1840 1840
 			}
1841 1841
 
1842
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1842
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1843 1843
 		}
1844 1844
 
1845 1845
 		return $skin_vars;
@@ -1851,32 +1851,32 @@  discard block
 block discarded – undo
1851 1851
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1852 1852
 	{
1853 1853
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1854
-		if(!$site_srl) $site_srl = 0;
1854
+		if (!$site_srl) $site_srl = 0;
1855 1855
 
1856 1856
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1857
-		if(is_readable($designInfoFile))
1857
+		if (is_readable($designInfoFile))
1858 1858
 		{
1859 1859
 			include($designInfoFile);
1860 1860
 
1861 1861
 			$skinName = $designInfo->module->{$module_name}->{$target};
1862 1862
 		}
1863
-		if(!$skinName)
1863
+		if (!$skinName)
1864 1864
 		{
1865 1865
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1866 1866
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1867 1867
 
1868
-			if(is_dir($moduleSkinPath.'default'))
1868
+			if (is_dir($moduleSkinPath.'default'))
1869 1869
 			{
1870 1870
 				$skinName = 'default';
1871 1871
 			}
1872
-			else if(is_dir($moduleSkinPath.'xe_default'))
1872
+			else if (is_dir($moduleSkinPath.'xe_default'))
1873 1873
 			{
1874 1874
 				$skinName = 'xe_default';
1875 1875
 			}
1876 1876
 			else
1877 1877
 			{
1878 1878
 				$skins = FileHandler::readDir($moduleSkinPath);
1879
-				if(count($skins) > 0)
1879
+				if (count($skins) > 0)
1880 1880
 				{
1881 1881
 					$skinName = $skins[0];
1882 1882
 				}
@@ -1886,9 +1886,9 @@  discard block
 block discarded – undo
1886 1886
 				}
1887 1887
 			}
1888 1888
 
1889
-			if($updateCache && $skinName)
1889
+			if ($updateCache && $skinName)
1890 1890
 			{
1891
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1891
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1892 1892
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1893 1893
 
1894 1894
 				$oAdminController = getAdminController('admin');
@@ -1904,10 +1904,10 @@  discard block
 block discarded – undo
1904 1904
 	 */
1905 1905
 	function syncSkinInfoToModuleInfo(&$module_info)
1906 1906
 	{
1907
-		if(!$module_info->module_srl) return;
1907
+		if (!$module_info->module_srl) return;
1908 1908
 
1909 1909
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1910
-		if(Mobile::isFromMobilePhone())
1910
+		if (Mobile::isFromMobilePhone())
1911 1911
 		{
1912 1912
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1913 1913
 		}
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1917 1917
 		}
1918 1918
 
1919
-		if(!$skin_vars) return;
1919
+		if (!$skin_vars) return;
1920 1920
 
1921
-		foreach($skin_vars as $name => $val)
1921
+		foreach ($skin_vars as $name => $val)
1922 1922
 		{
1923
-			if(isset($module_info->{$name})) continue;
1923
+			if (isset($module_info->{$name})) continue;
1924 1924
 			$module_info->{$name} = $val->value;
1925 1925
 		}
1926 1926
 	}
@@ -1934,27 +1934,27 @@  discard block
 block discarded – undo
1934 1934
 	{
1935 1935
 		$skin_vars = false;
1936 1936
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1937
-		if($oCacheHandler->isSupport())
1937
+		if ($oCacheHandler->isSupport())
1938 1938
 		{
1939 1939
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1940 1940
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1941 1941
 			$skin_vars = $oCacheHandler->get($cache_key);
1942 1942
 		}
1943 1943
 
1944
-		if($skin_vars === false)
1944
+		if ($skin_vars === false)
1945 1945
 		{
1946 1946
 			$args = new stdClass();
1947 1947
 			$args->module_srl = $module_srl;
1948
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1949
-			if(!$output->toBool() || !$output->data) return;
1948
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1949
+			if (!$output->toBool() || !$output->data) return;
1950 1950
 
1951 1951
 			$skin_vars = array();
1952
-			foreach($output->data as $vars)
1952
+			foreach ($output->data as $vars)
1953 1953
 			{
1954 1954
 				$skin_vars[$vars->name] = $vars;
1955 1955
 			}
1956 1956
 
1957
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1957
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1958 1958
 		}
1959 1959
 
1960 1960
 		return $skin_vars;
@@ -1966,32 +1966,32 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1968 1968
 	{
1969
-		if(!$module_info->module_srl) return;
1969
+		if (!$module_info->module_srl) return;
1970 1970
 		$skin_vars = false;
1971 1971
 		// cache controll
1972 1972
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1973
-		if($oCacheHandler->isSupport())
1973
+		if ($oCacheHandler->isSupport())
1974 1974
 		{
1975 1975
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1976 1976
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1977 1977
 			$skin_vars = $oCacheHandler->get($cache_key);
1978 1978
 		}
1979
-		if($skin_vars === false)
1979
+		if ($skin_vars === false)
1980 1980
 		{
1981 1981
 			$args = new stdClass;
1982 1982
 			$args->module_srl = $module_info->module_srl;
1983
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1984
-			if(!$output->toBool()) return;
1983
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1984
+			if (!$output->toBool()) return;
1985 1985
 			$skin_vars = $output->data;
1986 1986
 
1987 1987
 			//insert in cache
1988
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1988
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1989 1989
 		}
1990
-		if(!$skin_vars) return;
1990
+		if (!$skin_vars) return;
1991 1991
 
1992
-		foreach($output->data as $val)
1992
+		foreach ($output->data as $val)
1993 1993
 		{
1994
-			if(isset($module_info->{$val->name})) continue;
1994
+			if (isset($module_info->{$val->name})) continue;
1995 1995
 			$module_info->{$val->name} = $val->value;
1996 1996
 		}
1997 1997
 	}
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 	{
2004 2004
 		$grant = new stdClass();
2005 2005
 
2006
-		if(!$xml_info)
2006
+		if (!$xml_info)
2007 2007
 		{
2008 2008
 			$module = $module_info->module;
2009 2009
 			$xml_info = $this->getModuleActionXml($module);
@@ -2011,9 +2011,9 @@  discard block
 block discarded – undo
2011 2011
 		// Set variables to grant group permission
2012 2012
 		$module_srl = $module_info->module_srl;
2013 2013
 		$grant_info = $xml_info->grant;
2014
-		if($member_info->member_srl)
2014
+		if ($member_info->member_srl)
2015 2015
 		{
2016
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2016
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2017 2017
 			else $group_list = array();
2018 2018
 		}
2019 2019
 		else
@@ -2021,10 +2021,10 @@  discard block
 block discarded – undo
2021 2021
 			$group_list = array();
2022 2022
 		}
2023 2023
 		// If module_srl doesn't exist(if unable to set permissions)
2024
-		if(!$module_srl)
2024
+		if (!$module_srl)
2025 2025
 		{
2026 2026
 			$grant->access = true;
2027
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2027
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2028 2028
 			{
2029 2029
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2030 2030
 			}
@@ -2035,23 +2035,23 @@  discard block
 block discarded – undo
2035 2035
 		{
2036 2036
 			// If module_srl exists
2037 2037
 			// Get a type of granted permission
2038
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2038
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false;
2039 2039
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2040 2040
 			// If a just logged-in member is, check if the member is a module administrator
2041
-			if(!$grant->manager && $member_info->member_srl)
2041
+			if (!$grant->manager && $member_info->member_srl)
2042 2042
 			{
2043 2043
 				$args = new stdClass();
2044 2044
 				$args->module_srl = $module_srl;
2045 2045
 				$args->member_srl = $member_info->member_srl;
2046
-				$output = executeQuery('module.getModuleAdmin',$args);
2047
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2046
+				$output = executeQuery('module.getModuleAdmin', $args);
2047
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2048 2048
 			}
2049 2049
 			// If not an administrator, get information from the DB and grant manager privilege.
2050
-			if(!$grant->manager)
2050
+			if (!$grant->manager)
2051 2051
 			{
2052 2052
 				$args = new stdClass();
2053 2053
 				// If planet, get permission settings from the planet home
2054
-				if($module_info->module == 'planet')
2054
+				if ($module_info->module == 'planet')
2055 2055
 				{
2056 2056
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2057 2057
 				}
@@ -2064,42 +2064,42 @@  discard block
 block discarded – undo
2064 2064
 
2065 2065
 				$grant_exists = $granted = array();
2066 2066
 
2067
-				if($output->data)
2067
+				if ($output->data)
2068 2068
 				{
2069 2069
 					// Arrange names and groups who has privileges
2070
-					foreach($output->data as $val)
2070
+					foreach ($output->data as $val)
2071 2071
 					{
2072 2072
 						$grant_exists[$val->name] = true;
2073
-						if($granted[$val->name]) continue;
2073
+						if ($granted[$val->name]) continue;
2074 2074
 						// Log-in member only
2075
-						if($val->group_srl == -1)
2075
+						if ($val->group_srl == -1)
2076 2076
 						{
2077 2077
 							$granted[$val->name] = true;
2078
-							if($member_info->member_srl) $grant->{$val->name} = true;
2078
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2079 2079
 							// Site-joined member only
2080 2080
 						}
2081
-						elseif($val->group_srl == -2)
2081
+						elseif ($val->group_srl == -2)
2082 2082
 						{
2083 2083
 							$granted[$val->name] = true;
2084 2084
 							// Do not grant any permission for non-logged member
2085
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2085
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2086 2086
 							// Log-in member
2087 2087
 							else
2088 2088
 							{
2089 2089
 								$site_module_info = Context::get('site_module_info');
2090 2090
 								// Permission granted if no information of the currently connected site exists
2091
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2091
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2092 2092
 								// Permission is not granted if information of the currently connected site exists
2093
-								elseif(count($group_list)) $grant->{$val->name} = true;
2093
+								elseif (count($group_list)) $grant->{$val->name} = true;
2094 2094
 							}
2095 2095
 							// All of non-logged members
2096 2096
 						}
2097
-						elseif($val->group_srl == -3)
2097
+						elseif ($val->group_srl == -3)
2098 2098
 						{
2099 2099
 							$granted[$val->name] = true;
2100 2100
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2101 2101
 						}
2102
-						elseif($val->group_srl == 0)
2102
+						elseif ($val->group_srl == 0)
2103 2103
 						{
2104 2104
 							$granted[$val->name] = true;
2105 2105
 							$grant->{$val->name} = true;
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 						}
2108 2108
 						else
2109 2109
 						{
2110
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2110
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2111 2111
 							{
2112 2112
 								$grant->{$val->name} = true;
2113 2113
 								$granted[$val->name] = true;
@@ -2116,29 +2116,29 @@  discard block
 block discarded – undo
2116 2116
 					}
2117 2117
 				}
2118 2118
 				// Separate processing for the virtual group access
2119
-				if(!$grant_exists['access']) $grant->access = true;
2120
-				if(count($grant_info))
2119
+				if (!$grant_exists['access']) $grant->access = true;
2120
+				if (count($grant_info))
2121 2121
 				{
2122
-					foreach($grant_info as  $grant_name => $grant_item)
2122
+					foreach ($grant_info as  $grant_name => $grant_item)
2123 2123
 					{
2124
-						if($grant_exists[$grant_name]) continue;
2125
-						switch($grant_item->default)
2124
+						if ($grant_exists[$grant_name]) continue;
2125
+						switch ($grant_item->default)
2126 2126
 						{
2127 2127
 							case 'guest' :
2128 2128
 								$grant->{$grant_name} = true;
2129 2129
 								break;
2130 2130
 							case 'member' :
2131
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2131
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2132 2132
 								else $grant->{$grant_name} = false;
2133 2133
 								break;
2134 2134
 							case 'site' :
2135 2135
 								$site_module_info = Context::get('site_module_info');
2136
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2136
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2137 2137
 								else $grant->{$grant_name} = false;
2138 2138
 								break;
2139 2139
 							case 'manager' :
2140 2140
 							case 'root' :
2141
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2141
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2142 2142
 								else $grant->{$grant_name} = false;
2143 2143
 								break;
2144 2144
 						}
@@ -2146,12 +2146,12 @@  discard block
 block discarded – undo
2146 2146
 				}
2147 2147
 			}
2148 2148
 			// Set true to grant all privileges if an administrator is
2149
-			if($grant->manager)
2149
+			if ($grant->manager)
2150 2150
 			{
2151 2151
 				$grant->access = true;
2152
-				if(count($grant_info))
2152
+				if (count($grant_info))
2153 2153
 				{
2154
-					foreach($grant_info as $key => $val)
2154
+					foreach ($grant_info as $key => $val)
2155 2155
 					{
2156 2156
 						$grant->{$key} = true;
2157 2157
 					}
@@ -2183,27 +2183,27 @@  discard block
 block discarded – undo
2183 2183
 
2184 2184
 	function unserializeAttributes($module_filebox_list)
2185 2185
 	{
2186
-		if(is_array($module_filebox_list->data))
2186
+		if (is_array($module_filebox_list->data))
2187 2187
 		{
2188
-			foreach($module_filebox_list->data as &$item)
2188
+			foreach ($module_filebox_list->data as &$item)
2189 2189
 			{
2190
-				if(empty($item->comment))
2190
+				if (empty($item->comment))
2191 2191
 				{
2192 2192
 					continue;
2193 2193
 				}
2194 2194
 
2195 2195
 				$attributes = explode(';', $item->comment);
2196
-				foreach($attributes as $attribute)
2196
+				foreach ($attributes as $attribute)
2197 2197
 				{
2198 2198
 					$values = explode(':', $attribute);
2199
-					if((count($values) % 2) ==1)
2199
+					if ((count($values) % 2) == 1)
2200 2200
 					{
2201
-						for($i=2;$i<count($values);$i++)
2201
+						for ($i = 2; $i < count($values); $i++)
2202 2202
 						{
2203
-							$values[1].=":".$values[$i];
2203
+							$values[1] .= ":".$values[$i];
2204 2204
 						}
2205 2205
 					}
2206
-					$atts[$values[0]]=$values[1];
2206
+					$atts[$values[0]] = $values[1];
2207 2207
 				}
2208 2208
 				$item->attributes = $atts;
2209 2209
 				unset($atts);
@@ -2215,16 +2215,16 @@  discard block
 block discarded – undo
2215 2215
 	function getFileBoxListHtml()
2216 2216
 	{
2217 2217
 		$logged_info = Context::get('logged_info');
2218
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2218
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2219 2219
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2220
-		$link_params = explode('&',$link['query']);
2220
+		$link_params = explode('&', $link['query']);
2221 2221
 		foreach ($link_params as $param)
2222 2222
 		{
2223
-			$param = explode("=",$param);
2224
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2223
+			$param = explode("=", $param);
2224
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2225 2225
 		}
2226 2226
 		$oWidgetModel = getModel('widget');
2227
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2227
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2228 2228
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2229 2229
 
2230 2230
 		$oModuleModel = getModel('module');
@@ -2240,24 +2240,24 @@  discard block
 block discarded – undo
2240 2240
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2241 2241
 
2242 2242
 		$oTemplate = &TemplateHandler::getInstance();
2243
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2243
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2244 2244
 
2245 2245
 		$this->add('html', $html);
2246 2246
 	}
2247 2247
 
2248 2248
 	function getModuleFileBoxPath($module_filebox_srl)
2249 2249
 	{
2250
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2250
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2251 2251
 	}
2252 2252
 
2253 2253
 	/**
2254 2254
 	 * @brief Return ruleset cache file path
2255 2255
 	 * @param module, act
2256 2256
 	 */
2257
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2257
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2258 2258
 	{
2259 2259
 		// load dynamic ruleset xml file
2260
-		if(strpos($ruleset, '@') !== false)
2260
+		if (strpos($ruleset, '@') !== false)
2261 2261
 		{
2262 2262
 			$rulsetFile = str_replace('@', '', $ruleset);
2263 2263
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2267,20 +2267,20 @@  discard block
 block discarded – undo
2267 2267
 		{
2268 2268
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2269 2269
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2270
-			if(is_readable($xml_file))
2270
+			if (is_readable($xml_file))
2271 2271
 				return FileHandler::getRealPath($xml_file);
2272
-			else{
2272
+			else {
2273 2273
 				$ruleset = str_replace('#', '', $ruleset);
2274 2274
 			}
2275 2275
 
2276 2276
 		}
2277 2277
 		// Get a path of the requested module. Return if not exists.
2278 2278
 		$class_path = ModuleHandler::getModulePath($module);
2279
-		if(!$class_path) return;
2279
+		if (!$class_path) return;
2280 2280
 
2281 2281
 		// Check if module.xml exists in the path. Return if not exist
2282 2282
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2283
-		if(!file_exists($xml_file)) return;
2283
+		if (!file_exists($xml_file)) return;
2284 2284
 
2285 2285
 		return $xml_file;
2286 2286
 	}
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
 		$requestVars = Context::getRequestVars();
2293 2293
 
2294 2294
 		$args = new stdClass;
2295
-		$args->site_srl = (int)$requestVars->site_srl;
2295
+		$args->site_srl = (int) $requestVars->site_srl;
2296 2296
 		$args->page = 1; // /< Page
2297 2297
 		$args->list_count = 100; // /< the number of posts to display on a single page
2298 2298
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2304,9 +2304,9 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 		$list = array();
2306 2306
 
2307
-		if($output->toBool())
2307
+		if ($output->toBool())
2308 2308
 		{
2309
-			foreach((array)$output->data as $code_info)
2309
+			foreach ((array) $output->data as $code_info)
2310 2310
 			{
2311 2311
 				unset($codeInfo);
2312 2312
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
Braces   +470 added lines, -209 removed lines patch added patch discarded remove patch
@@ -19,26 +19,34 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) {
23
+			return true;
24
+		}
23 25
 		// directory and rss/atom/api reserved checking, etc.
24 26
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 27
 		$dirs[] = 'rss';
26 28
 		$dirs[] = 'atom';
27 29
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
30
+		if(in_array($id, $dirs)) {
31
+			return true;
32
+		}
29 33
 		// mid test
30 34
 		$args = new stdClass();
31 35
 		$args->mid = $id;
32 36
 		$args->site_srl = $site_srl;
33 37
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
38
+		if($output->data->count) {
39
+			return true;
40
+		}
35 41
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36 42
 		if(!$site_srl)
37 43
 		{
38 44
 			$site_args = new stdClass();
39 45
 			$site_args->domain = $id;
40 46
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
47
+			if($output->data->count) {
48
+				return true;
49
+			}
42 50
 		}
43 51
 
44 52
 		return false;
@@ -82,10 +90,14 @@  discard block
 block discarded – undo
82 90
 	function getDefaultMid()
83 91
 	{
84 92
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
93
+		if($default_url && substr_compare($default_url, '/', -1) === 0) {
94
+			$default_url = substr($default_url, 0, -1);
95
+		}
86 96
 
87 97
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
98
+		if($request_url && substr_compare($request_url, '/', -1) === 0) {
99
+			$request_url = substr($request_url, 0, -1);
100
+		}
89 101
 
90 102
 		$default_url_parse = parse_url($default_url);
91 103
 		$request_url_parse = parse_url($request_url);
@@ -100,14 +112,18 @@  discard block
 block discarded – undo
100 112
 			$hostname = $request_url_parse['host'];
101 113
 			$path = $request_url_parse['path'];
102 114
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
115
+			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
116
+				$path = substr($path, 0, -1);
117
+			}
104 118
 
105 119
 			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
106 120
 		}
107 121
 
108 122
 		if($domain === '')
109 123
 		{
110
-			if(!$vid) $vid = $mid;
124
+			if(!$vid) {
125
+				$vid = $mid;
126
+			}
111 127
 			if($vid)
112 128
 			{
113 129
 				$domain = $vid;
@@ -133,13 +149,17 @@  discard block
 block discarded – undo
133 149
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 150
 				$site_info = $output->data;
135 151
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
152
+				if($oCacheHandler->isSupport()) {
153
+					$oCacheHandler->put($domain_cache_key, $site_info);
154
+				}
137 155
 			}
138 156
 
139 157
 			if($site_info && $vid)
140 158
 			{
141 159
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
160
+				if(strtolower($mid)==strtolower($site_info->domain)) {
161
+					Context::set('mid', $site_info->mid,true);
162
+				}
143 163
 			}
144 164
 			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 165
 		}
@@ -165,8 +185,12 @@  discard block
 block discarded – undo
165 185
 				{
166 186
 					// Create a table if sites table doesn't exist
167 187
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
188
+					if(!$oDB->isTableExists('sites')) {
189
+						$oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
190
+					}
191
+					if(!$oDB->isTableExists('sites')) {
192
+						return;
193
+					}
170 194
 
171 195
 					// Get mid, language
172 196
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
@@ -184,21 +208,28 @@  discard block
 block discarded – undo
184 208
 					if($output->data && !$output->data->index_module_srl)
185 209
 					{
186 210
 						$output = executeQuery('module.updateSite', $site_args);
187
-					}
188
-					else
211
+					} else
189 212
 					{
190 213
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
214
+						if(!$output->toBool()) {
215
+							return $output;
216
+						}
192 217
 					}
193 218
 					$output = executeQuery('module.getSiteInfo', $args);
194 219
 				}
195 220
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
221
+				if($oCacheHandler->isSupport()) {
222
+					$oCacheHandler->put($default_site_cache_key, $site_info);
223
+				}
197 224
 			}
198 225
 		}
199 226
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
227
+		if(!$site_info->module_srl) {
228
+			return $site_info;
229
+		}
230
+		if(is_array($site_info) && $site_info->data[0]) {
231
+			$site_info = $site_info[0];
232
+		}
202 233
 		return $this->addModuleExtraVars($site_info);
203 234
 	}
204 235
 
@@ -248,7 +279,9 @@  discard block
 block discarded – undo
248 279
 		}
249 280
 
250 281
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
282
+		if(!$module_info->module_srl && $module_info->data[0]) {
283
+			$module_info = $module_info->data[0];
284
+		}
252 285
 		return $this->addModuleExtraVars($module_info);
253 286
 	}
254 287
 
@@ -340,8 +373,7 @@  discard block
 block discarded – undo
340 373
 				$object_key = 'mid_info:' . $output->data->module_srl;
341 374
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 375
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343
-			}
344
-			else
376
+			} else
345 377
 			{
346 378
 				$mid_info->designSettings = $moduleInfo->designSettings;
347 379
 				$moduleInfo = $mid_info;
@@ -382,11 +414,15 @@  discard block
 block discarded – undo
382 414
 			$args = new stdClass();
383 415
 			$args->module_srl = $module_srl;
384 416
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
417
+			if(!$output->toBool()) {
418
+				return;
419
+			}
386 420
 
387 421
 			$mid_info = $output->data;
388 422
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
423
+			if($oCacheHandler->isSupport()) {
424
+				$oCacheHandler->put($cache_key, $mid_info);
425
+			}
390 426
 		}
391 427
 
392 428
 		if($mid_info && count($columnList))
@@ -399,11 +435,14 @@  discard block
 block discarded – undo
399 435
 					$module_info->$key = $item;
400 436
 				}
401 437
 			}
438
+		} else {
439
+			$module_info = $mid_info;
402 440
 		}
403
-		else $module_info = $mid_info;
404 441
 
405 442
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
443
+		if(isset($module_info->browser_title)) {
444
+			$oModuleController->replaceDefinedLangCode($module_info->browser_title);
445
+		}
407 446
 
408 447
 		$this->applyDefaultSkin($module_info);
409 448
 		return $this->addModuleExtraVars($module_info);
@@ -451,11 +490,15 @@  discard block
 block discarded – undo
451 490
 	 */
452 491
 	function getModulesInfo($module_srls, $columnList = array())
453 492
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
493
+		if(is_array($module_srls)) {
494
+			$module_srls = implode(',',$module_srls);
495
+		}
455 496
 		$args = new stdClass();
456 497
 		$args->module_srls = $module_srls;
457 498
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
499
+		if(!$output->toBool()) {
500
+			return;
501
+		}
459 502
 		return $this->addModuleExtraVars($output->data);
460 503
 	}
461 504
 
@@ -465,31 +508,44 @@  discard block
 block discarded – undo
465 508
 	function addModuleExtraVars($module_info)
466 509
 	{
467 510
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
469
-		else $target_module_info = $module_info;
511
+		if(!is_array($module_info)) {
512
+			$target_module_info = array($module_info);
513
+		} else {
514
+			$target_module_info = $module_info;
515
+		}
470 516
 		// Get module_srl
471 517
 		$module_srls = array();
472 518
 		foreach($target_module_info as $key => $val)
473 519
 		{
474 520
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
521
+			if(!$module_srl) {
522
+				continue;
523
+			}
476 524
 			$module_srls[] = $val->module_srl;
477 525
 		}
478 526
 		// Extract extra information of the module and skin
479 527
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
528
+		if(!count($module_srls) || !count($extra_vars)) {
529
+			return $module_info;
530
+		}
481 531
 
482 532
 		foreach($target_module_info as $key => $val)
483 533
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
534
+			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) {
535
+				continue;
536
+			}
485 537
 			foreach($extra_vars[$val->module_srl] as $k => $v)
486 538
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
539
+				if($target_module_info[$key]->{$k}) {
540
+					continue;
541
+				}
488 542
 				$target_module_info[$key]->{$k} = $v;
489 543
 			}
490 544
 		}
491 545
 
492
-		if(is_array($module_info)) return $target_module_info;
546
+		if(is_array($module_info)) {
547
+			return $target_module_info;
548
+		}
493 549
 		return $target_module_info[0];
494 550
 	}
495 551
 
@@ -518,7 +574,9 @@  discard block
 block discarded – undo
518 574
 			}
519 575
 
520 576
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
577
+			if(!$output->toBool()) {
578
+				return $output;
579
+			}
522 580
 			$list = $output->data;
523 581
 
524 582
 			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
@@ -526,9 +584,13 @@  discard block
 block discarded – undo
526 584
 				$oCacheHandler->put($cache_key, $list);
527 585
 			}
528 586
 		}
529
-		if(!$list) return;
587
+		if(!$list) {
588
+			return;
589
+		}
530 590
 
531
-		if(!is_array($list)) $list = array($list);
591
+		if(!is_array($list)) {
592
+			$list = array($list);
593
+		}
532 594
 
533 595
 		foreach($list as $val)
534 596
 		{
@@ -544,10 +606,14 @@  discard block
 block discarded – undo
544 606
 	function getModuleSrlList($args = null, $columnList = array())
545 607
 	{
546 608
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
609
+		if(!$output->toBool()) {
610
+			return $output;
611
+		}
548 612
 
549 613
 		$list = $output->data;
550
-		if(!$list) return;
614
+		if(!$list) {
615
+			return;
616
+		}
551 617
 
552 618
 		return $list;
553 619
 	}
@@ -557,20 +623,32 @@  discard block
 block discarded – undo
557 623
 	 */
558 624
 	function getModuleSrlByMid($mid)
559 625
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
626
+		if($mid && !is_array($mid)) {
627
+			$mid = explode(',',$mid);
628
+		}
629
+		if(is_array($mid)) {
630
+			$mid = "'".implode("','",$mid)."'";
631
+		}
562 632
 
563 633
 		$site_module_info = Context::get('site_module_info');
564 634
 
565 635
 		$args = new stdClass;
566 636
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
637
+		if($site_module_info) {
638
+			$args->site_srl = $site_module_info->site_srl;
639
+		}
568 640
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
641
+		if(!$output->toBool()) {
642
+			return $output;
643
+		}
570 644
 
571 645
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
646
+		if(!$list) {
647
+			return;
648
+		}
649
+		if(!is_array($list)) {
650
+			$list = array($list);
651
+		}
574 652
 
575 653
 		foreach($list as $key => $val)
576 654
 		{
@@ -599,8 +677,12 @@  discard block
 block discarded – undo
599 677
 		{
600 678
 			$args = new stdClass();
601 679
 			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
680
+			if(!$output->toBool()) {
681
+				return new stdClass;
682
+			}
683
+			if(!$output->data) {
684
+				$output->data = array();
685
+			}
604 686
 
605 687
 			$action_forward = array();
606 688
 			foreach($output->data as $item)
@@ -617,8 +699,7 @@  discard block
 block discarded – undo
617 699
 		if($action_forward[$act])
618 700
 		{
619 701
 			return $action_forward[$act];
620
-		}
621
-		else
702
+		} else
622 703
 		{
623 704
 			return new stdClass();
624 705
 		}
@@ -726,8 +807,7 @@  discard block
 block discarded – undo
726 807
 			if(file_exists($cache_file))
727 808
 			{
728 809
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729
-			}
730
-			else
810
+			} else
731 811
 			{
732 812
 				$GLOBALS['__MODULE_EXTEND__'] = array();
733 813
 			}
@@ -743,16 +823,22 @@  discard block
 block discarded – undo
743 823
 	{
744 824
 		// Get a path of the requested module. Return if not exists.
745 825
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
826
+		if(!$module_path) {
827
+			return;
828
+		}
747 829
 		// Read the xml file for module skin information
748 830
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
831
+		if(!file_exists($xml_file)) {
832
+			return;
833
+		}
750 834
 
751 835
 		$oXmlParser = new XmlParser();
752 836
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 837
 		$xml_obj = $tmp_xml_obj->module;
754 838
 
755
-		if(!$xml_obj) return;
839
+		if(!$xml_obj) {
840
+			return;
841
+		}
756 842
 
757 843
 		// Module Information
758 844
 		$module_info = new stdClass();
@@ -764,14 +850,19 @@  discard block
 block discarded – undo
764 850
 			$module_info->version = $xml_obj->version->body;
765 851
 			$module_info->homepage = $xml_obj->link->body;
766 852
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
853
+			if(!$module_info->category) {
854
+				$module_info->category = 'service';
855
+			}
768 856
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 857
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 858
 			$module_info->license = $xml_obj->license->body;
771 859
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 860
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774
-			else $author_list = $xml_obj->author;
861
+			if(!is_array($xml_obj->author)) {
862
+				$author_list[] = $xml_obj->author;
863
+			} else {
864
+				$author_list = $xml_obj->author;
865
+			}
775 866
 
776 867
 			foreach($author_list as $author)
777 868
 			{
@@ -781,15 +872,16 @@  discard block
 block discarded – undo
781 872
 				$author_obj->homepage = $author->attrs->link;
782 873
 				$module_info->author[] = $author_obj;
783 874
 			}
784
-		}
785
-		else
875
+		} else
786 876
 		{
787 877
 			// module format 0.1
788 878
 			$module_info->title = $xml_obj->title->body;
789 879
 			$module_info->description = $xml_obj->author->description->body;
790 880
 			$module_info->version = $xml_obj->attrs->version;
791 881
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
882
+			if(!$module_info->category) {
883
+				$module_info->category = 'service';
884
+			}
793 885
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 886
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 887
 			$author_obj = new stdClass();
@@ -818,11 +910,15 @@  discard block
 block discarded – undo
818 910
 	{
819 911
 		// Get a path of the requested module. Return if not exists.
820 912
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
913
+		if(!$class_path) {
914
+			return;
915
+		}
822 916
 
823 917
 		// Check if module.xml exists in the path. Return if not exist
824 918
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
919
+		if(!file_exists($xml_file)) {
920
+			return;
921
+		}
826 922
 
827 923
 		// Check if cached file exists
828 924
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
@@ -841,7 +937,10 @@  discard block
 block discarded – undo
841 937
 
842 938
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 939
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
940
+			if(!count($xml_obj->module)) {
941
+				return;
942
+			}
943
+			// /< Error occurs if module tag doesn't included in the xml
845 944
 
846 945
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 946
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -853,8 +952,11 @@  discard block
 block discarded – undo
853 952
 			// Arrange permission information
854 953
 			if($grants)
855 954
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
857
-				else $grant_list[] = $grants;
955
+				if(is_array($grants)) {
956
+					$grant_list = $grants;
957
+				} else {
958
+					$grant_list[] = $grants;
959
+				}
858 960
 
859 961
 				$info->grant = new stdClass();
860 962
 				$buff[] = '$info->grant = new stdClass;';
@@ -876,8 +978,11 @@  discard block
 block discarded – undo
876 978
 			// Permissions to grant
877 979
 			if($permissions)
878 980
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
880
-				else $permission_list[] = $permissions;
981
+				if(is_array($permissions)) {
982
+					$permission_list = $permissions;
983
+				} else {
984
+					$permission_list[] = $permissions;
985
+				}
881 986
 
882 987
 				$buff[] = '$info->permission = new stdClass;';
883 988
 
@@ -895,8 +1000,11 @@  discard block
 block discarded – undo
895 1000
 			// for admin menus
896 1001
 			if($menus)
897 1002
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
899
-				else $menu_list[] = $menus;
1003
+				if(is_array($menus)) {
1004
+					$menu_list = $menus;
1005
+				} else {
1006
+					$menu_list[] = $menus;
1007
+				}
900 1008
 
901 1009
 				$buff[] = '$info->menu = new stdClass;';
902 1010
 				$info->menu = new stdClass();
@@ -920,8 +1028,11 @@  discard block
 block discarded – undo
920 1028
 			// actions
921 1029
 			if($actions)
922 1030
 			{
923
-				if(is_array($actions)) $action_list = $actions;
924
-				else $action_list[] = $actions;
1031
+				if(is_array($actions)) {
1032
+					$action_list = $actions;
1033
+				} else {
1034
+					$action_list[] = $actions;
1035
+				}
925 1036
 
926 1037
 				$buff[] = '$info->action = new stdClass;';
927 1038
 				$info->action = new stdClass();
@@ -1010,7 +1121,9 @@  discard block
 block discarded – undo
1010 1121
 			return $info;
1011 1122
 		}
1012 1123
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1124
+		if(file_exists($cache_file)) {
1125
+			return include($cache_file);
1126
+		}
1014 1127
 	}
1015 1128
 
1016 1129
 	/**
@@ -1048,7 +1161,9 @@  discard block
 block discarded – undo
1048 1161
 
1049 1162
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1163
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1164
+		if(!count($list)) {
1165
+			return;
1166
+		}
1052 1167
 
1053 1168
 		natcasesort($list);
1054 1169
 
@@ -1102,8 +1217,7 @@  discard block
 block discarded – undo
1102 1217
 			if($dir == 'skins')
1103 1218
 			{
1104 1219
 				$type = 'P';
1105
-			}
1106
-			else
1220
+			} else
1107 1221
 			{
1108 1222
 				$type = 'M';
1109 1223
 			}
@@ -1131,14 +1245,20 @@  discard block
 block discarded – undo
1131 1245
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1246
 	{
1133 1247
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1248
+		if(substr($path,-1)!='/') {
1249
+			$path .= '/';
1250
+		}
1135 1251
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1252
+		if(!file_exists($skin_xml_file)) {
1253
+			return;
1254
+		}
1137 1255
 		// Create XmlParser object
1138 1256
 		$oXmlParser = new XmlParser();
1139 1257
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1258
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1259
+		if(!$_xml_obj->skin) {
1260
+			return;
1261
+		}
1142 1262
 		$xml_obj = $_xml_obj->skin;
1143 1263
 		// Skin Name
1144 1264
 		$skin_info = new stdClass();
@@ -1155,8 +1275,11 @@  discard block
 block discarded – undo
1155 1275
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1276
 			$skin_info->description = $xml_obj->description->body;
1157 1277
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159
-			else $author_list = $xml_obj->author;
1278
+			if(!is_array($xml_obj->author)) {
1279
+				$author_list[] = $xml_obj->author;
1280
+			} else {
1281
+				$author_list = $xml_obj->author;
1282
+			}
1160 1283
 
1161 1284
 			foreach($author_list as $author)
1162 1285
 			{
@@ -1170,8 +1293,12 @@  discard block
 block discarded – undo
1170 1293
 			if($xml_obj->extra_vars)
1171 1294
 			{
1172 1295
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1296
+				if(!$extra_var_groups) {
1297
+					$extra_var_groups = $xml_obj->extra_vars;
1298
+				}
1299
+				if(!is_array($extra_var_groups)) {
1300
+					$extra_var_groups = array($extra_var_groups);
1301
+				}
1175 1302
 
1176 1303
 				foreach($extra_var_groups as $group)
1177 1304
 				{
@@ -1180,7 +1307,9 @@  discard block
 block discarded – undo
1180 1307
 					{
1181 1308
 						continue;
1182 1309
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1310
+					if(!is_array($group->var)) {
1311
+						$extra_vars = array($group->var);
1312
+					}
1184 1313
 
1185 1314
 					foreach($extra_vars as $key => $val)
1186 1315
 					{
@@ -1207,8 +1336,7 @@  discard block
 block discarded – undo
1207 1336
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1208 1337
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1209 1338
 							}
1210
-						}
1211
-						else
1339
+						} else
1212 1340
 						{
1213 1341
 							$obj->options[0] = new stdClass();
1214 1342
 							$obj->options[0]->title = $val->options->title->body;
@@ -1219,8 +1347,7 @@  discard block
 block discarded – undo
1219 1347
 					}
1220 1348
 				}
1221 1349
 			}
1222
-		}
1223
-		else
1350
+		} else
1224 1351
 		{
1225 1352
 			// skin format v0.1
1226 1353
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1238,8 +1365,12 @@  discard block
 block discarded – undo
1238 1365
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1366
 			// Variables used in the skin
1240 1367
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1368
+			if(!$extra_var_groups) {
1369
+				$extra_var_groups = $xml_obj->extra_vars;
1370
+			}
1371
+			if(!is_array($extra_var_groups)) {
1372
+				$extra_var_groups = array($extra_var_groups);
1373
+			}
1243 1374
 
1244 1375
 			foreach($extra_var_groups as $group)
1245 1376
 			{
@@ -1247,7 +1378,9 @@  discard block
 block discarded – undo
1247 1378
 
1248 1379
 				if($extra_vars)
1249 1380
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1381
+					if(!is_array($extra_vars)) {
1382
+						$extra_vars = array($extra_vars);
1383
+					}
1251 1384
 
1252 1385
 					foreach($extra_vars as $var)
1253 1386
 					{
@@ -1269,8 +1402,7 @@  discard block
 block discarded – undo
1269 1402
 								$options[$i]->title = $var->default[$i]->body;
1270 1403
 								$options[$i]->value = $var->default[$i]->body;
1271 1404
 							}
1272
-						}
1273
-						else
1405
+						} else
1274 1406
 						{
1275 1407
 							$options[0]->title = $var->default->body;
1276 1408
 							$options[0]->value = $var->default->body;
@@ -1300,7 +1432,9 @@  discard block
 block discarded – undo
1300 1432
 		$colorset = $xml_obj->colorset->color;
1301 1433
 		if($colorset)
1302 1434
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1435
+			if(!is_array($colorset)) {
1436
+				$colorset = array($colorset);
1437
+			}
1304 1438
 
1305 1439
 			foreach($colorset as $color)
1306 1440
 			{
@@ -1310,9 +1444,12 @@  discard block
 block discarded – undo
1310 1444
 				if($screenshot)
1311 1445
 				{
1312 1446
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1447
+					if(!file_exists($screenshot)) {
1448
+						$screenshot = "";
1449
+					}
1450
+				} else {
1451
+					$screenshot = "";
1314 1452
 				}
1315
-				else $screenshot = "";
1316 1453
 
1317 1454
 				$obj = new stdClass();
1318 1455
 				$obj->name = $name;
@@ -1325,7 +1462,9 @@  discard block
 block discarded – undo
1325 1462
 		if($xml_obj->menus->menu)
1326 1463
 		{
1327 1464
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1465
+			if(!is_array($menus)) {
1466
+				$menus = array($menus);
1467
+			}
1329 1468
 
1330 1469
 			$menu_count = count($menus);
1331 1470
 			$skin_info->menu_count = $menu_count;
@@ -1334,7 +1473,9 @@  discard block
 block discarded – undo
1334 1473
 				unset($obj);
1335 1474
 
1336 1475
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1476
+				if($menus[$i]->attrs->default == "true") {
1477
+					$obj->default = true;
1478
+				}
1338 1479
 				$obj->title = $menus[$i]->title->body;
1339 1480
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1481
 
@@ -1354,7 +1495,9 @@  discard block
 block discarded – undo
1354 1495
 	{
1355 1496
 		$args = new stdClass;
1356 1497
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1498
+		if(!is_null($module)) {
1499
+			$args->module = $module;
1500
+		}
1358 1501
 		$output = executeQuery('module.getModuleCount', $args);
1359 1502
 		return $output->data->count;
1360 1503
 	}
@@ -1383,8 +1526,11 @@  discard block
 block discarded – undo
1383 1526
 				$args->module = $module;
1384 1527
 				$args->site_srl = $site_srl;
1385 1528
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1387
-				else $config = null;
1529
+				if($output->data->config) {
1530
+					$config = unserialize($output->data->config);
1531
+				} else {
1532
+					$config = null;
1533
+				}
1388 1534
 
1389 1535
 				//insert in cache
1390 1536
 				if($oCacheHandler->isSupport())
@@ -1423,8 +1569,11 @@  discard block
 block discarded – undo
1423 1569
 				$args->module = $module;
1424 1570
 				$args->module_srl = $module_srl;
1425 1571
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1427
-				else $config = null;
1572
+				if($output->data->config) {
1573
+					$config = unserialize($output->data->config);
1574
+				} else {
1575
+					$config = null;
1576
+				}
1428 1577
 
1429 1578
 				//insert in cache
1430 1579
 				if($oCacheHandler->isSupport())
@@ -1446,9 +1595,13 @@  discard block
 block discarded – undo
1446 1595
 	{
1447 1596
 		$args = new stdClass();
1448 1597
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1598
+		if($site_srl) {
1599
+			$args->site_srl = $site_srl;
1600
+		}
1450 1601
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1602
+		if(!$output->toBool() || !$output->data) {
1603
+			return array();
1604
+		}
1452 1605
 
1453 1606
 		foreach($output->data as $key => $val)
1454 1607
 		{
@@ -1466,10 +1619,16 @@  discard block
 block discarded – undo
1466 1619
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1620
 		// Get data from the DB
1468 1621
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1622
+		if(!$output->toBool()) {
1623
+			return $output;
1624
+		}
1470 1625
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1626
+		if(!$list) {
1627
+			return;
1628
+		}
1629
+		if(!is_array($list)) {
1630
+			$list = array($list);
1631
+		}
1473 1632
 
1474 1633
 		foreach($list as $val)
1475 1634
 		{
@@ -1487,7 +1646,9 @@  discard block
 block discarded – undo
1487 1646
 		$args = new stdClass;
1488 1647
 		$args->module_category_srl = $module_category_srl;
1489 1648
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1649
+		if(!$output->toBool()) {
1650
+			return $output;
1651
+		}
1491 1652
 		return $output->data;
1492 1653
 	}
1493 1654
 
@@ -1499,7 +1660,9 @@  discard block
 block discarded – undo
1499 1660
 		// Get a list of downloaded and installed modules
1500 1661
 		$searched_list = FileHandler::readDir('./modules');
1501 1662
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1663
+		if(!$searched_count) {
1664
+			return;
1665
+		}
1503 1666
 		sort($searched_list);
1504 1667
 
1505 1668
 		for($i=0;$i<$searched_count;$i++)
@@ -1512,7 +1675,9 @@  discard block
 block discarded – undo
1512 1675
 			$info = $this->getModuleInfoXml($module_name);
1513 1676
 			unset($obj);
1514 1677
 
1515
-			if(!isset($info)) continue;
1678
+			if(!isset($info)) {
1679
+				continue;
1680
+			}
1516 1681
 			$info->module = $module_name;
1517 1682
 			$info->created_table_count = $created_table_count;
1518 1683
 			$info->table_count = $table_count;
@@ -1538,11 +1703,16 @@  discard block
 block discarded – undo
1538 1703
 			for($j=0;$j<count($tmp_files);$j++)
1539 1704
 			{
1540 1705
 				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1706
+				if($oDB->isTableExists($table_name)) {
1707
+					$created_table_count ++;
1708
+				}
1542 1709
 			}
1543 1710
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1545
-			else return false;
1711
+			if($table_count > $created_table_count) {
1712
+				return true;
1713
+			} else {
1714
+				return false;
1715
+			}
1546 1716
 		}
1547 1717
 		return false;
1548 1718
 	}
@@ -1565,15 +1735,23 @@  discard block
 block discarded – undo
1565 1735
 	 */
1566 1736
 	public function needUpdate($update_id)
1567 1737
 	{
1568
-		if(!is_array($update_id)) $update_id = array($update_id);
1738
+		if(!is_array($update_id)) {
1739
+			$update_id = array($update_id);
1740
+		}
1569 1741
 
1570 1742
 		$args = new stdClass();
1571 1743
 		$args->update_id = implode(',', $update_id);
1572 1744
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1573 1745
 
1574
-		if(!!$output->error) return false;
1575
-		if(!$output->data) $output->data = array();
1576
-		if(count($update_id) === count($output->data)) return false;
1746
+		if(!!$output->error) {
1747
+			return false;
1748
+		}
1749
+		if(!$output->data) {
1750
+			$output->data = array();
1751
+		}
1752
+		if(count($update_id) === count($output->data)) {
1753
+			return false;
1754
+		}
1577 1755
 
1578 1756
 		return true;
1579 1757
 	}
@@ -1590,7 +1768,9 @@  discard block
 block discarded – undo
1590 1768
 		sort($searched_list);
1591 1769
 
1592 1770
 		$searched_count = count($searched_list);
1593
-		if(!$searched_count) return;
1771
+		if(!$searched_count) {
1772
+			return;
1773
+		}
1594 1774
 
1595 1775
 		for($i=0;$i<$searched_count;$i++)
1596 1776
 		{
@@ -1598,7 +1778,9 @@  discard block
 block discarded – undo
1598 1778
 			$module_name = $searched_list[$i];
1599 1779
 
1600 1780
 			$path = ModuleHandler::getModulePath($module_name);
1601
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1781
+			if(!is_dir(FileHandler::getRealPath($path))) {
1782
+				continue;
1783
+			}
1602 1784
 
1603 1785
 			// Get the number of xml files to create a table in schemas
1604 1786
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1608,13 +1790,17 @@  discard block
 block discarded – undo
1608 1790
 			for($j=0;$j<$table_count;$j++)
1609 1791
 			{
1610 1792
 				list($table_name) = explode('.',$tmp_files[$j]);
1611
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1793
+				if($oDB->isTableExists($table_name)) {
1794
+					$created_table_count ++;
1795
+				}
1612 1796
 			}
1613 1797
 			// Get information of the module
1614 1798
 			$info = NULL;
1615 1799
 			$info = $this->getModuleInfoXml($module_name);
1616 1800
 
1617
-			if(!$info) continue;
1801
+			if(!$info) {
1802
+				continue;
1803
+			}
1618 1804
 
1619 1805
 			$info->module = $module_name;
1620 1806
 			$info->category = $info->category;
@@ -1623,16 +1809,18 @@  discard block
 block discarded – undo
1623 1809
 			$info->path = $path;
1624 1810
 			$info->admin_index_act = $info->admin_index_act;
1625 1811
 			// Check if DB is installed
1626
-			if($table_count > $created_table_count) $info->need_install = true;
1627
-			else $info->need_install = false;
1812
+			if($table_count > $created_table_count) {
1813
+				$info->need_install = true;
1814
+			} else {
1815
+				$info->need_install = false;
1816
+			}
1628 1817
 			// Check if it is upgraded to module.class.php on each module
1629 1818
 			$oDummy = null;
1630 1819
 			$oDummy = getModule($module_name, 'class');
1631 1820
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1632 1821
 			{
1633 1822
 				$info->need_update = $oDummy->checkUpdate();
1634
-			}
1635
-			else
1823
+			} else
1636 1824
 			{
1637 1825
 				continue;
1638 1826
 			}
@@ -1649,7 +1837,9 @@  discard block
 block discarded – undo
1649 1837
 	 */
1650 1838
 	function syncModuleToSite(&$data)
1651 1839
 	{
1652
-		if(!$data) return;
1840
+		if(!$data) {
1841
+			return;
1842
+		}
1653 1843
 
1654 1844
 		if(is_array($data))
1655 1845
 		{
@@ -1657,9 +1847,10 @@  discard block
 block discarded – undo
1657 1847
 			{
1658 1848
 				$module_srls[] = $val->module_srl;
1659 1849
 			}
1660
-			if(!count($module_srls)) return;
1661
-		}
1662
-		else
1850
+			if(!count($module_srls)) {
1851
+				return;
1852
+			}
1853
+		} else
1663 1854
 		{
1664 1855
 			$module_srls[] = $data->module_srl;
1665 1856
 		}
@@ -1667,7 +1858,9 @@  discard block
 block discarded – undo
1667 1858
 		$args = new stdClass();
1668 1859
 		$args->module_srls = implode(',',$module_srls);
1669 1860
 		$output = executeQueryArray('module.getModuleSites', $args);
1670
-		if(!$output->data) return array();
1861
+		if(!$output->data) {
1862
+			return array();
1863
+		}
1671 1864
 		foreach($output->data as $key => $val)
1672 1865
 		{
1673 1866
 			$modules[$val->module_srl] = $val;
@@ -1679,8 +1872,7 @@  discard block
 block discarded – undo
1679 1872
 			{
1680 1873
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1681 1874
 			}
1682
-		}
1683
-		else
1875
+		} else
1684 1876
 		{
1685 1877
 			$data->domain = $modules[$data->module_srl]->domain;
1686 1878
 		}
@@ -1691,24 +1883,31 @@  discard block
 block discarded – undo
1691 1883
 	 */
1692 1884
 	function isSiteAdmin($member_info, $site_srl = null)
1693 1885
 	{
1694
-		if(!$member_info->member_srl) return false;
1695
-		if($member_info->is_admin == 'Y') return true;
1886
+		if(!$member_info->member_srl) {
1887
+			return false;
1888
+		}
1889
+		if($member_info->is_admin == 'Y') {
1890
+			return true;
1891
+		}
1696 1892
 
1697 1893
 		$args = new stdClass();
1698 1894
 		if(!isset($site_srl))
1699 1895
 		{
1700 1896
 			$site_module_info = Context::get('site_module_info');
1701
-			if(!$site_module_info) return;
1897
+			if(!$site_module_info) {
1898
+				return;
1899
+			}
1702 1900
 			$args->site_srl = $site_module_info->site_srl;
1703
-		}
1704
-		else
1901
+		} else
1705 1902
 		{
1706 1903
 			$args->site_srl = $site_srl;
1707 1904
 		}
1708 1905
 
1709 1906
 		$args->member_srl = $member_info->member_srl;
1710 1907
 		$output = executeQuery('module.isSiteAdmin', $args);
1711
-		if($output->data->member_srl == $args->member_srl) return true;
1908
+		if($output->data->member_srl == $args->member_srl) {
1909
+			return true;
1910
+		}
1712 1911
 		return false;
1713 1912
 	}
1714 1913
 
@@ -1731,7 +1930,9 @@  discard block
 block discarded – undo
1731 1930
 		$obj = new stdClass();
1732 1931
 		$obj->module_srl = $module_srl;
1733 1932
 		$output = executeQueryArray('module.getAdminID', $obj);
1734
-		if(!$output->toBool() || !$output->data) return;
1933
+		if(!$output->toBool() || !$output->data) {
1934
+			return;
1935
+		}
1735 1936
 
1736 1937
 		return $output->data;
1737 1938
 	}
@@ -1744,7 +1945,9 @@  discard block
 block discarded – undo
1744 1945
 	{
1745 1946
 		$extra_vars = array();
1746 1947
 		$get_module_srls = array();
1747
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1948
+		if(!is_array($list_module_srl)) {
1949
+			$list_module_srl = array($list_module_srl);
1950
+		}
1748 1951
 
1749 1952
 		$vars = false;
1750 1953
 		// cache controll
@@ -1760,14 +1963,12 @@  discard block
 block discarded – undo
1760 1963
 				if($vars)
1761 1964
 				{
1762 1965
 					$extra_vars[$module_srl] = $vars;
1763
-				}
1764
-				else
1966
+				} else
1765 1967
 				{
1766 1968
 					$get_module_srls[] = $module_srl;
1767 1969
 				}
1768 1970
 			}
1769
-		}
1770
-		else
1971
+		} else
1771 1972
 		{
1772 1973
 			$get_module_srls = $list_module_srl;
1773 1974
 		}
@@ -1792,7 +1993,9 @@  discard block
 block discarded – undo
1792 1993
 			}
1793 1994
 			foreach($output->data as $key => $val)
1794 1995
 			{
1795
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1996
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1997
+					continue;
1998
+				}
1796 1999
 
1797 2000
 				if(!isset($extra_vars[$val->module_srl]))
1798 2001
 				{
@@ -1831,7 +2034,9 @@  discard block
 block discarded – undo
1831 2034
 			$args = new stdClass();
1832 2035
 			$args->module_srl = $module_srl;
1833 2036
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1834
-			if(!$output->toBool()) return;
2037
+			if(!$output->toBool()) {
2038
+				return;
2039
+			}
1835 2040
 
1836 2041
 			$skin_vars = array();
1837 2042
 			foreach($output->data as $vars)
@@ -1839,7 +2044,9 @@  discard block
 block discarded – undo
1839 2044
 				$skin_vars[$vars->name] = $vars;
1840 2045
 			}
1841 2046
 
1842
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2047
+			if($oCacheHandler->isSupport()) {
2048
+				$oCacheHandler->put($cache_key, $skin_vars);
2049
+			}
1843 2050
 		}
1844 2051
 
1845 2052
 		return $skin_vars;
@@ -1851,7 +2058,9 @@  discard block
 block discarded – undo
1851 2058
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1852 2059
 	{
1853 2060
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1854
-		if(!$site_srl) $site_srl = 0;
2061
+		if(!$site_srl) {
2062
+			$site_srl = 0;
2063
+		}
1855 2064
 
1856 2065
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1857 2066
 		if(is_readable($designInfoFile))
@@ -1868,19 +2077,16 @@  discard block
 block discarded – undo
1868 2077
 			if(is_dir($moduleSkinPath.'default'))
1869 2078
 			{
1870 2079
 				$skinName = 'default';
1871
-			}
1872
-			else if(is_dir($moduleSkinPath.'xe_default'))
2080
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1873 2081
 			{
1874 2082
 				$skinName = 'xe_default';
1875
-			}
1876
-			else
2083
+			} else
1877 2084
 			{
1878 2085
 				$skins = FileHandler::readDir($moduleSkinPath);
1879 2086
 				if(count($skins) > 0)
1880 2087
 				{
1881 2088
 					$skinName = $skins[0];
1882
-				}
1883
-				else
2089
+				} else
1884 2090
 				{
1885 2091
 					$skinName = NULL;
1886 2092
 				}
@@ -1888,7 +2094,9 @@  discard block
 block discarded – undo
1888 2094
 
1889 2095
 			if($updateCache && $skinName)
1890 2096
 			{
1891
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2097
+				if(!isset($designInfo->module->{$module_name})) {
2098
+					$designInfo->module->{$module_name} = new stdClass();
2099
+				}
1892 2100
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1893 2101
 
1894 2102
 				$oAdminController = getAdminController('admin');
@@ -1904,23 +2112,28 @@  discard block
 block discarded – undo
1904 2112
 	 */
1905 2113
 	function syncSkinInfoToModuleInfo(&$module_info)
1906 2114
 	{
1907
-		if(!$module_info->module_srl) return;
2115
+		if(!$module_info->module_srl) {
2116
+			return;
2117
+		}
1908 2118
 
1909 2119
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1910 2120
 		if(Mobile::isFromMobilePhone())
1911 2121
 		{
1912 2122
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1913
-		}
1914
-		else
2123
+		} else
1915 2124
 		{
1916 2125
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1917 2126
 		}
1918 2127
 
1919
-		if(!$skin_vars) return;
2128
+		if(!$skin_vars) {
2129
+			return;
2130
+		}
1920 2131
 
1921 2132
 		foreach($skin_vars as $name => $val)
1922 2133
 		{
1923
-			if(isset($module_info->{$name})) continue;
2134
+			if(isset($module_info->{$name})) {
2135
+				continue;
2136
+			}
1924 2137
 			$module_info->{$name} = $val->value;
1925 2138
 		}
1926 2139
 	}
@@ -1946,7 +2159,9 @@  discard block
 block discarded – undo
1946 2159
 			$args = new stdClass();
1947 2160
 			$args->module_srl = $module_srl;
1948 2161
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1949
-			if(!$output->toBool() || !$output->data) return;
2162
+			if(!$output->toBool() || !$output->data) {
2163
+				return;
2164
+			}
1950 2165
 
1951 2166
 			$skin_vars = array();
1952 2167
 			foreach($output->data as $vars)
@@ -1954,7 +2169,9 @@  discard block
 block discarded – undo
1954 2169
 				$skin_vars[$vars->name] = $vars;
1955 2170
 			}
1956 2171
 
1957
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2172
+			if($oCacheHandler->isSupport()) {
2173
+				$oCacheHandler->put($cache_key, $skin_vars);
2174
+			}
1958 2175
 		}
1959 2176
 
1960 2177
 		return $skin_vars;
@@ -1966,7 +2183,9 @@  discard block
 block discarded – undo
1966 2183
 	 */
1967 2184
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1968 2185
 	{
1969
-		if(!$module_info->module_srl) return;
2186
+		if(!$module_info->module_srl) {
2187
+			return;
2188
+		}
1970 2189
 		$skin_vars = false;
1971 2190
 		// cache controll
1972 2191
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1981,17 +2200,25 @@  discard block
 block discarded – undo
1981 2200
 			$args = new stdClass;
1982 2201
 			$args->module_srl = $module_info->module_srl;
1983 2202
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1984
-			if(!$output->toBool()) return;
2203
+			if(!$output->toBool()) {
2204
+				return;
2205
+			}
1985 2206
 			$skin_vars = $output->data;
1986 2207
 
1987 2208
 			//insert in cache
1988
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2209
+			if($oCacheHandler->isSupport()) {
2210
+				$oCacheHandler->put($cache_key, $skin_vars);
2211
+			}
2212
+		}
2213
+		if(!$skin_vars) {
2214
+			return;
1989 2215
 		}
1990
-		if(!$skin_vars) return;
1991 2216
 
1992 2217
 		foreach($output->data as $val)
1993 2218
 		{
1994
-			if(isset($module_info->{$val->name})) continue;
2219
+			if(isset($module_info->{$val->name})) {
2220
+				continue;
2221
+			}
1995 2222
 			$module_info->{$val->name} = $val->value;
1996 2223
 		}
1997 2224
 	}
@@ -2013,10 +2240,12 @@  discard block
 block discarded – undo
2013 2240
 		$grant_info = $xml_info->grant;
2014 2241
 		if($member_info->member_srl)
2015 2242
 		{
2016
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2017
-			else $group_list = array();
2018
-		}
2019
-		else
2243
+			if(is_array($member_info->group_list)) {
2244
+				$group_list = array_keys($member_info->group_list);
2245
+			} else {
2246
+				$group_list = array();
2247
+			}
2248
+		} else
2020 2249
 		{
2021 2250
 			$group_list = array();
2022 2251
 		}
@@ -2030,8 +2259,7 @@  discard block
 block discarded – undo
2030 2259
 			}
2031 2260
 
2032 2261
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2033
-		}
2034
-		else
2262
+		} else
2035 2263
 		{
2036 2264
 			// If module_srl exists
2037 2265
 			// Get a type of granted permission
@@ -2044,7 +2272,9 @@  discard block
 block discarded – undo
2044 2272
 				$args->module_srl = $module_srl;
2045 2273
 				$args->member_srl = $member_info->member_srl;
2046 2274
 				$output = executeQuery('module.getModuleAdmin',$args);
2047
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2275
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2276
+					$grant->manager = true;
2277
+				}
2048 2278
 			}
2049 2279
 			// If not an administrator, get information from the DB and grant manager privilege.
2050 2280
 			if(!$grant->manager)
@@ -2054,8 +2284,7 @@  discard block
 block discarded – undo
2054 2284
 				if($module_info->module == 'planet')
2055 2285
 				{
2056 2286
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2057
-				}
2058
-				else
2287
+				} else
2059 2288
 				{
2060 2289
 					$args = new stdClass;
2061 2290
 					$args->module_srl = $module_srl;
@@ -2070,42 +2299,48 @@  discard block
 block discarded – undo
2070 2299
 					foreach($output->data as $val)
2071 2300
 					{
2072 2301
 						$grant_exists[$val->name] = true;
2073
-						if($granted[$val->name]) continue;
2302
+						if($granted[$val->name]) {
2303
+							continue;
2304
+						}
2074 2305
 						// Log-in member only
2075 2306
 						if($val->group_srl == -1)
2076 2307
 						{
2077 2308
 							$granted[$val->name] = true;
2078
-							if($member_info->member_srl) $grant->{$val->name} = true;
2309
+							if($member_info->member_srl) {
2310
+								$grant->{$val->name} = true;
2311
+							}
2079 2312
 							// Site-joined member only
2080
-						}
2081
-						elseif($val->group_srl == -2)
2313
+						} elseif($val->group_srl == -2)
2082 2314
 						{
2083 2315
 							$granted[$val->name] = true;
2084 2316
 							// Do not grant any permission for non-logged member
2085
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2317
+							if(!$member_info->member_srl) {
2318
+								$grant->{$val->name} = false;
2319
+							}
2086 2320
 							// Log-in member
2087 2321
 							else
2088 2322
 							{
2089 2323
 								$site_module_info = Context::get('site_module_info');
2090 2324
 								// Permission granted if no information of the currently connected site exists
2091
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2325
+								if(!$site_module_info->site_srl) {
2326
+									$grant->{$val->name} = true;
2327
+								}
2092 2328
 								// Permission is not granted if information of the currently connected site exists
2093
-								elseif(count($group_list)) $grant->{$val->name} = true;
2329
+								elseif(count($group_list)) {
2330
+									$grant->{$val->name} = true;
2331
+								}
2094 2332
 							}
2095 2333
 							// All of non-logged members
2096
-						}
2097
-						elseif($val->group_srl == -3)
2334
+						} elseif($val->group_srl == -3)
2098 2335
 						{
2099 2336
 							$granted[$val->name] = true;
2100 2337
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2101
-						}
2102
-						elseif($val->group_srl == 0)
2338
+						} elseif($val->group_srl == 0)
2103 2339
 						{
2104 2340
 							$granted[$val->name] = true;
2105 2341
 							$grant->{$val->name} = true;
2106 2342
 							// If a target is a group
2107
-						}
2108
-						else
2343
+						} else
2109 2344
 						{
2110 2345
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2111 2346
 							{
@@ -2116,30 +2351,43 @@  discard block
 block discarded – undo
2116 2351
 					}
2117 2352
 				}
2118 2353
 				// Separate processing for the virtual group access
2119
-				if(!$grant_exists['access']) $grant->access = true;
2354
+				if(!$grant_exists['access']) {
2355
+					$grant->access = true;
2356
+				}
2120 2357
 				if(count($grant_info))
2121 2358
 				{
2122 2359
 					foreach($grant_info as  $grant_name => $grant_item)
2123 2360
 					{
2124
-						if($grant_exists[$grant_name]) continue;
2361
+						if($grant_exists[$grant_name]) {
2362
+							continue;
2363
+						}
2125 2364
 						switch($grant_item->default)
2126 2365
 						{
2127 2366
 							case 'guest' :
2128 2367
 								$grant->{$grant_name} = true;
2129 2368
 								break;
2130 2369
 							case 'member' :
2131
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2132
-								else $grant->{$grant_name} = false;
2370
+								if($member_info->member_srl) {
2371
+									$grant->{$grant_name} = true;
2372
+								} else {
2373
+									$grant->{$grant_name} = false;
2374
+								}
2133 2375
 								break;
2134 2376
 							case 'site' :
2135 2377
 								$site_module_info = Context::get('site_module_info');
2136
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2137
-								else $grant->{$grant_name} = false;
2378
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2379
+									$grant->{$grant_name} = true;
2380
+								} else {
2381
+									$grant->{$grant_name} = false;
2382
+								}
2138 2383
 								break;
2139 2384
 							case 'manager' :
2140 2385
 							case 'root' :
2141
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2142
-								else $grant->{$grant_name} = false;
2386
+								if($member_info->is_admin == 'Y') {
2387
+									$grant->{$grant_name} = true;
2388
+								} else {
2389
+									$grant->{$grant_name} = false;
2390
+								}
2143 2391
 								break;
2144 2392
 						}
2145 2393
 					}
@@ -2215,16 +2463,22 @@  discard block
 block discarded – undo
2215 2463
 	function getFileBoxListHtml()
2216 2464
 	{
2217 2465
 		$logged_info = Context::get('logged_info');
2218
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2466
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2467
+			return new BaseObject(-1, 'msg_not_permitted');
2468
+		}
2219 2469
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2220 2470
 		$link_params = explode('&',$link['query']);
2221 2471
 		foreach ($link_params as $param)
2222 2472
 		{
2223 2473
 			$param = explode("=",$param);
2224
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2474
+			if($param[0] == 'selected_widget') {
2475
+				$selected_widget = $param[1];
2476
+			}
2225 2477
 		}
2226 2478
 		$oWidgetModel = getModel('widget');
2227
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2479
+		if($selected_widget) {
2480
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2481
+		}
2228 2482
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2229 2483
 
2230 2484
 		$oModuleModel = getModel('module');
@@ -2232,7 +2486,9 @@  discard block
 block discarded – undo
2232 2486
 		Context::set('filebox_list', $output->data);
2233 2487
 
2234 2488
 		$page = Context::get('page');
2235
-		if (!$page) $page = 1;
2489
+		if (!$page) {
2490
+			$page = 1;
2491
+		}
2236 2492
 		Context::set('page', $page);
2237 2493
 		Context::set('page_navigation', $output->page_navigation);
2238 2494
 
@@ -2262,25 +2518,28 @@  discard block
 block discarded – undo
2262 2518
 			$rulsetFile = str_replace('@', '', $ruleset);
2263 2519
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2264 2520
 			return FileHandler::getRealPath($xml_file);
2265
-		}
2266
-		else if (strpos($ruleset, '#') !== false)
2521
+		} else if (strpos($ruleset, '#') !== false)
2267 2522
 		{
2268 2523
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2269 2524
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2270
-			if(is_readable($xml_file))
2271
-				return FileHandler::getRealPath($xml_file);
2272
-			else{
2525
+			if(is_readable($xml_file)) {
2526
+							return FileHandler::getRealPath($xml_file);
2527
+			} else{
2273 2528
 				$ruleset = str_replace('#', '', $ruleset);
2274 2529
 			}
2275 2530
 
2276 2531
 		}
2277 2532
 		// Get a path of the requested module. Return if not exists.
2278 2533
 		$class_path = ModuleHandler::getModulePath($module);
2279
-		if(!$class_path) return;
2534
+		if(!$class_path) {
2535
+			return;
2536
+		}
2280 2537
 
2281 2538
 		// Check if module.xml exists in the path. Return if not exist
2282 2539
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2283
-		if(!file_exists($xml_file)) return;
2540
+		if(!file_exists($xml_file)) {
2541
+			return;
2542
+		}
2284 2543
 
2285 2544
 		return $xml_file;
2286 2545
 	}
@@ -2330,7 +2589,9 @@  discard block
 block discarded – undo
2330 2589
 	function getLangByLangcode()
2331 2590
 	{
2332 2591
 		$langCode = Context::get('langCode');
2333
-		if (!$langCode) return;
2592
+		if (!$langCode) {
2593
+			return;
2594
+		}
2334 2595
 
2335 2596
 		$oModuleController = getController('module');
2336 2597
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
modules/document/document.admin.view.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 		// check current location in admin menu
20 20
 		$oModuleModel = getModel('module');
21 21
 		$info = $oModuleModel->getModuleActionXml('document');
22
-		foreach($info->menu AS $key => $menu)
22
+		foreach ($info->menu AS $key => $menu)
23 23
 		{
24
-			if(in_array($this->act, $menu->acts))
24
+			if (in_array($this->act, $menu->acts))
25 25
 			{
26 26
 				Context::set('currentMenu', $key);
27 27
 				break;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 		// set a search option used in the template
68 68
 		$count_search_option = count($this->search_option);
69
-		for($i=0;$i<$count_search_option;$i++)
69
+		for ($i = 0; $i < $count_search_option; $i++)
70 70
 		{
71 71
 			$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
72 72
 		}
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 		$oModuleModel = getModel('module');
76 76
 		$module_list = array();
77 77
 		$mod_srls = array();
78
-		foreach($output->data as $oDocument)
78
+		foreach ($output->data as $oDocument)
79 79
 		{
80 80
 			$mod_srls[] = $oDocument->get('module_srl');
81 81
 		}
82 82
 		$mod_srls = array_unique($mod_srls);
83 83
 		// Module List
84 84
 		$mod_srls_count = count($mod_srls);
85
-		if($mod_srls_count)
85
+		if ($mod_srls_count)
86 86
 		{
87 87
 			$columnList = array('module_srl', 'mid', 'browser_title');
88 88
 			$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
89
-			if($module_output && is_array($module_output))
89
+			if ($module_output && is_array($module_output))
90 90
 			{
91
-				foreach($module_output as $module)
91
+				foreach ($module_output as $module)
92 92
 				{
93 93
 					$module_list[$module->module_srl] = $module;
94 94
 				}
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		Context::set('config', $config);
116 116
 
117 117
 		$oModuleModel = getModel('module');
118
-		$pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons');
119
-		$mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'm.icons');
118
+		$pcIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'icons');
119
+		$mobileIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'm.icons');
120 120
 
121 121
 		Context::set('pcIconSkinList', $pcIconSkinList);
122 122
 		Context::set('mobileIconSkinList', $mobileIconSkinList);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	function dispDocumentAdminDeclared()
134 134
 	{
135 135
 		// option for a list
136
-		$args =new stdClass();
136
+		$args = new stdClass();
137 137
 		$args->page = Context::get('page'); // /< Page
138 138
 		$args->list_count = 30; // /< the number of posts to display on a single page
139 139
 		$args->page_count = 10; // /< the number of pages that appear in the page navigation
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 
148 148
 		// get a list
149 149
 		$declared_output = executeQuery('document.getDeclaredList', $args);
150
-		if($declared_output->data && count($declared_output->data))
150
+		if ($declared_output->data && count($declared_output->data))
151 151
 		{
152 152
 			$document_list = array();
153 153
 
154
-			foreach($declared_output->data as $key => $document)
154
+			foreach ($declared_output->data as $key => $document)
155 155
 			{
156 156
 				$document_list[$key] = new documentItem();
157 157
 				$document_list[$key]->setAttribute($document);
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 	function dispDocumentAdminAlias()
179 179
 	{
180 180
 		$args->document_srl = Context::get('document_srl');
181
-		if(!$args->document_srl) return $this->dispDocumentAdminList();
181
+		if (!$args->document_srl) return $this->dispDocumentAdminList();
182 182
 
183 183
 		$oModel = getModel('document');
184 184
 		$oDocument = $oModel->getDocument($args->document_srl);
185
-		if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
185
+		if (!$oDocument->isExists()) return $this->dispDocumentAdminList();
186 186
 		Context::set('oDocument', $oDocument);
187 187
 
188 188
 		$output = executeQueryArray('document.getAliases', $args);
189
-		if(!$output->data)
189
+		if (!$output->data)
190 190
 		{
191 191
 			$aliases = array();
192 192
 		}
Please login to merge, or discard this patch.
modules/install/install.admin.controller.php 3 patches
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -294,6 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
 	/**
296 296
 	 * @brief Supported languages (was procInstallAdminSaveLangSelected)
297
+	 * @param string $selected_lang
297 298
 	 */
298 299
 	function saveLangSelected($selected_lang)
299 300
 	{
@@ -312,7 +313,7 @@  discard block
 block discarded – undo
312 313
 
313 314
 	/**
314 315
 	 * Change the way the thumbnails are show.
315
-	 * @param $config
316
+	 * @param stdClass $config
316 317
 	 * @return void
317 318
 	 */
318 319
 	function setModulesConfig($config)
@@ -337,6 +338,10 @@  discard block
 block discarded – undo
337 338
 		$oModuleController->updateModuleConfig('module',$args);
338 339
 	}
339 340
 
341
+	/**
342
+	 * @param string $icon
343
+	 * @param string $iconname
344
+	 */
340 345
 	private function saveIconTmp($icon, $iconname)
341 346
 	{
342 347
 
@@ -383,6 +388,9 @@  discard block
 block discarded – undo
383 388
 		return $relative_filename;
384 389
 	}
385 390
 
391
+	/**
392
+	 * @param string $iconname
393
+	 */
386 394
 	private function updateIcon($iconname, $deleteIcon = false) {
387 395
 
388 396
 		$site_info = Context::get('site_module_info');
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
23
+		if (!$module_name) return new BaseObject(-1, 'invalid_request');
24 24
 
25 25
 		$oInstallController = getController('install');
26 26
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		@set_time_limit(0);
37 37
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
38
+		if (!$module_name) return new BaseObject(-1, 'invalid_request');
39 39
 
40 40
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
41
+		if ($oModule) $output = $oModule->moduleUpdate();
42 42
 		else $output = new BaseObject(-1, 'invalid_request');
43 43
 
44 44
 		return $output;
@@ -53,51 +53,51 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$admin_ip_list = Context::get('admin_ip_list');
55 55
 
56
-		if($admin_ip_list)
56
+		if ($admin_ip_list)
57 57
 		{
58
-			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
59
-			$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list);
60
-			if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
58
+			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list);
59
+			$admin_ip_list = preg_replace("/\s+/", "", $admin_ip_list);
60
+			if (preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
61 61
 			{
62 62
 				$admin_ip_list = '';
63 63
 			}
64
-			$admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
65
-			$admin_ip_list = explode(',',trim($admin_ip_list, ','));
64
+			$admin_ip_list .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
65
+			$admin_ip_list = explode(',', trim($admin_ip_list, ','));
66 66
 			$admin_ip_list = array_unique($admin_ip_list);
67
-			if(!IpFilter::validate($admin_ip_list)) {
67
+			if (!IpFilter::validate($admin_ip_list)) {
68 68
 				return new BaseObject(-1, 'msg_invalid_ip');
69 69
 			}
70 70
 		}
71 71
 		
72 72
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
73
+		if ($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
+		if ($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
75 75
 
76 76
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
77
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
78 78
 		$IDN = new idna_convert(array('idn_version' => 2008));
79 79
 		$default_url = $IDN->encode($default_url);
80 80
 
81 81
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
82
+		if (!$use_ssl) $use_ssl = 'none';
83 83
 
84 84
 		$http_port = Context::get('http_port');
85 85
 		$https_port = Context::get('https_port');
86 86
 
87 87
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
88
+		if ($use_rewrite != 'Y') $use_rewrite = 'N';
89 89
 
90 90
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
91
+		if ($use_sso != 'Y') $use_sso = 'N';
92 92
 
93 93
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
94
+		if ($use_db_session != 'Y') $use_db_session = 'N';
95 95
 
96 96
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
97
+		if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N';
98 98
 
99 99
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
100
+		if (!$use_html5) $use_html5 = 'N';
101 101
 
102 102
 		$db_info->default_url = $default_url;
103 103
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 		$db_info->use_html5 = $use_html5;
109 109
 		$db_info->admin_ip_list = $admin_ip_list;
110 110
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
111
+		if ($http_port) $db_info->http_port = (int) $http_port;
112
+		else if ($db_info->http_port) unset($db_info->http_port);
113 113
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
114
+		if ($https_port) $db_info->https_port = (int) $https_port;
115
+		else if ($db_info->https_port) unset($db_info->https_port);
116 116
 
117 117
 		unset($db_info->lang_type);
118 118
 
119 119
 		$oInstallController = getController('install');
120
-		if(!$oInstallController->makeConfigFile())
120
+		if (!$oInstallController->makeConfigFile())
121 121
 		{
122 122
 			return new BaseObject(-1, 'msg_invalid_request');
123 123
 		}
124 124
 		else
125 125
 		{
126 126
 			Context::setDBInfo($db_info);
127
-			if($default_url)
127
+			if ($default_url)
128 128
 			{
129 129
 				$site_args = new stdClass;
130 130
 				$site_args->site_srl = 0;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 	function procInstallAdminUpdateIndexModule()
140 140
 	{
141
-		if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
141
+		if (!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
142 142
 		{
143 143
 			return new BaseObject(-1, 'msg_invalid_request');
144 144
 		}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		// update homeSitemap.php cache file
158 158
 		$oMenuAdminController = getAdminController('menu');
159 159
 		$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
160
-		if(file_exists($homeMenuCacheFile))
160
+		if (file_exists($homeMenuCacheFile))
161 161
 		{
162 162
 			include($homeMenuCacheFile);
163 163
 		}
164 164
 
165
-		if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
165
+		if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
166 166
 		{
167 167
 			$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
168 168
 		}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	function procInstallAdminRemoveFTPInfo()
174 174
 	{
175 175
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
176
+		if (file_exists($ftp_config_file)) unlink($ftp_config_file);
177
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
178 178
 		$this->setMessage('success_deleted');
179 179
 	}
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 186
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 187
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
188
+		if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
189 189
 		$ftp_info->sftp = Context::get('sftp');
190 190
 
191 191
 		$ftp_root_path = Context::get('ftp_root_path');
192
-		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
192
+		if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/")
193 193
 		{
194 194
 			$ftp_info->ftp_root_path = $ftp_root_path;
195 195
 		}
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 199
 		}
200 200
 
201
-		if(ini_get('safe_mode'))
201
+		if (ini_get('safe_mode'))
202 202
 		{
203 203
 			$ftp_info->ftp_password = Context::get('ftp_password');
204 204
 		}
205 205
 
206 206
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207
-		foreach($ftp_info as $key => $val)
207
+		foreach ($ftp_info as $key => $val)
208 208
 		{
209
-			if(!$val) continue;
210
-			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
209
+			if (!$val) continue;
210
+			if (preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 211
 			{
212 212
 				continue;
213 213
 			}
214
-			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
214
+			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
215 215
 		}
216 216
 		$buff .= "?>";
217 217
 		$config_file = Context::getFTPConfigFile();
218 218
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
219
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
220 220
 
221 221
 		$this->setMessage('success_updated');
222 222
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	function procInstallAdminConfig()
227 227
 	{
228 228
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
229
+		if ($use_mobile_view != 'Y') $use_mobile_view = 'N';
230 230
 
231 231
 		$time_zone = Context::get('time_zone');
232 232
 
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		unset($db_info->lang_type);
238 238
 		Context::setDBInfo($db_info);
239 239
 		$oInstallController = getController('install');
240
-		if(!$oInstallController->makeConfigFile())
240
+		if (!$oInstallController->makeConfigFile())
241 241
 		{
242 242
 			return new BaseObject(-1, 'msg_invalid_request');
243 243
 		}
244 244
 
245 245
 		$site_args = new stdClass();
246 246
 		$site_args->site_srl = 0;
247
-		$site_args->index_module_srl = Context::get('index_module_srl');//
248
-		$site_args->default_language = Context::get('change_lang_type');//
247
+		$site_args->index_module_srl = Context::get('index_module_srl'); //
248
+		$site_args->default_language = Context::get('change_lang_type'); //
249 249
 		$oModuleController = getController('module');
250 250
 		$oModuleController->updateSite($site_args);
251 251
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		$deleteFavicon = Context::get('is_delete_favicon');
258 258
 		$deleteMobicon = Context::get('is_delete_mobicon');
259 259
 
260
-		$this->updateIcon('favicon.ico',$deleteFavicon);
261
-		$this->updateIcon('mobicon.png',$deleteMobicon);
260
+		$this->updateIcon('favicon.ico', $deleteFavicon);
261
+		$this->updateIcon('mobicon.png', $deleteMobicon);
262 262
 
263 263
 		//모듈 설정 저장(썸네일, 풋터스크립트)
264 264
 		$config = new stdClass();
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 
277 277
 		$favicon = Context::get('favicon');
278 278
 		$mobicon = Context::get('mobicon');
279
-		if(!$favicon && !$mobicon) {
279
+		if (!$favicon && !$mobicon) {
280 280
 			Context::set('msg', Context::getLang("msg_invalid_format"));
281 281
 			return;
282 282
 		}
283
-		if($favicon) {
283
+		if ($favicon) {
284 284
 			$name = 'favicon';
285
-			$tmpFileName = $this->saveIconTmp($favicon,'favicon.ico');
285
+			$tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico');
286 286
 		} else {
287 287
 			$name = 'mobicon';
288
-			$tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png');
288
+			$tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png');
289 289
 		}
290 290
 
291 291
 		Context::set('name', $name);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 		$lang_supported = Context::loadLangSupported();
303 303
 		$buff = null;
304
-		for($i=0;$i<count($langs);$i++)
304
+		for ($i = 0; $i < count($langs); $i++)
305 305
 		{
306 306
 			$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
307 307
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 
331 331
 		$oModuleController = getController('module');
332
-		$oModuleController->insertModuleConfig('document',$documentConfig);
332
+		$oModuleController->insertModuleConfig('document', $documentConfig);
333 333
 
334 334
 		$args = new stdClass;
335 335
 		$args->htmlFooter = $config->htmlFooter;
336 336
 		$args->siteTitle = $config->siteTitle;
337
-		$oModuleController->updateModuleConfig('module',$args);
337
+		$oModuleController->updateModuleConfig('module', $args);
338 338
 	}
339 339
 
340 340
 	private function saveIconTmp($icon, $iconname)
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 
343 343
 		$site_info = Context::get('site_module_info');
344 344
 		$virtual_site = '';
345
-		if($site_info->site_srl) 
345
+		if ($site_info->site_srl) 
346 346
 		{
347
-			$virtual_site = $site_info->site_srl . '/';
347
+			$virtual_site = $site_info->site_srl.'/';
348 348
 		}
349 349
 
350 350
 		$target_file = $icon['tmp_name'];
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
 		$target_filename = _XE_PATH_.$relative_filename;
354 354
 
355 355
 		list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
356
-		if($iconname == 'favicon.ico')
356
+		if ($iconname == 'favicon.ico')
357 357
 		{
358
-			if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) {
358
+			if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) {
359 359
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 360
 				return;
361 361
 			}
362 362
 		}
363
-		else if($iconname == 'mobicon.png')
363
+		else if ($iconname == 'mobicon.png')
364 364
 		{
365
-			if(!preg_match('/^.*(png).*$/',$type)) {
365
+			if (!preg_match('/^.*(png).*$/', $type)) {
366 366
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
367 367
 				return;
368 368
 			}
369
-			if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
369
+			if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
370 370
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 371
 				return;
372 372
 			}
@@ -387,21 +387,21 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$site_info = Context::get('site_module_info');
389 389
 		$virtual_site = '';
390
-		if($site_info->site_srl) 
390
+		if ($site_info->site_srl) 
391 391
 		{
392
-			$virtual_site = $site_info->site_srl . '/';
392
+			$virtual_site = $site_info->site_srl.'/';
393 393
 		}
394 394
 
395
-		$image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site;
395
+		$image_filepath = _XE_PATH_.'files/attach/xeicon/'.$virtual_site;
396 396
 
397
-		if($deleteIcon) {
397
+		if ($deleteIcon) {
398 398
 			FileHandler::removeFile($image_filepath.$iconname);
399 399
 			return;
400 400
 		}
401 401
 
402 402
 		$tmpicon_filepath = $image_filepath.'tmp/'.$iconname;
403 403
 		$icon_filepath = $image_filepath.$iconname;
404
-		if(file_exists($tmpicon_filepath))
404
+		if (file_exists($tmpicon_filepath))
405 405
 		{
406 406
 			FileHandler::moveFile($tmpicon_filepath, $icon_filepath);
407 407
 		}
Please login to merge, or discard this patch.
Braces   +68 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
23
+		if(!$module_name) {
24
+			return new BaseObject(-1, 'invalid_request');
25
+		}
24 26
 
25 27
 		$oInstallController = getController('install');
26 28
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,11 +37,16 @@  discard block
 block discarded – undo
35 37
 	{
36 38
 		@set_time_limit(0);
37 39
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
40
+		if(!$module_name) {
41
+			return new BaseObject(-1, 'invalid_request');
42
+		}
39 43
 
40 44
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
42
-		else $output = new BaseObject(-1, 'invalid_request');
45
+		if($oModule) {
46
+			$output = $oModule->moduleUpdate();
47
+		} else {
48
+			$output = new BaseObject(-1, 'invalid_request');
49
+		}
43 50
 
44 51
 		return $output;
45 52
 	}
@@ -70,8 +77,12 @@  discard block
 block discarded – undo
70 77
 		}
71 78
 		
72 79
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
80
+		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) {
81
+			$default_url = 'http://'.$default_url;
82
+		}
83
+		if($default_url && substr($default_url, -1) !== '/') {
84
+			$default_url = $default_url.'/';
85
+		}
75 86
 
76 87
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77 88
 		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
@@ -79,25 +90,37 @@  discard block
 block discarded – undo
79 90
 		$default_url = $IDN->encode($default_url);
80 91
 
81 92
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
93
+		if(!$use_ssl) {
94
+			$use_ssl = 'none';
95
+		}
83 96
 
84 97
 		$http_port = Context::get('http_port');
85 98
 		$https_port = Context::get('https_port');
86 99
 
87 100
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
101
+		if($use_rewrite!='Y') {
102
+			$use_rewrite = 'N';
103
+		}
89 104
 
90 105
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
106
+		if($use_sso !='Y') {
107
+			$use_sso = 'N';
108
+		}
92 109
 
93 110
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
111
+		if($use_db_session!='Y') {
112
+			$use_db_session = 'N';
113
+		}
95 114
 
96 115
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
116
+		if($qmail_compatibility!='Y') {
117
+			$qmail_compatibility = 'N';
118
+		}
98 119
 
99 120
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
121
+		if(!$use_html5) {
122
+			$use_html5 = 'N';
123
+		}
101 124
 
102 125
 		$db_info->default_url = $default_url;
103 126
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,11 +131,17 @@  discard block
 block discarded – undo
108 131
 		$db_info->use_html5 = $use_html5;
109 132
 		$db_info->admin_ip_list = $admin_ip_list;
110 133
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
134
+		if($http_port) {
135
+			$db_info->http_port = (int) $http_port;
136
+		} else if($db_info->http_port) {
137
+			unset($db_info->http_port);
138
+		}
113 139
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
140
+		if($https_port) {
141
+			$db_info->https_port = (int) $https_port;
142
+		} else if($db_info->https_port) {
143
+			unset($db_info->https_port);
144
+		}
116 145
 
117 146
 		unset($db_info->lang_type);
118 147
 
@@ -120,8 +149,7 @@  discard block
 block discarded – undo
120 149
 		if(!$oInstallController->makeConfigFile())
121 150
 		{
122 151
 			return new BaseObject(-1, 'msg_invalid_request');
123
-		}
124
-		else
152
+		} else
125 153
 		{
126 154
 			Context::setDBInfo($db_info);
127 155
 			if($default_url)
@@ -173,8 +201,12 @@  discard block
 block discarded – undo
173 201
 	function procInstallAdminRemoveFTPInfo()
174 202
 	{
175 203
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
204
+		if(file_exists($ftp_config_file)) {
205
+			unlink($ftp_config_file);
206
+		}
207
+		if($_SESSION['ftp_password']) {
208
+			unset($_SESSION['ftp_password']);
209
+		}
178 210
 		$this->setMessage('success_deleted');
179 211
 	}
180 212
 
@@ -185,15 +217,16 @@  discard block
 block discarded – undo
185 217
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 218
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 219
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
220
+		if(!$ftp_info->ftp_pasv) {
221
+			$ftp_info->ftp_pasv = "N";
222
+		}
189 223
 		$ftp_info->sftp = Context::get('sftp');
190 224
 
191 225
 		$ftp_root_path = Context::get('ftp_root_path');
192 226
 		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
193 227
 		{
194 228
 			$ftp_info->ftp_root_path = $ftp_root_path;
195
-		}
196
-		else
229
+		} else
197 230
 		{
198 231
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 232
 		}
@@ -206,7 +239,9 @@  discard block
 block discarded – undo
206 239
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207 240
 		foreach($ftp_info as $key => $val)
208 241
 		{
209
-			if(!$val) continue;
242
+			if(!$val) {
243
+				continue;
244
+			}
210 245
 			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 246
 			{
212 247
 				continue;
@@ -216,7 +251,9 @@  discard block
 block discarded – undo
216 251
 		$buff .= "?>";
217 252
 		$config_file = Context::getFTPConfigFile();
218 253
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
254
+		if($_SESSION['ftp_password']) {
255
+			unset($_SESSION['ftp_password']);
256
+		}
220 257
 
221 258
 		$this->setMessage('success_updated');
222 259
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +263,9 @@  discard block
 block discarded – undo
226 263
 	function procInstallAdminConfig()
227 264
 	{
228 265
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
266
+		if($use_mobile_view!='Y') {
267
+			$use_mobile_view = 'N';
268
+		}
230 269
 
231 270
 		$time_zone = Context::get('time_zone');
232 271
 
@@ -322,8 +361,7 @@  discard block
 block discarded – undo
322 361
 		if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio')
323 362
 		{
324 363
 			$documentConfig->thumbnail_type = 'crop';
325
-		}
326
-		else
364
+		} else
327 365
 		{
328 366
 			$documentConfig->thumbnail_type = 'ratio';
329 367
 		}
@@ -359,8 +397,7 @@  discard block
 block discarded – undo
359 397
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 398
 				return;
361 399
 			}
362
-		}
363
-		else if($iconname == 'mobicon.png')
400
+		} else if($iconname == 'mobicon.png')
364 401
 		{
365 402
 			if(!preg_match('/^.*(png).*$/',$type)) {
366 403
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
@@ -370,8 +407,7 @@  discard block
 block discarded – undo
370 407
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 408
 				return;
372 409
 			}
373
-		}
374
-		else
410
+		} else
375 411
 		{
376 412
 			Context::set('msg', Context::getLang('msg_invalid_format'));
377 413
 			return;
Please login to merge, or discard this patch.