GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — develop (#1814)
by
unknown
13:24 queued 02:11
created
modules/module/module.model.php 1 patch
Braces   +457 added lines, -203 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
 			$url_info = parse_url($request_url);
101 113
 			$hostname = $url_info['host'];
102 114
 			$path = $url_info['path'];
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, $url_info['port']&&$url_info['port']!=80?':'.$url_info['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();
@@ -1007,7 +1118,9 @@  discard block
 block discarded – undo
1007 1118
 			return $info;
1008 1119
 		}
1009 1120
 
1010
-		if(file_exists($cache_file)) return include($cache_file);
1121
+		if(file_exists($cache_file)) {
1122
+			return include($cache_file);
1123
+		}
1011 1124
 	}
1012 1125
 
1013 1126
 	/**
@@ -1045,7 +1158,9 @@  discard block
 block discarded – undo
1045 1158
 
1046 1159
 		$skin_path = sprintf("%s/%s/", $path, $dir);
1047 1160
 		$list = FileHandler::readDir($skin_path);
1048
-		if(!count($list)) return;
1161
+		if(!count($list)) {
1162
+			return;
1163
+		}
1049 1164
 
1050 1165
 		natcasesort($list);
1051 1166
 
@@ -1099,8 +1214,7 @@  discard block
 block discarded – undo
1099 1214
 			if($dir == 'skins')
1100 1215
 			{
1101 1216
 				$type = 'P';
1102
-			}
1103
-			else
1217
+			} else
1104 1218
 			{
1105 1219
 				$type = 'M';
1106 1220
 			}
@@ -1128,14 +1242,20 @@  discard block
 block discarded – undo
1128 1242
 	function loadSkinInfo($path, $skin, $dir = 'skins')
1129 1243
 	{
1130 1244
 		// Read xml file having skin information
1131
-		if(substr($path,-1)!='/') $path .= '/';
1245
+		if(substr($path,-1)!='/') {
1246
+			$path .= '/';
1247
+		}
1132 1248
 		$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
1133
-		if(!file_exists($skin_xml_file)) return;
1249
+		if(!file_exists($skin_xml_file)) {
1250
+			return;
1251
+		}
1134 1252
 		// Create XmlParser object
1135 1253
 		$oXmlParser = new XmlParser();
1136 1254
 		$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
1137 1255
 		// Return if no skin information is
1138
-		if(!$_xml_obj->skin) return;
1256
+		if(!$_xml_obj->skin) {
1257
+			return;
1258
+		}
1139 1259
 		$xml_obj = $_xml_obj->skin;
1140 1260
 		// Skin Name
1141 1261
 		$skin_info = new stdClass();
@@ -1152,8 +1272,11 @@  discard block
 block discarded – undo
1152 1272
 			$skin_info->license_link = $xml_obj->license->attrs->link;
1153 1273
 			$skin_info->description = $xml_obj->description->body;
1154 1274
 
1155
-			if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
1156
-			else $author_list = $xml_obj->author;
1275
+			if(!is_array($xml_obj->author)) {
1276
+				$author_list[] = $xml_obj->author;
1277
+			} else {
1278
+				$author_list = $xml_obj->author;
1279
+			}
1157 1280
 
1158 1281
 			foreach($author_list as $author)
1159 1282
 			{
@@ -1167,8 +1290,12 @@  discard block
 block discarded – undo
1167 1290
 			if($xml_obj->extra_vars)
1168 1291
 			{
1169 1292
 				$extra_var_groups = $xml_obj->extra_vars->group;
1170
-				if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1171
-				if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1293
+				if(!$extra_var_groups) {
1294
+					$extra_var_groups = $xml_obj->extra_vars;
1295
+				}
1296
+				if(!is_array($extra_var_groups)) {
1297
+					$extra_var_groups = array($extra_var_groups);
1298
+				}
1172 1299
 
1173 1300
 				foreach($extra_var_groups as $group)
1174 1301
 				{
@@ -1177,7 +1304,9 @@  discard block
 block discarded – undo
1177 1304
 					{
1178 1305
 						continue;
1179 1306
 					}
1180
-					if(!is_array($group->var)) $extra_vars = array($group->var);
1307
+					if(!is_array($group->var)) {
1308
+						$extra_vars = array($group->var);
1309
+					}
1181 1310
 
1182 1311
 					foreach($extra_vars as $key => $val)
1183 1312
 					{
@@ -1204,8 +1333,7 @@  discard block
 block discarded – undo
1204 1333
 								$obj->options[$i]->title = $val->options[$i]->title->body;
1205 1334
 								$obj->options[$i]->value = $val->options[$i]->attrs->value;
1206 1335
 							}
1207
-						}
1208
-						else
1336
+						} else
1209 1337
 						{
1210 1338
 							$obj->options[0] = new stdClass();
1211 1339
 							$obj->options[0]->title = $val->options->title->body;
@@ -1216,8 +1344,7 @@  discard block
 block discarded – undo
1216 1344
 					}
1217 1345
 				}
1218 1346
 			}
1219
-		}
1220
-		else
1347
+		} else
1221 1348
 		{
1222 1349
 			// skin format v0.1
1223 1350
 			sscanf($xml_obj->maker->attrs->date, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@@ -1235,8 +1362,12 @@  discard block
 block discarded – undo
1235 1362
 			$skin_info->author[0]->homepage = $xml_obj->maker->attrs->link;
1236 1363
 			// Variables used in the skin
1237 1364
 			$extra_var_groups = $xml_obj->extra_vars->group;
1238
-			if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
1239
-			if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
1365
+			if(!$extra_var_groups) {
1366
+				$extra_var_groups = $xml_obj->extra_vars;
1367
+			}
1368
+			if(!is_array($extra_var_groups)) {
1369
+				$extra_var_groups = array($extra_var_groups);
1370
+			}
1240 1371
 
1241 1372
 			foreach($extra_var_groups as $group)
1242 1373
 			{
@@ -1244,7 +1375,9 @@  discard block
 block discarded – undo
1244 1375
 
1245 1376
 				if($extra_vars)
1246 1377
 				{
1247
-					if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
1378
+					if(!is_array($extra_vars)) {
1379
+						$extra_vars = array($extra_vars);
1380
+					}
1248 1381
 
1249 1382
 					foreach($extra_vars as $var)
1250 1383
 					{
@@ -1266,8 +1399,7 @@  discard block
 block discarded – undo
1266 1399
 								$options[$i]->title = $var->default[$i]->body;
1267 1400
 								$options[$i]->value = $var->default[$i]->body;
1268 1401
 							}
1269
-						}
1270
-						else
1402
+						} else
1271 1403
 						{
1272 1404
 							$options[0]->title = $var->default->body;
1273 1405
 							$options[0]->value = $var->default->body;
@@ -1297,7 +1429,9 @@  discard block
 block discarded – undo
1297 1429
 		$colorset = $xml_obj->colorset->color;
1298 1430
 		if($colorset)
1299 1431
 		{
1300
-			if(!is_array($colorset)) $colorset = array($colorset);
1432
+			if(!is_array($colorset)) {
1433
+				$colorset = array($colorset);
1434
+			}
1301 1435
 
1302 1436
 			foreach($colorset as $color)
1303 1437
 			{
@@ -1307,9 +1441,12 @@  discard block
 block discarded – undo
1307 1441
 				if($screenshot)
1308 1442
 				{
1309 1443
 					$screenshot = sprintf("%s%s/%s/%s", $path, $dir, $skin, $screenshot);
1310
-					if(!file_exists($screenshot)) $screenshot = "";
1444
+					if(!file_exists($screenshot)) {
1445
+						$screenshot = "";
1446
+					}
1447
+				} else {
1448
+					$screenshot = "";
1311 1449
 				}
1312
-				else $screenshot = "";
1313 1450
 
1314 1451
 				$obj = new stdClass();
1315 1452
 				$obj->name = $name;
@@ -1322,7 +1459,9 @@  discard block
 block discarded – undo
1322 1459
 		if($xml_obj->menus->menu)
1323 1460
 		{
1324 1461
 			$menus = $xml_obj->menus->menu;
1325
-			if(!is_array($menus)) $menus = array($menus);
1462
+			if(!is_array($menus)) {
1463
+				$menus = array($menus);
1464
+			}
1326 1465
 
1327 1466
 			$menu_count = count($menus);
1328 1467
 			$skin_info->menu_count = $menu_count;
@@ -1331,7 +1470,9 @@  discard block
 block discarded – undo
1331 1470
 				unset($obj);
1332 1471
 
1333 1472
 				$obj->name = $menus[$i]->attrs->name;
1334
-				if($menus[$i]->attrs->default == "true") $obj->default = true;
1473
+				if($menus[$i]->attrs->default == "true") {
1474
+					$obj->default = true;
1475
+				}
1335 1476
 				$obj->title = $menus[$i]->title->body;
1336 1477
 				$obj->maxdepth = $menus[$i]->maxdepth->body;
1337 1478
 
@@ -1351,7 +1492,9 @@  discard block
 block discarded – undo
1351 1492
 	{
1352 1493
 		$args = new stdClass;
1353 1494
 		$args->site_srl = $site_srl;
1354
-		if(!is_null($module)) $args->module = $module;
1495
+		if(!is_null($module)) {
1496
+			$args->module = $module;
1497
+		}
1355 1498
 		$output = executeQuery('module.getModuleCount', $args);
1356 1499
 		return $output->data->count;
1357 1500
 	}
@@ -1380,8 +1523,11 @@  discard block
 block discarded – undo
1380 1523
 				$args->module = $module;
1381 1524
 				$args->site_srl = $site_srl;
1382 1525
 				$output = executeQuery('module.getModuleConfig', $args);
1383
-				if($output->data->config) $config = unserialize($output->data->config);
1384
-				else $config = new stdClass();
1526
+				if($output->data->config) {
1527
+					$config = unserialize($output->data->config);
1528
+				} else {
1529
+					$config = new stdClass();
1530
+				}
1385 1531
 
1386 1532
 				//insert in cache
1387 1533
 				if($oCacheHandler->isSupport())
@@ -1420,8 +1566,11 @@  discard block
 block discarded – undo
1420 1566
 				$args->module = $module;
1421 1567
 				$args->module_srl = $module_srl;
1422 1568
 				$output = executeQuery('module.getModulePartConfig', $args);
1423
-				if($output->data->config) $config = unserialize($output->data->config);
1424
-				else $config = null;
1569
+				if($output->data->config) {
1570
+					$config = unserialize($output->data->config);
1571
+				} else {
1572
+					$config = null;
1573
+				}
1425 1574
 
1426 1575
 				//insert in cache
1427 1576
 				if($oCacheHandler->isSupport())
@@ -1443,9 +1592,13 @@  discard block
 block discarded – undo
1443 1592
 	{
1444 1593
 		$args = new stdClass();
1445 1594
 		$args->module = $module;
1446
-		if($site_srl) $args->site_srl = $site_srl;
1595
+		if($site_srl) {
1596
+			$args->site_srl = $site_srl;
1597
+		}
1447 1598
 		$output = executeQueryArray('module.getModulePartConfigs', $args);
1448
-		if(!$output->toBool() || !$output->data) return array();
1599
+		if(!$output->toBool() || !$output->data) {
1600
+			return array();
1601
+		}
1449 1602
 
1450 1603
 		foreach($output->data as $key => $val)
1451 1604
 		{
@@ -1463,10 +1616,16 @@  discard block
 block discarded – undo
1463 1616
 		$args->moduleCategorySrl = $moduleCategorySrl;
1464 1617
 		// Get data from the DB
1465 1618
 		$output = executeQuery('module.getModuleCategories', $args);
1466
-		if(!$output->toBool()) return $output;
1619
+		if(!$output->toBool()) {
1620
+			return $output;
1621
+		}
1467 1622
 		$list = $output->data;
1468
-		if(!$list) return;
1469
-		if(!is_array($list)) $list = array($list);
1623
+		if(!$list) {
1624
+			return;
1625
+		}
1626
+		if(!is_array($list)) {
1627
+			$list = array($list);
1628
+		}
1470 1629
 
1471 1630
 		foreach($list as $val)
1472 1631
 		{
@@ -1484,7 +1643,9 @@  discard block
 block discarded – undo
1484 1643
 		$args = new stdClass;
1485 1644
 		$args->module_category_srl = $module_category_srl;
1486 1645
 		$output = executeQuery('module.getModuleCategory', $args);
1487
-		if(!$output->toBool()) return $output;
1646
+		if(!$output->toBool()) {
1647
+			return $output;
1648
+		}
1488 1649
 		return $output->data;
1489 1650
 	}
1490 1651
 
@@ -1496,7 +1657,9 @@  discard block
 block discarded – undo
1496 1657
 		// Get a list of downloaded and installed modules
1497 1658
 		$searched_list = FileHandler::readDir('./modules');
1498 1659
 		$searched_count = count($searched_list);
1499
-		if(!$searched_count) return;
1660
+		if(!$searched_count) {
1661
+			return;
1662
+		}
1500 1663
 		sort($searched_list);
1501 1664
 
1502 1665
 		for($i=0;$i<$searched_count;$i++)
@@ -1509,7 +1672,9 @@  discard block
 block discarded – undo
1509 1672
 			$info = $this->getModuleInfoXml($module_name);
1510 1673
 			unset($obj);
1511 1674
 
1512
-			if(!isset($info)) continue;
1675
+			if(!isset($info)) {
1676
+				continue;
1677
+			}
1513 1678
 			$info->module = $module_name;
1514 1679
 			$info->created_table_count = $created_table_count;
1515 1680
 			$info->table_count = $table_count;
@@ -1535,11 +1700,16 @@  discard block
 block discarded – undo
1535 1700
 			for($j=0;$j<count($tmp_files);$j++)
1536 1701
 			{
1537 1702
 				list($table_name) = explode(".",$tmp_files[$j]);
1538
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1703
+				if($oDB->isTableExists($table_name)) {
1704
+					$created_table_count ++;
1705
+				}
1539 1706
 			}
1540 1707
 			// Check if DB is installed
1541
-			if($table_count > $created_table_count) return true;
1542
-			else return false;
1708
+			if($table_count > $created_table_count) {
1709
+				return true;
1710
+			} else {
1711
+				return false;
1712
+			}
1543 1713
 		}
1544 1714
 		return false;
1545 1715
 	}
@@ -1567,7 +1737,9 @@  discard block
 block discarded – undo
1567 1737
 		sort($searched_list);
1568 1738
 
1569 1739
 		$searched_count = count($searched_list);
1570
-		if(!$searched_count) return;
1740
+		if(!$searched_count) {
1741
+			return;
1742
+		}
1571 1743
 
1572 1744
 		for($i=0;$i<$searched_count;$i++)
1573 1745
 		{
@@ -1575,7 +1747,9 @@  discard block
 block discarded – undo
1575 1747
 			$module_name = $searched_list[$i];
1576 1748
 
1577 1749
 			$path = ModuleHandler::getModulePath($module_name);
1578
-			if(!is_dir(FileHandler::getRealPath($path))) continue;
1750
+			if(!is_dir(FileHandler::getRealPath($path))) {
1751
+				continue;
1752
+			}
1579 1753
 
1580 1754
 			// Get the number of xml files to create a table in schemas
1581 1755
 			$tmp_files = FileHandler::readDir($path.'schemas', '/(\.xml)$/');
@@ -1585,13 +1759,17 @@  discard block
 block discarded – undo
1585 1759
 			for($j=0;$j<$table_count;$j++)
1586 1760
 			{
1587 1761
 				list($table_name) = explode('.',$tmp_files[$j]);
1588
-				if($oDB->isTableExists($table_name)) $created_table_count ++;
1762
+				if($oDB->isTableExists($table_name)) {
1763
+					$created_table_count ++;
1764
+				}
1589 1765
 			}
1590 1766
 			// Get information of the module
1591 1767
 			$info = NULL;
1592 1768
 			$info = $this->getModuleInfoXml($module_name);
1593 1769
 
1594
-			if(!$info) continue;
1770
+			if(!$info) {
1771
+				continue;
1772
+			}
1595 1773
 
1596 1774
 			$info->module = $module_name;
1597 1775
 			$info->category = $info->category;
@@ -1600,16 +1778,18 @@  discard block
 block discarded – undo
1600 1778
 			$info->path = $path;
1601 1779
 			$info->admin_index_act = $info->admin_index_act;
1602 1780
 			// Check if DB is installed
1603
-			if($table_count > $created_table_count) $info->need_install = true;
1604
-			else $info->need_install = false;
1781
+			if($table_count > $created_table_count) {
1782
+				$info->need_install = true;
1783
+			} else {
1784
+				$info->need_install = false;
1785
+			}
1605 1786
 			// Check if it is upgraded to module.class.php on each module
1606 1787
 			$oDummy = null;
1607 1788
 			$oDummy = getModule($module_name, 'class');
1608 1789
 			if($oDummy && method_exists($oDummy, "checkUpdate"))
1609 1790
 			{
1610 1791
 				$info->need_update = $oDummy->checkUpdate();
1611
-			}
1612
-			else
1792
+			} else
1613 1793
 			{
1614 1794
 				continue;
1615 1795
 			}
@@ -1626,7 +1806,9 @@  discard block
 block discarded – undo
1626 1806
 	 */
1627 1807
 	function syncModuleToSite(&$data)
1628 1808
 	{
1629
-		if(!$data) return;
1809
+		if(!$data) {
1810
+			return;
1811
+		}
1630 1812
 
1631 1813
 		if(is_array($data))
1632 1814
 		{
@@ -1634,9 +1816,10 @@  discard block
 block discarded – undo
1634 1816
 			{
1635 1817
 				$module_srls[] = $val->module_srl;
1636 1818
 			}
1637
-			if(!count($module_srls)) return;
1638
-		}
1639
-		else
1819
+			if(!count($module_srls)) {
1820
+				return;
1821
+			}
1822
+		} else
1640 1823
 		{
1641 1824
 			$module_srls[] = $data->module_srl;
1642 1825
 		}
@@ -1644,7 +1827,9 @@  discard block
 block discarded – undo
1644 1827
 		$args = new stdClass();
1645 1828
 		$args->module_srls = implode(',',$module_srls);
1646 1829
 		$output = executeQueryArray('module.getModuleSites', $args);
1647
-		if(!$output->data) return array();
1830
+		if(!$output->data) {
1831
+			return array();
1832
+		}
1648 1833
 		foreach($output->data as $key => $val)
1649 1834
 		{
1650 1835
 			$modules[$val->module_srl] = $val;
@@ -1656,8 +1841,7 @@  discard block
 block discarded – undo
1656 1841
 			{
1657 1842
 				$data[$key]->domain = $modules[$val->module_srl]->domain;
1658 1843
 			}
1659
-		}
1660
-		else
1844
+		} else
1661 1845
 		{
1662 1846
 			$data->domain = $modules[$data->module_srl]->domain;
1663 1847
 		}
@@ -1668,24 +1852,31 @@  discard block
 block discarded – undo
1668 1852
 	 */
1669 1853
 	function isSiteAdmin($member_info, $site_srl = null)
1670 1854
 	{
1671
-		if(!$member_info->member_srl) return false;
1672
-		if($member_info->is_admin == 'Y') return true;
1855
+		if(!$member_info->member_srl) {
1856
+			return false;
1857
+		}
1858
+		if($member_info->is_admin == 'Y') {
1859
+			return true;
1860
+		}
1673 1861
 
1674 1862
 		$args = new stdClass();
1675 1863
 		if(!isset($site_srl))
1676 1864
 		{
1677 1865
 			$site_module_info = Context::get('site_module_info');
1678
-			if(!$site_module_info) return;
1866
+			if(!$site_module_info) {
1867
+				return;
1868
+			}
1679 1869
 			$args->site_srl = $site_module_info->site_srl;
1680
-		}
1681
-		else
1870
+		} else
1682 1871
 		{
1683 1872
 			$args->site_srl = $site_srl;
1684 1873
 		}
1685 1874
 
1686 1875
 		$args->member_srl = $member_info->member_srl;
1687 1876
 		$output = executeQuery('module.isSiteAdmin', $args);
1688
-		if($output->data->member_srl == $args->member_srl) return true;
1877
+		if($output->data->member_srl == $args->member_srl) {
1878
+			return true;
1879
+		}
1689 1880
 		return false;
1690 1881
 	}
1691 1882
 
@@ -1708,7 +1899,9 @@  discard block
 block discarded – undo
1708 1899
 		$obj = new stdClass();
1709 1900
 		$obj->module_srl = $module_srl;
1710 1901
 		$output = executeQueryArray('module.getAdminID', $obj);
1711
-		if(!$output->toBool() || !$output->data) return;
1902
+		if(!$output->toBool() || !$output->data) {
1903
+			return;
1904
+		}
1712 1905
 
1713 1906
 		return $output->data;
1714 1907
 	}
@@ -1721,7 +1914,9 @@  discard block
 block discarded – undo
1721 1914
 	{
1722 1915
 		$extra_vars = array();
1723 1916
 		$get_module_srls = array();
1724
-		if(!is_array($list_module_srl)) $list_module_srl = array($list_module_srl);
1917
+		if(!is_array($list_module_srl)) {
1918
+			$list_module_srl = array($list_module_srl);
1919
+		}
1725 1920
 
1726 1921
 		$vars = false;
1727 1922
 		// cache controll
@@ -1737,14 +1932,12 @@  discard block
 block discarded – undo
1737 1932
 				if($vars)
1738 1933
 				{
1739 1934
 					$extra_vars[$module_srl] = $vars;
1740
-				}
1741
-				else
1935
+				} else
1742 1936
 				{
1743 1937
 					$get_module_srls[] = $module_srl;
1744 1938
 				}
1745 1939
 			}
1746
-		}
1747
-		else
1940
+		} else
1748 1941
 		{
1749 1942
 			$get_module_srls = $list_module_srl;
1750 1943
 		}
@@ -1769,7 +1962,9 @@  discard block
 block discarded – undo
1769 1962
 			}
1770 1963
 			foreach($output->data as $key => $val)
1771 1964
 			{
1772
-				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') continue;
1965
+				if(in_array($val->name, array('mid','module')) || $val->value == 'Array') {
1966
+					continue;
1967
+				}
1773 1968
 
1774 1969
 				if(!isset($extra_vars[$val->module_srl]))
1775 1970
 				{
@@ -1808,7 +2003,9 @@  discard block
 block discarded – undo
1808 2003
 			$args = new stdClass();
1809 2004
 			$args->module_srl = $module_srl;
1810 2005
 			$output = executeQueryArray('module.getModuleSkinVars',$args);
1811
-			if(!$output->toBool()) return;
2006
+			if(!$output->toBool()) {
2007
+				return;
2008
+			}
1812 2009
 
1813 2010
 			$skin_vars = array();
1814 2011
 			foreach($output->data as $vars)
@@ -1816,7 +2013,9 @@  discard block
 block discarded – undo
1816 2013
 				$skin_vars[$vars->name] = $vars;
1817 2014
 			}
1818 2015
 
1819
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2016
+			if($oCacheHandler->isSupport()) {
2017
+				$oCacheHandler->put($cache_key, $skin_vars);
2018
+			}
1820 2019
 		}
1821 2020
 
1822 2021
 		return $skin_vars;
@@ -1828,7 +2027,9 @@  discard block
 block discarded – undo
1828 2027
 	function getModuleDefaultSkin($module_name, $skin_type = 'P', $site_srl = 0, $updateCache = true)
1829 2028
 	{
1830 2029
 		$target = ($skin_type == 'M') ? 'mskin' : 'skin';
1831
-		if(!$site_srl) $site_srl = 0;
2030
+		if(!$site_srl) {
2031
+			$site_srl = 0;
2032
+		}
1832 2033
 
1833 2034
 		$designInfoFile = sprintf(_XE_PATH_.'files/site_design/design_%s.php', $site_srl);
1834 2035
 		if(is_readable($designInfoFile))
@@ -1845,19 +2046,16 @@  discard block
 block discarded – undo
1845 2046
 			if(is_dir($moduleSkinPath.'default'))
1846 2047
 			{
1847 2048
 				$skinName = 'default';
1848
-			}
1849
-			else if(is_dir($moduleSkinPath.'xe_default'))
2049
+			} else if(is_dir($moduleSkinPath.'xe_default'))
1850 2050
 			{
1851 2051
 				$skinName = 'xe_default';
1852
-			}
1853
-			else
2052
+			} else
1854 2053
 			{
1855 2054
 				$skins = FileHandler::readDir($moduleSkinPath);
1856 2055
 				if(count($skins) > 0)
1857 2056
 				{
1858 2057
 					$skinName = $skins[0];
1859
-				}
1860
-				else
2058
+				} else
1861 2059
 				{
1862 2060
 					$skinName = NULL;
1863 2061
 				}
@@ -1865,7 +2063,9 @@  discard block
 block discarded – undo
1865 2063
 
1866 2064
 			if($updateCache && $skinName)
1867 2065
 			{
1868
-				if(!isset($designInfo->module->{$module_name})) $designInfo->module->{$module_name} = new stdClass();
2066
+				if(!isset($designInfo->module->{$module_name})) {
2067
+					$designInfo->module->{$module_name} = new stdClass();
2068
+				}
1869 2069
 				$designInfo->module->{$module_name}->{$target} = $skinName;
1870 2070
 
1871 2071
 				$oAdminController = getAdminController('admin');
@@ -1881,23 +2081,28 @@  discard block
 block discarded – undo
1881 2081
 	 */
1882 2082
 	function syncSkinInfoToModuleInfo(&$module_info)
1883 2083
 	{
1884
-		if(!$module_info->module_srl) return;
2084
+		if(!$module_info->module_srl) {
2085
+			return;
2086
+		}
1885 2087
 
1886 2088
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
1887 2089
 		if(Mobile::isFromMobilePhone())
1888 2090
 		{
1889 2091
 			$skin_vars = $this->getModuleMobileSkinVars($module_info->module_srl);
1890
-		}
1891
-		else
2092
+		} else
1892 2093
 		{
1893 2094
 			$skin_vars = $this->getModuleSkinVars($module_info->module_srl);
1894 2095
 		}
1895 2096
 
1896
-		if(!$skin_vars) return;
2097
+		if(!$skin_vars) {
2098
+			return;
2099
+		}
1897 2100
 
1898 2101
 		foreach($skin_vars as $name => $val)
1899 2102
 		{
1900
-			if(isset($module_info->{$name})) continue;
2103
+			if(isset($module_info->{$name})) {
2104
+				continue;
2105
+			}
1901 2106
 			$module_info->{$name} = $val->value;
1902 2107
 		}
1903 2108
 	}
@@ -1923,7 +2128,9 @@  discard block
 block discarded – undo
1923 2128
 			$args = new stdClass();
1924 2129
 			$args->module_srl = $module_srl;
1925 2130
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1926
-			if(!$output->toBool() || !$output->data) return;
2131
+			if(!$output->toBool() || !$output->data) {
2132
+				return;
2133
+			}
1927 2134
 
1928 2135
 			$skin_vars = array();
1929 2136
 			foreach($output->data as $vars)
@@ -1931,7 +2138,9 @@  discard block
 block discarded – undo
1931 2138
 				$skin_vars[$vars->name] = $vars;
1932 2139
 			}
1933 2140
 
1934
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2141
+			if($oCacheHandler->isSupport()) {
2142
+				$oCacheHandler->put($cache_key, $skin_vars);
2143
+			}
1935 2144
 		}
1936 2145
 
1937 2146
 		return $skin_vars;
@@ -1943,7 +2152,9 @@  discard block
 block discarded – undo
1943 2152
 	 */
1944 2153
 	function syncMobileSkinInfoToModuleInfo(&$module_info)
1945 2154
 	{
1946
-		if(!$module_info->module_srl) return;
2155
+		if(!$module_info->module_srl) {
2156
+			return;
2157
+		}
1947 2158
 		$skin_vars = false;
1948 2159
 		// cache controll
1949 2160
 		$oCacheHandler = CacheHandler::getInstance('object', null, true);
@@ -1958,17 +2169,25 @@  discard block
 block discarded – undo
1958 2169
 			$args = new stdClass;
1959 2170
 			$args->module_srl = $module_info->module_srl;
1960 2171
 			$output = executeQueryArray('module.getModuleMobileSkinVars',$args);
1961
-			if(!$output->toBool()) return;
2172
+			if(!$output->toBool()) {
2173
+				return;
2174
+			}
1962 2175
 			$skin_vars = $output->data;
1963 2176
 
1964 2177
 			//insert in cache
1965
-			if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key, $skin_vars);
2178
+			if($oCacheHandler->isSupport()) {
2179
+				$oCacheHandler->put($cache_key, $skin_vars);
2180
+			}
2181
+		}
2182
+		if(!$skin_vars) {
2183
+			return;
1966 2184
 		}
1967
-		if(!$skin_vars) return;
1968 2185
 
1969 2186
 		foreach($output->data as $val)
1970 2187
 		{
1971
-			if(isset($module_info->{$val->name})) continue;
2188
+			if(isset($module_info->{$val->name})) {
2189
+				continue;
2190
+			}
1972 2191
 			$module_info->{$val->name} = $val->value;
1973 2192
 		}
1974 2193
 	}
@@ -1990,10 +2209,12 @@  discard block
 block discarded – undo
1990 2209
 		$grant_info = $xml_info->grant;
1991 2210
 		if($member_info->member_srl)
1992 2211
 		{
1993
-			if(is_array($member_info->group_list)) $group_list = array_keys($member_info->group_list);
1994
-			else $group_list = array();
1995
-		}
1996
-		else
2212
+			if(is_array($member_info->group_list)) {
2213
+				$group_list = array_keys($member_info->group_list);
2214
+			} else {
2215
+				$group_list = array();
2216
+			}
2217
+		} else
1997 2218
 		{
1998 2219
 			$group_list = array();
1999 2220
 		}
@@ -2007,8 +2228,7 @@  discard block
 block discarded – undo
2007 2228
 			}
2008 2229
 
2009 2230
 			$grant->is_admin = $grant->manager = ($member_info->is_admin == 'Y') ? true : false;
2010
-		}
2011
-		else
2231
+		} else
2012 2232
 		{
2013 2233
 			// If module_srl exists
2014 2234
 			// Get a type of granted permission
@@ -2021,7 +2241,9 @@  discard block
 block discarded – undo
2021 2241
 				$args->module_srl = $module_srl;
2022 2242
 				$args->member_srl = $member_info->member_srl;
2023 2243
 				$output = executeQuery('module.getModuleAdmin',$args);
2024
-				if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = true;
2244
+				if($output->data && $output->data->member_srl == $member_info->member_srl) {
2245
+					$grant->manager = true;
2246
+				}
2025 2247
 			}
2026 2248
 			// If not an administrator, get information from the DB and grant manager privilege.
2027 2249
 			if(!$grant->manager)
@@ -2031,8 +2253,7 @@  discard block
 block discarded – undo
2031 2253
 				if($module_info->module == 'planet')
2032 2254
 				{
2033 2255
 					$output = executeQueryArray('module.getPlanetGrants', $args);
2034
-				}
2035
-				else
2256
+				} else
2036 2257
 				{
2037 2258
 					$args = new stdClass;
2038 2259
 					$args->module_srl = $module_srl;
@@ -2047,37 +2268,44 @@  discard block
 block discarded – undo
2047 2268
 					foreach($output->data as $val)
2048 2269
 					{
2049 2270
 						$grant_exists[$val->name] = true;
2050
-						if($granted[$val->name]) continue;
2271
+						if($granted[$val->name]) {
2272
+							continue;
2273
+						}
2051 2274
 						// Log-in member only
2052 2275
 						if($val->group_srl == -1)
2053 2276
 						{
2054 2277
 							$granted[$val->name] = true;
2055
-							if($member_info->member_srl) $grant->{$val->name} = true;
2278
+							if($member_info->member_srl) {
2279
+								$grant->{$val->name} = true;
2280
+							}
2056 2281
 							// Site-joined member only
2057
-						}
2058
-						elseif($val->group_srl == -2)
2282
+						} elseif($val->group_srl == -2)
2059 2283
 						{
2060 2284
 							$granted[$val->name] = true;
2061 2285
 							// Do not grant any permission for non-logged member
2062
-							if(!$member_info->member_srl) $grant->{$val->name} = false;
2286
+							if(!$member_info->member_srl) {
2287
+								$grant->{$val->name} = false;
2288
+							}
2063 2289
 							// Log-in member
2064 2290
 							else
2065 2291
 							{
2066 2292
 								$site_module_info = Context::get('site_module_info');
2067 2293
 								// Permission granted if no information of the currently connected site exists
2068
-								if(!$site_module_info->site_srl) $grant->{$val->name} = true;
2294
+								if(!$site_module_info->site_srl) {
2295
+									$grant->{$val->name} = true;
2296
+								}
2069 2297
 								// Permission is not granted if information of the currently connected site exists
2070
-								elseif(count($group_list)) $grant->{$val->name} = true;
2298
+								elseif(count($group_list)) {
2299
+									$grant->{$val->name} = true;
2300
+								}
2071 2301
 							}
2072 2302
 							// All of non-logged members
2073
-						}
2074
-						elseif($val->group_srl == 0)
2303
+						} elseif($val->group_srl == 0)
2075 2304
 						{
2076 2305
 							$granted[$val->name] = true;
2077 2306
 							$grant->{$val->name} = true;
2078 2307
 							// If a target is a group
2079
-						}
2080
-						else
2308
+						} else
2081 2309
 						{
2082 2310
 							if($group_list && count($group_list) && in_array($val->group_srl, $group_list))
2083 2311
 							{
@@ -2088,30 +2316,43 @@  discard block
 block discarded – undo
2088 2316
 					}
2089 2317
 				}
