GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#1975)
by
unknown
15:55
created
modules/document/document.model.php 1 patch
Spacing   +232 added lines, -232 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	function getDocumentExtraVarsFromDB($documentSrls)
37 37
 	{
38
-		if(!is_array($documentSrls) || count($documentSrls) == 0)
38
+		if (!is_array($documentSrls) || count($documentSrls) == 0)
39 39
 		{
40 40
 			return new Object(-1, 'msg_invalid_request');
41 41
 		}
@@ -56,52 +56,52 @@  discard block
 block discarded – undo
56 56
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
57 57
 
58 58
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
59
-		if(count($_document_list) <= 0) return;
59
+		if (count($_document_list) <= 0) return;
60 60
 
61 61
 		// Find all called the document object variable has been set extension
62 62
 		$document_srls = array();
63
-		foreach($_document_list as $key => $val)
63
+		foreach ($_document_list as $key => $val)
64 64
 		{
65
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
65
+			if (!$val->document_srl || $checked_documents[$val->document_srl]) continue;
66 66
 			$checked_documents[$val->document_srl] = true;
67 67
 			$document_srls[] = $val->document_srl;
68 68
 		}
69 69
 		// If the document number, return detected
70
-		if(!count($document_srls)) return;
70
+		if (!count($document_srls)) return;
71 71
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
72 72
 		//$obj->document_srl = implode(',',$document_srls);
73 73
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
74
-		if($output->toBool() && $output->data)
74
+		if ($output->toBool() && $output->data)
75 75
 		{
76
-			foreach($output->data as $key => $val)
76
+			foreach ($output->data as $key => $val)
77 77
 			{
78
-				if(!isset($val->value)) continue;
79
-				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);
78
+				if (!isset($val->value)) continue;
79
+				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 80
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
81 81
 			}
82 82
 		}
83 83
 
84 84
 		$user_lang_code = Context::getLangType();
85
-		for($i=0,$c=count($document_srls);$i<$c;$i++)
85
+		for ($i = 0, $c = count($document_srls); $i < $c; $i++)
86 86
 		{
87 87
 			$document_srl = $document_srls[$i];
88 88
 			unset($vars);
89 89
 
90
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
90
+			if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
91 91
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
92 92
 			$extra_keys = $this->getExtraKeys($module_srl);
93 93
 			$vars = $extra_vars[$document_srl];
94 94
 			$document_lang_code = $_document_list[$document_srl]->get('lang_code');
95 95
 			// Expand the variable processing
96
-			if(count($extra_keys))
96
+			if (count($extra_keys))
97 97
 			{
98
-				foreach($extra_keys as $idx => $key)
98
+				foreach ($extra_keys as $idx => $key)
99 99
 				{
100 100
 					$extra_keys[$idx] = clone($key);
101 101
 					$val = $vars[$idx];
102
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
103
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
104
-					else if(isset($val[0])) $v = $val[0];
102
+					if (isset($val[$user_lang_code])) $v = $val[$user_lang_code];
103
+					else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code];
104
+					else if (isset($val[0])) $v = $val[0];
105 105
 					else $v = null;
106 106
 					$extra_keys[$idx]->value = $v;
107 107
 				}
@@ -111,11 +111,11 @@  discard block
 block discarded – undo
111 111
 			$evars = new ExtraVar($module_srl);
112 112
 			$evars->setExtraVarKeys($extra_keys);
113 113
 			// Title Processing
114
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
114
+			if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]);
115 115
 			// Information processing
116
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
116
+			if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]);
117 117
 
118
-			if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
118
+			if ($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code])
119 119
 			{
120 120
 				unset($checked_documents[$document_srl]);
121 121
 			}
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 	 * @param array $columnList
133 133
 	 * @return documentItem
134 134
 	 */
135
-	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
135
+	function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
136 136
 	{
137
-		if(!$document_srl) return new documentItem();
137
+		if (!$document_srl) return new documentItem();
138 138
 
139
-		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
139
+		if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
140 140
 		{
141 141
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
142 142
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
143
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
143
+			if ($load_extra_vars) $this->setToAllDocumentExtraVars();
144 144
 		}
145
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
145
+		if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
146 146
 
147 147
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
148 148
 	}
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 	 * @param array $columnList
156 156
 	 * @return array value type is documentItem
157 157
 	 */
