GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 898676...46e689 )
by gyeong-won
26:02 queued 16:27
created
modules/document/document.model.php 2 patches
Spacing   +235 added lines, -235 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,11 +113,11 @@  discard block
 block discarded – undo
113 113
 			$evars = new ExtraVar($module_srl);
114 114
 			$evars->setExtraVarKeys($extra_keys);
115 115
 			// Title Processing
116
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
116
+			if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]);
117 117
 			// Information processing
118
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
118
+			if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]);
119 119
 
120
-			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
120
+			if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
121 121
 			{
122 122
 				unset($checked_documents[$document_srl]);
123 123
 			}
@@ -134,21 +134,21 @@  discard block
 block discarded – undo
134 134
 	 * @param array $columnList
135 135
 	 * @return documentItem
136 136
 	 */
137
-	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
137
+	function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
138 138
 	{
139
-		if(!$document_srl) return new documentItem();
139
+		if (!$document_srl) return new documentItem();
140 140
 
141
-		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
141
+		if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
142 142
 		{
143 143
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
144
-			if(!$oDocument->isExists())
144
+			if (!$oDocument->isExists())
145 145
 			{
146 146
 				return $oDocument;
147 147
 			}
148 148
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
149
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
149
+			if ($load_extra_vars) $this->setToAllDocumentExtraVars();
150 150
 		}
151
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
151
+		if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
152 152
 
153 153
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
154 154
 	}
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
 	 * @param array $columnList
162 162
 	 * @return array value type is documentItem
163 163
 	 */
