Exemple #1
0
/**
 * フィルタ用に書き換えたフッタ変数を取得する
 * 
 * @access  public
 * @return  array  array(read_navi_previous_btm_ht, read_navi_next_btm_ht, read_footer_navi_new_btm_ht)
 */
function getResetReadNaviFooterK($aThread, $params)
{
    global $_conf;
    global $_filter_hits, $_filter_range;
    // $prev_st, $next_st, $filter_page, $res_filter
    extract($params);
    // {{{ 検索クエリ
    $filter_qs = array('detect_hint' => '◎◇', 'host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'offline' => 1, 'word' => $GLOBALS['word'], 'ls' => 'all', UA::getQueryKey() => UA::getQueryValue());
    foreach ($res_filter as $key => $value) {
        $filter_qs[$key] = $value;
    }
    // }}}
    if ($filter_page > 1) {
        $qs = array_merge($filter_qs, array('filter_page' => $filter_page - 1));
        $read_navi_previous_url = UriUtil::buildQueryUri($_conf['read_php'], $qs);
        $read_navi_previous_btm_ht = sprintf('<a %1$s="%2$s" href="%3$s">%2$s.%4$s</a>', hs($_conf['accesskey_for_k']), hs($_conf['k_accesskey']['prev']), hs($read_navi_previous_url), hs($prev_st));
    }
    if ($_filter_range['to'] < $_filter_hits) {
        $qs = array_merge($filter_qs, array('filter_page' => $filter_page + 1));
        $read_navi_next_url = UriUtil::buildQueryUri($_conf['read_php'], $qs);
        $read_navi_next_btm_ht = sprintf('<a %1$s="%2$s" href="%3$s">%2$s.%4$s</a>', hs($_conf['accesskey_for_k']), hs($_conf['k_accesskey']['next']), hs($read_navi_next_url), hs($next_st));
    }
    $read_footer_navi_new_btm_ht = '';
    /*
    // ※メモ:「6.新着」(新着レスの表示)と「3.新20」(最新N件)は異なる。
    $read_footer_navi_new_btm_ht = str_replace(
        " {$_conf['accesskey_for_k']}=\"{$_conf['k_accesskey']['next']}\"", '', $read_footer_navi_new_btm_ht
    );
    $read_footer_navi_new_btm_ht = str_replace(">{$_conf['k_accesskey']['next']}.", '>', $read_footer_navi_new_btm_ht);
    */
    return array('read_navi_previous_btm_ht' => $rread_navi_previous_btm_ht, 'read_navi_next_btm_ht' => $read_navi_next_btm_ht, 'read_footer_navi_new_btm_ht' => $read_footer_navi_new_btm_ht);
}
Exemple #2
0
/**
 * 新着まとめ読み <a>
 *
 * @return  string  HTML
 */
function getShinchakuMatomeATag($aThreadList, $shinchaku_num)
{
    global $_conf;
    static $upper_toolbar_done_ = false;
    $shinchaku_matome_atag = '';
    // 倉庫なら新着まとめのリンクはなし
    if ($aThreadList->spmode == 'soko') {
        return $shinchaku_matome_atag = '';
    }
    $attrs = array();
    if (UA::isIPhoneGroup()) {
        $attrs['class'] = 'button';
    }
    // 上下あるツールバーの下だけにアクセスキーをつける
    if ($upper_toolbar_done_) {
        $attrs[$_conf['accesskey_for_k']] = $_conf['k_accesskey']['matome'];
    }
    $upper_toolbar_done_ = true;
    $qs = array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'spmode' => $aThreadList->spmode, 'nt' => date('gis'), UA::getQueryKey() => UA::getQueryValue());
    $label = "{$_conf['k_accesskey']['matome']}.新まとめ";
    if ($shinchaku_num) {
        $shinchaku_matome_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_k_php'], array_merge($qs, array('norefresh' => '1'))), hs("{$label}({$shinchaku_num})"), $attrs);
    } else {
        $shinchaku_matome_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_k_php'], $qs), hs($label), $attrs);
    }
    return $shinchaku_matome_atag;
}
Exemple #3
0
 /**
  * Sets up some standard variables as well as starts the user agent parsing process
  *
  * @return {Object}       the result of the user agent parsing
  */
 public static function parse($ua = NULL)
 {
     self::$ua = $ua ? $ua : strip_tags($_SERVER["HTTP_USER_AGENT"]);
     self::$accept = empty($_SERVER["HTTP_ACCEPT"]) ? '' : strip_tags($_SERVER["HTTP_ACCEPT"]);
     if (empty(self::$regexes)) {
         if (file_exists(__DIR__ . "/resources/regexes.yaml")) {
             self::$regexes = Spyc::YAMLLoad(__DIR__ . "/resources/regexes.yaml");
         } else {
             print "<h1>Error</h1>\n\t\t\t\t\t   <p>Please download the regexes.yaml file before using UAParser.php.</p>\n\t\t\t\t\t   <p>You can type the following at the command line to download the latest version:</p>\n\t\t\t\t\t   <blockquote>\n\t\t\t\t\t\t<code>%: cd /path/to/UAParser</code><br />\n\t\t\t\t\t   \t<code>%: php UAParser.php -get</code>\n\t\t\t\t\t   </blockquote>";
             exit;
         }
     }
     // run the regexes to match things up
     $uaRegexes = self::$regexes['user_agent_parsers'];
     foreach ($uaRegexes as $uaRegex) {
         if ($result = self::uaParser($uaRegex)) {
             $result->uaOriginal = self::$ua;
             break;
         }
     }
     // if no browser was found check to see if it can be matched at least against a device (e.g. spider, generic feature phone or generic smartphone)
     if (!$result) {
         if (($result = self::deviceParser()) && $result->device != 'Spider') {
             $result->isMobile = true;
             $result->isMobileDevice = true;
             $result->uaOriginal = self::$ua;
         } else {
             if (isset($result) && isset($result->device) && $result->device == "Spider") {
                 $result->isMobile = false;
                 $result->isSpider = true;
                 $result->uaOriginal = self::$ua;
             }
         }
     }
     // still false?! see if it's a really dumb feature phone, if not just mark it as unknown
     if (!$result) {
         if (strpos(self::$accept, 'text/vnd.wap.wml') > 0 || strpos(self::$accept, 'application/vnd.wap.xhtml+xml') > 0 || isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE'])) {
             $result = new stdClass();
             $result->device = "Generic Feature Phone";
             $result->deviceFull = "Generic Feature Phone";
             $result->isMobile = true;
             $result->isMobileDevice = true;
             $result->uaOriginal = self::$ua;
         } else {
             $result = new stdClass();
             $result->device = "Unknown";
             $result->deviceFull = "Unknown";
             $result->isMobile = false;
             $result->isMobileDevice = false;
             $result->isComputer = true;
             $result->uaOriginal = self::$ua;
         }
     }
     // log the results when testing
     if (self::$debug) {
         self::log($result);
     }
     return $result;
 }
