@@ -394,7 +394,7 @@ |
||
| 394 | 394 | * Arrage css index |
| 395 | 395 | * |
| 396 | 396 | * @param string $dirName First directory name of css path |
| 397 | - * @param array $file file info. |
|
| 397 | + * @param stdClass $file file info. |
|
| 398 | 398 | * @return void |
| 399 | 399 | */ |
| 400 | 400 | 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,18 +183,18 @@ 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 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe . "\t" . $file->media; |
|
| 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 | - $file->key = $file->filePath . $file->keyName . "\t" . $file->targetIe; |
|
| 197 | + $file->key = $file->filePath.$file->keyName."\t".$file->targetIe; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | return $file; |
@@ -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,12 +271,12 @@ 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 | - $noneCache = (is_readable($file->cdnPath . '/' . $file->fileName)) ? '?' . date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)) : ''; |
|
| 279 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $noneCache; |
|
| 278 | + $noneCache = (is_readable($file->cdnPath.'/'.$file->fileName)) ? '?'.date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)) : ''; |
|
| 279 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$noneCache; |
|
| 280 | 280 | |
| 281 | 281 | $result[] = array('file' => $fullFilePath, 'media' => $file->media, 'targetie' => $file->targetIe); |
| 282 | 282 | } |
@@ -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,12 +307,12 @@ 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 | - $noneCache = (is_readable($file->cdnPath . '/' . $file->fileName)) ? '?' . date('YmdHis', filemtime($file->cdnPath . '/' . $file->fileName)) : ''; |
|
| 315 | - $fullFilePath = $file->filePath . '/' . $file->fileName . $noneCache; |
|
| 314 | + $noneCache = (is_readable($file->cdnPath.'/'.$file->fileName)) ? '?'.date('YmdHis', filemtime($file->cdnPath.'/'.$file->fileName)) : ''; |
|
| 315 | + $fullFilePath = $file->filePath.'/'.$file->fileName.$noneCache; |
|
| 316 | 316 | |
| 317 | 317 | $result[] = array('file' => $fullFilePath, 'targetie' => $file->targetIe); |
| 318 | 318 | } |
@@ -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 | - $path = './' . $path; |
|
| 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 | } |
@@ -371,20 +371,20 @@ discard block |
||
| 371 | 371 | $path = $this->_normalizeFilePath($path); |
| 372 | 372 | $script_path = getScriptPath(); |
| 373 | 373 | |
| 374 | - if(strpos($path, './') === 0) |
|
| 374 | + if (strpos($path, './') === 0) |
|
| 375 | 375 | { |
| 376 | - if($script_path == '/' || $script_path == '\\') |
|
| 376 | + if ($script_path == '/' || $script_path == '\\') |
|
| 377 | 377 | { |
| 378 | - $path = '/' . substr($path, 2); |
|
| 378 | + $path = '/'.substr($path, 2); |
|
| 379 | 379 | } |
| 380 | 380 | else |
| 381 | 381 | { |
| 382 | - $path = $script_path . substr($path, 2); |
|
| 382 | + $path = $script_path.substr($path, 2); |
|
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | - else if(strpos($file, '../') === 0) |
|
| 385 | + else if (strpos($file, '../') === 0) |
|
| 386 | 386 | { |
| 387 | - $path = $this->_normalizeFilePath($script_path . $path); |
|
| 387 | + $path = $this->_normalizeFilePath($script_path.$path); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | return $path; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | */ |
| 400 | 400 | function _arrangeCssIndex($dirName, &$file) |
| 401 | 401 | { |
| 402 | - if($file->index !== 0) |
|
| 402 | + if ($file->index !== 0) |
|
| 403 | 403 | { |
| 404 | 404 | return; |
| 405 | 405 | } |
@@ -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 | } |
@@ -376,13 +369,11 @@ discard block |
||
| 376 | 369 | if($script_path == '/' || $script_path == '\\') |
| 377 | 370 | { |
| 378 | 371 | $path = '/' . substr($path, 2); |
| 379 | - } |
|
| 380 | - else |
|
| 372 | + } else |
|
| 381 | 373 | { |
| 382 | 374 | $path = $script_path . substr($path, 2); |
| 383 | 375 | } |
| 384 | - } |
|
| 385 | - else if(strpos($file, '../') === 0) |
|
| 376 | + } else if(strpos($file, '../') === 0) |
|
| 386 | 377 | { |
| 387 | 378 | $path = $this->_normalizeFilePath($script_path . $path); |
| 388 | 379 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | function init() |
| 18 | 18 | { |
| 19 | 19 | // set the template path |
| 20 | - $this->setTemplatePath($this->module_path . 'tpl'); |
|
| 20 | + $this->setTemplatePath($this->module_path.'tpl'); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | function dispCounterAdminIndex() |
| 29 | 29 | { |
| 30 | 30 | // set today's if no date is given |
| 31 | - $selected_date = (int)Context::get('selected_date'); |
|
| 31 | + $selected_date = (int) Context::get('selected_date'); |
|
| 32 | 32 | |
| 33 | - if(!$selected_date) |
|
| 33 | + if (!$selected_date) |
|
| 34 | 34 | { |
| 35 | 35 | $selected_date = date("Ymd"); |
| 36 | 36 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // get data by time, day, month, and year |
| 51 | 51 | $type = Context::get('type'); |
| 52 | 52 | |
| 53 | - if(!$type) |
|
| 53 | + if (!$type) |
|
| 54 | 54 | { |
| 55 | 55 | $type = 'day'; |
| 56 | 56 | Context::set('type', $type); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
| 164 | 164 | static $theInstance = null; |
| 165 | - if(!$theInstance) |
|
| 165 | + if (!$theInstance) |
|
| 166 | 166 | { |
| 167 | 167 | $theInstance = new Context(); |
| 168 | 168 | } |
@@ -182,10 +182,10 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // include ssl action cache file |
| 184 | 184 | $this->sslActionCacheFile = FileHandler::getRealPath($this->sslActionCacheFile); |
| 185 | - if(is_readable($this->sslActionCacheFile)) |
|
| 185 | + if (is_readable($this->sslActionCacheFile)) |
|
| 186 | 186 | { |
| 187 | 187 | require($this->sslActionCacheFile); |
| 188 | - if(isset($sslActions)) |
|
| 188 | + if (isset($sslActions)) |
|
| 189 | 189 | { |
| 190 | 190 | $this->ssl_actions = $sslActions; |
| 191 | 191 | } |
@@ -201,12 +201,12 @@ discard block |
||
| 201 | 201 | function init() |
| 202 | 202 | { |
| 203 | 203 | // fix missing HTTP_RAW_POST_DATA in PHP 5.6 and above |
| 204 | - if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 204 | + if (!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === TRUE) |
|
| 205 | 205 | { |
| 206 | 206 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); |
| 207 | 207 | |
| 208 | 208 | // If content is not XML JSON, unset |
| 209 | - if(!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 209 | + if (!preg_match('/^[\<\{\[]/', $GLOBALS['HTTP_RAW_POST_DATA']) && strpos($_SERVER['CONTENT_TYPE'], 'json') === FALSE && strpos($_SERVER['HTTP_CONTENT_TYPE'], 'json') === FALSE) |
|
| 210 | 210 | { |
| 211 | 211 | unset($GLOBALS['HTTP_RAW_POST_DATA']); |
| 212 | 212 | } |
@@ -228,11 +228,11 @@ discard block |
||
| 228 | 228 | $this->_setUploadedArgument(); |
| 229 | 229 | |
| 230 | 230 | $this->loadDBInfo(); |
| 231 | - if($this->db_info->use_sitelock == 'Y') |
|
| 231 | + if ($this->db_info->use_sitelock == 'Y') |
|
| 232 | 232 | { |
| 233 | - if(is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 233 | + if (is_array($this->db_info->sitelock_whitelist)) $whitelist = $this->db_info->sitelock_whitelist; |
|
| 234 | 234 | |
| 235 | - if(!IpFilter::filter($whitelist)) |
|
| 235 | + if (!IpFilter::filter($whitelist)) |
|
| 236 | 236 | { |
| 237 | 237 | $title = ($this->db_info->sitelock_title) ? $this->db_info->sitelock_title : 'Maintenance in progress...'; |
| 238 | 238 | $message = $this->db_info->sitelock_message; |
@@ -242,52 +242,52 @@ discard block |
||
| 242 | 242 | define('_XE_SITELOCK_MESSAGE_', $message); |
| 243 | 243 | |
| 244 | 244 | header("HTTP/1.1 403 Forbidden"); |
| 245 | - if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
|
| 245 | + if (FileHandler::exists(_XE_PATH_.'common/tpl/sitelock.user.html')) |
|
| 246 | 246 | { |
| 247 | - include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
|
| 247 | + include _XE_PATH_.'common/tpl/sitelock.user.html'; |
|
| 248 | 248 | } |
| 249 | 249 | else |
| 250 | 250 | { |
| 251 | - include _XE_PATH_ . 'common/tpl/sitelock.html'; |
|
| 251 | + include _XE_PATH_.'common/tpl/sitelock.html'; |
|
| 252 | 252 | } |
| 253 | 253 | exit; |
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | // If XE is installed, get virtual site information |
| 258 | - if(self::isInstalled()) |
|
| 258 | + if (self::isInstalled()) |
|
| 259 | 259 | { |
| 260 | 260 | $oModuleModel = getModel('module'); |
| 261 | 261 | $site_module_info = $oModuleModel->getDefaultMid(); |
| 262 | 262 | |
| 263 | - if(!isset($site_module_info)) |
|
| 263 | + if (!isset($site_module_info)) |
|
| 264 | 264 | { |
| 265 | 265 | $site_module_info = new stdClass(); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // if site_srl of site_module_info is 0 (default site), compare the domain to default_url of db_config |
| 269 | - if($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 269 | + if ($site_module_info->site_srl == 0 && $site_module_info->domain != $this->db_info->default_url) |
|
| 270 | 270 | { |
| 271 | 271 | $site_module_info->domain = $this->db_info->default_url; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $this->set('site_module_info', $site_module_info); |
| 275 | - if($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 275 | + if ($site_module_info->site_srl && isSiteID($site_module_info->domain)) |
|
| 276 | 276 | { |
| 277 | 277 | $this->set('vid', $site_module_info->domain, TRUE); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if(!isset($this->db_info)) |
|
| 280 | + if (!isset($this->db_info)) |
|
| 281 | 281 | { |
| 282 | 282 | $this->db_info = new stdClass(); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->db_info->lang_type = $site_module_info->default_language; |
| 286 | - if(!$this->db_info->lang_type) |
|
| 286 | + if (!$this->db_info->lang_type) |
|
| 287 | 287 | { |
| 288 | 288 | $this->db_info->lang_type = 'en'; |
| 289 | 289 | } |
| 290 | - if(!$this->db_info->use_db_session) |
|
| 290 | + if (!$this->db_info->use_db_session) |
|
| 291 | 291 | { |
| 292 | 292 | $this->db_info->use_db_session = 'N'; |
| 293 | 293 | } |
@@ -297,30 +297,30 @@ discard block |
||
| 297 | 297 | $lang_supported = $this->loadLangSelected(); |
| 298 | 298 | |
| 299 | 299 | // Retrieve language type set in user's cookie |
| 300 | - if($this->lang_type = $this->get('l')) |
|
| 300 | + if ($this->lang_type = $this->get('l')) |
|
| 301 | 301 | { |
| 302 | - if($_COOKIE['lang_type'] != $this->lang_type) |
|
| 302 | + if ($_COOKIE['lang_type'] != $this->lang_type) |
|
| 303 | 303 | { |
| 304 | 304 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000, '/'); |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - elseif($_COOKIE['lang_type']) |
|
| 307 | + elseif ($_COOKIE['lang_type']) |
|
| 308 | 308 | { |
| 309 | 309 | $this->lang_type = $_COOKIE['lang_type']; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // If it's not exists, follow default language type set in db_info |
| 313 | - if(!$this->lang_type) |
|
| 313 | + if (!$this->lang_type) |
|
| 314 | 314 | { |
| 315 | 315 | $this->lang_type = $this->db_info->lang_type; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | // if still lang_type has not been set or has not-supported type , set as English. |
| 319 | - if(!$this->lang_type) |
|
| 319 | + if (!$this->lang_type) |
|
| 320 | 320 | { |
| 321 | 321 | $this->lang_type = 'en'; |
| 322 | 322 | } |
| 323 | - if(is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 323 | + if (is_array($lang_supported) && !isset($lang_supported[$this->lang_type])) |
|
| 324 | 324 | { |
| 325 | 325 | $this->lang_type = 'en'; |
| 326 | 326 | } |
@@ -329,10 +329,10 @@ discard block |
||
| 329 | 329 | $this->setLangType($this->lang_type); |
| 330 | 330 | |
| 331 | 331 | // load module module's language file according to language setting |
| 332 | - $this->loadLang(_XE_PATH_ . 'modules/module/lang'); |
|
| 332 | + $this->loadLang(_XE_PATH_.'modules/module/lang'); |
|
| 333 | 333 | |
| 334 | 334 | // set session handler |
| 335 | - if(self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 335 | + if (self::isInstalled() && $this->db_info->use_db_session == 'Y') |
|
| 336 | 336 | { |
| 337 | 337 | $oSessionModel = getModel('session'); |
| 338 | 338 | $oSessionController = getController('session'); |
@@ -341,11 +341,11 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if ($sess = $_POST[session_name()]) session_id($sess); |
|
| 345 | 345 | session_start(); |
| 346 | 346 | |
| 347 | 347 | // set authentication information in Context and session |
| 348 | - if(self::isInstalled()) |
|
| 348 | + if (self::isInstalled()) |
|
| 349 | 349 | { |
| 350 | 350 | $oModuleModel = getModel('module'); |
| 351 | 351 | $oModuleModel->loadModuleExtends(); |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | $oMemberModel = getModel('member'); |
| 354 | 354 | $oMemberController = getController('member'); |
| 355 | 355 | |
| 356 | - if($oMemberController && $oMemberModel) |
|
| 356 | + if ($oMemberController && $oMemberModel) |
|
| 357 | 357 | { |
| 358 | 358 | // if signed in, validate it. |
| 359 | - if($oMemberModel->isLogged()) |
|
| 359 | + if ($oMemberModel->isLogged()) |
|
| 360 | 360 | { |
| 361 | 361 | $oMemberController->setSessionInfo(); |
| 362 | 362 | } |
| 363 | 363 | // check auto sign-in |
| 364 | - elseif($_COOKIE['xeak']) |
|
| 364 | + elseif ($_COOKIE['xeak']) |
|
| 365 | 365 | { |
| 366 | 366 | $oMemberController->doAutologin(); |
| 367 | 367 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | // load common language file |
| 375 | 375 | $this->lang = &$GLOBALS['lang']; |
| 376 | - $this->loadLang(_XE_PATH_ . 'common/lang/'); |
|
| 376 | + $this->loadLang(_XE_PATH_.'common/lang/'); |
|
| 377 | 377 | |
| 378 | 378 | // check if using rewrite module |
| 379 | 379 | $this->allow_rewrite = ($this->db_info->use_rewrite == 'Y' ? TRUE : FALSE); |
@@ -381,28 +381,28 @@ discard block |
||
| 381 | 381 | // set locations for javascript use |
| 382 | 382 | $url = array(); |
| 383 | 383 | $current_url = self::getRequestUri(); |
| 384 | - if($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 384 | + if ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 385 | 385 | { |
| 386 | - if($this->get_vars) |
|
| 386 | + if ($this->get_vars) |
|
| 387 | 387 | { |
| 388 | 388 | $url = array(); |
| 389 | - foreach($this->get_vars as $key => $val) |
|
| 389 | + foreach ($this->get_vars as $key => $val) |
|
| 390 | 390 | { |
| 391 | - if(is_array($val) && count($val) > 0) |
|
| 391 | + if (is_array($val) && count($val) > 0) |
|
| 392 | 392 | { |
| 393 | - foreach($val as $k => $v) |
|
| 393 | + foreach ($val as $k => $v) |
|
| 394 | 394 | { |
| 395 | - $url[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 395 | + $url[] = $key.'['.$k.']='.urlencode($v); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | - elseif($val) |
|
| 398 | + elseif ($val) |
|
| 399 | 399 | { |
| 400 | - $url[] = $key . '=' . urlencode($val); |
|
| 400 | + $url[] = $key.'='.urlencode($val); |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 405 | + if ($url) $current_url .= '?'.join('&', $url); |
|
| 406 | 406 | } |
| 407 | 407 | else |
| 408 | 408 | { |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | $this->set('current_url', $current_url); |
| 418 | 418 | $this->set('request_uri', self::getRequestUri()); |
| 419 | 419 | |
| 420 | - if(strpos($current_url, 'xn--') !== FALSE) |
|
| 420 | + if (strpos($current_url, 'xn--') !== FALSE) |
|
| 421 | 421 | { |
| 422 | 422 | $this->set('current_url', self::decodeIdna($current_url)); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - if(strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 425 | + if (strpos(self::getRequestUri(), 'xn--') !== FALSE) |
|
| 426 | 426 | { |
| 427 | 427 | $this->set('request_uri', self::decodeIdna(self::getRequestUri())); |
| 428 | 428 | } |
@@ -447,19 +447,19 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | $self = self::getInstance(); |
| 449 | 449 | |
| 450 | - if(!$self->isInstalled()) |
|
| 450 | + if (!$self->isInstalled()) |
|
| 451 | 451 | { |
| 452 | 452 | return; |
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | $config_file = $self->getConfigFile(); |
| 456 | - if(is_readable($config_file)) |
|
| 456 | + if (is_readable($config_file)) |
|
| 457 | 457 | { |
| 458 | 458 | include($config_file); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // If master_db information does not exist, the config file needs to be updated |
| 462 | - if(!isset($db_info->master_db)) |
|
| 462 | + if (!isset($db_info->master_db)) |
|
| 463 | 463 | { |
| 464 | 464 | $db_info->master_db = array(); |
| 465 | 465 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 478 | 478 | unset($db_info->db_table_prefix); |
| 479 | 479 | |
| 480 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 480 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 481 | 481 | { |
| 482 | 482 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 483 | 483 | } |
@@ -489,33 +489,33 @@ discard block |
||
| 489 | 489 | $oInstallController->makeConfigFile(); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | - if(!$db_info->use_prepared_statements) |
|
| 492 | + if (!$db_info->use_prepared_statements) |
|
| 493 | 493 | { |
| 494 | 494 | $db_info->use_prepared_statements = 'Y'; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - if(!$db_info->time_zone) |
|
| 497 | + if (!$db_info->time_zone) |
|
| 498 | 498 | $db_info->time_zone = date('O'); |
| 499 | 499 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 500 | 500 | |
| 501 | - if($db_info->qmail_compatibility != 'Y') |
|
| 501 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 502 | 502 | $db_info->qmail_compatibility = 'N'; |
| 503 | 503 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 504 | 504 | |
| 505 | - if(!$db_info->use_db_session) |
|
| 505 | + if (!$db_info->use_db_session) |
|
| 506 | 506 | $db_info->use_db_session = 'N'; |
| 507 | - if(!$db_info->use_ssl) |
|
| 507 | + if (!$db_info->use_ssl) |
|
| 508 | 508 | $db_info->use_ssl = 'none'; |
| 509 | 509 | $this->set('_use_ssl', $db_info->use_ssl); |
| 510 | 510 | |
| 511 | 511 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 512 | 512 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 513 | 513 | |
| 514 | - if(!$db_info->sitelock_whitelist) { |
|
| 514 | + if (!$db_info->sitelock_whitelist) { |
|
| 515 | 515 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 518 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 519 | 519 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 520 | 520 | } |
| 521 | 521 | |
@@ -586,10 +586,10 @@ discard block |
||
| 586 | 586 | function loadLangSupported() |
| 587 | 587 | { |
| 588 | 588 | static $lang_supported = null; |
| 589 | - if(!$lang_supported) |
|
| 589 | + if (!$lang_supported) |
|
| 590 | 590 | { |
| 591 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 592 | - foreach($langs as $val) |
|
| 591 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 592 | + foreach ($langs as $val) |
|
| 593 | 593 | { |
| 594 | 594 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 595 | 595 | $lang_text = trim($lang_text); |
@@ -607,17 +607,17 @@ discard block |
||
| 607 | 607 | function loadLangSelected() |
| 608 | 608 | { |
| 609 | 609 | static $lang_selected = null; |
| 610 | - if(!$lang_selected) |
|
| 610 | + if (!$lang_selected) |
|
| 611 | 611 | { |
| 612 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 613 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 614 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 612 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 613 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 614 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 615 | 615 | { |
| 616 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 616 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 617 | 617 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 620 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 621 | 621 | { |
| 622 | 622 | $buff = FileHandler::readFile($orig_lang_file); |
| 623 | 623 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | else |
| 627 | 627 | { |
| 628 | 628 | $langs = file($selected_lang_file); |
| 629 | - foreach($langs as $val) |
|
| 629 | + foreach ($langs as $val) |
|
| 630 | 630 | { |
| 631 | 631 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 632 | 632 | $lang_text = trim($lang_text); |
@@ -645,44 +645,44 @@ discard block |
||
| 645 | 645 | function checkSSO() |
| 646 | 646 | { |
| 647 | 647 | // pass if it's not GET request or XE is not yet installed |
| 648 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 648 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 649 | 649 | { |
| 650 | 650 | return TRUE; |
| 651 | 651 | } |
| 652 | 652 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 653 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 653 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 654 | 654 | { |
| 655 | 655 | return TRUE; |
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | // pass if default URL is not set |
| 659 | 659 | $default_url = trim($this->db_info->default_url); |
| 660 | - if(!$default_url) |
|
| 660 | + if (!$default_url) |
|
| 661 | 661 | { |
| 662 | 662 | return TRUE; |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 665 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 666 | 666 | { |
| 667 | 667 | $default_url .= '/'; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | // for sites recieving SSO valdiation |
| 671 | - if($default_url == self::getRequestUri()) |
|
| 671 | + if ($default_url == self::getRequestUri()) |
|
| 672 | 672 | { |
| 673 | - if(self::get('url')) |
|
| 673 | + if (self::get('url')) |
|
| 674 | 674 | { |
| 675 | 675 | $url = base64_decode(self::get('url')); |
| 676 | 676 | $url_info = parse_url($url); |
| 677 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 677 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 678 | 678 | { |
| 679 | 679 | echo self::get('lang')->msg_invalid_request; |
| 680 | 680 | return false; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 684 | - $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':' . $url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 685 | - header('location:' . $redirect_url); |
|
| 683 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 684 | + $redirect_url = sprintf('%s://%s%s%s?%s', $url_info['scheme'], $url_info['host'], $url_info['port'] ? ':'.$url_info['port'] : '', $url_info['path'], $url_info['query']); |
|
| 685 | + header('location:'.$redirect_url); |
|
| 686 | 686 | |
| 687 | 687 | return FALSE; |
| 688 | 688 | } |
@@ -691,9 +691,9 @@ discard block |
||
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | 693 | // result handling : set session_name() |
| 694 | - if($session_name = self::get('SSOID')) |
|
| 694 | + if ($session_name = self::get('SSOID')) |
|
| 695 | 695 | { |
| 696 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 696 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 697 | 697 | { |
| 698 | 698 | echo self::get('lang')->msg_invalid_request; |
| 699 | 699 | return false; |
@@ -702,17 +702,17 @@ discard block |
||
| 702 | 702 | setcookie(session_name(), $session_name); |
| 703 | 703 | |
| 704 | 704 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 705 | - header('location:' . $url); |
|
| 705 | + header('location:'.$url); |
|
| 706 | 706 | return FALSE; |
| 707 | 707 | // send SSO request |
| 708 | 708 | } |
| 709 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 709 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 710 | 710 | { |
| 711 | 711 | setcookie('sso', md5(self::getRequestUri()), 0, '/'); |
| 712 | 712 | $origin_url = self::getRequestUrl(); |
| 713 | 713 | $origin_sig = Password::createSignature($origin_url); |
| 714 | 714 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 715 | - header('location:' . $url); |
|
| 715 | + header('location:'.$url); |
|
| 716 | 716 | return FALSE; |
| 717 | 717 | } |
| 718 | 718 | } |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | { |
| 740 | 740 | $self = self::getInstance(); |
| 741 | 741 | |
| 742 | - if(!$self->isFTPRegisted()) |
|
| 742 | + if (!$self->isFTPRegisted()) |
|
| 743 | 743 | { |
| 744 | 744 | return null; |
| 745 | 745 | } |
@@ -757,15 +757,15 @@ discard block |
||
| 757 | 757 | */ |
| 758 | 758 | function addBrowserTitle($site_title) |
| 759 | 759 | { |
| 760 | - if(!$site_title) |
|
| 760 | + if (!$site_title) |
|
| 761 | 761 | { |
| 762 | 762 | return; |
| 763 | 763 | } |
| 764 | 764 | $self = self::getInstance(); |
| 765 | 765 | |
| 766 | - if($self->site_title) |
|
| 766 | + if ($self->site_title) |
|
| 767 | 767 | { |
| 768 | - $self->site_title .= ' - ' . $site_title; |
|
| 768 | + $self->site_title .= ' - '.$site_title; |
|
| 769 | 769 | } |
| 770 | 770 | else |
| 771 | 771 | { |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | function setBrowserTitle($site_title) |
| 783 | 783 | { |
| 784 | - if(!$site_title) |
|
| 784 | + if (!$site_title) |
|
| 785 | 785 | { |
| 786 | 786 | return; |
| 787 | 787 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | $oModuleModel = getModel('module'); |
| 814 | 814 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 815 | 815 | |
| 816 | - if(isset($moduleConfig->siteTitle)) |
|
| 816 | + if (isset($moduleConfig->siteTitle)) |
|
| 817 | 817 | { |
| 818 | 818 | return $moduleConfig->siteTitle; |
| 819 | 819 | } |
@@ -840,30 +840,30 @@ discard block |
||
| 840 | 840 | global $lang; |
| 841 | 841 | |
| 842 | 842 | $self = self::getInstance(); |
| 843 | - if(!$self->lang_type) |
|
| 843 | + if (!$self->lang_type) |
|
| 844 | 844 | { |
| 845 | 845 | return; |
| 846 | 846 | } |
| 847 | - if(!is_object($lang)) |
|
| 847 | + if (!is_object($lang)) |
|
| 848 | 848 | { |
| 849 | 849 | $lang = new stdClass; |
| 850 | 850 | } |
| 851 | 851 | |
| 852 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 852 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 853 | 853 | { |
| 854 | 854 | $filename = $self->_loadPhpLang($path); |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - if(!is_array($self->loaded_lang_files)) |
|
| 857 | + if (!is_array($self->loaded_lang_files)) |
|
| 858 | 858 | { |
| 859 | 859 | $self->loaded_lang_files = array(); |
| 860 | 860 | } |
| 861 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 861 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 862 | 862 | { |
| 863 | 863 | return; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | - if($filename && is_readable($filename)) |
|
| 866 | + if ($filename && is_readable($filename)) |
|
| 867 | 867 | { |
| 868 | 868 | $self->loaded_lang_files[] = $filename; |
| 869 | 869 | include($filename); |
@@ -884,24 +884,24 @@ discard block |
||
| 884 | 884 | { |
| 885 | 885 | global $lang; |
| 886 | 886 | |
| 887 | - if(!$path) return; |
|
| 887 | + if (!$path) return; |
|
| 888 | 888 | |
| 889 | - $_path = 'eval://' . $path; |
|
| 889 | + $_path = 'eval://'.$path; |
|
| 890 | 890 | |
| 891 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 891 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 892 | 892 | { |
| 893 | 893 | return; |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 896 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 897 | 897 | { |
| 898 | 898 | $path .= '/'; |
| 899 | 899 | } |
| 900 | 900 | |
| 901 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 901 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 902 | 902 | $content = $oXmlLangParser->getCompileContent(); |
| 903 | 903 | |
| 904 | - if($content) |
|
| 904 | + if ($content) |
|
| 905 | 905 | { |
| 906 | 906 | $this->loaded_lang_files[] = $_path; |
| 907 | 907 | eval($content); |
@@ -916,9 +916,9 @@ discard block |
||
| 916 | 916 | */ |
| 917 | 917 | function _loadXmlLang($path) |
| 918 | 918 | { |
| 919 | - if(!$path) return; |
|
| 919 | + if (!$path) return; |
|
| 920 | 920 | |
| 921 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 921 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 922 | 922 | return $oXmlLangParser->compile(); |
| 923 | 923 | } |
| 924 | 924 | |
@@ -930,22 +930,22 @@ discard block |
||
| 930 | 930 | */ |
| 931 | 931 | function _loadPhpLang($path) |
| 932 | 932 | { |
| 933 | - if(!$path) return; |
|
| 933 | + if (!$path) return; |
|
| 934 | 934 | |
| 935 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 935 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 936 | 936 | { |
| 937 | 937 | $path .= '/'; |
| 938 | 938 | } |
| 939 | - $path_tpl = $path . '%s.lang.php'; |
|
| 939 | + $path_tpl = $path.'%s.lang.php'; |
|
| 940 | 940 | $file = sprintf($path_tpl, $this->lang_type); |
| 941 | 941 | |
| 942 | 942 | $langs = array('ko', 'en'); // this will be configurable. |
| 943 | - while(!is_readable($file) && $langs[0]) |
|
| 943 | + while (!is_readable($file) && $langs[0]) |
|
| 944 | 944 | { |
| 945 | 945 | $file = sprintf($path_tpl, array_shift($langs)); |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | - if(!is_readable($file)) |
|
| 948 | + if (!is_readable($file)) |
|
| 949 | 949 | { |
| 950 | 950 | return FALSE; |
| 951 | 951 | } |
@@ -987,11 +987,11 @@ discard block |
||
| 987 | 987 | */ |
| 988 | 988 | function getLang($code) |
| 989 | 989 | { |
| 990 | - if(!$code) |
|
| 990 | + if (!$code) |
|
| 991 | 991 | { |
| 992 | 992 | return; |
| 993 | 993 | } |
| 994 | - if($GLOBALS['lang']->{$code}) |
|
| 994 | + if ($GLOBALS['lang']->{$code}) |
|
| 995 | 995 | { |
| 996 | 996 | return $GLOBALS['lang']->{$code}; |
| 997 | 997 | } |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | */ |
| 1008 | 1008 | function setLang($code, $val) |
| 1009 | 1009 | { |
| 1010 | - if(!isset($GLOBALS['lang'])) |
|
| 1010 | + if (!isset($GLOBALS['lang'])) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $GLOBALS['lang'] = new stdClass(); |
| 1013 | 1013 | } |
@@ -1035,17 +1035,17 @@ discard block |
||
| 1035 | 1035 | |
| 1036 | 1036 | $obj = clone $source_obj; |
| 1037 | 1037 | |
| 1038 | - foreach($charset_list as $charset) |
|
| 1038 | + foreach ($charset_list as $charset) |
|
| 1039 | 1039 | { |
| 1040 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1040 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1041 | 1041 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1042 | - if($flag) |
|
| 1042 | + if ($flag) |
|
| 1043 | 1043 | { |
| 1044 | - if($charset == 'UTF-8') |
|
| 1044 | + if ($charset == 'UTF-8') |
|
| 1045 | 1045 | { |
| 1046 | 1046 | return $obj; |
| 1047 | 1047 | } |
| 1048 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1048 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1049 | 1049 | return $obj; |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
@@ -1064,11 +1064,11 @@ discard block |
||
| 1064 | 1064 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1065 | 1065 | { |
| 1066 | 1066 | static $flag = TRUE; |
| 1067 | - if($charset) |
|
| 1067 | + if ($charset) |
|
| 1068 | 1068 | { |
| 1069 | - if(is_array($val)) |
|
| 1070 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1071 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1069 | + if (is_array($val)) |
|
| 1070 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1071 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1072 | 1072 | else $flag = FALSE; |
| 1073 | 1073 | } |
| 1074 | 1074 | else |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | { |
| 1093 | 1093 | if (is_array($val)) |
| 1094 | 1094 | { |
| 1095 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1095 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1096 | 1096 | } |
| 1097 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1097 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1098 | 1098 | } |
| 1099 | 1099 | |
| 1100 | 1100 | /** |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | function convertEncodingStr($str) |
| 1107 | 1107 | { |
| 1108 | - if(!$str) return null; |
|
| 1108 | + if (!$str) return null; |
|
| 1109 | 1109 | $obj = new stdClass(); |
| 1110 | 1110 | $obj->str = $str; |
| 1111 | 1111 | $obj = self::convertEncoding($obj); |
@@ -1114,9 +1114,9 @@ discard block |
||
| 1114 | 1114 | |
| 1115 | 1115 | function decodeIdna($domain) |
| 1116 | 1116 | { |
| 1117 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1117 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1118 | 1118 | { |
| 1119 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1119 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1120 | 1120 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1121 | 1121 | $domain = $IDN->decode($domain); |
| 1122 | 1122 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | { |
| 1148 | 1148 | $self = self::getInstance(); |
| 1149 | 1149 | |
| 1150 | - if($self->response_method) |
|
| 1150 | + if ($self->response_method) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | return $self->response_method; |
| 1153 | 1153 | } |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1188 | 1188 | |
| 1189 | 1189 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1190 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1190 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1191 | 1191 | { |
| 1192 | 1192 | $this->isSuccessInit = FALSE; |
| 1193 | 1193 | } |
@@ -1200,30 +1200,30 @@ discard block |
||
| 1200 | 1200 | */ |
| 1201 | 1201 | function _setRequestArgument() |
| 1202 | 1202 | { |
| 1203 | - if(!count($_REQUEST)) |
|
| 1203 | + if (!count($_REQUEST)) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | return; |
| 1206 | 1206 | } |
| 1207 | 1207 | |
| 1208 | 1208 | $requestMethod = $this->getRequestMethod(); |
| 1209 | - foreach($_REQUEST as $key => $val) |
|
| 1209 | + foreach ($_REQUEST as $key => $val) |
|
| 1210 | 1210 | { |
| 1211 | - if($val === '' || self::get($key)) |
|
| 1211 | + if ($val === '' || self::get($key)) |
|
| 1212 | 1212 | { |
| 1213 | 1213 | continue; |
| 1214 | 1214 | } |
| 1215 | 1215 | $key = htmlentities($key); |
| 1216 | 1216 | $val = $this->_filterRequestVar($key, $val); |
| 1217 | 1217 | |
| 1218 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1218 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | $set_to_vars = TRUE; |
| 1221 | 1221 | } |
| 1222 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1222 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1223 | 1223 | { |
| 1224 | 1224 | $set_to_vars = TRUE; |
| 1225 | 1225 | } |
| 1226 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1226 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1227 | 1227 | { |
| 1228 | 1228 | $set_to_vars = TRUE; |
| 1229 | 1229 | } |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | $set_to_vars = FALSE; |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | - if($set_to_vars) |
|
| 1235 | + if ($set_to_vars) |
|
| 1236 | 1236 | { |
| 1237 | 1237 | $this->_recursiveCheckVar($val); |
| 1238 | 1238 | } |
@@ -1243,20 +1243,20 @@ discard block |
||
| 1243 | 1243 | |
| 1244 | 1244 | function _recursiveCheckVar($val) |
| 1245 | 1245 | { |
| 1246 | - if(is_string($val)) |
|
| 1246 | + if (is_string($val)) |
|
| 1247 | 1247 | { |
| 1248 | - foreach($this->patterns as $pattern) |
|
| 1248 | + foreach ($this->patterns as $pattern) |
|
| 1249 | 1249 | { |
| 1250 | - if(preg_match($pattern, $val)) |
|
| 1250 | + if (preg_match($pattern, $val)) |
|
| 1251 | 1251 | { |
| 1252 | 1252 | $this->isSuccessInit = FALSE; |
| 1253 | 1253 | return; |
| 1254 | 1254 | } |
| 1255 | 1255 | } |
| 1256 | 1256 | } |
| 1257 | - else if(is_array($val)) |
|
| 1257 | + else if (is_array($val)) |
|
| 1258 | 1258 | { |
| 1259 | - foreach($val as $val2) |
|
| 1259 | + foreach ($val as $val2) |
|
| 1260 | 1260 | { |
| 1261 | 1261 | $this->_recursiveCheckVar($val2); |
| 1262 | 1262 | } |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | */ |
| 1271 | 1271 | function _setJSONRequestArgument() |
| 1272 | 1272 | { |
| 1273 | - if($this->getRequestMethod() != 'JSON') |
|
| 1273 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1274 | 1274 | { |
| 1275 | 1275 | return; |
| 1276 | 1276 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | $params = array(); |
| 1279 | 1279 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1280 | 1280 | |
| 1281 | - foreach($params as $key => $val) |
|
| 1281 | + foreach ($params as $key => $val) |
|
| 1282 | 1282 | { |
| 1283 | 1283 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
| 1284 | 1284 | } |
@@ -1291,13 +1291,13 @@ discard block |
||
| 1291 | 1291 | */ |
| 1292 | 1292 | function _setXmlRpcArgument() |
| 1293 | 1293 | { |
| 1294 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1294 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1295 | 1295 | { |
| 1296 | 1296 | return; |
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1300 | - if(Security::detectingXEE($xml)) |
|
| 1300 | + if (Security::detectingXEE($xml)) |
|
| 1301 | 1301 | { |
| 1302 | 1302 | header("HTTP/1.0 400 Bad Request"); |
| 1303 | 1303 | exit; |
@@ -1309,12 +1309,12 @@ discard block |
||
| 1309 | 1309 | $params = $xml_obj->methodcall->params; |
| 1310 | 1310 | unset($params->node_name, $params->attrs, $params->body); |
| 1311 | 1311 | |
| 1312 | - if(!count(get_object_vars($params))) |
|
| 1312 | + if (!count(get_object_vars($params))) |
|
| 1313 | 1313 | { |
| 1314 | 1314 | return; |
| 1315 | 1315 | } |
| 1316 | 1316 | |
| 1317 | - foreach($params as $key => $val) |
|
| 1317 | + foreach ($params as $key => $val) |
|
| 1318 | 1318 | { |
| 1319 | 1319 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1320 | 1320 | } |
@@ -1329,10 +1329,10 @@ discard block |
||
| 1329 | 1329 | */ |
| 1330 | 1330 | function _filterXmlVars($key, $val) |
| 1331 | 1331 | { |
| 1332 | - if(is_array($val)) |
|
| 1332 | + if (is_array($val)) |
|
| 1333 | 1333 | { |
| 1334 | 1334 | $stack = array(); |
| 1335 | - foreach($val as $k => $v) |
|
| 1335 | + foreach ($val as $k => $v) |
|
| 1336 | 1336 | { |
| 1337 | 1337 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1338 | 1338 | } |
@@ -1342,20 +1342,20 @@ discard block |
||
| 1342 | 1342 | |
| 1343 | 1343 | $body = $val->body; |
| 1344 | 1344 | unset($val->node_name, $val->attrs, $val->body); |
| 1345 | - if(!count(get_object_vars($val))) |
|
| 1345 | + if (!count(get_object_vars($val))) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | return $this->_filterRequestVar($key, $body, 0); |
| 1348 | 1348 | } |
| 1349 | 1349 | |
| 1350 | 1350 | $stack = new stdClass(); |
| 1351 | - foreach($val as $k => $v) |
|
| 1351 | + foreach ($val as $k => $v) |
|
| 1352 | 1352 | { |
| 1353 | 1353 | $output = $this->_filterXmlVars($k, $v); |
| 1354 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1354 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1355 | 1355 | { |
| 1356 | 1356 | $output = array($output); |
| 1357 | 1357 | } |
| 1358 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1358 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1359 | 1359 | { |
| 1360 | 1360 | return $output; |
| 1361 | 1361 | } |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | $stack->{$k} = $output; |
| 1364 | 1364 | } |
| 1365 | 1365 | |
| 1366 | - if(!count(get_object_vars($stack))) |
|
| 1366 | + if (!count(get_object_vars($stack))) |
|
| 1367 | 1367 | { |
| 1368 | 1368 | return NULL; |
| 1369 | 1369 | } |
@@ -1382,24 +1382,24 @@ discard block |
||
| 1382 | 1382 | */ |
| 1383 | 1383 | function _filterRequestVar($key, $val, $do_stripslashes = 1) |
| 1384 | 1384 | { |
| 1385 | - if(!($isArray = is_array($val))) |
|
| 1385 | + if (!($isArray = is_array($val))) |
|
| 1386 | 1386 | { |
| 1387 | 1387 | $val = array($val); |
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | $result = array(); |
| 1391 | - foreach($val as $k => $v) |
|
| 1391 | + foreach ($val as $k => $v) |
|
| 1392 | 1392 | { |
| 1393 | 1393 | $k = htmlentities($k); |
| 1394 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1394 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1395 | 1395 | { |
| 1396 | 1396 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1397 | 1397 | } |
| 1398 | - elseif($key === 'mid' || $key === 'search_keyword') |
|
| 1398 | + elseif ($key === 'mid' || $key === 'search_keyword') |
|
| 1399 | 1399 | { |
| 1400 | 1400 | $result[$k] = htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1401 | 1401 | } |
| 1402 | - elseif($key === 'vid') |
|
| 1402 | + elseif ($key === 'vid') |
|
| 1403 | 1403 | { |
| 1404 | 1404 | $result[$k] = urlencode($v); |
| 1405 | 1405 | } |
@@ -1407,12 +1407,12 @@ discard block |
||
| 1407 | 1407 | { |
| 1408 | 1408 | $result[$k] = $v; |
| 1409 | 1409 | |
| 1410 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1410 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | $result[$k] = stripslashes($result[$k]); |
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | - if(!is_array($result[$k])) |
|
| 1415 | + if (!is_array($result[$k])) |
|
| 1416 | 1416 | { |
| 1417 | 1417 | $result[$k] = trim($result[$k]); |
| 1418 | 1418 | } |
@@ -1440,17 +1440,17 @@ discard block |
||
| 1440 | 1440 | */ |
| 1441 | 1441 | function _setUploadedArgument() |
| 1442 | 1442 | { |
| 1443 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1443 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1444 | 1444 | { |
| 1445 | 1445 | return; |
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | - foreach($_FILES as $key => $val) |
|
| 1448 | + foreach ($_FILES as $key => $val) |
|
| 1449 | 1449 | { |
| 1450 | 1450 | $tmp_name = $val['tmp_name']; |
| 1451 | - if(!is_array($tmp_name)) |
|
| 1451 | + if (!is_array($tmp_name)) |
|
| 1452 | 1452 | { |
| 1453 | - if(!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1453 | + if (!$tmp_name || !is_uploaded_file($tmp_name)) |
|
| 1454 | 1454 | { |
| 1455 | 1455 | continue; |
| 1456 | 1456 | } |
@@ -1460,9 +1460,9 @@ discard block |
||
| 1460 | 1460 | } |
| 1461 | 1461 | else |
| 1462 | 1462 | { |
| 1463 | - for($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1463 | + for ($i = 0, $c = count($tmp_name); $i < $c; $i++) |
|
| 1464 | 1464 | { |
| 1465 | - if($val['size'][$i] > 0) |
|
| 1465 | + if ($val['size'][$i] > 0) |
|
| 1466 | 1466 | { |
| 1467 | 1467 | $file['name'] = $val['name'][$i]; |
| 1468 | 1468 | $file['type'] = $val['type'][$i]; |
@@ -1494,16 +1494,16 @@ discard block |
||
| 1494 | 1494 | function getRequestUrl() |
| 1495 | 1495 | { |
| 1496 | 1496 | static $url = null; |
| 1497 | - if(is_null($url)) |
|
| 1497 | + if (is_null($url)) |
|
| 1498 | 1498 | { |
| 1499 | 1499 | $url = self::getRequestUri(); |
| 1500 | - if(count($_GET) > 0) |
|
| 1500 | + if (count($_GET) > 0) |
|
| 1501 | 1501 | { |
| 1502 | - foreach($_GET as $key => $val) |
|
| 1502 | + foreach ($_GET as $key => $val) |
|
| 1503 | 1503 | { |
| 1504 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1504 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1505 | 1505 | } |
| 1506 | - $url .= '?' . join('&', $vars); |
|
| 1506 | + $url .= '?'.join('&', $vars); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | } |
| 1509 | 1509 | return $url; |
@@ -1518,7 +1518,7 @@ discard block |
||
| 1518 | 1518 | $self = self::getInstance(); |
| 1519 | 1519 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1520 | 1520 | |
| 1521 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1521 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1522 | 1522 | { |
| 1523 | 1523 | unset($js_callback_func); |
| 1524 | 1524 | unset($_GET['xe_js_callback']); |
@@ -1546,22 +1546,22 @@ discard block |
||
| 1546 | 1546 | $self = self::getInstance(); |
| 1547 | 1547 | |
| 1548 | 1548 | // retrieve virtual site information |
| 1549 | - if(is_null($site_module_info)) |
|
| 1549 | + if (is_null($site_module_info)) |
|
| 1550 | 1550 | { |
| 1551 | 1551 | $site_module_info = self::get('site_module_info'); |
| 1552 | 1552 | } |
| 1553 | 1553 | |
| 1554 | 1554 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1555 | - if($domain && isSiteID($domain)) |
|
| 1555 | + if ($domain && isSiteID($domain)) |
|
| 1556 | 1556 | { |
| 1557 | 1557 | $vid = $domain; |
| 1558 | 1558 | $domain = ''; |
| 1559 | 1559 | } |
| 1560 | 1560 | |
| 1561 | 1561 | // If $domain, $vid are not set, use current site information |
| 1562 | - if(!$domain && !$vid) |
|
| 1562 | + if (!$domain && !$vid) |
|
| 1563 | 1563 | { |
| 1564 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1564 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1565 | 1565 | { |
| 1566 | 1566 | $vid = $site_module_info->domain; |
| 1567 | 1567 | } |
@@ -1572,21 +1572,21 @@ discard block |
||
| 1572 | 1572 | } |
| 1573 | 1573 | |
| 1574 | 1574 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1575 | - if($domain) |
|
| 1575 | + if ($domain) |
|
| 1576 | 1576 | { |
| 1577 | 1577 | $domain_info = parse_url($domain); |
| 1578 | - if(is_null($current_info)) |
|
| 1578 | + if (is_null($current_info)) |
|
| 1579 | 1579 | { |
| 1580 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1580 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1581 | 1581 | } |
| 1582 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1582 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1583 | 1583 | { |
| 1584 | 1584 | unset($domain); |
| 1585 | 1585 | } |
| 1586 | 1586 | else |
| 1587 | 1587 | { |
| 1588 | 1588 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1589 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1589 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1590 | 1590 | { |
| 1591 | 1591 | $domain .= '/'; |
| 1592 | 1592 | } |
@@ -1596,10 +1596,10 @@ discard block |
||
| 1596 | 1596 | $get_vars = array(); |
| 1597 | 1597 | |
| 1598 | 1598 | // If there is no GET variables or first argument is '' to reset variables |
| 1599 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1599 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1600 | 1600 | { |
| 1601 | 1601 | // rearrange args_list |
| 1602 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1602 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1603 | 1603 | { |
| 1604 | 1604 | array_shift($args_list); |
| 1605 | 1605 | } |
@@ -1611,13 +1611,13 @@ discard block |
||
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | // arrange args_list |
| 1614 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1614 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1615 | 1615 | { |
| 1616 | 1616 | $key = $args_list[$i]; |
| 1617 | 1617 | $val = trim($args_list[$i + 1]); |
| 1618 | 1618 | |
| 1619 | 1619 | // If value is not set, remove the key |
| 1620 | - if(!isset($val) || !strlen($val)) |
|
| 1620 | + if (!isset($val) || !strlen($val)) |
|
| 1621 | 1621 | { |
| 1622 | 1622 | unset($get_vars[$key]); |
| 1623 | 1623 | continue; |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | |
| 1629 | 1629 | // remove vid, rnd |
| 1630 | 1630 | unset($get_vars['rnd']); |
| 1631 | - if($vid) |
|
| 1631 | + if ($vid) |
|
| 1632 | 1632 | { |
| 1633 | 1633 | $get_vars['vid'] = $vid; |
| 1634 | 1634 | } |
@@ -1645,17 +1645,17 @@ discard block |
||
| 1645 | 1645 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1646 | 1646 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1647 | 1647 | ); |
| 1648 | - if($act_alias[$act]) |
|
| 1648 | + if ($act_alias[$act]) |
|
| 1649 | 1649 | { |
| 1650 | 1650 | $get_vars['act'] = $act_alias[$act]; |
| 1651 | 1651 | } |
| 1652 | 1652 | |
| 1653 | 1653 | // organize URL |
| 1654 | 1654 | $query = ''; |
| 1655 | - if(count($get_vars) > 0) |
|
| 1655 | + if (count($get_vars) > 0) |
|
| 1656 | 1656 | { |
| 1657 | 1657 | // if using rewrite mod |
| 1658 | - if($self->allow_rewrite) |
|
| 1658 | + if ($self->allow_rewrite) |
|
| 1659 | 1659 | { |
| 1660 | 1660 | $var_keys = array_keys($get_vars); |
| 1661 | 1661 | sort($var_keys); |
@@ -1675,8 +1675,8 @@ discard block |
||
| 1675 | 1675 | 'vid' => $vid, |
| 1676 | 1676 | 'mid' => $mid, |
| 1677 | 1677 | 'mid.vid' => "$vid/$mid", |
| 1678 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1679 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1678 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1679 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1680 | 1680 | 'document_srl' => $srl, |
| 1681 | 1681 | 'document_srl.mid' => "$mid/$srl", |
| 1682 | 1682 | 'document_srl.vid' => "$vid/$srl", |
@@ -1693,66 +1693,66 @@ discard block |
||
| 1693 | 1693 | $query = $target_map[$target]; |
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | - if(!$query) |
|
| 1696 | + if (!$query) |
|
| 1697 | 1697 | { |
| 1698 | 1698 | $queries = array(); |
| 1699 | - foreach($get_vars as $key => $val) |
|
| 1699 | + foreach ($get_vars as $key => $val) |
|
| 1700 | 1700 | { |
| 1701 | - if(is_array($val) && count($val) > 0) |
|
| 1701 | + if (is_array($val) && count($val) > 0) |
|
| 1702 | 1702 | { |
| 1703 | - foreach($val as $k => $v) |
|
| 1703 | + foreach ($val as $k => $v) |
|
| 1704 | 1704 | { |
| 1705 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1705 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1706 | 1706 | } |
| 1707 | 1707 | } |
| 1708 | - elseif(!is_array($val)) |
|
| 1708 | + elseif (!is_array($val)) |
|
| 1709 | 1709 | { |
| 1710 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1710 | + $queries[] = $key.'='.urlencode($val); |
|
| 1711 | 1711 | } |
| 1712 | 1712 | } |
| 1713 | - if(count($queries) > 0) |
|
| 1713 | + if (count($queries) > 0) |
|
| 1714 | 1714 | { |
| 1715 | - $query = 'index.php?' . join('&', $queries); |
|
| 1715 | + $query = 'index.php?'.join('&', $queries); |
|
| 1716 | 1716 | } |
| 1717 | 1717 | } |
| 1718 | 1718 | } |
| 1719 | 1719 | |
| 1720 | 1720 | // If using SSL always |
| 1721 | 1721 | $_use_ssl = $self->get('_use_ssl'); |
| 1722 | - if($_use_ssl == 'always') |
|
| 1722 | + if ($_use_ssl == 'always') |
|
| 1723 | 1723 | { |
| 1724 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1724 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1725 | 1725 | // optional SSL use |
| 1726 | 1726 | } |
| 1727 | - elseif($_use_ssl == 'optional') |
|
| 1727 | + elseif ($_use_ssl == 'optional') |
|
| 1728 | 1728 | { |
| 1729 | 1729 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1730 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1730 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1731 | 1731 | // no SSL |
| 1732 | 1732 | } |
| 1733 | 1733 | else |
| 1734 | 1734 | { |
| 1735 | 1735 | // currently on SSL but target is not based on SSL |
| 1736 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1736 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1737 | 1737 | { |
| 1738 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1738 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1739 | 1739 | } |
| 1740 | - else if($domain) // if $domain is set |
|
| 1740 | + else if ($domain) // if $domain is set |
|
| 1741 | 1741 | { |
| 1742 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1742 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1743 | 1743 | } |
| 1744 | 1744 | else |
| 1745 | 1745 | { |
| 1746 | - $query = getScriptPath() . $query; |
|
| 1746 | + $query = getScriptPath().$query; |
|
| 1747 | 1747 | } |
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | - if(!$encode) |
|
| 1750 | + if (!$encode) |
|
| 1751 | 1751 | { |
| 1752 | 1752 | return $query; |
| 1753 | 1753 | } |
| 1754 | 1754 | |
| 1755 | - if(!$autoEncode) |
|
| 1755 | + if (!$autoEncode) |
|
| 1756 | 1756 | { |
| 1757 | 1757 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1758 | 1758 | } |
@@ -1761,16 +1761,16 @@ discard block |
||
| 1761 | 1761 | $encode_queries = array(); |
| 1762 | 1762 | $parsedUrl = parse_url($query); |
| 1763 | 1763 | parse_str($parsedUrl['query'], $output); |
| 1764 | - foreach($output as $key => $value) |
|
| 1764 | + foreach ($output as $key => $value) |
|
| 1765 | 1765 | { |
| 1766 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1766 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1767 | 1767 | { |
| 1768 | 1768 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1769 | 1769 | } |
| 1770 | - $encode_queries[] = $key . '=' . $value; |
|
| 1770 | + $encode_queries[] = $key.'='.$value; |
|
| 1771 | 1771 | } |
| 1772 | 1772 | |
| 1773 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1773 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1774 | 1774 | } |
| 1775 | 1775 | |
| 1776 | 1776 | /** |
@@ -1785,17 +1785,17 @@ discard block |
||
| 1785 | 1785 | static $url = array(); |
| 1786 | 1786 | |
| 1787 | 1787 | // Check HTTP Request |
| 1788 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1788 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1789 | 1789 | { |
| 1790 | 1790 | return; |
| 1791 | 1791 | } |
| 1792 | 1792 | |
| 1793 | - if(self::get('_use_ssl') == 'always') |
|
| 1793 | + if (self::get('_use_ssl') == 'always') |
|
| 1794 | 1794 | { |
| 1795 | 1795 | $ssl_mode = ENFORCE_SSL; |
| 1796 | 1796 | } |
| 1797 | 1797 | |
| 1798 | - if($domain) |
|
| 1798 | + if ($domain) |
|
| 1799 | 1799 | { |
| 1800 | 1800 | $domain_key = md5($domain); |
| 1801 | 1801 | } |
@@ -1804,14 +1804,14 @@ discard block |
||
| 1804 | 1804 | $domain_key = 'default'; |
| 1805 | 1805 | } |
| 1806 | 1806 | |
| 1807 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1807 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1808 | 1808 | { |
| 1809 | 1809 | return $url[$ssl_mode][$domain_key]; |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | 1812 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1813 | 1813 | |
| 1814 | - switch($ssl_mode) |
|
| 1814 | + switch ($ssl_mode) |
|
| 1815 | 1815 | { |
| 1816 | 1816 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1817 | 1817 | break; |
@@ -1821,34 +1821,34 @@ discard block |
||
| 1821 | 1821 | break; |
| 1822 | 1822 | } |
| 1823 | 1823 | |
| 1824 | - if($domain) |
|
| 1824 | + if ($domain) |
|
| 1825 | 1825 | { |
| 1826 | 1826 | $target_url = trim($domain); |
| 1827 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1827 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1828 | 1828 | { |
| 1829 | - $target_url.= '/'; |
|
| 1829 | + $target_url .= '/'; |
|
| 1830 | 1830 | } |
| 1831 | 1831 | } |
| 1832 | 1832 | else |
| 1833 | 1833 | { |
| 1834 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1834 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | - $url_info = parse_url('http://' . $target_url); |
|
| 1837 | + $url_info = parse_url('http://'.$target_url); |
|
| 1838 | 1838 | |
| 1839 | - if($current_use_ssl != $use_ssl) |
|
| 1839 | + if ($current_use_ssl != $use_ssl) |
|
| 1840 | 1840 | { |
| 1841 | 1841 | unset($url_info['port']); |
| 1842 | 1842 | } |
| 1843 | 1843 | |
| 1844 | - if($use_ssl) |
|
| 1844 | + if ($use_ssl) |
|
| 1845 | 1845 | { |
| 1846 | 1846 | $port = self::get('_https_port'); |
| 1847 | - if($port && $port != 443) |
|
| 1847 | + if ($port && $port != 443) |
|
| 1848 | 1848 | { |
| 1849 | 1849 | $url_info['port'] = $port; |
| 1850 | 1850 | } |
| 1851 | - elseif($url_info['port'] == 443) |
|
| 1851 | + elseif ($url_info['port'] == 443) |
|
| 1852 | 1852 | { |
| 1853 | 1853 | unset($url_info['port']); |
| 1854 | 1854 | } |
@@ -1856,17 +1856,17 @@ discard block |
||
| 1856 | 1856 | else |
| 1857 | 1857 | { |
| 1858 | 1858 | $port = self::get('_http_port'); |
| 1859 | - if($port && $port != 80) |
|
| 1859 | + if ($port && $port != 80) |
|
| 1860 | 1860 | { |
| 1861 | 1861 | $url_info['port'] = $port; |
| 1862 | 1862 | } |
| 1863 | - elseif($url_info['port'] == 80) |
|
| 1863 | + elseif ($url_info['port'] == 80) |
|
| 1864 | 1864 | { |
| 1865 | 1865 | unset($url_info['port']); |
| 1866 | 1866 | } |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| 1869 | - $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':' . $url_info['port'] : '', $url_info['path']); |
|
| 1869 | + $url[$ssl_mode][$domain_key] = sprintf('%s://%s%s%s', $use_ssl ? 'https' : $url_info['scheme'], $url_info['host'], $url_info['port'] && $url_info['port'] != 80 ? ':'.$url_info['port'] : '', $url_info['path']); |
|
| 1870 | 1870 | |
| 1871 | 1871 | return $url[$ssl_mode][$domain_key]; |
| 1872 | 1872 | } |
@@ -1883,16 +1883,16 @@ discard block |
||
| 1883 | 1883 | { |
| 1884 | 1884 | $self = self::getInstance(); |
| 1885 | 1885 | $self->context->{$key} = $val; |
| 1886 | - if($set_to_get_vars === FALSE) |
|
| 1886 | + if ($set_to_get_vars === FALSE) |
|
| 1887 | 1887 | { |
| 1888 | 1888 | return; |
| 1889 | 1889 | } |
| 1890 | - if($val === NULL || $val === '') |
|
| 1890 | + if ($val === NULL || $val === '') |
|
| 1891 | 1891 | { |
| 1892 | 1892 | unset($self->get_vars->{$key}); |
| 1893 | 1893 | return; |
| 1894 | 1894 | } |
| 1895 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1895 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1896 | 1896 | { |
| 1897 | 1897 | $self->get_vars->{$key} = $val; |
| 1898 | 1898 | } |
@@ -1908,7 +1908,7 @@ discard block |
||
| 1908 | 1908 | { |
| 1909 | 1909 | $self = self::getInstance(); |
| 1910 | 1910 | |
| 1911 | - if(!isset($self->context->{$key})) |
|
| 1911 | + if (!isset($self->context->{$key})) |
|
| 1912 | 1912 | { |
| 1913 | 1913 | return null; |
| 1914 | 1914 | } |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | function gets() |
| 1924 | 1924 | { |
| 1925 | 1925 | $num_args = func_num_args(); |
| 1926 | - if($num_args < 1) |
|
| 1926 | + if ($num_args < 1) |
|
| 1927 | 1927 | { |
| 1928 | 1928 | return; |
| 1929 | 1929 | } |
@@ -1931,7 +1931,7 @@ discard block |
||
| 1931 | 1931 | |
| 1932 | 1932 | $args_list = func_get_args(); |
| 1933 | 1933 | $output = new stdClass(); |
| 1934 | - foreach($args_list as $v) |
|
| 1934 | + foreach ($args_list as $v) |
|
| 1935 | 1935 | { |
| 1936 | 1936 | $output->{$v} = $self->get($v); |
| 1937 | 1937 | } |
@@ -1957,7 +1957,7 @@ discard block |
||
| 1957 | 1957 | function getRequestVars() |
| 1958 | 1958 | { |
| 1959 | 1959 | $self = self::getInstance(); |
| 1960 | - if($self->get_vars) |
|
| 1960 | + if ($self->get_vars) |
|
| 1961 | 1961 | { |
| 1962 | 1962 | return clone($self->get_vars); |
| 1963 | 1963 | } |
@@ -1974,13 +1974,13 @@ discard block |
||
| 1974 | 1974 | { |
| 1975 | 1975 | $self = self::getInstance(); |
| 1976 | 1976 | |
| 1977 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 1977 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 1978 | 1978 | { |
| 1979 | 1979 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 1980 | 1980 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 1981 | 1981 | } |
| 1982 | 1982 | |
| 1983 | - if(!isset($self->ssl_actions[$action])) |
|
| 1983 | + if (!isset($self->ssl_actions[$action])) |
|
| 1984 | 1984 | { |
| 1985 | 1985 | $self->ssl_actions[$action] = 1; |
| 1986 | 1986 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -1998,16 +1998,16 @@ discard block |
||
| 1998 | 1998 | { |
| 1999 | 1999 | $self = self::getInstance(); |
| 2000 | 2000 | |
| 2001 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2001 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2002 | 2002 | { |
| 2003 | 2003 | unset($self->ssl_actions); |
| 2004 | 2004 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2005 | 2005 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2006 | 2006 | } |
| 2007 | 2007 | |
| 2008 | - foreach($action_array as $action) |
|
| 2008 | + foreach ($action_array as $action) |
|
| 2009 | 2009 | { |
| 2010 | - if(!isset($self->ssl_actions[$action])) |
|
| 2010 | + if (!isset($self->ssl_actions[$action])) |
|
| 2011 | 2011 | { |
| 2012 | 2012 | $self->ssl_actions[$action] = 1; |
| 2013 | 2013 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2026,7 +2026,7 @@ discard block |
||
| 2026 | 2026 | { |
| 2027 | 2027 | $self = self::getInstance(); |
| 2028 | 2028 | |
| 2029 | - if($self->isExistsSSLAction($action)) |
|
| 2029 | + if ($self->isExistsSSLAction($action)) |
|
| 2030 | 2030 | { |
| 2031 | 2031 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2032 | 2032 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2043,7 +2043,7 @@ discard block |
||
| 2043 | 2043 | function getSSLActions() |
| 2044 | 2044 | { |
| 2045 | 2045 | $self = self::getInstance(); |
| 2046 | - if($self->getSslStatus() == 'optional') |
|
| 2046 | + if ($self->getSslStatus() == 'optional') |
|
| 2047 | 2047 | { |
| 2048 | 2048 | return $self->ssl_actions; |
| 2049 | 2049 | } |
@@ -2070,12 +2070,12 @@ discard block |
||
| 2070 | 2070 | */ |
| 2071 | 2071 | function normalizeFilePath($file) |
| 2072 | 2072 | { |
| 2073 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2073 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2074 | 2074 | { |
| 2075 | - $file = './' . $file; |
|
| 2075 | + $file = './'.$file; |
|
| 2076 | 2076 | } |
| 2077 | 2077 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2078 | - while(strpos($file, '/../') !== FALSE) |
|
| 2078 | + while (strpos($file, '/../') !== FALSE) |
|
| 2079 | 2079 | { |
| 2080 | 2080 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2081 | 2081 | } |
@@ -2094,13 +2094,13 @@ discard block |
||
| 2094 | 2094 | { |
| 2095 | 2095 | $file = self::normalizeFilePath($file); |
| 2096 | 2096 | $script_path = getScriptPath(); |
| 2097 | - if(strpos($file, './') === 0) |
|
| 2097 | + if (strpos($file, './') === 0) |
|
| 2098 | 2098 | { |
| 2099 | - $file = $script_path . substr($file, 2); |
|
| 2099 | + $file = $script_path.substr($file, 2); |
|
| 2100 | 2100 | } |
| 2101 | - elseif(strpos($file, '../') === 0) |
|
| 2101 | + elseif (strpos($file, '../') === 0) |
|
| 2102 | 2102 | { |
| 2103 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2103 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2104 | 2104 | } |
| 2105 | 2105 | |
| 2106 | 2106 | return $file; |
@@ -2170,12 +2170,12 @@ discard block |
||
| 2170 | 2170 | */ |
| 2171 | 2171 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2172 | 2172 | { |
| 2173 | - if($isRuleset) |
|
| 2173 | + if ($isRuleset) |
|
| 2174 | 2174 | { |
| 2175 | - if(strpos($file, '#') !== FALSE) |
|
| 2175 | + if (strpos($file, '#') !== FALSE) |
|
| 2176 | 2176 | { |
| 2177 | 2177 | $file = str_replace('#', '', $file); |
| 2178 | - if(!is_readable($file)) |
|
| 2178 | + if (!is_readable($file)) |
|
| 2179 | 2179 | { |
| 2180 | 2180 | $file = $autoPath; |
| 2181 | 2181 | } |
@@ -2240,9 +2240,9 @@ discard block |
||
| 2240 | 2240 | ksort($files); |
| 2241 | 2241 | $files = array_values($files); |
| 2242 | 2242 | $filenames = array(); |
| 2243 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2243 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2244 | 2244 | { |
| 2245 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2245 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2246 | 2246 | { |
| 2247 | 2247 | unset($files[$i]); |
| 2248 | 2248 | } |
@@ -2327,14 +2327,14 @@ discard block |
||
| 2327 | 2327 | */ |
| 2328 | 2328 | function getJavascriptPluginInfo($pluginName) |
| 2329 | 2329 | { |
| 2330 | - if($plugin_name == 'ui.datepicker') |
|
| 2330 | + if ($plugin_name == 'ui.datepicker') |
|
| 2331 | 2331 | { |
| 2332 | 2332 | $plugin_name = 'ui'; |
| 2333 | 2333 | } |
| 2334 | 2334 | |
| 2335 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2336 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2337 | - if(!is_readable($info_file)) |
|
| 2335 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2336 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2337 | + if (!is_readable($info_file)) |
|
| 2338 | 2338 | { |
| 2339 | 2339 | return; |
| 2340 | 2340 | } |
@@ -2344,32 +2344,32 @@ discard block |
||
| 2344 | 2344 | $result->jsList = array(); |
| 2345 | 2345 | $result->cssList = array(); |
| 2346 | 2346 | |
| 2347 | - foreach($list as $filename) |
|
| 2347 | + foreach ($list as $filename) |
|
| 2348 | 2348 | { |
| 2349 | 2349 | $filename = trim($filename); |
| 2350 | - if(!$filename) |
|
| 2350 | + if (!$filename) |
|
| 2351 | 2351 | { |
| 2352 | 2352 | continue; |
| 2353 | 2353 | } |
| 2354 | 2354 | |
| 2355 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2355 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2356 | 2356 | { |
| 2357 | 2357 | $filename = substr($filename, 2); |
| 2358 | 2358 | } |
| 2359 | 2359 | |
| 2360 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2360 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2361 | 2361 | { |
| 2362 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2362 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2363 | 2363 | } |
| 2364 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2364 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2365 | 2365 | { |
| 2366 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2366 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2367 | 2367 | } |
| 2368 | 2368 | } |
| 2369 | 2369 | |
| 2370 | - if(is_dir($plugin_path . 'lang')) |
|
| 2370 | + if (is_dir($plugin_path.'lang')) |
|
| 2371 | 2371 | { |
| 2372 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2372 | + $result->langPath = $plugin_path.'lang'; |
|
| 2373 | 2373 | } |
| 2374 | 2374 | |
| 2375 | 2375 | return $result; |
@@ -2385,50 +2385,50 @@ discard block |
||
| 2385 | 2385 | static $loaded_plugins = array(); |
| 2386 | 2386 | |
| 2387 | 2387 | $self = self::getInstance(); |
| 2388 | - if($plugin_name == 'ui.datepicker') |
|
| 2388 | + if ($plugin_name == 'ui.datepicker') |
|
| 2389 | 2389 | { |
| 2390 | 2390 | $plugin_name = 'ui'; |
| 2391 | 2391 | } |
| 2392 | 2392 | |
| 2393 | - if($loaded_plugins[$plugin_name]) |
|
| 2393 | + if ($loaded_plugins[$plugin_name]) |
|
| 2394 | 2394 | { |
| 2395 | 2395 | return; |
| 2396 | 2396 | } |
| 2397 | 2397 | $loaded_plugins[$plugin_name] = TRUE; |
| 2398 | 2398 | |
| 2399 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2400 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2401 | - if(!is_readable($info_file)) |
|
| 2399 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2400 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2401 | + if (!is_readable($info_file)) |
|
| 2402 | 2402 | { |
| 2403 | 2403 | return; |
| 2404 | 2404 | } |
| 2405 | 2405 | |
| 2406 | 2406 | $list = file($info_file); |
| 2407 | - foreach($list as $filename) |
|
| 2407 | + foreach ($list as $filename) |
|
| 2408 | 2408 | { |
| 2409 | 2409 | $filename = trim($filename); |
| 2410 | - if(!$filename) |
|
| 2410 | + if (!$filename) |
|
| 2411 | 2411 | { |
| 2412 | 2412 | continue; |
| 2413 | 2413 | } |
| 2414 | 2414 | |
| 2415 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2415 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2416 | 2416 | { |
| 2417 | 2417 | $filename = substr($filename, 2); |
| 2418 | 2418 | } |
| 2419 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2419 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2420 | 2420 | { |
| 2421 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2421 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2422 | 2422 | } |
| 2423 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2423 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2424 | 2424 | { |
| 2425 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2425 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2426 | 2426 | } |
| 2427 | 2427 | } |
| 2428 | 2428 | |
| 2429 | - if(is_dir($plugin_path . 'lang')) |
|
| 2429 | + if (is_dir($plugin_path.'lang')) |
|
| 2430 | 2430 | { |
| 2431 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2431 | + $self->loadLang($plugin_path.'lang'); |
|
| 2432 | 2432 | } |
| 2433 | 2433 | } |
| 2434 | 2434 | |
@@ -2441,7 +2441,7 @@ discard block |
||
| 2441 | 2441 | function addHtmlHeader($header) |
| 2442 | 2442 | { |
| 2443 | 2443 | $self = self::getInstance(); |
| 2444 | - $self->html_header .= "\n" . $header; |
|
| 2444 | + $self->html_header .= "\n".$header; |
|
| 2445 | 2445 | } |
| 2446 | 2446 | |
| 2447 | 2447 | function clearHtmlHeader() |
@@ -2493,7 +2493,7 @@ discard block |
||
| 2493 | 2493 | function addBodyHeader($header) |
| 2494 | 2494 | { |
| 2495 | 2495 | $self = self::getInstance(); |
| 2496 | - $self->body_header .= "\n" . $header; |
|
| 2496 | + $self->body_header .= "\n".$header; |
|
| 2497 | 2497 | } |
| 2498 | 2498 | |
| 2499 | 2499 | /** |
@@ -2515,7 +2515,7 @@ discard block |
||
| 2515 | 2515 | function addHtmlFooter($footer) |
| 2516 | 2516 | { |
| 2517 | 2517 | $self = self::getInstance(); |
| 2518 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2518 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2519 | 2519 | } |
| 2520 | 2520 | |
| 2521 | 2521 | /** |
@@ -2536,7 +2536,7 @@ discard block |
||
| 2536 | 2536 | */ |
| 2537 | 2537 | function getConfigFile() |
| 2538 | 2538 | { |
| 2539 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2539 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2540 | 2540 | } |
| 2541 | 2541 | |
| 2542 | 2542 | /** |
@@ -2546,7 +2546,7 @@ discard block |
||
| 2546 | 2546 | */ |
| 2547 | 2547 | function getFTPConfigFile() |
| 2548 | 2548 | { |
| 2549 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2549 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2550 | 2550 | } |
| 2551 | 2551 | |
| 2552 | 2552 | /** |
@@ -2598,14 +2598,14 @@ discard block |
||
| 2598 | 2598 | $_path = explode('/', $path); |
| 2599 | 2599 | $_base = explode('/', $base_url); |
| 2600 | 2600 | |
| 2601 | - if(!$_base[count($_base) - 1]) |
|
| 2601 | + if (!$_base[count($_base) - 1]) |
|
| 2602 | 2602 | { |
| 2603 | 2603 | array_pop($_base); |
| 2604 | 2604 | } |
| 2605 | 2605 | |
| 2606 | - foreach($_xe as $idx => $dir) |
|
| 2606 | + foreach ($_xe as $idx => $dir) |
|
| 2607 | 2607 | { |
| 2608 | - if($_path[0] != $dir) |
|
| 2608 | + if ($_path[0] != $dir) |
|
| 2609 | 2609 | { |
| 2610 | 2610 | break; |
| 2611 | 2611 | } |
@@ -2613,9 +2613,9 @@ discard block |
||
| 2613 | 2613 | } |
| 2614 | 2614 | |
| 2615 | 2615 | $idx = count($_xe) - $idx - 1; |
| 2616 | - while($idx--) |
|
| 2616 | + while ($idx--) |
|
| 2617 | 2617 | { |
| 2618 | - if(count($_base) > 0) |
|
| 2618 | + if (count($_base) > 0) |
|
| 2619 | 2619 | { |
| 2620 | 2620 | array_shift($_base); |
| 2621 | 2621 | } |
@@ -2625,13 +2625,13 @@ discard block |
||
| 2625 | 2625 | } |
| 2626 | 2626 | } |
| 2627 | 2627 | |
| 2628 | - if(count($_base) > 0) |
|
| 2628 | + if (count($_base) > 0) |
|
| 2629 | 2629 | { |
| 2630 | 2630 | array_unshift($_path, join('/', $_base)); |
| 2631 | 2631 | } |
| 2632 | 2632 | |
| 2633 | - $path = '/' . join('/', $_path); |
|
| 2634 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2633 | + $path = '/'.join('/', $_path); |
|
| 2634 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2635 | 2635 | { |
| 2636 | 2636 | $path .= '/'; |
| 2637 | 2637 | } |
@@ -2646,13 +2646,13 @@ discard block |
||
| 2646 | 2646 | { |
| 2647 | 2647 | $self = self::getInstance(); |
| 2648 | 2648 | |
| 2649 | - if(!is_array($self->meta_tags)) |
|
| 2649 | + if (!is_array($self->meta_tags)) |
|
| 2650 | 2650 | { |
| 2651 | 2651 | $self->meta_tags = array(); |
| 2652 | 2652 | } |
| 2653 | 2653 | |
| 2654 | 2654 | $ret = array(); |
| 2655 | - foreach($self->meta_tags as $key => $val) |
|
| 2655 | + foreach ($self->meta_tags as $key => $val) |
|
| 2656 | 2656 | { |
| 2657 | 2657 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2658 | 2658 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2672,7 +2672,7 @@ discard block |
||
| 2672 | 2672 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2673 | 2673 | { |
| 2674 | 2674 | $self = self::getInstance(); |
| 2675 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2675 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2676 | 2676 | } |
| 2677 | 2677 | |
| 2678 | 2678 | } |