[geeklog-hg] geeklog: Fix #1488
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Thu Oct 25 15:34:34 EDT 2012
changeset 8867:58f088069923
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/58f088069923
user: kenji at grebe.flets-west.jp
date: Sat Oct 06 13:57:17 2012 +0900
description:
Fix #1488
diffstat:
plugins/spamx/SFS.Misc.class.php | 47 +++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 17 deletions(-)
diffs (60 lines):
diff -r a91757b2ba10 -r 58f088069923 plugins/spamx/SFS.Misc.class.php
--- a/plugins/spamx/SFS.Misc.class.php Mon Oct 22 12:31:38 2012 -0400
+++ b/plugins/spamx/SFS.Misc.class.php Sat Oct 06 13:57:17 2012 +0900
@@ -92,26 +92,39 @@
$_SPX_CONF['timeout'] = 5; // seconds
}
- $ctx = stream_context_create(array(
- 'http' => array(
- 'timeout' => $_SPX_CONF['timeout']
- )
- )
- );
-
+ require_once 'HTTP/Request.php';
+
+ $req = new HTTP_Request(
+ $query,
+ array(
+ 'timeout' => $_SPX_CONF['timeout'],
+ )
+ );
+
if ($this->_verbose) {
- SPAMX_log ("Sending to SFS: $query");
- }
-
- $result = file_get_contents($query, 0, $ctx);
- $result = unserialize($result);
- if (!$result) {
- if ($this->_verbose) {
- SPAMX_log ("SFS: no spam detected");
- }
- return 0; // invalid data, assume ok
+ SPAMX_log('Sending to SFS: ' . $query);
}
+ if ($req->sendRequest() === TRUE) {
+ $result = $req->getResponseBody();
+
+ if ($result === FALSE) {
+ return 0; // Response body is not set, assume ok
+ }
+
+ $result = unserialize($result);
+
+ if (!$result) {
+ if ($this->_verbose) {
+ SPAMX_log ("SFS: no spam detected");
+ }
+
+ return 0; // Invalid data, assume ok
+ }
+ } else {
+ return 0; // PEAR Error, assume ok
+ }
+
if ($result['email']['appears'] == 1)
$value_arr[] = "('email', '$db_email')";
if ($result['ip']['appears'] == 1)
More information about the geeklog-cvs
mailing list