UseModWiki소스수정/TextIsBanned의 코드를 수정해서 적용함.
다른 블로그 사이트에서 위키에 TrackBack을 보낼 때 트랙백 내용 안에 금지 단어가 들어가 있으면 트랙백도 거부하는데, 블로그 사이트 쪽에서 제대로 에러 내용을 보여주는 곳이 드물어서 보낸 사람 쪽에서는 영문도 모르고 트랙백 보내기가 실패하는 경우가 생길 수 있다.
sub DoPostMain { ... return; } # 금지단어 - 이 단락 추가 if (my $bannedText = &TextIsBanned($string)) { print &GetHeader("", T('Editing Denied'),""); print Ts('Editing not allowed: text includes banned text'); print " [$bannedText]"; print "\n<br><hr noshade size=1><p><strong>". T('This is the text you submitted:'). "<br>". T('(Copy the text, go back with your browser, paste the text, and edit again please)'). "</strong><p>". &GetTextArea('text', $string, &GetParam("editrows", 20), &GetParam("editcols", 65)). "<p>\n"; print &GetCommonFooter(); return; } if (($id eq 'SampleUndefinedPage') || ($id eq T('SampleUndefinedPage'))) { &ReportError(Ts('%s cannot be defined.', $id)); return; ... }
다음 함수 통채로 추가
# 금지단어 sub TextIsBanned { my ($text) = @_; my ($data, $status); ($status, $data) = &ReadFile("$DataDir/bantext"); return undef if (!$status); $data =~ s/\r//g; foreach (split(/\n/, $data)) { next if ((/^\s*$/) || (/^#/)); return $& if ($text =~ /$_/i); } return undef; }
/TrackBack패치가 되어 있는 경우 아래 수정 적용
sub DoReceiveTrackbackPing { ... } elsif (!&PageCanReceiveTrackbackPing($normal_id)) { &SendTrackbackResponse("1", "Invalid Pagename (Page is missing, or Trackback is not allowed)"); } elsif (my $bannedText = &TextIsBanned($blog_name.$url.$title.$excerpt)) { # 이 줄과 아래 줄 추가 &SendTrackbackResponse("1", "[$bannedText] is a Banned text"); } else { &OpenPage($normal_id); ... }
# editbannedtext action # 금지단어 sub action_editbannedtext { my ($banList, $status); print &GetHeader("", T('Editing Banned text'), ""); return if (!&UserIsAdminOrError()); ($status, $banList) = &ReadFile("$DataDir/bantext"); $banList = "" if (!$status); print &GetFormStart(); print &GetHiddenValue("edit_bantext",1),"\n"; print &GetHiddenValue("action", "updatebannedtext"),"\n"; print "<b>Banned text list:</b><br>\n"; print "<p>Each entry is either a commented line (starting with #), ", "or text."; print "<p>Example:<br>", "# blocks text 'spam.com'<br>", "spam\\.com\$<p>"; print &GetTextArea('bantext', $banList, 12, 50); print "<br>", $q->submit(-name=>'Save'), "\n"; print $q->endform; print &GetCommonFooter(); } 1;
# updatebannedtext action # 금지단어 sub action_updatebannedtext { my ($newList, $fname); print &GetHeader("", T('Updating Banned text'), ""); return if (!&UserIsAdminOrError()); $fname = "$DataDir/bantext"; $newList = &GetParam("bantext", "#Empty file"); if ($newList eq "") { print "<p>Empty banned text or error."; print "<p>Resubmit with at least one space character to remove."; } elsif ($newList =~ /^\s*$/s) { unlink($fname); print "<p>Removed banned text"; } else { &WriteStringToFile($fname, $newList); print "<p>Updated banned text"; } print &GetCommonFooter(); } 1;
... "<p>".&ScriptLink("action=editbanned",T('Editing Banned list')). "<p>".&ScriptLink("action=editbannedtext",T('Editing Banned text')). # 추가 "<p>".&ScriptLink("action=maintain",T('Maintenance on all pages')). ...
Editing not allowed: text includes banned text 수정할 수 없습니다: 금지된 단어가 포함되어 있습니다 Editing Banned text 등록 금지 단어 목록 수정 Updating Banned text 등록 금지 단어 목록 갱신 (Copy the text, go back with your browser, paste the text, and edit again please) (아래 텍스트를 복사하고, 브라우저의 뒤로 가기를 사용하여, 이전 화면에 붙여놓고 다시 편집해 주시기 바랍니다)
ext1.109c
등록금지 단어 필터링 패치하였습니다.
그리고 이 패치에 대한 질문은 아니지만 editbanned에 대한 질문이 있습니다.
action=editbanned 에서
^209.158.164.11$
^213.229.159.18$
^163.17.101.125$
^148.244.150.58$
^148.244.150.
^210.8.163.85$
^61.55.128.199$
^83.65.7.162$
^165.138.175.85$
#148.244.150.58
이런 식으로 등록하였는데 148.244.150.58 에서 계속 스팸이 올라오는데요.
형식을 잘 못 쓴 건가요?
음, 스팸중에 "url="이라는 문구가 들어간게 많아서 금지 단어에 설정해 뒀다가, 그게 wiki 소스에도 들어있는 터라 페이지 수정하던 거 날려먹었네요. =.=; 금지 단어가 포함되어서 저장이 거부되더라도 쓰던 내용을 잃지 않게 고민 좀 해봐야겠습니다. 페이지 편집의 경우는 다시 편집 화면으로 돌아가게 할 수 있을 법 한데, 코멘트는 어찌해야 되려나 모르겠네요. (트랙백이야 뭐 별 수 없고)
anth를 금지어로 했더니 panther가 걸리네요. anth만 걸리고 panther는 안걸린다거나..
anth$$ an*th 등의 정규식 표현식으로 하는 건 어려울까요?
여전히 스팸이 들어오고 있는데요..
저기 "^61\.55\.128\.199$ "에 $뒤에 빈칸이 하나 있어야 Banned list가 작동을
하는 건가요??
"^61\.55\.128\.199$"라고 적어두어도 계속 트랙백이 들어오거든요.
음 아뇨 $뒤에 빈칸 갈은 건 상관없습니다.
혹시나 해서 여쭈는 건데, IP차단하고 금지단어 차단 메뉴를 혼동하신 건 아니시고요?
그렇군요.. 같은 아이피가 계속 들어와서요.. 그냥 수작업으로 계속 지워줄 수 밖에 없군요.