function DEFENSIO_dataValHandler($DATA) { global $hostURL; requireComponent('Textcube.Function.misc'); $cfg = misc::fetchConfigVal($DATA); // check apikey if (isset($cfg['apikey'])) { $r = defensio_verify_key($cfg['apikey']); if ($r) { // check and create table; defensio_create_table(); return true; } else { return "API-Key is invalid"; } } else { return "Please, Input your defensio api-key."; } }
function defensio_settings() { global $pixelpost_db_prefix, $cfgrow, $defensio_conf; // get the settings $result = mysql_query("SELECT * FROM `{$pixelpost_db_prefix}defensio` LIMIT 1") or die(mysql_error()); $defensio_conf = mysql_fetch_array($result); $v = array(); $v['key'] = $defensio_conf['key']; if (defensio_verify_key($defensio_conf, $v['key'])) { $v['valid'] = true; } else { $v['valid'] = false; } $v['threshold'] = $defensio_conf['threshold'] * 100; $v['remove_older_than'] = $defensio_conf['remove_older_than']; $v['remove_older_than_days'] = $defensio_conf['remove_older_than_days']; $v['defensio_widget_image'] = $defensio_conf['defensio_widget_image']; $v['defensio_widget_align'] = $defensio_conf['defensio_widget_align']; if ($_GET['optionsview'] == 'antispam' && $_GET['optaction'] == 'updateantispam') { $older_than_error = ''; $minimum_days = 15; if (isset($_POST['defensio_remove_older_than_days']) and (int) $_POST['defensio_remove_older_than_days'] < $minimum_days) { $older_than_error = 'Days has to be a numeric value greater than ' . $minimum_days; $v['remove_older_than_days'] = $minimum_days; } else { $v['remove_older_than_days'] = (int) $_POST['defensio_remove_older_than_days']; } $v['key'] = mysql_real_escape_string(trim($_POST['new_key'])); if (defensio_verify_key($defensio_conf, $v['key'])) { $v['valid'] = true; } else { $v['valid'] = false; } $v['threshold'] = (int) $_POST['new_threshold']; $v['defensio_widget_image'] = $_POST['defensio_widget_image']; $v['defensio_widget_align'] = $_POST['defensio_widget_align']; $v['remove_older_than_error'] = $older_than_error; if ($_POST['defensio_remove_older_than'] == 'on') { $v['remove_older_than'] = 1; } else { $v['remove_older_than'] = 0; } $threshold_db = $v['threshold'] / 100; $query = "UPDATE {$pixelpost_db_prefix}defensio SET \n\t\t\t`threshold` = '" . $threshold_db . "', `remove_older_than` = '" . $v['remove_older_than'] . "', `remove_older_than_days` = '" . $v['remove_older_than_days'] . "',`key` = '" . $v['key'] . "',`defensio_widget_image` = '" . $v['defensio_widget_image'] . "',`defensio_widget_align` = '" . $v['defensio_widget_align'] . "'"; $result = mysql_query($query) or die(mysql_error()); } echo "<div class='jcaption'>DEFENSIO settings</div>\n\t\t<div class='content'>\n\t\t<a href=\"http://defensio.com\">Defensio</a>'s blog spam web service aggressively and intelligently prevents comment and trackback spam from hitting your blog. You should quickly notice a dramatic reduction in the amount of spam you have to worry about.\n \t\t<p>When the filter does rarely make a mistake (say, the odd spam message gets through or a rare good comment is marked as spam) we've made it a joy to sort through your comments and set things straight. Not only will the filter learn and improve over time, but it will do so in a personalized way!</p>\n \t\t<p>In order to use our service, you will need a <strong>free</strong> Defensio API key. Get yours now at <a href=\"http://defensio.com/signup\">Defensio.com</a>.</p>\n \t\t<h3>Defensio API Key</h3>"; echo defensio_render_key_validity($v); echo "<input type=\"text\" value=\"" . $v['key'] . "\" name=\"new_key\" size=\"38\" /><br />"; echo defensio_render_spaminess_threshold_option($v['threshold']); echo "<h3><label>Automatic removal of spam</label></h3>"; echo defensio_render_delete_older_than_option($v); echo defensio_render_widget_image_option($v); echo defensio_render_widget_align_option($v); echo "</div>"; }