/** * スマートポップアップメニューを生成するJavaScriptコードを生成する */ public function getSpmObjJs($retry = false) { global $_conf, $STYLE; if (isset(self::$_spm_objects[$this->spmObjName])) { return $retry ? self::$_spm_objects[$this->spmObjName] : ''; } $ttitle_en = UrlSafeBase64::encode($this->thread->ttitle); if ($_conf['expack.spm.filter_target'] == '' || $_conf['expack.spm.filter_target'] == 'read') { $_conf['expack.spm.filter_target'] = '_self'; } $motothre_url = $this->thread->getMotoThread(); $motothre_url = substr($motothre_url, 0, strlen($this->thread->ls) * -1); $_spmOptions = array('null', !$_conf['disable_res'] && $_conf['expack.spm.kokores'] ? $_conf['expack.spm.kokores_orig'] ? '2' : '1' : '0', $_conf['expack.spm.ngaborn'] ? $_conf['expack.spm.ngaborn_confirm'] ? '2' : '1' : '0', $_conf['expack.spm.filter'] ? '1' : '0', $this->am_on_spm ? '1' : '0', $_conf['expack.aas.enabled'] ? '1' : '0'); $spmOptions = implode(',', $_spmOptions); // エスケープ $_spm_title = StrCtl::toJavaScript($this->thread->ttitle_hc); $_spm_url = addslashes($motothre_url); $_spm_host = addslashes($this->thread->host); $_spm_bbs = addslashes($this->thread->bbs); $_spm_key = addslashes($this->thread->key); $_spm_ls = addslashes($this->thread->ls); $code = <<<EOJS <script type="text/javascript"> //<![CDATA[ EOJS; if (!count(self::$_spm_objects)) { $code .= sprintf("spmFlexTarget = '%s';\n", StrCtl::toJavaScript($_conf['expack.spm.filter_target'])); if ($_conf['expack.aas.enabled']) { $code .= sprintf("var aas_popup_width = %d;\n", $_conf['expack.aas.default.width'] + 10); $code .= sprintf("var aas_popup_height = %d;\n", $_conf['expack.aas.default.height'] + 10); } } $code .= <<<EOJS var {$this->spmObjName} = { 'objName':'{$this->spmObjName}', 'rc':'{$this->thread->rescount}', 'title':'{$_spm_title}', 'ttitle_en':'{$ttitle_en}', 'url':'{$_spm_url}', 'host':'{$_spm_host}', 'bbs':'{$_spm_bbs}', 'key':'{$_spm_key}', 'ls':'{$_spm_ls}', 'spmOption':[{$spmOptions}] }; SPM.init({$this->spmObjName}); //]]> </script> EOJS; self::$_spm_objects[$this->spmObjName] = $code; return $code; }
/** * DatレスをHTMLレスに変換する * * @access public * @param string $ares datの1ライン * @param integer $i レス番号 * @return string */ function transRes($ares, $i) { global $_conf, $STYLE, $mae_msg; global $ngaborns_head_hits, $ngaborns_body_hits; $tores = ""; $rpop = ""; $resar = $this->thread->explodeDatLine($ares); $name = $resar[0]; $mail = $resar[1]; $date_id = $resar[2]; $msg = $resar[3]; // {{{ フィルタリングカット if (isset($GLOBALS['word']) && strlen($GLOBALS['word']) > 0) { if (strlen($GLOBALS['word_fm']) <= 0) { return ''; // ターゲット設定 } elseif (!($target = $this->getFilterTarget($i, $name, $mail, $date_id, $msg))) { return ''; // マッチング } elseif (!$this->filterMatch($target, $i)) { return ''; } } // }}} // {{{ あぼーんチェック(名前、メール、ID、メッセージ) $aborned_res = "<dt id=\"r{$i}\" class=\"aborned\"><span> </span></dt>\n"; // 名前 $aborned_res .= "<!-- <dd class=\"aborned\"> </dd> -->\n"; // 内容 if (false !== $this->checkAborns($name, $mail, $date_id, $msg)) { return $aborned_res; } // }}} // {{{ NGチェック(名前、メール、ID、メッセージ) $isNgName = false; $isNgMail = false; $isNgId = false; $isNgMsg = false; if (false !== $this->ngAbornCheck('ng_name', strip_tags($name))) { $isNgName = true; } if (false !== $this->ngAbornCheck('ng_mail', $mail)) { $isNgMail = true; } if (false !== $this->ngAbornCheck('ng_id', $date_id)) { $isNgId = true; } if (false !== ($a_ng_msg = $this->ngAbornCheck('ng_msg', $msg))) { $isNgMsg = true; } // }}} // {{{ レスをポップアップ表示 if ($_conf['quote_res_view']) { $quote_res_nums = $this->checkQuoteResNums($i, $name, $msg); foreach ($quote_res_nums as $rnv) { if (empty($this->quote_res_nums_done[$rnv]) and $rnv < count($this->thread->datlines)) { $ds = $this->qRes($this->thread->datlines[$rnv - 1], $rnv); $onPopUp_at = " onMouseover=\"showResPopUp('q{$rnv}of{$this->thread->key}',event,true)\""; $rpop .= "<dd id=\"q{$rnv}of{$this->thread->key}\" class=\"respopup\"{$onPopUp_at}><i>" . $ds . "</i></dd>\n"; $this->quote_res_nums_done[$rnv] = true; } } } // }}} //============================================================= // まとめて出力 //============================================================= $name = $this->transName($name, $i); // 名前HTML変換 $msg = $this->transMsg($msg, $i); // メッセージHTML変換 // BEプロファイルリンク変換 $date_id = $this->replaceBeId($date_id, $i); // HTMLポップアップ if ($_conf['iframe_popup']) { $date_id = preg_replace_callback("{<a href=\"(http://[-_.!~*()a-zA-Z0-9;/?:@&=+\$,%#]+)\"({$_conf['ext_win_target_at']})>((\\?#*)|(Lv\\.\\d+))</a>}", array($this, 'iframe_popup_callback'), $date_id); } $a_ng_msg_hs = htmlspecialchars($a_ng_msg, ENT_QUOTES); // NGメッセージ変換 if ($isNgMsg) { $msg = <<<EOMSG <s class="ngword" onMouseover="document.getElementById('ngm{$ngaborns_body_hits}').style.display = 'block';">NG:{$a_ng_msg_hs}</s> <div id="ngm{$ngaborns_body_hits}" style="display:none;">{$msg}</div> EOMSG; } // NGネーム変換 if ($isNgName) { $name = <<<EONAME <s class="ngword" onMouseover="document.getElementById('ngn{$ngaborns_head_hits}').style.display = 'block';">{$name}</s> EONAME; $msg = <<<EOMSG <div id="ngn{$ngaborns_head_hits}" style="display:none;">{$msg}</div> EOMSG; // NGメール変換 } elseif ($isNgMail) { $mail = <<<EOMAIL <s class="ngword" onMouseover="document.getElementById('ngn{$ngaborns_head_hits}').style.display = 'block';">{$mail}</s> EOMAIL; $msg = <<<EOMSG <div id="ngn{$ngaborns_head_hits}" style="display:none;">{$msg}</div> EOMSG; // NGID変換 } elseif ($isNgId) { $date_id = preg_replace('|ID: ?([0-9A-Za-z/.+]{8,11})|', "<s class=\"ngword\" onMouseover=\"document.getElementById('ngn{$ngaborns_head_hits}').style.display = 'block';\">\\0</s>", $date_id); /* $date_id = <<<EOID <s class="ngword" onMouseover="document.getElementById('ngn{$ngaborns_head_hits}').style.display = 'block';">$date_id</s> EOID; */ $msg = <<<EOMSG <div id="ngn{$ngaborns_head_hits}" style="display:none;">{$msg}</div> EOMSG; } /* //「ここから新着」画像を挿入 if ($i == $this->thread->readnum +1) { $tores .= <<<EOP <div><img src="img/image.png" alt="新着レス" border="0" vspace="4"></div> EOP; } */ // スマートポップアップメニュー if ($_conf['enable_spm']) { $onPopUp_at = " onmouseover=\"showSPM({$this->thread->spmObjName},{$i},'{$id}',event,this)\" onmouseout=\"hideResPopUp('{$this->thread->spmObjName}_spm')\""; } else { $onPopUp_at = ""; } if ($this->thread->onthefly) { $GLOBALS['newres_to_show_flag'] = true; // 番号(オンザフライ時) $tores .= "<dt id=\"r{$i}\"><span class=\"ontheflyresorder\">{$i}</span> :"; } elseif ($i > $this->thread->readnum) { $GLOBALS['newres_to_show_flag'] = true; // 番号(新着レス時) if ($onPopUp_at) { // style=\"cursor:pointer;\" $tores .= "<dt id=\"r{$i}\"><a class=\"resnum\"{$onPopUp_at}><font color=\"{$STYLE['read_newres_color']}\" class=\"newres\">{$i}</font></a> :"; } else { $tores .= "<dt id=\"r{$i}\"><font color=\"{$STYLE['read_newres_color']}\" class=\"newres\">{$i}</font> :"; } } else { // 番号 if ($onPopUp_at) { // style=\"cursor:pointer;\" $tores .= "<dt id=\"r{$i}\"><a href=\"#\" class=\"resnum\"{$onPopUp_at}>{$i}</a> :"; } else { $tores .= "<dt id=\"r{$i}\">{$i} :"; } } // 名前 $tores .= "<span class=\"name\"><b>{$name}</b></span>:"; // メール if ($mail) { if (strstr($mail, "sage") && $STYLE['read_mail_sage_color']) { $tores .= "<span class=\"sage\">{$mail}</span> :"; } elseif ($STYLE['read_mail_color']) { $tores .= "<span class=\"mail\">{$mail}</span> :"; } else { $tores .= $mail . " :"; } } // IDフィルタ if ($_conf['flex_idpopup'] == 1) { if (preg_match('|ID: ?([0-9A-Za-z/.+]{8,11})|', $date_id, $matches)) { $id = $matches[1]; if ($this->thread->idcount[$id] > 1) { $date_id = preg_replace_callback('|ID: ?([0-9A-Za-z/.+]{8,11})|', array($this, 'idfilter_callback'), $date_id); } } } $tores .= $date_id; // 日付とID $tores .= "</dt>\n"; $tores .= $rpop; // レスポップアップ用引用 $tores .= "<dd>{$msg}<br><br></dd>\n"; // 内容 // まとめてフィルタ色分け if (!empty($GLOBALS['word_fm']) && $GLOBALS['res_filter']['match'] != 'off') { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores); } return $tores; }
/** * マッチ判定 * * @param string $target * @param int $resnum * @param boolean $failure * @return boolean */ private function _match($target, $resnum, $failure) { if ($this->method == self::METHOD_AND) { $hits = 0; foreach ($this->_words_fm as $pattern) { if (StrCtl::filterMatch($pattern, $target) == $failure) { if ($failure === false) { return false; } else { $hits++; } } } if ($hits == $this->_words_num) { return false; } } else { if (StrCtl::filterMatch($this->_word_fm, $target) == $failure) { return false; } } return true; }
$GLOBALS['word'] = geti($_POST['word'], geti($_GET['word'])); $GLOBALS['word_fm'] = null; if (strlen($GLOBALS['word'])) { // デフォルトオプション if (empty($GLOBALS['res_filter']['field'])) { $GLOBALS['res_filter']['field'] = "whole"; } if (empty($GLOBALS['res_filter']['match'])) { $GLOBALS['res_filter']['match'] = "on"; } if (empty($GLOBALS['res_filter']['method'])) { $GLOBALS['res_filter']['method'] = "or"; } if (!($GLOBALS['res_filter']['method'] == 'regex' && preg_match('/^\\.+$/', $GLOBALS['word']))) { require_once P2_LIB_DIR . '/StrCtl.php'; $GLOBALS['word_fm'] = StrCtl::wordForMatch($GLOBALS['word'], $GLOBALS['res_filter']['method']); if ($GLOBALS['res_filter']['method'] != 'just') { if (P2_MBREGEX_AVAILABLE == 1) { $GLOBALS['words_fm'] = mb_split('\\s+', $GLOBALS['word_fm']); $GLOBALS['word_fm'] = mb_ereg_replace('\\s+', '|', $GLOBALS['word_fm']); } else { $GLOBALS['words_fm'] = preg_split('/\\s+/', $GLOBALS['word_fm']); $GLOBALS['word_fm'] = preg_replace('/\\s+/', '|', $GLOBALS['word_fm']); } $GLOBALS['word_fm'] = '(?:' . $GLOBALS['word_fm'] . ')'; } } if (UA::isK() || UA::isIPhoneGroup()) { $filter_page = isset($_REQUEST['filter_page']) ? max(1, intval($_REQUEST['filter_page'])) : 1; $_filter_range = array(); $_filter_range['start'] = ($filter_page - 1) * $_conf['k_rnum_range'] + 1;
/** * (パターン)文字列を全角にする * * @static * @access private * @return string */ function getPatternToZen($pattern, $no_escape = false) { $kigou = StrCtl::getKigouPattern($no_escape); // 壊れる // $pattern = str_replace($kigou['han'], $kigou['zen'], $pattern); if (P2_MBREGEX_AVAILABLE == 1) { foreach ($kigou['zen'] as $k => $v) { $word_fm = $kigou['han'][$k]; // preg_quote()で2バイト目が0x5B("[")の"ー"なども変換されてしまうので // UTF-8にしてから正規表現の特殊文字をエスケープ $word_fm = mb_convert_encoding($word_fm, 'UTF-8', 'SJIS-win'); $word_fm = preg_quote($word_fm); $word_fm = mb_convert_encoding($word_fm, 'SJIS-win', 'UTF-8'); $pattern = mb_ereg_replace($word_fm, $kigou['zen'][$k], $pattern); } } $pattern = mb_convert_kana($pattern, 'RNKV'); return $pattern; }
/** * DatレスをHTMLレスに変換する * * @access public * @param string $ares datの1ライン * @param integer $i レス番号 * @return string HTML */ function transRes($ares, $i) { global $STYLE, $mae_msg, $res_filter, $word_fm; global $_conf; $hr = P2View::getHrHtmlK(); $tores = ''; // 返却するレスHTML全体 $rpop = ''; // レスポップアップ用引用 $resar = $this->thread->explodeDatLine($ares); $name = $resar[0]; $mail = $resar[1]; $date_id = $resar[2]; $msg = $resar[3]; // デフォルトの名前は、NG・あぼーんとフィルタ検索の対象外とする $nameForAborn = $name; if (strlen($this->BBS_NONAME_NAME) && $this->BBS_NONAME_NAME == $name) { if (!$_conf['k_bbs_noname_name']) { $nameForAborn = $name = ''; } else { $nameForAborn = ''; } } // 現在の年号は省略カットする。(設定で)月日の先頭0もカット。 if ($_conf['k_date_zerosuppress']) { $date_id = preg_replace('~^(?:' . date('Y') . '|' . date('y') . ')/(?:0(\\d)|(\\d\\d))?(?:(/)0)?~', '$1$2$3', $date_id); } else { $date_id = preg_replace('~^(?:' . date('Y') . '|' . date('y') . ')/~', '$1', $date_id); } // 曜日と時間の間を詰める $date_id = str_replace(') ', ')', $date_id); // 秒もカット if ($_conf['k_clip_time_sec']) { $date_id = preg_replace('/(\\d\\d:\\d\\d):\\d\\d(\\.\\d\\d)?/', '$1', $date_id); } // {{{ フィルタリング if (strlen($GLOBALS['word'])) { if (!strlen($GLOBALS['word_fm'])) { return ''; // ターゲット設定 } elseif (!($target = $this->getFilterTarget($i, $nameForAborn, $mail, $date_id, $msg))) { return ''; // マッチング } elseif (false === $this->filterMatch($target, $i)) { return ''; } } // }}} // {{{ あぼーんチェック(名前、メール、ID、メッセージ) /* $aborned_res = "<div id=\"r{$i}\" name=\"r{$i}\"> </div>\n"; // 名前 $aborned_res .= ""; // 内容 */ $aborned_res = "<span id=\"r{$i}\" name=\"r{$i}\"></span>\n"; if (false !== $this->checkAborns($nameForAborn, $mail, $date_id, $msg)) { return $aborned_res; } // }}} // {{{ NGチェック(名前、メール、ID、メッセージ) $isNgName = false; $isNgMail = false; $isNgId = false; $isNgMsg = false; if (empty($_GET['nong'])) { if ($nameForAborn and false !== $this->ngAbornCheck('ng_name', strip_tags($nameForAborn))) { $isNgName = true; } if (false !== $this->ngAbornCheck('ng_mail', $mail)) { $isNgMail = true; } if (false !== $this->ngAbornCheck('ng_id', $date_id)) { $isNgId = true; } if (false !== ($a_ng_msg = $this->ngAbornCheck('ng_msg', $msg))) { $isNgMsg = true; } } // }}} //============================================================= // まとめて出力 //============================================================= $name = $this->transName($name, $i); // 名前HTML変換 $has_aa = 0; // 1:弱反応, 2:強反応(AA略) $msg = $this->transMsg($msg, $i, $has_aa); // メッセージHTML変換 // BEプロファイルリンク変換 $date_id = $this->replaceBeId($date_id, $i); // NG変換 $kakunin_msg_ht = P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array('host' => $this->thread->host, 'bbs' => $this->thread->bbs, 'key' => $this->thread->key, 'ls' => $i, 'k_continue' => '1', 'nong' => '1', UA::getQueryKey() => UA::getQueryValue())), '確'); // NGメッセージ変換 if ($isNgMsg) { $msg = sprintf('<s><font color="%s">NG:%s</font></s>', $STYLE['read_ngword'], hs($a_ng_msg)); $msg .= ' ' . $kakunin_msg_ht; } // NGネーム変換 if ($isNgName) { $name = sprintf('<s><font color="%s">%s</font></s>', $STYLE['read_ngword'], $name); $msg = $kakunin_msg_ht; // NGメール変換 } elseif ($isNgMail) { $mail = sprintf('<s><font color="%s">%s</font></s>', $STYLE['read_ngword'], $mail); $msg = $kakunin_msg_ht; // NGID変換 } elseif ($isNgId) { $date_id = preg_replace('|ID: ?([0-9A-Za-z/.+]{8,11})|', "<s><font color=\"{$STYLE['read_ngword']}\">\\0</font></s>", $date_id); // $date_id = sprintf('<s><font color="%s">%s</font></s>', $STYLE['read_ngword'], $date_id); $msg = $kakunin_msg_ht; } /* //「ここから新着」画像を挿入 if ($i == $this->thread->readnum +1) { $tores .= "\n" . '<div><img src="img/image.png" alt="新着レス" border="0" vspace="4"></div>' . "\n"; } */ // 番号(オンザフライ時) if ($this->thread->onthefly) { $GLOBALS['newres_to_show_flag'] = true; $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[<font color=\"#00aa00\">{$i}</font>]"; // 番号(新着レス時) } elseif ($i > $this->thread->readnum) { $GLOBALS['newres_to_show_flag'] = true; $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[<font color=\"{$STYLE['read_newres_color']}\">{$i}</font>]"; // 番号 } else { $tores .= "<div id=\"r{$i}\" name=\"r{$i}\">[{$i}]"; } //$tores .= ' '; // 名前 if (strlen($name)) { $tores .= $name; } // メール $is_sage = false; if (strlen($mail)) { if ($mail == 'sage') { $is_sage = true; } else { //$tores .= $mail . " :"; $tores .= ':' . StrSjis::fixSjis($mail); } } if (strlen($name) or strlen($mail) && !$is_sage) { $tores .= ' '; } $no_trim_id_flag = false; // {{ IDフィルタ if ($_conf['flex_idpopup'] == 1) { if (preg_match('|ID: ?([0-9a-zA-Z/.+]{8,11})|', $date_id, $matches)) { $id = $matches[1]; if ($this->thread->idcount[$id] > 1) { $date_id = preg_replace_callback('|ID: ?([0-9A-Za-z/.+]{8,11})|', array($this, 'idfilter_callback'), $date_id); } else { if ($_conf['k_clip_unique_id']) { $date_id = str_replace($matches[0], 'ID:' . substr($matches[0], -1, 1), $date_id); $no_trim_id_flag = true; } } } } // }}} if ($_conf['mobile.id_underline']) { $date_id = preg_replace('!((?:ID: ?)| )([0-9A-Za-z/.+]{10}|[0-9A-Za-z/.+]{8}|\\?\\?\\?)?O(?=[^0-9A-Za-z/.+]|$)!', '$1$2<u>O</u>', $date_id); } if ($_conf['k_clip_unique_id']) { $date_id = str_replace('???', '?', $date_id); } if (!$no_trim_id_flag) { $date_id = preg_replace('/ID: ?/', '', $date_id); } $tores .= $date_id; // 日付とID if ($is_sage) { $tores .= '<font color="#aaaaaa">↓</font>'; } $tores .= "<br>\n"; // 日付とID $tores .= $rpop; // レスポップアップ用引用 $tores .= "{$msg}</div>{$hr}\n"; // 内容 // まとめてフィルタ色分け if (strlen($GLOBALS['word_fm']) && $GLOBALS['res_filter']['match'] != 'off') { if (is_string($_conf['k_filter_marker'])) { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores, $_conf['k_filter_marker']); } else { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores); } } // 全角英数スペースカナを半角に if ($_conf['k_save_packet']) { $tores = mb_convert_kana($tores, 'rnsk'); // SJIS-win だと ask で < を < に変換してしまうようだ } return $tores; }
/** * レスフィルタリングのマッチ判定 * * @access private * @return string|false マッチしたらマッチ文字列(「含まない」条件の時はtrue)を、マッチしなかったらfalseを返す * (単純にbooleanを返すようにしてもいいかもしれない) */ function filterMatch($target, $resnum) { global $_conf; global $_filter_hits, $_filter_range; $failed = $GLOBALS['res_filter']['match'] == 'off' ? true : false; if ($GLOBALS['res_filter']['method'] == 'and') { $words_fm_hit = 0; foreach ($GLOBALS['words_fm'] as $word_fm_ao) { $match = StrCtl::filterMatch($word_fm_ao, $target); if ((bool) strlen($match) == $failed) { if ($GLOBALS['res_filter']['match'] != 'off') { return false; } else { $words_fm_hit++; } } } if ($words_fm_hit == count($GLOBALS['words_fm'])) { return false; } } else { $match = StrCtl::filterMatch($GLOBALS['word_fm'], $target); if ((bool) strlen($match) == $failed) { return false; } } $GLOBALS['_filter_hits']++; // 表示範囲外なら偽判定とする if (isset($GLOBALS['word']) && !empty($_filter_range) && ($_filter_hits < $_filter_range['start'] || $_filter_hits > $_filter_range['to'])) { return false; } $GLOBALS['last_hit_resnum'] = $resnum; // 逐次更新用 if (!$_conf['ktai']) { echo <<<EOP <script type="text/javascript"> <!-- filterCount({$GLOBALS['_filter_hits']}); --> </script> EOP; } return $failed ? !(bool) $match : $match; }
/** * スマートポップアップメニューに必要なスレッド情報を格納したJavaScriptコードを取得 */ public function getSpmObjJs($retry = false) { global $_conf; if (isset(self::$_spm_objects[$this->spmObjName])) { return $retry ? self::$_spm_objects[$this->spmObjName] : ''; } $ttitle_en = UrlSafeBase64::encode($this->thread->ttitle); $motothre_url = $this->thread->getMotoThread(); $motothre_url = substr($motothre_url, 0, strlen($this->thread->ls) * -1); // エスケープ $_spm_title = StrCtl::toJavaScript($this->thread->ttitle_hc); $_spm_url = addslashes($motothre_url); $_spm_host = addslashes($this->thread->host); $_spm_bbs = addslashes($this->thread->bbs); $_spm_key = addslashes($this->thread->key); $_spm_ls = addslashes($this->thread->ls); $_spm_b = $_conf['view_forced_by_query'] ? "&b={$_conf['b']}" : ''; $code = <<<EOJS <script type="text/javascript"> //<![CDATA[ var {$this->spmObjName} = { 'objName':'{$this->spmObjName}', 'query':'&host={$_spm_host}&bbs={$_spm_bbs}&key={$_spm_key}&rescount={$this->thread->rescount}&ttitle_en={$ttitle_en}{$_spm_b}', 'rc':'{$this->thread->rescount}', 'title':'{$_spm_title}', 'ttitle_en':'{$ttitle_en}', 'url':'{$_spm_url}', 'host':'{$_spm_host}', 'bbs':'{$_spm_bbs}', 'key':'{$_spm_key}', 'ls':'{$_spm_ls}', 'client':['{$_conf['b']}','{$_conf['client_type']}'] }; {$this->spmObjName}.show = (function(no,id,evt){SPM.show({$this->spmObjName},no,id,evt);}); {$this->spmObjName}.hide = SPM.hide; // (function(evt){SPM.hide(evt);}); //]]> </script> EOJS; self::$_spm_objects[$this->spmObjName] = $code; return $code; }
/** * スレタイ(と本文)でマッチしたらtrueを返す * * @return boolean */ function matchSbFilter(&$aThread) { // 全文検索でdatがあれば、内容を読み込む if (!empty($_REQUEST['find_cont']) && file_exists($aThread->keydat)) { $dat_cont = file_get_contents($aThread->keydat); } if ($GLOBALS['sb_filter']['method'] == "and") { reset($GLOBALS['words_fm']); foreach ($GLOBALS['words_fm'] as $word_fm_ao) { // 全文検索でdatがあれば、内容を検索 if (!empty($_REQUEST['find_cont']) && file_exists($aThread->keydat)) { // be.2ch.net はEUC if (P2Util::isHostBe2chNet($aThread->host)) { $target_cont = mb_convert_encoding($word_fm_ao, 'eucJP-win', 'SJIS-win'); } if (!StrCtl::filterMatch($target_cont, $dat_cont)) { return false; } // スレタイを検索 } elseif (!StrCtl::filterMatch($word_fm_ao, $aThread->ttitle)) { return false; } } } else { // 全文検索でdatがあれば、内容を検索 if (!empty($_REQUEST['find_cont']) && file_exists($aThread->keydat)) { $target_cont = $GLOBALS['word_fm']; // be.2ch.net はEUC if (P2Util::isHostBe2chNet($aThread->host)) { $target_cont = mb_convert_encoding($target_cont, 'eucJP-win', 'SJIS-win'); } if (!StrCtl::filterMatch($target_cont, $dat_cont)) { return false; } // スレタイだけ検索 } elseif (!StrCtl::filterMatch($GLOBALS['word_fm'], $aThread->ttitle)) { return false; } } return true; }
} } // }}} // {{{ 書き込みプレビュー $htm['dpreview_onoff'] = ''; $htm['dpreview_amona'] = ''; $htm['dpreview'] = ''; $htm['dpreview2'] = ''; if (!$_conf['ktai'] && $_conf['expack.editor.dpreview']) { $_dpreview_noname = 'null'; if (P2Util::isHost2chs($host)) { $_dpreview_st = new SettingTxt($host, $bbs); $_dpreview_st->setSettingArray(); if (!empty($_dpreview_st->setting_array['BBS_NONAME_NAME'])) { $_dpreview_noname = $_dpreview_st->setting_array['BBS_NONAME_NAME']; $_dpreview_noname = '"' . StrCtl::toJavaScript($_dpreview_noname) . '"'; } } $_dpreview_hide = 'false'; if ($_conf['expack.editor.dpreview'] == 2) { if (P2Util::isBrowserSafariGroup() && basename($_SERVER['SCRIPT_NAME']) != 'post_form.php') { $_dpreview_hide = 'true'; } $_dpreview_pos = 'dpreview2'; } else { $_dpreview_pos = 'dpreview'; } $htm[$_dpreview_pos] = <<<EOP <script type="text/javascript" src="js/strutil.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/dpreview.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript">
// RSS //================================================================ // rssファイルがなければ生成 FileCtl::make_datafile($_conf['expack.rss.setting_path'], $_conf['expack.rss.setting_perm']); // rss読み込み $myrss = array(); $i = 0; if ($lines = FileCtl::file_read_lines($_conf['expack.rss.setting_path'], FILE_IGNORE_NEW_LINES)) { foreach ($lines as $l) { $p = explode("\t", $l); if (count($p) > 1) { $site = $p[0]; $xml = $p[1]; $atom = !empty($p[2]) ? '1' : '0'; $site_en = UrlSafeBase64::encode($site); $myrss["li{$i}"] = array('site' => $site, 'site_en' => $site_en, 'site_view' => htmlspecialchars($site, ENT_QUOTES), 'site_ht' => "&site_en={$site_en}", 'xml' => $xml, 'xml_en' => rawurlencode($xml), 'atom' => $atom, 'value' => StrCtl::toJavaScript("{$site}\t{$xml}\t{$atom}")); $i++; } } } // PC用 if (!$_conf['ktai'] and !empty($lines)) { ?> <script type="text/javascript"> //<![CDATA[ // var gLogger = new ygLogger("test_noimpl.php"); var dd = [] var gVarObj = new Object(); function dragDropInit() { var i = 0;
/** * p2_wakati()の結果等、キーワードの配列からハイライト用の正規表現を生成する * * @param array $words * @return string */ function p2_get_highlighting_regex(array $words) { $featured_words = array_filter($words, '_p2_get_highlighting_regex_filter'); if (count($featured_words) == 0) { $featured_words = $words; } //rsort($featured_words, SORT_STRING); $pattern = mb_convert_encoding(implode(' ', $featured_words), 'SJIS-win', 'UTF-8'); return str_replace(' ', '|', StrCtl::wordForMatch($pattern, 'or')); }
/** * レス引用HTMLを生成取得する * * @access private * @param string $resline * @return string */ function qRes($resline, $i, $hideid) { global $_conf; $resar = $this->thread->explodeDatLine($resline); $name = isset($resar[0]) ? $resar[0] : ''; $mail = isset($resar[1]) ? $resar[1] : ''; $date_id = isset($resar[2]) ? $resar[2] : ''; $msg = isset($resar[3]) ? $resar[3] : ''; if (!empty($this->BBS_NONAME_NAME) and $this->BBS_NONAME_NAME == $name) { $name = ''; } // 現在の年号は省略カットする。月日の先頭0もカット。 if ($_conf['k_date_zerosuppress']) { $date_id = preg_replace('~^(?:' . date('Y') . '|' . date('y') . ')/(?:0(\\d)|(\\d\\d))?(?:(/)0)?~', '$1$2$3', $date_id); } else { $date_id = preg_replace('~^(?:' . date('Y') . '|' . date('y') . ')/~', '$1', $date_id); } // 曜日と時間の間を詰める $date_id = str_replace(') ', ')', $date_id); // 秒もカット if ($_conf['k_clip_time_sec']) { $date_id = preg_replace('/(\\d\\d:\\d\\d):\\d\\d(\\.\\d\\d)?/', '$1', $date_id); } // あぼーんチェック if (false !== $this->checkAborns($name, $mail, $date_id, $msg)) { $name = $date_id = $msg = 'あぼーん'; $mail = ''; } else { $isNgName = false; $isNgMail = false; $isNgId = false; $isNgMsg = false; if (false !== $this->ngAbornCheck('ng_name', strip_tags($name))) { $isNgName = true; } if (false !== $this->ngAbornCheck('ng_mail', $mail)) { $isNgMail = true; } if (false !== $this->ngAbornCheck('ng_id', $date_id)) { $isNgId = true; } if (false !== ($a_ng_msg = $this->ngAbornCheck('ng_msg', $msg))) { $isNgMsg = true; } $name = $this->transName($name, $i); $has_aa = 0; // 1:弱反応, 2:強反応(AA略) $msg = $this->transMsg($msg, $i, $has_aa); // メッセージ変換 // BEプロファイルリンク変換 $date_id = $this->replaceBeId($date_id, $i); $a_ng_msg_hs = htmlspecialchars($a_ng_msg, ENT_QUOTES); // NG変換 $kakunin_msg_ht = <<<EOP <a href="{$_conf['read_php']}?host={$this->thread->host}&bbs={$this->thread->bbs}&key={$this->thread->key}&ls={$i}&k_continue=1&nong=1{$_conf['k_at_a']}">確</a> EOP; // NGメッセージ変換 if ($isNgMsg) { $msg = <<<EOMSG <s><font color="{$STYLE['read_ngword']}">NG:{$a_ng_msg_hs}</font></s> {$kakunin_msg_ht} EOMSG; } // NGネーム変換 if ($isNgName) { $name = <<<EONAME <s><font color="{$STYLE['read_ngword']}">{$name}</font></s> EONAME; $msg = $kakunin_msg_ht; // NGメール変換 } elseif ($isNgMail) { $mail = <<<EOMAIL <s><font color="{$STYLE['read_ngword']}">{$mail}</font></s> EOMAIL; $msg = $kakunin_msg_ht; // NGID変換 } elseif ($isNgId) { $date_id = preg_replace('|ID: ?([0-9A-Za-z/.+]{8,11})|', "<s><font color=\"{$STYLE['read_ngword']}\">\\0</font></s>", $date_id); /* $date_id = <<<EOID <s><font color="{$STYLE['read_ngword']}">$date_id</font></s> EOID; */ $msg = $kakunin_msg_ht; } // IDフィルタ if ($_conf['flex_idpopup'] == 1) { if (preg_match('|ID: ?([0-9a-zA-Z/.+]{8,11})|', $date_id, $matches)) { $id = $matches[1]; if ($this->thread->idcount[$id] > 1) { $date_id = preg_replace_callback('|ID: ?([0-9A-Za-z/.+]{8,11})|', array($this, 'idfilter_callback'), $date_id); } else { if ($_conf['k_clip_unique_id']) { $date_id = str_replace($matches[0], 'ID:' . substr($matches[0], -1, 1), $date_id); $no_trim_id_flag = true; } } } } } // $toresにまとめて出力 //$tores = "<input type=\"submit\" value=\"閉じる\" onClick=\"hideResPopUp('{$hideid}')\"><br>\n"; $tores = "<img class=\"close\" src=\"iui/icon_close.png\" onClick=\"hideResPopUp('{$hideid}')\">\n"; $tores .= " {$i} :"; // 番号 $tores .= "<b>{$name}</b> :"; // 名前 if ($mail) { $tores .= $mail . " :"; } // メール if ($_conf['mobile.id_underline']) { $date_id = preg_replace('!(ID: ?)([0-9A-Za-z/.+]{10}|[0-9A-Za-z/.+]{8}|\\?\\?\\?)?O(?=[^0-9A-Za-z/.+]|$)!', '$1$2<u>O</u>', $date_id); } if ($_conf['k_clip_unique_id']) { $date_id = str_replace('???', '?', $date_id); } if (!$no_trim_id_flag) { $date_id = preg_replace('/ID: ?/', '', $date_id); } $tores .= '<span class="tdate">' . $date_id . '</span>'; if ($is_sage) { $tores .= '<font color="#aaaaaa">↓</font>'; } $tores .= "<br>\n"; // 日付とID $tores .= "{$msg}\n"; // 内容 iPhone用にhr削除 // まとめてフィルタ色分け if ($GLOBALS['word_fm'] && $GLOBALS['res_filter']['match'] != 'off') { if (is_string($_conf['k_filter_marker'])) { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores, $_conf['k_filter_marker']); } else { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores); } } // 全角英数スペースカナを半角に if ($_conf['k_save_packet']) { $tores = mb_convert_kana($tores, 'rnsk'); // SJIS-win だと ask で < を < に変換してしまうようだ } return $tores; }
/** * レス引用HTMLを生成取得する * * @access private * @param string $resline * @return string */ function qRes($resline, $i, $hideid) { global $_conf; $resar = $this->thread->explodeDatLine($resline); $name = isset($resar[0]) ? $resar[0] : ''; $mail = isset($resar[1]) ? $resar[1] : ''; $date_id = isset($resar[2]) ? $resar[2] : ''; $msg = isset($resar[3]) ? $resar[3] : ''; // デフォルトの名前は、NG・あぼーんとフィルタ検索の対象外とする $nameForAborn = $name; if (strlen($this->BBS_NONAME_NAME) && $this->BBS_NONAME_NAME == $name) { if (!$_conf['k_bbs_noname_name']) { $nameForAborn = $name = ''; } else { $nameForAborn = ''; } } // 現在の年号は省略カットする。月日の先頭0もカット。 if ($_conf['k_date_zerosuppress']) { $date_id = preg_replace('~^(?:' . date('Y') . '|' . date('y') . ')/(?:0(\\d)|(\\d\\d))?(?:(/)0)?~', '$1$2$3', $date_id); } else { $date_id = preg_replace('~^(?:' . date('Y') . '|' . date('y') . ')/~', '$1', $date_id); } // 曜日と時間の間を詰める $date_id = str_replace(') ', ')', $date_id); // 秒もカット if ($_conf['k_clip_time_sec']) { $date_id = preg_replace('/(\\d\\d:\\d\\d):\\d\\d(\\.\\d\\d)?/', '$1', $date_id); } // あぼーんチェック if (false !== $this->checkAborns($nameForAborn, $mail, $date_id, $msg)) { $name = $date_id = $msg = 'あぼーん'; $mail = ''; } else { $isNgName = false; $isNgMail = false; $isNgId = false; $isNgMsg = false; if (strlen($nameForAborn) and false !== $this->ngAbornCheck('ng_name', strip_tags($nameForAborn))) { $isNgName = true; } if (false !== $this->ngAbornCheck('ng_mail', $mail)) { $isNgMail = true; } if (false !== $this->ngAbornCheck('ng_id', $date_id)) { $isNgId = true; } if (false !== ($a_ng_msg = $this->ngAbornCheck('ng_msg', $msg))) { $isNgMsg = true; } $name = $this->transName($name, $i); $has_aa = 0; // 1:弱反応, 2:強反応(AA略) $msg = $this->transMsg($msg, $i, $has_aa); // メッセージ変換 // BEプロファイルリンク変換 $date_id = $this->replaceBeId($date_id, $i); // NG変換 $kakunin_msg_ht = P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array('host' => $this->thread->host, 'bbs' => $this->thread->bbs, 'key' => $this->thread->key, 'ls' => $i, 'k_continue' => '1', 'nong' => '1', UA::getQueryKey() => UA::getQueryValue())), '確'); // NGメッセージ変換 if ($isNgMsg) { $msg = sprintf('<s><font color="%s">NG:%s</font></s>', $STYLE['read_ngword'], hs($a_ng_msg)); $msg .= ' ' . $kakunin_msg_ht; } // NGネーム変換 if ($isNgName) { $name = sprintf('<s><font color="%s">%s</font></s>', $STYLE['read_ngword'], $name); $msg = $kakunin_msg_ht; // NGメール変換 } elseif ($isNgMail) { $mail = sprintf('<s><font color="%s">%s</font></s>', $STYLE['read_ngword'], $mail); $msg = $kakunin_msg_ht; // NGID変換 } elseif ($isNgId) { $date_id = preg_replace('|ID: ?([0-9A-Za-z/.+]{8,11})|', "<s><font color=\"{$STYLE['read_ngword']}\">\\0</font></s>", $date_id); // $date_id = sprintf('<s><font color="%s">%s</font></s>', $STYLE['read_ngword'], $date_id); $msg = $kakunin_msg_ht; } // IDフィルタ if ($_conf['flex_idpopup'] == 1) { if (preg_match('|ID: ?([0-9a-zA-Z/.+]{8,11})|', $date_id, $matches)) { $id = $matches[1]; if ($this->thread->idcount[$id] > 1) { $date_id = preg_replace_callback('|ID: ?([0-9A-Za-z/.+]{8,11})|', array($this, 'idfilter_callback'), $date_id); } else { if ($_conf['k_clip_unique_id']) { $date_id = str_replace($matches[0], 'ID:' . substr($matches[0], -1, 1), $date_id); $no_trim_id_flag = true; } } } } } // $toresにまとめて出力 //$tores = "<input type=\"submit\" value=\"閉じる\" onClick=\"hideResPopUp('{$hideid}')\"><br>\n"; $tores = "<img class=\"close\" src=\"iui/icon_close.png\" onClick=\"hideResPopUp('{$hideid}')\">\n"; $tores .= " {$i} :"; // 番号 // 名前 //$tores .= "<b>$name</b> :"; if (strlen($name) > 0) { $tores .= '<span class="tname">' . $name . '</span> :'; } if ($mail) { $tores .= $mail . " :"; } // メール if ($_conf['mobile.id_underline']) { $date_id = preg_replace('!(ID: ?)([0-9A-Za-z/.+]{10}|[0-9A-Za-z/.+]{8}|\\?\\?\\?)?O(?=[^0-9A-Za-z/.+]|$)!', '$1$2<u>O</u>', $date_id); } if ($_conf['k_clip_unique_id']) { $date_id = str_replace('???', '?', $date_id); } if (!$no_trim_id_flag) { $date_id = preg_replace('/ID: ?/', '', $date_id); } $tores .= '<span class="tdate">' . $date_id . '</span>'; /* if ($is_sage) { $tores .= '<font color="#aaaaaa">↓</font>'; } */ $tores .= "<br>\n"; // 日付とID $tores .= "{$msg}\n"; // 内容 iPhone用にhr削除 // まとめてフィルタ色分け if ($GLOBALS['word_fm'] && $GLOBALS['res_filter']['match'] != 'off') { if (is_string($_conf['k_filter_marker'])) { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores, $_conf['k_filter_marker']); } else { $tores = StrCtl::filterMarking($GLOBALS['word_fm'], $tores); } } // 全角英数スペースカナを半角に if ($_conf['k_save_packet']) { $tores = mb_convert_kana($tores, 'rnsk'); // SJIS-win だと ask で < を < に変換してしまうようだ } return $tores; }
/** * データを読み込んで、カテゴリと板を登録する * * @access public * @return void */ function setBrdList($data) { global $_conf; if (empty($data)) { return; } // 除外URLリスト $not_bbs_list = array('http://members.tripod.co.jp/Backy/del_2ch/'); foreach ($data as $v) { $v = rtrim($v); // カテゴリを探す if (preg_match($this->cate_match, $v, $matches)) { $aBrdMenuCate = new BrdMenuCate($matches[1]); if ($this->format == 'brd') { $aBrdMenuCate->is_open = (bool) $matches[2]; } $this->addBrdMenuCate($aBrdMenuCate); // 板を探す } elseif (preg_match($this->ita_match, $v, $matches)) { // html形式なら除外URLを外す if ($this->format == 'html') { foreach ($not_bbs_list as $not_a_bbs) { if ($not_a_bbs == $matches[1]) { continue 2; } } } $aBrdMenuIta = new BrdMenuIta(); // html形式 if ($this->format == 'html') { $aBrdMenuIta->host = $matches[2]; $aBrdMenuIta->bbs = $matches[3]; $itaj_match = $matches[6]; // brd形式 } else { $aBrdMenuIta->host = $matches[1]; $aBrdMenuIta->bbs = $matches[2]; $itaj_match = $matches[3]; } $aBrdMenuIta->setItaj(rtrim($itaj_match)); // {{{ 板検索マッチ // and検索 if ($GLOBALS['words_fm']) { $no_match = false; foreach ($GLOBALS['words_fm'] as $word_fm_ao) { $target = $aBrdMenuIta->itaj . "\t" . $aBrdMenuIta->bbs; if (false === StrCtl::filterMatch($word_fm_ao, $target)) { $no_match = true; } } if (!$no_match) { $this->categories[$this->num - 1]->ita_match_num++; if (isset($GLOBALS['ita_mikke']['num'])) { $GLOBALS['ita_mikke']['num']++; } else { $GLOBALS['ita_mikke']['num'] = 1; } $GLOBALS['ita_mikke']['host'] = $aBrdMenuIta->host; $GLOBALS['ita_mikke']['bbs'] = $aBrdMenuIta->bbs; $GLOBALS['ita_mikke']['itaj_en'] = $aBrdMenuIta->itaj_en; // マーキング if ($_conf['ktai'] && is_string($_conf['k_filter_marker'])) { $aBrdMenuIta->itaj_ht = StrCtl::filterMarking($GLOBALS['word_fm'], $aBrdMenuIta->itaj, $_conf['k_filter_marker']); } else { $aBrdMenuIta->itaj_ht = StrCtl::filterMarking($GLOBALS['word_fm'], $aBrdMenuIta->itaj); } // マッチマーキングなければ(bbsでマッチしたとき)、全部マーキング if ($aBrdMenuIta->itaj_ht == $aBrdMenuIta->itaj) { $aBrdMenuIta->itaj_ht = '<b class="filtering">' . $aBrdMenuIta->itaj_ht . '</b>'; } // 検索が見つからなくて、さらに携帯の時 } else { if ($_conf['ktai']) { continue; } } } // }}} if ($this->num) { $this->categories[$this->num - 1]->addBrdMenuIta($aBrdMenuIta); } } } // foreach }
// $GLOBALS['word'] などの検索語の取り扱いがどさくさなのは、できれば整理したいところ... $GLOBALS['word_fm'] = null; if (isset($GLOBALS['word']) && strlen($GLOBALS['word']) > 0) { // デフォルトオプション if (empty($res_filter['field'])) { $res_filter['field'] = "hole"; } if (empty($res_filter['match'])) { $res_filter['match'] = "on"; } if (empty($res_filter['method'])) { $res_filter['method'] = "or"; } if (!($res_filter['method'] == 'regex' && preg_match('/^\\.+$/', $GLOBALS['word']))) { require_once P2_LIB_DIR . '/strctl.class.php'; $GLOBALS['word_fm'] = StrCtl::wordForMatch($word, $res_filter['method']); if ($res_filter['method'] != 'just') { if (P2_MBREGEX_AVAILABLE == 1) { $GLOBALS['words_fm'] = mb_split('\\s+', $GLOBALS['word_fm']); $GLOBALS['word_fm'] = mb_ereg_replace('\\s+', '|', $GLOBALS['word_fm']); } else { $GLOBALS['words_fm'] = preg_split('/\\s+/', $GLOBALS['word_fm']); $GLOBALS['word_fm'] = preg_replace('/\\s+/', '|', $GLOBALS['word_fm']); } } } if ($_conf['ktai']) { $filter_page = isset($_REQUEST['filter_page']) ? max(1, intval($_REQUEST['filter_page'])) : 1; $filter_range = array(); $filter_range['start'] = ($filter_page - 1) * $_conf['k_rnum_range'] + 1; $filter_range['to'] = $filter_range['start'] + $_conf['k_rnum_range'] - 1;
$active_tab1_js = "'" . StrCtl::toJavaScript($active_tab1) . "'"; } else { $active_tab1 = null; $active_tab1_ht = ''; $active_tab1_js = 'null'; } if (isset($_REQUEST['active_tab2'])) { $active_tab2 = $_REQUEST['active_tab2']; $active_tab2_ht = p2h($active_tab2); $active_tab2_js = "'" . StrCtl::toJavaScript($active_tab2) . "'"; } else { $active_tab2 = null; $active_tab2_ht = ''; $active_tab2_js = 'null'; } $parent_tabs_js = "['" . implode("','", array(StrCtl::toJavaScript('rep2基本設定'), StrCtl::toJavaScript('携帯端末設定'), StrCtl::toJavaScript('拡張パック設定'))) . "']"; $active_tab_hidden_ht = <<<EOP <input type="hidden" id="active_tab1" name="active_tab1" value="{$active_tab1_ht}"> <input type="hidden" id="active_tab2" name="active_tab2" value="{$active_tab2_ht}"> <script type="text/javascript"> // <![CDATA[ _EDIT_CONF_USER_JS_PARENT_TABS = {$parent_tabs_js}; _EDIT_CONF_USER_JS_ACTIVE_TAB1 = {$active_tab1_js}; _EDIT_CONF_USER_JS_ACTIVE_TAB2 = {$active_tab2_js}; // ]]> </script> EOP; } $groups = array(); $keep_old = false; // }}}
FileCtl::make_datafile($_conf['favita_brd']); // favita読み込み $lines = FileCtl::file_read_lines($_conf['favita_brd'], FILE_IGNORE_NEW_LINES); $okini_itas = array(); $i = 0; if (is_array($lines)) { foreach ($lines as $l) { if (preg_match("/^\t?(.+?)\t(.+?)\t(.+?)\$/", $l, $matches)) { $id = "li{$i}"; $okini_itas[$id]['itaj'] = $itaj = rtrim($matches[3]); $okini_itas[$id]['itaj_en'] = $itaj_en = UrlSafeBase64::encode($itaj); $okini_itas[$id]['host'] = $host = $matches[1]; $okini_itas[$id]['bbs'] = $bbs = $matches[2]; $okini_itas[$id]['itaj_view'] = p2h($itaj); $okini_itas[$id]['itaj_ht'] = "&itaj_en=" . $itaj_en; $okini_itas[$id]['value'] = StrCtl::toJavaScript("{$host}@{$bbs}@{$itaj_en}"); $i++; } } } // PC用 if (!$_conf['ktai'] and !empty($lines)) { ?> <script type="text/javascript"> //<![CDATA[ // var gLogger = new ygLogger("test_noimpl.php"); var dd = [] var gVarObj = new Object(); function dragDropInit() { var i = 0;
/** * スレタイ(と本文)でマッチしたらtrueを返す */ function matchSbFilter(Thread $aThread) { // 全文検索でdatがあれば、内容を読み込む if (!empty($_REQUEST['find_cont'])) { if (file_exists($aThread->keydat)) { $subject = file_get_contents($aThread->keydat); // be.2ch.net はEUC if (P2Util::isHostBe2chNet($aThread->host)) { $subject = mb_convert_encoding($subject, 'CP932', 'CP51932'); } } else { return false; } } else { $subject = $aThread->ttitle; } if ($GLOBALS['sb_filter']['method'] == 'and') { foreach ($GLOBALS['words_fm'] as $word) { if (!StrCtl::filterMatch($word, $subject)) { return false; } } } else { if (!StrCtl::filterMatch($GLOBALS['word_fm'], $subject)) { return false; } } return true; }
/** * 板検索(スレタイ検索)のwordクエリーがあればパースする * $GLOBALS['word'], $GLOBALS['words_fm'], $GLOBALS['word_fm'] をセットする * * @static * @access public * @return void */ function parseWord() { $GLOBALS['word'] = null; $GLOBALS['words_fm'] = null; $GLOBALS['word_fm'] = null; if (isset($_GET['word'])) { $word = $_GET['word']; } elseif (isset($_POST['word'])) { $word = $_POST['word']; } if (!isset($word) || strlen($word) == 0) { return; } /* // 特別に除外する条件 // 何でもマッチしてしまう正規表現 if (preg_match('/^\.+$/', $word)) { return; } */ require_once P2_LIB_DIR . '/StrCtl.php'; // and検索でよろしく(正規表現ではない) $word_fm = StrCtl::wordForMatch($word, 'and'); if (P2_MBREGEX_AVAILABLE == 1) { $GLOBALS['words_fm'] = mb_split('\\s+', $word_fm); $GLOBALS['word_fm'] = mb_ereg_replace('\\s+', '|', $word_fm); } else { $GLOBALS['words_fm'] = preg_split('/\\s+/', $word_fm); $GLOBALS['word_fm'] = preg_replace('/\\s+/', '|', $word_fm); } $GLOBALS['word'] = $word; }