예제 #1
0
파일: cookie.php 프로젝트: poppen/p2
/**
 * @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);
}
예제 #2
0
/**
 * スレを殿堂入りにセットする関数
 *
 * $set は、0(解除), 1(追加), top, up, down, bottom
 *
 * @access  public
 * @return  boolean
 */
function setPalace($host, $bbs, $key, $set)
{
    global $_conf;
    $idxfile = P2Util::getKeyIdxFilePath($host, $bbs, $key);
    // 既に key.idx データがあるなら読み込む
    if (file_exists($idxfile) and $lines = file($idxfile)) {
        $l = rtrim($lines[0]);
        $data = explode('<>', $l);
    }
    if (false === FileCtl::make_datafile($_conf['palace_file'], $_conf['palace_perm'])) {
        return false;
    }
    if (false === ($pallines = file($_conf['palace_file']))) {
        return false;
    }
    $newlines = array();
    $before_line_num = 0;
    // {{{ 最初に重複要素を削除しておく
    if (!empty($pallines)) {
        $i = -1;
        foreach ($pallines as $l) {
            $i++;
            $l = rtrim($l);
            $lar = explode('<>', $l);
            // 重複回避
            if ($lar[1] == $key && $lar[11] == $bbs) {
                $before_line_num = $i;
                // 移動前の行番号をセット
                continue;
                // keyのないものは不正データなのでスキップ
            } elseif (!$lar[1]) {
                continue;
            } else {
                $newlines[] = $l;
            }
        }
    }
    // }}}
    if (!empty($GLOBALS['brazil'])) {
        //$newlines = _removeLargePallistData($newlines);
    }
    // 新規データ設定
    if ($set) {
        $newdata = implode('<>', array(geti($data[0]), $key, geti($data[2]), geti($data[3]), geti($data[4]), geti($data[5]), geti($data[6]), geti($data[7]), geti($data[8]), geti($data[9]), $host, $bbs));
        require_once P2_LIB_DIR . '/getSetPosLines.func.php';
        $rec_lines = getSetPosLines($newlines, $newdata, $before_line_num, $set);
    } else {
        $rec_lines = $newlines;
    }
    if (false === FileCtl::filePutRename($_conf['palace_file'], $rec_lines ? implode("\n", $rec_lines) . "\n" : '')) {
        trigger_error(sprintf('p2 error: %s(), FileCtl::filePutRename() failed.', __FUNCTION__), E_USER_WARNING);
        return false;
    }
    return true;
}
예제 #3
0
파일: menu_i.php 프로젝트: poppen/p2
}
// }}}
// カテゴリをHTML表示
if ($get['view'] == 'cate' or isset($_REQUEST['word']) && !strlen($GLOBALS['word'])) {
    //echo "板リスト{$hr}";
    if ($brd_menus) {
        foreach ($brd_menus as $a_brd_menu) {
            $aShowBrdMenuK->printCate($a_brd_menu->categories);
        }
    }
}
// カテゴリの板をHTML表示
if (isset($_GET['cateid'])) {
    if ($brd_menus) {
        foreach ($brd_menus as $a_brd_menu) {
            $aShowBrdMenuK->printIta($a_brd_menu->categories);
        }
    }
    $modori_url_ht = P2View::tagA(UriUtil::buildQueryUri($_conf['menu_k_php'], array('view' => 'cate', 'nr' => '1', UA::getQueryKey() => UA::getQueryValue())), '板リスト') . '<br>';
}
P2Util::printInfoHtml();
// フッタをHTML表示
echo geti($GLOBALS['list_navi_ht']);
?>
<p><a id="backButton"class="button" href="<?php 
eh($index_uri);
?>
">TOP</a></p>
</body></html>
<?php 
exit;
예제 #4
0
파일: read_filter.php 프로젝트: poppen/p2
define('P2_READ_FILTER_WRAPPER', 1);
require_once './conf/conf.inc.php';
require_once P2_LIB_DIR . '/Thread.php';
require_once P2_LIB_DIR . '/ThreadRead.php';
$_login->authorize();
// ユーザ認証
//=====================================================
// 変数の設定
//=====================================================
$host = geti($_GET['host']);
$bbs = geti($_GET['bbs']);
$key = geti($_GET['key']);
$rc = geti($_GET['rc']);
$ttitle_en = geti($_GET['ttitle_en']);
$resnum = geti($_GET['resnum']);
$field = geti($_GET['field']);
$itaj = P2Util::getItaName($host, $bbs);
if (!$itaj) {
    $itaj = $bbs;
}
$ttitle_name = base64_decode($ttitle_en);
$GLOBALS['popup_filter'] = 1;
// 対象レスの対象フィールドから、検索ワードを取得する
$_GET['word'] = _getReadFilterWord($host, $bbs, $key, $resnum, $field);
// read.phpに処理を渡す
include $_conf['read_php'];
//===========================================================================
// 関数(このファイル内でのみ利用)
//===========================================================================
/**
 * 対象レスの対象フィールドから、検索ワードを取得する
예제 #5
0
파일: setFav.func.php 프로젝트: poppen/p2
/**
 * @access  private
 * @return  array  読み込んだkeyデータ
 */
function _setFavToKeyIdx($host, $bbs, $key, $setfav)
{
    $idxfile = P2Util::getKeyIdxFilePath($host, $bbs, $key);
    // FileCtl::mkdirFor($idxfile);
    $data = array();
    // 既にidxデータがあるなら読み込む
    if (file_exists($idxfile) and $lines = file($idxfile)) {
        $l = rtrim($lines[0]);
        $data = explode('<>', $l);
    }
    // スレッド.idx 記録
    if ($setfav == '0' || $setfav == '1') {
        // お気にスレから外した結果、idxの意味がなくなれば削除する
        if ($setfav == '0' and empty($data[3]) && empty($data[4]) && geti($data[9]) <= 1) {
            @unlink($idxfile);
        } else {
            P2Util::recKeyIdx($idxfile, array(geti($data[0]), $key, geti($data[2]), geti($data[3]), geti($data[4]), geti($data[5]), $setfav, geti($data[7]), geti($data[8]), geti($data[9]), $host, $bbs, geti($data[12])));
        }
    }
    return $data;
}
예제 #6
0
파일: blackboard.php 프로젝트: poppen/p2
/**
 * p2 - デザイン用 設定ファイル
 *
 * 黒板風スキン
 *
 * コメント冒頭の() 内はデフォルト値
 * 設定は style/*_css.inc と連動
 */