Exemple #4
0
/**
 * @return  string
 */
function _getCookieLocationUri()
{
    $qs = array('check_regist_cookie' => '1', 'regist_cookie' => intval(geti($_REQUEST['regist_cookie'])), UA::getQueryKey() => UA::getQueryValue());
    if (defined('SID') && strlen(SID)) {
        $qs[session_name()] = session_id();
    }
    return $next_uri = UriUtil::buildQueryUri('login.php', $qs);
}
Exemple #5
0
/**
 * @access  public
 * @return  array
 */
function getIndexMenuKIni()
{
    global $_conf;
    // 2008/11/15 旧 $_conf['menuKIni']
    $indexMenuKIni = array('recent_shinchaku' => array($_conf['subject_php'] . '?spmode=recent&sb_view=shinchaku', '最近読んだスレの新着'), 'recent' => array($_conf['subject_php'] . '?spmode=recent&norefresh=1', '最近読んだスレの全て'), 'fav_shinchaku' => array($_conf['subject_php'] . '?spmode=fav&sb_view=shinchaku', 'お気にスレの新着'), 'fav' => array($_conf['subject_php'] . '?spmode=fav&norefresh=1', 'お気にスレの全て'), 'favita' => array($_conf['menu_k_php'] . '?view=favita', 'お気に板'), 'cate' => array($_conf['menu_k_php'] . '?view=cate', '板リスト'), 'res_hist' => array($_conf['subject_php'] . '?spmode=res_hist', '書込履歴'), 'palace' => array($_conf['subject_php'] . '?spmode=palace&norefresh=1', 'スレの殿堂'), 'setting' => array('setting.php?dummy=1', 'ログイン管理'), 'editpref' => array($_conf['editpref_php'] . '?dummy=1', '設定管理'));
    // 携帯なら半角に変換
    if (UA::isK()) {
        foreach ($indexMenuKIni as $k => $v) {
            $indexMenuKIni[$k][1] = mb_convert_kana($indexMenuKIni[$k][1], 'rnsk');
        }
    }
    return $indexMenuKIni;
}
Exemple #6
0
/**
 * @access  public
 * @return  string  HTML
 */
