Ejemplo n.º 1
0
<?php

/**
 * rep2 - ログイン
 */
require_once './conf/conf.inc.php';
$_login->authorize();
// ユーザ認証
$csrfid = P2Util::getCsrfId(__FILE__);
//=========================================================
// 書き出し用変数
//=========================================================
$p_htm = array();
// 表示文字
$p_str = array('ptitle' => 'rep2認証ユーザ管理', 'autho_user' => '認証ユーザ', 'logout' => 'ログアウト', 'password' => 'パスワード', 'login' => 'ログイン', 'user' => 'ユーザ');
// 携帯用表示文字列変換
if ($_conf['ktai'] && function_exists('mb_convert_kana')) {
    foreach ($p_str as $k => $v) {
        $p_str[$k] = mb_convert_kana($v, 'rnsk');
    }
}
// (携帯)ログイン用URL
//$user_u_q = $_conf['ktai'] ? "?user={$_login->user_u}" : '';
//$url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/' . $user_u_q . '&amp;b=k';
$url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/?b=k';
$p_htm['ktai_url'] = '携帯' . $p_str['login'] . '用URL <a href="' . $url . '" target="_blank">' . $url . '</a><br>';
//====================================================
// ユーザ登録処理
//====================================================
if (isset($_POST['form_new_login_pass'])) {
    if (!isset($_POST['csrfid']) or $_POST['csrfid'] != $csrfid) {
Ejemplo n.º 2
0
<?php

/**
 * rep2 - あぼーんワード編集インタフェース
 */
require_once './conf/conf.inc.php';
$_login->authorize();
// ユーザ認証
$filename = isset($_REQUEST['file']) ? $_REQUEST['file'] : '';
$csrfid = P2Util::getCsrfId(__FILE__ . $filename);
if (!empty($_POST['submit_save']) || !empty($_POST['submit_default'])) {
    if (!isset($_POST['csrfid']) or $_POST['csrfid'] != $csrfid) {
        p2die('不正なポストです');
    }
}
$writable_files = array('p2_aborn_thread.txt' => 'あぼーんスレッドタイトル', 'p2_aborn_name.txt' => 'あぼーんネーム', 'p2_aborn_mail.txt' => 'あぼーんメール', 'p2_aborn_msg.txt' => 'あぼーんメッセージ', 'p2_aborn_id.txt' => 'あぼーんID', 'p2_ng_name.txt' => 'NGネーム', 'p2_ng_mail.txt' => 'NGメール', 'p2_ng_msg.txt' => 'NGメッセージ', 'p2_ng_id.txt' => 'NGID');
if (!array_key_exists($filename, $writable_files)) {
    $files_st = implode(', ', array_keys($writable_files));
    p2die(basename($_SERVER['SCRIPT_NAME']) . " 先生の書き込めるファイルは、{$files_st} だけ!");
}
$path = $_conf['pref_dir'] . DIRECTORY_SEPARATOR . $filename;
//=====================================================================
// 前処理
//=====================================================================
// {{{ ■保存ボタンが押されていたら、設定を保存
if (!empty($_POST['submit_save'])) {
    $newdata = '';
    foreach ($_POST['nga'] as $na_info) {
        $a_word = strtr(trim($na_info['word'], "\t\r\n"), "\t\r\n", "   ");
        $a_bbs = strtr(trim($na_info['bbs'], "\t\r\n"), "\t\r\n", "   ");
        $a_tt = strtr(trim($na_info['tt'], "\t\r\n"), "\t\r\n", "   ");
Ejemplo n.º 3
0
    if (!empty($_POST['submit_default'])) {
        if (@$linkPlugin->clear()) {
            $_info_msg_ht .= "<p>○リストを空にしました</p>";
        } else {
            $_info_msg_ht .= "<p>×リストを空にできませんでした</p>";
        }
    }
}
// リスト読み込み
$formdata = $linkPlugin->load();
//=====================================================================
// プリント設定
//=====================================================================
$ptitle_top = 'リンクプラグイン編集';
$ptitle = strip_tags($ptitle_top);
$csrfid = P2Util::getCsrfId();
//=====================================================================
// プリント
//=====================================================================
// ヘッダ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>
Ejemplo n.º 4
0
/**
 * ImageCache2 - 下書き保存する
 */
// {{{ p2基本設定読み込み&認証
require_once './conf/conf.inc.php';
$_login->authorize();
// 引数エラー
if (empty($_POST['host'])) {
    // 引数の指定が変です
    echo 'null';
    exit;
}
$el = error_reporting(E_ALL & ~E_NOTICE);
$salt = 'post' . $_POST['host'] . $_POST['bbs'] . $_POST['key'];
error_reporting($el);
if (!isset($_POST['csrfid']) or $_POST['csrfid'] != P2Util::getCsrfId($salt)) {
    // 不正なポストです
    echo 'null';
    exit;
}
// }}}
// {{{ HTTPヘッダ
P2Util::header_nocache();
header('Content-Type: text/plain; charset=UTF-8');
// }}}
// {{{ 初期化
$post_param_keys = array('bbs', 'key', 'time', 'FROM', 'mail', 'MESSAGE', 'subject', 'submit');
$post_internal_keys = array('host', 'sub', 'popup', 'rescount', 'ttitle_en');
foreach ($post_param_keys as $pk) {
    ${$pk} = isset($_POST[$pk]) ? mb_convert_encoding($_POST[$pk], 'CP932', 'UTF-8') : '';
}
Ejemplo n.º 5
0
Archivo: login.php Proyecto: poppen/p2
/**
 * パスワード変更登録処理
 *
 * @return  void or P2Util::pushInfoHtml() or die
 */
function _preExecChangePass()
{
    global $_login;
    if (isset($_POST['form_login_pass'])) {
        // 入力チェック
        if (!isset($_POST['csrfid']) || $_POST['csrfid'] != P2Util::getCsrfId()) {
            P2Util::pushInfoHtml('<p>p2 error: 不正なPOSTです</p>');
        } elseif (!preg_match('/^[0-9a-zA-Z_]+$/', $_POST['form_login_pass'])) {
            P2Util::pushInfoHtml('<p>p2 error: パスワードを半角英数字で入力して下さい。</p>');
            // パスワード変更登録処理を行う
        } else {
            if (!$_login->savaRegistUserPass($_login->user_u, $_POST['form_login_pass'])) {
                p2die('ユーザ登録処理を完了できませんでした。');
            }
            P2Util::pushInfoHtml('<p>○認証パスワードを変更登録しました</p>');
        }
    }
}
Ejemplo n.º 6
0
/**
 * 書き込んだレスの削除
 */
function _clearResHistLogByQuery()
{
    if (!empty($_GET['clear_res_hist_log'])) {
        /*
        $atag = P2View::tagA(
            UriUtil::buildQueryUri(
                basename($_SERVER['SCRIPT_NAME']),
                array(
                    'do_clear_res_hist_log' => 1,
                    'csrfid' => P2Util::getCsrfId(),
                    UA::getQueryKey() => UA::getQueryValue()
                )
            ),
            hs('はい、削除します')
        );
        */
        P2Util::pushInfoHtml(sprintf('<form method="POST" action="%s">
                 <input type="hidden" name="do_clear_res_hist_log" value="1">
                 <input type="hidden" name="csrfid" value="%s">
                 <input type="hidden" name="%s" value="%s">
                 確認:本当に書き込んだレスのログを全て削除しても、よろしいですか?
                 <input type="submit" name="submit" value="はい、削除します">
                 </form>', hs(basename($_SERVER['SCRIPT_NAME'])), hs(P2Util::getCsrfId()), hs(UA::getQueryKey()), hs(UA::getQueryValue())));
    } elseif (!empty($_POST['do_clear_res_hist_log'])) {
        if (!isset($_POST['csrfid']) or $_POST['csrfid'] != P2Util::getCsrfId()) {
            P2Util::pushInfoHtml('p2 error: 不正なクエリーです(CSRF対策)');
        } else {
            require_once P2_LIB_DIR . '/' . 'read_res_hist.funcs.php';
            if (deleteResHistDat()) {
                P2Util::pushInfoHtml('<p>p2 info: ○書き込んだレスのログを削除しました</p>');
            } else {
                P2Util::pushInfoHtml('<p>p2 error: ×書き込んだレスのログを削除できませんでした</p>');
            }
        }
    }
}
Ejemplo n.º 7
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 
        }
    }
Ejemplo n.º 8
0
    /**
     * お気に板をHTML表示する
     *
     * @access  public
     * @return  void
     */
    function printFavItaHtml()
    {
        global $_conf, $matome_i, $STYLE;
        // favita読み込み
        $favitas = array();
        if (file_exists($_conf['favita_path'])) {
            if ($lines = file($_conf['favita_path'])) {
                foreach ($lines as $l) {
                    if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", trim($l), $matches)) {
                        $favitas[] = array('host' => $matches[1], 'bbs' => $matches[2], 'itaj' => $matches[3]);
                    }
                }
            }
        }
        // 空っぽなら
        if (!$favitas) {
            echo <<<EOP
    <div class="menu_cate"><b>お気に板</b> [<a href="editfavita.php" target="subject">編集</a>]<br>
        <div class="itas" id="c_favita">(空っぽ)</div>
    </div>
EOP;
            return;
        }
        // 新着数を表示する場合・まとめてプリフェッチ
        if ($_conf['enable_menu_new'] && !empty($_GET['shownew'])) {
            if ($_conf['expack.use_pecl_http'] == 1) {
                require_once P2_LIB_DIR . '/P2HttpExt.php';
                P2HttpRequestPool::fetchSubjectTxt($favitas);
                $GLOBALS['expack.subject.multi-threaded-download.done'] = true;
            }
        }
        $csrfid = P2Util::getCsrfId();
        echo <<<EOP
<div class="menu_cate"><b><a class="menu_cate" href="javascript:void(0);" onClick="showHide('c_favita', 'itas_hide');" target="_self">お気に板</a></b> [<a href="editfavita.php" target="subject">編集</a>]<br>
    <div class="itas" id="c_favita">
EOP;
        foreach ($favitas as $favita) {
            extract($favita);
            // $host, $bbs, $itaj
            $itaj_en = base64_encode($itaj);
            $uri = UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'setfavita' => '0', 'csrfid' => $csrfid));
            $star_atag = P2View::tagA($uri, '★', array('target' => '_self', 'class' => 'fav', 'title' => "「{$itaj}」をお気に板から外す", 'onClick' => "return confirmSetFavIta('" . str_replace(array("\\", "'"), array("\\\\", "\\'"), $itaj) . "');"));
            // 新着数を表示する場合
            if ($_conf['enable_menu_new'] && !empty($_GET['shownew'])) {
                $matome_i++;
                // $host, $bbs
                $spmode = '';
                $shinchaku_num = 0;
                $_newthre_num = 0;
                include './subject_new.php';
                // $shinchaku_num, $_newthre_num がセットされる
                $newthre_ht = '';
                if ($_newthre_num) {
                    $newthre_ht = "{$_newthre_num}";
                }
                $subject_uri = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en));
                $subject_atag = P2View::tagA($subject_uri, hs($itaj), array('onClick' => "chMenuColor('{$matome_i}');"));
                $read_new_uri = UriUtil::buildQueryUri($_conf['read_new_php'], array('host' => $host, 'bbs' => $bbs));
                $read_new_attr = array('target' => 'read', 'id' => "un{$matome_i}", 'onClick' => "chUnColor('{$matome_i}');");
                if ($shinchaku_num > 0) {
                    $read_new_attr['class'] = 'newres_num';
                } else {
                    $read_new_attr['class'] = 'newres_num_zero';
                }
                $read_new_atag = P2View::tagA($read_new_uri, hs($shinchaku_num), $read_new_attr);
                echo <<<EOP
        {$star_atag} {$subject_atag} <span id="newthre{$matome_i}" class="newthre_num">{$newthre_ht}</span> ({$read_new_atag})<br>
EOP;
                // 新着数を表示しない場合
            } else {
                $subject_uri = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en));
                $subject_atag = P2View::tagA($subject_uri, hs($itaj));
                echo "{$star_atag} {$subject_atag}<br>";
            }
            ob_flush();
            flush();
        }
        // foreach
        echo "    </div>\n";
        echo "</div>\n";
    }
