Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -1,156 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* CAPTCHA CLASS
|
||||
* Database Table
|
||||
* <code>
|
||||
* CREATE TABLE captcha (
|
||||
* captcha_unique_id VARCHAR(32) NOT NULL default '',
|
||||
* captcha_string VARCHAR(100) NOT NULL default '',
|
||||
* captcha_ipaddress VARCHAR(16) NOT NULL default '',
|
||||
* captcha_date INT(10) NOT NULL default '',
|
||||
* PRIMARY KEY (captcha_unique_id )
|
||||
* );
|
||||
* </code>
|
||||
* PLUG IN: Default GD image
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Last Updated: $Date: 2010-09-13 17:11:29 -0400 (Mon, 13 Sep 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @package IP.Board
|
||||
* @subpackage Kernel
|
||||
* @author Matt Mecham
|
||||
* @copyright Invision Power Services, Inc.
|
||||
* @version 1.0
|
||||
* @file default.php Plugin for the default CAPTCHA GD image
|
||||
*~TERABYTE_DOC_READY~
|
||||
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
|
||||
* $License: This is NULLED!
|
||||
* $Author: bfarber $
|
||||
* @since Friday 19th May 2006 17:33
|
||||
* $LastChangedDate: 2011-08-17 17:49:31 -0400 (Wed, 17 Aug 2011) $
|
||||
* @version v3.2.3
|
||||
* $Revision: 9396 $
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @class captchaPlugin
|
||||
* @brief Plugin for the default CAPTCHA GD image
|
||||
* @note This plugin is automatically loaded by classCaptcha class based on the CAPTCHA setting
|
||||
*
|
||||
*/
|
||||
class captchaPlugin
|
||||
{
|
||||
/**
|
||||
* GD version
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access public
|
||||
* @var integer
|
||||
* @var $registry
|
||||
* @var $DB
|
||||
* @var $settings
|
||||
* @var $member
|
||||
*/
|
||||
public $gd_version = 0;
|
||||
public $registry;
|
||||
public $DB;
|
||||
public $settings;
|
||||
public $member;
|
||||
|
||||
/**
|
||||
* Backgrounds path
|
||||
* String that stores the backgrounds path
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
* @var $path_background
|
||||
*/
|
||||
public $path_background = '';
|
||||
|
||||
/**
|
||||
* Fonts path
|
||||
* String that stores the fonts path
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
* @var $path_fonts
|
||||
*/
|
||||
public $path_fonts = '';
|
||||
|
||||
/**
|
||||
* Return an error if GD is not installed?
|
||||
* My most verbose string name. I'm so proud.
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $show_error_gd_img = false;
|
||||
|
||||
/**
|
||||
* Registry object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $registry;
|
||||
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $DB;
|
||||
|
||||
/**
|
||||
* Settings object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $settings;
|
||||
|
||||
/**
|
||||
* Request object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $request;
|
||||
|
||||
/**
|
||||
* Language object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $lang;
|
||||
|
||||
/**
|
||||
* Member object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $member;
|
||||
|
||||
/**
|
||||
* Member data object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
public $memberData;
|
||||
|
||||
/**
|
||||
* Captcha key
|
||||
* String that stores the captcha key
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
* @var $captchaKey
|
||||
*/
|
||||
public $captchaKey = '';
|
||||
public $captchaKey = '';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Registry Object
|
||||
* @param object $registry Registry Object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->member = $this->registry->member();
|
||||
|
||||
/* Settings */
|
||||
$this->gd_version = $this->settings['gd_version'];
|
||||
$this->path_background = DOC_IPS_ROOT_PATH . 'public/style_captcha/captcha_backgrounds';
|
||||
$this->path_fonts = DOC_IPS_ROOT_PATH . 'public/style_captcha/captcha_fonts';
|
||||
$this->path_background = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_captcha/captcha_backgrounds';
|
||||
$this->path_fonts = DOC_IPS_ROOT_PATH . PUBLIC_DIRECTORY . '/style_captcha/captcha_fonts';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the template bit
|
||||
* Returns the captcha template
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
* @return @e string HTML template for captcha GD form
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $gdImage = $this->getTemplate();
|
||||
* @endcode
|
||||
*/
|
||||
public function getTemplate()
|
||||
{
|
||||
@@ -191,7 +121,7 @@ class captchaPlugin
|
||||
//-----------------------------------------
|
||||
// Add to the DB
|
||||
//-----------------------------------------
|
||||
|
||||
|
||||
$this->DB->insert( 'captcha', array( 'captcha_unique_id' => $captcha_unique_id,
|
||||
'captcha_string' => $captcha_string,
|
||||
'captcha_ipaddress' => $this->member->ip_address,
|
||||
@@ -200,45 +130,35 @@ class captchaPlugin
|
||||
/* Make available */
|
||||
$this->captchaKey = $captcha_unique_id;
|
||||
|
||||
//-----------------------------------------
|
||||
// Return Template Bit
|
||||
//-----------------------------------------
|
||||
|
||||
/* Return template */
|
||||
return $this->registry->output->getTemplate('global_other')->captchaGD( $captcha_unique_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the captcha image
|
||||
* Validates the entered captcha code
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
* @return @e boolean TRUE if the code is valid otherwise FALSE
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $isValid = $this->validate();
|
||||
* @endcode
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
/* Init vars */
|
||||
$captcha_unique_id = IPSText::alphanumericalClean( $_REQUEST['captcha_unique_id'] );
|
||||
$captcha_input_NOT_CLEAN = trim( $_REQUEST['captcha_string'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the info from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$captcha = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'captcha',
|
||||
'where' => "captcha_unique_id='". addslashes( $captcha_unique_id )."'" ) );
|
||||
/* Get ID from DB */
|
||||
$captcha = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'captcha', 'where' => "captcha_unique_id='". addslashes( $captcha_unique_id )."'" ) );
|
||||
|
||||
if ( ! $captcha['captcha_unique_id'] )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Check...
|
||||
//-----------------------------------------
|
||||
|
||||
/* Check */
|
||||
if ( $captcha['captcha_string'] != $captcha_input_NOT_CLEAN )
|
||||
{
|
||||
return FALSE;
|
||||
@@ -251,19 +171,18 @@ class captchaPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the captcha bot image
|
||||
* Generates the captcha image
|
||||
*
|
||||
* @access public
|
||||
* @param string captcha_unique_id Unique captcha db row id
|
||||
* @return mixed [Boolean on failure],[Output image data/headers]
|
||||
* @since 1.0
|
||||
* @param array $captcha_unique_id Key 0 of the array contains the Unique ID
|
||||
* @return @e mixed Prints image data and headers on success otherwise FALSE on failure
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $captchaImage = $this->showImage( $captcha_unique_id );
|
||||
* @endcode
|
||||
*/
|
||||
public function showImage( $captcha_unique_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// CHECK
|
||||
//-----------------------------------------
|
||||
|
||||
//-----------------------------------------
|
||||
// Magic _call method makes an array
|
||||
//-----------------------------------------
|
||||
@@ -275,35 +194,30 @@ class captchaPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get the info from the DB
|
||||
//-----------------------------------------
|
||||
|
||||
$captcha = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'captcha',
|
||||
'where' => "captcha_unique_id='" . $captcha_unique_id . "'",
|
||||
) );
|
||||
/* Get the info from the DB */
|
||||
$captcha = $this->DB->buildAndFetch( array( 'select' => '*', 'from' => 'captcha', 'where' => "captcha_unique_id='" . $captcha_unique_id . "'" ) );
|
||||
|
||||
if ( ! $captcha['captcha_unique_id'] )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show it...
|
||||
//-----------------------------------------
|
||||
|
||||
/* Show it... */
|
||||
$this->_showGDImage( $captcha['captcha_string'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show anti-spam bot GD image numbers
|
||||
* Prints captcha image and headers
|
||||
*
|
||||
* @param string Number string
|
||||
* @return void
|
||||
* @since 1.0
|
||||
* @param string $content Key to show in the GD image
|
||||
* @return @e void Prints image data and headers
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $this->_showGDImage( $captcha_string );
|
||||
* @endcode
|
||||
*/
|
||||
private function _showGDImage( $content="" )
|
||||
protected function _showGDImage( $content="" )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Is GD Available?
|
||||
@@ -311,16 +225,9 @@ class captchaPlugin
|
||||
|
||||
if ( ! extension_loaded('gd') )
|
||||
{
|
||||
if ( $this->show_error_gd_img )
|
||||
{
|
||||
@header( "Content-Type: image/gif" );
|
||||
print base64_decode( "R0lGODlhyAA8AJEAAN/f3z8/P8zMzP///yH5BAAAAAAALAAAAADIADwAAAL/nI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMlgACwEHQXESfzgOzykQAqgMmFMr9Rq+GbHlqAFsFWnFVrfwIAvQAu15P0A14Nn8/ADhXd4dnl2YYCAioGHBgyDbnNzBIV0gYxzEYWdg1iLAnScmFuQdAt2UKZTcl+mip+HoYG+tKOfv3N5l5garnmPt6CwyaFzrranu7i0crObvoaKvMyMhrIQhFuyzcyGwXcOpoLYg7DGsZXk5r6DSN51RNfF0RPU5sy7gpnH5bjLhrk7Y9/RQNisfq2CRJauTR6xUuFyBx/yrWypMMmTlq/9IwQnKWcKG5cvMeShBIMOFIaV9w2eti6SBABAyjvBRFMaZCMaxsqtxl8iShjpj+VfqGCJg4XzOfJCK5DVWliFNXlSIENKjWrVy7ev0KNqzYsWTFwhlFU8waLk+efGF7hi0aSgu3iGmV1cxdoGTinimbiGOeP8SWhps6z3AkeMMWW20mMykqQyuJDbYWdufKBJWc2uWmAJZdO0yOKfTCCqHGiO4E/oKGriTYaBw5g/MDqynNlW9Uhmx66tM2i05dNcM8O6Rg2MHLYKraLTpDcLebTke4APkcduAoku0DWpe24MI96ewZPdiy6Rlx/0Y+XJevlNu/z6vtlHFxZbpv9f9edYkfxgVmjnqSxXYOYPfFVMgXIHGC0ltWDNXYJ6Lsw82AFVpWEk4pEabgbsfBM5FphyDWRh1OLCUgbC06NtNU6UV1T1Jl3YhjjjruyGOPPv4IZJBC6tDXGUDB4UUaK06RhRl/0aWWF3CR4YWESraR1ZCh6dMOiMNIFE2GI/bRJYiIEeULiloyUNSFLzWC3VXcqEJXTBe1qApDpbXUEYxr2tYeQCyyGMuIcxbokHfPvPjHf25mqeWHoLEX0iH0UScmUzSWNxmj20yH6Z+/yNTeM0N1cumkg9E4GHnluLcfeKLm95yLoO5ZKJrhgeaQm4xlFGshcK3pYZ9LradQrmY5nmhVdMm+qqpKYkIqpDyltWkpjJJaaKmd6kXjHUXvDPborOaei2666q7LbrvuvgtvvPLOS2+9YBUAADs=" );
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
exit();
|
||||
}
|
||||
@header( "Content-Type: image/gif" );
|
||||
print base64_decode( "R0lGODlhyAA8AJEAAN/f3z8/P8zMzP///yH5BAAAAAAALAAAAADIADwAAAL/nI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMlgACwEHQXESfzgOzykQAqgMmFMr9Rq+GbHlqAFsFWnFVrfwIAvQAu15P0A14Nn8/ADhXd4dnl2YYCAioGHBgyDbnNzBIV0gYxzEYWdg1iLAnScmFuQdAt2UKZTcl+mip+HoYG+tKOfv3N5l5garnmPt6CwyaFzrranu7i0crObvoaKvMyMhrIQhFuyzcyGwXcOpoLYg7DGsZXk5r6DSN51RNfF0RPU5sy7gpnH5bjLhrk7Y9/RQNisfq2CRJauTR6xUuFyBx/yrWypMMmTlq/9IwQnKWcKG5cvMeShBIMOFIaV9w2eti6SBABAyjvBRFMaZCMaxsqtxl8iShjpj+VfqGCJg4XzOfJCK5DVWliFNXlSIENKjWrVy7ev0KNqzYsWTFwhlFU8waLk+efGF7hi0aSgu3iGmV1cxdoGTinimbiGOeP8SWhps6z3AkeMMWW20mMykqQyuJDbYWdufKBJWc2uWmAJZdO0yOKfTCCqHGiO4E/oKGriTYaBw5g/MDqynNlW9Uhmx66tM2i05dNcM8O6Rg2MHLYKraLTpDcLebTke4APkcduAoku0DWpe24MI96ewZPdiy6Rlx/0Y+XJevlNu/z6vtlHFxZbpv9f9edYkfxgVmjnqSxXYOYPfFVMgXIHGC0ltWDNXYJ6Lsw82AFVpWEk4pEabgbsfBM5FphyDWRh1OLCUgbC06NtNU6UV1T1Jl3YhjjjruyGOPPv4IZJBC6tDXGUDB4UUaK06RhRl/0aWWF3CR4YWESraR1ZCh6dMOiMNIFE2GI/bRJYiIEeULiloyUNSFLzWC3VXcqEJXTBe1qApDpbXUEYxr2tYeQCyyGMuIcxbokHfPvPjHf25mqeWHoLEX0iH0UScmUzSWNxmj20yH6Z+/yNTeM0N1cumkg9E4GHnluLcfeKLm95yLoO5ZKJrhgeaQm4xlFGshcK3pYZ9LradQrmY5nmhVdMm+qqpKYkIqpDyltWkpjJJaaKmd6kXjHUXvDPborOaei2666q7LbrvuvgtvvPLOS2+9YBUAADs=" );
|
||||
exit();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -328,7 +235,6 @@ class captchaPlugin
|
||||
//-----------------------------------------
|
||||
|
||||
$content = ' '. preg_replace( "/(\w)/", "\\1 ", $content ) .' ';
|
||||
$allow_fonts = isset( $this->settings['captcha_allow_fonts'] ) ? $this->settings['captcha_allow_fonts'] : 1;
|
||||
$use_fonts = 0;
|
||||
$tmp_x = 135;
|
||||
$tmp_y = 20;
|
||||
@@ -350,76 +256,73 @@ class captchaPlugin
|
||||
//-----------------------------------------
|
||||
$_imgs = array();
|
||||
|
||||
if ( $this->gd_version > 1 )
|
||||
while ( $continue_loop )
|
||||
{
|
||||
while ( $continue_loop )
|
||||
if ( is_array( $backgrounds ) AND count( $backgrounds ) )
|
||||
{
|
||||
if ( is_array( $backgrounds ) AND count( $backgrounds ) )
|
||||
$i = mt_rand(0, count( $backgrounds ) - 1 );
|
||||
|
||||
$background = $backgrounds[ $i ];
|
||||
$_file_extension = preg_replace( "#^.*\.(\w{2,4})$#is", "\\1", strtolower( $background ) );
|
||||
|
||||
switch( $_file_extension )
|
||||
{
|
||||
$i = mt_rand(0, count( $backgrounds ) - 1 );
|
||||
|
||||
$background = $backgrounds[ $i ];
|
||||
$_file_extension = preg_replace( "#^.*\.(\w{2,4})$#is", "\\1", strtolower( $background ) );
|
||||
|
||||
switch( $_file_extension )
|
||||
{
|
||||
case 'jpg':
|
||||
case 'jpe':
|
||||
case 'jpeg':
|
||||
if ( ! function_exists('imagecreatefromjpeg') OR ! $im = @imagecreatefromjpeg($background) )
|
||||
case 'jpg':
|
||||
case 'jpe':
|
||||
case 'jpeg':
|
||||
if ( ! function_exists('imagecreatefromjpeg') OR ! $im = @imagecreatefromjpeg($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_imgs[] = $im;
|
||||
|
||||
if( count( $_imgs ) > 2 )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
else
|
||||
}
|
||||
break;
|
||||
case 'gif':
|
||||
if ( ! function_exists('imagecreatefromgif') OR ! $im = @imagecreatefromgif($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_imgs[] = $im;
|
||||
|
||||
if( count( $_imgs ) > 2 )
|
||||
{
|
||||
$_imgs[] = $im;
|
||||
|
||||
if( count( $_imgs ) > 2 )
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
break;
|
||||
case 'gif':
|
||||
if ( ! function_exists('imagecreatefromgif') OR ! $im = @imagecreatefromgif($background) )
|
||||
}
|
||||
break;
|
||||
case 'png':
|
||||
if ( ! function_exists('imagecreatefrompng') OR ! $im = @imagecreatefrompng($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_imgs[] = $im;
|
||||
|
||||
if( count( $_imgs ) > 2 )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_imgs[] = $im;
|
||||
|
||||
if( count( $_imgs ) > 2 )
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'png':
|
||||
if ( ! function_exists('imagecreatefrompng') OR ! $im = @imagecreatefrompng($background) )
|
||||
{
|
||||
unset( $backgrounds[ $i ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_imgs[] = $im;
|
||||
|
||||
if( count( $_imgs ) > 2 )
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
$_started = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$continue_loop = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a new background */
|
||||
@@ -458,16 +361,8 @@ class captchaPlugin
|
||||
|
||||
if ( $_started !== TRUE )
|
||||
{
|
||||
if ( $this->gd_version == 1 )
|
||||
{
|
||||
$im = imagecreate($image_x, $image_y);
|
||||
$tmp = imagecreate($tmp_x, $tmp_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
$im = imagecreatetruecolor($image_x, $image_y);
|
||||
$tmp = imagecreatetruecolor($tmp_x, $tmp_y);
|
||||
}
|
||||
$im = imagecreatetruecolor($image_x, $image_y);
|
||||
$tmp = imagecreatetruecolor($tmp_x, $tmp_y);
|
||||
|
||||
$white = ImageColorAllocate($tmp, 255, 255, 255);
|
||||
$black = ImageColorAllocate($tmp, 0, 0, 0);
|
||||
@@ -557,7 +452,7 @@ class captchaPlugin
|
||||
// Can we use fonts?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $allow_fonts AND function_exists('imagettftext') AND is_array( $fonts ) AND count( $fonts ) )
|
||||
if ( function_exists('imagettftext') AND is_array( $fonts ) AND count( $fonts ) )
|
||||
{
|
||||
if ( function_exists('imageantialias') )
|
||||
{
|
||||
@@ -601,7 +496,7 @@ class captchaPlugin
|
||||
$b = mt_rand(0,100);
|
||||
$c = $a + 20;
|
||||
$d = $b + 20;
|
||||
$e = ( $i == 3 ) ? mt_rand( 280, 320 ) : mt_rand( -280, -320 );
|
||||
$e = ( $i == 3 ) ? mt_rand( 280, 320 ) : mt_rand( -320, -280 );
|
||||
|
||||
imagearc( $im, $a , $b , $c, $d, 0, $e, $color_light );
|
||||
imagearc( $im, $a+1, $b+1, $c, $d, 0, $e, $color_main );
|
||||
@@ -721,13 +616,16 @@ class captchaPlugin
|
||||
/**
|
||||
* Create wave effect for GD images
|
||||
*
|
||||
* @access private
|
||||
* @param resource Image resource
|
||||
* @param integer Wave factor
|
||||
* @return resource Returned image resource
|
||||
* @since 1.0
|
||||
* @param resources $im Image resource
|
||||
* @param integer $wave Wave factor
|
||||
* @return @e resource Returned image resource
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $imageResource = $this->_showGDImageWave( $captcha_string );
|
||||
* @endcode
|
||||
*/
|
||||
private function _showGDImageWave( $im, $wave=10 )
|
||||
protected function _showGDImageWave( $im, $wave=10 )
|
||||
{
|
||||
$_width = imagesx( $im );
|
||||
$_height = imagesy( $im );
|
||||
@@ -765,44 +663,43 @@ class captchaPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes extinct captcha sessions
|
||||
* Clears out "dead" entries
|
||||
* Removes extinct captcha sessions or 'dead' entries
|
||||
*
|
||||
* @access private
|
||||
* @param string Optional IP address to clear out on
|
||||
* @return string void
|
||||
* @param string $ip_address Optional IP address to clear out on
|
||||
* @return @e void
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $this->_clearSessions( $ip_address );
|
||||
* @endcode
|
||||
*/
|
||||
private function _clearSessions( $ip_address='' )
|
||||
protected function _clearSessions( $ip_address='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
/* Init vars */
|
||||
$time = time() - 60 * 3600;
|
||||
$extra = ( $ip_address ) ? " OR captcha_ipaddress='" . $ip_address . "'" : '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove...
|
||||
//-----------------------------------------
|
||||
|
||||
/* Remove from DB */
|
||||
$this->DB->delete( 'captcha', 'captcha_date < ' . $time . $extra );
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads up the backgrounds.
|
||||
* Retrieves the list of backgrounds from the specified path
|
||||
*
|
||||
* @access private
|
||||
* @return array backgrounds
|
||||
* @return @e array List of backgrouns found
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $images = $this->_getBackgrounds();
|
||||
* @endcode
|
||||
*/
|
||||
private function _getBackgrounds()
|
||||
protected function _getBackgrounds()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
/* Init vars */
|
||||
$images = array();
|
||||
$_path = $this->path_background;
|
||||
|
||||
/* Loop */
|
||||
if ( $_dir = opendir( $_path ) )
|
||||
{
|
||||
while( false !== ( $_file = readdir( $_dir ) ) )
|
||||
@@ -818,20 +715,22 @@ class captchaPlugin
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads up the fonts.
|
||||
* Retrieves the list of fonts from the specified path
|
||||
*
|
||||
* @access private
|
||||
* @return array fonts
|
||||
* @return @e array List of fonts found
|
||||
*
|
||||
* <b>Example Usage:</b>
|
||||
* @code
|
||||
* $fonts = $this->_getFonts();
|
||||
* @endcode
|
||||
*/
|
||||
private function _getFonts()
|
||||
protected function _getFonts()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
/* Init vars */
|
||||
$fonts = array();
|
||||
$_path = $this->path_fonts;
|
||||
|
||||
/* Loop */
|
||||
if ( $_dir = @opendir( $_path ) )
|
||||
{
|
||||
while( false !== ( $_file = @readdir( $_dir ) ) )
|
||||
@@ -845,5 +744,4 @@ class captchaPlugin
|
||||
|
||||
return $fonts;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user