158
-	function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
158
+	function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
159 159
 	{
160
-		if(is_array($document_srls))
160
+		if (is_array($document_srls))
161 161
 		{
162 162
 			$list_count = count($document_srls);
163
-			$document_srls = implode(',',$document_srls);
163
+			$document_srls = implode(',', $document_srls);
164 164
 		}
165 165
 		else
166 166
 		{
@@ -173,33 +173,33 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$output = executeQuery('document.getDocuments', $args, $columnList);
175 175
 		$document_list = $output->data;
176
-		if(!$document_list) return;
177
-		if(!is_array($document_list)) $document_list = array($document_list);
176
+		if (!$document_list) return;
177
+		if (!is_array($document_list)) $document_list = array($document_list);
178 178
 
179 179
 		$document_count = count($document_list);
180
-		foreach($document_list as $key => $attribute)
180
+		foreach ($document_list as $key => $attribute)
181 181
 		{
182 182
 			$document_srl = $attribute->document_srl;
183
-			if(!$document_srl) continue;
183
+			if (!$document_srl) continue;
184 184
 
185
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
185
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
186 186
 			{
187 187
 				$oDocument = null;
188 188
 				$oDocument = new documentItem();
189 189
 				$oDocument->setAttribute($attribute, false);
190
-				if($is_admin) $oDocument->setGrant();
190
+				if ($is_admin) $oDocument->setGrant();
191 191
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
192 192
 			}
193 193
 
194 194
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
195 195
 		}
196 196
 
197
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
197
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
198 198
 
199 199
 		$output = null;
200
-		if(count($result))
200
+		if (count($result))
201 201
 		{
202
-			foreach($result as $document_srl => $val)
202
+			foreach ($result as $document_srl => $val)
203 203
 			{
204 204
 				$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
205 205
 			}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param array $columnList
217 217
 	 * @return Object
218 218
 	 */
219
-	function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
219
+	function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
220 220
 	{
221 221
 		$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
222 222
 		$obj->sort_index = $sort_check->sort_index;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		// Call trigger (before)
227 227
 		// This trigger can be used to set an alternative output using a different search method
228 228
 		$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
229
-		if($output instanceof Object && !$output->toBool())
229
+		if ($output instanceof Object && !$output->toBool())
230 230
 		{
231 231
 			return $output;
232 232
 		}
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 			$output = $obj->use_alternate_output;
244 244
 			unset($obj->use_alternate_output);
245 245
 		}
246
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
246
+		elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars'))
247 247
 		{
248 248
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
249
-			$args->sort_index = str_replace('documents.','',$args->sort_index);
249
+			$args->sort_index = str_replace('documents.', '', $args->sort_index);
250 250
 			$output = executeQueryArray($query_id, $args);
251 251
 		}
252 252
 		elseif ($sort_check->isExtraVars)
@@ -258,16 +258,16 @@  discard block
 block discarded – undo
258 258
 			// document.getDocumentList query execution
259 259
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
260 260
 			$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
261
-			if(isset($groupByQuery[$query_id]))
261
+			if (isset($groupByQuery[$query_id]))
262 262
 			{
263 263
 				$group_args = clone($args);
264 264
 				$group_args->sort_index = 'documents.'.$args->sort_index;
265 265
 				$output = executeQueryArray($query_id, $group_args);
266
-				if(!$output->toBool()||!count($output->data)) return $output;
266
+				if (!$output->toBool() || !count($output->data)) return $output;
267 267
 
268
-				foreach($output->data as $key => $val)
268
+				foreach ($output->data as $key => $val)
269 269
 				{
270
-					if($val->document_srl) $target_srls[] = $val->document_srl;
270
+					if ($val->document_srl) $target_srls[] = $val->document_srl;
271 271
 				}
272 272
 
273 273
 				$page_navigation = $output->page_navigation;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 				$virtual_number = $keys[0];
276 276
 
277 277
 				$target_args = new stdClass();
278
-				$target_args->document_srls = implode(',',$target_srls);
278
+				$target_args->document_srls = implode(',', $target_srls);
279 279
 				$target_args->list_order = $args->sort_index;
280 280
 				$target_args->order_type = $args->order_type;
281 281
 				$target_args->list_count = $args->list_count;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			}
289 289
 			else
290 290
 			{
291
-				if(Context::get('act')=='dispMemberOwnDocument' && $args->s_member_srl) 
291
+				if (Context::get('act') == 'dispMemberOwnDocument' && $args->s_member_srl) 
292 292
 				{
293 293
 					$query_id = 'document.getDocumentListWithAnonymous';
294 294
 				}				
@@ -296,35 +296,35 @@  discard block
 block discarded – undo
296 296
 			}
297 297
 		}
298 298
 		// Return if no result or an error occurs
299
-		if(!$output->toBool()||!count($output->data)) return $output;
299
+		if (!$output->toBool() || !count($output->data)) return $output;
300 300
 		$idx = 0;
301 301
 		$data = $output->data;
302 302
 		unset($output->data);
303 303
 
304
-		if(!isset($virtual_number))
304
+		if (!isset($virtual_number))
305 305
 		{
306 306
 			$keys = array_keys($data);
307 307
 			$virtual_number = $keys[0];
308 308
 		}
309 309
 
310
-		if($except_notice)
310
+		if ($except_notice)
311 311
 		{
312
-			foreach($data as $key => $attribute)
312
+			foreach ($data as $key => $attribute)
313 313
 			{
314
-				if($attribute->is_notice == 'Y') $virtual_number --;
314
+				if ($attribute->is_notice == 'Y') $virtual_number--;
315 315
 			}
316 316
 		}
317 317
 
318
-		foreach($data as $key => $attribute)
318
+		foreach ($data as $key => $attribute)
319 319
 		{
320
-			if($except_notice && $attribute->is_notice == 'Y') continue;
320
+			if ($except_notice && $attribute->is_notice == 'Y') continue;
321 321
 			$document_srl = $attribute->document_srl;
322
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
322
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
323 323
 			{
324 324
 				$oDocument = null;
325 325
 				$oDocument = new documentItem();
326 326
 				$oDocument->setAttribute($attribute, false);
327
-				if($is_admin) $oDocument->setGrant();
327
+				if ($is_admin) $oDocument->setGrant();
328 328
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
329 329
 			}
330 330
 
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 			$virtual_number--;
333 333
 		}
334 334
 
335
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
335
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
336 336
 
337
-		if(count($output->data))
337
+		if (count($output->data))
338 338
 		{
339
-			foreach($output->data as $number => $document)
339
+			foreach ($output->data as $number => $document)
340 340
 			{
341 341
 				$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
342 342
 			}
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
 	{
359 359
 		$args = new stdClass();
360 360
 		$args->module_srl = $obj->module_srl;
361
-		$args->category_srl= $obj->category_srl;
361
+		$args->category_srl = $obj->category_srl;
362 362
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
363
-		if(!$output->toBool()||!$output->data) return;
363
+		if (!$output->toBool() || !$output->data) return;
364 364
 
365
-		foreach($output->data as $key => $val)
365
+		foreach ($output->data as $key => $val)
366 366
 		{
367 367
 			$document_srl = $val->document_srl;
368
-			if(!$document_srl) continue;
368
+			if (!$document_srl) continue;
369 369
 
370
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
370
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
371 371
 			{
372 372
 				$oDocument = null;
373 373
 				$oDocument = new documentItem();
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		}
379 379
 		$this->setToAllDocumentExtraVars();
380 380
 
381
-		foreach($result->data as $document_srl => $val)
381
+		foreach ($result->data as $document_srl => $val)
382 382
 		{
383 383
 			$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
384 384
 		}
@@ -394,20 +394,20 @@  discard block
 block discarded – undo
394 394
 	 */
395 395
 	function getExtraKeys($module_srl)
396 396
 	{
397
-		if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
397
+		if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
398 398
 		{
399 399
 			$keys = false;
400 400
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
401
-			if($oCacheHandler->isSupport())
401
+			if ($oCacheHandler->isSupport())
402 402
 			{
403
-				$object_key = 'module_document_extra_keys:' . $module_srl;
403
+				$object_key = 'module_document_extra_keys:'.$module_srl;
404 404
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
405 405
 				$keys = $oCacheHandler->get($cache_key);
406 406
 			}
407 407
 
408 408
 			$oExtraVar = ExtraVar::getInstance($module_srl);
409 409
 
410
-			if($keys === false)
410
+			if ($keys === false)
411 411
 			{
412 412
 				$obj = new stdClass();
413 413
 				$obj->module_srl = $module_srl;
@@ -417,13 +417,13 @@  discard block
 block discarded – undo
417 417
 
418 418
 				// correcting index order
419 419
 				$isFixed = FALSE;
420
-				if(is_array($output->data))
420
+				if (is_array($output->data))
421 421
 				{
422 422
 					$prevIdx = 0;
423
-					foreach($output->data as $no => $value)
423
+					foreach ($output->data as $no => $value)
424 424
 					{
425 425
 						// case first
426
-						if($prevIdx == 0 && $value->idx != 1)
426
+						if ($prevIdx == 0 && $value->idx != 1)
427 427
 						{
428 428
 							$args = new stdClass();
429 429
 							$args->module_srl = $module_srl;
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 						}
438 438
 
439 439
 						// case others
440
-						if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
440
+						if ($prevIdx > 0 && $prevIdx + 1 != $value->idx)
441 441
 						{
442 442
 							$args = new stdClass();
443 443
 							$args->module_srl = $module_srl;
@@ -454,16 +454,16 @@  discard block
 block discarded – undo
454 454
 					}
455 455
 				}
456 456
 
457
-				if($isFixed)
457
+				if ($isFixed)
458 458
 				{
459 459
 					$output = executeQueryArray('document.getDocumentExtraKeys', $obj);
460 460
 				}
461 461
 
462 462
 				$oExtraVar->setExtraVarKeys($output->data);
463 463
 				$keys = $oExtraVar->getExtraVars();
464
-				if(!$keys) $keys = array();
464
+				if (!$keys) $keys = array();
465 465
 
466
-				if($oCacheHandler->isSupport())
466
+				if ($oCacheHandler->isSupport())
467 467
 				{
468 468
 					$oCacheHandler->put($cache_key, $keys);
469 469
 				}
@@ -484,14 +484,14 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	function getExtraVars($module_srl, $document_srl)
486 486
 	{
487
-		if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
487
+		if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
488 488
 		{
489 489
 			// Extended to extract the values of variables set
490 490
 			$oDocument = $this->getDocument($document_srl, false);
491 491
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
492 492
 			$this->setToAllDocumentExtraVars();
493 493
 		}
494
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
494
+		if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
495 495
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
496 496
 	}
497 497
 
@@ -514,71 +514,71 @@  discard block
 block discarded – undo
514 514
 
515 515
 		$oDocumentController = getController('document');
516 516
 		// Members must be a possible feature
517
-		if($logged_info->member_srl)
517
+		if ($logged_info->member_srl)
518 518
 		{
519 519
 			$oDocumentModel = getModel('document');
520 520
 			$columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
521 521
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
522 522
 			$module_srl = $oDocument->get('module_srl');
523 523
 			$member_srl = $oDocument->get('member_srl');
524
-			if(!$module_srl) return new Object(-1, 'msg_invalid_request');
524
+			if (!$module_srl) return new Object(-1, 'msg_invalid_request');
525 525
 
526 526
 			$oModuleModel = getModel('module');
527
-			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
528
-			if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
527
+			$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
528
+			if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
529 529
 			{
530 530
 				// Add a Referral Button
531 531
 				$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
532
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
532
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript');
533 533
 			}
534 534
 
535
-			if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
535
+			if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
536 536
 			{
537 537
 				// Add button to negative
538
-				$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
539
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
538
+				$url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
539
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
540 540
 			}
541 541
 
542 542
 			// Adding Report
543 543
 			$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
544
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
544
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript');
545 545
 
546 546
 			// Add Bookmark button
547 547
 			$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
548
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
548
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript');
549 549
 		}
550 550
 		// Add print button
551
-		$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
552
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
551
+		$url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl);
552
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument');
553 553
 		// Call a trigger (after)
554 554
 		ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
555
-		if($this->grant->manager)
555
+		if ($this->grant->manager)
556 556
 		{
557 557
 			$str_confirm = Context::getLang('confirm_move');
558 558
 			$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);
559
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
559
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript');
560 560
 		}
561 561
 
562 562
 		// If you are managing to find posts by ip
563
-		if($logged_info->is_admin == 'Y')
563
+		if ($logged_info->is_admin == 'Y')
564 564
 		{
565 565
 			$oDocumentModel = getModel('document');
566
-			$oDocument = $oDocumentModel->getDocument($document_srl);	//before setting document recycle
566
+			$oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
567 567
 
568
-			if($oDocument->isExists())
568
+			if ($oDocument->isExists())
569 569
 			{
570 570
 				// Find a post equivalent to ip address
571
-				$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
572
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
571
+				$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress());
572
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
573 573
 
574 574
 				$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
575
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
575
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
576 576
 			}
577 577
 		}
578 578
 		// Changing the language of pop-up menu
579 579
 		$menus = Context::get('document_popup_menu_list');
580 580
 		$menus_count = count($menus);
581
-		for($i=0;$i<$menus_count;$i++)
581
+		for ($i = 0; $i < $menus_count; $i++)
582 582
 		{
583 583
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
584 584
 		}
@@ -594,13 +594,13 @@  discard block
 block discarded – undo
594 594
 	 */
595 595
 	function getDocumentCount($module_srl, $search_obj = NULL)
596 596
 	{
597
-		if(is_null($search_obj)) $search_obj = new stdClass();
597
+		if (is_null($search_obj)) $search_obj = new stdClass();
598 598
 		$search_obj->module_srl = $module_srl;
599 599
 
600 600
 		$output = executeQuery('document.getDocumentCount', $search_obj);
601 601
 		// Return total number of
602 602
 		$total_count = $output->data->count;
603
-		return (int)$total_count;
603
+		return (int) $total_count;
604 604
 	}
605 605
 
606 606
 	/**
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	function getDocumentCountByGroupStatus($search_obj = NULL)
612 612
 	{
613 613
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
614
-		if(!$output->toBool()) return array();
614
+		if (!$output->toBool()) return array();
615 615
 
616 616
 		return $output->data;
617 617
 	}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		$output = executeQuery('document.getDocumentExtraVarsCount', $args);
631 631
 		// Return total number of
632 632
 		$total_count = $output->data->count;
633
-		return (int)$total_count;
633
+		return (int) $total_count;
634 634
 	}
635 635
 
636 636
 	/**
@@ -647,17 +647,17 @@  discard block
 block discarded – undo
647 647
 
648 648
 		$this->_setSearchOption($opt, $args, $query_id, $use_division);
649 649
 
650
-		if($sort_check->isExtraVars)
650
+		if ($sort_check->isExtraVars)
651 651
 		{
652 652
 			return 1;
653 653
 		}
654 654
 		else
655 655
 		{
656
-			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
656
+			if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
657 657
 			{
658
-				if($args->order_type === 'desc')
658
+				if ($args->order_type === 'desc')
659 659
 				{
660
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
660
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
661 661
 				}
662 662
 				else
663 663
 				{
@@ -671,9 +671,9 @@  discard block
 block discarded – undo
671 671
 		}
672 672
 
673 673
 		// Guhanhu total number of the article search page
674
-		$output = executeQuery($query_id . 'Page', $args);
674
+		$output = executeQuery($query_id.'Page', $args);
675 675
 		$count = $output->data->count;
676
-		$page = (int)(($count-1)/$opt->list_count)+1;
676
+		$page = (int) (($count - 1) / $opt->list_count) + 1;
677 677
 		return $page;
678 678
 	}
679 679
 
@@ -685,16 +685,16 @@  discard block
 block discarded – undo
685 685
 	 */
686 686
 	function getCategory($category_srl, $columnList = array())
687 687
 	{
688
-		$args =new stdClass();
688
+		$args = new stdClass();
689 689
 		$args->category_srl = $category_srl;
690 690
 		$output = executeQuery('document.getCategory', $args, $columnList);
691 691
 
692 692
 		$node = $output->data;
693
-		if(!$node) return;
693
+		if (!$node) return;
694 694
 
695
-		if($node->group_srls)
695
+		if ($node->group_srls)
696 696
 		{
697
-			$group_srls = explode(',',$node->group_srls);
697
+			$group_srls = explode(',', $node->group_srls);
698 698
 			unset($node->group_srls);
699 699
 			$node->group_srls = $group_srls;
700 700
 		}
@@ -715,8 +715,8 @@  discard block
 block discarded – undo
715 715
 	{
716 716
 		$args = new stdClass();
717 717
 		$args->category_srl = $category_srl;
718
-		$output = executeQuery('document.getChildCategoryCount',$args);
719
-		if($output->data->count > 0) return true;
718
+		$output = executeQuery('document.getChildCategoryCount', $args);
719
+		if ($output->data->count > 0) return true;
720 720
 		return false;
721 721
 	}
722 722
 
@@ -732,10 +732,10 @@  discard block
 block discarded – undo
732 732
 		// Category of the target module file swollen
733 733
 		$filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
734 734
 		// If the target file to the cache file regeneration category
735
-		if(!file_exists($filename))
735
+		if (!file_exists($filename))
736 736
 		{
737 737
 			$oDocumentController = getController('document');
738
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
738
+			if (!$oDocumentController->makeCategoryFile($module_srl)) return array();
739 739
 		}
740 740
 
741 741
 		include($filename);
@@ -755,10 +755,10 @@  discard block
 block discarded – undo
755 755
 	 */
756 756
 	function _arrangeCategory(&$document_category, $list, $depth)
757 757
 	{
758
-		if(!count($list)) return;
758
+		if (!count($list)) return;
759 759
 		$idx = 0;
760 760
 		$list_order = array();
761
-		foreach($list as $key => $val)
761
+		foreach ($list as $key => $val)
762 762
 		{
763 763
 			$obj = new stdClass;
764 764
 			$obj->mid = $val['mid'];
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 			$obj->parent_srl = $val['parent_srl'];
768 768
 			$obj->title = $obj->text = $val['text'];
769 769
 			$obj->description = $val['description'];
770
-			$obj->expand = $val['expand']=='Y'?true:false;
770
+			$obj->expand = $val['expand'] == 'Y' ? true : false;
771 771
 			$obj->color = $val['color'];
772 772
 			$obj->document_count = $val['document_count'];
773 773
 			$obj->depth = $depth;
@@ -775,26 +775,26 @@  discard block
 block discarded – undo
775 775
 			$obj->childs = array();
776 776
 			$obj->grant = $val['grant'];
777 777
 
778
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
778
+			if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
779 779
 			else $selected = false;
780 780
 
781 781
 			$obj->selected = $selected;
782 782
 
783 783
 			$list_order[$idx++] = $obj->category_srl;
784 784
 			// If you have a parent category of child nodes apply data
785
-			if($obj->parent_srl)
785
+			if ($obj->parent_srl)
786 786
 			{
787 787
 				$parent_srl = $obj->parent_srl;
788 788
 				$document_count = $obj->document_count;
789 789
 				$expand = $obj->expand;
790
-				if($selected) $expand = true;
790
+				if ($selected) $expand = true;
791 791
 
792
-				while($parent_srl)
792
+				while ($parent_srl)
793 793
 				{
794 794
 					$document_category[$parent_srl]->document_count += $document_count;
795 795
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
796 796
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
797
-					if($expand) $document_category[$parent_srl]->expand = $expand;
797
+					if ($expand) $document_category[$parent_srl]->expand = $expand;
798 798
 
799 799
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
800 800
 				}
@@ -802,10 +802,10 @@  discard block
 block discarded – undo
802 802
 
803 803
 			$document_category[$key] = $obj;
804 804
 
805
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
805
+			if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1);
806 806
 		}
807 807
 		$document_category[$list_order[0]]->first = true;
808
-		$document_category[$list_order[count($list_order)-1]]->last = true;
808
+		$document_category[$list_order[count($list_order) - 1]]->last = true;
809 809
 	}
810 810
 
811 811
 	/**
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 		$args->module_srl = $module_srl;
821 821
 		$args->category_srl = $category_srl;
822 822
 		$output = executeQuery('document.getCategoryDocumentCount', $args);
823
-		return (int)$output->data->count;
823
+		return (int) $output->data->count;
824 824
 	}
825 825
 
826 826
 	/**
@@ -830,8 +830,8 @@  discard block
 block discarded – undo
830 830
 	 */
831 831
 	function getCategoryXmlFile($module_srl)
832 832
 	{
833
-		$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
834
-		if(!file_exists($xml_file))
833
+		$xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl);
834
+		if (!file_exists($xml_file))
835 835
 		{
836 836
 			$oDocumentController = getController('document');
837 837
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -846,8 +846,8 @@  discard block
 block discarded – undo
846 846
 	 */
847 847
 	function getCategoryPhpFile($module_srl)
848 848
 	{
849
-		$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
850
-		if(!file_exists($php_file))
849
+		$php_file = sprintf('files/cache/document_category/%s.php', $module_srl);
850
+		if (!file_exists($php_file))
851 851
 		{
852 852
 			$oDocumentController = getController('document');
853 853
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 */
863 863
 	function getMonthlyArchivedList($obj)
864 864
 	{
865
-		if($obj->mid)
865
+		if ($obj->mid)
866 866
 		{
867 867
 			$oModuleModel = getModel('module');
868 868
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 		// Module_srl passed the array may be a check whether the array
872 872
 		$args = new stdClass;
873
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
873
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
874 874
 		else $args->module_srl = $obj->module_srl;
875 875
 
876 876
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
877
-		if(!$output->toBool()||!$output->data) return $output;
877
+		if (!$output->toBool() || !$output->data) return $output;
878 878
 
879
-		if(!is_array($output->data)) $output->data = array($output->data);
879
+		if (!is_array($output->data)) $output->data = array($output->data);
880 880
 
881 881
 		return $output;
882 882
 	}
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 */
889 889
 	function getDailyArchivedList($obj)
890 890
 	{
891
-		if($obj->mid)
891
+		if ($obj->mid)
892 892
 		{
893 893
 			$oModuleModel = getModel('module');
894 894
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -896,14 +896,14 @@  discard block
 block discarded – undo
896 896
 		}
897 897
 		// Module_srl passed the array may be a check whether the array
898 898
 		$args = new stdClass;
899
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
899
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
900 900
 		else $args->module_srl = $obj->module_srl;
901 901
 		$args->regdate = $obj->regdate;
902 902
 
903 903
 		$output = executeQuery('document.getDailyArchivedList', $args);
904
-		if(!$output->toBool()) return $output;
904
+		if (!$output->toBool()) return $output;
905 905
 
906
-		if(!is_array($output->data)) $output->data = array($output->data);
906
+		if (!is_array($output->data)) $output->data = array($output->data);
907 907
 
908 908
 		return $output;
909 909
 	}
@@ -914,17 +914,17 @@  discard block
 block discarded – undo
914 914
 	 */
915 915
 	function getDocumentCategories()
916 916
 	{
917
-		if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
917
+		if (!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
918 918
 		$module_srl = Context::get('module_srl');
919
-		$categories= $this->getCategoryList($module_srl);
919
+		$categories = $this->getCategoryList($module_srl);
920 920
 		$lang = Context::get('lang');
921 921
 		// No additional category
922 922
 		$output = "0,0,{$lang->none_category}\n";
923
-		if($categories)
923
+		if ($categories)
924 924
 		{
925
-			foreach($categories as $category_srl => $category)
925
+			foreach ($categories as $category_srl => $category)
926 926
 			{
927
-				$output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
927
+				$output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title);
928 928
 			}
929 929
 		}
930 930
 		$this->add('categories', $output);
@@ -936,13 +936,13 @@  discard block
 block discarded – undo
936 936
 	 */
937 937
 	function getDocumentConfig()
938 938
 	{
939
-		if(!$GLOBALS['__document_config__'])
939
+		if (!$GLOBALS['__document_config__'])
940 940
 		{
941 941
 			$oModuleModel = getModel('module');
942 942
 			$config = $oModuleModel->getModuleConfig('document');
943 943
 
944
-			if(!$config) $config = new stdClass();
945
-			if(!$config->thumbnail_type) $config->thumbnail_type = 'crop';
944
+			if (!$config) $config = new stdClass();
945
+			if (!$config->thumbnail_type) $config->thumbnail_type = 'crop';
946 946
 			$GLOBALS['__document_config__'] = $config;
947 947
 		}
948 948
 		return $GLOBALS['__document_config__'];
@@ -1007,11 +1007,11 @@  discard block
 block discarded – undo
1007 1007
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1008 1008
 		// Check permissions
1009 1009
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1010
-		if(!$grant->manager) return new Object(-1,'msg_not_permitted');
1010
+		if (!$grant->manager) return new Object(-1, 'msg_not_permitted');
1011 1011
 
1012 1012
 		$category_srl = Context::get('category_srl');
1013 1013
 		$category_info = $this->getCategory($category_srl);
1014
-		if(!$category_info)
1014
+		if (!$category_info)
1015 1015
 		{
1016 1016
 			return new Object(-1, 'msg_invalid_request');
1017 1017
 		}
@@ -1027,14 +1027,14 @@  discard block
 block discarded – undo
1027 1027
 	 */
1028 1028
 	function getDocumentSrlByAlias($mid, $alias)
1029 1029
 	{
1030
-		if(!$mid || !$alias) return null;
1030
+		if (!$mid || !$alias) return null;
1031 1031
 		$site_module_info = Context::get('site_module_info');
1032 1032
 		$args = new stdClass;
1033 1033
 		$args->mid = $mid;
1034 1034
 		$args->alias_title = $alias;
1035 1035
 		$args->site_srl = $site_module_info->site_srl;
1036 1036
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1037
-		if(!$output->data) return null;
1037
+		if (!$output->data) return null;
1038 1038
 		else return $output->data->document_srl;
1039 1039
 	}
1040 1040
 
@@ -1046,15 +1046,15 @@  discard block
 block discarded – undo
1046 1046
 	 */
1047 1047
 	function getDocumentSrlByTitle($module_srl, $title)
1048 1048
 	{
1049
-		if(!$module_srl || !$title) return null;
1049
+		if (!$module_srl || !$title) return null;
1050 1050
 		$args = new stdClass;
1051 1051
 		$args->module_srl = $module_srl;
1052 1052
 		$args->title = $title;
1053 1053
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1054
-		if(!$output->data) return null;
1054
+		if (!$output->data) return null;
1055 1055
 		else
1056 1056
 		{
1057
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1057
+			if (is_array($output->data)) return $output->data[0]->document_srl;
1058 1058
 			return $output->data->document_srl;
1059 1059
 		}
1060 1060
 	}
@@ -1066,12 +1066,12 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	function getAlias($document_srl)
1068 1068
 	{
1069
-		if(!$document_srl) return null;
1069
+		if (!$document_srl) return null;
1070 1070
 		$args = new stdClass;
1071 1071
 		$args->document_srl = $document_srl;
1072 1072
 		$output = executeQueryArray('document.getAliases', $args);
1073 1073
 
1074
-		if(!$output->data) return null;
1074
+		if (!$output->data) return null;
1075 1075
 		else return $output->data[0]->alias_title;
1076 1076
 	}
1077 1077
 
@@ -1114,32 +1114,32 @@  discard block
 block discarded – undo
1114 1114
 	{
1115 1115
 		// Variable check
1116 1116
 		$args = new stdClass;
1117
-		$args->category_srl = $obj->category_srl?$obj->category_srl:null;
1117
+		$args->category_srl = $obj->category_srl ? $obj->category_srl : null;
1118 1118
 		$args->sort_index = $obj->sort_index;
1119
-		$args->order_type = $obj->order_type?$obj->order_type:'desc';
1120
-		$args->page = $obj->page?$obj->page:1;
1121
-		$args->list_count = $obj->list_count?$obj->list_count:20;
1122
-		$args->page_count = $obj->page_count?$obj->page_count:10;
1119
+		$args->order_type = $obj->order_type ? $obj->order_type : 'desc';
1120
+		$args->page = $obj->page ? $obj->page : 1;
1121
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
1122
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
1123 1123
 		// Search options
1124 1124
 		$search_target = $obj->search_target;
1125 1125
 		$search_keyword = $obj->search_keyword;
1126
-		if($search_target && $search_keyword)
1126
+		if ($search_target && $search_keyword)
1127 1127
 		{
1128
-			switch($search_target)
1128
+			switch ($search_target)
1129 1129
 			{
1130 1130
 				case 'title' :
1131 1131
 				case 'content' :
1132
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1132
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1133 1133
 					$args->{"s_".$search_target} = $search_keyword;
1134 1134
 					$use_division = true;
1135 1135
 					break;
1136 1136
 				case 'title_content' :
1137
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1137
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1138 1138
 					$args->s_title = $search_keyword;
1139 1139
 					$args->s_content = $search_keyword;
1140 1140
 					break;
1141 1141
 				case 'user_id' :
1142
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1142
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1143 1143
 					$args->s_user_id = $search_keyword;
1144 1144
 					$args->sort_index = 'documents.'.$args->sort_index;
1145 1145
 					break;
@@ -1147,13 +1147,13 @@  discard block
 block discarded – undo
1147 1147
 				case 'nick_name' :
1148 1148
 				case 'email_address' :
1149 1149
 				case 'homepage' :
1150
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1150
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1151 1151
 					$args->{"s_".$search_target} = $search_keyword;
1152 1152
 					break;
1153 1153
 				case 'is_notice' :
1154 1154
 				case 'is_secret' :
1155
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1156
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1155
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1156
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1157 1157
 					break;
1158 1158
 				case 'member_srl' :
1159 1159
 				case 'readed_count' :
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 				case 'comment_count' :
1163 1163
 				case 'trackback_count' :
1164 1164
 				case 'uploaded_count' :
1165
-					$args->{"s_".$search_target} = (int)$search_keyword;
1165
+					$args->{"s_".$search_target} = (int) $search_keyword;
1166 1166
 					break;
1167 1167
 				case 'regdate' :
1168 1168
 				case 'last_update' :
@@ -1174,9 +1174,9 @@  discard block
 block discarded – undo
1174 1174
 		}
1175 1175
 
1176 1176
 		$output = executeQueryArray('document.getTrashList', $args);
1177
-		if($output->data)
1177
+		if ($output->data)
1178 1178
 		{
1179
-			foreach($output->data as $key => $attribute)
1179
+			foreach ($output->data as $key => $attribute)
1180 1180
 			{
1181 1181
 				$oDocument = null;
1182 1182
 				$oDocument = new documentItem();
@@ -1195,46 +1195,46 @@  discard block
 block discarded – undo
1195 1195
 	{
1196 1196
 		$args = new stdClass;
1197 1197
 		$document_srl = Context::get('document_srl');
1198
-		if(!$document_srl) return new Object(-1,'msg_invalid_request');
1198
+		if (!$document_srl) return new Object(-1, 'msg_invalid_request');
1199 1199
 
1200 1200
 		$point = Context::get('point');
1201
-		if($point != -1) $point = 1;
1201
+		if ($point != -1) $point = 1;
1202 1202
 
1203 1203
 		$oDocumentModel = getModel('document');
1204 1204
 		$columnList = array('document_srl', 'module_srl');
1205 1205
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1206 1206
 		$module_srl = $oDocument->get('module_srl');
1207
-		if(!$module_srl) return new Object(-1, 'msg_invalid_request');
1207
+		if (!$module_srl) return new Object(-1, 'msg_invalid_request');
1208 1208
 
1209 1209
 		$oModuleModel = getModel('module');
1210
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1211
-		if($point == -1)
1210
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
1211
+		if ($point == -1)
1212 1212
 		{
1213
-			if($document_config->use_vote_down!='S') return new Object(-1, 'msg_invalid_request');
1213
+			if ($document_config->use_vote_down != 'S') return new Object(-1, 'msg_invalid_request');
1214 1214
 			$args->below_point = 0;
1215 1215
 		}
1216 1216
 		else
1217 1217
 		{
1218
-			if($document_config->use_vote_up!='S') return new Object(-1, 'msg_invalid_request');
1218
+			if ($document_config->use_vote_up != 'S') return new Object(-1, 'msg_invalid_request');
1219 1219
 			$args->more_point = 0;
1220 1220
 		}
1221 1221
 
1222 1222
 		$args->document_srl = $document_srl;
1223 1223
 
1224
-		$output = executeQueryArray('document.getVotedMemberList',$args);
1225
-		if(!$output->toBool()) return $output;
1224
+		$output = executeQueryArray('document.getVotedMemberList', $args);
1225
+		if (!$output->toBool()) return $output;
1226 1226
 
1227 1227
 		$oMemberModel = getModel('member');
1228
-		if($output->data)
1228
+		if ($output->data)
1229 1229
 		{
1230
-			foreach($output->data as $k => $d)
1230
+			foreach ($output->data as $k => $d)
1231 1231
 			{
1232 1232
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1233 1233
 				$output->data[$k]->src = $profile_image->src;
1234 1234
 			}
1235 1235
 		}
1236 1236
 
1237
-		$this->add('voted_member_list',$output->data);
1237
+		$this->add('voted_member_list', $output->data);
1238 1238
 	}
1239 1239
 
1240 1240
 	/**
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 	function getStatusNameList()
1245 1245
 	{
1246 1246
 		global $lang;
1247
-		if(!isset($lang->status_name_list))
1247
+		if (!isset($lang->status_name_list))
1248 1248
 			return array_flip($this->getStatusList());
1249 1249
 		else return $lang->status_name_list;
1250 1250
 	}
@@ -1259,7 +1259,7 @@  discard block
 block discarded – undo
1259 1259
 	{
1260 1260
 		$sortIndex = $obj->sort_index;
1261 1261
 		$isExtraVars = false;
1262
-		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')))
1262
+		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')))
1263 1263
 		{
1264 1264
 			// get module_srl extra_vars list
1265 1265
 			if ($load_extra_vars)
@@ -1274,11 +1274,11 @@  discard block
 block discarded – undo
1274 1274
 				else
1275 1275
 				{
1276 1276
 					$check_array = array();
1277
-					foreach($extra_output->data as $val)
1277
+					foreach ($extra_output->data as $val)
1278 1278
 					{
1279 1279
 						$check_array[] = $val->eid;
1280 1280
 					}
1281
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1281
+					if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1282 1282
 					else $isExtraVars = true;
1283 1283
 				}
1284 1284
 			}
@@ -1306,13 +1306,13 @@  discard block
 block discarded – undo
1306 1306
 	{
1307 1307
 		// Variable check
1308 1308
 		$args = new stdClass();
1309
-		$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1309
+		$args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null;
1310 1310
 		$args->order_type = $searchOpt->order_type;
1311
-		$args->page = $searchOpt->page?$searchOpt->page:1;
1312
-		$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1313
-		$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1314
-		$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1315
-		$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1311
+		$args->page = $searchOpt->page ? $searchOpt->page : 1;
1312
+		$args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20;
1313
+		$args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10;
1314
+		$args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null;
1315
+		$args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null;
1316 1316
 		$args->member_srl = $searchOpt->member_srl;
1317 1317
 
1318 1318
 		$logged_info = Context::get('logged_info');
@@ -1321,10 +1321,10 @@  discard block
 block discarded – undo
1321 1321
 		
1322 1322
 		// Check the target and sequence alignment
1323 1323
 		$orderType = array('desc' => 1, 'asc' => 1);
1324
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1324
+		if (!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1325 1325
 
1326 1326
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1327
-		if($searchOpt->mid)
1327
+		if ($searchOpt->mid)
1328 1328
 		{
1329 1329
 			$oModuleModel = getModel('module');
1330 1330
 			$args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -1332,30 +1332,30 @@  discard block
 block discarded – undo
1332 1332
 		}
1333 1333
 
1334 1334
 		// Module_srl passed the array may be a check whether the array
1335
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1335
+		if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1336 1336
 		else $args->module_srl = $searchOpt->module_srl;
1337 1337
 
1338 1338
 		// Except for the test module_srl
1339
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1339
+		if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1340 1340
 		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1341 1341
 
1342 1342
 		// only admin document list, temp document showing
1343
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1343
+		if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1344 1344
 		else
1345 1345
 		{
1346
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1346
+			if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1347 1347
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1348 1348
 			else
1349 1349
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1350 1350
 		}
1351 1351
 
1352 1352
 		// Category is selected, further sub-categories until all conditions
1353
-		if($args->category_srl)
1353
+		if ($args->category_srl)
1354 1354
 		{
1355 1355
 			$category_list = $this->getCategoryList($args->module_srl);
1356 1356
 			$category_info = $category_list[$args->category_srl];
1357 1357
 			$category_info->childs[] = $args->category_srl;
1358
-			$args->category_srl = implode(',',$category_info->childs);
1358
+			$args->category_srl = implode(',', $category_info->childs);
1359 1359
 		}
1360 1360
 
1361 1361
 		// Used to specify the default query id (based on several search options to query id modified)
@@ -1368,24 +1368,24 @@  discard block
 block discarded – undo
1368 1368
 		$search_target = $searchOpt->search_target;
1369 1369
 		$search_keyword = $searchOpt->search_keyword;
1370 1370
 
1371
-		if($search_target && $search_keyword)
1371
+		if ($search_target && $search_keyword)
1372 1372
 		{
1373
-			switch($search_target)
1373
+			switch ($search_target)
1374 1374
 			{
1375 1375
 				case 'title' :
1376 1376
 				case 'content' :
1377
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1377
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1378 1378
 					$args->{"s_".$search_target} = $search_keyword;
1379 1379
 					$use_division = true;
1380 1380
 					break;
1381 1381
 				case 'title_content' :
1382
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1382
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1383 1383
 					$args->s_title = $search_keyword;
1384 1384
 					$args->s_content = $search_keyword;
1385 1385
 					$use_division = true;
1386 1386
 					break;
1387 1387
 				case 'user_id' :
1388
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1388
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1389 1389
 					$args->s_user_id = $search_keyword;
1390 1390
 					$args->sort_index = 'documents.'.$args->sort_index;
1391 1391
 					break;
@@ -1393,18 +1393,18 @@  discard block
 block discarded – undo
1393 1393
 				case 'nick_name' :
1394 1394
 				case 'email_address' :
1395 1395
 				case 'homepage' :
1396
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1396
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1397 1397
 					$args->{"s_".$search_target} = $search_keyword;
1398 1398
 					break;
1399 1399
 				case 'is_notice' :
1400
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1401
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1400
+					if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N';
1401
+					elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y';
1402 1402
 					else $args->{"s_".$search_target} = '';
1403 1403
 					break;
1404 1404
 				case 'is_secret' :
1405
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1406
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1407
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1405
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1406
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1407
+					elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp'));
1408 1408
 					break;
1409 1409
 				case 'member_srl' :
1410 1410
 				case 'readed_count' :
@@ -1412,10 +1412,10 @@  discard block
 block discarded – undo
1412 1412
 				case 'comment_count' :
1413 1413
 				case 'trackback_count' :
1414 1414
 				case 'uploaded_count' :
1415
-					$args->{"s_".$search_target} = (int)$search_keyword;
1415
+					$args->{"s_".$search_target} = (int) $search_keyword;
1416 1416
 					break;
1417 1417
 				case 'blamed_count' :
1418
-					$args->{"s_".$search_target} = (int)$search_keyword * -1;
1418
+					$args->{"s_".$search_target} = (int) $search_keyword * -1;
1419 1419
 					break;
1420 1420
 				case 'regdate' :
1421 1421
 				case 'last_update' :
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 					$use_division = true;
1429 1429
 					break;
1430 1430
 				case 'tag' :
1431
-					$args->s_tags = str_replace(' ','%',$search_keyword);
1431
+					$args->s_tags = str_replace(' ', '%', $search_keyword);
1432 1432
 					$query_id = 'document.getDocumentListWithinTag';
1433 1433
 					break;
1434 1434
 				case 'extra_vars':
@@ -1436,9 +1436,9 @@  discard block
 block discarded – undo
1436 1436
 					$query_id = 'document.getDocumentListWithinExtraVars';
1437 1437
 					break;
1438 1438
 				default :
1439
-					if(strpos($search_target,'extra_vars')!==false) {
1439
+					if (strpos($search_target, 'extra_vars') !== false) {
1440 1440
 						$args->var_idx = substr($search_target, strlen('extra_vars'));
1441
-						$args->var_value = str_replace(' ','%',$search_keyword);
1441
+						$args->var_value = str_replace(' ', '%', $search_keyword);
1442 1442
 						$args->sort_index = 'documents.'.$args->sort_index;
1443 1443
 						$query_id = 'document.getDocumentListWithExtraVars';
1444 1444
 					}
@@ -1455,18 +1455,18 @@  discard block
 block discarded – undo
1455 1455
 			/**
1456 1456
 			 * list_order asc sort of division that can be used only when
1457 1457
 			 */
1458
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1458
+			if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1459 1459
 
1460 1460
 			/**
1461 1461
 			 * If it is true, use_division changed to use the document division
1462 1462
 			 */
1463
-			if($use_division)
1463
+			if ($use_division)
1464 1464
 			{
1465 1465
 				// Division begins
1466
-				$division = (int)Context::get('division');
1466
+				$division = (int) Context::get('division');
1467 1467
 
1468 1468
 				// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1469
-				if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1469
+				if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1470 1470
 				{
1471 1471
 					$listSqlID = 'document.getDocumentListUseIndex';
1472 1472
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 				}
1479 1479
 
1480 1480
 				// If you do not value the best division top
1481
-				if(!$division)
1481
+				if (!$division)
1482 1482
 				{
1483 1483
 					$division_args = new stdClass();
1484 1484
 					$division_args->module_srl = $args->module_srl;
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 					$division_args->statusList = $args->statusList;
1490 1490
 
1491 1491
 					$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1492
-					if($output->data)
1492
+					if ($output->data)
1493 1493
 					{
1494 1494
 						$item = array_pop($output->data);
1495 1495
 						$division = $item->list_order;
@@ -1498,10 +1498,10 @@  discard block
 block discarded – undo
1498 1498
 				}
1499 1499
 
1500 1500
 				// The last division
1501
-				$last_division = (int)Context::get('last_division');
1501
+				$last_division = (int) Context::get('last_division');
1502 1502
 
1503 1503
 				// Division after division from the 5000 value of the specified Wanted
1504
-				if(!$last_division)
1504
+				if (!$last_division)
1505 1505
 				{
1506 1506
 					$last_division_args = new stdClass();
1507 1507
 					$last_division_args->module_srl = $args->module_srl;
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
 					$last_division_args->page = 5001;
1514 1514
 
1515 1515
 					$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1516
-					if($output->data)
1516
+					if ($output->data)
1517 1517
 					{
1518 1518
 						$item = array_pop($output->data);
1519 1519
 						$last_division = $item->list_order;
@@ -1521,14 +1521,14 @@  discard block
 block discarded – undo
1521 1521
 				}
1522 1522
 
1523 1523
 				// Make sure that after last_division article
1524
-				if($last_division)
1524
+				if ($last_division)
1525 1525
 				{
1526 1526
 					$last_division_args = new stdClass();
1527 1527
 					$last_division_args->module_srl = $args->module_srl;
1528 1528
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1529 1529
 					$last_division_args->list_order = $last_division;
1530 1530
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1531
-					if($output->data->count<1) $last_division = null;
1531
+					if ($output->data->count < 1) $last_division = null;
1532 1532
 				}
1533 1533
 
1534 1534
 				$args->division = $division;
@@ -1561,7 +1561,7 @@  discard block
 block discarded – undo
1561 1561
 	 * @param int $count
1562 1562
 	 * @return object
1563 1563
 	 */
1564
-	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1564
+	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0)
1565 1565
 	{
1566 1566
 		$args = new stdClass();
1567 1567
 		$args->member_srl = $member_srl;
@@ -1569,8 +1569,8 @@  discard block
 block discarded – undo
1569 1569
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1570 1570
 		$document_list = $output->data;
1571 1571
 		
1572
-		if(!$document_list) return array();
1573
-		if(!is_array($document_list)) $document_list = array($document_list);
1572
+		if (!$document_list) return array();
1573
+		if (!is_array($document_list)) $document_list = array($document_list);
1574 1574
 
1575 1575
 		return $document_list;	
1576 1576
 	}
Please login to merge, or discard this patch.