GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#2396)
by
unknown
07:48
created
modules/layout/layout.admin.view.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 	/**
134 134
 	 * Display list of pc layout instance
135
-	 * @return void|BaseObject (void : success, BaseObject : fail)
135
+	 * @return ModuleObject|null (void : success, BaseObject : fail)
136 136
 	 */
137 137
 	function dispLayoutAdminInstanceList()
138 138
 	{
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	/**
162 162
 	 * Layout setting page
163 163
 	 * Once select a layout with empty value in the DB, then adjust values
164
-	 * @return void|BaseObject (void : success, BaseObject : fail)
164
+	 * @return ModuleObject|null (void : success, BaseObject : fail)
165 165
 	 */
166 166
 	function dispLayoutAdminInsert()
167 167
 	{
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 		// Set a layout list
29 29
 		$oLayoutModel = getModel('layout');
30 30
 		$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
31
-		if(!is_array($layout_list))
31
+		if (!is_array($layout_list))
32 32
 		{
33 33
 			$layout_list = array();
34 34
 		}
35 35
 
36
-		if($type == 'P')
36
+		if ($type == 'P')
37 37
 		{
38 38
 			// get Theme layout
39 39
 			$oAdminModel = getAdminModel('admin');
40 40
 			$themeList = $oAdminModel->getThemeList();
41 41
 			$themeLayoutList = array();
42
-			foreach($themeList as $themeInfo)
42
+			foreach ($themeList as $themeInfo)
43 43
 			{
44
-				if(strpos($themeInfo->layout_info->name, '.') === false) continue;
44
+				if (strpos($themeInfo->layout_info->name, '.') === false) continue;
45 45
 				$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
46 46
 			}
47 47
 			$layout_list = array_merge($layout_list, $themeLayoutList);
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 
60 60
 		//Security
61 61
 		$security = new Security();
62
-		$security->encodeHTML('layout_list..layout','layout_list..title');
62
+		$security->encodeHTML('layout_list..layout', 'layout_list..title');
63 63
 
64
-		foreach($layout_list as $no => $layout_info)
64
+		foreach ($layout_list as $no => $layout_info)
65 65
 		{
66 66
 			$layout_list[$no]->description = nl2br(trim($layout_info->description));
67 67
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	{
77 77
 		$type = Context::get('type');
78 78
 
79
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
79
+		if (!in_array($type, array('P', 'M'))) $type = 'P';
80 80
 
81 81
 		$oLayoutModel = getModel('layout');
82 82
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 		$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
90 90
 
91 91
 		$layout_list = array();
92
-		foreach($_layout_list as $item)
92
+		foreach ($_layout_list as $item)
93 93
 		{
94
-			if(!$layout_list[$item->layout])
94
+			if (!$layout_list[$item->layout])
95 95
 			{
96 96
 				$layout_list[$item->layout] = array();
97 97
 				$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$aTitle = strtolower($a['title']);
123 123
 		$bTitle = strtolower($b['title']);
124 124
 
125
-		if($aTitle == $bTitle)
125
+		if ($aTitle == $bTitle)
126 126
 		{
127 127
 			return 0;
128 128
 		}
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 		$type = Context::get('type');
140 140
 		$layout = Context::get('layout');
141 141
 
142
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
143
-		if(!$layout) return $this->stop('msg_invalid_request');
142
+		if (!in_array($type, array('P', 'M'))) $type = 'P';
143
+		if (!$layout) return $this->stop('msg_invalid_request');
144 144
 
145 145
 		$oLayoutModel = getModel('layout');
146 146
 		$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
147
-		if(!$layout_info) return $this->stop('msg_invalid_request');
147
+		if (!$layout_info) return $this->stop('msg_invalid_request');
148 148
 
149 149
 		Context::set('layout_info', $layout_info);
150 150
 
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 	{
168 168
 		$oModel = getModel('layout');
169 169
 		$type = Context::get('type');
170
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
170
+		if (!in_array($type, array('P', 'M'))) $type = 'P';
171 171
 
172 172
 		//Security
173 173
 		$security = new Security();
174
-		$security->encodeHTML('layout_list..layout','layout_list..title');
174
+		$security->encodeHTML('layout_list..layout', 'layout_list..title');
175 175
 
176 176
 		// Get layout info
177 177
 		$layout = Context::get('layout');
178
-		if($layout == 'faceoff') return $this->stop('not supported');
178
+		if ($layout == 'faceoff') return $this->stop('not supported');
179 179
 
180 180
 		$layout_info = $oModel->getLayoutInfo($layout, null, $type);
181
-		if(!$layout_info) return $this->stop('msg_invalid_request');
181
+		if (!$layout_info) return $this->stop('msg_invalid_request');
182 182
 
183 183
 		// get Menu list
184 184
 		$oMenuAdminModel = getAdminModel('menu');
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 		$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
193 193
 
194 194
 		$layout_info->description = nl2br(trim($layout_info->description));
195
-		if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
196
-		foreach($layout_info->extra_var as $var_name => $val)
195
+		if (!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
196
+		foreach ($layout_info->extra_var as $var_name => $val)
197 197
 		{
198
-			if(isset($layout_info->{$var_name}->description))
198
+			if (isset($layout_info->{$var_name}->description))
199 199
 				$layout_info->{$var_name}->description = nl2br(trim($val->description));
200 200
 		}
201 201
 		Context::set('selected_layout', $layout_info);
@@ -234,24 +234,24 @@  discard block
 block discarded – undo
234 234
 		$oLayoutModel = getModel('layout');
235 235
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
236 236
 		// Error appears if there is no layout information is registered
237
-		if(!$layout_info) return $this->dispLayoutAdminInstalledList();
237
+		if (!$layout_info) return $this->dispLayoutAdminInstalledList();
238 238
 
239 239
 		// Get Layout Code
240
-		if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
240
+		if ($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
241 241
 		{
242
-			$layout_file  = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243
-			$layout_css_file  = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
242
+			$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243
+			$layout_css_file = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
244 244
 		}
245 245
 		else
246 246
 		{
247 247
 			$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
248 248
 			$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
249 249
 
250
-			if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html';
251
-			if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css';
250
+			if (!file_exists($layout_file)) $layout_file = $layout_info->path.'layout.html';
251
+			if (!file_exists($layout_css_file)) $layout_css_file = $layout_info->path.'layout.css';
252 252
 		}
253 253
 
254
-		if(file_exists($layout_css_file))
254
+		if (file_exists($layout_css_file))
255 255
 		{
256 256
 			$layout_code_css = FileHandler::readFile($layout_css_file);
257 257
 			Context::set('layout_code_css', $layout_code_css);
@@ -295,30 +295,30 @@  discard block
 block discarded – undo
295 295
 		$layout_srl = Context::get('layout_srl');
296 296
 		$code = Context::get('code');
297 297
 		$code_css = Context::get('code_css');
298
-		if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
298
+		if (!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
299 299
 		// Get the layout information
300 300
 		$oLayoutModel = getModel('layout');
301 301
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
302
-		if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
302
+		if (!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
303 303
 		// Separately handle the layout if its type is faceoff
304
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
304
+		if ($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
305 305
 		// Apply CSS directly
306 306
 		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
307 307
 		// Set names and values of extra_vars to $layout_info
308
-		if($layout_info->extra_var_count)
308
+		if ($layout_info->extra_var_count)
309 309
 		{
310
-			foreach($layout_info->extra_var as $var_id => $val)
310
+			foreach ($layout_info->extra_var as $var_id => $val)
311 311
 			{
312 312
 				$layout_info->{$var_id} = $val->value;
313 313
 			}
314 314
 		}
315 315
 		// menu in layout information becomes an argument for Context:: set
316
-		if($layout_info->menu_count)
316
+		if ($layout_info->menu_count)
317 317
 		{
318
-			foreach($layout_info->menu as $menu_id => $menu)
318
+			foreach ($layout_info->menu as $menu_id => $menu)
319 319
 			{
320 320
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
321
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
321
+				if (FileHandler::exists($menu->php_file)) include($menu->php_file);
322 322
 				Context::set($menu_id, $menu);
323 323
 			}
324 324
 		}
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 		$layout_file = 'layout';
337 337
 
338 338
 		$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
339
-		Context::set('layout','none');
339
+		Context::set('layout', 'none');
340 340
 		// Convert widgets and others
341 341
 		$oContext = &Context::getInstance();
342 342
 		Context::set('layout_tpl', $layout_tpl);
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		// Remove the remaining tmp files because of temporarily saving
360 360
 		// This part needs to be modified
361 361
 		$delete_tmp = Context::get('delete_tmp');
362
-		if($delete_tmp =='Y')
362
+		if ($delete_tmp == 'Y')
363 363
 		{
364 364
 			$oLayoutAdminController = getAdminController('layout');
365 365
 			$oLayoutAdminController->deleteUserLayoutTempFile($layout_srl);
@@ -373,24 +373,24 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$css = FileHandler::readFile($faceoffcss);
375 375
 		$match = null;
376
-		preg_match_all('/([^\{]+)\{([^\}]*)\}/is',$css,$match);
377
-		for($i=0,$c=count($match[1]);$i<$c;$i++)
376
+		preg_match_all('/([^\{]+)\{([^\}]*)\}/is', $css, $match);
377
+		for ($i = 0, $c = count($match[1]); $i < $c; $i++)
378 378
 		{
379 379
 			$name = trim($match[1][$i]);
380 380
 			$css = trim($match[2][$i]);
381
-			if(!$css) continue;
382
-			$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
383
-			$style[] .= sprintf('"%s":"%s"',$name,$css);
381
+			if (!$css) continue;
382
+			$css = str_replace('./images/', Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl), $css);
383
+			$style[] .= sprintf('"%s":"%s"', $name, $css);
384 384
 		}
385 385
 
386
-		if(count($style))
386
+		if (count($style))
387 387
 		{
388
-			$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',',$style).'}; </script>';
388
+			$script = '<script type="text/javascript"> var faceOffStyle = {'.implode(',', $style).'}; </script>';
389 389
 			Context::addHtmlHeader($script);
390 390
 		}
391 391
 
392 392
 		$oTemplate = &TemplateHandler::getInstance();
393
-		Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
393
+		Context::set('content', $oTemplate->compile($this->module_path.'tpl', 'about_faceoff'));
394 394
 		// Change widget codes in Javascript mode
395 395
 		$oWidgetController = getController('widget');
396 396
 		$oWidgetController->setWidgetCodeInJavascriptMode();
Please login to merge, or discard this patch.
Braces   +55 added lines, -21 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@  discard block
 block discarded – undo
41 41
 			$themeLayoutList = array();
42 42
 			foreach($themeList as $themeInfo)
43 43
 			{
44
-				if(strpos($themeInfo->layout_info->name, '.') === false) continue;
44
+				if(strpos($themeInfo->layout_info->name, '.') === false) {
45
+					continue;
46
+				}
45 47
 				$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
46 48
 			}
47 49
 			$layout_list = array_merge($layout_list, $themeLayoutList);
@@ -76,7 +78,9 @@  discard block
 block discarded – undo
76 78
 	{
77 79
 		$type = Context::get('type');
78 80
 
79
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
81
+		if(!in_array($type, array('P', 'M'))) {
82
+			$type = 'P';
83
+		}
80 84
 
81 85
 		$oLayoutModel = getModel('layout');
82 86
 
@@ -139,12 +143,18 @@  discard block
 block discarded – undo
139 143
 		$type = Context::get('type');
140 144
 		$layout = Context::get('layout');
141 145
 
142
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
143
-		if(!$layout) return $this->stop('msg_invalid_request');
146
+		if(!in_array($type, array('P', 'M'))) {
147
+			$type = 'P';
148
+		}
149
+		if(!$layout) {
150
+			return $this->stop('msg_invalid_request');
151
+		}
144 152
 
145 153
 		$oLayoutModel = getModel('layout');
146 154
 		$layout_info = $oLayoutModel->getLayoutInfo($layout, null, $type);
147
-		if(!$layout_info) return $this->stop('msg_invalid_request');
155
+		if(!$layout_info) {
156
+			return $this->stop('msg_invalid_request');
157
+		}
148 158
 
149 159
 		Context::set('layout_info', $layout_info);
150 160
 
@@ -167,7 +177,9 @@  discard block
 block discarded – undo
167 177
 	{
168 178
 		$oModel = getModel('layout');
169 179
 		$type = Context::get('type');
170
-		if(!in_array($type, array('P', 'M'))) $type = 'P';
180
+		if(!in_array($type, array('P', 'M'))) {
181
+			$type = 'P';
182
+		}
171 183
 
172 184
 		//Security
173 185
 		$security = new Security();
@@ -175,10 +187,14 @@  discard block
 block discarded – undo
175 187
 
176 188
 		// Get layout info
177 189
 		$layout = Context::get('layout');
178
-		if($layout == 'faceoff') return $this->stop('not supported');
190
+		if($layout == 'faceoff') {
191
+			return $this->stop('not supported');
192
+		}
179 193
 
180 194
 		$layout_info = $oModel->getLayoutInfo($layout, null, $type);
181
-		if(!$layout_info) return $this->stop('msg_invalid_request');
195
+		if(!$layout_info) {
196
+			return $this->stop('msg_invalid_request');
197
+		}
182 198
 
183 199
 		// get Menu list
184 200
 		$oMenuAdminModel = getAdminModel('menu');
@@ -192,11 +208,14 @@  discard block
 block discarded – undo
192 208
 		$layout_info = $security->encodeHTML('.', 'author..', 'extra_var..', 'extra_var....');
193 209
 
194 210
 		$layout_info->description = nl2br(trim($layout_info->description));
195
-		if(!is_object($layout_info->extra_var)) $layout_info->extra_var = new StdClass();
211
+		if(!is_object($layout_info->extra_var)) {
212
+			$layout_info->extra_var = new StdClass();
213
+		}
196 214
 		foreach($layout_info->extra_var as $var_name => $val)
197 215
 		{
198
-			if(isset($layout_info->{$var_name}->description))
199
-				$layout_info->{$var_name}->description = nl2br(trim($val->description));
216
+			if(isset($layout_info->{$var_name}->description)) {
217
+							$layout_info->{$var_name}->description = nl2br(trim($val->description));
218
+			}
200 219
 		}
201 220
 		Context::set('selected_layout', $layout_info);
202 221
 
@@ -234,21 +253,26 @@  discard block
 block discarded – undo
234 253
 		$oLayoutModel = getModel('layout');
235 254
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
236 255
 		// Error appears if there is no layout information is registered
237
-		if(!$layout_info) return $this->dispLayoutAdminInstalledList();
256
+		if(!$layout_info) {
257
+			return $this->dispLayoutAdminInstalledList();
258
+		}
238 259
 
239 260
 		// Get Layout Code
240 261
 		if($oLayoutModel->useDefaultLayout($layout_info->layout_srl))
241 262
 		{
242 263
 			$layout_file  = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
243 264
 			$layout_css_file  = $oLayoutModel->getDefaultLayoutCss($layout_info->layout);
244
-		}
245
-		else
265
+		} else
246 266
 		{
247 267
 			$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
248 268
 			$layout_css_file = $oLayoutModel->getUserLayoutCss($layout_info->layout_srl);
249 269
 
250
-			if(!file_exists($layout_file)) $layout_file = $layout_info->path . 'layout.html';
251
-			if(!file_exists($layout_css_file)) $layout_css_file = $layout_info->path . 'layout.css';
270
+			if(!file_exists($layout_file)) {
271
+				$layout_file = $layout_info->path . 'layout.html';
272
+			}
273
+			if(!file_exists($layout_css_file)) {
274
+				$layout_css_file = $layout_info->path . 'layout.css';
275
+			}
252 276
 		}
253 277
 
254 278
 		if(file_exists($layout_css_file))
@@ -295,13 +319,19 @@  discard block
 block discarded – undo
295 319
 		$layout_srl = Context::get('layout_srl');
296 320
 		$code = Context::get('code');
297 321
 		$code_css = Context::get('code_css');
298
-		if(!$layout_srl || !$code) return new BaseObject(-1, 'msg_invalid_request');
322
+		if(!$layout_srl || !$code) {
323
+			return new BaseObject(-1, 'msg_invalid_request');
324
+		}
299 325
 		// Get the layout information
300 326
 		$oLayoutModel = getModel('layout');
301 327
 		$layout_info = $oLayoutModel->getLayout($layout_srl);
302
-		if(!$layout_info) return new BaseObject(-1, 'msg_invalid_request');
328
+		if(!$layout_info) {
329
+			return new BaseObject(-1, 'msg_invalid_request');
330
+		}
303 331
 		// Separately handle the layout if its type is faceoff
304
-		if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
332
+		if($layout_info && $layout_info->type == 'faceoff') {
333
+			$oLayoutModel->doActivateFaceOff($layout_info);
334
+		}
305 335
 		// Apply CSS directly
306 336
 		Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
307 337
 		// Set names and values of extra_vars to $layout_info
@@ -318,7 +348,9 @@  discard block
 block discarded – undo
318 348
 			foreach($layout_info->menu as $menu_id => $menu)
319 349
 			{
320 350
 				$menu->php_file = FileHandler::getRealPath($menu->php_file);
321
-				if(FileHandler::exists($menu->php_file)) include($menu->php_file);
351
+				if(FileHandler::exists($menu->php_file)) {
352
+					include($menu->php_file);
353
+				}
322 354
 				Context::set($menu_id, $menu);
323 355
 			}
324 356
 		}
@@ -378,7 +410,9 @@  discard block
 block discarded – undo
378 410
 		{
379 411
 			$name = trim($match[1][$i]);
380 412
 			$css = trim($match[2][$i]);
381
-			if(!$css) continue;
413
+			if(!$css) {
414
+				continue;
415
+			}
382 416
 			$css = str_replace('./images/',Context::getRequestUri().$oLayoutModel->getUserLayoutImagePath($layout_srl),$css);
383 417
 			$style[] .= sprintf('"%s":"%s"',$name,$css);
384 418
 		}
Please login to merge, or discard this patch.
modules/member/member.view.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -637,7 +637,7 @@
 block discarded – undo
637 637
 	/**
638 638
 	 * Spammer manage popup
639 639
 	 * 
640
-	 * @return void
640
+	 * @return BaseObject|null
641 641
 	**/
642 642
 	function dispMemberSpammer()
643 643
 	{
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -638,7 +638,7 @@
 block discarded – undo
638 638
 	 * Spammer manage popup
639 639
 	 * 
640 640
 	 * @return void
641
-	**/
641
+	 **/
642 642
 	function dispMemberSpammer()
643 643
 	{
644 644
 		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
Please login to merge, or discard this patch.
Braces   +77 added lines, -58 removed lines patch added patch discarded remove patch
@@ -29,16 +29,14 @@  discard block
 block discarded – undo
29 29
 		{
30 30
 			$skin = 'default';
31 31
 			$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
32
-		}
33
-		else
32
+		} else
34 33
 		{
35 34
 			//check theme
36 35
 			$config_parse = explode('|@|', $skin);
37 36
 			if (count($config_parse) > 1)
38 37
 			{
39 38
 				$template_path = sprintf('./themes/%s/modules/member/', $config_parse[0]);
40
-			}
41
-			else
39
+			} else
42 40
 			{
43 41
 				$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
44 42
 			}
@@ -63,14 +61,15 @@  discard block
 block discarded – undo
63 61
 		$oMemberModel = getModel('member');
64 62
 		$logged_info = Context::get('logged_info');
65 63
 		// Don't display member info to non-logged user
66
-		if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
64
+		if(!$logged_info->member_srl) {
65
+			return $this->stop('msg_not_permitted');
66
+		}
67 67
 
68 68
 		$member_srl = Context::get('member_srl');
69 69
 		if(!$member_srl && Context::get('is_logged'))
70 70
 		{
71 71
 			$member_srl = $logged_info->member_srl;
72
-		}
73
-		elseif(!$member_srl)
72
+		} elseif(!$member_srl)
74 73
 		{
75 74
 			return $this->dispMemberSignUpForm();
76 75
 		}
@@ -89,7 +88,9 @@  discard block
 block discarded – undo
89 88
 			$member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start);
90 89
 		}
91 90
 
92
-		if(!$member_info->member_srl) return $this->dispMemberSignUpForm();
91
+		if(!$member_info->member_srl) {
92
+			return $this->dispMemberSignUpForm();
93
+		}
93 94
 
94 95
 		Context::set('memberInfo', get_object_vars($member_info));
95 96
 
@@ -135,43 +136,35 @@  discard block
 block discarded – undo
135 136
 				{
136 137
 					$target = $memberInfo->profile_image;
137 138
 					$item->value = '<img src="'.$target->src.'" />';
138
-				}
139
-				elseif($formInfo->name == 'image_name' && $memberInfo->image_name)
139
+				} elseif($formInfo->name == 'image_name' && $memberInfo->image_name)
140 140
 				{
141 141
 					$target = $memberInfo->image_name;
142 142
 					$item->value = '<img src="'.$target->src.'" />';
143
-				}
144
-				elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark)
143
+				} elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark)
145 144
 				{
146 145
 					$target = $memberInfo->image_mark;
147 146
 					$item->value = '<img src="'.$target->src.'" />';
148
-				}
149
-				elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
147
+				} elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
150 148
 				{
151 149
 					$item->value = zdate($item->value, 'Y-m-d');
152 150
 				}
153
-			}
154
-			else
151
+			} else
155 152
 			{
156 153
 				$item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title;
157 154
 				$orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value;
158 155
 				if($formInfo->type=='tel' && is_array($orgValue))
159 156
 				{
160 157
 					$item->value = implode('-', $orgValue);
161
-				}
162
-				elseif($formInfo->type=='kr_zip' && is_array($orgValue))
158
+				} elseif($formInfo->type=='kr_zip' && is_array($orgValue))
163 159
 				{
164 160
 					$item->value = implode(' ', $orgValue);
165
-				}
166
-				elseif($formInfo->type=='checkbox' && is_array($orgValue))
161
+				} elseif($formInfo->type=='checkbox' && is_array($orgValue))
167 162
 				{
168 163
 					$item->value = implode(", ",$orgValue);
169
-				}
170
-				elseif($formInfo->type=='date')
164
+				} elseif($formInfo->type=='date')
171 165
 				{
172 166
 					$item->value = zdate($orgValue, "Y-m-d");
173
-				}
174
-				else
167
+				} else
175 168
 				{
176 169
 					$item->value = nl2br($orgValue);
177 170
 				}
@@ -198,12 +191,18 @@  discard block
 block discarded – undo
198 191
 
199 192
 		$oMemberModel = getModel('member');
200 193
 		// Get the member information if logged-in
201
-		if($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
194
+		if($oMemberModel->isLogged()) {
195
+			return $this->stop('msg_already_logged');
196
+		}
202 197
 		// call a trigger (before) 
203 198
 		$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
204
-		if(!$trigger_output->toBool()) return $trigger_output;
199
+		if(!$trigger_output->toBool()) {
200
+			return $trigger_output;
201
+		}
205 202
 		// Error appears if the member is not allowed to join
206
-		if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
203
+		if($member_config->enable_join != 'Y') {
204
+			return $this->stop('msg_signup_disabled');
205
+		}
207 206
 
208 207
 		$oMemberAdminView = getAdminView('member');
209 208
 		$formTags = $oMemberAdminView->_getMemberInputTag($member_info);
@@ -244,8 +243,7 @@  discard block
 block discarded – undo
244 243
 		{
245 244
 			Context::set('identifierTitle', Context::getLang('email_address'));
246 245
 			Context::set('identifierValue', $logged_info->email_address); 
247
-		}
248
-		else
246
+		} else
249 247
 		{
250 248
 			Context::set('identifierTitle', Context::getLang('user_id'));
251 249
 			Context::set('identifierValue', $logged_info->user_id);
@@ -271,7 +269,9 @@  discard block
 block discarded – undo
271 269
 
272 270
 		$oMemberModel = getModel('member');
273 271
 		// A message appears if the user is not logged-in
274
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
272
+		if(!$oMemberModel->isLogged()) {
273
+			return $this->stop('msg_not_logged');
274
+		}
275 275
 
276 276
 		$logged_info = Context::get('logged_info');
277 277
 		$member_srl = $logged_info->member_srl;
@@ -330,7 +330,9 @@  discard block
 block discarded – undo
330 330
 	{
331 331
 		$oMemberModel = getModel('member');
332 332
 		// A message appears if the user is not logged-in
333
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
333
+		if(!$oMemberModel->isLogged()) {
334
+			return $this->stop('msg_not_logged');
335
+		}
334 336
 
335 337
 		$logged_info = Context::get('logged_info');
336 338
 		$member_srl = $logged_info->member_srl;
@@ -357,7 +359,9 @@  discard block
 block discarded – undo
357 359
 	{
358 360
 		$oMemberModel = getModel('member');
359 361
 		// A message appears if the user is not logged-in
360
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
362
+		if(!$oMemberModel->isLogged()) {
363
+			return $this->stop('msg_not_logged');
364
+		}
361 365
 
362 366
 		$logged_info = Context::get('logged_info');
363 367
 		$args = new stdClass();
@@ -384,7 +388,9 @@  discard block
 block discarded – undo
384 388
 	{
385 389
 		$oMemberModel = getModel('member');
386 390
 		// A message appears if the user is not logged-in
387
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
391
+		if(!$oMemberModel->isLogged()) {
392
+			return $this->stop('msg_not_logged');
393
+		}
388 394
 		// Get the saved document(module_srl is set to member_srl instead)
389 395
 		$logged_info = Context::get('logged_info');
390 396
 		$args = new stdClass();
@@ -423,13 +429,15 @@  discard block
 block discarded – undo
423 429
 
424 430
 		$XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE');
425 431
 		$XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR');
426
-		if($XE_VALIDATOR_ERROR == -11)
427
-			Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description);
432
+		if($XE_VALIDATOR_ERROR == -11) {
433
+					Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description);
434
+		}
428 435
 
429
-		if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21)
430
-			Context::set('referer_url', getUrl('')); 
431
-		else
432
-			Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
436
+		if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21) {
437
+					Context::set('referer_url', getUrl(''));
438
+		} else {
439
+					Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
440
+		}
433 441
 
434 442
 		// Set a template file
435 443
 		$this->setTemplateFile('login_form');
@@ -442,7 +450,9 @@  discard block
 block discarded – undo
442 450
 	{
443 451
 		$oMemberModel = getModel('member');
444 452
 		// A message appears if the user is not logged-in
445
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
453
+		if(!$oMemberModel->isLogged()) {
454
+			return $this->stop('msg_not_logged');
455
+		}
446 456
 
447 457
 		$memberConfig = $this->member_config;
448 458
 
@@ -457,8 +467,7 @@  discard block
 block discarded – undo
457 467
 		{
458 468
 			Context::set('identifier', 'user_id');
459 469
 			Context::set('formValue', $member_info->user_id);
460
-		}
461
-		else
470
+		} else
462 471
 		{
463 472
 			Context::set('identifier', 'email_address');
464 473
 			Context::set('formValue', $member_info->email_address);
@@ -474,7 +483,9 @@  discard block
 block discarded – undo
474 483
 	{
475 484
 		$oMemberModel = getModel('member');
476 485
 		// A message appears if the user is not logged-in
477
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
486
+		if(!$oMemberModel->isLogged()) {
487
+			return $this->stop('msg_not_logged');
488
+		}
478 489
 
479 490
 		$memberConfig = $this->member_config;
480 491
 
@@ -488,8 +499,7 @@  discard block
 block discarded – undo
488 499
 		{
489 500
 			Context::set('identifier', 'user_id');
490 501
 			Context::set('formValue', $member_info->user_id);
491
-		}
492
-		else
502
+		} else
493 503
 		{
494 504
 			Context::set('identifier', 'email_address');
495 505
 			Context::set('formValue', $member_info->email_address);
@@ -505,10 +515,11 @@  discard block
 block discarded – undo
505 515
 	{
506 516
 		$oMemberController = getController('member');
507 517
 		$output = $oMemberController->procMemberLogout();
508
-		if(!$output->redirect_url)
509
-			$this->setRedirectUrl(getNotEncodedUrl('act', ''));
510
-		else
511
-			$this->setRedirectUrl($output->redirect_url);
518
+		if(!$output->redirect_url) {
519
+					$this->setRedirectUrl(getNotEncodedUrl('act', ''));
520
+		} else {
521
+					$this->setRedirectUrl($output->redirect_url);
522
+		}
512 523
 
513 524
 		return;
514 525
 	}
@@ -527,7 +538,9 @@  discard block
 block discarded – undo
527 538
 	 */
528 539
 	function dispMemberFindAccount()
529 540
 	{
530
-		if(Context::get('is_logged')) return $this->stop('already_logged');
541
+		if(Context::get('is_logged')) {
542
+			return $this->stop('already_logged');
543
+		}
531 544
 
532 545
 		$config = $this->member_config;
533 546
 
@@ -541,13 +554,17 @@  discard block
 block discarded – undo
541 554
 	 */
542 555
 	function dispMemberGetTempPassword()
543 556
 	{
544
-		if(Context::get('is_logged')) return $this->stop('already_logged');
557
+		if(Context::get('is_logged')) {
558
+			return $this->stop('already_logged');
559
+		}
545 560
 
546 561
 		$user_id = Context::get('user_id');
547 562
 		$temp_password = $_SESSION['xe_temp_password_'.$user_id];
548 563
 		unset($_SESSION['xe_temp_password_'.$user_id]);
549 564
 
550
-		if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request');
565
+		if(!$user_id||!$temp_password) {
566
+			return new BaseObject(-1,'msg_invaild_request');
567
+		}
551 568
 
552 569
 		Context::set('temp_password', $temp_password);
553 570
 
@@ -575,8 +592,7 @@  discard block
 block discarded – undo
575 592
 			$_SESSION['auth_member_info'] = $memberInfo;
576 593
 			Context::set('memberInfo', $memberInfo);
577 594
 			$this->setTemplateFile('reset_mail');
578
-		}
579
-		else
595
+		} else
580 596
 		{
581 597
 			$this->setTemplateFile('resend_auth_mail');
582 598
 		}
@@ -618,8 +634,7 @@  discard block
 block discarded – undo
618 634
 			if($val->column_type == 'kr_zip' || $val->column_type == 'tel')
619 635
 			{
620 636
 				$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title);
621
-			}
622
-			else
637
+			} else
623 638
 			{
624 639
 				$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s","%s"]);', $val->column_name, $title);
625 640
 			}
@@ -641,7 +656,9 @@  discard block
 block discarded – undo
641 656
 	**/
642 657
 	function dispMemberSpammer()
643 658
 	{
644
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
659
+		if(!Context::get('is_logged')) {
660
+			return new BaseObject(-1,'msg_not_permitted');
661
+		}
645 662
 
646 663
 		$member_srl = Context::get('member_srl');
647 664
 		$module_srl = Context::get('module_srl');
@@ -652,7 +669,9 @@  discard block
 block discarded – undo
652 669
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
653 670
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
654 671
 
655
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
672
+		if(!$grant->manager) {
673
+			return new BaseObject(-1,'msg_not_permitted');
674
+		}
656 675
 
657 676
 		$oMemberModel = getModel('member');
658 677
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$skin = $this->member_config->skin;
27 27
 		// Set the template path
28
-		if(!$skin)
28
+		if (!$skin)
29 29
 		{
30 30
 			$skin = 'default';
31 31
 			$template_path = sprintf('%sskins/%s', $this->module_path, $skin);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 		$oLayoutModel = getModel('layout');
50 50
 		$layout_info = $oLayoutModel->getLayout($this->member_config->layout_srl);
51
-		if($layout_info)
51
+		if ($layout_info)
52 52
 		{
53 53
 			$this->module_info->layout_srl = $this->member_config->layout_srl;
54 54
 			$this->setLayoutPath($layout_info->path);
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 		$oMemberModel = getModel('member');
64 64
 		$logged_info = Context::get('logged_info');
65 65
 		// Don't display member info to non-logged user
66
-		if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
66
+		if (!$logged_info->member_srl) return $this->stop('msg_not_permitted');
67 67
 
68 68
 		$member_srl = Context::get('member_srl');
69
-		if(!$member_srl && Context::get('is_logged'))
69
+		if (!$member_srl && Context::get('is_logged'))
70 70
 		{
71 71
 			$member_srl = $logged_info->member_srl;
72 72
 		}
73
-		elseif(!$member_srl)
73
+		elseif (!$member_srl)
74 74
 		{
75 75
 			return $this->dispMemberSignUpForm();
76 76
 		}
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 		unset($member_info->email_id);
83 83
 		unset($member_info->email_host);
84 84
 
85
-		if($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl))
85
+		if ($logged_info->is_admin != 'Y' && ($member_info->member_srl != $logged_info->member_srl))
86 86
 		{
87
-			$start = strpos($member_info->email_address, '@')+1;
87
+			$start = strpos($member_info->email_address, '@') + 1;
88 88
 			$replaceStr = str_repeat('*', (strlen($member_info->email_address) - $start));
89 89
 			$member_info->email_address = substr_replace($member_info->email_address, $replaceStr, $start);
90 90
 		}
91 91
 
92
-		if(!$member_info->member_srl) return $this->dispMemberSignUpForm();
92
+		if (!$member_info->member_srl) return $this->dispMemberSignUpForm();
93 93
 
94 94
 		Context::set('memberInfo', get_object_vars($member_info));
95 95
 
@@ -107,46 +107,46 @@  discard block
 block discarded – undo
107 107
 	{
108 108
 		$logged_info = Context::get('logged_info');
109 109
 		$displayDatas = array();
110
-		foreach($memberConfig->signupForm as $no=>$formInfo)
110
+		foreach ($memberConfig->signupForm as $no=>$formInfo)
111 111
 		{
112
-			if(!$formInfo->isUse)
112
+			if (!$formInfo->isUse)
113 113
 			{
114 114
 				continue;
115 115
 			}
116 116
 
117
-			if($formInfo->name == 'password' || $formInfo->name == 'find_account_question')
117
+			if ($formInfo->name == 'password' || $formInfo->name == 'find_account_question')
118 118
 			{
119 119
 				continue;
120 120
 			}
121 121
 
122
-			if($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y')
122
+			if ($logged_info->is_admin != 'Y' && $memberInfo->member_srl != $logged_info->member_srl && $formInfo->isPublic != 'Y')
123 123
 			{
124 124
 				continue;
125 125
 			}
126 126
 
127 127
 			$item = $formInfo;
128 128
 
129
-			if($formInfo->isDefaultForm)
129
+			if ($formInfo->isDefaultForm)
130 130
 			{
131 131
 				$item->title = Context::getLang($formInfo->name);
132 132
 				$item->value = $memberInfo->{$formInfo->name};
133 133
 
134
-				if($formInfo->name == 'profile_image' && $memberInfo->profile_image)
134
+				if ($formInfo->name == 'profile_image' && $memberInfo->profile_image)
135 135
 				{
136 136
 					$target = $memberInfo->profile_image;
137 137
 					$item->value = '<img src="'.$target->src.'" />';
138 138
 				}
139
-				elseif($formInfo->name == 'image_name' && $memberInfo->image_name)
139
+				elseif ($formInfo->name == 'image_name' && $memberInfo->image_name)
140 140
 				{
141 141
 					$target = $memberInfo->image_name;
142 142
 					$item->value = '<img src="'.$target->src.'" />';
143 143
 				}
144
-				elseif($formInfo->name == 'image_mark' && $memberInfo->image_mark)
144
+				elseif ($formInfo->name == 'image_mark' && $memberInfo->image_mark)
145 145
 				{
146 146
 					$target = $memberInfo->image_mark;
147 147
 					$item->value = '<img src="'.$target->src.'" />';
148 148
 				}
149
-				elseif($formInfo->name == 'birthday' && $memberInfo->birthday)
149
+				elseif ($formInfo->name == 'birthday' && $memberInfo->birthday)
150 150
 				{
151 151
 					$item->value = zdate($item->value, 'Y-m-d');
152 152
 				}
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 			{
156 156
 				$item->title = $extendFormInfo[$formInfo->member_join_form_srl]->column_title;
157 157
 				$orgValue = $extendFormInfo[$formInfo->member_join_form_srl]->value;
158
-				if($formInfo->type=='tel' && is_array($orgValue))
158
+				if ($formInfo->type == 'tel' && is_array($orgValue))
159 159
 				{
160 160
 					$item->value = implode('-', $orgValue);
161 161
 				}
162
-				elseif($formInfo->type=='kr_zip' && is_array($orgValue))
162
+				elseif ($formInfo->type == 'kr_zip' && is_array($orgValue))
163 163
 				{
164 164
 					$item->value = implode(' ', $orgValue);
165 165
 				}
166
-				elseif($formInfo->type=='checkbox' && is_array($orgValue))
166
+				elseif ($formInfo->type == 'checkbox' && is_array($orgValue))
167 167
 				{
168
-					$item->value = implode(", ",$orgValue);
168
+					$item->value = implode(", ", $orgValue);
169 169
 				}
170
-				elseif($formInfo->type=='date')
170
+				elseif ($formInfo->type == 'date')
171 171
 				{
172 172
 					$item->value = zdate($orgValue, "Y-m-d");
173 173
 				}
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 
199 199
 		$oMemberModel = getModel('member');
200 200
 		// Get the member information if logged-in
201
-		if($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
201
+		if ($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
202 202
 		// call a trigger (before) 
203 203
 		$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $member_config);
204
-		if(!$trigger_output->toBool()) return $trigger_output;
204
+		if (!$trigger_output->toBool()) return $trigger_output;
205 205
 		// Error appears if the member is not allowed to join
206
-		if($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
206
+		if ($member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
207 207
 
208 208
 		$oMemberAdminView = getAdminView('member');
209 209
 		$formTags = $oMemberAdminView->_getMemberInputTag($member_info);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	{
227 227
 		$logged_info = Context::get('logged_info');
228 228
 		$oMemberModel = getModel('member');
229
-		if(!$oMemberModel->isLogged() || empty($logged_info))
229
+		if (!$oMemberModel->isLogged() || empty($logged_info))
230 230
 		{
231 231
 			return $this->stop('msg_not_logged');
232 232
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		$_SESSION['rechecked_password_step'] = 'INPUT_PASSWORD';
235 235
 
236 236
 		$templateFile = $this->getTemplatePath().'rechecked_password.html';
237
-		if(!is_readable($templateFile))
237
+		if (!is_readable($templateFile))
238 238
 		{
239 239
 			$templatePath = sprintf('%sskins/default', $this->module_path);
240 240
 			$this->setTemplatePath($templatePath);
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	function dispMemberModifyInfo() 
261 261
 	{
262
-		if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
262
+		if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
263 263
 		{
264 264
 			$this->dispMemberModifyInfoBefore();
265 265
 			return;
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
 		$oMemberModel = getModel('member');
273 273
 		// A message appears if the user is not logged-in
274
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
274
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
275 275
 
276 276
 		$logged_info = Context::get('logged_info');
277 277
 		$member_srl = $logged_info->member_srl;
@@ -279,13 +279,13 @@  discard block
 block discarded – undo
279 279
 		$columnList = array('member_srl', 'user_id', 'user_name', 'nick_name', 'email_address', 'find_account_answer', 'homepage', 'blog', 'birthday', 'allow_mailing');
280 280
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
281 281
 		$member_info->signature = $oMemberModel->getSignature($member_srl);
282
-		Context::set('member_info',$member_info);
282
+		Context::set('member_info', $member_info);
283 283
 
284 284
 		// Get a list of extend join form
285 285
 		Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
286 286
 
287 287
 		// Editor of the module set for signing by calling getEditor
288
-		if($member_info->member_srl)
288
+		if ($member_info->member_srl)
289 289
 		{
290 290
 			$oEditorModel = getModel('editor');
291 291
 			$option = new stdClass();
@@ -330,14 +330,14 @@  discard block
 block discarded – undo
330 330
 	{
331 331
 		$oMemberModel = getModel('member');
332 332
 		// A message appears if the user is not logged-in
333
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
333
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
334 334
 
335 335
 		$logged_info = Context::get('logged_info');
336 336
 		$member_srl = $logged_info->member_srl;
337 337
 
338 338
 		$module_srl = Context::get('module_srl');
339
-		Context::set('module_srl',Context::get('selected_module_srl'));
340
-		Context::set('search_target','member_srls');
339
+		Context::set('module_srl', Context::get('selected_module_srl'));
340
+		Context::set('search_target', 'member_srls');
341 341
 		Context::set('search_keyword', implode(',', array($member_srl, $member_srl * -1)));
342 342
 
343 343
 
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
 	{
359 359
 		$oMemberModel = getModel('member');
360 360
 		// A message appears if the user is not logged-in
361
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
361
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
362 362
 
363 363
 		$logged_info = Context::get('logged_info');
364 364
 		$args = new stdClass();
365 365
 		$args->member_srl = $logged_info->member_srl;
366
-		$args->page = (int)Context::get('page');
366
+		$args->page = (int) Context::get('page');
367 367
 
368 368
 		$output = executeQuery('member.getScrapDocumentList', $args);
369 369
 		Context::set('total_count', $output->total_count);
@@ -385,12 +385,12 @@  discard block
 block discarded – undo
385 385
 	{
386 386
 		$oMemberModel = getModel('member');
387 387
 		// A message appears if the user is not logged-in
388
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
388
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
389 389
 		// Get the saved document(module_srl is set to member_srl instead)
390 390
 		$logged_info = Context::get('logged_info');
391 391
 		$args = new stdClass();
392 392
 		$args->member_srl = $logged_info->member_srl;
393
-		$args->page = (int)Context::get('page');
393
+		$args->page = (int) Context::get('page');
394 394
 		$args->statusList = array('TEMP');
395 395
 
396 396
 		$oDocumentModel = getModel('document');
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	function dispMemberLoginForm()
411 411
 	{
412
-		if(Context::get('is_logged'))
412
+		if (Context::get('is_logged'))
413 413
 		{
414
-			Context::set('redirect_url', getNotEncodedUrl('act',''));
414
+			Context::set('redirect_url', getNotEncodedUrl('act', ''));
415 415
 			$this->setTemplatePath($this->module_path.'tpl');
416 416
 			$this->setTemplateFile('redirect.html');
417 417
 			return;
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
 
425 425
 		$XE_VALIDATOR_MESSAGE = Context::get('XE_VALIDATOR_MESSAGE');
426 426
 		$XE_VALIDATOR_ERROR = Context::get('XE_VALIDATOR_ERROR');
427
-		if($XE_VALIDATOR_ERROR == -11)
428
-			Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE . $config->limit_day_description);
427
+		if ($XE_VALIDATOR_ERROR == -11)
428
+			Context::set('XE_VALIDATOR_MESSAGE', $XE_VALIDATOR_MESSAGE.$config->limit_day_description);
429 429
 
430
-		if($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21)
430
+		if ($XE_VALIDATOR_ERROR < -10 && $XE_VALIDATOR_ERROR > -21)
431 431
 			Context::set('referer_url', getUrl('')); 
432 432
 		else
433 433
 			Context::set('referer_url', htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	{
444 444
 		$oMemberModel = getModel('member');
445 445
 		// A message appears if the user is not logged-in
446
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
446
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
447 447
 
448 448
 		$memberConfig = $this->member_config;
449 449
 
@@ -452,9 +452,9 @@  discard block
 block discarded – undo
452 452
 
453 453
 		$columnList = array('member_srl', 'user_id');
454 454
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl, 0, $columnList);
455
-		Context::set('member_info',$member_info);
455
+		Context::set('member_info', $member_info);
456 456
 
457
-		if($memberConfig->identifier == 'user_id')
457
+		if ($memberConfig->identifier == 'user_id')
458 458
 		{
459 459
 			Context::set('identifier', 'user_id');
460 460
 			Context::set('formValue', $member_info->user_id);
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	{
476 476
 		$oMemberModel = getModel('member');
477 477
 		// A message appears if the user is not logged-in
478
-		if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
478
+		if (!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
479 479
 
480 480
 		$memberConfig = $this->member_config;
481 481
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 		$member_srl = $logged_info->member_srl;
484 484
 
485 485
 		$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
486
-		Context::set('member_info',$member_info);
486
+		Context::set('member_info', $member_info);
487 487
 
488
-		if($memberConfig->identifier == 'user_id')
488
+		if ($memberConfig->identifier == 'user_id')
489 489
 		{
490 490
 			Context::set('identifier', 'user_id');
491 491
 			Context::set('formValue', $member_info->user_id);
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	{
507 507
 		$oMemberController = getController('member');
508 508
 		$output = $oMemberController->procMemberLogout();
509
-		if(!$output->redirect_url)
509
+		if (!$output->redirect_url)
510 510
 			$this->setRedirectUrl(getNotEncodedUrl('act', ''));
511 511
 		else
512 512
 			$this->setRedirectUrl($output->redirect_url);
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
 	 */
529 529
 	function dispMemberFindAccount()
530 530
 	{
531
-		if(Context::get('is_logged')) return $this->stop('already_logged');
531
+		if (Context::get('is_logged')) return $this->stop('already_logged');
532 532
 
533 533
 		$config = $this->member_config;
534 534
 
@@ -542,13 +542,13 @@  discard block
 block discarded – undo
542 542
 	 */
543 543
 	function dispMemberGetTempPassword()
544 544
 	{
545
-		if(Context::get('is_logged')) return $this->stop('already_logged');
545
+		if (Context::get('is_logged')) return $this->stop('already_logged');
546 546
 
547 547
 		$user_id = Context::get('user_id');
548 548
 		$temp_password = $_SESSION['xe_temp_password_'.$user_id];
549 549
 		unset($_SESSION['xe_temp_password_'.$user_id]);
550 550
 
551
-		if(!$user_id||!$temp_password) return new BaseObject(-1,'msg_invaild_request');
551
+		if (!$user_id || !$temp_password) return new BaseObject(-1, 'msg_invaild_request');
552 552
 
553 553
 		Context::set('temp_password', $temp_password);
554 554
 
@@ -563,12 +563,12 @@  discard block
 block discarded – undo
563 563
 		$authMemberSrl = $_SESSION['auth_member_srl'];
564 564
 		unset($_SESSION['auth_member_srl']);
565 565
 
566
-		if(Context::get('is_logged')) 
566
+		if (Context::get('is_logged')) 
567 567
 		{
568 568
 			return $this->stop('already_logged');
569 569
 		}
570 570
 
571
-		if($authMemberSrl)
571
+		if ($authMemberSrl)
572 572
 		{
573 573
 			$oMemberModel = getModel('member');
574 574
 			$memberInfo = $oMemberModel->getMemberInfoByMemberSrl($authMemberSrl);
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 
586 586
 	function dispMemberModifyEmailAddress()
587 587
 	{
588
-		if($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
588
+		if ($_SESSION['rechecked_password_step'] != 'VALIDATE_PASSWORD' && $_SESSION['rechecked_password_step'] != 'INPUT_DATA')
589 589
 		{
590 590
 			Context::set('success_return_url', getUrl('', 'mid', Context::get('mid'), 'act', 'dispMemberModifyEmailAddress'));
591 591
 			$this->dispMemberModifyInfoBefore();
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
 		$js_code[] = 'if(!validator) return false;';
614 614
 
615 615
 		$errorLang = array();
616
-		foreach($extraList as $val) 
616
+		foreach ($extraList as $val) 
617 617
 		{
618 618
 			$title = str_ireplace(array('<script', '</script'), array('<scr"+"ipt', '</scr"+"ipt'), addslashes($val->column_title));
619
-			if($val->column_type == 'kr_zip' || $val->column_type == 'tel')
619
+			if ($val->column_type == 'kr_zip' || $val->column_type == 'tel')
620 620
 			{
621 621
 				$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s[]","%s"]);', $val->column_name, $title);
622 622
 			}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	**/
643 643
 	function dispMemberSpammer()
644 644
 	{
645
-		if(!Context::get('is_logged')) return new BaseObject(-1,'msg_not_permitted');
645
+		if (!Context::get('is_logged')) return new BaseObject(-1, 'msg_not_permitted');
646 646
 
647 647
 		$member_srl = Context::get('member_srl');
648 648
 		$module_srl = Context::get('module_srl');
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
654 654
 		$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
655 655
 
656
-		if(!$grant->manager) return new BaseObject(-1,'msg_not_permitted');
656
+		if (!$grant->manager) return new BaseObject(-1, 'msg_not_permitted');
657 657
 
658 658
 		$oMemberModel = getModel('member');
659 659
 
Please login to merge, or discard this patch.
modules/menu/menu.admin.controller.php 3 patches
Doc Comments   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 	/**
63 63
 	 * Add a menu
64
-	 * @return void|object
64
+	 * @return BaseObject|null
65 65
 	 */
66 66
 	function procMenuAdminInsert()
67 67
 	{
@@ -304,6 +304,7 @@  discard block
 block discarded – undo
304 304
 	/**
305 305
 	 * Delete menu
306 306
 	 * Delete menu_item and xml cache files
307
+	 * @param string $menu_srl
307 308
 	 * @return BaseObject
308 309
 	 */
309 310
 	function deleteMenu($menu_srl)
@@ -380,6 +381,7 @@  discard block
 block discarded – undo
380 381
 
381 382
 	/**
382 383
 	 * Add an item to the menu, simple version
384
+	 * @param stdClass $request
383 385
 	 * @return void
384 386
 	 */
385 387
 	public function procMenuAdminInsertItem($request = NULL)
@@ -518,6 +520,9 @@  discard block
 block discarded – undo
518 520
 		$this->setMessage('success_registed', 'info');
519 521
 	}
520 522
 
523
+	/**
524
+	 * @param boolean $isProc
525
+	 */
521 526
 	private function _insertMenu(&$request, $isProc)
522 527
 	{
523 528
 		$oDB = DB::getInstance();
@@ -583,6 +588,7 @@  discard block
 block discarded – undo
583 588
 	 * insert module by men create value
584 589
 	 * @request value of client request
585 590
 	 * @args value for menu create
591
+	 * @param stdClass $args
586 592
 	 * @return bool result of create module
587 593
 	 */
588 594
 	private function _insertModule(&$request, &$args)
@@ -640,7 +646,7 @@  discard block
 block discarded – undo
640 646
 
641 647
 	/**
642 648
 	 * Update an item to the menu, simple version
643
-	 * @return void
649
+	 * @return BaseObject|null
644 650
 	 */
645 651
 	public function procMenuAdminUpdateItem()
646 652
 	{
@@ -841,6 +847,7 @@  discard block
 block discarded – undo
841 847
 	/**
842 848
 	 * Delete menu item ( Only include BO )
843 849
 	 * @args menu_srl, menu_item_srl, is_force
850
+	 * @param stdClass $args
844 851
 	 * @return void|BaseObject
845 852
 	 */
846 853
 	public function deleteItem($args)
@@ -989,6 +996,9 @@  discard block
 block discarded – undo
989 996
 		return new BaseObject(0, 'success');
990 997
 	}
991 998
 
999
+	/**
1000
+	 * @param DB $oDB
1001
+	 */
992 1002
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
993 1003
 	{
994 1004
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
@@ -1008,7 +1018,7 @@  discard block
 block discarded – undo
1008 1018
 
1009 1019
 	/**
1010 1020
 	 * Move menu items
1011
-	 * @return void
1021
+	 * @return BaseObject|null
1012 1022
 	 */
1013 1023
 	function procMenuAdminMoveItem()
1014 1024
 	{
@@ -1173,6 +1183,9 @@  discard block
 block discarded – undo
1173 1183
 		}
1174 1184
 	}
1175 1185
 
1186
+	/**
1187
+	 * @param string $parentSrl
1188
+	 */
1176 1189
 	private function _copyMenu($menuSrl, $parentSrl, &$originMenu)
1177 1190
 	{
1178 1191
 		$oMenuAdminModel = getAdminModel('menu');
@@ -2129,7 +2142,7 @@  discard block
 block discarded – undo
2129 2142
 
2130 2143
 	/**
2131 2144
 	 * Register a menu image button
2132
-	 * @param object $args
2145
+	 * @param BaseObject $args
2133 2146
 	 * @return array
2134 2147
 	 */
2135 2148
 	function _uploadButton($args)
@@ -2204,6 +2217,7 @@  discard block
 block discarded – undo
2204 2217
 	/**
2205 2218
 	 * When copy a menu, button copied also.
2206 2219
 	 * @param $args menuItemInfo with button values
2220
+	 * @param string $insertedMenuItemSrl
2207 2221
 	 */
2208 2222
 	private function _copyButton($insertedMenuItemSrl, $insertedMenuSrl, &$menuItemInfo)
2209 2223
 	{
@@ -2244,6 +2258,9 @@  discard block
 block discarded – undo
2244 2258
 		return $copied_info;
2245 2259
 	}
2246 2260
 
2261
+	/**
2262
+	 * @param string $mode
2263
+	 */
2247 2264
 	private function _changeMenuItemSrlInButtonPath($buttonPath, $menuSrl, $menuItemSrl, $mode)
2248 2265
 	{
2249 2266
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
@@ -2253,6 +2270,9 @@  discard block
 block discarded – undo
2253 2270
 		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2254 2271
 	}
2255 2272
 
2273
+	/**
2274
+	 * @param integer $menuSrl
2275
+	 */
2256 2276
 	public function makeHomemenuCacheFile($menuSrl)
2257 2277
 	{
2258 2278
 		$cacheBuff .= sprintf('<?php if(!defined("__XE__")) exit();');
Please login to merge, or discard this patch.
Spacing   +304 added lines, -304 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	function __construct() {
59
-		$this->homeMenuCacheFile = _XE_PATH_ . $this->homeMenuCacheFile;
59
+		$this->homeMenuCacheFile = _XE_PATH_.$this->homeMenuCacheFile;
60 60
 	}
61 61
 
62 62
 	/**
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 		// List variables
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71
-		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
71
+		$output = $this->addMenu(Context::get('title'), (int) $site_module_info->site_srl);
72
+		if (!$output->toBool()) return $output;
73 73
 
74 74
 		$this->add('menu_srl', $output->get('menuSrl'));
75 75
 		$this->setMessage('success_registed');
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		$args->listorder = $args->menu_srl * -1;
96 96
 
97 97
 		$output = executeQuery('menu.insertMenu', $args);
98
-		if(!$output->toBool())
98
+		if (!$output->toBool())
99 99
 		{
100 100
 			return $output;
101 101
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 		$unlinked_modules = false;
110 110
 		$args = new stdClass;
111 111
 		$args->site_srl = 0;
112
-		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl',$args);
113
-		if($output->toBool() && $output->data && count($output->data) > 0)
112
+		$output = executeQueryArray('module.getNotLinkedModuleBySiteSrl', $args);
113
+		if ($output->toBool() && $output->data && count($output->data) > 0)
114 114
 		{
115 115
 			$unlinked_modules = $output->data;
116 116
 		}
117 117
 
118
-		if($unlinked_modules)
118
+		if ($unlinked_modules)
119 119
 		{
120 120
 			$unlinked_menu_srl = $this->getUnlinkedMenu();
121 121
 			$output = $this->updateLinkModule($unlinked_modules, $unlinked_menu_srl);
@@ -129,21 +129,21 @@  discard block
 block discarded – undo
129 129
 		$oModuleModel = getModel('module');
130 130
 		$moduleConfig = $oModuleModel->getModuleConfig('menu');
131 131
 
132
-		if($moduleConfig->unlinked_menu_srl)
132
+		if ($moduleConfig->unlinked_menu_srl)
133 133
 		{
134 134
 			$menuArgs = new stdClass;
135 135
 			$menuArgs->menu_srl = $moduleConfig->unlinked_menu_srl;
136 136
 			$menuOutput = executeQuery('menu.getMenu', $menuArgs);
137
-			if(!$menuOutput->data)
137
+			if (!$menuOutput->data)
138 138
 			{
139 139
 				unset($moduleConfig->unlinked_menu_srl);
140 140
 			}
141 141
 		}
142 142
 
143
-		if(!$moduleConfig->unlinked_menu_srl)
143
+		if (!$moduleConfig->unlinked_menu_srl)
144 144
 		{
145 145
 			$output = $this->addMenu('unlinked', 0);
146
-			if($output->toBool())
146
+			if ($output->toBool())
147 147
 			{
148 148
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 149
 				$oModuleController = getController('module');
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	function updateLinkModule($moduleInfos, $menuSrl)
170 170
 	{
171
-		if(!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
171
+		if (!$moduleInfos || !is_array($moduleInfos) || count($moduleInfos) == 0 || $menuSrl == 0)
172 172
 		{
173 173
 			return new BaseObject(-1, 'msg_invalid_request');
174 174
 		}
175 175
 
176
-		foreach($moduleInfos as $moduleInfo)
176
+		foreach ($moduleInfos as $moduleInfo)
177 177
 		{
178 178
 			// search menu.
179 179
 			$args = new stdClass;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
185 185
 
186
-			if($output->toBool() && $output->data)
186
+			if ($output->toBool() && $output->data)
187 187
 			{
188 188
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189 189
 			}
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 				$item_args->url = $moduleInfo->mid;
195 195
 				$item_args->name = $moduleInfo->mid;
196 196
 				$item_args->menu_item_srl = getNextSequence();
197
-				$item_args->listorder = -1*$item_args->menu_item_srl;
197
+				$item_args->listorder = -1 * $item_args->menu_item_srl;
198 198
 
199 199
 				$output = executeQuery('menu.insertMenuItem', $item_args);
200
-				if(!$output->toBool())
200
+				if (!$output->toBool())
201 201
 				{
202 202
 					return $output;
203 203
 				}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
213
-		if($oCacheHandler->isSupport())
213
+		if ($oCacheHandler->isSupport())
214 214
 		{
215 215
 			$oCacheHandler->invalidateGroupKey('site_and_module');
216 216
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if (!$output->toBool()) return $output;
239 239
 
240 240
 		$this->setMessage('success_registed');
241 241
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 256
 
257 257
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
258
+		if ($menuInfo->title == $oAdmin->getAdminMenuName())
259 259
 			return new BaseObject(-1, 'msg_adminmenu_cannot_delete');
260 260
 
261 261
 		// get menu properies with child menu
262 262
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
263 263
 		$originMenu = NULL;
264 264
 
265
-		if(is_readable(FileHandler::getRealPath($phpFile)))
265
+		if (is_readable(FileHandler::getRealPath($phpFile)))
266 266
 		{
267 267
 			include(FileHandler::getRealPath($phpFile));
268 268
 		}
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$isStartmenuInclude = false;
275 275
 
276
-		if(is_array($menu->list))
276
+		if (is_array($menu->list))
277 277
 		{
278
-			foreach($menu->list AS $key=>$value)
278
+			foreach ($menu->list AS $key=>$value)
279 279
 			{
280 280
 				$originMenu = $value;
281 281
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 282
 
283
-				if($isStartmenuInclude)
283
+				if ($isStartmenuInclude)
284 284
 					break;
285 285
 			}
286 286
 		}
287 287
 
288
-		if($isStartmenuInclude)
288
+		if ($isStartmenuInclude)
289 289
 		{
290 290
 			return new BaseObject(-1, 'msg_cannot_delete_homemenu');
291 291
 		}
292 292
 
293 293
 		$output = $this->deleteMenu($menu_srl);
294
-		if(!$output->toBool())
294
+		if (!$output->toBool())
295 295
 		{
296 296
 			return new BaseObject(-1, $output->message);
297 297
 		}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 		// Delete modules
321 321
 		$output = executeQueryArray('menu.getMenuItems', $args);
322
-		if(!$output->toBool())
322
+		if (!$output->toBool())
323 323
 		{
324 324
 			return $output;
325 325
 		}
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
 		$oModuleController = getController('module');
328 328
 		$oModuleModel = getModel('module');
329 329
 
330
-		foreach($output->data as $itemInfo)
330
+		foreach ($output->data as $itemInfo)
331 331
 		{
332
-			if($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
332
+			if ($itemInfo->is_shortcut != 'Y' && strncasecmp('http', $itemInfo->url, 4) !== 0)
333 333
 			{
334 334
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
335
-				if($moduleInfo->module_srl)
335
+				if ($moduleInfo->module_srl)
336 336
 				{
337 337
 					$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
338
-					if(!$output->toBool())
338
+					if (!$output->toBool())
339 339
 					{
340 340
 						$oDB->rollback();
341 341
 						return $output;
@@ -346,27 +346,27 @@  discard block
 block discarded – undo
346 346
 
347 347
 		// Delete menu items
348 348
 		$output = executeQuery("menu.deleteMenuItems", $args);
349
-		if(!$output->toBool())
349
+		if (!$output->toBool())
350 350
 		{
351 351
 			$oDB->rollback();
352 352
 			return $output;
353 353
 		}
354 354
 		// Delete the menu
355 355
 		$output = executeQuery("menu.deleteMenu", $args);
356
-		if(!$output->toBool())
356
+		if (!$output->toBool())
357 357
 		{
358 358
 			$oDB->rollback();
359 359
 			return $output;
360 360
 		}
361 361
 
362 362
 		// Delete cache files
363
-		$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
364
-		if(count($cache_list))
363
+		$cache_list = FileHandler::readDir("./files/cache/menu", "", false, true);
364
+		if (count($cache_list))
365 365
 		{
366
-			foreach($cache_list as $cache_file)
366
+			foreach ($cache_list as $cache_file)
367 367
 			{
368 368
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
369
+				if ($pos > 0)FileHandler::removeFile($cache_file);
370 370
 			}
371 371
 		}
372 372
 		// Delete images of menu buttons
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 		$oDB->commit();
377 377
 
378
-		return new BaseObject(0,'success_deleted');
378
+		return new BaseObject(0, 'success_deleted');
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,24 +385,24 @@  discard block
 block discarded – undo
385 385
 	public function procMenuAdminInsertItem($request = NULL)
386 386
 	{
387 387
 		$isProc = false;
388
-		if(!$request)
388
+		if (!$request)
389 389
 		{
390 390
 			$isProc = true;
391 391
 			$request = Context::getRequestVars();
392 392
 		}
393 393
 
394
-		if(!$request->parent_srl || !$request->menu_name)
394
+		if (!$request->parent_srl || !$request->menu_name)
395 395
 		{
396 396
 			return new BaseObject(-1, 'msg_invalid_request');
397 397
 		}
398 398
 
399 399
 		$this->_setMenuSrl($request->parent_srl, $request->menu_srl);
400
-		if(!$request->menu_srl)
400
+		if (!$request->menu_srl)
401 401
 		{
402 402
 			return new BaseObject(-1, 'msg_invalid_request');
403 403
 		}
404 404
 
405
-		if($request->is_shortcut == 'Y')
405
+		if ($request->is_shortcut == 'Y')
406 406
 		{
407 407
 			$result = $this->_insertShortcut($request);
408 408
 		}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$result = $this->_insertMenu($request, $isProc);
412 412
 		}
413 413
 
414
-		if($result->error < 0)
414
+		if ($result->error < 0)
415 415
 		{
416 416
 			return new BaseObject($result->error, $result->message);
417 417
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		// recreate menu cache file
420 420
 		$this->makeXmlFile($request->menu_srl);
421 421
 
422
-		if(!$isProc)
422
+		if (!$isProc)
423 423
 		{
424 424
 			return $this->get('menu_item_srl');
425 425
 		}
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$oMenuAdminModel = getAdminModel('menu');
432 432
 		$itemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
433 433
 		// parent_srl is parent menu item's srl
434
-		if($itemInfo->menu_srl)
434
+		if ($itemInfo->menu_srl)
435 435
 		{
436 436
 			$menu_srl = $itemInfo->menu_srl;
437 437
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		else
440 440
 		{
441 441
 			$output = $oMenuAdminModel->getMenu($parent_srl);
442
-			if($output->menu_srl == $parent_srl)
442
+			if ($output->menu_srl == $parent_srl)
443 443
 			{
444 444
 				$menu_srl = $output->menu_srl;
445 445
 				$parent_srl = 0;
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		$oDB->begin();
454 454
 
455 455
 		// type is url
456
-		if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
456
+		if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
457 457
 		{
458 458
 			// set menu variable
459 459
 			$args = new stdClass();
@@ -464,27 +464,27 @@  discard block
 block discarded – undo
464 464
 			$args->is_shortcut = $request->is_shortcut;
465 465
 			$args->url = $request->shortcut_target;
466 466
 
467
-			if(!$args->open_window) $args->open_window = 'N';
468
-			if(!$args->expand) $args->expand = 'N';
469
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
467
+			if (!$args->open_window) $args->open_window = 'N';
468
+			if (!$args->expand) $args->expand = 'N';
469
+			if (!$args->is_shortcut) $args->is_shortcut = 'Y';
470 470
 
471
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
471
+			if ($request->menu_name_key) $args->name = $request->menu_name_key;
472 472
 			else $args->name = $request->menu_name;
473 473
 		}
474 474
 		// type is module short cut
475
-		else if(is_numeric($request->shortcut_target))
475
+		else if (is_numeric($request->shortcut_target))
476 476
 		{
477 477
 			// Get original information
478 478
 			$oMenuAdminModel = getAdminModel('menu');
479 479
 			$itemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
480
-			if(!$itemInfo->menu_item_srl)
480
+			if (!$itemInfo->menu_item_srl)
481 481
 			{
482 482
 				return new BaseObject(-1, 'msg_invalid_request');
483 483
 			}
484 484
 			unset($itemInfo->normal_btn, $itemInfo->hover_btn, $itemInfo->active_btn);
485 485
 
486 486
 			$args = $itemInfo;
487
-			if(count($args->group_srls) == 0)
487
+			if (count($args->group_srls) == 0)
488 488
 			{
489 489
 				unset($args->group_srls);
490 490
 			}
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
 			$args->url = '#';
505 505
 		}
506 506
 
507
-		if($request->menu_desc) $args->desc = $request->menu_desc;
507
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
508 508
 		else $args->desc = '';
509 509
 
510 510
 		$args->menu_item_srl = getNextSequence();
511
-		$args->listorder = -1*$args->menu_item_srl;
511
+		$args->listorder = -1 * $args->menu_item_srl;
512 512
 		$output = executeQuery('menu.insertMenuItem', $args);
513
-		if(!$output->toBool()) return $output;
513
+		if (!$output->toBool()) return $output;
514 514
 
515 515
 		$oDB->commit();
516 516
 
@@ -532,46 +532,46 @@  discard block
 block discarded – undo
532 532
 		$args->expand = $request->menu_expand;
533 533
 		$args->is_shortcut = $request->is_shortcut;
534 534
 
535
-		if(!$args->open_window) $args->open_window = 'N';
536
-		if(!$args->expand) $args->expand = 'N';
537
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
535
+		if (!$args->open_window) $args->open_window = 'N';
536
+		if (!$args->expand) $args->expand = 'N';
537
+		if (!$args->is_shortcut) $args->is_shortcut = 'N';
538 538
 
539
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
539
+		if ($request->menu_name_key) $args->name = $request->menu_name_key;
540 540
 		else $args->name = $request->menu_name;
541 541
 
542
-		if($request->menu_desc) $args->desc = $request->menu_desc;
542
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
543 543
 		else $args->desc = '';
544 544
 
545
-		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
545
+		if ($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546 546
 		{
547 547
 			return new BaseObject(-1, 'msg_invalid_request');
548 548
 		}
549 549
 
550 550
 		// when menu copy, module already copied
551
-		if($isProc)
551
+		if ($isProc)
552 552
 		{
553 553
 			$result = $this->_insertModule($request, $args);
554
-			if(!$result->toBool())
554
+			if (!$result->toBool())
555 555
 			{
556 556
 				return new BaseObject(-1, $result->message);
557 557
 			}
558 558
 		}
559 559
 
560 560
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
561
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
-		if($request->active_btn) $args->active_btn = $request->active_btn;
561
+		if ($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
+		if ($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
+		if ($request->active_btn) $args->active_btn = $request->active_btn;
564 564
 
565
-		if(!$request->module_id)
565
+		if (!$request->module_id)
566 566
 		{
567 567
 			return new BaseObject(-1, 'msg_invalid_request');
568 568
 		}
569 569
 
570 570
 		$args->url = $request->module_id;
571 571
 		$args->menu_item_srl = getNextSequence();
572
-		$args->listorder = -1*$args->menu_item_srl;
572
+		$args->listorder = -1 * $args->menu_item_srl;
573 573
 		$output = executeQuery('menu.insertMenuItem', $args);
574
-		if(!$output->toBool()) return $output;
574
+		if (!$output->toBool()) return $output;
575 575
 
576 576
 		$oDB->commit();
577 577
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		//module create
605 605
 		$site_module_info = Context::get('site_module_info');
606
-		$cmArgs->site_srl = (int)$site_module_info->site_srl;
606
+		$cmArgs->site_srl = (int) $site_module_info->site_srl;
607 607
 		$cmArgs->browser_title = $args->name;
608 608
 		$cmArgs->menu_srl = $request->menu_srl;
609 609
 		$cmArgs->layout_srl = -1;
@@ -611,13 +611,13 @@  discard block
 block discarded – undo
611 611
 		$cmArgs->is_skin_fix = 'N';
612 612
 		$cmArgs->is_mskin_fix = 'N';
613 613
 
614
-		if(Mobile::isMobileEnabled() === true)
614
+		if (Mobile::isMobileEnabled() === true)
615 615
 		{
616 616
 			$cmArgs->use_mobile = 'Y';
617 617
 		}
618 618
 
619 619
 		// if mid is empty, auto create mid
620
-		if(!$request->module_id)
620
+		if (!$request->module_id)
621 621
 		{
622 622
 			$randomMid = $this->_makeRandomMid();
623 623
 			$request->module_id = $cmArgs->module.'_'.$randomMid;
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		// check already created module instance
628 628
 		$oModuleModel = getModel('module');
629 629
 		$output = $oModuleModel->getModuleInfoByMid($request->module_id);
630
-		if($output->module_srl)
630
+		if ($output->module_srl)
631 631
 		{
632 632
 			return new BaseObject(-1, 'msg_module_name_exists');
633 633
 		}
@@ -646,14 +646,14 @@  discard block
 block discarded – undo
646 646
 	{
647 647
 		$request = Context::getRequestVars();
648 648
 
649
-		if(!$request->menu_item_srl || !$request->menu_name)
649
+		if (!$request->menu_item_srl || !$request->menu_name)
650 650
 		{
651 651
 			return new BaseObject(-1, 'msg_invalid_request');
652 652
 		}
653 653
 
654 654
 		// variables set
655
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
655
+		if ($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
+		if ($request->menu_expand != "Y") $request->menu_expand = "N";
657 657
 
658 658
 		// Get original information
659 659
 		$oMenuAdminModel = getAdminModel('menu');
@@ -661,19 +661,19 @@  discard block
 block discarded – undo
661 661
 		$args = $itemInfo;
662 662
 
663 663
 		// if menu type is module, check exists module and update
664
-		if($itemInfo->is_shortcut == 'Y')
664
+		if ($itemInfo->is_shortcut == 'Y')
665 665
 		{
666 666
 			// type is url
667
-			if(strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
667
+			if (strncasecmp('http', $request->shortcut_target, 4) === 0 || preg_match('/^(\.\/|\.\.\/|\/).*$/', $request->shortcut_target))
668 668
 			{
669 669
 				$args->url = $request->shortcut_target;
670 670
 			}
671 671
 			// type is module short cut
672
-			else if(is_numeric($request->shortcut_target))
672
+			else if (is_numeric($request->shortcut_target))
673 673
 			{
674 674
 				// Get new original information
675 675
 				$newItemInfo = $oMenuAdminModel->getMenuItemInfo($request->shortcut_target);
676
-				if(!$newItemInfo->menu_item_srl)
676
+				if (!$newItemInfo->menu_item_srl)
677 677
 				{
678 678
 					return new BaseObject(-1, 'msg_invalid_request');
679 679
 				}
@@ -690,10 +690,10 @@  discard block
 block discarded – undo
690 690
 		{
691 691
 			// check already created module instance
692 692
 			$oModuleModel = getModel('module');
693
-			if($request->module_id != $itemInfo->url)
693
+			if ($request->module_id != $itemInfo->url)
694 694
 			{
695 695
 				$output = $oModuleModel->getModuleInfoByMid($request->module_id);
696
-				if($output->module_srl)
696
+				if ($output->module_srl)
697 697
 				{
698 698
 					return new BaseObject(-1, 'msg_module_name_exists');
699 699
 				}
@@ -701,13 +701,13 @@  discard block
 block discarded – undo
701 701
 
702 702
 			// if not exist module, return error
703 703
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url);
704
-			if(!$moduleInfo)
704
+			if (!$moduleInfo)
705 705
 			{
706 706
 				return new BaseObject(-1, 'msg_invalid_request');
707 707
 			}
708 708
 
709 709
 			$moduleInfo->mid = $request->module_id;
710
-			if($request->browser_title)
710
+			if ($request->browser_title)
711 711
 			{
712 712
 				$moduleInfo->browser_title = $request->browser_title;
713 713
 			}
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			$args->url = $request->module_id;
717 717
 		}
718 718
 
719
-		if($request->menu_name_key)
719
+		if ($request->menu_name_key)
720 720
 		{
721 721
 			$args->name = $request->menu_name_key;
722 722
 		}
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 			$args->name = $request->menu_name;
726 726
 		}
727 727
 
728
-		if($request->menu_desc) $args->desc = $request->menu_desc;
728
+		if ($request->menu_desc) $args->desc = $request->menu_desc;
729 729
 		else $args->desc = '';
730 730
 
731 731
 		unset($args->group_srls);
@@ -753,38 +753,38 @@  discard block
 block discarded – undo
753 753
 
754 754
 		$btnOutput = $this->_uploadButton($args);
755 755
 
756
-		if($btnOutput['normal_btn'])
756
+		if ($btnOutput['normal_btn'])
757 757
 		{
758 758
 			$this->add('normal_btn', $btnOutput['normal_btn']);
759 759
 			$item_info->normal_btn = $btnOutput['normal_btn'];
760 760
 		}
761
-		if($btnOutput['hover_btn'])
761
+		if ($btnOutput['hover_btn'])
762 762
 		{
763 763
 			$this->add('hover_btn', $btnOutput['hover_btn']);
764 764
 			$item_info->hover_btn = $btnOutput['hover_btn'];
765 765
 		}
766
-		if($btnOutput['active_btn'])
766
+		if ($btnOutput['active_btn'])
767 767
 		{
768 768
 			$this->add('active_btn', $btnOutput['active_btn']);
769 769
 			$item_info->active_btn = $btnOutput['active_btn'];
770 770
 		}
771 771
 
772 772
 		// group_srls check
773
-		if(count($item_info->group_srls) == 0)
773
+		if (count($item_info->group_srls) == 0)
774 774
 		{
775 775
 			unset($item_info->group_srls);
776 776
 		}
777 777
 
778 778
 		// Button delete check
779
-		if(!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
779
+		if (!$btnOutput['normal_btn'] && $args->isNormalDelete == 'Y')
780 780
 		{
781 781
 			$item_info->normal_btn = '';
782 782
 		}
783
-		if(!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
783
+		if (!$btnOutput['hover_btn'] && $args->isHoverDelete == 'Y')
784 784
 		{
785 785
 			$item_info->hover_btn = '';
786 786
 		}
787
-		if(!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
787
+		if (!$btnOutput['active_btn'] && $args->isActiveDelete == 'Y')
788 788
 		{
789 789
 			$item_info->active_btn = '';
790 790
 		}
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 		$args->is_force = Context::get('is_force');
825 825
 
826 826
 		$returnObj = $this->deleteItem($args);
827
-		if(is_object($returnObj))
827
+		if (is_object($returnObj))
828 828
 		{
829 829
 			$this->setError($returnObj->error);
830 830
 			$this->setMessage($returnObj->message);
@@ -853,11 +853,11 @@  discard block
 block discarded – undo
853 853
 		$args->menu_srl = $itemInfo->menu_srl;
854 854
 
855 855
 		// Display an error that the category cannot be deleted if it has a child node	603
856
-		if($args->is_force != 'Y')
856
+		if ($args->is_force != 'Y')
857 857
 		{
858 858
 			$output = executeQuery('menu.getChildMenuCount', $args);
859
-			if(!$output->toBool()) return $output;
860
-			if($output->data->count > 0)
859
+			if (!$output->toBool()) return $output;
860
+			if ($output->data->count > 0)
861 861
 			{
862 862
 				return new BaseObject(-1001, 'msg_cannot_delete_for_child');
863 863
 			}
@@ -869,22 +869,22 @@  discard block
 block discarded – undo
869 869
 
870 870
 		// check admin menu delete
871 871
 		$oAdmin = getClass('admin');
872
-		if($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
872
+		if ($menu_title == $oAdmin->getAdminMenuName() && $itemInfo->parent_srl == 0)
873 873
 		{
874 874
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
875 875
 		}
876 876
 
877
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
877
+		if ($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
878 878
 
879 879
 		// get menu properies with child menu
880 880
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
881 881
 		$originMenu = NULL;
882 882
 
883
-		if(is_readable(FileHandler::getRealPath($phpFile)))
883
+		if (is_readable(FileHandler::getRealPath($phpFile)))
884 884
 		{
885 885
 			include(FileHandler::getRealPath($phpFile));
886 886
 
887
-			if(is_array($menu->list))
887
+			if (is_array($menu->list))
888 888
 			{
889 889
 				$this->_searchMenu($menu->list, $args->menu_item_srl, $originMenu);
890 890
 			}
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 		$siteInfo = $oModuleModel->getSiteInfo($menuInfo->site_srl);
895 895
 		$isStartmenuInclude = false;
896 896
 		$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
897
-		if($isStartmenuInclude)
897
+		if ($isStartmenuInclude)
898 898
 		{
899 899
 			return new BaseObject(-1, 'msg_cannot_delete_homemenu');
900 900
 		}
@@ -918,14 +918,14 @@  discard block
 block discarded – undo
918 918
 
919 919
 	private function _checkHomeMenuInOriginMenu($originMenu, $startMid, &$isStartmenuInclude)
920 920
 	{
921
-		if($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
921
+		if ($originMenu['is_shortcut'] != 'Y' && $originMenu['url'] == $startMid)
922 922
 		{
923 923
 			$isStartmenuInclude = true;
924 924
 		}
925 925
 
926
-		if(!$isStartmenuInclude && is_array($originMenu['list']))
926
+		if (!$isStartmenuInclude && is_array($originMenu['list']))
927 927
 		{
928
-			foreach($originMenu['list'] AS $key=>$value)
928
+			foreach ($originMenu['list'] AS $key=>$value)
929 929
 			{
930 930
 				$this->_checkHomeMenuInOriginMenu($value, $startMid, $isStartmenuInclude);
931 931
 			}
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		$args->menu_srl = $menuSrl;
940 940
 		$args->menu_item_srl = $node['node_srl'];
941 941
 		$output = executeQuery("menu.deleteMenuItem", $args);
942
-		if(!$output->toBool())
942
+		if (!$output->toBool())
943 943
 		{
944 944
 			$oDB->rollback();
945 945
 			return $output;
@@ -948,12 +948,12 @@  discard block
 block discarded – undo
948 948
 		// Update the xml file and get its location
949 949
 		$xml_file = $this->makeXmlFile($args->menu_srl);
950 950
 		// Delete all of image buttons
951
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
951
+		if ($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
+		if ($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
+		if ($node['active_btn']) FileHandler::removeFile($node['active_btn']);
954 954
 
955 955
 		// Delete module
956
-		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
956
+		if ($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
957 957
 		{
958 958
 			$oModuleController = getController('module');
959 959
 			$oModuleModel = getModel('module');
@@ -963,12 +963,12 @@  discard block
 block discarded – undo
963 963
 			$args->site_srl = $menuInfo->site_srl;
964 964
 			$args->is_shortcut = 'Y';
965 965
 			$output = executeQuery('menu.getMenuItemByUrl', $args);
966
-			if($output->data->menu_item_srl)
966
+			if ($output->data->menu_item_srl)
967 967
 			{
968 968
 				$output->data->url = '';
969 969
 				$referenceItem = $output->data;
970 970
 				$output = $this->_updateMenuItem($referenceItem);
971
-				if(!$output->toBool())
971
+				if (!$output->toBool())
972 972
 				{
973 973
 					$oDB->rollback();
974 974
 					return $output;
@@ -976,10 +976,10 @@  discard block
 block discarded – undo
976 976
 			}
977 977
 
978 978
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url'], $menuInfo->site_srl);
979
-			if($moduleInfo->module_srl)
979
+			if ($moduleInfo->module_srl)
980 980
 			{
981 981
 				$output = $oModuleController->onlyDeleteModule($moduleInfo->module_srl);
982
-				if(!$output->toBool())
982
+				if (!$output->toBool())
983 983
 				{
984 984
 					$oDB->rollback();
985 985
 					return $output;
@@ -992,14 +992,14 @@  discard block
 block discarded – undo
992 992
 	private function _recursiveDeleteMenuItem(&$oDB, &$menuInfo, $node)
993 993
 	{
994 994
 		$output = $this->_deleteMenuItem($oDB, $menuInfo, $node);
995
-		if(!$output->toBool())
995
+		if (!$output->toBool())
996 996
 		{
997 997
 			return new BaseObject(-1, $output->message);
998 998
 		}
999 999
 
1000
-		if(is_array($node['list']))
1000
+		if (is_array($node['list']))
1001 1001
 		{
1002
-			foreach($node['list'] AS $key=>$value)
1002
+			foreach ($node['list'] AS $key=>$value)
1003 1003
 			{
1004 1004
 				$this->_recursiveDeleteMenuItem($oDB, $menuInfo, $value);
1005 1005
 			}
@@ -1012,31 +1012,31 @@  discard block
 block discarded – undo
1012 1012
 	 */
1013 1013
 	function procMenuAdminMoveItem()
1014 1014
 	{
1015
-		$mode = Context::get('mode');	//move
1016
-		$parent_srl = Context::get('parent_srl');	// Parent menu item serial number
1017
-		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1018
-		$target_srl = Context::get('target_srl');	// Self menu item serial number
1015
+		$mode = Context::get('mode'); //move
1016
+		$parent_srl = Context::get('parent_srl'); // Parent menu item serial number
1017
+		$source_srl = Context::get('source_srl'); // Same hierarchy's menu item serial number
1018
+		$target_srl = Context::get('target_srl'); // Self menu item serial number
1019 1019
 
1020
-		if(!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1,'msg_invalid_request');
1020
+		if (!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1, 'msg_invalid_request');
1021 1021
 
1022 1022
 		$oMenuAdminModel = getAdminModel('menu');
1023 1023
 
1024 1024
 		// get original menu item info for cache file recreate
1025 1025
 		$originalItemInfo = $oMenuAdminModel->getMenuItemInfo($target_srl);
1026
-		if(!$originalItemInfo->menu_item_srl)
1026
+		if (!$originalItemInfo->menu_item_srl)
1027 1027
 		{
1028 1028
 			return new BaseObject(-1, 'msg_empty_menu_item');
1029 1029
 		}
1030 1030
 
1031 1031
 		// get menu properies with child menu
1032
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1032
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $originalItemInfo->menu_srl);
1033 1033
 		$originMenu = NULL;
1034 1034
 
1035
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1035
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1036 1036
 		{
1037 1037
 			include(FileHandler::getRealPath($phpFile));
1038 1038
 
1039
-			if(is_array($menu->list))
1039
+			if (is_array($menu->list))
1040 1040
 			{
1041 1041
 				$this->_searchMenu($menu->list, $originalItemInfo->menu_item_srl, $originMenu);
1042 1042
 			}
@@ -1045,7 +1045,7 @@  discard block
 block discarded – undo
1045 1045
 		// get target menu info for move
1046 1046
 		$targetMenuItemInfo = $oMenuAdminModel->getMenuItemInfo($parent_srl);
1047 1047
 		// if move in same sitemap
1048
-		if($targetMenuItemInfo->menu_item_srl)
1048
+		if ($targetMenuItemInfo->menu_item_srl)
1049 1049
 		{
1050 1050
 			$menu_srl = $targetMenuItemInfo->menu_srl;
1051 1051
 		}
@@ -1057,20 +1057,20 @@  discard block
 block discarded – undo
1057 1057
 			$parent_srl = 0;
1058 1058
 		}
1059 1059
 
1060
-		if(!$this->homeModuleMid)
1060
+		if (!$this->homeModuleMid)
1061 1061
 		{
1062 1062
 			$oModuleModel = getModel('module');
1063 1063
 			$oMenuAdminController = getAdminController('menu');
1064 1064
 			$columnList = array('modules.mid',);
1065 1065
 			$output = $oModuleModel->getSiteInfo(0, $columnList);
1066
-			if($output->mid)
1066
+			if ($output->mid)
1067 1067
 			{
1068 1068
 				$this->homeModuleMid = $output->mid;
1069 1069
 			}
1070 1070
 		}
1071 1071
 
1072 1072
 		$this->moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $originMenu['is_shortcut'], $originMenu['url']);
1073
-		if(count($originMenu['list']) > 0)
1073
+		if (count($originMenu['list']) > 0)
1074 1074
 		{
1075 1075
 			$this->_recursiveUpdateMenuItem($originMenu['list'], $menu_srl);
1076 1076
 		}
@@ -1084,9 +1084,9 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 	private function _recursiveUpdateMenuItem($node, $menu_srl)
1086 1086
 	{
1087
-		if(is_array($node))
1087
+		if (is_array($node))
1088 1088
 		{
1089
-			foreach($node AS $key=>$node)
1089
+			foreach ($node AS $key=>$node)
1090 1090
 			{
1091 1091
 				$args = new stdClass();
1092 1092
 				$args->menu_srl = $menu_srl;
@@ -1094,11 +1094,11 @@  discard block
 block discarded – undo
1094 1094
 				$output = $this->_updateMenuItem($args);
1095 1095
 
1096 1096
 				//module's menu_srl move also
1097
-				if($node['is_shortcut'] == 'N' && !empty($node['url']))
1097
+				if ($node['is_shortcut'] == 'N' && !empty($node['url']))
1098 1098
 				{
1099 1099
 					$oModuleModel = getModel('module');
1100 1100
 					$moduleInfo = $oModuleModel->getModuleInfoByMid($node['url']);
1101
-					if($menu_srl != $moduleInfo->menu_srl)
1101
+					if ($menu_srl != $moduleInfo->menu_srl)
1102 1102
 					{
1103 1103
 						$moduleInfo->menu_srl = $menu_srl;
1104 1104
 						$oModuleController = getController('module');
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 					}
1107 1107
 				}
1108 1108
 
1109
-				if(count($node['list']) > 0)
1109
+				if (count($node['list']) > 0)
1110 1110
 				{
1111 1111
 					$this->_recursiveUpdateMenuItem($node['list'], $menu_srl);
1112 1112
 				}
@@ -1128,21 +1128,21 @@  discard block
 block discarded – undo
1128 1128
 		$menuSrl = $itemInfo->menu_srl;
1129 1129
 
1130 1130
 		// get menu properies with child menu
1131
-		$phpFile = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menuSrl);
1131
+		$phpFile = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menuSrl);
1132 1132
 		$originMenu = NULL;
1133 1133
 
1134
-		if(is_readable(FileHandler::getRealPath($phpFile)))
1134
+		if (is_readable(FileHandler::getRealPath($phpFile)))
1135 1135
 		{
1136 1136
 			include(FileHandler::getRealPath($phpFile));
1137 1137
 
1138
-			if(is_array($menu->list))
1138
+			if (is_array($menu->list))
1139 1139
 			{
1140 1140
 				$this->_searchMenu($menu->list, $menuItemSrl, $originMenu);
1141 1141
 			}
1142 1142
 		}
1143 1143
 
1144 1144
 		// copy the menu item with recursively
1145
-		if(is_array($originMenu))
1145
+		if (is_array($originMenu))
1146 1146
 		{
1147 1147
 			$this->_copyMenu($menuSrl, $parentSrl, $originMenu);
1148 1148
 		}
@@ -1158,15 +1158,15 @@  discard block
 block discarded – undo
1158 1158
 	 */
1159 1159
 	private function _searchMenu(&$menuList, $menuItemSrl, &$originMenu)
1160 1160
 	{
1161
-		if(array_key_exists($menuItemSrl, $menuList))
1161
+		if (array_key_exists($menuItemSrl, $menuList))
1162 1162
 		{
1163 1163
 			$originMenu = $menuList[$menuItemSrl];
1164 1164
 			return;
1165 1165
 		}
1166 1166
 
1167
-		foreach($menuList AS $key=>$value)
1167
+		foreach ($menuList AS $key=>$value)
1168 1168
 		{
1169
-			if(count($value['list']) > 0)
1169
+			if (count($value['list']) > 0)
1170 1170
 			{
1171 1171
 				$this->_searchMenu($value['list'], $menuItemSrl, $originMenu);
1172 1172
 			}
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		// default argument setting
1182 1182
 		$args = new stdClass();
1183 1183
 		$args->menu_srl = $menuSrl;
1184
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1184
+		if ($parentSrl == 0) $args->parent_srl = $menuSrl;
1185 1185
 		else $args->parent_srl = $parentSrl;
1186 1186
 		$args->menu_name_key = $originMenu['text'];
1187 1187
 		$args->menu_name = $originMenu['text'];
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 
1195 1195
 		$isModuleCopySuccess = false;
1196 1196
 		// if menu have a reference of module instance
1197
-		if($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0 )
1197
+		if ($menuItemInfo->is_shortcut == 'N' && strncasecmp('http', $originMenu['url'], 4) !== 0)
1198 1198
 		{
1199 1199
 			$oModuleModel = getModel('module');
1200 1200
 			$moduleInfo = $oModuleModel->getModuleInfoByMid($originMenu['url']);
@@ -1214,22 +1214,22 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 			$args->module_srl = $copiedModuleSrl;
1216 1216
 
1217
-			if($copiedModuleSrl)
1217
+			if ($copiedModuleSrl)
1218 1218
 			{
1219 1219
 				$isModuleCopySuccess = true;
1220 1220
 			}
1221 1221
 		}
1222 1222
 		// if menu type is shortcut
1223
-		else if($menuItemInfo->is_shortcut == 'Y')
1223
+		else if ($menuItemInfo->is_shortcut == 'Y')
1224 1224
 		{
1225 1225
 			$args->shortcut_target = $originMenu['url'];
1226 1226
 			$isModuleCopySuccess = true;
1227 1227
 		}
1228 1228
 
1229
-		if($isModuleCopySuccess)
1229
+		if ($isModuleCopySuccess)
1230 1230
 		{
1231 1231
 			// if have a group permission
1232
-			if($menuItemInfo->group_srls)
1232
+			if ($menuItemInfo->group_srls)
1233 1233
 			{
1234 1234
 				$args->group_srls = $menuItemInfo->group_srls;
1235 1235
 			}
@@ -1243,12 +1243,12 @@  discard block
 block discarded – undo
1243 1243
 
1244 1244
 			// if have a button, copy a button image also
1245 1245
 			$insertedMenuItemSrl = $this->get('menu_item_srl');
1246
-			if($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1246
+			if ($menuItemInfo->normal_btn || $menuItemInfo->hover_btn || $menuItemInfo->active_btn)
1247 1247
 			{
1248 1248
 				// copy & upate
1249 1249
 				$update_item_info = $oMenuAdminModel->getMenuItemInfo($insertedMenuItemSrl);
1250
-				$copied_info = $this->_copyButton($insertedMenuItemSrl,$update_item_info->menu_srl, $menuItemInfo);
1251
-				if(count($update_item_info->group_srls) == 0)
1250
+				$copied_info = $this->_copyButton($insertedMenuItemSrl, $update_item_info->menu_srl, $menuItemInfo);
1251
+				if (count($update_item_info->group_srls) == 0)
1252 1252
 				{
1253 1253
 					unset($update_item_info->group_srls);
1254 1254
 				}
@@ -1262,7 +1262,7 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
 		// if have a child menu, copy child menu also
1264 1264
 		$childMenu = array_shift($originMenu['list']);
1265
-		if(count($childMenu) > 0)
1265
+		if (count($childMenu) > 0)
1266 1266
 		{
1267 1267
 			$this->_copyMenu($menuSrl, $insertedMenuItemSrl, $childMenu);
1268 1268
 		}
@@ -1272,10 +1272,10 @@  discard block
 block discarded – undo
1272 1272
 	{
1273 1273
 		$time = $_SERVER['REQUEST_TIME'];
1274 1274
 		$randomString = "";
1275
-		for($i=0;$i<4;$i++)
1275
+		for ($i = 0; $i < 4; $i++)
1276 1276
 		{
1277 1277
 			$case = rand(0, 1);
1278
-			if($case) $doc = rand(65, 90);
1278
+			if ($case) $doc = rand(65, 90);
1279 1279
 			else $doc = rand(97, 122);
1280 1280
 
1281 1281
 			$randomString .= chr($doc);
@@ -1299,32 +1299,32 @@  discard block
 block discarded – undo
1299 1299
 		// menu name update
1300 1300
 		$args->menu_srl = $this->menuSrl;
1301 1301
 		$output = executeQuery('menu.updateMenu', $args);
1302
-		if(!$output->toBool()) return $output;
1302
+		if (!$output->toBool()) return $output;
1303 1303
 
1304 1304
 		$this->map = array();
1305
-		if(is_array($parentKeyList))
1305
+		if (is_array($parentKeyList))
1306 1306
 		{
1307
-			foreach($parentKeyList as $no=>$srl)
1307
+			foreach ($parentKeyList as $no=>$srl)
1308 1308
 			{
1309
-				if($srl === 0) continue;
1310
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1309
+				if ($srl === 0) continue;
1310
+				if (!is_array($this->map[$srl]))$this->map[$srl] = array();
1311 1311
 				$this->map[$srl][] = $no;
1312 1312
 			}
1313 1313
 		}
1314 1314
 
1315 1315
 		$result = array();
1316
-		if(is_array($this->itemKeyList))
1316
+		if (is_array($this->itemKeyList))
1317 1317
 		{
1318
-			foreach($this->itemKeyList as $srl)
1318
+			foreach ($this->itemKeyList as $srl)
1319 1319
 			{
1320
-				if(!$this->checked[$srl])
1320
+				if (!$this->checked[$srl])
1321 1321
 				{
1322 1322
 					$target = new stdClass();
1323 1323
 					$this->checked[$srl] = 1;
1324 1324
 					$target->node = $srl;
1325
-					$target->child= array();
1325
+					$target->child = array();
1326 1326
 
1327
-					while(count($this->map[$srl]))
1327
+					while (count($this->map[$srl]))
1328 1328
 					{
1329 1329
 						$this->_setParent($srl, array_shift($this->map[$srl]), $target);
1330 1330
 					}
@@ -1333,13 +1333,13 @@  discard block
 block discarded – undo
1333 1333
 			}
1334 1334
 		}
1335 1335
 
1336
-		if(is_array($result))
1336
+		if (is_array($result))
1337 1337
 		{
1338 1338
 			$i = 0;
1339
-			foreach($result AS $key=>$node)
1339
+			foreach ($result AS $key=>$node)
1340 1340
 			{
1341
-				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move');	//move parent node
1342
-				$this->_recursiveMoveMenuItem($node);	//move child node
1341
+				$this->moveMenuItem($this->menuSrl, 0, $i, $node->node, 'move'); //move parent node
1342
+				$this->_recursiveMoveMenuItem($node); //move child node
1343 1343
 				$i = $node->node;
1344 1344
 			}
1345 1345
 		}
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 		$child_node->child = array();
1369 1369
 		$target->child[] = $child_node;
1370 1370
 
1371
-		while(count($this->map[$child_srl]))
1371
+		while (count($this->map[$child_srl]))
1372 1372
 		{
1373 1373
 			$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
1374 1374
 		}
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	function _recursiveMoveMenuItem($result)
1384 1384
 	{
1385 1385
 		$i = 0;
1386
-		while(count($result->child))
1386
+		while (count($result->child))
1387 1387
 		{
1388 1388
 			unset($node);
1389 1389
 			$node = array_shift($result->child);
@@ -1403,48 +1403,48 @@  discard block
 block discarded – undo
1403 1403
 	 * @param string $mode 'move' or 'insert'
1404 1404
 	 * @return void
1405 1405
 	 */
1406
-	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut='Y', $url=NULL)
1406
+	function moveMenuItem($menu_srl, $parent_srl, $source_srl, $target_srl, $mode, $isShortcut = 'Y', $url = NULL)
1407 1407
 	{
1408 1408
 		// Get the original menus
1409 1409
 		$oMenuAdminModel = getAdminModel('menu');
1410 1410
 
1411 1411
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1412
-		if($target_item->menu_item_srl != $target_srl) return new BaseObject(-1,'msg_invalid_request');
1412
+		if ($target_item->menu_item_srl != $target_srl) return new BaseObject(-1, 'msg_invalid_request');
1413 1413
 		// Move the menu location(change the order menu appears)
1414
-		if($mode == 'move')
1414
+		if ($mode == 'move')
1415 1415
 		{
1416 1416
 			$args = new stdClass();
1417 1417
 			$args->parent_srl = $parent_srl;
1418 1418
 			$args->menu_srl = $menu_srl;
1419 1419
 
1420
-			if($source_srl)
1420
+			if ($source_srl)
1421 1421
 			{
1422 1422
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1423
-				if($source_item->menu_item_srl != $source_srl) return new BaseObject(-1,'msg_invalid_request');
1424
-				$args->listorder = $source_item->listorder-1;
1423
+				if ($source_item->menu_item_srl != $source_srl) return new BaseObject(-1, 'msg_invalid_request');
1424
+				$args->listorder = $source_item->listorder - 1;
1425 1425
 			}
1426 1426
 			else
1427 1427
 			{
1428 1428
 				$output = executeQuery('menu.getMaxListorder', $args);
1429
-				if(!$output->toBool()) return $output;
1430
-				$args->listorder = (int)$output->data->listorder;
1431
-				if(!$args->listorder) $args->listorder= 0;
1429
+				if (!$output->toBool()) return $output;
1430
+				$args->listorder = (int) $output->data->listorder;
1431
+				if (!$args->listorder) $args->listorder = 0;
1432 1432
 			}
1433 1433
 			$args->parent_srl = $parent_srl;
1434 1434
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1435
-			if(!$output->toBool()) return $output;
1435
+			if (!$output->toBool()) return $output;
1436 1436
 
1437 1437
 			$args->parent_srl = $parent_srl;
1438 1438
 			$args->menu_item_srl = $target_srl;
1439 1439
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1440
-			if(!$output->toBool()) return $output;
1440
+			if (!$output->toBool()) return $output;
1441 1441
 
1442 1442
 			//module's menu_srl move also
1443
-			if($isShortcut == 'N' && !empty($url))
1443
+			if ($isShortcut == 'N' && !empty($url))
1444 1444
 			{
1445 1445
 				$oModuleModel = getModel('module');
1446 1446
 				$moduleInfo = $oModuleModel->getModuleInfoByMid($url);
1447
-				if($menu_srl != $moduleInfo->menu_srl)
1447
+				if ($menu_srl != $moduleInfo->menu_srl)
1448 1448
 				{
1449 1449
 					$moduleInfo->menu_srl = $menu_srl;
1450 1450
 					$oModuleController = getController('module');
@@ -1452,13 +1452,13 @@  discard block
 block discarded – undo
1452 1452
 				}
1453 1453
 
1454 1454
 				// change home menu cache file
1455
-				if($url == $this->homeModuleMid)
1455
+				if ($url == $this->homeModuleMid)
1456 1456
 				{
1457
-					if(file_exists($this->homeMenuCacheFile))
1457
+					if (file_exists($this->homeMenuCacheFile))
1458 1458
 					{
1459 1459
 						include($this->homeMenuCacheFile);
1460 1460
 					}
1461
-					if(!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1461
+					if (!$homeMenuSrl || $homeMenuSrl != $menu_srl)
1462 1462
 					{
1463 1463
 						$this->makeHomemenuCacheFile($menu_srl);
1464 1464
 					}
@@ -1466,13 +1466,13 @@  discard block
 block discarded – undo
1466 1466
 			}
1467 1467
 			// Add a child
1468 1468
 		}
1469
-		elseif($mode == 'insert')
1469
+		elseif ($mode == 'insert')
1470 1470
 		{
1471 1471
 			$args->menu_item_srl = $target_srl;
1472 1472
 			$args->parent_srl = $parent_srl;
1473
-			$args->listorder = -1*getNextSequence();
1473
+			$args->listorder = -1 * getNextSequence();
1474 1474
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1475
-			if(!$output->toBool()) return $output;
1475
+			if (!$output->toBool()) return $output;
1476 1476
 		}
1477 1477
 
1478 1478
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1497,8 +1497,8 @@  discard block
 block discarded – undo
1497 1497
 		// Re-generate the xml file
1498 1498
 		$xml_file = $this->makeXmlFile($menu_srl);
1499 1499
 		// Set return value
1500
-		$this->add('menu_title',$menu_title);
1501
-		$this->add('xml_file',$xml_file);
1500
+		$this->add('menu_title', $menu_title);
1501
+		$this->add('xml_file', $xml_file);
1502 1502
 	}
1503 1503
 
1504 1504
 	/**
@@ -1512,12 +1512,12 @@  discard block
 block discarded – undo
1512 1512
 		$target = Context::get('target');
1513 1513
 		$target_file = Context::get($target);
1514 1514
 		// Error occurs when the target is neither a uploaded file nor a valid file
1515
-		if(!$menu_srl || !$menu_item_srl)
1515
+		if (!$menu_srl || !$menu_item_srl)
1516 1516
 		{
1517 1517
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1518 1518
 
1519 1519
 		}
1520
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1520
+		else if (!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i', $target_file['name']) || !checkUploadedFile($target_file['tmp_name']))
1521 1521
 		{
1522 1522
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1523 1523
 		}
@@ -1525,13 +1525,13 @@  discard block
 block discarded – undo
1525 1525
 		// Move the file to a specific director if the uploaded file meets requirement
1526 1526
 		else
1527 1527
 		{
1528
-			$tmp_arr = explode('.',$target_file['name']);
1529
-			$ext = $tmp_arr[count($tmp_arr)-1];
1528
+			$tmp_arr = explode('.', $target_file['name']);
1529
+			$ext = $tmp_arr[count($tmp_arr) - 1];
1530 1530
 
1531 1531
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1532 1532
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1533 1533
 
1534
-			if(!is_dir($path)) FileHandler::makeDir($path);
1534
+			if (!is_dir($path)) FileHandler::makeDir($path);
1535 1535
 
1536 1536
 			move_uploaded_file($target_file['tmp_name'], $filename);
1537 1537
 			Context::set('filename', $filename);
@@ -1564,14 +1564,14 @@  discard block
 block discarded – undo
1564 1564
 	{
1565 1565
 		$oModuleModel = getModel('module');
1566 1566
 		$installed_module_list = $oModuleModel->getModulesXmlInfo();
1567
-		if(is_array($installed_module_list))
1567
+		if (is_array($installed_module_list))
1568 1568
 		{
1569 1569
 			$currentLang = Context::getLangType();
1570 1570
 			$menuList = array();
1571
-			foreach($installed_module_list AS $key=>$value)
1571
+			foreach ($installed_module_list AS $key=>$value)
1572 1572
 			{
1573 1573
 				$info = $oModuleModel->getModuleActionXml($value->module);
1574
-				if($info->menu) $menuList[$value->module] = $info->menu;
1574
+				if ($info->menu) $menuList[$value->module] = $info->menu;
1575 1575
 				unset($info->menu);
1576 1576
 			}
1577 1577
 		}
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1604 1604
 
1605 1605
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1606
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1606
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
+		if (empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1608 1608
 		$dbInfo = Context::getDBInfo();
1609 1609
 
1610 1610
 		$args = new stdClass();
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
 		$args->menu_srl = $requestArgs->menu_srl;
1614 1614
 		$args->name = sprintf('{$lang->menu_gnb_sub[\'%s\']}', $menuName);
1615 1615
 		//if now page is https...
1616
-		if(strpos($url, 'https') !== false)
1616
+		if (strpos($url, 'https') !== false)
1617 1617
 		{
1618 1618
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619 1619
 		}
@@ -1627,23 +1627,23 @@  discard block
 block discarded – undo
1627 1627
 		$args->hover_btn = '';
1628 1628
 		$args->active_btn = '';
1629 1629
 		$args->group_srls = implode(',', array_keys($groupSrlList));
1630
-		$args->listorder = -1*$args->menu_item_srl;
1630
+		$args->listorder = -1 * $args->menu_item_srl;
1631 1631
 
1632 1632
 		// Check if already exists
1633 1633
 		$oMenuModel = getAdminModel('menu');
1634 1634
 		$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
1635 1635
 		// Update if exists
1636
-		if($item_info->menu_item_srl == $args->menu_item_srl)
1636
+		if ($item_info->menu_item_srl == $args->menu_item_srl)
1637 1637
 		{
1638 1638
 			$output = $this->_updateMenuItem($args);
1639
-			if(!$output->toBool()) return $output;
1639
+			if (!$output->toBool()) return $output;
1640 1640
 		}
1641 1641
 		// Insert if not exist
1642 1642
 		else
1643 1643
 		{
1644
-			$args->listorder = -1*$args->menu_item_srl;
1644
+			$args->listorder = -1 * $args->menu_item_srl;
1645 1645
 			$output = executeQuery('menu.insertMenuItem', $args);
1646
-			if(!$output->toBool()) return $output;
1646
+			if (!$output->toBool()) return $output;
1647 1647
 		}
1648 1648
 		// Get information of the menu
1649 1649
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1671,23 +1671,23 @@  discard block
 block discarded – undo
1671 1671
 
1672 1672
 		// Menu Exposure update
1673 1673
 		// if exposure target is only login user...
1674
-		if(!$exposure)
1674
+		if (!$exposure)
1675 1675
 		{
1676 1676
 			$args->group_srls = '';
1677 1677
 		}
1678 1678
 		else
1679 1679
 		{
1680 1680
 			$exposure = explode(',', $exposure);
1681
-			if(in_array($exposure, array('-1','-3')))
1681
+			if (in_array($exposure, array('-1', '-3')))
1682 1682
 			{
1683 1683
 				$args->group_srls = $exposure;
1684 1684
 			}
1685 1685
 
1686
-			if($exposure) $args->group_srls = implode(',', $exposure);
1686
+			if ($exposure) $args->group_srls = implode(',', $exposure);
1687 1687
 		}
1688 1688
 
1689 1689
 		$output = $this->_updateMenuItem($args);
1690
-		if(!$output->toBool())
1690
+		if (!$output->toBool())
1691 1691
 		{
1692 1692
 			return $output;
1693 1693
 		}
@@ -1701,21 +1701,21 @@  discard block
 block discarded – undo
1701 1701
 		$moduleInfo = $oModuleModel->getModuleInfoByMid($itemInfo->url, $menuInfo->site_srl);
1702 1702
 		$xml_info = $oModuleModel->getModuleActionXML($moduleInfo->module);
1703 1703
 
1704
-		if($itemInfo->is_shortcut === 'Y')
1704
+		if ($itemInfo->is_shortcut === 'Y')
1705 1705
 		{
1706 1706
 			$moduleGrnatsArgs = new stdClass;
1707 1707
 			$moduleGrnatsArgs->module_srl = $moduleInfo->module_srl;
1708 1708
 			$output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs);
1709
-			if(!$output->data) $output->data = array();
1709
+			if (!$output->data) $output->data = array();
1710 1710
 			$moduleGrnats = new stdClass();
1711
-			foreach($output->data as $grant)
1711
+			foreach ($output->data as $grant)
1712 1712
 			{
1713 1713
 				$moduleGrnats->{$grant->name}[] = $grant->group_srl;
1714 1714
 			}
1715 1715
 		}
1716 1716
 
1717 1717
 		$grantList = $xml_info->grant;
1718
-		if(!$grantList) $grantList = new stdClass;
1718
+		if (!$grantList) $grantList = new stdClass;
1719 1719
 
1720 1720
 		$grantList->access = new stdClass();
1721 1721
 		$grantList->access->default = 'guest';
@@ -1723,14 +1723,14 @@  discard block
 block discarded – undo
1723 1723
 		$grantList->manager->default = 'manager';
1724 1724
 
1725 1725
 		$grant = new stdClass();
1726
-		foreach($grantList AS $grantName=>$grantInfo)
1726
+		foreach ($grantList AS $grantName=>$grantInfo)
1727 1727
 		{
1728
-			if($htPerm[$grantName])
1728
+			if ($htPerm[$grantName])
1729 1729
 			{
1730 1730
 				$htPerm[$grantName] = explode(',', $htPerm[$grantName]);
1731 1731
 
1732 1732
 				// users in a particular group
1733
-				if(is_array($htPerm[$grantName]))
1733
+				if (is_array($htPerm[$grantName]))
1734 1734
 				{
1735 1735
 					$grant->{$grantName} = $htPerm[$grantName];
1736 1736
 					continue;
@@ -1742,13 +1742,13 @@  discard block
 block discarded – undo
1742 1742
 					continue;
1743 1743
 				}
1744 1744
 			}
1745
-			else if($itemInfo->is_shortcut === 'Y')
1745
+			else if ($itemInfo->is_shortcut === 'Y')
1746 1746
 			{
1747
-				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1747
+				if (isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1748 1748
 			}
1749 1749
 		}
1750 1750
 
1751
-		if(count($grant))
1751
+		if (count($grant))
1752 1752
 		{
1753 1753
 			$oModuleController = getController('module');
1754 1754
 			$oModuleController->insertModuleGrants($moduleInfo->module_srl, $grant);
@@ -1766,15 +1766,15 @@  discard block
 block discarded – undo
1766 1766
 	function makeXmlFile($menu_srl)
1767 1767
 	{
1768 1768
 		// Return if there is no information when creating the xml file
1769
-		if(!$menu_srl) return;
1769
+		if (!$menu_srl) return;
1770 1770
 		// Get menu informaton
1771 1771
 		$args = new stdClass();
1772 1772
 		$args->menu_srl = $menu_srl;
1773 1773
 		$output = executeQuery('menu.getMenu', $args);
1774
-		if(!$output->toBool() || !$output->data) return $output;
1775
-		$site_srl = (int)$output->data->site_srl;
1774
+		if (!$output->toBool() || !$output->data) return $output;
1775
+		$site_srl = (int) $output->data->site_srl;
1776 1776
 
1777
-		if($site_srl)
1777
+		if ($site_srl)
1778 1778
 		{
1779 1779
 			$oModuleModel = getModel('module');
1780 1780
 			$columnList = array('sites.domain');
@@ -1785,13 +1785,13 @@  discard block
 block discarded – undo
1785 1785
 		$args->menu_srl = $menu_srl;
1786 1786
 		$args->sort_index = 'listorder';
1787 1787
 		$output = executeQuery('menu.getMenuItems', $args);
1788
-		if(!$output->toBool()) return;
1788
+		if (!$output->toBool()) return;
1789 1789
 		// Specify the name of the cache file
1790
-		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1791
-		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
1790
+		$xml_file = sprintf(_XE_PATH_."files/cache/menu/%s.xml.php", $menu_srl);
1791
+		$php_file = sprintf(_XE_PATH_."files/cache/menu/%s.php", $menu_srl);
1792 1792
 		// If no data found, generate an XML file without node data
1793 1793
 		$list = $output->data;
1794
-		if(!$list)
1794
+		if (!$list)
1795 1795
 		{
1796 1796
 			$xml_buff = "<root />";
1797 1797
 			FileHandler::writeFile($xml_file, $xml_buff);
@@ -1799,10 +1799,10 @@  discard block
 block discarded – undo
1799 1799
 			return $xml_file;
1800 1800
 		}
1801 1801
 		// Change to an array if only a single data is obtained
1802
-		if(!is_array($list)) $list = array($list);
1802
+		if (!is_array($list)) $list = array($list);
1803 1803
 		// Create a tree for loop
1804 1804
 		$list_count = count($list);
1805
-		for($i=0;$i<$list_count;$i++)
1805
+		for ($i = 0; $i < $list_count; $i++)
1806 1806
 		{
1807 1807
 			$node = $list[$i];
1808 1808
 			$menu_item_srl = $node->menu_item_srl;
@@ -1858,7 +1858,7 @@  discard block
 block discarded – undo
1858 1858
 		$php_buff = sprintf(
1859 1859
 			'<?php '.
1860 1860
 			'if(!defined("__XE__")) exit(); '.
1861
-			'$menu = new stdClass();' .
1861
+			'$menu = new stdClass();'.
1862 1862
 			'%s; '.
1863 1863
 			'%s; '.
1864 1864
 			'$menu->list = array(%s); '.
@@ -1887,26 +1887,26 @@  discard block
 block discarded – undo
1887 1887
 	 */
1888 1888
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1889 1889
 	{
1890
-		if(!$source_node) return;
1890
+		if (!$source_node) return;
1891 1891
 
1892 1892
 		$oMenuAdminModel = getAdminModel('menu');
1893 1893
 
1894
-		foreach($source_node as $menu_item_srl => $node)
1894
+		foreach ($source_node as $menu_item_srl => $node)
1895 1895
 		{
1896 1896
 			$child_buff = "";
1897 1897
 			// Get data of the child nodes
1898
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1898
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
1899 1899
 			// List variables
1900 1900
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1901
-			foreach($names as $key => $val)
1901
+			foreach ($names as $key => $val)
1902 1902
 			{
1903
-				$name_arr_str .= sprintf('"%s"=>%s,',$key, var_export($val, true));
1903
+				$name_arr_str .= sprintf('"%s"=>%s,', $key, var_export($val, true));
1904 1904
 			}
1905 1905
 			$name_str = sprintf('$_names = array(%s); print $_names[$lang_type];', $name_arr_str);
1906 1906
 
1907
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
1908
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
1909
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1907
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
1908
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
1909
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1910 1910
 			{
1911 1911
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
1912 1912
 			}
@@ -1916,21 +1916,21 @@  discard block
 block discarded – undo
1916 1916
 			$expand = ($node->expand) ? $node->expand : '';
1917 1917
 
1918 1918
 			$normal_btn = ($node->normal_btn) ? $node->normal_btn : '';
1919
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1919
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
1920 1920
 			else $normal_btn = '';
1921 1921
 			$hover_btn = ($node->hover_btn) ? $node->hover_btn : '';
1922
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1922
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
1923 1923
 			else $hover_btn = '';
1924 1924
 			$active_btn = ($node->active_btn) ? $node->active_btn : '';
1925
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1925
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
1926 1926
 			else $active_btn = '';
1927 1927
 
1928 1928
 			$group_srls = ($node->group_srls) ? $node->group_srls : '';
1929 1929
 
1930
-			if($normal_btn)
1930
+			if ($normal_btn)
1931 1931
 			{
1932
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1932
+				if ($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
+				if ($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
1934 1934
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1935 1935
 			}
1936 1936
 			else
@@ -1939,8 +1939,8 @@  discard block
 block discarded – undo
1939 1939
 			}
1940 1940
 
1941 1941
 			// If the value of node->group_srls exists
1942
-			if($group_srls) {
1943
-				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1942
+			if ($group_srls) {
1943
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))', $group_srls, $group_srls == -1 ? 1 : 0);
1944 1944
 			}
1945 1945
 			else
1946 1946
 			{
@@ -1969,8 +1969,8 @@  discard block
 block discarded – undo
1969 1969
 				$link
1970 1970
 			);
1971 1971
 
1972
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1973
-			else $buff .=  sprintf('<node %s />', $attribute);
1972
+			if ($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1973
+			else $buff .= sprintf('<node %s />', $attribute);
1974 1974
 		}
1975 1975
 		return $buff;
1976 1976
 	}
@@ -1989,84 +1989,84 @@  discard block
 block discarded – undo
1989 1989
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1990 1990
 	{
1991 1991
 		$output = array("buff"=>"", "url_list"=>array());
1992
-		if(!$source_node) return $output;
1992
+		if (!$source_node) return $output;
1993 1993
 
1994 1994
 		$oMenuAdminModel = getAdminModel('menu');
1995 1995
 
1996
-		foreach($source_node as $menu_item_srl => $node)
1996
+		foreach ($source_node as $menu_item_srl => $node)
1997 1997
 		{
1998 1998
 			// Get data from child nodes if exist.
1999
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
1999
+			if ($menu_item_srl && $tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2000 2000
 			else $child_output = array("buff"=>"", "url_list"=>array());
2001 2001
 
2002 2002
 			// List variables
2003 2003
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
2004 2004
 			unset($name_arr_str);
2005
-			foreach($names as $key => $val)
2005
+			foreach ($names as $key => $val)
2006 2006
 			{
2007
-				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]?[a-zA-Z_0-9]*)\'\]\}/', $val) === 1)
2007
+				if (preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]?[a-zA-Z_0-9]*)\'\]\}/', $val) === 1)
2008 2008
 				{
2009 2009
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2010 2010
 				}
2011 2011
 				else
2012 2012
 				{
2013
-					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2013
+					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\', '\''), array('\\\\', '\\\''), removeHackTag($val)));
2014 2014
 				}
2015 2015
 			}
2016 2016
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2017 2017
 
2018 2018
 			// If url value is not empty in the current node, put the value into an array url_list
2019
-			if($node->url) $child_output['url_list'][] = $node->url;
2019
+			if ($node->url) $child_output['url_list'][] = $node->url;
2020 2020
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2021 2021
 			// If node->group_srls value exists
2022
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2022
+			if ($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))', $node->group_srls, $node->group_srls == -1 ? 1 : 0);
2023 2023
 			else $group_check_code = "true";
2024 2024
 
2025 2025
 			// List variables
2026
-			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
2027
-			$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
2028
-			$desc = str_replace(array('&','"',"'"),array('&amp;','&quot;','\\\''),$node->desc);
2029
-			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2026
+			$href = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->href);
2027
+			$url = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->url);
2028
+			$desc = str_replace(array('&', '"', "'"), array('&amp;', '&quot;', '\\\''), $node->desc);
2029
+			if (preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2030 2030
 			{
2031 2031
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2032 2032
 			}
2033 2033
 			else $href = var_export($url, true);
2034 2034
 			$is_shortcut = $node->is_shortcut;
2035 2035
 			$open_window = $node->open_window;
2036
-			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
2037
-			$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->hover_btn);
2038
-			$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->active_btn);
2036
+			$normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->normal_btn);
2037
+			$hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->hover_btn);
2038
+			$active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $node->active_btn);
2039 2039
 
2040
-			foreach($child_output['url_list'] as $key =>$val)
2040
+			foreach ($child_output['url_list'] as $key =>$val)
2041 2041
 			{
2042 2042
 				$child_output['url_list'][$key] = addslashes($val);
2043 2043
 			}
2044 2044
 
2045
-			$selected = '"'.implode('","',$child_output['url_list']).'"';
2045
+			$selected = '"'.implode('","', $child_output['url_list']).'"';
2046 2046
 			$child_buff = $child_output['buff'];
2047 2047
 			$expand = $node->expand;
2048 2048
 
2049 2049
 			$normal_btn = $node->normal_btn;
2050
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2050
+			if ($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $normal_btn);
2051 2051
 			else $normal_btn = '';
2052 2052
 
2053 2053
 			$hover_btn = $node->hover_btn;
2054
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2054
+			if ($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $hover_btn);
2055 2055
 			else $hover_btn = '';
2056 2056
 
2057 2057
 			$active_btn = $node->active_btn;
2058
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2058
+			if ($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $active_btn);
2059 2059
 			else $active_btn = '';
2060 2060
 
2061 2061
 
2062 2062
 			$group_srls = $node->group_srls;
2063 2063
 
2064
-			if($normal_btn)
2064
+			if ($normal_btn)
2065 2065
 			{
2066
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2067
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2066
+				if ($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2067
+				if ($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2068 2068
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2069
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2069
+				if ($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2070 2070
 				else $link_active = $link;
2071 2071
 			}
2072 2072
 			else
@@ -2104,7 +2104,7 @@  discard block
 block discarded – undo
2104 2104
 			);
2105 2105
 
2106 2106
 			// Generate buff data
2107
-			$output['buff'] .=  sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2107
+			$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
2108 2108
 			$output['name'] .= $name_str;
2109 2109
 		}
2110 2110
 		return $output;
@@ -2118,19 +2118,19 @@  discard block
 block discarded – undo
2118 2118
 	 */
2119 2119
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2120 2120
 	{
2121
-		if(!count($menu_srl_list)) return;
2121
+		if (!count($menu_srl_list)) return;
2122 2122
 		// Delete the value of menu_srls
2123
-		$args->menu_srls = implode(',',$menu_srl_list);
2123
+		$args->menu_srls = implode(',', $menu_srl_list);
2124 2124
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2125
-		if(!$output->toBool()) return $output;
2125
+		if (!$output->toBool()) return $output;
2126 2126
 
2127 2127
 		$args->layout_srl = $layout_srl;
2128 2128
 		// Mapping menu_srls, layout_srl
2129
-		for($i=0;$i<count($menu_srl_list);$i++)
2129
+		for ($i = 0; $i < count($menu_srl_list); $i++)
2130 2130
 		{
2131 2131
 			$args->menu_srl = $menu_srl_list[$i];
2132 2132
 			$output = executeQuery('menu.insertMenuLayout', $args);
2133
-			if(!$output->toBool()) return $output;
2133
+			if (!$output->toBool()) return $output;
2134 2134
 		}
2135 2135
 	}
2136 2136
 
@@ -2143,47 +2143,47 @@  discard block
 block discarded – undo
2143 2143
 	{
2144 2144
 		// path setting
2145 2145
 		$path = sprintf('./files/attach/menu_button/%d/', $args->menu_srl);
2146
-		if($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2146
+		if ($args->menu_normal_btn || $args->menu_hover_btn || $args->menu_active_btn && !is_dir($path))
2147 2147
 		{
2148 2148
 			FileHandler::makeDir($path);
2149 2149
 		}
2150 2150
 
2151
-		if($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2151
+		if ($args->isNormalDelete == 'Y' || $args->isHoverDelete == 'Y' || $args->isActiveDelete == 'Y')
2152 2152
 		{
2153 2153
 			$oMenuModel = getAdminModel('menu');
2154 2154
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2155 2155
 
2156
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2157
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2158
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2156
+			if ($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2157
+			if ($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2158
+			if ($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2159 2159
 		}
2160 2160
 
2161 2161
 		$returnArray = array();
2162 2162
 		$date = date('YmdHis');
2163 2163
 		// normal button
2164
-		if($args->menu_normal_btn)
2164
+		if ($args->menu_normal_btn)
2165 2165
 		{
2166
-			$tmp_arr = explode('.',$args->menu_normal_btn['name']);
2167
-			$ext = $tmp_arr[count($tmp_arr)-1];
2166
+			$tmp_arr = explode('.', $args->menu_normal_btn['name']);
2167
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2168 2168
 
2169 2169
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_normal_btn', $ext);
2170 2170
 
2171
-			if(checkUploadedFile($args->menu_normal_btn['tmp_name']))
2171
+			if (checkUploadedFile($args->menu_normal_btn['tmp_name']))
2172 2172
 			{
2173
-				move_uploaded_file ( $args->menu_normal_btn ['tmp_name'], $filename );
2173
+				move_uploaded_file($args->menu_normal_btn ['tmp_name'], $filename);
2174 2174
 				$returnArray ['normal_btn'] = $filename;
2175 2175
 			}
2176 2176
 		}
2177 2177
 
2178 2178
 		// hover button
2179
-		if($args->menu_hover_btn)
2179
+		if ($args->menu_hover_btn)
2180 2180
 		{
2181
-			$tmp_arr = explode('.',$args->menu_hover_btn['name']);
2182
-			$ext = $tmp_arr[count($tmp_arr)-1];
2181
+			$tmp_arr = explode('.', $args->menu_hover_btn['name']);
2182
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2183 2183
 
2184 2184
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_hover_btn', $ext);
2185 2185
 
2186
-			if(checkUploadedFile($args->menu_hover_btn['tmp_name']))
2186
+			if (checkUploadedFile($args->menu_hover_btn['tmp_name']))
2187 2187
 			{
2188 2188
 				move_uploaded_file($args->menu_hover_btn['tmp_name'], $filename);
2189 2189
 				$returnArray['hover_btn'] = $filename;
@@ -2191,14 +2191,14 @@  discard block
 block discarded – undo
2191 2191
 		}
2192 2192
 
2193 2193
 		// active button
2194
-		if($args->menu_active_btn)
2194
+		if ($args->menu_active_btn)
2195 2195
 		{
2196
-			$tmp_arr = explode('.',$args->menu_active_btn['name']);
2197
-			$ext = $tmp_arr[count($tmp_arr)-1];
2196
+			$tmp_arr = explode('.', $args->menu_active_btn['name']);
2197
+			$ext = $tmp_arr[count($tmp_arr) - 1];
2198 2198
 
2199 2199
 			$filename = sprintf('%s%d.%s.%s.%s', $path, $args->menu_item_srl, $date, 'menu_active_btn', $ext);
2200 2200
 
2201
-			if(checkUploadedFile($args->menu_active_btn['tmp_name']))
2201
+			if (checkUploadedFile($args->menu_active_btn['tmp_name']))
2202 2202
 			{
2203 2203
 				move_uploaded_file($args->menu_active_btn['tmp_name'], $filename);
2204 2204
 				$returnArray['active_btn'] = $filename;
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
 			"active_btn"=>"",
2221 2221
 		);
2222 2222
 		//normal_btn
2223
-		if($menuItemInfo->normal_btn)
2223
+		if ($menuItemInfo->normal_btn)
2224 2224
 		{
2225 2225
 			$originFile = FileHandler::getRealPath($menuItemInfo->normal_btn);
2226 2226
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->normal_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'normal');
@@ -2230,7 +2230,7 @@  discard block
 block discarded – undo
2230 2230
 		}
2231 2231
 
2232 2232
 		//hover_btn
2233
-		if($menuItemInfo->hover_btn)
2233
+		if ($menuItemInfo->hover_btn)
2234 2234
 		{
2235 2235
 			$originFile = FileHandler::getRealPath($menuItemInfo->hover_btn);
2236 2236
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->hover_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'hover');
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 		}
2241 2241
 
2242 2242
 		//active_btn
2243
-		if($menuItemInfo->active_btn)
2243
+		if ($menuItemInfo->active_btn)
2244 2244
 		{
2245 2245
 			$originFile = FileHandler::getRealPath($menuItemInfo->active_btn);
2246 2246
 			$targetFile = $this->_changeMenuItemSrlInButtonPath($menuItemInfo->active_btn, $insertedMenuSrl, $insertedMenuItemSrl, 'active');
@@ -2255,9 +2255,9 @@  discard block
 block discarded – undo
2255 2255
 	{
2256 2256
 		$path = sprintf('./files/attach/menu_button/%d/', $menuSrl);
2257 2257
 		$tmp_arr = explode('.', $buttonPath);
2258
-		$ext = $tmp_arr[count($tmp_arr)-1];
2258
+		$ext = $tmp_arr[count($tmp_arr) - 1];
2259 2259
 		$date = date("YmdHis");
2260
-		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl,$date,'menu_'.$mode.'_btn', $ext);
2260
+		return sprintf('%s%d.%s.%s.%s', $path, $menuItemSrl, $date, 'menu_'.$mode.'_btn', $ext);
2261 2261
 	}
2262 2262
 
2263 2263
 	public function makeHomemenuCacheFile($menuSrl)
Please login to merge, or discard this patch.
Braces   +300 added lines, -134 removed lines patch added patch discarded remove patch
@@ -69,7 +69,9 @@  discard block
 block discarded – undo
69 69
 		$site_module_info = Context::get('site_module_info');
70 70
 
71 71
 		$output = $this->addMenu(Context::get('title'), (int)$site_module_info->site_srl);
72
-		if(!$output->toBool()) return $output;
72
+		if(!$output->toBool()) {
73
+			return $output;
74
+		}
73 75
 
74 76
 		$this->add('menu_srl', $output->get('menuSrl'));
75 77
 		$this->setMessage('success_registed');
@@ -148,8 +150,7 @@  discard block
 block discarded – undo
148 150
 				$moduleConfig->unlinked_menu_srl = $output->get('menuSrl');
149 151
 				$oModuleController = getController('module');
150 152
 				$oModuleController->updateModuleConfig('menu', $moduleConfig);
151
-			}
152
-			else
153
+			} else
153 154
 			{
154 155
 				return false;
155 156
 			}
@@ -186,8 +187,7 @@  discard block
 block discarded – undo
186 187
 			if($output->toBool() && $output->data)
187 188
 			{
188 189
 				$moduleInfo->menu_srl = $output->data->menu_srl;
189
-			}
190
-			else
190
+			} else
191 191
 			{
192 192
 				// create menu item.
193 193
 				$item_args->menu_srl = $menuSrl;
@@ -235,7 +235,9 @@  discard block
 block discarded – undo
235 235
 		$args->menu_srl = Context::get('menu_srl');
236 236
 
237 237
 		$output = executeQuery('menu.updateMenu', $args);
238
-		if(!$output->toBool()) return $output;
238
+		if(!$output->toBool()) {
239
+			return $output;
240
+		}
239 241
 
240 242
 		$this->setMessage('success_registed');
241 243
 
@@ -255,8 +257,9 @@  discard block
 block discarded – undo
255 257
 		$menuInfo = $oMenuAdminModel->getMenu($menu_srl);
256 258
 
257 259
 		$oAdmin = getClass('admin');
258
-		if($menuInfo->title == $oAdmin->getAdminMenuName())
259
-			return new BaseObject(-1, 'msg_adminmenu_cannot_delete');
260
+		if($menuInfo->title == $oAdmin->getAdminMenuName()) {
261
+					return new BaseObject(-1, 'msg_adminmenu_cannot_delete');
262
+		}
260 263
 
261 264
 		// get menu properies with child menu
262 265
 		$phpFile = sprintf("./files/cache/menu/%s.php", $menu_srl);
@@ -280,8 +283,9 @@  discard block
 block discarded – undo
280 283
 				$originMenu = $value;
281 284
 				$this->_checkHomeMenuInOriginMenu($originMenu, $siteInfo->mid, $isStartmenuInclude);
282 285
 
283
-				if($isStartmenuInclude)
284
-					break;
286
+				if($isStartmenuInclude) {
287
+									break;
288
+				}
285 289
 			}
286 290
 		}
287 291
 
@@ -366,7 +370,9 @@  discard block
 block discarded – undo
366 370
 			foreach($cache_list as $cache_file)
367 371
 			{
368 372
 				$pos = strpos($cache_file, $menu_srl.'.');
369
-				if($pos>0)FileHandler::removeFile($cache_file);
373
+				if($pos>0) {
374
+					FileHandler::removeFile($cache_file);
375
+				}
370 376
 			}
371 377
 		}
372 378
 		// Delete images of menu buttons
@@ -405,8 +411,7 @@  discard block
 block discarded – undo
405 411
 		if($request->is_shortcut == 'Y')
406 412
 		{
407 413
 			$result = $this->_insertShortcut($request);
408
-		}
409
-		else
414
+		} else
410 415
 		{
411 416
 			$result = $this->_insertMenu($request, $isProc);
412 417
 		}
@@ -464,12 +469,21 @@  discard block
 block discarded – undo
464 469
 			$args->is_shortcut = $request->is_shortcut;
465 470
 			$args->url = $request->shortcut_target;
466 471
 
467
-			if(!$args->open_window) $args->open_window = 'N';
468
-			if(!$args->expand) $args->expand = 'N';
469
-			if(!$args->is_shortcut) $args->is_shortcut = 'Y';
472
+			if(!$args->open_window) {
473
+				$args->open_window = 'N';
474
+			}
475
+			if(!$args->expand) {
476
+				$args->expand = 'N';
477
+			}
478
+			if(!$args->is_shortcut) {
479
+				$args->is_shortcut = 'Y';
480
+			}
470 481
 
471
-			if($request->menu_name_key) $args->name = $request->menu_name_key;
472
-			else $args->name = $request->menu_name;
482
+			if($request->menu_name_key) {
483
+				$args->name = $request->menu_name_key;
484
+			} else {
485
+				$args->name = $request->menu_name;
486
+			}
473 487
 		}
474 488
 		// type is module short cut
475 489
 		else if(is_numeric($request->shortcut_target))
@@ -504,13 +518,18 @@  discard block
 block discarded – undo
504 518
 			$args->url = '#';
505 519
 		}
506 520
 
507
-		if($request->menu_desc) $args->desc = $request->menu_desc;
508
-		else $args->desc = '';
521
+		if($request->menu_desc) {
522
+			$args->desc = $request->menu_desc;
523
+		} else {
524
+			$args->desc = '';
525
+		}
509 526
 
510 527
 		$args->menu_item_srl = getNextSequence();
511 528
 		$args->listorder = -1*$args->menu_item_srl;
512 529
 		$output = executeQuery('menu.insertMenuItem', $args);
513
-		if(!$output->toBool()) return $output;
530
+		if(!$output->toBool()) {
531
+			return $output;
532
+		}
514 533
 
515 534
 		$oDB->commit();
516 535
 
@@ -532,15 +551,27 @@  discard block
 block discarded – undo
532 551
 		$args->expand = $request->menu_expand;
533 552
 		$args->is_shortcut = $request->is_shortcut;
534 553
 
535
-		if(!$args->open_window) $args->open_window = 'N';
536
-		if(!$args->expand) $args->expand = 'N';
537
-		if(!$args->is_shortcut) $args->is_shortcut = 'N';
554
+		if(!$args->open_window) {
555
+			$args->open_window = 'N';
556
+		}
557
+		if(!$args->expand) {
558
+			$args->expand = 'N';
559
+		}
560
+		if(!$args->is_shortcut) {
561
+			$args->is_shortcut = 'N';
562
+		}
538 563
 
539
-		if($request->menu_name_key) $args->name = $request->menu_name_key;
540
-		else $args->name = $request->menu_name;
564
+		if($request->menu_name_key) {
565
+			$args->name = $request->menu_name_key;
566
+		} else {
567
+			$args->name = $request->menu_name;
568
+		}
541 569
 
542
-		if($request->menu_desc) $args->desc = $request->menu_desc;
543
-		else $args->desc = '';
570
+		if($request->menu_desc) {
571
+			$args->desc = $request->menu_desc;
572
+		} else {
573
+			$args->desc = '';
574
+		}
544 575
 
545 576
 		if($request->module_id && strncasecmp('http', $request->module_id, 4) === 0)
546 577
 		{
@@ -558,9 +589,15 @@  discard block
 block discarded – undo
558 589
 		}
559 590
 
560 591
 		// if setting button variables, set argument button variables for db insert. but not upload in this method
561
-		if($request->normal_btn) $args->normal_btn = $request->normal_btn;
562
-		if($request->hover_btn) $args->hover_btn = $request->hover_btn;
563
-		if($request->active_btn) $args->active_btn = $request->active_btn;
592
+		if($request->normal_btn) {
593
+			$args->normal_btn = $request->normal_btn;
594
+		}
595
+		if($request->hover_btn) {
596
+			$args->hover_btn = $request->hover_btn;
597
+		}
598
+		if($request->active_btn) {
599
+			$args->active_btn = $request->active_btn;
600
+		}
564 601
 
565 602
 		if(!$request->module_id)
566 603
 		{
@@ -571,7 +608,9 @@  discard block
 block discarded – undo
571 608
 		$args->menu_item_srl = getNextSequence();
572 609
 		$args->listorder = -1*$args->menu_item_srl;
573 610
 		$output = executeQuery('menu.insertMenuItem', $args);
574
-		if(!$output->toBool()) return $output;
611
+		if(!$output->toBool()) {
612
+			return $output;
613
+		}
575 614
 
576 615
 		$oDB->commit();
577 616
 
@@ -652,8 +691,12 @@  discard block
 block discarded – undo
652 691
 		}
653 692
 
654 693
 		// variables set
655
-		if($request->menu_open_window != "Y") $request->menu_open_window = "N";
656
-		if($request->menu_expand != "Y") $request->menu_expand = "N";
694
+		if($request->menu_open_window != "Y") {
695
+			$request->menu_open_window = "N";
696
+		}
697
+		if($request->menu_expand != "Y") {
698
+			$request->menu_expand = "N";
699
+		}
657 700
 
658 701
 		// Get original information
659 702
 		$oMenuAdminModel = getAdminModel('menu');
@@ -680,13 +723,11 @@  discard block
 block discarded – undo
680 723
 
681 724
 				$args->url = $newItemInfo->url;
682 725
 				$args->is_shortcut = 'Y';
683
-			}
684
-			else
726
+			} else
685 727
 			{
686 728
 				$args->url = '#';
687 729
 			}
688
-		}
689
-		else
730
+		} else
690 731
 		{
691 732
 			// check already created module instance
692 733
 			$oModuleModel = getModel('module');
@@ -719,14 +760,16 @@  discard block
 block discarded – undo
719 760
 		if($request->menu_name_key)
720 761
 		{
721 762
 			$args->name = $request->menu_name_key;
722
-		}
723
-		else
763
+		} else
724 764
 		{
725 765
 			$args->name = $request->menu_name;
726 766
 		}
727 767
 
728
-		if($request->menu_desc) $args->desc = $request->menu_desc;
729
-		else $args->desc = '';
768
+		if($request->menu_desc) {
769
+			$args->desc = $request->menu_desc;
770
+		} else {
771
+			$args->desc = '';
772
+		}
730 773
 
731 774
 		unset($args->group_srls);
732 775
 		$args->open_window = $request->menu_open_window;
@@ -828,8 +871,7 @@  discard block
 block discarded – undo
828 871
 		{
829 872
 			$this->setError($returnObj->error);
830 873
 			$this->setMessage($returnObj->message);
831
-		}
832
-		else
874
+		} else
833 875
 		{
834 876
 			$this->setMessage('success_deleted');
835 877
 		}
@@ -856,7 +898,9 @@  discard block
 block discarded – undo
856 898
 		if($args->is_force != 'Y')
857 899
 		{
858 900
 			$output = executeQuery('menu.getChildMenuCount', $args);
859
-			if(!$output->toBool()) return $output;
901
+			if(!$output->toBool()) {
902
+				return $output;
903
+			}
860 904
 			if($output->data->count > 0)
861 905
 			{
862 906
 				return new BaseObject(-1001, 'msg_cannot_delete_for_child');
@@ -874,7 +918,9 @@  discard block
 block discarded – undo
874 918
 			return $this->stop('msg_cannot_delete_for_admin_topmenu');
875 919
 		}
876 920
 
877
-		if($itemInfo->parent_srl) $parent_srl = $itemInfo->parent_srl;
921
+		if($itemInfo->parent_srl) {
922
+			$parent_srl = $itemInfo->parent_srl;
923
+		}
878 924
 
879 925
 		// get menu properies with child menu
880 926
 		$phpFile = sprintf("./files/cache/menu/%s.php", $args->menu_srl);
@@ -948,9 +994,15 @@  discard block
 block discarded – undo
948 994
 		// Update the xml file and get its location
949 995
 		$xml_file = $this->makeXmlFile($args->menu_srl);
950 996
 		// Delete all of image buttons
951
-		if($node['normal_btn']) FileHandler::removeFile($node['normal_btn']);
952
-		if($node['hover_btn']) FileHandler::removeFile($node['hover_btn']);
953
-		if($node['active_btn']) FileHandler::removeFile($node['active_btn']);
997
+		if($node['normal_btn']) {
998
+			FileHandler::removeFile($node['normal_btn']);
999
+		}
1000
+		if($node['hover_btn']) {
1001
+			FileHandler::removeFile($node['hover_btn']);
1002
+		}
1003
+		if($node['active_btn']) {
1004
+			FileHandler::removeFile($node['active_btn']);
1005
+		}
954 1006
 
955 1007
 		// Delete module
956 1008
 		if($node['is_shortcut'] != 'Y' && strncasecmp('http', $node['url'], 4) !== 0)
@@ -1017,7 +1069,9 @@  discard block
 block discarded – undo
1017 1069
 		$source_srl = Context::get('source_srl');	// Same hierarchy's menu item serial number
1018 1070
 		$target_srl = Context::get('target_srl');	// Self menu item serial number
1019 1071
 
1020
-		if(!$mode || !$parent_srl || !$target_srl) return new BaseObject(-1,'msg_invalid_request');
1072
+		if(!$mode || !$parent_srl || !$target_srl) {
1073
+			return new BaseObject(-1,'msg_invalid_request');
1074
+		}
1021 1075
 
1022 1076
 		$oMenuAdminModel = getAdminModel('menu');
1023 1077
 
@@ -1181,8 +1235,11 @@  discard block
 block discarded – undo
1181 1235
 		// default argument setting
1182 1236
 		$args = new stdClass();
1183 1237
 		$args->menu_srl = $menuSrl;
1184
-		if($parentSrl == 0) $args->parent_srl = $menuSrl;
1185
-		else $args->parent_srl = $parentSrl;
1238
+		if($parentSrl == 0) {
1239
+			$args->parent_srl = $menuSrl;
1240
+		} else {
1241
+			$args->parent_srl = $parentSrl;
1242
+		}
1186 1243
 		$args->menu_name_key = $originMenu['text'];
1187 1244
 		$args->menu_name = $originMenu['text'];
1188 1245
 		$args->menu_open_window = $originMenu['open_window'];
@@ -1275,8 +1332,11 @@  discard block
 block discarded – undo
1275 1332
 		for($i=0;$i<4;$i++)
1276 1333
 		{
1277 1334
 			$case = rand(0, 1);
1278
-			if($case) $doc = rand(65, 90);
1279
-			else $doc = rand(97, 122);
1335
+			if($case) {
1336
+				$doc = rand(65, 90);
1337
+			} else {
1338
+				$doc = rand(97, 122);
1339
+			}
1280 1340
 
1281 1341
 			$randomString .= chr($doc);
1282 1342
 		}
@@ -1299,15 +1359,21 @@  discard block
 block discarded – undo
1299 1359
 		// menu name update
1300 1360
 		$args->menu_srl = $this->menuSrl;
1301 1361
 		$output = executeQuery('menu.updateMenu', $args);
1302
-		if(!$output->toBool()) return $output;
1362
+		if(!$output->toBool()) {
1363
+			return $output;
1364
+		}
1303 1365
 
1304 1366
 		$this->map = array();
1305 1367
 		if(is_array($parentKeyList))
1306 1368
 		{
1307 1369
 			foreach($parentKeyList as $no=>$srl)
1308 1370
 			{
1309
-				if($srl === 0) continue;
1310
-				if(!is_array($this->map[$srl]))$this->map[$srl] = array();
1371
+				if($srl === 0) {
1372
+					continue;
1373
+				}
1374
+				if(!is_array($this->map[$srl])) {
1375
+					$this->map[$srl] = array();
1376
+				}
1311 1377
 				$this->map[$srl][] = $no;
1312 1378
 			}
1313 1379
 		}
@@ -1409,7 +1475,9 @@  discard block
 block discarded – undo
1409 1475
 		$oMenuAdminModel = getAdminModel('menu');
1410 1476
 
1411 1477
 		$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
1412
-		if($target_item->menu_item_srl != $target_srl) return new BaseObject(-1,'msg_invalid_request');
1478
+		if($target_item->menu_item_srl != $target_srl) {
1479
+			return new BaseObject(-1,'msg_invalid_request');
1480
+		}
1413 1481
 		// Move the menu location(change the order menu appears)
1414 1482
 		if($mode == 'move')
1415 1483
 		{
@@ -1420,24 +1488,33 @@  discard block
 block discarded – undo
1420 1488
 			if($source_srl)
1421 1489
 			{
1422 1490
 				$source_item = $oMenuAdminModel->getMenuItemInfo($source_srl);
1423
-				if($source_item->menu_item_srl != $source_srl) return new BaseObject(-1,'msg_invalid_request');
1491
+				if($source_item->menu_item_srl != $source_srl) {
1492
+					return new BaseObject(-1,'msg_invalid_request');
1493
+				}
1424 1494
 				$args->listorder = $source_item->listorder-1;
1425
-			}
1426
-			else
1495
+			} else
1427 1496
 			{
1428 1497
 				$output = executeQuery('menu.getMaxListorder', $args);
1429
-				if(!$output->toBool()) return $output;
1498
+				if(!$output->toBool()) {
1499
+					return $output;
1500
+				}
1430 1501
 				$args->listorder = (int)$output->data->listorder;
1431
-				if(!$args->listorder) $args->listorder= 0;
1502
+				if(!$args->listorder) {
1503
+					$args->listorder= 0;
1504
+				}
1432 1505
 			}
1433 1506
 			$args->parent_srl = $parent_srl;
1434 1507
 			$output = executeQuery('menu.updateMenuItemListorder', $args);
1435
-			if(!$output->toBool()) return $output;
1508
+			if(!$output->toBool()) {
1509
+				return $output;
1510
+			}
1436 1511
 
1437 1512
 			$args->parent_srl = $parent_srl;
1438 1513
 			$args->menu_item_srl = $target_srl;
1439 1514
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1440
-			if(!$output->toBool()) return $output;
1515
+			if(!$output->toBool()) {
1516
+				return $output;
1517
+			}
1441 1518
 
1442 1519
 			//module's menu_srl move also
1443 1520
 			if($isShortcut == 'N' && !empty($url))
@@ -1465,14 +1542,15 @@  discard block
 block discarded – undo
1465 1542
 				}
1466 1543
 			}
1467 1544
 			// Add a child
1468
-		}
1469
-		elseif($mode == 'insert')
1545
+		} elseif($mode == 'insert')
1470 1546
 		{
1471 1547
 			$args->menu_item_srl = $target_srl;
1472 1548
 			$args->parent_srl = $parent_srl;
1473 1549
 			$args->listorder = -1*getNextSequence();
1474 1550
 			$output = executeQuery('menu.updateMenuItemNode', $args);
1475
-			if(!$output->toBool()) return $output;
1551
+			if(!$output->toBool()) {
1552
+				return $output;
1553
+			}
1476 1554
 		}
1477 1555
 
1478 1556
 		$xml_file = $this->makeXmlFile($menu_srl);
@@ -1516,8 +1594,7 @@  discard block
 block discarded – undo
1516 1594
 		{
1517 1595
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1518 1596
 
1519
-		}
1520
-		else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1597
+		} else if(!$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)$/i',$target_file['name'])  || !checkUploadedFile($target_file['tmp_name']))
1521 1598
 		{
1522 1599
 			Context::set('error_messge', Context::getLang('msg_invalid_request'));
1523 1600
 		}
@@ -1531,7 +1608,9 @@  discard block
 block discarded – undo
1531 1608
 			$path = sprintf('./files/attach/menu_button/%d/', $menu_srl);
1532 1609
 			$filename = sprintf('%s%d.%s.%s', $path, $menu_item_srl, $target, $ext);
1533 1610
 
1534
-			if(!is_dir($path)) FileHandler::makeDir($path);
1611
+			if(!is_dir($path)) {
1612
+				FileHandler::makeDir($path);
1613
+			}
1535 1614
 
1536 1615
 			move_uploaded_file($target_file['tmp_name'], $filename);
1537 1616
 			Context::set('filename', $filename);
@@ -1571,7 +1650,9 @@  discard block
 block discarded – undo
1571 1650
 			foreach($installed_module_list AS $key=>$value)
1572 1651
 			{
1573 1652
 				$info = $oModuleModel->getModuleActionXml($value->module);
1574
-				if($info->menu) $menuList[$value->module] = $info->menu;
1653
+				if($info->menu) {
1654
+					$menuList[$value->module] = $info->menu;
1655
+				}
1575 1656
 				unset($info->menu);
1576 1657
 			}
1577 1658
 		}
@@ -1603,8 +1684,12 @@  discard block
 block discarded – undo
1603 1684
 		$info = $oModuleModel->getModuleActionXml($moduleName);
1604 1685
 
1605 1686
 		$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->menu->{$menuName}->index);
1606
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1607
-		if(empty($url)) $url = getNotEncodedFullUrl('', 'module', 'admin');
1687
+		if(empty($url)) {
1688
+			$url = getNotEncodedFullUrl('', 'module', 'admin', 'act', $info->admin_index_act);
1689
+		}
1690
+		if(empty($url)) {
1691
+			$url = getNotEncodedFullUrl('', 'module', 'admin');
1692
+		}
1608 1693
 		$dbInfo = Context::getDBInfo();
1609 1694
 
1610 1695
 		$args = new stdClass();
@@ -1616,8 +1701,7 @@  discard block
 block discarded – undo
1616 1701
 		if(strpos($url, 'https') !== false)
1617 1702
 		{
1618 1703
 			$args->url = str_replace('https'.substr($dbInfo->default_url, 4), '', $url);
1619
-		}
1620
-		else
1704
+		} else
1621 1705
 		{
1622 1706
 			$args->url = str_replace($dbInfo->default_url, '', $url);
1623 1707
 		}
@@ -1636,14 +1720,18 @@  discard block
 block discarded – undo
1636 1720
 		if($item_info->menu_item_srl == $args->menu_item_srl)
1637 1721
 		{
1638 1722
 			$output = $this->_updateMenuItem($args);
1639
-			if(!$output->toBool()) return $output;
1723
+			if(!$output->toBool()) {
1724
+				return $output;
1725
+			}
1640 1726
 		}
1641 1727
 		// Insert if not exist
1642 1728
 		else
1643 1729
 		{
1644 1730
 			$args->listorder = -1*$args->menu_item_srl;
1645 1731
 			$output = executeQuery('menu.insertMenuItem', $args);
1646
-			if(!$output->toBool()) return $output;
1732
+			if(!$output->toBool()) {
1733
+				return $output;
1734
+			}
1647 1735
 		}
1648 1736
 		// Get information of the menu
1649 1737
 		$menu_info = $oMenuModel->getMenu($args->menu_srl);
@@ -1674,8 +1762,7 @@  discard block
 block discarded – undo
1674 1762
 		if(!$exposure)
1675 1763
 		{
1676 1764
 			$args->group_srls = '';
1677
-		}
1678
-		else
1765
+		} else
1679 1766
 		{
1680 1767
 			$exposure = explode(',', $exposure);
1681 1768
 			if(in_array($exposure, array('-1','-3')))
@@ -1683,7 +1770,9 @@  discard block
 block discarded – undo
1683 1770
 				$args->group_srls = $exposure;
1684 1771
 			}
1685 1772
 
1686
-			if($exposure) $args->group_srls = implode(',', $exposure);
1773
+			if($exposure) {
1774
+				$args->group_srls = implode(',', $exposure);
1775
+			}
1687 1776
 		}
1688 1777
 
1689 1778
 		$output = $this->_updateMenuItem($args);
@@ -1706,7 +1795,9 @@  discard block
 block discarded – undo
1706 1795
 			$moduleGrnatsArgs = new stdClass;
1707 1796
 			$moduleGrnatsArgs->module_srl = $moduleInfo->module_srl;
1708 1797
 			$output = executeQueryArray('module.getModuleGrants', $moduleGrnatsArgs);
1709
-			if(!$output->data) $output->data = array();
1798
+			if(!$output->data) {
1799
+				$output->data = array();
1800
+			}
1710 1801
 			$moduleGrnats = new stdClass();
1711 1802
 			foreach($output->data as $grant)
1712 1803
 			{
@@ -1715,7 +1806,9 @@  discard block
 block discarded – undo
1715 1806
 		}
1716 1807
 
1717 1808
 		$grantList = $xml_info->grant;
1718
-		if(!$grantList) $grantList = new stdClass;
1809
+		if(!$grantList) {
1810
+			$grantList = new stdClass;
1811
+		}
1719 1812
 
1720 1813
 		$grantList->access = new stdClass();
1721 1814
 		$grantList->access->default = 'guest';
@@ -1741,10 +1834,11 @@  discard block
 block discarded – undo
1741 1834
 					$grant->{$grantName}[] = $htPerm[$grantName];
1742 1835
 					continue;
1743 1836
 				}
1744
-			}
1745
-			else if($itemInfo->is_shortcut === 'Y')
1837
+			} else if($itemInfo->is_shortcut === 'Y')
1746 1838
 			{
1747
-				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) $grant->{$grantName} = $moduleGrnats->{$grantName};
1839
+				if(isset($moduleGrnats) && $moduleGrnats->{$grantName}) {
1840
+					$grant->{$grantName} = $moduleGrnats->{$grantName};
1841
+				}
1748 1842
 			}
1749 1843
 		}
1750 1844
 
@@ -1766,12 +1860,16 @@  discard block
 block discarded – undo
1766 1860
 	function makeXmlFile($menu_srl)
1767 1861
 	{
1768 1862
 		// Return if there is no information when creating the xml file
1769
-		if(!$menu_srl) return;
1863
+		if(!$menu_srl) {
1864
+			return;
1865
+		}
1770 1866
 		// Get menu informaton
1771 1867
 		$args = new stdClass();
1772 1868
 		$args->menu_srl = $menu_srl;
1773 1869
 		$output = executeQuery('menu.getMenu', $args);
1774
-		if(!$output->toBool() || !$output->data) return $output;
1870
+		if(!$output->toBool() || !$output->data) {
1871
+			return $output;
1872
+		}
1775 1873
 		$site_srl = (int)$output->data->site_srl;
1776 1874
 
1777 1875
 		if($site_srl)
@@ -1785,7 +1883,9 @@  discard block
 block discarded – undo
1785 1883
 		$args->menu_srl = $menu_srl;
1786 1884
 		$args->sort_index = 'listorder';
1787 1885
 		$output = executeQuery('menu.getMenuItems', $args);
1788
-		if(!$output->toBool()) return;
1886
+		if(!$output->toBool()) {
1887
+			return;
1888
+		}
1789 1889
 		// Specify the name of the cache file
1790 1890
 		$xml_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.xml.php", $menu_srl);
1791 1891
 		$php_file = sprintf(_XE_PATH_ . "files/cache/menu/%s.php", $menu_srl);
@@ -1799,7 +1899,9 @@  discard block
 block discarded – undo
1799 1899
 			return $xml_file;
1800 1900
 		}
1801 1901
 		// Change to an array if only a single data is obtained
1802
-		if(!is_array($list)) $list = array($list);
1902
+		if(!is_array($list)) {
1903
+			$list = array($list);
1904
+		}
1803 1905
 		// Create a tree for loop
1804 1906
 		$list_count = count($list);
1805 1907
 		for($i=0;$i<$list_count;$i++)
@@ -1887,7 +1989,9 @@  discard block
 block discarded – undo
1887 1989
 	 */
1888 1990
 	function getXmlTree($source_node, $tree, $site_srl, $domain)
1889 1991
 	{
1890
-		if(!$source_node) return;
1992
+		if(!$source_node) {
1993
+			return;
1994
+		}
1891 1995
 
1892 1996
 		$oMenuAdminModel = getAdminModel('menu');
1893 1997
 
@@ -1895,7 +1999,9 @@  discard block
 block discarded – undo
1895 1999
 		{
1896 2000
 			$child_buff = "";
1897 2001
 			// Get data of the child nodes
1898
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
2002
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2003
+				$child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
2004
+			}
1899 2005
 			// List variables
1900 2006
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
1901 2007
 			foreach($names as $key => $val)
@@ -1909,31 +2015,48 @@  discard block
 block discarded – undo
1909 2015
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url))
1910 2016
 			{
1911 2017
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2018
+			} else {
2019
+				$href = var_export($url, true);
1912 2020
 			}
1913
-			else $href = var_export($url, true);
1914 2021
 			$is_shortcut = ($node->is_shortcut) ? $node->is_shortcut : '';
1915 2022
 			$open_window = ($node->open_window) ? $node->open_window : '';
1916 2023
 			$expand = ($node->expand) ? $node->expand : '';
1917 2024
 
1918 2025
 			$normal_btn = ($node->normal_btn) ? $node->normal_btn : '';
1919
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
1920
-			else $normal_btn = '';
2026
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2027
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2028
+			} else {
2029
+				$normal_btn = '';
2030
+			}
1921 2031
 			$hover_btn = ($node->hover_btn) ? $node->hover_btn : '';
1922
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
1923
-			else $hover_btn = '';
2032
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2033
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2034
+			} else {
2035
+				$hover_btn = '';
2036
+			}
1924 2037
 			$active_btn = ($node->active_btn) ? $node->active_btn : '';
1925
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
1926
-			else $active_btn = '';
2038
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2039
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2040
+			} else {
2041
+				$active_btn = '';
2042
+			}
1927 2043
 
1928 2044
 			$group_srls = ($node->group_srls) ? $node->group_srls : '';
1929 2045
 
1930 2046
 			if($normal_btn)
1931 2047
 			{
1932
-				if($hover_btn) $hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn); else $hover_str = '';
1933
-				if($active_btn) $active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn); else $active_str = '';
2048
+				if($hover_btn) {
2049
+					$hover_str = sprintf('onmouseover=&quot;this.src=\'%s\'&quot;', $hover_btn);
2050
+				} else {
2051
+					$hover_str = '';
2052
+				}
2053
+				if($active_btn) {
2054
+					$active_str = sprintf('onmousedown=&quot;this.src=\'%s\'&quot;', $active_btn);
2055
+				} else {
2056
+					$active_str = '';
2057
+				}
1934 2058
 				$link = sprintf('&lt;img src=&quot;%s&quot; onmouseout=&quot;this.src=\'%s\'&quot; alt=&quot;<?php print htmlspecialchars($_names[$lang_type], ENT_COMPAT | ENT_HTML401, \'UTF-8\', false) ?>&quot; %s %s /&gt;', $normal_btn, $normal_btn, $hover_str, $active_str);
1935
-			}
1936
-			else
2059
+			} else
1937 2060
 			{
1938 2061
 				$link = '<?php print $_names[$lang_type]; ?>';
1939 2062
 			}
@@ -1941,8 +2064,7 @@  discard block
 block discarded – undo
1941 2064
 			// If the value of node->group_srls exists
1942 2065
 			if($group_srls) {
1943 2066
 				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged&&%s))',$group_srls,$group_srls == -1?1:0);
1944
-			}
1945
-			else
2067
+			} else
1946 2068
 			{
1947 2069
 				$group_check_code = "true";
1948 2070
 			}
@@ -1969,8 +2091,11 @@  discard block
 block discarded – undo
1969 2091
 				$link
1970 2092
 			);
1971 2093
 
1972
-			if($child_buff) $buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
1973
-			else $buff .=  sprintf('<node %s />', $attribute);
2094
+			if($child_buff) {
2095
+				$buff .= sprintf('<node %s>%s</node>', $attribute, $child_buff);
2096
+			} else {
2097
+				$buff .=  sprintf('<node %s />', $attribute);
2098
+			}
1974 2099
 		}
1975 2100
 		return $buff;
1976 2101
 	}
@@ -1989,15 +2114,20 @@  discard block
 block discarded – undo
1989 2114
 	function getPhpCacheCode($source_node, $tree, $site_srl, $domain)
1990 2115
 	{
1991 2116
 		$output = array("buff"=>"", "url_list"=>array());
1992
-		if(!$source_node) return $output;
2117
+		if(!$source_node) {
2118
+			return $output;
2119
+		}
1993 2120
 
1994 2121
 		$oMenuAdminModel = getAdminModel('menu');
1995 2122
 
1996 2123
 		foreach($source_node as $menu_item_srl => $node)
1997 2124
 		{
1998 2125
 			// Get data from child nodes if exist.
1999
-			if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2000
-			else $child_output = array("buff"=>"", "url_list"=>array());
2126
+			if($menu_item_srl&&$tree[$menu_item_srl]) {
2127
+				$child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
2128
+			} else {
2129
+				$child_output = array("buff"=>"", "url_list"=>array());
2130
+			}
2001 2131
 
2002 2132
 			// List variables
2003 2133
 			$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
@@ -2007,8 +2137,7 @@  discard block
 block discarded – undo
2007 2137
 				if(preg_match('/\{\$lang->menu_gnb(?:_sub)?\[\'([a-zA-Z_]?[a-zA-Z_0-9]*)\'\]\}/', $val) === 1)
2008 2138
 				{
2009 2139
 					$name_arr_str .= sprintf('"%s"=>"%s",', $key, $val);
2010
-				}
2011
-				else
2140
+				} else
2012 2141
 				{
2013 2142
 					$name_arr_str .= sprintf('"%s"=>\'%s\',', $key, str_replace(array('\\','\''), array('\\\\','\\\''), removeHackTag($val)));
2014 2143
 				}
@@ -2016,11 +2145,16 @@  discard block
 block discarded – undo
2016 2145
 			$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
2017 2146
 
2018 2147
 			// If url value is not empty in the current node, put the value into an array url_list
2019
-			if($node->url) $child_output['url_list'][] = $node->url;
2148
+			if($node->url) {
2149
+				$child_output['url_list'][] = $node->url;
2150
+			}
2020 2151
 			$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
2021 2152
 			// If node->group_srls value exists
2022
-			if($node->group_srls)$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2023
-			else $group_check_code = "true";
2153
+			if($node->group_srls) {
2154
+				$group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s))))||($is_logged && %s))',$node->group_srls,$node->group_srls == -1?1:0);
2155
+			} else {
2156
+				$group_check_code = "true";
2157
+			}
2024 2158
 
