Esempio n. 1
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';
    }
}
Esempio n. 2
0
File: UA.php Progetto: poppen/p2
 /**
  * クエリーが携帯を指定しているならtrueを返す
  *
  * @static
  * @access  private
  * @return  boolean
  */
 function isMobileByQuery()
 {
     $qv = UA::getQueryValue();
     if (isset($qv) && $qv == UA::getMobileQuery()) {
         return true;
     }
     return false;
 }