function getSbToolbarShinchakuMatomeHtml($aThreadList, $shinchaku_num)
{
    global $_conf;
    static $new_matome_i_ = 0;
    $new_matome_i_++;
    $shinchaku_matome_ht = '';
    // 倉庫でなければ
    if ($aThreadList->spmode != 'soko') {
        $shinchaku_num_ht = '';
        if ($shinchaku_num) {
            $shinchaku_num_ht = " (<span id=\"smynum{$new_matome_i_}\" class=\"matome_num\">{$shinchaku_num}</span>)";
        }
        $shinchaku_matome_ht = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_php'], array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'spmode' => $aThreadList->spmode, 'norefresh' => 1, 'nt' => date('gis'), UA::getQueryKey() => UA::getQueryValue())), '新着まとめ読み' . $shinchaku_num_ht, array('id' => "smy{$new_matome_i_}", 'class' => 'matome', 'onClick' => 'chNewAllColor();'));
    }
    return $shinchaku_matome_ht;
}
 /**
  * Categorize Incoming Request  
  * 
  * @access public
  * @return category of request, typically of the order M00X. 
  */
 public function determineCategory($userAgent = null, $defaultGrade = Grades::UNSUPPORTED)
 {
     $logger = $GLOBALS['logger'];
     $app = $GLOBALS['app'];
     $parsedUA = UA::parse($userAgent);
     if (!empty($app) && !$app->getConfiguration()->isLocal()) {
         try {
             $logger->info('Attempting device lookup in database');
             $browser = $this->_lookupDB($parsedUA);
             return $this->_computeCategory($browser);
         } catch (\Exception $ex) {
             $logger->info("No device database found, defaulting to local file based detection");
             $browser = $this->_lookupLocal($parsedUA, $defaultGrade);
             return $this->_computeCategory($browser);
         }
     } else {
         //$logger->info("Local environment, defaulting to local file based detection");
         $browser = $this->_lookupLocal($parsedUA, $defaultGrade);
         return $this->_computeCategory($browser);
     }
 }
Exemple #8
0
        } elseif ($r == 1) {
            $r_msg_ht = '1';
            // 完了
        }
    }
    // }}}
    // {{{ 書き込みフォームのオートセーブ(※これは使っていない。通信負荷を避けて、クッキーにまかせた)
} elseif ($cmd == 'auto_save_post_form') {
    // 未実装のテスト
    ob_start();
    var_dump($_POST);
    $r_msg = ob_get_clean();
    $r_msg_ht = hs($r_msg);
}
// }}}
if (UA::isSafariGroup()) {
    $r_msg_ht = mb_convert_encoding($r_msg_ht, 'UTF-8', 'SJIS-win');
}
// 結果出力
echo $xmldecTag;
echo $r_msg_ht;
/*
 * Local Variables:
 * mode: php
 * coding: cp932
 * tab-width: 4
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 */
// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker:
Exemple #9
0
/**
 * 設定ファイル編集ウインドウを開くHTMLを表示する
 *
 * @return  void
 */