2025 2159
 			// List variables
2026 2160
 			$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
@@ -2029,8 +2163,9 @@  discard block
 block discarded – undo
2029 2163
 			if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url))
2030 2164
 			{
2031 2165
 				$href = "getSiteUrl('$domain', '','mid','$node->url')";
2166
+			} else {
2167
+				$href = var_export($url, true);
2032 2168
 			}
2033
-			else $href = var_export($url, true);
2034 2169
 			$is_shortcut = $node->is_shortcut;
2035 2170
 			$open_window = $node->open_window;
2036 2171
 			$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);
@@ -2047,29 +2182,48 @@  discard block
 block discarded – undo
2047 2182
 			$expand = $node->expand;
2048 2183
 
2049 2184
 			$normal_btn = $node->normal_btn;
2050
-			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) $normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2051
-			else $normal_btn = '';
2185
+			if($normal_btn && strncasecmp('./files/attach/menu_button', $normal_btn, 26) === 0) {
2186
+				$normal_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$normal_btn);
2187
+			} else {
2188
+				$normal_btn = '';
2189
+			}
2052 2190
 
2053 2191
 			$hover_btn = $node->hover_btn;
2054
-			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) $hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2055
-			else $hover_btn = '';
2192
+			if($hover_btn && strncasecmp('./files/attach/menu_button', $hover_btn, 26) === 0) {
2193
+				$hover_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$hover_btn);
2194
+			} else {
2195
+				$hover_btn = '';
2196
+			}
2056 2197
 
