Ejemplo n.º 1
0
	/**
	 * Browser detection
	 */
	private function _is_keitai()
	{
        $agent = Net_UserAgent_Mobile::singleton(); 
        switch( true )
        {
          case ($agent->isDoCoMo()):   // DoCoMoかどうか
            return true;
            if( $agent->isFOMA() )
              return true;
            break;
          case ($agent->isVodafone()): // softbankかどうか
            return true;
            if( $agent->isType3GC() )
              return true;
            break;
          case ($agent->isEZweb()):    // ezwebかどうか
            return true;
            if( $agent->isWIN() )
              return true;
            break;
          default:
            return false;
            break;
        }
	}
Ejemplo n.º 2
0
function from_tumblr()
{
    global $sessionkey;
    $db = get_db_connectiuon();
    list($sessionkey, $cookies, $u) = get_login_cookie($db);
    $page = getPage();
    $agent = Net_UserAgent_Mobile::singleton();
    // paging a page
    if ($agent->isDoCoMo()) {
        $page = ceil($page / 2);
    }
    //$postid = getPostId();
    $url = 'http://www.tumblr.com/dashboard/';
    if ($page > 1) {
        $url .= $page;
    }
    if ($postid > 1) {
        $url .= "/{$postid}";
    }
    #print "<!--$url-->";
    $retry = 2;
    while ($retry--) {
        $req =& new HTTP_Request($url);
        $req->setMethod(HTTP_REQUEST_METHOD_GET);
        foreach ($cookies as $v) {
            $req->addCookie($v['name'], $v['value']);
        }
        if (PEAR::isError($req->sendRequest())) {
            $err = 1;
        }
        $code = $req->getResponseCode();
        if ($code == 302) {
            $err = true;
            if ($u['email']) {
                list($err, $cookies) = update_cookie_info($u['email'], $u['password'], true, $u['hash']);
            }
            if ($err) {
                $retry = 0;
                break;
            }
        } else {
            if ($code == 200) {
                return $req->getResponseBody();
            } else {
                print '<html><body><pre>x_x';
                print " {$code} ";
                print '</body></html>';
                exit;
            }
        }
    }
    if ($retry == 0) {
        header('Location: /login');
    } else {
        print '<html><body><pre>x_x';
        print '</body></html>';
    }
    exit;
}
Ejemplo n.º 3
0
 function __construct($content)
 {
     $html = $this->wash($content);
     $dom = new DOMDocument();
     $dom->loadXML($html);
     $this->dom = $dom;
     $this->agent = Net_UserAgent_Mobile::singleton();
 }
