/** * Copyright (C) 2012 Vizualizer All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @author Naohisa Minagawa <*****@*****.**> * @copyright Copyright (c) 2010, Vizualizer * @license http://www.apache.org/licenses/LICENSE-2.0.html Apache License, Version 2.0 * @since PHP 5.3 * @version 1.0.0 */ function smarty_function_emoji($params, $smarty, $template) { // codeパラメータは必須です。 if (empty($params['code'])) { trigger_error("emoji: missing code parameter", E_USER_WARNING); return; } // パラメータを変数にコピー $code = $params['code']; if (preg_match("/[0-9]{1,3}/", $code) && is_numeric($code) && 0 < $code && $code < 253) { // 変換表を配列に格納 $emoji_array = array(); $emoji_array[] = ""; $contents = @file(dirname(__FILE__) . "/emojix.csv"); foreach ($contents as $line) { $line = rtrim($line); $emoji_array[] = explode(",", $line); } if (Net_UserAgent_Mobile::isMobile()) { // モバイルユーザーエージェントのインスタンスを取得 $agent = Net_UserAgent_Mobile::singleton(); if ($agent->isDoCoMo()) { // DoCoMo echo mb_convert_encoding($emoji_array[$code][1], "UTF-8", "SJIS"); } elseif ($agent->isEZweb()) { // au if (preg_match("/[^0-9]/", $emoji_array[$code][2])) { echo $emoji_array[$code][2]; } else { echo "<img localsrc=\"" . $emoji_array[$code][2] . "\" />"; } } elseif ($agent->isSoftbank()) { if ($agent->isType3GC()) { // Softbank-UTF8 $e = new Emoji(); if (preg_match("/^[A-Z]{1}?/", $emoji_array[$code][3])) { echo "\$" . $emoji_array[$code][3] . ""; } else { echo $emoji_array[$code][3]; } } else { // Softbank-SJIS if (preg_match("/^[A-Z]{1}?/", $emoji_array[$code][3])) { echo "\$" . mb_convert_encoding($emoji_array[$code][3], "SJIS", "UTF-8") . ""; } else { echo mb_convert_encoding($emoji_array[$code][3], "SJIS", "UTF-8"); } } } } else { echo "<img src=\"/emoji_images/" . $emoji_array[$code][0] . ".gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"\" />"; } } else { // 絵文字のコードが規定値以外 return "[Error!]\n"; } }
/** * 携帯かどうか確認 * * @return bool * @access public */ function isMobile() { $container =& DIContainerFactory::getContainer(); $session =& $container->getComponent("Session"); $reader_flag = intval($session->getParameter("_reader_flag")); $pcviewer_flag = intval($session->getParameter("_pcviewer_flag")); if ($reader_flag == _ON) { return true; } else { if ($pcviewer_flag == _ON) { return false; } else { if (MobileCheck::isSmartPhone()) { return true; } else { return Net_UserAgent_Mobile::isMobile(); } } } }
/** * パラメーター管理で設定したセッション維持設定に従って適切なオブジェクトを返す. * * @return SC_SessionFactory */ function getInstance() { $type = defined('SESSION_KEEP_METHOD') ? SESSION_KEEP_METHOD : ''; switch ($type) { // セッションの維持にリクエストパラメーターを使用する case 'useRequest': $session = new SC_SessionFactory_UseRequest(); SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE ? $session->setState('mobile') : $session->setState('pc'); break; // クッキーを使用する // クッキーを使用する case 'useCookie': // モバイルの場合はSC_SessionFactory_UseRequestを使用する if (Net_UserAgent_Mobile::isMobile() === true) { $session = new SC_SessionFactory_UseRequest(); $session->setState('mobile'); break; } default: $session = new SC_SessionFactory_UseCookie(); break; } return $session; }
/** * 端末種別を判別する。 * * SC_Display::MOBILE = ガラケー = 1 * SC_Display::SMARTPHONE = スマホ = 2 * SC_Display::PC = PC = 10 * * @static * @param $reset boolean * @return integer 端末種別ID */ public static function detectDevice($reset = FALSE) { if (is_null(SC_Display_Ex::$device) || $reset) { $nu = new Net_UserAgent_Mobile(); $su = new SC_SmartphoneUserAgent_Ex(); if ($nu->isMobile()) { SC_Display_Ex::$device = DEVICE_TYPE_MOBILE; } elseif ($su->isSmartphone()) { SC_Display_Ex::$device = DEVICE_TYPE_SMARTPHONE; } else { SC_Display_Ex::$device = DEVICE_TYPE_PC; } } return SC_Display_Ex::$device; }
function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true) { $arrTplVar = new stdClass(); $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $arrTplVar->arrInfo = $arrInfo; $objQuery = new SC_Query_Ex(); if ($subject == "" && $header == "" && $footer == "") { // メールテンプレート情報の取得 $where = "template_id = ?"; $arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id)); $arrTplVar->tpl_header = $arrRet[0]['header']; $arrTplVar->tpl_footer = $arrRet[0]['footer']; $tmp_subject = $arrRet[0]['subject']; } else { $arrTplVar->tpl_header = $header; $arrTplVar->tpl_footer = $footer; $tmp_subject = $subject; } // 受注情報の取得 $where = "order_id = ?"; $arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id)); $arrOrder = $arrRet[0]; $objQuery->setOrder('order_detail_id'); $arrTplVar->arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id)); $objProduct = new SC_Product_Ex(); $objQuery->setOrder('shipping_id'); $arrRet = $objQuery->select("*", "dtb_shipping", "order_id = ?", array($order_id)); foreach (array_keys($arrRet) as $key) { $objQuery->setOrder('shipping_id'); $arrItems = $objQuery->select("*", "dtb_shipment_item", "order_id = ? AND shipping_id = ?", array($order_id, $arrRet[$key]['shipping_id'])); foreach ($arrItems as $itemKey => $arrDetail) { foreach ($arrDetail as $detailKey => $detailVal) { $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']][$detailKey] = $detailVal; } $arrRet[$key]['shipment_item'][$arrDetail['product_class_id']]['productsClass'] =& $objProduct->getDetailAndProductsClass($arrDetail['product_class_id']); } } $arrTplVar->arrShipping = $arrRet; $arrTplVar->Message_tmp = $arrOrder['message']; // 会員情報の取得 $customer_id = $arrOrder['customer_id']; $objQuery->setOrder('customer_id'); $arrRet = $objQuery->select('point', "dtb_customer", "customer_id = ?", array($customer_id)); $arrCustomer = isset($arrRet[0]) ? $arrRet[0] : ""; $arrTplVar->arrCustomer = $arrCustomer; $arrTplVar->arrOrder = $arrOrder; //その他決済情報 if ($arrOrder['memo02'] != "") { $arrOther = unserialize($arrOrder['memo02']); foreach ($arrOther as $other_key => $other_val) { if (SC_Utils_Ex::sfTrim($other_val['value']) == "") { $arrOther[$other_key]['value'] = ""; } } $arrTplVar->arrOther = $arrOther; } // 都道府県変換 $arrTplVar->arrPref = $this->arrPref; $objCustomer = new SC_Customer_Ex(); $arrTplVar->tpl_user_point = $objCustomer->getValue('point'); if (Net_UserAgent_Mobile::isMobile() === true) { $objMailView = new SC_MobileView_Ex(); } else { $objMailView = new SC_SiteView_Ex(); } // メール本文の取得 $objMailView->assignobj($arrTplVar); $body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]); // メール送信処理 $objSendMail = new SC_SendMail_Ex(); $bcc = $arrInfo['email01']; $from = $arrInfo['email03']; $error = $arrInfo['email04']; $tosubject = $this->sfMakeSubject($tmp_subject, $objMailView); $objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc); $objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " " . $arrOrder["order_name02"] . " 様"); // 送信フラグ:trueの場合は、送信する。 if ($send) { if ($objSendMail->sendMail()) { $this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body); } } return $objSendMail; }
/** * 機種を判別する。 * * SC_Display::MOBILE = ガラケー = 1 * SC_Display::SMARTPHONE = スマホ = 2 * SC_Display::PC = PC = 10 * * @static * @return integer 端末種別ID */ function detectDevice() { $nu = new Net_UserAgent_Mobile(); $su = new SC_SmartphoneUserAgent_Ex(); $retDevice = 0; if ($nu->isMobile()) { return DEVICE_TYPE_MOBILE; } elseif ($su->isSmartphone()) { return DEVICE_TYPE_SMARTPHONE; } else { return DEVICE_TYPE_PC; } }
/** * プレフィルタ * 初期処理を行う * @access private */ function _prefilter() { // NetCommonsバージョンファイル読み込み if (@file_exists(WEBAPP_DIR . "/config/version.php")) { include_once WEBAPP_DIR . "/config/version.php"; } $page_id = $this->_request->getParameter("page_id"); $block_id = $this->_request->getParameter("block_id"); $_redirect_url = $this->_request->getParameter("_redirect_url"); $action_name = $this->_request->getParameter(ACTION_KEY); $attributes = $this->getAttributes(); if (!$action_name) { $action_name = DEFAULT_ACTION; $this->_request->setParameter(ACTION_KEY, DEFAULT_ACTION); } // http -> https if ($action_name == DEFAULT_ACTION && (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on') && preg_match("/^https:\\/\\//i", BASE_URL)) { $url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; header('Location: ' . $url); exit; } // //block_id page_id設定 // if ($page_id == null) { $page_id = 0; $this->_request->setParameter("page_id", 0); } if ($block_id == null || $block_id < 0) { $block_id = 0; $this->_request->setParameter("block_id", 0); } if ($_redirect_url) { $_redirect_url = str_replace("@@", "#", $_redirect_url); $_redirect_url = str_replace("@", "&", $_redirect_url); $_redirect_url = str_replace("?_sub_action=", "?action=", $_redirect_url); $this->_request->setParameter("_redirect_url", $_redirect_url); } // ---------------------------------------------- // --- getDataクラス取得 --- // ---------------------------------------------- //$getdata =& new GetData; //$this->_container->register($getdata, "GetData"); $getdata =& $this->_container->getComponent("GetData"); // ---------------------------------------------- // --- configデータ取得 --- // ---------------------------------------------- $config =& $this->_container->getComponent("configView"); $config_obj =& $config->getConfig(_SYS_CONF_MODID); // // _PAGESTYLE_CONF_CATID,_SECURITY_CONF_CATIDのみ保存 // $buf_config = $config_obj; //unset($buf_config[_GENERAL_CONF_CATID]); unset($buf_config[_SERVER_CONF_CATID]); unset($buf_config[_MAIL_CONF_CATID]); unset($buf_config[_META_CONF_CATID]); unset($buf_config[_ENTER_EXIT_CONF_CATID]); unset($buf_config[_DEBUG_CONF_CATID]); //if(isset($buf_config[_SECURITY_CONF_CATID]['security_level']) && // $buf_config[_SECURITY_CONF_CATID]['security_level']['conf_value'] == _SECURITY_LEVEL_NONE) { // // チェックしない場合、セキュリティ項目unset // unset($buf_config[_SECURITY_CONF_CATID]); //} $getdata->setParameter("config", $buf_config); // ------------------------------------------------------------------------------------------ // --- Session情報 --- // --- configデータよりSession情報を登録するため、Filter.Sessionではsession_start()しない --- // ------------------------------------------------------------------------------------------ if ($config_obj[_SERVER_CONF_CATID]['use_mysession']['conf_value'] && $config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'] != '') { $this->_session->setName($config_obj[_SERVER_CONF_CATID]['session_name']['conf_value']); } //1.1と同様の処理:後に削除 //$sslpost_name = $this->_request->getParameter($config_obj[_GENERAL_CONF_CATID]['sslpost_name']['conf_value']); //if ($config_obj[_GENERAL_CONF_CATID]['use_ssl']['conf_value'] && // isset($sslpost_name) && $sslpost_name != '') { // session_id($sslpost_name); //} else if ($config_obj[_SERVER_CONF_CATID]['use_mysession']['conf_value'] && // $config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'] != '') { // if (isset($_COOKIE[$config_obj[_SERVER_CONF_CATID]['session_name']['conf_value']])) { // session_id($_COOKIE[$config_obj[_SERVER_CONF_CATID]['session_name']['conf_value']]); // } else { // // no custom session cookie set, destroy session if any // $this->_session->close(); // } //} //if(isset($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'])){ ini_set('session.gc_maxlifetime', $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60); //} //------------------------------------------------------------------------------- // ---Cookieパラメータセット --- //------------------------------------------------------------------------------- $path = $config_obj[_SERVER_CONF_CATID]['cookie_path']['conf_value']; if ($path == "") { $path = "/"; $pathList = explode("_", $action_name); if (!(isset($pathList[0]) && $pathList[0] == "install")) { $path = strstr(preg_replace("/^(http:\\/\\/|https:\\/\\/)/i", "", BASE_URL), "/"); if ($path === false) { $path = '/'; } else { $buf_path = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/i', "", BASE_DIR); if ($buf_path != BASE_DIR && $buf_path != "") { if (strstr($path, $buf_path)) { $path = substr($buf_path, 0, 1) == '/' ? $buf_path : "/" . $buf_path; } } } } //$path = strstr(preg_replace("/^(http:\/\/|https:\/\/)/i","", BASE_URL), "/"); } $domain = $config_obj[_SERVER_CONF_CATID]['cookie_domain']['conf_value']; $secure = intval($config_obj[_SERVER_CONF_CATID]['cookie_secure']['conf_value']); session_set_cookie_params(0, $path, $domain, $secure); //session_set_cookie_params($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60, $path, $domain, $secure); //ini_set("session.cookie_path", $path); //ini_set("session.cookie_domain", $domain); //ini_set("session.cookie_secure", $secure); //ini_set("session.cookie_lifetime", $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60); //setcookie($this->_session->getName(), $this->_session->getID(), time()+($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60)); // ---------------------------------------------- // --- セッションスタート --- // ---------------------------------------------- if (Net_UserAgent_Mobile::isMobile()) { ini_set('session.use_only_cookies', _OFF); } if (isset($attributes["regenerate_flag"]) && $attributes["regenerate_flag"] == _OFF) { $this->_session->start(_OFF); } else { $this->_session->start(intval($config_obj[_SERVER_CONF_CATID]['session_regenerate']['conf_value'])); } $user_id = $this->_session->getParameter("_user_id"); if (!isset($user_id)) { $user_id = "0"; $this->_session->setParameter("_user_id", "0"); $this->_session->setParameter("_handle", ''); } // ---------------------------------------------- // --- 固定リンク --- // ---------------------------------------------- if (isset($config_obj[_SERVER_CONF_CATID]['use_permalink']['conf_value']) && $config_obj[_SERVER_CONF_CATID]['use_permalink']['conf_value'] == _ON) { $this->_session->setParameter("_permalink_flag", _ON); } else { $this->_session->setParameter("_permalink_flag", _OFF); } // 言語セット $_lang = $this->_request->getParameter('lang'); if (!empty($_lang)) { $languages = $this->_languagesView->getLanguages(array("lang_dirname" => $_lang)); if (!isset($languages[0])) { $_lang = null; } else { $this->_session->setParameter('_lang', $_lang); } } if (empty($_lang)) { $_lang = $this->_session->getParameter('_lang'); if (empty($_lang)) { //システム管理のシステム標準使用言語の「自動」で選択している場合、自動で判断する。 if (empty($config_obj[_GENERAL_CONF_CATID]['language']['conf_value'])) { $this->_session->setParameter('_lang', $this->_getAcceptLang()); } else { $this->_session->setParameter('_lang', $config_obj[_GENERAL_CONF_CATID]['language']['conf_value']); } } } if ($action_name == "pages_view_main") { $header_menu_flag = _ON; if (isset($config_obj[_PAGESTYLE_CONF_CATID]['header_menu_flag']['conf_value'])) { $header_menu_flag = $config_obj[_PAGESTYLE_CONF_CATID]['header_menu_flag']['conf_value']; } $this->_session->setParameter("_header_menu_flag", $header_menu_flag); } // ---------------------------------------------- // --- 自動ログイン設定 --- // ---------------------------------------------- $autologin_login_cookie_name = $config_obj[_GENERAL_CONF_CATID]['autologin_login_cookie_name']['conf_value']; $autologin_pass_cookie_name = $config_obj[_GENERAL_CONF_CATID]['autologin_pass_cookie_name']['conf_value']; if (($user_id == "0" || $user_id == null) && $autologin_login_cookie_name != "" && $autologin_pass_cookie_name != "") { $login_id = isset($_COOKIE[$autologin_login_cookie_name]) ? $_COOKIE[$autologin_login_cookie_name] : null; //TODO:stripslashesする必要があるかも $pass = isset($_COOKIE[$autologin_pass_cookie_name]) ? $_COOKIE[$autologin_pass_cookie_name] : null; //TODO:stripslashesする必要があるかも if (empty($login_id) || empty($pass) || is_numeric($pass)) { $html = "error"; } else { if ($config_obj[_GENERAL_CONF_CATID]['autologin_use']['conf_value'] == _AUTOLOGIN_OK) { $params = array("action" => "login_action_main_init", "login_id" => $login_id, "password" => $pass, "md5" => "1", "_header" => "0", "_output" => "0"); if ($config_obj[_GENERAL_CONF_CATID]['autologin_use']['conf_value'] == _AUTOLOGIN_OK) { $params['rememberme'] = _OFF; } $preexecuteMain =& $this->_container->getComponent("preexecuteMain"); $html = $preexecuteMain->preExecute("login_action_main_init", $params, true); $user_id = $this->_session->getParameter("_user_id"); } else { $html = "error"; } //$usersView =& $this->_container->getComponent("usersView"); //$user =& $usersView->getUsers(array("login_id" => $login_id,"password" => $pass)); } //$cookie_path = '/' ; if ($html == "error") { if ($config_obj[_GENERAL_CONF_CATID]['autologin_use']['conf_value'] == _AUTOLOGIN_NO) { setcookie($autologin_login_cookie_name, '', time() - 3600, $path, $domain, $secure); } setcookie($autologin_pass_cookie_name, '', time() - 3600, $path, $domain, $secure); } } $user_auth_id = $this->_session->getParameter("_user_auth_id"); if ($user_auth_id == _AUTH_OTHER || $user_auth_id == null) { //ログイン前 $this->_session->setParameter("_allow_attachment_flag", _ALLOW_ATTACHMENT_NO); $this->_session->setParameter("_allow_htmltag_flag", _ALLOW_ATTACHMENT_NO); $this->_session->setParameter("_allow_video_flag", _OFF); $this->_session->setParameter("_allow_layout_flag", _OFF); $this->_session->setParameter("_private_max_size", -1); } // セッション情報をクッキーに保存する //if ($user_id > 0 && $config_obj[_SERVER_CONF_CATID]['use_mysession']['conf_value'] && // $config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'] != '') { // setcookie($config_obj[_SERVER_CONF_CATID]['session_name']['conf_value'], session_id(), time()+(60 * $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value']), '/', '', 0); //} // // config設定 // if ($action_name == "encryption_view_publickey" || $action_name == "headerinc_view_main") { //公開鍵取得アクション,またはヘッダー取得処理なのでチェックしない return; /* } else if($_redirect_url && !preg_match("{^".BASE_URL."}", $_redirect_url)) { // // 他サーバ // // TODO:他サーバ処理は現状、未実装のためコメント // 他サーバからの場合、DBの値に関わらずDEBUGはOFF if (isset($attributes["debug"])) { $this->_session->setParameter("_php_debug",0); $this->_session->setParameter("_sql_debug",0); $this->_session->setParameter("_smarty_debug",0); $this->_session->setParameter("_maple_debug",0); $this->_session->setParameter("_trace_log_level",LEVEL_TRACE); } //データセット //$getdata->setParameter("mysite",false); */ } else { // // 自サーバ // // // ---------------------------------------------- // ---デバッグ関連 --- // ---------------------------------------------- if (isset($attributes["debug"])) { // DBから取得 foreach ($config_obj[_DEBUG_CONF_CATID] as $conf_rec) { switch ($conf_rec["conf_name"]) { case "php_debug": $php_debug = $conf_rec["conf_value"]; break; case "sql_debug": $sql_debug = $conf_rec["conf_value"]; break; case "smarty_debug": $smarty_debug = $conf_rec["conf_value"]; break; case "maple_debug": $maple_debug = $conf_rec["conf_value"]; break; case "trace_log_level": $trace_log_level = $conf_rec["conf_value"]; break; case "use_db_debug": $use_db_debug = $conf_rec["conf_value"]; break; } } if ($use_db_debug) { $this->_session->setParameter("_php_debug", $php_debug); if ($php_debug && version_compare(phpversion(), '5.3.0', '>=')) { error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT); } elseif ($php_debug) { error_reporting(E_ALL); } else { error_reporting(0); } $this->_session->setParameter("_sql_debug", $sql_debug); $this->_session->setParameter("_smarty_debug", $smarty_debug); $this->_session->setParameter("_maple_debug", $maple_debug); $this->_session->setParameter("_trace_log_level", $trace_log_level); $this->_session->setParameter("_use_db_debug", $use_db_debug); } } //データセット //$getdata->setParameter("mysite",true); } //debugモード if (isset($attributes["debug"])) { $sql_debug = $this->_session->getParameter("_sql_debug"); $db =& $this->_container->getComponent("DbObject"); $db->setDebugMode($sql_debug); } // ---------------------------------------------- // ---タイムゾーン --- // ---------------------------------------------- if (isset($config_obj[_GENERAL_CONF_CATID]['server_TZ'])) { $this->_session->setParameter("_server_TZ", $config_obj[_GENERAL_CONF_CATID]['server_TZ']['conf_value']); } else { // 日本時間 $this->_session->setParameter("_server_TZ", 9); } if (isset($config_obj[_GENERAL_CONF_CATID]['default_TZ'])) { $this->_session->setParameter("_default_TZ", $config_obj[_GENERAL_CONF_CATID]['default_TZ']['conf_value']); } else { // 日本時間 $this->_session->setParameter("_default_TZ", 9); } if ($user_id == "0" || $user_id == null) { $this->_session->setParameter("_timezone_offset", $this->_session->getParameter("_default_TZ")); } // main_action_name $this->_session->setParameter('_main_action_name', $action_name); $this->_session->setParameter('_session_gc_maxlifetime', $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value']); // ---------------------------------------------- // ---metaタグ設定 --- // ---------------------------------------------- $sitename = $config->getConfigByConfname(_SYS_CONF_MODID, 'sitename'); $language = $this->_languagesView->getLanguages(array("lang_dirname" => $this->_session->getParameter('_lang'))); $meta = array('sitename' => $sitename['conf_value'], 'meta_language' => $language[0]['language'], 'meta_robots' => $config_obj[_META_CONF_CATID]['meta_robots']['conf_value'], 'meta_keywords' => $config_obj[_META_CONF_CATID]['meta_keywords']['conf_value'], 'meta_description' => $config_obj[_META_CONF_CATID]['meta_description']['conf_value'], 'meta_rating' => $config_obj[_META_CONF_CATID]['meta_rating']['conf_value'], 'meta_author' => $config_obj[_META_CONF_CATID]['meta_author']['conf_value'], 'meta_copyright' => $config_obj[_META_CONF_CATID]['meta_copyright']['conf_value'], 'meta_footer' => $config_obj[_META_CONF_CATID]['meta_footer']['conf_value']); // // footer初期化 // $footer_field = array('template_footer' => "", 'script_footer' => ""); // データセット $this->_session->setParameter("_meta", $meta); // プライベートスペースを公開するかどうか $this->_session->setParameter("_open_private_space", $config_obj[_GENERAL_CONF_CATID]['open_private_space']['conf_value']); // デフォルト参加ロール権限 $_default_entry_role_auth_public = $config_obj[_GENERAL_CONF_CATID]['default_entry_role_auth_public']['conf_value']; $_default_entry_role_auth_group = $config_obj[_GENERAL_CONF_CATID]['default_entry_role_auth_group']['conf_value']; //プライベートスペースを公開した場合、使用 if ($config_obj[_GENERAL_CONF_CATID]['open_private_space']['conf_value'] != _OFF) { $_default_entry_role_auth_private = $config_obj[_GENERAL_CONF_CATID]['default_entry_role_auth_private']['conf_value']; } else { $_default_entry_role_auth_private = _ROLE_AUTH_OTHER; } // // デフォルトで参加する場合のベース権限と権限の階層をセッションにセット // // システム管理のデフォルトで参加するルームでのロール権限の設定を一般、あるいはゲストのみとしてdefine値をセット // システム管理でモデレータのロール権限を設定させる場合、authoritiesテーブルからuser_authority_id,hierarchyを // 取得しなければならない(実行時間の節約のため行わない)。 // if ($_default_entry_role_auth_public == _ROLE_AUTH_GENERAL) { $this->_session->setParameter("_default_entry_auth_public", _AUTH_GENERAL); $this->_session->setParameter("_default_entry_hierarchy_public", _HIERARCHY_GENERAL); } else { $this->_session->setParameter("_default_entry_auth_public", _AUTH_GUEST); $this->_session->setParameter("_default_entry_hierarchy_public", _HIERARCHY_GUEST); } if ($_default_entry_role_auth_group == _ROLE_AUTH_GENERAL) { $this->_session->setParameter("_default_entry_auth_group", _AUTH_GENERAL); $this->_session->setParameter("_default_entry_hierarchy_group", _HIERARCHY_GENERAL); } else { $this->_session->setParameter("_default_entry_auth_group", _AUTH_GUEST); $this->_session->setParameter("_default_entry_hierarchy_group", _HIERARCHY_GUEST); } if ($_default_entry_role_auth_private == _ROLE_AUTH_GENERAL) { $this->_session->setParameter("_default_entry_auth_private", _AUTH_GENERAL); $this->_session->setParameter("_default_entry_hierarchy_private", _HIERARCHY_GENERAL); } else { if ($_default_entry_role_auth_private == _ROLE_AUTH_OTHER) { $this->_session->setParameter("_default_entry_auth_private", _AUTH_OTHER); $this->_session->setParameter("_default_entry_hierarchy_private", _HIERARCHY_OTHER); } else { $this->_session->setParameter("_default_entry_auth_private", _AUTH_GUEST); $this->_session->setParameter("_default_entry_hierarchy_private", _HIERARCHY_GUEST); } } /* $this->_session->setParameter("_default_entry_auth_public", $config_obj[_GENERAL_CONF_CATID]['default_entry_auth_public']['conf_value']); $this->_session->setParameter("_default_entry_auth_group", $config_obj[_GENERAL_CONF_CATID]['default_entry_auth_group']['conf_value']); //プライベートスペースを公開した場合、使用 if($config_obj[_GENERAL_CONF_CATID]['open_private_space']['conf_value'] != _OFF) { $this->_session->setParameter("_default_entry_auth_private", $config_obj[_GENERAL_CONF_CATID]['default_entry_auth_private']['conf_value']); } else { $this->_session->setParameter("_default_entry_auth_private", _ROLE_AUTH_OTHER); } */ // gzip_compression $this->_session->setParameter("_gzip_compression", $config_obj[_DEBUG_CONF_CATID]['gzip_compression']['conf_value']); // ---------------------------------------------- // ---Smarty関連設定 --- // ---------------------------------------------- $renderer =& SmartyTemplate::getInstance(); if (array_key_exists('smarty_caching', $config_obj[_GENERAL_CONF_CATID])) { if ($config_obj[_GENERAL_CONF_CATID]['smarty_caching']['conf_value'] == "true") { $smarty_caching = 2; } else { $smarty_caching = 0; } $renderer->setCaching($smarty_caching); } if (array_key_exists('smarty_force_compile', $config_obj[_GENERAL_CONF_CATID])) { if ($config_obj[_GENERAL_CONF_CATID]['smarty_force_compile']['conf_value'] == "true") { $smarty_force_compile = true; } else { $smarty_force_compile = false; } $renderer->setCompile($smarty_force_compile); } if (array_key_exists('smarty_lifetime', $config_obj[_GENERAL_CONF_CATID])) { $renderer->setCacheLifetime(intval($config_obj[_GENERAL_CONF_CATID]['smarty_lifetime']['conf_value'])); } // ---------------------------------------------- // ---メモリ最大サイズ設定 --- // ---------------------------------------------- ini_set('memory_limit', $config_obj[_SERVER_CONF_CATID]['memory_limit']['conf_value']); // ---------------------------------------------- // ---改行コードの判別有無の設定 --- // ---------------------------------------------- ini_set('auto_detect_line_endings', _ON); //UTF-8 // 直接指定:safariが文字化けするため $this->_response->setContentType("text/html; charset=utf-8"); // ---------------------------------------------- // ---サイトIDセット --- // ---------------------------------------------- $_site_id = $this->_session->getParameter("_site_id"); if (!isset($_site_id) || $_site_id == 0) { $sitesView =& $this->_container->getComponent("sitesView"); $site = $sitesView->getSelfSite(); if (isset($site['site_id'])) { $this->_session->setParameter("_site_id", $site['site_id']); } } // ---------------------------------------------- // ---サイトClose --- // ---------------------------------------------- $this->_session->setParameter("_closesite", _OFF); if ($config_obj[_GENERAL_CONF_CATID]['closesite']['conf_value'] == _ON) { $this->_session->setParameter("_closesite", _ON); $_lang = $this->_session->getParameter("_lang"); if ($user_id != "0" && $user_auth_id != _AUTH_ADMIN) { // 強制ログアウト $this->_session->close(); $user_id = "0"; } if ($user_id == "0") { $this->_session->setParameter("_lang", $_lang); $allow_action_name_arr = explode("|", _CLOSESITE_ALLOW_ACTION); if (!in_array($action_name, $allow_action_name_arr)) { // サイト閉鎖画面表示 $preexecute =& $this->_container->getComponent("preexecuteMain", array(), false, $this->_className); $preexecute->preExecute("pages_view_closesite"); exit; } } } }
/** * 会員情報を受注情報にコピーする. * * ユーザーがログインしていない場合は何もしない. * 会員情報を $dest の order_* へコピーする. * customer_id は強制的にコピーされる. * * @param array $dest コピー先の配列 * @param SC_Customer $objCustomer SC_Customer インスタンス * @param string $prefix コピー先の接頭辞. デフォルト order * @param array $keys コピー対象のキー * @return void */ function copyFromCustomer(&$dest, &$objCustomer, $prefix = 'order', $keys = array('name01', 'name02', 'kana01', 'kana02', 'sex', 'zip01', 'zip02', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'job', 'birth', 'email')) { if ($objCustomer->isLoginSuccess(true)) { foreach ($keys as $key) { if (in_array($key, $keys)) { $dest[$prefix . '_' . $key] = $objCustomer->getValue($key); } } if (Net_UserAgent_Mobile::isMobile() && in_array('email', $keys)) { $email_mobile = $objCustomer->getValue('email_mobile'); if (empty($email_mobile)) { $dest[$prefix . '_email'] = $objCustomer->getValue('email'); } else { $dest[$prefix . '_email'] = $email_mobile; } } $dest['customer_id'] = $objCustomer->getValue('customer_id'); $dest['update_date'] = 'CURRENT_TIMESTAMP'; } }