Пример #1
0
 /**
  * 画像を端末の解像度に合わせて変換する
  * output buffering 用コールバック関数
  *
  * @param string 入力
  * @return string 出力
  */
 function handler($buffer)
 {
     // 端末情報を取得する
     $carrier = SC_MobileUserAgent::getCarrier();
     $model = SC_MobileUserAgent::getModel();
     // 携帯電話の場合のみ処理を行う
     if ($carrier !== FALSE) {
         // HTML中のIMGタグを取得する
         $pattern = '/<img\\s+[^<>]*src=[\'"]?([^>"\'\\s]+)[\'"]?\\s*\\/?/i';
         $result = preg_match_all($pattern, $buffer, $images);
         // 端末の情報を取得する
         $fp = fopen(MOBILE_IMAGE_INC_PATH . "/mobile_image_map_{$carrier}.csv", "r");
         while (($data = fgetcsv($fp, 1000, ",")) !== FALSE) {
             if ($data[1] == $model || $data[1] == '*') {
                 $cacheSize = $data[2];
                 $imageFileSize = $data[7];
                 $imageType = $data[6];
                 $imageWidth = $data[5];
                 $imageHeight = $data[4];
                 break;
             }
         }
         fclose($fp);
         // docomoとsoftbankの場合は画像ファイル一つに利用可能なサイズの上限を計算する
         // auはHTMLのbyte数上限に画像ファイルサイズが含まれないのでimageFileSizeのまま。
         if ($carrier == "docomo" or $carrier == "softbank") {
             if ($result != false && $result > 0) {
                 // 計算式:(利用端末で表示可能なcacheサイズ - HTMLのバイト数 - 変換後の画像名のバイト数(目安値) ) / HTML中の画像数
                 $temp_imagefilesize = ($cacheSize - strlen($buffer) - 140 * $result) / $result;
             } else {
                 // 計算式:(利用端末で表示可能なcacheサイズ - HTMLのバイト数 )
                 $temp_imagefilesize = $cacheSize - strlen($buffer);
             }
             // 計算結果が端末の表示可能ファイルサイズ上限より小さい場合は計算結果の値を有効にする
             if ($temp_imagefilesize < $imageFileSize) {
                 $imageFileSize = $temp_imagefilesize;
             }
         }
         // 画像変換の情報をセットする
         $imageConverter = new ImageConverter();
         $imageConverter->setOutputDir(MOBILE_IMAGE_DIR);
         $imageConverter->setImageType($imageType);
         $imageConverter->setImageWidth($imageWidth);
         $imageConverter->setImageHeight($imageHeight);
         $imageConverter->setFileSize($imageFileSize);
         // HTML中のIMGタグを変換後のファイルパスに置換する
         foreach ($images[1] as $key => $value) {
             $converted = $imageConverter->execute(preg_replace('|^' . URL_DIR . '|', HTML_PATH, $value));
             if (isset($converted['outputImageName'])) {
                 $buffer = str_replace($value, MOBILE_IMAGE_URL . '/' . $converted['outputImageName'], $buffer);
             } else {
                 $buffer = str_replace($images[0][$key], '<!--No image-->', $buffer);
             }
         }
     }
     return $buffer;
 }
Пример #2
0
/**
 * 数値を数字絵文字に変換する。
 *
 * 入力が0〜9ではない場合、または、携帯端末からのアクセスではない場合は、
 * 入力を [ と ] で囲んだ文字列を返す。
 *
 * @param string $value 入力
 * @return string 出力
 */
function smarty_modifier_numeric_emoji($value)
{
    // 数字絵文字 (0〜9) の絵文字番号
    static $numeric_emoji_index = array('134', '125', '126', '127', '128', '129', '130', '131', '132', '133');
    if (SC_MobileUserAgent::isMobile() && isset($numeric_emoji_index[$value])) {
        return '[emoji:' . $numeric_emoji_index[$value] . ']';
    } else {
        return '[' . $value . ']';
    }
}
Пример #3
0
 /**
  * 絵文字番号を絵文字を表す Shift JIS の文字列に変換する。
  *
  * @param string $index 絵文字番号
  * @return string 絵文字を表す Shift JIS の文字列を返す。
  */
 function indexToCode($index)
 {
     $carrier = SC_MobileUserAgent::getCarrier();
     if ($carrier === false) {
         return MOBILE_EMOJI_SUBSTITUTE;
     }
     static $arrMap;
     if (!isset($arrMap)) {
         $arrMap = @(include_once dirname(__FILE__) . "/../include/mobile_emoji_map_{$carrier}.inc");
     }
     return isset($arrMap[$index]) ? $arrMap[$index] : MOBILE_EMOJI_SUBSTITUTE;
 }
