@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | $master_url_enc = urlencode($master_url); |
| 28 | 28 | $response = akismet_request("key=$key&blog=$master_url_enc", "rest.akismet.com", "/1.1/verify-key"); |
| 29 | - if ("valid" == $response[1] ) { |
|
| 29 | + if ("valid" == $response[1]) { |
|
| 30 | 30 | $post = urlencode($post); |
| 31 | 31 | $ip = urlencode($_SERVER['REMOTE_ADDR']); |
| 32 | 32 | $referrer = urlencode($_SERVER['HTTP_REFERER']); |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | $http_request = "POST $path HTTP/1.0\r\n"; |
| 57 | 57 | $http_request .= "Host: $host\r\n"; |
| 58 | 58 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; |
| 59 | - $http_request .= "Content-Length: " . strlen($request) . "\r\n"; |
|
| 59 | + $http_request .= "Content-Length: ".strlen($request)."\r\n"; |
|
| 60 | 60 | $http_request .= "User-Agent: BOINC | Akismet 1.1\r\n"; |
| 61 | 61 | $http_request .= "\r\n"; |
| 62 | 62 | $http_request .= $request; |
| 63 | 63 | |
| 64 | 64 | $response = ''; |
| 65 | - if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { |
|
| 65 | + if (false !== ($fs = @fsockopen($host, $port, $errno, $errstr, 3))) { |
|
| 66 | 66 | fwrite($fs, $http_request); |
| 67 | - while ( !feof($fs) ) |
|
| 67 | + while (!feof($fs)) |
|
| 68 | 68 | $response .= fgets($fs, 1160); // One TCP-IP packet |
| 69 | 69 | fclose($fs); |
| 70 | 70 | $response = explode("\r\n\r\n", $response, 2); |
@@ -42,7 +42,8 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $response = akismet_request($request, "$key.rest.akismet.com", "/1.1/comment-check"); |
| 44 | 44 | |
| 45 | - if ("true" == $response[1]) { // Akismet says it's spam |
|
| 45 | + if ("true" == $response[1]) { |
|
| 46 | +// Akismet says it's spam |
|
| 46 | 47 | return false; |
| 47 | 48 | } else { |
| 48 | 49 | return true; |
@@ -64,8 +65,10 @@ discard block |
||
| 64 | 65 | $response = ''; |
| 65 | 66 | if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { |
| 66 | 67 | fwrite($fs, $http_request); |
| 67 | - while ( !feof($fs) ) |
|
| 68 | - $response .= fgets($fs, 1160); // One TCP-IP packet |
|
| 68 | + while ( !feof($fs) ) { |
|
| 69 | + $response .= fgets($fs, 1160); |
|
| 70 | + } |
|
| 71 | + // One TCP-IP packet |
|
| 69 | 72 | fclose($fs); |
| 70 | 73 | $response = explode("\r\n\r\n", $response, 2); |
| 71 | 74 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | function akismet_request($request, $host, $path, $port = 80) { |
| 56 | - $http_request = "POST $path HTTP/1.0\r\n"; |
|
| 56 | + $http_request = "post $path HTTP/1.0\r\n"; |
|
| 57 | 57 | $http_request .= "Host: $host\r\n"; |
| 58 | 58 | $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n"; |
| 59 | 59 | $http_request .= "Content-Length: " . strlen($request) . "\r\n"; |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | class views_handler_argument_boincteam_id extends views_handler_argument_numeric { |
| 10 | - function construct() { |
|
| 10 | + function construct() { |
|
| 11 | 11 | parent::construct(); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - function set_argument($arg) { |
|
| 14 | + function set_argument($arg) { |
|
| 15 | 15 | // When setting the ID argument, convert to BOINC ID |
| 16 | 16 | $id = is_numeric($arg) ? $arg : 0; |
| 17 | 17 | $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id)); |
| 18 | 18 | $this->argument = $boinc_id; |
| 19 | 19 | return $this->validate_arg($boinc_id); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | class views_handler_argument_boincuser_id extends views_handler_argument_numeric { |
| 10 | - function construct() { |
|
| 10 | + function construct() { |
|
| 11 | 11 | parent::construct(); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - function set_argument($arg) { |
|
| 14 | + function set_argument($arg) { |
|
| 15 | 15 | // When setting the ID argument, convert to BOINC ID |
| 16 | 16 | $id = is_numeric($arg) ? $arg : 0; |
| 17 | 17 | $boinc_id = db_result(db_query("SELECT boinc_id FROM {boincuser} WHERE uid = %d", $id)); |
| 18 | 18 | $this->argument = $boinc_id; |
| 19 | 19 | return $this->validate_arg($boinc_id); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | class views_handler_argument_boincteam_id extends views_handler_argument_numeric { |
| 10 | - function construct() { |
|
| 10 | + function construct() { |
|
| 11 | 11 | parent::construct(); |
| 12 | - } |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - function set_argument($arg) { |
|
| 14 | + function set_argument($arg) { |
|
| 15 | 15 | // When setting the ID argument, convert to BOINC ID |
| 16 | 16 | $id = is_numeric($arg) ? $arg : 0; |
| 17 | 17 | $boinc_id = db_result(db_query("SELECT team_id FROM {boincteam} WHERE nid = %d", $id)); |
| 18 | 18 | $this->argument = $boinc_id; |
| 19 | 19 | return $this->validate_arg($boinc_id); |
| 20 | - } |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -197,5 +197,5 @@ |
||
| 197 | 197 | |
| 198 | 198 | admin_page_tail(); |
| 199 | 199 | |
| 200 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 200 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 201 | 201 | ?> |
@@ -197,5 +197,5 @@ |
||
| 197 | 197 | |
| 198 | 198 | admin_page_tail(); |
| 199 | 199 | |
| 200 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 200 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 201 | 201 | ?> |
@@ -148,6 +148,6 @@ |
||
| 148 | 148 | |
| 149 | 149 | page_tail(); |
| 150 | 150 | |
| 151 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 151 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 152 | 152 | |
| 153 | 153 | ?> |
@@ -148,6 +148,6 @@ |
||
| 148 | 148 | |
| 149 | 149 | page_tail(); |
| 150 | 150 | |
| 151 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 151 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 152 | 152 | |
| 153 | 153 | ?> |
@@ -148,6 +148,6 @@ |
||
| 148 | 148 | |
| 149 | 149 | page_tail(); |
| 150 | 150 | |
| 151 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
| 151 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
| 152 | 152 | |
| 153 | 153 | ?> |