function _printEditFileHtml($path_value, $submit_value)
{
    global $_conf;
    // アクティブ
    if (file_exists($path_value) && is_writable($path_value) || !file_exists($path_value) && is_writable(dirname($path_value))) {
        $onsubmit = '';
        $disabled = '';
        // 非アクティブ
    } else {
        $onsubmit = ' onsubmit="return false;"';
        $disabled = ' disabled';
    }
    $rows = 36;
    // 18
    $cols = 92;
    // 90
    // edit_aborn_word.php
    if (preg_match('/^p2_(aborn|ng)_(name|mail|id|msg)\\.txt$/', basename($path_value))) {
        $edit_php = 'edit_aborn_word.php';
        $target = '_self';
        $path_value = basename($path_value);
        $q_ar = array('path' => $path_value, UA::getQueryKey() => UA::getQueryValue());
        $url = $edit_php . '?' . UriUtil::buildQuery($q_ar);
        $html = P2View::tagA($url, $submit_value) . "\n";
        // editfile.php
    } else {
        $edit_php = 'editfile.php';
        $target = 'editfile';
        $html = <<<EOFORM
<form action="{$edit_php}" method="POST" target="{$target}" class="inline-form"{$onsubmit}>
\t{$_conf['k_input_ht']}
\t<input type="hidden" name="path" value="{$path_value}">
\t<input type="hidden" name="encode" value="Shift_JIS">
\t<input type="hidden" name="rows" value="{$rows}">
\t<input type="hidden" name="cols" value="{$cols}">
\t<input type="submit" value="{$submit_value}"{$disabled}>
</form>

EOFORM;
        // IE用にform HTML内のタグ間の空白を除去整形する
        if (strstr(geti($_SERVER['HTTP_USER_AGENT']), 'MSIE')) {
            $html = '&nbsp;' . preg_replace('{>\\s+<}', '><', $html);
        }
    }
    echo $html;
}
Exemple #10
0
    // PC用表示
} else {
    ?>
<hr>
<table id="footer" width="100%" style="padding:0px 10px 0px 0px;">
    <tr>
        <td align="right"><?php 
    echo $toolbar_ht;
    ?>
</td>
        <td align="right" style="padding-left:12px;"><a href="#header">▲</a></td>
    </tr>
</table>
<?php 
}
if (UA::isPC()) {
    ?>
</form><?php 
}
?>
</body></html>
<?php 
exit;
//===================================================================
// 関数(このファイル内でのみ利用)
//===================================================================
/*
 * Local Variables:
 * mode: php
 * coding: cp932
 * tab-width: 4
Exemple #11
0
 /**
  * 元スレURLを返す
  *
  * @access  public
  * @param   boolean  $original  携帯でも2chのスレURLを返す
  * @return  string  URL
  */
 function getMotoThread($original = false)
 {
     global $_conf;
     // 携帯カスタマイズ指定
     if ($_conf['ktai'] && !$original && $_conf['k_motothre_external']) {
         $motothre_url = $this->compileMobile2chUri();
         // まちBBS
     } elseif (P2Util::isHostMachiBbs($this->host)) {
         // PC
         if (!$_conf['ktai'] || $original) {
             /*
             $motothre_url = sprintf(
                 'http://%s/bbs/read.cgi?BBS=%s&KEY=%s',
                 $this->host, rawurlencode($this->bbs), rawurlencode($this->key)
             );
             */
             $motothre_url = "http://{$this->host}/bbs/read.cgi/{$this->bbs}/{$this->key}/{$this->ls}";
             // 携帯
         } else {
             $motothre_url = sprintf('http://%s/bbs/read.cgi?IMODE=TRUE&BBS=%s&KEY=%s', $this->host, rawurlencode($this->bbs), rawurlencode($this->key));
         }
         // まちびねっと
     } elseif (P2Util::isHostMachiBbsNet($this->host)) {
         $motothre_url = sprintf('http://%s/test/read.cgi?bbs=%s&key=%s', $this->host, rawurlencode($this->bbs), rawurlencode($this->key));
         // JBBSしたらば
     } elseif (P2Util::isHostJbbsShitaraba($this->host)) {
         $preg = '{(jbbs\\.shitaraba\\.com|jbbs\\.livedoor\\.com|jbbs\\.livedoor\\.jp)}';
         $host_bbs_cgi = preg_replace($preg, '$1/bbs/read.cgi', $this->host);
         $motothre_url = "http://{$host_bbs_cgi}/{$this->bbs}/{$this->key}/{$this->ls}";
         // $motothre_url = "http://{$this->host}/bbs/read.cgi?BBS={$this->bbs}&KEY={$this->key}";
         // 2ch系
     } elseif (P2Util::isHost2chs($this->host)) {
         // PC
         if (!UA::isK() || UA::isIPhoneGroup() || $original) {
             $motothre_url = "http://{$this->host}/test/read.cgi/{$this->bbs}/{$this->key}/{$this->ls}";
             // 携帯
         } else {
             // BBS PINK
             if (P2Util::isHostBbsPink($this->host)) {
                 // r.iはもう使われていない
                 //$motothre_url = "http://{$this->host}/test/r.i/{$this->bbs}/{$this->key}/{$this->ls}";
                 $motothre_url = "http://speedo.ula.cc/test/r.so/{$this->host}/{$this->bbs}/{$this->key}/{$this->ls}?guid=ON";
                 // 2ch(c.2ch)
             } else {
                 $motothre_url = $this->compileMobile2chUri();
             }
         }
         // その他
     } else {
         $motothre_url = "http://{$this->host}/test/read.cgi/{$this->bbs}/{$this->key}/{$this->ls}";
     }
     return $motothre_url;
 }
Exemple #12
0
 /**
  * ブラウザがiPhone, iPod Touch or Androidならtrueを返す
  */
 public static function isBrowserIphone()
 {
     return UA::isIPhoneGroup();
 }
Exemple #13
0
/**
 * 1- 101- 201- のリンクHTMLを取得する
 * _getHeadBarHtml() から呼ばれる
 *
 * @return  string  HTML
 */
function _getReadNaviRangeHtml($aThread, $rnum_range)
{
    global $_conf;
    static $cache_ = array();
    if (array_key_exists("{$aThread->host}/{$aThread->bbs}/{$aThread->key}", $cache_)) {
        return $cache_["{$aThread->host}/{$aThread->bbs}/{$aThread->key}"];
    }
    $read_navi_range_ht = '';
    for ($i = 1; $i <= $aThread->rescount; $i = $i + $rnum_range) {
        $ito = $i + $rnum_range - 1;
        $qs = array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'ls' => "{$i}-{$ito}", UA::getQueryKey() => UA::getQueryValue());
        if ($ito <= $aThread->gotnum) {
            $qs['offline'] = '1';
        }
        $url = UriUtil::buildQueryUri($_conf['read_php'], $qs);
        $read_navi_range_ht .= P2View::tagA($url, "{$i}-") . "\n";
    }
    return $cache_["{$aThread->host}/{$aThread->bbs}/{$aThread->key}"] = $read_navi_range_ht;
}
Exemple #14
0
/**
 * メニュー項目のリンクHTMLを取得する
 *
 * @access  private
 * @param   array   $menuKIni  メニュー項目 標準設定
 * @param   boolean $noLink    リンクをつけないのならtrue
 * @return  string  HTML
 */