Ejemplo n.º 4
0
/**
 * 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";
    }
}
 public function execute($filterChain)
 {
     $response = $this->getContext()->getResponse();
     if ($this->isFirstCall()) {
         $agent = Net_UserAgent_Mobile::singleton();
         $this->getContext()->getRequest()->setAttribute("userAgent", $agent);
         $this->getContext()->getResponse()->setSlot("carrier_css", $agent);
     }
     $filterChain->execute();
 }
Ejemplo n.º 6
0
 public function __construct()
 {
     $uri = Mage::app()->getRequest();
     if (preg_match("/extensions_(custom|local)/i", $uri->getRequestUri())) {
         $this->_isAdmin = true;
     }
     if (!$this->_isAdmin) {
         $error = error_reporting(E_ALL);
         $include_path = get_include_path();
         set_include_path($include_path . PS . BP . DS . 'lib/PEAR');
         require_once 'Net/UserAgent/Mobile.php';
         $this->_agent = Net_UserAgent_Mobile::singleton();
     }
 }
Ejemplo n.º 7
0
 /**
  * UAでセッションの妥当性をチェックする
  *
  * @return bool
  */
 private function _checkUA()
 {
     // {{{ docomoはUTN時にUA後部が変わるので機種名で検証する
     $mobile = Net_UserAgent_Mobile::singleton();
     if ($mobile->isDoCoMo()) {
         $mobile_b = Net_UserAgent_Mobile::factory($_SESSION[$this->sess_array]['ua']);
         if ($mobile_b->getModel() == $mobile->getModel()) {
             return true;
         }
     }
     // }}}
     // $offset = 12;
     if (empty($offset)) {
         $offset = strlen($_SERVER['HTTP_USER_AGENT']);
     }
     if (substr($_SERVER['HTTP_USER_AGENT'], 0, $offset) == substr($_SESSION[$this->sess_array]['ua'], 0, $offset)) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * EC-CUBE がサポートする携帯キャリアかどうかを判別する。 
  * 
  * ※一部モジュールで使用。ただし、本メソッドは将来的に削除しますので新規ご利用は控えてください。
  * 
  * @return boolean サポートしている場合は true、それ以外の場合は false を返す。 
  */
 function isMobile()
 {
     $objAgent =& Net_UserAgent_Mobile::singleton();
     if (Net_UserAgent_Mobile::isError($objAgent)) {
         return false;
     } else {
         return $objAgent->isDoCoMo() || $objAgent->isEZweb() || $objAgent->isVodafone();
     }
 }
Ejemplo n.º 9
0
/**
 * 端末に応じた絵文字を取得する
 *
 * @param Net_UserAgent_Mobile_Common $mobile
 * @return array
 */
function p2_get_emoji(Net_UserAgent_Mobile_Common $mobile = null)
{
    static $cache = null;
    if ($mobile === null && $cache !== null) {
        return $cache;
    }
    $emoji = array(0 => '0.', 1 => '1.', 2 => '2.', 3 => '3.', 4 => '4.', 5 => '5.', 6 => '6.', 7 => '7.', 8 => '8.', 9 => '9.', '*' => '*.', '#' => '#.', 'ut1' => '▲', 'ut2' => '△', 'dt1' => '▼', 'dt2' => '▽', 'lt1' => '&lt;', 'lt2' => '&laquo;', 'rt1' => '&gt;', 'rt2' => '&raquo;');
    if (!$mobile) {
        $mobile = Net_UserAgent_Mobile::singleton();
        $cache = true;
    }
    // @link http://www.nttdocomo.co.jp/service/imode/make/content/pictograph/
    if ($mobile->isDoCoMo()) {
        $emoji[0] = pack('C*', 0xf9, 0x90);
        $emoji[1] = pack('C*', 0xf9, 0x87);
        $emoji[2] = pack('C*', 0xf9, 0x88);
        $emoji[3] = pack('C*', 0xf9, 0x89);
        $emoji[4] = pack('C*', 0xf9, 0x8a);
        $emoji[5] = pack('C*', 0xf9, 0x8b);
        $emoji[6] = pack('C*', 0xf9, 0x8c);
        $emoji[7] = pack('C*', 0xf9, 0x8d);
        $emoji[8] = pack('C*', 0xf9, 0x8e);
        $emoji[9] = pack('C*', 0xf9, 0x8f);
        $emoji['lt2'] = '&lt;&lt;';
        $emoji['rt2'] = '&gt;&gt;';
        // @link http://www.au.kddi.com/ezfactory/tec/spec/3.html
    } elseif ($mobile->isEZweb()) {
        $emoji[0] = '<img localsrc="325">';
        $emoji[1] = '<img localsrc="180">';
        $emoji[2] = '<img localsrc="181">';
        $emoji[3] = '<img localsrc="182">';
        $emoji[4] = '<img localsrc="183">';
        $emoji[5] = '<img localsrc="184">';
        $emoji[6] = '<img localsrc="185">';
        $emoji[7] = '<img localsrc="186">';
        $emoji[8] = '<img localsrc="187">';
        $emoji[9] = '<img localsrc="188">';
        //$emoji['#'] = '<img localsrc="818">';
        $emoji[9] = '<img localsrc="188">';
        $emoji['ut1'] = '<img localsrc="33">';
        $emoji['ut2'] = '<img localsrc="35">';
        $emoji['dt1'] = '<img localsrc="32">';
        $emoji['dt2'] = '<img localsrc="34">';
        $emoji['lt1'] = '<img localsrc="5">';
        $emoji['lt2'] = '<img localsrc="7">';
        $emoji['rt1'] = '<img localsrc="6">';
        $emoji['rt2'] = '<img localsrc="8">';
        // @link http://creation.mb.softbank.jp/web/web_pic_about.html
    } elseif ($mobile->isSoftBank()) {
        $_esc = chr(0x1b) . '$';
        $_si = chr(0xf);
        $emoji[0] = $_esc . 'FE' . $_si;
        $emoji[1] = $_esc . 'F<' . $_si;
        $emoji[2] = $_esc . 'F=' . $_si;
        $emoji[3] = $_esc . 'F>' . $_si;
        $emoji[4] = $_esc . 'F?' . $_si;
        $emoji[5] = $_esc . 'F@' . $_si;
        $emoji[6] = $_esc . 'FA' . $_si;
        $emoji[7] = $_esc . 'FB' . $_si;
        $emoji[8] = $_esc . 'FC' . $_si;
        $emoji[9] = $_esc . 'FD' . $_si;
        $emoji['lt1'] = $_esc . 'F[' . $_si;
        $emoji['lt2'] = $_esc . 'F]' . $_si;
        $emoji['rt1'] = $_esc . 'FZ' . $_si;
        $emoji['rt2'] = $_esc . 'F\\' . $_si;
    }
    if ($cache) {
        $cache = $emoji;
    }
    return $emoji;
}
Ejemplo n.º 10
0
/**
 *  最初のログイン画面を表示する
 */
function printLoginFirst(Login $_login)
{
    global $STYLE, $_conf;
    global $_login_failed_flag, $_p2session;
    global $skin_en;
    // {{{ データ保存ディレクトリのパーミッションの注意を喚起する
    P2Util::checkDirWritable($_conf['dat_dir']);
    $checked_dirs[] = $_conf['dat_dir'];
    // チェック済みのディレクトリを格納する配列に
    if (!in_array($_conf['idx_dir'], $checked_dirs)) {
        P2Util::checkDirWritable($_conf['idx_dir']);
        $checked_dirs[] = $_conf['idx_dir'];
    }
    if (!in_array($_conf['pref_dir'], $checked_dirs)) {
        P2Util::checkDirWritable($_conf['pref_dir']);
        $checked_dirs[] = $_conf['pref_dir'];
    }
    // }}}
    // 前処理
    $_login->checkAuthUserFile();
    clearstatcache();
    //=========================================================
    // 書き出し用変数
    //=========================================================
    $ptitle = 'rep2';
    $myname = basename($_SERVER['SCRIPT_NAME']);
    $auth_sub_input_ht = "";
    $body_ht = "";
    $p_str = array('user' => 'ユーザ', 'password' => 'パスワード');
    // 携帯用表示文字列全角→半角変換
    if ($_conf['ktai'] && function_exists('mb_convert_kana')) {
        foreach ($p_str as $k => $v) {
            $p_str[$k] = mb_convert_kana($v, 'rnsk');
        }
    }
    //==============================================
    // 補助認証
    //==============================================
    $mobile = Net_UserAgent_Mobile::singleton();
    $keep_login_checked = ' checked';
    if (isset($_POST['submit_new']) || isset($_POST['submit_member'])) {
        if (!isset($_POST['keep_login']) || $_POST['keep_login'] !== '1') {
            $keep_login_checked = '';
        }
    }
    $auth_sub_input_ht = <<<EOP
<input type="hidden" name="device_pixel_ratio" id="device_pixel_ratio" value="1">
<input type="hidden" name="ctl_keep_login" value="1">
<input type="checkbox" id="keep_login" name="keep_login" value="1"{$keep_login_checked}><label for="keep_login">Cookieにログイン状態を保持</label><br>
EOP;
    // }}}
    // ログインフォームからの指定
    if (!empty($GLOBALS['brazil'])) {
        $add_mail = '.,@-';
    } else {
        $add_mail = '';
    }
    if (preg_match("/^[0-9A-Za-z_{$add_mail}]+\$/", $_login->user_u)) {
        $hd['form_login_id'] = p2h($_login->user_u);
    } elseif (!empty($_POST['form_login_id']) && preg_match("/^[0-9A-Za-z_{$add_mail}]+\$/", $_POST['form_login_id'])) {
        $hd['form_login_id'] = p2h($_POST['form_login_id']);
    } else {
        $hd['form_login_id'] = '';
    }
    if (!empty($_POST['form_login_pass']) && preg_match('/^[\\x21-\\x7E]+$/', $_POST['form_login_pass'])) {
        $hd['form_login_pass'] = p2h($_POST['form_login_pass']);
    } else {
        $hd['form_login_pass'] = '';
    }
    // docomoならpasswordにしない
    if ($mobile->isDoCoMo()) {
        $type = 'text';
    } else {
        $type = 'password';
    }
    // {{{ ログイン用フォームを生成
    $hd['REQUEST_URI'] = p2h($_SERVER['REQUEST_URI']);
    if ($mobile->isDoCoMo()) {
        if (strpos($hd['REQUEST_URI'], '?') === false) {
            $hd['REQUEST_URI'] .= '?guid=ON';
        } else {
            $hd['REQUEST_URI'] .= '&amp;guid=ON';
        }
    }
    if (file_exists($_conf['auth_user_file'])) {
        $submit_ht = '<input type="submit" name="submit_member" value="ユーザログイン">';
    } else {
        $submit_ht = '<input type="submit" name="submit_new" value="新規登録">';
    }
    if ($_conf['ktai']) {
        //$k_roman_input_at = ' istyle="3" format="*m" mode="alphabet"';
        $k_roman_input_at = ' istyle="3" format="*x" mode="alphabet"';
        $k_input_size_at = '';
    } else {
        $k_roman_input_at = '';
        $k_input_size_at = ' size="32"';
    }
    $login_form_ht = <<<EOP
<form id="login" method="post" action="{$hd['REQUEST_URI']}" target="_self">
    {$_conf['k_input_ht']}
    {$p_str['user']}: <input type="text" name="form_login_id" value="{$hd['form_login_id']}"{$k_roman_input_at}{$k_input_size_at}><br>
    {$p_str['password']}: <input type="{$type}" name="form_login_pass" value="{$hd['form_login_pass']}"{$k_roman_input_at}><br>
    {$auth_sub_input_ht}
    <br>
    {$submit_ht}
</form>

EOP;
    // }}}
    //=================================================================
    // 新規ユーザ登録処理
    //=================================================================
    if (!file_exists($_conf['auth_user_file']) && !$_login_failed_flag and !empty($_POST['submit_new']) && !empty($_POST['form_login_id']) && !empty($_POST['form_login_pass'])) {
        // {{{ 入力エラーをチェック、判定
        if (!preg_match('/^[0-9A-Za-z_]+$/', $_POST['form_login_id']) || !preg_match('/^[\\x21-\\x7E]+$/', $_POST['form_login_pass'])) {
            P2Util::pushInfoHtml("<p class=\"info-msg\">rep2 error: 「{$p_str['user']}」名と「{$p_str['password']}」は半角英数字で入力して下さい。</p>");
            $show_login_form_flag = true;
            // }}}
            // {{{ 登録処理
        } else {
            $_login->makeUser($_POST['form_login_id'], $_POST['form_login_pass']);
            // 新規登録成功
            $hd['form_login_id'] = p2h($_POST['form_login_id']);
            $body_ht .= "<p class=\"info-msg\">○ 認証{$p_str['user']}「{$hd['form_login_id']}」を登録しました</p>";
            $body_ht .= "<p><a href=\"{$myname}?form_login_id={$hd['form_login_id']}{$_conf['k_at_a']}\">rep2 start</a></p>";
            $_login->setUser($_POST['form_login_id']);
            $_login->pass_x = sha1($_POST['form_login_pass']);
            // セッションが利用されているなら、セッションを更新
            if (isset($_p2session)) {
                // ユーザ名とパスXを更新
                $_SESSION['login_user'] = $_login->user_u;
                $_SESSION['login_pass_x'] = $_login->pass_x;
            }
            // 要求があれば、補助認証を登録
            $_login->registerCookie();
        }
        // }}}
        // {{{ ログインエラーがある
    } else {
        if (isset($_POST['form_login_id']) || isset($_POST['form_login_pass'])) {
            $info_msg_ht = '<p class="info-msg">';
            if (!$_POST['form_login_id']) {
                $info_msg_ht .= "rep2 error: 「{$p_str['user']}」が入力されていません。<br>";
            }
            if (!$_POST['form_login_pass']) {
                $info_msg_ht .= "rep2 error: 「{$p_str['password']}」が入力されていません。";
            }
            $info_msg_ht .= '</p>';
            P2Util::pushInfoHtml($info_msg_ht);
        }
        $show_login_form_flag = true;
    }
    // }}}
    //=========================================================
    // HTMLプリント
    //=========================================================
    P2Util::header_nocache();
    echo $_conf['doctype'];
    echo <<<EOP
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

EOP;
    if (!$_conf['ktai']) {
        echo <<<EOP
<style type="text/css">
/* <![CDATA[ */

EOP;
        include P2_STYLE_DIR . '/style_css.inc';
        include P2_STYLE_DIR . '/login_first_css.inc';
        echo <<<EOP

/* ]]> */
</style>

EOP;
    }
    if ($_conf['iphone']) {
        echo <<<EOP
<script type="text/javascript">
// <![CDATA[
function setDevicePixelRatio()
{
    if (typeof window.devicePixelRatio === 'number') {
        var dpr = document.getElementById('device_pixel_ratio');
        if (dpr) {
            dpr.value = window.devicePixelRatio;
        }
    }
}
// ]]>
</script>
</head>
<body onload="setDevicePixelRatio()">
EOP;
    } else {
        echo "</head><body>\n";
    }
    echo "<h3>{$ptitle}</h3>\n";
    // 情報表示
    P2Util::printInfoHtml();
    echo $body_ht;
    if (!empty($show_login_form_flag)) {
        echo $login_form_ht;
    }
    echo '</body></html>';
    return true;
}
Ejemplo n.º 11
0
 /**
  * 認証のチェックを行う
  *
  * @return bool
  */
 private function _authCheck()
 {
     global $_conf;
     global $_login_failed_flag;
     global $_p2session;
     $this->checkAuthUserFile();
     // 認証ユーザ設定(ファイル)を読み込みできたら
     if (file_exists($_conf['auth_user_file'])) {
         include $_conf['auth_user_file'];
         // ユーザ名が違ったら、認証失敗で抜ける
         if ($this->user_u != $rec_login_user_u) {
             P2Util::pushInfoHtml('<p>p2 error: ログインエラー</p>');
             // ログイン失敗ログを記録する
             if (!empty($_conf['login_log_rec'])) {
                 $recnum = isset($_conf['login_log_rec_num']) ? intval($_conf['login_log_rec_num']) : 100;
                 P2Util::recAccessLog($_conf['login_failed_log_file'], $recnum);
             }
             return false;
         }
         // パスワード設定があれば、セットする
         if (isset($rec_login_pass_x) && strlen($rec_login_pass_x) > 0) {
             $this->pass_x = $rec_login_pass_x;
         }
     }
     // 認証設定 or パスワード記録がなかった場合はここまで
     if (!$this->pass_x) {
         // 新規登録でなければエラー表示
         if (empty($_POST['submit_new'])) {
             P2Util::pushInfoHtml('<p>p2 error: ログインエラー</p>');
         }
         return false;
     }
     // {{{ クッキー認証パススルー
     if (isset($_COOKIE['cid'])) {
         if ($this->checkUserPwWithCid($_COOKIE['cid'])) {
             return true;
             // Cookie認証が通らなければ
         } else {
             // 古いクッキーをクリアしておく
             $this->clearCookieAuth();
         }
     }
     // }}}
     // {{{ すでにセッションが登録されていたら、セッションで認証
     if (isset($_SESSION['login_user']) && isset($_SESSION['login_pass_x'])) {
         // セッションが利用されているなら、セッションの妥当性チェック
         if (isset($_p2session)) {
             if ($msg = $_p2session->checkSessionError()) {
                 P2Util::pushInfoHtml('<p>p2 error: ' . htmlspecialchars($msg) . '</p>');
                 //Session::unSession();
                 // ログイン失敗
                 return false;
             }
         }
         if ($this->user_u == $_SESSION['login_user']) {
             if ($_SESSION['login_pass_x'] != $this->pass_x) {
                 Session::unSession();
                 return false;
             } else {
                 return true;
             }
         }
     }
     // }}}
     $mobile = Net_UserAgent_Mobile::singleton();
     // {{{ フォームからログインした時
     if (!empty($_POST['submit_member'])) {
         // フォームログイン成功なら
         if ($_POST['form_login_id'] == $this->user_u and sha1($_POST['form_login_pass']) == $this->pass_x) {
             // 古いクッキーをクリアしておく
             $this->clearCookieAuth();
             // ログインログを記録する
             $this->logLoginSuccess();
             // リダイレクト
             return $_SERVER['REQUEST_URI'];
             //return true;
             // フォームログイン失敗なら
         } else {
             P2Util::pushInfoHtml('<p>p2 info: ログインできませんでした。<br>ユーザ名かパスワードが違います。</p>');
             $_login_failed_flag = true;
             // ログイン失敗ログを記録する
             $this->logLoginFailed();
             return false;
         }
     }
     // }}}
     return false;
 }
Ejemplo n.º 12
0
 /**
  * UAでセッションの妥当性をチェックする
  *
  * @access  private
  * @return  boolean
  */
 function checkUA()
 {
     // ibisBrowser 219.117.203.9
     // Mozilla/4.0 (compatible; ibisBrowser; ip210.153.84.0; ser0123456789ABCDE)
     // http://qb5.2ch.net/test/read.cgi/operate/1141521195/748
     if ($_SERVER['REMOTE_ADDR'] == '219.117.203.9') {
         return true;
     }
     // {{{ docomoはUTN時にUA後部が変わるので機種名で検証する
     $mobile =& Net_UserAgent_Mobile::singleton();
     if ($mobile->isDoCoMo()) {
         $mobile_b =& Net_UserAgent_Mobile::factory($_SESSION[$this->sess_array]['ua']);
         if ($mobile_b->getModel() == $mobile->getModel()) {
             return true;
         }
     }
     // }}}
     $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
     // $offset = 12;
     if (empty($offset)) {
         $offset = strlen($ua);
     }
     if (substr($ua, 0, $offset) == substr($_SESSION[$this->sess_array]['ua'], 0, $offset)) {
         return true;
     }
     return false;
 }
Ejemplo n.º 13
0
 /**
  * Registers services on the given app.
  *
  * This method should only be used to configure services and parameters.
  * It should not get services.
  *
  * @param BaseApplication $app An Application instance
  */
 public function register(BaseApplication $app)
 {
     // PEAR
     $app['smarty'] = function () {
         return new \Smarty();
     };
     $app['mobile.detect'] = function () {
         return new \Mobile_Detect();
     };
     $app['pear.archive.tar'] = $app->protect(function ($p_tarname, $p_compress = null) {
         return new \Archive_Tar($p_tarname, $p_compress);
     });
     $app['pear.cache.lite'] = $app->protect(function ($options = array()) {
         return new \Cache_Lite($options);
     });
     $app['pear.calendar.month.weekdays'] = $app->protect(function ($y, $m, $firstDay = null) {
         return new \Calendar_Month_Weekdays($y, $m, $firstDay);
     });
     $app['pear.http.request'] = $app->protect(function ($url = '', $params = array()) {
         return new \HTTP_Request($url, $params);
     });
     $app['pear.mail'] = $app->protect(function ($driver, $params = array()) {
         return \Mail::factory($driver, $params);
     });
     $app['pear.net.user_agent.mobile'] = $app->protect(function ($userAgent = null) {
         return \Net_UserAgent_Mobile::singleton($userAgent);
     });
     $app['pear.net.url'] = $app->protect(function ($url = null, $useBrackets = true) {
         return new \Net_URL($url, $useBrackets);
     });
     $app['pear.services.json'] = $app->protect(function ($use = 0) {
         return new \Services_JSON($use);
     });
     $app['pear.text.password'] = $app->protect(function ($length = 10, $type = 'pronounceable', $chars = '') {
         return \Text_Password::create($length, $type, $chars);
     });
     $app['pear.xml.serializer'] = $app->protect(function ($options = null) {
         return new \XML_Serializer($options);
     });
     // framework
     $app['eccube.cart_session'] = $app->protect(function ($cartKey = 'cart') {
         return new \Eccube\Framework\CartSession($cartKey);
     });
     $app['eccube.customer'] = function () {
         return new \Eccube\Framework\Customer();
     };
     $app['eccube.customer_list'] = $app->protect(function ($array, $mode = '') {
         return new \Eccube\Framework\CustomerList($array, $mode);
     });
     $app['eccube.cookie'] = $app->protect(function ($day = COOKIE_EXPIRE) {
         return new \Eccube\Framework\Cookie($day);
     });
     $app['eccube.check_error'] = $app->protect(function ($array = '') {
         return new \Eccube\Framework\CheckError($array);
     });
     $app['eccube.date'] = $app->protect(function ($start_year = '', $end_year = '') {
         return new \Eccube\Framework\Date($start_year, $end_year);
     });
     $app['eccube.display'] = $app->protect(function ($hasPrevURL = true) {
         return new \Eccube\Framework\Display($hasPrevURL);
     });
     $app['eccube.form_param'] = function () {
         return new \Eccube\Framework\FormParam();
     };
     $app['eccube.page_navi'] = $app->protect(function ($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX, $urlParam = '', $display_number = true) {
         return new \Eccube\Framework\PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max, $urlParam, $display_number);
     });
     $app['eccube.product'] = $app->protect(function () {
         return new \Eccube\Framework\Product();
     });
     $app['eccube.response'] = $app->protect(function () {
         return new \Eccube\Framework\Response();
     });
     $app['eccube.query'] = $app->protect(function ($dsn = '', $force_run = false, $new = false) {
         return \Eccube\Framework\Query::getSingletonInstance($dsn, $force_run, $new);
     });
     $app['eccube.site_session'] = $app->share(function () {
         return new \Eccube\Framework\SiteSession();
     });
     $app['eccube.sendmail'] = $app->protect(function () {
         return new \Eccube\Framework\Sendmail();
     });
     // db
     $app['eccube.db.factory'] = $app->protect(function ($db_type = DB_TYPE) {
         return \Eccube\Framework\DB\DBFactory::getInstance($db_type);
     });
     $app['eccube.db.master_data'] = $app->share(function () {
         return new \Eccube\Framework\DB\MasterData();
     });
     // graph
     $app['eccube.graph.bar'] = $app->protect(function ($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
         return new \Eccube\Framework\Graph\BarGraph($bgw, $bgh, $left, $top, $area_width, $area_height);
     });
     $app['eccube.graph.line'] = $app->protect(function ($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) {
         return new \Eccube\Framework\Graph\LineGraph($bgw, $bgh, $left, $top, $area_width, $area_height);
     });
     $app['eccube.graph.pie'] = $app->protect(function ($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT, $top = PIE_TOP) {
         return new \Eccube\Framework\Graph\PieGraph($bgw, $bgh, $left, $top);
     });
     // helper
     $app['eccube.helper.address'] = $app->share(function () {
         return new \Eccube\Framework\Helper\AddressHelper();
     });
     $app['eccube.helper.best_products'] = $app->share(function () {
         return new \Eccube\Framework\Helper\BestProductsHelper();
     });
     $app['eccube.helper.bloc'] = $app->protect(function ($devide_type_id = DEVICE_TYPE_PC) {
         return new \Eccube\Framework\Helper\BlocHelper($devide_type_id);
     });
     $app['eccube.helper.category'] = $app->protect(function ($count_check = false) {
         return new \Eccube\Framework\Helper\CategoryHelper($count_check);
     });
     $app['eccube.helper.csv'] = function () {
         return new \Eccube\Framework\Helper\CsvHelper();
     };
     $app['eccube.helper.customer'] = $app->share(function () {
         return new \Eccube\Framework\Helper\CustomerHelper();
     });
     $app['eccube.helper.db'] = $app->share(function () {
         return new \Eccube\Framework\Helper\DbHelper();
     });
     $app['eccube.helper.delivery'] = $app->share(function () {
         return new \Eccube\Framework\Helper\DeliveryHelper();
     });
     $app['eccube.helper.file_manager'] = $app->share(function () {
         return new \Eccube\Framework\Helper\FileManagerHelper();
     });
     $app['eccube.helper.fpdi'] = $app->protect(function ($orientation = 'P', $unit = 'mm', $size = 'A4') {
         return new \Eccube\Framework\Helper\FpdiHelper($orientation, $unit, $size);
     });
     $app['eccube.helper.holiday'] = $app->share(function () {
         return new \Eccube\Framework\Helper\HolidayHelper();
     });
     $app['eccube.helper.kiyaku'] = $app->share(function () {
         return new \Eccube\Framework\Helper\KiyakuHelper();
     });
     $app['eccube.helper.mail'] = $app->share(function () {
         return new \Eccube\Framework\Helper\MailHelper();
     });
     $app['eccube.helper.mailtemplate'] = $app->share(function () {
         return new \Eccube\Framework\Helper\MailtemplateHelper();
     });
     $app['eccube.helper.maker'] = $app->share(function () {
         return new \Eccube\Framework\Helper\MakerHelper();
     });
     $app['eccube.helper.mobile'] = $app->share(function () {
         return new \Eccube\Framework\Helper\MobileHelper();
     });
     $app['eccube.helper.news'] = $app->share(function () {
         return new \Eccube\Framework\Helper\NewsHelper();
     });
     $app['eccube.helper.page_layout'] = $app->share(function () {
         return new \Eccube\Framework\Helper\PageLayoutHelper();
     });
     $app['eccube.helper.payment'] = $app->share(function () {
         return new \Eccube\Framework\Helper\PaymentHelper();
     });
     $app['eccube.helper.plugin'] = function () {
         $plugin_activate_flg = PLUGIN_ACTIVATE_FLAG;
         return \Eccube\Framework\Helper\PluginHelper::getSingletonInstance($plugin_activate_flg);
     };
     $app['eccube.helper.purchase'] = $app->share(function () {
         return new \Eccube\Framework\Helper\PurchaseHelper();
     });
     $app['eccube.helper.session'] = $app->share(function () {
         return new \Eccube\Framework\Helper\SessionHelper();
     });
     $app['eccube.helper.tax_rule'] = $app->share(function () {
         return new \Eccube\Framework\Helper\TaxRuleHelper();
     });
     $app['eccube.helper.transform'] = $app->protect(function ($source) {
         return new \Eccube\Framework\Helper\TransformHelper($source);
     });
     // util
     $app['eccube.util.utils'] = $app->share(function () {
         return new \Eccube\Framework\Util\Utils();
     });
     $app['eccube.util.gc_utils'] = $app->share(function () {
         return new \Eccube\Framework\Util\GcUtils();
     });
     // smarty
     $app['smarty'] = $app->extend('smarty', function ($smarty) {
         /* @var $DbHelper \Eccube\Framework\Helper\DbHelper */
         $DbHelper = Application::alias('eccube.helper.db');
         /* @var $Utils \Eccube\Framework\Util\Utils */
         $Utils = Application::alias('eccube.util.utils');
         /* @var $GcUtils \Eccube\Framework\Util\GcUtils */
         $GcUtils = Application::alias('eccube.util.gc_utils');
         $smarty->left_delimiter = '<!--{';
         $smarty->right_delimiter = '}-->';
         $smarty->plugins_dir = array(realpath(__DIR__ . '/../../smarty_extends'), realpath(__DIR__ . '/../../../vendor/smarty/smarty/libs/plugins'));
         $smarty->register_modifier('sfDispDBDate', array($Utils, 'sfDispDBDate'));
         $smarty->register_modifier('sfGetErrorColor', array($Utils, 'sfGetErrorColor'));
         $smarty->register_modifier('sfTrim', array($Utils, 'sfTrim'));
         $smarty->register_modifier('sfCalcIncTax', array($DbHelper, 'calcIncTax'));
         $smarty->register_modifier('sfPrePoint', array($Utils, 'sfPrePoint'));
         $smarty->register_modifier('sfGetChecked', array($Utils, 'sfGetChecked'));
         $smarty->register_modifier('sfTrimURL', array($Utils, 'sfTrimURL'));
         $smarty->register_modifier('sfMultiply', array($Utils, 'sfMultiply'));
         $smarty->register_modifier('sfRmDupSlash', array($Utils, 'sfRmDupSlash'));
         $smarty->register_modifier('sfCutString', array($Utils, 'sfCutString'));
         $smarty->register_modifier('sfMbConvertEncoding', array($Utils, 'sfMbConvertEncoding'));
         $smarty->register_modifier('sfGetEnabled', array($Utils, 'sfGetEnabled'));
         $smarty->register_modifier('sfNoImageMainList', array($Utils, 'sfNoImageMainList'));
         // XXX register_function で登録すると if で使用できないのではないか?
         $smarty->register_function('sfIsHTTPS', array($Utils, 'sfIsHTTPS'));
         $smarty->register_function('sfSetErrorStyle', array($Utils, 'sfSetErrorStyle'));
         $smarty->register_function('printXMLDeclaration', array($GcUtils, 'printXMLDeclaration'));
         $smarty->default_modifiers = array('script_escape');
         $smarty->force_compile = SMARTY_FORCE_COMPILE_MODE === true;
         return $smarty;
     });
 }