// ("2") リンクに下線を(つける:0, つけない:1, スレタイトル一覧だけつけない:2)
$STYLE['a_underline_none'] = "2";
// {{{ フォント
// Mac用フォントファミリー
if (strstr(geti($_SERVER['HTTP_USER_AGENT']), 'Mac')) {
    // ブラウザが Macで Safari等の WebKitを使っているものなら
    if (strstr(geti($_SERVER['HTTP_USER_AGENT']), "AppleWebKit")) {
        // ("Hiragino Kaku Gothic Pro") 基本のフォント for Safari
        $STYLE['fontfamily'] = array("Comic Sans MS", "Hiragino Maru Gothic Pro");
        // ("") 基本ボールド用フォント for Safari(普通の太字より太くしたい場合は"Hiragino Kaku Gothic Std")
        $STYLE['fontfamily_bold'] = array("Arial Black", "Hiragino Kaku Gothic Std");
    } else {
        // ("ヒラギノ角ゴ Pro W3") 基本のフォント
        $STYLE['fontfamily'] = array("Comic Sans MS", "ヒラギノ丸ゴ Pro W4");
        // ("ヒラギノ角ゴ Pro W6") 基本ボールド用フォント(普通に太字にしたい場合は指定しない(""))
        $STYLE['fontfamily_bold'] = array("Arial Black", "ヒラギノ角ゴ Std W8");
    }
}
// }}}
/**
 * 色彩の設定
 *
예제 #7
0
파일: read.php 프로젝트: poppen/p2
/**
 * スレッドを指定する
 *
 * @return  array|false
 */