2057 2198
 			$active_btn = $node->active_btn;
2058
-			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) $active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2059
-			else $active_btn = '';
2199
+			if($active_btn && strncasecmp('./files/attach/menu_button', $active_btn, 26) === 0) {
2200
+				$active_btn = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$active_btn);
2201
+			} else {
2202
+				$active_btn = '';
2203
+			}
2060 2204
 
2061 2205
 
2062 2206
 			$group_srls = $node->group_srls;
2063 2207
 
2064 2208
 			if($normal_btn)
2065 2209
 			{
2066
-				if($hover_btn) $hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn); else $hover_str = '';
2067
-				if($active_btn) $active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn); else $active_str = '';
2210
+				if($hover_btn) {
2211
+					$hover_str = sprintf('onmouseover=\"this.src=\'%s\'\"', $hover_btn);
2212
+				} else {
2213
+					$hover_str = '';
2214
+				}
2215
+				if($active_btn) {
2216
+					$active_str = sprintf('onmousedown=\"this.src=\'%s\'\"', $active_btn);
2217
+				} else {
2218
+					$active_str = '';
2219
+				}
2068 2220
 				$link = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s %s />"', $normal_btn, $normal_btn, $node->menu_item_srl, $hover_str, $active_str);
2069
-				if($active_btn) $link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2070
-				else $link_active = $link;
2071
-			}
2072
-			else
2221
+				if($active_btn) {
2222
+					$link_active = sprintf('"<img src=\"%s\" onmouseout=\"this.src=\'%s\'\" alt=\"".$_menu_names[%d][$lang_type]."\" %s />"', $active_btn, $active_btn, $node->menu_item_srl, $hover_str);
2223
+				} else {
2224
+					$link_active = $link;
2225
+				}
2226
+			} else
2073 2227
 			{
2074 2228
 				$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
2075 2229
 			}