Ejemplo n.º 14
0
 /**
  * スレッド表示オブジェクトにAASで使う変数をアサインする
  */
 public static function initAAS($aShowThread)
 {
     global $_conf;
     if ($_conf['iphone']) {
         $aShowThread->aas_rotate = '&#x21BB;';
     } elseif ($_conf['ktai']) {
         $mobile = Net_UserAgent_Mobile::singleton();
         /**
          * @link http://www.nttdocomo.co.jp/service/imode/make/content/pictograph/
          * @link http://www.au.kddi.com/ezfactory/tec/spec/3.html
          * @link http://mb.softbank.jp/mb/service/3G/mail/pictogram/
          */
         if ($mobile->isDoCoMo()) {
             $aShowThread->aas_rotate = '&#xF9DA;';
             // リサイクル, 拡42
         } elseif ($mobile->isEZweb()) {
             $aShowThread->aas_rotate = '&#xF47D;';
             // 循環矢印, 807
         } elseif ($mobile->isSoftBank()) {
             $aShowThread->aas_rotate = "\$Pc";
             // 渦巻, 414
         }
     } else {
         //
     }
 }
Ejemplo n.º 15
0
 /**
  * 初期設定系
  */
 private function init_APP()
 {
     //
     // スマートフォンの確認
     //
     // android
     if ($this->mobilemyclass->is_android()) {
         $this->is_android = TRUE;
     } else {
         if ($this->mobilemyclass->is_iphone()) {
             $this->is_iphone = TRUE;
         } else {
             if ($this->mobilemyclass->is_ipad()) {
                 $this->is_ipad = TRUE;
             }
         }
     }
     // スマートフォン
     if ($this->mobilemyclass->is_smartphone()) {
         $this->is_smartphone = TRUE;
         $this->is_pc = FALSE;
         $this->view_pc = FALSE;
         if ($this->use_smartphone_view) {
             // クッキーを有効にしてビューの種類を取得
             $this->load->helper('cookie');
             $view_tmp = get_cookie('sf_view', TRUE);
             if ($view_tmp == 'pc') {
                 $this->view_smartphone = "";
                 $this->view_pc = TRUE;
                 //$this->use_smartphone_view = FALSE;
             } else {
                 $this->view_smartphone = TRUE;
             }
         }
     }
     if (!$this->config->config['base_url']) {
         $this->config->config['base_url'] = $this->config->base_url();
     }
     if ($this->mobilemyclass->is_mobile()) {
         $this->is_mobile = TRUE;
         $this->is_pc = FALSE;
         $this->view_pc = FALSE;
         # NET_USERAGENT_MOBIEL読み込み
         //$this->pearloader->load('Net/UserAgent/Mobile');
         require_once 'Net/UserAgent/Mobile.php';
         $this->agent =& Net_UserAgent_Mobile::singleton();
     }
     if ($this->is_force_ssl == "OFF" and $_SERVER['SERVER_PORT'] != 80) {
         $this->load->helper('force_ssl');
         force_no_ssl();
     }
     //
     // SSL通信の処理(SSLの場合は強制的にすべてをSSLにする)
     //
     if (isset($_SERVER['HTTPS'])) {
         $this->load->helper('force_ssl');
         force_ssl();
     }
     # テスト環境かどうか
     if ($this->is_test) {
         $this->chk_test();
     }
     if (!$this->mobilemyclass->is_mobile() and !$this->mobilemyclass->is_smartphone()) {
         $this->is_pc = TRUE;
     }
     //PCでSESSIDがGETについている場合、カットする
     if (isset($_GET['sessid'])) {
         unset($_GET['sessid']);
     }
     if ($_GET) {
         $this->get_param = http_build_query($_GET);
     }
     if ($this->mobilemyclass->is_mobile()) {
         // モバイルの場合の処理
         // PCサイト専用の場合はエラーを返す
         if ($this->only_pc) {
             $this->load->library('emoji');
             $this->message("PC専用ページです");
             exit;
         } elseif ($this->only_smartphone) {
             $this->load->library('emoji');
             $this->message("スマートフォン専用ページです");
             exit;
         }
     } elseif ($this->mobilemyclass->is_smartphone()) {
         //モバイルサイト専用の場合はエラーを返す
         if ($this->only_mobile) {
             $this->message("モバイル専用ページです");
             exit;
         }
         //PCサイト専用の場合はエラーを返す
         if ($this->only_pc) {
             #print "PC Only Page";
             $this->load->library('emoji');
             $this->message("PC専用ページです");
             exit;
         }
     } else {
         $this->is_pc = TRUE;
         //モバイルサイト専用の場合はエラーを返す
         if ($this->only_mobile) {
             $this->message("モバイル専用ページです");
             exit;
         } elseif ($this->only_smartphone) {
             #print "PC Only Page";
             $this->load->library('emoji');
             $this->message("スマートフォン専用ページです");
             exit;
         }
         //PCでSESSIDがGETについている場合、カットする
         if (isset($_GET['sessid'])) {
             unset($_GET['sessid']);
         }
     }
     //認証を行うか
     if ($this->is_auth) {
         $this->initialize_auth();
         $this->chk_auth();
     }
     $this->_url = current_url();
     # post getの処理
     if ($this->is_mobile) {
         //$_GET  = $this->_convert_encoding($_GET);
         //$_POST = $this->_convert_encoding($_POST);
     }
     # 計測値を表示するかどうか
     if ($this->is_bench) {
         $this->output->enable_profiler(TRUE);
     }
     # とりあえずセット
     $this->load->vars(array('css' => "", 'js' => ""));
 }