/**
 * marqueeタグで囲む。
 *
 * DoCoMoの携帯端末の場合はmarqueeを使用しない。
 *
 * @param string $value 入力
 * @return string 出力
 */
function smarty_block_marquee($params, $content, &$smarty, &$repeat)
{
    // {/marquee}の場合のみ出力する。
    if ($repeat || !isset($content)) {
        return null;
    }
    // 末尾の改行などを取り除く。
    $content = rtrim($content);
    // marqueeタグを使用しない場合
    if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_MobileUserAgent::getCarrier() == 'docomo') {
        return "<div>\n{$content}\n</div>\n";
    }
    return "<marquee>\n{$content}\n</marquee>\n";
}
Пример #5
0
/**
 * marqueeタグで囲む。
 *
 * DoCoMoの携帯端末の場合はmarqueeを使用しない。
 *
 * @param string $value 入力
 * @return string 出力
 */
function smarty_block_marquee($params, $content, &$smarty, &$repeat)
{
    // {/marquee}の場合のみ出力する。
    if ($repeat || !isset($content)) {
        return null;
    }
    // 末尾の改行などを取り除く。
    $content = rtrim($content);
    // marqueeタグを使用しない場合
    if (defined('MOBILE_SITE') && SC_MobileUserAgent::getCarrier() == 'docomo') {
        return "<div>\n{$content}\n</div>\n";
    }
    return "<marquee>\n{$content}\n</marquee>\n";
}
 /**
  * Page のプロセス。
  *
  * @return void
  */
 function process()
 {
     require_once CLASS_PATH . 'SC_MobileUserAgent.php';
     $objView = null;
     if (SC_MobileUserAgent::isMobile() && $this->adminPage == false) {
         $objView = new SC_InstallView(MOBILE_TEMPLATE_DIR, MOBILE_COMPILE_DIR);
     } elseif ($this->adminPage) {
         $objView = new SC_InstallView(TEMPLATE_ADMIN_DIR, COMPILE_ADMIN_DIR);
     } else {
         $objView = new SC_InstallView(TEMPLATE_DIR, COMPILE_DIR);
     }
     $this->tpl_error = "システムエラーが発生しました。<br />大変お手数ですが、サイト管理者までご連絡ください。";
     $objView->assignobj($this);
     $objView->display($this->flame);
 }
 /**
  * Page のResponse.
  *
  * todo たいした処理でないのに異常に処理が重い
  * @return void
  */
 function sendResponse()
 {
     // TODO sendResponseをオーバーライドしている為、afterフックポイントが実行されない.直接実行する.(#1790)
     $objPlugin = SC_Helper_Plugin_Ex::getSingletonInstance($this->plugin_activate_flg);
     $objPlugin->doAction('LC_Page_Mypage_DownLoad_action_after', array($this));
     $this->objDisplay->noAction();
     // パラメーター取得
     $customer_id = $_SESSION['customer']['customer_id'];
     $order_id = $_GET['order_id'];
     $product_id = $_GET['product_id'];
     $product_class_id = $_GET['product_class_id'];
     //DBから商品情報の読込
     $arrForm = $this->lfGetRealFileName($customer_id, $order_id, $product_id, $product_class_id);
     //ファイル情報が無い場合はNG
     if ($arrForm['down_realfilename'] == '') {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
     }
     //ファイルそのものが無い場合もとりあえずNG
     $realpath = DOWN_SAVE_REALDIR . $arrForm['down_realfilename'];
     if (!file_exists($realpath)) {
         SC_Utils_Ex::sfDispSiteError(DOWNFILE_NOT_FOUND, '', true);
     }
     //ファイル名をエンコードする Safariの対策はUTF-8で様子を見る
     $encoding = 'Shift_JIS';
     if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')) {
         $encoding = 'UTF-8';
     }
     $sdown_filename = mb_convert_encoding($arrForm['down_filename'], $encoding, 'auto');
     // flushなどを利用しているので、現行のSC_Displayは利用できません。
     // SC_DisplayやSC_Responseに大容量ファイルレスポンスが実装されたら移行可能だと思います。
     // ダウンロード実行 モバイル端末はダウンロード方法が異なる
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) {
         // キャリアがAUのモバイル端末はさらにダウンロード方法が異なる
         if (SC_MobileUserAgent::getCarrier() == 'ezweb') {
             // AUモバイル
             $this->lfMobileAuDownload($realpath, $sdown_filename);
         } else {
             // AU以外のモバイル
             $this->lfMobileDownload($realpath, $sdown_filename);
         }
     } else {
         // PC、スマフォ
         $this->lfDownload($realpath, $sdown_filename);
     }
 }
