これもだめ(Re:xmobile& protectスパム誤判定)

投稿ツリー


このトピックの投稿一覧へ

なーお

なし これもだめ(Re:xmobile& protectスパム誤判定)

msg# 1.1.1.2
depth:
3
前の投稿 - 次の投稿 | 親投稿 - 子投稿なし | 投稿日時 2007/10/17 7:52
なーお  長老   投稿数: 1745

下のコードでも、だめ。
自分で分かりやすいように愚直に書いてみたけど。。
 ・・singlebyte投稿がスルーしちゃう。
うーん。。 これ以上はローカル環境を作らないと、無理だなあ。virtualマシンごとコピーして、ドメインを割り当てて・・ 出張族には厳しく、少し時間がかかりそうです。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
 
// Don't enable this for site using single-byte
// Perhaps, japanese, schinese, tchinese, and korean can use it
 
class protector_postcommon_post_need_multibyte extends ProtectorFilterAbstract {
 
	function execute()
	{
		global $xoopsUser ;
	
		if( ! function_exists( 'mb_strlen' ) ) return true ;
	
		// registered users always pass this plugin
		if( is_object( $xoopsUser ) ) return true ;
	
		$multibyte_cheked = false ; 
		$multibyte_ok = false ; 
	
		$lengths = array(
			0 => 40 ,	 //
			'message' => 2 ,
			'com_text' => 2 ,
			'excerpt' => 2 ,
		) ;
	
		foreach( $_POST as $key => $data ) {
			// dare to ignore arrays/objects
			if( ! is_string( $data ) ) continue ;
	
			$check_length = isset( $lengths[ $key ] ) ? $lengths[ $key ] : $lengths[ 0 ] ;
			if( strlen( $data ) > $check_length ) {
				$multibyte_cheked = true ;
				if( strlen( $data ) > mb_strlen( $data ))  {
					$multibyte_ok = true ;
					break;
				}
			}
		}
		if( ( $multibyte_cheked == true ) && ( $multibyte_ok == false ) ) {
			$this->protector->message .= "No multibyte character was found ($data)\n" ;
			$this->protector->output_log( 'Singlebyte SPAM' , 0 , false , 128 ) ;
			die( 'Protector rejects your post, because your post looks like SPAM' ) ;
		}
		return true ;
	}
 
}
 
?>
投票数:0 平均点:0.00
返信する

この投稿に返信する

題名
ゲスト名
投稿本文

  条件検索へ