Ejemplo n.º 16
0
/**
 * 端末判定
 *
 * @return  void
 */
function _checkBrowser()
{
    global $_conf;
    // 基本(PC)
    $_conf['ktai'] = false;
    $_conf['disable_cookie'] = false;
    if (UA::isSafariGroup()) {
        $_conf['accept_charset'] = 'UTF-8';
    } else {
        $_conf['accept_charset'] = 'Shift_JIS';
    }
    $mobile =& Net_UserAgent_Mobile::singleton();
    if (PEAR::isError($mobile)) {
        trigger_error($mobile->toString(), E_USER_WARNING);
        // UAが携帯なら
    } elseif ($mobile and !$mobile->isNonMobile()) {
        $_conf['ktai'] = true;
        $_conf['disable_cookie'] = false;
        $_conf['accept_charset'] = 'Shift_JIS';
        // ベンダ判定
        // docomo i-Mode
        if ($mobile->isDoCoMo()) {
            // [todo] docomoの新しいのはCookieも使える…
            $_conf['disable_cookie'] = true;
            // EZweb (au or Tu-Ka)
        } elseif ($mobile->isEZweb()) {
            $_conf['disable_cookie'] = false;
            // SoftBank(旧Vodafone Live!)
        } elseif ($mobile->isSoftBank()) {
            //$_conf['accesskey_for_k'] = 'DIRECTKEY';
            // W型端末と3GC型端末はCookieが使える
            if ($mobile->isTypeW() || $mobile->isType3GC()) {
                $_conf['disable_cookie'] = false;
            } else {
                $_conf['disable_cookie'] = true;
            }
            // WILLCOM(旧AirH"Phone)
        } elseif ($mobile->isWillcom()) {
            $_conf['disable_cookie'] = false;
        }
    }
    // iPhone指定
    if (UA::isIPhoneGroup()) {
        $_conf['ktai'] = true;
        UA::setForceMode(UA::getMobileQuery());
        define('P2_IPHONE_LIB_DIR', './iphone');
        $_conf['subject_php'] = 'subject_i.php';
        $_conf['read_new_k_php'] = 'read_new_i.php';
        $_conf['menu_k_php'] = 'menu_i.php';
        $_conf['editpref_php'] = 'editpref_i.php';
    }
}
Ejemplo n.º 17
0
Archivo: P2Util.php Proyecto: poppen/p2
 /**
  * @access  public
  * @return  string|null
  */
 function getDocomoUtnId()
 {
     if (isset($_SESSION['docomo_utn_id'])) {
         return $_SESSION['docomo_utn_id'];
     }
     $mobile =& Net_UserAgent_Mobile::singleton();
     if ($mobile->isDoCoMo() && ($sn = $mobile->getSerialNumber())) {
         return $sn;
     }
     return null;
 }
Ejemplo n.º 18
0
/**
 *  最初のログイン画面を表示する
 */
function printLoginFirst(Login $_login)
{
    global $STYLE, $_conf;
    global $_login_failed_flag, $_p2session;
    global $skin_en;
    // {{{ データ保存ディレクトリのパーミッションの注意を喚起する
    P2Util::checkDirWritable($_conf['dat_dir']);
    $checked_dirs[] = $_conf['dat_dir'];
    // チェック済みのディレクトリを格納する配列に
    if (!in_array($_conf['idx_dir'], $checked_dirs)) {
        P2Util::checkDirWritable($_conf['idx_dir']);
        $checked_dirs[] = $_conf['idx_dir'];
    }
    if (!in_array($_conf['pref_dir'], $checked_dirs)) {
        P2Util::checkDirWritable($_conf['pref_dir']);
        $checked_dirs[] = $_conf['pref_dir'];
    }
    // }}}
    // 前処理
    $_login->checkAuthUserFile();
    clearstatcache();
    //=========================================================
    // 書き出し用変数
    //=========================================================
    $ptitle = 'rep2';
    $myname = basename($_SERVER['SCRIPT_NAME']);
    $auth_sub_input_ht = "";
    $body_ht = "";
    $p_str = array('user' => 'ユーザ', 'password' => 'パスワード');
    // 携帯用表示文字列全角→半角変換
    if ($_conf['ktai'] && function_exists('mb_convert_kana')) {
        foreach ($p_str as $k => $v) {
            $p_str[$k] = mb_convert_kana($v, 'rnsk');
        }
    }
    //==============================================
    // 補助認証
    //==============================================
    $mobile = Net_UserAgent_Mobile::singleton();
    // {{{ docomo iモードID認証
    if ($mobile->isDoCoMo()) {
        /**
         * @link http://www.nttdocomo.co.jp/service/imode/make/content/ip/index.html#imodeid
         */
        if (($UID = $mobile->getUID()) !== null) {
            // HTTPかつguid=ONでリクエストされない限りここに来ることはない
            if (file_exists($_conf['auth_imodeid_file'])) {
                include $_conf['auth_imodeid_file'];
                if (isset($registed_imodeid) && $registed_imodeid == $UID) {
                    $auth_sub_input_ht = 'iモードID OK : ユーザ名だけでログインできます。<br>';
                }
            }
        }
        if ($auth_sub_input_ht == '') {
            if (empty($_SERVER['HTTPS'])) {
                $regist_imodeid_chedked = ' checked';
                $regist_docomo_chedked = '';
            } else {
                $regist_imodeid_chedked = '';
                $regist_docomo_chedked = ' checked';
            }
            $auth_sub_input_ht = <<<EOP
<input type="hidden" name="ctl_regist_imodeid" value="1">
<input type="hidden" name="ctl_regist_docomo" value="1">
<input type="checkbox" name="regist_imodeid" value="1"{$regist_imodeid_chedked}>iモードIDで認証を登録<br>
<input type="checkbox" name="regist_docomo" value="1"{$regist_docomo_chedked}>端末IDで認証を登録<br>
EOP;
        }
        // }}}
        // {{{ EZweb サブスクライバID認証
    } elseif ($mobile->isEZweb()) {
        /**
         * @link http://www.au.kddi.com/ezfactory/tec/spec/4_4.html
         */
        if (($UID = $mobile->getUID()) !== null) {
            if (file_exists($_conf['auth_ez_file'])) {
                include $_conf['auth_ez_file'];
                if (isset($registed_ez) && $registed_ez == $UID) {
                    $auth_sub_input_ht = '端末ID OK : ユーザ名だけでログインできます。<br>';
                }
            }
        }
        if ($auth_sub_input_ht == '') {
            $auth_sub_input_ht = <<<EOP
<input type="hidden" name="ctl_regist_ez" value="1">
<input type="checkbox" name="regist_ez" value="1" checked>端末IDで認証を登録<br>
EOP;
        }
        // }}}
        // {{{ SoftBank 端末シリアル番号認証
    } elseif ($mobile->isSoftBank()) {
        /**
         * パケット対応機 要ユーザID通知ONの設定
         * @link http://creation.mb.softbank.jp/web/web_ua_about.html
         */
        if (($SN = $mobile->getSerialNumber()) !== null) {
            if (file_exists($_conf['auth_jp_file'])) {
                include $_conf['auth_jp_file'];
                if (isset($registed_jp) && $registed_jp == $SN) {
                    $auth_sub_input_ht = '端末ID OK : ユーザ名だけでログインできます。<br>';
                }
            }
        }
        if ($auth_sub_input_ht == '') {
            $auth_sub_input_ht = <<<EOP
<input type="hidden" name="ctl_regist_jp" value="1">
<input type="checkbox" name="regist_jp" value="1" checked>端末IDで認証を登録<br>
EOP;
        }
        // }}}
        // {{{ Cookie認証
    } else {
        $regist_cookie_checked = ' checked';
        if (isset($_POST['submit_new']) || isset($_POST['submit_member'])) {
            if ($_POST['regist_cookie'] != '1') {
                $regist_cookie_checked = '';
            }
        }
        $ignore_cip_checked = '';
        if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) {
            if (geti($_POST['ignore_cip']) == '1') {
                $ignore_cip_checked = ' checked';
            }
        } else {
            if (geti($_COOKIE['ignore_cip']) == '1') {
                $ignore_cip_checked = ' checked';
            }
        }
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_cookie" value="1">' . sprintf('<input type="checkbox" id="regist_cookie" name="regist_cookie" value="1"%s><label for="regist_cookie">ログイン情報をCookieに保存する(推奨)</label><br>', $regist_cookie_checked) . sprintf('<input type="checkbox" id="ignore_cip" name="ignore_cip" value="1"%s><label for="ignore_cip">Cookie認証時にIPの同一性をチェックしない</label><br>', $ignore_cip_checked);
    }
    // }}}
    // ログインフォームからの指定
    if (!empty($GLOBALS['brazil'])) {
        $add_mail = '.,@-';
    } else {
        $add_mail = '';
    }
    if (preg_match("/^[0-9A-Za-z_{$add_mail}]+\$/", $_login->user_u)) {
        $hd['form_login_id'] = htmlspecialchars($_login->user_u, ENT_QUOTES);
    } elseif (!empty($_POST['form_login_id']) && preg_match("/^[0-9A-Za-z_{$add_mail}]+\$/", $_POST['form_login_id'])) {
        $hd['form_login_id'] = htmlspecialchars($_POST['form_login_id'], ENT_QUOTES);
    } else {
        $hd['form_login_id'] = '';
    }
    if (!empty($_POST['form_login_pass']) && preg_match('/^[0-9A-Za-z_]+$/', $_POST['form_login_pass'])) {
        $hd['form_login_pass'] = htmlspecialchars($_POST['form_login_pass'], ENT_QUOTES);
    } else {
        $hd['form_login_pass'] = '';
    }
    // docomoの固有端末認証
    $docomo_auth_ht = '';
    if ($mobile->isDoCoMo()) {
        if (file_exists($_conf['auth_imodeid_file']) && empty($_SERVER['HTTPS'])) {
            $docomo_auth_ht .= sprintf('<p><a href="%s?auth_type=imodeid&amp;user=%s&amp;guid=ON">iモードID認証</a></p>', $myname, rawurldecode($_login->user_u));
        }
        if (file_exists($_conf['auth_docomo_file'])) {
            $docomo_auth_ht .= sprintf('<p><a href="%s?auth_type=utn&amp;user=%s" utn>端末ID認証</a></p>', $myname, rawurldecode($_login->user_u));
        }
    }
    // docomoならpasswordにしない
    if ($mobile->isDoCoMo()) {
        $type = 'text';
        $utn = ' utn';
    } else {
        $type = 'password';
        $utn = '';
    }
    // {{{ ログイン用フォームを生成
    $hd['REQUEST_URI'] = htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES);
    if ($mobile->isDoCoMo()) {
        if (strpos($hd['REQUEST_URI'], '?') === false) {
            $hd['REQUEST_URI'] .= '?guid=ON';
        } else {
            $hd['REQUEST_URI'] .= '&amp;guid=ON';
        }
    }
    if (file_exists($_conf['auth_user_file'])) {
        $submit_ht = '<input type="submit" name="submit_member" value="ユーザログイン">';
    } else {
        $submit_ht = '<input type="submit" name="submit_new" value="新規登録">';
    }
    if ($_conf['ktai']) {
        //$k_roman_input_at = ' istyle="3" format="*m" mode="alphabet"';
        $k_roman_input_at = ' istyle="3" format="*x" mode="alphabet"';
        $k_input_size_at = '';
    } else {
        $k_roman_input_at = '';
        $k_input_size_at = ' size="32"';
    }
    $login_form_ht = <<<EOP
{$docomo_auth_ht}
<form id="login" method="POST" action="{$hd['REQUEST_URI']}" target="_self"{$utn}>
    {$_conf['k_input_ht']}
    {$p_str['user']}: <input type="text" name="form_login_id" value="{$hd['form_login_id']}"{$k_roman_input_at}{$k_input_size_at}><br>
    {$p_str['password']}: <input type="{$type}" name="form_login_pass" value="{$hd['form_login_pass']}"{$k_roman_input_at}><br>
    {$auth_sub_input_ht}
    <br>
    {$submit_ht}
