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 ( 60afa9...8fa69d )
by gyeong-won
11:03
created
modules/editor/editor.model.php 2 patches
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	function getEditorConfig($module_srl = null)
25 25
 	{
26
-		if(!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
26
+		if (!$GLOBALS['__editor_module_config__'][$module_srl] && $module_srl)
27 27
 		{
28 28
 			// Get trackback settings of the selected module
29 29
 			$oModuleModel = getModel('module');
@@ -34,55 +34,55 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
37
+		if (!is_object($editor_config)) $editor_config = new stdClass();
38 38
 
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
39
+		if ($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
+		if (!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
+		if (!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
+		if (!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
+		if (!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
+		if (!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
+		if (!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
+		if (!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
+		if (!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant = array();
48 48
 
49
-		if(!$editor_config->editor_height)
49
+		if (!$editor_config->editor_height)
50 50
 		{
51 51
 			$editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500;
52 52
 		}
53
-		if(!$editor_config->comment_editor_height)
53
+		if (!$editor_config->comment_editor_height)
54 54
 		{
55 55
 			$editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120;
56 56
 		}
57
-		if(!$editor_config->editor_skin)
57
+		if (!$editor_config->editor_skin)
58 58
 		{
59 59
 			$editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor';
60 60
 		}
61
-		if(!$editor_config->comment_editor_skin)
61
+		if (!$editor_config->comment_editor_skin)
62 62
 		{
63 63
 			$editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor';
64 64
 		}
65
-		if(!$editor_config->content_style)
65
+		if (!$editor_config->content_style)
66 66
 		{
67 67
 			$editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light';
68 68
 		}
69
-		if(!$editor_config->content_font && $editor_default_config->content_font)
69
+		if (!$editor_config->content_font && $editor_default_config->content_font)
70 70
 		{
71 71
 			$editor_config->content_font = $editor_default_config->content_font;
72 72
 		}
73
-		if(!$editor_config->content_font_size && $editor_default_config->content_font_size)
73
+		if (!$editor_config->content_font_size && $editor_default_config->content_font_size)
74 74
 		{
75 75
 			$editor_config->content_font_size = $editor_default_config->content_font_size;
76 76
 		}
77
-		if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
77
+		if (!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
78 78
 		{
79 79
 			$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
80 80
 		}
81
-		if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
81
+		if (!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
82 82
 		{
83 83
 			$editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset;
84 84
 		}
85
-		if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
85
+		if (!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
86 86
 		{
87 87
 			$editor_config->comment_content_style = $editor_default_config->comment_content_style;
88 88
 		}
@@ -92,25 +92,25 @@  discard block
 block discarded – undo
92 92
 
93 93
 	function loadDrComponents()
94 94
 	{
95
-		$drComponentPath = _XE_PATH_ . 'modules/editor/skins/dreditor/drcomponents/';
95
+		$drComponentPath = _XE_PATH_.'modules/editor/skins/dreditor/drcomponents/';
96 96
 		$drComponentList = FileHandler::readDir($drComponentPath);
97 97
 
98 98
 		$oTemplate = &TemplateHandler::getInstance();
99 99
 
100 100
 		$drComponentInfo = array();
101
-		if($drComponentList)
101
+		if ($drComponentList)
102 102
 		{
103
-			foreach($drComponentList as $i => $drComponent)
103
+			foreach ($drComponentList as $i => $drComponent)
104 104
 			{
105 105
 				unset($obj);
106 106
 				$obj = $this->getDrComponentXmlInfo($drComponent);
107
-				Context::loadLang(sprintf('%s%s/lang/',$drComponentPath,$drComponent));
108
-				$path = sprintf('%s%s/tpl/',$drComponentPath,$drComponent);
109
-				$obj->html = $oTemplate->compile($path,$drComponent);
107
+				Context::loadLang(sprintf('%s%s/lang/', $drComponentPath, $drComponent));
108
+				$path = sprintf('%s%s/tpl/', $drComponentPath, $drComponent);
109
+				$obj->html = $oTemplate->compile($path, $drComponent);
110 110
 				$drComponentInfo[$drComponent] = $obj;
111 111
 			}
112 112
 		}
113
-		Context::set('drComponentList',$drComponentInfo);
113
+		Context::set('drComponentList', $drComponentInfo);
114 114
 	}
115 115
 
116 116
 	function getDrComponentXmlInfo($drComponentName)
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$xml_file = sprintf('%sinfo.xml', $component_path);
123 123
 		$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
124 124
 		// Return information after including it after cached xml file exists
125
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
125
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
126 126
 		{
127 127
 			include($cache_file);
128 128
 			return $xml_info;
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 152
 
153 153
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
154
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155 155
 		else $author_list = $xml_doc->component->author;
156 156
 
157
-		for($i=0; $i < count($author_list); $i++)
157
+		for ($i = 0; $i < count($author_list); $i++)
158 158
 		{
159 159
 			$buff .= sprintf('$xml_info->author['.$i.']->name = "%s";', $author_list[$i]->name->body);
160 160
 			$buff .= sprintf('$xml_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 
164 164
 		// List extra variables (text type only in the editor component)
165 165
 		$extra_vars = $xml_doc->component->extra_vars->var;
166
-		if($extra_vars)
166
+		if ($extra_vars)
167 167
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
-			foreach($extra_vars as $key => $val)
168
+			if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
169
+			foreach ($extra_vars as $key => $val)
170 170
 			{
171 171
 				unset($obj);
172 172
 				$key = $val->attrs->name;
@@ -198,47 +198,47 @@  discard block
 block discarded – undo
198 198
 		 * Editor's default options
199 199
 		 */
200 200
 		// Option setting to allow file upload
201
-		if($upload_target_srl)
201
+		if ($upload_target_srl)
202 202
 		{
203 203
 			$option->editor_sequence = $upload_target_srl;
204 204
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
205
+		if (!$option->allow_fileupload) $allow_fileupload = false;
206 206
 		else $allow_fileupload = true;
207 207
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
208
+		if (!$option->content_style) $option->content_style = 'ckeditor_light';
209 209
 		Context::set('content_style', $option->content_style);
210
-		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
210
+		Context::set('content_style_path', getScriptPath().ltrim($this->module_path, './').'styles/'.$option->content_style);
211 211
 		// Default font setting
212 212
 		Context::set('content_font', addslashes($option->content_font));
213 213
 		Context::set('content_font_size', $option->content_font_size);
214 214
 
215 215
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
216
+		if (!$option->enable_autosave) $enable_autosave = false;
217
+		elseif (Context::get($option->primary_key_name)) $enable_autosave = false;
218 218
 		else $enable_autosave = true;
219 219
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
220
+		if (!$option->enable_default_component) $enable_default_component = false;
221 221
 		else $enable_default_component = true;
222 222
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
223
+		if (!$option->enable_component) $enable_component = false;
224 224
 		else $enable_component = true;
225 225
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
226
+		if ($option->disable_html) $html_mode = false;
227 227
 		else $html_mode = true;
228 228
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
229
+		if (!$option->height) $editor_height = 300;
230 230
 		else $editor_height = $option->height;
231 231
 		// Skin Setting
232 232
 		$skin = $option->skin;
233
-		if(!$skin) $skin = 'ckeditor';
233
+		if (!$skin) $skin = 'ckeditor';
234 234
 
235 235
 		$colorset = $option->colorset;
236
-		if(!$colorset) $colorset = 'moono';
236
+		if (!$colorset) $colorset = 'moono';
237 237
 		Context::set('colorset', $colorset);
238 238
 		Context::set('skin', $skin);
239 239
 		Context::set('module_type', $option->module_type);
240 240
 
241
-		if($skin=='dreditor')
241
+		if ($skin == 'dreditor')
242 242
 		{
243 243
 			$this->loadDrComponents();
244 244
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		/**
247 247
 		 * Check the automatic backup feature (do not use if the post is edited)
248 248
 		 */
249
-		if($enable_autosave)
249
+		if ($enable_autosave)
250 250
 		{
251 251
 			// Extract auto-saved data
252 252
 			$saved_doc = $this->getSavedDoc($upload_target_srl);
@@ -258,26 +258,26 @@  discard block
 block discarded – undo
258 258
 		/**
259 259
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
260 260
 		 */
261
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
261
+		if ($option->editor_sequence) $editor_sequence = $option->editor_sequence;
262 262
 		else
263 263
 		{
264
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
265
-			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
264
+			if (!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
265
+			$editor_sequence = $_SESSION['_editor_sequence_']++;
266 266
 		}
267 267
 
268 268
 		/**
269 269
 		 * Upload setting by using configuration of the file module internally
270 270
 		 */
271 271
 		$files_count = 0;
272
-		if($allow_fileupload)
272
+		if ($allow_fileupload)
273 273
 		{
274 274
 			$oFileModel = getModel('file');
275 275
 			// Get upload configuration to set on SWFUploader
276 276
 			$file_config = $oFileModel->getUploadConfig();
277
-			$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
278
-			$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
277
+			$file_config->allowed_attach_size = $file_config->allowed_attach_size * 1024 * 1024;
278
+			$file_config->allowed_filesize = $file_config->allowed_filesize * 1024 * 1024;
279 279
 
280
-			Context::set('file_config',$file_config);
280
+			Context::set('file_config', $file_config);
281 281
 			// Configure upload status such as file size
282 282
 			$upload_status = $oFileModel->getUploadStatus();
283 283
 			Context::set('upload_status', $upload_status);
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 			$oFileController = getController('file');
286 286
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
287 287
 			// Check if the file already exists
288
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
288
+			if ($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
289 289
 		}
290
-		Context::set('files_count', (int)$files_count);
290
+		Context::set('files_count', (int) $files_count);
291 291
 
292 292
 		Context::set('allow_fileupload', $allow_fileupload);
293 293
 		// Set editor_sequence value
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		 * Check editor component
305 305
 		 */
306 306
 		$site_module_info = Context::get('site_module_info');
307
-		$site_srl = (int)$site_module_info->site_srl;
308
-		if($enable_component)
307
+		$site_srl = (int) $site_module_info->site_srl;
308
+		if ($enable_component)
309 309
 		{
310
-			if(!Context::get('component_list'))
310
+			if (!Context::get('component_list'))
311 311
 			{
312 312
 				$component_list = $this->getComponentList(true, $site_srl);
313 313
 				Context::set('component_list', $component_list);
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 		$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
335 335
 		$tpl_file = 'editor.html';
336 336
 
337
-		if(!file_exists($tpl_path.$tpl_file))
337
+		if (!file_exists($tpl_path.$tpl_file))
338 338
 		{
339 339
 			$skin = 'ckeditor';
340 340
 			$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 		$config->module_type = $type;
365 365
 
366 366
 		// Configurations listed according to a type
367
-		if($type == 'document')
367
+		if ($type == 'document')
368 368
 		{
369 369
 			$config->editor_skin = $editor_config->editor_skin;
370 370
 			$config->content_style = $editor_config->content_style;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			$config->enable_autosave = 'N';
394 394
 		}
395 395
 		// Check a group_list of the currently logged-in user for permission check
396
-		if(Context::get('is_logged'))
396
+		if (Context::get('is_logged'))
397 397
 		{
398 398
 			$logged_info = Context::get('logged_info');
399 399
 			$group_list = $logged_info->group_list;
@@ -412,12 +412,12 @@  discard block
 block discarded – undo
412 412
 		$option->colorset = $config->sel_editor_colorset;
413 413
 		// Permission check for file upload
414 414
 		$option->allow_fileupload = false;
415
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
416
-		elseif(count($config->upload_file_grant))
415
+		if ($logged_info->is_admin == 'Y') $option->allow_fileupload = true;
416
+		elseif (count($config->upload_file_grant))
417 417
 		{
418
-			foreach($group_list as $group_srl => $group_info)
418
+			foreach ($group_list as $group_srl => $group_info)
419 419
 			{
420
-				if(in_array($group_srl, $config->upload_file_grant))
420
+				if (in_array($group_srl, $config->upload_file_grant))
421 421
 				{
422 422
 					$option->allow_fileupload = true;
423 423
 					break;
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 		else $option->allow_fileupload = true;
428 428
 		// Permission check for using default components
429 429
 		$option->enable_default_component = false;
430
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
431
-		elseif(count($config->enable_default_component_grant))
430
+		if ($logged_info->is_admin == 'Y') $option->enable_default_component = true;
431
+		elseif (count($config->enable_default_component_grant))
432 432
 		{
433
-			foreach($group_list as $group_srl => $group_info)
433
+			foreach ($group_list as $group_srl => $group_info)
434 434
 			{
435
-				if(in_array($group_srl, $config->enable_default_component_grant))
435
+				if (in_array($group_srl, $config->enable_default_component_grant))
436 436
 				{
437 437
 					$option->enable_default_component = true;
438 438
 					break;
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
 		else $option->enable_default_component = true;
443 443
 		// Permisshion check for using extended components
444 444
 		$option->enable_component = false;
445
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
446
-		elseif(count($config->enable_component_grant))
445
+		if ($logged_info->is_admin == 'Y') $option->enable_component = true;
446
+		elseif (count($config->enable_component_grant))
447 447
 		{
448
-			foreach($group_list as $group_srl => $group_info)
448
+			foreach ($group_list as $group_srl => $group_info)
449 449
 			{
450
-				if(in_array($group_srl, $config->enable_component_grant))
450
+				if (in_array($group_srl, $config->enable_component_grant))
451 451
 				{
452 452
 					$option->enable_component = true;
453 453
 					break;
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
 		else $option->enable_component = true;
458 458
 		// HTML editing privileges
459 459
 		$enable_html = false;
460
-		if($logged_info->is_admin=='Y') $enable_html = true;
461
-		elseif(count($config->enable_html_grant))
460
+		if ($logged_info->is_admin == 'Y') $enable_html = true;
461
+		elseif (count($config->enable_html_grant))
462 462
 		{
463
-			foreach($group_list as $group_srl => $group_info)
463
+			foreach ($group_list as $group_srl => $group_info)
464 464
 			{
465
-				if(in_array($group_srl, $config->enable_html_grant))
465
+				if (in_array($group_srl, $config->enable_html_grant))
466 466
 				{
467 467
 					$enable_html = true;
468 468
 					break;
@@ -471,12 +471,12 @@  discard block
 block discarded – undo
471 471
 		}
472 472
 		else $enable_html = true;
473 473
 
474
-		if($enable_html) $option->disable_html = false;
474
+		if ($enable_html) $option->disable_html = false;
475 475
 		else $option->disable_html = true;
476 476
 		// Set Height
477 477
 		$option->height = $config->editor_height;
478 478
 		// Set an option for Auto-save
479
-		$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
479
+		$option->enable_autosave = $config->enable_autosave == 'Y' ?true:false;
480 480
 		// Other settings
481 481
 		$option->primary_key_name = $primary_key_name;
482 482
 		$option->content_key_name = $content_key_name;
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	{
492 492
 		$auto_save_args = new stdClass();
493 493
 		// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
494
-		if(Context::get('is_logged'))
494
+		if (Context::get('is_logged'))
495 495
 		{
496 496
 			$logged_info = Context::get('logged_info');
497 497
 			$auto_save_args->member_srl = $logged_info->member_srl;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 		}
503 503
 		$auto_save_args->module_srl = Context::get('module_srl');
504 504
 		// Get the current module if module_srl doesn't exist
505
-		if(!$auto_save_args->module_srl)
505
+		if (!$auto_save_args->module_srl)
506 506
 		{
507 507
 			$current_module_info = Context::get('current_module_info');
508 508
 			$auto_save_args->module_srl = $current_module_info->module_srl;
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
512 512
 		$saved_doc = $output->data;
513 513
 		// Return null if no result is auto-saved
514
-		if(!$saved_doc) return;
514
+		if (!$saved_doc) return;
515 515
 		// Check if the auto-saved document already exists
516 516
 		$oDocumentModel = getModel('document');
517 517
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
518
-		if($oSaved->isExists()) return;
518
+		if ($oSaved->isExists()) return;
519 519
 		// Move all the files if the auto-saved data contains document_srl and file
520 520
 		// Then set document_srl to editor_sequence
521
-		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
521
+		if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
522 522
 		{
523 523
 			$saved_doc->module_srl = $auto_save_args->module_srl;
524 524
 			$oFileController = getController('file');
525 525
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
526 526
 		}
527
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
527
+		else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
528 528
 		// Change auto-saved data
529 529
 		$oEditorController = getController('editor');
530 530
 		$oEditorController->deleteSavedDoc(false);
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
 	 */
541 541
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
542 542
 	{
543
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
543
+		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return;
544 544
 
545
-		if(!$this->loaded_component_list[$component][$editor_sequence])
545
+		if (!$this->loaded_component_list[$component][$editor_sequence])
546 546
 		{
547 547
 			// Create an object of the component and execute
548 548
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
549 549
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
550
-			if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
550
+			if (!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
551 551
 			// Create an object after loading the class file
552 552
 			require_once($class_file);
553 553
 			$oComponent = new $component($editor_sequence, $class_path);
554
-			if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
554
+			if (!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
555 555
 			// Add configuration information
556 556
 			$component_info = $this->getComponent($component, $site_srl);
557 557
 			$oComponent->setInfo($component_info);
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 	/**
573 573
 	 * @brief Return the cache file name of editor component list
574 574
 	 */
575
-	function getCacheFile($filter_enabled= true, $site_srl = 0)
575
+	function getCacheFile($filter_enabled = true, $site_srl = 0)
576 576
 	{
577 577
 		$lang = Context::getLangType();
578 578
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
579 579
 		FileHandler::makeDir($cache_path);
580
-		$cache_file = $cache_path.'component_list.' . $lang .'.';
581
-		if($filter_enabled) $cache_file .= 'filter.';
582
-		if($site_srl) $cache_file .= $site_srl.'.';
580
+		$cache_file = $cache_path.'component_list.'.$lang.'.';
581
+		if ($filter_enabled) $cache_file .= 'filter.';
582
+		if ($site_srl) $cache_file .= $site_srl.'.';
583 583
 		$cache_file .= 'php';
584 584
 		return $cache_file;
585 585
 	}
@@ -587,19 +587,19 @@  discard block
 block discarded – undo
587 587
 	/**
588 588
 	 * @brief Return a component list (DB Information included)
589 589
 	 */
590
-	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
590
+	function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false)
591 591
 	{
592 592
 		$cache_file = $this->getCacheFile(false, $site_srl);
593
-		if($from_db || !file_exists($cache_file))
593
+		if ($from_db || !file_exists($cache_file))
594 594
 		{
595 595
 			$oEditorController = getController('editor');
596 596
 			$oEditorController->makeCache(false, $site_srl);
597 597
 		}
598 598
 
599
-		if(!file_exists($cache_file)) return;
599
+		if (!file_exists($cache_file)) return;
600 600
 		include($cache_file);
601 601
 		$logged_info = Context::get('logged_info');
602
-		if($logged_info && is_array($logged_info->group_list))
602
+		if ($logged_info && is_array($logged_info->group_list))
603 603
 		{
604 604
 			$group_list = array_keys($logged_info->group_list);
605 605
 		}
@@ -608,45 +608,45 @@  discard block
 block discarded – undo
608 608
 			$group_list = array();
609 609
 		}
610 610
 
611
-		if(count($component_list))
611
+		if (count($component_list))
612 612
 		{
613
-			foreach($component_list as $key => $val)
613
+			foreach ($component_list as $key => $val)
614 614
 			{
615
-				if(!trim($key)) continue;
616
-				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
615
+				if (!trim($key)) continue;
616
+				if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
617 617
 				{
618 618
 					FileHandler::removeFile($cache_file);
619 619
 					return $this->getComponentList($filter_enabled, $site_srl);
620 620
 				}
621
-				if(!$filter_enabled) continue;
622
-				if($val->enabled == "N")
621
+				if (!$filter_enabled) continue;
622
+				if ($val->enabled == "N")
623 623
 				{
624 624
 					unset($component_list->{$key});
625 625
 					continue;
626 626
 				}
627
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
628
-				if($val->target_group)
627
+				if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
628
+				if ($val->target_group)
629 629
 				{
630
-					if(!$logged_info)
630
+					if (!$logged_info)
631 631
 					{
632 632
 						$val->enabled = "N";
633 633
 					}
634 634
 					else
635 635
 					{
636 636
 						$is_granted = false;
637
-						foreach($group_list as $group_srl)
637
+						foreach ($group_list as $group_srl)
638 638
 						{
639
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
639
+							if (in_array($group_srl, $val->target_group)) $is_granted = true;
640 640
 						}
641
-						if(!$is_granted) $val->enabled = "N";
641
+						if (!$is_granted) $val->enabled = "N";
642 642
 					}
643 643
 				}
644
-				if($val->enabled != "N" && $val->mid_list)
644
+				if ($val->enabled != "N" && $val->mid_list)
645 645
 				{
646 646
 					$mid = Context::get('mid');
647
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
647
+					if (!in_array($mid, $val->mid_list)) $val->enabled = "N";
648 648
 				}
649
-				if($val->enabled == "N")
649
+				if ($val->enabled == "N")
650 650
 				{
651 651
 					unset($component_list->{$key});
652 652
 					continue;
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 		$args = new stdClass();
665 665
 		$args->component_name = $component_name;
666 666
 
667
-		if($site_srl)
667
+		if ($site_srl)
668 668
 		{
669 669
 			$args->site_srl = $site_srl;
670 670
 			$output = executeQuery('editor.getSiteComponent', $args);
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		}
676 676
 		$component = $output->data;
677 677
 
678
-		if(!$output->data) return false;
678
+		if (!$output->data) return false;
679 679
 
680 680
 		$component_name = $component->component_name;
681 681
 
@@ -687,25 +687,25 @@  discard block
 block discarded – undo
687 687
 
688 688
 		$xml_info->mid_list = array();
689 689
 
690
-		if($component->extra_vars)
690
+		if ($component->extra_vars)
691 691
 		{
692 692
 			$extra_vars = unserialize($component->extra_vars);
693 693
 
694
-			if($extra_vars->target_group)
694
+			if ($extra_vars->target_group)
695 695
 			{
696 696
 				$xml_info->target_group = $extra_vars->target_group;
697 697
 				unset($extra_vars->target_group);
698 698
 			}
699 699
 
700
-			if($extra_vars->mid_list)
700
+			if ($extra_vars->mid_list)
701 701
 			{
702 702
 				$xml_info->mid_list = $extra_vars->mid_list;
703 703
 				unset($extra_vars->mid_list);
704 704
 			}
705 705
 
706
-			if($xml_info->extra_vars)
706
+			if ($xml_info->extra_vars)
707 707
 			{
708
-				foreach($xml_info->extra_vars as $key => $val)
708
+				foreach ($xml_info->extra_vars as $key => $val)
709 709
 				{
710 710
 					$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
711 711
 				}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
730 730
 
731 731
 		// Include and return xml file information if cached file exists
732
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
732
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
733 733
 		{
734 734
 			include($cache_file);
735 735
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 		$component_info->component_name = $component;
747 747
 		$component_info->title = $xml_doc->component->title->body;
748 748
 
749
-		if($xml_doc->component->version)
749
+		if ($xml_doc->component->version)
750 750
 		{
751 751
 			$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
752 752
 			$component_info->version = $xml_doc->component->version->body;
@@ -772,10 +772,10 @@  discard block
 block discarded – undo
772 772
 
773 773
 		// Author information
774 774
 		$author_list = array();
775
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
775
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
776 776
 		else $author_list = $xml_doc->component->author;
777 777
 
778
-		for($i = 0; $i < count($author_list); $i++)
778
+		for ($i = 0; $i < count($author_list); $i++)
779 779
 		{
780 780
 			$author = new stdClass;
781 781
 			$author->name = $author_list[$i]->name->body;
@@ -786,39 +786,39 @@  discard block
 block discarded – undo
786 786
 
787 787
 		// List extra variables (text type only for editor component)
788 788
 		$extra_vars = $xml_doc->component->extra_vars;
789
-		if($extra_vars)
789
+		if ($extra_vars)
790 790
 		{
791 791
 			$extra_var_groups = $extra_vars->group;
792
-			if(!$extra_var_groups)
792
+			if (!$extra_var_groups)
793 793
 			{
794 794
 				$extra_var_groups = $extra_vars;
795 795
 			}
796
-			if(!is_array($extra_var_groups))
796
+			if (!is_array($extra_var_groups))
797 797
 			{
798 798
 				$extra_var_groups = array($extra_var_groups);
799 799
 			}
800 800
 
801
-			foreach($extra_var_groups as $group)
801
+			foreach ($extra_var_groups as $group)
802 802
 			{
803 803
 				$extra_vars = $group->var;
804
-				if(!is_array($group->var))
804
+				if (!is_array($group->var))
805 805
 				{
806 806
 					$extra_vars = array($group->var);
807 807
 				}
808 808
 
809
-				foreach($extra_vars as $key => $val)
809
+				foreach ($extra_vars as $key => $val)
810 810
 				{
811
-					if(!$val)
811
+					if (!$val)
812 812
 					{
813 813
 						continue;
814 814
 					}
815 815
 
816 816
 					$obj = new stdClass();
817
-					if(!$val->attrs)
817
+					if (!$val->attrs)
818 818
 					{
819 819
 						$val->attrs = new stdClass();
820 820
 					}
821
-					if(!$val->attrs->type)
821
+					if (!$val->attrs->type)
822 822
 					{
823 823
 						$val->attrs->type = 'text';
824 824
 					}
@@ -828,26 +828,26 @@  discard block
 block discarded – undo
828 828
 					$obj->title = $val->title->body;
829 829
 					$obj->type = $val->attrs->type;
830 830
 					$obj->description = $val->description->body;
831
-					if($obj->name)
831
+					if ($obj->name)
832 832
 					{
833 833
 						$obj->value = $extra_vals->{$obj->name};
834 834
 					}
835
-					if(strpos($obj->value, '|@|') != FALSE)
835
+					if (strpos($obj->value, '|@|') != FALSE)
836 836
 					{
837 837
 						$obj->value = explode('|@|', $obj->value);
838 838
 					}
839
-					if($obj->type == 'mid_list' && !is_array($obj->value))
839
+					if ($obj->type == 'mid_list' && !is_array($obj->value))
840 840
 					{
841 841
 						$obj->value = array($obj->value);
842 842
 					}
843 843
 
844 844
 					// 'Select'type obtained from the option list.
845
-					if($val->options && !is_array($val->options))
845
+					if ($val->options && !is_array($val->options))
846 846
 					{
847 847
 						$val->options = array($val->options);
848 848
 					}
849 849
 
850
-					for($i = 0, $c = count($val->options); $i < $c; $i++)
850
+					for ($i = 0, $c = count($val->options); $i < $c; $i++)
851 851
 					{
852 852
 						$obj->options[$i] = new stdClass();
853 853
 						$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 
862 862
 		$buff = array();
863 863
 		$buff[] = '<?php if(!defined(\'__XE__\')) exit();';
864
-		$buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';';
864
+		$buff[] = '$xml_info = '.var_export($component_info, TRUE).';';
865 865
 		$buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff));
866 866
 
867 867
 		FileHandler::writeFile($cache_file, $buff, 'w');
Please login to merge, or discard this patch.
Braces   +173 added lines, -80 removed lines patch added patch discarded remove patch
@@ -34,17 +34,37 @@  discard block
 block discarded – undo
34 34
 		$oModuleModel = getModel('module');
35 35
 		$editor_default_config = $oModuleModel->getModuleConfig('editor');
36 36
 
37
-		if(!is_object($editor_config)) $editor_config = new stdClass();
38
-
39
-		if($editor_config->enable_autosave != 'N') $editor_config->enable_autosave = 'Y';
40
-		if(!is_array($editor_config->enable_html_grant)) $editor_config->enable_html_grant = array();
41
-		if(!is_array($editor_config->enable_comment_html_grant)) $editor_config->enable_comment_html_grant = array();
42
-		if(!is_array($editor_config->upload_file_grant)) $editor_config->upload_file_grant = array();
43
-		if(!is_array($editor_config->comment_upload_file_grant)) $editor_config->comment_upload_file_grant = array();
44
-		if(!is_array($editor_config->enable_default_component_grant)) $editor_config->enable_default_component_grant = array();
45
-		if(!is_array($editor_config->enable_comment_default_component_grant)) $editor_config->enable_comment_default_component_grant = array();
46
-		if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
47
-		if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
37
+		if(!is_object($editor_config)) {
38
+			$editor_config = new stdClass();
39
+		}
40
+
41
+		if($editor_config->enable_autosave != 'N') {
42
+			$editor_config->enable_autosave = 'Y';
43
+		}
44
+		if(!is_array($editor_config->enable_html_grant)) {
45
+			$editor_config->enable_html_grant = array();
46
+		}
47
+		if(!is_array($editor_config->enable_comment_html_grant)) {
48
+			$editor_config->enable_comment_html_grant = array();
49
+		}
50
+		if(!is_array($editor_config->upload_file_grant)) {
51
+			$editor_config->upload_file_grant = array();
52
+		}
53
+		if(!is_array($editor_config->comment_upload_file_grant)) {
54
+			$editor_config->comment_upload_file_grant = array();
55
+		}
56
+		if(!is_array($editor_config->enable_default_component_grant)) {
57
+			$editor_config->enable_default_component_grant = array();
58
+		}
59
+		if(!is_array($editor_config->enable_comment_default_component_grant)) {
60
+			$editor_config->enable_comment_default_component_grant = array();
61
+		}
62
+		if(!is_array($editor_config->enable_component_grant)) {
63
+			$editor_config->enable_component_grant = array();
64
+		}
65
+		if(!is_array($editor_config->enable_comment_component_grant)) {
66
+			$editor_config->enable_comment_component_grant= array();
67
+		}
48 68
 
49 69
 		if(!$editor_config->editor_height)
50 70
 		{
@@ -151,8 +171,11 @@  discard block
 block discarded – undo
151 171
 		$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
152 172
 
153 173
 		// Author information
154
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
155
-		else $author_list = $xml_doc->component->author;
174
+		if(!is_array($xml_doc->component->author)) {
175
+			$author_list[] = $xml_doc->component->author;
176
+		} else {
177
+			$author_list = $xml_doc->component->author;
178
+		}
156 179
 
157 180
 		for($i=0; $i < count($author_list); $i++)
158 181
 		{
@@ -165,7 +188,9 @@  discard block
 block discarded – undo
165 188
 		$extra_vars = $xml_doc->component->extra_vars->var;
166 189
 		if($extra_vars)
167 190
 		{
168
-			if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
191
+			if(!is_array($extra_vars)) {
192
+				$extra_vars = array($extra_vars);
193
+			}
169 194
 			foreach($extra_vars as $key => $val)
170 195
 			{
171 196
 				unset($obj);
@@ -202,10 +227,15 @@  discard block
 block discarded – undo
202 227
 		{
203 228
 			$option->editor_sequence = $upload_target_srl;
204 229
 		}
205
-		if(!$option->allow_fileupload) $allow_fileupload = false;
206
-		else $allow_fileupload = true;
230
+		if(!$option->allow_fileupload) {
231
+			$allow_fileupload = false;
232
+		} else {
233
+			$allow_fileupload = true;
234
+		}
207 235
 		// content_style setting
208
-		if(!$option->content_style) $option->content_style = 'ckeditor_light';
236
+		if(!$option->content_style) {
237
+			$option->content_style = 'ckeditor_light';
238
+		}
209 239
 		Context::set('content_style', $option->content_style);
210 240
 		Context::set('content_style_path', getScriptPath() . ltrim($this->module_path, './') . 'styles/' . $option->content_style);
211 241
 		// Default font setting
@@ -213,27 +243,47 @@  discard block
 block discarded – undo
213 243
 		Context::set('content_font_size', $option->content_font_size);
214 244
 
215 245
 		// Option setting to allow auto-save
216
-		if(!$option->enable_autosave) $enable_autosave = false;
217
-		elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
218
-		else $enable_autosave = true;
246
+		if(!$option->enable_autosave) {
247
+			$enable_autosave = false;
248
+		} elseif(Context::get($option->primary_key_name)) {
249
+			$enable_autosave = false;
250
+		} else {
251
+			$enable_autosave = true;
252
+		}
219 253
 		// Option setting to allow the default editor component
220
-		if(!$option->enable_default_component) $enable_default_component = false;
221
-		else $enable_default_component = true;
254
+		if(!$option->enable_default_component) {
255
+			$enable_default_component = false;
256
+		} else {
257
+			$enable_default_component = true;
258
+		}
222 259
 		// Option setting to allow other extended components
223
-		if(!$option->enable_component) $enable_component = false;
224
-		else $enable_component = true;
260
+		if(!$option->enable_component) {
261
+			$enable_component = false;
262
+		} else {
263
+			$enable_component = true;
264
+		}
225 265
 		// Setting for html-mode
226
-		if($option->disable_html) $html_mode = false;
227
-		else $html_mode = true;
266
+		if($option->disable_html) {
267
+			$html_mode = false;
268
+		} else {
269
+			$html_mode = true;
270
+		}
228 271
 		// Set Height
229
-		if(!$option->height) $editor_height = 300;
230
-		else $editor_height = $option->height;
272
+		if(!$option->height) {
273
+			$editor_height = 300;
274
+		} else {
275
+			$editor_height = $option->height;
276
+		}
231 277
 		// Skin Setting
232 278
 		$skin = $option->skin;
233
-		if(!$skin) $skin = 'ckeditor';
279
+		if(!$skin) {
280
+			$skin = 'ckeditor';
281
+		}
234 282
 
235 283
 		$colorset = $option->colorset;
236
-		if(!$colorset) $colorset = 'moono';
284
+		if(!$colorset) {
285
+			$colorset = 'moono';
286
+		}
237 287
 		Context::set('colorset', $colorset);
238 288
 		Context::set('skin', $skin);
239 289
 		Context::set('module_type', $option->module_type);
@@ -258,10 +308,13 @@  discard block
 block discarded – undo
258 308
 		/**
259 309
 		 * Extract editor's unique number (in order to display multiple editors on a single page)
260 310
 		 */
261
-		if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
262
-		else
311
+		if($option->editor_sequence) {
312
+			$editor_sequence = $option->editor_sequence;
313
+		} else
263 314
 		{
264
-			if(!$_SESSION['_editor_sequence_']) $_SESSION['_editor_sequence_'] = 1;
315
+			if(!$_SESSION['_editor_sequence_']) {
316
+				$_SESSION['_editor_sequence_'] = 1;
317
+			}
265 318
 			$editor_sequence = $_SESSION['_editor_sequence_'] ++;
266 319
 		}
267 320
 
@@ -285,7 +338,9 @@  discard block
 block discarded – undo
285 338
 			$oFileController = getController('file');
286 339
 			$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
287 340
 			// Check if the file already exists
288
-			if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
341
+			if($upload_target_srl) {
342
+				$files_count = $oFileModel->getFilesCount($upload_target_srl);
343
+			}
289 344
 		}
290 345
 		Context::set('files_count', (int)$files_count);
291 346
 
@@ -377,8 +432,7 @@  discard block
 block discarded – undo
377 432
 			$config->enable_html_grant = $editor_config->enable_html_grant;
378 433
 			$config->editor_height = $editor_config->editor_height;
379 434
 			$config->enable_autosave = $editor_config->enable_autosave;
380
-		}
381
-		else
435
+		} else
382 436
 		{
383 437
 			$config->editor_skin = $editor_config->comment_editor_skin;
384 438
 			$config->content_style = $editor_config->comment_content_style;
@@ -397,8 +451,7 @@  discard block
 block discarded – undo
397 451
 		{
398 452
 			$logged_info = Context::get('logged_info');
399 453
 			$group_list = $logged_info->group_list;
400
-		}
401
-		else
454
+		} else
402 455
 		{
403 456
 			$group_list = array();
404 457
 		}
@@ -412,8 +465,9 @@  discard block
 block discarded – undo
412 465
 		$option->colorset = $config->sel_editor_colorset;
413 466
 		// Permission check for file upload
414 467
 		$option->allow_fileupload = false;
415
-		if($logged_info->is_admin=='Y') $option->allow_fileupload = true;
416
-		elseif(count($config->upload_file_grant))
468
+		if($logged_info->is_admin=='Y') {
469
+			$option->allow_fileupload = true;
470
+		} elseif(count($config->upload_file_grant))
417 471
 		{
418 472
 			foreach($group_list as $group_srl => $group_info)
419 473
 			{
@@ -423,12 +477,14 @@  discard block
 block discarded – undo
423 477
 					break;
424 478
 				}
425 479
 			}
480
+		} else {
481
+			$option->allow_fileupload = true;
426 482
 		}
427
-		else $option->allow_fileupload = true;
428 483
 		// Permission check for using default components
429 484
 		$option->enable_default_component = false;
430
-		if($logged_info->is_admin=='Y') $option->enable_default_component = true;
431
-		elseif(count($config->enable_default_component_grant))
485
+		if($logged_info->is_admin=='Y') {
486
+			$option->enable_default_component = true;
487
+		} elseif(count($config->enable_default_component_grant))
432 488
 		{
433 489
 			foreach($group_list as $group_srl => $group_info)
434 490
 			{
@@ -438,12 +494,14 @@  discard block
 block discarded – undo
438 494
 					break;
439 495
 				}
440 496
 			}
497
+		} else {
498
+			$option->enable_default_component = true;
441 499
 		}
442
-		else $option->enable_default_component = true;
443 500
 		// Permisshion check for using extended components
444 501
 		$option->enable_component = false;
445
-		if($logged_info->is_admin=='Y') $option->enable_component = true;
446
-		elseif(count($config->enable_component_grant))
502
+		if($logged_info->is_admin=='Y') {
503
+			$option->enable_component = true;
504
+		} elseif(count($config->enable_component_grant))
447 505
 		{
448 506
 			foreach($group_list as $group_srl => $group_info)
449 507
 			{
@@ -453,12 +511,14 @@  discard block
 block discarded – undo
453 511
 					break;
454 512
 				}
455 513
 			}
514
+		} else {
515
+			$option->enable_component = true;
456 516
 		}
457
-		else $option->enable_component = true;
458 517
 		// HTML editing privileges
459 518
 		$enable_html = false;
460
-		if($logged_info->is_admin=='Y') $enable_html = true;
461
-		elseif(count($config->enable_html_grant))
519
+		if($logged_info->is_admin=='Y') {
520
+			$enable_html = true;
521
+		} elseif(count($config->enable_html_grant))
462 522
 		{
463 523
 			foreach($group_list as $group_srl => $group_info)
464 524
 			{
@@ -468,11 +528,15 @@  discard block
 block discarded – undo
468 528
 					break;
469 529
 				}
470 530
 			}
531
+		} else {
532
+			$enable_html = true;
471 533
 		}
472
-		else $enable_html = true;
473 534
 
474
-		if($enable_html) $option->disable_html = false;
475
-		else $option->disable_html = true;
535
+		if($enable_html) {
536
+			$option->disable_html = false;
537
+		} else {
538
+			$option->disable_html = true;
539
+		}
476 540
 		// Set Height
477 541
 		$option->height = $config->editor_height;
478 542
 		// Set an option for Auto-save
@@ -495,8 +559,7 @@  discard block
 block discarded – undo
495 559
 		{
496 560
 			$logged_info = Context::get('logged_info');
497 561
 			$auto_save_args->member_srl = $logged_info->member_srl;
498
-		}
499
-		else
562
+		} else
500 563
 		{
501 564
 			$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
502 565
 		}
@@ -511,11 +574,15 @@  discard block
 block discarded – undo
511 574
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
512 575
 		$saved_doc = $output->data;
513 576
 		// Return null if no result is auto-saved
514
-		if(!$saved_doc) return;
577
+		if(!$saved_doc) {
578
+			return;
579
+		}
515 580
 		// Check if the auto-saved document already exists
516 581
 		$oDocumentModel = getModel('document');
517 582
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
518
-		if($oSaved->isExists()) return;
583
+		if($oSaved->isExists()) {
584
+			return;
585
+		}
519 586
 		// Move all the files if the auto-saved data contains document_srl and file
520 587
 		// Then set document_srl to editor_sequence
521 588
 		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@@ -523,8 +590,9 @@  discard block
 block discarded – undo
523 590
 			$saved_doc->module_srl = $auto_save_args->module_srl;
524 591
 			$oFileController = getController('file');
525 592
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
593
+		} else if($upload_target_srl) {
594
+			$saved_doc->document_srl = $upload_target_srl;
526 595
 		}
527
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
528 596
 		// Change auto-saved data
529 597
 		$oEditorController = getController('editor');
530 598
 		$oEditorController->deleteSavedDoc(false);
@@ -540,18 +608,24 @@  discard block
 block discarded – undo
540 608
 	 */
541 609
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
542 610
 	{
543
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
611
+		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) {
612
+			return;
613
+		}
544 614
 
545 615
 		if(!$this->loaded_component_list[$component][$editor_sequence])
546 616
 		{
547 617
 			// Create an object of the component and execute
548 618
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
549 619
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
550
-			if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
620
+			if(!file_exists($class_file)) {
621
+				return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
622
+			}
551 623
 			// Create an object after loading the class file
552 624
 			require_once($class_file);
553 625
 			$oComponent = new $component($editor_sequence, $class_path);
554
-			if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
626
+			if(!$oComponent) {
627
+				return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
628
+			}
555 629
 			// Add configuration information
556 630
 			$component_info = $this->getComponent($component, $site_srl);
557 631
 			$oComponent->setInfo($component_info);
@@ -578,8 +652,12 @@  discard block
 block discarded – undo
578 652
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
579 653
 		FileHandler::makeDir($cache_path);
580 654
 		$cache_file = $cache_path.'component_list.' . $lang .'.';
581
-		if($filter_enabled) $cache_file .= 'filter.';
582
-		if($site_srl) $cache_file .= $site_srl.'.';
655
+		if($filter_enabled) {
656
+			$cache_file .= 'filter.';
657
+		}
658
+		if($site_srl) {
659
+			$cache_file .= $site_srl.'.';
660
+		}
583 661
 		$cache_file .= 'php';
584 662
 		return $cache_file;
585 663
 	}
@@ -596,14 +674,15 @@  discard block
 block discarded – undo
596 674
 			$oEditorController->makeCache(false, $site_srl);
597 675
 		}
598 676
 
599
-		if(!file_exists($cache_file)) return;
677
+		if(!file_exists($cache_file)) {
678
+			return;
679
+		}
600 680
 		include($cache_file);
601 681
 		$logged_info = Context::get('logged_info');
602 682
 		if($logged_info && is_array($logged_info->group_list))
603 683
 		{
604 684
 			$group_list = array_keys($logged_info->group_list);
605
-		}
606
-		else
685
+		} else
607 686
 		{
608 687
 			$group_list = array();
609 688
 		}
@@ -612,39 +691,50 @@  discard block
 block discarded – undo
612 691
 		{
613 692
 			foreach($component_list as $key => $val)
614 693
 			{
615
-				if(!trim($key)) continue;
694
+				if(!trim($key)) {
695
+					continue;
696
+				}
616 697
 				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
617 698
 				{
618 699
 					FileHandler::removeFile($cache_file);
619 700
 					return $this->getComponentList($filter_enabled, $site_srl);
620 701
 				}
621
-				if(!$filter_enabled) continue;
702
+				if(!$filter_enabled) {
703
+					continue;
704
+				}
622 705
 				if($val->enabled == "N")
623 706
 				{
624 707
 					unset($component_list->{$key});
625 708
 					continue;
626 709
 				}
627
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
710
+				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") {
711
+					continue;
712
+				}
628 713
 				if($val->target_group)
629 714
 				{
630 715
 					if(!$logged_info)
631 716
 					{
632 717
 						$val->enabled = "N";
633
-					}
634
-					else
718
+					} else
635 719
 					{
636 720
 						$is_granted = false;
637 721
 						foreach($group_list as $group_srl)
638 722
 						{
639
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
723
+							if(in_array($group_srl, $val->target_group)) {
724
+								$is_granted = true;
725
+							}
726
+						}
727
+						if(!$is_granted) {
728
+							$val->enabled = "N";
640 729
 						}
641
-						if(!$is_granted) $val->enabled = "N";
642 730
 					}
643 731
 				}
644 732
 				if($val->enabled != "N" && $val->mid_list)
645 733
 				{
646 734
 					$mid = Context::get('mid');
647
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
735
+					if(!in_array($mid, $val->mid_list)) {
736
+						$val->enabled = "N";
737
+					}
648 738
 				}
649 739
 				if($val->enabled == "N")
650 740
 				{
@@ -668,14 +758,15 @@  discard block
 block discarded – undo
668 758
 		{
669 759
 			$args->site_srl = $site_srl;
670 760
 			$output = executeQuery('editor.getSiteComponent', $args);
671
-		}
672
-		else
761
+		} else
673 762
 		{
674 763
 			$output = executeQuery('editor.getComponent', $args);
675 764
 		}
676 765
 		$component = $output->data;
677 766
 
678
-		if(!$output->data) return false;
767
+		if(!$output->data) {
768
+			return false;
769
+		}
679 770
 
680 771
 		$component_name = $component->component_name;
681 772
 
@@ -754,8 +845,7 @@  discard block
 block discarded – undo
754 845
 			$component_info->homepage = $xml_doc->component->link->body;
755 846
 			$component_info->license = $xml_doc->component->license->body;
756 847
 			$component_info->license_link = $xml_doc->component->license->attrs->link;
757
-		}
758
-		else
848
+		} else
759 849
 		{
760 850
 			sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
761 851
 			$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -772,8 +862,11 @@  discard block
 block discarded – undo
772 862
 
773 863
 		// Author information
774 864
 		$author_list = array();
775
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
776
-		else $author_list = $xml_doc->component->author;
865
+		if(!is_array($xml_doc->component->author)) {
866
+			$author_list[] = $xml_doc->component->author;
867
+		} else {
868
+			$author_list = $xml_doc->component->author;
869
+		}
777 870
 
778 871
 		for($i = 0; $i < count($author_list); $i++)
779 872
 		{
Please login to merge, or discard this patch.