@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | function init() |
18 | 18 | { |
19 | 19 | // Error occurs if already installed |
20 | - if($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled()) |
|
20 | + if ($this->act !== 'procInstallLicenseAggrement' && Context::isInstalled()) |
|
21 | 21 | { |
22 | 22 | $this->stop('msg_already_installed'); |
23 | 23 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | function _procDBSetting() |
87 | 87 | { |
88 | 88 | // Get DB-related variables |
89 | - $con_string = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix'); |
|
89 | + $con_string = Context::gets('db_type', 'db_port', 'db_hostname', 'db_userid', 'db_password', 'db_database', 'db_table_prefix'); |
|
90 | 90 | |
91 | 91 | $db_info = new stdClass(); |
92 | 92 | $db_info->master_db = get_object_vars($con_string); |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | // Check if available to connect to the DB |
102 | 102 | $oDB = &DB::getInstance(); |
103 | 103 | $output = $oDB->getError(); |
104 | - if(!$output->toBool()) return $output; |
|
105 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
104 | + if (!$output->toBool()) return $output; |
|
105 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
106 | 106 | |
107 | 107 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
108 | + if (!$this->makeDBConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
109 | 109 | |
110 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
110 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
111 | 111 | { |
112 | 112 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallConfigForm'); |
113 | 113 | header('location:'.$returnUrl); |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | function procConfigSetting() |
122 | 122 | { |
123 | 123 | // Get variables |
124 | - $config_info = Context::gets('use_rewrite','time_zone'); |
|
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
124 | + $config_info = Context::gets('use_rewrite', 'time_zone'); |
|
125 | + if ($config_info->use_rewrite != 'Y') $config_info->use_rewrite = 'N'; |
|
126 | 126 | |
127 | 127 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed'); |
|
128 | + if (!$this->makeEtcConfigFile($config_info)) return new BaseObject(-1, 'msg_install_failed'); |
|
129 | 129 | |
130 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
130 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
131 | 131 | { |
132 | 132 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallManagerForm'); |
133 | 133 | header('location:'.$returnUrl); |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | function procInstall() |
142 | 142 | { |
143 | 143 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
144 | + if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
145 | 145 | |
146 | 146 | Context::loadLang('modules/member/lang'); |
147 | 147 | $oMemberModel = getModel('member'); |
148 | 148 | $vars = Context::getRequestVars(); |
149 | 149 | |
150 | - if(!$oMemberModel->checkPasswordStrength($vars->password, 'high')) |
|
150 | + if (!$oMemberModel->checkPasswordStrength($vars->password, 'high')) |
|
151 | 151 | { |
152 | 152 | Context::loadLang('modules/member/lang'); |
153 | 153 | $message = Context::getLang('about_password_strength'); |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | Context::set('logged_info', $logged_info); |
161 | 161 | |
162 | 162 | // check install config |
163 | - if(Context::get('install_config')) |
|
163 | + if (Context::get('install_config')) |
|
164 | 164 | { |
165 | 165 | $db_info = $this->_makeDbInfoByInstallConfig(); |
166 | 166 | } |
167 | 167 | // install by default XE UI |
168 | 168 | else |
169 | 169 | { |
170 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
171 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
170 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
171 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | // Set DB type and information |
@@ -176,30 +176,30 @@ discard block |
||
176 | 176 | // Create DB Instance |
177 | 177 | $oDB = &DB::getInstance(); |
178 | 178 | // Check if available to connect to the DB |
179 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
179 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
180 | 180 | |
181 | 181 | // Install all the modules |
182 | 182 | try { |
183 | 183 | $oDB->begin(); |
184 | 184 | $this->installDownloadedModule(); |
185 | 185 | $oDB->commit(); |
186 | - } catch(Exception $e) { |
|
186 | + } catch (Exception $e) { |
|
187 | 187 | $oDB->rollback(); |
188 | 188 | return new BaseObject(-1, $e->getMessage()); |
189 | 189 | } |
190 | 190 | |
191 | 191 | // Create a config file |
192 | - if(!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
192 | + if (!$this->makeConfigFile()) return new BaseObject(-1, 'msg_install_failed'); |
|
193 | 193 | |
194 | 194 | // load script |
195 | - $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
|
196 | - if(count($scripts)>0) |
|
195 | + $scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/'); |
|
196 | + if (count($scripts) > 0) |
|
197 | 197 | { |
198 | 198 | sort($scripts); |
199 | - foreach($scripts as $script) |
|
199 | + foreach ($scripts as $script) |
|
200 | 200 | { |
201 | 201 | $script_path = FileHandler::getRealPath('./modules/install/script/'); |
202 | - $output = include($script_path . $script); |
|
202 | + $output = include($script_path.$script); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | unset($_SESSION['use_rewrite']); |
214 | 214 | |
215 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
215 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
216 | 216 | { |
217 | 217 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); |
218 | 218 | header('location:'.$returnUrl); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $db_info->use_rewrite = Context::get('use_rewrite'); |
243 | 243 | $db_info->time_zone = Context::get('time_zone'); |
244 | 244 | |
245 | - if($_SERVER['HTTPS'] == 'on') |
|
245 | + if ($_SERVER['HTTPS'] == 'on') |
|
246 | 246 | { |
247 | 247 | $https_port = (Context::get('https_port')) ? Context::get('https_port') : $_SERVER['SERVER_PORT']; |
248 | 248 | $https_port = (!$https_port != 443) ? $https_port : null; |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | $http_port = (Context::get('http_port')) ? Context::get('http_port') : $_SERVER['SERVER_PORT']; |
253 | 253 | $http_port = (!$http_port != 80) ? $http_port : null; |
254 | 254 | } |
255 | - if($http_port) $db_info->http_port = $http_port; |
|
256 | - if($https_port) $db_info->https_port = $https_port; |
|
255 | + if ($http_port) $db_info->http_port = $http_port; |
|
256 | + if ($https_port) $db_info->https_port = $https_port; |
|
257 | 257 | |
258 | 258 | return $db_info; |
259 | 259 | } |
@@ -263,57 +263,57 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function procInstallFTP() |
265 | 265 | { |
266 | - if(Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
267 | - $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
|
268 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
269 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
270 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
271 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
266 | + if (Context::isInstalled()) return new BaseObject(-1, 'msg_already_installed'); |
|
267 | + $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); |
|
268 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
269 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
270 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
271 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
272 | 272 | |
273 | 273 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
274 | 274 | $buff[] = "\$ftp_info = new stdClass();"; |
275 | - foreach($ftp_info as $key => $val) |
|
275 | + foreach ($ftp_info as $key => $val) |
|
276 | 276 | { |
277 | - $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); |
|
277 | + $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | // If safe_mode |
281 | - if(ini_get('safe_mode')) |
|
281 | + if (ini_get('safe_mode')) |
|
282 | 282 | { |
283 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
283 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed'); |
|
284 | 284 | |
285 | 285 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
286 | 286 | $oFtp = new ftp(); |
287 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
287 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
288 | 288 | |
289 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
289 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
290 | 290 | { |
291 | 291 | $oFtp->ftp_quit(); |
292 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
292 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
293 | 293 | } |
294 | 294 | |
295 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
295 | + if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
296 | 296 | { |
297 | 297 | $oFtp->ftp_quit(); |
298 | - return new BaseObject(-1,'msg_ftp_mkdir_fail'); |
|
298 | + return new BaseObject(-1, 'msg_ftp_mkdir_fail'); |
|
299 | 299 | } |
300 | 300 | |
301 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
301 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
302 | 302 | { |
303 | 303 | $oFtp->ftp_quit(); |
304 | - return new BaseObject(-1,'msg_ftp_chmod_fail'); |
|
304 | + return new BaseObject(-1, 'msg_ftp_chmod_fail'); |
|
305 | 305 | } |
306 | 306 | |
307 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
307 | + if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
308 | 308 | { |
309 | 309 | $oFtp->ftp_quit(); |
310 | - return new BaseObject(-1,'msg_ftp_mkdir_fail'); |
|
310 | + return new BaseObject(-1, 'msg_ftp_mkdir_fail'); |
|
311 | 311 | } |
312 | 312 | |
313 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
313 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
314 | 314 | { |
315 | 315 | $oFtp->ftp_quit(); |
316 | - return new BaseObject(-1,'msg_ftp_chmod_fail'); |
|
316 | + return new BaseObject(-1, 'msg_ftp_chmod_fail'); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | $oFtp->ftp_quit(); |
@@ -324,31 +324,31 @@ discard block |
||
324 | 324 | |
325 | 325 | function procInstallCheckFtp() |
326 | 326 | { |
327 | - $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
|
328 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
329 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
330 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
327 | + $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); |
|
328 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
329 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
330 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
331 | 331 | |
332 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1,'msg_safe_mode_ftp_needed'); |
|
332 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new BaseObject(-1, 'msg_safe_mode_ftp_needed'); |
|
333 | 333 | |
334 | - if($ftp_info->sftp == 'Y') |
|
334 | + if ($ftp_info->sftp == 'Y') |
|
335 | 335 | { |
336 | 336 | $connection = ssh2_connect('localhost', $ftp_info->ftp_port); |
337 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
337 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
338 | 338 | { |
339 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
339 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
340 | 340 | } |
341 | 341 | } |
342 | 342 | else |
343 | 343 | { |
344 | 344 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
345 | 345 | $oFtp = new ftp(); |
346 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
346 | + if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new BaseObject(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
347 | 347 | |
348 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
348 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
349 | 349 | { |
350 | 350 | $oFtp->ftp_quit(); |
351 | - return new BaseObject(-1,'msg_ftp_invalid_auth_info'); |
|
351 | + return new BaseObject(-1, 'msg_ftp_invalid_auth_info'); |
|
352 | 352 | } |
353 | 353 | $oFtp->ftp_quit(); |
354 | 354 | } |
@@ -365,36 +365,36 @@ discard block |
||
365 | 365 | $checklist = array(); |
366 | 366 | // 0. check your version of php (5.2.4 or higher) |
367 | 367 | $checklist['php_version'] = true; |
368 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
368 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
369 | 369 | { |
370 | 370 | $checklist['php_version'] = false; |
371 | 371 | } |
372 | 372 | |
373 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
373 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
374 | 374 | { |
375 | 375 | Context::set('phpversion_warning', true); |
376 | 376 | } |
377 | 377 | |
378 | 378 | // 1. Check permission |
379 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
379 | + if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; |
|
380 | 380 | else $checklist['permission'] = false; |
381 | 381 | // 2. Check if xml_parser_create exists |
382 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
382 | + if (function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
383 | 383 | else $checklist['xml'] = false; |
384 | 384 | // 3. Check if ini_get (session.auto_start) == 1 |
385 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
385 | + if (ini_get('session.auto_start') != 1) $checklist['session'] = true; |
|
386 | 386 | else $checklist['session'] = false; |
387 | 387 | // 4. Check if iconv exists |
388 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
388 | + if (function_exists('iconv')) $checklist['iconv'] = true; |
|
389 | 389 | else $checklist['iconv'] = false; |
390 | 390 | // 5. Check gd(imagecreatefromgif function) |
391 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
391 | + if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
392 | 392 | else $checklist['gd'] = false; |
393 | 393 | // 6. Check DB |
394 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
394 | + if (DB::getEnableList()) $checklist['db'] = true; |
|
395 | 395 | else $checklist['db'] = false; |
396 | 396 | |
397 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
397 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
398 | 398 | else $install_enable = true; |
399 | 399 | |
400 | 400 | // Save the checked result to the Context |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | |
415 | 415 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false; |
416 | 416 | |
417 | - if($license_agreement) |
|
417 | + if ($license_agreement) |
|
418 | 418 | { |
419 | 419 | $currentTime = $_SERVER['REQUEST_TIME']; |
420 | 420 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | return new BaseObject(-1, 'msg_must_accept_license_agreement'); |
426 | 426 | } |
427 | 427 | |
428 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
428 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
429 | 429 | { |
430 | 430 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); |
431 | 431 | $this->setRedirectUrl($returnUrl); |
@@ -448,25 +448,25 @@ discard block |
||
448 | 448 | $hostname = $_SERVER['SERVER_NAME']; |
449 | 449 | $port = $_SERVER['SERVER_PORT']; |
450 | 450 | $str_port = ''; |
451 | - if($port) |
|
451 | + if ($port) |
|
452 | 452 | { |
453 | - $str_port = ':' . $port; |
|
453 | + $str_port = ':'.$port; |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | $tmpPath = $_SERVER['DOCUMENT_ROOT']; |
457 | 457 | |
458 | 458 | //if DIRECTORY_SEPARATOR is not /(IIS) |
459 | - if(DIRECTORY_SEPARATOR !== '/') |
|
459 | + if (DIRECTORY_SEPARATOR !== '/') |
|
460 | 460 | { |
461 | 461 | //change to slash for compare |
462 | 462 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); |
463 | 463 | } |
464 | 464 | |
465 | - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; |
|
465 | + $query = "/JUST/CHECK/REWRITE/".$checkFilePath; |
|
466 | 466 | $currentPath = str_replace($tmpPath, "", _XE_PATH_); |
467 | - if($currentPath != "") |
|
467 | + if ($currentPath != "") |
|
468 | 468 | { |
469 | - $query = $currentPath . $query; |
|
469 | + $query = $currentPath.$query; |
|
470 | 470 | } |
471 | 471 | $requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); |
472 | 472 | $requestConfig = array(); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | './files/cache/template_compiled', |
492 | 492 | ); |
493 | 493 | |
494 | - foreach($directory_list as $dir) |
|
494 | + foreach ($directory_list as $dir) |
|
495 | 495 | { |
496 | 496 | FileHandler::makeDir($dir); |
497 | 497 | } |
@@ -507,57 +507,57 @@ discard block |
||
507 | 507 | $oModuleModel = getModel('module'); |
508 | 508 | // Create a table ny finding schemas/*.xml file in each module |
509 | 509 | $module_list = FileHandler::readDir('./modules/', NULL, false, true); |
510 | - foreach($module_list as $module_path) |
|
510 | + foreach ($module_list as $module_path) |
|
511 | 511 | { |
512 | 512 | // Get module name |
513 | - $tmp_arr = explode('/',$module_path); |
|
514 | - $module = $tmp_arr[count($tmp_arr)-1]; |
|
513 | + $tmp_arr = explode('/', $module_path); |
|
514 | + $module = $tmp_arr[count($tmp_arr) - 1]; |
|
515 | 515 | |
516 | 516 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
517 | - if(!$xml_info) continue; |
|
517 | + if (!$xml_info) continue; |
|
518 | 518 | $modules[$xml_info->category][] = $module; |
519 | 519 | } |
520 | 520 | // Install "module" module in advance |
521 | - $this->installModule('module','./modules/module'); |
|
521 | + $this->installModule('module', './modules/module'); |
|
522 | 522 | $oModule = getClass('module'); |
523 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
523 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
524 | 524 | // Determine the order of module installation depending on category |
525 | - $install_step = array('system','content','member'); |
|
525 | + $install_step = array('system', 'content', 'member'); |
|
526 | 526 | // Install all the remaining modules |
527 | - foreach($install_step as $category) |
|
527 | + foreach ($install_step as $category) |
|
528 | 528 | { |
529 | - if(count($modules[$category])) |
|
529 | + if (count($modules[$category])) |
|
530 | 530 | { |
531 | - foreach($modules[$category] as $module) |
|
531 | + foreach ($modules[$category] as $module) |
|
532 | 532 | { |
533 | - if($module == 'module') continue; |
|
533 | + if ($module == 'module') continue; |
|
534 | 534 | $this->installModule($module, sprintf('./modules/%s', $module)); |
535 | 535 | |
536 | 536 | $oModule = getClass($module); |
537 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
537 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
538 | 538 | { |
539 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
539 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | unset($modules[$category]); |
543 | 543 | } |
544 | 544 | } |
545 | 545 | // Install all the remaining modules |
546 | - if(count($modules)) |
|
546 | + if (count($modules)) |
|
547 | 547 | { |
548 | - foreach($modules as $category => $module_list) |
|
548 | + foreach ($modules as $category => $module_list) |
|
549 | 549 | { |
550 | - if(count($module_list)) |
|
550 | + if (count($module_list)) |
|
551 | 551 | { |
552 | - foreach($module_list as $module) |
|
552 | + foreach ($module_list as $module) |
|
553 | 553 | { |
554 | - if($module == 'module') continue; |
|
554 | + if ($module == 'module') continue; |
|
555 | 555 | $this->installModule($module, sprintf('./modules/%s', $module)); |
556 | 556 | |
557 | 557 | $oModule = getClass($module); |
558 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
558 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
559 | 559 | { |
560 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
560 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
561 | 561 | } |
562 | 562 | } |
563 | 563 | } |
@@ -579,31 +579,31 @@ discard block |
||
579 | 579 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); |
580 | 580 | |
581 | 581 | $file_cnt = count($schema_files); |
582 | - for($i=0;$i<$file_cnt;$i++) |
|
582 | + for ($i = 0; $i < $file_cnt; $i++) |
|
583 | 583 | { |
584 | 584 | $file = trim($schema_files[$i]); |
585 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
585 | + if (!$file || substr($file, -4) != '.xml') continue; |
|
586 | 586 | $output = $oDB->createTableByXmlFile($file); |
587 | - if($output === false) |
|
587 | + if ($output === false) |
|
588 | 588 | throw new Exception('msg_create_table_failed'); |
589 | 589 | } |
590 | 590 | // Create a table and module instance and then execute install() method |
591 | 591 | unset($oModule); |
592 | 592 | $oModule = getClass($module); |
593 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
593 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
594 | 594 | return new BaseObject(); |
595 | 595 | } |
596 | 596 | |
597 | 597 | function _getDBConfigFileContents($db_info) |
598 | 598 | { |
599 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
599 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
600 | 600 | { |
601 | 601 | $db_info->master_db['db_table_prefix'] .= '_'; |
602 | 602 | } |
603 | 603 | |
604 | - foreach($db_info->slave_db as &$slave) |
|
604 | + foreach ($db_info->slave_db as &$slave) |
|
605 | 605 | { |
606 | - if(substr($slave['db_table_prefix'], -1) != '_') |
|
606 | + if (substr($slave['db_table_prefix'], -1) != '_') |
|
607 | 607 | { |
608 | 608 | $slave['db_table_prefix'] .= '_'; |
609 | 609 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | |
612 | 612 | $buff = array(); |
613 | 613 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
614 | - $buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';'; |
|
614 | + $buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';'; |
|
615 | 615 | |
616 | 616 | return implode(PHP_EOL, $buff); |
617 | 617 | } |
@@ -625,13 +625,13 @@ discard block |
||
625 | 625 | $db_tmp_config_file = $this->db_tmp_config_file; |
626 | 626 | |
627 | 627 | $db_info = Context::getDBInfo(); |
628 | - if(!$db_info) return; |
|
628 | + if (!$db_info) return; |
|
629 | 629 | |
630 | 630 | $buff = $this->_getDBConfigFileContents($db_info); |
631 | 631 | |
632 | 632 | FileHandler::writeFile($db_tmp_config_file, $buff); |
633 | 633 | |
634 | - if(@file_exists($db_tmp_config_file)) return true; |
|
634 | + if (@file_exists($db_tmp_config_file)) return true; |
|
635 | 635 | return false; |
636 | 636 | } |
637 | 637 | |
@@ -644,14 +644,14 @@ discard block |
||
644 | 644 | $etc_tmp_config_file = $this->etc_tmp_config_file; |
645 | 645 | |
646 | 646 | $buff = '<?php if(!defined("__XE__")) exit();'."\n"; |
647 | - foreach($config_info as $key => $val) |
|
647 | + foreach ($config_info as $key => $val) |
|
648 | 648 | { |
649 | - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
649 | + $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
653 | 653 | |
654 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
654 | + if (@file_exists($etc_tmp_config_file)) return true; |
|
655 | 655 | return false; |
656 | 656 | } |
657 | 657 | |
@@ -666,13 +666,13 @@ discard block |
||
666 | 666 | //if(file_exists($config_file)) return; |
667 | 667 | |
668 | 668 | $db_info = Context::getDBInfo(); |
669 | - if(!$db_info) return; |
|
669 | + if (!$db_info) return; |
|
670 | 670 | |
671 | 671 | $buff = $this->_getDBConfigFileContents($db_info); |
672 | 672 | |
673 | 673 | FileHandler::writeFile($config_file, $buff); |
674 | 674 | |
675 | - if(@file_exists($config_file)) |
|
675 | + if (@file_exists($config_file)) |
|
676 | 676 | { |
677 | 677 | FileHandler::removeFile($this->db_tmp_config_file); |
678 | 678 | FileHandler::removeFile($this->etc_tmp_config_file); |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | function installByConfig($install_config_file) |
688 | 688 | { |
689 | 689 | include $install_config_file; |
690 | - if(!is_array($auto_config)) return false; |
|
690 | + if (!is_array($auto_config)) return false; |
|
691 | 691 | |
692 | 692 | $auto_config['module'] = 'install'; |
693 | 693 | $auto_config['act'] = 'procInstall'; |
@@ -695,22 +695,22 @@ discard block |
||
695 | 695 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n"; |
696 | 696 | $fheader = "POST %s HTTP/1.1\r\nHost: %s\r\nContent-Type: application/xml\r\nContent-Length: %s\r\n\r\n%s\r\n"; |
697 | 697 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
698 | - foreach($auto_config as $k => $v) |
|
698 | + foreach ($auto_config as $k => $v) |
|
699 | 699 | { |
700 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
700 | + if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); |
|
701 | 701 | } |
702 | 702 | $body .= "</params>\r\n</methodCall>"; |
703 | 703 | |
704 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); |
|
704 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body); |
|
705 | 705 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); |
706 | 706 | |
707 | - if($fp) |
|
707 | + if ($fp) |
|
708 | 708 | { |
709 | 709 | fputs($fp, $header); |
710 | - while(!feof($fp)) |
|
710 | + while (!feof($fp)) |
|
711 | 711 | { |
712 | 712 | $line = trim(fgets($fp, 4096)); |
713 | - if(strncmp('<error>', $line, 7) === 0) |
|
713 | + if (strncmp('<error>', $line, 7) === 0) |
|
714 | 714 | { |
715 | 715 | fclose($fp); |
716 | 716 | return false; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * Return whether support or not support cache |
57 | 57 | * |
58 | - * @return true |
|
58 | + * @return boolean |
|
59 | 59 | */ |
60 | 60 | function isSupport() |
61 | 61 | { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * Truncate all existing variables at the cache |
166 | 166 | * |
167 | - * @return bool Returns true on success or false on failure. |
|
167 | + * @return boolean|null Returns true on success or false on failure. |
|
168 | 168 | */ |
169 | 169 | function truncate() |
170 | 170 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function getInstance() |
25 | 25 | { |
26 | - if(!$GLOBALS['__CacheFile__']) |
|
26 | + if (!$GLOBALS['__CacheFile__']) |
|
27 | 27 | { |
28 | 28 | $GLOBALS['__CacheFile__'] = new CacheFile(); |
29 | 29 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function __construct() |
39 | 39 | { |
40 | - $this->cache_dir = _XE_PATH_ . $this->cache_dir; |
|
40 | + $this->cache_dir = _XE_PATH_.$this->cache_dir; |
|
41 | 41 | FileHandler::makeDir($this->cache_dir); |
42 | 42 | } |
43 | 43 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function getCacheFileName($key) |
51 | 51 | { |
52 | - return $this->cache_dir . str_replace(':', DIRECTORY_SEPARATOR, $key) . '.php'; |
|
52 | + return $this->cache_dir.str_replace(':', DIRECTORY_SEPARATOR, $key).'.php'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $content = array(); |
77 | 77 | $content[] = '<?php'; |
78 | 78 | $content[] = 'if(!defined(\'__XE__\')) { exit(); }'; |
79 | - $content[] = 'return \'' . addslashes(serialize($obj)) . '\';'; |
|
79 | + $content[] = 'return \''.addslashes(serialize($obj)).'\';'; |
|
80 | 80 | FileHandler::writeFile($cache_file, implode(PHP_EOL, $content)); |
81 | - if(function_exists('opcache_invalidate')) |
|
81 | + if (function_exists('opcache_invalidate')) |
|
82 | 82 | { |
83 | 83 | @opcache_invalidate($cache_file, true); |
84 | 84 | } |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | { |
96 | 96 | $cache_file = $this->getCacheFileName($key); |
97 | 97 | |
98 | - if(file_exists($cache_file)) |
|
98 | + if (file_exists($cache_file)) |
|
99 | 99 | { |
100 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
100 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
101 | 101 | { |
102 | 102 | FileHandler::removeFile($cache_file); |
103 | 103 | return false; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function get($key, $modified_time = 0) |
120 | 120 | { |
121 | - if(!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
121 | + if (!$cache_file = FileHandler::exists($this->getCacheFileName($key))) |
|
122 | 122 | { |
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
126 | + if ($modified_time > 0 && filemtime($cache_file) < $modified_time) |
|
127 | 127 | { |
128 | 128 | FileHandler::removeFile($cache_file); |
129 | 129 | return false; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | function _delete($_key) |
144 | 144 | { |
145 | 145 | $cache_file = $this->getCacheFileName($_key); |
146 | - if(function_exists('opcache_invalidate')) |
|
146 | + if (function_exists('opcache_invalidate')) |
|
147 | 147 | { |
148 | 148 | @opcache_invalidate($cache_file, true); |
149 | 149 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * |
36 | 36 | * Do not use this directly. You can use getInstance() instead. |
37 | 37 | * @param string $url url of memcache |
38 | - * @return void |
|
38 | + * @return false|null |
|
39 | 39 | */ |
40 | 40 | function __construct($url) |
41 | 41 | { |
@@ -97,6 +97,9 @@ |
||
97 | 97 | return $this->pipe . ' ' . $this->getConditionPart($this->_value); |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param string $pipe |
|
102 | + */ |
|
100 | 103 | function setPipe($pipe) |
101 | 104 | { |
102 | 105 | $this->pipe = $pipe; |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function toString($withValue = true) |
63 | 63 | { |
64 | - if(!isset($this->_value_to_string)) |
|
64 | + if (!isset($this->_value_to_string)) |
|
65 | 65 | { |
66 | - if(!$this->show()) |
|
66 | + if (!$this->show()) |
|
67 | 67 | { |
68 | 68 | $this->_value_to_string = ''; |
69 | 69 | } |
70 | - else if($withValue) |
|
70 | + else if ($withValue) |
|
71 | 71 | { |
72 | 72 | $this->_value_to_string = $this->toStringWithValue(); |
73 | 73 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function toStringWithoutValue() |
87 | 87 | { |
88 | - return $this->pipe . ' ' . $this->getConditionPart($this->_value); |
|
88 | + return $this->pipe.' '.$this->getConditionPart($this->_value); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function toStringWithValue() |
96 | 96 | { |
97 | - return $this->pipe . ' ' . $this->getConditionPart($this->_value); |
|
97 | + return $this->pipe.' '.$this->getConditionPart($this->_value); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | function setPipe($pipe) |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | */ |
108 | 108 | function show() |
109 | 109 | { |
110 | - if(!isset($this->_show)) |
|
110 | + if (!isset($this->_show)) |
|
111 | 111 | { |
112 | - if(is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') |
|
112 | + if (is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') |
|
113 | 113 | { |
114 | 114 | $this->_show = false; |
115 | 115 | } |
116 | 116 | else |
117 | 117 | { |
118 | 118 | $this->_show = true; |
119 | - switch($this->operation) |
|
119 | + switch ($this->operation) |
|
120 | 120 | { |
121 | 121 | case 'equal' : |
122 | 122 | case 'more' : |
@@ -138,30 +138,30 @@ discard block |
||
138 | 138 | case 'not': |
139 | 139 | case 'notequal' : |
140 | 140 | // if variable is not set or is not string or number, return |
141 | - if(!isset($this->_value)) |
|
141 | + if (!isset($this->_value)) |
|
142 | 142 | { |
143 | 143 | $this->_show = false; |
144 | 144 | break; |
145 | 145 | } |
146 | - if($this->_value === '') |
|
146 | + if ($this->_value === '') |
|
147 | 147 | { |
148 | 148 | $this->_show = false; |
149 | 149 | break; |
150 | 150 | } |
151 | 151 | $tmpArray = array('string' => 1, 'integer' => 1); |
152 | - if(!isset($tmpArray[gettype($this->_value)])) |
|
152 | + if (!isset($tmpArray[gettype($this->_value)])) |
|
153 | 153 | { |
154 | 154 | $this->_show = false; |
155 | 155 | break; |
156 | 156 | } |
157 | 157 | break; |
158 | 158 | case 'between' : |
159 | - if(!is_array($this->_value)) |
|
159 | + if (!is_array($this->_value)) |
|
160 | 160 | { |
161 | 161 | $this->_show = false; |
162 | 162 | break; |
163 | 163 | } |
164 | - if(count($this->_value) != 2) |
|
164 | + if (count($this->_value) != 2) |
|
165 | 165 | { |
166 | 166 | $this->_show = false; |
167 | 167 | break; |
@@ -188,67 +188,67 @@ discard block |
||
188 | 188 | $name = $this->column_name; |
189 | 189 | $operation = $this->operation; |
190 | 190 | |
191 | - switch($operation) |
|
191 | + switch ($operation) |
|
192 | 192 | { |
193 | 193 | case 'equal' : |
194 | - return $name . ' = ' . $value; |
|
194 | + return $name.' = '.$value; |
|
195 | 195 | break; |
196 | 196 | case 'more' : |
197 | - return $name . ' >= ' . $value; |
|
197 | + return $name.' >= '.$value; |
|
198 | 198 | break; |
199 | 199 | case 'excess' : |
200 | - return $name . ' > ' . $value; |
|
200 | + return $name.' > '.$value; |
|
201 | 201 | break; |
202 | 202 | case 'less' : |
203 | - return $name . ' <= ' . $value; |
|
203 | + return $name.' <= '.$value; |
|
204 | 204 | break; |
205 | 205 | case 'below' : |
206 | - return $name . ' < ' . $value; |
|
206 | + return $name.' < '.$value; |
|
207 | 207 | break; |
208 | 208 | case 'like_tail' : |
209 | 209 | case 'like_prefix' : |
210 | 210 | case 'like' : |
211 | - if(defined('__CUBRID_VERSION__') |
|
211 | + if (defined('__CUBRID_VERSION__') |
|
212 | 212 | && __CUBRID_VERSION__ >= '8.4.1') |
213 | - return $name . ' rlike ' . $value; |
|
213 | + return $name.' rlike '.$value; |
|
214 | 214 | else |
215 | - return $name . ' like ' . $value; |
|
215 | + return $name.' like '.$value; |
|
216 | 216 | break; |
217 | 217 | case 'notlike_tail' : |
218 | 218 | case 'notlike_prefix' : |
219 | 219 | case 'notlike' : |
220 | - return $name . ' not like ' . $value; |
|
220 | + return $name.' not like '.$value; |
|
221 | 221 | break; |
222 | 222 | case 'in' : |
223 | - return $name . ' in ' . $value; |
|
223 | + return $name.' in '.$value; |
|
224 | 224 | break; |
225 | 225 | case 'notin' : |
226 | 226 | case 'not_in' : |
227 | - return $name . ' not in ' . $value; |
|
227 | + return $name.' not in '.$value; |
|
228 | 228 | break; |
229 | 229 | case 'notequal' : |
230 | - return $name . ' <> ' . $value; |
|
230 | + return $name.' <> '.$value; |
|
231 | 231 | break; |
232 | 232 | case 'notnull' : |
233 | - return $name . ' is not null'; |
|
233 | + return $name.' is not null'; |
|
234 | 234 | break; |
235 | 235 | case 'null' : |
236 | - return $name . ' is null'; |
|
236 | + return $name.' is null'; |
|
237 | 237 | break; |
238 | 238 | case 'and' : |
239 | - return $name . ' & ' . $value; |
|
239 | + return $name.' & '.$value; |
|
240 | 240 | break; |
241 | 241 | case 'or' : |
242 | - return $name . ' | ' . $value; |
|
242 | + return $name.' | '.$value; |
|
243 | 243 | break; |
244 | 244 | case 'xor' : |
245 | - return $name . ' ^ ' . $value; |
|
245 | + return $name.' ^ '.$value; |
|
246 | 246 | break; |
247 | 247 | case 'not' : |
248 | - return $name . ' ~ ' . $value; |
|
248 | + return $name.' ~ '.$value; |
|
249 | 249 | break; |
250 | 250 | case 'between' : |
251 | - return $name . ' between ' . $value[0] . ' and ' . $value[1]; |
|
251 | + return $name.' between '.$value[0].' and '.$value[1]; |
|
252 | 252 | break; |
253 | 253 | } |
254 | 254 | } |
@@ -66,12 +66,10 @@ discard block |
||
66 | 66 | if(!$this->show()) |
67 | 67 | { |
68 | 68 | $this->_value_to_string = ''; |
69 | - } |
|
70 | - else if($withValue) |
|
69 | + } else if($withValue) |
|
71 | 70 | { |
72 | 71 | $this->_value_to_string = $this->toStringWithValue(); |
73 | - } |
|
74 | - else |
|
72 | + } else |
|
75 | 73 | { |
76 | 74 | $this->_value_to_string = $this->toStringWithoutValue(); |
77 | 75 | } |
@@ -112,8 +110,7 @@ discard block |
||
112 | 110 | if(is_array($this->_value) && count($this->_value) === 1 && $this->_value[0] === '') |
113 | 111 | { |
114 | 112 | $this->_show = false; |
115 | - } |
|
116 | - else |
|
113 | + } else |
|
117 | 114 | { |
118 | 115 | $this->_show = true; |
119 | 116 | switch($this->operation) |
@@ -209,10 +206,11 @@ discard block |
||
209 | 206 | case 'like_prefix' : |
210 | 207 | case 'like' : |
211 | 208 | if(defined('__CUBRID_VERSION__') |
212 | - && __CUBRID_VERSION__ >= '8.4.1') |
|
213 | - return $name . ' rlike ' . $value; |
|
214 | - else |
|
215 | - return $name . ' like ' . $value; |
|
209 | + && __CUBRID_VERSION__ >= '8.4.1') { |
|
210 | + return $name . ' rlike ' . $value; |
|
211 | + } else { |
|
212 | + return $name . ' like ' . $value; |
|
213 | + } |
|
216 | 214 | break; |
217 | 215 | case 'notlike_tail' : |
218 | 216 | case 'notlike_prefix' : |
@@ -12,10 +12,10 @@ |
||
12 | 12 | /** |
13 | 13 | * constructor |
14 | 14 | * @param string $column_name |
15 | - * @param mixed $argument |
|
15 | + * @param integer $argument |
|
16 | 16 | * @param string $operation |
17 | 17 | * @param string $pipe |
18 | - * @return void |
|
18 | + * @return boolean |
|
19 | 19 | */ |
20 | 20 | function __construct($column_name, $argument, $operation, $pipe = "") |
21 | 21 | { |
@@ -21,13 +21,13 @@ |
||
21 | 21 | { |
22 | 22 | parent::__construct($column_name, $argument, $operation, $pipe); |
23 | 23 | $tmpArray = array('in' => 1, 'notin' => 1, 'not_in' => 1); |
24 | - if(isset($tmpArray[$operation])) |
|
24 | + if (isset($tmpArray[$operation])) |
|
25 | 25 | { |
26 | - if(is_array($argument)) |
|
26 | + if (is_array($argument)) |
|
27 | 27 | { |
28 | 28 | $argument = implode($argument, ','); |
29 | 29 | } |
30 | - $this->_value = '(' . $argument . ')'; |
|
30 | + $this->_value = '('.$argument.')'; |
|
31 | 31 | } |
32 | 32 | else |
33 | 33 | { |
@@ -28,8 +28,7 @@ |
||
28 | 28 | $argument = implode($argument, ','); |
29 | 29 | } |
30 | 30 | $this->_value = '(' . $argument . ')'; |
31 | - } |
|
32 | - else |
|
31 | + } else |
|
33 | 32 | { |
34 | 33 | $this->_value = $argument; |
35 | 34 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | /** |
21 | 21 | * constructor |
22 | 22 | * @param string $column_name |
23 | - * @param object $argument |
|
23 | + * @param Argument $argument |
|
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | function __construct($column_name, $argument) |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function getExpression($with_value = true) |
37 | 37 | { |
38 | - if($with_value) |
|
38 | + if ($with_value) |
|
39 | 39 | { |
40 | 40 | return $this->getExpressionWithValue(); |
41 | 41 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | { |
51 | 51 | $value = $this->argument->getValue(); |
52 | 52 | $operation = $this->argument->getColumnOperation(); |
53 | - if(isset($operation)) |
|
53 | + if (isset($operation)) |
|
54 | 54 | { |
55 | 55 | return "$this->column_name = $this->column_name $operation $value"; |
56 | 56 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function getExpressionWithoutValue() |
66 | 66 | { |
67 | 67 | $operation = $this->argument->getColumnOperation(); |
68 | - if(isset($operation)) |
|
68 | + if (isset($operation)) |
|
69 | 69 | { |
70 | 70 | return "$this->column_name = $this->column_name $operation ?"; |
71 | 71 | } |
@@ -76,21 +76,21 @@ discard block |
||
76 | 76 | { |
77 | 77 | // TODO Escape value according to column type instead of variable type |
78 | 78 | $value = $this->argument->getValue(); |
79 | - if(!is_numeric($value)) |
|
79 | + if (!is_numeric($value)) |
|
80 | 80 | { |
81 | - return "'" . $value . "'"; |
|
81 | + return "'".$value."'"; |
|
82 | 82 | } |
83 | 83 | return $value; |
84 | 84 | } |
85 | 85 | |
86 | 86 | function show() |
87 | 87 | { |
88 | - if(!$this->argument) |
|
88 | + if (!$this->argument) |
|
89 | 89 | { |
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | $value = $this->argument->getValue(); |
93 | - if(!isset($value)) |
|
93 | + if (!isset($value)) |
|
94 | 94 | { |
95 | 95 | return false; |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | function getArguments() |
106 | 106 | { |
107 | - if($this->argument) |
|
107 | + if ($this->argument) |
|
108 | 108 | { |
109 | 109 | return array($this->argument); |
110 | 110 | } |
@@ -107,8 +107,7 @@ |
||
107 | 107 | if($this->argument) |
108 | 108 | { |
109 | 109 | return array($this->argument); |
110 | - } |
|
111 | - else |
|
110 | + } else |
|
112 | 111 | { |
113 | 112 | return array(); |
114 | 113 | } |
@@ -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 | { |
@@ -116,7 +116,7 @@ |
||
116 | 116 | * In this case, the column type is retrieved according to argument |
117 | 117 | * value type (using the PHP function is_numeric). |
118 | 118 | * |
119 | - * @return type string |
|
119 | + * @return string string |
|
120 | 120 | */ |
121 | 121 | function getType() |
122 | 122 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | function __construct($name, $value, $operation) |
27 | 27 | { |
28 | 28 | $operationList = array('in' => 1, 'notin' => 1, 'not_in' => 1, 'between' => 1); |
29 | - if(isset($value) && isset($operationList[$operation]) && !is_array($value) && $value != '') |
|
29 | + if (isset($value) && isset($operationList[$operation]) && !is_array($value) && $value != '') |
|
30 | 30 | { |
31 | 31 | $value = str_replace(' ', '', $value); |
32 | 32 | $value = str_replace('\'', '', $value); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function createConditionValue() |
44 | 44 | { |
45 | - if(!isset($this->value)) |
|
45 | + if (!isset($this->value)) |
|
46 | 46 | { |
47 | 47 | return; |
48 | 48 | } |
@@ -50,56 +50,56 @@ discard block |
||
50 | 50 | $operation = $this->operation; |
51 | 51 | $value = $this->value; |
52 | 52 | |
53 | - switch($operation) |
|
53 | + switch ($operation) |
|
54 | 54 | { |
55 | 55 | case 'like_prefix' : |
56 | - if(defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
|
56 | + if (defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
|
57 | 57 | { |
58 | - $this->value = '^' . str_replace('%', '(.*)', preg_quote($value)); |
|
58 | + $this->value = '^'.str_replace('%', '(.*)', preg_quote($value)); |
|
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
62 | - $this->value = $value . '%'; |
|
62 | + $this->value = $value.'%'; |
|
63 | 63 | } |
64 | 64 | break; |
65 | 65 | case 'like_tail' : |
66 | - if(defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
|
66 | + if (defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
|
67 | 67 | { |
68 | - $this->value = str_replace('%', '(.*)', preg_quote($value)) . '$'; |
|
68 | + $this->value = str_replace('%', '(.*)', preg_quote($value)).'$'; |
|
69 | 69 | } |
70 | 70 | else |
71 | 71 | { |
72 | - $this->value = '%' . $value; |
|
72 | + $this->value = '%'.$value; |
|
73 | 73 | } |
74 | 74 | break; |
75 | 75 | case 'like' : |
76 | - if(defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
|
76 | + if (defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
|
77 | 77 | { |
78 | 78 | $this->value = str_replace('%', '(.*)', preg_quote($value)); |
79 | 79 | } |
80 | 80 | else |
81 | 81 | { |
82 | - $this->value = '%' . $value . '%'; |
|
82 | + $this->value = '%'.$value.'%'; |
|
83 | 83 | } |
84 | 84 | break; |
85 | 85 | case 'notlike' : |
86 | - $this->value = '%' . $value . '%'; |
|
86 | + $this->value = '%'.$value.'%'; |
|
87 | 87 | break; |
88 | 88 | case 'notlike_prefix' : |
89 | - $this->value = $value . '%'; |
|
89 | + $this->value = $value.'%'; |
|
90 | 90 | break; |
91 | 91 | case 'notlike_tail' : |
92 | - $this->value = '%' . $value; |
|
92 | + $this->value = '%'.$value; |
|
93 | 93 | break; |
94 | 94 | case 'in': |
95 | - if(!is_array($value)) |
|
95 | + if (!is_array($value)) |
|
96 | 96 | { |
97 | 97 | $this->value = array($value); |
98 | 98 | } |
99 | 99 | break; |
100 | 100 | case 'notin': |
101 | 101 | case 'not_in': |
102 | - if(!is_array($value)) |
|
102 | + if (!is_array($value)) |
|
103 | 103 | { |
104 | 104 | $this->value = array($value); |
105 | 105 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | */ |
121 | 121 | function getType() |
122 | 122 | { |
123 | - if($this->type) |
|
123 | + if ($this->type) |
|
124 | 124 | { |
125 | 125 | return $this->type; |
126 | 126 | } |
127 | - else if(!is_numeric($this->value)) |
|
127 | + else if (!is_numeric($this->value)) |
|
128 | 128 | { |
129 | 129 | return 'varchar'; |
130 | 130 | } |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | |
137 | 137 | function setColumnType($column_type) |
138 | 138 | { |
139 | - if(!isset($this->value)) |
|
139 | + if (!isset($this->value)) |
|
140 | 140 | { |
141 | 141 | return; |
142 | 142 | } |
143 | - if($column_type === '') |
|
143 | + if ($column_type === '') |
|
144 | 144 | { |
145 | 145 | return; |
146 | 146 | } |
@@ -56,8 +56,7 @@ discard block |
||
56 | 56 | if(defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
57 | 57 | { |
58 | 58 | $this->value = '^' . str_replace('%', '(.*)', preg_quote($value)); |
59 | - } |
|
60 | - else |
|
59 | + } else |
|
61 | 60 | { |
62 | 61 | $this->value = $value . '%'; |
63 | 62 | } |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | if(defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
67 | 66 | { |
68 | 67 | $this->value = str_replace('%', '(.*)', preg_quote($value)) . '$'; |
69 | - } |
|
70 | - else |
|
68 | + } else |
|
71 | 69 | { |
72 | 70 | $this->value = '%' . $value; |
73 | 71 | } |
@@ -76,8 +74,7 @@ discard block |
||
76 | 74 | if(defined('__CUBRID_VERSION__') && __CUBRID_VERSION__ >= '8.4.1') |
77 | 75 | { |
78 | 76 | $this->value = str_replace('%', '(.*)', preg_quote($value)); |
79 | - } |
|
80 | - else |
|
77 | + } else |
|
81 | 78 | { |
82 | 79 | $this->value = '%' . $value . '%'; |
83 | 80 | } |
@@ -123,12 +120,10 @@ discard block |
||
123 | 120 | if($this->type) |
124 | 121 | { |
125 | 122 | return $this->type; |
126 | - } |
|
127 | - else if(!is_numeric($this->value)) |
|
123 | + } else if(!is_numeric($this->value)) |
|
128 | 124 | { |
129 | 125 | return 'varchar'; |
130 | - } |
|
131 | - else |
|
126 | + } else |
|
132 | 127 | { |
133 | 128 | return ''; |
134 | 129 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * |
29 | 29 | * @param object $query XML object obtained after reading the XML Query file |
30 | 30 | * @param bool $isSubQuery |
31 | - * @return void |
|
31 | + * @return string |
|
32 | 32 | */ |
33 | 33 | function __construct($query = NULL, $isSubQuery = FALSE) |
34 | 34 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | function __construct($query = NULL, $isSubQuery = FALSE) |
34 | 34 | { |
35 | - if($query) |
|
35 | + if ($query) |
|
36 | 36 | { |
37 | 37 | $this->queryTag = new QueryTag($query, $isSubQuery); |
38 | 38 | } |
@@ -54,17 +54,17 @@ discard block |
||
54 | 54 | $module = ''; |
55 | 55 | |
56 | 56 | $id_args = explode('.', $query_id); |
57 | - if(count($id_args) == 2) |
|
57 | + if (count($id_args) == 2) |
|
58 | 58 | { |
59 | 59 | $target = 'modules'; |
60 | 60 | $module = $id_args[0]; |
61 | 61 | $id = $id_args[1]; |
62 | 62 | } |
63 | - else if(count($id_args) == 3) |
|
63 | + else if (count($id_args) == 3) |
|
64 | 64 | { |
65 | 65 | $target = $id_args[0]; |
66 | 66 | $targetList = array('modules' => 1, 'addons' => 1, 'widgets' => 1); |
67 | - if(!isset($targetList[$target])) |
|
67 | + if (!isset($targetList[$target])) |
|
68 | 68 | { |
69 | 69 | return; |
70 | 70 | } |
@@ -74,33 +74,33 @@ discard block |
||
74 | 74 | |
75 | 75 | // get column properties from the table |
76 | 76 | $table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name); |
77 | - if(!file_exists($table_file)) |
|
77 | + if (!file_exists($table_file)) |
|
78 | 78 | { |
79 | - $searched_list = FileHandler::readDir(_XE_PATH_ . 'modules'); |
|
79 | + $searched_list = FileHandler::readDir(_XE_PATH_.'modules'); |
|
80 | 80 | $searched_count = count($searched_list); |
81 | - for($i = 0; $i < $searched_count; $i++) |
|
81 | + for ($i = 0; $i < $searched_count; $i++) |
|
82 | 82 | { |
83 | 83 | $table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name); |
84 | - if(file_exists($table_file)) |
|
84 | + if (file_exists($table_file)) |
|
85 | 85 | { |
86 | 86 | break; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - if(file_exists($table_file)) |
|
91 | + if (file_exists($table_file)) |
|
92 | 92 | { |
93 | 93 | $table_xml = FileHandler::readFile($table_file); |
94 | 94 | $xml_parser = new XmlParser(); |
95 | 95 | $table_obj = $xml_parser->parse($table_xml); |
96 | - if($table_obj->table) |
|
96 | + if ($table_obj->table) |
|
97 | 97 | { |
98 | - if(isset($table_obj->table->column) && !is_array($table_obj->table->column)) |
|
98 | + if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) |
|
99 | 99 | { |
100 | 100 | $table_obj->table->column = array($table_obj->table->column); |
101 | 101 | } |
102 | 102 | |
103 | - foreach($table_obj->table->column as $k => $v) |
|
103 | + foreach ($table_obj->table->column as $k => $v) |
|
104 | 104 | { |
105 | 105 | $column_type[$v->attrs->name] = $v->attrs->type; |
106 | 106 | } |
@@ -59,8 +59,7 @@ |
||
59 | 59 | $target = 'modules'; |
60 | 60 | $module = $id_args[0]; |
61 | 61 | $id = $id_args[1]; |
62 | - } |
|
63 | - else if(count($id_args) == 3) |
|
62 | + } else if(count($id_args) == 3) |
|
64 | 63 | { |
65 | 64 | $target = $id_args[0]; |
66 | 65 | $targetList = array('modules' => 1, 'addons' => 1, 'widgets' => 1); |