|
1: 2007-06-21 (木) 17:27:30 nao-pon |
| + | #nopagecomment |
| + | #navi(../) |
| + | * HypCommonPreLoad (えっちわいぴー・こもん・ぷりろーど) [#g3254c0b] |
| | | |
| + | |
| + | アクセス元の検索ワード&エンジン名取得や、検索語のハイライト表示機能、スパム投稿フィルターを組み込む XOOPS Cube 用の Preload Class です。 |
| + | |
| + | XOOPS_ROOT_PATH/include/common.php に組み込むことで、XOOPS 2 にも対応できます。 |
| + | |
| + | ** 組み込み手順 [#qf6be9b3] |
| + | |
| + | + なにはともあれ、HypCommonFunc を組み込んでください。 |
| + | + サーバー上に XOOPS_ROOT_PATH/cache2/kakasi というディレクトリを作成してファイル作成権限を与えてください。 |
| + | |
| + | *** XOOPS Cube の場合 [#zf014fd9] |
| + | + Cube の XOOPS_ROOT_PATH/preload ディレクトリに アーカイブの html/preload/HypCommonPreLoad.class.php をアップロードしてください。 |
| + | + 完了! |
| + | |
| + | *** XOOPS 2 の場合 [#o79d4795] |
| + | |
| + | + 以前に [[HypCommonFunc>../HypCommonFunc]], [[検索語マーカー>../検索語マーカー]], [[BBQあらしお断りシステム>../BBQあらしお断りシステム]] などを 組み込んでいた場合は、common.php を元の状態に戻します。 |
| + | + [[../検索語マーカー]] を組み込んでいた場合は、XOOPS_ROOT_PATH/footer.php を元の状態に戻します。 |
| + | + XOOPS_ROOT_PATH/include/common.php を編集します。 |
| + | // ############## Include common functions file ############## |
| + | include_once XOOPS_ROOT_PATH.'/include/functions.php'; |
| + | の&font(Red,b){下};に |
| + | // ############# Set Query Words & Load HypCommonFunction Class ############# |
| + | include_once XOOPS_TRUST_PATH . '/class/hyp_common/preload/hyp_preload.php'; |
| + | $HypCommonPreLoad = @ new HypCommonPreLoad(); |
| + | $HypCommonPreLoad->preFilter(); |
| + | を挿入。 |
| + | if (file_exists('./xoops_version.php')) { |
| + | の&font(Red,b){上};に |
| + | // ############# POST Filter with HypCommonPreLoad ############# |
| + | $HypCommonPreLoad->postFilter(); |
| + | を挿入。 |
| + | |
| + | 以上で完了! |
| + | |
| + | ん〜なんだか面倒だな。って思う人用に 編集済みの &ref(common.php); を用意しました。 :D |
| + | |
| + | ** 設定方法 [#y8348a4c] |
| + | |
| + | -設定を変えるには XOOPS_TRUST_PATH/class/hyp_common/preload/hyp_preload.conf.php.rename を hyp_preload.conf.php にリネームしてその内容を編集します。~ |
| + | また、このファイルは html側の XOOPS_ROOT_PATH/class/hyp_common ディレクトリに置くこともできます。その場合は html側 が優先されますので、サイトごとに設定を変えることも可能です。~ |
| + | 設定箇所は以下の部分です。 |
| + | |
| + | #code(php){{ |
| + | // 各種設定 |
| + | $this->use_set_query_words = 1; // 検索ワードを定数にセット |
| + | $this->use_words_highlight = 1; // 検索ワードをハイライト表示 |
| + | |
| + | $this->use_proxy_check = 1; // POST時プロキシチェックする |
| + | $this->no_proxy_check = '/^(127\.0\.0\.1|192\.168\.1\.)/'; // 除外IP |
| + | $this->msg_proxy_check = '公開プロキシ経由での投稿はできません。'; |
| + | |
| + | $this->use_dependence_filter = 1; // 機種依存文字フィルター |
| + | |
| + | // POST SPAM |
| + | $this->use_post_spam_filter = 1; // POST SPAM フィルター |
| + | $this->use_mail_notify = 1; // POST SPAM メール通知 0:なし, 1:SPAM判定のみ, 2:すべて |
| + | $this->post_spam_a = 1; // <a> タグ 1個あたりのポイント |
| + | $this->post_spam_bb = 1; // BBリンク 1個あたりのポイント |
| + | $this->post_spam_url = 1; // URL 1個あたりのポイント |
| + | $this->post_spam_host = 31; // Spam HOST の加算ポイント |
| + | $this->post_spam_word = 10; // Spam Word の加算ポイント |
| + | $this->post_spam_filed = 31; // Spam 無効フィールドの加算ポイント |
| + | $this->post_spam_trap = '___url';// Spam 罠用無効フィールド名 |
| + | $this->post_spam_trap_set = 1; // 無効フィールドの罠を自動で仕掛ける |
| + | |
| + | $this->post_spam_user = 30; // POST SPAM 閾値: ログインユーザー |
| + | $this->post_spam_guest = 15; // POST SPAM 閾値: ゲスト |
| + | |
| + | // 検索ワード定数名 |
| + | $this->q_word = 'XOOPS_QUERY_WORD'; // 検索ワード |
| + | $this->q_word2 = 'XOOPS_QUERY_WORD2'; // 検索ワード分かち書き |
| + | $this->se_name = 'XOOPS_SEARCH_ENGINE_NAME'; // 検索元名 |
| + | |
| + | // KAKASI のパスは、XOOPS_TRUST_PATH/class/hyp_common/hyp_kakasi.php で |
| + | // 設定する。規定値: '/usr/bin/kakasi' |
| + | |
| + | // KAKASI での分かち書き結果のキャッシュ先 |
| + | $this->kakasi_cache_dir = XOOPS_ROOT_PATH.'/cache2/kakasi/'; |
| + | |
| + | // POST SPAM のポイント加算設定 |
| + | $this->post_spam_rules = array( |
| + | // 同じURLが1行に3回 11pt |
| + | "/((?:ht|f)tps?:\/\/[!~*'();\/?:\@&=+\$,%#\w.-]+)[^!~*'();\/?:\@&=+\$,%#\w.-]+?\\1[^!~*'();\/?:\@&=+\$,%#\w.-]+?\\1/i" => 11, |
| + | |
| + | // 65文字以上の英数文字のみで構成されている 15pt |
| + | '/^[\x00-\x7f\s]{65,}$/' => 15, |
| + | |
| + | // 無効な文字コードがある 31pt |
| + | '/[\x00-\x08\x11-\x12\x14-\x1f\x7f\xff]+/' => 31 |
| + | ); |
| + | |
| + | // 無効なフィールド定義 |
| + | $this->ignore_fileds = array( |
| + | // 'url' => array('newbb/post.php', 'comment_post.php'), |
| + | ); |
| + | }} |
| + | |
| + | -検索ワードの分かち書き機能を利用する場合は、サーバーに KAKASI がインストールされていて、その KAKASI のパスを XOOPS_TRUST_PATH/class/hyp_common/hyp_kakasi.php 内で適切に設定する必要があります。 |
| + | |
| + | -検索語マーカー用のCSSについて~ |
| + | CSS は XOOPS_ROOT_PATH/xoops.css に追加するとよいでしょう。~ |
| + | ※ background: url(&font(Red,b){/xoops/images/ext.png};) center right no-repeat;~ |
| + | この部分の&font(Red,b){赤字};の部分は適宜環境に応じて書き換えてください。 |
| + | |
| + | #code(css){{ |
| + | a.ext |
| + | { |
| + | background: url(/xoops/images/ext.png) center right no-repeat; |
| + | padding-right: 12px; |
| + | } |
| + | |
| + | strong.word0 { |
| + | background-color:#FFFF66; |
| + | color:black; |
| + | } |
| + | |
| + | strong.word1 { |
| + | background-color:#A0FFFF; |
| + | color:black; |
| + | } |
| + | |
| + | strong.word2 { |
| + | background-color:#99FF99; |
| + | color:black; |
| + | } |
| + | |
| + | strong.word3 { |
| + | background-color:#FF9999; |
| + | color:black; |
| + | } |
| + | |
| + | strong.word4 { |
| + | background-color:#FF66FF; |
| + | color:black; |
| + | } |
| + | |
| + | strong.word5 { |
| + | background-color:#880000; |
| + | color:white; |
| + | } |
| + | |
| + | strong.word6 { |
| + | background-color:#00AA00; |
| + | color:white; |
| + | } |
| + | |
| + | strong.word7 { |
| + | background-color:#886800; |
| + | color:white; |
| + | } |
| + | |
| + | strong.word8 { |
| + | background-color:#004699; |
| + | color:white; |
| + | } |
| + | |
| + | strong.word9 { |
| + | background-color:#990099; |
| + | color:white; |
| + | } |
| + | }} |
| + | |
| + | |
| + | #navi(../) |