function _getMenuKLinkHtml($code, $menuKIni, $noLink = false)
{
    global $_conf, $_login;
    static $accesskey_ = 0;
    // 無効なコード指定なら
    if (!isset($menuKIni[$code][0]) || !isset($menuKIni[$code][1])) {
        return false;
    }
    $accesskey = ++$accesskey_;
    if ($_conf['index_menu_k_from1']) {
        $accesskey = $accesskey + 1;
        if ($accesskey == 10) {
            $accesskey = 0;
        }
    }
    if ($accesskey > 9) {
        $accesskey = null;
    }
    $href = $menuKIni[$code][0] . '&user='******'&' . UA::getQueryKey() . '=' . UA::getQueryValue();
    $name = $menuKIni[$code][1];
    /*if (!is_null($accesskey)) {
          $name = $accesskey . '.' . $name;
      }*/
    if ($noLink) {
        $linkHtml = hs($name);
    } else {
        $accesskeyAt = is_null($accesskey) ? '' : " {$_conf['accesskey_for_k']}=\"{$accesskey}\"";
        $linkHtml = "<a href=\"" . hs($href) . '">' . hs($name) . "</a>";
    }
    // 特別 - #.ログ
    if ($code == 'res_hist') {
        $name = 'ログ';
        if ($noLink) {
            $logHt = hs($name);
        } else {
            $newtime = date('gis');
            $logHt = P2View::tagA(UriUtil::buildQueryUri('read_res_hist.php', array('nt' => $newtime, UA::getQueryKey() => UA::getQueryValue())), hs($name), array($_conf['accesskey_for_k'] => '#'));
        }
        $linkHtml .= ' </li><li>' . $logHt;
    }
    return $linkHtml;
}
Exemple #15
0
<?php

/**
 *  p2 書き込みフォーム
 */
// 携帯
if (UA::isK()) {
    $htm['k_br'] = '<br>';
    $htm['kakiko_on_js'] = '';
    // PC
} else {
    $htm['k_br'] = '';
    $htm['kakiko_on_js'] = ' onFocus="adjustTextareaRows(this, 2);" onKeyup="adjustTextareaRows(this, 2);' . " autoSavePostForm('{$host}', '{$bbs}', '{$key}');\"";
}
$htm['subject'] = isset($htm['subject']) ? $htm['subject'] : '';
$popup_hs = isset($popup) ? hs($popup) : '';
$newthread_hidden_ht = isset($newthread_hidden_ht) ? $newthread_hidden_ht : '';
$readnew_hidden_ht = isset($readnew_hidden_ht) ? $readnew_hidden_ht : '';
$ttitle_en_hs = hs($ttitle_en);
// 文字コード判定用文字列を先頭に仕込むことでmb_convert_variables()の自動判定を助ける
$htm['post_form'] = <<<EOP
<form id="resform" method="POST" action="{$_conf['post_php']}" accept-charset="{$_conf['accept_charset']}" onsubmit="disableSubmit(this)">
{$htm['resform_ttitle']}
{$htm['orig_msg']}

    <input type="hidden" name="detect_hint" value="◎◇">
    {$htm['subject']}
    {$htm['maru_kakiko']} 名前: <input id="FROM" name="FROM" type="text" value="{$hs['FROM']}"{$name_size_at}>{$htm['k_br']} 
     E-mail : <input id="mail" name="mail" type="text" value="{$hs['mail']}"{$mail_size_at}{$on_check_sage}>
    {$sage_cb_ht}{$htm['k_br']}
    <textarea id="MESSAGE" name="MESSAGE" rows="{$STYLE['post_msg_rows']}"{$msg_cols_at} wrap="{$wrap}"{$htm['kakiko_on_js']}>{$MESSAGE_hs}</textarea>{$htm['k_br']}
Exemple #16
0
/**
 * preview >>1
 *
 * @return  void  HTML出力
 */
