/*
Plugin Name: Silver's CAPTCHA
Plugin URI: http://silver.balaton.to/downloads/
Description: Silver's CAPTCHA implementation to protecting comments from spam robots. Check plugin's settings under Options / SCaptcha menu. The handfont2.ttf was taken from Openfontlibrary.org. For more info, please read the readme.txt file from the installation package.
Author: Silver
Version: 0.2.1
Author URI: http://silver.balaton.to/
*/
/* Copyright 2006 Silver (email : silver@balaton.to)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
=============================================================================
FUNCTIONS
=============================================================================
*/
/*
-----------------------------------------------------------------------------
Adding admin menu
-----------------------------------------------------------------------------
*/
function s_captcha_adminmenu()
{
add_options_page("Silver's CAPTCHA", "SCaptcha", 10, __FILE__, 's_captcha_options');
}
/*
-----------------------------------------------------------------------------
Options page in admin menu
-----------------------------------------------------------------------------
*/
function s_captcha_options()
{
global $table_prefix, $wpdb;
$s_table_data = $table_prefix . "s_captcha_data";
$s_table_conf = $table_prefix . "s_captcha_config";
if (isset($_POST["update"]))
{
$sql="UPDATE ".$s_table_conf." "
. " SET cap_installed =1"
. ", cap_use_grid =".$_POST['cap_use_grid']
. ", cap_use_background =0"
. ", cap_use_random =1"
. ", cap_ttf_path ='".$_POST['cap_ttf_path']."'"
. ", cap_ttf_size =".$_POST['cap_ttf_size']
. ", cap_ttf_X =".$_POST['cap_ttf_X']
. ", cap_ttf_Y =".$_POST['cap_ttf_Y']
. ", cap_X_size =".$_POST['cap_X_size']
. ", cap_Y_size =".$_POST['cap_Y_size']
. ", cap_rotation =".$_POST['cap_rotation']
. ", cap_paper_color_R =".$_POST['cap_paper_color_R']
. ", cap_paper_color_G =".$_POST['cap_paper_color_G']
. ", cap_paper_color_B =".$_POST['cap_paper_color_B']
. ", cap_font_color_R =".$_POST['cap_font_color_R']
. ", cap_font_color_G =".$_POST['cap_font_color_G']
. ", cap_font_color_B =".$_POST['cap_font_color_B']
. ", cap_grid_color_R =".$_POST['cap_grid_color_R']
. ", cap_grid_color_G =".$_POST['cap_grid_color_G']
. ", cap_grid_color_B =".$_POST['cap_grid_color_B']
. ", cap_grid_spacing =".$_POST['cap_grid_spacing']
. ", cap_background_path =''".$_POST['cap_background_path']
. " limit 1";
$wpdb->query($sql);
}
$select = 'SELECT * FROM '.$s_table_conf.' LIMIT 1';
$row = $wpdb->get_row($select, ARRAY_A, 0);
$cap_installed = $row['cap_installed'];
$cap_use_grid = $row['cap_use_grid'];
$cap_use_background = $row['cap_use_background'];
$cap_use_random = $row['cap_use_random'];
$cap_ttf_path = $row['cap_ttf_path'];
$cap_ttf_size = $row['cap_ttf_size'];
$cap_ttf_X = $row['cap_ttf_X'];
$cap_ttf_Y = $row['cap_ttf_Y'];
$cap_X_size = $row['cap_X_size'];
$cap_Y_size = $row['cap_Y_size'];
$cap_rotation = $row['cap_rotation'];
$cap_paper_color_R = $row['cap_paper_color_R'];
$cap_paper_color_G = $row['cap_paper_color_G'];
$cap_paper_color_B = $row['cap_paper_color_B'];
$cap_font_color_R = $row['cap_font_color_R'];
$cap_font_color_G = $row['cap_font_color_G'];
$cap_font_color_B = $row['cap_font_color_B'];
$cap_grid_color_R = $row['cap_grid_color_R'];
$cap_grid_color_G = $row['cap_grid_color_G'];
$cap_grid_color_B = $row['cap_grid_color_B'];
$cap_grid_spacing = $row['cap_grid_spacing'];
$cap_background_path = $row['cap_background_path'];
if ($cap_installed)
$cap_installed_text = "YES";
else
$cap_installed_text = "NO (For first time installation, press the UPDATE OPTIONS button to show the captcha with plugin's defaults.)";
if ($cap_use_grid)
$cap_use_grid_text = "YES";
else
$cap_use_grid_text = "NO";
if ($cap_use_background)
$cap_use_background_text = "YES";
else
$cap_use_background_text = "NO";
if ($cap_use_random)
$cap_use_random_text = "YES";
else
$cap_use_random_text = "NO";
#$url = $wpdb->get_var("SELECT url FROM ".$blogringping_table." limit 1");
echo "