Changeset 18293


Ignore:
Timestamp:
2009/09/17 19:45:44 (15 years ago)
Author:
Seasoft
Message:
  • 機能とサイトの判定ロジックを実装
  • 携帯端末の場合、モバイルサイトへリダイレクトする処理をメソッドに移動
  • /data/include/module.inc の読み込みタイミングを移動(ロジックの直接実行を含むため。エラー処理を行ないやすいように他の共通ファイルの読み込みの後とした。)
  • インストール中は一部の共通ロジックを
  • インストール初期処理の誤りを修正。処理をスマートに。
Location:
branches/comu-ver2
Files:
8 edited

Legend:

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

    r18234 r18293  
    147147        } 
    148148    } 
     149 
     150    /** 
     151     * 携帯端末の場合、モバイルサイトへリダイレクトする 
     152     * 
     153     * @return void 
     154     */ 
     155    function sfAutoRedirectMobileSite() { 
     156        // 携帯端末ではない場合、処理しない 
     157        if (SC_MobileUserAgent::isNonMobile()) return; 
     158 
     159        $url = SC_Utils_Ex::sfIsHTTPS() 
     160            ? MOBILE_SSL_URL 
     161            : MOBILE_SITE_URL 
     162        ; 
     163 
     164        $url .= (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches)) 
     165            ? $matches[1] 
     166            : '' 
     167        ; 
     168 
     169        header("Location: ". SC_Utils_Ex::sfRmDupSlash($url)); 
     170        exit; 
     171    } 
    149172} 
    150173?> 
  • branches/comu-ver2/data/class/pages/error/LC_Page_Error_SystemError.php

    r18291 r18293  
    5656 
    5757        $this->tpl_title = 'システムエラー'; 
    58         $this->adminPage = $this->isAdminPage(); 
     58        $this->adminPage = SC_Utils_Ex::sfIsAdminFunction(); 
    5959 
    6060        if ($this->adminPage) { 
     
    108108    } 
    109109 
    110     /** 
    111      * 管理機能かどうかを判定する. 
    112      * 
    113      * @return boolean 
    114      */ 
    115     function isAdminPage() { 
    116         return preg_match('|/admin/|', $_SERVER['PHP_SELF']); 
    117     } 
    118      
    119110    /** 
    120111     * エラーメッセージを生成する 
  • branches/comu-ver2/data/class/util/SC_Utils.php

    r18292 r18293  
    7777    function sfInitInstall() { 
    7878        // インストール済みが定義されていない。 
    79         if(!defined('ECCUBE_INSTALL')) { 
    80             if(!ereg("/install/", $_SERVER['PHP_SELF'])) { 
    81                 header("Location: ./install/"); // TODO 絶対URL にする 
    82             } 
    83         } else { 
    84             $path = HTML_PATH . "install/index.php"; 
    85             if(file_exists($path)) { 
    86                 SC_Utils::sfErrorHeader(">> /install/index.phpは、インストール完了後にファイルを削除してください。"); 
    87             } 
     79        if (!defined('ECCUBE_INSTALL')) { 
     80            header("Location: ./install/" . DIR_INDEX_URL); // TODO 絶対URL にする 
     81            exit; 
     82        } 
     83        $path = HTML_PATH . "install/index.php"; 
     84        if(file_exists($path)) { 
     85            SC_Utils::sfErrorHeader(">> /install/index.phpは、インストール完了後にファイルを削除してください。"); 
    8886        } 
    8987    } 
     
    21632161        return $string; 
    21642162    } 
     2163 
     2164    /** 
     2165     * 管理機能かを判定 
     2166     * 
     2167     * @return bool 管理機能か 
     2168     */ 
     2169    function sfIsAdminFunction() { 
     2170        return defined('ADMIN_FUNCTION') && ADMIN_FUNCTION; 
     2171    } 
     2172 
     2173    /** 
     2174     * フロント機能かを判定 
     2175     * 
     2176     * @return bool フロント機能か 
     2177     */ 
     2178    function sfIsFrontFunction() { 
     2179        return SC_Utils_Ex::sfIsPcSite() || SC_Utils_Ex::sfIsMobileSite(); 
     2180    } 
     2181 
     2182    /** 
     2183     * フロント機能PCサイトかを判定 
     2184     * 
     2185     * @return bool フロント機能PCサイトか 
     2186     */ 
     2187    function sfIsPcSite() { 
     2188        return defined('FRONT_FUNCTION_PC_SITE') && FRONT_FUNCTION_PC_SITE; 
     2189    } 
     2190 
     2191    /** 
     2192     * フロント機能モバイル機能かを判定 
     2193     * 
     2194     * @return bool フロント機能モバイル機能か 
     2195     */ 
     2196    function sfIsMobileSite() { 
     2197        return defined('MOBILE_SITE') && MOBILE_SITE; 
     2198    } 
     2199 
     2200    /** 
     2201     * インストール機能かを判定 
     2202     * 
     2203     * @return bool インストール機能か 
     2204     */ 
     2205    function sfIsInstallFunction() { 
     2206        return defined('INSTALL_FUNCTION') && INSTALL_FUNCTION; 
     2207    } 
    21652208} 
    21662209?> 
  • branches/comu-ver2/data/require_base.php

    r18234 r18293  
    4646$objInit->init(); 
    4747 
    48 require_once(DATA_PATH . "include/module.inc"); 
    4948require_once(CLASS_EX_PATH . "util_extends/GC_Utils_Ex.php"); 
    5049require_once(CLASS_EX_PATH . "util_extends/SC_Utils_Ex.php"); 
     
    7675require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_PageLayout_Ex.php"); 
    7776require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_DB_Ex.php"); 
    78 require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_Session_Ex.php"); 
    7977require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_Mail_Ex.php"); 
    8078require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_Mobile_Ex.php"); 
     79require_once(DATA_PATH . "include/module.inc"); 
    8180include_once(DATA_PATH . "require_plugin.php"); 
    8281 
    83 // セッションハンドラ開始 
    84 $objSession = new SC_Helper_Session_Ex(); 
     82// インストール中で無い場合、 
     83if (!SC_Utils_Ex::sfIsInstallFunction()) { 
     84    // インストールチェック 
     85    SC_Utils_Ex::sfInitInstall(); 
    8586 
    86 // インストールチェック 
    87 SC_Utils_Ex::sfInitInstall(); 
     87    // セッションハンドラ開始 
     88    require_once CLASS_EX_PATH . 'helper_extends/SC_Helper_Session_Ex.php'; 
     89    $objSession = new SC_Helper_Session_Ex(); 
    8890 
    89 // セッション初期化・開始 
    90 require_once CLASS_PATH . 'session/SC_SessionFactory.php'; 
    91 $sessionFactory = SC_SessionFactory::getInstance(); 
    92 $sessionFactory->initSession(); 
     91    // セッション初期化・開始 
     92    require_once CLASS_PATH . 'session/SC_SessionFactory.php'; 
     93    $sessionFactory = SC_SessionFactory::getInstance(); 
     94    $sessionFactory->initSession(); 
     95} 
    9396 
    9497// 絵文字変換 (除去) フィルターを組み込む。 
  • branches/comu-ver2/html/admin/require.php

    r18234 r18293  
    2626 
    2727require_once HTML_PATH . 'define.php'; 
     28define('ADMIN_FUNCTION', true); 
    2829require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php'; 
    2930?> 
  • branches/comu-ver2/html/install/index.php

    r18235 r18293  
    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__)); 
    2533require_once(DATA_PATH . "module/Request.php"); 
  • branches/comu-ver2/html/mobile/require.php

    r18234 r18293  
    11<?php 
    2 /** 
    3  * 
     2/* 
    43 * This file is part of EC-CUBE 
    54 * 
     
    2625define("HTML_PATH", rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/../'), '/\\') . '/'); 
    2726 
    28 require_once(HTML_PATH . "define.php"); 
     27require_once HTML_PATH . 'define.php'; 
    2928define('MOBILE_SITE', true); 
    30 require_once(HTML_PATH . HTML2DATA_DIR . "require_base.php"); 
     29require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php'; 
    3130 
    3231// モバイルサイトを利用しない設定の場合、落とす。 
  • branches/comu-ver2/html/require.php

    r18234 r18293  
    2525define("HTML_PATH", rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/'), '/\\') . '/'); 
    2626 
    27 require_once(HTML_PATH . "define.php"); 
    28 require_once(HTML_PATH . HTML2DATA_DIR . "require_base.php"); 
     27require_once HTML_PATH . 'define.php'; 
     28define('FRONT_FUNCTION_PC_SITE', true); 
     29require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php'; 
    2930 
    30 // 携帯端末の場合は mobile 以下へリダイレクトする。 
    31 if (SC_MobileUserAgent::isMobile()) { 
    32     $url = ""; 
    33     if (SC_Utils_Ex::sfIsHTTPS()) { 
    34         $url = MOBILE_SSL_URL; 
    35     } else { 
    36         $url = MOBILE_SITE_URL; 
    37     } 
    38  
    39     if (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches)) { 
    40         $path = $matches[1]; 
    41     } else { 
    42         $path = ''; 
    43     } 
    44  
    45     header("Location: ". SC_Utils_Ex::sfRmDupSlash($url . $path)); 
    46     exit; 
    47 } 
     31// 携帯端末の場合、モバイルサイトへリダイレクトする 
     32SC_MobileUserAgent::sfAutoRedirectMobileSite(); 
    4833 
    4934?> 
Note: See TracChangeset for help on using the changeset viewer.