</form>

EOP;
    // }}}
    //=================================================================
    // 新規ユーザ登録処理
    //=================================================================
    if (!file_exists($_conf['auth_user_file']) && !$_login_failed_flag and !empty($_POST['submit_new']) && !empty($_POST['form_login_id']) && !empty($_POST['form_login_pass'])) {
        // {{{ 入力エラーをチェック、判定
        if (!preg_match('/^[0-9A-Za-z_]+$/', $_POST['form_login_id']) || !preg_match('/^[0-9A-Za-z_]+$/', $_POST['form_login_pass'])) {
            P2Util::pushInfoHtml("<p class=\"info-msg\">rep2 error: 「{$p_str['user']}」名と「{$p_str['password']}」は半角英数字で入力して下さい。</p>");
            $show_login_form_flag = true;
            // }}}
            // {{{ 登録処理
        } else {
            $_login->makeUser($_POST['form_login_id'], $_POST['form_login_pass']);
            // 新規登録成功
            $hd['form_login_id'] = htmlspecialchars($_POST['form_login_id'], ENT_QUOTES);
            $body_ht .= "<p class=\"info-msg\">○ 認証{$p_str['user']}「{$hd['form_login_id']}」を登録しました</p>";
            $body_ht .= "<p><a href=\"{$myname}?form_login_id={$hd['form_login_id']}{$_conf['k_at_a']}\">rep2 start</a></p>";
            $_login->setUser($_POST['form_login_id']);
            $_login->pass_x = sha1($_POST['form_login_pass']);
            // セッションが利用されているなら、セッションを更新
            if (isset($_p2session)) {
                // ユーザ名とパスXを更新
                $_SESSION['login_user'] = $_login->user_u;
                $_SESSION['login_pass_x'] = $_login->pass_x;
            }
            // 要求があれば、補助認証を登録
            $_login->registCookie();
            $_login->registKtaiId();
        }
        // }}}
        // {{{ ログインエラーがある
    } else {
        if (isset($_POST['form_login_id']) || isset($_POST['form_login_pass'])) {
            $info_msg_ht = '<p class="info-msg">';
            if (!$_POST['form_login_id']) {
                $info_msg_ht .= "rep2 error: 「{$p_str['user']}」が入力されていません。<br>";
            }
            if (!$_POST['form_login_pass']) {
                $info_msg_ht .= "rep2 error: 「{$p_str['password']}」が入力されていません。";
            }
            $info_msg_ht .= '</p>';
            P2Util::pushInfoHtml($info_msg_ht);
        }
        $show_login_form_flag = true;
    }
    // }}}
    //=========================================================
    // HTMLプリント
    //=========================================================
    P2Util::header_nocache();
    echo $_conf['doctype'];
    echo <<<EOP
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">