@@ -2118,11 +2272,15 @@  discard block
 block discarded – undo
2118 2272
 	 */
2119 2273
 	function updateMenuLayout($layout_srl, $menu_srl_list)
2120 2274
 	{
2121
-		if(!count($menu_srl_list)) return;
2275
+		if(!count($menu_srl_list)) {
2276
+			return;
2277
+		}
2122 2278
 		// Delete the value of menu_srls
2123 2279
 		$args->menu_srls = implode(',',$menu_srl_list);
2124 2280
 		$output = executeQuery('menu.deleteMenuLayout', $args);
2125
-		if(!$output->toBool()) return $output;
2281
+		if(!$output->toBool()) {
2282
+			return $output;
2283
+		}
2126 2284
 
2127 2285
 		$args->layout_srl = $layout_srl;
2128 2286
 		// Mapping menu_srls, layout_srl
@@ -2130,7 +2288,9 @@  discard block
 block discarded – undo
2130 2288
 		{
2131 2289
 			$args->menu_srl = $menu_srl_list[$i];
2132 2290
 			$output = executeQuery('menu.insertMenuLayout', $args);
2133
-			if(!$output->toBool()) return $output;
2291
+			if(!$output->toBool()) {
2292
+				return $output;
2293
+			}
2134 2294
 		}
2135 2295
 	}
