• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂78994767de288b0cdf025cbb34086e0ee0b860a9 (tree)
時間2007-02-20 00:34:47
作者henoheno <henoheno>
Commiterhenoheno

Log Message

$Id: spam.php,v 1.119 2007/02/19 15:28:42 henoheno Exp $
* pkwk_mail_notify(): HEADER option
* Remains more data
* scheme:////////nasty.example.com

Change Summary

差異

--- a/lib/spam.php
+++ b/lib/spam.php
@@ -1,5 +1,5 @@
11 <?php
2-// $Id: spam.php,v 1.18 2007/02/04 10:42:41 henoheno Exp $
2+// $Id: spam.php,v 1.19 2007/02/19 15:34:47 henoheno Exp $
33 // Copyright (C) 2006-2007 PukiWiki Developers Team
44 // License: GPL v2 or (at your option) any later version
55 // Functions for Concept-work of spam-uri metrics
@@ -51,7 +51,7 @@ function uri_pickup($string = '', $normalize = TRUE,
5151 preg_match_all(
5252 // scheme://userinfo@host:port/path/or/pathinfo/maybefile.and?query=string#fragment
5353 // Refer RFC3986 (Regex below is not strict)
54- '#(\b[a-z][a-z0-9.+-]{1,8})://' . // 1: Scheme
54+ '#(\b[a-z][a-z0-9.+-]{1,8}):/+' . // 1: Scheme
5555 '(?:' .
5656 '([^\s<>"\'\[\]/\#?@]*)' . // 2: Userinfo (Username)
5757 '@)?' .
@@ -793,7 +793,7 @@ function check_uri_spam($target = '', $method = array())
793793 $remains = & $progress['remains'];
794794 $asap = isset($method['asap']);
795795
796- // Return if ...
796+ // Recurse
797797 if (is_array($target)) {
798798 foreach($target as $str) {
799799 // Recurse
@@ -820,7 +820,11 @@ function check_uri_spam($target = '', $method = array())
820820 }
821821 foreach ($_remains as $key=>$value) {
822822 foreach ($value as $_key=>$_value) {
823- $remains[$key][$_key] = $_value;
823+ if (is_int($_key)) {
824+ $remains[$key][] = $_value;
825+ } else {
826+ $remains[$key][$_key] = $_value;
827+ }
824828 }
825829 }
826830 if ($asap && $is_spam) break;
@@ -855,14 +859,14 @@ function check_uri_spam($target = '', $method = array())
855859 }
856860
857861 // Return if ...
858- if ($asap && $is_spam) {
859- return $progress;
860- }
861- // URI Init
862+ if ($asap && $is_spam) return $progress;
863+
864+ // URI: Pickup
862865 $pickups = spam_uri_pickup($target, $method);
863- if (empty($pickups)) {
864- return $progress;
865- }
866+ //$remains['uri_pickup'] = & $pickups;
867+
868+ // Return if ...
869+ if (empty($pickups)) return $progress;
866870
867871 // URI: Check quantity
868872 $sum['quantity'] += count($pickups);
@@ -930,14 +934,13 @@ function check_uri_spam($target = '', $method = array())
930934 }
931935
932936 // Return if ...
933- if ($asap && $is_spam) {
934- return $progress;
935- }
937+ if ($asap && $is_spam) return $progress;
936938
937939 // Host: Uniqueness (uniq / non-uniq)
938940 $hosts = array();
939941 foreach ($pickups as $pickup) $hosts[] = & $pickup['host'];
940942 $hosts = array_unique($hosts);
943+ //$remains['uniqhost'] = & $hosts;
941944 $sum['uniqhost'] += count($hosts);
942945 if ((! $asap || ! $is_spam) && isset($method['non_uniqhost'])) {
943946 $sum['non_uniqhost'] = $sum['quantity'] - $sum['uniqhost'];
@@ -947,9 +950,7 @@ function check_uri_spam($target = '', $method = array())
947950 }
948951
949952 // Return if ...
950- if ($asap && $is_spam) {
951- return $progress;
952- }
953+ if ($asap && $is_spam) return $progress;
953954
954955 // URI: Bad host
955956 if ((! $asap || ! $is_spam) && isset($method['badhost'])) {
@@ -959,9 +960,9 @@ function check_uri_spam($target = '', $method = array())
959960 } else {
960961 $badhost = is_badhost($hosts, $asap, $__remains);
961962 if ($__remains) {
962- $progress['remains']['badhost'] = array();
963+ $remains['badhost'] = array();
963964 foreach ($__remains as $value) {
964- $progress['remains']['badhost'][$value] = TRUE;
965+ $remains['badhost'][$value] = TRUE;
965966 }
966967 }
967968 }
@@ -1094,7 +1095,7 @@ function pkwk_spamnotify($action, $page, $target = array('title' => ''), $progre
10941095 $summary['URI'] = get_script_uri() . '?' . rawurlencode($page);
10951096 $summary['USER_AGENT'] = TRUE;
10961097 $summary['REMOTE_ADDR'] = TRUE;
1097- pkwk_mail_notify($notify_subject, var_export($target, TRUE), $summary);
1098+ pkwk_mail_notify($notify_subject, var_export($target, TRUE), $summary, TRUE);
10981099 }
10991100
11001101 ?>