Index: /branches/comu-ver2/html/admin/require.php
===================================================================
--- /branches/comu-ver2/html/admin/require.php (revision 18234)
+++ /branches/comu-ver2/html/admin/require.php (revision 18293)
@@ -26,4 +26,5 @@
require_once HTML_PATH . 'define.php';
+define('ADMIN_FUNCTION', true);
require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php';
?>
Index: /branches/comu-ver2/html/require.php
===================================================================
--- /branches/comu-ver2/html/require.php (revision 18234)
+++ /branches/comu-ver2/html/require.php (revision 18293)
@@ -25,25 +25,10 @@
define("HTML_PATH", rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/'), '/\\') . '/');
-require_once(HTML_PATH . "define.php");
-require_once(HTML_PATH . HTML2DATA_DIR . "require_base.php");
+require_once HTML_PATH . 'define.php';
+define('FRONT_FUNCTION_PC_SITE', true);
+require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php';
-// 携帯端末の場合は mobile 以下へリダイレクトする。
-if (SC_MobileUserAgent::isMobile()) {
- $url = "";
- if (SC_Utils_Ex::sfIsHTTPS()) {
- $url = MOBILE_SSL_URL;
- } else {
- $url = MOBILE_SITE_URL;
- }
-
- if (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches)) {
- $path = $matches[1];
- } else {
- $path = '';
- }
-
- header("Location: ". SC_Utils_Ex::sfRmDupSlash($url . $path));
- exit;
-}
+// 携帯端末の場合、モバイルサイトへリダイレクトする
+SC_MobileUserAgent::sfAutoRedirectMobileSite();
?>
Index: /branches/comu-ver2/html/install/index.php
===================================================================
--- /branches/comu-ver2/html/install/index.php (revision 18235)
+++ /branches/comu-ver2/html/install/index.php (revision 18293)
@@ -21,5 +21,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-require_once("../require.php");
+// ▼require.php 相当
+// rtrim は PHP バージョン依存対策
+define('HTML_PATH', rtrim(realpath(rtrim(realpath(dirname(__FILE__)), '/\\') . '/../'), '/\\') . '/');
+
+require_once HTML_PATH . 'define.php';
+define('INSTALL_FUNCTION', true);
+require_once HTML_PATH . HTML2DATA_DIR . 'require_base.php';
+// ▲require.php 相当
+
$INSTALL_DIR = realpath(dirname( __FILE__));
require_once(DATA_PATH . "module/Request.php");
Index: /branches/comu-ver2/html/mobile/require.php
===================================================================
--- /branches/comu-ver2/html/mobile/require.php (revision 18234)
+++ /branches/comu-ver2/html/mobile/require.php (revision 18293)
@@ -1,5 +1,4 @@
init();
-require_once(DATA_PATH . "include/module.inc");
require_once(CLASS_EX_PATH . "util_extends/GC_Utils_Ex.php");
require_once(CLASS_EX_PATH . "util_extends/SC_Utils_Ex.php");
@@ -76,19 +75,23 @@
require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_PageLayout_Ex.php");
require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_DB_Ex.php");
-require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_Session_Ex.php");
require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_Mail_Ex.php");
require_once(CLASS_EX_PATH . "helper_extends/SC_Helper_Mobile_Ex.php");
+require_once(DATA_PATH . "include/module.inc");
include_once(DATA_PATH . "require_plugin.php");
-// セッションハンドラ開始
-$objSession = new SC_Helper_Session_Ex();
+// インストール中で無い場合、
+if (!SC_Utils_Ex::sfIsInstallFunction()) {
+ // インストールチェック
+ SC_Utils_Ex::sfInitInstall();
-// インストールチェック
-SC_Utils_Ex::sfInitInstall();
+ // セッションハンドラ開始
+ require_once CLASS_EX_PATH . 'helper_extends/SC_Helper_Session_Ex.php';
+ $objSession = new SC_Helper_Session_Ex();
-// セッション初期化・開始
-require_once CLASS_PATH . 'session/SC_SessionFactory.php';
-$sessionFactory = SC_SessionFactory::getInstance();
-$sessionFactory->initSession();
+ // セッション初期化・開始
+ require_once CLASS_PATH . 'session/SC_SessionFactory.php';
+ $sessionFactory = SC_SessionFactory::getInstance();
+ $sessionFactory->initSession();
+}
// 絵文字変換 (除去) フィルターを組み込む。
Index: /branches/comu-ver2/data/class/pages/error/LC_Page_Error_SystemError.php
===================================================================
--- /branches/comu-ver2/data/class/pages/error/LC_Page_Error_SystemError.php (revision 18291)
+++ /branches/comu-ver2/data/class/pages/error/LC_Page_Error_SystemError.php (revision 18293)
@@ -56,5 +56,5 @@
$this->tpl_title = 'システムエラー';
- $this->adminPage = $this->isAdminPage();
+ $this->adminPage = SC_Utils_Ex::sfIsAdminFunction();
if ($this->adminPage) {
@@ -108,13 +108,4 @@
}
- /**
- * 管理機能かどうかを判定する.
- *
- * @return boolean
- */
- function isAdminPage() {
- return preg_match('|/admin/|', $_SERVER['PHP_SELF']);
- }
-
/**
* エラーメッセージを生成する
Index: /branches/comu-ver2/data/class/SC_MobileUserAgent.php
===================================================================
--- /branches/comu-ver2/data/class/SC_MobileUserAgent.php (revision 18234)
+++ /branches/comu-ver2/data/class/SC_MobileUserAgent.php (revision 18293)
@@ -147,4 +147,27 @@
}
}
+
+ /**
+ * 携帯端末の場合、モバイルサイトへリダイレクトする
+ *
+ * @return void
+ */
+ function sfAutoRedirectMobileSite() {
+ // 携帯端末ではない場合、処理しない
+ if (SC_MobileUserAgent::isNonMobile()) return;
+
+ $url = SC_Utils_Ex::sfIsHTTPS()
+ ? MOBILE_SSL_URL
+ : MOBILE_SITE_URL
+ ;
+
+ $url .= (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches))
+ ? $matches[1]
+ : ''
+ ;
+
+ header("Location: ". SC_Utils_Ex::sfRmDupSlash($url));
+ exit;
+ }
}
?>
Index: /branches/comu-ver2/data/class/util/SC_Utils.php
===================================================================
--- /branches/comu-ver2/data/class/util/SC_Utils.php (revision 18292)
+++ /branches/comu-ver2/data/class/util/SC_Utils.php (revision 18293)
@@ -77,13 +77,11 @@
function sfInitInstall() {
// インストール済みが定義されていない。
- if(!defined('ECCUBE_INSTALL')) {
- if(!ereg("/install/", $_SERVER['PHP_SELF'])) {
- header("Location: ./install/"); // TODO 絶対URL にする
- }
- } else {
- $path = HTML_PATH . "install/index.php";
- if(file_exists($path)) {
- SC_Utils::sfErrorHeader(">> /install/index.phpは、インストール完了後にファイルを削除してください。");
- }
+ if (!defined('ECCUBE_INSTALL')) {
+ header("Location: ./install/" . DIR_INDEX_URL); // TODO 絶対URL にする
+ exit;
+ }
+ $path = HTML_PATH . "install/index.php";
+ if(file_exists($path)) {
+ SC_Utils::sfErrorHeader(">> /install/index.phpは、インストール完了後にファイルを削除してください。");
}
}
@@ -2163,4 +2161,49 @@
return $string;
}
+
+ /**
+ * 管理機能かを判定
+ *
+ * @return bool 管理機能か
+ */
+ function sfIsAdminFunction() {
+ return defined('ADMIN_FUNCTION') && ADMIN_FUNCTION;
+ }
+
+ /**
+ * フロント機能かを判定
+ *
+ * @return bool フロント機能か
+ */
+ function sfIsFrontFunction() {
+ return SC_Utils_Ex::sfIsPcSite() || SC_Utils_Ex::sfIsMobileSite();
+ }
+
+ /**
+ * フロント機能PCサイトかを判定
+ *
+ * @return bool フロント機能PCサイトか
+ */
+ function sfIsPcSite() {
+ return defined('FRONT_FUNCTION_PC_SITE') && FRONT_FUNCTION_PC_SITE;
+ }
+
+ /**
+ * フロント機能モバイル機能かを判定
+ *
+ * @return bool フロント機能モバイル機能か
+ */
+ function sfIsMobileSite() {
+ return defined('MOBILE_SITE') && MOBILE_SITE;
+ }
+
+ /**
+ * インストール機能かを判定
+ *
+ * @return bool インストール機能か
+ */
+ function sfIsInstallFunction() {
+ return defined('INSTALL_FUNCTION') && INSTALL_FUNCTION;
+ }
}
?>