GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2172)
by
unknown
08:59 queued 01:21
created
classes/module/ModuleObject.class.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 * */
45 45
 	function setModulePath($path)
46 46
 	{
47
-		if(substr_compare($path, '/', -1) !== 0)
47
+		if (substr_compare($path, '/', -1) !== 0)
48 48
 		{
49
-			$path.='/';
49
+			$path .= '/';
50 50
 		}
51 51
 		$this->module_path = $path;
52 52
 	}
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	function setRedirectUrl($url = './', $output = NULL)
61 61
 	{
62 62
 		$ajaxRequestMethod = array_flip($this->ajaxRequestMethod);
63
-		if(!isset($ajaxRequestMethod[Context::getRequestMethod()]))
63
+		if (!isset($ajaxRequestMethod[Context::getRequestMethod()]))
64 64
 		{
65 65
 			$this->add('redirect_url', $url);
66 66
 		}
67 67
 
68
-		if($output !== NULL && is_object($output))
68
+		if ($output !== NULL && is_object($output))
69 69
 		{
70 70
 			return $output;
71 71
 		}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$type = $this->get('message_type');
112 112
 		$typeList = array('error' => 1, 'info' => 1, 'update' => 1);
113
-		if(!isset($typeList[$type]))
113
+		if (!isset($typeList[$type]))
114 114
 		{
115 115
 			$type = $this->getError() ? 'error' : 'info';
116 116
 		}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		$oModuleModel = getModel('module');
162 162
 		// permission settings. access, manager(== is_admin) are fixed and privilege name in XE
163 163
 		$module_srl = Context::get('module_srl');
164
-		if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl))
164
+		if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl))
165 165
 		{
166 166
 			$request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
167
-			if($request_module->module_srl == $module_srl)
167
+			if ($request_module->module_srl == $module_srl)
168 168
 			{
169 169
 				$grant = $oModuleModel->getGrant($request_module, $logged_info);
170 170
 			}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		{
174 174
 			$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
175 175
 			// have at least access grant
176
-			if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication'))
176
+			if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication'))
177 177
 			{
178 178
 				$grant->access = 1;
179 179
 			}
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
 		// display no permission if the current module doesn't have an access privilege
182 182
 		//if(!$grant->access) return $this->stop("msg_not_permitted");
183 183
 		// checks permission and action if you don't have an admin privilege
184
-		if(!$grant->manager)
184
+		if (!$grant->manager)
185 185
 		{
186 186
 			// get permission types(guest, member, manager, root) of the currently requested action
187 187
 			$permission_target = $xml_info->permission->{$this->act};
188 188
 			// check manager if a permission in module.xml otherwise action if no permission
189
-			if(!$permission_target && substr_count($this->act, 'Admin'))
189
+			if (!$permission_target && substr_count($this->act, 'Admin'))
190 190
 			{
191 191
 				$permission_target = 'manager';
192 192
 			}
193 193
 			// Check permissions
194
-			switch($permission_target)
194
+			switch ($permission_target)
195 195
 			{
196 196
 				case 'root' :
197 197
 				case 'manager' :
198 198
 					$this->stop('msg_is_not_administrator');
199 199
 					return;
200 200
 				case 'member' :
201
-					if(!$is_logged)
201
+					if (!$is_logged)
202 202
 					{
203 203
 						$this->stop('msg_not_permitted_act');
204 204
 						return;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
 		$this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl);
215 215
 
216
-		if(method_exists($this, 'init'))
216
+		if (method_exists($this, 'init'))
217 217
 		{
218 218
 			$this->init();
219 219
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * */
252 252
 	function setTemplateFile($filename)
253 253
 	{
254
-		if(isset($filename) && substr_compare($filename, '.html', -5) !== 0)
254
+		if (isset($filename) && substr_compare($filename, '.html', -5) !== 0)
255 255
 		{
256 256
 			$filename .= '.html';
257 257
 		}
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 	 * */
275 275
 	function setTemplatePath($path)
276 276
 	{
277
-		if(!$path) return;
277
+		if (!$path) return;
278 278
 
279
-		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
279
+		if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
280 280
 		{
281
-			$path = './' . $path;
281
+			$path = './'.$path;
282 282
 		}
283 283
 
284
-		if(substr_compare($path, '/', -1) !== 0)
284
+		if (substr_compare($path, '/', -1) !== 0)
285 285
 		{
286 286
 			$path .= '/';
287 287
 		}
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 * */
305 305
 	function setEditedLayoutFile($filename)
306 306
 	{
307
-		if(!$filename) return;
307
+		if (!$filename) return;
308 308
 
309
-		if(substr_compare($filename, '.html', -5) !== 0)
309
+		if (substr_compare($filename, '.html', -5) !== 0)
310 310
 		{
311 311
 			$filename .= '.html';
312 312
 		}
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 * */
330 330
 	function setLayoutFile($filename)
331 331
 	{
332
-		if(!$filename) return;
332
+		if (!$filename) return;
333 333
 
334
-		if(substr_compare($filename, '.html', -5) !== 0)
334
+		if (substr_compare($filename, '.html', -5) !== 0)
335 335
 		{
336 336
 			$filename .= '.html';
337 337
 		}
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
 	 * */
354 354
 	function setLayoutPath($path)
355 355
 	{
356
-		if(!$path) return;
356
+		if (!$path) return;
357 357
 
358
-		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
358
+		if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
359 359
 		{
360
-			$path = './' . $path;
360
+			$path = './'.$path;
361 361
 		}
362
-		if(substr_compare($path, '/', -1) !== 0)
362
+		if (substr_compare($path, '/', -1) !== 0)
363 363
 		{
364 364
 			$path .= '/';
365 365
 		}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	function proc()
383 383
 	{
384 384
 		// pass if stop_proc is true
385
-		if($this->stop_proc)
385
+		if ($this->stop_proc)
386 386
 		{
387 387
 			debugPrint($this->message, 'ERROR');
388 388
 			return FALSE;
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
 		// trigger call
392 392
 		$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this);
393
-		if(!$triggerOutput->toBool())
393
+		if (!$triggerOutput->toBool())
394 394
 		{
395 395
 			$this->setError($triggerOutput->getError());
396 396
 			$this->setMessage($triggerOutput->getMessage());
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
 		$called_position = 'before_module_proc';
402 402
 		$oAddonController = getController('addon');
403 403
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
404
-		if(FileHandler::exists($addon_file)) include($addon_file);
404
+		if (FileHandler::exists($addon_file)) include($addon_file);
405 405
 
406
-		if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
406
+		if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
407 407
 		{
408 408
 			// Check permissions
409
-			if($this->module_srl && !$this->grant->access)
409
+			if ($this->module_srl && !$this->grant->access)
410 410
 			{
411 411
 				$this->stop("msg_not_permitted_act");
412 412
 				return FALSE;
@@ -415,21 +415,21 @@  discard block
 block discarded – undo
415 415
 			// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
416 416
 			$is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N'));
417 417
 			$usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET'));
418
-			if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
418
+			if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
419 419
 			{
420 420
 				$dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins';
421 421
 				$valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin';
422 422
 				$oModuleModel = getModel('module');
423 423
 				$skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
424 424
 				$skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType);
425
-				if($this->module == 'page')
425
+				if ($this->module == 'page')
426 426
 				{
427 427
 					$this->module_info->{$valueName} = $skinName;
428 428
 				}
429 429
 				else
430 430
 				{
431 431
 					$isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE);
432
-					if(!$isTemplatPath)
432
+					if (!$isTemplatPath)
433 433
 					{
434 434
 						$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName));
435 435
 					}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		// trigger call
451 451
 		$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
452
-		if(!$triggerOutput->toBool())
452
+		if (!$triggerOutput->toBool())
453 453
 		{
454 454
 			$this->setError($triggerOutput->getError());
455 455
 			$this->setMessage($triggerOutput->getMessage());
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
 		$called_position = 'after_module_proc';
461 461
 		$oAddonController = getController('addon');
462 462
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
463
-		if(FileHandler::exists($addon_file)) include($addon_file);
463
+		if (FileHandler::exists($addon_file)) include($addon_file);
464 464
 
465
-		if(is_a($output, 'Object') || is_subclass_of($output, 'Object'))
465
+		if (is_a($output, 'Object') || is_subclass_of($output, 'Object'))
466 466
 		{
467 467
 			$this->setError($output->getError());
468 468
 			$this->setMessage($output->getMessage());
469 469
 
470
-			if(!$output->toBool())
470
+			if (!$output->toBool())
471 471
 			{
472 472
 				return FALSE;
473 473
 			}
474 474
 		}
475 475
 		// execute api methods of the module if view action is and result is XMLRPC or JSON
476
-		if($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
476
+		if ($this->module_info->module_type == 'view' || $this->module_info->module_type == 'mobile')
477 477
 		{
478
-			if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
478
+			if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
479 479
 			{
480 480
 				$oAPI = getAPI($this->module_info->module, 'api');
481
-				if(method_exists($oAPI, $this->act))
481
+				if (method_exists($oAPI, $this->act))
482 482
 				{
483 483
 					$oAPI->{$this->act}($this);
484 484
 				}
Please login to merge, or discard this patch.
classes/context/Context.class.php 1 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/document/document.item.php 2 patches
Spacing   +182 added lines, -182 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if (!$this->document_srl) return;
83 83
 
84 84
 		$document_item = false;
85 85
 		$cache_put = false;
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
 
89 89
 		// cache controll
90 90
 		$oCacheHandler = CacheHandler::getInstance('object');
91
-		if($oCacheHandler->isSupport())
91
+		if ($oCacheHandler->isSupport())
92 92
 		{
93
-			$cache_key = 'document_item:' . getNumberingPath($this->document_srl) . $this->document_srl;
93
+			$cache_key = 'document_item:'.getNumberingPath($this->document_srl).$this->document_srl;
94 94
 			$document_item = $oCacheHandler->get($cache_key);
95
-			if($document_item !== false)
95
+			if ($document_item !== false)
96 96
 			{
97 97
 				$columnList = array('readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count');
98 98
 			}
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 		$args->document_srl = $this->document_srl;
103 103
 		$output = executeQuery('document.getDocument', $args, $columnList);
104 104
 
105
-		if($document_item === false)
105
+		if ($document_item === false)
106 106
 		{
107 107
 			$document_item = $output->data;
108 108
 
109 109
 				//insert in cache
110
-			if($document_item && $oCacheHandler->isSupport())
110
+			if ($document_item && $oCacheHandler->isSupport())
111 111
 			{
112 112
 				$oCacheHandler->put($cache_key, $document_item);
113 113
 			}
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
 		$this->setAttribute($document_item, $load_extra_vars);
125 125
 	}
126 126
 
127
-	function setAttribute($attribute, $load_extra_vars=true)
127
+	function setAttribute($attribute, $load_extra_vars = true)
128 128
 	{
129
-		if(!$attribute->document_srl)
129
+		if (!$attribute->document_srl)
130 130
 		{
131 131
 			$this->document_srl = null;
132 132
 			return;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		$this->adds($attribute);
137 137
 
138 138
 		// Tags
139
-		if($this->get('tags'))
139
+		if ($this->get('tags'))
140 140
 		{
141 141
 			$tag_list = explode(',', $this->get('tags'));
142 142
 			$tag_list = array_map('trim', $tag_list);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		}
145 145
 
146 146
 		$oDocumentModel = getModel('document');
147
-		if($load_extra_vars)
147
+		if ($load_extra_vars)
148 148
 		{
149 149
 			$GLOBALS['XE_DOCUMENT_LIST'][$attribute->document_srl] = $this;
150 150
 			$oDocumentModel->setToAllDocumentExtraVars();
@@ -159,23 +159,23 @@  discard block
 block discarded – undo
159 159
 
160 160
 	function isGranted()
161 161
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
162
+		if ($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163 163
 
164
-		if($this->grant_cache !== null)
164
+		if ($this->grant_cache !== null)
165 165
 		{
166 166
 			return $this->grant_cache;
167 167
 		}
168 168
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
169
+		if (!Context::get('is_logged')) return $this->grant_cache = false;
170 170
 
171 171
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
172
+		if ($logged_info->is_admin == 'Y') return $this->grant_cache = true;
173 173
 
174 174
 		$oModuleModel = getModel('module');
175 175
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
176
+		if ($grant->manager) return $this->grant_cache = true;
177 177
 
178
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true;
178
+		if ($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl') * -1 == $logged_info->member_srl)) return $this->grant_cache = true;
179 179
 
180 180
 		return $this->grant_cache = false;
181 181
 	}
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 
189 189
 	function isAccessible()
190 190
 	{
191
-		return $_SESSION['accessible'][$this->document_srl]==true?true:false;
191
+		return $_SESSION['accessible'][$this->document_srl] == true ?true:false;
192 192
 	}
193 193
 
194 194
 	function allowComment()
195 195
 	{
196 196
 		// init write, document is not exists. so allow comment status is true
197
-		if(!$this->isExists()) return true;
197
+		if (!$this->isExists()) return true;
198 198
 
199 199
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
200 200
 	}
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 	function allowTrackback()
203 203
 	{
204 204
 		static $allow_trackback_status = null;
205
-		if(is_null($allow_trackback_status))
205
+		if (is_null($allow_trackback_status))
206 206
 		{
207 207
 			
208 208
 			// Check the tarckback module exist
209
-			if(!getClass('trackback'))
209
+			if (!getClass('trackback'))
210 210
 			{
211 211
 				$allow_trackback_status = false;
212 212
 			}
@@ -216,20 +216,20 @@  discard block
 block discarded – undo
216 216
 				$oModuleModel = getModel('module');
217 217
 				$trackback_config = $oModuleModel->getModuleConfig('trackback');
218 218
 				
219
-				if(!$trackback_config)
219
+				if (!$trackback_config)
220 220
 				{
221 221
 					$trackback_config = new stdClass();
222 222
 				}
223 223
 				
224
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
224
+				if (!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
+				if ($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
226 226
 				else
227 227
 				{
228 228
 					$module_srl = $this->get('module_srl');
229 229
 					// Check settings of each module
230 230
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
231
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
231
+					if ($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
+					else if ($this->get('allow_trackback') == 'Y' || !$this->isExists()) $allow_trackback_status = true;
233 233
 				}
234 234
 			}
235 235
 		}
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 
239 239
 	function isLocked()
240 240
 	{
241
-		if(!$this->isExists()) return false;
241
+		if (!$this->isExists()) return false;
242 242
 
243 243
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
244 244
 	}
245 245
 
246 246
 	function isEditable()
247 247
 	{
248
-		if($this->isGranted() || !$this->get('member_srl')) return true;
248
+		if ($this->isGranted() || !$this->get('member_srl')) return true;
249 249
 		return false;
250 250
 	}
251 251
 
@@ -262,13 +262,13 @@  discard block
 block discarded – undo
262 262
 
263 263
 	function useNotify()
264 264
 	{
265
-		return $this->get('notify_message')=='Y' ? true : false;
265
+		return $this->get('notify_message') == 'Y' ? true : false;
266 266
 	}
267 267
 
268 268
 	function doCart()
269 269
 	{
270
-		if(!$this->document_srl) return false;
271
-		if($this->isCarted()) $this->removeCart();
270
+		if (!$this->document_srl) return false;
271
+		if ($this->isCarted()) $this->removeCart();
272 272
 		else $this->addCart();
273 273
 	}
274 274
 
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
 	 */
296 296
 	function notify($type, $content)
297 297
 	{
298
-		if(!$this->document_srl) return;
298
+		if (!$this->document_srl) return;
299 299
 		// return if it is not useNotify
300
-		if(!$this->useNotify()) return;
300
+		if (!$this->useNotify()) return;
301 301
 		// Pass if an author is not a logged-in user
302
-		if(!$this->get('member_srl')) return;
302
+		if (!$this->get('member_srl')) return;
303 303
 		// Return if the currently logged-in user is an author
304 304
 		$logged_info = Context::get('logged_info');
305
-		if($logged_info->member_srl == $this->get('member_srl')) return;
305
+		if ($logged_info->member_srl == $this->get('member_srl')) return;
306 306
 		// List variables
307
-		if($type) $title = "[".$type."] ";
307
+		if ($type) $title = "[".$type."] ";
308 308
 		$title .= cut_str(strip_tags($content), 10, '...');
309
-		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
309
+		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>', $content, getFullUrl('', 'document_srl', $this->document_srl), getFullUrl('', 'document_srl', $this->document_srl));
310 310
 		$receiver_srl = $this->get('member_srl');
311 311
 		$sender_member_srl = $logged_info->member_srl;
312 312
 		// Send a message
@@ -321,26 +321,26 @@  discard block
 block discarded – undo
321 321
 
322 322
 	function getIpAddress()
323 323
 	{
324
-		if($this->isGranted())
324
+		if ($this->isGranted())
325 325
 		{
326 326
 			return $this->get('ipaddress');
327 327
 		}
328 328
 
329
-		return '*' . strstr($this->get('ipaddress'), '.');
329
+		return '*'.strstr($this->get('ipaddress'), '.');
330 330
 	}
331 331
 
332 332
 	function isExistsHomepage()
333 333
 	{
334
-		if(trim($this->get('homepage'))) return true;
334
+		if (trim($this->get('homepage'))) return true;
335 335
 		return false;
336 336
 	}
337 337
 
338 338
 	function getHomepageUrl()
339 339
 	{
340 340
 		$url = trim($this->get('homepage'));
341
-		if(!$url) return;
341
+		if (!$url) return;
342 342
 
343
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
343
+		if (strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://'.$url;
344 344
 
345 345
 		return $url;
346 346
 	}
@@ -370,52 +370,52 @@  discard block
 block discarded – undo
370 370
 		return htmlspecialchars($this->get('last_updater'), ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
371 371
 	}
372 372
 
373
-	function getTitleText($cut_size = 0, $tail='...')
373
+	function getTitleText($cut_size = 0, $tail = '...')
374 374
 	{
375
-		if(!$this->document_srl) return;
375
+		if (!$this->document_srl) return;
376 376
 
377
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
377
+		if ($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
378 378
 		else $title = $this->get('title');
379 379
 
380 380
 		return $title;
381 381
 	}
382 382
 
383
-	function getTitle($cut_size = 0, $tail='...')
383
+	function getTitle($cut_size = 0, $tail = '...')
384 384
 	{
385
-		if(!$this->document_srl) return;
385
+		if (!$this->document_srl) return;
386 386
 
387 387
 		$title = $this->getTitleText($cut_size, $tail);
388 388
 
389 389
 		$attrs = array();
390 390
 		$this->add('title_color', trim($this->get('title_color')));
391
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
392
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
391
+		if ($this->get('title_bold') == 'Y') $attrs[] = "font-weight:bold;";
392
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
393 393
 
394
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
394
+		if (count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
395 395
 		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
396 396
 	}
397 397
 
398 398
 	function getContentText($strlen = 0)
399 399
 	{
400
-		if(!$this->document_srl) return;
400
+		if (!$this->document_srl) return;
401 401
 
402
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
402
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
403 403
 
404 404
 		$result = $this->_checkAccessibleFromStatus();
405
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
405
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
406 406
 
407 407
 		$content = $this->get('content');
408 408
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
409 409
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
410 410
 
411
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
411
+		if ($strlen) return cut_str(strip_tags($content), $strlen, '...');
412 412
 
413 413
 		return htmlspecialchars($content);
414 414
 	}
415 415
 
416 416
 	function _addAllowScriptAccess($m)
417 417
 	{
418
-		if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
418
+		if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1)
419 419
 		{
420 420
 			$m[0] = $m[0].'<param name="allowscriptaccess" value="never"></param>';
421 421
 		}
@@ -425,26 +425,26 @@  discard block
 block discarded – undo
425 425
 
426 426
 	function _checkAllowScriptAccess($m)
427 427
 	{
428
-		if($m[1] == 'object')
428
+		if ($m[1] == 'object')
429 429
 		{
430 430
 			$this->allowscriptaccessList[] = 1;
431 431
 		}
432 432
 
433
-		if($m[1] == 'param')
433
+		if ($m[1] == 'param')
434 434
 		{
435
-			if(stripos($m[0], 'allowscriptaccess'))
435
+			if (stripos($m[0], 'allowscriptaccess'))
436 436
 			{
437 437
 				$m[0] = '<param name="allowscriptaccess" value="never"';
438
-				if(substr($m[0], -1) == '/')
438
+				if (substr($m[0], -1) == '/')
439 439
 				{
440 440
 					$m[0] .= '/';
441 441
 				}
442
-				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
442
+				$this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--;
443 443
 			}
444 444
 		}
445
-		else if($m[1] == 'embed')
445
+		else if ($m[1] == 'embed')
446 446
 		{
447
-			if(stripos($m[0], 'allowscriptaccess'))
447
+			if (stripos($m[0], 'allowscriptaccess'))
448 448
 			{
449 449
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
450 450
 			}
@@ -458,24 +458,24 @@  discard block
 block discarded – undo
458 458
 
459 459
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
460 460
 	{
461
-		if(!$this->document_srl) return;
461
+		if (!$this->document_srl) return;
462 462
 
463
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
463
+		if ($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
464 464
 
465 465
 		$result = $this->_checkAccessibleFromStatus();
466
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
466
+		if ($result) $_SESSION['accessible'][$this->document_srl] = true;
467 467
 
468 468
 		$content = $this->get('content');
469
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
469
+		if (!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
470 470
 
471 471
 		// Define a link if using a rewrite module
472 472
 		$oContext = &Context::getInstance();
473
-		if($oContext->allow_rewrite)
473
+		if ($oContext->allow_rewrite)
474 474
 		{
475
-			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
475
+			$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i', "<a href=\\2".Context::getRequestUri()."?", $content);
476 476
 		}
477 477
 		// To display a pop-up menu
478
-		if($add_popup_menu)
478
+		if ($add_popup_menu)
479 479
 		{
480 480
 			$content = sprintf(
481 481
 				'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@@ -484,10 +484,10 @@  discard block
 block discarded – undo
484 484
 			);
485 485
 		}
486 486
 		// If additional content information is set
487
-		if($add_content_info)
487
+		if ($add_content_info)
488 488
 		{
489 489
 			$memberSrl = $this->get('member_srl');
490
-			if($memberSrl < 0)
490
+			if ($memberSrl < 0)
491 491
 			{
492 492
 				$memberSrl = 0;
493 493
 			}
@@ -503,12 +503,12 @@  discard block
 block discarded – undo
503 503
 		}
504 504
 		else
505 505
 		{
506
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
506
+			if ($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
507 507
 		}
508 508
 		// Change the image path to a valid absolute path if resource_realpath is true
509
-		if($resource_realpath)
509
+		if ($resource_realpath)
510 510
 		{
511
-			$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
511
+			$content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content);
512 512
 		}
513 513
 
514 514
 		return $content;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		$content = trim(cut_str($content, $str_size, $tail));
558 558
 
559 559
 		// Replace back < , <, "
560
-		$content = str_replace(array('<', '>', '"'),array('&lt;', '&gt;', '&quot;'), $content);
560
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
561 561
 
562 562
 		return $content;
563 563
 	}
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 	function getRegdateTime()
571 571
 	{
572 572
 		$regdate = $this->get('regdate');
573
-		$year = substr($regdate,0,4);
574
-		$month = substr($regdate,4,2);
575
-		$day = substr($regdate,6,2);
576
-		$hour = substr($regdate,8,2);
577
-		$min = substr($regdate,10,2);
578
-		$sec = substr($regdate,12,2);
579
-		return mktime($hour,$min,$sec,$month,$day,$year);
573
+		$year = substr($regdate, 0, 4);
574
+		$month = substr($regdate, 4, 2);
575
+		$day = substr($regdate, 6, 2);
576
+		$hour = substr($regdate, 8, 2);
577
+		$min = substr($regdate, 10, 2);
578
+		$sec = substr($regdate, 12, 2);
579
+		return mktime($hour, $min, $sec, $month, $day, $year);
580 580
 	}
581 581
 
582 582
 	function getRegdateGM()
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
 	function getRegdateDT()
588 588
 	{
589
-		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
589
+		return $this->getRegdate('Y-m-d').'T'.$this->getRegdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
590 590
 	}
591 591
 
592 592
 	function getUpdate($format = 'Y.m.d H:i:s')
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
 
597 597
 	function getUpdateTime()
598 598
 	{
599
-		$year = substr($this->get('last_update'),0,4);
600
-		$month = substr($this->get('last_update'),4,2);
601
-		$day = substr($this->get('last_update'),6,2);
602
-		$hour = substr($this->get('last_update'),8,2);
603
-		$min = substr($this->get('last_update'),10,2);
604
-		$sec = substr($this->get('last_update'),12,2);
605
-		return mktime($hour,$min,$sec,$month,$day,$year);
599
+		$year = substr($this->get('last_update'), 0, 4);
600
+		$month = substr($this->get('last_update'), 4, 2);
601
+		$day = substr($this->get('last_update'), 6, 2);
602
+		$hour = substr($this->get('last_update'), 8, 2);
603
+		$min = substr($this->get('last_update'), 10, 2);
604
+		$sec = substr($this->get('last_update'), 12, 2);
605
+		return mktime($hour, $min, $sec, $month, $day, $year);
606 606
 	}
607 607
 
608 608
 	function getUpdateGM()
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
 
613 613
 	function getUpdateDT()
614 614
 	{
615
-		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'],0,3).':'.substr($GLOBALS['_time_zone'],3,2);
615
+		return $this->getUpdate('Y-m-d').'T'.$this->getUpdate('H:i:s').substr($GLOBALS['_time_zone'], 0, 3).':'.substr($GLOBALS['_time_zone'], 3, 2);
616 616
 	}
617 617
 
618 618
 	function getPermanentUrl()
619 619
 	{
620
-		return getFullUrl('','mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl'));
620
+		return getFullUrl('', 'mid', $this->getDocumentMid('document_srl'), 'document_srl', $this->get('document_srl'));
621 621
 	}
622 622
 
623 623
 	function getTrackbackUrl()
624 624
 	{
625
-		if(!$this->document_srl) return;
625
+		if (!$this->document_srl) return;
626 626
 
627 627
 		// Generate a key to prevent spams
628 628
 		$oTrackbackModel = getModel('trackback');
629
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
629
+		if ($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
630 630
 	}
631 631
 
632 632
 	/**
@@ -636,24 +636,24 @@  discard block
 block discarded – undo
636 636
 	function updateReadedCount()
637 637
 	{
638 638
 		$oDocumentController = getController('document');
639
-		if($oDocumentController->updateReadedCount($this))
639
+		if ($oDocumentController->updateReadedCount($this))
640 640
 		{
641 641
 			$readed_count = $this->get('readed_count');
642
-			$this->add('readed_count', $readed_count+1);
642
+			$this->add('readed_count', $readed_count + 1);
643 643
 		}
644 644
 	}
645 645
 
646 646
 	function isExtraVarsExists()
647 647
 	{
648
-		if(!$this->get('module_srl')) return false;
648
+		if (!$this->get('module_srl')) return false;
649 649
 		$oDocumentModel = getModel('document');
650 650
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
651
-		return count($extra_keys)?true:false;
651
+		return count($extra_keys) ?true:false;
652 652
 	}
653 653
 
654 654
 	function getExtraVars()
655 655
 	{
656
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
656
+		if (!$this->get('module_srl') || !$this->document_srl) return null;
657 657
 
658 658
 		$oDocumentModel = getModel('document');
659 659
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	function getExtraValue($idx)
663 663
 	{
664 664
 		$extra_vars = $this->getExtraVars();
665
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
665
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
666 666
 		{
667 667
 			return $extra_vars[$idx]->getValue();
668 668
 		}
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 	function getExtraValueHTML($idx)
676 676
 	{
677 677
 		$extra_vars = $this->getExtraVars();
678
-		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
678
+		if (is_array($extra_vars) && array_key_exists($idx, $extra_vars))
679 679
 		{
680 680
 			return $extra_vars[$idx]->getValueHTML();
681 681
 		}
@@ -689,16 +689,16 @@  discard block
 block discarded – undo
689 689
 	{
690 690
 		$extra_vars = $this->getExtraVars();
691 691
 
692
-		if($extra_vars)
692
+		if ($extra_vars)
693 693
 		{
694 694
 			// Handle extra variable(eid)
695
-			foreach($extra_vars as $idx => $key)
695
+			foreach ($extra_vars as $idx => $key)
696 696
 			{
697 697
 				$extra_eid[$key->eid] = $key;
698 698
 			}
699 699
 		}
700 700
 		
701
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
701
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
702 702
 		{
703 703
 			return $extra_eid[$eid]->getValue();
704 704
 		}
@@ -712,12 +712,12 @@  discard block
 block discarded – undo
712 712
 	{
713 713
 		$extra_vars = $this->getExtraVars();
714 714
 		// Handle extra variable(eid)
715
-		foreach($extra_vars as $idx => $key)
715
+		foreach ($extra_vars as $idx => $key)
716 716
 		{
717 717
 			$extra_eid[$key->eid] = $key;
718 718
 		}
719 719
 		
720
-		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
720
+		if (is_array($extra_eid) && array_key_exists($eid, $extra_eid))
721 721
 		{
722 722
 			return $extra_eid[$eid]->getValueHTML();
723 723
 		}
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
 
742 742
 	function getComments()
743 743
 	{
744
-		if(!$this->getCommentCount()) return;
745
-		if(!$this->isGranted() && $this->isSecret()) return;
744
+		if (!$this->getCommentCount()) return;
745
+		if (!$this->isGranted() && $this->isSecret()) return;
746 746
 		// cpage is a number of comment pages
747 747
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
748 748
 		$cpage = Context::get($cpageStr);
749 749
 
750
-		if(!$cpage)
750
+		if (!$cpage)
751 751
 		{
752 752
 			$cpage = Context::get('cpage');
753 753
 		}
@@ -755,19 +755,19 @@  discard block
 block discarded – undo
755 755
 		// Get a list of comments
756 756
 		$oCommentModel = getModel('comment');
757 757
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
758
-		if(!$output->toBool() || !count($output->data)) return;
758
+		if (!$output->toBool() || !count($output->data)) return;
759 759
 		// Create commentItem object from a comment list
760 760
 		// If admin priviledge is granted on parent posts, you can read its child posts.
761 761
 		$accessible = array();
762 762
 		$comment_list = array();
763
-		foreach($output->data as $key => $val)
763
+		foreach ($output->data as $key => $val)
764 764
 		{
765 765
 			$oCommentItem = new commentItem();
766 766
 			$oCommentItem->setAttribute($val);
767 767
 			// If permission is granted to the post, you can access it temporarily
768
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
768
+			if ($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
769 769
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
770
-			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
770
+			if ($val->parent_srl > 0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl] === true)
771 771
 			{
772 772
 				$oCommentItem->setAccessible();
773 773
 			}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 		// Variable setting to be displayed on the skin
777 777
 		Context::set($cpageStr, $output->page_navigation->cur_page);
778 778
 		Context::set('cpage', $output->page_navigation->cur_page);
779
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
779
+		if ($output->total_page > 1) $this->comment_page_navigation = $output->page_navigation;
780 780
 
781 781
 		return $comment_list;
782 782
 	}
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
 
789 789
 	function getTrackbacks()
790 790
 	{
791
-		if(!$this->document_srl) return;
791
+		if (!$this->document_srl) return;
792 792
 
793
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
793
+		if (!$this->allowTrackback() || !$this->get('trackback_count')) return;
794 794
 
795 795
 		$oTrackbackModel = getModel('trackback');
796 796
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -798,47 +798,47 @@  discard block
 block discarded – undo
798 798
 
799 799
 	function thumbnailExists($width = 80, $height = 0, $type = '')
800 800
 	{
801
-		if(!$this->document_srl) return false;
802
-		if(!$this->getThumbnail($width, $height, $type)) return false;
801
+		if (!$this->document_srl) return false;
802
+		if (!$this->getThumbnail($width, $height, $type)) return false;
803 803
 		return true;
804 804
 	}
805 805
 
806 806
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
807 807
 	{
808 808
 		// Return false if the document doesn't exist
809
-		if(!$this->document_srl) return;
809
+		if (!$this->document_srl) return;
810 810
 
811
-		if($this->isSecret() && !$this->isGranted())
811
+		if ($this->isSecret() && !$this->isGranted())
812 812
 		{
813 813
 			return;
814 814
 		}
815 815
 
816 816
 		// If not specify its height, create a square
817
-		if(!$height) $height = $width;
817
+		if (!$height) $height = $width;
818 818
 
819 819
 		// Return false if neither attachement nor image files in the document
820 820
 		$content = $this->get('content');
821
-		if(!$this->get('uploaded_count'))
821
+		if (!$this->get('uploaded_count'))
822 822
 		{
823
-			if(!$content)
823
+			if (!$content)
824 824
 			{
825 825
 				$args = new stdClass();
826 826
 				$args->document_srl = $this->document_srl;
827 827
 				$output = executeQuery('document.getDocument', $args, array('content'));
828
-				if($output->toBool() && $output->data)
828
+				if ($output->toBool() && $output->data)
829 829
 				{
830 830
 					$content = $output->data->content;
831 831
 					$this->add('content', $content);
832 832
 				}
833 833
 			}
834 834
 
835
-			if(!preg_match("!<img!is", $content)) return;
835
+			if (!preg_match("!<img!is", $content)) return;
836 836
 		}
837 837
 		// Get thumbnai_type information from document module's configuration
838
-		if(!in_array($thumbnail_type, array('crop','ratio')))
838
+		if (!in_array($thumbnail_type, array('crop', 'ratio')))
839 839
 		{
840 840
 			$config = $GLOBALS['__document_config__'];
841
-			if(!$config)
841
+			if (!$config)
842 842
 			{
843 843
 				$oDocumentModel = getModel('document');
844 844
 				$config = $oDocumentModel->getDocumentConfig();
@@ -848,15 +848,15 @@  discard block
 block discarded – undo
848 848
 		}
849 849
 
850 850
 		// Define thumbnail information
851
-		$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($this->document_srl, 3));
851
+		$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($this->document_srl, 3));
852 852
 		$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
853 853
 		$thumbnail_lockfile = sprintf('%s%dx%d.%s.lock', $thumbnail_path, $width, $height, $thumbnail_type);
854 854
 		$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
855 855
 
856 856
 		// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
857
-		if(file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
857
+		if (file_exists($thumbnail_file) || file_exists($thumbnail_lockfile))
858 858
 		{
859
-			if(filesize($thumbnail_file) < 1)
859
+			if (filesize($thumbnail_file) < 1)
860 860
 			{
861 861
 				return FALSE;
862 862
 			}
@@ -874,64 +874,64 @@  discard block
 block discarded – undo
874 874
 		$is_tmp_file = false;
875 875
 
876 876
 		// Find an iamge file among attached files if exists
877
-		if($this->hasUploadedFiles())
877
+		if ($this->hasUploadedFiles())
878 878
 		{
879 879
 			$file_list = $this->getUploadedFiles();
880 880
 
881 881
 			$first_image = null;
882
-			foreach($file_list as $file)
882
+			foreach ($file_list as $file)
883 883
 			{
884
-				if($file->direct_download !== 'Y') continue;
884
+				if ($file->direct_download !== 'Y') continue;
885 885
 
886
-				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
886
+				if ($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
887 887
 				{
888 888
 					$source_file = $file->uploaded_filename;
889 889
 					break;
890 890
 				}
891 891
 
892
-				if($first_image) continue;
892
+				if ($first_image) continue;
893 893
 
894
-				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
894
+				if (preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
895 895
 				{
896
-					if(file_exists($file->uploaded_filename))
896
+					if (file_exists($file->uploaded_filename))
897 897
 					{
898 898
 						$first_image = $file->uploaded_filename;
899 899
 					}
900 900
 				}
901 901
 			}
902 902
 
903
-			if(!$source_file && $first_image)
903
+			if (!$source_file && $first_image)
904 904
 			{
905 905
 				$source_file = $first_image;
906 906
 			}
907 907
 		}
908 908
 		// If not exists, file an image file from the content
909 909
 		$is_tmp_file = false;
910
-		if(!$source_file)
910
+		if (!$source_file)
911 911
 		{
912 912
 			$random = new Password();
913 913
 
914 914
 			preg_match_all("!<img[^>]*src=(?:\"|\')([^\"\']*?)(?:\"|\')!is", $content, $matches, PREG_SET_ORDER);
915 915
 
916
-			foreach($matches as $target_image)
916
+			foreach ($matches as $target_image)
917 917
 			{
918 918
 				$target_src = trim($target_image[1]);
919
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
919
+				if (preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
920 920
 
921
-				if(!preg_match('/^(http|https):\/\//i',$target_src))
921
+				if (!preg_match('/^(http|https):\/\//i', $target_src))
922 922
 				{
923 923
 					$target_src = Context::getRequestUri().$target_src;
924 924
 				}
925 925
 
926 926
 				$target_src = htmlspecialchars_decode($target_src);
927 927
 
928
-				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
928
+				$tmp_file = _XE_PATH_.'files/cache/tmp/'.$random->createSecureSalt(32, 'hex');
929 929
 				FileHandler::getRemoteFile($target_src, $tmp_file);
930
-				if(!file_exists($tmp_file)) continue;
930
+				if (!file_exists($tmp_file)) continue;
931 931
 
932 932
 				$imageinfo = getimagesize($tmp_file);
933 933
 				list($_w, $_h) = $imageinfo;
934
-				if($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
934
+				if ($imageinfo === false || ($_w < ($width * 0.3) && $_h < ($height * 0.3))) {
935 935
 					FileHandler::removeFile($tmp_file);
936 936
 					continue;
937 937
 				}
@@ -942,13 +942,13 @@  discard block
 block discarded – undo
942 942
 			}
943 943
 		}
944 944
 
945
-		if($source_file)
945
+		if ($source_file)
946 946
 		{
947 947
 			$output_file = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
948 948
 		}
949 949
 
950 950
 		// Remove source file if it was temporary
951
-		if($is_tmp_file)
951
+		if ($is_tmp_file)
952 952
 		{
953 953
 			FileHandler::removeFile($source_file);
954 954
 		}
@@ -957,14 +957,14 @@  discard block
 block discarded – undo
957 957
 		FileHandler::removeFile($thumbnail_lockfile);
958 958
 
959 959
 		// Return the thumbnail path if it was successfully generated
960
-		if($output_file)
960
+		if ($output_file)
961 961
 		{
962 962
 			return $thumbnail_url;
963 963
 		}
964 964
 		// Create an empty file if thumbnail generation failed
965 965
 		else
966 966
 		{
967
-			FileHandler::writeFile($thumbnail_file, '','w');
967
+			FileHandler::writeFile($thumbnail_file, '', 'w');
968 968
 		}
969 969
 
970 970
 		return;
@@ -978,21 +978,21 @@  discard block
 block discarded – undo
978 978
 	 */
979 979
 	function getExtraImages($time_interval = 43200)
980 980
 	{
981
-		if(!$this->document_srl) return;
981
+		if (!$this->document_srl) return;
982 982
 		// variables for icon list
983 983
 		$buffs = array();
984 984
 
985 985
 		$check_files = false;
986 986
 
987 987
 		// Check if secret post is
988
-		if($this->isSecret()) $buffs[] = "secret";
988
+		if ($this->isSecret()) $buffs[] = "secret";
989 989
 
990 990
 		// Set the latest time
991
-		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
991
+		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME'] - $time_interval);
992 992
 
993 993
 		// Check new post
994
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
995
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
994
+		if ($this->get('regdate') > $time_check) $buffs[] = "new";
995
+		else if ($this->get('last_update') > $time_check) $buffs[] = "update";
996 996
 
997 997
 		/*
998 998
 		   $content = $this->get('content');
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 		 */
1016 1016
 
1017 1017
 		// Check the attachment
1018
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1018
+		if ($this->hasUploadedFiles()) $buffs[] = "file";
1019 1019
 
1020 1020
 		return $buffs;
1021 1021
 	}
1022 1022
 
1023 1023
 	function getStatus()
1024 1024
 	{
1025
-		if(!$this->get('status')) return $this->getDefaultStatus();
1025
+		if (!$this->get('status')) return $this->getDefaultStatus();
1026 1026
 		return $this->get('status');
1027 1027
 	}
1028 1028
 
@@ -1033,11 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 	 */
1034 1034
 	function printExtraImages($time_check = 43200)
1035 1035
 	{
1036
-		if(!$this->document_srl) return;
1036
+		if (!$this->document_srl) return;
1037 1037
 
1038 1038
 		$oDocumentModel = getModel('document');
1039 1039
 		$documentConfig = $oDocumentModel->getDocumentConfig();
1040
-		if(Mobile::isFromMobilePhone())
1040
+		if (Mobile::isFromMobilePhone())
1041 1041
 		{
1042 1042
 			$iconSkin = $documentConfig->micons;
1043 1043
 		}
@@ -1045,13 +1045,13 @@  discard block
 block discarded – undo
1045 1045
 		{
1046 1046
 			$iconSkin = $documentConfig->icons;
1047 1047
 		}
1048
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1048
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1049 1049
 
1050 1050
 		$buffs = $this->getExtraImages($time_check);
1051
-		if(!count($buffs)) return;
1051
+		if (!count($buffs)) return;
1052 1052
 
1053 1053
 		$buff = array();
1054
-		foreach($buffs as $key => $val)
1054
+		foreach ($buffs as $key => $val)
1055 1055
 		{
1056 1056
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1057 1057
 		}
@@ -1060,20 +1060,20 @@  discard block
 block discarded – undo
1060 1060
 
1061 1061
 	function hasUploadedFiles()
1062 1062
 	{
1063
-		if(!$this->document_srl) return;
1063
+		if (!$this->document_srl) return;
1064 1064
 
1065
-		if($this->isSecret() && !$this->isGranted()) return false;
1066
-		return $this->get('uploaded_count')? true : false;
1065
+		if ($this->isSecret() && !$this->isGranted()) return false;
1066
+		return $this->get('uploaded_count') ? true : false;
1067 1067
 	}
1068 1068
 
1069 1069
 	function getUploadedFiles($sortIndex = 'file_srl')
1070 1070
 	{
1071
-		if(!$this->document_srl) return;
1071
+		if (!$this->document_srl) return;
1072 1072
 
1073
-		if($this->isSecret() && !$this->isGranted()) return;
1074
-		if(!$this->get('uploaded_count')) return;
1073
+		if ($this->isSecret() && !$this->isGranted()) return;
1074
+		if (!$this->get('uploaded_count')) return;
1075 1075
 
1076
-		if(!$this->uploadedFiles[$sortIndex])
1076
+		if (!$this->uploadedFiles[$sortIndex])
1077 1077
 		{
1078 1078
 			$oFileModel = getModel('file');
1079 1079
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 	function getEditor()
1090 1090
 	{
1091 1091
 		$module_srl = $this->get('module_srl');
1092
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1092
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1093 1093
 
1094 1094
 		$oEditorModel = getModel('editor');
1095 1095
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 	{
1105 1105
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1106 1106
 		if (!$this->allowComment()) return false;
1107
-		if(!$this->isGranted() && $this->isSecret()) return false;
1107
+		if (!$this->isGranted() && $this->isSecret()) return false;
1108 1108
 
1109 1109
 		return true;
1110 1110
 	}
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 */
1116 1116
 	function getCommentEditor()
1117 1117
 	{
1118
-		if(!$this->isEnableComment()) return;
1118
+		if (!$this->isEnableComment()) return;
1119 1119
 
1120 1120
 		$oEditorModel = getModel('editor');
1121 1121
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1127,10 +1127,10 @@  discard block
 block discarded – undo
1127 1127
 	 */
1128 1128
 	function getProfileImage()
1129 1129
 	{
1130
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1130
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1131 1131
 		$oMemberModel = getModel('member');
1132 1132
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1133
-		if(!$profile_info) return;
1133
+		if (!$profile_info) return;
1134 1134
 
1135 1135
 		return $profile_info->src;
1136 1136
 	}
@@ -1142,21 +1142,21 @@  discard block
 block discarded – undo
1142 1142
 	function getSignature()
1143 1143
 	{
1144 1144
 		// Pass if a document doesn't exist
1145
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1145
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1146 1146
 		// Get signature information
1147 1147
 		$oMemberModel = getModel('member');
1148 1148
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1149 1149
 		// Check if a maximum height of signiture is set in the member module
1150
-		if(!isset($GLOBALS['__member_signature_max_height']))
1150
+		if (!isset($GLOBALS['__member_signature_max_height']))
1151 1151
 		{
1152 1152
 			$oModuleModel = getModel('module');
1153 1153
 			$member_config = $oModuleModel->getModuleConfig('member');
1154 1154
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1155 1155
 		}
1156
-		if($signature)
1156
+		if ($signature)
1157 1157
 		{
1158 1158
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1159
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1159
+			if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1160 1160
 		}
1161 1161
 
1162 1162
 		return $signature;
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 	 */
1170 1170
 	function replaceResourceRealPath($matches)
1171 1171
 	{
1172
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1172
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1173 1173
 	}
1174 1174
 
1175 1175
 	/**
@@ -1180,19 +1180,19 @@  discard block
 block discarded – undo
1180 1180
 	function _checkAccessibleFromStatus()
1181 1181
 	{
1182 1182
 		$logged_info = Context::get('logged_info');
1183
-		if($logged_info->is_admin == 'Y') return true;
1183
+		if ($logged_info->is_admin == 'Y') return true;
1184 1184
 
1185 1185
 		$status = $this->get('status');
1186
-		if(empty($status)) return false;
1186
+		if (empty($status)) return false;
1187 1187
 
1188 1188
 		$oDocumentModel = getModel('document');
1189 1189
 		$configStatusList = $oDocumentModel->getStatusList();
1190 1190
 
1191
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1191
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1192 1192
 			return true;
1193
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1193
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1194 1194
 		{
1195
-			if($this->get('member_srl') == $logged_info->member_srl)
1195
+			if ($this->get('member_srl') == $logged_info->member_srl)
1196 1196
 				return true;
1197 1197
 		}
1198 1198
 		return false;
Please login to merge, or discard this patch.
Braces   +264 added lines, -112 removed lines patch added patch discarded remove patch
@@ -79,7 +79,9 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	function _loadFromDB($load_extra_vars = true)
81 81
 	{
82
-		if(!$this->document_srl) return;
82
+		if(!$this->document_srl) {
83
+			return;
84
+		}
83 85
 
84 86
 		$document_item = false;
85 87
 		$cache_put = false;
@@ -111,8 +113,7 @@  discard block
 block discarded – undo
111 113
 			{
112 114
 				$oCacheHandler->put($cache_key, $document_item);
113 115
 			}
114
-		}
115
-		else
116
+		} else
116 117
 		{
117 118
 			$document_item->readed_count = $output->data->readed_count;
118 119
 			$document_item->voted_count = $output->data->voted_count;
@@ -159,23 +160,33 @@  discard block
 block discarded – undo
159 160
 
160 161
 	function isGranted()
161 162
 	{
162
-		if($_SESSION['own_document'][$this->document_srl]) return $this->grant_cache = true;
163
+		if($_SESSION['own_document'][$this->document_srl]) {
164
+			return $this->grant_cache = true;
165
+		}
163 166
 
164 167
 		if($this->grant_cache !== null)
165 168
 		{
166 169
 			return $this->grant_cache;
167 170
 		}
168 171
 
169
-		if(!Context::get('is_logged')) return $this->grant_cache = false;
172
+		if(!Context::get('is_logged')) {
173
+			return $this->grant_cache = false;
174
+		}
170 175
 
171 176
 		$logged_info = Context::get('logged_info');
172
-		if($logged_info->is_admin == 'Y') return $this->grant_cache = true;
177
+		if($logged_info->is_admin == 'Y') {
178
+			return $this->grant_cache = true;
179
+		}
173 180
 
174 181
 		$oModuleModel = getModel('module');
175 182
 		$grant = $oModuleModel->getGrant($oModuleModel->getModuleInfoByModuleSrl($this->get('module_srl')), $logged_info);
176
-		if($grant->manager) return $this->grant_cache = true;
183
+		if($grant->manager) {
184
+			return $this->grant_cache = true;
185
+		}
177 186
 
178
-		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) return $this->grant_cache = true;
187
+		if($this->get('member_srl') && ($this->get('member_srl') == $logged_info->member_srl || $this->get('member_srl')*-1 == $logged_info->member_srl)) {
188
+			return $this->grant_cache = true;
189
+		}
179 190
 
180 191
 		return $this->grant_cache = false;
181 192
 	}
@@ -194,7 +205,9 @@  discard block
 block discarded – undo
194 205
 	function allowComment()
195 206
 	{
196 207
 		// init write, document is not exists. so allow comment status is true
197
-		if(!$this->isExists()) return true;
208
+		if(!$this->isExists()) {
209
+			return true;
210
+		}
198 211
 
199 212
 		return $this->get('comment_status') == 'ALLOW' ? true : false;
200 213
 	}
@@ -209,8 +222,7 @@  discard block
 block discarded – undo
209 222
 			if(!getClass('trackback'))
210 223
 			{
211 224
 				$allow_trackback_status = false;
212
-			}
213
-			else
225
+			} else
214 226
 			{
215 227
 				// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
216 228
 				$oModuleModel = getModel('module');
@@ -221,15 +233,21 @@  discard block
 block discarded – undo
221 233
 					$trackback_config = new stdClass();
222 234
 				}
223 235
 				
224
-				if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
225
-				if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
226
-				else
236
+				if(!isset($trackback_config->enable_trackback)) {
237
+					$trackback_config->enable_trackback = 'Y';
238
+				}
239
+				if($trackback_config->enable_trackback != 'Y') {
240
+					$allow_trackback_status = false;
241
+				} else
227 242
 				{
228 243
 					$module_srl = $this->get('module_srl');
229 244
 					// Check settings of each module
230 245
 					$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
231
-					if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
232
-					else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
246
+					if($module_config->enable_trackback == 'N') {
247
+						$allow_trackback_status = false;
248
+					} else if($this->get('allow_trackback')=='Y' || !$this->isExists()) {
249
+						$allow_trackback_status = true;
250
+					}
233 251
 				}
234 252
 			}
235 253
 		}
@@ -238,14 +256,18 @@  discard block
 block discarded – undo
238 256
 
239 257
 	function isLocked()
240 258
 	{
241
-		if(!$this->isExists()) return false;
259
+		if(!$this->isExists()) {
260
+			return false;
261
+		}
242 262
 
243 263
 		return $this->get('comment_status') == 'ALLOW' ? false : true;
244 264
 	}
245 265
 
246 266
 	function isEditable()
247 267
 	{
248
-		if($this->isGranted() || !$this->get('member_srl')) return true;
268
+		if($this->isGranted() || !$this->get('member_srl')) {
269
+			return true;
270
+		}
249 271
 		return false;
250 272
 	}
251 273
 
@@ -267,9 +289,14 @@  discard block
 block discarded – undo
267 289
 
268 290
 	function doCart()
269 291
 	{
270
-		if(!$this->document_srl) return false;
271
-		if($this->isCarted()) $this->removeCart();
272
-		else $this->addCart();
292
+		if(!$this->document_srl) {
293
+			return false;
294
+		}
295
+		if($this->isCarted()) {
296
+			$this->removeCart();
297
+		} else {
298
+			$this->addCart();
299
+		}
273 300
 	}
274 301
 
275 302
 	function addCart()
@@ -295,16 +322,26 @@  discard block
 block discarded – undo
295 322
 	 */
296 323
 	function notify($type, $content)
297 324
 	{
298
-		if(!$this->document_srl) return;
325
+		if(!$this->document_srl) {
326
+			return;
327
+		}
299 328
 		// return if it is not useNotify
300
-		if(!$this->useNotify()) return;
329
+		if(!$this->useNotify()) {
330
+			return;
331
+		}
301 332
 		// Pass if an author is not a logged-in user
302
-		if(!$this->get('member_srl')) return;
333
+		if(!$this->get('member_srl')) {
334
+			return;
335
+		}
303 336
 		// Return if the currently logged-in user is an author
304 337
 		$logged_info = Context::get('logged_info');
305
-		if($logged_info->member_srl == $this->get('member_srl')) return;
338
+		if($logged_info->member_srl == $this->get('member_srl')) {
339
+			return;
340
+		}
306 341
 		// List variables
307
-		if($type) $title = "[".$type."] ";
342
+		if($type) {
343
+			$title = "[".$type."] ";
344
+		}
308 345
 		$title .= cut_str(strip_tags($content), 10, '...');
309 346
 		$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
310 347
 		$receiver_srl = $this->get('member_srl');
@@ -331,16 +368,22 @@  discard block
 block discarded – undo
331 368
 
332 369
 	function isExistsHomepage()
333 370
 	{
334
-		if(trim($this->get('homepage'))) return true;
371
+		if(trim($this->get('homepage'))) {
372
+			return true;
373
+		}
335 374
 		return false;
336 375
 	}
337 376
 
338 377
 	function getHomepageUrl()
339 378
 	{
340 379
 		$url = trim($this->get('homepage'));
341
-		if(!$url) return;
380
+		if(!$url) {
381
+			return;
382
+		}
342 383
 
343
-		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0)  $url = 'http://' . $url;
384
+		if(strncasecmp('http://', $url, 7) !== 0 && strncasecmp('https://', $url, 8) !== 0) {
385
+			$url = 'http://' . $url;
386
+		}
344 387
 
345 388
 		return $url;
346 389
 	}
@@ -372,43 +415,65 @@  discard block
 block discarded – undo
372 415
 
373 416
 	function getTitleText($cut_size = 0, $tail='...')
374 417
 	{
375
-		if(!$this->document_srl) return;
418
+		if(!$this->document_srl) {
419
+			return;
420
+		}
376 421
 
377
-		if($cut_size) $title = cut_str($this->get('title'), $cut_size, $tail);
378
-		else $title = $this->get('title');
422
+		if($cut_size) {
423
+			$title = cut_str($this->get('title'), $cut_size, $tail);
424
+		} else {
425
+			$title = $this->get('title');
426
+		}
379 427
 
380 428
 		return $title;
381 429
 	}
382 430
 
383 431
 	function getTitle($cut_size = 0, $tail='...')
384 432
 	{
385
-		if(!$this->document_srl) return;
433
+		if(!$this->document_srl) {
434
+			return;
435
+		}
386 436
 
387 437
 		$title = $this->getTitleText($cut_size, $tail);
388 438
 
389 439
 		$attrs = array();
390 440
 		$this->add('title_color', trim($this->get('title_color')));
391
-		if($this->get('title_bold')=='Y') $attrs[] = "font-weight:bold;";
392
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = "color:#".$this->get('title_color');
441
+		if($this->get('title_bold')=='Y') {
442
+			$attrs[] = "font-weight:bold;";
443
+		}
444
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
445
+			$attrs[] = "color:#".$this->get('title_color');
446
+		}
393 447
 
394
-		if(count($attrs)) return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
395
-		else return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
448
+		if(count($attrs)) {
449
+			return sprintf("<span style=\"%s\">%s</span>", implode(';',$attrs), htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
450
+		} else {
451
+			return htmlspecialchars($title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
452
+		}
396 453
 	}
397 454
 
398 455
 	function getContentText($strlen = 0)
399 456
 	{
400
-		if(!$this->document_srl) return;
457
+		if(!$this->document_srl) {
458
+			return;
459
+		}
401 460
 
402
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
461
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
462
+			return Context::getLang('msg_is_secret');
463
+		}
403 464
 
404 465
 		$result = $this->_checkAccessibleFromStatus();
405
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
466
+		if($result) {
467
+			$_SESSION['accessible'][$this->document_srl] = true;
468
+		}
406 469
 
407 470
 		$content = $this->get('content');
408 471
 		$content = preg_replace_callback('/<(object|param|embed)[^>]*/is', array($this, '_checkAllowScriptAccess'), $content);
409 472
 		$content = preg_replace_callback('/<object[^>]*>/is', array($this, '_addAllowScriptAccess'), $content);
410 473
 
411
-		if($strlen) return cut_str(strip_tags($content),$strlen,'...');
474
+		if($strlen) {
475
+			return cut_str(strip_tags($content),$strlen,'...');
476
+		}
412 477
 
413 478
 		return htmlspecialchars($content);
414 479
 	}
@@ -441,14 +506,12 @@  discard block
 block discarded – undo
441 506
 				}
442 507
 				$this->allowscriptaccessList[count($this->allowscriptaccessList)-1]--;
443 508
 			}
444
-		}
445
-		else if($m[1] == 'embed')
509
+		} else if($m[1] == 'embed')
446 510
 		{
447 511
 			if(stripos($m[0], 'allowscriptaccess'))
448 512
 			{
449 513
 				$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
450
-			}
451
-			else
514
+			} else
452 515
 			{
453 516
 				$m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]);
454 517
 			}
@@ -458,15 +521,23 @@  discard block
 block discarded – undo
458 521
 
459 522
 	function getContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true, $stripEmbedTagException = false)
460 523
 	{
461
-		if(!$this->document_srl) return;
524
+		if(!$this->document_srl) {
525
+			return;
526
+		}
462 527
 
463
-		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
528
+		if($this->isSecret() && !$this->isGranted() && !$this->isAccessible()) {
529
+			return Context::getLang('msg_is_secret');
530
+		}
464 531
 
465 532
 		$result = $this->_checkAccessibleFromStatus();
466
-		if($result) $_SESSION['accessible'][$this->document_srl] = true;
533
+		if($result) {
534
+			$_SESSION['accessible'][$this->document_srl] = true;
535
+		}
467 536
 
468 537
 		$content = $this->get('content');
469
-		if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
538
+		if(!$stripEmbedTagException) {
539
+			stripEmbedTagForAdmin($content, $this->get('member_srl'));
540
+		}
470 541
 
471 542
 		// Define a link if using a rewrite module
472 543
 		$oContext = &Context::getInstance();
@@ -500,10 +571,11 @@  discard block
 block discarded – undo
500 571
 				$this->document_srl, $memberSrl
501 572
 			);
502 573
 			// Add xe_content class although accessing content is not required
503
-		}
504
-		else
574
+		} else
505 575
 		{
506
-			if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
576
+			if($add_xe_content_class) {
577
+				$content = sprintf('<div class="xe_content">%s</div>', $content);
578
+			}
507 579
 		}
508 580
 		// Change the image path to a valid absolute path if resource_realpath is true
509 581
 		if($resource_realpath)
@@ -622,11 +694,15 @@  discard block
 block discarded – undo
622 694
 
623 695
 	function getTrackbackUrl()
624 696
 	{
625
-		if(!$this->document_srl) return;
697
+		if(!$this->document_srl) {
698
+			return;
699
+		}
626 700
 
627 701
 		// Generate a key to prevent spams
628 702
 		$oTrackbackModel = getModel('trackback');
629
-		if($oTrackbackModel) return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
703
+		if($oTrackbackModel) {
704
+			return $oTrackbackModel->getTrackbackUrl($this->document_srl, $this->getDocumentMid());
705
+		}
630 706
 	}
631 707
 
632 708
 	/**
@@ -645,7 +721,9 @@  discard block
 block discarded – undo
645 721
 
646 722
 	function isExtraVarsExists()
647 723
 	{
648
-		if(!$this->get('module_srl')) return false;
724
+		if(!$this->get('module_srl')) {
725
+			return false;
726
+		}
649 727
 		$oDocumentModel = getModel('document');
650 728
 		$extra_keys = $oDocumentModel->getExtraKeys($this->get('module_srl'));
651 729
 		return count($extra_keys)?true:false;
@@ -653,7 +731,9 @@  discard block
 block discarded – undo
653 731
 
654 732
 	function getExtraVars()
655 733
 	{
656
-		if(!$this->get('module_srl') || !$this->document_srl) return null;
734
+		if(!$this->get('module_srl') || !$this->document_srl) {
735
+			return null;
736
+		}
657 737
 
658 738
 		$oDocumentModel = getModel('document');
659 739
 		return $oDocumentModel->getExtraVars($this->get('module_srl'), $this->document_srl);
@@ -665,8 +745,7 @@  discard block
 block discarded – undo
665 745
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
666 746
 		{
667 747
 			return $extra_vars[$idx]->getValue();
668
-		}
669
-		else
748
+		} else
670 749
 		{
671 750
 			return '';
672 751
 		}
@@ -678,8 +757,7 @@  discard block
 block discarded – undo
678 757
 		if(is_array($extra_vars) && array_key_exists($idx,$extra_vars))
679 758
 		{
680 759
 			return $extra_vars[$idx]->getValueHTML();
681
-		}
682
-		else
760
+		} else
683 761
 		{
684 762
 			return '';
685 763
 		}
@@ -701,8 +779,7 @@  discard block
 block discarded – undo
701 779
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
702 780
 		{
703 781
 			return $extra_eid[$eid]->getValue();
704
-		}
705
-		else
782
+		} else
706 783
 		{
707 784
 			return '';
708 785
 		}
@@ -720,8 +797,7 @@  discard block
 block discarded – undo
720 797
 		if(is_array($extra_eid) && array_key_exists($eid,$extra_eid))
721 798
 		{
722 799
 			return $extra_eid[$eid]->getValueHTML();
723
-		}
724
-		else
800
+		} else
725 801
 		{
726 802
 			return '';
727 803
 		}
@@ -741,8 +817,12 @@  discard block
 block discarded – undo
741 817
 
742 818
 	function getComments()
743 819
 	{
744
-		if(!$this->getCommentCount()) return;
745
-		if(!$this->isGranted() && $this->isSecret()) return;
820
+		if(!$this->getCommentCount()) {
821
+			return;
822
+		}
823
+		if(!$this->isGranted() && $this->isSecret()) {
824
+			return;
825
+		}
746 826
 		// cpage is a number of comment pages
747 827
 		$cpageStr = sprintf('%d_cpage', $this->document_srl);
748 828
 		$cpage = Context::get($cpageStr);
@@ -755,7 +835,9 @@  discard block
 block discarded – undo
755 835
 		// Get a list of comments
756 836
 		$oCommentModel = getModel('comment');
757 837
 		$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
758
-		if(!$output->toBool() || !count($output->data)) return;
838
+		if(!$output->toBool() || !count($output->data)) {
839
+			return;
840
+		}
759 841
 		// Create commentItem object from a comment list
760 842
 		// If admin priviledge is granted on parent posts, you can read its child posts.
761 843
 		$accessible = array();
@@ -765,7 +847,9 @@  discard block
 block discarded – undo
765 847
 			$oCommentItem = new commentItem();
766 848
 			$oCommentItem->setAttribute($val);
767 849
 			// If permission is granted to the post, you can access it temporarily
768
-			if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
850
+			if($oCommentItem->isGranted()) {
851
+				$accessible[$val->comment_srl] = true;
852
+			}
769 853
 			// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
770 854
 			if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true)
771 855
 			{
@@ -776,7 +860,9 @@  discard block
 block discarded – undo
776 860
 		// Variable setting to be displayed on the skin
777 861
 		Context::set($cpageStr, $output->page_navigation->cur_page);
778 862
 		Context::set('cpage', $output->page_navigation->cur_page);
779
-		if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
863
+		if($output->total_page>1) {
864
+			$this->comment_page_navigation = $output->page_navigation;
865
+		}
780 866
 
781 867
 		return $comment_list;
782 868
 	}
@@ -788,9 +874,13 @@  discard block
 block discarded – undo
788 874
 
789 875
 	function getTrackbacks()
790 876
 	{
791
-		if(!$this->document_srl) return;
877
+		if(!$this->document_srl) {
878
+			return;
879
+		}
792 880
 
793
-		if(!$this->allowTrackback() || !$this->get('trackback_count')) return;
881
+		if(!$this->allowTrackback() || !$this->get('trackback_count')) {
882
+			return;
883
+		}
794 884
 
795 885
 		$oTrackbackModel = getModel('trackback');
796 886
 		return $oTrackbackModel->getTrackbackList($this->document_srl, $is_admin);
@@ -798,15 +888,21 @@  discard block
 block discarded – undo
798 888
 
799 889
 	function thumbnailExists($width = 80, $height = 0, $type = '')
800 890
 	{
801
-		if(!$this->document_srl) return false;
802
-		if(!$this->getThumbnail($width, $height, $type)) return false;
891
+		if(!$this->document_srl) {
892
+			return false;
893
+		}
894
+		if(!$this->getThumbnail($width, $height, $type)) {
895
+			return false;
896
+		}
803 897
 		return true;
804 898
 	}
805 899
 
806 900
 	function getThumbnail($width = 80, $height = 0, $thumbnail_type = '')
807 901
 	{
808 902
 		// Return false if the document doesn't exist
809
-		if(!$this->document_srl) return;
903
+		if(!$this->document_srl) {
904
+			return;
905
+		}
810 906
 
811 907
 		if($this->isSecret() && !$this->isGranted())
812 908
 		{
@@ -814,7 +910,9 @@  discard block
 block discarded – undo
814 910
 		}
815 911
 
816 912
 		// If not specify its height, create a square
817
-		if(!$height) $height = $width;
913
+		if(!$height) {
914
+			$height = $width;
915
+		}
818 916
 
819 917
 		// Return false if neither attachement nor image files in the document
820 918
 		$content = $this->get('content');
@@ -832,7 +930,9 @@  discard block
 block discarded – undo
832 930
 				}
833 931
 			}
834 932
 
835
-			if(!preg_match("!<img!is", $content)) return;
933
+			if(!preg_match("!<img!is", $content)) {
934
+				return;
935
+			}
836 936
 		}
837 937
 		// Get thumbnai_type information from document module's configuration
838 938
 		if(!in_array($thumbnail_type, array('crop','ratio')))
@@ -859,8 +959,7 @@  discard block
 block discarded – undo
859 959
 			if(filesize($thumbnail_file) < 1)
860 960
 			{
861 961
 				return FALSE;
862
-			}
863
-			else
962
+			} else
864 963
 			{
865 964
 				return $thumbnail_url;
866 965
 			}
@@ -881,7 +980,9 @@  discard block
 block discarded – undo
881 980
 			$first_image = null;
882 981
 			foreach($file_list as $file)
883 982
 			{
884
-				if($file->direct_download !== 'Y') continue;
983
+				if($file->direct_download !== 'Y') {
984
+					continue;
985
+				}
885 986
 
886 987
 				if($file->cover_image === 'Y' && file_exists($file->uploaded_filename))
887 988
 				{
@@ -889,7 +990,9 @@  discard block
 block discarded – undo
889 990
 					break;
890 991
 				}
891 992
 
892
-				if($first_image) continue;
993
+				if($first_image) {
994
+					continue;
995
+				}
893 996
 
894 997
 				if(preg_match("/\.(jpe?g|png|gif|bmp)$/i", $file->source_filename))
895 998
 				{
@@ -916,7 +1019,9 @@  discard block
 block discarded – undo
916 1019
 			foreach($matches as $target_image)
917 1020
 			{
918 1021
 				$target_src = trim($target_image[1]);
919
-				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) continue;
1022
+				if(preg_match('/\/(common|modules|widgets|addons|layouts|m\.layouts)\//i', $target_src)) {
1023
+					continue;
1024
+				}
920 1025
 
921 1026
 				if(!preg_match('/^(http|https):\/\//i',$target_src))
922 1027
 				{
@@ -927,7 +1032,9 @@  discard block
 block discarded – undo
927 1032
 
928 1033
 				$tmp_file = _XE_PATH_ . 'files/cache/tmp/' . $random->createSecureSalt(32, 'hex');
929 1034
 				FileHandler::getRemoteFile($target_src, $tmp_file);
930
-				if(!file_exists($tmp_file)) continue;
1035
+				if(!file_exists($tmp_file)) {
1036
+					continue;
1037
+				}
931 1038
 
932 1039
 				$imageinfo = getimagesize($tmp_file);
933 1040
 				list($_w, $_h) = $imageinfo;
@@ -978,21 +1085,28 @@  discard block
 block discarded – undo
978 1085
 	 */
979 1086
 	function getExtraImages($time_interval = 43200)
980 1087
 	{
981
-		if(!$this->document_srl) return;
1088
+		if(!$this->document_srl) {
1089
+			return;
1090
+		}
982 1091
 		// variables for icon list
983 1092
 		$buffs = array();
984 1093
 
985 1094
 		$check_files = false;
986 1095
 
987 1096
 		// Check if secret post is
988
-		if($this->isSecret()) $buffs[] = "secret";
1097
+		if($this->isSecret()) {
1098
+			$buffs[] = "secret";
1099
+		}
989 1100
 
990 1101
 		// Set the latest time
991 1102
 		$time_check = date("YmdHis", $_SERVER['REQUEST_TIME']-$time_interval);
992 1103
 
993 1104
 		// Check new post
994
-		if($this->get('regdate')>$time_check) $buffs[] = "new";
995
-		else if($this->get('last_update')>$time_check) $buffs[] = "update";
1105
+		if($this->get('regdate')>$time_check) {
1106
+			$buffs[] = "new";
1107
+		} else if($this->get('last_update')>$time_check) {
1108
+			$buffs[] = "update";
1109
+		}
996 1110
 
997 1111
 		/*
998 1112
 		   $content = $this->get('content');
@@ -1015,14 +1129,18 @@  discard block
 block discarded – undo
1015 1129
 		 */
1016 1130
 
1017 1131
 		// Check the attachment
1018
-		if($this->hasUploadedFiles()) $buffs[] = "file";
1132
+		if($this->hasUploadedFiles()) {
1133
+			$buffs[] = "file";
1134
+		}
1019 1135
 
1020 1136
 		return $buffs;
1021 1137
 	}
1022 1138
 
1023 1139
 	function getStatus()
1024 1140
 	{
1025
-		if(!$this->get('status')) return $this->getDefaultStatus();
1141
+		if(!$this->get('status')) {
1142
+			return $this->getDefaultStatus();
1143
+		}
1026 1144
 		return $this->get('status');
1027 1145
 	}
1028 1146
 
@@ -1033,22 +1151,25 @@  discard block
 block discarded – undo
1033 1151
 	 */
1034 1152
 	function printExtraImages($time_check = 43200)
1035 1153
 	{
1036
-		if(!$this->document_srl) return;
1154
+		if(!$this->document_srl) {
1155
+			return;
1156
+		}
1037 1157
 
1038 1158
 		$oDocumentModel = getModel('document');
1039 1159
 		$documentConfig = $oDocumentModel->getDocumentConfig();
1040 1160
 		if(Mobile::isFromMobilePhone())
1041 1161
 		{
1042 1162
 			$iconSkin = $documentConfig->micons;
1043
-		}
1044
-		else
1163
+		} else
1045 1164
 		{
1046 1165
 			$iconSkin = $documentConfig->icons;
1047 1166
 		}
1048 1167
 		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1049 1168
 
1050 1169
 		$buffs = $this->getExtraImages($time_check);
1051
-		if(!count($buffs)) return;
1170
+		if(!count($buffs)) {
1171
+			return;
1172
+		}
1052 1173
 
1053 1174
 		$buff = array();
1054 1175
 		foreach($buffs as $key => $val)
@@ -1060,18 +1181,28 @@  discard block
 block discarded – undo
1060 1181
 
1061 1182
 	function hasUploadedFiles()
1062 1183
 	{
1063
-		if(!$this->document_srl) return;
1184
+		if(!$this->document_srl) {
1185
+			return;
1186
+		}
1064 1187
 
1065
-		if($this->isSecret() && !$this->isGranted()) return false;
1188
+		if($this->isSecret() && !$this->isGranted()) {
1189
+			return false;
1190
+		}
1066 1191
 		return $this->get('uploaded_count')? true : false;
1067 1192
 	}
1068 1193
 
1069 1194
 	function getUploadedFiles($sortIndex = 'file_srl')
1070 1195
 	{
1071
-		if(!$this->document_srl) return;
1196
+		if(!$this->document_srl) {
1197
+			return;
1198
+		}
1072 1199
 
1073
-		if($this->isSecret() && !$this->isGranted()) return;
1074
-		if(!$this->get('uploaded_count')) return;
1200
+		if($this->isSecret() && !$this->isGranted()) {
1201
+			return;
1202
+		}
1203
+		if(!$this->get('uploaded_count')) {
1204
+			return;
1205
+		}
1075 1206
 
1076 1207
 		if(!$this->uploadedFiles[$sortIndex])
1077 1208
 		{
@@ -1089,7 +1220,9 @@  discard block
 block discarded – undo
1089 1220
 	function getEditor()
1090 1221
 	{
1091 1222
 		$module_srl = $this->get('module_srl');
1092
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1223
+		if(!$module_srl) {
1224
+			$module_srl = Context::get('module_srl');
1225
+		}
1093 1226
 
1094 1227
 		$oEditorModel = getModel('editor');
1095 1228
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1103,8 +1236,12 @@  discard block
 block discarded – undo
1103 1236
 	function isEnableComment()
1104 1237
 	{
1105 1238
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1106
-		if (!$this->allowComment()) return false;
1107
-		if(!$this->isGranted() && $this->isSecret()) return false;
1239
+		if (!$this->allowComment()) {
1240
+			return false;
1241
+		}
1242
+		if(!$this->isGranted() && $this->isSecret()) {
1243
+			return false;
1244
+		}
1108 1245
 
1109 1246
 		return true;
1110 1247
 	}
@@ -1115,7 +1252,9 @@  discard block
 block discarded – undo
1115 1252
 	 */
1116 1253
 	function getCommentEditor()
1117 1254
 	{
1118
-		if(!$this->isEnableComment()) return;
1255
+		if(!$this->isEnableComment()) {
1256
+			return;
1257
+		}
1119 1258
 
1120 1259
 		$oEditorModel = getModel('editor');
1121 1260
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1127,10 +1266,14 @@  discard block
 block discarded – undo
1127 1266
 	 */
1128 1267
 	function getProfileImage()
1129 1268
 	{
1130
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1269
+		if(!$this->isExists() || !$this->get('member_srl')) {
1270
+			return;
1271
+		}
1131 1272
 		$oMemberModel = getModel('member');
1132 1273
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1133
-		if(!$profile_info) return;
1274
+		if(!$profile_info) {
1275
+			return;
1276
+		}
1134 1277
 
1135 1278
 		return $profile_info->src;
1136 1279
 	}
@@ -1142,7 +1285,9 @@  discard block
 block discarded – undo
1142 1285
 	function getSignature()
1143 1286
 	{
1144 1287
 		// Pass if a document doesn't exist
1145
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1288
+		if(!$this->isExists() || !$this->get('member_srl')) {
1289
+			return;
1290
+		}
1146 1291
 		// Get signature information
1147 1292
 		$oMemberModel = getModel('member');
1148 1293
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1156,7 +1301,9 @@  discard block
 block discarded – undo
1156 1301
 		if($signature)
1157 1302
 		{
1158 1303
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1159
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1304
+			if($max_signature_height) {
1305
+				$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);
1306
+			}
1160 1307
 		}
1161 1308
 
1162 1309
 		return $signature;
@@ -1180,20 +1327,25 @@  discard block
 block discarded – undo
1180 1327
 	function _checkAccessibleFromStatus()
1181 1328
 	{
1182 1329
 		$logged_info = Context::get('logged_info');
1183
-		if($logged_info->is_admin == 'Y') return true;
1330
+		if($logged_info->is_admin == 'Y') {
1331
+			return true;
1332
+		}
1184 1333
 
1185 1334
 		$status = $this->get('status');
1186
-		if(empty($status)) return false;
1335
+		if(empty($status)) {
1336
+			return false;
1337
+		}
1187 1338
 
1188 1339
 		$oDocumentModel = getModel('document');
1189 1340
 		$configStatusList = $oDocumentModel->getStatusList();
1190 1341
 
1191
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1192
-			return true;
1193
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1342
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1343
+					return true;
1344
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1194 1345
 		{
1195
-			if($this->get('member_srl') == $logged_info->member_srl)
1196
-				return true;
1346
+			if($this->get('member_srl') == $logged_info->member_srl) {
1347
+							return true;
1348
+			}
1197 1349
 		}
1198 1350
 		return false;
1199 1351
 	}
Please login to merge, or discard this patch.
modules/document/document.model.php 2 patches
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	function getDocumentExtraVarsFromDB($documentSrls)
39 39
 	{
40
-		if(!is_array($documentSrls) || count($documentSrls) == 0)
40
+		if (!is_array($documentSrls) || count($documentSrls) == 0)
41 41
 		{
42 42
 			return new Object(-1, 'msg_invalid_request');
43 43
 		}
@@ -58,52 +58,52 @@  discard block
 block discarded – undo
58 58
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
59 59
 
60 60
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
61
-		if(count($_document_list) <= 0) return;
61
+		if (count($_document_list) <= 0) return;
62 62
 
63 63
 		// Find all called the document object variable has been set extension
64 64
 		$document_srls = array();
65
-		foreach($_document_list as $key => $val)
65
+		foreach ($_document_list as $key => $val)
66 66
 		{
67
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
67
+			if (!$val->document_srl || $checked_documents[$val->document_srl]) continue;
68 68
 			$checked_documents[$val->document_srl] = true;
69 69
 			$document_srls[] = $val->document_srl;
70 70
 		}
71 71
 		// If the document number, return detected
72
-		if(!count($document_srls)) return;
72
+		if (!count($document_srls)) return;
73 73
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
74 74
 		//$obj->document_srl = implode(',',$document_srls);
75 75
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
76
-		if($output->toBool() && $output->data)
76
+		if ($output->toBool() && $output->data)
77 77
 		{
78
-			foreach($output->data as $key => $val)
78
+			foreach ($output->data as $key => $val)
79 79
 			{
80
-				if(!isset($val->value)) continue;
81
-				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
80
+				if (!isset($val->value)) continue;
81
+				if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
82 82
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
83 83
 			}
84 84
 		}
85 85
 
86 86
 		$user_lang_code = Context::getLangType();
87
-		for($i=0,$c=count($document_srls);$i<$c;$i++)
87
+		for ($i = 0, $c = count($document_srls); $i < $c; $i++)
88 88
 		{
89 89
 			$document_srl = $document_srls[$i];
90 90
 			unset($vars);
91 91
 
92
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
92
+			if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
93 93
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
94 94
 			$extra_keys = $this->getExtraKeys($module_srl);
95 95
 			$vars = $extra_vars[$document_srl];
96 96
 			$document_lang_code = $_document_list[$document_srl]->get('lang_code');
97 97
 			// Expand the variable processing
98
-			if(count($extra_keys))
98
+			if (count($extra_keys))
99 99
 			{
100
-				foreach($extra_keys as $idx => $key)
100
+				foreach ($extra_keys as $idx => $key)
101 101
 				{
102 102
 					$extra_keys[$idx] = clone($key);
103 103
 					$val = $vars[$idx];
104
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106
-					else if(isset($val[0])) $v = $val[0];
104
+					if (isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105
+					else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106
+					else if (isset($val[0])) $v = $val[0];
107 107
 					else $v = null;
108 108
 					$extra_keys[$idx]->value = $v;
109 109
 				}
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 			$evars = new ExtraVar($module_srl);
114 114
 			$evars->setExtraVarKeys($extra_keys);
115 115
 			// Title Processing
116
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
116
+			if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]);
117 117
 			// Information processing
118
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
118
+			if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]);
119 119
 
120
-			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
120
+			if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
121 121
 			{
122 122
 				unset($checked_documents[$document_srl]);
123 123
 			}
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 	 * @param array $columnList
135 135
 	 * @return documentItem
136 136
 	 */
137
-	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
137
+	function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
138 138
 	{
139
-		if(!$document_srl) return new documentItem();
139
+		if (!$document_srl) return new documentItem();
140 140
 
141
-		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
141
+		if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
142 142
 		{
143 143
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
144 144
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
145
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
145
+			if ($load_extra_vars) $this->setToAllDocumentExtraVars();
146 146
 		}
147
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
147
+		if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
148 148
 
149 149
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
150 150
 	}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 	 * @param array $columnList
158 158
 	 * @return array value type is documentItem
159 159
 	 */
160
-	function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
160
+	function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
161 161
 	{
162
-		if(is_array($document_srls))
162
+		if (is_array($document_srls))
163 163
 		{
164 164
 			$list_count = count($document_srls);
165
-			$document_srls = implode(',',$document_srls);
165
+			$document_srls = implode(',', $document_srls);
166 166
 		}
167 167
 		else
168 168
 		{
@@ -175,33 +175,33 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$output = executeQuery('document.getDocuments', $args, $columnList);
177 177
 		$document_list = $output->data;
178
-		if(!$document_list) return;
179
-		if(!is_array($document_list)) $document_list = array($document_list);
178
+		if (!$document_list) return;
179
+		if (!is_array($document_list)) $document_list = array($document_list);
180 180
 
181 181
 		$document_count = count($document_list);
182
-		foreach($document_list as $key => $attribute)
182
+		foreach ($document_list as $key => $attribute)
183 183
 		{
184 184
 			$document_srl = $attribute->document_srl;
185
-			if(!$document_srl) continue;
185
+			if (!$document_srl) continue;
186 186
 
187
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
187
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
188 188
 			{
189 189
 				$oDocument = null;
190 190
 				$oDocument = new documentItem();
191 191
 				$oDocument->setAttribute($attribute, false);
192
-				if($is_admin) $oDocument->setGrant();
192
+				if ($is_admin) $oDocument->setGrant();
193 193
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
194 194
 			}
195 195
 
196 196
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
197 197
 		}
198 198
 
199
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
199
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
200 200
 
201 201
 		$output = null;
202
-		if(count($result))
202
+		if (count($result))
203 203
 		{
204
-			foreach($result as $document_srl => $val)
204
+			foreach ($result as $document_srl => $val)
205 205
 			{
206 206
 				$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
207 207
 			}
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @param array $columnList
219 219
 	 * @return Object
220 220
 	 */
221
-	function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
221
+	function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
222 222
 	{
223 223
 		$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
224 224
 		$obj->sort_index = $sort_check->sort_index;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 		// Call trigger (before)
229 229
 		// This trigger can be used to set an alternative output using a different search method
230 230
 		$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
231
-		if($output instanceof Object && !$output->toBool())
231
+		if ($output instanceof Object && !$output->toBool())
232 232
 		{
233 233
 			return $output;
234 234
 		}
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 			$output = $obj->use_alternate_output;
246 246
 			unset($obj->use_alternate_output);
247 247
 		}
248
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
248
+		elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars'))
249 249
 		{
250 250
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
251
-			$args->sort_index = str_replace('documents.','',$args->sort_index);
251
+			$args->sort_index = str_replace('documents.', '', $args->sort_index);
252 252
 			$output = executeQueryArray($query_id, $args);
253 253
 		}
254 254
 		elseif ($sort_check->isExtraVars)
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
 			// document.getDocumentList query execution
261 261
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
262 262
 			$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
263
-			if(isset($groupByQuery[$query_id]))
263
+			if (isset($groupByQuery[$query_id]))
264 264
 			{
265 265
 				$group_args = clone($args);
266 266
 				$group_args->sort_index = 'documents.'.$args->sort_index;
267 267
 				$output = executeQueryArray($query_id, $group_args);
268
-				if(!$output->toBool()||!count($output->data)) return $output;
268
+				if (!$output->toBool() || !count($output->data)) return $output;
269 269
 
270
-				foreach($output->data as $key => $val)
270
+				foreach ($output->data as $key => $val)
271 271
 				{
272
-					if($val->document_srl) $target_srls[] = $val->document_srl;
272
+					if ($val->document_srl) $target_srls[] = $val->document_srl;
273 273
 				}
274 274
 
275 275
 				$page_navigation = $output->page_navigation;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 				$virtual_number = $keys[0];
278 278
 
279 279
 				$target_args = new stdClass();
280
-				$target_args->document_srls = implode(',',$target_srls);
280
+				$target_args->document_srls = implode(',', $target_srls);
281 281
 				$target_args->list_order = $args->sort_index;
282 282
 				$target_args->order_type = $args->order_type;
283 283
 				$target_args->list_count = $args->list_count;
@@ -294,35 +294,35 @@  discard block
 block discarded – undo
294 294
 			}
295 295
 		}
296 296
 		// Return if no result or an error occurs
297
-		if(!$output->toBool()||!count($output->data)) return $output;
297
+		if (!$output->toBool() || !count($output->data)) return $output;
298 298
 		$idx = 0;
299 299
 		$data = $output->data;
300 300
 		unset($output->data);
301 301
 
302
-		if(!isset($virtual_number))
302
+		if (!isset($virtual_number))
303 303
 		{
304 304
 			$keys = array_keys($data);
305 305
 			$virtual_number = $keys[0];
306 306
 		}
307 307
 
308
-		if($except_notice)
308
+		if ($except_notice)
309 309
 		{
310
-			foreach($data as $key => $attribute)
310
+			foreach ($data as $key => $attribute)
311 311
 			{
312
-				if($attribute->is_notice == 'Y') $virtual_number --;
312
+				if ($attribute->is_notice == 'Y') $virtual_number--;
313 313
 			}
314 314
 		}
315 315
 
316
-		foreach($data as $key => $attribute)
316
+		foreach ($data as $key => $attribute)
317 317
 		{
318
-			if($except_notice && $attribute->is_notice == 'Y') continue;
318
+			if ($except_notice && $attribute->is_notice == 'Y') continue;
319 319
 			$document_srl = $attribute->document_srl;
320
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
320
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
321 321
 			{
322 322
 				$oDocument = null;
323 323
 				$oDocument = new documentItem();
324 324
 				$oDocument->setAttribute($attribute, false);
325
-				if($is_admin) $oDocument->setGrant();
325
+				if ($is_admin) $oDocument->setGrant();
326 326
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
327 327
 			}
328 328
 
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 			$virtual_number--;
331 331
 		}
332 332
 
333
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
333
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
334 334
 
335
-		if(count($output->data))
335
+		if (count($output->data))
336 336
 		{
337
-			foreach($output->data as $number => $document)
337
+			foreach ($output->data as $number => $document)
338 338
 			{
339 339
 				$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
340 340
 			}
@@ -356,16 +356,16 @@  discard block
 block discarded – undo
356 356
 	{
357 357
 		$args = new stdClass();
358 358
 		$args->module_srl = $obj->module_srl;
359
-		$args->category_srl= $obj->category_srl;
359
+		$args->category_srl = $obj->category_srl;
360 360
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
361
-		if(!$output->toBool()||!$output->data) return;
361
+		if (!$output->toBool() || !$output->data) return;
362 362
 
363
-		foreach($output->data as $key => $val)
363
+		foreach ($output->data as $key => $val)
364 364
 		{
365 365
 			$document_srl = $val->document_srl;
366
-			if(!$document_srl) continue;
366
+			if (!$document_srl) continue;
367 367
 
368
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
368
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
369 369
 			{
370 370
 				$oDocument = null;
371 371
 				$oDocument = new documentItem();
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 		$this->setToAllDocumentExtraVars();
378 378
 
379
-		foreach($result->data as $document_srl => $val)
379
+		foreach ($result->data as $document_srl => $val)
380 380
 		{
381 381
 			$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
382 382
 		}
@@ -392,20 +392,20 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	function getExtraKeys($module_srl)
394 394
 	{
395
-		if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
395
+		if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
396 396
 		{
397 397
 			$keys = false;
398 398
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
399
-			if($oCacheHandler->isSupport())
399
+			if ($oCacheHandler->isSupport())
400 400
 			{
401
-				$object_key = 'module_document_extra_keys:' . $module_srl;
401
+				$object_key = 'module_document_extra_keys:'.$module_srl;
402 402
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
403 403
 				$keys = $oCacheHandler->get($cache_key);
404 404
 			}
405 405
 
406 406
 			$oExtraVar = ExtraVar::getInstance($module_srl);
407 407
 
408
-			if($keys === false)
408
+			if ($keys === false)
409 409
 			{
410 410
 				$obj = new stdClass();
411 411
 				$obj->module_srl = $module_srl;
@@ -415,13 +415,13 @@  discard block
 block discarded – undo
415 415
 
416 416
 				// correcting index order
417 417
 				$isFixed = FALSE;
418
-				if(is_array($output->data))
418
+				if (is_array($output->data))
419 419
 				{
420 420
 					$prevIdx = 0;
421
-					foreach($output->data as $no => $value)
421
+					foreach ($output->data as $no => $value)
422 422
 					{
423 423
 						// case first
424
-						if($prevIdx == 0 && $value->idx != 1)
424
+						if ($prevIdx == 0 && $value->idx != 1)
425 425
 						{
426 426
 							$args = new stdClass();
427 427
 							$args->module_srl = $module_srl;
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 						}
436 436
 
437 437
 						// case others
438
-						if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
438
+						if ($prevIdx > 0 && $prevIdx + 1 != $value->idx)
439 439
 						{
440 440
 							$args = new stdClass();
441 441
 							$args->module_srl = $module_srl;
@@ -452,16 +452,16 @@  discard block
 block discarded – undo
452 452
 					}
453 453
 				}
454 454
 
455
-				if($isFixed)
455
+				if ($isFixed)
456 456
 				{
457 457
 					$output = executeQueryArray('document.getDocumentExtraKeys', $obj);
458 458
 				}
459 459
 
460 460
 				$oExtraVar->setExtraVarKeys($output->data);
461 461
 				$keys = $oExtraVar->getExtraVars();
462
-				if(!$keys) $keys = array();
462
+				if (!$keys) $keys = array();
463 463
 
464
-				if($oCacheHandler->isSupport())
464
+				if ($oCacheHandler->isSupport())
465 465
 				{
466 466
 					$oCacheHandler->put($cache_key, $keys);
467 467
 				}
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	function getExtraVars($module_srl, $document_srl)
484 484
 	{
485
-		if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
485
+		if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
486 486
 		{
487 487
 			// Extended to extract the values of variables set
488 488
 			$oDocument = $this->getDocument($document_srl, false);
489 489
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
490 490
 			$this->setToAllDocumentExtraVars();
491 491
 		}
492
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
492
+		if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
493 493
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
494 494
 	}
495 495
 
@@ -512,71 +512,71 @@  discard block
 block discarded – undo
512 512
 
513 513
 		$oDocumentController = getController('document');
514 514
 		// Members must be a possible feature
515
-		if($logged_info->member_srl)
515
+		if ($logged_info->member_srl)
516 516
 		{
517 517
 			$oDocumentModel = getModel('document');
518 518
 			$columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
519 519
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
520 520
 			$module_srl = $oDocument->get('module_srl');
521 521
 			$member_srl = $oDocument->get('member_srl');
522
-			if(!$module_srl) return new Object(-1, 'msg_invalid_request');
522
+			if (!$module_srl) return new Object(-1, 'msg_invalid_request');
523 523
 
524 524
 			$oModuleModel = getModel('module');
525
-			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
526
-			if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
525
+			$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
526
+			if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
527 527
 			{
528 528
 				// Add a Referral Button
529 529
 				$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
530
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
530
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript');
531 531
 			}
532 532
 
533
-			if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
533
+			if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
534 534
 			{
535 535
 				// Add button to negative
536
-				$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
537
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
536
+				$url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
537
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
538 538
 			}
539 539
 
540 540
 			// Adding Report
541 541
 			$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
542
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
542
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript');
543 543
 
544 544
 			// Add Bookmark button
545 545
 			$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
546
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
546
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript');
547 547
 		}
548 548
 		// Add print button
549
-		$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
550
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
549
+		$url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl);
550
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument');
551 551
 		// Call a trigger (after)
552 552
 		ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
553
-		if($this->grant->manager)
553
+		if ($this->grant->manager)
554 554
 		{
555 555
 			$str_confirm = Context::getLang('confirm_move');
556 556
 			$url = sprintf("if(!confirm('%s')) return; var params = new Array(); params['document_srl']='%s'; params['mid']=current_mid;params['cur_url']=current_url; exec_xml('document', 'procDocumentAdminMoveToTrash', params)", $str_confirm, $document_srl);
557
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
557
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript');
558 558
 		}
559 559
 
560 560
 		// If you are managing to find posts by ip
561
-		if($logged_info->is_admin == 'Y')
561
+		if ($logged_info->is_admin == 'Y')
562 562
 		{
563 563
 			$oDocumentModel = getModel('document');
564
-			$oDocument = $oDocumentModel->getDocument($document_srl);	//before setting document recycle
564
+			$oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
565 565
 
566
-			if($oDocument->isExists())
566
+			if ($oDocument->isExists())
567 567
 			{
568 568
 				// Find a post equivalent to ip address
569
-				$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
570
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
569
+				$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress());
570
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
571 571
 
572 572
 				$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
573
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
573
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
574 574
 			}
575 575
 		}
576 576
 		// Changing the language of pop-up menu
577 577
 		$menus = Context::get('document_popup_menu_list');
578 578
 		$menus_count = count($menus);
579
-		for($i=0;$i<$menus_count;$i++)
579
+		for ($i = 0; $i < $menus_count; $i++)
580 580
 		{
581 581
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
582 582
 		}
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	function getDocumentCount($module_srl, $search_obj = NULL)
594 594
 	{
595
-		if(is_null($search_obj)) $search_obj = new stdClass();
595
+		if (is_null($search_obj)) $search_obj = new stdClass();
596 596
 		$search_obj->module_srl = $module_srl;
597 597
 
598 598
 		$output = executeQuery('document.getDocumentCount', $search_obj);
599 599
 		// Return total number of
600 600
 		$total_count = $output->data->count;
601
-		return (int)$total_count;
601
+		return (int) $total_count;
602 602
 	}
603 603
 
604 604
 	/**
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	function getDocumentCountByGroupStatus($search_obj = NULL)
610 610
 	{
611 611
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
612
-		if(!$output->toBool()) return array();
612
+		if (!$output->toBool()) return array();
613 613
 
614 614
 		return $output->data;
615 615
 	}
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 		$output = executeQuery('document.getDocumentExtraVarsCount', $args);
629 629
 		// Return total number of
630 630
 		$total_count = $output->data->count;
631
-		return (int)$total_count;
631
+		return (int) $total_count;
632 632
 	}
633 633
 
634 634
 	/**
@@ -645,29 +645,29 @@  discard block
 block discarded – undo
645 645
 
646 646
 		$this->_setSearchOption($opt, $args, $query_id, $use_division);
647 647
 
648
-		if($sort_check->isExtraVars)
648
+		if ($sort_check->isExtraVars)
649 649
 		{
650 650
 			return 1;
651 651
 		}
652 652
 		else
653 653
 		{
654
-			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
654
+			if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
655 655
 			{
656
-				if($args->order_type === 'desc')
656
+				if ($args->order_type === 'desc')
657 657
 				{
658
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
658
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
659 659
 				}
660 660
 				else
661 661
 				{
662 662
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
663 663
 				}
664 664
 			}
665
-			elseif($sort_check->sort_index === 'regdate')
665
+			elseif ($sort_check->sort_index === 'regdate')
666 666
 			{
667 667
 
668
-				if($args->order_type === 'asc')
668
+				if ($args->order_type === 'asc')
669 669
 				{
670
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
670
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
671 671
 				}
672 672
 				else
673 673
 				{
@@ -682,9 +682,9 @@  discard block
 block discarded – undo
682 682
 		}
683 683
 
684 684
 		// Guhanhu total number of the article search page
685
-		$output = executeQuery($query_id . 'Page', $args);
685
+		$output = executeQuery($query_id.'Page', $args);
686 686
 		$count = $output->data->count;
687
-		$page = (int)(($count-1)/$opt->list_count)+1;
687
+		$page = (int) (($count - 1) / $opt->list_count) + 1;
688 688
 		return $page;
689 689
 	}
690 690
 
@@ -696,16 +696,16 @@  discard block
 block discarded – undo
696 696
 	 */
697 697
 	function getCategory($category_srl, $columnList = array())
698 698
 	{
699
-		$args =new stdClass();
699
+		$args = new stdClass();
700 700
 		$args->category_srl = $category_srl;
701 701
 		$output = executeQuery('document.getCategory', $args, $columnList);
702 702
 
703 703
 		$node = $output->data;
704
-		if(!$node) return;
704
+		if (!$node) return;
705 705
 
706
-		if($node->group_srls)
706
+		if ($node->group_srls)
707 707
 		{
708
-			$group_srls = explode(',',$node->group_srls);
708
+			$group_srls = explode(',', $node->group_srls);
709 709
 			unset($node->group_srls);
710 710
 			$node->group_srls = $group_srls;
711 711
 		}
@@ -726,8 +726,8 @@  discard block
 block discarded – undo
726 726
 	{
727 727
 		$args = new stdClass();
728 728
 		$args->category_srl = $category_srl;
729
-		$output = executeQuery('document.getChildCategoryCount',$args);
730
-		if($output->data->count > 0) return true;
729
+		$output = executeQuery('document.getChildCategoryCount', $args);
730
+		if ($output->data->count > 0) return true;
731 731
 		return false;
732 732
 	}
733 733
 
@@ -743,10 +743,10 @@  discard block
 block discarded – undo
743 743
 		// Category of the target module file swollen
744 744
 		$filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
745 745
 		// If the target file to the cache file regeneration category
746
-		if(!file_exists($filename))
746
+		if (!file_exists($filename))
747 747
 		{
748 748
 			$oDocumentController = getController('document');
749
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
749
+			if (!$oDocumentController->makeCategoryFile($module_srl)) return array();
750 750
 		}
751 751
 
752 752
 		include($filename);
@@ -766,10 +766,10 @@  discard block
 block discarded – undo
766 766
 	 */
767 767
 	function _arrangeCategory(&$document_category, $list, $depth)
768 768
 	{
769
-		if(!count($list)) return;
769
+		if (!count($list)) return;
770 770
 		$idx = 0;
771 771
 		$list_order = array();
772
-		foreach($list as $key => $val)
772
+		foreach ($list as $key => $val)
773 773
 		{
774 774
 			$obj = new stdClass;
775 775
 			$obj->mid = $val['mid'];
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 			$obj->parent_srl = $val['parent_srl'];
779 779
 			$obj->title = $obj->text = $val['text'];
780 780
 			$obj->description = $val['description'];
781
-			$obj->expand = $val['expand']=='Y'?true:false;
781
+			$obj->expand = $val['expand'] == 'Y' ?true:false;
782 782
 			$obj->color = $val['color'];
783 783
 			$obj->document_count = $val['document_count'];
784 784
 			$obj->depth = $depth;
@@ -786,26 +786,26 @@  discard block
 block discarded – undo
786 786
 			$obj->childs = array();
787 787
 			$obj->grant = $val['grant'];
788 788
 
789
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
789
+			if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
790 790
 			else $selected = false;
791 791
 
792 792
 			$obj->selected = $selected;
793 793
 
794 794
 			$list_order[$idx++] = $obj->category_srl;
795 795
 			// If you have a parent category of child nodes apply data
796
-			if($obj->parent_srl)
796
+			if ($obj->parent_srl)
797 797
 			{
798 798
 				$parent_srl = $obj->parent_srl;
799 799
 				$document_count = $obj->document_count;
800 800
 				$expand = $obj->expand;
801
-				if($selected) $expand = true;
801
+				if ($selected) $expand = true;
802 802
 
803
-				while($parent_srl)
803
+				while ($parent_srl)
804 804
 				{
805 805
 					$document_category[$parent_srl]->document_count += $document_count;
806 806
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
807 807
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
808
-					if($expand) $document_category[$parent_srl]->expand = $expand;
808
+					if ($expand) $document_category[$parent_srl]->expand = $expand;
809 809
 
810 810
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
811 811
 				}
@@ -813,10 +813,10 @@  discard block
 block discarded – undo
813 813
 
814 814
 			$document_category[$key] = $obj;
815 815
 
816
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
816
+			if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1);
817 817
 		}
818 818
 		$document_category[$list_order[0]]->first = true;
819
-		$document_category[$list_order[count($list_order)-1]]->last = true;
819
+		$document_category[$list_order[count($list_order) - 1]]->last = true;
820 820
 	}
821 821
 
822 822
 	/**
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 		$args->module_srl = $module_srl;
832 832
 		$args->category_srl = $category_srl;
833 833
 		$output = executeQuery('document.getCategoryDocumentCount', $args);
834
-		return (int)$output->data->count;
834
+		return (int) $output->data->count;
835 835
 	}
836 836
 
837 837
 	/**
@@ -841,8 +841,8 @@  discard block
 block discarded – undo
841 841
 	 */
842 842
 	function getCategoryXmlFile($module_srl)
843 843
 	{
844
-		$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
845
-		if(!file_exists($xml_file))
844
+		$xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl);
845
+		if (!file_exists($xml_file))
846 846
 		{
847 847
 			$oDocumentController = getController('document');
848 848
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
 	 */
858 858
 	function getCategoryPhpFile($module_srl)
859 859
 	{
860
-		$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
861
-		if(!file_exists($php_file))
860
+		$php_file = sprintf('files/cache/document_category/%s.php', $module_srl);
861
+		if (!file_exists($php_file))
862 862
 		{
863 863
 			$oDocumentController = getController('document');
864 864
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 	 */
874 874
 	function getMonthlyArchivedList($obj)
875 875
 	{
876
-		if($obj->mid)
876
+		if ($obj->mid)
877 877
 		{
878 878
 			$oModuleModel = getModel('module');
879 879
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -881,13 +881,13 @@  discard block
 block discarded – undo
881 881
 		}
882 882
 		// Module_srl passed the array may be a check whether the array
883 883
 		$args = new stdClass;
884
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
884
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
885 885
 		else $args->module_srl = $obj->module_srl;
886 886
 
887 887
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
888
-		if(!$output->toBool()||!$output->data) return $output;
888
+		if (!$output->toBool() || !$output->data) return $output;
889 889
 
890
-		if(!is_array($output->data)) $output->data = array($output->data);
890
+		if (!is_array($output->data)) $output->data = array($output->data);
891 891
 
892 892
 		return $output;
893 893
 	}
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	 */
900 900
 	function getDailyArchivedList($obj)
901 901
 	{
902
-		if($obj->mid)
902
+		if ($obj->mid)
903 903
 		{
904 904
 			$oModuleModel = getModel('module');
905 905
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -907,14 +907,14 @@  discard block
 block discarded – undo
907 907
 		}
908 908
 		// Module_srl passed the array may be a check whether the array
909 909
 		$args = new stdClass;
910
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
910
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
911 911
 		else $args->module_srl = $obj->module_srl;
912 912
 		$args->regdate = $obj->regdate;
913 913
 
914 914
 		$output = executeQuery('document.getDailyArchivedList', $args);
915
-		if(!$output->toBool()) return $output;
915
+		if (!$output->toBool()) return $output;
916 916
 
917
-		if(!is_array($output->data)) $output->data = array($output->data);
917
+		if (!is_array($output->data)) $output->data = array($output->data);
918 918
 
919 919
 		return $output;
920 920
 	}
@@ -925,17 +925,17 @@  discard block
 block discarded – undo
925 925
 	 */
926 926
 	function getDocumentCategories()
927 927
 	{
928
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
928
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
929 929
 		$module_srl = Context::get('module_srl');
930
-		$categories= $this->getCategoryList($module_srl);
930
+		$categories = $this->getCategoryList($module_srl);
931 931
 		$lang = Context::get('lang');
932 932
 		// No additional category
933 933
 		$output = "0,0,{$lang->none_category}\n";
934
-		if($categories)
934
+		if ($categories)
935 935
 		{
936
-			foreach($categories as $category_srl => $category)
936
+			foreach ($categories as $category_srl => $category)
937 937
 			{
938
-				$output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
938
+				$output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title);
939 939
 			}
940 940
 		}
941 941
 		$this->add('categories', $output);
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 	 */
948 948
 	function getDocumentConfig()
949 949
 	{
950
-		if($this->documentConfig === NULL)
950
+		if ($this->documentConfig === NULL)
951 951
 		{
952 952
 			$oModuleModel = getModel('module');
953 953
 			$config = $oModuleModel->getModuleConfig('document');
@@ -1020,11 +1020,11 @@  discard block
 block discarded – undo
1020 1020
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1021 1021
 		// Check permissions
1022 1022
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1023
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1023
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1024 1024
 
1025 1025
 		$category_srl = Context::get('category_srl');
1026 1026
 		$category_info = $this->getCategory($category_srl);
1027
-		if(!$category_info)
1027
+		if (!$category_info)
1028 1028
 		{
1029 1029
 			return new Object(-1, 'msg_invalid_request');
1030 1030
 		}
@@ -1040,14 +1040,14 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	function getDocumentSrlByAlias($mid, $alias)
1042 1042
 	{
1043
-		if(!$mid || !$alias) return null;
1043
+		if (!$mid || !$alias) return null;
1044 1044
 		$site_module_info = Context::get('site_module_info');
1045 1045
 		$args = new stdClass;
1046 1046
 		$args->mid = $mid;
1047 1047
 		$args->alias_title = $alias;
1048 1048
 		$args->site_srl = $site_module_info->site_srl;
1049 1049
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1050
-		if(!$output->data) return null;
1050
+		if (!$output->data) return null;
1051 1051
 		else return $output->data->document_srl;
1052 1052
 	}
1053 1053
 
@@ -1059,15 +1059,15 @@  discard block
 block discarded – undo
1059 1059
 	 */
1060 1060
 	function getDocumentSrlByTitle($module_srl, $title)
1061 1061
 	{
1062
-		if(!$module_srl || !$title) return null;
1062
+		if (!$module_srl || !$title) return null;
1063 1063
 		$args = new stdClass;
1064 1064
 		$args->module_srl = $module_srl;
1065 1065
 		$args->title = $title;
1066 1066
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1067
-		if(!$output->data) return null;
1067
+		if (!$output->data) return null;
1068 1068
 		else
1069 1069
 		{
1070
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1070
+			if (is_array($output->data)) return $output->data[0]->document_srl;
1071 1071
 			return $output->data->document_srl;
1072 1072
 		}
1073 1073
 	}
@@ -1079,12 +1079,12 @@  discard block
 block discarded – undo
1079 1079
 	 */
1080 1080
 	function getAlias($document_srl)
1081 1081
 	{
1082
-		if(!$document_srl) return null;
1082
+		if (!$document_srl) return null;
1083 1083
 		$args = new stdClass;
1084 1084
 		$args->document_srl = $document_srl;
1085 1085
 		$output = executeQueryArray('document.getAliases', $args);
1086 1086
 
1087
-		if(!$output->data) return null;
1087
+		if (!$output->data) return null;
1088 1088
 		else return $output->data[0]->alias_title;
1089 1089
 	}
1090 1090
 
@@ -1127,32 +1127,32 @@  discard block
 block discarded – undo
1127 1127
 	{
1128 1128
 		// Variable check
1129 1129
 		$args = new stdClass;
1130
-		$args->category_srl = $obj->category_srl?$obj->category_srl:null;
1130
+		$args->category_srl = $obj->category_srl ? $obj->category_srl : null;
1131 1131
 		$args->sort_index = $obj->sort_index;
1132
-		$args->order_type = $obj->order_type?$obj->order_type:'desc';
1133
-		$args->page = $obj->page?$obj->page:1;
1134
-		$args->list_count = $obj->list_count?$obj->list_count:20;
1135
-		$args->page_count = $obj->page_count?$obj->page_count:10;
1132
+		$args->order_type = $obj->order_type ? $obj->order_type : 'desc';
1133
+		$args->page = $obj->page ? $obj->page : 1;
1134
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
1135
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
1136 1136
 		// Search options
1137 1137
 		$search_target = $obj->search_target;
1138 1138
 		$search_keyword = $obj->search_keyword;
1139
-		if($search_target && $search_keyword)
1139
+		if ($search_target && $search_keyword)
1140 1140
 		{
1141
-			switch($search_target)
1141
+			switch ($search_target)
1142 1142
 			{
1143 1143
 				case 'title' :
1144 1144
 				case 'content' :
1145
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1145
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1146 1146
 					$args->{"s_".$search_target} = $search_keyword;
1147 1147
 					$use_division = true;
1148 1148
 					break;
1149 1149
 				case 'title_content' :
1150
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1150
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1151 1151
 					$args->s_title = $search_keyword;
1152 1152
 					$args->s_content = $search_keyword;
1153 1153
 					break;
1154 1154
 				case 'user_id' :
1155
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1155
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1156 1156
 					$args->s_user_id = $search_keyword;
1157 1157
 					$args->sort_index = 'documents.'.$args->sort_index;
1158 1158
 					break;
@@ -1160,13 +1160,13 @@  discard block
 block discarded – undo
1160 1160
 				case 'nick_name' :
1161 1161
 				case 'email_address' :
1162 1162
 				case 'homepage' :
1163
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1163
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1164 1164
 					$args->{"s_".$search_target} = $search_keyword;
1165 1165
 					break;
1166 1166
 				case 'is_notice' :
1167 1167
 				case 'is_secret' :
1168
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1169
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1168
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1169
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1170 1170
 					break;
1171 1171
 				case 'member_srl' :
1172 1172
 				case 'readed_count' :
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
 				case 'comment_count' :
1176 1176
 				case 'trackback_count' :
1177 1177
 				case 'uploaded_count' :
1178
-					$args->{"s_".$search_target} = (int)$search_keyword;
1178
+					$args->{"s_".$search_target} = (int) $search_keyword;
1179 1179
 					break;
1180 1180
 				case 'regdate' :
1181 1181
 				case 'last_update' :
@@ -1187,9 +1187,9 @@  discard block
 block discarded – undo
1187 1187
 		}
1188 1188
 
1189 1189
 		$output = executeQueryArray('document.getTrashList', $args);
1190
-		if($output->data)
1190
+		if ($output->data)
1191 1191
 		{
1192
-			foreach($output->data as $key => $attribute)
1192
+			foreach ($output->data as $key => $attribute)
1193 1193
 			{
1194 1194
 				$oDocument = null;
1195 1195
 				$oDocument = new documentItem();
@@ -1208,46 +1208,46 @@  discard block
 block discarded – undo
1208 1208
 	{
1209 1209
 		$args = new stdClass;
1210 1210
 		$document_srl = Context::get('document_srl');
1211
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
1211
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
1212 1212
 
1213 1213
 		$point = Context::get('point');
1214
-		if($point != -1) $point = 1;
1214
+		if ($point != -1) $point = 1;
1215 1215
 
1216 1216
 		$oDocumentModel = getModel('document');
1217 1217
 		$columnList = array('document_srl', 'module_srl');
1218 1218
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1219 1219
 		$module_srl = $oDocument->get('module_srl');
1220
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
1220
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
1221 1221
 
1222 1222
 		$oModuleModel = getModel('module');
1223
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1224
-		if($point == -1)
1223
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
1224
+		if ($point == -1)
1225 1225
 		{
1226
-			if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request');
1226
+			if ($document_config->use_vote_down != 'S') return new Object(-1, 'msg_invalid_request');
1227 1227
 			$args->below_point = 0;
1228 1228
 		}
1229 1229
 		else
1230 1230
 		{
1231
-			if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request');
1231
+			if ($document_config->use_vote_up != 'S') return new Object(-1, 'msg_invalid_request');
1232 1232
 			$args->more_point = 0;
1233 1233
 		}
1234 1234
 
1235 1235
 		$args->document_srl = $document_srl;
1236 1236
 
1237
-		$output = executeQueryArray('document.getVotedMemberList',$args);
1238
-		if(!$output->toBool()) return $output;
1237
+		$output = executeQueryArray('document.getVotedMemberList', $args);
1238
+		if (!$output->toBool()) return $output;
1239 1239
 
1240 1240
 		$oMemberModel = getModel('member');
1241
-		if($output->data)
1241
+		if ($output->data)
1242 1242
 		{
1243
-			foreach($output->data as $k => $d)
1243
+			foreach ($output->data as $k => $d)
1244 1244
 			{
1245 1245
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1246 1246
 				$output->data[$k]->src = $profile_image->src;
1247 1247
 			}
1248 1248
 		}
1249 1249
 
1250
-		$this->add('voted_member_list',$output->data);
1250
+		$this->add('voted_member_list', $output->data);
1251 1251
 	}
1252 1252
 
1253 1253
 	/**
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 	function getStatusNameList()
1258 1258
 	{
1259 1259
 		global $lang;
1260
-		if(!isset($lang->status_name_list))
1260
+		if (!isset($lang->status_name_list))
1261 1261
 			return array_flip($this->getStatusList());
1262 1262
 		else return $lang->status_name_list;
1263 1263
 	}
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 	{
1273 1273
 		$sortIndex = $obj->sort_index;
1274 1274
 		$isExtraVars = false;
1275
-		if(!in_array($sortIndex, array('list_order','regdate','last_update','update_order','readed_count','voted_count','blamed_count','comment_count','trackback_count','uploaded_count','title','category_srl')))
1275
+		if (!in_array($sortIndex, array('list_order', 'regdate', 'last_update', 'update_order', 'readed_count', 'voted_count', 'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'title', 'category_srl')))
1276 1276
 		{
1277 1277
 			// get module_srl extra_vars list
1278 1278
 			if ($load_extra_vars)
@@ -1287,11 +1287,11 @@  discard block
 block discarded – undo
1287 1287
 				else
1288 1288
 				{
1289 1289
 					$check_array = array();
1290
-					foreach($extra_output->data as $val)
1290
+					foreach ($extra_output->data as $val)
1291 1291
 					{
1292 1292
 						$check_array[] = $val->eid;
1293 1293
 					}
1294
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1294
+					if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1295 1295
 					else $isExtraVars = true;
1296 1296
 				}
1297 1297
 			}
@@ -1319,13 +1319,13 @@  discard block
 block discarded – undo
1319 1319
 	{
1320 1320
 		// Variable check
1321 1321
 		$args = new stdClass();
1322
-		$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1322
+		$args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null;
1323 1323
 		$args->order_type = $searchOpt->order_type;
1324
-		$args->page = $searchOpt->page?$searchOpt->page:1;
1325
-		$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1326
-		$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1327
-		$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1328
-		$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1324
+		$args->page = $searchOpt->page ? $searchOpt->page : 1;
1325
+		$args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20;
1326
+		$args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10;
1327
+		$args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null;
1328
+		$args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null;
1329 1329
 		$args->member_srl = $searchOpt->member_srl;
1330 1330
 
1331 1331
 		$logged_info = Context::get('logged_info');
@@ -1334,10 +1334,10 @@  discard block
 block discarded – undo
1334 1334
 
1335 1335
 		// Check the target and sequence alignment
1336 1336
 		$orderType = array('desc' => 1, 'asc' => 1);
1337
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1337
+		if (!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1338 1338
 
1339 1339
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1340
-		if($searchOpt->mid)
1340
+		if ($searchOpt->mid)
1341 1341
 		{
1342 1342
 			$oModuleModel = getModel('module');
1343 1343
 			$args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -1345,30 +1345,30 @@  discard block
 block discarded – undo
1345 1345
 		}
1346 1346
 
1347 1347
 		// Module_srl passed the array may be a check whether the array
1348
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1348
+		if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1349 1349
 		else $args->module_srl = $searchOpt->module_srl;
1350 1350
 
1351 1351
 		// Except for the test module_srl
1352
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1352
+		if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1353 1353
 		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1354 1354
 
1355 1355
 		// only admin document list, temp document showing
1356
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1356
+		if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1357 1357
 		else
1358 1358
 		{
1359
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1359
+			if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1360 1360
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1361 1361
 			else
1362 1362
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1363 1363
 		}
1364 1364
 
1365 1365
 		// Category is selected, further sub-categories until all conditions
1366
-		if($args->category_srl)
1366
+		if ($args->category_srl)
1367 1367
 		{
1368 1368
 			$category_list = $this->getCategoryList($args->module_srl);
1369 1369
 			$category_info = $category_list[$args->category_srl];
1370 1370
 			$category_info->childs[] = $args->category_srl;
1371
-			$args->category_srl = implode(',',$category_info->childs);
1371
+			$args->category_srl = implode(',', $category_info->childs);
1372 1372
 		}
1373 1373
 
1374 1374
 		// Used to specify the default query id (based on several search options to query id modified)
@@ -1381,24 +1381,24 @@  discard block
 block discarded – undo
1381 1381
 		$search_target = $searchOpt->search_target;
1382 1382
 		$search_keyword = $searchOpt->search_keyword;
1383 1383
 
1384
-		if($search_target && $search_keyword)
1384
+		if ($search_target && $search_keyword)
1385 1385
 		{
1386
-			switch($search_target)
1386
+			switch ($search_target)
1387 1387
 			{
1388 1388
 				case 'title' :
1389 1389
 				case 'content' :
1390
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1390
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1391 1391
 					$args->{"s_".$search_target} = $search_keyword;
1392 1392
 					$use_division = true;
1393 1393
 					break;
1394 1394
 				case 'title_content' :
1395
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1395
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1396 1396
 					$args->s_title = $search_keyword;
1397 1397
 					$args->s_content = $search_keyword;
1398 1398
 					$use_division = true;
1399 1399
 					break;
1400 1400
 				case 'user_id' :
1401
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1401
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1402 1402
 					$args->s_user_id = $search_keyword;
1403 1403
 					$args->sort_index = 'documents.'.$args->sort_index;
1404 1404
 					break;
@@ -1406,18 +1406,18 @@  discard block
 block discarded – undo
1406 1406
 				case 'nick_name' :
1407 1407
 				case 'email_address' :
1408 1408
 				case 'homepage' :
1409
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1409
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1410 1410
 					$args->{"s_".$search_target} = $search_keyword;
1411 1411
 					break;
1412 1412
 				case 'is_notice' :
1413
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1414
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1413
+					if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N';
1414
+					elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y';
1415 1415
 					else $args->{"s_".$search_target} = '';
1416 1416
 					break;
1417 1417
 				case 'is_secret' :
1418
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1419
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1420
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1418
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1419
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1420
+					elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp'));
1421 1421
 					break;
1422 1422
 				case 'member_srl' :
1423 1423
 				case 'readed_count' :
@@ -1425,10 +1425,10 @@  discard block
 block discarded – undo
1425 1425
 				case 'comment_count' :
1426 1426
 				case 'trackback_count' :
1427 1427
 				case 'uploaded_count' :
1428
-					$args->{"s_".$search_target} = (int)$search_keyword;
1428
+					$args->{"s_".$search_target} = (int) $search_keyword;
1429 1429
 					break;
1430 1430
 				case 'blamed_count' :
1431
-					$args->{"s_".$search_target} = (int)$search_keyword * -1;
1431
+					$args->{"s_".$search_target} = (int) $search_keyword * -1;
1432 1432
 					break;
1433 1433
 				case 'regdate' :
1434 1434
 				case 'last_update' :
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 					$use_division = true;
1442 1442
 					break;
1443 1443
 				case 'tag' :
1444
-					$args->s_tags = str_replace(' ','%',$search_keyword);
1444
+					$args->s_tags = str_replace(' ', '%', $search_keyword);
1445 1445
 					$query_id = 'document.getDocumentListWithinTag';
1446 1446
 					break;
1447 1447
 				case 'extra_vars':
@@ -1449,9 +1449,9 @@  discard block
 block discarded – undo
1449 1449
 					$query_id = 'document.getDocumentListWithinExtraVars';
1450 1450
 					break;
1451 1451
 				default :
1452
-					if(strpos($search_target,'extra_vars')!==false) {
1452
+					if (strpos($search_target, 'extra_vars') !== false) {
1453 1453
 						$args->var_idx = substr($search_target, strlen('extra_vars'));
1454
-						$args->var_value = str_replace(' ','%',$search_keyword);
1454
+						$args->var_value = str_replace(' ', '%', $search_keyword);
1455 1455
 						$args->sort_index = 'documents.'.$args->sort_index;
1456 1456
 						$query_id = 'document.getDocumentListWithExtraVars';
1457 1457
 					}
@@ -1468,18 +1468,18 @@  discard block
 block discarded – undo
1468 1468
 			/**
1469 1469
 			 * list_order asc sort of division that can be used only when
1470 1470
 			 */
1471
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1471
+			if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1472 1472
 
1473 1473
 			/**
1474 1474
 			 * If it is true, use_division changed to use the document division
1475 1475
 			 */
1476
-			if($use_division)
1476
+			if ($use_division)
1477 1477
 			{
1478 1478
 				// Division begins
1479
-				$division = (int)Context::get('division');
1479
+				$division = (int) Context::get('division');
1480 1480
 
1481 1481
 				// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1482
-				if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1482
+				if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1483 1483
 				{
1484 1484
 					$listSqlID = 'document.getDocumentListUseIndex';
1485 1485
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
@@ -1491,7 +1491,7 @@  discard block
 block discarded – undo
1491 1491
 				}
1492 1492
 
1493 1493
 				// If you do not value the best division top
1494
-				if(!$division)
1494
+				if (!$division)
1495 1495
 				{
1496 1496
 					$division_args = new stdClass();
1497 1497
 					$division_args->module_srl = $args->module_srl;
@@ -1502,7 +1502,7 @@  discard block
 block discarded – undo
1502 1502
 					$division_args->statusList = $args->statusList;
1503 1503
 
1504 1504
 					$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1505
-					if($output->data)
1505
+					if ($output->data)
1506 1506
 					{
1507 1507
 						$item = array_pop($output->data);
1508 1508
 						$division = $item->list_order;
@@ -1511,10 +1511,10 @@  discard block
 block discarded – undo
1511 1511
 				}
1512 1512
 
1513 1513
 				// The last division
1514
-				$last_division = (int)Context::get('last_division');
1514
+				$last_division = (int) Context::get('last_division');
1515 1515
 
1516 1516
 				// Division after division from the 5000 value of the specified Wanted
1517
-				if(!$last_division)
1517
+				if (!$last_division)
1518 1518
 				{
1519 1519
 					$last_division_args = new stdClass();
1520 1520
 					$last_division_args->module_srl = $args->module_srl;
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
 					$last_division_args->page = 5001;
1527 1527
 
1528 1528
 					$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1529
-					if($output->data)
1529
+					if ($output->data)
1530 1530
 					{
1531 1531
 						$item = array_pop($output->data);
1532 1532
 						$last_division = $item->list_order;
@@ -1534,14 +1534,14 @@  discard block
 block discarded – undo
1534 1534
 				}
1535 1535
 
1536 1536
 				// Make sure that after last_division article
1537
-				if($last_division)
1537
+				if ($last_division)
1538 1538
 				{
1539 1539
 					$last_division_args = new stdClass();
1540 1540
 					$last_division_args->module_srl = $args->module_srl;
1541 1541
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1542 1542
 					$last_division_args->list_order = $last_division;
1543 1543
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1544
-					if($output->data->count<1) $last_division = null;
1544
+					if ($output->data->count < 1) $last_division = null;
1545 1545
 				}
1546 1546
 
1547 1547
 				$args->division = $division;
@@ -1574,7 +1574,7 @@  discard block
 block discarded – undo
1574 1574
 	 * @param int $count
1575 1575
 	 * @return object
1576 1576
 	 */
1577
-	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1577
+	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0)
1578 1578
 	{
1579 1579
 		$args = new stdClass();
1580 1580
 		$args->member_srl = $member_srl;
@@ -1582,8 +1582,8 @@  discard block
 block discarded – undo
1582 1582
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1583 1583
 		$document_list = $output->data;
1584 1584
 
1585
-		if(!$document_list) return array();
1586
-		if(!is_array($document_list)) $document_list = array($document_list);
1585
+		if (!$document_list) return array();
1586
+		if (!is_array($document_list)) $document_list = array($document_list);
1587 1587
 
1588 1588
 		return $document_list;
1589 1589
 	}
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
 	function getDocumentExtraImagePath()
1592 1592
 	{
1593 1593
 		$documentConfig = getModel('document')->getDocumentConfig();
1594
-		if(Mobile::isFromMobilePhone())
1594
+		if (Mobile::isFromMobilePhone())
1595 1595
 		{
1596 1596
 			$iconSkin = $documentConfig->micons;
1597 1597
 		}
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 		{
1600 1600
 			$iconSkin = $documentConfig->icons;
1601 1601
 		}
1602
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1602
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1603 1603
 
1604 1604
 		return $path;
1605 1605
 	}
Please login to merge, or discard this patch.
Braces   +300 added lines, -139 removed lines patch added patch discarded remove patch
@@ -58,18 +58,24 @@  discard block
 block discarded – undo
58 58
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
59 59
 
60 60
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
61
-		if(count($_document_list) <= 0) return;
61
+		if(count($_document_list) <= 0) {
62
+			return;
63
+		}
62 64
 
63 65
 		// Find all called the document object variable has been set extension
64 66
 		$document_srls = array();
65 67
 		foreach($_document_list as $key => $val)
66 68
 		{
67
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
69
+			if(!$val->document_srl || $checked_documents[$val->document_srl]) {
70
+				continue;
71
+			}
68 72
 			$checked_documents[$val->document_srl] = true;
69 73
 			$document_srls[] = $val->document_srl;
70 74
 		}
71 75
 		// If the document number, return detected
72
-		if(!count($document_srls)) return;
76
+		if(!count($document_srls)) {
77
+			return;
78
+		}
73 79
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
74 80
 		//$obj->document_srl = implode(',',$document_srls);
75 81
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
@@ -77,8 +83,12 @@  discard block
 block discarded – undo
77 83
 		{
78 84
 			foreach($output->data as $key => $val)
79 85
 			{
80
-				if(!isset($val->value)) continue;
81
-				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
86
+				if(!isset($val->value)) {
87
+					continue;
88
+				}
89
+				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) {
90
+					$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
91
+				}
82 92
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
83 93
 			}
84 94
 		}
@@ -89,7 +99,9 @@  discard block
 block discarded – undo
89 99
 			$document_srl = $document_srls[$i];
90 100
 			unset($vars);
91 101
 
92
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
102
+			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) {
103
+				continue;
104
+			}
93 105
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
94 106
 			$extra_keys = $this->getExtraKeys($module_srl);
95 107
 			$vars = $extra_vars[$document_srl];
@@ -101,10 +113,15 @@  discard block
 block discarded – undo
101 113
 				{
102 114
 					$extra_keys[$idx] = clone($key);
103 115
 					$val = $vars[$idx];
104
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106
-					else if(isset($val[0])) $v = $val[0];
107
-					else $v = null;
116
+					if(isset($val[$user_lang_code])) {
117
+						$v = $val[$user_lang_code];
118
+					} else if(isset($val[$document_lang_code])) {
119
+						$v = $val[$document_lang_code];
120
+					} else if(isset($val[0])) {
121
+						$v = $val[0];
122
+					} else {
123
+						$v = null;
124
+					}
108 125
 					$extra_keys[$idx]->value = $v;
109 126
 				}
110 127
 			}
@@ -113,9 +130,13 @@  discard block
 block discarded – undo
113 130
 			$evars = new ExtraVar($module_srl);
114 131
 			$evars->setExtraVarKeys($extra_keys);
115 132
 			// Title Processing
116
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
133
+			if($vars[-1][$user_lang_code]) {
134
+				$_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
135
+			}
117 136
 			// Information processing
118
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
137
+			if($vars[-2][$user_lang_code]) {
138
+				$_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
139
+			}
119 140
 
120 141
 			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
121 142
 			{
@@ -136,15 +157,21 @@  discard block
 block discarded – undo
136 157
 	 */
137 158
 	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
138 159
 	{
139
-		if(!$document_srl) return new documentItem();
160
+		if(!$document_srl) {
161
+			return new documentItem();
162
+		}
140 163
 
141 164
 		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
142 165
 		{
143 166
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
144 167
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
145
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
168
+			if($load_extra_vars) {
169
+				$this->setToAllDocumentExtraVars();
170
+			}
171
+		}
172
+		if($is_admin) {
173
+			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
146 174
 		}
147
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
148 175
 
149 176
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
150 177
 	}
@@ -163,8 +190,7 @@  discard block
 block discarded – undo
163 190
 		{
164 191
 			$list_count = count($document_srls);
165 192
 			$document_srls = implode(',',$document_srls);
166
-		}
167
-		else
193
+		} else
168 194
 		{
169 195
 			$list_count = 1;
170 196
 		}
@@ -175,28 +201,38 @@  discard block
 block discarded – undo
175 201
 
176 202
 		$output = executeQuery('document.getDocuments', $args, $columnList);
177 203
 		$document_list = $output->data;
178
-		if(!$document_list) return;
179
-		if(!is_array($document_list)) $document_list = array($document_list);
204
+		if(!$document_list) {
205
+			return;
206
+		}
207
+		if(!is_array($document_list)) {
208
+			$document_list = array($document_list);
209
+		}
180 210
 
181 211
 		$document_count = count($document_list);
182 212
 		foreach($document_list as $key => $attribute)
183 213
 		{
184 214
 			$document_srl = $attribute->document_srl;
185
-			if(!$document_srl) continue;
215
+			if(!$document_srl) {
216
+				continue;
217
+			}
186 218
 
187 219
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
188 220
 			{
189 221
 				$oDocument = null;
190 222
 				$oDocument = new documentItem();
191 223
 				$oDocument->setAttribute($attribute, false);
192
-				if($is_admin) $oDocument->setGrant();
224
+				if($is_admin) {
225
+					$oDocument->setGrant();
226
+				}
193 227
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
194 228
 			}
195 229
 
196 230
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
197 231
 		}
198 232
 
199
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
233
+		if($load_extra_vars) {
234
+			$this->setToAllDocumentExtraVars();
235
+		}
200 236
 
201 237
 		$output = null;
202 238
 		if(count($result))
@@ -244,18 +280,15 @@  discard block
 block discarded – undo
244 280
 		{
245 281
 			$output = $obj->use_alternate_output;
246 282
 			unset($obj->use_alternate_output);
247
-		}
248
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
283
+		} elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
249 284
 		{
250 285
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
251 286
 			$args->sort_index = str_replace('documents.','',$args->sort_index);
252 287
 			$output = executeQueryArray($query_id, $args);
253
-		}
254
-		elseif ($sort_check->isExtraVars)
288
+		} elseif ($sort_check->isExtraVars)
255 289
 		{
256 290
 			$output = executeQueryArray($query_id, $args);
257
-		}
258
-		else
291
+		} else
259 292
 		{
260 293
 			// document.getDocumentList query execution
261 294
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
@@ -265,11 +298,15 @@  discard block
 block discarded – undo
265 298
 				$group_args = clone($args);
266 299
 				$group_args->sort_index = 'documents.'.$args->sort_index;
267 300
 				$output = executeQueryArray($query_id, $group_args);
268
-				if(!$output->toBool()||!count($output->data)) return $output;
301
+				if(!$output->toBool()||!count($output->data)) {
302
+					return $output;
303
+				}
269 304
 
270 305
 				foreach($output->data as $key => $val)
271 306
 				{
272
-					if($val->document_srl) $target_srls[] = $val->document_srl;
307
+					if($val->document_srl) {
308
+						$target_srls[] = $val->document_srl;
309
+					}
273 310
 				}
274 311
 
275 312
 				$page_navigation = $output->page_navigation;
@@ -287,14 +324,15 @@  discard block
 block discarded – undo
287 324
 				$output->total_count = $page_navigation->total_count;
288 325
 				$output->total_page = $page_navigation->total_page;
289 326
 				$output->page = $page_navigation->cur_page;
290
-			}
291
-			else
327
+			} else
292 328
 			{
293 329
 				$output = executeQueryArray($query_id, $args, $columnList);
294 330
 			}
295 331
 		}
296 332
 		// Return if no result or an error occurs
297
-		if(!$output->toBool()||!count($output->data)) return $output;
333
+		if(!$output->toBool()||!count($output->data)) {
334
+			return $output;
335
+		}
298 336
 		$idx = 0;
299 337
 		$data = $output->data;
300 338
 		unset($output->data);
@@ -309,20 +347,26 @@  discard block
 block discarded – undo
309 347
 		{
310 348
 			foreach($data as $key => $attribute)
311 349
 			{
312
-				if($attribute->is_notice == 'Y') $virtual_number --;
350
+				if($attribute->is_notice == 'Y') {
351
+					$virtual_number --;
352
+				}
313 353
 			}
314 354
 		}
315 355
 
316 356
 		foreach($data as $key => $attribute)
317 357
 		{
318
-			if($except_notice && $attribute->is_notice == 'Y') continue;
358
+			if($except_notice && $attribute->is_notice == 'Y') {
359
+				continue;
360
+			}
319 361
 			$document_srl = $attribute->document_srl;
320 362
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
321 363
 			{
322 364
 				$oDocument = null;
323 365
 				$oDocument = new documentItem();
324 366
 				$oDocument->setAttribute($attribute, false);
325
-				if($is_admin) $oDocument->setGrant();
367
+				if($is_admin) {
368
+					$oDocument->setGrant();
369
+				}
326 370
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
327 371
 			}
328 372
 
@@ -330,7 +374,9 @@  discard block
 block discarded – undo
330 374
 			$virtual_number--;
331 375
 		}
332 376
 
333
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
377
+		if($load_extra_vars) {
378
+			$this->setToAllDocumentExtraVars();
379
+		}
334 380
 
335 381
 		if(count($output->data))
336 382
 		{
@@ -358,12 +404,16 @@  discard block
 block discarded – undo
358 404
 		$args->module_srl = $obj->module_srl;
359 405
 		$args->category_srl= $obj->category_srl;
360 406
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
361
-		if(!$output->toBool()||!$output->data) return;
407
+		if(!$output->toBool()||!$output->data) {
408
+			return;
409
+		}
362 410
 
363 411
 		foreach($output->data as $key => $val)
364 412
 		{
365 413
 			$document_srl = $val->document_srl;
366
-			if(!$document_srl) continue;
414
+			if(!$document_srl) {
415
+				continue;
416
+			}
367 417
 
368 418
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
369 419
 			{
@@ -459,7 +509,9 @@  discard block
 block discarded – undo
459 509
 
460 510
 				$oExtraVar->setExtraVarKeys($output->data);
461 511
 				$keys = $oExtraVar->getExtraVars();
462
-				if(!$keys) $keys = array();
512
+				if(!$keys) {
513
+					$keys = array();
514
+				}
463 515
 
464 516
 				if($oCacheHandler->isSupport())
465 517
 				{
@@ -489,7 +541,9 @@  discard block
 block discarded – undo
489 541
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
490 542
 			$this->setToAllDocumentExtraVars();
491 543
 		}
492
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
544
+		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
545
+			ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
546
+		}
493 547
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
494 548
 	}
495 549
 
@@ -519,7 +573,9 @@  discard block
 block discarded – undo
519 573
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
520 574
 			$module_srl = $oDocument->get('module_srl');
521 575
 			$member_srl = $oDocument->get('member_srl');
522
-			if(!$module_srl) return new Object(-1, 'msg_invalid_request');
576
+			if(!$module_srl) {
577
+				return new Object(-1, 'msg_invalid_request');
578
+			}
523 579
 
524 580
 			$oModuleModel = getModel('module');
525 581
 			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
@@ -592,7 +648,9 @@  discard block
 block discarded – undo
592 648
 	 */
593 649
 	function getDocumentCount($module_srl, $search_obj = NULL)
594 650
 	{
595
-		if(is_null($search_obj)) $search_obj = new stdClass();
651
+		if(is_null($search_obj)) {
652
+			$search_obj = new stdClass();
653
+		}
596 654
 		$search_obj->module_srl = $module_srl;
597 655
 
598 656
 		$output = executeQuery('document.getDocumentCount', $search_obj);
@@ -609,7 +667,9 @@  discard block
 block discarded – undo
609 667
 	function getDocumentCountByGroupStatus($search_obj = NULL)
610 668
 	{
611 669
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
612
-		if(!$output->toBool()) return array();
670
+		if(!$output->toBool()) {
671
+			return array();
672
+		}
613 673
 
614 674
 		return $output->data;
615 675
 	}
@@ -648,34 +708,29 @@  discard block
 block discarded – undo
648 708
 		if($sort_check->isExtraVars)
649 709
 		{
650 710
 			return 1;
651
-		}
652
-		else
711
+		} else
653 712
 		{
654 713
 			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
655 714
 			{
656 715
 				if($args->order_type === 'desc')
657 716
 				{
658 717
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
659
-				}
660
-				else
718
+				} else
661 719
 				{
662 720
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
663 721
 				}
664
-			}
665
-			elseif($sort_check->sort_index === 'regdate')
722
+			} elseif($sort_check->sort_index === 'regdate')
666 723
 			{
667 724
 
668 725
 				if($args->order_type === 'asc')
669 726
 				{
670 727
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
671
-				}
672
-				else
728
+				} else
673 729
 				{
674 730
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
675 731
 				}
676 732
 
677
-			}
678
-			else
733
+			} else
679 734
 			{
680 735
 				return 1;
681 736
 			}
@@ -701,15 +756,16 @@  discard block
 block discarded – undo
701 756
 		$output = executeQuery('document.getCategory', $args, $columnList);
702 757
 
703 758
 		$node = $output->data;
704
-		if(!$node) return;
759
+		if(!$node) {
760
+			return;
761
+		}
705 762
 
706 763
 		if($node->group_srls)
707 764
 		{
708 765
 			$group_srls = explode(',',$node->group_srls);
709 766
 			unset($node->group_srls);
710 767
 			$node->group_srls = $group_srls;
711
-		}
712
-		else
768
+		} else
713 769
 		{
714 770
 			unset($node->group_srls);
715 771
 			$node->group_srls = array();
@@ -727,7 +783,9 @@  discard block
 block discarded – undo
727 783
 		$args = new stdClass();
728 784
 		$args->category_srl = $category_srl;
729 785
 		$output = executeQuery('document.getChildCategoryCount',$args);
730
-		if($output->data->count > 0) return true;
786
+		if($output->data->count > 0) {
787
+			return true;
788
+		}
731 789
 		return false;
732 790
 	}
733 791
 
@@ -746,7 +804,9 @@  discard block
 block discarded – undo
746 804
 		if(!file_exists($filename))
747 805
 		{
748 806
 			$oDocumentController = getController('document');
749
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
807
+			if(!$oDocumentController->makeCategoryFile($module_srl)) {
808
+				return array();
809
+			}
750 810
 		}
751 811
 
752 812
 		include($filename);
@@ -766,7 +826,9 @@  discard block
 block discarded – undo
766 826
 	 */
767 827
 	function _arrangeCategory(&$document_category, $list, $depth)
768 828
 	{
769
-		if(!count($list)) return;
829
+		if(!count($list)) {
830
+			return;
831
+		}
770 832
 		$idx = 0;
771 833
 		$list_order = array();
772 834
 		foreach($list as $key => $val)
@@ -786,8 +848,11 @@  discard block
 block discarded – undo
786 848
 			$obj->childs = array();
787 849
 			$obj->grant = $val['grant'];
788 850
 
789
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
790
-			else $selected = false;
851
+			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) {
852
+				$selected = true;
853
+			} else {
854
+				$selected = false;
855
+			}
791 856
 
792 857
 			$obj->selected = $selected;
793 858
 
@@ -798,14 +863,18 @@  discard block
 block discarded – undo
798 863
 				$parent_srl = $obj->parent_srl;
799 864
 				$document_count = $obj->document_count;
800 865
 				$expand = $obj->expand;
801
-				if($selected) $expand = true;
866
+				if($selected) {
867
+					$expand = true;
868
+				}
802 869
 
803 870
 				while($parent_srl)
804 871
 				{
805 872
 					$document_category[$parent_srl]->document_count += $document_count;
806 873
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
807 874
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
808
-					if($expand) $document_category[$parent_srl]->expand = $expand;
875
+					if($expand) {
876
+						$document_category[$parent_srl]->expand = $expand;
877
+					}
809 878
 
810 879
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
811 880
 				}
@@ -813,7 +882,9 @@  discard block
 block discarded – undo
813 882
 
814 883
 			$document_category[$key] = $obj;
815 884
 
816
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
885
+			if(count($val['list'])) {
886
+				$this->_arrangeCategory($document_category, $val['list'], $depth+1);
887
+			}
817 888
 		}
818 889
 		$document_category[$list_order[0]]->first = true;
819 890
 		$document_category[$list_order[count($list_order)-1]]->last = true;
@@ -881,13 +952,20 @@  discard block
 block discarded – undo
881 952
 		}
882 953
 		// Module_srl passed the array may be a check whether the array
883 954
 		$args = new stdClass;
884
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
885
-		else $args->module_srl = $obj->module_srl;
955
+		if(is_array($obj->module_srl)) {
956
+			$args->module_srl = implode(',', $obj->module_srl);
957
+		} else {
958
+			$args->module_srl = $obj->module_srl;
959
+		}
886 960
 
887 961
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
888
-		if(!$output->toBool()||!$output->data) return $output;
962
+		if(!$output->toBool()||!$output->data) {
963
+			return $output;
964
+		}
889 965
 
890
-		if(!is_array($output->data)) $output->data = array($output->data);
966
+		if(!is_array($output->data)) {
967
+			$output->data = array($output->data);
968
+		}
891 969
 
892 970
 		return $output;
893 971
 	}
@@ -907,14 +985,21 @@  discard block
 block discarded – undo
907 985
 		}
908 986
 		// Module_srl passed the array may be a check whether the array
909 987
 		$args = new stdClass;
910
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
911
-		else $args->module_srl = $obj->module_srl;
988
+		if(is_array($obj->module_srl)) {
989
+			$args->module_srl = implode(',', $obj->module_srl);
990
+		} else {
991
+			$args->module_srl = $obj->module_srl;
992
+		}
912 993
 		$args->regdate = $obj->regdate;
913 994
 
914 995
 		$output = executeQuery('document.getDailyArchivedList', $args);
915
-		if(!$output->toBool()) return $output;
996
+		if(!$output->toBool()) {
997
+			return $output;
998
+		}
916 999
 
917
-		if(!is_array($output->data)) $output->data = array($output->data);
1000
+		if(!is_array($output->data)) {
1001
+			$output->data = array($output->data);
1002
+		}
918 1003
 
919 1004
 		return $output;
920 1005
 	}
@@ -925,7 +1010,9 @@  discard block
 block discarded – undo
925 1010
 	 */
926 1011
 	function getDocumentCategories()
927 1012
 	{
928
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
1013
+		if(!Context::get('is_logged')) {
1014
+			return new Object(-1,'msg_not_permitted');
1015
+		}
929 1016
 		$module_srl = Context::get('module_srl');
930 1017
 		$categories= $this->getCategoryList($module_srl);
931 1018
 		$lang = Context::get('lang');
@@ -1020,7 +1107,9 @@  discard block
 block discarded – undo
1020 1107
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1021 1108
 		// Check permissions
1022 1109
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1023
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1110
+		if(!$grant->manager) {
1111
+			return new Object(-1,'msg_not_permitted');
1112
+		}
1024 1113
 
1025 1114
 		$category_srl = Context::get('category_srl');
1026 1115
 		$category_info = $this->getCategory($category_srl);
@@ -1040,15 +1129,20 @@  discard block
 block discarded – undo
1040 1129
 	 */
1041 1130
 	function getDocumentSrlByAlias($mid, $alias)
1042 1131
 	{
1043
-		if(!$mid || !$alias) return null;
1132
+		if(!$mid || !$alias) {
1133
+			return null;
1134
+		}
1044 1135
 		$site_module_info = Context::get('site_module_info');
1045 1136
 		$args = new stdClass;
1046 1137
 		$args->mid = $mid;
1047 1138
 		$args->alias_title = $alias;
1048 1139
 		$args->site_srl = $site_module_info->site_srl;
1049 1140
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1050
-		if(!$output->data) return null;
1051
-		else return $output->data->document_srl;
1141
+		if(!$output->data) {
1142
+			return null;
1143
+		} else {
1144
+			return $output->data->document_srl;
1145
+		}
1052 1146
 	}
1053 1147
 
1054 1148
 	/**
@@ -1059,15 +1153,20 @@  discard block
 block discarded – undo
1059 1153
 	 */
1060 1154
 	function getDocumentSrlByTitle($module_srl, $title)
1061 1155
 	{
1062
-		if(!$module_srl || !$title) return null;
1156
+		if(!$module_srl || !$title) {
1157
+			return null;
1158
+		}
1063 1159
 		$args = new stdClass;
1064 1160
 		$args->module_srl = $module_srl;
1065 1161
 		$args->title = $title;
1066 1162
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1067
-		if(!$output->data) return null;
1068
-		else
1163
+		if(!$output->data) {
1164
+			return null;
1165
+		} else
1069 1166
 		{
1070
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1167
+			if(is_array($output->data)) {
1168
+				return $output->data[0]->document_srl;
1169
+			}
1071 1170
 			return $output->data->document_srl;
1072 1171
 		}
1073 1172
 	}
@@ -1079,13 +1178,18 @@  discard block
 block discarded – undo
1079 1178
 	 */
1080 1179
 	function getAlias($document_srl)
1081 1180
 	{
1082
-		if(!$document_srl) return null;
1181
+		if(!$document_srl) {
1182
+			return null;
1183
+		}
1083 1184
 		$args = new stdClass;
1084 1185
 		$args->document_srl = $document_srl;
1085 1186
 		$output = executeQueryArray('document.getAliases', $args);
1086 1187
 
1087
-		if(!$output->data) return null;
1088
-		else return $output->data[0]->alias_title;
1188
+		if(!$output->data) {
1189
+			return null;
1190
+		} else {
1191
+			return $output->data[0]->alias_title;
1192
+		}
1089 1193
 	}
1090 1194
 
1091 1195
 	/**
@@ -1142,17 +1246,23 @@  discard block
 block discarded – undo
1142 1246
 			{
1143 1247
 				case 'title' :
1144 1248
 				case 'content' :
1145
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1249
+					if($search_keyword) {
1250
+						$search_keyword = str_replace(' ','%',$search_keyword);
1251
+					}
1146 1252
 					$args->{"s_".$search_target} = $search_keyword;
1147 1253
 					$use_division = true;
1148 1254
 					break;
1149 1255
 				case 'title_content' :
1150
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1256
+					if($search_keyword) {
1257
+						$search_keyword = str_replace(' ','%',$search_keyword);
1258
+					}
1151 1259
 					$args->s_title = $search_keyword;
1152 1260
 					$args->s_content = $search_keyword;
1153 1261
 					break;
1154 1262
 				case 'user_id' :
1155
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1263
+					if($search_keyword) {
1264
+						$search_keyword = str_replace(' ','%',$search_keyword);
1265
+					}
1156 1266
 					$args->s_user_id = $search_keyword;
1157 1267
 					$args->sort_index = 'documents.'.$args->sort_index;
1158 1268
 					break;
@@ -1160,13 +1270,18 @@  discard block
 block discarded – undo
1160 1270
 				case 'nick_name' :
1161 1271
 				case 'email_address' :
1162 1272
 				case 'homepage' :
1163
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1273
+					if($search_keyword) {
1274
+						$search_keyword = str_replace(' ','%',$search_keyword);
1275
+					}
1164 1276
 					$args->{"s_".$search_target} = $search_keyword;
1165 1277
 					break;
1166 1278
 				case 'is_notice' :
1167 1279
 				case 'is_secret' :
1168
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1169
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1280
+					if($search_keyword=='N') {
1281
+						$args->statusList = array($this->getConfigStatus('public'));
1282
+					} elseif($search_keyword=='Y') {
1283
+						$args->statusList = array($this->getConfigStatus('secret'));
1284
+					}
1170 1285
 					break;
1171 1286
 				case 'member_srl' :
1172 1287
 				case 'readed_count' :
@@ -1208,34 +1323,45 @@  discard block
 block discarded – undo
1208 1323
 	{
1209 1324
 		$args = new stdClass;
1210 1325
 		$document_srl = Context::get('document_srl');
1211
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
1326
+		if(!$document_srl) {
1327
+			return new Object(-1,'msg_invalid_request');
1328
+		}
1212 1329
 
1213 1330
 		$point = Context::get('point');
1214
-		if($point != -1) $point = 1;
1331
+		if($point != -1) {
1332
+			$point = 1;
1333
+		}
1215 1334
 
1216 1335
 		$oDocumentModel = getModel('document');
1217 1336
 		$columnList = array('document_srl', 'module_srl');
1218 1337
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1219 1338
 		$module_srl = $oDocument->get('module_srl');
1220
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
1339
+		if(!$module_srl) {
1340
+			return new Object(-1, 'msg_invalid_request');
1341
+		}
1221 1342
 
1222 1343
 		$oModuleModel = getModel('module');
1223 1344
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1224 1345
 		if($point == -1)
1225 1346
 		{
1226
-			if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request');
1347
+			if($document_config->use_vote_down!='S') {
1348
+				return new Object(-1, 'msg_invalid_request');
1349
+			}
1227 1350
 			$args->below_point = 0;
1228
-		}
1229
-		else
1351
+		} else
1230 1352
 		{
1231
-			if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request');
1353
+			if($document_config->use_vote_up!='S') {
1354
+				return new Object(-1, 'msg_invalid_request');
1355
+			}
1232 1356
 			$args->more_point = 0;
1233 1357
 		}
1234 1358
 
1235 1359
 		$args->document_srl = $document_srl;
1236 1360
 
1237 1361
 		$output = executeQueryArray('document.getVotedMemberList',$args);
1238
-		if(!$output->toBool()) return $output;
1362
+		if(!$output->toBool()) {
1363
+			return $output;
1364
+		}
1239 1365
 
1240 1366
 		$oMemberModel = getModel('member');
1241 1367
 		if($output->data)
@@ -1257,9 +1383,11 @@  discard block
 block discarded – undo
1257 1383
 	function getStatusNameList()
1258 1384
 	{
1259 1385
 		global $lang;
1260
-		if(!isset($lang->status_name_list))
1261
-			return array_flip($this->getStatusList());
1262
-		else return $lang->status_name_list;
1386
+		if(!isset($lang->status_name_list)) {
1387
+					return array_flip($this->getStatusList());
1388
+		} else {
1389
+			return $lang->status_name_list;
1390
+		}
1263 1391
 	}
1264 1392
 
1265 1393
 	/**
@@ -1283,20 +1411,22 @@  discard block
 block discarded – undo
1283 1411
 				if (!$extra_output->data || !$extra_output->toBool())
1284 1412
 				{
1285 1413
 					$sortIndex = 'list_order';
1286
-				}
1287
-				else
1414
+				} else
1288 1415
 				{
1289 1416
 					$check_array = array();
1290 1417
 					foreach($extra_output->data as $val)
1291 1418
 					{
1292 1419
 						$check_array[] = $val->eid;
1293 1420
 					}
1294
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1295
-					else $isExtraVars = true;
1421
+					if(!in_array($sortIndex, $check_array)) {
1422
+						$sortIndex = 'list_order';
1423
+					} else {
1424
+						$isExtraVars = true;
1425
+					}
1296 1426
 				}
1427
+			} else {
1428
+							$sortIndex = 'list_order';
1297 1429
 			}
1298
-			else
1299
-				$sortIndex = 'list_order';
1300 1430
 		}
1301 1431
 		$returnObj = new stdClass();
1302 1432
 		$returnObj->sort_index = $sortIndex;
@@ -1334,7 +1464,9 @@  discard block
 block discarded – undo
1334 1464
 
1335 1465
 		// Check the target and sequence alignment
1336 1466
 		$orderType = array('desc' => 1, 'asc' => 1);
1337
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1467
+		if(!isset($orderType[$args->order_type])) {
1468
+			$args->order_type = 'asc';
1469
+		}
1338 1470
 
1339 1471
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1340 1472
 		if($searchOpt->mid)
@@ -1345,21 +1477,29 @@  discard block
 block discarded – undo
1345 1477
 		}
1346 1478
 
1347 1479
 		// Module_srl passed the array may be a check whether the array
1348
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1349
-		else $args->module_srl = $searchOpt->module_srl;
1480
+		if(is_array($searchOpt->module_srl)) {
1481
+			$args->module_srl = implode(',', $searchOpt->module_srl);
1482
+		} else {
1483
+			$args->module_srl = $searchOpt->module_srl;
1484
+		}
1350 1485
 
1351 1486
 		// Except for the test module_srl
1352
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1353
-		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1487
+		if(is_array($searchOpt->exclude_module_srl)) {
1488
+			$args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1489
+		} else {
1490
+			$args->exclude_module_srl = $searchOpt->exclude_module_srl;
1491
+		}
1354 1492
 
1355 1493
 		// only admin document list, temp document showing
1356
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1357
-		else
1494
+		if($searchOpt->statusList) {
1495
+			$args->statusList = $searchOpt->statusList;
1496
+		} else
1358 1497
 		{
1359
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1360
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1361
-			else
1362
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1498
+			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) {
1499
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1500
+			} else {
1501
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1502
+			}
1363 1503
 		}
1364 1504
 
1365 1505
 		// Category is selected, further sub-categories until all conditions
@@ -1387,18 +1527,24 @@  discard block
 block discarded – undo
1387 1527
 			{
1388 1528
 				case 'title' :
1389 1529
 				case 'content' :
1390
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1530
+					if($search_keyword) {
1531
+						$search_keyword = str_replace(' ','%',$search_keyword);
1532
+					}
1391 1533
 					$args->{"s_".$search_target} = $search_keyword;
1392 1534
 					$use_division = true;
1393 1535
 					break;
1394 1536
 				case 'title_content' :
1395
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1537
+					if($search_keyword) {
1538
+						$search_keyword = str_replace(' ','%',$search_keyword);
1539
+					}
1396 1540
 					$args->s_title = $search_keyword;
1397 1541
 					$args->s_content = $search_keyword;
1398 1542
 					$use_division = true;
1399 1543
 					break;
1400 1544
 				case 'user_id' :
1401
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1545
+					if($search_keyword) {
1546
+						$search_keyword = str_replace(' ','%',$search_keyword);
1547
+					}
1402 1548
 					$args->s_user_id = $search_keyword;
1403 1549
 					$args->sort_index = 'documents.'.$args->sort_index;
1404 1550
 					break;
@@ -1406,18 +1552,28 @@  discard block
 block discarded – undo
1406 1552
 				case 'nick_name' :
1407 1553
 				case 'email_address' :
1408 1554
 				case 'homepage' :
1409
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1555
+					if($search_keyword) {
1556
+						$search_keyword = str_replace(' ','%',$search_keyword);
1557
+					}
1410 1558
 					$args->{"s_".$search_target} = $search_keyword;
1411 1559
 					break;
1412 1560
 				case 'is_notice' :
1413
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1414
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1415
-					else $args->{"s_".$search_target} = '';
1561
+					if($search_keyword=='N') {
1562
+						$args->{"s_".$search_target} = 'N';
1563
+					} elseif($search_keyword=='Y') {
1564
+						$args->{"s_".$search_target} = 'Y';
1565
+					} else {
1566
+						$args->{"s_".$search_target} = '';
1567
+					}
1416 1568
 					break;
1417 1569
 				case 'is_secret' :
1418
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1419
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1420
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1570
+					if($search_keyword=='N') {
1571
+						$args->statusList = array($this->getConfigStatus('public'));
1572
+					} elseif($search_keyword=='Y') {
1573
+						$args->statusList = array($this->getConfigStatus('secret'));
1574
+					} elseif($search_keyword=='temp') {
1575
+						$args->statusList = array($this->getConfigStatus('temp'));
1576
+					}
1421 1577
 					break;
1422 1578
 				case 'member_srl' :
1423 1579
 				case 'readed_count' :
@@ -1462,13 +1618,14 @@  discard block
 block discarded – undo
1462 1618
 		if ($searchOpt->isExtraVars)
1463 1619
 		{
1464 1620
 			$query_id = 'document.getDocumentListExtraSort';
1465
-		}
1466
-		else
1621
+		} else
1467 1622
 		{
1468 1623
 			/**
1469 1624
 			 * list_order asc sort of division that can be used only when
1470 1625
 			 */
1471
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1626
+			if($args->sort_index != 'list_order' || $args->order_type != 'asc') {
1627
+				$use_division = false;
1628
+			}
1472 1629
 
1473 1630
 			/**
1474 1631
 			 * If it is true, use_division changed to use the document division
@@ -1483,8 +1640,7 @@  discard block
 block discarded – undo
1483 1640
 				{
1484 1641
 					$listSqlID = 'document.getDocumentListUseIndex';
1485 1642
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
1486
-				}
1487
-				else
1643
+				} else
1488 1644
 				{
1489 1645
 					$listSqlID = 'document.getDocumentList';
1490 1646
 					$divisionSqlID = 'document.getDocumentDivision';
@@ -1541,7 +1697,9 @@  discard block
 block discarded – undo
1541 1697
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1542 1698
 					$last_division_args->list_order = $last_division;
1543 1699
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1544
-					if($output->data->count<1) $last_division = null;
1700
+					if($output->data->count<1) {
1701
+						$last_division = null;
1702
+					}
1545 1703
 				}
1546 1704
 
1547 1705
 				$args->division = $division;
@@ -1582,8 +1740,12 @@  discard block
 block discarded – undo
1582 1740
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1583 1741
 		$document_list = $output->data;
1584 1742
 
1585
-		if(!$document_list) return array();
1586
-		if(!is_array($document_list)) $document_list = array($document_list);
1743
+		if(!$document_list) {
1744
+			return array();
1745
+		}
1746
+		if(!is_array($document_list)) {
1747
+			$document_list = array($document_list);
1748
+		}
1587 1749
 
1588 1750
 		return $document_list;
1589 1751
 	}
@@ -1594,8 +1756,7 @@  discard block
 block discarded – undo
1594 1756
 		if(Mobile::isFromMobilePhone())
1595 1757
 		{
1596 1758
 			$iconSkin = $documentConfig->micons;
1597
-		}
1598
-		else
1759
+		} else
1599 1760
 		{
1600 1761
 			$iconSkin = $documentConfig->icons;
1601 1762
 		}
Please login to merge, or discard this patch.