function _printPreview1Html(&$aThread, $params)
{
    global $_conf, $STYLE, $_login;
    global $_filter_hits;
    // $res_filter
    extract($params);
    $aThread->ls = '1';
    // 必ずしも正確ではないが便宜的に
    if (!isset($aThread->rescount) and !empty($_GET['rc'])) {
        $aThread->rescount = intval($_GET['rc']);
        $aThread->lsToPoint();
    }
    $body = $aThread->previewOne();
    $ptitle_ht = hs($aThread->itaj) . ' / ' . hs($aThread->ttitle_hc);
    if (UA::isIPhoneGroup()) {
        $read_header_inc_php = P2_IPHONE_LIB_DIR . '/read_header_k.inc.php';
        $read_footer_inc_php = P2_IPHONE_LIB_DIR . '/read_footer_k.inc.php';
    } elseif (UA::isK()) {
        $read_header_inc_php = P2_LIB_DIR . '/read_header_k.inc.php';
        $read_footer_inc_php = P2_LIB_DIR . '/read_footer_k.inc.php';
    } else {
        $read_header_inc_php = P2_LIB_DIR . '/read_header.inc.php';
        $read_footer_inc_php = P2_LIB_DIR . '/read_footer.inc.php';
    }
    require_once $read_header_inc_php;
    echo $body;
    require_once $read_footer_inc_php;
}
Exemple #17
0
 /**
  * キャリア解析
  * @return void
  */
 private static function scanCarrier()
 {
     $UA = self::getUserAgent();
     if (strpos($UA, 'DoCoMo') !== false) {
         // DoCoMo
         self::$carrier = 'docomo';
     } elseif (strpos($UA, 'UP.Browser') !== false) {
         // au
         self::$carrier = 'au';
     } elseif (preg_match('/SoftBank|Vodafone|J-PHONE|SMOT/', $UA) === 1) {
         // SoftBank
         self::$carrier = 'softbank';
     } elseif (strpos($UA, 'WILLCOM') !== false) {
         // WILLCOM
         self::$carrier = 'willcom';
     } elseif (strpos($UA, 'emobile') !== false) {
         // eモバイル
         self::$carrier = 'emobile';
     } else {
         // 不明
         self::$carrier = 'unknown';
     }
 }
Exemple #18
0
/**
 * @return  string  <a>
 */
function _getDatSokoATag($aThreadList)
{
    global $_conf;
    $dat_soko_atag = '';
    if (!$aThreadList->spmode or $aThreadList->spmode == 'taborn') {
        $uri = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'norefresh' => '1', 'spmode' => 'soko', UA::getQueryKey() => UA::getQueryValue()));
        $dat_soko_atag = P2View::tagA($uri, hs('dat倉庫'));
    }
    return $dat_soko_atag;
}
Exemple #19
0
EOP;
}
?>
</table>
<a class='whiteButton' href="<?php 
eh($_SERVER['SCRIPT_NAME']);
?>
?setdef=1<?php 
echo $_conf['k_at_a'];
?>
">デフォルトに戻す</a>
</filedset>
</div>
<?php 
// フッタHTMLを表示する
if (UA::isK() && !UA::isIPhoneGroup()) {
    echo $hr . P2View::getBackToIndexKATag();
}
?>
</body></html><?php 
exit;
//======================================================================
// 関数(このファイル内でのみ利用)
//======================================================================
/**
 * 携帯TOPメニューの順番を変更する関数
 *
 * @access  public
 * @param   string  $code
 * @param   string  $set  top, up, down, bottom
 * @return  boolean
Exemple #20
0
<meta name="format-detection" content="telephone=no">
<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png">
<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}">
<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script>
EOS;
    }
    // endswitch
    // 強制iPhoneビュー時
} elseif ($_conf['iphone']) {
    $_conf['extra_headers_ht'] .= <<<EOS
<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}">
<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script>
EOS;
}
// AndroidではJavaScript-XPathを使う
if ($_conf['iphone'] && UA::isAndroidWebKit()) {
    $_conf['extra_headers_ht'] .= <<<EOS
<script type="text/javascript">window.jsxpath = { 'useNative': false };</script>
<script type="text/javascript" src="js/javascript-xpath.js?{$_conf['p2_version_id']}"></script>
EOS;
}
// iPhone用スキン
if ($_conf['iphone'] && isset($_conf['expack.iphone.skin'])) {
    if (strpos($_conf['expack.iphone.skin'], DIRECTORY_SEPARATOR) === false) {
        $iskin = 'skin/iphone/' . $iskin . '.css';
        if (file_exists($iskin)) {
            $iskin_mtime = filemtime($iskin);
            $_conf['extra_headers_ht'] .= <<<EOS
<link rel="stylesheet" type="text/css" media="screen" href="{$iskin}?{$iskin_mtime}">
EOS;
        }
Exemple #21
0
/**
 * @return  string  HTML
 */
function _getReadATag($aThread)
{
    global $_conf;
    $ttitle_hs = hs($aThread->ttitle_hc);
    if ($_conf['k_save_packet']) {
        $ttitle_hs = mb_convert_kana($ttitle_hs, 'rnsk');
    }
    return $read_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'offline' => '1', 'rescount' => $aThread->rescount, UA::getQueryKey() => UA::getQueryValue())) . '#r' . rawurlencode($aThread->rescount), $ttitle_hs);
}
Exemple #22
0
/**
 * @return  string  HTML
 */