Пример #8
0
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
$require_php_dir = realpath(dirname(__FILE__));
require_once $require_php_dir . "/define.php";
require_once $require_php_dir . 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;
}
Пример #9
0
 /**
  * 特定キャリア(AU)モバイルダウンロード処理
  * キャリアがAUのモバイル端末からダウンロードする場合は単純に
  * Aタグでダウンロードできないケースがある為、対応する。
  *
  * @param integer $order_id 注文番号
  * @param $arrOrderDetail 購入履歴の配列
  */
 function lfSetAU($arrOrderDetails)
 {
     $this->isAU = false;
     // モバイル端末かつ、キャリアがAUの場合に処理を行う
     if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_MobileUserAgent::getCarrier() == 'ezweb') {
         // MIMETYPE、ファイル名のセット
         $this->tpl_arrOrderDetail = $this->lfSetMimetype($arrOrderDetails);
         // @deprecated 2.12.0 PHP 定数 SID を使うこと
         $this->phpsessid = $_GET['PHPSESSID'];
         $this->isAU = true;
     }
 }
 /**
  * パラメーターから有効なセッションIDを取得する。
  *
  * @return string|false 取得した有効なセッションIDを返す。
  *                      取得できなかった場合は false を返す。
  */
 function getSessionId()
 {
     // パラメーターからセッションIDを取得する。
     $sessionId = @$_POST[session_name()];
     if (!isset($sessionId)) {
         $sessionId = @$_GET[session_name()];
         // AU動画音声ファイルダウンロード対策
         // キャリアがAUで、動画、音声ファイルをダウンロードする際に
         // SESSIONIDの後に余計なパラメータが付与され、セッションが無効になるケースがある
         if (SC_MobileUserAgent::getCarrier() == 'ezweb') {
             $idArray = split("\\?", $sessionId);
             $sessionId = $idArray[0];
         }
     }
     if (!isset($sessionId)) {
         $sessionId = $this->getExtSessionId();
     }
     if (!isset($sessionId)) {
         return false;
     }
     // セッションIDの存在をチェックする。
     $objSession = new SC_Helper_Session_Ex();
     if ($objSession->sfSessRead($sessionId) === null) {
         GC_Utils_Ex::gfPrintLog("Non-existent session id : sid={$sessionId}");
         return false;
     }
     return session_id($sessionId);
 }
 /**
  * 携帯のIDを登録する.
  *
  */
 function updatePhoneId()
 {
     $this->setValue('phone_id', SC_MobileUserAgent::getId());
 }
Пример #12
0
 /**
  * EC-CUBE がサポートする携帯キャリアかどうかを判別する。
  *
  * @return boolean 携帯端末ではない場合は true、それ以外の場合は false を返す。
  */
 function isNonMobile()
 {
     return !SC_MobileUserAgent::isMobile();
 }
Пример #13
0
 /**
  * 携帯端末IDを使用して会員を検索し、パスワードの照合を行う。
  * パスワードが合っている場合は顧客情報を取得する。
  *
  * @param string $pass パスワード
  * @return boolean 該当する会員が存在し、パスワードが合っている場合は true、
  *                 それ以外の場合は false を返す。
  */
 function getCustomerDataFromMobilePhoneIdPass($pass)
 {
     //docomo用にデータを取り出す。
     if (SC_MobileUserAgent::getCarrier() == 'docomo') {
         if ($_SESSION['mobile']['phone_id'] == "" && strlen($_SESSION['mobile']['phone_id']) == 0) {
             $_SESSION['mobile']['phone_id'] = SC_MobileUserAgent::getId();
         }
     }
     if (!isset($_SESSION['mobile']['phone_id']) || $_SESSION['mobile']['phone_id'] === false) {
         return false;
     }
     // 携帯端末IDが一致し、本登録された会員を検索する。
     $sql = 'SELECT * FROM dtb_customer WHERE mobile_phone_id = ? AND del_flg = 0 AND status = 2';
     @(list($data) = $this->conn->getAll($sql, array($_SESSION['mobile']['phone_id'])));
     // パスワードが合っている場合は、顧客情報をcustomer_dataに格納してtrueを返す。
     if (sha1($pass . ':' . AUTH_MAGIC) == @$data['password']) {
         $this->customer_data = $data;
         $this->startSession();
         return true;
     }
     return false;
 }