2136 2296
 
@@ -2153,9 +2313,15 @@  discard block
 block discarded – undo
2153 2313
 			$oMenuModel = getAdminModel('menu');
2154 2314
 			$itemInfo = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
2155 2315
 
2156
-			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) FileHandler::removeFile($itemInfo->normal_btn);
2157
-			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) FileHandler::removeFile($itemInfo->hover_btn);
2158
-			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) FileHandler::removeFile($itemInfo->active_btn);
2316
+			if($args->isNormalDelete == 'Y' && $itemInfo->normal_btn) {
2317
+				FileHandler::removeFile($itemInfo->normal_btn);
2318
+			}
2319
+			if($args->isHoverDelete == 'Y' && $itemInfo->hover_btn) {
2320
+				FileHandler::removeFile($itemInfo->hover_btn);
2321
+			}
2322
+			if($args->isActiveDelete == 'Y' && $itemInfo->active_btn) {
2323
+				FileHandler::removeFile($itemInfo->active_btn);
2324
+			}
2159 2325
 		}
2160 2326
 
2161 2327
 		$returnArray = array();
Please login to merge, or discard this patch.
modules/rss/rss.admin.controller.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
110 110
 	/**
111 111
 	 * RSS Module configurations
112 112
 	 *
113
-	 * @return void
113
+	 * @return BaseObject|null
114 114
 	 */
115 115
 	function procRssAdminInsertModuleConfig()
