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 (#2370)
by
unknown
06:51
created
modules/document/document.model.php 2 patches
Spacing   +240 added lines, -240 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 BaseObject(-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,9 +113,9 @@  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 120
 			// static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남		
121 121
 			/*		
@@ -137,21 +137,21 @@  discard block
 block discarded – undo
137 137
 	 * @param array $columnList
138 138
 	 * @return documentItem
139 139
 	 */
140
-	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
140
+	function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
141 141
 	{
142
-		if(!$document_srl) return new documentItem();
142
+		if (!$document_srl) return new documentItem();
143 143
 
144
-		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
144
+		if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
145 145
 		{
146 146
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
147
-			if(!$oDocument->isExists())
147
+			if (!$oDocument->isExists())
148 148
 			{
149 149
 				return $oDocument;
150 150
 			}
151 151
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
152
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
152
+			if ($load_extra_vars) $this->setToAllDocumentExtraVars();
153 153
 		}
154
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
154
+		if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
155 155
 
156 156
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
157 157
 	}
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 	 * @param array $columnList
165 165
 	 * @return array value type is documentItem
166 166
 	 */
167
-	function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
167
+	function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
168 168
 	{
169
-		if(is_array($document_srls))
169
+		if (is_array($document_srls))
170 170
 		{
171 171
 			$list_count = count($document_srls);
172
-			$document_srls = implode(',',$document_srls);
172
+			$document_srls = implode(',', $document_srls);
173 173
 		}
174 174
 		else
175 175
 		{
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$output = executeQuery('document.getDocuments', $args, $columnList);
184 184
 		$document_list = $output->data;
185
-		if(!$document_list) return;
186
-		if(!is_array($document_list)) $document_list = array($document_list);
185
+		if (!$document_list) return;
186
+		if (!is_array($document_list)) $document_list = array($document_list);
187 187
 
188 188
 		$document_count = count($document_list);
189
-		foreach($document_list as $key => $attribute)
189
+		foreach ($document_list as $key => $attribute)
190 190
 		{
191 191
 			$document_srl = $attribute->document_srl;
192
-			if(!$document_srl) continue;
192
+			if (!$document_srl) continue;
193 193
 
194
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
194
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
195 195
 			{
196 196
 				$oDocument = null;
197 197
 				$oDocument = new documentItem();
198 198
 				$oDocument->setAttribute($attribute, false);
199
-				if($is_admin) $oDocument->setGrant();
199
+				if ($is_admin) $oDocument->setGrant();
200 200
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
201 201
 			}
202 202
 
203 203
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
204 204
 		}
205 205
 
206
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
206
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
207 207
 
208 208
 		$output = null;
209
-		if(count($result))
209
+		if (count($result))
210 210
 		{
211
-			foreach($result as $document_srl => $val)
211
+			foreach ($result as $document_srl => $val)
212 212
 			{
213 213
 				$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
214 214
 			}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 * @param array $columnList
226 226
 	 * @return BaseObject
227 227
 	 */
228
-	function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
228
+	function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
229 229
 	{
230 230
 		$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
231 231
 		$obj->sort_index = $sort_check->sort_index;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		// Call trigger (before)
236 236
 		// This trigger can be used to set an alternative output using a different search method
237 237
 		$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
238
-		if($output instanceof BaseObject && !$output->toBool())
238
+		if ($output instanceof BaseObject && !$output->toBool())
239 239
 		{
240 240
 			return $output;
241 241
 		}
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 			$output = $obj->use_alternate_output;
253 253
 			unset($obj->use_alternate_output);
254 254
 		}
255
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
255
+		elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars'))
256 256
 		{
257 257
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
258
-			$args->sort_index = str_replace('documents.','',$args->sort_index);
258
+			$args->sort_index = str_replace('documents.', '', $args->sort_index);
259 259
 			$output = executeQueryArray($query_id, $args);
260 260
 		}
261 261
 		elseif ($sort_check->isExtraVars)
@@ -267,16 +267,16 @@  discard block
 block discarded – undo
267 267
 			// document.getDocumentList query execution
268 268
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
269 269
 			$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
270
-			if(isset($groupByQuery[$query_id]))
270
+			if (isset($groupByQuery[$query_id]))
271 271
 			{
272 272
 				$group_args = clone($args);
273 273
 				$group_args->sort_index = 'documents.'.$args->sort_index;
274 274
 				$output = executeQueryArray($query_id, $group_args);
275
-				if(!$output->toBool()||!count($output->data)) return $output;
275
+				if (!$output->toBool() || !count($output->data)) return $output;
276 276
 
277
-				foreach($output->data as $key => $val)
277
+				foreach ($output->data as $key => $val)
278 278
 				{
279
-					if($val->document_srl) $target_srls[] = $val->document_srl;
279
+					if ($val->document_srl) $target_srls[] = $val->document_srl;
280 280
 				}
281 281
 
282 282
 				$page_navigation = $output->page_navigation;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				$virtual_number = $keys[0];
285 285
 
286 286
 				$target_args = new stdClass();
287
-				$target_args->document_srls = implode(',',$target_srls);
287
+				$target_args->document_srls = implode(',', $target_srls);
288 288
 				$target_args->list_order = $args->sort_index;
289 289
 				$target_args->order_type = $args->order_type;
290 290
 				$target_args->list_count = $args->list_count;
@@ -301,35 +301,35 @@  discard block
 block discarded – undo
301 301
 			}
302 302
 		}
303 303
 		// Return if no result or an error occurs
304
-		if(!$output->toBool()||!count($output->data)) return $output;
304
+		if (!$output->toBool() || !count($output->data)) return $output;
305 305
 		$idx = 0;
306 306
 		$data = $output->data;
307 307
 		unset($output->data);
308 308
 
309
-		if(!isset($virtual_number))
309
+		if (!isset($virtual_number))
310 310
 		{
311 311
 			$keys = array_keys($data);
312 312
 			$virtual_number = $keys[0];
313 313
 		}
314 314
 
315
-		if($except_notice)
315
+		if ($except_notice)
316 316
 		{
317
-			foreach($data as $key => $attribute)
317
+			foreach ($data as $key => $attribute)
318 318
 			{
319
-				if($attribute->is_notice == 'Y') $virtual_number --;
319
+				if ($attribute->is_notice == 'Y') $virtual_number--;
320 320
 			}
321 321
 		}
322 322
 
323
-		foreach($data as $key => $attribute)
323
+		foreach ($data as $key => $attribute)
324 324
 		{
325
-			if($except_notice && $attribute->is_notice == 'Y') continue;
325
+			if ($except_notice && $attribute->is_notice == 'Y') continue;
326 326
 			$document_srl = $attribute->document_srl;
327
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
327
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
328 328
 			{
329 329
 				$oDocument = null;
330 330
 				$oDocument = new documentItem();
331 331
 				$oDocument->setAttribute($attribute, false);
332
-				if($is_admin) $oDocument->setGrant();
332
+				if ($is_admin) $oDocument->setGrant();
333 333
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
334 334
 			}
335 335
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 			$virtual_number--;
338 338
 		}
339 339
 
340
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
340
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
341 341
 
342
-		if(count($output->data))
342
+		if (count($output->data))
343 343
 		{
344
-			foreach($output->data as $number => $document)
344
+			foreach ($output->data as $number => $document)
345 345
 			{
346 346
 				$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
347 347
 			}
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	{
364 364
 		$args = new stdClass();
365 365
 		$args->module_srl = $obj->module_srl;
366
-		$args->category_srl= $obj->category_srl;
366
+		$args->category_srl = $obj->category_srl;
367 367
 		
368 368
 		unset($obj->use_alternate_output);
369 369
 		$obj->columnList = $columnList;
370 370
 		$output = ModuleHandler::triggerCall('document.getNoticeList', 'before', $obj);
371
-		if($output instanceof BaseObject && !$output->toBool())
371
+		if ($output instanceof BaseObject && !$output->toBool())
372 372
 		{
373 373
 			return $output;
374 374
 		}
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 			$output = executeQueryArray('document.getNoticeList', $args, $columnList);
383 383
 		}
384 384
 		
385
-		if(!$output->toBool()||!$output->data) return;
385
+		if (!$output->toBool() || !$output->data) return;
386 386
 
387
-		foreach($output->data as $key => $val)
387
+		foreach ($output->data as $key => $val)
388 388
 		{
389 389
 			$document_srl = $val->document_srl;
390
-			if(!$document_srl) continue;
390
+			if (!$document_srl) continue;
391 391
 
392
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
392
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
393 393
 			{
394 394
 				$oDocument = null;
395 395
 				$oDocument = new documentItem();
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		}
401 401
 		$this->setToAllDocumentExtraVars();
402 402
 
403
-		foreach($result->data as $document_srl => $val)
403
+		foreach ($result->data as $document_srl => $val)
404 404
 		{
405 405
 			$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
406 406
 		}
@@ -416,20 +416,20 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	function getExtraKeys($module_srl)
418 418
 	{
419
-		if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
419
+		if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
420 420
 		{
421 421
 			$keys = false;
422 422
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
423
-			if($oCacheHandler->isSupport())
423
+			if ($oCacheHandler->isSupport())
424 424
 			{
425
-				$object_key = 'module_document_extra_keys:' . $module_srl;
425
+				$object_key = 'module_document_extra_keys:'.$module_srl;
426 426
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
427 427
 				$keys = $oCacheHandler->get($cache_key);
428 428
 			}
429 429
 
430 430
 			$oExtraVar = ExtraVar::getInstance($module_srl);
431 431
 
432
-			if($keys === false)
432
+			if ($keys === false)
433 433
 			{
434 434
 				$obj = new stdClass();
435 435
 				$obj->module_srl = $module_srl;
@@ -439,13 +439,13 @@  discard block
 block discarded – undo
439 439
 
440 440
 				// correcting index order
441 441
 				$isFixed = FALSE;
442
-				if(is_array($output->data))
442
+				if (is_array($output->data))
443 443
 				{
444 444
 					$prevIdx = 0;
445
-					foreach($output->data as $no => $value)
445
+					foreach ($output->data as $no => $value)
446 446
 					{
447 447
 						// case first
448
-						if($prevIdx == 0 && $value->idx != 1)
448
+						if ($prevIdx == 0 && $value->idx != 1)
449 449
 						{
450 450
 							$args = new stdClass();
451 451
 							$args->module_srl = $module_srl;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 						}
460 460
 
461 461
 						// case others
462
-						if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
462
+						if ($prevIdx > 0 && $prevIdx + 1 != $value->idx)
463 463
 						{
464 464
 							$args = new stdClass();
465 465
 							$args->module_srl = $module_srl;
@@ -476,16 +476,16 @@  discard block
 block discarded – undo
476 476
 					}
477 477
 				}
478 478
 
479
-				if($isFixed)
479
+				if ($isFixed)
480 480
 				{
481 481
 					$output = executeQueryArray('document.getDocumentExtraKeys', $obj);
482 482
 				}
483 483
 
484 484
 				$oExtraVar->setExtraVarKeys($output->data);
485 485
 				$keys = $oExtraVar->getExtraVars();
486
-				if(!$keys) $keys = array();
486
+				if (!$keys) $keys = array();
487 487
 
488
-				if($oCacheHandler->isSupport())
488
+				if ($oCacheHandler->isSupport())
489 489
 				{
490 490
 					$oCacheHandler->put($cache_key, $keys);
491 491
 				}
@@ -506,14 +506,14 @@  discard block
 block discarded – undo
506 506
 	 */
507 507
 	function getExtraVars($module_srl, $document_srl)
508 508
 	{
509
-		if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
509
+		if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
510 510
 		{
511 511
 			// Extended to extract the values of variables set
512 512
 			$oDocument = $this->getDocument($document_srl, false);
513 513
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
514 514
 			$this->setToAllDocumentExtraVars();
515 515
 		}
516
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
516
+		if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
517 517
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
518 518
 	}
519 519
 
@@ -536,71 +536,71 @@  discard block
 block discarded – undo
536 536
 
537 537
 		$oDocumentController = getController('document');
538 538
 		// Members must be a possible feature
539
-		if($logged_info->member_srl)
539
+		if ($logged_info->member_srl)
540 540
 		{
541 541
 			$oDocumentModel = getModel('document');
542 542
 			$columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
543 543
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
544 544
 			$module_srl = $oDocument->get('module_srl');
545 545
 			$member_srl = $oDocument->get('member_srl');
546
-			if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
546
+			if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
547 547
 
548 548
 			$oModuleModel = getModel('module');
549
-			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
550
-			if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
549
+			$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
550
+			if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
551 551
 			{
552 552
 				// Add a Referral Button
553 553
 				$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
554
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
554
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript');
555 555
 			}
556 556
 
557
-			if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
557
+			if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
558 558
 			{
559 559
 				// Add button to negative
560
-				$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
561
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
560
+				$url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
561
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
562 562
 			}
563 563
 
564 564
 			// Adding Report
565 565
 			$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
566
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
566
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript');
567 567
 
568 568
 			// Add Bookmark button
569 569
 			$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
570
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
570
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript');
571 571
 		}
572 572
 		// Add print button
573
-		$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
574
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
573
+		$url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl);
574
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument');
575 575
 		// Call a trigger (after)
576 576
 		ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
577
-		if($this->grant->manager)
577
+		if ($this->grant->manager)
578 578
 		{
579 579
 			$str_confirm = Context::getLang('confirm_move');
580 580
 			$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);
581
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
581
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript');
582 582
 		}
583 583
 
584 584
 		// If you are managing to find posts by ip
585
-		if($logged_info->is_admin == 'Y')
585
+		if ($logged_info->is_admin == 'Y')
586 586
 		{
587 587
 			$oDocumentModel = getModel('document');
588
-			$oDocument = $oDocumentModel->getDocument($document_srl);	//before setting document recycle
588
+			$oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
589 589
 
590
-			if($oDocument->isExists())
590
+			if ($oDocument->isExists())
591 591
 			{
592 592
 				// Find a post equivalent to ip address
593
-				$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
594
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
593
+				$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress());
594
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
595 595
 
596 596
 				$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
597
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
597
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
598 598
 			}
599 599
 		}
600 600
 		// Changing the language of pop-up menu
601 601
 		$menus = Context::get('document_popup_menu_list');
602 602
 		$menus_count = count($menus);
603
-		for($i=0;$i<$menus_count;$i++)
603
+		for ($i = 0; $i < $menus_count; $i++)
604 604
 		{
605 605
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
606 606
 		}
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	function getDocumentCount($module_srl, $search_obj = NULL)
618 618
 	{
619
-		if(is_null($search_obj)) $search_obj = new stdClass();
619
+		if (is_null($search_obj)) $search_obj = new stdClass();
620 620
 		$search_obj->module_srl = $module_srl;
621 621
 
622 622
 		$output = executeQuery('document.getDocumentCount', $search_obj);
623 623
 		// Return total number of
624 624
 		$total_count = $output->data->count;
625
-		return (int)$total_count;
625
+		return (int) $total_count;
626 626
 	}
627 627
 
628 628
 	/**
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	function getDocumentCountByGroupStatus($search_obj = NULL)
634 634
 	{
635 635
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
636
-		if(!$output->toBool()) return array();
636
+		if (!$output->toBool()) return array();
637 637
 
638 638
 		return $output->data;
639 639
 	}
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 		$output = executeQuery('document.getDocumentExtraVarsCount', $args);
653 653
 		// Return total number of
654 654
 		$total_count = $output->data->count;
655
-		return (int)$total_count;
655
+		return (int) $total_count;
656 656
 	}
657 657
 
658 658
 	/**
@@ -669,29 +669,29 @@  discard block
 block discarded – undo
669 669
 
670 670
 		$this->_setSearchOption($opt, $args, $query_id, $use_division);
671 671
 
672
-		if($sort_check->isExtraVars)
672
+		if ($sort_check->isExtraVars)
673 673
 		{
674 674
 			return 1;
675 675
 		}
676 676
 		else
677 677
 		{
678
-			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
678
+			if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
679 679
 			{
680
-				if($args->order_type === 'desc')
680
+				if ($args->order_type === 'desc')
681 681
 				{
682
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
682
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
683 683
 				}
684 684
 				else
685 685
 				{
686 686
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
687 687
 				}
688 688
 			}
689
-			elseif($sort_check->sort_index === 'regdate')
689
+			elseif ($sort_check->sort_index === 'regdate')
690 690
 			{
691 691
 
692
-				if($args->order_type === 'asc')
692
+				if ($args->order_type === 'asc')
693 693
 				{
694
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
694
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
695 695
 				}
696 696
 				else
697 697
 				{
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
 		}
707 707
 
708 708
 		// Guhanhu total number of the article search page
709
-		$output = executeQuery($query_id . 'Page', $args);
709
+		$output = executeQuery($query_id.'Page', $args);
710 710
 		$count = $output->data->count;
711
-		$page = (int)(($count-1)/$opt->list_count)+1;
711
+		$page = (int) (($count - 1) / $opt->list_count) + 1;
712 712
 		return $page;
713 713
 	}
714 714
 
@@ -720,16 +720,16 @@  discard block
 block discarded – undo
720 720
 	 */
721 721
 	function getCategory($category_srl, $columnList = array())
722 722
 	{
723
-		$args =new stdClass();
723
+		$args = new stdClass();
724 724
 		$args->category_srl = $category_srl;
725 725
 		$output = executeQuery('document.getCategory', $args, $columnList);
726 726
 
727 727
 		$node = $output->data;
728
-		if(!$node) return;
728
+		if (!$node) return;
729 729
 
730
-		if($node->group_srls)
730
+		if ($node->group_srls)
731 731
 		{
732
-			$group_srls = explode(',',$node->group_srls);
732
+			$group_srls = explode(',', $node->group_srls);
733 733
 			unset($node->group_srls);
734 734
 			$node->group_srls = $group_srls;
735 735
 		}
@@ -750,8 +750,8 @@  discard block
 block discarded – undo
750 750
 	{
751 751
 		$args = new stdClass();
752 752
 		$args->category_srl = $category_srl;
753
-		$output = executeQuery('document.getChildCategoryCount',$args);
754
-		if($output->data->count > 0) return true;
753
+		$output = executeQuery('document.getChildCategoryCount', $args);
754
+		if ($output->data->count > 0) return true;
755 755
 		return false;
756 756
 	}
757 757
 
@@ -764,15 +764,15 @@  discard block
 block discarded – undo
764 764
 	 */
765 765
 	function getCategoryList($module_srl, $columnList = array())
766 766
 	{
767
-		$module_srl = (int)$module_srl;
767
+		$module_srl = (int) $module_srl;
768 768
 
769 769
 		// Category of the target module file swollen
770 770
 		$filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
771 771
 		// If the target file to the cache file regeneration category
772
-		if(!file_exists($filename))
772
+		if (!file_exists($filename))
773 773
 		{
774 774
 			$oDocumentController = getController('document');
775
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
775
+			if (!$oDocumentController->makeCategoryFile($module_srl)) return array();
776 776
 		}
777 777
 
778 778
 		include($filename);
@@ -792,10 +792,10 @@  discard block
 block discarded – undo
792 792
 	 */
793 793
 	function _arrangeCategory(&$document_category, $list, $depth)
794 794
 	{
795
-		if(!count($list)) return;
795
+		if (!count($list)) return;
796 796
 		$idx = 0;
797 797
 		$list_order = array();
798
-		foreach($list as $key => $val)
798
+		foreach ($list as $key => $val)
799 799
 		{
800 800
 			$obj = new stdClass;
801 801
 			$obj->mid = $val['mid'];
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			$obj->parent_srl = $val['parent_srl'];
805 805
 			$obj->title = $obj->text = $val['text'];
806 806
 			$obj->description = $val['description'];
807
-			$obj->expand = $val['expand']=='Y'?true:false;
807
+			$obj->expand = $val['expand'] == 'Y' ?true:false;
808 808
 			$obj->color = $val['color'];
809 809
 			$obj->document_count = $val['document_count'];
810 810
 			$obj->depth = $depth;
@@ -812,26 +812,26 @@  discard block
 block discarded – undo
812 812
 			$obj->childs = array();
813 813
 			$obj->grant = $val['grant'];
814 814
 
815
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
815
+			if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
816 816
 			else $selected = false;
817 817
 
818 818
 			$obj->selected = $selected;
819 819
 
820 820
 			$list_order[$idx++] = $obj->category_srl;
821 821
 			// If you have a parent category of child nodes apply data
822
-			if($obj->parent_srl)
822
+			if ($obj->parent_srl)
823 823
 			{
824 824
 				$parent_srl = $obj->parent_srl;
825 825
 				$document_count = $obj->document_count;
826 826
 				$expand = $obj->expand;
827
-				if($selected) $expand = true;
827
+				if ($selected) $expand = true;
828 828
 
829
-				while($parent_srl)
829
+				while ($parent_srl)
830 830
 				{
831 831
 					$document_category[$parent_srl]->document_count += $document_count;
832 832
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
833 833
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
834
-					if($expand) $document_category[$parent_srl]->expand = $expand;
834
+					if ($expand) $document_category[$parent_srl]->expand = $expand;
835 835
 
836 836
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
837 837
 				}
@@ -839,10 +839,10 @@  discard block
 block discarded – undo
839 839
 
840 840
 			$document_category[$key] = $obj;
841 841
 
842
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
842
+			if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1);
843 843
 		}
844 844
 		$document_category[$list_order[0]]->first = true;
845
-		$document_category[$list_order[count($list_order)-1]]->last = true;
845
+		$document_category[$list_order[count($list_order) - 1]]->last = true;
846 846
 	}
847 847
 
848 848
 	/**
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 		$args->module_srl = $module_srl;
858 858
 		$args->category_srl = $category_srl;
859 859
 		$output = executeQuery('document.getCategoryDocumentCount', $args);
860
-		return (int)$output->data->count;
860
+		return (int) $output->data->count;
861 861
 	}
862 862
 
863 863
 	/**
@@ -867,8 +867,8 @@  discard block
 block discarded – undo
867 867
 	 */
868 868
 	function getCategoryXmlFile($module_srl)
869 869
 	{
870
-		$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
871
-		if(!file_exists($xml_file))
870
+		$xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl);
871
+		if (!file_exists($xml_file))
872 872
 		{
873 873
 			$oDocumentController = getController('document');
874 874
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
 	 */
884 884
 	function getCategoryPhpFile($module_srl)
885 885
 	{
886
-		$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
887
-		if(!file_exists($php_file))
886
+		$php_file = sprintf('files/cache/document_category/%s.php', $module_srl);
887
+		if (!file_exists($php_file))
888 888
 		{
889 889
 			$oDocumentController = getController('document');
890 890
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	 */
900 900
 	function getMonthlyArchivedList($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,13 +907,13 @@  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
 
913 913
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
914
-		if(!$output->toBool()||!$output->data) return $output;
914
+		if (!$output->toBool() || !$output->data) return $output;
915 915
 
916
-		if(!is_array($output->data)) $output->data = array($output->data);
916
+		if (!is_array($output->data)) $output->data = array($output->data);
917 917
 
918 918
 		return $output;
919 919
 	}
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 	 */
926 926
 	function getDailyArchivedList($obj)
927 927
 	{
928
-		if($obj->mid)
928
+		if ($obj->mid)
929 929
 		{
930 930
 			$oModuleModel = getModel('module');
931 931
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -933,14 +933,14 @@  discard block
 block discarded – undo
933 933
 		}
934 934
 		// Module_srl passed the array may be a check whether the array
935 935
 		$args = new stdClass;
936
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
936
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
937 937
 		else $args->module_srl = $obj->module_srl;
938 938
 		$args->regdate = $obj->regdate;
939 939
 
940 940
 		$output = executeQuery('document.getDailyArchivedList', $args);
941
-		if(!$output->toBool()) return $output;
941
+		if (!$output->toBool()) return $output;
942 942
 
943
-		if(!is_array($output->data)) $output->data = array($output->data);
943
+		if (!is_array($output->data)) $output->data = array($output->data);
944 944
 
945 945
 		return $output;
946 946
 	}
@@ -951,17 +951,17 @@  discard block
 block discarded – undo
951 951
 	 */
952 952
 	function getDocumentCategories()
953 953
 	{
954
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
954
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
955 955
 		$module_srl = Context::get('module_srl');
956
-		$categories= $this->getCategoryList($module_srl);
956
+		$categories = $this->getCategoryList($module_srl);
957 957
 		$lang = Context::get('lang');
958 958
 		// No additional category
959 959
 		$output = "0,0,{$lang->none_category}\n";
960
-		if($categories)
960
+		if ($categories)
961 961
 		{
962
-			foreach($categories as $category_srl => $category)
962
+			foreach ($categories as $category_srl => $category)
963 963
 			{
964
-				$output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
964
+				$output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title);
965 965
 			}
966 966
 		}
967 967
 		$this->add('categories', $output);
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 	 */
974 974
 	function getDocumentConfig()
975 975
 	{
976
-		if($this->documentConfig === NULL)
976
+		if ($this->documentConfig === NULL)
977 977
 		{
978 978
 			$oModuleModel = getModel('module');
979 979
 			$config = $oModuleModel->getModuleConfig('document');
@@ -1046,11 +1046,11 @@  discard block
 block discarded – undo
1046 1046
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1047 1047
 		// Check permissions
1048 1048
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1049
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1049
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1050 1050
 
1051 1051
 		$category_srl = Context::get('category_srl');
1052 1052
 		$category_info = $this->getCategory($category_srl);
1053
-		if(!$category_info)
1053
+		if (!$category_info)
1054 1054
 		{
1055 1055
 			return new BaseObject(-1, 'msg_invalid_request');
1056 1056
 		}
@@ -1066,14 +1066,14 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	function getDocumentSrlByAlias($mid, $alias)
1068 1068
 	{
1069
-		if(!$mid || !$alias) return null;
1069
+		if (!$mid || !$alias) return null;
1070 1070
 		$site_module_info = Context::get('site_module_info');
1071 1071
 		$args = new stdClass;
1072 1072
 		$args->mid = $mid;
1073 1073
 		$args->alias_title = $alias;
1074 1074
 		$args->site_srl = $site_module_info->site_srl;
1075 1075
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1076
-		if(!$output->data) return null;
1076
+		if (!$output->data) return null;
1077 1077
 		else return $output->data->document_srl;
1078 1078
 	}
1079 1079
 
@@ -1085,15 +1085,15 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	function getDocumentSrlByTitle($module_srl, $title)
1087 1087
 	{
1088
-		if(!$module_srl || !$title) return null;
1088
+		if (!$module_srl || !$title) return null;
1089 1089
 		$args = new stdClass;
1090 1090
 		$args->module_srl = $module_srl;
1091 1091
 		$args->title = $title;
1092 1092
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1093
-		if(!$output->data) return null;
1093
+		if (!$output->data) return null;
1094 1094
 		else
1095 1095
 		{
1096
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1096
+			if (is_array($output->data)) return $output->data[0]->document_srl;
1097 1097
 			return $output->data->document_srl;
1098 1098
 		}
1099 1099
 	}
@@ -1105,12 +1105,12 @@  discard block
 block discarded – undo
1105 1105
 	 */
1106 1106
 	function getAlias($document_srl)
1107 1107
 	{
1108
-		if(!$document_srl) return null;
1108
+		if (!$document_srl) return null;
1109 1109
 		$args = new stdClass;
1110 1110
 		$args->document_srl = $document_srl;
1111 1111
 		$output = executeQueryArray('document.getAliases', $args);
1112 1112
 
1113
-		if(!$output->data) return null;
1113
+		if (!$output->data) return null;
1114 1114
 		else return $output->data[0]->alias_title;
1115 1115
 	}
1116 1116
 
@@ -1153,32 +1153,32 @@  discard block
 block discarded – undo
1153 1153
 	{
1154 1154
 		// Variable check
1155 1155
 		$args = new stdClass;
1156
-		$args->category_srl = $obj->category_srl?$obj->category_srl:null;
1156
+		$args->category_srl = $obj->category_srl ? $obj->category_srl : null;
1157 1157
 		$args->sort_index = $obj->sort_index;
1158
-		$args->order_type = $obj->order_type?$obj->order_type:'desc';
1159
-		$args->page = $obj->page?$obj->page:1;
1160
-		$args->list_count = $obj->list_count?$obj->list_count:20;
1161
-		$args->page_count = $obj->page_count?$obj->page_count:10;
1158
+		$args->order_type = $obj->order_type ? $obj->order_type : 'desc';
1159
+		$args->page = $obj->page ? $obj->page : 1;
1160
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
1161
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
1162 1162
 		// Search options
1163 1163
 		$search_target = $obj->search_target;
1164 1164
 		$search_keyword = $obj->search_keyword;
1165
-		if($search_target && $search_keyword)
1165
+		if ($search_target && $search_keyword)
1166 1166
 		{
1167
-			switch($search_target)
1167
+			switch ($search_target)
1168 1168
 			{
1169 1169
 				case 'title' :
1170 1170
 				case 'content' :
1171
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1171
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1172 1172
 					$args->{"s_".$search_target} = $search_keyword;
1173 1173
 					$use_division = true;
1174 1174
 					break;
1175 1175
 				case 'title_content' :
1176
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1176
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1177 1177
 					$args->s_title = $search_keyword;
1178 1178
 					$args->s_content = $search_keyword;
1179 1179
 					break;
1180 1180
 				case 'user_id' :
1181
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1181
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1182 1182
 					$args->s_user_id = $search_keyword;
1183 1183
 					$args->sort_index = 'documents.'.$args->sort_index;
1184 1184
 					break;
@@ -1186,13 +1186,13 @@  discard block
 block discarded – undo
1186 1186
 				case 'nick_name' :
1187 1187
 				case 'email_address' :
1188 1188
 				case 'homepage' :
1189
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1189
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1190 1190
 					$args->{"s_".$search_target} = $search_keyword;
1191 1191
 					break;
1192 1192
 				case 'is_notice' :
1193 1193
 				case 'is_secret' :
1194
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1195
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1194
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1195
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1196 1196
 					break;
1197 1197
 				case 'member_srl' :
1198 1198
 				case 'readed_count' :
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 				case 'comment_count' :
1202 1202
 				case 'trackback_count' :
1203 1203
 				case 'uploaded_count' :
1204
-					$args->{"s_".$search_target} = (int)$search_keyword;
1204
+					$args->{"s_".$search_target} = (int) $search_keyword;
1205 1205
 					break;
1206 1206
 				case 'regdate' :
1207 1207
 				case 'last_update' :
@@ -1213,9 +1213,9 @@  discard block
 block discarded – undo
1213 1213
 		}
1214 1214
 
1215 1215
 		$output = executeQueryArray('document.getTrashList', $args);
1216
-		if($output->data)
1216
+		if ($output->data)
1217 1217
 		{
1218
-			foreach($output->data as $key => $attribute)
1218
+			foreach ($output->data as $key => $attribute)
1219 1219
 			{
1220 1220
 				$oDocument = null;
1221 1221
 				$oDocument = new documentItem();
@@ -1234,46 +1234,46 @@  discard block
 block discarded – undo
1234 1234
 	{
1235 1235
 		$args = new stdClass;
1236 1236
 		$document_srl = Context::get('document_srl');
1237
-		if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1237
+		if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
1238 1238
 
1239 1239
 		$point = Context::get('point');
1240
-		if($point != -1) $point = 1;
1240
+		if ($point != -1) $point = 1;
1241 1241
 
1242 1242
 		$oDocumentModel = getModel('document');
1243 1243
 		$columnList = array('document_srl', 'module_srl');
1244 1244
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1245 1245
 		$module_srl = $oDocument->get('module_srl');
1246
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1246
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1247 1247
 
1248 1248
 		$oModuleModel = getModel('module');
1249
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1250
-		if($point == -1)
1249
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
1250
+		if ($point == -1)
1251 1251
 		{
1252
-			if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1252
+			if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request');
1253 1253
 			$args->below_point = 0;
1254 1254
 		}
1255 1255
 		else
1256 1256
 		{
1257
-			if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1257
+			if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request');
1258 1258
 			$args->more_point = 0;
1259 1259
 		}
1260 1260
 
1261 1261
 		$args->document_srl = $document_srl;
1262 1262
 
1263
-		$output = executeQueryArray('document.getVotedMemberList',$args);
1264
-		if(!$output->toBool()) return $output;
1263
+		$output = executeQueryArray('document.getVotedMemberList', $args);
1264
+		if (!$output->toBool()) return $output;
1265 1265
 
1266 1266
 		$oMemberModel = getModel('member');
1267
-		if($output->data)
1267
+		if ($output->data)
1268 1268
 		{
1269
-			foreach($output->data as $k => $d)
1269
+			foreach ($output->data as $k => $d)
1270 1270
 			{
1271 1271
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1272 1272
 				$output->data[$k]->src = $profile_image->src;
1273 1273
 			}
1274 1274
 		}
1275 1275
 
1276
-		$this->add('voted_member_list',$output->data);
1276
+		$this->add('voted_member_list', $output->data);
1277 1277
 	}
1278 1278
 
1279 1279
 	/**
@@ -1283,7 +1283,7 @@  discard block
 block discarded – undo
1283 1283
 	function getStatusNameList()
1284 1284
 	{
1285 1285
 		global $lang;
1286
-		if(!isset($lang->status_name_list))
1286
+		if (!isset($lang->status_name_list))
1287 1287
 			return array_flip($this->getStatusList());
1288 1288
 		else return $lang->status_name_list;
1289 1289
 	}
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 	{
1299 1299
 		$sortIndex = $obj->sort_index;
1300 1300
 		$isExtraVars = false;
1301
-		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')))
1301
+		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')))
1302 1302
 		{
1303 1303
 			// get module_srl extra_vars list
1304 1304
 			if ($load_extra_vars)
@@ -1313,11 +1313,11 @@  discard block
 block discarded – undo
1313 1313
 				else
1314 1314
 				{
1315 1315
 					$check_array = array();
1316
-					foreach($extra_output->data as $val)
1316
+					foreach ($extra_output->data as $val)
1317 1317
 					{
1318 1318
 						$check_array[] = $val->eid;
1319 1319
 					}
1320
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1320
+					if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1321 1321
 					else $isExtraVars = true;
1322 1322
 				}
1323 1323
 			}
@@ -1345,13 +1345,13 @@  discard block
 block discarded – undo
1345 1345
 	{
1346 1346
 		// Variable check
1347 1347
 		$args = new stdClass();
1348
-		$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1348
+		$args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null;
1349 1349
 		$args->order_type = $searchOpt->order_type;
1350
-		$args->page = $searchOpt->page?$searchOpt->page:1;
1351
-		$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1352
-		$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1353
-		$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1354
-		$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1350
+		$args->page = $searchOpt->page ? $searchOpt->page : 1;
1351
+		$args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20;
1352
+		$args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10;
1353
+		$args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null;
1354
+		$args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null;
1355 1355
 		$args->member_srl = $searchOpt->member_srl;
1356 1356
 		$args->member_srls = $searchOpt->member_srls;
1357 1357
 
@@ -1361,10 +1361,10 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
 		// Check the target and sequence alignment
1363 1363
 		$orderType = array('desc' => 1, 'asc' => 1);
1364
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1364
+		if (!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1365 1365
 
1366 1366
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1367
-		if($searchOpt->mid)
1367
+		if ($searchOpt->mid)
1368 1368
 		{
1369 1369
 			$oModuleModel = getModel('module');
1370 1370
 			$args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -1372,30 +1372,30 @@  discard block
 block discarded – undo
1372 1372
 		}
1373 1373
 
1374 1374
 		// Module_srl passed the array may be a check whether the array
1375
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1375
+		if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1376 1376
 		else $args->module_srl = $searchOpt->module_srl;
1377 1377
 
1378 1378
 		// Except for the test module_srl
1379
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1379
+		if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1380 1380
 		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1381 1381
 
1382 1382
 		// only admin document list, temp document showing
1383
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1383
+		if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1384 1384
 		else
1385 1385
 		{
1386
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1386
+			if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1387 1387
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1388 1388
 			else
1389 1389
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1390 1390
 		}
1391 1391
 
1392 1392
 		// Category is selected, further sub-categories until all conditions
1393
-		if($args->category_srl)
1393
+		if ($args->category_srl)
1394 1394
 		{
1395 1395
 			$category_list = $this->getCategoryList($args->module_srl);
1396 1396
 			$category_info = $category_list[$args->category_srl];
1397 1397
 			$category_info->childs[] = $args->category_srl;
1398
-			$args->category_srl = implode(',',$category_info->childs);
1398
+			$args->category_srl = implode(',', $category_info->childs);
1399 1399
 		}
1400 1400
 
1401 1401
 		// Used to specify the default query id (based on several search options to query id modified)
@@ -1408,24 +1408,24 @@  discard block
 block discarded – undo
1408 1408
 		$search_target = $searchOpt->search_target;
1409 1409
 		$search_keyword = $searchOpt->search_keyword;
1410 1410
 
1411
-		if($search_target && $search_keyword)
1411
+		if ($search_target && $search_keyword)
1412 1412
 		{
1413
-			switch($search_target)
1413
+			switch ($search_target)
1414 1414
 			{
1415 1415
 				case 'title' :
1416 1416
 				case 'content' :
1417
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1417
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1418 1418
 					$args->{"s_".$search_target} = $search_keyword;
1419 1419
 					$use_division = true;
1420 1420
 					break;
1421 1421
 				case 'title_content' :
1422
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1422
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1423 1423
 					$args->s_title = $search_keyword;
1424 1424
 					$args->s_content = $search_keyword;
1425 1425
 					$use_division = true;
1426 1426
 					break;
1427 1427
 				case 'user_id' :
1428
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1428
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1429 1429
 					$args->s_user_id = $search_keyword;
1430 1430
 					$args->sort_index = 'documents.'.$args->sort_index;
1431 1431
 					break;
@@ -1433,18 +1433,18 @@  discard block
 block discarded – undo
1433 1433
 				case 'nick_name' :
1434 1434
 				case 'email_address' :
1435 1435
 				case 'homepage' :
1436
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1436
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1437 1437
 					$args->{"s_".$search_target} = $search_keyword;
1438 1438
 					break;
1439 1439
 				case 'is_notice' :
1440
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1441
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1440
+					if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N';
1441
+					elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y';
1442 1442
 					else $args->{"s_".$search_target} = '';
1443 1443
 					break;
1444 1444
 				case 'is_secret' :
1445
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1446
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1447
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1445
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1446
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1447
+					elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp'));
1448 1448
 					break;
1449 1449
 				case 'member_srl' :
1450 1450
 				case 'readed_count' :
@@ -1452,17 +1452,17 @@  discard block
 block discarded – undo
1452 1452
 				case 'comment_count' :
1453 1453
 				case 'trackback_count' :
1454 1454
 				case 'uploaded_count' :
1455
-					$args->{"s_".$search_target} = (int)$search_keyword;
1455
+					$args->{"s_".$search_target} = (int) $search_keyword;
1456 1456
 					break;
1457 1457
 				case 'member_srls' :
1458
-					$args->{"s_".$search_target} = (int)$search_keyword;
1458
+					$args->{"s_".$search_target} = (int) $search_keyword;
1459 1459
 
1460
-					if($logged_info->member_srl)
1460
+					if ($logged_info->member_srl)
1461 1461
 					{
1462 1462
 						$srls = explode(',', $search_keyword);
1463
-						foreach($srls as $srl)
1463
+						foreach ($srls as $srl)
1464 1464
 						{
1465
-							if(abs($srl) != $logged_info->member_srl)
1465
+							if (abs($srl) != $logged_info->member_srl)
1466 1466
 							{
1467 1467
 								break; // foreach
1468 1468
 							}
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 					}
1474 1474
 					break;
1475 1475
 				case 'blamed_count' :
1476
-					$args->{"s_".$search_target} = (int)$search_keyword * -1;
1476
+					$args->{"s_".$search_target} = (int) $search_keyword * -1;
1477 1477
 					break;
1478 1478
 				case 'regdate' :
1479 1479
 				case 'last_update' :
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 					$use_division = true;
1487 1487
 					break;
1488 1488
 				case 'tag' :
1489
-					$args->s_tags = str_replace(' ','%',$search_keyword);
1489
+					$args->s_tags = str_replace(' ', '%', $search_keyword);
1490 1490
 					$query_id = 'document.getDocumentListWithinTag';
1491 1491
 					break;
1492 1492
 				case 'extra_vars':
@@ -1494,9 +1494,9 @@  discard block
 block discarded – undo
1494 1494
 					$query_id = 'document.getDocumentListWithinExtraVars';
1495 1495
 					break;
1496 1496
 				default :
1497
-					if(strpos($search_target,'extra_vars')!==false) {
1497
+					if (strpos($search_target, 'extra_vars') !== false) {
1498 1498
 						$args->var_idx = substr($search_target, strlen('extra_vars'));
1499
-						$args->var_value = str_replace(' ','%',$search_keyword);
1499
+						$args->var_value = str_replace(' ', '%', $search_keyword);
1500 1500
 						$args->sort_index = 'documents.'.$args->sort_index;
1501 1501
 						$query_id = 'document.getDocumentListWithExtraVars';
1502 1502
 					}
@@ -1513,18 +1513,18 @@  discard block
 block discarded – undo
1513 1513
 			/**
1514 1514
 			 * list_order asc sort of division that can be used only when
1515 1515
 			 */
1516
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1516
+			if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1517 1517
 
1518 1518
 			/**
1519 1519
 			 * If it is true, use_division changed to use the document division
1520 1520
 			 */
1521
-			if($use_division)
1521
+			if ($use_division)
1522 1522
 			{
1523 1523
 				// Division begins
1524
-				$division = (int)Context::get('division');
1524
+				$division = (int) Context::get('division');
1525 1525
 
1526 1526
 				// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1527
-				if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1527
+				if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1528 1528
 				{
1529 1529
 					$listSqlID = 'document.getDocumentListUseIndex';
1530 1530
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
 				}
1537 1537
 
1538 1538
 				// If you do not value the best division top
1539
-				if(!$division)
1539
+				if (!$division)
1540 1540
 				{
1541 1541
 					$division_args = new stdClass();
1542 1542
 					$division_args->module_srl = $args->module_srl;
@@ -1547,7 +1547,7 @@  discard block
 block discarded – undo
1547 1547
 					$division_args->statusList = $args->statusList;
1548 1548
 
1549 1549
 					$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1550
-					if($output->data)
1550
+					if ($output->data)
1551 1551
 					{
1552 1552
 						$item = array_pop($output->data);
1553 1553
 						$division = $item->list_order;
@@ -1556,10 +1556,10 @@  discard block
 block discarded – undo
1556 1556
 				}
1557 1557
 
1558 1558
 				// The last division
1559
-				$last_division = (int)Context::get('last_division');
1559
+				$last_division = (int) Context::get('last_division');
1560 1560
 
1561 1561
 				// Division after division from the 5000 value of the specified Wanted
1562
-				if(!$last_division)
1562
+				if (!$last_division)
1563 1563
 				{
1564 1564
 					$last_division_args = new stdClass();
1565 1565
 					$last_division_args->module_srl = $args->module_srl;
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
 					$last_division_args->page = 5001;
1572 1572
 
1573 1573
 					$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1574
-					if($output->data)
1574
+					if ($output->data)
1575 1575
 					{
1576 1576
 						$item = array_pop($output->data);
1577 1577
 						$last_division = $item->list_order;
@@ -1579,14 +1579,14 @@  discard block
 block discarded – undo
1579 1579
 				}
1580 1580
 
1581 1581
 				// Make sure that after last_division article
1582
-				if($last_division)
1582
+				if ($last_division)
1583 1583
 				{
1584 1584
 					$last_division_args = new stdClass();
1585 1585
 					$last_division_args->module_srl = $args->module_srl;
1586 1586
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1587 1587
 					$last_division_args->list_order = $last_division;
1588 1588
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1589
-					if($output->data->count<1) $last_division = null;
1589
+					if ($output->data->count < 1) $last_division = null;
1590 1590
 				}
1591 1591
 
1592 1592
 				$args->division = $division;
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 	 * @param int $count
1620 1620
 	 * @return object
1621 1621
 	 */
1622
-	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1622
+	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0)
1623 1623
 	{
1624 1624
 		$args = new stdClass();
1625 1625
 		$args->member_srl = $member_srl;
@@ -1627,8 +1627,8 @@  discard block
 block discarded – undo
1627 1627
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1628 1628
 		$document_list = $output->data;
1629 1629
 
1630
-		if(!$document_list) return array();
1631
-		if(!is_array($document_list)) $document_list = array($document_list);
1630
+		if (!$document_list) return array();
1631
+		if (!is_array($document_list)) $document_list = array($document_list);
1632 1632
 
1633 1633
 		return $document_list;
1634 1634
 	}
@@ -1640,7 +1640,7 @@  discard block
 block discarded – undo
1640 1640
 	function getDocumentExtraImagePath()
1641 1641
 	{
1642 1642
 		$documentConfig = getModel('document')->getDocumentConfig();
1643
-		if(Mobile::isFromMobilePhone())
1643
+		if (Mobile::isFromMobilePhone())
1644 1644
 		{
1645 1645
 			$iconSkin = $documentConfig->micons;
1646 1646
 		}
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 		{
1649 1649
 			$iconSkin = $documentConfig->icons;
1650 1650
 		}
1651
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1651
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1652 1652
 
1653 1653
 		return $path;
1654 1654
 	}
Please login to merge, or discard this patch.
Braces   +301 added lines, -141 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
 			// static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남		
121 142
 			/*		
@@ -139,7 +160,9 @@  discard block
 block discarded – undo
139 160
 	 */
140 161
 	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
141 162
 	{
142
-		if(!$document_srl) return new documentItem();
163
+		if(!$document_srl) {
164
+			return new documentItem();
165
+		}
143 166
 
144 167
 		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
145 168
 		{
@@ -149,9 +172,13 @@  discard block
 block discarded – undo
149 172
 				return $oDocument;
150 173
 			}
151 174
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
152
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
175
+			if($load_extra_vars) {
176
+				$this->setToAllDocumentExtraVars();
177
+			}
178
+		}
179
+		if($is_admin) {
180
+			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
153 181
 		}
154
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
155 182
 
156 183
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
157 184
 	}
@@ -170,8 +197,7 @@  discard block
 block discarded – undo
170 197
 		{
171 198
 			$list_count = count($document_srls);
172 199
 			$document_srls = implode(',',$document_srls);
173
-		}
174
-		else
200
+		} else
175 201
 		{
176 202
 			$list_count = 1;
177 203
 		}
@@ -182,28 +208,38 @@  discard block
 block discarded – undo
182 208
 
183 209
 		$output = executeQuery('document.getDocuments', $args, $columnList);
184 210
 		$document_list = $output->data;
185
-		if(!$document_list) return;
186
-		if(!is_array($document_list)) $document_list = array($document_list);
211
+		if(!$document_list) {
212
+			return;
213
+		}
214
+		if(!is_array($document_list)) {
215
+			$document_list = array($document_list);
216
+		}
187 217
 
188 218
 		$document_count = count($document_list);
189 219
 		foreach($document_list as $key => $attribute)
190 220
 		{
191 221
 			$document_srl = $attribute->document_srl;
192
-			if(!$document_srl) continue;
222
+			if(!$document_srl) {
223
+				continue;
224
+			}
193 225
 
194 226
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
195 227
 			{
196 228
 				$oDocument = null;
197 229
 				$oDocument = new documentItem();
198 230
 				$oDocument->setAttribute($attribute, false);
199
-				if($is_admin) $oDocument->setGrant();
231
+				if($is_admin) {
232
+					$oDocument->setGrant();
233
+				}
200 234
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
201 235
 			}
202 236
 
203 237
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
204 238
 		}
205 239
 
206
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
240
+		if($load_extra_vars) {
241
+			$this->setToAllDocumentExtraVars();
242
+		}
207 243
 
208 244
 		$output = null;
209 245
 		if(count($result))
@@ -251,18 +287,15 @@  discard block
 block discarded – undo
251 287
 		{
252 288
 			$output = $obj->use_alternate_output;
253 289
 			unset($obj->use_alternate_output);
254
-		}
255
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
290
+		} elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
256 291
 		{
257 292
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
258 293
 			$args->sort_index = str_replace('documents.','',$args->sort_index);
259 294
 			$output = executeQueryArray($query_id, $args);
260
-		}
261
-		elseif ($sort_check->isExtraVars)
295
+		} elseif ($sort_check->isExtraVars)
262 296
 		{
263 297
 			$output = executeQueryArray($query_id, $args);
264
-		}
265
-		else
298
+		} else
266 299
 		{
267 300
 			// document.getDocumentList query execution
268 301
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
@@ -272,11 +305,15 @@  discard block
 block discarded – undo
272 305
 				$group_args = clone($args);
273 306
 				$group_args->sort_index = 'documents.'.$args->sort_index;
274 307
 				$output = executeQueryArray($query_id, $group_args);
275
-				if(!$output->toBool()||!count($output->data)) return $output;
308
+				if(!$output->toBool()||!count($output->data)) {
309
+					return $output;
310
+				}
276 311
 
277 312
 				foreach($output->data as $key => $val)
278 313
 				{
279
-					if($val->document_srl) $target_srls[] = $val->document_srl;
314
+					if($val->document_srl) {
315
+						$target_srls[] = $val->document_srl;
316
+					}
280 317
 				}
281 318
 
282 319
 				$page_navigation = $output->page_navigation;
@@ -294,14 +331,15 @@  discard block
 block discarded – undo
294 331
 				$output->total_count = $page_navigation->total_count;
295 332
 				$output->total_page = $page_navigation->total_page;
296 333
 				$output->page = $page_navigation->cur_page;
297
-			}
298
-			else
334
+			} else
299 335
 			{
300 336
 				$output = executeQueryArray($query_id, $args, $columnList);
301 337
 			}
302 338
 		}
303 339
 		// Return if no result or an error occurs
304
-		if(!$output->toBool()||!count($output->data)) return $output;
340
+		if(!$output->toBool()||!count($output->data)) {
341
+			return $output;
342
+		}
305 343
 		$idx = 0;
306 344
 		$data = $output->data;
307 345
 		unset($output->data);
@@ -316,20 +354,26 @@  discard block
 block discarded – undo
316 354
 		{
317 355
 			foreach($data as $key => $attribute)
318 356
 			{
319
-				if($attribute->is_notice == 'Y') $virtual_number --;
357
+				if($attribute->is_notice == 'Y') {
358
+					$virtual_number --;
359
+				}
320 360
 			}
321 361
 		}
322 362
 
323 363
 		foreach($data as $key => $attribute)
324 364
 		{
325
-			if($except_notice && $attribute->is_notice == 'Y') continue;
365
+			if($except_notice && $attribute->is_notice == 'Y') {
366
+				continue;
367
+			}
326 368
 			$document_srl = $attribute->document_srl;
327 369
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
328 370
 			{
329 371
 				$oDocument = null;
330 372
 				$oDocument = new documentItem();
331 373
 				$oDocument->setAttribute($attribute, false);
332
-				if($is_admin) $oDocument->setGrant();
374
+				if($is_admin) {
375
+					$oDocument->setGrant();
376
+				}
333 377
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
334 378
 			}
335 379
 
@@ -337,7 +381,9 @@  discard block
 block discarded – undo
337 381
 			$virtual_number--;
338 382
 		}
339 383
 
340
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
384
+		if($load_extra_vars) {
385
+			$this->setToAllDocumentExtraVars();
386
+		}
341 387
 
342 388
 		if(count($output->data))
343 389
 		{
@@ -377,17 +423,20 @@  discard block
 block discarded – undo
377 423
 		{
378 424
 			$output = $obj->use_alternate_output;
379 425
 			unset($obj->use_alternate_output);
380
-		}
381
-		else {
426
+		} else {
382 427
 			$output = executeQueryArray('document.getNoticeList', $args, $columnList);
383 428
 		}
384 429
 		
385
-		if(!$output->toBool()||!$output->data) return;
430
+		if(!$output->toBool()||!$output->data) {
431
+			return;
432
+		}
386 433
 
387 434
 		foreach($output->data as $key => $val)
388 435
 		{
389 436
 			$document_srl = $val->document_srl;
390
-			if(!$document_srl) continue;
437
+			if(!$document_srl) {
438
+				continue;
439
+			}
391 440
 
392 441
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
393 442
 			{
@@ -483,7 +532,9 @@  discard block
 block discarded – undo
483 532
 
484 533
 				$oExtraVar->setExtraVarKeys($output->data);
485 534
 				$keys = $oExtraVar->getExtraVars();
486
-				if(!$keys) $keys = array();
535
+				if(!$keys) {
536
+					$keys = array();
537
+				}
487 538
 
488 539
 				if($oCacheHandler->isSupport())
489 540
 				{
@@ -513,7 +564,9 @@  discard block
 block discarded – undo
513 564
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
514 565
 			$this->setToAllDocumentExtraVars();
515 566
 		}
516
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
567
+		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
568
+			ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
569
+		}
517 570
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
518 571
 	}
519 572
 
@@ -543,7 +596,9 @@  discard block
 block discarded – undo
543 596
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
544 597
 			$module_srl = $oDocument->get('module_srl');
545 598
 			$member_srl = $oDocument->get('member_srl');
546
-			if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
599
+			if(!$module_srl) {
600
+				return new BaseObject(-1, 'msg_invalid_request');
601
+			}
547 602
 
548 603
 			$oModuleModel = getModel('module');
549 604
 			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
@@ -616,7 +671,9 @@  discard block
 block discarded – undo
616 671
 	 */
617 672
 	function getDocumentCount($module_srl, $search_obj = NULL)
618 673
 	{
619
-		if(is_null($search_obj)) $search_obj = new stdClass();
674
+		if(is_null($search_obj)) {
675
+			$search_obj = new stdClass();
676
+		}
620 677
 		$search_obj->module_srl = $module_srl;
621 678
 
622 679
 		$output = executeQuery('document.getDocumentCount', $search_obj);
@@ -633,7 +690,9 @@  discard block
 block discarded – undo
633 690
 	function getDocumentCountByGroupStatus($search_obj = NULL)
634 691
 	{
635 692
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
636
-		if(!$output->toBool()) return array();
693
+		if(!$output->toBool()) {
694
+			return array();
695
+		}
637 696
 
638 697
 		return $output->data;
639 698
 	}
@@ -672,34 +731,29 @@  discard block
 block discarded – undo
672 731
 		if($sort_check->isExtraVars)
673 732
 		{
674 733
 			return 1;
675
-		}
676
-		else
734
+		} else
677 735
 		{
678 736
 			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
679 737
 			{
680 738
 				if($args->order_type === 'desc')
681 739
 				{
682 740
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
683
-				}
684
-				else
741
+				} else
685 742
 				{
686 743
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
687 744
 				}
688
-			}
689
-			elseif($sort_check->sort_index === 'regdate')
745
+			} elseif($sort_check->sort_index === 'regdate')
690 746
 			{
691 747
 
692 748
 				if($args->order_type === 'asc')
693 749
 				{
694 750
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
695
-				}
696
-				else
751
+				} else
697 752
 				{
698 753
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
699 754
 				}
700 755
 
701
-			}
702
-			else
756
+			} else
703 757
 			{
704 758
 				return 1;
705 759
 			}
@@ -725,15 +779,16 @@  discard block
 block discarded – undo
725 779
 		$output = executeQuery('document.getCategory', $args, $columnList);
726 780
 
727 781
 		$node = $output->data;
728
-		if(!$node) return;
782
+		if(!$node) {
783
+			return;
784
+		}
729 785
 
730 786
 		if($node->group_srls)
731 787
 		{
732 788
 			$group_srls = explode(',',$node->group_srls);
733 789
 			unset($node->group_srls);
734 790
 			$node->group_srls = $group_srls;
735
-		}
736
-		else
791
+		} else
737 792
 		{
738 793
 			unset($node->group_srls);
739 794
 			$node->group_srls = array();
@@ -751,7 +806,9 @@  discard block
 block discarded – undo
751 806
 		$args = new stdClass();
752 807
 		$args->category_srl = $category_srl;
753 808
 		$output = executeQuery('document.getChildCategoryCount',$args);
754
-		if($output->data->count > 0) return true;
809
+		if($output->data->count > 0) {
810
+			return true;
811
+		}
755 812
 		return false;
756 813
 	}
757 814
 
@@ -772,7 +829,9 @@  discard block
 block discarded – undo
772 829
 		if(!file_exists($filename))
773 830
 		{
774 831
 			$oDocumentController = getController('document');
775
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
832
+			if(!$oDocumentController->makeCategoryFile($module_srl)) {
833
+				return array();
834
+			}
776 835
 		}
777 836
 
778 837
 		include($filename);
@@ -792,7 +851,9 @@  discard block
 block discarded – undo
792 851
 	 */
793 852
 	function _arrangeCategory(&$document_category, $list, $depth)
794 853
 	{
795
-		if(!count($list)) return;
854
+		if(!count($list)) {
855
+			return;
856
+		}
796 857
 		$idx = 0;
797 858
 		$list_order = array();
798 859
 		foreach($list as $key => $val)
@@ -812,8 +873,11 @@  discard block
 block discarded – undo
812 873
 			$obj->childs = array();
813 874
 			$obj->grant = $val['grant'];
814 875
 
815
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
816
-			else $selected = false;
876
+			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) {
877
+				$selected = true;
878
+			} else {
879
+				$selected = false;
880
+			}
817 881
 
818 882
 			$obj->selected = $selected;
819 883
 
@@ -824,14 +888,18 @@  discard block
 block discarded – undo
824 888
 				$parent_srl = $obj->parent_srl;
825 889
 				$document_count = $obj->document_count;
826 890
 				$expand = $obj->expand;
827
-				if($selected) $expand = true;
891
+				if($selected) {
892
+					$expand = true;
893
+				}
828 894
 
829 895
 				while($parent_srl)
830 896
 				{
831 897
 					$document_category[$parent_srl]->document_count += $document_count;
832 898
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
833 899
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
834
-					if($expand) $document_category[$parent_srl]->expand = $expand;
900
+					if($expand) {
901
+						$document_category[$parent_srl]->expand = $expand;
902
+					}
835 903
 
836 904
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
837 905
 				}
@@ -839,7 +907,9 @@  discard block
 block discarded – undo
839 907
 
840 908
 			$document_category[$key] = $obj;
841 909
 
842
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
910
+			if(count($val['list'])) {
911
+				$this->_arrangeCategory($document_category, $val['list'], $depth+1);
912
+			}
843 913
 		}
844 914
 		$document_category[$list_order[0]]->first = true;
845 915
 		$document_category[$list_order[count($list_order)-1]]->last = true;
@@ -907,13 +977,20 @@  discard block
 block discarded – undo
907 977
 		}
908 978
 		// Module_srl passed the array may be a check whether the array
909 979
 		$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;
980
+		if(is_array($obj->module_srl)) {
981
+			$args->module_srl = implode(',', $obj->module_srl);
982
+		} else {
983
+			$args->module_srl = $obj->module_srl;
984
+		}
912 985
 
913 986
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
914
-		if(!$output->toBool()||!$output->data) return $output;
987
+		if(!$output->toBool()||!$output->data) {
988
+			return $output;
989
+		}
915 990
 
916
-		if(!is_array($output->data)) $output->data = array($output->data);
991
+		if(!is_array($output->data)) {
992
+			$output->data = array($output->data);
993
+		}
917 994
 
918 995
 		return $output;
919 996
 	}
@@ -933,14 +1010,21 @@  discard block
 block discarded – undo
933 1010
 		}
934 1011
 		// Module_srl passed the array may be a check whether the array
935 1012
 		$args = new stdClass;
936
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
937
-		else $args->module_srl = $obj->module_srl;
1013
+		if(is_array($obj->module_srl)) {
1014
+			$args->module_srl = implode(',', $obj->module_srl);
1015
+		} else {
1016
+			$args->module_srl = $obj->module_srl;
1017
+		}
938 1018
 		$args->regdate = $obj->regdate;
939 1019
 
940 1020
 		$output = executeQuery('document.getDailyArchivedList', $args);
941
-		if(!$output->toBool()) return $output;
1021
+		if(!$output->toBool()) {
1022
+			return $output;
1023
+		}
942 1024
 
943
-		if(!is_array($output->data)) $output->data = array($output->data);
1025
+		if(!is_array($output->data)) {
1026
+			$output->data = array($output->data);
1027
+		}
944 1028
 
945 1029
 		return $output;
946 1030
 	}
@@ -951,7 +1035,9 @@  discard block
 block discarded – undo
951 1035
 	 */
952 1036
 	function getDocumentCategories()
953 1037
 	{
954
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
1038
+		if(!Context::get('is_logged')) {
1039
+			return new BaseObject(-1,'msg_not_permitted');
1040
+		}
955 1041
 		$module_srl = Context::get('module_srl');
956 1042
 		$categories= $this->getCategoryList($module_srl);
957 1043
 		$lang = Context::get('lang');
@@ -1046,7 +1132,9 @@  discard block
 block discarded – undo
1046 1132
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1047 1133
 		// Check permissions
1048 1134
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1049
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1135
+		if(!$grant->manager) {
1136
+			return new BaseObject(-1,'msg_not_permitted');
1137
+		}
1050 1138
 
1051 1139
 		$category_srl = Context::get('category_srl');
1052 1140
 		$category_info = $this->getCategory($category_srl);
@@ -1066,15 +1154,20 @@  discard block
 block discarded – undo
1066 1154
 	 */
1067 1155
 	function getDocumentSrlByAlias($mid, $alias)
1068 1156
 	{
1069
-		if(!$mid || !$alias) return null;
1157
+		if(!$mid || !$alias) {
1158
+			return null;
1159
+		}
1070 1160
 		$site_module_info = Context::get('site_module_info');
1071 1161
 		$args = new stdClass;
1072 1162
 		$args->mid = $mid;
1073 1163
 		$args->alias_title = $alias;
1074 1164
 		$args->site_srl = $site_module_info->site_srl;
1075 1165
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1076
-		if(!$output->data) return null;
1077
-		else return $output->data->document_srl;
1166
+		if(!$output->data) {
1167
+			return null;
1168
+		} else {
1169
+			return $output->data->document_srl;
1170
+		}
1078 1171
 	}
1079 1172
 
1080 1173
 	/**
@@ -1085,15 +1178,20 @@  discard block
 block discarded – undo
1085 1178
 	 */
1086 1179
 	function getDocumentSrlByTitle($module_srl, $title)
1087 1180
 	{
1088
-		if(!$module_srl || !$title) return null;
1181
+		if(!$module_srl || !$title) {
1182
+			return null;
1183
+		}
1089 1184
 		$args = new stdClass;
1090 1185
 		$args->module_srl = $module_srl;
1091 1186
 		$args->title = $title;
1092 1187
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1093
-		if(!$output->data) return null;
1094
-		else
1188
+		if(!$output->data) {
1189
+			return null;
1190
+		} else
1095 1191
 		{
1096
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1192
+			if(is_array($output->data)) {
1193
+				return $output->data[0]->document_srl;
1194
+			}
1097 1195
 			return $output->data->document_srl;
1098 1196
 		}
1099 1197
 	}
@@ -1105,13 +1203,18 @@  discard block
 block discarded – undo
1105 1203
 	 */
1106 1204
 	function getAlias($document_srl)
1107 1205
 	{
1108
-		if(!$document_srl) return null;
1206
+		if(!$document_srl) {
1207
+			return null;
1208
+		}
1109 1209
 		$args = new stdClass;
1110 1210
 		$args->document_srl = $document_srl;
1111 1211
 		$output = executeQueryArray('document.getAliases', $args);
1112 1212
 
1113
-		if(!$output->data) return null;
1114
-		else return $output->data[0]->alias_title;
1213
+		if(!$output->data) {
1214
+			return null;
1215
+		} else {
1216
+			return $output->data[0]->alias_title;
1217
+		}
1115 1218
 	}
1116 1219
 
1117 1220
 	/**
@@ -1168,17 +1271,23 @@  discard block
 block discarded – undo
1168 1271
 			{
1169 1272
 				case 'title' :
1170 1273
 				case 'content' :
1171
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1274
+					if($search_keyword) {
1275
+						$search_keyword = str_replace(' ','%',$search_keyword);
1276
+					}
1172 1277
 					$args->{"s_".$search_target} = $search_keyword;
1173 1278
 					$use_division = true;
1174 1279
 					break;
1175 1280
 				case 'title_content' :
1176
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1281
+					if($search_keyword) {
1282
+						$search_keyword = str_replace(' ','%',$search_keyword);
1283
+					}
1177 1284
 					$args->s_title = $search_keyword;
1178 1285
 					$args->s_content = $search_keyword;
1179 1286
 					break;
1180 1287
 				case 'user_id' :
1181
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1288
+					if($search_keyword) {
1289
+						$search_keyword = str_replace(' ','%',$search_keyword);
1290
+					}
1182 1291
 					$args->s_user_id = $search_keyword;
1183 1292
 					$args->sort_index = 'documents.'.$args->sort_index;
1184 1293
 					break;
@@ -1186,13 +1295,18 @@  discard block
 block discarded – undo
1186 1295
 				case 'nick_name' :
1187 1296
 				case 'email_address' :
1188 1297
 				case 'homepage' :
1189
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1298
+					if($search_keyword) {
1299
+						$search_keyword = str_replace(' ','%',$search_keyword);
1300
+					}
1190 1301
 					$args->{"s_".$search_target} = $search_keyword;
1191 1302
 					break;
1192 1303
 				case 'is_notice' :
1193 1304
 				case 'is_secret' :
1194
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1195
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1305
+					if($search_keyword=='N') {
1306
+						$args->statusList = array($this->getConfigStatus('public'));
1307
+					} elseif($search_keyword=='Y') {
1308
+						$args->statusList = array($this->getConfigStatus('secret'));
1309
+					}
1196 1310
 					break;
1197 1311
 				case 'member_srl' :
1198 1312
 				case 'readed_count' :
@@ -1234,34 +1348,45 @@  discard block
 block discarded – undo
1234 1348
 	{
1235 1349
 		$args = new stdClass;
1236 1350
 		$document_srl = Context::get('document_srl');
1237
-		if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1351
+		if(!$document_srl) {
1352
+			return new BaseObject(-1,'msg_invalid_request');
1353
+		}
1238 1354
 
1239 1355
 		$point = Context::get('point');
1240
-		if($point != -1) $point = 1;
1356
+		if($point != -1) {
1357
+			$point = 1;
1358
+		}
1241 1359
 
1242 1360
 		$oDocumentModel = getModel('document');
1243 1361
 		$columnList = array('document_srl', 'module_srl');
1244 1362
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1245 1363
 		$module_srl = $oDocument->get('module_srl');
1246
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1364
+		if(!$module_srl) {
1365
+			return new BaseObject(-1, 'msg_invalid_request');
1366
+		}
1247 1367
 
1248 1368
 		$oModuleModel = getModel('module');
1249 1369
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1250 1370
 		if($point == -1)
1251 1371
 		{
1252
-			if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1372
+			if($document_config->use_vote_down!='S') {
1373
+				return new BaseObject(-1, 'msg_invalid_request');
1374
+			}
1253 1375
 			$args->below_point = 0;
1254
-		}
1255
-		else
1376
+		} else
1256 1377
 		{
1257
-			if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1378
+			if($document_config->use_vote_up!='S') {
1379
+				return new BaseObject(-1, 'msg_invalid_request');
1380
+			}
1258 1381
 			$args->more_point = 0;
1259 1382
 		}
1260 1383
 
1261 1384
 		$args->document_srl = $document_srl;
1262 1385
 
1263 1386
 		$output = executeQueryArray('document.getVotedMemberList',$args);
1264
-		if(!$output->toBool()) return $output;
1387
+		if(!$output->toBool()) {
1388
+			return $output;
1389
+		}
1265 1390
 
1266 1391
 		$oMemberModel = getModel('member');
1267 1392
 		if($output->data)
@@ -1283,9 +1408,11 @@  discard block
 block discarded – undo
1283 1408
 	function getStatusNameList()
1284 1409
 	{
1285 1410
 		global $lang;
1286
-		if(!isset($lang->status_name_list))
1287
-			return array_flip($this->getStatusList());
1288
-		else return $lang->status_name_list;
1411
+		if(!isset($lang->status_name_list)) {
1412
+					return array_flip($this->getStatusList());
1413
+		} else {
1414
+			return $lang->status_name_list;
1415
+		}
1289 1416
 	}
1290 1417
 
1291 1418
 	/**
@@ -1309,20 +1436,22 @@  discard block
 block discarded – undo
1309 1436
 				if (!$extra_output->data || !$extra_output->toBool())
1310 1437
 				{
1311 1438
 					$sortIndex = 'list_order';
1312
-				}
1313
-				else
1439
+				} else
1314 1440
 				{
1315 1441
 					$check_array = array();
1316 1442
 					foreach($extra_output->data as $val)
1317 1443
 					{
1318 1444
 						$check_array[] = $val->eid;
1319 1445
 					}
1320
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1321
-					else $isExtraVars = true;
1446
+					if(!in_array($sortIndex, $check_array)) {
1447
+						$sortIndex = 'list_order';
1448
+					} else {
1449
+						$isExtraVars = true;
1450
+					}
1322 1451
 				}
1452
+			} else {
1453
+							$sortIndex = 'list_order';
1323 1454
 			}
1324
-			else
1325
-				$sortIndex = 'list_order';
1326 1455
 		}
1327 1456
 		$returnObj = new stdClass();
1328 1457
 		$returnObj->sort_index = $sortIndex;
@@ -1361,7 +1490,9 @@  discard block
 block discarded – undo
1361 1490
 
1362 1491
 		// Check the target and sequence alignment
1363 1492
 		$orderType = array('desc' => 1, 'asc' => 1);
1364
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1493
+		if(!isset($orderType[$args->order_type])) {
1494
+			$args->order_type = 'asc';
1495
+		}
1365 1496
 
1366 1497
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1367 1498
 		if($searchOpt->mid)
@@ -1372,21 +1503,29 @@  discard block
 block discarded – undo
1372 1503
 		}
1373 1504
 
1374 1505
 		// Module_srl passed the array may be a check whether the array
1375
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1376
-		else $args->module_srl = $searchOpt->module_srl;
1506
+		if(is_array($searchOpt->module_srl)) {
1507
+			$args->module_srl = implode(',', $searchOpt->module_srl);
1508
+		} else {
1509
+			$args->module_srl = $searchOpt->module_srl;
1510
+		}
1377 1511
 
1378 1512
 		// Except for the test module_srl
1379
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1380
-		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1513
+		if(is_array($searchOpt->exclude_module_srl)) {
1514
+			$args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1515
+		} else {
1516
+			$args->exclude_module_srl = $searchOpt->exclude_module_srl;
1517
+		}
1381 1518
 
1382 1519
 		// only admin document list, temp document showing
1383
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1384
-		else
1520
+		if($searchOpt->statusList) {
1521
+			$args->statusList = $searchOpt->statusList;
1522
+		} else
1385 1523
 		{
1386
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1387
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1388
-			else
1389
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1524
+			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) {
1525
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1526
+			} else {
1527
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1528
+			}
1390 1529
 		}
1391 1530
 
1392 1531
 		// Category is selected, further sub-categories until all conditions
@@ -1414,18 +1553,24 @@  discard block
 block discarded – undo
1414 1553
 			{
1415 1554
 				case 'title' :
1416 1555
 				case 'content' :
1417
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1556
+					if($search_keyword) {
1557
+						$search_keyword = str_replace(' ','%',$search_keyword);
1558
+					}
1418 1559
 					$args->{"s_".$search_target} = $search_keyword;
1419 1560
 					$use_division = true;
1420 1561
 					break;
1421 1562
 				case 'title_content' :
1422
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1563
+					if($search_keyword) {
1564
+						$search_keyword = str_replace(' ','%',$search_keyword);
1565
+					}
1423 1566
 					$args->s_title = $search_keyword;
1424 1567
 					$args->s_content = $search_keyword;
1425 1568
 					$use_division = true;
1426 1569
 					break;
1427 1570
 				case 'user_id' :
1428
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1571
+					if($search_keyword) {
1572
+						$search_keyword = str_replace(' ','%',$search_keyword);
1573
+					}
1429 1574
 					$args->s_user_id = $search_keyword;
1430 1575
 					$args->sort_index = 'documents.'.$args->sort_index;
1431 1576
 					break;
@@ -1433,18 +1578,28 @@  discard block
 block discarded – undo
1433 1578
 				case 'nick_name' :
1434 1579
 				case 'email_address' :
1435 1580
 				case 'homepage' :
1436
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1581
+					if($search_keyword) {
1582
+						$search_keyword = str_replace(' ','%',$search_keyword);
1583
+					}
1437 1584
 					$args->{"s_".$search_target} = $search_keyword;
1438 1585
 					break;
1439 1586
 				case 'is_notice' :
1440
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1441
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1442
-					else $args->{"s_".$search_target} = '';
1587
+					if($search_keyword=='N') {
1588
+						$args->{"s_".$search_target} = 'N';
1589
+					} elseif($search_keyword=='Y') {
1590
+						$args->{"s_".$search_target} = 'Y';
1591
+					} else {
1592
+						$args->{"s_".$search_target} = '';
1593
+					}
1443 1594
 					break;
1444 1595
 				case 'is_secret' :
1445
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1446
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1447
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1596
+					if($search_keyword=='N') {
1597
+						$args->statusList = array($this->getConfigStatus('public'));
1598
+					} elseif($search_keyword=='Y') {
1599
+						$args->statusList = array($this->getConfigStatus('secret'));
1600
+					} elseif($search_keyword=='temp') {
1601
+						$args->statusList = array($this->getConfigStatus('temp'));
1602
+					}
1448 1603
 					break;
1449 1604
 				case 'member_srl' :
1450 1605
 				case 'readed_count' :
@@ -1507,13 +1662,14 @@  discard block
 block discarded – undo
1507 1662
 		if ($searchOpt->isExtraVars)
1508 1663
 		{
1509 1664
 			$query_id = 'document.getDocumentListExtraSort';
1510
-		}
1511
-		else
1665
+		} else
1512 1666
 		{
1513 1667
 			/**
1514 1668
 			 * list_order asc sort of division that can be used only when
1515 1669
 			 */
1516
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1670
+			if($args->sort_index != 'list_order' || $args->order_type != 'asc') {
1671
+				$use_division = false;
1672
+			}
1517 1673
 
1518 1674
 			/**
1519 1675
 			 * If it is true, use_division changed to use the document division
@@ -1528,8 +1684,7 @@  discard block
 block discarded – undo
1528 1684
 				{
1529 1685
 					$listSqlID = 'document.getDocumentListUseIndex';
1530 1686
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
1531
-				}
1532
-				else
1687
+				} else
1533 1688
 				{
1534 1689
 					$listSqlID = 'document.getDocumentList';
1535 1690
 					$divisionSqlID = 'document.getDocumentDivision';
@@ -1586,7 +1741,9 @@  discard block
 block discarded – undo
1586 1741
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1587 1742
 					$last_division_args->list_order = $last_division;
1588 1743
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1589
-					if($output->data->count<1) $last_division = null;
1744
+					if($output->data->count<1) {
1745
+						$last_division = null;
1746
+					}
1590 1747
 				}
1591 1748
 
1592 1749
 				$args->division = $division;
@@ -1627,8 +1784,12 @@  discard block
 block discarded – undo
1627 1784
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1628 1785
 		$document_list = $output->data;
1629 1786
 
1630
-		if(!$document_list) return array();
1631
-		if(!is_array($document_list)) $document_list = array($document_list);
1787
+		if(!$document_list) {
1788
+			return array();
1789
+		}
1790
+		if(!is_array($document_list)) {
1791
+			$document_list = array($document_list);
1792
+		}
1632 1793
 
1633 1794
 		return $document_list;
1634 1795
 	}
@@ -1643,8 +1804,7 @@  discard block
 block discarded – undo
1643 1804
 		if(Mobile::isFromMobilePhone())
1644 1805
 		{
1645 1806
 			$iconSkin = $documentConfig->micons;
1646
-		}
1647
-		else
1807
+		} else
1648 1808
 		{
1649 1809
 			$iconSkin = $documentConfig->icons;
1650 1810
 		}
Please login to merge, or discard this patch.