2090 2318
 				// Separate processing for the virtual group access
2091
-				if(!$grant_exists['access']) $grant->access = true;
2319
+				if(!$grant_exists['access']) {
2320
+					$grant->access = true;
2321
+				}
2092 2322
 				if(count($grant_info))
2093 2323
 				{
2094 2324
 					foreach($grant_info as  $grant_name => $grant_item)
2095 2325
 					{
2096
-						if($grant_exists[$grant_name]) continue;
2326
+						if($grant_exists[$grant_name]) {
2327
+							continue;
2328
+						}
2097 2329
 						switch($grant_item->default)
2098 2330
 						{
2099 2331
 							case 'guest' :
2100 2332
 								$grant->{$grant_name} = true;
2101 2333
 								break;
2102 2334
 							case 'member' :
2103
-								if($member_info->member_srl) $grant->{$grant_name} = true;
2104
-								else $grant->{$grant_name} = false;
2335
+								if($member_info->member_srl) {
2336
+									$grant->{$grant_name} = true;
2337
+								} else {
2338
+									$grant->{$grant_name} = false;
2339
+								}
2105 2340
 								break;
2106 2341
 							case 'site' :
2107 2342
 								$site_module_info = Context::get('site_module_info');
2108
-								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) $grant->{$grant_name} = true;
2109
-								else $grant->{$grant_name} = false;
2343
+								if($member_info->member_srl && (($site_module_info->site_srl && count($group_list)) || !$site_module_info->site_srl)) {
2344
+									$grant->{$grant_name} = true;
2345
+								} else {
2346
+									$grant->{$grant_name} = false;
2347
+								}
2110 2348
 								break;
2111 2349
 							case 'manager' :
2112 2350
 							case 'root' :
2113
-								if($member_info->is_admin == 'Y') $grant->{$grant_name} = true;
2114
-								else $grant->{$grant_name} = false;
2351
+								if($member_info->is_admin == 'Y') {
2352
+									$grant->{$grant_name} = true;
2353
+								} else {
2354
+									$grant->{$grant_name} = false;
2355
+								}
2115 2356
 								break;
2116 2357
 						}
2117 2358
 					}
@@ -2187,16 +2428,22 @@  discard block
 block discarded – undo
2187 2428
 	function getFileBoxListHtml()
2188 2429
 	{
2189 2430
 		$logged_info = Context::get('logged_info');
2190
-		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
2431
+		if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) {
2432
+			return new Object(-1, 'msg_not_permitted');
2433
+		}
2191 2434
 		$link = parse_url($_SERVER["HTTP_REFERER"]);
2192 2435
 		$link_params = explode('&',$link['query']);
2193 2436
 		foreach ($link_params as $param)
2194 2437
 		{
2195 2438
 			$param = explode("=",$param);
2196
-			if($param[0] == 'selected_widget') $selected_widget = $param[1];
2439
+			if($param[0] == 'selected_widget') {
2440
+				$selected_widget = $param[1];
2441
+			}
2197 2442
 		}
2198 2443
 		$oWidgetModel = getModel('widget');
2199
-		if($selected_widget) $widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2444
+		if($selected_widget) {
2445
+			$widget_info = $oWidgetModel->getWidgetInfo($selected_widget);
2446
+		}
2200 2447
 		Context::set('allow_multiple', $widget_info->extra_var->images->allow_multiple);
2201 2448
 
2202 2449
 		$oModuleModel = getModel('module');
@@ -2204,7 +2451,9 @@  discard block
 block discarded – undo
2204 2451
 		Context::set('filebox_list', $output->data);
2205 2452
 
2206 2453
 		$page = Context::get('page');
2207
-		if (!$page) $page = 1;
2454
+		if (!$page) {
2455
+			$page = 1;
2456
+		}
2208 2457
 		Context::set('page', $page);
2209 2458
 		Context::set('page_navigation', $output->page_navigation);
2210 2459
 
@@ -2234,25 +2483,28 @@  discard block
 block discarded – undo
2234 2483
 			$rulsetFile = str_replace('@', '', $ruleset);
2235 2484
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2236 2485
 			return FileHandler::getRealPath($xml_file);
2237
-		}
2238
-		else if (strpos($ruleset, '#') !== false)
2486
+		} else if (strpos($ruleset, '#') !== false)
2239 2487
 		{
2240 2488
 			$rulsetFile = str_replace('#', '', $ruleset).'.'.$mid;
2241 2489
 			$xml_file = sprintf('./files/ruleset/%s.xml', $rulsetFile);
2242
-			if(is_readable($xml_file))
2243
-				return FileHandler::getRealPath($xml_file);
2244
-			else{
2490
+			if(is_readable($xml_file)) {
2491
+							return FileHandler::getRealPath($xml_file);
2492
+			} else{
2245 2493
 				$ruleset = str_replace('#', '', $ruleset);
2246 2494
 			}
2247 2495
 
2248 2496
 		}
2249 2497
 		// Get a path of the requested module. Return if not exists.
2250 2498
 		$class_path = ModuleHandler::getModulePath($module);
2251
-		if(!$class_path) return;
2499
+		if(!$class_path) {
2500
+			return;
2501
+		}
2252 2502
 
2253 2503
 		// Check if module.xml exists in the path. Return if not exist
2254 2504
 		$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
2255
-		if(!file_exists($xml_file)) return;
2505
+		if(!file_exists($xml_file)) {
2506
+			return;
2507
+		}
2256 2508
 
2257 2509
 		return $xml_file;
2258 2510
 	}
@@ -2302,7 +2554,9 @@  discard block
 block discarded – undo
2302 2554
 	function getLangByLangcode()