116 116
 	{
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,41 +27,41 @@  discard block
 block discarded – undo
27 27
 		$total_config = $oModuleModel->getModuleConfig('rss');
28 28
 
29 29
 		$config_vars = Context::getRequestVars();
30
-		$config_vars->feed_document_count = (int)$config_vars->feed_document_count;
30
+		$config_vars->feed_document_count = (int) $config_vars->feed_document_count;
31 31
 
32
-		if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
-		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y';
32
+		if (!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
+		if (!in_array($config_vars->use_total_feed, array('Y', 'N'))) $config_vars->open_rss = 'Y';
34 34
 
35
-		if($config_vars->image || $config_vars->del_image)
35
+		if ($config_vars->image || $config_vars->del_image)
36 36
 		{
37 37
 			$image_obj = $config_vars->image;
38 38
 			$config_vars->image = $total_config->image;
39 39
 			// Get a variable for the delete request
40
-			if($config_vars->del_image == 'Y' || $image_obj)
40
+			if ($config_vars->del_image == 'Y' || $image_obj)
41 41
 			{
42 42
 				FileHandler::removeFile($config_vars->image);
43 43
 				$config_vars->image = '';
44 44
 				$total_config->image = '';
45 45
 			}
46 46
 			// Ignore if the file is not the one which has been successfully uploaded
47
-			if($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))
47
+			if ($image_obj['tmp_name'] && is_uploaded_file($image_obj['tmp_name']) && checkUploadedFile($image_obj['tmp_name']))
48 48
 			{
49 49
 				// Ignore if the file is not an image
50 50
 				$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
51 51
 
52
-				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
52
+				if (!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
53 53
 				else
54 54
 				{
55 55
 					// Upload the file to a path
56 56
 					$path = './files/attach/images/rss/';
57 57
 					// Create a directory
58
-					if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
58
+					if (!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
59 59
 					else
60 60
 					{
61 61
 						$filename = $path.$image_obj['name'];
62 62
 
63 63
 						// Move the file
64
-						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
64
+						if (!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
65 65
 						else
66 66
 						{
67 67
 							$config_vars->image = $filename;
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 				}
71 71
 			}
72 72
 		}
73
-		if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
73
+		if (!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
74 74
 
75 75
 		$output = $this->setFeedConfig($config_vars);
76 76
 
77
-		if(!$alt_message) $alt_message = 'success_updated';
77
+		if (!$alt_message) $alt_message = 'success_updated';
78 78
 
79 79
 		$alt_message = Context::getLang($alt_message);
80 80
 		$this->setMessage($alt_message, 'info');
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		$originConfig = $oModuleModel->getModuleConfig('rss');
97 97
 
98 98
 		// Get a variable for the delete request
99
-		if($delImage == 'Y')
99
+		if ($delImage == 'Y')
100 100
 		{
101 101
 			FileHandler::removeFile($originConfig->image);
102 102
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$feedCopyrightList = $config_vars->feed_copyright;
123 123
 		$targetModuleSrl = $config_vars->target_module_srl;
124 124
 
125
-		if($targetModuleSrl && !is_array($openRssList))
125
+		if ($targetModuleSrl && !is_array($openRssList))
126 126
 		{
127 127
 			$openRssList = array($targetModuleSrl => $openRssList);
128 128
 			$openTotalFeedList = array($targetModuleSrl => $openTotalFeedList);
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
 			$feedCopyrightList = array($targetModuleSrl => $feedCopyrightList);
131 131
 		}
132 132
 
133
-		if(is_array($openRssList))
133
+		if (is_array($openRssList))
134 134
 		{
135
-			foreach($openRssList AS $module_srl=>$open_rss)
135
+			foreach ($openRssList AS $module_srl=>$open_rss)
136 136
 			{
137
-				if(!$module_srl || !$open_rss)
137
+				if (!$module_srl || !$open_rss)
138 138
 				{
139 139
 					return new BaseObject(-1, 'msg_invalid_request');
140 140
 				}
141 141
 
142
-				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
142
+				if (!in_array($open_rss, array('Y', 'H', 'N'))) $open_rss = 'N';
143 143
 
144 144
 				$this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);
145 145
 			}
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	function setFeedConfig($config)
162 162
 	{
163 163
 		$oModuleController = getController('module');
164
-		$oModuleController->insertModuleConfig('rss',$config);
164
+		$oModuleController->insertModuleConfig('rss', $config);
165 165
 		return new BaseObject();
166 166
 	}
167 167
 
@@ -181,9 +181,9 @@  discard block
 block discarded – undo
181 181
 		$config = new stdClass;
182 182
 		$config->open_rss = $open_rss;
183 183
 		$config->open_total_feed = $open_total_feed;
184
-		if($feed_description != 'N') { $config->feed_description = $feed_description; }
185
-		if($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
186
-		$oModuleController->insertModulePartConfig('rss',$module_srl,$config);
184
+		if ($feed_description != 'N') { $config->feed_description = $feed_description; }
185
+		if ($feed_copyright != 'N') { $config->feed_copyright = $feed_copyright; }
186
+		$oModuleController->insertModulePartConfig('rss', $module_srl, $config);
187 187
 		return new BaseObject();
188 188
 	}
189 189
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,8 +29,12 @@  discard block
 block discarded – undo
29 29
 		$config_vars = Context::getRequestVars();
30 30
 		$config_vars->feed_document_count = (int)$config_vars->feed_document_count;
31 31
 
32
-		if(!$config_vars->use_total_feed) $alt_message = 'msg_invalid_request';
33
-		if(!in_array($config_vars->use_total_feed, array('Y','N'))) $config_vars->open_rss = 'Y';
32
+		if(!$config_vars->use_total_feed) {
33
+			$alt_message = 'msg_invalid_request';
34
+		}
35
+		if(!in_array($config_vars->use_total_feed, array('Y','N'))) {
36
+			$config_vars->open_rss = 'Y';
37
+		}
34 38
 
35 39
 		if($config_vars->image || $config_vars->del_image)
36 40
 		{
@@ -49,20 +53,23 @@  discard block
 block discarded – undo
49 53
 				// Ignore if the file is not an image
50 54
 				$image_obj['name'] = Context::convertEncodingStr($image_obj['name']);
51 55
 
52
-				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) $alt_message = 'msg_rss_invalid_image_format';
53
-				else
56
+				if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
57
+					$alt_message = 'msg_rss_invalid_image_format';
58
+				} else
54 59
 				{
55 60
 					// Upload the file to a path
56 61
 					$path = './files/attach/images/rss/';
57 62
 					// Create a directory
58
-					if(!FileHandler::makeDir($path)) $alt_message = 'msg_error_occured';
59
-					else
63
+					if(!FileHandler::makeDir($path)) {
64
+						$alt_message = 'msg_error_occured';
65
+					} else
60 66
 					{
61 67
 						$filename = $path.$image_obj['name'];
62 68
 
63 69
 						// Move the file
64
-						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) $alt_message = 'msg_error_occured';
65
-						else
70
+						if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
71
+							$alt_message = 'msg_error_occured';
72
+						} else
66 73
 						{
67 74
 							$config_vars->image = $filename;
68 75
 						}
@@ -70,11 +77,15 @@  discard block
 block discarded – undo
70 77
 				}
71 78
 			}
72 79
 		}
73
-		if(!$config_vars->image && $config_vars->del_image != 'Y') $config_vars->image = $total_config->image;
80
+		if(!$config_vars->image && $config_vars->del_image != 'Y') {
81
+			$config_vars->image = $total_config->image;
82
+		}
74 83
 
75 84
 		$output = $this->setFeedConfig($config_vars);
76 85
 
77
-		if(!$alt_message) $alt_message = 'success_updated';
86
+		if(!$alt_message) {
87
+			$alt_message = 'success_updated';
88
+		}
78 89
 
79 90
 		$alt_message = Context::getLang($alt_message);
80 91
 		$this->setMessage($alt_message, 'info');
@@ -139,7 +150,9 @@  discard block
 block discarded – undo
139 150
 					return new BaseObject(-1, 'msg_invalid_request');
140 151
 				}
141 152
 
142
-				if(!in_array($open_rss, array('Y','H','N'))) $open_rss = 'N';
153
+				if(!in_array($open_rss, array('Y','H','N'))) {
154
+					$open_rss = 'N';
155
+				}
143 156
 
144 157
 				$this->setRssModuleConfig($module_srl, $open_rss, $openTotalFeedList[$module_srl], $feedDescriptionList[$module_srl], $feedCopyrightList[$module_srl]);
145 158
 			}
Please login to merge, or discard this patch.
modules/widget/widget.controller.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -697,6 +697,9 @@  discard block
 block discarded – undo
697 697
 		return $GLOBALS['_xe_loaded_widgets_'][$widget];
698 698
 	}
699 699
 
700
+	/**
701
+	 * @param boolean $javascript_mode
702
+	 */
700 703
 	function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
701 704
 	{
702 705
 		if(!$widgetStyle) return $widget_content_body;
@@ -737,6 +740,7 @@  discard block
 block discarded – undo
737 740
 
738 741
 	/**
739 742
 	 * @brief request parameters and variables sort through the information widget
743
+	 * @param BaseObject $request_vars
740 744
 	 */
741 745
 	function arrangeWidgetVars($widget, $request_vars, &$vars)
742 746
 	{
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
36 36
 
37
-		for($i=0;$i<count($skin_info->colorset);$i++)
37
+		for ($i = 0; $i < count($skin_info->colorset); $i++)
38 38
 		{
39 39
 			$colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title);
40 40
 			$colorset_list[] = $colorset;
41 41
 		}
42 42
 
43
-		if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
43
+		if (count($colorset_list)) $colorsets = implode("\n", $colorset_list);
44 44
 		$this->add('colorset_list', $colorsets);
45 45
 	}
46 46
 
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	function procWidgetGenerateCode()
51 51
 	{
52 52
 		$widget = Context::get('selected_widget');
53
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
54
-		if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
53
+		if (!$widget) return new BaseObject(-1, 'msg_invalid_request');
54
+		if (!Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null'));
55 55
 
56 56
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
57 57
 
58
-		$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ',$attribute));
58
+		$widget_code = sprintf('<img class="zbxe_widget_output" widget="%s" %s />', $widget, implode(' ', $attribute));
59 59
 		// Code output
60 60
 		$this->add('widget_code', $widget_code);
61 61
 	}
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	function procWidgetGenerateCodeInPage()
67 67
 	{
68 68
 		$widget = Context::get('selected_widget');
69
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
69
+		if (!$widget) return new BaseObject(-1, 'msg_invalid_request');
70 70
 
71
-		if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
71
+		if (!in_array($widget, array('widgetBox', 'widgetContent')) && !Context::get('skin')) return new BaseObject(-1, Context::getLang('msg_widget_skin_is_null'));
72 72
 
73 73
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
74 74
 		// Wanted results
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
 		$err = 0;
108 108
 		$oLayoutModel = getModel('layout');
109 109
 		$layout_info = $oLayoutModel->getLayout($module_srl);
110
-		if(!$layout_info || $layout_info->type != 'faceoff') $err++;
110
+		if (!$layout_info || $layout_info->type != 'faceoff') $err++;
111 111
 
112 112
 		// Destination Information Wanted page module
113 113
 		$oModuleModel = getModel('module');
114 114
 		$columnList = array('module_srl', 'module');
115 115
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
116
-		if(!$page_info->module_srl || $page_info->module != 'page') $err++;
116
+		if (!$page_info->module_srl || $page_info->module != 'page') $err++;
117 117
 
118
-		if($err > 1) return new BaseObject(-1,'msg_invalid_request');
118
+		if ($err > 1) return new BaseObject(-1, 'msg_invalid_request');
119 119
 
120 120
 		// Check permissions
121 121
 		$logged_info = Context::get('logged_info');
122
-		if(!$logged_info->member_srl)
122
+		if (!$logged_info->member_srl)
123 123
 		{
124
-			return new BaseObject(-1,'msg_not_permitted');
124
+			return new BaseObject(-1, 'msg_not_permitted');
125 125
 		}
126 126
 		$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
127
-		if(!$module_grant->manager)
127
+		if (!$module_grant->manager)
128 128
 		{
129
-			return new BaseObject(-1,'msg_not_permitted');
129
+			return new BaseObject(-1, 'msg_not_permitted');
130 130
 		}
131 131
 
132 132
 		// Enter post
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 		$obj->document_srl = $document_srl;
140 140
 
141 141
 		$oDocument = $oDocumentModel->getDocument($obj->document_srl);
142
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
142
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
143 143
 		{
144 144
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
145 145
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 		}
151 151
 
152 152
 		// Stop when an error occurs
153
-		if(!$output->toBool()) return $output;
153
+		if (!$output->toBool()) return $output;
154 154
 
155 155
 		// Return results
156 156
 		$this->add('document_srl', $obj->document_srl);
@@ -169,29 +169,29 @@  discard block
 block discarded – undo
169 169
 		$oDocumentAdminController = getAdminController('document');
170 170
 
171 171
 		$oDocument = $oDocumentModel->getDocument($document_srl);
172
-		if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
172
+		if (!$oDocument->isExists()) return new BaseObject(-1, 'msg_invalid_request');
173 173
 		$module_srl = $oDocument->get('module_srl');
174 174
 
175 175
 		// Destination Information Wanted page module
176 176
 		$oModuleModel = getModel('module');
177 177
 		$columnList = array('module_srl', 'module');
178 178
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
179
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
179
+		if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request');
180 180
 
181 181
 		// Check permissions
182 182
 		$logged_info = Context::get('logged_info');
183
-		if(!$logged_info->member_srl)
183
+		if (!$logged_info->member_srl)
184 184
 		{
185
-			return new BaseObject(-1,'msg_not_permitted');
185
+			return new BaseObject(-1, 'msg_not_permitted');
186 186
 		}
187 187
 		$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
188
-		if(!$module_grant->manager)
188
+		if (!$module_grant->manager)
189 189
 		{
190
-			return new BaseObject(-1,'msg_not_permitted');
190
+			return new BaseObject(-1, 'msg_not_permitted');
191 191
 		}
192 192
 
193
-		$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
194
-		if(!$output->toBool()) return $output;
193
+		$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'), 0);
194
+		if (!$output->toBool()) return $output;
195 195
 
196 196
 		// Return results
197 197
 		$copied_srls = $output->get('copied_srls');
@@ -210,28 +210,28 @@  discard block
 block discarded – undo
210 210
 		$oDocumentController = getController('document');
211 211
 
212 212
 		$oDocument = $oDocumentModel->getDocument($document_srl);
213
-		if(!$oDocument->isExists()) return new BaseObject();
213
+		if (!$oDocument->isExists()) return new BaseObject();
214 214
 		$module_srl = $oDocument->get('module_srl');
215 215
 
216 216
 		// Destination Information Wanted page module
217 217
 		$oModuleModel = getModel('module');
218 218
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
219
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
219
+		if (!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1, 'msg_invalid_request');
220 220
 
221 221
 		// Check permissions
222 222
 		$logged_info = Context::get('logged_info');
223
-		if(!$logged_info->member_srl)
223
+		if (!$logged_info->member_srl)
224 224
 		{
225 225
 			return new BaseObject(-1, 'msg_not_permitted');
226 226
 		}
227 227
 		$module_grant = $oModuleModel->getGrant($page_info, $logged_info);
228
-		if(!$module_grant->manager)
228
+		if (!$module_grant->manager)
229 229
 		{
230 230
 			return new BaseObject(-1, 'msg_not_permitted');
231 231
 		}
232 232
 
233 233
 		$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
234
-		if(!$output->toBool()) return $output;
234
+		if (!$output->toBool()) return $output;
235 235
 	}
236 236
 
237 237
 	/**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	function triggerWidgetCompile(&$content)
250 250
 	{
251
-		if(Context::getResponseMethod()!='HTML') return new BaseObject();
251
+		if (Context::getResponseMethod() != 'HTML') return new BaseObject();
252 252
 		$content = $this->transWidgetCode($content, $this->layout_javascript_mode);
253 253
 		return new BaseObject();
254 254
 	}
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 		// Check whether to include information about editing
265 265
 		$this->javascript_mode = $javascript_mode;
266 266
 		// Widget code box change
267
-		$content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this,'transWidgetBox'), $content);
267
+		$content = preg_replace_callback('!<div([^\>]*)widget=([^\>]*?)\><div><div>((<img.*?>)*)!is', array($this, 'transWidgetBox'), $content);
268 268
 		// Widget code information byeogyeong
269
-		$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this,'transWidget'), $content);
269
+		$content = preg_replace_callback('!<img([^\>]*)widget=([^\>]*?)\>!is', array($this, 'transWidget'), $content);
270 270
 
271 271
 		return $content;
272 272
 	}
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 		$oXmlParser = new XmlParser();
282 282
 		$xml_doc = $oXmlParser->parse(trim($buff));
283 283
 
284
-		if($xml_doc->img) $vars = $xml_doc->img->attrs;
284
+		if ($xml_doc->img) $vars = $xml_doc->img->attrs;
285 285
 		else $vars = $xml_doc->attrs;
286 286
 
287 287
 		$widget = $vars->widget;
288
-		if(!$widget) return $matches[0];
288
+		if (!$widget) return $matches[0];
289 289
 		unset($vars->widget);
290 290
 
291 291
 		return $this->execute($widget, $vars, $this->javascript_mode);
@@ -296,13 +296,13 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	function transWidgetBox($matches)
298 298
 	{
299
-		$buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]);
299
+		$buff = preg_replace('/<div><div>(.*)$/i', '</div>', $matches[0]);
300 300
 		$oXmlParser = new XmlParser();
301 301
 		$xml_doc = $oXmlParser->parse($buff);
302 302
 
303 303
 		$vars = $xml_doc->div->attrs;
304 304
 		$widget = $vars->widget;
305
-		if(!$widget) return $matches[0];
305
+		if (!$widget) return $matches[0];
306 306
 		unset($vars->widget);
307 307
 
308 308
 		$vars->widgetbox_content = $matches[3];
@@ -323,28 +323,28 @@  discard block
 block discarded – undo
323 323
 		$oXmlParser = new XmlParser();
324 324
 
325 325
 		$cnt = count($matches[1]);
326
-		for($i=0;$i<$cnt;$i++)
326
+		for ($i = 0; $i < $cnt; $i++)
327 327
 		{
328 328
 			$buff = $matches[0][$i];
329 329
 			$xml_doc = $oXmlParser->parse(trim($buff));
330 330
 
331 331
 			$args = $xml_doc->img->attrs;
332
-			if(!$args) continue;
332
+			if (!$args) continue;
333 333
 			// If you are not caching path
334 334
 			$widget = $args->widget;
335 335
 			$sequence = $args->widget_sequence;
336 336
 			$cache = $args->widget_cache;
337
-			if(!$sequence || !$cache) continue;
337
+			if (!$sequence || !$cache) continue;
338 338
 
339
-			if(count($args))
339
+			if (count($args))
340 340
 			{
341
-				foreach($args as $k => $v) $args->{$k} = urldecode($v);
341
+				foreach ($args as $k => $v) $args->{$k} = urldecode($v);
342 342
 			}
343 343
 			// If the cache file for each language widget regeneration
344
-			foreach($lang_list as $lang_type => $val)
344
+			foreach ($lang_list as $lang_type => $val)
345 345
 			{
346 346
 				$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type);
347
-				if(!file_exists($cache_file)) continue;
347
+				if (!file_exists($cache_file)) continue;
348 348
 				$this->getCache($widget, $args, $lang_type, true);
349 349
 			}
350 350
 		}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	function getCache($widget, $args, $lang_type = null, $ignore_cache = false)
357 357
 	{
358 358
 		// If the specified language specifies the current language
359
-		if(!$lang_type) $lang_type = Context::getLangType();
359
+		if (!$lang_type) $lang_type = Context::getLangType();
360 360
 		// widget, the cache number and cache values are set
361 361
 		$widget_sequence = $args->widget_sequence;
362 362
 		$widget_cache = $args->widget_cache;
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 		/**
365 365
 		 * Even if the cache number and value of the cache and return it to extract data
366 366
 		 */
367
-		if(!$ignore_cache && (!$widget_cache || !$widget_sequence))
367
+		if (!$ignore_cache && (!$widget_cache || !$widget_sequence))
368 368
 		{
369 369
 			$oWidget = $this->getWidgetObject($widget);
370
-			if(!$oWidget || !method_exists($oWidget, 'proc')) return;
370
+			if (!$oWidget || !method_exists($oWidget, 'proc')) return;
371 371
 
372 372
 			$widget_content = $oWidget->proc($args);
373 373
 			$oModuleController = getController('module');
@@ -376,15 +376,15 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 
378 378
 		$oCacheHandler = CacheHandler::getInstance('template');
379
-		if($oCacheHandler->isSupport())
379
+		if ($oCacheHandler->isSupport())
380 380
 		{
381
-			$key = 'widget_cache:' . $widget_sequence;
381
+			$key = 'widget_cache:'.$widget_sequence;
382 382
 
383 383
 			$cache_body = $oCacheHandler->get($key);
384 384
 			$cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body);
385 385
 		}
386 386
 
387
-		if($cache_body)
387
+		if ($cache_body)
388 388
 		{
389 389
 			return $cache_body;
390 390
 		}
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 			// Wanted cache file
398 398
 			$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $widget_sequence, $lang_type);
399 399
 			// If the file exists in the cache, the file validation
400
-			if(!$ignore_cache && file_exists($cache_file))
400
+			if (!$ignore_cache && file_exists($cache_file))
401 401
 			{
402 402
 				$filemtime = filemtime($cache_file);
403 403
 				// Should be modified compared to the time of the cache or in the future if creating more than widget.controller.php file a return value of the cache
404
-				if($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php'))
404
+				if ($filemtime + $widget_cache * 60 > $_SERVER['REQUEST_TIME'] && $filemtime > filemtime(_XE_PATH_.'modules/widget/widget.controller.php'))
405 405
 				{
406 406
 					$cache_body = FileHandler::readFile($cache_file);
407 407
 					$cache_body = preg_replace('@<\!--#Meta:@', '<!--Meta:', $cache_body);
@@ -410,18 +410,18 @@  discard block
 block discarded – undo
410 410
 				}
411 411
 			}
412 412
 			// cache update and cache renewal of the file mtime
413
-			if(!$oCacheHandler->isSupport())
413
+			if (!$oCacheHandler->isSupport())
414 414
 			{
415 415
 			touch($cache_file);
416 416
 			}
417 417
 
418 418
 			$oWidget = $this->getWidgetObject($widget);
419
-			if(!$oWidget || !method_exists($oWidget,'proc')) return;
419
+			if (!$oWidget || !method_exists($oWidget, 'proc')) return;
420 420
 
421 421
 			$widget_content = $oWidget->proc($args);
422 422
 			$oModuleController = getController('module');
423 423
 			$oModuleController->replaceDefinedLangCode($widget_content);
424
-			if($oCacheHandler->isSupport())
424
+			if ($oCacheHandler->isSupport())
425 425
 			{
426 426
 				$oCacheHandler->put($key, $widget_content, $widget_cache * 60);
427 427
 			}
@@ -443,16 +443,16 @@  discard block
 block discarded – undo
443 443
 	function execute($widget, $args, $javascript_mode = false, $escaped = true)
444 444
 	{
445 445
 		// Save for debug run-time widget
446
-		if(__DEBUG__==3) $start = getMicroTime();
446
+		if (__DEBUG__ == 3) $start = getMicroTime();
447 447
 		$before = microtime(true);
448 448
 		// urldecode the value of args haejum
449 449
 		$object_vars = get_object_vars($args);
450
-		if(count($object_vars))
450
+		if (count($object_vars))
451 451
 		{
452
-			foreach($object_vars as $key => $val)
452
+			foreach ($object_vars as $key => $val)
453 453
 			{
454
-				if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue;
455
-				if($escaped) $args->{$key} = utf8RawUrlDecode($val);
454
+				if (in_array($key, array('widgetbox_content', 'body', 'class', 'style', 'widget_sequence', 'widget', 'widget_padding_left', 'widget_padding_top', 'widget_padding_bottom', 'widget_padding_right', 'widgetstyle', 'document_srl'))) continue;
455
+				if ($escaped) $args->{$key} = utf8RawUrlDecode($val);
456 456
 			}
457 457
 		}
458 458
 
@@ -461,14 +461,14 @@  discard block
 block discarded – undo
461 461
 		 * Widgets widgetContent/widgetBox Wanted If you are not content
462 462
 		 */
463 463
 		$widget_content = '';
464
-		if($widget != 'widgetContent' && $widget != 'widgetBox')
464
+		if ($widget != 'widgetContent' && $widget != 'widgetBox')
465 465
 		{
466
-			if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return;
466
+			if (!is_dir(sprintf(_XE_PATH_.'widgets/%s/', $widget))) return;
467 467
 			// Hold the contents of the widget parameter
468 468
 			$widget_content = $this->getCache($widget, $args);
469 469
 		}
470 470
 
471
-		if($widget == 'widgetBox')
471
+		if ($widget == 'widgetBox')
472 472
 		{
473 473
 			$widgetbox_content = $args->widgetbox_content;
474 474
 		}
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		 * Wanted specified by the administrator of the widget style
478 478
 		 */
479 479
 		// Sometimes the wrong code, background-image: url (none) can be heard but none in this case, the request for the url so unconditionally Removed
480
-		$style = preg_replace('/url\((.+)(\/?)none\)/is','', $args->style);
480
+		$style = preg_replace('/url\((.+)(\/?)none\)/is', '', $args->style);
481 481
 		// Find a style statement that based on the internal margin dropping pre-change
482 482
 		$widget_padding_left = $args->widget_padding_left;
483 483
 		$widget_padding_right = $args->widget_padding_right;
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 		$widget_content_body = '';
494 494
 		$widget_content_footer = '';
495 495
 		// If general call is given on page styles should return immediately dreamin '
496
-		if(!$javascript_mode)
496
+		if (!$javascript_mode)
497 497
 		{
498
-			if($args->id) $args->id = ' id="'.$args->id.'" ';
499
-			switch($widget)
498
+			if ($args->id) $args->id = ' id="'.$args->id.'" ';
499
+			switch ($widget)
500 500
 			{
501 501
 				// If a direct orthogonal addition information
502 502
 				case 'widgetContent' :
503
-					if($args->document_srl)
503
+					if ($args->document_srl)
504 504
 					{
505 505
 						$oDocumentModel = getModel('document');
506 506
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
507
-						$body = $oDocument->getContent(false,false,false, false);
507
+						$body = $oDocument->getContent(false, false, false, false);
508 508
 					}
509 509
 					else
510 510
 					{
@@ -514,21 +514,21 @@  discard block
 block discarded – undo
514 514
 					$oEditorController = getController('editor');
515 515
 					$body = $oEditorController->transComponent($body);
516 516
 
517
-					$widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s"><div style="%s">', $args->id, $style,  $inner_style);
517
+					$widget_content_header = sprintf('<div class="xe_content xe-widget-wrapper '.$args->css_class.'" %sstyle="%s"><div style="%s">', $args->id, $style, $inner_style);
518 518
 					$widget_content_body = $body;
519 519
 					$widget_content_footer = '</div></div>';
520 520
 
521 521
 					break;
522 522
 					// If the widget box; it could
523 523
 				case 'widgetBox' :
524
-					$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s;"><div style="%s"><div>', $args->id, $style,  $inner_style);
524
+					$widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s;"><div style="%s"><div>', $args->id, $style, $inner_style);
525 525
 					$widget_content_body = $widgetbox_content;
526 526
 
527 527
 					break;
528 528
 					// If the General wijetil
529 529
 				default :
530
-					$widget_content_header = sprintf('<div class="xe-widget-wrapper ' . $args->css_class . '" %sstyle="%s">',$args->id,$style);
531
-					$widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style,$widget_content);
530
+					$widget_content_header = sprintf('<div class="xe-widget-wrapper '.$args->css_class.'" %sstyle="%s">', $args->id, $style);
531
+					$widget_content_body = sprintf('<div style="*zoom:1;%s">%s</div>', $inner_style, $widget_content);
532 532
 					$widget_content_footer = '</div>';
533 533
 					break;
534 534
 			}
@@ -536,15 +536,15 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 		else
538 538
 		{
539
-			switch($widget)
539
+			switch ($widget)
540 540
 			{
541 541
 				// If a direct orthogonal addition information
542 542
 				case 'widgetContent' :
543
-					if($args->document_srl)
543
+					if ($args->document_srl)
544 544
 					{
545 545
 						$oDocumentModel = getModel('document');
546 546
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
547
-						$body = $oDocument->getContent(false,false,false);
547
+						$body = $oDocument->getContent(false, false, false);
548 548
 					}
549 549
 					else
550 550
 					{
@@ -552,12 +552,12 @@  discard block
 block discarded – undo
552 552
 					}
553 553
 					// by args
554 554
 					$attribute = array();
555
-					if($args)
555
+					if ($args)
556 556
 					{
557
-						foreach($args as $key => $val)
557
+						foreach ($args as $key => $val)
558 558
 						{
559
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
560
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
559
+							if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue;
560
+							if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
561 561
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
562 562
 						}
563 563
 					}
@@ -565,44 +565,44 @@  discard block
 block discarded – undo
565 565
 					$oWidgetController = getController('widget');
566 566
 
567 567
 					$widget_content_header = sprintf(
568
-						'<div class="xe_content widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
568
+						'<div class="xe_content widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_left="%s" widget_padding_right="%s" widget_padding_top="%s" widget_padding_bottom="%s" widget="widgetContent" document_srl="%d" %s>'.
569 569
 						'<div class="widgetResize"></div>'.
570 570
 						'<div class="widgetResizeLeft"></div>'.
571 571
 						'<div class="widgetBorder">'.
572
-						'<div style="%s">',$args->widgetstyle,
572
+						'<div style="%s">', $args->widgetstyle,
573 573
 						$style,
574 574
 						$args->widget_padding_left, $args->widget_padding_right, $args->widget_padding_top, $args->widget_padding_bottom,
575 575
 						$args->document_srl,
576
-						implode(' ',$attribute),
576
+						implode(' ', $attribute),
577 577
 						$inner_style);
578 578
 
579 579
 					$widget_content_body = $body;
580 580
 					$widget_content_footer = sprintf('</div>'.
581 581
 						'</div>'.
582 582
 						'<div class="widgetContent" style="display:none;width:1px;height:1px;overflow:hidden;">%s</div>'.
583
-						'</div>',base64_encode($body));
583
+						'</div>', base64_encode($body));
584 584
 
585 585
 					break;
586 586
 					// If the widget box; it could
587 587
 				case 'widgetBox' :
588 588
 					// by args
589 589
 					$attribute = array();
590
-					if($args)
590
+					if ($args)
591 591
 					{
592
-						foreach($args as $key => $val)
592
+						foreach ($args as $key => $val)
593 593
 						{
594
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
595
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
596
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
594
+							if (in_array($key, array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget', 'widgetstyle', 'document_srl'))) continue;
595
+							if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue;
596
+							if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
597 597
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
598 598
 						}
599 599
 					}
600 600
 
601 601
 					$widget_content_header = sprintf(
602
-						'<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
602
+						'<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" widget="widgetBox" style="%s;" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" %s >'.
603 603
 						'<div class="widgetBoxResize"></div>'.
604 604
 						'<div class="widgetBoxResizeLeft"></div>'.
605
-						'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">',$args->widgetstyle,$style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,implode(' ',$attribute),$inner_style);
605
+						'<div class="widgetBoxBorder"><div class="nullWidget" style="%s">', $args->widgetstyle, $style, $widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left, implode(' ', $attribute), $inner_style);
606 606
 
607 607
 					$widget_content_body = $widgetbox_content;
608 608
 
@@ -611,26 +611,26 @@  discard block
 block discarded – undo
611 611
 				default :
612 612
 					// by args
613 613
 					$attribute = array();
614
-					if($args)
614
+					if ($args)
615 615
 					{
616
-						$allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget');
617
-						foreach($args as $key => $val)
616
+						$allowed_key = array('class', 'style', 'widget_padding_top', 'widget_padding_right', 'widget_padding_bottom', 'widget_padding_left', 'widget');
617
+						foreach ($args as $key => $val)
618 618
 						{
619
-							if(in_array($key, $allowed_key)) continue;
620
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
621
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
619
+							if (in_array($key, $allowed_key)) continue;
620
+							if (!is_numeric($val) && (!is_string($val) || strlen($val) == 0)) continue;
621
+							if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
622 622
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
623 623
 						}
624 624
 					}
625 625
 
626
-					$widget_content_header = sprintf('<div class="widgetOutput ' . $args->css_class . '" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
626
+					$widget_content_header = sprintf('<div class="widgetOutput '.$args->css_class.'" widgetstyle="%s" style="%s" widget_padding_top="%s" widget_padding_right="%s" widget_padding_bottom="%s" widget_padding_left="%s" widget="%s" %s >'.
627 627
 						'<div class="widgetResize"></div>'.
628 628
 						'<div class="widgetResizeLeft"></div>'.
629
-						'<div class="widgetBorder">',$args->widgetstyle,$style,
629
+						'<div class="widgetBorder">', $args->widgetstyle, $style,
630 630
 						$widget_padding_top, $widget_padding_right, $widget_padding_bottom, $widget_padding_left,
631
-						$widget, implode(' ',$attribute));
631
+						$widget, implode(' ', $attribute));
632 632
 
633
-					$widget_content_body = sprintf('<div style="%s">%s</div>',$inner_style, $widget_content);
633
+					$widget_content_body = sprintf('<div style="%s">%s</div>', $inner_style, $widget_content);
634 634
 
635 635
 					$widget_content_footer = '</div></div>';
636 636
 
@@ -638,11 +638,11 @@  discard block
 block discarded – undo
638 638
 			}
639 639
 		}
640 640
 		// Compile the widget style.
641
-		if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
641
+		if ($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle, $widget, $widget_content_body, $args, $javascript_mode);
642 642
 
643
-		$output = $widget_content_header . $widget_content_body . $widget_content_footer;
643
+		$output = $widget_content_header.$widget_content_body.$widget_content_footer;
644 644
 		// Debug widget creation time information added to the results
645
-		if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
645
+		if (__DEBUG__ == 3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
646 646
 
647 647
 		$after = microtime(true);
648 648
 
@@ -663,32 +663,32 @@  discard block
 block discarded – undo
663 663
 	 */
664 664
 	function getWidgetObject($widget)
665 665
 	{
666
-		if(!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget))
666
+		if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $widget))
667 667
 		{
668 668
 			return Context::getLang('msg_invalid_request');
669 669
 		}
670 670
 
671
-		if(!$GLOBALS['_xe_loaded_widgets_'][$widget])
671
+		if (!$GLOBALS['_xe_loaded_widgets_'][$widget])
672 672
 		{
673 673
 			// Finding the location of a widget
674 674
 			$oWidgetModel = getModel('widget');
675 675
 			$path = $oWidgetModel->getWidgetPath($widget);
676 676
 			// If you do not find the class file error output widget (html output)
677 677
 			$class_file = sprintf('%s%s.class.php', $path, $widget);
678
-			if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
678
+			if (!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
679 679
 			// Widget classes include
680 680
 			require_once($class_file);
681 681
 
682 682
 			// Creating Objects
683
-			if(!class_exists($widget, false))
683
+			if (!class_exists($widget, false))
684 684
 			{
685 685
 				return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
686 686
 			}
687 687
 
688 688
 			$oWidget = new $widget();
689
-			if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
689
+			if (!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
690 690
 
691
-			if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
691
+			if (!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
692 692
 
693 693
 			$oWidget->widget_path = $path;
694 694
 
@@ -697,29 +697,29 @@  discard block
 block discarded – undo
697 697
 		return $GLOBALS['_xe_loaded_widgets_'][$widget];
698 698
 	}
699 699
 
700
-	function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
700
+	function compileWidgetStyle($widgetStyle, $widget, $widget_content_body, $args, $javascript_mode)
701 701
 	{
702
-		if(!$widgetStyle) return $widget_content_body;
702
+		if (!$widgetStyle) return $widget_content_body;
703 703
 
704 704
 		$oWidgetModel = getModel('widget');
705 705
 		// Bring extra_var widget style tie
706 706
 		$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle);
707
-		if(!$widgetstyle_info) return $widget_content_body;
707
+		if (!$widgetstyle_info) return $widget_content_body;
708 708
 
709 709
 		$widgetstyle_extra_var = new stdClass();
710 710
 		$widgetstyle_extra_var_key = get_object_vars($widgetstyle_info);
711
-		if(count($widgetstyle_extra_var_key['extra_var']))
711
+		if (count($widgetstyle_extra_var_key['extra_var']))
712 712
 		{
713
-			foreach($widgetstyle_extra_var_key['extra_var'] as $key => $val)
713
+			foreach ($widgetstyle_extra_var_key['extra_var'] as $key => $val)
714 714
 			{
715
-				$widgetstyle_extra_var->{$key} =  $args->{$key};
715
+				$widgetstyle_extra_var->{$key} = $args->{$key};
716 716
 			}
717 717
 		}
718 718
 		Context::set('widgetstyle_extra_var', $widgetstyle_extra_var);
719 719
 		// #18994272 오타를 수정했으나 하위 호환성을 위해 남겨둠 - deprecated
720 720
 		Context::set('widgetstyle_extar_var', $widgetstyle_extra_var);
721 721
 
722
-		if($javascript_mode && $widget=='widgetBox')
722
+		if ($javascript_mode && $widget == 'widgetBox')
723 723
 		{
724 724
 			Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>');
725 725
 		}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		$oWidgetModel = getModel('widget');
744 744
 		$widget_info = $oWidgetModel->getWidgetInfo($widget);
745 745
 
746
-		if(!$vars)
746
+		if (!$vars)
747 747
 		{
748 748
 			$vars = new stdClass();
749 749
 		}
@@ -754,31 +754,31 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$vars->skin = trim($request_vars->skin);
756 756
 		$vars->colorset = trim($request_vars->colorset);
757
-		$vars->widget_sequence = (int)($request_vars->widget_sequence);
758
-		$vars->widget_cache = (int)($request_vars->widget_cache);
757
+		$vars->widget_sequence = (int) ($request_vars->widget_sequence);
758
+		$vars->widget_cache = (int) ($request_vars->widget_cache);
759 759
 		$vars->style = trim($request_vars->style);
760 760
 		$vars->widget_padding_left = trim($request_vars->widget_padding_left);
761 761
 		$vars->widget_padding_right = trim($request_vars->widget_padding_right);
762 762
 		$vars->widget_padding_top = trim($request_vars->widget_padding_top);
763 763
 		$vars->widget_padding_bottom = trim($request_vars->widget_padding_bottom);
764
-		$vars->document_srl= trim($request_vars->document_srl);
764
+		$vars->document_srl = trim($request_vars->document_srl);
765 765
 
766
-		if(count($widget_info->extra_var))
766
+		if (count($widget_info->extra_var))
767 767
 		{
768
-			foreach($widget_info->extra_var as $key=>$val)
768
+			foreach ($widget_info->extra_var as $key=>$val)
769 769
 			{
770 770
 				$vars->{$key} = trim($request_vars->{$key});
771 771
 			}
772 772
 		}
773 773
 		// If the widget style
774
-		if($request_vars->widgetstyle)
774
+		if ($request_vars->widgetstyle)
775 775
 		{
776 776
 			$widgetStyle_info = $oWidgetModel->getWidgetStyleInfo($request_vars->widgetstyle);
777
-			if(count($widgetStyle_info->extra_var))
777
+			if (count($widgetStyle_info->extra_var))
778 778
 			{
779
-				foreach($widgetStyle_info->extra_var as $key=>$val)
779
+				foreach ($widgetStyle_info->extra_var as $key=>$val)
780 780
 				{
781
-					if($val->type =='color' || $val->type =='text' || $val->type =='select' || $val->type =='filebox' || $val->type == 'textarea')
781
+					if ($val->type == 'color' || $val->type == 'text' || $val->type == 'select' || $val->type == 'filebox' || $val->type == 'textarea')
782 782
 					{
783 783
 						$vars->{$key} = trim($request_vars->{$key});
784 784
 					}
@@ -786,23 +786,23 @@  discard block
 block discarded – undo
786 786
 			}
787 787
 		}
788 788
 
789
-		if($vars->widget_sequence)
789
+		if ($vars->widget_sequence)
790 790
 		{
791 791
 			$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $vars->widget_sequence, Context::getLangType());
792 792
 			FileHandler::removeFile($cache_file);
793 793
 		}
794 794
 
795
-		if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
795
+		if ($vars->widget_cache > 0) $vars->widget_sequence = getNextSequence();
796 796
 
797 797
 		$attribute = array();
798
-		foreach($vars as $key => $val)
798
+		foreach ($vars as $key => $val)
799 799
 		{
800
-			if(!$val)
800
+			if (!$val)
801 801
 			{
802 802
 				unset($vars->{$key});
803 803
 				continue;
804 804
 			}
805
-			if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
805
+			if (strpos($val, '|@|') > 0) $val = str_replace('|@|', ',', $val);
806 806
 			$vars->{$key} = Context::convertEncodingStr($val);
807 807
 			$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
808 808
 		}
Please login to merge, or discard this patch.
Braces   +153 added lines, -63 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
 			$colorset_list[] = $colorset;
41 41
 		}
42 42
 
43
-		if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
43
+		if(count($colorset_list)) {
44
+			$colorsets = implode("\n", $colorset_list);
45
+		}
44 46
 		$this->add('colorset_list', $colorsets);
45 47
 	}
46 48
 
@@ -50,8 +52,12 @@  discard block
 block discarded – undo
50 52
 	function procWidgetGenerateCode()
51 53
 	{
52 54
 		$widget = Context::get('selected_widget');
53
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
54
-		if(!Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
55
+		if(!$widget) {
56
+			return new BaseObject(-1,'msg_invalid_request');
57
+		}
58
+		if(!Context::get('skin')) {
59
+			return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
60
+		}
55 61
 
56 62
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
57 63
 
@@ -66,9 +72,13 @@  discard block
 block discarded – undo
66 72
 	function procWidgetGenerateCodeInPage()
67 73
 	{
68 74
 		$widget = Context::get('selected_widget');
69
-		if(!$widget) return new BaseObject(-1,'msg_invalid_request');
75
+		if(!$widget) {
76
+			return new BaseObject(-1,'msg_invalid_request');
77
+		}
70 78
 
71
-		if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
79
+		if(!in_array($widget,array('widgetBox','widgetContent')) && !Context::get('skin')) {
80
+			return new BaseObject(-1,Context::getLang('msg_widget_skin_is_null'));
81
+		}
72 82
 
73 83
 		$attribute = $this->arrangeWidgetVars($widget, Context::getRequestVars(), $vars);
74 84
 		// Wanted results
@@ -107,15 +117,21 @@  discard block
 block discarded – undo
107 117
 		$err = 0;
108 118
 		$oLayoutModel = getModel('layout');
109 119
 		$layout_info = $oLayoutModel->getLayout($module_srl);
110
-		if(!$layout_info || $layout_info->type != 'faceoff') $err++;
120
+		if(!$layout_info || $layout_info->type != 'faceoff') {
121
+			$err++;
122
+		}
111 123
 
112 124
 		// Destination Information Wanted page module
113 125
 		$oModuleModel = getModel('module');
114 126
 		$columnList = array('module_srl', 'module');
115 127
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
116
-		if(!$page_info->module_srl || $page_info->module != 'page') $err++;
128
+		if(!$page_info->module_srl || $page_info->module != 'page') {
129
+			$err++;
130
+		}
117 131
 
118
-		if($err > 1) return new BaseObject(-1,'msg_invalid_request');
132
+		if($err > 1) {
133
+			return new BaseObject(-1,'msg_invalid_request');
134
+		}
119 135
 
120 136
 		// Check permissions
121 137
 		$logged_info = Context::get('logged_info');
@@ -142,15 +158,16 @@  discard block
 block discarded – undo
142 158
 		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl)
143 159
 		{
144 160
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
145
-		}
146
-		else
161
+		} else
147 162
 		{
148 163
 			$output = $oDocumentController->insertDocument($obj);
149 164
 			$obj->document_srl = $output->get('document_srl');
150 165
 		}
151 166
 
152 167
 		// Stop when an error occurs
153
-		if(!$output->toBool()) return $output;
168
+		if(!$output->toBool()) {
169
+			return $output;
170
+		}
154 171
 
155 172
 		// Return results
156 173
 		$this->add('document_srl', $obj->document_srl);
@@ -169,14 +186,18 @@  discard block
 block discarded – undo
169 186
 		$oDocumentAdminController = getAdminController('document');
170 187
 
171 188
 		$oDocument = $oDocumentModel->getDocument($document_srl);
172
-		if(!$oDocument->isExists()) return new BaseObject(-1,'msg_invalid_request');
189
+		if(!$oDocument->isExists()) {
190
+			return new BaseObject(-1,'msg_invalid_request');
191
+		}
173 192
 		$module_srl = $oDocument->get('module_srl');
174 193
 
175 194
 		// Destination Information Wanted page module
176 195
 		$oModuleModel = getModel('module');
177 196
 		$columnList = array('module_srl', 'module');
178 197
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
179
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
198
+		if(!$page_info->module_srl || $page_info->module != 'page') {
199
+			return new BaseObject(-1,'msg_invalid_request');
200
+		}
180 201
 
181 202
 		// Check permissions
182 203
 		$logged_info = Context::get('logged_info');
@@ -191,7 +212,9 @@  discard block
 block discarded – undo
191 212
 		}
192 213
 
193 214
 		$output = $oDocumentAdminController->copyDocumentModule(array($oDocument->get('document_srl')), $oDocument->get('module_srl'),0);
194
-		if(!$output->toBool()) return $output;
215
+		if(!$output->toBool()) {
216
+			return $output;
217
+		}
195 218
 
196 219
 		// Return results
197 220
 		$copied_srls = $output->get('copied_srls');
@@ -210,13 +233,17 @@  discard block
 block discarded – undo
210 233
 		$oDocumentController = getController('document');
211 234
 
212 235
 		$oDocument = $oDocumentModel->getDocument($document_srl);
213
-		if(!$oDocument->isExists()) return new BaseObject();
236
+		if(!$oDocument->isExists()) {
237
+			return new BaseObject();
238
+		}
214 239
 		$module_srl = $oDocument->get('module_srl');
215 240
 
216 241
 		// Destination Information Wanted page module
217 242
 		$oModuleModel = getModel('module');
218 243
 		$page_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
219
-		if(!$page_info->module_srl || $page_info->module != 'page') return new BaseObject(-1,'msg_invalid_request');
244
+		if(!$page_info->module_srl || $page_info->module != 'page') {
245
+			return new BaseObject(-1,'msg_invalid_request');
246
+		}
220 247
 
221 248
 		// Check permissions
222 249
 		$logged_info = Context::get('logged_info');
@@ -231,7 +258,9 @@  discard block
 block discarded – undo
231 258
 		}
232 259
 
233 260
 		$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'));
234
-		if(!$output->toBool()) return $output;
261
+		if(!$output->toBool()) {
262
+			return $output;
263
+		}
235 264
 	}
236 265
 
237 266
 	/**
@@ -248,7 +277,9 @@  discard block
 block discarded – undo
248 277
 	 */
249 278
 	function triggerWidgetCompile(&$content)
250 279
 	{
251
-		if(Context::getResponseMethod()!='HTML') return new BaseObject();
280
+		if(Context::getResponseMethod()!='HTML') {
281
+			return new BaseObject();
282
+		}
252 283
 		$content = $this->transWidgetCode($content, $this->layout_javascript_mode);
253 284
 		return new BaseObject();
254 285
 	}
@@ -281,11 +312,16 @@  discard block
 block discarded – undo
281 312
 		$oXmlParser = new XmlParser();
282 313
 		$xml_doc = $oXmlParser->parse(trim($buff));
283 314
 
284
-		if($xml_doc->img) $vars = $xml_doc->img->attrs;
285
-		else $vars = $xml_doc->attrs;
315
+		if($xml_doc->img) {
316
+			$vars = $xml_doc->img->attrs;
317
+		} else {
318
+			$vars = $xml_doc->attrs;
319
+		}
286 320
 
287 321
 		$widget = $vars->widget;
288
-		if(!$widget) return $matches[0];
322
+		if(!$widget) {
323
+			return $matches[0];
324
+		}
289 325
 		unset($vars->widget);
290 326
 
291 327
 		return $this->execute($widget, $vars, $this->javascript_mode);
@@ -302,7 +338,9 @@  discard block
 block discarded – undo
302 338
 
303 339
 		$vars = $xml_doc->div->attrs;
304 340
 		$widget = $vars->widget;
305
-		if(!$widget) return $matches[0];
341
+		if(!$widget) {
342
+			return $matches[0];
343
+		}
306 344
 		unset($vars->widget);
307 345
 
308 346
 		$vars->widgetbox_content = $matches[3];
@@ -329,22 +367,30 @@  discard block
 block discarded – undo
329 367
 			$xml_doc = $oXmlParser->parse(trim($buff));
330 368
 
331 369
 			$args = $xml_doc->img->attrs;
332
-			if(!$args) continue;
370
+			if(!$args) {
371
+				continue;
372
+			}
333 373
 			// If you are not caching path
334 374
 			$widget = $args->widget;
335 375
 			$sequence = $args->widget_sequence;
336 376
 			$cache = $args->widget_cache;
337
-			if(!$sequence || !$cache) continue;
377
+			if(!$sequence || !$cache) {
378
+				continue;
379
+			}
338 380
 
339 381
 			if(count($args))
340 382
 			{
341
-				foreach($args as $k => $v) $args->{$k} = urldecode($v);
383
+				foreach($args as $k => $v) {
384
+					$args->{$k} = urldecode($v);
385
+				}
342 386
 			}
343 387
 			// If the cache file for each language widget regeneration
344 388
 			foreach($lang_list as $lang_type => $val)
345 389
 			{
346 390
 				$cache_file = sprintf('%s%d.%s.cache', $this->cache_path, $sequence, $lang_type);
347
-				if(!file_exists($cache_file)) continue;
391
+				if(!file_exists($cache_file)) {
392
+					continue;
393
+				}
348 394
 				$this->getCache($widget, $args, $lang_type, true);
349 395
 			}
350 396
 		}
@@ -356,7 +402,9 @@  discard block
 block discarded – undo
356 402
 	function getCache($widget, $args, $lang_type = null, $ignore_cache = false)
357 403
 	{
358 404
 		// If the specified language specifies the current language
359
-		if(!$lang_type) $lang_type = Context::getLangType();
405
+		if(!$lang_type) {
406
+			$lang_type = Context::getLangType();
407
+		}
360 408
 		// widget, the cache number and cache values are set
361 409
 		$widget_sequence = $args->widget_sequence;
362 410
 		$widget_cache = $args->widget_cache;
@@ -367,7 +415,9 @@  discard block
 block discarded – undo
367 415
 		if(!$ignore_cache && (!$widget_cache || !$widget_sequence))
368 416
 		{
369 417
 			$oWidget = $this->getWidgetObject($widget);
370
-			if(!$oWidget || !method_exists($oWidget, 'proc')) return;
418
+			if(!$oWidget || !method_exists($oWidget, 'proc')) {
419
+				return;
420
+			}
371 421
 
372 422
 			$widget_content = $oWidget->proc($args);
373 423
 			$oModuleController = getController('module');
@@ -387,8 +437,7 @@  discard block
 block discarded – undo
387 437
 		if($cache_body)
388 438
 		{
389 439
 			return $cache_body;
390
-		}
391
-		else
440
+		} else
392 441
 		{
393 442
 			/**
394 443
 			 * Cache number and cache values are set so that the cache file should call
@@ -416,7 +465,9 @@  discard block
 block discarded – undo
416 465
 			}
417 466
 
418 467
 			$oWidget = $this->getWidgetObject($widget);
419
-			if(!$oWidget || !method_exists($oWidget,'proc')) return;
468
+			if(!$oWidget || !method_exists($oWidget,'proc')) {
469
+				return;
470
+			}
420 471
 
421 472
 			$widget_content = $oWidget->proc($args);
422 473
 			$oModuleController = getController('module');
@@ -424,8 +475,7 @@  discard block
 block discarded – undo
424 475
 			if($oCacheHandler->isSupport())
425 476
 			{
426 477
 				$oCacheHandler->put($key, $widget_content, $widget_cache * 60);
427
-			}
428
-			else
478
+			} else
429 479
 			{
430 480
 				FileHandler::writeFile($cache_file, $widget_content);
431 481
 			}
@@ -443,7 +493,9 @@  discard block
 block discarded – undo
443 493
 	function execute($widget, $args, $javascript_mode = false, $escaped = true)
444 494
 	{
445 495
 		// Save for debug run-time widget
446
-		if(__DEBUG__==3) $start = getMicroTime();
496
+		if(__DEBUG__==3) {
497
+			$start = getMicroTime();
498
+		}
447 499
 		$before = microtime(true);
448 500
 		// urldecode the value of args haejum
449 501
 		$object_vars = get_object_vars($args);
@@ -451,8 +503,12 @@  discard block
 block discarded – undo
451 503
 		{
452 504
 			foreach($object_vars as $key => $val)
453 505
 			{
454
-				if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) continue;
455
-				if($escaped) $args->{$key} = utf8RawUrlDecode($val);
506
+				if(in_array($key, array('widgetbox_content','body','class','style','widget_sequence','widget','widget_padding_left','widget_padding_top','widget_padding_bottom','widget_padding_right','widgetstyle','document_srl'))) {
507
+					continue;
508
+				}
509
+				if($escaped) {
510
+					$args->{$key} = utf8RawUrlDecode($val);
511
+				}
456 512
 			}
457 513
 		}
458 514
 
@@ -463,7 +519,9 @@  discard block
 block discarded – undo
463 519
 		$widget_content = '';
464 520
 		if($widget != 'widgetContent' && $widget != 'widgetBox')
465 521
 		{
466
-			if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) return;
522
+			if(!is_dir(sprintf(_XE_PATH_.'widgets/%s/',$widget))) {
523
+				return;
524
+			}
467 525
 			// Hold the contents of the widget parameter
468 526
 			$widget_content = $this->getCache($widget, $args);
469 527
 		}
@@ -495,7 +553,9 @@  discard block
 block discarded – undo
495 553
 		// If general call is given on page styles should return immediately dreamin '
496 554
 		if(!$javascript_mode)
497 555
 		{
498
-			if($args->id) $args->id = ' id="'.$args->id.'" ';
556
+			if($args->id) {
557
+				$args->id = ' id="'.$args->id.'" ';
558
+			}
499 559
 			switch($widget)
500 560
 			{
501 561
 				// If a direct orthogonal addition information
@@ -505,8 +565,7 @@  discard block
 block discarded – undo
505 565
 						$oDocumentModel = getModel('document');
506 566
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
507 567
 						$body = $oDocument->getContent(false,false,false, false);
508
-					}
509
-					else
568
+					} else
510 569
 					{
511 570
 						$body = base64_decode($args->body);
512 571
 					}
@@ -533,8 +592,7 @@  discard block
 block discarded – undo
533 592
 					break;
534 593
 			}
535 594
 			// Edit page is called when a widget if you add the code for handling
536
-		}
537
-		else
595
+		} else
538 596
 		{
539 597
 			switch($widget)
540 598
 			{
@@ -545,8 +603,7 @@  discard block
 block discarded – undo
545 603
 						$oDocumentModel = getModel('document');
546 604
 						$oDocument = $oDocumentModel->getDocument($args->document_srl);
547 605
 						$body = $oDocument->getContent(false,false,false);
548
-					}
549
-					else
606
+					} else
550 607
 					{
551 608
 						$body = base64_decode($args->body);
552 609
 					}
@@ -556,8 +613,12 @@  discard block
 block discarded – undo
556 613
 					{
557 614
 						foreach($args as $key => $val)
558 615
 						{
559
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
560
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
616
+							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) {
617
+								continue;
618
+							}
619
+							if(strpos($val,'|@|')>0) {
620
+								$val = str_replace('|@|',',',$val);
621
+							}
561 622
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
562 623
 						}
563 624
 					}
@@ -591,9 +652,15 @@  discard block
 block discarded – undo
591 652
 					{
592 653
 						foreach($args as $key => $val)
593 654
 						{
594
-							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) continue;
595
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
596
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
655
+							if(in_array($key, array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget','widgetstyle','document_srl'))) {
656
+								continue;
657
+							}
658
+							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) {
659
+								continue;
660
+							}
661
+							if(strpos($val,'|@|')>0) {
662
+								$val = str_replace('|@|',',',$val);
663
+							}
597 664
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
598 665
 						}
599 666
 					}
@@ -616,9 +683,15 @@  discard block
 block discarded – undo
616 683
 						$allowed_key = array('class','style','widget_padding_top','widget_padding_right','widget_padding_bottom','widget_padding_left','widget');
617 684
 						foreach($args as $key => $val)
618 685
 						{
619
-							if(in_array($key, $allowed_key)) continue;
620
-							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) continue;
621
-							if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
686
+							if(in_array($key, $allowed_key)) {
687
+								continue;
688
+							}
689
+							if(!is_numeric($val) && (!is_string($val) || strlen($val)==0)) {
690
+								continue;
691
+							}
692
+							if(strpos($val,'|@|')>0) {
693
+								$val = str_replace('|@|',',',$val);
694
+							}
622 695
 							$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars($val, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
623 696
 						}
624 697
 					}
@@ -638,11 +711,15 @@  discard block
 block discarded – undo
638 711
 			}
639 712
 		}
640 713
 		// Compile the widget style.
641
-		if($args->widgetstyle) $widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
714
+		if($args->widgetstyle) {
715
+			$widget_content_body = $this->compileWidgetStyle($args->widgetstyle,$widget, $widget_content_body, $args, $javascript_mode);
716
+		}
642 717
 
643 718
 		$output = $widget_content_header . $widget_content_body . $widget_content_footer;
644 719
 		// Debug widget creation time information added to the results
645
-		if(__DEBUG__==3) $GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
720
+		if(__DEBUG__==3) {
721
+			$GLOBALS['__widget_excute_elapsed__'] += getMicroTime() - $start;
722
+		}
646 723
 
647 724
 		$after = microtime(true);
648 725
 
@@ -675,7 +752,9 @@  discard block
 block discarded – undo
675 752
 			$path = $oWidgetModel->getWidgetPath($widget);
676 753
 			// If you do not find the class file error output widget (html output)
677 754
 			$class_file = sprintf('%s%s.class.php', $path, $widget);
678
-			if(!file_exists($class_file)) return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
755
+			if(!file_exists($class_file)) {
756
+				return sprintf(Context::getLang('msg_widget_is_not_exists'), $widget);
757
+			}
679 758
 			// Widget classes include
680 759
 			require_once($class_file);
681 760
 
@@ -686,9 +765,13 @@  discard block
 block discarded – undo
686 765
 			}
687 766
 
688 767
 			$oWidget = new $widget();
689
-			if(!is_object($oWidget)) return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
768
+			if(!is_object($oWidget)) {
769
+				return sprintf(Context::getLang('msg_widget_object_is_null'), $widget);
770
+			}
690 771
 
691
-			if(!method_exists($oWidget, 'proc')) return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
772
+			if(!method_exists($oWidget, 'proc')) {
773
+				return sprintf(Context::getLang('msg_widget_proc_is_null'), $widget);
774
+			}
692 775
 
693 776
 			$oWidget->widget_path = $path;
694 777
 
@@ -699,12 +782,16 @@  discard block
 block discarded – undo
699 782
 
700 783
 	function compileWidgetStyle($widgetStyle,$widget,$widget_content_body, $args, $javascript_mode)
701 784
 	{
702
-		if(!$widgetStyle) return $widget_content_body;
785
+		if(!$widgetStyle) {
786
+			return $widget_content_body;
787
+		}
703 788
 
704 789
 		$oWidgetModel = getModel('widget');
705 790
 		// Bring extra_var widget style tie
706 791
 		$widgetstyle_info = $oWidgetModel->getWidgetStyleInfo($widgetStyle);
707
-		if(!$widgetstyle_info) return $widget_content_body;
792
+		if(!$widgetstyle_info) {
793
+			return $widget_content_body;
794
+		}
708 795
 
709 796
 		$widgetstyle_extra_var = new stdClass();
710 797
 		$widgetstyle_extra_var_key = get_object_vars($widgetstyle_info);
@@ -722,8 +809,7 @@  discard block
 block discarded – undo
722 809
 		if($javascript_mode && $widget=='widgetBox')
723 810
 		{
724 811
 			Context::set('widget_content', '<div class="widget_inner">'.$widget_content_body.'</div>');
725
-		}
726
-		else
812
+		} else
727 813
 		{
728 814
 			Context::set('widget_content', $widget_content_body);
729 815
 		}
@@ -792,7 +878,9 @@  discard block
 block discarded – undo
792 878
 			FileHandler::removeFile($cache_file);
793 879
 		}
794 880
 
795
-		if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
881
+		if($vars->widget_cache>0) {
882
+			$vars->widget_sequence = getNextSequence();
883
+		}
796 884
 
797 885
 		$attribute = array();
798 886
 		foreach($vars as $key => $val)
@@ -802,7 +890,9 @@  discard block
 block discarded – undo
802 890
 				unset($vars->{$key});
803 891
 				continue;
804 892
 			}
805
-			if(strpos($val,'|@|') > 0) $val = str_replace('|@|', ',', $val);
893
+			if(strpos($val,'|@|') > 0) {
894
+				$val = str_replace('|@|', ',', $val);
895
+			}
806 896
 			$vars->{$key} = Context::convertEncodingStr($val);
807 897
 			$attribute[] = sprintf('%s="%s"', $key, htmlspecialchars(Context::convertEncodingStr($val), ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
808 898
 		}
Please login to merge, or discard this patch.
modules/integration_search/integration_search.view.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		$logged_info = Context::get('logged_info');
40 40
 
41 41
 		// Check permissions
42
-		if(!$this->grant->access) return new BaseObject(-1,'msg_not_permitted');
42
+		if (!$this->grant->access) return new BaseObject(-1, 'msg_not_permitted');
43 43
 
44 44
 		$config = $oModuleModel->getModuleConfig('integration_search');
45
-		if(!$config) $config = new stdClass;
46
-		if(!$config->skin)
45
+		if (!$config) $config = new stdClass;
46
+		if (!$config->skin)
47 47
 		{
48 48
 			$config->skin = 'default';
49 49
 			$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 		Context::set('module_info', $skin_vars);
68 68
 
69 69
 		$target = $config->target;
70
-		if(!$target) $target = 'include';
70
+		if (!$target) $target = 'include';
71 71
 
72
-		if(empty($config->target_module_srl))
72
+		if (empty($config->target_module_srl))
73 73
 			$module_srl_list = array();
74 74
 		else
75
-			$module_srl_list = explode(',',$config->target_module_srl);
75
+			$module_srl_list = explode(',', $config->target_module_srl);
76 76
 
77 77
 		// https://github.com/xpressengine/xe-core/issues/1522
78 78
 		// 검색 대상을 지정하지 않았을 때 검색 제한
79
-		if($target === 'include' && !count($module_srl_list))
79
+		if ($target === 'include' && !count($module_srl_list))
80 80
 		{
81 81
 			$oMessageObject = ModuleHandler::getModuleInstance('message');
82 82
 			$oMessageObject->setError(-1);
@@ -90,19 +90,19 @@  discard block
 block discarded – undo
90 90
 		// Set a variable for search keyword
91 91
 		$is_keyword = Context::get('is_keyword');
92 92
 		// Set page variables
93
-		$page = (int)Context::get('page');
94
-		if(!$page) $page = 1;
93
+		$page = (int) Context::get('page');
94
+		if (!$page) $page = 1;
95 95
 		// Search by search tab
96 96
 		$where = Context::get('where');
97 97
 		// Create integration search model object
98
-		if($is_keyword)
98
+		if ($is_keyword)
99 99
 		{
100 100
 			$oIS = getModel('integration_search');
101
-			switch($where)
101
+			switch ($where)
102 102
 			{
103 103
 				case 'document' :
104 104
 					$search_target = Context::get('search_target');
105
-					if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
105
+					if (!in_array($search_target, array('title', 'content', 'title_content', 'tag'))) $search_target = 'title';
106 106
 					Context::set('search_target', $search_target);
107 107
 
108 108
 					$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 					break;
117 117
 				case 'trackback' :
118 118
 					$search_target = Context::get('search_target');
119
-					if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title';
119
+					if (!in_array($search_target, array('title', 'url', 'blog_name', 'excerpt'))) $search_target = 'title';
120 120
 					Context::set('search_target', $search_target);
121 121
 
122 122
 					$output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 					$this->setTemplateFile("trackback", $page);
125 125
 					break;
126 126
 				case 'multimedia' :
127
-					$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page,20);
127
+					$output = $oIS->getImages($target, $module_srl_list, $is_keyword, $page, 20);
128 128
 					Context::set('output', $output);
129 129
 					$this->setTemplateFile("multimedia", $page);
130 130
 					break;
Please login to merge, or discard this patch.
Braces   +26 added lines, -16 removed lines patch added patch discarded remove patch
@@ -39,24 +39,26 @@  discard block
 block discarded – undo
39 39
 		$logged_info = Context::get('logged_info');
40 40
 
41 41
 		// Check permissions
42
-		if(!$this->grant->access) return new BaseObject(-1,'msg_not_permitted');
42
+		if(!$this->grant->access) {
43
+			return new BaseObject(-1,'msg_not_permitted');
44
+		}
43 45
 
44 46
 		$config = $oModuleModel->getModuleConfig('integration_search');
45
-		if(!$config) $config = new stdClass;
47
+		if(!$config) {
48
+			$config = new stdClass;
49
+		}
46 50
 		if(!$config->skin)
47 51
 		{
48 52
 			$config->skin = 'default';
49 53
 			$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
50
-		}
51
-		else
54
+		} else
52 55
 		{
53 56
 			//check theme
54 57
 			$config_parse = explode('|@|', $config->skin);
55 58
 			if (count($config_parse) > 1)
56 59
 			{
57 60
 				$template_path = sprintf('./themes/%s/modules/integration_search/', $config_parse[0]);
58
-			}
59
-			else
61
+			} else
60 62
 			{
61 63
 				$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
62 64
 			}
@@ -67,12 +69,15 @@  discard block
 block discarded – undo
67 69
 		Context::set('module_info', $skin_vars);
68 70
 
69 71
 		$target = $config->target;
70
-		if(!$target) $target = 'include';
72
+		if(!$target) {
73
+			$target = 'include';
74
+		}
71 75
 
72
-		if(empty($config->target_module_srl))
73
-			$module_srl_list = array();
74
-		else
75
-			$module_srl_list = explode(',',$config->target_module_srl);
76
+		if(empty($config->target_module_srl)) {
77
+					$module_srl_list = array();
78
+		} else {
79
+					$module_srl_list = explode(',',$config->target_module_srl);
80
+		}
76 81
 
77 82
 		// https://github.com/xpressengine/xe-core/issues/1522
78 83
 		// 검색 대상을 지정하지 않았을 때 검색 제한
@@ -91,7 +96,9 @@  discard block
 block discarded – undo
91 96
 		$is_keyword = Context::get('is_keyword');
92 97
 		// Set page variables
93 98
 		$page = (int)Context::get('page');
94
-		if(!$page) $page = 1;
99
+		if(!$page) {
100
+			$page = 1;
101
+		}
95 102
 		// Search by search tab
96 103
 		$where = Context::get('where');
97 104
 		// Create integration search model object
@@ -102,7 +109,9 @@  discard block
 block discarded – undo
102 109
 			{
103 110
 				case 'document' :
104 111
 					$search_target = Context::get('search_target');
105
-					if(!in_array($search_target, array('title','content','title_content','tag'))) $search_target = 'title';
112
+					if(!in_array($search_target, array('title','content','title_content','tag'))) {
113
+						$search_target = 'title';
114
+					}
106 115
 					Context::set('search_target', $search_target);
107 116
 
108 117
 					$output = $oIS->getDocuments($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -116,7 +125,9 @@  discard block
 block discarded – undo
116 125
 					break;
117 126
 				case 'trackback' :
118 127
 					$search_target = Context::get('search_target');
119
-					if(!in_array($search_target, array('title','url','blog_name','excerpt'))) $search_target = 'title';
128
+					if(!in_array($search_target, array('title','url','blog_name','excerpt'))) {
129
+						$search_target = 'title';
130
+					}
120 131
 					Context::set('search_target', $search_target);
121 132
 
122 133
 					$output = $oIS->getTrackbacks($target, $module_srl_list, $search_target, $is_keyword, $page, 10);
@@ -144,8 +155,7 @@  discard block
 block discarded – undo
144 155
 					$this->setTemplateFile("index", $page);
145 156
 					break;
146 157
 			}
147
-		}
148
-		else
158
+		} else
149 159
 		{
150 160
 			$this->setTemplateFile("no_keywords");
151 161
 		}
Please login to merge, or discard this patch.
modules/integration_search/integration_search.model.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return BaseObject output document list
30 30
 	 */
31
-	function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)
31
+	function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page = 1, $list_count = 20)
32 32
 	{
33
-		if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
33
+		if (is_array($module_srls_list)) $module_srls_list = implode(',', $module_srls_list);
34 34
 
35 35
 		$args = new stdClass();
36
-		if($target == 'exclude')
36
+		if ($target == 'exclude')
37 37
 		{
38 38
 			$module_srls_list .= ',0'; // exclude 'trash'
39 39
 			if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$args->sort_index = 'list_order';
54 54
 		$args->order_type = 'asc';
55 55
 		$args->statusList = array('PUBLIC');
56
-		if(!$args->module_srl) unset($args->module_srl);
56
+		if (!$args->module_srl) unset($args->module_srl);
57 57
 		// Get a list of documents
58 58
 		$oDocumentModel = getModel('document');
59 59
 
@@ -71,22 +71,22 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @return BaseObject output comment list
73 73
 	 */
74
-	function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
74
+	function getComments($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)
75 75
 	{
76 76
 		$args = new stdClass();
77 77
 
78
-		if(is_array($module_srls_list))
78
+		if (is_array($module_srls_list))
79 79
 		{
80
-			if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
80
+			if (count($module_srls_list) > 0) $module_srls = implode(',', $module_srls_list);
81 81
 		}
82 82
 		else
83 83
 		{
84
-			if($module_srls_list)
84
+			if ($module_srls_list)
85 85
 			{
86 86
 				$module_srls = $module_srls_list;
87 87
 			}
88 88
 		}
89
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
89
+		if ($target == 'exclude') $args->exclude_module_srl = $module_srls;
90 90
 		else $args->module_srl = $module_srls;
91 91
 
92 92
 		$args->page = $page;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		// Get a list of documents
100 100
 		$oCommentModel = getModel('comment');
101 101
 		$output = $oCommentModel->getTotalCommentList($args);
102
-		if(!$output->toBool()|| !$output->data) return $output;
102
+		if (!$output->toBool() || !$output->data) return $output;
103 103
 		return $output;
104 104
 	}
105 105
 
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return BaseObject output trackback list
117 117
 	 */
118
-	function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)
118
+	function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page = 1, $list_count = 20)
119 119
 	{
120 120
 		$oTrackbackModel = getAdminModel('trackback');
121
-		if(!$oTrackbackModel) return new BaseObject();
121
+		if (!$oTrackbackModel) return new BaseObject();
122 122
 		$args = new stdClass();
123 123
 
124
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
124
+		if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list);
125 125
 		else $module_srls = $module_srls_list;
126
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
126
+		if ($target == 'exclude') $args->exclude_module_srl = $module_srls;
127 127
 		else $args->module_srl = $module_srls;
128 128
 		$args->page = $page;
129 129
 		$args->list_count = $list_count;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$args->order_type = 'asc';
135 135
 		// Get a list of documents
136 136
 		$output = $oTrackbackModel->getTotalTrackbackList($args);
137
-		if(!$output->toBool()|| !$output->data) return $output;
137
+		if (!$output->toBool() || !$output->data) return $output;
138 138
 		return $output;
139 139
 	}
