@@ -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 Object(-1, 'msg_install_failed'); |
|
108 | + if (!$this->makeDBConfigFile()) return new Object(-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 Object(-1, 'msg_install_failed'); |
|
128 | + if (!$this->makeEtcConfigFile($config_info)) return new Object(-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,7 +141,7 @@ discard block |
||
141 | 141 | function procInstall() |
142 | 142 | { |
143 | 143 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
144 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
145 | 145 | |
146 | 146 | // Assign a temporary administrator when installing |
147 | 147 | $logged_info = new stdClass(); |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | Context::set('logged_info', $logged_info); |
150 | 150 | |
151 | 151 | // check install config |
152 | - if(Context::get('install_config')) |
|
152 | + if (Context::get('install_config')) |
|
153 | 153 | { |
154 | 154 | $db_info = $this->_makeDbInfoByInstallConfig(); |
155 | 155 | } |
156 | 156 | // install by default XE UI |
157 | 157 | else |
158 | 158 | { |
159 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
159 | + if (FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | + if (FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | // Set DB type and information |
@@ -165,30 +165,30 @@ discard block |
||
165 | 165 | // Create DB Instance |
166 | 166 | $oDB = &DB::getInstance(); |
167 | 167 | // Check if available to connect to the DB |
168 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
168 | + if (!$oDB->isConnected()) return $oDB->getError(); |
|
169 | 169 | |
170 | 170 | // Install all the modules |
171 | 171 | try { |
172 | 172 | $oDB->begin(); |
173 | 173 | $this->installDownloadedModule(); |
174 | 174 | $oDB->commit(); |
175 | - } catch(Exception $e) { |
|
175 | + } catch (Exception $e) { |
|
176 | 176 | $oDB->rollback(); |
177 | 177 | return new Object(-1, $e->getMessage()); |
178 | 178 | } |
179 | 179 | |
180 | 180 | // Create a config file |
181 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
181 | + if (!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
182 | 182 | |
183 | 183 | // load script |
184 | - $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
|
185 | - if(count($scripts)>0) |
|
184 | + $scripts = FileHandler::readDir(_XE_PATH_.'modules/install/script', '/(\.php)$/'); |
|
185 | + if (count($scripts) > 0) |
|
186 | 186 | { |
187 | 187 | sort($scripts); |
188 | - foreach($scripts as $script) |
|
188 | + foreach ($scripts as $script) |
|
189 | 189 | { |
190 | 190 | $script_path = FileHandler::getRealPath('./modules/install/script/'); |
191 | - $output = include($script_path . $script); |
|
191 | + $output = include($script_path.$script); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | unset($_SESSION['use_rewrite']); |
203 | 203 | |
204 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
204 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
205 | 205 | { |
206 | 206 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl(''); |
207 | 207 | header('location:'.$returnUrl); |
@@ -239,57 +239,57 @@ discard block |
||
239 | 239 | */ |
240 | 240 | function procInstallFTP() |
241 | 241 | { |
242 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
243 | - $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
|
244 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
245 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
242 | + if (Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
243 | + $ftp_info = Context::gets('ftp_host', 'ftp_user', 'ftp_password', 'ftp_port', 'ftp_root_path'); |
|
244 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
245 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | + if (!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | + if (!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
248 | 248 | |
249 | 249 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
250 | 250 | $buff[] = "\$ftp_info = new stdClass();"; |
251 | - foreach($ftp_info as $key => $val) |
|
251 | + foreach ($ftp_info as $key => $val) |
|
252 | 252 | { |
253 | - $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'","\\'",$val)); |
|
253 | + $buff[] = sprintf("\$ftp_info->%s='%s';", $key, str_replace("'", "\\'", $val)); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // If safe_mode |
257 | - if(ini_get('safe_mode')) |
|
257 | + if (ini_get('safe_mode')) |
|
258 | 258 | { |
259 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
259 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
260 | 260 | |
261 | 261 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
262 | 262 | $oFtp = new ftp(); |
263 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
263 | + if (!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
264 | 264 | |
265 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
265 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
266 | 266 | { |
267 | 267 | $oFtp->ftp_quit(); |
268 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
268 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
269 | 269 | } |
270 | 270 | |
271 | - if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
271 | + if (!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) |
|
272 | 272 | { |
273 | 273 | $oFtp->ftp_quit(); |
274 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
274 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
275 | 275 | } |
276 | 276 | |
277 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
277 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) |
|
278 | 278 | { |
279 | 279 | $oFtp->ftp_quit(); |
280 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
280 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
281 | 281 | } |
282 | 282 | |
283 | - if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
283 | + if (!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) |
|
284 | 284 | { |
285 | 285 | $oFtp->ftp_quit(); |
286 | - return new Object(-1,'msg_ftp_mkdir_fail'); |
|
286 | + return new Object(-1, 'msg_ftp_mkdir_fail'); |
|
287 | 287 | } |
288 | 288 | |
289 | - if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
289 | + if (!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) |
|
290 | 290 | { |
291 | 291 | $oFtp->ftp_quit(); |
292 | - return new Object(-1,'msg_ftp_chmod_fail'); |
|
292 | + return new Object(-1, 'msg_ftp_chmod_fail'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $oFtp->ftp_quit(); |
@@ -300,31 +300,31 @@ discard block |
||
300 | 300 | |
301 | 301 | function procInstallCheckFtp() |
302 | 302 | { |
303 | - $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
|
304 | - $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
|
305 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
303 | + $ftp_info = Context::gets('ftp_user', 'ftp_password', 'ftp_port', 'sftp'); |
|
304 | + $ftp_info->ftp_port = (int) $ftp_info->ftp_port; |
|
305 | + if (!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | + if (!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
307 | 307 | |
308 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
308 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1, 'msg_safe_mode_ftp_needed'); |
|
309 | 309 | |
310 | - if($ftp_info->sftp == 'Y') |
|
310 | + if ($ftp_info->sftp == 'Y') |
|
311 | 311 | { |
312 | 312 | $connection = ssh2_connect('localhost', $ftp_info->ftp_port); |
313 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
313 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
314 | 314 | { |
315 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
315 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
316 | 316 | } |
317 | 317 | } |
318 | 318 | else |
319 | 319 | { |
320 | 320 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
321 | 321 | $oFtp = new ftp(); |
322 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
322 | + if (!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
323 | 323 | |
324 | - if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
324 | + if (!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
325 | 325 | { |
326 | 326 | $oFtp->ftp_quit(); |
327 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
327 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
328 | 328 | } |
329 | 329 | $oFtp->ftp_quit(); |
330 | 330 | } |
@@ -341,36 +341,36 @@ discard block |
||
341 | 341 | $checklist = array(); |
342 | 342 | // 0. check your version of php (5.2.4 or higher) |
343 | 343 | $checklist['php_version'] = true; |
344 | - if(version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
344 | + if (version_compare(PHP_VERSION, __XE_MIN_PHP_VERSION__, '<')) |
|
345 | 345 | { |
346 | 346 | $checklist['php_version'] = false; |
347 | 347 | } |
348 | 348 | |
349 | - if(version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
349 | + if (version_compare(PHP_VERSION, __XE_RECOMMEND_PHP_VERSION__, '<')) |
|
350 | 350 | { |
351 | 351 | Context::set('phpversion_warning', true); |
352 | 352 | } |
353 | 353 | |
354 | 354 | // 1. Check permission |
355 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
355 | + if (is_writable('./') || is_writable('./files')) $checklist['permission'] = true; |
|
356 | 356 | else $checklist['permission'] = false; |
357 | 357 | // 2. Check if xml_parser_create exists |
358 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
358 | + if (function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
359 | 359 | else $checklist['xml'] = false; |
360 | 360 | // 3. Check if ini_get (session.auto_start) == 1 |
361 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
361 | + if (ini_get('session.auto_start') != 1) $checklist['session'] = true; |
|
362 | 362 | else $checklist['session'] = false; |
363 | 363 | // 4. Check if iconv exists |
364 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
364 | + if (function_exists('iconv')) $checklist['iconv'] = true; |
|
365 | 365 | else $checklist['iconv'] = false; |
366 | 366 | // 5. Check gd(imagecreatefromgif function) |
367 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
367 | + if (function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
368 | 368 | else $checklist['gd'] = false; |
369 | 369 | // 6. Check DB |
370 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
370 | + if (DB::getEnableList()) $checklist['db'] = true; |
|
371 | 371 | else $checklist['db'] = false; |
372 | 372 | |
373 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
373 | + if (!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
374 | 374 | else $install_enable = true; |
375 | 375 | |
376 | 376 | // Save the checked result to the Context |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | |
391 | 391 | $license_agreement = ($vars->license_agreement == 'Y') ? true : false; |
392 | 392 | |
393 | - if($license_agreement) |
|
393 | + if ($license_agreement) |
|
394 | 394 | { |
395 | 395 | $currentTime = $_SERVER['REQUEST_TIME']; |
396 | 396 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | return new Object(-1, 'msg_must_accept_license_agreement'); |
402 | 402 | } |
403 | 403 | |
404 | - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
|
404 | + if (!in_array(Context::getRequestMethod(), array('XMLRPC', 'JSON'))) |
|
405 | 405 | { |
406 | 406 | $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'act', 'dispInstallCheckEnv'); |
407 | 407 | $this->setRedirectUrl($returnUrl); |
@@ -424,25 +424,25 @@ discard block |
||
424 | 424 | $hostname = $_SERVER['SERVER_NAME']; |
425 | 425 | $port = $_SERVER['SERVER_PORT']; |
426 | 426 | $str_port = ''; |
427 | - if($port) |
|
427 | + if ($port) |
|
428 | 428 | { |
429 | - $str_port = ':' . $port; |
|
429 | + $str_port = ':'.$port; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | $tmpPath = $_SERVER['DOCUMENT_ROOT']; |
433 | 433 | |
434 | 434 | //if DIRECTORY_SEPARATOR is not /(IIS) |
435 | - if(DIRECTORY_SEPARATOR !== '/') |
|
435 | + if (DIRECTORY_SEPARATOR !== '/') |
|
436 | 436 | { |
437 | 437 | //change to slash for compare |
438 | 438 | $tmpPath = str_replace(DIRECTORY_SEPARATOR, '/', $_SERVER['DOCUMENT_ROOT']); |
439 | 439 | } |
440 | 440 | |
441 | - $query = "/JUST/CHECK/REWRITE/" . $checkFilePath; |
|
441 | + $query = "/JUST/CHECK/REWRITE/".$checkFilePath; |
|
442 | 442 | $currentPath = str_replace($tmpPath, "", _XE_PATH_); |
443 | - if($currentPath != "") |
|
443 | + if ($currentPath != "") |
|
444 | 444 | { |
445 | - $query = $currentPath . $query; |
|
445 | + $query = $currentPath.$query; |
|
446 | 446 | } |
447 | 447 | $requestUrl = sprintf('%s://%s%s%s', $scheme, $hostname, $str_port, $query); |
448 | 448 | $requestConfig = array(); |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | './files/cache/template_compiled', |
468 | 468 | ); |
469 | 469 | |
470 | - foreach($directory_list as $dir) |
|
470 | + foreach ($directory_list as $dir) |
|
471 | 471 | { |
472 | 472 | FileHandler::makeDir($dir); |
473 | 473 | } |
@@ -483,57 +483,57 @@ discard block |
||
483 | 483 | $oModuleModel = getModel('module'); |
484 | 484 | // Create a table ny finding schemas/*.xml file in each module |
485 | 485 | $module_list = FileHandler::readDir('./modules/', NULL, false, true); |
486 | - foreach($module_list as $module_path) |
|
486 | + foreach ($module_list as $module_path) |
|
487 | 487 | { |
488 | 488 | // Get module name |
489 | - $tmp_arr = explode('/',$module_path); |
|
490 | - $module = $tmp_arr[count($tmp_arr)-1]; |
|
489 | + $tmp_arr = explode('/', $module_path); |
|
490 | + $module = $tmp_arr[count($tmp_arr) - 1]; |
|
491 | 491 | |
492 | 492 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
493 | - if(!$xml_info) continue; |
|
493 | + if (!$xml_info) continue; |
|
494 | 494 | $modules[$xml_info->category][] = $module; |
495 | 495 | } |
496 | 496 | // Install "module" module in advance |
497 | - $this->installModule('module','./modules/module'); |
|
497 | + $this->installModule('module', './modules/module'); |
|
498 | 498 | $oModule = getClass('module'); |
499 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
499 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
500 | 500 | // Determine the order of module installation depending on category |
501 | - $install_step = array('system','content','member'); |
|
501 | + $install_step = array('system', 'content', 'member'); |
|
502 | 502 | // Install all the remaining modules |
503 | - foreach($install_step as $category) |
|
503 | + foreach ($install_step as $category) |
|
504 | 504 | { |
505 | - if(count($modules[$category])) |
|
505 | + if (count($modules[$category])) |
|
506 | 506 | { |
507 | - foreach($modules[$category] as $module) |
|
507 | + foreach ($modules[$category] as $module) |
|
508 | 508 | { |
509 | - if($module == 'module') continue; |
|
509 | + if ($module == 'module') continue; |
|
510 | 510 | $this->installModule($module, sprintf('./modules/%s', $module)); |
511 | 511 | |
512 | 512 | $oModule = getClass($module); |
513 | - if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
513 | + if (is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
|
514 | 514 | { |
515 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
515 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
516 | 516 | } |
517 | 517 | } |
518 | 518 | unset($modules[$category]); |
519 | 519 | } |
520 | 520 | } |
521 | 521 | // Install all the remaining modules |
522 | - if(count($modules)) |
|
522 | + if (count($modules)) |
|
523 | 523 | { |
524 | - foreach($modules as $category => $module_list) |
|
524 | + foreach ($modules as $category => $module_list) |
|
525 | 525 | { |
526 | - if(count($module_list)) |
|
526 | + if (count($module_list)) |
|
527 | 527 | { |
528 | - foreach($module_list as $module) |
|
528 | + foreach ($module_list as $module) |
|
529 | 529 | { |
530 | - if($module == 'module') continue; |
|
530 | + if ($module == 'module') continue; |
|
531 | 531 | $this->installModule($module, sprintf('./modules/%s', $module)); |
532 | 532 | |
533 | 533 | $oModule = getClass($module); |
534 | - if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
534 | + if ($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
|
535 | 535 | { |
536 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
536 | + if ($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | } |
@@ -555,31 +555,31 @@ discard block |
||
555 | 555 | $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); |
556 | 556 | |
557 | 557 | $file_cnt = count($schema_files); |
558 | - for($i=0;$i<$file_cnt;$i++) |
|
558 | + for ($i = 0; $i < $file_cnt; $i++) |
|
559 | 559 | { |
560 | 560 | $file = trim($schema_files[$i]); |
561 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
561 | + if (!$file || substr($file, -4) != '.xml') continue; |
|
562 | 562 | $output = $oDB->createTableByXmlFile($file); |
563 | - if($output === false) |
|
563 | + if ($output === false) |
|
564 | 564 | throw new Exception('msg_create_table_failed'); |
565 | 565 | } |
566 | 566 | // Create a table and module instance and then execute install() method |
567 | 567 | unset($oModule); |
568 | 568 | $oModule = getClass($module); |
569 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
569 | + if (method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
570 | 570 | return new Object(); |
571 | 571 | } |
572 | 572 | |
573 | 573 | function _getDBConfigFileContents($db_info) |
574 | 574 | { |
575 | - if(substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
575 | + if (substr($db_info->master_db['db_table_prefix'], -1) != '_') |
|
576 | 576 | { |
577 | 577 | $db_info->master_db['db_table_prefix'] .= '_'; |
578 | 578 | } |
579 | 579 | |
580 | - foreach($db_info->slave_db as &$slave) |
|
580 | + foreach ($db_info->slave_db as &$slave) |
|
581 | 581 | { |
582 | - if(substr($slave['db_table_prefix'], -1) != '_') |
|
582 | + if (substr($slave['db_table_prefix'], -1) != '_') |
|
583 | 583 | { |
584 | 584 | $slave['db_table_prefix'] .= '_'; |
585 | 585 | } |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | |
588 | 588 | $buff = array(); |
589 | 589 | $buff[] = '<?php if(!defined("__XE__")) exit();'; |
590 | - $buff[] = '$db_info = (object)' . var_export(get_object_vars($db_info), TRUE) . ';'; |
|
590 | + $buff[] = '$db_info = (object)'.var_export(get_object_vars($db_info), TRUE).';'; |
|
591 | 591 | |
592 | 592 | return implode(PHP_EOL, $buff); |
593 | 593 | } |
@@ -601,13 +601,13 @@ discard block |
||
601 | 601 | $db_tmp_config_file = $this->db_tmp_config_file; |
602 | 602 | |
603 | 603 | $db_info = Context::getDBInfo(); |
604 | - if(!$db_info) return; |
|
604 | + if (!$db_info) return; |
|
605 | 605 | |
606 | 606 | $buff = $this->_getDBConfigFileContents($db_info); |
607 | 607 | |
608 | 608 | FileHandler::writeFile($db_tmp_config_file, $buff); |
609 | 609 | |
610 | - if(@file_exists($db_tmp_config_file)) return true; |
|
610 | + if (@file_exists($db_tmp_config_file)) return true; |
|
611 | 611 | return false; |
612 | 612 | } |
613 | 613 | |
@@ -620,14 +620,14 @@ discard block |
||
620 | 620 | $etc_tmp_config_file = $this->etc_tmp_config_file; |
621 | 621 | |
622 | 622 | $buff = '<?php if(!defined("__XE__")) exit();'."\n"; |
623 | - foreach($config_info as $key => $val) |
|
623 | + foreach ($config_info as $key => $val) |
|
624 | 624 | { |
625 | - $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); |
|
625 | + $buff .= sprintf("\$db_info->%s = '%s';\n", $key, str_replace("'", "\\'", $val)); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
629 | 629 | |
630 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
630 | + if (@file_exists($etc_tmp_config_file)) return true; |
|
631 | 631 | return false; |
632 | 632 | } |
633 | 633 | |
@@ -642,13 +642,13 @@ discard block |
||
642 | 642 | //if(file_exists($config_file)) return; |
643 | 643 | |
644 | 644 | $db_info = Context::getDBInfo(); |
645 | - if(!$db_info) return; |
|
645 | + if (!$db_info) return; |
|
646 | 646 | |
647 | 647 | $buff = $this->_getDBConfigFileContents($db_info); |
648 | 648 | |
649 | 649 | FileHandler::writeFile($config_file, $buff); |
650 | 650 | |
651 | - if(@file_exists($config_file)) |
|
651 | + if (@file_exists($config_file)) |
|
652 | 652 | { |
653 | 653 | FileHandler::removeFile($this->db_tmp_config_file); |
654 | 654 | FileHandler::removeFile($this->etc_tmp_config_file); |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | function installByConfig($install_config_file) |
664 | 664 | { |
665 | 665 | include $install_config_file; |
666 | - if(!is_array($auto_config)) return false; |
|
666 | + if (!is_array($auto_config)) return false; |
|
667 | 667 | |
668 | 668 | $auto_config['module'] = 'install'; |
669 | 669 | $auto_config['act'] = 'procInstall'; |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | $fstr = "<%s><![CDATA[%s]]></%s>\r\n"; |
672 | 672 | $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"; |
673 | 673 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
674 | - foreach($auto_config as $k => $v) |
|
674 | + foreach ($auto_config as $k => $v) |
|
675 | 675 | { |
676 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
676 | + if (!in_array($k, array('host', 'port', 'path'))) $body .= sprintf($fstr, $k, $v, $k); |
|
677 | 677 | } |
678 | 678 | $body .= "</params>\r\n</methodCall>"; |
679 | 679 | |
680 | - $header = sprintf($fheader,$auto_config['path'],$auto_config['host'],strlen($body),$body); |
|
680 | + $header = sprintf($fheader, $auto_config['path'], $auto_config['host'], strlen($body), $body); |
|
681 | 681 | $fp = @fsockopen($auto_config['host'], $auto_config['port'], $errno, $errstr, 5); |
682 | 682 | |
683 | - if($fp) |
|
683 | + if ($fp) |
|
684 | 684 | { |
685 | 685 | fputs($fp, $header); |
686 | - while(!feof($fp)) |
|
686 | + while (!feof($fp)) |
|
687 | 687 | { |
688 | 688 | $line = trim(fgets($fp, 4096)); |
689 | - if(strncmp('<error>', $line, 7) === 0) |
|
689 | + if (strncmp('<error>', $line, 7) === 0) |
|
690 | 690 | { |
691 | 691 | fclose($fp); |
692 | 692 | return false; |
@@ -101,11 +101,17 @@ 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()) { |
|
105 | + return $output; |
|
106 | + } |
|
107 | + if(!$oDB->isConnected()) { |
|
108 | + return $oDB->getError(); |
|
109 | + } |
|
106 | 110 | |
107 | 111 | // Create a db temp config file |
108 | - if(!$this->makeDBConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
112 | + if(!$this->makeDBConfigFile()) { |
|
113 | + return new Object(-1, 'msg_install_failed'); |
|
114 | + } |
|
109 | 115 | |
110 | 116 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
111 | 117 | { |
@@ -122,10 +128,14 @@ discard block |
||
122 | 128 | { |
123 | 129 | // Get variables |
124 | 130 | $config_info = Context::gets('use_rewrite','time_zone'); |
125 | - if($config_info->use_rewrite!='Y') $config_info->use_rewrite = 'N'; |
|
131 | + if($config_info->use_rewrite!='Y') { |
|
132 | + $config_info->use_rewrite = 'N'; |
|
133 | + } |
|
126 | 134 | |
127 | 135 | // Create a db temp config file |
128 | - if(!$this->makeEtcConfigFile($config_info)) return new Object(-1, 'msg_install_failed'); |
|
136 | + if(!$this->makeEtcConfigFile($config_info)) { |
|
137 | + return new Object(-1, 'msg_install_failed'); |
|
138 | + } |
|
129 | 139 | |
130 | 140 | if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) |
131 | 141 | { |
@@ -141,7 +151,9 @@ discard block |
||
141 | 151 | function procInstall() |
142 | 152 | { |
143 | 153 | // Check if it is already installed |
144 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
154 | + if(Context::isInstalled()) { |
|
155 | + return new Object(-1, 'msg_already_installed'); |
|
156 | + } |
|
145 | 157 | |
146 | 158 | // Assign a temporary administrator when installing |
147 | 159 | $logged_info = new stdClass(); |
@@ -156,8 +168,12 @@ discard block |
||
156 | 168 | // install by default XE UI |
157 | 169 | else |
158 | 170 | { |
159 | - if(FileHandler::exists($this->db_tmp_config_file)) include $this->db_tmp_config_file; |
|
160 | - if(FileHandler::exists($this->etc_tmp_config_file)) include $this->etc_tmp_config_file; |
|
171 | + if(FileHandler::exists($this->db_tmp_config_file)) { |
|
172 | + include $this->db_tmp_config_file; |
|
173 | + } |
|
174 | + if(FileHandler::exists($this->etc_tmp_config_file)) { |
|
175 | + include $this->etc_tmp_config_file; |
|
176 | + } |
|
161 | 177 | } |
162 | 178 | |
163 | 179 | // Set DB type and information |
@@ -165,7 +181,9 @@ discard block |
||
165 | 181 | // Create DB Instance |
166 | 182 | $oDB = &DB::getInstance(); |
167 | 183 | // Check if available to connect to the DB |
168 | - if(!$oDB->isConnected()) return $oDB->getError(); |
|
184 | + if(!$oDB->isConnected()) { |
|
185 | + return $oDB->getError(); |
|
186 | + } |
|
169 | 187 | |
170 | 188 | // Install all the modules |
171 | 189 | try { |
@@ -178,7 +196,9 @@ discard block |
||
178 | 196 | } |
179 | 197 | |
180 | 198 | // Create a config file |
181 | - if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); |
|
199 | + if(!$this->makeConfigFile()) { |
|
200 | + return new Object(-1, 'msg_install_failed'); |
|
201 | + } |
|
182 | 202 | |
183 | 203 | // load script |
184 | 204 | $scripts = FileHandler::readDir(_XE_PATH_ . 'modules/install/script', '/(\.php)$/'); |
@@ -239,12 +259,20 @@ discard block |
||
239 | 259 | */ |
240 | 260 | function procInstallFTP() |
241 | 261 | { |
242 | - if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); |
|
262 | + if(Context::isInstalled()) { |
|
263 | + return new Object(-1, 'msg_already_installed'); |
|
264 | + } |
|
243 | 265 | $ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path'); |
244 | 266 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
245 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
246 | - if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1'; |
|
247 | - if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/'; |
|
267 | + if(!$ftp_info->ftp_port) { |
|
268 | + $ftp_info->ftp_port = 21; |
|
269 | + } |
|
270 | + if(!$ftp_info->ftp_host) { |
|
271 | + $ftp_info->ftp_host = '127.0.0.1'; |
|
272 | + } |
|
273 | + if(!$ftp_info->ftp_root_path) { |
|
274 | + $ftp_info->ftp_root_path = '/'; |
|
275 | + } |
|
248 | 276 | |
249 | 277 | $buff = array('<?php if(!defined("__XE__")) exit();'); |
250 | 278 | $buff[] = "\$ftp_info = new stdClass();"; |
@@ -256,11 +284,15 @@ discard block |
||
256 | 284 | // If safe_mode |
257 | 285 | if(ini_get('safe_mode')) |
258 | 286 | { |
259 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
287 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
288 | + return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
289 | + } |
|
260 | 290 | |
261 | 291 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
262 | 292 | $oFtp = new ftp(); |
263 | - if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
293 | + if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) { |
|
294 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
295 | + } |
|
264 | 296 | |
265 | 297 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
266 | 298 | { |
@@ -302,10 +334,16 @@ discard block |
||
302 | 334 | { |
303 | 335 | $ftp_info = Context::gets('ftp_user','ftp_password','ftp_port','sftp'); |
304 | 336 | $ftp_info->ftp_port = (int)$ftp_info->ftp_port; |
305 | - if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21; |
|
306 | - if(!$ftp_info->sftp) $ftp_info->sftp = 'N'; |
|
337 | + if(!$ftp_info->ftp_port) { |
|
338 | + $ftp_info->ftp_port = 21; |
|
339 | + } |
|
340 | + if(!$ftp_info->sftp) { |
|
341 | + $ftp_info->sftp = 'N'; |
|
342 | + } |
|
307 | 343 | |
308 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
344 | + if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) { |
|
345 | + return new Object(-1,'msg_safe_mode_ftp_needed'); |
|
346 | + } |
|
309 | 347 | |
310 | 348 | if($ftp_info->sftp == 'Y') |
311 | 349 | { |
@@ -314,12 +352,13 @@ discard block |
||
314 | 352 | { |
315 | 353 | return new Object(-1,'msg_ftp_invalid_auth_info'); |
316 | 354 | } |
317 | - } |
|
318 | - else |
|
355 | + } else |
|
319 | 356 | { |
320 | 357 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
321 | 358 | $oFtp = new ftp(); |
322 | - if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
359 | + if(!$oFtp->ftp_connect('127.0.0.1', $ftp_info->ftp_port)) { |
|
360 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'localhost')); |
|
361 | + } |
|
323 | 362 | |
324 | 363 | if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
325 | 364 | { |
@@ -352,26 +391,47 @@ discard block |
||
352 | 391 | } |
353 | 392 | |
354 | 393 | // 1. Check permission |
355 | - if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; |
|
356 | - else $checklist['permission'] = false; |
|
394 | + if(is_writable('./')||is_writable('./files')) { |
|
395 | + $checklist['permission'] = true; |
|
396 | + } else { |
|
397 | + $checklist['permission'] = false; |
|
398 | + } |
|
357 | 399 | // 2. Check if xml_parser_create exists |
358 | - if(function_exists('xml_parser_create')) $checklist['xml'] = true; |
|
359 | - else $checklist['xml'] = false; |
|
400 | + if(function_exists('xml_parser_create')) { |
|
401 | + $checklist['xml'] = true; |
|
402 | + } else { |
|
403 | + $checklist['xml'] = false; |
|
404 | + } |
|
360 | 405 | // 3. Check if ini_get (session.auto_start) == 1 |
361 | - if(ini_get('session.auto_start')!=1) $checklist['session'] = true; |
|
362 | - else $checklist['session'] = false; |
|
406 | + if(ini_get('session.auto_start')!=1) { |
|
407 | + $checklist['session'] = true; |
|
408 | + } else { |
|
409 | + $checklist['session'] = false; |
|
410 | + } |
|
363 | 411 | // 4. Check if iconv exists |
364 | - if(function_exists('iconv')) $checklist['iconv'] = true; |
|
365 | - else $checklist['iconv'] = false; |
|
412 | + if(function_exists('iconv')) { |
|
413 | + $checklist['iconv'] = true; |
|
414 | + } else { |
|
415 | + $checklist['iconv'] = false; |
|
416 | + } |
|
366 | 417 | // 5. Check gd(imagecreatefromgif function) |
367 | - if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; |
|
368 | - else $checklist['gd'] = false; |
|
418 | + if(function_exists('imagecreatefromgif')) { |
|
419 | + $checklist['gd'] = true; |
|
420 | + } else { |
|
421 | + $checklist['gd'] = false; |
|
422 | + } |
|
369 | 423 | // 6. Check DB |
370 | - if(DB::getEnableList()) $checklist['db'] = true; |
|
371 | - else $checklist['db'] = false; |
|
424 | + if(DB::getEnableList()) { |
|
425 | + $checklist['db'] = true; |
|
426 | + } else { |
|
427 | + $checklist['db'] = false; |
|
428 | + } |
|
372 | 429 | |
373 | - if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) $install_enable = false; |
|
374 | - else $install_enable = true; |
|
430 | + if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session'] || !$checklist['db']) { |
|
431 | + $install_enable = false; |
|
432 | + } else { |
|
433 | + $install_enable = true; |
|
434 | + } |
|
375 | 435 | |
376 | 436 | // Save the checked result to the Context |
377 | 437 | Context::set('checklist', $checklist); |
@@ -394,8 +454,7 @@ discard block |
||
394 | 454 | { |
395 | 455 | $currentTime = $_SERVER['REQUEST_TIME']; |
396 | 456 | FileHandler::writeFile($this->flagLicenseAgreement, $currentTime); |
397 | - } |
|
398 | - else |
|
457 | + } else |
|
399 | 458 | { |
400 | 459 | FileHandler::removeFile($this->flagLicenseAgreement); |
401 | 460 | return new Object(-1, 'msg_must_accept_license_agreement'); |
@@ -490,13 +549,17 @@ discard block |
||
490 | 549 | $module = $tmp_arr[count($tmp_arr)-1]; |
491 | 550 | |
492 | 551 | $xml_info = $oModuleModel->getModuleInfoXml($module); |
493 | - if(!$xml_info) continue; |
|
552 | + if(!$xml_info) { |
|
553 | + continue; |
|
554 | + } |
|
494 | 555 | $modules[$xml_info->category][] = $module; |
495 | 556 | } |
496 | 557 | // Install "module" module in advance |
497 | 558 | $this->installModule('module','./modules/module'); |
498 | 559 | $oModule = getClass('module'); |
499 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
560 | + if($oModule->checkUpdate()) { |
|
561 | + $oModule->moduleUpdate(); |
|
562 | + } |
|
500 | 563 | // Determine the order of module installation depending on category |
501 | 564 | $install_step = array('system','content','member'); |
502 | 565 | // Install all the remaining modules |
@@ -506,13 +569,17 @@ discard block |
||
506 | 569 | { |
507 | 570 | foreach($modules[$category] as $module) |
508 | 571 | { |
509 | - if($module == 'module') continue; |
|
572 | + if($module == 'module') { |
|
573 | + continue; |
|
574 | + } |
|
510 | 575 | $this->installModule($module, sprintf('./modules/%s', $module)); |
511 | 576 | |
512 | 577 | $oModule = getClass($module); |
513 | 578 | if(is_object($oModule) && method_exists($oModule, 'checkUpdate')) |
514 | 579 | { |
515 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
580 | + if($oModule->checkUpdate()) { |
|
581 | + $oModule->moduleUpdate(); |
|
582 | + } |
|
516 | 583 | } |
517 | 584 | } |
518 | 585 | unset($modules[$category]); |
@@ -527,13 +594,17 @@ discard block |
||
527 | 594 | { |
528 | 595 | foreach($module_list as $module) |
529 | 596 | { |
530 | - if($module == 'module') continue; |
|
597 | + if($module == 'module') { |
|
598 | + continue; |
|
599 | + } |
|
531 | 600 | $this->installModule($module, sprintf('./modules/%s', $module)); |
532 | 601 | |
533 | 602 | $oModule = getClass($module); |
534 | 603 | if($oModule && method_exists($oModule, 'checkUpdate') && method_exists($oModule, 'moduleUpdate')) |
535 | 604 | { |
536 | - if($oModule->checkUpdate()) $oModule->moduleUpdate(); |
|
605 | + if($oModule->checkUpdate()) { |
|
606 | + $oModule->moduleUpdate(); |
|
607 | + } |
|
537 | 608 | } |
538 | 609 | } |
539 | 610 | } |
@@ -558,15 +629,20 @@ discard block |
||
558 | 629 | for($i=0;$i<$file_cnt;$i++) |
559 | 630 | { |
560 | 631 | $file = trim($schema_files[$i]); |
561 | - if(!$file || substr($file,-4)!='.xml') continue; |
|
632 | + if(!$file || substr($file,-4)!='.xml') { |
|
633 | + continue; |
|
634 | + } |
|
562 | 635 | $output = $oDB->createTableByXmlFile($file); |
563 | - if($output === false) |
|
564 | - throw new Exception('msg_create_table_failed'); |
|
636 | + if($output === false) { |
|
637 | + throw new Exception('msg_create_table_failed'); |
|
638 | + } |
|
565 | 639 | } |
566 | 640 | // Create a table and module instance and then execute install() method |
567 | 641 | unset($oModule); |
568 | 642 | $oModule = getClass($module); |
569 | - if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); |
|
643 | + if(method_exists($oModule, 'moduleInstall')) { |
|
644 | + $oModule->moduleInstall(); |
|
645 | + } |
|
570 | 646 | return new Object(); |
571 | 647 | } |
572 | 648 | |
@@ -601,13 +677,17 @@ discard block |
||
601 | 677 | $db_tmp_config_file = $this->db_tmp_config_file; |
602 | 678 | |
603 | 679 | $db_info = Context::getDBInfo(); |
604 | - if(!$db_info) return; |
|
680 | + if(!$db_info) { |
|
681 | + return; |
|
682 | + } |
|
605 | 683 | |
606 | 684 | $buff = $this->_getDBConfigFileContents($db_info); |
607 | 685 | |
608 | 686 | FileHandler::writeFile($db_tmp_config_file, $buff); |
609 | 687 | |
610 | - if(@file_exists($db_tmp_config_file)) return true; |
|
688 | + if(@file_exists($db_tmp_config_file)) { |
|
689 | + return true; |
|
690 | + } |
|
611 | 691 | return false; |
612 | 692 | } |
613 | 693 | |
@@ -627,7 +707,9 @@ discard block |
||
627 | 707 | |
628 | 708 | FileHandler::writeFile($etc_tmp_config_file, $buff); |
629 | 709 | |
630 | - if(@file_exists($etc_tmp_config_file)) return true; |
|
710 | + if(@file_exists($etc_tmp_config_file)) { |
|
711 | + return true; |
|
712 | + } |
|
631 | 713 | return false; |
632 | 714 | } |
633 | 715 | |
@@ -642,7 +724,9 @@ discard block |
||
642 | 724 | //if(file_exists($config_file)) return; |
643 | 725 | |
644 | 726 | $db_info = Context::getDBInfo(); |
645 | - if(!$db_info) return; |
|
727 | + if(!$db_info) { |
|
728 | + return; |
|
729 | + } |
|
646 | 730 | |
647 | 731 | $buff = $this->_getDBConfigFileContents($db_info); |
648 | 732 | |
@@ -663,7 +747,9 @@ discard block |
||
663 | 747 | function installByConfig($install_config_file) |
664 | 748 | { |
665 | 749 | include $install_config_file; |
666 | - if(!is_array($auto_config)) return false; |
|
750 | + if(!is_array($auto_config)) { |
|
751 | + return false; |
|
752 | + } |
|
667 | 753 | |
668 | 754 | $auto_config['module'] = 'install'; |
669 | 755 | $auto_config['act'] = 'procInstall'; |
@@ -673,7 +759,9 @@ discard block |
||
673 | 759 | $body = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<methodCall>\r\n<params>\r\n"; |
674 | 760 | foreach($auto_config as $k => $v) |
675 | 761 | { |
676 | - if(!in_array($k,array('host','port','path'))) $body .= sprintf($fstr,$k,$v,$k); |
|
762 | + if(!in_array($k,array('host','port','path'))) { |
|
763 | + $body .= sprintf($fstr,$k,$v,$k); |
|
764 | + } |
|
677 | 765 | } |
678 | 766 | $body .= "</params>\r\n</methodCall>"; |
679 | 767 |
@@ -6,28 +6,28 @@ discard block |
||
6 | 6 | |
7 | 7 | function getSFTPList() |
8 | 8 | { |
9 | - $ftp_info = Context::getRequestVars(); |
|
10 | - if(!$ftp_info->ftp_host) |
|
9 | + $ftp_info = Context::getRequestVars(); |
|
10 | + if (!$ftp_info->ftp_host) |
|
11 | 11 | { |
12 | 12 | $ftp_info->ftp_host = "127.0.0.1"; |
13 | 13 | } |
14 | 14 | |
15 | 15 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
16 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
16 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
17 | 17 | { |
18 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
18 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $sftp = ssh2_sftp($connection); |
22 | 22 | $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
23 | 23 | $dh = @opendir($curpwd); |
24 | - if(!$dh) return new Object(-1, 'msg_ftp_invalid_path'); |
|
24 | + if (!$dh) return new Object(-1, 'msg_ftp_invalid_path'); |
|
25 | 25 | |
26 | 26 | $list = array(); |
27 | - while(($file = readdir($dh)) !== false) |
|
27 | + while (($file = readdir($dh)) !== false) |
|
28 | 28 | { |
29 | - if(!is_dir($curpwd.$file)) continue; |
|
30 | - $list[] = $file . "/"; |
|
29 | + if (!is_dir($curpwd.$file)) continue; |
|
30 | + $list[] = $file."/"; |
|
31 | 31 | } |
32 | 32 | closedir($dh); |
33 | 33 | $this->add('list', $list); |
@@ -35,33 +35,33 @@ discard block |
||
35 | 35 | |
36 | 36 | function getInstallFTPList() |
37 | 37 | { |
38 | - if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
38 | + if (!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
39 | 39 | { |
40 | 40 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
41 | 41 | } |
42 | 42 | $this->pwd = $ftp_info->ftp_root_path; |
43 | - if(!$ftp_info->ftp_host) |
|
43 | + if (!$ftp_info->ftp_host) |
|
44 | 44 | { |
45 | 45 | $ftp_info->ftp_host = "127.0.0.1"; |
46 | 46 | } |
47 | 47 | |
48 | - if($ftp_info->sftp == 'Y') |
|
48 | + if ($ftp_info->sftp == 'Y') |
|
49 | 49 | { |
50 | 50 | return $this->getSFTPList(); |
51 | 51 | } |
52 | 52 | |
53 | 53 | $_list = NULL; |
54 | - if(function_exists('ftp_connect')) |
|
54 | + if (function_exists('ftp_connect')) |
|
55 | 55 | { |
56 | 56 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
57 | - if(!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
58 | - if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
57 | + if (!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
58 | + if (!@ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
59 | 59 | { |
60 | 60 | ftp_close($connection); |
61 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
61 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
62 | 62 | } |
63 | 63 | |
64 | - if($ftp_info->ftp_pasv != "N") |
|
64 | + if ($ftp_info->ftp_pasv != "N") |
|
65 | 65 | { |
66 | 66 | ftp_pasv($connection, true); |
67 | 67 | } |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | { |
74 | 74 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
75 | 75 | $oFtp = new ftp(); |
76 | - if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
76 | + if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
77 | 77 | { |
78 | - if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
78 | + if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
79 | 79 | { |
80 | 80 | $_list = $oFtp->ftp_rawlist($this->pwd); |
81 | 81 | $oFtp->ftp_quit(); |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | else |
84 | 84 | { |
85 | 85 | $oFtp->ftp_quit(); |
86 | - return new Object(-1,'msg_ftp_invalid_auth_info'); |
|
86 | + return new Object(-1, 'msg_ftp_invalid_auth_info'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | $list = array(); |
92 | - if($_list) |
|
92 | + if ($_list) |
|
93 | 93 | { |
94 | - foreach($_list as $k => $v) |
|
94 | + foreach ($_list as $k => $v) |
|
95 | 95 | { |
96 | 96 | $src = new stdClass(); |
97 | 97 | $src->data = $v; |
98 | 98 | $res = Context::convertEncoding($src); |
99 | 99 | $v = $res->data; |
100 | - if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/'; |
|
100 | + if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v, ' '), 1).'/'; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | $this->add('list', $list); |
@@ -21,12 +21,16 @@ discard block |
||
21 | 21 | $sftp = ssh2_sftp($connection); |
22 | 22 | $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
23 | 23 | $dh = @opendir($curpwd); |
24 | - if(!$dh) return new Object(-1, 'msg_ftp_invalid_path'); |
|
24 | + if(!$dh) { |
|
25 | + return new Object(-1, 'msg_ftp_invalid_path'); |
|
26 | + } |
|
25 | 27 | |
26 | 28 | $list = array(); |
27 | 29 | while(($file = readdir($dh)) !== false) |
28 | 30 | { |
29 | - if(!is_dir($curpwd.$file)) continue; |
|
31 | + if(!is_dir($curpwd.$file)) { |
|
32 | + continue; |
|
33 | + } |
|
30 | 34 | $list[] = $file . "/"; |
31 | 35 | } |
32 | 36 | closedir($dh); |
@@ -54,7 +58,9 @@ discard block |
||
54 | 58 | if(function_exists('ftp_connect')) |
55 | 59 | { |
56 | 60 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
57 | - if(!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
61 | + if(!$connection) { |
|
62 | + return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
|
63 | + } |
|
58 | 64 | if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
59 | 65 | { |
60 | 66 | ftp_close($connection); |
@@ -68,8 +74,7 @@ discard block |
||
68 | 74 | |
69 | 75 | $_list = ftp_rawlist($connection, $this->pwd); |
70 | 76 | ftp_close($connection); |
71 | - } |
|
72 | - else |
|
77 | + } else |
|
73 | 78 | { |
74 | 79 | require_once(_XE_PATH_.'libs/ftp.class.php'); |
75 | 80 | $oFtp = new ftp(); |
@@ -79,8 +84,7 @@ discard block |
||
79 | 84 | { |
80 | 85 | $_list = $oFtp->ftp_rawlist($this->pwd); |
81 | 86 | $oFtp->ftp_quit(); |
82 | - } |
|
83 | - else |
|
87 | + } else |
|
84 | 88 | { |
85 | 89 | $oFtp->ftp_quit(); |
86 | 90 | return new Object(-1,'msg_ftp_invalid_auth_info'); |
@@ -97,7 +101,9 @@ discard block |
||
97 | 101 | $src->data = $v; |
98 | 102 | $res = Context::convertEncoding($src); |
99 | 103 | $v = $res->data; |
100 | - if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/'; |
|
104 | + if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) { |
|
105 | + $list[] = substr(strrchr($v,' '),1) . '/'; |
|
106 | + } |
|
101 | 107 | } |
102 | 108 | } |
103 | 109 | $this->add('list', $list); |
@@ -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/ftp.class.php'); |
|
4 | +require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Module installer |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | { |
79 | 79 | $oModel = getModel('autoinstall'); |
80 | 80 | $type = $oModel->getTypeFromPath($this->package->path); |
81 | - if($type == "module") |
|
81 | + if ($type == "module") |
|
82 | 82 | { |
83 | 83 | $output = $this->uninstallModule(); |
84 | - if(!$output->toBool()) |
|
84 | + if (!$output->toBool()) |
|
85 | 85 | { |
86 | 86 | return $output; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | 90 | $output = $this->_connect(); |
91 | - if(!$output->toBool()) |
|
91 | + if (!$output->toBool()) |
|
92 | 92 | { |
93 | 93 | return $output; |
94 | 94 | } |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function _download() |
118 | 118 | { |
119 | - if($this->package->path == ".") |
|
119 | + if ($this->package->path == ".") |
|
120 | 120 | { |
121 | - $this->download_file = $this->temp_dir . "xe.tar"; |
|
121 | + $this->download_file = $this->temp_dir."xe.tar"; |
|
122 | 122 | $this->target_path = ""; |
123 | 123 | $this->download_path = $this->temp_dir; |
124 | 124 | } |
125 | 125 | else |
126 | 126 | { |
127 | 127 | $subpath = trim(substr($this->package->path, 2), '/'); |
128 | - $this->download_file = $this->temp_dir . $subpath . ".tar"; |
|
128 | + $this->download_file = $this->temp_dir.$subpath.".tar"; |
|
129 | 129 | $subpatharr = explode("/", $subpath); |
130 | 130 | array_pop($subpatharr); |
131 | - $this->download_path = $this->temp_dir . implode("/", $subpatharr); |
|
131 | + $this->download_path = $this->temp_dir.implode("/", $subpatharr); |
|
132 | 132 | $this->target_path = implode("/", $subpatharr); |
133 | 133 | } |
134 | 134 | |
@@ -152,17 +152,17 @@ discard block |
||
152 | 152 | $path_array = explode("/", $this->package->path); |
153 | 153 | $target_name = array_pop($path_array); |
154 | 154 | $oModule = getModule($target_name, "class"); |
155 | - if(!$oModule) |
|
155 | + if (!$oModule) |
|
156 | 156 | { |
157 | 157 | return new Object(-1, 'msg_invalid_request'); |
158 | 158 | } |
159 | - if(!method_exists($oModule, "moduleUninstall")) |
|
159 | + if (!method_exists($oModule, "moduleUninstall")) |
|
160 | 160 | { |
161 | 161 | return new Object(-1, 'msg_invalid_request'); |
162 | 162 | } |
163 | 163 | |
164 | 164 | $output = $oModule->moduleUninstall(); |
165 | - if(is_subclass_of($output, 'Object') && !$output->toBool()) |
|
165 | + if (is_subclass_of($output, 'Object') && !$output->toBool()) |
|
166 | 166 | { |
167 | 167 | return $output; |
168 | 168 | } |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | $schema_dir = sprintf('%s/schemas/', $this->package->path); |
171 | 171 | $schema_files = FileHandler::readDir($schema_dir); |
172 | 172 | $oDB = DB::getInstance(); |
173 | - if(is_array($schema_files)) |
|
173 | + if (is_array($schema_files)) |
|
174 | 174 | { |
175 | - foreach($schema_files as $file) |
|
175 | + foreach ($schema_files as $file) |
|
176 | 176 | { |
177 | 177 | $filename_arr = explode(".", $file); |
178 | 178 | $filename = array_shift($filename_arr); |
@@ -192,26 +192,26 @@ discard block |
||
192 | 192 | function installModule() |
193 | 193 | { |
194 | 194 | $path = $this->package->path; |
195 | - if($path != ".") |
|
195 | + if ($path != ".") |
|
196 | 196 | { |
197 | 197 | $path_array = explode("/", $path); |
198 | 198 | $target_name = array_pop($path_array); |
199 | 199 | $type = substr(array_pop($path_array), 0, -1); |
200 | 200 | } |
201 | 201 | |
202 | - if($type == "module") |
|
202 | + if ($type == "module") |
|
203 | 203 | { |
204 | 204 | $oModuleModel = getModel('module'); |
205 | 205 | $oInstallController = getController('install'); |
206 | 206 | $module_path = ModuleHandler::getModulePath($target_name); |
207 | - if($oModuleModel->checkNeedInstall($target_name)) |
|
207 | + if ($oModuleModel->checkNeedInstall($target_name)) |
|
208 | 208 | { |
209 | 209 | $oInstallController->installModule($target_name, $module_path); |
210 | 210 | } |
211 | - if($oModuleModel->checkNeedUpdate($target_name)) |
|
211 | + if ($oModuleModel->checkNeedUpdate($target_name)) |
|
212 | 212 | { |
213 | 213 | $oModule = getModule($target_name, 'class'); |
214 | - if(method_exists($oModule, 'moduleUpdate')) |
|
214 | + if (method_exists($oModule, 'moduleUpdate')) |
|
215 | 215 | { |
216 | 216 | $oModule->moduleUpdate(); |
217 | 217 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $this->_download(); |
232 | 232 | $file_list = $this->_unPack(); |
233 | 233 | $output = $this->_copyDir($file_list); |
234 | - if(!$output->toBool()) |
|
234 | + if (!$output->toBool()) |
|
235 | 235 | { |
236 | 236 | FileHandler::removeDir($this->temp_dir); |
237 | 237 | return $output; |
@@ -249,18 +249,18 @@ discard block |
||
249 | 249 | */ |
250 | 250 | function _unPack() |
251 | 251 | { |
252 | - require_once(_XE_PATH_ . 'libs/tar.class.php'); |
|
252 | + require_once(_XE_PATH_.'libs/tar.class.php'); |
|
253 | 253 | |
254 | 254 | $oTar = new tar(); |
255 | 255 | $oTar->openTAR($this->download_file); |
256 | 256 | |
257 | 257 | $_files = $oTar->files; |
258 | 258 | $file_list = array(); |
259 | - if(is_array($_files)) |
|
259 | + if (is_array($_files)) |
|
260 | 260 | { |
261 | - foreach($_files as $key => $info) |
|
261 | + foreach ($_files as $key => $info) |
|
262 | 262 | { |
263 | - FileHandler::writeFile($this->download_path . "/" . $info['name'], $info['file']); |
|
263 | + FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']); |
|
264 | 264 | $file_list[] = $info['name']; |
265 | 265 | } |
266 | 266 | } |
@@ -278,22 +278,22 @@ discard block |
||
278 | 278 | $real_path = FileHandler::getRealPath($path); |
279 | 279 | $oDir = dir($path); |
280 | 280 | $files = array(); |
281 | - while($file = $oDir->read()) |
|
281 | + while ($file = $oDir->read()) |
|
282 | 282 | { |
283 | - if($file == "." || $file == "..") |
|
283 | + if ($file == "." || $file == "..") |
|
284 | 284 | { |
285 | 285 | continue; |
286 | 286 | } |
287 | 287 | $files[] = $file; |
288 | 288 | } |
289 | 289 | |
290 | - foreach($files as $file) |
|
290 | + foreach ($files as $file) |
|
291 | 291 | { |
292 | - $file_path = $path . "/" . $file; |
|
293 | - if(is_dir(FileHandler::getRealPath($file_path))) |
|
292 | + $file_path = $path."/".$file; |
|
293 | + if (is_dir(FileHandler::getRealPath($file_path))) |
|
294 | 294 | { |
295 | 295 | $output = $this->_removeDir($file_path); |
296 | - if(!$output->toBool()) |
|
296 | + if (!$output->toBool()) |
|
297 | 297 | { |
298 | 298 | return $output; |
299 | 299 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | else |
302 | 302 | { |
303 | 303 | $output = $this->_removeFile($file_path); |
304 | - if(!$output->toBool()) |
|
304 | + if (!$output->toBool()) |
|
305 | 305 | { |
306 | 306 | return $output; |
307 | 307 | } |
@@ -357,17 +357,17 @@ discard block |
||
357 | 357 | */ |
358 | 358 | function _connect() |
359 | 359 | { |
360 | - if(!function_exists('ssh2_connect')) |
|
360 | + if (!function_exists('ssh2_connect')) |
|
361 | 361 | { |
362 | 362 | return new Object(-1, 'msg_sftp_not_supported'); |
363 | 363 | } |
364 | 364 | |
365 | - if(!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') |
|
365 | + if (!$this->ftp_info->ftp_user || !$this->ftp_info->sftp || $this->ftp_info->sftp != 'Y') |
|
366 | 366 | { |
367 | 367 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
368 | 368 | } |
369 | 369 | |
370 | - if($this->ftp_info->ftp_host) |
|
370 | + if ($this->ftp_info->ftp_host) |
|
371 | 371 | { |
372 | 372 | $ftp_host = $this->ftp_info->ftp_host; |
373 | 373 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $ftp_host = "127.0.0.1"; |
377 | 377 | } |
378 | 378 | $this->connection = ssh2_connect($ftp_host, $this->ftp_info->ftp_port); |
379 | - if(!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) |
|
379 | + if (!@ssh2_auth_password($this->connection, $this->ftp_info->ftp_user, $this->ftp_password)) |
|
380 | 380 | { |
381 | 381 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
382 | 382 | } |
@@ -403,13 +403,13 @@ discard block |
||
403 | 403 | */ |
404 | 404 | function _removeFile($path) |
405 | 405 | { |
406 | - if(substr($path, 0, 2) == "./") |
|
406 | + if (substr($path, 0, 2) == "./") |
|
407 | 407 | { |
408 | 408 | $path = substr($path, 2); |
409 | 409 | } |
410 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
410 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
411 | 411 | |
412 | - if(!@ssh2_sftp_unlink($this->sftp, $target_path)) |
|
412 | + if (!@ssh2_sftp_unlink($this->sftp, $target_path)) |
|
413 | 413 | { |
414 | 414 | return new Object(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
415 | 415 | } |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | */ |
425 | 425 | function _removeDir_real($path) |
426 | 426 | { |
427 | - if(substr($path, 0, 2) == "./") |
|
427 | + if (substr($path, 0, 2) == "./") |
|
428 | 428 | { |
429 | 429 | $path = substr($path, 2); |
430 | 430 | } |
431 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
431 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
432 | 432 | |
433 | - if(!@ssh2_sftp_rmdir($this->sftp, $target_path)) |
|
433 | + if (!@ssh2_sftp_rmdir($this->sftp, $target_path)) |
|
434 | 434 | { |
435 | 435 | return new Object(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path)); |
436 | 436 | } |
@@ -445,36 +445,36 @@ discard block |
||
445 | 445 | */ |
446 | 446 | function _copyDir(&$file_list) |
447 | 447 | { |
448 | - if(!$this->ftp_password) |
|
448 | + if (!$this->ftp_password) |
|
449 | 449 | { |
450 | 450 | return new Object(-1, 'msg_ftp_password_input'); |
451 | 451 | } |
452 | 452 | |
453 | 453 | $output = $this->_connect(); |
454 | - if(!$output->toBool()) |
|
454 | + if (!$output->toBool()) |
|
455 | 455 | { |
456 | 456 | return $output; |
457 | 457 | } |
458 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
458 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
459 | 459 | |
460 | - if(is_array($file_list)) |
|
460 | + if (is_array($file_list)) |
|
461 | 461 | { |
462 | - foreach($file_list as $k => $file) |
|
462 | + foreach ($file_list as $k => $file) |
|
463 | 463 | { |
464 | 464 | $org_file = $file; |
465 | - if($this->package->path == ".") |
|
465 | + if ($this->package->path == ".") |
|
466 | 466 | { |
467 | 467 | $file = substr($file, 3); |
468 | 468 | } |
469 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
470 | - $pathname = dirname($target_dir . "/" . $file); |
|
469 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
470 | + $pathname = dirname($target_dir."/".$file); |
|
471 | 471 | |
472 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
472 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
473 | 473 | { |
474 | 474 | ssh2_sftp_mkdir($this->sftp, $pathname, 0755, TRUE); |
475 | 475 | } |
476 | 476 | |
477 | - ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path . "/" . $org_file), $target_dir . "/" . $file); |
|
477 | + ssh2_scp_send($this->connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file); |
|
478 | 478 | } |
479 | 479 | } |
480 | 480 | return new Object(); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | function _connect() |
522 | 522 | { |
523 | - if($this->ftp_info->ftp_host) |
|
523 | + if ($this->ftp_info->ftp_host) |
|
524 | 524 | { |
525 | 525 | $ftp_host = $this->ftp_info->ftp_host; |
526 | 526 | } |
@@ -530,20 +530,20 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | $this->connection = ftp_connect($ftp_host, $this->ftp_info->ftp_port); |
533 | - if(!$this->connection) |
|
533 | + if (!$this->connection) |
|
534 | 534 | { |
535 | 535 | return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
536 | 536 | } |
537 | 537 | |
538 | 538 | $login_result = @ftp_login($this->connection, $this->ftp_info->ftp_user, $this->ftp_password); |
539 | - if(!$login_result) |
|
539 | + if (!$login_result) |
|
540 | 540 | { |
541 | 541 | $this->_close(); |
542 | 542 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
543 | 543 | } |
544 | 544 | |
545 | 545 | $_SESSION['ftp_password'] = $this->ftp_password; |
546 | - if($this->ftp_info->ftp_pasv != "N") |
|
546 | + if ($this->ftp_info->ftp_pasv != "N") |
|
547 | 547 | { |
548 | 548 | ftp_pasv($this->connection, TRUE); |
549 | 549 | } |
@@ -558,15 +558,15 @@ discard block |
||
558 | 558 | */ |
559 | 559 | function _removeFile($path) |
560 | 560 | { |
561 | - if(substr($path, 0, 2) == "./") |
|
561 | + if (substr($path, 0, 2) == "./") |
|
562 | 562 | { |
563 | 563 | $path = substr($path, 2); |
564 | 564 | } |
565 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
565 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
566 | 566 | |
567 | - if(!@ftp_delete($this->connection, $target_path)) |
|
567 | + if (!@ftp_delete($this->connection, $target_path)) |
|
568 | 568 | { |
569 | - return new Object(-1, "failed to delete file " . $path); |
|
569 | + return new Object(-1, "failed to delete file ".$path); |
|
570 | 570 | } |
571 | 571 | return new Object(); |
572 | 572 | } |
@@ -579,15 +579,15 @@ discard block |
||
579 | 579 | */ |
580 | 580 | function _removeDir_real($path) |
581 | 581 | { |
582 | - if(substr($path, 0, 2) == "./") |
|
582 | + if (substr($path, 0, 2) == "./") |
|
583 | 583 | { |
584 | 584 | $path = substr($path, 2); |
585 | 585 | } |
586 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
586 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
587 | 587 | |
588 | - if(!@ftp_rmdir($this->connection, $target_path)) |
|
588 | + if (!@ftp_rmdir($this->connection, $target_path)) |
|
589 | 589 | { |
590 | - return new Object(-1, "failed to delete directory " . $path); |
|
590 | + return new Object(-1, "failed to delete directory ".$path); |
|
591 | 591 | } |
592 | 592 | return new Object(); |
593 | 593 | } |
@@ -610,73 +610,73 @@ discard block |
||
610 | 610 | */ |
611 | 611 | function _copyDir(&$file_list) |
612 | 612 | { |
613 | - if(!$this->ftp_password) |
|
613 | + if (!$this->ftp_password) |
|
614 | 614 | { |
615 | 615 | return new Object(-1, 'msg_ftp_password_input'); |
616 | 616 | } |
617 | 617 | |
618 | 618 | $output = $this->_connect(); |
619 | - if(!$output->toBool()) |
|
619 | + if (!$output->toBool()) |
|
620 | 620 | { |
621 | 621 | return $output; |
622 | 622 | } |
623 | 623 | |
624 | - if(!$this->target_path) |
|
624 | + if (!$this->target_path) |
|
625 | 625 | { |
626 | 626 | $this->target_path = '.'; |
627 | 627 | } |
628 | - if(substr($this->download_path, -1) == '/') |
|
628 | + if (substr($this->download_path, -1) == '/') |
|
629 | 629 | { |
630 | 630 | $this->download_path = substr($this->download_path, 0, -1); |
631 | 631 | } |
632 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
632 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
633 | 633 | |
634 | - if(is_array($file_list)) |
|
634 | + if (is_array($file_list)) |
|
635 | 635 | { |
636 | - foreach($file_list as $k => $file) |
|
636 | + foreach ($file_list as $k => $file) |
|
637 | 637 | { |
638 | - if(!$file) |
|
638 | + if (!$file) |
|
639 | 639 | { |
640 | 640 | continue; |
641 | 641 | } |
642 | 642 | $org_file = $file; |
643 | - if($this->package->path == ".") |
|
643 | + if ($this->package->path == ".") |
|
644 | 644 | { |
645 | 645 | $file = substr($file, 3); |
646 | 646 | } |
647 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
648 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
647 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
648 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
649 | 649 | |
650 | 650 | $real_path = "./"; |
651 | 651 | $ftp_path = $this->ftp_info->ftp_root_path; |
652 | 652 | |
653 | - for($i = 0; $i < count($path_list); $i++) |
|
653 | + for ($i = 0; $i < count($path_list); $i++) |
|
654 | 654 | { |
655 | - if($path_list == "") |
|
655 | + if ($path_list == "") |
|
656 | 656 | { |
657 | 657 | continue; |
658 | 658 | } |
659 | - $real_path .= $path_list[$i] . "/"; |
|
660 | - $ftp_path .= $path_list[$i] . "/"; |
|
661 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
659 | + $real_path .= $path_list[$i]."/"; |
|
660 | + $ftp_path .= $path_list[$i]."/"; |
|
661 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
662 | 662 | { |
663 | - if(!@ftp_mkdir($this->connection, $ftp_path)) |
|
663 | + if (!@ftp_mkdir($this->connection, $ftp_path)) |
|
664 | 664 | { |
665 | 665 | return new Object(-1, "msg_make_directory_failed"); |
666 | 666 | } |
667 | 667 | |
668 | - if(strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') |
|
668 | + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') |
|
669 | 669 | { |
670 | - if(function_exists('ftp_chmod')) |
|
670 | + if (function_exists('ftp_chmod')) |
|
671 | 671 | { |
672 | - if(!ftp_chmod($this->connection, 0755, $ftp_path)) |
|
672 | + if (!ftp_chmod($this->connection, 0755, $ftp_path)) |
|
673 | 673 | { |
674 | 674 | return new Object(-1, "msg_permission_adjust_failed"); |
675 | 675 | } |
676 | 676 | } |
677 | 677 | else |
678 | 678 | { |
679 | - if(!ftp_site($this->connection, "CHMOD 755 " . $ftp_path)) |
|
679 | + if (!ftp_site($this->connection, "CHMOD 755 ".$ftp_path)) |
|
680 | 680 | { |
681 | 681 | return new Object(-1, "msg_permission_adjust_failed"); |
682 | 682 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
687 | - if(!ftp_put($this->connection, $target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file), FTP_BINARY)) |
|
687 | + if (!ftp_put($this->connection, $target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file), FTP_BINARY)) |
|
688 | 688 | { |
689 | 689 | return new Object(-1, "msg_ftp_upload_failed"); |
690 | 690 | } |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | */ |
734 | 734 | function _connect() |
735 | 735 | { |
736 | - if($this->ftp_info->ftp_host) |
|
736 | + if ($this->ftp_info->ftp_host) |
|
737 | 737 | { |
738 | 738 | $ftp_host = $this->ftp_info->ftp_host; |
739 | 739 | } |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | } |
744 | 744 | |
745 | 745 | $this->oFtp = new ftp(); |
746 | - if(!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) |
|
746 | + if (!$this->oFtp->ftp_connect($ftp_host, $this->ftp_info->ftp_port)) |
|
747 | 747 | { |
748 | 748 | return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
749 | 749 | } |
750 | - if(!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) |
|
750 | + if (!$this->oFtp->ftp_login($this->ftp_info->ftp_user, $this->ftp_password)) |
|
751 | 751 | { |
752 | 752 | $this->_close(); |
753 | 753 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
@@ -764,13 +764,13 @@ discard block |
||
764 | 764 | */ |
765 | 765 | function _removeFile($path) |
766 | 766 | { |
767 | - if(substr($path, 0, 2) == "./") |
|
767 | + if (substr($path, 0, 2) == "./") |
|
768 | 768 | { |
769 | 769 | $path = substr($path, 2); |
770 | 770 | } |
771 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
771 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
772 | 772 | |
773 | - if(!$this->oFtp->ftp_delete($target_path)) |
|
773 | + if (!$this->oFtp->ftp_delete($target_path)) |
|
774 | 774 | { |
775 | 775 | return new Object(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
776 | 776 | } |
@@ -784,13 +784,13 @@ discard block |
||
784 | 784 | */ |
785 | 785 | function _removeDir_real($path) |
786 | 786 | { |
787 | - if(substr($path, 0, 2) == "./") |
|
787 | + if (substr($path, 0, 2) == "./") |
|
788 | 788 | { |
789 | 789 | $path = substr($path, 2); |
790 | 790 | } |
791 | - $target_path = $this->ftp_info->ftp_root_path . $path; |
|
791 | + $target_path = $this->ftp_info->ftp_root_path.$path; |
|
792 | 792 | |
793 | - if(!$this->oFtp->ftp_rmdir($target_path)) |
|
793 | + if (!$this->oFtp->ftp_rmdir($target_path)) |
|
794 | 794 | { |
795 | 795 | return new Object(-1, sprintf(Context::getLang('msg_delete_dir_failed'), $path)); |
796 | 796 | } |
@@ -815,50 +815,50 @@ discard block |
||
815 | 815 | */ |
816 | 816 | function _copyDir(&$file_list) |
817 | 817 | { |
818 | - if(!$this->ftp_password) |
|
818 | + if (!$this->ftp_password) |
|
819 | 819 | { |
820 | 820 | return new Object(-1, 'msg_ftp_password_input'); |
821 | 821 | } |
822 | 822 | |
823 | 823 | $output = $this->_connect(); |
824 | - if(!$output->toBool()) |
|
824 | + if (!$output->toBool()) |
|
825 | 825 | { |
826 | 826 | return $output; |
827 | 827 | } |
828 | 828 | |
829 | 829 | $oFtp = &$this->oFtp; |
830 | - $target_dir = $this->ftp_info->ftp_root_path . $this->target_path; |
|
830 | + $target_dir = $this->ftp_info->ftp_root_path.$this->target_path; |
|
831 | 831 | |
832 | - if(is_array($file_list)) |
|
832 | + if (is_array($file_list)) |
|
833 | 833 | { |
834 | - foreach($file_list as $k => $file) |
|
834 | + foreach ($file_list as $k => $file) |
|
835 | 835 | { |
836 | 836 | $org_file = $file; |
837 | - if($this->package->path == ".") |
|
837 | + if ($this->package->path == ".") |
|
838 | 838 | { |
839 | 839 | $file = substr($file, 3); |
840 | 840 | } |
841 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
842 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
841 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
842 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
843 | 843 | |
844 | 844 | $real_path = "./"; |
845 | 845 | $ftp_path = $this->ftp_info->ftp_root_path; |
846 | 846 | |
847 | - for($i = 0; $i < count($path_list); $i++) |
|
847 | + for ($i = 0; $i < count($path_list); $i++) |
|
848 | 848 | { |
849 | - if($path_list == "") |
|
849 | + if ($path_list == "") |
|
850 | 850 | { |
851 | 851 | continue; |
852 | 852 | } |
853 | - $real_path .= $path_list[$i] . "/"; |
|
854 | - $ftp_path .= $path_list[$i] . "/"; |
|
855 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
853 | + $real_path .= $path_list[$i]."/"; |
|
854 | + $ftp_path .= $path_list[$i]."/"; |
|
855 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
856 | 856 | { |
857 | 857 | $oFtp->ftp_mkdir($ftp_path); |
858 | - $oFtp->ftp_site("CHMOD 755 " . $ftp_path); |
|
858 | + $oFtp->ftp_site("CHMOD 755 ".$ftp_path); |
|
859 | 859 | } |
860 | 860 | } |
861 | - $oFtp->ftp_put($target_dir . '/' . $file, FileHandler::getRealPath($this->download_path . "/" . $org_file)); |
|
861 | + $oFtp->ftp_put($target_dir.'/'.$file, FileHandler::getRealPath($this->download_path."/".$org_file)); |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
@@ -903,13 +903,13 @@ discard block |
||
903 | 903 | */ |
904 | 904 | function _removeFile($path) |
905 | 905 | { |
906 | - if(substr($path, 0, 2) == "./") |
|
906 | + if (substr($path, 0, 2) == "./") |
|
907 | 907 | { |
908 | 908 | $path = substr($path, 2); |
909 | 909 | } |
910 | 910 | $target_path = FileHandler::getRealPath($path); |
911 | 911 | |
912 | - if(!FileHandler::removeFile($target_path)) |
|
912 | + if (!FileHandler::removeFile($target_path)) |
|
913 | 913 | { |
914 | 914 | return new Object(-1, sprintf(Context::getLang('msg_delete_file_failed'), $path)); |
915 | 915 | } |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | */ |
924 | 924 | function _removeDir_real($path) |
925 | 925 | { |
926 | - if(substr($path, 0, 2) == "./") |
|
926 | + if (substr($path, 0, 2) == "./") |
|
927 | 927 | { |
928 | 928 | $path = substr($path, 2); |
929 | 929 | } |
@@ -952,38 +952,38 @@ discard block |
||
952 | 952 | function _copyDir(&$file_list) |
953 | 953 | { |
954 | 954 | $output = $this->_connect(); |
955 | - if(!$output->toBool()) |
|
955 | + if (!$output->toBool()) |
|
956 | 956 | { |
957 | 957 | return $output; |
958 | 958 | } |
959 | 959 | $target_dir = $this->target_path; |
960 | 960 | |
961 | - if(is_array($file_list)) |
|
961 | + if (is_array($file_list)) |
|
962 | 962 | { |
963 | - foreach($file_list as $k => $file) |
|
963 | + foreach ($file_list as $k => $file) |
|
964 | 964 | { |
965 | 965 | $org_file = $file; |
966 | - if($this->package->path == ".") |
|
966 | + if ($this->package->path == ".") |
|
967 | 967 | { |
968 | 968 | $file = substr($file, 3); |
969 | 969 | } |
970 | - $path = FileHandler::getRealPath("./" . $this->target_path . "/" . $file); |
|
971 | - $path_list = explode('/', dirname($this->target_path . "/" . $file)); |
|
970 | + $path = FileHandler::getRealPath("./".$this->target_path."/".$file); |
|
971 | + $path_list = explode('/', dirname($this->target_path."/".$file)); |
|
972 | 972 | $real_path = "./"; |
973 | 973 | |
974 | - for($i = 0; $i < count($path_list); $i++) |
|
974 | + for ($i = 0; $i < count($path_list); $i++) |
|
975 | 975 | { |
976 | - if($path_list == "") |
|
976 | + if ($path_list == "") |
|
977 | 977 | { |
978 | 978 | continue; |
979 | 979 | } |
980 | - $real_path .= $path_list[$i] . "/"; |
|
981 | - if(!file_exists(FileHandler::getRealPath($real_path))) |
|
980 | + $real_path .= $path_list[$i]."/"; |
|
981 | + if (!file_exists(FileHandler::getRealPath($real_path))) |
|
982 | 982 | { |
983 | 983 | FileHandler::makeDir($real_path); |
984 | 984 | } |
985 | 985 | } |
986 | - FileHandler::copyFile( FileHandler::getRealPath($this->download_path . "/" . $org_file), FileHandler::getRealPath("./" . $target_dir . '/' . $file)); |
|
986 | + FileHandler::copyFile(FileHandler::getRealPath($this->download_path."/".$org_file), FileHandler::getRealPath("./".$target_dir.'/'.$file)); |
|
987 | 987 | } |
988 | 988 | } |
989 | 989 |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | { |
31 | 31 | $ftp_info = Context::getRequestVars(); |
32 | 32 | |
33 | - if(!$ftp_info->ftp_host) |
|
33 | + if (!$ftp_info->ftp_host) |
|
34 | 34 | { |
35 | 35 | $ftp_info->ftp_host = "127.0.0.1"; |
36 | 36 | } |
37 | 37 | |
38 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
38 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
39 | 39 | { |
40 | 40 | $ftp_info->ftp_port = '22'; |
41 | 41 | } |
42 | 42 | |
43 | 43 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
44 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
44 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
45 | 45 | { |
46 | 46 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
47 | 47 | } |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | $path_candidate = array(); |
59 | 59 | |
60 | 60 | $temp = ''; |
61 | - foreach($path_info as $path) |
|
61 | + foreach ($path_info as $path) |
|
62 | 62 | { |
63 | - $temp = '/' . $path . $temp; |
|
63 | + $temp = '/'.$path.$temp; |
|
64 | 64 | $path_candidate[] = $temp; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // try |
68 | - foreach($path_candidate as $path) |
|
68 | + foreach ($path_candidate as $path) |
|
69 | 69 | { |
70 | 70 | // upload check file |
71 | - if(!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path . 'ftp_check.html')) |
|
71 | + if (!@ssh2_scp_send($connection, FileHandler::getRealPath('./files/cache/ftp_check'), $path.'ftp_check.html')) |
|
72 | 72 | { |
73 | 73 | continue; |
74 | 74 | } |
75 | 75 | |
76 | 76 | // get check file |
77 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
77 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
78 | 78 | |
79 | 79 | // delete temp check file |
80 | - @ssh2_sftp_unlink($sftp, $path . 'ftp_check.html'); |
|
80 | + @ssh2_sftp_unlink($sftp, $path.'ftp_check.html'); |
|
81 | 81 | |
82 | 82 | // found |
83 | - if($result == $pin) |
|
83 | + if ($result == $pin) |
|
84 | 84 | { |
85 | 85 | $found_path = $path; |
86 | 86 | break; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
91 | 91 | |
92 | - if($found_path) |
|
92 | + if ($found_path) |
|
93 | 93 | { |
94 | 94 | $this->add('found_path', $found_path); |
95 | 95 | } |
@@ -99,24 +99,24 @@ discard block |
||
99 | 99 | { |
100 | 100 | $ftp_info = Context::getRequestVars(); |
101 | 101 | |
102 | - if(!$ftp_info->ftp_host) |
|
102 | + if (!$ftp_info->ftp_host) |
|
103 | 103 | { |
104 | 104 | $ftp_info->ftp_host = "127.0.0.1"; |
105 | 105 | } |
106 | 106 | |
107 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
107 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
108 | 108 | { |
109 | 109 | $ftp_info->ftp_port = '22'; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
113 | - if(!$connection) |
|
113 | + if (!$connection) |
|
114 | 114 | { |
115 | 115 | return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
116 | 116 | } |
117 | 117 | |
118 | 118 | $login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password); |
119 | - if(!$login_result) |
|
119 | + if (!$login_result) |
|
120 | 120 | { |
121 | 121 | ftp_close($connection); |
122 | 122 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
@@ -133,29 +133,29 @@ discard block |
||
133 | 133 | $path_candidate = array(); |
134 | 134 | |
135 | 135 | $temp = ''; |
136 | - foreach($path_info as $path) |
|
136 | + foreach ($path_info as $path) |
|
137 | 137 | { |
138 | - $temp = '/' . $path . $temp; |
|
138 | + $temp = '/'.$path.$temp; |
|
139 | 139 | $path_candidate[] = $temp; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // try |
143 | - foreach($path_candidate as $path) |
|
143 | + foreach ($path_candidate as $path) |
|
144 | 144 | { |
145 | 145 | // upload check file |
146 | - if(!ftp_put($connection, $path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
146 | + if (!ftp_put($connection, $path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'), FTP_BINARY)) |
|
147 | 147 | { |
148 | 148 | continue; |
149 | 149 | } |
150 | 150 | |
151 | 151 | // get check file |
152 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
152 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
153 | 153 | |
154 | 154 | // delete temp check file |
155 | - ftp_delete($connection, $path . 'ftp_check.html'); |
|
155 | + ftp_delete($connection, $path.'ftp_check.html'); |
|
156 | 156 | |
157 | 157 | // found |
158 | - if($result == $pin) |
|
158 | + if ($result == $pin) |
|
159 | 159 | { |
160 | 160 | $found_path = $path; |
161 | 161 | break; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
166 | 166 | |
167 | - if($found_path) |
|
167 | + if ($found_path) |
|
168 | 168 | { |
169 | 169 | $this->add('found_path', $found_path); |
170 | 170 | } |
@@ -175,39 +175,39 @@ discard block |
||
175 | 175 | */ |
176 | 176 | function getAdminFTPPath() |
177 | 177 | { |
178 | - Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
178 | + Context::loadLang(_XE_PATH_.'modules/autoinstall/lang'); |
|
179 | 179 | @set_time_limit(5); |
180 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
180 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
181 | 181 | |
182 | 182 | $ftp_info = Context::getRequestVars(); |
183 | 183 | |
184 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
184 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
185 | 185 | { |
186 | 186 | return new Object(1, 'msg_ftp_invalid_auth_info'); |
187 | 187 | } |
188 | 188 | |
189 | - if(!$ftp_info->ftp_host) |
|
189 | + if (!$ftp_info->ftp_host) |
|
190 | 190 | { |
191 | 191 | $ftp_info->ftp_host = '127.0.0.1'; |
192 | 192 | } |
193 | 193 | |
194 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
194 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
195 | 195 | { |
196 | 196 | $ftp_info->ftp_port = '21'; |
197 | 197 | } |
198 | 198 | |
199 | - if($ftp_info->sftp == 'Y') |
|
199 | + if ($ftp_info->sftp == 'Y') |
|
200 | 200 | { |
201 | - if(!function_exists('ssh2_sftp')) |
|
201 | + if (!function_exists('ssh2_sftp')) |
|
202 | 202 | { |
203 | 203 | return new Object(-1, 'disable_sftp_support'); |
204 | 204 | } |
205 | 205 | return $this->getSFTPPath(); |
206 | 206 | } |
207 | 207 | |
208 | - if($ftp_info->ftp_pasv == 'N') |
|
208 | + if ($ftp_info->ftp_pasv == 'N') |
|
209 | 209 | { |
210 | - if(function_exists('ftp_connect')) |
|
210 | + if (function_exists('ftp_connect')) |
|
211 | 211 | { |
212 | 212 | return $this->getFTPPath(); |
213 | 213 | } |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | } |
216 | 216 | |
217 | 217 | $oFTP = new ftp(); |
218 | - if(!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
218 | + if (!$oFTP->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
219 | 219 | { |
220 | 220 | return new Object(1, sprintf(Context::getLang('msg_ftp_not_connected'), 'host')); |
221 | 221 | } |
222 | 222 | |
223 | - if(!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
223 | + if (!$oFTP->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
224 | 224 | { |
225 | 225 | return new Object(1, 'msg_ftp_invalid_auth_info'); |
226 | 226 | } |
@@ -236,29 +236,29 @@ discard block |
||
236 | 236 | $path_candidate = array(); |
237 | 237 | |
238 | 238 | $temp = ''; |
239 | - foreach($path_info as $path) |
|
239 | + foreach ($path_info as $path) |
|
240 | 240 | { |
241 | - $temp = '/' . $path . $temp; |
|
241 | + $temp = '/'.$path.$temp; |
|
242 | 242 | $path_candidate[] = $temp; |
243 | 243 | } |
244 | 244 | |
245 | 245 | // try |
246 | - foreach($path_candidate as $path) |
|
246 | + foreach ($path_candidate as $path) |
|
247 | 247 | { |
248 | 248 | // upload check file |
249 | - if(!$oFTP->ftp_put($path . 'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
249 | + if (!$oFTP->ftp_put($path.'ftp_check.html', FileHandler::getRealPath('./files/cache/ftp_check'))) |
|
250 | 250 | { |
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // get check file |
255 | - $result = FileHandler::getRemoteResource(getNotencodedFullUrl() . 'ftp_check.html'); |
|
255 | + $result = FileHandler::getRemoteResource(getNotencodedFullUrl().'ftp_check.html'); |
|
256 | 256 | |
257 | 257 | // delete temp check file |
258 | - $oFTP->ftp_delete($path . 'ftp_check.html'); |
|
258 | + $oFTP->ftp_delete($path.'ftp_check.html'); |
|
259 | 259 | |
260 | 260 | // found |
261 | - if($result == $pin) |
|
261 | + if ($result == $pin) |
|
262 | 262 | { |
263 | 263 | $found_path = $path; |
264 | 264 | break; |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | FileHandler::removeFile('./files/cache/ftp_check', $pin); |
269 | 269 | |
270 | - if($found_path) |
|
270 | + if ($found_path) |
|
271 | 271 | { |
272 | 272 | $this->add('found_path', $found_path); |
273 | 273 | } |
@@ -280,27 +280,27 @@ discard block |
||
280 | 280 | function getSFTPList() |
281 | 281 | { |
282 | 282 | $ftp_info = Context::getRequestVars(); |
283 | - if(!$ftp_info->ftp_host) |
|
283 | + if (!$ftp_info->ftp_host) |
|
284 | 284 | { |
285 | 285 | $ftp_info->ftp_host = "127.0.0.1"; |
286 | 286 | } |
287 | 287 | $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port); |
288 | - if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
288 | + if (!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
289 | 289 | { |
290 | 290 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
291 | 291 | } |
292 | 292 | |
293 | 293 | $sftp = ssh2_sftp($connection); |
294 | - $curpwd = "ssh2.sftp://$sftp" . $this->pwd; |
|
294 | + $curpwd = "ssh2.sftp://$sftp".$this->pwd; |
|
295 | 295 | $dh = @opendir($curpwd); |
296 | - if(!$dh) |
|
296 | + if (!$dh) |
|
297 | 297 | { |
298 | 298 | return new Object(-1, 'msg_ftp_invalid_path'); |
299 | 299 | } |
300 | 300 | $list = array(); |
301 | - while(($file = readdir($dh)) !== FALSE) |
|
301 | + while (($file = readdir($dh)) !== FALSE) |
|
302 | 302 | { |
303 | - if(is_dir($curpwd . $file)) |
|
303 | + if (is_dir($curpwd.$file)) |
|
304 | 304 | { |
305 | 305 | $file .= "/"; |
306 | 306 | } |
@@ -320,32 +320,32 @@ discard block |
||
320 | 320 | */ |
321 | 321 | function getAdminFTPList() |
322 | 322 | { |
323 | - Context::loadLang(_XE_PATH_ . 'modules/autoinstall/lang'); |
|
323 | + Context::loadLang(_XE_PATH_.'modules/autoinstall/lang'); |
|
324 | 324 | @set_time_limit(5); |
325 | 325 | |
326 | - require_once(_XE_PATH_ . 'libs/ftp.class.php'); |
|
326 | + require_once(_XE_PATH_.'libs/ftp.class.php'); |
|
327 | 327 | |
328 | 328 | $ftp_info = Context::getRequestVars(); |
329 | - if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
329 | + if (!$ftp_info->ftp_user || !$ftp_info->ftp_password) |
|
330 | 330 | { |
331 | 331 | return new Object(-1, 'msg_ftp_invalid_auth_info'); |
332 | 332 | } |
333 | 333 | |
334 | 334 | $this->pwd = $ftp_info->ftp_root_path; |
335 | 335 | |
336 | - if(!$ftp_info->ftp_host) |
|
336 | + if (!$ftp_info->ftp_host) |
|
337 | 337 | { |
338 | 338 | $ftp_info->ftp_host = "127.0.0.1"; |
339 | 339 | } |
340 | 340 | |
341 | - if(!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
341 | + if (!$ftp_info->ftp_port || !is_numeric($ftp_info->ftp_port)) |
|
342 | 342 | { |
343 | 343 | $ftp_info->ftp_port = "21"; |
344 | 344 | } |
345 | 345 | |
346 | - if($ftp_info->sftp == 'Y') |
|
346 | + if ($ftp_info->sftp == 'Y') |
|
347 | 347 | { |
348 | - if(!function_exists('ssh2_sftp')) |
|
348 | + if (!function_exists('ssh2_sftp')) |
|
349 | 349 | { |
350 | 350 | return new Object(-1, 'disable_sftp_support'); |
351 | 351 | } |
@@ -353,9 +353,9 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | $oFtp = new ftp(); |
356 | - if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
356 | + if ($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) |
|
357 | 357 | { |
358 | - if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
358 | + if ($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) |
|
359 | 359 | { |
360 | 360 | $_list = $oFtp->ftp_rawlist($this->pwd); |
361 | 361 | $oFtp->ftp_quit(); |
@@ -367,17 +367,17 @@ discard block |
||
367 | 367 | } |
368 | 368 | $list = array(); |
369 | 369 | |
370 | - if($_list) |
|
370 | + if ($_list) |
|
371 | 371 | { |
372 | - foreach($_list as $k => $v) |
|
372 | + foreach ($_list as $k => $v) |
|
373 | 373 | { |
374 | 374 | $src = new stdClass(); |
375 | 375 | $src->data = $v; |
376 | 376 | $res = Context::convertEncoding($src); |
377 | 377 | $v = $res->data; |
378 | - if(strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
378 | + if (strpos($v, 'd') === 0 || strpos($v, '<DIR>')) |
|
379 | 379 | { |
380 | - $list[] = substr(strrchr($v, ' '), 1) . '/'; |
|
380 | + $list[] = substr(strrchr($v, ' '), 1).'/'; |
|
381 | 381 | } |
382 | 382 | } |
383 | 383 | } |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | , 'module' => array('addon', 'admin', 'autoinstall', 'comment', 'communication', 'counter', 'document', 'editor', 'file', 'importer', 'install', 'integration_search', 'layout', 'member', 'menu', 'message', 'module', 'opage', 'page', 'point', 'poll', 'rss', 'session', 'spamfilter', 'tag', 'trackback', 'trash', 'widget') |
401 | 401 | , 'addon' => array('autolink', 'blogapi', 'captcha', 'counter', 'member_communication', 'member_extra_info', 'mobile', 'openid_delegation_id', 'point_level_icon', 'resize_image') |
402 | 402 | , 'layout' => array('default') |
403 | - , 'widget' => array('content', 'language_select', 'login_info','mcontent') |
|
403 | + , 'widget' => array('content', 'language_select', 'login_info', 'mcontent') |
|
404 | 404 | , 'widgetstyle' => array(), |
405 | 405 | ); |
406 | 406 | $info = array(); |
@@ -420,86 +420,86 @@ discard block |
||
420 | 420 | $info['use_ssl'] = $db_info->use_ssl; |
421 | 421 | |
422 | 422 | $info['phpext'] = ''; |
423 | - foreach(get_loaded_extensions() as $ext) |
|
423 | + foreach (get_loaded_extensions() as $ext) |
|
424 | 424 | { |
425 | 425 | $ext = strtolower($ext); |
426 | - if(in_array($ext, $skip['ext'])) |
|
426 | + if (in_array($ext, $skip['ext'])) |
|
427 | 427 | { |
428 | 428 | continue; |
429 | 429 | } |
430 | - $info['phpext'] .= '|' . $ext; |
|
430 | + $info['phpext'] .= '|'.$ext; |
|
431 | 431 | } |
432 | 432 | $info['phpext'] = substr($info['phpext'], 1); |
433 | 433 | |
434 | 434 | $info['module'] = ''; |
435 | 435 | $oModuleModel = getModel('module'); |
436 | 436 | $module_list = $oModuleModel->getModuleList(); |
437 | - if($module_list) foreach($module_list as $module) |
|
437 | + if ($module_list) foreach ($module_list as $module) |
|
438 | 438 | { |
439 | - if(in_array($module->module, $skip['module'])) |
|
439 | + if (in_array($module->module, $skip['module'])) |
|
440 | 440 | { |
441 | 441 | continue; |
442 | 442 | } |
443 | - $info['module'] .= '|' . $module->module; |
|
443 | + $info['module'] .= '|'.$module->module; |
|
444 | 444 | } |
445 | 445 | $info['module'] = substr($info['module'], 1); |
446 | 446 | |
447 | 447 | $info['addon'] = ''; |
448 | 448 | $oAddonAdminModel = getAdminModel('addon'); |
449 | 449 | $addon_list = $oAddonAdminModel->getAddonList(); |
450 | - if($addon_list) foreach($addon_list as $addon) |
|
450 | + if ($addon_list) foreach ($addon_list as $addon) |
|
451 | 451 | { |
452 | - if(in_array($addon->addon, $skip['addon'])) |
|
452 | + if (in_array($addon->addon, $skip['addon'])) |
|
453 | 453 | { |
454 | 454 | continue; |
455 | 455 | } |
456 | - $info['addon'] .= '|' . $addon->addon; |
|
456 | + $info['addon'] .= '|'.$addon->addon; |
|
457 | 457 | } |
458 | 458 | $info['addon'] = substr($info['addon'], 1); |
459 | 459 | |
460 | 460 | $info['layout'] = ""; |
461 | 461 | $oLayoutModel = getModel('layout'); |
462 | 462 | $layout_list = $oLayoutModel->getDownloadedLayoutList(); |
463 | - if($layout_list) foreach($layout_list as $layout) |
|
463 | + if ($layout_list) foreach ($layout_list as $layout) |
|
464 | 464 | { |
465 | - if(in_array($layout->layout, $skip['layout'])) |
|
465 | + if (in_array($layout->layout, $skip['layout'])) |
|
466 | 466 | { |
467 | 467 | continue; |
468 | 468 | } |
469 | - $info['layout'] .= '|' . $layout->layout; |
|
469 | + $info['layout'] .= '|'.$layout->layout; |
|
470 | 470 | } |
471 | 471 | $info['layout'] = substr($info['layout'], 1); |
472 | 472 | |
473 | 473 | $info['widget'] = ""; |
474 | 474 | $oWidgetModel = getModel('widget'); |
475 | 475 | $widget_list = $oWidgetModel->getDownloadedWidgetList(); |
476 | - if($widget_list) foreach($widget_list as $widget) |
|
476 | + if ($widget_list) foreach ($widget_list as $widget) |
|
477 | 477 | { |
478 | - if(in_array($widget->widget, $skip['widget'])) |
|
478 | + if (in_array($widget->widget, $skip['widget'])) |
|
479 | 479 | { |
480 | 480 | continue; |
481 | 481 | } |
482 | - $info['widget'] .= '|' . $widget->widget; |
|
482 | + $info['widget'] .= '|'.$widget->widget; |
|
483 | 483 | } |
484 | 484 | $info['widget'] = substr($info['widget'], 1); |
485 | 485 | |
486 | 486 | $info['widgetstyle'] = ""; |
487 | 487 | $oWidgetModel = getModel('widget'); |
488 | 488 | $widgetstyle_list = $oWidgetModel->getDownloadedWidgetStyleList(); |
489 | - if($widgetstyle_list) foreach($widgetstyle_list as $widgetstyle) |
|
489 | + if ($widgetstyle_list) foreach ($widgetstyle_list as $widgetstyle) |
|
490 | 490 | { |
491 | - if(in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
491 | + if (in_array($widgetstyle->widgetStyle, $skip['widgetstyle'])) |
|
492 | 492 | { |
493 | 493 | continue; |
494 | 494 | } |
495 | - $info['widgetstyle'] .= '|' . $widgetstyle->widgetStyle; |
|
495 | + $info['widgetstyle'] .= '|'.$widgetstyle->widgetStyle; |
|
496 | 496 | } |
497 | 497 | $info['widgetstyle'] = substr($info['widgetstyle'], 1); |
498 | 498 | |
499 | 499 | $param = ''; |
500 | - foreach($info as $k => $v) |
|
500 | + foreach ($info as $k => $v) |
|
501 | 501 | { |
502 | - if($v) |
|
502 | + if ($v) |
|
503 | 503 | { |
504 | 504 | $param .= sprintf('&%s=%s', $k, urlencode($v)); |
505 | 505 | } |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function getThemeList() |
517 | 517 | { |
518 | - $path = _XE_PATH_ . 'themes'; |
|
518 | + $path = _XE_PATH_.'themes'; |
|
519 | 519 | $list = FileHandler::readDir($path); |
520 | 520 | |
521 | 521 | $theme_info = array(); |
522 | - if(count($list) > 0) |
|
522 | + if (count($list) > 0) |
|
523 | 523 | { |
524 | - foreach($list as $val) |
|
524 | + foreach ($list as $val) |
|
525 | 525 | { |
526 | 526 | $theme_info[$val] = $this->getThemeInfo($val); |
527 | 527 | } |
@@ -538,20 +538,20 @@ discard block |
||
538 | 538 | */ |
539 | 539 | function getThemeInfo($theme_name, $layout_list = NULL) |
540 | 540 | { |
541 | - if($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
541 | + if ($GLOBALS['__ThemeInfo__'][$theme_name]) |
|
542 | 542 | { |
543 | 543 | return $GLOBALS['__ThemeInfo__'][$theme_name]; |
544 | 544 | } |
545 | 545 | |
546 | - $info_file = _XE_PATH_ . 'themes/' . $theme_name . '/conf/info.xml'; |
|
547 | - if(!file_exists($info_file)) |
|
546 | + $info_file = _XE_PATH_.'themes/'.$theme_name.'/conf/info.xml'; |
|
547 | + if (!file_exists($info_file)) |
|
548 | 548 | { |
549 | 549 | return; |
550 | 550 | } |
551 | 551 | |
552 | 552 | $oXmlParser = new XmlParser(); |
553 | 553 | $_xml_obj = $oXmlParser->loadXmlFile($info_file); |
554 | - if(!$_xml_obj->theme) |
|
554 | + if (!$_xml_obj->theme) |
|
555 | 555 | { |
556 | 556 | return; |
557 | 557 | } |
@@ -562,16 +562,16 @@ discard block |
||
562 | 562 | $theme_info = new stdClass(); |
563 | 563 | $theme_info->name = $theme_name; |
564 | 564 | $theme_info->title = $xml_obj->title->body; |
565 | - $thumbnail = './themes/' . $theme_name . '/thumbnail.png'; |
|
565 | + $thumbnail = './themes/'.$theme_name.'/thumbnail.png'; |
|
566 | 566 | $theme_info->thumbnail = (FileHandler::exists($thumbnail)) ? $thumbnail : NULL; |
567 | 567 | $theme_info->version = $xml_obj->version->body; |
568 | 568 | $date_obj = new stdClass(); |
569 | 569 | sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); |
570 | 570 | $theme_info->date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); |
571 | 571 | $theme_info->description = $xml_obj->description->body; |
572 | - $theme_info->path = './themes/' . $theme_name . '/'; |
|
572 | + $theme_info->path = './themes/'.$theme_name.'/'; |
|
573 | 573 | |
574 | - if(!is_array($xml_obj->publisher)) |
|
574 | + if (!is_array($xml_obj->publisher)) |
|
575 | 575 | { |
576 | 576 | $publisher_list = array(); |
577 | 577 | $publisher_list[] = $xml_obj->publisher; |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | $theme_info->publisher = array(); |
585 | - foreach($publisher_list as $publisher) |
|
585 | + foreach ($publisher_list as $publisher) |
|
586 | 586 | { |
587 | 587 | $publisher_obj = new stdClass(); |
588 | 588 | $publisher_obj->name = $publisher->name->body; |
@@ -595,10 +595,10 @@ discard block |
||
595 | 595 | $layout_path = $layout->directory->attrs->path; |
596 | 596 | $layout_parse = explode('/', $layout_path); |
597 | 597 | $layout_info = new stdClass(); |
598 | - switch($layout_parse[1]) |
|
598 | + switch ($layout_parse[1]) |
|
599 | 599 | { |
600 | 600 | case 'themes' : |
601 | - $layout_info->name = $theme_name . '|@|' . $layout_parse[count($layout_parse) - 1]; |
|
601 | + $layout_info->name = $theme_name.'|@|'.$layout_parse[count($layout_parse) - 1]; |
|
602 | 602 | break; |
603 | 603 | |
604 | 604 | case 'layouts' : |
@@ -615,11 +615,11 @@ discard block |
||
615 | 615 | $oLayoutModel = getModel('layout'); |
616 | 616 | $layout_info_list = array(); |
617 | 617 | $layout_list = $oLayoutModel->getLayoutList($site_info->site_srl); |
618 | - if($layout_list) |
|
618 | + if ($layout_list) |
|
619 | 619 | { |
620 | - foreach($layout_list as $val) |
|
620 | + foreach ($layout_list as $val) |
|
621 | 621 | { |
622 | - if($val->layout == $layout_info->name) |
|
622 | + if ($val->layout == $layout_info->name) |
|
623 | 623 | { |
624 | 624 | $is_new_layout = FALSE; |
625 | 625 | $layout_info->layout_srl = $val->layout_srl; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | } |
630 | 630 | |
631 | - if($is_new_layout) |
|
631 | + if ($is_new_layout) |
|
632 | 632 | { |
633 | 633 | $site_module_info = Context::get('site_module_info'); |
634 | 634 | $args = new stdClass(); |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $theme_info->layout_info = $layout_info; |
647 | 647 | |
648 | 648 | $skin_infos = $xml_obj->skininfos; |
649 | - if(is_array($skin_infos->skininfo)) |
|
649 | + if (is_array($skin_infos->skininfo)) |
|
650 | 650 | { |
651 | 651 | $skin_list = $skin_infos->skininfo; |
652 | 652 | } |
@@ -657,17 +657,17 @@ discard block |
||
657 | 657 | |
658 | 658 | $oModuleModel = getModel('module'); |
659 | 659 | $skins = array(); |
660 | - foreach($skin_list as $val) |
|
660 | + foreach ($skin_list as $val) |
|
661 | 661 | { |
662 | 662 | $skin_info = new stdClass(); |
663 | 663 | unset($skin_parse); |
664 | 664 | $skin_parse = explode('/', $val->directory->attrs->path); |
665 | - switch($skin_parse[1]) |
|
665 | + switch ($skin_parse[1]) |
|
666 | 666 | { |
667 | 667 | case 'themes' : |
668 | 668 | $is_theme = TRUE; |
669 | 669 | $module_name = $skin_parse[count($skin_parse) - 1]; |
670 | - $skin_info->name = $theme_name . '|@|' . $module_name; |
|
670 | + $skin_info->name = $theme_name.'|@|'.$module_name; |
|
671 | 671 | break; |
672 | 672 | |
673 | 673 | case 'modules' : |
@@ -681,9 +681,9 @@ discard block |
||
681 | 681 | $skin_info->is_theme = $is_theme; |
682 | 682 | $skins[$module_name] = $skin_info; |
683 | 683 | |
684 | - if($is_theme) |
|
684 | + if ($is_theme) |
|
685 | 685 | { |
686 | - if(!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
686 | + if (!$GLOBALS['__ThemeModuleSkin__'][$module_name]) |
|
687 | 687 | { |
688 | 688 | $GLOBALS['__ThemeModuleSkin__'][$module_name] = array(); |
689 | 689 | $GLOBALS['__ThemeModuleSkin__'][$module_name]['skins'] = array(); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | */ |
706 | 706 | function getModulesSkinList() |
707 | 707 | { |
708 | - if($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
708 | + if ($GLOBALS['__ThemeModuleSkin__']['__IS_PARSE__']) |
|
709 | 709 | { |
710 | 710 | return $GLOBALS['__ThemeModuleSkin__']; |
711 | 711 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | sort($searched_list); |
714 | 714 | |
715 | 715 | $searched_count = count($searched_list); |
716 | - if(!$searched_count) |
|
716 | + if (!$searched_count) |
|
717 | 717 | { |
718 | 718 | return; |
719 | 719 | } |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | $exceptionModule = array('editor', 'poll', 'homepage', 'textyle'); |
722 | 722 | |
723 | 723 | $oModuleModel = getModel('module'); |
724 | - foreach($searched_list as $val) |
|
724 | + foreach ($searched_list as $val) |
|
725 | 725 | { |
726 | - $skin_list = $oModuleModel->getSkins(_XE_PATH_ . 'modules/' . $val); |
|
726 | + $skin_list = $oModuleModel->getSkins(_XE_PATH_.'modules/'.$val); |
|
727 | 727 | |
728 | - if(is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
728 | + if (is_array($skin_list) && count($skin_list) > 0 && !in_array($val, $exceptionModule)) |
|
729 | 729 | { |
730 | - if(!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
730 | + if (!$GLOBALS['__ThemeModuleSkin__'][$val]) |
|
731 | 731 | { |
732 | 732 | $GLOBALS['__ThemeModuleSkin__'][$val] = array(); |
733 | 733 | $moduleInfo = $oModuleModel->getModuleInfoXml($val); |
@@ -752,22 +752,22 @@ discard block |
||
752 | 752 | $cacheFile = sprintf('./files/cache/menu/admin_lang/adminMenu.%s.lang.php', $currentLang); |
753 | 753 | |
754 | 754 | // Update if no cache file exists or it is older than xml file |
755 | - if(!is_readable($cacheFile)) |
|
755 | + if (!is_readable($cacheFile)) |
|
756 | 756 | { |
757 | 757 | $lang = new stdClass(); |
758 | 758 | $oModuleModel = getModel('module'); |
759 | 759 | $installed_module_list = $oModuleModel->getModulesXmlInfo(); |
760 | 760 | |
761 | 761 | $this->gnbLangBuffer = '<?php $lang = new stdClass();'; |
762 | - foreach($installed_module_list AS $key => $value) |
|
762 | + foreach ($installed_module_list AS $key => $value) |
|
763 | 763 | { |
764 | 764 | $moduleActionInfo = $oModuleModel->getModuleActionXml($value->module); |
765 | - if(is_object($moduleActionInfo->menu)) |
|
765 | + if (is_object($moduleActionInfo->menu)) |
|
766 | 766 | { |
767 | - foreach($moduleActionInfo->menu AS $key2 => $value2) |
|
767 | + foreach ($moduleActionInfo->menu AS $key2 => $value2) |
|
768 | 768 | { |
769 | 769 | $lang->menu_gnb_sub[$key2] = $value2->title; |
770 | - $this->gnbLangBuffer .=sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title); |
|
770 | + $this->gnbLangBuffer .= sprintf('$lang->menu_gnb_sub[\'%s\'] = \'%s\';', $key2, $value2->title); |
|
771 | 771 | } |
772 | 772 | } |
773 | 773 | } |
@@ -793,19 +793,19 @@ discard block |
||
793 | 793 | $args = new stdClass(); |
794 | 794 | $args->site_srl = $siteSrl; |
795 | 795 | $output = executeQueryArray('admin.getFavoriteList', $args); |
796 | - if(!$output->toBool()) |
|
796 | + if (!$output->toBool()) |
|
797 | 797 | { |
798 | 798 | return $output; |
799 | 799 | } |
800 | - if(!$output->data) |
|
800 | + if (!$output->data) |
|
801 | 801 | { |
802 | 802 | return new Object(); |
803 | 803 | } |
804 | 804 | |
805 | - if($isGetModuleInfo && is_array($output->data)) |
|
805 | + if ($isGetModuleInfo && is_array($output->data)) |
|
806 | 806 | { |
807 | 807 | $oModuleModel = getModel('module'); |
808 | - foreach($output->data AS $key => $value) |
|
808 | + foreach ($output->data AS $key => $value) |
|
809 | 809 | { |
810 | 810 | $moduleInfo = $oModuleModel->getModuleInfoXml($value->module); |
811 | 811 | $output->data[$key]->admin_index_act = $moduleInfo->admin_index_act; |
@@ -830,13 +830,13 @@ discard block |
||
830 | 830 | $args->site_srl = $siteSrl; |
831 | 831 | $args->module = $module; |
832 | 832 | $output = executeQuery('admin.getFavorite', $args); |
833 | - if(!$output->toBool()) |
|
833 | + if (!$output->toBool()) |
|
834 | 834 | { |
835 | 835 | return $output; |
836 | 836 | } |
837 | 837 | |
838 | 838 | $returnObject = new Object(); |
839 | - if($output->data) |
|
839 | + if ($output->data) |
|
840 | 840 | { |
841 | 841 | $returnObject->add('result', TRUE); |
842 | 842 | $returnObject->add('favoriteSrl', $output->data->admin_favorite_srl); |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | */ |
856 | 856 | function getSiteAllList() |
857 | 857 | { |
858 | - if(Context::get('domain')) |
|
858 | + if (Context::get('domain')) |
|
859 | 859 | { |
860 | 860 | $domain = Context::get('domain'); |
861 | 861 | } |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | function getAllSitesThatHaveModules($domain = NULL) |
873 | 873 | { |
874 | 874 | $args = new stdClass(); |
875 | - if($domain) |
|
875 | + if ($domain) |
|
876 | 876 | { |
877 | 877 | $args->domain = $domain; |
878 | 878 | } |
@@ -880,31 +880,31 @@ discard block |
||
880 | 880 | |
881 | 881 | $siteList = array(); |
882 | 882 | $output = executeQueryArray('admin.getSiteAllList', $args, $columnList); |
883 | - if($output->toBool()) |
|
883 | + if ($output->toBool()) |
|
884 | 884 | { |
885 | 885 | $siteList = $output->data; |
886 | 886 | } |
887 | 887 | |
888 | 888 | $oModuleModel = getModel('module'); |
889 | - foreach($siteList as $key => $value) |
|
889 | + foreach ($siteList as $key => $value) |
|
890 | 890 | { |
891 | 891 | $args->site_srl = $value->site_srl; |
892 | 892 | $list = $oModuleModel->getModuleSrlList($args); |
893 | 893 | |
894 | - if(!is_array($list)) |
|
894 | + if (!is_array($list)) |
|
895 | 895 | { |
896 | 896 | $list = array($list); |
897 | 897 | } |
898 | 898 | |
899 | - foreach($list as $k => $v) |
|
899 | + foreach ($list as $k => $v) |
|
900 | 900 | { |
901 | - if(!is_dir(_XE_PATH_ . 'modules/' . $v->module)) |
|
901 | + if (!is_dir(_XE_PATH_.'modules/'.$v->module)) |
|
902 | 902 | { |
903 | 903 | unset($list[$k]); |
904 | 904 | } |
905 | 905 | } |
906 | 906 | |
907 | - if(!count($list)) |
|
907 | + if (!count($list)) |
|
908 | 908 | { |
909 | 909 | unset($siteList[$key]); |
910 | 910 | } |
@@ -921,13 +921,13 @@ discard block |
||
921 | 921 | { |
922 | 922 | $args = new stdClass(); |
923 | 923 | |
924 | - if($date) |
|
924 | + if ($date) |
|
925 | 925 | { |
926 | 926 | $args->regDate = date('Ymd', strtotime($date)); |
927 | 927 | } |
928 | 928 | |
929 | 929 | $output = executeQuery('admin.getSiteCountByDate', $args); |
930 | - if(!$output->toBool()) |
|
930 | + if (!$output->toBool()) |
|
931 | 931 | { |
932 | 932 | return 0; |
933 | 933 | } |
@@ -949,20 +949,20 @@ discard block |
||
949 | 949 | { |
950 | 950 | $site_info = Context::get('site_module_info'); |
951 | 951 | $virtual_site = ''; |
952 | - if($site_info->site_srl) |
|
952 | + if ($site_info->site_srl) |
|
953 | 953 | { |
954 | - $virtual_site = $site_info->site_srl . '/'; |
|
954 | + $virtual_site = $site_info->site_srl.'/'; |
|
955 | 955 | } |
956 | 956 | |
957 | - $file_exsit = FileHandler::readFile(_XE_PATH_ . 'files/attach/xeicon/' . $virtual_site . $iconname); |
|
958 | - if(!$file_exsit && $default === true) |
|
957 | + $file_exsit = FileHandler::readFile(_XE_PATH_.'files/attach/xeicon/'.$virtual_site.$iconname); |
|
958 | + if (!$file_exsit && $default === true) |
|
959 | 959 | { |
960 | - $icon_url = './modules/admin/tpl/img/' . $default_icon_name; |
|
960 | + $icon_url = './modules/admin/tpl/img/'.$default_icon_name; |
|
961 | 961 | } |
962 | - elseif($file_exsit) |
|
962 | + elseif ($file_exsit) |
|
963 | 963 | { |
964 | 964 | $default_url = Context::getDefaultUrl(); |
965 | - $icon_url = $default_url . 'files/attach/xeicon/' . $virtual_site . $iconname; |
|
965 | + $icon_url = $default_url.'files/attach/xeicon/'.$virtual_site.$iconname; |
|
966 | 966 | } |
967 | 967 | return $icon_url; |
968 | 968 | } |