function _getOffRecentATag($aThread, $offrecent_accesskey, $ttitle_en)
{
    global $_conf;
    $preKey = '';
    if (UA::isK() && $offrecent_accesskey) {
        $preKey = $offrecent_accesskey . '.';
    }
    return P2View::tagA(UriUtil::buildQueryUri('info_i.php', array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'offrecent' => '1', 'popup' => (int) (bool) geti($_GET['popup']), 'ttitle_en' => $ttitle_en, UA::getQueryKey() => UA::getQueryValue())), sprintf('%s履歴から外す', hs($preKey)), array('title' => 'このスレを「最近読んだスレ」と「書き込み履歴」から外します', 'accesskey' => $offrecent_accesskey));
}
Exemple #23
0
// p2 -  サブジェクト - 携帯ヘッダ表示
// for subject.php
//===============================================================
// HTML表示用変数
//===============================================================
$newtime = date("gis");
// {{{ ページタイトル部分URL設定
$p2_subject_url = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, UA::getQueryKey() => UA::getQueryValue()));
$ptitle_url = null;
// あぼーん or 倉庫
if ($aThreadList->spmode == 'taborn' or $aThreadList->spmode == 'soko') {
    $ptitle_url = $p2_subject_url;
    // 書き込み履歴
} elseif ($aThreadList->spmode == 'res_hist') {
    $ptitle_url = UriUtil::buildQueryUri('read_res_hist.php', array(UA::getQueryKey() => UA::getQueryValue()));
    // 通常 板
} elseif (!$aThreadList->spmode) {
    // 特別なパターン index2.html
    // match登録よりheadなげて聞いたほうがよさそうだが、ワンレスポンス増えるのが困る
    if (preg_match('/www\\.onpuch\\.jp/', $aThreadList->host)) {
        $ptitle_url = $ptitle_url . 'index2.html';
    } elseif (preg_match("/livesoccer\\.net/", $aThreadList->host)) {
        $ptitle_url = $ptitle_url . 'index2.html';
        // PC
    } elseif (empty($_conf['ktai'])) {
        $ptitle_url = "http://{$aThreadList->host}/{$aThreadList->bbs}/i/";
        // 携帯
    } else {
        if (!empty($GLOBALS['word']) || !empty($GLOBALS['wakati_words'])) {
            $ptitle_url = $p2_subject_url;
Exemple #24
0
echo $_conf['p2_version_id'];
?>
" />
    <?php 
echo $_conf['touch_icon_ht'];
?>
    <script type="text/javascript" src="iui/iui.js?<?php 
echo $_conf['p2_version_id'];
?>
"></script>
    <script type="text/javascript" src="js/json2.js?<?php 
echo $_conf['p2_version_id'];
?>
"></script>
<?php 
if (UA::isAndroidWebKit()) {
    ?>
    <script type="text/javascript">window.jsxpath = { 'useNative': false };</script>
    <script type="text/javascript" src="js/javascript-xpath.js?<?php 
    echo $_conf['p2_version_id'];
    ?>
"></script>
<?php 
}
?>
    <script type="text/javascript" src="js/iphone.js?<?php 
echo $_conf['p2_version_id'];
?>
"></script>
    <script type="text/javascript" src="js/menu_i.js?<?php 
echo $_conf['p2_version_id'];
Exemple #25
0
  / / / | | '_ \|  _/ _ \  \__ \ '_ ` _ \ / _ \
 / / /  | | | | | || (_) | (   / | | | | |  __/
/_/_/   |_|_| |_|_| \___/   |_||_| |_| |_|\___|
      </pre>
			script written by heiswayi nrird
			</div>
			
			
			<div id="output">

<table class="info"><tbody>

<?php 
// required functions
require "UAParser.php";
$ua = UA::parse();
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $iplocal = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
    $iplocal = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
    $iplocal = $_SERVER['REMOTE_ADDR'];
}
$file = file_get_contents('http://ip6.me/');
$pos = strpos($file, '+3') + 3;
$ip = substr($file, $pos, strlen($file));
$pos = strpos($ip, '</');
$ip = substr($ip, 0, $pos);
// display data
echo '<tr><td class="label">web_browser:</td><td>' . $ua->browserFull . '</td></tr>';
echo '<tr><td class="label">operating_system:</td><td>' . $ua->osFull . '</td></tr>';
Exemple #26
0
 * Copyright (c) 2011-2012 Dave Olsen, http://dmolsen.com
 * Licensed under the MIT license
 */
// include the ua-parser-php library to rip apart user agent strings
require __DIR__ . "/../lib/ua-parser-php/UAParser.php";
if ($uaListJSON = @file_get_contents(__DIR__ . "/../user-agents/core/ua.list.json")) {
    $uaList = (array) json_decode($uaListJSON);
    asort($uaList);
    foreach ($uaList as $key => $value) {
        $file = __DIR__ . "/../user-agents/core/ua." . $key . ".json";
        if (!isset($ua->device)) {
            $uaItemJSON = @file_get_contents($file);
            $uaJSON = json_decode($uaItemJSON);
            unset($uaJSON->deviceOSGeneral);
            unset($uaJSON->deviceOSSpecific);
            unset($uaJSON->majorVersion);
            unset($uaJSON->minorVersion);
            unset($uaJSON->isTablet);
            unset($uaJSON->isMobile);
            unset($uaJSON->isComputer);
            unset($uaJSON->isSpider);
            unset($uaJSON->iOSUIWebview);
            $userAgent = UA::parse($uaJSON->ua);
            $updatedInfo = (object) array_merge((array) $uaJSON, (array) $userAgent);
            $updatedInfo = json_encode($updatedInfo);
            $fp = fopen($file, "w");
            fwrite($fp, $updatedInfo);
            fclose($fp);
        }
    }
}
Exemple #27
0
 /**
  * IDフィルタリングリンク変換
  *
  * @access  private
  * @return  string  HTML
  */
 function idfilter_callback($s)
 {
     global $_conf;
     $idstr = $s[0];
     // ID:xxxxxxxxxx
     $id = $s[1];
     // xxxxxxxxxx
     $idflag = '';
     // 携帯/PC識別子
     // IDは8桁または10桁(+携帯/PC識別子)と仮定して
     /*
     if (strlen($id) % 2 == 1) {
         $id = substr($id, 0, -1);
         $idflag = substr($id, -1);
     } elseif (isset($s[2])) {
         $idflag = $s[2];
     }
     */
     if (isset($this->thread->idcount[$id]) && $this->thread->idcount[$id] > 0) {
         $filter_url = UriUtil::buildQueryUri($_conf['read_php'], array('host' => $this->thread->host, 'bbs' => $this->thread->bbs, 'key' => $this->thread->key, 'ls' => 'all', 'offline' => '1', 'idpopup' => '1', 'field' => 'id', 'method' => 'just', 'match' => 'on', 'word' => $id, UA::getQueryKey() => UA::getQueryValue()));
         $num_ht = sprintf('(<a href="%s">%s</a>)', hs($filter_url), $this->thread->idcount[$id]);
         return "{$idstr}{$num_ht}";
     }
     return $idstr;
 }
Exemple #28
0
/**
 * クライアントの種類を返す
 *
 * @param void
 * @return string
 */
function _toolbar_i_client_type()
{
    global $_conf;
    switch ($_conf['client_type']) {
        case 'i':
            $type = UA::isAndroidWebKit() ? 'android' : 'iphone';
            break;
        case 'i':
            $type = 'mobile';
            break;
        case 'pc':
        default:
            $type = 'other';
    }
    return $type;
}
Exemple #29
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 
}
Exemple #30
0
    /**
     * お気に板をHTML表示する for 携帯
     *
     * @access  public
     * @return  void
     */
    function printFavItaHtml()
    {
        global $_conf;
        $csrfid = P2Util::getCsrfId();
        $hr = P2View::getHrHtmlK();
        $show_flag = false;
        if (file_exists($_conf['favita_path']) and $lines = file($_conf['favita_path'])) {
            echo 'お気に板 [<a href="editfavita.php?b=k">編集</a>]' . $hr;
            $i = 0;
            foreach ($lines as $l) {
                $i++;
                $l = rtrim($l);
                if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", $l, $matches)) {
                    $itaj = rtrim($matches[3]);
                    $attr = array();
                    $key_num_st = '';
                    if ($i <= 9) {
                        $attr[$_conf['accesskey_for_k']] = $i;
                        $key_num_st = "{$i}.";
                    }
                    $atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $matches[1], 'bbs' => $matches[2], 'itaj_en' => base64_encode($itaj), UA::getQueryKey() => UA::getQueryValue())), UA::isIPhoneGroup() ? hs($itaj) : hs("{$key_num_st}{$itaj}"), $attr);
                    if (UA::isIPhoneGroup()) {
                        echo '<li>' . $atag . '</li>';
                    } else {
                        echo $atag . '<br>';
                    }
                    //  [<a href="{$_SERVER['SCRIPT_NAME']}?host={$matches[1]}&amp;bbs={$matches[2]}&amp;setfavita=0&amp;csrfid={$csrfid}&amp;view=favita{$_conf['k_at_a']}">削</a>]
                    $show_flag = true;
                }
            }
            if (UA::isIPhoneGroup()) {
                ?>
</ul><?php 
            }
        }
        if (!$show_flag) {
            ?>
<p>お気に板はまだないようだ</p><?php 
        }
    }