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
25:01 queued 17:25
created
classes/context/Context.class.php 1 patch
Doc Comments   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	/**
158 158
 	 * returns static context object (Singleton). It's to use Context without declaration of an object
159 159
 	 *
160
-	 * @return object Instance
160
+	 * @return Context Instance
161 161
 	 */
162 162
 	function &getInstance()
163 163
 	{
@@ -886,6 +886,7 @@  discard block
 block discarded – undo
886 886
 	 * Evaluation of xml language file
887 887
 	 *
888 888
 	 * @param string Path of the language file
889
+	 * @param string $path
889 890
 	 * @return void
890 891
 	 */
891 892
 	function _evalxmlLang($path)
@@ -1025,7 +1026,7 @@  discard block
 block discarded – undo
1025 1026
 	/**
1026 1027
 	 * Convert strings of variables in $source_object into UTF-8
1027 1028
 	 *
1028
-	 * @param object $source_obj Conatins strings to convert
1029
+	 * @param stdClass $source_obj Conatins strings to convert
1029 1030
 	 * @return object converted object
1030 1031
 	 */
1031 1032
 	function convertEncoding($source_obj)
@@ -1063,11 +1064,11 @@  discard block
 block discarded – undo
1063 1064
 	/**
1064 1065
 	 * Check flag
1065 1066
 	 *
1066
-	 * @param mixed $val
1067
+	 * @param boolean $val
1067 1068
 	 * @param string $key
1068 1069
 	 * @param mixed $charset charset
1069 1070
 	 * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
1070
-	 * @return void
1071
+	 * @return null|boolean
1071 1072
 	 */
1072 1073
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1073 1074
 	{
@@ -1385,7 +1386,7 @@  discard block
 block discarded – undo
1385 1386
 	 * @see Cast variables, such as _srl, page, and cpage, into interger
1386 1387
 	 * @param string $key Variable key
1387 1388
 	 * @param string $val Variable value
1388
-	 * @param string $do_stripslashes Whether to strip slashes
1389
+	 * @param integer $do_stripslashes Whether to strip slashes
1389 1390
 	 * @return mixed filtered value. Type are string or array
1390 1391
 	 */
1391 1392
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
@@ -1920,7 +1921,7 @@  discard block
 block discarded – undo
1920 1921
 	 *
1921 1922
 	 * @param string $key Key
1922 1923
 	 * @param mixed $val Value
1923
-	 * @param mixed $set_to_get_vars If not FALSE, Set to get vars.
1924
+	 * @param integer $set_to_get_vars If not FALSE, Set to get vars.
1924 1925
 	 * @return void
1925 1926
 	 */
1926 1927
 	function set($key, $val, $set_to_get_vars = 0)
@@ -1962,7 +1963,7 @@  discard block
 block discarded – undo
1962 1963
 	/**
1963 1964
 	 * Get one more vars in object vars with given arguments(key1, key2, key3,...)
1964 1965
 	 *
1965
-	 * @return object
1966
+	 * @return null|stdClass
1966 1967
 	 */
1967 1968
 	function gets()
1968 1969
 	{
@@ -2035,7 +2036,7 @@  discard block
 block discarded – undo
2035 2036
 	/**
2036 2037
 	 * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js
2037 2038
 	 *
2038
-	 * @param string $action act name
2039
+	 * @param string[] $action_array
2039 2040
 	 * @return void
2040 2041
 	 */
2041 2042
 	function addSSLActions($action_array)
@@ -2206,7 +2207,7 @@  discard block
 block discarded – undo
2206 2207
 	 * @param string $file File name with path
2207 2208
 	 * @param string $optimized optimized (That seems to not use)
2208 2209
 	 * @param string $targetie target IE
2209
-	 * @param string $index index
2210
+	 * @param integer $index index
2210 2211
 	 * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
2211 2212
 	 * @param bool $isRuleset Use ruleset
2212 2213
 	 * @param string $autoPath If path not readed, set the path automatically.
@@ -2316,7 +2317,7 @@  discard block
 block discarded – undo
2316 2317
 	 * @param string $optimized optimized (That seems to not use)
2317 2318
 	 * @param string $media Media query
2318 2319
 	 * @param string $targetie target IE
2319
-	 * @param string $index index
2320
+	 * @param integer $index index
2320 2321
 	 * @return void
2321 2322
 	 *
2322 2323
 	 */
Please login to merge, or discard this patch.
modules/document/document.admin.view.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
 		// check current location in admin menu
20 20
 		$oModuleModel = getModel('module');
21 21
 		$info = $oModuleModel->getModuleActionXml('document');
22
-		foreach($info->menu AS $key => $menu)
22
+		foreach ($info->menu AS $key => $menu)
23 23
 		{
24
-			if(in_array($this->act, $menu->acts))
24
+			if (in_array($this->act, $menu->acts))
25 25
 			{
26 26
 				Context::set('currentMenu', $key);
27 27
 				break;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 		// set a search option used in the template
68 68
 		$count_search_option = count($this->search_option);
69
-		for($i=0;$i<$count_search_option;$i++)
69
+		for ($i = 0; $i < $count_search_option; $i++)
70 70
 		{
71 71
 			$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
72 72
 		}
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 		$oModuleModel = getModel('module');
76 76
 		$module_list = array();
77 77
 		$mod_srls = array();
78
-		foreach($output->data as $oDocument)
78
+		foreach ($output->data as $oDocument)
79 79
 		{
80 80
 			$mod_srls[] = $oDocument->get('module_srl');
81 81
 		}
82 82
 		$mod_srls = array_unique($mod_srls);
83 83
 		// Module List
84 84
 		$mod_srls_count = count($mod_srls);
85
-		if($mod_srls_count)
85
+		if ($mod_srls_count)
86 86
 		{
87 87
 			$columnList = array('module_srl', 'mid', 'browser_title');
88 88
 			$module_output = $oModuleModel->getModulesInfo($mod_srls, $columnList);
89
-			if($module_output && is_array($module_output))
89
+			if ($module_output && is_array($module_output))
90 90
 			{
91
-				foreach($module_output as $module)
91
+				foreach ($module_output as $module)
92 92
 				{
93 93
 					$module_list[$module->module_srl] = $module;
94 94
 				}
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 		Context::set('config', $config);
116 116
 
117 117
 		$oModuleModel = getModel('module');
118
-		$pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons');
119
-		$mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'm.icons');
118
+		$pcIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'icons');
119
+		$mobileIconSkinList = $oModuleModel->getSkins($this->module_path.'tpl', 'm.icons');
120 120
 
121 121
 		Context::set('pcIconSkinList', $pcIconSkinList);
122 122
 		Context::set('mobileIconSkinList', $mobileIconSkinList);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	function dispDocumentAdminDeclared()
134 134
 	{
135 135
 		// option for a list
136
-		$args =new stdClass();
136
+		$args = new stdClass();
137 137
 		$args->page = Context::get('page'); // /< Page
138 138
 		$args->list_count = 30; // /< the number of posts to display on a single page
139 139
 		$args->page_count = 10; // /< the number of pages that appear in the page navigation
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 
148 148
 		// get a list
149 149
 		$declared_output = executeQuery('document.getDeclaredList', $args);
150
-		if($declared_output->data && count($declared_output->data))
150
+		if ($declared_output->data && count($declared_output->data))
151 151
 		{
152 152
 			$document_list = array();
153 153
 
154
-			foreach($declared_output->data as $key => $document)
154
+			foreach ($declared_output->data as $key => $document)
155 155
 			{
156 156
 				$document_list[$key] = new documentItem();
157 157
 				$document_list[$key]->setAttribute($document);
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 	function dispDocumentAdminAlias()
179 179
 	{
180 180
 		$args->document_srl = Context::get('document_srl');
181
-		if(!$args->document_srl) return $this->dispDocumentAdminList();
181
+		if (!$args->document_srl) return $this->dispDocumentAdminList();
182 182
 
183 183
 		$oModel = getModel('document');
184 184
 		$oDocument = $oModel->getDocument($args->document_srl);
185
-		if(!$oDocument->isExists()) return $this->dispDocumentAdminList();
185
+		if (!$oDocument->isExists()) return $this->dispDocumentAdminList();
186 186
 		Context::set('oDocument', $oDocument);
187 187
 
188 188
 		$output = executeQueryArray('document.getAliases', $args);
189
-		if(!$output->data)
189
+		if (!$output->data)
190 190
 		{
191 191
 			$aliases = array();
192 192
 		}
Please login to merge, or discard this patch.
modules/document/document.item.php 2 patches
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,15 +1151,16 @@  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->icons;
1043
-		}
1044
-		else
1163
+		} else
1045 1164
 		{
1046 1165
 			$iconSkin = $documentConfig->micons;
1047 1166
 		}
@@ -1049,7 +1168,9 @@  discard block
 block discarded – undo
1049 1168
 		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1050 1169
 
1051 1170
 		$buffs = $this->getExtraImages($time_check);
1052
-		if(!count($buffs)) return;
1171
+		if(!count($buffs)) {
1172
+			return;
1173
+		}
1053 1174
 
1054 1175
 		$buff = array();
1055 1176
 		foreach($buffs as $key => $val)
@@ -1061,18 +1182,28 @@  discard block
 block discarded – undo
1061 1182
 
1062 1183
 	function hasUploadedFiles()
1063 1184
 	{
1064
-		if(!$this->document_srl) return;
1185
+		if(!$this->document_srl) {
1186
+			return;
1187
+		}
1065 1188
 
1066
-		if($this->isSecret() && !$this->isGranted()) return false;
1189
+		if($this->isSecret() && !$this->isGranted()) {
1190
+			return false;
1191
+		}
1067 1192
 		return $this->get('uploaded_count')? true : false;
1068 1193
 	}
1069 1194
 
1070 1195
 	function getUploadedFiles($sortIndex = 'file_srl')
1071 1196
 	{
1072
-		if(!$this->document_srl) return;
1197
+		if(!$this->document_srl) {
1198
+			return;
1199
+		}
1073 1200
 
1074
-		if($this->isSecret() && !$this->isGranted()) return;
1075
-		if(!$this->get('uploaded_count')) return;
1201
+		if($this->isSecret() && !$this->isGranted()) {
1202
+			return;
1203
+		}
1204
+		if(!$this->get('uploaded_count')) {
1205
+			return;
1206
+		}
1076 1207
 
1077 1208
 		if(!$this->uploadedFiles[$sortIndex])
1078 1209
 		{
@@ -1090,7 +1221,9 @@  discard block
 block discarded – undo
1090 1221
 	function getEditor()
1091 1222
 	{
1092 1223
 		$module_srl = $this->get('module_srl');
1093
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1224
+		if(!$module_srl) {
1225
+			$module_srl = Context::get('module_srl');
1226
+		}
1094 1227
 
1095 1228
 		$oEditorModel = getModel('editor');
1096 1229
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1104,8 +1237,12 @@  discard block
 block discarded – undo
1104 1237
 	function isEnableComment()
1105 1238
 	{
1106 1239
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1107
-		if (!$this->allowComment()) return false;
1108
-		if(!$this->isGranted() && $this->isSecret()) return false;
1240
+		if (!$this->allowComment()) {
1241
+			return false;
1242
+		}
1243
+		if(!$this->isGranted() && $this->isSecret()) {
1244
+			return false;
1245
+		}
1109 1246
 
1110 1247
 		return true;
1111 1248
 	}
@@ -1116,7 +1253,9 @@  discard block
 block discarded – undo
1116 1253
 	 */
1117 1254
 	function getCommentEditor()
1118 1255
 	{
1119
-		if(!$this->isEnableComment()) return;
1256
+		if(!$this->isEnableComment()) {
1257
+			return;
1258
+		}
1120 1259
 
1121 1260
 		$oEditorModel = getModel('editor');
1122 1261
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1128,10 +1267,14 @@  discard block
 block discarded – undo
1128 1267
 	 */
1129 1268
 	function getProfileImage()
1130 1269
 	{
1131
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1270
+		if(!$this->isExists() || !$this->get('member_srl')) {
1271
+			return;
1272
+		}
1132 1273
 		$oMemberModel = getModel('member');
1133 1274
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1134
-		if(!$profile_info) return;
1275
+		if(!$profile_info) {
1276
+			return;
1277
+		}
1135 1278
 
1136 1279
 		return $profile_info->src;
1137 1280
 	}
@@ -1143,7 +1286,9 @@  discard block
 block discarded – undo
1143 1286
 	function getSignature()
1144 1287
 	{
1145 1288
 		// Pass if a document doesn't exist
1146
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1289
+		if(!$this->isExists() || !$this->get('member_srl')) {
1290
+			return;
1291
+		}
1147 1292
 		// Get signature information
1148 1293
 		$oMemberModel = getModel('member');
1149 1294
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
@@ -1157,7 +1302,9 @@  discard block
 block discarded – undo
1157 1302
 		if($signature)
1158 1303
 		{
1159 1304
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1160
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1305
+			if($max_signature_height) {
1306
+				$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);
1307
+			}
1161 1308
 		}
1162 1309
 
1163 1310
 		return $signature;
@@ -1181,20 +1328,25 @@  discard block
 block discarded – undo
1181 1328
 	function _checkAccessibleFromStatus()
1182 1329
 	{
1183 1330
 		$logged_info = Context::get('logged_info');
1184
-		if($logged_info->is_admin == 'Y') return true;
1331
+		if($logged_info->is_admin == 'Y') {
1332
+			return true;
1333
+		}
1185 1334
 
1186 1335
 		$status = $this->get('status');
1187
-		if(empty($status)) return false;
1336
+		if(empty($status)) {
1337
+			return false;
1338
+		}
1188 1339
 
1189 1340
 		$oDocumentModel = getModel('document');
1190 1341
 		$configStatusList = $oDocumentModel->getStatusList();
1191 1342
 
1192
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1193
-			return true;
1194
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1343
+		if($status == $configStatusList['public'] || $status == $configStatusList['publish']) {
1344
+					return true;
1345
+		} else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1195 1346
 		{
1196
-			if($this->get('member_srl') == $logged_info->member_srl)
1197
-				return true;
1347
+			if($this->get('member_srl') == $logged_info->member_srl) {
1348
+							return true;
1349
+			}
1198 1350
 		}
1199 1351
 		return false;
1200 1352
 	}
Please login to merge, or discard this patch.
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->icons;
1043 1043
 		}
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
 			$iconSkin = $documentConfig->micons;
1047 1047
 		}
1048 1048
 
1049
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1049
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1050 1050
 
1051 1051
 		$buffs = $this->getExtraImages($time_check);
1052
-		if(!count($buffs)) return;
1052
+		if (!count($buffs)) return;
1053 1053
 
1054 1054
 		$buff = array();
1055
-		foreach($buffs as $key => $val)
1055
+		foreach ($buffs as $key => $val)
1056 1056
 		{
1057 1057
 			$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
1058 1058
 		}
@@ -1061,20 +1061,20 @@  discard block
 block discarded – undo
1061 1061
 
1062 1062
 	function hasUploadedFiles()
1063 1063
 	{
1064
-		if(!$this->document_srl) return;
1064
+		if (!$this->document_srl) return;
1065 1065
 
1066
-		if($this->isSecret() && !$this->isGranted()) return false;
1067
-		return $this->get('uploaded_count')? true : false;
1066
+		if ($this->isSecret() && !$this->isGranted()) return false;
1067
+		return $this->get('uploaded_count') ? true : false;
1068 1068
 	}
1069 1069
 
1070 1070
 	function getUploadedFiles($sortIndex = 'file_srl')
1071 1071
 	{
1072
-		if(!$this->document_srl) return;
1072
+		if (!$this->document_srl) return;
1073 1073
 
1074
-		if($this->isSecret() && !$this->isGranted()) return;
1075
-		if(!$this->get('uploaded_count')) return;
1074
+		if ($this->isSecret() && !$this->isGranted()) return;
1075
+		if (!$this->get('uploaded_count')) return;
1076 1076
 
1077
-		if(!$this->uploadedFiles[$sortIndex])
1077
+		if (!$this->uploadedFiles[$sortIndex])
1078 1078
 		{
1079 1079
 			$oFileModel = getModel('file');
1080 1080
 			$this->uploadedFiles[$sortIndex] = $oFileModel->getFiles($this->document_srl, array(), $sortIndex, true);
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 	function getEditor()
1091 1091
 	{
1092 1092
 		$module_srl = $this->get('module_srl');
1093
-		if(!$module_srl) $module_srl = Context::get('module_srl');
1093
+		if (!$module_srl) $module_srl = Context::get('module_srl');
1094 1094
 
1095 1095
 		$oEditorModel = getModel('editor');
1096 1096
 		return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	{
1106 1106
 		// Return false if not authorized, if a secret document, if the document is set not to allow any comment
1107 1107
 		if (!$this->allowComment()) return false;
1108
-		if(!$this->isGranted() && $this->isSecret()) return false;
1108
+		if (!$this->isGranted() && $this->isSecret()) return false;
1109 1109
 
1110 1110
 		return true;
1111 1111
 	}
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	 */
1117 1117
 	function getCommentEditor()
1118 1118
 	{
1119
-		if(!$this->isEnableComment()) return;
1119
+		if (!$this->isEnableComment()) return;
1120 1120
 
1121 1121
 		$oEditorModel = getModel('editor');
1122 1122
 		return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
 	 */
1129 1129
 	function getProfileImage()
1130 1130
 	{
1131
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1131
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1132 1132
 		$oMemberModel = getModel('member');
1133 1133
 		$profile_info = $oMemberModel->getProfileImage($this->get('member_srl'));
1134
-		if(!$profile_info) return;
1134
+		if (!$profile_info) return;
1135 1135
 
1136 1136
 		return $profile_info->src;
1137 1137
 	}
@@ -1143,21 +1143,21 @@  discard block
 block discarded – undo
1143 1143
 	function getSignature()
1144 1144
 	{
1145 1145
 		// Pass if a document doesn't exist
1146
-		if(!$this->isExists() || !$this->get('member_srl')) return;
1146
+		if (!$this->isExists() || !$this->get('member_srl')) return;
1147 1147
 		// Get signature information
1148 1148
 		$oMemberModel = getModel('member');
1149 1149
 		$signature = $oMemberModel->getSignature($this->get('member_srl'));
1150 1150
 		// Check if a maximum height of signiture is set in the member module
1151
-		if(!isset($GLOBALS['__member_signature_max_height']))
1151
+		if (!isset($GLOBALS['__member_signature_max_height']))
1152 1152
 		{
1153 1153
 			$oModuleModel = getModel('module');
1154 1154
 			$member_config = $oModuleModel->getModuleConfig('member');
1155 1155
 			$GLOBALS['__member_signature_max_height'] = $member_config->signature_max_height;
1156 1156
 		}
1157
-		if($signature)
1157
+		if ($signature)
1158 1158
 		{
1159 1159
 			$max_signature_height = $GLOBALS['__member_signature_max_height'];
1160
-			if($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1160
+			if ($max_signature_height) $signature = sprintf('<div style="max-height:%dpx;overflow:auto;overflow-x:hidden;height:expression(this.scrollHeight > %d ? \'%dpx\': \'auto\')">%s</div>', $max_signature_height, $max_signature_height, $max_signature_height, $signature);
1161 1161
 		}
1162 1162
 
1163 1163
 		return $signature;
@@ -1170,7 +1170,7 @@  discard block
 block discarded – undo
1170 1170
 	 */
1171 1171
 	function replaceResourceRealPath($matches)
1172 1172
 	{
1173
-		return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
1173
+		return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]);
1174 1174
 	}
1175 1175
 
1176 1176
 	/**
@@ -1181,19 +1181,19 @@  discard block
 block discarded – undo
1181 1181
 	function _checkAccessibleFromStatus()
1182 1182
 	{
1183 1183
 		$logged_info = Context::get('logged_info');
1184
-		if($logged_info->is_admin == 'Y') return true;
1184
+		if ($logged_info->is_admin == 'Y') return true;
1185 1185
 
1186 1186
 		$status = $this->get('status');
1187
-		if(empty($status)) return false;
1187
+		if (empty($status)) return false;
1188 1188
 
1189 1189
 		$oDocumentModel = getModel('document');
1190 1190
 		$configStatusList = $oDocumentModel->getStatusList();
1191 1191
 
1192
-		if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1192
+		if ($status == $configStatusList['public'] || $status == $configStatusList['publish'])
1193 1193
 			return true;
1194
-		else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1194
+		else if ($status == $configStatusList['private'] || $status == $configStatusList['secret'])
1195 1195
 		{
1196
-			if($this->get('member_srl') == $logged_info->member_srl)
1196
+			if ($this->get('member_srl') == $logged_info->member_srl)
1197 1197
 				return true;
1198 1198
 		}
1199 1199
 		return false;
Please login to merge, or discard this patch.
modules/document/document.model.php 2 patches
Spacing   +232 added lines, -232 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
 	}
Please login to merge, or discard this patch.
Braces   +299 added lines, -137 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
 	}
Please login to merge, or discard this patch.
modules/install/install.admin.controller.php 3 patches
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -294,6 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
 	/**
296 296
 	 * @brief Supported languages (was procInstallAdminSaveLangSelected)
297
+	 * @param string $selected_lang
297 298
 	 */
298 299
 	function saveLangSelected($selected_lang)
299 300
 	{
@@ -312,7 +313,7 @@  discard block
 block discarded – undo
312 313
 
313 314
 	/**
314 315
 	 * Change the way the thumbnails are show.
315
-	 * @param $config
316
+	 * @param stdClass $config
316 317
 	 * @return void
317 318
 	 */
318 319
 	function setModulesConfig($config)
@@ -337,6 +338,10 @@  discard block
 block discarded – undo
337 338
 		$oModuleController->updateModuleConfig('module',$args);
338 339
 	}
339 340
 
341
+	/**
342
+	 * @param string $icon
343
+	 * @param string $iconname
344
+	 */
340 345
 	private function saveIconTmp($icon, $iconname)
341 346
 	{
342 347
 
@@ -383,6 +388,9 @@  discard block
 block discarded – undo
383 388
 		return $relative_filename;
384 389
 	}
385 390
 
391
+	/**
392
+	 * @param string $iconname
393
+	 */
386 394
 	private function updateIcon($iconname, $deleteIcon = false) {
387 395
 
388 396
 		$site_info = Context::get('site_module_info');
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new object(-1, 'invalid_request');
23
+		if (!$module_name) return new object(-1, 'invalid_request');
24 24
 
25 25
 		$oInstallController = getController('install');
26 26
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		@set_time_limit(0);
37 37
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new object(-1, 'invalid_request');
38
+		if (!$module_name) return new object(-1, 'invalid_request');
39 39
 
40 40
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
41
+		if ($oModule) $output = $oModule->moduleUpdate();
42 42
 		else $output = new Object(-1, 'invalid_request');
43 43
 
44 44
 		return $output;
@@ -53,51 +53,51 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$admin_ip_list = Context::get('admin_ip_list');
55 55
 
56
-		if($admin_ip_list)
56
+		if ($admin_ip_list)
57 57
 		{
58
-			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
59
-			$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list);
60
-			if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
58
+			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list);
59
+			$admin_ip_list = preg_replace("/\s+/", "", $admin_ip_list);
60
+			if (preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
61 61
 			{
62 62
 				$admin_ip_list = '';
63 63
 			}
64
-			$admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
65
-			$admin_ip_list = explode(',',trim($admin_ip_list, ','));
64
+			$admin_ip_list .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
65
+			$admin_ip_list = explode(',', trim($admin_ip_list, ','));
66 66
 			$admin_ip_list = array_unique($admin_ip_list);
67
-			if(!IpFilter::validate($admin_ip_list)) {
67
+			if (!IpFilter::validate($admin_ip_list)) {
68 68
 				return new Object(-1, 'msg_invalid_ip');
69 69
 			}
70 70
 		}
71 71
 		
72 72
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
73
+		if ($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
+		if ($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
75 75
 
76 76
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
77
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
78 78
 		$IDN = new idna_convert(array('idn_version' => 2008));
79 79
 		$default_url = $IDN->encode($default_url);
80 80
 
81 81
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
82
+		if (!$use_ssl) $use_ssl = 'none';
83 83
 
84 84
 		$http_port = Context::get('http_port');
85 85
 		$https_port = Context::get('https_port');
86 86
 
87 87
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
88
+		if ($use_rewrite != 'Y') $use_rewrite = 'N';
89 89
 
90 90
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
91
+		if ($use_sso != 'Y') $use_sso = 'N';
92 92
 
93 93
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
94
+		if ($use_db_session != 'Y') $use_db_session = 'N';
95 95
 
96 96
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
97
+		if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N';
98 98
 
99 99
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
100
+		if (!$use_html5) $use_html5 = 'N';
101 101
 
102 102
 		$db_info->default_url = $default_url;
103 103
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 		$db_info->use_html5 = $use_html5;
109 109
 		$db_info->admin_ip_list = $admin_ip_list;
110 110
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
111
+		if ($http_port) $db_info->http_port = (int) $http_port;
112
+		else if ($db_info->http_port) unset($db_info->http_port);
113 113
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
114
+		if ($https_port) $db_info->https_port = (int) $https_port;
115
+		else if ($db_info->https_port) unset($db_info->https_port);
116 116
 
117 117
 		unset($db_info->lang_type);
118 118
 
119 119
 		$oInstallController = getController('install');
120
-		if(!$oInstallController->makeConfigFile())
120
+		if (!$oInstallController->makeConfigFile())
121 121
 		{
122 122
 			return new Object(-1, 'msg_invalid_request');
123 123
 		}
124 124
 		else
125 125
 		{
126 126
 			Context::setDBInfo($db_info);
127
-			if($default_url)
127
+			if ($default_url)
128 128
 			{
129 129
 				$site_args = new stdClass;
130 130
 				$site_args->site_srl = 0;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 	function procInstallAdminUpdateIndexModule()
140 140
 	{
141
-		if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
141
+		if (!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
142 142
 		{
143 143
 			return new Object(-1, 'msg_invalid_request');
144 144
 		}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		// update homeSitemap.php cache file
158 158
 		$oMenuAdminController = getAdminController('menu');
159 159
 		$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
160
-		if(file_exists($homeMenuCacheFile))
160
+		if (file_exists($homeMenuCacheFile))
161 161
 		{
162 162
 			include($homeMenuCacheFile);
163 163
 		}
164 164
 
165
-		if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
165
+		if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
166 166
 		{
167 167
 			$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
168 168
 		}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	function procInstallAdminRemoveFTPInfo()
174 174
 	{
175 175
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
176
+		if (file_exists($ftp_config_file)) unlink($ftp_config_file);
177
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
178 178
 		$this->setMessage('success_deleted');
179 179
 	}
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 186
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 187
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
188
+		if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
189 189
 		$ftp_info->sftp = Context::get('sftp');
190 190
 
191 191
 		$ftp_root_path = Context::get('ftp_root_path');
192
-		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
192
+		if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/")
193 193
 		{
194 194
 			$ftp_info->ftp_root_path = $ftp_root_path;
195 195
 		}
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 199
 		}
200 200
 
201
-		if(ini_get('safe_mode'))
201
+		if (ini_get('safe_mode'))
202 202
 		{
203 203
 			$ftp_info->ftp_password = Context::get('ftp_password');
204 204
 		}
205 205
 
206 206
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207
-		foreach($ftp_info as $key => $val)
207
+		foreach ($ftp_info as $key => $val)
208 208
 		{
209
-			if(!$val) continue;
210
-			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
209
+			if (!$val) continue;
210
+			if (preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 211
 			{
212 212
 				continue;
213 213
 			}
214
-			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
214
+			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
215 215
 		}
216 216
 		$buff .= "?>";
217 217
 		$config_file = Context::getFTPConfigFile();
218 218
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
219
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
220 220
 
221 221
 		$this->setMessage('success_updated');
222 222
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	function procInstallAdminConfig()
227 227
 	{
228 228
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
229
+		if ($use_mobile_view != 'Y') $use_mobile_view = 'N';
230 230
 
231 231
 		$time_zone = Context::get('time_zone');
232 232
 
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		unset($db_info->lang_type);
238 238
 		Context::setDBInfo($db_info);
239 239
 		$oInstallController = getController('install');
240
-		if(!$oInstallController->makeConfigFile())
240
+		if (!$oInstallController->makeConfigFile())
241 241
 		{
242 242
 			return new Object(-1, 'msg_invalid_request');
243 243
 		}
244 244
 
245 245
 		$site_args = new stdClass();
246 246
 		$site_args->site_srl = 0;
247
-		$site_args->index_module_srl = Context::get('index_module_srl');//
248
-		$site_args->default_language = Context::get('change_lang_type');//
247
+		$site_args->index_module_srl = Context::get('index_module_srl'); //
248
+		$site_args->default_language = Context::get('change_lang_type'); //
249 249
 		$oModuleController = getController('module');
250 250
 		$oModuleController->updateSite($site_args);
251 251
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		$deleteFavicon = Context::get('is_delete_favicon');
258 258
 		$deleteMobicon = Context::get('is_delete_mobicon');
259 259
 
260
-		$this->updateIcon('favicon.ico',$deleteFavicon);
261
-		$this->updateIcon('mobicon.png',$deleteMobicon);
260
+		$this->updateIcon('favicon.ico', $deleteFavicon);
261
+		$this->updateIcon('mobicon.png', $deleteMobicon);
262 262
 
263 263
 		//모듈 설정 저장(썸네일, 풋터스크립트)
264 264
 		$config = new stdClass();
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 
277 277
 		$favicon = Context::get('favicon');
278 278
 		$mobicon = Context::get('mobicon');
279
-		if(!$favicon && !$mobicon) {
279
+		if (!$favicon && !$mobicon) {
280 280
 			Context::set('msg', Context::getLang("msg_invalid_format"));
281 281
 			return;
282 282
 		}
283
-		if($favicon) {
283
+		if ($favicon) {
284 284
 			$name = 'favicon';
285
-			$tmpFileName = $this->saveIconTmp($favicon,'favicon.ico');
285
+			$tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico');
286 286
 		} else {
287 287
 			$name = 'mobicon';
288
-			$tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png');
288
+			$tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png');
289 289
 		}
290 290
 
291 291
 		Context::set('name', $name);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 		$lang_supported = Context::loadLangSupported();
303 303
 		$buff = null;
304
-		for($i=0;$i<count($langs);$i++)
304
+		for ($i = 0; $i < count($langs); $i++)
305 305
 		{
306 306
 			$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
307 307
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 
331 331
 		$oModuleController = getController('module');
332
-		$oModuleController->insertModuleConfig('document',$documentConfig);
332
+		$oModuleController->insertModuleConfig('document', $documentConfig);
333 333
 
334 334
 		$args = new stdClass;
335 335
 		$args->htmlFooter = $config->htmlFooter;
336 336
 		$args->siteTitle = $config->siteTitle;
337
-		$oModuleController->updateModuleConfig('module',$args);
337
+		$oModuleController->updateModuleConfig('module', $args);
338 338
 	}
339 339
 
340 340
 	private function saveIconTmp($icon, $iconname)
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 
343 343
 		$site_info = Context::get('site_module_info');
344 344
 		$virtual_site = '';
345
-		if($site_info->site_srl) 
345
+		if ($site_info->site_srl) 
346 346
 		{
347
-			$virtual_site = $site_info->site_srl . '/';
347
+			$virtual_site = $site_info->site_srl.'/';
348 348
 		}
349 349
 
350 350
 		$target_file = $icon['tmp_name'];
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
 		$target_filename = _XE_PATH_.$relative_filename;
354 354
 
355 355
 		list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
356
-		if($iconname == 'favicon.ico')
356
+		if ($iconname == 'favicon.ico')
357 357
 		{
358
-			if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) {
358
+			if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) {
359 359
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 360
 				return;
361 361
 			}
362 362
 		}
363
-		else if($iconname == 'mobicon.png')
363
+		else if ($iconname == 'mobicon.png')
364 364
 		{
365
-			if(!preg_match('/^.*(png).*$/',$type)) {
365
+			if (!preg_match('/^.*(png).*$/', $type)) {
366 366
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
367 367
 				return;
368 368
 			}
369
-			if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
369
+			if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
370 370
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 371
 				return;
372 372
 			}
@@ -387,21 +387,21 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$site_info = Context::get('site_module_info');
389 389
 		$virtual_site = '';
390
-		if($site_info->site_srl) 
390
+		if ($site_info->site_srl) 
391 391
 		{
392
-			$virtual_site = $site_info->site_srl . '/';
392
+			$virtual_site = $site_info->site_srl.'/';
393 393
 		}
394 394
 
395
-		$image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site;
395
+		$image_filepath = _XE_PATH_.'files/attach/xeicon/'.$virtual_site;
396 396
 
397
-		if($deleteIcon) {
397
+		if ($deleteIcon) {
398 398
 			FileHandler::removeFile($image_filepath.$iconname);
399 399
 			return;
400 400
 		}
401 401
 
402 402
 		$tmpicon_filepath = $image_filepath.'tmp/'.$iconname;
403 403
 		$icon_filepath = $image_filepath.$iconname;
404
-		if(file_exists($tmpicon_filepath))
404
+		if (file_exists($tmpicon_filepath))
405 405
 		{
406 406
 			FileHandler::moveFile($tmpicon_filepath, $icon_filepath);
407 407
 		}
Please login to merge, or discard this patch.
Braces   +68 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new object(-1, 'invalid_request');
23
+		if(!$module_name) {
24
+			return new object(-1, 'invalid_request');
25
+		}
24 26
 
25 27
 		$oInstallController = getController('install');
26 28
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,11 +37,16 @@  discard block
 block discarded – undo
35 37
 	{
36 38
 		@set_time_limit(0);
37 39
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new object(-1, 'invalid_request');
40
+		if(!$module_name) {
41
+			return new object(-1, 'invalid_request');
42
+		}
39 43
 
40 44
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
42
-		else $output = new Object(-1, 'invalid_request');
45
+		if($oModule) {
46
+			$output = $oModule->moduleUpdate();
47
+		} else {
48
+			$output = new Object(-1, 'invalid_request');
49
+		}
43 50
 
44 51
 		return $output;
45 52
 	}
@@ -70,8 +77,12 @@  discard block
 block discarded – undo
70 77
 		}
71 78
 		
72 79
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
80
+		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) {
81
+			$default_url = 'http://'.$default_url;
82
+		}
83
+		if($default_url && substr($default_url, -1) !== '/') {
84
+			$default_url = $default_url.'/';
85
+		}
75 86
 
76 87
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77 88
 		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
@@ -79,25 +90,37 @@  discard block
 block discarded – undo
79 90
 		$default_url = $IDN->encode($default_url);
80 91
 
81 92
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
93
+		if(!$use_ssl) {
94
+			$use_ssl = 'none';
95
+		}
83 96
 
84 97
 		$http_port = Context::get('http_port');
85 98
 		$https_port = Context::get('https_port');
86 99
 
87 100
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
101
+		if($use_rewrite!='Y') {
102
+			$use_rewrite = 'N';
103
+		}
89 104
 
90 105
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
106
+		if($use_sso !='Y') {
107
+			$use_sso = 'N';
108
+		}
92 109
 
93 110
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
111
+		if($use_db_session!='Y') {
112
+			$use_db_session = 'N';
113
+		}
95 114
 
96 115
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
116
+		if($qmail_compatibility!='Y') {
117
+			$qmail_compatibility = 'N';
118
+		}
98 119
 
99 120
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
121
+		if(!$use_html5) {
122
+			$use_html5 = 'N';
123
+		}
101 124
 
102 125
 		$db_info->default_url = $default_url;
103 126
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,11 +131,17 @@  discard block
 block discarded – undo
108 131
 		$db_info->use_html5 = $use_html5;
109 132
 		$db_info->admin_ip_list = $admin_ip_list;
110 133
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
134
+		if($http_port) {
135
+			$db_info->http_port = (int) $http_port;
136
+		} else if($db_info->http_port) {
137
+			unset($db_info->http_port);
138
+		}
113 139
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
140
+		if($https_port) {
141
+			$db_info->https_port = (int) $https_port;
142
+		} else if($db_info->https_port) {
143
+			unset($db_info->https_port);
144
+		}
116 145
 
117 146
 		unset($db_info->lang_type);
118 147
 
@@ -120,8 +149,7 @@  discard block
 block discarded – undo
120 149
 		if(!$oInstallController->makeConfigFile())
121 150
 		{
122 151
 			return new Object(-1, 'msg_invalid_request');
123
-		}
124
-		else
152
+		} else
125 153
 		{
126 154
 			Context::setDBInfo($db_info);
127 155
 			if($default_url)
@@ -173,8 +201,12 @@  discard block
 block discarded – undo
173 201
 	function procInstallAdminRemoveFTPInfo()
174 202
 	{
175 203
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
204
+		if(file_exists($ftp_config_file)) {
205
+			unlink($ftp_config_file);
206
+		}
207
+		if($_SESSION['ftp_password']) {
208
+			unset($_SESSION['ftp_password']);
209
+		}
178 210
 		$this->setMessage('success_deleted');
179 211
 	}
180 212
 
@@ -185,15 +217,16 @@  discard block
 block discarded – undo
185 217
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 218
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 219
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
220
+		if(!$ftp_info->ftp_pasv) {
221
+			$ftp_info->ftp_pasv = "N";
222
+		}
189 223
 		$ftp_info->sftp = Context::get('sftp');
190 224
 
191 225
 		$ftp_root_path = Context::get('ftp_root_path');
192 226
 		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
193 227
 		{
194 228
 			$ftp_info->ftp_root_path = $ftp_root_path;
195
-		}
196
-		else
229
+		} else
197 230
 		{
198 231
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 232
 		}
@@ -206,7 +239,9 @@  discard block
 block discarded – undo
206 239
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207 240
 		foreach($ftp_info as $key => $val)
208 241
 		{
209
-			if(!$val) continue;
242
+			if(!$val) {
243
+				continue;
244
+			}
210 245
 			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 246
 			{
212 247
 				continue;
@@ -216,7 +251,9 @@  discard block
 block discarded – undo
216 251
 		$buff .= "?>";
217 252
 		$config_file = Context::getFTPConfigFile();
218 253
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
254
+		if($_SESSION['ftp_password']) {
255
+			unset($_SESSION['ftp_password']);
256
+		}
220 257
 
221 258
 		$this->setMessage('success_updated');
222 259
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +263,9 @@  discard block
 block discarded – undo
226 263
 	function procInstallAdminConfig()
227 264
 	{
228 265
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
266
+		if($use_mobile_view!='Y') {
267
+			$use_mobile_view = 'N';
268
+		}
230 269
 
231 270
 		$time_zone = Context::get('time_zone');
232 271
 
@@ -322,8 +361,7 @@  discard block
 block discarded – undo
322 361
 		if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio')
323 362
 		{
324 363
 			$documentConfig->thumbnail_type = 'crop';
325
-		}
326
-		else
364
+		} else
327 365
 		{
328 366
 			$documentConfig->thumbnail_type = 'ratio';
329 367
 		}
@@ -359,8 +397,7 @@  discard block
 block discarded – undo
359 397
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 398
 				return;
361 399
 			}
362
-		}
363
-		else if($iconname == 'mobicon.png')
400
+		} else if($iconname == 'mobicon.png')
364 401
 		{
365 402
 			if(!preg_match('/^.*(png).*$/',$type)) {
366 403
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
@@ -370,8 +407,7 @@  discard block
 block discarded – undo
370 407
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 408
 				return;
372 409
 			}
373
-		}
374
-		else
410
+		} else
375 411
 		{
376 412
 			Context::set('msg', Context::getLang('msg_invalid_format'));
377 413
 			return;
Please login to merge, or discard this patch.
modules/document/document.admin.controller.php 1 patch
Spacing   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@  discard block
 block discarded – undo
27 27
 	{
28 28
 		// error appears if no doc is selected
29 29
 		$cart = Context::get('cart');
30
-		if(!$cart) return $this->stop('msg_cart_is_null');
31
-		$document_srl_list= explode('|@|', $cart);
30
+		if (!$cart) return $this->stop('msg_cart_is_null');
31
+		$document_srl_list = explode('|@|', $cart);
32 32
 		$document_count = count($document_srl_list);
33
-		if(!$document_count) return $this->stop('msg_cart_is_null');
33
+		if (!$document_count) return $this->stop('msg_cart_is_null');
34 34
 		// Delete a doc
35 35
 		$oDocumentController = getController('document');
36
-		for($i=0;$i<$document_count;$i++)
36
+		for ($i = 0; $i < $document_count; $i++)
37 37
 		{
38 38
 			$document_srl = trim($document_srl_list[$i]);
39
-			if(!$document_srl) continue;
39
+			if (!$document_srl) continue;
40 40
 
41 41
 			$oDocumentController->deleteDocument($document_srl, true);
42 42
 		}
43 43
 
44
-		$this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
44
+		$this->setMessage(sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count));
45 45
 	}
46 46
 
47 47
 	/**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
55 55
 	{
56
-		if(!count($document_srl_list)) return;
56
+		if (!count($document_srl_list)) return;
57 57
 
58 58
 		$oDocumentModel = getModel('document');
59 59
 		$oDocumentController = getController('document');
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 		$oDB->begin();
63 63
 
64 64
 		$triggerObj = new stdClass();
65
-		$triggerObj->document_srls = implode(',',$document_srl_list);
65
+		$triggerObj->document_srls = implode(',', $document_srl_list);
66 66
 		$triggerObj->module_srl = $module_srl;
67 67
 		$triggerObj->category_srl = $category_srl;
68 68
 		// Call a trigger (before)
69 69
 		$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
70
-		if(!$output->toBool())
70
+		if (!$output->toBool())
71 71
 		{
72 72
 			$oDB->rollback();
73 73
 			return $output;
74 74
 		}
75 75
 
76
-		for($i=count($document_srl_list)-1;$i>=0;$i--)
76
+		for ($i = count($document_srl_list) - 1; $i >= 0; $i--)
77 77
 		{
78 78
 			$document_srl = $document_srl_list[$i];
79 79
 			$oDocument = $oDocumentModel->getDocument($document_srl);
80
-			if(!$oDocument->isExists()) continue;
80
+			if (!$oDocument->isExists()) continue;
81 81
 
82 82
 			$source_category_srl = $oDocument->get('category_srl');
83 83
 
@@ -90,27 +90,27 @@  discard block
 block discarded – undo
90 90
 			$obj->content = $output_ori->data->content;
91 91
 
92 92
 			// Move the attached file if the target module is different
93
-			if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles())
93
+			if ($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles())
94 94
 			{
95 95
 				$oFileController = getController('file');
96 96
 
97 97
 				$files = $oDocument->getUploadedFiles();
98 98
 				$delete_file_srls = array();
99
-				if(is_array($files))
99
+				if (is_array($files))
100 100
 				{
101
-					foreach($files as $val)
101
+					foreach ($files as $val)
102 102
 					{
103 103
 						$file_info = array();
104 104
 						$file_info['tmp_name'] = $val->uploaded_filename;
105 105
 						$file_info['name'] = $val->source_filename;
106 106
 						$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
107
-						if($inserted_file && $inserted_file->toBool())
107
+						if ($inserted_file && $inserted_file->toBool())
108 108
 						{
109 109
 							// for image/video files
110
-							if($val->direct_download == 'Y')
110
+							if ($val->direct_download == 'Y')
111 111
 							{
112
-								$source_filename = substr($val->uploaded_filename,2);
113
-								$target_filename = substr($inserted_file->get('uploaded_filename'),2);
112
+								$source_filename = substr($val->uploaded_filename, 2);
113
+								$target_filename = substr($inserted_file->get('uploaded_filename'), 2);
114 114
 								$obj->content = str_replace($source_filename, $target_filename, $obj->content);
115 115
 								// For binary files
116 116
 							}
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 				$oFileController->setFilesValid($obj->document_srl);
130 130
 			}
131 131
 
132
-			if($module_srl != $obj->module_srl)
132
+			if ($module_srl != $obj->module_srl)
133 133
 			{
134 134
 				$oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
135 135
 			}
@@ -137,48 +137,48 @@  discard block
 block discarded – undo
137 137
 			$obj->module_srl = $module_srl;
138 138
 			$obj->category_srl = $category_srl;
139 139
 			$output = executeQuery('document.updateDocumentModule', $obj);
140
-			if(!$output->toBool()) {
140
+			if (!$output->toBool()) {
141 141
 				$oDB->rollback();
142 142
 				return $output;
143 143
 			}
144 144
 
145 145
 			//Move a module of the extra vars
146 146
 			$output = executeQuery('document.moveDocumentExtraVars', $obj);
147
-			if(!$output->toBool()) {
147
+			if (!$output->toBool()) {
148 148
 				$oDB->rollback();
149 149
 				return $output;
150 150
 			}
151 151
 			// Set 0 if a new category doesn't exist after catergory change
152
-			if($source_category_srl != $category_srl)
152
+			if ($source_category_srl != $category_srl)
153 153
 			{
154
-				if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
155
-				if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
154
+				if ($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
155
+				if ($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
156 156
 			}
157 157
 		}
158 158
 
159 159
 		$args = new stdClass();
160
-		$args->document_srls = implode(',',$document_srl_list);
160
+		$args->document_srls = implode(',', $document_srl_list);
161 161
 		$args->module_srl = $module_srl;
162 162
 		// move the comment
163 163
 		$output = executeQuery('comment.updateCommentModule', $args);
164
-		if(!$output->toBool())
164
+		if (!$output->toBool())
165 165
 		{
166 166
 			$oDB->rollback();
167 167
 			return $output;
168 168
 		}
169 169
 
170 170
 		$output = executeQuery('comment.updateCommentListModule', $args);
171
-		if(!$output->toBool())
171
+		if (!$output->toBool())
172 172
 		{
173 173
 			$oDB->rollback();
174 174
 			return $output;
175 175
 		}
176 176
 		
177 177
 		// move the trackback
178
-		if(getClass('trackback'))
178
+		if (getClass('trackback'))
179 179
 		{
180 180
 			$output = executeQuery('trackback.updateTrackbackModule', $args);
181
-			if(!$output->toBool())
181
+			if (!$output->toBool())
182 182
 			{
183 183
 				$oDB->rollback();
184 184
 				return $output;
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
 
188 188
 		// Tags
189 189
 		$output = executeQuery('tag.updateTagModule', $args);
190
-		if(!$output->toBool())
190
+		if (!$output->toBool())
191 191
 		{
192 192
 			$oDB->rollback();
193 193
 			return $output;
194 194
 		}
195 195
 		// Call a trigger (before)
196 196
 		$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
197
-		if(!$output->toBool())
197
+		if (!$output->toBool())
198 198
 		{
199 199
 			$oDB->rollback();
200 200
 			return $output;
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 		$oDB->commit();
204 204
 		//remove from cache
205 205
 		$oCacheHandler = CacheHandler::getInstance('object');
206
-		if($oCacheHandler->isSupport())
206
+		if ($oCacheHandler->isSupport())
207 207
 		{
208
-			foreach($document_srl_list as $document_srl)
208
+			foreach ($document_srl_list as $document_srl)
209 209
 			{
210
-				$cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
210
+				$cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl;
211 211
 				$oCacheHandler->delete($cache_key_item);
212 212
 			}
213 213
 		}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	function copyDocumentModule($document_srl_list, $module_srl, $category_srl)
225 225
 	{
226
-		if(count($document_srl_list) < 1) return;
226
+		if (count($document_srl_list) < 1) return;
227 227
 
228 228
 		$oDocumentModel = getModel('document');
229 229
 		$oDocumentController = getController('document');
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
 		$oDB->begin();
235 235
 
236 236
 		$triggerObj = new stdClass();
237
-		$triggerObj->document_srls = implode(',',$document_srl_list);
237
+		$triggerObj->document_srls = implode(',', $document_srl_list);
238 238
 		$triggerObj->module_srl = $module_srl;
239 239
 		$triggerObj->category_srl = $category_srl;
240 240
 		// Call a trigger (before)
241 241
 		$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'before', $triggerObj);
242
-		if(!$output->toBool())
242
+		if (!$output->toBool())
243 243
 		{
244 244
 			$oDB->rollback();
245 245
 			return $output;
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 
248 248
 		$extraVarsList = $oDocumentModel->getDocumentExtraVarsFromDB($document_srl_list);
249 249
 		$extraVarsListByDocumentSrl = array();
250
-		if(is_array($extraVarsList->data))
250
+		if (is_array($extraVarsList->data))
251 251
 		{
252
-			foreach($extraVarsList->data as $value)
252
+			foreach ($extraVarsList->data as $value)
253 253
 			{
254
-				if(!isset($extraVarsListByDocumentSrl[$value->document_srl]))
254
+				if (!isset($extraVarsListByDocumentSrl[$value->document_srl]))
255 255
 				{
256 256
 					$extraVarsListByDocumentSrl[$value->document_srl] = array();
257 257
 				}
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 			}
261 261
 		}
262 262
 
263
-		for($i=count($document_srl_list)-1;$i>=0;$i--)
263
+		for ($i = count($document_srl_list) - 1; $i >= 0; $i--)
264 264
 		{
265 265
 			$document_srl = $document_srl_list[$i];
266 266
 			$oDocument = $oDocumentModel->getDocument($document_srl);
267
-			if(!$oDocument->isExists()) continue;
267
+			if (!$oDocument->isExists()) continue;
268 268
 
269 269
 			$obj = $oDocument->getObjectVars();
270 270
 
271 271
 			$extraVars = $extraVarsListByDocumentSrl[$document_srl];
272
-			if($module_srl == $obj->module_srl)
272
+			if ($module_srl == $obj->module_srl)
273 273
 			{
274
-				if(is_array($extraVars))
274
+				if (is_array($extraVars))
275 275
 				{
276
-					foreach($extraVars as $extraItem)
276
+					foreach ($extraVars as $extraItem)
277 277
 					{
278
-						if($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
278
+						if ($extraItem->var_idx >= 0) $obj->{'extra_vars'.$extraItem->var_idx} = $extraItem->value;
279 279
 					}
280 280
 				}
281 281
 			}
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 			$obj->trackback_count = 0;
288 288
 
289 289
 			// Pre-register the attachment
290
-			if($oDocument->hasUploadedFiles())
290
+			if ($oDocument->hasUploadedFiles())
291 291
 			{
292 292
 				$files = $oDocument->getUploadedFiles();
293
-				foreach($files as $val)
293
+				foreach ($files as $val)
294 294
 				{
295 295
 					$file_info = array();
296 296
 					$file_info['tmp_name'] = $val->uploaded_filename;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 					$oFileController = getController('file');
299 299
 					$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
300 300
 					// if image/video files
301
-					if($val->direct_download == 'Y')
301
+					if ($val->direct_download == 'Y')
302 302
 					{
303
-						$source_filename = substr($val->uploaded_filename,2);
304
-						$target_filename = substr($inserted_file->get('uploaded_filename'),2);
303
+						$source_filename = substr($val->uploaded_filename, 2);
304
+						$target_filename = substr($inserted_file->get('uploaded_filename'), 2);
305 305
 						$obj->content = str_replace($source_filename, $target_filename, $obj->content);
306 306
 						// If binary file
307 307
 					}
@@ -315,23 +315,23 @@  discard block
 block discarded – undo
315 315
 
316 316
 			// Write a post
317 317
 			$output = $oDocumentController->insertDocument($obj, true, true);
318
-			if(!$output->toBool())
318
+			if (!$output->toBool())
319 319
 			{
320 320
 				$oDB->rollback();
321 321
 				return $output;
322 322
 			}
323 323
 
324 324
 			// copy multi language contents
325
-			if(is_array($extraVars))
325
+			if (is_array($extraVars))
326 326
 			{
327
-				foreach($extraVars as $value)
327
+				foreach ($extraVars as $value)
328 328
 				{
329
-					if($value->idx >= 0 && $value->lang_code == Context::getLangType())
329
+					if ($value->idx >= 0 && $value->lang_code == Context::getLangType())
330 330
 					{
331 331
 						continue;
332 332
 					}
333 333
 
334
-					if( $value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0) )
334
+					if ($value->var_idx < 0 || ($module_srl == $value->module_srl && $value->var_idx >= 0))
335 335
 					{
336 336
 						$oDocumentController->insertDocumentExtraVar($value->module_srl, $obj->document_srl, $value->var_idx, $value->value, $value->eid, $value->lang_code);
337 337
 					}
@@ -339,26 +339,26 @@  discard block
 block discarded – undo
339 339
 			}
340 340
 
341 341
 			// Move the comments
342
-			if($oDocument->getCommentCount())
342
+			if ($oDocument->getCommentCount())
343 343
 			{
344 344
 				$oCommentModel = getModel('comment');
345 345
 				$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
346 346
 				$comments = $comment_output->data;
347
-				if(count($comments) > 0)
347
+				if (count($comments) > 0)
348 348
 				{
349 349
 					$oCommentController = getController('comment');
350 350
 					$success_count = 0;
351 351
 					$p_comment_srl = array();
352
-					foreach($comments as $comment_obj)
352
+					foreach ($comments as $comment_obj)
353 353
 					{
354 354
 						$comment_srl = getNextSequence();
355 355
 						$p_comment_srl[$comment_obj->comment_srl] = $comment_srl;
356 356
 
357 357
 						// Pre-register the attachment
358
-						if($comment_obj->uploaded_count)
358
+						if ($comment_obj->uploaded_count)
359 359
 						{
360 360
 							$files = $oFileModel->getFiles($comment_obj->comment_srl, true);
361
-							foreach($files as $val)
361
+							foreach ($files as $val)
362 362
 							{
363 363
 								$file_info = array();
364 364
 								$file_info['tmp_name'] = $val->uploaded_filename;
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 								$oFileController = getController('file');
367 367
 								$inserted_file = $oFileController->insertFile($file_info, $module_srl, $comment_srl, 0, true);
368 368
 								// if image/video files
369
-								if($val->direct_download == 'Y')
369
+								if ($val->direct_download == 'Y')
370 370
 								{
371
-									$source_filename = substr($val->uploaded_filename,2);
372
-									$target_filename = substr($inserted_file->get('uploaded_filename'),2);
371
+									$source_filename = substr($val->uploaded_filename, 2);
372
+									$target_filename = substr($inserted_file->get('uploaded_filename'), 2);
373 373
 									$comment_obj->content = str_replace($source_filename, $target_filename, $comment_obj->content);
374 374
 									// If binary file
375 375
 								}
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 						$comment_obj->document_srl = $obj->document_srl;
386 386
 						$comment_obj->comment_srl = $comment_srl;
387 387
 
388
-						if($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
388
+						if ($comment_obj->parent_srl) $comment_obj->parent_srl = $p_comment_srl[$comment_obj->parent_srl];
389 389
 
390 390
 						$output = $oCommentController->insertComment($comment_obj, true);
391
-						if($output->toBool()) $success_count ++;
391
+						if ($output->toBool()) $success_count++;
392 392
 					}
393 393
 					$oDocumentController->updateCommentCount($obj->document_srl, $success_count, $comment_obj->nick_name, true);
394 394
 				}
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
 
397 397
 			// Move the trackbacks
398 398
 			$oTrackbackModel = getModel('trackback');
399
-			if($oTrackbackModel && $oDocument->getTrackbackCount())
399
+			if ($oTrackbackModel && $oDocument->getTrackbackCount())
400 400
 			{
401 401
 				$trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
402
-				if(count($trackbacks))
402
+				if (count($trackbacks))
403 403
 				{
404 404
 					$success_count = 0;
405
-					foreach($trackbacks as $trackback_obj)
405
+					foreach ($trackbacks as $trackback_obj)
406 406
 					{
407 407
 						$trackback_obj->trackback_srl = getNextSequence();
408 408
 						$trackback_obj->module_srl = $obj->module_srl;
409 409
 						$trackback_obj->document_srl = $obj->document_srl;
410 410
 						$output = executeQuery('trackback.insertTrackback', $trackback_obj);
411
-						if($output->toBool()) $success_count++;
411
+						if ($output->toBool()) $success_count++;
412 412
 					}
413 413
 					// Update the number of trackbacks
414 414
 					$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		// Call a trigger (before)
422 422
 		$triggerObj->copied_srls = $copied_srls;
423 423
 		$output = ModuleHandler::triggerCall('document.copyDocumentModule', 'after', $triggerObj);
424
-		if(!$output->toBool())
424
+		if (!$output->toBool())
425 425
 		{
426 426
 			$oDB->rollback();
427 427
 			return $output;
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		$document_list = $oDocumentModel->getDocumentList($args);
449 449
 		$documents = $document_list->data;
450 450
 		$output = executeQuery('document.deleteModuleDocument', $args);
451
-		if(is_array($documents))
451
+		if (is_array($documents))
452 452
 		{
453 453
 			foreach ($documents as $oDocument)
454 454
 			{
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 		}
458 458
 		//remove from cache
459 459
 		$oCacheHandler = CacheHandler::getInstance('object');
460
-		if($oCacheHandler->isSupport())
460
+		if ($oCacheHandler->isSupport())
461 461
 		{
462
-			if(is_array($document_srl_list))
462
+			if (is_array($document_srl_list))
463 463
 			{
464
-				foreach($document_srl_list as $document_srl)
464
+				foreach ($document_srl_list as $document_srl)
465 465
 				{
466
-					$cache_key_item = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
466
+					$cache_key_item = 'document_item:'.getNumberingPath($document_srl).$document_srl;
467 467
 					$oCacheHandler->delete($cache_key_item);
468 468
 				}
469 469
 			}
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 		$config = getModel('document')->getDocumentConfig();
483 483
 		$config->icons = Context::get('icons');
484 484
 		$config->micons = Context::get('micons');
485
-		$output = $oModuleController->insertModuleConfig('document',$config);
486
-		if(!$output->toBool())
485
+		$output = $oModuleController->insertModuleConfig('document', $config);
486
+		if (!$output->toBool())
487 487
 		{
488 488
 			return $output;
489 489
 		}
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 	{
503 503
 		$document_srl = trim(Context::get('document_srl'));
504 504
 
505
-		if($document_srl)
505
+		if ($document_srl)
506 506
 		{
507 507
 			$args->document_srl = $document_srl;
508 508
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
509
-			if(!$output->toBool()) return $output;
509
+			if (!$output->toBool()) return $output;
510 510
 		}
511 511
 	}
512 512
 
@@ -531,12 +531,12 @@  discard block
 block discarded – undo
531 531
 	function deleteThumbnailFile($path)
532 532
 	{
533 533
 		$directory = dir($path);
534
-		while($entry = $directory->read()) {
534
+		while ($entry = $directory->read()) {
535 535
 			if ($entry != "." && $entry != "..") {
536 536
 				if (is_dir($path."/".$entry)) {
537 537
 					$this->deleteThumbnailFile($path."/".$entry);
538 538
 				} else {
539
-					if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue;
539
+					if (!preg_match('/^thumbnail_([^\.]*)\.jpg$/i', $entry)) continue;
540 540
 					FileHandler::removeFile($path.'/'.$entry);
541 541
 				}
542 542
 			}
@@ -561,13 +561,13 @@  discard block
 block discarded – undo
561 561
 		$eid = Context::get('eid');
562 562
 		$obj = new stdClass();
563 563
 
564
-		if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request');
564
+		if (!$module_srl || !$name || !$eid) return new Object(-1, 'msg_invalid_request');
565 565
 		// set the max value if idx is not specified
566
-		if(!$var_idx)
566
+		if (!$var_idx)
567 567
 		{
568 568
 			$obj->module_srl = $module_srl;
569 569
 			$output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj);
570
-			$var_idx = $output->data->var_idx+1;
570
+			$var_idx = $output->data->var_idx + 1;
571 571
 		}
572 572
 
573 573
 		// Check if the module name already exists
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 		$obj->var_idx = $var_idx;
576 576
 		$obj->eid = $eid;
577 577
 		$output = executeQuery('document.isExistsExtraKey', $obj);
578
-		if(!$output->toBool() || $output->data->count)
578
+		if (!$output->toBool() || $output->data->count)
579 579
 		{
580 580
 			return new Object(-1, 'msg_extra_name_exists');
581 581
 		}
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		// insert or update
584 584
 		$oDocumentController = getController('document');
585 585
 		$output = $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $name, $type, $is_required, $search, $default, $desc, $eid);
586
-		if(!$output->toBool()) return $output;
586
+		if (!$output->toBool()) return $output;
587 587
 
588 588
 		$this->setMessage('success_registed');
589 589
 
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
 	{
600 600
 		$module_srl = Context::get('module_srl');
601 601
 		$var_idx = Context::get('var_idx');
602
-		if(!$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request');
602
+		if (!$module_srl || !$var_idx) return new Object(-1, 'msg_invalid_request');
603 603
 
604 604
 		$oDocumentController = getController('document');
605 605
 		$output = $oDocumentController->deleteDocumentExtraKeys($module_srl, $var_idx);
606
-		if(!$output->toBool()) return $output;
606
+		if (!$output->toBool()) return $output;
607 607
 
608 608
 		$this->setMessage('success_deleted');
609 609
 	}
@@ -618,19 +618,19 @@  discard block
 block discarded – undo
618 618
 		$module_srl = Context::get('module_srl');
619 619
 		$var_idx = Context::get('var_idx');
620 620
 
621
-		if(!$type || !$module_srl || !$var_idx) return new Object(-1,'msg_invalid_request');
621
+		if (!$type || !$module_srl || !$var_idx) return new Object(-1, 'msg_invalid_request');
622 622
 
623 623
 		$oModuleModel = getModel('module');
624 624
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
625
-		if(!$module_info->module_srl) return new Object(-1,'msg_invalid_request');
625
+		if (!$module_info->module_srl) return new Object(-1, 'msg_invalid_request');
626 626
 
627 627
 		$oDocumentModel = getModel('document');
628 628
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
629
-		if(!$extra_keys[$var_idx]) return new Object(-1,'msg_invalid_request');
629
+		if (!$extra_keys[$var_idx]) return new Object(-1, 'msg_invalid_request');
630 630
 
631
-		if($type == 'up') $new_idx = $var_idx-1;
632
-		else $new_idx = $var_idx+1;
633
-		if($new_idx<1) return new Object(-1,'msg_invalid_request');
631
+		if ($type == 'up') $new_idx = $var_idx - 1;
632
+		else $new_idx = $var_idx + 1;
633
+		if ($new_idx < 1) return new Object(-1, 'msg_invalid_request');
634 634
 
635 635
 		$args = new stdClass();
636 636
 		$args->module_srl = $module_srl;
@@ -641,16 +641,16 @@  discard block
 block discarded – undo
641 641
 		unset($args);
642 642
 
643 643
 		// update immediately if there is no idx to change
644
-		if(!$extra_keys[$new_idx])
644
+		if (!$extra_keys[$new_idx])
645 645
 		{
646 646
 			$args = new stdClass();
647 647
 			$args->module_srl = $module_srl;
648 648
 			$args->var_idx = $var_idx;
649 649
 			$args->new_idx = $new_idx;
650 650
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
651
-			if(!$output->toBool()) return $output;
651
+			if (!$output->toBool()) return $output;
652 652
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
653
-			if(!$output->toBool()) return $output;
653
+			if (!$output->toBool()) return $output;
654 654
 			// replace if exists
655 655
 		}
656 656
 		else
@@ -660,27 +660,27 @@  discard block
 block discarded – undo
660 660
 			$args->var_idx = $new_idx;
661 661
 			$args->new_idx = -10000;
662 662
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
663
-			if(!$output->toBool()) return $output;
663
+			if (!$output->toBool()) return $output;
664 664
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
665
-			if(!$output->toBool()) return $output;
665
+			if (!$output->toBool()) return $output;
666 666
 
667 667
 			$args->var_idx = $var_idx;
668 668
 			$args->new_idx = $new_idx;
669 669
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
670
-			if(!$output->toBool()) return $output;
670
+			if (!$output->toBool()) return $output;
671 671
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
672
-			if(!$output->toBool()) return $output;
672
+			if (!$output->toBool()) return $output;
673 673
 
674 674
 			$args->var_idx = -10000;
675 675
 			$args->new_idx = $var_idx;
676 676
 			$output = executeQuery('document.updateDocumentExtraKeyIdx', $args);
677
-			if(!$output->toBool()) return $output;
677
+			if (!$output->toBool()) return $output;
678 678
 			$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
679
-			if(!$output->toBool()) return $output;
679
+			if (!$output->toBool()) return $output;
680 680
 		}
681 681
 
682 682
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
683
-		if($oCacheHandler->isSupport())
683
+		if ($oCacheHandler->isSupport())
684 684
 		{
685 685
 			$object_key = 'module_document_extra_keys:'.$module_srl;
686 686
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	function procDocumentAdminInsertAlias()
696 696
 	{
697
-		$args = Context::gets('module_srl','document_srl', 'alias_title');
697
+		$args = Context::gets('module_srl', 'document_srl', 'alias_title');
698 698
 		$alias_srl = Context::get('alias_srl');
699
-		if(!$alias_srl)
699
+		if (!$alias_srl)
700 700
 		{
701 701
 			$args->alias_srl = getNextSequence();
702 702
 			$query = "document.insertAlias";
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		$oDocumentModel = getModel('document');
740 740
 		$oDocumentController = getController('document');
741 741
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
742
-		if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
742
+		if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
743 743
 	
744 744
 		$oModuleModel = getModel('module');
745 745
 		$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
@@ -751,31 +751,31 @@  discard block
 block discarded – undo
751 751
 		$oDocumentController->moveDocumentToTrash($args);
752 752
 
753 753
 		$returnUrl = Context::get('success_return_url');
754
-		if(!$returnUrl)	
754
+		if (!$returnUrl)	
755 755
 		{
756 756
 			$arrUrl = parse_url(Context::get('cur_url'));
757 757
 			$query = "";
758 758
 
759
-			if($arrUrl['query'])
759
+			if ($arrUrl['query'])
760 760
 			{
761 761
 				parse_str($arrUrl['query'], $arrQuery);
762 762
 
763 763
 				// set query
764
-				if(isset($arrQuery['document_srl']))
764
+				if (isset($arrQuery['document_srl']))
765 765
 					unset($arrQuery['document_srl']);
766 766
 
767 767
 				$searchArgs = new stdClass;
768
-				foreach($arrQuery as $key=>$val)
768
+				foreach ($arrQuery as $key=>$val)
769 769
 				{
770 770
 					$searchArgs->{$key} = $val;
771 771
 				}
772 772
 
773
-				if(!isset($searchArgs->sort_index))
773
+				if (!isset($searchArgs->sort_index))
774 774
 					$searchArgs->sort_index = $module_info->order_target;
775 775
 
776
-				foreach($module_info as $key=>$val)
776
+				foreach ($module_info as $key=>$val)
777 777
 				{
778
-					if(!isset($searchArgs->{$key}))
778
+					if (!isset($searchArgs->{$key}))
779 779
 						$searchArgs->{$key} = $val;
780 780
 				}
781 781
 
@@ -783,20 +783,20 @@  discard block
 block discarded – undo
783 783
 				$output = $oDocumentModel->getDocumentList($searchArgs, $module_info->except_notice, TRUE, array('document_srl'));
784 784
 
785 785
 				$cur_page = 1;
786
-				if(isset($arrQuery['page'])) {
787
-					$cur_page = (int)$arrQuery['page'];
786
+				if (isset($arrQuery['page'])) {
787
+					$cur_page = (int) $arrQuery['page'];
788 788
 				}
789 789
 
790 790
 
791
-				if($cur_page>1 && count($output->data) == 0)
791
+				if ($cur_page > 1 && count($output->data) == 0)
792 792
 					$arrQuery['page'] = $cur_page - 1;
793 793
 
794 794
 				$query = "?";
795
-				foreach($arrQuery as $key=>$val)
795
+				foreach ($arrQuery as $key=>$val)
796 796
 					$query .= sprintf("%s=%s&", $key, $val);
797 797
 				$query = substr($query, 0, -1);
798 798
 			}
799
-			$returnUrl = $arrUrl['path'] . $query;
799
+			$returnUrl = $arrUrl['path'].$query;
800 800
 		}
801 801
 
802 802
 		$this->add('redirect_url', $returnUrl);
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 	 */
874 874
 	function restoreTrash($originObject)
875 875
 	{
876
-		if(is_array($originObject)) $originObject = (object)$originObject;
876
+		if (is_array($originObject)) $originObject = (object) $originObject;
877 877
 
878 878
 		$oDocumentController = getController('document');
879 879
 		$oDocumentModel = getModel('document');
@@ -883,12 +883,12 @@  discard block
 block discarded – undo
883 883
 
884 884
 		//DB restore
885 885
 		$output = $oDocumentController->insertDocument($originObject, false, true, false);
886
-		if(!$output->toBool()) return new Object(-1, $output->getMessage());
886
+		if (!$output->toBool()) return new Object(-1, $output->getMessage());
887 887
 
888 888
 		//FILE restore
889 889
 		$oDocument = $oDocumentModel->getDocument($originObject->document_srl);
890 890
 		// If the post was not temorarily saved, set the attachment's status to be valid
891
-		if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl)
891
+		if ($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl)
892 892
 		{
893 893
 			$args = new stdClass();
894 894
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -897,10 +897,10 @@  discard block
 block discarded – undo
897 897
 		}
898 898
 
899 899
 		// call a trigger (after)
900
-		if($output->toBool())
900
+		if ($output->toBool())
901 901
 		{
902 902
 			$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject);
903
-			if(!$trigger_output->toBool())
903
+			if (!$trigger_output->toBool())
904 904
 			{
905 905
 				$oDB->rollback();
906 906
 				return $trigger_output;
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	function emptyTrash($originObject)
922 922
 	{
923 923
 		$originObject = unserialize($originObject);
924
-		if(is_array($originObject)) $originObject = (object) $originObject;
924
+		if (is_array($originObject)) $originObject = (object) $originObject;
925 925
 
926 926
 		$oDocument = new documentItem();
927 927
 		$oDocument->setAttribute($originObject);
Please login to merge, or discard this patch.