Ignore:
Timestamp:
2010/03/11 10:35:11 (14 years ago)
Author:
kajiwara
Message:

正式版にナイトリービルド版をマージしてみるテスト

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tmp/version-2_5-test/html/install/index.php

    r18562 r18609  
    33 * This file is part of EC-CUBE 
    44 * 
    5  * Copyright(c) 2000-2008 LOCKON CO.,LTD. All Rights Reserved. 
     5 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. 
    66 * 
    77 * http://www.lockon.co.jp/ 
     
    2121 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
    2222 */ 
    23 require_once("../require.php"); 
     23// ▼require.php 相当 
     24// rtrim は PHP バージョン依存対策 
     25define('HTML_PATH', rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/../'), '/\\') . '/'); 
     26 
     27require_once HTML_PATH . 'define.php'; 
     28define('INSTALL_FUNCTION', true); 
     29require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php'; 
     30// ▲require.php 相当 
     31 
    2432$INSTALL_DIR = realpath(dirname( __FILE__)); 
    25 require_once("../" . HTML2DATA_DIR . "module/Request.php"); 
     33require_once(DATA_PATH . "module/Request.php"); 
    2634 
    2735define("INSTALL_LOG", "./temp/install.log"); 
    28 define("INSTALL_INFO_URL", "http://www.ec-cube.net/install_info/index.php"); 
    2936ini_set("max_execution_time", 300); 
    3037 
     
    6269$objDBParam->setParam($_POST); 
    6370 
    64 switch($_POST['mode']) { 
     71$mode = isset($_POST['mode_overwrite']) ? $_POST['mode_overwrite'] : $_POST['mode']; 
     72 
     73switch($mode) { 
    6574// ようこそ 
    6675case 'welcome': 
     
    101110    $objPage->arrErr = lfCheckDBError($objDBParam); 
    102111    if(count($objPage->arrErr) == 0) { 
     112        // 設定ファイルの生成 
     113        lfMakeConfigFile(); 
    103114        $objPage = lfDispStep3($objPage); 
    104115    } else { 
     
    137148        $skip = $_POST["db_skip"]; 
    138149        if ($skip == "on") { 
    139             // 設定ファイルの生成 
    140             lfMakeConfigFile(); 
    141150            $objPage = lfDispComplete($objPage); 
    142151            //$objPage = lfDispStep4($objPage); 
     
    195204 
    196205    if(count($objPage->arrErr) == 0) { 
    197         // 設定ファイルの生成 
    198         lfMakeConfigFile(); 
    199206        $objPage = lfDispStep3($objPage); 
    200207        $objPage->tpl_mode = 'step4'; 
     
    282289    $objQuery->query($sql, array($login_id, $login_pass)); 
    283290 
    284     global $GLOBAL_ERR; 
    285291    $GLOBAL_ERR = ""; 
    286292    $objPage = lfDispComplete($objPage); 
     
    306312    } 
    307313    $req->clearPostData(); 
     314 
    308315    break; 
    309316case 'return_step0': 
     
    328335    break; 
    329336} 
     337 
    330338//フォーム用のパラメータを返す 
    331339$objPage->arrForm = $objWebParam->getFormParamList(); 
     
    366374} 
    367375 
    368 // STEP0画面の表示(ファイル権限チェック) 
     376// STEP0画面の表示(チェック) 
    369377function lfDispStep0($objPage) { 
    370378    global $objWebParam; 
     
    377385    $objPage->arrHidden['agreement'] = $_POST['agreement']; 
    378386    $objPage->tpl_mainpage = 'step0.tpl'; 
    379     $objPage->tpl_mode = 'step0'; 
    380387 
    381388    // プログラムで書込みされるファイル・ディレクトリ 
    382389    $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/", 
    393400    ); 
    394401 
    395402    $mess = ""; 
    396     $err_file = false; 
     403    $hasErr = false; 
    397404    foreach($arrWriteFile as $val) { 
    398405        // listdirsの保持データを初期化 
     
    406413        foreach ($arrDirs as $path) { 
    407414            if(file_exists($path)) { 
    408                 $mode = lfGetFileMode($path); 
     415                $filemode = lfGetFileMode($path); 
    409416                $real_path = realpath($path); 
    410417 
     
    412419                if(is_dir($path)) { 
    413420                    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; 
    416423                    } else { 
    417424                        GC_Utils_Ex::gfPrintLog("WRITABLE:".$path, INSTALL_LOG); 
     
    419426                } else { 
    420427                    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; 
    423430                    } else { 
    424431                        GC_Utils_Ex::gfPrintLog("WRITABLE:".$path, INSTALL_LOG); 
     
    427434            } else { 
    428435                $mess.= ">> ×:$path が見つかりません。<br>"; 
    429                 $err_file = true; 
     436                $hasErr = true; 
    430437            } 
    431438        } 
    432439    } 
    433440 
    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'; 
    436453        umask(0); 
    437         $path = "../upload/temp_template"; 
     454        $path = HTML_PATH . "upload/temp_template"; 
    438455        if(!file_exists($path)) { 
    439456            mkdir($path); 
    440457        } 
    441         $path = "../upload/save_image"; 
     458        $path = HTML_PATH . "upload/save_image"; 
    442459        if(!file_exists($path)) { 
    443460            mkdir($path); 
    444461        } 
    445         $path = "../upload/temp_image"; 
     462        $path = HTML_PATH . "upload/temp_image"; 
    446463        if(!file_exists($path)) { 
    447464            mkdir($path); 
    448465        } 
    449         $path = "../upload/graph_image"; 
     466        $path = HTML_PATH . "upload/graph_image"; 
    450467        if(!file_exists($path)) { 
    451468            mkdir($path); 
    452469        } 
    453         $path = "../upload/mobile_image"; 
     470        $path = HTML_PATH . "upload/mobile_image"; 
    454471        if(!file_exists($path)) { 
    455472            mkdir($path); 
    456473        } 
    457         $path = "../upload/csv"; 
     474        $path = DATA_PATH . "downloads/module"; 
    458475        if(!file_exists($path)) { 
    459476            mkdir($path); 
    460477        } 
    461         $path = ".." . HTML2DATA_DIR . "downloads/module"; 
     478        $path = DATA_PATH . "downloads/update"; 
    462479        if(!file_exists($path)) { 
    463480            mkdir($path); 
    464481        } 
    465         $path = ".." . HTML2DATA_DIR . "downloads/update"; 
     482        $path = DATA_PATH . "upload/csv"; 
    466483        if(!file_exists($path)) { 
    467484            mkdir($path); 
    468485        } 
    469         $path = ".." . HTML2DATA_DIR . "upload/csv"; 
    470         if(!file_exists($path)) { 
    471             mkdir($path); 
    472         } 
    473486        $mess.= ">> ○:アクセス権限は正常です。<br>"; 
    474487    } 
    475488 
    476489    $objPage->mess = $mess; 
    477     $objPage->err_file = $err_file; 
     490    $objPage->hasErr = $hasErr; 
    478491 
    479492    return $objPage; 
     
    494507    $objPage->tpl_mode = 'step0_1'; 
    495508    // ファイルコピー 
    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); 
    516511    return $objPage; 
    517512} 
     
    613608    } 
    614609    $objPage->tpl_sslurl = $secure_url; 
    615     //EC-CUBEオフィシャルサイトからのお知らせURL 
    616     $objPage->install_info_url = INSTALL_INFO_URL; 
    617610    return $objPage; 
    618611} 
     
    621614function lfInitWebParam($objWebParam) { 
    622615    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     } 
    630616 
    631617    if(defined('SITE_URL')) { 
     
    658644    $objWebParam->addParam("管理者:ログインID", "login_id", ID_MAX_LEN, "", array("EXIST_CHECK","SPTAB_CHECK", "ALNUM_CHECK")); 
    659645    $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); 
    661646    $objWebParam->addParam("URL(通常)", "normal_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $normal_url); 
    662647    $objWebParam->addParam("URL(セキュア)", "secure_url", MTEXT_LEN, "", array("EXIST_CHECK","URL_CHECK","MAX_LENGTH_CHECK"), $secure_url); 
     
    737722function lfCheckDBError($objFormParam) { 
    738723    global $objPage; 
    739     global $objDb; 
    740724 
    741725    // 入力データを渡す。 
     
    748732        // 接続確認 
    749733        $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']); 
    751734        // Debugモード指定 
    752735        $options['debug'] = PEAR_DB_DEBUG; 
     
    754737        // 接続成功 
    755738        if(!PEAR::isError($objDB)) { 
     739            $dbFactory = SC_DB_DBFactory_Ex::getInstance(); 
    756740            // データベースバージョン情報の取得 
    757             $objPage->tpl_db_version = $objDb->sfGetDBVersion($dsn); 
     741            $objPage->tpl_db_version = $dbFactory->sfGetDBVersion($dsn); 
    758742        } else { 
    759743            $objErr->arrErr['all'] = ">> " . $objDB->message . "<br>"; 
     
    812796    global $objWebParam; 
    813797    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     
    822799    $normal_url = $objWebParam->getValue('normal_url'); 
    823800    // 語尾に'/'をつける 
     
    835812    $url_dir = ereg_replace("^https?://[a-zA-Z0-9_:~=&\?\.\-]+", "", $normal_url); 
    836813 
    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"; 
    845815 
    846816    $config_data = 
    847817    "<?php\n". 
    848818    "    define ('ECCUBE_INSTALL', 'ON');\n" . 
    849     "    define ('HTML_PATH', '" . $root_dir . "');\n" . 
    850819    "    define ('SITE_URL', '" . $normal_url . "');\n" . 
    851820    "    define ('SSL_URL', '" . $secure_url . "');\n" . 
     
    858827    "    define ('DB_NAME', '" . $objDBParam->getValue('db_name') . "');\n" . 
    859828    "    define ('DB_PORT', '" . $objDBParam->getValue('db_port') .  "');\n" . 
    860     "    define ('DATA_PATH', '".$data_path."');\n" . 
    861829    "    define ('MOBILE_HTML_PATH', HTML_PATH . 'mobile/');\n" . 
    862830    "    define ('MOBILE_SITE_URL', SITE_URL . 'mobile/');\n" . 
     
    869837        fclose($fp); 
    870838    } 
    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 */ 
    902839} 
    903840 
     
    10851022    $dirs = glob($dir . '/*'); 
    10861023    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        } 
    10911028    } 
    10921029    return $alldirs; 
     
    11001037    $alldirs = array(); 
    11011038} 
     1039 
     1040?> 
Note: See TracChangeset for help on using the changeset viewer.