Ejemplo n.º 1
0
Archivo: Thread.php Proyecto: poppen/p2
 /**
  * ttitleをセットする(ついでにttitle_hc, ttitle_hs, ttitle_htも)
  *
  * @access  public
  * @return  void
  */
 function setTtitle($ttitle)
 {
     $this->ttitle = $ttitle;
     // < が &lt; であったりするので、まずデコードしたものを
     // 2007/12/21 $this->ttitle も上書きしてしまう($this->ttitle_hc はなくしてしまいたい)
     // ↑これは今のところダメ。履歴など<>区切りで $this->ttitle を直接記録している箇所がある。
     $this->ttitle_hc = P2Util::htmlEntityDecodeLite($this->ttitle);
     // HTML表示用に htmlspecialchars() したもの
     $this->ttitle_hs = htmlspecialchars($this->ttitle_hc, ENT_QUOTES);
     $this->ttitle_ht = $this->ttitle_hs;
 }
Ejemplo n.º 2
0
 /**
  * リンク対象文字列の種類を判定して対応した関数/メソッドに渡して処理する
  *
  * @access  private
  * @return  string  HTML
  */
 function link_callback($s)
 {
     global $_conf;
     // preg_replace_callback()では名前付きでキャプチャできない?
     if (!isset($s['link'])) {
         // $s[1] => "<a...>...</a>", $s[2] => "<a..>", $s[3] => "...", $s[4] => "</a>"
         $s['link'] = $s[1];
         $s['quote'] = $s[5];
         $s['url'] = isset($s[8]) ? $s[8] : null;
         $s['id'] = isset($s[11]) ? $s[11] : null;
     }
     // マッチしたサブパターンに応じて分岐
     // リンク
     if ($s['link']) {
         if (preg_match('{ href=(["\'])?(.+?)(?(1)\\1)(?=[ >])}i', $s[2], $m)) {
             $url = $m[2];
             $html = $s[3];
         } else {
             return $s[3];
         }
         // 引用
     } elseif ($s['quote']) {
         return $this->quote_msg_callback(array($s['quote']));
         // http or ftp のURL
     } elseif ($s['url']) {
         if ($s[9] == 'ftp') {
             return $s[0];
         }
         $url = preg_replace('/^t?(tps?)$/', 'ht$1', $s[9]) . '://' . $s[10];
         $html = $s['url'];
         // ID
     } elseif ($s['id'] && $_conf['flex_idpopup']) {
         // && $_conf['flex_idlink_k']
         return $this->idfilter_callback(array($s['id'], $s[12]));
         // その他(予備)
     } else {
         return strip_tags($s[0]);
     }
     // 以下、urlケースの処理
     $url = P2Util::htmlEntityDecodeLite($url);
     // ime.nuを外す
     // (http以外のケースもあったっけ?)
     if (P2Util::isHostMachiBbs($this->thread->host)) {
         $url_tmp = preg_replace('|^([a-z]+://)machi\\.to/bbs/link\\.cgi\\?URL=|', '', $url);
         if ($url != $url_tmp) {
             $url = $url_tmp;
             $html = preg_replace('|^([a-z]+://)machi\\.to/bbs/link\\.cgi\\?URL=|', '', $html);
         }
     } else {
         $url = preg_replace('|^([a-z]+://)ime\\.nu/|', '$1', $url);
     }
     // URLをパース
     $purl = @parse_url($url);
     if (!$purl || !isset($purl['host']) || !strstr($purl['host'], '.') || $purl['host'] == '127.0.0.1') {
         return $html;
     }
     // URLを処理
     foreach ($this->url_handlers as $handler) {
         if (isset($handler['this'])) {
             if (FALSE !== ($linkHtml = call_user_func(array($this, $handler['this']), $url, $purl, $html))) {
                 return $linkHtml;
             }
         } elseif (isset($handler['class']) && isset($handler['method'])) {
             if (FALSE !== ($linkHtml = call_user_func(array($handler['class'], $handler['method']), $url, $purl, $html))) {
                 return $linkHtml;
             }
         } elseif (isset($handler['function'])) {
             if (FALSE !== ($linkHtml = call_user_func($handler['function'], $url, $purl, $html))) {
                 return $linkHtml;
             }
         }
     }
     return $html;
 }
Ejemplo n.º 3
0
//==================================================
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';
// 表示指定
$class_ttitle = '';
$target_read = '';
$sub_size_at = '';
if (!$_conf['ktai']) {
    $class_ttitle = ' class="thre_title"';
    $target_read = ' target="read"';
    $sub_size_at = ' size="40"';
Ejemplo n.º 4
0
<?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';
Ejemplo n.º 5
0
//==================================================
// 変数
//==================================================
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_hc = strlen($ttitle_en) > 0 ? P2Util::htmlEntityDecodeLite(base64_decode($ttitle_en)) : '';
if (P2Validate::host($host) || $bbs && P2Validate::bbs($bbs) || $key && P2Validate::key($key)) {
    p2die('不正な引数です');
}
// フォームのオプション読み込み
require_once P2_LIB_DIR . '/post_options_loader.inc.php';
// 表示指定
$htm['resform_ttitle'] = '';
// {{{ スレ立てなら
if (!empty($_GET['newthread'])) {
    $ptitle = "{$itaj} - 新規スレッド作成";
    // machibbs、JBBS@したらば なら
    if (P2Util::isHostMachiBbs($host) or P2Util::isHostJbbsShitaraba($host)) {
        $submit_value = "新規書き込み";
        // 2chなら
    } else {