140 140
 
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 	{
155 155
 		$args = new stdClass();
156 156
 
157
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
157
+		if (is_array($module_srls_list)) $module_srls = implode(',', $module_srls_list);
158 158
 		else $module_srls = $module_srls_list;
159
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
159
+		if ($target == 'exclude') $args->exclude_module_srl = $module_srls;
160 160
 		else $args->module_srl = $module_srls;
161 161
 		$args->page = $page;
162 162
 		$args->list_count = $list_count;
@@ -166,32 +166,32 @@  discard block
 block discarded – undo
166 166
 		$args->sort_index = 'files.file_srl';
167 167
 		$args->order_type = 'desc';
168 168
 		$args->isvalid = 'Y';
169
-		$args->direct_download = $direct_download=='Y'?'Y':'N';
169
+		$args->direct_download = $direct_download == 'Y' ? 'Y' : 'N';
170 170
 		// Get a list of documents
171 171
 		$oFileAdminModel = getAdminModel('file');
172 172
 		$output = $oFileAdminModel->getFileList($args);
173
-		if(!$output->toBool() || !$output->data) return $output;
173
+		if (!$output->toBool() || !$output->data) return $output;
174 174
 
175 175
 		$list = array();
176
-		foreach($output->data as $key => $val)
176
+		foreach ($output->data as $key => $val)
177 177
 		{
178 178
 			$obj = new stdClass;
179 179
 			$obj->filename = $val->source_filename;
180 180
 			$obj->download_count = $val->download_count;
181
-			if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);
181
+			if (substr($val->download_url, 0, 2) == './') $val->download_url = substr($val->download_url, 2);
182 182
 			$obj->download_url = Context::getRequestUri().$val->download_url;
183 183
 			$obj->target_srl = $val->upload_target_srl;
184 184
 			$obj->file_size = $val->file_size;
185 185
 			// Images
186
-			if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename))
186
+			if (preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename))
187 187
 			{
188 188
 				$obj->type = 'image';
189 189
 
190
-				$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3));
191
-				if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
190
+				$thumbnail_path = sprintf('files/thumbnails/%s', getNumberingPath($val->file_srl, 3));
191
+				if (!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
192 192
 				$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop');
193 193
 				$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
194
-				if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
194
+				if (!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
195 195
 				$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120);
196 196
 			}
197 197
 			else
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$oDocumentModel = getModel('document');
209 209
 		$document_list = $oDocumentModel->getDocuments($target_list);
210
-		if($document_list) foreach($document_list as $key => $val)
210
+		if ($document_list) foreach ($document_list as $key => $val)
211 211
 		{
212
-			foreach($output->data as $k => $v)
212
+			foreach ($output->data as $k => $v)
213 213
 			{
214
-				if($v->target_srl== $val->document_srl)
214
+				if ($v->target_srl == $val->document_srl)
215 215
 				{
216 216
 					$output->data[$k]->url = $val->getPermanentUrl();
217 217
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 
223 223
 		$oCommentModel = getModel('comment');
224 224
 		$comment_list = $oCommentModel->getComments($target_list);
225
-		if($comment_list) foreach($comment_list as $key => $val)
225
+		if ($comment_list) foreach ($comment_list as $key => $val)
226 226
 		{
227
-			foreach($output->data as $k => $v)
227
+			foreach ($output->data as $k => $v)
228 228
 			{
229
-				if($v->target_srl== $val->comment_srl)
229
+				if ($v->target_srl == $val->comment_srl)
230 230
 				{
231 231
 					$output->data[$k]->url = $val->getPermanentUrl();
232 232
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @return BaseObject
251 251
 	 */
252
-	function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
252
+	function getImages($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)
253 253
 	{
254 254
 		return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);
255 255
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @return BaseObject
267 267
 	 */
268
-	function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20)
268
+	function getFiles($target, $module_srls_list, $search_keyword, $page = 1, $list_count = 20)
269 269
 	{
270 270
 		return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');
271 271
 	}
Please login to merge, or discard this patch.
Braces   +67 added lines, -29 removed lines patch added patch discarded remove patch
@@ -30,16 +30,19 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20)
32 32
 	{
33
-		if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
33
+		if(is_array($module_srls_list)) {
34
+			$module_srls_list = implode(',',$module_srls_list);
35
+		}
34 36
 
35 37
 		$args = new stdClass();
36 38
 		if($target == 'exclude')
37 39
 		{
38 40
 			$module_srls_list .= ',0'; // exclude 'trash'
39
-			if ($module_srls_list{0} == ',') $module_srls_list = substr($module_srls_list, 1);
41
+			if ($module_srls_list{0} == ',') {
42
+				$module_srls_list = substr($module_srls_list, 1);
43
+			}
40 44
 			$args->exclude_module_srl = $module_srls_list;
41
-		}
42
-		else
45
+		} else
43 46
 		{
44 47
 			$args->module_srl = $module_srls_list;
45 48
 			$args->exclude_module_srl = '0'; // exclude 'trash'
@@ -53,7 +56,9 @@  discard block
 block discarded – undo
53 56
 		$args->sort_index = 'list_order';
54 57
 		$args->order_type = 'asc';
55 58
 		$args->statusList = array('PUBLIC');
56
-		if(!$args->module_srl) unset($args->module_srl);
59
+		if(!$args->module_srl) {
60
+			unset($args->module_srl);
61
+		}
57 62
 		// Get a list of documents
58 63
 		$oDocumentModel = getModel('document');
59 64
 
@@ -77,17 +82,21 @@  discard block
 block discarded – undo
77 82
 
78 83
 		if(is_array($module_srls_list))
79 84
 		{
80
-			if (count($module_srls_list) > 0) $module_srls = implode(',',$module_srls_list);
81
-		}
82
-		else
85
+			if (count($module_srls_list) > 0) {
86
+				$module_srls = implode(',',$module_srls_list);
87
+			}
88
+		} else
83 89
 		{
84 90
 			if($module_srls_list)
85 91
 			{
86 92
 				$module_srls = $module_srls_list;
87 93
 			}
88 94
 		}
89
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
90
-		else $args->module_srl = $module_srls;
95
+		if($target == 'exclude') {
96
+			$args->exclude_module_srl = $module_srls;
97
+		} else {
98
+			$args->module_srl = $module_srls;
99
+		}
91 100
 
92 101
 		$args->page = $page;
93 102
 		$args->list_count = $list_count;
@@ -99,7 +108,9 @@  discard block
 block discarded – undo
99 108
 		// Get a list of documents
100 109
 		$oCommentModel = getModel('comment');
101 110
 		$output = $oCommentModel->getTotalCommentList($args);
102
-		if(!$output->toBool()|| !$output->data) return $output;
111
+		if(!$output->toBool()|| !$output->data) {
112
+			return $output;
113
+		}
103 114
 		return $output;
104 115
 	}
105 116
 
@@ -118,13 +129,21 @@  discard block
 block discarded – undo
118 129
 	function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20)
119 130
 	{
120 131
 		$oTrackbackModel = getAdminModel('trackback');
121
-		if(!$oTrackbackModel) return new BaseObject();
132
+		if(!$oTrackbackModel) {
133
+			return new BaseObject();
134
+		}
122 135
 		$args = new stdClass();
123 136
 
124
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
125
-		else $module_srls = $module_srls_list;
126
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
127
-		else $args->module_srl = $module_srls;
137
+		if(is_array($module_srls_list)) {
138
+			$module_srls = implode(',',$module_srls_list);
139
+		} else {
140
+			$module_srls = $module_srls_list;
141
+		}
142
+		if($target == 'exclude') {
143
+			$args->exclude_module_srl = $module_srls;
144
+		} else {
145
+			$args->module_srl = $module_srls;
146
+		}
128 147
 		$args->page = $page;
129 148
 		$args->list_count = $list_count;
130 149
 		$args->page_count = 10;
@@ -134,7 +153,9 @@  discard block
 block discarded – undo
134 153
 		$args->order_type = 'asc';
135 154
 		// Get a list of documents
136 155
 		$output = $oTrackbackModel->getTotalTrackbackList($args);
137
-		if(!$output->toBool()|| !$output->data) return $output;
156
+		if(!$output->toBool()|| !$output->data) {
157
+			return $output;
158
+		}
138 159
 		return $output;
139 160
 	}
140 161
 
@@ -154,10 +175,16 @@  discard block
 block discarded – undo
154 175
 	{
155 176
 		$args = new stdClass();
156 177
 
157
-		if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
158
-		else $module_srls = $module_srls_list;
159
-		if($target == 'exclude') $args->exclude_module_srl = $module_srls;
160
-		else $args->module_srl = $module_srls;
178
+		if(is_array($module_srls_list)) {
179
+			$module_srls = implode(',',$module_srls_list);
180
+		} else {
181
+			$module_srls = $module_srls_list;
182
+		}
183
+		if($target == 'exclude') {
184
+			$args->exclude_module_srl = $module_srls;
185
+		} else {
186
+			$args->module_srl = $module_srls;
187
+		}
161 188
 		$args->page = $page;
162 189
 		$args->list_count = $list_count;
163 190
 		$args->page_count = 10;
@@ -170,7 +197,9 @@  discard block
 block discarded – undo
170 197
 		// Get a list of documents
171 198
 		$oFileAdminModel = getAdminModel('file');
172 199
 		$output = $oFileAdminModel->getFileList($args);
173
-		if(!$output->toBool() || !$output->data) return $output;
200
+		if(!$output->toBool() || !$output->data) {
201
+			return $output;
202
+		}
174 203
 
175 204
 		$list = array();
176 205
 		foreach($output->data as $key => $val)
@@ -178,7 +207,9 @@  discard block
 block discarded – undo
178 207
 			$obj = new stdClass;
179 208
 			$obj->filename = $val->source_filename;
180 209
 			$obj->download_count = $val->download_count;
181
-			if(substr($val->download_url,0,2)=='./') $val->download_url = substr($val->download_url,2);
210
+			if(substr($val->download_url,0,2)=='./') {
211
+				$val->download_url = substr($val->download_url,2);
212
+			}
182 213
 			$obj->download_url = Context::getRequestUri().$val->download_url;
183 214
 			$obj->target_srl = $val->upload_target_srl;
184 215
 			$obj->file_size = $val->file_size;
@@ -188,13 +219,16 @@  discard block
 block discarded – undo
188 219
 				$obj->type = 'image';
189 220
 
190 221
 				$thumbnail_path = sprintf('files/thumbnails/%s',getNumberingPath($val->file_srl, 3));
191
-				if(!is_dir($thumbnail_path)) FileHandler::makeDir($thumbnail_path);
222
+				if(!is_dir($thumbnail_path)) {
223
+					FileHandler::makeDir($thumbnail_path);
224
+				}
192 225
 				$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, 120, 120, 'crop');
193 226
 				$thumbnail_url  = Context::getRequestUri().$thumbnail_file;
194
-				if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
227
+				if(!file_exists($thumbnail_file)) {
228
+					FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
229
+				}
195 230
 				$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), 120, 120);
196
-			}
197
-			else
231
+			} else
198 232
 			{
199 233
 				$obj->type = 'binary';
200 234
 				$obj->src = '';
@@ -207,13 +241,15 @@  discard block
 block discarded – undo
207 241
 
208 242
 		$oDocumentModel = getModel('document');
209 243
 		$document_list = $oDocumentModel->getDocuments($target_list);
210
-		if($document_list) foreach($document_list as $key => $val)
244
+		if($document_list) {
245
+			foreach($document_list as $key => $val)
211 246
 		{
212 247
 			foreach($output->data as $k => $v)
213 248
 			{
214 249
 				if($v->target_srl== $val->document_srl)
215 250
 				{
216 251
 					$output->data[$k]->url = $val->getPermanentUrl();
252
+		}
217 253
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
218 254
 					$output->data[$k]->nick_name = $val->getNickName();
219 255
 				}
@@ -222,13 +258,15 @@  discard block
 block discarded – undo
222 258
 
223 259
 		$oCommentModel = getModel('comment');
224 260
 		$comment_list = $oCommentModel->getComments($target_list);
225
-		if($comment_list) foreach($comment_list as $key => $val)
261
+		if($comment_list) {
262
+			foreach($comment_list as $key => $val)
226 263
 		{
227 264
 			foreach($output->data as $k => $v)
228 265
 			{
229 266
 				if($v->target_srl== $val->comment_srl)
230 267
 				{
231 268
 					$output->data[$k]->url = $val->getPermanentUrl();
269
+		}
232 270
 					$output->data[$k]->regdate = $val->getRegdate("Y-m-d H:i");
233 271
 					$output->data[$k]->nick_name = $val->getNickName();
234 272
 				}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.lib.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
 			$this->download_file = $this->temp_dir . "xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124
-		}
125
-		else
124
+		} else
126 125
 		{
127 126
 			$subpath = trim(substr($this->package->path, 2), '/');
128 127
 			$this->download_file = $this->temp_dir . $subpath . ".tar";
@@ -297,8 +296,7 @@  discard block
 block discarded – undo
297 296
 				{
298 297
 					return $output;
299 298
 				}
300
-			}
301
-			else
299
+			} else
302 300
 			{
303 301
 				$output = $this->_removeFile($file_path);
304 302
 				if(!$output->toBool())
@@ -370,8 +368,7 @@  discard block
 block discarded – undo
370 368
 		if($this->ftp_info->ftp_host)
371 369
 		{
372 370
 			$ftp_host = $this->ftp_info->ftp_host;
373
-		}
374
-		else
371
+		} else
375 372
 		{
376 373
 			$ftp_host = "127.0.0.1";
377 374
 		}
@@ -523,8 +520,7 @@  discard block
 block discarded – undo
523 520
 		if($this->ftp_info->ftp_host)
524 521
 		{
525 522
 			$ftp_host = $this->ftp_info->ftp_host;
526
-		}
527
-		else
523
+		} else
528 524
 		{
529 525
 			$ftp_host = "127.0.0.1";
530 526
 		}
@@ -673,8 +669,7 @@  discard block
 block discarded – undo
673 669
 								{
674 670
 									return new BaseObject(-1, "msg_permission_adjust_failed");
675 671
 								}
676
-							}
677
-							else
672
+							} else
678 673
 							{
679 674
 								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
680 675
 								{
@@ -736,8 +731,7 @@  discard block
 block discarded – undo
736 731
 		if($this->ftp_info->ftp_host)
737 732
 		{
738 733
 			$ftp_host = $this->ftp_info->ftp_host;
739
-		}
740
-		else
734
+		} else
741 735
 		{
742 736
 			$ftp_host = "127.0.0.1";
743 737
 		}
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'libs/ftp.class.php');
4
+require_once(_XE_PATH_.'libs/ftp.class.php');
5 5
 
