Problem with Akismet

Hello,
I followed the instructions on this page: http://www.zenphoto.org/support/topic.php?id=1129&replies=1

and set up an akismet filter . The problem is that whatever I post ,it is flagged as spam.It doesn't get posted.(I have a valid API key)
I'm testing my zenp on my local machine.So my blog url is set to http://localhost/album .Could that be the problem(comments from localhost are treated as spam)?

Ps:The readme in the zip file mentions the function addComment(...) in classes.php but it was in class-image.php.I'm using the latest stable build on a lampp install.

Here's the code:
`

$zp_gal_url = 'http://localhost/album/';

$zp_akismet_key = '.....';

$this->getComments();

$name = trim($name);

$email = trim($email);

$website = trim($website);

// Let the comment have trailing line breaks and space? Nah...

// Also (in)validate HTML here, and in $name.

$comment = trim($comment);

if (empty($email) || !is_valid_email_zp($email) || empty($name) || empty($comment)) {

return false;

}

if (!empty($website) && substr($website, 0, 7) != "http://") {

$website = "http://" . $website;

}

// START - Akismet Spam Filter code ****************************************

require_once 'Akismet.class.php';

$commentData = array(

'author' => $name,

'email' => $email,

'website' => $website,

'body' => $comment,

//'permalink' => $this->getFullImage()

);

$akismet = new Akismet($zp_gal_url, $zp_akismet_key, $commentData);

//if($akismet->isError()) {

// echo'Couldn't connected to Akismet server!';

// TODO: Add more precise error handling

//} else {

if($akismet->iscommentspam()) {

// TODO: Add Spam Moderation Capabilities

//echo'Spam detected';

} else {

//echo'Not Spam!';

// START - Core addComment code ******************************

$newcomment = array();

$newcomment['name'] = $name;

$newcomment['email'] = $email;

$newcomment['website'] = $website;

$newcomment['comment'] = $comment;

$newcomment['date'] = time();

$this->comments[] = $newcomment;

// Update the database entry with the new comment

query("INSERT INTO " . prefix("comments") . " (imageid, name, email, website, comment, date) VALUES " .

" ('" . $this->id .

"', '" . escape($name) .

"', '" . escape($email) .

"', '" . escape($website) .

"', '" . escape($comment) .

"', NOW())");

// Notify the admin user

$message = "A comment has been posted in your album " . $this->getAlbumName() . " about " . $this->getTitle() . "n" .

"n" .

"Author: " . $name . "n" .

"Email: " . $email . "n" .

"Website: " . $website . "n" .

"Comment:n" . $comment . "n" .

"n" .

"You can view all comments about this image here:n" .

"http://" . $_SERVER['SERVER_NAME'] . WEBPATH . "/index.php?album=" . urlencode($this->album->name) . "&image=" . urlencode($this->name) . "n" .

"n" .

"You can edit the comment here:n" .

"http://" . $_SERVER['SERVER_NAME'] . WEBPATH . "/zen/admin.php?page=commentsn";

zp_mail("[" . zp_conf('gallery_title') . "] Comment posted about: " . $this->getTitle(), $message);

// END - Core addComment code ******************************

}

//}

// END - Akismet Spam Filter code ****************************************

`

Comments

Sign In or Register to comment.