164
-	function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
164
+	function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
165 165
 	{
166
-		if(is_array($document_srls))
166
+		if (is_array($document_srls))
167 167
 		{
168 168
 			$list_count = count($document_srls);
169
-			$document_srls = implode(',',$document_srls);
169
+			$document_srls = implode(',', $document_srls);
170 170
 		}
171 171
 		else
172 172
 		{
@@ -179,33 +179,33 @@  discard block
 block discarded – undo
179 179
 
180 180
 		$output = executeQuery('document.getDocuments', $args, $columnList);
181 181
 		$document_list = $output->data;
182
-		if(!$document_list) return;
183
-		if(!is_array($document_list)) $document_list = array($document_list);
182
+		if (!$document_list) return;
183
+		if (!is_array($document_list)) $document_list = array($document_list);
184 184
 
185 185
 		$document_count = count($document_list);
186
-		foreach($document_list as $key => $attribute)
186
+		foreach ($document_list as $key => $attribute)
187 187
 		{
188 188
 			$document_srl = $attribute->document_srl;
189
-			if(!$document_srl) continue;
189
+			if (!$document_srl) continue;
190 190
 
191
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
191
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
192 192
 			{
193 193
 				$oDocument = null;
194 194
 				$oDocument = new documentItem();
195 195
 				$oDocument->setAttribute($attribute, false);
196
-				if($is_admin) $oDocument->setGrant();
196
+				if ($is_admin) $oDocument->setGrant();
197 197
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
198 198
 			}
199 199
 
200 200
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
201 201
 		}
202 202
 
203
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
203
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
204 204
 
205 205
 		$output = null;
206
-		if(count($result))
206
+		if (count($result))
207 207
 		{
208
-			foreach($result as $document_srl => $val)
208
+			foreach ($result as $document_srl => $val)
209 209
 			{
210 210
 				$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
211 211
 			}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @param array $columnList
223 223
 	 * @return BaseObject
224 224
 	 */
225
-	function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
225
+	function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
226 226
 	{
227 227
 		$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
228 228
 		$obj->sort_index = $sort_check->sort_index;
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		// Call trigger (before)
233 233
 		// This trigger can be used to set an alternative output using a different search method
234 234
 		$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
235
-		if($output instanceof BaseObject && !$output->toBool())
235
+		if ($output instanceof BaseObject && !$output->toBool())
236 236
 		{
237 237
 			return $output;
238 238
 		}
@@ -249,10 +249,10 @@  discard block
 block discarded – undo
249 249
 			$output = $obj->use_alternate_output;
250 250
 			unset($obj->use_alternate_output);
251 251
 		}
252
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
252
+		elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars'))
253 253
 		{
254 254
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
255
-			$args->sort_index = str_replace('documents.','',$args->sort_index);
255
+			$args->sort_index = str_replace('documents.', '', $args->sort_index);
256 256
 			$output = executeQueryArray($query_id, $args);
257 257
 		}
258 258
 		elseif ($sort_check->isExtraVars)
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 			// document.getDocumentList query execution
265 265
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
266 266
 			$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
267
-			if(isset($groupByQuery[$query_id]))
267
+			if (isset($groupByQuery[$query_id]))
268 268
 			{
269 269
 				$group_args = clone($args);
270 270
 				$group_args->sort_index = 'documents.'.$args->sort_index;
271 271
 				$output = executeQueryArray($query_id, $group_args);
272
-				if(!$output->toBool()||!count($output->data)) return $output;
272
+				if (!$output->toBool() || !count($output->data)) return $output;
273 273
 
274
-				foreach($output->data as $key => $val)
274
+				foreach ($output->data as $key => $val)
275 275
 				{
276
-					if($val->document_srl) $target_srls[] = $val->document_srl;
276
+					if ($val->document_srl) $target_srls[] = $val->document_srl;
277 277
 				}
278 278
 
279 279
 				$page_navigation = $output->page_navigation;
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 				$virtual_number = $keys[0];
282 282
 
283 283
 				$target_args = new stdClass();
284
-				$target_args->document_srls = implode(',',$target_srls);
284
+				$target_args->document_srls = implode(',', $target_srls);
285 285
 				$target_args->list_order = $args->sort_index;
286 286
 				$target_args->order_type = $args->order_type;
287 287
 				$target_args->list_count = $args->list_count;
@@ -298,35 +298,35 @@  discard block
 block discarded – undo
298 298
 			}
299 299
 		}
300 300
 		// Return if no result or an error occurs
301
-		if(!$output->toBool()||!count($output->data)) return $output;
301
+		if (!$output->toBool() || !count($output->data)) return $output;
302 302
 		$idx = 0;
303 303
 		$data = $output->data;
304 304
 		unset($output->data);
305 305
 
306
-		if(!isset($virtual_number))
306
+		if (!isset($virtual_number))
307 307
 		{
308 308
 			$keys = array_keys($data);
309 309
 			$virtual_number = $keys[0];
310 310
 		}
311 311
 
312
-		if($except_notice)
312
+		if ($except_notice)
313 313
 		{
314
-			foreach($data as $key => $attribute)
314
+			foreach ($data as $key => $attribute)
315 315
 			{
316
-				if($attribute->is_notice == 'Y') $virtual_number --;
316
+				if ($attribute->is_notice == 'Y') $virtual_number--;
317 317
 			}
318 318
 		}
319 319
 
320
-		foreach($data as $key => $attribute)
320
+		foreach ($data as $key => $attribute)
321 321
 		{
322
-			if($except_notice && $attribute->is_notice == 'Y') continue;
322
+			if ($except_notice && $attribute->is_notice == 'Y') continue;
323 323
 			$document_srl = $attribute->document_srl;
324
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
324
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
325 325
 			{
326 326
 				$oDocument = null;
327 327
 				$oDocument = new documentItem();
328 328
 				$oDocument->setAttribute($attribute, false);
329
-				if($is_admin) $oDocument->setGrant();
329
+				if ($is_admin) $oDocument->setGrant();
330 330
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
331 331
 			}
332 332
 
@@ -334,11 +334,11 @@  discard block
 block discarded – undo
334 334
 			$virtual_number--;
335 335
 		}
336 336
 
337
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
337
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
338 338
 
339
-		if(count($output->data))
339
+		if (count($output->data))
340 340
 		{
341
-			foreach($output->data as $number => $document)
341
+			foreach ($output->data as $number => $document)
342 342
 			{
343 343
 				$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
344 344
 			}
@@ -360,16 +360,16 @@  discard block
 block discarded – undo
360 360
 	{
361 361
 		$args = new stdClass();
362 362
 		$args->module_srl = $obj->module_srl;
363
-		$args->category_srl= $obj->category_srl;
363
+		$args->category_srl = $obj->category_srl;
364 364
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
365
-		if(!$output->toBool()||!$output->data) return;
365
+		if (!$output->toBool() || !$output->data) return;
366 366
 
367
-		foreach($output->data as $key => $val)
367
+		foreach ($output->data as $key => $val)
368 368
 		{
369 369
 			$document_srl = $val->document_srl;
370
-			if(!$document_srl) continue;
370
+			if (!$document_srl) continue;
371 371
 
372
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
372
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
373 373
 			{
374 374
 				$oDocument = null;
375 375
 				$oDocument = new documentItem();
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		}
381 381
 		$this->setToAllDocumentExtraVars();
382 382
 
383
-		foreach($result->data as $document_srl => $val)
383
+		foreach ($result->data as $document_srl => $val)
384 384
 		{
385 385
 			$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
386 386
 		}
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 	 */
397 397
 	function getExtraKeys($module_srl)
398 398
 	{
399
-		if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
399
+		if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
400 400
 		{
401 401
 			$keys = false;
402 402
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
403
-			if($oCacheHandler->isSupport())
403
+			if ($oCacheHandler->isSupport())
404 404
 			{
405
-				$object_key = 'module_document_extra_keys:' . $module_srl;
405
+				$object_key = 'module_document_extra_keys:'.$module_srl;
406 406
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
407 407
 				$keys = $oCacheHandler->get($cache_key);
408 408
 			}
409 409
 
410 410
 			$oExtraVar = ExtraVar::getInstance($module_srl);
411 411
 
412
-			if($keys === false)
412
+			if ($keys === false)
413 413
 			{
414 414
 				$obj = new stdClass();
415 415
 				$obj->module_srl = $module_srl;
@@ -419,13 +419,13 @@  discard block
 block discarded – undo
419 419
 
420 420
 				// correcting index order
421 421
 				$isFixed = FALSE;
422
-				if(is_array($output->data))
422
+				if (is_array($output->data))
423 423
 				{
424 424
 					$prevIdx = 0;
425
-					foreach($output->data as $no => $value)
425
+					foreach ($output->data as $no => $value)
426 426
 					{
427 427
 						// case first
428
-						if($prevIdx == 0 && $value->idx != 1)
428
+						if ($prevIdx == 0 && $value->idx != 1)
429 429
 						{
430 430
 							$args = new stdClass();
431 431
 							$args->module_srl = $module_srl;
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 						}
440 440
 
441 441
 						// case others
442
-						if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
442
+						if ($prevIdx > 0 && $prevIdx + 1 != $value->idx)
443 443
 						{
444 444
 							$args = new stdClass();
445 445
 							$args->module_srl = $module_srl;
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 					}
457 457
 				}
458 458
 
459
-				if($isFixed)
459
+				if ($isFixed)
460 460
 				{
461 461
 					$output = executeQueryArray('document.getDocumentExtraKeys', $obj);
462 462
 				}
463 463
 
464 464
 				$oExtraVar->setExtraVarKeys($output->data);
465 465
 				$keys = $oExtraVar->getExtraVars();
466
-				if(!$keys) $keys = array();
466
+				if (!$keys) $keys = array();
467 467
 
468
-				if($oCacheHandler->isSupport())
468
+				if ($oCacheHandler->isSupport())
469 469
 				{
470 470
 					$oCacheHandler->put($cache_key, $keys);
471 471
 				}
@@ -486,14 +486,14 @@  discard block
 block discarded – undo
486 486
 	 */
487 487
 	function getExtraVars($module_srl, $document_srl)
488 488
 	{
489
-		if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
489
+		if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
490 490
 		{
491 491
 			// Extended to extract the values of variables set
492 492
 			$oDocument = $this->getDocument($document_srl, false);
493 493
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
494 494
 			$this->setToAllDocumentExtraVars();
495 495
 		}
496
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
496
+		if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
497 497
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
498 498
 	}
499 499
 
@@ -516,71 +516,71 @@  discard block
 block discarded – undo
516 516
 
517 517
 		$oDocumentController = getController('document');
518 518
 		// Members must be a possible feature
519
-		if($logged_info->member_srl)
519
+		if ($logged_info->member_srl)
520 520
 		{
521 521
 			$oDocumentModel = getModel('document');
522 522
 			$columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
523 523
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
524 524
 			$module_srl = $oDocument->get('module_srl');
525 525
 			$member_srl = $oDocument->get('member_srl');
526
-			if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
526
+			if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
527 527
 
528 528
 			$oModuleModel = getModel('module');
529
-			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
530
-			if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
529
+			$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
530
+			if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
531 531
 			{
532 532
 				// Add a Referral Button
533 533
 				$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
534
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
534
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript');
535 535
 			}
536 536
 
537
-			if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
537
+			if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
538 538
 			{
539 539
 				// Add button to negative
540
-				$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
541
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
540
+				$url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
541
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
542 542
 			}
543 543
 
544 544
 			// Adding Report
545 545
 			$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
546
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
546
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript');
547 547
 
548 548
 			// Add Bookmark button
549 549
 			$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
550
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
550
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript');
551 551
 		}
552 552
 		// Add print button
553
-		$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
554
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
553
+		$url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl);
554
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument');
555 555
 		// Call a trigger (after)
556 556
 		ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
557
-		if($this->grant->manager)
557
+		if ($this->grant->manager)
558 558
 		{
559 559
 			$str_confirm = Context::getLang('confirm_move');
560 560
 			$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);
561
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
561
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript');
562 562
 		}
563 563
 
564 564
 		// If you are managing to find posts by ip
565
-		if($logged_info->is_admin == 'Y')
565
+		if ($logged_info->is_admin == 'Y')
566 566
 		{
567 567
 			$oDocumentModel = getModel('document');
568
-			$oDocument = $oDocumentModel->getDocument($document_srl);	//before setting document recycle
568
+			$oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
569 569
 
570
-			if($oDocument->isExists())
570
+			if ($oDocument->isExists())
571 571
 			{
572 572
 				// Find a post equivalent to ip address
573
-				$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
574
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
573
+				$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress());
574
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
575 575
 
576 576
 				$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
577
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
577
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
578 578
 			}
579 579
 		}
580 580
 		// Changing the language of pop-up menu
581 581
 		$menus = Context::get('document_popup_menu_list');
582 582
 		$menus_count = count($menus);
583
-		for($i=0;$i<$menus_count;$i++)
583
+		for ($i = 0; $i < $menus_count; $i++)
584 584
 		{
585 585
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
586 586
 		}
@@ -596,13 +596,13 @@  discard block
 block discarded – undo
596 596
 	 */
597 597
 	function getDocumentCount($module_srl, $search_obj = NULL)
598 598
 	{
599
-		if(is_null($search_obj)) $search_obj = new stdClass();
599
+		if (is_null($search_obj)) $search_obj = new stdClass();
600 600
 		$search_obj->module_srl = $module_srl;
601 601
 
602 602
 		$output = executeQuery('document.getDocumentCount', $search_obj);
603 603
 		// Return total number of
604 604
 		$total_count = $output->data->count;
605
-		return (int)$total_count;
605
+		return (int) $total_count;
606 606
 	}
607 607
 
608 608
 	/**
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	function getDocumentCountByGroupStatus($search_obj = NULL)
614 614
 	{
615 615
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
616
-		if(!$output->toBool()) return array();
616
+		if (!$output->toBool()) return array();
617 617
 
618 618
 		return $output->data;
619 619
 	}
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 		$output = executeQuery('document.getDocumentExtraVarsCount', $args);
633 633
 		// Return total number of
634 634
 		$total_count = $output->data->count;
635
-		return (int)$total_count;
635
+		return (int) $total_count;
636 636
 	}
637 637
 
638 638
 	/**
@@ -649,29 +649,29 @@  discard block
 block discarded – undo
649 649
 
650 650
 		$this->_setSearchOption($opt, $args, $query_id, $use_division);
651 651
 
652
-		if($sort_check->isExtraVars)
652
+		if ($sort_check->isExtraVars)
653 653
 		{
654 654
 			return 1;
655 655
 		}
656 656
 		else
657 657
 		{
658
-			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
658
+			if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
659 659
 			{
660
-				if($args->order_type === 'desc')
660
+				if ($args->order_type === 'desc')
661 661
 				{
662
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
662
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
663 663
 				}
664 664
 				else
665 665
 				{
666 666
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
667 667
 				}
668 668
 			}
669
-			elseif($sort_check->sort_index === 'regdate')
669
+			elseif ($sort_check->sort_index === 'regdate')
670 670
 			{
671 671
 
672
-				if($args->order_type === 'asc')
672
+				if ($args->order_type === 'asc')
673 673
 				{
674
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
674
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
675 675
 				}
676 676
 				else
677 677
 				{
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
 		}
687 687
 
688 688
 		// Guhanhu total number of the article search page
689
-		$output = executeQuery($query_id . 'Page', $args);
689
+		$output = executeQuery($query_id.'Page', $args);
690 690
 		$count = $output->data->count;
691
-		$page = (int)(($count-1)/$opt->list_count)+1;
691
+		$page = (int) (($count - 1) / $opt->list_count) + 1;
692 692
 		return $page;
693 693
 	}
694 694
 
@@ -700,16 +700,16 @@  discard block
 block discarded – undo
700 700
 	 */
701 701
 	function getCategory($category_srl, $columnList = array())
702 702
 	{
703
-		$args =new stdClass();
703
+		$args = new stdClass();
704 704
 		$args->category_srl = $category_srl;
705 705
 		$output = executeQuery('document.getCategory', $args, $columnList);
706 706
 
707 707
 		$node = $output->data;
708
-		if(!$node) return;
708
+		if (!$node) return;
709 709
 
710
-		if($node->group_srls)
710
+		if ($node->group_srls)
711 711
 		{
712
-			$group_srls = explode(',',$node->group_srls);
712
+			$group_srls = explode(',', $node->group_srls);
713 713
 			unset($node->group_srls);
714 714
 			$node->group_srls = $group_srls;
715 715
 		}
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
 	{
731 731
 		$args = new stdClass();
732 732
 		$args->category_srl = $category_srl;
733
-		$output = executeQuery('document.getChildCategoryCount',$args);
734
-		if($output->data->count > 0) return true;
733
+		$output = executeQuery('document.getChildCategoryCount', $args);
734
+		if ($output->data->count > 0) return true;
735 735
 		return false;
736 736
 	}
737 737
 
@@ -747,10 +747,10 @@  discard block
 block discarded – undo
747 747
 		// Category of the target module file swollen
748 748
 		$filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
749 749
 		// If the target file to the cache file regeneration category
750
-		if(!file_exists($filename))
750
+		if (!file_exists($filename))
751 751
 		{
752 752
 			$oDocumentController = getController('document');
753
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
753
+			if (!$oDocumentController->makeCategoryFile($module_srl)) return array();
754 754
 		}
755 755
 
756 756
 		include($filename);
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 	 */
771 771
 	function _arrangeCategory(&$document_category, $list, $depth)
772 772
 	{
773
-		if(!count($list)) return;
773
+		if (!count($list)) return;
774 774
 		$idx = 0;
775 775
 		$list_order = array();
776
-		foreach($list as $key => $val)
776
+		foreach ($list as $key => $val)
777 777
 		{
778 778
 			$obj = new stdClass;
779 779
 			$obj->mid = $val['mid'];
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 			$obj->parent_srl = $val['parent_srl'];
783 783
 			$obj->title = $obj->text = $val['text'];
784 784
 			$obj->description = $val['description'];
785
-			$obj->expand = $val['expand']=='Y'?true:false;
785
+			$obj->expand = $val['expand'] == 'Y' ?true:false;
786 786
 			$obj->color = $val['color'];
787 787
 			$obj->document_count = $val['document_count'];
788 788
 			$obj->depth = $depth;
@@ -790,26 +790,26 @@  discard block
 block discarded – undo
790 790
 			$obj->childs = array();
791 791
 			$obj->grant = $val['grant'];
792 792
 
793
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
793
+			if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
794 794
 			else $selected = false;
795 795
 
796 796
 			$obj->selected = $selected;
797 797
 
798 798
 			$list_order[$idx++] = $obj->category_srl;
799 799
 			// If you have a parent category of child nodes apply data
800
-			if($obj->parent_srl)
800
+			if ($obj->parent_srl)
801 801
 			{
802 802
 				$parent_srl = $obj->parent_srl;
803 803
 				$document_count = $obj->document_count;
804 804
 				$expand = $obj->expand;
805
-				if($selected) $expand = true;
805
+				if ($selected) $expand = true;
806 806
 
807
-				while($parent_srl)
807
+				while ($parent_srl)
808 808
 				{
809 809
 					$document_category[$parent_srl]->document_count += $document_count;
810 810
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
811 811
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
812
-					if($expand) $document_category[$parent_srl]->expand = $expand;
812
+					if ($expand) $document_category[$parent_srl]->expand = $expand;
813 813
 
814 814
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
815 815
 				}
@@ -817,10 +817,10 @@  discard block
 block discarded – undo
817 817
 
818 818
 			$document_category[$key] = $obj;
819 819
 
820
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
820
+			if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1);
821 821
 		}
822 822
 		$document_category[$list_order[0]]->first = true;
823
-		$document_category[$list_order[count($list_order)-1]]->last = true;
823
+		$document_category[$list_order[count($list_order) - 1]]->last = true;
824 824
 	}
825 825
 
826 826
 	/**
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 		$args->module_srl = $module_srl;
836 836
 		$args->category_srl = $category_srl;
837 837
 		$output = executeQuery('document.getCategoryDocumentCount', $args);
838
-		return (int)$output->data->count;
838
+		return (int) $output->data->count;
839 839
 	}
840 840
 
841 841
 	/**
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 	 */
846 846
 	function getCategoryXmlFile($module_srl)
847 847
 	{
848
-		$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
849
-		if(!file_exists($xml_file))
848
+		$xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl);
849
+		if (!file_exists($xml_file))
850 850
 		{
851 851
 			$oDocumentController = getController('document');
852 852
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 	 */
862 862
 	function getCategoryPhpFile($module_srl)
863 863
 	{
864
-		$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
865
-		if(!file_exists($php_file))
864
+		$php_file = sprintf('files/cache/document_category/%s.php', $module_srl);
865
+		if (!file_exists($php_file))
866 866
 		{
867 867
 			$oDocumentController = getController('document');
868 868
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 	 */
878 878
 	function getMonthlyArchivedList($obj)
879 879
 	{
880
-		if($obj->mid)
880
+		if ($obj->mid)
881 881
 		{
882 882
 			$oModuleModel = getModel('module');
883 883
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -885,13 +885,13 @@  discard block
 block discarded – undo
885 885
 		}
886 886
 		// Module_srl passed the array may be a check whether the array
887 887
 		$args = new stdClass;
888
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
888
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
889 889
 		else $args->module_srl = $obj->module_srl;
890 890
 
891 891
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
892
-		if(!$output->toBool()||!$output->data) return $output;
892
+		if (!$output->toBool() || !$output->data) return $output;
893 893
 
894
-		if(!is_array($output->data)) $output->data = array($output->data);
894
+		if (!is_array($output->data)) $output->data = array($output->data);
895 895
 
896 896
 		return $output;
897 897
 	}
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	 */
904 904
 	function getDailyArchivedList($obj)
905 905
 	{
906
-		if($obj->mid)
906
+		if ($obj->mid)
907 907
 		{
908 908
 			$oModuleModel = getModel('module');
909 909
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -911,14 +911,14 @@  discard block
 block discarded – undo
911 911
 		}
912 912
 		// Module_srl passed the array may be a check whether the array
913 913
 		$args = new stdClass;
914
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
914
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
915 915
 		else $args->module_srl = $obj->module_srl;
916 916
 		$args->regdate = $obj->regdate;
917 917
 
918 918
 		$output = executeQuery('document.getDailyArchivedList', $args);
919
-		if(!$output->toBool()) return $output;
919
+		if (!$output->toBool()) return $output;
920 920
 
921
-		if(!is_array($output->data)) $output->data = array($output->data);
921
+		if (!is_array($output->data)) $output->data = array($output->data);
922 922
 
923 923
 		return $output;
924 924
 	}
@@ -929,17 +929,17 @@  discard block
 block discarded – undo
929 929
 	 */
930 930
 	function getDocumentCategories()
931 931
 	{
932
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
932
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
933 933
 		$module_srl = Context::get('module_srl');
934
-		$categories= $this->getCategoryList($module_srl);
934
+		$categories = $this->getCategoryList($module_srl);
935 935
 		$lang = Context::get('lang');
936 936
 		// No additional category
937 937
 		$output = "0,0,{$lang->none_category}\n";
938
-		if($categories)
938
+		if ($categories)
939 939
 		{
940
-			foreach($categories as $category_srl => $category)
940
+			foreach ($categories as $category_srl => $category)
941 941
 			{
942
-				$output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
942
+				$output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title);
943 943
 			}
944 944
 		}
945 945
 		$this->add('categories', $output);
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 	 */
952 952
 	function getDocumentConfig()
953 953
 	{
954
-		if($this->documentConfig === NULL)
954
+		if ($this->documentConfig === NULL)
955 955
 		{
956 956
 			$oModuleModel = getModel('module');
957 957
 			$config = $oModuleModel->getModuleConfig('document');
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1025 1025
 		// Check permissions
1026 1026
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1027
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1027
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1028 1028
 
1029 1029
 		$category_srl = Context::get('category_srl');
1030 1030
 		$category_info = $this->getCategory($category_srl);
1031
-		if(!$category_info)
1031
+		if (!$category_info)
1032 1032
 		{
1033 1033
 			return new BaseObject(-1, 'msg_invalid_request');
1034 1034
 		}
@@ -1044,14 +1044,14 @@  discard block
 block discarded – undo
1044 1044
 	 */
1045 1045
 	function getDocumentSrlByAlias($mid, $alias)
1046 1046
 	{
1047
-		if(!$mid || !$alias) return null;
1047
+		if (!$mid || !$alias) return null;
1048 1048
 		$site_module_info = Context::get('site_module_info');
1049 1049
 		$args = new stdClass;
1050 1050
 		$args->mid = $mid;
1051 1051
 		$args->alias_title = $alias;
1052 1052
 		$args->site_srl = $site_module_info->site_srl;
1053 1053
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1054
-		if(!$output->data) return null;
1054
+		if (!$output->data) return null;
1055 1055
 		else return $output->data->document_srl;
1056 1056
 	}
1057 1057
 
@@ -1063,15 +1063,15 @@  discard block
 block discarded – undo
1063 1063
 	 */
1064 1064
 	function getDocumentSrlByTitle($module_srl, $title)
1065 1065
 	{
1066
-		if(!$module_srl || !$title) return null;
1066
+		if (!$module_srl || !$title) return null;
1067 1067
 		$args = new stdClass;
1068 1068
 		$args->module_srl = $module_srl;
1069 1069
 		$args->title = $title;
1070 1070
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1071
-		if(!$output->data) return null;
1071
+		if (!$output->data) return null;
1072 1072
 		else
1073 1073
 		{
1074
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1074
+			if (is_array($output->data)) return $output->data[0]->document_srl;
1075 1075
 			return $output->data->document_srl;
1076 1076
 		}
1077 1077
 	}
@@ -1083,12 +1083,12 @@  discard block
 block discarded – undo
1083 1083
 	 */
1084 1084
 	function getAlias($document_srl)
1085 1085
 	{
1086
-		if(!$document_srl) return null;
1086
+		if (!$document_srl) return null;
1087 1087
 		$args = new stdClass;
1088 1088
 		$args->document_srl = $document_srl;
1089 1089
 		$output = executeQueryArray('document.getAliases', $args);
1090 1090
 
1091
-		if(!$output->data) return null;
1091
+		if (!$output->data) return null;
1092 1092
 		else return $output->data[0]->alias_title;
1093 1093
 	}
1094 1094
 
@@ -1131,32 +1131,32 @@  discard block
 block discarded – undo
1131 1131
 	{
1132 1132
 		// Variable check
1133 1133
 		$args = new stdClass;
1134
-		$args->category_srl = $obj->category_srl?$obj->category_srl:null;
1134
+		$args->category_srl = $obj->category_srl ? $obj->category_srl : null;
1135 1135
 		$args->sort_index = $obj->sort_index;
1136
-		$args->order_type = $obj->order_type?$obj->order_type:'desc';
1137
-		$args->page = $obj->page?$obj->page:1;
1138
-		$args->list_count = $obj->list_count?$obj->list_count:20;
1139
-		$args->page_count = $obj->page_count?$obj->page_count:10;
1136
+		$args->order_type = $obj->order_type ? $obj->order_type : 'desc';
1137
+		$args->page = $obj->page ? $obj->page : 1;
1138
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
1139
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
1140 1140
 		// Search options
1141 1141
 		$search_target = $obj->search_target;
1142 1142
 		$search_keyword = $obj->search_keyword;
1143
-		if($search_target && $search_keyword)
1143
+		if ($search_target && $search_keyword)
1144 1144
 		{
1145
-			switch($search_target)
1145
+			switch ($search_target)
1146 1146
 			{
1147 1147
 				case 'title' :
1148 1148
 				case 'content' :
1149
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1149
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1150 1150
 					$args->{"s_".$search_target} = $search_keyword;
1151 1151
 					$use_division = true;
1152 1152
 					break;
1153 1153
 				case 'title_content' :
1154
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1154
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1155 1155
 					$args->s_title = $search_keyword;
1156 1156
 					$args->s_content = $search_keyword;
1157 1157
 					break;
1158 1158
 				case 'user_id' :
1159
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1159
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1160 1160
 					$args->s_user_id = $search_keyword;
1161 1161
 					$args->sort_index = 'documents.'.$args->sort_index;
1162 1162
 					break;
@@ -1164,13 +1164,13 @@  discard block
 block discarded – undo
1164 1164
 				case 'nick_name' :
1165 1165
 				case 'email_address' :
1166 1166
 				case 'homepage' :
1167
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1167
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1168 1168
 					$args->{"s_".$search_target} = $search_keyword;
1169 1169
 					break;
1170 1170
 				case 'is_notice' :
1171 1171
 				case 'is_secret' :
1172
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1173
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1172
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1173
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1174 1174
 					break;
1175 1175
 				case 'member_srl' :
1176 1176
 				case 'readed_count' :
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
 				case 'comment_count' :
1180 1180
 				case 'trackback_count' :
1181 1181
 				case 'uploaded_count' :
1182
-					$args->{"s_".$search_target} = (int)$search_keyword;
1182
+					$args->{"s_".$search_target} = (int) $search_keyword;
1183 1183
 					break;
1184 1184
 				case 'regdate' :
1185 1185
 				case 'last_update' :
@@ -1191,9 +1191,9 @@  discard block
 block discarded – undo
1191 1191
 		}
1192 1192
 
1193 1193
 		$output = executeQueryArray('document.getTrashList', $args);
1194
-		if($output->data)
1194
+		if ($output->data)
1195 1195
 		{
1196
-			foreach($output->data as $key => $attribute)
1196
+			foreach ($output->data as $key => $attribute)
1197 1197
 			{
1198 1198
 				$oDocument = null;
1199 1199
 				$oDocument = new documentItem();
@@ -1212,46 +1212,46 @@  discard block
 block discarded – undo
1212 1212
 	{
1213 1213
 		$args = new stdClass;
1214 1214
 		$document_srl = Context::get('document_srl');
1215
-		if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1215
+		if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
1216 1216
 
1217 1217
 		$point = Context::get('point');
1218
-		if($point != -1) $point = 1;
1218
+		if ($point != -1) $point = 1;
1219 1219
 
1220 1220
 		$oDocumentModel = getModel('document');
1221 1221
 		$columnList = array('document_srl', 'module_srl');
1222 1222
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1223 1223
 		$module_srl = $oDocument->get('module_srl');
1224
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1224
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1225 1225
 
1226 1226
 		$oModuleModel = getModel('module');
1227
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1228
-		if($point == -1)
1227
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
1228
+		if ($point == -1)
1229 1229
 		{
1230
-			if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1230
+			if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request');
1231 1231
 			$args->below_point = 0;
1232 1232
 		}
1233 1233
 		else
1234 1234
 		{
1235
-			if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1235
+			if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request');
1236 1236
 			$args->more_point = 0;
1237 1237
 		}
1238 1238
 
1239 1239
 		$args->document_srl = $document_srl;
1240 1240
 
1241
-		$output = executeQueryArray('document.getVotedMemberList',$args);
1242
-		if(!$output->toBool()) return $output;
1241
+		$output = executeQueryArray('document.getVotedMemberList', $args);
1242
+		if (!$output->toBool()) return $output;
1243 1243
 
1244 1244
 		$oMemberModel = getModel('member');
1245
-		if($output->data)
1245
+		if ($output->data)
1246 1246
 		{
1247
-			foreach($output->data as $k => $d)
1247
+			foreach ($output->data as $k => $d)
1248 1248
 			{
1249 1249
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1250 1250
 				$output->data[$k]->src = $profile_image->src;
1251 1251
 			}
1252 1252
 		}
1253 1253
 
1254
-		$this->add('voted_member_list',$output->data);
1254
+		$this->add('voted_member_list', $output->data);
1255 1255
 	}
1256 1256
 
1257 1257
 	/**
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 	function getStatusNameList()
1262 1262
 	{
1263 1263
 		global $lang;
1264
-		if(!isset($lang->status_name_list))
1264
+		if (!isset($lang->status_name_list))
1265 1265
 			return array_flip($this->getStatusList());
1266 1266
 		else return $lang->status_name_list;
1267 1267
 	}
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 	{
1277 1277
 		$sortIndex = $obj->sort_index;
1278 1278
 		$isExtraVars = false;
1279
-		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')))
1279
+		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')))
1280 1280
 		{
1281 1281
 			// get module_srl extra_vars list
1282 1282
 			if ($load_extra_vars)
@@ -1291,11 +1291,11 @@  discard block
 block discarded – undo
1291 1291
 				else
1292 1292
 				{
1293 1293
 					$check_array = array();
1294
-					foreach($extra_output->data as $val)
1294
+					foreach ($extra_output->data as $val)
1295 1295
 					{
1296 1296
 						$check_array[] = $val->eid;
1297 1297
 					}
1298
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1298
+					if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1299 1299
 					else $isExtraVars = true;
1300 1300
 				}
1301 1301
 			}
@@ -1323,13 +1323,13 @@  discard block
 block discarded – undo
1323 1323
 	{
1324 1324
 		// Variable check
1325 1325
 		$args = new stdClass();
1326
-		$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1326
+		$args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null;
1327 1327
 		$args->order_type = $searchOpt->order_type;
1328
-		$args->page = $searchOpt->page?$searchOpt->page:1;
1329
-		$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1330
-		$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1331
-		$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1332
-		$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1328
+		$args->page = $searchOpt->page ? $searchOpt->page : 1;
1329
+		$args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20;
1330
+		$args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10;
1331
+		$args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null;
1332
+		$args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null;
1333 1333
 		$args->member_srl = $searchOpt->member_srl;
1334 1334
 
1335 1335
 		$logged_info = Context::get('logged_info');
@@ -1338,10 +1338,10 @@  discard block
 block discarded – undo
1338 1338
 
1339 1339
 		// Check the target and sequence alignment
1340 1340
 		$orderType = array('desc' => 1, 'asc' => 1);
1341
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1341
+		if (!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1342 1342
 
1343 1343
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1344
-		if($searchOpt->mid)
1344
+		if ($searchOpt->mid)
1345 1345
 		{
1346 1346
 			$oModuleModel = getModel('module');
1347 1347
 			$args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -1349,30 +1349,30 @@  discard block
 block discarded – undo
1349 1349
 		}
1350 1350
 
1351 1351
 		// Module_srl passed the array may be a check whether the array
1352
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1352
+		if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1353 1353
 		else $args->module_srl = $searchOpt->module_srl;
1354 1354
 
1355 1355
 		// Except for the test module_srl
1356
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1356
+		if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1357 1357
 		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1358 1358
 
1359 1359
 		// only admin document list, temp document showing
1360
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1360
+		if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1361 1361
 		else
1362 1362
 		{
1363
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1363
+			if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1364 1364
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1365 1365
 			else
1366 1366
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1367 1367
 		}
1368 1368
 
1369 1369
 		// Category is selected, further sub-categories until all conditions
1370
-		if($args->category_srl)
1370
+		if ($args->category_srl)
1371 1371
 		{
1372 1372
 			$category_list = $this->getCategoryList($args->module_srl);
1373 1373
 			$category_info = $category_list[$args->category_srl];
1374 1374
 			$category_info->childs[] = $args->category_srl;
1375
-			$args->category_srl = implode(',',$category_info->childs);
1375
+			$args->category_srl = implode(',', $category_info->childs);
1376 1376
 		}
1377 1377
 
1378 1378
 		// Used to specify the default query id (based on several search options to query id modified)
@@ -1385,24 +1385,24 @@  discard block
 block discarded – undo
1385 1385
 		$search_target = $searchOpt->search_target;
1386 1386
 		$search_keyword = $searchOpt->search_keyword;
1387 1387
 
1388
-		if($search_target && $search_keyword)
1388
+		if ($search_target && $search_keyword)
1389 1389
 		{
1390
-			switch($search_target)
1390
+			switch ($search_target)
1391 1391
 			{
1392 1392
 				case 'title' :
1393 1393
 				case 'content' :
1394
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1394
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1395 1395
 					$args->{"s_".$search_target} = $search_keyword;
1396 1396
 					$use_division = true;
1397 1397
 					break;
1398 1398
 				case 'title_content' :
1399
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1399
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1400 1400
 					$args->s_title = $search_keyword;
1401 1401
 					$args->s_content = $search_keyword;
1402 1402
 					$use_division = true;
1403 1403
 					break;
1404 1404
 				case 'user_id' :
1405
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1405
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1406 1406
 					$args->s_user_id = $search_keyword;
1407 1407
 					$args->sort_index = 'documents.'.$args->sort_index;
1408 1408
 					break;
@@ -1410,18 +1410,18 @@  discard block
 block discarded – undo
1410 1410
 				case 'nick_name' :
1411 1411
 				case 'email_address' :
1412 1412
 				case 'homepage' :
1413
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1413
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1414 1414
 					$args->{"s_".$search_target} = $search_keyword;
1415 1415
 					break;
1416 1416
 				case 'is_notice' :
1417
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1418
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1417
+					if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N';
1418
+					elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y';
1419 1419
 					else $args->{"s_".$search_target} = '';
1420 1420
 					break;
1421 1421
 				case 'is_secret' :
1422
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1423
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1424
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1422
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1423
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1424
+					elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp'));
1425 1425
 					break;
1426 1426
 				case 'member_srl' :
1427 1427
 				case 'readed_count' :
@@ -1429,10 +1429,10 @@  discard block
 block discarded – undo
1429 1429
 				case 'comment_count' :
1430 1430
 				case 'trackback_count' :
1431 1431
 				case 'uploaded_count' :
1432
-					$args->{"s_".$search_target} = (int)$search_keyword;
1432
+					$args->{"s_".$search_target} = (int) $search_keyword;
1433 1433
 					break;
1434 1434
 				case 'blamed_count' :
1435
-					$args->{"s_".$search_target} = (int)$search_keyword * -1;
1435
+					$args->{"s_".$search_target} = (int) $search_keyword * -1;
1436 1436
 					break;
1437 1437
 				case 'regdate' :
1438 1438
 				case 'last_update' :
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
 					$use_division = true;
1446 1446
 					break;
1447 1447
 				case 'tag' :
1448
-					$args->s_tags = str_replace(' ','%',$search_keyword);
1448
+					$args->s_tags = str_replace(' ', '%', $search_keyword);
1449 1449
 					$query_id = 'document.getDocumentListWithinTag';
1450 1450
 					break;
1451 1451
 				case 'extra_vars':
@@ -1453,9 +1453,9 @@  discard block
 block discarded – undo
1453 1453
 					$query_id = 'document.getDocumentListWithinExtraVars';
1454 1454
 					break;
1455 1455
 				default :
1456
-					if(strpos($search_target,'extra_vars')!==false) {
1456
+					if (strpos($search_target, 'extra_vars') !== false) {
1457 1457
 						$args->var_idx = substr($search_target, strlen('extra_vars'));
1458
-						$args->var_value = str_replace(' ','%',$search_keyword);
1458
+						$args->var_value = str_replace(' ', '%', $search_keyword);
1459 1459
 						$args->sort_index = 'documents.'.$args->sort_index;
1460 1460
 						$query_id = 'document.getDocumentListWithExtraVars';
1461 1461
 					}
@@ -1472,18 +1472,18 @@  discard block
 block discarded – undo
1472 1472
 			/**
1473 1473
 			 * list_order asc sort of division that can be used only when
1474 1474
 			 */
1475
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1475
+			if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1476 1476
 
1477 1477
 			/**
1478 1478
 			 * If it is true, use_division changed to use the document division
1479 1479
 			 */
1480
-			if($use_division)
1480
+			if ($use_division)
1481 1481
 			{
1482 1482
 				// Division begins
1483
-				$division = (int)Context::get('division');
1483
+				$division = (int) Context::get('division');
1484 1484
 
1485 1485
 				// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1486
-				if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1486
+				if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1487 1487
 				{
1488 1488
 					$listSqlID = 'document.getDocumentListUseIndex';
1489 1489
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
@@ -1495,7 +1495,7 @@  discard block
 block discarded – undo
1495 1495
 				}
1496 1496
 
1497 1497
 				// If you do not value the best division top
1498
-				if(!$division)
1498
+				if (!$division)
1499 1499
 				{
1500 1500
 					$division_args = new stdClass();
1501 1501
 					$division_args->module_srl = $args->module_srl;
@@ -1506,7 +1506,7 @@  discard block
 block discarded – undo
1506 1506
 					$division_args->statusList = $args->statusList;
1507 1507
 
1508 1508
 					$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1509
-					if($output->data)
1509
+					if ($output->data)
1510 1510
 					{
1511 1511
 						$item = array_pop($output->data);
1512 1512
 						$division = $item->list_order;
@@ -1515,10 +1515,10 @@  discard block
 block discarded – undo
1515 1515
 				}
1516 1516
 
1517 1517
 				// The last division
1518
-				$last_division = (int)Context::get('last_division');
1518
+				$last_division = (int) Context::get('last_division');
1519 1519
 
1520 1520
 				// Division after division from the 5000 value of the specified Wanted
1521
-				if(!$last_division)
1521
+				if (!$last_division)
1522 1522
 				{
1523 1523
 					$last_division_args = new stdClass();
1524 1524
 					$last_division_args->module_srl = $args->module_srl;
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 					$last_division_args->page = 5001;
1531 1531
 
1532 1532
 					$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1533
-					if($output->data)
1533
+					if ($output->data)
1534 1534
 					{
1535 1535
 						$item = array_pop($output->data);
1536 1536
 						$last_division = $item->list_order;
@@ -1538,14 +1538,14 @@  discard block
 block discarded – undo
1538 1538
 				}
1539 1539
 
1540 1540
 				// Make sure that after last_division article
1541
-				if($last_division)
1541
+				if ($last_division)
1542 1542
 				{
1543 1543
 					$last_division_args = new stdClass();
1544 1544
 					$last_division_args->module_srl = $args->module_srl;
1545 1545
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1546 1546
 					$last_division_args->list_order = $last_division;
1547 1547
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1548
-					if($output->data->count<1) $last_division = null;
1548
+					if ($output->data->count < 1) $last_division = null;
1549 1549
 				}
1550 1550
 
1551 1551
 				$args->division = $division;
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 	 * @param int $count
1579 1579
 	 * @return object
1580 1580
 	 */
1581
-	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1581
+	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0)
1582 1582
 	{
1583 1583
 		$args = new stdClass();
1584 1584
 		$args->member_srl = $member_srl;
@@ -1586,8 +1586,8 @@  discard block
 block discarded – undo
1586 1586
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1587 1587
 		$document_list = $output->data;
1588 1588
 
1589
-		if(!$document_list) return array();
1590
-		if(!is_array($document_list)) $document_list = array($document_list);
1589
+		if (!$document_list) return array();
1590
+		if (!is_array($document_list)) $document_list = array($document_list);
1591 1591
 
1592 1592
 		return $document_list;
1593 1593
 	}
@@ -1599,7 +1599,7 @@  discard block
 block discarded – undo
1599 1599
 	function getDocumentExtraImagePath()
1600 1600
 	{
1601 1601
 		$documentConfig = getModel('document')->getDocumentConfig();
1602
-		if(Mobile::isFromMobilePhone())
1602
+		if (Mobile::isFromMobilePhone())
1603 1603
 		{
1604 1604
 			$iconSkin = $documentConfig->micons;
1605 1605
 		}
@@ -1607,7 +1607,7 @@  discard block
 block discarded – undo
1607 1607
 		{
1608 1608
 			$iconSkin = $documentConfig->icons;
1609 1609
 		}
1610
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1610
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1611 1611
 
1612 1612
 		return $path;
1613 1613
 	}
Please login to merge, or discard this patch.
Braces   +300 added lines, -139 removed lines patch added patch discarded remove patch
@@ -58,18 +58,24 @@  discard block
 block discarded – undo
58 58
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
59 59
 
60 60
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
61
-		if(count($_document_list) <= 0) return;
61
+		if(count($_document_list) <= 0) {
62
+			return;
63
+		}
62 64
 
63 65
 		// Find all called the document object variable has been set extension
64 66
 		$document_srls = array();
65 67
 		foreach($_document_list as $key => $val)
66 68
 		{
67
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
69
+			if(!$val->document_srl || $checked_documents[$val->document_srl]) {
70
+				continue;
71
+			}
68 72
 			$checked_documents[$val->document_srl] = true;
69 73
 			$document_srls[] = $val->document_srl;
70 74
 		}
71 75
 		// If the document number, return detected
72
-		if(!count($document_srls)) return;
76
+		if(!count($document_srls)) {
77
+			return;
78
+		}
73 79
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
74 80
 		//$obj->document_srl = implode(',',$document_srls);
75 81
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
@@ -77,8 +83,12 @@  discard block
 block discarded – undo
77 83
 		{
78 84
 			foreach($output->data as $key => $val)
79 85
 			{
80
-				if(!isset($val->value)) continue;
81
-				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
86
+				if(!isset($val->value)) {
87
+					continue;
88
+				}
89
+				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) {
90
+					$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
91
+				}
82 92
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
83 93
 			}
84 94
 		}
@@ -89,7 +99,9 @@  discard block
 block discarded – undo
89 99
 			$document_srl = $document_srls[$i];
90 100
 			unset($vars);
91 101
 
92
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
102
+			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) {
103
+				continue;
104
+			}
93 105
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
94 106
 			$extra_keys = $this->getExtraKeys($module_srl);
95 107
 			$vars = $extra_vars[$document_srl];
@@ -101,10 +113,15 @@  discard block
 block discarded – undo
101 113
 				{
102 114
 					$extra_keys[$idx] = clone($key);
103 115
 					$val = $vars[$idx];
104
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106
-					else if(isset($val[0])) $v = $val[0];
107
-					else $v = null;
116
+					if(isset($val[$user_lang_code])) {
117
+						$v = $val[$user_lang_code];
118
+					} else if(isset($val[$document_lang_code])) {
119
+						$v = $val[$document_lang_code];
120
+					} else if(isset($val[0])) {
121
+						$v = $val[0];
122
+					} else {
123
+						$v = null;
124
+					}
108 125
 					$extra_keys[$idx]->value = $v;
109 126
 				}
110 127
 			}
@@ -113,9 +130,13 @@  discard block
 block discarded – undo
113 130
 			$evars = new ExtraVar($module_srl);
114 131
 			$evars->setExtraVarKeys($extra_keys);
115 132
 			// Title Processing
116
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
133
+			if($vars[-1][$user_lang_code]) {
134
+				$_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
135
+			}
117 136
 			// Information processing
118
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
137
+			if($vars[-2][$user_lang_code]) {
138
+				$_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
139
+			}
119 140
 
120 141
 			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
121 142
 			{
@@ -136,7 +157,9 @@  discard block
 block discarded – undo
136 157
 	 */
137 158
 	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
138 159
 	{
139
-		if(!$document_srl) return new documentItem();
160
+		if(!$document_srl) {
161
+			return new documentItem();
162
+		}
140 163
 
141 164
 		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
142 165
 		{
@@ -146,9 +169,13 @@  discard block
 block discarded – undo
146 169
 				return $oDocument;
147 170
 			}
148 171
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
149
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
172
+			if($load_extra_vars) {
173
+				$this->setToAllDocumentExtraVars();
174
+			}
175
+		}
176
+		if($is_admin) {
177
+			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
150 178
 		}
151
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
152 179
 
153 180
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
154 181
 	}
@@ -167,8 +194,7 @@  discard block
 block discarded – undo
167 194
 		{
168 195
 			$list_count = count($document_srls);
169 196
 			$document_srls = implode(',',$document_srls);
170
-		}
171
-		else
197
+		} else
172 198
 		{
173 199
 			$list_count = 1;
174 200
 		}
@@ -179,28 +205,38 @@  discard block
 block discarded – undo
179 205
 
180 206
 		$output = executeQuery('document.getDocuments', $args, $columnList);
181 207
 		$document_list = $output->data;
182
-		if(!$document_list) return;
183
-		if(!is_array($document_list)) $document_list = array($document_list);
208
+		if(!$document_list) {
209
+			return;
210
+		}
211
+		if(!is_array($document_list)) {
212
+			$document_list = array($document_list);
213
+		}
184 214
 
185 215
 		$document_count = count($document_list);
186 216
 		foreach($document_list as $key => $attribute)
187 217
 		{
188 218
 			$document_srl = $attribute->document_srl;
189
-			if(!$document_srl) continue;
219
+			if(!$document_srl) {
220
+				continue;
221
+			}
190 222
 
191 223
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
192 224
 			{
193 225
 				$oDocument = null;
194 226
 				$oDocument = new documentItem();
195 227
 				$oDocument->setAttribute($attribute, false);
196
-				if($is_admin) $oDocument->setGrant();
228
+				if($is_admin) {
229
+					$oDocument->setGrant();
230
+				}
197 231
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
198 232
 			}
199 233
 
200 234
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
201 235
 		}
202 236
 
203
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
237
+		if($load_extra_vars) {
238
+			$this->setToAllDocumentExtraVars();
239
+		}
204 240
 
205 241
 		$output = null;
206 242
 		if(count($result))
@@ -248,18 +284,15 @@  discard block
 block discarded – undo
248 284
 		{
249 285
 			$output = $obj->use_alternate_output;
250 286
 			unset($obj->use_alternate_output);
251
-		}
252
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
287
+		} elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
253 288
 		{
254 289
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
255 290
 			$args->sort_index = str_replace('documents.','',$args->sort_index);
256 291
 			$output = executeQueryArray($query_id, $args);
257
-		}
258
-		elseif ($sort_check->isExtraVars)
292
+		} elseif ($sort_check->isExtraVars)
259 293
 		{
260 294
 			$output = executeQueryArray($query_id, $args);
261
-		}
262
-		else
295
+		} else
263 296
 		{
264 297
 			// document.getDocumentList query execution
265 298
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
@@ -269,11 +302,15 @@  discard block
 block discarded – undo
269 302
 				$group_args = clone($args);
270 303
 				$group_args->sort_index = 'documents.'.$args->sort_index;
271 304
 				$output = executeQueryArray($query_id, $group_args);
272
-				if(!$output->toBool()||!count($output->data)) return $output;
305
+				if(!$output->toBool()||!count($output->data)) {
306
+					return $output;
307
+				}
273 308
 
274 309
 				foreach($output->data as $key => $val)
275 310
 				{
276
-					if($val->document_srl) $target_srls[] = $val->document_srl;
311
+					if($val->document_srl) {
312
+						$target_srls[] = $val->document_srl;
313
+					}
277 314
 				}
278 315
 
279 316
 				$page_navigation = $output->page_navigation;
@@ -291,14 +328,15 @@  discard block
 block discarded – undo
291 328
 				$output->total_count = $page_navigation->total_count;
292 329
 				$output->total_page = $page_navigation->total_page;
293 330
 				$output->page = $page_navigation->cur_page;
294
-			}
295
-			else
331
+			} else
296 332
 			{
297 333
 				$output = executeQueryArray($query_id, $args, $columnList);
298 334
 			}
299 335
 		}
300 336
 		// Return if no result or an error occurs
301
-		if(!$output->toBool()||!count($output->data)) return $output;
337
+		if(!$output->toBool()||!count($output->data)) {
338
+			return $output;
339
+		}
302 340
 		$idx = 0;
303 341
 		$data = $output->data;
304 342
 		unset($output->data);
@@ -313,20 +351,26 @@  discard block
 block discarded – undo
313 351
 		{
314 352
 			foreach($data as $key => $attribute)
315 353
 			{
316
-				if($attribute->is_notice == 'Y') $virtual_number --;
354
+				if($attribute->is_notice == 'Y') {
355
+					$virtual_number --;
356
+				}
317 357
 			}
318 358
 		}
319 359
 
320 360
 		foreach($data as $key => $attribute)
321 361
 		{
322
-			if($except_notice && $attribute->is_notice == 'Y') continue;
362
+			if($except_notice && $attribute->is_notice == 'Y') {
363
+				continue;
364
+			}
323 365
 			$document_srl = $attribute->document_srl;
324 366
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
325 367
 			{
326 368
 				$oDocument = null;
327 369
 				$oDocument = new documentItem();
328 370
 				$oDocument->setAttribute($attribute, false);
329
-				if($is_admin) $oDocument->setGrant();
371
+				if($is_admin) {
372
+					$oDocument->setGrant();
373
+				}
330 374
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
331 375
 			}
332 376
 
@@ -334,7 +378,9 @@  discard block
 block discarded – undo
334 378
 			$virtual_number--;
335 379
 		}
336 380
 
337
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
381
+		if($load_extra_vars) {
382
+			$this->setToAllDocumentExtraVars();
383
+		}
338 384
 
339 385
 		if(count($output->data))
340 386
 		{
@@ -362,12 +408,16 @@  discard block
 block discarded – undo
362 408
 		$args->module_srl = $obj->module_srl;
363 409
 		$args->category_srl= $obj->category_srl;
364 410
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
365
-		if(!$output->toBool()||!$output->data) return;
411
+		if(!$output->toBool()||!$output->data) {
412
+			return;
413
+		}
366 414
 
367 415
 		foreach($output->data as $key => $val)
368 416
 		{
369 417
 			$document_srl = $val->document_srl;
370
-			if(!$document_srl) continue;
418
+			if(!$document_srl) {
419
+				continue;
420
+			}
371 421
 
372 422
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
373 423
 			{
@@ -463,7 +513,9 @@  discard block
 block discarded – undo
463 513
 
464 514
 				$oExtraVar->setExtraVarKeys($output->data);
465 515
 				$keys = $oExtraVar->getExtraVars();
466
-				if(!$keys) $keys = array();
516
+				if(!$keys) {
517
+					$keys = array();
518
+				}
467 519
 
468 520
 				if($oCacheHandler->isSupport())
469 521
 				{
@@ -493,7 +545,9 @@  discard block
 block discarded – undo
493 545
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
494 546
 			$this->setToAllDocumentExtraVars();
495 547
 		}
496
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
548
+		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
549
+			ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
550
+		}
497 551
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
498 552
 	}
499 553
 
@@ -523,7 +577,9 @@  discard block
 block discarded – undo
523 577
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
524 578
 			$module_srl = $oDocument->get('module_srl');
525 579
 			$member_srl = $oDocument->get('member_srl');
526
-			if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
580
+			if(!$module_srl) {
581
+				return new BaseObject(-1, 'msg_invalid_request');
582
+			}
527 583
 
528 584
 			$oModuleModel = getModel('module');
529 585
 			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
@@ -596,7 +652,9 @@  discard block
 block discarded – undo
596 652
 	 */
597 653
 	function getDocumentCount($module_srl, $search_obj = NULL)
598 654
 	{
599
-		if(is_null($search_obj)) $search_obj = new stdClass();
655
+		if(is_null($search_obj)) {
656
+			$search_obj = new stdClass();
657
+		}
600 658
 		$search_obj->module_srl = $module_srl;
601 659
 
602 660
 		$output = executeQuery('document.getDocumentCount', $search_obj);
@@ -613,7 +671,9 @@  discard block
 block discarded – undo
613 671
 	function getDocumentCountByGroupStatus($search_obj = NULL)
614 672
 	{
615 673
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
616
-		if(!$output->toBool()) return array();
674
+		if(!$output->toBool()) {
675
+			return array();
676
+		}
617 677
 
618 678
 		return $output->data;
619 679
 	}
@@ -652,34 +712,29 @@  discard block
 block discarded – undo
652 712
 		if($sort_check->isExtraVars)
653 713
 		{
654 714
 			return 1;
655
-		}
656
-		else
715
+		} else
657 716
 		{
658 717
 			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
659 718
 			{
660 719
 				if($args->order_type === 'desc')
661 720
 				{
662 721
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
663
-				}
664
-				else
722
+				} else
665 723
 				{
666 724
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
667 725
 				}
668
-			}
669
-			elseif($sort_check->sort_index === 'regdate')
726
+			} elseif($sort_check->sort_index === 'regdate')
670 727
 			{
671 728
 
672 729
 				if($args->order_type === 'asc')
673 730
 				{
674 731
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
675
-				}
676
-				else
732
+				} else
677 733
 				{
678 734
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
679 735
 				}
680 736
 
681
-			}
682
-			else
737
+			} else
683 738
 			{
684 739
 				return 1;
685 740
 			}
@@ -705,15 +760,16 @@  discard block
 block discarded – undo
705 760
 		$output = executeQuery('document.getCategory', $args, $columnList);
706 761
 
707 762
 		$node = $output->data;
708
-		if(!$node) return;
763
+		if(!$node) {
764
+			return;
765
+		}
709 766
 
710 767
 		if($node->group_srls)
711 768
 		{
712 769
 			$group_srls = explode(',',$node->group_srls);
713 770
 			unset($node->group_srls);
714 771
 			$node->group_srls = $group_srls;
715
-		}
716
-		else
772
+		} else
717 773
 		{
718 774
 			unset($node->group_srls);
719 775
 			$node->group_srls = array();
@@ -731,7 +787,9 @@  discard block
 block discarded – undo
731 787
 		$args = new stdClass();
732 788
 		$args->category_srl = $category_srl;
733 789
 		$output = executeQuery('document.getChildCategoryCount',$args);
734
-		if($output->data->count > 0) return true;
790
+		if($output->data->count > 0) {
791
+			return true;
792
+		}
735 793
 		return false;
736 794
 	}
737 795
 
@@ -750,7 +808,9 @@  discard block
 block discarded – undo
750 808
 		if(!file_exists($filename))
751 809
 		{
752 810
 			$oDocumentController = getController('document');
753
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
811
+			if(!$oDocumentController->makeCategoryFile($module_srl)) {
812
+				return array();
813
+			}
754 814
 		}
755 815
 
756 816
 		include($filename);
@@ -770,7 +830,9 @@  discard block
 block discarded – undo
770 830
 	 */
771 831
 	function _arrangeCategory(&$document_category, $list, $depth)
772 832
 	{
773
-		if(!count($list)) return;
833
+		if(!count($list)) {
834
+			return;
835
+		}
774 836
 		$idx = 0;
775 837
 		$list_order = array();
776 838
 		foreach($list as $key => $val)
@@ -790,8 +852,11 @@  discard block
 block discarded – undo
790 852
 			$obj->childs = array();
791 853
 			$obj->grant = $val['grant'];
792 854
 
793
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
794
-			else $selected = false;
855
+			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) {
856
+				$selected = true;
857
+			} else {
858
+				$selected = false;
859
+			}
795 860
 
796 861
 			$obj->selected = $selected;
797 862
 
@@ -802,14 +867,18 @@  discard block
 block discarded – undo
802 867
 				$parent_srl = $obj->parent_srl;
803 868
 				$document_count = $obj->document_count;
804 869
 				$expand = $obj->expand;
805
-				if($selected) $expand = true;
870
+				if($selected) {
871
+					$expand = true;
872
+				}
806 873
 
807 874
 				while($parent_srl)
808 875
 				{
809 876
 					$document_category[$parent_srl]->document_count += $document_count;
810 877
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
811 878
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
812
-					if($expand) $document_category[$parent_srl]->expand = $expand;
879
+					if($expand) {
880
+						$document_category[$parent_srl]->expand = $expand;
881
+					}
813 882
 
814 883
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
815 884
 				}
@@ -817,7 +886,9 @@  discard block
 block discarded – undo
817 886
 
818 887
 			$document_category[$key] = $obj;
819 888
 
820
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
889
+			if(count($val['list'])) {
890
+				$this->_arrangeCategory($document_category, $val['list'], $depth+1);
891
+			}
821 892
 		}
822 893
 		$document_category[$list_order[0]]->first = true;
823 894
 		$document_category[$list_order[count($list_order)-1]]->last = true;
@@ -885,13 +956,20 @@  discard block
 block discarded – undo
885 956
 		}
886 957
 		// Module_srl passed the array may be a check whether the array
887 958
 		$args = new stdClass;
888
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
889
-		else $args->module_srl = $obj->module_srl;
959
+		if(is_array($obj->module_srl)) {
960
+			$args->module_srl = implode(',', $obj->module_srl);
961
+		} else {
962
+			$args->module_srl = $obj->module_srl;
963
+		}
890 964
 
891 965
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
892
-		if(!$output->toBool()||!$output->data) return $output;
966
+		if(!$output->toBool()||!$output->data) {
967
+			return $output;
968
+		}
893 969
 
894
-		if(!is_array($output->data)) $output->data = array($output->data);
970
+		if(!is_array($output->data)) {
971
+			$output->data = array($output->data);
972
+		}
895 973
 
896 974
 		return $output;
897 975
 	}
@@ -911,14 +989,21 @@  discard block
 block discarded – undo
911 989
 		}
912 990
 		// Module_srl passed the array may be a check whether the array
913 991
 		$args = new stdClass;
914
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
915
-		else $args->module_srl = $obj->module_srl;
992
+		if(is_array($obj->module_srl)) {
993
+			$args->module_srl = implode(',', $obj->module_srl);
994
+		} else {
995
+			$args->module_srl = $obj->module_srl;
996
+		}
916 997
 		$args->regdate = $obj->regdate;
917 998
 
918 999
 		$output = executeQuery('document.getDailyArchivedList', $args);
919
-		if(!$output->toBool()) return $output;
1000
+		if(!$output->toBool()) {
1001
+			return $output;
1002
+		}
920 1003
 
921
-		if(!is_array($output->data)) $output->data = array($output->data);
1004
+		if(!is_array($output->data)) {
1005
+			$output->data = array($output->data);
1006
+		}
922 1007
 
923 1008
 		return $output;
924 1009
 	}
@@ -929,7 +1014,9 @@  discard block
 block discarded – undo
929 1014
 	 */
930 1015
 	function getDocumentCategories()
931 1016
 	{
932
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
1017
+		if(!Context::get('is_logged')) {
1018
+			return new BaseObject(-1,'msg_not_permitted');
1019
+		}
933 1020
 		$module_srl = Context::get('module_srl');
934 1021
 		$categories= $this->getCategoryList($module_srl);
935 1022
 		$lang = Context::get('lang');
@@ -1024,7 +1111,9 @@  discard block
 block discarded – undo
1024 1111
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1025 1112
 		// Check permissions
1026 1113
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1027
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1114
+		if(!$grant->manager) {
1115
+			return new BaseObject(-1,'msg_not_permitted');
1116
+		}
1028 1117
 
1029 1118
 		$category_srl = Context::get('category_srl');
1030 1119
 		$category_info = $this->getCategory($category_srl);
@@ -1044,15 +1133,20 @@  discard block
 block discarded – undo
1044 1133
 	 */
1045 1134
 	function getDocumentSrlByAlias($mid, $alias)
1046 1135
 	{
1047
-		if(!$mid || !$alias) return null;
1136
+		if(!$mid || !$alias) {
1137
+			return null;
1138
+		}
1048 1139
 		$site_module_info = Context::get('site_module_info');
1049 1140
 		$args = new stdClass;
1050 1141
 		$args->mid = $mid;
1051 1142
 		$args->alias_title = $alias;
1052 1143
 		$args->site_srl = $site_module_info->site_srl;
1053 1144
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1054
-		if(!$output->data) return null;
1055
-		else return $output->data->document_srl;
1145
+		if(!$output->data) {
1146
+			return null;
1147
+		} else {
1148
+			return $output->data->document_srl;
1149
+		}
1056 1150
 	}
1057 1151
 
1058 1152
 	/**
@@ -1063,15 +1157,20 @@  discard block
 block discarded – undo
1063 1157
 	 */
1064 1158
 	function getDocumentSrlByTitle($module_srl, $title)
1065 1159
 	{
1066
-		if(!$module_srl || !$title) return null;
1160
+		if(!$module_srl || !$title) {
1161
+			return null;
1162
+		}
1067 1163
 		$args = new stdClass;
1068 1164
 		$args->module_srl = $module_srl;
1069 1165
 		$args->title = $title;
1070 1166
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1071
-		if(!$output->data) return null;
1072
-		else
1167
+		if(!$output->data) {
1168
+			return null;
1169
+		} else
1073 1170
 		{
1074
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1171
+			if(is_array($output->data)) {
1172
+				return $output->data[0]->document_srl;
1173
+			}
1075 1174
 			return $output->data->document_srl;
1076 1175
 		}
1077 1176
 	}
@@ -1083,13 +1182,18 @@  discard block
 block discarded – undo
1083 1182
 	 */
1084 1183
 	function getAlias($document_srl)
1085 1184
 	{
1086
-		if(!$document_srl) return null;
1185
+		if(!$document_srl) {
1186
+			return null;
1187
+		}
1087 1188
 		$args = new stdClass;
1088 1189
 		$args->document_srl = $document_srl;
1089 1190
 		$output = executeQueryArray('document.getAliases', $args);
1090 1191
 
1091
-		if(!$output->data) return null;
1092
-		else return $output->data[0]->alias_title;
1192
+		if(!$output->data) {
1193
+			return null;
1194
+		} else {
1195
+			return $output->data[0]->alias_title;
1196
+		}
1093 1197
 	}
1094 1198
 
1095 1199
 	/**
@@ -1146,17 +1250,23 @@  discard block
 block discarded – undo
1146 1250
 			{
1147 1251
 				case 'title' :
1148 1252
 				case 'content' :
1149
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1253
+					if($search_keyword) {
1254
+						$search_keyword = str_replace(' ','%',$search_keyword);
1255
+					}
1150 1256
 					$args->{"s_".$search_target} = $search_keyword;
1151 1257
 					$use_division = true;
1152 1258
 					break;
1153 1259
 				case 'title_content' :
1154
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1260
+					if($search_keyword) {
1261
+						$search_keyword = str_replace(' ','%',$search_keyword);
1262
+					}
1155 1263
 					$args->s_title = $search_keyword;
1156 1264
 					$args->s_content = $search_keyword;
1157 1265
 					break;
1158 1266
 				case 'user_id' :
1159
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1267
+					if($search_keyword) {
1268
+						$search_keyword = str_replace(' ','%',$search_keyword);
1269
+					}
1160 1270
 					$args->s_user_id = $search_keyword;
1161 1271
 					$args->sort_index = 'documents.'.$args->sort_index;
1162 1272
 					break;
@@ -1164,13 +1274,18 @@  discard block
 block discarded – undo
1164 1274
 				case 'nick_name' :
1165 1275
 				case 'email_address' :
1166 1276
 				case 'homepage' :
1167
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1277
+					if($search_keyword) {
1278
+						$search_keyword = str_replace(' ','%',$search_keyword);
1279
+					}
1168 1280
 					$args->{"s_".$search_target} = $search_keyword;
1169 1281
 					break;
1170 1282
 				case 'is_notice' :
1171 1283
 				case 'is_secret' :
1172
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1173
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1284
+					if($search_keyword=='N') {
1285
+						$args->statusList = array($this->getConfigStatus('public'));
1286
+					} elseif($search_keyword=='Y') {
1287
+						$args->statusList = array($this->getConfigStatus('secret'));
1288
+					}
1174 1289
 					break;
1175 1290
 				case 'member_srl' :
1176 1291
 				case 'readed_count' :
@@ -1212,34 +1327,45 @@  discard block
 block discarded – undo
1212 1327
 	{
1213 1328
 		$args = new stdClass;
1214 1329
 		$document_srl = Context::get('document_srl');
1215
-		if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1330
+		if(!$document_srl) {
1331
+			return new BaseObject(-1,'msg_invalid_request');
1332
+		}
1216 1333
 
1217 1334
 		$point = Context::get('point');
1218
-		if($point != -1) $point = 1;
1335
+		if($point != -1) {
1336
+			$point = 1;
1337
+		}
1219 1338
 
1220 1339
 		$oDocumentModel = getModel('document');
1221 1340
 		$columnList = array('document_srl', 'module_srl');
1222 1341
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1223 1342
 		$module_srl = $oDocument->get('module_srl');
1224
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1343
+		if(!$module_srl) {
1344
+			return new BaseObject(-1, 'msg_invalid_request');
1345
+		}
1225 1346
 
1226 1347
 		$oModuleModel = getModel('module');
1227 1348
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1228 1349
 		if($point == -1)
1229 1350
 		{
1230
-			if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1351
+			if($document_config->use_vote_down!='S') {
1352
+				return new BaseObject(-1, 'msg_invalid_request');
1353
+			}
1231 1354
 			$args->below_point = 0;
1232
-		}
1233
-		else
1355
+		} else
1234 1356
 		{
1235
-			if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1357
+			if($document_config->use_vote_up!='S') {
1358
+				return new BaseObject(-1, 'msg_invalid_request');
1359
+			}
1236 1360
 			$args->more_point = 0;
1237 1361
 		}
1238 1362
 
1239 1363
 		$args->document_srl = $document_srl;
1240 1364
 
1241 1365
 		$output = executeQueryArray('document.getVotedMemberList',$args);
1242
-		if(!$output->toBool()) return $output;
1366
+		if(!$output->toBool()) {
1367
+			return $output;
1368
+		}
1243 1369
 
1244 1370
 		$oMemberModel = getModel('member');
1245 1371
 		if($output->data)
@@ -1261,9 +1387,11 @@  discard block
 block discarded – undo
1261 1387
 	function getStatusNameList()
1262 1388
 	{
1263 1389
 		global $lang;
1264
-		if(!isset($lang->status_name_list))
1265
-			return array_flip($this->getStatusList());
1266
-		else return $lang->status_name_list;
1390
+		if(!isset($lang->status_name_list)) {
1391
+					return array_flip($this->getStatusList());
1392
+		} else {
1393
+			return $lang->status_name_list;
1394
+		}
1267 1395
 	}
1268 1396
 
1269 1397
 	/**
@@ -1287,20 +1415,22 @@  discard block
 block discarded – undo
1287 1415
 				if (!$extra_output->data || !$extra_output->toBool())
1288 1416
 				{
1289 1417
 					$sortIndex = 'list_order';
1290
-				}
1291
-				else
1418
+				} else
1292 1419
 				{
1293 1420
 					$check_array = array();
1294 1421
 					foreach($extra_output->data as $val)
1295 1422
 					{
1296 1423
 						$check_array[] = $val->eid;
1297 1424
 					}
1298
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1299
-					else $isExtraVars = true;
1425
+					if(!in_array($sortIndex, $check_array)) {
1426
+						$sortIndex = 'list_order';
1427
+					} else {
1428
+						$isExtraVars = true;
1429
+					}
1300 1430
 				}
1431
+			} else {
1432
+							$sortIndex = 'list_order';
1301 1433
 			}
1302
-			else
1303
-				$sortIndex = 'list_order';
1304 1434
 		}
1305 1435
 		$returnObj = new stdClass();
1306 1436
 		$returnObj->sort_index = $sortIndex;
@@ -1338,7 +1468,9 @@  discard block
 block discarded – undo
1338 1468
 
1339 1469
 		// Check the target and sequence alignment
1340 1470
 		$orderType = array('desc' => 1, 'asc' => 1);
1341
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1471
+		if(!isset($orderType[$args->order_type])) {
1472
+			$args->order_type = 'asc';
1473
+		}
1342 1474
 
1343 1475
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1344 1476
 		if($searchOpt->mid)
@@ -1349,21 +1481,29 @@  discard block
 block discarded – undo
1349 1481
 		}
1350 1482
 
1351 1483
 		// Module_srl passed the array may be a check whether the array
1352
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1353
-		else $args->module_srl = $searchOpt->module_srl;
1484
+		if(is_array($searchOpt->module_srl)) {
1485
+			$args->module_srl = implode(',', $searchOpt->module_srl);
1486
+		} else {
1487
+			$args->module_srl = $searchOpt->module_srl;
1488
+		}
1354 1489
 
1355 1490
 		// Except for the test module_srl
1356
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1357
-		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1491
+		if(is_array($searchOpt->exclude_module_srl)) {
1492
+			$args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1493
+		} else {
1494
+			$args->exclude_module_srl = $searchOpt->exclude_module_srl;
1495
+		}
1358 1496
 
1359 1497
 		// only admin document list, temp document showing
1360
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1361
-		else
1498
+		if($searchOpt->statusList) {
1499
+			$args->statusList = $searchOpt->statusList;
1500
+		} else
1362 1501
 		{
1363
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1364
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1365
-			else
1366
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1502
+			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) {
1503
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1504
+			} else {
1505
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1506
+			}
1367 1507
 		}
1368 1508
 
1369 1509
 		// Category is selected, further sub-categories until all conditions
@@ -1391,18 +1531,24 @@  discard block
 block discarded – undo
1391 1531
 			{
1392 1532
 				case 'title' :
1393 1533
 				case 'content' :
1394
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1534
+					if($search_keyword) {
1535
+						$search_keyword = str_replace(' ','%',$search_keyword);
1536
+					}
1395 1537
 					$args->{"s_".$search_target} = $search_keyword;
1396 1538
 					$use_division = true;
1397 1539
 					break;
1398 1540
 				case 'title_content' :
1399
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1541
+					if($search_keyword) {
1542
+						$search_keyword = str_replace(' ','%',$search_keyword);
1543
+					}
1400 1544
 					$args->s_title = $search_keyword;
1401 1545
 					$args->s_content = $search_keyword;
1402 1546
 					$use_division = true;
1403 1547
 					break;
1404 1548
 				case 'user_id' :
1405
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1549
+					if($search_keyword) {
1550
+						$search_keyword = str_replace(' ','%',$search_keyword);
1551
+					}
1406 1552
 					$args->s_user_id = $search_keyword;
1407 1553
 					$args->sort_index = 'documents.'.$args->sort_index;
1408 1554
 					break;
@@ -1410,18 +1556,28 @@  discard block
 block discarded – undo
1410 1556
 				case 'nick_name' :
1411 1557
 				case 'email_address' :
1412 1558
 				case 'homepage' :
1413
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1559
+					if($search_keyword) {
1560
+						$search_keyword = str_replace(' ','%',$search_keyword);
1561
+					}
1414 1562
 					$args->{"s_".$search_target} = $search_keyword;
1415 1563
 					break;
1416 1564
 				case 'is_notice' :
1417
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1418
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1419
-					else $args->{"s_".$search_target} = '';
1565
+					if($search_keyword=='N') {
1566
+						$args->{"s_".$search_target} = 'N';
1567
+					} elseif($search_keyword=='Y') {
1568
+						$args->{"s_".$search_target} = 'Y';
1569
+					} else {
1570
+						$args->{"s_".$search_target} = '';
1571
+					}
1420 1572
 					break;
1421 1573
 				case 'is_secret' :
1422
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1423
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1424
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1574
+					if($search_keyword=='N') {
1575
+						$args->statusList = array($this->getConfigStatus('public'));
1576
+					} elseif($search_keyword=='Y') {
1577
+						$args->statusList = array($this->getConfigStatus('secret'));
1578
+					} elseif($search_keyword=='temp') {
1579
+						$args->statusList = array($this->getConfigStatus('temp'));
1580
+					}
1425 1581
 					break;
1426 1582
 				case 'member_srl' :
1427 1583
 				case 'readed_count' :
@@ -1466,13 +1622,14 @@  discard block
 block discarded – undo
1466 1622
 		if ($searchOpt->isExtraVars)
1467 1623
 		{
1468 1624
 			$query_id = 'document.getDocumentListExtraSort';
1469
-		}
1470
-		else
1625
+		} else
1471 1626
 		{
1472 1627
 			/**
1473 1628
 			 * list_order asc sort of division that can be used only when
1474 1629
 			 */
1475
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1630
+			if($args->sort_index != 'list_order' || $args->order_type != 'asc') {
1631
+				$use_division = false;
1632
+			}
1476 1633
 
1477 1634
 			/**
1478 1635
 			 * If it is true, use_division changed to use the document division
@@ -1487,8 +1644,7 @@  discard block
 block discarded – undo
1487 1644
 				{
1488 1645
 					$listSqlID = 'document.getDocumentListUseIndex';
1489 1646
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
1490
-				}
1491
-				else
1647
+				} else
1492 1648
 				{
1493 1649
 					$listSqlID = 'document.getDocumentList';
1494 1650
 					$divisionSqlID = 'document.getDocumentDivision';
@@ -1545,7 +1701,9 @@  discard block
 block discarded – undo
1545 1701
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1546 1702
 					$last_division_args->list_order = $last_division;
1547 1703
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1548
-					if($output->data->count<1) $last_division = null;
1704
+					if($output->data->count<1) {
1705
+						$last_division = null;
1706
+					}
1549 1707
 				}
1550 1708
 
1551 1709
 				$args->division = $division;
@@ -1586,8 +1744,12 @@  discard block
 block discarded – undo
1586 1744
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1587 1745
 		$document_list = $output->data;
1588 1746
 
1589
-		if(!$document_list) return array();
1590
-		if(!is_array($document_list)) $document_list = array($document_list);
1747
+		if(!$document_list) {
1748
+			return array();
1749
+		}
1750
+		if(!is_array($document_list)) {
1751
+			$document_list = array($document_list);
1752
+		}
1591 1753
 
1592 1754
 		return $document_list;
1593 1755
 	}
@@ -1602,8 +1764,7 @@  discard block
 block discarded – undo
1602 1764
 		if(Mobile::isFromMobilePhone())
1603 1765
 		{
1604 1766
 			$iconSkin = $documentConfig->micons;
1605
-		}
1606
-		else
1767
+		} else
1607 1768
 		{
1608 1769
 			$iconSkin = $documentConfig->icons;
1609 1770
 		}
Please login to merge, or discard this patch.