Ejemplo n.º 9
0
 /**
  * 公式p2からdatを取得する際に使うCSRF防止トークンを生成する
  *
  * @param void
  * @return string
  */
 protected function _getCsrfIdForMoritapoDat()
 {
     return P2Util::getCsrfId('moritapodat' . $this->host . $this->bbs . $this->key);
 }
Ejemplo n.º 10
0
<?php

/**
 * rep2 - レス書き込みフォームの機能読み込み
 */
$js = array();
$fake_time = -10;
// time を10分前に偽装
$time = time() - 9 * 60 * 60;
$time = $time + $fake_time * 60;
$csrfid = P2Util::getCsrfId('post' . $host . $bbs . $key);
$hd['FROM'] = '';
$hd['mail'] = '';
$hd['MESSAGE'] = '';
$hd['subject'] = '';
$hd['beres_checked'] = '';
$hd['p2res_checked'] = '';
$htm['beres'] = '';
$htm['p2res'] = '';
$htm['sage_cb'] = '';
$htm['maru_post'] = '';
$htm['block_submit'] = '';
$htm['src_fix'] = '';
$htm['options'] = '';
$htm['options_k'] = '';
$htm['subject'] = '';
$htm['resform_ttitle'] = '';
$htm['disable_js'] = <<<EOP
<script type="text/javascript">
//<![CDATA[
// Thanks naoya <http://d.hatena.ne.jp/naoya/20050804/1123152230>
Ejemplo n.º 11
0
/**
 * @return  void  HTML出力
 */
function _printEditSortTrHtml($host, $bbs, $itaj)
{
    global $_conf;
    $itaj_en = base64_encode($itaj);
    ?>
    <tr>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $host, 'bbs' => $bbs, UA::getQueryKey() => UA::getQueryValue())), hs($itaj), array('title' => "{$host}/{$bbs}"));
    ?>
    </td>
    <td>[ 
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'top', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('▲'), array('class' => 'te', 'title' => '一番上に移動'));
    ?>
    </td>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'up', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('↑'), array('class' => 'te', 'title' => '一つ上に移動'));
    ?>
    </td>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'down', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('↓'), array('class' => 'te', 'title' => '一つ下に移動'));
    ?>
    </td>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'bottom', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('▼'), array('class' => 'te', 'title' => '一番下に移動'));
    ?>
     ]</td>
    <td>[<?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'setfavita' => '0', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('削除'), array('title' => '削除'));
    ?>
]</td>
    </tr>
    <?php 
}