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 ( 3d3ece...f480fa )
by gyeong-won
09:44
created
modules/comment/comment.view.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	/**
25 25
 	 * Add a form fot comment setting on the additional setting of module
26 26
 	 * @param string $obj
27
-	 * @return string
27
+	 * @return BaseObject
28 28
 	 */
29 29
 	function triggerDispCommentAdditionSetup(&$obj)
30 30
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 		$current_module_srl = Context::get('module_srl');
32 32
 		$current_module_srls = Context::get('module_srls');
33 33
 
34
-		if(!$current_module_srl && !$current_module_srls)
34
+		if (!$current_module_srl && !$current_module_srls)
35 35
 		{
36 36
 			// get information of the selected module
37 37
 			$current_module_info = Context::get('current_module_info');
38 38
 			$current_module_srl = $current_module_info->module_srl;
39
-			if(!$current_module_srl)
39
+			if (!$current_module_srl)
40 40
 			{
41 41
 				return new BaseObject();
42 42
 			}
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 		// Set a template file
56 56
 		$oTemplate = TemplateHandler::getInstance();
57
-		$tpl = $oTemplate->compile($this->module_path . 'tpl', 'comment_module_config');
57
+		$tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config');
58 58
 		$obj .= $tpl;
59 59
 
60 60
 		return new BaseObject();
Please login to merge, or discard this patch.
modules/document/document.model.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	/**
497 497
 	 * Show pop-up menu of the selected posts
498 498
 	 * Printing, scrap, recommendations and negative, reported the Add Features
499
-	 * @return void
499
+	 * @return BaseObject|null
500 500
 	 */
501 501
 	function getDocumentMenu()
502 502
 	{
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 	 * Setting sort index
1267 1267
 	 * @param object $obj
1268 1268
 	 * @param bool $load_extra_vars
1269
-	 * @return object
1269
+	 * @return stdClass
1270 1270
 	 */
1271 1271
 	function _setSortIndex($obj, $load_extra_vars)
1272 1272
 	{
Please login to merge, or discard this patch.
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	function getDocumentExtraVarsFromDB($documentSrls)
39 39
 	{
40
-		if(!is_array($documentSrls) || count($documentSrls) == 0)
40
+		if (!is_array($documentSrls) || count($documentSrls) == 0)
41 41
 		{
42 42
 			return new BaseObject(-1, 'msg_invalid_request');
43 43
 		}
@@ -58,52 +58,52 @@  discard block
 block discarded – undo
58 58
 		$_document_list = &$GLOBALS['XE_DOCUMENT_LIST'];
59 59
 
60 60
 		// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
61
-		if(count($_document_list) <= 0) return;
61
+		if (count($_document_list) <= 0) return;
62 62
 
63 63
 		// Find all called the document object variable has been set extension
64 64
 		$document_srls = array();
65
-		foreach($_document_list as $key => $val)
65
+		foreach ($_document_list as $key => $val)
66 66
 		{
67
-			if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
67
+			if (!$val->document_srl || $checked_documents[$val->document_srl]) continue;
68 68
 			$checked_documents[$val->document_srl] = true;
69 69
 			$document_srls[] = $val->document_srl;
70 70
 		}
71 71
 		// If the document number, return detected
72
-		if(!count($document_srls)) return;
72
+		if (!count($document_srls)) return;
73 73
 		// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
74 74
 		//$obj->document_srl = implode(',',$document_srls);
75 75
 		$output = $this->getDocumentExtraVarsFromDB($document_srls);
76
-		if($output->toBool() && $output->data)
76
+		if ($output->toBool() && $output->data)
77 77
 		{
78
-			foreach($output->data as $key => $val)
78
+			foreach ($output->data as $key => $val)
79 79
 			{
80
-				if(!isset($val->value)) continue;
81
-				if(!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
80
+				if (!isset($val->value)) continue;
81
+				if (!$extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0]) $extra_vars[$val->module_srl][$val->document_srl][$val->var_idx][0] = trim($val->value);
82 82
 				$extra_vars[$val->document_srl][$val->var_idx][$val->lang_code] = trim($val->value);
83 83
 			}
84 84
 		}
85 85
 
86 86
 		$user_lang_code = Context::getLangType();
87
-		for($i=0,$c=count($document_srls);$i<$c;$i++)
87
+		for ($i = 0, $c = count($document_srls); $i < $c; $i++)
88 88
 		{
89 89
 			$document_srl = $document_srls[$i];
90 90
 			unset($vars);
91 91
 
92
-			if(!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
92
+			if (!$_document_list[$document_srl] || !is_object($_document_list[$document_srl]) || !$_document_list[$document_srl]->isExists()) continue;
93 93
 			$module_srl = $_document_list[$document_srl]->get('module_srl');
94 94
 			$extra_keys = $this->getExtraKeys($module_srl);
95 95
 			$vars = $extra_vars[$document_srl];
96 96
 			$document_lang_code = $_document_list[$document_srl]->get('lang_code');
97 97
 			// Expand the variable processing
98
-			if(count($extra_keys))
98
+			if (count($extra_keys))
99 99
 			{
100
-				foreach($extra_keys as $idx => $key)
100
+				foreach ($extra_keys as $idx => $key)
101 101
 				{
102 102
 					$extra_keys[$idx] = clone($key);
103 103
 					$val = $vars[$idx];
104
-					if(isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105
-					else if(isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106
-					else if(isset($val[0])) $v = $val[0];
104
+					if (isset($val[$user_lang_code])) $v = $val[$user_lang_code];
105
+					else if (isset($val[$document_lang_code])) $v = $val[$document_lang_code];
106
+					else if (isset($val[0])) $v = $val[0];
107 107
 					else $v = null;
108 108
 					$extra_keys[$idx]->value = $v;
109 109
 				}
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 			$evars = new ExtraVar($module_srl);
114 114
 			$evars->setExtraVarKeys($extra_keys);
115 115
 			// Title Processing
116
-			if($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title',$vars[-1][$user_lang_code]);
116
+			if ($vars[-1][$user_lang_code]) $_document_list[$document_srl]->add('title', $vars[-1][$user_lang_code]);
117 117
 			// Information processing
118
-			if($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content',$vars[-2][$user_lang_code]);
118
+			if ($vars[-2][$user_lang_code]) $_document_list[$document_srl]->add('content', $vars[-2][$user_lang_code]);
119 119
 			
120 120
 			// static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남		
121 121
 			/*		
@@ -137,21 +137,21 @@  discard block
 block discarded – undo
137 137
 	 * @param array $columnList
138 138
 	 * @return documentItem
139 139
 	 */
140
-	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
140
+	function getDocument($document_srl = 0, $is_admin = false, $load_extra_vars = true, $columnList = array())
141 141
 	{
142
-		if(!$document_srl) return new documentItem();
142
+		if (!$document_srl) return new documentItem();
143 143
 
144
-		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
144
+		if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
145 145
 		{
146 146
 			$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
147
-			if(!$oDocument->isExists())
147
+			if (!$oDocument->isExists())
148 148
 			{
149 149
 				return $oDocument;
150 150
 			}
151 151
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
152
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
152
+			if ($load_extra_vars) $this->setToAllDocumentExtraVars();
153 153
 		}
154
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
154
+		if ($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
155 155
 
156 156
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
157 157
 	}
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 	 * @param array $columnList
165 165
 	 * @return array value type is documentItem
166 166
 	 */
167
-	function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array())
167
+	function getDocuments($document_srls, $is_admin = false, $load_extra_vars = true, $columnList = array())
168 168
 	{
169
-		if(is_array($document_srls))
169
+		if (is_array($document_srls))
170 170
 		{
171 171
 			$list_count = count($document_srls);
172
-			$document_srls = implode(',',$document_srls);
172
+			$document_srls = implode(',', $document_srls);
173 173
 		}
174 174
 		else
175 175
 		{
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$output = executeQuery('document.getDocuments', $args, $columnList);
184 184
 		$document_list = $output->data;
185
-		if(!$document_list) return;
186
-		if(!is_array($document_list)) $document_list = array($document_list);
185
+		if (!$document_list) return;
186
+		if (!is_array($document_list)) $document_list = array($document_list);
187 187
 
188 188
 		$document_count = count($document_list);
189
-		foreach($document_list as $key => $attribute)
189
+		foreach ($document_list as $key => $attribute)
190 190
 		{
191 191
 			$document_srl = $attribute->document_srl;
192
-			if(!$document_srl) continue;
192
+			if (!$document_srl) continue;
193 193
 
194
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
194
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
195 195
 			{
196 196
 				$oDocument = null;
197 197
 				$oDocument = new documentItem();
198 198
 				$oDocument->setAttribute($attribute, false);
199
-				if($is_admin) $oDocument->setGrant();
199
+				if ($is_admin) $oDocument->setGrant();
200 200
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
201 201
 			}
202 202
 
203 203
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
204 204
 		}
205 205
 
206
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
206
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
207 207
 
208 208
 		$output = null;
209
-		if(count($result))
209
+		if (count($result))
210 210
 		{
211
-			foreach($result as $document_srl => $val)
211
+			foreach ($result as $document_srl => $val)
212 212
 			{
213 213
 				$output[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
214 214
 			}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 * @param array $columnList
226 226
 	 * @return BaseObject
227 227
 	 */
228
-	function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array())
228
+	function getDocumentList($obj, $except_notice = false, $load_extra_vars = true, $columnList = array())
229 229
 	{
230 230
 		$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
231 231
 		$obj->sort_index = $sort_check->sort_index;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		// Call trigger (before)
236 236
 		// This trigger can be used to set an alternative output using a different search method
237 237
 		$output = ModuleHandler::triggerCall('document.getDocumentList', 'before', $obj);
238
-		if($output instanceof BaseObject && !$output->toBool())
238
+		if ($output instanceof BaseObject && !$output->toBool())
239 239
 		{
240 240
 			return $output;
241 241
 		}
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 			$output = $obj->use_alternate_output;
253 253
 			unset($obj->use_alternate_output);
254 254
 		}
255
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
255
+		elseif ($sort_check->isExtraVars && substr_count($obj->search_target, 'extra_vars'))
256 256
 		{
257 257
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
258
-			$args->sort_index = str_replace('documents.','',$args->sort_index);
258
+			$args->sort_index = str_replace('documents.', '', $args->sort_index);
259 259
 			$output = executeQueryArray($query_id, $args);
260 260
 		}
261 261
 		elseif ($sort_check->isExtraVars)
@@ -267,16 +267,16 @@  discard block
 block discarded – undo
267 267
 			// document.getDocumentList query execution
268 268
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
269 269
 			$groupByQuery = array('document.getDocumentListWithinComment' => 1, 'document.getDocumentListWithinTag' => 1, 'document.getDocumentListWithinExtraVars' => 1);
270
-			if(isset($groupByQuery[$query_id]))
270
+			if (isset($groupByQuery[$query_id]))
271 271
 			{
272 272
 				$group_args = clone($args);
273 273
 				$group_args->sort_index = 'documents.'.$args->sort_index;
274 274
 				$output = executeQueryArray($query_id, $group_args);
275
-				if(!$output->toBool()||!count($output->data)) return $output;
275
+				if (!$output->toBool() || !count($output->data)) return $output;
276 276
 
277
-				foreach($output->data as $key => $val)
277
+				foreach ($output->data as $key => $val)
278 278
 				{
279
-					if($val->document_srl) $target_srls[] = $val->document_srl;
279
+					if ($val->document_srl) $target_srls[] = $val->document_srl;
280 280
 				}
281 281
 
282 282
 				$page_navigation = $output->page_navigation;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 				$virtual_number = $keys[0];
285 285
 
286 286
 				$target_args = new stdClass();
287
-				$target_args->document_srls = implode(',',$target_srls);
287
+				$target_args->document_srls = implode(',', $target_srls);
288 288
 				$target_args->list_order = $args->sort_index;
289 289
 				$target_args->order_type = $args->order_type;
290 290
 				$target_args->list_count = $args->list_count;
@@ -301,35 +301,35 @@  discard block
 block discarded – undo
301 301
 			}
302 302
 		}
303 303
 		// Return if no result or an error occurs
304
-		if(!$output->toBool()||!count($output->data)) return $output;
304
+		if (!$output->toBool() || !count($output->data)) return $output;
305 305
 		$idx = 0;
306 306
 		$data = $output->data;
307 307
 		unset($output->data);
308 308
 
309
-		if(!isset($virtual_number))
309
+		if (!isset($virtual_number))
310 310
 		{
311 311
 			$keys = array_keys($data);
312 312
 			$virtual_number = $keys[0];
313 313
 		}
314 314
 
315
-		if($except_notice)
315
+		if ($except_notice)
316 316
 		{
317
-			foreach($data as $key => $attribute)
317
+			foreach ($data as $key => $attribute)
318 318
 			{
319
-				if($attribute->is_notice == 'Y') $virtual_number --;
319
+				if ($attribute->is_notice == 'Y') $virtual_number--;
320 320
 			}
321 321
 		}
322 322
 
323
-		foreach($data as $key => $attribute)
323
+		foreach ($data as $key => $attribute)
324 324
 		{
325
-			if($except_notice && $attribute->is_notice == 'Y') continue;
325
+			if ($except_notice && $attribute->is_notice == 'Y') continue;
326 326
 			$document_srl = $attribute->document_srl;
327
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
327
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
328 328
 			{
329 329
 				$oDocument = null;
330 330
 				$oDocument = new documentItem();
331 331
 				$oDocument->setAttribute($attribute, false);
332
-				if($is_admin) $oDocument->setGrant();
332
+				if ($is_admin) $oDocument->setGrant();
333 333
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
334 334
 			}
335 335
 
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 			$virtual_number--;
338 338
 		}
339 339
 
340
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
340
+		if ($load_extra_vars) $this->setToAllDocumentExtraVars();
341 341
 
342
-		if(count($output->data))
342
+		if (count($output->data))
343 343
 		{
344
-			foreach($output->data as $number => $document)
344
+			foreach ($output->data as $number => $document)
345 345
 			{
346 346
 				$output->data[$number] = $GLOBALS['XE_DOCUMENT_LIST'][$document->document_srl];
347 347
 			}
@@ -363,16 +363,16 @@  discard block
 block discarded – undo
363 363
 	{
364 364
 		$args = new stdClass();
365 365
 		$args->module_srl = $obj->module_srl;
366
-		$args->category_srl= $obj->category_srl;
366
+		$args->category_srl = $obj->category_srl;
367 367
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
368
-		if(!$output->toBool()||!$output->data) return;
368
+		if (!$output->toBool() || !$output->data) return;
369 369
 
370
-		foreach($output->data as $key => $val)
370
+		foreach ($output->data as $key => $val)
371 371
 		{
372 372
 			$document_srl = $val->document_srl;
373
-			if(!$document_srl) continue;
373
+			if (!$document_srl) continue;
374 374
 
375
-			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
375
+			if (!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
376 376
 			{
377 377
 				$oDocument = null;
378 378
 				$oDocument = new documentItem();
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 		}
384 384
 		$this->setToAllDocumentExtraVars();
385 385
 
386
-		foreach($result->data as $document_srl => $val)
386
+		foreach ($result->data as $document_srl => $val)
387 387
 		{
388 388
 			$result->data[$document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
389 389
 		}
@@ -399,20 +399,20 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	function getExtraKeys($module_srl)
401 401
 	{
402
-		if(!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
402
+		if (!isset($GLOBALS['XE_EXTRA_KEYS'][$module_srl]))
403 403
 		{
404 404
 			$keys = false;
405 405
 			$oCacheHandler = CacheHandler::getInstance('object', null, true);
406
-			if($oCacheHandler->isSupport())
406
+			if ($oCacheHandler->isSupport())
407 407
 			{
408
-				$object_key = 'module_document_extra_keys:' . $module_srl;
408
+				$object_key = 'module_document_extra_keys:'.$module_srl;
409 409
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
410 410
 				$keys = $oCacheHandler->get($cache_key);
411 411
 			}
412 412
 
413 413
 			$oExtraVar = ExtraVar::getInstance($module_srl);
414 414
 
415
-			if($keys === false)
415
+			if ($keys === false)
416 416
 			{
417 417
 				$obj = new stdClass();
418 418
 				$obj->module_srl = $module_srl;
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 
423 423
 				// correcting index order
424 424
 				$isFixed = FALSE;
425
-				if(is_array($output->data))
425
+				if (is_array($output->data))
426 426
 				{
427 427
 					$prevIdx = 0;
428
-					foreach($output->data as $no => $value)
428
+					foreach ($output->data as $no => $value)
429 429
 					{
430 430
 						// case first
431
-						if($prevIdx == 0 && $value->idx != 1)
431
+						if ($prevIdx == 0 && $value->idx != 1)
432 432
 						{
433 433
 							$args = new stdClass();
434 434
 							$args->module_srl = $module_srl;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 						}
443 443
 
444 444
 						// case others
445
-						if($prevIdx > 0 && $prevIdx + 1 != $value->idx)
445
+						if ($prevIdx > 0 && $prevIdx + 1 != $value->idx)
446 446
 						{
447 447
 							$args = new stdClass();
448 448
 							$args->module_srl = $module_srl;
@@ -459,16 +459,16 @@  discard block
 block discarded – undo
459 459
 					}
460 460
 				}
461 461
 
462
-				if($isFixed)
462
+				if ($isFixed)
463 463
 				{
464 464
 					$output = executeQueryArray('document.getDocumentExtraKeys', $obj);
465 465
 				}
466 466
 
467 467
 				$oExtraVar->setExtraVarKeys($output->data);
468 468
 				$keys = $oExtraVar->getExtraVars();
469
-				if(!$keys) $keys = array();
469
+				if (!$keys) $keys = array();
470 470
 
471
-				if($oCacheHandler->isSupport())
471
+				if ($oCacheHandler->isSupport())
472 472
 				{
473 473
 					$oCacheHandler->put($cache_key, $keys);
474 474
 				}
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 	 */
490 490
 	function getExtraVars($module_srl, $document_srl)
491 491
 	{
492
-		if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
492
+		if (!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl]))
493 493
 		{
494 494
 			// Extended to extract the values of variables set
495 495
 			$oDocument = $this->getDocument($document_srl, false);
496 496
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
497 497
 			$this->setToAllDocumentExtraVars();
498 498
 		}
499
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
499
+		if (is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
500 500
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
501 501
 	}
502 502
 
@@ -519,71 +519,71 @@  discard block
 block discarded – undo
519 519
 
520 520
 		$oDocumentController = getController('document');
521 521
 		// Members must be a possible feature
522
-		if($logged_info->member_srl)
522
+		if ($logged_info->member_srl)
523 523
 		{
524 524
 			$oDocumentModel = getModel('document');
525 525
 			$columnList = array('document_srl', 'module_srl', 'member_srl', 'ipaddress');
526 526
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
527 527
 			$module_srl = $oDocument->get('module_srl');
528 528
 			$member_srl = $oDocument->get('member_srl');
529
-			if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
529
+			if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
530 530
 
531 531
 			$oModuleModel = getModel('module');
532
-			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
533
-			if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl)
532
+			$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
533
+			if ($document_config->use_vote_up != 'N' && $member_srl != $logged_info->member_srl)
534 534
 			{
535 535
 				// Add a Referral Button
536 536
 				$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
537
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','','javascript');
537
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote', '', 'javascript');
538 538
 			}
539 539
 
540
-			if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl)
540
+			if ($document_config->use_vote_down != 'N' && $member_srl != $logged_info->member_srl)
541 541
 			{
542 542
 				// Add button to negative
543
-				$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
544
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','','javascript');
543
+				$url = sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
544
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_vote_down', '', 'javascript');
545 545
 			}
546 546
 
547 547
 			// Adding Report
548 548
 			$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
549
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','','javascript');
549
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_declare', '', 'javascript');
550 550
 
551 551
 			// Add Bookmark button
552 552
 			$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
553
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','','javascript');
553
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_scrap', '', 'javascript');
554 554
 		}
555 555
 		// Add print button
556
-		$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
557
-		$oDocumentController->addDocumentPopupMenu($url,'cmd_print','','printDocument');
556
+		$url = getUrl('', 'module', 'document', 'act', 'dispDocumentPrint', 'document_srl', $document_srl);
557
+		$oDocumentController->addDocumentPopupMenu($url, 'cmd_print', '', 'printDocument');
558 558
 		// Call a trigger (after)
559 559
 		ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
560
-		if($this->grant->manager)
560
+		if ($this->grant->manager)
561 561
 		{
562 562
 			$str_confirm = Context::getLang('confirm_move');
563 563
 			$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);
564
-			$oDocumentController->addDocumentPopupMenu($url,'cmd_trash','','javascript');
564
+			$oDocumentController->addDocumentPopupMenu($url, 'cmd_trash', '', 'javascript');
565 565
 		}
566 566
 
567 567
 		// If you are managing to find posts by ip
568
-		if($logged_info->is_admin == 'Y')
568
+		if ($logged_info->is_admin == 'Y')
569 569
 		{
570 570
 			$oDocumentModel = getModel('document');
571
-			$oDocument = $oDocumentModel->getDocument($document_srl);	//before setting document recycle
571
+			$oDocument = $oDocumentModel->getDocument($document_srl); //before setting document recycle
572 572
 
573
-			if($oDocument->isExists())
573
+			if ($oDocument->isExists())
574 574
 			{
575 575
 				// Find a post equivalent to ip address
576
-				$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->getIpAddress());
577
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
576
+				$url = getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList', 'search_target', 'ipaddress', 'search_keyword', $oDocument->getIpAddress());
577
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_search_by_ipaddress', $icon_path, 'TraceByIpaddress');
578 578
 
579 579
 				$url = sprintf("var params = new Array(); params['ipaddress_list']='%s'; exec_xml('spamfilter', 'procSpamfilterAdminInsertDeniedIP', params, completeCallModuleAction)", $oDocument->getIpAddress());
580
-				$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','','javascript');
580
+				$oDocumentController->addDocumentPopupMenu($url, 'cmd_add_ip_to_spamfilter', '', 'javascript');
581 581
 			}
582 582
 		}
583 583
 		// Changing the language of pop-up menu
584 584
 		$menus = Context::get('document_popup_menu_list');
585 585
 		$menus_count = count($menus);
586
-		for($i=0;$i<$menus_count;$i++)
586
+		for ($i = 0; $i < $menus_count; $i++)
587 587
 		{
588 588
 			$menus[$i]->str = Context::getLang($menus[$i]->str);
589 589
 		}
@@ -599,13 +599,13 @@  discard block
 block discarded – undo
599 599
 	 */
600 600
 	function getDocumentCount($module_srl, $search_obj = NULL)
601 601
 	{
602
-		if(is_null($search_obj)) $search_obj = new stdClass();
602
+		if (is_null($search_obj)) $search_obj = new stdClass();
603 603
 		$search_obj->module_srl = $module_srl;
604 604
 
605 605
 		$output = executeQuery('document.getDocumentCount', $search_obj);
606 606
 		// Return total number of
607 607
 		$total_count = $output->data->count;
608
-		return (int)$total_count;
608
+		return (int) $total_count;
609 609
 	}
610 610
 
611 611
 	/**
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 	function getDocumentCountByGroupStatus($search_obj = NULL)
617 617
 	{
618 618
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
619
-		if(!$output->toBool()) return array();
619
+		if (!$output->toBool()) return array();
620 620
 
621 621
 		return $output->data;
622 622
 	}
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		$output = executeQuery('document.getDocumentExtraVarsCount', $args);
636 636
 		// Return total number of
637 637
 		$total_count = $output->data->count;
638
-		return (int)$total_count;
638
+		return (int) $total_count;
639 639
 	}
640 640
 
641 641
 	/**
@@ -652,29 +652,29 @@  discard block
 block discarded – undo
652 652
 
653 653
 		$this->_setSearchOption($opt, $args, $query_id, $use_division);
654 654
 
655
-		if($sort_check->isExtraVars)
655
+		if ($sort_check->isExtraVars)
656 656
 		{
657 657
 			return 1;
658 658
 		}
659 659
 		else
660 660
 		{
661
-			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
661
+			if ($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
662 662
 			{
663
-				if($args->order_type === 'desc')
663
+				if ($args->order_type === 'desc')
664 664
 				{
665
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
665
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
666 666
 				}
667 667
 				else
668 668
 				{
669 669
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
670 670
 				}
671 671
 			}
672
-			elseif($sort_check->sort_index === 'regdate')
672
+			elseif ($sort_check->sort_index === 'regdate')
673 673
 			{
674 674
 
675
-				if($args->order_type === 'asc')
675
+				if ($args->order_type === 'asc')
676 676
 				{
677
-					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
677
+					$args->{'rev_'.$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
678 678
 				}
679 679
 				else
680 680
 				{
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
 		}
690 690
 
691 691
 		// Guhanhu total number of the article search page
692
-		$output = executeQuery($query_id . 'Page', $args);
692
+		$output = executeQuery($query_id.'Page', $args);
693 693
 		$count = $output->data->count;
694
-		$page = (int)(($count-1)/$opt->list_count)+1;
694
+		$page = (int) (($count - 1) / $opt->list_count) + 1;
695 695
 		return $page;
696 696
 	}
697 697
 
@@ -703,16 +703,16 @@  discard block
 block discarded – undo
703 703
 	 */
704 704
 	function getCategory($category_srl, $columnList = array())
705 705
 	{
706
-		$args =new stdClass();
706
+		$args = new stdClass();
707 707
 		$args->category_srl = $category_srl;
708 708
 		$output = executeQuery('document.getCategory', $args, $columnList);
709 709
 
710 710
 		$node = $output->data;
711
-		if(!$node) return;
711
+		if (!$node) return;
712 712
 
713
-		if($node->group_srls)
713
+		if ($node->group_srls)
714 714
 		{
715
-			$group_srls = explode(',',$node->group_srls);
715
+			$group_srls = explode(',', $node->group_srls);
716 716
 			unset($node->group_srls);
717 717
 			$node->group_srls = $group_srls;
718 718
 		}
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
 	{
734 734
 		$args = new stdClass();
735 735
 		$args->category_srl = $category_srl;
736
-		$output = executeQuery('document.getChildCategoryCount',$args);
737
-		if($output->data->count > 0) return true;
736
+		$output = executeQuery('document.getChildCategoryCount', $args);
737
+		if ($output->data->count > 0) return true;
738 738
 		return false;
739 739
 	}
740 740
 
@@ -750,10 +750,10 @@  discard block
 block discarded – undo
750 750
 		// Category of the target module file swollen
751 751
 		$filename = sprintf("%sfiles/cache/document_category/%s.php", _XE_PATH_, $module_srl);
752 752
 		// If the target file to the cache file regeneration category
753
-		if(!file_exists($filename))
753
+		if (!file_exists($filename))
754 754
 		{
755 755
 			$oDocumentController = getController('document');
756
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
756
+			if (!$oDocumentController->makeCategoryFile($module_srl)) return array();
757 757
 		}
758 758
 
759 759
 		include($filename);
@@ -773,10 +773,10 @@  discard block
 block discarded – undo
773 773
 	 */
774 774
 	function _arrangeCategory(&$document_category, $list, $depth)
775 775
 	{
776
-		if(!count($list)) return;
776
+		if (!count($list)) return;
777 777
 		$idx = 0;
778 778
 		$list_order = array();
779
-		foreach($list as $key => $val)
779
+		foreach ($list as $key => $val)
780 780
 		{
781 781
 			$obj = new stdClass;
782 782
 			$obj->mid = $val['mid'];
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			$obj->parent_srl = $val['parent_srl'];
786 786
 			$obj->title = $obj->text = $val['text'];
787 787
 			$obj->description = $val['description'];
788
-			$obj->expand = $val['expand']=='Y'?true:false;
788
+			$obj->expand = $val['expand'] == 'Y' ?true:false;
789 789
 			$obj->color = $val['color'];
790 790
 			$obj->document_count = $val['document_count'];
791 791
 			$obj->depth = $depth;
@@ -793,26 +793,26 @@  discard block
 block discarded – undo
793 793
 			$obj->childs = array();
794 794
 			$obj->grant = $val['grant'];
795 795
 
796
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
796
+			if (Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
797 797
 			else $selected = false;
798 798
 
799 799
 			$obj->selected = $selected;
800 800
 
801 801
 			$list_order[$idx++] = $obj->category_srl;
802 802
 			// If you have a parent category of child nodes apply data
803
-			if($obj->parent_srl)
803
+			if ($obj->parent_srl)
804 804
 			{
805 805
 				$parent_srl = $obj->parent_srl;
806 806
 				$document_count = $obj->document_count;
807 807
 				$expand = $obj->expand;
808
-				if($selected) $expand = true;
808
+				if ($selected) $expand = true;
809 809
 
810
-				while($parent_srl)
810
+				while ($parent_srl)
811 811
 				{
812 812
 					$document_category[$parent_srl]->document_count += $document_count;
813 813
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
814 814
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
815
-					if($expand) $document_category[$parent_srl]->expand = $expand;
815
+					if ($expand) $document_category[$parent_srl]->expand = $expand;
816 816
 
817 817
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
818 818
 				}
@@ -820,10 +820,10 @@  discard block
 block discarded – undo
820 820
 
821 821
 			$document_category[$key] = $obj;
822 822
 
823
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
823
+			if (count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth + 1);
824 824
 		}
825 825
 		$document_category[$list_order[0]]->first = true;
826
-		$document_category[$list_order[count($list_order)-1]]->last = true;
826
+		$document_category[$list_order[count($list_order) - 1]]->last = true;
827 827
 	}
828 828
 
829 829
 	/**
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		$args->module_srl = $module_srl;
839 839
 		$args->category_srl = $category_srl;
840 840
 		$output = executeQuery('document.getCategoryDocumentCount', $args);
841
-		return (int)$output->data->count;
841
+		return (int) $output->data->count;
842 842
 	}
843 843
 
844 844
 	/**
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	 */
849 849
 	function getCategoryXmlFile($module_srl)
850 850
 	{
851
-		$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
852
-		if(!file_exists($xml_file))
851
+		$xml_file = sprintf('files/cache/document_category/%s.xml.php', $module_srl);
852
+		if (!file_exists($xml_file))
853 853
 		{
854 854
 			$oDocumentController = getController('document');
855 855
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 	 */
865 865
 	function getCategoryPhpFile($module_srl)
866 866
 	{
867
-		$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
868
-		if(!file_exists($php_file))
867
+		$php_file = sprintf('files/cache/document_category/%s.php', $module_srl);
868
+		if (!file_exists($php_file))
869 869
 		{
870 870
 			$oDocumentController = getController('document');
871 871
 			$oDocumentController->makeCategoryFile($module_srl);
@@ -880,7 +880,7 @@  discard block
 block discarded – undo
880 880
 	 */
881 881
 	function getMonthlyArchivedList($obj)
882 882
 	{
883
-		if($obj->mid)
883
+		if ($obj->mid)
884 884
 		{
885 885
 			$oModuleModel = getModel('module');
886 886
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -888,13 +888,13 @@  discard block
 block discarded – undo
888 888
 		}
889 889
 		// Module_srl passed the array may be a check whether the array
890 890
 		$args = new stdClass;
891
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
891
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
892 892
 		else $args->module_srl = $obj->module_srl;
893 893
 
894 894
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
895
-		if(!$output->toBool()||!$output->data) return $output;
895
+		if (!$output->toBool() || !$output->data) return $output;
896 896
 
897
-		if(!is_array($output->data)) $output->data = array($output->data);
897
+		if (!is_array($output->data)) $output->data = array($output->data);
898 898
 
899 899
 		return $output;
900 900
 	}
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 	 */
907 907
 	function getDailyArchivedList($obj)
908 908
 	{
909
-		if($obj->mid)
909
+		if ($obj->mid)
910 910
 		{
911 911
 			$oModuleModel = getModel('module');
912 912
 			$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -914,14 +914,14 @@  discard block
 block discarded – undo
914 914
 		}
915 915
 		// Module_srl passed the array may be a check whether the array
916 916
 		$args = new stdClass;
917
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
917
+		if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
918 918
 		else $args->module_srl = $obj->module_srl;
919 919
 		$args->regdate = $obj->regdate;
920 920
 
921 921
 		$output = executeQuery('document.getDailyArchivedList', $args);
922
-		if(!$output->toBool()) return $output;
922
+		if (!$output->toBool()) return $output;
923 923
 
924
-		if(!is_array($output->data)) $output->data = array($output->data);
924
+		if (!is_array($output->data)) $output->data = array($output->data);
925 925
 
926 926
 		return $output;
927 927
 	}
@@ -932,17 +932,17 @@  discard block
 block discarded – undo
932 932
 	 */
933 933
 	function getDocumentCategories()
934 934
 	{
935
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
935
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
936 936
 		$module_srl = Context::get('module_srl');
937
-		$categories= $this->getCategoryList($module_srl);
937
+		$categories = $this->getCategoryList($module_srl);
938 938
 		$lang = Context::get('lang');
939 939
 		// No additional category
940 940
 		$output = "0,0,{$lang->none_category}\n";
941
-		if($categories)
941
+		if ($categories)
942 942
 		{
943
-			foreach($categories as $category_srl => $category)
943
+			foreach ($categories as $category_srl => $category)
944 944
 			{
945
-				$output .= sprintf("%d,%d,%s\n",$category_srl, $category->depth,$category->title);
945
+				$output .= sprintf("%d,%d,%s\n", $category_srl, $category->depth, $category->title);
946 946
 			}
947 947
 		}
948 948
 		$this->add('categories', $output);
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 	 */
955 955
 	function getDocumentConfig()
956 956
 	{
957
-		if($this->documentConfig === NULL)
957
+		if ($this->documentConfig === NULL)
958 958
 		{
959 959
 			$oModuleModel = getModel('module');
960 960
 			$config = $oModuleModel->getModuleConfig('document');
@@ -1027,11 +1027,11 @@  discard block
 block discarded – undo
1027 1027
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1028 1028
 		// Check permissions
1029 1029
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1030
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1030
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1031 1031
 
1032 1032
 		$category_srl = Context::get('category_srl');
1033 1033
 		$category_info = $this->getCategory($category_srl);
1034
-		if(!$category_info)
1034
+		if (!$category_info)
1035 1035
 		{
1036 1036
 			return new BaseObject(-1, 'msg_invalid_request');
1037 1037
 		}
@@ -1047,14 +1047,14 @@  discard block
 block discarded – undo
1047 1047
 	 */
1048 1048
 	function getDocumentSrlByAlias($mid, $alias)
1049 1049
 	{
1050
-		if(!$mid || !$alias) return null;
1050
+		if (!$mid || !$alias) return null;
1051 1051
 		$site_module_info = Context::get('site_module_info');
1052 1052
 		$args = new stdClass;
1053 1053
 		$args->mid = $mid;
1054 1054
 		$args->alias_title = $alias;
1055 1055
 		$args->site_srl = $site_module_info->site_srl;
1056 1056
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1057
-		if(!$output->data) return null;
1057
+		if (!$output->data) return null;
1058 1058
 		else return $output->data->document_srl;
1059 1059
 	}
1060 1060
 
@@ -1066,15 +1066,15 @@  discard block
 block discarded – undo
1066 1066
 	 */
1067 1067
 	function getDocumentSrlByTitle($module_srl, $title)
1068 1068
 	{
1069
-		if(!$module_srl || !$title) return null;
1069
+		if (!$module_srl || !$title) return null;
1070 1070
 		$args = new stdClass;
1071 1071
 		$args->module_srl = $module_srl;
1072 1072
 		$args->title = $title;
1073 1073
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1074
-		if(!$output->data) return null;
1074
+		if (!$output->data) return null;
1075 1075
 		else
1076 1076
 		{
1077
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1077
+			if (is_array($output->data)) return $output->data[0]->document_srl;
1078 1078
 			return $output->data->document_srl;
1079 1079
 		}
1080 1080
 	}
@@ -1086,12 +1086,12 @@  discard block
 block discarded – undo
1086 1086
 	 */
1087 1087
 	function getAlias($document_srl)
1088 1088
 	{
1089
-		if(!$document_srl) return null;
1089
+		if (!$document_srl) return null;
1090 1090
 		$args = new stdClass;
1091 1091
 		$args->document_srl = $document_srl;
1092 1092
 		$output = executeQueryArray('document.getAliases', $args);
1093 1093
 
1094
-		if(!$output->data) return null;
1094
+		if (!$output->data) return null;
1095 1095
 		else return $output->data[0]->alias_title;
1096 1096
 	}
1097 1097
 
@@ -1134,32 +1134,32 @@  discard block
 block discarded – undo
1134 1134
 	{
1135 1135
 		// Variable check
1136 1136
 		$args = new stdClass;
1137
-		$args->category_srl = $obj->category_srl?$obj->category_srl:null;
1137
+		$args->category_srl = $obj->category_srl ? $obj->category_srl : null;
1138 1138
 		$args->sort_index = $obj->sort_index;
1139
-		$args->order_type = $obj->order_type?$obj->order_type:'desc';
1140
-		$args->page = $obj->page?$obj->page:1;
1141
-		$args->list_count = $obj->list_count?$obj->list_count:20;
1142
-		$args->page_count = $obj->page_count?$obj->page_count:10;
1139
+		$args->order_type = $obj->order_type ? $obj->order_type : 'desc';
1140
+		$args->page = $obj->page ? $obj->page : 1;
1141
+		$args->list_count = $obj->list_count ? $obj->list_count : 20;
1142
+		$args->page_count = $obj->page_count ? $obj->page_count : 10;
1143 1143
 		// Search options
1144 1144
 		$search_target = $obj->search_target;
1145 1145
 		$search_keyword = $obj->search_keyword;
1146
-		if($search_target && $search_keyword)
1146
+		if ($search_target && $search_keyword)
1147 1147
 		{
1148
-			switch($search_target)
1148
+			switch ($search_target)
1149 1149
 			{
1150 1150
 				case 'title' :
1151 1151
 				case 'content' :
1152
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1152
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1153 1153
 					$args->{"s_".$search_target} = $search_keyword;
1154 1154
 					$use_division = true;
1155 1155
 					break;
1156 1156
 				case 'title_content' :
1157
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1157
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1158 1158
 					$args->s_title = $search_keyword;
1159 1159
 					$args->s_content = $search_keyword;
1160 1160
 					break;
1161 1161
 				case 'user_id' :
1162
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1162
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1163 1163
 					$args->s_user_id = $search_keyword;
1164 1164
 					$args->sort_index = 'documents.'.$args->sort_index;
1165 1165
 					break;
@@ -1167,13 +1167,13 @@  discard block
 block discarded – undo
1167 1167
 				case 'nick_name' :
1168 1168
 				case 'email_address' :
1169 1169
 				case 'homepage' :
1170
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1170
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1171 1171
 					$args->{"s_".$search_target} = $search_keyword;
1172 1172
 					break;
1173 1173
 				case 'is_notice' :
1174 1174
 				case 'is_secret' :
1175
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1176
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1175
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1176
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1177 1177
 					break;
1178 1178
 				case 'member_srl' :
1179 1179
 				case 'readed_count' :
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 				case 'comment_count' :
1183 1183
 				case 'trackback_count' :
1184 1184
 				case 'uploaded_count' :
1185
-					$args->{"s_".$search_target} = (int)$search_keyword;
1185
+					$args->{"s_".$search_target} = (int) $search_keyword;
1186 1186
 					break;
1187 1187
 				case 'regdate' :
1188 1188
 				case 'last_update' :
@@ -1194,9 +1194,9 @@  discard block
 block discarded – undo
1194 1194
 		}
1195 1195
 
1196 1196
 		$output = executeQueryArray('document.getTrashList', $args);
1197
-		if($output->data)
1197
+		if ($output->data)
1198 1198
 		{
1199
-			foreach($output->data as $key => $attribute)
1199
+			foreach ($output->data as $key => $attribute)
1200 1200
 			{
1201 1201
 				$oDocument = null;
1202 1202
 				$oDocument = new documentItem();
@@ -1215,46 +1215,46 @@  discard block
 block discarded – undo
1215 1215
 	{
1216 1216
 		$args = new stdClass;
1217 1217
 		$document_srl = Context::get('document_srl');
1218
-		if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1218
+		if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
1219 1219
 
1220 1220
 		$point = Context::get('point');
1221
-		if($point != -1) $point = 1;
1221
+		if ($point != -1) $point = 1;
1222 1222
 
1223 1223
 		$oDocumentModel = getModel('document');
1224 1224
 		$columnList = array('document_srl', 'module_srl');
1225 1225
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1226 1226
 		$module_srl = $oDocument->get('module_srl');
1227
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1227
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1228 1228
 
1229 1229
 		$oModuleModel = getModel('module');
1230
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1231
-		if($point == -1)
1230
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
1231
+		if ($point == -1)
1232 1232
 		{
1233
-			if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1233
+			if ($document_config->use_vote_down != 'S') return new BaseObject(-1, 'msg_invalid_request');
1234 1234
 			$args->below_point = 0;
1235 1235
 		}
1236 1236
 		else
1237 1237
 		{
1238
-			if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1238
+			if ($document_config->use_vote_up != 'S') return new BaseObject(-1, 'msg_invalid_request');
1239 1239
 			$args->more_point = 0;
1240 1240
 		}
1241 1241
 
1242 1242
 		$args->document_srl = $document_srl;
1243 1243
 
1244
-		$output = executeQueryArray('document.getVotedMemberList',$args);
1245
-		if(!$output->toBool()) return $output;
1244
+		$output = executeQueryArray('document.getVotedMemberList', $args);
1245
+		if (!$output->toBool()) return $output;
1246 1246
 
1247 1247
 		$oMemberModel = getModel('member');
1248
-		if($output->data)
1248
+		if ($output->data)
1249 1249
 		{
1250
-			foreach($output->data as $k => $d)
1250
+			foreach ($output->data as $k => $d)
1251 1251
 			{
1252 1252
 				$profile_image = $oMemberModel->getProfileImage($d->member_srl);
1253 1253
 				$output->data[$k]->src = $profile_image->src;
1254 1254
 			}
1255 1255
 		}
1256 1256
 
1257
-		$this->add('voted_member_list',$output->data);
1257
+		$this->add('voted_member_list', $output->data);
1258 1258
 	}
1259 1259
 
1260 1260
 	/**
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	function getStatusNameList()
1265 1265
 	{
1266 1266
 		global $lang;
1267
-		if(!isset($lang->status_name_list))
1267
+		if (!isset($lang->status_name_list))
1268 1268
 			return array_flip($this->getStatusList());
1269 1269
 		else return $lang->status_name_list;
1270 1270
 	}
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 	{
1280 1280
 		$sortIndex = $obj->sort_index;
1281 1281
 		$isExtraVars = false;
1282
-		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')))
1282
+		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')))
1283 1283
 		{
1284 1284
 			// get module_srl extra_vars list
1285 1285
 			if ($load_extra_vars)
@@ -1294,11 +1294,11 @@  discard block
 block discarded – undo
1294 1294
 				else
1295 1295
 				{
1296 1296
 					$check_array = array();
1297
-					foreach($extra_output->data as $val)
1297
+					foreach ($extra_output->data as $val)
1298 1298
 					{
1299 1299
 						$check_array[] = $val->eid;
1300 1300
 					}
1301
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1301
+					if (!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1302 1302
 					else $isExtraVars = true;
1303 1303
 				}
1304 1304
 			}
@@ -1326,13 +1326,13 @@  discard block
 block discarded – undo
1326 1326
 	{
1327 1327
 		// Variable check
1328 1328
 		$args = new stdClass();
1329
-		$args->category_srl = $searchOpt->category_srl?$searchOpt->category_srl:null;
1329
+		$args->category_srl = $searchOpt->category_srl ? $searchOpt->category_srl : null;
1330 1330
 		$args->order_type = $searchOpt->order_type;
1331
-		$args->page = $searchOpt->page?$searchOpt->page:1;
1332
-		$args->list_count = $searchOpt->list_count?$searchOpt->list_count:20;
1333
-		$args->page_count = $searchOpt->page_count?$searchOpt->page_count:10;
1334
-		$args->start_date = $searchOpt->start_date?$searchOpt->start_date:null;
1335
-		$args->end_date = $searchOpt->end_date?$searchOpt->end_date:null;
1331
+		$args->page = $searchOpt->page ? $searchOpt->page : 1;
1332
+		$args->list_count = $searchOpt->list_count ? $searchOpt->list_count : 20;
1333
+		$args->page_count = $searchOpt->page_count ? $searchOpt->page_count : 10;
1334
+		$args->start_date = $searchOpt->start_date ? $searchOpt->start_date : null;
1335
+		$args->end_date = $searchOpt->end_date ? $searchOpt->end_date : null;
1336 1336
 		$args->member_srl = $searchOpt->member_srl;
1337 1337
 		$args->member_srls = $searchOpt->member_srls;
1338 1338
 
@@ -1342,10 +1342,10 @@  discard block
 block discarded – undo
1342 1342
 
1343 1343
 		// Check the target and sequence alignment
1344 1344
 		$orderType = array('desc' => 1, 'asc' => 1);
1345
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1345
+		if (!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1346 1346
 
1347 1347
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1348
-		if($searchOpt->mid)
1348
+		if ($searchOpt->mid)
1349 1349
 		{
1350 1350
 			$oModuleModel = getModel('module');
1351 1351
 			$args->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
@@ -1353,30 +1353,30 @@  discard block
 block discarded – undo
1353 1353
 		}
1354 1354
 
1355 1355
 		// Module_srl passed the array may be a check whether the array
1356
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1356
+		if (is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1357 1357
 		else $args->module_srl = $searchOpt->module_srl;
1358 1358
 
1359 1359
 		// Except for the test module_srl
1360
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1360
+		if (is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1361 1361
 		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1362 1362
 
1363 1363
 		// only admin document list, temp document showing
1364
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1364
+		if ($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1365 1365
 		else
1366 1366
 		{
1367
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1367
+			if ($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1368 1368
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1369 1369
 			else
1370 1370
 				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1371 1371
 		}
1372 1372
 
1373 1373
 		// Category is selected, further sub-categories until all conditions
1374
-		if($args->category_srl)
1374
+		if ($args->category_srl)
1375 1375
 		{
1376 1376
 			$category_list = $this->getCategoryList($args->module_srl);
1377 1377
 			$category_info = $category_list[$args->category_srl];
1378 1378
 			$category_info->childs[] = $args->category_srl;
1379
-			$args->category_srl = implode(',',$category_info->childs);
1379
+			$args->category_srl = implode(',', $category_info->childs);
1380 1380
 		}
1381 1381
 
1382 1382
 		// Used to specify the default query id (based on several search options to query id modified)
@@ -1389,24 +1389,24 @@  discard block
 block discarded – undo
1389 1389
 		$search_target = $searchOpt->search_target;
1390 1390
 		$search_keyword = $searchOpt->search_keyword;
1391 1391
 
1392
-		if($search_target && $search_keyword)
1392
+		if ($search_target && $search_keyword)
1393 1393
 		{
1394
-			switch($search_target)
1394
+			switch ($search_target)
1395 1395
 			{
1396 1396
 				case 'title' :
1397 1397
 				case 'content' :
1398
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1398
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1399 1399
 					$args->{"s_".$search_target} = $search_keyword;
1400 1400
 					$use_division = true;
1401 1401
 					break;
1402 1402
 				case 'title_content' :
1403
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1403
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1404 1404
 					$args->s_title = $search_keyword;
1405 1405
 					$args->s_content = $search_keyword;
1406 1406
 					$use_division = true;
1407 1407
 					break;
1408 1408
 				case 'user_id' :
1409
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1409
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1410 1410
 					$args->s_user_id = $search_keyword;
1411 1411
 					$args->sort_index = 'documents.'.$args->sort_index;
1412 1412
 					break;
@@ -1414,18 +1414,18 @@  discard block
 block discarded – undo
1414 1414
 				case 'nick_name' :
1415 1415
 				case 'email_address' :
1416 1416
 				case 'homepage' :
1417
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1417
+					if ($search_keyword) $search_keyword = str_replace(' ', '%', $search_keyword);
1418 1418
 					$args->{"s_".$search_target} = $search_keyword;
1419 1419
 					break;
1420 1420
 				case 'is_notice' :
1421
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1422
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1421
+					if ($search_keyword == 'N') $args->{"s_".$search_target} = 'N';
1422
+					elseif ($search_keyword == 'Y') $args->{"s_".$search_target} = 'Y';
1423 1423
 					else $args->{"s_".$search_target} = '';
1424 1424
 					break;
1425 1425
 				case 'is_secret' :
1426
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1427
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1428
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1426
+					if ($search_keyword == 'N') $args->statusList = array($this->getConfigStatus('public'));
1427
+					elseif ($search_keyword == 'Y') $args->statusList = array($this->getConfigStatus('secret'));
1428
+					elseif ($search_keyword == 'temp') $args->statusList = array($this->getConfigStatus('temp'));
1429 1429
 					break;
1430 1430
 				case 'member_srl' :
1431 1431
 				case 'readed_count' :
@@ -1433,17 +1433,17 @@  discard block
 block discarded – undo
1433 1433
 				case 'comment_count' :
1434 1434
 				case 'trackback_count' :
1435 1435
 				case 'uploaded_count' :
1436
-					$args->{"s_".$search_target} = (int)$search_keyword;
1436
+					$args->{"s_".$search_target} = (int) $search_keyword;
1437 1437
 					break;
1438 1438
 				case 'member_srls' :
1439
-					$args->{"s_".$search_target} = (int)$search_keyword;
1439
+					$args->{"s_".$search_target} = (int) $search_keyword;
1440 1440
 
1441
-					if($logged_info->member_srl)
1441
+					if ($logged_info->member_srl)
1442 1442
 					{
1443 1443
 						$srls = explode(',', $search_keyword);
1444
-						foreach($srls as $srl)
1444
+						foreach ($srls as $srl)
1445 1445
 						{
1446
-							if(abs($srl) != $logged_info->member_srl)
1446
+							if (abs($srl) != $logged_info->member_srl)
1447 1447
 							{
1448 1448
 								break; // foreach
1449 1449
 							}
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 					}
1455 1455
 					break;
1456 1456
 				case 'blamed_count' :
1457
-					$args->{"s_".$search_target} = (int)$search_keyword * -1;
1457
+					$args->{"s_".$search_target} = (int) $search_keyword * -1;
1458 1458
 					break;
1459 1459
 				case 'regdate' :
1460 1460
 				case 'last_update' :
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 					$use_division = true;
1468 1468
 					break;
1469 1469
 				case 'tag' :
1470
-					$args->s_tags = str_replace(' ','%',$search_keyword);
1470
+					$args->s_tags = str_replace(' ', '%', $search_keyword);
1471 1471
 					$query_id = 'document.getDocumentListWithinTag';
1472 1472
 					break;
1473 1473
 				case 'extra_vars':
@@ -1475,9 +1475,9 @@  discard block
 block discarded – undo
1475 1475
 					$query_id = 'document.getDocumentListWithinExtraVars';
1476 1476
 					break;
1477 1477
 				default :
1478
-					if(strpos($search_target,'extra_vars')!==false) {
1478
+					if (strpos($search_target, 'extra_vars') !== false) {
1479 1479
 						$args->var_idx = substr($search_target, strlen('extra_vars'));
1480
-						$args->var_value = str_replace(' ','%',$search_keyword);
1480
+						$args->var_value = str_replace(' ', '%', $search_keyword);
1481 1481
 						$args->sort_index = 'documents.'.$args->sort_index;
1482 1482
 						$query_id = 'document.getDocumentListWithExtraVars';
1483 1483
 					}
@@ -1494,18 +1494,18 @@  discard block
 block discarded – undo
1494 1494
 			/**
1495 1495
 			 * list_order asc sort of division that can be used only when
1496 1496
 			 */
1497
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1497
+			if ($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1498 1498
 
1499 1499
 			/**
1500 1500
 			 * If it is true, use_division changed to use the document division
1501 1501
 			 */
1502
-			if($use_division)
1502
+			if ($use_division)
1503 1503
 			{
1504 1504
 				// Division begins
1505
-				$division = (int)Context::get('division');
1505
+				$division = (int) Context::get('division');
1506 1506
 
1507 1507
 				// order by list_order and (module_srl===0 or module_srl may count), therefore case table full scan
1508
-				if($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1508
+				if ($args->sort_index == 'list_order' && ($args->exclude_module_srl === '0' || count(explode(',', $args->module_srl)) > 5))
1509 1509
 				{
1510 1510
 					$listSqlID = 'document.getDocumentListUseIndex';
1511 1511
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
@@ -1517,7 +1517,7 @@  discard block
 block discarded – undo
1517 1517
 				}
1518 1518
 
1519 1519
 				// If you do not value the best division top
1520
-				if(!$division)
1520
+				if (!$division)
1521 1521
 				{
1522 1522
 					$division_args = new stdClass();
1523 1523
 					$division_args->module_srl = $args->module_srl;
@@ -1528,7 +1528,7 @@  discard block
 block discarded – undo
1528 1528
 					$division_args->statusList = $args->statusList;
1529 1529
 
1530 1530
 					$output = executeQuery($divisionSqlID, $division_args, array('list_order'));
1531
-					if($output->data)
1531
+					if ($output->data)
1532 1532
 					{
1533 1533
 						$item = array_pop($output->data);
1534 1534
 						$division = $item->list_order;
@@ -1537,10 +1537,10 @@  discard block
 block discarded – undo
1537 1537
 				}
1538 1538
 
1539 1539
 				// The last division
1540
-				$last_division = (int)Context::get('last_division');
1540
+				$last_division = (int) Context::get('last_division');
1541 1541
 
1542 1542
 				// Division after division from the 5000 value of the specified Wanted
1543
-				if(!$last_division)
1543
+				if (!$last_division)
1544 1544
 				{
1545 1545
 					$last_division_args = new stdClass();
1546 1546
 					$last_division_args->module_srl = $args->module_srl;
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
 					$last_division_args->page = 5001;
1553 1553
 
1554 1554
 					$output = executeQuery($divisionSqlID, $last_division_args, array('list_order'));
1555
-					if($output->data)
1555
+					if ($output->data)
1556 1556
 					{
1557 1557
 						$item = array_pop($output->data);
1558 1558
 						$last_division = $item->list_order;
@@ -1560,14 +1560,14 @@  discard block
 block discarded – undo
1560 1560
 				}
1561 1561
 
1562 1562
 				// Make sure that after last_division article
1563
-				if($last_division)
1563
+				if ($last_division)
1564 1564
 				{
1565 1565
 					$last_division_args = new stdClass();
1566 1566
 					$last_division_args->module_srl = $args->module_srl;
1567 1567
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1568 1568
 					$last_division_args->list_order = $last_division;
1569 1569
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1570
-					if($output->data->count<1) $last_division = null;
1570
+					if ($output->data->count < 1) $last_division = null;
1571 1571
 				}
1572 1572
 
1573 1573
 				$args->division = $division;
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
 	 * @param int $count
1601 1601
 	 * @return object
1602 1602
 	 */
1603
-	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0 )
1603
+	function getDocumentListByMemberSrl($member_srl, $columnList = array(), $page = 0, $is_admin = FALSE, $count = 0)
1604 1604
 	{
1605 1605
 		$args = new stdClass();
1606 1606
 		$args->member_srl = $member_srl;
@@ -1608,8 +1608,8 @@  discard block
 block discarded – undo
1608 1608
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1609 1609
 		$document_list = $output->data;
1610 1610
 
1611
-		if(!$document_list) return array();
1612
-		if(!is_array($document_list)) $document_list = array($document_list);
1611
+		if (!$document_list) return array();
1612
+		if (!is_array($document_list)) $document_list = array($document_list);
1613 1613
 
1614 1614
 		return $document_list;
1615 1615
 	}
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 	function getDocumentExtraImagePath()
1622 1622
 	{
1623 1623
 		$documentConfig = getModel('document')->getDocumentConfig();
1624
-		if(Mobile::isFromMobilePhone())
1624
+		if (Mobile::isFromMobilePhone())
1625 1625
 		{
1626 1626
 			$iconSkin = $documentConfig->micons;
1627 1627
 		}
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
 		{
1630 1630
 			$iconSkin = $documentConfig->icons;
1631 1631
 		}
1632
-		$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
1632
+		$path = sprintf('%s%s', getUrl(), "modules/document/tpl/icons/$iconSkin/");
1633 1633
 
1634 1634
 		return $path;
1635 1635
 	}
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
 			// static 데이터를 갱신해주기 위해 들어간 코드같으나 어차피 언어 변경 자체는 페이지 전환이 일어나면서 발생하는게 대부분이라 효용이 없음. 또한 예기치않게 권한이 없는 다국어 문서 내용을 보여주는 부효과가 일어남		
121 142
 			/*		
@@ -139,7 +160,9 @@  discard block
 block discarded – undo
139 160
 	 */
140 161
 	function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array())
141 162
 	{
142
-		if(!$document_srl) return new documentItem();
163
+		if(!$document_srl) {
164
+			return new documentItem();
165
+		}
143 166
 
144 167
 		if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
145 168
 		{
@@ -149,9 +172,13 @@  discard block
 block discarded – undo
149 172
 				return $oDocument;
150 173
 			}
151 174
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
152
-			if($load_extra_vars) $this->setToAllDocumentExtraVars();
175
+			if($load_extra_vars) {
176
+				$this->setToAllDocumentExtraVars();
177
+			}
178
+		}
179
+		if($is_admin) {
180
+			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
153 181
 		}
154
-		if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
155 182
 
156 183
 		return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
157 184
 	}
@@ -170,8 +197,7 @@  discard block
 block discarded – undo
170 197
 		{
171 198
 			$list_count = count($document_srls);
172 199
 			$document_srls = implode(',',$document_srls);
173
-		}
174
-		else
200
+		} else
175 201
 		{
176 202
 			$list_count = 1;
177 203
 		}
@@ -182,28 +208,38 @@  discard block
 block discarded – undo
182 208
 
183 209
 		$output = executeQuery('document.getDocuments', $args, $columnList);
184 210
 		$document_list = $output->data;
185
-		if(!$document_list) return;
186
-		if(!is_array($document_list)) $document_list = array($document_list);
211
+		if(!$document_list) {
212
+			return;
213
+		}
214
+		if(!is_array($document_list)) {
215
+			$document_list = array($document_list);
216
+		}
187 217
 
188 218
 		$document_count = count($document_list);
189 219
 		foreach($document_list as $key => $attribute)
190 220
 		{
191 221
 			$document_srl = $attribute->document_srl;
192
-			if(!$document_srl) continue;
222
+			if(!$document_srl) {
223
+				continue;
224
+			}
193 225
 
194 226
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
195 227
 			{
196 228
 				$oDocument = null;
197 229
 				$oDocument = new documentItem();
198 230
 				$oDocument->setAttribute($attribute, false);
199
-				if($is_admin) $oDocument->setGrant();
231
+				if($is_admin) {
232
+					$oDocument->setGrant();
233
+				}
200 234
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
201 235
 			}
202 236
 
203 237
 			$result[$attribute->document_srl] = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
204 238
 		}
205 239
 
206
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
240
+		if($load_extra_vars) {
241
+			$this->setToAllDocumentExtraVars();
242
+		}
207 243
 
208 244
 		$output = null;
209 245
 		if(count($result))
@@ -251,18 +287,15 @@  discard block
 block discarded – undo
251 287
 		{
252 288
 			$output = $obj->use_alternate_output;
253 289
 			unset($obj->use_alternate_output);
254
-		}
255
-		elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
290
+		} elseif ($sort_check->isExtraVars && substr_count($obj->search_target,'extra_vars'))
256 291
 		{
257 292
 			$query_id = 'document.getDocumentListWithinExtraVarsExtraSort';
258 293
 			$args->sort_index = str_replace('documents.','',$args->sort_index);
259 294
 			$output = executeQueryArray($query_id, $args);
260
-		}
261
-		elseif ($sort_check->isExtraVars)
295
+		} elseif ($sort_check->isExtraVars)
262 296
 		{
263 297
 			$output = executeQueryArray($query_id, $args);
264
-		}
265
-		else
298
+		} else
266 299
 		{
267 300
 			// document.getDocumentList query execution
268 301
 			// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
@@ -272,11 +305,15 @@  discard block
 block discarded – undo
272 305
 				$group_args = clone($args);
273 306
 				$group_args->sort_index = 'documents.'.$args->sort_index;
274 307
 				$output = executeQueryArray($query_id, $group_args);
275
-				if(!$output->toBool()||!count($output->data)) return $output;
308
+				if(!$output->toBool()||!count($output->data)) {
309
+					return $output;
310
+				}
276 311
 
277 312
 				foreach($output->data as $key => $val)
278 313
 				{
279
-					if($val->document_srl) $target_srls[] = $val->document_srl;
314
+					if($val->document_srl) {
315
+						$target_srls[] = $val->document_srl;
316
+					}
280 317
 				}
281 318
 
282 319
 				$page_navigation = $output->page_navigation;
@@ -294,14 +331,15 @@  discard block
 block discarded – undo
294 331
 				$output->total_count = $page_navigation->total_count;
295 332
 				$output->total_page = $page_navigation->total_page;
296 333
 				$output->page = $page_navigation->cur_page;
297
-			}
298
-			else
334
+			} else
299 335
 			{
300 336
 				$output = executeQueryArray($query_id, $args, $columnList);
301 337
 			}
302 338
 		}
303 339
 		// Return if no result or an error occurs
304
-		if(!$output->toBool()||!count($output->data)) return $output;
340
+		if(!$output->toBool()||!count($output->data)) {
341
+			return $output;
342
+		}
305 343
 		$idx = 0;
306 344
 		$data = $output->data;
307 345
 		unset($output->data);
@@ -316,20 +354,26 @@  discard block
 block discarded – undo
316 354
 		{
317 355
 			foreach($data as $key => $attribute)
318 356
 			{
319
-				if($attribute->is_notice == 'Y') $virtual_number --;
357
+				if($attribute->is_notice == 'Y') {
358
+					$virtual_number --;
359
+				}
320 360
 			}
321 361
 		}
322 362
 
323 363
 		foreach($data as $key => $attribute)
324 364
 		{
325
-			if($except_notice && $attribute->is_notice == 'Y') continue;
365
+			if($except_notice && $attribute->is_notice == 'Y') {
366
+				continue;
367
+			}
326 368
 			$document_srl = $attribute->document_srl;
327 369
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
328 370
 			{
329 371
 				$oDocument = null;
330 372
 				$oDocument = new documentItem();
331 373
 				$oDocument->setAttribute($attribute, false);
332
-				if($is_admin) $oDocument->setGrant();
374
+				if($is_admin) {
375
+					$oDocument->setGrant();
376
+				}
333 377
 				$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
334 378
 			}
335 379
 
@@ -337,7 +381,9 @@  discard block
 block discarded – undo
337 381
 			$virtual_number--;
338 382
 		}
339 383
 
340
-		if($load_extra_vars) $this->setToAllDocumentExtraVars();
384
+		if($load_extra_vars) {
385
+			$this->setToAllDocumentExtraVars();
386
+		}
341 387
 
342 388
 		if(count($output->data))
343 389
 		{
@@ -365,12 +411,16 @@  discard block
 block discarded – undo
365 411
 		$args->module_srl = $obj->module_srl;
366 412
 		$args->category_srl= $obj->category_srl;
367 413
 		$output = executeQueryArray('document.getNoticeList', $args, $columnList);
368
-		if(!$output->toBool()||!$output->data) return;
414
+		if(!$output->toBool()||!$output->data) {
415
+			return;
416
+		}
369 417
 
370 418
 		foreach($output->data as $key => $val)
371 419
 		{
372 420
 			$document_srl = $val->document_srl;
373
-			if(!$document_srl) continue;
421
+			if(!$document_srl) {
422
+				continue;
423
+			}
374 424
 
375 425
 			if(!$GLOBALS['XE_DOCUMENT_LIST'][$document_srl])
376 426
 			{
@@ -466,7 +516,9 @@  discard block
 block discarded – undo
466 516
 
467 517
 				$oExtraVar->setExtraVarKeys($output->data);
468 518
 				$keys = $oExtraVar->getExtraVars();
469
-				if(!$keys) $keys = array();
519
+				if(!$keys) {
520
+					$keys = array();
521
+				}
470 522
 
471 523
 				if($oCacheHandler->isSupport())
472 524
 				{
@@ -496,7 +548,9 @@  discard block
 block discarded – undo
496 548
 			$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
497 549
 			$this->setToAllDocumentExtraVars();
498 550
 		}
499
-		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
551
+		if(is_array($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
552
+			ksort($GLOBALS['XE_EXTRA_VARS'][$document_srl]);
553
+		}
500 554
 		return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
501 555
 	}
502 556
 
@@ -526,7 +580,9 @@  discard block
 block discarded – undo
526 580
 			$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
527 581
 			$module_srl = $oDocument->get('module_srl');
528 582
 			$member_srl = $oDocument->get('member_srl');
529
-			if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
583
+			if(!$module_srl) {
584
+				return new BaseObject(-1, 'msg_invalid_request');
585
+			}
530 586
 
531 587
 			$oModuleModel = getModel('module');
532 588
 			$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
@@ -599,7 +655,9 @@  discard block
 block discarded – undo
599 655
 	 */
600 656
 	function getDocumentCount($module_srl, $search_obj = NULL)
601 657
 	{
602
-		if(is_null($search_obj)) $search_obj = new stdClass();
658
+		if(is_null($search_obj)) {
659
+			$search_obj = new stdClass();
660
+		}
603 661
 		$search_obj->module_srl = $module_srl;
604 662
 
605 663
 		$output = executeQuery('document.getDocumentCount', $search_obj);
@@ -616,7 +674,9 @@  discard block
 block discarded – undo
616 674
 	function getDocumentCountByGroupStatus($search_obj = NULL)
617 675
 	{
618 676
 		$output = executeQuery('document.getDocumentCountByGroupStatus', $search_obj);
619
-		if(!$output->toBool()) return array();
677
+		if(!$output->toBool()) {
678
+			return array();
679
+		}
620 680
 
621 681
 		return $output->data;
622 682
 	}
@@ -655,34 +715,29 @@  discard block
 block discarded – undo
655 715
 		if($sort_check->isExtraVars)
656 716
 		{
657 717
 			return 1;
658
-		}
659
-		else
718
+		} else
660 719
 		{
661 720
 			if($sort_check->sort_index === 'list_order' || $sort_check->sort_index === 'update_order')
662 721
 			{
663 722
 				if($args->order_type === 'desc')
664 723
 				{
665 724
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
666
-				}
667
-				else
725
+				} else
668 726
 				{
669 727
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
670 728
 				}
671
-			}
672
-			elseif($sort_check->sort_index === 'regdate')
729
+			} elseif($sort_check->sort_index === 'regdate')
673 730
 			{
674 731
 
675 732
 				if($args->order_type === 'asc')
676 733
 				{
677 734
 					$args->{'rev_' . $sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
678
-				}
679
-				else
735
+				} else
680 736
 				{
681 737
 					$args->{$sort_check->sort_index} = $oDocument->get($sort_check->sort_index);
682 738
 				}
683 739
 
684
-			}
685
-			else
740
+			} else
686 741
 			{
687 742
 				return 1;
688 743
 			}
@@ -708,15 +763,16 @@  discard block
 block discarded – undo
708 763
 		$output = executeQuery('document.getCategory', $args, $columnList);
709 764
 
710 765
 		$node = $output->data;
711
-		if(!$node) return;
766
+		if(!$node) {
767
+			return;
768
+		}
712 769
 
713 770
 		if($node->group_srls)
714 771
 		{
715 772
 			$group_srls = explode(',',$node->group_srls);
716 773
 			unset($node->group_srls);
717 774
 			$node->group_srls = $group_srls;
718
-		}
719
-		else
775
+		} else
720 776
 		{
721 777
 			unset($node->group_srls);
722 778
 			$node->group_srls = array();
@@ -734,7 +790,9 @@  discard block
 block discarded – undo
734 790
 		$args = new stdClass();
735 791
 		$args->category_srl = $category_srl;
736 792
 		$output = executeQuery('document.getChildCategoryCount',$args);
737
-		if($output->data->count > 0) return true;
793
+		if($output->data->count > 0) {
794
+			return true;
795
+		}
738 796
 		return false;
739 797
 	}
740 798
 
@@ -753,7 +811,9 @@  discard block
 block discarded – undo
753 811
 		if(!file_exists($filename))
754 812
 		{
755 813
 			$oDocumentController = getController('document');
756
-			if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
814
+			if(!$oDocumentController->makeCategoryFile($module_srl)) {
815
+				return array();
816
+			}
757 817
 		}
758 818
 
759 819
 		include($filename);
@@ -773,7 +833,9 @@  discard block
 block discarded – undo
773 833
 	 */
774 834
 	function _arrangeCategory(&$document_category, $list, $depth)
775 835
 	{
776
-		if(!count($list)) return;
836
+		if(!count($list)) {
837
+			return;
838
+		}
777 839
 		$idx = 0;
778 840
 		$list_order = array();
779 841
 		foreach($list as $key => $val)
@@ -793,8 +855,11 @@  discard block
 block discarded – undo
793 855
 			$obj->childs = array();
794 856
 			$obj->grant = $val['grant'];
795 857
 
796
-			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) $selected = true;
797
-			else $selected = false;
858
+			if(Context::get('mid') == $obj->mid && Context::get('category') == $obj->category_srl) {
859
+				$selected = true;
860
+			} else {
861
+				$selected = false;
862
+			}
798 863
 
799 864
 			$obj->selected = $selected;
800 865
 
@@ -805,14 +870,18 @@  discard block
 block discarded – undo
805 870
 				$parent_srl = $obj->parent_srl;
806 871
 				$document_count = $obj->document_count;
807 872
 				$expand = $obj->expand;
808
-				if($selected) $expand = true;
873
+				if($selected) {
874
+					$expand = true;
875
+				}
809 876
 
810 877
 				while($parent_srl)
811 878
 				{
812 879
 					$document_category[$parent_srl]->document_count += $document_count;
813 880
 					$document_category[$parent_srl]->childs[] = $obj->category_srl;
814 881
 					$document_category[$parent_srl]->child_count = count($document_category[$parent_srl]->childs);
815
-					if($expand) $document_category[$parent_srl]->expand = $expand;
882
+					if($expand) {
883
+						$document_category[$parent_srl]->expand = $expand;
884
+					}
816 885
 
817 886
 					$parent_srl = $document_category[$parent_srl]->parent_srl;
818 887
 				}
@@ -820,7 +889,9 @@  discard block
 block discarded – undo
820 889
 
821 890
 			$document_category[$key] = $obj;
822 891
 
823
-			if(count($val['list'])) $this->_arrangeCategory($document_category, $val['list'], $depth+1);
892
+			if(count($val['list'])) {
893
+				$this->_arrangeCategory($document_category, $val['list'], $depth+1);
894
+			}
824 895
 		}
825 896
 		$document_category[$list_order[0]]->first = true;
826 897
 		$document_category[$list_order[count($list_order)-1]]->last = true;
@@ -888,13 +959,20 @@  discard block
 block discarded – undo
888 959
 		}
889 960
 		// Module_srl passed the array may be a check whether the array
890 961
 		$args = new stdClass;
891
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
892
-		else $args->module_srl = $obj->module_srl;
962
+		if(is_array($obj->module_srl)) {
963
+			$args->module_srl = implode(',', $obj->module_srl);
964
+		} else {
965
+			$args->module_srl = $obj->module_srl;
966
+		}
893 967
 
894 968
 		$output = executeQuery('document.getMonthlyArchivedList', $args);
895
-		if(!$output->toBool()||!$output->data) return $output;
969
+		if(!$output->toBool()||!$output->data) {
970
+			return $output;
971
+		}
896 972
 
897
-		if(!is_array($output->data)) $output->data = array($output->data);
973
+		if(!is_array($output->data)) {
974
+			$output->data = array($output->data);
975
+		}
898 976
 
899 977
 		return $output;
900 978
 	}
@@ -914,14 +992,21 @@  discard block
 block discarded – undo
914 992
 		}
915 993
 		// Module_srl passed the array may be a check whether the array
916 994
 		$args = new stdClass;
917
-		if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
918
-		else $args->module_srl = $obj->module_srl;
995
+		if(is_array($obj->module_srl)) {
996
+			$args->module_srl = implode(',', $obj->module_srl);
997
+		} else {
998
+			$args->module_srl = $obj->module_srl;
999
+		}
919 1000
 		$args->regdate = $obj->regdate;
920 1001
 
921 1002
 		$output = executeQuery('document.getDailyArchivedList', $args);
922
-		if(!$output->toBool()) return $output;
1003
+		if(!$output->toBool()) {
1004
+			return $output;
1005
+		}
923 1006
 
924
-		if(!is_array($output->data)) $output->data = array($output->data);
1007
+		if(!is_array($output->data)) {
1008
+			$output->data = array($output->data);
1009
+		}
925 1010
 
926 1011
 		return $output;
927 1012
 	}
@@ -932,7 +1017,9 @@  discard block
 block discarded – undo
932 1017
 	 */
933 1018
 	function getDocumentCategories()
934 1019
 	{
935
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
1020
+		if(!Context::get('is_logged')) {
1021
+			return new BaseObject(-1,'msg_not_permitted');
1022
+		}
936 1023
 		$module_srl = Context::get('module_srl');
937 1024
 		$categories= $this->getCategoryList($module_srl);
938 1025
 		$lang = Context::get('lang');
@@ -1027,7 +1114,9 @@  discard block
 block discarded – undo
1027 1114
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
1028 1115
 		// Check permissions
1029 1116
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1030
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1117
+		if(!$grant->manager) {
1118
+			return new BaseObject(-1,'msg_not_permitted');
1119
+		}
1031 1120
 
1032 1121
 		$category_srl = Context::get('category_srl');
1033 1122
 		$category_info = $this->getCategory($category_srl);
@@ -1047,15 +1136,20 @@  discard block
 block discarded – undo
1047 1136
 	 */
1048 1137
 	function getDocumentSrlByAlias($mid, $alias)
1049 1138
 	{
1050
-		if(!$mid || !$alias) return null;
1139
+		if(!$mid || !$alias) {
1140
+			return null;
1141
+		}
1051 1142
 		$site_module_info = Context::get('site_module_info');
1052 1143
 		$args = new stdClass;
1053 1144
 		$args->mid = $mid;
1054 1145
 		$args->alias_title = $alias;
1055 1146
 		$args->site_srl = $site_module_info->site_srl;
1056 1147
 		$output = executeQuery('document.getDocumentSrlByAlias', $args);
1057
-		if(!$output->data) return null;
1058
-		else return $output->data->document_srl;
1148
+		if(!$output->data) {
1149
+			return null;
1150
+		} else {
1151
+			return $output->data->document_srl;
1152
+		}
1059 1153
 	}
1060 1154
 
1061 1155
 	/**
@@ -1066,15 +1160,20 @@  discard block
 block discarded – undo
1066 1160
 	 */
1067 1161
 	function getDocumentSrlByTitle($module_srl, $title)
1068 1162
 	{
1069
-		if(!$module_srl || !$title) return null;
1163
+		if(!$module_srl || !$title) {
1164
+			return null;
1165
+		}
1070 1166
 		$args = new stdClass;
1071 1167
 		$args->module_srl = $module_srl;
1072 1168
 		$args->title = $title;
1073 1169
 		$output = executeQuery('document.getDocumentSrlByTitle', $args);
1074
-		if(!$output->data) return null;
1075
-		else
1170
+		if(!$output->data) {
1171
+			return null;
1172
+		} else
1076 1173
 		{
1077
-			if(is_array($output->data)) return $output->data[0]->document_srl;
1174
+			if(is_array($output->data)) {
1175
+				return $output->data[0]->document_srl;
1176
+			}
1078 1177
 			return $output->data->document_srl;
1079 1178
 		}
1080 1179
 	}
@@ -1086,13 +1185,18 @@  discard block
 block discarded – undo
1086 1185
 	 */
1087 1186
 	function getAlias($document_srl)
1088 1187
 	{
1089
-		if(!$document_srl) return null;
1188
+		if(!$document_srl) {
1189
+			return null;
1190
+		}
1090 1191
 		$args = new stdClass;
1091 1192
 		$args->document_srl = $document_srl;
1092 1193
 		$output = executeQueryArray('document.getAliases', $args);
1093 1194
 
1094
-		if(!$output->data) return null;
1095
-		else return $output->data[0]->alias_title;
1195
+		if(!$output->data) {
1196
+			return null;
1197
+		} else {
1198
+			return $output->data[0]->alias_title;
1199
+		}
1096 1200
 	}
1097 1201
 
1098 1202
 	/**
@@ -1149,17 +1253,23 @@  discard block
 block discarded – undo
1149 1253
 			{
1150 1254
 				case 'title' :
1151 1255
 				case 'content' :
1152
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1256
+					if($search_keyword) {
1257
+						$search_keyword = str_replace(' ','%',$search_keyword);
1258
+					}
1153 1259
 					$args->{"s_".$search_target} = $search_keyword;
1154 1260
 					$use_division = true;
1155 1261
 					break;
1156 1262
 				case 'title_content' :
1157
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1263
+					if($search_keyword) {
1264
+						$search_keyword = str_replace(' ','%',$search_keyword);
1265
+					}
1158 1266
 					$args->s_title = $search_keyword;
1159 1267
 					$args->s_content = $search_keyword;
1160 1268
 					break;
1161 1269
 				case 'user_id' :
1162
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1270
+					if($search_keyword) {
1271
+						$search_keyword = str_replace(' ','%',$search_keyword);
1272
+					}
1163 1273
 					$args->s_user_id = $search_keyword;
1164 1274
 					$args->sort_index = 'documents.'.$args->sort_index;
1165 1275
 					break;
@@ -1167,13 +1277,18 @@  discard block
 block discarded – undo
1167 1277
 				case 'nick_name' :
1168 1278
 				case 'email_address' :
1169 1279
 				case 'homepage' :
1170
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1280
+					if($search_keyword) {
1281
+						$search_keyword = str_replace(' ','%',$search_keyword);
1282
+					}
1171 1283
 					$args->{"s_".$search_target} = $search_keyword;
1172 1284
 					break;
1173 1285
 				case 'is_notice' :
1174 1286
 				case 'is_secret' :
1175
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1176
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1287
+					if($search_keyword=='N') {
1288
+						$args->statusList = array($this->getConfigStatus('public'));
1289
+					} elseif($search_keyword=='Y') {
1290
+						$args->statusList = array($this->getConfigStatus('secret'));
1291
+					}
1177 1292
 					break;
1178 1293
 				case 'member_srl' :
1179 1294
 				case 'readed_count' :
@@ -1215,34 +1330,45 @@  discard block
 block discarded – undo
1215 1330
 	{
1216 1331
 		$args = new stdClass;
1217 1332
 		$document_srl = Context::get('document_srl');
1218
-		if(!$document_srl) return new BaseObject(-1,'msg_invalid_request');
1333
+		if(!$document_srl) {
1334
+			return new BaseObject(-1,'msg_invalid_request');
1335
+		}
1219 1336
 
1220 1337
 		$point = Context::get('point');
1221
-		if($point != -1) $point = 1;
1338
+		if($point != -1) {
1339
+			$point = 1;
1340
+		}
1222 1341
 
1223 1342
 		$oDocumentModel = getModel('document');
1224 1343
 		$columnList = array('document_srl', 'module_srl');
1225 1344
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false, $columnList);
1226 1345
 		$module_srl = $oDocument->get('module_srl');
1227
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
1346
+		if(!$module_srl) {
1347
+			return new BaseObject(-1, 'msg_invalid_request');
1348
+		}
1228 1349
 
1229 1350
 		$oModuleModel = getModel('module');
1230 1351
 		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
1231 1352
 		if($point == -1)
1232 1353
 		{
1233
-			if($document_config->use_vote_down!='S') return new BaseObject(-1, 'msg_invalid_request');
1354
+			if($document_config->use_vote_down!='S') {
1355
+				return new BaseObject(-1, 'msg_invalid_request');
1356
+			}
1234 1357
 			$args->below_point = 0;
1235
-		}
1236
-		else
1358
+		} else
1237 1359
 		{
1238
-			if($document_config->use_vote_up!='S') return new BaseObject(-1, 'msg_invalid_request');
1360
+			if($document_config->use_vote_up!='S') {
1361
+				return new BaseObject(-1, 'msg_invalid_request');
1362
+			}
1239 1363
 			$args->more_point = 0;
1240 1364
 		}
1241 1365
 
1242 1366
 		$args->document_srl = $document_srl;
1243 1367
 
1244 1368
 		$output = executeQueryArray('document.getVotedMemberList',$args);
1245
-		if(!$output->toBool()) return $output;
1369
+		if(!$output->toBool()) {
1370
+			return $output;
1371
+		}
1246 1372
 
1247 1373
 		$oMemberModel = getModel('member');
1248 1374
 		if($output->data)
@@ -1264,9 +1390,11 @@  discard block
 block discarded – undo
1264 1390
 	function getStatusNameList()
1265 1391
 	{
1266 1392
 		global $lang;
1267
-		if(!isset($lang->status_name_list))
1268
-			return array_flip($this->getStatusList());
1269
-		else return $lang->status_name_list;
1393
+		if(!isset($lang->status_name_list)) {
1394
+					return array_flip($this->getStatusList());
1395
+		} else {
1396
+			return $lang->status_name_list;
1397
+		}
1270 1398
 	}
1271 1399
 
1272 1400
 	/**
@@ -1290,20 +1418,22 @@  discard block
 block discarded – undo
1290 1418
 				if (!$extra_output->data || !$extra_output->toBool())
1291 1419
 				{
1292 1420
 					$sortIndex = 'list_order';
1293
-				}
1294
-				else
1421
+				} else
1295 1422
 				{
1296 1423
 					$check_array = array();
1297 1424
 					foreach($extra_output->data as $val)
1298 1425
 					{
1299 1426
 						$check_array[] = $val->eid;
1300 1427
 					}
1301
-					if(!in_array($sortIndex, $check_array)) $sortIndex = 'list_order';
1302
-					else $isExtraVars = true;
1428
+					if(!in_array($sortIndex, $check_array)) {
1429
+						$sortIndex = 'list_order';
1430
+					} else {
1431
+						$isExtraVars = true;
1432
+					}
1303 1433
 				}
1434
+			} else {
1435
+							$sortIndex = 'list_order';
1304 1436
 			}
1305
-			else
1306
-				$sortIndex = 'list_order';
1307 1437
 		}
1308 1438
 		$returnObj = new stdClass();
1309 1439
 		$returnObj->sort_index = $sortIndex;
@@ -1342,7 +1472,9 @@  discard block
 block discarded – undo
1342 1472
 
1343 1473
 		// Check the target and sequence alignment
1344 1474
 		$orderType = array('desc' => 1, 'asc' => 1);
1345
-		if(!isset($orderType[$args->order_type])) $args->order_type = 'asc';
1475
+		if(!isset($orderType[$args->order_type])) {
1476
+			$args->order_type = 'asc';
1477
+		}
1346 1478
 
1347 1479
 		// If that came across mid module_srl instead of a direct module_srl guhaejum
1348 1480
 		if($searchOpt->mid)
@@ -1353,21 +1485,29 @@  discard block
 block discarded – undo
1353 1485
 		}
1354 1486
 
1355 1487
 		// Module_srl passed the array may be a check whether the array
1356
-		if(is_array($searchOpt->module_srl)) $args->module_srl = implode(',', $searchOpt->module_srl);
1357
-		else $args->module_srl = $searchOpt->module_srl;
1488
+		if(is_array($searchOpt->module_srl)) {
1489
+			$args->module_srl = implode(',', $searchOpt->module_srl);
1490
+		} else {
1491
+			$args->module_srl = $searchOpt->module_srl;
1492
+		}
1358 1493
 
1359 1494
 		// Except for the test module_srl
1360
-		if(is_array($searchOpt->exclude_module_srl)) $args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1361
-		else $args->exclude_module_srl = $searchOpt->exclude_module_srl;
1495
+		if(is_array($searchOpt->exclude_module_srl)) {
1496
+			$args->exclude_module_srl = implode(',', $searchOpt->exclude_module_srl);
1497
+		} else {
1498
+			$args->exclude_module_srl = $searchOpt->exclude_module_srl;
1499
+		}
1362 1500
 
1363 1501
 		// only admin document list, temp document showing
1364
-		if($searchOpt->statusList) $args->statusList = $searchOpt->statusList;
1365
-		else
1502
+		if($searchOpt->statusList) {
1503
+			$args->statusList = $searchOpt->statusList;
1504
+		} else
1366 1505
 		{
1367
-			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl)
1368
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1369
-			else
1370
-				$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1506
+			if($logged_info->is_admin == 'Y' && !$searchOpt->module_srl) {
1507
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'), $this->getConfigStatus('temp'));
1508
+			} else {
1509
+							$args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
1510
+			}
1371 1511
 		}
1372 1512
 
1373 1513
 		// Category is selected, further sub-categories until all conditions
@@ -1395,18 +1535,24 @@  discard block
 block discarded – undo
1395 1535
 			{
1396 1536
 				case 'title' :
1397 1537
 				case 'content' :
1398
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1538
+					if($search_keyword) {
1539
+						$search_keyword = str_replace(' ','%',$search_keyword);
1540
+					}
1399 1541
 					$args->{"s_".$search_target} = $search_keyword;
1400 1542
 					$use_division = true;
1401 1543
 					break;
1402 1544
 				case 'title_content' :
1403
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1545
+					if($search_keyword) {
1546
+						$search_keyword = str_replace(' ','%',$search_keyword);
1547
+					}
1404 1548
 					$args->s_title = $search_keyword;
1405 1549
 					$args->s_content = $search_keyword;
1406 1550
 					$use_division = true;
1407 1551
 					break;
1408 1552
 				case 'user_id' :
1409
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1553
+					if($search_keyword) {
1554
+						$search_keyword = str_replace(' ','%',$search_keyword);
1555
+					}
1410 1556
 					$args->s_user_id = $search_keyword;
1411 1557
 					$args->sort_index = 'documents.'.$args->sort_index;
1412 1558
 					break;
@@ -1414,18 +1560,28 @@  discard block
 block discarded – undo
1414 1560
 				case 'nick_name' :
1415 1561
 				case 'email_address' :
1416 1562
 				case 'homepage' :
1417
-					if($search_keyword) $search_keyword = str_replace(' ','%',$search_keyword);
1563
+					if($search_keyword) {
1564
+						$search_keyword = str_replace(' ','%',$search_keyword);
1565
+					}
1418 1566
 					$args->{"s_".$search_target} = $search_keyword;
1419 1567
 					break;
1420 1568
 				case 'is_notice' :
1421
-					if($search_keyword=='N') $args->{"s_".$search_target} = 'N';
1422
-					elseif($search_keyword=='Y') $args->{"s_".$search_target} = 'Y';
1423
-					else $args->{"s_".$search_target} = '';
1569
+					if($search_keyword=='N') {
1570
+						$args->{"s_".$search_target} = 'N';
1571
+					} elseif($search_keyword=='Y') {
1572
+						$args->{"s_".$search_target} = 'Y';
1573
+					} else {
1574
+						$args->{"s_".$search_target} = '';
1575
+					}
1424 1576
 					break;
1425 1577
 				case 'is_secret' :
1426
-					if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
1427
-					elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
1428
-					elseif($search_keyword=='temp') $args->statusList = array($this->getConfigStatus('temp'));
1578
+					if($search_keyword=='N') {
1579
+						$args->statusList = array($this->getConfigStatus('public'));
1580
+					} elseif($search_keyword=='Y') {
1581
+						$args->statusList = array($this->getConfigStatus('secret'));
1582
+					} elseif($search_keyword=='temp') {
1583
+						$args->statusList = array($this->getConfigStatus('temp'));
1584
+					}
1429 1585
 					break;
1430 1586
 				case 'member_srl' :
1431 1587
 				case 'readed_count' :
@@ -1488,13 +1644,14 @@  discard block
 block discarded – undo
1488 1644
 		if ($searchOpt->isExtraVars)
1489 1645
 		{
1490 1646
 			$query_id = 'document.getDocumentListExtraSort';
1491
-		}
1492
-		else
1647
+		} else
1493 1648
 		{
1494 1649
 			/**
1495 1650
 			 * list_order asc sort of division that can be used only when
1496 1651
 			 */
1497
-			if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
1652
+			if($args->sort_index != 'list_order' || $args->order_type != 'asc') {
1653
+				$use_division = false;
1654
+			}
1498 1655
 
1499 1656
 			/**
1500 1657
 			 * If it is true, use_division changed to use the document division
@@ -1509,8 +1666,7 @@  discard block
 block discarded – undo
1509 1666
 				{
1510 1667
 					$listSqlID = 'document.getDocumentListUseIndex';
1511 1668
 					$divisionSqlID = 'document.getDocumentDivisionUseIndex';
1512
-				}
1513
-				else
1669
+				} else
1514 1670
 				{
1515 1671
 					$listSqlID = 'document.getDocumentList';
1516 1672
 					$divisionSqlID = 'document.getDocumentDivision';
@@ -1567,7 +1723,9 @@  discard block
 block discarded – undo
1567 1723
 					$last_division_args->exclude_module_srl = $args->exclude_module_srl;
1568 1724
 					$last_division_args->list_order = $last_division;
1569 1725
 					$output = executeQuery('document.getDocumentDivisionCount', $last_division_args);
1570
-					if($output->data->count<1) $last_division = null;
1726
+					if($output->data->count<1) {
1727
+						$last_division = null;
1728
+					}
1571 1729
 				}
1572 1730
 
1573 1731
 				$args->division = $division;
@@ -1608,8 +1766,12 @@  discard block
 block discarded – undo
1608 1766
 		$output = executeQuery('document.getDocumentListByMemberSrl', $args, $columnList);
1609 1767
 		$document_list = $output->data;
1610 1768
 
1611
-		if(!$document_list) return array();
1612
-		if(!is_array($document_list)) $document_list = array($document_list);
1769
+		if(!$document_list) {
1770
+			return array();
1771
+		}
1772
+		if(!is_array($document_list)) {
1773
+			$document_list = array($document_list);
1774
+		}
1613 1775
 
1614 1776
 		return $document_list;
1615 1777
 	}
@@ -1624,8 +1786,7 @@  discard block
 block discarded – undo
1624 1786
 		if(Mobile::isFromMobilePhone())
1625 1787
 		{
1626 1788
 			$iconSkin = $documentConfig->micons;
1627
-		}
1628
-		else
1789
+		} else
1629 1790
 		{
1630 1791
 			$iconSkin = $documentConfig->icons;
1631 1792
 		}
Please login to merge, or discard this patch.
modules/document/document.view.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	/**
54 54
 	 * Preview
55
-	 * @return void
55
+	 * @return BaseObject|null
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 	/**
157 157
 	 * Document temp saved list
158
-	 * @return void
158
+	 * @return ModuleObject|null
159 159
 	 */
160 160
 	function dispTempSavedList()
161 161
 	{
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
 		$oDocumentModel = getModel('document');
37 37
 		// Creates an object for displaying the selected document
38 38
 		$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39
-		if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
39
+		if (!$oDocument->isExists()) return new BaseObject(-1, 'msg_invalid_request');
40 40
 		// Check permissions
41
-		if(!$oDocument->isAccessible()) return new BaseObject(-1,'msg_not_permitted');
41
+		if (!$oDocument->isAccessible()) return new BaseObject(-1, 'msg_not_permitted');
42 42
 		// Information setting module
43 43
 		//Context::set('module_info', $module_info);	//module_info not use in UI
44 44
 		// Browser title settings
45 45
 		Context::setBrowserTitle($oDocument->getTitleText());
46 46
 		Context::set('oDocument', $oDocument);
47 47
 
48
-		Context::set('layout','none');
48
+		Context::set('layout', 'none');
49 49
 		$this->setTemplatePath($this->module_path.'tpl');
50 50
 		$this->setTemplateFile('print_page');
51 51
 	}
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	function dispDocumentPreview()
58 58
 	{
59
-		if(!checkCSRF())
59
+		if (!checkCSRF())
60 60
 		{
61 61
 			return new BaseObject(-1, 'msg_invalid_request');
62 62
 		} 
63 63
 
64
-		if(Context::get('logged_info')->is_admin != 'Y')
64
+		if (Context::get('logged_info')->is_admin != 'Y')
65 65
 		{
66 66
 			Context::set('content', removeHackTag(Context::get('content')));
67 67
 		}
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	function dispDocumentManageDocument()
80 80
 	{
81
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
81
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
82 82
 		// Taken from a list of selected sessions
83 83
 		$flag_list = $_SESSION['document_management'];
84
-		if(count($flag_list))
84
+		if (count($flag_list))
85 85
 		{
86
-			foreach($flag_list as $key => $val)
86
+			foreach ($flag_list as $key => $val)
87 87
 			{
88
-				if(!is_bool($val)) continue;
88
+				if (!is_bool($val)) continue;
89 89
 				$document_srl_list[] = $key;
90 90
 			}
91 91
 		}
92 92
 
93
-		if(count($document_srl_list))
93
+		if (count($document_srl_list))
94 94
 		{
95 95
 			$oDocumentModel = getModel('document');
96 96
 			$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 
100 100
 		$oModuleModel = getModel('module');
101 101
 		// The combination of module categories list and the list of modules
102
-		if(count($module_list)>1) Context::set('module_list', $module_categories);
102
+		if (count($module_list) > 1) Context::set('module_list', $module_categories);
103 103
 
104
-		$module_srl=Context::get('module_srl');
105
-		Context::set('module_srl',$module_srl);
104
+		$module_srl = Context::get('module_srl');
105
+		Context::set('module_srl', $module_srl);
106 106
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
107
-		Context::set('mid',$module_info->mid);
108
-		Context::set('browser_title',$module_info->browser_title);
107
+		Context::set('mid', $module_info->mid);
108
+		Context::set('browser_title', $module_info->browser_title);
109 109
 
110 110
 		// Select Pop-up layout
111 111
 		$this->setLayoutPath('./common/tpl');
@@ -126,24 +126,24 @@  discard block
 block discarded – undo
126 126
 		$current_module_srl = Context::get('module_srl');
127 127
 		$current_module_srls = Context::get('module_srls');
128 128
 
129
-		if(!$current_module_srl && !$current_module_srls)
129
+		if (!$current_module_srl && !$current_module_srls)
130 130
 		{
131 131
 			// Get information of the current module
132 132
 			$current_module_info = Context::get('current_module_info');
133 133
 			$current_module_srl = $current_module_info->module_srl;
134
-			if(!$current_module_srl) return new BaseObject();
134
+			if (!$current_module_srl) return new BaseObject();
135 135
 		}
136 136
 
137 137
 		$oModuleModel = getModel('module');
138
-		if($current_module_srl)
138
+		if ($current_module_srl)
139 139
 		{
140 140
 			$document_config = $oModuleModel->getModulePartConfig('document', $current_module_srl);
141 141
 		}
142
-		if(!$document_config)
142
+		if (!$document_config)
143 143
 		{
144 144
 			$document_config = new stdClass();
145 145
 		}
146
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
146
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
147 147
 		Context::set('document_config', $document_config);
148 148
 
149 149
 		$oTemplate = &TemplateHandler::getInstance();
@@ -163,13 +163,13 @@  discard block
 block discarded – undo
163 163
 
164 164
 		$oMemberModel = getModel('member');
165 165
 		// A message appears if the user is not logged-in
166
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
166
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
167 167
 		// Get the saved document (module_srl is set to member_srl instead)
168 168
 		$logged_info = Context::get('logged_info');
169 169
 		$args = new stdClass();
170 170
 		$args->member_srl = $logged_info->member_srl;
171 171
 		$args->statusList = array($this->getConfigStatus('temp'));
172
-		$args->page = (int)Context::get('page');
172
+		$args->page = (int) Context::get('page');
173 173
 		$args->list_count = 10;
174 174
 
175 175
 		$oDocumentModel = getModel('document');
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,9 +36,13 @@  discard block
 block discarded – undo
36 36
 		$oDocumentModel = getModel('document');
37 37
 		// Creates an object for displaying the selected document
38 38
 		$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
39
-		if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
39
+		if(!$oDocument->isExists()) {
40
+			return new BaseObject(-1,'msg_invalid_request');
41
+		}
40 42
 		// Check permissions
41
-		if(!$oDocument->isAccessible()) return new BaseObject(-1,'msg_not_permitted');
43
+		if(!$oDocument->isAccessible()) {
44
+			return new BaseObject(-1,'msg_not_permitted');
45
+		}
42 46
 		// Information setting module
43 47
 		//Context::set('module_info', $module_info);	//module_info not use in UI
44 48
 		// Browser title settings
@@ -78,14 +82,18 @@  discard block
 block discarded – undo
78 82
 	 */
79 83
 	function dispDocumentManageDocument()
80 84
 	{
81
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
85
+		if(!Context::get('is_logged')) {
86
+			return new BaseObject(-1,'msg_not_permitted');
87
+		}
82 88
 		// Taken from a list of selected sessions
83 89
 		$flag_list = $_SESSION['document_management'];
84 90
 		if(count($flag_list))
85 91
 		{
86 92
 			foreach($flag_list as $key => $val)
87 93
 			{
88
-				if(!is_bool($val)) continue;
94
+				if(!is_bool($val)) {
95
+					continue;
96
+				}
89 97
 				$document_srl_list[] = $key;
90 98
 			}
91 99
 		}
@@ -99,7 +107,9 @@  discard block
 block discarded – undo
99 107
 
100 108
 		$oModuleModel = getModel('module');
101 109
 		// The combination of module categories list and the list of modules
102
-		if(count($module_list)>1) Context::set('module_list', $module_categories);
110
+		if(count($module_list)>1) {
111
+			Context::set('module_list', $module_categories);
112
+		}
103 113
 
104 114
 		$module_srl=Context::get('module_srl');
105 115
 		Context::set('module_srl',$module_srl);
@@ -131,7 +141,9 @@  discard block
 block discarded – undo
131 141
 			// Get information of the current module
132 142
 			$current_module_info = Context::get('current_module_info');
133 143
 			$current_module_srl = $current_module_info->module_srl;
134
-			if(!$current_module_srl) return new BaseObject();
144
+			if(!$current_module_srl) {
145
+				return new BaseObject();
146
+			}
135 147
 		}
136 148
 
137 149
 		$oModuleModel = getModel('module');
@@ -143,7 +155,9 @@  discard block
 block discarded – undo
143 155
 		{
144 156
 			$document_config = new stdClass();
145 157
 		}
146
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
158
+		if(!isset($document_config->use_history)) {
159
+			$document_config->use_history = 'N';
160
+		}
147 161
 		Context::set('document_config', $document_config);
148 162
 
149 163
 		$oTemplate = &TemplateHandler::getInstance();
@@ -163,7 +177,9 @@  discard block
 block discarded – undo
163 177
 
164 178
 		$oMemberModel = getModel('member');
165 179
 		// A message appears if the user is not logged-in
166
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
180
+		if(!$oMemberModel->isLogged()) {
181
+			return $this->stop('msg_not_logged');
182
+		}
167 183
 		// Get the saved document (module_srl is set to member_srl instead)
168 184
 		$logged_info = Context::get('logged_info');
169 185
 		$args = new stdClass();
Please login to merge, or discard this patch.
modules/file/file.admin.controller.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * Delete selected files from the administrator page
58 58
 	 *
59
-	 * @return BaseObject
59
+	 * @return ModuleObject|null
60 60
 	 */
61 61
 	function procFileAdminDeleteChecked()
62 62
 	{
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	/**
111 111
 	 * Add file information for each module
112 112
 	 *
113
-	 * @return void
113
+	 * @return BaseObject|null
114 114
 	 */
115 115
 	function procFileAdminInsertModuleConfig()
116 116
 	{
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -26,29 +26,29 @@  discard block
 block discarded – undo
26 26
 		$args = new stdClass();
27 27
 		$args->module_srl = $module_srl;
28 28
 		$columnList = array('file_srl', 'uploaded_filename');
29
-		$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
30
-		if(!$output) return $output;
29
+		$output = executeQueryArray('file.getModuleFiles', $args, $columnList);
30
+		if (!$output) return $output;
31 31
 		$files = $output->data;
32 32
 		// Remove from the DB
33 33
 		$args->module_srl = $module_srl;
34 34
 		$output = executeQuery('file.deleteModuleFiles', $args);
35
-		if(!$output->toBool()) return $output;
35
+		if (!$output->toBool()) return $output;
36 36
 		// Remove the file
37
-		FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
38
-		FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
37
+		FileHandler::removeDir(sprintf("./files/attach/images/%s/", $module_srl));
38
+		FileHandler::removeDir(sprintf("./files/attach/binaries/%s/", $module_srl));
39 39
 		// Remove the file list obtained from the DB
40 40
 		$path = array();
41 41
 		$cnt = count($files);
42
-		for($i=0;$i<$cnt;$i++)
42
+		for ($i = 0; $i < $cnt; $i++)
43 43
 		{
44 44
 			$uploaded_filename = $files[$i]->uploaded_filename;
45 45
 			FileHandler::removeFile($uploaded_filename);
46 46
 
47 47
 			$path_info = pathinfo($uploaded_filename);
48
-			if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
48
+			if (!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
49 49
 		}
50 50
 		// Remove a file directory of the document
51
-		for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
51
+		for ($i = 0; $i < count($path); $i++) FileHandler::removeBlankDir($path[$i]);
52 52
 
53 53
 		return $output;
54 54
 	}
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
 	{
63 63
 		// An error appears if no document is selected
64 64
 		$cart = Context::get('cart');
65
-		if(!$cart) return $this->stop('msg_file_cart_is_null');
66
-		if(!is_array($cart)) $file_srl_list= explode('|@|', $cart);
65
+		if (!$cart) return $this->stop('msg_file_cart_is_null');
66
+		if (!is_array($cart)) $file_srl_list = explode('|@|', $cart);
67 67
 		else $file_srl_list = $cart;
68 68
 		$file_count = count($file_srl_list);
69
-		if(!$file_count) return $this->stop('msg_file_cart_is_null');
69
+		if (!$file_count) return $this->stop('msg_file_cart_is_null');
70 70
 
71 71
 		$oFileController = getController('file');
72 72
 		// Delete the post
73
-		for($i=0;$i<$file_count;$i++)
73
+		for ($i = 0; $i < $file_count; $i++)
74 74
 		{
75 75
 			$file_srl = trim($file_srl_list[$i]);
76
-			if(!$file_srl) continue;
76
+			if (!$file_srl) continue;
77 77
 
78 78
 			$oFileController->deleteFile($file_srl);
79 79
 		}
80 80
 
81
-		$this->setMessage( sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count) );
81
+		$this->setMessage(sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count));
82 82
 
83 83
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminList');
84 84
 		$this->setRedirectUrl($returnUrl);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		$config->allow_outlink_site = Context::get('allow_outlink_site');
102 102
 		// Create module Controller object
103 103
 		$oModuleController = getController('module');
104
-		$output = $oModuleController->insertModuleConfig('file',$config);
104
+		$output = $oModuleController->insertModuleConfig('file', $config);
105 105
 
106 106
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispFileAdminConfig');
107 107
 		return $this->setRedirectUrl($returnUrl, $output);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		// Get variables
118 118
 		$module_srl = Context::get('target_module_srl');
119 119
 		// In order to configure multiple modules at once
120
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
120
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
121 121
 		else $module_srl = array($module_srl);
122 122
 
123 123
 		$download_grant = Context::get('download_grant');
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 		$file_config->allowed_attach_size = Context::get('allowed_attach_size');
131 131
 		$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
132 132
 
133
-		if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant);
133
+		if (!is_array($download_grant)) $file_config->download_grant = explode('|@|', $download_grant);
134 134
 		else $file_config->download_grant = $download_grant;
135 135
 
136 136
 		//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 		$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
141 141
 		$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
142 142
 
143
-		if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
143
+		if ($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
144 144
 			return new BaseObject(-1, 'input size over than config in php.ini');
145 145
 
146 146
 		$oModuleController = getController('module');
147
-		for($i=0;$i<count($module_srl);$i++)
147
+		for ($i = 0; $i < count($module_srl); $i++)
148 148
 		{
149 149
 			$srl = trim($module_srl[$i]);
150
-			if(!$srl) continue;
151
-			$oModuleController->insertModulePartConfig('file',$srl,$file_config);
150
+			if (!$srl) continue;
151
+			$oModuleController->insertModulePartConfig('file', $srl, $file_config);
152 152
 		}
153 153
 
154 154
 		$this->setError(-1);
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	function procFileAdminAddCart()
167 167
 	{
168
-		$file_srl = (int)Context::get('file_srl');
168
+		$file_srl = (int) Context::get('file_srl');
169 169
 		//$fileSrlList = array(500, 502);
170 170
 
171 171
 		$oFileModel = getModel('file');
172 172
 		$output = $oFileModel->getFile($file_srl);
173 173
 		//$output = $oFileModel->getFile($fileSrlList);
174 174
 
175
-		if($output->file_srl)
175
+		if ($output->file_srl)
176 176
 		{
177
-			if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
177
+			if ($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
178 178
 			else $_SESSION['file_management'][$output->file_srl] = true;
179 179
 		}
180 180
 	}
Please login to merge, or discard this patch.
Braces   +47 added lines, -18 removed lines patch added patch discarded remove patch
@@ -27,12 +27,16 @@  discard block
 block discarded – undo
27 27
 		$args->module_srl = $module_srl;
28 28
 		$columnList = array('file_srl', 'uploaded_filename');
29 29
 		$output = executeQueryArray('file.getModuleFiles',$args, $columnList);
30
-		if(!$output) return $output;
30
+		if(!$output) {
31
+			return $output;
32
+		}
31 33
 		$files = $output->data;
32 34
 		// Remove from the DB
33 35
 		$args->module_srl = $module_srl;
34 36
 		$output = executeQuery('file.deleteModuleFiles', $args);
35
-		if(!$output->toBool()) return $output;
37
+		if(!$output->toBool()) {
38
+			return $output;
39
+		}
36 40
 		// Remove the file
37 41
 		FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
38 42
 		FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
@@ -45,10 +49,14 @@  discard block
 block discarded – undo
45 49
 			FileHandler::removeFile($uploaded_filename);
46 50
 
47 51
 			$path_info = pathinfo($uploaded_filename);
48
-			if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
52
+			if(!in_array($path_info['dirname'], $path)) {
53
+				$path[] = $path_info['dirname'];
54
+			}
49 55
 		}
50 56
 		// Remove a file directory of the document
51
-		for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
57
+		for($i=0;$i<count($path);$i++) {
58
+			FileHandler::removeBlankDir($path[$i]);
59
+		}
52 60
 
53 61
 		return $output;
54 62
 	}
@@ -62,18 +70,27 @@  discard block
 block discarded – undo
62 70
 	{
63 71
 		// An error appears if no document is selected
64 72
 		$cart = Context::get('cart');
65
-		if(!$cart) return $this->stop('msg_file_cart_is_null');
66
-		if(!is_array($cart)) $file_srl_list= explode('|@|', $cart);
67
-		else $file_srl_list = $cart;
73
+		if(!$cart) {
74
+			return $this->stop('msg_file_cart_is_null');
75
+		}
76
+		if(!is_array($cart)) {
77
+			$file_srl_list= explode('|@|', $cart);
78
+		} else {
79
+			$file_srl_list = $cart;
80
+		}
68 81
 		$file_count = count($file_srl_list);
69
-		if(!$file_count) return $this->stop('msg_file_cart_is_null');
82
+		if(!$file_count) {
83
+			return $this->stop('msg_file_cart_is_null');
84
+		}
70 85
 
71 86
 		$oFileController = getController('file');
72 87
 		// Delete the post
73 88
 		for($i=0;$i<$file_count;$i++)
74 89
 		{
75 90
 			$file_srl = trim($file_srl_list[$i]);
76
-			if(!$file_srl) continue;
91
+			if(!$file_srl) {
92
+				continue;
93
+			}
77 94
 
78 95
 			$oFileController->deleteFile($file_srl);
79 96
 		}
@@ -117,8 +134,11 @@  discard block
 block discarded – undo
117 134
 		// Get variables
118 135
 		$module_srl = Context::get('target_module_srl');
119 136
 		// In order to configure multiple modules at once
120
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
121
-		else $module_srl = array($module_srl);
137
+		if(preg_match('/^([0-9,]+)$/',$module_srl)) {
138
+			$module_srl = explode(',',$module_srl);
139
+		} else {
140
+			$module_srl = array($module_srl);
141
+		}
122 142
 
123 143
 		$download_grant = Context::get('download_grant');
124 144
 
@@ -130,8 +150,11 @@  discard block
 block discarded – undo
130 150
 		$file_config->allowed_attach_size = Context::get('allowed_attach_size');
131 151
 		$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
132 152
 
133
-		if(!is_array($download_grant)) $file_config->download_grant = explode('|@|',$download_grant);
134
-		else $file_config->download_grant = $download_grant;
153
+		if(!is_array($download_grant)) {
154
+			$file_config->download_grant = explode('|@|',$download_grant);
155
+		} else {
156
+			$file_config->download_grant = $download_grant;
157
+		}
135 158
 
136 159
 		//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
137 160
 		$userFileAllowSize = FileHandler::returnbytes($file_config->allowed_filesize.'M');
@@ -140,14 +163,17 @@  discard block
 block discarded – undo
140 163
 		$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
141 164
 		$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
142 165
 
143
-		if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
144
-			return new BaseObject(-1, 'input size over than config in php.ini');
166
+		if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie) {
167
+					return new BaseObject(-1, 'input size over than config in php.ini');
168
+		}
145 169
 
146 170
 		$oModuleController = getController('module');
147 171
 		for($i=0;$i<count($module_srl);$i++)
148 172
 		{
149 173
 			$srl = trim($module_srl[$i]);
150
-			if(!$srl) continue;
174
+			if(!$srl) {
175
+				continue;
176
+			}
151 177
 			$oModuleController->insertModulePartConfig('file',$srl,$file_config);
152 178
 		}
153 179
 
@@ -174,8 +200,11 @@  discard block
 block discarded – undo
174 200
 
175 201
 		if($output->file_srl)
176 202
 		{
177
-			if($_SESSION['file_management'][$output->file_srl]) unset($_SESSION['file_management'][$output->file_srl]);
178
-			else $_SESSION['file_management'][$output->file_srl] = true;
203
+			if($_SESSION['file_management'][$output->file_srl]) {
204
+				unset($_SESSION['file_management'][$output->file_srl]);
205
+			} else {
206
+				$_SESSION['file_management'][$output->file_srl] = true;
207
+			}
179 208
 		}
180 209
 	}
181 210
 }
Please login to merge, or discard this patch.
modules/importer/importer.admin.controller.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@
 block discarded – undo
276 276
 
277 277
 	/**
278 278
 	 * Migrate data after completing xml file extraction
279
-	 * @return void
279
+	 * @return BaseObject|null
280 280
 	 */
281 281
 	function procImporterAdminImport()
282 282
 	{
Please login to merge, or discard this patch.
Spacing   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 		$filename = Context::get('filename');
44 44
 		$isExists = 'false';
45 45
 
46
-		if(strncasecmp('http://', $filename, 7) === 0)
46
+		if (strncasecmp('http://', $filename, 7) === 0)
47 47
 		{
48
-			if(ini_get('allow_url_fopen'))
48
+			if (ini_get('allow_url_fopen'))
49 49
 			{
50 50
 				$fp = @fopen($filename, "r");
51
-				if($fp)
51
+				if ($fp)
52 52
 				{
53 53
 					$str = fgets($fp, 100);
54
-					if(strlen($str) > 0)
54
+					if (strlen($str) > 0)
55 55
 					{
56 56
 						$isExists = 'true';
57 57
 						$type = 'XML';
58
-						if(stristr($str, 'tattertools')) $type = 'TTXML';
58
+						if (stristr($str, 'tattertools')) $type = 'TTXML';
59 59
 
60 60
 						$this->add('type', $type);
61 61
 					}
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
 		{
73 73
 			$realPath = FileHandler::getRealPath($filename);
74 74
 
75
-			if(file_exists($realPath) && is_file($realPath)) $isExists = 'true';
75
+			if (file_exists($realPath) && is_file($realPath)) $isExists = 'true';
76 76
 			$this->add('exists', $isExists);
77 77
 
78
-			if($isExists == 'true')
78
+			if ($isExists == 'true')
79 79
 			{
80 80
 				$type = 'XML';
81 81
 
82 82
 				$fp = fopen($realPath, "r");
83 83
 				$str = fgets($fp, 100);
84
-				if(stristr($str, 'tattertools')) $type = 'TTXML';
84
+				if (stristr($str, 'tattertools')) $type = 'TTXML';
85 85
 				fclose($fp);
86 86
 
87 87
 				$this->add('type', $type);
@@ -107,16 +107,16 @@  discard block
 block discarded – undo
107 107
 
108 108
 		/* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다.
109 109
 		   CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */
110
-		$db_info = Context::getDBInfo ();
111
-		if($db_info->db_type != "cubrid")
110
+		$db_info = Context::getDBInfo();
111
+		if ($db_info->db_type != "cubrid")
112 112
 		{
113 113
 			$output = executeQuery('importer.updateDocumentSync'.$postFix);
114 114
 			$output = executeQuery('importer.updateCommentSync'.$postFix);
115 115
 		}
116 116
 		else
117 117
 		{
118
-			$output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix);
119
-			if(is_array ($output->data) && count ($output->data))
118
+			$output = executeQueryArray('importer.getDocumentMemberSrlWithUserID'.$postFix);
119
+			if (is_array($output->data) && count($output->data))
120 120
 			{
121 121
 				$success_count = 0;
122 122
 				$error_count = 0;
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 				{
126 126
 					$args->user_id = $val->user_id;
127 127
 					$args->member_srl = $val->member_srl;
128
-					$tmp = executeQuery ('importer.updateDocumentSyncForCUBRID'.$postFix, $args);
129
-					if($tmp->toBool () === true)
128
+					$tmp = executeQuery('importer.updateDocumentSyncForCUBRID'.$postFix, $args);
129
+					if ($tmp->toBool() === true)
130 130
 					{
131 131
 						$success_count++;
132 132
 					}
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 				}
139 139
 			} // documents section
140 140
 
141
-			$output = executeQueryArray ('importer.getCommentMemberSrlWithUserID'.$postFix);
142
-			if(is_array ($output->data) && count ($output->data))
141
+			$output = executeQueryArray('importer.getCommentMemberSrlWithUserID'.$postFix);
142
+			if (is_array($output->data) && count($output->data))
143 143
 			{
144 144
 				$success_count = 0;
145 145
 				$error_count = 0;
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
 				{
149 149
 					$args->user_id = $val->user_id;
150 150
 					$args->member_srl = $val->member_srl;
151
-					$tmp = executeQuery ('importer.updateCommentSyncForCUBRID'.$postFix, $args);
152
-					if($tmp->toBool () === true)
151
+					$tmp = executeQuery('importer.updateCommentSyncForCUBRID'.$postFix, $args);
152
+					if ($tmp->toBool() === true)
153 153
 					{
154 154
 						$success_count++;
155 155
 					}
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 		// Extract and cache information from the xml file
179 179
 		$oExtract = new extract();
180 180
 
181
-		switch($type)
181
+		switch ($type)
182 182
 		{
183 183
 			case 'member' :
184
-				$output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>');
185
-				if($output->toBool()) $oExtract->saveItems();
184
+				$output = $oExtract->set($xml_file, '<members ', '</members>', '<member>', '</member>');
185
+				if ($output->toBool()) $oExtract->saveItems();
186 186
 				break;
187 187
 			case 'message' :
188
-				$output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>');
189
-				if($output->toBool()) $oExtract->saveItems();
188
+				$output = $oExtract->set($xml_file, '<messages ', '</messages>', '<message>', '</message>');
189
+				if ($output->toBool()) $oExtract->saveItems();
190 190
 				break;
191 191
 			case 'ttxml' :
192 192
 				// Category information
@@ -199,12 +199,12 @@  discard block
 block discarded – undo
199 199
 					while (!feof($oExtract->fd))
200 200
 					{
201 201
 						$str = fgets($oExtract->fd, 1024);
202
-						if(strstr($str, '<category>'))
202
+						if (strstr($str, '<category>'))
203 203
 						{
204 204
 							$started = true;
205 205
 							$str = strstr($str, '<category>');
206 206
 						}
207
-						if(substr($str,0,strlen('<post ')) == '<post ') break;
207
+						if (substr($str, 0, strlen('<post ')) == '<post ') break;
208 208
 						if ($started) $buff .= $str;
209 209
 					}
210 210
 					$buff = '<categories>'.$buff.'</categories>';
@@ -214,22 +214,22 @@  discard block
 block discarded – undo
214 214
 
215 215
 					// Guestbook information
216 216
 					$output = $oExtract->set($xml_file, '', '', '', '');
217
-					if($output->toBool())
217
+					if ($output->toBool())
218 218
 					{
219 219
 						$started = false;
220 220
 						$buff = '';
221 221
 						while (!feof($oExtract->fd))
222 222
 						{
223 223
 							$str = fgets($oExtract->fd, 1024);
224
-							if(strstr($str, '<guestbook>'))
224
+							if (strstr($str, '<guestbook>'))
225 225
 							{
226 226
 								$started = true;
227 227
 								$str = strstr($str, '<guestbook>');
228 228
 							}
229
-							if($started)
229
+							if ($started)
230 230
 							{
231 231
 								$pos = strpos($str, '</guestbook>');
232
-								if($pos !== false)
232
+								if ($pos !== false)
233 233
 								{
234 234
 									$buff .= substr($str, 0, $pos + strlen('</guestbook>'));
235 235
 									break;
@@ -241,37 +241,37 @@  discard block
 block discarded – undo
241 241
 						$guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml');
242 242
 						FileHandler::writeFile($guestbook_filename, $buff);
243 243
 						// Individual items
244
-						$output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>');
245
-						if($output->toBool()) $oExtract->saveItems();
244
+						$output = $oExtract->set($xml_file, '<blog', '</blog>', '<post ', '</post>');
245
+						if ($output->toBool()) $oExtract->saveItems();
246 246
 					}
247 247
 				}
248 248
 				break;
249 249
 			default :
250 250
 				// First get category information
251
-				$output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>');
252
-				if($output->toBool())
251
+				$output = $oExtract->set($xml_file, '<categories>', '</categories>', '<category', '</category>');
252
+				if ($output->toBool())
253 253
 				{
254 254
 					$oExtract->mergeItems('category.xml');
255 255
 					// Get each item
256
-					$output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>');
257
-					if($output->toBool()) $oExtract->saveItems();
256
+					$output = $oExtract->set($xml_file, '<posts ', '</posts>', '<post>', '</post>');
257
+					if ($output->toBool()) $oExtract->saveItems();
258 258
 				}
259 259
 				break;
260 260
 		}
261 261
 
262
-		if(!$output->toBool())
262
+		if (!$output->toBool())
263 263
 		{
264
-			$this->add('error',0);
265
-			$this->add('status',-1);
264
+			$this->add('error', 0);
265
+			$this->add('status', -1);
266 266
 			$this->setMessage($output->getMessage());
267 267
 			return;
268 268
 		}
269 269
 		// Notify that all data completely extracted
270
-		$this->add('type',$type);
271
-		$this->add('total',$oExtract->getTotalCount());
272
-		$this->add('cur',0);
270
+		$this->add('type', $type);
271
+		$this->add('total', $oExtract->getTotalCount());
272
+		$this->add('cur', 0);
273 273
 		$this->add('key', $oExtract->getKey());
274
-		$this->add('status',0);
274
+		$this->add('status', 0);
275 275
 	}
276 276
 
277 277
 	/**
@@ -291,19 +291,19 @@  discard block
 block discarded – undo
291 291
 		$this->unit_count = Context::get('unit_count');
292 292
 		// Check if an index file exists
293 293
 		$index_file = './files/cache/importer/'.$key.'/index';
294
-		if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file');
294
+		if (!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file');
295 295
 
296
-		switch($type)
296
+		switch ($type)
297 297
 		{
298 298
 			case 'ttxml' :
299
-				if(!$target_module) return new BaseObject(-1,'msg_invalid_request');
299
+				if (!$target_module) return new BaseObject(-1, 'msg_invalid_request');
300 300
 
301 301
 				$oModuleModel = getModel('module');
302 302
 				$columnList = array('module_srl', 'module');
303 303
 				$target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList);
304 304
 
305
-				$ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php');
306
-				if($ttimporter) require_once($ttimporter);
305
+				$ttimporter = FileHandler::exists(_XE_PATH_.'modules/importer/ttimport.class.php');
306
+				if ($ttimporter) require_once($ttimporter);
307 307
 
308 308
 				$oTT = new ttimport();
309 309
 				$cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module);
@@ -316,23 +316,23 @@  discard block
 block discarded – undo
316 316
 				break;
317 317
 			case 'module' :
318 318
 				// Check if the target module exists
319
-				if(!$target_module) return new BaseObject(-1,'msg_invalid_request');
319
+				if (!$target_module) return new BaseObject(-1, 'msg_invalid_request');
320 320
 				$cur = $this->importModule($key, $cur, $index_file, $target_module);
321 321
 				break;
322 322
 		}
323 323
 		// Notify that all data completely extracted
324
-		$this->add('type',$type);
325
-		$this->add('total',$total);
326
-		$this->add('cur',$cur);
324
+		$this->add('type', $type);
325
+		$this->add('total', $total);
326
+		$this->add('cur', $cur);
327 327
 		$this->add('key', $key);
328 328
 		$this->add('target_module', $target_module);
329 329
 		// When completing, success message appears and remove the cache files
330
-		if($total <= $cur)
330
+		if ($total <= $cur)
331 331
 		{
332
-			$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) );
332
+			$this->setMessage(sprintf(Context::getLang('msg_import_finished'), $cur, $total));
333 333
 			FileHandler::removeDir('./files/cache/importer/'.$key);
334 334
 		}
335
-		else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) );
335
+		else $this->setMessage(sprintf(Context::getLang('msg_importing'), $total, $cur));
336 336
 	}
337 337
 
338 338
 	/**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 */
345 345
 	function importMember($key, $cur, $index_file)
346 346
 	{
347
-		if(!$cur) $cur = 0;
347
+		if (!$cur) $cur = 0;
348 348
 		// Create the xmlParser object
349 349
 		$oXmlParser = new XmlParser();
350 350
 		// Create objects for importing member information
@@ -357,30 +357,30 @@  discard block
 block discarded – undo
357 357
 		$oModuleModel = getModel('module');
358 358
 		$member_config = $oModuleModel->getModuleConfig('member');
359 359
 		// Open an index file
360
-		$f = fopen($index_file,"r");
360
+		$f = fopen($index_file, "r");
361 361
 		// Pass if already read
362
-		for($i=0;$i<$cur;$i++) fgets($f, 1024);
362
+		for ($i = 0; $i < $cur; $i++) fgets($f, 1024);
363 363
 		// Read by each line until the condition meets
364
-		for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)
364
+		for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++)
365 365
 		{
366
-			if(feof($f)) break;
366
+			if (feof($f)) break;
367 367
 			// Find a given location
368 368
 			$target_file = trim(fgets($f, 1024));
369 369
 			// Load and parse the file
370 370
 			$xmlObj = $oXmlParser->loadXmlFile($target_file);
371 371
 			FileHandler::removeFile($target_file);
372
-			if(!$xmlObj) continue;
372
+			if (!$xmlObj) continue;
373 373
 			// List Objects
374 374
 			$obj = new stdClass();
375 375
 			$obj->user_id = base64_decode($xmlObj->member->user_id->body);
376 376
 			$obj->password = base64_decode($xmlObj->member->password->body);
377 377
 			$obj->user_name = base64_decode($xmlObj->member->user_name->body);
378 378
 			$obj->nick_name = base64_decode($xmlObj->member->nick_name->body);
379
-			if(!$obj->user_name) $obj->user_name = $obj->nick_name;
379
+			if (!$obj->user_name) $obj->user_name = $obj->nick_name;
380 380
 			$obj->email = base64_decode($xmlObj->member->email->body);
381 381
 			$obj->homepage = base64_decode($xmlObj->member->homepage->body);
382 382
 			$obj->blog = base64_decode($xmlObj->member->blog->body);
383
-			$obj->birthday = substr(base64_decode($xmlObj->member->birthday->body),0,8);
383
+			$obj->birthday = substr(base64_decode($xmlObj->member->birthday->body), 0, 8);
384 384
 			$obj->allow_mailing = base64_decode($xmlObj->member->allow_mailing->body);
385 385
 			$obj->point = base64_decode($xmlObj->member->point->body);
386 386
 			$obj->image_nickname = base64_decode($xmlObj->member->image_nickname->buff->body);
@@ -390,26 +390,26 @@  discard block
 block discarded – undo
390 390
 			$obj->regdate = base64_decode($xmlObj->member->regdate->body);
391 391
 			$obj->last_login = base64_decode($xmlObj->member->last_login->body);
392 392
 
393
-			if($xmlObj->member->extra_vars)
393
+			if ($xmlObj->member->extra_vars)
394 394
 			{
395
-				foreach($xmlObj->member->extra_vars as $key => $val)
395
+				foreach ($xmlObj->member->extra_vars as $key => $val)
396 396
 				{
397
-					if(in_array($key, array('node_name','attrs','body'))) continue;
397
+					if (in_array($key, array('node_name', 'attrs', 'body'))) continue;
398 398
 					$obj->extra_vars->{$key} = base64_decode($val->body);
399 399
 				}
400 400
 			}
401 401
 			// Create url for homepage and blog
402
-			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage;
402
+			if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage;
403 403
 			// email address column
404 404
 			$obj->email_address = $obj->email;
405 405
 			list($obj->email_id, $obj->email_host) = explode('@', $obj->email);
406 406
 			// Set the mailing option
407
-			if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N';
407
+			if ($obj->allow_mailing != 'Y') $obj->allow_mailing = 'N';
408 408
 			// Set the message option
409 409
 			$obj->allow_message = 'Y';
410
-			if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y';
410
+			if (!in_array($obj->allow_message, array('Y', 'N', 'F'))) $obj->allow_message = 'Y';
411 411
 			// Get member-join date if the last login time is not found
412
-			if(!$obj->last_login) $obj->last_login = $obj->regdate;
412
+			if (!$obj->last_login) $obj->last_login = $obj->regdate;
413 413
 			// Get a member_srl
414 414
 			$obj->member_srl = getNextSequence();
415 415
 			$obj->list_order = -1 * $obj->member_srl;
@@ -421,63 +421,63 @@  discard block
 block discarded – undo
421 421
 			$nick_args = new stdClass;
422 422
 			$nick_args->nick_name = $obj->nick_name;
423 423
 			$nick_output = executeQuery('member.getMemberSrl', $nick_args);
424
-			if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl;
424
+			if (!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl;
425 425
 			// Add a member
426 426
 			$output = executeQuery('member.insertMember', $obj);
427 427
 
428
-			if($output->toBool() && !($obj->password))
428
+			if ($output->toBool() && !($obj->password))
429 429
 			{
430 430
 				// Send a mail telling the user to reset his password.
431 431
 				$oMail = new Mail();
432
-				$oMail->setTitle("Password update for your " . getFullSiteUrl() . " account");
433
-				$webmaster_name = $member_config->webmaster_name?$member_config->webmaster_name:'Webmaster';
432
+				$oMail->setTitle("Password update for your ".getFullSiteUrl()." account");
433
+				$webmaster_name = $member_config->webmaster_name ? $member_config->webmaster_name : 'Webmaster';
434 434
 				$oMail->setContent("Dear $obj->user_name, <br /><br />
435 435
 						We recently migrated our phpBB forum to XpressEngine. Since you password was encrypted we could not migrate it too, so please reset it by following this link:
436
-						<a href='" . getFullSiteUrl() . "/?act=dispMemberFindAccount' >" . getFullSiteUrl() . "?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br />
436
+						<a href='".getFullSiteUrl()."/?act=dispMemberFindAccount' >".getFullSiteUrl()."?act=dispMemberFindAccount</a>. You need to enter you email address and hit the 'Find account' button. You will then receive an email with a new, generated password that you can change after login. <br /><br />
437 437
 
438 438
 						Thank you for your understanding,<br />
439 439
 						{$webmaster_name}"
440 440
 				);
441 441
 				$oMail->setSender($webmaster_name, $member_config->webmaster_email);
442
-				$oMail->setReceiptor( $obj->user_name, $obj->email);
442
+				$oMail->setReceiptor($obj->user_name, $obj->email);
443 443
 				$oMail->send();
444 444
 			}
445 445
 
446 446
 			// add group join/image name-mark-signiture and so on if a new member successfully added
447
-			if($output->toBool())
447
+			if ($output->toBool())
448 448
 			{
449 449
 				// Join to the default group
450 450
 				$obj->group_srl = $default_group_srl;
451
-				executeQuery('member.addMemberToGroup',$obj);
451
+				executeQuery('member.addMemberToGroup', $obj);
452 452
 				// Image name
453
-				if($obj->image_nickname)
453
+				if ($obj->image_nickname)
454 454
 				{
455 455
 					$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl));
456 456
 					$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
457 457
 					FileHandler::writeFile($target_filename, $obj->image_nickname);
458 458
 				}
459 459
 				// Image mark
460
-				if($obj->image_mark && file_exists($obj->image_mark))
460
+				if ($obj->image_mark && file_exists($obj->image_mark))
461 461
 				{
462 462
 					$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl));
463 463
 					$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
464 464
 					FileHandler::writeFile($target_filename, $obj->image_mark);
465 465
 				}
466 466
 				// Profile image
467
-				if($obj->profile_image)
467
+				if ($obj->profile_image)
468 468
 				{
469 469
 					$target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl));
470 470
 					$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
471 471
 					FileHandler::writeFile($target_filename, $obj->profile_image);
472 472
 				}
473 473
 				// Signiture
474
-				if($obj->signature)
474
+				if ($obj->signature)
475 475
 				{
476 476
 					$signature = removeHackTag($obj->signature);
477 477
 					$signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
478 478
 
479 479
 					$target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl));
480
-					if(!is_dir($target_path)) FileHandler::makeDir($target_path);
480
+					if (!is_dir($target_path)) FileHandler::makeDir($target_path);
481 481
 					$target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl);
482 482
 
483 483
 					FileHandler::writeFile($target_filename, $signature_buff);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 
488 488
 		fclose($f);
489 489
 
490
-		return $idx-1;
490
+		return $idx - 1;
491 491
 	}
492 492
 
493 493
 	/**
@@ -499,58 +499,58 @@  discard block
 block discarded – undo
499 499
 	 */
500 500
 	function importMessage($key, $cur, $index_file)
501 501
 	{
502
-		if(!$cur) $cur = 0;
502
+		if (!$cur) $cur = 0;
503 503
 		// Create the xmlParser object
504 504
 		$oXmlParser = new XmlParser();
505 505
 		// Open an index file
506
-		$f = fopen($index_file,"r");
506
+		$f = fopen($index_file, "r");
507 507
 		// Pass if already read
508
-		for($i=0;$i<$cur;$i++) fgets($f, 1024);
508
+		for ($i = 0; $i < $cur; $i++) fgets($f, 1024);
509 509
 		// Read each line until the condition meets
510
-		for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)
510
+		for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++)
511 511
 		{
512
-			if(feof($f)) break;
512
+			if (feof($f)) break;
513 513
 			// Find a location
514 514
 			$target_file = trim(fgets($f, 1024));
515 515
 			// Load and parse the file
516 516
 			$xmlObj = $oXmlParser->loadXmlFile($target_file);
517 517
 			FileHandler::removeFile($target_file);
518
-			if(!$xmlObj) continue;
518
+			if (!$xmlObj) continue;
519 519
 			// List objects
520 520
 			$obj = null;
521 521
 			$obj->receiver = base64_decode($xmlObj->message->receiver->body);
522 522
 			$obj->sender = base64_decode($xmlObj->message->sender->body);
523 523
 			$obj->title = base64_decode($xmlObj->message->title->body);
524 524
 			$obj->content = base64_decode($xmlObj->message->content->body);
525
-			$obj->readed = base64_decode($xmlObj->message->readed->body)=='Y'?'Y':'N';
525
+			$obj->readed = base64_decode($xmlObj->message->readed->body) == 'Y' ? 'Y' : 'N';
526 526
 			$obj->regdate = base64_decode($xmlObj->message->regdate->body);
527 527
 			$obj->readed_date = base64_decode($xmlObj->message->readed_date->body);
528 528
 			// Get member_srl of sender/recipient (If not exists, pass)
529
-			if(!$obj->sender) continue;
529
+			if (!$obj->sender) continue;
530 530
 			$sender_args->user_id = $obj->sender;
531
-			$sender_output = executeQuery('member.getMemberInfo',$sender_args);
531
+			$sender_output = executeQuery('member.getMemberInfo', $sender_args);
532 532
 			$sender_srl = $sender_output->data->member_srl;
533
-			if(!$sender_srl)
533
+			if (!$sender_srl)
534 534
 			{
535 535
 				unset($sender_args);
536 536
 				$sender_args->email_address = $obj->sender;
537
-				$sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args);
537
+				$sender_output = executeQuery('member.getMemberInfoByEmailAddress', $sender_args);
538 538
 				$sender_srl = $sender_output->data->member_srl;
539 539
 			}
540
-			if(!$sender_srl) continue;
540
+			if (!$sender_srl) continue;
541 541
 
542 542
 			$receiver_args->user_id = $obj->receiver;
543
-			if(!$obj->receiver) continue;
544
-			$receiver_output = executeQuery('member.getMemberInfo',$receiver_args);
543
+			if (!$obj->receiver) continue;
544
+			$receiver_output = executeQuery('member.getMemberInfo', $receiver_args);
545 545
 			$receiver_srl = $receiver_output->data->member_srl;
546
-			if(!$receiver_srl)
546
+			if (!$receiver_srl)
547 547
 			{
548 548
 				unset($receiver_args);
549 549
 				$receiver_args->email_address = $obj->receiver;
550
-				$receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args);
550
+				$receiver_output = executeQuery('member.getMemberInfoByEmailAddress', $receiver_args);
551 551
 				$receiver_srl = $receiver_output->data->member_srl;
552 552
 			}
553
-			if(!$receiver_srl) continue;
553
+			if (!$receiver_srl) continue;
554 554
 			// Message to save into sender's message box
555 555
 			$sender_args->sender_srl = $sender_srl;
556 556
 			$sender_args->receiver_srl = $receiver_srl;
@@ -565,13 +565,13 @@  discard block
 block discarded – undo
565 565
 			$sender_args->list_order = $sender_args->message_srl * -1;
566 566
 
567 567
 			$output = executeQuery('communication.sendMessage', $sender_args);
568
-			if($output->toBool())
568
+			if ($output->toBool())
569 569
 			{
570 570
 				// Message to save into recipient's massage box
571 571
 				$receiver_args->message_srl = $sender_args->related_srl;
572
-				$receiver_args->list_order = $sender_args->related_srl*-1;
572
+				$receiver_args->list_order = $sender_args->related_srl * -1;
573 573
 				$receiver_args->sender_srl = $sender_srl;
574
-				if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl;
574
+				if (!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl;
575 575
 				$receiver_args->receiver_srl = $receiver_srl;
576 576
 				$receiver_args->message_type = 'R';
577 577
 				$receiver_args->title = $obj->title;
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
 		fclose($f);
587 587
 
588
-		return $idx-1;
588
+		return $idx - 1;
589 589
 	}
590 590
 
591 591
 	/**
@@ -605,10 +605,10 @@  discard block
 block discarded – undo
605 605
 		$oDocumentModel = getModel('document');
606 606
 		$category_list = $category_titles = array();
607 607
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
608
-		if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
608
+		if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
609 609
 		// Extract category information
610 610
 		$category_file = preg_replace('/index$/i', 'category.xml', $index_file);
611
-		if(file_exists($category_file))
611
+		if (file_exists($category_file))
612 612
 		{
613 613
 			$buff = FileHandler::readFile($category_file);
614 614
 
@@ -616,14 +616,14 @@  discard block
 block discarded – undo
616 616
 			$xmlDoc = $this->oXmlParser->loadXmlFile($category_file);
617 617
 
618 618
 			$categories = $xmlDoc->items->category;
619
-			if($categories)
619
+			if ($categories)
620 620
 			{
621
-				if(!is_array($categories)) $categories = array($categories);
621
+				if (!is_array($categories)) $categories = array($categories);
622 622
 				$match_sequence = array();
623
-				foreach($categories as $k => $v)
623
+				foreach ($categories as $k => $v)
624 624
 				{
625 625
 					$category = trim(base64_decode($v->body));
626
-					if(!$category || $category_titles[$category]) continue;
626
+					if (!$category || $category_titles[$category]) continue;
627 627
 
628 628
 					$sequence = $v->attrs->sequence;
629 629
 					$parent = $v->attrs->parent;
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
 					$obj = null;
632 632
 					$obj->title = $category;
633 633
 					$obj->module_srl = $module_srl;
634
-					if($parent) $obj->parent_srl = $match_sequence[$parent];
634
+					if ($parent) $obj->parent_srl = $match_sequence[$parent];
635 635
 
636 636
 					$output = $oDocumentController->insertCategory($obj);
637
-					if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl');
637
+					if ($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl');
638 638
 				}
639 639
 				$oDocumentController = getController('document');
640 640
 				$oDocumentController->makeCategoryFile($module_srl);
@@ -644,31 +644,31 @@  discard block
 block discarded – undo
644 644
 
645 645
 		$category_list = $category_titles = array();
646 646
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
647
-		if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
647
+		if (count($category_list)) foreach ($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
648 648
 
649 649
 		$ek_args->module_srl = $module_srl;
650 650
 		$output = executeQueryArray('document.getDocumentExtraKeys', $ek_args);
651
-		if($output->data)
651
+		if ($output->data)
652 652
 		{
653
-			foreach($output->data as $key => $val) $extra_keys[$val->eid] = true;
653
+			foreach ($output->data as $key => $val) $extra_keys[$val->eid] = true;
654 654
 		}
655 655
 
656
-		if(!$cur) $cur = 0;
656
+		if (!$cur) $cur = 0;
657 657
 		// Open an index file
658
-		$f = fopen($index_file,"r");
658
+		$f = fopen($index_file, "r");
659 659
 		// Pass if already read
660
-		for($i=0;$i<$cur;$i++) fgets($f, 1024);
660
+		for ($i = 0; $i < $cur; $i++) fgets($f, 1024);
661 661
 		// Read each line until the condition meets
662
-		for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)
662
+		for ($idx = $cur; $idx < $cur + $this->unit_count; $idx++)
663 663
 		{
664
-			if(feof($f)) break;
664
+			if (feof($f)) break;
665 665
 			// Find a location
666 666
 			$target_file = trim(fgets($f, 1024));
667 667
 
668
-			if(!file_exists($target_file)) continue;
668
+			if (!file_exists($target_file)) continue;
669 669
 			// Importing data from now on
670
-			$fp = fopen($target_file,"r");
671
-			if(!$fp) continue;
670
+			$fp = fopen($target_file, "r");
671
+			if (!$fp) continue;
672 672
 
673 673
 			$obj = new stdClass;
674 674
 			$obj->module_srl = $module_srl;
@@ -680,51 +680,51 @@  discard block
 block discarded – undo
680 680
 			$started = false;
681 681
 			$buff = array();
682 682
 			// Start from the body data
683
-			while(!feof($fp))
683
+			while (!feof($fp))
684 684
 			{
685 685
 				$str = fgets($fp, 1024);
686 686
 				// Prepare an item
687
-				if(trim($str) == '<post>')
687
+				if (trim($str) == '<post>')
688 688
 				{
689 689
 					$started = true;
690 690
 					// Trackback inserted
691 691
 				}
692
-				else if(substr($str,0,11) == '<trackbacks')
692
+				else if (substr($str, 0, 11) == '<trackbacks')
693 693
 				{
694 694
 					$obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl);
695 695
 					continue;
696 696
 					// Comments inserted
697 697
 				}
698
-				else if(substr($str,0,9) == '<comments')
698
+				else if (substr($str, 0, 9) == '<comments')
699 699
 				{
700 700
 					$obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl);
701 701
 					continue;
702 702
 					// Attachment inserted
703 703
 				}
704
-				else if(substr($str,0,9) == '<attaches')
704
+				else if (substr($str, 0, 9) == '<attaches')
705 705
 				{
706 706
 					$obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files);
707 707
 					continue;
708 708
 					// When starting extra variabls
709 709
 				}
710
-				elseif(trim($str) == '<extra_vars>')
710
+				elseif (trim($str) == '<extra_vars>')
711 711
 				{
712 712
 					$extra_vars = $this->importExtraVars($fp);
713 713
 					continue;
714 714
 				}
715 715
 
716
-				if($started) $buff[] = $str;
716
+				if ($started) $buff[] = $str;
717 717
 			}
718 718
 
719 719
 			$xmlDoc = $this->oXmlParser->parse(implode('', $buff));
720 720
 
721 721
 			$category = base64_decode($xmlDoc->post->category->body);
722
-			if($category_titles[$category]) $obj->category_srl = $category_titles[$category];
722
+			if ($category_titles[$category]) $obj->category_srl = $category_titles[$category];
723 723
 
724 724
 			$obj->member_srl = 0;
725 725
 
726
-			$obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N';
727
-			$obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public');
726
+			$obj->is_notice = base64_decode($xmlDoc->post->is_notice->body) == 'Y' ? 'Y' : 'N';
727
+			$obj->status = base64_decode($xmlDoc->post->is_secret->body) == 'Y' ? $oDocumentModel->getConfigStatus('secret') : $oDocumentModel->getConfigStatus('public');
728 728
 			$obj->title = base64_decode($xmlDoc->post->title->body);
729 729
 			$obj->content = base64_decode($xmlDoc->post->content->body);
730 730
 			$obj->readed_count = base64_decode($xmlDoc->post->readed_count->body);
@@ -733,39 +733,39 @@  discard block
 block discarded – undo
733 733
 			$obj->password = base64_decode($xmlDoc->post->password->body);
734 734
 			$obj->user_name = base64_decode($xmlDoc->post->user_name->body);
735 735
 			$obj->nick_name = base64_decode($xmlDoc->post->nick_name->body);
736
-			if(!$obj->user_name) $obj->user_name = $obj->nick_name;
736
+			if (!$obj->user_name) $obj->user_name = $obj->nick_name;
737 737
 			$obj->user_id = base64_decode($xmlDoc->post->user_id->body);
738 738
 			$obj->email_address = base64_decode($xmlDoc->post->email->body);
739 739
 			$obj->homepage = base64_decode($xmlDoc->post->homepage->body);
740
-			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage;
740
+			if ($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage;
741 741
 			$obj->tags = base64_decode($xmlDoc->post->tags->body);
742 742
 			$obj->regdate = base64_decode($xmlDoc->post->regdate->body);
743 743
 			$obj->last_update = base64_decode($xmlDoc->post->update->body);
744 744
 			$obj->last_updater = base64_decode($xmlDoc->post->last_updater->body);
745
-			if(!$obj->last_update) $obj->last_update = $obj->regdate;
745
+			if (!$obj->last_update) $obj->last_update = $obj->regdate;
746 746
 			$obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body);
747
-			$obj->list_order = $obj->update_order = $obj->document_srl*-1;
748
-			$obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY';
749
-			$obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N';
747
+			$obj->list_order = $obj->update_order = $obj->document_srl * -1;
748
+			$obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body) != 'N' ? 'ALLOW' : 'DENY';
749
+			$obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body) != 'N' ? 'Y' : 'N';
750 750
 			$obj->notify_message = base64_decode($xmlDoc->post->is_notice->body);
751 751
 			// Change content information (attachment)
752
-			if(count($files))
752
+			if (count($files))
753 753
 			{
754
-				foreach($files as $key => $val)
754
+				foreach ($files as $key => $val)
755 755
 				{
756
-					$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content);
757
-					$obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content);
758
-					$obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i','"'.$val.'"',$obj->content);
756
+					$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content);
757
+					$obj->content = preg_replace('/(["\']?).\/files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content);
758
+					$obj->content = preg_replace('/(["\']?)files\/(.+)\/'.preg_quote($key).'([^"\']+)(["\']?)/i', '"'.$val.'"', $obj->content);
759 759
 				}
760 760
 			}
761 761
 
762 762
 			$output = executeQuery('document.insertDocument', $obj);
763 763
 
764
-			if($output->toBool() && $obj->tags)
764
+			if ($output->toBool() && $obj->tags)
765 765
 			{
766
-				$tag_list = explode(',',$obj->tags);
766
+				$tag_list = explode(',', $obj->tags);
767 767
 				$tag_count = count($tag_list);
768
-				for($i=0;$i<$tag_count;$i++)
768
+				for ($i = 0; $i < $tag_count; $i++)
769 769
 				{
770 770
 					$args = new stdClass;
771 771
 					$args->tag_srl = getNextSequence();
@@ -773,17 +773,17 @@  discard block
 block discarded – undo
773 773
 					$args->document_srl = $obj->document_srl;
774 774
 					$args->tag = trim($tag_list[$i]);
775 775
 					$args->regdate = $obj->regdate;
776
-					if(!$args->tag) continue;
776
+					if (!$args->tag) continue;
777 777
 					$output = executeQuery('tag.insertTag', $args);
778 778
 				}
779 779
 
780 780
 			}
781 781
 			// Add extra variables
782
-			if(count($extra_vars))
782
+			if (count($extra_vars))
783 783
 			{
784
-				foreach($extra_vars as $key => $val)
784
+				foreach ($extra_vars as $key => $val)
785 785
 				{
786
-					if(!$val->value) continue;
786
+					if (!$val->value) continue;
787 787
 					unset($e_args);
788 788
 					$e_args->module_srl = $module_srl;
789 789
 					$e_args->document_srl = $obj->document_srl;
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 					$e_args->lang_code = $val->lang_code;
793 793
 					$e_args->eid = $val->eid;
794 794
 					// Create a key for extra vars if not exists (except vars for title and content)
795
-					if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid])
795
+					if (!preg_match('/^(title|content)_(.+)$/i', $e_args->eid) && !$extra_keys[$e_args->eid])
796 796
 					{
797 797
 						unset($ek_args);
798 798
 						$ek_args->module_srl = $module_srl;
@@ -816,9 +816,9 @@  discard block
 block discarded – undo
816 816
 
817 817
 		fclose($f);
818 818
 		// Sync category counts
819
-		if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);
819
+		if (count($category_list)) foreach ($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);
820 820
 
821
-		return $idx-1;
821
+		return $idx - 1;
822 822
 	}
823 823
 
824 824
 	/**
@@ -834,17 +834,17 @@  discard block
 block discarded – undo
834 834
 		$buff = null;
835 835
 		$cnt = 0;
836 836
 
837
-		while(!feof($fp))
837
+		while (!feof($fp))
838 838
 		{
839 839
 			$str = fgets($fp, 1024);
840 840
 			// If </trackbacks> is, break
841
-			if(trim($str) == '</trackbacks>') break;
841
+			if (trim($str) == '</trackbacks>') break;
842 842
 			// If <trackback>, start importing
843
-			if(trim($str) == '<trackback>') $started = true;
843
+			if (trim($str) == '<trackback>') $started = true;
844 844
 
845
-			if($started) $buff .= $str;
845
+			if ($started) $buff .= $str;
846 846
 			// If </trackback>, insert to the DB
847
-			if(trim($str) == '</trackback>')
847
+			if (trim($str) == '</trackback>')
848 848
 			{
849 849
 				$xmlDoc = $this->oXmlParser->parse($buff);
850 850
 
@@ -858,9 +858,9 @@  discard block
 block discarded – undo
858 858
 				$obj->excerpt = base64_decode($xmlDoc->trackback->excerpt->body);
859 859
 				$obj->regdate = base64_decode($xmlDoc->trackback->regdate->body);
860 860
 				$obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body);
861
-				$obj->list_order = -1*$obj->trackback_srl;
861
+				$obj->list_order = -1 * $obj->trackback_srl;
862 862
 				$output = executeQuery('trackback.insertTrackback', $obj);
863
-				if($output->toBool()) $cnt++;
863
+				if ($output->toBool()) $cnt++;
864 864
 
865 865
 				$buff = null;
866 866
 				$started = false;
@@ -884,13 +884,13 @@  discard block
 block discarded – undo
884 884
 
885 885
 		$sequences = array();
886 886
 
887
-		while(!feof($fp))
887
+		while (!feof($fp))
888 888
 		{
889 889
 			$str = fgets($fp, 1024);
890 890
 			// If </comments> is, break
891
-			if(trim($str) == '</comments>') break;
891
+			if (trim($str) == '</comments>') break;
892 892
 			// If <comment> is, start importing
893
-			if(trim($str) == '<comment>')
893
+			if (trim($str) == '<comment>')
894 894
 			{
895 895
 				$started = true;
896 896
 				$obj = new stdClass;
@@ -898,15 +898,15 @@  discard block
 block discarded – undo
898 898
 				$files = array();
899 899
 			}
900 900
 			// If <attaches is, start importing attachments
901
-			if(substr($str,0,9) == '<attaches')
901
+			if (substr($str, 0, 9) == '<attaches')
902 902
 			{
903 903
 				$obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files);
904 904
 				continue;
905 905
 			}
906 906
 
907
-			if($started) $buff .= $str;
907
+			if ($started) $buff .= $str;
908 908
 			// If </comment> is, insert to the DB
909
-			if(trim($str) == '</comment>')
909
+			if (trim($str) == '</comment>')
910 910
 			{
911 911
 				$xmlDoc = $this->oXmlParser->parse($buff);
912 912
 
@@ -916,35 +916,35 @@  discard block
 block discarded – undo
916 916
 
917 917
 				$obj->module_srl = $module_srl;
918 918
 
919
-				if($parent) $obj->parent_srl = $sequences[$parent];
919
+				if ($parent) $obj->parent_srl = $sequences[$parent];
920 920
 				else $obj->parent_srl = 0;
921 921
 
922 922
 				$obj->document_srl = $document_srl;
923
-				$obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N';
924
-				$obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body)=='Y'?'Y':'N';
923
+				$obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body) == 'Y' ? 'Y' : 'N';
924
+				$obj->notify_message = base64_decode($xmlDoc->comment->notify_message->body) == 'Y' ? 'Y' : 'N';
925 925
 				$obj->content = base64_decode($xmlDoc->comment->content->body);
926 926
 				$obj->voted_count = base64_decode($xmlDoc->comment->voted_count->body);
927 927
 				$obj->blamed_count = base64_decode($xmlDoc->comment->blamed_count->body);
928 928
 				$obj->password = base64_decode($xmlDoc->comment->password->body);
929
-				$obj->user_name =base64_decode($xmlDoc->comment->user_name->body);
929
+				$obj->user_name = base64_decode($xmlDoc->comment->user_name->body);
930 930
 				$obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body);
931
-				if(!$obj->user_name) $obj->user_name = $obj->nick_name;
931
+				if (!$obj->user_name) $obj->user_name = $obj->nick_name;
932 932
 				$obj->user_id = base64_decode($xmlDoc->comment->user_id->body);
933 933
 				$obj->member_srl = 0;
934 934
 				$obj->email_address = base64_decode($xmlDoc->comment->email->body);
935 935
 				$obj->homepage = base64_decode($xmlDoc->comment->homepage->body);
936 936
 				$obj->regdate = base64_decode($xmlDoc->comment->regdate->body);
937 937
 				$obj->last_update = base64_decode($xmlDoc->comment->update->body);
938
-				if(!$obj->last_update) $obj->last_update = $obj->regdate;
938
+				if (!$obj->last_update) $obj->last_update = $obj->regdate;
939 939
 				$obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body);
940
-				$obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body);
941
-				$obj->list_order = $obj->comment_srl*-1;
940
+				$obj->status = base64_decode($xmlDoc->comment->status->body) == '' ? '1' : base64_decode($xmlDoc->comment->status->body);
941
+				$obj->list_order = $obj->comment_srl * -1;
942 942
 				// Change content information (attachment)
943
-				if(count($files))
943
+				if (count($files))
944 944
 				{
945
-					foreach($files as $key => $val)
945
+					foreach ($files as $key => $val)
946 946
 					{
947
-						$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content);
947
+						$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i', '$1="'.$val.'"', $obj->content);
948 948
 					}
949 949
 				}
950 950
 				// Comment list first
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 				$list_args->module_srl = $obj->module_srl;
955 955
 				$list_args->regdate = $obj->regdate;
956 956
 				// Set data directly if parent comment doesn't exist
957
-				if(!$obj->parent_srl)
957
+				if (!$obj->parent_srl)
958 958
 				{
959 959
 					$list_args->head = $list_args->arrange = $obj->comment_srl;
960 960
 					$list_args->depth = 0;
@@ -966,25 +966,25 @@  discard block
 block discarded – undo
966 966
 					$parent_args->comment_srl = $obj->parent_srl;
967 967
 					$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
968 968
 					// Return if parent comment doesn't exist
969
-					if(!$parent_output->toBool() || !$parent_output->data) continue;
969
+					if (!$parent_output->toBool() || !$parent_output->data) continue;
970 970
 					$parent = $parent_output->data;
971 971
 
972 972
 					$list_args->head = $parent->head;
973
-					$list_args->depth = $parent->depth+1;
974
-					if($list_args->depth<2) $list_args->arrange = $obj->comment_srl;
973
+					$list_args->depth = $parent->depth + 1;
974
+					if ($list_args->depth < 2) $list_args->arrange = $obj->comment_srl;
975 975
 					else
976 976
 					{
977 977
 						$list_args->arrange = $parent->arrange;
978 978
 						$output = executeQuery('comment.updateCommentListArrange', $list_args);
979
-						if(!$output->toBool()) return $output;
979
+						if (!$output->toBool()) return $output;
980 980
 					}
981 981
 				}
982 982
 
983 983
 				$output = executeQuery('comment.insertCommentList', $list_args);
984
-				if($output->toBool())
984
+				if ($output->toBool())
985 985
 				{
986 986
 					$output = executeQuery('comment.insertComment', $obj);
987
-					if($output->toBool()) $cnt++;
987
+					if ($output->toBool()) $cnt++;
988 988
 				}
989 989
 
990 990
 				$buff = null;
@@ -1010,13 +1010,13 @@  discard block
 block discarded – undo
1010 1010
 		$buff = null;
1011 1011
 
1012 1012
 		$file_obj = new stdClass;
1013
-		while(!feof($fp))
1013
+		while (!feof($fp))
1014 1014
 		{
1015 1015
 			$str = trim(fgets($fp, 1024));
1016 1016
 			// If it ends with </attaches>, break
1017
-			if(trim($str) == '</attaches>') break;
1017
+			if (trim($str) == '</attaches>') break;
1018 1018
 			// If it starts with <attach>, collect attachments
1019
-			if(trim($str) == '<attach>')
1019
+			if (trim($str) == '<attach>')
1020 1020
 			{
1021 1021
 				$file_obj->file_srl = getNextSequence();
1022 1022
 				$file_obj->upload_target_srl = $upload_target_srl;
@@ -1026,26 +1026,26 @@  discard block
 block discarded – undo
1026 1026
 				$buff = null;
1027 1027
 				// If it starts with <file>, handle the attachement in xml file
1028 1028
 			}
1029
-			else if(trim($str) == '<file>')
1029
+			else if (trim($str) == '<file>')
1030 1030
 			{
1031 1031
 				$file_obj->file = $this->saveTemporaryFile($fp);
1032 1032
 				continue;
1033 1033
 			}
1034 1034
 
1035
-			if($started) $buff .= $str;
1035
+			if ($started) $buff .= $str;
1036 1036
 			// If it ends with </attach>, handle attachements
1037
-			if(trim($str) == '</attach>')
1037
+			if (trim($str) == '</attach>')
1038 1038
 			{
1039 1039
 				$xmlDoc = $this->oXmlParser->parse($buff.$str);
1040 1040
 
1041 1041
 				$file_obj->source_filename = base64_decode($xmlDoc->attach->filename->body);
1042 1042
 				$file_obj->download_count = base64_decode($xmlDoc->attach->download_count->body);
1043 1043
 
1044
-				if(!$file_obj->file)
1044
+				if (!$file_obj->file)
1045 1045
 				{
1046 1046
 					$url = base64_decode($xmlDoc->attach->url->body);
1047 1047
 					$path = base64_decode($xmlDoc->attach->path->body);
1048
-					if($path && file_exists($path)) $file_obj->file = $path;
1048
+					if ($path && file_exists($path)) $file_obj->file = $path;
1049 1049
 					else
1050 1050
 					{
1051 1051
 						$file_obj->file = $this->getTmpFilename();
@@ -1053,11 +1053,11 @@  discard block
 block discarded – undo
1053 1053
 					}
1054 1054
 				}
1055 1055
 
1056
-				if(file_exists($file_obj->file))
1056
+				if (file_exists($file_obj->file))
1057 1057
 				{
1058 1058
 					$random = new Password();
1059 1059
 					// Set upload path by checking if the attachement is an image or other kind of file
1060
-					if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename))
1060
+					if (preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_obj->source_filename))
1061 1061
 					{
1062 1062
 						// Immediately remove the direct file if it has any kind of extensions for hacking
1063 1063
 						$file_obj->source_filename = preg_replace('/\.(php|phtm|phar|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x', $file_obj->source_filename);
@@ -1065,14 +1065,14 @@  discard block
 block discarded – undo
1065 1065
 
1066 1066
 						$path = sprintf("./files/attach/images/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3));
1067 1067
 
1068
-						$ext = substr(strrchr($file_obj->source_filename,'.'),1);
1068
+						$ext = substr(strrchr($file_obj->source_filename, '.'), 1);
1069 1069
 						$_filename = $random->createSecureSalt(32, 'hex').'.'.$ext;
1070 1070
 						$filename  = $path.$_filename;
1071 1071
 
1072 1072
 						$idx = 1;
1073
-						while(file_exists($filename))
1073
+						while (file_exists($filename))
1074 1074
 						{
1075
-							$filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1', $_filename);
1075
+							$filename = $path.preg_replace('/\.([a-z0-9]+)$/i', '_'.$idx.'.$1', $_filename);
1076 1076
 							$idx++;
1077 1077
 						}
1078 1078
 
@@ -1080,14 +1080,14 @@  discard block
 block discarded – undo
1080 1080
 					}
1081 1081
 					else
1082 1082
 					{
1083
-						$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3));
1083
+						$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl, 3));
1084 1084
 						$filename = $path.$random->createSecureSalt(32, 'hex');
1085 1085
 						$file_obj->direct_download = 'N';
1086 1086
 					}
1087 1087
 					// Create a directory
1088
-					if(!FileHandler::makeDir($path)) continue;
1088
+					if (!FileHandler::makeDir($path)) continue;
1089 1089
 
1090
-					if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0)
1090
+					if (strncmp('./files/cache/importer/', $file_obj->file, 23) === 0)
1091 1091
 					{
1092 1092
 						FileHandler::rename($file_obj->file, $filename);
1093 1093
 					}
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
 					// Insert the file to the DB
1100 1100
 					unset($file_obj->file);
1101
-					if(file_exists($filename))
1101
+					if (file_exists($filename))
1102 1102
 					{
1103 1103
 						$file_obj->uploaded_filename = $filename;
1104 1104
 						$file_obj->file_size = filesize($filename);
@@ -1108,13 +1108,13 @@  discard block
 block discarded – undo
1108 1108
 						$file_obj->isvalid = 'Y';
1109 1109
 						$output = executeQuery('file.insertFile', $file_obj);
1110 1110
 
1111
-						if($output->toBool())
1111
+						if ($output->toBool())
1112 1112
 						{
1113 1113
 							$uploaded_count++;
1114 1114
 							$tmp_obj = null;
1115 1115
 							$tmp_obj->source_filename = $file_obj->source_filename;
1116
-							if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename;
1117
-							else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid);
1116
+							if ($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename;
1117
+							else $files[$file_obj->source_filename] = getUrl('', 'module', 'file', 'act', 'procFileDownload', 'file_srl', $file_obj->file_srl, 'sid', $file_obj->sid);
1118 1118
 						}
1119 1119
 					}
1120 1120
 				}
@@ -1131,8 +1131,8 @@  discard block
 block discarded – undo
1131 1131
 	{
1132 1132
 		$path = "./files/cache/importer";
1133 1133
 		FileHandler::makeDir($path);
1134
-		$filename = sprintf("%s/%d", $path, rand(11111111,99999999));
1135
-		if(file_exists($filename)) $filename .= rand(111,999);
1134
+		$filename = sprintf("%s/%d", $path, rand(11111111, 99999999));
1135
+		if (file_exists($filename)) $filename .= rand(111, 999);
1136 1136
 		return $filename;
1137 1137
 	}
1138 1138
 
@@ -1147,14 +1147,14 @@  discard block
 block discarded – undo
1147 1147
 		$f = fopen($temp_filename, "w");
1148 1148
 
1149 1149
 		$buff = '';
1150
-		while(!feof($fp))
1150
+		while (!feof($fp))
1151 1151
 		{
1152 1152
 			$str = trim(fgets($fp, 1024));
1153
-			if(trim($str) == '</file>') break;
1153
+			if (trim($str) == '</file>') break;
1154 1154
 
1155 1155
 			$buff .= $str;
1156 1156
 
1157
-			if(substr($buff,-7)=='</buff>')
1157
+			if (substr($buff, -7) == '</buff>')
1158 1158
 			{
1159 1159
 				fwrite($f, base64_decode(substr($buff, 6, -7)));
1160 1160
 				$buff = '';
@@ -1173,23 +1173,23 @@  discard block
 block discarded – undo
1173 1173
 	function importExtraVars($fp)
1174 1174
 	{
1175 1175
 		$buff = null;
1176
-		while(!feof($fp))
1176
+		while (!feof($fp))
1177 1177
 		{
1178 1178
 			$buff .= $str = trim(fgets($fp, 1024));
1179
-			if(trim($str) == '</extra_vars>') break;
1179
+			if (trim($str) == '</extra_vars>') break;
1180 1180
 		}
1181
-		if(!$buff) return array();
1181
+		if (!$buff) return array();
1182 1182
 
1183 1183
 		$buff = '<extra_vars>'.$buff;
1184 1184
 		$oXmlParser = new XmlParser();
1185 1185
 		$xmlDoc = $this->oXmlParser->parse($buff);
1186
-		if(!count($xmlDoc->extra_vars->key)) return array();
1186
+		if (!count($xmlDoc->extra_vars->key)) return array();
1187 1187
 
1188 1188
 		$index = 1;
1189
-		foreach($xmlDoc->extra_vars->key as $k => $v)
1189
+		foreach ($xmlDoc->extra_vars->key as $k => $v)
1190 1190
 		{
1191 1191
 			unset($vobj);
1192
-			if($v->var_idx)
1192
+			if ($v->var_idx)
1193 1193
 			{
1194 1194
 				$vobj->var_idx = base64_decode($v->var_idx->body);
1195 1195
 				$vobj->lang_code = base64_decode($v->lang_code->body);
@@ -1197,7 +1197,7 @@  discard block
 block discarded – undo
1197 1197
 				$vobj->eid = base64_decode($v->eid->body);
1198 1198
 
1199 1199
 			}
1200
-			else if($v->body)
1200
+			else if ($v->body)
1201 1201
 			{
1202 1202
 				$vobj->var_idx = $index;
1203 1203
 				$vobj->lang_code = Context::getLangType();
Please login to merge, or discard this patch.
Braces   +256 added lines, -111 removed lines patch added patch discarded remove patch
@@ -55,24 +55,29 @@  discard block
 block discarded – undo
55 55
 					{
56 56
 						$isExists = 'true';
57 57
 						$type = 'XML';
58
-						if(stristr($str, 'tattertools')) $type = 'TTXML';
58
+						if(stristr($str, 'tattertools')) {
59
+							$type = 'TTXML';
60
+						}
59 61
 
60 62
 						$this->add('type', $type);
61 63
 					}
62 64
 					fclose($fp);
63 65
 					$resultMessage = $lang->found_xml_file;
66
+				} else {
67
+					$resultMessage = $lang->cannot_url_file;
64 68
 				}
65
-				else $resultMessage = $lang->cannot_url_file;
69
+			} else {
70
+				$resultMessage = $lang->cannot_allow_fopen_in_phpini;
66 71
 			}
67
-			else $resultMessage = $lang->cannot_allow_fopen_in_phpini;
68 72
 
69 73
 			$this->add('exists', $isExists);
70
-		}
71
-		else
74
+		} else
72 75
 		{
73 76
 			$realPath = FileHandler::getRealPath($filename);
74 77
 
75
-			if(file_exists($realPath) && is_file($realPath)) $isExists = 'true';
78
+			if(file_exists($realPath) && is_file($realPath)) {
79
+				$isExists = 'true';
80
+			}
76 81
 			$this->add('exists', $isExists);
77 82
 
78 83
 			if($isExists == 'true')
@@ -81,13 +86,16 @@  discard block
 block discarded – undo
81 86
 
82 87
 				$fp = fopen($realPath, "r");
83 88
 				$str = fgets($fp, 100);
84
-				if(stristr($str, 'tattertools')) $type = 'TTXML';
89
+				if(stristr($str, 'tattertools')) {
90
+					$type = 'TTXML';
91
+				}
85 92
 				fclose($fp);
86 93
 
87 94
 				$this->add('type', $type);
88 95
 				$resultMessage = $lang->found_xml_file;
96
+			} else {
97
+				$resultMessage = $lang->not_found_xml_file;
89 98
 			}
90
-			else $resultMessage = $lang->not_found_xml_file;
91 99
 		}
92 100
 		$this->add('result_message', $resultMessage);
93 101
 	}
@@ -112,8 +120,7 @@  discard block
 block discarded – undo
112 120
 		{
113 121
 			$output = executeQuery('importer.updateDocumentSync'.$postFix);
114 122
 			$output = executeQuery('importer.updateCommentSync'.$postFix);
115
-		}
116
-		else
123
+		} else
117 124
 		{
118 125
 			$output = executeQueryArray ('importer.getDocumentMemberSrlWithUserID'.$postFix);
119 126
 			if(is_array ($output->data) && count ($output->data))
@@ -129,8 +136,7 @@  discard block
 block discarded – undo
129 136
 					if($tmp->toBool () === true)
130 137
 					{
131 138
 						$success_count++;
132
-					}
133
-					else
139
+					} else
134 140
 					{
135 141
 						$error_count++;
136 142
 					}
@@ -152,8 +158,7 @@  discard block
 block discarded – undo
152 158
 					if($tmp->toBool () === true)
153 159
 					{
154 160
 						$success_count++;
155
-					}
156
-					else
161
+					} else
157 162
 					{
158 163
 						$error_count++;
159 164
 					}
@@ -182,11 +187,15 @@  discard block
 block discarded – undo
182 187
 		{
183 188
 			case 'member' :
184 189
 				$output = $oExtract->set($xml_file,'<members ', '</members>', '<member>', '</member>');
185
-				if($output->toBool()) $oExtract->saveItems();
190
+				if($output->toBool()) {
191
+					$oExtract->saveItems();
192
+				}
186 193
 				break;
187 194
 			case 'message' :
188 195
 				$output = $oExtract->set($xml_file,'<messages ', '</messages>', '<message>','</message>');
189
-				if($output->toBool()) $oExtract->saveItems();
196
+				if($output->toBool()) {
197
+					$oExtract->saveItems();
198
+				}
190 199
 				break;
191 200
 			case 'ttxml' :
192 201
 				// Category information
@@ -204,8 +213,12 @@  discard block
 block discarded – undo
204 213
 							$started = true;
205 214
 							$str = strstr($str, '<category>');
206 215
 						}
207
-						if(substr($str,0,strlen('<post ')) == '<post ') break;
208
-						if ($started) $buff .= $str;
216
+						if(substr($str,0,strlen('<post ')) == '<post ') {
217
+							break;
218
+						}
219
+						if ($started) {
220
+							$buff .= $str;
221
+						}
209 222
 					}
210 223
 					$buff = '<categories>'.$buff.'</categories>';
211 224
 					$oExtract->closeFile();
@@ -242,7 +255,9 @@  discard block
 block discarded – undo
242 255
 						FileHandler::writeFile($guestbook_filename, $buff);
243 256
 						// Individual items
244 257
 						$output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>');
245
-						if($output->toBool()) $oExtract->saveItems();
258
+						if($output->toBool()) {
259
+							$oExtract->saveItems();
260
+						}
246 261
 					}
247 262
 				}
248 263
 				break;
@@ -254,7 +269,9 @@  discard block
 block discarded – undo
254 269
 					$oExtract->mergeItems('category.xml');
255 270
 					// Get each item
256 271
 					$output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>');
257
-					if($output->toBool()) $oExtract->saveItems();
272
+					if($output->toBool()) {
273
+						$oExtract->saveItems();
274
+					}
258 275
 				}
259 276
 				break;
260 277
 		}
@@ -291,19 +308,25 @@  discard block
 block discarded – undo
291 308
 		$this->unit_count = Context::get('unit_count');
292 309
 		// Check if an index file exists
293 310
 		$index_file = './files/cache/importer/'.$key.'/index';
294
-		if(!file_exists($index_file)) return new BaseObject(-1, 'msg_invalid_xml_file');
311
+		if(!file_exists($index_file)) {
312
+			return new BaseObject(-1, 'msg_invalid_xml_file');
313
+		}
295 314
 
296 315
 		switch($type)
297 316
 		{
298 317
 			case 'ttxml' :
299
-				if(!$target_module) return new BaseObject(-1,'msg_invalid_request');
318
+				if(!$target_module) {
319
+					return new BaseObject(-1,'msg_invalid_request');
320
+				}
300 321
 
301 322
 				$oModuleModel = getModel('module');
302 323
 				$columnList = array('module_srl', 'module');
303 324
 				$target_module_info = $oModuleModel->getModuleInfoByModuleSrl($target_module, $columnList);
304 325
 
305 326
 				$ttimporter = FileHandler::exists(_XE_PATH_ . 'modules/importer/ttimport.class.php');
306
-				if($ttimporter) require_once($ttimporter);
327
+				if($ttimporter) {
328
+					require_once($ttimporter);
329
+				}
307 330
 
308 331
 				$oTT = new ttimport();
309 332
 				$cur = $oTT->importModule($key, $cur, $index_file, $this->unit_count, $target_module, $guestbook_target_module, $user_id, $target_module_info->module);
@@ -316,7 +339,9 @@  discard block
 block discarded – undo
316 339
 				break;
317 340
 			case 'module' :
318 341
 				// Check if the target module exists
319
-				if(!$target_module) return new BaseObject(-1,'msg_invalid_request');
342
+				if(!$target_module) {
343
+					return new BaseObject(-1,'msg_invalid_request');
344
+				}
320 345
 				$cur = $this->importModule($key, $cur, $index_file, $target_module);
321 346
 				break;
322 347
 		}
@@ -331,8 +356,9 @@  discard block
 block discarded – undo
331 356
 		{
332 357
 			$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) );
333 358
 			FileHandler::removeDir('./files/cache/importer/'.$key);
359
+		} else {
360
+			$this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) );
334 361
 		}
335
-		else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) );
336 362
 	}
337 363
 
338 364
 	/**
@@ -344,7 +370,9 @@  discard block
 block discarded – undo
344 370
 	 */
345 371
 	function importMember($key, $cur, $index_file)
346 372
 	{
347
-		if(!$cur) $cur = 0;
373
+		if(!$cur) {
374
+			$cur = 0;
375
+		}
348 376
 		// Create the xmlParser object
349 377
 		$oXmlParser = new XmlParser();
350 378
 		// Create objects for importing member information
@@ -359,24 +387,32 @@  discard block
 block discarded – undo
359 387
 		// Open an index file
360 388
 		$f = fopen($index_file,"r");
361 389
 		// Pass if already read
362
-		for($i=0;$i<$cur;$i++) fgets($f, 1024);
390
+		for($i=0;$i<$cur;$i++) {
391
+			fgets($f, 1024);
392
+		}
363 393
 		// Read by each line until the condition meets
364 394
 		for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)
365 395
 		{
366
-			if(feof($f)) break;
396
+			if(feof($f)) {
397
+				break;
398
+			}
367 399
 			// Find a given location
368 400
 			$target_file = trim(fgets($f, 1024));
369 401
 			// Load and parse the file
370 402
 			$xmlObj = $oXmlParser->loadXmlFile($target_file);
371 403
 			FileHandler::removeFile($target_file);
372
-			if(!$xmlObj) continue;
404
+			if(!$xmlObj) {
405
+				continue;
406
+			}
373 407
 			// List Objects
374 408
 			$obj = new stdClass();
375 409
 			$obj->user_id = base64_decode($xmlObj->member->user_id->body);
376 410
 			$obj->password = base64_decode($xmlObj->member->password->body);
377 411
 			$obj->user_name = base64_decode($xmlObj->member->user_name->body);
378 412
 			$obj->nick_name = base64_decode($xmlObj->member->nick_name->body);
379
-			if(!$obj->user_name) $obj->user_name = $obj->nick_name;
413
+			if(!$obj->user_name) {
414
+				$obj->user_name = $obj->nick_name;
415
+			}
380 416
 			$obj->email = base64_decode($xmlObj->member->email->body);
381 417
 			$obj->homepage = base64_decode($xmlObj->member->homepage->body);
382 418
 			$obj->blog = base64_decode($xmlObj->member->blog->body);
@@ -394,22 +430,32 @@  discard block
 block discarded – undo
394 430
 			{
395 431
 				foreach($xmlObj->member->extra_vars as $key => $val)
396 432
 				{
397
-					if(in_array($key, array('node_name','attrs','body'))) continue;
433
+					if(in_array($key, array('node_name','attrs','body'))) {
434
+						continue;
435
+					}
398 436
 					$obj->extra_vars->{$key} = base64_decode($val->body);
399 437
 				}
400 438
 			}
401 439
 			// Create url for homepage and blog
402
-			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage;
440
+			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) {
441
+				$obj->homepage = 'http://'.$obj->homepage;
442
+			}
403 443
 			// email address column
404 444
 			$obj->email_address = $obj->email;
405 445
 			list($obj->email_id, $obj->email_host) = explode('@', $obj->email);
406 446
 			// Set the mailing option
407
-			if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N';
447
+			if($obj->allow_mailing!='Y') {
448
+				$obj->allow_mailing = 'N';
449
+			}
408 450
 			// Set the message option
409 451
 			$obj->allow_message = 'Y';
410
-			if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y';
452
+			if(!in_array($obj->allow_message, array('Y','N','F'))) {
453
+				$obj->allow_message= 'Y';
454
+			}
411 455
 			// Get member-join date if the last login time is not found
412
-			if(!$obj->last_login) $obj->last_login = $obj->regdate;
456
+			if(!$obj->last_login) {
457
+				$obj->last_login = $obj->regdate;
458
+			}
413 459
 			// Get a member_srl
414 460
 			$obj->member_srl = getNextSequence();
415 461
 			$obj->list_order = -1 * $obj->member_srl;
@@ -421,7 +467,9 @@  discard block
 block discarded – undo
421 467
 			$nick_args = new stdClass;
422 468
 			$nick_args->nick_name = $obj->nick_name;
423 469
 			$nick_output = executeQuery('member.getMemberSrl', $nick_args);
424
-			if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl;
470
+			if(!$nick_output->toBool()) {
471
+				$obj->nick_name .= '_'.$obj->member_srl;
472
+			}
425 473
 			// Add a member
426 474
 			$output = executeQuery('member.insertMember', $obj);
427 475
 
@@ -477,7 +525,9 @@  discard block
 block discarded – undo
477 525
 					$signature_buff = sprintf('<?php if(!defined("__XE__")) exit();?>%s', $signature);
478 526
 
479 527
 					$target_path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($obj->member_srl));
480
-					if(!is_dir($target_path)) FileHandler::makeDir($target_path);
528
+					if(!is_dir($target_path)) {
529
+						FileHandler::makeDir($target_path);
530
+					}
481 531
 					$target_filename = sprintf('%s%d.signature.php', $target_path, $obj->member_srl);
482 532
 
483 533
 					FileHandler::writeFile($target_filename, $signature_buff);
@@ -499,23 +549,31 @@  discard block
 block discarded – undo
499 549
 	 */
500 550
 	function importMessage($key, $cur, $index_file)
501 551
 	{
502
-		if(!$cur) $cur = 0;
552
+		if(!$cur) {
553
+			$cur = 0;
554
+		}
503 555
 		// Create the xmlParser object
504 556
 		$oXmlParser = new XmlParser();
505 557
 		// Open an index file
506 558
 		$f = fopen($index_file,"r");
507 559
 		// Pass if already read
508
-		for($i=0;$i<$cur;$i++) fgets($f, 1024);
560
+		for($i=0;$i<$cur;$i++) {
561
+			fgets($f, 1024);
562
+		}
509 563
 		// Read each line until the condition meets
510 564
 		for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)
511 565
 		{
512
-			if(feof($f)) break;
566
+			if(feof($f)) {
567
+				break;
568
+			}
513 569
 			// Find a location
514 570
 			$target_file = trim(fgets($f, 1024));
515 571
 			// Load and parse the file
516 572
 			$xmlObj = $oXmlParser->loadXmlFile($target_file);
517 573
 			FileHandler::removeFile($target_file);
518
-			if(!$xmlObj) continue;
574
+			if(!$xmlObj) {
575
+				continue;
576
+			}
519 577
 			// List objects
520 578
 			$obj = null;
521 579
 			$obj->receiver = base64_decode($xmlObj->message->receiver->body);
@@ -526,7 +584,9 @@  discard block
 block discarded – undo
526 584
 			$obj->regdate = base64_decode($xmlObj->message->regdate->body);
527 585
 			$obj->readed_date = base64_decode($xmlObj->message->readed_date->body);
528 586
 			// Get member_srl of sender/recipient (If not exists, pass)
529
-			if(!$obj->sender) continue;
587
+			if(!$obj->sender) {
588
+				continue;
589
+			}
530 590
 			$sender_args->user_id = $obj->sender;
531 591
 			$sender_output = executeQuery('member.getMemberInfo',$sender_args);
532 592
 			$sender_srl = $sender_output->data->member_srl;
@@ -537,10 +597,14 @@  discard block
 block discarded – undo
537 597
 				$sender_output = executeQuery('member.getMemberInfoByEmailAddress',$sender_args);
538 598
 				$sender_srl = $sender_output->data->member_srl;
539 599
 			}
540
-			if(!$sender_srl) continue;
600
+			if(!$sender_srl) {
601
+				continue;
602
+			}
541 603
 
542 604
 			$receiver_args->user_id = $obj->receiver;
543
-			if(!$obj->receiver) continue;
605
+			if(!$obj->receiver) {
606
+				continue;
607
+			}
544 608
 			$receiver_output = executeQuery('member.getMemberInfo',$receiver_args);
545 609
 			$receiver_srl = $receiver_output->data->member_srl;
546 610
 			if(!$receiver_srl)
@@ -550,7 +614,9 @@  discard block
 block discarded – undo
550 614
 				$receiver_output = executeQuery('member.getMemberInfoByEmailAddress',$receiver_args);
551 615
 				$receiver_srl = $receiver_output->data->member_srl;
552 616
 			}
553
-			if(!$receiver_srl) continue;
617
+			if(!$receiver_srl) {
618
+				continue;
619
+			}
554 620
 			// Message to save into sender's message box
555 621
 			$sender_args->sender_srl = $sender_srl;
556 622
 			$sender_args->receiver_srl = $receiver_srl;
@@ -571,7 +637,9 @@  discard block
 block discarded – undo
571 637
 				$receiver_args->message_srl = $sender_args->related_srl;
572 638
 				$receiver_args->list_order = $sender_args->related_srl*-1;
573 639
 				$receiver_args->sender_srl = $sender_srl;
574
-				if(!$receiver_args->sender_srl) $receiver_args->sender_srl = $receiver_srl;
640
+				if(!$receiver_args->sender_srl) {
641
+					$receiver_args->sender_srl = $receiver_srl;
642
+				}
575 643
 				$receiver_args->receiver_srl = $receiver_srl;
576 644
 				$receiver_args->message_type = 'R';
577 645
 				$receiver_args->title = $obj->title;
@@ -605,7 +673,9 @@  discard block
 block discarded – undo
605 673
 		$oDocumentModel = getModel('document');
606 674
 		$category_list = $category_titles = array();
607 675
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
608
-		if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
676
+		if(count($category_list)) {
677
+			foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
678
+		}
609 679
 		// Extract category information
610 680
 		$category_file = preg_replace('/index$/i', 'category.xml', $index_file);
611 681
 		if(file_exists($category_file))
@@ -618,12 +688,16 @@  discard block
 block discarded – undo
618 688
 			$categories = $xmlDoc->items->category;
619 689
 			if($categories)
620 690
 			{
621
-				if(!is_array($categories)) $categories = array($categories);
691
+				if(!is_array($categories)) {
692
+					$categories = array($categories);
693
+				}
622 694
 				$match_sequence = array();
623 695
 				foreach($categories as $k => $v)
624 696
 				{
625 697
 					$category = trim(base64_decode($v->body));
626
-					if(!$category || $category_titles[$category]) continue;
698
+					if(!$category || $category_titles[$category]) {
699
+						continue;
700
+					}
627 701
 
628 702
 					$sequence = $v->attrs->sequence;
629 703
 					$parent = $v->attrs->parent;
@@ -631,10 +705,14 @@  discard block
 block discarded – undo
631 705
 					$obj = null;
632 706
 					$obj->title = $category;
633 707
 					$obj->module_srl = $module_srl;
634
-					if($parent) $obj->parent_srl = $match_sequence[$parent];
708
+					if($parent) {
709
+						$obj->parent_srl = $match_sequence[$parent];
710
+					}
635 711
 
636 712
 					$output = $oDocumentController->insertCategory($obj);
637
-					if($output->toBool()) $match_sequence[$sequence] = $output->get('category_srl');
713
+					if($output->toBool()) {
714
+						$match_sequence[$sequence] = $output->get('category_srl');
715
+					}
638 716
 				}
639 717
 				$oDocumentController = getController('document');
640 718
 				$oDocumentController->makeCategoryFile($module_srl);
@@ -644,31 +722,45 @@  discard block
 block discarded – undo
644 722
 
645 723
 		$category_list = $category_titles = array();
646 724
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
647
-		if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
725
+		if(count($category_list)) {
726
+			foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
727
+		}
648 728
 
649 729
 		$ek_args->module_srl = $module_srl;
650 730
 		$output = executeQueryArray('document.getDocumentExtraKeys', $ek_args);
651 731
 		if($output->data)
652 732
 		{
653
-			foreach($output->data as $key => $val) $extra_keys[$val->eid] = true;
733
+			foreach($output->data as $key => $val) {
734
+				$extra_keys[$val->eid] = true;
735
+			}
654 736
 		}
655 737
 
656
-		if(!$cur) $cur = 0;
738
+		if(!$cur) {
739
+			$cur = 0;
740
+		}
657 741
 		// Open an index file
658 742
 		$f = fopen($index_file,"r");
659 743
 		// Pass if already read
660
-		for($i=0;$i<$cur;$i++) fgets($f, 1024);
744
+		for($i=0;$i<$cur;$i++) {
745
+			fgets($f, 1024);
746
+		}
661 747
 		// Read each line until the condition meets
662 748
 		for($idx=$cur;$idx<$cur+$this->unit_count;$idx++)
663 749
 		{
664
-			if(feof($f)) break;
750
+			if(feof($f)) {
751
+				break;
752
+			}
665 753
 			// Find a location
666 754
 			$target_file = trim(fgets($f, 1024));
667 755
 
668
-			if(!file_exists($target_file)) continue;
756
+			if(!file_exists($target_file)) {
757
+				continue;
758
+			}
669 759
 			// Importing data from now on
670 760
 			$fp = fopen($target_file,"r");
671
-			if(!$fp) continue;
761
+			if(!$fp) {
762
+				continue;
763
+			}
672 764
 
673 765
 			$obj = new stdClass;
674 766
 			$obj->module_srl = $module_srl;
@@ -688,38 +780,38 @@  discard block
 block discarded – undo
688 780
 				{
689 781
 					$started = true;
690 782
 					// Trackback inserted
691
-				}
692
-				else if(substr($str,0,11) == '<trackbacks')
783
+				} else if(substr($str,0,11) == '<trackbacks')
693 784
 				{
694 785
 					$obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl);
695 786
 					continue;
696 787
 					// Comments inserted
697
-				}
698
-				else if(substr($str,0,9) == '<comments')
788
+				} else if(substr($str,0,9) == '<comments')
699 789
 				{
700 790
 					$obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl);
701 791
 					continue;
702 792
 					// Attachment inserted
703
-				}
704
-				else if(substr($str,0,9) == '<attaches')
793
+				} else if(substr($str,0,9) == '<attaches')
705 794
 				{
706 795
 					$obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files);
707 796
 					continue;
708 797
 					// When starting extra variabls
709
-				}
710
-				elseif(trim($str) == '<extra_vars>')
798
+				} elseif(trim($str) == '<extra_vars>')
711 799
 				{
712 800
 					$extra_vars = $this->importExtraVars($fp);
713 801
 					continue;
714 802
 				}
715 803
 
716
-				if($started) $buff[] = $str;
804
+				if($started) {
805
+					$buff[] = $str;
806
+				}
717 807
 			}
718 808
 
719 809
 			$xmlDoc = $this->oXmlParser->parse(implode('', $buff));
720 810
 
721 811
 			$category = base64_decode($xmlDoc->post->category->body);
722
-			if($category_titles[$category]) $obj->category_srl = $category_titles[$category];
812
+			if($category_titles[$category]) {
813
+				$obj->category_srl = $category_titles[$category];
814
+			}
723 815
 
724 816
 			$obj->member_srl = 0;
725 817
 
@@ -733,16 +825,22 @@  discard block
 block discarded – undo
733 825
 			$obj->password = base64_decode($xmlDoc->post->password->body);
734 826
 			$obj->user_name = base64_decode($xmlDoc->post->user_name->body);
735 827
 			$obj->nick_name = base64_decode($xmlDoc->post->nick_name->body);
736
-			if(!$obj->user_name) $obj->user_name = $obj->nick_name;
828
+			if(!$obj->user_name) {
829
+				$obj->user_name = $obj->nick_name;
830
+			}
737 831
 			$obj->user_id = base64_decode($xmlDoc->post->user_id->body);
738 832
 			$obj->email_address = base64_decode($xmlDoc->post->email->body);
739 833
 			$obj->homepage = base64_decode($xmlDoc->post->homepage->body);
740
-			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) $obj->homepage = 'http://'.$obj->homepage;
834
+			if($obj->homepage && strncasecmp('http://', $obj->homepage, 7) !== 0 && strncasecmp('https://', $obj->homepage, 8) !== 0) {
835
+				$obj->homepage = 'http://'.$obj->homepage;
836
+			}
741 837
 			$obj->tags = base64_decode($xmlDoc->post->tags->body);
742 838
 			$obj->regdate = base64_decode($xmlDoc->post->regdate->body);
743 839
 			$obj->last_update = base64_decode($xmlDoc->post->update->body);
744 840
 			$obj->last_updater = base64_decode($xmlDoc->post->last_updater->body);
745
-			if(!$obj->last_update) $obj->last_update = $obj->regdate;
841
+			if(!$obj->last_update) {
842
+				$obj->last_update = $obj->regdate;
843
+			}
746 844
 			$obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body);
747 845
 			$obj->list_order = $obj->update_order = $obj->document_srl*-1;
748 846
 			$obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY';
@@ -773,7 +871,9 @@  discard block
 block discarded – undo
773 871
 					$args->document_srl = $obj->document_srl;
774 872
 					$args->tag = trim($tag_list[$i]);
775 873
 					$args->regdate = $obj->regdate;
776
-					if(!$args->tag) continue;
874
+					if(!$args->tag) {
875
+						continue;
876
+					}
777 877
 					$output = executeQuery('tag.insertTag', $args);
778 878
 				}
779 879
 
@@ -783,7 +883,9 @@  discard block
 block discarded – undo
783 883
 			{
784 884
 				foreach($extra_vars as $key => $val)
785 885
 				{
786
-					if(!$val->value) continue;
886
+					if(!$val->value) {
887
+						continue;
888
+					}
787 889
 					unset($e_args);
788 890
 					$e_args->module_srl = $module_srl;
789 891
 					$e_args->document_srl = $obj->document_srl;
@@ -816,7 +918,9 @@  discard block
 block discarded – undo
816 918
 
817 919
 		fclose($f);
818 920
 		// Sync category counts
819
-		if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);
921
+		if(count($category_list)) {
922
+			foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);
923
+		}
820 924
 
821 925
 		return $idx-1;
822 926
 	}
@@ -838,11 +942,17 @@  discard block
 block discarded – undo
838 942
 		{
839 943
 			$str = fgets($fp, 1024);
840 944
 			// If </trackbacks> is, break
841
-			if(trim($str) == '</trackbacks>') break;
945
+			if(trim($str) == '</trackbacks>') {
946
+				break;
947
+			}
842 948
 			// If <trackback>, start importing
843
-			if(trim($str) == '<trackback>') $started = true;
949
+			if(trim($str) == '<trackback>') {
950
+				$started = true;
951
+			}
844 952
 
845
-			if($started) $buff .= $str;
953
+			if($started) {
954
+				$buff .= $str;
955
+			}
846 956
 			// If </trackback>, insert to the DB
847 957
 			if(trim($str) == '</trackback>')
848 958
 			{
@@ -860,7 +970,9 @@  discard block
 block discarded – undo
860 970
 				$obj->ipaddress = base64_decode($xmlDoc->trackback->ipaddress->body);
861 971
 				$obj->list_order = -1*$obj->trackback_srl;
862 972
 				$output = executeQuery('trackback.insertTrackback', $obj);
863
-				if($output->toBool()) $cnt++;
973
+				if($output->toBool()) {
974
+					$cnt++;
975
+				}
864 976
 
865 977
 				$buff = null;
866 978
 				$started = false;
@@ -888,7 +1000,9 @@  discard block
 block discarded – undo
888 1000
 		{
889 1001
 			$str = fgets($fp, 1024);
890 1002
 			// If </comments> is, break
891
-			if(trim($str) == '</comments>') break;
1003
+			if(trim($str) == '</comments>') {
1004
+				break;
1005
+			}
892 1006
 			// If <comment> is, start importing
893 1007
 			if(trim($str) == '<comment>')
894 1008
 			{
@@ -904,7 +1018,9 @@  discard block
 block discarded – undo
904 1018
 				continue;
905 1019
 			}
906 1020
 
907
-			if($started) $buff .= $str;
1021
+			if($started) {
1022
+				$buff .= $str;
1023
+			}
908 1024
 			// If </comment> is, insert to the DB
909 1025
 			if(trim($str) == '</comment>')
910 1026
 			{
@@ -916,8 +1032,11 @@  discard block
 block discarded – undo
916 1032
 
917 1033
 				$obj->module_srl = $module_srl;
918 1034
 
919
-				if($parent) $obj->parent_srl = $sequences[$parent];
920
-				else $obj->parent_srl = 0;
1035
+				if($parent) {
1036
+					$obj->parent_srl = $sequences[$parent];
1037
+				} else {
1038
+					$obj->parent_srl = 0;
1039
+				}
921 1040
 
922 1041
 				$obj->document_srl = $document_srl;
923 1042
 				$obj->is_secret = base64_decode($xmlDoc->comment->is_secret->body)=='Y'?'Y':'N';
@@ -928,14 +1047,18 @@  discard block
 block discarded – undo
928 1047
 				$obj->password = base64_decode($xmlDoc->comment->password->body);
929 1048
 				$obj->user_name =base64_decode($xmlDoc->comment->user_name->body);
930 1049
 				$obj->nick_name = base64_decode($xmlDoc->comment->nick_name->body);
931
-				if(!$obj->user_name) $obj->user_name = $obj->nick_name;
1050
+				if(!$obj->user_name) {
1051
+					$obj->user_name = $obj->nick_name;
1052
+				}
932 1053
 				$obj->user_id = base64_decode($xmlDoc->comment->user_id->body);
933 1054
 				$obj->member_srl = 0;
934 1055
 				$obj->email_address = base64_decode($xmlDoc->comment->email->body);
935 1056
 				$obj->homepage = base64_decode($xmlDoc->comment->homepage->body);
936 1057
 				$obj->regdate = base64_decode($xmlDoc->comment->regdate->body);
937 1058
 				$obj->last_update = base64_decode($xmlDoc->comment->update->body);
938
-				if(!$obj->last_update) $obj->last_update = $obj->regdate;
1059
+				if(!$obj->last_update) {
1060
+					$obj->last_update = $obj->regdate;
1061
+				}
939 1062
 				$obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body);
940 1063
 				$obj->status = base64_decode($xmlDoc->comment->status->body)==''?'1':base64_decode($xmlDoc->comment->status->body);
941 1064
 				$obj->list_order = $obj->comment_srl*-1;
@@ -959,24 +1082,28 @@  discard block
 block discarded – undo
959 1082
 					$list_args->head = $list_args->arrange = $obj->comment_srl;
960 1083
 					$list_args->depth = 0;
961 1084
 					// Get parent_srl if parent comment exists
962
-				}
963
-				else
1085
+				} else
964 1086
 				{
965 1087
 					// Get parent comment infomation
966 1088
 					$parent_args->comment_srl = $obj->parent_srl;
967 1089
 					$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
968 1090
 					// Return if parent comment doesn't exist
969
-					if(!$parent_output->toBool() || !$parent_output->data) continue;
1091
+					if(!$parent_output->toBool() || !$parent_output->data) {
1092
+						continue;
1093
+					}
970 1094
 					$parent = $parent_output->data;
971 1095
 
972 1096
 					$list_args->head = $parent->head;
973 1097
 					$list_args->depth = $parent->depth+1;
974
-					if($list_args->depth<2) $list_args->arrange = $obj->comment_srl;
975
-					else
1098
+					if($list_args->depth<2) {
1099
+						$list_args->arrange = $obj->comment_srl;
1100
+					} else
976 1101
 					{
977 1102
 						$list_args->arrange = $parent->arrange;
978 1103
 						$output = executeQuery('comment.updateCommentListArrange', $list_args);
979
-						if(!$output->toBool()) return $output;
1104
+						if(!$output->toBool()) {
1105
+							return $output;
1106
+						}
980 1107
 					}
981 1108
 				}
982 1109
 
@@ -984,7 +1111,9 @@  discard block
 block discarded – undo
984 1111
 				if($output->toBool())
985 1112
 				{
986 1113
 					$output = executeQuery('comment.insertComment', $obj);
987
-					if($output->toBool()) $cnt++;
1114
+					if($output->toBool()) {
1115
+						$cnt++;
1116
+					}
988 1117
 				}
989 1118
 
990 1119
 				$buff = null;
@@ -1014,7 +1143,9 @@  discard block
 block discarded – undo
1014 1143
 		{
1015 1144
 			$str = trim(fgets($fp, 1024));
1016 1145
 			// If it ends with </attaches>, break
1017
-			if(trim($str) == '</attaches>') break;
1146
+			if(trim($str) == '</attaches>') {
1147
+				break;
1148
+			}
1018 1149
 			// If it starts with <attach>, collect attachments
1019 1150
 			if(trim($str) == '<attach>')
1020 1151
 			{
@@ -1025,14 +1156,15 @@  discard block
 block discarded – undo
1025 1156
 				$started = true;
1026 1157
 				$buff = null;
1027 1158
 				// If it starts with <file>, handle the attachement in xml file
1028
-			}
1029
-			else if(trim($str) == '<file>')
1159
+			} else if(trim($str) == '<file>')
1030 1160
 			{
1031 1161
 				$file_obj->file = $this->saveTemporaryFile($fp);
1032 1162
 				continue;
1033 1163
 			}
1034 1164
 
1035
-			if($started) $buff .= $str;
1165
+			if($started) {
1166
+				$buff .= $str;
1167
+			}
1036 1168
 			// If it ends with </attach>, handle attachements
1037 1169
 			if(trim($str) == '</attach>')
1038 1170
 			{
@@ -1045,8 +1177,9 @@  discard block
 block discarded – undo
1045 1177
 				{
1046 1178
 					$url = base64_decode($xmlDoc->attach->url->body);
1047 1179
 					$path = base64_decode($xmlDoc->attach->path->body);
1048
-					if($path && file_exists($path)) $file_obj->file = $path;
1049
-					else
1180
+					if($path && file_exists($path)) {
1181
+						$file_obj->file = $path;
1182
+					} else
1050 1183
 					{
1051 1184
 						$file_obj->file = $this->getTmpFilename();
1052 1185
 						FileHandler::getRemoteFile($url, $file_obj->file);
@@ -1077,21 +1210,21 @@  discard block
 block discarded – undo
1077 1210
 						}
1078 1211
 
1079 1212
 						$file_obj->direct_download = 'Y';
1080
-					}
1081
-					else
1213
+					} else
1082 1214
 					{
1083 1215
 						$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3));
1084 1216
 						$filename = $path.$random->createSecureSalt(32, 'hex');
1085 1217
 						$file_obj->direct_download = 'N';
1086 1218
 					}
1087 1219
 					// Create a directory
1088
-					if(!FileHandler::makeDir($path)) continue;
1220
+					if(!FileHandler::makeDir($path)) {
1221
+						continue;
1222
+					}
1089 1223
 
1090 1224
 					if(strncmp('./files/cache/importer/', $file_obj->file, 23) === 0)
1091 1225
 					{
1092 1226
 						FileHandler::rename($file_obj->file, $filename);
1093
-					}
1094
-					else
1227
+					} else
1095 1228
 					{
1096 1229
 						copy($file_obj->file, $filename);
1097 1230
 					}
@@ -1113,8 +1246,11 @@  discard block
 block discarded – undo
1113 1246
 							$uploaded_count++;
1114 1247
 							$tmp_obj = null;
1115 1248
 							$tmp_obj->source_filename = $file_obj->source_filename;
1116
-							if($file_obj->direct_download == 'Y') $files[$file_obj->source_filename] = $file_obj->uploaded_filename;
1117
-							else $files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid);
1249
+							if($file_obj->direct_download == 'Y') {
1250
+								$files[$file_obj->source_filename] = $file_obj->uploaded_filename;
1251
+							} else {
1252
+								$files[$file_obj->source_filename] = getUrl('','module','file','act','procFileDownload','file_srl',$file_obj->file_srl,'sid',$file_obj->sid);
1253
+							}
1118 1254
 						}
1119 1255
 					}
1120 1256
 				}
@@ -1132,7 +1268,9 @@  discard block
 block discarded – undo
1132 1268
 		$path = "./files/cache/importer";
1133 1269
 		FileHandler::makeDir($path);
1134 1270
 		$filename = sprintf("%s/%d", $path, rand(11111111,99999999));
1135
-		if(file_exists($filename)) $filename .= rand(111,999);
1271
+		if(file_exists($filename)) {
1272
+			$filename .= rand(111,999);
1273
+		}
1136 1274
 		return $filename;
1137 1275
 	}
1138 1276
 
@@ -1150,7 +1288,9 @@  discard block
 block discarded – undo
1150 1288
 		while(!feof($fp))
1151 1289
 		{
1152 1290
 			$str = trim(fgets($fp, 1024));
1153
-			if(trim($str) == '</file>') break;
1291
+			if(trim($str) == '</file>') {
1292
+				break;
1293
+			}
1154 1294
 
1155 1295
 			$buff .= $str;
1156 1296
 
@@ -1176,14 +1316,20 @@  discard block
 block discarded – undo
1176 1316
 		while(!feof($fp))
1177 1317
 		{
1178 1318
 			$buff .= $str = trim(fgets($fp, 1024));
1179
-			if(trim($str) == '</extra_vars>') break;
1319
+			if(trim($str) == '</extra_vars>') {
1320
+				break;
1321
+			}
1322
+		}
1323
+		if(!$buff) {
1324
+			return array();
1180 1325
 		}
1181
-		if(!$buff) return array();
1182 1326
 
1183 1327
 		$buff = '<extra_vars>'.$buff;
1184 1328
 		$oXmlParser = new XmlParser();
1185 1329
 		$xmlDoc = $this->oXmlParser->parse($buff);
1186
-		if(!count($xmlDoc->extra_vars->key)) return array();
1330
+		if(!count($xmlDoc->extra_vars->key)) {
1331
+			return array();
1332
+		}
1187 1333
 
1188 1334
 		$index = 1;
1189 1335
 		foreach($xmlDoc->extra_vars->key as $k => $v)
@@ -1196,8 +1342,7 @@  discard block
 block discarded – undo
1196 1342
 				$vobj->value = base64_decode($v->value->body);
1197 1343
 				$vobj->eid = base64_decode($v->eid->body);
1198 1344
 
1199
-			}
1200
-			else if($v->body)
1345
+			} else if($v->body)
1201 1346
 			{
1202 1347
 				$vobj->var_idx = $index;
1203 1348
 				$vobj->lang_code = Context::getLangType();
Please login to merge, or discard this patch.
modules/layout/layout.admin.controller.php 3 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	/**
421 421
 	 * insert image into user layout
422 422
 	 * @param int $layout_srl
423
-	 * @param object $source file data
423
+	 * @param string $source file data
424 424
 	 * @return boolean (true : success, false : fail)
425 425
 	 */
426 426
 	function insertUserLayoutImage($layout_srl,$source)
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	/**
545 545
 	 * Add the widget code for faceoff into user layout file
546 546
 	 * @param int $layout_srl
547
-	 * @param object $arg
547
+	 * @param null|stdClass $arg
548 548
 	 * @param string $content
549 549
 	 * @return string
550 550
 	 */
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 
587 587
 	/**
588 588
 	 * export user layout
589
-	 * @return void
589
+	 * @return BaseObject|null
590 590
 	 */
591 591
 	function procLayoutAdminUserLayoutExport()
592 592
 	{
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 	/**
683 683
 	 * faceoff import
684 684
 	 * @deprecated
685
-	 * @return void
685
+	 * @return ModuleObject|null
686 686
 	 */
687 687
 	function procLayoutAdminUserLayoutImport()
688 688
 	{
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
 	/**
711 711
 	 * layout copy
712
-	 * @return void
712
+	 * @return BaseObject|null
713 713
 	 */
714 714
 	function procLayoutAdminCopyLayout()
715 715
 	{
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	/**
844 844
 	 * Layout file copy
845 845
 	 * @param $sourceLayoutSrl origin layout number
846
-	 * @param $targetLayoutSrl origin layout number
846
+	 * @param integer $targetLayoutSrl origin layout number
847 847
 	 * @return void
848 848
 	 */
849 849
 	function _copyLayoutFile($sourceLayoutSrl, $targetLayoutSrl)
Please login to merge, or discard this patch.
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function procLayoutAdminInsert()
25 25
 	{
26
-		if(Context::get('layout') == 'faceoff') return $this->stop('not supported');
26
+		if (Context::get('layout') == 'faceoff') return $this->stop('not supported');
27 27
 
28 28
 		// Get information to create a layout
29 29
 		$site_module_info = Context::get('site_module_info');
30
-		$args->site_srl = (int)$site_module_info->site_srl;
30
+		$args->site_srl = (int) $site_module_info->site_srl;
31 31
 		$args->layout_srl = getNextSequence();
32 32
 		$args->layout = Context::get('layout');
33 33
 		$args->title = Context::get('title');
34 34
 		$args->layout_type = Context::get('_layout_type');
35
-		if(!$args->layout_type) $args->layout_type = "P";
35
+		if (!$args->layout_type) $args->layout_type = "P";
36 36
 
37 37
 		// Insert into the DB
38 38
 		$output = $this->insertLayout($args);
39
-		if(!$output->toBool()) return $output;
39
+		if (!$output->toBool()) return $output;
40 40
 
41 41
 		// initiate if it is faceoff layout
42 42
 		$this->initLayout($args->layout_srl, $args->layout);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	{
71 71
 		$oLayoutModel = getModel('layout');
72 72
 		// Import a sample layout if it is faceoff
73
-		if($oLayoutModel->useDefaultLayout($layout_name))
73
+		if ($oLayoutModel->useDefaultLayout($layout_name))
74 74
 		{
75 75
 			$this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar');
76 76
 			// Remove a directory
@@ -101,25 +101,25 @@  discard block
 block discarded – undo
101 101
 		$is_sitemap = $extra_vars->is_sitemap;
102 102
 		unset($extra_vars->is_sitemap);
103 103
 
104
-		$args = Context::gets('layout_srl','title');
104
+		$args = Context::gets('layout_srl', 'title');
105 105
 		// Get layout information
106 106
 		$oLayoutModel = getModel('layout');
107 107
 		$oMenuAdminModel = getAdminModel('menu');
108 108
 		$layout_info = $oLayoutModel->getLayout($args->layout_srl);
109 109
 
110
-		if($layout_info->menu)
110
+		if ($layout_info->menu)
111 111
 		{
112 112
 			$menus = get_object_vars($layout_info->menu);
113 113
 		}
114
-		if(count($menus))
114
+		if (count($menus))
115 115
 		{
116
-			foreach($menus as $menu_id => $val)
116
+			foreach ($menus as $menu_id => $val)
117 117
 			{
118 118
 				$menu_srl = Context::get($menu_id);
119
-				if(!$menu_srl) continue;
119
+				if (!$menu_srl) continue;
120 120
 
121 121
 				// if menu is -1, get default menu in site
122
-				if($menu_srl == -1)
122
+				if ($menu_srl == -1)
123 123
 				{
124 124
 					$oModuleModel = getModel('module');
125 125
 					$start_module = $oModuleModel->getSiteInfo(0, $columnList);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 					$tmpArgs->url = $start_module->mid;
128 128
 					$tmpArgs->site_srl = 0;
129 129
 					$output = executeQuery('menu.getMenuItemByUrl', $tmpArgs);
130
-					if(!$output->toBool())
130
+					if (!$output->toBool())
131 131
 					{
132 132
 						return new BaseObject(-1, 'fail_to_update');
133 133
 					}
@@ -143,31 +143,31 @@  discard block
 block discarded – undo
143 143
 				$apply_layout = Context::get('apply_layout');
144 144
 				$apply_mobile_view = Context::get('apply_mobile_view');
145 145
 
146
-				if($apply_layout=='Y' || $apply_mobile_view=='Y')
146
+				if ($apply_layout == 'Y' || $apply_mobile_view == 'Y')
147 147
 				{
148 148
 					$menu_args = new stdClass();
149 149
 					$menu_args->menu_srl = $menu_srl;
150 150
 					$menu_args->site_srl = $layout_info->site_srl;
151 151
 					$output = executeQueryArray('layout.getLayoutModules', $menu_args);
152
-					if($output->data)
152
+					if ($output->data)
153 153
 					{
154 154
 						$modules = array();
155
-						for($i=0;$i<count($output->data);$i++)
155
+						for ($i = 0; $i < count($output->data); $i++)
156 156
 						{
157 157
 							$modules[] = $output->data[$i]->module_srl;
158 158
 						}
159 159
 
160
-						if(count($modules))
160
+						if (count($modules))
161 161
 						{
162 162
 							$update_args = new stdClass();
163
-							$update_args->module_srls = implode(',',$modules);
164
-							if($apply_layout == "Y")
163
+							$update_args->module_srls = implode(',', $modules);
164
+							if ($apply_layout == "Y")
165 165
 							{
166 166
 								$update_args->layout_srl = $args->layout_srl;
167 167
 							}
168
-							if($layout_info->layout_type == "M")
168
+							if ($layout_info->layout_type == "M")
169 169
 							{
170
-								if(Context::get('apply_mobile_view') == "Y")
170
+								if (Context::get('apply_mobile_view') == "Y")
171 171
 								{
172 172
 									$update_args->use_mobile = "Y";
173 173
 								}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 							}
180 180
 
181 181
 							$oCacheHandler = CacheHandler::getInstance('object', null, true);
182
-							if($oCacheHandler->isSupport())
182
+							if ($oCacheHandler->isSupport())
183 183
 							{
184 184
 								$oCacheHandler->invalidateGroupKey('site_and_module');
185 185
 							}
@@ -191,21 +191,21 @@  discard block
 block discarded – undo
191 191
 
192 192
 		$tmpDir = sprintf('./files/attach/images/%s/tmp', $args->layout_srl);
193 193
 		// Separately handle if a type of extra_vars is an image
194
-		if($layout_info->extra_var)
194
+		if ($layout_info->extra_var)
195 195
 		{
196
-			foreach($layout_info->extra_var as $name => $vars)
196
+			foreach ($layout_info->extra_var as $name => $vars)
197 197
 			{
198
-				if($vars->type!='image') continue;
198
+				if ($vars->type != 'image') continue;
199 199
 
200 200
 				$fileName = $extra_vars->{$name};
201
-				if($vars->value == $fileName)
201
+				if ($vars->value == $fileName)
202 202
 				{
203 203
 					continue;
204 204
 				}
205 205
 
206 206
 				FileHandler::removeFile($vars->value);
207 207
 
208
-				if(!$fileName)
208
+				if (!$fileName)
209 209
 				{
210 210
 					continue;
211 211
 				}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 				$pathInfo = pathinfo($fileName);
214 214
 				$tmpFileName = sprintf('%s/tmp/%s', $pathInfo['dirname'], $pathInfo['basename']);
215 215
 
216
-				if(!FileHandler::moveFile($tmpFileName, $fileName))
216
+				if (!FileHandler::moveFile($tmpFileName, $fileName))
217 217
 				{
218 218
 					unset($extra_vars->{$name});
219 219
 				}
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
 		$oModuleController = getController('module');
226 226
 		$layout_config = new stdClass();
227 227
 		$layout_config->header_script = Context::get('header_script');
228
-		$oModuleController->insertModulePartConfig('layout',$args->layout_srl,$layout_config);
228
+		$oModuleController->insertModulePartConfig('layout', $args->layout_srl, $layout_config);
229 229
 		// Save a title of the menu
230 230
 		$extra_vars->menu_name_list = $menu_name_list;
231 231
 		// Variable setting for DB insert
232 232
 		$args->extra_vars = serialize($extra_vars);
233 233
 
234 234
 		$output = $this->updateLayout($args);
235
-		if(!$output->toBool())
235
+		if (!$output->toBool())
236 236
 		{
237 237
 			return $output;
238 238
 		}
239 239
 
240 240
 		FileHandler::removeDir($tmpDir);
241 241
 
242
-		if(!$is_sitemap)
242
+		if (!$is_sitemap)
243 243
 		{
244 244
 			return $this->setRedirectUrl(Context::get('error_return_url'), $output);
245 245
 		}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	function updateLayout($args) {
260 260
 		$output = executeQuery('layout.updateLayout', $args);
261
-		if($output->toBool())
261
+		if ($output->toBool())
262 262
 		{
263 263
 			$oLayoutModel = getModel('layout');
264 264
 			$cache_file = $oLayoutModel->getUserLayoutCache($args->layout_srl, Context::getLangType());
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
 	{
290 290
 		$oLayoutModel = getModel('layout');
291 291
 
292
-		if($force)
292
+		if ($force)
293 293
 		{
294 294
 			$layoutInfo = $oLayoutModel->getLayout($layout_srl);
295
-			if($layoutInfo)
295
+			if ($layoutInfo)
296 296
 			{
297 297
 				$layoutList = $oLayoutModel->getLayoutInstanceList($layoutInfo->site_srl, $layoutInfo->layout_type, $layoutInfo->layout, array('layout_srl', 'layout'));
298
-				if(count($layoutList) <= 1)
298
+				if (count($layoutList) <= 1)
299 299
 				{
300 300
 					// uninstall package
301 301
 					$path = $layoutInfo->path;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 					$packageSrl = $oAutoinstallModel->getPackageSrlByPath($path);
305 305
 					$oAutoinstallAdminController = getAdminController('autoinstall');
306 306
 
307
-					if($packageSrl)
307
+					if ($packageSrl)
308 308
 					{
309 309
 						$output = $oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl);
310 310
 					}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 						$output = $oAutoinstallAdminController->uninstallPackageByPath($path);
314 314
 					}
315 315
 
316
-					if(!$output->toBool())
316
+					if (!$output->toBool())
317 317
 					{
318 318
 						return new BaseObject(-1, $output->message);
319 319
 					}
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 		$args->layout_srl = $layout_srl;
332 332
 		$output = executeQuery("layout.deleteLayout", $args);
333 333
 
334
-		if(!$output->toBool()) return $output;
334
+		if (!$output->toBool()) return $output;
335 335
 
336
-		return new BaseObject(0,'success_deleted');
336
+		return new BaseObject(0, 'success_deleted');
337 337
 	}
338 338
 
339 339
 	/**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		$code_css   = Context::get('code_css');
354 354
 		$is_post    = ($_SERVER['REQUEST_METHOD'] == 'POST');
355 355
 
356
-		if(!$layout_srl || !$code || !$is_post)
356
+		if (!$layout_srl || !$code || !$is_post)
357 357
 		{
358 358
 			return new BaseObject(-1, 'msg_invalid_request');
359 359
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	function procLayoutAdminCodeReset()
377 377
 	{
378 378
 		$layout_srl = Context::get('layout_srl');
379
-		if(!$layout_srl) return new BaseObject(-1, 'msg_invalid_request');
379
+		if (!$layout_srl) return new BaseObject(-1, 'msg_invalid_request');
380 380
 
381 381
 		// delete user layout file
382 382
 		$oLayoutModel = getModel('layout');
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		$info = $oLayoutModel->getLayout($layout_srl);
387 387
 
388 388
 		// if face off delete, tmp file
389
-		if($oLayoutModel->useDefaultLayout($info->layout))
389
+		if ($oLayoutModel->useDefaultLayout($info->layout))
390 390
 		{
391 391
 			$this->deleteUserLayoutTempFile($layout_srl);
392 392
 			$faceoff_css = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl);
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	function procLayoutAdminUserImageUpload()
406 406
 	{
407
-		if(!Context::isUploaded()) exit();
407
+		if (!Context::isUploaded()) exit();
408 408
 
409 409
 		$image = Context::get('user_layout_image');
410 410
 		$layout_srl = Context::get('layout_srl');
411
-		if(!is_uploaded_file($image['tmp_name'])) exit();
411
+		if (!is_uploaded_file($image['tmp_name'])) exit();
412 412
 
413 413
 		$this->insertUserLayoutImage($layout_srl, $image);
414 414
 		$this->setTemplatePath($this->module_path.'tpl');
@@ -423,24 +423,24 @@  discard block
 block discarded – undo
423 423
 	 * @param object $source file data
424 424
 	 * @return boolean (true : success, false : fail)
425 425
 	 */
426
-	function insertUserLayoutImage($layout_srl,$source)
426
+	function insertUserLayoutImage($layout_srl, $source)
427 427
 	{
428 428
 		$oLayoutModel = getModel('layout');
429 429
 		$path = $oLayoutModel->getUserLayoutImagePath($layout_srl);
430
-		if(!is_dir($path)) FileHandler::makeDir($path);
430
+		if (!is_dir($path)) FileHandler::makeDir($path);
431 431
 
432 432
 		$filename = strtolower($source['name']);
433
-		if($filename != urlencode($filename))
433
+		if ($filename != urlencode($filename))
434 434
 		{
435
-			$ext = substr(strrchr($filename,'.'),1);
435
+			$ext = substr(strrchr($filename, '.'), 1);
436 436
 			$filename = sprintf('%s.%s', md5($filename), $ext);
437 437
 		}
438 438
 
439 439
 		// Check uploaded file
440
-		if(!checkUploadedFile($source['tmp_name'])) return false;
440
+		if (!checkUploadedFile($source['tmp_name'])) return false;
441 441
 		
442
-		if(file_exists($path .'/'. $filename)) @unlink($path . $filename);
443
-		if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false;
442
+		if (file_exists($path.'/'.$filename)) @unlink($path.$filename);
443
+		if (!move_uploaded_file($source['tmp_name'], $path.$filename)) return false;
444 444
 		return true;
445 445
 	}
446 446
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	{
453 453
 		$filename = Context::get('filename');
454 454
 		$layout_srl = Context::get('layout_srl');
455
-		$this->removeUserLayoutImage($layout_srl,$filename);
455
+		$this->removeUserLayoutImage($layout_srl, $filename);
456 456
 		$this->setMessage('success_deleted');
457 457
 		$this->setRedirectUrl(Context::get('error_return_url'));
458 458
 	}
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 	 * @param string $filename
464 464
 	 * @return void
465 465
 	 */
466
-	function removeUserLayoutImage($layout_srl,$filename)
466
+	function removeUserLayoutImage($layout_srl, $filename)
467 467
 	{
468 468
 		$oLayoutModel = getModel('layout');
469 469
 		$path = $oLayoutModel->getUserLayoutImagePath($layout_srl);
470
-		@unlink($path . $filename);
470
+		@unlink($path.$filename);
471 471
 	}
472 472
 
473 473
 	// deprecated
@@ -482,19 +482,19 @@  discard block
 block discarded – undo
482 482
 		$oModuleModel = getModel('module');
483 483
 
484 484
 		$mid = Context::get('mid');
485
-		if(!$mid) return new BaseObject(-1, 'msg_invalid_request');
485
+		if (!$mid) return new BaseObject(-1, 'msg_invalid_request');
486 486
 
487 487
 		$site_module_info = Context::get('site_module_info');
488 488
 		$columnList = array('layout_srl');
489 489
 		$module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList);
490 490
 		$layout_srl = $module_info->layout_srl;
491
-		if(!$layout_srl) return new BaseObject(-1, 'msg_invalid_request');
491
+		if (!$layout_srl) return new BaseObject(-1, 'msg_invalid_request');
492 492
 
493 493
 		$oLayoutModel = getModel('layout');
494 494
 
495 495
 		// save tmp?
496 496
 		$temp = Context::get('saveTemp');
497
-		if($temp =='Y')
497
+		if ($temp == 'Y')
498 498
 		{
499 499
 			$oLayoutModel->setUseUserLayoutTemp();
500 500
 		}
@@ -504,28 +504,28 @@  discard block
 block discarded – undo
504 504
 			$this->deleteUserLayoutTempFile($layout_srl);
505 505
 		}
506 506
 
507
-		$this->add('saveTemp',$temp);
507
+		$this->add('saveTemp', $temp);
508 508
 
509 509
 		// write user layout
510
-		$extension_obj = Context::gets('e1','e2','neck','knee');
510
+		$extension_obj = Context::gets('e1', 'e2', 'neck', 'knee');
511 511
 
512 512
 		$file = $oLayoutModel->getUserLayoutHtml($layout_srl);
513 513
 		$content = FileHandler::readFile($file);
514
-		$content = $this->addExtension($layout_srl,$extension_obj,$content);
515
-		FileHandler::writeFile($file,$content);
514
+		$content = $this->addExtension($layout_srl, $extension_obj, $content);
515
+		FileHandler::writeFile($file, $content);
516 516
 
517 517
 		// write faceoff.css
518 518
 		$css = stripslashes(Context::get('css'));
519 519
 
520 520
 		$css_file = $oLayoutModel->getUserLayoutFaceOffCss($layout_srl);
521
-		FileHandler::writeFile($css_file,$css);
521
+		FileHandler::writeFile($css_file, $css);
522 522
 
523 523
 		// write ini
524
-		$obj = Context::gets('type','align','column');
525
-		$obj = (array)$obj;
524
+		$obj = Context::gets('type', 'align', 'column');
525
+		$obj = (array) $obj;
526 526
 		$src = $oLayoutModel->getUserLayoutIniConfig($layout_srl);
527
-		foreach($obj as $key => $val) $src[$key] = $val;
528
-		$this->insertUserLayoutValue($layout_srl,$src);
527
+		foreach ($obj as $key => $val) $src[$key] = $val;
528
+		$this->insertUserLayoutValue($layout_srl, $src);
529 529
 	}
530 530
 
531 531
 	/**
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 	 * @param object $arr layout ini
535 535
 	 * @return void
536 536
 	 */
537
-	function insertUserLayoutValue($layout_srl,$arr)
537
+	function insertUserLayoutValue($layout_srl, $arr)
538 538
 	{
539 539
 		$oLayoutModel = getModel('layout');
540 540
 		$file = $oLayoutModel->getUserLayoutIni($layout_srl);
@@ -548,24 +548,24 @@  discard block
 block discarded – undo
548 548
 	 * @param string $content
549 549
 	 * @return string
550 550
 	 */
551
-	function addExtension($layout_srl,$arg,$content)
551
+	function addExtension($layout_srl, $arg, $content)
552 552
 	{
553 553
 		$oLayoutModel = getModel('layout');
554 554
 		$reg = '/(<\!\-\- start\-e1 \-\->)(.*)(<\!\-\- end\-e1 \-\->)/i';
555
-		$extension_content =  '\1' .stripslashes($arg->e1) . '\3';
556
-		$content = preg_replace($reg,$extension_content,$content);
555
+		$extension_content = '\1'.stripslashes($arg->e1).'\3';
556
+		$content = preg_replace($reg, $extension_content, $content);
557 557
 
558 558
 		$reg = '/(<\!\-\- start\-e2 \-\->)(.*)(<\!\-\- end\-e2 \-\->)/i';
559
-		$extension_content =  '\1' .stripslashes($arg->e2) . '\3';
560
-		$content = preg_replace($reg,$extension_content,$content);
559
+		$extension_content = '\1'.stripslashes($arg->e2).'\3';
560
+		$content = preg_replace($reg, $extension_content, $content);
561 561
 
562 562
 		$reg = '/(<\!\-\- start\-neck \-\->)(.*)(<\!\-\- end\-neck \-\->)/i';
563
-		$extension_content =  '\1' .stripslashes($arg->neck) . '\3';
564
-		$content = preg_replace($reg,$extension_content,$content);
563
+		$extension_content = '\1'.stripslashes($arg->neck).'\3';
564
+		$content = preg_replace($reg, $extension_content, $content);
565 565
 
566 566
 		$reg = '/(<\!\-\- start\-knee \-\->)(.*)(<\!\-\- end\-knee \-\->)/i';
567
-		$extension_content =  '\1' .stripslashes($arg->knee) . '\3';
568
-		$content = preg_replace($reg,$extension_content,$content);
567
+		$extension_content = '\1'.stripslashes($arg->knee).'\3';
568
+		$content = preg_replace($reg, $extension_content, $content);
569 569
 		return $content;
570 570
 	}
571 571
 
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	{
579 579
 		$oLayoutModel = getModel('layout');
580 580
 		$file_list = $oLayoutModel->getUserLayoutTempFileList($layout_srl);
581
-		foreach($file_list as $key => $file)
581
+		foreach ($file_list as $key => $file)
582 582
 		{
583 583
 			FileHandler::removeFile($file);
584 584
 		}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	function procLayoutAdminUserLayoutExport()
592 592
 	{
593 593
 		$layout_srl = Context::get('layout_srl');
594
-		if(!$layout_srl) return new BaseObject('-1','msg_invalid_request');
594
+		if (!$layout_srl) return new BaseObject('-1', 'msg_invalid_request');
595 595
 
596 596
 		require_once(_XE_PATH_.'libs/tar.class.php');
597 597
 		$oLayoutModel = getModel('layout');
@@ -606,30 +606,30 @@  discard block
 block discarded – undo
606 606
 		$file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
607 607
 		unset($file_list[2]);
608 608
 
609
-		foreach($file_list as $file)
609
+		foreach ($file_list as $file)
610 610
 		{
611
-			if(strncasecmp('images', $file, 6) === 0) continue;
611
+			if (strncasecmp('images', $file, 6) === 0) continue;
612 612
 
613 613
 			// replace path
614
-			$file = $target_path . $file;
614
+			$file = $target_path.$file;
615 615
 			$content = FileHandler::readFile($file);
616
-			$pattern = '/(http:\/\/[^ ]+)?(\.\/)?' . str_replace('/', '\/', (str_replace('./', '', $file_path))) . '/';
617
-			if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css')
616
+			$pattern = '/(http:\/\/[^ ]+)?(\.\/)?'.str_replace('/', '\/', (str_replace('./', '', $file_path))).'/';
617
+			if (basename($file) == 'faceoff.css' || basename($file) == 'layout.css')
618 618
 				$content = preg_replace($pattern, '../', $content);
619 619
 			else
620 620
 				$content = preg_replace($pattern, './', $content);
621 621
 
622 622
 			// replace ini config
623
-			foreach($ini_config as $key => $value)
623
+			foreach ($ini_config as $key => $value)
624 624
 			{
625
-				$content = str_replace('{$layout_info->faceoff_ini_config[\'' . $key . '\']}', $value, $content);
625
+				$content = str_replace('{$layout_info->faceoff_ini_config[\''.$key.'\']}', $value, $content);
626 626
 			}
627 627
 
628 628
 			FileHandler::writeFile($file, $content);
629 629
 		}
630 630
 
631 631
 		// make info.xml
632
-		$info_file = $target_path . 'conf/info.xml';
632
+		$info_file = $target_path.'conf/info.xml';
633 633
 		FileHandler::copyFile('./modules/layout/faceoff/conf/info.xml', $info_file);
634 634
 		$content = FileHandler::readFile($info_file);
635 635
 		$content = str_replace('type="faceoff"', '', $content);
@@ -637,19 +637,19 @@  discard block
 block discarded – undo
637 637
 		$file_list[] = 'conf/info.xml';
638 638
 
639 639
 		// make css file
640
-		$css_file = $target_path . 'css/layout.css';
640
+		$css_file = $target_path.'css/layout.css';
641 641
 		FileHandler::copyFile('./modules/layout/faceoff/css/layout.css', $css_file);
642 642
 		$content = FileHandler::readFile('./modules/layout/tpl/css/widget.css');
643
-		FileHandler::writeFile($css_file, "\n" . $content, 'a');
644
-		$content = FileHandler::readFile($target_path . 'faceoff.css');
645
-		FileHandler::writeFile($css_file, "\n" . $content, 'a');
646
-		$content = FileHandler::readFile($target_path . 'layout.css');
647
-		FileHandler::writeFile($css_file, "\n" . $content, 'a');
643
+		FileHandler::writeFile($css_file, "\n".$content, 'a');
644
+		$content = FileHandler::readFile($target_path.'faceoff.css');
645
+		FileHandler::writeFile($css_file, "\n".$content, 'a');
646
+		$content = FileHandler::readFile($target_path.'layout.css');
647
+		FileHandler::writeFile($css_file, "\n".$content, 'a');
648 648
 
649 649
 		// css load
650
-		$content = FileHandler::readFile($target_path . 'layout.html');
651
-		$content = "<load target=\"css/layout.css\" />\n" . $content;
652
-		FileHandler::writeFile($target_path . 'layout.html', $content);
650
+		$content = FileHandler::readFile($target_path.'layout.html');
651
+		$content = "<load target=\"css/layout.css\" />\n".$content;
652
+		FileHandler::writeFile($target_path.'layout.html', $content);
653 653
 		unset($file_list[3]);
654 654
 		unset($file_list[1]);
655 655
 		$file_list[] = 'css/layout.css';
@@ -658,16 +658,16 @@  discard block
 block discarded – undo
658 658
 		$tar = new tar();
659 659
 		$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0));
660 660
 		chdir($user_layout_path);
661
-		foreach($file_list as $key => $file) $tar->addFile($file);
661
+		foreach ($file_list as $key => $file) $tar->addFile($file);
662 662
 
663 663
 		$stream = $tar->toTarStream();
664
-		$filename = 'faceoff_' . date('YmdHis') . '.tar';
664
+		$filename = 'faceoff_'.date('YmdHis').'.tar';
665 665
 		header("Cache-Control: ");
666 666
 		header("Pragma: ");
667 667
 		header("Content-Type: application/x-compressed");
668
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
668
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
669 669
 		//            header("Content-Length: " .strlen($stream)); ?? why??
670
-		header('Content-Disposition: attachment; filename="'. $filename .'"');
670
+		header('Content-Disposition: attachment; filename="'.$filename.'"');
671 671
 		header("Content-Transfer-Encoding: binary\n");
672 672
 		echo $stream;
673 673
 		// Close Context and then exit
@@ -689,18 +689,18 @@  discard block
 block discarded – undo
689 689
 		return $this->stop('not supported');
690 690
 
691 691
 		// check upload
692
-		if(!Context::isUploaded()) exit();
692
+		if (!Context::isUploaded()) exit();
693 693
 		$file = Context::get('file');
694
-		if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit();
694
+		if (!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit();
695 695
 
696
-		if(substr_compare($file['name'], '.tar', -4) !== 0) exit();
696
+		if (substr_compare($file['name'], '.tar', -4) !== 0) exit();
697 697
 
698 698
 		$layout_srl = Context::get('layout_srl');
699
-		if(!$layout_srl) exit();
699
+		if (!$layout_srl) exit();
700 700
 
701 701
 		$oLayoutModel = getModel('layout');
702 702
 		$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
703
-		if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) exit();
703
+		if (!move_uploaded_file($file['tmp_name'], $user_layout_path.'faceoff.tar')) exit();
704 704
 
705 705
 		$this->importLayout($layout_srl, $user_layout_path.'faceoff.tar');
706 706
 
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
 	function procLayoutAdminCopyLayout()
715 715
 	{
716 716
 		$sourceArgs = Context::getRequestVars();
717
-		if($sourceArgs->layout == 'faceoff')
717
+		if ($sourceArgs->layout == 'faceoff')
718 718
 		{
719 719
 			return $this->stop('not supported');
720 720
 		}
721 721
 
722
-		if(!$sourceArgs->layout_srl)
722
+		if (!$sourceArgs->layout_srl)
723 723
 		{
724 724
 			return $this->stop('msg_empty_origin_layout');
725 725
 		}
@@ -727,12 +727,12 @@  discard block
 block discarded – undo
727 727
 		$oLayoutModel = getModel('layout');
728 728
 		$layout = $oLayoutModel->getLayout($sourceArgs->layout_srl);
729 729
 
730
-		if(!$sourceArgs->title)
730
+		if (!$sourceArgs->title)
731 731
 		{
732 732
 			$sourceArgs->title = array($layout->title.'_'.$this->_makeRandomMid());
733 733
 		}
734 734
 
735
-		if(!is_array($sourceArgs->title) || count($sourceArgs->title) == 0)
735
+		if (!is_array($sourceArgs->title) || count($sourceArgs->title) == 0)
736 736
 		{
737 737
 			return $this->stop('msg_empty_target_layout');
738 738
 		}
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 		$args->extra_vars = $output->extra_vars;
743 743
 		$extra_vars = unserialize($args->extra_vars);
744 744
 		
745
-		if($layout->extra_var_count) {
745
+		if ($layout->extra_var_count) {
746 746
 			$reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/";
747
-			if($extra_vars) foreach($extra_vars as $key => $val) {
748
-				if($layout->extra_var->{$key}->type == 'image') {
749
-					if(!preg_match($reg,$val,$matches)) continue;
747
+			if ($extra_vars) foreach ($extra_vars as $key => $val) {
748
+				if ($layout->extra_var->{$key}->type == 'image') {
749
+					if (!preg_match($reg, $val, $matches)) continue;
750 750
 					$image_list[$key]->filename = $matches[2];
751 751
 					$image_list[$key]->old_file = $val;
752 752
 				}
@@ -758,19 +758,19 @@  discard block
 block discarded – undo
758 758
 		$layout_config->header_script = $extra_vars->header_script;
759 759
 
760 760
 		// Get information to create a layout
761
-		$args->site_srl = (int)$layout->site_srl;
761
+		$args->site_srl = (int) $layout->site_srl;
762 762
 		$args->layout = $layout->layout;
763 763
 		$args->layout_type = $layout->layout_type;
764
-		if(!$args->layout_type) $args->layout_type = "P";
764
+		if (!$args->layout_type) $args->layout_type = "P";
765 765
 
766 766
 		$oDB = &DB::getInstance();
767 767
 		$oDB->begin();
768 768
 
769
-		if(is_array($sourceArgs->title))
769
+		if (is_array($sourceArgs->title))
770 770
 		{
771
-			foreach($sourceArgs->title AS $key=>$value)
771
+			foreach ($sourceArgs->title AS $key=>$value)
772 772
 			{
773
-				if(!trim($value))
773
+				if (!trim($value))
774 774
 				{
775 775
 					continue;
776 776
 				}
@@ -778,9 +778,9 @@  discard block
 block discarded – undo
778 778
 				$args->layout_srl = getNextSequence();
779 779
 				$args->title = $value;
780 780
 
781
-				if(is_array($image_list)) {
782
-					foreach($image_list as $key=>$val) {
783
-						$new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl,$val->filename);
781
+				if (is_array($image_list)) {
782
+					foreach ($image_list as $key=>$val) {
783
+						$new_file = sprintf("./files/attach/images/%s/%s", $args->layout_srl, $val->filename);
784 784
 						FileHandler::copyFile($val->old_file, $new_file);
785 785
 						$extra_vars->{$key} = $new_file;
786 786
 					}
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 
793 793
 				// Insert into the DB
794 794
 				$output = $this->insertLayout($args);
795
-				if(!$output->toBool())
795
+				if (!$output->toBool())
796 796
 				{
797 797
 					$oDB->rollback();
798 798
 					return $output;
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
 		$oDB->commit();
816 816
 
817 817
 		$this->setMessage('success_registed');
818
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
818
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) {
819 819
 			global $lang;
820 820
 			htmlHeader();
821 821
 			alertScript($lang->success_registed);
@@ -831,9 +831,9 @@  discard block
 block discarded – undo
831 831
 	{
832 832
 		$time = $_SERVER['REQUEST_TIME'];
833 833
 		$randomString = "";
834
-		for($i=0;$i<4;$i++)
834
+		for ($i = 0; $i < 4; $i++)
835 835
 		{
836
-			$doc = rand()%26+65;
836
+			$doc = rand() % 26 + 65;
837 837
 			$randomString .= chr($doc);
838 838
 		}
839 839
 
@@ -857,12 +857,12 @@  discard block
 block discarded – undo
857 857
 		FileHandler::makeDir($targetImagePath);
858 858
 
859 859
 		$sourceFileList = $oLayoutModel->getUserLayoutFileList($sourceLayoutSrl);
860
-		foreach($sourceFileList as $key => $file)
860
+		foreach ($sourceFileList as $key => $file)
861 861
 		{
862
-			if(is_readable($sourceLayoutPath.$file))
862
+			if (is_readable($sourceLayoutPath.$file))
863 863
 			{
864 864
 				FileHandler::copyFile($sourceLayoutPath.$file, $targetLayoutPath.$file);
865
-				if($file == 'layout.html' || $file == 'layout.css')
865
+				if ($file == 'layout.html' || $file == 'layout.css')
866 866
 				{
867 867
 					$this->_changeFilepathInSource($targetLayoutPath.$file, $sourceImagePath, $targetImagePath);
868 868
 				}
@@ -893,9 +893,9 @@  discard block
 block discarded – undo
893 893
 		$oLayoutModel = getModel('layout');
894 894
 		$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
895 895
 		$file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
896
-		foreach($file_list as $key => $file)
896
+		foreach ($file_list as $key => $file)
897 897
 		{
898
-			FileHandler::removeFile($user_layout_path . $file);
898
+			FileHandler::removeFile($user_layout_path.$file);
899 899
 		}
900 900
 
901 901
 		require_once(_XE_PATH_.'libs/tar.class.php');
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
 		$tar = new tar();
905 905
 		$tar->openTAR($source_file);
906 906
 		// If layout.ini file does not exist
907
-		if(!$tar->getFile('layout.ini')) return;
907
+		if (!$tar->getFile('layout.ini')) return;
908 908
 
909
-		$replace_path = getNumberingPath($layout_srl,3);
910
-		foreach($tar->files as $key => $info)
909
+		$replace_path = getNumberingPath($layout_srl, 3);
910
+		foreach ($tar->files as $key => $info)
911 911
 		{
912
-			FileHandler::writeFile($user_layout_path . $info['name'],str_replace('__LAYOUT_PATH__',$replace_path,$info['file']));
912
+			FileHandler::writeFile($user_layout_path.$info['name'], str_replace('__LAYOUT_PATH__', $replace_path, $info['file']));
913 913
 		}
914 914
 		// Remove uploaded file
915 915
 		FileHandler::removeFile($source_file);
@@ -927,32 +927,32 @@  discard block
 block discarded – undo
927 927
 		$this->setTemplatePath($this->module_path.'tpl');
928 928
 		$this->setTemplateFile("after_upload_config_image.html");
929 929
 
930
-		if(!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name']))
930
+		if (!$img['tmp_name'] || !is_uploaded_file($img['tmp_name']) || !checkUploadedFile($img['tmp_name']))
931 931
 		{
932 932
 			Context::set('msg', Context::getLang('upload failed'));
933 933
 			return;
934 934
 		}
935 935
 
936
-		if(!preg_match('/\.(jpg|jpeg|gif|png)$/i', $img['name']))
936
+		if (!preg_match('/\.(jpg|jpeg|gif|png)$/i', $img['name']))
937 937
 		{
938 938
 			Context::set('msg', Context::getLang('msg_layout_image_target'));
939 939
 			return;
940 940
 		}
941 941
 
942 942
 		$path = sprintf('./files/attach/images/%s/', $layoutSrl);
943
-		$tmpPath = $path . 'tmp/';
944
-		if(!FileHandler::makeDir($tmpPath))
943
+		$tmpPath = $path.'tmp/';
944
+		if (!FileHandler::makeDir($tmpPath))
945 945
 		{
946 946
 			Context::set('msg', Context::getLang('make directory failed'));
947 947
 			return;
948 948
 		}
949 949
 
950
-		$ext = substr(strrchr($img['name'],'.'),1);
951
-		$_fileName = md5(crypt(rand(1000000,900000), rand(0,100))).'.'.$ext;
952
-		$fileName = $path . $_fileName;
953
-		$tmpFileName = $tmpPath . $_fileName;
950
+		$ext = substr(strrchr($img['name'], '.'), 1);
951
+		$_fileName = md5(crypt(rand(1000000, 900000), rand(0, 100))).'.'.$ext;
952
+		$fileName = $path.$_fileName;
953
+		$tmpFileName = $tmpPath.$_fileName;
954 954
 
955
-		if(!move_uploaded_file($img['tmp_name'], $tmpFileName))
955
+		if (!move_uploaded_file($img['tmp_name'], $tmpFileName))
956 956
 		{
957 957
 			Context::set('msg', Context::getLang('move file failed'));
958 958
 			return;
@@ -977,9 +977,9 @@  discard block
 block discarded – undo
977 977
 		$oModel = getModel('layout');
978 978
 		$layoutInfo = $oModel->getLayout($layoutSrl);
979 979
 
980
-		if($layoutInfo->extra_var_count)
980
+		if ($layoutInfo->extra_var_count)
981 981
 		{
982
-			foreach($layoutInfo->extra_var as $varId => $val)
982
+			foreach ($layoutInfo->extra_var as $varId => $val)
983 983
 			{
984 984
 				$newLayoutInfo->{$varId} = $val->value;
985 985
 			}
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 		$args->layout_srl = $layoutSrl;
991 991
 		$args->extra_vars = serialize($newLayoutInfo);
992 992
 		$output = $this->updateLayout($args);
993
-		if(!$output->toBool())
993
+		if (!$output->toBool())
994 994
 		{
995 995
 			Context::set('msg', Context::getLang($output->getMessage()));
996 996
 			return $output;
Please login to merge, or discard this patch.
Braces   +94 added lines, -42 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function procLayoutAdminInsert()
25 25
 	{
26
-		if(Context::get('layout') == 'faceoff') return $this->stop('not supported');
26
+		if(Context::get('layout') == 'faceoff') {
27
+			return $this->stop('not supported');
28
+		}
27 29
 
28 30
 		// Get information to create a layout
29 31
 		$site_module_info = Context::get('site_module_info');
@@ -32,11 +34,15 @@  discard block
 block discarded – undo
32 34
 		$args->layout = Context::get('layout');
33 35
 		$args->title = Context::get('title');
34 36
 		$args->layout_type = Context::get('_layout_type');
35
-		if(!$args->layout_type) $args->layout_type = "P";
37
+		if(!$args->layout_type) {
38
+			$args->layout_type = "P";
39
+		}
36 40
 
37 41
 		// Insert into the DB
38 42
 		$output = $this->insertLayout($args);
39
-		if(!$output->toBool()) return $output;
43
+		if(!$output->toBool()) {
44
+			return $output;
45
+		}
40 46
 
41 47
 		// initiate if it is faceoff layout
42 48
 		$this->initLayout($args->layout_srl, $args->layout);
@@ -44,7 +50,9 @@  discard block
 block discarded – undo
44 50
 		// update layout info
45 51
 		Context::set('layout_srl', $args->layout_srl);
46 52
 		$output = $this->procLayoutAdminUpdate();
47
-		if (!$output->toBool()) return $output;
53
+		if (!$output->toBool()) {
54
+			return $output;
55
+		}
48 56
 
49 57
 		return $this->setRedirectUrl(Context::get('success_return_url'), $output);
50 58
 	}
@@ -74,8 +82,7 @@  discard block
 block discarded – undo
74 82
 		{
75 83
 			$this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar');
76 84
 			// Remove a directory
77
-		}
78
-		else
85
+		} else
79 86
 		{
80 87
 			FileHandler::removeDir($oLayoutModel->getUserLayoutPath($layout_srl));
81 88
 		}
@@ -116,7 +123,9 @@  discard block
 block discarded – undo
116 123
 			foreach($menus as $menu_id => $val)
117 124
 			{
118 125
 				$menu_srl = Context::get($menu_id);
119
-				if(!$menu_srl) continue;
126
+				if(!$menu_srl) {
127
+					continue;
128
+				}
120 129
 
121 130
 				// if menu is -1, get default menu in site
122 131
 				if($menu_srl == -1)
@@ -172,8 +181,7 @@  discard block
 block discarded – undo
172 181
 									$update_args->use_mobile = "Y";
173 182
 								}
174 183
 								$output = executeQuery('layout.updateModuleMLayout', $update_args);
175
-							}
176
-							else
184
+							} else
177 185
 							{
178 186
 								$output = executeQuery('layout.updateModuleLayout', $update_args);
179 187
 							}
@@ -195,7 +203,9 @@  discard block
 block discarded – undo
195 203
 		{
196 204
 			foreach($layout_info->extra_var as $name => $vars)
197 205
 			{
198
-				if($vars->type!='image') continue;
206
+				if($vars->type!='image') {
207
+					continue;
208
+				}
199 209
 
200 210
 				$fileName = $extra_vars->{$name};
201 211
 				if($vars->value == $fileName)
@@ -242,8 +252,7 @@  discard block
 block discarded – undo
242 252
 		if(!$is_sitemap)
243 253
 		{
244 254
 			return $this->setRedirectUrl(Context::get('error_return_url'), $output);
245
-		}
246
-		else
255
+		} else
247 256
 		{
248 257
 			$context = Context::getInstance();
249 258
 			$context->setRequestMethod('JSON');
@@ -307,8 +316,7 @@  discard block
 block discarded – undo
307 316
 					if($packageSrl)
308 317
 					{
309 318
 						$output = $oAutoinstallAdminController->uninstallPackageByPackageSrl($packageSrl);
310
-					}
311
-					else
319
+					} else
312 320
 					{
313 321
 						$output = $oAutoinstallAdminController->uninstallPackageByPath($path);
314 322
 					}
@@ -331,7 +339,9 @@  discard block
 block discarded – undo
331 339
 		$args->layout_srl = $layout_srl;
332 340
 		$output = executeQuery("layout.deleteLayout", $args);
333 341
 
334
-		if(!$output->toBool()) return $output;
342
+		if(!$output->toBool()) {
343
+			return $output;
344
+		}
335 345
 
336 346
 		return new BaseObject(0,'success_deleted');
337 347
 	}
@@ -376,7 +386,9 @@  discard block
 block discarded – undo
376 386
 	function procLayoutAdminCodeReset()
377 387
 	{
378 388
 		$layout_srl = Context::get('layout_srl');
379
-		if(!$layout_srl) return new BaseObject(-1, 'msg_invalid_request');
389
+		if(!$layout_srl) {
390
+			return new BaseObject(-1, 'msg_invalid_request');
391
+		}
380 392
 
381 393
 		// delete user layout file
382 394
 		$oLayoutModel = getModel('layout');
@@ -404,11 +416,15 @@  discard block
 block discarded – undo
404 416
 	 */
405 417
 	function procLayoutAdminUserImageUpload()
406 418
 	{
407
-		if(!Context::isUploaded()) exit();
419
+		if(!Context::isUploaded()) {
420
+			exit();
421
+		}
408 422
 
409 423
 		$image = Context::get('user_layout_image');
410 424
 		$layout_srl = Context::get('layout_srl');
411
-		if(!is_uploaded_file($image['tmp_name'])) exit();
425
+		if(!is_uploaded_file($image['tmp_name'])) {
426
+			exit();
427
+		}
412 428
 
413 429
 		$this->insertUserLayoutImage($layout_srl, $image);
414 430
 		$this->setTemplatePath($this->module_path.'tpl');
@@ -427,7 +443,9 @@  discard block
 block discarded – undo
427 443
 	{
428 444
 		$oLayoutModel = getModel('layout');
429 445
 		$path = $oLayoutModel->getUserLayoutImagePath($layout_srl);
430
-		if(!is_dir($path)) FileHandler::makeDir($path);
446
+		if(!is_dir($path)) {
447
+			FileHandler::makeDir($path);
448
+		}
431 449
 
432 450
 		$filename = strtolower($source['name']);
433 451
 		if($filename != urlencode($filename))
@@ -437,10 +455,16 @@  discard block
 block discarded – undo
437 455
 		}
438 456
 
439 457
 		// Check uploaded file
440
-		if(!checkUploadedFile($source['tmp_name'])) return false;
458
+		if(!checkUploadedFile($source['tmp_name'])) {
459
+			return false;
460
+		}
441 461
 		
442
-		if(file_exists($path .'/'. $filename)) @unlink($path . $filename);
443
-		if(!move_uploaded_file($source['tmp_name'], $path . $filename )) return false;
462
+		if(file_exists($path .'/'. $filename)) {
463
+			@unlink($path . $filename);
464
+		}
465
+		if(!move_uploaded_file($source['tmp_name'], $path . $filename )) {
466
+			return false;
467
+		}
444 468
 		return true;
445 469
 	}
446 470
 
@@ -482,13 +506,17 @@  discard block
 block discarded – undo
482 506
 		$oModuleModel = getModel('module');
483 507
 
484 508
 		$mid = Context::get('mid');
485
-		if(!$mid) return new BaseObject(-1, 'msg_invalid_request');
509
+		if(!$mid) {
510
+			return new BaseObject(-1, 'msg_invalid_request');
511
+		}
486 512
 
487 513
 		$site_module_info = Context::get('site_module_info');
488 514
 		$columnList = array('layout_srl');
489 515
 		$module_info = $oModuleModel->getModuleInfoByMid($mid, $site_module_info->site_srl, $columnList);
490 516
 		$layout_srl = $module_info->layout_srl;
491
-		if(!$layout_srl) return new BaseObject(-1, 'msg_invalid_request');
517
+		if(!$layout_srl) {
518
+			return new BaseObject(-1, 'msg_invalid_request');
519
+		}
492 520
 
493 521
 		$oLayoutModel = getModel('layout');
494 522
 
@@ -497,8 +525,7 @@  discard block
 block discarded – undo
497 525
 		if($temp =='Y')
498 526
 		{
499 527
 			$oLayoutModel->setUseUserLayoutTemp();
500
-		}
501
-		else
528
+		} else
502 529
 		{
503 530
 			// delete temp files
504 531
 			$this->deleteUserLayoutTempFile($layout_srl);
@@ -524,7 +551,9 @@  discard block
 block discarded – undo
524 551
 		$obj = Context::gets('type','align','column');
525 552
 		$obj = (array)$obj;
526 553
 		$src = $oLayoutModel->getUserLayoutIniConfig($layout_srl);
527
-		foreach($obj as $key => $val) $src[$key] = $val;
554
+		foreach($obj as $key => $val) {
555
+			$src[$key] = $val;
556
+		}
528 557
 		$this->insertUserLayoutValue($layout_srl,$src);
529 558
 	}
530 559
 
@@ -591,7 +620,9 @@  discard block
 block discarded – undo
591 620
 	function procLayoutAdminUserLayoutExport()
592 621
 	{
593 622
 		$layout_srl = Context::get('layout_srl');
594
-		if(!$layout_srl) return new BaseObject('-1','msg_invalid_request');
623
+		if(!$layout_srl) {
624
+			return new BaseObject('-1','msg_invalid_request');
625
+		}
595 626
 
596 627
 		require_once(_XE_PATH_.'libs/tar.class.php');
597 628
 		$oLayoutModel = getModel('layout');
@@ -608,16 +639,19 @@  discard block
 block discarded – undo
608 639
 
609 640
 		foreach($file_list as $file)
610 641
 		{
611
-			if(strncasecmp('images', $file, 6) === 0) continue;
642
+			if(strncasecmp('images', $file, 6) === 0) {
643
+				continue;
644
+			}
612 645
 
613 646
 			// replace path
614 647
 			$file = $target_path . $file;
615 648
 			$content = FileHandler::readFile($file);
616 649
 			$pattern = '/(http:\/\/[^ ]+)?(\.\/)?' . str_replace('/', '\/', (str_replace('./', '', $file_path))) . '/';
617
-			if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css')
618
-				$content = preg_replace($pattern, '../', $content);
619
-			else
620
-				$content = preg_replace($pattern, './', $content);
650
+			if(basename($file) == 'faceoff.css' || basename($file) == 'layout.css') {
651
+							$content = preg_replace($pattern, '../', $content);
652
+			} else {
653
+							$content = preg_replace($pattern, './', $content);
654
+			}
621 655
 
622 656
 			// replace ini config
623 657
 			foreach($ini_config as $key => $value)
@@ -658,7 +692,9 @@  discard block
 block discarded – undo
658 692
 		$tar = new tar();
659 693
 		$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath(0));
660 694
 		chdir($user_layout_path);
661
-		foreach($file_list as $key => $file) $tar->addFile($file);
695
+		foreach($file_list as $key => $file) {
696
+			$tar->addFile($file);
697
+		}
662 698
 
663 699
 		$stream = $tar->toTarStream();
664 700
 		$filename = 'faceoff_' . date('YmdHis') . '.tar';
@@ -689,18 +725,28 @@  discard block
 block discarded – undo
689 725
 		return $this->stop('not supported');
690 726
 
691 727
 		// check upload
692
-		if(!Context::isUploaded()) exit();
728
+		if(!Context::isUploaded()) {
729
+			exit();
730
+		}
693 731
 		$file = Context::get('file');
694
-		if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) exit();
732
+		if(!is_uploaded_file($file['tmp_name']) || !checkUploadedFile($file['tmp_name'])) {
733
+			exit();
734
+		}
695 735
 
696
-		if(substr_compare($file['name'], '.tar', -4) !== 0) exit();
736
+		if(substr_compare($file['name'], '.tar', -4) !== 0) {
737
+			exit();
738
+		}
697 739
 
698 740
 		$layout_srl = Context::get('layout_srl');
699
-		if(!$layout_srl) exit();
741
+		if(!$layout_srl) {
742
+			exit();
743
+		}
700 744
 
701 745
 		$oLayoutModel = getModel('layout');
702 746
 		$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
703
-		if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) exit();
747
+		if(!move_uploaded_file($file['tmp_name'], $user_layout_path . 'faceoff.tar')) {
748
+			exit();
749
+		}
704 750
 
705 751
 		$this->importLayout($layout_srl, $user_layout_path.'faceoff.tar');
706 752
 
@@ -744,9 +790,11 @@  discard block
 block discarded – undo
744 790
 		
745 791
 		if($layout->extra_var_count) {
746 792
 			$reg = "/^.\/files\/attach\/images\/([0-9]+)\/(.*)/";
747
-			if($extra_vars) foreach($extra_vars as $key => $val) {
793
+			if($extra_vars) {
794
+				foreach($extra_vars as $key => $val) {
748 795
 				if($layout->extra_var->{$key}->type == 'image') {
749 796
 					if(!preg_match($reg,$val,$matches)) continue;
797
+			}
750 798
 					$image_list[$key]->filename = $matches[2];
751 799
 					$image_list[$key]->old_file = $val;
752 800
 				}
@@ -761,7 +809,9 @@  discard block
 block discarded – undo
761 809
 		$args->site_srl = (int)$layout->site_srl;
762 810
 		$args->layout = $layout->layout;
763 811
 		$args->layout_type = $layout->layout_type;
764
-		if(!$args->layout_type) $args->layout_type = "P";
812
+		if(!$args->layout_type) {
813
+			$args->layout_type = "P";
814
+		}
765 815
 
766 816
 		$oDB = &DB::getInstance();
767 817
 		$oDB->begin();
@@ -904,7 +954,9 @@  discard block
 block discarded – undo
904 954
 		$tar = new tar();
905 955
 		$tar->openTAR($source_file);
906 956
 		// If layout.ini file does not exist
907
-		if(!$tar->getFile('layout.ini')) return;
957
+		if(!$tar->getFile('layout.ini')) {
958
+			return;
959
+		}
908 960
 
909 961
 		$replace_path = getNumberingPath($layout_srl,3);
910 962
 		foreach($tar->files as $key => $info)
Please login to merge, or discard this patch.
modules/layout/layout.admin.view.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 	/**
134 134
 	 * Display list of pc layout instance
135
-	 * @return void|BaseObject (void : success, BaseObject : fail)
135
+	 * @return ModuleObject|null (void : success, BaseObject : fail)
136 136
 	 */
137 137
 	function dispLayoutAdminInstanceList()
138 138
 	{
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	/**
162 162
 	 * Layout setting page
163 163
 	 * Once select a layout with empty value in the DB, then adjust values
164
-	 * @return void|BaseObject (void : success, BaseObject : fail)
164
+	 * @return ModuleObject|null (void : success, BaseObject : fail)
165 165
 	 */
166 166
 	function dispLayoutAdminInsert()
167 167
 	{
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 		// Set a layout list
29 29
 		$oLayoutModel = getModel('layout');
30 30
 		$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
31
-		if(!is_array($layout_list))
31
+		if (!is_array($layout_list))
32 32
 		{
33 33
 			$layout_list = array();
34 34
 		}
35 35
 
36
-		if($type == 'P')
36
+		if ($type == 'P')
37 37
 		{
38 38
 			// get Theme layout
39 39
 			$oAdminModel = getAdminModel('admin');
40 40
 			$themeList = $oAdminModel->getThemeList();
41 41
 			$themeLayoutList = array();
42
-			foreach($themeList as $themeInfo)
42
+			foreach ($themeList as $themeInfo)
43 43
 			{
44
-				if(strpos($themeInfo->layout_info->name, '.') === false) continue;
44
+				if (strpos($themeInfo->layout_info->name, '.') === false) continue;
45 45
 				$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
46 46
 			}
47 47
 			$layout_list = array_merge($layout_list, $themeLayoutList);
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 		//Security
61 61
 		$security = new Security();
62
-		$security->encodeHTML('layout_list..layout','layout_list..title');
62
+		$security->encodeHTML('layout_list..layout', 'layout_list..title');
63 63
 
64
-		foreach($layout_list as $no => $layout_info)
64
+		foreach ($layout_list as $no => $layout_info)
65 65
 		{
66 66
 			$layout_list[$no]->description = nl2br(trim($layout_info->description));
67 67
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		$type = Context::get('type');
78 78
 
79
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
79
+		if (!in_array($type, array('P', 'M'))) $type = 'P';
80 80
 
81 81
 		$oLayoutModel = getModel('layout');
82 82
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 		$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
90 90
 
91 91
 		$layout_list = array();
92
-		foreach($_layout_list as $item)
92
+		foreach ($_layout_list as $item)
93 93
 		{
94
-			if(!$layout_list[$item->layout])
94
+			if (!$layout_list[$item->layout])
95 95
 			{
96 96
 				$layout_list[$item->layout] = array();
97 97
 				$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$aTitle = strtolower($a['title']);
123 123
 		$bTitle = strtolower($b['title']);
124 124
 
125
-		if($aTitle == $bTitle)
125
+		if ($aTitle == $bTitle)
126 126
 		{
127 127
 			return 0;
128 128
 		}
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 		$type = Context::get('type');
140 140
 		$layout = Context::get('layout');
141 141
 
142
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
143
-		if(!$layout) return $this->stop('msg_invalid_request');
142
+		if (!in_array($type, array('P', 'M'))) $type = 'P';
143
+		if (!$layout) return $this->stop('msg_invalid_request');
144 144
 
145 145
 		$oLayoutModel = getModel('layout');
146 146
 		$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
147
-		if(!$layout_info) return $this->stop('msg_invalid_request');
147
+		if (!$layout_info) return $this->stop('msg_invalid_request');
148 148
 
149 149
 		Context::set('layout_info', $layout_info);
150 150
 
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 	{
168 168
 		$oModel = getModel('layout');
169 169
 		$type = Context::get('type');
170
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
170
+		if (!in_array($type, array('P', 'M'))) $type = 'P';
171 171
 
172 172
 		//Security
173 173
 		$security = new Security();
174
-		$security->encodeHTML('layout_list..layout','layout_list..title');
174
+		$security->encodeHTML('layout_list..layout', 'layout_list..title');
175 175
 
176 176
 		// Get layout info
177 177
 		$layout = Context::get('layout');
178
-		if($layout == 'faceoff') return $this->stop('not supported');
178
+		if ($layout == 'faceoff') return $this->stop('not supported');
179 179
 
180 180
 		$layout_info = $oModel->getLayoutInfo($layout, null, $type);
181
-		if(!$layout_info) return $this->stop('msg_invalid_request');
181
+		if (!$layout_info) return $this->stop('msg_invalid_request');
182 182
 
183 183
 		// get Menu list
184 184
 		$oMenuAdminModel = getAdminModel('menu');
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 		$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
193 193
 
194 194
 		$layout_info->description = nl2br(trim($layout_info->description));
195
-		if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
196
-		foreach($layout_info->extra_var as $var_name => $val)
195
+		if (!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
196
+		foreach ($layout_info->extra_var as $var_name => $val)
197 197
 		{
198
-			if(isset($layout_info->{$var_name}->description))
198
+			if (isset($layout_info->{$var_name}->description))
199 199
 				$layout_info->{$var_name}->description = nl2br(trim($val->description));
200 200
 		}
201 201
 		Context::set('selected_layout', $layout_info);
@@ -234,24 +234,24 @@  discard block
 block discarded – undo
234 234
 		$oLayoutModel = getModel('layout');
235 235
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
236 236
 		// Error appears if there is no layout information is registered
237
-		if(!$layout_info) return $this->dispLayoutAdminInstalledList();
237
+		if (!$layout_info) return $this->dispLayoutAdminInstalledList();
238 238
 
239 239
 		// Get Layout Code
240
-		if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
240
+		if ($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
241 241
 		{
242
-			$layout_file  = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243
-			$layout_css_file  = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
242
+			$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243
+			$layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
244 244
 		}
245 245
 		else
246 246
 		{
247 247
 			$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
248 248
 			$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
249 249
 
250
-			if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html';
251
-			if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css';
250
+			if (!file_exists($layout_file)) $layout_file = $layout_info->path.'layout.html';
251
+			if (!file_exists($layout_css_file)) $layout_css_file = $layout_info->path.'layout.css';
252 252
 		}
253 253
 
254
-		if(file_exists($layout_css_file))
254
+		if (file_exists($layout_css_file))
255 255
 		{
256 256
 			$layout_code_css = FileHandler::readFile($layout_css_file);
257 257
 			Context::set('layout_code_css', $layout_code_css);
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
 		$layout_srl = Context::get('layout_srl');
296 296
 		$code = Context::get('code');
297 297
 		$code_css = Context::get('code_css');
298
-		if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
298
+		if (!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
299 299
 		// Get the layout information
300 300
 		$oLayoutModel = getModel('layout');
301 301
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
302
-		if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
302
+		if (!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
303 303
 		// Separately handle the layout if its type is faceoff
304
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
304
+		if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
305 305
 		// Apply CSS directly
306 306
 		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
307 307
 		// Set names and values of extra_vars to $layout_info
308
-		if($layout_info->extra_var_count)
308
+		if ($layout_info->extra_var_count)
309 309
 		{
310
-			foreach($layout_info->extra_var as $var_id => $val)
310
+			foreach ($layout_info->extra_var as $var_id => $val)
311 311
 			{
312 312
 				$layout_info->{$var_id} = $val->value;
313 313
 			}
314 314
 		}
315 315
 		// menu in layout information becomes an argument for Context:: set
316
-		if($layout_info->menu_count)
316
+		if ($layout_info->menu_count)
317 317
 		{
318
-			foreach($layout_info->menu as $menu_id => $menu)
318
+			foreach ($layout_info->menu as $menu_id => $menu)
319 319
 			{
320 320
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
321
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
321
+				if (FileHandler::exists($menu->php_file)) include($menu->php_file);
322 322
 				Context::set($menu_id, $menu);
323 323
 			}
324 324
 		}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		$layout_file = 'layout';
337 337
 
338 338
 		$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
339
-		Context::set('layout','none');
339
+		Context::set('layout', 'none');
340 340
 		// Convert widgets and others
341 341
 		$oContext = &Context::getInstance();
342 342
 		Context::set('layout_tpl', $layout_tpl);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		// Remove the remaining tmp files because of temporarily saving
360 360
 		// This part needs to be modified
361 361
 		$delete_tmp = Context::get('delete_tmp');
362
-		if($delete_tmp =='Y')
362
+		if ($delete_tmp == 'Y')
363 363
 		{
364 364
 			$oLayoutAdminController = getAdminController('layout');
365 365
 			$oLayoutAdminController->deleteUserLayoutTempFile($layout_srl);
@@ -373,24 +373,24 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$css = FileHandler::readFile($faceoffcss);
375 375
 		$match = null;
376
-		preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match);
377
-		for($i=0,$c=count($match[1]);$i<$c;$i++)
376
+		preg_match_all('/([^\{]+)\{([^\}]*)\}/is', $css, $match);
377
+		for ($i = 0, $c = count($match[1]); $i < $c; $i++)
378 378
 		{
379 379
 			$name = trim($match[1][$i]);
380 380
 			$css = trim($match[2][$i]);
381
-			if(!$css) continue;
382
-			$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
383
-			$style[] .= sprintf('"%s":"%s"',$name,$css);
381
+			if (!$css) continue;
382
+			$css = str_replace('./images/', Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl), $css);
383
+			$style[] .= sprintf('"%s":"%s"', $name, $css);
384 384
 		}
385 385
 
386
-		if(count($style))
386
+		if (count($style))
387 387
 		{
388
-			$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
388
+			$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',', $style).'}; </script>';
389 389
 			Context::addHtmlHeader($script);
390 390
 		}
391 391
 
392 392
 		$oTemplate = &TemplateHandler::getInstance();
393
-		Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
393
+		Context::set('content', $oTemplate->compile($this->module_path.'tpl', 'about_faceoff'));
394 394
 		// Change widget codes in Javascript mode
395 395
 		$oWidgetController = getController('widget');
396 396
 		$oWidgetController->setWidgetCodeInJavascriptMode();
Please login to merge, or discard this patch.
Braces   +55 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 			$themeLayoutList = array();
42 42
 			foreach($themeList as $themeInfo)
43 43
 			{
44
-				if(strpos($themeInfo->layout_info->name, '.') === false) continue;
44
+				if(strpos($themeInfo->layout_info->name, '.') === false) {
45
+					continue;
46
+				}
45 47
 				$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
46 48
 			}
47 49
 			$layout_list = array_merge($layout_list, $themeLayoutList);
@@ -76,7 +78,9 @@  discard block
 block discarded – undo
76 78
 	{
77 79
 		$type = Context::get('type');
78 80
 
79
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
81
+		if(!in_array($type, array('P', 'M'))) {
82
+			$type = 'P';
83
+		}
80 84
 
81 85
 		$oLayoutModel = getModel('layout');
82 86
 
@@ -139,12 +143,18 @@  discard block
 block discarded – undo
139 143
 		$type = Context::get('type');
140 144
 		$layout = Context::get('layout');
141 145
 
142
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
143
-		if(!$layout) return $this->stop('msg_invalid_request');
146
+		if(!in_array($type, array('P', 'M'))) {
147
+			$type = 'P';
148
+		}
149
+		if(!$layout) {
150
+			return $this->stop('msg_invalid_request');
151
+		}
144 152
 
145 153
 		$oLayoutModel = getModel('layout');
146 154
 		$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
147
-		if(!$layout_info) return $this->stop('msg_invalid_request');
155
+		if(!$layout_info) {
156
+			return $this->stop('msg_invalid_request');
157
+		}
148 158
 
149 159
 		Context::set('layout_info', $layout_info);
150 160
 
@@ -167,7 +177,9 @@  discard block
 block discarded – undo
167 177
 	{
168 178
 		$oModel = getModel('layout');
169 179
 		$type = Context::get('type');
170
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
180
+		if(!in_array($type, array('P', 'M'))) {
181
+			$type = 'P';
182
+		}
171 183
 
172 184
 		//Security
173 185
 		$security = new Security();
@@ -175,10 +187,14 @@  discard block
 block discarded – undo
175 187
 
176 188
 		// Get layout info
177 189
 		$layout = Context::get('layout');
178
-		if($layout == 'faceoff') return $this->stop('not supported');
190
+		if($layout == 'faceoff') {
191
+			return $this->stop('not supported');
192
+		}
179 193
 
180 194
 		$layout_info = $oModel->getLayoutInfo($layout, null, $type);
181
-		if(!$layout_info) return $this->stop('msg_invalid_request');
195
+		if(!$layout_info) {
196
+			return $this->stop('msg_invalid_request');
197
+		}
182 198
 
183 199
 		// get Menu list
184 200
 		$oMenuAdminModel = getAdminModel('menu');
@@ -192,11 +208,14 @@  discard block
 block discarded – undo
192 208
 		$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
193 209
 
194 210
 		$layout_info->description = nl2br(trim($layout_info->description));
195
-		if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
211
+		if(!is_object($layout_info->extra_var)) {
212
+			$layout_info->extra_var = new StdClass();
213
+		}
196 214
 		foreach($layout_info->extra_var as $var_name => $val)
197 215
 		{
198
-			if(isset($layout_info->{$var_name}->description))
199
-				$layout_info->{$var_name}->description = nl2br(trim($val->description));
216
+			if(isset($layout_info->{$var_name}->description)) {
217
+							$layout_info->{$var_name}->description = nl2br(trim($val->description));
218
+			}
200 219
 		}
201 220
 		Context::set('selected_layout', $layout_info);
202 221
 
@@ -234,21 +253,26 @@  discard block
 block discarded – undo
234 253
 		$oLayoutModel = getModel('layout');
235 254
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
236 255
 		// Error appears if there is no layout information is registered
237
-		if(!$layout_info) return $this->dispLayoutAdminInstalledList();
256
+		if(!$layout_info) {
257
+			return $this->dispLayoutAdminInstalledList();
258
+		}
238 259
 
239 260
 		// Get Layout Code
240 261
 		if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
241 262
 		{
242 263
 			$layout_file  = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243 264
 			$layout_css_file  = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
244
-		}
245
-		else
265
+		} else
246 266
 		{
247 267
 			$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
248 268
 			$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
249 269
 
250
-			if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html';
251
-			if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css';
270
+			if(!file_exists($layout_file)) {
271
+				$layout_file = $layout_info->path . 'layout.html';
272
+			}
273
+			if(!file_exists($layout_css_file)) {
274
+				$layout_css_file = $layout_info->path . 'layout.css';
275
+			}
252 276
 		}
253 277
 
254 278
 		if(file_exists($layout_css_file))
@@ -295,13 +319,19 @@  discard block
 block discarded – undo
295 319
 		$layout_srl = Context::get('layout_srl');
296 320
 		$code = Context::get('code');
297 321
 		$code_css = Context::get('code_css');
298
-		if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
322
+		if(!$layout_srl || !$code) {
323
+			return new BaseObject(-1, 'msg_invalid_request');
324
+		}
299 325
 		// Get the layout information
300 326
 		$oLayoutModel = getModel('layout');
301 327
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
302
-		if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
328
+		if(!$layout_info) {
329
+			return new BaseObject(-1, 'msg_invalid_request');
330
+		}
303 331
 		// Separately handle the layout if its type is faceoff
304
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
332
+		if($layout_info && $layout_info->type == 'faceoff') {
333
+			$oLayoutModel->doActivateFaceOff($layout_info);
334
+		}
305 335
 		// Apply CSS directly
306 336
 		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
307 337
 		// Set names and values of extra_vars to $layout_info
@@ -318,7 +348,9 @@  discard block
 block discarded – undo
318 348
 			foreach($layout_info->menu as $menu_id => $menu)
319 349
 			{
320 350
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
321
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
351
+				if(FileHandler::exists($menu->php_file)) {
352
+					include($menu->php_file);
353
+				}
322 354
 				Context::set($menu_id, $menu);
323 355
 			}
324 356
 		}
@@ -378,7 +410,9 @@  discard block
 block discarded – undo
378 410
 		{
379 411
 			$name = trim($match[1][$i]);
380 412
 			$css = trim($match[2][$i]);
381
-			if(!$css) continue;
413
+			if(!$css) {
414
+				continue;
415
+			}
382 416
 			$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
383 417
 			$style[] .= sprintf('"%s":"%s"',$name,$css);
384 418
 		}
Please login to merge, or discard this patch.
modules/member/member.view.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -637,7 +637,7 @@
 block discarded – undo
637 637
 	/**
638 638
 	 * Spammer manage popup
639 639
 	 * 
640
-	 * @return void
640
+	 * @return BaseObject|null
641 641
 	**/
642 642
 	function dispMemberSpammer()
643 643
 	{
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -638,7 +638,7 @@
 block discarded – undo
638 638
 	 * Spammer manage popup
639 639
 	 * 
640 640
 	 * @return void
641
-	**/
641
+	 **/
642 642
 	function dispMemberSpammer()
643 643
 	{
644 644
 		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
Please login to merge, or discard this patch.
Braces   +77 added lines, -58 removed lines patch added patch discarded remove patch
@@ -29,16 +29,14 @@  discard block
 block discarded – undo
29 29
 		{
30 30
 			$skin = 'default';
31 31
 			$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
32
-		}
33
-		else
32
+		} else
34 33
 		{
35 34
 			//check theme
36 35
 			$config_parse = explode('|@|', $skin);
37 36
 			if (count($config_parse) > 1)
38 37
 			{
39 38
 				$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
40
-			}
41
-			else
39
+			} else
42 40
 			{
43 41
 				$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
44 42
 			}
@@ -63,14 +61,15 @@  discard block
 block discarded – undo
63 61
 		$oMemberModel = getModel('member');
64 62
 		$logged_info = Context::get('logged_info');
65 63
 		// Don't display member info to non-logged user
66
-		if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
64
+		if(!$logged_info->member_srl) {
65
+			return $this->stop('msg_not_permitted');
66
+		}
67 67
 
68 68
 		$member_srl = Context::get('member_srl');
69 69
 		if(!$member_srl && Context::get('is_logged'))
70 70
 		{
71 71
 			$member_srl = $logged_info->member_srl;
72
-		}
73
-		elseif(!$member_srl)
72
+		} elseif(!$member_srl)
74 73
 		{
75 74
 			return $this->dispMemberSignUpForm();
76 75
 		}
@@ -89,7 +88,9 @@  discard block
 block discarded – undo
89 88
 			$member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start);
90 89
 		}
91 90
 
92
-		if(!$member_info->member_srl) return $this->dispMemberSignUpForm();
91
+		if(!$member_info->member_srl) {
92
+			return $this->dispMemberSignUpForm();
93
+		}
93 94
 
94 95
 		Context::set('memberInfo', get_object_vars($member_info));
95 96
 
@@ -135,43 +136,35 @@  discard block
 block discarded – undo
135 136
 				{
136 137
 					$target = $memberInfo->profile_image;
137 138
 					$item->value = '<img src="'.$target->src.'" />';
138
-				}
139
-				elseif($formInfo->name == 'image_name' && $memberInfo->image_name)
139
+				} elseif($formInfo->name == 'image_name' && $memberInfo->image_name)
140 140
 				{
141 141
 					$target = $memberInfo->image_name;
142 142
 					$item->value = '<img src="'.$target->src.'" />';
143
-				}
144
-				elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark)
143
+				} elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark)
145 144
 				{
146 145
 					$target = $memberInfo->image_mark;
147 146
 					$item->value = '<img src="'.$target->src.'" />';
148
-				}
149
-				elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
147
+				} elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
150 148
 				{
151 149
 					$item->value = zdate($item->value, 'Y-m-d');
152 150
 				}
153
-			}
154
-			else
151
+			} else
155 152
 			{
156 153
 				$item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title;
157 154
 				$orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value;
158 155
 				if($formInfo->type=='tel' && is_array($orgValue))
159 156
 				{
160 157
 					$item->value = implode('-', $orgValue);
161
-				}
162
-				elseif($formInfo->type=='kr_zip' && is_array($orgValue))
158
+				} elseif($formInfo->type=='kr_zip' && is_array($orgValue))
163 159
 				{
164 160
 					$item->value = implode(' ', $orgValue);
165
-				}
166
-				elseif($formInfo->type=='checkbox' && is_array($orgValue))
161
+				} elseif($formInfo->type=='checkbox' && is_array($orgValue))
167 162
 				{
168 163
 					$item->value = implode(", ",$orgValue);
169
-				}
170
-				elseif($formInfo->type=='date')
164
+				} elseif($formInfo->type=='date')
171 165
 				{
172 166
 					$item->value = zdate($orgValue, "Y-m-d");
173
-				}
174
-				else
167
+				} else
175 168
 				{
176 169
 					$item->value = nl2br($orgValue);
177 170
 				}
@@ -198,12 +191,18 @@  discard block
 block discarded – undo
198 191
 
199 192
 		$oMemberModel = getModel('member');
200 193
 		// Get the member information if logged-in
201
-		if($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
194
+		if($oMemberModel->isLogged()) {
195
+			return $this->stop('msg_already_logged');
196
+		}
202 197
 		// call a trigger (before) 
203 198
 		$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
204
-		if(!$trigger_output->toBool()) return $trigger_output;
199
+		if(!$trigger_output->toBool()) {
200
+			return $trigger_output;
201
+		}
205 202
 		// Error appears if the member is not allowed to join
206
-		if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
203
+		if($member_config->enable_join != 'Y') {
204
+			return $this->stop('msg_signup_disabled');
205
+		}
207 206
 
208 207
 		$oMemberAdminView = getAdminView('member');
209 208
 		$formTags = $oMemberAdminView->_getMemberInputTag($member_info);
@@ -244,8 +243,7 @@  discard block
 block discarded – undo
244 243
 		{
245 244
 			Context::set('identifierTitle', Context::getLang('email_address'));
246 245
 			Context::set('identifierValue', $logged_info->email_address); 
247
-		}
248
-		else
246
+		} else
249 247
 		{
250 248
 			Context::set('identifierTitle', Context::getLang('user_id'));
251 249
 			Context::set('identifierValue', $logged_info->user_id);
@@ -271,7 +269,9 @@  discard block
 block discarded – undo
271 269
 
272 270
 		$oMemberModel = getModel('member');
273 271
 		// A message appears if the user is not logged-in
274
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
272
+		if(!$oMemberModel->isLogged()) {
273
+			return $this->stop('msg_not_logged');
274
+		}
275 275
 
276 276
 		$logged_info = Context::get('logged_info');
277 277
 		$member_srl = $logged_info->member_srl;
@@ -330,7 +330,9 @@  discard block
 block discarded – undo
330 330
 	{
331 331
 		$oMemberModel = getModel('member');
332 332
 		// A message appears if the user is not logged-in
333
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
333
+		if(!$oMemberModel->isLogged()) {
334
+			return $this->stop('msg_not_logged');
335
+		}
334 336
 
335 337
 		$logged_info = Context::get('logged_info');
336 338
 		$member_srl = $logged_info->member_srl;
@@ -357,7 +359,9 @@  discard block
 block discarded – undo
357 359
 	{
358 360
 		$oMemberModel = getModel('member');
359 361
 		// A message appears if the user is not logged-in
360
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
362
+		if(!$oMemberModel->isLogged()) {
363
+			return $this->stop('msg_not_logged');
364
+		}
361 365
 
362 366
 		$logged_info = Context::get('logged_info');
363 367
 		$args = new stdClass();
@@ -384,7 +388,9 @@  discard block
 block discarded – undo
384 388
 	{
385 389
 		$oMemberModel = getModel('member');
386 390
 		// A message appears if the user is not logged-in
387
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
391
+		if(!$oMemberModel->isLogged()) {
392
+			return $this->stop('msg_not_logged');
393
+		}
388 394
 		// Get the saved document(module_srl is set to member_srl instead)
389 395
 		$logged_info = Context::get('logged_info');
390 396
 		$args = new stdClass();
@@ -423,13 +429,15 @@  discard block
 block discarded – undo
423 429
 
424 430
 		$XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE');
425 431
 		$XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR');
426
-		if($XE_VALIDATOR_ERROR == -11)
427
-			Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description);
432
+		if($XE_VALIDATOR_ERROR == -11) {
433
+					Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description);
434
+		}
428 435
 
429
-		if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21)
430
-			Context::set('referer_url', getUrl('')); 
431
-		else
432
-			Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
436
+		if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) {
437
+					Context::set('referer_url', getUrl(''));
438
+		} else {
439
+					Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
440
+		}
433 441
 
434 442
 		// Set a template file
435 443
 		$this->setTemplateFile('login_form');
@@ -442,7 +450,9 @@  discard block
 block discarded – undo
442 450
 	{
443 451
 		$oMemberModel = getModel('member');
444 452
 		// A message appears if the user is not logged-in
445
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
453
+		if(!$oMemberModel->isLogged()) {
454
+			return $this->stop('msg_not_logged');
455
+		}
446 456
 
447 457
 		$memberConfig = $this->member_config;
448 458
 
@@ -457,8 +467,7 @@  discard block
 block discarded – undo
457 467
 		{
458 468
 			Context::set('identifier', 'user_id');
459 469
 			Context::set('formValue', $member_info->user_id);
460
-		}
461
-		else
470
+		} else
462 471
 		{
463 472
 			Context::set('identifier', 'email_address');
464 473
 			Context::set('formValue', $member_info->email_address);
@@ -474,7 +483,9 @@  discard block
 block discarded – undo
474 483
 	{
475 484
 		$oMemberModel = getModel('member');
476 485
 		// A message appears if the user is not logged-in
477
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
486
+		if(!$oMemberModel->isLogged()) {
487
+			return $this->stop('msg_not_logged');
488
+		}
478 489
 
479 490
 		$memberConfig = $this->member_config;
480 491
 
@@ -488,8 +499,7 @@  discard block
 block discarded – undo
488 499
 		{
489 500
 			Context::set('identifier', 'user_id');
490 501
 			Context::set('formValue', $member_info->user_id);
491
-		}
492
-		else
502
+		} else
493 503
 		{
494 504
 			Context::set('identifier', 'email_address');
495 505
 			Context::set('formValue', $member_info->email_address);
@@ -505,10 +515,11 @@  discard block
 block discarded – undo
505 515
 	{
506 516
 		$oMemberController = getController('member');
507 517
 		$output = $oMemberController->procMemberLogout();
508
-		if(!$output->redirect_url)
509
-			$this->setRedirectUrl(getNotEncodedUrl('act', ''));
510
-		else
511
-			$this->setRedirectUrl($output->redirect_url);
518
+		if(!$output->redirect_url) {
519
+					$this->setRedirectUrl(getNotEncodedUrl('act', ''));
520
+		} else {
521
+					$this->setRedirectUrl($output->redirect_url);
522
+		}
512 523
 
513 524
 		return;
514 525
 	}
@@ -527,7 +538,9 @@  discard block
 block discarded – undo
527 538
 	 */
528 539
 	function dispMemberFindAccount()
529 540
 	{
530
-		if(Context::get('is_logged')) return $this->stop('already_logged');
541
+		if(Context::get('is_logged')) {
542
+			return $this->stop('already_logged');
543
+		}
531 544
 
532 545
 		$config = $this->member_config;
533 546
 
@@ -541,13 +554,17 @@  discard block
 block discarded – undo
541 554
 	 */
542 555
 	function dispMemberGetTempPassword()
543 556
 	{
544
-		if(Context::get('is_logged')) return $this->stop('already_logged');
557
+		if(Context::get('is_logged')) {
558
+			return $this->stop('already_logged');
559
+		}
545 560
 
546 561
 		$user_id = Context::get('user_id');
547 562
 		$temp_password = $_SESSION['xe_temp_password_'.$user_id];
548 563
 		unset($_SESSION['xe_temp_password_'.$user_id]);
549 564
 
550
-		if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request');
565
+		if(!$user_id||!$temp_password) {
566
+			return new BaseObject(-1,'msg_invaild_request');
567
+		}
551 568
 
552 569
 		Context::set('temp_password', $temp_password);
553 570
 
@@ -575,8 +592,7 @@  discard block
 block discarded – undo
575 592
 			$_SESSION['auth_member_info'] = $memberInfo;
576 593
 			Context::set('memberInfo', $memberInfo);
577 594
 			$this->setTemplateFile('reset_mail');
578
-		}
579
-		else
595
+		} else
580 596
 		{
581 597
 			$this->setTemplateFile('resend_auth_mail');
582 598
 		}
@@ -618,8 +634,7 @@  discard block
 block discarded – undo
618 634
 			if($val->column_type == 'kr_zip' || $val->column_type == 'tel')
619 635
 			{
620 636
 				$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title);
621
-			}
622
-			else
637
+			} else
623 638
 			{
624 639
 				$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s","%s"]);', $val->column_name, $title);
625 640
 			}
@@ -641,7 +656,9 @@  discard block
 block discarded – undo
641 656
 	**/
642 657
 	function dispMemberSpammer()
643 658
 	{
644
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
659
+		if(!Context::get('is_logged')) {
660
+			return new BaseObject(-1,'msg_not_permitted');
661
+		}
645 662
 
646 663
 		$member_srl = Context::get('member_srl');
647 664
 		$module_srl = Context::get('module_srl');
@@ -652,7 +669,9 @@  discard block
 block discarded – undo
652 669
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
653 670
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
654 671
 
655
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
672
+		if(!$grant->manager) {
673
+			return new BaseObject(-1,'msg_not_permitted');
674
+		}
656 675
 
657 676
 		$oMemberModel = getModel('member');
658 677
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$skin = $this->member_config->skin;
27 27
 		// Set the template path
28
-		if(!$skin)
28
+		if (!$skin)
29 29
 		{
30 30
 			$skin = 'default';
31 31
 			$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 		$oLayoutModel = getModel('layout');
50 50
 		$layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl);
51
-		if($layout_info)
51
+		if ($layout_info)
52 52
 		{
53 53
 			$this->module_info->layout_srl = $this->member_config->layout_srl;
54 54
 			$this->setLayoutPath($layout_info->path);
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 		$oMemberModel = getModel('member');
64 64
 		$logged_info = Context::get('logged_info');
65 65
 		// Don't display member info to non-logged user
66
-		if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
66
+		if (!$logged_info->member_srl) return $this->stop('msg_not_permitted');
67 67
 
68 68
 		$member_srl = Context::get('member_srl');
69
-		if(!$member_srl && Context::get('is_logged'))
69
+		if (!$member_srl && Context::get('is_logged'))
70 70
 		{
71 71
 			$member_srl = $logged_info->member_srl;
72 72
 		}
73
-		elseif(!$member_srl)
73
+		elseif (!$member_srl)
74 74
 		{
75 75
 			return $this->dispMemberSignUpForm();
76 76
 		}
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 		unset($member_info->email_id);
83 83
 		unset($member_info->email_host);
84 84
 
85
-		if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl))
85
+		if ($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl))
86 86
 		{
87
-			$start = strpos($member_info->email_address, '@')+1;
87
+			$start = strpos($member_info->email_address, '@') + 1;
88 88
 			$replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start));
89 89
 			$member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start);
90 90
 		}
91 91
 
92
-		if(!$member_info->member_srl) return $this->dispMemberSignUpForm();
92
+		if (!$member_info->member_srl) return $this->dispMemberSignUpForm();
93 93
 
94 94
 		Context::set('memberInfo', get_object_vars($member_info));
95 95
 
@@ -107,46 +107,46 @@  discard block
 block discarded – undo
107 107
 	{
108 108
 		$logged_info = Context::get('logged_info');
109 109
 		$displayDatas = array();
110
-		foreach($memberConfig->signupForm as $no=>$formInfo)
110
+		foreach ($memberConfig->signupForm as $no=>$formInfo)
111 111
 		{
112
-			if(!$formInfo->isUse)
112
+			if (!$formInfo->isUse)
113 113
 			{
114 114
 				continue;
115 115
 			}
116 116
 
117
-			if($formInfo->name == 'password' || $formInfo->name == 'find_account_question')
117
+			if ($formInfo->name == 'password' || $formInfo->name == 'find_account_question')
118 118
 			{
119 119
 				continue;
120 120
 			}
121 121
 
122
-			if($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y')
122
+			if ($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y')
123 123
 			{
124 124
 				continue;
125 125
 			}
126 126
 
127 127
 			$item = $formInfo;
128 128
 
129
-			if($formInfo->isDefaultForm)
129
+			if ($formInfo->isDefaultForm)
130 130
 			{
131 131
 				$item->title = Context::getLang($formInfo->name);
132 132
 				$item->value = $memberInfo->{$formInfo->name};
133 133
 
134
-				if($formInfo->name == 'profile_image' && $memberInfo->profile_image)
134
+				if ($formInfo->name == 'profile_image' && $memberInfo->profile_image)
135 135
 				{
136 136
 					$target = $memberInfo->profile_image;
137 137
 					$item->value = '<img src="'.$target->src.'" />';
138 138
 				}
139
-				elseif($formInfo->name == 'image_name' && $memberInfo->image_name)
139
+				elseif ($formInfo->name == 'image_name' && $memberInfo->image_name)
140 140
 				{
141 141
 					$target = $memberInfo->image_name;
142 142
 					$item->value = '<img src="'.$target->src.'" />';
143 143
 				}
144
-				elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark)
144
+				elseif ($formInfo->name == 'image_mark' && $memberInfo->image_mark)
145 145
 				{
146 146
 					$target = $memberInfo->image_mark;
147 147
 					$item->value = '<img src="'.$target->src.'" />';
148 148
 				}
149
-				elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
149
+				elseif ($formInfo->name == 'birthday' && $memberInfo->birthday)
150 150
 				{
151 151
 					$item->value = zdate($item->value, 'Y-m-d');
152 152
 				}
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 			{
156 156
 				$item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title;
157 157
 				$orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value;
158
-				if($formInfo->type=='tel' && is_array($orgValue))
158
+				if ($formInfo->type == 'tel' && is_array($orgValue))
159 159
 				{
160 160
 					$item->value = implode('-', $orgValue);
161 161
 				}
162
-				elseif($formInfo->type=='kr_zip' && is_array($orgValue))
162
+				elseif ($formInfo->type == 'kr_zip' && is_array($orgValue))
163 163
 				{
164 164
 					$item->value = implode(' ', $orgValue);
165 165
 				}
166
-				elseif($formInfo->type=='checkbox' && is_array($orgValue))
166
+				elseif ($formInfo->type == 'checkbox' && is_array($orgValue))
167 167
 				{
168
-					$item->value = implode(", ",$orgValue);
168
+					$item->value = implode(", ", $orgValue);
169 169
 				}
170
-				elseif($formInfo->type=='date')
170
+				elseif ($formInfo->type == 'date')
171 171
 				{
172 172
 					$item->value = zdate($orgValue, "Y-m-d");
173 173
 				}
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 
199 199
 		$oMemberModel = getModel('member');
200 200
 		// Get the member information if logged-in
201
-		if($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
201
+		if ($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
202 202
 		// call a trigger (before) 
203 203
 		$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
204
-		if(!$trigger_output->toBool()) return $trigger_output;
204
+		if (!$trigger_output->toBool()) return $trigger_output;
205 205
 		// Error appears if the member is not allowed to join
206
-		if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
206
+		if ($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
207 207
 
208 208
 		$oMemberAdminView = getAdminView('member');
209 209
 		$formTags = $oMemberAdminView->_getMemberInputTag($member_info);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	{
227 227
 		$logged_info = Context::get('logged_info');
228 228
 		$oMemberModel = getModel('member');
229
-		if(!$oMemberModel->isLogged() || empty($logged_info))
229
+		if (!$oMemberModel->isLogged() || empty($logged_info))
230 230
 		{
231 231
 			return $this->stop('msg_not_logged');
232 232
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		$_SESSION['rechecked_password_step'] = 'INPUT_PASSWORD';
235 235
 
236 236
 		$templateFile = $this->getTemplatePath().'rechecked_password.html';
237
-		if(!is_readable($templateFile))
237
+		if (!is_readable($templateFile))
238 238
 		{
239 239
 			$templatePath = sprintf('%sskins/default', $this->module_path);
240 240
 			$this->setTemplatePath($templatePath);
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	function dispMemberModifyInfo() 
261 261
 	{
262
-		if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
262
+		if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
263 263
 		{
264 264
 			$this->dispMemberModifyInfoBefore();
265 265
 			return;
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 		$oMemberModel = getModel('member');
273 273
 		// A message appears if the user is not logged-in
274
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
274
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
275 275
 
276 276
 		$logged_info = Context::get('logged_info');
277 277
 		$member_srl = $logged_info->member_srl;
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 		$columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address', 'find_account_answer', 'homepage', 'blog', 'birthday', 'allow_mailing');
280 280
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
281 281
 		$member_info->signature = $oMemberModel->getSignature($member_srl);
282
-		Context::set('member_info',$member_info);
282
+		Context::set('member_info', $member_info);
283 283
 
284 284
 		// Get a list of extend join form
285 285
 		Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
286 286
 
287 287
 		// Editor of the module set for signing by calling getEditor
288
-		if($member_info->member_srl)
288
+		if ($member_info->member_srl)
289 289
 		{
290 290
 			$oEditorModel = getModel('editor');
291 291
 			$option = new stdClass();
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
 	{
331 331
 		$oMemberModel = getModel('member');
332 332
 		// A message appears if the user is not logged-in
333
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
333
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
334 334
 
335 335
 		$logged_info = Context::get('logged_info');
336 336
 		$member_srl = $logged_info->member_srl;
337 337
 
338 338
 		$module_srl = Context::get('module_srl');
339
-		Context::set('module_srl',Context::get('selected_module_srl'));
340
-		Context::set('search_target','member_srls');
339
+		Context::set('module_srl', Context::get('selected_module_srl'));
340
+		Context::set('search_target', 'member_srls');
341 341
 		Context::set('search_keyword', implode(',', array($member_srl, $member_srl * -1)));
342 342
 
343 343
 
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 	{
359 359
 		$oMemberModel = getModel('member');
360 360
 		// A message appears if the user is not logged-in
361
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
361
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
362 362
 
363 363
 		$logged_info = Context::get('logged_info');
364 364
 		$args = new stdClass();
365 365
 		$args->member_srl = $logged_info->member_srl;
366
-		$args->page = (int)Context::get('page');
366
+		$args->page = (int) Context::get('page');
367 367
 
368 368
 		$output = executeQuery('member.getScrapDocumentList', $args);
369 369
 		Context::set('total_count', $output->total_count);
@@ -385,12 +385,12 @@  discard block
 block discarded – undo
385 385
 	{
386 386
 		$oMemberModel = getModel('member');
387 387
 		// A message appears if the user is not logged-in
388
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
388
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
389 389
 		// Get the saved document(module_srl is set to member_srl instead)
390 390
 		$logged_info = Context::get('logged_info');
391 391
 		$args = new stdClass();
392 392
 		$args->member_srl = $logged_info->member_srl;
393
-		$args->page = (int)Context::get('page');
393
+		$args->page = (int) Context::get('page');
394 394
 		$args->statusList = array('TEMP');
395 395
 
396 396
 		$oDocumentModel = getModel('document');
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	function dispMemberLoginForm()
411 411
 	{
412
-		if(Context::get('is_logged'))
412
+		if (Context::get('is_logged'))
413 413
 		{
414
-			Context::set('redirect_url', getNotEncodedUrl('act',''));
414
+			Context::set('redirect_url', getNotEncodedUrl('act', ''));
415 415
 			$this->setTemplatePath($this->module_path.'tpl');
416 416
 			$this->setTemplateFile('redirect.html');
417 417
 			return;
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
 
425 425
 		$XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE');
426 426
 		$XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR');
427
-		if($XE_VALIDATOR_ERROR == -11)
428
-			Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description);
427
+		if ($XE_VALIDATOR_ERROR == -11)
428
+			Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE.$config->limit_day_description);
429 429
 
430
-		if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21)
430
+		if ($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21)
431 431
 			Context::set('referer_url', getUrl('')); 
432 432
 		else
433 433
 			Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	{
444 444
 		$oMemberModel = getModel('member');
445 445
 		// A message appears if the user is not logged-in
446
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
446
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
447 447
 
448 448
 		$memberConfig = $this->member_config;
449 449
 
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
 
453 453
 		$columnList = array('member_srl', 'user_id');
454 454
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
455
-		Context::set('member_info',$member_info);
455
+		Context::set('member_info', $member_info);
456 456
 
457
-		if($memberConfig->identifier == 'user_id')
457
+		if ($memberConfig->identifier == 'user_id')
458 458
 		{
459 459
 			Context::set('identifier', 'user_id');
460 460
 			Context::set('formValue', $member_info->user_id);
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	{
476 476
 		$oMemberModel = getModel('member');
477 477
 		// A message appears if the user is not logged-in
478
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
478
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
479 479
 
480 480
 		$memberConfig = $this->member_config;
481 481
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 		$member_srl = $logged_info->member_srl;
484 484
 
485 485
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
486
-		Context::set('member_info',$member_info);
486
+		Context::set('member_info', $member_info);
487 487
 
488
-		if($memberConfig->identifier == 'user_id')
488
+		if ($memberConfig->identifier == 'user_id')
489 489
 		{
490 490
 			Context::set('identifier', 'user_id');
491 491
 			Context::set('formValue', $member_info->user_id);
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		$oMemberController = getController('member');
508 508
 		$output = $oMemberController->procMemberLogout();
509
-		if(!$output->redirect_url)
509
+		if (!$output->redirect_url)
510 510
 			$this->setRedirectUrl(getNotEncodedUrl('act', ''));
511 511
 		else
512 512
 			$this->setRedirectUrl($output->redirect_url);
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	 */
529 529
 	function dispMemberFindAccount()
530 530
 	{
531
-		if(Context::get('is_logged')) return $this->stop('already_logged');
531
+		if (Context::get('is_logged')) return $this->stop('already_logged');
532 532
 
533 533
 		$config = $this->member_config;
534 534
 
@@ -542,13 +542,13 @@  discard block
 block discarded – undo
542 542
 	 */
543 543
 	function dispMemberGetTempPassword()
544 544
 	{
545
-		if(Context::get('is_logged')) return $this->stop('already_logged');
545
+		if (Context::get('is_logged')) return $this->stop('already_logged');
546 546
 
547 547
 		$user_id = Context::get('user_id');
548 548
 		$temp_password = $_SESSION['xe_temp_password_'.$user_id];
549 549
 		unset($_SESSION['xe_temp_password_'.$user_id]);
550 550
 
551
-		if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request');
551
+		if (!$user_id || !$temp_password) return new BaseObject(-1, 'msg_invaild_request');
552 552
 
553 553
 		Context::set('temp_password', $temp_password);
554 554
 
@@ -563,12 +563,12 @@  discard block
 block discarded – undo
563 563
 		$authMemberSrl = $_SESSION['auth_member_srl'];
564 564
 		unset($_SESSION['auth_member_srl']);
565 565
 
566
-		if(Context::get('is_logged')) 
566
+		if (Context::get('is_logged')) 
567 567
 		{
568 568
 			return $this->stop('already_logged');
569 569
 		}
570 570
 
571
-		if($authMemberSrl)
571
+		if ($authMemberSrl)
572 572
 		{
573 573
 			$oMemberModel = getModel('member');
574 574
 			$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($authMemberSrl);
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
 	function dispMemberModifyEmailAddress()
587 587
 	{
588
-		if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
588
+		if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
589 589
 		{
590 590
 			Context::set('success_return_url', getUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyEmailAddress'));
591 591
 			$this->dispMemberModifyInfoBefore();
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
 		$js_code[] = 'if(!validator) return false;';
614 614
 
615 615
 		$errorLang = array();
616
-		foreach($extraList as $val) 
616
+		foreach ($extraList as $val) 
617 617
 		{
618 618
 			$title = str_ireplace(array('<script', '</script'), array('<scr"+"ipt', '</scr"+"ipt'), addslashes($val->column_title));
619
-			if($val->column_type == 'kr_zip' || $val->column_type == 'tel')
619
+			if ($val->column_type == 'kr_zip' || $val->column_type == 'tel')
620 620
 			{
621 621
 				$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title);
622 622
 			}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	**/
643 643
 	function dispMemberSpammer()
644 644
 	{
645
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
645
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
646 646
 
647 647
 		$member_srl = Context::get('member_srl');
648 648
 		$module_srl = Context::get('module_srl');
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
654 654
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
655 655
 
656
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
656
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
657 657
 
658 658
 		$oMemberModel = getModel('member');
659 659
 
Please login to merge, or discard this patch.
modules/menu/menu.admin.controller.php 3 patches
Doc Comments   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 	/**
63 63
 	 * Add a menu
64
-	 * @return void|object
64
+	 * @return BaseObject|null
65 65
 	 */
66 66
 	function procMenuAdminInsert()
67 67
 	{
@@ -304,6 +304,7 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * Delete menu
306 306
 	 * Delete menu_item and xml cache files
307
+	 * @param string $menu_srl
307 308
 	 * @return BaseObject
308 309
 	 */
309 310
 	function deleteMenu($menu_srl)
@@ -380,6 +381,7 @@  discard block
 block discarded – undo
380 381
 
381 382
 	/**
382 383
 	 * Add an item to the menu, simple version
384
+	 * @param stdClass $request
383 385
 	 * @return void
384 386
 	 */
385 387
 	public function procMenuAdminInsertItem($request = NULL)
@@ -518,6 +520,9 @@  discard block
 block discarded – undo
518 520
 		$this->setMessage('success_registed', 'info');
519 521
 	}
520 522
 
523
+	/**
524
+	 * @param boolean $isProc
525
+	 */
521 526
 	private function _insertMenu(&$request, $isProc)
522 527
 	{
523 528
 		$oDB = DB::getInstance();
@@ -583,6 +588,7 @@  discard block
 block discarded – undo
583 588
 	 * insert module by men create value
584 589
 	 * @request value of client request
585 590
 	 * @args value for menu create
591
+	 * @param stdClass $args
586 592
 	 * @return bool result of create module
587 593
 	 */
588 594
 	private function _insertModule(&$request, &$args)
@@ -640,7 +646,7 @@  discard block
 block discarded – undo
640 646
 
641 647
 	/**
642 648
 	 * Update an item to the menu, simple version
643
-	 * @return void
649
+	 * @return BaseObject|null
644 650
 	 */
645 651
 	public function procMenuAdminUpdateItem()
646 652
 	{
@@ -841,6 +847,7 @@  discard block
 block discarded – undo
841 847
 	/**
842 848
 	 * Delete menu item ( Only include BO )
843 849
 	 * @args menu_srl, menu_item_srl, is_force
850
+	 * @param stdClass $args
844 851
 	 * @return void|BaseObject
845 852
 	 */
846 853
 	public function deleteItem($args)
@@ -989,6 +996,9 @@  discard block
 block discarded – undo
989 996
 		return new BaseObject(0, 'success');
990 997
 	}
991 998
 
999
+	/**
1000
+	 * @param DB $oDB
1001
+	 */
992 1002
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
993 1003
 	{
994 1004
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
@@ -1008,7 +1018,7 @@  discard block
 block discarded – undo
1008 1018
 
1009 1019
 	/**
1010 1020
 	 * Move menu items
1011
-	 * @return void
1021
+	 * @return BaseObject|null
1012 1022
 	 */
1013 1023
 	function procMenuAdminMoveItem()
1014 1024
 	{
@@ -1173,6 +1183,9 @@  discard block
 block discarded – undo
1173 1183
 		}
1174 1184
 	}
1175 1185
 
1186
+	/**
1187
+	 * @param string $parentSrl
1188
+	 */
1176 1189
 	private function _copyMenu($menuSrl, $parentSrl, &$originMenu)
1177 1190
 	{
1178 1191
 		$oMenuAdminModel = getAdminModel('menu');
@@ -2129,7 +2142,7 @@  discard block
 block discarded – undo
2129 2142
 
2130 2143
 	/**
2131 2144
 	 * Register a menu image button
2132
-	 * @param object $args
2145
+	 * @param BaseObject $args
2133 2146
 	 * @return array
2134 2147
 	 */
2135 2148
 	function _uploadButton($args)
@@ -2204,6 +2217,7 @@  discard block
 block discarded – undo
2204 2217
 	/**
2205 2218
 	 * When copy a menu, button copied also.
2206 2219
 	 * @param $args menuItemInfo with button values
2220
+	 * @param string $insertedMenuItemSrl
2207 2221
 	 */
2208 2222
 	private function _copyButton($insertedMenuItemSrl, $insertedMenuSrl, &$menuItemInfo)
2209 2223
 	{
@@ -2244,6 +2258,9 @@  discard block
 block discarded – undo
2244 2258
 		return $copied_info;
2245 2259
 	}
2246 2260
 
2261
+	/**
2262
+	 * @param string $mode
2263
+	 */
2247 2264
 	private function _changeMenuItemSrlInButtonPath($buttonPath, $menuSrl, $menuItemSrl, $mode)
2248 2265
 	{
2249 2266
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
@@ -2253,6 +2270,9 @@  discard block
 block discarded – undo
2253 2270
 		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2254 2271
 	}
2255 2272
 
2273
+	/**
2274
+	 * @param integer $menuSrl
2275
+	 */
2256 2276
 	public function makeHomemenuCacheFile($menuSrl)
2257 2277
 	{
2258 2278
 		$cacheBuff .= sprintf('<?php if(!defined("__XE__")) exit();');
Please login to merge, or discard this patch.
Spacing   +304 added lines, -304 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	function __construct() {
59
-		$this->homeMenuCacheFile = _XE_PATH_ . $this->homeMenuCacheFile;
59
+		$this->homeMenuCacheFile = _XE_PATH_.$this->homeMenuCacheFile;
60 60
 	}
61 61
 
62 62
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		// List variables
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71
-		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
71
+		$output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl);
72
+		if (!$output->toBool()) return $output;
73 73
 
74 74
 		$this->add('menu_srl', $output->get('menuSrl'));
75 75
 		$this->setMessage('success_registed');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$args->listorder = $args->menu_srl * -1;
96 96
 
97 97
 		$output = executeQuery('menu.insertMenu', $args);
98
-		if(!$output->toBool())
98
+		if (!$output->toBool())
99 99
 		{
100 100
 			return $output;
101 101
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		$unlinked_modules = false;
110 110
 		$args = new stdClass;
111 111
 		$args->site_srl = 0;
112
-		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args);
113
-		if($output->toBool() && $output->data && count($output->data) > 0)
112
+		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args);
113
+		if ($output->toBool() && $output->data && count($output->data) > 0)
114 114
 		{
115 115
 			$unlinked_modules = $output->data;
116 116
 		}
117 117
 
118
-		if($unlinked_modules)
118
+		if ($unlinked_modules)
119 119
 		{
120 120
 			$unlinked_menu_srl = $this->getUnlinkedMenu();
121 121
 			$output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl);
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$moduleConfig = $oModuleModel->getModuleConfig('menu');
131 131
 
132
-		if($moduleConfig->unlinked_menu_srl)
132
+		if ($moduleConfig->unlinked_menu_srl)
133 133
 		{
134 134
 			$menuArgs = new stdClass;
135 135
 			$menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl;
136 136
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
137
-			if(!$menuOutput->data)
137
+			if (!$menuOutput->data)
138 138
 			{
139 139
 				unset($moduleConfig->unlinked_menu_srl);
140 140
 			}
141 141
 		}
142 142
 
143
-		if(!$moduleConfig->unlinked_menu_srl)
143
+		if (!$moduleConfig->unlinked_menu_srl)
144 144
 		{
145 145
 			$output = $this->addMenu('unlinked', 0);
146
-			if($output->toBool())
146
+			if ($output->toBool())
147 147
 			{
148 148
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 149
 				$oModuleController = getController('module');
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function updateLinkModule($moduleInfos, $menuSrl)
170 170
 	{
171
-		if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
171
+		if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
172 172
 		{
173 173
 			return new BaseObject(-1, 'msg_invalid_request');
174 174
 		}
175 175
 
176
-		foreach($moduleInfos as $moduleInfo)
176
+		foreach ($moduleInfos as $moduleInfo)
177 177
 		{
178 178
 			// search menu.
179 179
 			$args = new stdClass;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
185 185
 
186
-			if($output->toBool() && $output->data)
186
+			if ($output->toBool() && $output->data)
187 187
 			{
188 188
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189 189
 			}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				$item_args->url = $moduleInfo->mid;
195 195
 				$item_args->name = $moduleInfo->mid;
196 196
 				$item_args->menu_item_srl = getNextSequence();
197
-				$item_args->listorder = -1*$item_args->menu_item_srl;
197
+				$item_args->listorder = -1 * $item_args->menu_item_srl;
198 198
 
199 199
 				$output = executeQuery('menu.insertMenuItem', $item_args);
200
-				if(!$output->toBool())
200
+				if (!$output->toBool())
201 201
 				{
202 202
 					return $output;
203 203
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
213
-		if($oCacheHandler->isSupport())
213
+		if ($oCacheHandler->isSupport())
214 214
 		{
215 215
 			$oCacheHandler->invalidateGroupKey('site_and_module');
216 216
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 
240 240
 		$this->setMessage('success_registed');
241 241
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 256
 
257 257
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
258
+		if ($menuInfo->title == $oAdmin->getAdminMenuName())
259 259
 			return new BaseObject(-1, 'msg_adminmenu_cannot_delete');
260 260
 
261 261
 		// get menu properies with child menu
262 262
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
263 263
 		$originMenu = NULL;
264 264
 
265
-		if(is_readable(FileHandler::getRealPath($phpFile)))
265
+		if (is_readable(FileHandler::getRealPath($phpFile)))
266 266
 		{
267 267
 			include(FileHandler::getRealPath($phpFile));
268 268
 		}
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$isStartmenuInclude = false;
275 275
 
276
-		if(is_array($menu->list))
276
+		if (is_array($menu->list))
277 277
 		{
278
-			foreach($menu->list AS $key=>$value)
278
+			foreach ($menu->list AS $key=>$value)
279 279
 			{
280 280
 				$originMenu = $value;
281 281
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 282
 
283
-				if($isStartmenuInclude)
283
+				if ($isStartmenuInclude)
284 284
 					break;
285 285
 			}
286 286
 		}
287 287
 
288
-		if($isStartmenuInclude)
288
+		if ($isStartmenuInclude)
289 289
 		{
290 290
 			return new BaseObject(-1, 'msg_cannot_delete_homemenu');
291 291
 		}
292 292
 
293 293
 		$output = $this->deleteMenu($menu_srl);
294
-		if(!$output->toBool())
294
+		if (!$output->toBool())
295 295
 		{
296 296
 			return new BaseObject(-1, $output->message);
297 297
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		// Delete modules
321 321
 		$output = executeQueryArray('menu.getMenuItems', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 		$oModuleController = getController('module');
328 328
 		$oModuleModel = getModel('module');
329 329
 
330
-		foreach($output->data as $itemInfo)
330
+		foreach ($output->data as $itemInfo)
331 331
 		{
332
-			if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
332
+			if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
333 333
 			{
334 334
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
335
-				if($moduleInfo->module_srl)
335
+				if ($moduleInfo->module_srl)
336 336
 				{
337 337
 					$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
338
-					if(!$output->toBool())
338
+					if (!$output->toBool())
339 339
 					{
340 340
 						$oDB->rollback();
341 341
 						return $output;
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
 
347 347
 		// Delete menu items
348 348
 		$output = executeQuery("menu.deleteMenuItems", $args);
349
-		if(!$output->toBool())
349
+		if (!$output->toBool())
350 350
 		{
351 351
 			$oDB->rollback();
352 352
 			return $output;
353 353
 		}
354 354
 		// Delete the menu
355 355
 		$output = executeQuery("menu.deleteMenu", $args);
356
-		if(!$output->toBool())
356
+		if (!$output->toBool())
357 357
 		{
358 358
 			$oDB->rollback();
359 359
 			return $output;
360 360
 		}
361 361
 
362 362
 		// Delete cache files
363
-		$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
364
-		if(count($cache_list))
363
+		$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
364
+		if (count($cache_list))
365 365
 		{
366
-			foreach($cache_list as $cache_file)
366
+			foreach ($cache_list as $cache_file)
367 367
 			{
368 368
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
369
+				if ($pos > 0)FileHandler::removeFile($cache_file);
370 370
 			}
371 371
 		}
372 372
 		// Delete images of menu buttons
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 		$oDB->commit();
377 377
 
378
-		return new BaseObject(0,'success_deleted');
378
+		return new BaseObject(0, 'success_deleted');
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
 	public function procMenuAdminInsertItem($request = NULL)
386 386
 	{
387 387
 		$isProc = false;
388
-		if(!$request)
388
+		if (!$request)
389 389
 		{
390 390
 			$isProc = true;
391 391
 			$request = Context::getRequestVars();
392 392
 		}
393 393
 
394
-		if(!$request->parent_srl || !$request->menu_name)
394
+		if (!$request->parent_srl || !$request->menu_name)
395 395
 		{
396 396
 			return new BaseObject(-1, 'msg_invalid_request');
397 397
 		}
398 398
 
399 399
 		$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
400
-		if(!$request->menu_srl)
400
+		if (!$request->menu_srl)
401 401
 		{
402 402
 			return new BaseObject(-1, 'msg_invalid_request');
403 403
 		}
404 404
 
405
-		if($request->is_shortcut == 'Y')
405
+		if ($request->is_shortcut == 'Y')
406 406
 		{
407 407
 			$result = $this->_insertShortcut($request);
408 408
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$result = $this->_insertMenu($request, $isProc);
412 412
 		}
413 413
 
414
-		if($result->error < 0)
414
+		if ($result->error < 0)
415 415
 		{
416 416
 			return new BaseObject($result->error, $result->message);
417 417
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// recreate menu cache file
420 420
 		$this->makeXmlFile($request->menu_srl);
421 421
 
422
-		if(!$isProc)
422
+		if (!$isProc)
423 423
 		{
424 424
 			return $this->get('menu_item_srl');
425 425
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$oMenuAdminModel = getAdminModel('menu');
432 432
 		$itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
433 433
 		// parent_srl is parent menu item's srl
434
-		if($itemInfo->menu_srl)
434
+		if ($itemInfo->menu_srl)
435 435
 		{
436 436
 			$menu_srl = $itemInfo->menu_srl;
437 437
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		else
440 440
 		{
441 441
 			$output = $oMenuAdminModel->getMenu($parent_srl);
442
-			if($output->menu_srl == $parent_srl)
442
+			if ($output->menu_srl == $parent_srl)
443 443
 			{
444 444
 				$menu_srl = $output->menu_srl;
445 445
 				$parent_srl = 0;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$oDB->begin();
454 454
 
455 455
 		// type is url
456
-		if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
456
+		if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
457 457
 		{
458 458
 			// set menu variable
459 459
 			$args = new stdClass();
@@ -464,27 +464,27 @@  discard block
 block discarded – undo
464 464
 			$args->is_shortcut = $request->is_shortcut;
465 465
 			$args->url = $request->shortcut_target;
466 466
 
467
-			if(!$args->open_window) $args->open_window = 'N';
468
-			if(!$args->expand) $args->expand = 'N';
469
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
467
+			if (!$args->open_window) $args->open_window = 'N';
468
+			if (!$args->expand) $args->expand = 'N';
469
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
470 470
 
471
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
471
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
472 472
 			else $args->name = $request->menu_name;
473 473
 		}
474 474
 		// type is module short cut
475
-		else if(is_numeric($request->shortcut_target))
475
+		else if (is_numeric($request->shortcut_target))
476 476
 		{
477 477
 			// Get original information
478 478
 			$oMenuAdminModel = getAdminModel('menu');
479 479
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
480
-			if(!$itemInfo->menu_item_srl)
480
+			if (!$itemInfo->menu_item_srl)
481 481
 			{
482 482
 				return new BaseObject(-1, 'msg_invalid_request');
483 483
 			}
484 484
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
485 485
 
486 486
 			$args = $itemInfo;
487
-			if(count($args->group_srls) == 0)
487
+			if (count($args->group_srls) == 0)
488 488
 			{
489 489
 				unset($args->group_srls);
490 490
 			}
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
 			$args->url = '#';
505 505
 		}
506 506
 
507
-		if($request->menu_desc) $args->desc = $request->menu_desc;
507
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
508 508
 		else $args->desc = '';
509 509
 
510 510
 		$args->menu_item_srl = getNextSequence();
511
-		$args->listorder = -1*$args->menu_item_srl;
511
+		$args->listorder = -1 * $args->menu_item_srl;
512 512
 		$output = executeQuery('menu.insertMenuItem', $args);
513
-		if(!$output->toBool()) return $output;
513
+		if (!$output->toBool()) return $output;
514 514
 
515 515
 		$oDB->commit();
516 516
 
@@ -532,46 +532,46 @@  discard block
 block discarded – undo
532 532
 		$args->expand = $request->menu_expand;
533 533
 		$args->is_shortcut = $request->is_shortcut;
534 534
 
535
-		if(!$args->open_window) $args->open_window = 'N';
536
-		if(!$args->expand) $args->expand = 'N';
537
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
535
+		if (!$args->open_window) $args->open_window = 'N';
536
+		if (!$args->expand) $args->expand = 'N';
537
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
538 538
 
539
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
539
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
540 540
 		else $args->name = $request->menu_name;
541 541
 
542
-		if($request->menu_desc) $args->desc = $request->menu_desc;
542
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
543 543
 		else $args->desc = '';
544 544
 
545
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
545
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546 546
 		{
547 547
 			return new BaseObject(-1, 'msg_invalid_request');
548 548
 		}
549 549
 
550 550
 		// when menu copy, module already copied
551
-		if($isProc)
551
+		if ($isProc)
552 552
 		{
553 553
 			$result = $this->_insertModule($request, $args);
554
-			if(!$result->toBool())
554
+			if (!$result->toBool())
555 555
 			{
556 556
 				return new BaseObject(-1, $result->message);
557 557
 			}
558 558
 		}
559 559
 
560 560
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
561
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
-		if($request->active_btn) $args->active_btn = $request->active_btn;
561
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
564 564
 
565
-		if(!$request->module_id)
565
+		if (!$request->module_id)
566 566
 		{
567 567
 			return new BaseObject(-1, 'msg_invalid_request');
568 568
 		}
569 569
 
570 570
 		$args->url = $request->module_id;
571 571
 		$args->menu_item_srl = getNextSequence();
572
-		$args->listorder = -1*$args->menu_item_srl;
572
+		$args->listorder = -1 * $args->menu_item_srl;
573 573
 		$output = executeQuery('menu.insertMenuItem', $args);
574
-		if(!$output->toBool()) return $output;
574
+		if (!$output->toBool()) return $output;
575 575
 
576 576
 		$oDB->commit();
577 577
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		//module create
605 605
 		$site_module_info = Context::get('site_module_info');
606
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
606
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
607 607
 		$cmArgs->browser_title = $args->name;
608 608
 		$cmArgs->menu_srl = $request->menu_srl;
609 609
 		$cmArgs->layout_srl = -1;
@@ -611,13 +611,13 @@  discard block
 block discarded – undo
611 611
 		$cmArgs->is_skin_fix = 'N';
612 612
 		$cmArgs->is_mskin_fix = 'N';
613 613
 
614
-		if(Mobile::isMobileEnabled() === true)
614
+		if (Mobile::isMobileEnabled() === true)
615 615
 		{
616 616
 			$cmArgs->use_mobile = 'Y';
617 617
 		}
618 618
 
619 619
 		// if mid is empty, auto create mid
620
-		if(!$request->module_id)
620
+		if (!$request->module_id)
621 621
 		{
622 622
 			$randomMid = $this->_makeRandomMid();
623 623
 			$request->module_id = $cmArgs->module.'_'.$randomMid;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		// check already created module instance
628 628
 		$oModuleModel = getModel('module');
629 629
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
630
-		if($output->module_srl)
630
+		if ($output->module_srl)
631 631
 		{
632 632
 			return new BaseObject(-1, 'msg_module_name_exists');
633 633
 		}
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
 	{
647 647
 		$request = Context::getRequestVars();
648 648
 
649
-		if(!$request->menu_item_srl || !$request->menu_name)
649
+		if (!$request->menu_item_srl || !$request->menu_name)
650 650
 		{
651 651
 			return new BaseObject(-1, 'msg_invalid_request');
652 652
 		}
653 653
 
654 654
 		// variables set
655
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
655
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
657 657
 
658 658
 		// Get original information
659 659
 		$oMenuAdminModel = getAdminModel('menu');
@@ -661,19 +661,19 @@  discard block
 block discarded – undo
661 661
 		$args = $itemInfo;
662 662
 
663 663
 		// if menu type is module, check exists module and update
664
-		if($itemInfo->is_shortcut == 'Y')
664
+		if ($itemInfo->is_shortcut == 'Y')
665 665
 		{
666 666
 			// type is url
667
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
667
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668 668
 			{
669 669
 				$args->url = $request->shortcut_target;
670 670
 			}
671 671
 			// type is module short cut
672
-			else if(is_numeric($request->shortcut_target))
672
+			else if (is_numeric($request->shortcut_target))
673 673
 			{
674 674
 				// Get new original information
675 675
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
676
-				if(!$newItemInfo->menu_item_srl)
676
+				if (!$newItemInfo->menu_item_srl)
677 677
 				{
678 678
 					return new BaseObject(-1, 'msg_invalid_request');
679 679
 				}
@@ -690,10 +690,10 @@  discard block
 block discarded – undo
690 690
 		{
691 691
 			// check already created module instance
692 692
 			$oModuleModel = getModel('module');
693
-			if($request->module_id != $itemInfo->url)
693
+			if ($request->module_id != $itemInfo->url)
694 694
 			{
695 695
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
696
-				if($output->module_srl)
696
+				if ($output->module_srl)
697 697
 				{
698 698
 					return new BaseObject(-1, 'msg_module_name_exists');
699 699
 				}
@@ -701,13 +701,13 @@  discard block
 block discarded – undo
701 701
 
702 702
 			// if not exist module, return error
703 703
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
704
-			if(!$moduleInfo)
704
+			if (!$moduleInfo)
705 705
 			{
706 706
 				return new BaseObject(-1, 'msg_invalid_request');
707 707
 			}
708 708
 
709 709
 			$moduleInfo->mid = $request->module_id;
710
-			if($request->browser_title)
710
+			if ($request->browser_title)
711 711
 			{
712 712
 				$moduleInfo->browser_title = $request->browser_title;
713 713
 			}
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			$args->url = $request->module_id;
717 717
 		}
718 718
 
719
-		if($request->menu_name_key)
719
+		if ($request->menu_name_key)
720 720
 		{
721 721
 			$args->name = $request->menu_name_key;
722 722
 		}
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 			$args->name = $request->menu_name;
726 726
 		}
727 727
 
728
-		if($request->menu_desc) $args->desc = $request->menu_desc;
728
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
729 729
 		else $args->desc = '';
730 730
 
731 731
 		unset($args->group_srls);
@@ -753,38 +753,38 @@  discard block
 block discarded – undo
753 753
 
754 754
 		$btnOutput = $this->_uploadButton($args);
755 755
 
756
-		if($btnOutput['normal_btn'])
756
+		if ($btnOutput['normal_btn'])
757 757
 		{
758 758
 			$this->add('normal_btn', $btnOutput['normal_btn']);
759 759
 			$item_info->normal_btn = $btnOutput['normal_btn'];
760 760
 		}
761
-		if($btnOutput['hover_btn'])
761
+		if ($btnOutput['hover_btn'])
762 762
 		{
763 763
 			$this->add('hover_btn', $btnOutput['hover_btn']);
764 764
 			$item_info->hover_btn = $btnOutput['hover_btn'];
765 765
 		}
766
-		if($btnOutput['active_btn'])
766
+		if ($btnOutput['active_btn'])
767 767
 		{
768 768
 			$this->add('active_btn', $btnOutput['active_btn']);
769 769
 			$item_info->active_btn = $btnOutput['active_btn'];
770 770
 		}
771 771
 
772 772
 		// group_srls check
773
-		if(count($item_info->group_srls) == 0)
773
+		if (count($item_info->group_srls) == 0)
774 774
 		{
775 775
 			unset($item_info->group_srls);
776 776
 		}
777 777
 
778 778
 		// Button delete check
779
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
779
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780 780
 		{
781 781
 			$item_info->normal_btn = '';
782 782
 		}
783
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
783
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784 784
 		{
785 785
 			$item_info->hover_btn = '';
786 786
 		}
787
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
787
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788 788
 		{
789 789
 			$item_info->active_btn = '';
790 790
 		}
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 		$args->is_force = Context::get('is_force');
825 825
 
826 826
 		$returnObj = $this->deleteItem($args);
827
-		if(is_object($returnObj))
827
+		if (is_object($returnObj))
828 828
 		{
829 829
 			$this->setError($returnObj->error);
830 830
 			$this->setMessage($returnObj->message);
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
 		$args->menu_srl = $itemInfo->menu_srl;
854 854
 
855 855
 		// Display an error that the category cannot be deleted if it has a child node	603
856
-		if($args->is_force != 'Y')
856
+		if ($args->is_force != 'Y')
857 857
 		{
858 858
 			$output = executeQuery('menu.getChildMenuCount', $args);
859
-			if(!$output->toBool()) return $output;
860
-			if($output->data->count > 0)
859
+			if (!$output->toBool()) return $output;
860
+			if ($output->data->count > 0)
861 861
 			{
862 862
 				return new BaseObject(-1001, 'msg_cannot_delete_for_child');
863 863
 			}
@@ -869,22 +869,22 @@  discard block
 block discarded – undo
869 869
 
870 870
 		// check admin menu delete
871 871
 		$oAdmin = getClass('admin');
872
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
872
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873 873
 		{
874 874
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
875 875
 		}
876 876
 
877
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
877
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878 878
 
879 879
 		// get menu properies with child menu
880 880
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
881 881
 		$originMenu = NULL;
882 882
 
883
-		if(is_readable(FileHandler::getRealPath($phpFile)))
883
+		if (is_readable(FileHandler::getRealPath($phpFile)))
884 884
 		{
885 885
 			include(FileHandler::getRealPath($phpFile));
886 886
 
887
-			if(is_array($menu->list))
887
+			if (is_array($menu->list))
888 888
 			{
889 889
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
890 890
 			}
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
895 895
 		$isStartmenuInclude = false;
896 896
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
897
-		if($isStartmenuInclude)
897
+		if ($isStartmenuInclude)
898 898
 		{
899 899
 			return new BaseObject(-1, 'msg_cannot_delete_homemenu');
900 900
 		}
@@ -918,14 +918,14 @@  discard block
 block discarded – undo
918 918
 
919 919
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
920 920
 	{
921
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
921
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922 922
 		{
923 923
 			$isStartmenuInclude = true;
924 924
 		}
925 925
 
926
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
926
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
927 927
 		{
928
-			foreach($originMenu['list'] AS $key=>$value)
928
+			foreach ($originMenu['list'] AS $key=>$value)
929 929
 			{
930 930
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
931 931
 			}
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		$args->menu_srl = $menuSrl;
940 940
 		$args->menu_item_srl = $node['node_srl'];
941 941
 		$output = executeQuery("menu.deleteMenuItem", $args);
942
-		if(!$output->toBool())
942
+		if (!$output->toBool())
943 943
 		{
944 944
 			$oDB->rollback();
945 945
 			return $output;
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 		// Update the xml file and get its location
949 949
 		$xml_file = $this->makeXmlFile($args->menu_srl);
950 950
 		// Delete all of image buttons
951
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
951
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
954 954
 
955 955
 		// Delete module
956
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
956
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957 957
 		{
958 958
 			$oModuleController = getController('module');
959 959
 			$oModuleModel = getModel('module');
@@ -963,12 +963,12 @@  discard block
 block discarded – undo
963 963
 			$args->site_srl = $menuInfo->site_srl;
964 964
 			$args->is_shortcut = 'Y';
965 965
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
966
-			if($output->data->menu_item_srl)
966
+			if ($output->data->menu_item_srl)
967 967
 			{
968 968
 				$output->data->url = '';
969 969
 				$referenceItem = $output->data;
970 970
 				$output = $this->_updateMenuItem($referenceItem);
971
-				if(!$output->toBool())
971
+				if (!$output->toBool())
972 972
 				{
973 973
 					$oDB->rollback();
974 974
 					return $output;
@@ -976,10 +976,10 @@  discard block
 block discarded – undo
976 976
 			}
977 977
 
978 978
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
979
-			if($moduleInfo->module_srl)
979
+			if ($moduleInfo->module_srl)
980 980
 			{
981 981
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
982
-				if(!$output->toBool())
982
+				if (!$output->toBool())
983 983
 				{
984 984
 					$oDB->rollback();
985 985
 					return $output;
@@ -992,14 +992,14 @@  discard block
 block discarded – undo
992 992
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
993 993
 	{
994 994
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
995
-		if(!$output->toBool())
995
+		if (!$output->toBool())
996 996
 		{
997 997
 			return new BaseObject(-1, $output->message);
998 998
 		}
999 999
 
1000
-		if(is_array($node['list']))
1000
+		if (is_array($node['list']))
1001 1001
 		{
1002
-			foreach($node['list'] AS $key=>$value)
1002
+			foreach ($node['list'] AS $key=>$value)
1003 1003
 			{
1004 1004
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1005 1005
 			}
@@ -1012,31 +1012,31 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	function procMenuAdminMoveItem()
1014 1014
 	{
1015
-		$mode = Context::get('mode');	//move
1016
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1017
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1018
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1015
+		$mode = Context::get('mode'); //move
1016
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1017
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1018
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1019 1019
 
1020
-		if(!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1,'msg_invalid_request');
1020
+		if (!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1, 'msg_invalid_request');
1021 1021
 
1022 1022
 		$oMenuAdminModel = getAdminModel('menu');
1023 1023
 
1024 1024
 		// get original menu item info for cache file recreate
1025 1025
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1026
-		if(!$originalItemInfo->menu_item_srl)
1026
+		if (!$originalItemInfo->menu_item_srl)
1027 1027
 		{
1028 1028
 			return new BaseObject(-1, 'msg_empty_menu_item');
1029 1029
 		}
1030 1030
 
1031 1031
 		// get menu properies with child menu
1032
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1032
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1033 1033
 		$originMenu = NULL;
1034 1034
 
1035
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1035
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1036 1036
 		{
1037 1037
 			include(FileHandler::getRealPath($phpFile));
1038 1038
 
1039
-			if(is_array($menu->list))
1039
+			if (is_array($menu->list))
1040 1040
 			{
1041 1041
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1042 1042
 			}
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 		// get target menu info for move
1046 1046
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1047 1047
 		// if move in same sitemap
1048
-		if($targetMenuItemInfo->menu_item_srl)
1048
+		if ($targetMenuItemInfo->menu_item_srl)
1049 1049
 		{
1050 1050
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1051 1051
 		}
@@ -1057,20 +1057,20 @@  discard block
 block discarded – undo
1057 1057
 			$parent_srl = 0;
1058 1058
 		}
1059 1059
 
1060
-		if(!$this->homeModuleMid)
1060
+		if (!$this->homeModuleMid)
1061 1061
 		{
1062 1062
 			$oModuleModel = getModel('module');
1063 1063
 			$oMenuAdminController = getAdminController('menu');
1064 1064
 			$columnList = array('modules.mid',);
1065 1065
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1066
-			if($output->mid)
1066
+			if ($output->mid)
1067 1067
 			{
1068 1068
 				$this->homeModuleMid = $output->mid;
1069 1069
 			}
1070 1070
 		}
1071 1071
 
1072 1072
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1073
-		if(count($originMenu['list']) > 0)
1073
+		if (count($originMenu['list']) > 0)
1074 1074
 		{
1075 1075
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1076 1076
 		}
@@ -1084,9 +1084,9 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1086 1086
 	{
1087
-		if(is_array($node))
1087
+		if (is_array($node))
1088 1088
 		{
1089
-			foreach($node AS $key=>$node)
1089
+			foreach ($node AS $key=>$node)
1090 1090
 			{
1091 1091
 				$args = new stdClass();
1092 1092
 				$args->menu_srl = $menu_srl;
@@ -1094,11 +1094,11 @@  discard block
 block discarded – undo
1094 1094
 				$output = $this->_updateMenuItem($args);
1095 1095
 
1096 1096
 				//module's menu_srl move also
1097
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1097
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1098 1098
 				{
1099 1099
 					$oModuleModel = getModel('module');
1100 1100
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1101
-					if($menu_srl != $moduleInfo->menu_srl)
1101
+					if ($menu_srl != $moduleInfo->menu_srl)
1102 1102
 					{
1103 1103
 						$moduleInfo->menu_srl = $menu_srl;
1104 1104
 						$oModuleController = getController('module');
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 					}
1107 1107
 				}
1108 1108
 
1109
-				if(count($node['list']) > 0)
1109
+				if (count($node['list']) > 0)
1110 1110
 				{
1111 1111
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1112 1112
 				}
@@ -1128,21 +1128,21 @@  discard block
 block discarded – undo
1128 1128
 		$menuSrl = $itemInfo->menu_srl;
1129 1129
 
1130 1130
 		// get menu properies with child menu
1131
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1131
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl);
1132 1132
 		$originMenu = NULL;
1133 1133
 
1134
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1134
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1135 1135
 		{
1136 1136
 			include(FileHandler::getRealPath($phpFile));
1137 1137
 
1138
-			if(is_array($menu->list))
1138
+			if (is_array($menu->list))
1139 1139
 			{
1140 1140
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1141 1141
 			}
1142 1142
 		}
1143 1143
 
1144 1144
 		// copy the menu item with recursively
1145
-		if(is_array($originMenu))
1145
+		if (is_array($originMenu))
1146 1146
 		{
1147 1147
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1148 1148
 		}
@@ -1158,15 +1158,15 @@  discard block
 block discarded – undo
1158 1158
 	 */
1159 1159
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1160 1160
 	{
1161
-		if(array_key_exists($menuItemSrl, $menuList))
1161
+		if (array_key_exists($menuItemSrl, $menuList))
1162 1162
 		{
1163 1163
 			$originMenu = $menuList[$menuItemSrl];
1164 1164
 			return;
1165 1165
 		}
1166 1166
 
1167
-		foreach($menuList AS $key=>$value)
1167
+		foreach ($menuList AS $key=>$value)
1168 1168
 		{
1169
-			if(count($value['list']) > 0)
1169
+			if (count($value['list']) > 0)
1170 1170
 			{
1171 1171
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1172 1172
 			}
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		// default argument setting
1182 1182
 		$args = new stdClass();
1183 1183
 		$args->menu_srl = $menuSrl;
1184
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1184
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1185 1185
 		else $args->parent_srl = $parentSrl;
1186 1186
 		$args->menu_name_key = $originMenu['text'];
1187 1187
 		$args->menu_name = $originMenu['text'];
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
 		$isModuleCopySuccess = false;
1196 1196
 		// if menu have a reference of module instance
1197
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1197
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1198 1198
 		{
1199 1199
 			$oModuleModel = getModel('module');
1200 1200
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
@@ -1214,22 +1214,22 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 			$args->module_srl = $copiedModuleSrl;
1216 1216
 
1217
-			if($copiedModuleSrl)
1217
+			if ($copiedModuleSrl)
1218 1218
 			{
1219 1219
 				$isModuleCopySuccess = true;
1220 1220
 			}
1221 1221
 		}
1222 1222
 		// if menu type is shortcut
1223
-		else if($menuItemInfo->is_shortcut == 'Y')
1223
+		else if ($menuItemInfo->is_shortcut == 'Y')
1224 1224
 		{
1225 1225
 			$args->shortcut_target = $originMenu['url'];
1226 1226
 			$isModuleCopySuccess = true;
1227 1227
 		}
1228 1228
 
1229
-		if($isModuleCopySuccess)
1229
+		if ($isModuleCopySuccess)
1230 1230
 		{
1231 1231
 			// if have a group permission
1232
-			if($menuItemInfo->group_srls)
1232
+			if ($menuItemInfo->group_srls)
1233 1233
 			{
1234 1234
 				$args->group_srls = $menuItemInfo->group_srls;
1235 1235
 			}
@@ -1243,12 +1243,12 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 			// if have a button, copy a button image also
1245 1245
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1246
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1246
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247 1247
 			{
1248 1248
 				// copy & upate
1249 1249
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1250
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1251
-				if(count($update_item_info->group_srls) == 0)
1250
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1251
+				if (count($update_item_info->group_srls) == 0)
1252 1252
 				{
1253 1253
 					unset($update_item_info->group_srls);
1254 1254
 				}
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
 		// if have a child menu, copy child menu also
1264 1264
 		$childMenu = array_shift($originMenu['list']);
1265
-		if(count($childMenu) > 0)
1265
+		if (count($childMenu) > 0)
1266 1266
 		{
1267 1267
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1268 1268
 		}
@@ -1272,10 +1272,10 @@  discard block
 block discarded – undo
1272 1272
 	{
1273 1273
 		$time = $_SERVER['REQUEST_TIME'];
1274 1274
 		$randomString = "";
1275
-		for($i=0;$i<4;$i++)
1275
+		for ($i = 0; $i < 4; $i++)
1276 1276
 		{
1277 1277
 			$case = rand(0, 1);
1278
-			if($case) $doc = rand(65, 90);
1278
+			if ($case) $doc = rand(65, 90);
1279 1279
 			else $doc = rand(97, 122);
1280 1280
 
1281 1281
 			$randomString .= chr($doc);
@@ -1299,32 +1299,32 @@  discard block
 block discarded – undo
1299 1299
 		// menu name update
1300 1300
 		$args->menu_srl = $this->menuSrl;
1301 1301
 		$output = executeQuery('menu.updateMenu', $args);
1302
-		if(!$output->toBool()) return $output;
1302
+		if (!$output->toBool()) return $output;
1303 1303
 
1304 1304
 		$this->map = array();
1305
-		if(is_array($parentKeyList))
1305
+		if (is_array($parentKeyList))
1306 1306
 		{
1307
-			foreach($parentKeyList as $no=>$srl)
1307
+			foreach ($parentKeyList as $no=>$srl)
1308 1308
 			{
1309
-				if($srl === 0) continue;
1310
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1309
+				if ($srl === 0) continue;
1310
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1311 1311
 				$this->map[$srl][] = $no;
1312 1312
 			}
1313 1313
 		}
1314 1314
 
1315 1315
 		$result = array();
1316
-		if(is_array($this->itemKeyList))
1316
+		if (is_array($this->itemKeyList))
1317 1317
 		{
1318
-			foreach($this->itemKeyList as $srl)
1318
+			foreach ($this->itemKeyList as $srl)
1319 1319
 			{
1320
-				if(!$this->checked[$srl])
1320
+				if (!$this->checked[$srl])
1321 1321
 				{
1322 1322
 					$target = new stdClass();
1323 1323
 					$this->checked[$srl] = 1;
1324 1324
 					$target->node = $srl;
1325
-					$target->child= array();
1325
+					$target->child = array();
1326 1326
 
1327
-					while(count($this->map[$srl]))
1327
+					while (count($this->map[$srl]))
1328 1328
 					{
1329 1329
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1330 1330
 					}
@@ -1333,13 +1333,13 @@  discard block
 block discarded – undo
1333 1333
 			}
1334 1334
 		}
1335 1335
 
1336
-		if(is_array($result))
1336
+		if (is_array($result))
1337 1337
 		{
1338 1338
 			$i = 0;
1339
-			foreach($result AS $key=>$node)
1339
+			foreach ($result AS $key=>$node)
1340 1340
 			{
1341
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1342
-				$this->_recursiveMoveMenuItem($node);	//move child node
1341
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1342
+				$this->_recursiveMoveMenuItem($node); //move child node
1343 1343
 				$i = $node->node;
1344 1344
 			}
1345 1345
 		}
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 		$child_node->child = array();
1369 1369
 		$target->child[] = $child_node;
1370 1370
 
1371
-		while(count($this->map[$child_srl]))
1371
+		while (count($this->map[$child_srl]))
1372 1372
 		{
1373 1373
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1374 1374
 		}
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	function _recursiveMoveMenuItem($result)
1384 1384
 	{
1385 1385
 		$i = 0;
1386
-		while(count($result->child))
1386
+		while (count($result->child))
1387 1387
 		{
1388 1388
 			unset($node);
1389 1389
 			$node = array_shift($result->child);
@@ -1403,48 +1403,48 @@  discard block
 block discarded – undo
1403 1403
 	 * @param string $mode 'move' or 'insert'
1404 1404
 	 * @return void
1405 1405
 	 */
1406
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1406
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1407 1407
 	{
1408 1408
 		// Get the original menus
1409 1409
 		$oMenuAdminModel = getAdminModel('menu');
1410 1410
 
1411 1411
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1412
-		if($target_item->menu_item_srl != $target_srl) return new BaseObject(-1,'msg_invalid_request');
1412
+		if ($target_item->menu_item_srl != $target_srl) return new BaseObject(-1, 'msg_invalid_request');
1413 1413
 		// Move the menu location(change the order menu appears)
1414
-		if($mode == 'move')
1414
+		if ($mode == 'move')
1415 1415
 		{
1416 1416
 			$args = new stdClass();
1417 1417
 			$args->parent_srl = $parent_srl;
1418 1418
 			$args->menu_srl = $menu_srl;
1419 1419
 
1420
-			if($source_srl)
1420
+			if ($source_srl)
1421 1421
 			{
1422 1422
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1423
-				if($source_item->menu_item_srl != $source_srl) return new BaseObject(-1,'msg_invalid_request');
1424
-				$args->listorder = $source_item->listorder-1;
1423
+				if ($source_item->menu_item_srl != $source_srl) return new BaseObject(-1, 'msg_invalid_request');
1424
+				$args->listorder = $source_item->listorder - 1;
1425 1425
 			}
1426 1426
 			else
1427 1427
 			{
1428 1428
 				$output = executeQuery('menu.getMaxListorder', $args);
1429
-				if(!$output->toBool()) return $output;
1430
-				$args->listorder = (int)$output->data->listorder;
1431
-				if(!$args->listorder) $args->listorder= 0;
1429
+				if (!$output->toBool()) return $output;
1430
+				$args->listorder = (int) $output->data->listorder;
1431
+				if (!$args->listorder) $args->listorder = 0;
1432 1432
 			}
1433 1433
 			$args->parent_srl = $parent_srl;
1434 1434
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1435
-			if(!$output->toBool()) return $output;
1435
+			if (!$output->toBool()) return $output;
1436 1436
 
1437 1437
 			$args->parent_srl = $parent_srl;
1438 1438
 			$args->menu_item_srl = $target_srl;
1439 1439
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1440
-			if(!$output->toBool()) return $output;
1440
+			if (!$output->toBool()) return $output;
1441 1441
 
1442 1442
 			//module's menu_srl move also
1443
-			if($isShortcut == 'N' && !empty($url))
1443
+			if ($isShortcut == 'N' && !empty($url))
1444 1444
 			{
1445 1445
 				$oModuleModel = getModel('module');
1446 1446
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1447
-				if($menu_srl != $moduleInfo->menu_srl)
1447
+				if ($menu_srl != $moduleInfo->menu_srl)
1448 1448
 				{
1449 1449
 					$moduleInfo->menu_srl = $menu_srl;
1450 1450
 					$oModuleController = getController('module');
@@ -1452,13 +1452,13 @@  discard block
 block discarded – undo
1452 1452
 				}
1453 1453
 
1454 1454
 				// change home menu cache file
1455
-				if($url == $this->homeModuleMid)
1455
+				if ($url == $this->homeModuleMid)
1456 1456
 				{
1457
-					if(file_exists($this->homeMenuCacheFile))
1457
+					if (file_exists($this->homeMenuCacheFile))
1458 1458
 					{
1459 1459
 						include($this->homeMenuCacheFile);
1460 1460
 					}
1461
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1461
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462 1462
 					{
1463 1463
 						$this->makeHomemenuCacheFile($menu_srl);
1464 1464
 					}
@@ -1466,13 +1466,13 @@  discard block
 block discarded – undo
1466 1466
 			}
1467 1467
 			// Add a child
1468 1468
 		}
1469
-		elseif($mode == 'insert')
1469
+		elseif ($mode == 'insert')
1470 1470
 		{
1471 1471
 			$args->menu_item_srl = $target_srl;
1472 1472
 			$args->parent_srl = $parent_srl;
1473
-			$args->listorder = -1*getNextSequence();
1473
+			$args->listorder = -1 * getNextSequence();
1474 1474
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1475
-			if(!$output->toBool()) return $output;
1475
+			if (!$output->toBool()) return $output;
1476 1476
 		}
1477 1477
 
1478 1478
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 		// Re-generate the xml file
1498 1498
 		$xml_file = $this->makeXmlFile($menu_srl);
1499 1499
 		// Set return value
1500
-		$this->add('menu_title',$menu_title);
1501
-		$this->add('xml_file',$xml_file);
1500
+		$this->add('menu_title', $menu_title);
1501
+		$this->add('xml_file', $xml_file);
1502 1502
 	}
1503 1503
 
1504 1504
 	/**
@@ -1512,12 +1512,12 @@  discard block
 block discarded – undo
1512 1512
 		$target = Context::get('target');
1513 1513
 		$target_file = Context::get($target);
1514 1514
 		// Error occurs when the target is neither a uploaded file nor a valid file
1515
-		if(!$menu_srl || !$menu_item_srl)
1515
+		if (!$menu_srl || !$menu_item_srl)
1516 1516
 		{
1517 1517
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1518 1518
 
1519 1519
 		}
1520
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1520
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1521 1521
 		{
1522 1522
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1523 1523
 		}
@@ -1525,13 +1525,13 @@  discard block
 block discarded – undo
1525 1525
 		// Move the file to a specific director if the uploaded file meets requirement
1526 1526
 		else
1527 1527
 		{
1528
-			$tmp_arr = explode('.',$target_file['name']);
1529
-			$ext = $tmp_arr[count($tmp_arr)-1];
1528
+			$tmp_arr = explode('.', $target_file['name']);
1529
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1530 1530
 
1531 1531
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1532 1532
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1533 1533
 
1534
-			if(!is_dir($path)) FileHandler::makeDir($path);
1534
+			if (!is_dir($path)) FileHandler::makeDir($path);
1535 1535
 
1536 1536
 			move_uploaded_file($target_file['tmp_name'], $filename);
1537 1537
 			Context::set('filename', $filename);
@@ -1564,14 +1564,14 @@  discard block
 block discarded – undo
1564 1564
 	{
1565 1565
 		$oModuleModel = getModel('module');
1566 1566
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1567
-		if(is_array($installed_module_list))
1567
+		if (is_array($installed_module_list))
1568 1568
 		{
1569 1569
 			$currentLang = Context::getLangType();
1570 1570
 			$menuList = array();
1571
-			foreach($installed_module_list AS $key=>$value)
1571
+			foreach ($installed_module_list AS $key=>$value)
1572 1572
 			{
1573 1573
 				$info = $oModuleModel->getModuleActionXml($value->module);
1574
-				if($info->menu) $menuList[$value->module] = $info->menu;
1574
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1575 1575
 				unset($info->menu);
1576 1576
 			}
1577 1577
 		}
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1604 1604
 
1605 1605
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1606
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1606
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1608 1608
 		$dbInfo = Context::getDBInfo();
1609 1609
 
1610 1610
 		$args = new stdClass();
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 		$args->menu_srl = $requestArgs->menu_srl;
1614 1614
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1615 1615
 		//if now page is https...
1616
-		if(strpos($url, 'https') !== false)
1616
+		if (strpos($url, 'https') !== false)
1617 1617
 		{
1618 1618
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619 1619
 		}
@@ -1627,23 +1627,23 @@  discard block
 block discarded – undo
1627 1627
 		$args->hover_btn = '';
1628 1628
 		$args->active_btn = '';
1629 1629
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1630
-		$args->listorder = -1*$args->menu_item_srl;
1630
+		$args->listorder = -1 * $args->menu_item_srl;
1631 1631
 
1632 1632
 		// Check if already exists
1633 1633
 		$oMenuModel = getAdminModel('menu');
1634 1634
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1635 1635
 		// Update if exists
1636
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1636
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1637 1637
 		{
1638 1638
 			$output = $this->_updateMenuItem($args);
1639
-			if(!$output->toBool()) return $output;
1639
+			if (!$output->toBool()) return $output;
1640 1640
 		}
1641 1641
 		// Insert if not exist
1642 1642
 		else
1643 1643
 		{
1644
-			$args->listorder = -1*$args->menu_item_srl;
1644
+			$args->listorder = -1 * $args->menu_item_srl;
1645 1645
 			$output = executeQuery('menu.insertMenuItem', $args);
1646
-			if(!$output->toBool()) return $output;
1646
+			if (!$output->toBool()) return $output;
1647 1647
 		}
1648 1648
 		// Get information of the menu
1649 1649
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1671,23 +1671,23 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
 		// Menu Exposure update
1673 1673
 		// if exposure target is only login user...
1674
-		if(!$exposure)
1674
+		if (!$exposure)
1675 1675
 		{
1676 1676
 			$args->group_srls = '';
1677 1677
 		}
1678 1678
 		else
1679 1679
 		{
1680 1680
 			$exposure = explode(',', $exposure);
1681
-			if(in_array($exposure, array('-1','-3')))
1681
+			if (in_array($exposure, array('-1', '-3')))
1682 1682
 			{
1683 1683
 				$args->group_srls = $exposure;
1684 1684
 			}
1685 1685
 
1686
-			if($exposure) $args->group_srls = implode(',', $exposure);
1686
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1687 1687
 		}
1688 1688
 
1689 1689
 		$output = $this->_updateMenuItem($args);
1690
-		if(!$output->toBool())
1690
+		if (!$output->toBool())
1691 1691
 		{
1692 1692
 			return $output;
1693 1693
 		}
@@ -1701,21 +1701,21 @@  discard block
 block discarded – undo
1701 1701
 		$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
1702 1702
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1703 1703
 
1704
-		if($itemInfo->is_shortcut === 'Y')
1704
+		if ($itemInfo->is_shortcut === 'Y')
1705 1705
 		{
1706 1706
 			$moduleGrnatsArgs = new stdClass;
1707 1707
 			$moduleGrnatsArgs->module_srl = $moduleInfo->module_srl;
1708 1708
 			$output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs);
1709
-			if(!$output->data) $output->data = array();
1709
+			if (!$output->data) $output->data = array();
1710 1710
 			$moduleGrnats = new stdClass();
1711
-			foreach($output->data as $grant)
1711
+			foreach ($output->data as $grant)
1712 1712
 			{
1713 1713
 				$moduleGrnats->{$grant->name}[] = $grant->group_srl;
1714 1714
 			}
1715 1715
 		}
1716 1716
 
1717 1717
 		$grantList = $xml_info->grant;
1718
-		if(!$grantList) $grantList = new stdClass;
1718
+		if (!$grantList) $grantList = new stdClass;
1719 1719
 
1720 1720
 		$grantList->access = new stdClass();
1721 1721
 		$grantList->access->default = 'guest';
@@ -1723,14 +1723,14 @@  discard block
 block discarded – undo
1723 1723
 		$grantList->manager->default = 'manager';
1724 1724
 
1725 1725
 		$grant = new stdClass();
1726
-		foreach($grantList AS $grantName=>$grantInfo)
1726
+		foreach ($grantList AS $grantName=>$grantInfo)
1727 1727
 		{
1728
-			if($htPerm[$grantName])
1728
+			if ($htPerm[$grantName])
1729 1729
 			{
1730 1730
 				$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1731 1731
 
1732 1732
 				// users in a particular group
1733
-				if(is_array($htPerm[$grantName]))
1733
+				if (is_array($htPerm[$grantName]))
1734 1734
 				{
1735 1735
 					$grant->{$grantName} = $htPerm[$grantName];
1736 1736
 					continue;
@@ -1742,13 +1742,13 @@  discard block
 block discarded – undo
1742 1742
 					continue;
1743 1743
 				}
1744 1744
 			}
1745
-			else if($itemInfo->is_shortcut === 'Y')
1745
+			else if ($itemInfo->is_shortcut === 'Y')
1746 1746
 			{
1747
-				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1747
+				if (isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1748 1748
 			}
1749 1749
 		}
1750 1750
 
1751
-		if(count($grant))
1751
+		if (count($grant))
1752 1752
 		{
1753 1753
 			$oModuleController = getController('module');
1754 1754
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 	function makeXmlFile($menu_srl)
1767 1767
 	{
1768 1768
 		// Return if there is no information when creating the xml file
1769
-		if(!$menu_srl) return;
1769
+		if (!$menu_srl) return;
1770 1770
 		// Get menu informaton
1771 1771
 		$args = new stdClass();
1772 1772
 		$args->menu_srl = $menu_srl;
1773 1773
 		$output = executeQuery('menu.getMenu', $args);
1774
-		if(!$output->toBool() || !$output->data) return $output;
1775
-		$site_srl = (int)$output->data->site_srl;
1774
+		if (!$output->toBool() || !$output->data) return $output;
1775
+		$site_srl = (int) $output->data->site_srl;
1776 1776
 
1777
-		if($site_srl)
1777
+		if ($site_srl)
1778 1778
 		{
1779 1779
 			$oModuleModel = getModel('module');
1780 1780
 			$columnList = array('sites.domain');
@@ -1785,13 +1785,13 @@  discard block
 block discarded – undo
1785 1785
 		$args->menu_srl = $menu_srl;
1786 1786
 		$args->sort_index = 'listorder';
1787 1787
 		$output = executeQuery('menu.getMenuItems', $args);
1788
-		if(!$output->toBool()) return;
1788
+		if (!$output->toBool()) return;
1789 1789
 		// Specify the name of the cache file
1790
-		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1791
-		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1790
+		$xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl);
1791
+		$php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl);
1792 1792
 		// If no data found, generate an XML file without node data
1793 1793
 		$list = $output->data;
1794
-		if(!$list)
1794
+		if (!$list)
1795 1795
 		{
1796 1796
 			$xml_buff = "<root />";
1797 1797
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1799,10 +1799,10 @@  discard block
 block discarded – undo
1799 1799
 			return $xml_file;
1800 1800
 		}
1801 1801
 		// Change to an array if only a single data is obtained
1802
-		if(!is_array($list)) $list = array($list);
1802
+		if (!is_array($list)) $list = array($list);
1803 1803
 		// Create a tree for loop
1804 1804
 		$list_count = count($list);
1805
-		for($i=0;$i<$list_count;$i++)
1805
+		for ($i = 0; $i < $list_count; $i++)
1806 1806
 		{
1807 1807
 			$node = $list[$i];
1808 1808
 			$menu_item_srl = $node->menu_item_srl;
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
 		$php_buff = sprintf(
1859 1859
 			'<?php '.
1860 1860
 			'if(!defined("__XE__")) exit(); '.
1861
-			'$menu = new stdClass();' .
1861
+			'$menu = new stdClass();'.
1862 1862
 			'%s; '.
1863 1863
 			'%s; '.
1864 1864
 			'$menu->list = array(%s); '.
@@ -1887,26 +1887,26 @@  discard block
 block discarded – undo
1887 1887
 	 */
1888 1888
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1889 1889
 	{
1890
-		if(!$source_node) return;
1890
+		if (!$source_node) return;
1891 1891
 
1892 1892
 		$oMenuAdminModel = getAdminModel('menu');
1893 1893
 
1894
-		foreach($source_node as $menu_item_srl => $node)
1894
+		foreach ($source_node as $menu_item_srl => $node)
1895 1895
 		{
1896 1896
 			$child_buff = "";
1897 1897
 			// Get data of the child nodes
1898
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1898
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1899 1899
 			// List variables
1900 1900
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1901
-			foreach($names as $key => $val)
1901
+			foreach ($names as $key => $val)
1902 1902
 			{
1903
-				$name_arr_str .= sprintf('"%s"=>%s,',$key, var_export($val, true));
1903
+				$name_arr_str .= sprintf('"%s"=>%s,', $key, var_export($val, true));
1904 1904
 			}
1905 1905
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1906 1906
 
1907
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1908
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1909
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1907
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1908
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1909
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1910 1910
 			{
1911 1911
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1912 1912
 			}
@@ -1916,21 +1916,21 @@  discard block
 block discarded – undo
1916 1916
 			$expand = ($node->expand) ? $node->expand : '';
1917 1917
 
1918 1918
 			$normal_btn = ($node->normal_btn) ? $node->normal_btn : '';
1919
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1919
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1920 1920
 			else $normal_btn = '';
1921 1921
 			$hover_btn = ($node->hover_btn) ? $node->hover_btn : '';
1922
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1922
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1923 1923
 			else $hover_btn = '';
1924 1924
 			$active_btn = ($node->active_btn) ? $node->active_btn : '';
1925
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1925
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1926 1926
 			else $active_btn = '';
1927 1927
 
1928 1928
 			$group_srls = ($node->group_srls) ? $node->group_srls : '';
1929 1929
 
1930
-			if($normal_btn)
1930
+			if ($normal_btn)
1931 1931
 			{
1932
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1932
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1934 1934
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1935 1935
 			}
1936 1936
 			else
@@ -1939,8 +1939,8 @@  discard block
 block discarded – undo
1939 1939
 			}
1940 1940
 
1941 1941
 			// If the value of node->group_srls exists
1942
-			if($group_srls) {
1943
-				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1942
+			if ($group_srls) {
1943
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1944 1944
 			}
1945 1945
 			else
1946 1946
 			{
@@ -1969,8 +1969,8 @@  discard block
 block discarded – undo
1969 1969
 				$link
1970 1970
 			);
1971 1971
 
1972
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1973
-			else $buff .=  sprintf('<node %s />', $attribute);
1972
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1973
+			else $buff .= sprintf('<node %s />', $attribute);
1974 1974
 		}
1975 1975
 		return $buff;
1976 1976
 	}
@@ -1989,84 +1989,84 @@  discard block
 block discarded – undo
1989 1989
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1990 1990
 	{
1991 1991
 		$output = array("buff"=>"", "url_list"=>array());
1992
-		if(!$source_node) return $output;
1992
+		if (!$source_node) return $output;
1993 1993
 
1994 1994
 		$oMenuAdminModel = getAdminModel('menu');
1995 1995
 
1996
-		foreach($source_node as $menu_item_srl => $node)
1996
+		foreach ($source_node as $menu_item_srl => $node)
1997 1997
 		{
1998 1998
 			// Get data from child nodes if exist.
1999
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1999
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2000 2000
 			else $child_output = array("buff"=>"", "url_list"=>array());
2001 2001
 
2002 2002
 			// List variables
2003 2003
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
2004 2004
 			unset($name_arr_str);
2005
-			foreach($names as $key => $val)
2005
+			foreach ($names as $key => $val)
2006 2006
 			{
2007
-				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]?[a-zA-Z_0-9]*)\'\]\}/', $val) === 1)
2007
+				if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]?[a-zA-Z_0-9]*)\'\]\}/', $val) === 1)
2008 2008
 				{
2009 2009
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2010 2010
 				}
2011 2011
 				else
2012 2012
 				{
2013
-					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2013
+					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), removeHackTag($val)));
2014 2014
 				}
2015 2015
 			}
2016 2016
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2017 2017
 
2018 2018
 			// If url value is not empty in the current node, put the value into an array url_list
2019
-			if($node->url) $child_output['url_list'][] = $node->url;
2019
+			if ($node->url) $child_output['url_list'][] = $node->url;
2020 2020
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2021 2021
 			// If node->group_srls value exists
2022
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2022
+			if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0);
2023 2023
 			else $group_check_code = "true";
2024 2024
 
2025 2025
 			// List variables
2026
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2027
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2028
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2029
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2026
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2027
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2028
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2029
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2030 2030
 			{
2031 2031
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2032 2032
 			}
2033 2033
 			else $href = var_export($url, true);
2034 2034
 			$is_shortcut = $node->is_shortcut;
2035 2035
 			$open_window = $node->open_window;
2036
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2037
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2038
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2036
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2037
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2038
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2039 2039
 
2040
-			foreach($child_output['url_list'] as $key =>$val)
2040
+			foreach ($child_output['url_list'] as $key =>$val)
2041 2041
 			{
2042 2042
 				$child_output['url_list'][$key] = addslashes($val);
2043 2043
 			}
2044 2044
 
2045
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2045
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2046 2046
 			$child_buff = $child_output['buff'];
2047 2047
 			$expand = $node->expand;
2048 2048
 
2049 2049
 			$normal_btn = $node->normal_btn;
2050
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2050
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2051 2051
 			else $normal_btn = '';
2052 2052
 
2053 2053
 			$hover_btn = $node->hover_btn;
2054
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2054
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2055 2055
 			else $hover_btn = '';
2056 2056
 
2057 2057
 			$active_btn = $node->active_btn;
2058
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2058
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2059 2059
 			else $active_btn = '';
2060 2060
 
2061 2061
 
2062 2062
 			$group_srls = $node->group_srls;
2063 2063
 
2064
-			if($normal_btn)
2064
+			if ($normal_btn)
2065 2065
 			{
2066
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2067
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2066
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2067
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2068 2068
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2069
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2069
+				if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2070 2070
 				else $link_active = $link;
2071 2071
 			}
2072 2072
 			else
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 			);
2105 2105
 
2106 2106
 			// Generate buff data
2107
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2107
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2108 2108
 			$output['name'] .= $name_str;
2109 2109
 		}
2110 2110
 		return $output;
@@ -2118,19 +2118,19 @@  discard block
 block discarded – undo
2118 2118
 	 */
2119 2119
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2120 2120
 	{
2121
-		if(!count($menu_srl_list)) return;
2121
+		if (!count($menu_srl_list)) return;
2122 2122
 		// Delete the value of menu_srls
2123
-		$args->menu_srls = implode(',',$menu_srl_list);
2123
+		$args->menu_srls = implode(',', $menu_srl_list);
2124 2124
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2125
-		if(!$output->toBool()) return $output;
2125
+		if (!$output->toBool()) return $output;
2126 2126
 
2127 2127
 		$args->layout_srl = $layout_srl;
2128 2128
 		// Mapping menu_srls, layout_srl
2129
-		for($i=0;$i<count($menu_srl_list);$i++)
2129
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2130 2130
 		{
2131 2131
 			$args->menu_srl = $menu_srl_list[$i];
2132 2132
 			$output = executeQuery('menu.insertMenuLayout', $args);
2133
-			if(!$output->toBool()) return $output;
2133
+			if (!$output->toBool()) return $output;
2134 2134
 		}
2135 2135
 	}
2136 2136
 
@@ -2143,47 +2143,47 @@  discard block
 block discarded – undo
2143 2143
 	{
2144 2144
 		// path setting
2145 2145
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2146
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2146
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2147 2147
 		{
2148 2148
 			FileHandler::makeDir($path);
2149 2149
 		}
2150 2150
 
2151
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2151
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2152 2152
 		{
2153 2153
 			$oMenuModel = getAdminModel('menu');
2154 2154
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2155 2155
 
2156
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2157
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2158
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2156
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2157
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2158
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2159 2159
 		}
2160 2160
 
2161 2161
 		$returnArray = array();
2162 2162
 		$date = date('YmdHis');
2163 2163
 		// normal button
2164
-		if($args->menu_normal_btn)
2164
+		if ($args->menu_normal_btn)
2165 2165
 		{
2166
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2167
-			$ext = $tmp_arr[count($tmp_arr)-1];
2166
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2167
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2168 2168
 
2169 2169
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2170 2170
 
2171
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2171
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2172 2172
 			{
2173
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2173
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2174 2174
 				$returnArray ['normal_btn'] = $filename;
2175 2175
 			}
2176 2176
 		}
2177 2177
 
2178 2178
 		// hover button
2179
-		if($args->menu_hover_btn)
2179
+		if ($args->menu_hover_btn)
2180 2180
 		{
2181
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2182
-			$ext = $tmp_arr[count($tmp_arr)-1];
2181
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2182
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2183 2183
 
2184 2184
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2185 2185
 
2186
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2186
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2187 2187
 			{
2188 2188
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2189 2189
 				$returnArray['hover_btn'] = $filename;
@@ -2191,14 +2191,14 @@  discard block
 block discarded – undo
2191 2191
 		}
2192 2192
 
2193 2193
 		// active button
2194
-		if($args->menu_active_btn)
2194
+		if ($args->menu_active_btn)
2195 2195
 		{
2196
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2197
-			$ext = $tmp_arr[count($tmp_arr)-1];
2196
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2197
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2198 2198
 
2199 2199
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2200 2200
 
2201
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2201
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2202 2202
 			{
2203 2203
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2204 2204
 				$returnArray['active_btn'] = $filename;
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
 			"active_btn"=>"",
2221 2221
 		);
2222 2222
 		//normal_btn
2223
-		if($menuItemInfo->normal_btn)
2223
+		if ($menuItemInfo->normal_btn)
2224 2224
 		{
2225 2225
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2226 2226
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
 		}
2231 2231
 
2232 2232
 		//hover_btn
2233
-		if($menuItemInfo->hover_btn)
2233
+		if ($menuItemInfo->hover_btn)
2234 2234
 		{
2235 2235
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2236 2236
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 		}
2241 2241
 
2242 2242
 		//active_btn
2243
-		if($menuItemInfo->active_btn)
2243
+		if ($menuItemInfo->active_btn)
2244 2244
 		{
2245 2245
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2246 2246
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2255,9 +2255,9 @@  discard block
 block discarded – undo
2255 2255
 	{
2256 2256
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2257 2257
 		$tmp_arr = explode('.', $buttonPath);
2258
-		$ext = $tmp_arr[count($tmp_arr)-1];
2258
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2259 2259
 		$date = date("YmdHis");
2260
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2260
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2261 2261
 	}
2262 2262
 
2263 2263
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +300 added lines, -134 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71 71
 		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
72
+		if(!$output->toBool()) {
73
+			return $output;
74
+		}
73 75
 
74 76
 		$this->add('menu_srl', $output->get('menuSrl'));
75 77
 		$this->setMessage('success_registed');
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 151
 				$oModuleController = getController('module');
150 152
 				$oModuleController->updateModuleConfig('menu', $moduleConfig);
151
-			}
152
-			else
153
+			} else
153 154
 			{
154 155
 				return false;
155 156
 			}
@@ -186,8 +187,7 @@  discard block
 block discarded – undo
186 187
 			if($output->toBool() && $output->data)
187 188
 			{
188 189
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189
-			}
190
-			else
190
+			} else
191 191
 			{
192 192
 				// create menu item.
193 193
 				$item_args->menu_srl = $menuSrl;
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if(!$output->toBool()) {
239
+			return $output;
240
+		}
239 241
 
240 242
 		$this->setMessage('success_registed');
241 243
 
@@ -255,8 +257,9 @@  discard block
 block discarded – undo
255 257
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 258
 
257 259
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
259
-			return new BaseObject(-1, 'msg_adminmenu_cannot_delete');
260
+		if($menuInfo->title == $oAdmin->getAdminMenuName()) {
261
+					return new BaseObject(-1, 'msg_adminmenu_cannot_delete');
262
+		}
260 263
 
261 264
 		// get menu properies with child menu
262 265
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
@@ -280,8 +283,9 @@  discard block
 block discarded – undo
280 283
 				$originMenu = $value;
281 284
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 285
 
283
-				if($isStartmenuInclude)
284
-					break;
286
+				if($isStartmenuInclude) {
287
+									break;
288
+				}
285 289
 			}
286 290
 		}
287 291
 
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
 			foreach($cache_list as $cache_file)
367 371
 			{
368 372
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
373
+				if($pos>0) {
374
+					FileHandler::removeFile($cache_file);
375
+				}
370 376
 			}
371 377
 		}
372 378
 		// Delete images of menu buttons
@@ -405,8 +411,7 @@  discard block
 block discarded – undo
405 411
 		if($request->is_shortcut == 'Y')
406 412
 		{
407 413
 			$result = $this->_insertShortcut($request);
408
-		}
409
-		else
414
+		} else
410 415
 		{
411 416
 			$result = $this->_insertMenu($request, $isProc);
412 417
 		}
@@ -464,12 +469,21 @@  discard block
 block discarded – undo
464 469
 			$args->is_shortcut = $request->is_shortcut;
465 470
 			$args->url = $request->shortcut_target;
466 471
 
467
-			if(!$args->open_window) $args->open_window = 'N';
468
-			if(!$args->expand) $args->expand = 'N';
469
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
472
+			if(!$args->open_window) {
473
+				$args->open_window = 'N';
474
+			}
475
+			if(!$args->expand) {
476
+				$args->expand = 'N';
477
+			}
478
+			if(!$args->is_shortcut) {
479
+				$args->is_shortcut = 'Y';
480
+			}
470 481
 
471
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
-			else $args->name = $request->menu_name;
482
+			if($request->menu_name_key) {
483
+				$args->name = $request->menu_name_key;
484
+			} else {
485
+				$args->name = $request->menu_name;
486
+			}
473 487
 		}
474 488
 		// type is module short cut
475 489
 		else if(is_numeric($request->shortcut_target))
@@ -504,13 +518,18 @@  discard block
 block discarded – undo
504 518
 			$args->url = '#';
505 519
 		}
506 520
 
507
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
-		else $args->desc = '';
521
+		if($request->menu_desc) {
522
+			$args->desc = $request->menu_desc;
523
+		} else {
524
+			$args->desc = '';
525
+		}
509 526
 
510 527
 		$args->menu_item_srl = getNextSequence();
511 528
 		$args->listorder = -1*$args->menu_item_srl;
512 529
 		$output = executeQuery('menu.insertMenuItem', $args);
513
-		if(!$output->toBool()) return $output;
530
+		if(!$output->toBool()) {
531
+			return $output;
532
+		}
514 533
 
515 534
 		$oDB->commit();
516 535
 
@@ -532,15 +551,27 @@  discard block
 block discarded – undo
532 551
 		$args->expand = $request->menu_expand;
533 552
 		$args->is_shortcut = $request->is_shortcut;
534 553
 
535
-		if(!$args->open_window) $args->open_window = 'N';
536
-		if(!$args->expand) $args->expand = 'N';
537
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
554
+		if(!$args->open_window) {
555
+			$args->open_window = 'N';
556
+		}
557
+		if(!$args->expand) {
558
+			$args->expand = 'N';
559
+		}
560
+		if(!$args->is_shortcut) {
561
+			$args->is_shortcut = 'N';
562
+		}
538 563
 
539
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
-		else $args->name = $request->menu_name;
564
+		if($request->menu_name_key) {
565
+			$args->name = $request->menu_name_key;
566
+		} else {
567
+			$args->name = $request->menu_name;
568
+		}
541 569
 
542
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
-		else $args->desc = '';
570
+		if($request->menu_desc) {
571
+			$args->desc = $request->menu_desc;
572
+		} else {
573
+			$args->desc = '';
574
+		}
544 575
 
545 576
 		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546 577
 		{
@@ -558,9 +589,15 @@  discard block
 block discarded – undo
558 589
 		}
559 590
 
560 591
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
561
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
-		if($request->active_btn) $args->active_btn = $request->active_btn;
592
+		if($request->normal_btn) {
593
+			$args->normal_btn = $request->normal_btn;
594
+		}
595
+		if($request->hover_btn) {
596
+			$args->hover_btn = $request->hover_btn;
597
+		}
598
+		if($request->active_btn) {
599
+			$args->active_btn = $request->active_btn;
600
+		}
564 601
 
565 602
 		if(!$request->module_id)
566 603
 		{
@@ -571,7 +608,9 @@  discard block
 block discarded – undo
571 608
 		$args->menu_item_srl = getNextSequence();
572 609
 		$args->listorder = -1*$args->menu_item_srl;
573 610
 		$output = executeQuery('menu.insertMenuItem', $args);
574
-		if(!$output->toBool()) return $output;
611
+		if(!$output->toBool()) {
612
+			return $output;
613
+		}
575 614
 
576 615
 		$oDB->commit();
577 616
 
@@ -652,8 +691,12 @@  discard block
 block discarded – undo
652 691
 		}
653 692
 
654 693
 		// variables set
655
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
694
+		if($request->menu_open_window != "Y") {
695
+			$request->menu_open_window = "N";
696
+		}
697
+		if($request->menu_expand != "Y") {
698
+			$request->menu_expand = "N";
699
+		}
657 700
 
658 701
 		// Get original information
659 702
 		$oMenuAdminModel = getAdminModel('menu');
@@ -680,13 +723,11 @@  discard block
 block discarded – undo
680 723
 
681 724
 				$args->url = $newItemInfo->url;
682 725
 				$args->is_shortcut = 'Y';
683
-			}
684
-			else
726
+			} else
685 727
 			{
686 728
 				$args->url = '#';
687 729
 			}
688
-		}
689
-		else
730
+		} else
690 731
 		{
691 732
 			// check already created module instance
692 733
 			$oModuleModel = getModel('module');
@@ -719,14 +760,16 @@  discard block
 block discarded – undo
719 760
 		if($request->menu_name_key)
720 761
 		{
721 762
 			$args->name = $request->menu_name_key;
722
-		}
723
-		else
763
+		} else
724 764
 		{
725 765
 			$args->name = $request->menu_name;
726 766
 		}
727 767
 
728
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
-		else $args->desc = '';
768
+		if($request->menu_desc) {
769
+			$args->desc = $request->menu_desc;
770
+		} else {
771
+			$args->desc = '';
772
+		}
730 773
 
731 774
 		unset($args->group_srls);
732 775
 		$args->open_window = $request->menu_open_window;
@@ -828,8 +871,7 @@  discard block
 block discarded – undo
828 871
 		{
829 872
 			$this->setError($returnObj->error);
830 873
 			$this->setMessage($returnObj->message);
831
-		}
832
-		else
874
+		} else
833 875
 		{
834 876
 			$this->setMessage('success_deleted');
835 877
 		}
@@ -856,7 +898,9 @@  discard block
 block discarded – undo
856 898
 		if($args->is_force != 'Y')
857 899
 		{
858 900
 			$output = executeQuery('menu.getChildMenuCount', $args);
859
-			if(!$output->toBool()) return $output;
901
+			if(!$output->toBool()) {
902
+				return $output;
903
+			}
860 904
 			if($output->data->count > 0)
861 905
 			{
862 906
 				return new BaseObject(-1001, 'msg_cannot_delete_for_child');
@@ -874,7 +918,9 @@  discard block
 block discarded – undo
874 918
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
875 919
 		}
876 920
 
877
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
921
+		if($itemInfo->parent_srl) {
922
+			$parent_srl = $itemInfo->parent_srl;
923
+		}
878 924
 
879 925
 		// get menu properies with child menu
880 926
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
@@ -948,9 +994,15 @@  discard block
 block discarded – undo
948 994
 		// Update the xml file and get its location
949 995
 		$xml_file = $this->makeXmlFile($args->menu_srl);
950 996
 		// Delete all of image buttons
951
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
997
+		if($node['normal_btn']) {
998
+			FileHandler::removeFile($node['normal_btn']);
999
+		}
1000
+		if($node['hover_btn']) {
1001
+			FileHandler::removeFile($node['hover_btn']);
1002
+		}
1003
+		if($node['active_btn']) {
1004
+			FileHandler::removeFile($node['active_btn']);
1005
+		}
954 1006
 
955 1007
 		// Delete module
956 1008
 		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
@@ -1017,7 +1069,9 @@  discard block
 block discarded – undo
1017 1069
 		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1018 1070
 		$target_srl = Context::get('target_srl');	// Self menu item serial number
1019 1071
 
1020
-		if(!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1,'msg_invalid_request');
1072
+		if(!$mode || !$parent_srl || !$target_srl) {
1073
+			return new BaseObject(-1,'msg_invalid_request');
1074
+		}
1021 1075
 
1022 1076
 		$oMenuAdminModel = getAdminModel('menu');
1023 1077
 
@@ -1181,8 +1235,11 @@  discard block
 block discarded – undo
1181 1235
 		// default argument setting
1182 1236
 		$args = new stdClass();
1183 1237
 		$args->menu_srl = $menuSrl;
1184
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
-		else $args->parent_srl = $parentSrl;
1238
+		if($parentSrl == 0) {
1239
+			$args->parent_srl = $menuSrl;
1240
+		} else {
1241
+			$args->parent_srl = $parentSrl;
1242
+		}
1186 1243
 		$args->menu_name_key = $originMenu['text'];
1187 1244
 		$args->menu_name = $originMenu['text'];
1188 1245
 		$args->menu_open_window = $originMenu['open_window'];
@@ -1275,8 +1332,11 @@  discard block
 block discarded – undo
1275 1332
 		for($i=0;$i<4;$i++)
1276 1333
 		{
1277 1334
 			$case = rand(0, 1);
1278
-			if($case) $doc = rand(65, 90);
1279
-			else $doc = rand(97, 122);
1335
+			if($case) {
1336
+				$doc = rand(65, 90);
1337
+			} else {
1338
+				$doc = rand(97, 122);
1339
+			}
1280 1340
 
1281 1341
 			$randomString .= chr($doc);
1282 1342
 		}
@@ -1299,15 +1359,21 @@  discard block
 block discarded – undo
1299 1359
 		// menu name update
1300 1360
 		$args->menu_srl = $this->menuSrl;
1301 1361
 		$output = executeQuery('menu.updateMenu', $args);
1302
-		if(!$output->toBool()) return $output;
1362
+		if(!$output->toBool()) {
1363
+			return $output;
1364
+		}
1303 1365
 
1304 1366
 		$this->map = array();
1305 1367
 		if(is_array($parentKeyList))
1306 1368
 		{
1307 1369
 			foreach($parentKeyList as $no=>$srl)
1308 1370
 			{
1309
-				if($srl === 0) continue;
1310
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1371
+				if($srl === 0) {
1372
+					continue;
1373
+				}
1374
+				if(!is_array($this->map[$srl])) {
1375
+					$this->map[$srl] = array();
1376
+				}
1311 1377
 				$this->map[$srl][] = $no;
1312 1378
 			}
1313 1379
 		}
@@ -1409,7 +1475,9 @@  discard block
 block discarded – undo
1409 1475
 		$oMenuAdminModel = getAdminModel('menu');
1410 1476
 
1411 1477
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1412
-		if($target_item->menu_item_srl != $target_srl) return new BaseObject(-1,'msg_invalid_request');
1478
+		if($target_item->menu_item_srl != $target_srl) {
1479
+			return new BaseObject(-1,'msg_invalid_request');
1480
+		}
1413 1481
 		// Move the menu location(change the order menu appears)
1414 1482
 		if($mode == 'move')
1415 1483
 		{
@@ -1420,24 +1488,33 @@  discard block
 block discarded – undo
1420 1488
 			if($source_srl)
1421 1489
 			{
1422 1490
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1423
-				if($source_item->menu_item_srl != $source_srl) return new BaseObject(-1,'msg_invalid_request');
1491
+				if($source_item->menu_item_srl != $source_srl) {
1492
+					return new BaseObject(-1,'msg_invalid_request');
1493
+				}
1424 1494
 				$args->listorder = $source_item->listorder-1;
1425
-			}
1426
-			else
1495
+			} else
1427 1496
 			{
1428 1497
 				$output = executeQuery('menu.getMaxListorder', $args);
1429
-				if(!$output->toBool()) return $output;
1498
+				if(!$output->toBool()) {
1499
+					return $output;
1500
+				}
1430 1501
 				$args->listorder = (int)$output->data->listorder;
1431
-				if(!$args->listorder) $args->listorder= 0;
1502
+				if(!$args->listorder) {
1503
+					$args->listorder= 0;
1504
+				}
1432 1505
 			}
1433 1506
 			$args->parent_srl = $parent_srl;
1434 1507
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1435
-			if(!$output->toBool()) return $output;
1508
+			if(!$output->toBool()) {
1509
+				return $output;
1510
+			}
1436 1511
 
1437 1512
 			$args->parent_srl = $parent_srl;
1438 1513
 			$args->menu_item_srl = $target_srl;
1439 1514
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1440
-			if(!$output->toBool()) return $output;
1515
+			if(!$output->toBool()) {
1516
+				return $output;
1517
+			}
1441 1518
 
1442 1519
 			//module's menu_srl move also
1443 1520
 			if($isShortcut == 'N' && !empty($url))
@@ -1465,14 +1542,15 @@  discard block
 block discarded – undo
1465 1542
 				}
1466 1543
 			}
1467 1544
 			// Add a child
1468
-		}
1469
-		elseif($mode == 'insert')
1545
+		} elseif($mode == 'insert')
1470 1546
 		{
1471 1547
 			$args->menu_item_srl = $target_srl;
1472 1548
 			$args->parent_srl = $parent_srl;
1473 1549
 			$args->listorder = -1*getNextSequence();
1474 1550
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1475
-			if(!$output->toBool()) return $output;
1551
+			if(!$output->toBool()) {
1552
+				return $output;
1553
+			}
1476 1554
 		}
1477 1555
 
1478 1556
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1516,8 +1594,7 @@  discard block
 block discarded – undo
1516 1594
 		{
1517 1595
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1518 1596
 
1519
-		}
1520
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1597
+		} else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521 1598
 		{
1522 1599
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1523 1600
 		}
@@ -1531,7 +1608,9 @@  discard block
 block discarded – undo
1531 1608
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1532 1609
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1533 1610
 
1534
-			if(!is_dir($path)) FileHandler::makeDir($path);
1611
+			if(!is_dir($path)) {
1612
+				FileHandler::makeDir($path);
1613
+			}
1535 1614
 
1536 1615
 			move_uploaded_file($target_file['tmp_name'], $filename);
1537 1616
 			Context::set('filename', $filename);
@@ -1571,7 +1650,9 @@  discard block
 block discarded – undo
1571 1650
 			foreach($installed_module_list AS $key=>$value)
1572 1651
 			{
1573 1652
 				$info = $oModuleModel->getModuleActionXml($value->module);
1574
-				if($info->menu) $menuList[$value->module] = $info->menu;
1653
+				if($info->menu) {
1654
+					$menuList[$value->module] = $info->menu;
1655
+				}
1575 1656
 				unset($info->menu);
1576 1657
 			}
1577 1658
 		}
@@ -1603,8 +1684,12 @@  discard block
 block discarded – undo
1603 1684
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1604 1685
 
1605 1686
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1606
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1687
+		if(empty($url)) {
1688
+			$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1689
+		}
1690
+		if(empty($url)) {
1691
+			$url = getNotEncodedFullUrl('', 'module', 'admin');
1692
+		}
1608 1693
 		$dbInfo = Context::getDBInfo();
1609 1694
 
1610 1695
 		$args = new stdClass();
@@ -1616,8 +1701,7 @@  discard block
 block discarded – undo
1616 1701
 		if(strpos($url, 'https') !== false)
1617 1702
 		{
1618 1703
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619
-		}
1620
-		else
1704
+		} else
1621 1705
 		{
1622 1706
 			$args->url = str_replace($dbInfo->default_url, '', $url);
1623 1707
 		}
@@ -1636,14 +1720,18 @@  discard block
 block discarded – undo
1636 1720
 		if($item_info->menu_item_srl == $args->menu_item_srl)
1637 1721
 		{
1638 1722
 			$output = $this->_updateMenuItem($args);
1639
-			if(!$output->toBool()) return $output;
1723
+			if(!$output->toBool()) {
1724
+				return $output;
1725
+			}
1640 1726
 		}
1641 1727
 		// Insert if not exist
1642 1728
 		else
1643 1729
 		{
1644 1730
 			$args->listorder = -1*$args->menu_item_srl;
1645 1731
 			$output = executeQuery('menu.insertMenuItem', $args);
1646
-			if(!$output->toBool()) return $output;
1732
+			if(!$output->toBool()) {
1733
+				return $output;
1734
+			}
1647 1735
 		}
1648 1736
 		// Get information of the menu
1649 1737
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1674,8 +1762,7 @@  discard block
 block discarded – undo
1674 1762
 		if(!$exposure)
1675 1763
 		{
1676 1764
 			$args->group_srls = '';
1677
-		}
1678
-		else
1765
+		} else
1679 1766
 		{
1680 1767
 			$exposure = explode(',', $exposure);
1681 1768
 			if(in_array($exposure, array('-1','-3')))
@@ -1683,7 +1770,9 @@  discard block
 block discarded – undo
1683 1770
 				$args->group_srls = $exposure;
1684 1771
 			}
1685 1772
 
1686
-			if($exposure) $args->group_srls = implode(',', $exposure);
1773
+			if($exposure) {
1774
+				$args->group_srls = implode(',', $exposure);
1775
+			}
1687 1776
 		}
1688 1777
 
1689 1778
 		$output = $this->_updateMenuItem($args);
@@ -1706,7 +1795,9 @@  discard block
 block discarded – undo
1706 1795
 			$moduleGrnatsArgs = new stdClass;
1707 1796
 			$moduleGrnatsArgs->module_srl = $moduleInfo->module_srl;
1708 1797
 			$output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs);
1709
-			if(!$output->data) $output->data = array();
1798
+			if(!$output->data) {
1799
+				$output->data = array();
1800
+			}
1710 1801
 			$moduleGrnats = new stdClass();
1711 1802
 			foreach($output->data as $grant)
1712 1803
 			{
@@ -1715,7 +1806,9 @@  discard block
 block discarded – undo
1715 1806
 		}
1716 1807
 
1717 1808
 		$grantList = $xml_info->grant;
1718
-		if(!$grantList) $grantList = new stdClass;
1809
+		if(!$grantList) {
1810
+			$grantList = new stdClass;
1811
+		}
1719 1812
 
1720 1813
 		$grantList->access = new stdClass();
1721 1814
 		$grantList->access->default = 'guest';
@@ -1741,10 +1834,11 @@  discard block
 block discarded – undo
1741 1834
 					$grant->{$grantName}[] = $htPerm[$grantName];
1742 1835
 					continue;
1743 1836
 				}
1744
-			}
1745
-			else if($itemInfo->is_shortcut === 'Y')
1837
+			} else if($itemInfo->is_shortcut === 'Y')
1746 1838
 			{
1747
-				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1839
+				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) {
1840
+					$grant->{$grantName} = $moduleGrnats->{$grantName};
1841
+				}
1748 1842
 			}
1749 1843
 		}
1750 1844
 
@@ -1766,12 +1860,16 @@  discard block
 block discarded – undo
1766 1860
 	function makeXmlFile($menu_srl)
1767 1861
 	{
1768 1862
 		// Return if there is no information when creating the xml file
1769
-		if(!$menu_srl) return;
1863
+		if(!$menu_srl) {
1864
+			return;
1865
+		}
1770 1866
 		// Get menu informaton
1771 1867
 		$args = new stdClass();
1772 1868
 		$args->menu_srl = $menu_srl;
1773 1869
 		$output = executeQuery('menu.getMenu', $args);
1774
-		if(!$output->toBool() || !$output->data) return $output;
1870
+		if(!$output->toBool() || !$output->data) {
1871
+			return $output;
1872
+		}
1775 1873
 		$site_srl = (int)$output->data->site_srl;
1776 1874
 
1777 1875
 		if($site_srl)
@@ -1785,7 +1883,9 @@  discard block
 block discarded – undo
1785 1883
 		$args->menu_srl = $menu_srl;
1786 1884
 		$args->sort_index = 'listorder';
1787 1885
 		$output = executeQuery('menu.getMenuItems', $args);
1788
-		if(!$output->toBool()) return;
1886
+		if(!$output->toBool()) {
1887
+			return;
1888
+		}
1789 1889
 		// Specify the name of the cache file
1790 1890
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1791 1891
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
@@ -1799,7 +1899,9 @@  discard block
 block discarded – undo
1799 1899
 			return $xml_file;
1800 1900
 		}
1801 1901
 		// Change to an array if only a single data is obtained
1802
-		if(!is_array($list)) $list = array($list);
1902
+		if(!is_array($list)) {
1903
+			$list = array($list);
1904
+		}
1803 1905
 		// Create a tree for loop
1804 1906
 		$list_count = count($list);
1805 1907
 		for($i=0;$i<$list_count;$i++)
@@ -1887,7 +1989,9 @@  discard block
 block discarded – undo
1887 1989
 	 */
1888 1990
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1889 1991
 	{
1890
-		if(!$source_node) return;
1992
+		if(!$source_node) {
1993
+			return;
1994
+		}
1891 1995
 
1892 1996
 		$oMenuAdminModel = getAdminModel('menu');
1893 1997
 
@@ -1895,7 +1999,9 @@  discard block
 block discarded – undo
1895 1999
 		{
1896 2000
 			$child_buff = "";
1897 2001
 			// Get data of the child nodes
1898
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
2002
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2003
+				$child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
2004
+			}
1899 2005
 			// List variables
1900 2006
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1901 2007
 			foreach($names as $key => $val)
@@ -1909,31 +2015,48 @@  discard block
 block discarded – undo
1909 2015
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1910 2016
 			{
1911 2017
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2018
+			} else {
2019
+				$href = var_export($url, true);
1912 2020
 			}
1913
-			else $href = var_export($url, true);
1914 2021
 			$is_shortcut = ($node->is_shortcut) ? $node->is_shortcut : '';
1915 2022
 			$open_window = ($node->open_window) ? $node->open_window : '';
1916 2023
 			$expand = ($node->expand) ? $node->expand : '';
1917 2024
 
1918 2025
 			$normal_btn = ($node->normal_btn) ? $node->normal_btn : '';
1919
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1920
-			else $normal_btn = '';
2026
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2027
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2028
+			} else {
2029
+				$normal_btn = '';
2030
+			}
1921 2031
 			$hover_btn = ($node->hover_btn) ? $node->hover_btn : '';
1922
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1923
-			else $hover_btn = '';
2032
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2033
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2034
+			} else {
2035
+				$hover_btn = '';
2036
+			}
1924 2037
 			$active_btn = ($node->active_btn) ? $node->active_btn : '';
1925
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1926
-			else $active_btn = '';
2038
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2039
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2040
+			} else {
2041
+				$active_btn = '';
2042
+			}
1927 2043
 
1928 2044
 			$group_srls = ($node->group_srls) ? $node->group_srls : '';
1929 2045
 
1930 2046
 			if($normal_btn)
1931 2047
 			{
1932
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
2048
+				if($hover_btn) {
2049
+					$hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn);
2050
+				} else {
2051
+					$hover_str = '';
2052
+				}
2053
+				if($active_btn) {
2054
+					$active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn);
2055
+				} else {
2056
+					$active_str = '';
2057
+				}
1934 2058
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1935
-			}
1936
-			else
2059
+			} else
1937 2060
 			{
1938 2061
 				$link = '<?php print $_names[$lang_type]; ?>';
1939 2062
 			}
@@ -1941,8 +2064,7 @@  discard block
 block discarded – undo
1941 2064
 			// If the value of node->group_srls exists
1942 2065
 			if($group_srls) {
1943 2066
 				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1944
-			}
1945
-			else
2067
+			} else
1946 2068
 			{
1947 2069
 				$group_check_code = "true";
1948 2070
 			}
@@ -1969,8 +2091,11 @@  discard block
 block discarded – undo
1969 2091
 				$link
1970 2092
 			);
1971 2093
 
1972
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1973
-			else $buff .=  sprintf('<node %s />', $attribute);
2094
+			if($child_buff) {
2095
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2096
+			} else {
2097
+				$buff .=  sprintf('<node %s />', $attribute);
2098
+			}
1974 2099
 		}
1975 2100
 		return $buff;
1976 2101
 	}
@@ -1989,15 +2114,20 @@  discard block
 block discarded – undo
1989 2114
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1990 2115
 	{
1991 2116
 		$output = array("buff"=>"", "url_list"=>array());
1992
-		if(!$source_node) return $output;
2117
+		if(!$source_node) {
2118
+			return $output;
2119
+		}
1993 2120
 
1994 2121
 		$oMenuAdminModel = getAdminModel('menu');
1995 2122
 
1996 2123
 		foreach($source_node as $menu_item_srl => $node)
1997 2124
 		{
1998 2125
 			// Get data from child nodes if exist.
1999
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2000
-			else $child_output = array("buff"=>"", "url_list"=>array());
2126
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2127
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2128
+			} else {
2129
+				$child_output = array("buff"=>"", "url_list"=>array());
2130
+			}
2001 2131
 
2002 2132
 			// List variables
2003 2133
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
@@ -2007,8 +2137,7 @@  discard block
 block discarded – undo
2007 2137
 				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]?[a-zA-Z_0-9]*)\'\]\}/', $val) === 1)
2008 2138
 				{
2009 2139
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2010
-				}
2011
-				else
2140
+				} else
2012 2141
 				{
2013 2142
 					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2014 2143
 				}
@@ -2016,11 +2145,16 @@  discard block
 block discarded – undo
2016 2145
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2017 2146
 
2018 2147
 			// If url value is not empty in the current node, put the value into an array url_list
2019
-			if($node->url) $child_output['url_list'][] = $node->url;
2148
+			if($node->url) {
2149
+				$child_output['url_list'][] = $node->url;
2150
+			}
2020 2151
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2021 2152
 			// If node->group_srls value exists
2022
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2023
-			else $group_check_code = "true";
2153
+			if($node->group_srls) {
2154
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2155
+			} else {
2156
+				$group_check_code = "true";
2157
+			}
2024 2158
 
2025 2159
 			// List variables
2026 2160
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
@@ -2029,8 +2163,9 @@  discard block
 block discarded – undo
2029 2163
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2030 2164
 			{
2031 2165
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2166
+			} else {
2167
+				$href = var_export($url, true);
2032 2168
 			}
2033
-			else $href = var_export($url, true);
2034 2169
 			$is_shortcut = $node->is_shortcut;
2035 2170
 			$open_window = $node->open_window;
2036 2171
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2047,29 +2182,48 @@  discard block
 block discarded – undo
2047 2182
 			$expand = $node->expand;
2048 2183
 
2049 2184
 			$normal_btn = $node->normal_btn;
2050
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2051
-			else $normal_btn = '';
2185
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2186
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2187
+			} else {
2188
+				$normal_btn = '';
2189
+			}
2052 2190
 
2053 2191
 			$hover_btn = $node->hover_btn;
2054
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2055
-			else $hover_btn = '';
2192
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2193
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2194
+			} else {
2195
+				$hover_btn = '';
2196
+			}
2056 2197
 
2057 2198
 			$active_btn = $node->active_btn;
2058
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2059
-			else $active_btn = '';
2199
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2200
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2201
+			} else {
2202
+				$active_btn = '';
2203
+			}
2060 2204
 
2061 2205
 
2062 2206
 			$group_srls = $node->group_srls;
2063 2207
 
2064 2208
 			if($normal_btn)
2065 2209
 			{
2066
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2067
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2210
+				if($hover_btn) {
2211
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2212
+				} else {
2213
+					$hover_str = '';
2214
+				}
2215
+				if($active_btn) {
2216
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2217
+				} else {
2218
+					$active_str = '';
2219
+				}
2068 2220
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2069
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2070
-				else $link_active = $link;
2071
-			}
2072
-			else
2221
+				if($active_btn) {
2222
+					$link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2223
+				} else {
2224
+					$link_active = $link;
2225
+				}
2226
+			} else
2073 2227
 			{
2074 2228
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2075 2229
 			}
@@ -2118,11 +2272,15 @@  discard block
 block discarded – undo
2118 2272
 	 */
2119 2273
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2120 2274
 	{
2121
-		if(!count($menu_srl_list)) return;
2275
+		if(!count($menu_srl_list)) {
2276
+			return;
2277
+		}
2122 2278
 		// Delete the value of menu_srls
2123 2279
 		$args->menu_srls = implode(',',$menu_srl_list);
2124 2280
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2125
-		if(!$output->toBool()) return $output;
2281
+		if(!$output->toBool()) {
2282
+			return $output;
2283
+		}
2126 2284
 
2127 2285
 		$args->layout_srl = $layout_srl;
2128 2286
 		// Mapping menu_srls, layout_srl
@@ -2130,7 +2288,9 @@  discard block
 block discarded – undo
2130 2288
 		{
2131 2289
 			$args->menu_srl = $menu_srl_list[$i];
2132 2290
 			$output = executeQuery('menu.insertMenuLayout', $args);
2133
-			if(!$output->toBool()) return $output;
2291
+			if(!$output->toBool()) {
2292
+				return $output;
2293
+			}
2134 2294
 		}
2135 2295
 	}
2136 2296
 
@@ -2153,9 +2313,15 @@  discard block
 block discarded – undo
2153 2313
 			$oMenuModel = getAdminModel('menu');
2154 2314
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2155 2315
 
2156
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2157
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2158
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2316
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2317
+				FileHandler::removeFile($itemInfo->normal_btn);
2318
+			}
2319
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2320
+				FileHandler::removeFile($itemInfo->hover_btn);
2321
+			}
2322
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2323
+				FileHandler::removeFile($itemInfo->active_btn);
2324
+			}
2159 2325
 		}
2160 2326
 
2161 2327
 		$returnArray = array();
Please login to merge, or discard this patch.