GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( 3d3ece...f480fa )
by gyeong-won
09:44
created
modules/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.
modules/page/page.mobile.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
 		// Get a template path (page in the administrative template tpl putting together)
10 10
 		$this->setTemplatePath($this->module_path.'tpl');
11 11
 
12
-		switch($this->module_info->page_type)
12
+		switch ($this->module_info->page_type)
13 13
 		{
14 14
 			case 'WIDGET' :
15 15
 				{
16 16
 					$this->cache_file = sprintf("%sfiles/cache/page/%d.%s.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType(), Context::getSslStatus());
17
-					$this->interval = (int)($this->module_info->page_caching_interval);
17
+					$this->interval = (int) ($this->module_info->page_caching_interval);
18 18
 					break;
19 19
 				}
20 20
 			case 'OUTSIDE' :
21 21
 				{
22 22
 					$this->cache_file = sprintf("./files/cache/opage/%d.%s.m.cache.php", $this->module_info->module_srl, Context::getSslStatus()); 
23
-					$this->interval = (int)($this->module_info->page_caching_interval);
23
+					$this->interval = (int) ($this->module_info->page_caching_interval);
24 24
 					$this->path = $this->module_info->mpath;
25 25
 					break;
26 26
 				}
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	function dispPageIndex()
31 31
 	{
32 32
 		// Variables used in the template Context:: set()
33
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
33
+		if ($this->module_srl) Context::set('module_srl', $this->module_srl);
34 34
 
35 35
 		$page_type_name = strtolower($this->module_info->page_type);
36
-		$method = '_get' . ucfirst($page_type_name) . 'Content';
36
+		$method = '_get'.ucfirst($page_type_name).'Content';
37 37
 		if (method_exists($this, $method)) $page_content = $this->{$method}();
38 38
 		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
39 39
 
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 	function _getWidgetContent()
47 47
 	{
48 48
 		// Arrange a widget ryeolro
49
-		if($this->module_info->mcontent)
49
+		if ($this->module_info->mcontent)
50 50
 		{
51 51
 			$cache_file = sprintf("%sfiles/cache/page/%d.%s.m.cache.php", _XE_PATH_, $this->module_info->module_srl, Context::getLangType());
52
-			$interval = (int)($this->module_info->page_caching_interval);
53
-			if($interval>0)
52
+			$interval = (int) ($this->module_info->page_caching_interval);
53
+			if ($interval > 0)
54 54
 			{
55
-				if(!file_exists($cache_file) || filesize($cache_file) < 1)
55
+				if (!file_exists($cache_file) || filesize($cache_file) < 1)
56 56
 				{
57 57
 					$mtime = 0;
58 58
 				}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 					$mtime = filemtime($cache_file);
62 62
 				}
63 63
 
64
-				if($mtime + $interval*60 > $_SERVER['REQUEST_TIME']) 
64
+				if ($mtime + $interval * 60 > $_SERVER['REQUEST_TIME']) 
65 65
 				{
66 66
 					$page_content = FileHandler::readFile($cache_file); 
67 67
 					$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 			} 
76 76
 			else 
77 77
 			{
78
-				if(file_exists($cache_file))
78
+				if (file_exists($cache_file))
79 79
 				{
80 80
 					FileHandler::removeFile($cache_file);
81 81
 				}
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		$oDocumentModel = getModel('document');
98 98
 		$oDocument = $oDocumentModel->getDocument(0, true);
99 99
 
100
-		if($this->module_info->mdocument_srl)
100
+		if ($this->module_info->mdocument_srl)
101 101
 		{
102 102
 			$document_srl = $this->module_info->mdocument_srl;
103 103
 			$oDocument->setDocument($document_srl);
104 104
 			Context::set('document_srl', $document_srl);
105 105
 		}
106
-		if(!$oDocument->isExists())
106
+		if (!$oDocument->isExists())
107 107
 		{
108 108
 			$document_srl = $this->module_info->document_srl;
109 109
 			$oDocument->setDocument($document_srl);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		}
112 112
 		Context::set('oDocument', $oDocument);
113 113
 
114
-		if($this->module_info->mskin)
114
+		if ($this->module_info->mskin)
115 115
 		{
116 116
 			$templatePath = (sprintf($this->module_path.'m.skins/%s', $this->module_info->mskin));
117 117
 		}
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 	function _getOutsideContent()
129 129
 	{
130 130
 		// check if it is http or internal file
131
-		if($this->path)
131
+		if ($this->path)
132 132
 		{
133
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
133
+			if (preg_match("/^([a-z]+):\/\//i", $this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
134 134
 			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
135 135
 		}
136 136
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,12 +30,17 @@  discard block
 block discarded – undo
30 30
 	function dispPageIndex()
31 31
 	{
32 32
 		// Variables used in the template Context:: set()
33
-		if($this->module_srl) Context::set('module_srl',$this->module_srl);
33
+		if($this->module_srl) {
34
+			Context::set('module_srl',$this->module_srl);
35
+		}
34 36
 
35 37
 		$page_type_name = strtolower($this->module_info->page_type);
36 38
 		$method = '_get' . ucfirst($page_type_name) . 'Content';
37
-		if (method_exists($this, $method)) $page_content = $this->{$method}();
38
-		else return new BaseObject(-1, sprintf('%s method is not exists', $method));
39
+		if (method_exists($this, $method)) {
40
+			$page_content = $this->{$method}();
41
+		} else {
42
+			return new BaseObject(-1, sprintf('%s method is not exists', $method));
43
+		}
39 44
 
40 45
 		Context::set('module_info', $this->module_info);
41 46
 		Context::set('page_content', $page_content);
@@ -55,8 +60,7 @@  discard block
 block discarded – undo
55 60
 				if(!file_exists($cache_file) || filesize($cache_file) < 1)
56 61
 				{
57 62
 					$mtime = 0;
58
-				}
59
-				else
63
+				} else
60 64
 				{
61 65
 					$mtime = filemtime($cache_file);
62 66
 				}
@@ -65,15 +69,13 @@  discard block
 block discarded – undo
65 69
 				{
66 70
 					$page_content = FileHandler::readFile($cache_file); 
67 71
 					$page_content = preg_replace('@<\!--#Meta:@', '<!--Meta:', $page_content);
68
-				} 
69
-				else 
72
+				} else 
70 73
 				{
71 74
 					$oWidgetController = getController('widget');
72 75
 					$page_content = $oWidgetController->transWidgetCode($this->module_info->mcontent);
73 76
 					FileHandler::writeFile($cache_file, $page_content);
74 77
 				}
75
-			} 
76
-			else 
78
+			} else 
77 79
 			{
78 80
 				if(file_exists($cache_file))
79 81
 				{
@@ -81,8 +83,7 @@  discard block
 block discarded – undo
81 83
 				}
82 84
 				$page_content = $this->module_info->mcontent;
83 85
 			}
84
-		}
85
-		else
86
+		} else
86 87
 		{
87 88
 			$page_content = $this->module_info->content;
88 89
 		}
@@ -114,8 +115,7 @@  discard block
 block discarded – undo
114 115
 		if($this->module_info->mskin)
115 116
 		{
116 117
 			$templatePath = (sprintf($this->module_path.'m.skins/%s', $this->module_info->mskin));
117
-		}
118
-		else
118
+		} else
119 119
 		{
120 120
 			$templatePath = ($this->module_path.'m.skins/default');
121 121
 		}
@@ -130,8 +130,11 @@  discard block
 block discarded – undo
130 130
 		// check if it is http or internal file
131 131
 		if($this->path)
132 132
 		{
133
-			if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
134
-			else $content = $this->executeFile($this->path, $this->interval, $this->cache_file);
133
+			if(preg_match("/^([a-z]+):\/\//i",$this->path)) {
134
+				$content = $this->getHtmlPage($this->path, $this->interval, $this->cache_file);
135
+			} else {
136
+				$content = $this->executeFile($this->path, $this->interval, $this->cache_file);
137
+			}
135 138
 		}
136 139
 
137 140
 		return $content;
Please login to merge, or discard this patch.
modules/file/file.view.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@
 block discarded – undo
26 26
 		$current_module_srl = Context::get('module_srl');
27 27
 		$current_module_srls = Context::get('module_srls');
28 28
 
29
-		if(!$current_module_srl && !$current_module_srls)
29
+		if (!$current_module_srl && !$current_module_srls)
30 30
 		{
31 31
 			// Get information of the current module
32 32
 			$current_module_info = Context::get('current_module_info');
33 33
 			$current_module_srl = $current_module_info->module_srl;
34
-			if(!$current_module_srl) return new BaseObject();
34
+			if (!$current_module_srl) return new BaseObject();
35 35
 		}
36 36
 		// Get file configurations of the module
37 37
 		$oFileModel = getModel('file');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@
 block discarded – undo
31 31
 			// Get information of the current module
32 32
 			$current_module_info = Context::get('current_module_info');
33 33
 			$current_module_srl = $current_module_info->module_srl;
34
-			if(!$current_module_srl) return new BaseObject();
34
+			if(!$current_module_srl) {
35
+				return new BaseObject();
36
+			}
35 37
 		}
36 38
 		// Get file configurations of the module
37 39
 		$oFileModel = getModel('file');
Please login to merge, or discard this patch.
modules/tag/tag.controller.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,20 +19,20 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function triggerArrangeTag(&$obj)
21 21
 	{
22
-		if(!$obj->tags) return new BaseObject();
22
+		if (!$obj->tags) return new BaseObject();
23 23
 		// tags by variable
24 24
 		$tag_list = explode(',', $obj->tags);
25 25
 		$tag_count = count($tag_list);
26 26
 		$tag_list = array_unique($tag_list);
27
-		if(!count($tag_list)) return new BaseObject();
27
+		if (!count($tag_list)) return new BaseObject();
28 28
 
29
-		foreach($tag_list as $tag)
29
+		foreach ($tag_list as $tag)
30 30
 		{
31
-			if(!trim($tag)) continue;
31
+			if (!trim($tag)) continue;
32 32
 			$arranged_tag_list[] = trim($tag); 
33 33
 		}
34
-		if(!count($arranged_tag_list)) $obj->tags = null;
35
-		else $obj->tags = implode(',',$arranged_tag_list);
34
+		if (!count($arranged_tag_list)) $obj->tags = null;
35
+		else $obj->tags = implode(',', $arranged_tag_list);
36 36
 		return new BaseObject();
37 37
 	}
38 38
 
@@ -45,24 +45,24 @@  discard block
 block discarded – undo
45 45
 		$module_srl = $obj->module_srl;
46 46
 		$document_srl = $obj->document_srl;
47 47
 		$tags = $obj->tags;
48
-		if(!$document_srl) return new BaseObject();
48
+		if (!$document_srl) return new BaseObject();
49 49
 		// Remove all tags that article
50 50
 		$output = $this->triggerDeleteTag($obj);
51
-		if(!$output->toBool()) return $output;
51
+		if (!$output->toBool()) return $output;
52 52
 		// Re-enter the tag
53 53
 		$args = new stdClass();
54 54
 		$args->module_srl = $module_srl;
55 55
 		$args->document_srl = $document_srl;
56 56
 
57
-		$tag_list = explode(',',$tags);
57
+		$tag_list = explode(',', $tags);
58 58
 		$tag_count = count($tag_list);
59
-		for($i=0;$i<$tag_count;$i++)
59
+		for ($i = 0; $i < $tag_count; $i++)
60 60
 		{
61 61
 			unset($args->tag);
62 62
 			$args->tag = trim($tag_list[$i]);
63
-			if(!$args->tag) continue;
63
+			if (!$args->tag) continue;
64 64
 			$output = executeQuery('tag.insertTag', $args);
65
-			if(!$output->toBool()) return $output;
65
+			if (!$output->toBool()) return $output;
66 66
 		}
67 67
 
68 68
 		return new BaseObject();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	function triggerDeleteTag(&$obj)
76 76
 	{
77 77
 		$document_srl = $obj->document_srl;
78
-		if(!$document_srl) return new BaseObject();
78
+		if (!$document_srl) return new BaseObject();
79 79
 
80 80
 		$args = new stdClass();
81 81
 		$args->document_srl = $document_srl;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	function triggerDeleteModuleTags(&$obj)
89 89
 	{
90 90
 		$module_srl = $obj->module_srl;
91
-		if(!$module_srl) return new BaseObject();
91
+		if (!$module_srl) return new BaseObject();
92 92
 
93 93
 		$oTagController = getAdminController('tag');
94 94
 		return $oTagController->deleteModuleTags($module_srl);
Please login to merge, or discard this patch.
Braces   +32 added lines, -11 removed lines patch added patch discarded remove patch
@@ -19,20 +19,29 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function triggerArrangeTag(&$obj)
21 21
 	{
22
-		if(!$obj->tags) return new BaseObject();
22
+		if(!$obj->tags) {
23
+			return new BaseObject();
24
+		}
23 25
 		// tags by variable
24 26
 		$tag_list = explode(',', $obj->tags);
25 27
 		$tag_count = count($tag_list);
26 28
 		$tag_list = array_unique($tag_list);
27
-		if(!count($tag_list)) return new BaseObject();
29
+		if(!count($tag_list)) {
30
+			return new BaseObject();
31
+		}
28 32
 
29 33
 		foreach($tag_list as $tag)
30 34
 		{
31
-			if(!trim($tag)) continue;
35
+			if(!trim($tag)) {
36
+				continue;
37
+			}
32 38
 			$arranged_tag_list[] = trim($tag); 
33 39
 		}
34
-		if(!count($arranged_tag_list)) $obj->tags = null;
35
-		else $obj->tags = implode(',',$arranged_tag_list);
40
+		if(!count($arranged_tag_list)) {
41
+			$obj->tags = null;
42
+		} else {
43
+			$obj->tags = implode(',',$arranged_tag_list);
44
+		}
36 45
 		return new BaseObject();
37 46
 	}
38 47
 
@@ -45,10 +54,14 @@  discard block
 block discarded – undo
45 54
 		$module_srl = $obj->module_srl;
46 55
 		$document_srl = $obj->document_srl;
47 56
 		$tags = $obj->tags;
48
-		if(!$document_srl) return new BaseObject();
57
+		if(!$document_srl) {
58
+			return new BaseObject();
59
+		}
49 60
 		// Remove all tags that article
50 61
 		$output = $this->triggerDeleteTag($obj);
51
-		if(!$output->toBool()) return $output;
62
+		if(!$output->toBool()) {
63
+			return $output;
64
+		}
52 65
 		// Re-enter the tag
53 66
 		$args = new stdClass();
54 67
 		$args->module_srl = $module_srl;
@@ -60,9 +73,13 @@  discard block
 block discarded – undo
60 73
 		{
61 74
 			unset($args->tag);
62 75
 			$args->tag = trim($tag_list[$i]);
63
-			if(!$args->tag) continue;
76
+			if(!$args->tag) {
77
+				continue;
78
+			}
64 79
 			$output = executeQuery('tag.insertTag', $args);
65
-			if(!$output->toBool()) return $output;
80
+			if(!$output->toBool()) {
81
+				return $output;
82
+			}
66 83
 		}
67 84
 
68 85
 		return new BaseObject();
@@ -75,7 +92,9 @@  discard block
 block discarded – undo
75 92
 	function triggerDeleteTag(&$obj)
76 93
 	{
77 94
 		$document_srl = $obj->document_srl;
78
-		if(!$document_srl) return new BaseObject();
95
+		if(!$document_srl) {
96
+			return new BaseObject();
97
+		}
79 98
 
80 99
 		$args = new stdClass();
81 100
 		$args->document_srl = $document_srl;
@@ -88,7 +107,9 @@  discard block
 block discarded – undo
88 107
 	function triggerDeleteModuleTags(&$obj)
89 108
 	{
90 109
 		$module_srl = $obj->module_srl;
91
-		if(!$module_srl) return new BaseObject();
110
+		if(!$module_srl) {
111
+			return new BaseObject();
112
+		}
92 113
 
93 114
 		$oTagController = getAdminController('tag');
94 115
 		return $oTagController->deleteModuleTags($module_srl);
Please login to merge, or discard this patch.
modules/rss/rss.controller.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
 		$current_module_srl = Context::get('module_srl');
29 29
 		$site_module_info = Context::get('site_module_info');
30 30
 
31
-		if(is_array($current_module_srl))
31
+		if (is_array($current_module_srl))
32 32
 		{
33 33
 			unset($current_module_srl);
34 34
 		}
35
-		if(!$current_module_srl) {
35
+		if (!$current_module_srl) {
36 36
 			$current_module_info = Context::get('current_module_info');
37 37
 			$current_module_srl = $current_module_info->module_srl;
38 38
 		}
39 39
 
40
-		if(!$current_module_srl) return new BaseObject();
40
+		if (!$current_module_srl) return new BaseObject();
41 41
 		// Imported rss settings of the selected module
42 42
 		$oRssModel = getModel('rss');
43 43
 		$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
44 44
 
45
-		if($rss_config->open_rss != 'N')
45
+		if ($rss_config->open_rss != 'N')
46 46
 		{
47 47
 			Context::set('rss_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'rss'));
48 48
 			Context::set('atom_url', $oRssModel->getModuleFeedUrl(Context::get('vid'), Context::get('mid'), 'atom'));
49 49
 		}
50 50
 
51
-		if(Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N')
51
+		if (Context::isInstalled() && $site_module_info->mid == Context::get('mid') && $total_config->use_total_feed != 'N')
52 52
 		{
53
-			if(Context::isAllowRewrite() && !Context::get('vid'))
53
+			if (Context::isAllowRewrite() && !Context::get('vid'))
54 54
 			{
55 55
 				$request_uri = Context::getRequestUri();
56 56
 				Context::set('general_rss_url', $request_uri.'rss');
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 			}
59 59
 			else
60 60
 			{
61
-				Context::set('general_rss_url', getUrl('','module','rss','act','rss'));
62
-				Context::set('general_atom_url', getUrl('','module','rss','act','atom'));
61
+				Context::set('general_rss_url', getUrl('', 'module', 'rss', 'act', 'rss'));
62
+				Context::set('general_atom_url', getUrl('', 'module', 'rss', 'act', 'atom'));
63 63
 			}
64 64
 		}
65 65
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
 		$rssConfig = $oModuleModel->getModulePartConfig('rss', $obj->originModuleSrl);
73 73
 
74 74
 		$oModuleController = getController('module');
75
-		if(is_array($obj->moduleSrlList))
75
+		if (is_array($obj->moduleSrlList))
76 76
 		{
77
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
77
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
78 78
 			{
79 79
 				$oModuleController->insertModulePartConfig('rss', $moduleSrl, $rssConfig);
80 80
 			}
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 			$current_module_srl = $current_module_info->module_srl;
38 38
 		}
39 39
 
40
-		if(!$current_module_srl) return new BaseObject();
40
+		if(!$current_module_srl) {
41
+			return new BaseObject();
42
+		}
41 43
 		// Imported rss settings of the selected module
42 44
 		$oRssModel = getModel('rss');
43 45
 		$rss_config = $oRssModel->getRssModuleConfig($current_module_srl);
@@ -55,8 +57,7 @@  discard block
 block discarded – undo
55 57
 				$request_uri = Context::getRequestUri();
56 58
 				Context::set('general_rss_url', $request_uri.'rss');
57 59
 				Context::set('general_atom_url', $request_uri.'atom');
58
-			}
59
-			else
60
+			} else
60 61
 			{
61 62
 				Context::set('general_rss_url', getUrl('','module','rss','act','rss'));
62 63
 				Context::set('general_atom_url', getUrl('','module','rss','act','atom'));
Please login to merge, or discard this patch.