Ejemplo n.º 1
0
/**
 * p2 - 携帯用インデックスをHTMLプリントする関数
 *
 * @access  public
 * @return  void
 */
function index_print_k()
{
    global $_conf, $_login;
    $menuKLinkHtmls = getIndexMenuKLinkHtmls(getIndexMenuKIni());
    $ptitle = $_conf['p2name'] . 'iPhone';
    // ログインユーザ情報
    $auth_user_ht = sprintf('<p>ログインユーザ: %s - %s</p>', hs($_login->user_u), date('Y/m/d (D) G:i:s'));
    // p2ログイン用URL
    $login_url = rtrim(dirname(UriUtil::getMyUri()), '/') . '/';
    $login_url_pc = UriUtil::buildQueryUri($login_url, array(UA::getQueryKey() => 'pc'));
    $login_url_k = UriUtil::buildQueryUri($login_url, array(UA::getQueryKey() => 'k', 'user' => $_login->user_u));
    // 前回のログイン情報
    if ($_conf['login_log_rec'] && $_conf['last_login_log_show']) {
        if (false !== ($log = P2Util::getLastAccessLog($_conf['login_log_file']))) {
            $log_hs = array_map('htmlspecialchars', $log);
            $htm['last_login'] = <<<EOP
<font color="#888888">
前回のログイン情報 - {$log_hs['date']}<br>
ユーザ:   {$log_hs['user']}<br>
IP:     {$log_hs['ip']}<br>
HOST:   {$log_hs['host']}<br>
UA:     {$log_hs['ua']}<br>
REFERER: {$log_hs['referer']}
</font>
EOP;
        }
    }
    // 古いセッションIDがキャッシュされていることを考慮して、ユーザ情報を付加しておく
    // (リファラを考慮して、つけないほうがいい場合もあるので注意)
    $narabikae_uri = UriUtil::buildQueryUri('edit_indexmenui.php', array('user' => $_login->user_u, UA::getQueryKey() => UA::getQueryValue()));
    require_once P2_LIB_DIR . '/BrdCtl.php';
    $search_form_htm = BrdCtl::getMenuKSearchFormHtml('menu_i.php');
    $body_at = P2View::getBodyAttrK();
    $hr = P2View::getHrHtmlK();
    //=========================================================
    // 携帯用 HTML出力
    //=========================================================
    P2Util::headerNoCache();
    P2View::printDoctypeTag();
    ?>
<html>
<head>
<?php 
    P2View::printExtraHeadersHtml();
    ?>
<script type="text/javascript"> 
<!-- 
window.onload = function() { 
setTimeout(scrollTo, 100, 0, 1); 
} 
// --> 
</script> 
<style type="text/css" media="screen">@import "./iui/iui.css";</style>
    <title><?php 
    eh($ptitle);
    ?>
</title>
</head>
<body>
    <div class="toolbar">
<h1 id="pageTitle"><?php 
    eh($ptitle);
    ?>
</h1>
    <a class="button" href="<?php 
    eh($narabikae_uri);
    ?>
">並替</a>
    </div>
    <ul id="home">
    <li class="group">メニュー</li>
<?php 
    P2Util::printInfoHtml();
    foreach ($menuKLinkHtmls as $v) {
        ?>
<li><?php 
        echo $v;
        ?>
</li><?php 
    }
    ?>
<li class="group">検索</li>
<?php 
    echo $search_form_htm;
    ?>
</ul>
<br>
</body>
</html>
<?php 
}
Ejemplo n.º 2
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.º 3
0
</filedset></div>

EOP;
} else {
    $filter_form_ht = '';
}
// 検索結果
if (!empty($GLOBALS['sb_mikke_num'])) {
    $hit_ht = "<div class=\"panel\"><h2>\"{$word}\" {$GLOBALS['sb_mikke_num']}hit!</h2></div>";
} else {
    $hit_ht = '';
}
//=================================================
// ヘッダHTMLをプリント
//=================================================
P2Util::headerNoCache();
P2View::printDoctypeTag();
?>
<html>
<head>
<?php 
P2View::printExtraHeadersHtml();
?>
<style type="text/css" media="screen">@import "./iui/iui.css";</style>
<script type="text/javascript" src="iphone/js/setfavjs.iphone.js?v=20061206"></script>
	<script type="text/javascript" src="js/basic.js?v=20090429"></script>

<script type="text/javascript"> 
<!-- 
window.onload = function() { 
setTimeout(scrollTo, 100, 0, 1);