function _detectThread()
{
    global $_conf;
    $ls = null;
    $url = null;
    // スレURLの直接指定
    if (($url = geti($_GET['nama_url'])) || ($url = geti($_GET['url']))) {
        $url = trim($url);
        // 2ch or pink http://choco.2ch.net/test/read.cgi/event/1027770702/
        if (preg_match('{http://([^/]+\\.(2ch\\.net|bbspink\\.com|machibbs\\.com|machi\\.to))/test/read\\.cgi/([^/]+)/([0-9]+)/?([^/]+)?}', $url, $matches)) {
            $host = $matches[1];
            $bbs = $matches[3];
            $key = $matches[4];
            $ls = geti($matches[5]);
            // c-docomo c-au c-other http://c-au.2ch.net/test/--3!mail=sage/operate/1159594301/519-n
        } elseif (preg_match('{http://((c-docomo|c-au|c-other)\\.2ch\\.net)/test/([^/]+)/([^/]+)/([0-9]+)/?([^/]+)?}', $url, $m)) {
            require_once P2_LIB_DIR . '/BbsMap.php';
            if ($mapped_host = BbsMap::get2chHostByBbs($m[4])) {
                $host = $mapped_host;
                $bbs = $m[4];
                $key = $m[5];
                $ls = geti($m[6]);
            }
            // 2ch, pink, vip2ch.com 過去ログhtml - http://pc.2ch.net/mac/kako/1015/10153/1015358199.html
        } elseif (preg_match('{(http://([^/]+\\.(2ch\\.net|bbspink\\.com|vip2ch\\.com))(/[^/]+)?/([^/]+)/kako/\\d+(/\\d+)?/(\\d+)).html}', $url, $matches)) {
            $host = $matches[2];
            $bbs = $matches[5];
            $key = $matches[7];
            $kakolog_uri = $matches[1];
            $_GET['kakolog'] = $kakolog_uri;
            // 新まちBBS http://tohoku.machi.to/bbs/read.cgi/touhoku/1179407635/l50
        } elseif (preg_match('{http://([^/]+\\.(2ch\\.net|bbspink\\.com|machibbs\\.com|machi\\.to))/bbs/read\\.cgi/([^/]+)/([0-9]+)/?([^/]+)?}', $url, $matches)) {
            $host = $matches[1];
            $bbs = $matches[3];
            $key = $matches[4];
            $ls = geti($matches[5]);
            // (旧)まちBBS http://kanto.machibbs.com/bbs/read.pl?BBS=kana&KEY=1034515019
        } elseif (preg_match('{http://([^/]+\\.machibbs\\.com|[^/]+\\.machi\\.to)/bbs/read\\.(pl|cgi)\\?BBS=([^&]+)&KEY=([0-9]+)(&START=([0-9]+))?(&END=([0-9]+))?[^\\"]*}', $url, $matches)) {
            $host = $matches[1];
            $bbs = $matches[3];
            $key = $matches[4];
            $ls = geti($matches[6]) . '-' . geti($matches[8]);
            // したらばJBBS(旧まちBBSと類似形式)
        } elseif (preg_match('{http://((jbbs\\.livedoor\\.jp|jbbs\\.livedoor.com|jbbs\\.shitaraba\\.com)(/[^/]+)?)/bbs/read\\.(pl|cgi)\\?BBS=([^&]+)&KEY=([0-9]+)(&START=([0-9]+))?(&END=([0-9]+))?[^"]*}', $url, $matches)) {
            $host = $matches[1];
            $bbs = $matches[5];
            $key = $matches[6];
            $ls = geti($matches[8]) . '-' . geti($matches[10]);
            // したらばJBBS(2ch類似形式) http://jbbs.livedoor.com/bbs/read.cgi/computer/2999/1081177036/-100
        } elseif (preg_match('{http://(jbbs\\.livedoor\\.jp|jbbs\\.livedoor.com|jbbs\\.shitaraba\\.com)/bbs/read\\.cgi/(\\w+)/(\\d+)/(\\d+)/((\\d+)?-(\\d+)?)?[^"]*}', $url, $matches)) {
            $host = $matches[1] . '/' . $matches[2];
            $bbs = $matches[3];
            $key = $matches[4];
            $ls = geti($matches[5]);
            // チャットちゃんねる http://cha2.net/cgi-bin/test/read.cgi/anitoku/1241688251/l50
        } elseif (preg_match('{http://(cha2\\.net)/cgi-bin/test/read\\.cgi/(\\w+)/(\\d+)/?([^/]+)?}', $url, $matches)) {
            $host = $matches[1];
            $bbs = $matches[2];
            $key = $matches[3];
            $ls = geti($matches[4]);
            // 外部板 read.cgi 形式 http://ex14.vip2ch.com/test/read.cgi/operate/1161701941/
        } elseif (preg_match('{http://([^/]+)/test/read\\.cgi/(\\w+)/(\\d+)/?([^/]+)?}', $url, $matches)) {
            $host = $matches[1];
            $bbs = $matches[2];
            $key = $matches[3];
            $ls = geti($matches[4]);
        }
    } else {
        !empty($_GET['host']) and $host = $_GET['host'];
        // "pc.2ch.net"
        !empty($_POST['host']) and $host = $_POST['host'];
        isset($_GET['bbs']) and $bbs = $_GET['bbs'];
        // "php"
        isset($_POST['bbs']) and $bbs = $_POST['bbs'];
        isset($_GET['key']) and $key = $_GET['key'];
        // "1022999539"
        isset($_POST['key']) and $key = $_POST['key'];
        !empty($_GET['ls']) and $ls = $_GET['ls'];
        // "all"
        !empty($_POST['ls']) and $ls = $_POST['ls'];
    }
    if (empty($host) || !isset($bbs) || !isset($key)) {
        $err = $_conf['read_php'] . ' スレッドの指定が変です。';
        $msg = null;
        if ($url) {
            if (preg_match('/^http/', $url)) {
                $msg = sprintf('<a href="%1$s">%1$s</a>', hs($url));
            } else {
                $msg = hs($url);
            }
        }
        p2die($err, $msg);
    }
    if (P2Validate::host($host) || P2Validate::bbs($bbs) || P2Validate::key($key)) {
        p2die('不正な引数です');
    }
    return array($host, $bbs, $key, $ls);
}
예제 #8
0
파일: Login.php 프로젝트: poppen/p2
 /**
  * md5_encrypt, md5_decrypt のための password(salt) を得る
  * (クッキーのcidの生成に利用している)
  *
  * @static
  * @access  private
  * @return  string
  */
 function getMd5CryptPassForCid()
 {
     //return md5($_SERVER['SERVER_NAME'] . $_SERVER['HTTP_USER_AGENT'] . $_SERVER['SERVER_SOFTWARE']);
     //$seed = $_SERVER['SERVER_NAME'] . $_SERVER['SERVER_SOFTWARE'];
     $seed = $_SERVER['SERVER_SOFTWARE'];
     require_once P2_LIB_DIR . '/HostCheck.php';
     // ローカルチェックをして、HostCheck::isAddrDocomo() などでホスト名を引く機会を減らす
     $notK = (bool) (HostCheck::isAddrLocal() || HostCheck::isAddrPrivate());
     // 携帯判定された場合は、 IPチェックなし
     if (!$notK and UA::isK(geti($_SERVER['HTTP_USER_AGENT'])) || HostCheck::isAddrDocomo() || HostCheck::isAddrAu() || HostCheck::isAddrSoftBank() || HostCheck::isAddrWillcom() || HostCheck::isAddrJigWeb() || HostCheck::isAddrJig() || HostCheck::isAddrIbis()) {
     } elseif (!empty($_COOKIE['ignore_cip'])) {
     } else {
         $now_ips = explode('.', $_SERVER['REMOTE_ADDR']);
         $seed .= $now_ips[0];
     }
     return md5($seed);
 }
예제 #9
0
파일: css.php 프로젝트: poppen/p2
<?php

// p2 - スタイルシートを外部スタイルシートとして出力する
/*
<link rel="stylesheet" type="text/css" href="css.php?css=style&user=nanashi&skin=">
<link rel="stylesheet" type="text/css" href="css.php?css=read&user=nanashi&skin=">
*/
require_once './conf/conf.inc.php';
//$_login->authorize(); // ユーザ認証
// 妥当なCSSファイル指定か検証して取得する
if (!isset($_GET['css']) or !($cssFilePath = _getValidCssFilePath($_GET['css']))) {
    exit;
}
// CSS出力
_printCss($cssFilePath, geti($_GET['skin']));
exit;
//===============================================================================
// 関数(このファイル内でのみ利用)
//===============================================================================
/**
 * @return  void  CSS出力
 */
