GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( c3355a...eb6166 )
by gyeong-won
14:34
created
tools/dbxml_validator/tests/xmlQueriesTest.php 4 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -27,6 +27,11 @@  discard block
 block discarded – undo
27 27
  
28 28
     // recursive glob
29 29
     // On Windows glob() is case-sensitive.
30
+
31
+    /**
32
+     * @param string $sDir
33
+     * @param integer $nFlags
34
+     */
30 35
     public function globr($sDir, $sPattern, $nFlags = NULL) 
31 36
     { 
32 37
 	// Get the list of all matching files currently in the 
@@ -129,6 +134,9 @@  discard block
 block discarded – undo
129 134
 	$this->markTestIncomplete('XML Schema Language files should be fixed first.');
130 135
     }
131 136
 
137
+    /**
138
+     * @param integer $err_code
139
+     */
132 140
     public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
133 141
     {
134 142
 	$cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);
@@ -166,6 +174,9 @@  discard block
 block discarded – undo
166 174
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS);
167 175
     }
168 176
 
177
+    /**
178
+     * @param string $dir_name
179
+     */
169 180
     public function getDirFilesList($dir_name)
170 181
     {
171 182
 	$output = array();
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -2,33 +2,33 @@  discard block
 block discarded – undo
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4 4
 if (!defined('__DIR__'))
5
-    define('__DIR__', realpath(dirname(__FILE__))); 
5
+	define('__DIR__', realpath(dirname(__FILE__))); 
6 6
 
7 7
 /** The tests here are meant only for the built-in checks in validator.php, 
8 8
     and not for the entire syntax expressed by the .xsd files. */
9 9
 class XmlQueriesTest extends PHPUnit_Framework_TestCase
10 10
 {
11
-    // taken from validator.php
11
+	// taken from validator.php
12 12
 
13
-    const RETCODE_VALIDATOR_INTERNAL = 60;
14
-    const RETCODE_GENERIC_XML_SYNTAX = 50;
15
-    const RETCODE_QUERY_ELEMENT = 40;
16
-    const RETCODE_XSD_VALIDATION = 30;
17
-    const RETCODE_BUILTIN_CHECKS =    20;
18
-    const RETCODE_DB_SCHEMA_MATCH =10;	// no schema match is currently implemented.
19
-    const RETCODE_SUCCESS = 0;
13
+	const RETCODE_VALIDATOR_INTERNAL = 60;
14
+	const RETCODE_GENERIC_XML_SYNTAX = 50;
15
+	const RETCODE_QUERY_ELEMENT = 40;
16
+	const RETCODE_XSD_VALIDATION = 30;
17
+	const RETCODE_BUILTIN_CHECKS =    20;
18
+	const RETCODE_DB_SCHEMA_MATCH =10;	// no schema match is currently implemented.
19
+	const RETCODE_SUCCESS = 0;
20 20
 
21
-    public $validator_cmd;
21
+	public $validator_cmd;
22 22
 
23
-    public function setUp()
24
-    {
23
+	public function setUp()
24
+	{
25 25
 	 $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " ";
26
-    }
26
+	}
27 27
  
28
-    // recursive glob
29
-    // On Windows glob() is case-sensitive.
30
-    public function globr($sDir, $sPattern, $nFlags = NULL) 
31
-    { 
28
+	// recursive glob
29
+	// On Windows glob() is case-sensitive.
30
+	public function globr($sDir, $sPattern, $nFlags = NULL) 
31
+	{ 
32 32
 	// Get the list of all matching files currently in the 
33 33
 	// directory. 
34 34
 
@@ -41,25 +41,25 @@  discard block
 block discarded – undo
41 41
 
42 42
 	foreach ($aDirs as $sSubDir) 
43 43
 	{ 
44
-	    if ($sSubDir != '.' && $sSubDir != '..')
45
-	    {
44
+		if ($sSubDir != '.' && $sSubDir != '..')
45
+		{
46 46
 		$aSubFiles = $this->globr($sSubDir, $sPattern, $nFlags); 
47 47
 		$aFiles = array_merge($aFiles, $aSubFiles); 
48
-	    }
48
+		}
49 49
 	} 
50 50
 
51 51
 	// return merged array with all (recursive) files
52 52
 	return $aFiles; 
53
-    } 
53
+	} 
54 54
 
55
-    /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */
56
-    public function invoke_testReleasedXMLLangFiles
55
+	/** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */
56
+	public function invoke_testReleasedXMLLangFiles
57 57
 	(
58
-	    $released_files,
59
-	    $expected_return_code,
60
-	    $validator_args = ''
58
+		$released_files,
59
+		$expected_return_code,
60
+		$validator_args = ''
61 61
 	)
62
-    {
62
+	{
63 63
 	// this file is in tools/dbxml_validator/tests
64 64
 	$xe_dir = __DIR__ . '/../../..';
65 65
 
@@ -70,67 +70,67 @@  discard block
 block discarded – undo
70 70
 	$xml_files = array();
71 71
 
72 72
 	foreach ($released_files as $released_file_mask)
73
-	    $xml_files =
73
+		$xml_files =
74 74
 		array_merge
75 75
 		(
76
-		    $xml_files,
77
-		    $this->globr
76
+			$xml_files,
77
+			$this->globr
78 78
 			(
79
-			    $xe_dir,
80
-			    $released_file_mask,
81
-			    GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
79
+				$xe_dir,
80
+				$released_file_mask,
81
+				GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
82 82
 			)
83 83
 		);
84 84
 
85 85
 	while ($cnt < count($xml_files))
86 86
 	{
87
-	    $cmd = $this->validator_cmd . $validator_args;
87
+		$cmd = $this->validator_cmd . $validator_args;
88 88
 
89
-	    // Validate 50 files at once
90
-	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
89
+		// Validate 50 files at once
90
+		foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
91 91
 		$cmd .= " " . escapeshellarg($xml_file);
92 92
 
93
-	    exec($cmd . ' 2>&1', $validator_output, $return_code);
93
+		exec($cmd . ' 2>&1', $validator_output, $return_code);
94 94
 
95
-	    $output_text = trim(trim(implode("\n", $validator_output)), "\n");
95
+		$output_text = trim(trim(implode("\n", $validator_output)), "\n");
96 96
 
97
-	    // Validator should not crash/exit-with-an-error.
98
-	    $this->assertLessThanOrEqual
97
+		// Validator should not crash/exit-with-an-error.
98
+		$this->assertLessThanOrEqual
99 99
 		(
100
-		    $expected_return_code,
101
-		    $return_code,
102
-		    "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}."
100
+			$expected_return_code,
101
+			$return_code,
102
+			"{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}."
103 103
 		);
104 104
 
105
-	    $cnt += 50;
105
+		$cnt += 50;
106
+	}
106 107
 	}
107
-    }
108 108
 
109
-    public function testReleasedXMLQueryLangFiles()
110
-    {
109
+	public function testReleasedXMLQueryLangFiles()
110
+	{
111 111
 	$this->invoke_testReleasedXMLLangFiles
112
-	    (
112
+		(
113 113
 		array('queries/*.xml', 'xml_query/*.xml'),
114 114
 		self::RETCODE_QUERY_ELEMENT
115
-	    );
115
+		);
116 116
 
117 117
 	$this->markTestIncomplete('XML Query Language files should be fixed first.');
118
-    }
118
+	}
119 119
 
120
-    public function testReleasedXMLSchemaLangFiles()
121
-    {
120
+	public function testReleasedXMLSchemaLangFiles()
121
+	{
122 122
 	$this->invoke_testReleasedXMLLangFiles
123
-	    (
123
+		(
124 124
 		array('schemas/*.xml'),
125 125
 		self::RETCODE_BUILTIN_CHECKS,
126 126
 		' --schema-language'
127
-	    );
127
+		);
128 128
 
129 129
 	$this->markTestIncomplete('XML Schema Language files should be fixed first.');
130
-    }
130
+	}
131 131
 
132
-    public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
133
-    {
132
+	public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
133
+	{
134 134
 	$cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);
135 135
 	$validator_output = array();
136 136
 	$return_code = 0;
@@ -141,88 +141,88 @@  discard block
 block discarded – undo
141 141
 
142 142
 	// Validator should not crash/exit-with-an-error.
143 143
 	$this->assertEquals
144
-	    (
144
+		(
145 145
 		$err_code,
146 146
 		$return_code,
147 147
 		"{$cmd}\n{$output_text}\nValidator returned code {$return_code}."
148
-	    );
148
+		);
149 149
 
150 150
 	// Validator should output some error on the test files
151 151
 	$basefilename = basename($filename);
152 152
 	$this->assertNotEmpty($output_text, "Error reporting failed for {$basefilename} validation.");
153 153
 
154
-    }
154
+	}
155 155
 
156
-    public function testInvalidQueryId()
157
-    {
156
+	public function testInvalidQueryId()
157
+	{
158 158
 	return $this->invoke_testInvalidXmlFiles(__DIR__.'/data/wrongQueryId.xml', self::RETCODE_QUERY_ELEMENT);
159
-    }
159
+	}
160 160
 
161
-    /**
162
-     * @dataProvider getFilesList
163
-     */
164
-    public function testInvalidXMLQueryFiles($filename)
165
-    {
161
+	/**
162
+	 * @dataProvider getFilesList
163
+	 */
164
+	public function testInvalidXMLQueryFiles($filename)
165
+	{
166 166
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS);
167
-    }
167
+	}
168 168
 
169
-    public function getDirFilesList($dir_name)
170
-    {
169
+	public function getDirFilesList($dir_name)
170
+	{
171 171
 	$output = array();
172 172
 
173 173
 	$dir = opendir(__DIR__ . '/' . $dir_name);
174 174
 
175 175
 	if ($dir)
176 176
 	{
177
-	    $entry = readdir($dir);
177
+		$entry = readdir($dir);
178 178
 
179
-	    while ($entry !== FALSE)
180
-	    {
179
+		while ($entry !== FALSE)
180
+		{
181 181
 		$fname = __DIR__ . '/' . $dir_name .'/' . $entry;
182 182
 
183 183
 		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')
184
-		    $output[] = array($fname);
184
+			$output[] = array($fname);
185 185
 
186 186
 		$entry = readdir($dir);
187
-	    }
187
+		}
188 188
 
189
-	    closedir($dir);
189
+		closedir($dir);
190 190
 	}
191 191
 	else
192
-	    $this->assertFalse(TRUE);
192
+		$this->assertFalse(TRUE);
193 193
 
194
-        return $output;
195
-    }
194
+		return $output;
195
+	}
196 196
 
197
-    public function getFilesList()
198
-    {
197
+	public function getFilesList()
198
+	{
199 199
 	return $this->getDirFilesList('data');
200
-    }
200
+	}
201 201
 
202
-    public function getSchemaFilesList()
203
-    {
202
+	public function getSchemaFilesList()
203
+	{
204 204
 	return $this->getDirFilesList('data/schema');
205
-    }
205
+	}
206 206
 
207
-    public function getSchemaWarningFilesList()
208
-    {
207
+	public function getSchemaWarningFilesList()
208
+	{
209 209
 	return $this->getDirFilesList('data/schema/warnings');
210
-    }
210
+	}
211 211
 
212
-    /**
213
-     * @dataProvider getSchemaFilesList
214
-     */
215
-    public function testInvalidXMLSchemaFiles($filename)
216
-    {
212
+	/**
213
+	 * @dataProvider getSchemaFilesList
214
+	 */
215
+	public function testInvalidXMLSchemaFiles($filename)
216
+	{
217 217
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_BUILTIN_CHECKS, '--schema-language');
218
-    }
218
+	}
219 219
 
220
-    /**
221
-     * @dataProvider getSchemaWarningFilesList
222
-     */
223
-    public function testWarningXMLSchemaFiles($filename)
224
-    {
220
+	/**
221
+	 * @dataProvider getSchemaWarningFilesList
222
+	 */
223
+	public function testWarningXMLSchemaFiles($filename)
224
+	{
225 225
 	return $this->invoke_testInvalidXmlFiles($filename, self::RETCODE_SUCCESS, '--schema-language');
226
-    }
226
+	}
227 227
 }
228 228
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -27 removed lines patch added patch discarded remove patch
@@ -14,15 +14,15 @@  discard block
 block discarded – undo
14 14
     const RETCODE_GENERIC_XML_SYNTAX = 50;
15 15
     const RETCODE_QUERY_ELEMENT = 40;
16 16
     const RETCODE_XSD_VALIDATION = 30;
17
-    const RETCODE_BUILTIN_CHECKS =    20;
18
-    const RETCODE_DB_SCHEMA_MATCH =10;	// no schema match is currently implemented.
17
+    const RETCODE_BUILTIN_CHECKS = 20;
18
+    const RETCODE_DB_SCHEMA_MATCH = 10; // no schema match is currently implemented.
19 19
     const RETCODE_SUCCESS = 0;
20 20
 
21 21
     public $validator_cmd;
22 22
 
23 23
     public function setUp()
24 24
     {
25
-	 $this->validator_cmd = "php " . escapeshellarg(__DIR__ . '/../validate.php') . " ";
25
+	 $this->validator_cmd = "php ".escapeshellarg(__DIR__.'/../validate.php')." ";
26 26
     }
27 27
  
28 28
     // recursive glob
@@ -53,17 +53,16 @@  discard block
 block discarded – undo
53 53
     } 
54 54
 
55 55
     /** Tests all XML Query and Schema Language files (in all modules/addons/widgets) in XE */