Пример #14
0
 function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn, $confirm_flg, $isMobile = false, $email_mobile = "")
 {
     $objConn = new SC_DbConn();
     // 登録データの生成
     foreach ($arrRegistColumn as $data) {
         if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) {
             $arrRegist[$data["column"]] = $array[$data["column"]];
         }
     }
     // 誕生日が入力されている場合
     if (strlen($array["year"]) > 0) {
         $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00";
     }
     // パスワードの暗号化
     $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC);
     // 仮会員登録の場合
     if ($confirm_flg == true) {
         // 重複しない会員登録キーを発行する。
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
         }
         switch ($array["mailmaga_flg"]) {
             case 1:
                 $arrRegist["mailmaga_flg"] = 4;
                 break;
             case 2:
                 $arrRegist["mailmaga_flg"] = 5;
                 break;
             default:
                 $arrRegist["mailmaga_flg"] = 6;
                 break;
         }
         $arrRegist["status"] = "1";
         // 仮会員
     } else {
         // 重複しない会員登録キーを発行する。
         $count = 1;
         while ($count != 0) {
             $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r");
             $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid));
         }
         $arrRegist["status"] = "2";
         // 本会員
     }
     /*
       secret_keyは、テーブルで重複許可されていない場合があるので、
       本会員登録では利用されないがセットしておく。
     */
     $arrRegist["secret_key"] = $uniqid;
     // 会員登録キー
     $arrRegist["create_date"] = "now()";
     // 作成日
     $arrRegist["update_date"] = "now()";
     // 更新日
     $arrRegist["first_buy_date"] = "";
     // 最初の購入日
     $arrRegist["point"] = $this->CONF["welcome_point"];
     // 入会時ポイント
     if ($isMobile) {
         // 携帯メールアドレス
         $arrRegist['email_mobile'] = $arrRegist['email'];
         //PHONE_IDを取り出す
         $phoneId = SC_MobileUserAgent::getId();
         $arrRegist['mobile_phone_id'] = $phoneId;
     }
     //-- 仮登録実行
     $objConn->query("BEGIN");
     $objQuery = new SC_Query();
     $objQuery->insert("dtb_customer", $arrRegist);
     /* メルマガ会員機能は現在停止中 2007/03/07
     
     
             //-- 非会員でメルマガ登録しているかの判定
             $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?";
             $mailResult = $objConn->getOne($sql, array($arrRegist["email"]));
     
             //-- メルマガ仮登録実行
             $arrRegistMail["email"] = $arrRegist["email"];
             if ($array["mailmaga_flg"] == 1) {
                 $arrRegistMail["mailmaga_flg"] = 4;
             } elseif ($array["mailmaga_flg"] == 2) {
                 $arrRegistMail["mailmaga_flg"] = 5;
             } else {
                 $arrRegistMail["mailmaga_flg"] = 6;
             }
             $arrRegistMail["update_date"] = "now()";
     
             // 非会員でメルマガ登録している場合
             if ($mailResult == 1) {
                 $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'");
             } else {				// 新規登録の場合
                 $arrRegistMail["create_date"] = "now()";
                 $objQuery->insert("dtb_customer_mail", $arrRegistMail);
             }
         */
     $objConn->query("COMMIT");
     return $uniqid;
 }
Пример #15
0
 /**
  * モバイルサイト用のセッション関連の初期処理を行う。
  *
  * @return void
  */
 function lfMobileInitSession()
 {
     // セッションIDの受け渡しにクッキーを使用しない。
     ini_set('session.use_cookies', '0');
     // パラメーターから有効なセッションIDを取得する。
     $sessionId = $this->lfMobileGetSessionId();
     session_start();
     // セッションIDまたはセッションデータが無効な場合は、セッションIDを再生成
     // し、セッションデータを初期化する。
     if ($sessionId === false || !$this->lfMobileValidateSession()) {
         session_regenerate_id();
         $_SESSION = array('mobile' => array('model' => SC_MobileUserAgent::getModel(), 'phone_id' => SC_MobileUserAgent::getId(), 'expires' => time() + MOBILE_SESSION_LIFETIME));
         // 新しいセッションIDを付加してリダイレクトする。
         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
             // GET の場合は同じページにリダイレクトする。
             header('Location: ' . $this->gfAddSessionId());
         } else {
             // GET 以外の場合はトップページへリダイレクトする。
             header('Location: ' . URL_SITE_TOP . '?' . SID);
         }
         exit;
     }
     // 携帯端末IDを取得できた場合はセッションデータに保存する。
     $phoneId = SC_MobileUserAgent::getId();
     if ($phoneId !== false) {
         $_SESSION['mobile']['phone_id'] = $phoneId;
     }
     // セッションの有効期限を更新する。
     $_SESSION['mobile']['expires'] = time() + MOBILE_SESSION_LIFETIME;
 }