Example #1
0
/**
 * ページ遷移用のHTML要素を取得する
 */
function get_read_jump(ThreadRead $aThread, $label, $use_onchange)
{
    global $_conf;
    $resFilter = ResFilter::getFilter();
    if ($resFilter && $resFilter->hasWord()) {
        $jump = _get_read_jump_filter($aThread, $resFilter, $use_onchange);
    } else {
        $jump = _get_read_jump($aThread, $use_onchange);
    }
    if ($use_onchange) {
        return $jump;
    } else {
        return "<form method=\"get\" action=\"{$_conf['read_php']}\" accept-charset=\"{$_conf['accept_charset']}\">{$label}{$jump}</form>";
    }
}
Example #2
0
 /**
  * DatをHTMLに変換して表示する
  *
  * @param   bool $capture       trueなら変換結果を出力せずに返す
  * @param   bool $is_fragment   trueなら<div class="thread"></div>で囲まない
  * @return  bool|string
  */
 public function datToHtml($capture = false, $is_fragment = false)
 {
     global $_conf, $filter_hits, $last_hit_resnum;
     $aThread = $this->thread;
     // 表示レス範囲が指定されていなければ
     if (!$aThread->resrange) {
         $error = '<p><b>p2 error: {$this->resrange} is FALSE at datToHtml()</b></p>';
         if ($capture) {
             return $error;
         } else {
             echo $error;
             return false;
         }
     }
     $start = $aThread->resrange['start'];
     $to = $aThread->resrange['to'];
     $nofirst = $aThread->resrange['nofirst'];
     $is_ktai = $_conf['ktai'];
     $resFilter = ResFilter::getFilter();
     if ($resFilter && $resFilter->hasWord()) {
         $do_filtering = true;
         $nofirst = true;
     } else {
         $do_filtering = false;
     }
     $datlines = $aThread->datlines;
     $count = count($datlines);
     $buf['body'] = $is_fragment ? '' : "<div class=\"thread\">\n";
     $buf['q'] = '';
     // まず 1 を表示
     if (!$nofirst) {
         $res = $this->transRes($datlines[0], 1);
         if (is_array($res)) {
             $buf['body'] .= $res['body'];
             $buf['q'] .= $res['q'] ? $res['q'] : '';
         } else {
             $buf['body'] .= $res;
         }
     }
     // 連鎖のため、範囲外のNGあぼーんチェック
     if ($_conf['ngaborn_chain_all'] && empty($_GET['nong'])) {
         $pre = min($count, $start);
         for ($i = $nofirst ? 0 : 1; $i < $pre; $i++) {
             $n = $i + 1;
             list($name, $mail, $date_id, $msg) = $aThread->explodeDatLine($datlines[$i]);
             if (($id = $aThread->ids[$n]) !== null) {
                 $date_id = str_replace($aThread->idp[$n] . $id, "ID:{$id}", $date_id);
             }
             $this->_ngAbornCheck($n, strip_tags($name), $mail, $date_id, $id, $msg);
         }
     }
     // フィルタリング
     if ($do_filtering) {
         $datlines = $resFilter->apply($this);
         $filter_hits = $resFilter->hits;
         $last_hit_resnum = $resFilter->last_hit_resnum;
     }
     // 指定範囲を表示
     $i = 0;
     $n = 0;
     $rn = 0;
     if ($do_filtering) {
         if (!empty($resFilter->range)) {
             $start = $resFilter->range['start'];
             $to = $resFilter->range['to'];
         }
         $pattern = $resFilter->getPattern();
     } else {
         $pattern = null;
     }
     foreach ($datlines as $i => $ares) {
         if ($ares === null) {
             continue;
         }
         $n++;
         if ($i === 0 && !$nofirst) {
             continue;
         }
         if ($n < $start) {
             continue;
         }
         if ($n > $to) {
             break;
         }
         $rn = $i + 1;
         $res = $this->transRes($ares, $rn, $pattern);
         if (is_array($res)) {
             $buf['body'] .= $res['body'];
             $buf['q'] .= $res['q'] ? $res['q'] : '';
         } else {
             $buf['body'] .= $res;
         }
         if (!$capture && $n % 10 == 0) {
             echo $buf['body'];
             if ($do_filtering && !$is_ktai) {
                 echo "<script type=\"text/javascript\">filterCount({$n});</script>\n";
             }
             flush();
             $buf['body'] = '';
         }
     }
     if ($this->thread->readnum < $rn) {
         $this->thread->readnum = $rn;
     }
     if ($do_filtering && !$is_ktai) {
         $buf['body'] .= "<script type=\"text/javascript\">filterCount({$filter_hits});</script>\n";
     }
     if (!$is_fragment) {
         $buf['body'] .= "</div>\n";
     }
     if ($capture) {
         return $buf['body'] . $buf['q'];
     } else {
         echo $buf['body'];
         echo $buf['q'];
         flush();
         return true;
     }
 }
}
if (($aThread->rescount or $_GET['one'] && !$aThread->diedat) && empty($_GET['renzokupop'])) {
    echo <<<EOP
<div class="navi">{$htm['read_navi_range']}
{$read_navi_previous}
{$read_navi_next}
{$read_navi_latest}
<a href="#footer"{$_conf['k_accesskey_at']['bottom']}>{$_conf['k_accesskey_st']['bottom']}▼</a></div>

EOP;
}
echo "<hr>";
echo "<h3><font color=\"{$STYLE['mobile_read_ttitle_color']}\">{$aThread->ttitle_hd}</font></h3>\n";
$filter_fields = array(ResFilter::FIELD_HOLE => '', ResFilter::FIELD_MESSAGE => 'メッセージが', ResFilter::FIELD_NAME => '名前が', ResFilter::FIELD_MAIL => 'メールが', ResFilter::FIELD_DATE => '日付が', ResFilter::FIELD_ID => 'IDが');
if ($do_filtering) {
    $resFilter = ResFilter::getFilter();
    echo "検索結果: {$filter_fields[$resFilter->field]}";
    echo "&quot;{$hd['word']}&quot;を";
    echo $resFilter->match == ResFilter::MATCH_ON ? '含む' : '含まない';
}
echo '<hr>';
/*
 * 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:
Example #4
0
 /**
  * マッチ結果以外に表示するレスを選択する要素を生成する
  *
  * @param string $id_suffix
  * @param boolean $xhtml
  */
 public static function getIncludeField($id_suffix = null, $xhtml = false)
 {
     $filter = parent::getFilter();
     $fields = parent::$_includes;
     $default = is_object($filter) ? $filter->include : self::INCLUDE_DEFAULT;
     $key = 'include';
     return self::_getSelectField($fields, $default, $key, $id_suffix, $xhtml);
 }