56
-    public function invoke_testReleasedXMLLangFiles
57
-	(
56
+    public function invoke_testReleasedXMLLangFiles(
58 57
 	    $released_files,
59 58
 	    $expected_return_code,
60 59
 	    $validator_args = ''
61 60
 	)
62 61
     {
63 62
 	// this file is in tools/dbxml_validator/tests
64
-	$xe_dir = __DIR__ . '/../../..';
63
+	$xe_dir = __DIR__.'/../../..';
65 64
 
66
-	$this->assertTrue(file_exists($xe_dir . '/index.php'), 'XE directory not found');
65
+	$this->assertTrue(file_exists($xe_dir.'/index.php'), 'XE directory not found');
67 66
 
68 67
 	$cnt = 0;
69 68
 	$cmd = $this->validator_cmd;
@@ -71,11 +70,9 @@  discard block
 block discarded – undo
71 70
 
72 71
 	foreach ($released_files as $released_file_mask)
73 72
 	    $xml_files =
74
-		array_merge
75
-		(
73
+		array_merge(
76 74
 		    $xml_files,
77
-		    $this->globr
78
-			(
75
+		    $this->globr(
79 76
 			    $xe_dir,
80 77
 			    $released_file_mask,
81 78
 			    GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
@@ -84,19 +81,18 @@  discard block
 block discarded – undo
84 81
 
85 82
 	while ($cnt < count($xml_files))
86 83
 	{
87
-	    $cmd = $this->validator_cmd . $validator_args;
84
+	    $cmd = $this->validator_cmd.$validator_args;
88 85
 
89 86
 	    // Validate 50 files at once
90 87
 	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
91
-		$cmd .= " " . escapeshellarg($xml_file);
88
+		$cmd .= " ".escapeshellarg($xml_file);
92 89
 
93
-	    exec($cmd . ' 2>&1', $validator_output, $return_code);
90
+	    exec($cmd.' 2>&1', $validator_output, $return_code);
94 91
 
95 92
 	    $output_text = trim(trim(implode("\n", $validator_output)), "\n");
96 93
 
97 94
 	    // Validator should not crash/exit-with-an-error.
98
-	    $this->assertLessThanOrEqual
99
-		(
95
+	    $this->assertLessThanOrEqual(
100 96
 		    $expected_return_code,
101 97
 		    $return_code,
102 98
 		    "{$cmd}\n\n{$output_text}\nValidator returned code {$return_code}."
@@ -108,8 +104,7 @@  discard block
 block discarded – undo
108 104
 
109 105
     public function testReleasedXMLQueryLangFiles()
110 106
     {
111
-	$this->invoke_testReleasedXMLLangFiles
112
-	    (
107
+	$this->invoke_testReleasedXMLLangFiles(
113 108
 		array('queries/*.xml', 'xml_query/*.xml'),
114 109
 		self::RETCODE_QUERY_ELEMENT
115 110
 	    );
@@ -119,8 +114,7 @@  discard block
 block discarded – undo
119 114
 
120 115
     public function testReleasedXMLSchemaLangFiles()
121 116
     {
122
-	$this->invoke_testReleasedXMLLangFiles
123
-	    (
117
+	$this->invoke_testReleasedXMLLangFiles(
124 118
 		array('schemas/*.xml'),
125 119
 		self::RETCODE_BUILTIN_CHECKS,
126 120
 		' --schema-language'
@@ -131,17 +125,16 @@  discard block
 block discarded – undo
131 125
 
132 126
     public function invoke_testInvalidXmlFiles($filename, $err_code, $args = '')
133 127
     {
134
-	$cmd = $this->validator_cmd . ' '. $args . ' ' . escapeshellarg($filename);
128
+	$cmd = $this->validator_cmd.' '.$args.' '.escapeshellarg($filename);
135 129
 	$validator_output = array();
136 130
 	$return_code = 0;
137 131
 
138
-	exec($cmd . '2>&1', $validator_output, $return_code);
132
+	exec($cmd.'2>&1', $validator_output, $return_code);
139 133
 
140 134
 	$output_text = trim(trim(implode("\n", $validator_output)), "\n");
141 135
 
142 136
 	// Validator should not crash/exit-with-an-error.
143
-	$this->assertEquals
144
-	    (
137
+	$this->assertEquals(
145 138
 		$err_code,
146 139
 		$return_code,
147 140
 		"{$cmd}\n{$output_text}\nValidator returned code {$return_code}."
@@ -170,7 +163,7 @@  discard block
 block discarded – undo
170 163
     {
171 164
 	$output = array();
172 165
 
173
-	$dir = opendir(__DIR__ . '/' . $dir_name);
166
+	$dir = opendir(__DIR__.'/'.$dir_name);
174 167
 
175 168
 	if ($dir)
176 169
 	{
@@ -178,9 +171,9 @@  discard block
 block discarded – undo
178 171
 
179 172
 	    while ($entry !== FALSE)
180 173
 	    {
181
-		$fname = __DIR__ . '/' . $dir_name .'/' . $entry;
174
+		$fname = __DIR__.'/'.$dir_name.'/'.$entry;
182 175
 
183
-		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')
176
+		if (!is_dir($fname) && $entry != 'wrongQueryId.xml')
184 177
 		    $output[] = array($fname);
185 178
 
186 179
 		$entry = readdir($dir);
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,8 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4
-if (!defined('__DIR__'))
5
-    define('__DIR__', realpath(dirname(__FILE__))); 
4
+if (!defined('__DIR__')) {
5
+    define('__DIR__', realpath(dirname(__FILE__)));
6
+}
6 7
 
7 8
 /** The tests here are meant only for the built-in checks in validator.php, 
8 9
     and not for the entire syntax expressed by the .xsd files. */
@@ -69,8 +70,8 @@  discard block
 block discarded – undo
69 70
 	$cmd = $this->validator_cmd;
70 71
 	$xml_files = array();
71 72
 
72
-	foreach ($released_files as $released_file_mask)
73
-	    $xml_files =
73
+	foreach ($released_files as $released_file_mask) {
74
+		    $xml_files =
74 75
 		array_merge
75 76
 		(
76 77
 		    $xml_files,
@@ -81,14 +82,16 @@  discard block
 block discarded – undo
81 82
 			    GLOB_NOSORT | GLOB_NOESCAPE | GLOB_ERR
82 83
 			)
83 84
 		);
85
+	}
84 86
 
85 87
 	while ($cnt < count($xml_files))
86 88
 	{
87 89
 	    $cmd = $this->validator_cmd . $validator_args;
88 90
 
89 91
 	    // Validate 50 files at once
90
-	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file)
91
-		$cmd .= " " . escapeshellarg($xml_file);
92
+	    foreach (array_slice($xml_files, $cnt, 50) as $xml_file) {
93
+	    		$cmd .= " " . escapeshellarg($xml_file);
94
+	    }
92 95
 
93 96
 	    exec($cmd . ' 2>&1', $validator_output, $return_code);
94 97
 
@@ -180,16 +183,17 @@  discard block
 block discarded – undo
180 183
 	    {
181 184
 		$fname = __DIR__ . '/' . $dir_name .'/' . $entry;
182 185
 
183
-		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml')
184
-		    $output[] = array($fname);
186
+		if (!is_dir($fname)&& $entry != 'wrongQueryId.xml') {
187
+				    $output[] = array($fname);
188
+		}
185 189
 
186 190
 		$entry = readdir($dir);
187 191
 	    }
188 192
 
189 193
 	    closedir($dir);
194
+	} else {
195
+		    $this->assertFalse(TRUE);
190 196
 	}
191
-	else
192
-	    $this->assertFalse(TRUE);
193 197
 
194 198
         return $output;
195 199
     }
Please login to merge, or discard this patch.
tools/dbxml_validator/validate.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
  @return
174 174
  @param $xml_file
175 175
  @param $node
176
- @param $child_tag
176
+ @param string $child_tag
177 177
  */
178 178
 function checkDuplicateDescendants($xml_file, $node, $child_tag)
179 179
 {
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 	messages.
200 200
  @param $node
201 201
 	The XML node with the children to be checked.
202
- @param $child_tags
202
+ @param string[] $child_tags
203 203
 	Array with tag names for the children elements
204
- @param $attr_tags
204
+ @param string[] $attr_tags
205 205
 	Array with names of attributes to be checked. If multiple attributes
206 206
 	are given, than the first one that is present on a child is included
207 207
 	in the check.
208
- @param $key
208
+ @param boolean $key
209 209
 	True if child elements are required to expose at least one of the 
210 210
 	attribute. False if only the child nodes with some of the
211 211
 	attributes present are to be checked.
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	@return
490 490
 	@param $xml_file
491 491
 	@param $container_element
492
-	@param $child_tag
492
+	@param string $child_tag
493 493
 */
494 494
 function checkVarContentsValidation
495 495
 	(
Please login to merge, or discard this patch.
Indentation   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		@param $line_no
91 91
 		@param $message
92 92
 		@access
93
-	*/
93
+	 */
94 94
 	public function __construct($file, $line_no, $message)
95 95
 	{
96 96
 		parent::__construct("{$file}({$line_no}):\n\t$message");
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	@developer
113 113
 	@return
114 114
 	@access
115
-	*/
115
+	 */
116 116
 	public function __destruct()
117 117
 	{
118 118
 		libxml_clear_errors();
@@ -834,8 +834,7 @@  discard block
 block discarded – undo
834 834
 
835 835
 	@brief
836 836
 	@developer
837
-
838
-	*/
837
+	 */
839 838
 	class RestoreWorkDir
840 839
 	{
841 840
 		protected $dirname;
@@ -845,7 +844,7 @@  discard block
 block discarded – undo
845 844
 			@developer
846 845
 			@return
847 846
 			@access
848
-			*/
847
+		 */
849 848
 		public function __destruct()
850 849
 		{
851 850
 			try
@@ -868,7 +867,7 @@  discard block
 block discarded – undo
868 867
 			@developer
869 868
 			@return
870 869
 			@access
871
-			*/
870
+		 */
872 871
 		public function __construct()
873 872
 		{
874 873
 			$this->dirname = getcwd();
@@ -1113,7 +1112,7 @@  discard block
 block discarded – undo
1113 1112
 		@return
1114 1113
 		@access
1115 1114
 		@param $val
1116
-	*/
1115
+	 */
1117 1116
 	public function code($val = -1)
1118 1117
 	{
1119 1118
 		if($val == -1)
@@ -1135,7 +1134,7 @@  discard block
 block discarded – undo
1135 1134
 		@return
1136 1135
 		@access
1137 1136
 		@param $val
1138
-	*/
1137
+	 */
1139 1138
 	public function push($val)
1140 1139
 	{
1141 1140
 		$this->save = $this->exit_code;
@@ -1147,7 +1146,7 @@  discard block
 block discarded – undo
1147 1146
 		@developer
1148 1147
 		@access
1149 1148
 		@return
1150
-	*/
1149
+	 */
1151 1150
 	public function pop()
1152 1151
 	{
1153 1152
 		$this->exit_code = $this->save;
@@ -1160,7 +1159,7 @@  discard block
 block discarded – undo
1160 1159
 		@return
1161 1160
 		@access
1162 1161
 		@param $val
1163
-	*/
1162
+	 */
1164 1163
 	public function __construct($val = 0)
1165 1164
 	{
1166 1165
 		$this->save = self::RETCODE_VALIDATOR_INTERNAL;
@@ -1181,7 +1180,7 @@  discard block
 block discarded – undo
1181 1180
 		@developer
1182 1181
 		@access
1183 1182
 		@return
1184
-	*/
1183
+	 */
1185 1184
 	public function __destruct()
1186 1185
 	{
1187 1186
 		if($this->file_name)
@@ -1196,7 +1195,7 @@  discard block
 block discarded – undo
1196 1195
 		@access
1197 1196
 		@return
1198 1197
 		@param $file_name
1199
-	*/
1198
+	 */
1200 1199
 	public function __construct($file_name)
1201 1200
 	{
1202 1201
 		$this->file_name = $file_name;
@@ -1439,7 +1438,7 @@  discard block
 block discarded – undo
1439 1438
 
1440 1439
 			@brief
1441 1440
 			@developer
1442
-		*/
1441
+		 */
1443 1442
 		class Context
1444 1443
 		{
1445 1444
 			protected static $db_info = NULL;
@@ -1449,7 +1448,7 @@  discard block
 block discarded – undo
1449 1448
 				@developer
1450 1449
 				@return
1451 1450
 				@access
1452
-			*/
1451
+			 */
1453 1452
 			public static function isInstalled()
1454 1453
 			{
1455 1454
 				return TRUE;
@@ -1460,7 +1459,7 @@  discard block
 block discarded – undo
1460 1459
 				@developer
1461 1460
 				@return
1462 1461
 				@access
1463
-			*/
1462
+			 */
1464 1463
 			public static function getLangType()
1465 1464
 			{
1466 1465
 				return 'en';
@@ -1471,7 +1470,7 @@  discard block
 block discarded – undo
1471 1470
 				@developer
1472 1471
 				@return
1473 1472
 				@access
1474
-			*/
1473
+			 */
1475 1474
 			public static function getLang()
1476 1475
 			{
1477 1476
 				return 'en';
@@ -1482,7 +1481,7 @@  discard block
 block discarded – undo
1482 1481
 				@developer
1483 1482
 				@return
1484 1483
 				@access
1485
-			*/
1484
+			 */
1486 1485
 			public static function getDBType()
1487 1486
 			{
1488 1487
 				if(self::$db_info)
@@ -1501,7 +1500,7 @@  discard block
 block discarded – undo
1501 1500
 				@return
1502 1501
 				@access
1503 1502
 				@param $db_info
1504
-			*/
1503
+			 */
1505 1504
 			public static function setDBInfo($db_info)
1506 1505
 			{
1507 1506
 				self::$db_info = $db_info;
@@ -1512,7 +1511,7 @@  discard block
 block discarded – undo
1512 1511
 				@developer
1513 1512
 				@return
1514 1513
 				@access
1515
-			*/
1514
+			 */
1516 1515
 			public static function getDBInfo()
1517 1516
 			{
1518 1517
 				return self::$db_info;
@@ -1524,7 +1523,7 @@  discard block
 block discarded – undo
1524 1523
 				@return
1525 1524
 				@access
1526 1525
 				@param $str
1527
-			*/
1526
+			 */
1528 1527
 			public static function convertEncodingStr($str)
1529 1528
 			{
1530 1529
 				return $str;
@@ -1535,7 +1534,7 @@  discard block
 block discarded – undo
1535 1534
 				@developer
1536 1535
 				@return
1537 1536
 				@access
1538
-			*/
1537
+			 */
1539 1538
 			public static function setNoDBInfo()
1540 1539
 			{
1541 1540
 				$db_info = (object)NULL;
@@ -1562,7 +1561,7 @@  discard block
 block discarded – undo
1562 1561
 				@developer
1563 1562
 				@access
1564 1563
 				@return
1565
-			*/
1564
+			 */
1566 1565
 			public static function setMysqlDBInfo()
1567 1566
 			{
1568 1567
 				$db_info = (object)NULL;
@@ -1604,7 +1603,7 @@  discard block
 block discarded – undo
1604 1603
 				@developer
1605 1604
 				@return
1606 1605
 				@access
1607
-			*/
1606
+			 */
1608 1607
 			public static function setMysqliDBInfo()
1609 1608
 			{
1610 1609
 				$db_info = (object)NULL;
@@ -1646,7 +1645,7 @@  discard block
 block discarded – undo
1646 1645
 				@developer
1647 1646
 				@return
1648 1647
 				@access
1649
-			*/
1648
+			 */
1650 1649
 			public static function setCubridDBInfo()
1651 1650
 			{
1652 1651
 				$db_info = (object)NULL;
@@ -1688,7 +1687,7 @@  discard block
 block discarded – undo
1688 1687
 				@developer
1689 1688
 				@return
1690 1689
 				@access
1691
-			*/
1690
+			 */
1692 1691
 			public static function setMssqlDBInfo()
1693 1692
 			{
1694 1693
 				$db_info = (object)NULL;
@@ -1729,7 +1728,7 @@  discard block
 block discarded – undo
1729 1728
 		/**
1730 1729
 			@brief
1731 1730
 			@developer
1732
-		*/
1731
+		 */
1733 1732
 		class Any_prop_obj_base
1734 1733
 		{
1735 1734
 			/**
@@ -1738,7 +1737,7 @@  discard block
 block discarded – undo
1738 1737
 				@return
1739 1738
 				@param $property
1740 1739
 				@access
1741
-			*/
1740
+			 */
1742 1741
 			public function __get($property)
1743 1742
 			{
1744 1743
 				return NULL;
@@ -1748,7 +1747,7 @@  discard block
 block discarded – undo
1748 1747
 		/**
1749 1748
 			@brief
1750 1749
 			@developer
1751
-			*/
1750
+		 */
1752 1751
 		class LangArgFilterErrorMessage
1753 1752
 		{
1754 1753
 			/**
@@ -1757,7 +1756,7 @@  discard block
 block discarded – undo
1757 1756
 				@return
1758 1757
 				@param $property
1759 1758
 				@access
1760
-			*/
1759
+			 */
1761 1760
 			public function __get($property)
1762 1761
 			{
1763 1762
 				return 'Argument filter error';
Please login to merge, or discard this patch.
Spacing   +267 added lines, -286 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,32 +133,32 @@  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
 		}
154 154
 		else
155 155
 		{
156
-			fwrite(STDERR, $msg . "\n");
156
+			fwrite(STDERR, $msg."\n");
157 157
 		}
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(
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 						$child_node->getLineNo(),
255 255
 						"<{$child_node->tagName}>: at least one of the following attributes is expected: "
256 256
 							.
257
-						implode(', ', $attr_tags) . '.'
257
+						implode(', ', $attr_tags).'.'
258 258
 					);
259 259
 			}
260 260
 		}
@@ -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,12 +1004,11 @@  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
-						$xml_file . '(' . $col_node->getLineNo() . ")\n\t"
1011
+						$xml_file.'('.$col_node->getLineNo().")\n\t"
1019 1012
 							.
1020 1013
 						"<column>: attribute 'auto_increment' is currently supported only by SQL Server and mysql backends.\n"
1021 1014
 					);
@@ -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(
@@ -1031,30 +1024,29 @@  discard block
 block discarded – undo
1031 1024
 							$col_node->getLineNo(),
1032 1025
 							"<column>: attribute 'auto_increment' only expected for one of the following types: "
1033 1026
 								.
1034
-							implode(', ', $autoinc_types) . '.'
1027
+							implode(', ', $autoinc_types).'.'
1035 1028
 						);
1036 1029
 				}
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
-						$xml_file . '(' . $col_node->getLineNo() . ")\n\t"
1037
+						$xml_file.'('.$col_node->getLineNo().")\n\t"
1046 1038
 							.
1047 1039
 						"<column>: type \"tinytext\" is supported only by CUBRID.\n"
1048 1040
 					);
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(
@@ -1076,7 +1068,7 @@  discard block
 block discarded – undo
1076 1068
 							$col_node->getLineNo(),
1077 1069
 							"<column>: 'size' attribute only expected for the following types: "
1078 1070
 								.
1079
-							implode(', ', $varsize_types) . "."
1071
+							implode(', ', $varsize_types)."."
1080 1072
 						);
1081 1073
 			}
1082 1074
 		}
@@ -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
 					&&
@@ -1366,48 +1358,48 @@  discard block
 block discarded – undo
1366 1358
 	{
1367 1359
 		throw
1368 1360
 			new SyntaxError(
1369
-				"Validates an XML document against a given schema definition (XSD), using the standard php library.\n" .
1370
-				"Syntax:\n" .
1371
-				"	{$cmdname} schema.xsd document.xml...\n" .
1372
-				"	{$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n" .
1373
-				"Where:\n" .
1374
-				"	--schema-language\n" .
1375
-				"	--schema\n" .
1376
-				"	-s\n" .
1377
-				"		If given, the document(s) are validated against XE XML Schema Language,\n" .
1378
-				"		otherwise document(s) are validated against XE XML Query Language.\n" .
1379
-				"\n" .
1380
-				"	--skip-query-id\n" .
1381
-				"		Do not check the query id, which should normally match the file name.\n" .
1382
-				"\n" .
1383
-				"	--xe-path\n" .
1384
-				"	--xe\n" .
1385
-				"		Path to XE installation. Used to load the database-specific parsers to generate\n" .
1386
-				"		SQL from the XML language files.\n" .
1387
-				"\n" .
1388
-				"	--validate-only\n" .
1389
-				"		Only check XML schemas, no SQL generated with the database-specific parsers.\n" .
1390
-				"\n" .
1391
-				"	--args-string   \" 'name' => 'val..', 'name' => 'val...' \"\n" .
1392
-				"	--args-file		args/file/name.php\n" .
1393
-				"		Variables and values for the query, if it has any (only for XML Query Language).\n" .
1394
-				"		Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n" .
1395
-				"		array constructor. The validator script will directly eval()/include() this content.\n" .
1396
-				"		The file named with --args-file should include an array() constructor around the\n" .
1397
-				"		name-value list, and should immediately return it, without a named array variable.\n" .
1398
-				"		E.g.:\n" .
1399
-				"			return \n" .
1400
-				"				array\n" .
1401
-				"					(\n" .
1402
-				"						'name' => 'val',\n" .
1403
-				"						'name' => 'val',\n" .
1404
-				"						...\n" .
1405
-				"					);\n" .
1406
-				"\n" .
1407
-				"	schema.xsd		if given, is the file name for the schema definition to validate the\n" .
1408
-				"					document against\n" .
1409
-				"\n" .
1410
-				"	document.xml	is the file name for the XML document to be validated against the schema.\n" .
1361
+				"Validates an XML document against a given schema definition (XSD), using the standard php library.\n".
1362
+				"Syntax:\n".
1363
+				"	{$cmdname} schema.xsd document.xml...\n".
1364
+				"	{$cmdname} [ --schema-language ] [--skip-query-id] ... [--] document.xml...\n".
1365
+				"Where:\n".
1366
+				"	--schema-language\n".
1367
+				"	--schema\n".
1368
+				"	-s\n".
1369
+				"		If given, the document(s) are validated against XE XML Schema Language,\n".
1370
+				"		otherwise document(s) are validated against XE XML Query Language.\n".
1371
+				"\n".
1372
+				"	--skip-query-id\n".
1373
+				"		Do not check the query id, which should normally match the file name.\n".
1374
+				"\n".
1375
+				"	--xe-path\n".
1376
+				"	--xe\n".
1377
+				"		Path to XE installation. Used to load the database-specific parsers to generate\n".
1378
+				"		SQL from the XML language files.\n".
1379
+				"\n".
1380
+				"	--validate-only\n".
1381
+				"		Only check XML schemas, no SQL generated with the database-specific parsers.\n".
1382
+				"\n".
1383
+				"	--args-string   \" 'name' => 'val..', 'name' => 'val...' \"\n".
1384
+				"	--args-file		args/file/name.php\n".
1385
+				"		Variables and values for the query, if it has any (only for XML Query Language).\n".
1386
+				"		Use a comma-separated 'var-name' => 'var_value...' pairs, in php syntax for an\n".
1387
+				"		array constructor. The validator script will directly eval()/include() this content.\n".
1388
+				"		The file named with --args-file should include an array() constructor around the\n".
1389
+				"		name-value list, and should immediately return it, without a named array variable.\n".
1390
+				"		E.g.:\n".
1391
+				"			return \n".
1392
+				"				array\n".
1393
+				"					(\n".
1394
+				"						'name' => 'val',\n".
1395
+				"						'name' => 'val',\n".
1396
+				"						...\n".
1397
+				"					);\n".
1398
+				"\n".
1399
+				"	schema.xsd		if given, is the file name for the schema definition to validate the\n".
1400
+				"					document against\n".
1401
+				"\n".
1402
+				"	document.xml	is the file name for the XML document to be validated against the schema.\n".
1411 1403
 				"					Multiple .xml files can be given.\n"
1412 1404
 			);
1413 1405
 	}
@@ -1415,23 +1407,23 @@  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
-			define('_XE_PATH_', $xe_path . '/');
1426
+			define('_XE_PATH_', $xe_path.'/');
1435 1427
 		}
1436 1428
 
1437 1429
 		/**
@@ -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,49 +1752,49 @@  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
 		}
1790 1777
 
1791
-		include(_XE_PATH_ . 'classes/object/BaseObject.class.php');
1792
-		include(_XE_PATH_ . 'classes/handler/Handler.class.php');
1793
-		include(_XE_PATH_ . 'classes/file/FileHandler.class.php');
1794
-		include(_XE_PATH_ . 'classes/page/PageHandler.class.php');
1778
+		include(_XE_PATH_.'classes/object/BaseObject.class.php');
1779
+		include(_XE_PATH_.'classes/handler/Handler.class.php');
1780
+		include(_XE_PATH_.'classes/file/FileHandler.class.php');
1781
+		include(_XE_PATH_.'classes/page/PageHandler.class.php');
1795 1782
 
1796 1783
 		Context::setNoDBInfo();
1797 1784
 
1798
-		require_once(_XE_PATH_ . 'classes/db/DB.class.php');
1799
-		require_once(_XE_PATH_ . 'classes/db/DBMysql.class.php');
1800
-		require_once(_XE_PATH_ . 'classes/db/DBMysqli.class.php');
1801
-		require_once(_XE_PATH_ . 'classes/db/DBMysql_innodb.class.php');
1802
-		require_once(_XE_PATH_ . 'classes/db/DBCubrid.class.php');
1803
-		require_once(_XE_PATH_ . 'classes/db/DBMssql.class.php');
1804
-		require_once(_XE_PATH_ . 'classes/xml/XmlParser.class.php');
1805
-		require_once(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php');
1785
+		require_once(_XE_PATH_.'classes/db/DB.class.php');
1786
+		require_once(_XE_PATH_.'classes/db/DBMysql.class.php');
1787
+		require_once(_XE_PATH_.'classes/db/DBMysqli.class.php');
1788
+		require_once(_XE_PATH_.'classes/db/DBMysql_innodb.class.php');
1789
+		require_once(_XE_PATH_.'classes/db/DBCubrid.class.php');
1790
+		require_once(_XE_PATH_.'classes/db/DBMssql.class.php');
1791
+		require_once(_XE_PATH_.'classes/xml/XmlParser.class.php');
1792
+		require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php');
1806 1793
 
1807
-		require_once(__DIR__ . '/connect_wrapper.php');
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,11 +1808,11 @@  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
 				{
1828
-					eval('$query_user_args = array(' . $query_args . ');');
1815
+					eval('$query_user_args = array('.$query_args.');');
1829 1816
 				}
1830 1817
 				catch (Exception $exc)
1831 1818
 				{
@@ -1841,26 +1828,25 @@  discard block
 block discarded – undo
1841 1828
 
1842 1829
 	$schema_file = NULL;
1843 1830
 	$schemas_set =
1844
-		array
1845
-			(
1846
-				'delete' => __DIR__ . '/xml_delete.xsd',
1847
-				'update' => __DIR__ . '/xml_update.xsd',
1848
-				'select' => __DIR__ . '/xml_select.xsd',
1849
-				'insert' => __DIR__ . '/xml_insert.xsd',
1850
-				'insert-select' => __DIR__ . '/xml_insert_select.xsd'
1831
+		array(
1832
+				'delete' => __DIR__.'/xml_delete.xsd',
1833
+				'update' => __DIR__.'/xml_update.xsd',
1834
+				'select' => __DIR__.'/xml_select.xsd',
1835
+				'insert' => __DIR__.'/xml_insert.xsd',
1836
+				'insert-select' => __DIR__.'/xml_insert_select.xsd'
1851 1837
 			);
1852
-	$table_schema = __DIR__ . '/xml_create_table.xsd';
1838
+	$table_schema = __DIR__.'/xml_create_table.xsd';
1853 1839
 
1854 1840
 	$domDocument = new DOMDocument();
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'
@@ -1895,15 +1881,15 @@  discard block
 block discarded – undo
1895 1881
 
1896 1882
 					throw
1897 1883
 						new ErrorMessage(
1898
-								"{$argv[$i]}:" .
1899
-								"		Root element should be <query> and should have an action attribute of:" .
1900
-								"		insert, insert-select, select, update or delete." .
1901
-								"		Otherwise an explicit schema, to validate the document with, should be" .
1884
+								"{$argv[$i]}:".
1885
+								"		Root element should be <query> and should have an action attribute of:".
1886
+								"		insert, insert-select, select, update or delete.".
1887
+								"		Otherwise an explicit schema, to validate the document with, should be".
1902 1888
 								"		specified as first argument on the command line."
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
 				{
@@ -1912,28 +1898,28 @@  discard block
 block discarded – undo
1912 1898
 
1913 1899
 					throw
1914 1900
 						new ErrorMessage(
1915
-							"{$argv[$i]}(" . $queryElement->getLineNo() . "):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name."
1901
+							"{$argv[$i]}(".$queryElement->getLineNo()."):\n\tQuery 'id' attribute value \"{$query_id}\" should match file name."
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,39 +1995,38 @@  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
 													&&
2036 2020
 												isset($arg->argument_validator->default_value->value))
2037 2021
 										{
2038 2022
 											$query_user_args[$arg->variable_name] =
2039
-												eval('return ' . $arg->argument_validator->default_value->toString() . ';');
2023
+												eval('return '.$arg->argument_validator->default_value->toString().';');
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, 'BaseObject') && !$resultset->toBool())
2114
+							if (is_a($resultset, 'BaseObject') && !$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
 			}
@@ -2156,21 +2137,21 @@  discard block
 block discarded – undo
2156 2137
 		{
2157 2138
 			$retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS);
2158 2139
 
2159
-			fwrite(STDERR, $exc->getMessage() . "\n");
2140
+			fwrite(STDERR, $exc->getMessage()."\n");
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
 			}
2167 2148
 
2168
-			fwrite(STDERR, $exc->getMessage() . "\n");
2149
+			fwrite(STDERR, $exc->getMessage()."\n");
2169 2150
 			libXmlDisplayError($argv[$i]);
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
 			}
@@ -2183,7 +2164,7 @@  discard block
 block discarded – undo
2183 2164
 		{
2184 2165
 			$retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);
2185 2166
 
2186
-			fwrite(STDERR, $exc->getMessage() . "\n");
2167
+			fwrite(STDERR, $exc->getMessage()."\n");
2187 2168
 			fwrite(STDERR, $exc->getTraceAsString());
2188 2169
 			libXmlDisplayError($argv[$i]);
2189 2170
 		}
@@ -2193,22 +2174,22 @@  discard block
 block discarded – undo
2193 2174
 }
2194 2175
 catch (SyntaxError $syntax)
2195 2176
 {
2196
-	fwrite(STDERR, $syntax->getMessage() . "\n");
2197
-	exit(254);	// wrong command line
2177
+	fwrite(STDERR, $syntax->getMessage()."\n");
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
-	fwrite(STDERR, $exc->getMessage() . "\n");
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
-	fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n");
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.
Braces   +33 added lines, -66 removed lines patch added patch discarded remove patch
@@ -150,13 +150,11 @@  discard block
 block discarded – undo
150 150
 		if($throw_error)
151 151
 		{
152 152
 			throw new ErrorMessage($msg);
153
-		}
154
-		else
153
+		} else
155 154
 		{
156 155
 			fwrite(STDERR, $msg . "\n");
157 156
 		}
158
-	}
159
-	else
157
+	} else
160 158
 	{
161 159
 		if($throw_error)
162 160
 		{
@@ -346,8 +344,7 @@  discard block
 block discarded – undo
346 344
 					"\nANSI SQL-99 declares the table specification as required."
347 345
 				);
348 346
 		}
349
-	}
350
-	else
347
+	} else
351 348
 	{
352 349
 		// base table or view
353 350
 
@@ -369,13 +366,11 @@  discard block
 block discarded – undo
369 366
 									$child_node->getLineNo(),
370 367
 									'Duplicate <conditions> elements.'
371 368
 								);
372
-						}
373
-						else
369
+						} else
374 370
 						{
375 371
 							$has_conditions_element = TRUE;
376 372
 						}
377
-					}
378
-					else
373
+					} else
379 374
 					{
380 375
 						throw
381 376
 							new XmlSchemaError(
@@ -396,8 +391,7 @@  discard block
 block discarded – undo
396 391
 						'Expected <conditions> element as content.'
397 392
 					);
398 393
 			}
399
-		}
400
-		else
394
+		} else
401 395
 		{
402 396
 			foreach($table_element->childNodes as $child_node)
403 397
 			{
@@ -609,8 +603,7 @@  discard block
 block discarded – undo
609 603
 			if($first_child)
610 604
 			{
611 605
 				$first_child = FALSE;
612
-			}
613
-			else
606
+			} else
614 607
 			{
615 608
 				if(!$child_node->hasAttribute('pipe'))
616 609
 				{
@@ -629,14 +622,12 @@  discard block
 block discarded – undo
629 622
 			if($child_node->tagName == 'group')
630 623
 			{
631 624
 				checkConditionsGroup($xml_file, $child_node);
632
-			}
633
-			else
625
+			} else
634 626
 			{
635 627
 				if($child_node->tagName == 'query')
636 628
 				{
637 629
 					validate_select_query($xml_file, $child_node);
638
-				}
639
-				else
630
+				} else
640 631
 				{
641 632
 					if($child_node->tagName == 'condition')
642 633
 					{
@@ -851,8 +842,7 @@  discard block
 block discarded – undo
851 842
 			try
852 843
 			{
853 844
 				$success = chdir($this->dirname);
854
-			}
855
-			catch (Exception $e)
845
+			} catch (Exception $e)
856 846
 			{
857 847
 				print "Failed to restore working dir {$this->dirname}.";
858 848
 			}
@@ -921,8 +911,7 @@  discard block
 block discarded – undo
921 911
 		if($lowercase_name[$i] != $uppercase_name[$i])
922 912
 		{
923 913
 			$varing_case_filename .= "[{$lowercase_name[$i]}{$uppercase_name[$i]}]";
924
-		}
925
-		else
914
+		} else
926 915
 		{
927 916
 			$varing_case_filename .= $lowercase_name[$i];
928 917
 		}
@@ -1119,8 +1108,7 @@  discard block
 block discarded – undo
1119 1108
 		if($val == -1)
1120 1109
 		{
1121 1110
 			return $this->exit_code;
1122
-		}
1123
-		else
1111
+		} else
1124 1112
 		{
1125 1113
 			if($this->exit_code < $val)
1126 1114
 			{
@@ -1488,8 +1476,7 @@  discard block
 block discarded – undo
1488 1476
 				if(self::$db_info)
1489 1477
 				{
1490 1478
 					return self::$db_info->master_db['db_type'];
1491
-				}
1492
-				else
1479
+				} else
1493 1480
 				{
1494 1481
 					return NULL;
1495 1482
 				}
@@ -1588,8 +1575,7 @@  discard block
 block discarded – undo
1588 1575
 							&&
1589 1576
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1590 1577
 				{
1591
-				}
1592
-				else
1578
+				} else
1593 1579
 				{
1594 1580
 					$GLOBALS['__DB__'][$db_info->master_db['db_type']] =
1595 1581
 						new DBMysqlConnectWrapper();
@@ -1630,8 +1616,7 @@  discard block
 block discarded – undo
1630 1616
 							&&
1631 1617
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1632 1618
 				{
1633
-				}
1634
-				else
1619
+				} else
1635 1620
 				{
1636 1621
 					$GLOBALS['__DB__'][$db_info->master_db['db_type']] =
1637 1622
 						new DBMysqliConnectWrapper();
@@ -1672,8 +1657,7 @@  discard block
 block discarded – undo
1672 1657
 							&&
1673 1658
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1674 1659
 				{
1675
-				}
1676
-				else
1660
+				} else
1677 1661
 				{
1678 1662
 					$GLOBALS['__DB__'][$db_info->master_db['db_type']] =
1679 1663
 						new DBCubridConnectWrapper();
@@ -1714,8 +1698,7 @@  discard block
 block discarded – undo
1714 1698
 							&&
1715 1699
 						array_key_exists($db_info->master_db['db_type'], $GLOBALS['__DB__']))
1716 1700
 				{
1717
-				}
1718
-				else
1701
+				} else
1719 1702
 				{
1720 1703
 					$GLOBALS['__DB__'][$db_info->master_db['db_type']] =
1721 1704
 						new DBMssqlConnectWrapper();
@@ -1812,22 +1795,19 @@  discard block
 block discarded – undo
1812 1795
 			try
1813 1796
 			{
1814 1797
 				$query_user_args = require($query_args_file);
1815
-			}
1816
-			catch (Exception $exc)
1798
+			} catch (Exception $exc)
1817 1799
 			{
1818 1800
 				fwrite(STDERR, "Error in arguments file.\n");
1819 1801
 				throw $exc;
1820 1802
 			}
1821
-		}
1822
-		else
1803
+		} else
1823 1804
 		{
1824 1805
 			if($query_args)
1825 1806
 			{
1826 1807
 				try
1827 1808
 				{
1828 1809
 					eval('$query_user_args = array(' . $query_args . ');');
1829
-				}
1830
-				catch (Exception $exc)
1810
+				} catch (Exception $exc)
1831 1811
 				{
1832 1812
 					fwrite(STDERR, "Error in arguments string.\n");
1833 1813
 					throw $exc;
@@ -1919,8 +1899,7 @@  discard block
 block discarded – undo
1919 1899
 				if($use_schema_language)
1920 1900
 				{
1921 1901
 					$document_schema = $table_schema;
1922
-				}
1923
-				else
1902
+				} else
1924 1903
 				{
1925 1904
 					if(!$document_schema)
1926 1905
 					{
@@ -1936,8 +1915,7 @@  discard block
 block discarded – undo
1936 1915
 					if($use_schema_language)
1937 1916
 					{
1938 1917
 						validate_schema_doc($argv[$i], $domDocument->documentElement);
1939
-					}
1940
-					else
1918
+					} else
1941 1919
 					{
1942 1920
 						validate_xml_query($argv[$i], $domDocument->documentElement);
1943 1921
 					}
@@ -1951,8 +1929,7 @@  discard block
 block discarded – undo
1951 1929
 					if(function_exists('sys_get_temp_dir'))
1952 1930
 					{
1953 1931
 						$tmpdir = sys_get_temp_dir();
1954
-					}
1955
-					else
1932
+					} else
1956 1933
 					{
1957 1934
 						$tmpdir = getenv('TEMP');
1958 1935
 						if(!$tmpdir)
@@ -2001,8 +1978,7 @@  discard block
 block discarded – undo
2001 1978
 							print " {$db_type} query:\n";
2002 1979
 							print $GLOBALS['__DB__'][$db_type]->queries;
2003 1980
 							print "\n";
2004
-						}
2005
-						else
1981
+						} else
2006 1982
 						{
2007 1983
 							$unlink_tmpfile =
2008 1984
 								new UnlinkFile(tempnam($tmpdir, 'xe_'));
@@ -2037,8 +2013,7 @@  discard block
 block discarded – undo
2037 2013
 										{
2038 2014
 											$query_user_args[$arg->variable_name] =
2039 2015
 												eval('return ' . $arg->argument_validator->default_value->toString() . ';');
2040
-										}
2041
-										else
2016
+										} else
2042 2017
 										{
2043 2018
 											if($arg->argument_validator->filter)
2044 2019
 											{
@@ -2133,8 +2108,7 @@  discard block
 block discarded – undo
2133 2108
 							if(is_a($resultset, 'BaseObject') && !$resultset->toBool())
2134 2109
 							{
2135 2110
 								throw new XmlSchemaError($argv[$i], -1, 'mysql SQL query generation failed');
2136
-							}
2137
-							else
2111
+							} else
2138 2112
 							{
2139 2113
 								print "\n";
2140 2114
 								print pathinfo($argv[$i], PATHINFO_FILENAME);
@@ -2151,14 +2125,12 @@  discard block
 block discarded – undo
2151 2125
 			{
2152 2126
 				libXmlDisplayError($argv[$i], TRUE);
2153 2127
 			}
2154
-		}
2155
-		catch (XmlSchemaError $exc)
2128
+		} catch (XmlSchemaError $exc)
2156 2129
 		{
2157 2130
 			$retcode->code(ReturnCode::RETCODE_BUILTIN_CHECKS);
2158 2131
 
2159 2132
 			fwrite(STDERR, $exc->getMessage() . "\n");
2160
-		}
2161
-		catch (ErrorMessage $exc)
2133
+		} catch (ErrorMessage $exc)
2162 2134
 		{
2163 2135
 			if($retcode->code() == ReturnCode::RETCODE_SUCCESS)
2164 2136
 			{
@@ -2167,8 +2139,7 @@  discard block
 block discarded – undo
2167 2139
 
2168 2140
 			fwrite(STDERR, $exc->getMessage() . "\n");
2169 2141
 			libXmlDisplayError($argv[$i]);
2170
-		}
2171
-		catch (ErrorException $exc)
2142
+		} catch (ErrorException $exc)
2172 2143
 		{
2173 2144
 			if($retcode->code() == ReturnCode::RETCODE_SUCCESS)
2174 2145
 			{
@@ -2178,8 +2149,7 @@  discard block
 block discarded – undo
2178 2149
 			fwrite(STDERR, "{$exc->getFile()}({$exc->getLine()}):\n\t{$exc->getMessage()}.\n");
2179 2150
 			fwrite(STDERR, $exc->getTraceAsString());
2180 2151
 			libXmlDisplayError($argv[$i]);
2181
-		}
2182
-		catch (Exception $exc)
2152
+		} catch (Exception $exc)
2183 2153
 		{
2184 2154
 			$retcode->code(ReturnCode::RETCODE_VALIDATOR_INTERNAL);
2185 2155
 
@@ -2190,20 +2160,17 @@  discard block
 block discarded – undo
2190 2160
 	}
2191 2161
 
2192 2162
 	exit($retcode->code());
2193
-}
2194
-catch (SyntaxError $syntax)
2163
+} catch (SyntaxError $syntax)
2195 2164
 {
2196 2165
 	fwrite(STDERR, $syntax->getMessage() . "\n");
2197 2166
 	exit(254);	// wrong command line
2198 2167
 				// 255 is reserved by php (for parse errors, etc.)
2199
-}
2200
-catch (ErrorMessage $exc)
2168
+} catch (ErrorMessage $exc)
2201 2169
 {
2202 2170
 	fwrite(STDERR, $exc->getMessage() . "\n");
2203 2171
 	libXmlDisplayError();
2204 2172
 	exit(ReturnCode::RETCODE_VALIDATOR_INTERNAL);		// internal validator error
2205
-}
2206
-catch (Exception $exc)
2173
+} catch (Exception $exc)
2207 2174
 {
2208 2175
 	fwrite(STDERR, $exc->getFile() . '(' . $exc->getLine() . ")\n\t" . $exc->getMessage() . "\n");
2209 2176
 	fwrite(STDERR, $exc->getTraceAsString());
Please login to merge, or discard this patch.
libs/ftp.class.php 1 patch
Indentation   +479 added lines, -479 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-    /*********************************************************************
2
+	/*********************************************************************
3 3
      *
4 4
      *    PHP FTP Client Class By TOMO ( [email protected] )
5 5
 	 *    Modified By XEHub ( [email protected] )
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      *
19 19
      ********************************************************************/
20 20
 
21
-    /*********************************************************************
21
+	/*********************************************************************
22 22
      * List of available functions
23 23
      * ftp_connect($server, $port = 21)
24 24
      * ftp_login($user, $pass)
@@ -41,448 +41,448 @@  discard block
 block discarded – undo
41 41
      * ftp_quit()
42 42
      *********************************************************************/
43 43
 
44
-    class ftp
45
-    {
46
-        /* Public variables */
47
-        var $debug;
48
-        var $umask;
49
-        var $timeout;
50
-
51
-        /* Private variables */
52
-        var $ftp_sock;
53
-        var $ftp_resp;
54
-
55
-        /* Constractor */
56
-        function ftp()
57
-        {
58
-            $this->debug = false;
59
-            $this->umask = 0022;
60
-            $this->timeout = 30;
61
-
62
-            if (!defined("FTP_BINARY")) {
63
-                define("FTP_BINARY", 1);
64
-            }
65
-            if (!defined("FTP_ASCII")) {
66
-                define("FTP_ASCII", 0);
67
-            }
68
-
69
-            $this->ftp_resp = "";
70
-        }
71
-
72
-        /* Public functions */
73
-        function ftp_connect($server, $port = 21)
74
-        {
75
-            $this->ftp_debug("Trying to ".$server.":".$port." ...\n");
76
-            $this->ftp_sock = @fsockopen($server, $port, $errno, $errstr, $this->timeout);
77
-
78
-            if (!$this->ftp_sock || !$this->ftp_ok()) {
79
-                $this->ftp_debug("Error : Cannot connect to remote host \"".$server.":".$port."\"\n");
80
-                $this->ftp_debug("Error : fsockopen() ".$errstr." (".$errno.")\n");
81
-                return FALSE;
82
-            }
44
+	class ftp
45
+	{
46
+		/* Public variables */
47
+		var $debug;
48
+		var $umask;
49
+		var $timeout;
50
+
51
+		/* Private variables */
52
+		var $ftp_sock;
53
+		var $ftp_resp;
54
+
55
+		/* Constractor */
56
+		function ftp()
57
+		{
58
+			$this->debug = false;
59
+			$this->umask = 0022;
60
+			$this->timeout = 30;
61
+
62
+			if (!defined("FTP_BINARY")) {
63
+				define("FTP_BINARY", 1);
64
+			}
65
+			if (!defined("FTP_ASCII")) {
66
+				define("FTP_ASCII", 0);
67
+			}
68
+
69
+			$this->ftp_resp = "";
70
+		}
71
+
72
+		/* Public functions */
73
+		function ftp_connect($server, $port = 21)
74
+		{
75
+			$this->ftp_debug("Trying to ".$server.":".$port." ...\n");
76
+			$this->ftp_sock = @fsockopen($server, $port, $errno, $errstr, $this->timeout);
77
+
78
+			if (!$this->ftp_sock || !$this->ftp_ok()) {
79
+				$this->ftp_debug("Error : Cannot connect to remote host \"".$server.":".$port."\"\n");
80
+				$this->ftp_debug("Error : fsockopen() ".$errstr." (".$errno.")\n");
81
+				return FALSE;
82
+			}
83 83
 
84 84
 			if(substr($this->ftp_resp, 0, 3) !== '220')
85 85
 			{
86 86
 				return FALSE;
87 87
 			}
88 88
 
89
-            $this->ftp_debug("Connected to remote host \"".$server.":".$port."\"\n");
90
-
91
-            return TRUE;
92
-        }
93
-
94
-        function ftp_login($user, $pass)
95
-        {
96
-            $this->ftp_putcmd("USER", $user);
97
-            if (!$this->ftp_ok()) {
98
-                $this->ftp_debug("Error : USER command failed\n");
99
-                return FALSE;
100
-            }
101
-
102
-            $this->ftp_putcmd("PASS", $pass);
103
-            if (!$this->ftp_ok()) {
104
-                $this->ftp_debug("Error : PASS command failed\n");
105
-                return FALSE;
106
-            }
107
-            $this->ftp_debug("Authentication succeeded\n");
108
-
109
-            return TRUE;
110
-        }
111
-
112
-        function ftp_pwd()
113
-        {
114
-            $this->ftp_putcmd("PWD");
115
-            if (!$this->ftp_ok()) {
116
-                $this->ftp_debug("Error : PWD command failed\n");
117
-                return FALSE;
118
-            }
119
-
120
-            return preg_replace("@^[0-9]{3} \"(.+)\" .+\r\n@", "\\1", $this->ftp_resp);
121
-        }
122
-
123
-        function ftp_size($pathname)
124
-        {
125
-            $this->ftp_putcmd("SIZE", $pathname);
126
-            if (!$this->ftp_ok()) {
127
-                $this->ftp_debug("Error : SIZE command failed\n");
128
-                return -1;
129
-            }
130
-
131
-            return preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp);
132
-        }
133
-
134
-        function ftp_mdtm($pathname)
135
-        {
136
-            $this->ftp_putcmd("MDTM", $pathname);
137
-            if (!$this->ftp_ok()) {
138
-                $this->ftp_debug("Error : MDTM command failed\n");
139
-                return -1;
140
-            }
141
-            $mdtm = preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp);
142
-            $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
143
-            $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
144
-
145
-            return $timestamp;
146
-        }
147
-
148
-        function ftp_systype()
149
-        {
150
-            $this->ftp_putcmd("SYST");
151
-            if (!$this->ftp_ok()) {
152
-                $this->ftp_debug("Error : SYST command failed\n");
153
-                return FALSE;
154
-            }
155
-            $DATA = explode(" ", $this->ftp_resp);
156
-
157
-            return $DATA[1];
158
-        }
159
-
160
-        function ftp_cdup()
161
-        {
162
-            $this->ftp_putcmd("CDUP");
163
-            $response = $this->ftp_ok();
164
-            if (!$response) {
165
-                $this->ftp_debug("Error : CDUP command failed\n");
166
-            }
167
-            return $response;
168
-        }
169
-
170
-        function ftp_chdir($pathname)
171
-        {
172
-            $this->ftp_putcmd("CWD", $pathname);
173
-            $response = $this->ftp_ok();
174
-            if (!$response) {
175
-                $this->ftp_debug("Error : CWD command failed\n");
176
-            }
177
-            return $response;
178
-        }
179
-
180
-        function ftp_delete($pathname)
181
-        {
182
-            $this->ftp_putcmd("DELE", $pathname);
183
-            $response = $this->ftp_ok();
184
-            if (!$response) {
185
-                $this->ftp_debug("Error : DELE command failed\n");
186
-            }
187
-            return $response;
188
-        }
189
-
190
-        function ftp_rmdir($pathname)
191
-        {
192
-            $this->ftp_putcmd("RMD", $pathname);
193
-            $response = $this->ftp_ok();
194
-            if (!$response) {
195
-                $this->ftp_debug("Error : RMD command failed\n");
196
-            }
197
-            return $response;
198
-        }
199
-
200
-        function ftp_mkdir($pathname)
201
-        {
202
-            $this->ftp_putcmd("MKD", $pathname);
203
-            $response = $this->ftp_ok();
204
-            if (!$response) {
205
-                $this->ftp_debug("Error : MKD command failed\n");
206
-            }
207
-            return $response;
208
-        }
209
-
210
-        function ftp_file_exists($pathname)
211
-        {
212
-            if (!($remote_list = $this->ftp_nlist("-a"))) {
213
-                $this->ftp_debug("Error : Cannot get remote file list\n");
214
-                return -1;
215
-            }
89
+			$this->ftp_debug("Connected to remote host \"".$server.":".$port."\"\n");
90
+
91
+			return TRUE;
92
+		}
93
+
94
+		function ftp_login($user, $pass)
95
+		{
96
+			$this->ftp_putcmd("USER", $user);
97
+			if (!$this->ftp_ok()) {
98
+				$this->ftp_debug("Error : USER command failed\n");
99
+				return FALSE;
100
+			}
101
+
102
+			$this->ftp_putcmd("PASS", $pass);
103
+			if (!$this->ftp_ok()) {
104
+				$this->ftp_debug("Error : PASS command failed\n");
105
+				return FALSE;
106
+			}
107
+			$this->ftp_debug("Authentication succeeded\n");
108
+
109
+			return TRUE;
110
+		}
111
+
112
+		function ftp_pwd()
113
+		{
114
+			$this->ftp_putcmd("PWD");
115
+			if (!$this->ftp_ok()) {
116
+				$this->ftp_debug("Error : PWD command failed\n");
117
+				return FALSE;
118
+			}
119
+
120
+			return preg_replace("@^[0-9]{3} \"(.+)\" .+\r\n@", "\\1", $this->ftp_resp);
121
+		}
122
+
123
+		function ftp_size($pathname)
124
+		{
125
+			$this->ftp_putcmd("SIZE", $pathname);
126
+			if (!$this->ftp_ok()) {
127
+				$this->ftp_debug("Error : SIZE command failed\n");
128
+				return -1;
129
+			}
130
+
131
+			return preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp);
132
+		}
133
+
134
+		function ftp_mdtm($pathname)
135
+		{
136
+			$this->ftp_putcmd("MDTM", $pathname);
137
+			if (!$this->ftp_ok()) {
138
+				$this->ftp_debug("Error : MDTM command failed\n");
139
+				return -1;
140
+			}
141
+			$mdtm = preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp);
142
+			$date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
143
+			$timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
144
+
145
+			return $timestamp;
146
+		}
147
+
148
+		function ftp_systype()
149
+		{
150
+			$this->ftp_putcmd("SYST");
151
+			if (!$this->ftp_ok()) {
152
+				$this->ftp_debug("Error : SYST command failed\n");
153
+				return FALSE;
154
+			}
155
+			$DATA = explode(" ", $this->ftp_resp);
156
+
157
+			return $DATA[1];
158
+		}
159
+
160
+		function ftp_cdup()
161
+		{
162
+			$this->ftp_putcmd("CDUP");
163
+			$response = $this->ftp_ok();
164
+			if (!$response) {
165
+				$this->ftp_debug("Error : CDUP command failed\n");
166
+			}
167
+			return $response;
168
+		}
169
+
170
+		function ftp_chdir($pathname)
171
+		{
172
+			$this->ftp_putcmd("CWD", $pathname);
173
+			$response = $this->ftp_ok();
174
+			if (!$response) {
175
+				$this->ftp_debug("Error : CWD command failed\n");
176
+			}
177
+			return $response;
178
+		}
179
+
180
+		function ftp_delete($pathname)
181
+		{
182
+			$this->ftp_putcmd("DELE", $pathname);
183
+			$response = $this->ftp_ok();
184
+			if (!$response) {
185
+				$this->ftp_debug("Error : DELE command failed\n");
186
+			}
187
+			return $response;
188
+		}
189
+
190
+		function ftp_rmdir($pathname)
191
+		{
192
+			$this->ftp_putcmd("RMD", $pathname);
193
+			$response = $this->ftp_ok();
194
+			if (!$response) {
195
+				$this->ftp_debug("Error : RMD command failed\n");
196
+			}
197
+			return $response;
198
+		}
199
+
200
+		function ftp_mkdir($pathname)
201
+		{
202
+			$this->ftp_putcmd("MKD", $pathname);
203
+			$response = $this->ftp_ok();
204
+			if (!$response) {
205
+				$this->ftp_debug("Error : MKD command failed\n");
206
+			}
207
+			return $response;
208
+		}
209
+
210
+		function ftp_file_exists($pathname)
211
+		{
212
+			if (!($remote_list = $this->ftp_nlist("-a"))) {
213
+				$this->ftp_debug("Error : Cannot get remote file list\n");
214
+				return -1;
215
+			}
216 216
             
217
-            reset($remote_list);
218
-            while (list(,$value) = each($remote_list)) {
219
-                if ($value == $pathname) {
220
-                    $this->ftp_debug("Remote file ".$pathname." exists\n");
221
-                    return 1;
222
-                }
223
-            }
224
-            $this->ftp_debug("Remote file ".$pathname." does not exist\n");
225
-
226
-            return 0;
227
-        }
228
-
229
-        function ftp_rename($from, $to)
230
-        {
231
-            $this->ftp_putcmd("RNFR", $from);
232
-            if (!$this->ftp_ok()) {
233
-                $this->ftp_debug("Error : RNFR command failed\n");
234
-                return FALSE;
235
-            }
236
-            $this->ftp_putcmd("RNTO", $to);
237
-
238
-            $response = $this->ftp_ok();
239
-            if (!$response) {
240
-                $this->ftp_debug("Error : RNTO command failed\n");
241
-            }
242
-            return $response;
243
-        }
244
-
245
-        function ftp_nlist($arg = "", $pathname = "")
246
-        {
247
-            if (!($string = $this->ftp_pasv())) {
248
-                return FALSE;
249
-            }
250
-
251
-            if ($arg == "") {
252
-                $nlst = "NLST";
253
-            } else {
254
-                $nlst = "NLST ".$arg;
255
-            }
256
-            $this->ftp_putcmd($nlst, $pathname);
257
-
258
-            $sock_data = $this->ftp_open_data_connection($string);
259
-            if (!$sock_data || !$this->ftp_ok()) {
260
-                $this->ftp_debug("Error : Cannot connect to remote host\n");
261
-                $this->ftp_debug("Error : NLST command failed\n");
262
-                return FALSE;
263
-            }
264
-            $this->ftp_debug("Connected to remote host\n");
217
+			reset($remote_list);
218
+			while (list(,$value) = each($remote_list)) {
219
+				if ($value == $pathname) {
220
+					$this->ftp_debug("Remote file ".$pathname." exists\n");
221
+					return 1;
222
+				}
223
+			}
224
+			$this->ftp_debug("Remote file ".$pathname." does not exist\n");
225
+
226
+			return 0;
227
+		}
228
+
229
+		function ftp_rename($from, $to)
230
+		{
231
+			$this->ftp_putcmd("RNFR", $from);
232
+			if (!$this->ftp_ok()) {
233
+				$this->ftp_debug("Error : RNFR command failed\n");
234
+				return FALSE;
235
+			}
236
+			$this->ftp_putcmd("RNTO", $to);
237
+
238
+			$response = $this->ftp_ok();
239
+			if (!$response) {
240
+				$this->ftp_debug("Error : RNTO command failed\n");
241
+			}
242
+			return $response;
243
+		}
244
+
245
+		function ftp_nlist($arg = "", $pathname = "")
246
+		{
247
+			if (!($string = $this->ftp_pasv())) {
248
+				return FALSE;
249
+			}
250
+
251
+			if ($arg == "") {
252
+				$nlst = "NLST";
253
+			} else {
254
+				$nlst = "NLST ".$arg;
255
+			}
256
+			$this->ftp_putcmd($nlst, $pathname);
257
+
258
+			$sock_data = $this->ftp_open_data_connection($string);
259
+			if (!$sock_data || !$this->ftp_ok()) {
260
+				$this->ftp_debug("Error : Cannot connect to remote host\n");
261
+				$this->ftp_debug("Error : NLST command failed\n");
262
+				return FALSE;
263
+			}
264
+			$this->ftp_debug("Connected to remote host\n");
265 265
 
266 266
 			$list = array();
267
-            while (!feof($sock_data)) {
268
-                $list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512));
269
-            }
270
-            $this->ftp_close_data_connection($sock_data);
271
-            $this->ftp_debug(implode("\n", $list));
272
-
273
-            if (!$this->ftp_ok()) {
274
-                $this->ftp_debug("Error : NLST command failed\n");
275
-                return FALSE;
276
-            }
277
-
278
-            return $list;
279
-        }
280
-
281
-        function ftp_rawlist($pathname = "")
282
-        {
283
-            if (!($string = $this->ftp_pasv())) {
284
-                return FALSE;
285
-            }
286
-
287
-            $this->ftp_putcmd("LIST", $pathname);
288
-
289
-            $sock_data = $this->ftp_open_data_connection($string);
290
-            if (!$sock_data || !$this->ftp_ok()) {
291
-                $this->ftp_debug("Error : Cannot connect to remote host\n");
292
-                $this->ftp_debug("Error : LIST command failed\n");
293
-                return FALSE;
294
-            }
295
-
296
-            $this->ftp_debug("Connected to remote host\n");
297
-
298
-            while (!feof($sock_data)) {
299
-                $list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512));
300
-            }
301
-            $this->ftp_debug(implode("\n", $list));
302
-            $this->ftp_close_data_connection($sock_data);
303
-
304
-            if (!$this->ftp_ok()) {
305
-                $this->ftp_debug("Error : LIST command failed\n");
306
-                return FALSE;
307
-            }
308
-
309
-            return $list;
310
-        }
311
-
312
-        function ftp_get($localfile, $remotefile, $mode = 1)
313
-        {
314
-            umask($this->umask);
315
-
316
-            if (@file_exists($localfile)) {
317
-                $this->ftp_debug("Warning : local file will be overwritten\n");
318
-            }
319
-
320
-            $fp = @fopen($localfile, "w");
321
-            if (!$fp) {
322
-                $this->ftp_debug("Error : Cannot create \"".$localfile."\"");
323
-                $this->ftp_debug("Error : GET command failed\n");
324
-                return FALSE;
325
-            }
326
-
327
-            if (!$this->ftp_type($mode)) {
328
-                $this->ftp_debug("Error : GET command failed\n");
329
-                return FALSE;
330
-            }
331
-
332
-            if (!($string = $this->ftp_pasv())) {
333
-                $this->ftp_debug("Error : GET command failed\n");
334
-                return FALSE;
335
-            }
336
-
337
-            $this->ftp_putcmd("RETR", $remotefile);
338
-
339
-            $sock_data = $this->ftp_open_data_connection($string);
340
-            if (!$sock_data || !$this->ftp_ok()) {
341
-                $this->ftp_debug("Error : Cannot connect to remote host\n");
342
-                $this->ftp_debug("Error : GET command failed\n");
343
-                return FALSE;
344
-            }
345
-            $this->ftp_debug("Connected to remote host\n");
346
-            $this->ftp_debug("Retrieving remote file \"".$remotefile."\" to local file \"".$localfile."\"\n");
347
-            while (!feof($sock_data)) {
348
-                fputs($fp, fread($sock_data, 4096));
349
-            }
350
-            fclose($fp);
351
-
352
-            $this->ftp_close_data_connection($sock_data);
353
-
354
-            $response = $this->ftp_ok();
355
-            if (!$response) {
356
-                $this->ftp_debug("Error : GET command failed\n");
357
-            }
358
-            return $response;
359
-        }
360
-
361
-        function ftp_put($remotefile, $localfile, $mode = 1)
362
-        {
267
+			while (!feof($sock_data)) {
268
+				$list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512));
269
+			}
270
+			$this->ftp_close_data_connection($sock_data);
271
+			$this->ftp_debug(implode("\n", $list));
272
+
273
+			if (!$this->ftp_ok()) {
274
+				$this->ftp_debug("Error : NLST command failed\n");
275
+				return FALSE;
276
+			}
277
+
278
+			return $list;
279
+		}
280
+
281
+		function ftp_rawlist($pathname = "")
282
+		{
283
+			if (!($string = $this->ftp_pasv())) {
284
+				return FALSE;
285
+			}
286
+
287
+			$this->ftp_putcmd("LIST", $pathname);
288
+
289
+			$sock_data = $this->ftp_open_data_connection($string);
290
+			if (!$sock_data || !$this->ftp_ok()) {
291
+				$this->ftp_debug("Error : Cannot connect to remote host\n");
292
+				$this->ftp_debug("Error : LIST command failed\n");
293
+				return FALSE;
294
+			}
295
+
296
+			$this->ftp_debug("Connected to remote host\n");
297
+
298
+			while (!feof($sock_data)) {
299
+				$list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512));
300
+			}
301
+			$this->ftp_debug(implode("\n", $list));
302
+			$this->ftp_close_data_connection($sock_data);
303
+
304
+			if (!$this->ftp_ok()) {
305
+				$this->ftp_debug("Error : LIST command failed\n");
306
+				return FALSE;
307
+			}
308
+
309
+			return $list;
310
+		}
311
+
312
+		function ftp_get($localfile, $remotefile, $mode = 1)
313
+		{
314
+			umask($this->umask);
315
+
316
+			if (@file_exists($localfile)) {
317
+				$this->ftp_debug("Warning : local file will be overwritten\n");
318
+			}
319
+
320
+			$fp = @fopen($localfile, "w");
321
+			if (!$fp) {
322
+				$this->ftp_debug("Error : Cannot create \"".$localfile."\"");
323
+				$this->ftp_debug("Error : GET command failed\n");
324
+				return FALSE;
325
+			}
326
+
327
+			if (!$this->ftp_type($mode)) {
328
+				$this->ftp_debug("Error : GET command failed\n");
329
+				return FALSE;
330
+			}
331
+
332
+			if (!($string = $this->ftp_pasv())) {
333
+				$this->ftp_debug("Error : GET command failed\n");
334
+				return FALSE;
335
+			}
336
+
337
+			$this->ftp_putcmd("RETR", $remotefile);
338
+
339
+			$sock_data = $this->ftp_open_data_connection($string);
340
+			if (!$sock_data || !$this->ftp_ok()) {
341
+				$this->ftp_debug("Error : Cannot connect to remote host\n");
342
+				$this->ftp_debug("Error : GET command failed\n");
343
+				return FALSE;
344
+			}
345
+			$this->ftp_debug("Connected to remote host\n");
346
+			$this->ftp_debug("Retrieving remote file \"".$remotefile."\" to local file \"".$localfile."\"\n");
347
+			while (!feof($sock_data)) {
348
+				fputs($fp, fread($sock_data, 4096));
349
+			}
350
+			fclose($fp);
351
+
352
+			$this->ftp_close_data_connection($sock_data);
353
+
354
+			$response = $this->ftp_ok();
355
+			if (!$response) {
356
+				$this->ftp_debug("Error : GET command failed\n");
357
+			}
358
+			return $response;
359
+		}
360
+
361
+		function ftp_put($remotefile, $localfile, $mode = 1)
362
+		{
363 363
             
364
-            if (!@file_exists($localfile)) {
365
-                $this->ftp_debug("Error : No such file or directory \"".$localfile."\"\n");
366
-                $this->ftp_debug("Error : PUT command failed\n");
367
-                return FALSE;
368
-            }
369
-
370
-            $fp = @fopen($localfile, "r");
371
-            if (!$fp) {
372
-                $this->ftp_debug("Error : Cannot read file \"".$localfile."\"\n");
373
-                $this->ftp_debug("Error : PUT command failed\n");
374
-                return FALSE;
375
-            }
376
-
377
-            if (!$this->ftp_type($mode)) {
378
-                $this->ftp_debug("Error : PUT command failed\n");
379
-                return FALSE;
380
-            }
381
-
382
-            if (!($string = $this->ftp_pasv())) {
383
-                $this->ftp_debug("Error : PUT command failed\n");
384
-                return FALSE;
385
-            }
386
-
387
-            $this->ftp_putcmd("STOR", $remotefile);
388
-
389
-            $sock_data = $this->ftp_open_data_connection($string);
390
-            if (!$sock_data || !$this->ftp_ok()) {
391
-                $this->ftp_debug("Error : Cannot connect to remote host\n");
392
-                $this->ftp_debug("Error : PUT command failed\n");
393
-                return FALSE;
394
-            }
395
-            $this->ftp_debug("Connected to remote host\n");
396
-            $this->ftp_debug("Storing local file \"".$localfile."\" to remote file \"".$remotefile."\"\n");
397
-            while (!feof($fp)) {
398
-                fputs($sock_data, fread($fp, 4096));
399
-            }
400
-            fclose($fp);
401
-
402
-            $this->ftp_close_data_connection($sock_data);
403
-
404
-            $response = $this->ftp_ok();
405
-            if (!$response) {
406
-                $this->ftp_debug("Error : PUT command failed\n");
407
-            }
408
-            return $response;
409
-        }
410
-
411
-        function ftp_site($command)
412
-        {
413
-            $this->ftp_putcmd("SITE", $command);
414
-            $response = $this->ftp_ok();
415
-            if (!$response) {
416
-                $this->ftp_debug("Error : SITE command failed\n");
417
-            }
418
-            return $response;
419
-        }
420
-
421
-        function ftp_quit()
422
-        {
423
-            $this->ftp_putcmd("QUIT");
424
-            if (!$this->ftp_ok() || !fclose($this->ftp_sock)) {
425
-                $this->ftp_debug("Error : QUIT command failed\n");
426
-                return FALSE;
427
-            }
428
-            $this->ftp_debug("Disconnected from remote host\n");
429
-            return TRUE;
430
-        }
431
-
432
-        /* Private Functions */
433
-
434
-        function ftp_type($mode)
435
-        {
436
-            if ($mode) {
437
-                $type = "I"; //Binary mode
438
-            } else {
439
-                $type = "A"; //ASCII mode
440
-            }
441
-            $this->ftp_putcmd("TYPE", $type);
442
-            $response = $this->ftp_ok();
443
-            if (!$response) {
444
-                $this->ftp_debug("Error : TYPE command failed\n");
445
-            }
446
-            return $response;
447
-        }
448
-
449
-        function ftp_port($ip_port)
450
-        {
451
-            $this->ftp_putcmd("PORT", $ip_port);
452
-            $response = $this->ftp_ok();
453
-            if (!$response) {
454
-                $this->ftp_debug("Error : PORT command failed\n");
455
-            }
456
-            return $response;
457
-        }
458
-
459
-        function ftp_pasv()
460
-        {
461
-            $this->ftp_putcmd("PASV");
462
-            if (!$this->ftp_ok()) {
463
-                $this->ftp_debug("Error : PASV command failed\n");
464
-                return FALSE;
465
-            }
466
-
467
-            $ip_port = preg_replace("@^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$@", "\\1", $this->ftp_resp);
468
-            return $ip_port;
469
-        }
470
-
471
-        function ftp_putcmd($cmd, $arg = "")
472
-        {
473
-            if ($arg != "") {
474
-                $cmd = $cmd." ".$arg;
475
-            }
476
-
477
-            fputs($this->ftp_sock, $cmd."\r\n");
478
-            $this->ftp_debug("> ".$cmd."\n");
479
-
480
-            return TRUE;
481
-        }
482
-
483
-        function ftp_ok()
484
-        {
485
-            $this->ftp_resp = "";
364
+			if (!@file_exists($localfile)) {
365
+				$this->ftp_debug("Error : No such file or directory \"".$localfile."\"\n");
366
+				$this->ftp_debug("Error : PUT command failed\n");
367
+				return FALSE;
368
+			}
369
+
370
+			$fp = @fopen($localfile, "r");
371
+			if (!$fp) {
372
+				$this->ftp_debug("Error : Cannot read file \"".$localfile."\"\n");
373
+				$this->ftp_debug("Error : PUT command failed\n");
374
+				return FALSE;
375
+			}
376
+
377
+			if (!$this->ftp_type($mode)) {
378
+				$this->ftp_debug("Error : PUT command failed\n");
379
+				return FALSE;
380
+			}
381
+
382
+			if (!($string = $this->ftp_pasv())) {
383
+				$this->ftp_debug("Error : PUT command failed\n");
384
+				return FALSE;
385
+			}
386
+
387
+			$this->ftp_putcmd("STOR", $remotefile);
388
+
389
+			$sock_data = $this->ftp_open_data_connection($string);
390
+			if (!$sock_data || !$this->ftp_ok()) {
391
+				$this->ftp_debug("Error : Cannot connect to remote host\n");
392
+				$this->ftp_debug("Error : PUT command failed\n");
393
+				return FALSE;
394
+			}
395
+			$this->ftp_debug("Connected to remote host\n");
396
+			$this->ftp_debug("Storing local file \"".$localfile."\" to remote file \"".$remotefile."\"\n");
397
+			while (!feof($fp)) {
398
+				fputs($sock_data, fread($fp, 4096));
399
+			}
400
+			fclose($fp);
401
+
402
+			$this->ftp_close_data_connection($sock_data);
403
+
404
+			$response = $this->ftp_ok();
405
+			if (!$response) {
406
+				$this->ftp_debug("Error : PUT command failed\n");
407
+			}
408
+			return $response;
409
+		}
410
+
411
+		function ftp_site($command)
412
+		{
413
+			$this->ftp_putcmd("SITE", $command);
414
+			$response = $this->ftp_ok();
415
+			if (!$response) {
416
+				$this->ftp_debug("Error : SITE command failed\n");
417
+			}
418
+			return $response;
419
+		}
420
+
421
+		function ftp_quit()
422
+		{
423
+			$this->ftp_putcmd("QUIT");
424
+			if (!$this->ftp_ok() || !fclose($this->ftp_sock)) {
425
+				$this->ftp_debug("Error : QUIT command failed\n");
426
+				return FALSE;
427
+			}
428
+			$this->ftp_debug("Disconnected from remote host\n");
429
+			return TRUE;
430
+		}
431
+
432
+		/* Private Functions */
433
+
434
+		function ftp_type($mode)
435
+		{
436
+			if ($mode) {
437
+				$type = "I"; //Binary mode
438
+			} else {
439
+				$type = "A"; //ASCII mode
440
+			}
441
+			$this->ftp_putcmd("TYPE", $type);
442
+			$response = $this->ftp_ok();
443
+			if (!$response) {
444
+				$this->ftp_debug("Error : TYPE command failed\n");
445
+			}
446
+			return $response;
447
+		}
448
+
449
+		function ftp_port($ip_port)
450
+		{
451
+			$this->ftp_putcmd("PORT", $ip_port);
452
+			$response = $this->ftp_ok();
453
+			if (!$response) {
454
+				$this->ftp_debug("Error : PORT command failed\n");
455
+			}
456
+			return $response;
457
+		}
458
+
459
+		function ftp_pasv()
460
+		{
461
+			$this->ftp_putcmd("PASV");
462
+			if (!$this->ftp_ok()) {
463
+				$this->ftp_debug("Error : PASV command failed\n");
464
+				return FALSE;
465
+			}
466
+
467
+			$ip_port = preg_replace("@^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$@", "\\1", $this->ftp_resp);
468
+			return $ip_port;
469
+		}
470
+
471
+		function ftp_putcmd($cmd, $arg = "")
472
+		{
473
+			if ($arg != "") {
474
+				$cmd = $cmd." ".$arg;
475
+			}
476
+
477
+			fputs($this->ftp_sock, $cmd."\r\n");
478
+			$this->ftp_debug("> ".$cmd."\n");
479
+
480
+			return TRUE;
481
+		}
482
+
483
+		function ftp_ok()
484
+		{
485
+			$this->ftp_resp = "";
486 486
 
487 487
 			// 한줄을 읽는다.
488 488
 			$line = '';
@@ -521,49 +521,49 @@  discard block
 block discarded – undo
521 521
 				}while($line);
522 522
 			}
523 523
 
524
-            $this->ftp_debug(str_replace("\r\n", "\n", $this->ftp_resp));
525
-
526
-            if (!preg_match("@^[123]@", $this->ftp_resp)) {
527
-                return FALSE;
528
-            }
529
-
530
-            return TRUE;
531
-        }
532
-
533
-        function ftp_close_data_connection($sock)
534
-        {
535
-            $this->ftp_debug("Disconnected from remote host\n");
536
-            return fclose($sock);
537
-        }
538
-
539
-        function ftp_open_data_connection($ip_port)
540
-        {
541
-            if (!preg_match("@[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+@", $ip_port)) {
542
-                $this->ftp_debug("Error : Illegal ip-port format(".$ip_port.")\n");
543
-                return FALSE;
544
-            }
545
-
546
-            $DATA = explode(",", $ip_port);
547
-            $ipaddr = $DATA[0].".".$DATA[1].".".$DATA[2].".".$DATA[3];
548
-            $port   = $DATA[4]*256 + $DATA[5];
549
-            $this->ftp_debug("Trying to ".$ipaddr.":".$port." ...\n");
550
-            $data_connection = @fsockopen($ipaddr, $port, $errno, $errstr);
551
-            if (!$data_connection) {
552
-                $this->ftp_debug("Error : Cannot open data connection to ".$ipaddr.":".$port."\n");
553
-                $this->ftp_debug("Error : ".$errstr." (".$errno.")\n");
554
-                return FALSE;
555
-            }
556
-
557
-            return $data_connection;
558
-        }
559
-
560
-        function ftp_debug($message = "")
561
-        {
562
-            if ($this->debug) {
563
-                echo $message;
564
-            }
565
-
566
-            return TRUE;
567
-        }
568
-    }
524
+			$this->ftp_debug(str_replace("\r\n", "\n", $this->ftp_resp));
525
+
526
+			if (!preg_match("@^[123]@", $this->ftp_resp)) {
527
+				return FALSE;
528
+			}
529
+
530
+			return TRUE;
531
+		}
532
+
533
+		function ftp_close_data_connection($sock)
534
+		{
535
+			$this->ftp_debug("Disconnected from remote host\n");
536
+			return fclose($sock);
537
+		}
538
+
539
+		function ftp_open_data_connection($ip_port)
540
+		{
541
+			if (!preg_match("@[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+@", $ip_port)) {
542
+				$this->ftp_debug("Error : Illegal ip-port format(".$ip_port.")\n");
543
+				return FALSE;
544
+			}
545
+
546
+			$DATA = explode(",", $ip_port);
547
+			$ipaddr = $DATA[0].".".$DATA[1].".".$DATA[2].".".$DATA[3];
548
+			$port   = $DATA[4]*256 + $DATA[5];
549
+			$this->ftp_debug("Trying to ".$ipaddr.":".$port." ...\n");
550
+			$data_connection = @fsockopen($ipaddr, $port, $errno, $errstr);
551
+			if (!$data_connection) {
552
+				$this->ftp_debug("Error : Cannot open data connection to ".$ipaddr.":".$port."\n");
553
+				$this->ftp_debug("Error : ".$errstr." (".$errno.")\n");
554
+				return FALSE;
555
+			}
556
+
557
+			return $data_connection;
558
+		}
559
+
560
+		function ftp_debug($message = "")
561
+		{
562
+			if ($this->debug) {
563
+				echo $message;
564
+			}
565
+
566
+			return TRUE;
567
+		}
568
+	}
569 569
 ?>
Please login to merge, or discard this patch.
tools/dbxml_validator/connect_wrapper.php 3 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 /**
13 13
   @brief
14 14
   @developer
15
-  */
15
+ */
16 16
 class DBMysqlConnectWrapper extends DBMysql
17 17
 {
18 18
 	public $queries = '';
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 		@developer
23 23
 		@return
24 24
 		@access
25
-		*/
25
+	 */
26 26
 	public function __construct()
27 27
 	{
28 28
 		$this->db_type = 'mysql';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		@developer
35 35
 		@return
36 36
 		@access
37
-		*/
37
+	 */
38 38
 	public function create()
39 39
 	{
40 40
 		return new DBMysqlConnectWrapper();
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 		@developer
46 46
 		@return
47 47
 		@access
48
-		*/
48
+	 */
49 49
 	public function actDBClassStart()
50 50
 	{
51 51
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		@return
57 57
 		@access
58 58
 		@param $query
59
-		*/
59
+	 */
60 60
 	public function actStart($query)
61 61
 	{
62 62
 	}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		@developer
67 67
 		@return
68 68
 		@access
69
-		*/
69
+	 */
70 70
 	public function actFinish()
71 71
 	{
72 72
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		@developer
77 77
 		@return
78 78
 		@access
79
-		*/
79
+	 */
80 80
 	public function actDBClassFinish()
81 81
 	{
82 82
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		@developer
87 87
 		@return
88 88
 		@access
89
-		*/
89
+	 */
90 90
 	public function isSupported()
91 91
 	{
92 92
 		// No need to actually check for 'mysql_connect' function
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		@return
100 100
 		@access
101 101
 		@param $connection
102
-		*/
102
+	 */
103 103
 	public function __connect($connection)
104 104
 	{
105 105
 		return TRUE;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		@return
112 112
 		@access
113 113
 		@param $connection
114
-		*/
114
+	 */
115 115
 	public function _afterConnect($connection)
116 116
 	{
117 117
 	}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		@return
123 123
 		@access
124 124
 		@param $connection
125
-		*/
125
+	 */
126 126
 	public function _close($connection)
127 127
 	{
128 128
 	}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		@access
135 135
 		@param $type
136 136
 		@param $indx
137
-		*/
137
+	 */
138 138
 	public function close($type = 'master', $indx = NULL)
139 139
 	{
140 140
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		@developer
145 145
 		@return
146 146
 		@access
147
-		*/
147
+	 */
148 148
 	public function _begin()
149 149
 	{
150 150
 		return TRUE;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		@developer
156 156
 		@return
157 157
 		@access
158
-		*/
158
+	 */
159 159
 	public function _rollback()
160 160
 	{
161 161
 		return TRUE;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 		@developer
167 167
 		@return
168 168
 		@access
169
-		*/
169
+	 */
170 170
 	public function _commit()
171 171
 	{
172 172
 		return TRUE;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		@access
180 180
 		@param $query
181 181
 		@param $connection
182
-		*/
182
+	 */
183 183
 	public function __query($query, $connection)
184 184
 	{
185 185
 		$this->queries .= "\n" . $query;
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		@access
195 195
 		@param $result
196 196
 		@param $arrayIndexEndValue
197
-		*/
197
+	 */
198 198
 	public function _fetch($result, $arrayIndexEndValue = NULL)
199 199
 	{
200 200
 		return new Any_prop_obj_base();
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		@return
207 207
 		@access
208 208
 		@param $target_name
209
-		*/
209
+	 */
210 210
 	public function isTableExists($target_name)
211 211
 	{
212 212
 		parent::isTableExists($target_name);
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		@developer
220 220
 		@return
221 221
 		@access
222
-		*/
222
+	 */
223 223
 	public function db_insert_id()
224 224
 	{
225 225
 		return NULL;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		@return
232 232
 		@access
233 233
 		@param $result
234
-		*/
234
+	 */
235 235
 	public function db_fetch_object(&$result)
236 236
 	{
237 237
 		return new Any_prop_obj_base();
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 /**
242 242
   @brief
243 243
   @developer
244
-  */
244
+ */
245 245
 class DBMysqliConnectWrapper extends DBMysqli
246 246
 {
247 247
 	public $queries = '';
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		@developer
252 252
 		@return
253 253
 		@access
254
-		*/
254
+	 */
255 255
 	public function __construct()
256 256
 	{
257 257
 		$this->db_type = 'mysqli';
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		@developer
264 264
 		@return
265 265
 		@access
266
-		*/
266
+	 */
267 267
 	public function create()
268 268
 	{
269 269
 		return new DBMysqlConnectWrapper();
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		@developer
275 275
 		@return
276 276
 		@access
277
-		*/
277
+	 */
278 278
 	public function actDBClassStart()
279 279
 	{
280 280
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		@return
286 286
 		@access
287 287
 		@param $query
288
-		*/
288
+	 */
289 289
 	public function actStart($query)
290 290
 	{
291 291
 	}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		@developer
296 296
 		@return
297 297
 		@access
298
-		*/
298
+	 */
299 299
 	public function actFinish()
300 300
 	{
301 301
 	}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		@developer
306 306
 		@return
307 307
 		@access
308
-		*/
308
+	 */
309 309
 	public function actDBClassFinish()
310 310
 	{
311 311
 	}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 		@developer
316 316
 		@return
317 317
 		@access
318
-		*/
318
+	 */
319 319
 	public function isSupported()
320 320
 	{
321 321
 		// No need to actually check for 'mysql_connect' function
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		@return
329 329
 		@access
330 330
 		@param $target_name
331
-		*/
331
+	 */
332 332
 	public function isTableExists($target_name)
333 333
 	{
334 334
 		parent::isTableExists($target_name);
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 		@return
345 345
 		@access
346 346
 		@param $string
347
-		*/
347
+	 */
348 348
 	public function addQuotes($string)
349 349
 	{
350 350
 		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 		@return
367 367
 		@access
368 368
 		@param $connection
369
-		*/
369
+	 */
370 370
 	public function __connect($connection)
371 371
 	{
372 372
 		return TRUE;
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 		@return
379 379
 		@access
380 380
 		@param $connection
381
-		*/
381
+	 */
382 382
 	public function _afterConnect($connection)
383 383
 	{
384 384
 	}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		@return
390 390
 		@access
391 391
 		@param $connection
392
-		*/
392
+	 */
393 393
 	public function _close($connection)
394 394
 	{
395 395
 	}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 		@access
402 402
 		@param $type
403 403
 		@param $indx
404
-		*/
404
+	 */
405 405
 	public function close($type = 'master', $indx = NULL)
406 406
 	{
407 407
 	}
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 		@developer
412 412
 		@return
413 413
 		@access
414
-		*/
414
+	 */
415 415
 	public function _begin()
416 416
 	{
417 417
 		return TRUE;
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		@developer
423 423
 		@return
424 424
 		@access
425
-		*/
425
+	 */
426 426
 	public function _rollback()
427 427
 	{
428 428
 		return TRUE;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		@developer
434 434
 		@return
435 435
 		@access
436
-		*/
436
+	 */
437 437
 	public function _commit()
438 438
 	{
439 439
 		return TRUE;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 		@access
447 447
 		@param $query
448 448
 		@param $connection
449
-		*/
449
+	 */
450 450
 	public function __query($query, $connection)
451 451
 	{
452 452
 		$this->queries .= "\n" . $query;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 		@access
462 462
 		@param $result
463 463
 		@param $arrayIndexEndValue
464
-		*/
464
+	 */
465 465
 	public function _fetch($result, $arrayIndexEndValue = NULL)
466 466
 	{
467 467
 		return new Any_prop_obj_base();
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		@developer
473 473
 		@return
474 474
 		@access
475
-		*/
475
+	 */
476 476
 	public function db_insert_id()
477 477
 	{
478 478
 		return NULL;
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		@return
485 485
 		@access
486 486
 		@param $result
487
-		*/
487
+	 */
488 488
 	public function db_fetch_object(&$result)
489 489
 	{
490 490
 		return new Any_prop_obj_base();
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 /**
495 495
   @brief
496 496
   @developer
497
-  */
497
+ */
498 498
 class DBCubridConnectWrapper extends DBCubrid
499 499
 {
500 500
 	public $queries = '';
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		@developer
505 505
 		@return
506 506
 		@access
507
-		*/
507
+	 */
508 508
 	public function __construct()
509 509
 	{
510 510
 		$this->db_type = 'cubrid';
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		@developer
517 517
 		@return
518 518
 		@access
519
-		*/
519
+	 */
520 520
 	public function create()
521 521
 	{
522 522
 		return new DBMysqlConnectWrapper();
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		@developer
528 528
 		@return
529 529
 		@access
530
-		*/
530
+	 */
531 531
 	public function actDBClassStart()
532 532
 	{
533 533
 	}
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		@return
539 539
 		@access
540 540
 		@param $query
541
-		*/
541
+	 */
542 542
 	public function actStart($query)
543 543
 	{
544 544
 	}
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 		@developer
549 549
 		@return
550 550
 		@access
551
-		*/
551
+	 */
552 552
 	public function _makeSequence()
553 553
 	{
554 554
 		return TRUE;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		@developer
560 560
 		@return
561 561
 		@access
562
-		*/
562
+	 */
563 563
 	public function actFinish()
564 564
 	{
565 565
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 		@developer
570 570
 		@return
571 571
 		@access
572
-		*/
572
+	 */
573 573
 	public function actDBClassFinish()
574 574
 	{
575 575
 	}
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 		@developer
580 580
 		@return
581 581
 		@access
582
-		*/
582
+	 */
583 583
 	public function isSupported()
584 584
 	{
585 585
 		// No need to actually check for 'cubrid_connect' function
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 		@return
593 593
 		@access
594 594
 		@param $target_name
595
-		*/
595
+	 */
596 596
 	public function isTableExists($target_name)
597 597
 	{
598 598
 		try
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		@return
613 613
 		@access
614 614
 		@param $connection
615
-		*/
615
+	 */
616 616
 	public function __connect($connection)
617 617
 	{
618 618
 		return TRUE;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 		@return
625 625
 		@access
626 626
 		@param $connection
627
-		*/
627
+	 */
628 628
 	public function _afterConnect($connection)
629 629
 	{
630 630
 	}
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		@return
636 636
 		@access
637 637
 		@param $connection
638
-		*/
638
+	 */
639 639
 	public function _close($connection)
640 640
 	{
641 641
 	}
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		@access
648 648
 		@param $type
649 649
 		@param $indx
650
-		*/
650
+	 */
651 651
 	public function close($type = 'master', $indx = NULL)
652 652
 	{
653 653
 	}
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 		@developer
658 658
 		@return
659 659
 		@access
660
-		*/
660
+	 */
661 661
 	public function _begin()
662 662
 	{
663 663
 		return TRUE;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 		@developer
669 669
 		@return
670 670
 		@access
671
-		*/
671
+	 */
672 672
 	public function _rollback()
673 673
 	{
674 674
 		return TRUE;
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		@developer
680 680
 		@return
681 681
 		@access
682
-		*/
682
+	 */
683 683
 	public function _commit()
684 684
 	{
685 685
 		return TRUE;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 		@access
693 693
 		@param $query
694 694
 		@param $connection
695
-		*/
695
+	 */
696 696
 	public function __query($query, $connection)
697 697
 	{
698 698
 		$this->queries .= "\n" . $query;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		@access
708 708
 		@param $result
709 709
 		@param $arrayIndexEndValue
710
-		*/
710
+	 */
711 711
 	public function _fetch($result, $arrayIndexEndValue = NULL)
712 712
 	{
713 713
 		return new Any_prop_obj_base();
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		@developer
719 719
 		@return
720 720
 		@access
721
-		*/
721
+	 */
722 722
 	public function db_insert_id()
723 723
 	{
724 724
 		return NULL;
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		@developer
730 730
 		@return
731 731
 		@access
732
-		*/
732
+	 */
733 733
 	public function &db_fetch_object()
734 734
 	{
735 735
 		return new Any_prop_obj_base();
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 /**
740 740
   @brief
741 741
   @developer
742
-  */
742
+ */
743 743
 class DBMssqlConnectWrapper extends DBMssql
744 744
 {
745 745
 	public $queries = '';
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 		@developer
750 750
 		@return
751 751
 		@access
752
-		*/
752
+	 */
753 753
 	public function __construct()
754 754
 	{
755 755
 		$this->db_type = 'mssql';
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 		@developer
762 762
 		@return
763 763
 		@access
764
-		*/
764
+	 */
765 765
 	public function create()
766 766
 	{
767 767
 		return new DBMssqlConnectWrapper();
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 		@developer
773 773
 		@return
774 774
 		@access
775
-		*/
775
+	 */
776 776
 	public function actDBClassStart()
777 777
 	{
778 778
 	}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 		@return
784 784
 		@access
785 785
 		@param $query
786
-		*/
786
+	 */
787 787
 	public function actStart($query)
788 788
 	{
789 789
 	}
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
 		@developer
794 794
 		@return
795 795
 		@access
796
-		*/
796
+	 */
797 797
 	public function actFinish()
798 798
 	{
799 799
 	}
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 		@developer
804 804
 		@return
805 805
 		@access
806
-		*/
806
+	 */
807 807
 	public function actDBClassFinish()
808 808
 	{
809 809
 	}
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		@developer
814 814
 		@return
815 815
 		@access
816
-		*/
816
+	 */
817 817
 	public function isSupported()
818 818
 	{
819 819
 		// No need to actually check for 'mssql_connect' function
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 		@return
827 827
 		@access
828 828
 		@param $target_name
829
-		*/
829
+	 */
830 830
 	public function isTableExists($target_name)
831 831
 	{
832 832
 		parent::isTableExists($target_name);
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 		@return
841 841
 		@access
842 842
 		@param $connection
843
-		*/
843
+	 */
844 844
 	public function __connect($connection)
845 845
 	{
846 846
 		return TRUE;
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 		@return
853 853
 		@access
854 854
 		@param $connection
855
-		*/
855
+	 */
856 856
 	public function _afterConnect($connection)
857 857
 	{
858 858
 	}
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 		@return
864 864
 		@access
865 865
 		@param $connection
866
-		*/
866
+	 */
867 867
 	public function _close($connection)
868 868
 	{
869 869
 	}
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		@access
876 876
 		@param $type
877 877
 		@param $indx
878
-		*/
878
+	 */
879 879
 	public function close($type = 'master', $indx = NULL)
880 880
 	{
881 881
 	}
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 		@developer
886 886
 		@return
887 887
 		@access
888
-		*/
888
+	 */
889 889
 	public function _begin()
890 890
 	{
891 891
 		return TRUE;
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 		@developer
897 897
 		@return
898 898
 		@access
899
-		*/
899
+	 */
900 900
 	public function _rollback()
901 901
 	{
902 902
 		return TRUE;
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 		@developer
908 908
 		@return
909 909
 		@access
910
-		*/
910
+	 */
911 911
 	public function _commit()
912 912
 	{
913 913
 		return TRUE;
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 		@access
921 921
 		@param $query
922 922
 		@param $connection
923
-		*/
923
+	 */
924 924
 	public function __query($query, $connection)
925 925
 	{
926 926
 		if($this->queries)
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 		@access
941 941
 		@param $result
942 942
 		@param $arrayIndexEndValue
943
-		*/
943
+	 */
944 944
 	public function _fetch($result, $arrayIndexEndValue = NULL)
945 945
 	{
946 946
 		return new Any_prop_obj_base();
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 		@developer
952 952
 		@return
953 953
 		@access
954
-		*/
954
+	 */
955 955
 	public function db_insert_id()
956 956
 	{
957 957
 		return NULL;
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 		@developer
963 963
 		@return
964 964
 		@access
965
-		*/
965
+	 */
966 966
 	public function &db_fetch_object()
967 967
 	{
968 968
 		return new Any_prop_obj_base();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	public function __construct()
27 27
 	{
28 28
 		$this->db_type = 'mysql';
29
-		$this->_setDBInfo();	// Context::get() should indicate a mysql db
29
+		$this->_setDBInfo(); // Context::get() should indicate a mysql db
30 30
 	}
31 31
 
32 32
 	/**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		*/
183 183
 	public function __query($query, $connection)
184 184
 	{
185
-		$this->queries .= "\n" . $query;
185
+		$this->queries .= "\n".$query;
186 186
 
187 187
 		return TRUE;
188 188
 	}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	public function __construct()
256 256
 	{
257 257
 		$this->db_type = 'mysqli';
258
-		$this->_setDBInfo();	// Context::get() should indicate a mysqli db
258
+		$this->_setDBInfo(); // Context::get() should indicate a mysqli db
259 259
 	}
260 260
 
261 261
 	/**
@@ -347,12 +347,12 @@  discard block
 block discarded – undo
347 347
 		*/
348 348
 	public function addQuotes($string)
349 349
 	{
350
-		if(version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
350
+		if (version_compare(PHP_VERSION, "5.4.0", "<") && get_magic_quotes_gpc())
351 351
 		{
352 352
 			$string = stripslashes(str_replace("\\", "\\\\", $string));
353 353
 		}
354 354
 
355
-		if(!is_numeric($string))
355
+		if (!is_numeric($string))
356 356
 		{
357 357
 			$string = @mysql_real_escape_string($string);
358 358
 		}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		*/
450 450
 	public function __query($query, $connection)
451 451
 	{
452
-		$this->queries .= "\n" . $query;
452
+		$this->queries .= "\n".$query;
453 453
 
454 454
 		return TRUE;
455 455
 	}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	public function __construct()
509 509
 	{
510 510
 		$this->db_type = 'cubrid';
511
-		$this->_setDBInfo();	// Context::get() should indicate a CUBRID db
511
+		$this->_setDBInfo(); // Context::get() should indicate a CUBRID db
512 512
 	}
513 513
 
514 514
 	/**
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 		*/
696 696
 	public function __query($query, $connection)
697 697
 	{
698
-		$this->queries .= "\n" . $query;
698
+		$this->queries .= "\n".$query;
699 699
 
700 700
 		return TRUE;
701 701
 	}
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	public function __construct()
754 754
 	{
755 755
 		$this->db_type = 'mssql';
756
-		$this->_setDBInfo();	// Context::get() should indicate a MS Sql db
756
+		$this->_setDBInfo(); // Context::get() should indicate a MS Sql db
757 757
 	}
758 758
 
759 759
 	/**
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 		*/
924 924
 	public function __query($query, $connection)
925 925
 	{
926
-		if($this->queries)
926
+		if ($this->queries)
927 927
 		{
928 928
 			$this->queries .= ";\n";
929 929
 		}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -598,8 +598,7 @@
 block discarded – undo
598 598
 		try
599 599
 		{
600 600
 			parent::isTableExists($target_name);
601
-		}
602
-		catch (Exception $ex)
601
+		} catch (Exception $ex)
603 602
 		{
604 603
 		}
605 604
 
Please login to merge, or discard this patch.
modules/comment/comment.class.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/comment/comment.item.php');
4
+require_once(_XE_PATH_.'modules/comment/comment.item.php');
5 5
 
6 6
 /**
7 7
  * comment
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 		// 2008. 02. 22 add comment setting when a new module added
37 37
 		$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
38 38
 
39
-		if(!is_dir('./files/cache/tmp'))
39
+		if (!is_dir('./files/cache/tmp'))
40 40
 		{
41 41
 			FileHandler::makeDir('./files/cache/tmp');
42 42
 		}
@@ -54,63 +54,63 @@  discard block
 block discarded – undo
54 54
 		$oModuleModel = getModel('module');
55 55
 		$oModuleController = getController('module');
56 56
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
57
-		if($oModuleModel->needUpdate($version_update_id))
57
+		if ($oModuleModel->needUpdate($version_update_id))
58 58
 		{
59 59
 			// 2007. 10. 17 add a trigger to delete comments together with posting deleted
60
-			if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
60
+			if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
61 61
 			{
62 62
 				return TRUE;
63 63
 			}
64 64
 			// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
65
-			if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
65
+			if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
66 66
 			{
67 67
 				return TRUE;
68 68
 			}
69 69
 			// 2007. 10. 23 add a column for recommendation votes or notification of the comments
70
-			if(!$oDB->isColumnExists("comments", "voted_count"))
70
+			if (!$oDB->isColumnExists("comments", "voted_count"))
71 71
 			{
72 72
 				return TRUE;
73 73
 			}
74
-			if(!$oDB->isColumnExists("comments", "notify_message"))
74
+			if (!$oDB->isColumnExists("comments", "notify_message"))
75 75
 			{
76 76
 				return TRUE;
77 77
 			}
78 78
 			// 2008. 02. 22 add comment setting when a new module added
79
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
79
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
80 80
 			{
81 81
 				return TRUE;
82 82
 			}
83 83
 			// 2008. 05. 14 add a column for blamed count
84
-			if(!$oDB->isColumnExists("comments", "blamed_count"))
84
+			if (!$oDB->isColumnExists("comments", "blamed_count"))
85 85
 			{
86 86
 				return TRUE;
87 87
 			}
88
-			if(!$oDB->isColumnExists("comment_voted_log", "point"))
88
+			if (!$oDB->isColumnExists("comment_voted_log", "point"))
89 89
 			{
90 90
 				return TRUE;
91 91
 			}
92 92
 
93
-			if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
93
+			if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
94 94
 			{
95 95
 				return TRUE;
96 96
 			}
97 97
 			//2012. 02. 24 add comment published status column and index
98
-			if(!$oDB->isColumnExists("comments", "status"))
98
+			if (!$oDB->isColumnExists("comments", "status"))
99 99
 			{
100 100
 				return TRUE;
101 101
 			}
102
-			if(!$oDB->isIndexExists("comments", "idx_status"))
102
+			if (!$oDB->isIndexExists("comments", "idx_status"))
103 103
 			{
104 104
 				return TRUE;
105 105
 			}
106 106
 
107 107
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
108
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
108
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
109 109
 			{
110 110
 				return TRUE;
111 111
 			}
112 112
 
113
-			if(!$oDB->isIndexExists("comments", "idx_parent_srl"))
113
+			if (!$oDB->isIndexExists("comments", "idx_parent_srl"))
114 114
 			{
115 115
 				return TRUE;
116 116
 			}
@@ -131,46 +131,46 @@  discard block
 block discarded – undo
131 131
 		$oModuleModel = getModel('module');
132 132
 		$oModuleController = getController('module');
133 133
 		$version_update_id = implode('.', array(__CLASS__, __XE_VERSION__, 'updated'));
134
-		if($oModuleModel->needUpdate($version_update_id))
134
+		if ($oModuleModel->needUpdate($version_update_id))
135 135
 		{
136 136
 			// 2007. 10. 17 add a trigger to delete comments together with posting deleted
137
-			if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
137
+			if (!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
138 138
 			{
139 139
 				$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
140 140
 			}
141 141
 			// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
142
-			if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
142
+			if (!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
143 143
 			{
144 144
 				$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
145 145
 			}
146 146
 			// 2007. 10. 23 add a column for recommendation votes or notification of the comments
147
-			if(!$oDB->isColumnExists("comments", "voted_count"))
147
+			if (!$oDB->isColumnExists("comments", "voted_count"))
148 148
 			{
149 149
 				$oDB->addColumn("comments", "voted_count", "number", "11");
150 150
 				$oDB->addIndex("comments", "idx_voted_count", array("voted_count"));
151 151
 			}
152 152
 
153
-			if(!$oDB->isColumnExists("comments", "notify_message"))
153
+			if (!$oDB->isColumnExists("comments", "notify_message"))
154 154
 			{
155 155
 				$oDB->addColumn("comments", "notify_message", "char", "1");
156 156
 			}
157 157
 			// 2008. 02. 22 add comment setting when a new module added
158
-			if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
158
+			if (!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
159 159
 			{
160 160
 				$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
161 161
 			}
162 162
 			// 2008. 05. 14 add a column for blamed count
163
-			if(!$oDB->isColumnExists("comments", "blamed_count"))
163
+			if (!$oDB->isColumnExists("comments", "blamed_count"))
164 164
 			{
165 165
 				$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, TRUE);
166 166
 				$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
167 167
 			}
168
-			if(!$oDB->isColumnExists("comment_voted_log", "point"))
168
+			if (!$oDB->isColumnExists("comment_voted_log", "point"))
169 169
 			{
170 170
 				$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, TRUE);
171 171
 			}
172 172
 
173
-			if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
173
+			if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
174 174
 			{
175 175
 				$oDB->addIndex(
176 176
 						"comments", "idx_module_list_order", array("module_srl", "list_order"), TRUE
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 			}
179 179
 
180 180
 			//2012. 02. 24 add comment published status column and index
181
-			if(!$oDB->isColumnExists("comments", "status"))
181
+			if (!$oDB->isColumnExists("comments", "status"))
182 182
 			{
183 183
 				$oDB->addColumn("comments", "status", "number", 1, 1, TRUE);
184 184
 			}
185
-			if(!$oDB->isIndexExists("comments", "idx_status"))
185
+			if (!$oDB->isIndexExists("comments", "idx_status"))
186 186
 			{
187 187
 				$oDB->addIndex(
188 188
 						"comments", "idx_status", array("status", "comment_srl", "module_srl", "document_srl"), TRUE
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			}
191 191
 
192 192
 			// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied 
193
-			if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
193
+			if (!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
194 194
 			{
195 195
 				$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
196 196
 			}
197 197
 
198
-			if(!$oDB->isIndexExists("comments", "idx_parent_srl"))
198
+			if (!$oDB->isIndexExists("comments", "idx_parent_srl"))
199 199
 			{
200 200
 				$oDB->addIndex('comments', 'idx_parent_srl', array('parent_srl'));
201 201
 			}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	function recompileCache()
214 214
 	{
215
-		if(!is_dir('./files/cache/tmp'))
215
+		if (!is_dir('./files/cache/tmp'))
216 216
 		{
217 217
 			FileHandler::makeDir('./files/cache/tmp');
218 218
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.admin.controller.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/autoinstall/autoinstall.lib.php');
4
+require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
5 5
 
6 6
 /**
7 7
  * autoinstall module admin controller class
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	{
65 65
 		$oModel = getModel('autoinstall');
66 66
 		$item = $oModel->getLatestPackage();
67
-		if($item)
67
+		if ($item)
68 68
 		{
69 69
 			$params["updatedate"] = $item->updatedate;
70 70
 		}
@@ -92,23 +92,23 @@  discard block
 block discarded – undo
92 92
 		executeQuery("autoinstall.deleteInstalledPackage");
93 93
 		$oModel = getModel('autoinstall');
94 94
 		$packages = $oModel->getPackages();
95
-		foreach($packages as $package)
95
+		foreach ($packages as $package)
96 96
 		{
97 97
 			$real_path = FileHandler::getRealPath($package->path);
98
-			if(!file_exists($real_path))
98
+			if (!file_exists($real_path))
99 99
 			{
100 100
 				continue;
101 101
 			}
102 102
 
103 103
 			$type = $oModel->getTypeFromPath($package->path);
104
-			if($type == "core")
104
+			if ($type == "core")
105 105
 			{
106 106
 				$version = __XE_VERSION__;
107 107
 			}
108 108
 			else
109 109
 			{
110 110
 				$config_file = NULL;
111
-				switch($type)
111
+				switch ($type)
112 112
 				{
113 113
 					case "m.layout":
114 114
 						$type = "layout";
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 						break;
139 139
 				}
140 140
 
141
-				if(!$config_file)
141
+				if (!$config_file)
142 142
 				{
143 143
 					continue;
144 144
 				}
145 145
 
146 146
 				$xml = new XmlParser();
147
-				$xmlDoc = $xml->loadXmlFile($real_path . $config_file);
147
+				$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
148 148
 
149
-				if(!$xmlDoc)
149
+				if (!$xmlDoc)
150 150
 				{
151 151
 					continue;
152 152
 				}
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			$args->package_srl = $package->package_srl;
159 159
 			$args->version = $package->version;
160 160
 			$args->current_version = $version;
161
-			if(version_compare($args->version, $args->current_version, ">"))
161
+			if (version_compare($args->version, $args->current_version, ">"))
162 162
 			{
163 163
 				$args->need_update = "Y";
164 164
 			}
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		$oAdminModel = getAdminModel('autoinstall');
185 185
 		$packages = explode(',', $package_srls);
186 186
 		$ftp_info = Context::getFTPInfo();
187
-		if(!$_SESSION['ftp_password'])
187
+		if (!$_SESSION['ftp_password'])
188 188
 		{
189 189
 			$ftp_password = Context::get('ftp_password');
190 190
 		}
@@ -194,18 +194,18 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		$isSftpSupported = function_exists(ssh2_sftp);
197
-		foreach($packages as $package_srl)
197
+		foreach ($packages as $package_srl)
198 198
 		{
199 199
 			$package = $oModel->getPackage($package_srl);
200
-			if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
200
+			if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
201 201
 			{
202 202
 				$oModuleInstaller = new DirectModuleInstaller($package);
203 203
 			}
204
-			else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
204
+			else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
205 205
 			{
206 206
 				$oModuleInstaller = new SFTPModuleInstaller($package);
207 207
 			}
208
-			else if(function_exists(ftp_connect))
208
+			else if (function_exists(ftp_connect))
209 209
 			{
210 210
 				$oModuleInstaller = new PHPFTPModuleInstaller($package);
211 211
 			}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$oModuleInstaller->setServerUrl(_XE_DOWNLOAD_SERVER_);
218 218
 			$oModuleInstaller->setPassword($ftp_password);
219 219
 			$output = $oModuleInstaller->install();
220
-			if(!$output->toBool())
220
+			if (!$output->toBool())
221 221
 			{
222 222
 				return $output;
223 223
 			}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 		$this->setMessage('success_installed', 'update');
229 229
 
230
-		if(Context::get('return_url'))
230
+		if (Context::get('return_url'))
231 231
 		{
232 232
 			$this->setRedirectUrl(Context::get('return_url'));
233 233
 		}
@@ -246,30 +246,30 @@  discard block
 block discarded – undo
246 246
 	function updatePackages(&$xmlDoc)
247 247
 	{
248 248
 		$oModel = getModel('autoinstall');
249
-		if(!$xmlDoc->response->packages->item)
249
+		if (!$xmlDoc->response->packages->item)
250 250
 		{
251 251
 			return;
252 252
 		}
253
-		if(!is_array($xmlDoc->response->packages->item))
253
+		if (!is_array($xmlDoc->response->packages->item))
254 254
 		{
255 255
 			$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
256 256
 		}
257 257
 		$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl', 'have_instance');
258
-		foreach($xmlDoc->response->packages->item as $item)
258
+		foreach ($xmlDoc->response->packages->item as $item)
259 259
 		{
260 260
 			$args = new stdClass();
261
-			foreach($targets as $target)
261
+			foreach ($targets as $target)
262 262
 			{
263 263
 				$args->{$target} = $item->{$target}->body;
264 264
 			}
265
-			if($oModel->getPackage($args->package_srl))
265
+			if ($oModel->getPackage($args->package_srl))
266 266
 			{
267 267
 				$output = executeQuery("autoinstall.updatePackage", $args);
268 268
 			}
269 269
 			else
270 270
 			{
271 271
 				$output = executeQuery("autoinstall.insertPackage", $args);
272
-				if(!$output->toBool())
272
+				if (!$output->toBool())
273 273
 				{
274 274
 					$output = executeQuery("autoinstall.deletePackage", $args);
275 275
 					$output = executeQuery("autoinstall.insertPackage", $args);
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 	{
289 289
 		executeQuery("autoinstall.deleteCategory");
290 290
 		$oModel = getModel('autoinstall');
291
-		if(!is_array($xmlDoc->response->categorylist->item))
291
+		if (!is_array($xmlDoc->response->categorylist->item))
292 292
 		{
293 293
 			$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
294 294
 		}
295 295
 		$list_order = 0;
296
-		foreach($xmlDoc->response->categorylist->item as $item)
296
+		foreach ($xmlDoc->response->categorylist->item as $item)
297 297
 		{
298 298
 			$args = new stdClass();
299 299
 			$args->category_srl = $item->category_srl->body;
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
 		$package_srl = Context::get('package_srl');
315 315
 
316 316
 		$output = $this->uninstallPackageByPackageSrl($package_srl);
317
-		if($output->toBool()==FALSE)
317
+		if ($output->toBool() == FALSE)
318 318
 		{
319 319
 			return $output;
320 320
 		}
321 321
 
322
-		if(Context::get('return_url'))
322
+		if (Context::get('return_url'))
323 323
 		{
324 324
 			$this->setRedirectUrl(Context::get('return_url'));
325 325
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 		$oAdminModel = getAdminModel('autoinstall');
361 361
 
362
-		if(!$_SESSION['ftp_password'])
362
+		if (!$_SESSION['ftp_password'])
363 363
 		{
364 364
 			$ftp_password = Context::get('ftp_password');
365 365
 		}
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 		$ftp_info = Context::getFTPInfo();
371 371
 
372 372
 		$isSftpSupported = function_exists(ssh2_sftp);
373
-		if($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
373
+		if ($oAdminModel->checkUseDirectModuleInstall($package)->toBool())
374 374
 		{
375 375
 			$oModuleInstaller = new DirectModuleInstaller($package);
376 376
 		}
377
-		else if($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
377
+		else if ($ftp_info->sftp && $ftp_info->sftp == 'Y' && $isSftpSupported)
378 378
 		{
379 379
 			$oModuleInstaller = new SFTPModuleInstaller($package);
380 380
 		}
381
-		else if(function_exists('ftp_connect'))
381
+		else if (function_exists('ftp_connect'))
382 382
 		{
383 383
 			$oModuleInstaller = new PHPFTPModuleInstaller($package);
384 384
 		}
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 		$oModuleInstaller->setPassword($ftp_password);
393 393
 		$output = $oModuleInstaller->uninstall();
394
-		if(!$output->toBool())
394
+		if (!$output->toBool())
395 395
 		{
396 396
 			return $output;
397 397
 		}
Please login to merge, or discard this patch.
modules/autoinstall/autoinstall.lib.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'libs/ftp.class.php');
4
+require_once(_XE_PATH_.'libs/ftp.class.php');
5 5
 
6 6
 /**
7 7
  * Module installer
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
 	{
79 79
 		$oModel = getModel('autoinstall');
80 80
 		$type = $oModel->getTypeFromPath($this->package->path);
81
-		if($type == "module")
81
+		if ($type == "module")
82 82
 		{
83 83
 			$output = $this->uninstallModule();
84
-			if(!$output->toBool())
84
+			if (!$output->toBool())
85 85
 			{
86 86
 				return $output;
87 87
 			}
88 88
 		}
89 89
 
90 90
 		$output = $this->_connect();
91
-		if(!$output->toBool())
91
+		if (!$output->toBool())
92 92
 		{
93 93
 			return $output;
94 94
 		}
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	function _download()
118 118
 	{
119
-		if($this->package->path == ".")
119
+		if ($this->package->path == ".")
120 120
 		{
121
-			$this->download_file = $this->temp_dir . "xe.tar";
121
+			$this->download_file = $this->temp_dir."xe.tar";
122 122
 			$this->target_path = "";
123 123
 			$this->download_path = $this->temp_dir;
124 124
 		}
125 125
 		else
126 126
 		{
127 127
 			$subpath = trim(substr($this->package->path, 2), '/');
128
-			$this->download_file = $this->temp_dir . $subpath . ".tar";
128
+			$this->download_file = $this->temp_dir.$subpath.".tar";
129 129
 			$subpatharr = explode("/", $subpath);
130 130
 			array_pop($subpatharr);
131
-			$this->download_path = $this->temp_dir . implode("/", $subpatharr);
131
+			$this->download_path = $this->temp_dir.implode("/", $subpatharr);
132 132
 			$this->target_path = implode("/", $subpatharr);
133 133
 		}
134 134
 
@@ -152,17 +152,17 @@  discard block
 block discarded – undo
152 152
 		$path_array = explode("/", $this->package->path);
153 153
 		$target_name = array_pop($path_array);
154 154
 		$oModule = getModule($target_name, "class");
155
-		if(!$oModule)
155
+		if (!$oModule)
156 156
 		{
157 157
 			return new BaseObject(-1, 'msg_invalid_request');
158 158
 		}
159
-		if(!method_exists($oModule, "moduleUninstall"))
159
+		if (!method_exists($oModule, "moduleUninstall"))
160 160
 		{
161 161
 			return new BaseObject(-1, 'msg_invalid_request');
162 162
 		}
163 163
 
164 164
 		$output = $oModule->moduleUninstall();
165
-		if(is_subclass_of($output, 'BaseObject') && !$output->toBool())
165
+		if (is_subclass_of($output, 'BaseObject') && !$output->toBool())
166 166
 		{
167 167
 			return $output;
168 168
 		}
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 		$schema_dir = sprintf('%s/schemas/', $this->package->path);
171 171
 		$schema_files = FileHandler::readDir($schema_dir);
172 172
 		$oDB = DB::getInstance();
173
-		if(is_array($schema_files))
173
+		if (is_array($schema_files))
174 174
 		{
175
-			foreach($schema_files as $file)
175
+			foreach ($schema_files as $file)
176 176
 			{
177 177
 				$filename_arr = explode(".", $file);
178 178
 				$filename = array_shift($filename_arr);
@@ -192,26 +192,26 @@  discard block
 block discarded – undo
192 192
 	function installModule()
193 193
 	{
194 194
 		$path = $this->package->path;
195
-		if($path != ".")
195
+		if ($path != ".")
196 196
 		{
197 197
 			$path_array = explode("/", $path);
198 198
 			$target_name = array_pop($path_array);
199 199
 			$type = substr(array_pop($path_array), 0, -1);
200 200
 		}
201 201
 
202
-		if($type == "module")
202
+		if ($type == "module")
203 203
 		{
204 204
 			$oModuleModel = getModel('module');
205 205
 			$oInstallController = getController('install');
206 206
 			$module_path = ModuleHandler::getModulePath($target_name);
207
-			if($oModuleModel->checkNeedInstall($target_name))
207
+			if ($oModuleModel->checkNeedInstall($target_name))
208 208
 			{
209 209
 				$oInstallController->installModule($target_name, $module_path);
210 210
 			}
211
-			if($oModuleModel->checkNeedUpdate($target_name))
211
+			if ($oModuleModel->checkNeedUpdate($target_name))
212 212
 			{
213 213
 				$oModule = getModule($target_name, 'class');
214
-				if(method_exists($oModule, 'moduleUpdate'))
214
+				if (method_exists($oModule, 'moduleUpdate'))
215 215
 				{
216 216
 					$oModule->moduleUpdate();
217 217
 				}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		$this->_download();
232 232
 		$file_list = $this->_unPack();
233 233
 		$output = $this->_copyDir($file_list);
234
-		if(!$output->toBool())
234
+		if (!$output->toBool())
235 235
 		{
236 236
 			FileHandler::removeDir($this->temp_dir);
237 237
 			return $output;
@@ -249,18 +249,18 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	function _unPack()
251 251
 	{
252
-		require_once(_XE_PATH_ . 'libs/tar.class.php');
252
+		require_once(_XE_PATH_.'libs/tar.class.php');
253 253
 
254 254
 		$oTar = new tar();
255 255
 		$oTar->openTAR($this->download_file);
256 256
 
257 257
 		$_files = $oTar->files;
258 258
 		$file_list = array();
259
-		if(is_array($_files))
259
+		if (is_array($_files))
260 260
 		{
261
-			foreach($_files as $key => $info)
261
+			foreach ($_files as $key => $info)
262 262
 			{
263
-				FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']);
263
+				FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
264 264
 				$file_list[] = $info['name'];
265 265
 			}
266 266
 		}
@@ -278,22 +278,22 @@  discard block
 block discarded – undo
278 278
 		$real_path = FileHandler::getRealPath($path);
279 279
 		$oDir = dir($path);
280 280
 		$files = array();
281
-		while($file = $oDir->read())
281
+		while ($file = $oDir->read())
282 282
 		{
283
-			if($file == "." || $file == "..")
283
+			if ($file == "." || $file == "..")
284 284
 			{
285 285
 				continue;
286 286
 			}
287 287
 			$files[] = $file;
288 288
 		}
289 289
 
290
-		foreach($files as $file)
290
+		foreach ($files as $file)
291 291
 		{
292
-			$file_path = $path . "/" . $file;
293
-			if(is_dir(FileHandler::getRealPath($file_path)))
292
+			$file_path = $path."/".$file;
293
+			if (is_dir(FileHandler::getRealPath($file_path)))
294 294
 			{
295 295
 				$output = $this->_removeDir($file_path);
296
-				if(!$output->toBool())
296
+				if (!$output->toBool())
297 297
 				{
298 298
 					return $output;
299 299
 				}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 			else
302 302
 			{
303 303
 				$output = $this->_removeFile($file_path);
304
-				if(!$output->toBool())
304
+				if (!$output->toBool())
305 305
 				{
306 306
 					return $output;
307 307
 				}
@@ -357,17 +357,17 @@  discard block
 block discarded – undo
357 357
 	 */
358 358
 	function _connect()
359 359
 	{
360
-		if(!function_exists('ssh2_connect'))
360
+		if (!function_exists('ssh2_connect'))
361 361
 		{
362 362
 			return new BaseObject(-1, 'msg_sftp_not_supported');
363 363
 		}
364 364
 
365
-		if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
365
+		if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y')
366 366
 		{
367 367
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
368 368
 		}
369 369
 
370
-		if($this->ftp_info->ftp_host)
370
+		if ($this->ftp_info->ftp_host)
371 371
 		{
372 372
 			$ftp_host = $this->ftp_info->ftp_host;
373 373
 		}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			$ftp_host = "127.0.0.1";
377 377
 		}
378 378
 		$this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port);
379
-		if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
379
+		if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password))
380 380
 		{
381 381
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
382 382
 		}
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	function _removeFile($path)
405 405
 	{
406
-		if(substr($path, 0, 2) == "./")
406
+		if (substr($path, 0, 2) == "./")
407 407
 		{
408 408
 			$path = substr($path, 2);
409 409
 		}
410
-		$target_path = $this->ftp_info->ftp_root_path . $path;
410
+		$target_path = $this->ftp_info->ftp_root_path.$path;
411 411
 
412
-		if(!@ssh2_sftp_unlink($this->sftp, $target_path))
412
+		if (!@ssh2_sftp_unlink($this->sftp, $target_path))
413 413
 		{
414 414
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
415 415
 		}
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	function _removeDir_real($path)
426 426
 	{
427
-		if(substr($path, 0, 2) == "./")
427
+		if (substr($path, 0, 2) == "./")
428 428
 		{
429 429
 			$path = substr($path, 2);
430 430
 		}
431
-		$target_path = $this->ftp_info->ftp_root_path . $path;
431
+		$target_path = $this->ftp_info->ftp_root_path.$path;
432 432
 
433
-		if(!@ssh2_sftp_rmdir($this->sftp, $target_path))
433
+		if (!@ssh2_sftp_rmdir($this->sftp, $target_path))
434 434
 		{
435 435
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
436 436
 		}
@@ -445,37 +445,37 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	function _copyDir(&$file_list)
447 447
 	{
448
-		if(!$this->ftp_password)
448
+		if (!$this->ftp_password)
449 449
 		{
450 450
 			return new BaseObject(-1, 'msg_ftp_password_input');
451 451
 		}
452 452
 
453 453
 		$output = $this->_connect();
454
-		if(!$output->toBool())
454
+		if (!$output->toBool())
455 455
 		{
456 456
 			return $output;
457 457
 		}
458
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
458
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
459 459
 		$copied = array();
460 460
 
461
-		if(is_array($file_list))
461
+		if (is_array($file_list))
462 462
 		{
463
-			foreach($file_list as $k => $file)
463
+			foreach ($file_list as $k => $file)
464 464
 			{
465 465
 				$org_file = $file;
466
-				if($this->package->path == ".")
466
+				if ($this->package->path == ".")
467 467
 				{
468 468
 					$file = substr($file, 3);
469 469
 				}
470
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
471
-				$pathname = dirname($target_dir . "/" . $file);
470
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
471
+				$pathname = dirname($target_dir."/".$file);
472 472
 
473
-				if(!file_exists(FileHandler::getRealPath($real_path)))
473
+				if (!file_exists(FileHandler::getRealPath($real_path)))
474 474
 				{
475 475
 					ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE);
476 476
 				}
477 477
 
478
-				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file);
478
+				ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
479 479
 				$copied[] = $path;
480 480
 			}
481 481
 		}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	function _connect()
528 528
 	{
529
-		if($this->ftp_info->ftp_host)
529
+		if ($this->ftp_info->ftp_host)
530 530
 		{
531 531
 			$ftp_host = $this->ftp_info->ftp_host;
532 532
 		}
@@ -536,20 +536,20 @@  discard block
 block discarded – undo
536 536
 		}
537 537
 
538 538
 		$this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port);
539
-		if(!$this->connection)
539
+		if (!$this->connection)
540 540
 		{
541 541
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
542 542
 		}
543 543
 
544 544
 		$login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password);
545
-		if(!$login_result)
545
+		if (!$login_result)
546 546
 		{
547 547
 			$this->_close();
548 548
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
549 549
 		}
550 550
 
551 551
 		$_SESSION['ftp_password'] = $this->ftp_password;
552
-		if($this->ftp_info->ftp_pasv != "N")
552
+		if ($this->ftp_info->ftp_pasv != "N")
553 553
 		{
554 554
 			ftp_pasv($this->connection, TRUE);
555 555
 		}
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 	 */
565 565
 	function _removeFile($path)
566 566
 	{
567
-		if(substr($path, 0, 2) == "./")
567
+		if (substr($path, 0, 2) == "./")
568 568
 		{
569 569
 			$path = substr($path, 2);
570 570
 		}
571
-		$target_path = $this->ftp_info->ftp_root_path . $path;
571
+		$target_path = $this->ftp_info->ftp_root_path.$path;
572 572
 
573
-		if(!@ftp_delete($this->connection, $target_path))
573
+		if (!@ftp_delete($this->connection, $target_path))
574 574
 		{
575
-			return new BaseObject(-1, "failed to delete file " . $path);
575
+			return new BaseObject(-1, "failed to delete file ".$path);
576 576
 		}
577 577
 		return new BaseObject();
578 578
 	}
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 	 */
586 586
 	function _removeDir_real($path)
587 587
 	{
588
-		if(substr($path, 0, 2) == "./")
588
+		if (substr($path, 0, 2) == "./")
589 589
 		{
590 590
 			$path = substr($path, 2);
591 591
 		}
592
-		$target_path = $this->ftp_info->ftp_root_path . $path;
592
+		$target_path = $this->ftp_info->ftp_root_path.$path;
593 593
 
594
-		if(!@ftp_rmdir($this->connection, $target_path))
594
+		if (!@ftp_rmdir($this->connection, $target_path))
595 595
 		{
596
-			return new BaseObject(-1, "failed to delete directory " . $path);
596
+			return new BaseObject(-1, "failed to delete directory ".$path);
597 597
 		}
598 598
 		return new BaseObject();
599 599
 	}
@@ -616,74 +616,74 @@  discard block
 block discarded – undo
616 616
 	 */
617 617
 	function _copyDir(&$file_list)
618 618
 	{
619
-		if(!$this->ftp_password)
619
+		if (!$this->ftp_password)
620 620
 		{
621 621
 			return new BaseObject(-1, 'msg_ftp_password_input');
622 622
 		}
623 623
 
624 624
 		$output = $this->_connect();
625
-		if(!$output->toBool())
625
+		if (!$output->toBool())
626 626
 		{
627 627
 			return $output;
628 628
 		}
629 629
 
630
-		if(!$this->target_path)
630
+		if (!$this->target_path)
631 631
 		{
632 632
 			$this->target_path = '.';
633 633
 		}
634
-		if(substr($this->download_path, -1) == '/')
634
+		if (substr($this->download_path, -1) == '/')
635 635
 		{
636 636
 			$this->download_path = substr($this->download_path, 0, -1);
637 637
 		}
638
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
638
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
639 639
 		$copied = array();
640 640
 
641
-		if(is_array($file_list))
641
+		if (is_array($file_list))
642 642
 		{
643
-			foreach($file_list as $k => $file)
643
+			foreach ($file_list as $k => $file)
644 644
 			{
645
-				if(!$file)
645
+				if (!$file)
646 646
 				{
647 647
 					continue;
648 648
 				}
649 649
 				$org_file = $file;
650
-				if($this->package->path == ".")
650
+				if ($this->package->path == ".")
651 651
 				{
652 652
 					$file = substr($file, 3);
653 653
 				}
654
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
655
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
654
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
655
+				$path_list = explode('/', dirname($this->target_path."/".$file));
656 656
 
657 657
 				$real_path = "./";
658 658
 				$ftp_path = $this->ftp_info->ftp_root_path;
659 659
 
660
-				for($i = 0; $i < count($path_list); $i++)
660
+				for ($i = 0; $i < count($path_list); $i++)
661 661
 				{
662
-					if($path_list == "")
662
+					if ($path_list == "")
663 663
 					{
664 664
 						continue;
665 665
 					}
666
-					$real_path .= $path_list[$i] . "/";
667
-					$ftp_path .= $path_list[$i] . "/";
668
-					if(!file_exists(FileHandler::getRealPath($real_path)))
666
+					$real_path .= $path_list[$i]."/";
667
+					$ftp_path .= $path_list[$i]."/";
668
+					if (!file_exists(FileHandler::getRealPath($real_path)))
669 669
 					{
670
-						if(!@ftp_mkdir($this->connection, $ftp_path))
670
+						if (!@ftp_mkdir($this->connection, $ftp_path))
671 671
 						{
672 672
 							return new BaseObject(-1, "msg_make_directory_failed");
673 673
 						}
674 674
 
675
-						if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
675
+						if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')
676 676
 						{
677
-							if(function_exists('ftp_chmod'))
677
+							if (function_exists('ftp_chmod'))
678 678
 							{
679
-								if(!ftp_chmod($this->connection, 0755, $ftp_path))
679
+								if (!ftp_chmod($this->connection, 0755, $ftp_path))
680 680
 								{
681 681
 									return new BaseObject(-1, "msg_permission_adjust_failed");
682 682
 								}
683 683
 							}
684 684
 							else
685 685
 							{
686
-								if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path))
686
+								if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path))
687 687
 								{
688 688
 									return new BaseObject(-1, "msg_permission_adjust_failed");
689 689
 								}
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 						}
692 692
 					}
693 693
 				}
694
-				if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY))
694
+				if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY))
695 695
 				{
696 696
 					return new BaseObject(-1, "msg_ftp_upload_failed");
697 697
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	function _connect()
747 747
 	{
748
-		if($this->ftp_info->ftp_host)
748
+		if ($this->ftp_info->ftp_host)
749 749
 		{
750 750
 			$ftp_host = $this->ftp_info->ftp_host;
751 751
 		}
@@ -755,11 +755,11 @@  discard block
 block discarded – undo
755 755
 		}
756 756
 
757 757
 		$this->oFtp = new ftp();
758
-		if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
758
+		if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port))
759 759
 		{
760 760
 			return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host'));
761 761
 		}
762
-		if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
762
+		if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password))
763 763
 		{
764 764
 			$this->_close();
765 765
 			return new BaseObject(-1, 'msg_ftp_invalid_auth_info');
@@ -776,13 +776,13 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	function _removeFile($path)
778 778
 	{
779
-		if(substr($path, 0, 2) == "./")
779
+		if (substr($path, 0, 2) == "./")
780 780
 		{
781 781
 			$path = substr($path, 2);
782 782
 		}
783
-		$target_path = $this->ftp_info->ftp_root_path . $path;
783
+		$target_path = $this->ftp_info->ftp_root_path.$path;
784 784
 
785
-		if(!$this->oFtp->ftp_delete($target_path))
785
+		if (!$this->oFtp->ftp_delete($target_path))
786 786
 		{
787 787
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
788 788
 		}
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	function _removeDir_real($path)
798 798
 	{
799
-		if(substr($path, 0, 2) == "./")
799
+		if (substr($path, 0, 2) == "./")
800 800
 		{
801 801
 			$path = substr($path, 2);
802 802
 		}
803
-		$target_path = $this->ftp_info->ftp_root_path . $path;
803
+		$target_path = $this->ftp_info->ftp_root_path.$path;
804 804
 
805
-		if(!$this->oFtp->ftp_rmdir($target_path))
805
+		if (!$this->oFtp->ftp_rmdir($target_path))
806 806
 		{
807 807
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path));
808 808
 		}
@@ -827,52 +827,52 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	function _copyDir(&$file_list)
829 829
 	{
830
-		if(!$this->ftp_password)
830
+		if (!$this->ftp_password)
831 831
 		{
832 832
 			return new BaseObject(-1, 'msg_ftp_password_input');
833 833
 		}
834 834
 
835 835
 		$output = $this->_connect();
836
-		if(!$output->toBool())
836
+		if (!$output->toBool())
837 837
 		{
838 838
 			return $output;
839 839
 		}
840 840
 
841 841
 		$oFtp = &$this->oFtp;
842
-		$target_dir = $this->ftp_info->ftp_root_path . $this->target_path;
842
+		$target_dir = $this->ftp_info->ftp_root_path.$this->target_path;
843 843
 
844 844
 		$copied = array();
845 845
 
846
-		if(is_array($file_list))
846
+		if (is_array($file_list))
847 847
 		{
848
-			foreach($file_list as $k => $file)
848
+			foreach ($file_list as $k => $file)
849 849
 			{
850 850
 				$org_file = $file;
851
-				if($this->package->path == ".")
851
+				if ($this->package->path == ".")
852 852
 				{
853 853
 					$file = substr($file, 3);
854 854
 				}
855
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
856
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
855
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
856
+				$path_list = explode('/', dirname($this->target_path."/".$file));
857 857
 
858 858
 				$real_path = "./";
859 859
 				$ftp_path = $this->ftp_info->ftp_root_path;
860 860
 
861
-				for($i = 0; $i < count($path_list); $i++)
861
+				for ($i = 0; $i < count($path_list); $i++)
862 862
 				{
863
-					if($path_list == "")
863
+					if ($path_list == "")
864 864
 					{
865 865
 						continue;
866 866
 					}
867
-					$real_path .= $path_list[$i] . "/";
868
-					$ftp_path .= $path_list[$i] . "/";
869
-					if(!file_exists(FileHandler::getRealPath($real_path)))
867
+					$real_path .= $path_list[$i]."/";
868
+					$ftp_path .= $path_list[$i]."/";
869
+					if (!file_exists(FileHandler::getRealPath($real_path)))
870 870
 					{
871 871
 						$oFtp->ftp_mkdir($ftp_path);
872
-						$oFtp->ftp_site("CHMOD 755 " . $ftp_path);
872
+						$oFtp->ftp_site("CHMOD 755 ".$ftp_path);
873 873
 					}
874 874
 				}
875
-				$oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file));
875
+				$oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file));
876 876
 				$copied[] = $path;
877 877
 			}
878 878
 		}
@@ -921,13 +921,13 @@  discard block
 block discarded – undo
921 921
 	 */
922 922
 	function _removeFile($path)
923 923
 	{
924
-		if(substr($path, 0, 2) == "./")
924
+		if (substr($path, 0, 2) == "./")
925 925
 		{
926 926
 			$path = substr($path, 2);
927 927
 		}
928 928
 		$target_path = FileHandler::getRealPath($path);
929 929
 
930
-		if(!FileHandler::removeFile($target_path))
930
+		if (!FileHandler::removeFile($target_path))
931 931
 		{
932 932
 			return new BaseObject(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path));
933 933
 		}
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	 */
942 942
 	function _removeDir_real($path)
943 943
 	{
944
-		if(substr($path, 0, 2) == "./")
944
+		if (substr($path, 0, 2) == "./")
945 945
 		{
946 946
 			$path = substr($path, 2);
947 947
 		}
@@ -970,39 +970,39 @@  discard block
 block discarded – undo
970 970
 	function _copyDir(&$file_list)
971 971
 	{
972 972
 		$output = $this->_connect();
973
-		if(!$output->toBool())
973
+		if (!$output->toBool())
974 974
 		{
975 975
 			return $output;
976 976
 		}
977 977
 		$target_dir = $this->target_path;
978 978
 		$copied = array();
979 979
 
980
-		if(is_array($file_list))
980
+		if (is_array($file_list))
981 981
 		{
982
-			foreach($file_list as $k => $file)
982
+			foreach ($file_list as $k => $file)
983 983
 			{
984 984
 				$org_file = $file;
985
-				if($this->package->path == ".")
985
+				if ($this->package->path == ".")
986 986
 				{
987 987
 					$file = substr($file, 3);
988 988
 				}
989
-				$path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file);
990
-				$path_list = explode('/', dirname($this->target_path . "/" . $file));
989
+				$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
990
+				$path_list = explode('/', dirname($this->target_path."/".$file));
991 991
 				$real_path = "./";
992 992
 
993
-				for($i = 0; $i < count($path_list); $i++)
993
+				for ($i = 0; $i < count($path_list); $i++)
994 994
 				{
995
-					if($path_list == "")
995
+					if ($path_list == "")
996 996
 					{
997 997
 						continue;
998 998
 					}
999
-					$real_path .= $path_list[$i] . "/";
1000
-					if(!file_exists(FileHandler::getRealPath($real_path)))
999
+					$real_path .= $path_list[$i]."/";
1000
+					if (!file_exists(FileHandler::getRealPath($real_path)))
1001 1001
 					{
1002 1002
 						FileHandler::makeDir($real_path);
1003 1003
 					}
1004 1004
 				}
1005
-				FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file));
1005
+				FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file));
1006 1006
 				$copied[] = $path;
1007 1007
 			}
1008 1008
 		}
Please login to merge, or discard this patch.
modules/addon/addon.admin.controller.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/addon/addon.controller.php');
4
+require_once(_XE_PATH_.'modules/addon/addon.controller.php');
5 5
 
6 6
 /**
7 7
  * Admin controller class of addon modules
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$site_module_info = Context::get('site_module_info');
35 35
 
36
-		if($site_module_info->site_srl)
36
+		if ($site_module_info->site_srl)
37 37
 		{
38 38
 			$site_srl = $site_module_info->site_srl;
39 39
 		}
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
 			$site_srl = 0;
43 43
 		}
44 44
 
45
-		if(!$pcOnList)
45
+		if (!$pcOnList)
46 46
 		{
47 47
 			$pcOnList = array();
48 48
 		}
49
-		if(!$mobileOnList)
49
+		if (!$mobileOnList)
50 50
 		{
51 51
 			$mobileOnList = array();
52 52
 		}
53
-		if(!$fixed)
53
+		if (!$fixed)
54 54
 		{
55 55
 			$fixed = array();
56 56
 		}
57 57
 
58
-		if(!is_array($pcOnList))
58
+		if (!is_array($pcOnList))
59 59
 		{
60 60
 			$pcOnList = array($pcOnList);
61 61
 		}
62
-		if(!is_array($mobileOnList))
62
+		if (!is_array($mobileOnList))
63 63
 		{
64 64
 			$pcOnList = array($mobileOnList);
65 65
 		}
66
-		if(!is_array($fixed))
66
+		if (!is_array($fixed))
67 67
 		{
68 68
 			$pcOnList = array($fixed);
69 69
 		}
@@ -74,21 +74,21 @@  discard block
 block discarded – undo
74 74
 
75 75
 		// get need update addon list
76 76
 		$updateList = array();
77
-		foreach($currentAddonList as $addon)
77
+		foreach ($currentAddonList as $addon)
78 78
 		{
79
-			if($addon->activated !== in_array($addon->addon_name, $pcOnList))
79
+			if ($addon->activated !== in_array($addon->addon_name, $pcOnList))
80 80
 			{
81 81
 				$updateList[] = $addon->addon_name;
82 82
 				continue;
83 83
 			}
84 84
 
85
-			if($addon->mactivated !== in_array($addon->addon_name, $mobileOnList))
85
+			if ($addon->mactivated !== in_array($addon->addon_name, $mobileOnList))
86 86
 			{
87 87
 				$updateList[] = $addon->addon_name;
88 88
 				continue;
89 89
 			}
90 90
 
91
-			if($addon->fixed !== in_array($addon->addon_name, $fixed))
91
+			if ($addon->fixed !== in_array($addon->addon_name, $fixed))
92 92
 			{
93 93
 				$updateList[] = $addon->addon_name;
94 94
 				continue;
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
 		}
97 97
 
98 98
 		// update
99
-		foreach($updateList as $targetAddon)
99
+		foreach ($updateList as $targetAddon)
100 100
 		{
101 101
 			$args = new stdClass();
102 102
 
103
-			if(in_array($targetAddon, $pcOnList))
103
+			if (in_array($targetAddon, $pcOnList))
104 104
 			{
105 105
 				$args->is_used = 'Y';
106 106
 			}
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				$args->is_used = 'N';
110 110
 			}
111 111
 
112
-			if(in_array($targetAddon, $mobileOnList))
112
+			if (in_array($targetAddon, $mobileOnList))
113 113
 			{
114 114
 				$args->is_used_m = 'Y';
115 115
 			}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 				$args->is_used_m = 'N';
119 119
 			}
120 120
 
121
-			if(in_array($targetAddon, $fixed))
121
+			if (in_array($targetAddon, $fixed))
122 122
 			{
123 123
 				$args->fixed = 'Y';
124 124
 			}
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
 			$args->site_srl = $site_srl;
132 132
 
133 133
 			$output = executeQuery('addon.updateSiteAddon', $args);
134
-			if(!$output->toBool())
134
+			if (!$output->toBool())
135 135
 			{
136 136
 				return $output;
137 137
 			}
138 138
 		}
139 139
 
140
-		if(count($updateList))
140
+		if (count($updateList))
141 141
 		{
142 142
 			$this->makeCacheFile($site_srl, 'pc', 'site');
143 143
 			$this->makeCacheFile($site_srl, 'mobile', 'site');
144 144
 		}
145 145
 
146 146
 		$this->setMessage('success_updated', 'info');
147
-		if(Context::get('success_return_url'))
147
+		if (Context::get('success_return_url'))
148 148
 		{
149 149
 			$this->setRedirectUrl(Context::get('success_return_url'));
150 150
 		}
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 		// batahom addon values
168 168
 		$addon = Context::get('addon');
169 169
 		$type = Context::get('type');
170
-		if(!$type)
170
+		if (!$type)
171 171
 		{
172 172
 			$type = "pc";
173 173
 		}
174
-		if($addon)
174
+		if ($addon)
175 175
 		{
176 176
 			// If enabled Disables
177
-			if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type))
177
+			if ($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type))
178 178
 			{
179 179
 				$this->doDeactivate($addon, $site_module_info->site_srl, $type);
180 180
 			}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		$site_module_info = Context::get('site_module_info');
208 208
 
209 209
 		$output = $this->doSetup($addon_name, $args, $site_module_info->site_srl, 'site');
210
-		if(!$output->toBool())
210
+		if (!$output->toBool())
211 211
 		{
212 212
 			return $output;
213 213
 		}
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		$args = new stdClass;
233 233
 		$args->addon = $addon;
234 234
 		$args->is_used = $isUsed;
235
-		if($gtype == 'global')
235
+		if ($gtype == 'global')
236 236
 		{
237 237
 			return executeQuery('addon.insertAddon', $args);
238 238
 		}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	{
254 254
 		$args = new stdClass();
255 255
 		$args->addon = $addon;
256
-		if($type == "pc")
256
+		if ($type == "pc")
257 257
 		{
258 258
 			$args->is_used = 'Y';
259 259
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		{
262 262
 			$args->is_used_m = "Y";
263 263
 		}
264
-		if($gtype == 'global')
264
+		if ($gtype == 'global')
265 265
 		{
266 266
 			return executeQuery('addon.updateAddon', $args);
267 267
 		}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	{
282 282
 		$args = new stdClass();
283 283
 		$args->addon = $addon;
284
-		if($type == "pc")
284
+		if ($type == "pc")
285 285
 		{
286 286
 			$args->is_used = 'N';
287 287
 		}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 		{
290 290
 			$args->is_used_m = 'N';
291 291
 		}
292
-		if($gtype == 'global')
292
+		if ($gtype == 'global')
293 293
 		{
294 294
 			return executeQuery('addon.updateAddon', $args);
295 295
 		}
Please login to merge, or discard this patch.
modules/communication/communication.mobile.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* Copyright (C) XEHub <https://www.xpressengine.com> */
3 3
 
4
-require_once(_XE_PATH_ . 'modules/communication/communication.view.php');
4
+require_once(_XE_PATH_.'modules/communication/communication.view.php');
5 5
 
6 6
 /**
7 7
  * @class  communicationMobile
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 		$oLayoutModel = getModel('layout');
27 27
 		$layout_info = $oLayoutModel->getLayout($this->communication_config->mlayout_srl);
28
-		if($layout_info)
28
+		if ($layout_info)
29 29
 		{
30 30
 			$this->module_info->mlayout_srl = $this->communication_config->mlayout_srl;
31 31
 			$this->setLayoutPath($layout_info->path);
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	function dispCommunicationMessages()
40 40
 	{
41 41
 		// Error appears if not logged-in
42
-		if(!Context::get('is_logged'))
42
+		if (!Context::get('is_logged'))
43 43
 		{
44 44
 			return $this->stop('msg_not_logged');
45 45
 		}
46 46
 
47 47
 		$logged_info = Context::get('logged_info');
48
-		if(!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
48
+		if (!array_key_exists('dispCommunicationMessages', $logged_info->menu_list))
49 49
 		{
50 50
 			return $this->stop('msg_invalid_request');
51 51
 		}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		// Set the variables
54 54
 		$message_srl = Context::get('message_srl');
55 55
 		$message_type = Context::get('message_type');
56
-		if(!in_array($message_type, array('R', 'S', 'T')))
56
+		if (!in_array($message_type, array('R', 'S', 'T')))
57 57
 		{
58 58
 			$message_type = 'R';
59 59
 			Context::set('message_type', $message_type);
@@ -61,37 +61,37 @@  discard block
 block discarded – undo
61 61
 		$oCommunicationModel = getModel('communication');
62 62
 
63 63
 		// extract contents if message_srl exists
64
-		if($message_srl)
64
+		if ($message_srl)
65 65
 		{
66 66
 			$templateFile = 'read_message';
67 67
 			$columnList = array('message_srl', 'sender_srl', 'receiver_srl', 'message_type', 'title', 'content', 'readed', 'regdate');
68 68
 			$message = $oCommunicationModel->getSelectedMessage($message_srl, $columnList);
69 69
 
70
-			switch($message->message_type)
70
+			switch ($message->message_type)
71 71
 			{
72 72
 				case 'R':
73
-					if($message->receiver_srl != $logged_info->member_srl)
73
+					if ($message->receiver_srl != $logged_info->member_srl)
74 74
 					{
75 75
 						return $this->stop('msg_invalid_request');
76 76
 					}
77 77
 					break;
78 78
 
79 79
 				case 'S':
80
-					if($message->sender_srl != $logged_info->member_srl)
80
+					if ($message->sender_srl != $logged_info->member_srl)
81 81
 					{
82 82
 						return $this->stop('msg_invalid_request');
83 83
 					}
84 84
 					break;
85 85
 
86 86
 				case 'T':
87
-					if($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
87
+					if ($message->receiver_srl != $logged_info->member_srl && $message->sender_srl != $logged_info->member_srl)
88 88
 					{
89 89
 						return $this->stop('msg_invalid_request');
90 90
 					}
91 91
 					break;
92 92
 			}
93 93
 
94
-			if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
94
+			if ($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl))
95 95
 			{
96 96
 				stripEmbedTagForAdmin($message->content, $message->sender_srl);
97 97
 				Context::set('message', $message);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 		$oMemberModel = getModel('member');
139 139
 
140 140
 		// Error appears if not logged-in
141
-		if(!Context::get('is_logged'))
141
+		if (!Context::get('is_logged'))
142 142
 		{
143 143
 			return $this->stop('msg_not_logged');
144 144
 		}
@@ -148,32 +148,32 @@  discard block
 block discarded – undo
148 148
 		// get receipient's information
149 149
 		// check inalid request
150 150
 		$receiver_srl = Context::get('receiver_srl');
151
-		if(!$receiver_srl)
151
+		if (!$receiver_srl)
152 152
 		{
153 153
 			return $this->stop('msg_invalid_request');
154 154
 		}
155 155
 
156 156
 		// check receiver and sender are same
157
-		if($logged_info->member_srl == $receiver_srl)
157
+		if ($logged_info->member_srl == $receiver_srl)
158 158
 		{
159 159
 			return $this->stop('msg_cannot_send_to_yourself');
160 160
 		}
161 161
 
162 162
 		// get message_srl of the original message if it is a reply
163 163
 		$message_srl = Context::get('message_srl');
164
-		if($message_srl)
164
+		if ($message_srl)
165 165
 		{
166 166
 			$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
167
-			if($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
167
+			if ($source_message->message_srl == $message_srl && $source_message->sender_srl == $receiver_srl)
168 168
 			{
169
-				$source_message->title = "[re] " . $source_message->title;
170
-				$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">" . trim($source_message->content) . "</div>";
169
+				$source_message->title = "[re] ".$source_message->title;
170
+				$source_message->content = "\r\n<br />\r\n<br /><div style=\"padding-left:5px; border-left:5px solid #DDDDDD;\">".trim($source_message->content)."</div>";
171 171
 				Context::set('source_message', $source_message);
172 172
 			}
173 173
 		}
174 174
 
175 175
 		$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
176
-		if(!$receiver_info)
176
+		if (!$receiver_info)
177 177
 		{
178 178
 			return $this->stop('msg_invalid_request');
179 179
 		}
Please login to merge, or discard this patch.