Changeset 18677 for branches/comu-ver2


Ignore:
Timestamp:
2010/06/07 20:54:00 (14 years ago)
Author:
nanasess
bzr:base-revision:
ohkouchi@loop-az.jp-20100607064638-mc5fd4g73wuo1f1g
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/class/util/SC_Utils.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Futil%2FSC_Utils.php
bzr:mapping-version:
v4
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20100607115355-l2rr0dxlsu5as956
bzr:revno:
2233
bzr:revprop:branch-nick:
branches/comu-ver2
bzr:root:
branches/comu-ver2
bzr:timestamp:
2010-06-07 20:53:55.660000086 +0900
bzr:user-agent:
bzr2.1.1+bzr-svn1.0.2
svn:original-date:
2010-06-07T11:53:55.660000Z
Message:

merged r18676

  • インストーラへのリダイレクトを修正(#348, #603)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/util/SC_Utils.php

    r18675 r18677  
    7878        // インストール済みが定義されていない。 
    7979        if (!defined('ECCUBE_INSTALL')) { 
    80             header("Location: ./install/" . DIR_INDEX_URL); // TODO 絶対URL にする 
    81             exit; 
     80            $phpself = $_SERVER['PHP_SELF']; 
     81            if( !ereg('/install/', $phpself) ) { 
     82                $path = substr($phpself, 0, strpos($phpself, basename($phpself))); 
     83                $install_url = SC_Utils::searchInstallerPath($path); 
     84                header('Location: ' . $install_url); 
     85                exit; 
     86            } 
    8287        } 
    8388        $path = HTML_PATH . "install/index.php"; 
     
    8590            SC_Utils::sfErrorHeader("&gt;&gt; /install/index.phpは、インストール完了後にファイルを削除してください。"); 
    8691        } 
     92    } 
     93 
     94    /** 
     95     * インストーラのパスを検索し, URL を返す. 
     96     * 
     97     * $path と同階層に install/index.php があるか検索する. 
     98     * 存在しない場合は上位階層を再帰的に検索する. 
     99     * インストーラのパスが見つかった場合は, その URL を返す. 
     100     * DocumentRoot まで検索しても見つからない場合は /install/index.php を返す. 
     101     * 
     102     * @param string $path 検索対象のパス 
     103     * @return string インストーラの URL 
     104     */ 
     105    function searchInstallerPath($path) { 
     106        $installer = 'install/index.php'; 
     107        if ($path == '/') { 
     108            return $path . $installer; 
     109        } 
     110        if (substr($path, -1, 1) != '/') { 
     111            $path .= $path . '/'; 
     112        } 
     113        if (SC_Utils::sfIsHTTPS()) { 
     114            $proto = "https://"; 
     115        } else { 
     116            $proto = "http://"; 
     117        } 
     118        $installer_url = $proto . $_SERVER['SERVER_NAME'] . $path . $installer; 
     119        $resources = fopen($installer_url, 'r'); 
     120        if ($resources === false) { 
     121            $installer_url = SC_Utils::searchInstallerPath($path . '../'); 
     122        } 
     123        return $installer_url; 
    87124    } 
    88125 
Note: See TracChangeset for help on using the changeset viewer.