2303 2555
 	{
2304 2556
 		$langCode = Context::get('langCode');
2305
-		if (!$langCode) return;
2557
+		if (!$langCode) {
2558
+			return;
2559
+		}
2306 2560
 
2307 2561
 		$oModuleController = getController('module');
2308 2562
 		$oModuleController->replaceDefinedLangCode($langCode);
Please login to merge, or discard this patch.
classes/context/Context.class.php 2 patches
Spacing   +237 added lines, -237 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	function &getInstance()
163 163
 	{
164 164
 		static $theInstance = null;
165
-		if(!$theInstance)
165
+		if (!$theInstance)
166 166
 		{
167 167
 			$theInstance = new Context();
168 168
 		}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
 		// include ssl action cache file
184 184
 		$this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile);
185
-		if(is_readable($this->sslActionCacheFile))
185
+		if (is_readable($this->sslActionCacheFile))
186 186
 		{
187 187
 			require($this->sslActionCacheFile);
188
-			if(isset($sslActions))
188
+			if (isset($sslActions))
189 189
 			{
190 190
 				$this->ssl_actions = $sslActions;
191 191
 			}
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	function init()
202 202
 	{
203 203
 		// fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above
204
-		if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) {
204
+		if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) {
205 205
 			$GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input");
206
-			if(!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']))
206
+			if (!preg_match('/^[<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']))
207 207
 			{
208 208
 				unset($GLOBALS['HTTP_RAW_POST_DATA']);
209 209
 			}
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 		$this->_setUploadedArgument();
226 226
 
227 227
 		$this->loadDBInfo();
228
-		if($this->db_info->use_sitelock == 'Y')
228
+		if ($this->db_info->use_sitelock == 'Y')
229 229
 		{
230
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
230
+			if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
231 231
 
232
-			if(!IpFilter::filter($whitelist))
232
+			if (!IpFilter::filter($whitelist))
233 233
 			{
234 234
 				$title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...';
235 235
 				$message = $this->db_info->sitelock_message;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 				define('_XE_SITELOCK_MESSAGE_', $message);
240 240
 
241 241
 				header("HTTP/1.1 403 Forbidden");
242
-				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
242
+				if (FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
243 243
 				{
244 244
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
245 245
 				}
@@ -252,39 +252,39 @@  discard block
 block discarded – undo
252 252
 		}
253 253
 
254 254
 		// If XE is installed, get virtual site information
255
-		if(self::isInstalled())
255
+		if (self::isInstalled())
256 256
 		{
257 257
 			$oModuleModel = getModel('module');
258 258
 			$site_module_info = $oModuleModel->getDefaultMid();
259 259
 
260
-			if(!isset($site_module_info))
260
+			if (!isset($site_module_info))
261 261
 			{
262 262
 				$site_module_info = new stdClass();
263 263
 			}
264 264
 
265 265
 			// if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config
266
-			if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
266
+			if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url)
267 267
 			{
268 268
 				$site_module_info->domain = $this->db_info->default_url;
269 269
 			}
270 270
 
271 271
 			$this->set('site_module_info', $site_module_info);
272
-			if($site_module_info->site_srl && isSiteID($site_module_info->domain))
272
+			if ($site_module_info->site_srl && isSiteID($site_module_info->domain))
273 273
 			{
274 274
 				$this->set('vid', $site_module_info->domain, TRUE);
275 275
 			}
276 276
 
277
-			if(!isset($this->db_info))
277
+			if (!isset($this->db_info))
278 278
 			{
279 279
 				$this->db_info = new stdClass();
280 280
 			}
281 281
 
282 282
 			$this->db_info->lang_type = $site_module_info->default_language;
283
-			if(!$this->db_info->lang_type)
283
+			if (!$this->db_info->lang_type)
284 284
 			{
285 285
 				$this->db_info->lang_type = 'en';
286 286
 			}
287
-			if(!$this->db_info->use_db_session)
287
+			if (!$this->db_info->use_db_session)
288 288
 			{
289 289
 				$this->db_info->use_db_session = 'N';
290 290
 			}
@@ -294,30 +294,30 @@  discard block
 block discarded – undo
294 294
 		$lang_supported = $this->loadLangSelected();
295 295
 
296 296
 		// Retrieve language type set in user's cookie
297
-		if($this->lang_type = $this->get('l'))
297
+		if ($this->lang_type = $this->get('l'))
298 298
 		{
299
-			if($_COOKIE['lang_type'] != $this->lang_type)
299
+			if ($_COOKIE['lang_type'] != $this->lang_type)
300 300
 			{
301 301
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
302 302
 			}
303 303
 		}
304
-		elseif($_COOKIE['lang_type'])
304
+		elseif ($_COOKIE['lang_type'])
305 305
 		{
306 306
 			$this->lang_type = $_COOKIE['lang_type'];
307 307
 		}
308 308
 
309 309
 		// If it's not exists, follow default language type set in db_info
310
-		if(!$this->lang_type)
310
+		if (!$this->lang_type)
311 311
 		{
312 312
 			$this->lang_type = $this->db_info->lang_type;
313 313
 		}
314 314
 
315 315
 		// if still lang_type has not been set or has not-supported type , set as English.
316
-		if(!$this->lang_type)
316
+		if (!$this->lang_type)
317 317
 		{
318 318
 			$this->lang_type = 'en';
319 319
 		}
320
-		if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
320
+		if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type]))
321 321
 		{
322 322
 			$this->lang_type = 'en';
323 323
 		}
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		$this->loadLang(_XE_PATH_ . 'modules/module/lang');
330 330
 
331 331
 		// set session handler
332
-		if(self::isInstalled() && $this->db_info->use_db_session == 'Y')
332
+		if (self::isInstalled() && $this->db_info->use_db_session == 'Y')
333 333
 		{
334 334
 			$oSessionModel = getModel('session');
335 335
 			$oSessionController = getController('session');
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			);
339 339
 		}
340 340
 
341
-		if($sess = $_POST[session_name()]) session_id($sess);
341
+		if ($sess = $_POST[session_name()]) session_id($sess);
342 342
 		session_start();
343 343
 
344 344
 		// set authentication information in Context and session
345
-		if(self::isInstalled())
345
+		if (self::isInstalled())
346 346
 		{
347 347
 			$oModuleModel = getModel('module');
348 348
 			$oModuleModel->loadModuleExtends();
@@ -350,15 +350,15 @@  discard block
 block discarded – undo
350 350
 			$oMemberModel = getModel('member');
351 351
 			$oMemberController = getController('member');
352 352
 
353
-			if($oMemberController && $oMemberModel)
353
+			if ($oMemberController && $oMemberModel)
354 354
 			{
355 355
 				// if signed in, validate it.
356
-				if($oMemberModel->isLogged())
356
+				if ($oMemberModel->isLogged())
357 357
 				{
358 358
 					$oMemberController->setSessionInfo();
359 359
 				}
360 360
 				// check auto sign-in
361
-				elseif($_COOKIE['xeak'])
361
+				elseif ($_COOKIE['xeak'])
362 362
 				{
363 363
 					$oMemberController->doAutologin();
364 364
 				}
@@ -378,28 +378,28 @@  discard block
 block discarded – undo
378 378
 		// set locations for javascript use
379 379
 		$url = array();
380 380
 		$current_url = self::getRequestUri();
381
-		if($_SERVER['REQUEST_METHOD'] == 'GET')
381
+		if ($_SERVER['REQUEST_METHOD'] == 'GET')
382 382
 		{
383
-			if($this->get_vars)
383
+			if ($this->get_vars)
384 384
 			{
385 385
 				$url = array();
386
-				foreach($this->get_vars as $key => $val)
386
+				foreach ($this->get_vars as $key => $val)
387 387
 				{
388
-					if(is_array($val) && count($val) > 0)
388
+					if (is_array($val) && count($val) > 0)
389 389
 					{
390
-						foreach($val as $k => $v)
390
+						foreach ($val as $k => $v)
391 391
 						{
392 392
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
393 393
 						}
394 394
 					}
395
-					elseif($val)
395
+					elseif ($val)
396 396
 					{
397 397
 						$url[] = $key . '=' . urlencode($val);
398 398
 					}
399 399
 				}
400 400
 
401 401
 				$current_url = self::getRequestUri();
402
-				if($url) $current_url .= '?' . join('&', $url);
402
+				if ($url) $current_url .= '?' . join('&', $url);
403 403
 			}
404 404
 			else
405 405
 			{
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 		$this->set('current_url', $current_url);
415 415
 		$this->set('request_uri', self::getRequestUri());
416 416
 
417
-		if(strpos($current_url, 'xn--') !== FALSE)
417
+		if (strpos($current_url, 'xn--') !== FALSE)
418 418
 		{
419 419
 			$this->set('current_url', self::decodeIdna($current_url));
420 420
 		}
421 421
 
422
-		if(strpos(self::getRequestUri(), 'xn--') !== FALSE)
422
+		if (strpos(self::getRequestUri(), 'xn--') !== FALSE)
423 423
 		{
424 424
 			$this->set('request_uri', self::decodeIdna(self::getRequestUri()));
425 425
 		}
@@ -444,19 +444,19 @@  discard block
 block discarded – undo
444 444
 	{
445 445
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
446 446
 
447
-		if(!$self->isInstalled())
447
+		if (!$self->isInstalled())
448 448
 		{
449 449
 			return;
450 450
 		}
451 451
 
452 452
 		$config_file = $self->getConfigFile();
453
-		if(is_readable($config_file))
453
+		if (is_readable($config_file))
454 454
 		{
455 455
 			include($config_file);
456 456
 		}
457 457
 
458 458
 		// If master_db information does not exist, the config file needs to be updated
459
-		if(!isset($db_info->master_db))
459
+		if (!isset($db_info->master_db))
460 460
 		{
461 461
 			$db_info->master_db = array();
462 462
 			$db_info->master_db["db_type"] = $db_info->db_type;
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 			$db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix;
475 475
 			unset($db_info->db_table_prefix);
476 476
 
477
-			if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
477
+			if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0)
478 478
 			{
479 479
 				$db_info->master_db["db_table_prefix"] .= '_';
480 480
 			}
@@ -486,33 +486,33 @@  discard block
 block discarded – undo
486 486
 			$oInstallController->makeConfigFile();
487 487
 		}
488 488
 
489
-		if(!$db_info->use_prepared_statements)
489
+		if (!$db_info->use_prepared_statements)
490 490
 		{
491 491
 			$db_info->use_prepared_statements = 'Y';
492 492
 		}
493 493
 
494
-		if(!$db_info->time_zone)
494
+		if (!$db_info->time_zone)
495 495
 			$db_info->time_zone = date('O');
496 496
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
497 497
 
498
-		if($db_info->qmail_compatibility != 'Y')
498
+		if ($db_info->qmail_compatibility != 'Y')
499 499
 			$db_info->qmail_compatibility = 'N';
500 500
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
501 501
 
502
-		if(!$db_info->use_db_session)
502
+		if (!$db_info->use_db_session)
503 503
 			$db_info->use_db_session = 'N';
504
-		if(!$db_info->use_ssl)
504
+		if (!$db_info->use_ssl)
505 505
 			$db_info->use_ssl = 'none';
506 506
 		$this->set('_use_ssl', $db_info->use_ssl);
507 507
 
508 508
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
509 509
 		$self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL);
510 510
 
511
-		if(!$db_info->sitelock_whitelist) {
511
+		if (!$db_info->sitelock_whitelist) {
512 512
 			$db_info->sitelock_whitelist = '127.0.0.1';
513 513
 		}
514 514
 
515
-		if(is_string($db_info->sitelock_whitelist)) {
515
+		if (is_string($db_info->sitelock_whitelist)) {
516 516
 			$db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist);
517 517
 		}
518 518
 
@@ -583,10 +583,10 @@  discard block
 block discarded – undo
583 583
 	function loadLangSupported()
584 584
 	{
585 585
 		static $lang_supported = null;
586
-		if(!$lang_supported)
586
+		if (!$lang_supported)
587 587
 		{
588 588
 			$langs = file(_XE_PATH_ . 'common/lang/lang.info');
589
-			foreach($langs as $val)
589
+			foreach ($langs as $val)
590 590
 			{
591 591
 				list($lang_prefix, $lang_text) = explode(',', $val);
592 592
 				$lang_text = trim($lang_text);
@@ -604,17 +604,17 @@  discard block
 block discarded – undo
604 604
 	function loadLangSelected()
605 605
 	{
606 606
 		static $lang_selected = null;
607
-		if(!$lang_selected)
607
+		if (!$lang_selected)
608 608
 		{
609 609
 			$orig_lang_file = _XE_PATH_ . 'common/lang/lang.info';
610 610
 			$selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info';
611
-			if(!FileHandler::hasContent($selected_lang_file))
611
+			if (!FileHandler::hasContent($selected_lang_file))
612 612
 			{
613 613
 				$old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info';
614 614
 				FileHandler::moveFile($old_selected_lang_file, $selected_lang_file);
615 615
 			}
616 616
 
617
-			if(!FileHandler::hasContent($selected_lang_file))
617
+			if (!FileHandler::hasContent($selected_lang_file))
618 618
 			{
619 619
 				$buff = FileHandler::readFile($orig_lang_file);
620 620
 				FileHandler::writeFile($selected_lang_file, $buff);
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 			else
624 624
 			{
625 625
 				$langs = file($selected_lang_file);
626
-				foreach($langs as $val)
626
+				foreach ($langs as $val)
627 627
 				{
628 628
 					list($lang_prefix, $lang_text) = explode(',', $val);
629 629
 					$lang_text = trim($lang_text);
@@ -642,32 +642,32 @@  discard block
 block discarded – undo
642 642
 	function checkSSO()
643 643
 	{
644 644
 		// pass if it's not GET request or XE is not yet installed
645
-		if($this->db_info->use_sso != 'Y' || isCrawler())
645
+		if ($this->db_info->use_sso != 'Y' || isCrawler())
646 646
 		{
647 647
 			return TRUE;
648 648
 		}
649 649
 		$checkActList = array('rss' => 1, 'atom' => 1);
650
-		if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
650
+		if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')]))
651 651
 		{
652 652
 			return TRUE;
653 653
 		}
654 654
 
655 655
 		// pass if default URL is not set
656 656
 		$default_url = trim($this->db_info->default_url);
657
-		if(!$default_url)
657
+		if (!$default_url)
658 658
 		{
659 659
 			return TRUE;
660 660
 		}
661 661
 
662
-		if(substr_compare($default_url, '/', -1) !== 0)
662
+		if (substr_compare($default_url, '/', -1) !== 0)
663 663
 		{
664 664
 			$default_url .= '/';
665 665
 		}
666 666
 
667 667
 		// for sites recieving SSO valdiation
668
-		if($default_url == self::getRequestUri())
668
+		if ($default_url == self::getRequestUri())
669 669
 		{
670
-			if(self::get('default_url'))
670
+			if (self::get('default_url'))
671 671
 			{
672 672
 				$url = base64_decode(self::get('default_url'));
673 673
 				$url_info = parse_url($url);
@@ -675,14 +675,14 @@  discard block
 block discarded – undo
675 675
 				$oModuleModel = getModel('module');
676 676
 				$target_domain = (stripos($url, $default_url) !== 0) ? $url_info['host'] : $default_url;
677 677
 				$site_info = $oModuleModel->getSiteInfoByDomain($target_domain);
678
-				if(!$site_info->site_srl) {
678
+				if (!$site_info->site_srl) {
679 679
 					$oModuleObject = new ModuleObject();
680 680
 					$oModuleObject->stop('msg_invalid_request');
681 681
 
682 682
 					return false;
683 683
 				}
684 684
 
685
-				$url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id();
685
+				$url_info['query'] .= ($url_info['query'] ? '&' : '') . 'SSOID=' . session_id();
686 686
 				$redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']);
687 687
 				header('location:' . $redirect_url);
688 688
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 		else
694 694
 		{
695 695
 			// result handling : set session_name()
696
-			if($session_name = self::get('SSOID'))
696
+			if ($session_name = self::get('SSOID'))
697 697
 			{
698 698
 				setcookie(session_name(), $session_name);
699 699
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 				return FALSE;
703 703
 				// send SSO request
704 704
 			}
705
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
705
+			else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
706 706
 			{
707 707
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
708 708
 				$url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl()));
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 	{
734 734
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
735 735
 
736
-		if(!$self->isFTPRegisted())
736
+		if (!$self->isFTPRegisted())
737 737
 		{
738 738
 			return null;
739 739
 		}
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 	 */
752 752
 	function addBrowserTitle($site_title)
753 753
 	{
754
-		if(!$site_title)
754
+		if (!$site_title)
755 755
 		{
756 756
 			return;
757 757
 		}
758 758
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
759 759
 
760
-		if($self->site_title)
760
+		if ($self->site_title)
761 761
 		{
762 762
 			$self->site_title .= ' - ' . $site_title;
763 763
 		}
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 	 */
776 776
 	function setBrowserTitle($site_title)
777 777
 	{
778
-		if(!$site_title)
778
+		if (!$site_title)
779 779
 		{
780 780
 			return;
781 781
 		}
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
 		$oModuleModel = getModel('module');
808 808
 		$moduleConfig = $oModuleModel->getModuleConfig('module');
809 809
 
810
-		if(isset($moduleConfig->siteTitle))
810
+		if (isset($moduleConfig->siteTitle))
811 811
 		{
812 812
 			return $moduleConfig->siteTitle;
813 813
 		}
@@ -834,30 +834,30 @@  discard block
 block discarded – undo
834 834
 		global $lang;
835 835
 
836 836
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
837
-		if(!$self->lang_type)
837
+		if (!$self->lang_type)
838 838
 		{
839 839
 			return;
840 840
 		}
841
-		if(!is_object($lang))
841
+		if (!is_object($lang))
842 842
 		{
843 843
 			$lang = new stdClass;
844 844
 		}
845 845
 
846
-		if(!($filename = $self->_loadXmlLang($path)))
846
+		if (!($filename = $self->_loadXmlLang($path)))
847 847
 		{
848 848
 			$filename = $self->_loadPhpLang($path);
849 849
 		}
850 850
 
851
-		if(!is_array($self->loaded_lang_files))
851
+		if (!is_array($self->loaded_lang_files))
852 852
 		{
853 853
 			$self->loaded_lang_files = array();
854 854
 		}
855
-		if(in_array($filename, $self->loaded_lang_files))
855
+		if (in_array($filename, $self->loaded_lang_files))
856 856
 		{
857 857
 			return;
858 858
 		}
859 859
 
860
-		if($filename && is_readable($filename))
860
+		if ($filename && is_readable($filename))
861 861
 		{
862 862
 			$self->loaded_lang_files[] = $filename;
863 863
 			include($filename);
@@ -878,16 +878,16 @@  discard block
 block discarded – undo
878 878
 	{
879 879
 		global $lang;
880 880
 
881
-		if(!$path) return;
881
+		if (!$path) return;
882 882
 
883 883
 		$_path = 'eval://' . $path;
884 884
 
885
-		if(in_array($_path, $this->loaded_lang_files))
885
+		if (in_array($_path, $this->loaded_lang_files))
886 886
 		{
887 887
 			return;
888 888
 		}
889 889
 
890
-		if(substr_compare($path, '/', -1) !== 0)
890
+		if (substr_compare($path, '/', -1) !== 0)
891 891
 		{
892 892
 			$path .= '/';
893 893
 		}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 		$oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type);
896 896
 		$content = $oXmlLangParser->getCompileContent();
897 897
 
898
-		if($content)
898
+		if ($content)
899 899
 		{
900 900
 			$this->loaded_lang_files[] = $_path;
901 901
 			eval($content);
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 	 */
911 911
 	function _loadXmlLang($path)
912 912
 	{
913
-		if(!$path) return;
913
+		if (!$path) return;
914 914
 
915 915
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
916 916
 		return $oXmlLangParser->compile();
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	function _loadPhpLang($path)
926 926
 	{
927
-		if(!$path) return;
927
+		if (!$path) return;
928 928
 
929
-		if(substr_compare($path, '/', -1) !== 0)
929
+		if (substr_compare($path, '/', -1) !== 0)
930 930
 		{
931 931
 			$path .= '/';
932 932
 		}
@@ -934,12 +934,12 @@  discard block
 block discarded – undo
934 934
 		$file = sprintf($path_tpl, $this->lang_type);
935 935
 
936 936
 		$langs = array('ko', 'en'); // this will be configurable.
937
-		while(!is_readable($file) && $langs[0])
937
+		while (!is_readable($file) && $langs[0])
938 938
 		{
939 939
 			$file = sprintf($path_tpl, array_shift($langs));
940 940
 		}
941 941
 
942
-		if(!is_readable($file))
942
+		if (!is_readable($file))
943 943
 		{
944 944
 			return FALSE;
945 945
 		}
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 	 */
982 982
 	function getLang($code)
983 983
 	{
984
-		if(!$code)
984
+		if (!$code)
985 985
 		{
986 986
 			return;
987 987
 		}
988
-		if($GLOBALS['lang']->{$code})
988
+		if ($GLOBALS['lang']->{$code})
989 989
 		{
990 990
 			return $GLOBALS['lang']->{$code};
991 991
 		}
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	 */
1002 1002
 	function setLang($code, $val)
1003 1003
 	{
1004
-		if(!isset($GLOBALS['lang']))
1004
+		if (!isset($GLOBALS['lang']))
1005 1005
 		{
1006 1006
 			$GLOBALS['lang'] = new stdClass();
1007 1007
 		}
@@ -1029,17 +1029,17 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
 		$obj = clone $source_obj;
1031 1031
 
1032
-		foreach($charset_list as $charset)
1032
+		foreach ($charset_list as $charset)
1033 1033
 		{
1034
-			array_walk($obj,'Context::checkConvertFlag',$charset);
1034
+			array_walk($obj, 'Context::checkConvertFlag', $charset);
1035 1035
 			$flag = self::checkConvertFlag($flag = TRUE);
1036
-			if($flag)
1036
+			if ($flag)
1037 1037
 			{
1038
-				if($charset == 'UTF-8')
1038
+				if ($charset == 'UTF-8')
1039 1039
 				{
1040 1040
 					return $obj;
1041 1041
 				}
1042
-				array_walk($obj,'Context::doConvertEncoding',$charset);
1042
+				array_walk($obj, 'Context::doConvertEncoding', $charset);
1043 1043
 				return $obj;
1044 1044
 			}
1045 1045
 		}
@@ -1058,11 +1058,11 @@  discard block
 block discarded – undo
1058 1058
 	function checkConvertFlag(&$val, $key = null, $charset = null)
1059 1059
 	{
1060 1060
 		static $flag = TRUE;
1061
-		if($charset)
1061
+		if ($charset)
1062 1062
 		{
1063
-			if(is_array($val))
1064
-				array_walk($val,'Context::checkConvertFlag',$charset);
1065
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1063
+			if (is_array($val))
1064
+				array_walk($val, 'Context::checkConvertFlag', $charset);
1065
+			else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE;
1066 1066
 			else $flag = FALSE;
1067 1067
 		}
1068 1068
 		else
@@ -1086,9 +1086,9 @@  discard block
 block discarded – undo
1086 1086
 	{
1087 1087
 		if (is_array($val))
1088 1088
 		{
1089
-			array_walk($val,'Context::doConvertEncoding',$charset);
1089
+			array_walk($val, 'Context::doConvertEncoding', $charset);
1090 1090
 		}
1091
-		else $val = iconv($charset,'UTF-8',$val);
1091
+		else $val = iconv($charset, 'UTF-8', $val);
1092 1092
 	}
1093 1093
 
1094 1094
 	/**
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 	 */
1100 1100
 	function convertEncodingStr($str)
1101 1101
 	{
1102
-        if(!$str) return null;
1102
+        if (!$str) return null;
1103 1103
 		$obj = new stdClass();
1104 1104
 		$obj->str = $str;
1105 1105
 		$obj = self::convertEncoding($obj);
@@ -1108,7 +1108,7 @@  discard block
 block discarded – undo
1108 1108
 
1109 1109
 	function decodeIdna($domain)
1110 1110
 	{
1111
-		if(strpos($domain, 'xn--') !== FALSE)
1111
+		if (strpos($domain, 'xn--') !== FALSE)
1112 1112
 		{
1113 1113
 			require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php');
1114 1114
 			$IDN = new idna_convert(array('idn_version' => 2008));
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	{
1142 1142
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1143 1143
 
1144
-		if($self->response_method)
1144
+		if ($self->response_method)
1145 1145
 		{
1146 1146
 			return $self->response_method;
1147 1147
 		}
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		$this->_recursiveCheckVar($_SERVER['HTTP_HOST']);
1182 1182
 
1183 1183
 		$pattern = "/[\,\"\'\{\}\[\]\(\);$]/";
1184
-		if(preg_match($pattern, $_SERVER['HTTP_HOST']))
1184
+		if (preg_match($pattern, $_SERVER['HTTP_HOST']))
1185 1185
 		{
1186 1186
 			$this->isSuccessInit = FALSE;
1187 1187
 		}
@@ -1194,30 +1194,30 @@  discard block
 block discarded – undo
1194 1194
 	 */
1195 1195
 	function _setRequestArgument()
1196 1196
 	{
1197
-		if(!count($_REQUEST))
1197
+		if (!count($_REQUEST))
1198 1198
 		{
1199 1199
 			return;
1200 1200
 		}
1201 1201
 
1202 1202
 		$requestMethod = $this->getRequestMethod();
1203
-		foreach($_REQUEST as $key => $val)
1203
+		foreach ($_REQUEST as $key => $val)
1204 1204
 		{
1205
-			if($val === '' || self::get($key))
1205
+			if ($val === '' || self::get($key))
1206 1206
 			{
1207 1207
 				continue;
1208 1208
 			}
1209 1209
 			$key = htmlentities($key);
1210 1210
 			$val = $this->_filterRequestVar($key, $val);
1211 1211
 
1212
-			if($requestMethod == 'GET' && isset($_GET[$key]))
1212
+			if ($requestMethod == 'GET' && isset($_GET[$key]))
1213 1213
 			{
1214 1214
 				$set_to_vars = TRUE;
1215 1215
 			}
1216
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1216
+			elseif ($requestMethod == 'POST' && isset($_POST[$key]))
1217 1217
 			{
1218 1218
 				$set_to_vars = TRUE;
1219 1219
 			}
1220
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1220
+			elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1221 1221
 			{
1222 1222
 				$set_to_vars = TRUE;
1223 1223
 			}
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 				$set_to_vars = FALSE;
1227 1227
 			}
1228 1228
 
1229
-			if($set_to_vars)
1229
+			if ($set_to_vars)
1230 1230
 			{
1231 1231
 				$this->_recursiveCheckVar($val);
1232 1232
 			}
@@ -1237,20 +1237,20 @@  discard block
 block discarded – undo
1237 1237
 
1238 1238
 	function _recursiveCheckVar($val)
1239 1239
 	{
1240
-		if(is_string($val))
1240
+		if (is_string($val))
1241 1241
 		{
1242
-			foreach($this->patterns as $pattern)
1242
+			foreach ($this->patterns as $pattern)
1243 1243
 			{
1244
-				if(preg_match($pattern, $val))
1244
+				if (preg_match($pattern, $val))
1245 1245
 				{
1246 1246
 					$this->isSuccessInit = FALSE;
1247 1247
 					return;
1248 1248
 				}
1249 1249
 			}
1250 1250
 		}
1251
-		else if(is_array($val))
1251
+		else if (is_array($val))
1252 1252
 		{
1253
-			foreach($val as $val2)
1253
+			foreach ($val as $val2)
1254 1254
 			{
1255 1255
 				$this->_recursiveCheckVar($val2);
1256 1256
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	 */
1265 1265
 	function _setJSONRequestArgument()
1266 1266
 	{
1267
-		if($this->getRequestMethod() != 'JSON')
1267
+		if ($this->getRequestMethod() != 'JSON')
1268 1268
 		{
1269 1269
 			return;
1270 1270
 		}
@@ -1272,7 +1272,7 @@  discard block
 block discarded – undo
1272 1272
 		$params = array();
1273 1273
 		parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params);
1274 1274
 
1275
-		foreach($params as $key => $val)
1275
+		foreach ($params as $key => $val)
1276 1276
 		{
1277 1277
 			$this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE);
1278 1278
 		}
@@ -1285,13 +1285,13 @@  discard block
 block discarded – undo
1285 1285
 	 */
1286 1286
 	function _setXmlRpcArgument()
1287 1287
 	{
1288
-		if($this->getRequestMethod() != 'XMLRPC')
1288
+		if ($this->getRequestMethod() != 'XMLRPC')
1289 1289
 		{
1290 1290
 			return;
1291 1291
 		}
1292 1292
 
1293 1293
 		$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
1294
-		if(Security::detectingXEE($xml))
1294
+		if (Security::detectingXEE($xml))
1295 1295
 		{
1296 1296
 			header("HTTP/1.0 400 Bad Request");
1297 1297
 			exit;
@@ -1303,12 +1303,12 @@  discard block
 block discarded – undo
1303 1303
 		$params = $xml_obj->methodcall->params;
1304 1304
 		unset($params->node_name, $params->attrs, $params->body);
1305 1305
 
1306
-		if(!count(get_object_vars($params)))
1306
+		if (!count(get_object_vars($params)))
1307 1307
 		{
1308 1308
 			return;
1309 1309
 		}
1310 1310
 
1311
-		foreach($params as $key => $val)
1311
+		foreach ($params as $key => $val)
1312 1312
 		{
1313 1313
 			$this->set($key, $this->_filterXmlVars($key, $val), TRUE);
1314 1314
 		}
@@ -1323,10 +1323,10 @@  discard block
 block discarded – undo
1323 1323
 	 */
1324 1324
 	function _filterXmlVars($key, $val)
1325 1325
 	{
1326
-		if(is_array($val))
1326
+		if (is_array($val))
1327 1327
 		{
1328 1328
 			$stack = array();
1329
-			foreach($val as $k => $v)
1329
+			foreach ($val as $k => $v)
1330 1330
 			{
1331 1331
 				$stack[$k] = $this->_filterXmlVars($k, $v);
1332 1332
 			}
@@ -1336,20 +1336,20 @@  discard block
 block discarded – undo
1336 1336
 
1337 1337
 		$body = $val->body;
1338 1338
 		unset($val->node_name, $val->attrs, $val->body);
1339
-		if(!count(get_object_vars($val)))
1339
+		if (!count(get_object_vars($val)))
1340 1340
 		{
1341 1341
 			return $this->_filterRequestVar($key, $body, 0);
1342 1342
 		}
1343 1343
 
1344 1344
 		$stack = new stdClass();
1345
-		foreach($val as $k => $v)
1345
+		foreach ($val as $k => $v)
1346 1346
 		{
1347 1347
 			$output = $this->_filterXmlVars($k, $v);
1348
-			if(is_object($v) && $v->attrs->type == 'array')
1348
+			if (is_object($v) && $v->attrs->type == 'array')
1349 1349
 			{
1350 1350
 				$output = array($output);
1351 1351
 			}
1352
-			if($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1352
+			if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array'))
1353 1353
 			{
1354 1354
 				return $output;
1355 1355
 			}
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 			$stack->{$k} = $output;
1358 1358
 		}
1359 1359
 
1360
-		if(!count(get_object_vars($stack)))
1360
+		if (!count(get_object_vars($stack)))
1361 1361
 		{
1362 1362
 			return NULL;
1363 1363
 		}
@@ -1376,24 +1376,24 @@  discard block
 block discarded – undo
1376 1376
 	 */
1377 1377
 	function _filterRequestVar($key, $val, $do_stripslashes = 1)
1378 1378
 	{
1379
-		if(!($isArray = is_array($val)))
1379
+		if (!($isArray = is_array($val)))
1380 1380
 		{
1381 1381
 			$val = array($val);
1382 1382
 		}
1383 1383
 
1384 1384
 		$result = array();
1385
-		foreach($val as $k => $v)
1385
+		foreach ($val as $k => $v)
1386 1386
 		{
1387 1387
 			$k = htmlentities($k);
1388
-			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1388
+			if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1389 1389
 			{
1390 1390
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1391 1391
 			}
1392
-			elseif($key === 'mid' || $key === 'search_keyword')
1392
+			elseif ($key === 'mid' || $key === 'search_keyword')
1393 1393
 			{
1394 1394
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1395 1395
 			}
1396
-			elseif($key === 'vid')
1396
+			elseif ($key === 'vid')
1397 1397
 			{
1398 1398
 				$result[$k] = urlencode($v);
1399 1399
 			}
@@ -1401,12 +1401,12 @@  discard block
 block discarded – undo
1401 1401
 			{
1402 1402
 				$result[$k] = $v;
1403 1403
 
1404
-				if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1404
+				if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc())
1405 1405
 				{
1406 1406
 					$result[$k] = stripslashes($result[$k]);
1407 1407
 				}
1408 1408
 
1409
-				if(!is_array($result[$k]))
1409
+				if (!is_array($result[$k]))
1410 1410
 				{
1411 1411
 					$result[$k] = trim($result[$k]);
1412 1412
 				}
@@ -1434,17 +1434,17 @@  discard block
 block discarded – undo
1434 1434
 	 */
1435 1435
 	function _setUploadedArgument()
1436 1436
 	{
1437
-		if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1437
+		if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE))
1438 1438
 		{
1439 1439
 			return;
1440 1440
 		}
1441 1441
 
1442
-		foreach($_FILES as $key => $val)
1442
+		foreach ($_FILES as $key => $val)
1443 1443
 		{
1444 1444
 			$tmp_name = $val['tmp_name'];
1445
-			if(!is_array($tmp_name))
1445
+			if (!is_array($tmp_name))
1446 1446
 			{
1447
-				if(!$tmp_name || !is_uploaded_file($tmp_name))
1447
+				if (!$tmp_name || !is_uploaded_file($tmp_name))
1448 1448
 				{
1449 1449
 					continue;
1450 1450
 				}
@@ -1454,9 +1454,9 @@  discard block
 block discarded – undo
1454 1454
 			}
1455 1455
 			else
1456 1456
 			{
1457
-				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1457
+				for ($i = 0, $c = count($tmp_name); $i < $c; $i++)
1458 1458
 				{
1459
-					if($val['size'][$i] > 0)
1459
+					if ($val['size'][$i] > 0)
1460 1460
 					{
1461 1461
 						$file['name'] = $val['name'][$i];
1462 1462
 						$file['type'] = $val['type'][$i];
@@ -1488,12 +1488,12 @@  discard block
 block discarded – undo
1488 1488
 	function getRequestUrl()
1489 1489
 	{
1490 1490
 		static $url = null;
1491
-		if(is_null($url))
1491
+		if (is_null($url))
1492 1492
 		{
1493 1493
 			$url = self::getRequestUri();
1494
-			if(count($_GET) > 0)
1494
+			if (count($_GET) > 0)
1495 1495
 			{
1496
-				foreach($_GET as $key => $val)
1496
+				foreach ($_GET as $key => $val)
1497 1497
 				{
1498 1498
 					$vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : '');
1499 1499
 				}
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1513 1513
 		$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
1514 1514
 
1515
-		if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1515
+		if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
1516 1516
 		{
1517 1517
 			unset($js_callback_func);
1518 1518
 			unset($_GET['xe_js_callback']);
@@ -1540,22 +1540,22 @@  discard block
 block discarded – undo
1540 1540
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1541 1541
 
1542 1542
 		// retrieve virtual site information
1543
-		if(is_null($site_module_info))
1543
+		if (is_null($site_module_info))
1544 1544
 		{
1545 1545
 			$site_module_info = self::get('site_module_info');
1546 1546
 		}
1547 1547
 
1548 1548
 		// If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid)
1549
-		if($domain && isSiteID($domain))
1549
+		if ($domain && isSiteID($domain))
1550 1550
 		{
1551 1551
 			$vid = $domain;
1552 1552
 			$domain = '';
1553 1553
 		}
1554 1554
 
1555 1555
 		// If $domain, $vid are not set, use current site information
1556
-		if(!$domain && !$vid)
1556
+		if (!$domain && !$vid)
1557 1557
 		{
1558
-			if($site_module_info->domain && isSiteID($site_module_info->domain))
1558
+			if ($site_module_info->domain && isSiteID($site_module_info->domain))
1559 1559
 			{
1560 1560
 				$vid = $site_module_info->domain;
1561 1561
 			}
@@ -1566,21 +1566,21 @@  discard block
 block discarded – undo
1566 1566
 		}
1567 1567
 
1568 1568
 		// if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain.
1569
-		if($domain)
1569
+		if ($domain)
1570 1570
 		{
1571 1571
 			$domain_info = parse_url($domain);
1572
-			if(is_null($current_info))
1572
+			if (is_null($current_info))
1573 1573
 			{
1574 1574
 				$current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath());
1575 1575
 			}
1576
-			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1576
+			if ($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1577 1577
 			{
1578 1578
 				unset($domain);
1579 1579
 			}
1580 1580
 			else
1581 1581
 			{
1582 1582
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1583
-				if(substr_compare($domain, '/', -1) !== 0)
1583
+				if (substr_compare($domain, '/', -1) !== 0)
1584 1584
 				{
1585 1585
 					$domain .= '/';
1586 1586
 				}
@@ -1590,10 +1590,10 @@  discard block
 block discarded – undo
1590 1590
 		$get_vars = array();
1591 1591
 
1592 1592
 		// If there is no GET variables or first argument is '' to reset variables
1593
-		if(!$self->get_vars || $args_list[0] == '')
1593
+		if (!$self->get_vars || $args_list[0] == '')
1594 1594
 		{
1595 1595
 			// rearrange args_list
1596
-			if(is_array($args_list) && $args_list[0] == '')
1596
+			if (is_array($args_list) && $args_list[0] == '')
1597 1597
 			{
1598 1598
 				array_shift($args_list);
1599 1599
 			}
@@ -1605,13 +1605,13 @@  discard block
 block discarded – undo
1605 1605
 		}
1606 1606
 
1607 1607
 		// arrange args_list
1608
-		for($i = 0, $c = count($args_list); $i < $c; $i += 2)
1608
+		for ($i = 0, $c = count($args_list); $i < $c; $i += 2)
1609 1609
 		{
1610 1610
 			$key = $args_list[$i];
1611 1611
 			$val = trim($args_list[$i + 1]);
1612 1612
 
1613 1613
 			// If value is not set, remove the key
1614
-			if(!isset($val) || !strlen($val))
1614
+			if (!isset($val) || !strlen($val))
1615 1615
 			{
1616 1616
 				unset($get_vars[$key]);
1617 1617
 				continue;
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 
1623 1623
 		// remove vid, rnd
1624 1624
 		unset($get_vars['rnd']);
1625
-		if($vid)
1625
+		if ($vid)
1626 1626
 		{
1627 1627
 			$get_vars['vid'] = $vid;
1628 1628
 		}
@@ -1639,17 +1639,17 @@  discard block
 block discarded – undo
1639 1639
 			'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument',
1640 1640
 			'dispModuleAdminSelectList' => 'dispModuleSelectList'
1641 1641
 		);
1642
-		if($act_alias[$act])
1642
+		if ($act_alias[$act])
1643 1643
 		{
1644 1644
 			$get_vars['act'] = $act_alias[$act];
1645 1645
 		}
1646 1646
 
1647 1647
 		// organize URL
1648 1648
 		$query = '';
1649
-		if(count($get_vars) > 0)
1649
+		if (count($get_vars) > 0)
1650 1650
 		{
1651 1651
 			// if using rewrite mod
1652
-			if($self->allow_rewrite)
1652
+			if ($self->allow_rewrite)
1653 1653
 			{
1654 1654
 				$var_keys = array_keys($get_vars);
1655 1655
 				sort($var_keys);
@@ -1687,24 +1687,24 @@  discard block
 block discarded – undo
1687 1687
 				$query = $target_map[$target];
1688 1688
 			}
1689 1689
 
1690
-			if(!$query)
1690
+			if (!$query)
1691 1691
 			{
1692 1692
 				$queries = array();
1693
-				foreach($get_vars as $key => $val)
1693
+				foreach ($get_vars as $key => $val)
1694 1694
 				{
1695
-					if(is_array($val) && count($val) > 0)
1695
+					if (is_array($val) && count($val) > 0)
1696 1696
 					{
1697
-						foreach($val as $k => $v)
1697
+						foreach ($val as $k => $v)
1698 1698
 						{
1699 1699
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1700 1700
 						}
1701 1701
 					}
1702
-					elseif(!is_array($val))
1702
+					elseif (!is_array($val))
1703 1703
 					{
1704 1704
 						$queries[] = $key . '=' . urlencode($val);
1705 1705
 					}
1706 1706
 				}
1707
-				if(count($queries) > 0)
1707
+				if (count($queries) > 0)
1708 1708
 				{
1709 1709
 					$query = 'index.php?' . join('&', $queries);
1710 1710
 				}
@@ -1713,12 +1713,12 @@  discard block
 block discarded – undo
1713 1713
 
1714 1714
 		// If using SSL always
1715 1715
 		$_use_ssl = $self->get('_use_ssl');
1716
-		if($_use_ssl == 'always')
1716
+		if ($_use_ssl == 'always')
1717 1717
 		{
1718 1718
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1719 1719
 			// optional SSL use
1720 1720
 		}
1721
-		elseif($_use_ssl == 'optional')
1721
+		elseif ($_use_ssl == 'optional')
1722 1722
 		{
1723 1723
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1724 1724
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
@@ -1727,11 +1727,11 @@  discard block
 block discarded – undo
1727 1727
 		else
1728 1728
 		{
1729 1729
 			// currently on SSL but target is not based on SSL
1730
-			if($_SERVER['HTTPS'] == 'on')
1730
+			if ($_SERVER['HTTPS'] == 'on')
1731 1731
 			{
1732 1732
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1733 1733
 			}
1734
-			else if($domain) // if $domain is set
1734
+			else if ($domain) // if $domain is set
1735 1735
 			{
1736 1736
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1737 1737
 			}
@@ -1741,12 +1741,12 @@  discard block
 block discarded – undo
1741 1741
 			}
1742 1742
 		}
1743 1743
 
1744
-		if(!$encode)
1744
+		if (!$encode)
1745 1745
 		{
1746 1746
 			return $query;
1747 1747
 		}
1748 1748
 
1749
-		if(!$autoEncode)
1749
+		if (!$autoEncode)
1750 1750
 		{
1751 1751
 			return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1752 1752
 		}
@@ -1755,9 +1755,9 @@  discard block
 block discarded – undo
1755 1755
 		$encode_queries = array();
1756 1756
 		$parsedUrl = parse_url($query);
1757 1757
 		parse_str($parsedUrl['query'], $output);
1758
-		foreach($output as $key => $value)
1758
+		foreach ($output as $key => $value)
1759 1759
 		{
1760
-			if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1760
+			if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value)))
1761 1761
 			{
1762 1762
 				$value = urlencode(htmlspecialchars_decode(urldecode($value)));
1763 1763
 			}
@@ -1779,17 +1779,17 @@  discard block
 block discarded – undo
1779 1779
 		static $url = array();
1780 1780
 
1781 1781
 		// Check HTTP Request
1782
-		if(!isset($_SERVER['SERVER_PROTOCOL']))
1782
+		if (!isset($_SERVER['SERVER_PROTOCOL']))
1783 1783
 		{
1784 1784
 			return;
1785 1785
 		}
1786 1786
 
1787
-		if(self::get('_use_ssl') == 'always')
1787
+		if (self::get('_use_ssl') == 'always')
1788 1788
 		{
1789 1789
 			$ssl_mode = ENFORCE_SSL;
1790 1790
 		}
1791 1791
 
1792
-		if($domain)
1792
+		if ($domain)
1793 1793
 		{
1794 1794
 			$domain_key = md5($domain);
1795 1795
 		}
@@ -1798,14 +1798,14 @@  discard block
 block discarded – undo
1798 1798
 			$domain_key = 'default';
1799 1799
 		}
1800 1800
 
1801
-		if(isset($url[$ssl_mode][$domain_key]))
1801
+		if (isset($url[$ssl_mode][$domain_key]))
1802 1802
 		{
1803 1803
 			return $url[$ssl_mode][$domain_key];
1804 1804
 		}
1805 1805
 
1806 1806
 		$current_use_ssl = ($_SERVER['HTTPS'] == 'on');
1807 1807
 
1808
-		switch($ssl_mode)
1808
+		switch ($ssl_mode)
1809 1809
 		{
1810 1810
 			case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl;
1811 1811
 				break;
@@ -1815,12 +1815,12 @@  discard block
 block discarded – undo
1815 1815
 				break;
1816 1816
 		}
1817 1817
 
1818
-		if($domain)
1818
+		if ($domain)
1819 1819
 		{
1820 1820
 			$target_url = trim($domain);
1821
-			if(substr_compare($target_url, '/', -1) !== 0)
1821
+			if (substr_compare($target_url, '/', -1) !== 0)
1822 1822
 			{
1823
-				$target_url.= '/';
1823
+				$target_url .= '/';
1824 1824
 			}
1825 1825
 		}
1826 1826
 		else
@@ -1830,19 +1830,19 @@  discard block
 block discarded – undo
1830 1830
 
1831 1831
 		$url_info = parse_url('http://' . $target_url);
1832 1832
 
1833
-		if($current_use_ssl != $use_ssl)
1833
+		if ($current_use_ssl != $use_ssl)
1834 1834
 		{
1835 1835
 			unset($url_info['port']);
1836 1836
 		}
1837 1837
 
1838
-		if($use_ssl)
1838
+		if ($use_ssl)
1839 1839
 		{
1840 1840
 			$port = self::get('_https_port');
1841
-			if($port && $port != 443)
1841
+			if ($port && $port != 443)
1842 1842
 			{
1843 1843
 				$url_info['port'] = $port;
1844 1844
 			}
1845
-			elseif($url_info['port'] == 443)
1845
+			elseif ($url_info['port'] == 443)
1846 1846
 			{
1847 1847
 				unset($url_info['port']);
1848 1848
 			}
@@ -1850,11 +1850,11 @@  discard block
 block discarded – undo
1850 1850
 		else
1851 1851
 		{
1852 1852
 			$port = self::get('_http_port');
1853
-			if($port && $port != 80)
1853
+			if ($port && $port != 80)
1854 1854
 			{
1855 1855
 				$url_info['port'] = $port;
1856 1856
 			}
1857
-			elseif($url_info['port'] == 80)
1857
+			elseif ($url_info['port'] == 80)
1858 1858
 			{
1859 1859
 				unset($url_info['port']);
1860 1860
 			}
@@ -1877,16 +1877,16 @@  discard block
 block discarded – undo
1877 1877
 	{
1878 1878
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1879 1879
 		$self->context->{$key} = $val;
1880
-		if($set_to_get_vars === FALSE)
1880
+		if ($set_to_get_vars === FALSE)
1881 1881
 		{
1882 1882
 			return;
1883 1883
 		}
1884
-		if($val === NULL || $val === '')
1884
+		if ($val === NULL || $val === '')
1885 1885
 		{
1886 1886
 			unset($self->get_vars->{$key});
1887 1887
 			return;
1888 1888
 		}
1889
-		if($set_to_get_vars || $self->get_vars->{$key})
1889
+		if ($set_to_get_vars || $self->get_vars->{$key})
1890 1890
 		{
1891 1891
 			$self->get_vars->{$key} = $val;
1892 1892
 		}
@@ -1902,7 +1902,7 @@  discard block
 block discarded – undo
1902 1902
 	{
1903 1903
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1904 1904
 
1905
-		if(!isset($self->context->{$key}))
1905
+		if (!isset($self->context->{$key}))
1906 1906
 		{
1907 1907
 			return null;
1908 1908
 		}
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
 	function gets()
1918 1918
 	{
1919 1919
 		$num_args = func_num_args();
1920
-		if($num_args < 1)
1920
+		if ($num_args < 1)
1921 1921
 		{
1922 1922
 			return;
1923 1923
 		}
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
 
1926 1926
 		$args_list = func_get_args();
1927 1927
 		$output = new stdClass();
1928
-		foreach($args_list as $v)
1928
+		foreach ($args_list as $v)
1929 1929
 		{
1930 1930
 			$output->{$v} = $self->get($v);
1931 1931
 		}
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 	function getRequestVars()
1952 1952
 	{
1953 1953
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1954
-		if($self->get_vars)
1954
+		if ($self->get_vars)
1955 1955
 		{
1956 1956
 			return clone($self->get_vars);
1957 1957
 		}
@@ -1968,13 +1968,13 @@  discard block
 block discarded – undo
1968 1968
 	{
1969 1969
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1970 1970
 
1971
-		if(!is_readable($self->sslActionCacheFile))
1971
+		if (!is_readable($self->sslActionCacheFile))
1972 1972
 		{
1973 1973
 			$buff = '<?php if(!defined("__XE__"))exit;';
1974 1974
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
1975 1975
 		}
1976 1976
 
1977
-		if(!isset($self->ssl_actions[$action]))
1977
+		if (!isset($self->ssl_actions[$action]))
1978 1978
 		{
1979 1979
 			$self->ssl_actions[$action] = 1;
1980 1980
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -1992,16 +1992,16 @@  discard block
 block discarded – undo
1992 1992
 	{
1993 1993
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
1994 1994
 
1995
-		if(!is_readable($self->sslActionCacheFile))
1995
+		if (!is_readable($self->sslActionCacheFile))
1996 1996
 		{
1997 1997
 			unset($self->ssl_actions);
1998 1998
 			$buff = '<?php if(!defined("__XE__"))exit;';
1999 1999
 			FileHandler::writeFile($self->sslActionCacheFile, $buff);
2000 2000
 		}
2001 2001
 
2002
-		foreach($action_array as $action)
2002
+		foreach ($action_array as $action)
2003 2003
 		{
2004
-			if(!isset($self->ssl_actions[$action]))
2004
+			if (!isset($self->ssl_actions[$action]))
2005 2005
 			{
2006 2006
 				$self->ssl_actions[$action] = 1;
2007 2007
 				$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
@@ -2020,7 +2020,7 @@  discard block
 block discarded – undo
2020 2020
 	{
2021 2021
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2022 2022
 
2023
-		if($self->isExistsSSLAction($action))
2023
+		if ($self->isExistsSSLAction($action))
2024 2024
 		{
2025 2025
 			$sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action);
2026 2026
 			$buff = FileHandler::readFile($self->sslActionCacheFile);
@@ -2037,7 +2037,7 @@  discard block
 block discarded – undo
2037 2037
 	function getSSLActions()
2038 2038
 	{
2039 2039
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2040
-		if($self->getSslStatus() == 'optional')
2040
+		if ($self->getSslStatus() == 'optional')
2041 2041
 		{
2042 2042
 			return $self->ssl_actions;
2043 2043
 		}
@@ -2064,12 +2064,12 @@  discard block
 block discarded – undo
2064 2064
 	 */
2065 2065
 	function normalizeFilePath($file)
2066 2066
 	{
2067
-		if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2067
+		if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
2068 2068
 		{
2069 2069
 			$file = './' . $file;
2070 2070
 		}
2071 2071
 		$file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file);
2072
-		while(strpos($file, '/../') !== FALSE)
2072
+		while (strpos($file, '/../') !== FALSE)
2073 2073
 		{
2074 2074
 			$file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1);
2075 2075
 		}
@@ -2087,11 +2087,11 @@  discard block
 block discarded – undo
2087 2087
 	function getAbsFileUrl($file)
2088 2088
 	{
2089 2089
 		$file = self::normalizeFilePath($file);
2090
-		if(strpos($file, './') === 0)
2090
+		if (strpos($file, './') === 0)
2091 2091
 		{
2092 2092
 			$file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2);
2093 2093
 		}
2094
-		elseif(strpos($file, '../') === 0)
2094
+		elseif (strpos($file, '../') === 0)
2095 2095
 		{
2096 2096
 			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}");
2097 2097
 		}
@@ -2163,12 +2163,12 @@  discard block
 block discarded – undo
2163 2163
 	 */
2164 2164
 	function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
2165 2165
 	{
2166
-		if($isRuleset)
2166
+		if ($isRuleset)
2167 2167
 		{
2168
-			if(strpos($file, '#') !== FALSE)
2168
+			if (strpos($file, '#') !== FALSE)
2169 2169
 			{
2170 2170
 				$file = str_replace('#', '', $file);
2171
-				if(!is_readable($file))
2171
+				if (!is_readable($file))
2172 2172
 				{
2173 2173
 					$file = $autoPath;
2174 2174
 				}
@@ -2233,9 +2233,9 @@  discard block
 block discarded – undo
2233 2233
 		ksort($files);
2234 2234
 		$files = array_values($files);
2235 2235
 		$filenames = array();
2236
-		for($i = 0, $c = count($files); $i < $c; ++$i)
2236
+		for ($i = 0, $c = count($files); $i < $c; ++$i)
2237 2237
 		{
2238
-			if(in_array($files[$i]['file'], $filenames))
2238
+			if (in_array($files[$i]['file'], $filenames))
2239 2239
 			{
2240 2240
 				unset($files[$i]);
2241 2241
 			}
@@ -2320,14 +2320,14 @@  discard block
 block discarded – undo
2320 2320
 	 */
2321 2321
 	function getJavascriptPluginInfo($pluginName)
2322 2322
 	{
2323
-		if($plugin_name == 'ui.datepicker')
2323
+		if ($plugin_name == 'ui.datepicker')
2324 2324
 		{
2325 2325
 			$plugin_name = 'ui';
2326 2326
 		}
2327 2327
 
2328 2328
 		$plugin_path = './common/js/plugins/' . $pluginName . '/';
2329 2329
 		$info_file = $plugin_path . 'plugin.load';
2330
-		if(!is_readable($info_file))
2330
+		if (!is_readable($info_file))
2331 2331
 		{
2332 2332
 			return;
2333 2333
 		}
@@ -2337,30 +2337,30 @@  discard block
 block discarded – undo
2337 2337
 		$result->jsList = array();
2338 2338
 		$result->cssList = array();
2339 2339
 
2340
-		foreach($list as $filename)
2340
+		foreach ($list as $filename)
2341 2341
 		{
2342 2342
 			$filename = trim($filename);
2343
-			if(!$filename)
2343
+			if (!$filename)
2344 2344
 			{
2345 2345
 				continue;
2346 2346
 			}
2347 2347
 
2348
-			if(strncasecmp('./', $filename, 2) === 0)
2348
+			if (strncasecmp('./', $filename, 2) === 0)
2349 2349
 			{
2350 2350
 				$filename = substr($filename, 2);
2351 2351
 			}
2352 2352
 
2353
-			if(substr_compare($filename, '.js', -3) === 0)
2353
+			if (substr_compare($filename, '.js', -3) === 0)
2354 2354
 			{
2355 2355
 				$result->jsList[] = $plugin_path . $filename;
2356 2356
 			}
2357
-			elseif(substr_compare($filename, '.css', -4) === 0)
2357
+			elseif (substr_compare($filename, '.css', -4) === 0)
2358 2358
 			{
2359 2359
 				$result->cssList[] = $plugin_path . $filename;
2360 2360
 			}
2361 2361
 		}
2362 2362
 
2363
-		if(is_dir($plugin_path . 'lang'))
2363
+		if (is_dir($plugin_path . 'lang'))
2364 2364
 		{
2365 2365
 			$result->langPath = $plugin_path . 'lang';
2366 2366
 		}
@@ -2378,12 +2378,12 @@  discard block
 block discarded – undo
2378 2378
 		static $loaded_plugins = array();
2379 2379
 
2380 2380
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2381
-		if($plugin_name == 'ui.datepicker')
2381
+		if ($plugin_name == 'ui.datepicker')
2382 2382
 		{
2383 2383
 			$plugin_name = 'ui';
2384 2384
 		}
2385 2385
 
2386
-		if($loaded_plugins[$plugin_name])
2386
+		if ($loaded_plugins[$plugin_name])
2387 2387
 		{
2388 2388
 			return;
2389 2389
 		}
@@ -2391,35 +2391,35 @@  discard block
 block discarded – undo
2391 2391
 
2392 2392
 		$plugin_path = './common/js/plugins/' . $plugin_name . '/';
2393 2393
 		$info_file = $plugin_path . 'plugin.load';
2394
-		if(!is_readable($info_file))
2394
+		if (!is_readable($info_file))
2395 2395
 		{
2396 2396
 			return;
2397 2397
 		}
2398 2398
 
2399 2399
 		$list = file($info_file);
2400
-		foreach($list as $filename)
2400
+		foreach ($list as $filename)
2401 2401
 		{
2402 2402
 			$filename = trim($filename);
2403
-			if(!$filename)
2403
+			if (!$filename)
2404 2404
 			{
2405 2405
 				continue;
2406 2406
 			}
2407 2407
 
2408
-			if(strncasecmp('./', $filename, 2) === 0)
2408
+			if (strncasecmp('./', $filename, 2) === 0)
2409 2409
 			{
2410 2410
 				$filename = substr($filename, 2);
2411 2411
 			}
2412
-			if(substr_compare($filename, '.js', -3) === 0)
2412
+			if (substr_compare($filename, '.js', -3) === 0)
2413 2413
 			{
2414 2414
 				$self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE);
2415 2415
 			}
2416
-			if(substr_compare($filename, '.css', -4) === 0)
2416
+			if (substr_compare($filename, '.css', -4) === 0)
2417 2417
 			{
2418 2418
 				$self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE);
2419 2419
 			}
2420 2420
 		}
2421 2421
 
2422
-		if(is_dir($plugin_path . 'lang'))
2422
+		if (is_dir($plugin_path . 'lang'))
2423 2423
 		{
2424 2424
 			$self->loadLang($plugin_path . 'lang');
2425 2425
 		}
@@ -2591,14 +2591,14 @@  discard block
 block discarded – undo
2591 2591
 		$_path = explode('/', $path);
2592 2592
 		$_base = explode('/', $base_url);
2593 2593
 
2594
-		if(!$_base[count($_base) - 1])
2594
+		if (!$_base[count($_base) - 1])
2595 2595
 		{
2596 2596
 			array_pop($_base);
2597 2597
 		}
2598 2598
 
2599
-		foreach($_xe as $idx => $dir)
2599
+		foreach ($_xe as $idx => $dir)
2600 2600
 		{
2601
-			if($_path[0] != $dir)
2601
+			if ($_path[0] != $dir)
2602 2602
 			{
2603 2603
 				break;
2604 2604
 			}
@@ -2606,9 +2606,9 @@  discard block
 block discarded – undo
2606 2606
 		}
2607 2607
 
2608 2608
 		$idx = count($_xe) - $idx - 1;
2609
-		while($idx--)
2609
+		while ($idx--)
2610 2610
 		{
2611
-			if(count($_base) > 0)
2611
+			if (count($_base) > 0)
2612 2612
 			{
2613 2613
 				array_shift($_base);
2614 2614
 			}
@@ -2618,13 +2618,13 @@  discard block
 block discarded – undo
2618 2618
 			}
2619 2619
 		}
2620 2620
 
2621
-		if(count($_base) > 0)
2621
+		if (count($_base) > 0)
2622 2622
 		{
2623 2623
 			array_unshift($_path, join('/', $_base));
2624 2624
 		}
2625 2625
 
2626 2626
 		$path = '/' . join('/', $_path);
2627
-		if(substr_compare($path, '/', -1) !== 0)
2627
+		if (substr_compare($path, '/', -1) !== 0)
2628 2628
 		{
2629 2629
 			$path .= '/';
2630 2630
 		}
@@ -2639,13 +2639,13 @@  discard block
 block discarded – undo
2639 2639
 	{
2640 2640
 		is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
2641 2641
 
2642
-		if(!is_array($self->meta_tags))
2642
+		if (!is_array($self->meta_tags))
2643 2643
 		{
2644 2644
 			$self->meta_tags = array();
2645 2645
 		}
2646 2646
 
2647 2647
 		$ret = array();
2648
-		foreach($self->meta_tags as $key => $val)
2648
+		foreach ($self->meta_tags as $key => $val)
2649 2649
 		{
2650 2650
 			list($name, $is_http_equiv) = explode("\t", $key);
2651 2651
 			$ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val);
Please login to merge, or discard this patch.
Braces   +79 added lines, -91 removed lines patch added patch discarded remove patch
@@ -227,7 +227,9 @@  discard block
 block discarded – undo
227 227
 		$this->loadDBInfo();
228 228
 		if($this->db_info->use_sitelock == 'Y')
229 229
 		{
230
-			if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist;
230
+			if(is_array($this->db_info->sitelock_whitelist)) {
231
+				$whitelist = $this->db_info->sitelock_whitelist;
232
+			}
231 233
 
232 234
 			if(!IpFilter::filter($whitelist))
233 235
 			{
@@ -242,8 +244,7 @@  discard block
 block discarded – undo
242 244
 				if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html'))
243 245
 				{
244 246
 					include _XE_PATH_ . 'common/tpl/sitelock.user.html';
245
-				}
246
-				else
247
+				} else
247 248
 				{
248 249
 					include _XE_PATH_ . 'common/tpl/sitelock.html';
249 250
 				}
@@ -300,8 +301,7 @@  discard block
 block discarded – undo
300 301
 			{
301 302
 				setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/');
302 303
 			}
303
-		}
304
-		elseif($_COOKIE['lang_type'])
304
+		} elseif($_COOKIE['lang_type'])
305 305
 		{
306 306
 			$this->lang_type = $_COOKIE['lang_type'];
307 307
 		}
@@ -338,7 +338,9 @@  discard block
 block discarded – undo
338 338
 			);
339 339
 		}
340 340
 
341
-		if($sess = $_POST[session_name()]) session_id($sess);
341
+		if($sess = $_POST[session_name()]) {
342
+			session_id($sess);
343
+		}
342 344
 		session_start();
343 345
 
344 346
 		// set authentication information in Context and session
@@ -391,22 +393,21 @@  discard block
 block discarded – undo
391 393
 						{
392 394
 							$url[] = $key . '[' . $k . ']=' . urlencode($v);
393 395
 						}
394
-					}
395
-					elseif($val)
396
+					} elseif($val)
396 397
 					{
397 398
 						$url[] = $key . '=' . urlencode($val);
398 399
 					}
399 400
 				}
400 401
 
401 402
 				$current_url = self::getRequestUri();
402
-				if($url) $current_url .= '?' . join('&', $url);
403
-			}
404
-			else
403
+				if($url) {
404
+					$current_url .= '?' . join('&', $url);
405
+				}
406
+			} else
405 407
 			{
406 408
 				$current_url = $this->getUrl();
407 409
 			}
408
-		}
409
-		else
410
+		} else
410 411
 		{
411 412
 			$current_url = self::getRequestUri();
412 413
 		}
@@ -491,18 +492,22 @@  discard block
 block discarded – undo
491 492
 			$db_info->use_prepared_statements = 'Y';
492 493
 		}
493 494
 
494
-		if(!$db_info->time_zone)
495
-			$db_info->time_zone = date('O');
495
+		if(!$db_info->time_zone) {
496
+					$db_info->time_zone = date('O');
497
+		}
496 498
 		$GLOBALS['_time_zone'] = $db_info->time_zone;
497 499
 
498
-		if($db_info->qmail_compatibility != 'Y')
499
-			$db_info->qmail_compatibility = 'N';
500
+		if($db_info->qmail_compatibility != 'Y') {
501
+					$db_info->qmail_compatibility = 'N';
502
+		}
500 503
 		$GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility;
501 504
 
502
-		if(!$db_info->use_db_session)
503
-			$db_info->use_db_session = 'N';
504
-		if(!$db_info->use_ssl)
505
-			$db_info->use_ssl = 'none';
505
+		if(!$db_info->use_db_session) {
506
+					$db_info->use_db_session = 'N';
507
+		}
508
+		if(!$db_info->use_ssl) {
509
+					$db_info->use_ssl = 'none';
510
+		}
506 511
 		$this->set('_use_ssl', $db_info->use_ssl);
507 512
 
508 513
 		$self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL);
@@ -619,8 +624,7 @@  discard block
 block discarded – undo
619 624
 				$buff = FileHandler::readFile($orig_lang_file);
620 625
 				FileHandler::writeFile($selected_lang_file, $buff);
621 626
 				$lang_selected = self::loadLangSupported();
622
-			}
623
-			else
627
+			} else
624 628
 			{
625 629
 				$langs = file($selected_lang_file);
626 630
 				foreach($langs as $val)
@@ -689,8 +693,7 @@  discard block
 block discarded – undo
689 693
 				return FALSE;
690 694
 			}
691 695
 			// for sites requesting SSO validation
692
-		}
693
-		else
696
+		} else
694 697
 		{
695 698
 			// result handling : set session_name()
696 699
 			if($session_name = self::get('SSOID'))
@@ -701,8 +704,7 @@  discard block
 block discarded – undo
701 704
 				header('location:' . $url);
702 705
 				return FALSE;
703 706
 				// send SSO request
704
-			}
705
-			else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
707
+			} else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri()))
706 708
 			{
707 709
 				setcookie('sso', md5(self::getRequestUri()), 0, '/');
708 710
 				$url = sprintf("%s?default_url=%s", $default_url, base64_encode(self::getRequestUrl()));
@@ -760,8 +762,7 @@  discard block
 block discarded – undo
760 762
 		if($self->site_title)
761 763
 		{
762 764
 			$self->site_title .= ' - ' . $site_title;
763
-		}
764
-		else
765
+		} else
765 766
 		{
766 767
 			$self->site_title = $site_title;
767 768
 		}
@@ -861,8 +862,7 @@  discard block
 block discarded – undo
861 862
 		{
862 863
 			$self->loaded_lang_files[] = $filename;
863 864
 			include($filename);
864
-		}
865
-		else
865
+		} else
866 866
 		{
867 867
 			$self->_evalxmlLang($path);
868 868
 		}
@@ -878,7 +878,9 @@  discard block
 block discarded – undo
878 878
 	{
879 879
 		global $lang;
880 880
 
881
-		if(!$path) return;
881
+		if(!$path) {
882
+			return;
883
+		}
882 884
 
883 885
 		$_path = 'eval://' . $path;
884 886
 
@@ -910,7 +912,9 @@  discard block
 block discarded – undo
910 912
 	 */
911 913
 	function _loadXmlLang($path)
912 914
 	{
913
-		if(!$path) return;
915
+		if(!$path) {
916
+			return;
917
+		}
914 918
 
915 919
 		$oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type);
916 920
 		return $oXmlLangParser->compile();
@@ -924,7 +928,9 @@  discard block
 block discarded – undo
924 928
 	 */
925 929
 	function _loadPhpLang($path)
926 930
 	{
927
-		if(!$path) return;
931
+		if(!$path) {
932
+			return;
933
+		}
928 934
 
929 935
 		if(substr_compare($path, '/', -1) !== 0)
930 936
 		{
@@ -1060,12 +1066,14 @@  discard block
 block discarded – undo
1060 1066
 		static $flag = TRUE;
1061 1067
 		if($charset)
1062 1068
 		{
1063
-			if(is_array($val))
1064
-				array_walk($val,'Context::checkConvertFlag',$charset);
1065
-			else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE;
1066
-			else $flag = FALSE;
1067
-		}
1068
-		else
1069
+			if(is_array($val)) {
1070
+							array_walk($val,'Context::checkConvertFlag',$charset);
1071
+			} else if($val && iconv($charset,$charset,$val)!=$val) {
1072
+				$flag = FALSE;
1073
+			} else {
1074
+				$flag = FALSE;
1075
+			}
1076
+		} else
1069 1077
 		{
1070 1078
 			$return = $flag;
1071 1079
 			$flag = TRUE;
@@ -1087,8 +1095,9 @@  discard block
 block discarded – undo
1087 1095
 		if (is_array($val))
1088 1096
 		{
1089 1097
 			array_walk($val,'Context::doConvertEncoding',$charset);
1098
+		} else {
1099
+			$val = iconv($charset,'UTF-8',$val);
1090 1100
 		}
1091
-		else $val = iconv($charset,'UTF-8',$val);
1092 1101
 	}
1093 1102
 
1094 1103
 	/**
@@ -1099,7 +1108,9 @@  discard block
 block discarded – undo
1099 1108
 	 */
1100 1109
 	function convertEncodingStr($str)
1101 1110
 	{
1102
-        if(!$str) return null;
1111
+        if(!$str) {
1112
+        	return null;
1113
+        }
1103 1114
 		$obj = new stdClass();
1104 1115
 		$obj->str = $str;
1105 1116
 		$obj = self::convertEncoding($obj);
@@ -1212,16 +1223,13 @@  discard block
 block discarded – undo
1212 1223
 			if($requestMethod == 'GET' && isset($_GET[$key]))
1213 1224
 			{
1214 1225
 				$set_to_vars = TRUE;
1215
-			}
1216
-			elseif($requestMethod == 'POST' && isset($_POST[$key]))
1226
+			} elseif($requestMethod == 'POST' && isset($_POST[$key]))
1217 1227
 			{
1218 1228
 				$set_to_vars = TRUE;
1219
-			}
1220
-			elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1229
+			} elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key])))
1221 1230
 			{
1222 1231
 				$set_to_vars = TRUE;
1223
-			}
1224
-			else
1232
+			} else
1225 1233
 			{
1226 1234
 				$set_to_vars = FALSE;
1227 1235
 			}
@@ -1247,8 +1255,7 @@  discard block
 block discarded – undo
1247 1255
 					return;
1248 1256
 				}
1249 1257
 			}
1250
-		}
1251
-		else if(is_array($val))
1258
+		} else if(is_array($val))
1252 1259
 		{
1253 1260
 			foreach($val as $val2)
1254 1261
 			{
@@ -1388,16 +1395,13 @@  discard block
 block discarded – undo
1388 1395
 			if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0)
1389 1396
 			{
1390 1397
 				$result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v;
1391
-			}
1392
-			elseif($key === 'mid' || $key === 'search_keyword')
1398
+			} elseif($key === 'mid' || $key === 'search_keyword')
1393 1399
 			{
1394 1400
 				$result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1395
-			}
1396
-			elseif($key === 'vid')
1401
+			} elseif($key === 'vid')
1397 1402
 			{
1398 1403
 				$result[$k] = urlencode($v);
1399
-			}
1400
-			else
1404
+			} else
1401 1405
 			{
1402 1406
 				$result[$k] = $v;
1403 1407
 
@@ -1451,8 +1455,7 @@  discard block
 block discarded – undo
1451 1455
 				$val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE);
1452 1456
 				$this->set($key, $val, TRUE);
1453 1457
 				$this->is_uploaded = TRUE;
1454
-			}
1455
-			else
1458
+			} else
1456 1459
 			{
1457 1460
 				for($i = 0, $c = count($tmp_name); $i < $c; $i++)
1458 1461
 				{
@@ -1558,8 +1561,7 @@  discard block
 block discarded – undo
1558 1561
 			if($site_module_info->domain && isSiteID($site_module_info->domain))
1559 1562
 			{
1560 1563
 				$vid = $site_module_info->domain;
1561
-			}
1562
-			else
1564
+			} else
1563 1565
 			{
1564 1566
 				$domain = $site_module_info->domain;
1565 1567
 			}
@@ -1576,8 +1578,7 @@  discard block
 block discarded – undo
1576 1578
 			if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path'])
1577 1579
 			{
1578 1580
 				unset($domain);
1579
-			}
1580
-			else
1581
+			} else
1581 1582
 			{
1582 1583
 				$domain = preg_replace('/^(http|https):\/\//i', '', trim($domain));
1583 1584
 				if(substr_compare($domain, '/', -1) !== 0)
@@ -1597,8 +1598,7 @@  discard block
 block discarded – undo
1597 1598
 			{
1598 1599
 				array_shift($args_list);
1599 1600
 			}
1600
-		}
1601
-		else
1601
+		} else
1602 1602
 		{
1603 1603
 			// Otherwise, make GET variables into array
1604 1604
 			$get_vars = get_object_vars($self->get_vars);
@@ -1625,8 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 		if($vid)
1626 1626
 		{
1627 1627
 			$get_vars['vid'] = $vid;
1628
-		}
1629
-		else
1628
+		} else
1630 1629
 		{
1631 1630
 			unset($get_vars['vid']);
1632 1631
 		}
@@ -1698,8 +1697,7 @@  discard block
 block discarded – undo
1698 1697
 						{
1699 1698
 							$queries[] = $key . '[' . $k . ']=' . urlencode($v);
1700 1699
 						}
1701
-					}
1702
-					elseif(!is_array($val))
1700
+					} elseif(!is_array($val))
1703 1701
 					{
1704 1702
 						$queries[] = $key . '=' . urlencode($val);
1705 1703
 					}
@@ -1717,25 +1715,23 @@  discard block
 block discarded – undo
1717 1715
 		{
1718 1716
 			$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1719 1717
 			// optional SSL use
1720
-		}
1721
-		elseif($_use_ssl == 'optional')
1718
+		} elseif($_use_ssl == 'optional')
1722 1719
 		{
1723 1720
 			$ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL;
1724 1721
 			$query = $self->getRequestUri($ssl_mode, $domain) . $query;
1725 1722
 			// no SSL
1726
-		}
1727
-		else
1723
+		} else
1728 1724
 		{
1729 1725
 			// currently on SSL but target is not based on SSL
1730 1726
 			if($_SERVER['HTTPS'] == 'on')
1731 1727
 			{
1732 1728
 				$query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query;
1733
-			}
1734
-			else if($domain) // if $domain is set
1729
+			} else if($domain) {
1730
+				// if $domain is set
1735 1731
 			{
1736 1732
 				$query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query;
1737 1733
 			}
1738
-			else
1734
+			} else
1739 1735
 			{
1740 1736
 				$query = getScriptPath() . $query;
1741 1737
 			}
@@ -1792,8 +1788,7 @@  discard block
 block discarded – undo
1792 1788
 		if($domain)
1793 1789
 		{
1794 1790
 			$domain_key = md5($domain);
1795
-		}
1796
-		else
1791
+		} else
1797 1792
 		{
1798 1793
 			$domain_key = 'default';
1799 1794
 		}
@@ -1822,8 +1817,7 @@  discard block
 block discarded – undo
1822 1817
 			{
1823 1818
 				$target_url.= '/';
1824 1819
 			}
1825
-		}
1826
-		else
1820
+		} else
1827 1821
 		{
1828 1822
 			$target_url = $_SERVER['HTTP_HOST'] . getScriptPath();
1829 1823
 		}
@@ -1841,20 +1835,17 @@  discard block
 block discarded – undo
1841 1835
 			if($port && $port != 443)
1842 1836
 			{
1843 1837
 				$url_info['port'] = $port;
1844
-			}
1845
-			elseif($url_info['port'] == 443)
1838
+			} elseif($url_info['port'] == 443)
1846 1839
 			{
1847 1840
 				unset($url_info['port']);
1848 1841
 			}
1849
-		}
1850
-		else
1842
+		} else
1851 1843
 		{
1852 1844
 			$port = self::get('_http_port');
1853 1845
 			if($port && $port != 80)
1854 1846
 			{
1855 1847
 				$url_info['port'] = $port;
1856
-			}
1857
-			elseif($url_info['port'] == 80)
1848
+			} elseif($url_info['port'] == 80)
1858 1849
 			{
1859 1850
 				unset($url_info['port']);
1860 1851
 			}
@@ -2090,8 +2081,7 @@  discard block
 block discarded – undo
2090 2081
 		if(strpos($file, './') === 0)
2091 2082
 		{
2092 2083
 			$file = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($file, 2);
2093
-		}
2094
-		elseif(strpos($file, '../') === 0)
2084
+		} elseif(strpos($file, '../') === 0)
2095 2085
 		{
2096 2086
 			$file = self::normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$file}");
2097 2087
 		}
@@ -2353,8 +2343,7 @@  discard block
 block discarded – undo
2353 2343
 			if(substr_compare($filename, '.js', -3) === 0)
2354 2344
 			{
2355 2345
 				$result->jsList[] = $plugin_path . $filename;
2356
-			}
2357
-			elseif(substr_compare($filename, '.css', -4) === 0)
2346
+			} elseif(substr_compare($filename, '.css', -4) === 0)
2358 2347
 			{
2359 2348
 				$result->cssList[] = $plugin_path . $filename;
2360 2349
 			}
@@ -2611,8 +2600,7 @@  discard block
 block discarded – undo
2611 2600
 			if(count($_base) > 0)
2612 2601
 			{
2613 2602
 				array_shift($_base);
2614
-			}
2615
-			else
2603
+			} else
2616 2604
 			{
2617 2605
 				array_unshift($_base, '..');
2618 2606
 			}
Please login to merge, or discard this patch.
classes/db/DB.class.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 * Returns counter cache data
672 672
 	 * @param array|string $tables tables to get data
673 673
 	 * @param string $condition condition to get data
674
-	 * @return int count of cache data
674
+	 * @return boolean count of cache data
675 675
 	 */
676 676
 	function getCountCache($tables, $condition)
677 677
 	{
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 	 * @param array|string $tables tables to save data
732 732
 	 * @param string $condition condition to save data
733 733
 	 * @param int $count count of cache data to save
734
-	 * @return void
734
+	 * @return boolean
735 735
 	 */
736 736
 	function putCountCache($tables, $condition, $count = 0)
737 737
 	{
@@ -1242,7 +1242,7 @@  discard block
 block discarded – undo
1242 1242
 	 * DB Connect
1243 1243
 	 * this method is protected
1244 1244
 	 * @param array $connection
1245
-	 * @return void
1245
+	 * @return resource
1246 1246
 	 */
1247 1247
 	function __connect($connection)
1248 1248
 	{
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	function &getInstance($db_type = NULL)
143 143
 	{
144
-		if(!$db_type)
144
+		if (!$db_type)
145 145
 		{
146 146
 			$db_type = Context::getDBType();
147 147
 		}
148
-		if(!$db_type && Context::isInstalled())
148
+		if (!$db_type && Context::isInstalled())
149 149
 		{
150 150
 			return new Object(-1, 'msg_db_not_setted');
151 151
 		}
152 152
 
153
-		if(!isset($GLOBALS['__DB__']))
153
+		if (!isset($GLOBALS['__DB__']))
154 154
 		{
155 155
 			$GLOBALS['__DB__'] = array();
156 156
 		}
157
-		if(!isset($GLOBALS['__DB__'][$db_type]))
157
+		if (!isset($GLOBALS['__DB__'][$db_type]))
158 158
 		{
159 159
 			$class_name = 'DB' . ucfirst($db_type);
160 160
 			$class_file = _XE_PATH_ . "classes/db/$class_name.class.php";
161
-			if(!file_exists($class_file))
161
+			if (!file_exists($class_file))
162 162
 			{
163 163
 				return new Object(-1, 'msg_db_not_setted');
164 164
 			}
@@ -212,18 +212,18 @@  discard block
 block discarded – undo
212 212
 	{
213 213
 		is_a($this, 'DB') ? $self = $this : $self = self::getInstance();
214 214
 		
215
-		if(!$self->supported_list)
215
+		if (!$self->supported_list)
216 216
 		{
217 217
 			$oDB = new DB();
218 218
 			$self->supported_list = $oDB->_getSupportedList();
219 219
 		}
220 220
 
221 221
 		$enableList = array();
222
-		if(is_array($self->supported_list))
222
+		if (is_array($self->supported_list))
223 223
 		{
224
-			foreach($self->supported_list AS $key => $value)
224
+			foreach ($self->supported_list AS $key => $value)
225 225
 			{
226
-				if($value->enable)
226
+				if ($value->enable)
227 227
 				{
228 228
 					$enableList[] = $value;
229 229
 				}
@@ -241,18 +241,18 @@  discard block
 block discarded – undo
241 241
 	{
242 242
 		is_a($this, 'DB') ? $self = $this : $self = self::getInstance();
243 243
 		
244
-		if(!$self->supported_list)
244
+		if (!$self->supported_list)
245 245
 		{
246 246
 			$oDB = new DB();
247 247
 			$self->supported_list = $oDB->_getSupportedList();
248 248
 		}
249 249
 
250 250
 		$disableList = array();
251
-		if(is_array($self->supported_list))
251
+		if (is_array($self->supported_list))
252 252
 		{
253
-			foreach($self->supported_list AS $key => $value)
253
+			foreach ($self->supported_list AS $key => $value)
254 254
 			{
255
-				if(!$value->enable)
255
+				if (!$value->enable)
256 256
 				{
257 257
 					$disableList[] = $value;
258 258
 				}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	function _getSupportedList()
270 270
 	{
271 271
 		static $get_supported_list = '';
272
-		if(is_array($get_supported_list))
272
+		if (is_array($get_supported_list))
273 273
 		{
274 274
 			$this->supported_list = $get_supported_list;
275 275
 			return $this->supported_list;
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 		$supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE);
281 281
 
282 282
 		// after creating instance of class, check is supported
283
-		for($i = 0; $i < count($supported_list); $i++)
283
+		for ($i = 0; $i < count($supported_list); $i++)
284 284
 		{
285 285
 			$db_type = $supported_list[$i];
286 286
 
287 287
 			$class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1)));
288 288
 			$class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name);
289
-			if(!file_exists($class_file))
289
+			if (!file_exists($class_file))
290 290
 			{
291 291
 				continue;
292 292
 			}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			require_once($class_file);
296 296
 			$oDB = new $class_name();
297 297
 
298
-			if(!$oDB)
298
+			if (!$oDB)
299 299
 			{
300 300
 				continue;
301 301
 			}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	function _sortDBMS($a, $b)
321 321
 	{
322
-		if(!isset($this->priority_dbms[$a->db_type]))
322
+		if (!isset($this->priority_dbms[$a->db_type]))
323 323
 		{
324 324
 			$priority_a = 0;
325 325
 		}
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 			$priority_a = $this->priority_dbms[$a->db_type];
329 329
 		}
330 330
 
331
-		if(!isset($this->priority_dbms[$b->db_type]))
331
+		if (!isset($this->priority_dbms[$b->db_type]))
332 332
 		{
333 333
 			$priority_b = 0;
334 334
 		}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			$priority_b = $this->priority_dbms[$b->db_type];
338 338
 		}
339 339
 
340
-		if($priority_a == $priority_b)
340
+		if ($priority_a == $priority_b)
341 341
 		{
342 342
 			return 0;
343 343
 		}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 */
364 364
 	function isConnected($type = 'master', $indx = 0)
365 365
 	{
366
-		if($type == 'master')
366
+		if ($type == 'master')
367 367
 		{
368 368
 			return $this->master_db["is_connected"] ? TRUE : FALSE;
369 369
 		}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	function actFinish()
394 394
 	{
395
-		if(!$this->query)
395
+		if (!$this->query)
396 396
 		{
397 397
 			return;
398 398
 		}
@@ -413,37 +413,37 @@  discard block
 block discarded – undo
413 413
 
414 414
 		$bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace();
415 415
 
416
-		foreach($bt as $no => $call)
416
+		foreach ($bt as $no => $call)
417 417
 		{
418
-			if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray')
418
+			if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray')
419 419
 			{
420 420
 				$call_no = $no;
421 421
 				$call_no++;
422
-				$log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line'];
423
-				$log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']);
422
+				$log['called_file'] = $bt[$call_no]['file'] . ':' . $bt[$call_no]['line'];
423
+				$log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']);
424 424
 				$call_no++;
425
-				$log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function'];
425
+				$log['called_method'] = $bt[$call_no]['class'] . $bt[$call_no]['type'] . $bt[$call_no]['function'];
426 426
 				break;
427 427
 			}
428 428
 		}
429 429
 
430 430
 		// leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined)
431
-		if($this->isError())
431
+		if ($this->isError())
432 432
 		{
433 433
 			$log['result'] = 'Failed';
434 434
 			$log['errno'] = $this->errno;
435 435
 			$log['errstr'] = $this->errstr;
436 436
 
437
-			if(__DEBUG_DB_OUTPUT__ == 1)
437
+			if (__DEBUG_DB_OUTPUT__ == 1)
438 438
 			{
439 439
 				$debug_file = _XE_PATH_ . "files/_debug_db_query.php";
440 440
 				$buff = array();
441
-				if(!file_exists($debug_file))
441
+				if (!file_exists($debug_file))
442 442
 				{
443 443
 					$buff[] = '<?php exit(); ?' . '>';
444 444
 				}
445 445
 				$buff[] = print_r($log, TRUE);
446
-				@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX);
446
+				@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND | LOCK_EX);
447 447
 			}
448 448
 		}
449 449
 		else
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 	{
515 515
 		static $cache_file = array();
516 516
 
517
-		if(!$query_id)
517
+		if (!$query_id)
518 518
 		{
519 519
 			return new Object(-1, 'msg_invalid_queryid');
520 520
 		}
521
-		if(!$this->db_type)
521
+		if (!$this->db_type)
522 522
 		{
523 523
 			return;
524 524
 		}
@@ -527,20 +527,20 @@  discard block
 block discarded – undo
527 527
 
528 528
 		$this->query_id = $query_id;
529 529
 
530
-		if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id]))
530
+		if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id]))
531 531
 		{
532 532
 			$id_args = explode('.', $query_id);
533
-			if(count($id_args) == 2)
533
+			if (count($id_args) == 2)
534 534
 			{
535 535
 				$target = 'modules';
536 536
 				$module = $id_args[0];
537 537
 				$id = $id_args[1];
538 538
 			}
539
-			elseif(count($id_args) == 3)
539
+			elseif (count($id_args) == 3)
540 540
 			{
541 541
 				$target = $id_args[0];
542 542
 				$typeList = array('addons' => 1, 'widgets' => 1);
543
-				if(!isset($typeList[$target]))
543
+				if (!isset($typeList[$target]))
544 544
 				{
545 545
 					$this->actDBClassFinish();
546 546
 					return;
@@ -548,14 +548,14 @@  discard block
 block discarded – undo
548 548
 				$module = $id_args[1];
549 549
 				$id = $id_args[2];
550 550
 			}
551
-			if(!$target || !$module || !$id)
551
+			if (!$target || !$module || !$id)
552 552
 			{
553 553
 				$this->actDBClassFinish();
554 554
 				return new Object(-1, 'msg_invalid_queryid');
555 555
 			}
556 556
 
557 557
 			$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
558
-			if(!file_exists($xml_file))
558
+			if (!file_exists($xml_file))
559 559
 			{
560 560
 				$this->actDBClassFinish();
561 561
 				return new Object(-1, 'msg_invalid_queryid');
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
 		$cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type);
584 584
 
585 585
 		$cache_time = -1;
586
-		if(file_exists($cache_file))
586
+		if (file_exists($cache_file))
587 587
 		{
588 588
 			$cache_time = filemtime($cache_file);
589 589
 		}
590 590
 
591 591
 		// if there is no cache file or is not new, find original xml query file and parse it
592
-		if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php'))
592
+		if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php'))
593 593
 		{
594 594
 			$oParser = new XmlQueryParser();
595 595
 			$oParser->parse($query_id, $xml_file, $cache_file);
@@ -610,27 +610,27 @@  discard block
 block discarded – undo
610 610
 	{
611 611
 		global $lang;
612 612
 		
613
-		if(!in_array($type, array('master','slave'))) $type = 'slave';
613
+		if (!in_array($type, array('master', 'slave'))) $type = 'slave';
614 614
 
615
-		if(!file_exists($cache_file))
615
+		if (!file_exists($cache_file))
616 616
 		{
617 617
 			return new Object(-1, 'msg_invalid_queryid');
618 618
 		}
619 619
 
620
-		if($source_args)
620
+		if ($source_args)
621 621
 		{
622 622
 			$args = clone $source_args;
623 623
 		}
624 624
 
625 625
 		$output = include($cache_file);
626 626
 
627
-		if((is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) && !$output->toBool())
627
+		if ((is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) && !$output->toBool())
628 628
 		{
629 629
 			return $output;
630 630
 		}
631 631
 
632 632
 		// execute appropriate query
633
-		switch($output->getAction())
633
+		switch ($output->getAction())
634 634
 		{
635 635
 			case 'insert' :
636 636
 			case 'insert-select' :
@@ -653,11 +653,11 @@  discard block
 block discarded – undo
653 653
 				break;
654 654
 		}
655 655
 
656
-		if($this->isError())
656
+		if ($this->isError())
657 657
 		{
658 658
 			$output = $this->getError();
659 659
 		}
660
-		else if(!is_a($output, 'XEObject') && !is_subclass_of($output, 'XEObject'))
660
+		else if (!is_a($output, 'XEObject') && !is_subclass_of($output, 'XEObject'))
661 661
 		{
662 662
 			$output = new Object();
663 663
 		}
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 	 */
804 804
 	function dropTable($table_name)
805 805
 	{
806
-		if(!$table_name)
806
+		if (!$table_name)
807 807
 		{
808 808
 			return;
809 809
 		}
@@ -820,54 +820,54 @@  discard block
 block discarded – undo
820 820
 	function getSelectSql($query, $with_values = TRUE)
821 821
 	{
822 822
 		$select = $query->getSelectString($with_values);
823
-		if($select == '')
823
+		if ($select == '')
824 824
 		{
825 825
 			return new Object(-1, "Invalid query");
826 826
 		}
827 827
 		$select = 'SELECT ' . $select;
828 828
 
829 829
 		$from = $query->getFromString($with_values);
830
-		if($from == '')
830
+		if ($from == '')
831 831
 		{
832 832
 			return new Object(-1, "Invalid query");
833 833
 		}
834 834
 		$from = ' FROM ' . $from;
835 835
 
836 836
 		$where = $query->getWhereString($with_values);
837
-		if($where != '')
837
+		if ($where != '')
838 838
 		{
839 839
 			$where = ' WHERE ' . $where;
840 840
 		}
841 841
 
842 842
 		$tableObjects = $query->getTables();
843 843
 		$index_hint_list = '';
844
-		foreach($tableObjects as $tableObject)
844
+		foreach ($tableObjects as $tableObject)
845 845
 		{
846
-			if(is_a($tableObject, 'CubridTableWithHint'))
846
+			if (is_a($tableObject, 'CubridTableWithHint'))
847 847
 			{
848 848
 				$index_hint_list .= $tableObject->getIndexHintString() . ', ';
849 849
 			}
850 850
 		}
851 851
 		$index_hint_list = substr($index_hint_list, 0, -2);
852
-		if($index_hint_list != '')
852
+		if ($index_hint_list != '')
853 853
 		{
854 854
 			$index_hint_list = 'USING INDEX ' . $index_hint_list;
855 855
 		}
856 856
 
857 857
 		$groupBy = $query->getGroupByString();
858
-		if($groupBy != '')
858
+		if ($groupBy != '')
859 859
 		{
860 860
 			$groupBy = ' GROUP BY ' . $groupBy;
861 861
 		}
862 862
 
863 863
 		$orderBy = $query->getOrderByString();
864
-		if($orderBy != '')
864
+		if ($orderBy != '')
865 865
 		{
866 866
 			$orderBy = ' ORDER BY ' . $orderBy;
867 867
 		}
868 868
 
869 869
 		$limit = $query->getLimitString();
870
-		if($limit != '')
870
+		if ($limit != '')
871 871
 		{
872 872
 			$limit = ' LIMIT ' . $limit;
873 873
 		}
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	{
891 891
 		$new_update_columns = array();
892 892
 		$click_count_columns = $queryObject->getClickCountColumns();
893
-		foreach($click_count_columns as $click_count_column)
893
+		foreach ($click_count_columns as $click_count_column)
894 894
 		{
895 895
 			$click_count_column_name = $click_count_column->column_name;
896 896
 
@@ -922,14 +922,14 @@  discard block
 block discarded – undo
922 922
 		$sql .= $tables[0]->getAlias();
923 923
 
924 924
 		$from = $query->getFromString($with_values);
925
-		if($from == '')
925
+		if ($from == '')
926 926
 		{
927 927
 			return new Object(-1, "Invalid query");
928 928
 		}
929 929
 		$sql .= ' FROM ' . $from;
930 930
 
931 931
 		$where = $query->getWhereString($with_values);
932
-		if($where != '')
932
+		if ($where != '')
933 933
 		{
934 934
 			$sql .= ' WHERE ' . $where;
935 935
 		}
@@ -947,19 +947,19 @@  discard block
 block discarded – undo
947 947
 	function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE)
948 948
 	{
949 949
 		$columnsList = $query->getUpdateString($with_values);
950
-		if($columnsList == '')
950
+		if ($columnsList == '')
951 951
 		{
952 952
 			return new Object(-1, "Invalid query");
953 953
 		}
954 954
 
955 955
 		$tables = $query->getFromString($with_values);
956
-		if($tables == '')
956
+		if ($tables == '')
957 957
 		{
958 958
 			return new Object(-1, "Invalid query");
959 959
 		}
960 960
 
961 961
 		$where = $query->getWhereString($with_values);
962
-		if($where != '')
962
+		if ($where != '')
963 963
 		{
964 964
 			$where = ' WHERE ' . $where;
965 965
 		}
@@ -1004,9 +1004,9 @@  discard block
 block discarded – undo
1004 1004
 	 */
1005 1005
 	function _getConnection($type = 'master', $indx = NULL)
1006 1006
 	{
1007
-		if($type == 'master')
1007
+		if ($type == 'master')
1008 1008
 		{
1009
-			if(!$this->master_db['is_connected'])
1009
+			if (!$this->master_db['is_connected'])
1010 1010
 			{
1011 1011
 				$this->_connect($type);
1012 1012
 			}
@@ -1014,12 +1014,12 @@  discard block
 block discarded – undo
1014 1014
 			return $this->master_db["resource"];
1015 1015
 		}
1016 1016
 
1017
-		if($indx === NULL)
1017
+		if ($indx === NULL)
1018 1018
 		{
1019 1019
 			$indx = $this->_getSlaveConnectionStringIndex($type);
1020 1020
 		}
1021 1021
 
1022
-		if(!$this->slave_db[$indx]['is_connected'])
1022
+		if (!$this->slave_db[$indx]['is_connected'])
1023 1023
 		{
1024 1024
 			$this->_connect($type, $indx);
1025 1025
 		}
@@ -1034,11 +1034,11 @@  discard block
 block discarded – undo
1034 1034
 	 */
1035 1035
 	function _dbInfoExists()
1036 1036
 	{
1037
-		if(!$this->master_db)
1037
+		if (!$this->master_db)
1038 1038
 		{
1039 1039
 			return FALSE;
1040 1040
 		}
1041
-		if(count($this->slave_db) === 0)
1041
+		if (count($this->slave_db) === 0)
1042 1042
 		{
1043 1043
 			return FALSE;
1044 1044
 		}
@@ -1064,12 +1064,12 @@  discard block
 block discarded – undo
1064 1064
 	 */
1065 1065
 	function close($type = 'master', $indx = 0)
1066 1066
 	{
1067
-		if(!$this->isConnected($type, $indx))
1067
+		if (!$this->isConnected($type, $indx))
1068 1068
 		{
1069 1069
 			return;
1070 1070
 		}
1071 1071
 
1072
-		if($type == 'master')
1072
+		if ($type == 'master')
1073 1073
 		{
1074 1074
 			$connection = &$this->master_db;
1075 1075
 		}
@@ -1100,12 +1100,12 @@  discard block
 block discarded – undo
1100 1100
 	 */
1101 1101
 	function begin()
1102 1102
 	{
1103
-		if(!$this->isConnected())
1103
+		if (!$this->isConnected())
1104 1104
 		{
1105 1105
 			return;
1106 1106
 		}
1107 1107
 
1108
-		if($this->_begin($this->transactionNestedLevel))
1108
+		if ($this->_begin($this->transactionNestedLevel))
1109 1109
 		{
1110 1110
 			$this->transaction_started = TRUE;
1111 1111
 			$this->transactionNestedLevel++;
@@ -1128,15 +1128,15 @@  discard block
 block discarded – undo
1128 1128
 	 */
1129 1129
 	function rollback()
1130 1130
 	{
1131
-		if(!$this->isConnected() || !$this->transaction_started)
1131
+		if (!$this->isConnected() || !$this->transaction_started)
1132 1132
 		{
1133 1133
 			return;
1134 1134
 		}
1135
-		if($this->_rollback($this->transactionNestedLevel))
1135
+		if ($this->_rollback($this->transactionNestedLevel))
1136 1136
 		{
1137 1137
 			$this->transactionNestedLevel--;
1138 1138
 
1139
-			if(!$this->transactionNestedLevel)
1139
+			if (!$this->transactionNestedLevel)
1140 1140
 			{
1141 1141
 				$this->transaction_started = FALSE;
1142 1142
 			}
@@ -1160,11 +1160,11 @@  discard block
 block discarded – undo
1160 1160
 	 */
1161 1161
 	function commit($force = FALSE)
1162 1162
 	{
1163
-		if(!$force && (!$this->isConnected() || !$this->transaction_started))
1163
+		if (!$force && (!$this->isConnected() || !$this->transaction_started))
1164 1164
 		{
1165 1165
 			return;
1166 1166
 		}
1167
-		if($this->transactionNestedLevel == 1 && $this->_commit())
1167
+		if ($this->transactionNestedLevel == 1 && $this->_commit())
1168 1168
 		{
1169 1169
 			$this->transaction_started = FALSE;
1170 1170
 			$this->transactionNestedLevel = 0;
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 	 */
1197 1197
 	function _query($query, $connection = NULL)
1198 1198
 	{
1199
-		if($connection == NULL)
1199
+		if ($connection == NULL)
1200 1200
 		{
1201 1201
 			$connection = $this->_getConnection('master');
1202 1202
 		}
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 	{
1222 1222
 		$db_info = Context::getDBInfo();
1223 1223
 		$this->master_db = $db_info->master_db;
1224
-		if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"]
1224
+		if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"]
1225 1225
 				&& $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"]
1226 1226
 				&& $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"]
1227 1227
 				&& $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"]
@@ -1269,18 +1269,18 @@  discard block
 block discarded – undo
1269 1269
 	 */
1270 1270
 	function _connect($type = 'master', $indx = 0)
1271 1271
 	{
1272
-		if($this->isConnected($type, $indx))
1272
+		if ($this->isConnected($type, $indx))
1273 1273
 		{
1274 1274
 			return;
1275 1275
 		}
1276 1276
 
1277 1277
 		// Ignore if no DB information exists
1278
-		if(!$this->_dbInfoExists())
1278
+		if (!$this->_dbInfoExists())
1279 1279
 		{
1280 1280
 			return;
1281 1281
 		}
1282 1282
 
1283
-		if($type == 'master')
1283
+		if ($type == 'master')
1284 1284
 		{
1285 1285
 			$connection = &$this->master_db;
1286 1286
 		}
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 		}
1291 1291
 
1292 1292
 		$result = $this->__connect($connection);
1293
-		if($result === NULL || $result === FALSE)
1293
+		if ($result === NULL || $result === FALSE)
1294 1294
 		{
1295 1295
 			$connection["is_connected"] = FALSE;
1296 1296
 			return;
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 	 */
1327 1327
 	function actDBClassFinish()
1328 1328
 	{
1329
-		if(!$this->query)
1329
+		if (!$this->query)
1330 1330
 		{
1331 1331
 			return;
1332 1332
 		}
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 	function &getParser($force = FALSE)
1350 1350
 	{
1351 1351
 		static $dbParser = NULL;
1352
-		if(!$dbParser || $force)
1352
+		if (!$dbParser || $force)
1353 1353
 		{
1354 1354
 			$oDB = DB::getInstance();
1355 1355
 			$dbParser = $oDB->getParser();
Please login to merge, or discard this patch.
Braces   +13 added lines, -21 removed lines patch added patch discarded remove patch
@@ -322,8 +322,7 @@  discard block
 block discarded – undo
322 322
 		if(!isset($this->priority_dbms[$a->db_type]))
323 323
 		{
324 324
 			$priority_a = 0;
325
-		}
326
-		else
325
+		} else
327 326
 		{
328 327
 			$priority_a = $this->priority_dbms[$a->db_type];
329 328
 		}
@@ -331,8 +330,7 @@  discard block
 block discarded – undo
331 330
 		if(!isset($this->priority_dbms[$b->db_type]))
332 331
 		{
333 332
 			$priority_b = 0;
334
-		}
335
-		else
333
+		} else
336 334
 		{
337 335
 			$priority_b = $this->priority_dbms[$b->db_type];
338 336
 		}
@@ -366,8 +364,7 @@  discard block
 block discarded – undo
366 364
 		if($type == 'master')
367 365
 		{
368 366
 			return $this->master_db["is_connected"] ? TRUE : FALSE;
369
-		}
370
-		else
367
+		} else
371 368
 		{
372 369
 			return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE;
373 370
 		}
@@ -445,8 +442,7 @@  discard block
 block discarded – undo
445 442
 				$buff[] = print_r($log, TRUE);
446 443
 				@file_put_contents($log_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX);
447 444
 			}
448
-		}
449
-		else
445
+		} else
450 446
 		{
451 447
 			$log['result'] = 'Success';
452 448
 		}
@@ -535,8 +531,7 @@  discard block
 block discarded – undo
535 531
 				$target = 'modules';
536 532
 				$module = $id_args[0];
537 533
 				$id = $id_args[1];
538
-			}
539
-			elseif(count($id_args) == 3)
534
+			} elseif(count($id_args) == 3)
540 535
 			{
541 536
 				$target = $id_args[0];
542 537
 				$typeList = array('addons' => 1, 'widgets' => 1);
@@ -610,7 +605,9 @@  discard block
 block discarded – undo
610 605
 	{
611 606
 		global $lang;
612 607
 		
613
-		if(!in_array($type, array('master','slave'))) $type = 'slave';
608
+		if(!in_array($type, array('master','slave'))) {
609
+			$type = 'slave';
610
+		}
614 611
 
615 612
 		if(!file_exists($cache_file))
616 613
 		{
@@ -656,8 +653,7 @@  discard block
 block discarded – undo
656 653
 		if($this->isError())
657 654
 		{
658 655
 			$output = $this->getError();
659
-		}
660
-		else if(!is_a($output, 'XEObject') && !is_subclass_of($output, 'XEObject'))
656
+		} else if(!is_a($output, 'XEObject') && !is_subclass_of($output, 'XEObject'))
661 657
 		{
662 658
 			$output = new Object();
663 659
 		}
@@ -1072,8 +1068,7 @@  discard block
 block discarded – undo
1072 1068
 		if($type == 'master')
1073 1069
 		{
1074 1070
 			$connection = &$this->master_db;
1075
-		}
1076
-		else
1071
+		} else
1077 1072
 		{
1078 1073
 			$connection = &$this->slave_db[$indx];
1079 1074
 		}
@@ -1168,8 +1163,7 @@  discard block
 block discarded – undo
1168 1163
 		{
1169 1164
 			$this->transaction_started = FALSE;
1170 1165
 			$this->transactionNestedLevel = 0;
1171
-		}
1172
-		else
1166
+		} else
1173 1167
 		{
1174 1168
 			$this->transactionNestedLevel--;
1175 1169
 		}
@@ -1229,8 +1223,7 @@  discard block
 block discarded – undo
1229 1223
 		)
1230 1224
 		{
1231 1225
 			$this->slave_db[0] = &$this->master_db;
1232
-		}
1233
-		else
1226
+		} else
1234 1227
 		{
1235 1228
 			$this->slave_db = $db_info->slave_db;
1236 1229
 		}
@@ -1283,8 +1276,7 @@  discard block
 block discarded – undo
1283 1276
 		if($type == 'master')
1284 1277
 		{
1285 1278
 			$connection = &$this->master_db;
1286
-		}
1287
-		else
1279
+		} else
1288 1280
 		{
1289 1281
 			$connection = &$this->slave_db[$indx];
1290 1282
 		}
Please login to merge, or discard this patch.
classes/module/ModuleObject.class.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 * */
45 45
 	function setModulePath($path)
46 46
 	{
47
-		if(substr_compare($path, '/', -1) !== 0)
47
+		if (substr_compare($path, '/', -1) !== 0)
48 48
 		{
49
-			$path.='/';
49
+			$path .= '/';
50 50
 		}
51 51
 		$this->module_path = $path;
52 52
 	}
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 	function setRedirectUrl($url = './', $output = NULL)
61 61
 	{
62 62
 		$ajaxRequestMethod = array_flip($this->ajaxRequestMethod);
63
-		if(!isset($ajaxRequestMethod[Context::getRequestMethod()]))
63
+		if (!isset($ajaxRequestMethod[Context::getRequestMethod()]))
64 64
 		{
65 65
 			$this->add('redirect_url', $url);
66 66
 		}
67 67
 
68
-		if($output !== NULL && is_object($output))
68
+		if ($output !== NULL && is_object($output))
69 69
 		{
70 70
 			return $output;
71 71
 		}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$type = $this->get('message_type');
112 112
 		$typeList = array('error' => 1, 'info' => 1, 'update' => 1);
113
-		if(!isset($typeList[$type]))
113
+		if (!isset($typeList[$type]))
114 114
 		{
115 115
 			$type = $this->getError() ? 'error' : 'info';
116 116
 		}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		$oModuleModel = getModel('module');
162 162
 		// permission settings. access, manager(== is_admin) are fixed and privilege name in XE
163 163
 		$module_srl = Context::get('module_srl');
164
-		if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl))
164
+		if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl))
165 165
 		{
166 166
 			$request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
167
-			if($request_module->module_srl == $module_srl)
167
+			if ($request_module->module_srl == $module_srl)
168 168
 			{
169 169
 				$grant = $oModuleModel->getGrant($request_module, $logged_info);
170 170
 			}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		{
174 174
 			$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
175 175
 			// have at least access grant
176
-			if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication'))
176
+			if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication'))
177 177
 			{
178 178
 				$grant->access = 1;
179 179
 			}
@@ -181,24 +181,24 @@  discard block
 block discarded – undo
181 181
 		// display no permission if the current module doesn't have an access privilege
182 182
 		//if(!$grant->access) return $this->stop("msg_not_permitted");
183 183
 		// checks permission and action if you don't have an admin privilege
184
-		if(!$grant->manager)
184
+		if (!$grant->manager)
185 185
 		{
186 186
 			// get permission types(guest, member, manager, root) of the currently requested action
187 187
 			$permission_target = $xml_info->permission->{$this->act};
188 188
 			// check manager if a permission in module.xml otherwise action if no permission
189
-			if(!$permission_target && substr_count($this->act, 'Admin'))
189
+			if (!$permission_target && substr_count($this->act, 'Admin'))
190 190
 			{
191 191
 				$permission_target = 'manager';
192 192
 			}
193 193
 			// Check permissions
194
-			switch($permission_target)
194
+			switch ($permission_target)
195 195
 			{
196 196
 				case 'root' :
197 197
 				case 'manager' :
198 198
 					$this->stop('msg_is_not_administrator');
199 199
 					return;
200 200
 				case 'member' :
201
-					if(!$is_logged)
201
+					if (!$is_logged)
202 202
 					{
203 203
 						$this->stop('msg_not_permitted_act');
204 204
 						return;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
 		$this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl);
215 215
 
216
-		if(method_exists($this, 'init'))
216
+		if (method_exists($this, 'init'))
217 217
 		{
218 218
 			$this->init();
219 219
 		}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * */
252 252
 	function setTemplateFile($filename)
253 253
 	{
254
-		if(isset($filename) && substr_compare($filename, '.html', -5) !== 0)
254
+		if (isset($filename) && substr_compare($filename, '.html', -5) !== 0)
255 255
 		{
256 256
 			$filename .= '.html';
257 257
 		}
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
 	 * */
275 275
 	function setTemplatePath($path)
276 276
 	{
277
-		if(!$path) return;
277
+		if (!$path) return;
278 278
 
279
-		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
279
+		if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
280 280
 		{
281 281
 			$path = './' . $path;
282 282
 		}
283 283
 
284
-		if(substr_compare($path, '/', -1) !== 0)
284
+		if (substr_compare($path, '/', -1) !== 0)
285 285
 		{
286 286
 			$path .= '/';
287 287
 		}
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 * */
305 305
 	function setEditedLayoutFile($filename)
306 306
 	{
307
-		if(!$filename) return;
307
+		if (!$filename) return;
308 308
 
309
-		if(substr_compare($filename, '.html', -5) !== 0)
309
+		if (substr_compare($filename, '.html', -5) !== 0)
310 310
 		{
311 311
 			$filename .= '.html';
312 312
 		}
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 * */
330 330
 	function setLayoutFile($filename)
331 331
 	{
332
-		if(!$filename) return;
332
+		if (!$filename) return;
333 333
 
334
-		if(substr_compare($filename, '.html', -5) !== 0)
334
+		if (substr_compare($filename, '.html', -5) !== 0)
335 335
 		{
336 336
 			$filename .= '.html';
337 337
 		}
@@ -353,13 +353,13 @@  discard block
 block discarded – undo
353 353
 	 * */
354 354
 	function setLayoutPath($path)
355 355
 	{
356
-		if(!$path) return;
356
+		if (!$path) return;
357 357
 
358
-		if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
358
+		if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
359 359
 		{
360 360
 			$path = './' . $path;
361 361
 		}
362
-		if(substr_compare($path, '/', -1) !== 0)
362
+		if (substr_compare($path, '/', -1) !== 0)
363 363
 		{
364 364
 			$path .= '/';
365 365
 		}
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	function proc()
383 383
 	{
384 384
 		// pass if stop_proc is true
385
-		if($this->stop_proc)
385
+		if ($this->stop_proc)
386 386
 		{
387 387
 			debugPrint($this->message, 'ERROR');
388 388
 			return FALSE;
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 
391 391
 		// trigger call
392 392
 		$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this);
393
-		if(!$triggerOutput->toBool())
393
+		if (!$triggerOutput->toBool())
394 394
 		{
395 395
 			$this->setError($triggerOutput->getError());
396 396
 			$this->setMessage($triggerOutput->getMessage());
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
 		$called_position = 'before_module_proc';
402 402
 		$oAddonController = getController('addon');
403 403
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
404
-		if(FileHandler::exists($addon_file)) include($addon_file);
404
+		if (FileHandler::exists($addon_file)) include($addon_file);
405 405
 
406
-		if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
406
+		if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act))
407 407
 		{
408 408
 			// Check permissions
409
-			if($this->module_srl && !$this->grant->access)
409
+			if ($this->module_srl && !$this->grant->access)
410 410
 			{
411 411
 				$this->stop("msg_not_permitted_act");
412 412
 				return FALSE;
@@ -415,21 +415,21 @@  discard block
 block discarded – undo
415 415
 			// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
416 416
 			$is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N'));
417 417
 			$usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET'));
418
-			if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
418
+			if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module)
419 419
 			{
420 420
 				$dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins';
421 421
 				$valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin';
422 422
 				$oModuleModel = getModel('module');
423 423
 				$skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P';
424 424
 				$skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType);
425
-				if($this->module == 'page')
425
+				if ($this->module == 'page')
426 426
 				{
427 427
 					$this->module_info->{$valueName} = $skinName;
428 428
 				}
429 429
 				else
430 430
 				{
431 431
 					$isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE);
432
-					if(!$isTemplatPath)
432
+					if (!$isTemplatPath)
433 433
 					{
434 434
 						$this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName));
435 435
 					}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		// trigger call
451 451
 		$triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this);
452
-		if(!$triggerOutput->toBool())
452
+		if (!$triggerOutput->toBool())
453 453
 		{
454 454
 			$this->setError($triggerOutput->getError());
455 455
 			$this->setMessage($triggerOutput->getMessage());
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
 		$called_position = 'after_module_proc';
461 461
 		$oAddonController = getController('addon');
462 462
 		$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc");
463
-		if(FileHandler::exists($addon_file)) include($addon_file);
463
+		if (FileHandler::exists($addon_file)) include($addon_file);
464 464
 
465
-		if(is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject'))
465
+		if (is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject'))
466 466
 		{
467 467
 			$this->setError($output->getError());
468 468
 			$this->setMessage($output->getMessage());
469 469
 
470
-			if(!$output->toBool())
470
+			if (!$output->toBool())
471 471
 			{
472 472
 				return FALSE;
473 473
 			}
474 474
 		}
475 475
 		// execute api methos of the module if view action is and result is XMLRPC or JSON
476
-		if($this->module_info->module_type == 'view')
476
+		if ($this->module_info->module_type == 'view')
477 477
 		{
478
-			if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
478
+			if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON')
479 479
 			{
480 480
 				$oAPI = getAPI($this->module_info->module, 'api');
481
-				if(method_exists($oAPI, $this->act))
481
+				if (method_exists($oAPI, $this->act))
482 482
 				{
483 483
 					$oAPI->{$this->act}($this);
484 484
 				}
Please login to merge, or discard this patch.
tools/dbxml_validator/validate.php 1 patch
Spacing   +186 added lines, -205 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	{
96 96
 		parent::__construct("{$file}({$line_no}):\n\t$message");
97 97
 
98
-		$this->xml_file	= $file;
98
+		$this->xml_file = $file;
99 99
 		$this->xml_line_no = $line_no;
100 100
 		$this->xml_message = $message;
101 101
 	}
@@ -133,21 +133,21 @@  discard block
 block discarded – undo
133 133
 
134 134
 	$libXmlErrors = libxml_get_errors();
135 135
 
136
-	if(count($libXmlErrors))
136
+	if (count($libXmlErrors))
137 137
 	{
138
-		if(!$filename)
138
+		if (!$filename)
139 139
 		{
140 140
 			$filename = $libXmlErrors[0]->file;
141 141
 		}
142 142
 
143 143
 		$msg = '';
144 144
 
145
-		foreach($libXmlErrors as $libXmlError)
145
+		foreach ($libXmlErrors as $libXmlError)
146 146
 		{
147 147
 			$msg .= "{$libXmlError->file}({$libXmlError->line}):\n\t {$libXmlError->message}";
148 148
 		}
149 149
 
150
-		if($throw_error)
150
+		if ($throw_error)
151 151
 		{
152 152
 			throw new ErrorMessage($msg);
153 153
 		}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	}
159 159
 	else
160 160
 	{
161
-		if($throw_error)
161
+		if ($throw_error)
162 162
 		{
163 163
 			throw new ErrorMessage('Schema validation failed.');
164 164
 		}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 {
180 180
 	$children = $node->getElementsByTagName($child_tag);
181 181
 
182
-	if($children->length > 1)
182
+	if ($children->length > 1)
183 183
 	{
184 184
 		throw 
185 185
 			new XmlSchemaError(
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
 {
218 218
 	$key_values = array();
219 219
 
220
-	foreach($node->childNodes as $child_node)
220
+	foreach ($node->childNodes as $child_node)
221 221
 	{
222
-		if($child_node->nodeType == XML_ELEMENT_NODE
222
+		if ($child_node->nodeType == XML_ELEMENT_NODE
223 223
 					&&
224 224
 				in_array($child_node->tagName, $child_tags))
225 225
 		{
226 226
 			$key_value = NULL;
227 227
 
228
-			foreach($attr_tags as $attr_tag)
228
+			foreach ($attr_tags as $attr_tag)
229 229
 			{
230
-				if($child_node->hasAttribute($attr_tag))
230
+				if ($child_node->hasAttribute($attr_tag))
231 231
 				{
232 232
 					$key_value = $child_node->getAttribute($attr_tag);
233 233
 
234
-					if(array_key_exists($key_value, $key_values))
234
+					if (array_key_exists($key_value, $key_values))
235 235
 					{
236 236
 						throw
237 237
 							new XmlSchemaError(
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 				}
247 247
 			}
248 248
 
249
-			if(!$key_value && $key)
249
+			if (!$key_value && $key)
250 250
 			{
251 251
 				throw
252 252
 					new XmlSchemaError(
@@ -282,19 +282,19 @@  discard block
 block discarded – undo
282 282
 	$table_name = NULL;
283 283
 	$join_type = NULL;
284 284
 
285
-	if($table_element->hasAttribute('name'))
285
+	if ($table_element->hasAttribute('name'))
286 286
 	{
287 287
 		$table_name = $table_element->getAttribute('name');
288 288
 	}
289 289
 
290
-	if($table_element->hasAttribute('type'))
290
+	if ($table_element->hasAttribute('type'))
291 291
 	{
292 292
 		$join_type = $table_element->getAttribute('type');
293 293
 	}
294 294
 
295
-	if($table_element->getAttribute('query') == 'true')
295
+	if ($table_element->getAttribute('query') == 'true')
296 296
 	{
297
-		if($table_name !== NULL)
297
+		if ($table_name !== NULL)
298 298
 		{
299 299
 			throw
300 300
 				new XmlSchemaError(
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 				);
305 305
 		}
306 306
 
307
-		if($join_type !== NULL)
307
+		if ($join_type !== NULL)
308 308
 		{
309 309
 			throw
310 310
 				new XmlSchemaError(
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 		// check contents for a select list or a table-specification
323 323
 		$has_query_clauses = FALSE;
324 324
 
325
-		foreach($table_element->childNodes as $query_clause)
325
+		foreach ($table_element->childNodes as $query_clause)
326 326
 		{
327
-			if($query_clause->nodeType == XML_ELEMENT_NODE
327
+			if ($query_clause->nodeType == XML_ELEMENT_NODE
328 328
 						&&
329 329
 					(
330 330
 						$query_clause->tagName == 'columns' 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			}
336 336
 		}
337 337
 
338
-		if(!$has_query_clauses)
338
+		if (!$has_query_clauses)
339 339
 		{
340 340
 			throw
341 341
 				new XmlSchemaError(
@@ -351,17 +351,17 @@  discard block
 block discarded – undo
351 351
 	{
352 352
 		// base table or view
353 353
 
354
-		if($join_type !== NULL)
354
+		if ($join_type !== NULL)
355 355
 		{
356 356
 			$has_conditions_element = FALSE;
357 357
 
358
-			foreach($table_element->childNodes as $child_node)
358
+			foreach ($table_element->childNodes as $child_node)
359 359
 			{
360
-				if($child_node->nodeType == XML_ELEMENT_NODE)
360
+				if ($child_node->nodeType == XML_ELEMENT_NODE)
361 361
 				{
362
-					if($child_node->tagName == 'conditions')
362
+					if ($child_node->tagName == 'conditions')
363 363
 					{
364
-						if($has_conditions_element)
364
+						if ($has_conditions_element)
365 365
 						{
366 366
 							throw
367 367
 								new XmlSchemaError(
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				}
388 388
 			}
389 389
 
390
-			if(!$has_conditions_element)
390
+			if (!$has_conditions_element)
391 391
 			{
392 392
 				throw
393 393
 					new XmlSchemaError(
@@ -399,9 +399,9 @@  discard block
 block discarded – undo
399 399
 		}
400 400
 		else
401 401
 		{
402
-			foreach($table_element->childNodes as $child_node)
402
+			foreach ($table_element->childNodes as $child_node)
403 403
 			{
404
-				if($child_node->nodeType == XML_ELEMENT_NODE)
404
+				if ($child_node->nodeType == XML_ELEMENT_NODE)
405 405
 				{
406 406
 					throw
407 407
 						new XmlSchemaError(
@@ -429,26 +429,25 @@  discard block
 block discarded – undo
429 429
  */
430 430
 function checkTablesClause($xml_file, $tables_element)
431 431
 {
432
-	checkUniqueKey
433
-		(
432
+	checkUniqueKey(
434 433
 			$xml_file,
435 434
 			$tables_element,
436
-			array('table'),				// child elements to be checked
437
-			array('alias', 'name'),		// attributes to be checked
435
+			array('table'), // child elements to be checked
436
+			array('alias', 'name'), // attributes to be checked
438 437
 			TRUE						// attributes are required
439 438
 		);
440 439
 
441
-	foreach($tables_element->childNodes as $table)
440
+	foreach ($tables_element->childNodes as $table)
442 441
 	{
443
-		if($table->nodeType == XML_ELEMENT_NODE
442
+		if ($table->nodeType == XML_ELEMENT_NODE
444 443
 					&&
445 444
 				$table->tagName == 'table')
446 445
 		{
447 446
 			checkTableExpression($xml_file, $table);
448 447
 
449
-			if($table->getAttribute('query') == 'true')
448
+			if ($table->getAttribute('query') == 'true')
450 449
 			{
451
-				validate_select_query($xml_file, $table);		// recursive call
450
+				validate_select_query($xml_file, $table); // recursive call
452 451
 			}
453 452
 		}
454 453
 	}
@@ -470,12 +469,11 @@  discard block
 block discarded – undo
470 469
  */
471 470
 function checkSelectListClause($xml_file, $columns_element)
472 471
 {
473
-	checkUniqueKey
474
-		(
472
+	checkUniqueKey(
475 473
 			$xml_file,
476 474
 			$columns_element,
477
-			array('column', 'query'),	// child elements
478
-			array('alias', 'name'),		// attributes
475
+			array('column', 'query'), // child elements
476
+			array('alias', 'name'), // attributes
479 477
 			FALSE						// ignore if no attributes present
480 478
 		);
481 479
 }
@@ -491,8 +489,7 @@  discard block
 block discarded – undo
491 489
 	@param $container_element
492 490
 	@param $child_tag
493 491
 */
494
-function checkVarContentsValidation
495
-	(
492
+function checkVarContentsValidation(
496 493
 		$xml_file,
497 494
 		$container_element,
498 495
 		$child_tag
@@ -503,23 +500,22 @@  discard block
 block discarded – undo
503 500
 
504 501
 	static
505 502
 		$var_attrs =
506
-			array
507
-			(
503
+			array(
508 504
 				'filter', 'notnull', 'minlength',
509 505
 				'maxlength'
510 506
 			);
511 507
 
512
-	foreach($container_element->childNodes as $child_node)
508
+	foreach ($container_element->childNodes as $child_node)
513 509
 	{
514
-		if($child_node->nodeType == XML_ELEMENT_NODE
510
+		if ($child_node->nodeType == XML_ELEMENT_NODE
515 511
 					&&
516 512
 				$child_node->tagName == $child_tag)
517 513
 		{
518
-			if(!$child_node->hasAttribute($key_attr))
514
+			if (!$child_node->hasAttribute($key_attr))
519 515
 			{
520
-				foreach($var_attrs as $var_attr)
516
+				foreach ($var_attrs as $var_attr)
521 517
 				{
522
-					if($child_node->hasAttribute($var_attr))
518
+					if ($child_node->hasAttribute($var_attr))
523 519
 					{
524 520
 						throw
525 521
 							new XmlSchemaError(
@@ -551,9 +547,9 @@  discard block
 block discarded – undo
551 547
 	$has_var_attribute = $condition->hasAttribute('var') || $condition->hasAttribute('default');
552 548
 	$query_line_no = -1;
553 549
 
554
-	foreach($condition->childNodes as $query_node)
550
+	foreach ($condition->childNodes as $query_node)
555 551
 	{
556
-		if($query_node->nodeType == XML_ELEMENT_NODE
552
+		if ($query_node->nodeType == XML_ELEMENT_NODE
557 553
 					&&
558 554
 				$query_node->tagName == 'query')
559 555
 		{
@@ -564,7 +560,7 @@  discard block
 block discarded – undo
564 560
 		}
565 561
 	}
566 562
 
567
-	if($child_query_node && $has_var_attribute)
563
+	if ($child_query_node && $has_var_attribute)
568 564
 	{
569 565
 		throw 
570 566
 			new XmlSchemaError(
@@ -574,7 +570,7 @@  discard block
 block discarded – undo
574 570
 			);
575 571
 	}
576 572
 
577
-	if(!($child_query_node || $has_var_attribute))
573
+	if (!($child_query_node || $has_var_attribute))
578 574
 	{
579 575
 		throw
580 576
 			new XmlSchemaError(
@@ -601,18 +597,18 @@  discard block
 block discarded – undo
601 597
 {
602 598
 	$first_child = TRUE;
603 599
 
604
-	foreach($conditions->childNodes as $child_node)
600
+	foreach ($conditions->childNodes as $child_node)
605 601
 	{
606
-		if($child_node->nodeType == XML_ELEMENT_NODE)
602
+		if ($child_node->nodeType == XML_ELEMENT_NODE)
607 603
 		{
608 604
 			// check for 'pipe' attribute
609
-			if($first_child)
605
+			if ($first_child)
610 606
 			{
611 607
 				$first_child = FALSE;
612 608
 			}
613 609
 			else
614 610
 			{
615
-				if(!$child_node->hasAttribute('pipe'))
611
+				if (!$child_node->hasAttribute('pipe'))
616 612
 				{
617 613
 					throw
618 614
 						new XmlSchemaError(
@@ -626,19 +622,19 @@  discard block
 block discarded – undo
626 622
 			}
627 623
 
628 624
 			// recurse in condition groups/queries
629
-			if($child_node->tagName == 'group')
625
+			if ($child_node->tagName == 'group')
630 626
 			{
631 627
 				checkConditionsGroup($xml_file, $child_node);
632 628
 			}
633 629
 			else
634 630
 			{
635
-				if($child_node->tagName == 'query')
631
+				if ($child_node->tagName == 'query')
636 632
 				{
637 633
 					validate_select_query($xml_file, $child_node);
638 634
 				}
639 635
 				else
640 636
 				{
641
-					if($child_node->tagName == 'condition')
637
+					if ($child_node->tagName == 'condition')
642 638
 					{
643 639
 						checkConditionElement($xml_file, $child_node);
644 640
 					}
@@ -664,12 +660,11 @@  discard block
 block discarded – undo
664 660
  */
665 661
 function checkNavigationClauses($xml_file, $navigation_element)
666 662
 {
667
-	foreach(array('list_count', 'page_count', 'page')
663
+	foreach (array('list_count', 'page_count', 'page')
668 664
 				as
669 665
 			$navigation_el)
670 666
 	{
671
-		checkDuplicateDescendants
672
-			(
667
+		checkDuplicateDescendants(
673 668
 				$xml_file,
674 669
 				$navigation_element,
675 670
 				$navigation_el
@@ -693,11 +688,11 @@  discard block
 block discarded – undo
693 688
  */
694 689
 function validate_select_query($xml_file, $query_element)
695 690
 {
696
-	foreach($query_element->childNodes as $select_clause)
691
+	foreach ($query_element->childNodes as $select_clause)
697 692
 	{
698
-		if($select_clause->nodeType == XML_ELEMENT_NODE)
693
+		if ($select_clause->nodeType == XML_ELEMENT_NODE)
699 694
 		{
700
-			switch($select_clause->tagName)
695
+			switch ($select_clause->tagName)
701 696
 			{
702 697
 				case 'columns':
703 698
 					checkSelectListClause($xml_file, $select_clause);
@@ -728,11 +723,11 @@  discard block
 block discarded – undo
728 723
  */
729 724
 function validate_update_query($xml_file, $query_element)
730 725
 {
731
-	foreach($query_element->childNodes as $update_clause)
726
+	foreach ($query_element->childNodes as $update_clause)
732 727
 	{
733
-		if($update_clause->nodeType == XML_ELEMENT_NODE)
728
+		if ($update_clause->nodeType == XML_ELEMENT_NODE)
734 729
 		{
735
-			switch($update_clause->tagName)
730
+			switch ($update_clause->tagName)
736 731
 			{
737 732
 				case 'tables':
738 733
 					checkTablesClause($xml_file, $update_clause);
@@ -755,11 +750,11 @@  discard block
 block discarded – undo
755 750
  */
756 751
 function validate_delete_query($xml_file, $query_element)
757 752
 {
758
-	foreach($query_element->childNodes as $delete_clause)
753
+	foreach ($query_element->childNodes as $delete_clause)
759 754
 	{
760
-		if($delete_clause->nodeType == XML_ELEMENT_NODE)
755
+		if ($delete_clause->nodeType == XML_ELEMENT_NODE)
761 756
 		{
762
-			switch($delete_clause->tagName)
757
+			switch ($delete_clause->tagName)
763 758
 			{
764 759
 				case 'conditions':
765 760
 					checkConditionsGroup($xml_file, $delete_clause);
@@ -778,11 +773,11 @@  discard block
 block discarded – undo
778 773
  */
779 774
 function validate_insert_select_query($xml_file, $query_element)
780 775
 {
781
-	foreach($query_element->childNodes as $statement_clause)
776
+	foreach ($query_element->childNodes as $statement_clause)
782 777
 	{
783
-		if($statement_clause->nodeType == XML_ELEMENT_NODE)
778
+		if ($statement_clause->nodeType == XML_ELEMENT_NODE)
784 779
 		{
785
-			switch($statement_clause->tagName)
780
+			switch ($statement_clause->tagName)
786 781
 			{
787 782
 				case 'query':
788 783
 					validate_select_query($xml_file, $statement_clause);
@@ -793,8 +788,7 @@  discard block
 block discarded – undo
793 788
 }
794 789
 
795 790
 $validate_query_type = 
796
-	array
797
-		(
791
+	array(
798 792
 			// 'insert' =>		
799 793
 							// there is currently nothing special to check
800 794
 							// for a plain insert, all the needed checks
@@ -818,13 +812,13 @@  discard block
 block discarded – undo
818 812
 
819 813
 	$action = $query_element->getAttribute('action');
820 814
 
821
-	if(array_key_exists($action, $validate_query_type))
815
+	if (array_key_exists($action, $validate_query_type))
822 816
 	{
823 817
 		$validate_query_type[$action]($xml_file, $query_element);
824 818
 	}
825 819
 }
826 820
 
827
-if(strpos(PHP_SAPI, 'cli') !== FALSE
821
+if (strpos(PHP_SAPI, 'cli') !== FALSE
828 822
 			|| 
829 823
 		strpos(PHP_SAPI, 'cgi') !== FALSE)
830 824
 {
@@ -857,7 +851,7 @@  discard block
 block discarded – undo
857 851
 				print "Failed to restore working dir {$this->dirname}.";
858 852
 			}
859 853
 
860
-			if(!$success)
854
+			if (!$success)
861 855
 			{
862 856
 				print "Failed to restore working dir {$this->dirname}.";
863 857
 			}
@@ -873,7 +867,7 @@  discard block
 block discarded – undo
873 867
 		{
874 868
 			$this->dirname = getcwd();
875 869
 
876
-			if(!$this->dirname)
870
+			if (!$this->dirname)
877 871
 			{
878 872
 				throw new ErrorMessage("Failed to get current directory.");
879 873
 			}
@@ -903,7 +897,7 @@  discard block
 block discarded – undo
903 897
 	$lowercase_name = strtolower($xml_path_info['basename']);
904 898
 	$uppercase_name = strtoupper($xml_path_info['basename']);
905 899
 
906
-	if(strlen($lowercase_name) != $filename_len
900
+	if (strlen($lowercase_name) != $filename_len
907 901
 				||
908 902
 			strlen($uppercase_name) != $filename_len)
909 903
 	{
@@ -916,9 +910,9 @@  discard block
 block discarded – undo
916 910
 
917 911
 	$varing_case_filename = '';
918 912
 
919
-	for($i = 0; $i < $filename_len; $i++)
913
+	for ($i = 0; $i < $filename_len; $i++)
920 914
 	{
921
-		if($lowercase_name[$i] != $uppercase_name[$i])
915
+		if ($lowercase_name[$i] != $uppercase_name[$i])
922 916
 		{
923 917
 			$varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]";
924 918
 		}
@@ -932,13 +926,13 @@  discard block
 block discarded – undo
932 926
 
933 927
 	$restoreWorkDir = new RestoreWorkDir();
934 928
 
935
-	if($glob_pattern)
929
+	if ($glob_pattern)
936 930
 	{
937 931
 		// change current dir to the xml file directory to keep
938 932
 		// glob pattern shorter (maximum 260 chars).
939 933
 		$success = chdir($glob_pattern);
940 934
 
941
-		if(!$success)
935
+		if (!$success)
942 936
 		{
943 937
 			throw new ErrorMessage("Failed to change work dir to {$glob_pattern}.");
944 938
 		}
@@ -950,14 +944,14 @@  discard block
 block discarded – undo
950 944
 	// realpath() would have the same effect, but it is not documented as such
951 945
 	$matched_files = glob($glob_pattern, GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR);
952 946
 
953
-	unset($RestoreWorkDir);		// restore work dir after call to glob()
947
+	unset($RestoreWorkDir); // restore work dir after call to glob()
954 948
 
955
-	if($matched_files === FALSE || !is_array($matched_files))
949
+	if ($matched_files === FALSE || !is_array($matched_files))
956 950
 	{
957 951
 		throw new ErrorMessage("Directory listing for $xml_file failed.");
958 952
 	}
959 953
 
960
-	switch(count($matched_files))
954
+	switch (count($matched_files))
961 955
 	{
962 956
 		case 0:
963 957
 			throw new ErrorMessage("Directory listing for $xml_file failed.");
@@ -968,9 +962,9 @@  discard block
 block discarded – undo
968 962
 		default:
969 963
 			// more than one files with the same name and different case
970 964
 			// case-sensitive file system
971
-			foreach($mached_files as $matched_file)
965
+			foreach ($mached_files as $matched_file)
972 966
 			{
973
-				if(pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename'])
967
+				if (pathinfo($matched_file, PATHINFO_BASENAME) == $xml_path_info['basename'])
974 968
 				{
975 969
 					return ($xml_path_info['filename'] == $query_id);
976 970
 				}
@@ -979,7 +973,7 @@  discard block
 block discarded – undo
979 973
 
980 974
 	}
981 975
 
982
-	throw new ErrorMessage("Internal application error.");  // unreachable
976
+	throw new ErrorMessage("Internal application error."); // unreachable
983 977
 }
984 978
 
985 979
 /**
@@ -1000,9 +994,9 @@  discard block
 block discarded – undo
1000 994
 */
1001 995
 function validate_schema_doc($xml_file, $table_element)
1002 996
 {
1003
-	foreach($table_element->childNodes as $col_node)
997
+	foreach ($table_element->childNodes as $col_node)
1004 998
 	{
1005
-		if($col_node->nodeType == XML_ELEMENT_NODE
999
+		if ($col_node->nodeType == XML_ELEMENT_NODE
1006 1000
 					&&
1007 1001
 				$col_node->tagName == 'column')
1008 1002
 		{
@@ -1010,10 +1004,9 @@  discard block
 block discarded – undo
1010 1004
 			$col_size = NULL;
1011 1005
 
1012 1006
 			// check auto-increment column
1013
-			if($col_node->hasAttribute('auto_increment'))
1007
+			if ($col_node->hasAttribute('auto_increment'))
1014 1008
 			{
1015
-				fwrite
1016
-					(
1009
+				fwrite(
1017 1010
 						fopen('php://stdout', 'wt'), 
1018 1011
 						$xml_file . '(' . $col_node->getLineNo() . ")\n\t"
1019 1012
 							.
@@ -1023,7 +1016,7 @@  discard block
 block discarded – undo
1023 1016
 				static
1024 1017
 					$autoinc_types = array('number', 'bignumber');
1025 1018
 
1026
-				if(!in_array($col_type, $autoinc_types))
1019
+				if (!in_array($col_type, $autoinc_types))
1027 1020
 				{
1028 1021
 					throw
1029 1022
 						new XmlSchemaError(
@@ -1037,10 +1030,9 @@  discard block
 block discarded – undo
1037 1030
 			}
1038 1031
 
1039 1032
 			// check tinytext
1040
-			if($col_type == 'tinytext')
1033
+			if ($col_type == 'tinytext')
1041 1034
 			{
1042
-				fwrite
1043
-					(
1035
+				fwrite(
1044 1036
 						fopen('php://stdout', 'wt'), 
1045 1037
 						$xml_file . '(' . $col_node->getLineNo() . ")\n\t"
1046 1038
 							.
@@ -1049,12 +1041,12 @@  discard block
 block discarded – undo
1049 1041
 			}
1050 1042
 
1051 1043
 			// check size attribute
1052
-			if($col_node->hasAttribute('size'))
1044
+			if ($col_node->hasAttribute('size'))
1053 1045
 			{
1054 1046
 				$col_size = $col_node->getAttribute('size');
1055 1047
 			}
1056 1048
 
1057
-			if($col_type == 'varchar' && $col_size === NULL)
1049
+			if ($col_type == 'varchar' && $col_size === NULL)
1058 1050
 			{
1059 1051
 				throw 
1060 1052
 					new XmlSchemaError(
@@ -1068,7 +1060,7 @@  discard block
 block discarded – undo
1068 1060
 				$varsize_types = array('char', 'varchar', 'float');
1069 1061
 					
1070 1062
 
1071
-			if($col_size !== NULL  && !in_array($col_type, $varsize_types))
1063
+			if ($col_size !== NULL && !in_array($col_type, $varsize_types))
1072 1064
 			{
1073 1065
 				throw 
1074 1066
 					new XmlSchemaError(
@@ -1102,8 +1094,8 @@  discard block
 block discarded – undo
1102 1094
 	const RETCODE_GENERIC_XML_SYNTAX = 50;
1103 1095
 	const RETCODE_QUERY_ELEMENT = 40;
1104 1096
 	const RETCODE_XSD_VALIDATION = 30;
1105
-	const RETCODE_BUILTIN_CHECKS =	20;
1106
-	const RETCODE_DB_SCHEMA_MATCH = 10;	// no schema match is currently implemented.
1097
+	const RETCODE_BUILTIN_CHECKS = 20;
1098
+	const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented.
1107 1099
 	const RETCODE_SUCCESS = 0;
1108 1100
 
1109 1101
 
@@ -1116,13 +1108,13 @@  discard block
 block discarded – undo
1116 1108
 	*/
1117 1109
 	public function code($val = -1)
1118 1110
 	{
1119
-		if($val == -1)
1111
+		if ($val == -1)
1120 1112
 		{
1121 1113
 			return $this->exit_code;
1122 1114
 		}
1123 1115
 		else
1124 1116
 		{
1125
-			if($this->exit_code < $val)
1117
+			if ($this->exit_code < $val)
1126 1118
 			{
1127 1119
 				$this->exit_code = $val;
1128 1120
 			}
@@ -1184,7 +1176,7 @@  discard block
 block discarded – undo
1184 1176
 	*/
1185 1177
 	public function __destruct()
1186 1178
 	{
1187
-		if($this->file_name)
1179
+		if ($this->file_name)
1188 1180
 		{
1189 1181
 			unlink($this->file_name);
1190 1182
 			$this->file_name = NULL;
@@ -1214,12 +1206,12 @@  discard block
 block discarded – undo
1214 1206
 	$cmdname = CMD_NAME;
1215 1207
 
1216 1208
 	// php manual says resources should not normally be declared constant
1217
-	if(!defined('STDERR'))
1209
+	if (!defined('STDERR'))
1218 1210
 	{
1219 1211
 		define('STDERR', fopen('php://stderr', 'wt'));
1220 1212
 	}
1221 1213
 
1222
-	if(!defined('__DIR__'))
1214
+	if (!defined('__DIR__'))
1223 1215
 	{
1224 1216
 		define('__DIR__', dirname(__FILE__)); 
1225 1217
 	}
@@ -1234,7 +1226,7 @@  discard block
 block discarded – undo
1234 1226
 	$query_args = NULL;
1235 1227
 	$query_args_file = NULL;
1236 1228
 
1237
-	while($argc >= 2 && $argv[1][0] == '-')
1229
+	while ($argc >= 2 && $argv[1][0] == '-')
1238 1230
 	{
1239 1231
 		$option = $argv[1];
1240 1232
 
@@ -1242,17 +1234,17 @@  discard block
 block discarded – undo
1242 1234
 		$argv = array_values($argv);
1243 1235
 		$argc = count($argv);
1244 1236
 
1245
-		switch($option)
1237
+		switch ($option)
1246 1238
 		{
1247 1239
 			case '-s':
1248 1240
 			case '--schema':
1249 1241
 			case '--schema-language':
1250
-				if($query_args !== NULL)
1242
+				if ($query_args !== NULL)
1251 1243
 				{
1252 1244
 					throw new SyntaxError("Both --args-string and --schema-language options given.");
1253 1245
 				}
1254 1246
 
1255
-				if($query_args_file !== NULL)
1247
+				if ($query_args_file !== NULL)
1256 1248
 				{
1257 1249
 					throw new SyntaxError("Both --args-file and --schema-language options given.");
1258 1250
 				}
@@ -1272,7 +1264,7 @@  discard block
 block discarded – undo
1272 1264
 
1273 1265
 			case '--xe-path':
1274 1266
 			case '--xe':
1275
-				if($argc < 2)
1267
+				if ($argc < 2)
1276 1268
 				{
1277 1269
 					throw
1278 1270
 						new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`");
@@ -1290,17 +1282,17 @@  discard block
 block discarded – undo
1290 1282
 			case '--args-string':
1291 1283
 			case '--arguments':
1292 1284
 			case '--args':
1293
-				if($schema_language !== NULL)
1285
+				if ($schema_language !== NULL)
1294 1286
 				{
1295 1287
 					throw new SyntaxError("Both --schema-language and --args-string options given.");
1296 1288
 				}
1297 1289
 
1298
-				if($query_args_file !== NULL)
1290
+				if ($query_args_file !== NULL)
1299 1291
 				{
1300 1292
 					throw new SyntaxError("Both --args-string and --args-file options given.");
1301 1293
 				}
1302 1294
 
1303
-				if($argc < 2)
1295
+				if ($argc < 2)
1304 1296
 				{
1305 1297
 					throw
1306 1298
 						new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`");
@@ -1316,17 +1308,17 @@  discard block
 block discarded – undo
1316 1308
 
1317 1309
 			case '--arguments-file':
1318 1310
 			case '--args-file':
1319
-				if($schema_language !== NULL)
1311
+				if ($schema_language !== NULL)
1320 1312
 				{
1321 1313
 					throw new SyntaxError("Both --schema-language and --args-file options given.");
1322 1314
 				}
1323 1315
 
1324
-				if($query_args !== NULL)
1316
+				if ($query_args !== NULL)
1325 1317
 				{
1326 1318
 					throw new SyntaxError("Both --args-string and --args-file options given.");
1327 1319
 				}
1328 1320
 
1329
-				if($argc < 2)
1321
+				if ($argc < 2)
1330 1322
 				{
1331 1323
 					throw
1332 1324
 						new SyntaxError("Option '{$option}' requires an argument., see `{$cmdname} --help`");
@@ -1357,7 +1349,7 @@  discard block
 block discarded – undo
1357 1349
 		}
1358 1350
 	}
1359 1351
 
1360
-	if($argc < 2 ||
1352
+	if ($argc < 2 ||
1361 1353
 			(
1362 1354
 				$argc == 2
1363 1355
 					&&
@@ -1415,21 +1407,21 @@  discard block
 block discarded – undo
1415 1407
 	$query_user_args = array();
1416 1408
 
1417 1409
 	// check $xe_path, $query_args
1418
-	if(!$validate_only)
1410
+	if (!$validate_only)
1419 1411
 	{
1420
-		if($xe_path == NULL)
1412
+		if ($xe_path == NULL)
1421 1413
 		{
1422 1414
 			// assume validator.php is in directory .../xe/tools/dbxml_validator/ in an XE installation
1423 1415
 			$xe_path = dirname(dirname(realpath(__DIR__)));
1424 1416
 		}
1425 1417
 
1426
-		if(!file_exists($xe_path . '/index.php'))
1418
+		if (!file_exists($xe_path . '/index.php'))
1427 1419
 		{
1428 1420
 			throw
1429 1421
 				new ErrorMessage("File index.php not found in {$xe_path}.");
1430 1422
 		}
1431 1423
 
1432
-		if(!defined('_XE_PATH_'))
1424
+		if (!defined('_XE_PATH_'))
1433 1425
 		{
1434 1426
 			define('_XE_PATH_', $xe_path . '/');
1435 1427
 		}
@@ -1485,7 +1477,7 @@  discard block
 block discarded – undo
1485 1477
 			*/
1486 1478
 			public static function getDBType()
1487 1479
 			{
1488
-				if(self::$db_info)
1480
+				if (self::$db_info)
1489 1481
 				{
1490 1482
 					return self::$db_info->master_db['db_type'];
1491 1483
 				}
@@ -1538,10 +1530,9 @@  discard block
 block discarded – undo
1538 1530
 			*/
1539 1531
 			public static function setNoDBInfo()
1540 1532
 			{
1541
-				$db_info = (object)NULL;
1533
+				$db_info = (object) NULL;
1542 1534
 				$db_info->master_db =
1543
-					array
1544
-						(
1535
+					array(
1545 1536
 							'db_type' => NULL,
1546 1537
 							'db_hostname' => NULL,
1547 1538
 							'db_port' => NULL,
@@ -1565,10 +1556,9 @@  discard block
 block discarded – undo
1565 1556
 			*/
1566 1557
 			public static function setMysqlDBInfo()
1567 1558
 			{
1568
-				$db_info = (object)NULL;
1559
+				$db_info = (object) NULL;
1569 1560
 				$db_info->master_db =
1570
-					array
1571
-						(
1561
+					array(
1572 1562
 							'db_type' => 'mysql',
1573 1563
 							'db_hostname' => NULL,
1574 1564
 							'db_port' => NULL,
@@ -1584,7 +1574,7 @@  discard block
 block discarded – undo
1584 1574
 
1585 1575
 				self::setDBInfo($db_info);
1586 1576
 
1587
-				if(array_key_exists('__DB__', $GLOBALS)
1577
+				if (array_key_exists('__DB__', $GLOBALS)
1588 1578
 							&&
1589 1579
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1590 1580
 				{
@@ -1607,10 +1597,9 @@  discard block
 block discarded – undo
1607 1597
 			*/
1608 1598
 			public static function setMysqliDBInfo()
1609 1599
 			{
1610
-				$db_info = (object)NULL;
1600
+				$db_info = (object) NULL;
1611 1601
 				$db_info->master_db =
1612
-					array
1613
-						(
1602
+					array(
1614 1603
 							'db_type' => 'mysqli',
1615 1604
 							'db_hostname' => NULL,
1616 1605
 							'db_port' => NULL,
@@ -1626,7 +1615,7 @@  discard block
 block discarded – undo
1626 1615
 
1627 1616
 				self::setDBInfo($db_info);
1628 1617
 
1629
-				if(array_key_exists('__DB__', $GLOBALS)
1618
+				if (array_key_exists('__DB__', $GLOBALS)
1630 1619
 							&&
1631 1620
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1632 1621
 				{
@@ -1649,10 +1638,9 @@  discard block
 block discarded – undo
1649 1638
 			*/
1650 1639
 			public static function setCubridDBInfo()
1651 1640
 			{
1652
-				$db_info = (object)NULL;
1641
+				$db_info = (object) NULL;
1653 1642
 				$db_info->master_db =
1654
-					array
1655
-						(
1643
+					array(
1656 1644
 							'db_type' => 'cubrid',
1657 1645
 							'db_hostname' => NULL,
1658 1646
 							'db_port' => NULL,
@@ -1668,7 +1656,7 @@  discard block
 block discarded – undo
1668 1656
 
1669 1657
 				self::setDBInfo($db_info);
1670 1658
 
1671
-				if(array_key_exists('__DB__', $GLOBALS)
1659
+				if (array_key_exists('__DB__', $GLOBALS)
1672 1660
 							&&
1673 1661
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1674 1662
 				{
@@ -1691,10 +1679,9 @@  discard block
 block discarded – undo
1691 1679
 			*/
1692 1680
 			public static function setMssqlDBInfo()
1693 1681
 			{
1694
-				$db_info = (object)NULL;
1682
+				$db_info = (object) NULL;
1695 1683
 				$db_info->master_db =
1696
-					array
1697
-						(
1684
+					array(
1698 1685
 							'db_type' => 'mssql',
1699 1686
 							'db_hostname' => NULL,
1700 1687
 							'db_port' => NULL,
@@ -1710,7 +1697,7 @@  discard block
 block discarded – undo
1710 1697
 
1711 1698
 				self::setDBInfo($db_info);
1712 1699
 
1713
-				if(array_key_exists('__DB__', $GLOBALS)
1700
+				if (array_key_exists('__DB__', $GLOBALS)
1714 1701
 							&&
1715 1702
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1716 1703
 				{
@@ -1765,25 +1752,25 @@  discard block
 block discarded – undo
1765 1752
 		}
1766 1753
 
1767 1754
 		global $lang;
1768
-		$lang = new Any_prop_obj_base();	// to return NULL on non-existent properties
1755
+		$lang = new Any_prop_obj_base(); // to return NULL on non-existent properties
1769 1756
 		$lang->filter = New LangArgFilterErrorMessage();
1770 1757
 
1771
-		if(!defined('__XE__'))
1758
+		if (!defined('__XE__'))
1772 1759
 		{
1773 1760
 			define('__XE__', TRUE);
1774 1761
 		}
1775 1762
 
1776
-		if(!defined('__ZBXE__'))
1763
+		if (!defined('__ZBXE__'))
1777 1764
 		{
1778 1765
 			define('__ZBXE__', TRUE);
1779 1766
 		}
1780 1767
 
1781
-		if(!defined('__DEBUG__'))
1768
+		if (!defined('__DEBUG__'))
1782 1769
 		{
1783 1770
 			define('__DEBUG__', 0);
1784 1771
 		}
1785 1772
 
1786
-		if(!defined('__DEBUG_QUERY__'))
1773
+		if (!defined('__DEBUG_QUERY__'))
1787 1774
 		{
1788 1775
 			define('__DEBUG_QUERY__', 0);
1789 1776
 		}
@@ -1807,7 +1794,7 @@  discard block
 block discarded – undo
1807 1794
 		require_once(__DIR__ . '/connect_wrapper.php');
1808 1795
 
1809 1796
 		// check $query_args, $query_args_file
1810
-		if($query_args_file)
1797
+		if ($query_args_file)
1811 1798
 		{
1812 1799
 			try
1813 1800
 			{
@@ -1821,7 +1808,7 @@  discard block
 block discarded – undo
1821 1808
 		}
1822 1809
 		else
1823 1810
 		{
1824
-			if($query_args)
1811
+			if ($query_args)
1825 1812
 			{
1826 1813
 				try
1827 1814
 				{
@@ -1841,8 +1828,7 @@  discard block
 block discarded – undo
1841 1828
 
1842 1829
 	$schema_file = NULL;
1843 1830
 	$schemas_set =
1844
-		array
1845
-			(
1831
+		array(
1846 1832
 				'delete' => __DIR__ . '/xml_delete.xsd',
1847 1833
 				'update' => __DIR__ . '/xml_update.xsd',
1848 1834
 				'select' => __DIR__ . '/xml_select.xsd',
@@ -1855,12 +1841,12 @@  discard block
 block discarded – undo
1855 1841
 
1856 1842
 	$i = 1;
1857 1843
 
1858
-	if(pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd')
1844
+	if (pathinfo($argv[1], PATHINFO_EXTENSION) == 'xsd')
1859 1845
 	{
1860 1846
 		$schema_file = $argv[$i++];
1861 1847
 	}
1862 1848
 	
1863
-	for(; $i < count($argv); $i++)
1849
+	for (; $i < count($argv); $i++)
1864 1850
 	{
1865 1851
 		try
1866 1852
 		{
@@ -1869,7 +1855,7 @@  discard block
 block discarded – undo
1869 1855
 			$use_schema_language = $schema_language;
1870 1856
 
1871 1857
 			$retcode->push(ReturnCode::RETCODE_GENERIC_XML_SYNTAX);
1872
-			if($domDocument->load($argv[$i]))
1858
+			if ($domDocument->load($argv[$i]))
1873 1859
 			{
1874 1860
 				$retcode->pop();
1875 1861
 
@@ -1883,7 +1869,7 @@  discard block
 block discarded – undo
1883 1869
 					}
1884 1870
 				}
1885 1871
 
1886
-				if(!$schema_file && !$use_schema_language
1872
+				if (!$schema_file && !$use_schema_language
1887 1873
 							&&
1888 1874
 						(
1889 1875
 							$queryElement->tagName != 'query'
@@ -1903,7 +1889,7 @@  discard block
 block discarded – undo
1903 1889
 							);
1904 1890
 				}
1905 1891
 
1906
-				if(!$schema_file && !$use_schema_language && !$skip_query_id
1892
+				if (!$schema_file && !$use_schema_language && !$skip_query_id
1907 1893
 							&&
1908 1894
 						!validate_query_id($argv[$i], $queryElement->getAttribute('id')))
1909 1895
 				{
@@ -1916,24 +1902,24 @@  discard block
 block discarded – undo
1916 1902
 						);
1917 1903
 				}
1918 1904
 
1919
-				if($use_schema_language)
1905
+				if ($use_schema_language)
1920 1906
 				{
1921 1907
 					$document_schema = $table_schema;
1922 1908
 				}
1923 1909
 				else
1924 1910
 				{
1925
-					if(!$document_schema)
1911
+					if (!$document_schema)
1926 1912
 					{
1927 1913
 						$document_schema = $schemas_set[$queryElement->getAttribute('action')];
1928 1914
 					}
1929 1915
 				}
1930 1916
 
1931 1917
 				$retcode->push(ReturnCode::RETCODE_XSD_VALIDATION);
1932
-				if($domDocument->schemaValidate($document_schema))
1918
+				if ($domDocument->schemaValidate($document_schema))
1933 1919
 				{
1934 1920
 					$retcode->pop();
1935 1921
 
1936
-					if($use_schema_language)
1922
+					if ($use_schema_language)
1937 1923
 					{
1938 1924
 						validate_schema_doc($argv[$i], $domDocument->documentElement);
1939 1925
 					}
@@ -1944,22 +1930,22 @@  discard block
 block discarded – undo
1944 1930
 					$success = TRUE;
1945 1931
 				}
1946 1932
 
1947
-				if(!$validate_only)
1933
+				if (!$validate_only)
1948 1934
 				{
1949 1935
 					// Generate SQL with the db provider back-ends
1950 1936
 
1951
-					if(function_exists('sys_get_temp_dir'))
1937
+					if (function_exists('sys_get_temp_dir'))
1952 1938
 					{
1953 1939
 						$tmpdir = sys_get_temp_dir();
1954 1940
 					}
1955 1941
 					else
1956 1942
 					{
1957 1943
 						$tmpdir = getenv('TEMP');
1958
-						if(!$tmpdir)
1944
+						if (!$tmpdir)
1959 1945
 						{
1960 1946
 							$tmpdir = getenv('TMP');
1961 1947
 						}
1962
-						if(!$tmpdir)
1948
+						if (!$tmpdir)
1963 1949
 						{
1964 1950
 							$tmpdir = '/tmp';
1965 1951
 						}
@@ -1968,30 +1954,29 @@  discard block
 block discarded – undo
1968 1954
 
1969 1955
 					global $_SERVER;
1970 1956
 
1971
-					if(!is_array($_SERVER))
1957
+					if (!is_array($_SERVER))
1972 1958
 					{
1973 1959
 						$_SERVER = array();
1974 1960
 					}
1975 1961
 
1976
-					if(!array_key_exists('REMOTE_ADDR', $_SERVER))
1962
+					if (!array_key_exists('REMOTE_ADDR', $_SERVER))
1977 1963
 					{
1978 1964
 						$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
1979 1965
 					}
1980 1966
 
1981 1967
 					$set_db_info_methods =
1982
-						array
1983
-							(
1968
+						array(
1984 1969
 								'mysql'		=> 'setMysqlDBInfo',
1985 1970
 								'mysqli'	=> 'setMysqliDBInfo',
1986 1971
 								'cubrid'	=> 'setCubridDBInfo',
1987 1972
 								'mssql'		=> 'setMssqlDBInfo'
1988 1973
 							);
1989 1974
 
1990
-					foreach($set_db_info_methods as $db_type => $set_info_method)
1975
+					foreach ($set_db_info_methods as $db_type => $set_info_method)
1991 1976
 					{
1992 1977
 						Context::$set_info_method(); // calls setMysqlDBInfo()/setCubridDBInfo()/...
1993 1978
 
1994
-						if($use_schema_language)
1979
+						if ($use_schema_language)
1995 1980
 						{
1996 1981
 							$GLOBALS['__DB__'][$db_type]->queries = '';
1997 1982
 							$GLOBALS['__DB__'][$db_type]->createTableByXmlFile($argv[$i]);
@@ -2010,26 +1995,25 @@  discard block
 block discarded – undo
2010 1995
 							// copied from classes/db/DB.class.php
2011 1996
 							$oParser = new XmlQueryParser();
2012 1997
 							$args_array =
2013
-								$oParser->parse_xml_query
2014
-									(
1998
+								$oParser->parse_xml_query(
2015 1999
 										pathinfo($argv[$i], PATHINFO_FILENAME), // query id
2016
-										$argv[$i],								// xml file
2000
+										$argv[$i], // xml file
2017 2001
 										$unlink_tmpfile->file_name				// cache file
2018 2002
 									);
2019 2003
 							$args_array = $args_array->queryTag->getArguments();
2020 2004
 
2021 2005
 							$GLOBALS['__DB__'][$db_type]->queries = '';
2022 2006
 							$k = 1;
2023
-							foreach($args_array as $arg)
2007
+							foreach ($args_array as $arg)
2024 2008
 							{
2025
-								if(// why would there be a query arg without a var name ?
2009
+								if (// why would there be a query arg without a var name ?
2026 2010
 										isset($arg->variable_name)
2027 2011
 											&&
2028 2012
 										!array_key_exists($arg->variable_name, $query_user_args))
2029 2013
 								{
2030
-									if(isset($arg->argument_validator))
2014
+									if (isset($arg->argument_validator))
2031 2015
 									{
2032
-										if(FALSE	// some default values are to be parsed by php, some are not...
2016
+										if (FALSE	// some default values are to be parsed by php, some are not...
2033 2017
 													&&
2034 2018
 												isset($arg->argument_validator->default_value)
2035 2019
 													&&
@@ -2040,9 +2024,9 @@  discard block
 block discarded – undo
2040 2024
 										}
2041 2025
 										else
2042 2026
 										{
2043
-											if($arg->argument_validator->filter)
2027
+											if ($arg->argument_validator->filter)
2044 2028
 											{
2045
-												switch($arg->argument_validator->filter)
2029
+												switch ($arg->argument_validator->filter)
2046 2030
 												{
2047 2031
 													case 'email':
2048 2032
 													case 'email_address':
@@ -2081,18 +2065,17 @@  discard block
 block discarded – undo
2081 2065
 										}
2082 2066
 									}
2083 2067
 
2084
-									if(!array_key_exists($arg->variable_name, $query_user_args))
2068
+									if (!array_key_exists($arg->variable_name, $query_user_args))
2085 2069
 									{
2086 2070
 										$query_user_args[$arg->variable_name] = sprintf('%06d', $k);
2087 2071
 									}
2088 2072
 
2089
-									if(isset($arg->argument_validator))
2073
+									if (isset($arg->argument_validator))
2090 2074
 									{
2091
-										if(isset($arg->argument_validator->min_length))
2075
+										if (isset($arg->argument_validator->min_length))
2092 2076
 										{
2093 2077
 											$query_user_args[$arg->variable_name] =
2094
-												str_pad
2095
-													(
2078
+												str_pad(
2096 2079
 														$query_user_args[$arg->variable_name],
2097 2080
 														$arg->argument_validator->min_length,
2098 2081
 														isset($arg->argument_validator->filter) &&
@@ -2105,11 +2088,10 @@  discard block
 block discarded – undo
2105 2088
 													);
2106 2089
 										}
2107 2090
 
2108
-										if(isset($arg->argument_validator->max_length))
2091
+										if (isset($arg->argument_validator->max_length))
2109 2092
 										{
2110 2093
 											$query_user_args[$arg->variable_name] =
2111
-												substr
2112
-													(
2094
+												substr(
2113 2095
 														$query_user_args[$arg->variable_name],
2114 2096
 														0, 
2115 2097
 														$arg->argument_validator->max_length
@@ -2122,15 +2104,14 @@  discard block
 block discarded – undo
2122 2104
 							}
2123 2105
 
2124 2106
 							$resultset = 
2125
-								$GLOBALS['__DB__'][$db_type]->_executeQuery
2126
-									(
2127
-										$unlink_tmpfile->file_name,		// cache_file
2128
-										(object)$query_user_args,		// source_args
2129
-										basename($argv[$i]),			// query_id
2107
+								$GLOBALS['__DB__'][$db_type]->_executeQuery(
2108
+										$unlink_tmpfile->file_name, // cache_file
2109
+										(object) $query_user_args, // source_args
2110
+										basename($argv[$i]), // query_id
2130 2111
 										array()							// arg_columns
2131 2112
 									);
2132 2113
 
2133
-							if(is_a($resultset, 'XEObject') && !$resultset->toBool())
2114
+							if (is_a($resultset, 'XEObject') && !$resultset->toBool())
2134 2115
 							{
2135 2116
 								throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed');
2136 2117
 							}
@@ -2147,7 +2128,7 @@  discard block
 block discarded – undo
2147 2128
 				}
2148 2129
 			}
2149 2130
 
2150
-			if(!$success)
2131
+			if (!$success)
2151 2132
 			{
2152 2133
 				libXmlDisplayError($argv[$i], TRUE);
2153 2134
 			}
@@ -2160,7 +2141,7 @@  discard block
 block discarded – undo
2160 2141
 		}
2161 2142
 		catch (ErrorMessage $exc)
2162 2143
 		{
2163
-			if($retcode->code() == ReturnCode::RETCODE_SUCCESS)
2144
+			if ($retcode->code() == ReturnCode::RETCODE_SUCCESS)
2164 2145
 			{
2165 2146
 				$retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);
2166 2147
 			}
@@ -2170,7 +2151,7 @@  discard block
 block discarded – undo
2170 2151
 		}
2171 2152
 		catch (ErrorException $exc)
2172 2153
 		{
2173
-			if($retcode->code() == ReturnCode::RETCODE_SUCCESS)
2154
+			if ($retcode->code() == ReturnCode::RETCODE_SUCCESS)
2174 2155
 			{
2175 2156
 				$retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);
2176 2157
 			}
@@ -2194,21 +2175,21 @@  discard block
 block discarded – undo
2194 2175
 catch (SyntaxError $syntax)
2195 2176
 {
2196 2177
 	fwrite(STDERR, $syntax->getMessage() . "\n");
2197
-	exit(254);	// wrong command line
2178
+	exit(254); // wrong command line
2198 2179
 				// 255 is reserved by php (for parse errors, etc.)
2199 2180
 }
2200 2181
 catch (ErrorMessage $exc)
2201 2182
 {
2202 2183
 	fwrite(STDERR, $exc->getMessage() . "\n");
2203 2184
 	libXmlDisplayError();
2204
-	exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL);		// internal validator error
2185
+	exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error
2205 2186
 }
2206 2187
 catch (Exception $exc)
2207 2188
 {
2208 2189
 	fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n");
2209 2190
 	fwrite(STDERR, $exc->getTraceAsString());
2210 2191
 	libXmlDisplayError();
2211
-	exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL);		// internal validator error
2192
+	exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL); // internal validator error
2212 2193
 }
2213 2194
 
2214 2195
 /* End of file validate.php */
Please login to merge, or discard this patch.
modules/editor/editor.controller.php 2 patches
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -47,28 +47,28 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$component = Context::get('component');
49 49
 		$method = Context::get('method');
50
-		if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
50
+		if (!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
51 51
 
52 52
 		$oEditorModel = getModel('editor');
53 53
 		$oComponent = &$oEditorModel->getComponentObject($component);
54
-		if(!$oComponent->toBool()) return $oComponent;
54
+		if (!$oComponent->toBool()) return $oComponent;
55 55
 
56
-		if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
56
+		if (!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
57 57
 
58 58
 		//$output = call_user_method($method, $oComponent);
59 59
 		//$output = call_user_func(array($oComponent, $method));
60
-		if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
-		else return new Object(-1,sprintf('%s method is not exists', $method));
60
+		if (method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
+		else return new Object(-1, sprintf('%s method is not exists', $method));
62 62
 
63
-		if((is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) && !$output->toBool()) return $output;
63
+		if ((is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) && !$output->toBool()) return $output;
64 64
 
65 65
 		$this->setError($oComponent->getError());
66 66
 		$this->setMessage($oComponent->getMessage());
67 67
 
68 68
 		$vars = $oComponent->getVariables();
69
-		if(count($vars))
69
+		if (count($vars))
70 70
 		{
71
-			foreach($vars as $key => $val)
71
+			foreach ($vars as $key => $val)
72 72
 			{
73 73
 				$this->add($key, $val);
74 74
 			}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	{
83 83
 		$module_srl = Context::get('target_module_srl');
84 84
 		// To configure many of modules at once
85
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
85
+		if (preg_match('/^([0-9,]+)$/', $module_srl)) $module_srl = explode(',', $module_srl);
86 86
 		else $module_srl = array($module_srl);
87 87
 
88 88
 		$editor_config = new stdClass;
@@ -91,32 +91,32 @@  discard block
 block discarded – undo
91 91
 		$editor_config->content_style = Context::get('content_style');
92 92
 		$editor_config->comment_content_style = Context::get('comment_content_style');
93 93
 		$editor_config->content_font = Context::get('content_font');
94
-		if($editor_config->content_font)
94
+		if ($editor_config->content_font)
95 95
 		{
96 96
 			$font_list = array();
97
-			$fonts = explode(',',$editor_config->content_font);
98
-			for($i=0,$c=count($fonts);$i<$c;$i++)
97
+			$fonts = explode(',', $editor_config->content_font);
98
+			for ($i = 0, $c = count($fonts); $i < $c; $i++)
99 99
 			{
100
-				$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
101
-				if(!$font) continue;
100
+				$font = trim(str_replace(array('"', '\''), '', $fonts[$i]));
101
+				if (!$font) continue;
102 102
 				$font_list[] = $font;
103 103
 			}
104
-			if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
104
+			if (count($font_list)) $editor_config->content_font = '"' . implode('","', $font_list) . '"';
105 105
 		}
106 106
 		$editor_config->content_font_size = Context::get('content_font_size');
107 107
 		$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
108 108
 		$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
109 109
 
110
-		$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant');
110
+		$grants = array('enable_html_grant', 'enable_comment_html_grant', 'upload_file_grant', 'comment_upload_file_grant', 'enable_default_component_grant', 'enable_comment_default_component_grant', 'enable_component_grant', 'enable_comment_component_grant');
111 111
 
112
-		foreach($grants as $key)
112
+		foreach ($grants as $key)
113 113
 		{
114 114
 			$grant = Context::get($key);
115
-			if(!$grant)
115
+			if (!$grant)
116 116
 			{
117 117
 				$editor_config->{$key} = array();
118 118
 			}
119
-			else if(is_array($grant))
119
+			else if (is_array($grant))
120 120
 			{
121 121
 				$editor_config->{$key} = $grant;
122 122
 			}
@@ -126,17 +126,17 @@  discard block
 block discarded – undo
126 126
 			}
127 127
 		}
128 128
 
129
-		$editor_config->editor_height = (int)Context::get('editor_height');
130
-		$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
129
+		$editor_config->editor_height = (int) Context::get('editor_height');
130
+		$editor_config->comment_editor_height = (int) Context::get('comment_editor_height');
131 131
 		$editor_config->enable_autosave = Context::get('enable_autosave');
132
-		if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
132
+		if ($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
133 133
 
134 134
 		$oModuleController = getController('module');
135
-		for($i=0;$i<count($module_srl);$i++)
135
+		for ($i = 0; $i < count($module_srl); $i++)
136 136
 		{
137 137
 			$srl = trim($module_srl[$i]);
138
-			if(!$srl) continue;
139
-			$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
138
+			if (!$srl) continue;
139
+			$oModuleController->insertModulePartConfig('editor', $srl, $editor_config);
140 140
 		}
141 141
 
142 142
 		$this->setError(-1);
@@ -151,45 +151,45 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	function triggerEditorComponentCompile(&$content)
153 153
 	{
154
-		if(Context::getResponseMethod()!='HTML') return new Object();
154
+		if (Context::getResponseMethod() != 'HTML') return new Object();
155 155
 
156 156
 		$module_info = Context::get('module_info');
157 157
 		$module_srl = $module_info->module_srl;
158
-		if($module_srl)
158
+		if ($module_srl)
159 159
 		{
160 160
 			$oEditorModel = getModel('editor');
161 161
 			$editor_config = $oEditorModel->getEditorConfig($module_srl);
162 162
 			$content_style = $editor_config->content_style;
163
-			if($content_style)
163
+			if ($content_style)
164 164
 			{
165
-				$path = _XE_PATH_ . 'modules/editor/styles/'.$content_style.'/';
166
-				if(is_dir($path) && file_exists($path . 'style.ini'))
165
+				$path = _XE_PATH_ . 'modules/editor/styles/' . $content_style . '/';
166
+				if (is_dir($path) && file_exists($path . 'style.ini'))
167 167
 				{
168
-					$ini = file($path.'style.ini');
169
-					for($i = 0, $c = count($ini); $i < $c; $i++)
168
+					$ini = file($path . 'style.ini');
169
+					for ($i = 0, $c = count($ini); $i < $c; $i++)
170 170
 					{
171 171
 						$file = trim($ini[$i]);
172
-						if(!$file) continue;
172
+						if (!$file) continue;
173 173
 
174
-						if(substr_compare($file, '.css', -4) === 0)
174
+						if (substr_compare($file, '.css', -4) === 0)
175 175
 						{
176
-							Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
176
+							Context::addCSSFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
177 177
 						}
178
-						elseif(substr_compare($file, '.js', -3) === 0)
178
+						elseif (substr_compare($file, '.js', -3) === 0)
179 179
 						{
180
-							Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
180
+							Context::addJsFile('./modules/editor/styles/' . $content_style . '/' . $file, false);
181 181
 						}
182 182
 					}
183 183
 				}
184 184
 			}
185 185
 			$content_font = $editor_config->content_font;
186 186
 			$content_font_size = $editor_config->content_font_size;
187
-			if($content_font || $content_font_size)
187
+			if ($content_font || $content_font_size)
188 188
 			{
189 189
 				$buff = array();
190 190
 				$buff[] = '<style> .xe_content { ';
191
-				if($content_font) $buff[] = 'font-family:'.$content_font.';';
192
-				if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
191
+				if ($content_font) $buff[] = 'font-family:' . $content_font . ';';
192
+				if ($content_font_size) $buff[] = 'font-size:' . $content_font_size . ';';
193 193
 				$buff[] = ' }</style>';
194 194
 				Context::addHtmlHeader(implode('', $buff));
195 195
 			}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	function transComponent($content)
206 206
 	{
207
-		$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this,'transEditorComponent'), $content);
207
+		$content = preg_replace_callback('!<(?:(div)|img)([^>]*)editor_component=([^>]*)>(?(1)(.*?)</div>)!is', array($this, 'transEditorComponent'), $content);
208 208
 		return $content;
209 209
 	}
210 210
 
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
 
220 220
 		$xml_obj = new stdClass;
221 221
 		$xml_obj->attrs = new stdClass;
222
-		for($i=0,$c=count($m[0]);$i<$c;$i++)
222
+		for ($i = 0, $c = count($m[0]); $i < $c; $i++)
223 223
 		{
224
-			if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
224
+			if (!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
225 225
 			$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
226 226
 		}
227 227
 		$xml_obj->body = $match[4];
228 228
 
229
-		if(!$xml_obj->attrs->editor_component) return $match[0];
229
+		if (!$xml_obj->attrs->editor_component) return $match[0];
230 230
 
231 231
 		// Get converted codes by using component::transHTML()
232 232
 		$oEditorModel = getModel('editor');
233 233
 		$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
234
-		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
234
+		if (!is_object($oComponent) || !method_exists($oComponent, 'transHTML')) return $match[0];
235 235
 
236 236
 		return $oComponent->transHTML($xml_obj);
237 237
 	}
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	function doSaveDoc($args)
243 243
 	{
244
-		if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
245
-		if(Context::get('is_logged'))
244
+		if (!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
245
+		if (Context::get('is_logged'))
246 246
 		{
247 247
 			$logged_info = Context::get('logged_info');
248 248
 			$args->member_srl = $logged_info->member_srl;
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 		}
254 254
 
255 255
 		// Get the current module if module_srl doesn't exist
256
-		if(!$args->module_srl)
256
+		if (!$args->module_srl)
257 257
 		{
258 258
 			$args->module_srl = Context::get('module_srl');
259 259
 		}
260
-		if(!$args->module_srl)
260
+		if (!$args->module_srl)
261 261
 		{
262 262
 			$current_module_info = Context::get('current_module_info');
263 263
 			$args->module_srl = $current_module_info->module_srl;
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	function deleteSavedDoc($mode = false)
304 304
 	{
305 305
 		$args = new stdClass();
306
-		if(Context::get('is_logged'))
306
+		if (Context::get('is_logged'))
307 307
 		{
308 308
 			$logged_info = Context::get('logged_info');
309 309
 			$args->member_srl = $logged_info->member_srl;
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		}
315 315
 		$args->module_srl = Context::get('module_srl');
316 316
 		// Get the current module if module_srl doesn't exist
317
-		if(!$args->module_srl)
317
+		if (!$args->module_srl)
318 318
 		{
319 319
 			$current_module_info = Context::get('current_module_info');
320 320
 			$args->module_srl = $current_module_info->module_srl;
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 		// Check if the auto-saved document already exists
323 323
 		$output = executeQuery('editor.getSavedDocument', $args);
324 324
 		$saved_doc = $output->data;
325
-		if(!$saved_doc) return;
325
+		if (!$saved_doc) return;
326 326
 
327 327
 		$oDocumentModel = getModel('document');
328 328
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
329
-		if(!$oSaved->isExists())
329
+		if (!$oSaved->isExists())
330 330
 		{
331
-			if($mode)
331
+			if ($mode)
332 332
 			{
333 333
 				$output = executeQuery('editor.getSavedDocument', $args);
334 334
 				$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 		$oEditorModel = getModel('editor');
357 357
 		$args = new stdClass;
358 358
 
359
-		if($filter_enabled) $args->enabled = "Y";
359
+		if ($filter_enabled) $args->enabled = "Y";
360 360
 
361
-		if($site_srl)
361
+		if ($site_srl)
362 362
 		{
363 363
 			$args->site_srl = $site_srl;
364 364
 			$output = executeQuery('editor.getSiteComponentList', $args);
@@ -367,14 +367,14 @@  discard block
 block discarded – undo
367 367
 		$db_list = $output->data;
368 368
 
369 369
 		// Get a list of files
370
-		$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
370
+		$downloaded_list = FileHandler::readDir(_XE_PATH_ . 'modules/editor/components');
371 371
 
372 372
 		// Get information about log-in status and its group
373 373
 		$is_logged = Context::get('is_logged');
374
-		if($is_logged)
374
+		if ($is_logged)
375 375
 		{
376 376
 			$logged_info = Context::get('logged_info');
377
-			if($logged_info->group_list && is_array($logged_info->group_list))
377
+			if ($logged_info->group_list && is_array($logged_info->group_list))
378 378
 			{
379 379
 				$group_list = array_keys($logged_info->group_list);
380 380
 			}
@@ -382,30 +382,30 @@  discard block
 block discarded – undo
382 382
 		}
383 383
 
384 384
 		// Get xml information for looping DB list
385
-		if(!is_array($db_list)) $db_list = array($db_list);
385
+		if (!is_array($db_list)) $db_list = array($db_list);
386 386
 		$component_list = new stdClass();
387
-		foreach($db_list as $component)
387
+		foreach ($db_list as $component)
388 388
 		{
389
-			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
389
+			if (in_array($component->component_name, array('colorpicker_text', 'colorpicker_bg'))) continue;
390 390
 
391 391
 			$component_name = $component->component_name;
392
-			if(!$component_name) continue;
392
+			if (!$component_name) continue;
393 393
 
394
-			if(!in_array($component_name, $downloaded_list)) continue;
394
+			if (!in_array($component_name, $downloaded_list)) continue;
395 395
 
396 396
 			unset($xml_info);
397 397
 			$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
398 398
 			$xml_info->enabled = $component->enabled;
399 399
 
400
-			if($component->extra_vars)
400
+			if ($component->extra_vars)
401 401
 			{
402 402
 				$extra_vars = unserialize($component->extra_vars);
403
-				if($extra_vars->target_group)
403
+				if ($extra_vars->target_group)
404 404
 				{
405 405
 					$xml_info->target_group = $extra_vars->target_group;
406 406
 				}
407 407
 
408
-				if($extra_vars->mid_list && count($extra_vars->mid_list))
408
+				if ($extra_vars->mid_list && count($extra_vars->mid_list))
409 409
 				{
410 410
 					$xml_info->mid_list = $extra_vars->mid_list;
411 411
 				}
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
 				if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
433 433
 				}*/
434 434
 				// Check the configuration of the editor component
435
-				if($xml_info->extra_vars)
435
+				if ($xml_info->extra_vars)
436 436
 				{
437
-					foreach($xml_info->extra_vars as $key => $val)
437
+					foreach ($xml_info->extra_vars as $key => $val)
438 438
 					{
439 439
 						$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
440 440
 					}
@@ -443,27 +443,27 @@  discard block
 block discarded – undo
443 443
 
444 444
 			$component_list->{$component_name} = $xml_info;
445 445
 			// Get buttons, icons, images
446
-			$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
447
-			$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
448
-			if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
449
-			if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
446
+			$icon_file = _XE_PATH_ . 'modules/editor/components/' . $component_name . '/icon.gif';
447
+			$component_icon_file = _XE_PATH_ . 'modules/editor/components/' . $component_name . '/component_icon.gif';
448
+			if (file_exists($icon_file)) $component_list->{$component_name}->icon = true;
449
+			if (file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
450 450
 		}
451 451
 
452 452
 		// Return if it checks enabled only
453
-		if($filter_enabled)
453
+		if ($filter_enabled)
454 454
 		{
455 455
 			$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
456
-			$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
456
+			$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list)));
457 457
 			FileHandler::writeFile($cache_file, $buff);
458 458
 			return $component_list;
459 459
 		}
460 460
 
461 461
 		// Get xml_info of downloaded list
462
-		foreach($downloaded_list as $component_name)
462
+		foreach ($downloaded_list as $component_name)
463 463
 		{
464
-			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
464
+			if (in_array($component_name, array('colorpicker_text', 'colorpicker_bg'))) continue;
465 465
 			// Pass if configured
466
-			if($component_list->{$component_name}) continue;
466
+			if ($component_list->{$component_name}) continue;
467 467
 			// Insert data into the DB
468 468
 			$oEditorController = getAdminController('editor');
469 469
 			$oEditorController->insertComponent($component_name, false, $site_srl);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		}
477 477
 
478 478
 		$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
479
-		$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
479
+		$buff = sprintf('<?php if(!defined("__XE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"', '\\"', serialize($component_list)));
480 480
 		FileHandler::writeFile($cache_file, $buff);
481 481
 
482 482
 		return $component_list;
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
 		$editorConfig = $oModuleModel->getModulePartConfig('editor', $obj->originModuleSrl);
499 499
 
500 500
 		$oModuleController = getController('module');
501
-		if(is_array($obj->moduleSrlList))
501
+		if (is_array($obj->moduleSrlList))
502 502
 		{
503
-			foreach($obj->moduleSrlList AS $key=>$moduleSrl)
503
+			foreach ($obj->moduleSrlList AS $key=>$moduleSrl)
504 504
 			{
505 505
 				$oModuleController->insertModulePartConfig('editor', $moduleSrl, $editorConfig);
506 506
 			}
Please login to merge, or discard this patch.
Braces   +97 added lines, -42 removed lines patch added patch discarded remove patch
@@ -47,20 +47,31 @@  discard block
 block discarded – undo
47 47
 	{
48 48
 		$component = Context::get('component');
49 49
 		$method = Context::get('method');
50
-		if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
50
+		if(!$component) {
51
+			return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
52
+		}
51 53
 
52 54
 		$oEditorModel = getModel('editor');
53 55
 		$oComponent = &$oEditorModel->getComponentObject($component);
54
-		if(!$oComponent->toBool()) return $oComponent;
56
+		if(!$oComponent->toBool()) {
57
+			return $oComponent;
58
+		}
55 59
 
56
-		if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
60
+		if(!method_exists($oComponent, $method)) {
61
+			return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
62
+		}
57 63
 
58 64
 		//$output = call_user_method($method, $oComponent);
59 65
 		//$output = call_user_func(array($oComponent, $method));
60
-		if(method_exists($oComponent, $method)) $output = $oComponent->{$method}();
61
-		else return new Object(-1,sprintf('%s method is not exists', $method));
66
+		if(method_exists($oComponent, $method)) {
67
+			$output = $oComponent->{$method}();
68
+		} else {
69
+			return new Object(-1,sprintf('%s method is not exists', $method));
70
+		}
62 71
 
63
-		if((is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) && !$output->toBool()) return $output;
72
+		if((is_a($output, 'XEObject') || is_subclass_of($output, 'XEObject')) && !$output->toBool()) {
73
+			return $output;
74
+		}
64 75
 
65 76
 		$this->setError($oComponent->getError());
66 77
 		$this->setMessage($oComponent->getMessage());
@@ -82,8 +93,11 @@  discard block
 block discarded – undo
82 93
 	{
83 94
 		$module_srl = Context::get('target_module_srl');
84 95
 		// To configure many of modules at once
85
-		if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
86
-		else $module_srl = array($module_srl);
96
+		if(preg_match('/^([0-9,]+)$/',$module_srl)) {
97
+			$module_srl = explode(',',$module_srl);
98
+		} else {
99
+			$module_srl = array($module_srl);
100
+		}
87 101
 
88 102
 		$editor_config = new stdClass;
89 103
 		$editor_config->editor_skin = Context::get('editor_skin');
@@ -98,10 +112,14 @@  discard block
 block discarded – undo
98 112
 			for($i=0,$c=count($fonts);$i<$c;$i++)
99 113
 			{
100 114
 				$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
101
-				if(!$font) continue;
115
+				if(!$font) {
116
+					continue;
117
+				}
102 118
 				$font_list[] = $font;
103 119
 			}
104
-			if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
120
+			if(count($font_list)) {
121
+				$editor_config->content_font = '"'.implode('","',$font_list).'"';
122
+			}
105 123
 		}
106 124
 		$editor_config->content_font_size = Context::get('content_font_size');
107 125
 		$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
@@ -115,12 +133,10 @@  discard block
 block discarded – undo
115 133
 			if(!$grant)
116 134
 			{
117 135
 				$editor_config->{$key} = array();
118
-			}
119
-			else if(is_array($grant))
136
+			} else if(is_array($grant))
120 137
 			{
121 138
 				$editor_config->{$key} = $grant;
122
-			}
123
-			else
139
+			} else
124 140
 			{
125 141
 				$editor_config->{$key} = explode('|@|', $grant);
126 142
 			}
@@ -129,13 +145,17 @@  discard block
 block discarded – undo
129 145
 		$editor_config->editor_height = (int)Context::get('editor_height');
130 146
 		$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
131 147
 		$editor_config->enable_autosave = Context::get('enable_autosave');
132
-		if($editor_config->enable_autosave != 'Y') $editor_config->enable_autosave = 'N';
148
+		if($editor_config->enable_autosave != 'Y') {
149
+			$editor_config->enable_autosave = 'N';
150
+		}
133 151
 
134 152
 		$oModuleController = getController('module');
135 153
 		for($i=0;$i<count($module_srl);$i++)
136 154
 		{
137 155
 			$srl = trim($module_srl[$i]);
138
-			if(!$srl) continue;
156
+			if(!$srl) {
157
+				continue;
158
+			}
139 159
 			$oModuleController->insertModulePartConfig('editor',$srl,$editor_config);
140 160
 		}
141 161
 
@@ -151,7 +171,9 @@  discard block
 block discarded – undo
151 171
 	 */
152 172
 	function triggerEditorComponentCompile(&$content)
153 173
 	{
154
-		if(Context::getResponseMethod()!='HTML') return new Object();
174
+		if(Context::getResponseMethod()!='HTML') {
175
+			return new Object();
176
+		}
155 177
 
156 178
 		$module_info = Context::get('module_info');
157 179
 		$module_srl = $module_info->module_srl;
@@ -169,13 +191,14 @@  discard block
 block discarded – undo
169 191
 					for($i = 0, $c = count($ini); $i < $c; $i++)
170 192
 					{
171 193
 						$file = trim($ini[$i]);
172
-						if(!$file) continue;
194
+						if(!$file) {
195
+							continue;
196
+						}
173 197
 
174 198
 						if(substr_compare($file, '.css', -4) === 0)
175 199
 						{
176 200
 							Context::addCSSFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
177
-						}
178
-						elseif(substr_compare($file, '.js', -3) === 0)
201
+						} elseif(substr_compare($file, '.js', -3) === 0)
179 202
 						{
180 203
 							Context::addJsFile('./modules/editor/styles/'.$content_style.'/'.$file, false);
181 204
 						}
@@ -188,8 +211,12 @@  discard block
 block discarded – undo
188 211
 			{
189 212
 				$buff = array();
190 213
 				$buff[] = '<style> .xe_content { ';
191
-				if($content_font) $buff[] = 'font-family:'.$content_font.';';
192
-				if($content_font_size) $buff[] = 'font-size:'.$content_font_size.';';
214
+				if($content_font) {
215
+					$buff[] = 'font-family:'.$content_font.';';
216
+				}
217
+				if($content_font_size) {
218
+					$buff[] = 'font-size:'.$content_font_size.';';
219
+				}
193 220
 				$buff[] = ' }</style>';
194 221
 				Context::addHtmlHeader(implode('', $buff));
195 222
 			}
@@ -221,17 +248,23 @@  discard block
 block discarded – undo
221 248
 		$xml_obj->attrs = new stdClass;
222 249
 		for($i=0,$c=count($m[0]);$i<$c;$i++)
223 250
 		{
224
-			if(!isset($xml_obj->attrs)) $xml_obj->attrs = new stdClass;
251
+			if(!isset($xml_obj->attrs)) {
252
+				$xml_obj->attrs = new stdClass;
253
+			}
225 254
 			$xml_obj->attrs->{$m[1][$i]} = $m[2][$i];
226 255
 		}
227 256
 		$xml_obj->body = $match[4];
228 257
 
229
-		if(!$xml_obj->attrs->editor_component) return $match[0];
258
+		if(!$xml_obj->attrs->editor_component) {
259
+			return $match[0];
260
+		}
230 261
 
231 262
 		// Get converted codes by using component::transHTML()
232 263
 		$oEditorModel = getModel('editor');
233 264
 		$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
234
-		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $match[0];
265
+		if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) {
266
+			return $match[0];
267
+		}
235 268
 
236 269
 		return $oComponent->transHTML($xml_obj);
237 270
 	}
@@ -241,13 +274,14 @@  discard block
 block discarded – undo
241 274
 	 */
242 275
 	function doSaveDoc($args)
243 276
 	{
244
-		if(!$args->document_srl) $args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
277
+		if(!$args->document_srl) {
278
+			$args->document_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
279
+		}
245 280
 		if(Context::get('is_logged'))
246 281
 		{
247 282
 			$logged_info = Context::get('logged_info');
248 283
 			$args->member_srl = $logged_info->member_srl;
249
-		}
250
-		else
284
+		} else
251 285
 		{
252 286
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
253 287
 		}
@@ -307,8 +341,7 @@  discard block
 block discarded – undo
307 341
 		{
308 342
 			$logged_info = Context::get('logged_info');
309 343
 			$args->member_srl = $logged_info->member_srl;
310
-		}
311
-		else
344
+		} else
312 345
 		{
313 346
 			$args->ipaddress = $_SERVER['REMOTE_ADDR'];
314 347
 		}
@@ -322,7 +355,9 @@  discard block
 block discarded – undo
322 355
 		// Check if the auto-saved document already exists
323 356
 		$output = executeQuery('editor.getSavedDocument', $args);
324 357
 		$saved_doc = $output->data;
325
-		if(!$saved_doc) return;
358
+		if(!$saved_doc) {
359
+			return;
360
+		}
326 361
 
327 362
 		$oDocumentModel = getModel('document');
328 363
 		$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
@@ -356,14 +391,17 @@  discard block
 block discarded – undo
356 391
 		$oEditorModel = getModel('editor');
357 392
 		$args = new stdClass;
358 393
 
359
-		if($filter_enabled) $args->enabled = "Y";
394
+		if($filter_enabled) {
395
+			$args->enabled = "Y";
396
+		}
360 397
 
361 398
 		if($site_srl)
362 399
 		{
363 400
 			$args->site_srl = $site_srl;
364 401
 			$output = executeQuery('editor.getSiteComponentList', $args);
402
+		} else {
403
+			$output = executeQuery('editor.getComponentList', $args);
365 404
 		}
366
-		else $output = executeQuery('editor.getComponentList', $args);
367 405
 		$db_list = $output->data;
368 406
 
369 407
 		// Get a list of files
@@ -377,21 +415,30 @@  discard block
 block discarded – undo
377 415
 			if($logged_info->group_list && is_array($logged_info->group_list))
378 416
 			{
379 417
 				$group_list = array_keys($logged_info->group_list);
418
+			} else {
419
+				$group_list = array();
380 420
 			}
381
-			else $group_list = array();
382 421
 		}
383 422
 
384 423
 		// Get xml information for looping DB list
385
-		if(!is_array($db_list)) $db_list = array($db_list);
424
+		if(!is_array($db_list)) {
425
+			$db_list = array($db_list);
426
+		}
386 427
 		$component_list = new stdClass();
387 428
 		foreach($db_list as $component)
388 429
 		{
389
-			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
430
+			if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) {
431
+				continue;
432
+			}
390 433
 
391 434
 			$component_name = $component->component_name;
392
-			if(!$component_name) continue;
435
+			if(!$component_name) {
436
+				continue;
437
+			}
393 438
 
394
-			if(!in_array($component_name, $downloaded_list)) continue;
439
+			if(!in_array($component_name, $downloaded_list)) {
440
+				continue;
441
+			}
395 442
 
396 443
 			unset($xml_info);
397 444
 			$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
@@ -445,8 +492,12 @@  discard block
 block discarded – undo
445 492
 			// Get buttons, icons, images
446 493
 			$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
447 494
 			$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
448
-			if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
449
-			if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
495
+			if(file_exists($icon_file)) {
496
+				$component_list->{$component_name}->icon = true;
497
+			}
498
+			if(file_exists($component_icon_file)) {
499
+				$component_list->{$component_name}->component_icon = true;
500
+			}
450 501
 		}
451 502
 
452 503
 		// Return if it checks enabled only
@@ -461,9 +512,13 @@  discard block
 block discarded – undo
461 512
 		// Get xml_info of downloaded list
462 513
 		foreach($downloaded_list as $component_name)
463 514
 		{
464
-			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
515
+			if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) {
516
+				continue;
517
+			}
465 518
 			// Pass if configured
466
-			if($component_list->{$component_name}) continue;
519
+			if($component_list->{$component_name}) {
520
+				continue;
521
+			}
467 522
 			// Insert data into the DB
468 523
 			$oEditorController = getAdminController('editor');
469 524
 			$oEditorController->insertComponent($component_name, false, $site_srl);
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.lib.php 1 patch
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$oModel = getModel('autoinstall');
80 80
 		$type = $oModel->getTypeFromPath($this->package->path);
81
-		if($type == "module")
81
+		if ($type == "module")
82 82
 		{
83 83
 			$output = $this->uninstallModule();
84
-			if(!$output->toBool())
84
+			if (!$output->toBool())
85 85
 			{
86 86
 				return $output;
87 87
 			}
88 88
 		}
89 89
 
90 90
 		$output = $this->_connect();
91
-		if(!$output->toBool())
91
+		if (!$output->toBool())
92 92
 		{
93 93
 			return $output;
94 94
 		}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function _download()
118 118
 	{
119
-		if($this->package->path == ".")
119
+		if ($this->package->path == ".")
120 120
 		{
121 121
 			$this->download_file = $this->temp_dir . "xe.tar";
122 122
 			$this->target_path = "";
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$path_array = explode("/", $this->package->path);
153 153
 		$target_name = array_pop($path_array);
154 154
 		$oModule = getModule($target_name, "class");
155
-		if(!$oModule)
155
+		if (!$oModule)
156 156
 		{
157 157
 			return new Object(-1, 'msg_invalid_request');
158 158
 		}
159
-		if(!method_exists($oModule, "moduleUninstall"))
159
+		if (!method_exists($oModule, "moduleUninstall"))
160 160
 		{
161 161
 			return new Object(-1, 'msg_invalid_request');
162 162
 		}
163 163
 
164 164
 		$output = $oModule->moduleUninstall();
165
-		if(is_subclass_of($output, 'XEObject') && !$output->toBool())
165
+		if (is_subclass_of($output, 'XEObject') && !$output->toBool())
166 166
 		{
167 167
 			return $output;
168 168
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		$schema_dir = sprintf('%s/schemas/', $this->package->path);
171 171
 		$schema_files = FileHandler::readDir($schema_dir);
172 172
 		$oDB = DB::getInstance();
173
-		if(is_array($schema_files))
173
+		if (is_array($schema_files))
174 174
 		{
175
-			foreach($schema_files as $file)
175
+			foreach ($schema_files as $file)
176 176
 			{
177 177
 				$filename_arr = explode(".", $file);
178 178
 				$filename = array_shift($filename_arr);
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 	function installModule()
193 193
 	{
194 194
 		$path = $this->package->path;
195
-		if($path != ".")
195
+		if ($path != ".")
196 196
 		{
197 197
 			$path_array = explode("/", $path);
198 198
 			$target_name = array_pop($path_array);
199 199
 			$type = substr(array_pop($path_array), 0, -1);
200 200
 		}
201 201
 
202
-		if($type == "module")
202
+		if ($type == "module")
203 203
 		{
204 204
 			$oModuleModel = getModel('module');
205 205
 			$oInstallController = getController('install');
206 206
 			$module_path = ModuleHandler::getModulePath($target_name);
207
-			if($oModuleModel->checkNeedInstall($target_name))
207
+			if ($oModuleModel->checkNeedInstall($target_name))
208 208
 			{
209 209
 				$oInstallController->installModule($target_name, $module_path);
210 210
 			}
211
-			if($oModuleModel->checkNeedUpdate($target_name))
211
+			if ($oModuleModel->checkNeedUpdate($target_name))
212 212
 			{
213 213
 				$oModule = getModule($target_name, 'class');
214
-				if(method_exists($oModule, 'moduleUpdate'))
214
+				if (method_exists($oModule, 'moduleUpdate'))
215 215
 				{
216 216
 					$oModule->moduleUpdate();
217 217
 				}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$this->_download();
232 232
 		$file_list = $this->_unPack();
233 233
 		$output = $this->_copyDir($file_list);
234
-		if(!$output->toBool())
234
+		if (!$output->toBool())
235 235
 		{
236 236
 			FileHandler::removeDir($this->temp_dir);
237 237
 			return $output;
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 
257 257
 		$_files = $oTar->files;
258 258
 		$file_list = array();
259
-		if(is_array($_files))
259
+		if (is_array($_files))
260 260
 		{
261
-			foreach($_files as $key => $info)
261
+			foreach ($_files as $key => $info)
262 262
 			{
263 263
 				FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
264 264
 				$file_list[] = $info['name'];
@@ -278,22 +278,22 @@  discard block
 block discarded – undo
278 278
 		$real_path = FileHandler::getRealPath($path);
279 279
 		$oDir = dir($path);
280 280
 		$files = array();
281
-		while($file = $oDir->read())
281
+		while ($file = $oDir->read())
282 282
 		{
283
-			if($file == "." || $file == "..")
283
+			if ($file == "." || $file == "..")
284 284
 			{
285 285
 				continue;
286 286
 			}
287 287
 			$files[] = $file;
288 288
 		}
289 289
 
290
-		foreach($files as $file)
290
+		foreach ($files as $file)
291 291
 		{
292 292
 			$file_path = $path . "/" . $file;
293
-			if(is_dir(FileHandler::getRealPath($file_path)))
293
+			if (is_dir(FileHandler::getRealPath($file_path)))
294 294
 			{
295 295
 				$output = $this->_removeDir($file_path);
296
-				if(!$output->toBool())
296
+				if (!$output->toBool())
297 297
 				{
298 298
 					return $output;
299 299
 				}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			else
302 302
 			{
303 303
 				$output = $this->_removeFile($file_path);
304
-				if(!$output->toBool())
304
+				if (!$output->toBool())
305 305
 				{
306 306
 					return $output;
307 307
 				}
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function _connect()
359 359
 	{
360
-		if(!function_exists('ssh2_connect'))
360
+		if (!function_exists('ssh2_connect'))
361 361
 		{
362 362
 			return new Object(-1, 'msg_sftp_not_supported');
363 363
 		}
364 364
 
365
-		if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
365
+		if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
366 366
 		{
367 367
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
368 368
 		}
369 369
 
370
-		if($this->ftp_info->ftp_host)
370
+		if ($this->ftp_info->ftp_host)
371 371
 		{
372 372
 			$ftp_host = $this->ftp_info->ftp_host;
373 373
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$ftp_host = "127.0.0.1";
377 377
 		}
378 378
 		$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
379
-		if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
379
+		if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
380 380
 		{
381 381
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
382 382
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function _removeFile($path)
405 405
 	{
406
-		if(substr($path, 0, 2) == "./")
406
+		if (substr($path, 0, 2) == "./")
407 407
 		{
408 408
 			$path = substr($path, 2);
409 409
 		}
410 410
 		$target_path = $this->ftp_info->ftp_root_path . $path;
411 411
 
412
-		if(!@ssh2_sftp_unlink($this->sftp, $target_path))
412
+		if (!@ssh2_sftp_unlink($this->sftp, $target_path))
413 413
 		{
414 414
 			return new Object(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
415 415
 		}
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	function _removeDir_real($path)
426 426
 	{
427
-		if(substr($path, 0, 2) == "./")
427
+		if (substr($path, 0, 2) == "./")
428 428
 		{
429 429
 			$path = substr($path, 2);
430 430
 		}
431 431
 		$target_path = $this->ftp_info->ftp_root_path . $path;
432 432
 
433
-		if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
433
+		if (!@ssh2_sftp_rmdir($this->sftp, $target_path))
434 434
 		{
435 435
 			return new Object(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
436 436
 		}
@@ -445,31 +445,31 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	function _copyDir(&$file_list)
447 447
 	{
448
-		if(!$this->ftp_password)
448
+		if (!$this->ftp_password)
449 449
 		{
450 450
 			return new Object(-1, 'msg_ftp_password_input');
451 451
 		}
452 452
 
453 453
 		$output = $this->_connect();
454
-		if(!$output->toBool())
454
+		if (!$output->toBool())
455 455
 		{
456 456
 			return $output;
457 457
 		}
458 458
 		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
459 459
 
460
-		if(is_array($file_list))
460
+		if (is_array($file_list))
461 461
 		{
462
-			foreach($file_list as $k => $file)
462
+			foreach ($file_list as $k => $file)
463 463
 			{
464 464
 				$org_file = $file;
465
-				if($this->package->path == ".")
465
+				if ($this->package->path == ".")
466 466
 				{
467 467
 					$file = substr($file, 3);
468 468
 				}
469 469
 				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
470 470
 				$pathname = dirname($target_dir . "/" . $file);
471 471
 
472
-				if(!file_exists(FileHandler::getRealPath($real_path)))
472
+				if (!file_exists(FileHandler::getRealPath($real_path)))
473 473
 				{
474 474
 					ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
475 475
 				}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	function _connect()
522 522
 	{
523
-		if($this->ftp_info->ftp_host)
523
+		if ($this->ftp_info->ftp_host)
524 524
 		{
525 525
 			$ftp_host = $this->ftp_info->ftp_host;
526 526
 		}
@@ -530,20 +530,20 @@  discard block
 block discarded – undo
530 530
 		}
531 531
 
532 532
 		$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
533
-		if(!$this->connection)
533
+		if (!$this->connection)
534 534
 		{
535 535
 			return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_host));
536 536
 		}
537 537
 
538 538
 		$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
539
-		if(!$login_result)
539
+		if (!$login_result)
540 540
 		{
541 541
 			$this->_close();
542 542
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
543 543
 		}
544 544
 
545 545
 		$_SESSION['ftp_password'] = $this->ftp_password;
546
-		if($this->ftp_info->ftp_pasv != "N")
546
+		if ($this->ftp_info->ftp_pasv != "N")
547 547
 		{
548 548
 			ftp_pasv($this->connection, TRUE);
549 549
 		}
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 	 */
559 559
 	function _removeFile($path)
560 560
 	{
561
-		if(substr($path, 0, 2) == "./")
561
+		if (substr($path, 0, 2) == "./")
562 562
 		{
563 563
 			$path = substr($path, 2);
564 564
 		}
565 565
 		$target_path = $this->ftp_info->ftp_root_path . $path;
566 566
 
567
-		if(!@ftp_delete($this->connection, $target_path))
567
+		if (!@ftp_delete($this->connection, $target_path))
568 568
 		{
569 569
 			return new Object(-1, "failed to delete file " . $path);
570 570
 		}
@@ -579,13 +579,13 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	function _removeDir_real($path)
581 581
 	{
582
-		if(substr($path, 0, 2) == "./")
582
+		if (substr($path, 0, 2) == "./")
583 583
 		{
584 584
 			$path = substr($path, 2);
585 585
 		}
586 586
 		$target_path = $this->ftp_info->ftp_root_path . $path;
587 587
 
588
-		if(!@ftp_rmdir($this->connection, $target_path))
588
+		if (!@ftp_rmdir($this->connection, $target_path))
589 589
 		{
590 590
 			return new Object(-1, "failed to delete directory " . $path);
591 591
 		}
@@ -610,37 +610,37 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	function _copyDir(&$file_list)
612 612
 	{
613
-		if(!$this->ftp_password)
613
+		if (!$this->ftp_password)
614 614
 		{
615 615
 			return new Object(-1, 'msg_ftp_password_input');
616 616
 		}
617 617
 
618 618
 		$output = $this->_connect();
619
-		if(!$output->toBool())
619
+		if (!$output->toBool())
620 620
 		{
621 621
 			return $output;
622 622
 		}
623 623
 
624
-		if(!$this->target_path)
624
+		if (!$this->target_path)
625 625
 		{
626 626
 			$this->target_path = '.';
627 627
 		}
628
-		if(substr($this->download_path, -1) == '/')
628
+		if (substr($this->download_path, -1) == '/')
629 629
 		{
630 630
 			$this->download_path = substr($this->download_path, 0, -1);
631 631
 		}
632 632
 		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
633 633
 
634
-		if(is_array($file_list))
634
+		if (is_array($file_list))
635 635
 		{
636
-			foreach($file_list as $k => $file)
636
+			foreach ($file_list as $k => $file)
637 637
 			{
638
-				if(!$file)
638
+				if (!$file)
639 639
 				{
640 640
 					continue;
641 641
 				}
642 642
 				$org_file = $file;
643
-				if($this->package->path == ".")
643
+				if ($this->package->path == ".")
644 644
 				{
645 645
 					$file = substr($file, 3);
646 646
 				}
@@ -650,33 +650,33 @@  discard block
 block discarded – undo
650 650
 				$real_path = "./";
651 651
 				$ftp_path = $this->ftp_info->ftp_root_path;
652 652
 
653
-				for($i = 0; $i < count($path_list); $i++)
653
+				for ($i = 0; $i < count($path_list); $i++)
654 654
 				{
655
-					if($path_list == "")
655
+					if ($path_list == "")
656 656
 					{
657 657
 						continue;
658 658
 					}
659 659
 					$real_path .= $path_list[$i] . "/";
660 660
 					$ftp_path .= $path_list[$i] . "/";
661
-					if(!file_exists(FileHandler::getRealPath($real_path)))
661
+					if (!file_exists(FileHandler::getRealPath($real_path)))
662 662
 					{
663
-						if(!@ftp_mkdir($this->connection, $ftp_path))
663
+						if (!@ftp_mkdir($this->connection, $ftp_path))
664 664
 						{
665 665
 							return new Object(-1, "msg_make_directory_failed");
666 666
 						}
667 667
 
668
-						if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
668
+						if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
669 669
 						{
670
-							if(function_exists('ftp_chmod'))
670
+							if (function_exists('ftp_chmod'))
671 671
 							{
672
-								if(!ftp_chmod($this->connection, 0755, $ftp_path))
672
+								if (!ftp_chmod($this->connection, 0755, $ftp_path))
673 673
 								{
674 674
 									return new Object(-1, "msg_permission_adjust_failed");
675 675
 								}
676 676
 							}
677 677
 							else
678 678
 							{
679
-								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
679
+								if (!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
680 680
 								{
681 681
 									return new Object(-1, "msg_permission_adjust_failed");
682 682
 								}
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 						}
685 685
 					}
686 686
 				}
687
-				if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
687
+				if (!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
688 688
 				{
689 689
 					return new Object(-1, "msg_ftp_upload_failed");
690 690
 				}
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 	 */
734 734
 	function _connect()
735 735
 	{
736
-		if($this->ftp_info->ftp_host)
736
+		if ($this->ftp_info->ftp_host)
737 737
 		{
738 738
 			$ftp_host = $this->ftp_info->ftp_host;
739 739
 		}
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 		}
744 744
 
745 745
 		$this->oFtp = new ftp();
746
-		if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
746
+		if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
747 747
 		{
748 748
 			return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_host));
749 749
 		}
750
-		if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
750
+		if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
751 751
 		{
752 752
 			$this->_close();
753 753
 			return new Object(-1, 'msg_ftp_invalid_auth_info');
@@ -764,13 +764,13 @@  discard block
 block discarded – undo
764 764
 	 */
765 765
 	function _removeFile($path)
766 766
 	{
767
-		if(substr($path, 0, 2) == "./")
767
+		if (substr($path, 0, 2) == "./")
768 768
 		{
769 769
 			$path = substr($path, 2);
770 770
 		}
771 771
 		$target_path = $this->ftp_info->ftp_root_path . $path;
772 772
 
773
-		if(!$this->oFtp->ftp_delete($target_path))
773
+		if (!$this->oFtp->ftp_delete($target_path))
774 774
 		{
775 775
 			return new Object(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
776 776
 		}
@@ -784,13 +784,13 @@  discard block
 block discarded – undo
784 784
 	 */
785 785
 	function _removeDir_real($path)
786 786
 	{
787
-		if(substr($path, 0, 2) == "./")
787
+		if (substr($path, 0, 2) == "./")
788 788
 		{
789 789
 			$path = substr($path, 2);
790 790
 		}
791 791
 		$target_path = $this->ftp_info->ftp_root_path . $path;
792 792
 
793
-		if(!$this->oFtp->ftp_rmdir($target_path))
793
+		if (!$this->oFtp->ftp_rmdir($target_path))
794 794
 		{
795 795
 			return new Object(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
796 796
 		}
@@ -815,13 +815,13 @@  discard block
 block discarded – undo
815 815
 	 */
816 816
 	function _copyDir(&$file_list)
817 817
 	{
818
-		if(!$this->ftp_password)
818
+		if (!$this->ftp_password)
819 819
 		{
820 820
 			return new Object(-1, 'msg_ftp_password_input');
821 821
 		}
822 822
 
823 823
 		$output = $this->_connect();
824
-		if(!$output->toBool())
824
+		if (!$output->toBool())
825 825
 		{
826 826
 			return $output;
827 827
 		}
@@ -829,12 +829,12 @@  discard block
 block discarded – undo
829 829
 		$oFtp = &$this->oFtp;
830 830
 		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
831 831
 
832
-		if(is_array($file_list))
832
+		if (is_array($file_list))
833 833
 		{
834
-			foreach($file_list as $k => $file)
834
+			foreach ($file_list as $k => $file)
835 835
 			{
836 836
 				$org_file = $file;
837
-				if($this->package->path == ".")
837
+				if ($this->package->path == ".")
838 838
 				{
839 839
 					$file = substr($file, 3);
840 840
 				}
@@ -844,15 +844,15 @@  discard block
 block discarded – undo
844 844
 				$real_path = "./";
845 845
 				$ftp_path = $this->ftp_info->ftp_root_path;
846 846
 
847
-				for($i = 0; $i < count($path_list); $i++)
847
+				for ($i = 0; $i < count($path_list); $i++)
848 848
 				{
849
-					if($path_list == "")
849
+					if ($path_list == "")
850 850
 					{
851 851
 						continue;
852 852
 					}
853 853
 					$real_path .= $path_list[$i] . "/";
854 854
 					$ftp_path .= $path_list[$i] . "/";
855
-					if(!file_exists(FileHandler::getRealPath($real_path)))
855
+					if (!file_exists(FileHandler::getRealPath($real_path)))
856 856
 					{
857 857
 						$oFtp->ftp_mkdir($ftp_path);
858 858
 						$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
@@ -903,13 +903,13 @@  discard block
 block discarded – undo
903 903
 	 */
904 904
 	function _removeFile($path)
905 905
 	{
906
-		if(substr($path, 0, 2) == "./")
906
+		if (substr($path, 0, 2) == "./")
907 907
 		{
908 908
 			$path = substr($path, 2);
909 909
 		}
910 910
 		$target_path = FileHandler::getRealPath($path);
911 911
 
912
-		if(!FileHandler::removeFile($target_path))
912
+		if (!FileHandler::removeFile($target_path))
913 913
 		{
914 914
 			return new Object(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
915 915
 		}
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 	 */
924 924
 	function _removeDir_real($path)
925 925
 	{
926
-		if(substr($path, 0, 2) == "./")
926
+		if (substr($path, 0, 2) == "./")
927 927
 		{
928 928
 			$path = substr($path, 2);
929 929
 		}
@@ -952,18 +952,18 @@  discard block
 block discarded – undo
952 952
 	function _copyDir(&$file_list)
953 953
 	{
954 954
 		$output = $this->_connect();
955
-		if(!$output->toBool())
955
+		if (!$output->toBool())
956 956
 		{
957 957
 			return $output;
958 958
 		}
959 959
 		$target_dir = $this->target_path;
960 960
 
961
-		if(is_array($file_list))
961
+		if (is_array($file_list))
962 962
 		{
963
-			foreach($file_list as $k => $file)
963
+			foreach ($file_list as $k => $file)
964 964
 			{
965 965
 				$org_file = $file;
966
-				if($this->package->path == ".")
966
+				if ($this->package->path == ".")
967 967
 				{
968 968
 					$file = substr($file, 3);
969 969
 				}
@@ -971,19 +971,19 @@  discard block
 block discarded – undo
971 971
 				$path_list = explode('/', dirname($this->target_path . "/" . $file));
972 972
 				$real_path = "./";
973 973
 
974
-				for($i = 0; $i < count($path_list); $i++)
974
+				for ($i = 0; $i < count($path_list); $i++)
975 975
 				{
976
-					if($path_list == "")
976
+					if ($path_list == "")
977 977
 					{
978 978
 						continue;
979 979
 					}
980 980
 					$real_path .= $path_list[$i] . "/";
981
-					if(!file_exists(FileHandler::getRealPath($real_path)))
981
+					if (!file_exists(FileHandler::getRealPath($real_path)))
982 982
 					{
983 983
 						FileHandler::makeDir($real_path);
984 984
 					}
985 985
 				}
986
-				FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
986
+				FileHandler::copyFile(FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
987 987
 			}
988 988
 		}
989 989
 
Please login to merge, or discard this patch.
modules/install/script/ko.install.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 function __makeMenu(&$list, $parent_srl)
131 131
 {
132 132
 	$oMenuAdminController = getAdminController('menu');
133
-	foreach($list as $idx => &$item)
133
+	foreach ($list as $idx => &$item)
134 134
 	{
135 135
 		Context::set('parent_srl', $parent_srl, TRUE);
136 136
 		Context::set('menu_name', $item['menu_name'], TRUE);
137 137
 		Context::set('module_type', $item['module_type'], TRUE);
138 138
 		Context::set('module_id', $item['module_id'], TRUE);
139
-		if($item['is_shortcut'] === 'Y')
139
+		if ($item['is_shortcut'] === 'Y')
140 140
 		{
141 141
 			Context::set('is_shortcut', $item['is_shortcut'], TRUE);
142 142
 			Context::set('shortcut_target', $item['shortcut_target'], TRUE);
@@ -148,23 +148,23 @@  discard block
 block discarded – undo
148 148
 		}
149 149
 
150 150
 		$output = $oMenuAdminController->procMenuAdminInsertItem();
151
-		if($output instanceof XEObject && !$output->toBool())
151
+		if ($output instanceof XEObject && !$output->toBool())
152 152
 		{
153 153
 			return $output;
154 154
 		}
155 155
 		$menu_srl = $oMenuAdminController->get('menu_item_srl');
156 156
 		$item['menu_srl'] = $menu_srl;
157 157
 
158
-		if($item['list']) __makeMenu($item['list'], $menu_srl);
158
+		if ($item['list']) __makeMenu($item['list'], $menu_srl);
159 159
 	}
160 160
 }
161 161
 
162 162
 
163 163
 // 사이트맵 생성
164
-foreach($sitemap as $id => &$val)
164
+foreach ($sitemap as $id => &$val)
165 165
 {
166 166
 	$output = $oMenuAdminController->addMenu($val['title']);
167
-	if(!$output->toBool())
167
+	if (!$output->toBool())
168 168
 	{
169 169
 		return $output;
170 170
 	}
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 
192 192
 $oLayoutAdminController = getAdminController('layout');
193 193
 $output = $oLayoutAdminController->insertLayout($args);
194
-if(!$output->toBool()) return $output;
194
+if (!$output->toBool()) return $output;
195 195
 
196 196
 // update Layout (PC)
197 197
 $args->extra_vars = serialize($extra_vars);
198 198
 $output = $oLayoutAdminController->updateLayout($args);
199
-if(!$output->toBool()) return $output;
199
+if (!$output->toBool()) return $output;
200 200
 
201 201
 //create mobile layout
202 202
 $mlayout_srl = $args->layout_srl = getNextSequence();
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
 $extra_vars->main_menu = $sitemap['GNB']['menu_srl'];
207 207
 
208 208
 $output = $oLayoutAdminController->insertLayout($args);
209
-if(!$output->toBool()) return $output;
209
+if (!$output->toBool()) return $output;
210 210
 
211 211
 // update mobile Layout
212 212
 $args->extra_vars = serialize($extra_vars);
213 213
 $output = $oLayoutAdminController->updateLayout($args);
214
-if(!$output->toBool()) return $output;
214
+if (!$output->toBool()) return $output;
215 215
 
216 216
 
217
-$siteDesignPath = _XE_PATH_.'files/site_design/';
217
+$siteDesignPath = _XE_PATH_ . 'files/site_design/';
218 218
 FileHandler::makeDir($siteDesignPath);
219 219
 
220 220
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 $moduleList = array('page', 'board', 'editor');
226 226
 $moutput = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList);
227
-if($moutput->toBool())
227
+if ($moutput->toBool())
228 228
 {
229 229
 	$moduleList = array_unique($moduleList);
230 230
 }
@@ -234,10 +234,10 @@  discard block
 block discarded – undo
234 234
 $designInfo->module = new stdClass();
235 235
 
236 236
 $oModuleModel = getModel('module'); /* @var $oModuleModel moduleModel */
237
-foreach($skinTypes as $key => $dir)
237
+foreach ($skinTypes as $key => $dir)
238 238
 {
239 239
 	$skinType = $key == 'skin' ? 'P' : 'M';
240
-	foreach($moduleList as $moduleName)
240
+	foreach ($moduleList as $moduleName)
241 241
 	{
242 242
 		$designInfo->module->{$moduleName} = new stdClass();
243 243
 		$designInfo->module->{$moduleName}->{$key} = $oModuleModel->getModuleDefaultSkin($moduleName, $skinType, 0, false);
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 Context::set('version', __XE_VERSION__);
272 272
 $obj->title = 'Welcome XE';
273 273
 
274
-$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_'.$lang);
274
+$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/welcome_content', 'welcome_content_' . $lang);
275 275
 
276 276
 $output = $oDocumentController->insertDocument($obj, true);
277
-if(!$output->toBool()) return $output;
277
+if (!$output->toBool()) return $output;
278 278
 
279 279
 $document_srl = $output->get('document_srl');
280 280
 
281 281
 unset($obj->document_srl);
282 282
 $obj->title = 'Welcome mobile XE';
283 283
 $output = $oDocumentController->insertDocument($obj, true);
284
-if(!$output->toBool()) return $output;
284
+if (!$output->toBool()) return $output;
285 285
 
286 286
 // save PageWidget
287 287
 $oModuleController = getController('module'); /* @var $oModuleController moduleController */
288 288
 $mdocument_srl = $output->get('document_srl');
289 289
 $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
290
-$module_info->content = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$document_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0"  />';
291
-$module_info->mcontent = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="'.$mdocument_srl.'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0"  />';
290
+$module_info->content = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="' . $document_srl . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0"  />';
291
+$module_info->mcontent = '<img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="width: 100%; float: left;" body="" document_srl="' . $mdocument_srl . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0"  />';
292 292
 $output = $oModuleController->updateModule($module_info);
293
-if(!$output->toBool()) return $output;
293
+if (!$output->toBool()) return $output;
294 294
 
295 295
 // insertFirstModule
296 296
 $site_args = new stdClass();
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 $xeicon_module_srl = $moduleInfo->module_srl;
305 305
 
306 306
 $xeicon_document_srl = array();
307
-for($i = 1; $i <=4; $i++)
307
+for ($i = 1; $i <= 4; $i++)
308 308
 {
309 309
 	unset($obj->document_srl);
310 310
 	$obj->title = "XEIcon ({$i})";
311 311
 	$obj->content = $oTemplateHandler->compile(_XE_PATH_ . 'modules/install/script/xeicon_content', 'xeicon_content_ko_' . $i);
312 312
 
313 313
 	$output = $oDocumentController->insertDocument($obj, true);
314
-	if(!$output->toBool()) return $output;
314
+	if (!$output->toBool()) return $output;
315 315
 
316 316
 	$xeicon_document_srl[$i] = $output->get('document_srl');
317 317
 }
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 // save PageWidget
320 320
 $oModuleController = getController('module'); /* @var $oModuleController moduleController */
321 321
 $module_info = $oModuleModel->getModuleInfoByModuleSrl($xeicon_module_srl);
322
-$module_info->content = '<div widget="widgetBox" style="float:left;width:100%;" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" css_class="XEicon" ><div><div><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[1].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[2].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[3].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="'.$xeicon_document_srl[4].'" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /></div></div></div>';
322
+$module_info->content = '<div widget="widgetBox" style="float:left;width:100%;" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" css_class="XEicon" ><div><div><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[1] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[2] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[3] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /><img hasContent="true" class="zbxe_widget_output" widget="widgetContent" style="float:left;padding:none;margin:none;width:100%;" document_srl="' . $xeicon_document_srl[4] . '" widget_padding_left="0" widget_padding_right="0" widget_padding_top="0" widget_padding_bottom="0" /></div></div></div>';
323 323
 $output = $oModuleController->updateModule($module_info);
324
-if(!$output->toBool()) return $output;
324
+if (!$output->toBool()) return $output;
325 325
 
326 326
 
327 327
 // create menu cache
Please login to merge, or discard this patch.
classes/db/DBCubrid.class.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -76,13 +76,13 @@  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);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
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,11 +146,11 @@  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
 			}
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 		$point = $transactionLevel - 1;
175 175
 
176
-		if($point)
176
+		if ($point)
177 177
 		{
178 178
 			$this->_query("ROLLBACK TO SP" . $point, $connection);
179 179
 		}
@@ -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,7 +404,7 @@  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)
407
+		if ($output->count == 0)
408 408
 		{
409 409
 			$query = sprintf('select max("a"."srl") as "srl" from ' .
410 410
 					'( select max("document_srl") as "srl" from ' .
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
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
 		}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 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,7 +579,7 @@  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
 		}
@@ -614,14 +614,14 @@  discard block
 block discarded – undo
614 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
 		}
@@ -660,18 +660,18 @@  discard block
 block discarded – undo
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,7 +680,7 @@  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 686
 					, $this->prefix . $index->unprefixed_index_name
@@ -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,13 +734,13 @@  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 745
 			$query = sprintf('create serial "%s" start with 1 increment by 1' .
746 746
 					' minvalue 1 ' .
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
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,30 +791,30 @@  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 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
 			}
@@ -823,24 +823,24 @@  discard block
 block discarded – undo
823 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 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 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 845
 				$query = sprintf("create index \"%s\" on \"%s\" (%s);", $key, $table_name, '"' . implode('","', $val) . '"');
846 846
 				$this->_query($query);
@@ -856,13 +856,13 @@  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, 'XEObject'))
865
+		if (is_a($query, 'XEObject'))
866 866
 		{
867 867
 			unset($this->param);
868 868
 			return;
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 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,13 +887,13 @@  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, 'XEObject'))
896
+		if (is_a($query, 'XEObject'))
897 897
 		{
898 898
 			unset($this->param);
899 899
 			return;
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
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,13 +919,13 @@  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, 'XEObject'))
928
+		if (is_a($query, 'XEObject'))
929 929
 		{
930 930
 			unset($this->param);
931 931
 			return;
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
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,20 +955,20 @@  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, 'XEObject'))
971
+			if (is_a($query, 'XEObject'))
972 972
 			{
973 973
 				unset($this->param);
974 974
 				return;
@@ -977,14 +977,14 @@  discard block
 block discarded – undo
977 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);
984 984
 			}
985 985
 
986 986
 			$data = $this->_fetch($result);
987
-			$buff = new Object ();
987
+			$buff = new Object();
988 988
 			$buff->data = $data;
989 989
 
990 990
 			unset($this->param);
@@ -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 Object ();
1005
+			$buff = new Object();
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
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
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
@@ -1050,23 +1050,23 @@  discard block
 block discarded – undo
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,11 +1076,11 @@  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
 
1083
-			$buff = new Object ();
1083
+			$buff = new Object();
1084 1084
 			$buff->total_count = $total_count;
1085 1085
 			$buff->total_page = $total_page;
1086 1086
 			$buff->page = $page;
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 		$query = $this->getSelectPageSql($queryObject, $with_values, $start_count, $list_count);
1095 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);
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 		$virtual_no = $total_count - ($page - 1) * $list_count;
1104 1104
 		$data = $this->_fetch($result, $virtual_no);
1105 1105
 
1106
-		$buff = new Object ();
1106
+		$buff = new Object();
1107 1107
 		$buff->total_count = $total_count;
1108 1108
 		$buff->total_page = $total_page;
1109 1109
 		$buff->page = $page;
@@ -1135,39 +1135,39 @@  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 Object(-1, "Invalid query");
1141 1141
 		}
1142 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 Object(-1, "Invalid query");
1148 1148
 		}
1149 1149
 		$from = ' FROM ' . $from;
1150 1150
 
1151 1151
 		$where = $query->getWhereString($with_values);
1152
-		if($where != '')
1152
+		if ($where != '')
1153 1153
 		{
1154 1154
 			$where = ' WHERE ' . $where;
1155 1155
 		}
1156 1156
 
1157 1157
 		$groupBy = $query->getGroupByString();
1158
-		if($groupBy != '')
1158
+		if ($groupBy != '')
1159 1159
 		{
1160 1160
 			$groupBy = ' GROUP BY ' . $groupBy;
1161 1161
 		}
1162 1162
 
1163 1163
 		$orderBy = $query->getOrderByString();
1164
-		if($orderBy != '')
1164
+		if ($orderBy != '')
1165 1165
 		{
1166 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
 		}
Please login to merge, or discard this patch.