6 6
 /**
7 7
  * Module installer
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$oModel = getModel('autoinstall');
80 80
 		$type = $oModel->getTypeFromPath($this->package->path);
81
-		if($type == "module")
81
+		if ($type == "module")
82 82
 		{
83 83
 			$output = $this->uninstallModule();
84
-			if(!$output->toBool())
84
+			if (!$output->toBool())
85 85
 			{
86 86
 				return $output;
87 87
 			}
88 88
 		}
89 89
 
90 90
 		$output = $this->_connect();
91
-		if(!$output->toBool())
91
+		if (!$output->toBool())
92 92
 		{
93 93
 			return $output;
94 94
 		}
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function _download()
118 118
 	{
119
-		if($this->package->path == ".")
119
+		if ($this->package->path == ".")
120 120
 		{
121
-			$this->download_file = $this->temp_dir . "xe.tar";
121
+			$this->download_file = $this->temp_dir."xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124 124
 		}
125 125
 		else
126 126
 		{
127 127
 			$subpath = trim(substr($this->package->path, 2), '/');
128
-			$this->download_file = $this->temp_dir . $subpath . ".tar";
128
+			$this->download_file = $this->temp_dir.$subpath.".tar";
129 129
 			$subpatharr = explode("/", $subpath);
130 130
 			array_pop($subpatharr);
131
-			$this->download_path = $this->temp_dir . implode("/", $subpatharr);
131
+			$this->download_path = $this->temp_dir.implode("/", $subpatharr);
132 132
 			$this->target_path = implode("/", $subpatharr);
133 133
 		}
134 134
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$path_array = explode("/", $this->package->path);
153 153
 		$target_name = array_pop($path_array);
154 154
 		$oModule = getModule($target_name, "class");
155
-		if(!$oModule)
155
+		if (!$oModule)
156 156
 		{
157 157
 			return new BaseObject(-1, 'msg_invalid_request');
158 158
 		}
159
-		if(!method_exists($oModule, "moduleUninstall"))
159
+		if (!method_exists($oModule, "moduleUninstall"))
160 160
 		{
161 161
 			return new BaseObject(-1, 'msg_invalid_request');
162 162
 		}
163 163
 
164 164
 		$output = $oModule->moduleUninstall();
165
-		if(is_subclass_of($output, 'BaseObject') && !$output->toBool())
165
+		if (is_subclass_of($output, 'BaseObject') && !$output->toBool())
166 166
 		{
167 167
 			return $output;
168 168
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		$schema_dir = sprintf('%s/schemas/', $this->package->path);
171 171
 		$schema_files = FileHandler::readDir($schema_dir);
172 172
 		$oDB = DB::getInstance();
173
-		if(is_array($schema_files))
173
+		if (is_array($schema_files))
174 174
 		{
175
-			foreach($schema_files as $file)
175
+			foreach ($schema_files as $file)
176 176
 			{
177 177
 				$filename_arr = explode(".", $file);
178 178
 				$filename = array_shift($filename_arr);
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 	function installModule()
193 193
 	{
194 194
 		$path = $this->package->path;
195
-		if($path != ".")
195
+		if ($path != ".")
196 196
 		{
197 197
 			$path_array = explode("/", $path);
198 198
 			$target_name = array_pop($path_array);
199 199
 			$type = substr(array_pop($path_array), 0, -1);
200 200
 		}
201 201
 
202
-		if($type == "module")
202
+		if ($type == "module")
203 203
 		{
204 204
 			$oModuleModel = getModel('module');
205 205
 			$oInstallController = getController('install');
206 206
 			$module_path = ModuleHandler::getModulePath($target_name);
207
-			if($oModuleModel->checkNeedInstall($target_name))
207
+			if ($oModuleModel->checkNeedInstall($target_name))
208 208
 			{
209 209
 				$oInstallController->installModule($target_name, $module_path);
210 210
 			}
211
-			if($oModuleModel->checkNeedUpdate($target_name))
211
+			if ($oModuleModel->checkNeedUpdate($target_name))
212 212
 			{
213 213
 				$oModule = getModule($target_name, 'class');
214
-				if(method_exists($oModule, 'moduleUpdate'))
214
+				if (method_exists($oModule, 'moduleUpdate'))
215 215
 				{
216 216
 					$oModule->moduleUpdate();
217 217
 				}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$this->_download();
232 232
 		$file_list = $this->_unPack();
233 233
 		$output = $this->_copyDir($file_list);
234
-		if(!$output->toBool())
234
+		if (!$output->toBool())
235 235
 		{
236 236
 			FileHandler::removeDir($this->temp_dir);
237 237
 			return $output;
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	function _unPack()
251 251
 	{
252
-		require_once(_XE_PATH_ . 'libs/tar.class.php');
252
+		require_once(_XE_PATH_.'libs/tar.class.php');
253 253
 
254 254
 		$oTar = new tar();
255 255
 		$oTar->openTAR($this->download_file);
256 256
 
257 257
 		$_files = $oTar->files;
258 258
 		$file_list = array();
259
-		if(is_array($_files))
259
+		if (is_array($_files))
260 260
 		{
261
-			foreach($_files as $key => $info)
261
+			foreach ($_files as $key => $info)
262 262
 			{
263
-				FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
263
+				FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
264 264
 				$file_list[] = $info['name'];
265 265
 			}
266 266
 		}
@@ -278,22 +278,22 @@  discard block
 block discarded – undo
278 278
 		$real_path = FileHandler::getRealPath($path);
279 279
 		$oDir = dir($path);
280 280
 		$files = array();
281
-		while($file = $oDir->read())
281
+		while ($file = $oDir->read())
282 282
 		{
283
-			if($file == "." || $file == "..")
283
+			if ($file == "." || $file == "..")
284 284
 			{
285 285
 				continue;
286 286
 			}
287 287
 			$files[] = $file;
288 288
 		}
289 289
 
290
-		foreach($files as $file)
290
+		foreach ($files as $file)
291 291
 		{
292
-			$file_path = $path . "/" . $file;
293
-			if(is_dir(FileHandler::getRealPath($file_path)))
292
+			$file_path = $path."/".$file;
293
+			if (is_dir(FileHandler::getRealPath($file_path)))
294 294
 			{
295 295
 				$output = $this->_removeDir($file_path);
296
-				if(!$output->toBool())
296
+				if (!$output->toBool())
297 297
 				{
298 298
 					return $output;
299 299
 				}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			else
302 302
 			{
303 303
 				$output = $this->_removeFile($file_path);
304
-				if(!$output->toBool())
304
+				if (!$output->toBool())
305 305
 				{
306 306
 					return $output;
307 307
 				}
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function _connect()
359 359
 	{
360
-		if(!function_exists('ssh2_connect'))
360
+		if (!function_exists('ssh2_connect'))
361 361
 		{
362 362
 			return new BaseObject(-1, 'msg_sftp_not_supported');
363 363
 		}
364 364
 
365
-		if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
365
+		if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
366 366
 		{
367 367
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
368 368
 		}
369 369
 
370
-		if($this->ftp_info->ftp_host)
370
+		if ($this->ftp_info->ftp_host)
371 371
 		{
372 372
 			$ftp_host = $this->ftp_info->ftp_host;
373 373
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$ftp_host = "127.0.0.1";
377 377
 		}
378 378
 		$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
379
-		if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
379
+		if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
380 380
 		{
381 381
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
382 382
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function _removeFile($path)
405 405
 	{
406
-		if(substr($path, 0, 2) == "./")
406
+		if (substr($path, 0, 2) == "./")
407 407
 		{
408 408
 			$path = substr($path, 2);
409 409
 		}
410
-		$target_path = $this->ftp_info->ftp_root_path . $path;
410
+		$target_path = $this->ftp_info->ftp_root_path.$path;
411 411
 
412
-		if(!@ssh2_sftp_unlink($this->sftp, $target_path))
412
+		if (!@ssh2_sftp_unlink($this->sftp, $target_path))
413 413
 		{
414 414
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
415 415
 		}
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	function _removeDir_real($path)
426 426
 	{
427
-		if(substr($path, 0, 2) == "./")
427
+		if (substr($path, 0, 2) == "./")
428 428
 		{
429 429
 			$path = substr($path, 2);
430 430
 		}
431
-		$target_path = $this->ftp_info->ftp_root_path . $path;
431
+		$target_path = $this->ftp_info->ftp_root_path.$path;
432 432
 
433
-		if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
433
+		if (!@ssh2_sftp_rmdir($this->sftp, $target_path))
434 434
 		{
435 435
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
436 436
 		}
@@ -445,37 +445,37 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	function _copyDir(&$file_list)
447 447
 	{
448
-		if(!$this->ftp_password)
448
+		if (!$this->ftp_password)
449 449
 		{
450 450
 			return new BaseObject(-1, 'msg_ftp_password_input');
451 451
 		}
452 452
 
453 453
 		$output = $this->_connect();
454
-		if(!$output->toBool())
454
+		if (!$output->toBool())
455 455
 		{
456 456
 			return $output;
457 457
 		}
458
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
458
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
459 459
 		$copied = array();
460 460
 
461
-		if(is_array($file_list))
461
+		if (is_array($file_list))
462 462
 		{
463
-			foreach($file_list as $k => $file)
463
+			foreach ($file_list as $k => $file)
464 464
 			{
465 465
 				$org_file = $file;
466
-				if($this->package->path == ".")
466
+				if ($this->package->path == ".")
467 467
 				{
468 468
 					$file = substr($file, 3);
469 469
 				}
470
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
471
-				$pathname = dirname($target_dir . "/" . $file);
470
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
471
+				$pathname = dirname($target_dir."/".$file);
472 472
 
473
-				if(!file_exists(FileHandler::getRealPath($real_path)))
473
+				if (!file_exists(FileHandler::getRealPath($real_path)))
474 474
 				{
475 475
 					ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
476 476
 				}
477 477
 
478
-				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
478
+				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
479 479
 				$copied[] = $path;
480 480
 			}
481 481
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	function _connect()
528 528
 	{
529
-		if($this->ftp_info->ftp_host)
529
+		if ($this->ftp_info->ftp_host)
530 530
 		{
531 531
 			$ftp_host = $this->ftp_info->ftp_host;
532 532
 		}
@@ -536,20 +536,20 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
539
-		if(!$this->connection)
539
+		if (!$this->connection)
540 540
 		{
541 541
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
542 542
 		}
543 543
 
544 544
 		$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
545
-		if(!$login_result)
545
+		if (!$login_result)
546 546
 		{
547 547
 			$this->_close();
548 548
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
549 549
 		}
550 550
 
551 551
 		$_SESSION['ftp_password'] = $this->ftp_password;
552
-		if($this->ftp_info->ftp_pasv != "N")
552
+		if ($this->ftp_info->ftp_pasv != "N")
553 553
 		{
554 554
 			ftp_pasv($this->connection, TRUE);
555 555
 		}
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	function _removeFile($path)
566 566
 	{
567
-		if(substr($path, 0, 2) == "./")
567
+		if (substr($path, 0, 2) == "./")
568 568
 		{
569 569
 			$path = substr($path, 2);
570 570
 		}
571
-		$target_path = $this->ftp_info->ftp_root_path . $path;
571
+		$target_path = $this->ftp_info->ftp_root_path.$path;
572 572
 
573
-		if(!@ftp_delete($this->connection, $target_path))
573
+		if (!@ftp_delete($this->connection, $target_path))
574 574
 		{
575
-			return new BaseObject(-1, "failed to delete file " . $path);
575
+			return new BaseObject(-1, "failed to delete file ".$path);
576 576
 		}
577 577
 		return new BaseObject();
578 578
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	function _removeDir_real($path)
587 587
 	{
588
-		if(substr($path, 0, 2) == "./")
588
+		if (substr($path, 0, 2) == "./")
589 589
 		{
590 590
 			$path = substr($path, 2);
591 591
 		}
592
-		$target_path = $this->ftp_info->ftp_root_path . $path;
592
+		$target_path = $this->ftp_info->ftp_root_path.$path;
593 593
 
594
-		if(!@ftp_rmdir($this->connection, $target_path))
594
+		if (!@ftp_rmdir($this->connection, $target_path))
595 595
 		{
596
-			return new BaseObject(-1, "failed to delete directory " . $path);
596
+			return new BaseObject(-1, "failed to delete directory ".$path);
597 597
 		}
598 598
 		return new BaseObject();
599 599
 	}
@@ -616,74 +616,74 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	function _copyDir(&$file_list)
618 618
 	{
619
-		if(!$this->ftp_password)
619
+		if (!$this->ftp_password)
620 620
 		{
621 621
 			return new BaseObject(-1, 'msg_ftp_password_input');
622 622
 		}
623 623
 
624 624
 		$output = $this->_connect();
625
-		if(!$output->toBool())
625
+		if (!$output->toBool())
626 626
 		{
627 627
 			return $output;
628 628
 		}
629 629
 
630
-		if(!$this->target_path)
630
+		if (!$this->target_path)
631 631
 		{
632 632
 			$this->target_path = '.';
633 633
 		}
634
-		if(substr($this->download_path, -1) == '/')
634
+		if (substr($this->download_path, -1) == '/')
635 635
 		{
636 636
 			$this->download_path = substr($this->download_path, 0, -1);
637 637
 		}
638
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
638
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
639 639
 		$copied = array();
640 640
 
641
-		if(is_array($file_list))
641
+		if (is_array($file_list))
642 642
 		{
643
-			foreach($file_list as $k => $file)
643
+			foreach ($file_list as $k => $file)
644 644
 			{
645
-				if(!$file)
645
+				if (!$file)
646 646
 				{
647 647
 					continue;
648 648
 				}
649 649
 				$org_file = $file;
650
-				if($this->package->path == ".")
650
+				if ($this->package->path == ".")
651 651
 				{
652 652
 					$file = substr($file, 3);
653 653
 				}
654
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
655
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
654
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
655
+				$path_list = explode('/', dirname($this->target_path."/".$file));
656 656
 
657 657
 				$real_path = "./";
658 658
 				$ftp_path = $this->ftp_info->ftp_root_path;
659 659
 
660
-				for($i = 0; $i < count($path_list); $i++)
660
+				for ($i = 0; $i < count($path_list); $i++)
661 661
 				{
662
-					if($path_list == "")
662
+					if ($path_list == "")
663 663
 					{
664 664
 						continue;
665 665
 					}
666
-					$real_path .= $path_list[$i] . "/";
667
-					$ftp_path .= $path_list[$i] . "/";
668
-					if(!file_exists(FileHandler::getRealPath($real_path)))
666
+					$real_path .= $path_list[$i]."/";
667
+					$ftp_path .= $path_list[$i]."/";
668
+					if (!file_exists(FileHandler::getRealPath($real_path)))
669 669
 					{
670
-						if(!@ftp_mkdir($this->connection, $ftp_path))
670
+						if (!@ftp_mkdir($this->connection, $ftp_path))
671 671
 						{
672 672
 							return new BaseObject(-1, "msg_make_directory_failed");
673 673
 						}
674 674
 
675
-						if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
675
+						if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
676 676
 						{
677
-							if(function_exists('ftp_chmod'))
677
+							if (function_exists('ftp_chmod'))
678 678
 							{
679
-								if(!ftp_chmod($this->connection, 0755, $ftp_path))
679
+								if (!ftp_chmod($this->connection, 0755, $ftp_path))
680 680
 								{
681 681
 									return new BaseObject(-1, "msg_permission_adjust_failed");
682 682
 								}
683 683
 							}
684 684
 							else
685 685
 							{
686
-								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
686
+								if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
687 687
 								{
688 688
 									return new BaseObject(-1, "msg_permission_adjust_failed");
689 689
 								}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 						}
692 692
 					}
693 693
 				}
694
-				if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
694
+				if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
695 695
 				{
696 696
 					return new BaseObject(-1, "msg_ftp_upload_failed");
697 697
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	function _connect()
747 747
 	{
748
-		if($this->ftp_info->ftp_host)
748
+		if ($this->ftp_info->ftp_host)
749 749
 		{
750 750
 			$ftp_host = $this->ftp_info->ftp_host;
751 751
 		}
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 
757 757
 		$this->oFtp = new ftp();
758
-		if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
758
+		if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
759 759
 		{
760 760
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
761 761
 		}
762
-		if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
762
+		if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
763 763
 		{
764 764
 			$this->_close();
765 765
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
@@ -776,13 +776,13 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	function _removeFile($path)
778 778
 	{
779
-		if(substr($path, 0, 2) == "./")
779
+		if (substr($path, 0, 2) == "./")
780 780
 		{
781 781
 			$path = substr($path, 2);
782 782
 		}
783
-		$target_path = $this->ftp_info->ftp_root_path . $path;
783
+		$target_path = $this->ftp_info->ftp_root_path.$path;
784 784
 
785
-		if(!$this->oFtp->ftp_delete($target_path))
785
+		if (!$this->oFtp->ftp_delete($target_path))
786 786
 		{
787 787
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
788 788
 		}
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	function _removeDir_real($path)
798 798
 	{
799
-		if(substr($path, 0, 2) == "./")
799
+		if (substr($path, 0, 2) == "./")
800 800
 		{
801 801
 			$path = substr($path, 2);
802 802
 		}
803
-		$target_path = $this->ftp_info->ftp_root_path . $path;
803
+		$target_path = $this->ftp_info->ftp_root_path.$path;
804 804
 
805
-		if(!$this->oFtp->ftp_rmdir($target_path))
805
+		if (!$this->oFtp->ftp_rmdir($target_path))
806 806
 		{
807 807
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
808 808
 		}
@@ -827,52 +827,52 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	function _copyDir(&$file_list)
829 829
 	{
830
-		if(!$this->ftp_password)
830
+		if (!$this->ftp_password)
831 831
 		{
832 832
 			return new BaseObject(-1, 'msg_ftp_password_input');
833 833
 		}
834 834
 
835 835
 		$output = $this->_connect();
836
-		if(!$output->toBool())
836
+		if (!$output->toBool())
837 837
 		{
838 838
 			return $output;
839 839
 		}
840 840
 
841 841
 		$oFtp = &$this->oFtp;
842
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
842
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
843 843
 
844 844
 		$copied = array();
845 845
 
846
-		if(is_array($file_list))
846
+		if (is_array($file_list))
847 847
 		{
848
-			foreach($file_list as $k => $file)
848
+			foreach ($file_list as $k => $file)
849 849
 			{
850 850
 				$org_file = $file;
851
-				if($this->package->path == ".")
851
+				if ($this->package->path == ".")
852 852
 				{
853 853
 					$file = substr($file, 3);
854 854
 				}
855
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
856
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
855
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
856
+				$path_list = explode('/', dirname($this->target_path."/".$file));
857 857
 
858 858
 				$real_path = "./";
859 859
 				$ftp_path = $this->ftp_info->ftp_root_path;
860 860
 
861
-				for($i = 0; $i < count($path_list); $i++)
861
+				for ($i = 0; $i < count($path_list); $i++)
862 862
 				{
863
-					if($path_list == "")
863
+					if ($path_list == "")
864 864
 					{
865 865
 						continue;
866 866
 					}
867
-					$real_path .= $path_list[$i] . "/";
868
-					$ftp_path .= $path_list[$i] . "/";
869
-					if(!file_exists(FileHandler::getRealPath($real_path)))
867
+					$real_path .= $path_list[$i]."/";
868
+					$ftp_path .= $path_list[$i]."/";
869
+					if (!file_exists(FileHandler::getRealPath($real_path)))
870 870
 					{
871 871
 						$oFtp->ftp_mkdir($ftp_path);
872
-						$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
872
+						$oFtp->ftp_site("CHMOD 755 ".$ftp_path);
873 873
 					}
874 874
 				}
875
-				$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
875
+				$oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file));
876 876
 				$copied[] = $path;
877 877
 			}
878 878
 		}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	function _removeFile($path)
923 923
 	{
924
-		if(substr($path, 0, 2) == "./")
924
+		if (substr($path, 0, 2) == "./")
925 925
 		{
926 926
 			$path = substr($path, 2);
927 927
 		}
928 928
 		$target_path = FileHandler::getRealPath($path);
929 929
 
930
-		if(!FileHandler::removeFile($target_path))
930
+		if (!FileHandler::removeFile($target_path))
931 931
 		{
932 932
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
933 933
 		}
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	function _removeDir_real($path)
943 943
 	{
944
-		if(substr($path, 0, 2) == "./")
944
+		if (substr($path, 0, 2) == "./")
945 945
 		{
946 946
 			$path = substr($path, 2);
947 947
 		}
@@ -970,39 +970,39 @@  discard block
 block discarded – undo
970 970
 	function _copyDir(&$file_list)
971 971
 	{
972 972
 		$output = $this->_connect();
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			return $output;
976 976
 		}
977 977
 		$target_dir = $this->target_path;
978 978
 		$copied = array();
979 979
 
980
-		if(is_array($file_list))
980
+		if (is_array($file_list))
981 981
 		{
982
-			foreach($file_list as $k => $file)
982
+			foreach ($file_list as $k => $file)
983 983
 			{
984 984
 				$org_file = $file;
985
-				if($this->package->path == ".")
985
+				if ($this->package->path == ".")
986 986
 				{
987 987
 					$file = substr($file, 3);
988 988
 				}
989
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
990
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
989
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
990
+				$path_list = explode('/', dirname($this->target_path."/".$file));
991 991
 				$real_path = "./";
992 992
 
993
-				for($i = 0; $i < count($path_list); $i++)
993
+				for ($i = 0; $i < count($path_list); $i++)
994 994
 				{
995
-					if($path_list == "")
995
+					if ($path_list == "")
996 996
 					{
997 997
 						continue;
998 998
 					}
999
-					$real_path .= $path_list[$i] . "/";
1000
-					if(!file_exists(FileHandler::getRealPath($real_path)))
999
+					$real_path .= $path_list[$i]."/";
1000
+					if (!file_exists(FileHandler::getRealPath($real_path)))
1001 1001
 					{
1002 1002
 						FileHandler::makeDir($real_path);
1003 1003
 					}
1004 1004
 				}
1005
-				FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
1005
+				FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file));
1006 1006
 				$copied[] = $path;
1007 1007
 			}
1008 1008
 		}
Please login to merge, or discard this patch.
modules/page/page.admin.controller.php 2 patches
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -25,24 +25,24 @@  discard block
 block discarded – undo
25 25
 		// Set board module
26 26
 		$args = Context::getRequestVars();
27 27
 		$args->module = 'page';
28
-		$args->mid = $args->page_name;	//because if mid is empty in context, set start page mid
28
+		$args->mid = $args->page_name; //because if mid is empty in context, set start page mid
29 29
 		$args->path = (!$args->path) ? '' : $args->path;
30 30
 		$args->mpath = (!$args->mpath) ? '' : $args->mpath;
31 31
 		unset($args->page_name);
32 32
 
33
-		if($args->use_mobile != 'Y') $args->use_mobile = '';
33
+		if ($args->use_mobile != 'Y') $args->use_mobile = '';
34 34
 		// Check if an original module exists by using module_srl
35
-		if($args->module_srl)
35
+		if ($args->module_srl)
36 36
 		{
37 37
 			$columnList = array('module_srl');
38 38
 			$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl, $columnList);
39
-			if($module_info->module_srl != $args->module_srl)
39
+			if ($module_info->module_srl != $args->module_srl)
40 40
 			{
41 41
 				unset($args->module_srl);
42 42
 			}
43 43
 			else
44 44
 			{
45
-				foreach($args as $key=>$val)
45
+				foreach ($args as $key=>$val)
46 46
 				{
47 47
 					$module_info->{$key} = $val;
48 48
 				}
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 				}
76 76
 		}
77 77
 		// Insert/update depending on module_srl
78
-		if(!$args->module_srl)
78
+		if (!$args->module_srl)
79 79
 		{
80 80
 			$output = $oModuleController->insertModule($args);
81 81
 			$msg_code = 'success_registed';
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 			$msg_code = 'success_updated';
87 87
 		}
88 88
 
89
-		if(!$output->toBool()) return $output;
89
+		if (!$output->toBool()) return $output;
90 90
 
91 91
 		$this->add("page", Context::get('page'));
92
-		$this->add('module_srl',$output->get('module_srl'));
92
+		$this->add('module_srl', $output->get('module_srl'));
93 93
 		$this->setMessage($msg_code);
94 94
 
95 95
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'module_srl', $output->get('module_srl'), 'act', 'dispPageAdminInfo');
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
 
107 107
 	function putDocumentsInPageToArray($target, &$array)
108 108
 	{
109
-		if(!$target) return;
109
+		if (!$target) return;
110 110
 		preg_match_all('!<img hasContent="true" ([^>]+)!is', $target, $matches);
111 111
 		$pattern = '!document_srl="(\d+)"!';
112
-		foreach($matches[1] as $match)
112
+		foreach ($matches[1] as $match)
113 113
 		{
114 114
 			$match2 = null;
115 115
 			preg_match($pattern, $match, $match2);
116
-			if(count($match2))
116
+			if (count($match2))
117 117
 			{
118
-				$array[(int)$match2[1]] = 1;
118
+				$array[(int) $match2[1]] = 1;
119 119
 			}
120 120
 		}
121 121
 	}
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
 	{
128 128
 		$module_srl = Context::get('module_srl');
129 129
 		$content = Context::get('content');
130
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
130
+		if (!$module_srl) return new BaseObject(-1, 'msg_invalid_request');
131 131
 		$mcontent = Context::get('mcontent');
132 132
 		$type = Context::get('type');
133 133
 		// Guhaeom won information page
134 134
 		$oModuleModel = getModel('module');
135 135
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
136
-		if($type == "mobile")
136
+		if ($type == "mobile")
137 137
 		{
138
-			if(!$mcontent) $mcontent = '';
138
+			if (!$mcontent) $mcontent = '';
139 139
 			$module_info->mcontent = $mcontent;
140 140
 		}
141 141
 		else
142 142
 		{
143
-			if(!isset($content)) $content ='';
143
+			if (!isset($content)) $content = '';
144 144
 			$module_info->content = $content;
145 145
 		}
146 146
 
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 		$obj->module_srl = $module_srl;
155 155
 		$obj->list_count = 99999999;
156 156
 		$output = $oDocumentModel->getDocumentList($obj);
157
-		if(count($output->data))
157
+		if (count($output->data))
158 158
 		{
159
-			foreach($output->data as $document)
159
+			foreach ($output->data as $document)
160 160
 			{
161
-				if($document_srls[$document->document_srl]) continue;
161
+				if ($document_srls[$document->document_srl]) continue;
162 162
 				$oDocumentController->deleteDocument($document->document_srl, true);
163 163
 			}
164 164
 		}
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		$oModuleController = getController('module');
167 167
 		// Save
168 168
 		$output = $oModuleController->updateModule($module_info);
169
-		if(!$output->toBool()) return $output;
169
+		if (!$output->toBool()) return $output;
170 170
 		// On the page, change the validity status of the attached file
171 171
 		$oFileController = getController('file');
172 172
 		$oFileController->setFilesValid($module_info->module_srl);
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 		// Get an original
190 190
 		$oModuleController = getController('module');
191 191
 		$output = $oModuleController->deleteModule($module_srl);
192
-		if(!$output->toBool()) return $output;
192
+		if (!$output->toBool()) return $output;
193 193
 
194
-		$this->add('module','page');
195
-		$this->add('page',Context::get('page'));
194
+		$this->add('module', 'page');
195
+		$this->add('page', Context::get('page'));
196 196
 		$this->setMessage('success_deleted');
197 197
 
198 198
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPageAdminContent');
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$args = Context::getRequestVars();
209 209
 		// Insert by creating the module Controller object
210 210
 		$oModuleController = getController('module');
211
-		$output = $oModuleController->insertModuleConfig('page',$args);
211
+		$output = $oModuleController->insertModuleConfig('page', $args);
212 212
 		return $output;
213 213
 	}
214 214
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		$file_srl = Context::get('file_srl');
240 240
 		// Create the controller object file class
241 241
 		$oFileController = getController('file');
242
-		if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
242
+		if ($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
243 243
 		// Attachment to the output of the list, java script
244 244
 		$oFileController->printUploadedFileList($upload_target_srl);
245 245
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	{
252 252
 		$module_srl = Context::get('module_srl');
253 253
 
254
-		if(!$module_srl) return;
254
+		if (!$module_srl) return;
255 255
 
256 256
 		$oModuleModel = getModel('module');
257 257
 		$columnList = array('module_srl', 'content');
@@ -263,29 +263,29 @@  discard block
 block discarded – undo
263 263
 		$oWidgetController = getController('widget');
264 264
 		$oWidgetController->recompileWidget($content);
265 265
 
266
-		if($module_info->page_type == 'WIDGET')
266
+		if ($module_info->page_type == 'WIDGET')
267 267
 		{
268
-			$path = _XE_PATH_ . 'files/cache/page/';
269
-			$cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . '\./');
270
-			foreach($cache_files as $file_name)
268
+			$path = _XE_PATH_.'files/cache/page/';
269
+			$cache_files = FileHandler::readDir($path, '/^'.$module_info->module_srl.'\./');
270
+			foreach ($cache_files as $file_name)
271 271
 			{
272
-				FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name);
272
+				FileHandler::removeFile($path.$module_info->module_srl.'.'.$file_name);
273 273
 			}
274 274
 		}
275
-		else if($module_info->page_type == 'OUTSIDE')
275
+		else if ($module_info->page_type == 'OUTSIDE')
276 276
 		{
277
-			$path = _XE_PATH_ . 'files/cache/page/';
278
-			$cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . './');
279
-			foreach($cache_files as $file_name)
277
+			$path = _XE_PATH_.'files/cache/page/';
278
+			$cache_files = FileHandler::readDir($path, '/^'.$module_info->module_srl.'./');
279
+			foreach ($cache_files as $file_name)
280 280
 			{
281
-				FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name);
281
+				FileHandler::removeFile($path.$module_info->module_srl.'.'.$file_name);
282 282
 			}
283 283
 		}
284 284
 
285 285
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
286
-		if($oCacheHandler->isSupport())
286
+		if ($oCacheHandler->isSupport())
287 287
 		{
288
-			$object_key = 'mid_info:' . $module_info->module_srl;
288
+			$object_key = 'mid_info:'.$module_info->module_srl;
289 289
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
290 290
 			$oCacheHandler->delete($cache_key);
291 291
 		}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		$oModuleModel = getModel('module');
302 302
 		$grant = $oModuleModel->getGrant($this->module_info, $logged_info);
303 303
 
304
-		if(!$grant->manager)
304
+		if (!$grant->manager)
305 305
 		{
306 306
 			return new BaseObject(-1, 'msg_not_permitted');
307 307
 		}
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 		$obj->is_notice = 'N';
312 312
 
313 313
 		settype($obj->title, "string");
314
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
314
+		if ($obj->title == '') $obj->title = cut_str(strip_tags($obj->content), 20, '...');
315 315
 		//그래도 없으면 Untitled
316
-		if($obj->title == '') $obj->title = 'Untitled';
316
+		if ($obj->title == '') $obj->title = 'Untitled';
317 317
 
318 318
 		$document_srl = $obj->document_srl;
319 319
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 		$target = ($obj->ismobile == 'Y') ? 'mdocument_srl' : 'document_srl';
325 325
 
326 326
 		// 이미 존재하는 경우 수정
327
-		if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) 
327
+		if ($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) 
328 328
 		{
329 329
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
330 330
 			$msg_code = 'success_updated';
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			$document_srl = $output->get('document_srl');
338 338
 		}
339 339
 
340
-		if(!isset($this->module_info->{$target}) || (isset($this->module_info->{$target}) && $this->module_info->{$target} !== $document_srl))
340
+		if (!isset($this->module_info->{$target}) || (isset($this->module_info->{$target}) && $this->module_info->{$target} !== $document_srl))
341 341
 		{
342 342
 			$oModuleController = getController('module');
343 343
 			$this->module_info->{$target} = $document_srl;
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		}
346 346
 
347 347
 		// 오류 발생시 멈춤
348
-		if(!$output->toBool()) return $output;
348
+		if (!$output->toBool()) return $output;
349 349
 
350 350
 		// 결과를 리턴
351 351
 		$this->add('mid', Context::get('mid'));
Please login to merge, or discard this patch.
Braces   +47 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,7 +30,9 @@  discard block
 block discarded – undo
30 30
 		$args->mpath = (!$args->mpath) ? '' : $args->mpath;
31 31
 		unset($args->page_name);
32 32
 
33
-		if($args->use_mobile != 'Y') $args->use_mobile = '';
33
+		if($args->use_mobile != 'Y') {
34
+			$args->use_mobile = '';
35
+		}
34 36
 		// Check if an original module exists by using module_srl
35 37
 		if($args->module_srl)
36 38
 		{
@@ -39,8 +41,7 @@  discard block
 block discarded – undo
39 41
 			if($module_info->module_srl != $args->module_srl)
40 42
 			{
41 43
 				unset($args->module_srl);
42
-			}
43
-			else
44
+			} else
44 45
 			{
45 46
 				foreach($args as $key=>$val)
46 47
 				{
@@ -79,14 +80,15 @@  discard block
 block discarded – undo
79 80
 		{
80 81
 			$output = $oModuleController->insertModule($args);
81 82
 			$msg_code = 'success_registed';
82
-		}
83
-		else
83
+		} else
84 84
 		{
85 85
 			$output = $oModuleController->updateModule($args);
86 86
 			$msg_code = 'success_updated';
87 87
 		}
88 88
 
89
-		if(!$output->toBool()) return $output;
89
+		if(!$output->toBool()) {
90
+			return $output;
91
+		}
90 92
 
91 93
 		$this->add("page", Context::get('page'));
92 94
 		$this->add('module_srl',$output->get('module_srl'));
@@ -106,7 +108,9 @@  discard block
 block discarded – undo
106 108
 
107 109
 	function putDocumentsInPageToArray($target, &$array)
108 110
 	{
109
-		if(!$target) return;
111
+		if(!$target) {
112
+			return;
113
+		}
110 114
 		preg_match_all('!<img hasContent="true" ([^>]+)!is', $target, $matches);
111 115
 		$pattern = '!document_srl="(\d+)"!';
112 116
 		foreach($matches[1] as $match)
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 	{
128 132
 		$module_srl = Context::get('module_srl');
129 133
 		$content = Context::get('content');
130
-		if(!$module_srl) return new BaseObject(-1,'msg_invalid_request');
134
+		if(!$module_srl) {
135
+			return new BaseObject(-1,'msg_invalid_request');
136
+		}
131 137
 		$mcontent = Context::get('mcontent');
132 138
 		$type = Context::get('type');
133 139
 		// Guhaeom won information page
@@ -135,12 +141,15 @@  discard block
 block discarded – undo
135 141
 		$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
136 142
 		if($type == "mobile")
137 143
 		{
138
-			if(!$mcontent) $mcontent = '';
144
+			if(!$mcontent) {
145
+				$mcontent = '';
146
+			}
139 147
 			$module_info->mcontent = $mcontent;
140
-		}
141
-		else
148
+		} else
142 149
 		{
143
-			if(!isset($content)) $content ='';
150
+			if(!isset($content)) {
151
+				$content ='';
152
+			}
144 153
 			$module_info->content = $content;
145 154
 		}
146 155
 
@@ -158,7 +167,9 @@  discard block
 block discarded – undo
158 167
 		{
159 168
 			foreach($output->data as $document)
160 169
 			{
161
-				if($document_srls[$document->document_srl]) continue;
170
+				if($document_srls[$document->document_srl]) {
171
+					continue;
172
+				}
162 173
 				$oDocumentController->deleteDocument($document->document_srl, true);
163 174
 			}
164 175
 		}
@@ -166,7 +177,9 @@  discard block
 block discarded – undo
166 177
 		$oModuleController = getController('module');
167 178
 		// Save
168 179
 		$output = $oModuleController->updateModule($module_info);
169
-		if(!$output->toBool()) return $output;
180
+		if(!$output->toBool()) {
181
+			return $output;
182
+		}
170 183
 		// On the page, change the validity status of the attached file
171 184
 		$oFileController = getController('file');
172 185
 		$oFileController->setFilesValid($module_info->module_srl);
@@ -189,7 +202,9 @@  discard block
 block discarded – undo
189 202
 		// Get an original
190 203
 		$oModuleController = getController('module');
191 204
 		$output = $oModuleController->deleteModule($module_srl);
192
-		if(!$output->toBool()) return $output;
205
+		if(!$output->toBool()) {
206
+			return $output;
207
+		}
193 208
 
194 209
 		$this->add('module','page');
195 210
 		$this->add('page',Context::get('page'));
@@ -239,7 +254,9 @@  discard block
 block discarded – undo
239 254
 		$file_srl = Context::get('file_srl');
240 255
 		// Create the controller object file class
241 256
 		$oFileController = getController('file');
242
-		if($file_srl) $output = $oFileController->deleteFile($file_srl, $this->grant->manager);
257
+		if($file_srl) {
258
+			$output = $oFileController->deleteFile($file_srl, $this->grant->manager);
259
+		}
243 260
 		// Attachment to the output of the list, java script
244 261
 		$oFileController->printUploadedFileList($upload_target_srl);
245 262
 	}
@@ -251,7 +268,9 @@  discard block
 block discarded – undo
251 268
 	{
252 269
 		$module_srl = Context::get('module_srl');
253 270
 
254
-		if(!$module_srl) return;
271
+		if(!$module_srl) {
272
+			return;
273
+		}
255 274
 
256 275
 		$oModuleModel = getModel('module');
257 276
 		$columnList = array('module_srl', 'content');
@@ -271,8 +290,7 @@  discard block
 block discarded – undo
271 290
 			{
272 291
 				FileHandler::removeFile($path . $module_info->module_srl . '.' . $file_name);
273 292
 			}
274
-		}
275
-		else if($module_info->page_type == 'OUTSIDE')
293
+		} else if($module_info->page_type == 'OUTSIDE')
276 294
 		{
277 295
 			$path = _XE_PATH_ . 'files/cache/page/';
278 296
 			$cache_files = FileHandler::readDir($path, '/^' . $module_info->module_srl . './');
@@ -311,9 +329,13 @@  discard block
 block discarded – undo
311 329
 		$obj->is_notice = 'N';
312 330
 
313 331
 		settype($obj->title, "string");
314
-		if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...');
332
+		if($obj->title == '') {
333
+			$obj->title = cut_str(strip_tags($obj->content),20,'...');
334
+		}
315 335
 		//그래도 없으면 Untitled
316
-		if($obj->title == '') $obj->title = 'Untitled';
336
+		if($obj->title == '') {
337
+			$obj->title = 'Untitled';
338
+		}
317 339
 
318 340
 		$document_srl = $obj->document_srl;
319 341
 
@@ -328,8 +350,7 @@  discard block
 block discarded – undo
328 350
 		{
329 351
 			$output = $oDocumentController->updateDocument($oDocument, $obj);
330 352
 			$msg_code = 'success_updated';
331
-		}
332
-		else
353
+		} else
333 354
 		{
334 355
 			// 그렇지 않으면 신규 등록
335 356
 			$output = $oDocumentController->insertDocument($obj, $bAnonymous);
@@ -345,7 +366,9 @@  discard block
 block discarded – undo
345 366
 		}
346 367
 
347 368
 		// 오류 발생시 멈춤
348
-		if(!$output->toBool()) return $output;
369
+		if(!$output->toBool()) {
370
+			return $output;
371
+		}
349 372
 
350 373
 		// 결과를 리턴
351 374
 		$this->add('mid', Context::get('mid'));
Please login to merge, or discard this patch.