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 ( cdb4d0...5e2ff7 )
by gyeong-won
07:36
created
modules/document/document.controller.php 1 patch
Spacing   +367 added lines, -367 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	function procDocumentVoteUp()
26 26
 	{
27
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request');
27
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request');
28 28
 
29 29
 		$document_srl = Context::get('target_srl');
30
-		if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
30
+		if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
31 31
 
32 32
 		$oDocumentModel = getModel('document');
33 33
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
34 34
 		$module_srl = $oDocument->get('module_srl');
35
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
35
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
36 36
 
37 37
 		$oModuleModel = getModel('module');
38
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
39
-		if($document_config->use_vote_up=='N') return new BaseObject(-1, 'msg_invalid_request');
38
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
39
+		if ($document_config->use_vote_up == 'N') return new BaseObject(-1, 'msg_invalid_request');
40 40
 
41 41
 		$point = 1;
42 42
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -69,19 +69,19 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	function procDocumentVoteDown()
71 71
 	{
72
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request');
72
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request');
73 73
 
74 74
 		$document_srl = Context::get('target_srl');
75
-		if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
75
+		if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
76 76
 
77 77
 		$oDocumentModel = getModel('document');
78 78
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
79 79
 		$module_srl = $oDocument->get('module_srl');
80
-		if(!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
80
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
81 81
 
82 82
 		$oModuleModel = getModel('module');
83
-		$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
84
-		if($document_config->use_vote_down=='N') return new BaseObject(-1, 'msg_invalid_request');
83
+		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
84
+		if ($document_config->use_vote_down == 'N') return new BaseObject(-1, 'msg_invalid_request');
85 85
 
86 86
 		$point = -1;
87 87
 		$output = $this->updateVotedCount($document_srl, $point);
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function procDocumentDeclare()
97 97
 	{
98
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request');
98
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_invalid_request');
99 99
 
100 100
 		$document_srl = Context::get('target_srl');
101
-		if(!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
101
+		if (!$document_srl) return new BaseObject(-1, 'msg_invalid_request');
102 102
 
103 103
 		return $this->declaredDocument($document_srl);
104 104
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		$args->history_srl = $history_srl;
141 141
 		$args->module_srl = $module_srl;
142 142
 		$args->document_srl = $document_srl;
143
-		if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
143
+		if (!$args->history_srl && !$args->module_srl && !$args->document_srl) return;
144 144
 		executeQuery("document.deleteHistory", $args);
145 145
 	}
146 146
 
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	function triggerDeleteModuleDocuments(&$obj)
153 153
 	{
154 154
 		$module_srl = $obj->module_srl;
155
-		if(!$module_srl) return new BaseObject();
155
+		if (!$module_srl) return new BaseObject();
156 156
 		// Delete the document
157 157
 		$oDocumentAdminController = getAdminController('document');
158 158
 		$output = $oDocumentAdminController->deleteModuleDocument($module_srl);
159
-		if(!$output->toBool()) return $output;
159
+		if (!$output->toBool()) return $output;
160 160
 		// Delete the category
161 161
 		$oDocumentController = getController('document');
162 162
 		$output = $oDocumentController->deleteModuleCategory($module_srl);
163
-		if(!$output->toBool()) return $output;
163
+		if (!$output->toBool()) return $output;
164 164
 		// Delete extra key and variable, because module deleted
165 165
 		$this->deleteDocumentExtraKeys($module_srl);
166 166
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	function insertDocument($obj, $manual_inserted = false, $isRestore = false, $isLatest = true)
195 195
 	{
196
-		if(!$manual_inserted && !checkCSRF())
196
+		if (!$manual_inserted && !checkCSRF())
197 197
 		{
198 198
 			return new BaseObject(-1, 'msg_invalid_request');
199 199
 		}
@@ -202,32 +202,32 @@  discard block
 block discarded – undo
202 202
 		$oDB = &DB::getInstance();
203 203
 		$oDB->begin();
204 204
 		// List variables
205
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
206
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
207
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
208
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
209
-		if($obj->homepage) 
205
+		if ($obj->comment_status) $obj->commentStatus = $obj->comment_status;
206
+		if (!$obj->commentStatus) $obj->commentStatus = 'DENY';
207
+		if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
208
+		if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N';
209
+		if ($obj->homepage) 
210 210
 		{
211 211
 			$obj->homepage = removeHackTag($obj->homepage);
212
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
212
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
213 213
 			{
214 214
 				$obj->homepage = 'http://'.$obj->homepage;
215 215
 			}
216 216
 		}
217 217
 		
218
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
219
-		if(!$obj->email_address) $obj->email_address = '';
220
-		if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
218
+		if ($obj->notify_message != 'Y') $obj->notify_message = 'N';
219
+		if (!$obj->email_address) $obj->email_address = '';
220
+		if (!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR'];
221 221
 
222 222
                 // can modify regdate only manager
223 223
                 $grant = Context::get('grant');
224
-		if(!$grant->manager)
224
+		if (!$grant->manager)
225 225
 		{
226 226
 			unset($obj->regdate);
227 227
 		}
228 228
 		
229 229
 		// Serialize the $extra_vars, check the extra_vars type, because duplicate serialized avoid
230
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
230
+		if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
231 231
 		// Remove the columns for automatic saving
232 232
 		unset($obj->_saved_doc_srl);
233 233
 		unset($obj->_saved_doc_title);
@@ -235,34 +235,34 @@  discard block
 block discarded – undo
235 235
 		unset($obj->_saved_doc_message);
236 236
 		// Call a trigger (before)
237 237
 		$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 		// Register it if no given document_srl exists
240
-		if(!$obj->document_srl) $obj->document_srl = getNextSequence();
241
-		elseif(!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new BaseObject(-1, 'msg_not_permitted');
240
+		if (!$obj->document_srl) $obj->document_srl = getNextSequence();
241
+		elseif (!$manual_inserted && !$isRestore && !checkUserSequence($obj->document_srl)) return new BaseObject(-1, 'msg_not_permitted');
242 242
 
243 243
 		$oDocumentModel = getModel('document');
244 244
 		// Set to 0 if the category_srl doesn't exist
245
-		if($obj->category_srl)
245
+		if ($obj->category_srl)
246 246
 		{
247 247
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
248
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
248
+			if (count($category_list) > 0 && !$category_list[$obj->category_srl]->grant)
249 249
 			{
250 250
 				return new BaseObject(-1, 'msg_not_permitted');
251 251
 			}
252
-			if(count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
252
+			if (count($category_list) > 0 && !$category_list[$obj->category_srl]) $obj->category_srl = 0;
253 253
 		}
254 254
 		// Set the read counts and update order.
255
-		if(!$obj->readed_count) $obj->readed_count = 0;
256
-		if($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
255
+		if (!$obj->readed_count) $obj->readed_count = 0;
256
+		if ($isLatest) $obj->update_order = $obj->list_order = $obj->document_srl * -1;
257 257
 		else $obj->update_order = $obj->list_order;
258 258
 		// Check the status of password hash for manually inserting. Apply hashing for otherwise.
259
-		if($obj->password && !$obj->password_is_hashed)
259
+		if ($obj->password && !$obj->password_is_hashed)
260 260
 		{
261 261
 			$obj->password = getModel('member')->hashPassword($obj->password);
262 262
 		}
263 263
 		// Insert member's information only if the member is logged-in and not manually registered.
264 264
 		$logged_info = Context::get('logged_info');
265
-		if(Context::get('is_logged') && !$manual_inserted && !$isRestore)
265
+		if (Context::get('is_logged') && !$manual_inserted && !$isRestore)
266 266
 		{
267 267
 			$obj->member_srl = $logged_info->member_srl;
268 268
 
@@ -276,61 +276,61 @@  discard block
 block discarded – undo
276 276
 		// If the tile is empty, extract string from the contents.
277 277
 		$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
278 278
 		settype($obj->title, "string");
279
-		if($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))),20,'...');
279
+		if ($obj->title == '') $obj->title = cut_str(trim(strip_tags(nl2br($obj->content))), 20, '...');
280 280
 		// If no tile extracted from the contents, leave it untitled.
281
-		if($obj->title == '') $obj->title = 'Untitled';
281
+		if ($obj->title == '') $obj->title = 'Untitled';
282 282
 		// Remove XE's own tags from the contents.
283 283
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
284
-		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
284
+		if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
285 285
 		{
286
-			if($obj->use_html != 'Y')
286
+			if ($obj->use_html != 'Y')
287 287
 			{
288 288
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
289 289
 			}
290 290
 			$obj->content = nl2br($obj->content);
291 291
 		}
292 292
 		// Remove iframe and script if not a top adminisrator in the session.
293
-		if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
293
+		if ($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
294 294
 		// An error appears if both log-in info and user name don't exist.
295
-		if(!$logged_info->member_srl && !$obj->nick_name) return new BaseObject(-1,'msg_invalid_request');
295
+		if (!$logged_info->member_srl && !$obj->nick_name) return new BaseObject(-1, 'msg_invalid_request');
296 296
 
297 297
 		$obj->lang_code = Context::getLangType();
298 298
 		// Insert data into the DB
299
-		if(!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
299
+		if (!$obj->status) $this->_checkDocumentStatusForOldVersion($obj);
300 300
 		$output = executeQuery('document.insertDocument', $obj);
301
-		if(!$output->toBool())
301
+		if (!$output->toBool())
302 302
 		{
303 303
 			$oDB->rollback();
304 304
 			return $output;
305 305
 		}
306 306
 		// Insert extra variables if the document successfully inserted.
307 307
 		$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
308
-		if(count($extra_keys))
308
+		if (count($extra_keys))
309 309
 		{
310
-			foreach($extra_keys as $idx => $extra_item)
310
+			foreach ($extra_keys as $idx => $extra_item)
311 311
 			{
312 312
 				$value = NULL;
313
-				if(isset($obj->{'extra_vars'.$idx}))
313
+				if (isset($obj->{'extra_vars'.$idx}))
314 314
 				{
315 315
 					$tmp = $obj->{'extra_vars'.$idx};
316
-					if(is_array($tmp))
316
+					if (is_array($tmp))
317 317
 						$value = implode('|@|', $tmp);
318 318
 					else
319 319
 						$value = trim($tmp);
320 320
 				}
321
-				else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
322
-				if($value == NULL) continue;
321
+				else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
322
+				if ($value == NULL) continue;
323 323
 
324 324
 				$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
325 325
 			}
326 326
 		}
327 327
 		// Update the category if the category_srl exists.
328
-		if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
328
+		if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
329 329
 		// Call a trigger (after)
330
-		if($output->toBool())
330
+		if ($output->toBool())
331 331
 		{
332 332
 			$trigger_output = ModuleHandler::triggerCall('document.insertDocument', 'after', $obj);
333
-			if(!$trigger_output->toBool())
333
+			if (!$trigger_output->toBool())
334 334
 			{
335 335
 				$oDB->rollback();
336 336
 				return $trigger_output;
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 		$oDB->commit();
342 342
 
343 343
 		// return
344
-		if(!$manual_inserted)
344
+		if (!$manual_inserted)
345 345
 		{
346 346
 			$this->addGrant($obj->document_srl);
347 347
 		}
348
-		$output->add('document_srl',$obj->document_srl);
349
-		$output->add('category_srl',$obj->category_srl);
348
+		$output->add('document_srl', $obj->document_srl);
349
+		$output->add('category_srl', $obj->category_srl);
350 350
 
351 351
 		return $output;
352 352
 	}
@@ -362,41 +362,41 @@  discard block
 block discarded – undo
362 362
 	{
363 363
 		$logged_info = Context::get('logged_info');
364 364
 
365
-		if(!$manual_updated && !checkCSRF())
365
+		if (!$manual_updated && !checkCSRF())
366 366
 		{
367 367
 			return new BaseObject(-1, 'msg_invalid_request');
368 368
 		}
369 369
 
370
-		if(!$source_obj->document_srl || !$obj->document_srl) return new BaseObject(-1,'msg_invalied_request');
371
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
372
-		if(!$obj->status) $obj->status = 'PUBLIC';
370
+		if (!$source_obj->document_srl || !$obj->document_srl) return new BaseObject(-1, 'msg_invalied_request');
371
+		if (!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
372
+		if (!$obj->status) $obj->status = 'PUBLIC';
373 373
 
374 374
 		// Call a trigger (before)
375 375
 		$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj);
376
-		if(!$output->toBool()) return $output;
376
+		if (!$output->toBool()) return $output;
377 377
 
378 378
 		// begin transaction
379 379
 		$oDB = &DB::getInstance();
380 380
 		$oDB->begin();
381 381
 
382 382
 		$oModuleModel = getModel('module');
383
-		if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
383
+		if (!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl');
384 384
 		$module_srl = $obj->module_srl;
385 385
 		$document_config = $oModuleModel->getModulePartConfig('document', $module_srl);
386
-		if(!$document_config)
386
+		if (!$document_config)
387 387
 		{
388 388
 			$document_config = new stdClass();
389 389
 		}
390
-		if(!isset($document_config->use_history)) $document_config->use_history = 'N';
390
+		if (!isset($document_config->use_history)) $document_config->use_history = 'N';
391 391
 		$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace';
392 392
 
393
-		if($bUseHistory)
393
+		if ($bUseHistory)
394 394
 		{
395 395
 			$args = new stdClass;
396 396
 			$args->history_srl = getNextSequence();
397 397
 			$args->document_srl = $obj->document_srl;
398 398
 			$args->module_srl = $module_srl;
399
-			if($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
399
+			if ($document_config->use_history == 'Y') $args->content = $source_obj->get('content');
400 400
 			$args->nick_name = $source_obj->get('nick_name');
401 401
 			$args->member_srl = $source_obj->get('member_srl');
402 402
 			$args->regdate = $source_obj->get('last_update');
@@ -408,30 +408,30 @@  discard block
 block discarded – undo
408 408
 			$obj->ipaddress = $source_obj->get('ipaddress');
409 409
 		}
410 410
 		// List variables
411
-		if($obj->comment_status) $obj->commentStatus = $obj->comment_status;
412
-		if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
413
-		if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
414
-		if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
415
-		if($obj->homepage)
411
+		if ($obj->comment_status) $obj->commentStatus = $obj->comment_status;
412
+		if (!$obj->commentStatus) $obj->commentStatus = 'DENY';
413
+		if ($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion($obj);
414
+		if ($obj->allow_trackback != 'Y') $obj->allow_trackback = 'N';
415
+		if ($obj->homepage)
416 416
 		{
417 417
 			$obj->homepage = removeHackTag($obj->homepage);
418
-			if(!preg_match('/^[a-z]+:\/\//i',$obj->homepage))
418
+			if (!preg_match('/^[a-z]+:\/\//i', $obj->homepage))
419 419
 			{
420 420
 				$obj->homepage = 'http://'.$obj->homepage;
421 421
 			}
422 422
 		}
423 423
 		
424
-		if($obj->notify_message != 'Y') $obj->notify_message = 'N';
424
+		if ($obj->notify_message != 'Y') $obj->notify_message = 'N';
425 425
 		
426 426
 		// can modify regdate only manager
427 427
                 $grant = Context::get('grant');
428
-		if(!$grant->manager)
428
+		if (!$grant->manager)
429 429
 		{
430 430
 			unset($obj->regdate);
431 431
 		}
432 432
 		
433 433
 		// Serialize the $extra_vars
434
-		if(!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
434
+		if (!is_string($obj->extra_vars)) $obj->extra_vars = serialize($obj->extra_vars);
435 435
 		// Remove the columns for automatic saving
436 436
 		unset($obj->_saved_doc_srl);
437 437
 		unset($obj->_saved_doc_title);
@@ -440,23 +440,23 @@  discard block
 block discarded – undo
440 440
 
441 441
 		$oDocumentModel = getModel('document');
442 442
 		// Set the category_srl to 0 if the changed category is not exsiting.
443
-		if($source_obj->get('category_srl')!=$obj->category_srl)
443
+		if ($source_obj->get('category_srl') != $obj->category_srl)
444 444
 		{
445 445
 			$category_list = $oDocumentModel->getCategoryList($obj->module_srl);
446
-			if(!$category_list[$obj->category_srl]) $obj->category_srl = 0;
446
+			if (!$category_list[$obj->category_srl]) $obj->category_srl = 0;
447 447
 		}
448 448
 		// Change the update order
449 449
 		$obj->update_order = getNextSequence() * -1;
450 450
 		// Hash the password if it exists
451
-		if($obj->password)
451
+		if ($obj->password)
452 452
 		{
453 453
 			$obj->password = getModel('member')->hashPassword($obj->password);
454 454
 		}
455 455
 
456 456
 		// If an author is identical to the modifier or history is used, use the logged-in user's information.
457
-		if(Context::get('is_logged') && !$manual_updated)
457
+		if (Context::get('is_logged') && !$manual_updated)
458 458
 		{
459
-			if($source_obj->get('member_srl')==$logged_info->member_srl)
459
+			if ($source_obj->get('member_srl') == $logged_info->member_srl)
460 460
 			{
461 461
 				$obj->member_srl = $logged_info->member_srl;
462 462
 				$obj->user_name = htmlspecialchars_decode($logged_info->user_name);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		}
468 468
 
469 469
 		// For the document written by logged-in user however no nick_name exists
470
-		if($source_obj->get('member_srl')&& !$obj->nick_name)
470
+		if ($source_obj->get('member_srl') && !$obj->nick_name)
471 471
 		{
472 472
 			$obj->member_srl = $source_obj->get('member_srl');
473 473
 			$obj->user_name = $source_obj->get('user_name');
@@ -478,24 +478,24 @@  discard block
 block discarded – undo
478 478
 		// If the tile is empty, extract string from the contents.
479 479
 		$obj->title = htmlspecialchars($obj->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
480 480
 		settype($obj->title, "string");
481
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
481
+		if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...');
482 482
 		// If no tile extracted from the contents, leave it untitled.
483
-		if($obj->title == '') $obj->title = 'Untitled';
483
+		if ($obj->title == '') $obj->title = 'Untitled';
484 484
 		// Remove XE's own tags from the contents.
485 485
 		$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
486
-		if(Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
486
+		if (Mobile::isFromMobilePhone() && $obj->use_editor != 'Y')
487 487
 		{
488
-			if($obj->use_html != 'Y')
488
+			if ($obj->use_html != 'Y')
489 489
 			{
490 490
 				$obj->content = htmlspecialchars($obj->content, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
491 491
 			}
492 492
 			$obj->content = nl2br($obj->content);
493 493
 		}
494 494
 		// Change not extra vars but language code of the original document if document's lang_code is different from author's setting.
495
-		if($source_obj->get('lang_code') != Context::getLangType())
495
+		if ($source_obj->get('lang_code') != Context::getLangType())
496 496
 		{
497 497
 			// Change not extra vars but language code of the original document if document's lang_code doesn't exist.
498
-			if(!$source_obj->get('lang_code'))
498
+			if (!$source_obj->get('lang_code'))
499 499
 			{
500 500
 				$lang_code_args->document_srl = $source_obj->get('document_srl');
501 501
 				$lang_code_args->lang_code = Context::getLangType();
@@ -515,59 +515,59 @@  discard block
 block discarded – undo
515 515
 			}
516 516
 		}
517 517
 		// Remove iframe and script if not a top adminisrator in the session.
518
-		if($logged_info->is_admin != 'Y')
518
+		if ($logged_info->is_admin != 'Y')
519 519
 		{
520 520
 			$obj->content = removeHackTag($obj->content);
521 521
 		}
522 522
 		// if temporary document, regdate is now setting
523
-		if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
523
+		if ($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
524 524
 
525 525
 		// Insert data into the DB
526 526
 		$output = executeQuery('document.updateDocument', $obj);
527
-		if(!$output->toBool())
527
+		if (!$output->toBool())
528 528
 		{
529 529
 			$oDB->rollback();
530 530
 			return $output;
531 531
 		}
532 532
 		// Remove all extra variables
533
-		if(Context::get('act')!='procFileDelete')
533
+		if (Context::get('act') != 'procFileDelete')
534 534
 		{
535 535
 			$this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType());
536 536
 			// Insert extra variables if the document successfully inserted.
537 537
 			$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl);
538
-			if(count($extra_keys))
538
+			if (count($extra_keys))
539 539
 			{
540
-				foreach($extra_keys as $idx => $extra_item)
540
+				foreach ($extra_keys as $idx => $extra_item)
541 541
 				{
542 542
 					$value = NULL;
543
-					if(isset($obj->{'extra_vars'.$idx}))
543
+					if (isset($obj->{'extra_vars'.$idx}))
544 544
 					{
545 545
 						$tmp = $obj->{'extra_vars'.$idx};
546
-						if(is_array($tmp))
546
+						if (is_array($tmp))
547 547
 							$value = implode('|@|', $tmp);
548 548
 						else
549 549
 							$value = trim($tmp);
550 550
 					}
551
-					else if(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
552
-					if($value == NULL) continue;
551
+					else if (isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name});
552
+					if ($value == NULL) continue;
553 553
 					$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid);
554 554
 				}
555 555
 			}
556 556
 			// Inert extra vars for multi-language support of title and contents.
557
-			if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
558
-			if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
557
+			if ($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType());
558
+			if ($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType());
559 559
 		}
560 560
 		// Update the category if the category_srl exists.
561
-		if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
561
+		if ($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl)
562 562
 		{
563
-			if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
564
-			if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
563
+			if ($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl'));
564
+			if ($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl);
565 565
 		}
566 566
 		// Call a trigger (after)
567
-		if($output->toBool())
567
+		if ($output->toBool())
568 568
 		{
569 569
 			$trigger_output = ModuleHandler::triggerCall('document.updateDocument', 'after', $obj);
570
-			if(!$trigger_output->toBool())
570
+			if (!$trigger_output->toBool())
571 571
 			{
572 572
 				$oDB->rollback();
573 573
 				return $trigger_output;
@@ -577,15 +577,15 @@  discard block
 block discarded – undo
577 577
 		// commit
578 578
 		$oDB->commit();
579 579
 		// Remove the thumbnail file
580
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
580
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
581 581
 
582
-		$output->add('document_srl',$obj->document_srl);
582
+		$output->add('document_srl', $obj->document_srl);
583 583
 		//remove from cache
584 584
 		$oCacheHandler = CacheHandler::getInstance('object');
585
-		if($oCacheHandler->isSupport())
585
+		if ($oCacheHandler->isSupport())
586 586
 		{
587 587
 			//remove document item from cache
588
-			$cache_key = 'document_item:'. getNumberingPath($obj->document_srl) . $obj->document_srl;
588
+			$cache_key = 'document_item:'.getNumberingPath($obj->document_srl).$obj->document_srl;
589 589
 			$oCacheHandler->delete($cache_key);
590 590
 		}
591 591
 
@@ -606,33 +606,33 @@  discard block
 block discarded – undo
606 606
 		$trigger_obj = new stdClass();
607 607
 		$trigger_obj->document_srl = $document_srl;
608 608
 		$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
609
-		if(!$output->toBool()) return $output;
609
+		if (!$output->toBool()) return $output;
610 610
 
611 611
 		// begin transaction
612 612
 		$oDB = &DB::getInstance();
613 613
 		$oDB->begin();
614 614
 
615
-		if(!$isEmptyTrash)
615
+		if (!$isEmptyTrash)
616 616
 		{
617 617
 			// get model object of the document
618 618
 			$oDocumentModel = getModel('document');
619 619
 			// Check if the documnet exists
620 620
 			$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
621 621
 		}
622
-		else if($isEmptyTrash && $oDocument == null) return new BaseObject(-1, 'document is not exists');
622
+		else if ($isEmptyTrash && $oDocument == null) return new BaseObject(-1, 'document is not exists');
623 623
 
624
-		if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new BaseObject(-1, 'msg_invalid_document');
624
+		if (!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new BaseObject(-1, 'msg_invalid_document');
625 625
 		// Check if a permossion is granted
626
-		if(!$oDocument->isGranted()) return new BaseObject(-1, 'msg_not_permitted');
626
+		if (!$oDocument->isGranted()) return new BaseObject(-1, 'msg_not_permitted');
627 627
 
628 628
 		//if empty trash, document already deleted, therefore document not delete
629 629
 		$args = new stdClass();
630 630
 		$args->document_srl = $document_srl;
631
-		if(!$isEmptyTrash)
631
+		if (!$isEmptyTrash)
632 632
 		{
633 633
 			// Delete the document
634 634
 			$output = executeQuery('document.deleteDocument', $args);
635
-			if(!$output->toBool())
635
+			if (!$output->toBool())
636 636
 			{
637 637
 				$oDB->rollback();
638 638
 				return $output;
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
 		$this->deleteDocumentHistory(null, $document_srl, null);
645 645
 		// Update category information if the category_srl exists.
646
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
646
+		if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
647 647
 		// Delete a declared list
648 648
 		executeQuery('document.deleteDeclared', $args);
649 649
 		// Delete extra variable
@@ -651,11 +651,11 @@  discard block
 block discarded – undo
651 651
 
652 652
 		//this
653 653
 		// Call a trigger (after)
654
-		if($output->toBool())
654
+		if ($output->toBool())
655 655
 		{
656 656
 			$trigger_obj = $oDocument->getObjectVars();
657 657
 			$trigger_output = ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj);
658
-			if(!$trigger_output->toBool())
658
+			if (!$trigger_output->toBool())
659 659
 			{
660 660
 				$oDB->rollback();
661 661
 				return $trigger_output;
@@ -667,16 +667,16 @@  discard block
 block discarded – undo
667 667
 		$this->_deleteDocumentVotedLog($args);
668 668
 
669 669
 		// Remove the thumbnail file
670
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($document_srl, 3)));
670
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($document_srl, 3)));
671 671
 
672 672
 		// commit
673 673
 		$oDB->commit();
674 674
 
675 675
 		//remove from cache
676 676
 		$oCacheHandler = CacheHandler::getInstance('object');
677
-		if($oCacheHandler->isSupport())
677
+		if ($oCacheHandler->isSupport())
678 678
 		{
679
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
679
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
680 680
 			$oCacheHandler->delete($cache_key);
681 681
 		}
682 682
 
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	{
724 724
 		$trash_args = new stdClass();
725 725
 		// Get trash_srl if a given trash_srl doesn't exist
726
-		if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
726
+		if (!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
727 727
 		else $trash_args->trash_srl = $obj->trash_srl;
728 728
 		// Get its module_srl which the document belongs to
729 729
 		$oDocumentModel = getModel('document');
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
 		$trash_args->module_srl = $oDocument->get('module_srl');
733 733
 		$obj->module_srl = $oDocument->get('module_srl');
734 734
 		// Cannot throw data from the trash to the trash
735
-		if($trash_args->module_srl == 0) return false;
735
+		if ($trash_args->module_srl == 0) return false;
736 736
 		// Data setting
737 737
 		$trash_args->document_srl = $obj->document_srl;
738 738
 		$trash_args->description = $obj->description;
739 739
 		// Insert member's information only if the member is logged-in and not manually registered.
740
-		if(Context::get('is_logged')&&!$manual_inserted)
740
+		if (Context::get('is_logged') && !$manual_inserted)
741 741
 		{
742 742
 			$logged_info = Context::get('logged_info');
743 743
 			$trash_args->member_srl = $logged_info->member_srl;
@@ -773,14 +773,14 @@  discard block
 block discarded – undo
773 773
 
774 774
 		$oTrashAdminController = getAdminController('trash');
775 775
 		$output = $oTrashAdminController->insertTrash($oTrashVO);
776
-		if(!$output->toBool())
776
+		if (!$output->toBool())
777 777
 		{
778 778
 			$oDB->rollback();
779 779
 			return $output;
780 780
 		}
781 781
 
782 782
 		$output = executeQuery('document.deleteDocument', $trash_args);
783
-		if(!$output->toBool())
783
+		if (!$output->toBool())
784 784
 		{
785 785
 			$oDB->rollback();
786 786
 			return $output;
@@ -793,12 +793,12 @@  discard block
 block discarded – undo
793 793
 		  }*/
794 794
 
795 795
 		// update category
796
-		if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
796
+		if ($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'), $oDocument->get('category_srl'));
797 797
 
798 798
 		// remove thumbnails
799
-		FileHandler::removeDir(sprintf('files/thumbnails/%s',getNumberingPath($obj->document_srl, 3)));
799
+		FileHandler::removeDir(sprintf('files/thumbnails/%s', getNumberingPath($obj->document_srl, 3)));
800 800
 		// Set the attachment to be invalid state
801
-		if($oDocument->hasUploadedFiles())
801
+		if ($oDocument->hasUploadedFiles())
802 802
 		{
803 803
 			$args = new stdClass();
804 804
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -806,10 +806,10 @@  discard block
 block discarded – undo
806 806
 			executeQuery('file.updateFileValid', $args);
807 807
 		}
808 808
 		// Call a trigger (after)
809
-		if($output->toBool())
809
+		if ($output->toBool())
810 810
 		{
811 811
 			$trigger_output = ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj);
812
-			if(!$trigger_output->toBool())
812
+			if (!$trigger_output->toBool())
813 813
 			{
814 814
 				$oDB->rollback();
815 815
 				return $trigger_output;
@@ -821,9 +821,9 @@  discard block
 block discarded – undo
821 821
 
822 822
 		// Clear cache
823 823
 		$oCacheHandler = CacheHandler::getInstance('object');
824
-		if($oCacheHandler->isSupport())
824
+		if ($oCacheHandler->isSupport())
825 825
 		{
826
-			$cache_key = 'document_item:'. getNumberingPath($oDocument->document_srl) . $oDocument->document_srl;
826
+			$cache_key = 'document_item:'.getNumberingPath($oDocument->document_srl).$oDocument->document_srl;
827 827
 			$oCacheHandler->delete($cache_key);
828 828
 		}
829 829
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 	function updateReadedCount(&$oDocument)
839 839
 	{
840 840
 		// Pass if Crawler access
841
-		if(isCrawler()) return false;
841
+		if (isCrawler()) return false;
842 842
 		
843 843
 		$document_srl = $oDocument->document_srl;
844 844
 		$member_srl = $oDocument->get('member_srl');
@@ -846,19 +846,19 @@  discard block
 block discarded – undo
846 846
 
847 847
 		// Call a trigger when the read count is updated (before)
848 848
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
849
-		if(!$trigger_output->toBool()) return $trigger_output;
849
+		if (!$trigger_output->toBool()) return $trigger_output;
850 850
 
851 851
 		// Pass if read count is increaded on the session information
852
-		if($_SESSION['readed_document'][$document_srl]) return false;
852
+		if ($_SESSION['readed_document'][$document_srl]) return false;
853 853
 
854 854
 		// Pass if the author's IP address is as same as visitor's.
855
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
855
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
856 856
 		{
857 857
 			$_SESSION['readed_document'][$document_srl] = true;
858 858
 			return false;
859 859
 		}
860 860
 		// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user.
861
-		if($member_srl && $logged_info->member_srl == $member_srl)
861
+		if ($member_srl && $logged_info->member_srl == $member_srl)
862 862
 		{
863 863
 			$_SESSION['readed_document'][$document_srl] = true;
864 864
 			return false;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 
875 875
 		// Call a trigger when the read count is updated (after)
876 876
 		$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
877
-		if(!$trigger_output->toBool())
877
+		if (!$trigger_output->toBool())
878 878
 		{
879 879
 			$oDB->rollback();
880 880
 			return $trigger_output;
@@ -883,15 +883,15 @@  discard block
 block discarded – undo
883 883
 		$oDB->commit();
884 884
 
885 885
 		$oCacheHandler = CacheHandler::getInstance('object');
886
-		if($oCacheHandler->isSupport())
886
+		if ($oCacheHandler->isSupport())
887 887
 		{
888 888
 			//remove document item from cache
889
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
889
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
890 890
 			$oCacheHandler->delete($cache_key);
891 891
 		}
892 892
 
893 893
 		// Register session
894
-		if(!$_SESSION['banned_document'][$document_srl]) 
894
+		if (!$_SESSION['banned_document'][$document_srl]) 
895 895
 		{
896 896
 			$_SESSION['readed_document'][$document_srl] = true;
897 897
 		}
@@ -914,21 +914,21 @@  discard block
 block discarded – undo
914 914
 	 */
915 915
 	function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid)
916 916
 	{
917
-		if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new BaseObject(-1,'msg_invalid_request');
917
+		if (!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new BaseObject(-1, 'msg_invalid_request');
918 918
 
919 919
 		$obj = new stdClass();
920 920
 		$obj->module_srl = $module_srl;
921 921
 		$obj->var_idx = $var_idx;
922 922
 		$obj->var_name = $var_name;
923 923
 		$obj->var_type = $var_type;
924
-		$obj->var_is_required = $var_is_required=='Y'?'Y':'N';
925
-		$obj->var_search = $var_search=='Y'?'Y':'N';
924
+		$obj->var_is_required = $var_is_required == 'Y' ? 'Y' : 'N';
925
+		$obj->var_search = $var_search == 'Y' ? 'Y' : 'N';
926 926
 		$obj->var_default = $var_default;
927 927
 		$obj->var_desc = $var_desc;
928 928
 		$obj->eid = $eid;
929 929
 
930 930
 		$output = executeQuery('document.getDocumentExtraKeys', $obj);
931
-		if(!$output->data)
931
+		if (!$output->data)
932 932
 		{
933 933
 			$output = executeQuery('document.insertDocumentExtraKey', $obj);
934 934
 		}
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		}
941 941
 
942 942
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
943
-		if($oCacheHandler->isSupport())
943
+		if ($oCacheHandler->isSupport())
944 944
 		{
945 945
 			$object_key = 'module_document_extra_keys:'.$module_srl;
946 946
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -958,42 +958,42 @@  discard block
 block discarded – undo
958 958
 	 */
959 959
 	function deleteDocumentExtraKeys($module_srl, $var_idx = null)
960 960
 	{
961
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
961
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
962 962
 		$obj = new stdClass();
963 963
 		$obj->module_srl = $module_srl;
964
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
964
+		if (!is_null($var_idx)) $obj->var_idx = $var_idx;
965 965
 
966 966
 		$oDB = DB::getInstance();
967 967
 		$oDB->begin();
968 968
 
969 969
 		$output = $oDB->executeQuery('document.deleteDocumentExtraKeys', $obj);
970
-		if(!$output->toBool())
970
+		if (!$output->toBool())
971 971
 		{
972 972
 			$oDB->rollback();
973 973
 			return $output;
974 974
 		}
975 975
 
976
-		if($var_idx != NULL)
976
+		if ($var_idx != NULL)
977 977
 		{
978 978
 			$output = $oDB->executeQuery('document.updateDocumentExtraKeyIdxOrder', $obj);
979
-			if(!$output->toBool())
979
+			if (!$output->toBool())
980 980
 			{
981 981
 				$oDB->rollback();
982 982
 				return $output;
983 983
 			}
984 984
 		}
985 985
 
986
-		$output =  executeQuery('document.deleteDocumentExtraVars', $obj);
987
-		if(!$output->toBool())
986
+		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
987
+		if (!$output->toBool())
988 988
 		{
989 989
 			$oDB->rollback();
990 990
 			return $output;
991 991
 		}
992 992
 
993
-		if($var_idx != NULL)
993
+		if ($var_idx != NULL)
994 994
 		{
995 995
 			$output = $oDB->executeQuery('document.updateDocumentExtraVarIdxOrder', $obj);
996
-			if(!$output->toBool())
996
+			if (!$output->toBool())
997 997
 			{
998 998
 				$oDB->rollback();
999 999
 				return $output;
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 		$oDB->commit();
1004 1004
 
1005 1005
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
1006
-		if($oCacheHandler->isSupport())
1006
+		if ($oCacheHandler->isSupport())
1007 1007
 		{
1008 1008
 			$object_key = 'module_document_extra_keys:'.$module_srl;
1009 1009
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1025,8 +1025,8 @@  discard block
 block discarded – undo
1025 1025
 	 */
1026 1026
 	function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '')
1027 1027
 	{
1028
-		if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new BaseObject(-1,'msg_invalid_request');
1029
-		if(!$lang_code) $lang_code = Context::getLangType();
1028
+		if (!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new BaseObject(-1, 'msg_invalid_request');
1029
+		if (!$lang_code) $lang_code = Context::getLangType();
1030 1030
 
1031 1031
 		$obj = new stdClass;
1032 1032
 		$obj->module_srl = $module_srl;
@@ -1052,10 +1052,10 @@  discard block
 block discarded – undo
1052 1052
 	{
1053 1053
 		$obj = new stdClass();
1054 1054
 		$obj->module_srl = $module_srl;
1055
-		if(!is_null($document_srl)) $obj->document_srl = $document_srl;
1056
-		if(!is_null($var_idx)) $obj->var_idx = $var_idx;
1057
-		if(!is_null($lang_code)) $obj->lang_code = $lang_code;
1058
-		if(!is_null($eid)) $obj->eid = $eid;
1055
+		if (!is_null($document_srl)) $obj->document_srl = $document_srl;
1056
+		if (!is_null($var_idx)) $obj->var_idx = $var_idx;
1057
+		if (!is_null($lang_code)) $obj->lang_code = $lang_code;
1058
+		if (!is_null($eid)) $obj->eid = $eid;
1059 1059
 		$output = executeQuery('document.deleteDocumentExtraVars', $obj);
1060 1060
 		return $output;
1061 1061
 	}
@@ -1069,10 +1069,10 @@  discard block
 block discarded – undo
1069 1069
 	 */
1070 1070
 	function updateVotedCount($document_srl, $point = 1)
1071 1071
 	{
1072
-		if($point > 0) $failed_voted = 'failed_voted';
1072
+		if ($point > 0) $failed_voted = 'failed_voted';
1073 1073
 		else $failed_voted = 'failed_blamed';
1074 1074
 		// Return fail if session already has information about votes
1075
-		if($_SESSION['voted_document'][$document_srl])
1075
+		if ($_SESSION['voted_document'][$document_srl])
1076 1076
 		{
1077 1077
 			return new BaseObject(-1, $failed_voted);
1078 1078
 		}
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 		$oDocumentModel = getModel('document');
1081 1081
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
1082 1082
 		// Pass if the author's IP address is as same as visitor's.
1083
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1083
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'])
1084 1084
 		{
1085 1085
 			$_SESSION['voted_document'][$document_srl] = true;
1086 1086
 			return new BaseObject(-1, $failed_voted);
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
 		$member_srl = $oMemberModel->getLoggedMemberSrl();
1092 1092
 
1093 1093
 		// Check if document's author is a member.
1094
-		if($oDocument->get('member_srl'))
1094
+		if ($oDocument->get('member_srl'))
1095 1095
 		{
1096 1096
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
1097
-			if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1097
+			if ($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1098 1098
 			{
1099 1099
 				$_SESSION['voted_document'][$document_srl] = true;
1100 1100
 				return new BaseObject(-1, $failed_voted);
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 
1104 1104
 		// Use member_srl for logged-in members and IP address for non-members.
1105 1105
 		$args = new stdClass;
1106
-		if($member_srl)
1106
+		if ($member_srl)
1107 1107
 		{
1108 1108
 			$args->member_srl = $member_srl;
1109 1109
 		}
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 		$args->document_srl = $document_srl;
1115 1115
 		$output = executeQuery('document.getDocumentVotedLogInfo', $args);
1116 1116
 		// Pass after registering a session if log information has vote-up logs
1117
-		if($output->data->count)
1117
+		if ($output->data->count)
1118 1118
 		{
1119 1119
 			$_SESSION['voted_document'][$document_srl] = true;
1120 1120
 			return new BaseObject(-1, $failed_voted);
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 		$oDB->begin();
1126 1126
 
1127 1127
 		// Update the voted count
1128
-		if($point < 0)
1128
+		if ($point < 0)
1129 1129
 		{
1130 1130
 			$args->blamed_count = $oDocument->get('blamed_count') + $point;
1131 1131
 			$output = executeQuery('document.updateBlamedCount', $args);
@@ -1135,11 +1135,11 @@  discard block
 block discarded – undo
1135 1135
 			$args->voted_count = $oDocument->get('voted_count') + $point;
1136 1136
 			$output = executeQuery('document.updateVotedCount', $args);
1137 1137
 		}
1138
-		if(!$output->toBool()) return $output;
1138
+		if (!$output->toBool()) return $output;
1139 1139
 		// Leave logs
1140 1140
 		$args->point = $point;
1141 1141
 		$output = executeQuery('document.insertDocumentVotedLog', $args);
1142
-		if(!$output->toBool()) return $output;
1142
+		if (!$output->toBool()) return $output;
1143 1143
 
1144 1144
 		$obj = new stdClass;
1145 1145
 		$obj->member_srl = $oDocument->get('member_srl');
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 		$obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count');
1151 1151
 		$obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count;
1152 1152
 		$trigger_output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj);
1153
-		if(!$trigger_output->toBool())
1153
+		if (!$trigger_output->toBool())
1154 1154
 		{
1155 1155
 			$oDB->rollback();
1156 1156
 			return $trigger_output;
@@ -1159,10 +1159,10 @@  discard block
 block discarded – undo
1159 1159
 		$oDB->commit();
1160 1160
 
1161 1161
 		$oCacheHandler = CacheHandler::getInstance('object');
1162
-		if($oCacheHandler->isSupport())
1162
+		if ($oCacheHandler->isSupport())
1163 1163
 		{
1164 1164
 			//remove document item from cache
1165
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1165
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
1166 1166
 			$oCacheHandler->delete($cache_key);
1167 1167
 		}
1168 1168
 
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
 
1172 1172
 		// Return result
1173 1173
 		$output = new BaseObject();
1174
-		if($point > 0)
1174
+		if ($point > 0)
1175 1175
 		{
1176 1176
 			$output->setMessage('success_voted');
1177 1177
 			$output->add('voted_count', $obj->after_point);
@@ -1193,13 +1193,13 @@  discard block
 block discarded – undo
1193 1193
 	function declaredDocument($document_srl)
1194 1194
 	{
1195 1195
 		// Fail if session information already has a reported document
1196
-		if($_SESSION['declared_document'][$document_srl]) return new BaseObject(-1, 'failed_declared');
1196
+		if ($_SESSION['declared_document'][$document_srl]) return new BaseObject(-1, 'failed_declared');
1197 1197
 
1198 1198
 		// Check if previously reported
1199 1199
 		$args = new stdClass();
1200 1200
 		$args->document_srl = $document_srl;
1201 1201
 		$output = executeQuery('document.getDeclaredDocument', $args);
1202
-		if(!$output->toBool()) return $output;
1202
+		if (!$output->toBool()) return $output;
1203 1203
 
1204 1204
 		$declared_count = ($output->data->declared_count) ? $output->data->declared_count : 0;
1205 1205
 
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 		// Call a trigger (before)
1211 1211
 		$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'before', $trigger_obj);
1212
-		if(!$trigger_output->toBool())
1212
+		if (!$trigger_output->toBool())
1213 1213
 		{
1214 1214
 			return $trigger_output;
1215 1215
 		}
@@ -1219,19 +1219,19 @@  discard block
 block discarded – undo
1219 1219
 		$oDocument = $oDocumentModel->getDocument($document_srl, false, false);
1220 1220
 
1221 1221
 		// Pass if the author's IP address is as same as visitor's.
1222
-		if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
1222
+		if ($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
1223 1223
 			$_SESSION['declared_document'][$document_srl] = true;
1224 1224
 			return new BaseObject(-1, 'failed_declared');
1225 1225
 		}
1226 1226
 
1227 1227
 		// Check if document's author is a member.
1228
-		if($oDocument->get('member_srl'))
1228
+		if ($oDocument->get('member_srl'))
1229 1229
 		{
1230 1230
 			// Create a member model object
1231 1231
 			$oMemberModel = getModel('member');
1232 1232
 			$member_srl = $oMemberModel->getLoggedMemberSrl();
1233 1233
 			// Pass after registering a session if author's information is same as the currently logged-in user's.
1234
-			if($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1234
+			if ($member_srl && $member_srl == abs($oDocument->get('member_srl')))
1235 1235
 			{
1236 1236
 				$_SESSION['declared_document'][$document_srl] = true;
1237 1237
 				return new BaseObject(-1, 'failed_declared');
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
 		// Use member_srl for logged-in members and IP address for non-members.
1242 1242
 		$args = new stdClass;
1243
-		if($member_srl)
1243
+		if ($member_srl)
1244 1244
 		{
1245 1245
 			$args->member_srl = $member_srl;
1246 1246
 		}
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 		$output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
1254 1254
 
1255 1255
 		// Pass after registering a sesson if reported/declared documents are in the logs.
1256
-		if($output->data->count)
1256
+		if ($output->data->count)
1257 1257
 		{
1258 1258
 			$_SESSION['declared_document'][$document_srl] = true;
1259 1259
 			return new BaseObject(-1, 'failed_declared');
@@ -1264,23 +1264,23 @@  discard block
 block discarded – undo
1264 1264
 		$oDB->begin();
1265 1265
 
1266 1266
 		// Add the declared document
1267
-		if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1267
+		if ($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
1268 1268
 		else $output = executeQuery('document.insertDeclaredDocument', $args);
1269
-		if(!$output->toBool()) return $output;
1269
+		if (!$output->toBool()) return $output;
1270 1270
 		// Leave logs
1271 1271
 		$output = executeQuery('document.insertDocumentDeclaredLog', $args);
1272
-		if(!$output->toBool())
1272
+		if (!$output->toBool())
1273 1273
 		{
1274 1274
 			$oDB->rollback();
1275 1275
 			return $output;
1276 1276
 		}
1277 1277
 
1278
-		$this->add('declared_count', $declared_count+1);
1278
+		$this->add('declared_count', $declared_count + 1);
1279 1279
 
1280 1280
 		// Call a trigger (after)
1281 1281
 		$trigger_obj->declared_count = $declared_count + 1;
1282 1282
 		$trigger_output = ModuleHandler::triggerCall('document.declaredDocument', 'after', $trigger_obj);
1283
-		if(!$trigger_output->toBool())
1283
+		if (!$trigger_output->toBool())
1284 1284
 		{
1285 1285
 			$oDB->rollback();
1286 1286
 			return $trigger_output;
@@ -1310,16 +1310,16 @@  discard block
 block discarded – undo
1310 1310
 		$args->document_srl = $document_srl;
1311 1311
 		$args->comment_count = $comment_count;
1312 1312
 
1313
-		if($comment_inserted)
1313
+		if ($comment_inserted)
1314 1314
 		{
1315
-			$args->update_order = -1*getNextSequence();
1315
+			$args->update_order = -1 * getNextSequence();
1316 1316
 			$args->last_updater = $last_updater;
1317 1317
 
1318 1318
 			$oCacheHandler = CacheHandler::getInstance('object');
1319
-			if($oCacheHandler->isSupport())
1319
+			if ($oCacheHandler->isSupport())
1320 1320
 			{
1321 1321
 				//remove document item from cache
1322
-				$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1322
+				$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
1323 1323
 				$oCacheHandler->delete($cache_key);
1324 1324
 			}
1325 1325
 		}
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 		$args->trackback_count = $trackback_count;
1341 1341
 
1342 1342
 		$oCacheHandler = CacheHandler::getInstance('object');
1343
-		if($oCacheHandler->isSupport())
1343
+		if ($oCacheHandler->isSupport())
1344 1344
 		{
1345 1345
 			//remove document item from cache
1346
-			$cache_key = 'document_item:'. getNumberingPath($document_srl) . $document_srl;
1346
+			$cache_key = 'document_item:'.getNumberingPath($document_srl).$document_srl;
1347 1347
 			$oCacheHandler->delete($cache_key);
1348 1348
 		}
1349 1349
 
@@ -1358,14 +1358,14 @@  discard block
 block discarded – undo
1358 1358
 	function insertCategory($obj)
1359 1359
 	{
1360 1360
 		// Sort the order to display if a child category is added
1361
-		if($obj->parent_srl)
1361
+		if ($obj->parent_srl)
1362 1362
 		{
1363 1363
 			// Get its parent category
1364 1364
 			$oDocumentModel = getModel('document');
1365 1365
 			$parent_category = $oDocumentModel->getCategory($obj->parent_srl);
1366 1366
 			$obj->list_order = $parent_category->list_order;
1367
-			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1);
1368
-			if(!$obj->category_srl) $obj->category_srl = getNextSequence();
1367
+			$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order + 1);
1368
+			if (!$obj->category_srl) $obj->category_srl = getNextSequence();
1369 1369
 		}
1370 1370
 		else
1371 1371
 		{
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 		}
1374 1374
 
1375 1375
 		$output = executeQuery('document.insertCategory', $obj);
1376
-		if($output->toBool())
1376
+		if ($output->toBool())
1377 1377
 		{
1378 1378
 			$output->add('category_srl', $obj->category_srl);
1379 1379
 			$this->makeCategoryFile($obj->module_srl);
@@ -1407,13 +1407,13 @@  discard block
 block discarded – undo
1407 1407
 	{
1408 1408
 		// Create a document model object
1409 1409
 		$oDocumentModel = getModel('document');
1410
-		if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl);
1410
+		if (!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl, $category_srl);
1411 1411
 
1412 1412
 		$args = new stdClass;
1413 1413
 		$args->category_srl = $category_srl;
1414 1414
 		$args->document_count = $document_count;
1415 1415
 		$output = executeQuery('document.updateCategoryCount', $args);
1416
-		if($output->toBool()) $this->makeCategoryFile($module_srl);
1416
+		if ($output->toBool()) $this->makeCategoryFile($module_srl);
1417 1417
 
1418 1418
 		return $output;
1419 1419
 	}
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 	function updateCategory($obj)
1427 1427
 	{
1428 1428
 		$output = executeQuery('document.updateCategory', $obj);
1429
-		if($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1429
+		if ($output->toBool()) $this->makeCategoryFile($obj->module_srl);
1430 1430
 		return $output;
1431 1431
 	}
1432 1432
 
@@ -1443,32 +1443,32 @@  discard block
 block discarded – undo
1443 1443
 		$category_info = $oDocumentModel->getCategory($category_srl);
1444 1444
 		// Display an error that the category cannot be deleted if it has a child
1445 1445
 		$output = executeQuery('document.getChildCategoryCount', $args);
1446
-		if(!$output->toBool()) return $output;
1447
-		if($output->data->count>0) return new BaseObject(-1, 'msg_cannot_delete_for_child');
1446
+		if (!$output->toBool()) return $output;
1447
+		if ($output->data->count > 0) return new BaseObject(-1, 'msg_cannot_delete_for_child');
1448 1448
 		// Delete a category information
1449 1449
 		$output = executeQuery('document.deleteCategory', $args);
1450
-		if(!$output->toBool()) return $output;
1450
+		if (!$output->toBool()) return $output;
1451 1451
 
1452 1452
 		$this->makeCategoryFile($category_info->module_srl);
1453 1453
 		// remvove cache
1454 1454
 		$oCacheHandler = CacheHandler::getInstance('object');
1455
-		if($oCacheHandler->isSupport())
1455
+		if ($oCacheHandler->isSupport())
1456 1456
 		{
1457 1457
 			$page = 0;
1458
-			while(true) {
1458
+			while (true) {
1459 1459
 				$args = new stdClass();
1460 1460
 				$args->category_srl = $category_srl;
1461 1461
 				$args->list_count = 100;
1462 1462
 				$args->page = ++$page;
1463 1463
 				$output = executeQuery('document.getDocumentList', $args, array('document_srl'));
1464 1464
 
1465
-				if($output->data == array())
1465
+				if ($output->data == array())
1466 1466
 					break;
1467 1467
 
1468
-				foreach($output->data as $val)
1468
+				foreach ($output->data as $val)
1469 1469
 				{
1470 1470
 					//remove document item from cache
1471
-					$cache_key = 'document_item:'. getNumberingPath($val->document_srl) . $val->document_srl;
1471
+					$cache_key = 'document_item:'.getNumberingPath($val->document_srl).$val->document_srl;
1472 1472
 					$oCacheHandler->delete($cache_key);
1473 1473
 				}
1474 1474
 			}
@@ -1515,18 +1515,18 @@  discard block
 block discarded – undo
1515 1515
 		// Seek a full list of categories
1516 1516
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1517 1517
 		$category_srl_list = array_keys($category_list);
1518
-		if(count($category_srl_list)<2) return new BaseObject();
1518
+		if (count($category_srl_list) < 2) return new BaseObject();
1519 1519
 
1520 1520
 		$prev_category = NULL;
1521
-		foreach($category_list as $key => $val)
1521
+		foreach ($category_list as $key => $val)
1522 1522
 		{
1523
-			if($key==$category_srl) break;
1523
+			if ($key == $category_srl) break;
1524 1524
 			$prev_category = $val;
1525 1525
 		}
1526 1526
 		// Return if the previous category doesn't exist
1527
-		if(!$prev_category) return new BaseObject(-1,Context::getLang('msg_category_not_moved'));
1527
+		if (!$prev_category) return new BaseObject(-1, Context::getLang('msg_category_not_moved'));
1528 1528
 		// Return if the selected category is the top level
1529
-		if($category_srl_list[0]==$category_srl) return new BaseObject(-1,Context::getLang('msg_category_not_moved'));
1529
+		if ($category_srl_list[0] == $category_srl) return new BaseObject(-1, Context::getLang('msg_category_not_moved'));
1530 1530
 		// Information of the selected category
1531 1531
 		$cur_args = new stdClass;
1532 1532
 		$cur_args->category_srl = $category_srl;
@@ -1562,15 +1562,15 @@  discard block
 block discarded – undo
1562 1562
 		// Seek a full list of categories
1563 1563
 		$category_list = $oDocumentModel->getCategoryList($module_srl);
1564 1564
 		$category_srl_list = array_keys($category_list);
1565
-		if(count($category_srl_list)<2) return new BaseObject();
1565
+		if (count($category_srl_list) < 2) return new BaseObject();
1566 1566
 
1567
-		for($i=0;$i<count($category_srl_list);$i++)
1567
+		for ($i = 0; $i < count($category_srl_list); $i++)
1568 1568
 		{
1569
-			if($category_srl_list[$i]==$category_srl) break;
1569
+			if ($category_srl_list[$i] == $category_srl) break;
1570 1570
 		}
1571 1571
 
1572
-		$next_category_srl = $category_srl_list[$i+1];
1573
-		if(!$category_list[$next_category_srl]) return new BaseObject(-1,Context::getLang('msg_category_not_moved'));
1572
+		$next_category_srl = $category_srl_list[$i + 1];
1573
+		if (!$category_list[$next_category_srl]) return new BaseObject(-1, Context::getLang('msg_category_not_moved'));
1574 1574
 		$next_category = $category_list[$next_category_srl];
1575 1575
 		// Information of the selected category
1576 1576
 		$cur_args = new stdClass;
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
 	{
1598 1598
 		$oDocumentModel = getModel('document');
1599 1599
 		$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
1600
-		if(!count($extra_keys)) return;
1600
+		if (!count($extra_keys)) return;
1601 1601
 
1602 1602
 		$js_code = array();
1603 1603
 		$js_code[] = '<script>//<![CDATA[';
@@ -1607,16 +1607,16 @@  discard block
 block discarded – undo
1607 1607
 
1608 1608
 		$logged_info = Context::get('logged_info');
1609 1609
 
1610
-		foreach($extra_keys as $idx => $val)
1610
+		foreach ($extra_keys as $idx => $val)
1611 1611
 		{
1612 1612
 			$idx = $val->idx;
1613
-			if($val->type == 'kr_zip')
1613
+			if ($val->type == 'kr_zip')
1614 1614
 			{
1615 1615
 				$idx .= '[]';
1616 1616
 			}
1617 1617
 			$name = str_ireplace(array('<script', '</script'), array('<scr" + "ipt', '</scr" + "ipt'), $val->name);
1618 1618
 			$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["extra_vars%s","%s"]);', $idx, $name);
1619
-			if($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1619
+			if ($val->is_required == 'Y') $js_code[] = sprintf('validator.cast("ADD_EXTRA_FIELD", ["extra_vars%s", { required:true }]);', $idx);
1620 1620
 		}
1621 1621
 
1622 1622
 		$js_code[] = '})(jQuery);';
@@ -1634,12 +1634,12 @@  discard block
 block discarded – undo
1634 1634
 	function procDocumentInsertCategory($args = null)
1635 1635
 	{
1636 1636
 		// List variables
1637
-		if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
1637
+		if (!$args) $args = Context::gets('module_srl', 'category_srl', 'parent_srl', 'category_title', 'category_description', 'expand', 'group_srls', 'category_color', 'mid');
1638 1638
 		$args->title = $args->category_title;
1639 1639
 		$args->description = $args->category_description;
1640 1640
 		$args->color = $args->category_color;
1641 1641
 
1642
-		if(!$args->module_srl && $args->mid)
1642
+		if (!$args->module_srl && $args->mid)
1643 1643
 		{
1644 1644
 			$mid = $args->mid;
1645 1645
 			unset($args->mid);
@@ -1650,28 +1650,28 @@  discard block
 block discarded – undo
1650 1650
 		$columnList = array('module_srl', 'module');
1651 1651
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1652 1652
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1653
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1653
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1654 1654
 
1655
-		if($args->expand !="Y") $args->expand = "N";
1656
-		if(!is_array($args->group_srls)) $args->group_srls = str_replace('|@|',',',$args->group_srls);
1655
+		if ($args->expand != "Y") $args->expand = "N";
1656
+		if (!is_array($args->group_srls)) $args->group_srls = str_replace('|@|', ',', $args->group_srls);
1657 1657
 		else $args->group_srls = implode(',', $args->group_srls);
1658
-		$args->parent_srl = (int)$args->parent_srl;
1658
+		$args->parent_srl = (int) $args->parent_srl;
1659 1659
 
1660 1660
 		$oDocumentModel = getModel('document');
1661 1661
 
1662 1662
 		$oDB = &DB::getInstance();
1663 1663
 		$oDB->begin();
1664 1664
 		// Check if already exists
1665
-		if($args->category_srl)
1665
+		if ($args->category_srl)
1666 1666
 		{
1667 1667
 			$category_info = $oDocumentModel->getCategory($args->category_srl);
1668
-			if($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1668
+			if ($category_info->category_srl != $args->category_srl) $args->category_srl = null;
1669 1669
 		}
1670 1670
 		// Update if exists
1671
-		if($args->category_srl)
1671
+		if ($args->category_srl)
1672 1672
 		{
1673 1673
 			$output = $this->updateCategory($args);
1674
-			if(!$output->toBool())
1674
+			if (!$output->toBool())
1675 1675
 			{
1676 1676
 				$oDB->rollback();
1677 1677
 				return $output;
@@ -1681,7 +1681,7 @@  discard block
 block discarded – undo
1681 1681
 		else
1682 1682
 		{
1683 1683
 			$output = $this->insertCategory($args);
1684
-			if(!$output->toBool())
1684
+			if (!$output->toBool())
1685 1685
 			{
1686 1686
 				$oDB->rollback();
1687 1687
 				return $output;
@@ -1720,11 +1720,11 @@  discard block
 block discarded – undo
1720 1720
 		$columnList = array('module_srl', 'module');
1721 1721
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl, $columnList);
1722 1722
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1723
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1723
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1724 1724
 
1725 1725
 		// First child of the parent_category_srl
1726 1726
 		$source_args = new stdClass;
1727
-		if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
1727
+		if ($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0))
1728 1728
 		{
1729 1729
 			$parent_category = $oDocumentModel->getCategory($parent_category_srl);
1730 1730
 
@@ -1733,30 +1733,30 @@  discard block
 block discarded – undo
1733 1733
 			$args->parent_srl = $parent_category_srl;
1734 1734
 			$output = executeQuery('document.getChildCategoryMinListOrder', $args);
1735 1735
 
1736
-			if(!$output->toBool()) return $output;
1737
-			$args->list_order = (int)$output->data->list_order;
1738
-			if(!$args->list_order) $args->list_order = 0;
1736
+			if (!$output->toBool()) return $output;
1737
+			$args->list_order = (int) $output->data->list_order;
1738
+			if (!$args->list_order) $args->list_order = 0;
1739 1739
 			$args->list_order--;
1740 1740
 
1741 1741
 			$source_args->category_srl = $source_category_srl;
1742 1742
 			$source_args->parent_srl = $parent_category_srl;
1743 1743
 			$source_args->list_order = $args->list_order;
1744 1744
 			$output = $this->updateCategory($source_args);
1745
-			if(!$output->toBool()) return $output;
1745
+			if (!$output->toBool()) return $output;
1746 1746
 			// Sibling of the $target_category_srl
1747 1747
 		}
1748
-		else if($target_category_srl > 0)
1748
+		else if ($target_category_srl > 0)
1749 1749
 		{
1750 1750
 			$target_category = $oDocumentModel->getCategory($target_category_srl);
1751 1751
 			// Move all siblings of the $target_category down
1752
-			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1);
1753
-			if(!$output->toBool()) return $output;
1752
+			$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order + 1);
1753
+			if (!$output->toBool()) return $output;
1754 1754
 
1755 1755
 			$source_args->category_srl = $source_category_srl;
1756 1756
 			$source_args->parent_srl = $target_category->parent_srl;
1757
-			$source_args->list_order = $target_category->list_order+1;
1757
+			$source_args->list_order = $target_category->list_order + 1;
1758 1758
 			$output = $this->updateCategory($source_args);
1759
-			if(!$output->toBool()) return $output;
1759
+			if (!$output->toBool()) return $output;
1760 1760
 		}
1761 1761
 		// Re-generate the xml file
1762 1762
 		$xml_file = $this->makeCategoryFile($source_category->module_srl);
@@ -1772,7 +1772,7 @@  discard block
 block discarded – undo
1772 1772
 	function procDocumentDeleteCategory()
1773 1773
 	{
1774 1774
 		// List variables
1775
-		$args = Context::gets('module_srl','category_srl');
1775
+		$args = Context::gets('module_srl', 'category_srl');
1776 1776
 
1777 1777
 		$oDB = &DB::getInstance();
1778 1778
 		$oDB->begin();
@@ -1781,17 +1781,17 @@  discard block
 block discarded – undo
1781 1781
 		$columnList = array('module_srl', 'module');
1782 1782
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
1783 1783
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1784
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1784
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1785 1785
 
1786 1786
 		$oDocumentModel = getModel('document');
1787 1787
 		// Get original information
1788 1788
 		$category_info = $oDocumentModel->getCategory($args->category_srl);
1789
-		if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
1789
+		if ($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
1790 1790
 		// Display an error that the category cannot be deleted if it has a child node
1791
-		if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new BaseObject(-1, 'msg_cannot_delete_for_child');
1791
+		if ($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new BaseObject(-1, 'msg_cannot_delete_for_child');
1792 1792
 		// Remove from the DB
1793 1793
 		$output = $this->deleteCategory($args->category_srl);
1794
-		if(!$output->toBool())
1794
+		if (!$output->toBool())
1795 1795
 		{
1796 1796
 			$oDB->rollback();
1797 1797
 			return $output;
@@ -1822,11 +1822,11 @@  discard block
 block discarded – undo
1822 1822
 		$columnList = array('module_srl', 'module');
1823 1823
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1824 1824
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
1825
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
1825
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
1826 1826
 
1827 1827
 		$xml_file = $this->makeCategoryFile($module_srl);
1828 1828
 		// Set return value
1829
-		$this->add('xml_file',$xml_file);
1829
+		$this->add('xml_file', $xml_file);
1830 1830
 	}
1831 1831
 
1832 1832
 	/**
@@ -1837,14 +1837,14 @@  discard block
 block discarded – undo
1837 1837
 	function makeCategoryFile($module_srl)
1838 1838
 	{
1839 1839
 		// Return if there is no information you need for creating a cache file
1840
-		if(!$module_srl) return false;
1840
+		if (!$module_srl) return false;
1841 1841
 		// Get module information (to obtain mid)
1842 1842
 		$oModuleModel = getModel('module');
1843 1843
 		$columnList = array('module_srl', 'mid', 'site_srl');
1844 1844
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
1845 1845
 		$mid = $module_info->mid;
1846 1846
 
1847
-		if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
1847
+		if (!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category');
1848 1848
 		// Cache file's name
1849 1849
 		$xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl);
1850 1850
 		$php_file = sprintf("./files/cache/document_category/%s.php", $module_srl);
@@ -1856,17 +1856,17 @@  discard block
 block discarded – undo
1856 1856
 
1857 1857
 		$category_list = $output->data;
1858 1858
 
1859
-		if(!is_array($category_list)) $category_list = array($category_list);
1859
+		if (!is_array($category_list)) $category_list = array($category_list);
1860 1860
 
1861 1861
 		$category_count = count($category_list);
1862
-		for($i=0;$i<$category_count;$i++)
1862
+		for ($i = 0; $i < $category_count; $i++)
1863 1863
 		{
1864 1864
 			$category_srl = $category_list[$i]->category_srl;
1865
-			if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
1865
+			if (!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = '';
1866 1866
 			$list[$category_srl] = $category_list[$i];
1867 1867
 		}
1868 1868
 		// Create the xml file without node data if no data is obtained
1869
-		if(!$list)
1869
+		if (!$list)
1870 1870
 		{
1871 1871
 			$xml_buff = "<root />";
1872 1872
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1874,12 +1874,12 @@  discard block
 block discarded – undo
1874 1874
 			return $xml_file;
1875 1875
 		}
1876 1876
 		// Change to an array if only a single data is obtained
1877
-		if(!is_array($list)) $list = array($list);
1877
+		if (!is_array($list)) $list = array($list);
1878 1878
 		// Create a tree for loop
1879
-		foreach($list as $category_srl => $node)
1879
+		foreach ($list as $category_srl => $node)
1880 1880
 		{
1881 1881
 			$node->mid = $mid;
1882
-			$parent_srl = (int)$node->parent_srl;
1882
+			$parent_srl = (int) $node->parent_srl;
1883 1883
 			$tree[$parent_srl][$category_srl] = $node;
1884 1884
 		}
1885 1885
 		// A common header to set permissions and groups of the cache file
@@ -1953,13 +1953,13 @@  discard block
 block discarded – undo
1953 1953
 	 */
1954 1954
 	function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff)
1955 1955
 	{
1956
-		if(!$source_node) return;
1956
+		if (!$source_node) return;
1957 1957
 
1958
-		foreach($source_node as $category_srl => $node)
1958
+		foreach ($source_node as $category_srl => $node)
1959 1959
 		{
1960 1960
 			$child_buff = "";
1961 1961
 			// Get data of the child nodes
1962
-			if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
1962
+			if ($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff);
1963 1963
 			// List variables
1964 1964
 			$expand = $node->expand;
1965 1965
 			$group_srls = $node->group_srls;
@@ -1969,27 +1969,27 @@  discard block
 block discarded – undo
1969 1969
 			$color = $node->color;
1970 1970
 			$description = $node->description;
1971 1971
 			// If node->group_srls value exists
1972
-			if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
1972
+			if ($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $group_srls);
1973 1973
 			else $group_check_code = "true";
1974 1974
 
1975 1975
 			$title = $node->title;
1976 1976
 			$oModuleAdminModel = getAdminModel('module');
1977 1977
 
1978 1978
 			$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
1979
-			if(count($langs))
1979
+			if (count($langs))
1980 1980
 			{
1981
-				foreach($langs as $key => $val)
1981
+				foreach ($langs as $key => $val)
1982 1982
 				{
1983
-					$xml_header_buff .= sprintf('$_titles[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true));
1983
+					$xml_header_buff .= sprintf('$_titles[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true));
1984 1984
 				}
1985 1985
 			}
1986 1986
 
1987 1987
 			$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
1988
-			if(count($langx))
1988
+			if (count($langx))
1989 1989
 			{
1990
-				foreach($langx as $key => $val)
1990
+				foreach ($langx as $key => $val)
1991 1991
 				{
1992
-					$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"','\\"',htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true));
1992
+					$xml_header_buff .= sprintf('$_descriptions[%d]["%s"] = %s; ', $category_srl, $key, var_export(str_replace('"', '\\"', htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false)), true));
1993 1993
 				}
1994 1994
 			}
1995 1995
 
@@ -2002,7 +2002,7 @@  discard block
 block discarded – undo
2002 2002
 				$category_srl,
2003 2003
 				$group_check_code,
2004 2004
 				$category_srl,
2005
-				var_export(getUrl('','mid',$node->mid,'category',$category_srl), true),
2005
+				var_export(getUrl('', 'mid', $node->mid, 'category', $category_srl), true),
2006 2006
 				var_export($expand, true),
2007 2007
 				var_export($color, true),
2008 2008
 				$group_check_code,
@@ -2010,8 +2010,8 @@  discard block
 block discarded – undo
2010 2010
 				$node->document_count
2011 2011
 			);
2012 2012
 
2013
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2014
-			else $buff .=  sprintf('<node %s />', $attribute);
2013
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2014
+			else $buff .= sprintf('<node %s />', $attribute);
2015 2015
 		}
2016 2016
 		return $buff;
2017 2017
 	}
@@ -2030,13 +2030,13 @@  discard block
 block discarded – undo
2030 2030
 	function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff)
2031 2031
 	{
2032 2032
 		$output = array("buff"=>"", "category_srl_list"=>array());
2033
-		if(!$source_node) return $output;
2033
+		if (!$source_node) return $output;
2034 2034
 
2035 2035
 		// Set to an arraty for looping and then generate php script codes to be included
2036
-		foreach($source_node as $category_srl => $node)
2036
+		foreach ($source_node as $category_srl => $node)
2037 2037
 		{
2038 2038
 			// Get data from child nodes first if exist.
2039
-			if($category_srl && $tree[$category_srl]){
2039
+			if ($category_srl && $tree[$category_srl]) {
2040 2040
 				$child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff);
2041 2041
 			} else {
2042 2042
 				$child_output = array("buff"=>"", "category_srl_list"=>array());
@@ -2047,14 +2047,14 @@  discard block
 block discarded – undo
2047 2047
 			$output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']);
2048 2048
 
2049 2049
 			// If node->group_srls value exists
2050
-			if($node->group_srls) {
2051
-				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls);
2050
+			if ($node->group_srls) {
2051
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))', $node->group_srls);
2052 2052
 			} else {
2053 2053
 				$group_check_code = "true";
2054 2054
 			}
2055 2055
 
2056 2056
 			// List variables
2057
-			$selected = '"' . implode('","', $child_output['category_srl_list']) . '"';
2057
+			$selected = '"'.implode('","', $child_output['category_srl_list']).'"';
2058 2058
 			$child_buff = $child_output['buff'];
2059 2059
 			$expand = $node->expand;
2060 2060
 
@@ -2063,32 +2063,32 @@  discard block
 block discarded – undo
2063 2063
 			$oModuleAdminModel = getAdminModel('module');
2064 2064
 			$langs = $oModuleAdminModel->getLangCode($site_srl, $title);
2065 2065
 
2066
-			if(count($langs))
2066
+			if (count($langs))
2067 2067
 			{
2068
-				foreach($langs as $key => $val)
2068
+				foreach ($langs as $key => $val)
2069 2069
 				{
2070 2070
 					$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2071 2071
 					$php_header_buff .= sprintf(
2072 2072
 						'$_titles[%d]["%s"] = %s; ',
2073 2073
 						$category_srl,
2074 2074
 						$key,
2075
-						var_export(str_replace('"','\\"', $val), true)
2075
+						var_export(str_replace('"', '\\"', $val), true)
2076 2076
 					);
2077 2077
 				}
2078 2078
 			}
2079 2079
 
2080 2080
 			$langx = $oModuleAdminModel->getLangCode($site_srl, $description);
2081 2081
 
2082
-			if(count($langx))
2082
+			if (count($langx))
2083 2083
 			{
2084
-				foreach($langx as $key => $val)
2084
+				foreach ($langx as $key => $val)
2085 2085
 				{
2086 2086
 					$val = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
2087 2087
 					$php_header_buff .= sprintf(
2088 2088
 						'$_descriptions[%d]["%s"] = %s; ',
2089 2089
 						$category_srl,
2090 2090
 						$key,
2091
-						var_export(str_replace('"','\\"', $val), true)
2091
+						var_export(str_replace('"', '\\"', $val), true)
2092 2092
 					);
2093 2093
 				}
2094 2094
 			}
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
 			);
2113 2113
 
2114 2114
 			// Generate buff data
2115
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->category_srl, $attribute);
2115
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute);
2116 2116
 		}
2117 2117
 
2118 2118
 		return $output;
@@ -2129,7 +2129,7 @@  discard block
 block discarded – undo
2129 2129
 	function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self')
2130 2130
 	{
2131 2131
 		$document_popup_menu_list = Context::get('document_popup_menu_list');
2132
-		if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2132
+		if (!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
2133 2133
 
2134 2134
 		$obj = new stdClass();
2135 2135
 		$obj->url = $url;
@@ -2147,68 +2147,68 @@  discard block
 block discarded – undo
2147 2147
 	 */
2148 2148
 	function procDocumentAddCart()
2149 2149
 	{
2150
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
2150
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
2151 2151
 
2152 2152
 		// Get document_srl
2153
-		$srls = explode(',',Context::get('srls'));
2154
-		for($i = 0; $i < count($srls); $i++)
2153
+		$srls = explode(',', Context::get('srls'));
2154
+		for ($i = 0; $i < count($srls); $i++)
2155 2155
 		{
2156 2156
 			$srl = trim($srls[$i]);
2157 2157
 
2158
-			if(!$srl) continue;
2158
+			if (!$srl) continue;
2159 2159
 
2160 2160
 			$document_srls[] = $srl;
2161 2161
 		}
2162
-		if(!count($document_srls)) return;
2162
+		if (!count($document_srls)) return;
2163 2163
 
2164 2164
 		// Get module_srl of the documents
2165 2165
 		$args = new stdClass;
2166 2166
 		$args->list_count = count($document_srls);
2167
-		$args->document_srls = implode(',',$document_srls);
2167
+		$args->document_srls = implode(',', $document_srls);
2168 2168
 		$args->order_type = 'asc';
2169 2169
 		$output = executeQueryArray('document.getDocuments', $args);
2170
-		if(!$output->data) return new BaseObject();
2170
+		if (!$output->data) return new BaseObject();
2171 2171
 
2172 2172
 		unset($document_srls);
2173
-		foreach($output->data as $key => $val)
2173
+		foreach ($output->data as $key => $val)
2174 2174
 		{
2175 2175
 			$document_srls[$val->module_srl][] = $val->document_srl;
2176 2176
 		}
2177
-		if(!$document_srls || !count($document_srls)) return new BaseObject();
2177
+		if (!$document_srls || !count($document_srls)) return new BaseObject();
2178 2178
 
2179 2179
 		// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents)
2180 2180
 		$oModuleModel = getModel('module');
2181 2181
 		$module_srls = array_keys($document_srls);
2182
-		for($i=0;$i<count($module_srls);$i++)
2182
+		for ($i = 0; $i < count($module_srls); $i++)
2183 2183
 		{
2184 2184
 			$module_srl = $module_srls[$i];
2185 2185
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
2186 2186
 			$logged_info = Context::get('logged_info');
2187
-			if($logged_info->is_admin != 'Y')
2187
+			if ($logged_info->is_admin != 'Y')
2188 2188
 			{
2189
-				if(!$module_info)
2189
+				if (!$module_info)
2190 2190
 				{
2191 2191
 					unset($document_srls[$module_srl]);
2192 2192
 					continue;
2193 2193
 				}
2194 2194
 				$grant = $oModuleModel->getGrant($module_info, $logged_info);
2195
-				if(!$grant->manager)
2195
+				if (!$grant->manager)
2196 2196
 				{
2197 2197
 					unset($document_srls[$module_srl]);
2198 2198
 					continue;
2199 2199
 				}
2200 2200
 			}
2201 2201
 		}
2202
-		if(!count($document_srls)) return new BaseObject();
2202
+		if (!count($document_srls)) return new BaseObject();
2203 2203
 
2204
-		foreach($document_srls as $module_srl => $documents)
2204
+		foreach ($document_srls as $module_srl => $documents)
2205 2205
 		{
2206 2206
 			$cnt = count($documents);
2207
-			for($i=0;$i<$cnt;$i++)
2207
+			for ($i = 0; $i < $cnt; $i++)
2208 2208
 			{
2209
-				$document_srl = (int)trim($documents[$i]);
2210
-				if(!$document_srls) continue;
2211
-				if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2209
+				$document_srl = (int) trim($documents[$i]);
2210
+				if (!$document_srls) continue;
2211
+				if ($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]);
2212 2212
 				else $_SESSION['document_management'][$document_srl] = true;
2213 2213
 			}
2214 2214
 		}
@@ -2221,9 +2221,9 @@  discard block
 block discarded – undo
2221 2221
 	function procDocumentManageCheckedDocument()
2222 2222
 	{
2223 2223
 		@set_time_limit(0);
2224
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
2224
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
2225 2225
 
2226
-		if(!checkCSRF())
2226
+		if (!checkCSRF())
2227 2227
 		{
2228 2228
 			return new BaseObject(-1, 'msg_invalid_request');
2229 2229
 		}
@@ -2231,44 +2231,44 @@  discard block
 block discarded – undo
2231 2231
 		$type = Context::get('type');
2232 2232
 		$target_module = Context::get('target_module');
2233 2233
 		$module_srl = Context::get('module_srl');
2234
-		if($target_module && !$module_srl) $module_srl = $target_module;
2234
+		if ($target_module && !$module_srl) $module_srl = $target_module;
2235 2235
 		$category_srl = Context::get('target_category');
2236 2236
 		$message_content = Context::get('message_content');
2237
-		if($message_content) $message_content = nl2br($message_content);
2237
+		if ($message_content) $message_content = nl2br($message_content);
2238 2238
 
2239 2239
 		$cart = Context::get('cart');
2240
-		if(!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2240
+		if (!is_array($cart)) $document_srl_list = explode('|@|', $cart);
2241 2241
 		else $document_srl_list = $cart;
2242 2242
 
2243 2243
 		$document_srl_count = count($document_srl_list);
2244 2244
 
2245 2245
 		$oDocumentModel = getModel('document');
2246 2246
 		$document_items = array();
2247
-		foreach($document_srl_list as $document_srl)
2247
+		foreach ($document_srl_list as $document_srl)
2248 2248
 		{
2249 2249
 			$oDocument = $oDocumentModel->getDocument($document_srl);
2250 2250
 			$document_items[] = $oDocument;
2251
-			if(!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2251
+			if (!$oDocument->isGranted()) return $this->stop('msg_not_permitted');
2252 2252
 		}
2253 2253
 
2254 2254
 		// Send a message
2255
-		if($message_content)
2255
+		if ($message_content)
2256 2256
 		{
2257 2257
 
2258 2258
 			$oCommunicationController = getController('communication');
2259 2259
 
2260 2260
 			$logged_info = Context::get('logged_info');
2261 2261
 
2262
-			$title = cut_str($message_content,10,'...');
2262
+			$title = cut_str($message_content, 10, '...');
2263 2263
 			$sender_member_srl = $logged_info->member_srl;
2264 2264
 
2265
-			foreach($document_items as $oDocument)
2265
+			foreach ($document_items as $oDocument)
2266 2266
 			{
2267
-				if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
2267
+				if (!$oDocument->get('member_srl') || $oDocument->get('member_srl') == $sender_member_srl) continue;
2268 2268
 
2269
-				if($type=='move') $purl = sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2269
+				if ($type == 'move') $purl = sprintf("<a href=\"%s\" target=\"_blank\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
2270 2270
 				else $purl = "";
2271
-				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2271
+				$content = sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s", $message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false));
2272 2272
 
2273 2273
 				$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
2274 2274
 			}
@@ -2278,54 +2278,54 @@  discard block
 block discarded – undo
2278 2278
 		$oSpamController->setAvoidLog();
2279 2279
 
2280 2280
 		$oDocumentAdminController = getAdminController('document');
2281
-		if($type == 'move')
2281
+		if ($type == 'move')
2282 2282
 		{
2283
-			if(!$module_srl) return new BaseObject(-1, 'fail_to_move');
2283
+			if (!$module_srl) return new BaseObject(-1, 'fail_to_move');
2284 2284
 
2285 2285
 			$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
2286
-			if(!$output->toBool()) return new BaseObject(-1, 'fail_to_move');
2286
+			if (!$output->toBool()) return new BaseObject(-1, 'fail_to_move');
2287 2287
 
2288 2288
 			$msg_code = 'success_moved';
2289 2289
 
2290 2290
 		}
2291
-		else if($type == 'copy')
2291
+		else if ($type == 'copy')
2292 2292
 		{
2293
-			if(!$module_srl) return new BaseObject(-1, 'fail_to_move');
2293
+			if (!$module_srl) return new BaseObject(-1, 'fail_to_move');
2294 2294
 
2295 2295
 			$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
2296
-			if(!$output->toBool()) return new BaseObject(-1, 'fail_to_move');
2296
+			if (!$output->toBool()) return new BaseObject(-1, 'fail_to_move');
2297 2297
 
2298 2298
 			$msg_code = 'success_copied';
2299 2299
 		}
2300
-		else if($type =='delete')
2300
+		else if ($type == 'delete')
2301 2301
 		{
2302 2302
 			$oDB = &DB::getInstance();
2303 2303
 			$oDB->begin();
2304
-			for($i=0;$i<$document_srl_count;$i++)
2304
+			for ($i = 0; $i < $document_srl_count; $i++)
2305 2305
 			{
2306 2306
 				$document_srl = $document_srl_list[$i];
2307 2307
 				$output = $this->deleteDocument($document_srl, true);
2308
-				if(!$output->toBool()) return new BaseObject(-1, 'fail_to_delete');
2308
+				if (!$output->toBool()) return new BaseObject(-1, 'fail_to_delete');
2309 2309
 			}
2310 2310
 			$oDB->commit();
2311 2311
 			$msg_code = 'success_deleted';
2312 2312
 		}
2313
-		else if($type == 'trash')
2313
+		else if ($type == 'trash')
2314 2314
 		{
2315 2315
 			$args = new stdClass();
2316 2316
 			$args->description = $message_content;
2317 2317
 
2318 2318
 			$oDB = &DB::getInstance();
2319 2319
 			$oDB->begin();
2320
-			for($i=0;$i<$document_srl_count;$i++) {
2320
+			for ($i = 0; $i < $document_srl_count; $i++) {
2321 2321
 				$args->document_srl = $document_srl_list[$i];
2322 2322
 				$output = $this->moveDocumentToTrash($args);
2323
-				if(!$output || !$output->toBool()) return new BaseObject(-1, 'fail_to_trash');
2323
+				if (!$output || !$output->toBool()) return new BaseObject(-1, 'fail_to_trash');
2324 2324
 			}
2325 2325
 			$oDB->commit();
2326 2326
 			$msg_code = 'success_trashed';
2327 2327
 		}
2328
-		else if($type == 'cancelDeclare')
2328
+		else if ($type == 'cancelDeclare')
2329 2329
 		{
2330 2330
 			$args->document_srl = $document_srl_list;
2331 2331
 			$output = executeQuery('document.deleteDeclaredDocuments', $args);
@@ -2347,27 +2347,27 @@  discard block
 block discarded – undo
2347 2347
 	function procDocumentInsertModuleConfig()
2348 2348
 	{
2349 2349
 		$module_srl = Context::get('target_module_srl');
2350
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
2350
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
2351 2351
 		else $module_srl = array($module_srl);
2352 2352
 
2353 2353
 		$document_config = new stdClass();
2354 2354
 		$document_config->use_history = Context::get('use_history');
2355
-		if(!$document_config->use_history) $document_config->use_history = 'N';
2355
+		if (!$document_config->use_history) $document_config->use_history = 'N';
2356 2356
 
2357 2357
 		$document_config->use_vote_up = Context::get('use_vote_up');
2358
-		if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2358
+		if (!$document_config->use_vote_up) $document_config->use_vote_up = 'Y';
2359 2359
 
2360 2360
 		$document_config->use_vote_down = Context::get('use_vote_down');
2361
-		if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2361
+		if (!$document_config->use_vote_down) $document_config->use_vote_down = 'Y';
2362 2362
 
2363 2363
 		$document_config->use_status = Context::get('use_status');
2364 2364
 
2365 2365
 		$oModuleController = getController('module');
2366
-		for($i=0;$i<count($module_srl);$i++)
2366
+		for ($i = 0; $i < count($module_srl); $i++)
2367 2367
 		{
2368 2368
 			$srl = trim($module_srl[$i]);
2369
-			if(!$srl) continue;
2370
-			$output = $oModuleController->insertModulePartConfig('document',$srl,$document_config);
2369
+			if (!$srl) continue;
2370
+			$output = $oModuleController->insertModulePartConfig('document', $srl, $document_config);
2371 2371
 		}
2372 2372
 		$this->setError(-1);
2373 2373
 		$this->setMessage('success_updated', 'info');
@@ -2383,7 +2383,7 @@  discard block
 block discarded – undo
2383 2383
 	function procDocumentTempSave()
2384 2384
 	{
2385 2385
 		// Check login information
2386
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged');
2386
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_logged');
2387 2387
 		$module_info = Context::get('module_info');
2388 2388
 		$logged_info = Context::get('logged_info');
2389 2389
 
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
 		unset($obj->is_notice);
2396 2396
 
2397 2397
 		// Extract from beginning part of contents in the guestbook
2398
-		if(!$obj->title)
2398
+		if (!$obj->title)
2399 2399
 		{
2400 2400
 			$obj->title = cut_str(strip_tags($obj->content), 20, '...');
2401 2401
 		}
@@ -2406,13 +2406,13 @@  discard block
 block discarded – undo
2406 2406
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
2407 2407
 
2408 2408
 		// Update if already exists
2409
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
2409
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
2410 2410
 		{
2411
-			if($oDocument->get('module_srl') != $obj->module_srl)
2411
+			if ($oDocument->get('module_srl') != $obj->module_srl)
2412 2412
 			{
2413 2413
 				return new BaseObject(-1, 'msg_invalid_request');
2414 2414
 			}
2415
-			if(!$oDocument->isGranted())
2415
+			if (!$oDocument->isGranted())
2416 2416
 			{
2417 2417
 				return new BaseObject(-1, 'msg_invalid_request');
2418 2418
 			}
@@ -2430,7 +2430,7 @@  discard block
 block discarded – undo
2430 2430
 			$oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);
2431 2431
 		}
2432 2432
 		// Set the attachment to be invalid state
2433
-		if($oDocument->hasUploadedFiles())
2433
+		if ($oDocument->hasUploadedFiles())
2434 2434
 		{
2435 2435
 			$args = new stdClass;
2436 2436
 			$args->upload_target_srl = $oDocument->document_srl;
@@ -2448,11 +2448,11 @@  discard block
 block discarded – undo
2448 2448
 	 */
2449 2449
 	function procDocumentGetList()
2450 2450
 	{
2451
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
2451
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
2452 2452
 		$documentSrls = Context::get('document_srls');
2453
-		if($documentSrls) $documentSrlList = explode(',', $documentSrls);
2453
+		if ($documentSrls) $documentSrlList = explode(',', $documentSrls);
2454 2454
 
2455
-		if(count($documentSrlList) > 0)
2455
+		if (count($documentSrlList) > 0)
2456 2456
 		{
2457 2457
 			$oDocumentModel = getModel('document');
2458 2458
 			$columnList = array('document_srl', 'title', 'nick_name', 'status');
@@ -2476,10 +2476,10 @@  discard block
 block discarded – undo
2476 2476
 	 */
2477 2477
 	function _checkCommentStatusForOldVersion(&$obj)
2478 2478
 	{
2479
-		if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2480
-		if(!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2479
+		if (!isset($obj->allow_comment)) $obj->allow_comment = 'N';
2480
+		if (!isset($obj->lock_comment)) $obj->lock_comment = 'N';
2481 2481
 
2482
-		if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2482
+		if ($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
2483 2483
 		else $obj->commentStatus = 'DENY';
2484 2484
 	}
2485 2485
 
@@ -2490,8 +2490,8 @@  discard block
 block discarded – undo
2490 2490
 	 */
2491 2491
 	function _checkDocumentStatusForOldVersion(&$obj)
2492 2492
 	{
2493
-		if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2494
-		if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2493
+		if (!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
2494
+		if (!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
2495 2495
 	}
2496 2496
 
2497 2497
 	public function updateUploaedCount($documentSrlList)
@@ -2499,10 +2499,10 @@  discard block
 block discarded – undo
2499 2499
 		$oDocumentModel = getModel('document');
2500 2500
 		$oFileModel = getModel('file');
2501 2501
 
2502
-		if(is_array($documentSrlList))
2502
+		if (is_array($documentSrlList))
2503 2503
 		{
2504 2504
 			$documentSrlList = array_unique($documentSrlList);
2505
-			foreach($documentSrlList AS $key => $documentSrl)
2505
+			foreach ($documentSrlList AS $key => $documentSrl)
2506 2506
 			{
2507 2507
 				$fileCount = $oFileModel->getFilesCount($documentSrl);
2508 2508
 				$args = new stdClass();
@@ -2523,14 +2523,14 @@  discard block
 block discarded – undo
2523 2523
 		$oDocumentModel = getModel('document');
2524 2524
 		$documentExtraKeys = $oDocumentModel->getExtraKeys($obj->originModuleSrl);
2525 2525
 
2526
-		if(is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
2526
+		if (is_array($documentExtraKeys) && is_array($obj->moduleSrlList))
2527 2527
 		{
2528
-			$oDocumentController=getController('document');
2529
-			foreach($obj->moduleSrlList AS $key=>$value)
2528
+			$oDocumentController = getController('document');
2529
+			foreach ($obj->moduleSrlList AS $key=>$value)
2530 2530
 			{
2531
-				foreach($documentExtraKeys AS $extraItem)
2531
+				foreach ($documentExtraKeys AS $extraItem)
2532 2532
 				{
2533
-					$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required , $extraItem->search , $extraItem->default , $extraItem->desc, $extraItem->eid) ;
2533
+					$oDocumentController->insertDocumentExtraKey($value, $extraItem->idx, $extraItem->name, $extraItem->type, $extraItem->is_required, $extraItem->search, $extraItem->default, $extraItem->desc, $extraItem->eid);
2534 2534
 				}
2535 2535
 			}
2536 2536
 		}
@@ -2542,9 +2542,9 @@  discard block
 block discarded – undo
2542 2542
 		$documentConfig = $oModuleModel->getModulePartConfig('document', $obj->originModuleSrl);
2543 2543
 
2544 2544
 		$oModuleController = getController('module');
2545
-		if(is_array($obj->moduleSrlList))
2545
+		if (is_array($obj->moduleSrlList))
2546 2546
 		{
2547
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
2547
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
2548 2548
 			{
2549 2549
 				$oModuleController->insertModulePartConfig('document', $moduleSrl, $documentConfig);
2550 2550
 			}
Please login to merge, or discard this patch.
modules/menu/menu.admin.controller.php 2 patches
Spacing   +303 added lines, -303 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;
1917 1917
 
1918 1918
 			$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;
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;
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;
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
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
 				$link = '<?php print $_names[$lang_type]; ?>';
1939 1939
 			}
1940 1940
 			// If the value of node->group_srls exists
1941
-			if($group_srls)$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);
1941
+			if ($group_srls)$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 1942
 			else $group_check_code = "true";
1943 1943
 			$attribute = sprintf(
1944 1944
 				'node_srl="%d" parent_srl="%d" menu_name_key=%s text="<?php if(%s) { %s }?>" url="<?php print(%s?%s:"")?>" href="<?php print(%s?%s:"")?>" is_shortcut=%s desc=%s open_window=%s expand=%s normal_btn=%s hover_btn=%s active_btn=%s link="<?php if(%s) {?>%s<?php }?>"',
@@ -1962,8 +1962,8 @@  discard block
 block discarded – undo
1962 1962
 				$link
1963 1963
 			);
1964 1964
 
1965
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1966
-			else $buff .=  sprintf('<node %s />', $attribute);
1965
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1966
+			else $buff .= sprintf('<node %s />', $attribute);
1967 1967
 		}
1968 1968
 		return $buff;
1969 1969
 	}
@@ -1982,84 +1982,84 @@  discard block
 block discarded – undo
1982 1982
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1983 1983
 	{
1984 1984
 		$output = array("buff"=>"", "url_list"=>array());
1985
-		if(!$source_node) return $output;
1985
+		if (!$source_node) return $output;
1986 1986
 
1987 1987
 		$oMenuAdminModel = getAdminModel('menu');
1988 1988
 
1989
-		foreach($source_node as $menu_item_srl => $node)
1989
+		foreach ($source_node as $menu_item_srl => $node)
1990 1990
 		{
1991 1991
 			// Get data from child nodes if exist.
1992
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1992
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1993 1993
 			else $child_output = array("buff"=>"", "url_list"=>array());
1994 1994
 
1995 1995
 			// List variables
1996 1996
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1997 1997
 			unset($name_arr_str);
1998
-			foreach($names as $key => $val)
1998
+			foreach ($names as $key => $val)
1999 1999
 			{
2000
-				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
2000
+				if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
2001 2001
 				{
2002 2002
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2003 2003
 				}
2004 2004
 				else
2005 2005
 				{
2006
-					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2006
+					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), removeHackTag($val)));
2007 2007
 				}
2008 2008
 			}
2009 2009
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2010 2010
 
2011 2011
 			// If url value is not empty in the current node, put the value into an array url_list
2012
-			if($node->url) $child_output['url_list'][] = $node->url;
2012
+			if ($node->url) $child_output['url_list'][] = $node->url;
2013 2013
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2014 2014
 			// If node->group_srls value exists
2015
-			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);
2015
+			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);
2016 2016
 			else $group_check_code = "true";
2017 2017
 
2018 2018
 			// List variables
2019
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2020
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2021
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2022
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2019
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2020
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2021
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2022
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2023 2023
 			{
2024 2024
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2025 2025
 			}
2026 2026
 			else $href = var_export($url, true);
2027 2027
 			$is_shortcut = $node->is_shortcut;
2028 2028
 			$open_window = $node->open_window;
2029
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2030
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2031
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2029
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2030
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2031
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2032 2032
 
2033
-			foreach($child_output['url_list'] as $key =>$val)
2033
+			foreach ($child_output['url_list'] as $key =>$val)
2034 2034
 			{
2035 2035
 				$child_output['url_list'][$key] = addslashes($val);
2036 2036
 			}
2037 2037
 
2038
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2038
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2039 2039
 			$child_buff = $child_output['buff'];
2040 2040
 			$expand = $node->expand;
2041 2041
 
2042 2042
 			$normal_btn = $node->normal_btn;
2043
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2043
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2044 2044
 			else $normal_btn = '';
2045 2045
 
2046 2046
 			$hover_btn = $node->hover_btn;
2047
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2047
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2048 2048
 			else $hover_btn = '';
2049 2049
 
2050 2050
 			$active_btn = $node->active_btn;
2051
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2051
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2052 2052
 			else $active_btn = '';
2053 2053
 
2054 2054
 
2055 2055
 			$group_srls = $node->group_srls;
2056 2056
 
2057
-			if($normal_btn)
2057
+			if ($normal_btn)
2058 2058
 			{
2059
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2060
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2059
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2060
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2061 2061
 				$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);
2062
-				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);
2062
+				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);
2063 2063
 				else $link_active = $link;
2064 2064
 			}
2065 2065
 			else
@@ -2097,7 +2097,7 @@  discard block
 block discarded – undo
2097 2097
 			);
2098 2098
 
2099 2099
 			// Generate buff data
2100
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2100
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2101 2101
 			$output['name'] .= $name_str;
2102 2102
 		}
2103 2103
 		return $output;
@@ -2111,19 +2111,19 @@  discard block
 block discarded – undo
2111 2111
 	 */
2112 2112
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2113 2113
 	{
2114
-		if(!count($menu_srl_list)) return;
2114
+		if (!count($menu_srl_list)) return;
2115 2115
 		// Delete the value of menu_srls
2116
-		$args->menu_srls = implode(',',$menu_srl_list);
2116
+		$args->menu_srls = implode(',', $menu_srl_list);
2117 2117
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2118
-		if(!$output->toBool()) return $output;
2118
+		if (!$output->toBool()) return $output;
2119 2119
 
2120 2120
 		$args->layout_srl = $layout_srl;
2121 2121
 		// Mapping menu_srls, layout_srl
2122
-		for($i=0;$i<count($menu_srl_list);$i++)
2122
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2123 2123
 		{
2124 2124
 			$args->menu_srl = $menu_srl_list[$i];
2125 2125
 			$output = executeQuery('menu.insertMenuLayout', $args);
2126
-			if(!$output->toBool()) return $output;
2126
+			if (!$output->toBool()) return $output;
2127 2127
 		}
2128 2128
 	}
2129 2129
 
@@ -2136,47 +2136,47 @@  discard block
 block discarded – undo
2136 2136
 	{
2137 2137
 		// path setting
2138 2138
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2139
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2139
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2140 2140
 		{
2141 2141
 			FileHandler::makeDir($path);
2142 2142
 		}
2143 2143
 
2144
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2144
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2145 2145
 		{
2146 2146
 			$oMenuModel = getAdminModel('menu');
2147 2147
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2148 2148
 
2149
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2150
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2151
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2149
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2150
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2151
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2152 2152
 		}
2153 2153
 
2154 2154
 		$returnArray = array();
2155 2155
 		$date = date('YmdHis');
2156 2156
 		// normal button
2157
-		if($args->menu_normal_btn)
2157
+		if ($args->menu_normal_btn)
2158 2158
 		{
2159
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2160
-			$ext = $tmp_arr[count($tmp_arr)-1];
2159
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2160
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2161 2161
 
2162 2162
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2163 2163
 
2164
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2164
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2165 2165
 			{
2166
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2166
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2167 2167
 				$returnArray ['normal_btn'] = $filename;
2168 2168
 			}
2169 2169
 		}
2170 2170
 
2171 2171
 		// hover button
2172
-		if($args->menu_hover_btn)
2172
+		if ($args->menu_hover_btn)
2173 2173
 		{
2174
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2175
-			$ext = $tmp_arr[count($tmp_arr)-1];
2174
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2175
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2176 2176
 
2177 2177
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2178 2178
 
2179
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2179
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2180 2180
 			{
2181 2181
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2182 2182
 				$returnArray['hover_btn'] = $filename;
@@ -2184,14 +2184,14 @@  discard block
 block discarded – undo
2184 2184
 		}
2185 2185
 
2186 2186
 		// active button
2187
-		if($args->menu_active_btn)
2187
+		if ($args->menu_active_btn)
2188 2188
 		{
2189
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2190
-			$ext = $tmp_arr[count($tmp_arr)-1];
2189
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2190
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2191 2191
 
2192 2192
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2193 2193
 
2194
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2194
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2195 2195
 			{
2196 2196
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2197 2197
 				$returnArray['active_btn'] = $filename;
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
 			"active_btn"=>"",
2214 2214
 		);
2215 2215
 		//normal_btn
2216
-		if($menuItemInfo->normal_btn)
2216
+		if ($menuItemInfo->normal_btn)
2217 2217
 		{
2218 2218
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2219 2219
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2223,7 +2223,7 @@  discard block
 block discarded – undo
2223 2223
 		}
2224 2224
 
2225 2225
 		//hover_btn
2226
-		if($menuItemInfo->hover_btn)
2226
+		if ($menuItemInfo->hover_btn)
2227 2227
 		{
2228 2228
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2229 2229
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 		}
2234 2234
 
2235 2235
 		//active_btn
2236
-		if($menuItemInfo->active_btn)
2236
+		if ($menuItemInfo->active_btn)
2237 2237
 		{
2238 2238
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2239 2239
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2248,9 +2248,9 @@  discard block
 block discarded – undo
2248 2248
 	{
2249 2249
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2250 2250
 		$tmp_arr = explode('.', $buttonPath);
2251
-		$ext = $tmp_arr[count($tmp_arr)-1];
2251
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2252 2252
 		$date = date("YmdHis");
2253
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2253
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2254 2254
 	}
2255 2255
 
2256 2256
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +304 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,37 +2015,57 @@  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;
1915 2022
 			$open_window = $node->open_window;
1916 2023
 			$expand = $node->expand;
1917 2024
 
1918 2025
 			$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;
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;
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;
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
 			}
1940 2063
 			// If the value of node->group_srls exists
1941
-			if($group_srls)$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
-			else $group_check_code = "true";
2064
+			if($group_srls) {
2065
+				$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);
2066
+			} else {
2067
+				$group_check_code = "true";
2068
+			}
1943 2069
 			$attribute = sprintf(
1944 2070
 				'node_srl="%d" parent_srl="%d" menu_name_key=%s text="<?php if(%s) { %s }?>" url="<?php print(%s?%s:"")?>" href="<?php print(%s?%s:"")?>" is_shortcut=%s desc=%s open_window=%s expand=%s normal_btn=%s hover_btn=%s active_btn=%s link="<?php if(%s) {?>%s<?php }?>"',
1945 2071
 				$menu_item_srl,
@@ -1962,8 +2088,11 @@  discard block
 block discarded – undo
1962 2088
 				$link
1963 2089
 			);
1964 2090
 
1965
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1966
-			else $buff .=  sprintf('<node %s />', $attribute);
2091
+			if($child_buff) {
2092
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2093
+			} else {
2094
+				$buff .=  sprintf('<node %s />', $attribute);
2095
+			}
1967 2096
 		}
1968 2097
 		return $buff;
1969 2098
 	}
@@ -1982,15 +2111,20 @@  discard block
 block discarded – undo
1982 2111
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1983 2112
 	{
1984 2113
 		$output = array("buff"=>"", "url_list"=>array());
1985
-		if(!$source_node) return $output;
2114
+		if(!$source_node) {
2115
+			return $output;
2116
+		}
1986 2117
 
1987 2118
 		$oMenuAdminModel = getAdminModel('menu');
1988 2119
 
1989 2120
 		foreach($source_node as $menu_item_srl => $node)
1990 2121
 		{
1991 2122
 			// Get data from child nodes if exist.
1992
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1993
-			else $child_output = array("buff"=>"", "url_list"=>array());
2123
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2124
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2125
+			} else {
2126
+				$child_output = array("buff"=>"", "url_list"=>array());
2127
+			}
1994 2128
 
1995 2129
 			// List variables
1996 2130
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
@@ -2000,8 +2134,7 @@  discard block
 block discarded – undo
2000 2134
 				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]+)\'\]\}/', $val) === 1)
2001 2135
 				{
2002 2136
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2003
-				}
2004
-				else
2137
+				} else
2005 2138
 				{
2006 2139
 					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2007 2140
 				}
@@ -2009,11 +2142,16 @@  discard block
 block discarded – undo
2009 2142
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2010 2143
 
2011 2144
 			// If url value is not empty in the current node, put the value into an array url_list
2012
-			if($node->url) $child_output['url_list'][] = $node->url;
2145
+			if($node->url) {
2146
+				$child_output['url_list'][] = $node->url;
2147
+			}
2013 2148
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2014 2149
 			// If node->group_srls value exists
2015
-			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);
2016
-			else $group_check_code = "true";
2150
+			if($node->group_srls) {
2151
+				$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);
2152
+			} else {
2153
+				$group_check_code = "true";
2154
+			}
2017 2155
 
2018 2156
 			// List variables
2019 2157
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
@@ -2022,8 +2160,9 @@  discard block
 block discarded – undo
2022 2160
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2023 2161
 			{
2024 2162
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2163
+			} else {
2164
+				$href = var_export($url, true);
2025 2165
 			}
2026
-			else $href = var_export($url, true);
2027 2166
 			$is_shortcut = $node->is_shortcut;
2028 2167
 			$open_window = $node->open_window;
2029 2168
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2040,29 +2179,48 @@  discard block
 block discarded – undo
2040 2179
 			$expand = $node->expand;
2041 2180
 
2042 2181
 			$normal_btn = $node->normal_btn;
2043
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2044
-			else $normal_btn = '';
2182
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2183
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2184
+			} else {
2185
+				$normal_btn = '';
2186
+			}
2045 2187
 
2046 2188
 			$hover_btn = $node->hover_btn;
2047
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2048
-			else $hover_btn = '';
2189
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2190
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2191
+			} else {
2192
+				$hover_btn = '';
2193
+			}
2049 2194
 
2050 2195
 			$active_btn = $node->active_btn;
2051
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2052
-			else $active_btn = '';
2196
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2197
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2198
+			} else {
2199
+				$active_btn = '';
2200
+			}
2053 2201
 
2054 2202
 
2055 2203
 			$group_srls = $node->group_srls;
2056 2204
 
2057 2205
 			if($normal_btn)
2058 2206
 			{
2059
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2060
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2207
+				if($hover_btn) {
2208
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2209
+				} else {
2210
+					$hover_str = '';
2211
+				}
2212
+				if($active_btn) {
2213
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2214
+				} else {
2215
+					$active_str = '';
2216
+				}
2061 2217
 				$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);
2062
-				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);
2063
-				else $link_active = $link;
2064
-			}
2065
-			else
2218
+				if($active_btn) {
2219
+					$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);
2220
+				} else {
2221
+					$link_active = $link;
2222
+				}
2223
+			} else
2066 2224
 			{
2067 2225
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2068 2226
 			}
@@ -2111,11 +2269,15 @@  discard block
 block discarded – undo
2111 2269
 	 */
2112 2270
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2113 2271
 	{
2114
-		if(!count($menu_srl_list)) return;
2272
+		if(!count($menu_srl_list)) {
2273
+			return;
2274
+		}
2115 2275
 		// Delete the value of menu_srls
2116 2276
 		$args->menu_srls = implode(',',$menu_srl_list);
2117 2277
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2118
-		if(!$output->toBool()) return $output;
2278
+		if(!$output->toBool()) {
2279
+			return $output;
2280
+		}
2119 2281
 
2120 2282
 		$args->layout_srl = $layout_srl;
2121 2283
 		// Mapping menu_srls, layout_srl
@@ -2123,7 +2285,9 @@  discard block
 block discarded – undo
2123 2285
 		{
2124 2286
 			$args->menu_srl = $menu_srl_list[$i];
2125 2287
 			$output = executeQuery('menu.insertMenuLayout', $args);
2126
-			if(!$output->toBool()) return $output;
2288
+			if(!$output->toBool()) {
2289
+				return $output;
2290
+			}
2127 2291
 		}
2128 2292
 	}
2129 2293
 
@@ -2146,9 +2310,15 @@  discard block
 block discarded – undo
2146 2310
 			$oMenuModel = getAdminModel('menu');
2147 2311
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2148 2312
 
2149
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2150
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2151
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2313
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2314
+				FileHandler::removeFile($itemInfo->normal_btn);
2315
+			}
2316
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2317
+				FileHandler::removeFile($itemInfo->hover_btn);
2318
+			}
2319
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2320
+				FileHandler::removeFile($itemInfo->active_btn);
2321
+			}
2152 2322
 		}
2153 2323
 
2154 2324
 		$returnArray = array();
Please login to merge, or discard this patch.
modules/admin/admin.admin.model.php 2 patches
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
 	{
31 31
 		$ftp_info = Context::getRequestVars();
32 32
 
33
-		if(!$ftp_info->ftp_host)
33
+		if (!$ftp_info->ftp_host)
34 34
 		{
35 35
 			$ftp_info->ftp_host = "127.0.0.1";
36 36
 		}
37 37
 
38
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
38
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
39 39
 		{
40 40
 			$ftp_info->ftp_port = '22';
41 41
 		}
42 42
 
43 43
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
44
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
44
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
45 45
 		{
46 46
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
47 47
 		}
@@ -58,29 +58,29 @@  discard block
 block discarded – undo
58 58
 		$path_candidate = array();
59 59
 
60 60
 		$temp = '';
61
-		foreach($path_info as $path)
61
+		foreach ($path_info as $path)
62 62
 		{
63
-			$temp = '/' . $path . $temp;
63
+			$temp = '/'.$path.$temp;
64 64
 			$path_candidate[] = $temp;
65 65
 		}
66 66
 
67 67
 		// try
68
-		foreach($path_candidate as $path)
68
+		foreach ($path_candidate as $path)
69 69
 		{
70 70
 			// upload check file
71
-			if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html'))
71
+			if (!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path.'ftp_check.html'))
72 72
 			{
73 73
 				continue;
74 74
 			}
75 75
 
76 76
 			// get check file
77
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
77
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
78 78
 
79 79
 			// delete temp check file
80
-			@ssh2_sftp_unlink($sftp, $path . 'ftp_check.html');
80
+			@ssh2_sftp_unlink($sftp, $path.'ftp_check.html');
81 81
 
82 82
 			// found
83
-			if($result == $pin)
83
+			if ($result == $pin)
84 84
 			{
85 85
 				$found_path = $path;
86 86
 				break;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
91 91
 
92
-		if($found_path)
92
+		if ($found_path)
93 93
 		{
94 94
 			$this->add('found_path', $found_path);
95 95
 		}
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 	{
100 100
 		$ftp_info = Context::getRequestVars();
101 101
 
102
-		if(!$ftp_info->ftp_host)
102
+		if (!$ftp_info->ftp_host)
103 103
 		{
104 104
 			$ftp_info->ftp_host = "127.0.0.1";
105 105
 		}
106 106
 
107
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
107
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
108 108
 		{
109 109
 			$ftp_info->ftp_port = '22';
110 110
 		}
111 111
 
112 112
 		$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
113
-		if(!$connection)
113
+		if (!$connection)
114 114
 		{
115 115
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
116 116
 		}
117 117
 
118 118
 		$login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
119
-		if(!$login_result)
119
+		if (!$login_result)
120 120
 		{
121 121
 			ftp_close($connection);
122 122
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
@@ -133,29 +133,29 @@  discard block
 block discarded – undo
133 133
 		$path_candidate = array();
134 134
 
135 135
 		$temp = '';
136
-		foreach($path_info as $path)
136
+		foreach ($path_info as $path)
137 137
 		{
138
-			$temp = '/' . $path . $temp;
138
+			$temp = '/'.$path.$temp;
139 139
 			$path_candidate[] = $temp;
140 140
 		}
141 141
 
142 142
 		// try
143
-		foreach($path_candidate as $path)
143
+		foreach ($path_candidate as $path)
144 144
 		{
145 145
 			// upload check file
146
-			if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY))
146
+			if (!ftp_put($connection, $path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY))
147 147
 			{
148 148
 				continue;
149 149
 			}
150 150
 
151 151
 			// get check file
152
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
152
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
153 153
 
154 154
 			// delete temp check file
155
-			ftp_delete($connection, $path . 'ftp_check.html');
155
+			ftp_delete($connection, $path.'ftp_check.html');
156 156
 
157 157
 			// found
158
-			if($result == $pin)
158
+			if ($result == $pin)
159 159
 			{
160 160
 				$found_path = $path;
161 161
 				break;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
166 166
 
167
-		if($found_path)
167
+		if ($found_path)
168 168
 		{
169 169
 			$this->add('found_path', $found_path);
170 170
 		}
@@ -175,39 +175,39 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	function getAdminFTPPath()
177 177
 	{
178
-		Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
178
+		Context::loadLang(_XE_PATH_.'modules/autoinstall/lang');
179 179
 		@set_time_limit(5);
180
-		require_once(_XE_PATH_ . 'libs/ftp.class.php');
180
+		require_once(_XE_PATH_.'libs/ftp.class.php');
181 181
 
182 182
 		$ftp_info = Context::getRequestVars();
183 183
 
184
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
184
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password)
185 185
 		{
186 186
 			return new BaseObject(1, 'msg_ftp_invalid_auth_info');
187 187
 		}
188 188
 
189
-		if(!$ftp_info->ftp_host)
189
+		if (!$ftp_info->ftp_host)
190 190
 		{
191 191
 			$ftp_info->ftp_host = '127.0.0.1';
192 192
 		}
193 193
 
194
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
194
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
195 195
 		{
196 196
 			$ftp_info->ftp_port = '21';
197 197
 		}
198 198
 
199
-		if($ftp_info->sftp == 'Y')
199
+		if ($ftp_info->sftp == 'Y')
200 200
 		{
201
-			if(!function_exists('ssh2_sftp'))
201
+			if (!function_exists('ssh2_sftp'))
202 202
 			{
203 203
 				return new BaseObject(-1, 'disable_sftp_support');
204 204
 			}
205 205
 			return $this->getSFTPPath();
206 206
 		}
207 207
 
208
-		if($ftp_info->ftp_pasv == 'N')
208
+		if ($ftp_info->ftp_pasv == 'N')
209 209
 		{
210
-			if(function_exists('ftp_connect'))
210
+			if (function_exists('ftp_connect'))
211 211
 			{
212 212
 				return $this->getFTPPath();
213 213
 			}
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 		}
216 216
 
217 217
 		$oFTP = new ftp();
218
-		if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
218
+		if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
219 219
 		{
220 220
 			return new BaseObject(1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
221 221
 		}
222 222
 
223
-		if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
223
+		if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
224 224
 		{
225 225
 			return new BaseObject(1, 'msg_ftp_invalid_auth_info');
226 226
 		}
@@ -236,29 +236,29 @@  discard block
 block discarded – undo
236 236
 		$path_candidate = array();
237 237
 
238 238
 		$temp = '';
239
-		foreach($path_info as $path)
239
+		foreach ($path_info as $path)
240 240
 		{
241
-			$temp = '/' . $path . $temp;
241
+			$temp = '/'.$path.$temp;
242 242
 			$path_candidate[] = $temp;
243 243
 		}
244 244
 
245 245
 		// try
246
-		foreach($path_candidate as $path)
246
+		foreach ($path_candidate as $path)
247 247
 		{
248 248
 			// upload check file
249
-			if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check')))
249
+			if (!$oFTP->ftp_put($path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check')))
250 250
 			{
251 251
 				continue;
252 252
 			}
253 253
 
254 254
 			// get check file
255
-			$result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html');
255
+			$result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html');
256 256
 
257 257
 			// delete temp check file
258
-			$oFTP->ftp_delete($path . 'ftp_check.html');
258
+			$oFTP->ftp_delete($path.'ftp_check.html');
259 259
 
260 260
 			// found
261
-			if($result == $pin)
261
+			if ($result == $pin)
262 262
 			{
263 263
 				$found_path = $path;
264 264
 				break;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 
268 268
 		FileHandler::removeFile('./files/cache/ftp_check', $pin);
269 269
 
270
-		if($found_path)
270
+		if ($found_path)
271 271
 		{
272 272
 			$this->add('found_path', $found_path);
273 273
 		}
@@ -280,27 +280,27 @@  discard block
 block discarded – undo
280 280
 	function getSFTPList()
281 281
 	{
282 282
 		$ftp_info = Context::getRequestVars();
283
-		if(!$ftp_info->ftp_host)
283
+		if (!$ftp_info->ftp_host)
284 284
 		{
285 285
 			$ftp_info->ftp_host = "127.0.0.1";
286 286
 		}
287 287
 		$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
288
-		if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
288
+		if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
289 289
 		{
290 290
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
291 291
 		}
292 292
 
293 293
 		$sftp = ssh2_sftp($connection);
294
-		$curpwd = "ssh2.sftp://$sftp" . $this->pwd;
294
+		$curpwd = "ssh2.sftp://$sftp".$this->pwd;
295 295
 		$dh = @opendir($curpwd);
296
-		if(!$dh)
296
+		if (!$dh)
297 297
 		{
298 298
 			return new BaseObject(-1, 'msg_ftp_invalid_path');
299 299
 		}
300 300
 		$list = array();
301
-		while(($file = readdir($dh)) !== FALSE)
301
+		while (($file = readdir($dh)) !== FALSE)
302 302
 		{
303
-			if(is_dir($curpwd . $file))
303
+			if (is_dir($curpwd.$file))
304 304
 			{
305 305
 				$file .= "/";
306 306
 			}
@@ -320,32 +320,32 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	function getAdminFTPList()
322 322
 	{
323
-		Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang');
323
+		Context::loadLang(_XE_PATH_.'modules/autoinstall/lang');
324 324
 		@set_time_limit(5);
325 325
 
326
-		require_once(_XE_PATH_ . 'libs/ftp.class.php');
326
+		require_once(_XE_PATH_.'libs/ftp.class.php');
327 327
 
328 328
 		$ftp_info = Context::getRequestVars();
329
-		if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
329
+		if (!$ftp_info->ftp_user || !$ftp_info->ftp_password)
330 330
 		{
331 331
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
332 332
 		}
333 333
 
334 334
 		$this->pwd = $ftp_info->ftp_root_path;
335 335
 
336
-		if(!$ftp_info->ftp_host)
336
+		if (!$ftp_info->ftp_host)
337 337
 		{
338 338
 			$ftp_info->ftp_host = "127.0.0.1";
339 339
 		}
340 340
 
341
-		if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
341
+		if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port))
342 342
 		{
343 343
 			$ftp_info->ftp_port = "21";
344 344
 		}
345 345
 
346
-		if($ftp_info->sftp == 'Y')
346
+		if ($ftp_info->sftp == 'Y')
347 347
 		{
348
-			if(!function_exists('ssh2_sftp'))
348
+			if (!function_exists('ssh2_sftp'))
349 349
 			{
350 350
 				return new BaseObject(-1, 'disable_sftp_support');
351 351
 			}
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 		}
354 354
 
355 355
 		$oFtp = new ftp();
356
-		if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
356
+		if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
357 357
 		{
358
-			if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
358
+			if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
359 359
 			{
360 360
 				$_list = $oFtp->ftp_rawlist($this->pwd);
361 361
 				$oFtp->ftp_quit();
@@ -367,17 +367,17 @@  discard block
 block discarded – undo
367 367
 		}
368 368
 		$list = array();
369 369
 
370
-		if($_list)
370
+		if ($_list)
371 371
 		{
372
-			foreach($_list as $k => $v)
372
+			foreach ($_list as $k => $v)
373 373
 			{
374 374
 				$src = new stdClass();
375 375
 				$src->data = $v;
376 376
 				$res = Context::convertEncoding($src);
377 377
 				$v = $res->data;
378
-				if(strpos($v, 'd') === 0 || strpos($v, '<DIR>'))
378
+				if (strpos($v, 'd') === 0 || strpos($v, '<DIR>'))
379 379
 				{
380
-					$list[] = substr(strrchr($v, ' '), 1) . '/';
380
+					$list[] = substr(strrchr($v, ' '), 1).'/';
381 381
 				}
382 382
 			}
383 383
 		}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			, 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget')
401 401
 			, 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image')
402 402
 			, 'layout' => array('default')
403
-			, 'widget' => array('content', 'language_select', 'login_info','mcontent')
403
+			, 'widget' => array('content', 'language_select', 'login_info', 'mcontent')
404 404
 			, 'widgetstyle' => array(),
405 405
 		);
406 406
 		$info = array();
@@ -420,86 +420,86 @@  discard block
 block discarded – undo
420 420
 		$info['use_ssl'] = $db_info->use_ssl;
421 421
 		
422 422
 		$info['phpext'] = '';
423
-		foreach(get_loaded_extensions() as $ext)
423
+		foreach (get_loaded_extensions() as $ext)
424 424
 		{
425 425
 			$ext = strtolower($ext);
426
-			if(in_array($ext, $skip['ext']))
426
+			if (in_array($ext, $skip['ext']))
427 427
 			{
428 428
 				continue;
429 429
 			}
430
-			$info['phpext'] .= '|' . $ext;
430
+			$info['phpext'] .= '|'.$ext;
431 431
 		}
432 432
 		$info['phpext'] = substr($info['phpext'], 1);
433 433
 
434 434
 		$info['module'] = '';
435 435
 		$oModuleModel = getModel('module');
436 436
 		$module_list = $oModuleModel->getModuleList();
437
-		if($module_list) foreach($module_list as $module)
437
+		if ($module_list) foreach ($module_list as $module)
438 438
 		{
439
-			if(in_array($module->module, $skip['module']))
439
+			if (in_array($module->module, $skip['module']))
440 440
 			{
441 441
 				continue;
442 442
 			}
443
-			$info['module'] .= '|' . $module->module;
443
+			$info['module'] .= '|'.$module->module;
444 444
 		}
445 445
 		$info['module'] = substr($info['module'], 1);
446 446
 
447 447
 		$info['addon'] = '';
448 448
 		$oAddonAdminModel = getAdminModel('addon');
449 449
 		$addon_list = $oAddonAdminModel->getAddonList();
450
-		if($addon_list) foreach($addon_list as $addon)
450
+		if ($addon_list) foreach ($addon_list as $addon)
451 451
 		{
452
-			if(in_array($addon->addon, $skip['addon']))
452
+			if (in_array($addon->addon, $skip['addon']))
453 453
 			{
454 454
 				continue;
455 455
 			}
456
-			$info['addon'] .= '|' . $addon->addon;
456
+			$info['addon'] .= '|'.$addon->addon;
457 457
 		}
458 458
 		$info['addon'] = substr($info['addon'], 1);
459 459
 
460 460
 		$info['layout'] = "";
461 461
 		$oLayoutModel = getModel('layout');
462 462
 		$layout_list = $oLayoutModel->getDownloadedLayoutList();
463
-		if($layout_list) foreach($layout_list as $layout)
463
+		if ($layout_list) foreach ($layout_list as $layout)
464 464
 		{
465
-			if(in_array($layout->layout, $skip['layout']))
465
+			if (in_array($layout->layout, $skip['layout']))
466 466
 			{
467 467
 				continue;
468 468
 			}
469
-			$info['layout'] .= '|' . $layout->layout;
469
+			$info['layout'] .= '|'.$layout->layout;
470 470
 		}
471 471
 		$info['layout'] = substr($info['layout'], 1);
472 472
 
473 473
 		$info['widget'] = "";
474 474
 		$oWidgetModel = getModel('widget');
475 475
 		$widget_list = $oWidgetModel->getDownloadedWidgetList();
476
-		if($widget_list) foreach($widget_list as $widget)
476
+		if ($widget_list) foreach ($widget_list as $widget)
477 477
 		{
478
-			if(in_array($widget->widget, $skip['widget']))
478
+			if (in_array($widget->widget, $skip['widget']))
479 479
 			{
480 480
 				continue;
481 481
 			}
482
-			$info['widget'] .= '|' . $widget->widget;
482
+			$info['widget'] .= '|'.$widget->widget;
483 483
 		}
484 484
 		$info['widget'] = substr($info['widget'], 1);
485 485
 
486 486
 		$info['widgetstyle'] = "";
487 487
 		$oWidgetModel = getModel('widget');
488 488
 		$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
489
-		if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle)
489
+		if ($widgetstyle_list) foreach ($widgetstyle_list as $widgetstyle)
490 490
 		{
491
-			if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
491
+			if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
492 492
 			{
493 493
 				continue;
494 494
 			}
495
-			$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
495
+			$info['widgetstyle'] .= '|'.$widgetstyle->widgetStyle;
496 496
 		}
497 497
 		$info['widgetstyle'] = substr($info['widgetstyle'], 1);
498 498
 
499 499
 		$param = '';
500
-		foreach($info as $k => $v)
500
+		foreach ($info as $k => $v)
501 501
 		{
502
-			if($v)
502
+			if ($v)
503 503
 			{
504 504
 				$param .= sprintf('&%s=%s', $k, urlencode($v));
505 505
 			}
@@ -515,13 +515,13 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	function getThemeList()
517 517
 	{
518
-		$path = _XE_PATH_ . 'themes';
518
+		$path = _XE_PATH_.'themes';
519 519
 		$list = FileHandler::readDir($path);
520 520
 
521 521
 		$theme_info = array();
522
-		if(count($list) > 0)
522
+		if (count($list) > 0)
523 523
 		{
524
-			foreach($list as $val)
524
+			foreach ($list as $val)
525 525
 			{
526 526
 				$theme_info[$val] = $this->getThemeInfo($val);
527 527
 			}
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	function getThemeInfo($theme_name, $layout_list = NULL)
540 540
 	{
541
-		if($GLOBALS['__ThemeInfo__'][$theme_name])
541
+		if ($GLOBALS['__ThemeInfo__'][$theme_name])
542 542
 		{
543 543
 			return $GLOBALS['__ThemeInfo__'][$theme_name];
544 544
 		}
545 545
 
546
-		$info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml';
547
-		if(!file_exists($info_file))
546
+		$info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml';
547
+		if (!file_exists($info_file))
548 548
 		{
549 549
 			return;
550 550
 		}
551 551
 
552 552
 		$oXmlParser = new XmlParser();
553 553
 		$_xml_obj = $oXmlParser->loadXmlFile($info_file);
554
-		if(!$_xml_obj->theme)
554
+		if (!$_xml_obj->theme)
555 555
 		{
556 556
 			return;
557 557
 		}
@@ -562,16 +562,16 @@  discard block
 block discarded – undo
562 562
 		$theme_info = new stdClass();
563 563
 		$theme_info->name = $theme_name;
564 564
 		$theme_info->title = $xml_obj->title->body;
565
-		$thumbnail = './themes/' . $theme_name . '/thumbnail.png';
565
+		$thumbnail = './themes/'.$theme_name.'/thumbnail.png';
566 566
 		$theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL;
567 567
 		$theme_info->version = $xml_obj->version->body;
568 568
 		$date_obj = new stdClass();
569 569
 		sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
570 570
 		$theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
571 571
 		$theme_info->description = $xml_obj->description->body;
572
-		$theme_info->path = './themes/' . $theme_name . '/';
572
+		$theme_info->path = './themes/'.$theme_name.'/';
573 573
 
574
-		if(!is_array($xml_obj->publisher))
574
+		if (!is_array($xml_obj->publisher))
575 575
 		{
576 576
 			$publisher_list = array();
577 577
 			$publisher_list[] = $xml_obj->publisher;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 		}
583 583
 
584 584
 		$theme_info->publisher = array();
585
-		foreach($publisher_list as $publisher)
585
+		foreach ($publisher_list as $publisher)
586 586
 		{
587 587
 			$publisher_obj = new stdClass();
588 588
 			$publisher_obj->name = $publisher->name->body;
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		$layout_path = $layout->directory->attrs->path;
596 596
 		$layout_parse = explode('/', $layout_path);
597 597
 		$layout_info = new stdClass();
598
-		switch($layout_parse[1])
598
+		switch ($layout_parse[1])
599 599
 		{
600 600
 			case 'themes' :
601
-					$layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1];
601
+					$layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse) - 1];
602 602
 					break;
603 603
 
604 604
 			case 'layouts' :
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
 		$oLayoutModel = getModel('layout');
616 616
 		$layout_info_list = array();
617 617
 		$layout_list = $oLayoutModel->getLayoutList($site_info->site_srl);
618
-		if($layout_list)
618
+		if ($layout_list)
619 619
 		{
620
-			foreach($layout_list as $val)
620
+			foreach ($layout_list as $val)
621 621
 			{
622
-				if($val->layout == $layout_info->name)
622
+				if ($val->layout == $layout_info->name)
623 623
 				{
624 624
 					$is_new_layout = FALSE;
625 625
 					$layout_info->layout_srl = $val->layout_srl;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 			}
629 629
 		}
630 630
 
631
-		if($is_new_layout)
631
+		if ($is_new_layout)
632 632
 		{
633 633
 			$site_module_info = Context::get('site_module_info');
634 634
 			$args = new stdClass();
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		$theme_info->layout_info = $layout_info;
647 647
 
648 648
 		$skin_infos = $xml_obj->skininfos;
649
-		if(is_array($skin_infos->skininfo))
649
+		if (is_array($skin_infos->skininfo))
650 650
 		{
651 651
 			$skin_list = $skin_infos->skininfo;
652 652
 		}
@@ -657,17 +657,17 @@  discard block
 block discarded – undo
657 657
 
658 658
 		$oModuleModel = getModel('module');
659 659
 		$skins = array();
660
-		foreach($skin_list as $val)
660
+		foreach ($skin_list as $val)
661 661
 		{
662 662
 			$skin_info = new stdClass();
663 663
 			unset($skin_parse);
664 664
 			$skin_parse = explode('/', $val->directory->attrs->path);
665
-			switch($skin_parse[1])
665
+			switch ($skin_parse[1])
666 666
 			{
667 667
 				case 'themes' :
668 668
 						$is_theme = TRUE;
669 669
 						$module_name = $skin_parse[count($skin_parse) - 1];
670
-						$skin_info->name = $theme_name . '|@|' . $module_name;
670
+						$skin_info->name = $theme_name.'|@|'.$module_name;
671 671
 						break;
672 672
 
673 673
 				case 'modules' :
@@ -681,9 +681,9 @@  discard block
 block discarded – undo
681 681
 			$skin_info->is_theme = $is_theme;
682 682
 			$skins[$module_name] = $skin_info;
683 683
 
684
-			if($is_theme)
684
+			if ($is_theme)
685 685
 			{
686
-				if(!$GLOBALS['__ThemeModuleSkin__'][$module_name])
686
+				if (!$GLOBALS['__ThemeModuleSkin__'][$module_name])
687 687
 				{
688 688
 					$GLOBALS['__ThemeModuleSkin__'][$module_name] = array();
689 689
 					$GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array();
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	 */
706 706
 	function getModulesSkinList()
707 707
 	{
708
-		if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'])
708
+		if ($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__'])
709 709
 		{
710 710
 			return $GLOBALS['__ThemeModuleSkin__'];
711 711
 		}
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 		sort($searched_list);
714 714
 
715 715
 		$searched_count = count($searched_list);
716
-		if(!$searched_count)
716
+		if (!$searched_count)
717 717
 		{
718 718
 			return;
719 719
 		}
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 		$exceptionModule = array('editor', 'poll', 'homepage', 'textyle');
722 722
 
723 723
 		$oModuleModel = getModel('module');
724
-		foreach($searched_list as $val)
724
+		foreach ($searched_list as $val)
725 725
 		{
726
-			$skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val);
726
+			$skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$val);
727 727
 
728
-			if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
728
+			if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule))
729 729
 			{
730
-				if(!$GLOBALS['__ThemeModuleSkin__'][$val])
730
+				if (!$GLOBALS['__ThemeModuleSkin__'][$val])
731 731
 				{
732 732
 					$GLOBALS['__ThemeModuleSkin__'][$val] = array();
733 733
 					$moduleInfo = $oModuleModel->getModuleInfoXml($val);
@@ -751,23 +751,23 @@  discard block
 block discarded – undo
751 751
 		static $lang = false;
752 752
 
753 753
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
754
-		if($lang === false && $oCacheHandler->isSupport())
754
+		if ($lang === false && $oCacheHandler->isSupport())
755 755
 		{
756
-			$cache_key = 'admin_menu_langs:' . Context::getLangType();
756
+			$cache_key = 'admin_menu_langs:'.Context::getLangType();
757 757
 			$lang = $oCacheHandler->get($cache_key);
758 758
 
759
-			if($lang === false)
759
+			if ($lang === false)
760 760
 			{
761 761
 				$lang = array();
762 762
 				$oModuleModel = getModel('module');
763 763
 				$installed_module_list = $oModuleModel->getModulesXmlInfo();
764 764
 
765
-				foreach($installed_module_list as $key => $value)
765
+				foreach ($installed_module_list as $key => $value)
766 766
 				{
767 767
 					$moduleActionInfo = $oModuleModel->getModuleActionXml($value->module);
768
-					if(is_object($moduleActionInfo->menu))
768
+					if (is_object($moduleActionInfo->menu))
769 769
 					{
770
-						foreach($moduleActionInfo->menu as $key2 => $value2)
770
+						foreach ($moduleActionInfo->menu as $key2 => $value2)
771 771
 						{
772 772
 							$lang[$key2] = $value2->title;
773 773
 						}
@@ -792,19 +792,19 @@  discard block
 block discarded – undo
792 792
 		$args = new stdClass();
793 793
 		$args->site_srl = $siteSrl;
794 794
 		$output = executeQueryArray('admin.getFavoriteList', $args);
795
-		if(!$output->toBool())
795
+		if (!$output->toBool())
796 796
 		{
797 797
 			return $output;
798 798
 		}
799
-		if(!$output->data)
799
+		if (!$output->data)
800 800
 		{
801 801
 			return new BaseObject();
802 802
 		}
803 803
 
804
-		if($isGetModuleInfo && is_array($output->data))
804
+		if ($isGetModuleInfo && is_array($output->data))
805 805
 		{
806 806
 			$oModuleModel = getModel('module');
807
-			foreach($output->data AS $key => $value)
807
+			foreach ($output->data AS $key => $value)
808 808
 			{
809 809
 				$moduleInfo = $oModuleModel->getModuleInfoXml($value->module);
810 810
 				$output->data[$key]->admin_index_act = $moduleInfo->admin_index_act;
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
 		$args->site_srl = $siteSrl;
830 830
 		$args->module = $module;
831 831
 		$output = executeQuery('admin.getFavorite', $args);
832
-		if(!$output->toBool())
832
+		if (!$output->toBool())
833 833
 		{
834 834
 			return $output;
835 835
 		}
836 836
 
837 837
 		$returnObject = new BaseObject();
838
-		if($output->data)
838
+		if ($output->data)
839 839
 		{
840 840
 			$returnObject->add('result', TRUE);
841 841
 			$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 */
855 855
 	function getSiteAllList()
856 856
 	{
857
-		if(Context::get('domain'))
857
+		if (Context::get('domain'))
858 858
 		{
859 859
 			$domain = Context::get('domain');
860 860
 		}
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	function getAllSitesThatHaveModules($domain = NULL)
872 872
 	{
873 873
 		$args = new stdClass();
874
-		if($domain)
874
+		if ($domain)
875 875
 		{
876 876
 			$args->domain = $domain;
877 877
 		}
@@ -879,31 +879,31 @@  discard block
 block discarded – undo
879 879
 
880 880
 		$siteList = array();
881 881
 		$output = executeQueryArray('admin.getSiteAllList', $args, $columnList);
882
-		if($output->toBool())
882
+		if ($output->toBool())
883 883
 		{
884 884
 			$siteList = $output->data;
885 885
 		}
886 886
 
887 887
 		$oModuleModel = getModel('module');
888
-		foreach($siteList as $key => $value)
888
+		foreach ($siteList as $key => $value)
889 889
 		{
890 890
 			$args->site_srl = $value->site_srl;
891 891
 			$list = $oModuleModel->getModuleSrlList($args);
892 892
 
893
-			if(!is_array($list))
893
+			if (!is_array($list))
894 894
 			{
895 895
 				$list = array($list);
896 896
 			}
897 897
 
898
-			foreach($list as $k => $v)
898
+			foreach ($list as $k => $v)
899 899
 			{
900
-				if(!is_dir(_XE_PATH_ . 'modules/' . $v->module))
900
+				if (!is_dir(_XE_PATH_.'modules/'.$v->module))
901 901
 				{
902 902
 					unset($list[$k]);
903 903
 				}
904 904
 			}
905 905
 
906
-			if(!count($list))
906
+			if (!count($list))
907 907
 			{
908 908
 				unset($siteList[$key]);
909 909
 			}
@@ -920,13 +920,13 @@  discard block
 block discarded – undo
920 920
 	{
921 921
 		$args = new stdClass();
922 922
 
923
-		if($date)
923
+		if ($date)
924 924
 		{
925 925
 			$args->regDate = date('Ymd', strtotime($date));
926 926
 		}
927 927
 
928 928
 		$output = executeQuery('admin.getSiteCountByDate', $args);
929
-		if(!$output->toBool())
929
+		if (!$output->toBool())
930 930
 		{
931 931
 			return 0;
932 932
 		}
@@ -948,21 +948,21 @@  discard block
 block discarded – undo
948 948
 	{
949 949
 		$site_info = Context::get('site_module_info');
950 950
 		$virtual_site = '';
951
-		if($site_info->site_srl) 
951
+		if ($site_info->site_srl) 
952 952
 		{
953
-			$virtual_site = $site_info->site_srl . '/';
953
+			$virtual_site = $site_info->site_srl.'/';
954 954
 		}
955 955
 
956
-		$file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
957
-		if(!$file_exsit && $default === true)
956
+		$file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
957
+		if (!$file_exsit && $default === true)
958 958
         {
959
-            $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
959
+            $icon_url = './modules/admin/tpl/img/'.$default_icon_name;
960 960
         }
961
-        elseif($file_exsit)
961
+        elseif ($file_exsit)
962 962
 		{
963 963
 			$default_url = Context::getDefaultUrl();
964
-			if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
965
-			$icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname;
964
+			if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
965
+			$icon_url = $default_url.'/files/attach/xeicon/'.$virtual_site.$iconname;
966 966
 		}
967 967
 		return $icon_url;
968 968
 	}
Please login to merge, or discard this patch.
Braces   +25 added lines, -20 removed lines patch added patch discarded remove patch
@@ -303,8 +303,7 @@  discard block
 block discarded – undo
303 303
 			if(is_dir($curpwd . $file))
304 304
 			{
305 305
 				$file .= "/";
306
-			}
307
-			else
306
+			} else
308 307
 			{
309 308
 				continue;
310 309
 			}
@@ -359,8 +358,7 @@  discard block
 block discarded – undo
359 358
 			{
360 359
 				$_list = $oFtp->ftp_rawlist($this->pwd);
361 360
 				$oFtp->ftp_quit();
362
-			}
363
-			else
361
+			} else
364 362
 			{
365 363
 				return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
366 364
 			}
@@ -380,8 +378,7 @@  discard block
 block discarded – undo
380 378
 					$list[] = substr(strrchr($v, ' '), 1) . '/';
381 379
 				}
382 380
 			}
383
-		}
384
-		else
381
+		} else
385 382
 		{
386 383
 			return new BaseObject(-1, 'msg_ftp_no_directory');
387 384
 		}
@@ -434,11 +431,13 @@  discard block
 block discarded – undo
434 431
 		$info['module'] = '';
435 432
 		$oModuleModel = getModel('module');
436 433
 		$module_list = $oModuleModel->getModuleList();
437
-		if($module_list) foreach($module_list as $module)
434
+		if($module_list) {
435
+			foreach($module_list as $module)
438 436
 		{
439 437
 			if(in_array($module->module, $skip['module']))
440 438
 			{
441 439
 				continue;
440
+		}
442 441
 			}
443 442
 			$info['module'] .= '|' . $module->module;
444 443
 		}
@@ -447,11 +446,13 @@  discard block
 block discarded – undo
447 446
 		$info['addon'] = '';
448 447
 		$oAddonAdminModel = getAdminModel('addon');
449 448
 		$addon_list = $oAddonAdminModel->getAddonList();
450
-		if($addon_list) foreach($addon_list as $addon)
449
+		if($addon_list) {
450
+			foreach($addon_list as $addon)
451 451
 		{
452 452
 			if(in_array($addon->addon, $skip['addon']))
453 453
 			{
454 454
 				continue;
455
+		}
455 456
 			}
456 457
 			$info['addon'] .= '|' . $addon->addon;
457 458
 		}
@@ -460,11 +461,13 @@  discard block
 block discarded – undo
460 461
 		$info['layout'] = "";
461 462
 		$oLayoutModel = getModel('layout');
462 463
 		$layout_list = $oLayoutModel->getDownloadedLayoutList();
463
-		if($layout_list) foreach($layout_list as $layout)
464
+		if($layout_list) {
465
+			foreach($layout_list as $layout)
464 466
 		{
465 467
 			if(in_array($layout->layout, $skip['layout']))
466 468
 			{
467 469
 				continue;
470
+		}
468 471
 			}
469 472
 			$info['layout'] .= '|' . $layout->layout;
470 473
 		}
@@ -473,11 +476,13 @@  discard block
 block discarded – undo
473 476
 		$info['widget'] = "";
474 477
 		$oWidgetModel = getModel('widget');
475 478
 		$widget_list = $oWidgetModel->getDownloadedWidgetList();
476
-		if($widget_list) foreach($widget_list as $widget)
479
+		if($widget_list) {
480
+			foreach($widget_list as $widget)
477 481
 		{
478 482
 			if(in_array($widget->widget, $skip['widget']))
479 483
 			{
480 484
 				continue;
485
+		}
481 486
 			}
482 487
 			$info['widget'] .= '|' . $widget->widget;
483 488
 		}
@@ -486,11 +491,13 @@  discard block
 block discarded – undo
486 491
 		$info['widgetstyle'] = "";
487 492
 		$oWidgetModel = getModel('widget');
488 493
 		$widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList();
489
-		if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle)
494
+		if($widgetstyle_list) {
495
+			foreach($widgetstyle_list as $widgetstyle)
490 496
 		{
491 497
 			if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle']))
492 498
 			{
493 499
 				continue;
500
+		}
494 501
 			}
495 502
 			$info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle;
496 503
 		}
@@ -575,8 +582,7 @@  discard block
 block discarded – undo
575 582
 		{
576 583
 			$publisher_list = array();
577 584
 			$publisher_list[] = $xml_obj->publisher;
578
-		}
579
-		else
585
+		} else
580 586
 		{
581 587
 			$publisher_list = $xml_obj->publisher;
582 588
 		}
@@ -649,8 +655,7 @@  discard block
 block discarded – undo
649 655
 		if(is_array($skin_infos->skininfo))
650 656
 		{
651 657
 			$skin_list = $skin_infos->skininfo;
652
-		}
653
-		else
658
+		} else
654 659
 		{
655 660
 			$skin_list = array($skin_infos->skininfo);
656 661
 		}
@@ -839,8 +844,7 @@  discard block
 block discarded – undo
839 844
 		{
840 845
 			$returnObject->add('result', TRUE);
841 846
 			$returnObject->add('favoriteSrl', $output->data->admin_favorite_srl);
842
-		}
843
-		else
847
+		} else
844 848
 		{
845 849
 			$returnObject->add('result', FALSE);
846 850
 		}
@@ -957,11 +961,12 @@  discard block
 block discarded – undo
957 961
 		if(!$file_exsit && $default === true)
958 962
         {
959 963
             $icon_url = './modules/admin/tpl/img/' . $default_icon_name;
960
-        }
961
-        elseif($file_exsit)
964
+        } elseif($file_exsit)
962 965
 		{
963 966
 			$default_url = Context::getDefaultUrl();
964
-			if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
967
+			if($default_url && substr_compare($default_url, '/', -1) === 0) {
968
+				$default_url = substr($default_url, 0, -1);
969
+			}
965 970
 			$icon_url = $default_url . '/files/attach/xeicon/' . $virtual_site . $iconname;
966 971
 		}
967 972
 		return $icon_url;
Please login to merge, or discard this patch.
modules/admin/admin.admin.controller.php 1 patch
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		// forbit access if the user is not an administrator
21 21
 		$oMemberModel = getModel('member');
22 22
 		$logged_info = $oMemberModel->getLoggedInfo();
23
-		if($logged_info->is_admin != 'Y')
23
+		if ($logged_info->is_admin != 'Y')
24 24
 		{
25 25
 			return $this->stop("msg_is_not_administrator");
26 26
 		}
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 	function procAdminMenuReset()
34 34
 	{
35 35
 		$menuSrl = Context::get('menu_srl');
36
-		if(!$menuSrl)
36
+		if (!$menuSrl)
37 37
 		{
38 38
 			return $this->stop('msg_invalid_request');
39 39
 		}
40 40
 
41 41
 		$oMenuAdminController = getAdminController('menu');
42 42
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
43
-		if($oCacheHandler->isSupport())
43
+		if ($oCacheHandler->isSupport())
44 44
 		{
45
-			$cache_key = 'admin_menu_langs:' . Context::getLangType();
45
+			$cache_key = 'admin_menu_langs:'.Context::getLangType();
46 46
 			$oCacheHandler->delete($cache_key);
47 47
 		}
48 48
 		$output = $oMenuAdminController->deleteMenu($menuSrl);
49
-		if(!$output->toBool())
49
+		if (!$output->toBool())
50 50
 		{
51 51
 			return $output;
52 52
 		}
@@ -63,27 +63,27 @@  discard block
 block discarded – undo
63 63
 	function procAdminRecompileCacheFile()
64 64
 	{
65 65
 		// rename cache dir
66
-		$temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
66
+		$temp_cache_dir = './files/cache_'.$_SERVER['REQUEST_TIME'];
67 67
 		FileHandler::rename('./files/cache', $temp_cache_dir);
68 68
 		FileHandler::makeDir('./files/cache');
69 69
 
70 70
 		// remove module extend cache
71
-		FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php');
71
+		FileHandler::removeFile(_XE_PATH_.'files/config/module_extend.php');
72 72
 
73 73
 		// remove debug files
74
-		FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
75
-		FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
76
-		FileHandler::removeFile(_XE_PATH_ . 'files/_db_slow_query.php');
74
+		FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php');
75
+		FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php');
76
+		FileHandler::removeFile(_XE_PATH_.'files/_db_slow_query.php');
77 77
 
78 78
 		$oModuleModel = getModel('module');
79 79
 		$module_list = $oModuleModel->getModuleList();
80 80
 
81 81
 		// call recompileCache for each module
82
-		foreach($module_list as $module)
82
+		foreach ($module_list as $module)
83 83
 		{
84 84
 			$oModule = NULL;
85 85
 			$oModule = getClass($module->module);
86
-			if(method_exists($oModule, 'recompileCache'))
86
+			if (method_exists($oModule, 'recompileCache'))
87 87
 			{
88 88
 				$oModule->recompileCache();
89 89
 			}
@@ -94,37 +94,37 @@  discard block
 block discarded – undo
94 94
 		$oObjectCacheHandler = CacheHandler::getInstance('object');
95 95
 		$oTemplateCacheHandler = CacheHandler::getInstance('template');
96 96
 
97
-		if($oObjectCacheHandler->isSupport())
97
+		if ($oObjectCacheHandler->isSupport())
98 98
 		{
99 99
 			$truncated[] = $oObjectCacheHandler->truncate();
100 100
 		}
101 101
 
102
-		if($oTemplateCacheHandler->isSupport())
102
+		if ($oTemplateCacheHandler->isSupport())
103 103
 		{
104 104
 			$truncated[] = $oTemplateCacheHandler->truncate();
105 105
 		}
106 106
 
107
-		if(count($truncated) && in_array(FALSE, $truncated))
107
+		if (count($truncated) && in_array(FALSE, $truncated))
108 108
 		{
109 109
 			return new BaseObject(-1, 'msg_self_restart_cache_engine');
110 110
 		}
111 111
 
112 112
 		// remove cache dir
113 113
 		$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
114
-		if($tmp_cache_list)
114
+		if ($tmp_cache_list)
115 115
 		{
116
-			foreach($tmp_cache_list as $tmp_dir)
116
+			foreach ($tmp_cache_list as $tmp_dir)
117 117
 			{
118
-				if($tmp_dir)
118
+				if ($tmp_dir)
119 119
 				{
120
-					FileHandler::removeDir('./files/' . $tmp_dir);
120
+					FileHandler::removeDir('./files/'.$tmp_dir);
121 121
 				}
122 122
 			}
123 123
 		}
124 124
 
125 125
 		// remove duplicate indexes (only for CUBRID)
126 126
 		$db_type = Context::getDBType();
127
-		if($db_type == 'cubrid')
127
+		if ($db_type == 'cubrid')
128 128
 		{
129 129
 			$db = DB::getInstance();
130 130
 			$db->deleteDuplicateIndexes();
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 		$oMemberController = getController('member');
147 147
 		$oMemberController->procMemberLogout();
148 148
 
149
-		header('Location: ' . getNotEncodedUrl('', 'module', 'admin'));
149
+		header('Location: '.getNotEncodedUrl('', 'module', 'admin'));
150 150
 	}
151 151
 
152 152
 	public function procAdminInsertDefaultDesignInfo()
153 153
 	{
154 154
 		$vars = Context::getRequestVars();
155
-		if(!$vars->site_srl)
155
+		if (!$vars->site_srl)
156 156
 		{
157 157
 			$vars->site_srl = 0;
158 158
 		}
@@ -164,27 +164,27 @@  discard block
 block discarded – undo
164 164
 
165 165
 	public function updateDefaultDesignInfo($vars)
166 166
 	{
167
-		$siteDesignPath = _XE_PATH_ . 'files/site_design/';
167
+		$siteDesignPath = _XE_PATH_.'files/site_design/';
168 168
 
169 169
 		$vars->module_skin = json_decode($vars->module_skin);
170 170
 
171
-		if(!is_dir($siteDesignPath))
171
+		if (!is_dir($siteDesignPath))
172 172
 		{
173 173
 			FileHandler::makeDir($siteDesignPath);
174 174
 		}
175 175
 
176
-		$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $vars->site_srl . '.php';
176
+		$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php';
177 177
 
178 178
 		$layoutTarget = 'layout_srl';
179 179
 		$skinTarget = 'skin';
180 180
 
181
-		if($vars->target_type == 'M')
181
+		if ($vars->target_type == 'M')
182 182
 		{
183 183
 			$layoutTarget = 'mlayout_srl';
184 184
 			$skinTarget = 'mskin';
185 185
 		}
186 186
 
187
-		if(is_readable($siteDesignFile))
187
+		if (is_readable($siteDesignFile))
188 188
 		{
189 189
 			include($siteDesignFile);
190 190
 		}
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$designInfo->{$layoutTarget} = $layoutSrl;
199 199
 
200
-		foreach($vars->module_skin as $moduleName => $skinName)
200
+		foreach ($vars->module_skin as $moduleName => $skinName)
201 201
 		{
202
-			if($moduleName == 'ARTICLE')
202
+			if ($moduleName == 'ARTICLE')
203 203
 			{
204 204
 				$moduleName = 'page';
205 205
 			}
206 206
 
207
-			if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
207
+			if (!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
208 208
 			$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
209 209
 		}
210 210
 
@@ -219,28 +219,28 @@  discard block
 block discarded – undo
219 219
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
220 220
 		$buff[] = '$designInfo = new stdClass;';
221 221
 
222
-		if($designInfo->layout_srl)
222
+		if ($designInfo->layout_srl)
223 223
 		{
224 224
 			$buff[] = sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl);
225 225
 		}
226 226
 
227
-		if($designInfo->mlayout_srl)
227
+		if ($designInfo->mlayout_srl)
228 228
 		{
229 229
 			$buff[] = sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl);
230 230
 		}
231 231
 
232 232
 		$buff[] = '$designInfo->module = new stdClass;';
233 233
 
234
-		foreach($designInfo->module as $moduleName => $skinInfo)
234
+		foreach ($designInfo->module as $moduleName => $skinInfo)
235 235
 		{
236 236
 			$buff[] = sprintf('$designInfo->module->%s = new stdClass;', $moduleName);
237
-			foreach($skinInfo as $target => $skinName)
237
+			foreach ($skinInfo as $target => $skinName)
238 238
 			{
239 239
 				$buff[] = sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName);
240 240
 			}
241 241
 		}
242 242
 
243
-		$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $site_srl . '.php';
243
+		$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php';
244 244
 		FileHandler::writeFile($siteDesignFile, implode(PHP_EOL, $buff));
245 245
 	}
246 246
 
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 		// check favorite exists
257 257
 		$oModel = getAdminModel('admin');
258 258
 		$output = $oModel->isExistsFavorite($siteSrl, $moduleName);
259
-		if(!$output->toBool())
259
+		if (!$output->toBool())
260 260
 		{
261 261
 			return $output;
262 262
 		}
263 263
 
264 264
 		// if exists, delete favorite
265
-		if($output->get('result'))
265
+		if ($output->get('result'))
266 266
 		{
267 267
 			$favoriteSrl = $output->get('favoriteSrl');
268 268
 			$output = $this->_deleteFavorite($favoriteSrl);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			$result = 'on';
276 276
 		}
277 277
 
278
-		if(!$output->toBool())
278
+		if (!$output->toBool())
279 279
 		{
280 280
 			return $output;
281 281
 		}
@@ -293,31 +293,31 @@  discard block
 block discarded – undo
293 293
 	{
294 294
 		$oModel = getAdminModel('admin');
295 295
 		$output = $oModel->getFavoriteList();
296
-		if(!$output->toBool())
296
+		if (!$output->toBool())
297 297
 		{
298 298
 			return $output;
299 299
 		}
300 300
 
301 301
 		$favoriteList = $output->get('favoriteList');
302
-		if(!$favoriteList)
302
+		if (!$favoriteList)
303 303
 		{
304 304
 			return new BaseObject();
305 305
 		}
306 306
 
307 307
 		$deleteTargets = array();
308
-		foreach($favoriteList as $favorite)
308
+		foreach ($favoriteList as $favorite)
309 309
 		{
310
-			if($favorite->type == 'module')
310
+			if ($favorite->type == 'module')
311 311
 			{
312
-				$modulePath = _XE_PATH_ . 'modules/' . $favorite->module;
313
-				if(!is_dir($modulePath))
312
+				$modulePath = _XE_PATH_.'modules/'.$favorite->module;
313
+				if (!is_dir($modulePath))
314 314
 				{
315 315
 					$deleteTargets[] = $favorite->admin_favorite_srl;
316 316
 				}
317 317
 			}
318 318
 		}
319 319
 
320
-		if(!count($deleteTargets))
320
+		if (!count($deleteTargets))
321 321
 		{
322 322
 			return new BaseObject();
323 323
 		}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		$args = new stdClass();
326 326
 		$args->admin_favorite_srls = $deleteTargets;
327 327
 		$output = executeQuery('admin.deleteFavorites', $args);
328
-		if(!$output->toBool())
328
+		if (!$output->toBool())
329 329
 		{
330 330
 			return $output;
331 331
 		}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	function procAdminEnviromentGatheringAgreement()
341 341
 	{
342 342
 		$isAgree = Context::get('is_agree');
343
-		if($isAgree == 'true')
343
+		if ($isAgree == 'true')
344 344
 		{
345 345
 			$_SESSION['enviroment_gather'] = 'Y';
346 346
 		}
@@ -365,23 +365,23 @@  discard block
 block discarded – undo
365 365
 		$oModuleModel = getModel('module');
366 366
 		$oAdminConfig = $oModuleModel->getModuleConfig('admin');
367 367
 
368
-		if(!is_object($oAdminConfig))
368
+		if (!is_object($oAdminConfig))
369 369
 		{
370 370
 			$oAdminConfig = new stdClass();
371 371
 		}
372 372
 
373
-		if($file['tmp_name'])
373
+		if ($file['tmp_name'])
374 374
 		{
375 375
 			$target_path = 'files/attach/images/admin/';
376 376
 			FileHandler::makeDir($target_path);
377 377
 
378 378
 			// Get file information
379 379
 			list($width, $height, $type, $attrs) = @getimagesize($file['tmp_name']);
380
-			if($type == 3)
380
+			if ($type == 3)
381 381
 			{
382 382
 				$ext = 'png';
383 383
 			}
384
-			elseif($type == 2)
384
+			elseif ($type == 2)
385 385
 			{
386 386
 				$ext = 'jpg';
387 387
 			}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
 			$oAdminConfig->adminLogo = $target_filename;
397 397
 		}
398
-		if($adminTitle)
398
+		if ($adminTitle)
399 399
 		{
400 400
 			$oAdminConfig->adminTitle = strip_tags($adminTitle);
401 401
 		}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			unset($oAdminConfig->adminTitle);
405 405
 		}
406 406
 
407
-		if($oAdminConfig)
407
+		if ($oAdminConfig)
408 408
 		{
409 409
 			$oModuleController = getController('module');
410 410
 			$oModuleController->insertModuleConfig('admin', $oAdminConfig);
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 		$oModuleModel = getModel('module');
426 426
 		$oAdminConfig = $oModuleModel->getModuleConfig('admin');
427 427
 
428
-		FileHandler::removeFile(_XE_PATH_ . $oAdminConfig->adminLogo);
428
+		FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo);
429 429
 		unset($oAdminConfig->adminLogo);
430 430
 
431 431
 		$oModuleController = getController('module');
@@ -484,16 +484,16 @@  discard block
 block discarded – undo
484 484
 
485 485
 		$site_info = Context::get('site_module_info');
486 486
 		$virtual_site = '';
487
-		if($site_info->site_srl) 
487
+		if ($site_info->site_srl) 
488 488
 		{
489
-			$virtual_site = $site_info->site_srl . '/';
489
+			$virtual_site = $site_info->site_srl.'/';
490 490
 		}
491 491
 
492 492
 		$iconname = Context::get('iconname');
493
-		$file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
494
-		if($file_exist)
493
+		$file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
494
+		if ($file_exist)
495 495
 		{
496
-			@FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
496
+			@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
497 497
 		}
498 498
 		else
499 499
 		{
@@ -514,33 +514,33 @@  discard block
 block discarded – undo
514 514
 		$db_info->sitelock_message = $vars->sitelock_message;
515 515
 
516 516
 		$whitelist = $vars->sitelock_whitelist;
517
-		$whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist);
518
-		$whitelist = preg_replace("/\s+/","",$whitelist);
519
-		if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
517
+		$whitelist = preg_replace("/[\r|\n|\r\n]+/", ",", $whitelist);
518
+		$whitelist = preg_replace("/\s+/", "", $whitelist);
519
+		if (preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
520 520
 		{
521 521
 			$whitelist = '';
522 522
 		}
523
-		$whitelist .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
524
-		$whitelist = explode(',',trim($whitelist, ','));
523
+		$whitelist .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
524
+		$whitelist = explode(',', trim($whitelist, ','));
525 525
 		$whitelist = array_unique($whitelist);
526 526
 
527
-		if(!IpFilter::validate($whitelist)) {
527
+		if (!IpFilter::validate($whitelist)) {
528 528
 			return new BaseObject(-1, 'msg_invalid_ip');
529 529
 		}
530 530
 
531 531
 		$db_info->sitelock_whitelist = $whitelist;
532 532
 
533 533
 		$oInstallController = getController('install');
534
-		if(!$oInstallController->makeConfigFile())
534
+		if (!$oInstallController->makeConfigFile())
535 535
 		{
536 536
 			return new BaseObject(-1, 'msg_invalid_request');
537 537
 		}
538 538
 
539
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
539
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
540 540
 		{
541 541
 			$returnUrl = Context::get('success_return_url');
542
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
543
-			header('location:' . $returnUrl);
542
+			if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
543
+			header('location:'.$returnUrl);
544 544
 			return;
545 545
 		}
546 546
 	}
@@ -571,20 +571,20 @@  discard block
 block discarded – undo
571 571
 		$db_info->embed_white_iframe = $white_iframe;
572 572
 
573 573
 		$oInstallController = getController('install');
574
-		if(!$oInstallController->makeConfigFile())
574
+		if (!$oInstallController->makeConfigFile())
575 575
 		{
576 576
 			return new BaseObject(-1, 'msg_invalid_request');
577 577
 		}
578 578
 
579
-		require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
579
+		require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
580 580
 		$oEmbedFilter = EmbedFilter::getInstance();
581 581
 		$oEmbedFilter->_makeWhiteDomainList($whitelist);
582 582
 
583
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
583
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
584 584
 		{
585 585
 			$returnUrl = Context::get('success_return_url');
586
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
587
-			header('location:' . $returnUrl);
586
+			if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
587
+			header('location:'.$returnUrl);
588 588
 			return;
589 589
 		}
590 590
 	}
Please login to merge, or discard this patch.
modules/module/module.admin.controller.php 2 patches
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if (!$output->toBool()) return $output;
26 26
 
27 27
 		$this->setMessage("success_registed");
28 28
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	function procModuleAdminUpdateCategory()
37 37
 	{
38 38
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
39
+		if (!$output->toBool()) return $output;
40 40
 
41 41
 		$this->setMessage('success_updated');
42 42
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	function procModuleAdminDeleteCategory()
51 51
 	{
52 52
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
53
+		if (!$output->toBool()) return $output;
54 54
 
55 55
 		$this->setMessage('success_deleted');
56 56
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	function procModuleAdminCopyModule($args = NULL)
86 86
 	{
87 87
 		$isProc = false;
88
-		if(!$args)
88
+		if (!$args)
89 89
 		{
90 90
 			$isProc = true;
91 91
 			// Get information of the target module to copy
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
 			$module_srl = $args->module_srl;
98 98
 		}
99 99
 
100
-		if(!$module_srl)
100
+		if (!$module_srl)
101 101
 		{
102 102
 			return $this->_returnByProc($isProc);
103 103
 		}
104 104
 
105 105
 		// Get module name to create and browser title
106 106
 		$clones = array();
107
-		for($i=1;$i<=10;$i++)
107
+		for ($i = 1; $i <= 10; $i++)
108 108
 		{
109 109
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
110
+			if (!$mid) continue;
111
+			if (!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
112 112
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
113
+			if (!$mid) continue;
114
+			if ($mid && !$browser_title) $browser_title = $mid;
115 115
 			$clones[$mid] = $browser_title;
116 116
 		}
117
-		if(count($clones) < 1)
117
+		if (count($clones) < 1)
118 118
 		{
119 119
 			return $this->_returnByProc($isProc);
120 120
 		}
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 		$module_args->module_srl = $module_srl;
130 130
 		$output = executeQueryArray('module.getModuleGrants', $module_args);
131 131
 		$grant = array();
132
-		if($output->data)
132
+		if ($output->data)
133 133
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
134
+			foreach ($output->data as $val) $grant[$val->name][] = $val->group_srl;
135 135
 		}
136 136
 
137 137
 		// get Extra Vars
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
 		$extra_args->module_srl = $module_srl;
140 140
 		$extra_output = executeQueryArray('module.getModuleExtraVars', $extra_args);
141 141
 		$extra_vars = new stdClass();
142
-		if($extra_output->toBool() && is_array($extra_output->data))
142
+		if ($extra_output->toBool() && is_array($extra_output->data))
143 143
 		{
144
-			foreach($extra_output->data as $info)
144
+			foreach ($extra_output->data as $info)
145 145
 			{
146 146
 				$extra_vars->{$info->name} = $info->value;
147 147
 			}
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 		$tmpModuleSkinVars = $oModuleModel->getModuleSkinVars($module_srl);
151 151
 		$tmpModuleMobileSkinVars = $oModuleModel->getModuleMobileSkinVars($module_srl);
152 152
 
153
-		if($tmpModuleSkinVars)
153
+		if ($tmpModuleSkinVars)
154 154
 		{
155
-			foreach($tmpModuleSkinVars as $key=>$value)
155
+			foreach ($tmpModuleSkinVars as $key=>$value)
156 156
 			{
157 157
 				$moduleSkinVars->{$key} = $value->value;
158 158
 			}
159 159
 		}
160 160
 
161
-		if($tmpModuleMobileSkinVars)
161
+		if ($tmpModuleMobileSkinVars)
162 162
 		{
163
-			foreach($tmpModuleMobileSkinVars as $key=>$value)
163
+			foreach ($tmpModuleMobileSkinVars as $key=>$value)
164 164
 			{
165 165
 				$moduleMobileSkinVars->{$key} = $value->value;
166 166
 			}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$triggerObj->moduleSrlList = array();
175 175
 
176 176
 		$errorLog = array();
177
-		foreach($clones as $mid => $browser_title)
177
+		foreach ($clones as $mid => $browser_title)
178 178
 		{
179 179
 			$clone_args = new stdClass;
180 180
 			$clone_args = clone $module_info;
@@ -188,29 +188,29 @@  discard block
 block discarded – undo
188 188
 			// Create a module
189 189
 			$output = $oModuleController->insertModule($clone_args);
190 190
 
191
-			if(!$output->toBool())
191
+			if (!$output->toBool())
192 192
 			{
193
-				$errorLog[] = $mid . ' : '. $output->message;
193
+				$errorLog[] = $mid.' : '.$output->message;
194 194
 				continue;
195 195
 			}
196 196
 			$module_srl = $output->get('module_srl');
197 197
 
198
-			if($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
198
+			if ($module_info->module == 'page' && $extra_vars->page_type == 'ARTICLE')
199 199
 			{
200 200
 				// copy document
201 201
 				$oDocumentAdminController = getAdminController('document');
202 202
 				$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->document_srl), $module_srl, $module_info->category_srl);
203 203
 				$document_srls = $copyOutput->get('copied_srls');
204
-				if($document_srls && count($document_srls) > 0)
204
+				if ($document_srls && count($document_srls) > 0)
205 205
 				{
206 206
 					$extra_vars->document_srl = array_pop($document_srls);
207 207
 				}
208 208
 
209
-				if($extra_vars->mdocument_srl)
209
+				if ($extra_vars->mdocument_srl)
210 210
 				{
211 211
 					$copyOutput = $oDocumentAdminController->copyDocumentModule(array($extra_vars->mdocument_srl), $module_srl, $module_info->category_srl);
212 212
 					$copiedSrls = $copyOutput->get('copied_srls');
213
-					if($copiedSrls && count($copiedSrls) > 0)
213
+					if ($copiedSrls && count($copiedSrls) > 0)
214 214
 					{
215 215
 						$extra_vars->mdocument_srl = array_pop($copiedSrls);
216 216
 					}
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 			}
219 219
 
220 220
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
221
+			if (count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
+			if ($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
223 223
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
224
+			if ($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
+			if ($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
226 226
 
227 227
 			$triggerObj->moduleSrlList[] = $module_srl;
228 228
 		}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		$oDB->commit();
233 233
 
234
-		if(count($errorLog) > 0)
234
+		if (count($errorLog) > 0)
235 235
 		{
236 236
 			$message = implode('\n', $errorLog);
237 237
 			$this->setMessage($message);
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 			$this->setMessage('success_registed');
243 243
 		}
244 244
 
245
-		if($isProc)
245
+		if ($isProc)
246 246
 		{
247
-			if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
247
+			if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
248 248
 			{
249 249
 				global $lang;
250 250
 				htmlHeader();
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 		return $module_srl;
261 261
 	}
262 262
 
263
-	private function _returnByProc($isProc, $msg='msg_invalid_request')
263
+	private function _returnByProc($isProc, $msg = 'msg_invalid_request')
264 264
 	{
265
-		if(!$isProc)
265
+		if (!$isProc)
266 266
 			return;
267 267
 		else
268 268
 		{
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
 		// Get information of the module
283 283
 		$columnList = array('module_srl', 'module');
284 284
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new BaseObject(-1,'msg_invalid_request');
285
+		if (!$module_info) return new BaseObject(-1, 'msg_invalid_request');
286 286
 		// Register Admin ID
287 287
 		$oModuleController->deleteAdminId($module_srl);
288 288
 		$admin_member = Context::get('admin_member');
289
-		if($admin_member)
289
+		if ($admin_member)
290 290
 		{
291
-			$admin_members = explode(',',$admin_member);
292
-			foreach($admin_members as $admin_id)
291
+			$admin_members = explode(',', $admin_member);
292
+			foreach ($admin_members as $admin_id)
293 293
 			{
294 294
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
295
+				if (!$admin_id) continue;
296 296
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 297
 			}
298 298
 		}
@@ -307,13 +307,13 @@  discard block
 block discarded – undo
307 307
 		$grant_list->manager->default = 'manager';
308 308
 
309 309
 		$grant = new stdClass();
310
-		foreach($grant_list as $grant_name => $grant_info)
310
+		foreach ($grant_list as $grant_name => $grant_info)
311 311
 		{
312 312
 			// Get the default value
313 313
 			$default = Context::get($grant_name.'_default');
314 314
 			// -1 = Log-in user only, -2 = site members only, -3 = manager only, 0 = all users
315 315
 			$grant->{$grant_name} = array();
316
-			if(strlen($default))
316
+			if (strlen($default))
317 317
 			{
318 318
 				$grant->{$grant_name}[] = $default;
319 319
 				continue;
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
 			else
323 323
 			{
324 324
 				$group_srls = Context::get($grant_name);
325
-				if($group_srls)
325
+				if ($group_srls)
326 326
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
327
+					if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
328
+					elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
329 329
 					else $group_srls = array($group_srls);
330 330
 					$grant->{$grant_name} = $group_srls;
331 331
 				}
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 		$args = new stdClass();
339 339
 		$args->module_srl = $module_srl;
340 340
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
341
+		if (!$output->toBool()) return $output;
342 342
 		// Permissions stored in the DB
343
-		foreach($grant as $grant_name => $group_srls)
343
+		foreach ($grant as $grant_name => $group_srls)
344 344
 		{
345
-			foreach($group_srls as $val)
345
+			foreach ($group_srls as $val)
346 346
 			{
347 347
 				$args = new stdClass();
348 348
 				$args->module_srl = $module_srl;
349 349
 				$args->name = $grant_name;
350 350
 				$args->group_srl = $val;
351 351
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
352
+				if (!$output->toBool()) return $output;
353 353
 			}
354 354
 		}
355 355
 		$this->setMessage('success_registed');
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
 		$oModuleModel = getModel('module');
369 369
 		$columnList = array('module_srl', 'module', 'skin', 'mskin', 'is_skin_fix', 'is_mskin_fix');
370 370
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
371
-		if($module_info->module_srl)
371
+		if ($module_info->module_srl)
372 372
 		{
373
-			if($mode === 'M')
373
+			if ($mode === 'M')
374 374
 			{
375
-				if($module_info->is_mskin_fix == 'Y')
375
+				if ($module_info->is_mskin_fix == 'Y')
376 376
 				{
377 377
 					$skin = $module_info->mskin;
378 378
 				}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 			else
385 385
 			{
386
-				if($module_info->is_skin_fix == 'Y')
386
+				if ($module_info->is_skin_fix == 'Y')
387 387
 				{
388 388
 					$skin = $module_info->skin;
389 389
 				}
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 			}
395 395
 
396 396
 			// Get skin information (to check extra_vars)
397
-			$module_path = _XE_PATH_ . 'modules/'.$module_info->module;
397
+			$module_path = _XE_PATH_.'modules/'.$module_info->module;
398 398
 
399
-			if($mode === 'M')
399
+			if ($mode === 'M')
400 400
 			{
401 401
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 402
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
@@ -417,35 +417,35 @@  discard block
 block discarded – undo
417 417
 			unset($obj->module);
418 418
 			unset($obj->_mode);
419 419
 			// Separately handle if a type of extra_vars is an image in the original skin_info
420
-			if($skin_info->extra_vars)
420
+			if ($skin_info->extra_vars)
421 421
 			{
422
-				foreach($skin_info->extra_vars as $vars)
422
+				foreach ($skin_info->extra_vars as $vars)
423 423
 				{
424
-					if($vars->type!='image') continue;
424
+					if ($vars->type != 'image') continue;
425 425
 
426 426
 					$image_obj = $obj->{$vars->name};
427 427
 					// Get a variable to delete
428 428
 					$del_var = $obj->{"del_".$vars->name};
429 429
 					unset($obj->{"del_".$vars->name});
430
-					if($del_var == 'Y')
430
+					if ($del_var == 'Y')
431 431
 					{
432 432
 						FileHandler::removeFile($skin_vars[$vars->name]->value);
433 433
 						continue;
434 434
 					}
435 435
 					// Use the previous data if not uploaded
436
-					if(!$image_obj['tmp_name'])
436
+					if (!$image_obj['tmp_name'])
437 437
 					{
438 438
 						$obj->{$vars->name} = $skin_vars[$vars->name]->value;
439 439
 						continue;
440 440
 					}
441 441
 					// Ignore if the file is not successfully uploaded
442
-					if(!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
442
+					if (!is_uploaded_file($image_obj['tmp_name']) || !checkUploadedFile($image_obj['tmp_name']))
443 443
 					{
444 444
 						unset($obj->{$vars->name});
445 445
 						continue;
446 446
 					}
447 447
 					// Ignore if the file is not an image
448
-					if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
448
+					if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name']))
449 449
 					{
450 450
 						unset($obj->{$vars->name});
451 451
 						continue;
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 					// Upload the file to a path
454 454
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 455
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
456
+					if (!FileHandler::makeDir($path)) return false;
457 457
 
458 458
 					$filename = $path.$image_obj['name'];
459 459
 					// Move the file
460
-					if(!move_uploaded_file($image_obj['tmp_name'], $filename))
460
+					if (!move_uploaded_file($image_obj['tmp_name'], $filename))
461 461
 					{
462 462
 						unset($obj->{$vars->name});
463 463
 						continue;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 			*/
482 482
 			$oModuleController = getController('module');
483 483
 
484
-			if($mode === 'M')
484
+			if ($mode === 'M')
485 485
 			{
486 486
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487 487
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 			{
490 490
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 491
 			}
492
-			if(!$output->toBool())
492
+			if (!$output->toBool())
493 493
 			{
494 494
 				return $output;
495 495
 			}
@@ -506,29 +506,29 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		$vars = Context::getRequestVars();
508 508
 
509
-		if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request');
509
+		if (!$vars->module_srls) return new BaseObject(-1, 'msg_invalid_request');
510 510
 
511
-		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request');
511
+		$module_srls = explode(',', $vars->module_srls);
512
+		if (count($module_srls) < 1) return new BaseObject(-1, 'msg_invalid_request');
513 513
 
514 514
 		$oModuleModel = getModel('module');
515
-		$oModuleController= getController('module');
515
+		$oModuleController = getController('module');
516 516
 		$columnList = array('module_srl', 'module', 'menu_srl', 'site_srl', 'mid', 'browser_title', 'is_default', 'content', 'mcontent', 'open_rss', 'regdate');
517
-		$updateList = array('module_category_srl','layout_srl','skin','mlayout_srl','mskin','description','header_text','footer_text', 'use_mobile');
518
-		foreach($updateList as $key=>$val)
517
+		$updateList = array('module_category_srl', 'layout_srl', 'skin', 'mlayout_srl', 'mskin', 'description', 'header_text', 'footer_text', 'use_mobile');
518
+		foreach ($updateList as $key=>$val)
519 519
 		{
520
-			if(!strlen($vars->{$val}))
520
+			if (!strlen($vars->{$val}))
521 521
 			{
522 522
 				unset($updateList[$key]);
523 523
 				$columnList[] = $val;
524 524
 			}
525 525
 		}
526 526
 
527
-		foreach($module_srls as $module_srl)
527
+		foreach ($module_srls as $module_srl)
528 528
 		{
529 529
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
530 530
 
531
-			foreach($updateList as $val)
531
+			foreach ($updateList as $val)
532 532
 			{
533 533
 				$module_info->{$val} = $vars->{$val};
534 534
 			}
@@ -536,9 +536,9 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->setMessage('success_registed');
539
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
539
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
540 540
 		{
541
-			if(Context::get('success_return_url'))
541
+			if (Context::get('success_return_url'))
542 542
 			{
543 543
 				$this->setRedirectUrl(Context::get('success_return_url'));
544 544
 			}
@@ -561,10 +561,10 @@  discard block
 block discarded – undo
561 561
 	function procModuleAdminModuleGrantSetup()
562 562
 	{
563 563
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
564
+		if (!$module_srls) return new BaseObject(-1, 'msg_invalid_request');
565 565
 
566
-		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request');
566
+		$modules = explode(',', $module_srls);
567
+		if (count($modules) < 1) return new BaseObject(-1, 'msg_invalid_request');
568 568
 
569 569
 		$oModuleController = getController('module');
570 570
 		$oModuleModel = getModel('module');
@@ -581,13 +581,13 @@  discard block
 block discarded – undo
581 581
 
582 582
 		$grant = new stdClass;
583 583
 
584
-		foreach($grant_list as $grant_name => $grant_info)
584
+		foreach ($grant_list as $grant_name => $grant_info)
585 585
 		{
586 586
 			// Get the default value
587 587
 			$default = Context::get($grant_name.'_default');
588 588
 			// -1 = Sign only, 0 = all users
589 589
 			$grant->{$grant_name} = array();
590
-			if(strlen($default))
590
+			if (strlen($default))
591 591
 			{
592 592
 				$grant->{$grant_name}[] = $default;
593 593
 				continue;
@@ -596,12 +596,12 @@  discard block
 block discarded – undo
596 596
 			else
597 597
 			{
598 598
 				$group_srls = Context::get($grant_name);
599
-				if($group_srls)
599
+				if ($group_srls)
600 600
 				{
601
-					if(!is_array($group_srls))
601
+					if (!is_array($group_srls))
602 602
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
603
+						if (strpos($group_srls, '|@|') !== false) $group_srls = explode('|@|', $group_srls);
604
+						elseif (strpos($group_srls, ',') !== false) $group_srls = explode(',', $group_srls);
605 605
 						else $group_srls = array($group_srls);
606 606
 					}
607 607
 					$grant->{$grant_name} = $group_srls;
@@ -612,30 +612,30 @@  discard block
 block discarded – undo
612 612
 		}
613 613
 
614 614
 		// Stored in the DB
615
-		foreach($modules as $module_srl)
615
+		foreach ($modules as $module_srl)
616 616
 		{
617 617
 			$args = new stdClass();
618 618
 			$args->module_srl = $module_srl;
619 619
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
620
+			if (!$output->toBool()) continue;
621 621
 			// Permissions stored in the DB
622
-			foreach($grant as $grant_name => $group_srls)
622
+			foreach ($grant as $grant_name => $group_srls)
623 623
 			{
624
-				foreach($group_srls as $val)
624
+				foreach ($group_srls as $val)
625 625
 				{
626 626
 					$args = new stdClass();
627 627
 					$args->module_srl = $module_srl;
628 628
 					$args->name = $grant_name;
629 629
 					$args->group_srl = $val;
630 630
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
631
+					if (!$output->toBool()) return $output;
632 632
 				}
633 633
 			}
634 634
 		}
635 635
 		$this->setMessage('success_registed');
636
-		if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON')))
636
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
637 637
 		{
638
-			if(Context::get('success_return_url'))
638
+			if (Context::get('success_return_url'))
639 639
 			{
640 640
 				$this->setRedirectUrl(Context::get('success_return_url'));
641 641
 			}
@@ -662,38 +662,38 @@  discard block
 block discarded – undo
662 662
 		$target = Context::get('target');
663 663
 		$module = Context::get('module');
664 664
 		$args = new stdClass();
665
-		$args->site_srl = (int)$site_module_info->site_srl;
666
-		$args->name = str_replace(' ','_',Context::get('lang_code'));
667
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
665
+		$args->site_srl = (int) $site_module_info->site_srl;
666
+		$args->name = str_replace(' ', '_', Context::get('lang_code'));
667
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
668
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
669 669
 
670 670
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
671
+		if (empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
672 672
 
673
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
673
+		if (!$args->name) return new BaseObject(-1, 'msg_invalid_request');
674 674
 		// Check whether a language code exists
675 675
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
676
+		if (!$output->toBool()) return $output;
677 677
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
678
+		if ($output->data) $output = executeQuery('module.deleteLang', $args);
679
+		if (!$output->toBool()) return $output;
680 680
 		// Enter
681 681
 		$lang_supported = Context::get('lang_supported');
682
-		foreach($lang_supported as $key => $val)
682
+		foreach ($lang_supported as $key => $val)
683 683
 		{
684 684
 			$args->lang_code = $key;
685 685
 			$args->value = trim(Context::get($key));
686 686
 
687 687
 			// if request method is json, strip slashes
688
-			if(Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
688
+			if (Context::getRequestMethod() == 'JSON' && version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
689 689
 			{
690 690
 				$args->value = stripslashes($args->value);
691 691
 			}
692 692
 
693
-			if($args->value)
693
+			if ($args->value)
694 694
 			{
695 695
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
696
+				if (!$output->toBool()) return $output;
697 697
 			}
698 698
 		}
699 699
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -713,14 +713,14 @@  discard block
 block discarded – undo
713 713
 		// Get language code
714 714
 		$site_module_info = Context::get('site_module_info');
715 715
 		$args = new stdClass();
716
-		$args->site_srl = (int)$site_module_info->site_srl;
717
-		$args->name = str_replace(' ','_',Context::get('name'));
718
-		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
716
+		$args->site_srl = (int) $site_module_info->site_srl;
717
+		$args->name = str_replace(' ', '_', Context::get('name'));
718
+		$args->lang_name = str_replace(' ', '_', Context::get('lang_name'));
719
+		if (!empty($args->lang_name)) $args->name = $args->lang_name;
720
+		if (!$args->name) return new BaseObject(-1, 'msg_invalid_request');
721 721
 
722 722
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
723
+		if (!$output->toBool()) return $output;
724 724
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 725
 
726 726
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 
732 732
 	function procModuleAdminGetList()
733 733
 	{
734
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
734
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
735 735
 
736 736
 		$oModuleController = getController('module');
737 737
 		$oModuleModel = getModel('module');
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
 		$args = new stdClass;
745 745
 		$logged_info = Context::get('logged_info');
746 746
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
747
+		if ($site_keyword) $args->site_keyword = $site_keyword;
748 748
 
749
-		if(!$site_srl)
749
+		if (!$site_srl)
750 750
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
751
+			if ($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
+			else $args->site_srl = (int) $site_module_info->site_srl;
753 753
 		}
754 754
 		else $args->site_srl = $site_srl;
755 755
 
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
 		// Get a list of modules at the site
760 760
 		$output = executeQueryArray('module.getSiteModules', $args);
761 761
 		$mid_list = array();
762
-		if(count($output->data) > 0)
762
+		if (count($output->data) > 0)
763 763
 		{
764
-			foreach($output->data as $val)
764
+			foreach ($output->data as $val)
765 765
 			{
766 766
 				$module = trim($val->module);
767
-				if(!$module) continue;
767
+				if (!$module) continue;
768 768
 
769 769
 				// replace user defined lang.
770 770
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 				$obj->browser_title = $val->browser_title;
776 776
 				$obj->mid = $val->mid;
777 777
 				$obj->module_category_srl = $val->module_category_srl;
778
-				if($val->module_category_srl > 0)
778
+				if ($val->module_category_srl > 0)
779 779
 				{
780 780
 					$moduleCategorySrl[] = $val->module_category_srl;
781 781
 				}
@@ -787,23 +787,23 @@  discard block
 block discarded – undo
787 787
 		$moduleCategorySrl = array_unique($moduleCategorySrl);
788 788
 		$output = $oModuleModel->getModuleCategories($moduleCategorySrl);
789 789
 		$categoryNameList = array();
790
-		if(is_array($output))
790
+		if (is_array($output))
791 791
 		{
792
-			foreach($output as $value)
792
+			foreach ($output as $value)
793 793
 			{
794 794
 				$categoryNameList[$value->module_category_srl] = $value->title;
795 795
 			}
796 796
 		}
797 797
 
798 798
 		$selected_module = Context::get('selected_module');
799
-		if(count($mid_list) > 0)
799
+		if (count($mid_list) > 0)
800 800
 		{
801
-			foreach($mid_list as $module => $val)
801
+			foreach ($mid_list as $module => $val)
802 802
 			{
803
-				if(!$selected_module) $selected_module = $module;
803
+				if (!$selected_module) $selected_module = $module;
804 804
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 805
 
806
-				if(!$xml_info)
806
+				if (!$xml_info)
807 807
 				{
808 808
 					unset($mid_list[$module]);
809 809
 					continue;
@@ -812,14 +812,14 @@  discard block
 block discarded – undo
812 812
 				$mid_list[$module]->title = $xml_info->title;
813 813
 
814 814
 				// change module category srl to title
815
-				if(is_array($val->list))
815
+				if (is_array($val->list))
816 816
 				{
817
-					foreach($val->list as $key=>$value)
817
+					foreach ($val->list as $key=>$value)
818 818
 					{
819
-						if($value->module_category_srl > 0)
819
+						if ($value->module_category_srl > 0)
820 820
 						{
821 821
 							$categorySrl = $mid_list[$module]->list[$key]->module_category_srl;
822
-							if(isset($categoryNameList[$categorySrl]))
822
+							if (isset($categoryNameList[$categorySrl]))
823 823
 							{
824 824
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 825
 							}
@@ -847,20 +847,20 @@  discard block
 block discarded – undo
847 847
 		$args = new stdClass();
848 848
 
849 849
 		// Get the language file of the current site
850
-		if(!$site_srl)
850
+		if (!$site_srl)
851 851
 		{
852 852
 			$site_module_info = Context::get('site_module_info');
853
-			$args->site_srl = (int)$site_module_info->site_srl;
853
+			$args->site_srl = (int) $site_module_info->site_srl;
854 854
 		}
855 855
 		else
856 856
 		{
857 857
 			$args->site_srl = $site_srl;
858 858
 		}
859 859
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
860
+		if (!$output->toBool() || !$output->data) return;
861 861
 
862 862
 		$langMap = array();
863
-		foreach($output->data as $lang)
863
+		foreach ($output->data as $lang)
864 864
 		{
865 865
 			$langMap[$lang->lang_code][$lang->name] = $lang->value;
866 866
 		}
@@ -869,29 +869,29 @@  discard block
 block discarded – undo
869 869
 		$dbInfo = Context::getDBInfo();
870 870
 		$defaultLang = $dbInfo->lang_type;
871 871
 
872
-		if(!is_array($langMap[$defaultLang]))
872
+		if (!is_array($langMap[$defaultLang]))
873 873
 		{
874 874
 			$langMap[$defaultLang] = array();
875 875
 		}
876 876
 
877 877
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
878 878
 
879
-		foreach($lang_supported as $langCode => $langName)
879
+		foreach ($lang_supported as $langCode => $langName)
880 880
 		{
881
-			if(!is_array($langMap[$langCode]))
881
+			if (!is_array($langMap[$langCode]))
882 882
 			{
883 883
 				$langMap[$langCode] = array();
884 884
 			}
885 885
 
886 886
 			$langMap[$langCode] += $langMap[$defaultLang];
887
-			foreach($lang_supported as $targetLangCode => $targetLangName)
887
+			foreach ($lang_supported as $targetLangCode => $targetLangName)
888 888
 			{
889
-				if($langCode == $targetLangCode || $langCode == $defaultLang)
889
+				if ($langCode == $targetLangCode || $langCode == $defaultLang)
890 890
 				{
891 891
 					continue;
892 892
 				}
893 893
 
894
-				if(!is_array($langMap[$targetLangCode]))
894
+				if (!is_array($langMap[$targetLangCode]))
895 895
 				{
896 896
 					$langMap[$targetLangCode] = array();
897 897
 				}
@@ -899,9 +899,9 @@  discard block
 block discarded – undo
899 899
 				$langMap[$langCode] += $langMap[$targetLangCode];
900 900
 			}
901 901
 
902
-			if($oCacheHandler->isSupport())
902
+			if ($oCacheHandler->isSupport())
903 903
 			{
904
-				$object_key = 'user_defined_langs:' . $args->site_srl . ':' . $langCode;
904
+				$object_key = 'user_defined_langs:'.$args->site_srl.':'.$langCode;
905 905
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
906 906
 				$oCacheHandler->put($cache_key, $langMap[$langCode]);
907 907
 			}
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 
923 923
 		$isSkinFix = Context::get('is_skin_fix');
924 924
 
925
-		if($isSkinFix)
925
+		if ($isSkinFix)
926 926
 		{
927 927
 			$isSkinFix = ($isSkinFix == 'N') ? 'N' : 'Y';
928 928
 		}
@@ -938,14 +938,14 @@  discard block
 block discarded – undo
938 938
 
939 939
 	public function setDesignInfo($moduleSrl = 0, $mid = '', $skinType = 'P', $layoutSrl = 0, $isSkinFix = 'Y', $skinName = '', $skinVars = NULL)
940 940
 	{
941
-		if(!$moduleSrl && !$mid)
941
+		if (!$moduleSrl && !$mid)
942 942
 		{
943 943
 			return $this->stop(-1, 'msg_invalid_request');
944 944
 		}
945 945
 
946 946
 		$oModuleModel = getModel('module');
947 947
 
948
-		if($mid)
948
+		if ($mid)
949 949
 		{
950 950
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
951 951
 		}
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
955 955
 		}
956 956
 
957
-		if(!$moduleInfo)
957
+		if (!$moduleInfo)
958 958
 		{
959 959
 			return $this->stop(-1, 'msg_module_not_exists');
960 960
 		}
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
 		$layoutTargetValue = ($skinType == 'M') ? 'mlayout_srl' : 'layout_srl';
964 964
 		$skinFixTargetValue = ($skinType == 'M') ? 'is_mskin_fix' : 'is_skin_fix';
965 965
 
966
-		if(strlen($layoutSrl))
966
+		if (strlen($layoutSrl))
967 967
 		{
968 968
 			$moduleInfo->{$layoutTargetValue} = $layoutSrl;
969 969
 		}
970 970
 
971
-		if(strlen($isSkinFix))
971
+		if (strlen($isSkinFix))
972 972
 		{
973 973
 			$moduleInfo->{$skinFixTargetValue} = $isSkinFix;
974 974
 		}
975 975
 
976
-		if($isSkinFix == 'Y')
976
+		if ($isSkinFix == 'Y')
977 977
 		{
978 978
 			$moduleInfo->{$skinTargetValue} = $skinName;
979 979
 			$skinVars = json_decode($skinVars);
980 980
 
981
-			if(is_array($skinVars))
981
+			if (is_array($skinVars))
982 982
 			{
983
-				foreach($skinVars as $key => $val)
983
+				foreach ($skinVars as $key => $val)
984 984
 				{
985
-					if(empty($val))
985
+					if (empty($val))
986 986
 					{
987 987
 						continue;
988 988
 					}
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 		$menuItemSrl = Context::get('menu_item_srl');
1004 1004
 		$useMobile = Context::get('use_mobile');
1005 1005
 
1006
-		if(!$menuItemSrl)
1006
+		if (!$menuItemSrl)
1007 1007
 		{
1008 1008
 			return $this->stop(-1, 'msg_invalid_request');
1009 1009
 		}
Please login to merge, or discard this patch.
Braces   +155 added lines, -79 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@  discard block
 block discarded – undo
22 22
 		$args = new stdClass();
23 23
 		$args->title = Context::get('title');
24 24
 		$output = executeQuery('module.insertModuleCategory', $args);
25
-		if(!$output->toBool()) return $output;
25
+		if(!$output->toBool()) {
26
+			return $output;
27
+		}
26 28
 
27 29
 		$this->setMessage("success_registed");
28 30
 
@@ -36,7 +38,9 @@  discard block
 block discarded – undo
36 38
 	function procModuleAdminUpdateCategory()
37 39
 	{
38 40
 		$output = $this->doUpdateModuleCategory();
39
-		if(!$output->toBool()) return $output;
41
+		if(!$output->toBool()) {
42
+			return $output;
43
+		}
40 44
 
41 45
 		$this->setMessage('success_updated');
42 46
 
@@ -50,7 +54,9 @@  discard block
 block discarded – undo
50 54
 	function procModuleAdminDeleteCategory()
51 55
 	{
52 56
 		$output = $this->doDeleteModuleCategory();
53
-		if(!$output->toBool()) return $output;
57
+		if(!$output->toBool()) {
58
+			return $output;
59
+		}
54 60
 
55 61
 		$this->setMessage('success_deleted');
56 62
 
@@ -91,8 +97,7 @@  discard block
 block discarded – undo
91 97
 			// Get information of the target module to copy
92 98
 			$module_srl = Context::get('module_srl');
93 99
 			$args = Context::getRequestVars();
94
-		}
95
-		else
100
+		} else
96 101
 		{
97 102
 			$module_srl = $args->module_srl;
98 103
 		}
@@ -107,11 +112,19 @@  discard block
 block discarded – undo
107 112
 		for($i=1;$i<=10;$i++)
108 113
 		{
109 114
 			$mid = trim($args->{"mid_".$i});
110
-			if(!$mid) continue;
111
-			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) return new BaseObject(-1, 'msg_limit_mid');
115
+			if(!$mid) {
116
+				continue;
117
+			}
118
+			if(!preg_match("/^[a-zA-Z]([a-zA-Z0-9_]*)$/i", $mid)) {
119
+				return new BaseObject(-1, 'msg_limit_mid');
120
+			}
112 121
 			$browser_title = $args->{"browser_title_".$i};
113
-			if(!$mid) continue;
114
-			if($mid && !$browser_title) $browser_title = $mid;
122
+			if(!$mid) {
123
+				continue;
124
+			}
125
+			if($mid && !$browser_title) {
126
+				$browser_title = $mid;
127
+			}
115 128
 			$clones[$mid] = $browser_title;
116 129
 		}
117 130
 		if(count($clones) < 1)
@@ -131,7 +144,9 @@  discard block
 block discarded – undo
131 144
 		$grant = array();
132 145
 		if($output->data)
133 146
 		{
134
-			foreach($output->data as $val) $grant[$val->name][] = $val->group_srl;
147
+			foreach($output->data as $val) {
148
+				$grant[$val->name][] = $val->group_srl;
149
+			}
135 150
 		}
136 151
 
137 152
 		// get Extra Vars
@@ -218,11 +233,19 @@  discard block
 block discarded – undo
218 233
 			}
219 234
 
220 235
 			// Grant module permissions
221
-			if(count($grant) > 0) $oModuleController->insertModuleGrants($module_srl, $grant);
222
-			if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
236
+			if(count($grant) > 0) {
237
+				$oModuleController->insertModuleGrants($module_srl, $grant);
238
+			}
239
+			if($extra_vars) {
240
+				$oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
241
+			}
223 242
 
224
-			if($moduleSkinVars) $oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
225
-			if($moduleMobileSkinVars) $oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
243
+			if($moduleSkinVars) {
244
+				$oModuleController->insertModuleSkinVars($module_srl, $moduleSkinVars);
245
+			}
246
+			if($moduleMobileSkinVars) {
247
+				$oModuleController->insertModuleMobileSkinVars($module_srl, $moduleMobileSkinVars);
248
+			}
226 249
 
227 250
 			$triggerObj->moduleSrlList[] = $module_srl;
228 251
 		}
@@ -235,8 +258,7 @@  discard block
 block discarded – undo
235 258
 		{
236 259
 			$message = implode('\n', $errorLog);
237 260
 			$this->setMessage($message);
238
-		}
239
-		else
261
+		} else
240 262
 		{
241 263
 			$message = $lang->success_registed;
242 264
 			$this->setMessage('success_registed');
@@ -262,9 +284,9 @@  discard block
 block discarded – undo
262 284
 
263 285
 	private function _returnByProc($isProc, $msg='msg_invalid_request')
264 286
 	{
265
-		if(!$isProc)
266
-			return;
267
-		else
287
+		if(!$isProc) {
288
+					return;
289
+		} else
268 290
 		{
269 291
 			return new BaseObject(-1, $msg);
270 292
 		}
@@ -282,7 +304,9 @@  discard block
 block discarded – undo
282 304
 		// Get information of the module
283 305
 		$columnList = array('module_srl', 'module');
284 306
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
285
-		if(!$module_info) return new BaseObject(-1,'msg_invalid_request');
307
+		if(!$module_info) {
308
+			return new BaseObject(-1,'msg_invalid_request');
309
+		}
286 310
 		// Register Admin ID
287 311
 		$oModuleController->deleteAdminId($module_srl);
288 312
 		$admin_member = Context::get('admin_member');
@@ -292,7 +316,9 @@  discard block
 block discarded – undo
292 316
 			foreach($admin_members as $admin_id)
293 317
 			{
294 318
 				$admin_id = trim($admin_id);
295
-				if(!$admin_id) continue;
319
+				if(!$admin_id) {
320
+					continue;
321
+				}
296 322
 				$oModuleController->insertAdminId($module_srl, $admin_id);
297 323
 			}
298 324
 		}
@@ -318,15 +344,18 @@  discard block
 block discarded – undo
318 344
 				$grant->{$grant_name}[] = $default;
319 345
 				continue;
320 346
 				// users in a particular group
321
-			}
322
-			else
347
+			} else
323 348
 			{
324 349
 				$group_srls = Context::get($grant_name);
325 350
 				if($group_srls)
326 351
 				{
327
-					if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
328
-					elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
329
-					else $group_srls = array($group_srls);
352
+					if(strpos($group_srls,'|@|')!==false) {
353
+						$group_srls = explode('|@|',$group_srls);
354
+					} elseif(strpos($group_srls,',')!==false) {
355
+						$group_srls = explode(',',$group_srls);
356
+					} else {
357
+						$group_srls = array($group_srls);
358
+					}
330 359
 					$grant->{$grant_name} = $group_srls;
331 360
 				}
332 361
 				continue;
@@ -338,7 +367,9 @@  discard block
 block discarded – undo
338 367
 		$args = new stdClass();
339 368
 		$args->module_srl = $module_srl;
340 369
 		$output = executeQuery('module.deleteModuleGrants', $args);
341
-		if(!$output->toBool()) return $output;
370
+		if(!$output->toBool()) {
371
+			return $output;
372
+		}
342 373
 		// Permissions stored in the DB
343 374
 		foreach($grant as $grant_name => $group_srls)
344 375
 		{
@@ -349,7 +380,9 @@  discard block
 block discarded – undo
349 380
 				$args->name = $grant_name;
350 381
 				$args->group_srl = $val;
351 382
 				$output = executeQuery('module.insertModuleGrant', $args);
352
-				if(!$output->toBool()) return $output;
383
+				if(!$output->toBool()) {
384
+					return $output;
385
+				}
353 386
 			}
354 387
 		}
355 388
 		$this->setMessage('success_registed');
@@ -375,19 +408,16 @@  discard block
 block discarded – undo
375 408
 				if($module_info->is_mskin_fix == 'Y')
376 409
 				{
377 410
 					$skin = $module_info->mskin;
378
-				}
379
-				else
411
+				} else
380 412
 				{
381 413
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M');
382 414
 				}
383
-			}
384
-			else
415
+			} else
385 416
 			{
386 417
 				if($module_info->is_skin_fix == 'Y')
387 418
 				{
388 419
 					$skin = $module_info->skin;
389
-				}
390
-				else
420
+				} else
391 421
 				{
392 422
 					$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P');
393 423
 				}
@@ -400,8 +430,7 @@  discard block
 block discarded – undo
400 430
 			{
401 431
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
402 432
 				$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
403
-			}
404
-			else
433
+			} else
405 434
 			{
406 435
 				$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
407 436
 				$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
@@ -421,7 +450,9 @@  discard block
 block discarded – undo
421 450
 			{
422 451
 				foreach($skin_info->extra_vars as $vars)
423 452
 				{
424
-					if($vars->type!='image') continue;
453
+					if($vars->type!='image') {
454
+						continue;
455
+					}
425 456
 
426 457
 					$image_obj = $obj->{$vars->name};
427 458
 					// Get a variable to delete
@@ -453,7 +484,9 @@  discard block
 block discarded – undo
453 484
 					// Upload the file to a path
454 485
 					$path = sprintf("./files/attach/images/%s/", $module_srl);
455 486
 					// Create a directory
456
-					if(!FileHandler::makeDir($path)) return false;
487
+					if(!FileHandler::makeDir($path)) {
488
+						return false;
489
+					}
457 490
 
458 491
 					$filename = $path.$image_obj['name'];
459 492
 					// Move the file
@@ -484,8 +517,7 @@  discard block
 block discarded – undo
484 517
 			if($mode === 'M')
485 518
 			{
486 519
 				$output = $oModuleController->insertModuleMobileSkinVars($module_srl, $obj);
487
-			}
488
-			else
520
+			} else
489 521
 			{
490 522
 				$output = $oModuleController->insertModuleSkinVars($module_srl, $obj);
491 523
 			}
@@ -506,10 +538,14 @@  discard block
 block discarded – undo
506 538
 	{
507 539
 		$vars = Context::getRequestVars();
508 540
 
509
-		if(!$vars->module_srls) return new BaseObject(-1,'msg_invalid_request');
541
+		if(!$vars->module_srls) {
542
+			return new BaseObject(-1,'msg_invalid_request');
543
+		}
510 544
 
511 545
 		$module_srls = explode(',',$vars->module_srls);
512
-		if(count($module_srls) < 1) return new BaseObject(-1,'msg_invalid_request');
546
+		if(count($module_srls) < 1) {
547
+			return new BaseObject(-1,'msg_invalid_request');
548
+		}
513 549
 
514 550
 		$oModuleModel = getModel('module');
515 551
 		$oModuleController= getController('module');
@@ -541,8 +577,7 @@  discard block
 block discarded – undo
541 577
 			if(Context::get('success_return_url'))
542 578
 			{
543 579
 				$this->setRedirectUrl(Context::get('success_return_url'));
544
-			}
545
-			else
580
+			} else
546 581
 			{
547 582
 				global $lang;
548 583
 				htmlHeader();
@@ -561,10 +596,14 @@  discard block
 block discarded – undo
561 596
 	function procModuleAdminModuleGrantSetup()
562 597
 	{
563 598
 		$module_srls = Context::get('module_srls');
564
-		if(!$module_srls) return new BaseObject(-1,'msg_invalid_request');
599
+		if(!$module_srls) {
600
+			return new BaseObject(-1,'msg_invalid_request');
601
+		}
565 602
 
566 603
 		$modules = explode(',',$module_srls);
567
-		if(count($modules) < 1) return new BaseObject(-1,'msg_invalid_request');
604
+		if(count($modules) < 1) {
605
+			return new BaseObject(-1,'msg_invalid_request');
606
+		}
568 607
 
569 608
 		$oModuleController = getController('module');
570 609
 		$oModuleModel = getModel('module');
@@ -592,17 +631,20 @@  discard block
 block discarded – undo
592 631
 				$grant->{$grant_name}[] = $default;
593 632
 				continue;
594 633
 				// Users in a particular group
595
-			}
596
-			else
634
+			} else
597 635
 			{
598 636
 				$group_srls = Context::get($grant_name);
599 637
 				if($group_srls)
600 638
 				{
601 639
 					if(!is_array($group_srls))
602 640
 					{
603
-						if(strpos($group_srls,'|@|')!==false) $group_srls = explode('|@|',$group_srls);
604
-						elseif(strpos($group_srls,',')!==false) $group_srls = explode(',',$group_srls);
605
-						else $group_srls = array($group_srls);
641
+						if(strpos($group_srls,'|@|')!==false) {
642
+							$group_srls = explode('|@|',$group_srls);
643
+						} elseif(strpos($group_srls,',')!==false) {
644
+							$group_srls = explode(',',$group_srls);
645
+						} else {
646
+							$group_srls = array($group_srls);
647
+						}
606 648
 					}
607 649
 					$grant->{$grant_name} = $group_srls;
608 650
 				}
@@ -617,7 +659,9 @@  discard block
 block discarded – undo
617 659
 			$args = new stdClass();
618 660
 			$args->module_srl = $module_srl;
619 661
 			$output = executeQuery('module.deleteModuleGrants', $args);
620
-			if(!$output->toBool()) continue;
662
+			if(!$output->toBool()) {
663
+				continue;
664
+			}
621 665
 			// Permissions stored in the DB
622 666
 			foreach($grant as $grant_name => $group_srls)
623 667
 			{
@@ -628,7 +672,9 @@  discard block
 block discarded – undo
628 672
 					$args->name = $grant_name;
629 673
 					$args->group_srl = $val;
630 674
 					$output = executeQuery('module.insertModuleGrant', $args);
631
-					if(!$output->toBool()) return $output;
675
+					if(!$output->toBool()) {
676
+						return $output;
677
+					}
632 678
 				}
633 679
 			}
634 680
 		}
@@ -638,8 +684,7 @@  discard block
 block discarded – undo
638 684
 			if(Context::get('success_return_url'))
639 685
 			{
640 686
 				$this->setRedirectUrl(Context::get('success_return_url'));
641
-			}
642
-			else
687
+			} else
643 688
 			{
644 689
 				global $lang;
645 690
 				htmlHeader();
@@ -665,18 +710,30 @@  discard block
 block discarded – undo
665 710
 		$args->site_srl = (int)$site_module_info->site_srl;
666 711
 		$args->name = str_replace(' ','_',Context::get('lang_code'));
667 712
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
668
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
713
+		if(!empty($args->lang_name)) {
714
+			$args->name = $args->lang_name;
715
+		}
669 716
 
670 717
 		// if args->name is empty, random generate for user define language
671
-		if(empty($args->name)) $args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
718
+		if(empty($args->name)) {
719
+			$args->name = 'userLang'.date('YmdHis').''.sprintf('%03d', mt_rand(0, 100));
720
+		}
672 721
 
673
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
722
+		if(!$args->name) {
723
+			return new BaseObject(-1,'msg_invalid_request');
724
+		}
674 725
 		// Check whether a language code exists
675 726
 		$output = executeQueryArray('module.getLang', $args);
676
-		if(!$output->toBool()) return $output;
727
+		if(!$output->toBool()) {
728
+			return $output;
729
+		}
677 730
 		// If exists, clear the old values for updating
678
-		if($output->data) $output = executeQuery('module.deleteLang', $args);
679
-		if(!$output->toBool()) return $output;
731
+		if($output->data) {
732
+			$output = executeQuery('module.deleteLang', $args);
733
+		}
734
+		if(!$output->toBool()) {
735
+			return $output;
736
+		}
680 737
 		// Enter
681 738
 		$lang_supported = Context::get('lang_supported');
682 739
 		foreach($lang_supported as $key => $val)
@@ -693,7 +750,9 @@  discard block
 block discarded – undo
693 750
 			if($args->value)
694 751
 			{
695 752
 				$output = executeQuery('module.insertLang', $args);
696
-				if(!$output->toBool()) return $output;
753
+				if(!$output->toBool()) {
754
+					return $output;
755
+				}
697 756
 			}
698 757
 		}
699 758
 		$this->makeCacheDefinedLangCode($args->site_srl);
@@ -716,11 +775,17 @@  discard block
 block discarded – undo
716 775
 		$args->site_srl = (int)$site_module_info->site_srl;
717 776
 		$args->name = str_replace(' ','_',Context::get('name'));
718 777
 		$args->lang_name = str_replace(' ','_',Context::get('lang_name'));
719
-		if(!empty($args->lang_name)) $args->name = $args->lang_name;
720
-		if(!$args->name) return new BaseObject(-1,'msg_invalid_request');
778
+		if(!empty($args->lang_name)) {
779
+			$args->name = $args->lang_name;
780
+		}
781
+		if(!$args->name) {
782
+			return new BaseObject(-1,'msg_invalid_request');
783
+		}
721 784
 
722 785
 		$output = executeQuery('module.deleteLang', $args);
723
-		if(!$output->toBool()) return $output;
786
+		if(!$output->toBool()) {
787
+			return $output;
788
+		}
724 789
 		$this->makeCacheDefinedLangCode($args->site_srl);
725 790
 
726 791
 		$this->setMessage("success_deleted", 'info');
@@ -731,7 +796,9 @@  discard block
 block discarded – undo
731 796
 
732 797
 	function procModuleAdminGetList()
733 798
 	{
734
-		if(!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
799
+		if(!Context::get('is_logged')) {
800
+			return new BaseObject(-1, 'msg_not_permitted');
801
+		}
735 802
 
736 803
 		$oModuleController = getController('module');
737 804
 		$oModuleModel = getModel('module');
@@ -744,14 +811,20 @@  discard block
 block discarded – undo
744 811
 		$args = new stdClass;
745 812
 		$logged_info = Context::get('logged_info');
746 813
 		$site_module_info = Context::get('site_module_info');
747
-		if($site_keyword) $args->site_keyword = $site_keyword;
814
+		if($site_keyword) {
815
+			$args->site_keyword = $site_keyword;
816
+		}
748 817
 
749 818
 		if(!$site_srl)
750 819
 		{
751
-			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) $args->site_srl = 0;
752
-			else $args->site_srl = (int)$site_module_info->site_srl;
820
+			if($logged_info->is_admin == 'Y' && !$site_keyword && !$vid) {
821
+				$args->site_srl = 0;
822
+			} else {
823
+				$args->site_srl = (int)$site_module_info->site_srl;
824
+			}
825
+		} else {
826
+			$args->site_srl = $site_srl;
753 827
 		}
754
-		else $args->site_srl = $site_srl;
755 828
 
756 829
 		$args->sort_index1 = 'sites.domain';
757 830
 
@@ -764,7 +837,9 @@  discard block
 block discarded – undo
764 837
 			foreach($output->data as $val)
765 838
 			{
766 839
 				$module = trim($val->module);
767
-				if(!$module) continue;
840
+				if(!$module) {
841
+					continue;
842
+				}
768 843
 
769 844
 				// replace user defined lang.
770 845
 				$oModuleController->replaceDefinedLangCode($val->browser_title);
@@ -800,7 +875,9 @@  discard block
 block discarded – undo
800 875
 		{
801 876
 			foreach($mid_list as $module => $val)
802 877
 			{
803
-				if(!$selected_module) $selected_module = $module;
878
+				if(!$selected_module) {
879
+					$selected_module = $module;
880
+				}
804 881
 				$xml_info = $oModuleModel->getModuleInfoXml($module);
805 882
 
806 883
 				if(!$xml_info)
@@ -823,8 +900,7 @@  discard block
 block discarded – undo
823 900
 							{
824 901
 								$mid_list[$module]->list[$key]->module_category_srl = $categoryNameList[$categorySrl];
825 902
 							}
826
-						}
827
-						else
903
+						} else
828 904
 						{
829 905
 							$mid_list[$module]->list[$key]->module_category_srl = Context::getLang('none_category');
830 906
 						}
@@ -851,13 +927,14 @@  discard block
 block discarded – undo
851 927
 		{
852 928
 			$site_module_info = Context::get('site_module_info');
853 929
 			$args->site_srl = (int)$site_module_info->site_srl;
854
-		}
855
-		else
930
+		} else
856 931
 		{
857 932
 			$args->site_srl = $site_srl;
858 933
 		}
859 934
 		$output = executeQueryArray('module.getLang', $args);
860
-		if(!$output->toBool() || !$output->data) return;
935
+		if(!$output->toBool() || !$output->data) {
936
+			return;
937
+		}
861 938
 
862 939
 		$langMap = array();
863 940
 		foreach($output->data as $lang)
@@ -948,8 +1025,7 @@  discard block
 block discarded – undo
948 1025
 		if($mid)
949 1026
 		{
950 1027
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($mid);
951
-		}
952
-		else
1028
+		} else
953 1029
 		{
954 1030
 			$moduleInfo = $oModuleModel->getModuleInfoByModuleSrl($moduleSrl);
955 1031
 		}
Please login to merge, or discard this patch.
modules/module/module.controller.php 2 patches
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		$output = executeQuery('module.insertActionForward', $args);
30 30
 
31 31
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
32
-		if($oCacheHandler->isSupport())
32
+		if ($oCacheHandler->isSupport())
33 33
 		{
34 34
 			$cache_key = 'action_forward';
35 35
 			$oCacheHandler->delete($cache_key);
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$output = executeQuery('module.deleteActionForward', $args);
52 52
 
53 53
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
54
-		if($oCacheHandler->isSupport())
54
+		if ($oCacheHandler->isSupport())
55 55
 		{
56 56
 			$cache_key = 'action_forward';
57 57
 			$oCacheHandler->delete($cache_key);
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		$args->called_position = $called_position;
76 76
 
77 77
 		$output = executeQuery('module.insertTrigger', $args);
78
-		if($output->toBool())
78
+		if ($output->toBool())
79 79
 		{
80 80
 			//remove from cache
81 81
 			$GLOBALS['__triggers__'] = NULL;
82 82
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
83
-			if($oCacheHandler->isSupport())
83
+			if ($oCacheHandler->isSupport())
84 84
 			{
85 85
 				$cache_key = 'triggers';
86 86
 				$oCacheHandler->delete($cache_key);
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 		$args->called_position = $called_position;
105 105
 
106 106
 		$output = executeQuery('module.deleteTrigger', $args);
107
-		if($output->toBool())
107
+		if ($output->toBool())
108 108
 		{
109 109
 			//remove from cache
110 110
 			$GLOBALS['__triggers__'] = NULL;
111 111
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
112
-			if($oCacheHandler->isSupport())
112
+			if ($oCacheHandler->isSupport())
113 113
 			{
114 114
 				$cache_key = 'triggers';
115 115
 				$oCacheHandler->delete($cache_key);
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 		$args->module = $module;
130 130
 
131 131
 		$output = executeQuery('module.deleteModuleTriggers', $args);
132
-		if($output->toBool())
132
+		if ($output->toBool())
133 133
 		{
134 134
 			//remove from cache
135 135
 			$GLOBALS['__triggers__'] = NULL;
136 136
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
137
-			if($oCacheHandler->isSupport())
137
+			if ($oCacheHandler->isSupport())
138 138
 			{
139 139
 				$cache_key = 'triggers';
140 140
 				$oCacheHandler->delete($cache_key);
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	 * @brief Add module extend
149 149
 	 *
150 150
 	 */
151
-	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
151
+	function insertModuleExtend($parent_module, $extend_module, $type, $kind = '')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if ($kind != 'admin') $kind = '';
154
+		if (!in_array($type, array('model', 'controller', 'view', 'api', 'mobile'))) return false;
155
+		if (in_array($parent_module, array('module', 'addon', 'widget', 'layout'))) return false;
156 156
 
157 157
 		$cache_file = './files/config/module_extend.php';
158 158
 		FileHandler::removeFile($cache_file);
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$args->kind = $kind;
165 165
 
166 166
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
167
+		if ($output->data->count > 0) return false;
168 168
 
169 169
 		$output = executeQuery('module.insertModuleExtend', $args);
170 170
 		return $output;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @brief Delete module extend
175 175
 	 *
176 176
 	 */
177
-	function deleteModuleExtend($parent_module, $extend_module, $type, $kind='')
177
+	function deleteModuleExtend($parent_module, $extend_module, $type, $kind = '')
178 178
 	{
179 179
 		$cache_file = './files/config/module_extend.php';
180 180
 		FileHandler::removeFile($cache_file);
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 		$oModuleModel = getModel('module');
200 200
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 201
 
202
-		if(!$origin_config) $origin_config = new stdClass;
202
+		if (!$origin_config) $origin_config = new stdClass;
203 203
 
204
-		foreach($config as $key => $val)
204
+		foreach ($config as $key => $val)
205 205
 		{
206 206
 			$origin_config->{$key} = $val;
207 207
 		}
@@ -215,19 +215,19 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	function insertModuleConfig($module, $config, $site_srl = 0)
217 217
 	{
218
-		$args =new stdClass();
218
+		$args = new stdClass();
219 219
 		$args->module = $module;
220 220
 		$args->config = serialize($config);
221 221
 		$args->site_srl = $site_srl;
222 222
 
223 223
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
224
+		if (!$output->toBool()) return $output;
225 225
 
226 226
 		$output = executeQuery('module.insertModuleConfig', $args);
227 227
 
228 228
 		//remove from cache
229 229
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
230
-		if($oCacheHandler->isSupport())
230
+		if ($oCacheHandler->isSupport())
231 231
 		{
232 232
 			$oCacheHandler->invalidateGroupKey('site_and_module');
233 233
 		}
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 		$args->config = serialize($config);
247 247
 
248 248
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
249
+		if (!$output->toBool()) return $output;
250 250
 
251 251
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 252
 
253 253
 		//remove from cache
254 254
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
255
-		if($oCacheHandler->isSupport())
255
+		if ($oCacheHandler->isSupport())
256 256
 		{
257 257
 			$oCacheHandler->invalidateGroupKey('site_and_module');
258 258
 		}
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	function insertSite($domain, $index_module_srl)
267 267
 	{
268
-		if(isSiteID($domain))
268
+		if (isSiteID($domain))
269 269
 		{
270 270
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid');
271
+			if ($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1, 'msg_already_registed_vid');
272 272
 		}
273 273
 		else
274 274
 		{
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 		$columnList = array('modules.site_srl');
285 285
 		$oModuleModel = getModel('module');
286 286
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new BaseObject(-1,'msg_already_registed_vid');
287
+		if ($output) return new BaseObject(-1, 'msg_already_registed_vid');
288 288
 
289 289
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
290
+		if (!$output->toBool()) return $output;
291 291
 
292 292
 		$output->add('site_srl', $args->site_srl);
293 293
 		return $output;
@@ -302,32 +302,32 @@  discard block
 block discarded – undo
302 302
 		$columnList = array('sites.site_srl', 'sites.domain');
303 303
 		$site_info = $oModuleModel->getSiteInfo($args->site_srl, $columnList);
304 304
 
305
-		if(!$args->domain && $site_info->site_srl == $args->site_srl)
305
+		if (!$args->domain && $site_info->site_srl == $args->site_srl)
306 306
 		{
307 307
 			$args->domain = $site_info->domain;
308 308
 		}
309 309
 
310
-		if($site_info->domain != $args->domain)
310
+		if ($site_info->domain != $args->domain)
311 311
 		{
312 312
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid');
313
+			if ($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1, 'msg_already_registed_domain');
314
+			if (isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1, 'msg_already_registed_vid');
315 315
 
316
-			if($args->domain && !isSiteID($args->domain))
316
+			if ($args->domain && !isSiteID($args->domain))
317 317
 			{
318 318
 				$args->domain = (strlen($args->domain) >= 1 && substr_compare($args->domain, '/', -1) === 0) ? substr($args->domain, 0, -1) : $args->domain;
319 319
 			}
320 320
 		}
321 321
 		$output = executeQuery('module.updateSite', $args);
322 322
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
323
+		if ($args->site_srl == 0) $vid = '';
324
+		else $vid = $args->domain;
325 325
 
326 326
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 327
 		$mid = $module_info->mid;
328 328
 
329 329
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
330
-		if($oCacheHandler->isSupport())
330
+		if ($oCacheHandler->isSupport())
331 331
 		{
332 332
 			$oCacheHandler->invalidateGroupKey('site_and_module');
333 333
 		}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		unset($args->act);
346 346
 		unset($args->page);
347 347
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid');
348
+		if (!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid');
349 349
 		// Test variables (separate basic vars and other vars in modules)
350 350
 		$extra_vars = clone($args);
351 351
 		unset($extra_vars->module_srl);
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function insertModule($args)
381 381
 	{
382
-		if(isset($args->isMenuCreate))
382
+		if (isset($args->isMenuCreate))
383 383
 		{
384 384
 			$isMenuCreate = $args->isMenuCreate;
385 385
 		}
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 		}
390 390
 
391 391
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
392
+		if (!$output->toBool()) return $output;
393 393
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
394
+		if (!$args->site_srl) $args->site_srl = 0;
395 395
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists');
396
+		if ($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists');
397 397
 
398 398
 		// begin transaction
399 399
 		$oDB = &DB::getInstance();
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 		$skin_vars = new stdClass();
405 405
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 406
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
407
+		if (!$args->module_srl) $args->module_srl = getNextSequence();
408 408
 
409 409
 		// default value
410
-		if($args->skin == '/USE_DEFAULT/')
410
+		if ($args->skin == '/USE_DEFAULT/')
411 411
 		{
412 412
 			$args->is_skin_fix = 'N';
413 413
 		}
414 414
 		else
415 415
 		{
416
-			if(isset($args->is_skin_fix))
416
+			if (isset($args->is_skin_fix))
417 417
 			{
418 418
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419 419
 			}
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 			}
424 424
 		}
425 425
 
426
-		if($args->mskin == '/USE_DEFAULT/')
426
+		if ($args->mskin == '/USE_DEFAULT/')
427 427
 		{
428 428
 			$args->is_mskin_fix = 'N';
429 429
 		}
430 430
 		else
431 431
 		{
432
-			if(isset($args->is_mskin_fix))
432
+			if (isset($args->is_mskin_fix))
433 433
 			{
434 434
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435 435
 			}
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
 
444 444
 		$args->browser_title = strip_tags($args->browser_title);
445 445
 
446
-		if($isMenuCreate === TRUE)
446
+		if ($isMenuCreate === TRUE)
447 447
 		{
448 448
 			$menuArgs = new stdClass;
449 449
 			$menuArgs->menu_srl = $args->menu_srl;
450 450
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
451 451
 
452 452
 			// if menu is not created, create menu also. and does not supported that in virtual site.
453
-			if(!$menuOutput->data && !$args->site_srl)
453
+			if (!$menuOutput->data && !$args->site_srl)
454 454
 			{
455 455
 				$oMenuAdminModel = getAdminModel('menu');
456 456
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 				$menuArgs->listorder = $args->menu_item_srl * -1;
469 469
 
470 470
 				$menuItemOutput = executeQuery('menu.insertMenuItem', $menuArgs);
471
-				if(!$menuItemOutput->toBool())
471
+				if (!$menuItemOutput->toBool())
472 472
 				{
473 473
 					$oDB->rollback();
474 474
 					return $menuItemOutput;
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
 		// Insert a module
482 482
 		$args->menu_srl = $menuArgs->menu_srl;
483 483
 		$output = executeQuery('module.insertModule', $args);
484
-		if(!$output->toBool())
484
+		if (!$output->toBool())
485 485
 		{
486 486
 			$oDB->rollback();
487 487
 			return $output;
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 		$oDB->commit();
494 494
 
495 495
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
496
-		if($oCacheHandler->isSupport())
496
+		if ($oCacheHandler->isSupport())
497 497
 		{
498 498
 			$oCacheHandler->invalidateGroupKey('site_and_module');
499 499
 		}
500 500
 
501
-		$output->add('module_srl',$args->module_srl);
501
+		$output->add('module_srl', $args->module_srl);
502 502
 		return $output;
503 503
 	}
504 504
 
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	function updateModule($args)
509 509
 	{
510
-		if(isset($args->isMenuCreate))
510
+		if (isset($args->isMenuCreate))
511 511
 		{
512 512
 			$isMenuCreate = $args->isMenuCreate;
513 513
 		}
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 		}
518 518
 		
519 519
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
520
-		if(!$output->toBool()) return $output;
520
+		if (!$output->toBool()) return $output;
521 521
 		// begin transaction
522 522
 		$oDB = &DB::getInstance();
523 523
 		$oDB->begin();
@@ -526,29 +526,29 @@  discard block
 block discarded – undo
526 526
 		$columnList = array('module_srl', 'site_srl', 'browser_title', 'mid');
527 527
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
528 528
 
529
-		if(!$args->site_srl || !$args->browser_title)
529
+		if (!$args->site_srl || !$args->browser_title)
530 530
 		{
531
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
532
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
531
+			if (!$args->site_srl) $args->site_srl = (int) $module_info->site_srl;
532
+			if (!$args->browser_title) $args->browser_title = $module_info->browser_title;
533 533
 		}
534 534
 
535 535
 		$args->browser_title = strip_tags($args->browser_title);
536 536
 
537 537
 		$output = executeQuery('module.isExistsModuleName', $args);
538
-		if(!$output->toBool() || $output->data->count)
538
+		if (!$output->toBool() || $output->data->count)
539 539
 		{
540 540
 			$oDB->rollback();
541 541
 			return new BaseObject(-1, 'msg_module_name_exists');
542 542
 		}
543 543
 
544 544
 		// default value
545
-		if($args->skin == '/USE_DEFAULT/')
545
+		if ($args->skin == '/USE_DEFAULT/')
546 546
 		{
547 547
 			$args->is_skin_fix = 'N';
548 548
 		}
549 549
 		else
550 550
 		{
551
-			if(isset($args->is_skin_fix))
551
+			if (isset($args->is_skin_fix))
552 552
 			{
553 553
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
554 554
 			}
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 			}
559 559
 		}
560 560
 
561
-		if($args->mskin == '/USE_DEFAULT/')
561
+		if ($args->mskin == '/USE_DEFAULT/')
562 562
 		{
563 563
 			$args->is_mskin_fix = 'N';
564 564
 		}
565 565
 		else
566 566
 		{
567
-			if(isset($args->is_mskin_fix))
567
+			if (isset($args->is_mskin_fix))
568 568
 			{
569 569
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
570 570
 			}
@@ -574,27 +574,27 @@  discard block
 block discarded – undo
574 574
 			}
575 575
 		}
576 576
 		$output = executeQuery('module.updateModule', $args);
577
-		if(!$output->toBool())
577
+		if (!$output->toBool())
578 578
 		{
579 579
 			$oDB->rollback();
580 580
 			return $output;
581 581
 		}
582 582
 
583
-		if($isMenuCreate === TRUE)
583
+		if ($isMenuCreate === TRUE)
584 584
 		{
585 585
 			$menuArgs = new stdClass;
586 586
 			$menuArgs->url = $module_info->mid;
587 587
 			$menuArgs->site_srl = $module_info->site_srl;
588 588
 			$menuOutput = executeQueryArray('menu.getMenuItemByUrl', $menuArgs);
589
-			if($menuOutput->data && count($menuOutput->data))
589
+			if ($menuOutput->data && count($menuOutput->data))
590 590
 			{
591 591
 				$oMenuAdminController = getAdminController('menu');
592
-				foreach($menuOutput->data as $itemInfo)
592
+				foreach ($menuOutput->data as $itemInfo)
593 593
 				{
594 594
 					$itemInfo->url = $args->mid;
595 595
 	
596 596
 					$updateMenuItemOutput = $oMenuAdminController->updateMenuItem($itemInfo);
597
-					if(!$updateMenuItemOutput->toBool())
597
+					if (!$updateMenuItemOutput->toBool())
598 598
 					{
599 599
 						$oDB->rollback();
600 600
 						return $updateMenuItemOutput;
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		}
605 605
 
606 606
 		// if mid changed, change mid of success_return_url to new mid
607
-		if($module_info->mid != $args->mid && Context::get('success_return_url'))
607
+		if ($module_info->mid != $args->mid && Context::get('success_return_url'))
608 608
 		{
609 609
 			changeValueInUrl('mid', $args->mid, $module_info->mid);
610 610
 		}
@@ -614,11 +614,11 @@  discard block
 block discarded – undo
614 614
 
615 615
 		$oDB->commit();
616 616
 
617
-		$output->add('module_srl',$args->module_srl);
617
+		$output->add('module_srl', $args->module_srl);
618 618
 
619 619
 		//remove from cache
620 620
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
621
-		if($oCacheHandler->isSupport())
621
+		if ($oCacheHandler->isSupport())
622 622
 		{
623 623
 			$oCacheHandler->invalidateGroupKey('site_and_module');
624 624
 		}
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 		$args->update_id = $update_id;
638 638
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
639 639
 
640
-		if(!!$output->error) return false;
640
+		if (!!$output->error) return false;
641 641
 
642 642
 		return true;
643 643
 	}
@@ -652,11 +652,11 @@  discard block
 block discarded – undo
652 652
 		$args->site_srl = $site_srl;
653 653
 		$args->layout_srl = $layout_srl;
654 654
 		$output = executeQuery('module.updateModuleSite', $args);
655
-		if(!$output->toBool()) return $output;
655
+		if (!$output->toBool()) return $output;
656 656
 
657 657
 		//remove from cache
658 658
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
659
-		if($oCacheHandler->isSupport())
659
+		if ($oCacheHandler->isSupport())
660 660
 		{
661 661
 			$oCacheHandler->invalidateGroupKey('site_and_module');
662 662
 		}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 */
672 672
 	function deleteModule($module_srl, $site_srl = 0)
673 673
 	{
674
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
674
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
675 675
 
676 676
 		$site_module_info = Context::get('site_module_info');
677 677
 
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		$args = new stdClass();
682 682
 		$args->url = $output->mid;
683 683
 		$args->is_shortcut = 'N';
684
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
684
+		if (!$site_srl) $args->site_srl = $site_module_info->site_srl;
685 685
 		else $args->site_srl = $site_srl;
686 686
 
687 687
 		unset($output);
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
 		$menuOutput = $oMenuAdminModel->getMenuList($args);
691 691
 
692 692
 		// get menu_srl by site_srl
693
-		if(is_array($menuOutput->data))
693
+		if (is_array($menuOutput->data))
694 694
 		{
695
-			foreach($menuOutput->data AS $key=>$value)
695
+			foreach ($menuOutput->data AS $key=>$value)
696 696
 			{
697 697
 				$args->menu_srl = $value->menu_srl;
698 698
 				break;
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
 		$output = executeQuery('menu.getMenuItemByUrl', $args);
703 703
 		// menu delete
704
-		if($output->data)
704
+		if ($output->data)
705 705
 		{
706 706
 			unset($args);
707 707
 			$args = new stdClass;
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			$oMenuAdminController = getAdminController('menu');
713 713
 			$output = $oMenuAdminController->deleteItem($args);
714 714
 
715
-			if($output->isSuccess)
715
+			if ($output->isSuccess)
716 716
 			{
717 717
 				return new BaseObject(0, 'success_deleted');
718 718
 			}
@@ -734,19 +734,19 @@  discard block
 block discarded – undo
734 734
 	 */
735 735
 	public function onlyDeleteModule($module_srl)
736 736
 	{
737
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
737
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
738 738
 
739 739
 		// check start module
740 740
 		$oModuleModel = getModel('module');
741 741
 		$columnList = array('sites.index_module_srl');
742 742
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
743
-		if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
743
+		if ($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
744 744
 
745 745
 		// Call a trigger (before)
746 746
 		$trigger_obj = new stdClass();
747 747
 		$trigger_obj->module_srl = $module_srl;
748 748
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
749
-		if(!$output->toBool()) return $output;
749
+		if (!$output->toBool()) return $output;
750 750
 
751 751
 		// begin transaction
752 752
 		$oDB = &DB::getInstance();
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		$args->module_srl = $module_srl;
757 757
 		// Delete module information from the DB
758 758
 		$output = executeQuery('module.deleteModule', $args);
759
-		if(!$output->toBool())
759
+		if (!$output->toBool())
760 760
 		{
761 761
 			$oDB->rollback();
762 762
 			return $output;
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 		// Remove the module manager
771 771
 		$this->deleteAdminId($module_srl);
772 772
 		// Call a trigger (after)
773
-		if($output->toBool())
773
+		if ($output->toBool())
774 774
 		{
775 775
 			$trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj);
776
-			if(!$trigger_output->toBool())
776
+			if (!$trigger_output->toBool())
777 777
 			{
778 778
 				$oDB->rollback();
779 779
 				return $trigger_output;
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 
786 786
 		//remove from cache
787 787
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
788
-		if($oCacheHandler->isSupport())
788
+		if ($oCacheHandler->isSupport())
789 789
 		{
790 790
 			$oCacheHandler->invalidateGroupKey('site_and_module');
791 791
 		}
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
 	function clearDefaultModule()
808 808
 	{
809 809
 		$output = executeQuery('module.clearDefaultModule');
810
-		if(!$output->toBool()) return $output;
810
+		if (!$output->toBool()) return $output;
811 811
 
812 812
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
813
-		if($oCacheHandler->isSupport())
813
+		if ($oCacheHandler->isSupport())
814 814
 		{
815 815
 			$oCacheHandler->invalidateGroupKey('site_and_module');
816 816
 		}
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		$output = executeQuery('module.updateModuleMenu', $args);
827 827
 
828 828
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
829
-		if($oCacheHandler->isSupport())
829
+		if ($oCacheHandler->isSupport())
830 830
 		{
831 831
 			$oCacheHandler->invalidateGroupKey('site_and_module');
832 832
 		}
@@ -839,15 +839,15 @@  discard block
 block discarded – undo
839 839
 	 */
840 840
 	function updateModuleLayout($layout_srl, $menu_srl_list)
841 841
 	{
842
-		if(!count($menu_srl_list)) return;
842
+		if (!count($menu_srl_list)) return;
843 843
 
844 844
 		$args = new stdClass;
845 845
 		$args->layout_srl = $layout_srl;
846
-		$args->menu_srls = implode(',',$menu_srl_list);
846
+		$args->menu_srls = implode(',', $menu_srl_list);
847 847
 		$output = executeQuery('module.updateModuleLayout', $args);
848 848
 
849 849
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
850
-		if($oCacheHandler->isSupport())
850
+		if ($oCacheHandler->isSupport())
851 851
 		{
852 852
 			$oCacheHandler->invalidateGroupKey('site_and_module');
853 853
 		}
@@ -866,37 +866,37 @@  discard block
 block discarded – undo
866 866
 
867 867
 		$output = executeQuery('module.deleteSiteAdmin', $args);
868 868
 
869
-		if(!$output->toBool()) return $output;
869
+		if (!$output->toBool()) return $output;
870 870
 		// Get user id of an administrator
871
-		if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
872
-		foreach($arr_admins as $key => $user_id)
871
+		if (!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
872
+		foreach ($arr_admins as $key => $user_id)
873 873
 		{
874
-			if(!trim($user_id)) continue;
874
+			if (!trim($user_id)) continue;
875 875
 			$admins[] = trim($user_id);
876 876
 		}
877
-		if(!count($admins)) return new BaseObject();
877
+		if (!count($admins)) return new BaseObject();
878 878
 
879 879
 		$oMemberModel = getModel('member');
880 880
 		$member_config = $oMemberModel->getMemberConfig();
881
-		if($member_config->identifier == 'email_address')
881
+		if ($member_config->identifier == 'email_address')
882 882
 		{
883
-			$args->email_address = '\''.implode('\',\'',$admins).'\'';
883
+			$args->email_address = '\''.implode('\',\'', $admins).'\'';
884 884
 		}
885 885
 		else
886 886
 		{
887
-			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
887
+			$args->user_ids = '\''.implode('\',\'', $admins).'\'';
888 888
 		}
889 889
 		$output = executeQueryArray('module.getAdminSrls', $args);
890
-		if(!$output->toBool()||!$output->data) return $output;
890
+		if (!$output->toBool() || !$output->data) return $output;
891 891
 
892
-		foreach($output->data as $key => $val)
892
+		foreach ($output->data as $key => $val)
893 893
 		{
894 894
 			unset($args);
895 895
 			$args = new stdClass;
896 896
 			$args->site_srl = $site_srl;
897 897
 			$args->member_srl = $val->member_srl;
898 898
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
899
-			if(!$output->toBool()) return $output;
899
+			if (!$output->toBool()) return $output;
900 900
 		}
901 901
 		return new BaseObject();
902 902
 	}
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 		$oMemberModel = getModel('member');
910 910
 		$member_config = $oMemberModel->getMemberConfig();
911 911
 
912
-		if($member_config->identifier == 'email_address')
912
+		if ($member_config->identifier == 'email_address')
913 913
 			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
914 914
 		else
915 915
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
916 916
 
917
-		if(!$member_info->member_srl) return;
917
+		if (!$member_info->member_srl) return;
918 918
 		$args = new stdClass();
919 919
 		$args->module_srl = $module_srl;
920 920
 		$args->member_srl = $member_info->member_srl;
@@ -929,11 +929,11 @@  discard block
 block discarded – undo
929 929
 		$args = new stdClass();
930 930
 		$args->module_srl = $module_srl;
931 931
 
932
-		if($admin_id)
932
+		if ($admin_id)
933 933
 		{
934 934
 			$oMemberModel = getModel('member');
935 935
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
936
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
936
+			if ($member_info->member_srl) $args->member_srl = $member_info->member_srl;
937 937
 		}
938 938
 		return executeQuery('module.deleteAdminId', $args);
939 939
 	}
@@ -970,18 +970,18 @@  discard block
 block discarded – undo
970 970
 		$oDB->begin();
971 971
 
972 972
 		$output = $this->_deleteModuleSkinVars($module_srl, $mode);
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			$oDB->rollback();
976 976
 			return $output;
977 977
 		}
978 978
 
979 979
 		getDestroyXeVars($obj);
980
-		if(!$obj || !count($obj)) return new BaseObject();
980
+		if (!$obj || !count($obj)) return new BaseObject();
981 981
 
982 982
 		$args = new stdClass;
983 983
 		$args->module_srl = $module_srl;
984
-		foreach($obj as $key => $val)
984
+		foreach ($obj as $key => $val)
985 985
 		{
986 986
 			// #17927989 For an old board which used the old blog module
987 987
 			// it often saved menu item(stdClass) on the skin info column
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
 
993 993
 			$args->name = trim($key);
994 994
 			$args->value = trim($val);
995
-			if(!$args->name || !$args->value) continue;
995
+			if (!$args->name || !$args->value) continue;
996 996
 
997
-			if($mode === 'P')
997
+			if ($mode === 'P')
998 998
 			{
999 999
 				$output = executeQuery('module.insertModuleSkinVars', $args);
1000 1000
 			}
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			{
1003 1003
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
1004 1004
 			}
1005
-			if(!$output->toBool())
1005
+			if (!$output->toBool())
1006 1006
 			{
1007 1007
 				return $output;
1008 1008
 				$oDB->rollback();
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
 		$args->module_srl = $module_srl;
1042 1042
 		$mode = $mode === 'P' ? 'P' : 'M';
1043 1043
 
1044
-		if($mode === 'P')
1044
+		if ($mode === 'P')
1045 1045
 		{
1046 1046
 			$object_key = 'module_skin_vars:'.$module_srl;
1047 1047
 			$query = 'module.deleteModuleSkinVars';
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		//remove from cache
1056 1056
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1057 1057
 		$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1058
-		if($oCacheHandler->isSupport())
1058
+		if ($oCacheHandler->isSupport())
1059 1059
 		{
1060 1060
 			$oCacheHandler->delete($cache_key);
1061 1061
 		}
@@ -1070,22 +1070,22 @@  discard block
 block discarded – undo
1070 1070
 	{
1071 1071
 		$this->deleteModuleExtraVars($module_srl);
1072 1072
 		getDestroyXeVars($obj);
1073
-		if(!$obj || !count($obj)) return;
1073
+		if (!$obj || !count($obj)) return;
1074 1074
 
1075
-		foreach($obj as $key => $val)
1075
+		foreach ($obj as $key => $val)
1076 1076
 		{
1077
-			if(is_object($val) || is_array($val)) continue;
1077
+			if (is_object($val) || is_array($val)) continue;
1078 1078
 
1079 1079
 			$args = new stdClass();
1080 1080
 			$args->module_srl = $module_srl;
1081 1081
 			$args->name = trim($key);
1082 1082
 			$args->value = trim($val);
1083
-			if(!$args->name || !$args->value) continue;
1083
+			if (!$args->name || !$args->value) continue;
1084 1084
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1085 1085
 		}
1086 1086
 
1087 1087
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1088
-		if($oCacheHandler->isSupport())
1088
+		if ($oCacheHandler->isSupport())
1089 1089
 		{
1090 1090
 			$object_key = 'module_extra_vars:'.$module_srl;
1091 1091
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 		//remove from cache
1106 1106
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1107
-		if($oCacheHandler->isSupport())
1107
+		if ($oCacheHandler->isSupport())
1108 1108
 		{
1109 1109
 			$object_key = 'module_extra_vars:'.$module_srl;
1110 1110
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1120,19 +1120,19 @@  discard block
 block discarded – undo
1120 1120
 	function insertModuleGrants($module_srl, $obj)
1121 1121
 	{
1122 1122
 		$this->deleteModuleGrants($module_srl);
1123
-		if(!$obj || !count($obj)) return;
1123
+		if (!$obj || !count($obj)) return;
1124 1124
 
1125
-		foreach($obj as $name => $val)
1125
+		foreach ($obj as $name => $val)
1126 1126
 		{
1127
-			if(!$val || !count($val)) continue;
1127
+			if (!$val || !count($val)) continue;
1128 1128
 
1129
-			foreach($val as $group_srl)
1129
+			foreach ($val as $group_srl)
1130 1130
 			{
1131 1131
 				$args = new stdClass();
1132 1132
 				$args->module_srl = $module_srl;
1133 1133
 				$args->name = $name;
1134 1134
 				$args->group_srl = trim($group_srl);
1135
-				if(!$args->name || !$args->group_srl) continue;
1135
+				if (!$args->name || !$args->group_srl) continue;
1136 1136
 				executeQuery('module.insertModuleGrant', $args);
1137 1137
 			}
1138 1138
 		}
@@ -1153,9 +1153,9 @@  discard block
 block discarded – undo
1153 1153
 	 */
1154 1154
 	function replaceDefinedLangCode(&$output, $isReplaceLangCode = true)
1155 1155
 	{
1156
-		if($isReplaceLangCode)
1156
+		if ($isReplaceLangCode)
1157 1157
 		{
1158
-			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output);
1158
+			$output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this, '_replaceLangCode'), $output);
1159 1159
 		}
1160 1160
 	}
1161 1161
 
@@ -1164,29 +1164,29 @@  discard block
 block discarded – undo
1164 1164
 		static $lang = false;
1165 1165
 
1166 1166
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1167
-		if($lang === false && $oCacheHandler->isSupport())
1167
+		if ($lang === false && $oCacheHandler->isSupport())
1168 1168
 		{
1169 1169
 			$site_module_info = Context::get('site_module_info');
1170
-			if(!$site_module_info)
1170
+			if (!$site_module_info)
1171 1171
 			{
1172 1172
 				$oModuleModel = getModel('module');
1173 1173
 				$site_module_info = $oModuleModel->getDefaultMid();
1174 1174
 				Context::set('site_module_info', $site_module_info);
1175 1175
 			}
1176 1176
 
1177
-			$object_key = 'user_defined_langs:' . $site_module_info->site_srl . ':' . Context::getLangType();
1177
+			$object_key = 'user_defined_langs:'.$site_module_info->site_srl.':'.Context::getLangType();
1178 1178
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1179 1179
 			$lang = $oCacheHandler->get($cache_key);
1180 1180
 
1181
-			if($lang === false) {
1181
+			if ($lang === false) {
1182 1182
 				$oModuleAdminController = getAdminController('module');
1183 1183
 				$lang = $oModuleAdminController->makeCacheDefinedLangCode($site_module_info->site_srl);
1184 1184
 			}
1185 1185
 		}
1186 1186
 
1187
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1187
+		if (!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1188 1188
 
1189
-		return str_replace('$user_lang->','',$matches[0]);
1189
+		return str_replace('$user_lang->', '', $matches[0]);
1190 1190
 	}
1191 1191
 
1192 1192
 
@@ -1199,17 +1199,17 @@  discard block
 block discarded – undo
1199 1199
 		if ($ajax) Context::setRequestMethod('JSON');
1200 1200
 
1201 1201
 		$logged_info = Context::get('logged_info');
1202
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1202
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1203 1203
 
1204
-		$vars = Context::gets('addfile','filter');
1204
+		$vars = Context::gets('addfile', 'filter');
1205 1205
 		$attributeNames = Context::get('attribute_name');
1206 1206
 		$attributeValues = Context::get('attribute_value');
1207
-		if(is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1207
+		if (is_array($attributeNames) && is_array($attributeValues) && count($attributeNames) == count($attributeValues))
1208 1208
 		{
1209 1209
 			$attributes = array();
1210
-			foreach($attributeNames as $no => $name)
1210
+			foreach ($attributeNames as $no => $name)
1211 1211
 			{
1212
-				if(empty($name))
1212
+				if (empty($name))
1213 1213
 				{
1214 1214
 					continue;
1215 1215
 				}
@@ -1221,16 +1221,16 @@  discard block
 block discarded – undo
1221 1221
 		$vars->comment = $attributes;
1222 1222
 		$module_filebox_srl = Context::get('module_filebox_srl');
1223 1223
 
1224
-		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1224
+		$ext = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1225 1225
 		$vars->ext = $ext;
1226
-		if($vars->filter) $filter = explode(',',$vars->filter);
1227
-		else $filter = array('jpg','jpeg','gif','png');
1228
-		if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured');
1226
+		if ($vars->filter) $filter = explode(',', $vars->filter);
1227
+		else $filter = array('jpg', 'jpeg', 'gif', 'png');
1228
+		if (!in_array($ext, $filter)) return new BaseObject(-1, 'msg_error_occured');
1229 1229
 
1230 1230
 		$vars->member_srl = $logged_info->member_srl;
1231 1231
 
1232 1232
 		// update
1233
-		if($module_filebox_srl > 0)
1233
+		if ($module_filebox_srl > 0)
1234 1234
 		{
1235 1235
 			$vars->module_filebox_srl = $module_filebox_srl;
1236 1236
 			$output = $this->updateModuleFileBox($vars);
@@ -1238,10 +1238,10 @@  discard block
 block discarded – undo
1238 1238
 		// insert
1239 1239
 		else
1240 1240
 		{
1241
-			if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1241
+			if (!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1242 1242
 			$addfile = Context::get('addfile');
1243
-			if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1244
-			if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1243
+			if (!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1244
+			if ($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1245 1245
 			$output = $this->insertModuleFileBox($vars);
1246 1246
 		}
1247 1247
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 		}
1256 1256
 		else
1257 1257
 		{
1258
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1258
+			if ($output) $this->add('save_filename', $output->get('save_filename'));
1259 1259
 			else $this->add('save_filename', '');
1260 1260
 		}
1261 1261
 	}
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 	{
1268 1268
 		$args = new stdClass;
1269 1269
 		// have file
1270
-		if($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1270
+		if ($vars->addfile['tmp_name'] && is_uploaded_file($vars->addfile['tmp_name']))
1271 1271
 		{
1272 1272
 			$oModuleModel = getModel('module');
1273 1273
 			$output = $oModuleModel->getModuleFileBox($vars->module_filebox_srl);
@@ -1276,18 +1276,18 @@  discard block
 block discarded – undo
1276 1276
 			$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1277 1277
 			FileHandler::makeDir($path);
1278 1278
 
1279
-			$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $ext);
1279
+			$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $ext);
1280 1280
 			$tmp = $vars->addfile['tmp_name'];
1281 1281
 
1282 1282
 			// Check uploaded file
1283
-			if(!checkUploadedFile($tmp)) return false;
1283
+			if (!checkUploadedFile($tmp)) return false;
1284 1284
 
1285
-			if(!@move_uploaded_file($tmp, $save_filename))
1285
+			if (!@move_uploaded_file($tmp, $save_filename))
1286 1286
 			{
1287 1287
 				return false;
1288 1288
 			}
1289 1289
 
1290
-			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1290
+			$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1291 1291
 			$args->filename = $save_filename;
1292 1292
 			$args->filesize = $vars->addfile['size'];
1293 1293
 		}
@@ -1313,14 +1313,14 @@  discard block
 block discarded – undo
1313 1313
 		$oModuleModel = getModel('module');
1314 1314
 		$path = $oModuleModel->getModuleFileBoxPath($vars->module_filebox_srl);
1315 1315
 		FileHandler::makeDir($path);
1316
-		$save_filename = sprintf('%s%s.%s',$path, $vars->module_filebox_srl, $vars->ext);
1316
+		$save_filename = sprintf('%s%s.%s', $path, $vars->module_filebox_srl, $vars->ext);
1317 1317
 		$tmp = $vars->addfile['tmp_name'];
1318 1318
 
1319 1319
 		// Check uploaded file
1320
-		if(!checkUploadedFile($tmp)) return false;
1320
+		if (!checkUploadedFile($tmp)) return false;
1321 1321
 
1322 1322
 		// upload
1323
-		if(!@move_uploaded_file($tmp, $save_filename))
1323
+		if (!@move_uploaded_file($tmp, $save_filename))
1324 1324
 		{
1325 1325
 			return false;
1326 1326
 		}
@@ -1331,7 +1331,7 @@  discard block
 block discarded – undo
1331 1331
 		$args->member_srl = $vars->member_srl;
1332 1332
 		$args->comment = $vars->comment;
1333 1333
 		$args->filename = $save_filename;
1334
-		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1334
+		$args->fileextension = strtolower(substr(strrchr($vars->addfile['name'], '.'), 1));
1335 1335
 		$args->filesize = $vars->addfile['size'];
1336 1336
 
1337 1337
 		$output = executeQuery('module.insertModuleFileBox', $args);
@@ -1346,14 +1346,14 @@  discard block
 block discarded – undo
1346 1346
 	function procModuleFileBoxDelete()
1347 1347
 	{
1348 1348
 		$logged_info = Context::get('logged_info');
1349
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1349
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1350 1350
 
1351 1351
 		$module_filebox_srl = Context::get('module_filebox_srl');
1352
-		if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1352
+		if (!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1353 1353
 		$vars = new stdClass();
1354 1354
 		$vars->module_filebox_srl = $module_filebox_srl;
1355 1355
 		$output = $this->deleteModuleFileBox($vars);
1356
-		if(!$output->toBool()) return $output;
1356
+		if (!$output->toBool()) return $output;
1357 1357
 	}
1358 1358
 
1359 1359
 	function deleteModuleFileBox($vars)
@@ -1376,11 +1376,11 @@  discard block
 block discarded – undo
1376 1376
 		$this->unlockTimeoutPassed();
1377 1377
 		$args = new stdClass;
1378 1378
 		$args->lock_name = $lock_name;
1379
-		if(!$timeout) $timeout = 60;
1379
+		if (!$timeout) $timeout = 60;
1380 1380
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1381
-		if($member_srl) $args->member_srl = $member_srl;
1381
+		if ($member_srl) $args->member_srl = $member_srl;
1382 1382
 		$output = executeQuery('module.insertLock', $args);
1383
-		if($output->toBool())
1383
+		if ($output->toBool())
1384 1384
 		{
1385 1385
 			$output->add('lock_name', $lock_name);
1386 1386
 			$output->add('deadline', $args->deadline);
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		$output = executeQuery('module.updateModuleInSites', $args);
1410 1410
 
1411 1411
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1412
-		if($oCacheHandler->isSupport())
1412
+		if ($oCacheHandler->isSupport())
1413 1413
 		{
1414 1414
 			$oCacheHandler->invalidateGroupKey('site_and_module');
1415 1415
 		}
Please login to merge, or discard this patch.
Braces   +221 added lines, -104 removed lines patch added patch discarded remove patch
@@ -150,9 +150,15 @@  discard block
 block discarded – undo
150 150
 	 */
151 151
 	function insertModuleExtend($parent_module, $extend_module, $type, $kind='')
152 152
 	{
153
-		if($kind != 'admin') $kind = '';
154
-		if(!in_array($type,array('model','controller','view','api','mobile'))) return false;
155
-		if(in_array($parent_module, array('module','addon','widget','layout'))) return false;
153
+		if($kind != 'admin') {
154
+			$kind = '';
155
+		}
156
+		if(!in_array($type,array('model','controller','view','api','mobile'))) {
157
+			return false;
158
+		}
159
+		if(in_array($parent_module, array('module','addon','widget','layout'))) {
160
+			return false;
161
+		}
156 162
 
157 163
 		$cache_file = './files/config/module_extend.php';
158 164
 		FileHandler::removeFile($cache_file);
@@ -164,7 +170,9 @@  discard block
 block discarded – undo
164 170
 		$args->kind = $kind;
165 171
 
166 172
 		$output = executeQuery('module.getModuleExtendCount', $args);
167
-		if($output->data->count>0) return false;
173
+		if($output->data->count>0) {
174
+			return false;
175
+		}
168 176
 
169 177
 		$output = executeQuery('module.insertModuleExtend', $args);
170 178
 		return $output;
@@ -199,7 +207,9 @@  discard block
 block discarded – undo
199 207
 		$oModuleModel = getModel('module');
200 208
 		$origin_config = $oModuleModel->getModuleConfig($module, $site_srl);
201 209
 
202
-		if(!$origin_config) $origin_config = new stdClass;
210
+		if(!$origin_config) {
211
+			$origin_config = new stdClass;
212
+		}
203 213
 
204 214
 		foreach($config as $key => $val)
205 215
 		{
@@ -221,7 +231,9 @@  discard block
 block discarded – undo
221 231
 		$args->site_srl = $site_srl;
222 232
 
223 233
 		$output = executeQuery('module.deleteModuleConfig', $args);
224
-		if(!$output->toBool()) return $output;
234
+		if(!$output->toBool()) {
235
+			return $output;
236
+		}
225 237
 
226 238
 		$output = executeQuery('module.insertModuleConfig', $args);
227 239
 
@@ -246,7 +258,9 @@  discard block
 block discarded – undo
246 258
 		$args->config = serialize($config);
247 259
 
248 260
 		$output = executeQuery('module.deleteModulePartConfig', $args);
249
-		if(!$output->toBool()) return $output;
261
+		if(!$output->toBool()) {
262
+			return $output;
263
+		}
250 264
 
251 265
 		$output = executeQuery('module.insertModulePartConfig', $args);
252 266
 
@@ -268,9 +282,10 @@  discard block
 block discarded – undo
268 282
 		if(isSiteID($domain))
269 283
 		{
270 284
 			$oModuleModel = getModel('module');
271
-			if($oModuleModel->isIDExists($domain, 0)) return new BaseObject(-1,'msg_already_registed_vid');
272
-		}
273
-		else
285
+			if($oModuleModel->isIDExists($domain, 0)) {
286
+				return new BaseObject(-1,'msg_already_registed_vid');
287
+			}
288
+		} else
274 289
 		{
275 290
 			$domain = strtolower($domain);
276 291
 		}
@@ -284,10 +299,14 @@  discard block
 block discarded – undo
284 299
 		$columnList = array('modules.site_srl');
285 300
 		$oModuleModel = getModel('module');
286 301
 		$output = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
287
-		if($output) return new BaseObject(-1,'msg_already_registed_vid');
302
+		if($output) {
303
+			return new BaseObject(-1,'msg_already_registed_vid');
304
+		}
288 305
 
289 306
 		$output = executeQuery('module.insertSite', $args);
290
-		if(!$output->toBool()) return $output;
307
+		if(!$output->toBool()) {
308
+			return $output;
309
+		}
291 310
 
292 311
 		$output->add('site_srl', $args->site_srl);
293 312
 		return $output;
@@ -310,8 +329,12 @@  discard block
 block discarded – undo
310 329
 		if($site_info->domain != $args->domain)
311 330
 		{
312 331
 			$info = $oModuleModel->getSiteInfoByDomain($args->domain, $columnList);
313
-			if($info->site_srl && $info->site_srl != $args->site_srl) return new BaseObject(-1,'msg_already_registed_domain');
314
-			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) return new BaseObject(-1,'msg_already_registed_vid');
332
+			if($info->site_srl && $info->site_srl != $args->site_srl) {
333
+				return new BaseObject(-1,'msg_already_registed_domain');
334
+			}
335
+			if(isSiteID($args->domain) && $oModuleModel->isIDExists($args->domain)) {
336
+				return new BaseObject(-1,'msg_already_registed_vid');
337
+			}
315 338
 
316 339
 			if($args->domain && !isSiteID($args->domain))
317 340
 			{
@@ -320,8 +343,11 @@  discard block
 block discarded – undo
320 343
 		}
321 344
 		$output = executeQuery('module.updateSite', $args);
322 345
 		//clear cache for default mid
323
-		if($args->site_srl == 0) $vid='';
324
-		else $vid=$args->domain;
346
+		if($args->site_srl == 0) {
347
+			$vid='';
348
+		} else {
349
+			$vid=$args->domain;
350
+		}
325 351
 
326 352
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->index_module_srl);
327 353
 		$mid = $module_info->mid;
@@ -345,7 +371,9 @@  discard block
 block discarded – undo
345 371
 		unset($args->act);
346 372
 		unset($args->page);
347 373
 		// Test mid value
348
-		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new BaseObject(-1, 'msg_limit_mid');
374
+		if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) {
375
+			return new BaseObject(-1, 'msg_limit_mid');
376
+		}
349 377
 		// Test variables (separate basic vars and other vars in modules)
350 378
 		$extra_vars = clone($args);
351 379
 		unset($extra_vars->module_srl);
@@ -382,18 +410,23 @@  discard block
 block discarded – undo
382 410
 		if(isset($args->isMenuCreate))
383 411
 		{
384 412
 			$isMenuCreate = $args->isMenuCreate;
385
-		}
386
-		else
413
+		} else
387 414
 		{
388 415
 			$isMenuCreate = TRUE;
389 416
 		}
390 417
 
391 418
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
392
-		if(!$output->toBool()) return $output;
419
+		if(!$output->toBool()) {
420
+			return $output;
421
+		}
393 422
 		// Check whether the module name already exists
394
-		if(!$args->site_srl) $args->site_srl = 0;
423
+		if(!$args->site_srl) {
424
+			$args->site_srl = 0;
425
+		}
395 426
 		$oModuleModel = getModel('module');
396
-		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new BaseObject(-1, 'msg_module_name_exists');
427
+		if($oModuleModel->isIDExists($args->mid, $args->site_srl)) {
428
+			return new BaseObject(-1, 'msg_module_name_exists');
429
+		}
397 430
 
398 431
 		// begin transaction
399 432
 		$oDB = &DB::getInstance();
@@ -404,20 +437,20 @@  discard block
 block discarded – undo
404 437
 		$skin_vars = new stdClass();
405 438
 		$skin_vars->colorset = $skin_info->colorset[0]->name;
406 439
 		// Arrange variables and then execute a query
407
-		if(!$args->module_srl) $args->module_srl = getNextSequence();
440
+		if(!$args->module_srl) {
441
+			$args->module_srl = getNextSequence();
442
+		}
408 443
 
409 444
 		// default value
410 445
 		if($args->skin == '/USE_DEFAULT/')
411 446
 		{
412 447
 			$args->is_skin_fix = 'N';
413
-		}
414
-		else
448
+		} else
415 449
 		{
416 450
 			if(isset($args->is_skin_fix))
417 451
 			{
418 452
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
419
-			}
420
-			else
453
+			} else
421 454
 			{
422 455
 				$args->is_skin_fix = 'Y';
423 456
 			}
@@ -426,14 +459,12 @@  discard block
 block discarded – undo
426 459
 		if($args->mskin == '/USE_DEFAULT/')
427 460
 		{
428 461
 			$args->is_mskin_fix = 'N';
429
-		}
430
-		else
462
+		} else
431 463
 		{
432 464
 			if(isset($args->is_mskin_fix))
433 465
 			{
434 466
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
435
-			}
436
-			else
467
+			} else
437 468
 			{
438 469
 				$args->is_mskin_fix = 'Y';
439 470
 			}
@@ -510,14 +541,15 @@  discard block
 block discarded – undo
510 541
 		if(isset($args->isMenuCreate))
511 542
 		{
512 543
 			$isMenuCreate = $args->isMenuCreate;
513
-		}
514
-		else
544
+		} else
515 545
 		{
516 546
 			$isMenuCreate = TRUE;
517 547
 		}
518 548
 		
519 549
 		$output = $this->arrangeModuleInfo($args, $extra_vars);
520
-		if(!$output->toBool()) return $output;
550
+		if(!$output->toBool()) {
551
+			return $output;
552
+		}
521 553
 		// begin transaction
522 554
 		$oDB = &DB::getInstance();
523 555
 		$oDB->begin();
@@ -528,8 +560,12 @@  discard block
 block discarded – undo
528 560
 
529 561
 		if(!$args->site_srl || !$args->browser_title)
530 562
 		{
531
-			if(!$args->site_srl) $args->site_srl = (int)$module_info->site_srl;
532
-			if(!$args->browser_title) $args->browser_title = $module_info->browser_title;
563
+			if(!$args->site_srl) {
564
+				$args->site_srl = (int)$module_info->site_srl;
565
+			}
566
+			if(!$args->browser_title) {
567
+				$args->browser_title = $module_info->browser_title;
568
+			}
533 569
 		}
534 570
 
535 571
 		$args->browser_title = strip_tags($args->browser_title);
@@ -545,14 +581,12 @@  discard block
 block discarded – undo
545 581
 		if($args->skin == '/USE_DEFAULT/')
546 582
 		{
547 583
 			$args->is_skin_fix = 'N';
548
-		}
549
-		else
584
+		} else
550 585
 		{
551 586
 			if(isset($args->is_skin_fix))
552 587
 			{
553 588
 				$args->is_skin_fix = ($args->is_skin_fix != 'Y') ? 'N' : 'Y';
554
-			}
555
-			else
589
+			} else
556 590
 			{
557 591
 				$args->is_skin_fix = 'Y';
558 592
 			}
@@ -561,14 +595,12 @@  discard block
 block discarded – undo
561 595
 		if($args->mskin == '/USE_DEFAULT/')
562 596
 		{
563 597
 			$args->is_mskin_fix = 'N';
564
-		}
565
-		else
598
+		} else
566 599
 		{
567 600
 			if(isset($args->is_mskin_fix))
568 601
 			{
569 602
 				$args->is_mskin_fix = ($args->is_mskin_fix != 'Y') ? 'N' : 'Y';
570
-			}
571
-			else
603
+			} else
572 604
 			{
573 605
 				$args->is_mskin_fix = 'Y';
574 606
 			}
@@ -637,7 +669,9 @@  discard block
 block discarded – undo
637 669
 		$args->update_id = $update_id;
638 670
 		$output = executeQuery('module.insertModuleUpdateLog', $args);
639 671
 
640
-		if(!!$output->error) return false;
672
+		if(!!$output->error) {
673
+			return false;
674
+		}
641 675
 
642 676
 		return true;
643 677
 	}
@@ -652,7 +686,9 @@  discard block
 block discarded – undo
652 686
 		$args->site_srl = $site_srl;
653 687
 		$args->layout_srl = $layout_srl;
654 688
 		$output = executeQuery('module.updateModuleSite', $args);
655
-		if(!$output->toBool()) return $output;
689
+		if(!$output->toBool()) {
690
+			return $output;
691
+		}
656 692
 
657 693
 		//remove from cache
658 694
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -671,7 +707,9 @@  discard block
 block discarded – undo
671 707
 	 */
672 708
 	function deleteModule($module_srl, $site_srl = 0)
673 709
 	{
674
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
710
+		if(!$module_srl) {
711
+			return new BaseObject(-1,'msg_invalid_request');
712
+		}
675 713
 
676 714
 		$site_module_info = Context::get('site_module_info');
677 715
 
@@ -681,8 +719,11 @@  discard block
 block discarded – undo
681 719
 		$args = new stdClass();
682 720
 		$args->url = $output->mid;
683 721
 		$args->is_shortcut = 'N';
684
-		if(!$site_srl) $args->site_srl = $site_module_info->site_srl;
685
-		else $args->site_srl = $site_srl;
722
+		if(!$site_srl) {
723
+			$args->site_srl = $site_module_info->site_srl;
724
+		} else {
725
+			$args->site_srl = $site_srl;
726
+		}
686 727
 
687 728
 		unset($output);
688 729
 
@@ -715,8 +756,7 @@  discard block
 block discarded – undo
715 756
 			if($output->isSuccess)
716 757
 			{
717 758
 				return new BaseObject(0, 'success_deleted');
718
-			}
719
-			else
759
+			} else
720 760
 			{
721 761
 				return new BaseObject($output->error, $output->message);
722 762
 			}
@@ -734,19 +774,25 @@  discard block
 block discarded – undo
734 774
 	 */
735 775
 	public function onlyDeleteModule($module_srl)
736 776
 	{
737
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
777
+		if(!$module_srl) {
778
+			return new BaseObject(-1,'msg_invalid_request');
779
+		}
738 780
 
739 781
 		// check start module
740 782
 		$oModuleModel = getModel('module');
741 783
 		$columnList = array('sites.index_module_srl');
742 784
 		$start_module = $oModuleModel->getSiteInfo(0, $columnList);
743
-		if($module_srl == $start_module->index_module_srl) return new BaseObject(-1, 'msg_cannot_delete_startmodule');
785
+		if($module_srl == $start_module->index_module_srl) {
786
+			return new BaseObject(-1, 'msg_cannot_delete_startmodule');
787
+		}
744 788
 
745 789
 		// Call a trigger (before)
746 790
 		$trigger_obj = new stdClass();
747 791
 		$trigger_obj->module_srl = $module_srl;
748 792
 		$output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj);
749
-		if(!$output->toBool()) return $output;
793
+		if(!$output->toBool()) {
794
+			return $output;
795
+		}
750 796
 
751 797
 		// begin transaction
752 798
 		$oDB = &DB::getInstance();
@@ -807,7 +853,9 @@  discard block
 block discarded – undo
807 853
 	function clearDefaultModule()
808 854
 	{
809 855
 		$output = executeQuery('module.clearDefaultModule');
810
-		if(!$output->toBool()) return $output;
856
+		if(!$output->toBool()) {
857
+			return $output;
858
+		}
811 859
 
812 860
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
813 861
 		if($oCacheHandler->isSupport())
@@ -839,7 +887,9 @@  discard block
 block discarded – undo
839 887
 	 */
840 888
 	function updateModuleLayout($layout_srl, $menu_srl_list)
841 889
 	{
842
-		if(!count($menu_srl_list)) return;
890
+		if(!count($menu_srl_list)) {
891
+			return;
892
+		}
843 893
 
844 894
 		$args = new stdClass;
845 895
 		$args->layout_srl = $layout_srl;
@@ -866,28 +916,37 @@  discard block
 block discarded – undo
866 916
 
867 917
 		$output = executeQuery('module.deleteSiteAdmin', $args);
868 918
 
869
-		if(!$output->toBool()) return $output;
919
+		if(!$output->toBool()) {
920
+			return $output;
921
+		}
870 922
 		// Get user id of an administrator
871
-		if(!is_array($arr_admins) || !count($arr_admins)) return new BaseObject();
923
+		if(!is_array($arr_admins) || !count($arr_admins)) {
924
+			return new BaseObject();
925
+		}
872 926
 		foreach($arr_admins as $key => $user_id)
873 927
 		{
874
-			if(!trim($user_id)) continue;
928
+			if(!trim($user_id)) {
929
+				continue;
930
+			}
875 931
 			$admins[] = trim($user_id);
876 932
 		}
877
-		if(!count($admins)) return new BaseObject();
933
+		if(!count($admins)) {
934
+			return new BaseObject();
935
+		}
878 936
 
879 937
 		$oMemberModel = getModel('member');
880 938
 		$member_config = $oMemberModel->getMemberConfig();
881 939
 		if($member_config->identifier == 'email_address')
882 940
 		{
883 941
 			$args->email_address = '\''.implode('\',\'',$admins).'\'';
884
-		}
885
-		else
942
+		} else
886 943
 		{
887 944
 			$args->user_ids = '\''.implode('\',\'',$admins).'\'';
888 945
 		}
889 946
 		$output = executeQueryArray('module.getAdminSrls', $args);
890
-		if(!$output->toBool()||!$output->data) return $output;
947
+		if(!$output->toBool()||!$output->data) {
948
+			return $output;
949
+		}
891 950
 
892 951
 		foreach($output->data as $key => $val)
893 952
 		{
@@ -896,7 +955,9 @@  discard block
 block discarded – undo
896 955
 			$args->site_srl = $site_srl;
897 956
 			$args->member_srl = $val->member_srl;
898 957
 			$output = executeQueryArray('module.insertSiteAdmin', $args);
899
-			if(!$output->toBool()) return $output;
958
+			if(!$output->toBool()) {
959
+				return $output;
960
+			}
900 961
 		}
901 962
 		return new BaseObject();
902 963
 	}
@@ -909,12 +970,15 @@  discard block
 block discarded – undo
909 970
 		$oMemberModel = getModel('member');
910 971
 		$member_config = $oMemberModel->getMemberConfig();
911 972
 
912
-		if($member_config->identifier == 'email_address')
913
-			$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
914
-		else
915
-			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
973
+		if($member_config->identifier == 'email_address') {
974
+					$member_info = $oMemberModel->getMemberInfoByEmailAddress($admin_id);
975
+		} else {
976
+					$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
977
+		}
916 978
 
917
-		if(!$member_info->member_srl) return;
979
+		if(!$member_info->member_srl) {
980
+			return;
981
+		}
918 982
 		$args = new stdClass();
919 983
 		$args->module_srl = $module_srl;
920 984
 		$args->member_srl = $member_info->member_srl;
@@ -933,7 +997,9 @@  discard block
 block discarded – undo
933 997
 		{
934 998
 			$oMemberModel = getModel('member');
935 999
 			$member_info = $oMemberModel->getMemberInfoByUserID($admin_id);
936
-			if($member_info->member_srl) $args->member_srl = $member_info->member_srl;
1000
+			if($member_info->member_srl) {
1001
+				$args->member_srl = $member_info->member_srl;
1002
+			}
937 1003
 		}
938 1004
 		return executeQuery('module.deleteAdminId', $args);
939 1005
 	}
@@ -977,7 +1043,9 @@  discard block
 block discarded – undo
977 1043
 		}
978 1044
 
979 1045
 		getDestroyXeVars($obj);
980
-		if(!$obj || !count($obj)) return new BaseObject();
1046
+		if(!$obj || !count($obj)) {
1047
+			return new BaseObject();
1048
+		}
981 1049
 
982 1050
 		$args = new stdClass;
983 1051
 		$args->module_srl = $module_srl;
@@ -987,18 +1055,23 @@  discard block
 block discarded – undo
987 1055
 			// it often saved menu item(stdClass) on the skin info column
988 1056
 			// When updating the module on XE core 1.2.0 later versions, it occurs an error
989 1057
 			// fixed the error
990
-			if (is_object($val)) continue;
991
-			if (is_array($val)) $val = serialize($val);
1058
+			if (is_object($val)) {
1059
+				continue;
1060
+			}
1061
+			if (is_array($val)) {
1062
+				$val = serialize($val);
1063
+			}
992 1064
 
993 1065
 			$args->name = trim($key);
994 1066
 			$args->value = trim($val);
995
-			if(!$args->name || !$args->value) continue;
1067
+			if(!$args->name || !$args->value) {
1068
+				continue;
1069
+			}
996 1070
 
997 1071
 			if($mode === 'P')
998 1072
 			{
999 1073
 				$output = executeQuery('module.insertModuleSkinVars', $args);
1000
-			}
1001
-			else
1074
+			} else
1002 1075
 			{
1003 1076
 				$output = executeQuery('module.insertModuleMobileSkinVars', $args);
1004 1077
 			}
@@ -1045,8 +1118,7 @@  discard block
 block discarded – undo
1045 1118
 		{
1046 1119
 			$object_key = 'module_skin_vars:'.$module_srl;
1047 1120
 			$query = 'module.deleteModuleSkinVars';
1048
-		}
1049
-		else
1121
+		} else
1050 1122
 		{
1051 1123
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1052 1124
 			$query = 'module.deleteModuleMobileSkinVars';
@@ -1070,17 +1142,23 @@  discard block
 block discarded – undo
1070 1142
 	{
1071 1143
 		$this->deleteModuleExtraVars($module_srl);
1072 1144
 		getDestroyXeVars($obj);
1073
-		if(!$obj || !count($obj)) return;
1145
+		if(!$obj || !count($obj)) {
1146
+			return;
1147
+		}
1074 1148
 
1075 1149
 		foreach($obj as $key => $val)
1076 1150
 		{
1077
-			if(is_object($val) || is_array($val)) continue;
1151
+			if(is_object($val) || is_array($val)) {
1152
+				continue;
1153
+			}
1078 1154
 
1079 1155
 			$args = new stdClass();
1080 1156
 			$args->module_srl = $module_srl;
1081 1157
 			$args->name = trim($key);
1082 1158
 			$args->value = trim($val);
1083
-			if(!$args->name || !$args->value) continue;
1159
+			if(!$args->name || !$args->value) {
1160
+				continue;
1161
+			}
1084 1162
 			$output = executeQuery('module.insertModuleExtraVars', $args);
1085 1163
 		}
1086 1164
 
@@ -1120,11 +1198,15 @@  discard block
 block discarded – undo
1120 1198
 	function insertModuleGrants($module_srl, $obj)
1121 1199
 	{
1122 1200
 		$this->deleteModuleGrants($module_srl);
1123
-		if(!$obj || !count($obj)) return;
1201
+		if(!$obj || !count($obj)) {
1202
+			return;
1203
+		}
1124 1204
 
1125 1205
 		foreach($obj as $name => $val)
1126 1206
 		{
1127
-			if(!$val || !count($val)) continue;
1207
+			if(!$val || !count($val)) {
1208
+				continue;
1209
+			}
1128 1210
 
1129 1211
 			foreach($val as $group_srl)
1130 1212
 			{
@@ -1132,7 +1214,9 @@  discard block
 block discarded – undo
1132 1214
 				$args->module_srl = $module_srl;
1133 1215
 				$args->name = $name;
1134 1216
 				$args->group_srl = trim($group_srl);
1135
-				if(!$args->name || !$args->group_srl) continue;
1217
+				if(!$args->name || !$args->group_srl) {
1218
+					continue;
1219
+				}
1136 1220
 				executeQuery('module.insertModuleGrant', $args);
1137 1221
 			}
1138 1222
 		}
@@ -1184,7 +1268,9 @@  discard block
 block discarded – undo
1184 1268
 			}
1185 1269
 		}
1186 1270
 
1187
-		if(!Context::get($matches[1]) && $lang[$matches[1]]) return $lang[$matches[1]];
1271
+		if(!Context::get($matches[1]) && $lang[$matches[1]]) {
1272
+			return $lang[$matches[1]];
1273
+		}
1188 1274
 
1189 1275
 		return str_replace('$user_lang->','',$matches[0]);
1190 1276
 	}
@@ -1196,10 +1282,14 @@  discard block
 block discarded – undo
1196 1282
 	function procModuleFileBoxAdd()
1197 1283
 	{
1198 1284
 		$ajax = Context::get('ajax');
1199
-		if ($ajax) Context::setRequestMethod('JSON');
1285
+		if ($ajax) {
1286
+			Context::setRequestMethod('JSON');
1287
+		}
1200 1288
 
1201 1289
 		$logged_info = Context::get('logged_info');
1202
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1290
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1291
+			return new BaseObject(-1, 'msg_not_permitted');
1292
+		}
1203 1293
 
1204 1294
 		$vars = Context::gets('addfile','filter');
1205 1295
 		$attributeNames = Context::get('attribute_name');
@@ -1223,9 +1313,14 @@  discard block
 block discarded – undo
1223 1313
 
1224 1314
 		$ext = strtolower(substr(strrchr($vars->addfile['name'],'.'),1));
1225 1315
 		$vars->ext = $ext;
1226
-		if($vars->filter) $filter = explode(',',$vars->filter);
1227
-		else $filter = array('jpg','jpeg','gif','png');
1228
-		if(!in_array($ext,$filter)) return new BaseObject(-1, 'msg_error_occured');
1316
+		if($vars->filter) {
1317
+			$filter = explode(',',$vars->filter);
1318
+		} else {
1319
+			$filter = array('jpg','jpeg','gif','png');
1320
+		}
1321
+		if(!in_array($ext,$filter)) {
1322
+			return new BaseObject(-1, 'msg_error_occured');
1323
+		}
1229 1324
 
1230 1325
 		$vars->member_srl = $logged_info->member_srl;
1231 1326
 
@@ -1238,10 +1333,16 @@  discard block
 block discarded – undo
1238 1333
 		// insert
1239 1334
 		else
1240 1335
 		{
1241
-			if(!Context::isUploaded()) return new BaseObject(-1, 'msg_error_occured');
1336
+			if(!Context::isUploaded()) {
1337
+				return new BaseObject(-1, 'msg_error_occured');
1338
+			}
1242 1339
 			$addfile = Context::get('addfile');
1243
-			if(!is_uploaded_file($addfile['tmp_name'])) return new BaseObject(-1, 'msg_error_occured');
1244
-			if($vars->addfile['error'] != 0) return new BaseObject(-1, 'msg_error_occured');
1340
+			if(!is_uploaded_file($addfile['tmp_name'])) {
1341
+				return new BaseObject(-1, 'msg_error_occured');
1342
+			}
1343
+			if($vars->addfile['error'] != 0) {
1344
+				return new BaseObject(-1, 'msg_error_occured');
1345
+			}
1245 1346
 			$output = $this->insertModuleFileBox($vars);
1246 1347
 		}
1247 1348
 
@@ -1252,11 +1353,13 @@  discard block
 block discarded – undo
1252 1353
 			$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispModuleAdminFileBox');
1253 1354
 			$this->setRedirectUrl($returnUrl);
1254 1355
 			return;
1255
-		}
1256
-		else
1356
+		} else
1257 1357
 		{
1258
-			if($output) $this->add('save_filename', $output->get('save_filename'));
1259
-			else $this->add('save_filename', '');
1358
+			if($output) {
1359
+				$this->add('save_filename', $output->get('save_filename'));
1360
+			} else {
1361
+				$this->add('save_filename', '');
1362
+			}
1260 1363
 		}
1261 1364
 	}
1262 1365
 
@@ -1280,7 +1383,9 @@  discard block
 block discarded – undo
1280 1383
 			$tmp = $vars->addfile['tmp_name'];
1281 1384
 
1282 1385
 			// Check uploaded file
1283
-			if(!checkUploadedFile($tmp)) return false;
1386
+			if(!checkUploadedFile($tmp)) {
1387
+				return false;
1388
+			}
1284 1389
 
1285 1390
 			if(!@move_uploaded_file($tmp, $save_filename))
1286 1391
 			{
@@ -1317,7 +1422,9 @@  discard block
 block discarded – undo
1317 1422
 		$tmp = $vars->addfile['tmp_name'];
1318 1423
 
1319 1424
 		// Check uploaded file
1320
-		if(!checkUploadedFile($tmp)) return false;
1425
+		if(!checkUploadedFile($tmp)) {
1426
+			return false;
1427
+		}
1321 1428
 
1322 1429
 		// upload
1323 1430
 		if(!@move_uploaded_file($tmp, $save_filename))
@@ -1346,14 +1453,20 @@  discard block
 block discarded – undo
1346 1453
 	function procModuleFileBoxDelete()
1347 1454
 	{
1348 1455
 		$logged_info = Context::get('logged_info');
1349
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
1456
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
1457
+			return new BaseObject(-1, 'msg_not_permitted');
1458
+		}
1350 1459
 
1351 1460
 		$module_filebox_srl = Context::get('module_filebox_srl');
1352
-		if(!$module_filebox_srl) return new BaseObject(-1, 'msg_invalid_request');
1461
+		if(!$module_filebox_srl) {
1462
+			return new BaseObject(-1, 'msg_invalid_request');
1463
+		}
1353 1464
 		$vars = new stdClass();
1354 1465
 		$vars->module_filebox_srl = $module_filebox_srl;
1355 1466
 		$output = $this->deleteModuleFileBox($vars);
1356
-		if(!$output->toBool()) return $output;
1467
+		if(!$output->toBool()) {
1468
+			return $output;
1469
+		}
1357 1470
 	}
1358 1471
 
1359 1472
 	function deleteModuleFileBox($vars)
@@ -1376,9 +1489,13 @@  discard block
 block discarded – undo
1376 1489
 		$this->unlockTimeoutPassed();
1377 1490
 		$args = new stdClass;
1378 1491
 		$args->lock_name = $lock_name;
1379
-		if(!$timeout) $timeout = 60;
1492
+		if(!$timeout) {
1493
+			$timeout = 60;
1494
+		}
1380 1495
 		$args->deadline = date("YmdHis", $_SERVER['REQUEST_TIME'] + $timeout);
1381
-		if($member_srl) $args->member_srl = $member_srl;
1496
+		if($member_srl) {
1497
+			$args->member_srl = $member_srl;
1498
+		}
1382 1499
 		$output = executeQuery('module.insertLock', $args);
1383 1500
 		if($output->toBool())
1384 1501
 		{
Please login to merge, or discard this patch.