EOP;
    if (!$_conf['ktai']) {
        echo <<<EOP
<style type="text/css">
/* <![CDATA[ */

EOP;
        include P2_STYLE_DIR . '/style_css.inc';
        include P2_STYLE_DIR . '/login_first_css.inc';
        echo <<<EOP

/* ]]> */
</style>

EOP;
    }
    echo "</head><body>\n";
    echo "<h3>{$ptitle}</h3>\n";
    // 情報表示
    P2Util::printInfoHtml();
    echo $body_ht;
    if (!empty($show_login_form_flag)) {
        echo $login_form_ht;
    }
    echo '</body></html>';
    return true;
}
Ejemplo n.º 19
0
function ic2_display($path, $params)
{
    global $_conf, $ini, $thumb, $dpr, $redirect, $id, $uri, $file, $thumbnailer;
    if (P2_OS_WINDOWS) {
        $path = str_replace('\\', '/', $path);
    }
    if (strncmp($path, '/', 1) == 0) {
        $s = empty($_SERVER['HTTPS']) ? '' : 's';
        $to = 'http' . $s . '://' . $_SERVER['HTTP_HOST'] . $path;
    } else {
        $dir = dirname(P2Util::getMyUrl());
        if (strncasecmp($path, './', 2) == 0) {
            $to = $dir . substr($path, 1);
        } elseif (strncasecmp($path, '../', 3) == 0) {
            $to = dirname($dir) . substr($path, 2);
        } else {
            $to = $dir . '/' . $path;
        }
    }
    $name = basename($path);
    $ext = strrchr($name, '.');
    switch ($redirect) {
        case 1:
            header("Location: {$to}");
            exit;
        case 2:
            switch ($ext) {
                case '.jpg':
                    header("Content-Type: image/jpeg; name=\"{$name}\"");
                    break;
                case '.png':
                    header("Content-Type: image/png; name=\"{$name}\"");
                    break;
                case '.gif':
                    header("Content-Type: image/gif; name=\"{$name}\"");
                    break;
                default:
                    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
                        header("Content-Type: application/octetstream; name=\"{$name}\"");
                    } else {
                        header("Content-Type: application/octet-stream; name=\"{$name}\"");
                    }
            }
            header("Content-Disposition: inline; filename=\"{$name}\"");
            header('Content-Length: ' . filesize($path));
            readfile($path);
            exit;
        default:
            if (!class_exists('HTML_Template_Flexy', false)) {
                require 'HTML/Template/Flexy.php';
            }
            if (!class_exists('HTML_QuickForm', false)) {
                require 'HTML/QuickForm.php';
            }
            if (!class_exists('HTML_QuickForm_Renderer_ObjectFlexy', false)) {
                require 'HTML/QuickForm/Renderer/ObjectFlexy.php';
            }
            if (isset($uri)) {
                $img_o = 'uri';
                $img_p = $uri;
            } elseif (isset($id)) {
                $img_o = 'id';
                $img_p = $id;
            } else {
                $img_o = 'file';
                $img_p = $file;
            }
            $img_q = $img_o . '=' . rawurlencode($img_p);
            // QuickFormの初期化
            $_size = explode('x', $thumbnailer->calc($params['width'], $params['height']));
            $_constants = array('o' => sprintf('原寸 (%dx%d)', $params['width'], $params['height']), 's' => '作成', 't' => $thumb, 'd' => $dpr, 'u' => $img_p, 'v' => $img_o, 'x' => $_size[0], 'y' => $_size[1]);
            $_defaults = array('q' => $ini["Thumb{$thumb}"]['quality'], 'r' => '0');
            $mobile = Net_UserAgent_Mobile::singleton();
            $qa = 'size=3 maxlength=3';
            if ($mobile->isDoCoMo()) {
                $qa .= ' istyle=4';
            } elseif ($mobile->isEZweb()) {
                $qa .= ' format=*N';
            } elseif ($mobile->isSoftBank()) {
                $qa .= ' mode=numeric';
            }
            $_presets = array('' => 'サイズ・品質');
            foreach ($ini['Dynamic']['presets'] as $_preset_name => $_preset_params) {
                $_presets[$_preset_name] = $_preset_name;
            }
            $qf = new HTML_QuickForm('imgmaker', 'get', 'ic2_mkthumb.php');
            $qf->setConstants($_constants);
            $qf->setDefaults($_defaults);
            $qf->addElement('hidden', 't');
            $qf->addElement('hidden', 'u');
            $qf->addElement('hidden', 'v');
            $qf->addElement('text', 'x', '高さ', $qa);
            $qf->addElement('text', 'y', '横幅', $qa);
            $qf->addElement('text', 'q', '品質', $qa);
            $qf->addElement('select', 'p', 'プリセット', $_presets);
            $qf->addElement('select', 'r', '回転', array('0' => 'なし', '90' => '右に90°', '270' => '左に90°', '180' => '180°'));
            $qf->addElement('checkbox', 'w', 'トリム');
            $qf->addElement('checkbox', 'z', 'DL');
            $qf->addElement('submit', 's');
            $qf->addElement('submit', 'o');
            // FlexyとQurickForm_Rendererの初期化
            $_flexy_options = array('locale' => 'ja', 'charset' => 'cp932', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
            $flexy = new HTML_Template_Flexy($_flexy_options);
            $rdr = new HTML_QuickForm_Renderer_ObjectFlexy($flexy);
            $qf->accept($rdr);
            // 表示
            $flexy->setData('p2vid', P2_VERSION_ID);
            $flexy->setData('title', 'IC2::Cached');
            $flexy->setData('pc', !$_conf['ktai']);
            $flexy->setData('iphone', $_conf['iphone']);
            if (!$_conf['ktai']) {
                $flexy->setData('skin', $GLOBALS['skin_name']);
                //$flexy->setData('stylesheets', array('css'));
                //$flexy->setData('javascripts', array('js'));
            } else {
                $flexy->setData('k_color', array('c_bgcolor' => !empty($_conf['mobile.background_color']) ? $_conf['mobile.background_color'] : '#ffffff', 'c_text' => !empty($_conf['mobile.text_color']) ? $_conf['mobile.text_color'] : '#000000', 'c_link' => !empty($_conf['mobile.link_color']) ? $_conf['mobile.link_color'] : '#0000ff', 'c_vlink' => !empty($_conf['mobile.vlink_color']) ? $_conf['mobile.vlink_color'] : '#9900ff'));
            }
            $rank = isset($params['rank']) ? $params['rank'] : 0;
            if ($_conf['iphone']) {
                $img_dir = 'img/iphone/';
                $img_ext = '.png';
            } else {
                $img_dir = 'img/';
                $img_ext = $_conf['ktai'] ? '.gif' : '.png';
            }
            $stars = array();
            $stars[-1] = $img_dir . ($rank == -1 ? 'sn1' : 'sn0') . $img_ext;
            //$stars[0] = $img_dir . (($rank ==  0) ? 'sz1' : 'sz0') . $img_ext;
            $stars[0] = $img_dir . ($_conf['iphone'] ? 'sz0' : 'sz1') . $img_ext;
            for ($i = 1; $i <= 5; $i++) {
                $stars[$i] = $img_dir . ($rank >= $i ? 's1' : 's0') . $img_ext;
            }
            $k_at_a = str_replace('&amp;', '&', $_conf['k_at_a']);
            $setrank_url = "ic2.php?{$img_q}&t={$thumb}&r=0{$k_at_a}";
            $flexy->setData('stars', $stars);
            $flexy->setData('params', $params);
            if ($thumb == 2 && $rank >= 0) {
                if ($ini['General']['inline'] == 1) {
                    $t = 2;
                    $link = null;
                } else {
                    $t = 1;
                    $link = $path;
                }
                $r = $ini['General']['redirect'] == 1 ? 1 : 2;
                $preview = "{$_SERVER['SCRIPT_NAME']}?o=1&r={$r}&t={$t}&{$img_q}{$k_at_a}";
                $flexy->setData('preview', $preview);
                $flexy->setData('link', $link);
                $flexy->setData('info', null);
            } else {
                $flexy->setData('preview', null);
                $flexy->setData('link', $path);
                $flexy->setData('info', null);
            }
            if (!$_conf['ktai'] || $_conf['iphone']) {
                $flexy->setData('backto', null);
            } elseif (isset($_REQUEST['from'])) {
                $flexy->setData('backto', $_REQUEST['from']);
                $setrank_url .= '&from=' . rawurlencode($_REQUEST['from']);
            } elseif (isset($_SERVER['HTTP_REFERER'])) {
                $flexy->setData('backto', $_SERVER['HTTP_REFERER']);
            } else {
                $flexy->setData('backto', null);
            }
            $flexy->setData('stars', $stars);
            $flexy->setData('sertank', $setrank_url . '&rank=');
            if ($_conf['iphone']) {
                $_conf['extra_headers_ht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}">
EOP;
                $_conf['extra_headers_xht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}" />
EOP;
            }
            $flexy->setData('edit', extension_loaded('gd') && $rank >= 0);
            $flexy->setData('form', $rdr->toObject());
            $flexy->setData('doctype', $_conf['doctype']);
            $flexy->setData('extra_headers', $_conf['extra_headers_ht']);
            $flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
            $flexy->compile('preview.tpl.html');
            P2Util::header_nocache();
            $flexy->output();
    }
    exit;
}
Ejemplo n.º 20
0
 /**
  * EC-CUBE がサポートする携帯端末かどうかを判別する。
  *
  * @return boolean サポートしている場合は true、それ以外の場合は false を返す。
  */
 function isSupported()
 {
     $objAgent =& Net_UserAgent_Mobile::singleton();
     // 携帯端末だと認識されたが、User-Agent の形式が未知の場合
     if (Net_UserAgent_Mobile::isError($objAgent)) {
         GC_Utils_Ex::gfPrintLog($objAgent->toString());
         return false;
     }
     if ($objAgent->isDoCoMo()) {
         $arrUnsupportedSeries = array('501i', '502i', '209i', '210i');
         $arrUnsupportedModels = array('SH821i', 'N821i', 'P821i ', 'P651ps', 'R691i', 'F671i', 'SH251i', 'SH251iS');
         return !in_array($objAgent->getSeries(), $arrUnsupportedSeries) && !in_array($objAgent->getModel(), $arrUnsupportedModels);
     } elseif ($objAgent->isEZweb()) {
         return $objAgent->isWAP2();
     } elseif ($objAgent->isVodafone()) {
         return $objAgent->isPacketCompliant();
     } else {
         // 携帯端末ではない場合はサポートしていることにする。
         return true;
     }
 }
Ejemplo n.º 21
0
 /**
  * 携帯用端末IDの認証登録をセットする
  */
 public function registKtaiId()
 {
     global $_conf;
     $mobile = Net_UserAgent_Mobile::singleton();
     // {{{ 認証登録処理 docomo iモードID & 端末製造番号
     if (!empty($_REQUEST['ctl_regist_imodeid']) || !empty($_REQUEST['ctl_regist_docomo'])) {
         // {{{ iモードID
         if (!empty($_REQUEST['ctl_regist_imodeid'])) {
             if (isset($_REQUEST['regist_imodeid']) && $_REQUEST['regist_imodeid'] == '1') {
                 if (!$mobile->isDoCoMo() || !$this->_checkIp('docomo')) {
                     p2die('端末ID登録エラー', "UAがdocomo端末でないか、iモードのIPアドレス帯域とマッチしません。({$_SERVER['REMOTE_ADDR']})");
                 }
                 if (($UID = $mobile->getUID()) !== null) {
                     $this->_registAuth('registed_imodeid', $UID, $_conf['auth_imodeid_file']);
                 } else {
                     P2Util::pushInfoHtml('<p>×docomo iモードIDでの認証登録はできませんでした</p>');
                 }
             } else {
                 $this->_registAuthOff($_conf['auth_imodeid_file']);
             }
         }
         // }}}
         // {{{ 端末製造番号
         if (!empty($_REQUEST['ctl_regist_docomo'])) {
             if (isset($_REQUEST['regist_docomo']) && $_REQUEST['regist_docomo'] == '1') {
                 if (!$mobile->isDoCoMo() || !$this->_checkIp('docomo')) {
                     p2die('端末ID登録エラー', "UAがdocomo端末でないか、iモードのIPアドレス帯域とマッチしません。({$_SERVER['REMOTE_ADDR']})");
                 }
                 if (($SN = $mobile->getSerialNumber()) !== null) {
                     $this->_registAuth('registed_docomo', $SN, $_conf['auth_docomo_file']);
                 } else {
                     P2Util::pushInfoHtml('<p>×docomo 端末製造番号での認証登録はできませんでした</p>');
                 }
             } else {
                 $this->_registAuthOff($_conf['auth_docomo_file']);
             }
         }
         // }}}
         return;
     }
     // }}}
     // {{{ 認証登録処理 EZweb サブスクライバID
     if (!empty($_REQUEST['ctl_regist_ez'])) {
         if (isset($_REQUEST['regist_ez']) && $_REQUEST['regist_ez'] == '1') {
             if (!$mobile->isEZweb() || !$this->_checkIp('au')) {
                 p2die('端末ID登録エラー', "UAがau端末でないか、EZwebのIPアドレス帯域とマッチしません。({$_SERVER['REMOTE_ADDR']})");
             }
             if (($UID = $mobile->getUID()) !== null) {
                 $this->_registAuth('registed_ez', $UID, $_conf['auth_ez_file']);
             } else {
                 P2Util::pushInfoHtml('<p>×EZweb サブスクライバIDでの認証登録はできませんでした</p>');
             }
         } else {
             $this->_registAuthOff($_conf['auth_ez_file']);
         }
         return;
     }
     // }}}
     // {{{ 認証登録処理 SoftBank 端末シリアル番号
     if (!empty($_REQUEST['ctl_regist_jp'])) {
         if (isset($_REQUEST['regist_jp']) && $_REQUEST['regist_jp'] == '1') {
             if (!$mobile->isSoftBank() || !$this->_checkIp('softbank')) {
                 p2die('端末ID登録エラー', "UAがSoftBank端末でないか、SoftBank MobileのIPアドレス帯域とマッチしません。({$_SERVER['REMOTE_ADDR']})");
             }
             if (($SN = $mobile->getSerialNumber()) !== null) {
                 $this->_registAuth('registed_jp', $SN, $_conf['auth_jp_file']);
             } else {
                 P2Util::pushInfoHtml('<p>×SoftBank 端末シリアル番号での認証登録はできませんでした</p>');
             }
         } else {
             $this->_registAuthOff($_conf['auth_jp_file']);
         }
         return;
     }
     // }}}
 }
Ejemplo n.º 22
0
Archivo: Login.php Proyecto: poppen/p2
 /**
  * 認証のチェックを行う
  *
  * @access  private
  * @return  boolean
  */
 function authCheck()
 {
     global $_conf;
     global $_login_failed_flag;
     global $_p2session;
     $this->cleanInvalidAuthUserFile();
     // 認証ユーザ設定(ファイル)を読み込みできたら
     if (file_exists($_conf['auth_user_file'])) {
         include $_conf['auth_user_file'];
         // ユーザ名が違ったら、認証失敗で抜ける
         if ($this->user_u != $rec_login_user_u) {
             P2Util::pushInfoHtml('<p class="infomsg">p2 error: ログインエラー</p>');
             // ログイン失敗ログを記録する
             if (!empty($_conf['login_log_rec'])) {
                 $recnum = isset($_conf['login_log_rec_num']) ? intval($_conf['login_log_rec_num']) : 100;
                 P2Util::recAccessLog($_conf['login_failed_log_file'], $recnum);
             }
             return false;
         }
         // パスワード設定があれば、セットする
         if (isset($rec_login_pass_x) && strlen($rec_login_pass_x)) {
             // $this->pass_x をセットする
             $this->setPassX($rec_login_pass_x);
         }
     }
     // 認証ユーザ設定 or パスワード記録がなければここまで
     if (!$this->pass_x) {
         // 新規登録時以外はエラーメッセージを表示
         if (empty($_POST['submit_newuser'])) {
             P2Util::pushInfoHtml('<p class="infomsg">p2 error: ログインエラー</p>');
         }
         return false;
     }
     // {{{ クッキー認証スルーパス
     if (isset($_COOKIE['cid'])) {
         if ($this->checkUserPwWithCid($_COOKIE['cid'])) {
             return true;
             // Cookie認証が通らなければ
         } else {
             // 古いクッキーをクリアしておく
             $this->clearCookieAuth();
         }
     }
     // }}}
     // {{{ 携帯固有端末ID認証
     $mobile =& Net_UserAgent_Mobile::singleton();
     if (PEAR::isError($mobile)) {
         trigger_error($mobile->toString(), E_USER_WARNING);
     } elseif ($mobile and !$mobile->isNonMobile()) {
         require_once P2_LIB_DIR . '/HostCheck.php';
         // ■EZweb認証スルーパス サブスクライバID
         if ($mobile->isEZweb() && isset($_SERVER['HTTP_X_UP_SUBNO']) and HostCheck::isAddrAu()) {
             if ($registed_ez = $this->getRegistedAuthCarrier('EZWEB')) {
                 if ($_SERVER['HTTP_X_UP_SUBNO'] == $registed_ez) {
                     if (isset($_p2session)) {
                         //$_p2session->regenerateId();
                         $_p2session->updateSecure();
                     }
                     return true;
                 }
             }
         }
         // ■SoftBank(J-PHONE)認証スルーパス
         // パケット対応機 要ユーザID通知ONの設定 端末シリアル番号
         // http://www.dp.j-phone.com/dp/tool_dl/web/useragent.php
         if (HostCheck::isAddrSoftBank() and $sn = P2Util::getSoftBankID() and HostCheck::isAddrSoftBank()) {
             if ($registed_jp = $this->getRegistedAuthCarrier('SOFTBANK')) {
                 if ($sn == $registed_jp) {
                     if (isset($_p2session)) {
                         // ここで session_regenerate_id(true) すると接続が途切れた時にログイン画面に戻されるらしい。
                         // 端末認証されているなら、セッションチェックまで行かないはずなのに不思議。
                         //$_p2session->regenerateId();
                         $_p2session->updateSecure();
                     }
                     return true;
                 }
                 //$this->removeRegistedAuthCarrier('SOFTBANK');
             }
         }
         // ■docomo UTN認証
         // ログインフォーム入力からは利用せず、専用認証リンクからのみ利用
         if (empty($_POST['form_login_id'])) {
             if ($sn = P2Util::getDocomoUtnId() and HostCheck::isAddrDocomo()) {
                 if ($registed_docomo = $this->getRegistedAuthCarrier('DOCOMO')) {
                     if ($sn == $registed_docomo) {
                         if (isset($_p2session)) {
                             // docomoで書き込んだ後に戻ったりすると再認証になって不便
                             //$_p2session->regenerateId();
                             $_p2session->updateSecure();
                         }
                         return true;
                     }
                 }
             }
         }
         // WILLCOMでは端末ID認証を行わない
     }
     // }}}
     // {{{ すでにセッションが登録されていたら、セッションで認証
     if (isset($_SESSION['login_user']) && isset($_SESSION['login_pass_x'])) {
         // セッションが利用されているなら、セッションの妥当性チェック
         if (isset($_p2session)) {
             if ($msg = $_p2session->getSecureSessionErrorMsg()) {
                 P2Util::pushInfoHtml('<p>p2 error: ' . htmlspecialchars($msg) . '</p>');
                 //$_p2session->unSession();
                 // ログイン失敗
                 return false;
             }
         }
         if ($this->user_u == $_SESSION['login_user']) {
             if ($_SESSION['login_pass_x'] != $this->pass_x) {
                 $_p2session->unSession();
                 return false;
             } else {
                 return true;
             }
         }
     }
     // }}}
     // ■フォームからログインした時
     if (!empty($_POST['submit_userlogin'])) {
         // フォームログイン成功なら
         if ($_POST['form_login_id'] == $this->user_u and sha1($_POST['form_login_pass']) == $this->pass_x) {
             // 古いクッキーをクリアしておく
             $this->clearCookieAuth();
             // ログインログを記録する
             $this->logLoginSuccess();
             if (isset($_p2session)) {
                 $_p2session->regenerateId();
                 $_p2session->updateSecure();
             }
             return true;
             // フォームログイン失敗なら
         } else {
             P2Util::pushInfoHtml('<p class="infomsg">p2 info: ログインできませんでした。<br>ユーザ名かパスワードが違います。</p>');
             $_login_failed_flag = true;
             // ログイン失敗ログを記録する
             $this->logLoginFailed();
             return false;
         }
     }
     /*
     // Basic認証
     if (!empty($_REQUEST['basic'])) {
         if (isset($_SERVER['PHP_AUTH_USER']) and ($_SERVER['PHP_AUTH_USER'] == $this->user_u) && (sha1($_SERVER['PHP_AUTH_PW']) == $this->pass_x)) {
             
             // 古いクッキーをクリアしておく
             $this->clearCookieAuth();
     
             // ログインログを記録する
             $this->logLoginSuccess();
             
             if (isset($_p2session)) {
                 $_p2session->regenerateId();
                 $_p2session->updateSecure();
             }
             return true;
             
         } else {
             header('WWW-Authenticate: Basic realm="zone"');
             header('HTTP/1.0 401 Unauthorized');
             echo 'Login Failed. ユーザ認証に失敗しました。';
             
             // ログイン失敗ログを記録する
             $this->logLoginFailed();
             
             exit;
         }
     }
     */
     return false;
 }
Ejemplo n.º 23
0
 /**
  * Net_UserAgent_Mobile::singleton() の結果を取得する。
  * REAR Error は false に変換される。
  *
  * @param   string  $ua
  * @return  Net_UserAgent_Mobile|false
  */
 public static function getNet_UserAgent_Mobile($ua = null)
 {
     static $cache_ = null;
     if (is_null($ua) and !is_null($cache_)) {
         return $cache_;
     }
     if (!is_null($ua)) {
         $nuam = Net_UserAgent_Mobile::factory($ua);
     } else {
         $nuam = Net_UserAgent_Mobile::singleton();
     }
     if (PEAR::isError($nuam)) {
         trigger_error($nuam->toString, E_USER_WARNING);
         $return = false;
     } elseif (!$nuam) {
         $return = false;
         // null
     } else {
         $return = $nuam;
     }
     if (is_null($ua)) {
         $cache_ = $return;
     }
     return $return;
 }
Ejemplo n.º 24
0
        // ファイルがなければ生成
        $fp = @fopen($_conf['auth_user_file'], 'wb');
        if (!$fp) {
            p2die("{$_conf['auth_user_file']} を保存できませんでした。認証ユーザ登録失敗。");
        }
        flock($fp, LOCK_EX);
        fputs($fp, $auth_user_cont);
        flock($fp, LOCK_UN);
        fclose($fp);
        P2Util::pushInfoHtml('<p>○認証パスワードを変更登録しました</p>');
    }
}
//====================================================
// 補助認証
//====================================================
$mobile = Net_UserAgent_Mobile::singleton();
$p_htm['auth_ctl'] = '';
// docomo認証
if ($mobile->isDoCoMo()) {
    if (file_exists($_conf['auth_imodeid_file'])) {
        $p_htm['auth_ctl'] .= <<<EOP
iモードID認証登録済[<a href="{$_SERVER['SCRIPT_NAME']}?ctl_regist_imodeid=1{$_conf['k_at_a']}">解除</a>]<br>
EOP;
    }
    if (file_exists($_conf['auth_docomo_file'])) {
        $p_htm['auth_ctl'] .= <<<EOP
端末ID認証登録済[<a href="{$_SERVER['SCRIPT_NAME']}?ctl_regist_docomo=1{$_conf['k_at_a']}">解除</a>]<br>
EOP;
    }
    if ($p_htm['auth_ctl'] == '' && $_login->pass_x) {
        if (empty($_SERVER['HTTPS'])) {
Ejemplo n.º 25
0
/**
 *  p2 - 最初のログイン画面をHTML表示する関数
 *
 * @access  public
 * @return  void
 */
function printLoginFirst(&$_login)
{
    global $_info_msg_ht, $STYLE, $_conf;
    global $_login_failed_flag, $_p2session;
    // {{{ データ保存ディレクトリに書き込み権限がなければ注意を表示セットする
    P2Util::checkDirWritable($_conf['dat_dir']);
    $checked_dirs[] = $_conf['dat_dir'];
    // チェック済みのディレクトリを格納する配列に
    if (!in_array($_conf['idx_dir'], $checked_dirs)) {
        P2Util::checkDirWritable($_conf['idx_dir']);
        $checked_dirs[] = $_conf['idx_dir'];
    }
    if (!in_array($_conf['pref_dir'], $checked_dirs)) {
        P2Util::checkDirWritable($_conf['pref_dir']);
        $checked_dirs[] = $_conf['pref_dir'];
    }
    // }}}
    // 前処理
    $_login->cleanInvalidAuthUserFile();
    clearstatcache();
    // 外部からの変数
    $post['form_login_id'] = isset($_POST['form_login_id']) ? $_POST['form_login_id'] : null;
    $post['form_login_pass'] = isset($_POST['form_login_pass']) ? $_POST['form_login_pass'] : null;
    //=========================================================
    // 書き出し用変数
    //=========================================================
    if ($_conf['ktai']) {
        $ptitle = 'rep2iPhone';
    } else {
        $ptitle = 'rep2';
    }
    $myname = basename($_SERVER['SCRIPT_NAME']);
    $auth_sub_input_ht = "";
    $body_ht = "";
    $show_login_form_flag = false;
    $p_str = array('user' => 'ユーザー名', 'password' => 'パスワード');
    //iPhoneなんで変換とばしますよ
    // 携帯用表示文字列全角→半角変換
    //if ($_conf['ktai'] && function_exists('mb_convert_kana')) {
    //   foreach ($p_str as $k => $v) {
    //       $p_str[$k] = mb_convert_kana($v, 'rnsk');
    //   }
    //}
    // {{{ 補助認証
    $mobile =& Net_UserAgent_Mobile::singleton();
    // EZ認証
    if (!empty($_SERVER['HTTP_X_UP_SUBNO'])) {
        if (file_exists($_conf['auth_ez_file'])) {
        } else {
            $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_ez" value="1">' . "\n" . '<input type="checkbox" name="regist_ez" value="1" checked>EZ端末IDで認証を登録<br>';
        }
        // J認証
        // http://www.dp.j-phone.com/dp/tool_dl/web/useragent.php
    } elseif ($mobile->isVodafone() && ($SN = $mobile->getSerialNumber()) !== NULL) {
        if (file_exists($_conf['auth_jp_file'])) {
        } else {
            $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_jp" value="1">' . "\n" . '<input type="checkbox" name="regist_jp" value="1" checked>J端末IDで認証を登録<br>';
        }
        // DoCoMo認証
    } elseif ($mobile->isDoCoMo()) {
        if (file_exists($_conf['auth_docomo_file'])) {
        } else {
            $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_docomo" value="1">' . "\n" . '<input type="checkbox" name="regist_docomo" value="1" checked>DoCoMo端末IDで認証を登録<br>';
        }
        // Cookie認証
    } else {
        $regist_cookie_checked = ' checked';
        if (isset($_POST['submit_new']) || isset($_POST['submit_member'])) {
            if (!isset($_POST['regist_cookie']) or $_POST['regist_cookie'] != '1') {
                $regist_cookie_checked = '';
            }
        }
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_cookie" value="1">' . "\n" . '<input type="checkbox" id="regist_cookie" name="regist_cookie" value="1"' . $regist_cookie_checked . '><label for="regist_cookie">cookieに保存する(推奨)</label><br>';
    }
    // }}}
    // ログインフォームからの指定
    if (!empty($GLOBALS['brazil'])) {
        $add_mail = '.,@-';
    } else {
        $add_mail = '';
    }
    $form_login_id_hs = '';
    if (preg_match("/^[0-9a-zA-Z_{$add_mail}]+\$/", $_login->user_u)) {
        $form_login_id_hs = hs($_login->user_u);
    } elseif (preg_match("/^[0-9a-zA-Z_{$add_mail}]+\$/", $post['form_login_id'])) {
        $form_login_id_hs = hs($post['form_login_id']);
    }
    if (preg_match('/^[0-9a-zA-Z_]+$/', $post['form_login_pass'])) {
        $form_login_pass_hs = hs($post['form_login_pass']);
    } else {
        $form_login_pass_hs = '';
    }
    // DoCoMoの固有端末認証(セッション利用時のみ有効)
    $docomo_utn_ht = '';
    //if ($_conf['use_session'] && $_login->user_u && $mobile->isDoCoMo()) {
    if ($_conf['use_session'] && $mobile->isDoCoMo()) {
        $docomo_utn_ht = '<p><a href="' . $myname . '?user='******'" utn>DoCoMo固有端末認証</a></p>';
    }
    // DoCoMoならリトライ時にパスワード入力を password → text とする
    // (DoCoMoはpassword入力が完全マスクされるUIで、入力エラーがわかりにく過ぎる)
    if (isset($post['form_login_pass']) and $mobile->isDoCoMo()) {
        $type = "text";
    } else {
        $type = "password";
    }
    // {{{ ログイン用フォームを生成
    $REQUEST_URI_hs = hs($_SERVER['REQUEST_URI']);
    if (file_exists($_conf['auth_user_file'])) {
        $submit_ht = '<input type="submit" name="submit_member" value="ユーザログイン">';
    } else {
        $submit_ht = '<input type="submit" name="submit_new" value="新規登録">';
    }
    $login_form_ht = <<<EOP
{$docomo_utn_ht}
<form id="login" method="POST" action="{$REQUEST_URI_hs}" target="_self" utn>
    {$_conf['k_input_ht']}
    {$p_str['user']}: <input type="text" name="form_login_id" value="{$form_login_id_hs}" istyle="3"><br>
    {$p_str['password']}: <input type="{$type}" name="form_login_pass" value="{$form_login_pass_hs}" istyle="3"><br>
    {$auth_sub_input_ht}
    <br>
    {$submit_ht}
</form>

EOP;
    // }}}
    //=================================================================
    // 新規ユーザ登録処理
    //=================================================================
    if (!file_exists($_conf['auth_user_file']) && !$_login_failed_flag and !empty($_POST['submit_new']) && $post['form_login_id'] && $post['form_login_pass']) {
        // {{{ 入力エラーをチェック、判定
        if (!preg_match('/^[0-9a-zA-Z_]+$/', $post['form_login_id']) || !preg_match('/^[0-9a-zA-Z_]+$/', $post['form_login_pass'])) {
            $_info_msg_ht .= "<p class=\"infomsg\">rep2 error: 「{$p_str['user']}」名と「{$p_str['password']}」は半角英数字で入力して下さい。</p>";
            $show_login_form_flag = true;
            // }}}
            // {{{ 登録処理
        } else {
            $_login->makeUser($post['form_login_id'], $post['form_login_pass']);
            // 新規登録成功
            $form_login_id_hs = hs($post['form_login_id']);
            $body_ht .= "<p class=\"infomsg\">○ 認証{$p_str['user']}「{$form_login_id_hs}」を登録しました</p>";
            $body_ht .= "<p><a href=\"{$myname}?form_login_id={$form_login_id_hs}{$_conf['k_at_a']}\">rep2 start</a></p>";
            $_login->setUser($post['form_login_id']);
            $_login->pass_x = sha1($post['form_login_pass']);
            // セッションが利用されているなら、セッションを更新
            if (isset($_p2session)) {
                // ユーザ名とパスXを更新
                $_SESSION['login_user'] = $_login->user_u;
                $_SESSION['login_pass_x'] = $_login->pass_x;
            }
            // 要求があれば、補助認証を登録
            $_login->registCookie();
            $_login->registKtaiId();
        }
        // }}}
        // {{{ ログインエラーがある
    } else {
        if (isset($post['form_login_id']) || isset($post['form_login_pass'])) {
            $msg_ht .= '<p class="infomsg">';
            if (!$post['form_login_id']) {
                $msg_ht .= "p2 error: 「{$p_str['user']}」が入力されていません。" . "<br>";
            }
            if (!$post['form_login_pass']) {
                $msg_ht .= "p2 error: 「{$p_str['password']}」が入力されていません。";
            }
            $msg_ht .= '</p>';
            P2Util::pushInfoHtml($msg_ht);
        }
        $show_login_form_flag = true;
    }
    // }}}
    //=========================================================
    // HTML表示出力
    //=========================================================
    P2Util::header_nocache();
    echo $_conf['doctype'];
    echo <<<EOP
<html lang="ja">
<head>
    {$_conf['meta_charset_ht']}
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <title>{$ptitle}</title>
EOP;
    if (!$_conf['ktai']) {
        include_once "./style/style_css.inc";
        include_once "./style/login_first_css.inc";
    } else {
        //携帯でないなら=iPhoneなら
        echo '<style type="text/css" media="screen">@import "./iui/iui.css";</style>';
    }
    echo "</head><body>\n";
    echo "<div class=\"toolbar\"><h1 id=\"pageTitle\">{$ptitle}</h1></div>\n";
    if ($_conf['ktai']) {
        //iPhone用
        echo '<div id="usage" class="panel"><filedset>';
    }
    P2Util::printInfoHtml();
    echo $body_ht;
    if ($show_login_form_flag) {
        echo $login_form_ht;
    }
    if ($_conf['ktai']) {
        //iPhone用
        echo "<br><br><br><br><br><br><br>\n</filedset></div>\n";
    }
    echo '</body></html>';
}
Ejemplo n.º 26
0
/**
 *  p2 - 最初のログイン画面をHTML表示する関数
 *
 * @access  public
 * @return  void
 */
function printLoginFirst(&$_login)
{
    global $STYLE, $_conf;
    global $_login_failed_flag, $_p2session;
    // データ保存ディレクトリに書き込み権限がなければ注意を表示セットする
    P2Util::checkDirsWritable(array($_conf['dat_dir'], $_conf['idx_dir'], $_conf['pref_dir']));
    // 前処理
    $_login->cleanInvalidAuthUserFile();
    clearstatcache();
    // 外部からの変数
    $post['form_login_id'] = isset($_POST['form_login_id']) ? $_POST['form_login_id'] : null;
    $post['form_login_pass'] = isset($_POST['form_login_pass']) ? $_POST['form_login_pass'] : null;
    //=========================================================
    // 書き出し用変数
    //=========================================================
    if (UA::isIPhoneGroup()) {
        $ptitle = $_conf['p2name'] . 'iPhone';
    } else {
        $ptitle = $_conf['p2name'];
    }
    $ptitle_ht = hs($ptitle);
    if (!empty($GLOBALS['brazil'])) {
        $ptitle_ht = 'p2.2ch.net';
        if (!(UA::isK() || UA::isIPhoneGroup())) {
            $ptitle_ht = '<a href="http://p2.2ch.net/">' . $ptitle_ht . '</a>';
        }
    }
    $myname = basename($_SERVER['SCRIPT_NAME']);
    $body_ht = '';
    $show_login_form_flag = false;
    $p_str = array('user' => 'ユーザ', 'password' => 'パスワード');
    if (!empty($GLOBALS['brazil'])) {
        $p_str['user'] = '******';
    }
    // 携帯用表示文字列全角→半角変換
    if (!UA::isIPhoneGroup() && UA::isK() && function_exists('mb_convert_kana')) {
        foreach ($p_str as $k => $v) {
            $p_str[$k] = mb_convert_kana($v, 'rnsk');
        }
    }
    // 補助認証
    require_once P2_LIB_DIR . '/HostCheck.php';
    $mobile = Net_UserAgent_Mobile::singleton();
    $auth_sub_input_ht = _getAuthSubInputHtml($mobile);
    // ログインフォームからの指定
    $form_login_id_hs = '';
    if ($_login->validLoginId($_login->user_u)) {
        $form_login_id_hs = hs($_login->user_u);
    } elseif ($_login->validLoginId($post['form_login_id'])) {
        $form_login_id_hs = hs($post['form_login_id']);
    }
    $form_login_pass_hs = '';
    if ($_login->validLoginPass($post['form_login_pass'])) {
        $form_login_pass_hs = hs($post['form_login_pass']);
    }
    // docomoの固有端末認証(セッション利用時のみ有効)
    $docomo_utn_ht = '';
    //if ($_conf['use_session'] && $_login->user_u && $mobile->isDoCoMo()) {
    if ($_conf['use_session'] && $mobile->isDoCoMo()) {
        $uri = $myname . '?guid=ON&user='******'<p><a href="' . hs($uri) . '" utn>docomo固有端末認証</a></p>';
    }
    // docomoならリトライ時にパスワード入力を password → text とする
    // (docomoはpassword入力が完全マスクされるUIで、入力エラーがわかりにく過ぎる)
    if (isset($post['form_login_pass']) and $mobile->isDoCoMo()) {
        $type = "text";
    } else {
        $type = "password";
    }
    // {{{ ログイン用フォームを生成
    $ruri = $_SERVER['REQUEST_URI'];
    if (UA::isDoCoMo()) {
        $ruri = UriUtil::addQueryToUri($ruri, array('guid' => 'ON'));
    }
    $REQUEST_URI_hs = hs($ruri);
    if (!empty($GLOBALS['brazil']) or file_exists($_conf['auth_user_file'])) {
        $submit_ht = '<input type="submit" name="submit_userlogin" value="ユーザログイン">';
    } else {
        $submit_ht = '<input type="submit" name="submit_newuser" value="新規登録">';
    }
    $login_form_ht = <<<EOP
{$docomo_utn_ht}
<form id="login" method="POST" action="{$REQUEST_URI_hs}" target="_self" utn>
    {$_conf['k_input_ht']}
    {$p_str['user']}: <input type="text" name="form_login_id" value="{$form_login_id_hs}" istyle="3" size="32" autocorrect="off" autocapitalize="off"><br>
    {$p_str['password']}: <input type="{$type}" name="form_login_pass" value="{$form_login_pass_hs}" istyle="3" autocorrect="off" autocapitalize="off"><br>
    {$auth_sub_input_ht}
    <br>
    {$submit_ht}
</form>

EOP;
    // }}}
    //=================================================================
    // 新規ユーザ登録処理
    //=================================================================
    $isAllowedNewUser = empty($GLOBALS['brazil']) ? true : false;
    if ($isAllowedNewUser and !file_exists($_conf['auth_user_file']) && !$_login_failed_flag and !empty($_POST['submit_newuser']) && $post['form_login_id'] && $post['form_login_pass']) {
        // {{{ 入力エラーをチェック、判定
        if (!$_login->validLoginId($post['form_login_id']) || !$_login->validLoginPass($post['form_login_pass'])) {
            P2Util::pushInfoHtml(sprintf('<p class="infomsg">p2 error: 「%s」名と「%s」は半角英数字で入力して下さい。</p>', hs($p_str['user']), hs($p_str['password'])));
            $show_login_form_flag = true;
            // }}}
            // {{{ 登録処理
        } else {
            $_login->makeUser($post['form_login_id'], $post['form_login_pass']);
            // 新規登録成功
            $form_login_id_hs = hs($post['form_login_id']);
            $body_ht .= "<p class=\"infomsg\">○ 認証{$p_str['user']}「{$form_login_id_hs}」を登録しました</p>";
            $body_ht .= "<p><a href=\"{$myname}?form_login_id={$form_login_id_hs}{$_conf['k_at_a']}\">{$_conf['p2name']} start</a></p>";
            $_login->setUser($post['form_login_id']);
            $_login->setPassX(sha1($post['form_login_pass']));
            // セッションが利用されているなら、セッションを更新
            if (isset($_p2session)) {
                // ユーザ名とパスXを更新
                $_SESSION['login_user'] = $_login->user_u;
                $_SESSION['login_pass_x'] = $_login->pass_x;
            }
            // 要求があれば、補助認証を登録
            $_login->registCookie();
            $_login->registKtaiId();
        }
        // }}}
        // {{{ ログインエラーがある
    } else {
        if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) {
            $msg_ht = '<p class="infomsg">';
            if (!$post['form_login_id']) {
                $msg_ht .= "p2 error: 「{$p_str['user']}」が入力されていません。" . "<br>";
            } elseif (!$_login->validLoginId($post['form_login_id'])) {
                $msg_ht .= "p2 error: 「{$p_str['user']}」文字列が不正です。" . "<br>";
            }
            if (!$post['form_login_pass']) {
                $msg_ht .= "p2 error: 「{$p_str['password']}」が入力されていません。";
            }
            $msg_ht .= '</p>';
            P2Util::pushInfoHtml($msg_ht);
        }
        $show_login_form_flag = true;
    }
    // }}}
    //=========================================================
    // HTML表示出力
    //=========================================================
    P2Util::headerNoCache();
    P2View::printDoctypeTag();
    ?>
<html lang="ja">
<head>
<?php 
    P2View::printExtraHeadersHtml();
    ?>
	<title><?php 
    eh($ptitle);
    ?>
</title>
    <?php 
    if (UA::isIPhoneGroup()) {
        ?>
<style type="text/css" media="screen">@import "./iui/iui.css";</style><?php 
    }
    if (UA::isPC() && !UA::isIPhoneGroup()) {
        // ユーザは未決定
        //P2View::printIncludeCssHtml('style');
        //P2View::printIncludeCssHtml('login_first');
        ?>
	<link rel="stylesheet" href="style/login_first.css" type="text/css">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
	<?php 
    }
    ?>
	</head><body><?php 
    if (UA::isIPhoneGroup()) {
        ?>
<div class="toolbar"><h1 id="pageTitle"><?php 
        echo $ptitle_ht;
        ?>
</h1></div><?php 
        ?>
<div id="usage" class="panel"><filedset><?php 
    } else {
        ?>
<h3><?php 
        echo $ptitle_ht;
        ?>
</h3><?php 
    }
    P2Util::printInfoHtml();
    echo $body_ht;
    if ($show_login_form_flag) {
        echo $login_form_ht;
        if (empty($GLOBALS['brazil']) and !(HostCheck::isAddrLocal() || HostCheck::isAddrPrivate())) {
            ?>
<p>
	<font size="-1" color="gray">※このページはプライベート利用のためのシステムです。<br>
	部外者によるログイン試行は、<br>
	不正アクセスとして記録されます。<br>
	このページへのアクセスURLを部外者が<br>
	不特定多数に公知することを禁止します。</font></p><?php 
        }
    }
    if (!empty($GLOBALS['brazil']) and UA::isK() || UA::isIPhoneGroup()) {
        ?>
<br><hr size="1"><div align="center"><a href="http://p2.2ch.net/">p2.2ch.net</a></div><?php 
    }
    if (UA::isIPhoneGroup()) {
        ?>
<br><br><br><br><br><br></filedset></div><?php 
    }
    ?>
</body></html><?php 
}
Ejemplo n.º 27
0
<?php

require_once "Net/UserAgent/Mobile.php";
define("GMAP_API_KEY", "ABQIAAAAj3IHIoLSRmyzSz8pW3AHbBSh7JF37mP6LSEerb9hwzyNHc72dhTbIovkd3xnLdbgVCtxZw0swtjeog");
$agent =& Net_UserAgent_Mobile::singleton();
switch (true) {
    case $agent->isDoCoMo():
        // DoCoMoかどうか
        echo "DoCoMoだよ。";
        break;
    case $agent->isVodafone():
        // vodafoneかどうか
        echo "vodafoneだよ。";
        break;
    case $agent->isEZweb():
        // ezwebかどうか
        echo "ezwebだよ。";
        break;
    default:
        echo "たぶんパソコン。";
        break;
}
?>
<img src="http://maps.google.com/staticmap?center=43.068527,141.350806
&zoom=15&size=220x220&maptype=mobile&markers=43.068367,141.347646,
redy%7C43.067402,141.352697,blueb&key=<?php 
echo GMAP_API_KEY;
?>
" />