@@ -63,37 +63,30 @@ |
||
| 63 | 63 | if($info->use_object_cache == 'apc') |
| 64 | 64 | { |
| 65 | 65 | $type = 'apc'; |
| 66 | - } |
|
| 67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 66 | + } else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 68 | 67 | { |
| 69 | 68 | $type = 'memcache'; |
| 70 | 69 | $url = $info->use_object_cache; |
| 71 | - } |
|
| 72 | - else if($info->use_object_cache == 'wincache') |
|
| 70 | + } else if($info->use_object_cache == 'wincache') |
|
| 73 | 71 | { |
| 74 | 72 | $type = 'wincache'; |
| 75 | - } |
|
| 76 | - else if($info->use_object_cache == 'file') |
|
| 73 | + } else if($info->use_object_cache == 'file') |
|
| 77 | 74 | { |
| 78 | 75 | $type = 'file'; |
| 79 | - } |
|
| 80 | - else if($always_use_file) |
|
| 76 | + } else if($always_use_file) |
|
| 81 | 77 | { |
| 82 | 78 | $type = 'file'; |
| 83 | 79 | } |
| 84 | - } |
|
| 85 | - else if($target == 'template') |
|
| 80 | + } else if($target == 'template') |
|
| 86 | 81 | { |
| 87 | 82 | if($info->use_template_cache == 'apc') |
| 88 | 83 | { |
| 89 | 84 | $type = 'apc'; |
| 90 | - } |
|
| 91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 85 | + } else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 92 | 86 | { |
| 93 | 87 | $type = 'memcache'; |
| 94 | 88 | $url = $info->use_template_cache; |
| 95 | - } |
|
| 96 | - else if($info->use_template_cache == 'wincache') |
|
| 89 | + } else if($info->use_template_cache == 'wincache') |
|
| 97 | 90 | { |
| 98 | 91 | $type = 'wincache'; |
| 99 | 92 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @param string $key Cache key |
| 149 | 149 | * @param int $modified_time Unix time of data modified. |
| 150 | 150 | * If stored time is older then modified time, return false. |
| 151 | - * @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
| 151 | + * @return boolean Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
| 152 | 152 | */ |
| 153 | 153 | function get($key, $modified_time = 0) |
| 154 | 154 | { |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param string $key Cache key |
| 298 | 298 | * @param int $modified_time Unix time of data modified. |
| 299 | 299 | * If stored time is older then modified time, return false. |
| 300 | - * @return false|mixed Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
| 300 | + * @return boolean Return false on failure or older then modified time. Return the string associated with the $key on success. |
|
| 301 | 301 | */ |
| 302 | 302 | function get($key, $modified_time = 0) |
| 303 | 303 | { |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function &getInstance($target = 'object', $info = null, $always_use_file = false) |
| 32 | 32 | { |
| 33 | - $cache_handler_key = $target . ($always_use_file ? '_file' : ''); |
|
| 34 | - if(!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
| 33 | + $cache_handler_key = $target.($always_use_file ? '_file' : ''); |
|
| 34 | + if (!$GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key]) |
|
| 35 | 35 | { |
| 36 | 36 | $GLOBALS['__XE_CACHE_HANDLER__'][$cache_handler_key] = new CacheHandler($target, $info, $always_use_file); |
| 37 | 37 | } |
@@ -51,61 +51,61 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function __construct($target, $info = null, $always_use_file = false) |
| 53 | 53 | { |
| 54 | - if(!$info) |
|
| 54 | + if (!$info) |
|
| 55 | 55 | { |
| 56 | 56 | $info = Context::getDBInfo(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if($info) |
|
| 59 | + if ($info) |
|
| 60 | 60 | { |
| 61 | - if($target == 'object') |
|
| 61 | + if ($target == 'object') |
|
| 62 | 62 | { |
| 63 | - if($info->use_object_cache == 'apc') |
|
| 63 | + if ($info->use_object_cache == 'apc') |
|
| 64 | 64 | { |
| 65 | 65 | $type = 'apc'; |
| 66 | 66 | } |
| 67 | - else if(substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 67 | + else if (substr($info->use_object_cache, 0, 8) == 'memcache') |
|
| 68 | 68 | { |
| 69 | 69 | $type = 'memcache'; |
| 70 | 70 | $url = $info->use_object_cache; |
| 71 | 71 | } |
| 72 | - else if($info->use_object_cache == 'wincache') |
|
| 72 | + else if ($info->use_object_cache == 'wincache') |
|
| 73 | 73 | { |
| 74 | 74 | $type = 'wincache'; |
| 75 | 75 | } |
| 76 | - else if($info->use_object_cache == 'file') |
|
| 76 | + else if ($info->use_object_cache == 'file') |
|
| 77 | 77 | { |
| 78 | 78 | $type = 'file'; |
| 79 | 79 | } |
| 80 | - else if($always_use_file) |
|
| 80 | + else if ($always_use_file) |
|
| 81 | 81 | { |
| 82 | 82 | $type = 'file'; |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | - else if($target == 'template') |
|
| 85 | + else if ($target == 'template') |
|
| 86 | 86 | { |
| 87 | - if($info->use_template_cache == 'apc') |
|
| 87 | + if ($info->use_template_cache == 'apc') |
|
| 88 | 88 | { |
| 89 | 89 | $type = 'apc'; |
| 90 | 90 | } |
| 91 | - else if(substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 91 | + else if (substr($info->use_template_cache, 0, 8) == 'memcache') |
|
| 92 | 92 | { |
| 93 | 93 | $type = 'memcache'; |
| 94 | 94 | $url = $info->use_template_cache; |
| 95 | 95 | } |
| 96 | - else if($info->use_template_cache == 'wincache') |
|
| 96 | + else if ($info->use_template_cache == 'wincache') |
|
| 97 | 97 | { |
| 98 | 98 | $type = 'wincache'; |
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if($type) |
|
| 102 | + if ($type) |
|
| 103 | 103 | { |
| 104 | - $class = 'Cache' . ucfirst($type); |
|
| 104 | + $class = 'Cache'.ucfirst($type); |
|
| 105 | 105 | include_once sprintf('%sclasses/cache/%s.class.php', _XE_PATH_, $class); |
| 106 | 106 | $this->handler = call_user_func(array($class, 'getInstance'), $url); |
| 107 | 107 | $this->keyGroupVersions = $this->handler->get('key_group_versions', 0); |
| 108 | - if(!$this->keyGroupVersions) |
|
| 108 | + if (!$this->keyGroupVersions) |
|
| 109 | 109 | { |
| 110 | 110 | $this->keyGroupVersions = array(); |
| 111 | 111 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | function isSupport() |
| 123 | 123 | { |
| 124 | - if($this->handler && $this->handler->isSupport()) |
|
| 124 | + if ($this->handler && $this->handler->isSupport()) |
|
| 125 | 125 | { |
| 126 | 126 | return true; |
| 127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $key = str_replace('/', ':', $key); |
| 141 | 141 | |
| 142 | - return __XE_VERSION__ . ':' . $key; |
|
| 142 | + return __XE_VERSION__.':'.$key; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | function get($key, $modified_time = 0) |
| 154 | 154 | { |
| 155 | - if(!$this->handler) |
|
| 155 | + if (!$this->handler) |
|
| 156 | 156 | { |
| 157 | 157 | return false; |
| 158 | 158 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | function put($key, $obj, $valid_time = 0) |
| 176 | 176 | { |
| 177 | - if(!$this->handler && !$key) |
|
| 177 | + if (!$this->handler && !$key) |
|
| 178 | 178 | { |
| 179 | 179 | return false; |
| 180 | 180 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | function delete($key) |
| 194 | 194 | { |
| 195 | - if(!$this->handler) |
|
| 195 | + if (!$this->handler) |
|
| 196 | 196 | { |
| 197 | 197 | return false; |
| 198 | 198 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function isValid($key, $modified_time = 0) |
| 214 | 214 | { |
| 215 | - if(!$this->handler) |
|
| 215 | + if (!$this->handler) |
|
| 216 | 216 | { |
| 217 | 217 | return false; |
| 218 | 218 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | function truncate() |
| 231 | 231 | { |
| 232 | - if(!$this->handler) |
|
| 232 | + if (!$this->handler) |
|
| 233 | 233 | { |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | function getGroupKey($keyGroupName, $key) |
| 257 | 257 | { |
| 258 | - if(!$this->keyGroupVersions[$keyGroupName]) |
|
| 258 | + if (!$this->keyGroupVersions[$keyGroupName]) |
|
| 259 | 259 | { |
| 260 | 260 | $this->keyGroupVersions[$keyGroupName] = 1; |
| 261 | 261 | $this->handler->put('key_group_versions', $this->keyGroupVersions, 0); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - return 'cache_group_' . $this->keyGroupVersions[$keyGroupName] . ':' . $keyGroupName . ':' . $key; |
|
| 264 | + return 'cache_group_'.$this->keyGroupVersions[$keyGroupName].':'.$keyGroupName.':'.$key; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -1094,7 +1094,7 @@ |
||
| 1094 | 1094 | */ |
| 1095 | 1095 | function convertEncodingStr($str) |
| 1096 | 1096 | { |
| 1097 | - if(!$str) return null; |
|
| 1097 | + if(!$str) return null; |
|
| 1098 | 1098 | $obj = new stdClass(); |
| 1099 | 1099 | $obj->str = $str; |
| 1100 | 1100 | $obj = self::convertEncoding($obj); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | /** |
| 158 | 158 | * returns static context object (Singleton). It's to use Context without declaration of an object |
| 159 | 159 | * |
| 160 | - * @return object Instance |
|
| 160 | + * @return Context Instance |
|
| 161 | 161 | */ |
| 162 | 162 | function &getInstance() |
| 163 | 163 | { |
@@ -891,6 +891,7 @@ discard block |
||
| 891 | 891 | * Evaluation of xml language file |
| 892 | 892 | * |
| 893 | 893 | * @param string Path of the language file |
| 894 | + * @param string $path |
|
| 894 | 895 | * @return void |
| 895 | 896 | */ |
| 896 | 897 | function _evalxmlLang($path) |
@@ -1030,7 +1031,7 @@ discard block |
||
| 1030 | 1031 | /** |
| 1031 | 1032 | * Convert strings of variables in $source_object into UTF-8 |
| 1032 | 1033 | * |
| 1033 | - * @param object $source_obj Conatins strings to convert |
|
| 1034 | + * @param stdClass $source_obj Conatins strings to convert |
|
| 1034 | 1035 | * @return object converted object |
| 1035 | 1036 | */ |
| 1036 | 1037 | function convertEncoding($source_obj) |
@@ -1065,11 +1066,11 @@ discard block |
||
| 1065 | 1066 | /** |
| 1066 | 1067 | * Check flag |
| 1067 | 1068 | * |
| 1068 | - * @param mixed $val |
|
| 1069 | + * @param boolean $val |
|
| 1069 | 1070 | * @param string $key |
| 1070 | 1071 | * @param mixed $charset charset |
| 1071 | 1072 | * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 |
| 1072 | - * @return void |
|
| 1073 | + * @return null|boolean |
|
| 1073 | 1074 | */ |
| 1074 | 1075 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1075 | 1076 | { |
@@ -1935,7 +1936,7 @@ discard block |
||
| 1935 | 1936 | * |
| 1936 | 1937 | * @param string $key Key |
| 1937 | 1938 | * @param mixed $val Value |
| 1938 | - * @param mixed $set_to_get_vars If not FALSE, Set to get vars. |
|
| 1939 | + * @param integer $set_to_get_vars If not FALSE, Set to get vars. |
|
| 1939 | 1940 | * @return void |
| 1940 | 1941 | */ |
| 1941 | 1942 | function set($key, $val, $set_to_get_vars = 0) |
@@ -1977,7 +1978,7 @@ discard block |
||
| 1977 | 1978 | /** |
| 1978 | 1979 | * Get one more vars in object vars with given arguments(key1, key2, key3,...) |
| 1979 | 1980 | * |
| 1980 | - * @return object |
|
| 1981 | + * @return null|stdClass |
|
| 1981 | 1982 | */ |
| 1982 | 1983 | function gets() |
| 1983 | 1984 | { |
@@ -2050,7 +2051,7 @@ discard block |
||
| 2050 | 2051 | /** |
| 2051 | 2052 | * Register if actions are to be encrypted by SSL. Those actions are sent to https in common/js/xml_handler.js |
| 2052 | 2053 | * |
| 2053 | - * @param string $action act name |
|
| 2054 | + * @param string[] $action_array |
|
| 2054 | 2055 | * @return void |
| 2055 | 2056 | */ |
| 2056 | 2057 | function addSSLActions($action_array) |
@@ -2221,7 +2222,7 @@ discard block |
||
| 2221 | 2222 | * @param string $file File name with path |
| 2222 | 2223 | * @param string $optimized optimized (That seems to not use) |
| 2223 | 2224 | * @param string $targetie target IE |
| 2224 | - * @param string $index index |
|
| 2225 | + * @param integer $index index |
|
| 2225 | 2226 | * @param string $type Added position. (head:<head>..</head>, body:<body>..</body>) |
| 2226 | 2227 | * @param bool $isRuleset Use ruleset |
| 2227 | 2228 | * @param string $autoPath If path not readed, set the path automatically. |
@@ -2331,7 +2332,7 @@ discard block |
||
| 2331 | 2332 | * @param string $optimized optimized (That seems to not use) |
| 2332 | 2333 | * @param string $media Media query |
| 2333 | 2334 | * @param string $targetie target IE |
| 2334 | - * @param string $index index |
|
| 2335 | + * @param integer $index index |
|
| 2335 | 2336 | * @return void |
| 2336 | 2337 | * |
| 2337 | 2338 | */ |
@@ -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,7 +447,7 @@ 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 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | ob_end_clean(); |
| 458 | 458 | |
| 459 | 459 | // If master_db information does not exist, the config file needs to be updated |
| 460 | - if(!isset($db_info->master_db)) |
|
| 460 | + if (!isset($db_info->master_db)) |
|
| 461 | 461 | { |
| 462 | 462 | $db_info->master_db = array(); |
| 463 | 463 | $db_info->master_db["db_type"] = $db_info->db_type; |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $db_info->master_db["db_table_prefix"] = $db_info->db_table_prefix; |
| 476 | 476 | unset($db_info->db_table_prefix); |
| 477 | 477 | |
| 478 | - if(isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 478 | + if (isset($db_info->master_db["db_table_prefix"]) && substr_compare($db_info->master_db["db_table_prefix"], '_', -1) !== 0) |
|
| 479 | 479 | { |
| 480 | 480 | $db_info->master_db["db_table_prefix"] .= '_'; |
| 481 | 481 | } |
@@ -487,33 +487,33 @@ discard block |
||
| 487 | 487 | $oInstallController->makeConfigFile(); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - if(!$db_info->use_prepared_statements) |
|
| 490 | + if (!$db_info->use_prepared_statements) |
|
| 491 | 491 | { |
| 492 | 492 | $db_info->use_prepared_statements = 'Y'; |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if(!$db_info->time_zone) |
|
| 495 | + if (!$db_info->time_zone) |
|
| 496 | 496 | $db_info->time_zone = date('O'); |
| 497 | 497 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 498 | 498 | |
| 499 | - if($db_info->qmail_compatibility != 'Y') |
|
| 499 | + if ($db_info->qmail_compatibility != 'Y') |
|
| 500 | 500 | $db_info->qmail_compatibility = 'N'; |
| 501 | 501 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 502 | 502 | |
| 503 | - if(!$db_info->use_db_session) |
|
| 503 | + if (!$db_info->use_db_session) |
|
| 504 | 504 | $db_info->use_db_session = 'N'; |
| 505 | - if(!$db_info->use_ssl) |
|
| 505 | + if (!$db_info->use_ssl) |
|
| 506 | 506 | $db_info->use_ssl = 'none'; |
| 507 | 507 | $this->set('_use_ssl', $db_info->use_ssl); |
| 508 | 508 | |
| 509 | 509 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
| 510 | 510 | $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); |
| 511 | 511 | |
| 512 | - if(!$db_info->sitelock_whitelist) { |
|
| 512 | + if (!$db_info->sitelock_whitelist) { |
|
| 513 | 513 | $db_info->sitelock_whitelist = '127.0.0.1'; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - if(is_string($db_info->sitelock_whitelist)) { |
|
| 516 | + if (is_string($db_info->sitelock_whitelist)) { |
|
| 517 | 517 | $db_info->sitelock_whitelist = explode(',', $db_info->sitelock_whitelist); |
| 518 | 518 | } |
| 519 | 519 | |
@@ -584,10 +584,10 @@ discard block |
||
| 584 | 584 | function loadLangSupported() |
| 585 | 585 | { |
| 586 | 586 | static $lang_supported = null; |
| 587 | - if(!$lang_supported) |
|
| 587 | + if (!$lang_supported) |
|
| 588 | 588 | { |
| 589 | - $langs = file(_XE_PATH_ . 'common/lang/lang.info'); |
|
| 590 | - foreach($langs as $val) |
|
| 589 | + $langs = file(_XE_PATH_.'common/lang/lang.info'); |
|
| 590 | + foreach ($langs as $val) |
|
| 591 | 591 | { |
| 592 | 592 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 593 | 593 | $lang_text = trim($lang_text); |
@@ -605,17 +605,17 @@ discard block |
||
| 605 | 605 | function loadLangSelected() |
| 606 | 606 | { |
| 607 | 607 | static $lang_selected = null; |
| 608 | - if(!$lang_selected) |
|
| 608 | + if (!$lang_selected) |
|
| 609 | 609 | { |
| 610 | - $orig_lang_file = _XE_PATH_ . 'common/lang/lang.info'; |
|
| 611 | - $selected_lang_file = _XE_PATH_ . 'files/config/lang_selected.info'; |
|
| 612 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 610 | + $orig_lang_file = _XE_PATH_.'common/lang/lang.info'; |
|
| 611 | + $selected_lang_file = _XE_PATH_.'files/config/lang_selected.info'; |
|
| 612 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 613 | 613 | { |
| 614 | - $old_selected_lang_file = _XE_PATH_ . 'files/cache/lang_selected.info'; |
|
| 614 | + $old_selected_lang_file = _XE_PATH_.'files/cache/lang_selected.info'; |
|
| 615 | 615 | FileHandler::moveFile($old_selected_lang_file, $selected_lang_file); |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | - if(!FileHandler::hasContent($selected_lang_file)) |
|
| 618 | + if (!FileHandler::hasContent($selected_lang_file)) |
|
| 619 | 619 | { |
| 620 | 620 | $buff = FileHandler::readFile($orig_lang_file); |
| 621 | 621 | FileHandler::writeFile($selected_lang_file, $buff); |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | else |
| 625 | 625 | { |
| 626 | 626 | $langs = file($selected_lang_file); |
| 627 | - foreach($langs as $val) |
|
| 627 | + foreach ($langs as $val) |
|
| 628 | 628 | { |
| 629 | 629 | list($lang_prefix, $lang_text) = explode(',', $val); |
| 630 | 630 | $lang_text = trim($lang_text); |
@@ -643,56 +643,56 @@ discard block |
||
| 643 | 643 | function checkSSO() |
| 644 | 644 | { |
| 645 | 645 | // pass if it's not GET request or XE is not yet installed |
| 646 | - if($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 646 | + if ($this->db_info->use_sso != 'Y' || isCrawler()) |
|
| 647 | 647 | { |
| 648 | 648 | return TRUE; |
| 649 | 649 | } |
| 650 | 650 | $checkActList = array('rss' => 1, 'atom' => 1); |
| 651 | - if(self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 651 | + if (self::getRequestMethod() != 'GET' || !self::isInstalled() || isset($checkActList[self::get('act')])) |
|
| 652 | 652 | { |
| 653 | 653 | return TRUE; |
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // pass if default URL is not set |
| 657 | 657 | $default_url = trim($this->db_info->default_url); |
| 658 | - if(!$default_url) |
|
| 658 | + if (!$default_url) |
|
| 659 | 659 | { |
| 660 | 660 | return TRUE; |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - if(substr_compare($default_url, '/', -1) !== 0) |
|
| 663 | + if (substr_compare($default_url, '/', -1) !== 0) |
|
| 664 | 664 | { |
| 665 | 665 | $default_url .= '/'; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | // for sites recieving SSO valdiation |
| 669 | - if($default_url == self::getRequestUri()) |
|
| 669 | + if ($default_url == self::getRequestUri()) |
|
| 670 | 670 | { |
| 671 | - if(self::get('url')) |
|
| 671 | + if (self::get('url')) |
|
| 672 | 672 | { |
| 673 | 673 | $url = base64_decode(self::get('url')); |
| 674 | 674 | $url_info = parse_url($url); |
| 675 | - if(!Password::checkSignature($url, self::get('sig'))) |
|
| 675 | + if (!Password::checkSignature($url, self::get('sig'))) |
|
| 676 | 676 | { |
| 677 | 677 | echo self::get('lang')->msg_invalid_request; |
| 678 | 678 | return false; |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | $oModuleModel = getModel('module'); |
| 682 | - $domain = $url_info['host'] . $url_info['path']; |
|
| 683 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 682 | + $domain = $url_info['host'].$url_info['path']; |
|
| 683 | + if (substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 684 | 684 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 685 | 685 | |
| 686 | - if($site_info->site_srl) |
|
| 686 | + if ($site_info->site_srl) |
|
| 687 | 687 | { |
| 688 | - $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
|
| 689 | - $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']); |
|
| 688 | + $url_info['query'] .= ($url_info['query'] ? '&' : '').'SSOID='.urlencode(session_id()).'&sig='.urlencode(Password::createSignature(session_id())); |
|
| 689 | + $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']); |
|
| 690 | 690 | } |
| 691 | 691 | else |
| 692 | 692 | { |
| 693 | 693 | $redirect_url = $url; |
| 694 | 694 | } |
| 695 | - header('location:' . $redirect_url); |
|
| 695 | + header('location:'.$redirect_url); |
|
| 696 | 696 | |
| 697 | 697 | return FALSE; |
| 698 | 698 | } |
@@ -701,9 +701,9 @@ discard block |
||
| 701 | 701 | else |
| 702 | 702 | { |
| 703 | 703 | // result handling : set session_name() |
| 704 | - if($session_name = self::get('SSOID')) |
|
| 704 | + if ($session_name = self::get('SSOID')) |
|
| 705 | 705 | { |
| 706 | - if(!Password::checkSignature($session_name, self::get('sig'))) |
|
| 706 | + if (!Password::checkSignature($session_name, self::get('sig'))) |
|
| 707 | 707 | { |
| 708 | 708 | echo self::get('lang')->msg_invalid_request; |
| 709 | 709 | return false; |
@@ -712,17 +712,17 @@ discard block |
||
| 712 | 712 | setcookie(session_name(), $session_name); |
| 713 | 713 | |
| 714 | 714 | $url = preg_replace('/[\?\&]SSOID=.+$/', '', self::getRequestUrl()); |
| 715 | - header('location:' . $url); |
|
| 715 | + header('location:'.$url); |
|
| 716 | 716 | return FALSE; |
| 717 | 717 | // send SSO request |
| 718 | 718 | } |
| 719 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 719 | + else if (!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 720 | 720 | { |
| 721 | 721 | setcookie('sso', md5(self::getRequestUri())); |
| 722 | 722 | $origin_url = self::getRequestUrl(); |
| 723 | 723 | $origin_sig = Password::createSignature($origin_url); |
| 724 | 724 | $url = sprintf("%s?url=%s&sig=%s", $default_url, urlencode(base64_encode($origin_url)), urlencode($origin_sig)); |
| 725 | - header('location:' . $url); |
|
| 725 | + header('location:'.$url); |
|
| 726 | 726 | return FALSE; |
| 727 | 727 | } |
| 728 | 728 | } |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | { |
| 750 | 750 | $self = self::getInstance(); |
| 751 | 751 | |
| 752 | - if(!$self->isFTPRegisted()) |
|
| 752 | + if (!$self->isFTPRegisted()) |
|
| 753 | 753 | { |
| 754 | 754 | return null; |
| 755 | 755 | } |
@@ -767,15 +767,15 @@ discard block |
||
| 767 | 767 | */ |
| 768 | 768 | function addBrowserTitle($site_title) |
| 769 | 769 | { |
| 770 | - if(!$site_title) |
|
| 770 | + if (!$site_title) |
|
| 771 | 771 | { |
| 772 | 772 | return; |
| 773 | 773 | } |
| 774 | 774 | $self = self::getInstance(); |
| 775 | 775 | |
| 776 | - if($self->site_title) |
|
| 776 | + if ($self->site_title) |
|
| 777 | 777 | { |
| 778 | - $self->site_title .= ' - ' . $site_title; |
|
| 778 | + $self->site_title .= ' - '.$site_title; |
|
| 779 | 779 | } |
| 780 | 780 | else |
| 781 | 781 | { |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | */ |
| 792 | 792 | function setBrowserTitle($site_title) |
| 793 | 793 | { |
| 794 | - if(!$site_title) |
|
| 794 | + if (!$site_title) |
|
| 795 | 795 | { |
| 796 | 796 | return; |
| 797 | 797 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | $oModuleModel = getModel('module'); |
| 824 | 824 | $moduleConfig = $oModuleModel->getModuleConfig('module'); |
| 825 | 825 | |
| 826 | - if(isset($moduleConfig->siteTitle)) |
|
| 826 | + if (isset($moduleConfig->siteTitle)) |
|
| 827 | 827 | { |
| 828 | 828 | return $moduleConfig->siteTitle; |
| 829 | 829 | } |
@@ -850,30 +850,30 @@ discard block |
||
| 850 | 850 | global $lang; |
| 851 | 851 | |
| 852 | 852 | $self = self::getInstance(); |
| 853 | - if(!$self->lang_type) |
|
| 853 | + if (!$self->lang_type) |
|
| 854 | 854 | { |
| 855 | 855 | return; |
| 856 | 856 | } |
| 857 | - if(!is_object($lang)) |
|
| 857 | + if (!is_object($lang)) |
|
| 858 | 858 | { |
| 859 | 859 | $lang = new stdClass; |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - if(!($filename = $self->_loadXmlLang($path))) |
|
| 862 | + if (!($filename = $self->_loadXmlLang($path))) |
|
| 863 | 863 | { |
| 864 | 864 | $filename = $self->_loadPhpLang($path); |
| 865 | 865 | } |
| 866 | 866 | |
| 867 | - if(!is_array($self->loaded_lang_files)) |
|
| 867 | + if (!is_array($self->loaded_lang_files)) |
|
| 868 | 868 | { |
| 869 | 869 | $self->loaded_lang_files = array(); |
| 870 | 870 | } |
| 871 | - if(in_array($filename, $self->loaded_lang_files)) |
|
| 871 | + if (in_array($filename, $self->loaded_lang_files)) |
|
| 872 | 872 | { |
| 873 | 873 | return; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - if($filename && is_readable($filename)) |
|
| 876 | + if ($filename && is_readable($filename)) |
|
| 877 | 877 | { |
| 878 | 878 | $self->loaded_lang_files[] = $filename; |
| 879 | 879 | include($filename); |
@@ -894,24 +894,24 @@ discard block |
||
| 894 | 894 | { |
| 895 | 895 | global $lang; |
| 896 | 896 | |
| 897 | - if(!$path) return; |
|
| 897 | + if (!$path) return; |
|
| 898 | 898 | |
| 899 | - $_path = 'eval://' . $path; |
|
| 899 | + $_path = 'eval://'.$path; |
|
| 900 | 900 | |
| 901 | - if(in_array($_path, $this->loaded_lang_files)) |
|
| 901 | + if (in_array($_path, $this->loaded_lang_files)) |
|
| 902 | 902 | { |
| 903 | 903 | return; |
| 904 | 904 | } |
| 905 | 905 | |
| 906 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 906 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 907 | 907 | { |
| 908 | 908 | $path .= '/'; |
| 909 | 909 | } |
| 910 | 910 | |
| 911 | - $oXmlLangParser = new XmlLangParser($path . 'lang.xml', $this->lang_type); |
|
| 911 | + $oXmlLangParser = new XmlLangParser($path.'lang.xml', $this->lang_type); |
|
| 912 | 912 | $content = $oXmlLangParser->getCompileContent(); |
| 913 | 913 | |
| 914 | - if($content) |
|
| 914 | + if ($content) |
|
| 915 | 915 | { |
| 916 | 916 | $this->loaded_lang_files[] = $_path; |
| 917 | 917 | eval($content); |
@@ -926,9 +926,9 @@ discard block |
||
| 926 | 926 | */ |
| 927 | 927 | function _loadXmlLang($path) |
| 928 | 928 | { |
| 929 | - if(!$path) return; |
|
| 929 | + if (!$path) return; |
|
| 930 | 930 | |
| 931 | - $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
|
| 931 | + $oXmlLangParser = new XmlLangParser($path.((substr_compare($path, '/', -1) !== 0) ? '/' : '').'lang.xml', $this->lang_type); |
|
| 932 | 932 | return $oXmlLangParser->compile(); |
| 933 | 933 | } |
| 934 | 934 | |
@@ -940,22 +940,22 @@ discard block |
||
| 940 | 940 | */ |
| 941 | 941 | function _loadPhpLang($path) |
| 942 | 942 | { |
| 943 | - if(!$path) return; |
|
| 943 | + if (!$path) return; |
|
| 944 | 944 | |
| 945 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 945 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 946 | 946 | { |
| 947 | 947 | $path .= '/'; |
| 948 | 948 | } |
| 949 | - $path_tpl = $path . '%s.lang.php'; |
|
| 949 | + $path_tpl = $path.'%s.lang.php'; |
|
| 950 | 950 | $file = sprintf($path_tpl, $this->lang_type); |
| 951 | 951 | |
| 952 | 952 | $langs = array('ko', 'en'); // this will be configurable. |
| 953 | - while(!is_readable($file) && $langs[0]) |
|
| 953 | + while (!is_readable($file) && $langs[0]) |
|
| 954 | 954 | { |
| 955 | 955 | $file = sprintf($path_tpl, array_shift($langs)); |
| 956 | 956 | } |
| 957 | 957 | |
| 958 | - if(!is_readable($file)) |
|
| 958 | + if (!is_readable($file)) |
|
| 959 | 959 | { |
| 960 | 960 | return FALSE; |
| 961 | 961 | } |
@@ -997,11 +997,11 @@ discard block |
||
| 997 | 997 | */ |
| 998 | 998 | function getLang($code) |
| 999 | 999 | { |
| 1000 | - if(!$code) |
|
| 1000 | + if (!$code) |
|
| 1001 | 1001 | { |
| 1002 | 1002 | return; |
| 1003 | 1003 | } |
| 1004 | - if($GLOBALS['lang']->{$code}) |
|
| 1004 | + if ($GLOBALS['lang']->{$code}) |
|
| 1005 | 1005 | { |
| 1006 | 1006 | return $GLOBALS['lang']->{$code}; |
| 1007 | 1007 | } |
@@ -1017,7 +1017,7 @@ discard block |
||
| 1017 | 1017 | */ |
| 1018 | 1018 | function setLang($code, $val) |
| 1019 | 1019 | { |
| 1020 | - if(!isset($GLOBALS['lang'])) |
|
| 1020 | + if (!isset($GLOBALS['lang'])) |
|
| 1021 | 1021 | { |
| 1022 | 1022 | $GLOBALS['lang'] = new stdClass(); |
| 1023 | 1023 | } |
@@ -1042,17 +1042,17 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | $obj = clone $source_obj; |
| 1044 | 1044 | |
| 1045 | - foreach($charset_list as $charset) |
|
| 1045 | + foreach ($charset_list as $charset) |
|
| 1046 | 1046 | { |
| 1047 | - array_walk($obj,'Context::checkConvertFlag',$charset); |
|
| 1047 | + array_walk($obj, 'Context::checkConvertFlag', $charset); |
|
| 1048 | 1048 | $flag = self::checkConvertFlag($flag = TRUE); |
| 1049 | - if($flag) |
|
| 1049 | + if ($flag) |
|
| 1050 | 1050 | { |
| 1051 | - if($charset == 'UTF-8') |
|
| 1051 | + if ($charset == 'UTF-8') |
|
| 1052 | 1052 | { |
| 1053 | 1053 | return $obj; |
| 1054 | 1054 | } |
| 1055 | - array_walk($obj,'Context::doConvertEncoding',$charset); |
|
| 1055 | + array_walk($obj, 'Context::doConvertEncoding', $charset); |
|
| 1056 | 1056 | return $obj; |
| 1057 | 1057 | } |
| 1058 | 1058 | } |
@@ -1071,11 +1071,11 @@ discard block |
||
| 1071 | 1071 | function checkConvertFlag(&$val, $key = null, $charset = null) |
| 1072 | 1072 | { |
| 1073 | 1073 | static $flag = TRUE; |
| 1074 | - if($charset) |
|
| 1074 | + if ($charset) |
|
| 1075 | 1075 | { |
| 1076 | - if(is_array($val)) |
|
| 1077 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1078 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1076 | + if (is_array($val)) |
|
| 1077 | + array_walk($val, 'Context::checkConvertFlag', $charset); |
|
| 1078 | + else if ($val && iconv($charset, $charset, $val) != $val) $flag = FALSE; |
|
| 1079 | 1079 | else $flag = FALSE; |
| 1080 | 1080 | } |
| 1081 | 1081 | else |
@@ -1099,9 +1099,9 @@ discard block |
||
| 1099 | 1099 | { |
| 1100 | 1100 | if (is_array($val)) |
| 1101 | 1101 | { |
| 1102 | - array_walk($val,'Context::doConvertEncoding',$charset); |
|
| 1102 | + array_walk($val, 'Context::doConvertEncoding', $charset); |
|
| 1103 | 1103 | } |
| 1104 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1104 | + else $val = iconv($charset, 'UTF-8', $val); |
|
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | 1107 | /** |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | */ |
| 1113 | 1113 | function convertEncodingStr($str) |
| 1114 | 1114 | { |
| 1115 | - if(!$str) return null; |
|
| 1115 | + if (!$str) return null; |
|
| 1116 | 1116 | $obj = new stdClass(); |
| 1117 | 1117 | $obj->str = $str; |
| 1118 | 1118 | $obj = self::convertEncoding($obj); |
@@ -1121,9 +1121,9 @@ discard block |
||
| 1121 | 1121 | |
| 1122 | 1122 | function decodeIdna($domain) |
| 1123 | 1123 | { |
| 1124 | - if(strpos($domain, 'xn--') !== FALSE) |
|
| 1124 | + if (strpos($domain, 'xn--') !== FALSE) |
|
| 1125 | 1125 | { |
| 1126 | - require_once(_XE_PATH_ . 'libs/idna_convert/idna_convert.class.php'); |
|
| 1126 | + require_once(_XE_PATH_.'libs/idna_convert/idna_convert.class.php'); |
|
| 1127 | 1127 | $IDN = new idna_convert(array('idn_version' => 2008)); |
| 1128 | 1128 | $domain = $IDN->decode($domain); |
| 1129 | 1129 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | { |
| 1155 | 1155 | $self = self::getInstance(); |
| 1156 | 1156 | |
| 1157 | - if($self->response_method) |
|
| 1157 | + if ($self->response_method) |
|
| 1158 | 1158 | { |
| 1159 | 1159 | return $self->response_method; |
| 1160 | 1160 | } |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); |
| 1195 | 1195 | |
| 1196 | 1196 | $pattern = "/[\,\"\'\{\}\[\]\(\);$]/"; |
| 1197 | - if(preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1197 | + if (preg_match($pattern, $_SERVER['HTTP_HOST'])) |
|
| 1198 | 1198 | { |
| 1199 | 1199 | $this->isSuccessInit = FALSE; |
| 1200 | 1200 | } |
@@ -1207,30 +1207,30 @@ discard block |
||
| 1207 | 1207 | */ |
| 1208 | 1208 | function _setRequestArgument() |
| 1209 | 1209 | { |
| 1210 | - if(!count($_REQUEST)) |
|
| 1210 | + if (!count($_REQUEST)) |
|
| 1211 | 1211 | { |
| 1212 | 1212 | return; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
| 1215 | 1215 | $requestMethod = $this->getRequestMethod(); |
| 1216 | - foreach($_REQUEST as $key => $val) |
|
| 1216 | + foreach ($_REQUEST as $key => $val) |
|
| 1217 | 1217 | { |
| 1218 | - if($val === '' || self::get($key)) |
|
| 1218 | + if ($val === '' || self::get($key)) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | continue; |
| 1221 | 1221 | } |
| 1222 | 1222 | $key = htmlentities($key); |
| 1223 | 1223 | $val = $this->_filterRequestVar($key, $val, false, ($requestMethod == 'GET')); |
| 1224 | 1224 | |
| 1225 | - if($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1225 | + if ($requestMethod == 'GET' && isset($_GET[$key])) |
|
| 1226 | 1226 | { |
| 1227 | 1227 | $set_to_vars = TRUE; |
| 1228 | 1228 | } |
| 1229 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1229 | + elseif ($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1230 | 1230 | { |
| 1231 | 1231 | $set_to_vars = TRUE; |
| 1232 | 1232 | } |
| 1233 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1233 | + elseif ($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1234 | 1234 | { |
| 1235 | 1235 | $set_to_vars = TRUE; |
| 1236 | 1236 | } |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | $set_to_vars = FALSE; |
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | - if($set_to_vars) |
|
| 1242 | + if ($set_to_vars) |
|
| 1243 | 1243 | { |
| 1244 | 1244 | $this->_recursiveCheckVar($val); |
| 1245 | 1245 | } |
@@ -1250,20 +1250,20 @@ discard block |
||
| 1250 | 1250 | |
| 1251 | 1251 | function _recursiveCheckVar($val) |
| 1252 | 1252 | { |
| 1253 | - if(is_string($val)) |
|
| 1253 | + if (is_string($val)) |
|
| 1254 | 1254 | { |
| 1255 | - foreach($this->patterns as $pattern) |
|
| 1255 | + foreach ($this->patterns as $pattern) |
|
| 1256 | 1256 | { |
| 1257 | - if(preg_match($pattern, $val)) |
|
| 1257 | + if (preg_match($pattern, $val)) |
|
| 1258 | 1258 | { |
| 1259 | 1259 | $this->isSuccessInit = FALSE; |
| 1260 | 1260 | return; |
| 1261 | 1261 | } |
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | - else if(is_array($val)) |
|
| 1264 | + else if (is_array($val)) |
|
| 1265 | 1265 | { |
| 1266 | - foreach($val as $val2) |
|
| 1266 | + foreach ($val as $val2) |
|
| 1267 | 1267 | { |
| 1268 | 1268 | $this->_recursiveCheckVar($val2); |
| 1269 | 1269 | } |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | */ |
| 1278 | 1278 | function _setJSONRequestArgument() |
| 1279 | 1279 | { |
| 1280 | - if($this->getRequestMethod() != 'JSON') |
|
| 1280 | + if ($this->getRequestMethod() != 'JSON') |
|
| 1281 | 1281 | { |
| 1282 | 1282 | return; |
| 1283 | 1283 | } |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | $params = array(); |
| 1286 | 1286 | parse_str($GLOBALS['HTTP_RAW_POST_DATA'], $params); |
| 1287 | 1287 | |
| 1288 | - foreach($params as $key => $val) |
|
| 1288 | + foreach ($params as $key => $val) |
|
| 1289 | 1289 | { |
| 1290 | 1290 | $this->set($key, $this->_filterRequestVar($key, $val, 1), TRUE); |
| 1291 | 1291 | } |
@@ -1298,13 +1298,13 @@ discard block |
||
| 1298 | 1298 | */ |
| 1299 | 1299 | function _setXmlRpcArgument() |
| 1300 | 1300 | { |
| 1301 | - if($this->getRequestMethod() != 'XMLRPC') |
|
| 1301 | + if ($this->getRequestMethod() != 'XMLRPC') |
|
| 1302 | 1302 | { |
| 1303 | 1303 | return; |
| 1304 | 1304 | } |
| 1305 | 1305 | |
| 1306 | 1306 | $xml = $GLOBALS['HTTP_RAW_POST_DATA']; |
| 1307 | - if(Security::detectingXEE($xml)) |
|
| 1307 | + if (Security::detectingXEE($xml)) |
|
| 1308 | 1308 | { |
| 1309 | 1309 | header("HTTP/1.0 400 Bad Request"); |
| 1310 | 1310 | exit; |
@@ -1316,12 +1316,12 @@ discard block |
||
| 1316 | 1316 | $params = $xml_obj->methodcall->params; |
| 1317 | 1317 | unset($params->node_name, $params->attrs, $params->body); |
| 1318 | 1318 | |
| 1319 | - if(!count(get_object_vars($params))) |
|
| 1319 | + if (!count(get_object_vars($params))) |
|
| 1320 | 1320 | { |
| 1321 | 1321 | return; |
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | - foreach($params as $key => $val) |
|
| 1324 | + foreach ($params as $key => $val) |
|
| 1325 | 1325 | { |
| 1326 | 1326 | $this->set($key, $this->_filterXmlVars($key, $val), TRUE); |
| 1327 | 1327 | } |
@@ -1336,10 +1336,10 @@ discard block |
||
| 1336 | 1336 | */ |
| 1337 | 1337 | function _filterXmlVars($key, $val) |
| 1338 | 1338 | { |
| 1339 | - if(is_array($val)) |
|
| 1339 | + if (is_array($val)) |
|
| 1340 | 1340 | { |
| 1341 | 1341 | $stack = array(); |
| 1342 | - foreach($val as $k => $v) |
|
| 1342 | + foreach ($val as $k => $v) |
|
| 1343 | 1343 | { |
| 1344 | 1344 | $stack[$k] = $this->_filterXmlVars($k, $v); |
| 1345 | 1345 | } |
@@ -1349,20 +1349,20 @@ discard block |
||
| 1349 | 1349 | |
| 1350 | 1350 | $body = $val->body; |
| 1351 | 1351 | unset($val->node_name, $val->attrs, $val->body); |
| 1352 | - if(!count(get_object_vars($val))) |
|
| 1352 | + if (!count(get_object_vars($val))) |
|
| 1353 | 1353 | { |
| 1354 | 1354 | return $this->_filterRequestVar($key, $body, 0); |
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | $stack = new stdClass(); |
| 1358 | - foreach($val as $k => $v) |
|
| 1358 | + foreach ($val as $k => $v) |
|
| 1359 | 1359 | { |
| 1360 | 1360 | $output = $this->_filterXmlVars($k, $v); |
| 1361 | - if(is_object($v) && $v->attrs->type == 'array') |
|
| 1361 | + if (is_object($v) && $v->attrs->type == 'array') |
|
| 1362 | 1362 | { |
| 1363 | 1363 | $output = array($output); |
| 1364 | 1364 | } |
| 1365 | - if($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1365 | + if ($k == 'value' && (is_array($v) || $v->attrs->type == 'array')) |
|
| 1366 | 1366 | { |
| 1367 | 1367 | return $output; |
| 1368 | 1368 | } |
@@ -1370,7 +1370,7 @@ discard block |
||
| 1370 | 1370 | $stack->{$k} = $output; |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - if(!count(get_object_vars($stack))) |
|
| 1373 | + if (!count(get_object_vars($stack))) |
|
| 1374 | 1374 | { |
| 1375 | 1375 | return NULL; |
| 1376 | 1376 | } |
@@ -1389,16 +1389,16 @@ discard block |
||
| 1389 | 1389 | */ |
| 1390 | 1390 | function _filterRequestVar($key, $val, $do_stripslashes = true, $remove_hack = false) |
| 1391 | 1391 | { |
| 1392 | - if(!($isArray = is_array($val))) |
|
| 1392 | + if (!($isArray = is_array($val))) |
|
| 1393 | 1393 | { |
| 1394 | 1394 | $val = array($val); |
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | $result = array(); |
| 1398 | - foreach($val as $k => $v) |
|
| 1398 | + foreach ($val as $k => $v) |
|
| 1399 | 1399 | { |
| 1400 | - if($remove_hack && !is_array($v)) { |
|
| 1401 | - if(stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
| 1400 | + if ($remove_hack && !is_array($v)) { |
|
| 1401 | + if (stripos($v, '<script') || stripos($v, 'lt;script') || stripos($v, '%3Cscript')) |
|
| 1402 | 1402 | { |
| 1403 | 1403 | $result[$k] = escape($v); |
| 1404 | 1404 | continue; |
@@ -1406,18 +1406,18 @@ discard block |
||
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | $k = htmlentities($k); |
| 1409 | - if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1409 | + if ($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
|
| 1410 | 1410 | { |
| 1411 | 1411 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1412 | 1412 | } |
| 1413 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1413 | + elseif (in_array($key, array('mid', 'search_keyword', 'search_target', 'xe_validator_id'))) { |
|
| 1414 | 1414 | $result[$k] = escape($v, false); |
| 1415 | 1415 | } |
| 1416 | - elseif($key === 'vid') |
|
| 1416 | + elseif ($key === 'vid') |
|
| 1417 | 1417 | { |
| 1418 | 1418 | $result[$k] = urlencode($v); |
| 1419 | 1419 | } |
| 1420 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1420 | + elseif (stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1421 | 1421 | { |
| 1422 | 1422 | unset($result[$k]); |
| 1423 | 1423 | } |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | { |
| 1426 | 1426 | $result[$k] = $v; |
| 1427 | 1427 | |
| 1428 | - if($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1428 | + if ($do_stripslashes && version_compare(PHP_VERSION, '5.4.0', '<') && get_magic_quotes_gpc()) |
|
| 1429 | 1429 | { |
| 1430 | 1430 | if (is_array($result[$k])) |
| 1431 | 1431 | { |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | } |
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | - if(is_array($result[$k])) |
|
| 1440 | + if (is_array($result[$k])) |
|
| 1441 | 1441 | { |
| 1442 | 1442 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1443 | 1443 | } |
@@ -1446,7 +1446,7 @@ discard block |
||
| 1446 | 1446 | $result[$k] = trim($result[$k]); |
| 1447 | 1447 | } |
| 1448 | 1448 | |
| 1449 | - if($remove_hack) |
|
| 1449 | + if ($remove_hack) |
|
| 1450 | 1450 | { |
| 1451 | 1451 | $result[$k] = escape($result[$k], false); |
| 1452 | 1452 | } |
@@ -1474,17 +1474,17 @@ discard block |
||
| 1474 | 1474 | */ |
| 1475 | 1475 | function _setUploadedArgument() |
| 1476 | 1476 | { |
| 1477 | - if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1477 | + if ($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) |
|
| 1478 | 1478 | { |
| 1479 | 1479 | return; |
| 1480 | 1480 | } |
| 1481 | 1481 | |
| 1482 | - foreach($_FILES as $key => $val) |
|
| 1482 | + foreach ($_FILES as $key => $val) |
|
| 1483 | 1483 | { |
| 1484 | 1484 | $tmp_name = $val['tmp_name']; |
| 1485 | - if(!is_array($tmp_name)) |
|
| 1485 | + if (!is_array($tmp_name)) |
|
| 1486 | 1486 | { |
| 1487 | - if(!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1487 | + if (!UploadFileFilter::check($tmp_name, $val['name'])) |
|
| 1488 | 1488 | { |
| 1489 | 1489 | continue; |
| 1490 | 1490 | } |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | $files = array(); |
| 1498 | 1498 | foreach ($tmp_name as $i => $j) |
| 1499 | 1499 | { |
| 1500 | - if(!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1500 | + if (!UploadFileFilter::check($val['tmp_name'][$i], $val['name'][$i])) |
|
| 1501 | 1501 | { |
| 1502 | 1502 | $files = array(); |
| 1503 | 1503 | unset($_FILES[$key]); |
@@ -1511,7 +1511,7 @@ discard block |
||
| 1511 | 1511 | $file['size'] = $val['size'][$i]; |
| 1512 | 1512 | $files[] = $file; |
| 1513 | 1513 | } |
| 1514 | - if(count($files)) |
|
| 1514 | + if (count($files)) |
|
| 1515 | 1515 | { |
| 1516 | 1516 | self::set($key, $files, true); |
| 1517 | 1517 | } |
@@ -1536,16 +1536,16 @@ discard block |
||
| 1536 | 1536 | function getRequestUrl() |
| 1537 | 1537 | { |
| 1538 | 1538 | static $url = null; |
| 1539 | - if(is_null($url)) |
|
| 1539 | + if (is_null($url)) |
|
| 1540 | 1540 | { |
| 1541 | 1541 | $url = self::getRequestUri(); |
| 1542 | - if(count($_GET) > 0) |
|
| 1542 | + if (count($_GET) > 0) |
|
| 1543 | 1543 | { |
| 1544 | - foreach($_GET as $key => $val) |
|
| 1544 | + foreach ($_GET as $key => $val) |
|
| 1545 | 1545 | { |
| 1546 | - $vars[] = $key . '=' . ($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1546 | + $vars[] = $key.'='.($val ? urlencode(self::convertEncodingStr($val)) : ''); |
|
| 1547 | 1547 | } |
| 1548 | - $url .= '?' . join('&', $vars); |
|
| 1548 | + $url .= '?'.join('&', $vars); |
|
| 1549 | 1549 | } |
| 1550 | 1550 | } |
| 1551 | 1551 | return $url; |
@@ -1560,7 +1560,7 @@ discard block |
||
| 1560 | 1560 | $self = self::getInstance(); |
| 1561 | 1561 | $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; |
| 1562 | 1562 | |
| 1563 | - if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1563 | + if (!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) |
|
| 1564 | 1564 | { |
| 1565 | 1565 | unset($js_callback_func); |
| 1566 | 1566 | unset($_GET['xe_js_callback']); |
@@ -1588,22 +1588,22 @@ discard block |
||
| 1588 | 1588 | $self = self::getInstance(); |
| 1589 | 1589 | |
| 1590 | 1590 | // retrieve virtual site information |
| 1591 | - if(is_null($site_module_info)) |
|
| 1591 | + if (is_null($site_module_info)) |
|
| 1592 | 1592 | { |
| 1593 | 1593 | $site_module_info = self::get('site_module_info'); |
| 1594 | 1594 | } |
| 1595 | 1595 | |
| 1596 | 1596 | // If $domain is set, handle it (if $domain is vid type, remove $domain and handle with $vid) |
| 1597 | - if($domain && isSiteID($domain)) |
|
| 1597 | + if ($domain && isSiteID($domain)) |
|
| 1598 | 1598 | { |
| 1599 | 1599 | $vid = $domain; |
| 1600 | 1600 | $domain = ''; |
| 1601 | 1601 | } |
| 1602 | 1602 | |
| 1603 | 1603 | // If $domain, $vid are not set, use current site information |
| 1604 | - if(!$domain && !$vid) |
|
| 1604 | + if (!$domain && !$vid) |
|
| 1605 | 1605 | { |
| 1606 | - if($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1606 | + if ($site_module_info->domain && isSiteID($site_module_info->domain)) |
|
| 1607 | 1607 | { |
| 1608 | 1608 | $vid = $site_module_info->domain; |
| 1609 | 1609 | } |
@@ -1614,21 +1614,21 @@ discard block |
||
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | // if $domain is set, compare current URL. If they are same, remove the domain, otherwise link to the domain. |
| 1617 | - if($domain) |
|
| 1617 | + if ($domain) |
|
| 1618 | 1618 | { |
| 1619 | 1619 | $domain_info = parse_url($domain); |
| 1620 | - if(is_null($current_info)) |
|
| 1620 | + if (is_null($current_info)) |
|
| 1621 | 1621 | { |
| 1622 | - $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . getScriptPath()); |
|
| 1622 | + $current_info = parse_url(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].getScriptPath()); |
|
| 1623 | 1623 | } |
| 1624 | - if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
|
| 1624 | + if ($domain_info['host'].$domain_info['path'] == $current_info['host'].$current_info['path']) |
|
| 1625 | 1625 | { |
| 1626 | 1626 | unset($domain); |
| 1627 | 1627 | } |
| 1628 | 1628 | else |
| 1629 | 1629 | { |
| 1630 | 1630 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1631 | - if(substr_compare($domain, '/', -1) !== 0) |
|
| 1631 | + if (substr_compare($domain, '/', -1) !== 0) |
|
| 1632 | 1632 | { |
| 1633 | 1633 | $domain .= '/'; |
| 1634 | 1634 | } |
@@ -1638,41 +1638,41 @@ discard block |
||
| 1638 | 1638 | $get_vars = array(); |
| 1639 | 1639 | |
| 1640 | 1640 | // If there is no GET variables or first argument is '' to reset variables |
| 1641 | - if(!$self->get_vars || $args_list[0] == '') |
|
| 1641 | + if (!$self->get_vars || $args_list[0] == '') |
|
| 1642 | 1642 | { |
| 1643 | 1643 | // rearrange args_list |
| 1644 | - if(is_array($args_list) && $args_list[0] == '') |
|
| 1644 | + if (is_array($args_list) && $args_list[0] == '') |
|
| 1645 | 1645 | { |
| 1646 | 1646 | array_shift($args_list); |
| 1647 | 1647 | } |
| 1648 | 1648 | } |
| 1649 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1649 | + elseif ($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1650 | 1650 | { |
| 1651 | 1651 | // Otherwise, make GET variables into array |
| 1652 | 1652 | $get_vars = get_object_vars($self->get_vars); |
| 1653 | 1653 | } |
| 1654 | 1654 | else |
| 1655 | 1655 | { |
| 1656 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1657 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1659 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1660 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1661 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1662 | - if($get_vars['act'] == 'IS') |
|
| 1656 | + if (!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1657 | + if (!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | + if (!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1659 | + if (!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1660 | + if (!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1661 | + if (!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1662 | + if ($get_vars['act'] == 'IS') |
|
| 1663 | 1663 | { |
| 1664 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1664 | + if (!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1665 | 1665 | } |
| 1666 | 1666 | } |
| 1667 | 1667 | |
| 1668 | 1668 | // arrange args_list |
| 1669 | - for($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1669 | + for ($i = 0, $c = count($args_list); $i < $c; $i += 2) |
|
| 1670 | 1670 | { |
| 1671 | 1671 | $key = $args_list[$i]; |
| 1672 | 1672 | $val = trim($args_list[$i + 1]); |
| 1673 | 1673 | |
| 1674 | 1674 | // If value is not set, remove the key |
| 1675 | - if(!isset($val) || !strlen($val)) |
|
| 1675 | + if (!isset($val) || !strlen($val)) |
|
| 1676 | 1676 | { |
| 1677 | 1677 | unset($get_vars[$key]); |
| 1678 | 1678 | continue; |
@@ -1683,7 +1683,7 @@ discard block |
||
| 1683 | 1683 | |
| 1684 | 1684 | // remove vid, rnd |
| 1685 | 1685 | unset($get_vars['rnd']); |
| 1686 | - if($vid) |
|
| 1686 | + if ($vid) |
|
| 1687 | 1687 | { |
| 1688 | 1688 | $get_vars['vid'] = $vid; |
| 1689 | 1689 | } |
@@ -1700,17 +1700,17 @@ discard block |
||
| 1700 | 1700 | 'dispDocumentAdminManageDocument' => 'dispDocumentManageDocument', |
| 1701 | 1701 | 'dispModuleAdminSelectList' => 'dispModuleSelectList' |
| 1702 | 1702 | ); |
| 1703 | - if($act_alias[$act]) |
|
| 1703 | + if ($act_alias[$act]) |
|
| 1704 | 1704 | { |
| 1705 | 1705 | $get_vars['act'] = $act_alias[$act]; |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | 1708 | // organize URL |
| 1709 | 1709 | $query = ''; |
| 1710 | - if(count($get_vars) > 0) |
|
| 1710 | + if (count($get_vars) > 0) |
|
| 1711 | 1711 | { |
| 1712 | 1712 | // if using rewrite mod |
| 1713 | - if($self->allow_rewrite) |
|
| 1713 | + if ($self->allow_rewrite) |
|
| 1714 | 1714 | { |
| 1715 | 1715 | $var_keys = array_keys($get_vars); |
| 1716 | 1716 | sort($var_keys); |
@@ -1730,8 +1730,8 @@ discard block |
||
| 1730 | 1730 | 'vid' => $vid, |
| 1731 | 1731 | 'mid' => $mid, |
| 1732 | 1732 | 'mid.vid' => "$vid/$mid", |
| 1733 | - 'entry.mid' => "$mid/entry/" . $get_vars['entry'], |
|
| 1734 | - 'entry.mid.vid' => "$vid/$mid/entry/" . $get_vars['entry'], |
|
| 1733 | + 'entry.mid' => "$mid/entry/".$get_vars['entry'], |
|
| 1734 | + 'entry.mid.vid' => "$vid/$mid/entry/".$get_vars['entry'], |
|
| 1735 | 1735 | 'document_srl' => $srl, |
| 1736 | 1736 | 'document_srl.mid' => "$mid/$srl", |
| 1737 | 1737 | 'document_srl.vid' => "$vid/$srl", |
@@ -1748,66 +1748,66 @@ discard block |
||
| 1748 | 1748 | $query = $target_map[$target]; |
| 1749 | 1749 | } |
| 1750 | 1750 | |
| 1751 | - if(!$query) |
|
| 1751 | + if (!$query) |
|
| 1752 | 1752 | { |
| 1753 | 1753 | $queries = array(); |
| 1754 | - foreach($get_vars as $key => $val) |
|
| 1754 | + foreach ($get_vars as $key => $val) |
|
| 1755 | 1755 | { |
| 1756 | - if(is_array($val) && count($val) > 0) |
|
| 1756 | + if (is_array($val) && count($val) > 0) |
|
| 1757 | 1757 | { |
| 1758 | - foreach($val as $k => $v) |
|
| 1758 | + foreach ($val as $k => $v) |
|
| 1759 | 1759 | { |
| 1760 | - $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
|
| 1760 | + $queries[] = $key.'['.$k.']='.urlencode($v); |
|
| 1761 | 1761 | } |
| 1762 | 1762 | } |
| 1763 | - elseif(!is_array($val)) |
|
| 1763 | + elseif (!is_array($val)) |
|
| 1764 | 1764 | { |
| 1765 | - $queries[] = $key . '=' . urlencode($val); |
|
| 1765 | + $queries[] = $key.'='.urlencode($val); |
|
| 1766 | 1766 | } |
| 1767 | 1767 | } |
| 1768 | - if(count($queries) > 0) |
|
| 1768 | + if (count($queries) > 0) |
|
| 1769 | 1769 | { |
| 1770 | - $query = 'index.php?' . join('&', $queries); |
|
| 1770 | + $query = 'index.php?'.join('&', $queries); |
|
| 1771 | 1771 | } |
| 1772 | 1772 | } |
| 1773 | 1773 | } |
| 1774 | 1774 | |
| 1775 | 1775 | // If using SSL always |
| 1776 | 1776 | $_use_ssl = $self->get('_use_ssl'); |
| 1777 | - if($_use_ssl == 'always') |
|
| 1777 | + if ($_use_ssl == 'always') |
|
| 1778 | 1778 | { |
| 1779 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1779 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1780 | 1780 | // optional SSL use |
| 1781 | 1781 | } |
| 1782 | - elseif($_use_ssl == 'optional') |
|
| 1782 | + elseif ($_use_ssl == 'optional') |
|
| 1783 | 1783 | { |
| 1784 | 1784 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1785 | - $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
|
| 1785 | + $query = $self->getRequestUri($ssl_mode, $domain).$query; |
|
| 1786 | 1786 | // no SSL |
| 1787 | 1787 | } |
| 1788 | 1788 | else |
| 1789 | 1789 | { |
| 1790 | 1790 | // currently on SSL but target is not based on SSL |
| 1791 | - if($_SERVER['HTTPS'] == 'on') |
|
| 1791 | + if ($_SERVER['HTTPS'] == 'on') |
|
| 1792 | 1792 | { |
| 1793 | - $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
|
| 1793 | + $query = $self->getRequestUri(ENFORCE_SSL, $domain).$query; |
|
| 1794 | 1794 | } |
| 1795 | - else if($domain) // if $domain is set |
|
| 1795 | + else if ($domain) // if $domain is set |
|
| 1796 | 1796 | { |
| 1797 | - $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
|
| 1797 | + $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain).$query; |
|
| 1798 | 1798 | } |
| 1799 | 1799 | else |
| 1800 | 1800 | { |
| 1801 | - $query = getScriptPath() . $query; |
|
| 1801 | + $query = getScriptPath().$query; |
|
| 1802 | 1802 | } |
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | - if(!$encode) |
|
| 1805 | + if (!$encode) |
|
| 1806 | 1806 | { |
| 1807 | 1807 | return $query; |
| 1808 | 1808 | } |
| 1809 | 1809 | |
| 1810 | - if(!$autoEncode) |
|
| 1810 | + if (!$autoEncode) |
|
| 1811 | 1811 | { |
| 1812 | 1812 | return htmlspecialchars($query, ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1813 | 1813 | } |
@@ -1816,16 +1816,16 @@ discard block |
||
| 1816 | 1816 | $encode_queries = array(); |
| 1817 | 1817 | $parsedUrl = parse_url($query); |
| 1818 | 1818 | parse_str($parsedUrl['query'], $output); |
| 1819 | - foreach($output as $key => $value) |
|
| 1819 | + foreach ($output as $key => $value) |
|
| 1820 | 1820 | { |
| 1821 | - if(preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1821 | + if (preg_match('/&([a-z]{2,}|#\d+);/', urldecode($value))) |
|
| 1822 | 1822 | { |
| 1823 | 1823 | $value = urlencode(htmlspecialchars_decode(urldecode($value))); |
| 1824 | 1824 | } |
| 1825 | - $encode_queries[] = $key . '=' . $value; |
|
| 1825 | + $encode_queries[] = $key.'='.$value; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | |
| 1828 | - return htmlspecialchars($parsedUrl['path'] . '?' . join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1828 | + return htmlspecialchars($parsedUrl['path'].'?'.join('&', $encode_queries), ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
|
| 1829 | 1829 | } |
| 1830 | 1830 | |
| 1831 | 1831 | /** |
@@ -1840,17 +1840,17 @@ discard block |
||
| 1840 | 1840 | static $url = array(); |
| 1841 | 1841 | |
| 1842 | 1842 | // Check HTTP Request |
| 1843 | - if(!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1843 | + if (!isset($_SERVER['SERVER_PROTOCOL'])) |
|
| 1844 | 1844 | { |
| 1845 | 1845 | return; |
| 1846 | 1846 | } |
| 1847 | 1847 | |
| 1848 | - if(self::get('_use_ssl') == 'always') |
|
| 1848 | + if (self::get('_use_ssl') == 'always') |
|
| 1849 | 1849 | { |
| 1850 | 1850 | $ssl_mode = ENFORCE_SSL; |
| 1851 | 1851 | } |
| 1852 | 1852 | |
| 1853 | - if($domain) |
|
| 1853 | + if ($domain) |
|
| 1854 | 1854 | { |
| 1855 | 1855 | $domain_key = md5($domain); |
| 1856 | 1856 | } |
@@ -1859,14 +1859,14 @@ discard block |
||
| 1859 | 1859 | $domain_key = 'default'; |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | - if(isset($url[$ssl_mode][$domain_key])) |
|
| 1862 | + if (isset($url[$ssl_mode][$domain_key])) |
|
| 1863 | 1863 | { |
| 1864 | 1864 | return $url[$ssl_mode][$domain_key]; |
| 1865 | 1865 | } |
| 1866 | 1866 | |
| 1867 | 1867 | $current_use_ssl = ($_SERVER['HTTPS'] == 'on'); |
| 1868 | 1868 | |
| 1869 | - switch($ssl_mode) |
|
| 1869 | + switch ($ssl_mode) |
|
| 1870 | 1870 | { |
| 1871 | 1871 | case FOLLOW_REQUEST_SSL: $use_ssl = $current_use_ssl; |
| 1872 | 1872 | break; |
@@ -1876,34 +1876,34 @@ discard block |
||
| 1876 | 1876 | break; |
| 1877 | 1877 | } |
| 1878 | 1878 | |
| 1879 | - if($domain) |
|
| 1879 | + if ($domain) |
|
| 1880 | 1880 | { |
| 1881 | 1881 | $target_url = trim($domain); |
| 1882 | - if(substr_compare($target_url, '/', -1) !== 0) |
|
| 1882 | + if (substr_compare($target_url, '/', -1) !== 0) |
|
| 1883 | 1883 | { |
| 1884 | - $target_url.= '/'; |
|
| 1884 | + $target_url .= '/'; |
|
| 1885 | 1885 | } |
| 1886 | 1886 | } |
| 1887 | 1887 | else |
| 1888 | 1888 | { |
| 1889 | - $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
|
| 1889 | + $target_url = $_SERVER['HTTP_HOST'].getScriptPath(); |
|
| 1890 | 1890 | } |
| 1891 | 1891 | |
| 1892 | - $url_info = parse_url('http://' . $target_url); |
|
| 1892 | + $url_info = parse_url('http://'.$target_url); |
|
| 1893 | 1893 | |
| 1894 | - if($current_use_ssl != $use_ssl) |
|
| 1894 | + if ($current_use_ssl != $use_ssl) |
|
| 1895 | 1895 | { |
| 1896 | 1896 | unset($url_info['port']); |
| 1897 | 1897 | } |
| 1898 | 1898 | |
| 1899 | - if($use_ssl) |
|
| 1899 | + if ($use_ssl) |
|
| 1900 | 1900 | { |
| 1901 | 1901 | $port = self::get('_https_port'); |
| 1902 | - if($port && $port != 443) |
|
| 1902 | + if ($port && $port != 443) |
|
| 1903 | 1903 | { |
| 1904 | 1904 | $url_info['port'] = $port; |
| 1905 | 1905 | } |
| 1906 | - elseif($url_info['port'] == 443) |
|
| 1906 | + elseif ($url_info['port'] == 443) |
|
| 1907 | 1907 | { |
| 1908 | 1908 | unset($url_info['port']); |
| 1909 | 1909 | } |
@@ -1911,17 +1911,17 @@ discard block |
||
| 1911 | 1911 | else |
| 1912 | 1912 | { |
| 1913 | 1913 | $port = self::get('_http_port'); |
| 1914 | - if($port && $port != 80) |
|
| 1914 | + if ($port && $port != 80) |
|
| 1915 | 1915 | { |
| 1916 | 1916 | $url_info['port'] = $port; |
| 1917 | 1917 | } |
| 1918 | - elseif($url_info['port'] == 80) |
|
| 1918 | + elseif ($url_info['port'] == 80) |
|
| 1919 | 1919 | { |
| 1920 | 1920 | unset($url_info['port']); |
| 1921 | 1921 | } |
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | - $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']); |
|
| 1924 | + $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']); |
|
| 1925 | 1925 | |
| 1926 | 1926 | return $url[$ssl_mode][$domain_key]; |
| 1927 | 1927 | } |
@@ -1938,16 +1938,16 @@ discard block |
||
| 1938 | 1938 | { |
| 1939 | 1939 | $self = self::getInstance(); |
| 1940 | 1940 | $self->context->{$key} = $val; |
| 1941 | - if($set_to_get_vars === FALSE) |
|
| 1941 | + if ($set_to_get_vars === FALSE) |
|
| 1942 | 1942 | { |
| 1943 | 1943 | return; |
| 1944 | 1944 | } |
| 1945 | - if($val === NULL || $val === '') |
|
| 1945 | + if ($val === NULL || $val === '') |
|
| 1946 | 1946 | { |
| 1947 | 1947 | unset($self->get_vars->{$key}); |
| 1948 | 1948 | return; |
| 1949 | 1949 | } |
| 1950 | - if($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1950 | + if ($set_to_get_vars || $self->get_vars->{$key}) |
|
| 1951 | 1951 | { |
| 1952 | 1952 | $self->get_vars->{$key} = $val; |
| 1953 | 1953 | } |
@@ -1963,7 +1963,7 @@ discard block |
||
| 1963 | 1963 | { |
| 1964 | 1964 | $self = self::getInstance(); |
| 1965 | 1965 | |
| 1966 | - if(!isset($self->context->{$key})) |
|
| 1966 | + if (!isset($self->context->{$key})) |
|
| 1967 | 1967 | { |
| 1968 | 1968 | return null; |
| 1969 | 1969 | } |
@@ -1978,7 +1978,7 @@ discard block |
||
| 1978 | 1978 | function gets() |
| 1979 | 1979 | { |
| 1980 | 1980 | $num_args = func_num_args(); |
| 1981 | - if($num_args < 1) |
|
| 1981 | + if ($num_args < 1) |
|
| 1982 | 1982 | { |
| 1983 | 1983 | return; |
| 1984 | 1984 | } |
@@ -1986,7 +1986,7 @@ discard block |
||
| 1986 | 1986 | |
| 1987 | 1987 | $args_list = func_get_args(); |
| 1988 | 1988 | $output = new stdClass(); |
| 1989 | - foreach($args_list as $v) |
|
| 1989 | + foreach ($args_list as $v) |
|
| 1990 | 1990 | { |
| 1991 | 1991 | $output->{$v} = $self->get($v); |
| 1992 | 1992 | } |
@@ -2012,7 +2012,7 @@ discard block |
||
| 2012 | 2012 | function getRequestVars() |
| 2013 | 2013 | { |
| 2014 | 2014 | $self = self::getInstance(); |
| 2015 | - if($self->get_vars) |
|
| 2015 | + if ($self->get_vars) |
|
| 2016 | 2016 | { |
| 2017 | 2017 | return clone($self->get_vars); |
| 2018 | 2018 | } |
@@ -2029,13 +2029,13 @@ discard block |
||
| 2029 | 2029 | { |
| 2030 | 2030 | $self = self::getInstance(); |
| 2031 | 2031 | |
| 2032 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2032 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2033 | 2033 | { |
| 2034 | 2034 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2035 | 2035 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | - if(!isset($self->ssl_actions[$action])) |
|
| 2038 | + if (!isset($self->ssl_actions[$action])) |
|
| 2039 | 2039 | { |
| 2040 | 2040 | $self->ssl_actions[$action] = 1; |
| 2041 | 2041 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2053,16 +2053,16 @@ discard block |
||
| 2053 | 2053 | { |
| 2054 | 2054 | $self = self::getInstance(); |
| 2055 | 2055 | |
| 2056 | - if(!is_readable($self->sslActionCacheFile)) |
|
| 2056 | + if (!is_readable($self->sslActionCacheFile)) |
|
| 2057 | 2057 | { |
| 2058 | 2058 | unset($self->ssl_actions); |
| 2059 | 2059 | $buff = '<?php if(!defined("__XE__"))exit;'; |
| 2060 | 2060 | FileHandler::writeFile($self->sslActionCacheFile, $buff); |
| 2061 | 2061 | } |
| 2062 | 2062 | |
| 2063 | - foreach($action_array as $action) |
|
| 2063 | + foreach ($action_array as $action) |
|
| 2064 | 2064 | { |
| 2065 | - if(!isset($self->ssl_actions[$action])) |
|
| 2065 | + if (!isset($self->ssl_actions[$action])) |
|
| 2066 | 2066 | { |
| 2067 | 2067 | $self->ssl_actions[$action] = 1; |
| 2068 | 2068 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
@@ -2081,7 +2081,7 @@ discard block |
||
| 2081 | 2081 | { |
| 2082 | 2082 | $self = self::getInstance(); |
| 2083 | 2083 | |
| 2084 | - if($self->isExistsSSLAction($action)) |
|
| 2084 | + if ($self->isExistsSSLAction($action)) |
|
| 2085 | 2085 | { |
| 2086 | 2086 | $sslActionCacheString = sprintf('$sslActions[\'%s\'] = 1;', $action); |
| 2087 | 2087 | $buff = FileHandler::readFile($self->sslActionCacheFile); |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | function getSSLActions() |
| 2099 | 2099 | { |
| 2100 | 2100 | $self = self::getInstance(); |
| 2101 | - if($self->getSslStatus() == 'optional') |
|
| 2101 | + if ($self->getSslStatus() == 'optional') |
|
| 2102 | 2102 | { |
| 2103 | 2103 | return $self->ssl_actions; |
| 2104 | 2104 | } |
@@ -2125,12 +2125,12 @@ discard block |
||
| 2125 | 2125 | */ |
| 2126 | 2126 | function normalizeFilePath($file) |
| 2127 | 2127 | { |
| 2128 | - if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2128 | + if ($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) |
|
| 2129 | 2129 | { |
| 2130 | - $file = './' . $file; |
|
| 2130 | + $file = './'.$file; |
|
| 2131 | 2131 | } |
| 2132 | 2132 | $file = preg_replace('@/\./|(?<!:)\/\/@', '/', $file); |
| 2133 | - while(strpos($file, '/../') !== FALSE) |
|
| 2133 | + while (strpos($file, '/../') !== FALSE) |
|
| 2134 | 2134 | { |
| 2135 | 2135 | $file = preg_replace('/\/([^\/]+)\/\.\.\//s', '/', $file, 1); |
| 2136 | 2136 | } |
@@ -2149,13 +2149,13 @@ discard block |
||
| 2149 | 2149 | { |
| 2150 | 2150 | $file = self::normalizeFilePath($file); |
| 2151 | 2151 | $script_path = getScriptPath(); |
| 2152 | - if(strpos($file, './') === 0) |
|
| 2152 | + if (strpos($file, './') === 0) |
|
| 2153 | 2153 | { |
| 2154 | - $file = $script_path . substr($file, 2); |
|
| 2154 | + $file = $script_path.substr($file, 2); |
|
| 2155 | 2155 | } |
| 2156 | - elseif(strpos($file, '../') === 0) |
|
| 2156 | + elseif (strpos($file, '../') === 0) |
|
| 2157 | 2157 | { |
| 2158 | - $file = self::normalizeFilePath($script_path . $file); |
|
| 2158 | + $file = self::normalizeFilePath($script_path.$file); |
|
| 2159 | 2159 | } |
| 2160 | 2160 | |
| 2161 | 2161 | return $file; |
@@ -2225,12 +2225,12 @@ discard block |
||
| 2225 | 2225 | */ |
| 2226 | 2226 | function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) |
| 2227 | 2227 | { |
| 2228 | - if($isRuleset) |
|
| 2228 | + if ($isRuleset) |
|
| 2229 | 2229 | { |
| 2230 | - if(strpos($file, '#') !== FALSE) |
|
| 2230 | + if (strpos($file, '#') !== FALSE) |
|
| 2231 | 2231 | { |
| 2232 | 2232 | $file = str_replace('#', '', $file); |
| 2233 | - if(!is_readable($file)) |
|
| 2233 | + if (!is_readable($file)) |
|
| 2234 | 2234 | { |
| 2235 | 2235 | $file = $autoPath; |
| 2236 | 2236 | } |
@@ -2295,9 +2295,9 @@ discard block |
||
| 2295 | 2295 | ksort($files); |
| 2296 | 2296 | $files = array_values($files); |
| 2297 | 2297 | $filenames = array(); |
| 2298 | - for($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2298 | + for ($i = 0, $c = count($files); $i < $c; ++$i) |
|
| 2299 | 2299 | { |
| 2300 | - if(in_array($files[$i]['file'], $filenames)) |
|
| 2300 | + if (in_array($files[$i]['file'], $filenames)) |
|
| 2301 | 2301 | { |
| 2302 | 2302 | unset($files[$i]); |
| 2303 | 2303 | } |
@@ -2382,14 +2382,14 @@ discard block |
||
| 2382 | 2382 | */ |
| 2383 | 2383 | function getJavascriptPluginInfo($pluginName) |
| 2384 | 2384 | { |
| 2385 | - if($plugin_name == 'ui.datepicker') |
|
| 2385 | + if ($plugin_name == 'ui.datepicker') |
|
| 2386 | 2386 | { |
| 2387 | 2387 | $plugin_name = 'ui'; |
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | - $plugin_path = './common/js/plugins/' . $pluginName . '/'; |
|
| 2391 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2392 | - if(!is_readable($info_file)) |
|
| 2390 | + $plugin_path = './common/js/plugins/'.$pluginName.'/'; |
|
| 2391 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2392 | + if (!is_readable($info_file)) |
|
| 2393 | 2393 | { |
| 2394 | 2394 | return; |
| 2395 | 2395 | } |
@@ -2399,32 +2399,32 @@ discard block |
||
| 2399 | 2399 | $result->jsList = array(); |
| 2400 | 2400 | $result->cssList = array(); |
| 2401 | 2401 | |
| 2402 | - foreach($list as $filename) |
|
| 2402 | + foreach ($list as $filename) |
|
| 2403 | 2403 | { |
| 2404 | 2404 | $filename = trim($filename); |
| 2405 | - if(!$filename) |
|
| 2405 | + if (!$filename) |
|
| 2406 | 2406 | { |
| 2407 | 2407 | continue; |
| 2408 | 2408 | } |
| 2409 | 2409 | |
| 2410 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2410 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2411 | 2411 | { |
| 2412 | 2412 | $filename = substr($filename, 2); |
| 2413 | 2413 | } |
| 2414 | 2414 | |
| 2415 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2415 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2416 | 2416 | { |
| 2417 | - $result->jsList[] = $plugin_path . $filename; |
|
| 2417 | + $result->jsList[] = $plugin_path.$filename; |
|
| 2418 | 2418 | } |
| 2419 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2419 | + elseif (substr_compare($filename, '.css', -4) === 0) |
|
| 2420 | 2420 | { |
| 2421 | - $result->cssList[] = $plugin_path . $filename; |
|
| 2421 | + $result->cssList[] = $plugin_path.$filename; |
|
| 2422 | 2422 | } |
| 2423 | 2423 | } |
| 2424 | 2424 | |
| 2425 | - if(is_dir($plugin_path . 'lang')) |
|
| 2425 | + if (is_dir($plugin_path.'lang')) |
|
| 2426 | 2426 | { |
| 2427 | - $result->langPath = $plugin_path . 'lang'; |
|
| 2427 | + $result->langPath = $plugin_path.'lang'; |
|
| 2428 | 2428 | } |
| 2429 | 2429 | |
| 2430 | 2430 | return $result; |
@@ -2440,50 +2440,50 @@ discard block |
||
| 2440 | 2440 | static $loaded_plugins = array(); |
| 2441 | 2441 | |
| 2442 | 2442 | $self = self::getInstance(); |
| 2443 | - if($plugin_name == 'ui.datepicker') |
|
| 2443 | + if ($plugin_name == 'ui.datepicker') |
|
| 2444 | 2444 | { |
| 2445 | 2445 | $plugin_name = 'ui'; |
| 2446 | 2446 | } |
| 2447 | 2447 | |
| 2448 | - if($loaded_plugins[$plugin_name]) |
|
| 2448 | + if ($loaded_plugins[$plugin_name]) |
|
| 2449 | 2449 | { |
| 2450 | 2450 | return; |
| 2451 | 2451 | } |
| 2452 | 2452 | $loaded_plugins[$plugin_name] = TRUE; |
| 2453 | 2453 | |
| 2454 | - $plugin_path = './common/js/plugins/' . $plugin_name . '/'; |
|
| 2455 | - $info_file = $plugin_path . 'plugin.load'; |
|
| 2456 | - if(!is_readable($info_file)) |
|
| 2454 | + $plugin_path = './common/js/plugins/'.$plugin_name.'/'; |
|
| 2455 | + $info_file = $plugin_path.'plugin.load'; |
|
| 2456 | + if (!is_readable($info_file)) |
|
| 2457 | 2457 | { |
| 2458 | 2458 | return; |
| 2459 | 2459 | } |
| 2460 | 2460 | |
| 2461 | 2461 | $list = file($info_file); |
| 2462 | - foreach($list as $filename) |
|
| 2462 | + foreach ($list as $filename) |
|
| 2463 | 2463 | { |
| 2464 | 2464 | $filename = trim($filename); |
| 2465 | - if(!$filename) |
|
| 2465 | + if (!$filename) |
|
| 2466 | 2466 | { |
| 2467 | 2467 | continue; |
| 2468 | 2468 | } |
| 2469 | 2469 | |
| 2470 | - if(strncasecmp('./', $filename, 2) === 0) |
|
| 2470 | + if (strncasecmp('./', $filename, 2) === 0) |
|
| 2471 | 2471 | { |
| 2472 | 2472 | $filename = substr($filename, 2); |
| 2473 | 2473 | } |
| 2474 | - if(substr_compare($filename, '.js', -3) === 0) |
|
| 2474 | + if (substr_compare($filename, '.js', -3) === 0) |
|
| 2475 | 2475 | { |
| 2476 | - $self->loadFile(array($plugin_path . $filename, 'body', '', 0), TRUE); |
|
| 2476 | + $self->loadFile(array($plugin_path.$filename, 'body', '', 0), TRUE); |
|
| 2477 | 2477 | } |
| 2478 | - if(substr_compare($filename, '.css', -4) === 0) |
|
| 2478 | + if (substr_compare($filename, '.css', -4) === 0) |
|
| 2479 | 2479 | { |
| 2480 | - $self->loadFile(array($plugin_path . $filename, 'all', '', 0), TRUE); |
|
| 2480 | + $self->loadFile(array($plugin_path.$filename, 'all', '', 0), TRUE); |
|
| 2481 | 2481 | } |
| 2482 | 2482 | } |
| 2483 | 2483 | |
| 2484 | - if(is_dir($plugin_path . 'lang')) |
|
| 2484 | + if (is_dir($plugin_path.'lang')) |
|
| 2485 | 2485 | { |
| 2486 | - $self->loadLang($plugin_path . 'lang'); |
|
| 2486 | + $self->loadLang($plugin_path.'lang'); |
|
| 2487 | 2487 | } |
| 2488 | 2488 | } |
| 2489 | 2489 | |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | function addHtmlHeader($header) |
| 2497 | 2497 | { |
| 2498 | 2498 | $self = self::getInstance(); |
| 2499 | - $self->html_header .= "\n" . $header; |
|
| 2499 | + $self->html_header .= "\n".$header; |
|
| 2500 | 2500 | } |
| 2501 | 2501 | |
| 2502 | 2502 | function clearHtmlHeader() |
@@ -2548,7 +2548,7 @@ discard block |
||
| 2548 | 2548 | function addBodyHeader($header) |
| 2549 | 2549 | { |
| 2550 | 2550 | $self = self::getInstance(); |
| 2551 | - $self->body_header .= "\n" . $header; |
|
| 2551 | + $self->body_header .= "\n".$header; |
|
| 2552 | 2552 | } |
| 2553 | 2553 | |
| 2554 | 2554 | /** |
@@ -2570,7 +2570,7 @@ discard block |
||
| 2570 | 2570 | function addHtmlFooter($footer) |
| 2571 | 2571 | { |
| 2572 | 2572 | $self = self::getInstance(); |
| 2573 | - $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; |
|
| 2573 | + $self->html_footer .= ($self->Htmlfooter ? "\n" : '').$footer; |
|
| 2574 | 2574 | } |
| 2575 | 2575 | |
| 2576 | 2576 | /** |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | */ |
| 2592 | 2592 | function getConfigFile() |
| 2593 | 2593 | { |
| 2594 | - return _XE_PATH_ . 'files/config/db.config.php'; |
|
| 2594 | + return _XE_PATH_.'files/config/db.config.php'; |
|
| 2595 | 2595 | } |
| 2596 | 2596 | |
| 2597 | 2597 | /** |
@@ -2601,7 +2601,7 @@ discard block |
||
| 2601 | 2601 | */ |
| 2602 | 2602 | function getFTPConfigFile() |
| 2603 | 2603 | { |
| 2604 | - return _XE_PATH_ . 'files/config/ftp.config.php'; |
|
| 2604 | + return _XE_PATH_.'files/config/ftp.config.php'; |
|
| 2605 | 2605 | } |
| 2606 | 2606 | |
| 2607 | 2607 | /** |
@@ -2653,14 +2653,14 @@ discard block |
||
| 2653 | 2653 | $_path = explode('/', $path); |
| 2654 | 2654 | $_base = explode('/', $base_url); |
| 2655 | 2655 | |
| 2656 | - if(!$_base[count($_base) - 1]) |
|
| 2656 | + if (!$_base[count($_base) - 1]) |
|
| 2657 | 2657 | { |
| 2658 | 2658 | array_pop($_base); |
| 2659 | 2659 | } |
| 2660 | 2660 | |
| 2661 | - foreach($_xe as $idx => $dir) |
|
| 2661 | + foreach ($_xe as $idx => $dir) |
|
| 2662 | 2662 | { |
| 2663 | - if($_path[0] != $dir) |
|
| 2663 | + if ($_path[0] != $dir) |
|
| 2664 | 2664 | { |
| 2665 | 2665 | break; |
| 2666 | 2666 | } |
@@ -2668,9 +2668,9 @@ discard block |
||
| 2668 | 2668 | } |
| 2669 | 2669 | |
| 2670 | 2670 | $idx = count($_xe) - $idx - 1; |
| 2671 | - while($idx--) |
|
| 2671 | + while ($idx--) |
|
| 2672 | 2672 | { |
| 2673 | - if(count($_base) > 0) |
|
| 2673 | + if (count($_base) > 0) |
|
| 2674 | 2674 | { |
| 2675 | 2675 | array_shift($_base); |
| 2676 | 2676 | } |
@@ -2680,13 +2680,13 @@ discard block |
||
| 2680 | 2680 | } |
| 2681 | 2681 | } |
| 2682 | 2682 | |
| 2683 | - if(count($_base) > 0) |
|
| 2683 | + if (count($_base) > 0) |
|
| 2684 | 2684 | { |
| 2685 | 2685 | array_unshift($_path, join('/', $_base)); |
| 2686 | 2686 | } |
| 2687 | 2687 | |
| 2688 | - $path = '/' . join('/', $_path); |
|
| 2689 | - if(substr_compare($path, '/', -1) !== 0) |
|
| 2688 | + $path = '/'.join('/', $_path); |
|
| 2689 | + if (substr_compare($path, '/', -1) !== 0) |
|
| 2690 | 2690 | { |
| 2691 | 2691 | $path .= '/'; |
| 2692 | 2692 | } |
@@ -2701,13 +2701,13 @@ discard block |
||
| 2701 | 2701 | { |
| 2702 | 2702 | $self = self::getInstance(); |
| 2703 | 2703 | |
| 2704 | - if(!is_array($self->meta_tags)) |
|
| 2704 | + if (!is_array($self->meta_tags)) |
|
| 2705 | 2705 | { |
| 2706 | 2706 | $self->meta_tags = array(); |
| 2707 | 2707 | } |
| 2708 | 2708 | |
| 2709 | 2709 | $ret = array(); |
| 2710 | - foreach($self->meta_tags as $key => $val) |
|
| 2710 | + foreach ($self->meta_tags as $key => $val) |
|
| 2711 | 2711 | { |
| 2712 | 2712 | list($name, $is_http_equiv) = explode("\t", $key); |
| 2713 | 2713 | $ret[] = array('name' => $name, 'is_http_equiv' => $is_http_equiv, 'content' => $val); |
@@ -2727,7 +2727,7 @@ discard block |
||
| 2727 | 2727 | function addMetaTag($name, $content, $is_http_equiv = FALSE) |
| 2728 | 2728 | { |
| 2729 | 2729 | $self = self::getInstance(); |
| 2730 | - $self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content; |
|
| 2730 | + $self->meta_tags[$name."\t".($is_http_equiv ? '1' : '0')] = $content; |
|
| 2731 | 2731 | } |
| 2732 | 2732 | |
| 2733 | 2733 | } |
@@ -230,7 +230,9 @@ discard block |
||
| 230 | 230 | $this->loadDBInfo(); |
| 231 | 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)) { |
|
| 234 | + $whitelist = $this->db_info->sitelock_whitelist; |
|
| 235 | + } |
|
| 234 | 236 | |
| 235 | 237 | if(!IpFilter::filter($whitelist)) |
| 236 | 238 | { |
@@ -245,8 +247,7 @@ discard block |
||
| 245 | 247 | if(FileHandler::exists(_XE_PATH_ . 'common/tpl/sitelock.user.html')) |
| 246 | 248 | { |
| 247 | 249 | include _XE_PATH_ . 'common/tpl/sitelock.user.html'; |
| 248 | - } |
|
| 249 | - else |
|
| 250 | + } else |
|
| 250 | 251 | { |
| 251 | 252 | include _XE_PATH_ . 'common/tpl/sitelock.html'; |
| 252 | 253 | } |
@@ -303,8 +304,7 @@ discard block |
||
| 303 | 304 | { |
| 304 | 305 | setcookie('lang_type', $this->lang_type, $_SERVER['REQUEST_TIME'] + 3600 * 24 * 1000); |
| 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 | } |
@@ -341,7 +341,9 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if($sess = $_POST[session_name()]) session_id($sess); |
|
| 344 | + if($sess = $_POST[session_name()]) { |
|
| 345 | + session_id($sess); |
|
| 346 | + } |
|
| 345 | 347 | session_start(); |
| 346 | 348 | |
| 347 | 349 | // set authentication information in Context and session |
@@ -394,22 +396,21 @@ discard block |
||
| 394 | 396 | { |
| 395 | 397 | $url[] = $key . '[' . $k . ']=' . urlencode($v); |
| 396 | 398 | } |
| 397 | - } |
|
| 398 | - elseif($val) |
|
| 399 | + } elseif($val) |
|
| 399 | 400 | { |
| 400 | 401 | $url[] = $key . '=' . urlencode($val); |
| 401 | 402 | } |
| 402 | 403 | } |
| 403 | 404 | |
| 404 | 405 | $current_url = self::getRequestUri(); |
| 405 | - if($url) $current_url .= '?' . join('&', $url); |
|
| 406 | - } |
|
| 407 | - else |
|
| 406 | + if($url) { |
|
| 407 | + $current_url .= '?' . join('&', $url); |
|
| 408 | + } |
|
| 409 | + } else |
|
| 408 | 410 | { |
| 409 | 411 | $current_url = $this->getUrl(); |
| 410 | 412 | } |
| 411 | - } |
|
| 412 | - else |
|
| 413 | + } else |
|
| 413 | 414 | { |
| 414 | 415 | $current_url = self::getRequestUri(); |
| 415 | 416 | } |
@@ -492,18 +493,22 @@ discard block |
||
| 492 | 493 | $db_info->use_prepared_statements = 'Y'; |
| 493 | 494 | } |
| 494 | 495 | |
| 495 | - if(!$db_info->time_zone) |
|
| 496 | - $db_info->time_zone = date('O'); |
|
| 496 | + if(!$db_info->time_zone) { |
|
| 497 | + $db_info->time_zone = date('O'); |
|
| 498 | + } |
|
| 497 | 499 | $GLOBALS['_time_zone'] = $db_info->time_zone; |
| 498 | 500 | |
| 499 | - if($db_info->qmail_compatibility != 'Y') |
|
| 500 | - $db_info->qmail_compatibility = 'N'; |
|
| 501 | + if($db_info->qmail_compatibility != 'Y') { |
|
| 502 | + $db_info->qmail_compatibility = 'N'; |
|
| 503 | + } |
|
| 501 | 504 | $GLOBALS['_qmail_compatibility'] = $db_info->qmail_compatibility; |
| 502 | 505 | |
| 503 | - if(!$db_info->use_db_session) |
|
| 504 | - $db_info->use_db_session = 'N'; |
|
| 505 | - if(!$db_info->use_ssl) |
|
| 506 | - $db_info->use_ssl = 'none'; |
|
| 506 | + if(!$db_info->use_db_session) { |
|
| 507 | + $db_info->use_db_session = 'N'; |
|
| 508 | + } |
|
| 509 | + if(!$db_info->use_ssl) { |
|
| 510 | + $db_info->use_ssl = 'none'; |
|
| 511 | + } |
|
| 507 | 512 | $this->set('_use_ssl', $db_info->use_ssl); |
| 508 | 513 | |
| 509 | 514 | $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); |
@@ -620,8 +625,7 @@ discard block |
||
| 620 | 625 | $buff = FileHandler::readFile($orig_lang_file); |
| 621 | 626 | FileHandler::writeFile($selected_lang_file, $buff); |
| 622 | 627 | $lang_selected = self::loadLangSupported(); |
| 623 | - } |
|
| 624 | - else |
|
| 628 | + } else |
|
| 625 | 629 | { |
| 626 | 630 | $langs = file($selected_lang_file); |
| 627 | 631 | foreach($langs as $val) |
@@ -680,15 +684,16 @@ discard block |
||
| 680 | 684 | |
| 681 | 685 | $oModuleModel = getModel('module'); |
| 682 | 686 | $domain = $url_info['host'] . $url_info['path']; |
| 683 | - if(substr_compare($domain, '/', -1) === 0) $domain = substr($domain, 0, -1); |
|
| 687 | + if(substr_compare($domain, '/', -1) === 0) { |
|
| 688 | + $domain = substr($domain, 0, -1); |
|
| 689 | + } |
|
| 684 | 690 | $site_info = $oModuleModel->getSiteInfoByDomain($domain); |
| 685 | 691 | |
| 686 | 692 | if($site_info->site_srl) |
| 687 | 693 | { |
| 688 | 694 | $url_info['query'].= ($url_info['query'] ? '&' : '') . 'SSOID=' . urlencode(session_id()) . '&sig=' . urlencode(Password::createSignature(session_id())); |
| 689 | 695 | $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']); |
| 690 | - } |
|
| 691 | - else |
|
| 696 | + } else |
|
| 692 | 697 | { |
| 693 | 698 | $redirect_url = $url; |
| 694 | 699 | } |
@@ -697,8 +702,7 @@ discard block |
||
| 697 | 702 | return FALSE; |
| 698 | 703 | } |
| 699 | 704 | // for sites requesting SSO validation |
| 700 | - } |
|
| 701 | - else |
|
| 705 | + } else |
|
| 702 | 706 | { |
| 703 | 707 | // result handling : set session_name() |
| 704 | 708 | if($session_name = self::get('SSOID')) |
@@ -715,8 +719,7 @@ discard block |
||
| 715 | 719 | header('location:' . $url); |
| 716 | 720 | return FALSE; |
| 717 | 721 | // send SSO request |
| 718 | - } |
|
| 719 | - else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 722 | + } else if(!self::get('SSOID') && $_COOKIE['sso'] != md5(self::getRequestUri())) |
|
| 720 | 723 | { |
| 721 | 724 | setcookie('sso', md5(self::getRequestUri())); |
| 722 | 725 | $origin_url = self::getRequestUrl(); |
@@ -776,8 +779,7 @@ discard block |
||
| 776 | 779 | if($self->site_title) |
| 777 | 780 | { |
| 778 | 781 | $self->site_title .= ' - ' . $site_title; |
| 779 | - } |
|
| 780 | - else |
|
| 782 | + } else |
|
| 781 | 783 | { |
| 782 | 784 | $self->site_title = $site_title; |
| 783 | 785 | } |
@@ -877,8 +879,7 @@ discard block |
||
| 877 | 879 | { |
| 878 | 880 | $self->loaded_lang_files[] = $filename; |
| 879 | 881 | include($filename); |
| 880 | - } |
|
| 881 | - else |
|
| 882 | + } else |
|
| 882 | 883 | { |
| 883 | 884 | $self->_evalxmlLang($path); |
| 884 | 885 | } |
@@ -894,7 +895,9 @@ discard block |
||
| 894 | 895 | { |
| 895 | 896 | global $lang; |
| 896 | 897 | |
| 897 | - if(!$path) return; |
|
| 898 | + if(!$path) { |
|
| 899 | + return; |
|
| 900 | + } |
|
| 898 | 901 | |
| 899 | 902 | $_path = 'eval://' . $path; |
| 900 | 903 | |
@@ -926,7 +929,9 @@ discard block |
||
| 926 | 929 | */ |
| 927 | 930 | function _loadXmlLang($path) |
| 928 | 931 | { |
| 929 | - if(!$path) return; |
|
| 932 | + if(!$path) { |
|
| 933 | + return; |
|
| 934 | + } |
|
| 930 | 935 | |
| 931 | 936 | $oXmlLangParser = new XmlLangParser($path . ((substr_compare($path, '/', -1) !== 0) ? '/' : '') . 'lang.xml', $this->lang_type); |
| 932 | 937 | return $oXmlLangParser->compile(); |
@@ -940,7 +945,9 @@ discard block |
||
| 940 | 945 | */ |
| 941 | 946 | function _loadPhpLang($path) |
| 942 | 947 | { |
| 943 | - if(!$path) return; |
|
| 948 | + if(!$path) { |
|
| 949 | + return; |
|
| 950 | + } |
|
| 944 | 951 | |
| 945 | 952 | if(substr_compare($path, '/', -1) !== 0) |
| 946 | 953 | { |
@@ -1073,12 +1080,14 @@ discard block |
||
| 1073 | 1080 | static $flag = TRUE; |
| 1074 | 1081 | if($charset) |
| 1075 | 1082 | { |
| 1076 | - if(is_array($val)) |
|
| 1077 | - array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1078 | - else if($val && iconv($charset,$charset,$val)!=$val) $flag = FALSE; |
|
| 1079 | - else $flag = FALSE; |
|
| 1080 | - } |
|
| 1081 | - else |
|
| 1083 | + if(is_array($val)) { |
|
| 1084 | + array_walk($val,'Context::checkConvertFlag',$charset); |
|
| 1085 | + } else if($val && iconv($charset,$charset,$val)!=$val) { |
|
| 1086 | + $flag = FALSE; |
|
| 1087 | + } else { |
|
| 1088 | + $flag = FALSE; |
|
| 1089 | + } |
|
| 1090 | + } else |
|
| 1082 | 1091 | { |
| 1083 | 1092 | $return = $flag; |
| 1084 | 1093 | $flag = TRUE; |
@@ -1100,8 +1109,9 @@ discard block |
||
| 1100 | 1109 | if (is_array($val)) |
| 1101 | 1110 | { |
| 1102 | 1111 | array_walk($val,'Context::doConvertEncoding',$charset); |
| 1112 | + } else { |
|
| 1113 | + $val = iconv($charset,'UTF-8',$val); |
|
| 1103 | 1114 | } |
| 1104 | - else $val = iconv($charset,'UTF-8',$val); |
|
| 1105 | 1115 | } |
| 1106 | 1116 | |
| 1107 | 1117 | /** |
@@ -1112,7 +1122,9 @@ discard block |
||
| 1112 | 1122 | */ |
| 1113 | 1123 | function convertEncodingStr($str) |
| 1114 | 1124 | { |
| 1115 | - if(!$str) return null; |
|
| 1125 | + if(!$str) { |
|
| 1126 | + return null; |
|
| 1127 | + } |
|
| 1116 | 1128 | $obj = new stdClass(); |
| 1117 | 1129 | $obj->str = $str; |
| 1118 | 1130 | $obj = self::convertEncoding($obj); |
@@ -1225,16 +1237,13 @@ discard block |
||
| 1225 | 1237 | if($requestMethod == 'GET' && isset($_GET[$key])) |
| 1226 | 1238 | { |
| 1227 | 1239 | $set_to_vars = TRUE; |
| 1228 | - } |
|
| 1229 | - elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1240 | + } elseif($requestMethod == 'POST' && isset($_POST[$key])) |
|
| 1230 | 1241 | { |
| 1231 | 1242 | $set_to_vars = TRUE; |
| 1232 | - } |
|
| 1233 | - elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1243 | + } elseif($requestMethod == 'JS_CALLBACK' && (isset($_GET[$key]) || isset($_POST[$key]))) |
|
| 1234 | 1244 | { |
| 1235 | 1245 | $set_to_vars = TRUE; |
| 1236 | - } |
|
| 1237 | - else |
|
| 1246 | + } else |
|
| 1238 | 1247 | { |
| 1239 | 1248 | $set_to_vars = FALSE; |
| 1240 | 1249 | } |
@@ -1260,8 +1269,7 @@ discard block |
||
| 1260 | 1269 | return; |
| 1261 | 1270 | } |
| 1262 | 1271 | } |
| 1263 | - } |
|
| 1264 | - else if(is_array($val)) |
|
| 1272 | + } else if(is_array($val)) |
|
| 1265 | 1273 | { |
| 1266 | 1274 | foreach($val as $val2) |
| 1267 | 1275 | { |
@@ -1409,19 +1417,15 @@ discard block |
||
| 1409 | 1417 | if($key === 'page' || $key === 'cpage' || substr_compare($key, 'srl', -3) === 0) |
| 1410 | 1418 | { |
| 1411 | 1419 | $result[$k] = !preg_match('/^[0-9,]+$/', $v) ? (int) $v : $v; |
| 1412 | - } |
|
| 1413 | - elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1420 | + } elseif(in_array($key, array('mid','search_keyword','search_target','xe_validator_id'))) { |
|
| 1414 | 1421 | $result[$k] = escape($v, false); |
| 1415 | - } |
|
| 1416 | - elseif($key === 'vid') |
|
| 1422 | + } elseif($key === 'vid') |
|
| 1417 | 1423 | { |
| 1418 | 1424 | $result[$k] = urlencode($v); |
| 1419 | - } |
|
| 1420 | - elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1425 | + } elseif(stripos($key, 'XE_VALIDATOR', 0) === 0) |
|
| 1421 | 1426 | { |
| 1422 | 1427 | unset($result[$k]); |
| 1423 | - } |
|
| 1424 | - else |
|
| 1428 | + } else |
|
| 1425 | 1429 | { |
| 1426 | 1430 | $result[$k] = $v; |
| 1427 | 1431 | |
@@ -1430,8 +1434,7 @@ discard block |
||
| 1430 | 1434 | if (is_array($result[$k])) |
| 1431 | 1435 | { |
| 1432 | 1436 | array_walk_recursive($result[$k], function(&$val) { $val = stripslashes($val); }); |
| 1433 | - } |
|
| 1434 | - else |
|
| 1437 | + } else |
|
| 1435 | 1438 | { |
| 1436 | 1439 | $result[$k] = stripslashes($result[$k]); |
| 1437 | 1440 | } |
@@ -1440,8 +1443,7 @@ discard block |
||
| 1440 | 1443 | if(is_array($result[$k])) |
| 1441 | 1444 | { |
| 1442 | 1445 | array_walk_recursive($result[$k], function(&$val) { $val = trim($val); }); |
| 1443 | - } |
|
| 1444 | - else |
|
| 1446 | + } else |
|
| 1445 | 1447 | { |
| 1446 | 1448 | $result[$k] = trim($result[$k]); |
| 1447 | 1449 | } |
@@ -1491,8 +1493,7 @@ discard block |
||
| 1491 | 1493 | $val['name'] = htmlspecialchars($val['name'], ENT_COMPAT | ENT_HTML401, 'UTF-8', FALSE); |
| 1492 | 1494 | $this->set($key, $val, TRUE); |
| 1493 | 1495 | $this->is_uploaded = TRUE; |
| 1494 | - } |
|
| 1495 | - else |
|
| 1496 | + } else |
|
| 1496 | 1497 | { |
| 1497 | 1498 | $files = array(); |
| 1498 | 1499 | foreach ($tmp_name as $i => $j) |
@@ -1606,8 +1607,7 @@ discard block |
||
| 1606 | 1607 | if($site_module_info->domain && isSiteID($site_module_info->domain)) |
| 1607 | 1608 | { |
| 1608 | 1609 | $vid = $site_module_info->domain; |
| 1609 | - } |
|
| 1610 | - else |
|
| 1610 | + } else |
|
| 1611 | 1611 | { |
| 1612 | 1612 | $domain = $site_module_info->domain; |
| 1613 | 1613 | } |
@@ -1624,8 +1624,7 @@ discard block |
||
| 1624 | 1624 | if($domain_info['host'] . $domain_info['path'] == $current_info['host'] . $current_info['path']) |
| 1625 | 1625 | { |
| 1626 | 1626 | unset($domain); |
| 1627 | - } |
|
| 1628 | - else |
|
| 1627 | + } else |
|
| 1629 | 1628 | { |
| 1630 | 1629 | $domain = preg_replace('/^(http|https):\/\//i', '', trim($domain)); |
| 1631 | 1630 | if(substr_compare($domain, '/', -1) !== 0) |
@@ -1645,23 +1644,35 @@ discard block |
||
| 1645 | 1644 | { |
| 1646 | 1645 | array_shift($args_list); |
| 1647 | 1646 | } |
| 1648 | - } |
|
| 1649 | - elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1647 | + } elseif($_SERVER['REQUEST_METHOD'] == 'GET') |
|
| 1650 | 1648 | { |
| 1651 | 1649 | // Otherwise, make GET variables into array |
| 1652 | 1650 | $get_vars = get_object_vars($self->get_vars); |
| 1653 | - } |
|
| 1654 | - else |
|
| 1651 | + } else |
|
| 1655 | 1652 | { |
| 1656 | - if(!!$self->get_vars->module) $get_vars['module'] = $self->get_vars->module; |
|
| 1657 | - if(!!$self->get_vars->mid) $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | - if(!!$self->get_vars->act) $get_vars['act'] = $self->get_vars->act; |
|
| 1659 | - if(!!$self->get_vars->page) $get_vars['page'] = $self->get_vars->page; |
|
| 1660 | - if(!!$self->get_vars->search_target) $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1661 | - if(!!$self->get_vars->search_keyword) $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1653 | + if(!!$self->get_vars->module) { |
|
| 1654 | + $get_vars['module'] = $self->get_vars->module; |
|
| 1655 | + } |
|
| 1656 | + if(!!$self->get_vars->mid) { |
|
| 1657 | + $get_vars['mid'] = $self->get_vars->mid; |
|
| 1658 | + } |
|
| 1659 | + if(!!$self->get_vars->act) { |
|
| 1660 | + $get_vars['act'] = $self->get_vars->act; |
|
| 1661 | + } |
|
| 1662 | + if(!!$self->get_vars->page) { |
|
| 1663 | + $get_vars['page'] = $self->get_vars->page; |
|
| 1664 | + } |
|
| 1665 | + if(!!$self->get_vars->search_target) { |
|
| 1666 | + $get_vars['search_target'] = $self->get_vars->search_target; |
|
| 1667 | + } |
|
| 1668 | + if(!!$self->get_vars->search_keyword) { |
|
| 1669 | + $get_vars['search_keyword'] = $self->get_vars->search_keyword; |
|
| 1670 | + } |
|
| 1662 | 1671 | if($get_vars['act'] == 'IS') |
| 1663 | 1672 | { |
| 1664 | - if(!!$self->get_vars->is_keyword) $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1673 | + if(!!$self->get_vars->is_keyword) { |
|
| 1674 | + $get_vars['is_keyword'] = $self->get_vars->is_keyword; |
|
| 1675 | + } |
|
| 1665 | 1676 | } |
| 1666 | 1677 | } |
| 1667 | 1678 | |
@@ -1686,8 +1697,7 @@ discard block |
||
| 1686 | 1697 | if($vid) |
| 1687 | 1698 | { |
| 1688 | 1699 | $get_vars['vid'] = $vid; |
| 1689 | - } |
|
| 1690 | - else |
|
| 1700 | + } else |
|
| 1691 | 1701 | { |
| 1692 | 1702 | unset($get_vars['vid']); |
| 1693 | 1703 | } |
@@ -1759,8 +1769,7 @@ discard block |
||
| 1759 | 1769 | { |
| 1760 | 1770 | $queries[] = $key . '[' . $k . ']=' . urlencode($v); |
| 1761 | 1771 | } |
| 1762 | - } |
|
| 1763 | - elseif(!is_array($val)) |
|
| 1772 | + } elseif(!is_array($val)) |
|
| 1764 | 1773 | { |
| 1765 | 1774 | $queries[] = $key . '=' . urlencode($val); |
| 1766 | 1775 | } |
@@ -1778,25 +1787,23 @@ discard block |
||
| 1778 | 1787 | { |
| 1779 | 1788 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1780 | 1789 | // optional SSL use |
| 1781 | - } |
|
| 1782 | - elseif($_use_ssl == 'optional') |
|
| 1790 | + } elseif($_use_ssl == 'optional') |
|
| 1783 | 1791 | { |
| 1784 | 1792 | $ssl_mode = (($self->get('module') === 'admin') || ($get_vars['module'] === 'admin') || (isset($get_vars['act']) && $self->isExistsSSLAction($get_vars['act']))) ? ENFORCE_SSL : RELEASE_SSL; |
| 1785 | 1793 | $query = $self->getRequestUri($ssl_mode, $domain) . $query; |
| 1786 | 1794 | // no SSL |
| 1787 | - } |
|
| 1788 | - else |
|
| 1795 | + } else |
|
| 1789 | 1796 | { |
| 1790 | 1797 | // currently on SSL but target is not based on SSL |
| 1791 | 1798 | if($_SERVER['HTTPS'] == 'on') |
| 1792 | 1799 | { |
| 1793 | 1800 | $query = $self->getRequestUri(ENFORCE_SSL, $domain) . $query; |
| 1794 | - } |
|
| 1795 | - else if($domain) // if $domain is set |
|
| 1801 | + } else if($domain) { |
|
| 1802 | + // if $domain is set |
|
| 1796 | 1803 | { |
| 1797 | 1804 | $query = $self->getRequestUri(FOLLOW_REQUEST_SSL, $domain) . $query; |
| 1798 | 1805 | } |
| 1799 | - else |
|
| 1806 | + } else |
|
| 1800 | 1807 | { |
| 1801 | 1808 | $query = getScriptPath() . $query; |
| 1802 | 1809 | } |
@@ -1853,8 +1860,7 @@ discard block |
||
| 1853 | 1860 | if($domain) |
| 1854 | 1861 | { |
| 1855 | 1862 | $domain_key = md5($domain); |
| 1856 | - } |
|
| 1857 | - else |
|
| 1863 | + } else |
|
| 1858 | 1864 | { |
| 1859 | 1865 | $domain_key = 'default'; |
| 1860 | 1866 | } |
@@ -1883,8 +1889,7 @@ discard block |
||
| 1883 | 1889 | { |
| 1884 | 1890 | $target_url.= '/'; |
| 1885 | 1891 | } |
| 1886 | - } |
|
| 1887 | - else |
|
| 1892 | + } else |
|
| 1888 | 1893 | { |
| 1889 | 1894 | $target_url = $_SERVER['HTTP_HOST'] . getScriptPath(); |
| 1890 | 1895 | } |
@@ -1902,20 +1907,17 @@ discard block |
||
| 1902 | 1907 | if($port && $port != 443) |
| 1903 | 1908 | { |
| 1904 | 1909 | $url_info['port'] = $port; |
| 1905 | - } |
|
| 1906 | - elseif($url_info['port'] == 443) |
|
| 1910 | + } elseif($url_info['port'] == 443) |
|
| 1907 | 1911 | { |
| 1908 | 1912 | unset($url_info['port']); |
| 1909 | 1913 | } |
| 1910 | - } |
|
| 1911 | - else |
|
| 1914 | + } else |
|
| 1912 | 1915 | { |
| 1913 | 1916 | $port = self::get('_http_port'); |
| 1914 | 1917 | if($port && $port != 80) |
| 1915 | 1918 | { |
| 1916 | 1919 | $url_info['port'] = $port; |
| 1917 | - } |
|
| 1918 | - elseif($url_info['port'] == 80) |
|
| 1920 | + } elseif($url_info['port'] == 80) |
|
| 1919 | 1921 | { |
| 1920 | 1922 | unset($url_info['port']); |
| 1921 | 1923 | } |
@@ -2152,8 +2154,7 @@ discard block |
||
| 2152 | 2154 | if(strpos($file, './') === 0) |
| 2153 | 2155 | { |
| 2154 | 2156 | $file = $script_path . substr($file, 2); |
| 2155 | - } |
|
| 2156 | - elseif(strpos($file, '../') === 0) |
|
| 2157 | + } elseif(strpos($file, '../') === 0) |
|
| 2157 | 2158 | { |
| 2158 | 2159 | $file = self::normalizeFilePath($script_path . $file); |
| 2159 | 2160 | } |
@@ -2415,8 +2416,7 @@ discard block |
||
| 2415 | 2416 | if(substr_compare($filename, '.js', -3) === 0) |
| 2416 | 2417 | { |
| 2417 | 2418 | $result->jsList[] = $plugin_path . $filename; |
| 2418 | - } |
|
| 2419 | - elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2419 | + } elseif(substr_compare($filename, '.css', -4) === 0) |
|
| 2420 | 2420 | { |
| 2421 | 2421 | $result->cssList[] = $plugin_path . $filename; |
| 2422 | 2422 | } |
@@ -2673,8 +2673,7 @@ discard block |
||
| 2673 | 2673 | if(count($_base) > 0) |
| 2674 | 2674 | { |
| 2675 | 2675 | array_shift($_base); |
| 2676 | - } |
|
| 2677 | - else |
|
| 2676 | + } else |
|
| 2678 | 2677 | { |
| 2679 | 2678 | array_unshift($_base, '..'); |
| 2680 | 2679 | } |
@@ -470,7 +470,7 @@ |
||
| 470 | 470 | * set query debug log |
| 471 | 471 | * @param array $log values set query debug |
| 472 | 472 | * @return void |
| 473 | - */ |
|
| 473 | + */ |
|
| 474 | 474 | function setQueryLog($log) |
| 475 | 475 | { |
| 476 | 476 | $GLOBALS['__db_queries__'][] = $log; |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | /** |
| 492 | 492 | * Returns object of error info |
| 493 | - * @return object object of error |
|
| 493 | + * @return BaseObject object of error |
|
| 494 | 494 | */ |
| 495 | 495 | function getError() |
| 496 | 496 | { |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | * Returns counter cache data |
| 668 | 668 | * @param array|string $tables tables to get data |
| 669 | 669 | * @param string $condition condition to get data |
| 670 | - * @return int count of cache data |
|
| 670 | + * @return boolean count of cache data |
|
| 671 | 671 | */ |
| 672 | 672 | function getCountCache($tables, $condition) |
| 673 | 673 | { |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | * @param array|string $tables tables to save data |
| 728 | 728 | * @param string $condition condition to save data |
| 729 | 729 | * @param int $count count of cache data to save |
| 730 | - * @return void |
|
| 730 | + * @return boolean |
|
| 731 | 731 | */ |
| 732 | 732 | function putCountCache($tables, $condition, $count = 0) |
| 733 | 733 | { |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | |
| 810 | 810 | /** |
| 811 | 811 | * Return select query string |
| 812 | - * @param object $query |
|
| 812 | + * @param BaseObject $query |
|
| 813 | 813 | * @param boolean $with_values |
| 814 | 814 | * @return string |
| 815 | 815 | */ |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | |
| 904 | 904 | /** |
| 905 | 905 | * Return delete query string |
| 906 | - * @param object $query |
|
| 906 | + * @param BaseObject $query |
|
| 907 | 907 | * @param boolean $with_values |
| 908 | 908 | * @param boolean $with_priority |
| 909 | 909 | * @return string |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | /** |
| 937 | 937 | * Return update query string |
| 938 | - * @param object $query |
|
| 938 | + * @param BaseObject $query |
|
| 939 | 939 | * @param boolean $with_values |
| 940 | 940 | * @param boolean $with_priority |
| 941 | 941 | * @return string |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | /** |
| 969 | 969 | * Return insert query string |
| 970 | - * @param object $query |
|
| 970 | + * @param BaseObject $query |
|
| 971 | 971 | * @param boolean $with_values |
| 972 | 972 | * @param boolean $with_priority |
| 973 | 973 | * @return string |
@@ -1238,7 +1238,7 @@ discard block |
||
| 1238 | 1238 | * DB Connect |
| 1239 | 1239 | * this method is protected |
| 1240 | 1240 | * @param array $connection |
| 1241 | - * @return void |
|
| 1241 | + * @return resource |
|
| 1242 | 1242 | */ |
| 1243 | 1243 | function __connect($connection) |
| 1244 | 1244 | { |
@@ -318,8 +318,7 @@ discard block |
||
| 318 | 318 | if(!isset($this->priority_dbms[$a->db_type])) |
| 319 | 319 | { |
| 320 | 320 | $priority_a = 0; |
| 321 | - } |
|
| 322 | - else |
|
| 321 | + } else |
|
| 323 | 322 | { |
| 324 | 323 | $priority_a = $this->priority_dbms[$a->db_type]; |
| 325 | 324 | } |
@@ -327,8 +326,7 @@ discard block |
||
| 327 | 326 | if(!isset($this->priority_dbms[$b->db_type])) |
| 328 | 327 | { |
| 329 | 328 | $priority_b = 0; |
| 330 | - } |
|
| 331 | - else |
|
| 329 | + } else |
|
| 332 | 330 | { |
| 333 | 331 | $priority_b = $this->priority_dbms[$b->db_type]; |
| 334 | 332 | } |
@@ -362,8 +360,7 @@ discard block |
||
| 362 | 360 | if($type == 'master') |
| 363 | 361 | { |
| 364 | 362 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
| 365 | - } |
|
| 366 | - else |
|
| 363 | + } else |
|
| 367 | 364 | { |
| 368 | 365 | return $this->slave_db[$indx]["is_connected"] ? TRUE : FALSE; |
| 369 | 366 | } |
@@ -441,8 +438,7 @@ discard block |
||
| 441 | 438 | $buff[] = print_r($log, TRUE); |
| 442 | 439 | @file_put_contents($debug_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
| 443 | 440 | } |
| 444 | - } |
|
| 445 | - else |
|
| 441 | + } else |
|
| 446 | 442 | { |
| 447 | 443 | $log['result'] = 'Success'; |
| 448 | 444 | } |
@@ -531,8 +527,7 @@ discard block |
||
| 531 | 527 | $target = 'modules'; |
| 532 | 528 | $module = $id_args[0]; |
| 533 | 529 | $id = $id_args[1]; |
| 534 | - } |
|
| 535 | - elseif(count($id_args) == 3) |
|
| 530 | + } elseif(count($id_args) == 3) |
|
| 536 | 531 | { |
| 537 | 532 | $target = $id_args[0]; |
| 538 | 533 | $typeList = array('addons' => 1, 'widgets' => 1); |
@@ -606,7 +601,9 @@ discard block |
||
| 606 | 601 | { |
| 607 | 602 | global $lang; |
| 608 | 603 | |
| 609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
| 604 | + if(!in_array($type, array('master','slave'))) { |
|
| 605 | + $type = 'slave'; |
|
| 606 | + } |
|
| 610 | 607 | |
| 611 | 608 | if(!file_exists($cache_file)) |
| 612 | 609 | { |
@@ -652,8 +649,7 @@ discard block |
||
| 652 | 649 | if($this->isError()) |
| 653 | 650 | { |
| 654 | 651 | $output = $this->getError(); |
| 655 | - } |
|
| 656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 652 | + } else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 657 | 653 | { |
| 658 | 654 | $output = new BaseObject(); |
| 659 | 655 | } |
@@ -1068,8 +1064,7 @@ discard block |
||
| 1068 | 1064 | if($type == 'master') |
| 1069 | 1065 | { |
| 1070 | 1066 | $connection = &$this->master_db; |
| 1071 | - } |
|
| 1072 | - else |
|
| 1067 | + } else |
|
| 1073 | 1068 | { |
| 1074 | 1069 | $connection = &$this->slave_db[$indx]; |
| 1075 | 1070 | } |
@@ -1164,8 +1159,7 @@ discard block |
||
| 1164 | 1159 | { |
| 1165 | 1160 | $this->transaction_started = FALSE; |
| 1166 | 1161 | $this->transactionNestedLevel = 0; |
| 1167 | - } |
|
| 1168 | - else |
|
| 1162 | + } else |
|
| 1169 | 1163 | { |
| 1170 | 1164 | $this->transactionNestedLevel--; |
| 1171 | 1165 | } |
@@ -1225,8 +1219,7 @@ discard block |
||
| 1225 | 1219 | ) |
| 1226 | 1220 | { |
| 1227 | 1221 | $this->slave_db[0] = &$this->master_db; |
| 1228 | - } |
|
| 1229 | - else |
|
| 1222 | + } else |
|
| 1230 | 1223 | { |
| 1231 | 1224 | $this->slave_db = $db_info->slave_db; |
| 1232 | 1225 | } |
@@ -1279,8 +1272,7 @@ discard block |
||
| 1279 | 1272 | if($type == 'master') |
| 1280 | 1273 | { |
| 1281 | 1274 | $connection = &$this->master_db; |
| 1282 | - } |
|
| 1283 | - else |
|
| 1275 | + } else |
|
| 1284 | 1276 | { |
| 1285 | 1277 | $connection = &$this->slave_db[$indx]; |
| 1286 | 1278 | } |
@@ -141,24 +141,24 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | function getInstance($db_type = NULL) |
| 143 | 143 | { |
| 144 | - if(!$db_type) |
|
| 144 | + if (!$db_type) |
|
| 145 | 145 | { |
| 146 | 146 | $db_type = Context::getDBType(); |
| 147 | 147 | } |
| 148 | - if(!$db_type && Context::isInstalled()) |
|
| 148 | + if (!$db_type && Context::isInstalled()) |
|
| 149 | 149 | { |
| 150 | 150 | return new BaseObject(-1, 'msg_db_not_setted'); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if(!isset($GLOBALS['__DB__'])) |
|
| 153 | + if (!isset($GLOBALS['__DB__'])) |
|
| 154 | 154 | { |
| 155 | 155 | $GLOBALS['__DB__'] = array(); |
| 156 | 156 | } |
| 157 | - if(!isset($GLOBALS['__DB__'][$db_type])) |
|
| 157 | + if (!isset($GLOBALS['__DB__'][$db_type])) |
|
| 158 | 158 | { |
| 159 | - $class_name = 'DB' . ucfirst($db_type); |
|
| 160 | - $class_file = _XE_PATH_ . "classes/db/$class_name.class.php"; |
|
| 161 | - if(!file_exists($class_file)) |
|
| 159 | + $class_name = 'DB'.ucfirst($db_type); |
|
| 160 | + $class_file = _XE_PATH_."classes/db/$class_name.class.php"; |
|
| 161 | + if (!file_exists($class_file)) |
|
| 162 | 162 | { |
| 163 | 163 | return new BaseObject(-1, 'msg_db_not_setted'); |
| 164 | 164 | } |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | function __construct() |
| 189 | 189 | { |
| 190 | - $this->count_cache_path = _XE_PATH_ . $this->count_cache_path; |
|
| 191 | - $this->cache_file = _XE_PATH_ . $this->cache_file; |
|
| 190 | + $this->count_cache_path = _XE_PATH_.$this->count_cache_path; |
|
| 191 | + $this->cache_file = _XE_PATH_.$this->cache_file; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -210,18 +210,18 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | public static function getEnableList() |
| 212 | 212 | { |
| 213 | - if(!self::$supported_list) |
|
| 213 | + if (!self::$supported_list) |
|
| 214 | 214 | { |
| 215 | 215 | $oDB = new DB(); |
| 216 | 216 | self::$supported_list = $oDB->_getSupportedList(); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $enableList = array(); |
| 220 | - if(is_array(self::$supported_list)) |
|
| 220 | + if (is_array(self::$supported_list)) |
|
| 221 | 221 | { |
| 222 | - foreach(self::$supported_list AS $key => $value) |
|
| 222 | + foreach (self::$supported_list AS $key => $value) |
|
| 223 | 223 | { |
| 224 | - if($value->enable) |
|
| 224 | + if ($value->enable) |
|
| 225 | 225 | { |
| 226 | 226 | $enableList[] = $value; |
| 227 | 227 | } |
@@ -237,18 +237,18 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public static function getDisableList() |
| 239 | 239 | { |
| 240 | - if(!self::$supported_list) |
|
| 240 | + if (!self::$supported_list) |
|
| 241 | 241 | { |
| 242 | 242 | $oDB = new DB(); |
| 243 | 243 | self::$supported_list = $oDB->_getSupportedList(); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | $disableList = array(); |
| 247 | - if(is_array(self::$supported_list)) |
|
| 247 | + if (is_array(self::$supported_list)) |
|
| 248 | 248 | { |
| 249 | - foreach(self::$supported_list AS $key => $value) |
|
| 249 | + foreach (self::$supported_list AS $key => $value) |
|
| 250 | 250 | { |
| 251 | - if(!$value->enable) |
|
| 251 | + if (!$value->enable) |
|
| 252 | 252 | { |
| 253 | 253 | $disableList[] = $value; |
| 254 | 254 | } |
@@ -265,24 +265,24 @@ discard block |
||
| 265 | 265 | function _getSupportedList() |
| 266 | 266 | { |
| 267 | 267 | static $get_supported_list = ''; |
| 268 | - if(is_array($get_supported_list)) |
|
| 268 | + if (is_array($get_supported_list)) |
|
| 269 | 269 | { |
| 270 | 270 | self::$supported_list = $get_supported_list; |
| 271 | 271 | return self::$supported_list; |
| 272 | 272 | } |
| 273 | 273 | $get_supported_list = array(); |
| 274 | - $db_classes_path = _XE_PATH_ . "classes/db/"; |
|
| 274 | + $db_classes_path = _XE_PATH_."classes/db/"; |
|
| 275 | 275 | $filter = "/^DB([^\.]+)\.class\.php/i"; |
| 276 | 276 | $supported_list = FileHandler::readDir($db_classes_path, $filter, TRUE); |
| 277 | 277 | |
| 278 | 278 | // after creating instance of class, check is supported |
| 279 | - for($i = 0; $i < count($supported_list); $i++) |
|
| 279 | + for ($i = 0; $i < count($supported_list); $i++) |
|
| 280 | 280 | { |
| 281 | 281 | $db_type = $supported_list[$i]; |
| 282 | 282 | |
| 283 | 283 | $class_name = sprintf("DB%s%s", strtoupper(substr($db_type, 0, 1)), strtolower(substr($db_type, 1))); |
| 284 | - $class_file = sprintf(_XE_PATH_ . "classes/db/%s.class.php", $class_name); |
|
| 285 | - if(!file_exists($class_file)) |
|
| 284 | + $class_file = sprintf(_XE_PATH_."classes/db/%s.class.php", $class_name); |
|
| 285 | + if (!file_exists($class_file)) |
|
| 286 | 286 | { |
| 287 | 287 | continue; |
| 288 | 288 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | require_once($class_file); |
| 292 | 292 | $oDB = new $class_name(FALSE); |
| 293 | 293 | |
| 294 | - if(!$oDB) |
|
| 294 | + if (!$oDB) |
|
| 295 | 295 | { |
| 296 | 296 | continue; |
| 297 | 297 | } |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | function _sortDBMS($a, $b) |
| 317 | 317 | { |
| 318 | - if(!isset($this->priority_dbms[$a->db_type])) |
|
| 318 | + if (!isset($this->priority_dbms[$a->db_type])) |
|
| 319 | 319 | { |
| 320 | 320 | $priority_a = 0; |
| 321 | 321 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $priority_a = $this->priority_dbms[$a->db_type]; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if(!isset($this->priority_dbms[$b->db_type])) |
|
| 327 | + if (!isset($this->priority_dbms[$b->db_type])) |
|
| 328 | 328 | { |
| 329 | 329 | $priority_b = 0; |
| 330 | 330 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $priority_b = $this->priority_dbms[$b->db_type]; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if($priority_a == $priority_b) |
|
| 336 | + if ($priority_a == $priority_b) |
|
| 337 | 337 | { |
| 338 | 338 | return 0; |
| 339 | 339 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | function isConnected($type = 'master', $indx = 0) |
| 361 | 361 | { |
| 362 | - if($type == 'master') |
|
| 362 | + if ($type == 'master') |
|
| 363 | 363 | { |
| 364 | 364 | return $this->master_db["is_connected"] ? TRUE : FALSE; |
| 365 | 365 | } |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | */ |
| 389 | 389 | function actFinish() |
| 390 | 390 | { |
| 391 | - if(!$this->query) |
|
| 391 | + if (!$this->query) |
|
| 392 | 392 | { |
| 393 | 393 | return; |
| 394 | 394 | } |
@@ -409,14 +409,14 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | $bt = version_compare(PHP_VERSION, '5.3.6', '>=') ? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) : debug_backtrace(); |
| 411 | 411 | |
| 412 | - foreach($bt as $no => $call) |
|
| 412 | + foreach ($bt as $no => $call) |
|
| 413 | 413 | { |
| 414 | - if($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
| 414 | + if ($call['function'] == 'executeQuery' || $call['function'] == 'executeQueryArray') |
|
| 415 | 415 | { |
| 416 | 416 | $call_no = $no; |
| 417 | 417 | $call_no++; |
| 418 | 418 | $log['called_file'] = $bt[$call_no]['file'].':'.$bt[$call_no]['line']; |
| 419 | - $log['called_file'] = str_replace(_XE_PATH_ , '', $log['called_file']); |
|
| 419 | + $log['called_file'] = str_replace(_XE_PATH_, '', $log['called_file']); |
|
| 420 | 420 | $call_no++; |
| 421 | 421 | $log['called_method'] = $bt[$call_no]['class'].$bt[$call_no]['type'].$bt[$call_no]['function']; |
| 422 | 422 | break; |
@@ -424,22 +424,22 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | // leave error log if an error occured (if __DEBUG_DB_OUTPUT__ is defined) |
| 427 | - if($this->isError()) |
|
| 427 | + if ($this->isError()) |
|
| 428 | 428 | { |
| 429 | 429 | $log['result'] = 'Failed'; |
| 430 | 430 | $log['errno'] = $this->errno; |
| 431 | 431 | $log['errstr'] = $this->errstr; |
| 432 | 432 | |
| 433 | - if(__DEBUG_DB_OUTPUT__ == 1) |
|
| 433 | + if (__DEBUG_DB_OUTPUT__ == 1) |
|
| 434 | 434 | { |
| 435 | - $debug_file = _XE_PATH_ . "files/_debug_db_query.php"; |
|
| 435 | + $debug_file = _XE_PATH_."files/_debug_db_query.php"; |
|
| 436 | 436 | $buff = array(); |
| 437 | - if(!file_exists($debug_file)) |
|
| 437 | + if (!file_exists($debug_file)) |
|
| 438 | 438 | { |
| 439 | - $buff[] = '<?php exit(); ?' . '>'; |
|
| 439 | + $buff[] = '<?php exit(); ?'.'>'; |
|
| 440 | 440 | } |
| 441 | 441 | $buff[] = print_r($log, TRUE); |
| 442 | - @file_put_contents($debug_file, implode("\n", $buff) . "\n\n", FILE_APPEND|LOCK_EX); |
|
| 442 | + @file_put_contents($debug_file, implode("\n", $buff)."\n\n", FILE_APPEND | LOCK_EX); |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | else |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $log_args = new stdClass; |
| 453 | 453 | $log_args->query = $this->query; |
| 454 | 454 | $log_args->query_id = $this->query_id; |
| 455 | - $log_args->caller = $log['called_method'] . '() in ' . $log['called_file']; |
|
| 455 | + $log_args->caller = $log['called_method'].'() in '.$log['called_file']; |
|
| 456 | 456 | $log_args->connection = $log['connection']; |
| 457 | 457 | writeSlowlog('query', $elapsed_time, $log_args); |
| 458 | 458 | } |
@@ -510,11 +510,11 @@ discard block |
||
| 510 | 510 | { |
| 511 | 511 | static $cache_file = array(); |
| 512 | 512 | |
| 513 | - if(!$query_id) |
|
| 513 | + if (!$query_id) |
|
| 514 | 514 | { |
| 515 | 515 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 516 | 516 | } |
| 517 | - if(!$this->db_type) |
|
| 517 | + if (!$this->db_type) |
|
| 518 | 518 | { |
| 519 | 519 | return; |
| 520 | 520 | } |
@@ -523,20 +523,20 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | $this->query_id = $query_id; |
| 525 | 525 | |
| 526 | - if(!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
| 526 | + if (!isset($cache_file[$query_id]) || !file_exists($cache_file[$query_id])) |
|
| 527 | 527 | { |
| 528 | 528 | $id_args = explode('.', $query_id); |
| 529 | - if(count($id_args) == 2) |
|
| 529 | + if (count($id_args) == 2) |
|
| 530 | 530 | { |
| 531 | 531 | $target = 'modules'; |
| 532 | 532 | $module = $id_args[0]; |
| 533 | 533 | $id = $id_args[1]; |
| 534 | 534 | } |
| 535 | - elseif(count($id_args) == 3) |
|
| 535 | + elseif (count($id_args) == 3) |
|
| 536 | 536 | { |
| 537 | 537 | $target = $id_args[0]; |
| 538 | 538 | $typeList = array('addons' => 1, 'widgets' => 1); |
| 539 | - if(!isset($typeList[$target])) |
|
| 539 | + if (!isset($typeList[$target])) |
|
| 540 | 540 | { |
| 541 | 541 | $this->actDBClassFinish(); |
| 542 | 542 | return; |
@@ -544,14 +544,14 @@ discard block |
||
| 544 | 544 | $module = $id_args[1]; |
| 545 | 545 | $id = $id_args[2]; |
| 546 | 546 | } |
| 547 | - if(!$target || !$module || !$id) |
|
| 547 | + if (!$target || !$module || !$id) |
|
| 548 | 548 | { |
| 549 | 549 | $this->actDBClassFinish(); |
| 550 | 550 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | $xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id); |
| 554 | - if(!file_exists($xml_file)) |
|
| 554 | + if (!file_exists($xml_file)) |
|
| 555 | 555 | { |
| 556 | 556 | $this->actDBClassFinish(); |
| 557 | 557 | return new BaseObject(-1, 'msg_invalid_queryid'); |
@@ -579,13 +579,13 @@ discard block |
||
| 579 | 579 | $cache_file = sprintf('%s%s%s.%s.%s.cache.php', _XE_PATH_, $this->cache_file, $query_id, __ZBXE_VERSION__, $this->db_type); |
| 580 | 580 | |
| 581 | 581 | $cache_time = -1; |
| 582 | - if(file_exists($cache_file)) |
|
| 582 | + if (file_exists($cache_file)) |
|
| 583 | 583 | { |
| 584 | 584 | $cache_time = filemtime($cache_file); |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | // if there is no cache file or is not new, find original xml query file and parse it |
| 588 | - if($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_ . 'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_ . 'classes/xml/XmlQueryParser.class.php')) |
|
| 588 | + if ($cache_time < filemtime($xml_file) || $cache_time < filemtime(_XE_PATH_.'classes/db/DB.class.php') || $cache_time < filemtime(_XE_PATH_.'classes/xml/XmlQueryParser.class.php')) |
|
| 589 | 589 | { |
| 590 | 590 | $oParser = new XmlQueryParser(); |
| 591 | 591 | $oParser->parse($query_id, $xml_file, $cache_file); |
@@ -606,27 +606,27 @@ discard block |
||
| 606 | 606 | { |
| 607 | 607 | global $lang; |
| 608 | 608 | |
| 609 | - if(!in_array($type, array('master','slave'))) $type = 'slave'; |
|
| 609 | + if (!in_array($type, array('master', 'slave'))) $type = 'slave'; |
|
| 610 | 610 | |
| 611 | - if(!file_exists($cache_file)) |
|
| 611 | + if (!file_exists($cache_file)) |
|
| 612 | 612 | { |
| 613 | 613 | return new BaseObject(-1, 'msg_invalid_queryid'); |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - if($source_args) |
|
| 616 | + if ($source_args) |
|
| 617 | 617 | { |
| 618 | 618 | $args = clone $source_args; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | $output = include($cache_file); |
| 622 | 622 | |
| 623 | - if((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
| 623 | + if ((is_a($output, 'BaseObject') || is_subclass_of($output, 'BaseObject')) && !$output->toBool()) |
|
| 624 | 624 | { |
| 625 | 625 | return $output; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // execute appropriate query |
| 629 | - switch($output->getAction()) |
|
| 629 | + switch ($output->getAction()) |
|
| 630 | 630 | { |
| 631 | 631 | case 'insert' : |
| 632 | 632 | case 'insert-select' : |
@@ -649,11 +649,11 @@ discard block |
||
| 649 | 649 | break; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if($this->isError()) |
|
| 652 | + if ($this->isError()) |
|
| 653 | 653 | { |
| 654 | 654 | $output = $this->getError(); |
| 655 | 655 | } |
| 656 | - else if(!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 656 | + else if (!is_a($output, 'BaseObject') && !is_subclass_of($output, 'BaseObject')) |
|
| 657 | 657 | { |
| 658 | 658 | $output = new BaseObject(); |
| 659 | 659 | } |
@@ -799,7 +799,7 @@ discard block |
||
| 799 | 799 | */ |
| 800 | 800 | function dropTable($table_name) |
| 801 | 801 | { |
| 802 | - if(!$table_name) |
|
| 802 | + if (!$table_name) |
|
| 803 | 803 | { |
| 804 | 804 | return; |
| 805 | 805 | } |
@@ -816,59 +816,59 @@ discard block |
||
| 816 | 816 | function getSelectSql($query, $with_values = TRUE) |
| 817 | 817 | { |
| 818 | 818 | $select = $query->getSelectString($with_values); |
| 819 | - if($select == '') |
|
| 819 | + if ($select == '') |
|
| 820 | 820 | { |
| 821 | 821 | return new BaseObject(-1, "Invalid query"); |
| 822 | 822 | } |
| 823 | - $select = 'SELECT ' . $select; |
|
| 823 | + $select = 'SELECT '.$select; |
|
| 824 | 824 | |
| 825 | 825 | $from = $query->getFromString($with_values); |
| 826 | - if($from == '') |
|
| 826 | + if ($from == '') |
|
| 827 | 827 | { |
| 828 | 828 | return new BaseObject(-1, "Invalid query"); |
| 829 | 829 | } |
| 830 | - $from = ' FROM ' . $from; |
|
| 830 | + $from = ' FROM '.$from; |
|
| 831 | 831 | |
| 832 | 832 | $where = $query->getWhereString($with_values); |
| 833 | - if($where != '') |
|
| 833 | + if ($where != '') |
|
| 834 | 834 | { |
| 835 | - $where = ' WHERE ' . $where; |
|
| 835 | + $where = ' WHERE '.$where; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | $tableObjects = $query->getTables(); |
| 839 | 839 | $index_hint_list = ''; |
| 840 | - foreach($tableObjects as $tableObject) |
|
| 840 | + foreach ($tableObjects as $tableObject) |
|
| 841 | 841 | { |
| 842 | - if(is_a($tableObject, 'CubridTableWithHint')) |
|
| 842 | + if (is_a($tableObject, 'CubridTableWithHint')) |
|
| 843 | 843 | { |
| 844 | - $index_hint_list .= $tableObject->getIndexHintString() . ', '; |
|
| 844 | + $index_hint_list .= $tableObject->getIndexHintString().', '; |
|
| 845 | 845 | } |
| 846 | 846 | } |
| 847 | 847 | $index_hint_list = substr($index_hint_list, 0, -2); |
| 848 | - if($index_hint_list != '') |
|
| 848 | + if ($index_hint_list != '') |
|
| 849 | 849 | { |
| 850 | - $index_hint_list = 'USING INDEX ' . $index_hint_list; |
|
| 850 | + $index_hint_list = 'USING INDEX '.$index_hint_list; |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | $groupBy = $query->getGroupByString(); |
| 854 | - if($groupBy != '') |
|
| 854 | + if ($groupBy != '') |
|
| 855 | 855 | { |
| 856 | - $groupBy = ' GROUP BY ' . $groupBy; |
|
| 856 | + $groupBy = ' GROUP BY '.$groupBy; |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | $orderBy = $query->getOrderByString(); |
| 860 | - if($orderBy != '') |
|
| 860 | + if ($orderBy != '') |
|
| 861 | 861 | { |
| 862 | - $orderBy = ' ORDER BY ' . $orderBy; |
|
| 862 | + $orderBy = ' ORDER BY '.$orderBy; |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | $limit = $query->getLimitString(); |
| 866 | - if($limit != '') |
|
| 866 | + if ($limit != '') |
|
| 867 | 867 | { |
| 868 | - $limit = ' LIMIT ' . $limit; |
|
| 868 | + $limit = ' LIMIT '.$limit; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | - return $select . ' ' . $from . ' ' . $where . ' ' . $index_hint_list . ' ' . $groupBy . ' ' . $orderBy . ' ' . $limit; |
|
| 871 | + return $select.' '.$from.' '.$where.' '.$index_hint_list.' '.$groupBy.' '.$orderBy.' '.$limit; |
|
| 872 | 872 | } |
| 873 | 873 | |
| 874 | 874 | /** |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | { |
| 887 | 887 | $new_update_columns = array(); |
| 888 | 888 | $click_count_columns = $queryObject->getClickCountColumns(); |
| 889 | - foreach($click_count_columns as $click_count_column) |
|
| 889 | + foreach ($click_count_columns as $click_count_column) |
|
| 890 | 890 | { |
| 891 | 891 | $click_count_column_name = $click_count_column->column_name; |
| 892 | 892 | |
@@ -918,16 +918,16 @@ discard block |
||
| 918 | 918 | $sql .= $tables[0]->getAlias(); |
| 919 | 919 | |
| 920 | 920 | $from = $query->getFromString($with_values); |
| 921 | - if($from == '') |
|
| 921 | + if ($from == '') |
|
| 922 | 922 | { |
| 923 | 923 | return new BaseObject(-1, "Invalid query"); |
| 924 | 924 | } |
| 925 | - $sql .= ' FROM ' . $from; |
|
| 925 | + $sql .= ' FROM '.$from; |
|
| 926 | 926 | |
| 927 | 927 | $where = $query->getWhereString($with_values); |
| 928 | - if($where != '') |
|
| 928 | + if ($where != '') |
|
| 929 | 929 | { |
| 930 | - $sql .= ' WHERE ' . $where; |
|
| 930 | + $sql .= ' WHERE '.$where; |
|
| 931 | 931 | } |
| 932 | 932 | |
| 933 | 933 | return $sql; |
@@ -943,26 +943,26 @@ discard block |
||
| 943 | 943 | function getUpdateSql($query, $with_values = TRUE, $with_priority = FALSE) |
| 944 | 944 | { |
| 945 | 945 | $columnsList = $query->getUpdateString($with_values); |
| 946 | - if($columnsList == '') |
|
| 946 | + if ($columnsList == '') |
|
| 947 | 947 | { |
| 948 | 948 | return new BaseObject(-1, "Invalid query"); |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | $tables = $query->getFromString($with_values); |
| 952 | - if($tables == '') |
|
| 952 | + if ($tables == '') |
|
| 953 | 953 | { |
| 954 | 954 | return new BaseObject(-1, "Invalid query"); |
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | $where = $query->getWhereString($with_values); |
| 958 | - if($where != '') |
|
| 958 | + if ($where != '') |
|
| 959 | 959 | { |
| 960 | - $where = ' WHERE ' . $where; |
|
| 960 | + $where = ' WHERE '.$where; |
|
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | $priority = $with_priority ? $query->getPriority() : ''; |
| 964 | 964 | |
| 965 | - return "UPDATE $priority $tables SET $columnsList " . $where; |
|
| 965 | + return "UPDATE $priority $tables SET $columnsList ".$where; |
|
| 966 | 966 | } |
| 967 | 967 | |
| 968 | 968 | /** |
@@ -1000,27 +1000,27 @@ discard block |
||
| 1000 | 1000 | */ |
| 1001 | 1001 | function _getConnection($type = 'master', $indx = NULL) |
| 1002 | 1002 | { |
| 1003 | - if($type == 'master') |
|
| 1003 | + if ($type == 'master') |
|
| 1004 | 1004 | { |
| 1005 | - if(!$this->master_db['is_connected']) |
|
| 1005 | + if (!$this->master_db['is_connected']) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | $this->_connect($type); |
| 1008 | 1008 | } |
| 1009 | - $this->connection = 'Master ' . $this->master_db['db_hostname']; |
|
| 1009 | + $this->connection = 'Master '.$this->master_db['db_hostname']; |
|
| 1010 | 1010 | return $this->master_db["resource"]; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | - if($indx === NULL) |
|
| 1013 | + if ($indx === NULL) |
|
| 1014 | 1014 | { |
| 1015 | 1015 | $indx = $this->_getSlaveConnectionStringIndex($type); |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | - if(!$this->slave_db[$indx]['is_connected']) |
|
| 1018 | + if (!$this->slave_db[$indx]['is_connected']) |
|
| 1019 | 1019 | { |
| 1020 | 1020 | $this->_connect($type, $indx); |
| 1021 | 1021 | } |
| 1022 | 1022 | |
| 1023 | - $this->connection = 'Slave ' . $this->slave_db[$indx]['db_hostname']; |
|
| 1023 | + $this->connection = 'Slave '.$this->slave_db[$indx]['db_hostname']; |
|
| 1024 | 1024 | return $this->slave_db[$indx]["resource"]; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -1030,11 +1030,11 @@ discard block |
||
| 1030 | 1030 | */ |
| 1031 | 1031 | function _dbInfoExists() |
| 1032 | 1032 | { |
| 1033 | - if(!$this->master_db) |
|
| 1033 | + if (!$this->master_db) |
|
| 1034 | 1034 | { |
| 1035 | 1035 | return FALSE; |
| 1036 | 1036 | } |
| 1037 | - if(count($this->slave_db) === 0) |
|
| 1037 | + if (count($this->slave_db) === 0) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | return FALSE; |
| 1040 | 1040 | } |
@@ -1060,12 +1060,12 @@ discard block |
||
| 1060 | 1060 | */ |
| 1061 | 1061 | function close($type = 'master', $indx = 0) |
| 1062 | 1062 | { |
| 1063 | - if(!$this->isConnected($type, $indx)) |
|
| 1063 | + if (!$this->isConnected($type, $indx)) |
|
| 1064 | 1064 | { |
| 1065 | 1065 | return; |
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | - if($type == 'master') |
|
| 1068 | + if ($type == 'master') |
|
| 1069 | 1069 | { |
| 1070 | 1070 | $connection = &$this->master_db; |
| 1071 | 1071 | } |
@@ -1096,12 +1096,12 @@ discard block |
||
| 1096 | 1096 | */ |
| 1097 | 1097 | function begin() |
| 1098 | 1098 | { |
| 1099 | - if(!$this->isConnected()) |
|
| 1099 | + if (!$this->isConnected()) |
|
| 1100 | 1100 | { |
| 1101 | 1101 | return; |
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | - if($this->_begin($this->transactionNestedLevel)) |
|
| 1104 | + if ($this->_begin($this->transactionNestedLevel)) |
|
| 1105 | 1105 | { |
| 1106 | 1106 | $this->transaction_started = TRUE; |
| 1107 | 1107 | $this->transactionNestedLevel++; |
@@ -1124,15 +1124,15 @@ discard block |
||
| 1124 | 1124 | */ |
| 1125 | 1125 | function rollback() |
| 1126 | 1126 | { |
| 1127 | - if(!$this->isConnected() || !$this->transaction_started) |
|
| 1127 | + if (!$this->isConnected() || !$this->transaction_started) |
|
| 1128 | 1128 | { |
| 1129 | 1129 | return; |
| 1130 | 1130 | } |
| 1131 | - if($this->_rollback($this->transactionNestedLevel)) |
|
| 1131 | + if ($this->_rollback($this->transactionNestedLevel)) |
|
| 1132 | 1132 | { |
| 1133 | 1133 | $this->transactionNestedLevel--; |
| 1134 | 1134 | |
| 1135 | - if(!$this->transactionNestedLevel) |
|
| 1135 | + if (!$this->transactionNestedLevel) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | $this->transaction_started = FALSE; |
| 1138 | 1138 | } |
@@ -1156,11 +1156,11 @@ discard block |
||
| 1156 | 1156 | */ |
| 1157 | 1157 | function commit($force = FALSE) |
| 1158 | 1158 | { |
| 1159 | - if(!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
| 1159 | + if (!$force && (!$this->isConnected() || !$this->transaction_started)) |
|
| 1160 | 1160 | { |
| 1161 | 1161 | return; |
| 1162 | 1162 | } |
| 1163 | - if($this->transactionNestedLevel == 1 && $this->_commit()) |
|
| 1163 | + if ($this->transactionNestedLevel == 1 && $this->_commit()) |
|
| 1164 | 1164 | { |
| 1165 | 1165 | $this->transaction_started = FALSE; |
| 1166 | 1166 | $this->transactionNestedLevel = 0; |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | */ |
| 1193 | 1193 | function _query($query, $connection = NULL) |
| 1194 | 1194 | { |
| 1195 | - if($connection == NULL) |
|
| 1195 | + if ($connection == NULL) |
|
| 1196 | 1196 | { |
| 1197 | 1197 | $connection = $this->_getConnection('master'); |
| 1198 | 1198 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
| 1217 | 1217 | { |
| 1218 | 1218 | $db_info = Context::getDBInfo(); |
| 1219 | 1219 | $this->master_db = $db_info->master_db; |
| 1220 | - if($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
| 1220 | + if ($db_info->master_db["db_hostname"] == $db_info->slave_db[0]["db_hostname"] |
|
| 1221 | 1221 | && $db_info->master_db["db_port"] == $db_info->slave_db[0]["db_port"] |
| 1222 | 1222 | && $db_info->master_db["db_userid"] == $db_info->slave_db[0]["db_userid"] |
| 1223 | 1223 | && $db_info->master_db["db_password"] == $db_info->slave_db[0]["db_password"] |
@@ -1265,18 +1265,18 @@ discard block |
||
| 1265 | 1265 | */ |
| 1266 | 1266 | function _connect($type = 'master', $indx = 0) |
| 1267 | 1267 | { |
| 1268 | - if($this->isConnected($type, $indx)) |
|
| 1268 | + if ($this->isConnected($type, $indx)) |
|
| 1269 | 1269 | { |
| 1270 | 1270 | return; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | 1273 | // Ignore if no DB information exists |
| 1274 | - if(!$this->_dbInfoExists()) |
|
| 1274 | + if (!$this->_dbInfoExists()) |
|
| 1275 | 1275 | { |
| 1276 | 1276 | return; |
| 1277 | 1277 | } |
| 1278 | 1278 | |
| 1279 | - if($type == 'master') |
|
| 1279 | + if ($type == 'master') |
|
| 1280 | 1280 | { |
| 1281 | 1281 | $connection = &$this->master_db; |
| 1282 | 1282 | } |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | $result = $this->__connect($connection); |
| 1289 | - if($result === NULL || $result === FALSE) |
|
| 1289 | + if ($result === NULL || $result === FALSE) |
|
| 1290 | 1290 | { |
| 1291 | 1291 | $connection["is_connected"] = FALSE; |
| 1292 | 1292 | return; |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | $connection["is_connected"] = TRUE; |
| 1298 | 1298 | |
| 1299 | 1299 | // Save connection info for db logs |
| 1300 | - $this->connection = ucfirst($type) . ' ' . $connection["db_hostname"]; |
|
| 1300 | + $this->connection = ucfirst($type).' '.$connection["db_hostname"]; |
|
| 1301 | 1301 | |
| 1302 | 1302 | // regist $this->close callback |
| 1303 | 1303 | register_shutdown_function(array($this, "close")); |
@@ -1322,7 +1322,7 @@ discard block |
||
| 1322 | 1322 | */ |
| 1323 | 1323 | function actDBClassFinish() |
| 1324 | 1324 | { |
| 1325 | - if(!$this->query) |
|
| 1325 | + if (!$this->query) |
|
| 1326 | 1326 | { |
| 1327 | 1327 | return; |
| 1328 | 1328 | } |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | function getParser($force = FALSE) |
| 1346 | 1346 | { |
| 1347 | 1347 | static $dbParser = NULL; |
| 1348 | - if(!$dbParser || $force) |
|
| 1348 | + if (!$dbParser || $force) |
|
| 1349 | 1349 | { |
| 1350 | 1350 | $oDB = DB::getInstance(); |
| 1351 | 1351 | $dbParser = $oDB->getParser(); |
@@ -20,12 +20,12 @@ |
||
| 20 | 20 | { |
| 21 | 21 | Context::set('component_info', $info); |
| 22 | 22 | |
| 23 | - if(!$info->extra_vars) |
|
| 23 | + if (!$info->extra_vars) |
|
| 24 | 24 | { |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - foreach($info->extra_vars as $key => $val) |
|
| 28 | + foreach ($info->extra_vars as $key => $val) |
|
| 29 | 29 | { |
| 30 | 30 | $this->{$key} = trim($val->value); |
| 31 | 31 | } |
@@ -215,12 +215,10 @@ discard block |
||
| 215 | 215 | if(is_array($value)) |
| 216 | 216 | { |
| 217 | 217 | $values = $value; |
| 218 | - } |
|
| 219 | - elseif(strpos($value, '|@|') !== FALSE) |
|
| 218 | + } elseif(strpos($value, '|@|') !== FALSE) |
|
| 220 | 219 | { |
| 221 | 220 | $values = explode('|@|', $value); |
| 222 | - } |
|
| 223 | - elseif(strpos($value, ',') !== FALSE) |
|
| 221 | + } elseif(strpos($value, ',') !== FALSE) |
|
| 224 | 222 | { |
| 225 | 223 | $values = explode(',', $value); |
| 226 | 224 | } |
@@ -238,16 +236,13 @@ discard block |
||
| 238 | 236 | if(is_array($value)) |
| 239 | 237 | { |
| 240 | 238 | $values = $value; |
| 241 | - } |
|
| 242 | - elseif(strpos($value, '|@|') !== FALSE) |
|
| 239 | + } elseif(strpos($value, '|@|') !== FALSE) |
|
| 243 | 240 | { |
| 244 | 241 | $values = explode('|@|', $value); |
| 245 | - } |
|
| 246 | - elseif(strpos($value, ',') !== FALSE) |
|
| 242 | + } elseif(strpos($value, ',') !== FALSE) |
|
| 247 | 243 | { |
| 248 | 244 | $values = explode(',', $value); |
| 249 | - } |
|
| 250 | - else |
|
| 245 | + } else |
|
| 251 | 246 | { |
| 252 | 247 | $values = array($value); |
| 253 | 248 | } |
@@ -263,12 +258,10 @@ discard block |
||
| 263 | 258 | if(is_array($value)) |
| 264 | 259 | { |
| 265 | 260 | $values = $value; |
| 266 | - } |
|
| 267 | - elseif(strpos($value, '|@|') !== false) |
|
| 261 | + } elseif(strpos($value, '|@|') !== false) |
|
| 268 | 262 | { |
| 269 | 263 | $values = explode('|@|', $value); |
| 270 | - } |
|
| 271 | - else |
|
| 264 | + } else |
|
| 272 | 265 | { |
| 273 | 266 | $values = array($value); |
| 274 | 267 | } |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function setExtraVarKeys($extra_keys) |
| 53 | 53 | { |
| 54 | - if(!is_array($extra_keys) || count($extra_keys) < 1) |
|
| 54 | + if (!is_array($extra_keys) || count($extra_keys) < 1) |
|
| 55 | 55 | { |
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - foreach($extra_keys as $val) |
|
| 59 | + foreach ($extra_keys as $val) |
|
| 60 | 60 | { |
| 61 | 61 | $obj = new ExtraItem($val->module_srl, $val->idx, $val->name, $val->type, $val->default, $val->desc, $val->is_required, $val->search, $val->value, $val->eid); |
| 62 | 62 | $this->keys[$val->idx] = $obj; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | function __construct($module_srl, $idx, $name, $type = 'text', $default = null, $desc = '', $is_required = 'N', $search = 'N', $value = null, $eid = '') |
| 161 | 161 | { |
| 162 | - if(!$idx) |
|
| 162 | + if (!$idx) |
|
| 163 | 163 | { |
| 164 | 164 | return; |
| 165 | 165 | } |
@@ -197,36 +197,36 @@ discard block |
||
| 197 | 197 | function _getTypeValue($type, $value) |
| 198 | 198 | { |
| 199 | 199 | $value = trim($value); |
| 200 | - if(!isset($value)) |
|
| 200 | + if (!isset($value)) |
|
| 201 | 201 | { |
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - switch($type) |
|
| 205 | + switch ($type) |
|
| 206 | 206 | { |
| 207 | 207 | case 'homepage' : |
| 208 | - if($value && !preg_match('/^([a-z]+):\/\//i', $value)) |
|
| 208 | + if ($value && !preg_match('/^([a-z]+):\/\//i', $value)) |
|
| 209 | 209 | { |
| 210 | - $value = 'http://' . $value; |
|
| 210 | + $value = 'http://'.$value; |
|
| 211 | 211 | } |
| 212 | 212 | return htmlspecialchars($value, ENT_COMPAT | ENT_HTML401, 'UTF-8', false); |
| 213 | 213 | |
| 214 | 214 | case 'tel' : |
| 215 | - if(is_array($value)) |
|
| 215 | + if (is_array($value)) |
|
| 216 | 216 | { |
| 217 | 217 | $values = $value; |
| 218 | 218 | } |
| 219 | - elseif(strpos($value, '|@|') !== FALSE) |
|
| 219 | + elseif (strpos($value, '|@|') !== FALSE) |
|
| 220 | 220 | { |
| 221 | 221 | $values = explode('|@|', $value); |
| 222 | 222 | } |
| 223 | - elseif(strpos($value, ',') !== FALSE) |
|
| 223 | + elseif (strpos($value, ',') !== FALSE) |
|
| 224 | 224 | { |
| 225 | 225 | $values = explode(',', $value); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | $values = array_values($values); |
| 229 | - for($i = 0, $c = count($values); $i < $c; $i++) |
|
| 229 | + for ($i = 0, $c = count($values); $i < $c; $i++) |
|
| 230 | 230 | { |
| 231 | 231 | $values[$i] = trim(htmlspecialchars($values[$i], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 232 | 232 | } |
@@ -235,15 +235,15 @@ discard block |
||
| 235 | 235 | case 'checkbox' : |
| 236 | 236 | case 'radio' : |
| 237 | 237 | case 'select' : |
| 238 | - if(is_array($value)) |
|
| 238 | + if (is_array($value)) |
|
| 239 | 239 | { |
| 240 | 240 | $values = $value; |
| 241 | 241 | } |
| 242 | - elseif(strpos($value, '|@|') !== FALSE) |
|
| 242 | + elseif (strpos($value, '|@|') !== FALSE) |
|
| 243 | 243 | { |
| 244 | 244 | $values = explode('|@|', $value); |
| 245 | 245 | } |
| 246 | - elseif(strpos($value, ',') !== FALSE) |
|
| 246 | + elseif (strpos($value, ',') !== FALSE) |
|
| 247 | 247 | { |
| 248 | 248 | $values = explode(',', $value); |
| 249 | 249 | } |
@@ -253,18 +253,18 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | $values = array_values($values); |
| 256 | - for($i = 0, $c = count($values); $i < $c; $i++) |
|
| 256 | + for ($i = 0, $c = count($values); $i < $c; $i++) |
|
| 257 | 257 | { |
| 258 | 258 | $values[$i] = trim(htmlspecialchars($values[$i], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 259 | 259 | } |
| 260 | 260 | return $values; |
| 261 | 261 | |
| 262 | 262 | case 'kr_zip' : |
| 263 | - if(is_array($value)) |
|
| 263 | + if (is_array($value)) |
|
| 264 | 264 | { |
| 265 | 265 | $values = $value; |
| 266 | 266 | } |
| 267 | - elseif(strpos($value, '|@|') !== false) |
|
| 267 | + elseif (strpos($value, '|@|') !== false) |
|
| 268 | 268 | { |
| 269 | 269 | $values = explode('|@|', $value); |
| 270 | 270 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | $values = array_values($values); |
| 277 | - for($i = 0, $c = count($values); $i < $c; $i++) |
|
| 277 | + for ($i = 0, $c = count($values); $i < $c; $i++) |
|
| 278 | 278 | { |
| 279 | 279 | $values[$i] = trim(htmlspecialchars($values[$i], ENT_COMPAT | ENT_HTML401, 'UTF-8', false)); |
| 280 | 280 | } |
@@ -308,10 +308,10 @@ discard block |
||
| 308 | 308 | { |
| 309 | 309 | $value = $this->_getTypeValue($this->type, $this->value); |
| 310 | 310 | |
| 311 | - switch($this->type) |
|
| 311 | + switch ($this->type) |
|
| 312 | 312 | { |
| 313 | 313 | case 'homepage' : |
| 314 | - return ($value) ? (sprintf('<a href="%s" target="_blank">%s</a>', $value, strlen($value) > 60 ? substr($value, 0, 40) . '...' . substr($value, -10) : $value)) : ""; |
|
| 314 | + return ($value) ? (sprintf('<a href="%s" target="_blank">%s</a>', $value, strlen($value) > 60 ? substr($value, 0, 40).'...'.substr($value, -10) : $value)) : ""; |
|
| 315 | 315 | |
| 316 | 316 | case 'email_address' : |
| 317 | 317 | return ($value) ? sprintf('<a href="mailto:%s">%s</a>', $value, $value) : ""; |
@@ -328,14 +328,14 @@ discard block |
||
| 328 | 328 | case 'checkbox' : |
| 329 | 329 | case 'select' : |
| 330 | 330 | case 'radio' : |
| 331 | - if(is_array($value)) |
|
| 331 | + if (is_array($value)) |
|
| 332 | 332 | { |
| 333 | 333 | return implode(',', $value); |
| 334 | 334 | } |
| 335 | 335 | return $value; |
| 336 | 336 | |
| 337 | 337 | case 'kr_zip' : |
| 338 | - if(is_array($value)) |
|
| 338 | + if (is_array($value)) |
|
| 339 | 339 | { |
| 340 | 340 | return implode(' ', $value); |
| 341 | 341 | } |
@@ -360,77 +360,77 @@ discard block |
||
| 360 | 360 | $name = $this->name; |
| 361 | 361 | $value = $this->_getTypeValue($this->type, $this->value); |
| 362 | 362 | $default = $this->_getTypeValue($this->type, $this->default); |
| 363 | - $column_name = 'extra_vars' . $this->idx; |
|
| 364 | - $tmp_id = $column_name . '-' . $id_num++; |
|
| 363 | + $column_name = 'extra_vars'.$this->idx; |
|
| 364 | + $tmp_id = $column_name.'-'.$id_num++; |
|
| 365 | 365 | |
| 366 | 366 | $buff = array(); |
| 367 | - switch($type) |
|
| 367 | + switch ($type) |
|
| 368 | 368 | { |
| 369 | 369 | // Homepage |
| 370 | 370 | case 'homepage' : |
| 371 | - $buff[] = '<input type="text" name="' . $column_name . '" value="' . $value . '" class="homepage" />'; |
|
| 371 | + $buff[] = '<input type="text" name="'.$column_name.'" value="'.$value.'" class="homepage" />'; |
|
| 372 | 372 | break; |
| 373 | 373 | // Email Address |
| 374 | 374 | case 'email_address' : |
| 375 | - $buff[] = '<input type="text" name="' . $column_name . '" value="' . $value . '" class="email_address" />'; |
|
| 375 | + $buff[] = '<input type="text" name="'.$column_name.'" value="'.$value.'" class="email_address" />'; |
|
| 376 | 376 | break; |
| 377 | 377 | // Phone Number |
| 378 | 378 | case 'tel' : |
| 379 | - $buff[] = '<input type="text" name="' . $column_name . '[]" value="' . $value[0] . '" size="4" maxlength="4" class="tel" />'; |
|
| 380 | - $buff[] = '<input type="text" name="' . $column_name . '[]" value="' . $value[1] . '" size="4" maxlength="4" class="tel" />'; |
|
| 381 | - $buff[] = '<input type="text" name="' . $column_name . '[]" value="' . $value[2] . '" size="4" maxlength="4" class="tel" />'; |
|
| 379 | + $buff[] = '<input type="text" name="'.$column_name.'[]" value="'.$value[0].'" size="4" maxlength="4" class="tel" />'; |
|
| 380 | + $buff[] = '<input type="text" name="'.$column_name.'[]" value="'.$value[1].'" size="4" maxlength="4" class="tel" />'; |
|
| 381 | + $buff[] = '<input type="text" name="'.$column_name.'[]" value="'.$value[2].'" size="4" maxlength="4" class="tel" />'; |
|
| 382 | 382 | break; |
| 383 | 383 | // textarea |
| 384 | 384 | case 'textarea' : |
| 385 | - $buff[] = '<textarea name="' . $column_name . '" rows="8" cols="42">' . $value . '</textarea>'; |
|
| 385 | + $buff[] = '<textarea name="'.$column_name.'" rows="8" cols="42">'.$value.'</textarea>'; |
|
| 386 | 386 | break; |
| 387 | 387 | // multiple choice |
| 388 | 388 | case 'checkbox' : |
| 389 | 389 | $buff[] = '<ul>'; |
| 390 | - foreach($default as $v) |
|
| 390 | + foreach ($default as $v) |
|
| 391 | 391 | { |
| 392 | 392 | $checked = ''; |
| 393 | - if($value && in_array(trim($v), $value)) |
|
| 393 | + if ($value && in_array(trim($v), $value)) |
|
| 394 | 394 | { |
| 395 | 395 | $checked = ' checked="checked"'; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | // Temporary ID for labeling |
| 399 | - $tmp_id = $column_name . '-' . $id_num++; |
|
| 399 | + $tmp_id = $column_name.'-'.$id_num++; |
|
| 400 | 400 | |
| 401 | - $buff[] =' <li><input type="checkbox" name="' . $column_name . '[]" id="' . $tmp_id . '" value="' . htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '" ' . $checked . ' /><label for="' . $tmp_id . '">' . $v . '</label></li>'; |
|
| 401 | + $buff[] = ' <li><input type="checkbox" name="'.$column_name.'[]" id="'.$tmp_id.'" value="'.htmlspecialchars($v, ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'" '.$checked.' /><label for="'.$tmp_id.'">'.$v.'</label></li>'; |
|
| 402 | 402 | } |
| 403 | 403 | $buff[] = '</ul>'; |
| 404 | 404 | break; |
| 405 | 405 | // single choice |
| 406 | 406 | case 'select' : |
| 407 | - $buff[] = '<select name="' . $column_name . '" class="select">'; |
|
| 408 | - foreach($default as $v) |
|
| 407 | + $buff[] = '<select name="'.$column_name.'" class="select">'; |
|
| 408 | + foreach ($default as $v) |
|
| 409 | 409 | { |
| 410 | 410 | $selected = ''; |
| 411 | - if($value && in_array(trim($v), $value)) |
|
| 411 | + if ($value && in_array(trim($v), $value)) |
|
| 412 | 412 | { |
| 413 | 413 | $selected = ' selected="selected"'; |
| 414 | 414 | } |
| 415 | - $buff[] = ' <option value="' . $v . '" ' . $selected . '>' . $v . '</option>'; |
|
| 415 | + $buff[] = ' <option value="'.$v.'" '.$selected.'>'.$v.'</option>'; |
|
| 416 | 416 | } |
| 417 | 417 | $buff[] = '</select>'; |
| 418 | 418 | break; |
| 419 | 419 | // radio |
| 420 | 420 | case 'radio' : |
| 421 | 421 | $buff[] = '<ul>'; |
| 422 | - foreach($default as $v) |
|
| 422 | + foreach ($default as $v) |
|
| 423 | 423 | { |
| 424 | 424 | $checked = ''; |
| 425 | - if($value && in_array(trim($v), $value)) |
|
| 425 | + if ($value && in_array(trim($v), $value)) |
|
| 426 | 426 | { |
| 427 | 427 | $checked = ' checked="checked"'; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | // Temporary ID for labeling |
| 431 | - $tmp_id = $column_name . '-' . $id_num++; |
|
| 431 | + $tmp_id = $column_name.'-'.$id_num++; |
|
| 432 | 432 | |
| 433 | - $buff[] = '<li><input type="radio" name="' . $column_name . '" id="' . $tmp_id . '" ' . $checked . ' value="' . $v . '" class="radio" /><label for="' . $tmp_id . '">' . $v . '</label></li>'; |
|
| 433 | + $buff[] = '<li><input type="radio" name="'.$column_name.'" id="'.$tmp_id.'" '.$checked.' value="'.$v.'" class="radio" /><label for="'.$tmp_id.'">'.$v.'</label></li>'; |
|
| 434 | 434 | } |
| 435 | 435 | $buff[] = '</ul>'; |
| 436 | 436 | break; |
@@ -439,44 +439,44 @@ discard block |
||
| 439 | 439 | // datepicker javascript plugin load |
| 440 | 440 | Context::loadJavascriptPlugin('ui.datepicker'); |
| 441 | 441 | |
| 442 | - $buff[] = '<input type="hidden" name="' . $column_name . '" value="' . $value . '" />'; |
|
| 443 | - $buff[] = '<input type="text" id="date_' . $column_name . '" value="' . zdate($value, 'Y-m-d') . '" class="date" />'; |
|
| 444 | - $buff[] = '<input type="button" value="' . Context::getLang('cmd_delete') . '" class="btn" id="dateRemover_' . $column_name . '" />'; |
|
| 445 | - $buff[] = '<script type="text/javascript">'; |
|
| 442 | + $buff[] = '<input type="hidden" name="'.$column_name.'" value="'.$value.'" />'; |
|
| 443 | + $buff[] = '<input type="text" id="date_'.$column_name.'" value="'.zdate($value, 'Y-m-d').'" class="date" />'; |
|
| 444 | + $buff[] = '<input type="button" value="'.Context::getLang('cmd_delete').'" class="btn" id="dateRemover_'.$column_name.'" />'; |
|
| 445 | + $buff[] = '<script type="text/javascript">'; |
|
| 446 | 446 | $buff[] = '//<![CDATA['; |
| 447 | - $buff[] = '(function($){'; |
|
| 448 | - $buff[] = '$(function(){'; |
|
| 449 | - $buff[] = ' var option = { dateFormat: "yy-mm-dd", changeMonth:true, changeYear:true, gotoCurrent:false, yearRange:\'-100:+10\', onSelect:function(){'; |
|
| 450 | - $buff[] = ' $(this).prev(\'input[type="hidden"]\').val(this.value.replace(/-/g,""))}'; |
|
| 451 | - $buff[] = ' };'; |
|
| 452 | - $buff[] = ' $.extend(option,$.datepicker.regional[\'' . Context::getLangType() . '\']);'; |
|
| 453 | - $buff[] = ' $("#date_' . $column_name . '").datepicker(option);'; |
|
| 454 | - $buff[] = ' $("#date_' . $column_name . '").datepicker("option", "dateFormat", "yy-mm-dd");'; |
|
| 455 | - $buff[] = ' $("#dateRemover_' . $column_name . '").click(function(){'; |
|
| 456 | - $buff[] = ' $(this).siblings("input").val("");'; |
|
| 457 | - $buff[] = ' return false;'; |
|
| 458 | - $buff[] = ' })'; |
|
| 459 | - $buff[] = '});'; |
|
| 460 | - $buff[] = '})(jQuery);'; |
|
| 447 | + $buff[] = '(function($){'; |
|
| 448 | + $buff[] = '$(function(){'; |
|
| 449 | + $buff[] = ' var option = { dateFormat: "yy-mm-dd", changeMonth:true, changeYear:true, gotoCurrent:false, yearRange:\'-100:+10\', onSelect:function(){'; |
|
| 450 | + $buff[] = ' $(this).prev(\'input[type="hidden"]\').val(this.value.replace(/-/g,""))}'; |
|
| 451 | + $buff[] = ' };'; |
|
| 452 | + $buff[] = ' $.extend(option,$.datepicker.regional[\''.Context::getLangType().'\']);'; |
|
| 453 | + $buff[] = ' $("#date_'.$column_name.'").datepicker(option);'; |
|
| 454 | + $buff[] = ' $("#date_'.$column_name.'").datepicker("option", "dateFormat", "yy-mm-dd");'; |
|
| 455 | + $buff[] = ' $("#dateRemover_'.$column_name.'").click(function(){'; |
|
| 456 | + $buff[] = ' $(this).siblings("input").val("");'; |
|
| 457 | + $buff[] = ' return false;'; |
|
| 458 | + $buff[] = ' })'; |
|
| 459 | + $buff[] = '});'; |
|
| 460 | + $buff[] = '})(jQuery);'; |
|
| 461 | 461 | $buff[] = '//]]>'; |
| 462 | 462 | $buff[] = '</script>'; |
| 463 | 463 | break; |
| 464 | 464 | // address |
| 465 | 465 | case "kr_zip" : |
| 466 | - if(($oKrzipModel = getModel('krzip')) && method_exists($oKrzipModel , 'getKrzipCodeSearchHtml' )) |
|
| 466 | + if (($oKrzipModel = getModel('krzip')) && method_exists($oKrzipModel, 'getKrzipCodeSearchHtml')) |
|
| 467 | 467 | { |
| 468 | - $buff[] = $oKrzipModel->getKrzipCodeSearchHtml($column_name, $value); |
|
| 468 | + $buff[] = $oKrzipModel->getKrzipCodeSearchHtml($column_name, $value); |
|
| 469 | 469 | } |
| 470 | 470 | break; |
| 471 | 471 | // General text |
| 472 | 472 | default : |
| 473 | - $buff[] =' <input type="text" name="' . $column_name . '" value="' . ($value ? $value : $default) . '" class="text" />'; |
|
| 473 | + $buff[] = ' <input type="text" name="'.$column_name.'" value="'.($value ? $value : $default).'" class="text" />'; |
|
| 474 | 474 | } |
| 475 | - if($this->desc) |
|
| 475 | + if ($this->desc) |
|
| 476 | 476 | { |
| 477 | 477 | $oModuleController = getController('module'); |
| 478 | 478 | $oModuleController->replaceDefinedLangCode($this->desc); |
| 479 | - $buff[] = '<p>' . htmlspecialchars($this->desc, ENT_COMPAT | ENT_HTML401, 'UTF-8', false) . '</p>'; |
|
| 479 | + $buff[] = '<p>'.htmlspecialchars($this->desc, ENT_COMPAT | ENT_HTML401, 'UTF-8', false).'</p>'; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | return join(PHP_EOL, $buff); |
@@ -136,8 +136,7 @@ |
||
| 136 | 136 | if($this->fp != NULL) |
| 137 | 137 | { |
| 138 | 138 | return $this->path; |
| 139 | - } |
|
| 140 | - else |
|
| 139 | + } else |
|
| 141 | 140 | { |
| 142 | 141 | return NULL; |
| 143 | 142 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | function __construct($path, $mode) |
| 38 | 38 | { |
| 39 | - if($path != NULL) |
|
| 39 | + if ($path != NULL) |
|
| 40 | 40 | { |
| 41 | 41 | $this->Open($path, $mode); |
| 42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | function append($file_name) |
| 52 | 52 | { |
| 53 | 53 | $target = new FileObject($file_name, "r"); |
| 54 | - while(!$target->feof()) |
|
| 54 | + while (!$target->feof()) |
|
| 55 | 55 | { |
| 56 | 56 | $readstr = $target->read(); |
| 57 | 57 | $this->write($readstr); |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | function write($str) |
| 90 | 90 | { |
| 91 | 91 | $len = strlen($str); |
| 92 | - if(!$str || $len <= 0) |
|
| 92 | + if (!$str || $len <= 0) |
|
| 93 | 93 | { |
| 94 | 94 | return FALSE; |
| 95 | 95 | } |
| 96 | - if(!$this->fp) |
|
| 96 | + if (!$this->fp) |
|
| 97 | 97 | { |
| 98 | 98 | return FALSE; |
| 99 | 99 | } |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | function open($path, $mode) |
| 114 | 114 | { |
| 115 | - if($this->fp != NULL) |
|
| 115 | + if ($this->fp != NULL) |
|
| 116 | 116 | { |
| 117 | 117 | $this->close(); |
| 118 | 118 | } |
| 119 | 119 | $this->fp = fopen($path, $mode); |
| 120 | - if(!is_resource($this->fp)) |
|
| 120 | + if (!is_resource($this->fp)) |
|
| 121 | 121 | { |
| 122 | 122 | $this->fp = NULL; |
| 123 | 123 | return FALSE; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function getPath() |
| 135 | 135 | { |
| 136 | - if($this->fp != NULL) |
|
| 136 | + if ($this->fp != NULL) |
|
| 137 | 137 | { |
| 138 | 138 | return $this->path; |
| 139 | 139 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | function close() |
| 152 | 152 | { |
| 153 | - if($this->fp != NULL) |
|
| 153 | + if ($this->fp != NULL) |
|
| 154 | 154 | { |
| 155 | 155 | fclose($this->fp); |
| 156 | 156 | $this->fp = NULL; |
@@ -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 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* Copyright (C) NAVER <http://www.navercorp.com> */ |
| 3 | 3 | |
| 4 | -require_once _XE_PATH_ . "libs/phpmailer/phpmailer.php"; |
|
| 4 | +require_once _XE_PATH_."libs/phpmailer/phpmailer.php"; |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * Mailing class for XpressEngine |
@@ -148,13 +148,13 @@ 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 | } |
| 155 | 155 | else |
| 156 | 156 | { |
| 157 | - $this->Username = $account_name . '@gmail.com'; |
|
| 157 | + $this->Username = $account_name.'@gmail.com'; |
|
| 158 | 158 | } |
| 159 | 159 | $this->Password = $account_passwd; |
| 160 | 160 | $this->IsSMTP(); |
@@ -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,9 +260,9 @@ 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 | - return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->sender_name) . '?=', $this->sender_email); |
|
| 265 | + return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->sender_name).'?=', $this->sender_email); |
|
| 266 | 266 | } |
| 267 | 267 | return $this->sender_email; |
| 268 | 268 | } |
@@ -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,9 +294,9 @@ 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 | - return sprintf("%s <%s>", '=?utf-8?b?' . base64_encode($this->receiptor_name) . '?=', $this->receiptor_email); |
|
| 299 | + return sprintf("%s <%s>", '=?utf-8?b?'.base64_encode($this->receiptor_name).'?=', $this->receiptor_email); |
|
| 300 | 300 | } |
| 301 | 301 | return $this->receiptor_email; |
| 302 | 302 | } |
@@ -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 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | function getTitle() |
| 328 | 328 | { |
| 329 | - return '=?utf-8?b?' . base64_encode($this->title) . '?='; |
|
| 329 | + return '=?utf-8?b?'.base64_encode($this->title).'?='; |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -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 | } |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | */ |
| 416 | 416 | function replaceResourceRealPath($matches) |
| 417 | 417 | { |
| 418 | - return preg_replace('/src=(["\']?)files/i', 'src=$1' . Context::getRequestUri() . 'files', $matches[0]); |
|
| 418 | + return preg_replace('/src=(["\']?)files/i', 'src=$1'.Context::getRequestUri().'files', $matches[0]); |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
@@ -456,42 +456,42 @@ 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 | - $this->body = $this->header . $this->body; |
|
| 464 | - $boundary = '----==' . uniqid(rand(), TRUE); |
|
| 465 | - $this->header = "Content-Type: multipart/mixed;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol; |
|
| 466 | - $this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol; |
|
| 463 | + $this->body = $this->header.$this->body; |
|
| 464 | + $boundary = '----=='.uniqid(rand(), TRUE); |
|
| 465 | + $this->header = "Content-Type: multipart/mixed;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol; |
|
| 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(); |
| 473 | 473 | $file_str = $file_handler->readFile($attachment); |
| 474 | 474 | $chunks = chunk_split(base64_encode($file_str)); |
| 475 | 475 | $tempBody = sprintf( |
| 476 | - "--" . $boundary . $this->eol . |
|
| 477 | - "Content-Type: %s;" . $this->eol . |
|
| 478 | - "\tname=\"%s\"" . $this->eol . |
|
| 479 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
| 480 | - "Content-Description: %s" . $this->eol . |
|
| 481 | - "Content-Disposition: attachment;" . $this->eol . |
|
| 482 | - "\tfilename=\"%s\"" . $this->eol . $this->eol . |
|
| 483 | - "%s" . $this->eol . $this->eol, $type, $filename, $filename, $filename, $chunks); |
|
| 476 | + "--".$boundary.$this->eol. |
|
| 477 | + "Content-Type: %s;".$this->eol. |
|
| 478 | + "\tname=\"%s\"".$this->eol. |
|
| 479 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
| 480 | + "Content-Description: %s".$this->eol. |
|
| 481 | + "Content-Disposition: attachment;".$this->eol. |
|
| 482 | + "\tfilename=\"%s\"".$this->eol.$this->eol. |
|
| 483 | + "%s".$this->eol.$this->eol, $type, $filename, $filename, $filename, $chunks); |
|
| 484 | 484 | $res[] = $tempBody; |
| 485 | 485 | } |
| 486 | 486 | $this->body = implode("", $res); |
| 487 | - $this->body .= "--" . $boundary . "--"; |
|
| 487 | + $this->body .= "--".$boundary."--"; |
|
| 488 | 488 | } |
| 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,33 +506,33 @@ 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 | - $this->body = $this->header . $this->body; |
|
| 512 | - $boundary = '----==' . uniqid(rand(), TRUE); |
|
| 513 | - $this->header = "Content-Type: multipart/relative;" . $this->eol . "\ttype=\"multipart/alternative\";" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol; |
|
| 514 | - $this->body = "--" . $boundary . $this->eol . $this->body . $this->eol . $this->eol; |
|
| 511 | + $this->body = $this->header.$this->body; |
|
| 512 | + $boundary = '----=='.uniqid(rand(), TRUE); |
|
| 513 | + $this->header = "Content-Type: multipart/relative;".$this->eol."\ttype=\"multipart/alternative\";".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol; |
|
| 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)); |
| 521 | 521 | $file_str = FileHandler::readFile($attachment); |
| 522 | 522 | $chunks = chunk_split(base64_encode($file_str)); |
| 523 | 523 | $tempBody = sprintf( |
| 524 | - "--" . $boundary . $this->eol . |
|
| 525 | - "Content-Type: %s;" . $this->eol . |
|
| 526 | - "\tname=\"%s\"" . $this->eol . |
|
| 527 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
| 528 | - "Content-ID: <%s>" . $this->eol . |
|
| 529 | - "Content-Description: %s" . $this->eol . |
|
| 530 | - "Content-Location: %s" . $this->eol . $this->eol . |
|
| 531 | - "%s" . $this->eol . $this->eol, $type, $filename, $cid, $filename, $filename, $chunks); |
|
| 524 | + "--".$boundary.$this->eol. |
|
| 525 | + "Content-Type: %s;".$this->eol. |
|
| 526 | + "\tname=\"%s\"".$this->eol. |
|
| 527 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
| 528 | + "Content-ID: <%s>".$this->eol. |
|
| 529 | + "Content-Description: %s".$this->eol. |
|
| 530 | + "Content-Location: %s".$this->eol.$this->eol. |
|
| 531 | + "%s".$this->eol.$this->eol, $type, $filename, $cid, $filename, $filename, $chunks); |
|
| 532 | 532 | $res[] = $tempBody; |
| 533 | 533 | } |
| 534 | 534 | $this->body = implode("", $res); |
| 535 | - $this->body .= "--" . $boundary . "--"; |
|
| 535 | + $this->body .= "--".$boundary."--"; |
|
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
@@ -543,37 +543,37 @@ discard block |
||
| 543 | 543 | */ |
| 544 | 544 | function send() |
| 545 | 545 | { |
| 546 | - if($this->Mailer == "mail") |
|
| 546 | + if ($this->Mailer == "mail") |
|
| 547 | 547 | { |
| 548 | - $boundary = '----==' . uniqid(rand(), TRUE); |
|
| 548 | + $boundary = '----=='.uniqid(rand(), TRUE); |
|
| 549 | 549 | $this->eol = $GLOBALS['_qmail_compatibility'] == "Y" ? "\n" : "\r\n"; |
| 550 | - $this->header = "Content-Type: multipart/alternative;" . $this->eol . "\tboundary=\"" . $boundary . "\"" . $this->eol . $this->eol; |
|
| 550 | + $this->header = "Content-Type: multipart/alternative;".$this->eol."\tboundary=\"".$boundary."\"".$this->eol.$this->eol; |
|
| 551 | 551 | $this->body = sprintf( |
| 552 | - "--%s" . $this->eol . |
|
| 553 | - "Content-Type: text/plain; charset=utf-8; format=flowed" . $this->eol . |
|
| 554 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
| 555 | - "Content-Disposition: inline" . $this->eol . $this->eol . |
|
| 556 | - "%s" . |
|
| 557 | - "--%s" . $this->eol . |
|
| 558 | - "Content-Type: text/html; charset=utf-8" . $this->eol . |
|
| 559 | - "Content-Transfer-Encoding: base64" . $this->eol . |
|
| 560 | - "Content-Disposition: inline" . $this->eol . $this->eol . |
|
| 561 | - "%s" . |
|
| 562 | - "--%s--" . |
|
| 552 | + "--%s".$this->eol. |
|
| 553 | + "Content-Type: text/plain; charset=utf-8; format=flowed".$this->eol. |
|
| 554 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
| 555 | + "Content-Disposition: inline".$this->eol.$this->eol. |
|
| 556 | + "%s". |
|
| 557 | + "--%s".$this->eol. |
|
| 558 | + "Content-Type: text/html; charset=utf-8".$this->eol. |
|
| 559 | + "Content-Transfer-Encoding: base64".$this->eol. |
|
| 560 | + "Content-Disposition: inline".$this->eol.$this->eol. |
|
| 561 | + "%s". |
|
| 562 | + "--%s--". |
|
| 563 | 563 | "", $boundary, $this->getPlainContent(), $boundary, $this->getHTMLContent(), $boundary |
| 564 | 564 | ); |
| 565 | 565 | $this->procCidAttachments(); |
| 566 | 566 | $this->procAttachments(); |
| 567 | 567 | $headers = sprintf( |
| 568 | - "From: %s" . $this->eol . |
|
| 569 | - "%s" . |
|
| 570 | - "%s" . |
|
| 571 | - "%s" . |
|
| 572 | - "%s" . |
|
| 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) : "" |
|
| 568 | + "From: %s".$this->eol. |
|
| 569 | + "%s". |
|
| 570 | + "%s". |
|
| 571 | + "%s". |
|
| 572 | + "%s". |
|
| 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"; |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | case "gif" : |
| 655 | 655 | case "bmp" : |
| 656 | 656 | case "tiff" : |
| 657 | - return "image/" . strtolower($fileSuffix[1]); |
|
| 657 | + return "image/".strtolower($fileSuffix[1]); |
|
| 658 | 658 | case "css" : |
| 659 | 659 | return "text/css"; |
| 660 | 660 | case "xml" : |
@@ -708,11 +708,11 @@ 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 | } |
| 715 | - return "unknown/" . trim($fileSuffix[0], "."); |
|
| 715 | + return "unknown/".trim($fileSuffix[0], "."); |
|
| 716 | 716 | } |
| 717 | 717 | } |
| 718 | 718 | |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | /** |
| 129 | 129 | * Constructor function |
| 130 | 130 | * |
| 131 | - * @return void |
|
| 131 | + * @return string |
|
| 132 | 132 | */ |
| 133 | 133 | function __construct() |
| 134 | 134 | { |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | $this->point = 0; |
| 40 | 40 | |
| 41 | 41 | $first_page = $cur_page - (int) ($page_count / 2); |
| 42 | - if($first_page < 1) |
|
| 42 | + if ($first_page < 1) |
|
| 43 | 43 | { |
| 44 | 44 | $first_page = 1; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if($total_page > $page_count && $first_page + $page_count - 1 > $total_page) |
|
| 47 | + if ($total_page > $page_count && $first_page + $page_count - 1 > $total_page) |
|
| 48 | 48 | { |
| 49 | 49 | $first_page -= $first_page + $page_count - 1 - $total_page; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $last_page = $total_page; |
| 53 | - if($last_page > $total_page) |
|
| 53 | + if ($last_page > $total_page) |
|
| 54 | 54 | { |
| 55 | 55 | $last_page = $total_page; |
| 56 | 56 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->first_page = $first_page; |
| 59 | 59 | $this->last_page = $last_page; |
| 60 | 60 | |
| 61 | - if($total_page < $this->page_count) |
|
| 61 | + if ($total_page < $this->page_count) |
|
| 62 | 62 | { |
| 63 | 63 | $this->page_count = $total_page; |
| 64 | 64 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | function getNextPage() |
| 72 | 72 | { |
| 73 | 73 | $page = $this->first_page + $this->point++; |
| 74 | - if($this->point > $this->page_count || $page > $this->last_page) |
|
| 74 | + if ($this->point > $this->page_count || $page > $this->last_page) |
|
| 75 | 75 | { |
| 76 | 76 | $page = 0; |
| 77 | 77 | } |
@@ -5,24 +5,24 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public function filter($ip_list, $ip = NULL) |
| 7 | 7 | { |
| 8 | - if(!$ip) $ip = $_SERVER['REMOTE_ADDR']; |
|
| 8 | + if (!$ip) $ip = $_SERVER['REMOTE_ADDR']; |
|
| 9 | 9 | $long_ip = ip2long($ip); |
| 10 | - foreach($ip_list as $filter_ip) |
|
| 10 | + foreach ($ip_list as $filter_ip) |
|
| 11 | 11 | { |
| 12 | 12 | $range = explode('-', $filter_ip); |
| 13 | - if(!$range[1]) // single address type |
|
| 13 | + if (!$range[1]) // single address type |
|
| 14 | 14 | { |
| 15 | 15 | $star_pos = strpos($filter_ip, '*'); |
| 16 | - if($star_pos !== FALSE ) // wild card exist |
|
| 16 | + if ($star_pos !== FALSE) // wild card exist |
|
| 17 | 17 | { |
| 18 | - if(strncmp($filter_ip, $ip, $star_pos)===0) return true; |
|
| 18 | + if (strncmp($filter_ip, $ip, $star_pos) === 0) return true; |
|
| 19 | 19 | } |
| 20 | - else if(strcmp($filter_ip, $ip)===0) |
|
| 20 | + else if (strcmp($filter_ip, $ip) === 0) |
|
| 21 | 21 | { |
| 22 | 22 | return true; |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | - else if(ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip) |
|
| 25 | + else if (ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip) |
|
| 26 | 26 | { |
| 27 | 27 | return true; |
| 28 | 28 | } |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | ) |
| 75 | 75 | ) |
| 76 | 76 | $/"; |
| 77 | - $regex = str_replace(array("\r\n", "\n", "\r","\t"," "), '', $regex); |
|
| 77 | + $regex = str_replace(array("\r\n", "\n", "\r", "\t", " "), '', $regex); |
|
| 78 | 78 | |
| 79 | - foreach($ip_list as $i => $ip) |
|
| 79 | + foreach ($ip_list as $i => $ip) |
|
| 80 | 80 | { |
| 81 | 81 | preg_match($regex, $ip, $matches); |
| 82 | - if(!count($matches)) return false; |
|
| 82 | + if (!count($matches)) return false; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return true; |
@@ -5,24 +5,28 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public function filter($ip_list, $ip = NULL) |
| 7 | 7 | { |
| 8 | - if(!$ip) $ip = $_SERVER['REMOTE_ADDR']; |
|
| 8 | + if(!$ip) { |
|
| 9 | + $ip = $_SERVER['REMOTE_ADDR']; |
|
| 10 | + } |
|
| 9 | 11 | $long_ip = ip2long($ip); |
| 10 | 12 | foreach($ip_list as $filter_ip) |
| 11 | 13 | { |
| 12 | 14 | $range = explode('-', $filter_ip); |
| 13 | - if(!$range[1]) // single address type |
|
| 15 | + if(!$range[1]) { |
|
| 16 | + // single address type |
|
| 14 | 17 | { |
| 15 | 18 | $star_pos = strpos($filter_ip, '*'); |
| 16 | - if($star_pos !== FALSE ) // wild card exist |
|
| 19 | + } |
|
| 20 | + if($star_pos !== FALSE ) { |
|
| 21 | + // wild card exist |
|
| 17 | 22 | { |
| 18 | 23 | if(strncmp($filter_ip, $ip, $star_pos)===0) return true; |
| 19 | 24 | } |
| 20 | - else if(strcmp($filter_ip, $ip)===0) |
|
| 25 | + } else if(strcmp($filter_ip, $ip)===0) |
|
| 21 | 26 | { |
| 22 | 27 | return true; |
| 23 | 28 | } |
| 24 | - } |
|
| 25 | - else if(ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip) |
|
| 29 | + } else if(ip2long($range[0]) <= $long_ip && ip2long($range[1]) >= $long_ip) |
|
| 26 | 30 | { |
| 27 | 31 | return true; |
| 28 | 32 | } |
@@ -79,7 +83,9 @@ discard block |
||
| 79 | 83 | foreach($ip_list as $i => $ip) |
| 80 | 84 | { |
| 81 | 85 | preg_match($regex, $ip, $matches); |
| 82 | - if(!count($matches)) return false; |
|
| 86 | + if(!count($matches)) { |
|
| 87 | + return false; |
|
| 88 | + } |
|
| 83 | 89 | } |
| 84 | 90 | |
| 85 | 91 | return true; |