Changeset 18609 for tmp/version-2_5-test/html/install/index.php
- Timestamp:
- 2010/03/11 10:35:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tmp/version-2_5-test/html/install/index.php
r18562 r18609 3 3 * This file is part of EC-CUBE 4 4 * 5 * Copyright(c) 2000-200 8LOCKON CO.,LTD. All Rights Reserved.5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 6 6 * 7 7 * http://www.lockon.co.jp/ … … 21 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 22 */ 23 require_once("../require.php"); 23 // ▼require.php 相当 24 // rtrim は PHP バージョン依存対策 25 define('HTML_PATH', rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/../'), '/\\') . '/'); 26 27 require_once HTML_PATH . 'define.php'; 28 define('INSTALL_FUNCTION', true); 29 require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php'; 30 // ▲require.php 相当 31 24 32 $INSTALL_DIR = realpath(dirname( __FILE__)); 25 require_once( "../" . HTML2DATA_DIR. "module/Request.php");33 require_once(DATA_PATH . "module/Request.php"); 26 34 27 35 define("INSTALL_LOG", "./temp/install.log"); 28 define("INSTALL_INFO_URL", "http://www.ec-cube.net/install_info/index.php");29 36 ini_set("max_execution_time", 300); 30 37 … … 62 69 $objDBParam->setParam($_POST); 63 70 64 switch($_POST['mode']) { 71 $mode = isset($_POST['mode_overwrite']) ? $_POST['mode_overwrite'] : $_POST['mode']; 72 73 switch($mode) { 65 74 // ようこそ 66 75 case 'welcome': … … 101 110 $objPage->arrErr = lfCheckDBError($objDBParam); 102 111 if(count($objPage->arrErr) == 0) { 112 // 設定ファイルの生成 113 lfMakeConfigFile(); 103 114 $objPage = lfDispStep3($objPage); 104 115 } else { … … 137 148 $skip = $_POST["db_skip"]; 138 149 if ($skip == "on") { 139 // 設定ファイルの生成140 lfMakeConfigFile();141 150 $objPage = lfDispComplete($objPage); 142 151 //$objPage = lfDispStep4($objPage); … … 195 204 196 205 if(count($objPage->arrErr) == 0) { 197 // 設定ファイルの生成198 lfMakeConfigFile();199 206 $objPage = lfDispStep3($objPage); 200 207 $objPage->tpl_mode = 'step4'; … … 282 289 $objQuery->query($sql, array($login_id, $login_pass)); 283 290 284 global $GLOBAL_ERR;285 291 $GLOBAL_ERR = ""; 286 292 $objPage = lfDispComplete($objPage); … … 306 312 } 307 313 $req->clearPostData(); 314 308 315 break; 309 316 case 'return_step0': … … 328 335 break; 329 336 } 337 330 338 //フォーム用のパラメータを返す 331 339 $objPage->arrForm = $objWebParam->getFormParamList(); … … 366 374 } 367 375 368 // STEP0画面の表示( ファイル権限チェック)376 // STEP0画面の表示(チェック) 369 377 function lfDispStep0($objPage) { 370 378 global $objWebParam; … … 377 385 $objPage->arrHidden['agreement'] = $_POST['agreement']; 378 386 $objPage->tpl_mainpage = 'step0.tpl'; 379 $objPage->tpl_mode = 'step0';380 387 381 388 // プログラムで書込みされるファイル・ディレクトリ 382 389 $arrWriteFile = array( 383 ".." . HTML2DATA_DIR. "install.php",384 "../user_data",385 "../cp",386 "../upload",387 ".." . HTML2DATA_DIR. "cache/",388 ".." . HTML2DATA_DIR. "class/",389 ".." . HTML2DATA_DIR. "Smarty/",390 ".." . HTML2DATA_DIR. "logs/",391 ".." . HTML2DATA_DIR. "downloads/",392 ".." . HTML2DATA_DIR . "upload/"390 DATA_PATH . "install.php", 391 HTML_PATH . "user_data", 392 HTML_PATH . "cp", 393 HTML_PATH . "upload", 394 DATA_PATH . "cache/", 395 DATA_PATH . "class/", 396 DATA_PATH . "Smarty/", 397 DATA_PATH . "logs/", 398 DATA_PATH . "downloads/", 399 DATA_PATH . "upload/", 393 400 ); 394 401 395 402 $mess = ""; 396 $ err_file= false;403 $hasErr = false; 397 404 foreach($arrWriteFile as $val) { 398 405 // listdirsの保持データを初期化 … … 406 413 foreach ($arrDirs as $path) { 407 414 if(file_exists($path)) { 408 $ mode = lfGetFileMode($path);415 $filemode = lfGetFileMode($path); 409 416 $real_path = realpath($path); 410 417 … … 412 419 if(is_dir($path)) { 413 420 if(!is_writable($path)) { 414 $mess.= ">> ×:$real_path($ mode) <br>ユーザ書込み権限(777, 707等)を付与して下さい。<br>";415 $ err_file= true;421 $mess.= ">> ×:$real_path($filemode) <br>ユーザ書込み権限(777, 707等)を付与して下さい。<br>"; 422 $hasErr = true; 416 423 } else { 417 424 GC_Utils_Ex::gfPrintLog("WRITABLE:".$path, INSTALL_LOG); … … 419 426 } else { 420 427 if(!is_writable($path)) { 421 $mess.= ">> ×:$real_path($ mode) <br>ユーザ書込み権限(666, 606等)を付与して下さい。<br>";422 $ err_file= true;428 $mess.= ">> ×:$real_path($filemode) <br>ユーザ書込み権限(666, 606等)を付与して下さい。<br>"; 429 $hasErr = true; 423 430 } else { 424 431 GC_Utils_Ex::gfPrintLog("WRITABLE:".$path, INSTALL_LOG); … … 427 434 } else { 428 435 $mess.= ">> ×:$path が見つかりません。<br>"; 429 $ err_file= true;436 $hasErr = true; 430 437 } 431 438 } 432 439 } 433 440 434 // 権限エラー等が発生していない場合 435 if(!$err_file) { 441 if (ini_get('safe_mode')) { 442 $mess .= ">> ×:PHPのセーフモードが有効になっています。<br>"; 443 $hasErr = true; 444 } 445 446 // 問題点を検出している場合 447 if ($hasErr) { 448 $objPage->tpl_mode = 'return_step0'; 449 } 450 // 問題点を検出していない場合 451 else { 452 $objPage->tpl_mode = 'step0'; 436 453 umask(0); 437 $path = "../upload/temp_template";454 $path = HTML_PATH . "upload/temp_template"; 438 455 if(!file_exists($path)) { 439 456 mkdir($path); 440 457 } 441 $path = "../upload/save_image";458 $path = HTML_PATH . "upload/save_image"; 442 459 if(!file_exists($path)) { 443 460 mkdir($path); 444 461 } 445 $path = "../upload/temp_image";462 $path = HTML_PATH . "upload/temp_image"; 446 463 if(!file_exists($path)) { 447 464 mkdir($path); 448 465 } 449 $path = "../upload/graph_image";466 $path = HTML_PATH . "upload/graph_image"; 450 467 if(!file_exists($path)) { 451 468 mkdir($path); 452 469 } 453 $path = "../upload/mobile_image";470 $path = HTML_PATH . "upload/mobile_image"; 454 471 if(!file_exists($path)) { 455 472 mkdir($path); 456 473 } 457 $path = "../upload/csv";474 $path = DATA_PATH . "downloads/module"; 458 475 if(!file_exists($path)) { 459 476 mkdir($path); 460 477 } 461 $path = ".." . HTML2DATA_DIR . "downloads/module";478 $path = DATA_PATH . "downloads/update"; 462 479 if(!file_exists($path)) { 463 480 mkdir($path); 464 481 } 465 $path = ".." . HTML2DATA_DIR . "downloads/update";482 $path = DATA_PATH . "upload/csv"; 466 483 if(!file_exists($path)) { 467 484 mkdir($path); 468 485 } 469 $path = ".." . HTML2DATA_DIR . "upload/csv";470 if(!file_exists($path)) {471 mkdir($path);472 }473 486 $mess.= ">> ○:アクセス権限は正常です。<br>"; 474 487 } 475 488 476 489 $objPage->mess = $mess; 477 $objPage-> err_file = $err_file;490 $objPage->hasErr = $hasErr; 478 491 479 492 return $objPage; … … 494 507 $objPage->tpl_mode = 'step0_1'; 495 508 // ファイルコピー 496 $objPage->copy_mess = SC_Utils_Ex::sfCopyDir("./user_data/", "../user_data/", $objPage->copy_mess); 497 $objPage->copy_mess = SC_Utils_Ex::sfCopyDir("./save_image/", "../upload/save_image/", $objPage->copy_mess); 498 return $objPage; 499 } 500 501 // STEP0_2画面の表示(ファイルのコピー) 502 function lfDispStep0_2($objPage) { 503 global $objWebParam; 504 global $objDBParam; 505 // hiddenに入力値を保持 506 $objPage->arrHidden = $objWebParam->getHashArray(); 507 // hiddenに入力値を保持 508 $objPage->arrHidden = array_merge($objPage->arrHidden, $objDBParam->getHashArray()); 509 $objPage->arrHidden['db_skip'] = $_POST['db_skip']; 510 $objPage->arrHidden['agreement'] = $_POST['agreement']; 511 $objPage->tpl_mainpage = 'step0_1.tpl'; 512 $objPage->tpl_mode = 'step0_1'; 513 // ファイルコピー 514 $objPage->copy_mess = SC_Utils_Ex::sfCopyDir("./user_data/", "../user_data/", $objPage->copy_mess); 515 $objPage->copy_mess = SC_Utils_Ex::sfCopyDir("./save_image/", "../upload/save_image/", $objPage->copy_mess); 509 $objPage->copy_mess = SC_Utils_Ex::sfCopyDir("./user_data/", HTML_PATH . "user_data/", $objPage->copy_mess); 510 $objPage->copy_mess = SC_Utils_Ex::sfCopyDir("./save_image/", HTML_PATH . "upload/save_image/", $objPage->copy_mess); 516 511 return $objPage; 517 512 } … … 613 608 } 614 609 $objPage->tpl_sslurl = $secure_url; 615 //EC-CUBEオフィシャルサイトからのお知らせURL616 $objPage->install_info_url = INSTALL_INFO_URL;617 610 return $objPage; 618 611 } … … 621 614 function lfInitWebParam($objWebParam) { 622 615 global $objDb; 623 624 if(defined('HTML_PATH')) {625 $install_dir = HTML_PATH;626 } else {627 $install_dir = realpath(dirname( __FILE__) . "/../");628 $install_dir = rtrim($install_dir, '\\/') . '/';629 }630 616 631 617 if(defined('SITE_URL')) { … … 658 644 $objWebParam->addParam("管理者:ログインID", "login_id", ID_MAX_LEN, "", array("EXIST_CHECK","SPTAB_CHECK", "ALNUM_CHECK")); 659 645 $objWebParam->addParam("管理者:パスワード", "login_pass", ID_MAX_LEN, "", array("EXIST_CHECK","SPTAB_CHECK", "ALNUM_CHECK")); 660 $objWebParam->addParam("インストールディレクトリ", "install_dir", MTEXT_LEN, "", array("EXIST_CHECK","MAX_LENGTH_CHECK"), $install_dir);661 646 $objWebParam->addParam("URL(通常)", "normal_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $normal_url); 662 647 $objWebParam->addParam("URL(セキュア)", "secure_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $secure_url); … … 737 722 function lfCheckDBError($objFormParam) { 738 723 global $objPage; 739 global $objDb;740 724 741 725 // 入力データを渡す。 … … 748 732 // 接続確認 749 733 $dsn = $arrRet['db_type']."://".$arrRet['db_user'].":".$arrRet['db_password']."@".$arrRet['db_server'].":".$arrRet['db_port']."/".$arrRet['db_name']; 750 define("DB_TYPE", $arrRet['db_type']);751 734 // Debugモード指定 752 735 $options['debug'] = PEAR_DB_DEBUG; … … 754 737 // 接続成功 755 738 if(!PEAR::isError($objDB)) { 739 $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 756 740 // データベースバージョン情報の取得 757 $objPage->tpl_db_version = $ objDb->sfGetDBVersion($dsn);741 $objPage->tpl_db_version = $dbFactory->sfGetDBVersion($dsn); 758 742 } else { 759 743 $objErr->arrErr['all'] = ">> " . $objDB->message . "<br>"; … … 812 796 global $objWebParam; 813 797 global $objDBParam; 814 815 $root_dir = $objWebParam->getValue('install_dir'); 816 $root_dir = str_replace("\\", "/", $root_dir); 817 // 語尾に'/'をつける 818 if (!ereg("/$", $root_dir)) { 819 $root_dir = $root_dir . "/"; 820 } 821 798 822 799 $normal_url = $objWebParam->getValue('normal_url'); 823 800 // 語尾に'/'をつける … … 835 812 $url_dir = ereg_replace("^https?://[a-zA-Z0-9_:~=&\?\.\-]+", "", $normal_url); 836 813 837 $data_path = SC_Utils_Ex::sfRmDupSlash($root_dir . HTML2DATA_DIR); 838 $data_path = str_replace("\\", "/", realpath($data_path)); 839 // 語尾に'/'をつける 840 if (!ereg("/$", $data_path)) { 841 $data_path = $data_path . "/"; 842 } 843 844 $filepath = $data_path . "install.php"; 814 $filepath = DATA_PATH . "install.php"; 845 815 846 816 $config_data = 847 817 "<?php\n". 848 818 " define ('ECCUBE_INSTALL', 'ON');\n" . 849 " define ('HTML_PATH', '" . $root_dir . "');\n" .850 819 " define ('SITE_URL', '" . $normal_url . "');\n" . 851 820 " define ('SSL_URL', '" . $secure_url . "');\n" . … … 858 827 " define ('DB_NAME', '" . $objDBParam->getValue('db_name') . "');\n" . 859 828 " define ('DB_PORT', '" . $objDBParam->getValue('db_port') . "');\n" . 860 " define ('DATA_PATH', '".$data_path."');\n" .861 829 " define ('MOBILE_HTML_PATH', HTML_PATH . 'mobile/');\n" . 862 830 " define ('MOBILE_SITE_URL', SITE_URL . 'mobile/');\n" . … … 869 837 fclose($fp); 870 838 } 871 /* install_mobile.incは使用しない用に変更872 873 // モバイル版の設定ファイル install_mobile.inc を作成する。874 $filepath = $data_path . "install_mobile.inc";875 876 $config_data =877 "<?php\n".878 " define ('ECCUBE_INSTALL', 'ON');\n" .879 " define ('HTML_PATH', '" . $root_dir . "mobile/');\n" .880 " define ('PC_HTML_PATH', '" . $root_dir . "');\n" .881 " define ('SITE_URL', '" . $normal_url . "mobile/');\n" .882 " define ('PC_SITE_URL', '" . $normal_url . "');\n" .883 " define ('SSL_URL', '" . $secure_url . "mobile/');\n" .884 " define ('PC_SSL_URL', '" . $secure_url . "');\n" .885 " define ('URL_DIR', '" . $url_dir . "mobile/');\n" .886 " define ('PC_URL_DIR', '" . $url_dir . "');\n" .887 " define ('DOMAIN_NAME', '" . $objWebParam->getValue('domain') . "');\n" .888 " define ('DB_TYPE', '" . $objDBParam->getValue('db_type') . "');\n" .889 " define ('DB_USER', '" . $objDBParam->getValue('db_user') . "');\n" .890 " define ('DB_PASSWORD', '" . $objDBParam->getValue('db_password') . "');\n" .891 " define ('DB_SERVER', '" . $objDBParam->getValue('db_server') . "');\n" .892 " define ('DB_NAME', '" . $objDBParam->getValue('db_name') . "');\n" .893 " define ('DB_PORT', '" . $objDBParam->getValue('db_port') . "');\n" .894 " define ('DATA_PATH', '".$data_path."');\n" .895 "?>";896 897 if($fp = fopen($filepath,"w")) {898 fwrite($fp, $config_data);899 fclose($fp);900 }901 */902 839 } 903 840 … … 1085 1022 $dirs = glob($dir . '/*'); 1086 1023 if (is_array($dirs) && count($dirs) > 0) { 1087 foreach ($dirs as $d) $alldirs[] = $d;1088 }1089 if (is_array($dirs)) {1090 foreach ($dirs as $dir) listdirs($dir);1024 foreach ($dirs as $d) { 1025 $alldirs[] = $d; 1026 listdirs($d); 1027 } 1091 1028 } 1092 1029 return $alldirs; … … 1100 1037 $alldirs = array(); 1101 1038 } 1039 1040 ?>
Note: See TracChangeset
for help on using the changeset viewer.