//******************************************************************************************************************* require_once 'lib/pixelpost/defensio_pixelpost.php'; $addon_name = "Pixelpost Defensio comment filter (Front Side)"; $addon_version = '2.0.0'; $akismet_warning = defensio_check_status_askimet(); if (version_compare(PHP_VERSION, '5.0.0', '<')) { $php_version_message = "<br /><br /><font color=\"red\"><strong>This addon requires PHP version 5.0.0 and it seems you are on PHP version " . PHP_VERSION . ". This version of the Defensio addon will not work on your setup.</strong></font>"; } else { $php_version_message = "<br /><br />Running on PHP version " . PHP_VERSION . ": <font color=\"green\"><strong>OK</strong></font>."; } $addon_description = "<a name='defensio'></a>Pixelpost Add-On to filter spam using Defensio (<a href='http://www.defensio.com' target='_blank'>Info</a>). This is the front side of the addon, it checks the comments and marks them in the database." . $php_version_message . $akismet_warning . "<br />Please read the <a href='../addons/_defensio2.0/manual/Defensio_v2.0_manual.html'>manual</a> for more information.<br /><br /><img src=\"../addons/_defensio2.0/images/poweredbyd.png\">"; if (version_compare(PHP_VERSION, '5.0.0', '>=')) { //******************************************************************************************************************* // WORKSPACE STUFF //******************************************************************************************************************* add_front_functions('check_comment_with_defensio', 'comment_accepted'); require_once 'lib/defensio-php/Defensio.php'; $defensio_result = mysql_query("SELECT * FROM `{$pixelpost_db_prefix}defensio` LIMIT 1") or die(mysql_error()); $defensio_conf = mysql_fetch_array($defensio_result); $timelimit = 60 * 15; //number of seconds. if ($defensio_conf['defensio_comments_processed_at'] == null or mktime() - $defensio_conf['defensio_comments_processed_at'] > $timelimit) { defensio_process_unprocessed($defensio_conf); } //******************************************************************************************************************* // MAIN FUNCTION CALL //******************************************************************************************************************* /** * check_comment_with_defensio() * * @return
<?php //error_reporting(E_ALL ^ E_NOTICE); $addon_name = "Pixelpost Akismet comment filter (Front Side)"; $addon_version = '1.3'; $addon_description = 'Checking the Comments with Akismet'; add_front_functions('check_akismet_comment', 'comment_accepted'); function check_akismet_comment() { global $cfgrow, $name, $email, $url, $message, $parent_id, $pixelpost_db_prefix; // query for testing if the function is performed anyway $params = array('comment_type' => 'comment', 'comment_author' => $name, 'comment_author_email' => $email, 'comment_author_url' => $url, 'comment_content' => $message); if ('true' == pp_auto_check_comment($params)) { $query = "UPDATE {$pixelpost_db_prefix}comments SET publish = 'spm' WHERE id = last_insert_id()"; mysql_query($query); $cfgrow['commentemail'] = 'no'; eval_addon_front_workspace('comment_blocked_askimet'); $extra_message = '<b>Your comment is marked as SPAM by Akismet Spam Checker and now in moderation queue until the Administrator has reviewed it.</b><p /> '; } else { eval_addon_front_workspace('comment_passed_askimet'); } $akismet_comment_checked = true; } function pp_auto_check_comment($comment) { global $cfgrow, $pixelpost_db_prefix; $kkey = $cfgrow['akismet_key']; $pp_api_host = $kkey . '.rest.akismet.com'; $pp_api_port = 80; $comment['user_ip'] = $_SERVER['REMOTE_ADDR']; $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
// GENERAL INFORMATION DISPLAYED IN ADDON LIST //******************************************************************************************************************* $addon_name = "Pixelpost Defensio comment filter (Front Side)"; $addon_version = '1.4'; $result = mysql_query("SELECT `status` FROM `{$pixelpost_db_prefix}addons` WHERE `addon_name` LIKE '%akismet%' and `type`='front'") or die(mysql_error()); $akismet = mysql_fetch_array($result); if ($akismet['status'] == 'on') { $akismet_warning = "<br /><br /><font color=\"red\"><strong>Defensio is not designed to work with Akismet. It is suggested to disable Akismet if you want to use Defensio.</strong></font>"; } else { $akismet_warning = null; } $addon_description = "<a name='defensio'></a>Pixelpost Add-On to filter spam using Defensio (<a href='http://www.defensio.com' target='_blank'>Info</a>). This is the front side of the addon, it checks the comments and marks them in the database." . $akismet_warning . "<br /><br /><img src=\"../addons/_defensio/images/poweredbyd.png\">"; //******************************************************************************************************************* // WORKSPACE STUFF //******************************************************************************************************************* add_front_functions('check_defensio_comment', 'comment_accepted'); //******************************************************************************************************************* // MAIN FUNCTION CALL //******************************************************************************************************************* function check_defensio_comment() { global $pixelpost_db_prefix, $cfgrow, $parent_id, $message, $ip, $name, $url, $email; $defensio_conf = sql_array("SELECT * FROM {$pixelpost_db_prefix}defensio"); // the following code tries to get the full addon path. $filename = basename(__FILE__, ".php"); $query = "SELECT `addon_name` FROM `{$pixelpost_db_prefix}addons` WHERE `addon_name` LIKE '%" . $filename . "%'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $addon_path = $row[0]; } $pos = strpos($addon_path, "/");