@@ -393,7 +393,7 @@ |
||
393 | 393 | * Arrage css index |
394 | 394 | * |
395 | 395 | * @param string $dirName First directory name of css path |
396 | - * @param array $file file info. |
|
396 | + * @param stdClass $file file info. |
|
397 | 397 | * @return void |
398 | 398 | */ |
399 | 399 | function _arrangeCssIndex($dirName, &$file) |
@@ -50,7 +50,7 @@ |
||
50 | 50 | * Check SSL |
51 | 51 | * |
52 | 52 | * @return bool If using ssl returns true, otherwise returns false. |
53 | - * @deprecated |
|
53 | + * @deprecated |
|
54 | 54 | */ |
55 | 55 | function isSsl() |
56 | 56 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function isSsl() |
56 | 56 | { |
57 | - if(!is_null(self::$isSSL)) |
|
57 | + if (!is_null(self::$isSSL)) |
|
58 | 58 | { |
59 | 59 | return self::$isSSL; |
60 | 60 | } |
@@ -88,30 +88,30 @@ discard block |
||
88 | 88 | * */ |
89 | 89 | function loadFile($args) |
90 | 90 | { |
91 | - if(!is_array($args)) |
|
91 | + if (!is_array($args)) |
|
92 | 92 | { |
93 | 93 | $args = array($args); |
94 | 94 | } |
95 | 95 | $file = $this->getFileInfo($args[0], $args[2], $args[1]); |
96 | 96 | |
97 | 97 | $availableExtension = array('css' => 1, 'js' => 1); |
98 | - if(!isset($availableExtension[$file->fileExtension])) |
|
98 | + if (!isset($availableExtension[$file->fileExtension])) |
|
99 | 99 | { |
100 | 100 | return; |
101 | 101 | } |
102 | 102 | |
103 | 103 | $file->index = (int) $args[3]; |
104 | 104 | |
105 | - if($file->fileExtension == 'css') |
|
105 | + if ($file->fileExtension == 'css') |
|
106 | 106 | { |
107 | 107 | $map = &$this->cssMap; |
108 | 108 | $mapIndex = &$this->cssMapIndex; |
109 | 109 | |
110 | 110 | $this->_arrangeCssIndex($pathInfo['dirname'], $file); |
111 | 111 | } |
112 | - else if($file->fileExtension == 'js') |
|
112 | + else if ($file->fileExtension == 'js') |
|
113 | 113 | { |
114 | - if($args[1] == 'body') |
|
114 | + if ($args[1] == 'body') |
|
115 | 115 | { |
116 | 116 | $map = &$this->jsBodyMap; |
117 | 117 | $mapIndex = &$this->jsBodyMapIndex; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | (is_null($file->index)) ? $file->index = 0 : $file->index = $file->index; |
127 | - if(!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index) |
|
127 | + if (!isset($mapIndex[$file->key]) || $mapIndex[$file->key] > $file->index) |
|
128 | 128 | { |
129 | 129 | $this->unloadFile($args[0], $args[2], $args[1]); |
130 | 130 | $map[$file->index][$file->key] = $file; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | { |
145 | 145 | static $existsInfo = array(); |
146 | 146 | |
147 | - if(isset($existsInfo[$existsKey])) |
|
147 | + if (isset($existsInfo[$existsKey])) |
|
148 | 148 | { |
149 | 149 | return $existsInfo[$existsKey]; |
150 | 150 | } |
@@ -159,14 +159,14 @@ discard block |
||
159 | 159 | $file->keyName = implode('.', array($file->fileNameNoExt, $file->fileExtension)); |
160 | 160 | $file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']); |
161 | 161 | |
162 | - if(strpos($file->filePath, '://') === FALSE) |
|
162 | + if (strpos($file->filePath, '://') === FALSE) |
|
163 | 163 | { |
164 | - if(!__DEBUG__ && __XE_VERSION_STABLE__) |
|
164 | + if (!__DEBUG__ && __XE_VERSION_STABLE__) |
|
165 | 165 | { |
166 | 166 | // if no debug mode, load minifed file |
167 | 167 | $minifiedFileName = implode('.', array($file->fileNameNoExt, 'min', $file->fileExtension)); |
168 | 168 | $minifiedRealPath = implode('/', array($file->fileRealPath, $minifiedFileName)); |
169 | - if(file_exists($minifiedRealPath)) |
|
169 | + if (file_exists($minifiedRealPath)) |
|
170 | 170 | { |
171 | 171 | $file->fileName = $minifiedFileName; |
172 | 172 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | else |
175 | 175 | { |
176 | 176 | // Remove .min |
177 | - if(file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
|
177 | + if (file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
|
178 | 178 | { |
179 | 179 | $file->fileName = $file->keyName; |
180 | 180 | } |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | |
184 | 184 | $file->targetIe = $targetIe; |
185 | 185 | |
186 | - if($file->fileExtension == 'css') |
|
186 | + if ($file->fileExtension == 'css') |
|
187 | 187 | { |
188 | 188 | $file->media = $media; |
189 | - if(!$file->media) |
|
189 | + if (!$file->media) |
|
190 | 190 | { |
191 | 191 | $file->media = 'all'; |
192 | 192 | } |
193 | 193 | $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media; |
194 | 194 | } |
195 | - else if($file->fileExtension == 'js') |
|
195 | + else if ($file->fileExtension == 'js') |
|
196 | 196 | { |
197 | 197 | $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe; |
198 | 198 | } |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | { |
213 | 213 | $file = $this->getFileInfo($fileName, $targetIe, $media); |
214 | 214 | |
215 | - if($file->fileExtension == 'css') |
|
215 | + if ($file->fileExtension == 'css') |
|
216 | 216 | { |
217 | - if(isset($this->cssMapIndex[$file->key])) |
|
217 | + if (isset($this->cssMapIndex[$file->key])) |
|
218 | 218 | { |
219 | 219 | $index = $this->cssMapIndex[$file->key]; |
220 | 220 | unset($this->cssMap[$index][$file->key], $this->cssMapIndex[$file->key]); |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | } |
223 | 223 | else |
224 | 224 | { |
225 | - if(isset($this->jsHeadMapIndex[$file->key])) |
|
225 | + if (isset($this->jsHeadMapIndex[$file->key])) |
|
226 | 226 | { |
227 | 227 | $index = $this->jsHeadMapIndex[$file->key]; |
228 | 228 | unset($this->jsHeadMap[$index][$file->key], $this->jsHeadMapIndex[$file->key]); |
229 | 229 | } |
230 | - if(isset($this->jsBodyMapIndex[$file->key])) |
|
230 | + if (isset($this->jsBodyMapIndex[$file->key])) |
|
231 | 231 | { |
232 | 232 | $index = $this->jsBodyMapIndex[$file->key]; |
233 | 233 | unset($this->jsBodyMap[$index][$file->key], $this->jsBodyMapIndex[$file->key]); |
@@ -243,13 +243,13 @@ discard block |
||
243 | 243 | */ |
244 | 244 | function unloadAllFiles($type = 'all') |
245 | 245 | { |
246 | - if($type == 'css' || $type == 'all') |
|
246 | + if ($type == 'css' || $type == 'all') |
|
247 | 247 | { |
248 | 248 | $this->cssMap = array(); |
249 | 249 | $this->cssMapIndex = array(); |
250 | 250 | } |
251 | 251 | |
252 | - if($type == 'js' || $type == 'all') |
|
252 | + if ($type == 'js' || $type == 'all') |
|
253 | 253 | { |
254 | 254 | $this->jsHeadMap = array(); |
255 | 255 | $this->jsBodyMap = array(); |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | $this->_sortMap($map, $mapIndex); |
272 | 272 | |
273 | 273 | $result = array(); |
274 | - foreach($map as $indexedMap) |
|
274 | + foreach ($map as $indexedMap) |
|
275 | 275 | { |
276 | - foreach($indexedMap as $file) |
|
276 | + foreach ($indexedMap as $file) |
|
277 | 277 | { |
278 | 278 | $noneCache = (is_readable($file->cdnPath . '/' . $file->fileName)) ? '?' . date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)) : ''; |
279 | 279 | $fullFilePath = $file->filePath . '/' . $file->fileName . $noneCache; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | function getJsFileList($type = 'head') |
295 | 295 | { |
296 | - if($type == 'head') |
|
296 | + if ($type == 'head') |
|
297 | 297 | { |
298 | 298 | $map = &$this->jsHeadMap; |
299 | 299 | $mapIndex = &$this->jsHeadMapIndex; |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | $this->_sortMap($map, $mapIndex); |
308 | 308 | |
309 | 309 | $result = array(); |
310 | - foreach($map as $indexedMap) |
|
310 | + foreach ($map as $indexedMap) |
|
311 | 311 | { |
312 | - foreach($indexedMap as $file) |
|
312 | + foreach ($indexedMap as $file) |
|
313 | 313 | { |
314 | 314 | $noneCache = (is_readable($file->cdnPath . '/' . $file->fileName)) ? '?' . date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)) : ''; |
315 | 315 | $fullFilePath = $file->filePath . '/' . $file->fileName . $noneCache; |
@@ -341,18 +341,18 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function _normalizeFilePath($path) |
343 | 343 | { |
344 | - if(strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
|
344 | + if (strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
|
345 | 345 | { |
346 | 346 | $path = './' . $path; |
347 | 347 | } |
348 | - elseif(!strncmp($path, '//', 2)) |
|
348 | + elseif (!strncmp($path, '//', 2)) |
|
349 | 349 | { |
350 | 350 | return preg_replace('#^//+#', '//', $path); |
351 | 351 | } |
352 | 352 | |
353 | 353 | $path = preg_replace('@/\./|(?<!:)\/\/@', '/', $path); |
354 | 354 | |
355 | - while(strpos($path, '/../')) |
|
355 | + while (strpos($path, '/../')) |
|
356 | 356 | { |
357 | 357 | $path = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $path, 1); |
358 | 358 | } |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | { |
371 | 371 | $path = $this->_normalizeFilePath($path); |
372 | 372 | |
373 | - if(strpos($path, './') === 0) |
|
373 | + if (strpos($path, './') === 0) |
|
374 | 374 | { |
375 | - if(dirname($_SERVER['SCRIPT_NAME']) == '/' || dirname($_SERVER['SCRIPT_NAME']) == '\\') |
|
375 | + if (dirname($_SERVER['SCRIPT_NAME']) == '/' || dirname($_SERVER['SCRIPT_NAME']) == '\\') |
|
376 | 376 | { |
377 | 377 | $path = '/' . substr($path, 2); |
378 | 378 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $path = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($path, 2); |
382 | 382 | } |
383 | 383 | } |
384 | - else if(strpos($file, '../') === 0) |
|
384 | + else if (strpos($file, '../') === 0) |
|
385 | 385 | { |
386 | 386 | $path = $this->_normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$path}"); |
387 | 387 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function _arrangeCssIndex($dirName, &$file) |
400 | 400 | { |
401 | - if($file->index !== 0) |
|
401 | + if ($file->index !== 0) |
|
402 | 402 | { |
403 | 403 | return; |
404 | 404 | } |
@@ -108,15 +108,13 @@ discard block |
||
108 | 108 | $mapIndex = &$this->cssMapIndex; |
109 | 109 | |
110 | 110 | $this->_arrangeCssIndex($pathInfo['dirname'], $file); |
111 | - } |
|
112 | - else if($file->fileExtension == 'js') |
|
111 | + } else if($file->fileExtension == 'js') |
|
113 | 112 | { |
114 | 113 | if($args[1] == 'body') |
115 | 114 | { |
116 | 115 | $map = &$this->jsBodyMap; |
117 | 116 | $mapIndex = &$this->jsBodyMapIndex; |
118 | - } |
|
119 | - else |
|
117 | + } else |
|
120 | 118 | { |
121 | 119 | $map = &$this->jsHeadMap; |
122 | 120 | $mapIndex = &$this->jsHeadMapIndex; |
@@ -170,8 +168,7 @@ discard block |
||
170 | 168 | { |
171 | 169 | $file->fileName = $minifiedFileName; |
172 | 170 | } |
173 | - } |
|
174 | - else |
|
171 | + } else |
|
175 | 172 | { |
176 | 173 | // Remove .min |
177 | 174 | if(file_exists(implode('/', array($file->fileRealPath, $file->keyName)))) |
@@ -191,8 +188,7 @@ discard block |
||
191 | 188 | $file->media = 'all'; |
192 | 189 | } |
193 | 190 | $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media; |
194 | - } |
|
195 | - else if($file->fileExtension == 'js') |
|
191 | + } else if($file->fileExtension == 'js') |
|
196 | 192 | { |
197 | 193 | $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe; |
198 | 194 | } |
@@ -219,8 +215,7 @@ discard block |
||
219 | 215 | $index = $this->cssMapIndex[$file->key]; |
220 | 216 | unset($this->cssMap[$index][$file->key], $this->cssMapIndex[$file->key]); |
221 | 217 | } |
222 | - } |
|
223 | - else |
|
218 | + } else |
|
224 | 219 | { |
225 | 220 | if(isset($this->jsHeadMapIndex[$file->key])) |
226 | 221 | { |
@@ -297,8 +292,7 @@ discard block |
||
297 | 292 | { |
298 | 293 | $map = &$this->jsHeadMap; |
299 | 294 | $mapIndex = &$this->jsHeadMapIndex; |
300 | - } |
|
301 | - else |
|
295 | + } else |
|
302 | 296 | { |
303 | 297 | $map = &$this->jsBodyMap; |
304 | 298 | $mapIndex = &$this->jsBodyMapIndex; |
@@ -344,8 +338,7 @@ discard block |
||
344 | 338 | if(strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.') |
345 | 339 | { |
346 | 340 | $path = './' . $path; |
347 | - } |
|
348 | - elseif(!strncmp($path, '//', 2)) |
|
341 | + } elseif(!strncmp($path, '//', 2)) |
|
349 | 342 | { |
350 | 343 | return preg_replace('#^//+#', '//', $path); |
351 | 344 | } |
@@ -375,13 +368,11 @@ discard block |
||
375 | 368 | if(dirname($_SERVER['SCRIPT_NAME']) == '/' || dirname($_SERVER['SCRIPT_NAME']) == '\\') |
376 | 369 | { |
377 | 370 | $path = '/' . substr($path, 2); |
378 | - } |
|
379 | - else |
|
371 | + } else |
|
380 | 372 | { |
381 | 373 | $path = dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($path, 2); |
382 | 374 | } |
383 | - } |
|
384 | - else if(strpos($file, '../') === 0) |
|
375 | + } else if(strpos($file, '../') === 0) |
|
385 | 376 | { |
386 | 377 | $path = $this->_normalizeFilePath(dirname($_SERVER['SCRIPT_NAME']) . "/{$path}"); |
387 | 378 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Mether to add key/value pair to the HTTP request header |
54 | - * @param int|string $key HTTP header element |
|
54 | + * @param string $key HTTP header element |
|
55 | 55 | * @param string $value value string for HTTP header element |
56 | 56 | * @return void |
57 | 57 | */ |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * constructor |
42 | 42 | * @return void |
43 | 43 | */ |
44 | - function XEHttpRequest($host, $port, $scheme='') |
|
44 | + function XEHttpRequest($host, $port, $scheme = '') |
|
45 | 45 | { |
46 | 46 | $this->m_host = $host; |
47 | 47 | $this->m_port = $port; |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $this->addToHeader('Connection', 'close'); |
77 | 77 | |
78 | 78 | $method = strtoupper($method); |
79 | - if(!$allow_methods) |
|
79 | + if (!$allow_methods) |
|
80 | 80 | { |
81 | 81 | $allow_methods = explode(' ', 'GET POST PUT'); |
82 | 82 | } |
83 | - if(!in_array($method, $allow_methods)) |
|
83 | + if (!in_array($method, $allow_methods)) |
|
84 | 84 | { |
85 | 85 | $method = $allow_methods[0]; |
86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
89 | 89 | $timout = max((int) $timeout, 0); |
90 | 90 | |
91 | 91 | // list of post variables |
92 | - if(!is_array($post_vars)) |
|
92 | + if (!is_array($post_vars)) |
|
93 | 93 | { |
94 | 94 | $post_vars = array(); |
95 | 95 | } |
96 | 96 | |
97 | - if(FALSE && is_callable('curl_init')) |
|
97 | + if (FALSE && is_callable('curl_init')) |
|
98 | 98 | { |
99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
100 | 100 | } |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | static $crlf = "\r\n"; |
118 | 118 | |
119 | 119 | $scheme = ''; |
120 | - if($this->m_scheme=='https') |
|
120 | + if ($this->m_scheme == 'https') |
|
121 | 121 | { |
122 | 122 | $scheme = 'ssl://'; |
123 | 123 | } |
124 | 124 | |
125 | 125 | $sock = @fsockopen($scheme . $this->m_host, $this->m_port, $errno, $errstr, $timeout); |
126 | - if(!$sock) |
|
126 | + if (!$sock) |
|
127 | 127 | { |
128 | 128 | return new Object(-1, 'socket_connect_failed'); |
129 | 129 | } |
130 | 130 | |
131 | 131 | $headers = $this->m_headers + array(); |
132 | - if(!isset($headers['Accept-Encoding'])) |
|
132 | + if (!isset($headers['Accept-Encoding'])) |
|
133 | 133 | { |
134 | 134 | $headers['Accept-Encoding'] = 'identity'; |
135 | 135 | } |
136 | 136 | |
137 | 137 | // post body |
138 | 138 | $post_body = ''; |
139 | - if($method == 'POST' && count($post_vars)) |
|
139 | + if ($method == 'POST' && count($post_vars)) |
|
140 | 140 | { |
141 | - foreach($post_vars as $key => $value) |
|
141 | + foreach ($post_vars as $key => $value) |
|
142 | 142 | { |
143 | 143 | $post_body .= urlencode($key) . '=' . urlencode($value) . '&'; |
144 | 144 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $request = "$method $target HTTP/1.1$crlf"; |
152 | - foreach($headers as $equiv => $content) |
|
152 | + foreach ($headers as $equiv => $content) |
|
153 | 153 | { |
154 | 154 | $request .= "$equiv: $content$crlf"; |
155 | 155 | } |
@@ -160,24 +160,24 @@ discard block |
||
160 | 160 | |
161 | 161 | // read response headers |
162 | 162 | $is_chunked = FALSE; |
163 | - while(strlen(trim($line = fgets($sock)))) |
|
163 | + while (strlen(trim($line = fgets($sock)))) |
|
164 | 164 | { |
165 | 165 | list($equiv, $content) = preg_split('/ *: */', rtrim($line), 2); |
166 | - if(!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
166 | + if (!strcasecmp($equiv, 'Transfer-Encoding') && $content == 'chunked') |
|
167 | 167 | { |
168 | 168 | $is_chunked = TRUE; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | 172 | $body = ''; |
173 | - while(!feof($sock)) |
|
173 | + while (!feof($sock)) |
|
174 | 174 | { |
175 | - if($is_chunked) |
|
175 | + if ($is_chunked) |
|
176 | 176 | { |
177 | 177 | $chunk_size = hexdec(fgets($sock)); |
178 | - if($chunk_size) |
|
178 | + if ($chunk_size) |
|
179 | 179 | { |
180 | - $body .= fgets($sock, $chunk_size+1); |
|
180 | + $body .= fgets($sock, $chunk_size + 1); |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | else |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
220 | 220 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); |
221 | 221 | |
222 | - switch($method) |
|
222 | + switch ($method) |
|
223 | 223 | { |
224 | 224 | case 'GET': curl_setopt($ch, CURLOPT_HTTPGET, true); |
225 | 225 | break; |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | $arr_headers = array(); |
235 | - foreach($headers as $key => $value) |
|
235 | + foreach ($headers as $key => $value) |
|
236 | 236 | { |
237 | 237 | $arr_headers[] = "$key: $value"; |
238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | curl_setopt($ch, CURLOPT_HTTPHEADER, $arr_headers); |
241 | 241 | |
242 | 242 | $body = curl_exec($ch); |
243 | - if(curl_errno($ch)) |
|
243 | + if (curl_errno($ch)) |
|
244 | 244 | { |
245 | 245 | return new Object(-1, 'socket_connect_failed'); |
246 | 246 | } |
@@ -97,8 +97,7 @@ discard block |
||
97 | 97 | if(FALSE && is_callable('curl_init')) |
98 | 98 | { |
99 | 99 | return $this->sendWithCurl($target, $method, $timeout, $post_vars); |
100 | - } |
|
101 | - else |
|
100 | + } else |
|
102 | 101 | { |
103 | 102 | return $this->sendWithSock($target, $method, $timeout, $post_vars); |
104 | 103 | } |
@@ -179,8 +178,7 @@ discard block |
||
179 | 178 | { |
180 | 179 | $body .= fgets($sock, $chunk_size+1); |
181 | 180 | } |
182 | - } |
|
183 | - else |
|
181 | + } else |
|
184 | 182 | { |
185 | 183 | $body .= fgets($sock, 512); |
186 | 184 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | /** |
129 | 129 | * Constructor function |
130 | 130 | * |
131 | - * @return void |
|
131 | + * @return string |
|
132 | 132 | */ |
133 | 133 | function Mail() |
134 | 134 | { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->SMTPSecure = "tls"; |
149 | 149 | $this->Host = 'smtp.gmail.com'; |
150 | 150 | $this->Port = '587'; |
151 | - if($this->isVaildMailAddress($account_name)) |
|
151 | + if ($this->isVaildMailAddress($account_name)) |
|
152 | 152 | { |
153 | 153 | $this->Username = $account_name; |
154 | 154 | } |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | $this->Password = $pass; |
181 | 181 | $this->Port = $port; |
182 | 182 | |
183 | - if($secure == 'ssl' || $secure == 'tls') |
|
183 | + if ($secure == 'ssl' || $secure == 'tls') |
|
184 | 184 | { |
185 | 185 | $this->SMTPSecure = $secure; |
186 | 186 | } |
187 | 187 | |
188 | - if(($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL)) |
|
188 | + if (($this->SMTPAuth !== NULL && $this->Host !== NULL && $this->Username !== NULL && $this->Password !== NULL) || ($this->SMTPAuth === NULL && $this->Host !== NULL)) |
|
189 | 189 | { |
190 | 190 | $this->IsSMTP(); |
191 | 191 | $this->AltBody = "To view the message, please use an HTML compatible email viewer!"; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function setSender($name, $email) |
244 | 244 | { |
245 | - if($this->Mailer == "mail") |
|
245 | + if ($this->Mailer == "mail") |
|
246 | 246 | { |
247 | 247 | $this->sender_name = $name; |
248 | 248 | $this->sender_email = $email; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | function getSender() |
262 | 262 | { |
263 | - if(!stristr(PHP_OS, 'win') && $this->sender_name) |
|
263 | + if (!stristr(PHP_OS, 'win') && $this->sender_name) |
|
264 | 264 | { |
265 | 265 | return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->sender_name) . '?=', $this->sender_email); |
266 | 266 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | function setReceiptor($name, $email) |
278 | 278 | { |
279 | - if($this->Mailer == "mail") |
|
279 | + if ($this->Mailer == "mail") |
|
280 | 280 | { |
281 | 281 | $this->receiptor_name = $name; |
282 | 282 | $this->receiptor_email = $email; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | function getReceiptor() |
296 | 296 | { |
297 | - if(!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email) |
|
297 | + if (!stristr(PHP_OS, 'win') && $this->receiptor_name && $this->receiptor_name != $this->receiptor_email) |
|
298 | 298 | { |
299 | 299 | return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->receiptor_name) . '?=', $this->receiptor_email); |
300 | 300 | } |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | function setTitle($title) |
311 | 311 | { |
312 | - if($this->Mailer == "mail") |
|
312 | + if ($this->Mailer == "mail") |
|
313 | 313 | { |
314 | 314 | $this->title = $title; |
315 | 315 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | function setBCC($bcc) |
339 | 339 | { |
340 | - if($this->Mailer == "mail") |
|
340 | + if ($this->Mailer == "mail") |
|
341 | 341 | { |
342 | 342 | $this->bcc = $bcc; |
343 | 343 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function setReplyTo($replyTo) |
379 | 379 | { |
380 | - if($this->Mailer == "mail") |
|
380 | + if ($this->Mailer == "mail") |
|
381 | 381 | { |
382 | 382 | $this->replyTo = $replyTo; |
383 | 383 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | function setContent($content) |
397 | 397 | { |
398 | 398 | $content = preg_replace_callback('/<img([^>]+)>/i', array($this, 'replaceResourceRealPath'), $content); |
399 | - if($this->Mailer == "mail") |
|
399 | + if ($this->Mailer == "mail") |
|
400 | 400 | { |
401 | 401 | $this->content = $content; |
402 | 402 | } |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | */ |
457 | 457 | function procAttachments() |
458 | 458 | { |
459 | - if($this->Mailer == "mail") |
|
459 | + if ($this->Mailer == "mail") |
|
460 | 460 | { |
461 | - if(count($this->attachments) > 0) |
|
461 | + if (count($this->attachments) > 0) |
|
462 | 462 | { |
463 | 463 | $this->body = $this->header . $this->body; |
464 | 464 | $boundary = '----==' . uniqid(rand(), TRUE); |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol; |
467 | 467 | $res = array(); |
468 | 468 | $res[] = $this->body; |
469 | - foreach($this->attachments as $filename => $attachment) |
|
469 | + foreach ($this->attachments as $filename => $attachment) |
|
470 | 470 | { |
471 | 471 | $type = $this->returnMIMEType($filename); |
472 | 472 | $file_handler = new FileHandler(); |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | } |
490 | 490 | else |
491 | 491 | { |
492 | - if(count($this->attachments) > 0) |
|
492 | + if (count($this->attachments) > 0) |
|
493 | 493 | { |
494 | - foreach($this->attachments as $filename => $attachment) |
|
494 | + foreach ($this->attachments as $filename => $attachment) |
|
495 | 495 | { |
496 | 496 | parent::AddAttachment($attachment); |
497 | 497 | } |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | function procCidAttachments() |
508 | 508 | { |
509 | - if(count($this->cidAttachments) > 0) |
|
509 | + if (count($this->cidAttachments) > 0) |
|
510 | 510 | { |
511 | 511 | $this->body = $this->header . $this->body; |
512 | 512 | $boundary = '----==' . uniqid(rand(), TRUE); |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | $this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol; |
515 | 515 | $res = array(); |
516 | 516 | $res[] = $this->body; |
517 | - foreach($this->cidAttachments as $cid => $attachment) |
|
517 | + foreach ($this->cidAttachments as $cid => $attachment) |
|
518 | 518 | { |
519 | 519 | $filename = basename($attachment); |
520 | 520 | $type = $this->returnMIMEType(FileHandler::getRealPath($attachment)); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | */ |
544 | 544 | function send() |
545 | 545 | { |
546 | - if($this->Mailer == "mail") |
|
546 | + if ($this->Mailer == "mail") |
|
547 | 547 | { |
548 | 548 | $boundary = '----==' . uniqid(rand(), TRUE); |
549 | 549 | $this->eol = $GLOBALS['_qmail_compatibility'] == "Y" ? "\n" : "\r\n"; |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | "MIME-Version: 1.0" . $this->eol . "", $this->getSender(), $this->messageId ? ("Message-ID: <" . $this->messageId . ">" . $this->eol) : "", $this->replyTo ? ("Reply-To: <" . $this->replyTo . ">" . $this->eol) : "", $this->bcc ? ("Bcc: " . $this->bcc . $this->eol) : "", $this->references ? ("References: <" . $this->references . ">" . $this->eol . "In-Reply-To: <" . $this->references . ">" . $this->eol) : "" |
574 | 574 | ); |
575 | 575 | $headers .= $this->header; |
576 | - if($this->additional_params) |
|
576 | + if ($this->additional_params) |
|
577 | 577 | { |
578 | 578 | return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers, $this->additional_params); |
579 | 579 | } |
@@ -594,14 +594,14 @@ discard block |
||
594 | 594 | */ |
595 | 595 | function checkMailMX($email_address) |
596 | 596 | { |
597 | - if(!Mail::isVaildMailAddress($email_address)) |
|
597 | + if (!Mail::isVaildMailAddress($email_address)) |
|
598 | 598 | { |
599 | 599 | return FALSE; |
600 | 600 | } |
601 | 601 | list($user, $host) = explode("@", $email_address); |
602 | - if(function_exists('checkdnsrr')) |
|
602 | + if (function_exists('checkdnsrr')) |
|
603 | 603 | { |
604 | - if(checkdnsrr($host, "MX") || checkdnsrr($host, "A")) |
|
604 | + if (checkdnsrr($host, "MX") || checkdnsrr($host, "A")) |
|
605 | 605 | { |
606 | 606 | return TRUE; |
607 | 607 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | function isVaildMailAddress($email_address) |
623 | 623 | { |
624 | - if(preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address)) |
|
624 | + if (preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address)) |
|
625 | 625 | { |
626 | 626 | return $email_address; |
627 | 627 | } |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | function returnMIMEType($filename) |
641 | 641 | { |
642 | 642 | preg_match("|\.([a-z0-9]{2,4})$|i", $filename, $fileSuffix); |
643 | - switch(strtolower($fileSuffix[1])) |
|
643 | + switch (strtolower($fileSuffix[1])) |
|
644 | 644 | { |
645 | 645 | case "js" : |
646 | 646 | return "application/x-javascript"; |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | case "swf" : |
709 | 709 | return "application/x-shockwave-flash"; |
710 | 710 | default : |
711 | - if(function_exists("mime_content_type")) |
|
711 | + if (function_exists("mime_content_type")) |
|
712 | 712 | { |
713 | 713 | $fileSuffix = mime_content_type($filename); |
714 | 714 | } |
@@ -151,8 +151,7 @@ discard block |
||
151 | 151 | if($this->isVaildMailAddress($account_name)) |
152 | 152 | { |
153 | 153 | $this->Username = $account_name; |
154 | - } |
|
155 | - else |
|
154 | + } else |
|
156 | 155 | { |
157 | 156 | $this->Username = $account_name . '@gmail.com'; |
158 | 157 | } |
@@ -190,8 +189,7 @@ discard block |
||
190 | 189 | $this->IsSMTP(); |
191 | 190 | $this->AltBody = "To view the message, please use an HTML compatible email viewer!"; |
192 | 191 | return TRUE; |
193 | - } |
|
194 | - else |
|
192 | + } else |
|
195 | 193 | { |
196 | 194 | $this->IsMail(); |
197 | 195 | return FALSE; |
@@ -246,8 +244,7 @@ discard block |
||
246 | 244 | { |
247 | 245 | $this->sender_name = $name; |
248 | 246 | $this->sender_email = $email; |
249 | - } |
|
250 | - else |
|
247 | + } else |
|
251 | 248 | { |
252 | 249 | $this->SetFrom($email, $name); |
253 | 250 | } |
@@ -280,8 +277,7 @@ discard block |
||
280 | 277 | { |
281 | 278 | $this->receiptor_name = $name; |
282 | 279 | $this->receiptor_email = $email; |
283 | - } |
|
284 | - else |
|
280 | + } else |
|
285 | 281 | { |
286 | 282 | $this->AddAddress($email, $name); |
287 | 283 | } |
@@ -312,8 +308,7 @@ discard block |
||
312 | 308 | if($this->Mailer == "mail") |
313 | 309 | { |
314 | 310 | $this->title = $title; |
315 | - } |
|
316 | - else |
|
311 | + } else |
|
317 | 312 | { |
318 | 313 | $this->Subject = $title; |
319 | 314 | } |
@@ -340,8 +335,7 @@ discard block |
||
340 | 335 | if($this->Mailer == "mail") |
341 | 336 | { |
342 | 337 | $this->bcc = $bcc; |
343 | - } |
|
344 | - else |
|
338 | + } else |
|
345 | 339 | { |
346 | 340 | $this->AddBCC($bcc); |
347 | 341 | } |
@@ -380,8 +374,7 @@ discard block |
||
380 | 374 | if($this->Mailer == "mail") |
381 | 375 | { |
382 | 376 | $this->replyTo = $replyTo; |
383 | - } |
|
384 | - else |
|
377 | + } else |
|
385 | 378 | { |
386 | 379 | $this->AddReplyTo($replyTo); |
387 | 380 | } |
@@ -399,8 +392,7 @@ discard block |
||
399 | 392 | if($this->Mailer == "mail") |
400 | 393 | { |
401 | 394 | $this->content = $content; |
402 | - } |
|
403 | - else |
|
395 | + } else |
|
404 | 396 | { |
405 | 397 | $this->MsgHTML($content); |
406 | 398 | } |
@@ -486,8 +478,7 @@ discard block |
||
486 | 478 | $this->body = implode("", $res); |
487 | 479 | $this->body .= "--" . $boundary . "--"; |
488 | 480 | } |
489 | - } |
|
490 | - else |
|
481 | + } else |
|
491 | 482 | { |
492 | 483 | if(count($this->attachments) > 0) |
493 | 484 | { |
@@ -578,8 +569,7 @@ discard block |
||
578 | 569 | return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers, $this->additional_params); |
579 | 570 | } |
580 | 571 | return mail($this->getReceiptor(), $this->getTitle(), $this->body, $headers); |
581 | - } |
|
582 | - else |
|
572 | + } else |
|
583 | 573 | { |
584 | 574 | $this->procAttachments(); |
585 | 575 | return parent::Send(); |
@@ -604,8 +594,7 @@ discard block |
||
604 | 594 | if(checkdnsrr($host, "MX") || checkdnsrr($host, "A")) |
605 | 595 | { |
606 | 596 | return TRUE; |
607 | - } |
|
608 | - else |
|
597 | + } else |
|
609 | 598 | { |
610 | 599 | return FALSE; |
611 | 600 | } |
@@ -624,8 +613,7 @@ discard block |
||
624 | 613 | if(preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address)) |
625 | 614 | { |
626 | 615 | return $email_address; |
627 | - } |
|
628 | - else |
|
616 | + } else |
|
629 | 617 | { |
630 | 618 | return ''; |
631 | 619 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | /** |
114 | 114 | * Initialization. It finds the target module based on module, mid, document_srl, and prepares to execute an action |
115 | - * @return boolean true: OK, false: redirected |
|
115 | + * @return string|boolean true: OK, false: redirected |
|
116 | 116 | * */ |
117 | 117 | function init() |
118 | 118 | { |
@@ -1128,6 +1128,10 @@ discard block |
||
1128 | 1128 | return $GLOBALS['_loaded_module'][$module][$type][$kind]; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | + /** |
|
1132 | + * @param string $type |
|
1133 | + * @param string $kind |
|
1134 | + */ |
|
1131 | 1135 | function _getModuleFilePath($module, $type, $kind, &$classPath, &$highClassFile, &$classFile, &$instanceName) |
1132 | 1136 | { |
1133 | 1137 | $classPath = ModuleHandler::getModulePath($module); |
@@ -59,10 +59,10 @@ |
||
59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
62 | - if($entry = Context::get('entry')) |
|
63 | - { |
|
64 | - $this->entry = Context::convertEncodingStr($entry); |
|
65 | - } |
|
62 | + if($entry = Context::get('entry')) |
|
63 | + { |
|
64 | + $this->entry = Context::convertEncodingStr($entry); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | // Validate variables to prevent XSS |
68 | 68 | $isInvalid = NULL; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | function ModuleHandler($module = '', $act = '', $mid = '', $document_srl = '', $module_srl = '') |
36 | 36 | { |
37 | 37 | // If XE has not installed yet, set module as install |
38 | - if(!Context::isInstalled()) |
|
38 | + if (!Context::isInstalled()) |
|
39 | 39 | { |
40 | 40 | $this->module = 'install'; |
41 | 41 | $this->act = Context::get('act'); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | $oContext = Context::getInstance(); |
46 | - if($oContext->isSuccessInit == FALSE) |
|
46 | + if ($oContext->isSuccessInit == FALSE) |
|
47 | 47 | { |
48 | 48 | $logged_info = Context::get('logged_info'); |
49 | - if($logged_info->is_admin != "Y") |
|
49 | + if ($logged_info->is_admin != "Y") |
|
50 | 50 | { |
51 | 51 | $this->error = 'msg_invalid_request'; |
52 | 52 | return; |
@@ -59,26 +59,26 @@ discard block |
||
59 | 59 | $this->mid = $mid ? $mid : Context::get('mid'); |
60 | 60 | $this->document_srl = $document_srl ? (int) $document_srl : (int) Context::get('document_srl'); |
61 | 61 | $this->module_srl = $module_srl ? (int) $module_srl : (int) Context::get('module_srl'); |
62 | - if($entry = Context::get('entry')) |
|
62 | + if ($entry = Context::get('entry')) |
|
63 | 63 | { |
64 | 64 | $this->entry = Context::convertEncodingStr($entry); |
65 | 65 | } |
66 | 66 | |
67 | 67 | // Validate variables to prevent XSS |
68 | 68 | $isInvalid = NULL; |
69 | - if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
69 | + if ($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->module)) |
|
70 | 70 | { |
71 | 71 | $isInvalid = TRUE; |
72 | 72 | } |
73 | - if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
73 | + if ($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->mid)) |
|
74 | 74 | { |
75 | 75 | $isInvalid = TRUE; |
76 | 76 | } |
77 | - if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
77 | + if ($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i", $this->act)) |
|
78 | 78 | { |
79 | 79 | $isInvalid = TRUE; |
80 | 80 | } |
81 | - if($isInvalid) |
|
81 | + if ($isInvalid) |
|
82 | 82 | { |
83 | 83 | htmlHeader(); |
84 | 84 | echo Context::getLang("msg_invalid_request"); |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | exit; |
88 | 88 | } |
89 | 89 | |
90 | - if(isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
90 | + if (isset($this->act) && (strlen($this->act) >= 4 && substr_compare($this->act, 'disp', 0, 4) === 0)) |
|
91 | 91 | { |
92 | - if(Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
92 | + if (Context::get('_use_ssl') == 'optional' && Context::isExistsSSLAction($this->act) && $_SERVER['HTTPS'] != 'on') |
|
93 | 93 | { |
94 | - if(Context::get('_https_port')!=null) { |
|
94 | + if (Context::get('_https_port') != null) { |
|
95 | 95 | header('location:https://' . $_SERVER['HTTP_HOST'] . ':' . Context::get('_https_port') . $_SERVER['REQUEST_URI']); |
96 | 96 | } else { |
97 | 97 | header('location:https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $called_position = 'before_module_init'; |
108 | 108 | $oAddonController = getController('addon'); |
109 | 109 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
110 | - if(file_exists($addon_file)) include($addon_file); |
|
110 | + if (file_exists($addon_file)) include($addon_file); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | |
122 | 122 | // if success_return_url and error_return_url is incorrect |
123 | 123 | $urls = array(Context::get('success_return_url'), Context::get('error_return_url')); |
124 | - foreach($urls as $url) |
|
124 | + foreach ($urls as $url) |
|
125 | 125 | { |
126 | - if(empty($url)) |
|
126 | + if (empty($url)) |
|
127 | 127 | { |
128 | 128 | continue; |
129 | 129 | } |
@@ -135,29 +135,29 @@ discard block |
||
135 | 135 | $defaultUrlInfo = parse_url($dbInfo->default_url); |
136 | 136 | $defaultHost = $defaultUrlInfo['host']; |
137 | 137 | |
138 | - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
138 | + if ($host && ($host != $defaultHost && $host != $site_module_info->domain)) |
|
139 | 139 | { |
140 | 140 | throw new Exception('msg_default_url_is_null'); |
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
144 | - if(!$this->document_srl && $this->mid && $this->entry) |
|
144 | + if (!$this->document_srl && $this->mid && $this->entry) |
|
145 | 145 | { |
146 | 146 | $oDocumentModel = getModel('document'); |
147 | 147 | $this->document_srl = $oDocumentModel->getDocumentSrlByAlias($this->mid, $this->entry); |
148 | - if($this->document_srl) |
|
148 | + if ($this->document_srl) |
|
149 | 149 | { |
150 | 150 | Context::set('document_srl', $this->document_srl); |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Get module's information based on document_srl, if it's specified |
155 | - if($this->document_srl) |
|
155 | + if ($this->document_srl) |
|
156 | 156 | { |
157 | 157 | |
158 | 158 | $module_info = $oModuleModel->getModuleInfoByDocumentSrl($this->document_srl); |
159 | 159 | // If the document does not exist, remove document_srl |
160 | - if(!$module_info) |
|
160 | + if (!$module_info) |
|
161 | 161 | { |
162 | 162 | unset($this->document_srl); |
163 | 163 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | { |
166 | 166 | // If it exists, compare mid based on the module information |
167 | 167 | // if mids are not matching, set it as the document's mid |
168 | - if(!$this->mid || ($this->mid != $module_info->mid)) |
|
168 | + if (!$this->mid || ($this->mid != $module_info->mid)) |
|
169 | 169 | { |
170 | 170 | |
171 | - if(Context::getRequestMethod() == 'GET') |
|
171 | + if (Context::getRequestMethod() == 'GET') |
|
172 | 172 | { |
173 | 173 | $this->mid = $module_info->mid; |
174 | 174 | header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | } |
184 | 184 | // if requested module is different from one of the document, remove the module information retrieved based on the document number |
185 | - if($this->module && $module_info->module != $this->module) |
|
185 | + if ($this->module && $module_info->module != $this->module) |
|
186 | 186 | { |
187 | 187 | unset($module_info); |
188 | 188 | } |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | // If module_info is not set yet, and there exists mid information, get module information based on the mid |
194 | - if(!$module_info && $this->mid) |
|
194 | + if (!$module_info && $this->mid) |
|
195 | 195 | { |
196 | 196 | $module_info = $oModuleModel->getModuleInfoByMid($this->mid, $site_module_info->site_srl); |
197 | 197 | //if($this->module && $module_info->module != $this->module) unset($module_info); |
198 | 198 | } |
199 | 199 | |
200 | 200 | // redirect, if module_site_srl and site_srl are different |
201 | - if(!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
201 | + if (!$this->module && !$module_info && $site_module_info->site_srl == 0 && $site_module_info->module_site_srl > 0) |
|
202 | 202 | { |
203 | 203 | $site_info = $oModuleModel->getSiteInfo($site_module_info->module_site_srl); |
204 | 204 | header("location:" . getNotEncodedSiteUrl($site_info->domain, 'mid', $site_module_info->mid)); |
@@ -206,21 +206,21 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | // If module_info is not set still, and $module does not exist, find the default module |
209 | - if(!$module_info && !$this->module && !$this->mid) |
|
209 | + if (!$module_info && !$this->module && !$this->mid) |
|
210 | 210 | { |
211 | 211 | $module_info = $site_module_info; |
212 | 212 | } |
213 | 213 | |
214 | - if(!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
214 | + if (!$module_info && !$this->module && $site_module_info->module_site_srl) |
|
215 | 215 | { |
216 | 216 | $module_info = $site_module_info; |
217 | 217 | } |
218 | 218 | |
219 | 219 | // redirect, if site_srl of module_info is different from one of site's module_info |
220 | - if($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
220 | + if ($module_info && $module_info->site_srl != $site_module_info->site_srl && !isCrawler()) |
|
221 | 221 | { |
222 | 222 | // If the module is of virtual site |
223 | - if($module_info->site_srl) |
|
223 | + if ($module_info->site_srl) |
|
224 | 224 | { |
225 | 225 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
226 | 226 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | else |
230 | 230 | { |
231 | 231 | $db_info = Context::getDBInfo(); |
232 | - if(!$db_info->default_url) |
|
232 | + if (!$db_info->default_url) |
|
233 | 233 | { |
234 | 234 | return Context::getLang('msg_default_url_is_not_defined'); |
235 | 235 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | // If module info was set, retrieve variables from the module information |
246 | - if($module_info) |
|
246 | + if ($module_info) |
|
247 | 247 | { |
248 | 248 | $this->module = $module_info->module; |
249 | 249 | $this->mid = $module_info->mid; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $targetSrl = (Mobile::isFromMobilePhone()) ? 'mlayout_srl' : 'layout_srl'; |
255 | 255 | |
256 | 256 | // use the site default layout. |
257 | - if($module_info->{$targetSrl} == -1) |
|
257 | + if ($module_info->{$targetSrl} == -1) |
|
258 | 258 | { |
259 | 259 | $oLayoutAdminModel = getAdminModel('layout'); |
260 | 260 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | // Set module and mid into module_info |
275 | - if(!isset($this->module_info)) |
|
275 | + if (!isset($this->module_info)) |
|
276 | 276 | { |
277 | 277 | $this->module_info = new stdClass(); |
278 | 278 | } |
@@ -283,21 +283,21 @@ discard block |
||
283 | 283 | $this->module_info->site_srl = $site_module_info->site_srl; |
284 | 284 | |
285 | 285 | // Still no module? it's an error |
286 | - if(!$this->module) |
|
286 | + if (!$this->module) |
|
287 | 287 | { |
288 | 288 | $this->error = 'msg_module_is_not_exists'; |
289 | 289 | $this->httpStatusCode = '404'; |
290 | 290 | } |
291 | 291 | |
292 | 292 | // If mid exists, set mid into context |
293 | - if($this->mid) |
|
293 | + if ($this->mid) |
|
294 | 294 | { |
295 | 295 | Context::set('mid', $this->mid, TRUE); |
296 | 296 | } |
297 | 297 | |
298 | 298 | // Call a trigger after moduleHandler init |
299 | 299 | $output = ModuleHandler::triggerCall('moduleHandler.init', 'after', $this->module_info); |
300 | - if(!$output->toBool()) |
|
300 | + if (!$output->toBool()) |
|
301 | 301 | { |
302 | 302 | $this->error = $output->getMessage(); |
303 | 303 | return TRUE; |
@@ -319,14 +319,14 @@ discard block |
||
319 | 319 | $display_mode = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
320 | 320 | |
321 | 321 | // If error occurred while preparation, return a message instance |
322 | - if($this->error) |
|
322 | + if ($this->error) |
|
323 | 323 | { |
324 | 324 | $this->_setInputErrorToContext(); |
325 | 325 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
326 | 326 | $oMessageObject->setError(-1); |
327 | 327 | $oMessageObject->setMessage($this->error); |
328 | 328 | $oMessageObject->dispMessage(); |
329 | - if($this->httpStatusCode) |
|
329 | + if ($this->httpStatusCode) |
|
330 | 330 | { |
331 | 331 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
332 | 332 | } |
@@ -337,22 +337,22 @@ discard block |
||
337 | 337 | $xml_info = $oModuleModel->getModuleActionXml($this->module); |
338 | 338 | |
339 | 339 | // If not installed yet, modify act |
340 | - if($this->module == "install") |
|
340 | + if ($this->module == "install") |
|
341 | 341 | { |
342 | - if(!$this->act || !$xml_info->action->{$this->act}) |
|
342 | + if (!$this->act || !$xml_info->action->{$this->act}) |
|
343 | 343 | { |
344 | 344 | $this->act = $xml_info->default_index_act; |
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
348 | 348 | // if act exists, find type of the action, if not use default index act |
349 | - if(!$this->act) |
|
349 | + if (!$this->act) |
|
350 | 350 | { |
351 | 351 | $this->act = $xml_info->default_index_act; |
352 | 352 | } |
353 | 353 | |
354 | 354 | // still no act means error |
355 | - if(!$this->act) |
|
355 | + if (!$this->act) |
|
356 | 356 | { |
357 | 357 | $this->error = 'msg_module_is_not_exists'; |
358 | 358 | $this->httpStatusCode = '404'; |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $oMessageObject->setError(-1); |
363 | 363 | $oMessageObject->setMessage($this->error); |
364 | 364 | $oMessageObject->dispMessage(); |
365 | - if($this->httpStatusCode) |
|
365 | + if ($this->httpStatusCode) |
|
366 | 366 | { |
367 | 367 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
368 | 368 | } |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | $type = $xml_info->action->{$this->act}->type; |
374 | 374 | $ruleset = $xml_info->action->{$this->act}->ruleset; |
375 | 375 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
376 | - if(!$kind && $this->module == 'admin') |
|
376 | + if (!$kind && $this->module == 'admin') |
|
377 | 377 | { |
378 | 378 | $kind = 'admin'; |
379 | 379 | } |
380 | 380 | |
381 | 381 | // check REQUEST_METHOD in controller |
382 | - if($type == 'controller') |
|
382 | + if ($type == 'controller') |
|
383 | 383 | { |
384 | 384 | $allowedMethod = $xml_info->action->{$this->act}->method; |
385 | 385 | |
386 | - if(!$allowedMethod) |
|
386 | + if (!$allowedMethod) |
|
387 | 387 | { |
388 | 388 | $allowedMethodList[0] = 'POST'; |
389 | 389 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
393 | 393 | } |
394 | 394 | |
395 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
395 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
396 | 396 | { |
397 | 397 | $this->error = "msg_invalid_request"; |
398 | 398 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | } |
404 | 404 | } |
405 | 405 | |
406 | - if($this->module_info->use_mobile != "Y") |
|
406 | + if ($this->module_info->use_mobile != "Y") |
|
407 | 407 | { |
408 | 408 | Mobile::setMobile(FALSE); |
409 | 409 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $logged_info = Context::get('logged_info'); |
412 | 412 | |
413 | 413 | // check CSRF for POST actions |
414 | - if(Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
414 | + if (Context::getRequestMethod() === 'POST' && Context::isInstalled() && $this->act !== 'procFileUpload' && !checkCSRF()) { |
|
415 | 415 | $this->error = 'msg_invalid_request'; |
416 | 416 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
417 | 417 | $oMessageObject->setError(-1); |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | // Admin ip |
424 | - if($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
424 | + if ($kind == 'admin' && $_SESSION['denied_admin'] == 'Y') |
|
425 | 425 | { |
426 | 426 | $this->_setInputErrorToContext(); |
427 | 427 | $this->error = "msg_not_permitted_act"; |
@@ -433,13 +433,13 @@ discard block |
||
433 | 433 | } |
434 | 434 | |
435 | 435 | // if(type == view, and case for using mobilephone) |
436 | - if($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
436 | + if ($type == "view" && Mobile::isFromMobilePhone() && Context::isInstalled()) |
|
437 | 437 | { |
438 | 438 | $orig_type = "view"; |
439 | 439 | $type = "mobile"; |
440 | 440 | // create a module instance |
441 | 441 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
442 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
442 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
443 | 443 | { |
444 | 444 | $type = $orig_type; |
445 | 445 | Mobile::setMobile(FALSE); |
@@ -452,14 +452,14 @@ discard block |
||
452 | 452 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
453 | 453 | } |
454 | 454 | |
455 | - if(!is_object($oModule)) |
|
455 | + if (!is_object($oModule)) |
|
456 | 456 | { |
457 | 457 | $this->_setInputErrorToContext(); |
458 | 458 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
459 | 459 | $oMessageObject->setError(-1); |
460 | 460 | $oMessageObject->setMessage($this->error); |
461 | 461 | $oMessageObject->dispMessage(); |
462 | - if($this->httpStatusCode) |
|
462 | + if ($this->httpStatusCode) |
|
463 | 463 | { |
464 | 464 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
465 | 465 | } |
@@ -467,10 +467,10 @@ discard block |
||
467 | 467 | } |
468 | 468 | |
469 | 469 | // If there is no such action in the module object |
470 | - if(!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
470 | + if (!isset($xml_info->action->{$this->act}) || !method_exists($oModule, $this->act)) |
|
471 | 471 | { |
472 | 472 | |
473 | - if(!Context::isInstalled()) |
|
473 | + if (!Context::isInstalled()) |
|
474 | 474 | { |
475 | 475 | $this->_setInputErrorToContext(); |
476 | 476 | $this->error = 'msg_invalid_request'; |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | $oMessageObject->setError(-1); |
479 | 479 | $oMessageObject->setMessage($this->error); |
480 | 480 | $oMessageObject->dispMessage(); |
481 | - if($this->httpStatusCode) |
|
481 | + if ($this->httpStatusCode) |
|
482 | 482 | { |
483 | 483 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
484 | 484 | } |
@@ -487,12 +487,12 @@ discard block |
||
487 | 487 | |
488 | 488 | $forward = NULL; |
489 | 489 | // 1. Look for the module with action name |
490 | - if(preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
490 | + if (preg_match('/^([a-z]+)([A-Z])([a-z0-9\_]+)(.*)$/', $this->act, $matches)) |
|
491 | 491 | { |
492 | 492 | $module = strtolower($matches[2] . $matches[3]); |
493 | 493 | $xml_info = $oModuleModel->getModuleActionXml($module); |
494 | 494 | |
495 | - if($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
495 | + if ($xml_info->action->{$this->act} && ((stripos($this->act, 'admin') !== FALSE) || $xml_info->action->{$this->act}->standalone != 'false')) |
|
496 | 496 | { |
497 | 497 | $forward = new stdClass(); |
498 | 498 | $forward->module = $module; |
@@ -512,12 +512,12 @@ discard block |
||
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - if(!$forward) |
|
515 | + if (!$forward) |
|
516 | 516 | { |
517 | 517 | $forward = $oModuleModel->getActionForward($this->act); |
518 | 518 | } |
519 | 519 | |
520 | - if($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
520 | + if ($forward->module && $forward->type && $forward->act && $forward->act == $this->act) |
|
521 | 521 | { |
522 | 522 | $kind = stripos($forward->act, 'admin') !== FALSE ? 'admin' : ''; |
523 | 523 | $type = $forward->type; |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | |
530 | 530 | // SECISSUE also check foward act method |
531 | 531 | // check REQUEST_METHOD in controller |
532 | - if($type == 'controller') |
|
532 | + if ($type == 'controller') |
|
533 | 533 | { |
534 | 534 | $allowedMethod = $xml_info->action->{$forward->act}->method; |
535 | 535 | |
536 | - if(!$allowedMethod) |
|
536 | + if (!$allowedMethod) |
|
537 | 537 | { |
538 | 538 | $allowedMethodList[0] = 'POST'; |
539 | 539 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
543 | 543 | } |
544 | 544 | |
545 | - if(!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
545 | + if (!in_array(strtoupper($_SERVER['REQUEST_METHOD']), $allowedMethodList)) |
|
546 | 546 | { |
547 | 547 | $this->error = "msg_invalid_request"; |
548 | 548 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -553,13 +553,13 @@ discard block |
||
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
556 | - if($type == "view" && Mobile::isFromMobilePhone()) |
|
556 | + if ($type == "view" && Mobile::isFromMobilePhone()) |
|
557 | 557 | { |
558 | 558 | $orig_type = "view"; |
559 | 559 | $type = "mobile"; |
560 | 560 | // create a module instance |
561 | 561 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
562 | - if(!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
562 | + if (!is_object($oModule) || !method_exists($oModule, $this->act)) |
|
563 | 563 | { |
564 | 564 | $type = $orig_type; |
565 | 565 | Mobile::setMobile(FALSE); |
@@ -571,25 +571,25 @@ discard block |
||
571 | 571 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
572 | 572 | } |
573 | 573 | |
574 | - if(!is_object($oModule)) |
|
574 | + if (!is_object($oModule)) |
|
575 | 575 | { |
576 | 576 | $this->_setInputErrorToContext(); |
577 | 577 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
578 | 578 | $oMessageObject->setError(-1); |
579 | 579 | $oMessageObject->setMessage('msg_module_is_not_exists'); |
580 | 580 | $oMessageObject->dispMessage(); |
581 | - if($this->httpStatusCode) |
|
581 | + if ($this->httpStatusCode) |
|
582 | 582 | { |
583 | 583 | $oMessageObject->setHttpStatusCode($this->httpStatusCode); |
584 | 584 | } |
585 | 585 | return $oMessageObject; |
586 | 586 | } |
587 | 587 | |
588 | - if($this->module == "admin" && $type == "view") |
|
588 | + if ($this->module == "admin" && $type == "view") |
|
589 | 589 | { |
590 | - if($logged_info->is_admin == 'Y') |
|
590 | + if ($logged_info->is_admin == 'Y') |
|
591 | 591 | { |
592 | - if($this->act != 'dispLayoutAdminLayoutModify') |
|
592 | + if ($this->act != 'dispLayoutAdminLayoutModify') |
|
593 | 593 | { |
594 | 594 | $oAdminView = getAdminView('admin'); |
595 | 595 | $oAdminView->makeGnbUrl($forward->module); |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | return $oMessageObject; |
610 | 610 | } |
611 | 611 | } |
612 | - if($kind == 'admin') |
|
612 | + if ($kind == 'admin') |
|
613 | 613 | { |
614 | 614 | $grant = $oModuleModel->getGrant($this->module_info, $logged_info); |
615 | - if(!$grant->manager) |
|
615 | + if (!$grant->manager) |
|
616 | 616 | { |
617 | 617 | $this->_setInputErrorToContext(); |
618 | 618 | $this->error = 'msg_is_not_manager'; |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | } |
625 | 625 | else |
626 | 626 | { |
627 | - if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
627 | + if (!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
|
628 | 628 | { |
629 | 629 | $this->_setInputErrorToContext(); |
630 | 630 | $this->error = 'msg_is_not_administrator'; |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | } |
638 | 638 | } |
639 | 639 | } |
640 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
640 | + else if ($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
641 | 641 | { |
642 | 642 | $this->act = $xml_info->default_index_act; |
643 | 643 | } |
@@ -651,16 +651,16 @@ discard block |
||
651 | 651 | } |
652 | 652 | |
653 | 653 | // ruleset check... |
654 | - if(!empty($ruleset)) |
|
654 | + if (!empty($ruleset)) |
|
655 | 655 | { |
656 | 656 | $rulesetModule = $forward->module ? $forward->module : $this->module; |
657 | 657 | $rulesetFile = $oModuleModel->getValidatorFilePath($rulesetModule, $ruleset, $this->mid); |
658 | - if(!empty($rulesetFile)) |
|
658 | + if (!empty($rulesetFile)) |
|
659 | 659 | { |
660 | - if($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
660 | + if ($_SESSION['XE_VALIDATOR_ERROR_LANG']) |
|
661 | 661 | { |
662 | 662 | $errorLang = $_SESSION['XE_VALIDATOR_ERROR_LANG']; |
663 | - foreach($errorLang as $key => $val) |
|
663 | + foreach ($errorLang as $key => $val) |
|
664 | 664 | { |
665 | 665 | Context::setLang($key, $val); |
666 | 666 | } |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | $Validator = new Validator($rulesetFile); |
671 | 671 | $result = $Validator->validate(); |
672 | - if(!$result) |
|
672 | + if (!$result) |
|
673 | 673 | { |
674 | 674 | $lastError = $Validator->getLastError(); |
675 | 675 | $returnUrl = Context::get('error_return_url'); |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | 'dispLayoutPreviewWithModule' => 1 |
702 | 702 | ); |
703 | 703 | $db_use_mobile = Mobile::isMobileEnabled(); |
704 | - if($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
704 | + if ($type == "view" && $this->module_info->use_mobile == "Y" && Mobile::isMobileCheckByAgent() && !isset($skipAct[Context::get('act')]) && $db_use_mobile === true) |
|
705 | 705 | { |
706 | 706 | global $lang; |
707 | 707 | $header = '<style>div.xe_mobile{opacity:0.7;margin:1em 0;padding:.5em;background:#333;border:1px solid #666;border-left:0;border-right:0}p.xe_mobile{text-align:center;margin:1em 0}a.xe_mobile{color:#ff0;font-weight:bold;font-size:24px}@media only screen and (min-width:500px){a.xe_mobile{font-size:15px}}</style>'; |
@@ -710,17 +710,17 @@ discard block |
||
710 | 710 | Context::addHtmlFooter($footer); |
711 | 711 | } |
712 | 712 | |
713 | - if($type == "view" && $kind != 'admin') |
|
713 | + if ($type == "view" && $kind != 'admin') |
|
714 | 714 | { |
715 | 715 | $module_config = $oModuleModel->getModuleConfig('module'); |
716 | - if($module_config->htmlFooter) |
|
716 | + if ($module_config->htmlFooter) |
|
717 | 717 | { |
718 | 718 | Context::addHtmlFooter($module_config->htmlFooter); |
719 | 719 | } |
720 | - if($module_config->siteTitle) |
|
720 | + if ($module_config->siteTitle) |
|
721 | 721 | { |
722 | 722 | $siteTitle = Context::getBrowserTitle(); |
723 | - if(!$siteTitle) |
|
723 | + if (!$siteTitle) |
|
724 | 724 | { |
725 | 725 | Context::setBrowserTitle($module_config->siteTitle); |
726 | 726 | } |
@@ -733,18 +733,18 @@ discard block |
||
733 | 733 | $procResult = $oModule->proc(); |
734 | 734 | |
735 | 735 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
736 | - if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
736 | + if (!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) |
|
737 | 737 | { |
738 | 738 | $error = $oModule->getError(); |
739 | 739 | $message = $oModule->getMessage(); |
740 | 740 | $messageType = $oModule->getMessageType(); |
741 | 741 | $redirectUrl = $oModule->getRedirectUrl(); |
742 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
742 | + if ($messageType == 'error') debugPrint($message, 'ERROR'); |
|
743 | 743 | |
744 | - if(!$procResult) |
|
744 | + if (!$procResult) |
|
745 | 745 | { |
746 | 746 | $this->error = $message; |
747 | - if(!$redirectUrl && Context::get('error_return_url')) |
|
747 | + if (!$redirectUrl && Context::get('error_return_url')) |
|
748 | 748 | { |
749 | 749 | $redirectUrl = Context::get('error_return_url'); |
750 | 750 | } |
@@ -757,13 +757,13 @@ discard block |
||
757 | 757 | |
758 | 758 | $_SESSION['XE_VALIDATOR_ERROR'] = $error; |
759 | 759 | $_SESSION['XE_VALIDATOR_ID'] = Context::get('xe_validator_id'); |
760 | - if($message != 'success') |
|
760 | + if ($message != 'success') |
|
761 | 761 | { |
762 | 762 | $_SESSION['XE_VALIDATOR_MESSAGE'] = $message; |
763 | 763 | } |
764 | 764 | $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] = $messageType; |
765 | 765 | |
766 | - if(Context::get('xeVirtualRequestMethod') != 'xml') |
|
766 | + if (Context::get('xeVirtualRequestMethod') != 'xml') |
|
767 | 767 | { |
768 | 768 | $_SESSION['XE_VALIDATOR_RETURN_URL'] = $redirectUrl; |
769 | 769 | } |
@@ -779,27 +779,27 @@ discard block |
||
779 | 779 | * */ |
780 | 780 | function _setInputErrorToContext() |
781 | 781 | { |
782 | - if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
782 | + if ($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) |
|
783 | 783 | { |
784 | 784 | Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); |
785 | 785 | } |
786 | - if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
786 | + if ($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) |
|
787 | 787 | { |
788 | 788 | Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); |
789 | 789 | } |
790 | - if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
790 | + if ($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) |
|
791 | 791 | { |
792 | 792 | Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); |
793 | 793 | } |
794 | - if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
794 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) |
|
795 | 795 | { |
796 | 796 | Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); |
797 | 797 | } |
798 | - if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
798 | + if ($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) |
|
799 | 799 | { |
800 | 800 | Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); |
801 | 801 | } |
802 | - if(count($_SESSION['INPUT_ERROR'])) |
|
802 | + if (count($_SESSION['INPUT_ERROR'])) |
|
803 | 803 | { |
804 | 804 | Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); |
805 | 805 | } |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | { |
830 | 830 | $requestVars = Context::getRequestVars(); |
831 | 831 | unset($requestVars->act, $requestVars->mid, $requestVars->vid, $requestVars->success_return_url, $requestVars->error_return_url); |
832 | - foreach($requestVars AS $key => $value) |
|
832 | + foreach ($requestVars AS $key => $value) |
|
833 | 833 | { |
834 | 834 | $_SESSION['INPUT_ERROR'][$key] = $value; |
835 | 835 | } |
@@ -843,31 +843,31 @@ discard block |
||
843 | 843 | function displayContent($oModule = NULL) |
844 | 844 | { |
845 | 845 | // If the module is not set or not an object, set error |
846 | - if(!$oModule || !is_object($oModule)) |
|
846 | + if (!$oModule || !is_object($oModule)) |
|
847 | 847 | { |
848 | 848 | $this->error = 'msg_module_is_not_exists'; |
849 | 849 | $this->httpStatusCode = '404'; |
850 | 850 | } |
851 | 851 | |
852 | 852 | // If connection to DB has a problem even though it's not install module, set error |
853 | - if($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
853 | + if ($this->module != 'install' && isset($GLOBALS['__DB__']) && $GLOBALS['__DB__'][Context::getDBType()]->isConnected() == FALSE) |
|
854 | 854 | { |
855 | 855 | $this->error = 'msg_dbconnect_failed'; |
856 | 856 | } |
857 | 857 | |
858 | 858 | // Call trigger after moduleHandler proc |
859 | 859 | $output = ModuleHandler::triggerCall('moduleHandler.proc', 'after', $oModule); |
860 | - if(!$output->toBool()) |
|
860 | + if (!$output->toBool()) |
|
861 | 861 | { |
862 | 862 | $this->error = $output->getMessage(); |
863 | 863 | } |
864 | 864 | |
865 | 865 | // Use message view object, if HTML call |
866 | 866 | $methodList = array('XMLRPC' => 1, 'JSON' => 1, 'JS_CALLBACK' => 1); |
867 | - if(!isset($methodList[Context::getRequestMethod()])) |
|
867 | + if (!isset($methodList[Context::getRequestMethod()])) |
|
868 | 868 | { |
869 | 869 | |
870 | - if($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
870 | + if ($_SESSION['XE_VALIDATOR_RETURN_URL']) |
|
871 | 871 | { |
872 | 872 | $display_handler = new DisplayHandler(); |
873 | 873 | $display_handler->_debugOutput(); |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | } |
878 | 878 | |
879 | 879 | // If error occurred, handle it |
880 | - if($this->error) |
|
880 | + if ($this->error) |
|
881 | 881 | { |
882 | 882 | // display content with message module instance |
883 | 883 | $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; |
@@ -886,14 +886,14 @@ discard block |
||
886 | 886 | $oMessageObject->setMessage($this->error); |
887 | 887 | $oMessageObject->dispMessage(); |
888 | 888 | |
889 | - if($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
889 | + if ($oMessageObject->getHttpStatusCode() && $oMessageObject->getHttpStatusCode() != '200') |
|
890 | 890 | { |
891 | 891 | $this->_setHttpStatusMessage($oMessageObject->getHttpStatusCode()); |
892 | 892 | $oMessageObject->setTemplateFile('http_status_code'); |
893 | 893 | } |
894 | 894 | |
895 | 895 | // If module was called normally, change the templates of the module into ones of the message view module |
896 | - if($oModule) |
|
896 | + if ($oModule) |
|
897 | 897 | { |
898 | 898 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
899 | 899 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | } |
909 | 909 | |
910 | 910 | // Check if layout_srl exists for the module |
911 | - if(Mobile::isFromMobilePhone()) |
|
911 | + if (Mobile::isFromMobilePhone()) |
|
912 | 912 | { |
913 | 913 | $layout_srl = $oModule->module_info->mlayout_srl; |
914 | 914 | } |
@@ -918,31 +918,31 @@ discard block |
||
918 | 918 | } |
919 | 919 | |
920 | 920 | // if layout_srl is rollback by module, set default layout |
921 | - if($layout_srl == -1) |
|
921 | + if ($layout_srl == -1) |
|
922 | 922 | { |
923 | 923 | $viewType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
924 | 924 | $oLayoutAdminModel = getAdminModel('layout'); |
925 | 925 | $layout_srl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $oModule->module_info->site_srl); |
926 | 926 | } |
927 | 927 | |
928 | - if($layout_srl && !$oModule->getLayoutFile()) |
|
928 | + if ($layout_srl && !$oModule->getLayoutFile()) |
|
929 | 929 | { |
930 | 930 | |
931 | 931 | // If layout_srl exists, get information of the layout, and set the location of layout_path/ layout_file |
932 | 932 | $oLayoutModel = getModel('layout'); |
933 | 933 | $layout_info = $oLayoutModel->getLayout($layout_srl); |
934 | - if($layout_info) |
|
934 | + if ($layout_info) |
|
935 | 935 | { |
936 | 936 | |
937 | 937 | // Input extra_vars into $layout_info |
938 | - if($layout_info->extra_var_count) |
|
938 | + if ($layout_info->extra_var_count) |
|
939 | 939 | { |
940 | 940 | |
941 | - foreach($layout_info->extra_var as $var_id => $val) |
|
941 | + foreach ($layout_info->extra_var as $var_id => $val) |
|
942 | 942 | { |
943 | - if($val->type == 'image') |
|
943 | + if ($val->type == 'image') |
|
944 | 944 | { |
945 | - if(strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
945 | + if (strncmp('./files/attach/images/', $val->value, 22) === 0) |
|
946 | 946 | { |
947 | 947 | $val->value = Context::getRequestUri() . substr($val->value, 2); |
948 | 948 | } |
@@ -951,22 +951,22 @@ discard block |
||
951 | 951 | } |
952 | 952 | } |
953 | 953 | // Set menus into context |
954 | - if($layout_info->menu_count) |
|
954 | + if ($layout_info->menu_count) |
|
955 | 955 | { |
956 | - foreach($layout_info->menu as $menu_id => $menu) |
|
956 | + foreach ($layout_info->menu as $menu_id => $menu) |
|
957 | 957 | { |
958 | 958 | // set default menu set(included home menu) |
959 | - if(!$menu->menu_srl || $menu->menu_srl == -1) |
|
959 | + if (!$menu->menu_srl || $menu->menu_srl == -1) |
|
960 | 960 | { |
961 | 961 | $oMenuAdminController = getAdminController('menu'); |
962 | 962 | $homeMenuCacheFile = $oMenuAdminController->getHomeMenuCacheFile(); |
963 | 963 | |
964 | - if(FileHandler::exists($homeMenuCacheFile)) |
|
964 | + if (FileHandler::exists($homeMenuCacheFile)) |
|
965 | 965 | { |
966 | 966 | include($homeMenuCacheFile); |
967 | 967 | } |
968 | 968 | |
969 | - if(!$menu->menu_srl) |
|
969 | + if (!$menu->menu_srl) |
|
970 | 970 | { |
971 | 971 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
972 | 972 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | } |
981 | 981 | |
982 | 982 | $php_file = FileHandler::exists($menu->php_file); |
983 | - if($php_file) |
|
983 | + if ($php_file) |
|
984 | 984 | { |
985 | 985 | include($php_file); |
986 | 986 | } |
@@ -996,17 +996,17 @@ discard block |
||
996 | 996 | |
997 | 997 | // If layout was modified, use the modified version |
998 | 998 | $edited_layout = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); |
999 | - if(file_exists($edited_layout)) |
|
999 | + if (file_exists($edited_layout)) |
|
1000 | 1000 | { |
1001 | 1001 | $oModule->setEditedLayoutFile($edited_layout); |
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | $isLayoutDrop = Context::get('isLayoutDrop'); |
1006 | - if($isLayoutDrop) |
|
1006 | + if ($isLayoutDrop) |
|
1007 | 1007 | { |
1008 | 1008 | $kind = stripos($this->act, 'admin') !== FALSE ? 'admin' : ''; |
1009 | - if($kind == 'admin') |
|
1009 | + if ($kind == 'admin') |
|
1010 | 1010 | { |
1011 | 1011 | $oModule->setLayoutFile('popup_layout'); |
1012 | 1012 | } |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | function &getModuleInstance($module, $type = 'view', $kind = '') |
1045 | 1045 | { |
1046 | 1046 | |
1047 | - if(__DEBUG__ == 3) |
|
1047 | + if (__DEBUG__ == 3) |
|
1048 | 1048 | { |
1049 | 1049 | $start_time = getMicroTime(); |
1050 | 1050 | } |
@@ -1054,49 +1054,49 @@ discard block |
||
1054 | 1054 | $type = strtolower($type); |
1055 | 1055 | |
1056 | 1056 | $kinds = array('svc' => 1, 'admin' => 1); |
1057 | - if(!isset($kinds[$kind])) |
|
1057 | + if (!isset($kinds[$kind])) |
|
1058 | 1058 | { |
1059 | 1059 | $kind = 'svc'; |
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | $key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type; |
1063 | 1063 | |
1064 | - if(is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1064 | + if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) |
|
1065 | 1065 | { |
1066 | 1066 | $module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key]; |
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // if there is no instance of the module in global variable, create a new one |
1070 | - if(!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1070 | + if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) |
|
1071 | 1071 | { |
1072 | 1072 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1073 | 1073 | |
1074 | - if($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1074 | + if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) |
|
1075 | 1075 | { |
1076 | 1076 | $module = $parent_module; |
1077 | 1077 | ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name); |
1078 | 1078 | } |
1079 | 1079 | |
1080 | 1080 | // Check if the base class and instance class exist |
1081 | - if(!class_exists($module, true)) |
|
1081 | + if (!class_exists($module, true)) |
|
1082 | 1082 | { |
1083 | 1083 | return NULL; |
1084 | 1084 | } |
1085 | - if(!class_exists($instance_name, true)) |
|
1085 | + if (!class_exists($instance_name, true)) |
|
1086 | 1086 | { |
1087 | 1087 | return NULL; |
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | // Create an instance |
1091 | 1091 | $oModule = new $instance_name(); |
1092 | - if(!is_object($oModule)) |
|
1092 | + if (!is_object($oModule)) |
|
1093 | 1093 | { |
1094 | 1094 | return NULL; |
1095 | 1095 | } |
1096 | 1096 | |
1097 | 1097 | // Load language files for the class |
1098 | 1098 | Context::loadLang($class_path . 'lang'); |
1099 | - if($extend_module) |
|
1099 | + if ($extend_module) |
|
1100 | 1100 | { |
1101 | 1101 | Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang'); |
1102 | 1102 | } |
@@ -1106,10 +1106,10 @@ discard block |
||
1106 | 1106 | $oModule->setModulePath($class_path); |
1107 | 1107 | |
1108 | 1108 | // If the module has a constructor, run it. |
1109 | - if(!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1109 | + if (!isset($GLOBALS['_called_constructor'][$instance_name])) |
|
1110 | 1110 | { |
1111 | 1111 | $GLOBALS['_called_constructor'][$instance_name] = TRUE; |
1112 | - if(@method_exists($oModule, $instance_name)) |
|
1112 | + if (@method_exists($oModule, $instance_name)) |
|
1113 | 1113 | { |
1114 | 1114 | $oModule->{$instance_name}(); |
1115 | 1115 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | $GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule; |
1120 | 1120 | } |
1121 | 1121 | |
1122 | - if(__DEBUG__ == 3) |
|
1122 | + if (__DEBUG__ == 3) |
|
1123 | 1123 | { |
1124 | 1124 | $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time; |
1125 | 1125 | } |
@@ -1135,17 +1135,17 @@ discard block |
||
1135 | 1135 | $highClassFile = sprintf('%s%s%s.class.php', _XE_PATH_, $classPath, $module); |
1136 | 1136 | $highClassFile = FileHandler::getRealPath($highClassFile); |
1137 | 1137 | |
1138 | - $types = array('view','controller','model','api','wap','mobile','class'); |
|
1139 | - if(!in_array($type, $types)) |
|
1138 | + $types = array('view', 'controller', 'model', 'api', 'wap', 'mobile', 'class'); |
|
1139 | + if (!in_array($type, $types)) |
|
1140 | 1140 | { |
1141 | 1141 | $type = $types[0]; |
1142 | 1142 | } |
1143 | - if($type == 'class') |
|
1143 | + if ($type == 'class') |
|
1144 | 1144 | { |
1145 | 1145 | $instanceName = '%s'; |
1146 | 1146 | $classFile = '%s%s.%s.php'; |
1147 | 1147 | } |
1148 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1148 | + elseif ($kind == 'admin' && array_search($type, $types) < 3) |
|
1149 | 1149 | { |
1150 | 1150 | $instanceName = '%sAdmin%s'; |
1151 | 1151 | $classFile = '%s%s.admin.%s.php'; |
@@ -1170,26 +1170,26 @@ discard block |
||
1170 | 1170 | function triggerCall($trigger_name, $called_position, &$obj) |
1171 | 1171 | { |
1172 | 1172 | // skip if not installed |
1173 | - if(!Context::isInstalled()) |
|
1173 | + if (!Context::isInstalled()) |
|
1174 | 1174 | { |
1175 | 1175 | return new Object(); |
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | $oModuleModel = getModel('module'); |
1179 | 1179 | $triggers = $oModuleModel->getTriggers($trigger_name, $called_position); |
1180 | - if(!$triggers || count($triggers) < 1) |
|
1180 | + if (!$triggers || count($triggers) < 1) |
|
1181 | 1181 | { |
1182 | 1182 | return new Object(); |
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | //store before trigger call time |
1186 | 1186 | $before_trigger_time = NULL; |
1187 | - if(__LOG_SLOW_TRIGGER__> 0) |
|
1187 | + if (__LOG_SLOW_TRIGGER__ > 0) |
|
1188 | 1188 | { |
1189 | 1189 | $before_trigger_time = microtime(true); |
1190 | 1190 | } |
1191 | 1191 | |
1192 | - foreach($triggers as $item) |
|
1192 | + foreach ($triggers as $item) |
|
1193 | 1193 | { |
1194 | 1194 | $module = $item->module; |
1195 | 1195 | $type = $item->type; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | // todo why don't we call a normal class object ? |
1199 | 1199 | $oModule = getModule($module, $type); |
1200 | - if(!$oModule || !method_exists($oModule, $called_method)) |
|
1200 | + if (!$oModule || !method_exists($oModule, $called_method)) |
|
1201 | 1201 | { |
1202 | 1202 | continue; |
1203 | 1203 | } |
@@ -1213,9 +1213,9 @@ discard block |
||
1213 | 1213 | $slowlog->caller = $trigger_name . '.' . $called_position; |
1214 | 1214 | $slowlog->called = $module . '.' . $called_method; |
1215 | 1215 | $slowlog->called_extension = $module; |
1216 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1216 | + if ($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1217 | 1217 | |
1218 | - if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1218 | + if (is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
|
1219 | 1219 | { |
1220 | 1220 | return $output; |
1221 | 1221 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | '505' => 'HTTP Version Not Supported', |
1276 | 1276 | ); |
1277 | 1277 | $statusMessage = $statusMessageList[$code]; |
1278 | - if(!$statusMessage) |
|
1278 | + if (!$statusMessage) |
|
1279 | 1279 | { |
1280 | 1280 | $statusMessage = 'OK'; |
1281 | 1281 | } |
@@ -107,7 +107,9 @@ discard block |
||
107 | 107 | $called_position = 'before_module_init'; |
108 | 108 | $oAddonController = getController('addon'); |
109 | 109 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? 'mobile' : 'pc'); |
110 | - if(file_exists($addon_file)) include($addon_file); |
|
110 | + if(file_exists($addon_file)) { |
|
111 | + include($addon_file); |
|
112 | + } |
|
111 | 113 | } |
112 | 114 | |
113 | 115 | /** |
@@ -160,8 +162,7 @@ discard block |
||
160 | 162 | if(!$module_info) |
161 | 163 | { |
162 | 164 | unset($this->document_srl); |
163 | - } |
|
164 | - else |
|
165 | + } else |
|
165 | 166 | { |
166 | 167 | // If it exists, compare mid based on the module information |
167 | 168 | // if mids are not matching, set it as the document's mid |
@@ -173,8 +174,7 @@ discard block |
||
173 | 174 | $this->mid = $module_info->mid; |
174 | 175 | header('location:' . getNotEncodedSiteUrl($site_module_info->domain, 'mid', $this->mid, 'document_srl', $this->document_srl)); |
175 | 176 | return FALSE; |
176 | - } |
|
177 | - else |
|
177 | + } else |
|
178 | 178 | { |
179 | 179 | $this->mid = $module_info->mid; |
180 | 180 | Context::set('mid', $this->mid); |
@@ -225,15 +225,13 @@ discard block |
||
225 | 225 | $site_info = $oModuleModel->getSiteInfo($module_info->site_srl); |
226 | 226 | $redirect_url = getNotEncodedSiteUrl($site_info->domain, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
227 | 227 | // If it's called from a virtual site, though it's not a module of the virtual site |
228 | - } |
|
229 | - else |
|
228 | + } else |
|
230 | 229 | { |
231 | 230 | $db_info = Context::getDBInfo(); |
232 | 231 | if(!$db_info->default_url) |
233 | 232 | { |
234 | 233 | return Context::getLang('msg_default_url_is_not_defined'); |
235 | - } |
|
236 | - else |
|
234 | + } else |
|
237 | 235 | { |
238 | 236 | $redirect_url = getNotEncodedSiteUrl($db_info->default_url, 'mid', Context::get('mid'), 'document_srl', Context::get('document_srl'), 'module_srl', Context::get('module_srl'), 'entry', Context::get('entry')); |
239 | 237 | } |
@@ -258,8 +256,7 @@ discard block |
||
258 | 256 | { |
259 | 257 | $oLayoutAdminModel = getAdminModel('layout'); |
260 | 258 | $layoutSrl = $oLayoutAdminModel->getSiteDefaultLayout($viewType, $module_info->site_srl); |
261 | - } |
|
262 | - else |
|
259 | + } else |
|
263 | 260 | { |
264 | 261 | $layoutSrl = $module_info->{$targetSrl}; |
265 | 262 | } |
@@ -386,8 +383,7 @@ discard block |
||
386 | 383 | if(!$allowedMethod) |
387 | 384 | { |
388 | 385 | $allowedMethodList[0] = 'POST'; |
389 | - } |
|
390 | - else |
|
386 | + } else |
|
391 | 387 | { |
392 | 388 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
393 | 389 | } |
@@ -445,8 +441,7 @@ discard block |
||
445 | 441 | Mobile::setMobile(FALSE); |
446 | 442 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
447 | 443 | } |
448 | - } |
|
449 | - else |
|
444 | + } else |
|
450 | 445 | { |
451 | 446 | // create a module instance |
452 | 447 | $oModule = $this->getModuleInstance($this->module, $type, $kind); |
@@ -499,8 +494,7 @@ discard block |
||
499 | 494 | $forward->type = $xml_info->action->{$this->act}->type; |
500 | 495 | $forward->ruleset = $xml_info->action->{$this->act}->ruleset; |
501 | 496 | $forward->act = $this->act; |
502 | - } |
|
503 | - else |
|
497 | + } else |
|
504 | 498 | { |
505 | 499 | $this->error = 'msg_invalid_request'; |
506 | 500 | $oMessageObject = ModuleHandler::getModuleInstance('message', $display_mode); |
@@ -536,8 +530,7 @@ discard block |
||
536 | 530 | if(!$allowedMethod) |
537 | 531 | { |
538 | 532 | $allowedMethodList[0] = 'POST'; |
539 | - } |
|
540 | - else |
|
533 | + } else |
|
541 | 534 | { |
542 | 535 | $allowedMethodList = explode('|', strtoupper($allowedMethod)); |
543 | 536 | } |
@@ -565,8 +558,7 @@ discard block |
||
565 | 558 | Mobile::setMobile(FALSE); |
566 | 559 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
567 | 560 | } |
568 | - } |
|
569 | - else |
|
561 | + } else |
|
570 | 562 | { |
571 | 563 | $oModule = $this->getModuleInstance($forward->module, $type, $kind); |
572 | 564 | } |
@@ -596,8 +588,7 @@ discard block |
||
596 | 588 | $oModule->setLayoutPath("./modules/admin/tpl"); |
597 | 589 | $oModule->setLayoutFile("layout.html"); |
598 | 590 | } |
599 | - } |
|
600 | - else |
|
591 | + } else |
|
601 | 592 | { |
602 | 593 | $this->_setInputErrorToContext(); |
603 | 594 | |
@@ -621,8 +612,7 @@ discard block |
||
621 | 612 | $oMessageObject->setMessage($this->error); |
622 | 613 | $oMessageObject->dispMessage(); |
623 | 614 | return $oMessageObject; |
624 | - } |
|
625 | - else |
|
615 | + } else |
|
626 | 616 | { |
627 | 617 | if(!$grant->is_admin && $this->module != $this->orig_module->module && $xml_info->permission->{$this->act} != 'manager') |
628 | 618 | { |
@@ -636,12 +626,10 @@ discard block |
||
636 | 626 | } |
637 | 627 | } |
638 | 628 | } |
639 | - } |
|
640 | - else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
629 | + } else if($xml_info->default_index_act && method_exists($oModule, $xml_info->default_index_act)) |
|
641 | 630 | { |
642 | 631 | $this->act = $xml_info->default_index_act; |
643 | - } |
|
644 | - else |
|
632 | + } else |
|
645 | 633 | { |
646 | 634 | $this->error = 'msg_invalid_request'; |
647 | 635 | $oModule->setError(-1); |
@@ -739,7 +727,9 @@ discard block |
||
739 | 727 | $message = $oModule->getMessage(); |
740 | 728 | $messageType = $oModule->getMessageType(); |
741 | 729 | $redirectUrl = $oModule->getRedirectUrl(); |
742 | - if($messageType == 'error') debugPrint($message, 'ERROR'); |
|
730 | + if($messageType == 'error') { |
|
731 | + debugPrint($message, 'ERROR'); |
|
732 | + } |
|
743 | 733 | |
744 | 734 | if(!$procResult) |
745 | 735 | { |
@@ -749,8 +739,7 @@ discard block |
||
749 | 739 | $redirectUrl = Context::get('error_return_url'); |
750 | 740 | } |
751 | 741 | $this->_setInputValueToSession(); |
752 | - } |
|
753 | - else |
|
742 | + } else |
|
754 | 743 | { |
755 | 744 | |
756 | 745 | } |
@@ -898,8 +887,7 @@ discard block |
||
898 | 887 | $oModule->setTemplatePath($oMessageObject->getTemplatePath()); |
899 | 888 | $oModule->setTemplateFile($oMessageObject->getTemplateFile()); |
900 | 889 | // Otherwise, set message instance as the target module |
901 | - } |
|
902 | - else |
|
890 | + } else |
|
903 | 891 | { |
904 | 892 | $oModule = $oMessageObject; |
905 | 893 | } |
@@ -911,8 +899,7 @@ discard block |
||
911 | 899 | if(Mobile::isFromMobilePhone()) |
912 | 900 | { |
913 | 901 | $layout_srl = $oModule->module_info->mlayout_srl; |
914 | - } |
|
915 | - else |
|
902 | + } else |
|
916 | 903 | { |
917 | 904 | $layout_srl = $oModule->module_info->layout_srl; |
918 | 905 | } |
@@ -971,8 +958,7 @@ discard block |
||
971 | 958 | $menu->xml_file = str_replace('.xml.php', $homeMenuSrl . '.xml.php', $menu->xml_file); |
972 | 959 | $menu->php_file = str_replace('.php', $homeMenuSrl . '.php', $menu->php_file); |
973 | 960 | $layout_info->menu->{$menu_id}->menu_srl = $homeMenuSrl; |
974 | - } |
|
975 | - else |
|
961 | + } else |
|
976 | 962 | { |
977 | 963 | $menu->xml_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->xml_file); |
978 | 964 | $menu->php_file = str_replace($menu->menu_srl, $homeMenuSrl, $menu->php_file); |
@@ -1009,8 +995,7 @@ discard block |
||
1009 | 995 | if($kind == 'admin') |
1010 | 996 | { |
1011 | 997 | $oModule->setLayoutFile('popup_layout'); |
1012 | - } |
|
1013 | - else |
|
998 | + } else |
|
1014 | 999 | { |
1015 | 1000 | $oModule->setLayoutPath('common/tpl'); |
1016 | 1001 | $oModule->setLayoutFile('default_layout'); |
@@ -1144,13 +1129,11 @@ discard block |
||
1144 | 1129 | { |
1145 | 1130 | $instanceName = '%s'; |
1146 | 1131 | $classFile = '%s%s.%s.php'; |
1147 | - } |
|
1148 | - elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1132 | + } elseif($kind == 'admin' && array_search($type, $types) < 3) |
|
1149 | 1133 | { |
1150 | 1134 | $instanceName = '%sAdmin%s'; |
1151 | 1135 | $classFile = '%s%s.admin.%s.php'; |
1152 | - } |
|
1153 | - else |
|
1136 | + } else |
|
1154 | 1137 | { |
1155 | 1138 | $instanceName = '%s%s'; |
1156 | 1139 | $classFile = '%s%s.%s.php'; |
@@ -1213,7 +1196,9 @@ discard block |
||
1213 | 1196 | $slowlog->caller = $trigger_name . '.' . $called_position; |
1214 | 1197 | $slowlog->called = $module . '.' . $called_method; |
1215 | 1198 | $slowlog->called_extension = $module; |
1216 | - if($trigger_name != 'XE.writeSlowlog') writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1199 | + if($trigger_name != 'XE.writeSlowlog') { |
|
1200 | + writeSlowlog('trigger', $elapsed_time_trigger, $slowlog); |
|
1201 | + } |
|
1217 | 1202 | |
1218 | 1203 | if(is_object($output) && method_exists($output, 'toBool') && !$output->toBool()) |
1219 | 1204 | { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | /** |
143 | 143 | * sett to set module information |
144 | - * @param object $module_info object containing module information |
|
144 | + * @param stdClass $module_info object containing module information |
|
145 | 145 | * @param object $xml_info object containing module description |
146 | 146 | * @return void |
147 | 147 | * */ |
@@ -247,6 +247,7 @@ discard block |
||
247 | 247 | /** |
248 | 248 | * set the file name of the template file |
249 | 249 | * @param string name of file |
250 | + * @param string $filename |
|
250 | 251 | * @return void |
251 | 252 | * */ |
252 | 253 | function setTemplateFile($filename) |
@@ -270,6 +271,7 @@ discard block |
||
270 | 271 | /** |
271 | 272 | * set the directory path of the template directory |
272 | 273 | * @param string path of template directory. |
274 | + * @param string $path |
|
273 | 275 | * @return void |
274 | 276 | * */ |
275 | 277 | function setTemplatePath($path) |
@@ -325,6 +327,7 @@ discard block |
||
325 | 327 | /** |
326 | 328 | * set the file name of the layout file |
327 | 329 | * @param string name of file |
330 | + * @param string $filename |
|
328 | 331 | * @return void |
329 | 332 | * */ |
330 | 333 | function setLayoutFile($filename) |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * */ |
45 | 45 | function setModulePath($path) |
46 | 46 | { |
47 | - if(substr_compare($path, '/', -1) !== 0) |
|
47 | + if (substr_compare($path, '/', -1) !== 0) |
|
48 | 48 | { |
49 | - $path.='/'; |
|
49 | + $path .= '/'; |
|
50 | 50 | } |
51 | 51 | $this->module_path = $path; |
52 | 52 | } |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | function setRedirectUrl($url = './', $output = NULL) |
61 | 61 | { |
62 | 62 | $ajaxRequestMethod = array_flip($this->ajaxRequestMethod); |
63 | - if(!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
63 | + if (!isset($ajaxRequestMethod[Context::getRequestMethod()])) |
|
64 | 64 | { |
65 | 65 | $this->add('redirect_url', $url); |
66 | 66 | } |
67 | 67 | |
68 | - if($output !== NULL && is_object($output)) |
|
68 | + if ($output !== NULL && is_object($output)) |
|
69 | 69 | { |
70 | 70 | return $output; |
71 | 71 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | { |
111 | 111 | $type = $this->get('message_type'); |
112 | 112 | $typeList = array('error' => 1, 'info' => 1, 'update' => 1); |
113 | - if(!isset($typeList[$type])) |
|
113 | + if (!isset($typeList[$type])) |
|
114 | 114 | { |
115 | 115 | $type = $this->getError() ? 'error' : 'info'; |
116 | 116 | } |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | $oModuleModel = getModel('module'); |
162 | 162 | // permission settings. access, manager(== is_admin) are fixed and privilege name in XE |
163 | 163 | $module_srl = Context::get('module_srl'); |
164 | - if(!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
164 | + if (!$module_info->mid && !is_array($module_srl) && preg_match('/^([0-9]+)$/', $module_srl)) |
|
165 | 165 | { |
166 | 166 | $request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl); |
167 | - if($request_module->module_srl == $module_srl) |
|
167 | + if ($request_module->module_srl == $module_srl) |
|
168 | 168 | { |
169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
170 | 170 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
175 | 175 | // have at least access grant |
176 | - if(substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
176 | + if (substr_count($this->act, 'Member') || substr_count($this->act, 'Communication')) |
|
177 | 177 | { |
178 | 178 | $grant->access = 1; |
179 | 179 | } |
@@ -181,24 +181,24 @@ discard block |
||
181 | 181 | // display no permission if the current module doesn't have an access privilege |
182 | 182 | //if(!$grant->access) return $this->stop("msg_not_permitted"); |
183 | 183 | // checks permission and action if you don't have an admin privilege |
184 | - if(!$grant->manager) |
|
184 | + if (!$grant->manager) |
|
185 | 185 | { |
186 | 186 | // get permission types(guest, member, manager, root) of the currently requested action |
187 | 187 | $permission_target = $xml_info->permission->{$this->act}; |
188 | 188 | // check manager if a permission in module.xml otherwise action if no permission |
189 | - if(!$permission_target && substr_count($this->act, 'Admin')) |
|
189 | + if (!$permission_target && substr_count($this->act, 'Admin')) |
|
190 | 190 | { |
191 | 191 | $permission_target = 'manager'; |
192 | 192 | } |
193 | 193 | // Check permissions |
194 | - switch($permission_target) |
|
194 | + switch ($permission_target) |
|
195 | 195 | { |
196 | 196 | case 'root' : |
197 | 197 | case 'manager' : |
198 | 198 | $this->stop('msg_is_not_administrator'); |
199 | 199 | return; |
200 | 200 | case 'member' : |
201 | - if(!$is_logged) |
|
201 | + if (!$is_logged) |
|
202 | 202 | { |
203 | 203 | $this->stop('msg_not_permitted_act'); |
204 | 204 | return; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | $this->module_config = $oModuleModel->getModuleConfig($this->module, $module_info->site_srl); |
215 | 215 | |
216 | - if(method_exists($this, 'init')) |
|
216 | + if (method_exists($this, 'init')) |
|
217 | 217 | { |
218 | 218 | $this->init(); |
219 | 219 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | * */ |
252 | 252 | function setTemplateFile($filename) |
253 | 253 | { |
254 | - if(isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
254 | + if (isset($filename) && substr_compare($filename, '.html', -5) !== 0) |
|
255 | 255 | { |
256 | 256 | $filename .= '.html'; |
257 | 257 | } |
@@ -274,14 +274,14 @@ discard block |
||
274 | 274 | * */ |
275 | 275 | function setTemplatePath($path) |
276 | 276 | { |
277 | - if(!$path) return; |
|
277 | + if (!$path) return; |
|
278 | 278 | |
279 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
279 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
280 | 280 | { |
281 | 281 | $path = './' . $path; |
282 | 282 | } |
283 | 283 | |
284 | - if(substr_compare($path, '/', -1) !== 0) |
|
284 | + if (substr_compare($path, '/', -1) !== 0) |
|
285 | 285 | { |
286 | 286 | $path .= '/'; |
287 | 287 | } |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | * */ |
305 | 305 | function setEditedLayoutFile($filename) |
306 | 306 | { |
307 | - if(!$filename) return; |
|
307 | + if (!$filename) return; |
|
308 | 308 | |
309 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
309 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
310 | 310 | { |
311 | 311 | $filename .= '.html'; |
312 | 312 | } |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | * */ |
330 | 330 | function setLayoutFile($filename) |
331 | 331 | { |
332 | - if(!$filename) return; |
|
332 | + if (!$filename) return; |
|
333 | 333 | |
334 | - if(substr_compare($filename, '.html', -5) !== 0) |
|
334 | + if (substr_compare($filename, '.html', -5) !== 0) |
|
335 | 335 | { |
336 | 336 | $filename .= '.html'; |
337 | 337 | } |
@@ -353,13 +353,13 @@ discard block |
||
353 | 353 | * */ |
354 | 354 | function setLayoutPath($path) |
355 | 355 | { |
356 | - if(!$path) return; |
|
356 | + if (!$path) return; |
|
357 | 357 | |
358 | - if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
358 | + if ((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
|
359 | 359 | { |
360 | 360 | $path = './' . $path; |
361 | 361 | } |
362 | - if(substr_compare($path, '/', -1) !== 0) |
|
362 | + if (substr_compare($path, '/', -1) !== 0) |
|
363 | 363 | { |
364 | 364 | $path .= '/'; |
365 | 365 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | function proc() |
383 | 383 | { |
384 | 384 | // pass if stop_proc is true |
385 | - if($this->stop_proc) |
|
385 | + if ($this->stop_proc) |
|
386 | 386 | { |
387 | 387 | debugPrint($this->message, 'ERROR'); |
388 | 388 | return FALSE; |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | // trigger call |
392 | 392 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'before', $this); |
393 | - if(!$triggerOutput->toBool()) |
|
393 | + if (!$triggerOutput->toBool()) |
|
394 | 394 | { |
395 | 395 | $this->setError($triggerOutput->getError()); |
396 | 396 | $this->setMessage($triggerOutput->getMessage()); |
@@ -401,12 +401,12 @@ discard block |
||
401 | 401 | $called_position = 'before_module_proc'; |
402 | 402 | $oAddonController = getController('addon'); |
403 | 403 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
404 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
405 | 405 | |
406 | - if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
406 | + if (isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
|
407 | 407 | { |
408 | 408 | // Check permissions |
409 | - if($this->module_srl && !$this->grant->access) |
|
409 | + if ($this->module_srl && !$this->grant->access) |
|
410 | 410 | { |
411 | 411 | $this->stop("msg_not_permitted_act"); |
412 | 412 | return FALSE; |
@@ -415,21 +415,21 @@ discard block |
||
415 | 415 | // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) |
416 | 416 | $is_default_skin = ((!Mobile::isFromMobilePhone() && $this->module_info->is_skin_fix == 'N') || (Mobile::isFromMobilePhone() && $this->module_info->is_mskin_fix == 'N')); |
417 | 417 | $usedSkinModule = !($this->module == 'page' && ($this->module_info->page_type == 'OUTSIDE' || $this->module_info->page_type == 'WIDGET')); |
418 | - if($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
418 | + if ($usedSkinModule && $is_default_skin && $this->module != 'admin' && strpos($this->act, 'Admin') === false && $this->module == $this->module_info->module) |
|
419 | 419 | { |
420 | 420 | $dir = (Mobile::isFromMobilePhone()) ? 'm.skins' : 'skins'; |
421 | 421 | $valueName = (Mobile::isFromMobilePhone()) ? 'mskin' : 'skin'; |
422 | 422 | $oModuleModel = getModel('module'); |
423 | 423 | $skinType = (Mobile::isFromMobilePhone()) ? 'M' : 'P'; |
424 | 424 | $skinName = $oModuleModel->getModuleDefaultSkin($this->module, $skinType); |
425 | - if($this->module == 'page') |
|
425 | + if ($this->module == 'page') |
|
426 | 426 | { |
427 | 427 | $this->module_info->{$valueName} = $skinName; |
428 | 428 | } |
429 | 429 | else |
430 | 430 | { |
431 | 431 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
432 | - if(!$isTemplatPath) |
|
432 | + if (!$isTemplatPath) |
|
433 | 433 | { |
434 | 434 | $this->setTemplatePath(sprintf('%s%s/%s/', $this->module_path, $dir, $skinName)); |
435 | 435 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | // trigger call |
451 | 451 | $triggerOutput = ModuleHandler::triggerCall('moduleObject.proc', 'after', $this); |
452 | - if(!$triggerOutput->toBool()) |
|
452 | + if (!$triggerOutput->toBool()) |
|
453 | 453 | { |
454 | 454 | $this->setError($triggerOutput->getError()); |
455 | 455 | $this->setMessage($triggerOutput->getMessage()); |
@@ -460,25 +460,25 @@ discard block |
||
460 | 460 | $called_position = 'after_module_proc'; |
461 | 461 | $oAddonController = getController('addon'); |
462 | 462 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
463 | + if (FileHandler::exists($addon_file)) include($addon_file); |
|
464 | 464 | |
465 | - if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) |
|
465 | + if (is_a($output, 'Object') || is_subclass_of($output, 'Object')) |
|
466 | 466 | { |
467 | 467 | $this->setError($output->getError()); |
468 | 468 | $this->setMessage($output->getMessage()); |
469 | 469 | |
470 | - if(!$output->toBool()) |
|
470 | + if (!$output->toBool()) |
|
471 | 471 | { |
472 | 472 | return FALSE; |
473 | 473 | } |
474 | 474 | } |
475 | 475 | // execute api methos of the module if view action is and result is XMLRPC or JSON |
476 | - if($this->module_info->module_type == 'view') |
|
476 | + if ($this->module_info->module_type == 'view') |
|
477 | 477 | { |
478 | - if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
478 | + if (Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') |
|
479 | 479 | { |
480 | 480 | $oAPI = getAPI($this->module_info->module, 'api'); |
481 | - if(method_exists($oAPI, $this->act)) |
|
481 | + if (method_exists($oAPI, $this->act)) |
|
482 | 482 | { |
483 | 483 | $oAPI->{$this->act}($this); |
484 | 484 | } |
@@ -168,8 +168,7 @@ discard block |
||
168 | 168 | { |
169 | 169 | $grant = $oModuleModel->getGrant($request_module, $logged_info); |
170 | 170 | } |
171 | - } |
|
172 | - else |
|
171 | + } else |
|
173 | 172 | { |
174 | 173 | $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); |
175 | 174 | // have at least access grant |
@@ -274,7 +273,9 @@ discard block |
||
274 | 273 | * */ |
275 | 274 | function setTemplatePath($path) |
276 | 275 | { |
277 | - if(!$path) return; |
|
276 | + if(!$path) { |
|
277 | + return; |
|
278 | + } |
|
278 | 279 | |
279 | 280 | if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
280 | 281 | { |
@@ -304,7 +305,9 @@ discard block |
||
304 | 305 | * */ |
305 | 306 | function setEditedLayoutFile($filename) |
306 | 307 | { |
307 | - if(!$filename) return; |
|
308 | + if(!$filename) { |
|
309 | + return; |
|
310 | + } |
|
308 | 311 | |
309 | 312 | if(substr_compare($filename, '.html', -5) !== 0) |
310 | 313 | { |
@@ -329,7 +332,9 @@ discard block |
||
329 | 332 | * */ |
330 | 333 | function setLayoutFile($filename) |
331 | 334 | { |
332 | - if(!$filename) return; |
|
335 | + if(!$filename) { |
|
336 | + return; |
|
337 | + } |
|
333 | 338 | |
334 | 339 | if(substr_compare($filename, '.html', -5) !== 0) |
335 | 340 | { |
@@ -353,7 +358,9 @@ discard block |
||
353 | 358 | * */ |
354 | 359 | function setLayoutPath($path) |
355 | 360 | { |
356 | - if(!$path) return; |
|
361 | + if(!$path) { |
|
362 | + return; |
|
363 | + } |
|
357 | 364 | |
358 | 365 | if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0)) |
359 | 366 | { |
@@ -401,7 +408,9 @@ discard block |
||
401 | 408 | $called_position = 'before_module_proc'; |
402 | 409 | $oAddonController = getController('addon'); |
403 | 410 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
404 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
411 | + if(FileHandler::exists($addon_file)) { |
|
412 | + include($addon_file); |
|
413 | + } |
|
405 | 414 | |
406 | 415 | if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) |
407 | 416 | { |
@@ -425,8 +434,7 @@ discard block |
||
425 | 434 | if($this->module == 'page') |
426 | 435 | { |
427 | 436 | $this->module_info->{$valueName} = $skinName; |
428 | - } |
|
429 | - else |
|
437 | + } else |
|
430 | 438 | { |
431 | 439 | $isTemplatPath = (strpos($this->getTemplatePath(), '/tpl/') !== FALSE); |
432 | 440 | if(!$isTemplatPath) |
@@ -441,8 +449,7 @@ discard block |
||
441 | 449 | Context::set('module_info', $this->module_info); |
442 | 450 | // Run |
443 | 451 | $output = $this->{$this->act}(); |
444 | - } |
|
445 | - else |
|
452 | + } else |
|
446 | 453 | { |
447 | 454 | return FALSE; |
448 | 455 | } |
@@ -460,7 +467,9 @@ discard block |
||
460 | 467 | $called_position = 'after_module_proc'; |
461 | 468 | $oAddonController = getController('addon'); |
462 | 469 | $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone() ? "mobile" : "pc"); |
463 | - if(FileHandler::exists($addon_file)) include($addon_file); |
|
470 | + if(FileHandler::exists($addon_file)) { |
|
471 | + include($addon_file); |
|
472 | + } |
|
464 | 473 | |
465 | 474 | if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) |
466 | 475 | { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * Method to retrieve an object containing a key/value pairs |
169 | 169 | * |
170 | - * @return Object Returns an object containing key/value pairs |
|
170 | + * @return stdClass Returns an object containing key/value pairs |
|
171 | 171 | */ |
172 | 172 | function gets() |
173 | 173 | { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * Method to retrieve an object of key/value pairs |
195 | 195 | * |
196 | - * @return Object |
|
196 | + * @return stdClass |
|
197 | 197 | */ |
198 | 198 | function getObjectVars() |
199 | 199 | { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function setMessage($message = 'success') |
98 | 98 | { |
99 | - if($str = Context::getLang($message)) |
|
99 | + if ($str = Context::getLang($message)) |
|
100 | 100 | { |
101 | 101 | $this->message = $str; |
102 | 102 | } |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | */ |
140 | 140 | function adds($object) |
141 | 141 | { |
142 | - if(is_object($object)) |
|
142 | + if (is_object($object)) |
|
143 | 143 | { |
144 | 144 | $object = get_object_vars($object); |
145 | 145 | } |
146 | 146 | |
147 | - if(is_array($object)) |
|
147 | + if (is_array($object)) |
|
148 | 148 | { |
149 | - foreach($object as $key => $val) |
|
149 | + foreach ($object as $key => $val) |
|
150 | 150 | { |
151 | 151 | $this->variables[$key] = $val; |
152 | 152 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $args = func_get_args(); |
175 | 175 | $output = new stdClass(); |
176 | - foreach($args as $arg) |
|
176 | + foreach ($args as $arg) |
|
177 | 177 | { |
178 | 178 | $output->{$arg} = $this->get($arg); |
179 | 179 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | function getObjectVars() |
199 | 199 | { |
200 | 200 | $output = new stdClass(); |
201 | - foreach($this->variables as $key => $val) |
|
201 | + foreach ($this->variables as $key => $val) |
|
202 | 202 | { |
203 | 203 | $output->{$key} = $val; |
204 | 204 | } |
@@ -99,8 +99,7 @@ |
||
99 | 99 | if($str = Context::getLang($message)) |
100 | 100 | { |
101 | 101 | $this->message = $str; |
102 | - } |
|
103 | - else |
|
102 | + } else |
|
104 | 103 | { |
105 | 104 | $this->message = $message; |
106 | 105 | } |
@@ -295,6 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | /** |
297 | 297 | * Check the content. |
298 | + * @param string $content |
|
298 | 299 | * @return void |
299 | 300 | */ |
300 | 301 | function check(&$content) |
@@ -487,7 +488,7 @@ discard block |
||
487 | 488 | |
488 | 489 | /** |
489 | 490 | * Check white domain in object data attribute or embed src attribute. |
490 | - * @return string |
|
491 | + * @return boolean |
|
491 | 492 | */ |
492 | 493 | function isWhiteDomain($urlAttribute) |
493 | 494 | { |
@@ -506,7 +507,7 @@ discard block |
||
506 | 507 | |
507 | 508 | /** |
508 | 509 | * Check white domain in iframe src attribute. |
509 | - * @return string |
|
510 | + * @return boolean |
|
510 | 511 | */ |
511 | 512 | function isWhiteIframeDomain($urlAttribute) |
512 | 513 | { |
@@ -525,7 +526,7 @@ discard block |
||
525 | 526 | |
526 | 527 | /** |
527 | 528 | * Check white mime type in object type attribute or embed type attribute. |
528 | - * @return string |
|
529 | + * @return boolean |
|
529 | 530 | */ |
530 | 531 | function isWhiteMimetype($mimeType) |
531 | 532 | { |
@@ -590,7 +591,7 @@ discard block |
||
590 | 591 | |
591 | 592 | /** |
592 | 593 | * Make white domain list cache file from xml config file. |
593 | - * @param $whitelist array |
|
594 | + * @param stdClass $whitelist array |
|
594 | 595 | * @return void |
595 | 596 | */ |
596 | 597 | function _makeWhiteDomainList($whitelist = NULL) |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | */ |
277 | 277 | function getInstance() |
278 | 278 | { |
279 | - if(!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) |
|
279 | + if (!isset($GLOBALS['__EMBEDFILTER_INSTANCE__'])) |
|
280 | 280 | { |
281 | 281 | $GLOBALS['__EMBEDFILTER_INSTANCE__'] = new EmbedFilter(); |
282 | 282 | } |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | { |
317 | 317 | preg_match_all('/<\s*object\s*[^>]+(?:\/?>?)/is', $content, $m); |
318 | 318 | $objectTagList = $m[0]; |
319 | - if($objectTagList) |
|
319 | + if ($objectTagList) |
|
320 | 320 | { |
321 | - foreach($objectTagList AS $key => $objectTag) |
|
321 | + foreach ($objectTagList AS $key => $objectTag) |
|
322 | 322 | { |
323 | 323 | $isWhiteDomain = true; |
324 | 324 | $isWhiteMimetype = true; |
@@ -326,21 +326,21 @@ discard block |
||
326 | 326 | $ext = ''; |
327 | 327 | |
328 | 328 | $parser = new HtmlParser($objectTag); |
329 | - while($parser->parse()) |
|
329 | + while ($parser->parse()) |
|
330 | 330 | { |
331 | - if(is_array($parser->iNodeAttributes)) |
|
331 | + if (is_array($parser->iNodeAttributes)) |
|
332 | 332 | { |
333 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
333 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
334 | 334 | { |
335 | 335 | // data url check |
336 | - if($attrValue && strtolower($attrName) == 'data') |
|
336 | + if ($attrValue && strtolower($attrName) == 'data') |
|
337 | 337 | { |
338 | 338 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
339 | 339 | $isWhiteDomain = $this->isWhiteDomain($attrValue); |
340 | 340 | } |
341 | 341 | |
342 | 342 | // mime type check |
343 | - if(strtolower($attrName) == 'type' && $attrValue) |
|
343 | + if (strtolower($attrName) == 'type' && $attrValue) |
|
344 | 344 | { |
345 | 345 | $isWhiteMimetype = $this->isWhiteMimetype($attrValue); |
346 | 346 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - if(!$isWhiteDomain || !$isWhiteMimetype) |
|
351 | + if (!$isWhiteDomain || !$isWhiteMimetype) |
|
352 | 352 | { |
353 | 353 | $content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
354 | 354 | } |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | { |
365 | 365 | preg_match_all('/<\s*embed\s*[^>]+(?:\/?>?)/is', $content, $m); |
366 | 366 | $embedTagList = $m[0]; |
367 | - if($embedTagList) |
|
367 | + if ($embedTagList) |
|
368 | 368 | { |
369 | - foreach($embedTagList AS $key => $embedTag) |
|
369 | + foreach ($embedTagList AS $key => $embedTag) |
|
370 | 370 | { |
371 | 371 | $isWhiteDomain = TRUE; |
372 | 372 | $isWhiteMimetype = TRUE; |
@@ -374,21 +374,21 @@ discard block |
||
374 | 374 | $ext = ''; |
375 | 375 | |
376 | 376 | $parser = new HtmlParser($embedTag); |
377 | - while($parser->parse()) |
|
377 | + while ($parser->parse()) |
|
378 | 378 | { |
379 | - if(is_array($parser->iNodeAttributes)) |
|
379 | + if (is_array($parser->iNodeAttributes)) |
|
380 | 380 | { |
381 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
381 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
382 | 382 | { |
383 | 383 | // src url check |
384 | - if($attrValue && strtolower($attrName) == 'src') |
|
384 | + if ($attrValue && strtolower($attrName) == 'src') |
|
385 | 385 | { |
386 | 386 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
387 | 387 | $isWhiteDomain = $this->isWhiteDomain($attrValue); |
388 | 388 | } |
389 | 389 | |
390 | 390 | // mime type check |
391 | - if(strtolower($attrName) == 'type' && $attrValue) |
|
391 | + if (strtolower($attrName) == 'type' && $attrValue) |
|
392 | 392 | { |
393 | 393 | $isWhiteMimetype = $this->isWhiteMimetype($attrValue); |
394 | 394 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | } |
398 | 398 | |
399 | - if(!$isWhiteDomain || !$isWhiteMimetype) |
|
399 | + if (!$isWhiteDomain || !$isWhiteMimetype) |
|
400 | 400 | { |
401 | 401 | $content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
402 | 402 | } |
@@ -415,22 +415,22 @@ discard block |
||
415 | 415 | |
416 | 416 | preg_match_all('/<\s*iframe\s*[^>]+(?:\/?>?)/is', $content, $m); |
417 | 417 | $iframeTagList = $m[0]; |
418 | - if($iframeTagList) |
|
418 | + if ($iframeTagList) |
|
419 | 419 | { |
420 | - foreach($iframeTagList AS $key => $iframeTag) |
|
420 | + foreach ($iframeTagList AS $key => $iframeTag) |
|
421 | 421 | { |
422 | 422 | $isWhiteDomain = TRUE; |
423 | 423 | $ext = ''; |
424 | 424 | |
425 | 425 | $parser = new HtmlParser($iframeTag); |
426 | - while($parser->parse()) |
|
426 | + while ($parser->parse()) |
|
427 | 427 | { |
428 | - if(is_array($parser->iNodeAttributes)) |
|
428 | + if (is_array($parser->iNodeAttributes)) |
|
429 | 429 | { |
430 | - foreach($parser->iNodeAttributes AS $attrName => $attrValue) |
|
430 | + foreach ($parser->iNodeAttributes AS $attrName => $attrValue) |
|
431 | 431 | { |
432 | 432 | // src url check |
433 | - if(strtolower($attrName) == 'src' && $attrValue) |
|
433 | + if (strtolower($attrName) == 'src' && $attrValue) |
|
434 | 434 | { |
435 | 435 | $ext = strtolower(substr(strrchr($attrValue, "."), 1)); |
436 | 436 | $isWhiteDomain = $this->isWhiteIframeDomain($attrValue); |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | - if(!$isWhiteDomain) |
|
442 | + if (!$isWhiteDomain) |
|
443 | 443 | { |
444 | 444 | $content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
445 | 445 | } |
@@ -455,26 +455,26 @@ discard block |
||
455 | 455 | { |
456 | 456 | preg_match_all('/<\s*param\s*[^>]+(?:\/?>?)/is', $content, $m); |
457 | 457 | $paramTagList = $m[0]; |
458 | - if($paramTagList) |
|
458 | + if ($paramTagList) |
|
459 | 459 | { |
460 | - foreach($paramTagList AS $key => $paramTag) |
|
460 | + foreach ($paramTagList AS $key => $paramTag) |
|
461 | 461 | { |
462 | 462 | $isWhiteDomain = TRUE; |
463 | 463 | $isWhiteExt = TRUE; |
464 | 464 | $ext = ''; |
465 | 465 | |
466 | 466 | $parser = new HtmlParser($paramTag); |
467 | - while($parser->parse()) |
|
467 | + while ($parser->parse()) |
|
468 | 468 | { |
469 | - if($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value']) |
|
469 | + if ($parser->iNodeAttributes['name'] && $parser->iNodeAttributes['value']) |
|
470 | 470 | { |
471 | 471 | $name = strtolower($parser->iNodeAttributes['name']); |
472 | - if($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source') |
|
472 | + if ($name == 'movie' || $name == 'src' || $name == 'href' || $name == 'url' || $name == 'source') |
|
473 | 473 | { |
474 | 474 | $ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1)); |
475 | 475 | $isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']); |
476 | 476 | |
477 | - if(!$isWhiteDomain) |
|
477 | + if (!$isWhiteDomain) |
|
478 | 478 | { |
479 | 479 | $content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT | ENT_HTML401, 'UTF-8', false), $content); |
480 | 480 | } |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | */ |
492 | 492 | function isWhiteDomain($urlAttribute) |
493 | 493 | { |
494 | - if(is_array($this->whiteUrlList)) |
|
494 | + if (is_array($this->whiteUrlList)) |
|
495 | 495 | { |
496 | - foreach($this->whiteUrlList AS $key => $value) |
|
496 | + foreach ($this->whiteUrlList AS $key => $value) |
|
497 | 497 | { |
498 | - if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
498 | + if (preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
499 | 499 | { |
500 | 500 | return TRUE; |
501 | 501 | } |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | */ |
511 | 511 | function isWhiteIframeDomain($urlAttribute) |
512 | 512 | { |
513 | - if(is_array($this->whiteIframeUrlList)) |
|
513 | + if (is_array($this->whiteIframeUrlList)) |
|
514 | 514 | { |
515 | - foreach($this->whiteIframeUrlList AS $key => $value) |
|
515 | + foreach ($this->whiteIframeUrlList AS $key => $value) |
|
516 | 516 | { |
517 | - if(preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
517 | + if (preg_match('@^' . preg_quote($value) . '@i', $urlAttribute)) |
|
518 | 518 | { |
519 | 519 | return TRUE; |
520 | 520 | } |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | */ |
530 | 530 | function isWhiteMimetype($mimeType) |
531 | 531 | { |
532 | - if(isset($this->mimeTypeList[$mimeType])) |
|
532 | + if (isset($this->mimeTypeList[$mimeType])) |
|
533 | 533 | { |
534 | 534 | return TRUE; |
535 | 535 | } |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | |
539 | 539 | function isWhiteExt($ext) |
540 | 540 | { |
541 | - if(isset($this->extList[$ext])) |
|
541 | + if (isset($this->extList[$ext])) |
|
542 | 542 | { |
543 | 543 | return TRUE; |
544 | 544 | } |
@@ -547,26 +547,26 @@ discard block |
||
547 | 547 | |
548 | 548 | function _checkAllowScriptAccess($m) |
549 | 549 | { |
550 | - if($m[1] == 'object') |
|
550 | + if ($m[1] == 'object') |
|
551 | 551 | { |
552 | 552 | $this->allowscriptaccessList[] = 1; |
553 | 553 | } |
554 | 554 | |
555 | - if($m[1] == 'param') |
|
555 | + if ($m[1] == 'param') |
|
556 | 556 | { |
557 | - if(stripos($m[0], 'allowscriptaccess')) |
|
557 | + if (stripos($m[0], 'allowscriptaccess')) |
|
558 | 558 | { |
559 | 559 | $m[0] = '<param name="allowscriptaccess" value="never"'; |
560 | - if(substr($m[0], -1) == '/') |
|
560 | + if (substr($m[0], -1) == '/') |
|
561 | 561 | { |
562 | 562 | $m[0] .= '/'; |
563 | 563 | } |
564 | 564 | $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
565 | 565 | } |
566 | 566 | } |
567 | - else if($m[1] == 'embed') |
|
567 | + else if ($m[1] == 'embed') |
|
568 | 568 | { |
569 | - if(stripos($m[0], 'allowscriptaccess')) |
|
569 | + if (stripos($m[0], 'allowscriptaccess')) |
|
570 | 570 | { |
571 | 571 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
572 | 572 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | |
581 | 581 | function _addAllowScriptAccess($m) |
582 | 582 | { |
583 | - if($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
583 | + if ($this->allowscriptaccessList[$this->allowscriptaccessKey] == 1) |
|
584 | 584 | { |
585 | 585 | $m[0] = $m[0] . '<param name="allowscriptaccess" value="never"></param>'; |
586 | 586 | } |
@@ -599,31 +599,31 @@ discard block |
||
599 | 599 | $whiteUrlCacheFile = FileHandler::getRealPath($this->whiteUrlCacheFile); |
600 | 600 | |
601 | 601 | $isMake = FALSE; |
602 | - if(!file_exists($whiteUrlCacheFile)) |
|
602 | + if (!file_exists($whiteUrlCacheFile)) |
|
603 | 603 | { |
604 | 604 | $isMake = TRUE; |
605 | 605 | } |
606 | - if(file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile)) |
|
606 | + if (file_exists($whiteUrlCacheFile) && filemtime($whiteUrlCacheFile) < filemtime($whiteUrlXmlFile)) |
|
607 | 607 | { |
608 | 608 | $isMake = TRUE; |
609 | 609 | } |
610 | 610 | |
611 | - if(gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array') |
|
611 | + if (gettype($whitelist) == 'array' && gettype($whitelist['object']) == 'array' && gettype($whitelist['iframe']) == 'array') |
|
612 | 612 | { |
613 | 613 | $isMake = FALSE; |
614 | 614 | } |
615 | 615 | |
616 | - if(isset($whitelist) && gettype($whitelist) == 'object') |
|
616 | + if (isset($whitelist) && gettype($whitelist) == 'object') |
|
617 | 617 | { |
618 | 618 | $isMake = TRUE; |
619 | 619 | } |
620 | 620 | |
621 | - if($isMake) |
|
621 | + if ($isMake) |
|
622 | 622 | { |
623 | 623 | $whiteUrlList = array(); |
624 | 624 | $whiteIframeUrlList = array(); |
625 | 625 | |
626 | - if(gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array') |
|
626 | + if (gettype($whitelist->object) == 'array' && gettype($whitelist->iframe) == 'array') |
|
627 | 627 | { |
628 | 628 | $whiteUrlList = $whitelist->object; |
629 | 629 | $whiteIframeUrlList = $whitelist->iframe; |
@@ -636,15 +636,15 @@ discard block |
||
636 | 636 | $domainListObj = $xmlParser->parse($xmlBuff); |
637 | 637 | $embedDomainList = $domainListObj->whiteurl->embed->domain; |
638 | 638 | $iframeDomainList = $domainListObj->whiteurl->iframe->domain; |
639 | - if(!is_array($embedDomainList)) $embedDomainList = array(); |
|
640 | - if(!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
639 | + if (!is_array($embedDomainList)) $embedDomainList = array(); |
|
640 | + if (!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
641 | 641 | |
642 | - foreach($embedDomainList AS $key => $value) |
|
642 | + foreach ($embedDomainList AS $key => $value) |
|
643 | 643 | { |
644 | 644 | $patternList = $value->pattern; |
645 | - if(is_array($patternList)) |
|
645 | + if (is_array($patternList)) |
|
646 | 646 | { |
647 | - foreach($patternList AS $key => $value) |
|
647 | + foreach ($patternList AS $key => $value) |
|
648 | 648 | { |
649 | 649 | $whiteUrlList[] = $value->body; |
650 | 650 | } |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
658 | - foreach($iframeDomainList AS $key => $value) |
|
658 | + foreach ($iframeDomainList AS $key => $value) |
|
659 | 659 | { |
660 | 660 | $patternList = $value->pattern; |
661 | - if(is_array($patternList)) |
|
661 | + if (is_array($patternList)) |
|
662 | 662 | { |
663 | - foreach($patternList AS $key => $value) |
|
663 | + foreach ($patternList AS $key => $value) |
|
664 | 664 | { |
665 | 665 | $whiteIframeUrlList[] = $value->body; |
666 | 666 | } |
@@ -674,12 +674,12 @@ discard block |
||
674 | 674 | |
675 | 675 | $db_info = Context::getDBInfo(); |
676 | 676 | |
677 | - if($db_info->embed_white_object) |
|
677 | + if ($db_info->embed_white_object) |
|
678 | 678 | { |
679 | 679 | $whiteUrlList = array_merge($whiteUrlList, $db_info->embed_white_object); |
680 | 680 | } |
681 | 681 | |
682 | - if($db_info->embed_white_iframe) |
|
682 | + if ($db_info->embed_white_iframe) |
|
683 | 683 | { |
684 | 684 | $whiteIframeUrlList = array_merge($whiteIframeUrlList, $db_info->embed_white_iframe); |
685 | 685 | } |
@@ -563,14 +563,12 @@ discard block |
||
563 | 563 | } |
564 | 564 | $this->allowscriptaccessList[count($this->allowscriptaccessList) - 1]--; |
565 | 565 | } |
566 | - } |
|
567 | - else if($m[1] == 'embed') |
|
566 | + } else if($m[1] == 'embed') |
|
568 | 567 | { |
569 | 568 | if(stripos($m[0], 'allowscriptaccess')) |
570 | 569 | { |
571 | 570 | $m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]); |
572 | - } |
|
573 | - else |
|
571 | + } else |
|
574 | 572 | { |
575 | 573 | $m[0] = preg_replace('/\<embed/i', '<embed allowscriptaccess="never"', $m[0]); |
576 | 574 | } |
@@ -627,8 +625,7 @@ discard block |
||
627 | 625 | { |
628 | 626 | $whiteUrlList = $whitelist->object; |
629 | 627 | $whiteIframeUrlList = $whitelist->iframe; |
630 | - } |
|
631 | - else |
|
628 | + } else |
|
632 | 629 | { |
633 | 630 | $xmlBuff = FileHandler::readFile($this->whiteUrlXmlFile); |
634 | 631 | |
@@ -636,8 +633,12 @@ discard block |
||
636 | 633 | $domainListObj = $xmlParser->parse($xmlBuff); |
637 | 634 | $embedDomainList = $domainListObj->whiteurl->embed->domain; |
638 | 635 | $iframeDomainList = $domainListObj->whiteurl->iframe->domain; |
639 | - if(!is_array($embedDomainList)) $embedDomainList = array(); |
|
640 | - if(!is_array($iframeDomainList)) $iframeDomainList = array(); |
|
636 | + if(!is_array($embedDomainList)) { |
|
637 | + $embedDomainList = array(); |
|
638 | + } |
|
639 | + if(!is_array($iframeDomainList)) { |
|
640 | + $iframeDomainList = array(); |
|
641 | + } |
|
641 | 642 | |
642 | 643 | foreach($embedDomainList AS $key => $value) |
643 | 644 | { |
@@ -648,8 +649,7 @@ discard block |
||
648 | 649 | { |
649 | 650 | $whiteUrlList[] = $value->body; |
650 | 651 | } |
651 | - } |
|
652 | - else |
|
652 | + } else |
|
653 | 653 | { |
654 | 654 | $whiteUrlList[] = $patternList->body; |
655 | 655 | } |
@@ -664,8 +664,7 @@ discard block |
||
664 | 664 | { |
665 | 665 | $whiteIframeUrlList[] = $value->body; |
666 | 666 | } |
667 | - } |
|
668 | - else |
|
667 | + } else |
|
669 | 668 | { |
670 | 669 | $whiteIframeUrlList[] = $patternList->body; |
671 | 670 | } |
@@ -11,6 +11,7 @@ |
||
11 | 11 | /** |
12 | 12 | * @param HTMLPurifier_Length $max Minimum length, or null for no bound. String is also acceptable. |
13 | 13 | * @param HTMLPurifier_Length $max Maximum length, or null for no bound. String is also acceptable. |
14 | + * @param string $min |
|
14 | 15 | */ |
15 | 16 | public function __construct($min = null, $max = null) { |
16 | 17 | $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null; |
@@ -6,41 +6,41 @@ |
||
6 | 6 | class HTMLPurifier_AttrDef_CSS_Length extends HTMLPurifier_AttrDef |
7 | 7 | { |
8 | 8 | |
9 | - protected $min, $max; |
|
10 | - |
|
11 | - /** |
|
12 | - * @param HTMLPurifier_Length $max Minimum length, or null for no bound. String is also acceptable. |
|
13 | - * @param HTMLPurifier_Length $max Maximum length, or null for no bound. String is also acceptable. |
|
14 | - */ |
|
15 | - public function __construct($min = null, $max = null) { |
|
16 | - $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null; |
|
17 | - $this->max = $max !== null ? HTMLPurifier_Length::make($max) : null; |
|
18 | - } |
|
19 | - |
|
20 | - public function validate($string, $config, $context) { |
|
21 | - $string = $this->parseCDATA($string); |
|
22 | - |
|
23 | - // Optimizations |
|
24 | - if ($string === '') return false; |
|
25 | - if ($string === '0') return '0'; |
|
26 | - if (strlen($string) === 1) return false; |
|
27 | - |
|
28 | - $length = HTMLPurifier_Length::make($string); |
|
29 | - if (!$length->isValid()) return false; |
|
30 | - |
|
31 | - if ($this->min) { |
|
32 | - $c = $length->compareTo($this->min); |
|
33 | - if ($c === false) return false; |
|
34 | - if ($c < 0) return false; |
|
35 | - } |
|
36 | - if ($this->max) { |
|
37 | - $c = $length->compareTo($this->max); |
|
38 | - if ($c === false) return false; |
|
39 | - if ($c > 0) return false; |
|
40 | - } |
|
41 | - |
|
42 | - return $length->toString(); |
|
43 | - } |
|
9 | + protected $min, $max; |
|
10 | + |
|
11 | + /** |
|
12 | + * @param HTMLPurifier_Length $max Minimum length, or null for no bound. String is also acceptable. |
|
13 | + * @param HTMLPurifier_Length $max Maximum length, or null for no bound. String is also acceptable. |
|
14 | + */ |
|
15 | + public function __construct($min = null, $max = null) { |
|
16 | + $this->min = $min !== null ? HTMLPurifier_Length::make($min) : null; |
|
17 | + $this->max = $max !== null ? HTMLPurifier_Length::make($max) : null; |
|
18 | + } |
|
19 | + |
|
20 | + public function validate($string, $config, $context) { |
|
21 | + $string = $this->parseCDATA($string); |
|
22 | + |
|
23 | + // Optimizations |
|
24 | + if ($string === '') return false; |
|
25 | + if ($string === '0') return '0'; |
|
26 | + if (strlen($string) === 1) return false; |
|
27 | + |
|
28 | + $length = HTMLPurifier_Length::make($string); |
|
29 | + if (!$length->isValid()) return false; |
|
30 | + |
|
31 | + if ($this->min) { |
|
32 | + $c = $length->compareTo($this->min); |
|
33 | + if ($c === false) return false; |
|
34 | + if ($c < 0) return false; |
|
35 | + } |
|
36 | + if ($this->max) { |
|
37 | + $c = $length->compareTo($this->max); |
|
38 | + if ($c === false) return false; |
|
39 | + if ($c > 0) return false; |
|
40 | + } |
|
41 | + |
|
42 | + return $length->toString(); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | } |
46 | 46 |
@@ -21,22 +21,38 @@ |
||
21 | 21 | $string = $this->parseCDATA($string); |
22 | 22 | |
23 | 23 | // Optimizations |
24 | - if ($string === '') return false; |
|
25 | - if ($string === '0') return '0'; |
|
26 | - if (strlen($string) === 1) return false; |
|
24 | + if ($string === '') { |
|
25 | + return false; |
|
26 | + } |
|
27 | + if ($string === '0') { |
|
28 | + return '0'; |
|
29 | + } |
|
30 | + if (strlen($string) === 1) { |
|
31 | + return false; |
|
32 | + } |
|
27 | 33 | |
28 | 34 | $length = HTMLPurifier_Length::make($string); |
29 | - if (!$length->isValid()) return false; |
|
35 | + if (!$length->isValid()) { |
|
36 | + return false; |
|
37 | + } |
|
30 | 38 | |
31 | 39 | if ($this->min) { |
32 | 40 | $c = $length->compareTo($this->min); |
33 | - if ($c === false) return false; |
|
34 | - if ($c < 0) return false; |
|
41 | + if ($c === false) { |
|
42 | + return false; |
|
43 | + } |
|
44 | + if ($c < 0) { |
|
45 | + return false; |
|
46 | + } |
|
35 | 47 | } |
36 | 48 | if ($this->max) { |
37 | 49 | $c = $length->compareTo($this->max); |
38 | - if ($c === false) return false; |
|
39 | - if ($c > 0) return false; |
|
50 | + if ($c === false) { |
|
51 | + return false; |
|
52 | + } |
|
53 | + if ($c > 0) { |
|
54 | + return false; |
|
55 | + } |
|
40 | 56 | } |
41 | 57 | |
42 | 58 | return $length->toString(); |
@@ -9,6 +9,9 @@ |
||
9 | 9 | class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4 |
10 | 10 | { |
11 | 11 | |
12 | + /** |
|
13 | + * @param string $aIP |
|
14 | + */ |
|
12 | 15 | public function validate($aIP, $config, $context) { |
13 | 16 | |
14 | 17 | if (!$this->ip4) $this->_loadRegex(); |
@@ -9,90 +9,90 @@ |
||
9 | 9 | class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4 |
10 | 10 | { |
11 | 11 | |
12 | - public function validate($aIP, $config, $context) { |
|
13 | - |
|
14 | - if (!$this->ip4) $this->_loadRegex(); |
|
15 | - |
|
16 | - $original = $aIP; |
|
17 | - |
|
18 | - $hex = '[0-9a-fA-F]'; |
|
19 | - $blk = '(?:' . $hex . '{1,4})'; |
|
20 | - $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128 |
|
21 | - |
|
22 | - // prefix check |
|
23 | - if (strpos($aIP, '/') !== false) |
|
24 | - { |
|
25 | - if (preg_match('#' . $pre . '$#s', $aIP, $find)) |
|
26 | - { |
|
27 | - $aIP = substr($aIP, 0, 0-strlen($find[0])); |
|
28 | - unset($find); |
|
29 | - } |
|
30 | - else |
|
31 | - { |
|
32 | - return false; |
|
33 | - } |
|
34 | - } |
|
35 | - |
|
36 | - // IPv4-compatiblity check |
|
37 | - if (preg_match('#(?<=:'.')' . $this->ip4 . '$#s', $aIP, $find)) |
|
38 | - { |
|
39 | - $aIP = substr($aIP, 0, 0-strlen($find[0])); |
|
40 | - $ip = explode('.', $find[0]); |
|
41 | - $ip = array_map('dechex', $ip); |
|
42 | - $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3]; |
|
43 | - unset($find, $ip); |
|
44 | - } |
|
45 | - |
|
46 | - // compression check |
|
47 | - $aIP = explode('::', $aIP); |
|
48 | - $c = count($aIP); |
|
49 | - if ($c > 2) |
|
50 | - { |
|
51 | - return false; |
|
52 | - } |
|
53 | - elseif ($c == 2) |
|
54 | - { |
|
55 | - list($first, $second) = $aIP; |
|
56 | - $first = explode(':', $first); |
|
57 | - $second = explode(':', $second); |
|
58 | - |
|
59 | - if (count($first) + count($second) > 8) |
|
60 | - { |
|
61 | - return false; |
|
62 | - } |
|
63 | - |
|
64 | - while(count($first) < 8) |
|
65 | - { |
|
66 | - array_push($first, '0'); |
|
67 | - } |
|
68 | - |
|
69 | - array_splice($first, 8 - count($second), 8, $second); |
|
70 | - $aIP = $first; |
|
71 | - unset($first,$second); |
|
72 | - } |
|
73 | - else |
|
74 | - { |
|
75 | - $aIP = explode(':', $aIP[0]); |
|
76 | - } |
|
77 | - $c = count($aIP); |
|
78 | - |
|
79 | - if ($c != 8) |
|
80 | - { |
|
81 | - return false; |
|
82 | - } |
|
83 | - |
|
84 | - // All the pieces should be 16-bit hex strings. Are they? |
|
85 | - foreach ($aIP as $piece) |
|
86 | - { |
|
87 | - if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) |
|
88 | - { |
|
89 | - return false; |
|
90 | - } |
|
91 | - } |
|
92 | - |
|
93 | - return $original; |
|
94 | - |
|
95 | - } |
|
12 | + public function validate($aIP, $config, $context) { |
|
13 | + |
|
14 | + if (!$this->ip4) $this->_loadRegex(); |
|
15 | + |
|
16 | + $original = $aIP; |
|
17 | + |
|
18 | + $hex = '[0-9a-fA-F]'; |
|
19 | + $blk = '(?:' . $hex . '{1,4})'; |
|
20 | + $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128 |
|
21 | + |
|
22 | + // prefix check |
|
23 | + if (strpos($aIP, '/') !== false) |
|
24 | + { |
|
25 | + if (preg_match('#' . $pre . '$#s', $aIP, $find)) |
|
26 | + { |
|
27 | + $aIP = substr($aIP, 0, 0-strlen($find[0])); |
|
28 | + unset($find); |
|
29 | + } |
|
30 | + else |
|
31 | + { |
|
32 | + return false; |
|
33 | + } |
|
34 | + } |
|
35 | + |
|
36 | + // IPv4-compatiblity check |
|
37 | + if (preg_match('#(?<=:'.')' . $this->ip4 . '$#s', $aIP, $find)) |
|
38 | + { |
|
39 | + $aIP = substr($aIP, 0, 0-strlen($find[0])); |
|
40 | + $ip = explode('.', $find[0]); |
|
41 | + $ip = array_map('dechex', $ip); |
|
42 | + $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3]; |
|
43 | + unset($find, $ip); |
|
44 | + } |
|
45 | + |
|
46 | + // compression check |
|
47 | + $aIP = explode('::', $aIP); |
|
48 | + $c = count($aIP); |
|
49 | + if ($c > 2) |
|
50 | + { |
|
51 | + return false; |
|
52 | + } |
|
53 | + elseif ($c == 2) |
|
54 | + { |
|
55 | + list($first, $second) = $aIP; |
|
56 | + $first = explode(':', $first); |
|
57 | + $second = explode(':', $second); |
|
58 | + |
|
59 | + if (count($first) + count($second) > 8) |
|
60 | + { |
|
61 | + return false; |
|
62 | + } |
|
63 | + |
|
64 | + while(count($first) < 8) |
|
65 | + { |
|
66 | + array_push($first, '0'); |
|
67 | + } |
|
68 | + |
|
69 | + array_splice($first, 8 - count($second), 8, $second); |
|
70 | + $aIP = $first; |
|
71 | + unset($first,$second); |
|
72 | + } |
|
73 | + else |
|
74 | + { |
|
75 | + $aIP = explode(':', $aIP[0]); |
|
76 | + } |
|
77 | + $c = count($aIP); |
|
78 | + |
|
79 | + if ($c != 8) |
|
80 | + { |
|
81 | + return false; |
|
82 | + } |
|
83 | + |
|
84 | + // All the pieces should be 16-bit hex strings. Are they? |
|
85 | + foreach ($aIP as $piece) |
|
86 | + { |
|
87 | + if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) |
|
88 | + { |
|
89 | + return false; |
|
90 | + } |
|
91 | + } |
|
92 | + |
|
93 | + return $original; |
|
94 | + |
|
95 | + } |
|
96 | 96 | |
97 | 97 | } |
98 | 98 |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | |
18 | 18 | $hex = '[0-9a-fA-F]'; |
19 | 19 | $blk = '(?:' . $hex . '{1,4})'; |
20 | - $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128 |
|
20 | + $pre = '(?:/(?:12[0-8]|1[0-1][0-9]|[1-9][0-9]|[0-9]))'; // /0 - /128 |
|
21 | 21 | |
22 | 22 | // prefix check |
23 | 23 | if (strpos($aIP, '/') !== false) |
24 | 24 | { |
25 | 25 | if (preg_match('#' . $pre . '$#s', $aIP, $find)) |
26 | 26 | { |
27 | - $aIP = substr($aIP, 0, 0-strlen($find[0])); |
|
27 | + $aIP = substr($aIP, 0, 0 - strlen($find[0])); |
|
28 | 28 | unset($find); |
29 | 29 | } |
30 | 30 | else |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | // IPv4-compatiblity check |
37 | - if (preg_match('#(?<=:'.')' . $this->ip4 . '$#s', $aIP, $find)) |
|
37 | + if (preg_match('#(?<=:' . ')' . $this->ip4 . '$#s', $aIP, $find)) |
|
38 | 38 | { |
39 | - $aIP = substr($aIP, 0, 0-strlen($find[0])); |
|
39 | + $aIP = substr($aIP, 0, 0 - strlen($find[0])); |
|
40 | 40 | $ip = explode('.', $find[0]); |
41 | 41 | $ip = array_map('dechex', $ip); |
42 | 42 | $aIP .= $ip[0] . $ip[1] . ':' . $ip[2] . $ip[3]; |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
64 | - while(count($first) < 8) |
|
64 | + while (count($first) < 8) |
|
65 | 65 | { |
66 | 66 | array_push($first, '0'); |
67 | 67 | } |
68 | 68 | |
69 | 69 | array_splice($first, 8 - count($second), 8, $second); |
70 | 70 | $aIP = $first; |
71 | - unset($first,$second); |
|
71 | + unset($first, $second); |
|
72 | 72 | } |
73 | 73 | else |
74 | 74 | { |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | |
12 | 12 | public function validate($aIP, $config, $context) { |
13 | 13 | |
14 | - if (!$this->ip4) $this->_loadRegex(); |
|
14 | + if (!$this->ip4) { |
|
15 | + $this->_loadRegex(); |
|
16 | + } |
|
15 | 17 | |
16 | 18 | $original = $aIP; |
17 | 19 | |
@@ -26,8 +28,7 @@ discard block |
||
26 | 28 | { |
27 | 29 | $aIP = substr($aIP, 0, 0-strlen($find[0])); |
28 | 30 | unset($find); |
29 | - } |
|
30 | - else |
|
31 | + } else |
|
31 | 32 | { |
32 | 33 | return false; |
33 | 34 | } |
@@ -49,8 +50,7 @@ discard block |
||
49 | 50 | if ($c > 2) |
50 | 51 | { |
51 | 52 | return false; |
52 | - } |
|
53 | - elseif ($c == 2) |
|
53 | + } elseif ($c == 2) |
|
54 | 54 | { |
55 | 55 | list($first, $second) = $aIP; |
56 | 56 | $first = explode(':', $first); |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | array_splice($first, 8 - count($second), 8, $second); |
70 | 70 | $aIP = $first; |
71 | 71 | unset($first,$second); |
72 | - } |
|
73 | - else |
|
72 | + } else |
|
74 | 73 | { |
75 | 74 | $aIP = explode(':', $aIP[0]); |
76 | 75 | } |