function _printCss($cssFilePath, $skin = null)
{
    global $_conf, $STYLE, $MYSTYLE;
    /*
    // クエリにユニークキーを埋め込んでいるいるので、キャッシュさせてよい
    // ノーマルp2ではまだ含んでないよ
    $now = time();
    header('Expires: ' . http_date($now + 3600));
    header('Last-Modified: ' . http_date($now));
예제 #10
0
파일: post.php 프로젝트: poppen/p2
/**
 * スレ立てしすぎならtrueを返す
 */
function _isThreTateSugi()
{
    global $_conf;
    if (!file_exists($_conf['p2_res_hist_dat_secu']) or !($lines = file($_conf['p2_res_hist_dat_secu']))) {
        return false;
    }
    $lines = array_reverse($lines);
    $count = 0;
    $check_time = 60 * 60 * 1;
    // 1h
    $limit = 6;
    foreach ($lines as $v) {
        // $from, $mail, date("y/m/d H:i"), $message, $ttitle, $host, $bbs, $key, $resnum, $_SERVER['REMOTE_ADDR']
        $e = explode('<>', $v);
        $key = geti($e[7]);
        $time_str = '20' . $e[2];
        // $e[2] -> 07/12/21 09:27
        //echo '<br>';
        // チェックする時間
        if (strtotime($time_str) < time() - $check_time) {
            break;
        }
        // スレ立てなら
        if (!$key) {
            ++$count;
            if ($count > $limit) {
                return true;
            }
        }
    }
    return false;
}
예제 #11
0
파일: read_filter_k.php 프로젝트: poppen/p2
<?php

/* vim: set fileencoding=cp932 ai et ts=4 sw=4 sts=0 fdm=marker: */
/* mi: charset=Shift_JIS */
// p2 - 携帯版レスフィルタリング
require_once './conf/conf.inc.php';
require_once P2_LIB_DIR . '/P2Validate.php';
$_login->authorize();
// ユーザ認証
// {{{ スレッド情報
$host = geti($_GET['host']);
$bbs = geti($_GET['bbs']);
$key = geti($_GET['key']);
$ttitle_hc = P2Util::htmlEntityDecodeLite(base64_decode(geti($_GET['ttitle_en'])));
$ttitle_back_ht = isset($_SERVER['HTTP_REFERER']) ? '<a href="' . hs($_SERVER['HTTP_REFERER']) . '" title="戻る">' . hs($ttitle_hc) . '</a>' : hs($ttitle_hc);
if (P2Validate::host($host) || P2Validate::bbs($bbs) || P2Validate::key($key)) {
    p2die('不正な引数です');
}
// }}}
// {{{ 前回フィルタ値読み込み
$cachefile = $_conf['pref_dir'] . '/p2_res_filter.txt';
$res_filter = array();
if (file_exists($cachefile) and $res_filter_cont = file_get_contents($cachefile)) {
    $res_filter = unserialize($res_filter_cont);
}
$field = array('whole' => '', 'msg' => '', 'name' => '', 'mail' => '', 'date' => '', 'id' => '', 'beid' => '', 'belv' => '');
$match = array('on' => '', 'off' => '');
$method = array('and' => '', 'or' => '', 'just' => '', 'regex' => '', 'similar' => '');
$field[$res_filter['field']] = ' selected';
$match[$res_filter['match']] = ' selected';
$method[$res_filter['method']] = ' selected';
예제 #12
0
파일: post_form_i.php 프로젝트: poppen/p2
require_once './conf/conf.inc.php';
require_once P2_LIB_DIR . '/DataPhp.php';
require_once P2_LIB_DIR . '/P2Validate.php';
$_login->authorize();
// ユーザ認証
//==================================================
// 変数
//==================================================
if (empty($_GET['host'])) {
    p2die('host が指定されていません');
}
$host = $_GET['host'];
$bbs = geti($_GET['bbs']);
$key = geti($_GET['key']);
$rescount = (int) geti($_GET['rescount'], 1);
$popup = (int) geti($_GET['popup'], 0);
if (!($itaj = P2Util::getItaName($host, $bbs))) {
    $itaj = $bbs;
}
$ttitle_en = isset($_GET['ttitle_en']) ? $_GET['ttitle_en'] : '';
$ttitle_hs = null;
if (strlen($ttitle_en)) {
    $ttitle_hs = hs(P2Util::htmlEntityDecodeLite(base64_decode($ttitle_en)));
}
if (P2Validate::host($host) || $bbs && P2Validate::bbs($bbs) || $key && P2Validate::key($key)) {
    p2die('不正な引数です');
}
$keyidx = P2Util::getKeyIdxFilePath($host, $bbs, $key);
// フォームのオプション読み込み
require_once P2_LIB_DIR . '/post_options_loader.inc.php';
// 表示指定
예제 #13
0
파일: P2Util.php 프로젝트: poppen/p2
 /**
  * アクセス(ログイン)情報をログに記録する
  *
  * @access  public
  * @return  boolean
  */
 function recAccessLog($logfile, $maxline = 100, $format = 'dataphp')
 {
     global $_conf, $_login;
     // ログファイルの中身を取得する
     $lines = array();
     if (file_exists($logfile)) {
         if ($format == 'dataphp') {
             $lines = DataPhp::fileDataPhp($logfile);
         } else {
             $lines = file($logfile);
         }
     }
     if ($lines) {
         // 制限行調整
         while (sizeof($lines) > $maxline - 1) {
             array_pop($lines);
         }
     } else {
         $lines = array();
     }
     $lines = array_map('rtrim', $lines);
     // 変数設定
     $date = date('Y/m/d (D) G:i:s');
     $user = isset($_login->user_u) ? $_login->user_u : "";
     // 新しいログ行を設定
     $newdata = implode('<>', array($date, $_SERVER['REMOTE_ADDR'], P2Util::getRemoteHost(), geti($_SERVER['HTTP_USER_AGENT']), geti($_SERVER['HTTP_REFERER']), '', $user));
     //$newdata = htmlspecialchars($newdata, ENT_QUOTES);
     // まずタブを全て外して
     $newdata = str_replace("\t", "", $newdata);
     // <>をタブに変換して
     $newdata = str_replace("<>", "\t", $newdata);
     // 新しいデータを一番上に追加
     @array_unshift($lines, $newdata);
     $cont = implode("\n", $lines) . "\n";
     FileCtl::make_datafile($logfile, $_conf['p2_perm']);
     // 書き込み処理
     if ($format == 'dataphp') {
         if (!DataPhp::writeDataPhp($logfile, $cont, $_conf['p2_perm'])) {
             return false;
         }
     } else {
         if (false === file_put_contents($logfile, $cont, LOCK_EX)) {
             trigger_error("file_put_contents(" . $logfile . ")", E_USER_WARNING);
             return false;
         }
     }
     return true;
 }
예제 #14
0
파일: login2ch.php 프로젝트: poppen/p2
<?php

/**
 *    p2 - 2ch●ログイン管理
 */
require_once './conf/conf.inc.php';
require_once P2_LIB_DIR . '/P2Validate.php';
$_login->authorize();
// ユーザ認証
//================================================================
// 変数
//================================================================
$login2chID = geti($_POST['login2chID']);
$login2chPW = geti($_POST['login2chPW']);
$autoLogin2ch = intval(geti($_POST['autoLogin2ch']));
// 2ch ID (メアド)
if ($login2chID and P2Validate::mail($login2chID)) {
    P2Util::pushInfoHtml('<p>p2 error: 使用できないID文字列が含まれています</p>');
    $login2chID = null;
}
// 正確な許可文字列は不明
if ($login2chPW and P2Validate::login2chPW($login2chPW)) {
    P2Util::pushInfoHtml('<p>p2 error: 使用できないパスワード文字列が含まれています</p>');
    $login2chPW = null;
}
//===============================================================
// ログインなら、IDとPWを登録保存して、ログインする
//===============================================================
if ($login2chID && $login2chPW) {
    P2Util::saveIdPw2ch($login2chID, $login2chPW, $autoLogin2ch);
    require_once P2_LIB_DIR . '/login2ch.func.php';
예제 #15
0
파일: editfile.php 프로젝트: poppen/p2
<?php

/*
    ファイルをブラウザで編集する
*/
require_once './conf/conf.inc.php';
$_login->authorize();
// ユーザ認証
// 引数エラー
if (!isset($_POST['path'])) {
    die('Error: path が指定されていません');
}
// 変数
$path = geti($_POST['path']);
$modori_url = geti($_POST['modori_url']);
$encode = geti($_POST['encode']);
$rows = isset($_POST['rows']) ? intval($_POST['rows']) : 36;
$cols = isset($_POST['cols']) ? intval($_POST['cols']) : 128;
isset($_POST['filecont']) and $filecont = $_POST['filecont'];
// 前処理
// 書き込めるファイルを限定する
_checkWritableFiles($path);
// void|exit
// メイン
if (isset($filecont)) {
    if (_setFile($path, $filecont, $encode)) {
        P2Util::pushInfoHtml("saved, OK.");
    }
}
// 表示
_printEditFileHtml($path, $encode);
예제 #16
0
파일: P2View.php 프로젝트: poppen/p2
    /**
     * @static
     * @access  public
     * @return  void  HTML出力
     */
    function printHeadMetasHtml($frameset = false)
    {
        $metas = array(array('http-equiv' => 'Content-Type', 'content' => 'text/html; charset=Shift_JIS'), array('name' => 'ROBOTS', 'content' => 'NOINDEX, NOFOLLOW'));
        /*
        // 省略
        if (UA::isPC() || UA::isIPhoneGroup()) {
            $metas[] = array(
                'http-equiv' => 'Content-Style-Type',
                'content'    => 'text/css'
            );
            $metas[] = array(
                'http-equiv' => 'Content-Script-Type',
                'content'    => 'text/javascript'
            );
        }
        */
        if (!$frameset) {
            if (UA::isIPhoneGroup() || UA::isIPhoneGroup(geti($_SERVER['HTTP_USER_AGENT']))) {
                ?>
<link rel="apple-touch-icon" href="img/p2iphone.png"><?php 
                // <meta name="viewport" content="width=device-width, initial-scale=1.0">
                // initial-scale=1.0, maximum-scale=1.0
                // initial-scale=1.0 とすると、縦→横と向きを変えた時に、拡大率が大きい状態になってしまう。
                $metas[] = array('name' => 'viewport', 'content' => 'width=device-width');
                // <meta name="format-detection" content="telephone=no">
                $metas[] = array('name' => 'format-detection', 'content' => 'telephone=no');
            }
        }
        foreach ($metas as $meta) {
            $attrs = array();
            foreach ($meta as $k => $v) {
                $attrs[] = hs($k) . '="' . hs($v) . '"';
            }
            printf('<meta %s>' . "\n", implode(' ', $attrs));
        }
    }
예제 #17
0
/**
 * ナビ 前
 *
 * @return  string  HTML
 */
function _getMaeATag($aThreadList, $disp_navi, $word_qs)
{
    global $_conf;
    $mae_atag = '';
    if ($disp_navi['from'] > 1) {
        $qs = array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'spmode' => $aThreadList->spmode, 'norefresh' => '1', 'from' => $disp_navi['mae_from'], 'sb_view' => geti($_REQUEST['sb_view']), UA::getQueryKey() => UA::getQueryValue());
        $qs = array_merge($word_qs, $qs);
        $mae_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], $qs), hs('前'));
    }
    return $mae_atag;
}
예제 #18
0
파일: subject_i.php 프로젝트: poppen/p2
require_once P2_LIB_DIR . '/P2Validate.php';
require_once P2_LIB_DIR . '/subject.funcs.php';
$GLOBALS['debug'] && $GLOBALS['profiler']->enterSection('HEAD');
$_login->authorize();
// ユーザ認証
//============================================================
// 変数設定
//============================================================
$newtime = date('gis');
$abornoff_st = 'あぼーん解除';
$deletelog_st = 'ログを削除';
$sb_disp_from = (int) geti($_GET['from'], geti($_POST['from'], 1));
// {{{ ホスト、板、モード設定
$host = geti($_GET['host'], geti($_POST['host']));
$bbs = geti($_GET['bbs'], geti($_POST['bbs']));
$spmode = geti($_GET['spmode'], geti($_POST['spmode']));
if (!$host || !strlen($bbs) and !$spmode) {
    p2die('必要な引数が指定されていません');
}
if ($host && P2Validate::host($host) || strlen($bbs) && P2Validate::bbs($bbs) || $spmode && P2Validate::spmode($spmode)) {
    p2die('不正な引数です');
}
// }}}
// {{{ p2_setting, sb_keys 設定
if ($spmode) {
    $p2_setting_txt = $_conf['pref_dir'] . '/p2_setting_' . $spmode . '.txt';
    $sb_keys_b_txt = null;
    $sb_keys_txt = null;
} else {
    $idx_bbs_dir_s = P2Util::idxDirOfHostBbs($host, $bbs);
    $p2_setting_txt = $idx_bbs_dir_s . 'p2_setting.txt';
예제 #19
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;
}
예제 #20
0
    } else {
        P2Util::pushInfoHtml("<p>×リストを空にできませんでした</p>");
    }
}
// }}}
// {{{ リスト読み込み
$formdata = array();
if (file_exists($path)) {
    $lines = file($path);
    $i = 0;
    foreach ($lines as $line) {
        $lar = explode("\t", rtrim($line, "\r\n"));
        if (strlen($lar[0]) == 0) {
            continue;
        }
        $ar = array('cond' => $lar[0], 'word' => $lar[0], 'ht' => geti($lar[1]), 'hn' => geti($lar[2], 0), 're' => '', 'ic' => '', 'bbs' => '', 'tt' => '');
        // 板縛り
        if (preg_match('!<bbs>(.+?)</bbs>!', $ar['word'], $matches)) {
            $ar['bbs'] = $matches[1];
        }
        $ar['word'] = preg_replace('!<bbs>(.*)</bbs>!', '', $ar['word']);
        // タイトル縛り
        if (preg_match('!<title>(.+?)</title>!', $ar['word'], $matches)) {
            $ar['tt'] = $matches[1];
        }
        $ar['word'] = preg_replace('!<title>(.*)</title>!', '', $ar['word']);
        // 正規表現
        if (preg_match('/^<(mb_ereg|preg_match|regex)(:[imsxeADSUXu]+)?>(.*)$/', $ar['word'], $m)) {
            $ar['word'] = $m[3];
            $ar['re'] = ' checked';
            // 大文字小文字を無視
예제 #21
0
파일: login.php 프로젝트: poppen/p2
/**
 * Cookie認証登録解除処理の結果
 *
 * @return  void, P2Util::pushInfoHtml()
 */
function _preExecCheckRegistCookie()
{
    global $_login;
    if (isset($_REQUEST['check_regist_cookie'])) {
        if ($_login->checkUserPwWithCid($_COOKIE['cid'])) {
            if (geti($_REQUEST['regist_cookie']) == '1') {
                P2Util::pushInfoHtml('<p>○cookie認証登録完了</p>');
            } else {
                P2Util::pushInfoHtml('<p>×cookie認証解除失敗</p>');
            }
        } else {
            if (geti($_REQUEST['regist_cookie']) == '1') {
                P2Util::pushInfoHtml('<p>×cookie認証登録失敗</p>');
            } else {
                P2Util::pushInfoHtml('<p>○cookie認証解除完了</p>');
            }
        }
    }
}
예제 #22
0
파일: read_copy_k.php 프로젝트: poppen/p2
<?php

/* vim: set fileencoding=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: */
/* mi: charset=Shift_JIS */
// p2 - 携帯版レスコピペ用フォーム
require_once 'conf/conf.inc.php';
require_once P2_LIB_DIR . '/Thread.php';
require_once P2_LIB_DIR . '/ThreadRead.php';
$_login->authorize();
// ユーザ認証
$host = geti($_GET['host']);
$bbs = geti($_GET['bbs']);
$key = geti($_GET['key']);
$resid = $GLOBALS['_read_copy_resnum'];
$quote = !empty($_GET['inyou']);
$back_link_atag = '';
if (isset($_SERVER['HTTP_REFERER'])) {
    $back_link_atag = P2View::tagA($_SERVER['HTTP_REFERER'], hs('戻る'), array('title' => '戻る'));
}
// レス読み込み
$aThread = new ThreadRead();
$aThread->setThreadPathInfo($host, $bbs, $key);
$aThread->ls = $resid;
$moto_url = '';
$moto_url_k = '';
$post_link_atag = '';
$moto_link_atag = '';
$name_txt = '';
$mail_txt = '';
$date_txt = '';
$msg_txt = '';
예제 #23
0
파일: editpref.php 프로젝트: poppen/p2
/**
 * ホストの同期用フォームのHTMLを取得する
 *
 * @return  string
 */
function _getSyncFavoritesFormHtml($path_value, $submit_value)
{
    global $_conf;
    $ht = <<<EOFORM
<form action="{$_conf['editpref_php']}" method="POST" target="_self" class="inline-form">
    {$_conf['k_input_ht']}
    <input type="hidden" name="sync" value="{$path_value}">
    <input type="submit" value="{$submit_value}">
</form>

EOFORM;
    if (strstr(geti($_SERVER['HTTP_USER_AGENT']), 'MSIE')) {
        $ht = '&nbsp;' . preg_replace('/>\\s+</', '><', $ht);
    }
    return $ht;
}
예제 #24
0
/* mi: charset=Shift_JIS */
// p2 - レス書き込みフォームの機能読み込み
// 事前変数
// $host, $bbs, $key ($rescount, $popup, $ttitle_en)
$fake_time = -10;
// time を10分前に偽装
$time = time() - 9 * 60 * 60;
$time = $time + $fake_time * 60;
$csrfid = P2Util::getCsrfId();
$res_disabled_at = '';
// $resv 'FROM', 'mail', 'MESSAGE, 'subject'
$resv = P2Util::getDefaultResValues($host, $bbs, $key);
$hs = array('FROM' => hs($resv['FROM']), 'mail' => hs($resv['mail']), 'subject' => hs($resv['subject']));
$MESSAGE_hs = hs($resv['MESSAGE']);
// これにレス
$htm['orig_msg'] = _getOrigMsgHtmlAndSetMessageHs($host, $bbs, $key, geti($_GET['resnum']), geti($_GET['inyou']), $MESSAGE_hs);
// 表示指定
// 参考 クラシック COLS='60' ROWS='8'
$mobile =& Net_UserAgent_Mobile::singleton();
$name_size_at = '';
$mail_size_at = '';
// PC
if (UA::isPC()) {
    $name_size_at = ' size="19"';
    $mail_size_at = ' size="19"';
    $msg_cols_at = sprintf(' cols="%d"', $STYLE['post_msg_cols']);
    $wrap = 'off';
    // willcom
    // 通常はPC用設定に準じるが、携帯用設定がセットされていれば、そちらに準じる。
} elseif ($mobile->isWillcom()) {
    if ($_conf['k_post_msg_cols']) {
예제 #25
0
파일: read_new_i.php 프로젝트: poppen/p2
/**
 * スレッドの新着部分を読み込んで表示する
 */
function _readNew(&$aThread)
{
    global $_conf, $_newthre_num, $STYLE;
    global $spmode;
    $_newthre_num++;
    $hr = P2View::getHrHtmlK();
    //==========================================================
    // idxの読み込み
    //==========================================================
    //hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    //FileCtl::mkdirFor($aThread->keyidx); //板ディレクトリが無ければ作る //この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if (is_readable($aThread->keyidx)) {
        $lines = file($aThread->keyidx);
        $data = explode('<>', rtrim($lines[0]));
    }
    $aThread->getThreadInfoFromIdx();
    //$aThread->readDatInfoFromFile();
    // DATのダウンロード
    if (!(strlen(geti($word)) and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = base64_encode($aThread->ttitle);
    $ttitle_en_q = "&amp;ttitle_en=" . $ttitle_en;
    $bbs_q = "&amp;bbs=" . $aThread->bbs;
    $key_q = "&amp;key=" . $aThread->key;
    $popup_q = "&amp;popup=1";
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $_newthre_num - 1;
    $next_thre_num = $_newthre_num + 1;
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    }
    //$next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> ";
    $next_thre_ht = "<a class=\"button\" href=\"#ntt_bt{$_newthre_num}\">▼</a> ";
    if ($spmode) {
        $read_header_itaj_ht = sprintf(' (%s)', hs($aThread->itaj));
        if ($_conf['k_save_packet']) {
            $read_header_itaj_ht = mb_convert_kana($read_header_itaj_ht, 'rnsk');
        }
    }
    // スマートポップアップメニュー JavaScriptコード
    if ($_conf['enable_spm']) {
        // フォントサイズ等 conf_user_style.inc.php  をいじるとPCも変わるのでここで書き換え
        $STYLE['respop_color'] = "#FFFFFF";
        // ("#000") レスポップアップのテキスト色
        $STYLE['respop_bgcolor'] = "";
        // ("#ffffcc") レスポップアップの背景色
        $STYLE['respop_fontsize'] = '13px';
        $aThread->showSmartPopUpMenuJs();
    }
    P2Util::printInfoHtml();
    $ttitle_hs = hs($aThread->ttitle_hc);
    if ($_conf['k_save_packet']) {
        $ttitle_hs = mb_convert_kana($ttitle_hs, 'rnsk');
    }
    $read_header_ht = <<<EOP
\t<p id="ntt{$_newthre_num}" name="ntt{$_newthre_num}"><font color="{$STYLE['read_k_thread_title_color']}"><b>{$ttitle_hs}</b></font>{$read_header_itaj_ht} {$next_thre_ht}</p>
\t{$hr}

EOP;
    // {{{ ローカルDatを読み込んでHTML表示
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    $read_cont_ht = '';
    if ($aThread->rescount) {
        //$aThread->datToHtml(); // dat を html に変換表示
        require_once P2_IPHONE_LIB_DIR . '/ShowThreadK.php';
        $aShowThread = new ShowThreadK($aThread);
        $read_cont_ht = $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    // }}}
    //==================================================================
    // フッタ 表示
    //==================================================================
    // require_once P2_LIB_DIR . '/read_footer.inc.php';
    //----------------------------------------------
    // $read_footer_navi_new_ht  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = "情";
    $dele_st = "削";
    $prev_st = "前";
    $next_st = "次";
    // 表示範囲
    if ($aThread->resrange['start'] == $aThread->resrange['to']) {
        $read_range_on = $aThread->resrange['start'];
    } else {
        $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}";
    }
    $read_range_ht = "{$read_range_on}/{$aThread->rescount}<br>";
    /*
    $read_footer_navi_new_ht = P2View::tagA(
        UriUtil::buildQueryUri(
            $_conf['read_php'],
            array(
                'host' => $aThread->host,
                'bbs'  => $aThread->bbs,
                'key'  => $aThread->key,
                'ls'   => "$aThread->rescount-",
                'nt'   => $newtime,
                UA::getQueryKey() => UA::getQueryValue()
            ) . "#r{$aThread->rescount}"
        ),
        '新着レスの表示'
    );
    
    $dores_ht _getDoResATag($aThread, $motothre_url);
    */
    // {{{ ツールバー部分HTML
    if ($spmode) {
        $ita_atag = _getItaATag($aThread);
        $toolbar_itaj_ht = " ({$ita_atag})";
        if ($_conf['k_save_packet']) {
            $toolbar_itaj_ht = mb_convert_kana($toolbar_itaj_ht, 'rnsk');
        }
    }
    /*
    $info_atag = _getInfoATag($aThread, $info_st);
    $dele_atag = _getDeleATag($aThread, $dele_st);
    $motothre_atag = P2View::tagA($motothre_url, '元スレ')
    $toolbar_right_ht = "{$info_atag} {$dele_atag} {$motothre_atag}\n";
    */
    // }}}
    $read_atag = _getReadATag($aThread);
    $read_footer_ht = <<<EOP
        <div id="ntt_bt{$_newthre_num}" name="ntt_bt{$_newthre_num}">
            {$read_range_ht} 
            {$read_atag}{$toolbar_itaj_ht} 
            <a href="#ntt{$_newthre_num}">▲</a>
        </div>
EOP;
    // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
    }
    // {{{ key.idxの値設定
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、後方互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, '', $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
    // }}}
    unset($aThread);
}
예제 #26
0
파일: info_i.php 프로젝트: poppen/p2
/**
 * @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));
}
예제 #27
0
 /**
  * setcookie() では、auで必要なmax ageが設定されないので、こちらを利用する
  *
  * @access  public
  * @param   string  $key
  * @param   string  $value
  * @param   int     $expires
  * @param   string  $path
  * @param   string  $domain
  * @param   boolean $secure
  * @param   boolean $httponly
  * @return  boolean
  */
 public static function setCookie($key, $value = '', $expires = null, $path = '', $domain = null, $secure = false, $httponly = true)
 {
     if (is_null($domain)) {
         $domain = self::getCookieDomain();
     }
     is_null($expires) and $expires = time() + 60 * 60 * 24 * 365;
     if (headers_sent()) {
         return false;
     }
     // Mac IEは、動作不良を起こすらしいっぽいので、httponlyの対象から外す。(そもそも対応もしていない)
     // MAC IE5.1  Mozilla/4.0 (compatible; MSIE 5.16; Mac_PowerPC)
     if (preg_match('/MSIE \\d\\.\\d+; Mac/', geti($_SERVER['HTTP_USER_AGENT']))) {
         $httponly = false;
     }
     // setcookie($key, $value, $expires, $path, $domain, $secure = false, $httponly = true);
     /*
     if (is_array($name)) {
         list($k, $v) = each($name);
         $name = $k . '[' . $v . ']';
     }
     */
     if ($expires) {
         $maxage = $expires - time();
     }
     header('Set-Cookie: ' . self::encodeCookieName($key) . '=' . rawurlencode($value) . (empty($domain) ? '' : '; Domain=' . $domain) . (empty($expires) ? '' : '; expires=' . gmdate('D, d-M-Y H:i:s', $expires) . ' GMT') . (empty($maxage) ? '' : '; Max-Age=' . $maxage) . (empty($path) ? '' : '; Path=' . $path) . (!$secure ? '' : '; Secure') . (!$httponly ? '' : '; HttpOnly'), $replace = false);
     return true;
 }
예제 #28
0
파일: ShowThreadPc.php 프로젝트: poppen/p2
 /**
  * 外部板 read.cgi 形式 リンク
  *
  * @access  private
  * @return  string|false  HTML
  */
 function plugin_linkReadCgi($url, $purl, $html)
 {
     global $_conf;
     // 外部板 read.cgi 形式 http://ex14.vip2ch.com/test/read.cgi/operate/1161701941/
     // 2009/09/15 新まちBBSのbbs形式ももここに入れとこか http://www.machi.to/bbs/read.cgi/tawara/1180236579/137
     if (preg_match('{http://([^/]+)/(?:test|bbs)/read\\.cgi/(\\w+)/(\\d+)/?([^/]+)?}', $url, $matches)) {
         $host = $matches[1];
         $bbs = $matches[2];
         $key = $matches[3];
         $ls = geti($matches[4]);
         $read_url = "{$_conf['read_php']}?host={$host}&bbs={$bbs}&key={$key}&ls={$ls}";
         if ($_conf['iframe_popup']) {
             if (preg_match('/^[0-9\\-n]+$/', $ls)) {
                 $pop_url = $url;
             } else {
                 $pop_url = $read_url . '&onlyone=true';
             }
             return $this->iframePopup(array($read_url, $pop_url), $html, array('target' => $_conf['bbs_win_target']));
         }
         return P2View::tagA($read_url, $html, array('target' => $_conf['bbs_win_target']));
     }
     return FALSE;
 }
예제 #29
0
/**
 * @return  string  HTML
 */
function _getAuthSubInputHtml($mobile)
{
    $auth_sub_input_ht = '';
    // EZ認証
    if (!empty($_SERVER['HTTP_X_UP_SUBNO'])) {
        //if (!$_login->hasRegistedAuthCarrier('EZWEB')) {
        $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>';
        //}
        // SoftBank認証
        // http://www.dp.j-phone.com/dp/tool_dl/web/useragent.php
    } elseif (HostCheck::isAddrSoftBank() and P2Util::getSoftBankID()) {
        //if (!$_login->hasRegistedAuthCarrier('SOFTBANK')) {
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_jp" value="1">' . "\n" . '<input type="checkbox" name="regist_jp" value="1" checked>SoftBank端末IDで認証を登録<br>';
        //}
        // docomo認証
    } elseif ($mobile->isDoCoMo()) {
        //if (!$_login->hasRegistedAuthCarrier('DOCOMO')) {
        $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_newuser']) || isset($_POST['submit_userlogin'])) {
            if (empty($_POST['regist_cookie'])) {
                $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);
    }
    return $auth_sub_input_ht;
}
예제 #30
0
파일: Login.php 프로젝트: unpush/p2-php
 /**
  * MD5Crypt::encrypt, MD5Crypt::decrypt のための password(salt) を得る
  * (クッキーのcidの生成に利用している)
  *
  * @param   void
  * @access  private
  * @return  string
  */
 private static function getMd5CryptPassForCid()
 {
     static $pass = null;
     if ($pass !== null) {
         return $pass;
     }
     $seed = $_SERVER['SERVER_SOFTWARE'];
     // IPチェックなしの場合と
     if (!empty($_COOKIE['ignore_cip'])) {
         // 携帯判定された場合は、 IPチェックなし
     } elseif (UA::isK(geti($_SERVER['HTTP_USER_AGENT'])) || HostCheck::isAddressMobile()) {
     } else {
         $now_ips = explode('.', $_SERVER['REMOTE_ADDR']);
         $seed .= $now_ips[0];
     }
     $pass = md5($seed, true);
     return $pass;
 }