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/editor/editor.model.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -113,6 +113,11 @@  discard block
 block discarded – undo
113 113
 		Context::set('drComponentList',$drComponentInfo);
114 114
 	}
115 115
 
116
+	/**
117
+	 * @param string $drComponentName
118
+	 *
119
+	 * @return string
120
+	 */
116 121
 	function getDrComponentXmlInfo($drComponentName)
117 122
 	{
118 123
 		$lang_type = Context::getLangType();
@@ -191,6 +196,7 @@  discard block
 block discarded – undo
191 196
 	 * @brief Return the editor template
192 197
 	 * You can call upload_target_srl when modifying content
193 198
 	 * The upload_target_srl is used for a routine to check if an attachment exists
199
+	 * @param stdClass $option
194 200
 	 */
195 201
 	function getEditor($upload_target_srl = 0, $option = null)
196 202
 	{
@@ -486,6 +492,7 @@  discard block
 block discarded – undo
486 492
 
487 493
 	/**
488 494
 	 * @brief Get information which has been auto-saved
495
+	 * @param integer $upload_target_srl
489 496
 	 */
490 497
 	function getSavedDoc($upload_target_srl)
491 498
 	{
Please login to merge, or discard this patch.
Spacing   +143 added lines, -143 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;
@@ -492,31 +492,31 @@  discard block
 block discarded – undo
492 492
 		$auto_save_args = new stdClass();
493 493
 		$auto_save_args->module_srl = Context::get('module_srl');
494 494
 		// Get the current module if module_srl doesn't exist
495
-		if(!$auto_save_args->module_srl)
495
+		if (!$auto_save_args->module_srl)
496 496
 		{
497 497
 			$current_module_info = Context::get('current_module_info');
498 498
 			$auto_save_args->module_srl = $current_module_info->module_srl;
499 499
 		}
500 500
 		// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
501
-		if(Context::get('is_logged'))
501
+		if (Context::get('is_logged'))
502 502
 		{
503 503
 			$logged_info = Context::get('logged_info');
504 504
 			$auto_save_args->member_srl = $logged_info->member_srl;
505 505
 		}
506 506
 		else
507 507
 		{
508
-			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
508
+			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_'.$auto_save_args->module_srl];
509 509
 			// @see https://github.com/xpressengine/xe-core/issues/2208
510 510
 			// 변경 이전에 작성된 게시물 호환성 유지
511
-			if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
511
+			if (!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
512 512
 		}
513 513
 		// Extract auto-saved data from the DB
514 514
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
515 515
 		$saved_doc = $output->data;
516 516
 		// Return null if no result is auto-saved
517
-		if(!$saved_doc) return;
517
+		if (!$saved_doc) return;
518 518
 
519
-		if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
519
+		if ($saved_doc->certify_key && !isset($auto_save_args->certify_key))
520 520
 		{
521 521
 			return;
522 522
 		}
@@ -524,16 +524,16 @@  discard block
 block discarded – undo
524 524
 		// Check if the auto-saved document already exists
525 525
 		$oDocumentModel = getModel('document');
526 526
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
527
-		if($oSaved->isExists()) return;
527
+		if ($oSaved->isExists()) return;
528 528
 		// Move all the files if the auto-saved data contains document_srl and file
529 529
 		// Then set document_srl to editor_sequence
530
-		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
530
+		if ($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
531 531
 		{
532 532
 			$saved_doc->module_srl = $auto_save_args->module_srl;
533 533
 			$oFileController = getController('file');
534 534
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
535 535
 		}
536
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
536
+		else if ($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
537 537
 		// Change auto-saved data
538 538
 		$saved_doc->certify_key = $auto_save_args->certify_key;
539 539
 		$oEditorController = getController('editor');
@@ -550,18 +550,18 @@  discard block
 block discarded – undo
550 550
 	 */
551 551
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
552 552
 	{
553
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
553
+		if (!preg_match('/^[a-zA-Z0-9_-]+$/', $component) || !preg_match('/^[0-9]+$/', $editor_sequence.$site_srl)) return;
554 554
 
555
-		if(!$this->loaded_component_list[$component][$editor_sequence])
555
+		if (!$this->loaded_component_list[$component][$editor_sequence])
556 556
 		{
557 557
 			// Create an object of the component and execute
558 558
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
559 559
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
560
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
560
+			if (!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
561 561
 			// Create an object after loading the class file
562 562
 			require_once($class_file);
563 563
 			$oComponent = new $component($editor_sequence, $class_path);
564
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
564
+			if (!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
565 565
 			// Add configuration information
566 566
 			$component_info = $this->getComponent($component, $site_srl);
567 567
 			$oComponent->setInfo($component_info);
@@ -582,14 +582,14 @@  discard block
 block discarded – undo
582 582
 	/**
583 583
 	 * @brief Return the cache file name of editor component list
584 584
 	 */
585
-	function getCacheFile($filter_enabled= true, $site_srl = 0)
585
+	function getCacheFile($filter_enabled = true, $site_srl = 0)
586 586
 	{
587 587
 		$lang = Context::getLangType();
588 588
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
589 589
 		FileHandler::makeDir($cache_path);
590
-		$cache_file = $cache_path.'component_list.' . $lang .'.';
591
-		if($filter_enabled) $cache_file .= 'filter.';
592
-		if($site_srl) $cache_file .= $site_srl.'.';
590
+		$cache_file = $cache_path.'component_list.'.$lang.'.';
591
+		if ($filter_enabled) $cache_file .= 'filter.';
592
+		if ($site_srl) $cache_file .= $site_srl.'.';
593 593
 		$cache_file .= 'php';
594 594
 		return $cache_file;
595 595
 	}
@@ -597,19 +597,19 @@  discard block
 block discarded – undo
597 597
 	/**
598 598
 	 * @brief Return a component list (DB Information included)
599 599
 	 */
600
-	function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false)
600
+	function getComponentList($filter_enabled = true, $site_srl = 0, $from_db = false)
601 601
 	{
602 602
 		$cache_file = $this->getCacheFile(false, $site_srl);
603
-		if($from_db || !file_exists($cache_file))
603
+		if ($from_db || !file_exists($cache_file))
604 604
 		{
605 605
 			$oEditorController = getController('editor');
606 606
 			$oEditorController->makeCache(false, $site_srl);
607 607
 		}
608 608
 
609
-		if(!file_exists($cache_file)) return;
609
+		if (!file_exists($cache_file)) return;
610 610
 		include($cache_file);
611 611
 		$logged_info = Context::get('logged_info');
612
-		if($logged_info && is_array($logged_info->group_list))
612
+		if ($logged_info && is_array($logged_info->group_list))
613 613
 		{
614 614
 			$group_list = array_keys($logged_info->group_list);
615 615
 		}
@@ -618,45 +618,45 @@  discard block
 block discarded – undo
618 618
 			$group_list = array();
619 619
 		}
620 620
 
621
-		if(count($component_list))
621
+		if (count($component_list))
622 622
 		{
623
-			foreach($component_list as $key => $val)
623
+			foreach ($component_list as $key => $val)
624 624
 			{
625
-				if(!trim($key)) continue;
626
-				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
625
+				if (!trim($key)) continue;
626
+				if (!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
627 627
 				{
628 628
 					FileHandler::removeFile($cache_file);
629 629
 					return $this->getComponentList($filter_enabled, $site_srl);
630 630
 				}
631
-				if(!$filter_enabled) continue;
632
-				if($val->enabled == "N")
631
+				if (!$filter_enabled) continue;
632
+				if ($val->enabled == "N")
633 633
 				{
634 634
 					unset($component_list->{$key});
635 635
 					continue;
636 636
 				}
637
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
638
-				if($val->target_group)
637
+				if ($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
638
+				if ($val->target_group)
639 639
 				{
640
-					if(!$logged_info)
640
+					if (!$logged_info)
641 641
 					{
642 642
 						$val->enabled = "N";
643 643
 					}
644 644
 					else
645 645
 					{
646 646
 						$is_granted = false;
647
-						foreach($group_list as $group_srl)
647
+						foreach ($group_list as $group_srl)
648 648
 						{
649
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
649
+							if (in_array($group_srl, $val->target_group)) $is_granted = true;
650 650
 						}
651
-						if(!$is_granted) $val->enabled = "N";
651
+						if (!$is_granted) $val->enabled = "N";
652 652
 					}
653 653
 				}
654
-				if($val->enabled != "N" && $val->mid_list)
654
+				if ($val->enabled != "N" && $val->mid_list)
655 655
 				{
656 656
 					$mid = Context::get('mid');
657
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
657
+					if (!in_array($mid, $val->mid_list)) $val->enabled = "N";
658 658
 				}
659
-				if($val->enabled == "N")
659
+				if ($val->enabled == "N")
660 660
 				{
661 661
 					unset($component_list->{$key});
662 662
 					continue;
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 		$args = new stdClass();
675 675
 		$args->component_name = $component_name;
676 676
 
677
-		if($site_srl)
677
+		if ($site_srl)
678 678
 		{
679 679
 			$args->site_srl = $site_srl;
680 680
 			$output = executeQuery('editor.getSiteComponent', $args);
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 		}
686 686
 		$component = $output->data;
687 687
 
688
-		if(!$output->data) return false;
688
+		if (!$output->data) return false;
689 689
 
690 690
 		$component_name = $component->component_name;
691 691
 
@@ -697,25 +697,25 @@  discard block
 block discarded – undo
697 697
 
698 698
 		$xml_info->mid_list = array();
699 699
 
700
-		if($component->extra_vars)
700
+		if ($component->extra_vars)
701 701
 		{
702 702
 			$extra_vars = unserialize($component->extra_vars);
703 703
 
704
-			if($extra_vars->target_group)
704
+			if ($extra_vars->target_group)
705 705
 			{
706 706
 				$xml_info->target_group = $extra_vars->target_group;
707 707
 				unset($extra_vars->target_group);
708 708
 			}
709 709
 
710
-			if($extra_vars->mid_list)
710
+			if ($extra_vars->mid_list)
711 711
 			{
712 712
 				$xml_info->mid_list = $extra_vars->mid_list;
713 713
 				unset($extra_vars->mid_list);
714 714
 			}
715 715
 
716
-			if($xml_info->extra_vars)
716
+			if ($xml_info->extra_vars)
717 717
 			{
718
-				foreach($xml_info->extra_vars as $key => $val)
718
+				foreach ($xml_info->extra_vars as $key => $val)
719 719
 				{
720 720
 					$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
721 721
 				}
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 		$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
740 740
 
741 741
 		// Include and return xml file information if cached file exists
742
-		if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
742
+		if (file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file))
743 743
 		{
744 744
 			include($cache_file);
745 745
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		$component_info->component_name = $component;
757 757
 		$component_info->title = $xml_doc->component->title->body;
758 758
 
759
-		if($xml_doc->component->version)
759
+		if ($xml_doc->component->version)
760 760
 		{
761 761
 			$component_info->description = str_replace('\n', "\n", $xml_doc->component->description->body);
762 762
 			$component_info->version = $xml_doc->component->version->body;
@@ -782,10 +782,10 @@  discard block
 block discarded – undo
782 782
 
783 783
 		// Author information
784 784
 		$author_list = array();
785
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
785
+		if (!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
786 786
 		else $author_list = $xml_doc->component->author;
787 787
 
788
-		for($i = 0; $i < count($author_list); $i++)
788
+		for ($i = 0; $i < count($author_list); $i++)
789 789
 		{
790 790
 			$author = new stdClass;
791 791
 			$author->name = $author_list[$i]->name->body;
@@ -796,39 +796,39 @@  discard block
 block discarded – undo
796 796
 
797 797
 		// List extra variables (text type only for editor component)
798 798
 		$extra_vars = $xml_doc->component->extra_vars;
799
-		if($extra_vars)
799
+		if ($extra_vars)
800 800
 		{
801 801
 			$extra_var_groups = $extra_vars->group;
802
-			if(!$extra_var_groups)
802
+			if (!$extra_var_groups)
803 803
 			{
804 804
 				$extra_var_groups = $extra_vars;
805 805
 			}
806
-			if(!is_array($extra_var_groups))
806
+			if (!is_array($extra_var_groups))
807 807
 			{
808 808
 				$extra_var_groups = array($extra_var_groups);
809 809
 			}
810 810
 
811
-			foreach($extra_var_groups as $group)
811
+			foreach ($extra_var_groups as $group)
812 812
 			{
813 813
 				$extra_vars = $group->var;
814
-				if(!is_array($group->var))
814
+				if (!is_array($group->var))
815 815
 				{
816 816
 					$extra_vars = array($group->var);
817 817
 				}
818 818
 
819
-				foreach($extra_vars as $key => $val)
819
+				foreach ($extra_vars as $key => $val)
820 820
 				{
821
-					if(!$val)
821
+					if (!$val)
822 822
 					{
823 823
 						continue;
824 824
 					}
825 825
 
826 826
 					$obj = new stdClass();
827
-					if(!$val->attrs)
827
+					if (!$val->attrs)
828 828
 					{
829 829
 						$val->attrs = new stdClass();
830 830
 					}
831
-					if(!$val->attrs->type)
831
+					if (!$val->attrs->type)
832 832
 					{
833 833
 						$val->attrs->type = 'text';
834 834
 					}
@@ -838,26 +838,26 @@  discard block
 block discarded – undo
838 838
 					$obj->title = $val->title->body;
839 839
 					$obj->type = $val->attrs->type;
840 840
 					$obj->description = $val->description->body;
841
-					if($obj->name)
841
+					if ($obj->name)
842 842
 					{
843 843
 						$obj->value = $extra_vals->{$obj->name};
844 844
 					}
845
-					if(strpos($obj->value, '|@|') != FALSE)
845
+					if (strpos($obj->value, '|@|') != FALSE)
846 846
 					{
847 847
 						$obj->value = explode('|@|', $obj->value);
848 848
 					}
849
-					if($obj->type == 'mid_list' && !is_array($obj->value))
849
+					if ($obj->type == 'mid_list' && !is_array($obj->value))
850 850
 					{
851 851
 						$obj->value = array($obj->value);
852 852
 					}
853 853
 
854 854
 					// 'Select'type obtained from the option list.
855
-					if($val->options && !is_array($val->options))
855
+					if ($val->options && !is_array($val->options))
856 856
 					{
857 857
 						$val->options = array($val->options);
858 858
 					}
859 859
 
860
-					for($i = 0, $c = count($val->options); $i < $c; $i++)
860
+					for ($i = 0, $c = count($val->options); $i < $c; $i++)
861 861
 					{
862 862
 						$obj->options[$i] = new stdClass();
863 863
 						$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 
872 872
 		$buff = array();
873 873
 		$buff[] = '<?php if(!defined(\'__XE__\')) exit();';
874
-		$buff[] = '$xml_info = ' . var_export($component_info, TRUE) . ';';
874
+		$buff[] = '$xml_info = '.var_export($component_info, TRUE).';';
875 875
 		$buff = str_replace('stdClass::__set_state', '(object)', implode(PHP_EOL, $buff));
876 876
 
877 877
 		FileHandler::writeFile($cache_file, $buff, 'w');
Please login to merge, or discard this patch.
Braces   +176 added lines, -81 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
@@ -502,19 +566,22 @@  discard block
 block discarded – undo
502 566
 		{
503 567
 			$logged_info = Context::get('logged_info');
504 568
 			$auto_save_args->member_srl = $logged_info->member_srl;
505
-		}
506
-		else
569
+		} else
507 570
 		{
508 571
 			$auto_save_args->certify_key = $_COOKIE['autosave_certify_key_' . $auto_save_args->module_srl];
509 572
 			// @see https://github.com/xpressengine/xe-core/issues/2208
510 573
 			// 변경 이전에 작성된 게시물 호환성 유지
511
-			if(!$auto_save_args->certify_key) $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
574
+			if(!$auto_save_args->certify_key) {
575
+				$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
576
+			}
512 577
 		}
513 578
 		// Extract auto-saved data from the DB
514 579
 		$output = executeQuery('editor.getSavedDocument', $auto_save_args);
515 580
 		$saved_doc = $output->data;
516 581
 		// Return null if no result is auto-saved
517
-		if(!$saved_doc) return;
582
+		if(!$saved_doc) {
583
+			return;
584
+		}
518 585
 
519 586
 		if($saved_doc->certify_key && !isset($auto_save_args->certify_key))
520 587
 		{
@@ -524,7 +591,9 @@  discard block
 block discarded – undo
524 591
 		// Check if the auto-saved document already exists
525 592
 		$oDocumentModel = getModel('document');
526 593
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
527
-		if($oSaved->isExists()) return;
594
+		if($oSaved->isExists()) {
595
+			return;
596
+		}
528 597
 		// Move all the files if the auto-saved data contains document_srl and file
529 598
 		// Then set document_srl to editor_sequence
530 599
 		if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl'))
@@ -532,8 +601,9 @@  discard block
 block discarded – undo
532 601
 			$saved_doc->module_srl = $auto_save_args->module_srl;
533 602
 			$oFileController = getController('file');
534 603
 			$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
604
+		} else if($upload_target_srl) {
605
+			$saved_doc->document_srl = $upload_target_srl;
535 606
 		}
536
-		else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
537 607
 		// Change auto-saved data
538 608
 		$saved_doc->certify_key = $auto_save_args->certify_key;
539 609
 		$oEditorController = getController('editor');
@@ -550,18 +620,24 @@  discard block
 block discarded – undo
550 620
 	 */
551 621
 	function getComponentObject($component, $editor_sequence = 0, $site_srl = 0)
552 622
 	{
553
-		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
623
+		if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) {
624
+			return;
625
+		}
554 626
 
555 627
 		if(!$this->loaded_component_list[$component][$editor_sequence])
556 628
 		{
557 629
 			// Create an object of the component and execute
558 630
 			$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
559 631
 			$class_file = sprintf('%s%s.class.php', $class_path, $component);
560
-			if(!file_exists($class_file)) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
632
+			if(!file_exists($class_file)) {
633
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
634
+			}
561 635
 			// Create an object after loading the class file
562 636
 			require_once($class_file);
563 637
 			$oComponent = new $component($editor_sequence, $class_path);
564
-			if(!$oComponent) return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
638
+			if(!$oComponent) {
639
+				return new BaseObject(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
640
+			}
565 641
 			// Add configuration information
566 642
 			$component_info = $this->getComponent($component, $site_srl);
567 643
 			$oComponent->setInfo($component_info);
@@ -588,8 +664,12 @@  discard block
 block discarded – undo
588 664
 		$cache_path = _XE_PATH_.'files/cache/editor/cache/';
589 665
 		FileHandler::makeDir($cache_path);
590 666
 		$cache_file = $cache_path.'component_list.' . $lang .'.';
591
-		if($filter_enabled) $cache_file .= 'filter.';
592
-		if($site_srl) $cache_file .= $site_srl.'.';
667
+		if($filter_enabled) {
668
+			$cache_file .= 'filter.';
669
+		}
670
+		if($site_srl) {
671
+			$cache_file .= $site_srl.'.';
672
+		}
593 673
 		$cache_file .= 'php';
594 674
 		return $cache_file;
595 675
 	}
@@ -606,14 +686,15 @@  discard block
 block discarded – undo
606 686
 			$oEditorController->makeCache(false, $site_srl);
607 687
 		}
608 688
 
609
-		if(!file_exists($cache_file)) return;
689
+		if(!file_exists($cache_file)) {
690
+			return;
691
+		}
610 692
 		include($cache_file);
611 693
 		$logged_info = Context::get('logged_info');
612 694
 		if($logged_info && is_array($logged_info->group_list))
613 695
 		{
614 696
 			$group_list = array_keys($logged_info->group_list);
615
-		}
616
-		else
697
+		} else
617 698
 		{
618 699
 			$group_list = array();
619 700
 		}
@@ -622,39 +703,50 @@  discard block
 block discarded – undo
622 703
 		{
623 704
 			foreach($component_list as $key => $val)
624 705
 			{
625
-				if(!trim($key)) continue;
706
+				if(!trim($key)) {
707
+					continue;
708
+				}
626 709
 				if(!is_dir(_XE_PATH_.'modules/editor/components/'.$key))
627 710
 				{
628 711
 					FileHandler::removeFile($cache_file);
629 712
 					return $this->getComponentList($filter_enabled, $site_srl);
630 713
 				}
631
-				if(!$filter_enabled) continue;
714
+				if(!$filter_enabled) {
715
+					continue;
716
+				}
632 717
 				if($val->enabled == "N")
633 718
 				{
634 719
 					unset($component_list->{$key});
635 720
 					continue;
636 721
 				}
637
-				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") continue;
722
+				if($logged_info->is_admin == "Y" || $logged_info->is_site_admin == "Y") {
723
+					continue;
724
+				}
638 725
 				if($val->target_group)
639 726
 				{
640 727
 					if(!$logged_info)
641 728
 					{
642 729
 						$val->enabled = "N";
643
-					}
644
-					else
730
+					} else
645 731
 					{
646 732
 						$is_granted = false;
647 733
 						foreach($group_list as $group_srl)
648 734
 						{
649
-							if(in_array($group_srl, $val->target_group)) $is_granted = true;
735
+							if(in_array($group_srl, $val->target_group)) {
736
+								$is_granted = true;
737
+							}
738
+						}
739
+						if(!$is_granted) {
740
+							$val->enabled = "N";
650 741
 						}
651
-						if(!$is_granted) $val->enabled = "N";
652 742
 					}
653 743
 				}
654 744
 				if($val->enabled != "N" && $val->mid_list)
655 745
 				{
656 746
 					$mid = Context::get('mid');
657
-					if(!in_array($mid, $val->mid_list)) $val->enabled = "N";
747
+					if(!in_array($mid, $val->mid_list)) {
748
+						$val->enabled = "N";
749
+					}
658 750
 				}
659 751
 				if($val->enabled == "N")
660 752
 				{
@@ -678,14 +770,15 @@  discard block
 block discarded – undo
678 770
 		{
679 771
 			$args->site_srl = $site_srl;
680 772
 			$output = executeQuery('editor.getSiteComponent', $args);
681
-		}
682
-		else
773
+		} else
683 774
 		{
684 775
 			$output = executeQuery('editor.getComponent', $args);
685 776
 		}
686 777
 		$component = $output->data;
687 778
 
688
-		if(!$output->data) return false;
779
+		if(!$output->data) {
780
+			return false;
781
+		}
689 782
 
690 783
 		$component_name = $component->component_name;
691 784
 
@@ -764,8 +857,7 @@  discard block
 block discarded – undo
764 857
 			$component_info->homepage = $xml_doc->component->link->body;
765 858
 			$component_info->license = $xml_doc->component->license->body;
766 859
 			$component_info->license_link = $xml_doc->component->license->attrs->link;
767
-		}
768
-		else
860
+		} else
769 861
 		{
770 862
 			sscanf($xml_doc->component->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
771 863
 			$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -782,8 +874,11 @@  discard block
 block discarded – undo
782 874
 
783 875
 		// Author information
784 876
 		$author_list = array();
785
-		if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
786
-		else $author_list = $xml_doc->component->author;
877
+		if(!is_array($xml_doc->component->author)) {
878
+			$author_list[] = $xml_doc->component->author;
879
+		} else {
880
+			$author_list = $xml_doc->component->author;
881
+		}
787 882
 
788 883
 		for($i = 0; $i < count($author_list); $i++)
789 884
 		{
Please login to merge, or discard this patch.
modules/module/module.model.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -1038,6 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 	/**
1039 1039
 	 * @brief Get a list of skins for the module
1040 1040
 	 * Return file analysis of skin and skin.xml
1041
+	 * @param string $path
1041 1042
 	 */
1042 1043
 	function getSkins($path, $dir = 'skins')
1043 1044
 	{
@@ -1362,6 +1363,7 @@  discard block
 block discarded – undo
1362 1363
 	/**
1363 1364
 	 * @brief Return module configurations
1364 1365
 	 * Global configuration is used to manage board, member and others
1366
+	 * @param string $module
1365 1367
 	 */
1366 1368
 	function getModuleConfig($module, $site_srl = 0)
1367 1369
 	{
Please login to merge, or discard this patch.
Spacing   +369 added lines, -369 removed lines patch added patch discarded remove patch
@@ -19,26 +19,26 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if (!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i', $id)) return true;
23 23
 		// directory and rss/atom/api reserved checking, etc.
24 24
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 25
 		$dirs[] = 'rss';
26 26
 		$dirs[] = 'atom';
27 27
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
28
+		if (in_array($id, $dirs)) return true;
29 29
 		// mid test
30 30
 		$args = new stdClass();
31 31
 		$args->mid = $id;
32 32
 		$args->site_srl = $site_srl;
33 33
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
34
+		if ($output->data->count) return true;
35 35
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36
-		if(!$site_srl)
36
+		if (!$site_srl)
37 37
 		{
38 38
 			$site_args = new stdClass();
39 39
 			$site_args->domain = $id;
40 40
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
41
+			if ($output->data->count) return true;
42 42
 		}
43 43
 
44 44
 		return false;
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
 	function getDefaultMid()
83 83
 	{
84 84
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
85
+		if ($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
86 86
 
87 87
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
88
+		if ($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
89 89
 
90 90
 		$default_url_parse = parse_url($default_url);
91 91
 		$request_url_parse = parse_url($request_url);
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
 		// Set up
96 96
 		$domain = '';
97 97
 		$site_info = NULL;
98
-		if($default_url && $default_url_parse['host'] != $request_url_parse['host'])
98
+		if ($default_url && $default_url_parse['host'] != $request_url_parse['host'])
99 99
 		{
100 100
 			$hostname = $request_url_parse['host'];
101 101
 			$path = $request_url_parse['path'];
102 102
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
103
+			if (strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
104 104
 
105
-			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
105
+			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80) ? ':'.$port : '', $path);
106 106
 		}
107 107
 
108
-		if($domain === '')
108
+		if ($domain === '')
109 109
 		{
110
-			if(!$vid) $vid = $mid;
111
-			if($vid)
110
+			if (!$vid) $vid = $mid;
111
+			if ($vid)
112 112
 			{
113 113
 				$domain = $vid;
114 114
 			}
@@ -116,89 +116,89 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
118 118
 		// If domain is set, look for subsite
119
-		if($domain !== '')
119
+		if ($domain !== '')
120 120
 		{
121 121
 			$site_info = false;
122
-			if($oCacheHandler->isSupport())
122
+			if ($oCacheHandler->isSupport())
123 123
 			{
124
-				$object_key = 'site_info:' . md5($domain);
124
+				$object_key = 'site_info:'.md5($domain);
125 125
 				$domain_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
126 126
 				$site_info = $oCacheHandler->get($domain_cache_key);
127 127
 			}
128 128
 
129
-			if($site_info === false)
129
+			if ($site_info === false)
130 130
 			{
131 131
 				$args = new stdClass();
132 132
 				$args->domain = $domain;
133 133
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 134
 				$site_info = $output->data;
135 135
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
136
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
137 137
 			}
138 138
 
139
-			if($site_info && $vid)
139
+			if ($site_info && $vid)
140 140
 			{
141 141
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
142
+				if (strtolower($mid) == strtolower($site_info->domain)) Context::set('mid', $site_info->mid, true);
143 143
 			}
144
-			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
144
+			if (!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 145
 		}
146 146
 
147 147
 		// If no virtual website was found, get default website
148
-		if($domain === '')
148
+		if ($domain === '')
149 149
 		{
150 150
 			$site_info = false;
151
-			if($oCacheHandler->isSupport())
151
+			if ($oCacheHandler->isSupport())
152 152
 			{
153 153
 				$object_key = 'default_site';
154 154
 				$default_site_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
155 155
 				$site_info = $oCacheHandler->get($default_site_cache_key);
156 156
 			}
157 157
 
158
-			if($site_info === false)
158
+			if ($site_info === false)
159 159
 			{
160 160
 				$args = new stdClass();
161 161
 				$args->site_srl = 0;
162 162
 				$output = executeQuery('module.getSiteInfo', $args);
163 163
 				// Update the related informaion if there is no default site info
164
-				if(!$output->data)
164
+				if (!$output->data)
165 165
 				{
166 166
 					// Create a table if sites table doesn't exist
167 167
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
168
+					if (!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
+					if (!$oDB->isTableExists('sites')) return;
170 170
 
171 171
 					// Get mid, language
172 172
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
173 173
 					$db_info = Context::getDBInfo();
174 174
 					$domain = Context::getDefaultUrl();
175 175
 					$url_info = parse_url($domain);
176
-					$domain = $url_info['host'].( (!empty($url_info['port'])&&$url_info['port']!=80)?':'.$url_info['port']:'').$url_info['path'];
176
+					$domain = $url_info['host'].((!empty($url_info['port']) && $url_info['port'] != 80) ? ':'.$url_info['port'] : '').$url_info['path'];
177 177
 
178 178
 					$site_args = new stdClass;
179 179
 					$site_args->site_srl = 0;
180
-					$site_args->index_module_srl  = $mid_output->data->module_srl;
180
+					$site_args->index_module_srl = $mid_output->data->module_srl;
181 181
 					$site_args->domain = $domain;
182 182
 					$site_args->default_language = $db_info->lang_type;
183 183
 
184
-					if($output->data && !$output->data->index_module_srl)
184
+					if ($output->data && !$output->data->index_module_srl)
185 185
 					{
186 186
 						$output = executeQuery('module.updateSite', $site_args);
187 187
 					}
188 188
 					else
189 189
 					{
190 190
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
191
+						if (!$output->toBool()) return $output;
192 192
 					}
193 193
 					$output = executeQuery('module.getSiteInfo', $args);
194 194
 				}
195 195
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
196
+				if ($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
197 197
 			}
198 198
 		}
199 199
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
200
+		if (!$site_info->module_srl) return $site_info;
201
+		if (is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
202 202
 		return $this->addModuleExtraVars($site_info);
203 203
 	}
204 204
 
@@ -207,48 +207,48 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	function getModuleInfoByMid($mid, $site_srl = 0, $columnList = array())
209 209
 	{
210
-		if(!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
210
+		if (!$mid || ($mid && !preg_match("/^[a-z][a-z0-9_]+$/i", $mid)))
211 211
 		{
212 212
 			return;
213 213
 		}
214 214
 
215 215
 		$args = new stdClass();
216 216
 		$args->mid = $mid;
217
-		$args->site_srl = (int)$site_srl;
217
+		$args->site_srl = (int) $site_srl;
218 218
 
219 219
 		$module_srl = false;
220 220
 		$module_info = false;
221 221
 
222 222
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
223
-		if($oCacheHandler->isSupport())
223
+		if ($oCacheHandler->isSupport())
224 224
 		{
225 225
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
226 226
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
227 227
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
228
-			if($module_srl)
228
+			if ($module_srl)
229 229
 			{
230
-				$object_key = 'mid_info:' . $module_srl;
230
+				$object_key = 'mid_info:'.$module_srl;
231 231
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
232 232
 				$module_info = $oCacheHandler->get($module_info_cache_key);
233 233
 			}
234 234
 		}
235 235
 
236
-		if($module_info === false)
236
+		if ($module_info === false)
237 237
 		{
238 238
 			$output = executeQuery('module.getMidInfo', $args);
239 239
 			$module_info = $output->data;
240
-			if($oCacheHandler->isSupport())
240
+			if ($oCacheHandler->isSupport())
241 241
 			{
242 242
 				$oCacheHandler->put($module_srl_cache_key, $module_info->module_srl);
243 243
 
244
-				$object_key = 'mid_info:' . $module_info->module_srl;
244
+				$object_key = 'mid_info:'.$module_info->module_srl;
245 245
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
246 246
 				$oCacheHandler->put($module_info_cache_key, $module_info);
247 247
 			}
248 248
 		}
249 249
 
250 250
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
251
+		if (!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
252 252
 		return $this->addModuleExtraVars($module_info);
253 253
 	}
254 254
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$menuItemSrl = Context::get('menu_item_srl');
265 265
 		$menuItemSrl = (!$menuItemSrl) ? $menu_item_srl : $menuItemSrl;
266 266
 
267
-		if(!$menuItemSrl)
267
+		if (!$menuItemSrl)
268 268
 		{
269 269
 			$this->stop(-1, 'msg_invalid_request');
270 270
 			return;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		$args = new stdClass();
274 274
 		$args->menu_item_srl = $menuItemSrl;
275 275
 		$output = executeQuery('module.getModuleInfoByMenuItemSrl', $args);
276
-		if(!$output->toBool())
276
+		if (!$output->toBool())
277 277
 		{
278 278
 			return $output;
279 279
 		}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 		$layoutInfoMobile = $layoutSrlMobile ? $oLayoutModel->getLayoutRawData($layoutSrlMobile, array('title')) : NULL;
298 298
 		$skinInfoPc = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNamePc);
299 299
 		$skinInfoMobile = $this->loadSkinInfo(Modulehandler::getModulePath($moduleInfo->module), $skinNameMobile, 'm.skins');
300
-		if(!$skinInfoPc)
300
+		if (!$skinInfoPc)
301 301
 		{
302 302
 			$skinInfoPc = new stdClass();
303 303
 			$skinInfoPc->title = $skinNamePc;
304 304
 		}
305
-		if(!$skinInfoMobile)
305
+		if (!$skinInfoMobile)
306 306
 		{
307 307
 			$skinInfoMobile = new stdClass();
308 308
 			$skinInfoMobile->title = $skinNameMobile;
@@ -321,23 +321,23 @@  discard block
 block discarded – undo
321 321
 		$mid_info = false;
322 322
 
323 323
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
324
-		if($oCacheHandler->isSupport())
324
+		if ($oCacheHandler->isSupport())
325 325
 		{
326 326
 			$object_key = 'module_srl:'.$mid.'_'.$site_srl;
327 327
 			$module_srl_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
328 328
 			$module_srl = $oCacheHandler->get($module_srl_cache_key);
329
-			if($module_srl)
329
+			if ($module_srl)
330 330
 			{
331
-				$object_key = 'mid_info:' . $module_srl;
331
+				$object_key = 'mid_info:'.$module_srl;
332 332
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
333 333
 				$mid_info = $oCacheHandler->get($module_info_cache_key);
334 334
 			}
335 335
 
336
-			if($mid_info === false)
336
+			if ($mid_info === false)
337 337
 			{
338 338
 				$oCacheHandler->put($module_srl_cache_key, $output->data->module_srl);
339 339
 
340
-				$object_key = 'mid_info:' . $output->data->module_srl;
340
+				$object_key = 'mid_info:'.$output->data->module_srl;
341 341
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 342
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343 343
 			}
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$moduleInfo = $this->addModuleExtraVars($moduleInfo);
352 352
 
353
-		if($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
353
+		if ($moduleInfo->module == 'page' && $moduleInfo->page_type != 'ARTICLE')
354 354
 		{
355 355
 			unset($moduleInfo->skin);
356 356
 			unset($moduleInfo->mskin);
@@ -369,32 +369,32 @@  discard block
 block discarded – undo
369 369
 		$mid_info = false;
370 370
 
371 371
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
372
-		if($oCacheHandler->isSupport())
372
+		if ($oCacheHandler->isSupport())
373 373
 		{
374
-			$object_key = 'mid_info:' . $module_srl;
374
+			$object_key = 'mid_info:'.$module_srl;
375 375
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
376 376
 			$mid_info = $oCacheHandler->get($cache_key);
377 377
 		}
378 378
 
379
-		if($mid_info === false)
379
+		if ($mid_info === false)
380 380
 		{
381 381
 			// Get data
382 382
 			$args = new stdClass();
383 383
 			$args->module_srl = $module_srl;
384 384
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
385
+			if (!$output->toBool()) return;
386 386
 
387 387
 			$mid_info = $output->data;
388 388
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
389
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
390 390
 		}
391 391
 
392
-		if($mid_info && count($columnList))
392
+		if ($mid_info && count($columnList))
393 393
 		{
394 394
 			$module_info = new stdClass();
395
-			foreach($mid_info as $key => $item)
395
+			foreach ($mid_info as $key => $item)
396 396
 			{
397
-				if(in_array($key, $columnList))
397
+				if (in_array($key, $columnList))
398 398
 				{
399 399
 					$module_info->$key = $item;
400 400
 				}
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		else $module_info = $mid_info;
404 404
 
405 405
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
406
+		if (isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
407 407
 
408 408
 		$this->applyDefaultSkin($module_info);
409 409
 		return $this->addModuleExtraVars($module_info);
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	private function applyDefaultSkin(&$moduleInfo)
418 418
 	{
419
-		if($moduleInfo->is_skin_fix == 'N')
419
+		if ($moduleInfo->is_skin_fix == 'N')
420 420
 		{
421 421
 			$moduleInfo->skin = '/USE_DEFAULT/';
422 422
 		}
423 423
 
424
-		if($moduleInfo->is_mskin_fix == 'N')
424
+		if ($moduleInfo->is_mskin_fix == 'N')
425 425
 		{
426 426
 			$moduleInfo->mskin = '/USE_DEFAULT/';
427 427
 		}
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$count = count($output->data);
440 440
 
441 441
 		$modules = array();
442
-		for($i=0;$i<$count;$i++)
442
+		for ($i = 0; $i < $count; $i++)
443 443
 		{
444 444
 			$modules[] = $output->data[$i];
445 445
 		}
@@ -451,11 +451,11 @@  discard block
 block discarded – undo
451 451
 	 */
452 452
 	function getModulesInfo($module_srls, $columnList = array())
453 453
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
454
+		if (is_array($module_srls)) $module_srls = implode(',', $module_srls);
455 455
 		$args = new stdClass();
456 456
 		$args->module_srls = $module_srls;
457 457
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
458
+		if (!$output->toBool()) return;
459 459
 		return $this->addModuleExtraVars($output->data);
460 460
 	}
461 461
 
@@ -465,31 +465,31 @@  discard block
 block discarded – undo
465 465
 	function addModuleExtraVars($module_info)
466 466
 	{
467 467
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
468
+		if (!is_array($module_info)) $target_module_info = array($module_info);
469 469
 		else $target_module_info = $module_info;
470 470
 		// Get module_srl
471 471
 		$module_srls = array();
472
-		foreach($target_module_info as $key => $val)
472
+		foreach ($target_module_info as $key => $val)
473 473
 		{
474 474
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
475
+			if (!$module_srl) continue;
476 476
 			$module_srls[] = $val->module_srl;
477 477
 		}
478 478
 		// Extract extra information of the module and skin
479 479
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
480
+		if (!count($module_srls) || !count($extra_vars)) return $module_info;
481 481
 
482
-		foreach($target_module_info as $key => $val)
482
+		foreach ($target_module_info as $key => $val)
483 483
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
-			foreach($extra_vars[$val->module_srl] as $k => $v)
484
+			if (!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
485
+			foreach ($extra_vars[$val->module_srl] as $k => $v)
486 486
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
487
+				if ($target_module_info[$key]->{$k}) continue;
488 488
 				$target_module_info[$key]->{$k} = $v;
489 489
 			}
490 490
 		}
491 491
 
492
-		if(is_array($module_info)) return $target_module_info;
492
+		if (is_array($module_info)) return $target_module_info;
493 493
 		return $target_module_info[0];
494 494
 	}
495 495
 
@@ -500,37 +500,37 @@  discard block
 block discarded – undo
500 500
 	{
501 501
 		$list = false;
502 502
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
503
-		if($oCacheHandler->isSupport())
503
+		if ($oCacheHandler->isSupport())
504 504
 		{
505
-			if(count($args) === 1 && isset($args->site_srl))
505
+			if (count($args) === 1 && isset($args->site_srl))
506 506
 			{
507
-				$object_key = 'module:mid_list_' . $args->site_srl;
507
+				$object_key = 'module:mid_list_'.$args->site_srl;
508 508
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
509 509
 				$list = $oCacheHandler->get($cache_key);
510 510
 			}
511 511
 		}
512 512
 
513
-		if($list === false)
513
+		if ($list === false)
514 514
 		{
515
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
515
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
516 516
 			{
517 517
 				$columnList = array();
518 518
 			}
519 519
 
520 520
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
521
+			if (!$output->toBool()) return $output;
522 522
 			$list = $output->data;
523 523
 
524
-			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
524
+			if ($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
525 525
 			{
526 526
 				$oCacheHandler->put($cache_key, $list);
527 527
 			}
528 528
 		}
529
-		if(!$list) return;
529
+		if (!$list) return;
530 530
 
531
-		if(!is_array($list)) $list = array($list);
531
+		if (!is_array($list)) $list = array($list);
532 532
 
533
-		foreach($list as $val)
533
+		foreach ($list as $val)
534 534
 		{
535 535
 			$mid_list[$val->mid] = $val;
536 536
 		}
@@ -544,10 +544,10 @@  discard block
 block discarded – undo
544 544
 	function getModuleSrlList($args = null, $columnList = array())
545 545
 	{
546 546
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
547
+		if (!$output->toBool()) return $output;
548 548
 
549 549
 		$list = $output->data;
550
-		if(!$list) return;
550
+		if (!$list) return;
551 551
 
552 552
 		return $list;
553 553
 	}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 	 */
558 558
 	function getModuleSrlByMid($mid)
559 559
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
560
+		if ($mid && !is_array($mid)) $mid = explode(',', $mid);
561
+		if (is_array($mid)) $mid = "'".implode("','", $mid)."'";
562 562
 
563 563
 		$site_module_info = Context::get('site_module_info');
564 564
 
565 565
 		$args = new stdClass;
566 566
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
567
+		if ($site_module_info) $args->site_srl = $site_module_info->site_srl;
568 568
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
569
+		if (!$output->toBool()) return $output;
570 570
 
571 571
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
572
+		if (!$list) return;
573
+		if (!is_array($list)) $list = array($list);
574 574
 
575
-		foreach($list as $key => $val)
575
+		foreach ($list as $key => $val)
576 576
 		{
577 577
 			$module_srl_list[] = $val->module_srl;
578 578
 		}
@@ -588,33 +588,33 @@  discard block
 block discarded – undo
588 588
 		$action_forward = false;
589 589
 		// cache controll
590 590
 		$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
591
-		if($oCacheHandler->isSupport())
591
+		if ($oCacheHandler->isSupport())
592 592
 		{
593 593
 			$cache_key = 'action_forward';
594 594
 			$action_forward = $oCacheHandler->get($cache_key);
595 595
 		}
596 596
 
597 597
 		// retrieve and caching all registered action_forward
598
-		if($action_forward === false)
598
+		if ($action_forward === false)
599 599
 		{
600 600
 			$args = new stdClass();
601
-			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
601
+			$output = executeQueryArray('module.getActionForward', $args);
602
+			if (!$output->toBool()) return new stdClass;
603
+			if (!$output->data) $output->data = array();
604 604
 
605 605
 			$action_forward = array();
606
-			foreach($output->data as $item)
606
+			foreach ($output->data as $item)
607 607
 			{
608 608
 				$action_forward[$item->act] = $item;
609 609
 			}
610 610
 
611
-			if($oCacheHandler->isSupport())
611
+			if ($oCacheHandler->isSupport())
612 612
 			{
613 613
 				$oCacheHandler->put($cache_key, $action_forward);
614 614
 			}
615 615
 		}
616 616
 
617
-		if($action_forward[$act])
617
+		if ($action_forward[$act])
618 618
 		{
619 619
 			return $action_forward[$act];
620 620
 		}
@@ -629,25 +629,25 @@  discard block
 block discarded – undo
629 629
 	 */
630 630
 	function getTriggers($trigger_name, $called_position)
631 631
 	{
632
-		if(is_null($GLOBALS['__triggers__']))
632
+		if (is_null($GLOBALS['__triggers__']))
633 633
 		{
634 634
 			$triggers = FALSE;
635 635
 			$oCacheHandler = CacheHandler::getInstance('object', NULL, TRUE);
636
-			if($oCacheHandler->isSupport())
636
+			if ($oCacheHandler->isSupport())
637 637
 			{
638 638
 				$cache_key = 'triggers';
639 639
 				$triggers = $oCacheHandler->get($cache_key);
640 640
 			}
641
-			if($triggers === FALSE)
641
+			if ($triggers === FALSE)
642 642
 			{
643 643
 				$output = executeQueryArray('module.getTriggers');
644 644
 				$triggers = $output->data;
645
-				if($output->toBool() && $oCacheHandler->isSupport())
645
+				if ($output->toBool() && $oCacheHandler->isSupport())
646 646
 				{
647 647
 					$oCacheHandler->put($cache_key, $triggers);
648 648
 				}
649 649
 			}
650
-			foreach($triggers as $item)
650
+			foreach ($triggers as $item)
651 651
 			{
652 652
 				$GLOBALS['__triggers__'][$item->trigger_name][$item->called_position][] = $item;
653 653
 			}
@@ -663,11 +663,11 @@  discard block
 block discarded – undo
663 663
 	{
664 664
 		$triggers = $this->getTriggers($trigger_name, $called_position);
665 665
 
666
-		if($triggers && is_array($triggers))
666
+		if ($triggers && is_array($triggers))
667 667
 		{
668
-			foreach($triggers as $item)
668
+			foreach ($triggers as $item)
669 669
 			{
670
-				if($item->module == $module && $item->type == $type && $item->called_method == $called_method)
670
+				if ($item->module == $module && $item->type == $type && $item->called_method == $called_method)
671 671
 				{
672 672
 					return $item;
673 673
 				}
@@ -680,12 +680,12 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @brief Get module extend
682 682
 	 */
683
-	function getModuleExtend($parent_module, $type, $kind='')
683
+	function getModuleExtend($parent_module, $type, $kind = '')
684 684
 	{
685 685
 		$key = $parent_module.'.'.$kind.'.'.$type;
686 686
 
687 687
 		$module_extend_info = $this->loadModuleExtends();
688
-		if(array_key_exists($key, $module_extend_info))
688
+		if (array_key_exists($key, $module_extend_info))
689 689
 		{
690 690
 			return $module_extend_info[$key];
691 691
 		}
@@ -701,29 +701,29 @@  discard block
 block discarded – undo
701 701
 		$cache_file = './files/config/module_extend.php';
702 702
 		$cache_file = FileHandler::getRealPath($cache_file);
703 703
 
704
-		if(!isset($GLOBALS['__MODULE_EXTEND__']))
704
+		if (!isset($GLOBALS['__MODULE_EXTEND__']))
705 705
 		{
706 706
 			// check pre install
707
-			if(file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
707
+			if (file_exists(FileHandler::getRealPath('./files')) && !file_exists($cache_file))
708 708
 			{
709 709
 				$arr = array();
710 710
 				$output = executeQueryArray('module.getModuleExtend');
711
-				if($output->data)
711
+				if ($output->data)
712 712
 				{
713
-					foreach($output->data as $v)
713
+					foreach ($output->data as $v)
714 714
 					{
715 715
 						$arr[] = sprintf("'%s.%s.%s' => '%s'", $v->parent_module, $v->kind, $v->type, $v->extend_module);
716 716
 					}
717 717
 				}
718 718
 
719 719
 				$str = '<?PHP return array(%s); ?>';
720
-				$str = sprintf($str, join(',',$arr));
720
+				$str = sprintf($str, join(',', $arr));
721 721
 
722 722
 				FileHandler::writeFile($cache_file, $str);
723 723
 			}
724 724
 
725 725
 
726
-			if(file_exists($cache_file))
726
+			if (file_exists($cache_file))
727 727
 			{
728 728
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729 729
 			}
@@ -743,20 +743,20 @@  discard block
 block discarded – undo
743 743
 	{
744 744
 		// Get a path of the requested module. Return if not exists.
745 745
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
746
+		if (!$module_path) return;
747 747
 		// Read the xml file for module skin information
748 748
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
749
+		if (!file_exists($xml_file)) return;
750 750
 
751 751
 		$oXmlParser = new XmlParser();
752 752
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 753
 		$xml_obj = $tmp_xml_obj->module;
754 754
 
755
-		if(!$xml_obj) return;
755
+		if (!$xml_obj) return;
756 756
 
757 757
 		// Module Information
758 758
 		$module_info = new stdClass();
759
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
759
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
760 760
 		{
761 761
 			// module format 0.2
762 762
 			$module_info->title = $xml_obj->title->body;
@@ -764,16 +764,16 @@  discard block
 block discarded – undo
764 764
 			$module_info->version = $xml_obj->version->body;
765 765
 			$module_info->homepage = $xml_obj->link->body;
766 766
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
767
+			if (!$module_info->category) $module_info->category = 'service';
768 768
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 769
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 770
 			$module_info->license = $xml_obj->license->body;
771 771
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 772
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
773
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774 774
 			else $author_list = $xml_obj->author;
775 775
 
776
-			foreach($author_list as $author)
776
+			foreach ($author_list as $author)
777 777
 			{
778 778
 				$author_obj = new stdClass();
779 779
 				$author_obj->name = $author->name->body;
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
 			$module_info->description = $xml_obj->author->description->body;
790 790
 			$module_info->version = $xml_obj->attrs->version;
791 791
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
792
+			if (!$module_info->category) $module_info->category = 'service';
793 793
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 794
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 795
 			$author_obj = new stdClass();
@@ -818,17 +818,17 @@  discard block
 block discarded – undo
818 818
 	{
819 819
 		// Get a path of the requested module. Return if not exists.
820 820
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
821
+		if (!$class_path) return;
822 822
 
823 823
 		// Check if module.xml exists in the path. Return if not exist
824 824
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
825
+		if (!file_exists($xml_file)) return;
826 826
 
827 827
 		// Check if cached file exists
828
-		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
828
+		$cache_file = sprintf(_XE_PATH_."files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
829 829
 
830 830
 		// Update if no cache file exists or it is older than xml file
831
-		if(!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
831
+		if (!file_exists($cache_file) || filemtime($cache_file) < filemtime($xml_file) || $re_cache)
832 832
 		{
833 833
 			$info = new stdClass();
834 834
 			$buff = array(); // /< Set buff variable to use in the cache file
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 
842 842
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 843
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
844
+			if (!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
845 845
 
846 846
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 847
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -851,17 +851,17 @@  discard block
 block discarded – undo
851 851
 			$default_index = $admin_index = '';
852 852
 
853 853
 			// Arrange permission information
854
-			if($grants)
854
+			if ($grants)
855 855
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
856
+				if (is_array($grants)) $grant_list = $grants;
857 857
 				else $grant_list[] = $grants;
858 858
 
859 859
 				$info->grant = new stdClass();
860 860
 				$buff[] = '$info->grant = new stdClass;';
861
-				foreach($grant_list as $grant)
861
+				foreach ($grant_list as $grant)
862 862
 				{
863 863
 					$name = $grant->attrs->name;
864
-					$default = $grant->attrs->default?$grant->attrs->default:'guest';
864
+					$default = $grant->attrs->default ? $grant->attrs->default : 'guest';
865 865
 					$title = $grant->title->body;
866 866
 
867 867
 					$info->grant->{$name} = new stdClass();
@@ -874,15 +874,15 @@  discard block
 block discarded – undo
874 874
 				}
875 875
 			}
876 876
 			// Permissions to grant
877
-			if($permissions)
877
+			if ($permissions)
878 878
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
879
+				if (is_array($permissions)) $permission_list = $permissions;
880 880
 				else $permission_list[] = $permissions;
881 881
 
882 882
 				$buff[] = '$info->permission = new stdClass;';
883 883
 
884 884
 				$info->permission = new stdClass();
885
-				foreach($permission_list as $permission)
885
+				foreach ($permission_list as $permission)
886 886
 				{
887 887
 					$action = $permission->attrs->action;
888 888
 					$target = $permission->attrs->target;
@@ -893,14 +893,14 @@  discard block
 block discarded – undo
893 893
 				}
894 894
 			}
895 895
 			// for admin menus
896
-			if($menus)
896
+			if ($menus)
897 897
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
898
+				if (is_array($menus)) $menu_list = $menus;
899 899
 				else $menu_list[] = $menus;
900 900
 
901 901
 				$buff[] = '$info->menu = new stdClass;';
902 902
 				$info->menu = new stdClass();
903
-				foreach($menu_list as $menu)
903
+				foreach ($menu_list as $menu)
904 904
 				{
905 905
 					$menu_name = $menu->attrs->name;
906 906
 					$menu_title = is_array($menu->title) ? $menu->title[0]->body : $menu->title->body;
@@ -918,23 +918,23 @@  discard block
 block discarded – undo
918 918
 			}
919 919
 
920 920
 			// actions
921
-			if($actions)
921
+			if ($actions)
922 922
 			{
923
-				if(is_array($actions)) $action_list = $actions;
923
+				if (is_array($actions)) $action_list = $actions;
924 924
 				else $action_list[] = $actions;
925 925
 
926 926
 				$buff[] = '$info->action = new stdClass;';
927 927
 				$info->action = new stdClass();
928
-				foreach($action_list as $action)
928
+				foreach ($action_list as $action)
929 929
 				{
930 930
 					$name = $action->attrs->name;
931 931
 
932 932
 					$type = $action->attrs->type;
933
-					$grant = $action->attrs->grant?$action->attrs->grant:'guest';
934
-					$standalone = $action->attrs->standalone=='false'?'false':'true';
935
-					$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
936
-					$method = $action->attrs->method?$action->attrs->method:'';
937
-					$check_csrf = $action->attrs->check_csrf=='false'?'false':'true';
933
+					$grant = $action->attrs->grant ? $action->attrs->grant : 'guest';
934
+					$standalone = $action->attrs->standalone == 'false' ? 'false' : 'true';
935
+					$ruleset = $action->attrs->ruleset ? $action->attrs->ruleset : '';
936
+					$method = $action->attrs->method ? $action->attrs->method : '';
937
+					$check_csrf = $action->attrs->check_csrf == 'false' ? 'false' : 'true';
938 938
 
939 939
 					$index = $action->attrs->index;
940 940
 					$admin_index = $action->attrs->admin_index;
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 					$info->action->{$name}->ruleset = $ruleset;
950 950
 					$info->action->{$name}->method = $method;
951 951
 					$info->action->{$name}->check_csrf = $check_csrf;
952
-					if($action->attrs->menu_name)
952
+					if ($action->attrs->menu_name)
953 953
 					{
954
-						if($menu_index == 'true')
954
+						if ($menu_index == 'true')
955 955
 						{
956 956
 							$info->menu->{$action->attrs->menu_name}->index = $name;
957 957
 							$buff[] = sprintf('$info->menu->%s->index=\'%s\';', $action->attrs->menu_name, $name);
958 958
 						}
959
-						if(is_array($info->menu->{$action->attrs->menu_name}->acts))
959
+						if (is_array($info->menu->{$action->attrs->menu_name}->acts))
960 960
 						{
961 961
 							$info->menu->{$action->attrs->menu_name}->acts[] = $name;
962 962
 							$currentKey = array_search($name, $info->menu->{$action->attrs->menu_name}->acts);
@@ -974,22 +974,22 @@  discard block
 block discarded – undo
974 974
 					$buff[] = sprintf('$info->action->%s->method=\'%s\';', $name, $method);
975 975
 					$buff[] = sprintf('$info->action->%s->check_csrf=\'%s\';', $name, $check_csrf);
976 976
 
977
-					if($index=='true')
977
+					if ($index == 'true')
978 978
 					{
979 979
 						$default_index_act = $name;
980 980
 						$info->default_index_act = $name;
981 981
 					}
982
-					if($admin_index=='true')
982
+					if ($admin_index == 'true')
983 983
 					{
984 984
 						$admin_index_act = $name;
985 985
 						$info->admin_index_act = $name;
986 986
 					}
987
-					if($setup_index=='true')
987
+					if ($setup_index == 'true')
988 988
 					{
989 989
 						$setup_index_act = $name;
990 990
 						$info->setup_index_act = $name;
991 991
 					}
992
-					if($simple_setup_index=='true')
992
+					if ($simple_setup_index == 'true')
993 993
 					{
994 994
 						$simple_setup_index_act = $name;
995 995
 						$info->simple_setup_index_act = $name;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			return $info;
1011 1011
 		}
1012 1012
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1013
+		if (file_exists($cache_file)) return include($cache_file);
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	{
1022 1022
 		$module = Context::get('module_type');
1023 1023
 
1024
-		if($module == 'ARTICLE')
1024
+		if ($module == 'ARTICLE')
1025 1025
 		{
1026 1026
 			$module = 'page';
1027 1027
 		}
@@ -1041,26 +1041,26 @@  discard block
 block discarded – undo
1041 1041
 	 */
1042 1042
 	function getSkins($path, $dir = 'skins')
1043 1043
 	{
1044
-		if(substr($path, -1) == '/')
1044
+		if (substr($path, -1) == '/')
1045 1045
 		{
1046 1046
 			$path = substr($path, 0, -1);
1047 1047
 		}
1048 1048
 
1049 1049
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1050
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1051
+		if (!count($list)) return;
1052 1052
 
1053 1053
 		natcasesort($list);
1054 1054
 
1055
-		foreach($list as $skin_name)
1055
+		foreach ($list as $skin_name)
1056 1056
 		{
1057
-			if(!is_dir($skin_path . $skin_name))
1057
+			if (!is_dir($skin_path.$skin_name))
1058 1058
 			{
1059 1059
 				continue;
1060 1060
 			}
1061 1061
 			unset($skin_info);
1062 1062
 			$skin_info = $this->loadSkinInfo($path, $skin_name, $dir);
1063
-			if(!$skin_info)
1063
+			if (!$skin_info)
1064 1064
 			{
1065 1065
 				$skin_info = new stdClass();
1066 1066
 				$skin_info->title = $skin_name;
@@ -1073,15 +1073,15 @@  discard block
 block discarded – undo
1073 1073
 		$tmpPath = trim($tmpPath);
1074 1074
 		$module = array_pop(explode(' ', $tmpPath));
1075 1075
 
1076
-		if($dir == 'skins')
1076
+		if ($dir == 'skins')
1077 1077
 		{
1078 1078
 			$oAdminModel = getAdminModel('admin');
1079 1079
 			$themesInfo = $oAdminModel->getThemeList();
1080 1080
 
1081
-			foreach($themesInfo as $themeName => $info)
1081
+			foreach ($themesInfo as $themeName => $info)
1082 1082
 			{
1083 1083
 				$skinInfos = $info->skin_infos;
1084
-				if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1084
+				if (isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
1085 1085
 				{
1086 1086
 					$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name];
1087 1087
 					$skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
@@ -1093,13 +1093,13 @@  discard block
 block discarded – undo
1093 1093
 		$oMenuAdminModel = getAdminModel('menu');
1094 1094
 		$installedMenuTypes = $oMenuAdminModel->getModuleListInSitemap($siteInfo->site_srl);
1095 1095
 		$moduleName = $module;
1096
-		if($moduleName === 'page')
1096
+		if ($moduleName === 'page')
1097 1097
 		{
1098 1098
 			$moduleName = 'ARTICLE';
1099 1099
 		}
1100
-		if(array_key_exists($moduleName, $installedMenuTypes))
1100
+		if (array_key_exists($moduleName, $installedMenuTypes))
1101 1101
 		{
1102
-			if($dir == 'skins')
1102
+			if ($dir == 'skins')
1103 1103
 			{
1104 1104
 				$type = 'P';
1105 1105
 			}
@@ -1109,12 +1109,12 @@  discard block
 block discarded – undo
1109 1109
 			}
1110 1110
 			$defaultSkinName = $this->getModuleDefaultSkin($module, $type, $site_info->site_srl);
1111 1111
 
1112
-			if(isset($defaultSkinName))
1112
+			if (isset($defaultSkinName))
1113 1113
 			{
1114 1114
 				$defaultSkinInfo = $this->loadSkinInfo($path, $defaultSkinName, $dir);
1115 1115
 
1116 1116
 				$useDefault = new stdClass();
1117
-				$useDefault->title = Context::getLang('use_site_default_skin') . ' (' . $defaultSkinInfo->title . ')';
1117
+				$useDefault->title = Context::getLang('use_site_default_skin').' ('.$defaultSkinInfo->title.')';
1118 1118
 
1119 1119
 				$useDefaultList['/USE_DEFAULT/'] = $useDefault;
1120 1120
 
@@ -1131,20 +1131,20 @@  discard block
 block discarded – undo
1131 1131
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1132
 	{
1133 1133
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1134
+		if (substr($path, -1) != '/') $path .= '/';
1135 1135
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1136
+		if (!file_exists($skin_xml_file)) return;
1137 1137
 		// Create XmlParser object
1138 1138
 		$oXmlParser = new XmlParser();
1139 1139
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1140
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1141
+		if (!$_xml_obj->skin) return;
1142 1142
 		$xml_obj = $_xml_obj->skin;
1143 1143
 		// Skin Name
1144 1144
 		$skin_info = new stdClass();
1145 1145
 		$skin_info->title = $xml_obj->title->body;
1146 1146
 		// Author information
1147
-		if($xml_obj->version && $xml_obj->attrs->version == '0.2')
1147
+		if ($xml_obj->version && $xml_obj->attrs->version == '0.2')
1148 1148
 		{
1149 1149
 			// skin format v0.2
1150 1150
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1155,10 +1155,10 @@  discard block
 block discarded – undo
1155 1155
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1156
 			$skin_info->description = $xml_obj->description->body;
1157 1157
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1158
+			if (!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159 1159
 			else $author_list = $xml_obj->author;
1160 1160
 
1161
-			foreach($author_list as $author)
1161
+			foreach ($author_list as $author)
1162 1162
 			{
1163 1163
 				$author_obj = new stdClass();
1164 1164
 				$author_obj->name = $author->name->body;
@@ -1167,25 +1167,25 @@  discard block
 block discarded – undo
1167 1167
 				$skin_info->author[] = $author_obj;
1168 1168
 			}
1169 1169
 			// List extra vars
1170
-			if($xml_obj->extra_vars)
1170
+			if ($xml_obj->extra_vars)
1171 1171
 			{
1172 1172
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1173
+				if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
+				if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1175 1175
 
1176
-				foreach($extra_var_groups as $group)
1176
+				foreach ($extra_var_groups as $group)
1177 1177
 				{
1178 1178
 					$extra_vars = $group->var;
1179
-					if(!$extra_vars)
1179
+					if (!$extra_vars)
1180 1180
 					{
1181 1181
 						continue;
1182 1182
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1183
+					if (!is_array($group->var)) $extra_vars = array($group->var);
1184 1184
 
1185
-					foreach($extra_vars as $key => $val)
1185
+					foreach ($extra_vars as $key => $val)
1186 1186
 					{
1187 1187
 						$obj = new stdClass();
1188
-						if(!$val->attrs->type) { $val->attrs->type = 'text'; }
1188
+						if (!$val->attrs->type) { $val->attrs->type = 'text'; }
1189 1189
 
1190 1190
 						$obj->group = $group->title->body;
1191 1191
 						$obj->name = $val->attrs->name;
@@ -1194,14 +1194,14 @@  discard block
 block discarded – undo
1194 1194
 						$obj->description = $val->description->body;
1195 1195
 						$obj->value = $extra_vals->{$obj->name};
1196 1196
 						$obj->default = $val->attrs->default;
1197
-						if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
-						if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1197
+						if (strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
1198
+						if ($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
1199 1199
 						// Get an option list from 'select'type
1200
-						if(is_array($val->options))
1200
+						if (is_array($val->options))
1201 1201
 						{
1202 1202
 							$option_count = count($val->options);
1203 1203
 
1204
-							for($i = 0; $i < $option_count; $i++)
1204
+							for ($i = 0; $i < $option_count; $i++)
1205 1205
 							{
1206 1206
 								$obj->options[$i] = new stdClass();
1207 1207
 								$obj->options[$i]->title = $val->options[$i]->title->body;
@@ -1238,18 +1238,18 @@  discard block
 block discarded – undo
1238 1238
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1239
 			// Variables used in the skin
1240 1240
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1241
+			if (!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
+			if (!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1243 1243
 
1244
-			foreach($extra_var_groups as $group)
1244
+			foreach ($extra_var_groups as $group)
1245 1245
 			{
1246 1246
 				$extra_vars = $group->var;
1247 1247
 
1248
-				if($extra_vars)
1248
+				if ($extra_vars)
1249 1249
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1250
+					if (!is_array($extra_vars)) $extra_vars = array($extra_vars);
1251 1251
 
1252
-					foreach($extra_vars as $var)
1252
+					foreach ($extra_vars as $var)
1253 1253
 					{
1254 1254
 						unset($obj);
1255 1255
 						unset($options);
@@ -1260,11 +1260,11 @@  discard block
 block discarded – undo
1260 1260
 						$title = $var->title->body;
1261 1261
 						$description = $var->description->body;
1262 1262
 						// Get an option list from 'select'type.
1263
-						if(is_array($var->default))
1263
+						if (is_array($var->default))
1264 1264
 						{
1265 1265
 							$option_count = count($var->default);
1266 1266
 
1267
-							for($i = 0; $i < $option_count; $i++)
1267
+							for ($i = 0; $i < $option_count; $i++)
1268 1268
 							{
1269 1269
 								$options[$i]->title = $var->default[$i]->body;
1270 1270
 								$options[$i]->value = $var->default[$i]->body;
@@ -1298,19 +1298,19 @@  discard block
 block discarded – undo
1298 1298
 
1299 1299
 		// colorset
1300 1300
 		$colorset = $xml_obj->colorset->color;
1301
-		if($colorset)
1301
+		if ($colorset)
1302 1302
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1303
+			if (!is_array($colorset)) $colorset = array($colorset);
1304 1304
 
1305
-			foreach($colorset as $color)
1305
+			foreach ($colorset as $color)
1306 1306
 			{
1307 1307
 				$name = $color->attrs->name;
1308 1308
 				$title = $color->title->body;
1309 1309
 				$screenshot = $color->attrs->src;
1310
-				if($screenshot)
1310
+				if ($screenshot)
1311 1311
 				{
1312 1312
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1313
+					if (!file_exists($screenshot)) $screenshot = "";
1314 1314
 				}
1315 1315
 				else $screenshot = "";
1316 1316
 
@@ -1322,19 +1322,19 @@  discard block
 block discarded – undo
1322 1322
 			}
1323 1323
 		}
1324 1324
 		// Menu type (settings for layout)
1325
-		if($xml_obj->menus->menu)
1325
+		if ($xml_obj->menus->menu)
1326 1326
 		{
1327 1327
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1328
+			if (!is_array($menus)) $menus = array($menus);
1329 1329
 
1330 1330
 			$menu_count = count($menus);
1331 1331
 			$skin_info->menu_count = $menu_count;
1332
-			for($i=0;$i<$menu_count;$i++)
1332
+			for ($i = 0; $i < $menu_count; $i++)
1333 1333
 			{
1334 1334
 				unset($obj);
1335 1335
 
1336 1336
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1337
+				if ($menus[$i]->attrs->default == "true") $obj->default = true;
1338 1338
 				$obj->title = $menus[$i]->title->body;
1339 1339
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1340
 
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 		}
1344 1344
 
1345 1345
 		$thumbnail = sprintf("%s%s/%s/thumbnail.png", $path, $dir, $skin);
1346
-		$skin_info->thumbnail = (file_exists($thumbnail))?$thumbnail:null;
1346
+		$skin_info->thumbnail = (file_exists($thumbnail)) ? $thumbnail : null;
1347 1347
 		return $skin_info;
1348 1348
 	}
1349 1349
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	{
1355 1355
 		$args = new stdClass;
1356 1356
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1357
+		if (!is_null($module)) $args->module = $module;
1358 1358
 		$output = executeQuery('module.getModuleCount', $args);
1359 1359
 		return $output->data->count;
1360 1360
 	}
@@ -1368,26 +1368,26 @@  discard block
 block discarded – undo
1368 1368
 		$config = false;
1369 1369
 		// cache controll
1370 1370
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1371
-		if($oCacheHandler->isSupport())
1371
+		if ($oCacheHandler->isSupport())
1372 1372
 		{
1373
-			$object_key = 'module_config:' . $module . '_' . $site_srl;
1373
+			$object_key = 'module_config:'.$module.'_'.$site_srl;
1374 1374
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1375 1375
 			$config = $oCacheHandler->get($cache_key);
1376 1376
 		}
1377 1377
 
1378
-		if($config === false)
1378
+		if ($config === false)
1379 1379
 		{
1380
-			if(!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1380
+			if (!$GLOBALS['__ModuleConfig__'][$site_srl][$module])
1381 1381
 			{
1382 1382
 				$args = new stdClass();
1383 1383
 				$args->module = $module;
1384 1384
 				$args->site_srl = $site_srl;
1385 1385
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1386
+				if ($output->data->config) $config = unserialize($output->data->config);
1387 1387
 				else $config = null;
1388 1388
 
1389 1389
 				//insert in cache
1390
-				if($oCacheHandler->isSupport())
1390
+				if ($oCacheHandler->isSupport())
1391 1391
 				{
1392 1392
 					$oCacheHandler->put($cache_key, $config);
1393 1393
 				}
@@ -1408,26 +1408,26 @@  discard block
 block discarded – undo
1408 1408
 		$config = false;
1409 1409
 		// cache controll
1410 1410
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1411
-		if($oCacheHandler->isSupport())
1411
+		if ($oCacheHandler->isSupport())
1412 1412
 		{
1413 1413
 			$object_key = 'module_part_config:'.$module.'_'.$module_srl;
1414 1414
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1415 1415
 			$config = $oCacheHandler->get($cache_key);
1416 1416
 		}
1417 1417
 
1418
-		if($config === false)
1418
+		if ($config === false)
1419 1419
 		{
1420
-			if(!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1420
+			if (!isset($GLOBALS['__ModulePartConfig__'][$module][$module_srl]))
1421 1421
 			{
1422 1422
 				$args = new stdClass();
1423 1423
 				$args->module = $module;
1424 1424
 				$args->module_srl = $module_srl;
1425 1425
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1426
+				if ($output->data->config) $config = unserialize($output->data->config);
1427 1427
 				else $config = null;
1428 1428
 
1429 1429
 				//insert in cache
1430
-				if($oCacheHandler->isSupport())
1430
+				if ($oCacheHandler->isSupport())
1431 1431
 				{
1432 1432
 					$oCacheHandler->put($cache_key, $config);
1433 1433
 				}
@@ -1446,11 +1446,11 @@  discard block
 block discarded – undo
1446 1446
 	{
1447 1447
 		$args = new stdClass();
1448 1448
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1449
+		if ($site_srl) $args->site_srl = $site_srl;
1450 1450
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1451
+		if (!$output->toBool() || !$output->data) return array();
1452 1452
 
1453
-		foreach($output->data as $key => $val)
1453
+		foreach ($output->data as $key => $val)
1454 1454
 		{
1455 1455
 			$result[$val->module_srl] = unserialize($val->config);
1456 1456
 		}
@@ -1466,12 +1466,12 @@  discard block
 block discarded – undo
1466 1466
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1467
 		// Get data from the DB
1468 1468
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1469
+		if (!$output->toBool()) return $output;
1470 1470
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1471
+		if (!$list) return;
1472
+		if (!is_array($list)) $list = array($list);
1473 1473
 
1474
-		foreach($list as $val)
1474
+		foreach ($list as $val)
1475 1475
 		{
1476 1476
 			$category_list[$val->module_category_srl] = $val;
1477 1477
 		}
@@ -1487,7 +1487,7 @@  discard block
 block discarded – undo
1487 1487
 		$args = new stdClass;
1488 1488
 		$args->module_category_srl = $module_category_srl;
1489 1489
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1490
+		if (!$output->toBool()) return $output;
1491 1491
 		return $output->data;
1492 1492
 	}
1493 1493
 
@@ -1499,10 +1499,10 @@  discard block
 block discarded – undo
1499 1499
 		// Get a list of downloaded and installed modules
1500 1500
 		$searched_list = FileHandler::readDir('./modules');
1501 1501
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1502
+		if (!$searched_count) return;
1503 1503
 		sort($searched_list);
1504 1504
 
1505
-		for($i=0;$i<$searched_count;$i++)
1505
+		for ($i = 0; $i < $searched_count; $i++)
1506 1506
 		{
1507 1507
 			// Module name
1508 1508
 			$module_name = $searched_list[$i];
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 			$info = $this->getModuleInfoXml($module_name);
1513 1513
 			unset($obj);
1514 1514
 
1515
-			if(!isset($info)) continue;
1515
+			if (!isset($info)) continue;
1516 1516
 			$info->module = $module_name;
1517 1517
 			$info->created_table_count = $created_table_count;
1518 1518
 			$info->table_count = $table_count;
@@ -1529,19 +1529,19 @@  discard block
 block discarded – undo
1529 1529
 		$info = null;
1530 1530
 
1531 1531
 		$moduledir = ModuleHandler::getModulePath($module_name);
1532
-		if(file_exists(FileHandler::getRealPath($moduledir."schemas")))
1532
+		if (file_exists(FileHandler::getRealPath($moduledir."schemas")))
1533 1533
 		{
1534 1534
 			$tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/');
1535 1535
 			$table_count = count($tmp_files);
1536 1536
 			// Check if the table is created
1537 1537
 			$created_table_count = 0;
1538
-			for($j=0;$j<count($tmp_files);$j++)
1538
+			for ($j = 0; $j < count($tmp_files); $j++)
1539 1539
 			{
1540
-				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1540
+				list($table_name) = explode(".", $tmp_files[$j]);
1541
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1542 1542
 			}
1543 1543
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1544
+			if ($table_count > $created_table_count) return true;
1545 1545
 			else return false;
1546 1546
 		}
1547 1547
 		return false;
@@ -1551,7 +1551,7 @@  discard block
 block discarded – undo
1551 1551
 	{
1552 1552
 		// Check if it is upgraded to module.class.php on each module
1553 1553
 		$oDummy = getModule($module_name, 'class');
1554
-		if($oDummy && method_exists($oDummy, "checkUpdate"))
1554
+		if ($oDummy && method_exists($oDummy, "checkUpdate"))
1555 1555
 		{
1556 1556
 			return $oDummy->checkUpdate();
1557 1557
 		}
@@ -1565,15 +1565,15 @@  discard block
 block discarded – undo
1565 1565
 	 */
1566 1566
 	public function needUpdate($update_id)
1567 1567
 	{
1568
-		if(!is_array($update_id)) $update_id = array($update_id);
1568
+		if (!is_array($update_id)) $update_id = array($update_id);
1569 1569
 
1570 1570
 		$args = new stdClass();
1571 1571
 		$args->update_id = implode(',', $update_id);
1572 1572
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1573 1573
 
1574
-		if(!!$output->error) return false;
1575
-		if(!$output->data) $output->data = array();
1576
-		if(count($update_id) === count($output->data)) return false;
1574
+		if (!!$output->error) return false;
1575
+		if (!$output->data) $output->data = array();
1576
+		if (count($update_id) === count($output->data)) return false;
1577 1577
 
1578 1578
 		return true;
1579 1579
 	}
@@ -1590,31 +1590,31 @@  discard block
 block discarded – undo
1590 1590
 		sort($searched_list);
1591 1591
 
1592 1592
 		$searched_count = count($searched_list);
1593
-		if(!$searched_count) return;
1593
+		if (!$searched_count) return;
1594 1594
 
1595
-		for($i=0;$i<$searched_count;$i++)
1595
+		for ($i = 0; $i < $searched_count; $i++)
1596 1596
 		{
1597 1597
 			// module name
1598 1598
 			$module_name = $searched_list[$i];
1599 1599
 
1600 1600
 			$path = ModuleHandler::getModulePath($module_name);
1601
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1601
+			if (!is_dir(FileHandler::getRealPath($path))) continue;
1602 1602
 
1603 1603
 			// Get the number of xml files to create a table in schemas
1604 1604
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
1605 1605
 			$table_count = count($tmp_files);
1606 1606
 			// Check if the table is created
1607 1607
 			$created_table_count = 0;
1608
-			for($j=0;$j<$table_count;$j++)
1608
+			for ($j = 0; $j < $table_count; $j++)
1609 1609
 			{
1610
-				list($table_name) = explode('.',$tmp_files[$j]);
1611
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1610
+				list($table_name) = explode('.', $tmp_files[$j]);
1611
+				if ($oDB->isTableExists($table_name)) $created_table_count++;
1612 1612
 			}
1613 1613
 			// Get information of the module
1614 1614
 			$info = NULL;
1615 1615
 			$info = $this->getModuleInfoXml($module_name);
1616 1616
 
1617
-			if(!$info) continue;
1617
+			if (!$info) continue;
1618 1618
 
1619 1619
 			$info->module = $module_name;
1620 1620
 			$info->category = $info->category;
@@ -1623,12 +1623,12 @@  discard block
 block discarded – undo
1623 1623
 			$info->path = $path;
1624 1624
 			$info->admin_index_act = $info->admin_index_act;
1625 1625
 			// Check if DB is installed
1626
-			if($table_count > $created_table_count) $info->need_install = true;
1626
+			if ($table_count > $created_table_count) $info->need_install = true;
1627 1627
 			else $info->need_install = false;
1628 1628
 			// Check if it is upgraded to module.class.php on each module
1629 1629
 			$oDummy = null;
1630 1630
 			$oDummy = getModule($module_name, 'class');
1631
-			if($oDummy && method_exists($oDummy, "checkUpdate"))
1631
+			if ($oDummy && method_exists($oDummy, "checkUpdate"))
1632 1632
 			{
1633 1633
 				$info->need_update = $oDummy->checkUpdate();
1634 1634
 			}
@@ -1649,15 +1649,15 @@  discard block
 block discarded – undo
1649 1649
 	 */
1650 1650
 	function syncModuleToSite(&$data)
1651 1651
 	{
1652
-		if(!$data) return;
1652
+		if (!$data) return;
1653 1653
 
1654
-		if(is_array($data))
1654
+		if (is_array($data))
1655 1655
 		{
1656
-			foreach($data as $key => $val)
1656
+			foreach ($data as $key => $val)
1657 1657
 			{
1658 1658
 				$module_srls[] = $val->module_srl;
1659 1659
 			}
1660
-			if(!count($module_srls)) return;
1660
+			if (!count($module_srls)) return;
1661 1661
 		}
1662 1662
 		else
1663 1663
 		{
@@ -1665,17 +1665,17 @@  discard block
 block discarded – undo
1665 1665
 		}
1666 1666
 
1667 1667
 		$args = new stdClass();
1668
-		$args->module_srls = implode(',',$module_srls);
1668
+		$args->module_srls = implode(',', $module_srls);
1669 1669
 		$output = executeQueryArray('module.getModuleSites', $args);
1670
-		if(!$output->data) return array();
1671
-		foreach($output->data as $key => $val)
1670
+		if (!$output->data) return array();
1671
+		foreach ($output->data as $key => $val)
1672 1672
 		{
1673 1673
 			$modules[$val->module_srl] = $val;
1674 1674
 		}
1675 1675
 
1676
-		if(is_array($data))
1676
+		if (is_array($data))
1677 1677
 		{
1678
-			foreach($data as $key => $val)
1678
+			foreach ($data as $key => $val)
1679 1679
 			{
1680 1680
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1681 1681
 			}
@@ -1691,14 +1691,14 @@  discard block
 block discarded – undo
1691 1691
 	 */
1692 1692
 	function isSiteAdmin($member_info, $site_srl = null)
1693 1693
 	{
1694
-		if(!$member_info->member_srl) return false;
1695
-		if($member_info->is_admin == 'Y') return true;
1694
+		if (!$member_info->member_srl) return false;
1695
+		if ($member_info->is_admin == 'Y') return true;
1696 1696
 
1697 1697
 		$args = new stdClass();
1698
-		if(!isset($site_srl))
1698
+		if (!isset($site_srl))
1699 1699
 		{
1700 1700
 			$site_module_info = Context::get('site_module_info');
1701
-			if(!$site_module_info) return;
1701
+			if (!$site_module_info) return;
1702 1702
 			$args->site_srl = $site_module_info->site_srl;
1703 1703
 		}
1704 1704
 		else
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 
1709 1709
 		$args->member_srl = $member_info->member_srl;
1710 1710
 		$output = executeQuery('module.isSiteAdmin', $args);
1711
-		if($output->data->member_srl == $args->member_srl) return true;
1711
+		if ($output->data->member_srl == $args->member_srl) return true;
1712 1712
 		return false;
1713 1713
 	}
1714 1714
 
@@ -1731,7 +1731,7 @@  discard block
 block discarded – undo
1731 1731
 		$obj = new stdClass();
1732 1732
 		$obj->module_srl = $module_srl;
1733 1733
 		$output = executeQueryArray('module.getAdminID', $obj);
1734
-		if(!$output->toBool() || !$output->data) return;
1734
+		if (!$output->toBool() || !$output->data) return;
1735 1735
 
1736 1736
 		return $output->data;
1737 1737
 	}
@@ -1744,20 +1744,20 @@  discard block
 block discarded – undo
1744 1744
 	{
1745 1745
 		$extra_vars = array();
1746 1746
 		$get_module_srls = array();
1747
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1747
+		if (!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1748 1748
 
1749 1749
 		$vars = false;
1750 1750
 		// cache controll
1751 1751
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1752
-		if($oCacheHandler->isSupport())
1752
+		if ($oCacheHandler->isSupport())
1753 1753
 		{
1754
-			foreach($list_module_srl as $module_srl)
1754
+			foreach ($list_module_srl as $module_srl)
1755 1755
 			{
1756 1756
 				$object_key = 'module_extra_vars:'.$module_srl;
1757 1757
 				$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1758 1758
 				$vars = $oCacheHandler->get($cache_key);
1759 1759
 
1760
-				if($vars)
1760
+				if ($vars)
1761 1761
 				{
1762 1762
 					$extra_vars[$module_srl] = $vars;
1763 1763
 				}
@@ -1772,35 +1772,35 @@  discard block
 block discarded – undo
1772 1772
 			$get_module_srls = $list_module_srl;
1773 1773
 		}
1774 1774
 
1775
-		if(count($get_module_srls) > 0)
1775
+		if (count($get_module_srls) > 0)
1776 1776
 		{
1777 1777
 			$args = new stdClass();
1778 1778
 			$args->module_srl = implode(',', $get_module_srls);
1779 1779
 			$output = executeQueryArray('module.getModuleExtraVars', $args);
1780 1780
 
1781
-			if(!$output->toBool())
1781
+			if (!$output->toBool())
1782 1782
 			{
1783 1783
 				return;
1784 1784
 			}
1785 1785
 
1786
-			if(!$output->data)
1786
+			if (!$output->data)
1787 1787
 			{
1788
-				foreach($get_module_srls as $module_srl)
1788
+				foreach ($get_module_srls as $module_srl)
1789 1789
 				{
1790 1790
 					$extra_vars[$module_srl] = new stdClass;
1791 1791
 				}
1792 1792
 			}
1793
-			foreach($output->data as $key => $val)
1793
+			foreach ($output->data as $key => $val)
1794 1794
 			{
1795
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1795
+				if (in_array($val->name, array('mid', 'module')) || $val->value == 'Array') continue;
1796 1796
 
1797
-				if(!isset($extra_vars[$val->module_srl]))
1797
+				if (!isset($extra_vars[$val->module_srl]))
1798 1798
 				{
1799 1799
 					$extra_vars[$val->module_srl] = new stdClass();
1800 1800
 				}
1801 1801
 				$extra_vars[$val->module_srl]->{$val->name} = $val->value;
1802 1802
 
1803
-				if($oCacheHandler->isSupport())
1803
+				if ($oCacheHandler->isSupport())
1804 1804
 				{
1805 1805
 					$object_key = 'module_extra_vars:'.$val->module_srl;
1806 1806
 					$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
@@ -1819,27 +1819,27 @@  discard block
 block discarded – undo
1819 1819
 	{
1820 1820
 		$skin_vars = false;
1821 1821
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1822
-		if($oCacheHandler->isSupport())
1822
+		if ($oCacheHandler->isSupport())
1823 1823
 		{
1824 1824
 			$object_key = 'module_skin_vars:'.$module_srl;
1825 1825
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1826 1826
 			$skin_vars = $oCacheHandler->get($cache_key);
1827 1827
 		}
1828 1828
 
1829
-		if($skin_vars === false)
1829
+		if ($skin_vars === false)
1830 1830
 		{
1831 1831
 			$args = new stdClass();
1832 1832
 			$args->module_srl = $module_srl;
1833
-			$output = executeQueryArray('module.getModuleSkinVars',$args);
1834
-			if(!$output->toBool()) return;
1833
+			$output = executeQueryArray('module.getModuleSkinVars', $args);
1834
+			if (!$output->toBool()) return;
1835 1835
 
1836 1836
 			$skin_vars = array();
1837
-			foreach($output->data as $vars)
1837
+			foreach ($output->data as $vars)
1838 1838
 			{
1839 1839
 				$skin_vars[$vars->name] = $vars;
1840 1840
 			}
1841 1841
 
1842
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1842
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1843 1843
 		}
1844 1844
 
1845 1845
 		return $skin_vars;
@@ -1851,32 +1851,32 @@  discard block
 block discarded – undo
1851 1851
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1852 1852
 	{
1853 1853
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1854
-		if(!$site_srl) $site_srl = 0;
1854
+		if (!$site_srl) $site_srl = 0;
1855 1855
 
1856 1856
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1857
-		if(is_readable($designInfoFile))
1857
+		if (is_readable($designInfoFile))
1858 1858
 		{
1859 1859
 			include($designInfoFile);
1860 1860
 
1861 1861
 			$skinName = $designInfo->module->{$module_name}->{$target};
1862 1862
 		}
1863
-		if(!$skinName)
1863
+		if (!$skinName)
1864 1864
 		{
1865 1865
 			$dir = ($skin_type == 'M') ? 'm.skins/' : 'skins/';
1866 1866
 			$moduleSkinPath = ModuleHandler::getModulePath($module_name).$dir;
1867 1867
 
1868
-			if(is_dir($moduleSkinPath.'default'))
1868
+			if (is_dir($moduleSkinPath.'default'))
1869 1869
 			{
1870 1870
 				$skinName = 'default';
1871 1871
 			}
1872
-			else if(is_dir($moduleSkinPath.'xe_default'))
1872
+			else if (is_dir($moduleSkinPath.'xe_default'))
1873 1873
 			{
1874 1874
 				$skinName = 'xe_default';
1875 1875
 			}
1876 1876
 			else
1877 1877
 			{
1878 1878
 				$skins = FileHandler::readDir($moduleSkinPath);
1879
-				if(count($skins) > 0)
1879
+				if (count($skins) > 0)
1880 1880
 				{
1881 1881
 					$skinName = $skins[0];
1882 1882
 				}
@@ -1886,9 +1886,9 @@  discard block
 block discarded – undo
1886 1886
 				}
1887 1887
 			}
1888 1888
 
1889
-			if($updateCache && $skinName)
1889
+			if ($updateCache && $skinName)
1890 1890
 			{
1891
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1891
+				if (!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
1892 1892
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1893 1893
 
1894 1894
 				$oAdminController = getAdminController('admin');
@@ -1904,10 +1904,10 @@  discard block
 block discarded – undo
1904 1904
 	 */
1905 1905
 	function syncSkinInfoToModuleInfo(&$module_info)
1906 1906
 	{
1907
-		if(!$module_info->module_srl) return;
1907
+		if (!$module_info->module_srl) return;
1908 1908
 
1909 1909
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1910
-		if(Mobile::isFromMobilePhone())
1910
+		if (Mobile::isFromMobilePhone())
1911 1911
 		{
1912 1912
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1913 1913
 		}
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1917 1917
 		}
1918 1918
 
1919
-		if(!$skin_vars) return;
1919
+		if (!$skin_vars) return;
1920 1920
 
1921
-		foreach($skin_vars as $name => $val)
1921
+		foreach ($skin_vars as $name => $val)
1922 1922
 		{
1923
-			if(isset($module_info->{$name})) continue;
1923
+			if (isset($module_info->{$name})) continue;
1924 1924
 			$module_info->{$name} = $val->value;
1925 1925
 		}
1926 1926
 	}
@@ -1934,27 +1934,27 @@  discard block
 block discarded – undo
1934 1934
 	{
1935 1935
 		$skin_vars = false;
1936 1936
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1937
-		if($oCacheHandler->isSupport())
1937
+		if ($oCacheHandler->isSupport())
1938 1938
 		{
1939 1939
 			$object_key = 'module_mobile_skin_vars:'.$module_srl;
1940 1940
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1941 1941
 			$skin_vars = $oCacheHandler->get($cache_key);
1942 1942
 		}
1943 1943
 
1944
-		if($skin_vars === false)
1944
+		if ($skin_vars === false)
1945 1945
 		{
1946 1946
 			$args = new stdClass();
1947 1947
 			$args->module_srl = $module_srl;
1948
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1949
-			if(!$output->toBool() || !$output->data) return;
1948
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1949
+			if (!$output->toBool() || !$output->data) return;
1950 1950
 
1951 1951
 			$skin_vars = array();
1952
-			foreach($output->data as $vars)
1952
+			foreach ($output->data as $vars)
1953 1953
 			{
1954 1954
 				$skin_vars[$vars->name] = $vars;
1955 1955
 			}
1956 1956
 
1957
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1957
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1958 1958
 		}
1959 1959
 
1960 1960
 		return $skin_vars;
@@ -1966,32 +1966,32 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1968 1968
 	{
1969
-		if(!$module_info->module_srl) return;
1969
+		if (!$module_info->module_srl) return;
1970 1970
 		$skin_vars = false;
1971 1971
 		// cache controll
1972 1972
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1973
-		if($oCacheHandler->isSupport())
1973
+		if ($oCacheHandler->isSupport())
1974 1974
 		{
1975 1975
 			$object_key = 'module_mobile_skin_vars:'.$module_info->module_srl;
1976 1976
 			$cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
1977 1977
 			$skin_vars = $oCacheHandler->get($cache_key);
1978 1978
 		}
1979
-		if($skin_vars === false)
1979
+		if ($skin_vars === false)
1980 1980
 		{
1981 1981
 			$args = new stdClass;
1982 1982
 			$args->module_srl = $module_info->module_srl;
1983
-			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1984
-			if(!$output->toBool()) return;
1983
+			$output = executeQueryArray('module.getModuleMobileSkinVars', $args);
1984
+			if (!$output->toBool()) return;
1985 1985
 			$skin_vars = $output->data;
1986 1986
 
1987 1987
 			//insert in cache
1988
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1988
+			if ($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
1989 1989
 		}
1990
-		if(!$skin_vars) return;
1990
+		if (!$skin_vars) return;
1991 1991
 
1992
-		foreach($output->data as $val)
1992
+		foreach ($output->data as $val)
1993 1993
 		{
1994
-			if(isset($module_info->{$val->name})) continue;
1994
+			if (isset($module_info->{$val->name})) continue;
1995 1995
 			$module_info->{$val->name} = $val->value;
1996 1996
 		}
1997 1997
 	}
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 	{
2004 2004
 		$grant = new stdClass();
2005 2005
 
2006
-		if(!$xml_info)
2006
+		if (!$xml_info)
2007 2007
 		{
2008 2008
 			$module = $module_info->module;
2009 2009
 			$xml_info = $this->getModuleActionXml($module);
@@ -2011,9 +2011,9 @@  discard block
 block discarded – undo
2011 2011
 		// Set variables to grant group permission
2012 2012
 		$module_srl = $module_info->module_srl;
2013 2013
 		$grant_info = $xml_info->grant;
2014
-		if($member_info->member_srl)
2014
+		if ($member_info->member_srl)
2015 2015
 		{
2016
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2016
+			if (is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2017 2017
 			else $group_list = array();
2018 2018
 		}
2019 2019
 		else
@@ -2021,10 +2021,10 @@  discard block
 block discarded – undo
2021 2021
 			$group_list = array();
2022 2022
 		}
2023 2023
 		// If module_srl doesn't exist(if unable to set permissions)
2024
-		if(!$module_srl)
2024
+		if (!$module_srl)
2025 2025
 		{
2026 2026
 			$grant->access = true;
2027
-			if($this->isSiteAdmin($member_info, $module_info->site_srl))
2027
+			if ($this->isSiteAdmin($member_info, $module_info->site_srl))
2028 2028
 			{
2029 2029
 				$grant->access = $grant->manager = $grant->is_site_admin = true;
2030 2030
 			}
@@ -2035,23 +2035,23 @@  discard block
 block discarded – undo
2035 2035
 		{
2036 2036
 			// If module_srl exists
2037 2037
 			// Get a type of granted permission
2038
-			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info, $module_info->site_srl))?true:false;
2038
+			$grant->access = $grant->manager = $grant->is_site_admin = ($member_info->is_admin == 'Y' || $this->isSiteAdmin($member_info, $module_info->site_srl)) ?true:false;
2039 2039
 			$grant->is_admin = ($member_info->is_admin == 'Y') ? true : false;
2040 2040
 			// If a just logged-in member is, check if the member is a module administrator
2041
-			if(!$grant->manager && $member_info->member_srl)
2041
+			if (!$grant->manager && $member_info->member_srl)
2042 2042
 			{
2043 2043
 				$args = new stdClass();
2044 2044
 				$args->module_srl = $module_srl;
2045 2045
 				$args->member_srl = $member_info->member_srl;
2046
-				$output = executeQuery('module.getModuleAdmin',$args);
2047
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2046
+				$output = executeQuery('module.getModuleAdmin', $args);
2047
+				if ($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2048 2048
 			}
2049 2049
 			// If not an administrator, get information from the DB and grant manager privilege.
2050
-			if(!$grant->manager)
2050
+			if (!$grant->manager)
2051 2051
 			{
2052 2052
 				$args = new stdClass();
2053 2053
 				// If planet, get permission settings from the planet home
2054
-				if($module_info->module == 'planet')
2054
+				if ($module_info->module == 'planet')
2055 2055
 				{
2056 2056
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2057 2057
 				}
@@ -2064,42 +2064,42 @@  discard block
 block discarded – undo
2064 2064
 
2065 2065
 				$grant_exists = $granted = array();
2066 2066
 
2067
-				if($output->data)
2067
+				if ($output->data)
2068 2068
 				{
2069 2069
 					// Arrange names and groups who has privileges
2070
-					foreach($output->data as $val)
2070
+					foreach ($output->data as $val)
2071 2071
 					{
2072 2072
 						$grant_exists[$val->name] = true;
2073
-						if($granted[$val->name]) continue;
2073
+						if ($granted[$val->name]) continue;
2074 2074
 						// Log-in member only
2075
-						if($val->group_srl == -1)
2075
+						if ($val->group_srl == -1)
2076 2076
 						{
2077 2077
 							$granted[$val->name] = true;
2078
-							if($member_info->member_srl) $grant->{$val->name} = true;
2078
+							if ($member_info->member_srl) $grant->{$val->name} = true;
2079 2079
 							// Site-joined member only
2080 2080
 						}
2081
-						elseif($val->group_srl == -2)
2081
+						elseif ($val->group_srl == -2)
2082 2082
 						{
2083 2083
 							$granted[$val->name] = true;
2084 2084
 							// Do not grant any permission for non-logged member
2085
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2085
+							if (!$member_info->member_srl) $grant->{$val->name} = false;
2086 2086
 							// Log-in member
2087 2087
 							else
2088 2088
 							{
2089 2089
 								$site_module_info = Context::get('site_module_info');
2090 2090
 								// Permission granted if no information of the currently connected site exists
2091
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2091
+								if (!$site_module_info->site_srl) $grant->{$val->name} = true;
2092 2092
 								// Permission is not granted if information of the currently connected site exists
2093
-								elseif(count($group_list)) $grant->{$val->name} = true;
2093
+								elseif (count($group_list)) $grant->{$val->name} = true;
2094 2094
 							}
2095 2095
 							// All of non-logged members
2096 2096
 						}
2097
-						elseif($val->group_srl == -3)
2097
+						elseif ($val->group_srl == -3)
2098 2098
 						{
2099 2099
 							$granted[$val->name] = true;
2100 2100
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2101 2101
 						}
2102
-						elseif($val->group_srl == 0)
2102
+						elseif ($val->group_srl == 0)
2103 2103
 						{
2104 2104
 							$granted[$val->name] = true;
2105 2105
 							$grant->{$val->name} = true;
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 						}
2108 2108
 						else
2109 2109
 						{
2110
-							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2110
+							if ($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2111 2111
 							{
2112 2112
 								$grant->{$val->name} = true;
2113 2113
 								$granted[$val->name] = true;
@@ -2116,29 +2116,29 @@  discard block
 block discarded – undo
2116 2116
 					}
2117 2117
 				}
2118 2118
 				// Separate processing for the virtual group access
2119
-				if(!$grant_exists['access']) $grant->access = true;
2120
-				if(count($grant_info))
2119
+				if (!$grant_exists['access']) $grant->access = true;
2120
+				if (count($grant_info))
2121 2121
 				{
2122
-					foreach($grant_info as  $grant_name => $grant_item)
2122
+					foreach ($grant_info as  $grant_name => $grant_item)
2123 2123
 					{
2124
-						if($grant_exists[$grant_name]) continue;
2125
-						switch($grant_item->default)
2124
+						if ($grant_exists[$grant_name]) continue;
2125
+						switch ($grant_item->default)
2126 2126
 						{
2127 2127
 							case 'guest' :
2128 2128
 								$grant->{$grant_name} = true;
2129 2129
 								break;
2130 2130
 							case 'member' :
2131
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2131
+								if ($member_info->member_srl) $grant->{$grant_name} = true;
2132 2132
 								else $grant->{$grant_name} = false;
2133 2133
 								break;
2134 2134
 							case 'site' :
2135 2135
 								$site_module_info = Context::get('site_module_info');
2136
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2136
+								if ($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2137 2137
 								else $grant->{$grant_name} = false;
2138 2138
 								break;
2139 2139
 							case 'manager' :
2140 2140
 							case 'root' :
2141
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2141
+								if ($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2142 2142
 								else $grant->{$grant_name} = false;
2143 2143
 								break;
2144 2144
 						}
@@ -2146,12 +2146,12 @@  discard block
 block discarded – undo
2146 2146
 				}
2147 2147
 			}
2148 2148
 			// Set true to grant all privileges if an administrator is
2149
-			if($grant->manager)
2149
+			if ($grant->manager)
2150 2150
 			{
2151 2151
 				$grant->access = true;
2152
-				if(count($grant_info))
2152
+				if (count($grant_info))
2153 2153
 				{
2154
-					foreach($grant_info as $key => $val)
2154
+					foreach ($grant_info as $key => $val)
2155 2155
 					{
2156 2156
 						$grant->{$key} = true;
2157 2157
 					}
@@ -2183,27 +2183,27 @@  discard block
 block discarded – undo
2183 2183
 
2184 2184
 	function unserializeAttributes($module_filebox_list)
2185 2185
 	{
2186
-		if(is_array($module_filebox_list->data))
2186
+		if (is_array($module_filebox_list->data))
2187 2187
 		{
2188
-			foreach($module_filebox_list->data as &$item)
2188
+			foreach ($module_filebox_list->data as &$item)
2189 2189
 			{
2190
-				if(empty($item->comment))
2190
+				if (empty($item->comment))
2191 2191
 				{
2192 2192
 					continue;
2193 2193
 				}
2194 2194
 
2195 2195
 				$attributes = explode(';', $item->comment);
2196
-				foreach($attributes as $attribute)
2196
+				foreach ($attributes as $attribute)
2197 2197
 				{
2198 2198
 					$values = explode(':', $attribute);
2199
-					if((count($values) % 2) ==1)
2199
+					if ((count($values) % 2) == 1)
2200 2200
 					{
2201
-						for($i=2;$i<count($values);$i++)
2201
+						for ($i = 2; $i < count($values); $i++)
2202 2202
 						{
2203
-							$values[1].=":".$values[$i];
2203
+							$values[1] .= ":".$values[$i];
2204 2204
 						}
2205 2205
 					}
2206
-					$atts[$values[0]]=$values[1];
2206
+					$atts[$values[0]] = $values[1];
2207 2207
 				}
2208 2208
 				$item->attributes = $atts;
2209 2209
 				unset($atts);
@@ -2215,16 +2215,16 @@  discard block
 block discarded – undo
2215 2215
 	function getFileBoxListHtml()
2216 2216
 	{
2217 2217
 		$logged_info = Context::get('logged_info');
2218
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2218
+		if ($logged_info->is_admin != 'Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2219 2219
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2220
-		$link_params = explode('&',$link['query']);
2220
+		$link_params = explode('&', $link['query']);
2221 2221
 		foreach ($link_params as $param)
2222 2222
 		{
2223
-			$param = explode("=",$param);
2224
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2223
+			$param = explode("=", $param);
2224
+			if ($param[0] == 'selected_widget') $selected_widget = $param[1];
2225 2225
 		}
2226 2226
 		$oWidgetModel = getModel('widget');
2227
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2227
+		if ($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2228 2228
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2229 2229
 
2230 2230
 		$oModuleModel = getModel('module');
@@ -2240,24 +2240,24 @@  discard block
 block discarded – undo
2240 2240
 		$security->encodeHTML('filebox_list..comment', 'filebox_list..attributes.');
2241 2241
 
2242 2242
 		$oTemplate = &TemplateHandler::getInstance();
2243
-		$html = $oTemplate->compile(_XE_PATH_ . 'modules/module/tpl/', 'filebox_list_html');
2243
+		$html = $oTemplate->compile(_XE_PATH_.'modules/module/tpl/', 'filebox_list_html');
2244 2244
 
2245 2245
 		$this->add('html', $html);
2246 2246
 	}
2247 2247
 
2248 2248
 	function getModuleFileBoxPath($module_filebox_srl)
2249 2249
 	{
2250
-		return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
2250
+		return sprintf("./files/attach/filebox/%s", getNumberingPath($module_filebox_srl, 3));
2251 2251
 	}
2252 2252
 
2253 2253
 	/**
2254 2254
 	 * @brief Return ruleset cache file path
2255 2255
 	 * @param module, act
2256 2256
 	 */
2257
-	function getValidatorFilePath($module, $ruleset, $mid=null)
2257
+	function getValidatorFilePath($module, $ruleset, $mid = null)
2258 2258
 	{
2259 2259
 		// load dynamic ruleset xml file
2260
-		if(strpos($ruleset, '@') !== false)
2260
+		if (strpos($ruleset, '@') !== false)
2261 2261
 		{
2262 2262
 			$rulsetFile = str_replace('@', '', $ruleset);
2263 2263
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
@@ -2267,20 +2267,20 @@  discard block
 block discarded – undo
2267 2267
 		{
2268 2268
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2269 2269
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2270
-			if(is_readable($xml_file))
2270
+			if (is_readable($xml_file))
2271 2271
 				return FileHandler::getRealPath($xml_file);
2272
-			else{
2272
+			else {
2273 2273
 				$ruleset = str_replace('#', '', $ruleset);
2274 2274
 			}
2275 2275
 
2276 2276
 		}
2277 2277
 		// Get a path of the requested module. Return if not exists.
2278 2278
 		$class_path = ModuleHandler::getModulePath($module);
2279
-		if(!$class_path) return;
2279
+		if (!$class_path) return;
2280 2280
 
2281 2281
 		// Check if module.xml exists in the path. Return if not exist
2282 2282
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2283
-		if(!file_exists($xml_file)) return;
2283
+		if (!file_exists($xml_file)) return;
2284 2284
 
2285 2285
 		return $xml_file;
2286 2286
 	}
@@ -2292,7 +2292,7 @@  discard block
 block discarded – undo
2292 2292
 		$requestVars = Context::getRequestVars();
2293 2293
 
2294 2294
 		$args = new stdClass;
2295
-		$args->site_srl = (int)$requestVars->site_srl;
2295
+		$args->site_srl = (int) $requestVars->site_srl;
2296 2296
 		$args->page = 1; // /< Page
2297 2297
 		$args->list_count = 100; // /< the number of posts to display on a single page
2298 2298
 		$args->page_count = 5; // /< the number of pages that appear in the page navigation
@@ -2304,9 +2304,9 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 		$list = array();
2306 2306
 
2307
-		if($output->toBool())
2307
+		if ($output->toBool())
2308 2308
 		{
2309
-			foreach((array)$output->data as $code_info)
2309
+			foreach ((array) $output->data as $code_info)
2310 2310
 			{
2311 2311
 				unset($codeInfo);
2312 2312
 				$codeInfo = array('name'=>'$user_lang->'.$code_info->name, 'value'=>$code_info->value);
Please login to merge, or discard this patch.
Braces   +470 added lines, -209 removed lines patch added patch discarded remove patch
@@ -19,26 +19,34 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	function isIDExists($id, $site_srl = 0)
21 21
 	{
22
-		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true;
22
+		if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) {
23
+			return true;
24
+		}
23 25
 		// directory and rss/atom/api reserved checking, etc.
24 26
 		$dirs = FileHandler::readDir(_XE_PATH_);
25 27
 		$dirs[] = 'rss';
26 28
 		$dirs[] = 'atom';
27 29
 		$dirs[] = 'api';
28
-		if(in_array($id, $dirs)) return true;
30
+		if(in_array($id, $dirs)) {
31
+			return true;
32
+		}
29 33
 		// mid test
30 34
 		$args = new stdClass();
31 35
 		$args->mid = $id;
32 36
 		$args->site_srl = $site_srl;
33 37
 		$output = executeQuery('module.isExistsModuleName', $args);
34
-		if($output->data->count) return true;
38
+		if($output->data->count) {
39
+			return true;
40
+		}
35 41
 		// vid test (check mid != vid if site_srl=0, which means it is not a virtual site)
36 42
 		if(!$site_srl)
37 43
 		{
38 44
 			$site_args = new stdClass();
39 45
 			$site_args->domain = $id;
40 46
 			$output = executeQuery('module.isExistsSiteDomain', $site_args);
41
-			if($output->data->count) return true;
47
+			if($output->data->count) {
48
+				return true;
49
+			}
42 50
 		}
43 51
 
44 52
 		return false;
@@ -82,10 +90,14 @@  discard block
 block discarded – undo
82 90
 	function getDefaultMid()
83 91
 	{
84 92
 		$default_url = Context::getDefaultUrl();
85
-		if($default_url && substr_compare($default_url, '/', -1) === 0) $default_url = substr($default_url, 0, -1);
93
+		if($default_url && substr_compare($default_url, '/', -1) === 0) {
94
+			$default_url = substr($default_url, 0, -1);
95
+		}
86 96
 
87 97
 		$request_url = Context::getRequestUri();
88
-		if($request_url && substr_compare($request_url, '/', -1) === 0) $request_url = substr($request_url, 0, -1);
98
+		if($request_url && substr_compare($request_url, '/', -1) === 0) {
99
+			$request_url = substr($request_url, 0, -1);
100
+		}
89 101
 
90 102
 		$default_url_parse = parse_url($default_url);
91 103
 		$request_url_parse = parse_url($request_url);
@@ -100,14 +112,18 @@  discard block
 block discarded – undo
100 112
 			$hostname = $request_url_parse['host'];
101 113
 			$path = $request_url_parse['path'];
102 114
 			$port = $request_url_parse['port'];
103
-			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) $path = substr($path, 0, -1);
115
+			if(strlen($path) >= 1 && substr_compare($path, '/', -1) === 0) {
116
+				$path = substr($path, 0, -1);
117
+			}
104 118
 
105 119
 			$domain = sprintf('%s%s%s', $hostname, $port && ($port != 80 )? ':'.$port  : '', $path);
106 120
 		}
107 121
 
108 122
 		if($domain === '')
109 123
 		{
110
-			if(!$vid) $vid = $mid;
124
+			if(!$vid) {
125
+				$vid = $mid;
126
+			}
111 127
 			if($vid)
112 128
 			{
113 129
 				$domain = $vid;
@@ -133,13 +149,17 @@  discard block
 block discarded – undo
133 149
 				$output = executeQuery('module.getSiteInfoByDomain', $args);
134 150
 				$site_info = $output->data;
135 151
 
136
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($domain_cache_key, $site_info);
152
+				if($oCacheHandler->isSupport()) {
153
+					$oCacheHandler->put($domain_cache_key, $site_info);
154
+				}
137 155
 			}
138 156
 
139 157
 			if($site_info && $vid)
140 158
 			{
141 159
 				Context::set('vid', $site_info->domain, true);
142
-				if(strtolower($mid)==strtolower($site_info->domain)) Context::set('mid', $site_info->mid,true);
160
+				if(strtolower($mid)==strtolower($site_info->domain)) {
161
+					Context::set('mid', $site_info->mid,true);
162
+				}
143 163
 			}
144 164
 			if(!$site_info || !$site_info->domain) { $domain = ''; unset($site_info); }
145 165
 		}
@@ -165,8 +185,12 @@  discard block
 block discarded – undo
165 185
 				{
166 186
 					// Create a table if sites table doesn't exist
167 187
 					$oDB = &DB::getInstance();
168
-					if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
169
-					if(!$oDB->isTableExists('sites')) return;
188
+					if(!$oDB->isTableExists('sites')) {
189
+						$oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml');
190
+					}
191
+					if(!$oDB->isTableExists('sites')) {
192
+						return;
193
+					}
170 194
 
171 195
 					// Get mid, language
172 196
 					$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
@@ -184,21 +208,28 @@  discard block
 block discarded – undo
184 208
 					if($output->data && !$output->data->index_module_srl)
185 209
 					{
186 210
 						$output = executeQuery('module.updateSite', $site_args);
187
-					}
188
-					else
211
+					} else
189 212
 					{
190 213
 						$output = executeQuery('module.insertSite', $site_args);
191
-						if(!$output->toBool()) return $output;
214
+						if(!$output->toBool()) {
215
+							return $output;
216
+						}
192 217
 					}
193 218
 					$output = executeQuery('module.getSiteInfo', $args);
194 219
 				}
195 220
 				$site_info = $output->data;
196
-				if($oCacheHandler->isSupport()) $oCacheHandler->put($default_site_cache_key, $site_info);
221
+				if($oCacheHandler->isSupport()) {
222
+					$oCacheHandler->put($default_site_cache_key, $site_info);
223
+				}
197 224
 			}
198 225
 		}
199 226
 
200
-		if(!$site_info->module_srl) return $site_info;
201
-		if(is_array($site_info) && $site_info->data[0]) $site_info = $site_info[0];
227
+		if(!$site_info->module_srl) {
228
+			return $site_info;
229
+		}
230
+		if(is_array($site_info) && $site_info->data[0]) {
231
+			$site_info = $site_info[0];
232
+		}
202 233
 		return $this->addModuleExtraVars($site_info);
203 234
 	}
204 235
 
@@ -248,7 +279,9 @@  discard block
 block discarded – undo
248 279
 		}
249 280
 
250 281
 		$this->applyDefaultSkin($module_info);
251
-		if(!$module_info->module_srl && $module_info->data[0]) $module_info = $module_info->data[0];
282
+		if(!$module_info->module_srl && $module_info->data[0]) {
283
+			$module_info = $module_info->data[0];
284
+		}
252 285
 		return $this->addModuleExtraVars($module_info);
253 286
 	}
254 287
 
@@ -340,8 +373,7 @@  discard block
 block discarded – undo
340 373
 				$object_key = 'mid_info:' . $output->data->module_srl;
341 374
 				$module_info_cache_key = $oCacheHandler->getGroupKey('site_and_module', $object_key);
342 375
 				$oCacheHandler->put($module_info_cache_key, $moduleInfo);
343
-			}
344
-			else
376
+			} else
345 377
 			{
346 378
 				$mid_info->designSettings = $moduleInfo->designSettings;
347 379
 				$moduleInfo = $mid_info;
@@ -382,11 +414,15 @@  discard block
 block discarded – undo
382 414
 			$args = new stdClass();
383 415
 			$args->module_srl = $module_srl;
384 416
 			$output = executeQuery('module.getMidInfo', $args);
385
-			if(!$output->toBool()) return;
417
+			if(!$output->toBool()) {
418
+				return;
419
+			}
386 420
 
387 421
 			$mid_info = $output->data;
388 422
 			$this->applyDefaultSkin($mid_info);
389
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $mid_info);
423
+			if($oCacheHandler->isSupport()) {
424
+				$oCacheHandler->put($cache_key, $mid_info);
425
+			}
390 426
 		}
391 427
 
392 428
 		if($mid_info && count($columnList))
@@ -399,11 +435,14 @@  discard block
 block discarded – undo
399 435
 					$module_info->$key = $item;
400 436
 				}
401 437
 			}
438
+		} else {
439
+			$module_info = $mid_info;
402 440
 		}
403
-		else $module_info = $mid_info;
404 441
 
405 442
 		$oModuleController = getController('module');
406
-		if(isset($module_info->browser_title)) $oModuleController->replaceDefinedLangCode($module_info->browser_title);
443
+		if(isset($module_info->browser_title)) {
444
+			$oModuleController->replaceDefinedLangCode($module_info->browser_title);
445
+		}
407 446
 
408 447
 		$this->applyDefaultSkin($module_info);
409 448
 		return $this->addModuleExtraVars($module_info);
@@ -451,11 +490,15 @@  discard block
 block discarded – undo
451 490
 	 */
452 491
 	function getModulesInfo($module_srls, $columnList = array())
453 492
 	{
454
-		if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
493
+		if(is_array($module_srls)) {
494
+			$module_srls = implode(',',$module_srls);
495
+		}
455 496
 		$args = new stdClass();
456 497
 		$args->module_srls = $module_srls;
457 498
 		$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
458
-		if(!$output->toBool()) return;
499
+		if(!$output->toBool()) {
500
+			return;
501
+		}
459 502
 		return $this->addModuleExtraVars($output->data);
460 503
 	}
461 504
 
@@ -465,31 +508,44 @@  discard block
 block discarded – undo
465 508
 	function addModuleExtraVars($module_info)
466 509
 	{
467 510
 		// Process although one or more module informaion is requested
468
-		if(!is_array($module_info)) $target_module_info = array($module_info);
469
-		else $target_module_info = $module_info;
511
+		if(!is_array($module_info)) {
512
+			$target_module_info = array($module_info);
513
+		} else {
514
+			$target_module_info = $module_info;
515
+		}
470 516
 		// Get module_srl
471 517
 		$module_srls = array();
472 518
 		foreach($target_module_info as $key => $val)
473 519
 		{
474 520
 			$module_srl = $val->module_srl;
475
-			if(!$module_srl) continue;
521
+			if(!$module_srl) {
522
+				continue;
523
+			}
476 524
 			$module_srls[] = $val->module_srl;
477 525
 		}
478 526
 		// Extract extra information of the module and skin
479 527
 		$extra_vars = $this->getModuleExtraVars($module_srls);
480
-		if(!count($module_srls) || !count($extra_vars)) return $module_info;
528
+		if(!count($module_srls) || !count($extra_vars)) {
529
+			return $module_info;
530
+		}
481 531
 
482 532
 		foreach($target_module_info as $key => $val)
483 533
 		{
484
-			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) continue;
534
+			if(!$extra_vars[$val->module_srl] || !count($extra_vars[$val->module_srl])) {
535
+				continue;
536
+			}
485 537
 			foreach($extra_vars[$val->module_srl] as $k => $v)
486 538
 			{
487
-				if($target_module_info[$key]->{$k}) continue;
539
+				if($target_module_info[$key]->{$k}) {
540
+					continue;
541
+				}
488 542
 				$target_module_info[$key]->{$k} = $v;
489 543
 			}
490 544
 		}
491 545
 
492
-		if(is_array($module_info)) return $target_module_info;
546
+		if(is_array($module_info)) {
547
+			return $target_module_info;
548
+		}
493 549
 		return $target_module_info[0];
494 550
 	}
495 551
 
@@ -518,7 +574,9 @@  discard block
 block discarded – undo
518 574
 			}
519 575
 
520 576
 			$output = executeQuery('module.getMidList', $args, $columnList);
521
-			if(!$output->toBool()) return $output;
577
+			if(!$output->toBool()) {
578
+				return $output;
579
+			}
522 580
 			$list = $output->data;
523 581
 
524 582
 			if($oCacheHandler->isSupport() && count($args) === 1 && isset($args->site_srl))
@@ -526,9 +584,13 @@  discard block
 block discarded – undo
526 584
 				$oCacheHandler->put($cache_key, $list);
527 585
 			}
528 586
 		}
529
-		if(!$list) return;
587
+		if(!$list) {
588
+			return;
589
+		}
530 590
 
531
-		if(!is_array($list)) $list = array($list);
591
+		if(!is_array($list)) {
592
+			$list = array($list);
593
+		}
532 594
 
533 595
 		foreach($list as $val)
534 596
 		{
@@ -544,10 +606,14 @@  discard block
 block discarded – undo
544 606
 	function getModuleSrlList($args = null, $columnList = array())
545 607
 	{
546 608
 		$output = executeQueryArray('module.getMidList', $args, $columnList);
547
-		if(!$output->toBool()) return $output;
609
+		if(!$output->toBool()) {
610
+			return $output;
611
+		}
548 612
 
549 613
 		$list = $output->data;
550
-		if(!$list) return;
614
+		if(!$list) {
615
+			return;
616
+		}
551 617
 
552 618
 		return $list;
553 619
 	}
@@ -557,20 +623,32 @@  discard block
 block discarded – undo
557 623
 	 */
558 624
 	function getModuleSrlByMid($mid)
559 625
 	{
560
-		if($mid && !is_array($mid)) $mid = explode(',',$mid);
561
-		if(is_array($mid)) $mid = "'".implode("','",$mid)."'";
626
+		if($mid && !is_array($mid)) {
627
+			$mid = explode(',',$mid);
628
+		}
629
+		if(is_array($mid)) {
630
+			$mid = "'".implode("','",$mid)."'";
631
+		}
562 632
 
563 633
 		$site_module_info = Context::get('site_module_info');
564 634
 
565 635
 		$args = new stdClass;
566 636
 		$args->mid = $mid;
567
-		if($site_module_info) $args->site_srl = $site_module_info->site_srl;
637
+		if($site_module_info) {
638
+			$args->site_srl = $site_module_info->site_srl;
639
+		}
568 640
 		$output = executeQuery('module.getModuleSrlByMid', $args);
569
-		if(!$output->toBool()) return $output;
641
+		if(!$output->toBool()) {
642
+			return $output;
643
+		}
570 644
 
571 645
 		$list = $output->data;
572
-		if(!$list) return;
573
-		if(!is_array($list)) $list = array($list);
646
+		if(!$list) {
647
+			return;
648
+		}
649
+		if(!is_array($list)) {
650
+			$list = array($list);
651
+		}
574 652
 
575 653
 		foreach($list as $key => $val)
576 654
 		{
@@ -599,8 +677,12 @@  discard block
 block discarded – undo
599 677
 		{
600 678
 			$args = new stdClass();
601 679
 			$output = executeQueryArray('module.getActionForward',$args);
602
-			if(!$output->toBool()) return new stdClass;
603
-			if(!$output->data) $output->data = array();
680
+			if(!$output->toBool()) {
681
+				return new stdClass;
682
+			}
683
+			if(!$output->data) {
684
+				$output->data = array();
685
+			}
604 686
 
605 687
 			$action_forward = array();
606 688
 			foreach($output->data as $item)
@@ -617,8 +699,7 @@  discard block
 block discarded – undo
617 699
 		if($action_forward[$act])
618 700
 		{
619 701
 			return $action_forward[$act];
620
-		}
621
-		else
702
+		} else
622 703
 		{
623 704
 			return new stdClass();
624 705
 		}
@@ -726,8 +807,7 @@  discard block
 block discarded – undo
726 807
 			if(file_exists($cache_file))
727 808
 			{
728 809
 				$GLOBALS['__MODULE_EXTEND__'] = include($cache_file);
729
-			}
730
-			else
810
+			} else
731 811
 			{
732 812
 				$GLOBALS['__MODULE_EXTEND__'] = array();
733 813
 			}
@@ -743,16 +823,22 @@  discard block
 block discarded – undo
743 823
 	{
744 824
 		// Get a path of the requested module. Return if not exists.
745 825
 		$module_path = ModuleHandler::getModulePath($module);
746
-		if(!$module_path) return;
826
+		if(!$module_path) {
827
+			return;
828
+		}
747 829
 		// Read the xml file for module skin information
748 830
 		$xml_file = sprintf("%s/conf/info.xml", $module_path);
749
-		if(!file_exists($xml_file)) return;
831
+		if(!file_exists($xml_file)) {
832
+			return;
833
+		}
750 834
 
751 835
 		$oXmlParser = new XmlParser();
752 836
 		$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
753 837
 		$xml_obj = $tmp_xml_obj->module;
754 838
 
755
-		if(!$xml_obj) return;
839
+		if(!$xml_obj) {
840
+			return;
841
+		}
756 842
 
757 843
 		// Module Information
758 844
 		$module_info = new stdClass();
@@ -764,14 +850,19 @@  discard block
 block discarded – undo
764 850
 			$module_info->version = $xml_obj->version->body;
765 851
 			$module_info->homepage = $xml_obj->link->body;
766 852
 			$module_info->category = $xml_obj->category->body;
767
-			if(!$module_info->category) $module_info->category = 'service';
853
+			if(!$module_info->category) {
854
+				$module_info->category = 'service';
855
+			}
768 856
 			sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
769 857
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
770 858
 			$module_info->license = $xml_obj->license->body;
771 859
 			$module_info->license_link = $xml_obj->license->attrs->link;
772 860
 
773
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
774
-			else $author_list = $xml_obj->author;
861
+			if(!is_array($xml_obj->author)) {
862
+				$author_list[] = $xml_obj->author;
863
+			} else {
864
+				$author_list = $xml_obj->author;
865
+			}
775 866
 
776 867
 			foreach($author_list as $author)
777 868
 			{
@@ -781,15 +872,16 @@  discard block
 block discarded – undo
781 872
 				$author_obj->homepage = $author->attrs->link;
782 873
 				$module_info->author[] = $author_obj;
783 874
 			}
784
-		}
785
-		else
875
+		} else
786 876
 		{
787 877
 			// module format 0.1
788 878
 			$module_info->title = $xml_obj->title->body;
789 879
 			$module_info->description = $xml_obj->author->description->body;
790 880
 			$module_info->version = $xml_obj->attrs->version;
791 881
 			$module_info->category = $xml_obj->attrs->category;
792
-			if(!$module_info->category) $module_info->category = 'service';
882
+			if(!$module_info->category) {
883
+				$module_info->category = 'service';
884
+			}
793 885
 			sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
794 886
 			$module_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
795 887
 			$author_obj = new stdClass();
@@ -818,11 +910,15 @@  discard block
 block discarded – undo
818 910
 	{
819 911
 		// Get a path of the requested module. Return if not exists.
820 912
 		$class_path = ModuleHandler::getModulePath($module);
821
-		if(!$class_path) return;
913
+		if(!$class_path) {
914
+			return;
915
+		}
822 916
 
823 917
 		// Check if module.xml exists in the path. Return if not exist
824 918
 		$xml_file = sprintf("%sconf/module.xml", $class_path);
825
-		if(!file_exists($xml_file)) return;
919
+		if(!file_exists($xml_file)) {
920
+			return;
921
+		}
826 922
 
827 923
 		// Check if cached file exists
828 924
 		$cache_file = sprintf(_XE_PATH_ . "files/cache/module_info/%s.%s.%s.php", $module, Context::getLangType(), __XE_VERSION__);
@@ -841,7 +937,10 @@  discard block
 block discarded – undo
841 937
 
842 938
 			$xml_obj = XmlParser::loadXmlFile($xml_file); // /< Read xml file and convert it to xml object
843 939
 
844
-			if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml
940
+			if(!count($xml_obj->module)) {
941
+				return;
942
+			}
943
+			// /< Error occurs if module tag doesn't included in the xml
845 944
 
846 945
 			$grants = $xml_obj->module->grants->grant; // /< Permission information
847 946
 			$permissions = $xml_obj->module->permissions->permission; // /<  Acting permission
@@ -853,8 +952,11 @@  discard block
 block discarded – undo
853 952
 			// Arrange permission information
854 953
 			if($grants)
855 954
 			{
856
-				if(is_array($grants)) $grant_list = $grants;
857
-				else $grant_list[] = $grants;
955
+				if(is_array($grants)) {
956
+					$grant_list = $grants;
957
+				} else {
958
+					$grant_list[] = $grants;
959
+				}
858 960
 
859 961
 				$info->grant = new stdClass();
860 962
 				$buff[] = '$info->grant = new stdClass;';
@@ -876,8 +978,11 @@  discard block
 block discarded – undo
876 978
 			// Permissions to grant
877 979
 			if($permissions)
878 980
 			{
879
-				if(is_array($permissions)) $permission_list = $permissions;
880
-				else $permission_list[] = $permissions;
981
+				if(is_array($permissions)) {
982
+					$permission_list = $permissions;
983
+				} else {
984
+					$permission_list[] = $permissions;
985
+				}
881 986
 
882 987
 				$buff[] = '$info->permission = new stdClass;';
883 988
 
@@ -895,8 +1000,11 @@  discard block
 block discarded – undo
895 1000
 			// for admin menus
896 1001
 			if($menus)
897 1002
 			{
898
-				if(is_array($menus)) $menu_list = $menus;
899
-				else $menu_list[] = $menus;
1003
+				if(is_array($menus)) {
1004
+					$menu_list = $menus;
1005
+				} else {
1006
+					$menu_list[] = $menus;
1007
+				}
900 1008
 
901 1009
 				$buff[] = '$info->menu = new stdClass;';
902 1010
 				$info->menu = new stdClass();
@@ -920,8 +1028,11 @@  discard block
 block discarded – undo
920 1028
 			// actions
921 1029
 			if($actions)
922 1030
 			{
923
-				if(is_array($actions)) $action_list = $actions;
924
-				else $action_list[] = $actions;
1031
+				if(is_array($actions)) {
1032
+					$action_list = $actions;
1033
+				} else {
1034
+					$action_list[] = $actions;
1035
+				}
925 1036
 
926 1037
 				$buff[] = '$info->action = new stdClass;';
927 1038
 				$info->action = new stdClass();
@@ -1010,7 +1121,9 @@  discard block
 block discarded – undo
1010 1121
 			return $info;
1011 1122
 		}
1012 1123
 
1013
-		if(file_exists($cache_file)) return include($cache_file);
1124
+		if(file_exists($cache_file)) {
1125
+			return include($cache_file);
1126
+		}
1014 1127
 	}
1015 1128
 
1016 1129
 	/**
@@ -1048,7 +1161,9 @@  discard block
 block discarded – undo
1048 1161
 
1049 1162
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1050 1163
 		$list = FileHandler::readDir($skin_path);
1051
-		if(!count($list)) return;
1164
+		if(!count($list)) {
1165
+			return;
1166
+		}
1052 1167
 
1053 1168
 		natcasesort($list);
1054 1169
 
@@ -1102,8 +1217,7 @@  discard block
 block discarded – undo
1102 1217
 			if($dir == 'skins')
1103 1218
 			{
1104 1219
 				$type = 'P';
1105
-			}
1106
-			else
1220
+			} else
1107 1221
 			{
1108 1222
 				$type = 'M';
1109 1223
 			}
@@ -1131,14 +1245,20 @@  discard block
 block discarded – undo
1131 1245
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1132 1246
 	{
1133 1247
 		// Read xml file having skin information
1134
-		if(substr($path,-1)!='/') $path .= '/';
1248
+		if(substr($path,-1)!='/') {
1249
+			$path .= '/';
1250
+		}
1135 1251
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1136
-		if(!file_exists($skin_xml_file)) return;
1252
+		if(!file_exists($skin_xml_file)) {
1253
+			return;
1254
+		}
1137 1255
 		// Create XmlParser object
1138 1256
 		$oXmlParser = new XmlParser();
1139 1257
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1140 1258
 		// Return if no skin information is
1141
-		if(!$_xml_obj->skin) return;
1259
+		if(!$_xml_obj->skin) {
1260
+			return;
1261
+		}
1142 1262
 		$xml_obj = $_xml_obj->skin;
1143 1263
 		// Skin Name
1144 1264
 		$skin_info = new stdClass();
@@ -1155,8 +1275,11 @@  discard block
 block discarded – undo
1155 1275
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1156 1276
 			$skin_info->description = $xml_obj->description->body;
1157 1277
 
1158
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1159
-			else $author_list = $xml_obj->author;
1278
+			if(!is_array($xml_obj->author)) {
1279
+				$author_list[] = $xml_obj->author;
1280
+			} else {
1281
+				$author_list = $xml_obj->author;
1282
+			}
1160 1283
 
1161 1284
 			foreach($author_list as $author)
1162 1285
 			{
@@ -1170,8 +1293,12 @@  discard block
 block discarded – undo
1170 1293
 			if($xml_obj->extra_vars)
1171 1294
 			{
1172 1295
 				$extra_var_groups = $xml_obj->extra_vars->group;
1173
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1174
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1296
+				if(!$extra_var_groups) {
1297
+					$extra_var_groups = $xml_obj->extra_vars;
1298
+				}
1299
+				if(!is_array($extra_var_groups)) {
1300
+					$extra_var_groups = array($extra_var_groups);
1301
+				}
1175 1302
 
1176 1303
 				foreach($extra_var_groups as $group)
1177 1304
 				{
@@ -1180,7 +1307,9 @@  discard block
 block discarded – undo
1180 1307
 					{
1181 1308
 						continue;
1182 1309
 					}
1183
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1310
+					if(!is_array($group->var)) {
1311
+						$extra_vars = array($group->var);
1312
+					}
1184 1313
 
1185 1314
 					foreach($extra_vars as $key => $val)
1186 1315
 					{
@@ -1207,8 +1336,7 @@  discard block
 block discarded – undo
1207 1336
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1208 1337
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1209 1338
 							}
1210
-						}
1211
-						else
1339
+						} else
1212 1340
 						{
1213 1341
 							$obj->options[0] = new stdClass();
1214 1342
 							$obj->options[0]->title = $val->options->title->body;
@@ -1219,8 +1347,7 @@  discard block
 block discarded – undo
1219 1347
 					}
1220 1348
 				}
1221 1349
 			}
1222
-		}
1223
-		else
1350
+		} else
1224 1351
 		{
1225 1352
 			// skin format v0.1
1226 1353
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1238,8 +1365,12 @@  discard block
 block discarded – undo
1238 1365
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1239 1366
 			// Variables used in the skin
1240 1367
 			$extra_var_groups = $xml_obj->extra_vars->group;
1241
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1242
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1368
+			if(!$extra_var_groups) {
1369
+				$extra_var_groups = $xml_obj->extra_vars;
1370
+			}
1371
+			if(!is_array($extra_var_groups)) {
1372
+				$extra_var_groups = array($extra_var_groups);
1373
+			}
1243 1374
 
1244 1375
 			foreach($extra_var_groups as $group)
1245 1376
 			{
@@ -1247,7 +1378,9 @@  discard block
 block discarded – undo
1247 1378
 
1248 1379
 				if($extra_vars)
1249 1380
 				{
1250
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1381
+					if(!is_array($extra_vars)) {
1382
+						$extra_vars = array($extra_vars);
1383
+					}
1251 1384
 
1252 1385
 					foreach($extra_vars as $var)
1253 1386
 					{
@@ -1269,8 +1402,7 @@  discard block
 block discarded – undo
1269 1402
 								$options[$i]->title = $var->default[$i]->body;
1270 1403
 								$options[$i]->value = $var->default[$i]->body;
1271 1404
 							}
1272
-						}
1273
-						else
1405
+						} else
1274 1406
 						{
1275 1407
 							$options[0]->title = $var->default->body;
1276 1408
 							$options[0]->value = $var->default->body;
@@ -1300,7 +1432,9 @@  discard block
 block discarded – undo
1300 1432
 		$colorset = $xml_obj->colorset->color;
1301 1433
 		if($colorset)
1302 1434
 		{
1303
-			if(!is_array($colorset)) $colorset = array($colorset);
1435
+			if(!is_array($colorset)) {
1436
+				$colorset = array($colorset);
1437
+			}
1304 1438
 
1305 1439
 			foreach($colorset as $color)
1306 1440
 			{
@@ -1310,9 +1444,12 @@  discard block
 block discarded – undo
1310 1444
 				if($screenshot)
1311 1445
 				{
1312 1446
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1313
-					if(!file_exists($screenshot)) $screenshot = "";
1447
+					if(!file_exists($screenshot)) {
1448
+						$screenshot = "";
1449
+					}
1450
+				} else {
1451
+					$screenshot = "";
1314 1452
 				}
1315
-				else $screenshot = "";
1316 1453
 
1317 1454
 				$obj = new stdClass();
1318 1455
 				$obj->name = $name;
@@ -1325,7 +1462,9 @@  discard block
 block discarded – undo
1325 1462
 		if($xml_obj->menus->menu)
1326 1463
 		{
1327 1464
 			$menus = $xml_obj->menus->menu;
1328
-			if(!is_array($menus)) $menus = array($menus);
1465
+			if(!is_array($menus)) {
1466
+				$menus = array($menus);
1467
+			}
1329 1468
 
1330 1469
 			$menu_count = count($menus);
1331 1470
 			$skin_info->menu_count = $menu_count;
@@ -1334,7 +1473,9 @@  discard block
 block discarded – undo
1334 1473
 				unset($obj);
1335 1474
 
1336 1475
 				$obj->name = $menus[$i]->attrs->name;
1337
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1476
+				if($menus[$i]->attrs->default == "true") {
1477
+					$obj->default = true;
1478
+				}
1338 1479
 				$obj->title = $menus[$i]->title->body;
1339 1480
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1340 1481
 
@@ -1354,7 +1495,9 @@  discard block
 block discarded – undo
1354 1495
 	{
1355 1496
 		$args = new stdClass;
1356 1497
 		$args->site_srl = $site_srl;
1357
-		if(!is_null($module)) $args->module = $module;
1498
+		if(!is_null($module)) {
1499
+			$args->module = $module;
1500
+		}
1358 1501
 		$output = executeQuery('module.getModuleCount', $args);
1359 1502
 		return $output->data->count;
1360 1503
 	}
@@ -1383,8 +1526,11 @@  discard block
 block discarded – undo
1383 1526
 				$args->module = $module;
1384 1527
 				$args->site_srl = $site_srl;
1385 1528
 				$output = executeQuery('module.getModuleConfig', $args);
1386
-				if($output->data->config) $config = unserialize($output->data->config);
1387
-				else $config = null;
1529
+				if($output->data->config) {
1530
+					$config = unserialize($output->data->config);
1531
+				} else {
1532
+					$config = null;
1533
+				}
1388 1534
 
1389 1535
 				//insert in cache
1390 1536
 				if($oCacheHandler->isSupport())
@@ -1423,8 +1569,11 @@  discard block
 block discarded – undo
1423 1569
 				$args->module = $module;
1424 1570
 				$args->module_srl = $module_srl;
1425 1571
 				$output = executeQuery('module.getModulePartConfig', $args);
1426
-				if($output->data->config) $config = unserialize($output->data->config);
1427
-				else $config = null;
1572
+				if($output->data->config) {
1573
+					$config = unserialize($output->data->config);
1574
+				} else {
1575
+					$config = null;
1576
+				}
1428 1577
 
1429 1578
 				//insert in cache
1430 1579
 				if($oCacheHandler->isSupport())
@@ -1446,9 +1595,13 @@  discard block
 block discarded – undo
1446 1595
 	{
1447 1596
 		$args = new stdClass();
1448 1597
 		$args->module = $module;
1449
-		if($site_srl) $args->site_srl = $site_srl;
1598
+		if($site_srl) {
1599
+			$args->site_srl = $site_srl;
1600
+		}
1450 1601
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1451
-		if(!$output->toBool() || !$output->data) return array();
1602
+		if(!$output->toBool() || !$output->data) {
1603
+			return array();
1604
+		}
1452 1605
 
1453 1606
 		foreach($output->data as $key => $val)
1454 1607
 		{
@@ -1466,10 +1619,16 @@  discard block
 block discarded – undo
1466 1619
 		$args->moduleCategorySrl = $moduleCategorySrl;
1467 1620
 		// Get data from the DB
1468 1621
 		$output = executeQuery('module.getModuleCategories', $args);
1469
-		if(!$output->toBool()) return $output;
1622
+		if(!$output->toBool()) {
1623
+			return $output;
1624
+		}
1470 1625
 		$list = $output->data;
1471
-		if(!$list) return;
1472
-		if(!is_array($list)) $list = array($list);
1626
+		if(!$list) {
1627
+			return;
1628
+		}
1629
+		if(!is_array($list)) {
1630
+			$list = array($list);
1631
+		}
1473 1632
 
1474 1633
 		foreach($list as $val)
1475 1634
 		{
@@ -1487,7 +1646,9 @@  discard block
 block discarded – undo
1487 1646
 		$args = new stdClass;
1488 1647
 		$args->module_category_srl = $module_category_srl;
1489 1648
 		$output = executeQuery('module.getModuleCategory', $args);
1490
-		if(!$output->toBool()) return $output;
1649
+		if(!$output->toBool()) {
1650
+			return $output;
1651
+		}
1491 1652
 		return $output->data;
1492 1653
 	}
1493 1654
 
@@ -1499,7 +1660,9 @@  discard block
 block discarded – undo
1499 1660
 		// Get a list of downloaded and installed modules
1500 1661
 		$searched_list = FileHandler::readDir('./modules');
1501 1662
 		$searched_count = count($searched_list);
1502
-		if(!$searched_count) return;
1663
+		if(!$searched_count) {
1664
+			return;
1665
+		}
1503 1666
 		sort($searched_list);
1504 1667
 
1505 1668
 		for($i=0;$i<$searched_count;$i++)
@@ -1512,7 +1675,9 @@  discard block
 block discarded – undo
1512 1675
 			$info = $this->getModuleInfoXml($module_name);
1513 1676
 			unset($obj);
1514 1677
 
1515
-			if(!isset($info)) continue;
1678
+			if(!isset($info)) {
1679
+				continue;
1680
+			}
1516 1681
 			$info->module = $module_name;
1517 1682
 			$info->created_table_count = $created_table_count;
1518 1683
 			$info->table_count = $table_count;
@@ -1538,11 +1703,16 @@  discard block
 block discarded – undo
1538 1703
 			for($j=0;$j<count($tmp_files);$j++)
1539 1704
 			{
1540 1705
 				list($table_name) = explode(".",$tmp_files[$j]);
1541
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1706
+				if($oDB->isTableExists($table_name)) {
1707
+					$created_table_count ++;
1708
+				}
1542 1709
 			}
1543 1710
 			// Check if DB is installed
1544
-			if($table_count > $created_table_count) return true;
1545
-			else return false;
1711
+			if($table_count > $created_table_count) {
1712
+				return true;
1713
+			} else {
1714
+				return false;
1715
+			}
1546 1716
 		}
1547 1717
 		return false;
1548 1718
 	}
@@ -1565,15 +1735,23 @@  discard block
 block discarded – undo
1565 1735
 	 */
1566 1736
 	public function needUpdate($update_id)
1567 1737
 	{
1568
-		if(!is_array($update_id)) $update_id = array($update_id);
1738
+		if(!is_array($update_id)) {
1739
+			$update_id = array($update_id);
1740
+		}
1569 1741
 
1570 1742
 		$args = new stdClass();
1571 1743
 		$args->update_id = implode(',', $update_id);
1572 1744
 		$output = executeQueryArray('module.getModuleUpdateLog', $args);
1573 1745
 
1574
-		if(!!$output->error) return false;
1575
-		if(!$output->data) $output->data = array();
1576
-		if(count($update_id) === count($output->data)) return false;
1746
+		if(!!$output->error) {
1747
+			return false;
1748
+		}
1749
+		if(!$output->data) {
1750
+			$output->data = array();
1751
+		}
1752
+		if(count($update_id) === count($output->data)) {
1753
+			return false;
1754
+		}
1577 1755
 
1578 1756
 		return true;
1579 1757
 	}
@@ -1590,7 +1768,9 @@  discard block
 block discarded – undo
1590 1768
 		sort($searched_list);
1591 1769
 
1592 1770
 		$searched_count = count($searched_list);
1593
-		if(!$searched_count) return;
1771
+		if(!$searched_count) {
1772
+			return;
1773
+		}
1594 1774
 
1595 1775
 		for($i=0;$i<$searched_count;$i++)
1596 1776
 		{
@@ -1598,7 +1778,9 @@  discard block
 block discarded – undo
1598 1778
 			$module_name = $searched_list[$i];
1599 1779
 
1600 1780
 			$path = ModuleHandler::getModulePath($module_name);
1601
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1781
+			if(!is_dir(FileHandler::getRealPath($path))) {
1782
+				continue;
1783
+			}
1602 1784
 
1603 1785
 			// Get the number of xml files to create a table in schemas
1604 1786
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1608,13 +1790,17 @@  discard block
 block discarded – undo
1608 1790
 			for($j=0;$j<$table_count;$j++)
1609 1791
 			{
1610 1792
 				list($table_name) = explode('.',$tmp_files[$j]);
1611
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1793
+				if($oDB->isTableExists($table_name)) {
1794
+					$created_table_count ++;
1795
+				}
1612 1796
 			}
1613 1797
 			// Get information of the module
1614 1798
 			$info = NULL;
1615 1799
 			$info = $this->getModuleInfoXml($module_name);
1616 1800
 
1617
-			if(!$info) continue;
1801
+			if(!$info) {
1802
+				continue;
1803
+			}
1618 1804
 
1619 1805
 			$info->module = $module_name;
1620 1806
 			$info->category = $info->category;
@@ -1623,16 +1809,18 @@  discard block
 block discarded – undo
1623 1809
 			$info->path = $path;
1624 1810
 			$info->admin_index_act = $info->admin_index_act;
1625 1811
 			// Check if DB is installed
1626
-			if($table_count > $created_table_count) $info->need_install = true;
1627
-			else $info->need_install = false;
1812
+			if($table_count > $created_table_count) {
1813
+				$info->need_install = true;
1814
+			} else {
1815
+				$info->need_install = false;
1816
+			}
1628 1817
 			// Check if it is upgraded to module.class.php on each module
1629 1818
 			$oDummy = null;
1630 1819
 			$oDummy = getModule($module_name, 'class');
1631 1820
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1632 1821
 			{
1633 1822
 				$info->need_update = $oDummy->checkUpdate();
1634
-			}
1635
-			else
1823
+			} else
1636 1824
 			{
1637 1825
 				continue;
1638 1826
 			}
@@ -1649,7 +1837,9 @@  discard block
 block discarded – undo
1649 1837
 	 */
1650 1838
 	function syncModuleToSite(&$data)
1651 1839
 	{
1652
-		if(!$data) return;
1840
+		if(!$data) {
1841
+			return;
1842
+		}
1653 1843
 
1654 1844
 		if(is_array($data))
1655 1845
 		{
@@ -1657,9 +1847,10 @@  discard block
 block discarded – undo
1657 1847
 			{
1658 1848
 				$module_srls[] = $val->module_srl;
1659 1849
 			}
1660
-			if(!count($module_srls)) return;
1661
-		}
1662
-		else
1850
+			if(!count($module_srls)) {
1851
+				return;
1852
+			}
1853
+		} else
1663 1854
 		{
1664 1855
 			$module_srls[] = $data->module_srl;
1665 1856
 		}
@@ -1667,7 +1858,9 @@  discard block
 block discarded – undo
1667 1858
 		$args = new stdClass();
1668 1859
 		$args->module_srls = implode(',',$module_srls);
1669 1860
 		$output = executeQueryArray('module.getModuleSites', $args);
1670
-		if(!$output->data) return array();
1861
+		if(!$output->data) {
1862
+			return array();
1863
+		}
1671 1864
 		foreach($output->data as $key => $val)
1672 1865
 		{
1673 1866
 			$modules[$val->module_srl] = $val;
@@ -1679,8 +1872,7 @@  discard block
 block discarded – undo
1679 1872
 			{
1680 1873
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1681 1874
 			}
1682
-		}
1683
-		else
1875
+		} else
1684 1876
 		{
1685 1877
 			$data->domain = $modules[$data->module_srl]->domain;
1686 1878
 		}
@@ -1691,24 +1883,31 @@  discard block
 block discarded – undo
1691 1883
 	 */
1692 1884
 	function isSiteAdmin($member_info, $site_srl = null)
1693 1885
 	{
1694
-		if(!$member_info->member_srl) return false;
1695
-		if($member_info->is_admin == 'Y') return true;
1886
+		if(!$member_info->member_srl) {
1887
+			return false;
1888
+		}
1889
+		if($member_info->is_admin == 'Y') {
1890
+			return true;
1891
+		}
1696 1892
 
1697 1893
 		$args = new stdClass();
1698 1894
 		if(!isset($site_srl))
1699 1895
 		{
1700 1896
 			$site_module_info = Context::get('site_module_info');
1701
-			if(!$site_module_info) return;
1897
+			if(!$site_module_info) {
1898
+				return;
1899
+			}
1702 1900
 			$args->site_srl = $site_module_info->site_srl;
1703
-		}
1704
-		else
1901
+		} else
1705 1902
 		{
1706 1903
 			$args->site_srl = $site_srl;
1707 1904
 		}
1708 1905
 
1709 1906
 		$args->member_srl = $member_info->member_srl;
1710 1907
 		$output = executeQuery('module.isSiteAdmin', $args);
1711
-		if($output->data->member_srl == $args->member_srl) return true;
1908
+		if($output->data->member_srl == $args->member_srl) {
1909
+			return true;
1910
+		}
1712 1911
 		return false;
1713 1912
 	}
1714 1913
 
@@ -1731,7 +1930,9 @@  discard block
 block discarded – undo
1731 1930
 		$obj = new stdClass();
1732 1931
 		$obj->module_srl = $module_srl;
1733 1932
 		$output = executeQueryArray('module.getAdminID', $obj);
1734
-		if(!$output->toBool() || !$output->data) return;
1933
+		if(!$output->toBool() || !$output->data) {
1934
+			return;
1935
+		}
1735 1936
 
1736 1937
 		return $output->data;
1737 1938
 	}
@@ -1744,7 +1945,9 @@  discard block
 block discarded – undo
1744 1945
 	{
1745 1946
 		$extra_vars = array();
1746 1947
 		$get_module_srls = array();
1747
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1948
+		if(!is_array($list_module_srl)) {
1949
+			$list_module_srl = array($list_module_srl);
1950
+		}
1748 1951
 
1749 1952
 		$vars = false;
1750 1953
 		// cache controll
@@ -1760,14 +1963,12 @@  discard block
 block discarded – undo
1760 1963
 				if($vars)
1761 1964
 				{
1762 1965
 					$extra_vars[$module_srl] = $vars;
1763
-				}
1764
-				else
1966
+				} else
1765 1967
 				{
1766 1968
 					$get_module_srls[] = $module_srl;
1767 1969
 				}
1768 1970
 			}
1769
-		}
1770
-		else
1971
+		} else
1771 1972
 		{
1772 1973
 			$get_module_srls = $list_module_srl;
1773 1974
 		}
@@ -1792,7 +1993,9 @@  discard block
 block discarded – undo
1792 1993
 			}
1793 1994
 			foreach($output->data as $key => $val)
1794 1995
 			{
1795
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1996
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1997
+					continue;
1998
+				}
1796 1999
 
1797 2000
 				if(!isset($extra_vars[$val->module_srl]))
1798 2001
 				{
@@ -1831,7 +2034,9 @@  discard block
 block discarded – undo
1831 2034
 			$args = new stdClass();
1832 2035
 			$args->module_srl = $module_srl;
1833 2036
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1834
-			if(!$output->toBool()) return;
2037
+			if(!$output->toBool()) {
2038
+				return;
2039
+			}
1835 2040
 
1836 2041
 			$skin_vars = array();
1837 2042
 			foreach($output->data as $vars)
@@ -1839,7 +2044,9 @@  discard block
 block discarded – undo
1839 2044
 				$skin_vars[$vars->name] = $vars;
1840 2045
 			}
1841 2046
 
1842
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2047
+			if($oCacheHandler->isSupport()) {
2048
+				$oCacheHandler->put($cache_key, $skin_vars);
2049
+			}
1843 2050
 		}
1844 2051
 
1845 2052
 		return $skin_vars;
@@ -1851,7 +2058,9 @@  discard block
 block discarded – undo
1851 2058
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1852 2059
 	{
1853 2060
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1854
-		if(!$site_srl) $site_srl = 0;
2061
+		if(!$site_srl) {
2062
+			$site_srl = 0;
2063
+		}
1855 2064
 
1856 2065
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1857 2066
 		if(is_readable($designInfoFile))
@@ -1868,19 +2077,16 @@  discard block
 block discarded – undo
1868 2077
 			if(is_dir($moduleSkinPath.'default'))
1869 2078
 			{
1870 2079
 				$skinName = 'default';
1871
-			}
1872
-			else if(is_dir($moduleSkinPath.'xe_default'))
2080
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1873 2081
 			{
1874 2082
 				$skinName = 'xe_default';
1875
-			}
1876
-			else
2083
+			} else
1877 2084
 			{
1878 2085
 				$skins = FileHandler::readDir($moduleSkinPath);
1879 2086
 				if(count($skins) > 0)
1880 2087
 				{
1881 2088
 					$skinName = $skins[0];
1882
-				}
1883
-				else
2089
+				} else
1884 2090
 				{
1885 2091
 					$skinName = NULL;
1886 2092
 				}
@@ -1888,7 +2094,9 @@  discard block
 block discarded – undo
1888 2094
 
1889 2095
 			if($updateCache && $skinName)
1890 2096
 			{
1891
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2097
+				if(!isset($designInfo->module->{$module_name})) {
2098
+					$designInfo->module->{$module_name} = new stdClass();
2099
+				}
1892 2100
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1893 2101
 
1894 2102
 				$oAdminController = getAdminController('admin');
@@ -1904,23 +2112,28 @@  discard block
 block discarded – undo
1904 2112
 	 */
1905 2113
 	function syncSkinInfoToModuleInfo(&$module_info)
1906 2114
 	{
1907
-		if(!$module_info->module_srl) return;
2115
+		if(!$module_info->module_srl) {
2116
+			return;
2117
+		}
1908 2118
 
1909 2119
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1910 2120
 		if(Mobile::isFromMobilePhone())
1911 2121
 		{
1912 2122
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1913
-		}
1914
-		else
2123
+		} else
1915 2124
 		{
1916 2125
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1917 2126
 		}
1918 2127
 
1919
-		if(!$skin_vars) return;
2128
+		if(!$skin_vars) {
2129
+			return;
2130
+		}
1920 2131
 
1921 2132
 		foreach($skin_vars as $name => $val)
1922 2133
 		{
1923
-			if(isset($module_info->{$name})) continue;
2134
+			if(isset($module_info->{$name})) {
2135
+				continue;
2136
+			}
1924 2137
 			$module_info->{$name} = $val->value;
1925 2138
 		}
1926 2139
 	}
@@ -1946,7 +2159,9 @@  discard block
 block discarded – undo
1946 2159
 			$args = new stdClass();
1947 2160
 			$args->module_srl = $module_srl;
1948 2161
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1949
-			if(!$output->toBool() || !$output->data) return;
2162
+			if(!$output->toBool() || !$output->data) {
2163
+				return;
2164
+			}
1950 2165
 
1951 2166
 			$skin_vars = array();
1952 2167
 			foreach($output->data as $vars)
@@ -1954,7 +2169,9 @@  discard block
 block discarded – undo
1954 2169
 				$skin_vars[$vars->name] = $vars;
1955 2170
 			}
1956 2171
 
1957
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2172
+			if($oCacheHandler->isSupport()) {
2173
+				$oCacheHandler->put($cache_key, $skin_vars);
2174
+			}
1958 2175
 		}
1959 2176
 
1960 2177
 		return $skin_vars;
@@ -1966,7 +2183,9 @@  discard block
 block discarded – undo
1966 2183
 	 */
1967 2184
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1968 2185
 	{
1969
-		if(!$module_info->module_srl) return;
2186
+		if(!$module_info->module_srl) {
2187
+			return;
2188
+		}
1970 2189
 		$skin_vars = false;
1971 2190
 		// cache controll
1972 2191
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1981,17 +2200,25 @@  discard block
 block discarded – undo
1981 2200
 			$args = new stdClass;
1982 2201
 			$args->module_srl = $module_info->module_srl;
1983 2202
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1984
-			if(!$output->toBool()) return;
2203
+			if(!$output->toBool()) {
2204
+				return;
2205
+			}
1985 2206
 			$skin_vars = $output->data;
1986 2207
 
1987 2208
 			//insert in cache
1988
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2209
+			if($oCacheHandler->isSupport()) {
2210
+				$oCacheHandler->put($cache_key, $skin_vars);
2211
+			}
2212
+		}
2213
+		if(!$skin_vars) {
2214
+			return;
1989 2215
 		}
1990
-		if(!$skin_vars) return;
1991 2216
 
1992 2217
 		foreach($output->data as $val)
1993 2218
 		{
1994
-			if(isset($module_info->{$val->name})) continue;
2219
+			if(isset($module_info->{$val->name})) {
2220
+				continue;
2221
+			}
1995 2222
 			$module_info->{$val->name} = $val->value;
1996 2223
 		}
1997 2224
 	}
@@ -2013,10 +2240,12 @@  discard block
 block discarded – undo
2013 2240
 		$grant_info = $xml_info->grant;
2014 2241
 		if($member_info->member_srl)
2015 2242
 		{
2016
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
2017
-			else $group_list = array();
2018
-		}
2019
-		else
2243
+			if(is_array($member_info->group_list)) {
2244
+				$group_list = array_keys($member_info->group_list);
2245
+			} else {
2246
+				$group_list = array();
2247
+			}
2248
+		} else
2020 2249
 		{
2021 2250
 			$group_list = array();
2022 2251
 		}
@@ -2030,8 +2259,7 @@  discard block
 block discarded – undo
2030 2259
 			}
2031 2260
 
2032 2261
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2033
-		}
2034
-		else
2262
+		} else
2035 2263
 		{
2036 2264
 			// If module_srl exists
2037 2265
 			// Get a type of granted permission
@@ -2044,7 +2272,9 @@  discard block
 block discarded – undo
2044 2272
 				$args->module_srl = $module_srl;
2045 2273
 				$args->member_srl = $member_info->member_srl;
2046 2274
 				$output = executeQuery('module.getModuleAdmin',$args);
2047
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2275
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2276
+					$grant->manager = true;
2277
+				}
2048 2278
 			}
2049 2279
 			// If not an administrator, get information from the DB and grant manager privilege.
2050 2280
 			if(!$grant->manager)
@@ -2054,8 +2284,7 @@  discard block
 block discarded – undo
2054 2284
 				if($module_info->module == 'planet')
2055 2285
 				{
2056 2286
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2057
-				}
2058
-				else
2287
+				} else
2059 2288
 				{
2060 2289
 					$args = new stdClass;
2061 2290
 					$args->module_srl = $module_srl;
@@ -2070,42 +2299,48 @@  discard block
 block discarded – undo
2070 2299
 					foreach($output->data as $val)
2071 2300
 					{
2072 2301
 						$grant_exists[$val->name] = true;
2073
-						if($granted[$val->name]) continue;
2302
+						if($granted[$val->name]) {
2303
+							continue;
2304
+						}
2074 2305
 						// Log-in member only
2075 2306
 						if($val->group_srl == -1)
2076 2307
 						{
2077 2308
 							$granted[$val->name] = true;
2078
-							if($member_info->member_srl) $grant->{$val->name} = true;
2309
+							if($member_info->member_srl) {
2310
+								$grant->{$val->name} = true;
2311
+							}
2079 2312
 							// Site-joined member only
2080
-						}
2081
-						elseif($val->group_srl == -2)
2313
+						} elseif($val->group_srl == -2)
2082 2314
 						{
2083 2315
 							$granted[$val->name] = true;
2084 2316
 							// Do not grant any permission for non-logged member
2085
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2317
+							if(!$member_info->member_srl) {
2318
+								$grant->{$val->name} = false;
2319
+							}
2086 2320
 							// Log-in member
2087 2321
 							else
2088 2322
 							{
2089 2323
 								$site_module_info = Context::get('site_module_info');
2090 2324
 								// Permission granted if no information of the currently connected site exists
2091
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2325
+								if(!$site_module_info->site_srl) {
2326
+									$grant->{$val->name} = true;
2327
+								}
2092 2328
 								// Permission is not granted if information of the currently connected site exists
2093
-								elseif(count($group_list)) $grant->{$val->name} = true;
2329
+								elseif(count($group_list)) {
2330
+									$grant->{$val->name} = true;
2331
+								}
2094 2332
 							}
2095 2333
 							// All of non-logged members
2096
-						}
2097
-						elseif($val->group_srl == -3)
2334
+						} elseif($val->group_srl == -3)
2098 2335
 						{
2099 2336
 							$granted[$val->name] = true;
2100 2337
 							$grant->{$val->name} = ($grant->is_admin || $grant->is_site_admin);
2101
-						}
2102
-						elseif($val->group_srl == 0)
2338
+						} elseif($val->group_srl == 0)
2103 2339
 						{
2104 2340
 							$granted[$val->name] = true;
2105 2341
 							$grant->{$val->name} = true;
2106 2342
 							// If a target is a group
2107
-						}
2108
-						else
2343
+						} else
2109 2344
 						{
2110 2345
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2111 2346
 							{
@@ -2116,30 +2351,43 @@  discard block
 block discarded – undo
2116 2351
 					}
2117 2352
 				}
2118 2353
 				// Separate processing for the virtual group access
2119
-				if(!$grant_exists['access']) $grant->access = true;
2354
+				if(!$grant_exists['access']) {
2355
+					$grant->access = true;
2356
+				}
2120 2357
 				if(count($grant_info))
2121 2358
 				{
2122 2359
 					foreach($grant_info as  $grant_name => $grant_item)
2123 2360
 					{
2124
-						if($grant_exists[$grant_name]) continue;
2361
+						if($grant_exists[$grant_name]) {
2362
+							continue;
2363
+						}
2125 2364
 						switch($grant_item->default)
2126 2365
 						{
2127 2366
 							case 'guest' :
2128 2367
 								$grant->{$grant_name} = true;
2129 2368
 								break;
2130 2369
 							case 'member' :
2131
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2132
-								else $grant->{$grant_name} = false;
2370
+								if($member_info->member_srl) {
2371
+									$grant->{$grant_name} = true;
2372
+								} else {
2373
+									$grant->{$grant_name} = false;
2374
+								}
2133 2375
 								break;
2134 2376
 							case 'site' :
2135 2377
 								$site_module_info = Context::get('site_module_info');
2136
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2137
-								else $grant->{$grant_name} = false;
2378
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2379
+									$grant->{$grant_name} = true;
2380
+								} else {
2381
+									$grant->{$grant_name} = false;
2382
+								}
2138 2383
 								break;
2139 2384
 							case 'manager' :
2140 2385
 							case 'root' :
2141
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2142
-								else $grant->{$grant_name} = false;
2386
+								if($member_info->is_admin == 'Y') {
2387
+									$grant->{$grant_name} = true;
2388
+								} else {
2389
+									$grant->{$grant_name} = false;
2390
+								}
2143 2391
 								break;
2144 2392
 						}
2145 2393
 					}
@@ -2215,16 +2463,22 @@  discard block
 block discarded – undo
2215 2463
 	function getFileBoxListHtml()
2216 2464
 	{
2217 2465
 		$logged_info = Context::get('logged_info');
2218
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new BaseObject(-1, 'msg_not_permitted');
2466
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2467
+			return new BaseObject(-1, 'msg_not_permitted');
2468
+		}
2219 2469
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2220 2470
 		$link_params = explode('&',$link['query']);
2221 2471
 		foreach ($link_params as $param)
2222 2472
 		{
2223 2473
 			$param = explode("=",$param);
2224
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2474
+			if($param[0] == 'selected_widget') {
2475
+				$selected_widget = $param[1];
2476
+			}
2225 2477
 		}
2226 2478
 		$oWidgetModel = getModel('widget');
2227
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2479
+		if($selected_widget) {
2480
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2481
+		}
2228 2482
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2229 2483
 
2230 2484
 		$oModuleModel = getModel('module');
@@ -2232,7 +2486,9 @@  discard block
 block discarded – undo
2232 2486
 		Context::set('filebox_list', $output->data);
2233 2487
 
2234 2488
 		$page = Context::get('page');
2235
-		if (!$page) $page = 1;
2489
+		if (!$page) {
2490
+			$page = 1;
2491
+		}
2236 2492
 		Context::set('page', $page);
2237 2493
 		Context::set('page_navigation', $output->page_navigation);
2238 2494
 
@@ -2262,25 +2518,28 @@  discard block
 block discarded – undo
2262 2518
 			$rulsetFile = str_replace('@', '', $ruleset);
2263 2519
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2264 2520
 			return FileHandler::getRealPath($xml_file);
2265
-		}
2266
-		else if (strpos($ruleset, '#') !== false)
2521
+		} else if (strpos($ruleset, '#') !== false)
2267 2522
 		{
2268 2523
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2269 2524
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2270
-			if(is_readable($xml_file))
2271
-				return FileHandler::getRealPath($xml_file);
2272
-			else{
2525
+			if(is_readable($xml_file)) {
2526
+							return FileHandler::getRealPath($xml_file);
2527
+			} else{
2273 2528
 				$ruleset = str_replace('#', '', $ruleset);
2274 2529
 			}
2275 2530
 
2276 2531
 		}
2277 2532
 		// Get a path of the requested module. Return if not exists.
2278 2533
 		$class_path = ModuleHandler::getModulePath($module);
2279
-		if(!$class_path) return;
2534
+		if(!$class_path) {
2535
+			return;
2536
+		}
2280 2537
 
2281 2538
 		// Check if module.xml exists in the path. Return if not exist
2282 2539
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2283
-		if(!file_exists($xml_file)) return;
2540
+		if(!file_exists($xml_file)) {
2541
+			return;
2542
+		}
2284 2543
 
2285 2544
 		return $xml_file;
2286 2545
 	}
@@ -2330,7 +2589,9 @@  discard block
 block discarded – undo
2330 2589
 	function getLangByLangcode()
2331 2590
 	{
2332 2591
 		$langCode = Context::get('langCode');
2333
-		if (!$langCode) return;
2592
+		if (!$langCode) {
2593
+			return;
2594
+		}
2334 2595
 
2335 2596
 		$oModuleController = getController('module');
2336 2597
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
modules/install/install.admin.controller.php 3 patches
Doc Comments   +9 added lines, -1 removed lines patch added patch discarded remove patch
@@ -294,6 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
 	/**
296 296
 	 * @brief Supported languages (was procInstallAdminSaveLangSelected)
297
+	 * @param string $selected_lang
297 298
 	 */
298 299
 	function saveLangSelected($selected_lang)
299 300
 	{
@@ -312,7 +313,7 @@  discard block
 block discarded – undo
312 313
 
313 314
 	/**
314 315
 	 * Change the way the thumbnails are show.
315
-	 * @param $config
316
+	 * @param stdClass $config
316 317
 	 * @return void
317 318
 	 */
318 319
 	function setModulesConfig($config)
@@ -337,6 +338,10 @@  discard block
 block discarded – undo
337 338
 		$oModuleController->updateModuleConfig('module',$args);
338 339
 	}
339 340
 
341
+	/**
342
+	 * @param string $icon
343
+	 * @param string $iconname
344
+	 */
340 345
 	private function saveIconTmp($icon, $iconname)
341 346
 	{
342 347
 
@@ -383,6 +388,9 @@  discard block
 block discarded – undo
383 388
 		return $relative_filename;
384 389
 	}
385 390
 
391
+	/**
392
+	 * @param string $iconname
393
+	 */
386 394
 	private function updateIcon($iconname, $deleteIcon = false) {
387 395
 
388 396
 		$site_info = Context::get('site_module_info');
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
23
+		if (!$module_name) return new BaseObject(-1, 'invalid_request');
24 24
 
25 25
 		$oInstallController = getController('install');
26 26
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,10 +35,10 @@  discard block
 block discarded – undo
35 35
 	{
36 36
 		@set_time_limit(0);
37 37
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
38
+		if (!$module_name) return new BaseObject(-1, 'invalid_request');
39 39
 
40 40
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
41
+		if ($oModule) $output = $oModule->moduleUpdate();
42 42
 		else $output = new BaseObject(-1, 'invalid_request');
43 43
 
44 44
 		return $output;
@@ -53,51 +53,51 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$admin_ip_list = Context::get('admin_ip_list');
55 55
 
56
-		if($admin_ip_list)
56
+		if ($admin_ip_list)
57 57
 		{
58
-			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/",",",$admin_ip_list);
59
-			$admin_ip_list = preg_replace("/\s+/","",$admin_ip_list);
60
-			if(preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
58
+			$admin_ip_list = preg_replace("/[\r|\n|\r\n]+/", ",", $admin_ip_list);
59
+			$admin_ip_list = preg_replace("/\s+/", "", $admin_ip_list);
60
+			if (preg_match('/(<\?|<\?php|\?>)/xsm', $admin_ip_list))
61 61
 			{
62 62
 				$admin_ip_list = '';
63 63
 			}
64
-			$admin_ip_list .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
65
-			$admin_ip_list = explode(',',trim($admin_ip_list, ','));
64
+			$admin_ip_list .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
65
+			$admin_ip_list = explode(',', trim($admin_ip_list, ','));
66 66
 			$admin_ip_list = array_unique($admin_ip_list);
67
-			if(!IpFilter::validate($admin_ip_list)) {
67
+			if (!IpFilter::validate($admin_ip_list)) {
68 68
 				return new BaseObject(-1, 'msg_invalid_ip');
69 69
 			}
70 70
 		}
71 71
 		
72 72
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
73
+		if ($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
+		if ($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
75 75
 
76 76
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77
-		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
77
+		require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php');
78 78
 		$IDN = new idna_convert(array('idn_version' => 2008));
79 79
 		$default_url = $IDN->encode($default_url);
80 80
 
81 81
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
82
+		if (!$use_ssl) $use_ssl = 'none';
83 83
 
84 84
 		$http_port = Context::get('http_port');
85 85
 		$https_port = Context::get('https_port');
86 86
 
87 87
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
88
+		if ($use_rewrite != 'Y') $use_rewrite = 'N';
89 89
 
90 90
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
91
+		if ($use_sso != 'Y') $use_sso = 'N';
92 92
 
93 93
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
94
+		if ($use_db_session != 'Y') $use_db_session = 'N';
95 95
 
96 96
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
97
+		if ($qmail_compatibility != 'Y') $qmail_compatibility = 'N';
98 98
 
99 99
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
100
+		if (!$use_html5) $use_html5 = 'N';
101 101
 
102 102
 		$db_info->default_url = $default_url;
103 103
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 		$db_info->use_html5 = $use_html5;
109 109
 		$db_info->admin_ip_list = $admin_ip_list;
110 110
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
111
+		if ($http_port) $db_info->http_port = (int) $http_port;
112
+		else if ($db_info->http_port) unset($db_info->http_port);
113 113
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
114
+		if ($https_port) $db_info->https_port = (int) $https_port;
115
+		else if ($db_info->https_port) unset($db_info->https_port);
116 116
 
117 117
 		unset($db_info->lang_type);
118 118
 
119 119
 		$oInstallController = getController('install');
120
-		if(!$oInstallController->makeConfigFile())
120
+		if (!$oInstallController->makeConfigFile())
121 121
 		{
122 122
 			return new BaseObject(-1, 'msg_invalid_request');
123 123
 		}
124 124
 		else
125 125
 		{
126 126
 			Context::setDBInfo($db_info);
127
-			if($default_url)
127
+			if ($default_url)
128 128
 			{
129 129
 				$site_args = new stdClass;
130 130
 				$site_args->site_srl = 0;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 	function procInstallAdminUpdateIndexModule()
140 140
 	{
141
-		if(!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
141
+		if (!Context::get('index_module_srl') || !Context::get('menu_item_srl'))
142 142
 		{
143 143
 			return new BaseObject(-1, 'msg_invalid_request');
144 144
 		}
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 		// update homeSitemap.php cache file
158 158
 		$oMenuAdminController = getAdminController('menu');
159 159
 		$homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile();
160
-		if(file_exists($homeMenuCacheFile))
160
+		if (file_exists($homeMenuCacheFile))
161 161
 		{
162 162
 			include($homeMenuCacheFile);
163 163
 		}
164 164
 
165
-		if(!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
165
+		if (!$homeMenuSrl || $homeMenuSrl != $output->menu_srl)
166 166
 		{
167 167
 			$oMenuAdminController->makeHomemenuCacheFile($output->menu_srl);
168 168
 		}
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	function procInstallAdminRemoveFTPInfo()
174 174
 	{
175 175
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
176
+		if (file_exists($ftp_config_file)) unlink($ftp_config_file);
177
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
178 178
 		$this->setMessage('success_deleted');
179 179
 	}
180 180
 
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 186
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 187
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
188
+		if (!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
189 189
 		$ftp_info->sftp = Context::get('sftp');
190 190
 
191 191
 		$ftp_root_path = Context::get('ftp_root_path');
192
-		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
192
+		if (substr($ftp_root_path, strlen($ftp_root_path) - 1) == "/")
193 193
 		{
194 194
 			$ftp_info->ftp_root_path = $ftp_root_path;
195 195
 		}
@@ -198,25 +198,25 @@  discard block
 block discarded – undo
198 198
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 199
 		}
200 200
 
201
-		if(ini_get('safe_mode'))
201
+		if (ini_get('safe_mode'))
202 202
 		{
203 203
 			$ftp_info->ftp_password = Context::get('ftp_password');
204 204
 		}
205 205
 
206 206
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207
-		foreach($ftp_info as $key => $val)
207
+		foreach ($ftp_info as $key => $val)
208 208
 		{
209
-			if(!$val) continue;
210
-			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
209
+			if (!$val) continue;
210
+			if (preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 211
 			{
212 212
 				continue;
213 213
 			}
214
-			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
214
+			$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val));
215 215
 		}
216 216
 		$buff .= "?>";
217 217
 		$config_file = Context::getFTPConfigFile();
218 218
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
219
+		if ($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
220 220
 
221 221
 		$this->setMessage('success_updated');
222 222
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	function procInstallAdminConfig()
227 227
 	{
228 228
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
229
+		if ($use_mobile_view != 'Y') $use_mobile_view = 'N';
230 230
 
231 231
 		$time_zone = Context::get('time_zone');
232 232
 
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 		unset($db_info->lang_type);
238 238
 		Context::setDBInfo($db_info);
239 239
 		$oInstallController = getController('install');
240
-		if(!$oInstallController->makeConfigFile())
240
+		if (!$oInstallController->makeConfigFile())
241 241
 		{
242 242
 			return new BaseObject(-1, 'msg_invalid_request');
243 243
 		}
244 244
 
245 245
 		$site_args = new stdClass();
246 246
 		$site_args->site_srl = 0;
247
-		$site_args->index_module_srl = Context::get('index_module_srl');//
248
-		$site_args->default_language = Context::get('change_lang_type');//
247
+		$site_args->index_module_srl = Context::get('index_module_srl'); //
248
+		$site_args->default_language = Context::get('change_lang_type'); //
249 249
 		$oModuleController = getController('module');
250 250
 		$oModuleController->updateSite($site_args);
251 251
 
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		$deleteFavicon = Context::get('is_delete_favicon');
258 258
 		$deleteMobicon = Context::get('is_delete_mobicon');
259 259
 
260
-		$this->updateIcon('favicon.ico',$deleteFavicon);
261
-		$this->updateIcon('mobicon.png',$deleteMobicon);
260
+		$this->updateIcon('favicon.ico', $deleteFavicon);
261
+		$this->updateIcon('mobicon.png', $deleteMobicon);
262 262
 
263 263
 		//모듈 설정 저장(썸네일, 풋터스크립트)
264 264
 		$config = new stdClass();
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
 
277 277
 		$favicon = Context::get('favicon');
278 278
 		$mobicon = Context::get('mobicon');
279
-		if(!$favicon && !$mobicon) {
279
+		if (!$favicon && !$mobicon) {
280 280
 			Context::set('msg', Context::getLang("msg_invalid_format"));
281 281
 			return;
282 282
 		}
283
-		if($favicon) {
283
+		if ($favicon) {
284 284
 			$name = 'favicon';
285
-			$tmpFileName = $this->saveIconTmp($favicon,'favicon.ico');
285
+			$tmpFileName = $this->saveIconTmp($favicon, 'favicon.ico');
286 286
 		} else {
287 287
 			$name = 'mobicon';
288
-			$tmpFileName = $this->saveIconTmp($mobicon,'mobicon.png');
288
+			$tmpFileName = $this->saveIconTmp($mobicon, 'mobicon.png');
289 289
 		}
290 290
 
291 291
 		Context::set('name', $name);
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 		$lang_supported = Context::loadLangSupported();
303 303
 		$buff = null;
304
-		for($i=0;$i<count($langs);$i++)
304
+		for ($i = 0; $i < count($langs); $i++)
305 305
 		{
306 306
 			$buff .= sprintf("%s,%s\n", $langs[$i], $lang_supported[$langs[$i]]);
307 307
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 		}
330 330
 
331 331
 		$oModuleController = getController('module');
332
-		$oModuleController->insertModuleConfig('document',$documentConfig);
332
+		$oModuleController->insertModuleConfig('document', $documentConfig);
333 333
 
334 334
 		$args = new stdClass;
335 335
 		$args->htmlFooter = $config->htmlFooter;
336 336
 		$args->siteTitle = $config->siteTitle;
337
-		$oModuleController->updateModuleConfig('module',$args);
337
+		$oModuleController->updateModuleConfig('module', $args);
338 338
 	}
339 339
 
340 340
 	private function saveIconTmp($icon, $iconname)
@@ -342,9 +342,9 @@  discard block
 block discarded – undo
342 342
 
343 343
 		$site_info = Context::get('site_module_info');
344 344
 		$virtual_site = '';
345
-		if($site_info->site_srl) 
345
+		if ($site_info->site_srl) 
346 346
 		{
347
-			$virtual_site = $site_info->site_srl . '/';
347
+			$virtual_site = $site_info->site_srl.'/';
348 348
 		}
349 349
 
350 350
 		$target_file = $icon['tmp_name'];
@@ -353,20 +353,20 @@  discard block
 block discarded – undo
353 353
 		$target_filename = _XE_PATH_.$relative_filename;
354 354
 
355 355
 		list($width, $height, $type_no, $attrs) = @getimagesize($target_file);
356
-		if($iconname == 'favicon.ico')
356
+		if ($iconname == 'favicon.ico')
357 357
 		{
358
-			if(!preg_match('/^.*(x-icon|\.icon)$/i',$type)) {
358
+			if (!preg_match('/^.*(x-icon|\.icon)$/i', $type)) {
359 359
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 360
 				return;
361 361
 			}
362 362
 		}
363
-		else if($iconname == 'mobicon.png')
363
+		else if ($iconname == 'mobicon.png')
364 364
 		{
365
-			if(!preg_match('/^.*(png).*$/',$type)) {
365
+			if (!preg_match('/^.*(png).*$/', $type)) {
366 366
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
367 367
 				return;
368 368
 			}
369
-			if(!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
369
+			if (!(($height == '57' && $width == '57') || ($height == '114' && $width == '114'))) {
370 370
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 371
 				return;
372 372
 			}
@@ -387,21 +387,21 @@  discard block
 block discarded – undo
387 387
 
388 388
 		$site_info = Context::get('site_module_info');
389 389
 		$virtual_site = '';
390
-		if($site_info->site_srl) 
390
+		if ($site_info->site_srl) 
391 391
 		{
392
-			$virtual_site = $site_info->site_srl . '/';
392
+			$virtual_site = $site_info->site_srl.'/';
393 393
 		}
394 394
 
395
-		$image_filepath = _XE_PATH_.'files/attach/xeicon/' . $virtual_site;
395
+		$image_filepath = _XE_PATH_.'files/attach/xeicon/'.$virtual_site;
396 396
 
397
-		if($deleteIcon) {
397
+		if ($deleteIcon) {
398 398
 			FileHandler::removeFile($image_filepath.$iconname);
399 399
 			return;
400 400
 		}
401 401
 
402 402
 		$tmpicon_filepath = $image_filepath.'tmp/'.$iconname;
403 403
 		$icon_filepath = $image_filepath.$iconname;
404
-		if(file_exists($tmpicon_filepath))
404
+		if (file_exists($tmpicon_filepath))
405 405
 		{
406 406
 			FileHandler::moveFile($tmpicon_filepath, $icon_filepath);
407 407
 		}
Please login to merge, or discard this patch.
Braces   +68 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	function procInstallAdminInstall()
21 21
 	{
22 22
 		$module_name = Context::get('module_name');
23
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
23
+		if(!$module_name) {
24
+			return new BaseObject(-1, 'invalid_request');
25
+		}
24 26
 
25 27
 		$oInstallController = getController('install');
26 28
 		$oInstallController->installModule($module_name, './modules/'.$module_name);
@@ -35,11 +37,16 @@  discard block
 block discarded – undo
35 37
 	{
36 38
 		@set_time_limit(0);
37 39
 		$module_name = Context::get('module_name');
38
-		if(!$module_name) return new BaseObject(-1, 'invalid_request');
40
+		if(!$module_name) {
41
+			return new BaseObject(-1, 'invalid_request');
42
+		}
39 43
 
40 44
 		$oModule = getModule($module_name, 'class');
41
-		if($oModule) $output = $oModule->moduleUpdate();
42
-		else $output = new BaseObject(-1, 'invalid_request');
45
+		if($oModule) {
46
+			$output = $oModule->moduleUpdate();
47
+		} else {
48
+			$output = new BaseObject(-1, 'invalid_request');
49
+		}
43 50
 
44 51
 		return $output;
45 52
 	}
@@ -70,8 +77,12 @@  discard block
 block discarded – undo
70 77
 		}
71 78
 		
72 79
 		$default_url = Context::get('default_url');
73
-		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) $default_url = 'http://'.$default_url;
74
-		if($default_url && substr($default_url, -1) !== '/') $default_url = $default_url.'/';
80
+		if($default_url && strncasecmp('http://', $default_url, 7) !== 0 && strncasecmp('https://', $default_url, 8) !== 0) {
81
+			$default_url = 'http://'.$default_url;
82
+		}
83
+		if($default_url && substr($default_url, -1) !== '/') {
84
+			$default_url = $default_url.'/';
85
+		}
75 86
 
76 87
 		/* convert NON Alphabet URL to punycode URL - Alphabet URL will not be changed */
77 88
 		require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
@@ -79,25 +90,37 @@  discard block
 block discarded – undo
79 90
 		$default_url = $IDN->encode($default_url);
80 91
 
81 92
 		$use_ssl = Context::get('use_ssl');
82
-		if(!$use_ssl) $use_ssl = 'none';
93
+		if(!$use_ssl) {
94
+			$use_ssl = 'none';
95
+		}
83 96
 
84 97
 		$http_port = Context::get('http_port');
85 98
 		$https_port = Context::get('https_port');
86 99
 
87 100
 		$use_rewrite = Context::get('use_rewrite');
88
-		if($use_rewrite!='Y') $use_rewrite = 'N';
101
+		if($use_rewrite!='Y') {
102
+			$use_rewrite = 'N';
103
+		}
89 104
 
90 105
 		$use_sso = Context::get('use_sso');
91
-		if($use_sso !='Y') $use_sso = 'N';
106
+		if($use_sso !='Y') {
107
+			$use_sso = 'N';
108
+		}
92 109
 
93 110
 		$use_db_session = Context::get('use_db_session');
94
-		if($use_db_session!='Y') $use_db_session = 'N';
111
+		if($use_db_session!='Y') {
112
+			$use_db_session = 'N';
113
+		}
95 114
 
96 115
 		$qmail_compatibility = Context::get('qmail_compatibility');
97
-		if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
116
+		if($qmail_compatibility!='Y') {
117
+			$qmail_compatibility = 'N';
118
+		}
98 119
 
99 120
 		$use_html5 = Context::get('use_html5');
100
-		if(!$use_html5) $use_html5 = 'N';
121
+		if(!$use_html5) {
122
+			$use_html5 = 'N';
123
+		}
101 124
 
102 125
 		$db_info->default_url = $default_url;
103 126
 		$db_info->qmail_compatibility = $qmail_compatibility;
@@ -108,11 +131,17 @@  discard block
 block discarded – undo
108 131
 		$db_info->use_html5 = $use_html5;
109 132
 		$db_info->admin_ip_list = $admin_ip_list;
110 133
 
111
-		if($http_port) $db_info->http_port = (int) $http_port;
112
-		else if($db_info->http_port) unset($db_info->http_port);
134
+		if($http_port) {
135
+			$db_info->http_port = (int) $http_port;
136
+		} else if($db_info->http_port) {
137
+			unset($db_info->http_port);
138
+		}
113 139
 
114
-		if($https_port) $db_info->https_port = (int) $https_port;
115
-		else if($db_info->https_port) unset($db_info->https_port);
140
+		if($https_port) {
141
+			$db_info->https_port = (int) $https_port;
142
+		} else if($db_info->https_port) {
143
+			unset($db_info->https_port);
144
+		}
116 145
 
117 146
 		unset($db_info->lang_type);
118 147
 
@@ -120,8 +149,7 @@  discard block
 block discarded – undo
120 149
 		if(!$oInstallController->makeConfigFile())
121 150
 		{
122 151
 			return new BaseObject(-1, 'msg_invalid_request');
123
-		}
124
-		else
152
+		} else
125 153
 		{
126 154
 			Context::setDBInfo($db_info);
127 155
 			if($default_url)
@@ -173,8 +201,12 @@  discard block
 block discarded – undo
173 201
 	function procInstallAdminRemoveFTPInfo()
174 202
 	{
175 203
 		$ftp_config_file = Context::getFTPConfigFile();
176
-		if(file_exists($ftp_config_file)) unlink($ftp_config_file);
177
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
204
+		if(file_exists($ftp_config_file)) {
205
+			unlink($ftp_config_file);
206
+		}
207
+		if($_SESSION['ftp_password']) {
208
+			unset($_SESSION['ftp_password']);
209
+		}
178 210
 		$this->setMessage('success_deleted');
179 211
 	}
180 212
 
@@ -185,15 +217,16 @@  discard block
 block discarded – undo
185 217
 		$ftp_info->ftp_port = Context::get('ftp_port');
186 218
 		$ftp_info->ftp_host = Context::get('ftp_host');
187 219
 		$ftp_info->ftp_pasv = Context::get('ftp_pasv');
188
-		if(!$ftp_info->ftp_pasv) $ftp_info->ftp_pasv = "N";
220
+		if(!$ftp_info->ftp_pasv) {
221
+			$ftp_info->ftp_pasv = "N";
222
+		}
189 223
 		$ftp_info->sftp = Context::get('sftp');
190 224
 
191 225
 		$ftp_root_path = Context::get('ftp_root_path');
192 226
 		if(substr($ftp_root_path, strlen($ftp_root_path)-1) == "/")
193 227
 		{
194 228
 			$ftp_info->ftp_root_path = $ftp_root_path;
195
-		}
196
-		else
229
+		} else
197 230
 		{
198 231
 			$ftp_info->ftp_root_path = $ftp_root_path.'/';
199 232
 		}
@@ -206,7 +239,9 @@  discard block
 block discarded – undo
206 239
 		$buff = '<?php if(!defined("__XE__")) exit();'."\n\$ftp_info = new stdClass;\n";
207 240
 		foreach($ftp_info as $key => $val)
208 241
 		{
209
-			if(!$val) continue;
242
+			if(!$val) {
243
+				continue;
244
+			}
210 245
 			if(preg_match('/(<\?|<\?php|\?>|fputs|fopen|fwrite|fgets|fread|file_get_contents|file_put_contents|exec|proc_open|popen|passthru|show_source|phpinfo|system|\/\*|\*\/|chr\()/xsm', preg_replace('/\s/', '', $val)))
211 246
 			{
212 247
 				continue;
@@ -216,7 +251,9 @@  discard block
 block discarded – undo
216 251
 		$buff .= "?>";
217 252
 		$config_file = Context::getFTPConfigFile();
218 253
 		FileHandler::WriteFile($config_file, $buff);
219
-		if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
254
+		if($_SESSION['ftp_password']) {
255
+			unset($_SESSION['ftp_password']);
256
+		}
220 257
 
221 258
 		$this->setMessage('success_updated');
222 259
 		$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAdminConfigFtp');
@@ -226,7 +263,9 @@  discard block
 block discarded – undo
226 263
 	function procInstallAdminConfig()
227 264
 	{
228 265
 		$use_mobile_view = Context::get('use_mobile_view');
229
-		if($use_mobile_view!='Y') $use_mobile_view = 'N';
266
+		if($use_mobile_view!='Y') {
267
+			$use_mobile_view = 'N';
268
+		}
230 269
 
231 270
 		$time_zone = Context::get('time_zone');
232 271
 
@@ -322,8 +361,7 @@  discard block
 block discarded – undo
322 361
 		if (!$config->thumbnail_type || $config->thumbnail_type != 'ratio')
323 362
 		{
324 363
 			$documentConfig->thumbnail_type = 'crop';
325
-		}
326
-		else
364
+		} else
327 365
 		{
328 366
 			$documentConfig->thumbnail_type = 'ratio';
329 367
 		}
@@ -359,8 +397,7 @@  discard block
 block discarded – undo
359 397
 				Context::set('msg', '*.ico '.Context::getLang('msg_possible_only_file'));
360 398
 				return;
361 399
 			}
362
-		}
363
-		else if($iconname == 'mobicon.png')
400
+		} else if($iconname == 'mobicon.png')
364 401
 		{
365 402
 			if(!preg_match('/^.*(png).*$/',$type)) {
366 403
 				Context::set('msg', '*.png '.Context::getLang('msg_possible_only_file'));
@@ -370,8 +407,7 @@  discard block
 block discarded – undo
370 407
 				Context::set('msg', Context::getLang('msg_invalid_format').' (size : 57x57, 114x114)');
371 408
 				return;
372 409
 			}
373
-		}
374
-		else
410
+		} else
375 411
 		{
376 412
 			Context::set('msg', Context::getLang('msg_invalid_format'));
377 413
 			return;
Please login to merge, or discard this patch.
widgets/mcontent/mcontent.class.php 2 patches
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -18,32 +18,32 @@  discard block
 block discarded – undo
18 18
 	function proc($args)
19 19
 	{
20 20
 		// Targets to sort
21
-		if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order';
21
+		if (!in_array($args->order_target, array('list_order', 'update_order'))) $args->order_target = 'list_order';
22 22
 		// Sort order
23
-		if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc';
23
+		if (!in_array($args->order_type, array('asc', 'desc'))) $args->order_type = 'asc';
24 24
 		// The number of displayed lists
25
-		$args->list_count = (int)$args->list_count;
26
-		if(!$args->list_count) $args->list_count = 5;
25
+		$args->list_count = (int) $args->list_count;
26
+		if (!$args->list_count) $args->list_count = 5;
27 27
 		// Cut the length of the title
28
-		if(!$args->subject_cut_size) $args->subject_cut_size = 0;
28
+		if (!$args->subject_cut_size) $args->subject_cut_size = 0;
29 29
 		// Cut the length of contents
30
-		if(!$args->content_cut_size) $args->content_cut_size = 100;
30
+		if (!$args->content_cut_size) $args->content_cut_size = 100;
31 31
 		// Viewing options
32
-		$args->option_view_arr = explode(',',$args->option_view);
32
+		$args->option_view_arr = explode(',', $args->option_view);
33 33
 		// markup options
34
-		if(!$args->markup_type) $args->markup_type = 'list';
34
+		if (!$args->markup_type) $args->markup_type = 'list';
35 35
 		// Set variables for internal use
36 36
 		$oModuleModel = getModel('module');
37 37
 		$module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array();
38 38
 		$site_module_info = Context::get('site_module_info');
39 39
 		// List URLs if a type is RSS
40
-		if($args->content_type == 'rss')
40
+		if ($args->content_type == 'rss')
41 41
 		{
42 42
 			$args->rss_urls = array();
43
-			$rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4));
44
-			for($i=0,$c=count($rss_urls);$i<$c;$i++)
43
+			$rss_urls = array_unique(array($args->rss_url0, $args->rss_url1, $args->rss_url2, $args->rss_url3, $args->rss_url4));
44
+			for ($i = 0, $c = count($rss_urls); $i < $c; $i++)
45 45
 			{
46
-				if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
46
+				if ($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
47 47
 			}
48 48
 			// Get module information after listing module_srls if the module is not RSS
49 49
 		}
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 		{
52 52
 			$obj = new stdClass();
53 53
 			// Apply to all modules in the site if a target module is not specified
54
-			if(!$args->module_srls)
54
+			if (!$args->module_srls)
55 55
 			{
56
-				$obj->site_srl = (int)$site_module_info->site_srl;
56
+				$obj->site_srl = (int) $site_module_info->site_srl;
57 57
 				$output = executeQueryArray('widgets.content.getMids', $obj);
58
-				if($output->data)
58
+				if ($output->data)
59 59
 				{
60
-					foreach($output->data as $key => $val)
60
+					foreach ($output->data as $key => $val)
61 61
 					{
62 62
 						$args->modules_info[$val->mid] = $val;
63 63
 						$args->module_srls_info[$val->module_srl] = $val;
@@ -73,35 +73,35 @@  discard block
 block discarded – undo
73 73
 			{
74 74
 				$obj->module_srls = $args->module_srls;
75 75
 				$output = executeQueryArray('widgets.content.getMids', $obj);
76
-				if($output->data)
76
+				if ($output->data)
77 77
 				{
78
-					foreach($output->data as $key => $val)
78
+					foreach ($output->data as $key => $val)
79 79
 					{
80 80
 						$args->modules_info[$val->mid] = $val;
81 81
 						$args->module_srls_info[$val->module_srl] = $val;
82 82
 						$module_srls[] = $val->module_srl;
83 83
 					}
84
-					$idx = explode(',',$args->module_srls);
85
-					for($i=0,$c=count($idx);$i<$c;$i++)
84
+					$idx = explode(',', $args->module_srls);
85
+					for ($i = 0, $c = count($idx); $i < $c; $i++)
86 86
 					{
87 87
 						$srl = $idx[$i];
88
-						if(!$args->module_srls_info[$srl]) continue;
88
+						if (!$args->module_srls_info[$srl]) continue;
89 89
 						$args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid;
90 90
 					}
91 91
 				}
92 92
 			}
93 93
 			// Exit if no module is found
94
-			if(!count($args->modules_info)) return Context::get('msg_not_founded');
95
-			$args->module_srl = implode(',',$module_srls);
94
+			if (!count($args->modules_info)) return Context::get('msg_not_founded');
95
+			$args->module_srl = implode(',', $module_srls);
96 96
 		}
97 97
 
98 98
 		/**
99 99
 		 * Method is separately made because content extraction, articles, comments, trackbacks, RSS and other elements exist
100 100
 		 */
101 101
 		// tab mode
102
-		if($args->tab_type == 'none' || $args->tab_type == '')
102
+		if ($args->tab_type == 'none' || $args->tab_type == '')
103 103
 		{
104
-			switch($args->content_type)
104
+			switch ($args->content_type)
105 105
 			{
106 106
 				case 'comment':
107 107
 					$content_items = $this->_getCommentItems($args);
@@ -125,17 +125,17 @@  discard block
 block discarded – undo
125 125
 		{
126 126
 			$content_items = array();
127 127
 
128
-			switch($args->content_type)
128
+			switch ($args->content_type)
129 129
 			{
130 130
 				case 'comment':
131
-					foreach($args->mid_lists as $module_srl => $mid)
131
+					foreach ($args->mid_lists as $module_srl => $mid)
132 132
 					{
133 133
 						$args->module_srl = $module_srl;
134 134
 						$content_items[$module_srl] = $this->_getCommentItems($args);
135 135
 					}
136 136
 					break;
137 137
 				case 'image':
138
-					foreach($args->mid_lists as $module_srl => $mid)
138
+					foreach ($args->mid_lists as $module_srl => $mid)
139 139
 					{
140 140
 						$args->module_srl = $module_srl;
141 141
 						$content_items[$module_srl] = $this->_getImageItems($args);
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 					$content_items = $this->getRssItems($args);
146 146
 					break;
147 147
 				case 'trackback':
148
-					foreach($args->mid_lists as $module_srl => $mid){
148
+					foreach ($args->mid_lists as $module_srl => $mid) {
149 149
 						$args->module_srl = $module_srl;
150 150
 						$content_items[$module_srl] = $this->_getTrackbackItems($args);
151 151
 					}
152 152
 					break;
153 153
 				default:
154
-					foreach($args->mid_lists as $module_srl => $mid)
154
+					foreach ($args->mid_lists as $module_srl => $mid)
155 155
 					{
156 156
 						$args->module_srl = $module_srl;
157 157
 						$content_items[$module_srl] = $this->_getDocumentItems($args);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			}
161 161
 		}
162 162
 
163
-		$output = $this->_compile($args,$content_items);
163
+		$output = $this->_compile($args, $content_items);
164 164
 		return $output;
165 165
 	}
166 166
 
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
 
181 181
 		$content_items = array();
182 182
 
183
-		if(!count($output)) return;
183
+		if (!count($output)) return;
184 184
 
185
-		foreach($output as $key => $oComment)
185
+		foreach ($output as $key => $oComment)
186 186
 		{
187 187
 			$attribute = $oComment->getObjectVars();
188 188
 			$title = $oComment->getSummary($args->content_cut_size);
189 189
 			$thumbnail = $oComment->getThumbnail();
190
-			$url = sprintf("%s#comment_%s",getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl',$oComment->get('document_srl')),$oComment->get('comment_srl'));
190
+			$url = sprintf("%s#comment_%s", getUrl('', 'mid', $args->mid_lists[$attribute->module_srl], 'document_srl', $oComment->get('document_srl')), $oComment->get('comment_srl'));
191 191
 
192 192
 			$attribute->mid = $args->mid_lists[$attribute->module_srl];
193 193
 			$browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title;
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 		// Get categories
213 213
 		$obj = new stdClass();
214 214
 		$obj->module_srl = $args->module_srl;
215
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
216
-		if($output->toBool() && $output->data)
215
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
216
+		if ($output->toBool() && $output->data)
217 217
 		{
218
-			foreach($output->data as $key => $val)
218
+			foreach ($output->data as $key => $val)
219 219
 			{
220 220
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
221 221
 			}
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 		// Get a list of documents
224 224
 		$obj->module_srl = $args->module_srl;
225 225
 		$obj->sort_index = $args->order_target;
226
-		$obj->order_type = $args->order_type=="desc"?"asc":"desc";
226
+		$obj->order_type = $args->order_type == "desc" ? "asc" : "desc";
227 227
 		$obj->list_count = $args->list_count;
228 228
 		$obj->statusList = array('PUBLIC');
229 229
 		$output = executeQueryArray('widgets.content.getNewestDocuments', $obj);
230
-		if(!$output->toBool() || !$output->data) return;
230
+		if (!$output->toBool() || !$output->data) return;
231 231
 		// If the result exists, make each document as an object
232 232
 		$content_items = array();
233 233
 		$first_thumbnail_idx = -1;
234
-		if(count($output->data))
234
+		if (count($output->data))
235 235
 		{
236
-			foreach($output->data as $key => $attribute)
236
+			foreach ($output->data as $key => $attribute)
237 237
 			{
238 238
 				$oDocument = new documentItem();
239 239
 				$oDocument->setAttribute($attribute, false);
@@ -242,23 +242,23 @@  discard block
 block discarded – undo
242 242
 			}
243 243
 			$oDocumentModel->setToAllDocumentExtraVars();
244 244
 
245
-			for($i=0,$c=count($document_srls);$i<$c;$i++)
245
+			for ($i = 0, $c = count($document_srls); $i < $c; $i++)
246 246
 			{
247 247
 				$oDocument = $GLOBALS['XE_DOCUMENT_LIST'][$document_srls[$i]];
248 248
 				$document_srl = $oDocument->document_srl;
249 249
 				$module_srl = $oDocument->get('module_srl');
250 250
 				$category_srl = $oDocument->get('category_srl');
251 251
 				$thumbnail = $oDocument->getThumbnail();
252
-				$content_item = new mcontentItem( $args->module_srls_info[$module_srl]->browser_title );
252
+				$content_item = new mcontentItem($args->module_srls_info[$module_srl]->browser_title);
253 253
 				$content_item->adds($oDocument->getObjectVars());
254 254
 				$content_item->setTitle($oDocument->getTitleText());
255
-				$content_item->setCategory( $category_lists[$module_srl][$category_srl]->title );
256
-				$content_item->setDomain( $args->module_srls_info[$module_srl]->domain );
255
+				$content_item->setCategory($category_lists[$module_srl][$category_srl]->title);
256
+				$content_item->setDomain($args->module_srls_info[$module_srl]->domain);
257 257
 				$content_item->setContent($oDocument->getSummary($args->content_cut_size));
258
-				$content_item->setLink( getSiteUrl($domain,'', 'mid',$args->mid_lists[$module_srl], 'document_srl',$document_srl) );
258
+				$content_item->setLink(getSiteUrl($domain, '', 'mid', $args->mid_lists[$module_srl], 'document_srl', $document_srl));
259 259
 				$content_item->setThumbnail($thumbnail);
260 260
 				$content_item->add('mid', $args->mid_lists[$module_srl]);
261
-				if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
261
+				if ($first_thumbnail_idx == -1 && $thumbnail) $first_thumbnail_idx = $i;
262 262
 				$content_items[] = $content_item;
263 263
 			}
264 264
 
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 		$obj->direct_download = 'Y';
277 277
 		$obj->isvalid = 'Y';
278 278
 		// Get categories
279
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
280
-		if($output->toBool() && $output->data)
279
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
280
+		if ($output->toBool() && $output->data)
281 281
 		{
282
-			foreach($output->data as $key => $val)
282
+			foreach ($output->data as $key => $val)
283 283
 			{
284 284
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
285 285
 			}
@@ -288,24 +288,24 @@  discard block
 block discarded – undo
288 288
 		$obj->list_count = $args->list_count;
289 289
 		$files_output = executeQueryArray("file.getOneFileInDocument", $obj);
290 290
 		$files_count = count($files_output->data);
291
-		if(!$files_count) return;
291
+		if (!$files_count) return;
292 292
 
293 293
 		$content_items = array();
294 294
 
295
-		for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
295
+		for ($i = 0; $i < $files_count; $i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
296 296
 
297 297
 		$tmp_document_list = $oDocumentModel->getDocuments($document_srl_list);
298 298
 
299
-		if(!count($tmp_document_list)) return;
299
+		if (!count($tmp_document_list)) return;
300 300
 
301
-		foreach($tmp_document_list as $oDocument)
301
+		foreach ($tmp_document_list as $oDocument)
302 302
 		{
303 303
 			$attribute = $oDocument->getObjectVars();
304 304
 			$browser_title = $args->module_srls_info[$attribute->module_srl]->browser_title;
305 305
 			$domain = $args->module_srls_info[$attribute->module_srl]->domain;
306 306
 			$category = $category_lists[$attribute->module_srl]->text;
307 307
 			$content = $oDocument->getSummary($args->content_cut_size);
308
-			$url = sprintf("%s#%s",$oDocument->getPermanentUrl() ,$oDocument->getCommentCount());
308
+			$url = sprintf("%s#%s", $oDocument->getPermanentUrl(), $oDocument->getCommentCount());
309 309
 			$thumbnail = $oDocument->getThumbnail();
310 310
 			$content_item = new mcontentItem($browser_title);
311 311
 			$content_item->adds($attribute);
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
 		$content_items = array();
328 328
 		$args->mid_lists = array();
329 329
 
330
-		foreach($args->rss_urls as $key => $rss)
330
+		foreach ($args->rss_urls as $key => $rss)
331 331
 		{
332 332
 			$args->rss_url = $rss;
333 333
 			$content_item = $this->_getRssItems($args);
334
-			if(count($content_item) > 0)
334
+			if (count($content_item) > 0)
335 335
 			{
336 336
 				$browser_title = $content_item[0]->getBrowserTitle();
337 337
 				$args->mid_lists[] = $browser_title;
@@ -339,40 +339,40 @@  discard block
 block discarded – undo
339 339
 			}
340 340
 		}
341 341
 
342
-		if($args->tab_type == 'none' || $args->tab_type == '')
342
+		if ($args->tab_type == 'none' || $args->tab_type == '')
343 343
 		{
344 344
 			$items = array();
345
-			foreach($content_items as $key => $val)
345
+			foreach ($content_items as $key => $val)
346 346
 			{
347
-				foreach($val as $k => $v)
347
+				foreach ($val as $k => $v)
348 348
 				{
349 349
 					$date = $v->get('regdate');
350
-					$i=0;
351
-					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++;
352
-					$items[sprintf('%s%02d',$date,$i)] = $v;
350
+					$i = 0;
351
+					while (array_key_exists(sprintf('%s%02d', $date, $i), $items)) $i++;
352
+					$items[sprintf('%s%02d', $date, $i)] = $v;
353 353
 				}
354 354
 			}
355
-			if($args->order_type =='asc') ksort($items);
355
+			if ($args->order_type == 'asc') ksort($items);
356 356
 			else krsort($items);
357
-			$content_items = array_slice(array_values($items),0,$args->list_count);
357
+			$content_items = array_slice(array_values($items), 0, $args->list_count);
358 358
 		} return $content_items;
359 359
 	}
360 360
 
361 361
 	function _getRssBody($value)
362 362
 	{
363
-		if(!$value || is_string($value)) return $value;
364
-		if(is_object($value)) $value = get_object_vars($value);
363
+		if (!$value || is_string($value)) return $value;
364
+		if (is_object($value)) $value = get_object_vars($value);
365 365
 		$body = null;
366
-		if(!count($value)) return;
367
-		foreach($value as $key => $val)
366
+		if (!count($value)) return;
367
+		foreach ($value as $key => $val)
368 368
 		{
369
-			if($key == 'body')
369
+			if ($key == 'body')
370 370
 			{
371 371
 				$body = $val;
372 372
 				continue;
373 373
 			}
374
-			if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val);
375
-			if($body !== null) return $body;
374
+			if (is_object($val) || is_array($val)) $body = $this->_getRssBody($val);
375
+			if ($body !== null) return $body;
376 376
 		}
377 377
 		return $body;
378 378
 	}
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
 		// Replace tags such as </p> , </div> , </li> and others to a whitespace
384 384
 		$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
385 385
 		// Remove Tag
386
-		$content = preg_replace('!<([^>]*?)>!is','', $content);
386
+		$content = preg_replace('!<([^>]*?)>!is', '', $content);
387 387
 		// Replace tags to < , > , " 
388
-		$content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
388
+		$content = str_replace(array('&lt;', '&gt;', '&quot;', '&nbsp;'), array('<', '>', '"', ' '), $content);
389 389
 		// Delete a series of whitespaces
390 390
 		$content = preg_replace('/ ( +)/is', ' ', $content);
391 391
 		// Truncate string
392 392
 		$content = trim(cut_str($content, $str_size, $tail));
393 393
 		// Replace back < , > , "  to theoriginal tags
394
-		$content = str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);
394
+		$content = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $content);
395 395
 		// Fixed a newline bug on a set of consecutive English letters 
396
-		$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is',"$0-",$content);
396
+		$content = preg_replace('/([a-z0-9\+:\/\.\~,\|\!\@\#\$\%\^\&\*\(\)\_]){20}/is', "$0-", $content);
397 397
 		return $content; 
398 398
 	}
399 399
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	function requestFeedContents($rss_url)
406 406
 	{
407
-		$rss_url = str_replace('&amp;','&',Context::convertEncodingStr($rss_url));
407
+		$rss_url = str_replace('&amp;', '&', Context::convertEncodingStr($rss_url));
408 408
 		return FileHandler::getRemoteResource($rss_url, null, 3, 'GET', 'application/xml');
409 409
 	}
410 410
 
@@ -416,52 +416,52 @@  discard block
 block discarded – undo
416 416
 		$buff = $this->requestFeedContents($args->rss_url);
417 417
 
418 418
 		$encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
419
-		if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
419
+		if ($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
420 420
 
421 421
 		$buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
422 422
 
423 423
 		$oXmlParser = new XmlParser();
424 424
 		$xml_doc = $oXmlParser->parse($buff);
425 425
 		$rss = new stdClass();
426
-		if($xml_doc->rss)
426
+		if ($xml_doc->rss)
427 427
 		{
428 428
 			$rss->title = $xml_doc->rss->channel->title->body;
429 429
 			$rss->link = $xml_doc->rss->channel->link->body;
430 430
 
431 431
 			$items = $xml_doc->rss->channel->item;
432 432
 
433
-			if(!$items) return;
434
-			if($items && !is_array($items)) $items = array($items);
433
+			if (!$items) return;
434
+			if ($items && !is_array($items)) $items = array($items);
435 435
 
436 436
 			$content_items = array();
437 437
 
438 438
 			foreach ($items as $key => $value)
439 439
 			{
440
-				if($key >= $args->list_count) break;
440
+				if ($key >= $args->list_count) break;
441 441
 				unset($item);
442 442
 				$item = new stdClass();
443 443
 
444
-				foreach($value as $key2 => $value2)
444
+				foreach ($value as $key2 => $value2)
445 445
 				{
446
-					if(is_array($value2)) $value2 = array_shift($value2);
446
+					if (is_array($value2)) $value2 = array_shift($value2);
447 447
 					$item->{$key2} = $this->_getRssBody($value2);
448 448
 				}
449 449
 
450 450
 				$content_item = new mcontentItem($rss->title);
451 451
 				$content_item->setContentsLink($rss->link);
452 452
 				$content_item->setTitle($item->title);
453
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
453
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
454 454
 				//$content_item->setCategory($item->category);
455
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
455
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
456 456
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
457 457
 				$content_item->setLink($item->link);
458
-				$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
458
+				$date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
459 459
 				$content_item->setRegdate($date);
460 460
 
461 461
 				$content_items[] = $content_item;
462 462
 			}
463 463
 		}
464
-		else if($xml_doc->{'rdf:rdf'})
464
+		else if ($xml_doc->{'rdf:rdf'})
465 465
 		{
466 466
 			// rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol
467 467
 			$rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
@@ -469,102 +469,102 @@  discard block
 block discarded – undo
469 469
 
470 470
 			$items = $xml_doc->{'rdf:rdf'}->item;
471 471
 
472
-			if(!$items) return;
473
-			if($items && !is_array($items)) $items = array($items);
472
+			if (!$items) return;
473
+			if ($items && !is_array($items)) $items = array($items);
474 474
 
475 475
 			$content_items = array();
476 476
 
477 477
 			foreach ($items as $key => $value)
478 478
 			{
479
-				if($key >= $args->list_count) break;
479
+				if ($key >= $args->list_count) break;
480 480
 				unset($item);
481 481
 				$item = new stdClass();
482 482
 
483
-				foreach($value as $key2 => $value2)
483
+				foreach ($value as $key2 => $value2)
484 484
 				{
485
-					if(is_array($value2)) $value2 = array_shift($value2);
485
+					if (is_array($value2)) $value2 = array_shift($value2);
486 486
 					$item->{$key2} = $this->_getRssBody($value2);
487 487
 				}
488 488
 
489 489
 				$content_item = new mcontentItem($rss->title);
490 490
 				$content_item->setContentsLink($rss->link);
491 491
 				$content_item->setTitle($item->title);
492
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
492
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
493 493
 				//$content_item->setCategory($item->category);
494
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
494
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
495 495
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
496 496
 				$content_item->setLink($item->link);
497
-				$date = date('YmdHis', strtotime(max($item->pubdate,$item->pubDate,$item->{'dc:date'})));
497
+				$date = date('YmdHis', strtotime(max($item->pubdate, $item->pubDate, $item->{'dc:date'})));
498 498
 				$content_item->setRegdate($date);
499 499
 
500 500
 				$content_items[] = $content_item;
501 501
 			}
502 502
 		}
503
-		else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
503
+		else if ($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
504 504
 			{
505 505
 			// Atom 1.0 spec supported by misol
506 506
 			$rss->title = $xml_doc->feed->title->body;
507 507
 			$links = $xml_doc->feed->link;
508
-			if(is_array($links))
508
+			if (is_array($links))
509 509
 			{
510 510
 				foreach ($links as $value)
511 511
 				{
512
-					if($value->attrs->rel == 'alternate')
512
+					if ($value->attrs->rel == 'alternate')
513 513
 					{
514 514
 						$rss->link = $value->attrs->href;
515 515
 						break;
516 516
 					}
517 517
 				}
518 518
 			}
519
-			else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
519
+			else if ($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
520 520
 	
521 521
 			$items = $xml_doc->feed->entry;
522 522
 	
523
-			if(!$items) return;
524
-			if($items && !is_array($items)) $items = array($items);
523
+			if (!$items) return;
524
+			if ($items && !is_array($items)) $items = array($items);
525 525
 	
526 526
 			$content_items = array();
527 527
 	
528 528
 			foreach ($items as $key => $value)
529 529
 			{
530
-				if($key >= $args->list_count) break;
530
+				if ($key >= $args->list_count) break;
531 531
 				unset($item);
532 532
 	
533
-				foreach($value as $key2 => $value2)
533
+				foreach ($value as $key2 => $value2)
534 534
 				{
535
-					if(is_array($value2)) $value2 = array_shift($value2);
535
+					if (is_array($value2)) $value2 = array_shift($value2);
536 536
 					$item->{$key2} = $this->_getRssBody($value2);
537 537
 				}
538 538
 	
539 539
 				$content_item = new mcontentItem($rss->title);
540 540
 				$links = $value->link;
541
-				if(is_array($links))
541
+				if (is_array($links))
542 542
 				{
543 543
 					foreach ($links as $val)
544 544
 					{
545
-						if($val->attrs->rel == 'alternate')
545
+						if ($val->attrs->rel == 'alternate')
546 546
 						{
547 547
 							$item->link = $val->attrs->href;
548 548
 							break;
549 549
 						}
550 550
 					}
551 551
 				}
552
-				else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
552
+				else if ($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
553 553
 	
554 554
 				$content_item->setContentsLink($rss->link);
555
-				if($item->title)
555
+				if ($item->title)
556 556
 				{
557
-					if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
557
+					if (stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
558 558
 				}
559 559
 				$content_item->setTitle($item->title);
560
-				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
560
+				$content_item->setNickName(max($item->author, $item->{'dc:creator'}));
561 561
 				$content_item->setAuthorSite($value->author->uri->body);
562 562
 	
563 563
 				//$content_item->setCategory($item->category);
564 564
 				$item->description = ($item->content) ? $item->content : $item->description = $item->summary;
565
-				$item->description = preg_replace('!<a href=!is','<a target="_blank" rel="noopener" href=', $item->description);
565
+				$item->description = preg_replace('!<a href=!is', '<a target="_blank" rel="noopener" href=', $item->description);
566 566
 	
567
-				if(($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
567
+				if (($item->content && stripos($value->content->attrs->type, "html") === FALSE) || (!$item->content && stripos($value->summary->attrs->type, "html") === FALSE))
568 568
 				{
569 569
 					$item->description = htmlspecialchars($item->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);
570 570
 	
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 	
573 573
 				$content_item->setContent($this->_getSummary($item->description, $args->content_cut_size));
574 574
 				$content_item->setLink($item->link);
575
-				$date = date('YmdHis', strtotime(max($item->published,$item->updated,$item->{'dc:date'})));
575
+				$date = date('YmdHis', strtotime(max($item->published, $item->updated, $item->{'dc:date'})));
576 576
 				$content_item->setRegdate($date);
577 577
 	
578 578
 				$content_items[] = $content_item;
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 		return $content_items;
582 582
 	}
583 583
 
584
-	function _getTrackbackItems($args){
584
+	function _getTrackbackItems($args) {
585 585
 		// Get categories
586
-		$output = executeQueryArray('widgets.content.getCategories',$obj);
587
-		if($output->toBool() && $output->data)
586
+		$output = executeQueryArray('widgets.content.getCategories', $obj);
587
+		if ($output->toBool() && $output->data)
588 588
 		{
589
-			foreach($output->data as $key => $val) {
589
+			foreach ($output->data as $key => $val) {
590 590
 				$category_lists[$val->module_srl][$val->category_srl] = $val;
591 591
 			}
592 592
 		}
@@ -598,14 +598,14 @@  discard block
 block discarded – undo
598 598
 		$oTrackbackModel = getModel('trackback');
599 599
 		$output = $oTrackbackModel->getNewestTrackbackList($obj);
600 600
 		// If an error occurs, just ignore it.
601
-		if(!$output->toBool() || !$output->data) return;
601
+		if (!$output->toBool() || !$output->data) return;
602 602
 		// If the result exists, make each document as an object
603 603
 		$content_items = array();
604
-		foreach($output->data as $key => $item)
604
+		foreach ($output->data as $key => $item)
605 605
 		{
606 606
 			$domain = $args->module_srls_info[$item->module_srl]->domain;
607 607
 			$category = $category_lists[$item->module_srl]->text;
608
-			$url = getSiteUrl($domain,'','mid', $args->mid_lists[$item->module_srl],'document_srl',$item->document_srl);
608
+			$url = getSiteUrl($domain, '', 'mid', $args->mid_lists[$item->module_srl], 'document_srl', $item->document_srl);
609 609
 			$browser_title = $args->module_srls_info[$item->module_srl]->browser_title;
610 610
 
611 611
 			$content_item = new mcontentItem($browser_title);
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 			$content_item->setTitle($item->title);
614 614
 			$content_item->setCategory($category);
615 615
 			$content_item->setNickName($item->blog_name);
616
-			$content_item->setContent($item->excerpt);  ///<<
617
-			$content_item->setDomain($domain);  ///<<
616
+			$content_item->setContent($item->excerpt); ///<<
617
+			$content_item->setDomain($domain); ///<<
618 618
 			$content_item->setLink($url);
619 619
 			$content_item->add('mid', $args->mid_lists[$item->module_srl]);
620 620
 			$content_item->setRegdate($item->regdate);
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 		return $content_items;
624 624
 	}
625 625
 
626
-	function _compile($args,$content_items)
626
+	function _compile($args, $content_items)
627 627
 	{
628 628
 		$oTemplate = &TemplateHandler::getInstance();
629 629
 		// Set variables for widget
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	var $contents_link = null;
672 672
 	var $domain = null;
673 673
 
674
-	function mcontentItem($browser_title='')
674
+	function mcontentItem($browser_title = '')
675 675
 	{
676 676
 		$this->browser_title = $browser_title;
677 677
 	}
@@ -681,58 +681,58 @@  discard block
 block discarded – undo
681 681
 	}
682 682
 	function setFirstThumbnailIdx($first_thumbnail_idx)
683 683
 	{
684
-		if(is_null($this->first_thumbnail) && $first_thumbnail_idx>-1) {
684
+		if (is_null($this->first_thumbnail) && $first_thumbnail_idx > -1) {
685 685
 			$this->has_first_thumbnail_idx = true;
686
-			$this->first_thumbnail_idx= $first_thumbnail_idx;
686
+			$this->first_thumbnail_idx = $first_thumbnail_idx;
687 687
 		}
688 688
 	}
689 689
 	function setExtraImages($extra_images)
690 690
 	{
691
-		$this->add('extra_images',$extra_images);
691
+		$this->add('extra_images', $extra_images);
692 692
 	}
693 693
 	function setDomain($domain)
694 694
 	{
695 695
 		static $default_domain = null;
696
-		if(!$domain)
696
+		if (!$domain)
697 697
 		{
698
-			if(is_null($default_domain)) $default_domain = Context::getDefaultUrl();
698
+			if (is_null($default_domain)) $default_domain = Context::getDefaultUrl();
699 699
 			$domain = $default_domain;
700 700
 		}
701 701
 		$this->domain = $domain;
702 702
 	}
703 703
 	function setLink($url)
704 704
 	{
705
-		$this->add('url',$url);
705
+		$this->add('url', $url);
706 706
 	}
707 707
 	function setTitle($title)
708 708
 	{
709
-		$this->add('title',$title);
709
+		$this->add('title', $title);
710 710
 	}
711 711
 
712 712
 	function setThumbnail($thumbnail)
713 713
 	{
714
-		$this->add('thumbnail',$thumbnail);
714
+		$this->add('thumbnail', $thumbnail);
715 715
 	}
716 716
 	function setContent($content)
717 717
 	{
718
-		$this->add('content',$content);
718
+		$this->add('content', $content);
719 719
 	}
720 720
 	function setRegdate($regdate)
721 721
 	{
722
-		$this->add('regdate',$regdate);
722
+		$this->add('regdate', $regdate);
723 723
 	}
724 724
 	function setNickName($nick_name)
725 725
 	{
726
-		$this->add('nick_name',$nick_name);
726
+		$this->add('nick_name', $nick_name);
727 727
 	}
728 728
 	// Save author's homepage url by misol
729 729
 	function setAuthorSite($site_url)
730 730
 	{
731
-		$this->add('author_site',$site_url);
731
+		$this->add('author_site', $site_url);
732 732
 	}
733 733
 	function setCategory($category)
734 734
 	{
735
-		$this->add('category',$category);
735
+		$this->add('category', $category);
736 736
 	}
737 737
 	function getBrowserTitle()
738 738
 	{
@@ -760,17 +760,17 @@  discard block
 block discarded – undo
760 760
 	{
761 761
 		return $this->get('module_srl');
762 762
 	}
763
-	function getTitle($cut_size = 0, $tail='...')
763
+	function getTitle($cut_size = 0, $tail = '...')
764 764
 	{
765 765
 		$title = strip_tags($this->get('title'));
766 766
 
767
-		if($cut_size) $title = cut_str($title, $cut_size, $tail);
767
+		if ($cut_size) $title = cut_str($title, $cut_size, $tail);
768 768
 
769 769
 		$attrs = array();
770
-		if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
771
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
770
+		if ($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
771
+		if ($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
772 772
 
773
-		if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
773
+		if (count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
774 774
 
775 775
 		return $title;
776 776
 	}
@@ -793,12 +793,12 @@  discard block
 block discarded – undo
793 793
 	function getCommentCount()
794 794
 	{
795 795
 		$comment_count = $this->get('comment_count');
796
-		return $comment_count>0 ? $comment_count : '';
796
+		return $comment_count > 0 ? $comment_count : '';
797 797
 	}
798 798
 	function getTrackbackCount()
799 799
 	{
800 800
 		$trackback_count = $this->get('trackback_count');
801
-		return $trackback_count>0 ? $trackback_count : '';
801
+		return $trackback_count > 0 ? $trackback_count : '';
802 802
 	}
803 803
 	function getRegdate($format = 'Y.m.d H:i:s')
804 804
 	{
Please login to merge, or discard this patch.
Braces   +137 added lines, -55 removed lines patch added patch discarded remove patch
@@ -18,20 +18,32 @@  discard block
 block discarded – undo
18 18
 	function proc($args)
19 19
 	{
20 20
 		// Targets to sort
21
-		if(!in_array($args->order_target, array('list_order','update_order'))) $args->order_target = 'list_order';
21
+		if(!in_array($args->order_target, array('list_order','update_order'))) {
22
+			$args->order_target = 'list_order';
23
+		}
22 24
 		// Sort order
23
-		if(!in_array($args->order_type, array('asc','desc'))) $args->order_type = 'asc';
25
+		if(!in_array($args->order_type, array('asc','desc'))) {
26
+			$args->order_type = 'asc';
27
+		}
24 28
 		// The number of displayed lists
25 29
 		$args->list_count = (int)$args->list_count;
26
-		if(!$args->list_count) $args->list_count = 5;
30
+		if(!$args->list_count) {
31
+			$args->list_count = 5;
32
+		}
27 33
 		// Cut the length of the title
28
-		if(!$args->subject_cut_size) $args->subject_cut_size = 0;
34
+		if(!$args->subject_cut_size) {
35
+			$args->subject_cut_size = 0;
36
+		}
29 37
 		// Cut the length of contents
30
-		if(!$args->content_cut_size) $args->content_cut_size = 100;
38
+		if(!$args->content_cut_size) {
39
+			$args->content_cut_size = 100;
40
+		}
31 41
 		// Viewing options
32 42
 		$args->option_view_arr = explode(',',$args->option_view);
33 43
 		// markup options
34
-		if(!$args->markup_type) $args->markup_type = 'list';
44
+		if(!$args->markup_type) {
45
+			$args->markup_type = 'list';
46
+		}
35 47
 		// Set variables for internal use
36 48
 		$oModuleModel = getModel('module');
37 49
 		$module_srls = $args->modules_info = $args->module_srls_info = $args->mid_lists = array();
@@ -43,11 +55,12 @@  discard block
 block discarded – undo
43 55
 			$rss_urls = array_unique(array($args->rss_url0,$args->rss_url1,$args->rss_url2,$args->rss_url3,$args->rss_url4));
44 56
 			for($i=0,$c=count($rss_urls);$i<$c;$i++)
45 57
 			{
46
-				if($rss_urls[$i]) $args->rss_urls[] = $rss_urls[$i];
58
+				if($rss_urls[$i]) {
59
+					$args->rss_urls[] = $rss_urls[$i];
60
+				}
47 61
 			}
48 62
 			// Get module information after listing module_srls if the module is not RSS
49
-		}
50
-		else
63
+		} else
51 64
 		{
52 65
 			$obj = new stdClass();
53 66
 			// Apply to all modules in the site if a target module is not specified
@@ -68,8 +81,7 @@  discard block
 block discarded – undo
68 81
 
69 82
 				$args->modules_info = $oModuleModel->getMidList($obj);
70 83
 				// Apply to the module only if a target module is specified
71
-			}
72
-			else
84
+			} else
73 85
 			{
74 86
 				$obj->module_srls = $args->module_srls;
75 87
 				$output = executeQueryArray('widgets.content.getMids', $obj);
@@ -85,13 +97,17 @@  discard block
 block discarded – undo
85 97
 					for($i=0,$c=count($idx);$i<$c;$i++)
86 98
 					{
87 99
 						$srl = $idx[$i];
88
-						if(!$args->module_srls_info[$srl]) continue;
100
+						if(!$args->module_srls_info[$srl]) {
101
+							continue;
102
+						}
89 103
 						$args->mid_lists[$srl] = $args->module_srls_info[$srl]->mid;
90 104
 					}
91 105
 				}
92 106
 			}
93 107
 			// Exit if no module is found
94
-			if(!count($args->modules_info)) return Context::get('msg_not_founded');
108
+			if(!count($args->modules_info)) {
109
+				return Context::get('msg_not_founded');
110
+			}
95 111
 			$args->module_srl = implode(',',$module_srls);
96 112
 		}
97 113
 
@@ -120,8 +136,7 @@  discard block
 block discarded – undo
120 136
 					break;
121 137
 			}
122 138
 			// If not a tab type
123
-		}
124
-		else
139
+		} else
125 140
 		{
126 141
 			$content_items = array();
127 142
 
@@ -180,7 +195,9 @@  discard block
 block discarded – undo
180 195
 
181 196
 		$content_items = array();
182 197
 
183
-		if(!count($output)) return;
198
+		if(!count($output)) {
199
+			return;
200
+		}
184 201
 
185 202
 		foreach($output as $key => $oComment)
186 203
 		{
@@ -227,7 +244,9 @@  discard block
 block discarded – undo
227 244
 		$obj->list_count = $args->list_count;
228 245
 		$obj->statusList = array('PUBLIC');
229 246
 		$output = executeQueryArray('widgets.content.getNewestDocuments', $obj);
230
-		if(!$output->toBool() || !$output->data) return;
247
+		if(!$output->toBool() || !$output->data) {
248
+			return;
249
+		}
231 250
 		// If the result exists, make each document as an object
232 251
 		$content_items = array();
233 252
 		$first_thumbnail_idx = -1;
@@ -258,7 +277,9 @@  discard block
 block discarded – undo
258 277
 				$content_item->setLink( getSiteUrl($domain,'', 'mid',$args->mid_lists[$module_srl], 'document_srl',$document_srl) );
259 278
 				$content_item->setThumbnail($thumbnail);
260 279
 				$content_item->add('mid', $args->mid_lists[$module_srl]);
261
-				if($first_thumbnail_idx==-1 && $thumbnail) $first_thumbnail_idx = $i;
280
+				if($first_thumbnail_idx==-1 && $thumbnail) {
281
+					$first_thumbnail_idx = $i;
282
+				}
262 283
 				$content_items[] = $content_item;
263 284
 			}
264 285
 
@@ -288,15 +309,21 @@  discard block
 block discarded – undo
288 309
 		$obj->list_count = $args->list_count;
289 310
 		$files_output = executeQueryArray("file.getOneFileInDocument", $obj);
290 311
 		$files_count = count($files_output->data);
291
-		if(!$files_count) return;
312
+		if(!$files_count) {
313
+			return;
314
+		}
292 315
 
293 316
 		$content_items = array();
294 317
 
295
-		for($i=0;$i<$files_count;$i++) $document_srl_list[] = $files_output->data[$i]->document_srl;
318
+		for($i=0;$i<$files_count;$i++) {
319
+			$document_srl_list[] = $files_output->data[$i]->document_srl;
320
+		}
296 321
 
297 322
 		$tmp_document_list = $oDocumentModel->getDocuments($document_srl_list);
298 323
 
299
-		if(!count($tmp_document_list)) return;
324
+		if(!count($tmp_document_list)) {
325
+			return;
326
+		}
300 327
 
301 328
 		foreach($tmp_document_list as $oDocument)
302 329
 		{
@@ -348,22 +375,33 @@  discard block
 block discarded – undo
348 375
 				{
349 376
 					$date = $v->get('regdate');
350 377
 					$i=0;
351
-					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) $i++;
378
+					while(array_key_exists(sprintf('%s%02d',$date,$i), $items)) {
379
+						$i++;
380
+					}
352 381
 					$items[sprintf('%s%02d',$date,$i)] = $v;
353 382
 				}
354 383
 			}
355
-			if($args->order_type =='asc') ksort($items);
356
-			else krsort($items);
384
+			if($args->order_type =='asc') {
385
+				ksort($items);
386
+			} else {
387
+				krsort($items);
388
+			}
357 389
 			$content_items = array_slice(array_values($items),0,$args->list_count);
358 390
 		} return $content_items;
359 391
 	}
360 392
 
361 393
 	function _getRssBody($value)
362 394
 	{
363
-		if(!$value || is_string($value)) return $value;
364
-		if(is_object($value)) $value = get_object_vars($value);
395
+		if(!$value || is_string($value)) {
396
+			return $value;
397
+		}
398
+		if(is_object($value)) {
399
+			$value = get_object_vars($value);
400
+		}
365 401
 		$body = null;
366
-		if(!count($value)) return;
402
+		if(!count($value)) {
403
+			return;
404
+		}
367 405
 		foreach($value as $key => $val)
368 406
 		{
369 407
 			if($key == 'body')
@@ -371,8 +409,12 @@  discard block
 block discarded – undo
371 409
 				$body = $val;
372 410
 				continue;
373 411
 			}
374
-			if(is_object($val)||is_array($val)) $body = $this->_getRssBody($val);
375
-			if($body !== null) return $body;
412
+			if(is_object($val)||is_array($val)) {
413
+				$body = $this->_getRssBody($val);
414
+			}
415
+			if($body !== null) {
416
+				return $body;
417
+			}
376 418
 		}
377 419
 		return $body;
378 420
 	}
@@ -416,7 +458,9 @@  discard block
 block discarded – undo
416 458
 		$buff = $this->requestFeedContents($args->rss_url);
417 459
 
418 460
 		$encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches);
419
-		if($encoding && stripos($matches[1], "UTF-8") === FALSE) $buff = Context::convertEncodingStr($buff);
461
+		if($encoding && stripos($matches[1], "UTF-8") === FALSE) {
462
+			$buff = Context::convertEncodingStr($buff);
463
+		}
420 464
 
421 465
 		$buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
422 466
 
@@ -430,20 +474,28 @@  discard block
 block discarded – undo
430 474
 
431 475
 			$items = $xml_doc->rss->channel->item;
432 476
 
433
-			if(!$items) return;
434
-			if($items && !is_array($items)) $items = array($items);
477
+			if(!$items) {
478
+				return;
479
+			}
480
+			if($items && !is_array($items)) {
481
+				$items = array($items);
482
+			}
435 483
 
436 484
 			$content_items = array();
437 485
 
438 486
 			foreach ($items as $key => $value)
439 487
 			{
440
-				if($key >= $args->list_count) break;
488
+				if($key >= $args->list_count) {
489
+					break;
490
+				}
441 491
 				unset($item);
442 492
 				$item = new stdClass();
443 493
 
444 494
 				foreach($value as $key2 => $value2)
445 495
 				{
446
-					if(is_array($value2)) $value2 = array_shift($value2);
496
+					if(is_array($value2)) {
497
+						$value2 = array_shift($value2);
498
+					}
447 499
 					$item->{$key2} = $this->_getRssBody($value2);
448 500
 				}
449 501
 
@@ -460,8 +512,7 @@  discard block
 block discarded – undo
460 512
 
461 513
 				$content_items[] = $content_item;
462 514
 			}
463
-		}
464
-		else if($xml_doc->{'rdf:rdf'})
515
+		} else if($xml_doc->{'rdf:rdf'})
465 516
 		{
466 517
 			// rss1.0 supported (XE's XML is case-insensitive because XML parser converts all to small letters) Fixed by misol
467 518
 			$rss->title = $xml_doc->{'rdf:rdf'}->channel->title->body;
@@ -469,20 +520,28 @@  discard block
 block discarded – undo
469 520
 
470 521
 			$items = $xml_doc->{'rdf:rdf'}->item;
471 522
 
472
-			if(!$items) return;
473
-			if($items && !is_array($items)) $items = array($items);
523
+			if(!$items) {
524
+				return;
525
+			}
526
+			if($items && !is_array($items)) {
527
+				$items = array($items);
528
+			}
474 529
 
475 530
 			$content_items = array();
476 531
 
477 532
 			foreach ($items as $key => $value)
478 533
 			{
479
-				if($key >= $args->list_count) break;
534
+				if($key >= $args->list_count) {
535
+					break;
536
+				}
480 537
 				unset($item);
481 538
 				$item = new stdClass();
482 539
 
483 540
 				foreach($value as $key2 => $value2)
484 541
 				{
485
-					if(is_array($value2)) $value2 = array_shift($value2);
542
+					if(is_array($value2)) {
543
+						$value2 = array_shift($value2);
544
+					}
486 545
 					$item->{$key2} = $this->_getRssBody($value2);
487 546
 				}
488 547
 
@@ -499,8 +558,7 @@  discard block
 block discarded – undo
499 558
 
500 559
 				$content_items[] = $content_item;
501 560
 			}
502
-		}
503
-		else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
561
+		} else if($xml_doc->feed && $xml_doc->feed->attrs->xmlns == 'http://www.w3.org/2005/Atom') 
504 562
 			{
505 563
 			// Atom 1.0 spec supported by misol
506 564
 			$rss->title = $xml_doc->feed->title->body;
@@ -515,24 +573,33 @@  discard block
 block discarded – undo
515 573
 						break;
516 574
 					}
517 575
 				}
576
+			} else if($links->attrs->rel == 'alternate') {
577
+				$rss->link = $links->attrs->href;
518 578
 			}
519
-			else if($links->attrs->rel == 'alternate') $rss->link = $links->attrs->href;
520 579
 	
521 580
 			$items = $xml_doc->feed->entry;
522 581
 	
523
-			if(!$items) return;
524
-			if($items && !is_array($items)) $items = array($items);
582
+			if(!$items) {
583
+				return;
584
+			}
585
+			if($items && !is_array($items)) {
586
+				$items = array($items);
587
+			}
525 588
 	
526 589
 			$content_items = array();
527 590
 	
528 591
 			foreach ($items as $key => $value)
529 592
 			{
530
-				if($key >= $args->list_count) break;
593
+				if($key >= $args->list_count) {
594
+					break;
595
+				}
531 596
 				unset($item);
532 597
 	
533 598
 				foreach($value as $key2 => $value2)
534 599
 				{
535
-					if(is_array($value2)) $value2 = array_shift($value2);
600
+					if(is_array($value2)) {
601
+						$value2 = array_shift($value2);
602
+					}
536 603
 					$item->{$key2} = $this->_getRssBody($value2);
537 604
 				}
538 605
 	
@@ -548,13 +615,16 @@  discard block
 block discarded – undo
548 615
 							break;
549 616
 						}
550 617
 					}
618
+				} else if($links->attrs->rel == 'alternate') {
619
+					$item->link = $links->attrs->href;
551 620
 				}
552
-				else if($links->attrs->rel == 'alternate') $item->link = $links->attrs->href;
553 621
 	
554 622
 				$content_item->setContentsLink($rss->link);
555 623
 				if($item->title)
556 624
 				{
557
-					if(stripos($value->title->attrs->type, "html") === FALSE) $item->title = $value->title->body;
625
+					if(stripos($value->title->attrs->type, "html") === FALSE) {
626
+						$item->title = $value->title->body;
627
+					}
558 628
 				}
559 629
 				$content_item->setTitle($item->title);
560 630
 				$content_item->setNickName(max($item->author,$item->{'dc:creator'}));
@@ -598,7 +668,9 @@  discard block
 block discarded – undo
598 668
 		$oTrackbackModel = getModel('trackback');
599 669
 		$output = $oTrackbackModel->getNewestTrackbackList($obj);
600 670
 		// If an error occurs, just ignore it.
601
-		if(!$output->toBool() || !$output->data) return;
671
+		if(!$output->toBool() || !$output->data) {
672
+			return;
673
+		}
602 674
 		// If the result exists, make each document as an object
603 675
 		$content_items = array();
604 676
 		foreach($output->data as $key => $item)
@@ -695,7 +767,9 @@  discard block
 block discarded – undo
695 767
 		static $default_domain = null;
696 768
 		if(!$domain)
697 769
 		{
698
-			if(is_null($default_domain)) $default_domain = Context::getDefaultUrl();
770
+			if(is_null($default_domain)) {
771
+				$default_domain = Context::getDefaultUrl();
772
+			}
699 773
 			$domain = $default_domain;
700 774
 		}
701 775
 		$this->domain = $domain;
@@ -764,13 +838,21 @@  discard block
 block discarded – undo
764 838
 	{
765 839
 		$title = strip_tags($this->get('title'));
766 840
 
767
-		if($cut_size) $title = cut_str($title, $cut_size, $tail);
841
+		if($cut_size) {
842
+			$title = cut_str($title, $cut_size, $tail);
843
+		}
768 844
 
769 845
 		$attrs = array();
770
-		if($this->get('title_bold') == 'Y') $attrs[] = 'font-weight:bold';
771
-		if($this->get('title_color') && $this->get('title_color') != 'N') $attrs[] = 'color:#'.$this->get('title_color');
846
+		if($this->get('title_bold') == 'Y') {
847
+			$attrs[] = 'font-weight:bold';
848
+		}
849
+		if($this->get('title_color') && $this->get('title_color') != 'N') {
850
+			$attrs[] = 'color:#'.$this->get('title_color');
851
+		}
772 852
 
773
-		if(count($attrs)) $title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
853
+		if(count($attrs)) {
854
+			$title = sprintf("<span style=\"%s\">%s</span>", implode(';', $attrs), htmlspecialchars($title));
855
+		}
774 856
 
775 857
 		return $title;
776 858
 	}
Please login to merge, or discard this patch.
classes/db/DBCubrid.class.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 * @param int $size column size
478 478
 	 * @param string|int $default default value
479 479
 	 * @param boolean $notnull not null status, default value is false
480
-	 * @return void
480
+	 * @return resource|null
481 481
 	 */
482 482
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE)
483 483
 	{
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 	/**
694 694
 	 * Creates a table by using xml contents
695 695
 	 * @param string $xml_doc xml schema contents
696
-	 * @return void|object
696
+	 * @return null|resource
697 697
 	 */
698 698
 	function createTableByXml($xml_doc)
699 699
 	{
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	/**
704 704
 	 * Creates a table by using xml file path
705 705
 	 * @param string $file_name xml schema file path
706
-	 * @return void|object
706
+	 * @return null|resource
707 707
 	 */
708 708
 	function createTableByXmlFile($file_name)
709 709
 	{
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
 	 * opt : notnull, default, size\n
724 724
 	 * index : primary key, index, unique\n
725 725
 	 * @param string $xml_doc xml schema contents
726
-	 * @return void|object
726
+	 * @return null|resource
727 727
 	 */
728 728
 	function _createTable($xml_doc)
729 729
 	{
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 	/**
1127 1127
 	 * If select query execute, return paging sql
1128
-	 * @param object $query
1128
+	 * @param BaseObject $query
1129 1129
 	 * @param boolean $with_values
1130 1130
 	 * @param int $start_count
1131 1131
 	 * @param int $list_count
Please login to merge, or discard this patch.
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	function DBCubrid($auto_connect = TRUE)
53 53
 	{
54 54
 		$this->_setDBInfo();
55
-		if($auto_connect) $this->_connect();
55
+		if ($auto_connect) $this->_connect();
56 56
 	}
57 57
 
58 58
 	/**
@@ -76,21 +76,21 @@  discard block
 block discarded – undo
76 76
 		$result = @cubrid_connect($connection["db_hostname"], $connection["db_port"], $connection["db_database"], $connection["db_userid"], $connection["db_password"]);
77 77
 
78 78
 		// check connections
79
-		if(!$result)
79
+		if (!$result)
80 80
 		{
81 81
 			$this->setError(-1, 'database connect fail');
82 82
 			return;
83 83
 		}
84 84
 
85
-		if(!defined('__CUBRID_VERSION__'))
85
+		if (!defined('__CUBRID_VERSION__'))
86 86
 		{
87 87
 			$cubrid_version = cubrid_get_server_info($result);
88 88
 			$cubrid_version_elem = explode('.', $cubrid_version);
89
-			$cubrid_version = $cubrid_version_elem[0] . '.' . $cubrid_version_elem[1] . '.' . $cubrid_version_elem[2];
89
+			$cubrid_version = $cubrid_version_elem[0].'.'.$cubrid_version_elem[1].'.'.$cubrid_version_elem[2];
90 90
 			define('__CUBRID_VERSION__', $cubrid_version);
91 91
 		}
92 92
 
93
-		if(__CUBRID_VERSION__ >= '8.4.0')
93
+		if (__CUBRID_VERSION__ >= '8.4.0')
94 94
 			cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
95 95
 
96 96
 		return $result;
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function addQuotes($string)
118 118
 	{
119
-		if(version_compare(PHP_VERSION, "5.4.0", "<") &&
119
+		if (version_compare(PHP_VERSION, "5.4.0", "<") &&
120 120
 				get_magic_quotes_gpc())
121 121
 		{
122 122
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
123 123
 		}
124 124
 
125
-		if(!is_numeric($string))
125
+		if (!is_numeric($string))
126 126
 		{
127 127
 			/*
128 128
 			  if ($this->isConnected()) {
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	function _begin($transactionLevel = 0)
148 148
 	{
149
-		if(__CUBRID_VERSION__ >= '8.4.0')
149
+		if (__CUBRID_VERSION__ >= '8.4.0')
150 150
 		{
151 151
 			$connection = $this->_getConnection('master');
152 152
 
153
-			if(!$transactionLevel)
153
+			if (!$transactionLevel)
154 154
 			{
155 155
 				cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE);
156 156
 			}
157 157
 			else
158 158
 			{
159
-				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
159
+				$this->_query("SAVEPOINT SP".$transactionLevel, $connection);
160 160
 			}
161 161
 		}
162 162
 		return TRUE;
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$point = $transactionLevel - 1;
175 175
 
176
-		if($point)
176
+		if ($point)
177 177
 		{
178
-			$this->_query("ROLLBACK TO SP" . $point, $connection);
178
+			$this->_query("ROLLBACK TO SP".$point, $connection);
179 179
 		}
180 180
 		else
181 181
 		{
@@ -206,29 +206,29 @@  discard block
 block discarded – undo
206 206
 	 */
207 207
 	function __query($query, $connection)
208 208
 	{
209
-		if($this->use_prepared_statements == 'Y')
209
+		if ($this->use_prepared_statements == 'Y')
210 210
 		{
211 211
 			$req = @cubrid_prepare($connection, $query);
212
-			if(!$req)
212
+			if (!$req)
213 213
 			{
214 214
 				$this->_setError();
215 215
 				return false;
216 216
 			}
217 217
 
218 218
 			$position = 0;
219
-			if($this->param)
219
+			if ($this->param)
220 220
 			{
221
-				foreach($this->param as $param)
221
+				foreach ($this->param as $param)
222 222
 				{
223 223
 					$value = $param->getUnescapedValue();
224 224
 					$type = $param->getType();
225 225
 
226
-					if($param->isColumnName())
226
+					if ($param->isColumnName())
227 227
 					{
228 228
 						continue;
229 229
 					}
230 230
 
231
-					switch($type)
231
+					switch ($type)
232 232
 					{
233 233
 						case 'number' :
234 234
 							$bind_type = 'numeric';
@@ -240,12 +240,12 @@  discard block
 block discarded – undo
240 240
 							$bind_type = 'string';
241 241
 					}
242 242
 
243
-					if(is_array($value))
243
+					if (is_array($value))
244 244
 					{
245
-						foreach($value as $v)
245
+						foreach ($value as $v)
246 246
 						{
247 247
 							$bound = @cubrid_bind($req, ++$position, $v, $bind_type);
248
-							if(!$bound)
248
+							if (!$bound)
249 249
 							{
250 250
 								$this->_setError();
251 251
 								return false;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 					else
256 256
 					{
257 257
 						$bound = @cubrid_bind($req, ++$position, $value, $bind_type);
258
-						if(!$bound)
258
+						if (!$bound)
259 259
 						{
260 260
 							$this->_setError();
261 261
 							return false;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			}
266 266
 
267 267
 			$result = @cubrid_execute($req);
268
-			if(!$result)
268
+			if (!$result)
269 269
 			{
270 270
 				$this->_setError();
271 271
 				return false;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		// Execute the query
276 276
 		$result = @cubrid_execute($connection, $query);
277 277
 		// error check
278
-		if(!$result)
278
+		if (!$result)
279 279
 		{
280 280
 			$this->_setError();
281 281
 			return false;
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 	function _fetch($result, $arrayIndexEndValue = NULL)
307 307
 	{
308 308
 		$output = array();
309
-		if(!$this->isConnected() || $this->isError() || !$result)
309
+		if (!$this->isConnected() || $this->isError() || !$result)
310 310
 		{
311 311
 			return array();
312 312
 		}
313 313
 
314
-		if($this->use_prepared_statements == 'Y')
314
+		if ($this->use_prepared_statements == 'Y')
315 315
 		{
316 316
 
317 317
 		}
@@ -322,25 +322,25 @@  discard block
 block discarded – undo
322 322
 		$col_names = cubrid_column_names($result);
323 323
 		$max = count($col_types);
324 324
 
325
-		for($count = 0; $count < $max; $count++)
325
+		for ($count = 0; $count < $max; $count++)
326 326
 		{
327
-			if(preg_match("/^char/", $col_types[$count]) > 0)
327
+			if (preg_match("/^char/", $col_types[$count]) > 0)
328 328
 			{
329 329
 				$char_type_fields[] = $col_names[$count];
330 330
 			}
331 331
 		}
332 332
 
333
-		while($tmp = cubrid_fetch($result, CUBRID_OBJECT))
333
+		while ($tmp = cubrid_fetch($result, CUBRID_OBJECT))
334 334
 		{
335
-			if(is_array($char_type_fields))
335
+			if (is_array($char_type_fields))
336 336
 			{
337
-				foreach($char_type_fields as $val)
337
+				foreach ($char_type_fields as $val)
338 338
 				{
339 339
 					$tmp->{$val} = rtrim($tmp->{$val});
340 340
 				}
341 341
 			}
342 342
 
343
-			if($arrayIndexEndValue)
343
+			if ($arrayIndexEndValue)
344 344
 			{
345 345
 				$output[$arrayIndexEndValue--] = $tmp;
346 346
 			}
@@ -352,15 +352,15 @@  discard block
 block discarded – undo
352 352
 
353 353
 		unset($char_type_fields);
354 354
 
355
-		if($result)
355
+		if ($result)
356 356
 		{
357 357
 			cubrid_close_request($result);
358 358
 		}
359 359
 
360
-		if(count($output) == 1)
360
+		if (count($output) == 1)
361 361
 		{
362 362
 			// If call is made for pagination, always return array
363
-			if(isset($arrayIndexEndValue))
363
+			if (isset($arrayIndexEndValue))
364 364
 			{
365 365
 				return $output;
366 366
 			}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	function _makeSequence()
397 397
 	{
398
-		if($_GLOBALS['XE_EXISTS_SEQUENCE'])
398
+		if ($_GLOBALS['XE_EXISTS_SEQUENCE'])
399 399
 			return;
400 400
 
401 401
 		// check cubrid serial
@@ -404,21 +404,21 @@  discard block
 block discarded – undo
404 404
 		$output = $this->_fetch($result);
405 405
 
406 406
 		// if do not create serial
407
-		if($output->count == 0)
408
-		{
409
-			$query = sprintf('select max("a"."srl") as "srl" from ' .
410
-					'( select max("document_srl") as "srl" from ' .
411
-					'"%sdocuments" UNION ' .
412
-					'select max("comment_srl") as "srl" from ' .
413
-					'"%scomments" UNION ' .
414
-					'select max("member_srl") as "srl" from ' .
415
-					'"%smember"' .
407
+		if ($output->count == 0)
408
+		{
409
+			$query = sprintf('select max("a"."srl") as "srl" from '.
410
+					'( select max("document_srl") as "srl" from '.
411
+					'"%sdocuments" UNION '.
412
+					'select max("comment_srl") as "srl" from '.
413
+					'"%scomments" UNION '.
414
+					'select max("member_srl") as "srl" from '.
415
+					'"%smember"'.
416 416
 					') as "a"', $this->prefix, $this->prefix, $this->prefix);
417 417
 
418 418
 			$result = $this->_query($query);
419 419
 			$output = $this->_fetch($result);
420 420
 			$srl = $output->srl;
421
-			if($srl < 1)
421
+			if ($srl < 1)
422 422
 			{
423 423
 				$start = 1;
424 424
 			}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 */
443 443
 	function isTableExists($target_name)
444 444
 	{
445
-		if($target_name == 'sequence')
445
+		if ($target_name == 'sequence')
446 446
 		{
447 447
 			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name);
448 448
 		}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		}
453 453
 
454 454
 		$result = $this->_query($query);
455
-		if(cubrid_num_rows($result) > 0)
455
+		if (cubrid_num_rows($result) > 0)
456 456
 		{
457 457
 			$output = TRUE;
458 458
 		}
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			$output = FALSE;
462 462
 		}
463 463
 
464
-		if($result)
464
+		if ($result)
465 465
 		{
466 466
 			cubrid_close_request($result);
467 467
 		}
@@ -482,22 +482,22 @@  discard block
 block discarded – undo
482 482
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = FALSE)
483 483
 	{
484 484
 		$type = strtoupper($this->column_type[$type]);
485
-		if($type == 'INTEGER')
485
+		if ($type == 'INTEGER')
486 486
 		{
487 487
 			$size = '';
488 488
 		}
489 489
 
490 490
 		$query = sprintf("alter class \"%s%s\" add \"%s\" ", $this->prefix, $table_name, $column_name);
491 491
 
492
-		if($type == 'char' || $type == 'varchar')
492
+		if ($type == 'char' || $type == 'varchar')
493 493
 		{
494
-			if($size)
494
+			if ($size)
495 495
 			{
496 496
 				$size = $size * 3;
497 497
 			}
498 498
 		}
499 499
 
500
-		if($size)
500
+		if ($size)
501 501
 		{
502 502
 			$query .= sprintf("%s(%s) ", $type, $size);
503 503
 		}
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 			$query .= sprintf("%s ", $type);
507 507
 		}
508 508
 
509
-		if(isset($default))
509
+		if (isset($default))
510 510
 		{
511
-			if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
511
+			if ($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
512 512
 			{
513 513
 				$query .= sprintf("default %d ", $default);
514 514
 			}
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			}
519 519
 		}
520 520
 
521
-		if($notnull)
521
+		if ($notnull)
522 522
 		{
523 523
 			$query .= "not null ";
524 524
 		}
@@ -547,10 +547,10 @@  discard block
 block discarded – undo
547 547
 	 */
548 548
 	function isColumnExists($table_name, $column_name)
549 549
 	{
550
-		$query = sprintf("select \"attr_name\" from \"db_attribute\" where " . "\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name);
550
+		$query = sprintf("select \"attr_name\" from \"db_attribute\" where "."\"attr_name\" ='%s' and \"class_name\" = '%s%s'", $column_name, $this->prefix, $table_name);
551 551
 		$result = $this->_query($query);
552 552
 
553
-		if(cubrid_num_rows($result) > 0)
553
+		if (cubrid_num_rows($result) > 0)
554 554
 		{
555 555
 			$output = TRUE;
556 556
 		}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			$output = FALSE;
560 560
 		}
561 561
 
562
-		if($result)
562
+		if ($result)
563 563
 		{
564 564
 			cubrid_close_request($result);
565 565
 		}
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = FALSE)
581 581
 	{
582
-		if(!is_array($target_columns))
582
+		if (!is_array($target_columns))
583 583
 		{
584 584
 			$target_columns = array($target_columns);
585 585
 		}
586 586
 
587
-		$query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"' . implode('","', $target_columns) . '"');
587
+		$query = sprintf("create %s index \"%s\" on \"%s%s\" (%s);", $is_unique ? 'unique' : '', $index_name, $this->prefix, $table_name, '"'.implode('","', $target_columns).'"');
588 588
 
589 589
 		$this->_query($query);
590 590
 	}
@@ -611,17 +611,17 @@  discard block
 block discarded – undo
611 611
 	 */
612 612
 	function isIndexExists($table_name, $index_name)
613 613
 	{
614
-		$query = sprintf("select \"index_name\" from \"db_index\" where " . "\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix . $index_name, $index_name);
614
+		$query = sprintf("select \"index_name\" from \"db_index\" where "."\"class_name\" = '%s%s' and (\"index_name\" = '%s' or \"index_name\" = '%s') ", $this->prefix, $table_name, $this->prefix.$index_name, $index_name);
615 615
 		$result = $this->_query($query);
616 616
 
617
-		if($this->isError())
617
+		if ($this->isError())
618 618
 		{
619 619
 			return FALSE;
620 620
 		}
621 621
 
622 622
 		$output = $this->_fetch($result);
623 623
 
624
-		if(!$output)
624
+		if (!$output)
625 625
 		{
626 626
 			return FALSE;
627 627
 		}
@@ -653,25 +653,25 @@  discard block
 block discarded – undo
653 653
 				", strlen($this->prefix)
654 654
 				, $this->prefix
655 655
 				, strlen($this->prefix) + 1
656
-				, "'" . $this->prefix . '%' . "'"
656
+				, "'".$this->prefix.'%'."'"
657 657
 				, strlen($this->prefix)
658 658
 				, $this->prefix
659 659
 				, strlen($this->prefix) + 1
660 660
 		);
661 661
 		$result = $this->_query($query);
662 662
 
663
-		if($this->isError())
663
+		if ($this->isError())
664 664
 		{
665 665
 			return FALSE;
666 666
 		}
667 667
 
668 668
 		$output = $this->_fetch($result);
669
-		if(!$output)
669
+		if (!$output)
670 670
 		{
671 671
 			return FALSE;
672 672
 		}
673 673
 
674
-		if(!is_array($output))
674
+		if (!is_array($output))
675 675
 		{
676 676
 			$indexes_to_be_deleted = array($output);
677 677
 		}
@@ -680,10 +680,10 @@  discard block
 block discarded – undo
680 680
 			$indexes_to_be_deleted = $output;
681 681
 		}
682 682
 
683
-		foreach($indexes_to_be_deleted as $index)
683
+		foreach ($indexes_to_be_deleted as $index)
684 684
 		{
685 685
 			$this->dropIndex(substr($index->class_name, strlen($this->prefix))
686
-					, $this->prefix . $index->unprefixed_index_name
686
+					, $this->prefix.$index->unprefixed_index_name
687 687
 					, $index->is_unique == 'YES' ? TRUE : FALSE);
688 688
 		}
689 689
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	function createTableByXmlFile($file_name)
709 709
 	{
710
-		if(!file_exists($file_name))
710
+		if (!file_exists($file_name))
711 711
 		{
712 712
 			return;
713 713
 		}
@@ -734,28 +734,28 @@  discard block
 block discarded – undo
734 734
 		$table_name = $xml_obj->table->attrs->name;
735 735
 
736 736
 		// if the table already exists exit function
737
-		if($this->isTableExists($table_name))
737
+		if ($this->isTableExists($table_name))
738 738
 		{
739 739
 			return;
740 740
 		}
741 741
 
742 742
 		// If the table name is sequence, it creates a serial
743
-		if($table_name == 'sequence')
743
+		if ($table_name == 'sequence')
744 744
 		{
745
-			$query = sprintf('create serial "%s" start with 1 increment by 1' .
746
-					' minvalue 1 ' .
747
-					'maxvalue 10000000000000000000000000000000000000' . ' nocycle;', $this->prefix . $table_name);
745
+			$query = sprintf('create serial "%s" start with 1 increment by 1'.
746
+					' minvalue 1 '.
747
+					'maxvalue 10000000000000000000000000000000000000'.' nocycle;', $this->prefix.$table_name);
748 748
 
749 749
 			return $this->_query($query);
750 750
 		}
751 751
 
752 752
 
753
-		$table_name = $this->prefix . $table_name;
753
+		$table_name = $this->prefix.$table_name;
754 754
 
755 755
 		$query = sprintf('create class "%s";', $table_name);
756 756
 		$this->_query($query);
757 757
 
758
-		if(!is_array($xml_obj->table->column))
758
+		if (!is_array($xml_obj->table->column))
759 759
 		{
760 760
 			$columns[] = $xml_obj->table->column;
761 761
 		}
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 		$unique_list = array();
771 771
 		$index_list = array();
772 772
 
773
-		foreach($columns as $column)
773
+		foreach ($columns as $column)
774 774
 		{
775 775
 			$name = $column->attrs->name;
776 776
 			$type = $column->attrs->type;
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 			$unique = $column->attrs->unique;
782 782
 			$default = $column->attrs->default;
783 783
 
784
-			switch($this->column_type[$type])
784
+			switch ($this->column_type[$type])
785 785
 			{
786 786
 				case 'integer' :
787 787
 					$size = NULL;
@@ -791,58 +791,58 @@  discard block
 block discarded – undo
791 791
 					break;
792 792
 			}
793 793
 
794
-			if(isset($default) && ($type == 'varchar' || $type == 'char' ||
794
+			if (isset($default) && ($type == 'varchar' || $type == 'char' ||
795 795
 					$type == 'text' || $type == 'tinytext' || $type == 'bigtext'))
796 796
 			{
797 797
 				$default = sprintf("'%s'", $default);
798 798
 			}
799 799
 
800
-			if($type == 'varchar' || $type == 'char')
800
+			if ($type == 'varchar' || $type == 'char')
801 801
 			{
802
-				if($size)
802
+				if ($size)
803 803
 					$size = $size * 3;
804 804
 			}
805 805
 
806 806
 
807
-			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default " . $default : '', $notnull ? 'not null' : '');
807
+			$column_schema[] = sprintf('"%s" %s%s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default ".$default : '', $notnull ? 'not null' : '');
808 808
 
809
-			if($primary_key)
809
+			if ($primary_key)
810 810
 			{
811 811
 				$primary_list[] = $name;
812 812
 			}
813
-			else if($unique)
813
+			else if ($unique)
814 814
 			{
815 815
 				$unique_list[$unique][] = $name;
816 816
 			}
817
-			else if($index)
817
+			else if ($index)
818 818
 			{
819 819
 				$index_list[$index][] = $name;
820 820
 			}
821 821
 		}
822 822
 
823
-		$query .= implode(',', $column_schema) . ';';
823
+		$query .= implode(',', $column_schema).';';
824 824
 		$this->_query($query);
825 825
 
826
-		if(count($primary_list))
826
+		if (count($primary_list))
827 827
 		{
828
-			$query = sprintf("alter class \"%s\" add attribute constraint " . "\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"' . implode('","', $primary_list) . '"');
828
+			$query = sprintf("alter class \"%s\" add attribute constraint "."\"pkey_%s\" PRIMARY KEY(%s);", $table_name, $table_name, '"'.implode('","', $primary_list).'"');
829 829
 			$this->_query($query);
830 830
 		}
831 831
 
832
-		if(count($unique_list))
832
+		if (count($unique_list))
833 833
 		{
834
-			foreach($unique_list as $key => $val)
834
+			foreach ($unique_list as $key => $val)
835 835
 			{
836
-				$query = sprintf("create unique index \"%s\" on \"%s\" " . "(%s);", $key, $table_name, '"' . implode('","', $val) . '"');
836
+				$query = sprintf("create unique index \"%s\" on \"%s\" "."(%s);", $key, $table_name, '"'.implode('","', $val).'"');
837 837
 				$this->_query($query);
838 838
 			}
839 839
 		}
840 840
 
841
-		if(count($index_list))
841
+		if (count($index_list))
842 842
 		{
843
-			foreach($index_list as $key => $val)
843
+			foreach ($index_list as $key => $val)
844 844
 			{
845
-				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"' . implode('","', $val) . '"');
845
+				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"'.implode('","', $val).'"');
846 846
 				$this->_query($query);
847 847
 			}
848 848
 		}
@@ -856,22 +856,22 @@  discard block
 block discarded – undo
856 856
 	 */
857 857
 	function _executeInsertAct($queryObject, $with_values = TRUE)
858 858
 	{
859
-		if($this->use_prepared_statements == 'Y')
859
+		if ($this->use_prepared_statements == 'Y')
860 860
 		{
861 861
 			$this->param = $queryObject->getArguments();
862 862
 			$with_values = FALSE;
863 863
 		}
864 864
 		$query = $this->getInsertSql($queryObject, $with_values);
865
-		if(is_a($query, 'BaseObject'))
865
+		if (is_a($query, 'BaseObject'))
866 866
 		{
867 867
 			unset($this->param);
868 868
 			return;
869 869
 		}
870 870
 
871
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
871
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
872 872
 
873 873
 		$result = $this->_query($query);
874
-		if($result && !$this->transaction_started)
874
+		if ($result && !$this->transaction_started)
875 875
 		{
876 876
 			$this->_commit();
877 877
 		}
@@ -887,23 +887,23 @@  discard block
 block discarded – undo
887 887
 	 */
888 888
 	function _executeUpdateAct($queryObject, $with_values = TRUE)
889 889
 	{
890
-		if($this->use_prepared_statements == 'Y')
890
+		if ($this->use_prepared_statements == 'Y')
891 891
 		{
892 892
 			$this->param = $queryObject->getArguments();
893 893
 			$with_values = FALSE;
894 894
 		}
895 895
 		$query = $this->getUpdateSql($queryObject, $with_values);
896
-		if(is_a($query, 'BaseObject'))
896
+		if (is_a($query, 'BaseObject'))
897 897
 		{
898 898
 			unset($this->param);
899 899
 			return;
900 900
 		}
901 901
 
902
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
902
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
903 903
 
904 904
 		$result = $this->_query($query);
905 905
 
906
-		if($result && !$this->transaction_started)
906
+		if ($result && !$this->transaction_started)
907 907
 		{
908 908
 			$this->_commit();
909 909
 		}
@@ -919,23 +919,23 @@  discard block
 block discarded – undo
919 919
 	 */
920 920
 	function _executeDeleteAct($queryObject, $with_values = TRUE)
921 921
 	{
922
-		if($this->use_prepared_statements == 'Y')
922
+		if ($this->use_prepared_statements == 'Y')
923 923
 		{
924 924
 			$this->param = $queryObject->getArguments();
925 925
 			$with_values = FALSE;
926 926
 		}
927 927
 		$query = $this->getDeleteSql($queryObject, $with_values);
928
-		if(is_a($query, 'BaseObject'))
928
+		if (is_a($query, 'BaseObject'))
929 929
 		{
930 930
 			unset($this->param);
931 931
 			return;
932 932
 		}
933 933
 
934
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
934
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
935 935
 
936 936
 		$result = $this->_query($query);
937 937
 
938
-		if($result && !$this->transaction_started)
938
+		if ($result && !$this->transaction_started)
939 939
 		{
940 940
 			$this->_commit();
941 941
 		}
@@ -955,29 +955,29 @@  discard block
 block discarded – undo
955 955
 	 */
956 956
 	function _executeSelectAct($queryObject, $connection = NULL, $with_values = TRUE)
957 957
 	{
958
-		if($this->use_prepared_statements == 'Y')
958
+		if ($this->use_prepared_statements == 'Y')
959 959
 		{
960 960
 			$this->param = $queryObject->getArguments();
961 961
 			$with_values = FALSE;
962 962
 		}
963 963
 		$limit = $queryObject->getLimit();
964
-		if($limit && $limit->isPageHandler())
964
+		if ($limit && $limit->isPageHandler())
965 965
 		{
966 966
 			return $this->queryPageLimit($queryObject, $connection, $with_values);
967 967
 		}
968 968
 		else
969 969
 		{
970 970
 			$query = $this->getSelectSql($queryObject, $with_values);
971
-			if(is_a($query, 'BaseObject'))
971
+			if (is_a($query, 'BaseObject'))
972 972
 			{
973 973
 				unset($this->param);
974 974
 				return;
975 975
 			}
976 976
 
977
-			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
977
+			$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
978 978
 			$result = $this->_query($query, $connection);
979 979
 
980
-			if($this->isError())
980
+			if ($this->isError())
981 981
 			{
982 982
 				unset($this->param);
983 983
 				return $this->queryError($queryObject);
@@ -1000,16 +1000,16 @@  discard block
 block discarded – undo
1000 1000
 	function queryError($queryObject)
1001 1001
 	{
1002 1002
 		$limit = $queryObject->getLimit();
1003
-		if($limit && $limit->isPageHandler())
1003
+		if ($limit && $limit->isPageHandler())
1004 1004
 		{
1005
-			$buff = new BaseObject ();
1005
+			$buff = new BaseObject();
1006 1006
 			$buff->total_count = 0;
1007 1007
 			$buff->total_page = 0;
1008 1008
 			$buff->page = 1;
1009 1009
 			$buff->data = array();
1010 1010
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
1011 1011
 			return $buff;
1012
-		}else
1012
+		} else
1013 1013
 			return;
1014 1014
 	}
1015 1015
 
@@ -1025,48 +1025,48 @@  discard block
 block discarded – undo
1025 1025
 		$limit = $queryObject->getLimit();
1026 1026
 		// Total count
1027 1027
 		$temp_where = $queryObject->getWhereString($with_values, FALSE);
1028
-		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where));
1028
+		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where));
1029 1029
 
1030 1030
 		// Check for distinct query and if found update count query structure
1031 1031
 		$temp_select = $queryObject->getSelectString($with_values);
1032 1032
 		$uses_distinct = stripos($temp_select, "distinct") !== FALSE;
1033 1033
 		$uses_groupby = $queryObject->getGroupByString() != '';
1034
-		if($uses_distinct || $uses_groupby)
1034
+		if ($uses_distinct || $uses_groupby)
1035 1035
 		{
1036 1036
 			$count_query = sprintf('select %s %s %s %s'
1037 1037
 					, $temp_select
1038
-					, 'FROM ' . $queryObject->getFromString($with_values)
1039
-					, ($temp_where === '' ? '' : ' WHERE ' . $temp_where)
1040
-					, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
1038
+					, 'FROM '.$queryObject->getFromString($with_values)
1039
+					, ($temp_where === '' ? '' : ' WHERE '.$temp_where)
1040
+					, ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '')
1041 1041
 			);
1042 1042
 
1043 1043
 			// If query uses grouping or distinct, count from original select
1044 1044
 			$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
1045 1045
 		}
1046 1046
 
1047
-		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
1047
+		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : '';
1048 1048
 		$result = $this->_query($count_query, $connection);
1049 1049
 		$count_output = $this->_fetch($result);
1050 1050
 		$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
1051 1051
 
1052 1052
 		$list_count = $limit->list_count->getValue();
1053
-		if(!$list_count)
1053
+		if (!$list_count)
1054 1054
 		{
1055 1055
 			$list_count = 20;
1056 1056
 		}
1057 1057
 		$page_count = $limit->page_count->getValue();
1058
-		if(!$page_count)
1058
+		if (!$page_count)
1059 1059
 		{
1060 1060
 			$page_count = 10;
1061 1061
 		}
1062 1062
 		$page = $limit->page->getValue();
1063
-		if(!$page || $page < 1)
1063
+		if (!$page || $page < 1)
1064 1064
 		{
1065 1065
 			$page = 1;
1066 1066
 		}
1067 1067
 
1068 1068
 		// total pages
1069
-		if($total_count)
1069
+		if ($total_count)
1070 1070
 		{
1071 1071
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
1072 1072
 		}
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 		}
1077 1077
 
1078 1078
 		// check the page variables
1079
-		if($page > $total_page)
1079
+		if ($page > $total_page)
1080 1080
 		{
1081 1081
 			// If requested page is bigger than total number of pages, return empty list
1082 1082
 
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
 		$start_count = ($page - 1) * $list_count;
1093 1093
 
1094 1094
 		$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
1095
-		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
1095
+		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
1096 1096
 		$result = $this->_query($query, $connection);
1097
-		if($this->isError())
1097
+		if ($this->isError())
1098 1098
 		{
1099 1099
 			unset($this->param);
1100 1100
 			return $this->queryError($queryObject);
@@ -1135,44 +1135,44 @@  discard block
 block discarded – undo
1135 1135
 	{
1136 1136
 
1137 1137
 		$select = $query->getSelectString($with_values);
1138
-		if($select == '')
1138
+		if ($select == '')
1139 1139
 		{
1140 1140
 			return new BaseObject(-1, "Invalid query");
1141 1141
 		}
1142
-		$select = 'SELECT ' . $select;
1142
+		$select = 'SELECT '.$select;
1143 1143
 
1144 1144
 		$from = $query->getFromString($with_values);
1145
-		if($from == '')
1145
+		if ($from == '')
1146 1146
 		{
1147 1147
 			return new BaseObject(-1, "Invalid query");
1148 1148
 		}
1149
-		$from = ' FROM ' . $from;
1149
+		$from = ' FROM '.$from;
1150 1150
 
1151 1151
 		$where = $query->getWhereString($with_values);
1152
-		if($where != '')
1152
+		if ($where != '')
1153 1153
 		{
1154
-			$where = ' WHERE ' . $where;
1154
+			$where = ' WHERE '.$where;
1155 1155
 		}
1156 1156
 
1157 1157
 		$groupBy = $query->getGroupByString();
1158
-		if($groupBy != '')
1158
+		if ($groupBy != '')
1159 1159
 		{
1160
-			$groupBy = ' GROUP BY ' . $groupBy;
1160
+			$groupBy = ' GROUP BY '.$groupBy;
1161 1161
 		}
1162 1162
 
1163 1163
 		$orderBy = $query->getOrderByString();
1164
-		if($orderBy != '')
1164
+		if ($orderBy != '')
1165 1165
 		{
1166
-			$orderBy = ' ORDER BY ' . $orderBy;
1166
+			$orderBy = ' ORDER BY '.$orderBy;
1167 1167
 		}
1168 1168
 
1169 1169
 		$limit = $query->getLimitString();
1170
-		if($limit != '')
1170
+		if ($limit != '')
1171 1171
 		{
1172 1172
 			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count);
1173 1173
 		}
1174 1174
 
1175
-		return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
1175
+		return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit;
1176 1176
 	}
1177 1177
 
1178 1178
 }
Please login to merge, or discard this patch.
Braces   +31 added lines, -41 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 	function DBCubrid($auto_connect = TRUE)
53 53
 	{
54 54
 		$this->_setDBInfo();
55
-		if($auto_connect) $this->_connect();
55
+		if($auto_connect) {
56
+			$this->_connect();
57
+		}
56 58
 	}
57 59
 
58 60
 	/**
@@ -90,8 +92,9 @@  discard block
 block discarded – undo
90 92
 			define('__CUBRID_VERSION__', $cubrid_version);
91 93
 		}
92 94
 
93
-		if(__CUBRID_VERSION__ >= '8.4.0')
94
-			cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
95
+		if(__CUBRID_VERSION__ >= '8.4.0') {
96
+					cubrid_set_autocommit($result, CUBRID_AUTOCOMMIT_TRUE);
97
+		}
95 98
 
96 99
 		return $result;
97 100
 	}
@@ -153,8 +156,7 @@  discard block
 block discarded – undo
153 156
 			if(!$transactionLevel)
154 157
 			{
155 158
 				cubrid_set_autocommit($connection, CUBRID_AUTOCOMMIT_FALSE);
156
-			}
157
-			else
159
+			} else
158 160
 			{
159 161
 				$this->_query("SAVEPOINT SP" . $transactionLevel, $connection);
160 162
 			}
@@ -176,8 +178,7 @@  discard block
 block discarded – undo
176 178
 		if($point)
177 179
 		{
178 180
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
179
-		}
180
-		else
181
+		} else
181 182
 		{
182 183
 			@cubrid_rollback($connection);
183 184
 		}
@@ -251,8 +252,7 @@  discard block
 block discarded – undo
251 252
 								return false;
252 253
 							}
253 254
 						}
254
-					}
255
-					else
255
+					} else
256 256
 					{
257 257
 						$bound = @cubrid_bind($req, ++$position, $value, $bind_type);
258 258
 						if(!$bound)
@@ -343,8 +343,7 @@  discard block
 block discarded – undo
343 343
 			if($arrayIndexEndValue)
344 344
 			{
345 345
 				$output[$arrayIndexEndValue--] = $tmp;
346
-			}
347
-			else
346
+			} else
348 347
 			{
349 348
 				$output[] = $tmp;
350 349
 			}
@@ -395,8 +394,9 @@  discard block
 block discarded – undo
395 394
 	 */
396 395
 	function _makeSequence()
397 396
 	{
398
-		if($_GLOBALS['XE_EXISTS_SEQUENCE'])
399
-			return;
397
+		if($_GLOBALS['XE_EXISTS_SEQUENCE']) {
398
+					return;
399
+		}
400 400
 
401 401
 		// check cubrid serial
402 402
 		$query = sprintf('select count(*) as "count" from "db_serial" where name=\'%ssequence\'', $this->prefix);
@@ -421,8 +421,7 @@  discard block
 block discarded – undo
421 421
 			if($srl < 1)
422 422
 			{
423 423
 				$start = 1;
424
-			}
425
-			else
424
+			} else
426 425
 			{
427 426
 				$start = $srl + 1000000;
428 427
 			}
@@ -445,8 +444,7 @@  discard block
 block discarded – undo
445 444
 		if($target_name == 'sequence')
446 445
 		{
447 446
 			$query = sprintf("select \"name\" from \"db_serial\" where \"name\" = '%s%s'", $this->prefix, $target_name);
448
-		}
449
-		else
447
+		} else
450 448
 		{
451 449
 			$query = sprintf("select \"class_name\" from \"db_class\" where \"class_name\" = '%s%s'", $this->prefix, $target_name);
452 450
 		}
@@ -455,8 +453,7 @@  discard block
 block discarded – undo
455 453
 		if(cubrid_num_rows($result) > 0)
456 454
 		{
457 455
 			$output = TRUE;
458
-		}
459
-		else
456
+		} else
460 457
 		{
461 458
 			$output = FALSE;
462 459
 		}
@@ -500,8 +497,7 @@  discard block
 block discarded – undo
500 497
 		if($size)
501 498
 		{
502 499
 			$query .= sprintf("%s(%s) ", $type, $size);
503
-		}
504
-		else
500
+		} else
505 501
 		{
506 502
 			$query .= sprintf("%s ", $type);
507 503
 		}
@@ -511,8 +507,7 @@  discard block
 block discarded – undo
511 507
 			if($type == 'INTEGER' || $type == 'BIGINT' || $type == 'INT')
512 508
 			{
513 509
 				$query .= sprintf("default %d ", $default);
514
-			}
515
-			else
510
+			} else
516 511
 			{
517 512
 				$query .= sprintf("default '%s' ", $default);
518 513
 			}
@@ -553,8 +548,7 @@  discard block
 block discarded – undo
553 548
 		if(cubrid_num_rows($result) > 0)
554 549
 		{
555 550
 			$output = TRUE;
556
-		}
557
-		else
551
+		} else
558 552
 		{
559 553
 			$output = FALSE;
560 554
 		}
@@ -674,8 +668,7 @@  discard block
 block discarded – undo
674 668
 		if(!is_array($output))
675 669
 		{
676 670
 			$indexes_to_be_deleted = array($output);
677
-		}
678
-		else
671
+		} else
679 672
 		{
680 673
 			$indexes_to_be_deleted = $output;
681 674
 		}
@@ -758,8 +751,7 @@  discard block
 block discarded – undo
758 751
 		if(!is_array($xml_obj->table->column))
759 752
 		{
760 753
 			$columns[] = $xml_obj->table->column;
761
-		}
762
-		else
754
+		} else
763 755
 		{
764 756
 			$columns = $xml_obj->table->column;
765 757
 		}
@@ -799,8 +791,9 @@  discard block
 block discarded – undo
799 791
 
800 792
 			if($type == 'varchar' || $type == 'char')
801 793
 			{
802
-				if($size)
803
-					$size = $size * 3;
794
+				if($size) {
795
+									$size = $size * 3;
796
+				}
804 797
 			}
805 798
 
806 799
 
@@ -809,12 +802,10 @@  discard block
 block discarded – undo
809 802
 			if($primary_key)
810 803
 			{
811 804
 				$primary_list[] = $name;
812
-			}
813
-			else if($unique)
805
+			} else if($unique)
814 806
 			{
815 807
 				$unique_list[$unique][] = $name;
816
-			}
817
-			else if($index)
808
+			} else if($index)
818 809
 			{
819 810
 				$index_list[$index][] = $name;
820 811
 			}
@@ -964,8 +955,7 @@  discard block
 block discarded – undo
964 955
 		if($limit && $limit->isPageHandler())
965 956
 		{
966 957
 			return $this->queryPageLimit($queryObject, $connection, $with_values);
967
-		}
968
-		else
958
+		} else
969 959
 		{
970 960
 			$query = $this->getSelectSql($queryObject, $with_values);
971 961
 			if(is_a($query, 'BaseObject'))
@@ -1009,8 +999,9 @@  discard block
 block discarded – undo
1009 999
 			$buff->data = array();
1010 1000
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
1011 1001
 			return $buff;
1012
-		}else
1013
-			return;
1002
+		} else {
1003
+					return;
1004
+		}
1014 1005
 	}
1015 1006
 
1016 1007
 	/**
@@ -1069,8 +1060,7 @@  discard block
 block discarded – undo
1069 1060
 		if($total_count)
1070 1061
 		{
1071 1062
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
1072
-		}
1073
-		else
1063
+		} else
1074 1064
 		{
1075 1065
 			$total_page = 1;
1076 1066
 		}
Please login to merge, or discard this patch.
classes/db/DBMssql.class.php 3 patches
Doc Comments   +8 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	/**
112 112
 	 * DB transaction start
113 113
 	 * this method is private
114
-	 * @return boolean
114
+	 * @return null|boolean
115 115
 	 */
116 116
 	function _begin($transactionLevel = 0)
117 117
 	{
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * this method is private
171 171
 	 * @param string $query
172 172
 	 * @param resource $connection
173
-	 * @return resource|boolean Returns a statement resource on success and FALSE if an error occurred.
173
+	 * @return resource Returns a statement resource on success and FALSE if an error occurred.
174 174
 	 */
175 175
 	function __query($query, $connection)
176 176
 	{
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	 * @param int $size column size
376 376
 	 * @param string|int $default default value
377 377
 	 * @param boolean $notnull not null status, default value is false
378
-	 * @return void
378
+	 * @return null|resource
379 379
 	 */
380 380
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
381 381
 	{
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * Check column exist status of the table
432 432
 	 * @param string $table_name table name
433 433
 	 * @param string $column_name column name
434
-	 * @return boolean
434
+	 * @return null|boolean
435 435
 	 */
436 436
 	function isColumnExists($table_name, $column_name)
437 437
 	{
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 * Check index status of the table
496 496
 	 * @param string $table_name table name
497 497
 	 * @param string $index_name index name
498
-	 * @return boolean
498
+	 * @return null|boolean
499 499
 	 */
500 500
 	function isIndexExists($table_name, $index_name)
501 501
 	{
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 
675 675
 	/**
676 676
 	 * Return update query string
677
-	 * @param object $query
677
+	 * @param BaseObject $query
678 678
 	 * @param boolean $with_values
679 679
 	 * @param boolean $with_priority
680 680
 	 * @return string
@@ -726,8 +726,9 @@  discard block
 block discarded – undo
726 726
 
727 727
 	/**
728 728
 	 * Return select query string
729
-	 * @param object $query
729
+	 * @param BaseObject $query
730 730
 	 * @param boolean $with_values
731
+	 * @param resource $connection
731 732
 	 * @return string
732 733
 	 */
733 734
 	function getSelectSql($query, $with_values = TRUE, $connection=NULL)
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	function DBMssql($auto_connect = TRUE)
46 46
 	{
47 47
 		$this->_setDBInfo();
48
-		if($auto_connect) $this->_connect();
48
+		if ($auto_connect) $this->_connect();
49 49
 	}
50 50
 
51 51
 	/**
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 		//sqlsrv_configure( 'LogSubsystems', SQLSRV_LOG_SYSTEM_ALL );
71 71
 		$result = @sqlsrv_connect($connection["db_hostname"], array('Database' => $connection["db_database"], 'UID' => $connection["db_userid"], 'PWD' => $connection["db_password"]));
72 72
 
73
-		if(!$result)
73
+		if (!$result)
74 74
 		{
75 75
 			$errors = print_r(sqlsrv_errors(), true);
76
-			$this->setError(-1, 'database connect fail' . PHP_EOL . $errors);
76
+			$this->setError(-1, 'database connect fail'.PHP_EOL.$errors);
77 77
 			return;
78 78
 		}
79 79
 		return $result;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	function addQuotes($string)
101 101
 	{
102
-		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
102
+		if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
103 103
 		{
104 104
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
105 105
 		}
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 	{
118 118
 		$connection = $this->_getConnection('master');
119 119
 
120
-		if(!$transactionLevel)
120
+		if (!$transactionLevel)
121 121
 		{
122
-			if(sqlsrv_begin_transaction($connection) === false)
122
+			if (sqlsrv_begin_transaction($connection) === false)
123 123
 			{
124 124
 				return;
125 125
 			}
126 126
 		}
127 127
 		else
128 128
 		{
129
-			$this->_query("SAVE TRANS SP" . $transactionLevel, $connection);
129
+			$this->_query("SAVE TRANS SP".$transactionLevel, $connection);
130 130
 		}
131 131
 		return true;
132 132
 	}
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 
143 143
 		$point = $transactionLevel - 1;
144 144
 
145
-		if($point)
145
+		if ($point)
146 146
 		{
147
-			$this->_query("ROLLBACK TRANS SP" . $point, $connection);
147
+			$this->_query("ROLLBACK TRANS SP".$point, $connection);
148 148
 		}
149 149
 		else
150 150
 		{
@@ -176,18 +176,18 @@  discard block
 block discarded – undo
176 176
 	{
177 177
 		$_param = array();
178 178
 
179
-		if(count($this->param))
179
+		if (count($this->param))
180 180
 		{
181
-			foreach($this->param as $k => $o)
181
+			foreach ($this->param as $k => $o)
182 182
 			{
183
-				if($o->isColumnName())
183
+				if ($o->isColumnName())
184 184
 				{
185 185
 					continue;
186 186
 				}
187
-				if($o->getType() == 'number')
187
+				if ($o->getType() == 'number')
188 188
 				{
189 189
 					$value = $o->getUnescapedValue();
190
-					if(is_array($value))
190
+					if (is_array($value))
191 191
 					{
192 192
 						$_param = array_merge($_param, $value);
193 193
 					}
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 				else
200 200
 				{
201 201
 					$value = $o->getUnescapedValue();
202
-					if(is_array($value))
202
+					if (is_array($value))
203 203
 					{
204
-						foreach($value as $v)
204
+						foreach ($value as $v)
205 205
 						{
206 206
 							$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
207 207
 						}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
 		// Run the query statement
218 218
 		$result = false;
219
-		if(count($_param))
219
+		if (count($_param))
220 220
 		{
221 221
 			$args = $this->_getParametersByReference($_param);
222 222
 			$stmt = sqlsrv_prepare($connection, $query, $args);
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			$stmt = sqlsrv_prepare($connection, $query);
227 227
 		}
228 228
 
229
-		if(!$stmt)
229
+		if (!$stmt)
230 230
 		{
231 231
 			$result = false;
232 232
 		}
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		}
237 237
 
238 238
 		// Error Check
239
-		if(!$result)
239
+		if (!$result)
240 240
 		{
241 241
 			$this->setError(print_r(sqlsrv_errors(), true));
242 242
 		}
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
 		$copy = array();
260 260
 		$args = array();
261 261
 		$i = 0;
262
-		foreach($_param as $key => $value)
262
+		foreach ($_param as $key => $value)
263 263
 		{
264
-			if(is_array($value))
264
+			if (is_array($value))
265 265
 			{
266 266
 				$value_copy = $value;
267 267
 				$value_arg = array();
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	function _fetch($result, $arrayIndexEndValue = NULL)
289 289
 	{
290 290
 		$output = array();
291
-		if(!$this->isConnected() || $this->isError() || !$result)
291
+		if (!$this->isConnected() || $this->isError() || !$result)
292 292
 		{
293 293
 			return $output;
294 294
 		}
@@ -296,18 +296,18 @@  discard block
 block discarded – undo
296 296
 		$c = sqlsrv_num_fields($result);
297 297
 		$m = null;
298 298
 
299
-		while(sqlsrv_fetch($result))
299
+		while (sqlsrv_fetch($result))
300 300
 		{
301
-			if(!$m)
301
+			if (!$m)
302 302
 			{
303 303
 				$m = sqlsrv_field_metadata($result);
304 304
 			}
305 305
 			unset($row);
306
-			for($i = 0; $i < $c; $i++)
306
+			for ($i = 0; $i < $c; $i++)
307 307
 			{
308 308
 				$row->{$m[$i]['Name']} = sqlsrv_get_field($result, $i, SQLSRV_PHPTYPE_STRING('utf-8'));
309 309
 			}
310
-			if($arrayIndexEndValue)
310
+			if ($arrayIndexEndValue)
311 311
 			{
312 312
 				$output[$arrayIndexEndValue--] = $row;
313 313
 			}
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 			}
318 318
 		}
319 319
 
320
-		if(count($output) == 1)
320
+		if (count($output) == 1)
321 321
 		{
322
-			if(isset($arrayIndexEndValue))
322
+			if (isset($arrayIndexEndValue))
323 323
 			{
324 324
 				return $output;
325 325
 			}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 		$result = $this->_query($query);
361 361
 		$tmp = $this->_fetch($result);
362 362
 
363
-		if(!$tmp)
363
+		if (!$tmp)
364 364
 		{
365 365
 			return false;
366 366
 		}
@@ -379,18 +379,18 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
381 381
 	{
382
-		if($this->isColumnExists($table_name, $column_name))
382
+		if ($this->isColumnExists($table_name, $column_name))
383 383
 		{
384 384
 			return;
385 385
 		}
386 386
 		$type = $this->column_type[$type];
387
-		if(strtoupper($type) == 'INTEGER')
387
+		if (strtoupper($type) == 'INTEGER')
388 388
 		{
389 389
 			$size = '';
390 390
 		}
391 391
 
392 392
 		$query = sprintf("alter table %s%s add \"%s\" ", $this->prefix, $table_name, $column_name);
393
-		if($size)
393
+		if ($size)
394 394
 		{
395 395
 			$query .= sprintf(" %s(%s) ", $type, $size);
396 396
 		}
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
 			$query .= sprintf(" %s ", $type);
400 400
 		}
401 401
 
402
-		if(isset($default))
402
+		if (isset($default))
403 403
 		{
404 404
 			$query .= sprintf(" default '%s' ", $default);
405 405
 		}
406
-		if($notnull)
406
+		if ($notnull)
407 407
 		{
408 408
 			$query .= " not null ";
409 409
 		}
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	function dropColumn($table_name, $column_name)
421 421
 	{
422
-		if(!$this->isColumnExists($table_name, $column_name))
422
+		if (!$this->isColumnExists($table_name, $column_name))
423 423
 		{
424 424
 			return;
425 425
 		}
@@ -437,12 +437,12 @@  discard block
 block discarded – undo
437 437
 	{
438 438
 		$query = sprintf("select syscolumns.name as name from syscolumns, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = syscolumns.id and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name);
439 439
 		$result = $this->_query($query);
440
-		if($this->isError())
440
+		if ($this->isError())
441 441
 		{
442 442
 			return;
443 443
 		}
444 444
 		$tmp = $this->_fetch($result);
445
-		if(!$tmp->name)
445
+		if (!$tmp->name)
446 446
 		{
447 447
 			return false;
448 448
 		}
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
 	 */
462 462
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = false)
463 463
 	{
464
-		if($this->isIndexExists($table_name, $index_name))
464
+		if ($this->isIndexExists($table_name, $index_name))
465 465
 		{
466 466
 			return;
467 467
 		}
468
-		if(!is_array($target_columns))
468
+		if (!is_array($target_columns))
469 469
 		{
470 470
 			$target_columns = array($target_columns);
471 471
 		}
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 */
484 484
 	function dropIndex($table_name, $index_name, $is_unique = false)
485 485
 	{
486
-		if(!$this->isIndexExists($table_name, $index_name))
486
+		if (!$this->isIndexExists($table_name, $index_name))
487 487
 		{
488 488
 			return;
489 489
 		}
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 		$query = sprintf("select sysindexes.name as name from sysindexes, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = sysindexes.id and sysindexes.name = '%s'", $this->prefix, $table_name, $index_name);
503 503
 
504 504
 		$result = $this->_query($query);
505
-		if($this->isError())
505
+		if ($this->isError())
506 506
 		{
507 507
 			return;
508 508
 		}
509 509
 		$tmp = $this->_fetch($result);
510 510
 
511
-		if(!$tmp->name)
511
+		if (!$tmp->name)
512 512
 		{
513 513
 			return false;
514 514
 		}
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	function createTableByXmlFile($file_name)
534 534
 	{
535
-		if(!file_exists($file_name))
535
+		if (!file_exists($file_name))
536 536
 		{
537 537
 			return;
538 538
 		}
@@ -557,22 +557,22 @@  discard block
 block discarded – undo
557 557
 		$xml_obj = $oXml->parse($xml_doc);
558 558
 		// Create a table schema
559 559
 		$table_name = $xml_obj->table->attrs->name;
560
-		if($this->isTableExists($table_name))
560
+		if ($this->isTableExists($table_name))
561 561
 		{
562 562
 			return;
563 563
 		}
564 564
 
565
-		if($table_name == 'sequence')
565
+		if ($table_name == 'sequence')
566 566
 		{
567
-			$table_name = $this->prefix . $table_name;
567
+			$table_name = $this->prefix.$table_name;
568 568
 			$query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name);
569 569
 			return $this->_query($query);
570 570
 		}
571 571
 		else
572 572
 		{
573
-			$table_name = $this->prefix . $table_name;
573
+			$table_name = $this->prefix.$table_name;
574 574
 
575
-			if(!is_array($xml_obj->table->column))
575
+			if (!is_array($xml_obj->table->column))
576 576
 			{
577 577
 				$columns[] = $xml_obj->table->column;
578 578
 			}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			$index_list = array();
587 587
 
588 588
 			$typeList = array('number' => 1, 'text' => 1);
589
-			foreach($columns as $column)
589
+			foreach ($columns as $column)
590 590
 			{
591 591
 				$name = $column->attrs->name;
592 592
 				$type = $column->attrs->type;
@@ -598,48 +598,48 @@  discard block
 block discarded – undo
598 598
 				$default = $column->attrs->default;
599 599
 				$auto_increment = $column->attrs->auto_increment;
600 600
 
601
-				$column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : '');
601
+				$column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], !isset($typeList[$type]) && $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : 'null', $auto_increment ? 'identity(1,1)' : '');
602 602
 
603
-				if($primary_key)
603
+				if ($primary_key)
604 604
 				{
605 605
 					$primary_list[] = $name;
606 606
 				}
607
-				else if($unique)
607
+				else if ($unique)
608 608
 				{
609 609
 					$unique_list[$unique][] = $name;
610 610
 				}
611
-				else if($index)
611
+				else if ($index)
612 612
 				{
613 613
 					$index_list[$index][] = $name;
614 614
 				}
615 615
 			}
616 616
 
617
-			if(count($primary_list))
617
+			if (count($primary_list))
618 618
 			{
619
-				$column_schema[] = sprintf("primary key (%s)", '"' . implode($primary_list, '","') . '"');
619
+				$column_schema[] = sprintf("primary key (%s)", '"'.implode($primary_list, '","').'"');
620 620
 			}
621 621
 
622 622
 			$schema = sprintf('create table [%s] (%s%s)', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"));
623 623
 			$output = $this->_query($schema);
624
-			if(!$output)
624
+			if (!$output)
625 625
 			{
626 626
 				return false;
627 627
 			}
628 628
 
629
-			if(count($unique_list))
629
+			if (count($unique_list))
630 630
 			{
631
-				foreach($unique_list as $key => $val)
631
+				foreach ($unique_list as $key => $val)
632 632
 				{
633
-					$query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']');
633
+					$query = sprintf("create unique index %s on %s (%s);", $key, $table_name, '['.implode('],[', $val).']');
634 634
 					$this->_query($query);
635 635
 				}
636 636
 			}
637 637
 
638
-			if(count($index_list))
638
+			if (count($index_list))
639 639
 			{
640
-				foreach($index_list as $key => $val)
640
+				foreach ($index_list as $key => $val)
641 641
 				{
642
-					$query = sprintf("create index %s on %s (%s);", $key, $table_name, '[' . implode('],[', $val) . ']');
642
+					$query = sprintf("create index %s on %s (%s);", $key, $table_name, '['.implode('],[', $val).']');
643 643
 					$this->_query($query);
644 644
 				}
645 645
 			}
@@ -682,34 +682,34 @@  discard block
 block discarded – undo
682 682
 	function getUpdateSql($query, $with_values = true, $with_priority = false)
683 683
 	{
684 684
 		$columnsList = $query->getUpdateString($with_values);
685
-		if($columnsList == '')
685
+		if ($columnsList == '')
686 686
 		{
687 687
 			return new BaseObject(-1, "Invalid query");
688 688
 		}
689 689
 
690 690
 		$from = $query->getFromString($with_values);
691
-		if($from == '')
691
+		if ($from == '')
692 692
 		{
693 693
 			return new BaseObject(-1, "Invalid query");
694 694
 		}
695 695
 
696 696
 		$tables = $query->getTables();
697 697
 		$alias_list = '';
698
-		foreach($tables as $table)
698
+		foreach ($tables as $table)
699 699
 		{
700 700
 			$alias_list .= $table->getAlias();
701 701
 		}
702 702
 		implode(',', explode(' ', $alias_list));
703 703
 
704 704
 		$where = $query->getWhereString($with_values);
705
-		if($where != '')
705
+		if ($where != '')
706 706
 		{
707
-			$where = ' WHERE ' . $where;
707
+			$where = ' WHERE '.$where;
708 708
 		}
709 709
 
710 710
 		$priority = $with_priority ? $query->getPriority() : '';
711 711
 
712
-		return "UPDATE $priority $alias_list SET $columnsList FROM " . $from . $where;
712
+		return "UPDATE $priority $alias_list SET $columnsList FROM ".$from.$where;
713 713
 	}
714 714
 
715 715
 	/**
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 * @param boolean $with_values
731 731
 	 * @return string
732 732
 	 */
733
-	function getSelectSql($query, $with_values = TRUE, $connection=NULL)
733
+	function getSelectSql($query, $with_values = TRUE, $connection = NULL)
734 734
 	{
735 735
 		$with_values = false;
736 736
 
@@ -740,75 +740,75 @@  discard block
 block discarded – undo
740 740
 		$limit = '';
741 741
 		$limitCount = '';
742 742
 		$limitQueryPart = $query->getLimit();
743
-		if($limitQueryPart)
743
+		if ($limitQueryPart)
744 744
 		{
745 745
 			$limitCount = $limitQueryPart->getLimit();
746 746
 		}
747
-		if($limitCount != '')
747
+		if ($limitCount != '')
748 748
 		{
749
-			$limit = 'SELECT TOP ' . $limitCount;
749
+			$limit = 'SELECT TOP '.$limitCount;
750 750
 		}
751 751
 
752 752
 		$select = $query->getSelectString($with_values);
753
-		if($select == '')
753
+		if ($select == '')
754 754
 		{
755 755
 			return new BaseObject(-1, "Invalid query");
756 756
 		}
757
-		if($limit != '')
757
+		if ($limit != '')
758 758
 		{
759
-			$select = $limit . ' ' . $select;
759
+			$select = $limit.' '.$select;
760 760
 		}
761 761
 		else
762 762
 		{
763
-			$select = 'SELECT ' . $select;
763
+			$select = 'SELECT '.$select;
764 764
 		}
765 765
 
766 766
 		$from = $query->getFromString($with_values);
767
-		if($from == '')
767
+		if ($from == '')
768 768
 		{
769 769
 			return new BaseObject(-1, "Invalid query");
770 770
 		}
771
-		$from = ' FROM ' . $from;
771
+		$from = ' FROM '.$from;
772 772
 
773 773
 		$where = $query->getWhereString($with_values);
774
-		if($where != '')
774
+		if ($where != '')
775 775
 		{
776
-			$where = ' WHERE ' . $where;
776
+			$where = ' WHERE '.$where;
777 777
 		}
778 778
 
779 779
 		$groupBy = $query->getGroupByString();
780
-		if($groupBy != '')
780
+		if ($groupBy != '')
781 781
 		{
782
-			$groupBy = ' GROUP BY ' . $groupBy;
782
+			$groupBy = ' GROUP BY '.$groupBy;
783 783
 		}
784 784
 
785 785
 		$orderBy = $query->getOrderByString();
786
-		if($orderBy != '')
786
+		if ($orderBy != '')
787 787
 		{
788
-			$orderBy = ' ORDER BY ' . $orderBy;
788
+			$orderBy = ' ORDER BY '.$orderBy;
789 789
 		}
790 790
 
791
-		if($limitCount != '' && $query->limit->start > 0)
791
+		if ($limitCount != '' && $query->limit->start > 0)
792 792
 		{
793 793
 			$order = $query->getOrder();
794 794
 			$first_columns = array();
795
-			foreach($order as $val)
795
+			foreach ($order as $val)
796 796
 			{
797 797
 				$tmpColumnName = $val->getPureColumnName();
798
-				$first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder()=='asc'?'max':'min', $tmpColumnName, $tmpColumnName);
798
+				$first_columns[] = sprintf('%s(%s) as %s', $val->getPureSortOrder() == 'asc' ? 'max' : 'min', $tmpColumnName, $tmpColumnName);
799 799
 				$first_sub_columns[] = $tmpColumnName;
800 800
 			}
801 801
 
802
-			$first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',',$first_columns),  $query->limit->start, implode(',',$first_sub_columns), $from, $where, $groupBy, $orderBy);
802
+			$first_query = sprintf("select %s from (select top %d %s %s %s %s %s) xet", implode(',', $first_columns), $query->limit->start, implode(',', $first_sub_columns), $from, $where, $groupBy, $orderBy);
803 803
 			$this->param = $query->getArguments();
804 804
 			$result = $this->__query($first_query, $connection);
805 805
 			$tmp = $this->_fetch($result);
806 806
 
807 807
 			$sub_cond = array();
808
-			foreach($order as $k => $v)
808
+			foreach ($order as $k => $v)
809 809
 			{
810 810
 				//for example... use Document
811
-				if(get_class($v->sort_order) == 'SortArgument')
811
+				if (get_class($v->sort_order) == 'SortArgument')
812 812
 				{
813 813
 					$sort_order = $v->sort_order->value;
814 814
 				}
@@ -818,19 +818,19 @@  discard block
 block discarded – undo
818 818
 					$sort_order = $v->sort_order;
819 819
 				}
820 820
 
821
-				$sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order=='asc'?'>':'<', $tmp->{$v->getPureColumnName()});
821
+				$sub_cond[] = sprintf("%s %s '%s'", $v->getPureColumnName(), $sort_order == 'asc' ? '>' : '<', $tmp->{$v->getPureColumnName()});
822 822
 			}
823 823
 
824
-			if(!$where)
824
+			if (!$where)
825 825
 			{
826
-				$sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )';
826
+				$sub_condition = ' WHERE ( '.implode(' and ', $sub_cond).' )';
827 827
 			}
828 828
 			else
829 829
 			{
830
-				$sub_condition = ' and ( '.implode(' and ',$sub_cond).' )';
830
+				$sub_condition = ' and ( '.implode(' and ', $sub_cond).' )';
831 831
 			}
832 832
 		}
833
-		return $select . ' ' . $from . ' ' . $where .$sub_condition. ' ' . $groupBy . ' ' . $orderBy;
833
+		return $select.' '.$from.' '.$where.$sub_condition.' '.$groupBy.' '.$orderBy;
834 834
 	}
835 835
 
836 836
 	/**
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 	{
846 846
 		$query = $this->getSelectSql($queryObject, true, $connection);
847 847
 
848
-		if(strpos($query, "substr"))
848
+		if (strpos($query, "substr"))
849 849
 		{
850 850
 			$query = str_replace("substr", "substring", $query);
851 851
 		}
@@ -853,10 +853,10 @@  discard block
 block discarded – undo
853 853
 		// TODO Decide if we continue to pass parameters like this
854 854
 		$this->param = $queryObject->getArguments();
855 855
 
856
-		$query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
856
+		$query .= (__DEBUG_QUERY__ & 1 && $output->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
857 857
 		$result = $this->_query($query, $connection);
858 858
 
859
-		if($this->isError())
859
+		if ($this->isError())
860 860
 		{
861 861
 			return $this->queryError($queryObject);
862 862
 		}
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 	function queryError($queryObject)
885 885
 	{
886 886
 		$limit = $queryObject->getLimit();
887
-		if($limit && $limit->isPageHandler())
887
+		if ($limit && $limit->isPageHandler())
888 888
 		{
889 889
 			$buff = new BaseObject();
890 890
 			$buff->total_count = 0;
@@ -910,52 +910,52 @@  discard block
 block discarded – undo
910 910
 	function queryPageLimit($queryObject, $result, $connection)
911 911
 	{
912 912
 		$limit = $queryObject->getLimit();
913
-		if($limit && $limit->isPageHandler())
913
+		if ($limit && $limit->isPageHandler())
914 914
 		{
915 915
 			// Total count
916 916
 			$temp_where = $queryObject->getWhereString(true, false);
917
-			$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE ' . $temp_where));
917
+			$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString(), ($temp_where === '' ? '' : ' WHERE '.$temp_where));
918 918
 
919 919
 			// Check for distinct query and if found update count query structure
920 920
 			$temp_select = $queryObject->getSelectString(true);
921 921
 			$uses_distinct = stripos($temp_select, "distinct") !== false;
922 922
 			$uses_groupby = $queryObject->getGroupByString() != '';
923
-			if($uses_distinct || $uses_groupby)
923
+			if ($uses_distinct || $uses_groupby)
924 924
 			{
925 925
 				$count_query = sprintf('select %s %s %s %s'
926 926
 						, $temp_select
927
-						, 'FROM ' . $queryObject->getFromString(true)
928
-						, ($temp_where === '' ? '' : ' WHERE ' . $temp_where)
929
-						, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
927
+						, 'FROM '.$queryObject->getFromString(true)
928
+						, ($temp_where === '' ? '' : ' WHERE '.$temp_where)
929
+						, ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '')
930 930
 				);
931 931
 
932 932
 				// If query uses grouping or distinct, count from original select
933 933
 				$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
934 934
 			}
935 935
 
936
-			$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
936
+			$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
937 937
 			$this->param = $queryObject->getArguments();
938 938
 			$result_count = $this->_query($count_query, $connection);
939 939
 			$count_output = $this->_fetch($result_count);
940 940
 			$total_count = (int) $count_output->count;
941 941
 
942 942
 			$list_count = $limit->list_count->getValue();
943
-			if(!$list_count)
943
+			if (!$list_count)
944 944
 			{
945 945
 				$list_count = 20;
946 946
 			}
947 947
 			$page_count = $limit->page_count->getValue();
948
-			if(!$page_count)
948
+			if (!$page_count)
949 949
 			{
950 950
 				$page_count = 10;
951 951
 			}
952 952
 			$page = $limit->page->getValue();
953
-			if(!$page || $page < 1)
953
+			if (!$page || $page < 1)
954 954
 			{
955 955
 				$page = 1;
956 956
 			}
957 957
 			// Total pages
958
-			if($total_count)
958
+			if ($total_count)
959 959
 			{
960 960
 				$total_page = (int) (($total_count - 1) / $list_count) + 1;
961 961
 			}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 			}
966 966
 
967 967
 			// check the page variables
968
-			if($page > $total_page)
968
+			if ($page > $total_page)
969 969
 			{
970 970
 				// If requested page is bigger than total number of pages, return empty list
971 971
 
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 				$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
978 978
 				return $buff;
979 979
 
980
-				if($queryObject->usesClickCount())
980
+				if ($queryObject->usesClickCount())
981 981
 				{
982 982
 					$update_query = $this->getClickCountQuery($queryObject);
983 983
 					$this->_executeUpdateAct($update_query);
Please login to merge, or discard this patch.
Braces   +24 added lines, -43 removed lines patch added patch discarded remove patch
@@ -45,7 +45,9 @@  discard block
 block discarded – undo
45 45
 	function DBMssql($auto_connect = TRUE)
46 46
 	{
47 47
 		$this->_setDBInfo();
48
-		if($auto_connect) $this->_connect();
48
+		if($auto_connect) {
49
+			$this->_connect();
50
+		}
49 51
 	}
50 52
 
51 53
 	/**
@@ -123,8 +125,7 @@  discard block
 block discarded – undo
123 125
 			{
124 126
 				return;
125 127
 			}
126
-		}
127
-		else
128
+		} else
128 129
 		{
129 130
 			$this->_query("SAVE TRANS SP" . $transactionLevel, $connection);
130 131
 		}
@@ -145,8 +146,7 @@  discard block
 block discarded – undo
145 146
 		if($point)
146 147
 		{
147 148
 			$this->_query("ROLLBACK TRANS SP" . $point, $connection);
148
-		}
149
-		else
149
+		} else
150 150
 		{
151 151
 			sqlsrv_rollback($connection);
152 152
 		}
@@ -190,13 +190,11 @@  discard block
 block discarded – undo
190 190
 					if(is_array($value))
191 191
 					{
192 192
 						$_param = array_merge($_param, $value);
193
-					}
194
-					else
193
+					} else
195 194
 					{
196 195
 						$_param[] = $o->getUnescapedValue();
197 196
 					}
198
-				}
199
-				else
197
+				} else
200 198
 				{
201 199
 					$value = $o->getUnescapedValue();
202 200
 					if(is_array($value))
@@ -205,8 +203,7 @@  discard block
 block discarded – undo
205 203
 						{
206 204
 							$_param[] = array($v, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
207 205
 						}
208
-					}
209
-					else
206
+					} else
210 207
 					{
211 208
 						$_param[] = array($value, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STRING('utf-8'));
212 209
 					}
@@ -220,8 +217,7 @@  discard block
 block discarded – undo
220 217
 		{
221 218
 			$args = $this->_getParametersByReference($_param);
222 219
 			$stmt = sqlsrv_prepare($connection, $query, $args);
223
-		}
224
-		else
220
+		} else
225 221
 		{
226 222
 			$stmt = sqlsrv_prepare($connection, $query);
227 223
 		}
@@ -229,8 +225,7 @@  discard block
 block discarded – undo
229 225
 		if(!$stmt)
230 226
 		{
231 227
 			$result = false;
232
-		}
233
-		else
228
+		} else
234 229
 		{
235 230
 			$result = sqlsrv_execute($stmt);
236 231
 		}
@@ -268,8 +263,7 @@  discard block
 block discarded – undo
268 263
 				$value_arg[] = &$value_copy[0];
269 264
 				$value_arg[] = $value_copy[1];
270 265
 				$value_arg[] = $value_copy[2];
271
-			}
272
-			else
266
+			} else
273 267
 			{
274 268
 				$value_arg = $value;
275 269
 			}
@@ -310,8 +304,7 @@  discard block
 block discarded – undo
310 304
 			if($arrayIndexEndValue)
311 305
 			{
312 306
 				$output[$arrayIndexEndValue--] = $row;
313
-			}
314
-			else
307
+			} else
315 308
 			{
316 309
 				$output[] = $row;
317 310
 			}
@@ -322,8 +315,7 @@  discard block
 block discarded – undo
322 315
 			if(isset($arrayIndexEndValue))
323 316
 			{
324 317
 				return $output;
325
-			}
326
-			else
318
+			} else
327 319
 			{
328 320
 				return $output[0];
329 321
 			}
@@ -393,8 +385,7 @@  discard block
 block discarded – undo
393 385
 		if($size)
394 386
 		{
395 387
 			$query .= sprintf(" %s(%s) ", $type, $size);
396
-		}
397
-		else
388
+		} else
398 389
 		{
399 390
 			$query .= sprintf(" %s ", $type);
400 391
 		}
@@ -567,16 +558,14 @@  discard block
 block discarded – undo
567 558
 			$table_name = $this->prefix . $table_name;
568 559
 			$query = sprintf('create table %s ( sequence int identity(1,1), seq int )', $table_name);
569 560
 			return $this->_query($query);
570
-		}
571
-		else
561
+		} else
572 562
 		{
573 563
 			$table_name = $this->prefix . $table_name;
574 564
 
575 565
 			if(!is_array($xml_obj->table->column))
576 566
 			{
577 567
 				$columns[] = $xml_obj->table->column;
578
-			}
579
-			else
568
+			} else
580 569
 			{
581 570
 				$columns = $xml_obj->table->column;
582 571
 			}
@@ -603,12 +592,10 @@  discard block
 block discarded – undo
603 592
 				if($primary_key)
604 593
 				{
605 594
 					$primary_list[] = $name;
606
-				}
607
-				else if($unique)
595
+				} else if($unique)
608 596
 				{
609 597
 					$unique_list[$unique][] = $name;
610
-				}
611
-				else if($index)
598
+				} else if($index)
612 599
 				{
613 600
 					$index_list[$index][] = $name;
614 601
 				}
@@ -757,8 +744,7 @@  discard block
 block discarded – undo
757 744
 		if($limit != '')
758 745
 		{
759 746
 			$select = $limit . ' ' . $select;
760
-		}
761
-		else
747
+		} else
762 748
 		{
763 749
 			$select = 'SELECT ' . $select;
764 750
 		}
@@ -824,8 +810,7 @@  discard block
 block discarded – undo
824 810
 			if(!$where)
825 811
 			{
826 812
 				$sub_condition = ' WHERE ( '.implode(' and ',$sub_cond).' )';
827
-			}
828
-			else
813
+			} else
829 814
 			{
830 815
 				$sub_condition = ' and ( '.implode(' and ',$sub_cond).' )';
831 816
 			}
@@ -859,8 +844,7 @@  discard block
 block discarded – undo
859 844
 		if($this->isError())
860 845
 		{
861 846
 			return $this->queryError($queryObject);
862
-		}
863
-		else
847
+		} else
864 848
 		{
865 849
 			return $this->queryPageLimit($queryObject, $result, $connection);
866 850
 		}
@@ -893,8 +877,7 @@  discard block
 block discarded – undo
893 877
 			$buff->data = array();
894 878
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
895 879
 			return $buff;
896
-		}
897
-		else
880
+		} else
898 881
 		{
899 882
 			return;
900 883
 		}
@@ -958,8 +941,7 @@  discard block
 block discarded – undo
958 941
 			if($total_count)
959 942
 			{
960 943
 				$total_page = (int) (($total_count - 1) / $list_count) + 1;
961
-			}
962
-			else
944
+			} else
963 945
 			{
964 946
 				$total_page = 1;
965 947
 			}
@@ -995,8 +977,7 @@  discard block
 block discarded – undo
995 977
 			$buff->page = $page;
996 978
 			$buff->data = $data;
997 979
 			$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
998
-		}
999
-		else
980
+		} else
1000 981
 		{
1001 982
 			$data = $this->_fetch($result);
1002 983
 			$buff = new BaseObject();
Please login to merge, or discard this patch.
classes/db/DBMysql.class.php 3 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 * @param int $size column size
298 298
 	 * @param string|int $default default value
299 299
 	 * @param boolean $notnull not null status, default value is false
300
-	 * @return void
300
+	 * @return resource|null
301 301
 	 */
302 302
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
303 303
 	{
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * Check column exist status of the table
345 345
 	 * @param string $table_name table name
346 346
 	 * @param string $column_name column name
347
-	 * @return boolean
347
+	 * @return null|boolean
348 348
 	 */
349 349
 	function isColumnExists($table_name, $column_name)
350 350
 	{
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 	 * Check index status of the table
409 409
 	 * @param string $table_name table name
410 410
 	 * @param string $index_name index name
411
-	 * @return boolean
411
+	 * @return null|boolean
412 412
 	 */
413 413
 	function isIndexExists($table_name, $index_name)
414 414
 	{
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	/**
443 443
 	 * Creates a table by using xml contents
444 444
 	 * @param string $xml_doc xml schema contents
445
-	 * @return void|object
445
+	 * @return null|false
446 446
 	 */
447 447
 	function createTableByXml($xml_doc)
448 448
 	{
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 	/**
453 453
 	 * Creates a table by using xml file path
454 454
 	 * @param string $file_name xml schema file path
455
-	 * @return void|object
455
+	 * @return null|false
456 456
 	 */
457 457
 	function createTableByXmlFile($file_name)
458 458
 	{
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * opt : notnull, default, size\n
473 473
 	 * index : primary key, index, unique\n
474 474
 	 * @param string $xml_doc xml schema contents
475
-	 * @return void|object
475
+	 * @return null|false
476 476
 	 */
477 477
 	function _createTable($xml_doc)
478 478
 	{
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 
825 825
 	/**
826 826
 	 * If select query execute, return paging sql
827
-	 * @param object $query
827
+	 * @param BaseObject $query
828 828
 	 * @param boolean $with_values
829 829
 	 * @param int $start_count
830 830
 	 * @param int $list_count
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	function DBMysql($auto_connect = TRUE)
47 47
 	{
48 48
 		$this->_setDBInfo();
49
-		if($auto_connect) $this->_connect();
49
+		if ($auto_connect) $this->_connect();
50 50
 	}
51 51
 
52 52
 	/**
@@ -67,32 +67,32 @@  discard block
 block discarded – undo
67 67
 	function __connect($connection)
68 68
 	{
69 69
 		// Ignore if no DB information exists
70
-		if(strpos($connection["db_hostname"], ':') === false && $connection["db_port"])
70
+		if (strpos($connection["db_hostname"], ':') === false && $connection["db_port"])
71 71
 		{
72
-			$connection["db_hostname"] .= ':' . $connection["db_port"];
72
+			$connection["db_hostname"] .= ':'.$connection["db_port"];
73 73
 		}
74 74
 
75 75
 		// Attempt to connect
76 76
 		$result = @mysql_connect($connection["db_hostname"], $connection["db_userid"], $connection["db_password"]);
77
-		if(!$result)
77
+		if (!$result)
78 78
 		{
79 79
 			exit('XE cannot connect to DB.');
80 80
 		}
81 81
 
82
-		if(mysql_error())
82
+		if (mysql_error())
83 83
 		{
84 84
 			$this->setError(mysql_errno(), mysql_error());
85 85
 			return;
86 86
 		}
87 87
 		// Error appears if the version is lower than 4.1
88
-		if(version_compare(mysql_get_server_info($result), '4.1', '<'))
88
+		if (version_compare(mysql_get_server_info($result), '4.1', '<'))
89 89
 		{
90
-			$this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is ' . mysql_get_server_info());
90
+			$this->setError(-1, 'XE cannot be installed under the version of mysql 4.1. Current mysql version is '.mysql_get_server_info());
91 91
 			return;
92 92
 		}
93 93
 		// select db
94 94
 		@mysql_select_db($connection["db_database"], $result);
95
-		if(mysql_error())
95
+		if (mysql_error())
96 96
 		{
97 97
 			$this->setError(mysql_errno(), mysql_error());
98 98
 			return;
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 */
132 132
 	function addQuotes($string)
133 133
 	{
134
-		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
134
+		if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
135 135
 		{
136 136
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
137 137
 		}
138
-		if(!is_numeric($string))
138
+		if (!is_numeric($string))
139 139
 		{
140 140
 			$string = @mysql_real_escape_string($string);
141 141
 		}
@@ -181,14 +181,14 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	function __query($query, $connection)
183 183
 	{
184
-		if(!$connection)
184
+		if (!$connection)
185 185
 		{
186 186
 			exit('XE cannot handle DB connection.');
187 187
 		}
188 188
 		// Run the query statement
189 189
 		$result = mysql_query($query, $connection);
190 190
 		// Error Check
191
-		if(mysql_error($connection))
191
+		if (mysql_error($connection))
192 192
 		{
193 193
 			$this->setError(mysql_errno($connection), mysql_error($connection));
194 194
 		}
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 	function _fetch($result, $arrayIndexEndValue = NULL)
206 206
 	{
207 207
 		$output = array();
208
-		if(!$this->isConnected() || $this->isError() || !$result)
208
+		if (!$this->isConnected() || $this->isError() || !$result)
209 209
 		{
210 210
 			return $output;
211 211
 		}
212
-		while($tmp = $this->db_fetch_object($result))
212
+		while ($tmp = $this->db_fetch_object($result))
213 213
 		{
214
-			if($arrayIndexEndValue)
214
+			if ($arrayIndexEndValue)
215 215
 			{
216 216
 				$output[$arrayIndexEndValue--] = $tmp;
217 217
 			}
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
 				$output[] = $tmp;
221 221
 			}
222 222
 		}
223
-		if(count($output) == 1)
223
+		if (count($output) == 1)
224 224
 		{
225
-			if(isset($arrayIndexEndValue))
225
+			if (isset($arrayIndexEndValue))
226 226
 			{
227 227
 				return $output;
228 228
 			}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		$query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix);
246 246
 		$this->_query($query);
247 247
 		$sequence = $this->db_insert_id();
248
-		if($sequence % 10000 == 0)
248
+		if ($sequence % 10000 == 0)
249 249
 		{
250 250
 			$query = sprintf("delete from  `%ssequence` where seq < %d", $this->prefix, $sequence);
251 251
 			$this->_query($query);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		$query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($password));
266 266
 		$result = $this->_query($query);
267 267
 		$tmp = $this->_fetch($result);
268
-		if($tmp->password === $saved_password || $tmp->old_password === $saved_password)
268
+		if ($tmp->password === $saved_password || $tmp->old_password === $saved_password)
269 269
 		{
270 270
 			return true;
271 271
 		}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		$query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($target_name));
283 283
 		$result = $this->_query($query);
284 284
 		$tmp = $this->_fetch($result);
285
-		if(!$tmp)
285
+		if (!$tmp)
286 286
 		{
287 287
 			return false;
288 288
 		}
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
 	function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = null, $notnull = false)
303 303
 	{
304 304
 		$type = $this->column_type[$type];
305
-		if(strtoupper($type) == 'INTEGER')
305
+		if (strtoupper($type) == 'INTEGER')
306 306
 		{
307 307
 			$size = '';
308 308
 		}
309 309
 
310 310
 		$query = sprintf("alter table `%s%s` add `%s` ", $this->prefix, $table_name, $column_name);
311
-		if($size)
311
+		if ($size)
312 312
 		{
313 313
 			$query .= sprintf(" %s(%s) ", $type, $size);
314 314
 		}
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 		{
317 317
 			$query .= sprintf(" %s ", $type);
318 318
 		}
319
-		if(isset($default))
319
+		if (isset($default))
320 320
 		{
321 321
 			$query .= sprintf(" default '%s' ", $default);
322 322
 		}
323
-		if($notnull)
323
+		if ($notnull)
324 324
 		{
325 325
 			$query .= " not null ";
326 326
 		}
@@ -350,18 +350,18 @@  discard block
 block discarded – undo
350 350
 	{
351 351
 		$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name);
352 352
 		$result = $this->_query($query);
353
-		if($this->isError())
353
+		if ($this->isError())
354 354
 		{
355 355
 			return;
356 356
 		}
357 357
 		$output = $this->_fetch($result);
358
-		if($output)
358
+		if ($output)
359 359
 		{
360 360
 			$column_name = strtolower($column_name);
361
-			foreach($output as $key => $val)
361
+			foreach ($output as $key => $val)
362 362
 			{
363 363
 				$name = strtolower($val->Field);
364
-				if($column_name == $name)
364
+				if ($column_name == $name)
365 365
 				{
366 366
 					return true;
367 367
 				}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	function addIndex($table_name, $index_name, $target_columns, $is_unique = false)
384 384
 	{
385
-		if(!is_array($target_columns))
385
+		if (!is_array($target_columns))
386 386
 		{
387 387
 			$target_columns = array($target_columns);
388 388
 		}
@@ -415,23 +415,23 @@  discard block
 block discarded – undo
415 415
 		//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
416 416
 		$query = sprintf("show indexes from `%s%s`", $this->prefix, $table_name);
417 417
 		$result = $this->_query($query);
418
-		if($this->isError())
418
+		if ($this->isError())
419 419
 		{
420 420
 			return;
421 421
 		}
422 422
 		$output = $this->_fetch($result);
423
-		if(!$output)
423
+		if (!$output)
424 424
 		{
425 425
 			return;
426 426
 		}
427
-		if(!is_array($output))
427
+		if (!is_array($output))
428 428
 		{
429 429
 			$output = array($output);
430 430
 		}
431 431
 
432
-		for($i = 0; $i < count($output); $i++)
432
+		for ($i = 0; $i < count($output); $i++)
433 433
 		{
434
-			if($output[$i]->Key_name == $index_name)
434
+			if ($output[$i]->Key_name == $index_name)
435 435
 			{
436 436
 				return true;
437 437
 			}
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	function createTableByXmlFile($file_name)
458 458
 	{
459
-		if(!file_exists($file_name))
459
+		if (!file_exists($file_name))
460 460
 		{
461 461
 			return;
462 462
 		}
@@ -481,13 +481,13 @@  discard block
 block discarded – undo
481 481
 		$xml_obj = $oXml->parse($xml_doc);
482 482
 		// Create a table schema
483 483
 		$table_name = $xml_obj->table->attrs->name;
484
-		if($this->isTableExists($table_name))
484
+		if ($this->isTableExists($table_name))
485 485
 		{
486 486
 			return;
487 487
 		}
488
-		$table_name = $this->prefix . $table_name;
488
+		$table_name = $this->prefix.$table_name;
489 489
 
490
-		if(!is_array($xml_obj->table->column))
490
+		if (!is_array($xml_obj->table->column))
491 491
 		{
492 492
 			$columns[] = $xml_obj->table->column;
493 493
 		}
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		$unique_list = array();
501 501
 		$index_list = array();
502 502
 
503
-		foreach($columns as $column)
503
+		foreach ($columns as $column)
504 504
 		{
505 505
 			$name = $column->attrs->name;
506 506
 			$type = $column->attrs->type;
@@ -512,47 +512,47 @@  discard block
 block discarded – undo
512 512
 			$default = $column->attrs->default;
513 513
 			$auto_increment = $column->attrs->auto_increment;
514 514
 
515
-			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '(' . $size . ')' : '', isset($default) ? "default '" . $default . "'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
515
+			$column_schema[] = sprintf('`%s` %s%s %s %s %s', $name, $this->column_type[$type], $size ? '('.$size.')' : '', isset($default) ? "default '".$default."'" : '', $notnull ? 'not null' : '', $auto_increment ? 'auto_increment' : '');
516 516
 
517
-			if($primary_key)
517
+			if ($primary_key)
518 518
 			{
519 519
 				$primary_list[] = $name;
520 520
 			}
521
-			else if($unique)
521
+			else if ($unique)
522 522
 			{
523 523
 				$unique_list[$unique][] = $name;
524 524
 			}
525
-			else if($index)
525
+			else if ($index)
526 526
 			{
527 527
 				$index_list[$index][] = $name;
528 528
 			}
529 529
 		}
530 530
 
531
-		if(count($primary_list))
531
+		if (count($primary_list))
532 532
 		{
533
-			$column_schema[] = sprintf("primary key (%s)", '`' . implode($primary_list, '`,`') . '`');
533
+			$column_schema[] = sprintf("primary key (%s)", '`'.implode($primary_list, '`,`').'`');
534 534
 		}
535 535
 
536
-		if(count($unique_list))
536
+		if (count($unique_list))
537 537
 		{
538
-			foreach($unique_list as $key => $val)
538
+			foreach ($unique_list as $key => $val)
539 539
 			{
540
-				$column_schema[] = sprintf("unique %s (%s)", $key, '`' . implode($val, '`,`') . '`');
540
+				$column_schema[] = sprintf("unique %s (%s)", $key, '`'.implode($val, '`,`').'`');
541 541
 			}
542 542
 		}
543 543
 
544
-		if(count($index_list))
544
+		if (count($index_list))
545 545
 		{
546
-			foreach($index_list as $key => $val)
546
+			foreach ($index_list as $key => $val)
547 547
 			{
548
-				$column_schema[] = sprintf("index %s (%s)", $key, '`' . implode($val, '`,`') . '`');
548
+				$column_schema[] = sprintf("index %s (%s)", $key, '`'.implode($val, '`,`').'`');
549 549
 			}
550 550
 		}
551 551
 
552 552
 		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM  CHARACTER SET utf8 COLLATE utf8_general_ci");
553 553
 
554 554
 		$output = $this->_query($schema);
555
-		if(!$output)
555
+		if (!$output)
556 556
 			return false;
557 557
 	}
558 558
 
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 	function _executeInsertAct($queryObject, $with_values = true)
566 566
 	{
567 567
 		$query = $this->getInsertSql($queryObject, $with_values, true);
568
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
569
-		if(is_a($query, 'BaseObject'))
568
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
569
+		if (is_a($query, 'BaseObject'))
570 570
 		{
571 571
 			return;
572 572
 		}
@@ -582,13 +582,13 @@  discard block
 block discarded – undo
582 582
 	function _executeUpdateAct($queryObject, $with_values = true)
583 583
 	{
584 584
 		$query = $this->getUpdateSql($queryObject, $with_values, true);
585
-		if(is_a($query, 'BaseObject'))
585
+		if (is_a($query, 'BaseObject'))
586 586
 		{
587
-			if(!$query->toBool()) return $query;
587
+			if (!$query->toBool()) return $query;
588 588
 			else return;
589 589
 		}
590 590
 
591
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
591
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
592 592
 
593 593
 
594 594
 		return $this->_query($query);
@@ -603,8 +603,8 @@  discard block
 block discarded – undo
603 603
 	function _executeDeleteAct($queryObject, $with_values = true)
604 604
 	{
605 605
 		$query = $this->getDeleteSql($queryObject, $with_values, true);
606
-		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
607
-		if(is_a($query, 'BaseObject'))
606
+		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
607
+		if (is_a($query, 'BaseObject'))
608 608
 		{
609 609
 			return;
610 610
 		}
@@ -624,21 +624,21 @@  discard block
 block discarded – undo
624 624
 	{
625 625
 		$limit = $queryObject->getLimit();
626 626
 		$result = NULL;
627
-		if($limit && $limit->isPageHandler())
627
+		if ($limit && $limit->isPageHandler())
628 628
 		{
629 629
 			return $this->queryPageLimit($queryObject, $result, $connection, $with_values);
630 630
 		}
631 631
 		else
632 632
 		{
633 633
 			$query = $this->getSelectSql($queryObject, $with_values);
634
-			if(is_a($query, 'BaseObject'))
634
+			if (is_a($query, 'BaseObject'))
635 635
 			{
636 636
 				return;
637 637
 			}
638
-			$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
638
+			$query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : '';
639 639
 
640 640
 			$result = $this->_query($query, $connection);
641
-			if($this->isError())
641
+			if ($this->isError())
642 642
 			{
643 643
 				return $this->queryError($queryObject);
644 644
 			}
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 			$buff = new BaseObject();
648 648
 			$buff->data = $data;
649 649
 
650
-			if($queryObject->usesClickCount())
650
+			if ($queryObject->usesClickCount())
651 651
 			{
652 652
 				$update_query = $this->getClickCountQuery($queryObject);
653 653
 				$this->_executeUpdateAct($update_query, $with_values);
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 	function queryError($queryObject)
709 709
 	{
710 710
 		$limit = $queryObject->getLimit();
711
-		if($limit && $limit->isPageHandler())
711
+		if ($limit && $limit->isPageHandler())
712 712
 		{
713 713
 			$buff = new BaseObject();
714 714
 			$buff->total_count = 0;
@@ -737,48 +737,48 @@  discard block
 block discarded – undo
737 737
 		$limit = $queryObject->getLimit();
738 738
 		// Total count
739 739
 		$temp_where = $queryObject->getWhereString($with_values, false);
740
-		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM ' . $queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE ' . $temp_where));
740
+		$count_query = sprintf('select count(*) as "count" %s %s', 'FROM '.$queryObject->getFromString($with_values), ($temp_where === '' ? '' : ' WHERE '.$temp_where));
741 741
 
742 742
 		// Check for distinct query and if found update count query structure
743 743
 		$temp_select = $queryObject->getSelectString($with_values);
744 744
 		$uses_distinct = stripos($temp_select, "distinct") !== false;
745 745
 		$uses_groupby = $queryObject->getGroupByString() != '';
746
-		if($uses_distinct || $uses_groupby)
746
+		if ($uses_distinct || $uses_groupby)
747 747
 		{
748 748
 			$count_query = sprintf('select %s %s %s %s'
749 749
 					, $temp_select == '*' ? '1' : $temp_select
750
-					, 'FROM ' . $queryObject->getFromString($with_values)
751
-					, ($temp_where === '' ? '' : ' WHERE ' . $temp_where)
752
-					, ($uses_groupby ? ' GROUP BY ' . $queryObject->getGroupByString() : '')
750
+					, 'FROM '.$queryObject->getFromString($with_values)
751
+					, ($temp_where === '' ? '' : ' WHERE '.$temp_where)
752
+					, ($uses_groupby ? ' GROUP BY '.$queryObject->getGroupByString() : '')
753 753
 			);
754 754
 
755 755
 			// If query uses grouping or distinct, count from original select
756 756
 			$count_query = sprintf('select count(*) as "count" from (%s) xet', $count_query);
757 757
 		}
758 758
 
759
-		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' ' . $this->comment_syntax, $queryObject->queryID) : '';
759
+		$count_query .= (__DEBUG_QUERY__ & 1 && $queryObject->queryID) ? sprintf(' '.$this->comment_syntax, $queryObject->queryID) : '';
760 760
 		$result_count = $this->_query($count_query, $connection);
761 761
 		$count_output = $this->_fetch($result_count);
762 762
 		$total_count = (int) (isset($count_output->count) ? $count_output->count : NULL);
763 763
 
764 764
 		$list_count = $limit->list_count->getValue();
765
-		if(!$list_count)
765
+		if (!$list_count)
766 766
 		{
767 767
 			$list_count = 20;
768 768
 		}
769 769
 		$page_count = $limit->page_count->getValue();
770
-		if(!$page_count)
770
+		if (!$page_count)
771 771
 		{
772 772
 			$page_count = 10;
773 773
 		}
774 774
 		$page = $limit->page->getValue();
775
-		if(!$page || $page < 1)
775
+		if (!$page || $page < 1)
776 776
 		{
777 777
 			$page = 1;
778 778
 		}
779 779
 
780 780
 		// total pages
781
-		if($total_count)
781
+		if ($total_count)
782 782
 		{
783 783
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
784 784
 		}
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 		}
789 789
 
790 790
 		// check the page variables
791
-		if($page > $total_page)
791
+		if ($page > $total_page)
792 792
 		{
793 793
 			// If requested page is bigger than total number of pages, return empty list
794 794
 			$buff = new BaseObject();
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 
804 804
 		$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
805 805
 
806
-		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
806
+		$query .= (__DEBUG_QUERY__ & 1 && $queryObject->query_id) ? sprintf(' '.$this->comment_syntax, $this->query_id) : '';
807 807
 		$result = $this->_query($query, $connection);
808
-		if($this->isError())
808
+		if ($this->isError())
809 809
 		{
810 810
 			return $this->queryError($queryObject);
811 811
 		}
@@ -833,44 +833,44 @@  discard block
 block discarded – undo
833 833
 	function getSelectPageSql($query, $with_values = true, $start_count = 0, $list_count = 0)
834 834
 	{
835 835
 		$select = $query->getSelectString($with_values);
836
-		if($select == '')
836
+		if ($select == '')
837 837
 		{
838 838
 			return new BaseObject(-1, "Invalid query");
839 839
 		}
840
-		$select = 'SELECT ' . $select;
840
+		$select = 'SELECT '.$select;
841 841
 
842 842
 		$from = $query->getFromString($with_values);
843
-		if($from == '')
843
+		if ($from == '')
844 844
 		{
845 845
 			return new BaseObject(-1, "Invalid query");
846 846
 		}
847
-		$from = ' FROM ' . $from;
847
+		$from = ' FROM '.$from;
848 848
 
849 849
 		$where = $query->getWhereString($with_values);
850
-		if($where != '')
850
+		if ($where != '')
851 851
 		{
852
-			$where = ' WHERE ' . $where;
852
+			$where = ' WHERE '.$where;
853 853
 		}
854 854
 
855 855
 		$groupBy = $query->getGroupByString();
856
-		if($groupBy != '')
856
+		if ($groupBy != '')
857 857
 		{
858
-			$groupBy = ' GROUP BY ' . $groupBy;
858
+			$groupBy = ' GROUP BY '.$groupBy;
859 859
 		}
860 860
 
861 861
 		$orderBy = $query->getOrderByString();
862
-		if($orderBy != '')
862
+		if ($orderBy != '')
863 863
 		{
864
-			$orderBy = ' ORDER BY ' . $orderBy;
864
+			$orderBy = ' ORDER BY '.$orderBy;
865 865
 		}
866 866
 
867 867
 		$limit = $query->getLimitString();
868
-		if($limit != '')
868
+		if ($limit != '')
869 869
 		{
870 870
 			$limit = sprintf(' LIMIT %d, %d', $start_count, $list_count);
871 871
 		}
872 872
 
873
-		return $select . ' ' . $from . ' ' . $where . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit;
873
+		return $select.' '.$from.' '.$where.' '.$groupBy.' '.$orderBy.' '.$limit;
874 874
 	}
875 875
 
876 876
 }
Please login to merge, or discard this patch.
Braces   +20 added lines, -23 removed lines patch added patch discarded remove patch
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 	function DBMysql($auto_connect = TRUE)
47 47
 	{
48 48
 		$this->_setDBInfo();
49
-		if($auto_connect) $this->_connect();
49
+		if($auto_connect) {
50
+			$this->_connect();
51
+		}
50 52
 	}
51 53
 
52 54
 	/**
@@ -214,8 +216,7 @@  discard block
 block discarded – undo
214 216
 			if($arrayIndexEndValue)
215 217
 			{
216 218
 				$output[$arrayIndexEndValue--] = $tmp;
217
-			}
218
-			else
219
+			} else
219 220
 			{
220 221
 				$output[] = $tmp;
221 222
 			}
@@ -225,8 +226,7 @@  discard block
 block discarded – undo
225 226
 			if(isset($arrayIndexEndValue))
226 227
 			{
227 228
 				return $output;
228
-			}
229
-			else
229
+			} else
230 230
 			{
231 231
 				return $output[0];
232 232
 			}
@@ -311,8 +311,7 @@  discard block
 block discarded – undo
311 311
 		if($size)
312 312
 		{
313 313
 			$query .= sprintf(" %s(%s) ", $type, $size);
314
-		}
315
-		else
314
+		} else
316 315
 		{
317 316
 			$query .= sprintf(" %s ", $type);
318 317
 		}
@@ -490,8 +489,7 @@  discard block
 block discarded – undo
490 489
 		if(!is_array($xml_obj->table->column))
491 490
 		{
492 491
 			$columns[] = $xml_obj->table->column;
493
-		}
494
-		else
492
+		} else
495 493
 		{
496 494
 			$columns = $xml_obj->table->column;
497 495
 		}
@@ -517,12 +515,10 @@  discard block
 block discarded – undo
517 515
 			if($primary_key)
518 516
 			{
519 517
 				$primary_list[] = $name;
520
-			}
521
-			else if($unique)
518
+			} else if($unique)
522 519
 			{
523 520
 				$unique_list[$unique][] = $name;
524
-			}
525
-			else if($index)
521
+			} else if($index)
526 522
 			{
527 523
 				$index_list[$index][] = $name;
528 524
 			}
@@ -552,8 +548,9 @@  discard block
 block discarded – undo
552 548
 		$schema = sprintf('create table `%s` (%s%s) %s;', $this->addQuotes($table_name), "\n", implode($column_schema, ",\n"), "ENGINE = MYISAM  CHARACTER SET utf8 COLLATE utf8_general_ci");
553 549
 
554 550
 		$output = $this->_query($schema);
555
-		if(!$output)
556
-			return false;
551
+		if(!$output) {
552
+					return false;
553
+		}
557 554
 	}
558 555
 
559 556
 	/**
@@ -584,8 +581,11 @@  discard block
 block discarded – undo
584 581
 		$query = $this->getUpdateSql($queryObject, $with_values, true);
585 582
 		if(is_a($query, 'BaseObject'))
586 583
 		{
587
-			if(!$query->toBool()) return $query;
588
-			else return;
584
+			if(!$query->toBool()) {
585
+				return $query;
586
+			} else {
587
+				return;
588
+			}
589 589
 		}
590 590
 
591 591
 		$query .= (__DEBUG_QUERY__ & 1 && $this->query_id) ? sprintf(' ' . $this->comment_syntax, $this->query_id) : '';
@@ -627,8 +627,7 @@  discard block
 block discarded – undo
627 627
 		if($limit && $limit->isPageHandler())
628 628
 		{
629 629
 			return $this->queryPageLimit($queryObject, $result, $connection, $with_values);
630
-		}
631
-		else
630
+		} else
632 631
 		{
633 632
 			$query = $this->getSelectSql($queryObject, $with_values);
634 633
 			if(is_a($query, 'BaseObject'))
@@ -717,8 +716,7 @@  discard block
 block discarded – undo
717 716
 			$buff->data = array();
718 717
 			$buff->page_navigation = new PageHandler(/* $total_count */0, /* $total_page */1, /* $page */1, /* $page_count */10); //default page handler values
719 718
 			return $buff;
720
-		}
721
-		else
719
+		} else
722 720
 		{
723 721
 			return;
724 722
 		}
@@ -781,8 +779,7 @@  discard block
 block discarded – undo
781 779
 		if($total_count)
782 780
 		{
783 781
 			$total_page = (int) (($total_count - 1) / $list_count) + 1;
784
-		}
785
-		else
782
+		} else
786 783
 		{
787 784
 			$total_page = 1;
788 785
 		}
Please login to merge, or discard this patch.
classes/object/BaseObject.class.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	/**
167 167
 	 * Method to retrieve an object containing a key/value pairs
168 168
 	 *
169
-	 * @return BaseObject Returns an object containing key/value pairs
169
+	 * @return stdClass Returns an object containing key/value pairs
170 170
 	 */
171 171
 	function gets()
172 172
 	{
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	/**
193 193
 	 * Method to retrieve an object of key/value pairs
194 194
 	 *
195
-	 * @return BaseObject
195
+	 * @return stdClass
196 196
 	 */
197 197
 	function getObjectVars()
198 198
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@
 block discarded – undo
99 99
 		if($str = Context::getLang($message))
100 100
 		{
101 101
 			$this->message = $str;
102
-		}
103
-		else
102
+		} else
104 103
 		{
105 104
 			$this->message = $message;
106 105
 		}
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	function setMessage($message = 'success', $type = NULL)
97 97
 	{
98
-		if($str = Context::getLang($message))
98
+		if ($str = Context::getLang($message))
99 99
 		{
100 100
 			$this->message = $str;
101 101
 		}
@@ -138,14 +138,14 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	function adds($object)
140 140
 	{
141
-		if(is_object($object))
141
+		if (is_object($object))
142 142
 		{
143 143
 			$object = get_object_vars($object);
144 144
 		}
145 145
 
146
-		if(is_array($object))
146
+		if (is_array($object))
147 147
 		{
148
-			foreach($object as $key => $val)
148
+			foreach ($object as $key => $val)
149 149
 			{
150 150
 				$this->variables[$key] = $val;
151 151
 			}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	{
173 173
 		$args = func_get_args();
174 174
 		$output = new stdClass();
175
-		foreach($args as $arg)
175
+		foreach ($args as $arg)
176 176
 		{
177 177
 			$output->{$arg} = $this->get($arg);
178 178
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	function getObjectVars()
198 198
 	{
199 199
 		$output = new stdClass();
200
-		foreach($this->variables as $key => $val)
200
+		foreach ($this->variables as $key => $val)
201 201
 		{
202 202
 			$output->{$key} = $val;
203 203
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	}
227 227
 }
228 228
 
229
-if(version_compare(PHP_VERSION, '7.2', '<') && !class_exists('Object', false))
229
+if (version_compare(PHP_VERSION, '7.2', '<') && !class_exists('Object', false))
230 230
 {
231 231
 	class_alias('BaseObject', 'Object');
232 232
 }
Please login to merge, or discard this patch.
modules/admin/admin.admin.controller.php 3 patches
Doc Comments   +11 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 	/**
15 15
 	 * initialization
16
-	 * @return void
16
+	 * @return ModuleObject|null
17 17
 	 */
18 18
 	function init()
19 19
 	{
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	/**
54 54
 	 * Regenerate all cache files
55
-	 * @return void
55
+	 * @return BaseObject|null
56 56
 	 */
57 57
 	function procAdminRecompileCacheFile()
58 58
 	{
@@ -156,6 +156,9 @@  discard block
 block discarded – undo
156 156
 		return $this->setRedirectUrl(Context::get('error_return_url'), $output);
157 157
 	}
158 158
 
159
+	/**
160
+	 * @param BaseObject $vars
161
+	 */
159 162
 	public function updateDefaultDesignInfo($vars)
160 163
 	{
161 164
 		$siteDesignPath = _XE_PATH_ . 'files/site_design/';
@@ -207,6 +210,9 @@  discard block
 block discarded – undo
207 210
 		return new BaseObject();
208 211
 	}
209 212
 
213
+	/**
214
+	 * @param stdClass $designInfo
215
+	 */
210 216
 	function makeDefaultDesignFile($designInfo, $site_srl = 0)
211 217
 	{
212 218
 		$buff = array();
@@ -433,6 +439,8 @@  discard block
 block discarded – undo
433 439
 
434 440
 	/**
435 441
 	 * Insert favorite
442
+	 * @param string $siteSrl
443
+	 * @param string $module
436 444
 	 * @return object query result
437 445
 	 */
438 446
 	function _insertFavorite($siteSrl, $module, $type = 'module')
@@ -471,7 +479,7 @@  discard block
 block discarded – undo
471 479
 
472 480
 	/**
473 481
 	 * Remove admin icon
474
-	 * @return object|void
482
+	 * @return BaseObject|null
475 483
 	 */
476 484
 	function procAdminRemoveIcons()
477 485
 	{
Please login to merge, or discard this patch.
Braces   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -181,8 +181,7 @@  discard block
 block discarded – undo
181 181
 		if(is_readable($siteDesignFile))
182 182
 		{
183 183
 			include($siteDesignFile);
184
-		}
185
-		else
184
+		} else
186 185
 		{
187 186
 			$designInfo = new stdClass();
188 187
 		}
@@ -198,7 +197,9 @@  discard block
 block discarded – undo
198 197
 				$moduleName = 'page';
199 198
 			}
200 199
 
201
-			if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
200
+			if(!isset($designInfo->module->{$moduleName})) {
201
+				$designInfo->module->{$moduleName} = new stdClass();
202
+			}
202 203
 			$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
203 204
 		}
204 205
 
@@ -337,8 +338,7 @@  discard block
 block discarded – undo
337 338
 		if($isAgree == 'true')
338 339
 		{
339 340
 			$_SESSION['enviroment_gather'] = 'Y';
340
-		}
341
-		else
341
+		} else
342 342
 		{
343 343
 			$_SESSION['enviroment_gather'] = 'N';
344 344
 		}
@@ -374,12 +374,10 @@  discard block
 block discarded – undo
374 374
 			if($type == 3)
375 375
 			{
376 376
 				$ext = 'png';
377
-			}
378
-			elseif($type == 2)
377
+			} elseif($type == 2)
379 378
 			{
380 379
 				$ext = 'jpg';
381
-			}
382
-			else
380
+			} else
383 381
 			{
384 382
 				$ext = 'gif';
385 383
 			}
@@ -392,8 +390,7 @@  discard block
 block discarded – undo
392 390
 		if($adminTitle)
393 391
 		{
394 392
 			$oAdminConfig->adminTitle = strip_tags($adminTitle);
395
-		}
396
-		else
393
+		} else
397 394
 		{
398 395
 			unset($oAdminConfig->adminTitle);
399 396
 		}
@@ -488,8 +485,7 @@  discard block
 block discarded – undo
488 485
 		if($file_exist)
489 486
 		{
490 487
 			@FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
491
-		}
492
-		else
488
+		} else
493 489
 		{
494 490
 			return new BaseObject(-1, 'fail_to_delete');
495 491
 		}
@@ -533,7 +529,9 @@  discard block
 block discarded – undo
533 529
 		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
534 530
 		{
535 531
 			$returnUrl = Context::get('success_return_url');
536
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
532
+			if(!$returnUrl) {
533
+				$returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
534
+			}
537 535
 			header('location:' . $returnUrl);
538 536
 			return;
539 537
 		}
@@ -577,7 +575,9 @@  discard block
 block discarded – undo
577 575
 		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
578 576
 		{
579 577
 			$returnUrl = Context::get('success_return_url');
580
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
578
+			if(!$returnUrl) {
579
+				$returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
580
+			}
581 581
 			header('location:' . $returnUrl);
582 582
 			return;
583 583
 		}
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		// forbit access if the user is not an administrator
21 21
 		$oMemberModel = getModel('member');
22 22
 		$logged_info = $oMemberModel->getLoggedInfo();
23
-		if($logged_info->is_admin != 'Y')
23
+		if ($logged_info->is_admin != 'Y')
24 24
 		{
25 25
 			return $this->stop("msg_is_not_administrator");
26 26
 		}
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 	function procAdminMenuReset()
34 34
 	{
35 35
 		$menuSrl = Context::get('menu_srl');
36
-		if(!$menuSrl)
36
+		if (!$menuSrl)
37 37
 		{
38 38
 			return $this->stop('msg_invalid_request');
39 39
 		}
40 40
 
41 41
 		$oMenuAdminController = getAdminController('menu');
42 42
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
43
-		if($oCacheHandler->isSupport())
43
+		if ($oCacheHandler->isSupport())
44 44
 		{
45
-			$cache_key = 'admin_menu_langs:' . Context::getLangType();
45
+			$cache_key = 'admin_menu_langs:'.Context::getLangType();
46 46
 			$oCacheHandler->delete($cache_key);
47 47
 		}
48 48
 		$output = $oMenuAdminController->deleteMenu($menuSrl);
49
-		if(!$output->toBool())
49
+		if (!$output->toBool())
50 50
 		{
51 51
 			return $output;
52 52
 		}
@@ -63,30 +63,30 @@  discard block
 block discarded – undo
63 63
 	function procAdminRecompileCacheFile()
64 64
 	{
65 65
 		// rename cache dir
66
-		$temp_cache_dir = './files/cache_' . $_SERVER['REQUEST_TIME'];
66
+		$temp_cache_dir = './files/cache_'.$_SERVER['REQUEST_TIME'];
67 67
 		FileHandler::rename('./files/cache', $temp_cache_dir);
68 68
 		FileHandler::makeDir('./files/cache');
69 69
 
70 70
 		// remove module extend cache
71
-		FileHandler::removeFile(_XE_PATH_ . 'files/config/module_extend.php');
71
+		FileHandler::removeFile(_XE_PATH_.'files/config/module_extend.php');
72 72
 
73 73
 		// remove debug files
74
-		FileHandler::removeFile(_XE_PATH_ . 'files/_debug_message.php');
75
-		FileHandler::removeFile(_XE_PATH_ . 'files/_debug_db_query.php');
76
-		FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_query.php');
77
-		FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_trigger.php');
78
-		FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_addon.php');
79
-		FileHandler::removeFile(_XE_PATH_ . 'files/_slowlog_widget.php');
74
+		FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php');
75
+		FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php');
76
+		FileHandler::removeFile(_XE_PATH_.'files/_slowlog_query.php');
77
+		FileHandler::removeFile(_XE_PATH_.'files/_slowlog_trigger.php');
78
+		FileHandler::removeFile(_XE_PATH_.'files/_slowlog_addon.php');
79
+		FileHandler::removeFile(_XE_PATH_.'files/_slowlog_widget.php');
80 80
 
81 81
 		$oModuleModel = getModel('module');
82 82
 		$module_list = $oModuleModel->getModuleList();
83 83
 
84 84
 		// call recompileCache for each module
85
-		foreach($module_list as $module)
85
+		foreach ($module_list as $module)
86 86
 		{
87 87
 			$oModule = NULL;
88 88
 			$oModule = getClass($module->module);
89
-			if(method_exists($oModule, 'recompileCache'))
89
+			if (method_exists($oModule, 'recompileCache'))
90 90
 			{
91 91
 				$oModule->recompileCache();
92 92
 			}
@@ -97,37 +97,37 @@  discard block
 block discarded – undo
97 97
 		$oObjectCacheHandler = CacheHandler::getInstance('object');
98 98
 		$oTemplateCacheHandler = CacheHandler::getInstance('template');
99 99
 
100
-		if($oObjectCacheHandler->isSupport())
100
+		if ($oObjectCacheHandler->isSupport())
101 101
 		{
102 102
 			$truncated[] = $oObjectCacheHandler->truncate();
103 103
 		}
104 104
 
105
-		if($oTemplateCacheHandler->isSupport())
105
+		if ($oTemplateCacheHandler->isSupport())
106 106
 		{
107 107
 			$truncated[] = $oTemplateCacheHandler->truncate();
108 108
 		}
109 109
 
110
-		if(count($truncated) && in_array(FALSE, $truncated))
110
+		if (count($truncated) && in_array(FALSE, $truncated))
111 111
 		{
112 112
 			return new BaseObject(-1, 'msg_self_restart_cache_engine');
113 113
 		}
114 114
 
115 115
 		// remove cache dir
116 116
 		$tmp_cache_list = FileHandler::readDir('./files', '/(^cache_[0-9]+)/');
117
-		if($tmp_cache_list)
117
+		if ($tmp_cache_list)
118 118
 		{
119
-			foreach($tmp_cache_list as $tmp_dir)
119
+			foreach ($tmp_cache_list as $tmp_dir)
120 120
 			{
121
-				if($tmp_dir)
121
+				if ($tmp_dir)
122 122
 				{
123
-					FileHandler::removeDir('./files/' . $tmp_dir);
123
+					FileHandler::removeDir('./files/'.$tmp_dir);
124 124
 				}
125 125
 			}
126 126
 		}
127 127
 
128 128
 		// remove duplicate indexes (only for CUBRID)
129 129
 		$db_type = Context::getDBType();
130
-		if($db_type == 'cubrid')
130
+		if ($db_type == 'cubrid')
131 131
 		{
132 132
 			$db = DB::getInstance();
133 133
 			$db->deleteDuplicateIndexes();
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 		$oMemberController = getController('member');
150 150
 		$oMemberController->procMemberLogout();
151 151
 
152
-		header('Location: ' . getNotEncodedUrl('', 'module', 'admin'));
152
+		header('Location: '.getNotEncodedUrl('', 'module', 'admin'));
153 153
 	}
154 154
 
155 155
 	public function procAdminInsertDefaultDesignInfo()
156 156
 	{
157 157
 		$vars = Context::getRequestVars();
158
-		if(!$vars->site_srl)
158
+		if (!$vars->site_srl)
159 159
 		{
160 160
 			$vars->site_srl = 0;
161 161
 		}
@@ -167,27 +167,27 @@  discard block
 block discarded – undo
167 167
 
168 168
 	public function updateDefaultDesignInfo($vars)
169 169
 	{
170
-		$siteDesignPath = _XE_PATH_ . 'files/site_design/';
170
+		$siteDesignPath = _XE_PATH_.'files/site_design/';
171 171
 
172 172
 		$vars->module_skin = json_decode($vars->module_skin);
173 173
 
174
-		if(!is_dir($siteDesignPath))
174
+		if (!is_dir($siteDesignPath))
175 175
 		{
176 176
 			FileHandler::makeDir($siteDesignPath);
177 177
 		}
178 178
 
179
-		$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $vars->site_srl . '.php';
179
+		$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$vars->site_srl.'.php';
180 180
 
181 181
 		$layoutTarget = 'layout_srl';
182 182
 		$skinTarget = 'skin';
183 183
 
184
-		if($vars->target_type == 'M')
184
+		if ($vars->target_type == 'M')
185 185
 		{
186 186
 			$layoutTarget = 'mlayout_srl';
187 187
 			$skinTarget = 'mskin';
188 188
 		}
189 189
 
190
-		if(is_readable($siteDesignFile))
190
+		if (is_readable($siteDesignFile))
191 191
 		{
192 192
 			include($siteDesignFile);
193 193
 		}
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 
201 201
 		$designInfo->{$layoutTarget} = $layoutSrl;
202 202
 
203
-		foreach($vars->module_skin as $moduleName => $skinName)
203
+		foreach ($vars->module_skin as $moduleName => $skinName)
204 204
 		{
205
-			if($moduleName == 'ARTICLE')
205
+			if ($moduleName == 'ARTICLE')
206 206
 			{
207 207
 				$moduleName = 'page';
208 208
 			}
209 209
 
210
-			if(!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
210
+			if (!isset($designInfo->module->{$moduleName})) $designInfo->module->{$moduleName} = new stdClass();
211 211
 			$designInfo->module->{$moduleName}->{$skinTarget} = $skinName;
212 212
 		}
213 213
 
@@ -222,28 +222,28 @@  discard block
 block discarded – undo
222 222
 		$buff[] = '<?php if(!defined("__XE__")) exit();';
223 223
 		$buff[] = '$designInfo = new stdClass;';
224 224
 
225
-		if($designInfo->layout_srl)
225
+		if ($designInfo->layout_srl)
226 226
 		{
227 227
 			$buff[] = sprintf('$designInfo->layout_srl = %s; ', $designInfo->layout_srl);
228 228
 		}
229 229
 
230
-		if($designInfo->mlayout_srl)
230
+		if ($designInfo->mlayout_srl)
231 231
 		{
232 232
 			$buff[] = sprintf('$designInfo->mlayout_srl = %s;', $designInfo->mlayout_srl);
233 233
 		}
234 234
 
235 235
 		$buff[] = '$designInfo->module = new stdClass;';
236 236
 
237
-		foreach($designInfo->module as $moduleName => $skinInfo)
237
+		foreach ($designInfo->module as $moduleName => $skinInfo)
238 238
 		{
239 239
 			$buff[] = sprintf('$designInfo->module->%s = new stdClass;', $moduleName);
240
-			foreach($skinInfo as $target => $skinName)
240
+			foreach ($skinInfo as $target => $skinName)
241 241
 			{
242 242
 				$buff[] = sprintf('$designInfo->module->%s->%s = \'%s\';', $moduleName, $target, $skinName);
243 243
 			}
244 244
 		}
245 245
 
246
-		$siteDesignFile = _XE_PATH_ . 'files/site_design/design_' . $site_srl . '.php';
246
+		$siteDesignFile = _XE_PATH_.'files/site_design/design_'.$site_srl.'.php';
247 247
 		FileHandler::writeFile($siteDesignFile, implode(PHP_EOL, $buff));
248 248
 	}
249 249
 
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 		// check favorite exists
260 260
 		$oModel = getAdminModel('admin');
261 261
 		$output = $oModel->isExistsFavorite($siteSrl, $moduleName);
262
-		if(!$output->toBool())
262
+		if (!$output->toBool())
263 263
 		{
264 264
 			return $output;
265 265
 		}
266 266
 
267 267
 		// if exists, delete favorite
268
-		if($output->get('result'))
268
+		if ($output->get('result'))
269 269
 		{
270 270
 			$favoriteSrl = $output->get('favoriteSrl');
271 271
 			$output = $this->_deleteFavorite($favoriteSrl);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			$result = 'on';
279 279
 		}
280 280
 
281
-		if(!$output->toBool())
281
+		if (!$output->toBool())
282 282
 		{
283 283
 			return $output;
284 284
 		}
@@ -296,31 +296,31 @@  discard block
 block discarded – undo
296 296
 	{
297 297
 		$oModel = getAdminModel('admin');
298 298
 		$output = $oModel->getFavoriteList();
299
-		if(!$output->toBool())
299
+		if (!$output->toBool())
300 300
 		{
301 301
 			return $output;
302 302
 		}
303 303
 
304 304
 		$favoriteList = $output->get('favoriteList');
305
-		if(!$favoriteList)
305
+		if (!$favoriteList)
306 306
 		{
307 307
 			return new BaseObject();
308 308
 		}
309 309
 
310 310
 		$deleteTargets = array();
311
-		foreach($favoriteList as $favorite)
311
+		foreach ($favoriteList as $favorite)
312 312
 		{
313
-			if($favorite->type == 'module')
313
+			if ($favorite->type == 'module')
314 314
 			{
315
-				$modulePath = _XE_PATH_ . 'modules/' . $favorite->module;
316
-				if(!is_dir($modulePath))
315
+				$modulePath = _XE_PATH_.'modules/'.$favorite->module;
316
+				if (!is_dir($modulePath))
317 317
 				{
318 318
 					$deleteTargets[] = $favorite->admin_favorite_srl;
319 319
 				}
320 320
 			}
321 321
 		}
322 322
 
323
-		if(!count($deleteTargets))
323
+		if (!count($deleteTargets))
324 324
 		{
325 325
 			return new BaseObject();
326 326
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		$args = new stdClass();
329 329
 		$args->admin_favorite_srls = $deleteTargets;
330 330
 		$output = executeQuery('admin.deleteFavorites', $args);
331
-		if(!$output->toBool())
331
+		if (!$output->toBool())
332 332
 		{
333 333
 			return $output;
334 334
 		}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	function procAdminEnviromentGatheringAgreement()
344 344
 	{
345 345
 		$isAgree = Context::get('is_agree');
346
-		if($isAgree == 'true')
346
+		if ($isAgree == 'true')
347 347
 		{
348 348
 			$_SESSION['enviroment_gather'] = 'Y';
349 349
 		}
@@ -368,23 +368,23 @@  discard block
 block discarded – undo
368 368
 		$oModuleModel = getModel('module');
369 369
 		$oAdminConfig = $oModuleModel->getModuleConfig('admin');
370 370
 
371
-		if(!is_object($oAdminConfig))
371
+		if (!is_object($oAdminConfig))
372 372
 		{
373 373
 			$oAdminConfig = new stdClass();
374 374
 		}
375 375
 
376
-		if($file['tmp_name'])
376
+		if ($file['tmp_name'])
377 377
 		{
378 378
 			$target_path = 'files/attach/images/admin/';
379 379
 			FileHandler::makeDir($target_path);
380 380
 
381 381
 			// Get file information
382 382
 			list($width, $height, $type, $attrs) = @getimagesize($file['tmp_name']);
383
-			if($type == 3)
383
+			if ($type == 3)
384 384
 			{
385 385
 				$ext = 'png';
386 386
 			}
387
-			elseif($type == 2)
387
+			elseif ($type == 2)
388 388
 			{
389 389
 				$ext = 'jpg';
390 390
 			}
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
 			$oAdminConfig->adminLogo = $target_filename;
400 400
 		}
401
-		if($adminTitle)
401
+		if ($adminTitle)
402 402
 		{
403 403
 			$oAdminConfig->adminTitle = strip_tags($adminTitle);
404 404
 		}
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 			unset($oAdminConfig->adminTitle);
408 408
 		}
409 409
 
410
-		if($oAdminConfig)
410
+		if ($oAdminConfig)
411 411
 		{
412 412
 			$oModuleController = getController('module');
413 413
 			$oModuleController->insertModuleConfig('admin', $oAdminConfig);
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 		$oModuleModel = getModel('module');
429 429
 		$oAdminConfig = $oModuleModel->getModuleConfig('admin');
430 430
 
431
-		FileHandler::removeFile(_XE_PATH_ . $oAdminConfig->adminLogo);
431
+		FileHandler::removeFile(_XE_PATH_.$oAdminConfig->adminLogo);
432 432
 		unset($oAdminConfig->adminLogo);
433 433
 
434 434
 		$oModuleController = getController('module');
@@ -487,16 +487,16 @@  discard block
 block discarded – undo
487 487
 
488 488
 		$site_info = Context::get('site_module_info');
489 489
 		$virtual_site = '';
490
-		if($site_info->site_srl) 
490
+		if ($site_info->site_srl) 
491 491
 		{
492
-			$virtual_site = $site_info->site_srl . '/';
492
+			$virtual_site = $site_info->site_srl.'/';
493 493
 		}
494 494
 
495 495
 		$iconname = Context::get('iconname');
496
-		$file_exist = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
497
-		if($file_exist)
496
+		$file_exist = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
497
+		if ($file_exist)
498 498
 		{
499
-			@FileHandler::removeFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname);
499
+			@FileHandler::removeFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname);
500 500
 		}
501 501
 		else
502 502
 		{
@@ -517,33 +517,33 @@  discard block
 block discarded – undo
517 517
 		$db_info->sitelock_message = $vars->sitelock_message;
518 518
 
519 519
 		$whitelist = $vars->sitelock_whitelist;
520
-		$whitelist = preg_replace("/[\r|\n|\r\n]+/",",",$whitelist);
521
-		$whitelist = preg_replace("/\s+/","",$whitelist);
522
-		if(preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
520
+		$whitelist = preg_replace("/[\r|\n|\r\n]+/", ",", $whitelist);
521
+		$whitelist = preg_replace("/\s+/", "", $whitelist);
522
+		if (preg_match('/(<\?|<\?php|\?>)/xsm', $whitelist))
523 523
 		{
524 524
 			$whitelist = '';
525 525
 		}
526
-		$whitelist .= ',127.0.0.1,' . $_SERVER['REMOTE_ADDR'];
527
-		$whitelist = explode(',',trim($whitelist, ','));
526
+		$whitelist .= ',127.0.0.1,'.$_SERVER['REMOTE_ADDR'];
527
+		$whitelist = explode(',', trim($whitelist, ','));
528 528
 		$whitelist = array_unique($whitelist);
529 529
 
530
-		if(!IpFilter::validate($whitelist)) {
530
+		if (!IpFilter::validate($whitelist)) {
531 531
 			return new BaseObject(-1, 'msg_invalid_ip');
532 532
 		}
533 533
 
534 534
 		$db_info->sitelock_whitelist = $whitelist;
535 535
 
536 536
 		$oInstallController = getController('install');
537
-		if(!$oInstallController->makeConfigFile())
537
+		if (!$oInstallController->makeConfigFile())
538 538
 		{
539 539
 			return new BaseObject(-1, 'msg_invalid_request');
540 540
 		}
541 541
 
542
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
542
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
543 543
 		{
544 544
 			$returnUrl = Context::get('success_return_url');
545
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
546
-			header('location:' . $returnUrl);
545
+			if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
546
+			header('location:'.$returnUrl);
547 547
 			return;
548 548
 		}
549 549
 	}
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
 		$db_info->embed_white_iframe = $white_iframe;
575 575
 
576 576
 		$oInstallController = getController('install');
577
-		if(!$oInstallController->makeConfigFile())
577
+		if (!$oInstallController->makeConfigFile())
578 578
 		{
579 579
 			return new BaseObject(-1, 'msg_invalid_request');
580 580
 		}
581 581
 
582
-		require_once(_XE_PATH_ . 'classes/security/EmbedFilter.class.php');
582
+		require_once(_XE_PATH_.'classes/security/EmbedFilter.class.php');
583 583
 		$oEmbedFilter = EmbedFilter::getInstance();
584 584
 		$oEmbedFilter->_makeWhiteDomainList($whitelist);
585 585
 
586
-		if(!in_array(Context::getRequestMethod(), array('XMLRPC','JSON')))
586
+		if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON')))
587 587
 		{
588 588
 			$returnUrl = Context::get('success_return_url');
589
-			if(!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
590
-			header('location:' . $returnUrl);
589
+			if (!$returnUrl) $returnUrl = getNotEncodedUrl('', 'act', 'dispAdminConfigGeneral');
590
+			header('location:'.$returnUrl);
591 591
 			return;
592 592
 		}
593 593
 	}
Please login to merge, or discard this patch.