Version Notes
This is a development version.Any valuable suggestions and help will be highly appreciated
Download this release
Release Info
Developer | Magento Core Team |
Extension | OutsourceOnline_Captcha |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- app/code/community/OutsourceOnline/Captcha/Helper/Data.php +26 -305
- app/code/community/OutsourceOnline/Captcha/Helper/OSOLmulticaptcha.php +554 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/adlibBT.png +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ajax-loader-big.gif +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/font-png.png +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/fontFileMeta.meta +1 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/temp.meta +1 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/temp.png +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/{adlibBT.TTF → ttfs/AdLibBT.TTF} +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ttfs/BookmanOldStyle.TTF +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ttfs/CooperBlack.TTF +0 -0
- app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ttfs/index.html +0 -0
- app/code/community/OutsourceOnline/Captcha/Model/Source/Captchafonts.php +45 -0
- app/code/community/OutsourceOnline/Captcha/Model/Source/Captchafontsize.php +31 -0
- app/code/community/OutsourceOnline/Captcha/Model/Source/Captchanoise.php +31 -0
- app/code/community/OutsourceOnline/Captcha/etc/config.xml +7 -2
- app/code/community/OutsourceOnline/Captcha/etc/system.xml +61 -14
- app/design/frontend/default/default/template/outsourceOnline/captcha/captcha.phtml +0 -67
- package.xml +4 -4
app/code/community/OutsourceOnline/Captcha/Helper/Data.php
CHANGED
@@ -18,6 +18,7 @@
|
|
18 |
* @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
|
|
21 |
class Outsourceonline_Captcha_Helper_Data extends Mage_Core_Helper_Abstract
|
22 |
{
|
23 |
|
@@ -32,16 +33,32 @@ class Outsourceonline_Captcha_Helper_Data extends Mage_Core_Helper_Abstract
|
|
32 |
var $reportBotscoutNegativeMail='';
|
33 |
function display()
|
34 |
{
|
35 |
-
|
36 |
-
|
37 |
-
$imageFunction =
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
exit;
|
|
|
45 |
|
46 |
|
47 |
return true;
|
@@ -54,303 +71,7 @@ class Outsourceonline_Captcha_Helper_Data extends Mage_Core_Helper_Abstract
|
|
54 |
//$this->botscoutCheck();
|
55 |
return ($sessionSecurity_code == $postedSecurityCode);
|
56 |
}
|
57 |
-
function setColors()
|
58 |
-
{
|
59 |
-
|
60 |
-
$this->bgColor = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/background_color");
|
61 |
-
$this->textColor = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/text_color");
|
62 |
-
}
|
63 |
-
function HexToRGB($hex) {
|
64 |
-
$hex = ereg_replace("#", "", $hex);
|
65 |
-
$color = array();
|
66 |
-
|
67 |
-
if(strlen($hex) == 3) {
|
68 |
-
$color['r'] = hexdec(substr($hex, 0, 1) . $r);
|
69 |
-
$color['g'] = hexdec(substr($hex, 1, 1) . $g);
|
70 |
-
$color['b'] = hexdec(substr($hex, 2, 1) . $b);
|
71 |
-
}
|
72 |
-
else if(strlen($hex) == 6) {
|
73 |
-
$color['r'] = hexdec(substr($hex, 0, 2));
|
74 |
-
$color['g'] = hexdec(substr($hex, 2, 2));
|
75 |
-
$color['b'] = hexdec(substr($hex, 4, 2));
|
76 |
-
}
|
77 |
-
|
78 |
-
return array_values($color);
|
79 |
-
}
|
80 |
-
|
81 |
-
function RGBToHex($r, $g, $b) {
|
82 |
-
$hex = "#";
|
83 |
-
$hex.= dechex($r);
|
84 |
-
$hex.= dechex($g);
|
85 |
-
$hex.= dechex($b);
|
86 |
-
|
87 |
-
return $hex;
|
88 |
-
}
|
89 |
-
|
90 |
|
91 |
-
// generates distorted letters ,this is a revised version of a method used in kcaptcha
|
92 |
-
#http://www.phpclasses.org/browse/package/3193.html
|
93 |
-
|
94 |
-
# Copyright by Kruglov Sergei, 2006, 2007, 2008
|
95 |
-
# www.captcha.ru, www.kruglov.ru
|
96 |
-
|
97 |
-
# System requirements: PHP 4.0.6+ w/ GD
|
98 |
-
|
99 |
-
# KCAPTCHA is a free software. You can freely use it for building own site or software.
|
100 |
-
# If you use this software as a part of own sofware, you must leave copyright notices intact or add KCAPTCHA copyright notices to own.
|
101 |
-
function create_imageAdv(){
|
102 |
-
|
103 |
-
$alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
|
104 |
-
$allowed_symbols = "23456789abcdeghkmnpqsuvxyz";
|
105 |
-
|
106 |
-
$length = 5;
|
107 |
-
$width = 120;
|
108 |
-
$height = 60;
|
109 |
-
$fluctuation_amplitude = 5;
|
110 |
-
$no_spaces = true;
|
111 |
-
$this->setColors();
|
112 |
-
$foreground_color = $this->HexToRGB($this->textColor) ;//array(255,255,255);//array(180, 180, 180);//array(255,255,255);//
|
113 |
-
$background_color = $this->HexToRGB($this->bgColor) ;//array(44,127,7);//array(53,3,0);//array(246, 246, 246);//array(0,0,0);//
|
114 |
-
$jpeg_quality = 90;
|
115 |
-
|
116 |
-
|
117 |
-
$alphabet_length=strlen($alphabet);
|
118 |
-
|
119 |
-
do{
|
120 |
-
// generating random keystring
|
121 |
-
while(true){
|
122 |
-
$this->keystring='';
|
123 |
-
for($i=0;$i<$length;$i++){
|
124 |
-
$this->keystring.=$allowed_symbols{mt_rand(0,strlen($allowed_symbols)-1)};
|
125 |
-
}
|
126 |
-
if(!preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $this->keystring)) break;
|
127 |
-
}
|
128 |
-
|
129 |
-
$font_file=$font_file=dirname(__FILE__).DS.'osolCaptcha'.DS.'adlibBT.png';
|
130 |
-
$font=imagecreatefrompng($font_file);
|
131 |
-
imagealphablending($font, true);
|
132 |
-
$fontfile_width=imagesx($font);
|
133 |
-
$fontfile_height=imagesy($font)-1;
|
134 |
-
$font_metrics=array();
|
135 |
-
$symbol=0;
|
136 |
-
$reading_symbol=false;
|
137 |
-
|
138 |
-
// loading font
|
139 |
-
for($i=0;$i<$fontfile_width && $symbol<$alphabet_length;$i++){
|
140 |
-
$transparent = (imagecolorat($font, $i, 0) >> 24) == 127;
|
141 |
-
|
142 |
-
if(!$reading_symbol && !$transparent){
|
143 |
-
$font_metrics[$alphabet{$symbol}]=array('start'=>$i);
|
144 |
-
$reading_symbol=true;
|
145 |
-
continue;
|
146 |
-
}
|
147 |
-
|
148 |
-
if($reading_symbol && $transparent){
|
149 |
-
$font_metrics[$alphabet{$symbol}]['end']=$i;
|
150 |
-
$reading_symbol=false;
|
151 |
-
$symbol++;
|
152 |
-
continue;
|
153 |
-
}
|
154 |
-
}
|
155 |
-
|
156 |
-
$img=imagecreatetruecolor($width, $height);
|
157 |
-
imagealphablending($img, true);
|
158 |
-
$white=imagecolorallocate($img, 255, 255, 255);
|
159 |
-
$black=imagecolorallocate($img, 0, 0, 0);
|
160 |
-
|
161 |
-
imagefilledrectangle($img, 0, 0, $width-1, $height-1, $white);
|
162 |
-
|
163 |
-
// draw text
|
164 |
-
$x=1;
|
165 |
-
for($i=0;$i<$length;$i++){
|
166 |
-
$m=$font_metrics[$this->keystring{$i}];
|
167 |
-
|
168 |
-
$y=mt_rand(-$fluctuation_amplitude, $fluctuation_amplitude)+($height-$fontfile_height)/2+2;
|
169 |
-
|
170 |
-
if($no_spaces){
|
171 |
-
$shift=0;
|
172 |
-
if($i>0){
|
173 |
-
$shift=10000;
|
174 |
-
for($sy=7;$sy<$fontfile_height-20;$sy+=1){
|
175 |
-
for($sx=$m['start']-1;$sx<$m['end'];$sx+=1){
|
176 |
-
$rgb=imagecolorat($font, $sx, $sy);
|
177 |
-
$opacity=$rgb>>24;
|
178 |
-
if($opacity<127){
|
179 |
-
$left=$sx-$m['start']+$x;
|
180 |
-
$py=$sy+$y;
|
181 |
-
if($py>$height) break;
|
182 |
-
for($px=min($left,$width-1);$px>$left-12 && $px>=0;$px-=1){
|
183 |
-
$color=imagecolorat($img, $px, $py) & 0xff;
|
184 |
-
if($color+$opacity<190){
|
185 |
-
if($shift>$left-$px){
|
186 |
-
$shift=$left-$px;
|
187 |
-
}
|
188 |
-
break;
|
189 |
-
}
|
190 |
-
}
|
191 |
-
break;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
if($shift==10000){
|
196 |
-
$shift=mt_rand(4,6);
|
197 |
-
}
|
198 |
-
|
199 |
-
}
|
200 |
-
}else{
|
201 |
-
$shift=1;
|
202 |
-
}
|
203 |
-
imagecopy($img, $font, $x-$shift, $y, $m['start'], 1, $m['end']-$m['start'], $fontfile_height);
|
204 |
-
$x+=$m['end']-$m['start']-$shift;
|
205 |
-
}
|
206 |
-
}while($x>=$width-10); // while not fit in canvas
|
207 |
-
|
208 |
-
$center=$x/2;
|
209 |
-
|
210 |
-
|
211 |
-
$img2=imagecreatetruecolor($width, $height);
|
212 |
-
$foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
|
213 |
-
$background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
|
214 |
-
imagefilledrectangle($img2, 0, 0, $width-1, $height-1, $background);
|
215 |
-
imagefilledrectangle($img2, 0, $height, $width-1, $height+12, $foreground);
|
216 |
-
|
217 |
-
|
218 |
-
// periods
|
219 |
-
$rand1=mt_rand(750000,1200000)/10000000;
|
220 |
-
$rand2=mt_rand(750000,1200000)/10000000;
|
221 |
-
$rand3=mt_rand(750000,1200000)/10000000;
|
222 |
-
$rand4=mt_rand(750000,1200000)/10000000;
|
223 |
-
// phases
|
224 |
-
$rand5=mt_rand(0,31415926)/10000000;
|
225 |
-
$rand6=mt_rand(0,31415926)/10000000;
|
226 |
-
$rand7=mt_rand(0,31415926)/10000000;
|
227 |
-
$rand8=mt_rand(0,31415926)/10000000;
|
228 |
-
// amplitudes
|
229 |
-
$rand9=mt_rand(330,420)/110;
|
230 |
-
$rand10=mt_rand(330,450)/110;
|
231 |
-
|
232 |
-
//wave distortion
|
233 |
-
|
234 |
-
for($x=0;$x<$width;$x++){
|
235 |
-
for($y=0;$y<$height;$y++){
|
236 |
-
$sx=$x+(sin($x*$rand1+$rand5)+sin($y*$rand3+$rand6))*$rand9-$width/2+$center+1;
|
237 |
-
$sy=$y+(sin($x*$rand2+$rand7)+sin($y*$rand4+$rand8))*$rand10;
|
238 |
-
|
239 |
-
if($sx<0 || $sy<0 || $sx>=$width-1 || $sy>=$height-1){
|
240 |
-
continue;
|
241 |
-
}else{
|
242 |
-
$color=imagecolorat($img, $sx, $sy) & 0xFF;
|
243 |
-
$color_x=imagecolorat($img, $sx+1, $sy) & 0xFF;
|
244 |
-
$color_y=imagecolorat($img, $sx, $sy+1) & 0xFF;
|
245 |
-
$color_xy=imagecolorat($img, $sx+1, $sy+1) & 0xFF;
|
246 |
-
}
|
247 |
-
|
248 |
-
if($color==255 && $color_x==255 && $color_y==255 && $color_xy==255){
|
249 |
-
continue;
|
250 |
-
}else if($color==0 && $color_x==0 && $color_y==0 && $color_xy==0){
|
251 |
-
$newred=$foreground_color[0];
|
252 |
-
$newgreen=$foreground_color[1];
|
253 |
-
$newblue=$foreground_color[2];
|
254 |
-
}else{
|
255 |
-
$frsx=$sx-floor($sx);
|
256 |
-
$frsy=$sy-floor($sy);
|
257 |
-
$frsx1=1-$frsx;
|
258 |
-
$frsy1=1-$frsy;
|
259 |
-
|
260 |
-
$newcolor=(
|
261 |
-
$color*$frsx1*$frsy1+
|
262 |
-
$color_x*$frsx*$frsy1+
|
263 |
-
$color_y*$frsx1*$frsy+
|
264 |
-
$color_xy*$frsx*$frsy);
|
265 |
-
|
266 |
-
if($newcolor>255) $newcolor=255;
|
267 |
-
$newcolor=$newcolor/255;
|
268 |
-
$newcolor0=1-$newcolor;
|
269 |
-
|
270 |
-
$newred=$newcolor0*$foreground_color[0]+$newcolor*$background_color[0];
|
271 |
-
$newgreen=$newcolor0*$foreground_color[1]+$newcolor*$background_color[1];
|
272 |
-
$newblue=$newcolor0*$foreground_color[2]+$newcolor*$background_color[2];
|
273 |
-
}
|
274 |
-
|
275 |
-
imagesetpixel($img2, $x, $y, imagecolorallocate($img2, $newred, $newgreen, $newblue));
|
276 |
-
}
|
277 |
-
}
|
278 |
-
|
279 |
-
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
280 |
-
header('Cache-Control: no-store, no-cache, must-revalidate');
|
281 |
-
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
282 |
-
header('Pragma: no-cache');
|
283 |
-
|
284 |
-
if(function_exists("imagejpeg")){
|
285 |
-
header("Content-Type: image/jpeg");
|
286 |
-
imagejpeg($img2, null, $jpeg_quality);
|
287 |
-
}else if(function_exists("imagegif")){
|
288 |
-
header("Content-Type: image/gif");
|
289 |
-
imagegif($img2);
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
}else if(function_exists("imagepng")){
|
294 |
-
header("Content-Type: image/x-png");
|
295 |
-
imagepng($img2);
|
296 |
-
}
|
297 |
-
$security_code = $this->keystring;
|
298 |
-
//Set the session to store the security code
|
299 |
-
//$_SESSION["security_code"]
|
300 |
-
/*$currentSession = & JFactory::getSession() ;//&JSession::getInstance('none',array());
|
301 |
-
$currentSession->set('securiy_code'.(JRequest::getVar('instanceNo')+0), $security_code);*/
|
302 |
-
Mage::getSingleton('core/session')->setSecuriyCode($security_code);
|
303 |
-
//$security_code= Mage::getSingleton('core/session')->getSecuriyCode();
|
304 |
-
$width = 120;//100;
|
305 |
-
$height = 40;//20;
|
306 |
-
|
307 |
-
|
308 |
-
}
|
309 |
-
// generates plain letters
|
310 |
-
function create_imagePlane()
|
311 |
-
{
|
312 |
-
//Let's generate a totally random string using md5
|
313 |
-
$md5_hash = md5(rand(0,999));
|
314 |
-
//We don't need a 32 character long string so we trim it down to 5
|
315 |
-
$security_code = str_replace(array("0","O","o"), array("p"),substr($md5_hash, 15, 5));
|
316 |
-
|
317 |
-
//Set the session to store the security code
|
318 |
-
//$_SESSION["security_code"]
|
319 |
-
/*$currentSession = & JFactory::getSession() ;//&JSession::getInstance('none',array());
|
320 |
-
$currentSession->set('securiy_code'.(JRequest::getVar('instanceNo')+0), $security_code);*/
|
321 |
-
Mage::getSingleton('core/session')->setSecuriyCode($security_code);
|
322 |
-
$width = 120;//100;
|
323 |
-
$height = 40;//20;
|
324 |
-
$image = imagecreate($width, $height);
|
325 |
-
$this->setColors();
|
326 |
-
$foreground_color = $this->HexToRGB($this->textColor) ;//array(255,255,255);//array(180, 180, 180);//array(255,255,255);//
|
327 |
-
$background_color = $this->HexToRGB($this->bgColor) ;
|
328 |
-
//We are making three colors, white, black and gray
|
329 |
-
$white = imagecolorallocate ($image, $foreground_color[0],$foreground_color[1],$foreground_color[2]);//255, 255, 255);
|
330 |
-
$black = imagecolorallocate ($image,$background_color[0],$background_color[1],$background_color[2]);//44,127,7);// imagecolorallocate ($image, 0, 0, 0);
|
331 |
-
$grey = imagecolorallocate ($image, 204, 204, 204);
|
332 |
-
|
333 |
-
//Make the background black
|
334 |
-
imagefill($image, 0, 0, $black);
|
335 |
-
//imagestring($image, 3, 30, 3, $security_code, $white);
|
336 |
-
$size = 10;
|
337 |
-
$this->ly = (int)(2.4 * $size);
|
338 |
-
$x = 20;
|
339 |
-
for($i=0;$i<strlen($security_code);$i++)
|
340 |
-
{
|
341 |
-
|
342 |
-
$angle = rand(-45,45);
|
343 |
-
$y = intval(rand((int)($size * 1.5), (int)($this->ly - ($size / 7))));
|
344 |
-
|
345 |
-
@imagettftext($image, $size, $angle, $x + (int)($size / 15), $y, $white, dirname(__FILE__).DS.'osolCaptcha'.DS.'adlibBT.TTF', $security_code[$i]);
|
346 |
-
$x += ($size *2);
|
347 |
-
}
|
348 |
-
//imageline($image, 0, $height/2, $width, $height/2, $grey);
|
349 |
-
//imageline($image, $width/2, 0, $width/2, $height, $grey);
|
350 |
-
header('Content-type: image/png');
|
351 |
-
imagepng($image);
|
352 |
-
//imagedestroy($image);
|
353 |
-
}
|
354 |
function validateBotScout($XNAME){
|
355 |
$this->botscoutAPIKey = Mage::getStoreConfig("OutsourceOnline_Captcha/botscout/botscout_api_key");
|
356 |
$this->reportBotscoutNegativeMail = Mage::getStoreConfig("OutsourceOnline_Captcha/botscout/botscout_report_email");
|
18 |
* @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
|
19 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
*/
|
21 |
+
require_once(dirname(__FILE__)."/OSOLmulticaptcha.php");
|
22 |
class Outsourceonline_Captcha_Helper_Data extends Mage_Core_Helper_Abstract
|
23 |
{
|
24 |
|
33 |
var $reportBotscoutNegativeMail='';
|
34 |
function display()
|
35 |
{
|
36 |
+
$captcha = new OSOLmulticaptcha();
|
37 |
+
|
38 |
+
$imageFunction = 'create_image'.Mage::getStoreConfig("OutsourceOnline_Captcha/setup/image_function");
|
39 |
+
$imageFunction = ((!method_exists($captcha,$imageFunction)))?'create_imageAdv':$imageFunction;
|
40 |
+
$captcha->imageFunction = $imageFunction;
|
41 |
+
$font_size = (int)Mage::getStoreConfig("OutsourceOnline_Captcha/setup/letter_size");
|
42 |
+
$captcha->font_size = $font_size == 0 ? 24:$font_size;
|
43 |
+
$font_file = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/font_ttf");
|
44 |
+
$font_file = $font_file == '' ?basename($captcha->font_ttf) :$font_file;
|
45 |
+
$captcha->font_ttf = $captcha->fontPNGLocation.DIRECTORY_SEPARATOR.'ttfs'.DIRECTORY_SEPARATOR.$font_file;
|
46 |
+
$captcha->bgColor = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/background_color");
|
47 |
+
$captcha->textColor = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/text_color");
|
48 |
+
|
49 |
+
$captcha->symbolsToUse = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/characters_allowed");
|
50 |
+
//$captcha->fluctuation_amplitude = 4;//changing this creates unexpected issues
|
51 |
+
$captcha->white_noise_density = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/noise_in_bg") + 0 ;
|
52 |
+
$captcha->black_noise_density = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/noise_in_text") + 0;
|
53 |
+
|
54 |
+
//die( "<pre>".print_r($captcha,true)."</pre>");
|
55 |
+
|
56 |
+
$security_code = $captcha->displayCaptcha();
|
57 |
+
//Set the session to store the security code
|
58 |
+
|
59 |
+
Mage::getSingleton('core/session')->setSecuriyCode($security_code);
|
60 |
exit;
|
61 |
+
|
62 |
|
63 |
|
64 |
return true;
|
71 |
//$this->botscoutCheck();
|
72 |
return ($sessionSecurity_code == $postedSecurityCode);
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
function validateBotScout($XNAME){
|
76 |
$this->botscoutAPIKey = Mage::getStoreConfig("OutsourceOnline_Captcha/botscout/botscout_api_key");
|
77 |
$this->reportBotscoutNegativeMail = Mage::getStoreConfig("OutsourceOnline_Captcha/botscout/botscout_report_email");
|
app/code/community/OutsourceOnline/Captcha/Helper/OSOLmulticaptcha.php
ADDED
@@ -0,0 +1,554 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
# OSOLMulticaptcha version 1.0
|
3 |
+
|
4 |
+
/* ===================================================
|
5 |
+
* @author
|
6 |
+
* Name: Sreekanth Dayanand, www.outsource-online.net
|
7 |
+
* Email: joomla@outsource-online.net
|
8 |
+
* Url: http://www.outsource-online.net
|
9 |
+
* ===================================================
|
10 |
+
* @copyright (C) 2012,2013 Sreekanth Dayanand, Outsource Online (www.outsource-online.net). All rights reserved.
|
11 |
+
* @license see http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL.
|
12 |
+
* You can use, redistribute this file and/or modify
|
13 |
+
* it under the terms of the GNU General Public License as published by
|
14 |
+
* the Free Software Foundation.
|
15 |
+
*If you use this software as a part of own sofware, you must leave copyright notices intact or add OSOLMulticaptcha copyright notices to own.
|
16 |
+
*/
|
17 |
+
|
18 |
+
# System requirements: PHP 5.3.1 + w/ GD
|
19 |
+
# Open previewCaptcha.php in browser for customization
|
20 |
+
/*
|
21 |
+
//simplest way to show captcha
|
22 |
+
$captcha = new OSOLmulticaptcha();
|
23 |
+
$captcha->displayCaptcha();*/
|
24 |
+
class OSOLmulticaptcha{
|
25 |
+
|
26 |
+
var $imageFunction = "Adv";
|
27 |
+
var $font_size = 36;
|
28 |
+
var $font_ttf = 'AdLibBT.TTF';
|
29 |
+
var $bgColor = "#2c8007";
|
30 |
+
var $textColor = "#ffffff";
|
31 |
+
|
32 |
+
var $symbolsToUse = "ABCDEFGHJKLMNPQRTWXY346789";//"234789acdeghklmnpqrwxyz";
|
33 |
+
var $fluctuation_amplitude = 4;
|
34 |
+
var $white_noise_density = 0;
|
35 |
+
var $black_noise_density = 0;
|
36 |
+
|
37 |
+
var $captchaLength = 5;
|
38 |
+
|
39 |
+
var $fontPNGFile = "font-png.png";
|
40 |
+
var $DS = "/";
|
41 |
+
var $fontPNGLocation = "";
|
42 |
+
var $fontMetaFile = 'fontFileMeta.meta';
|
43 |
+
|
44 |
+
|
45 |
+
|
46 |
+
function __construct()
|
47 |
+
{
|
48 |
+
|
49 |
+
$imageFunction = 'create_image'.((isset($_REQUEST['osolcaptcha_imageFunction']) && $_REQUEST['osolcaptcha_imageFunction'] !='')?$_REQUEST['osolcaptcha_imageFunction']:$this->imageFunction);
|
50 |
+
$this->imageFunction = ((!method_exists($this,$imageFunction)))?'create_imageAdv':$imageFunction;
|
51 |
+
|
52 |
+
$this->DS = DIRECTORY_SEPARATOR;
|
53 |
+
$this->fontPNGLocation = dirname(__FILE__).$this->DS.'osolCaptcha';
|
54 |
+
$font_ttf = $this->fontPNGLocation.$this->DS.'ttfs'.$this->DS.((isset($_REQUEST['osolcaptcha_font_ttf']) && $_REQUEST['osolcaptcha_font_ttf'] !='')?$_REQUEST['osolcaptcha_font_ttf']:$this->font_ttf);
|
55 |
+
$this->fontPNGFile = (isset($_REQUEST['previewCaptcha']) && $_REQUEST['previewCaptcha'] == 'True')?'temp.png':$this->fontPNGFile;
|
56 |
+
$this->fontMetaFile = (isset($_REQUEST['previewCaptcha']) && $_REQUEST['previewCaptcha'] == 'True')?'temp.meta':$this->fontMetaFile;
|
57 |
+
$this->font_ttf = file_exists($font_ttf) && !is_dir($font_ttf)?$font_ttf:$this->font_ttf;
|
58 |
+
$this->font_size = (isset($_REQUEST['osolcaptcha_font_size']) && $_REQUEST['osolcaptcha_font_size'] !='')?$_REQUEST['osolcaptcha_font_size']:$this->font_size;
|
59 |
+
|
60 |
+
$this->bgColor = (isset($_REQUEST['osolcaptcha_bgColor']) && $_REQUEST['osolcaptcha_bgColor'] !='')?$_REQUEST['osolcaptcha_bgColor']:$this->bgColor;
|
61 |
+
$this->textColor = (isset($_REQUEST['osolcaptcha_textColor']) && $_REQUEST['osolcaptcha_textColor'] !='')?$_REQUEST['osolcaptcha_textColor']:$this->textColor;
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
$this->fluctuation_amplitude = (isset($_REQUEST['osol_fluctuation']) && $_REQUEST['osol_fluctuation'] != '')?$_REQUEST['osol_fluctuation']:$this->fluctuation_amplitude;
|
67 |
+
$this->white_noise_density=(isset($_REQUEST['white_noise_density']) && $_REQUEST['white_noise_density'] != '')?$_REQUEST['white_noise_density']:$this->white_noise_density; // no white noise
|
68 |
+
//$white_noise_density=1/6;
|
69 |
+
$this->black_noise_density=(isset($_REQUEST['black_noise_density']) && $_REQUEST['black_noise_density'] != '')?$_REQUEST['black_noise_density']:$this->black_noise_density; // no black noise
|
70 |
+
|
71 |
+
$this->symbolsToUse = ((isset($_REQUEST['osolcaptcha_symbolsToUse']) && $_REQUEST['osolcaptcha_symbolsToUse'] !='')?$_REQUEST['osolcaptcha_symbolsToUse']:$this->symbolsToUse);
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
}
|
78 |
+
function displayCaptcha()
|
79 |
+
{
|
80 |
+
|
81 |
+
$imageFunction = $this->imageFunction;
|
82 |
+
set_time_limit(1000);
|
83 |
+
if($imageFunction == 'create_imageAdv')
|
84 |
+
{
|
85 |
+
$this->callCreateAlphaImageForDistorted();
|
86 |
+
}
|
87 |
+
$this->$imageFunction();
|
88 |
+
return $this->keystring;
|
89 |
+
}
|
90 |
+
|
91 |
+
function createKeyString()
|
92 |
+
{
|
93 |
+
$allowed_symbols = $this->symbolsToUse;
|
94 |
+
while(true){
|
95 |
+
$this->keystring='';
|
96 |
+
for($i=0;$i<$this->captchaLength;$i++){
|
97 |
+
$this->keystring.=$allowed_symbols{mt_rand(0,strlen($allowed_symbols)-1)};
|
98 |
+
}
|
99 |
+
if(!preg_match('/cp|cb|ck|c6|c9|rn|rm|mm|co|do|cl|db|qp|qb|dp|ww/', $this->keystring)) break;
|
100 |
+
}
|
101 |
+
}
|
102 |
+
function callCreateAlphaImageForDistorted()
|
103 |
+
{
|
104 |
+
// Example usage - gif image output
|
105 |
+
$alphabet = $this->symbolsToUse;
|
106 |
+
|
107 |
+
$alphabet = implode(" ",str_split($alphabet));
|
108 |
+
$text_string = $alphabet;
|
109 |
+
|
110 |
+
$font_ttf = $this->font_ttf;
|
111 |
+
|
112 |
+
|
113 |
+
$text_angle = 0;
|
114 |
+
$text_padding = 20; // Img padding - around text
|
115 |
+
$font_size = $this->font_size;
|
116 |
+
$fontFileMeta = array(
|
117 |
+
'alphabet' => $alphabet,
|
118 |
+
'font_ttf' => basename($font_ttf),
|
119 |
+
'font_size' => $font_size,
|
120 |
+
);
|
121 |
+
$fontMetaFile = $this->fontPNGLocation.$this->DS.$this->fontMetaFile;
|
122 |
+
if(!file_exists($fontMetaFile) )
|
123 |
+
{
|
124 |
+
die("missing meta file : ".$fontMetaFile);
|
125 |
+
}
|
126 |
+
|
127 |
+
$savedfontMeta = unserialize( file_get_contents($fontMetaFile));
|
128 |
+
if(!is_array($savedfontMeta) || !isset($savedfontMeta['alphabet']) || !isset($savedfontMeta['font_ttf']) || !isset($savedfontMeta['font_size']))
|
129 |
+
{
|
130 |
+
die("corrupted meta file : ".$fontMetaFile." download the correct one ");
|
131 |
+
}
|
132 |
+
//die("Saved one <pre>".print_r(unserialize( file_get_contents($fontMetaFile)),true)."</pre><hr />Required one <pre>".print_r($fontFileMeta,true)."</pre>");
|
133 |
+
if( $savedfontMeta == $fontFileMeta)
|
134 |
+
{
|
135 |
+
|
136 |
+
return;
|
137 |
+
}
|
138 |
+
elseif(!(file_exists($font_ttf) || is_dir($font_ttf)))
|
139 |
+
{
|
140 |
+
$alphabet = $this->symbolsToUse = $savedfontMeta['alphabet'];
|
141 |
+
$font_ttf = $this->font_ttf = $savedfontMeta['font_ttf'];
|
142 |
+
$font_size = $this->font_size = $savedfontMeta['font_size'];
|
143 |
+
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
file_put_contents ( $fontMetaFile,serialize($fontFileMeta));
|
149 |
+
$the_box = $this->calculateTextBox($text_string, $font_ttf, $font_size, $text_angle);
|
150 |
+
|
151 |
+
$imgWidth = $the_box["width"] + $text_padding*2;
|
152 |
+
$imgHeight = $the_box["height"] + $text_padding*2;
|
153 |
+
$img = $image = imagecreatetruecolor($imgWidth,$imgHeight);
|
154 |
+
|
155 |
+
$colorBlack =imagecolorallocate($image,0,0,0);
|
156 |
+
|
157 |
+
imagealphablending($image, false);
|
158 |
+
imagesavealpha($image, true);
|
159 |
+
$transparent = imageColorAllocateAlpha($img, 0, 0, 0, 127);
|
160 |
+
imagefilledrectangle($image, 0, 0, $imgWidth-1, $imgHeight-1, $transparent);
|
161 |
+
imageAlphaBlending($image, true);
|
162 |
+
imageantialias($image, true);
|
163 |
+
|
164 |
+
|
165 |
+
imagettftext($image,
|
166 |
+
$font_size,
|
167 |
+
$text_angle,
|
168 |
+
$the_box["left"] + ($imgWidth / 2) - ($the_box["width"] / 2),
|
169 |
+
$the_box["top"] + ($imgHeight / 2) - ($the_box["height"] / 2) ,
|
170 |
+
$colorBlack,
|
171 |
+
$font_ttf,
|
172 |
+
$text_string);
|
173 |
+
imagealphablending($image, false);
|
174 |
+
imagesavealpha($image, true);
|
175 |
+
//header("content-type: image/png");imagepng($image);imagepng($image,'test.png');imagedestroy($image); exit;
|
176 |
+
$font_file = $this->fontPNGLocation.$this->DS.$this->fontPNGFile;
|
177 |
+
imagepng($image,$font_file);
|
178 |
+
$image = $this->createAlphaImage();
|
179 |
+
imagepng($image,$font_file);
|
180 |
+
|
181 |
+
}
|
182 |
+
function createAlphaImage()
|
183 |
+
{
|
184 |
+
|
185 |
+
$font_file = $this->fontPNGLocation.$this->DS.$this->fontPNGFile;
|
186 |
+
$img=imagecreatefrompng($font_file);
|
187 |
+
imageAlphaBlending($img, false);
|
188 |
+
imageSaveAlpha($img, true);
|
189 |
+
$transparent=imagecolorallocatealpha($img,255,255,255,127);
|
190 |
+
$white=imagecolorallocate($img,255,255,255);
|
191 |
+
$black=imagecolorallocate($img,0,0,0);
|
192 |
+
$gray=imagecolorallocate($img,100,100,100);
|
193 |
+
|
194 |
+
for($x=0;$x<imagesx($img);$x++){
|
195 |
+
$space=true;
|
196 |
+
$column_opacity=0;
|
197 |
+
for($y=1;$y<imagesy($img);$y++){
|
198 |
+
$rgb = ImageColorAt($img, $x, $y);
|
199 |
+
$opacity=$rgb>>24;
|
200 |
+
if($opacity!=127){
|
201 |
+
$space=false;
|
202 |
+
}
|
203 |
+
$column_opacity+=127-$opacity;
|
204 |
+
}
|
205 |
+
if(!$space){
|
206 |
+
imageline($img,$x,0,$x,0,$column_opacity<200?$gray:$black);
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
return $img;
|
211 |
+
|
212 |
+
// closedir($handle);
|
213 |
+
}
|
214 |
+
function validateFontfile($fontFile)
|
215 |
+
{
|
216 |
+
if(!(file_exists($fontFile) || is_dir($fontFile)))
|
217 |
+
{
|
218 |
+
die("Missing $fontFile.Cant create captcha without it");
|
219 |
+
}
|
220 |
+
}
|
221 |
+
/************
|
222 |
+
simple function that calculates the *exact* bounding box (single pixel precision).
|
223 |
+
The function returns an associative array with these keys:
|
224 |
+
left, top: coordinates you will pass to imagettftext
|
225 |
+
width, height: dimension of the image you have to create
|
226 |
+
*************/
|
227 |
+
function calculateTextBox($text,$fontFile,$fontSize,$fontAngle) {
|
228 |
+
//die($fontFile);
|
229 |
+
$this->validateFontfile($fontFile);
|
230 |
+
$rect = imagettfbbox($fontSize,$fontAngle,$fontFile,$text);
|
231 |
+
$minX = min(array($rect[0],$rect[2],$rect[4],$rect[6]));
|
232 |
+
$maxX = max(array($rect[0],$rect[2],$rect[4],$rect[6]));
|
233 |
+
$minY = min(array($rect[1],$rect[3],$rect[5],$rect[7]));
|
234 |
+
$maxY = max(array($rect[1],$rect[3],$rect[5],$rect[7]));
|
235 |
+
|
236 |
+
return array(
|
237 |
+
"left" => abs($minX) - 1,
|
238 |
+
"top" => abs($minY) - 1,
|
239 |
+
"width" => $maxX - $minX,
|
240 |
+
"height" => $maxY - $minY,
|
241 |
+
"box" => $rect
|
242 |
+
);
|
243 |
+
}
|
244 |
+
// generates distorted letters ,this is a revised version of a method used in kcaptcha
|
245 |
+
#http://www.phpclasses.org/browse/package/3193.html
|
246 |
+
|
247 |
+
# Copyright by Kruglov Sergei, 2006-2013
|
248 |
+
# www.captcha.ru, www.kruglov.ru
|
249 |
+
|
250 |
+
# System requirements: PHP 4.0.6+ w/ GD
|
251 |
+
|
252 |
+
# KCAPTCHA is a free software. You can freely use it for building own site or software.
|
253 |
+
# If you use this software as a part of own sofware, you must leave copyright notices intact or add KCAPTCHA copyright notices to own.
|
254 |
+
function create_imageAdv(){
|
255 |
+
|
256 |
+
|
257 |
+
$alphabet = $this->symbolsToUse;
|
258 |
+
$allowed_symbols = $this->symbolsToUse;
|
259 |
+
|
260 |
+
$length = $this->captchaLength;
|
261 |
+
|
262 |
+
$width = $this->font_size * 5;
|
263 |
+
$height = $this->font_size * 2.5;
|
264 |
+
$fluctuation_amplitude = $this->fluctuation_amplitude;
|
265 |
+
$white_noise_density=$this->white_noise_density; // no white noise
|
266 |
+
|
267 |
+
$black_noise_density=$this->black_noise_density; // no black noise
|
268 |
+
|
269 |
+
$no_spaces = true;
|
270 |
+
|
271 |
+
|
272 |
+
$jpeg_quality = 90;//die($this->bgColor.",".$this->textColor);
|
273 |
+
$background_color = $this->HexToRGB($this->bgColor) ;
|
274 |
+
$foreground_color = $this->HexToRGB($this->textColor);
|
275 |
+
|
276 |
+
$alphabet_length=strlen($alphabet);
|
277 |
+
|
278 |
+
do{
|
279 |
+
// generating random keystring
|
280 |
+
$this->createKeyString();
|
281 |
+
$font_file_name = $this->fontPNGFile;
|
282 |
+
$font_file = $this->fontPNGLocation.$this->DS.$font_file_name;
|
283 |
+
$this->validateFontfile($font_file);
|
284 |
+
$font=imagecreatefrompng($font_file);
|
285 |
+
imagealphablending($font, true);
|
286 |
+
$fontfile_width=imagesx($font);
|
287 |
+
$fontfile_height=imagesy($font)-1;
|
288 |
+
$font_metrics=array();
|
289 |
+
$symbol=0;
|
290 |
+
$reading_symbol=false;
|
291 |
+
|
292 |
+
// loading font
|
293 |
+
for($i=0;$i<$fontfile_width && $symbol<$alphabet_length;$i++){
|
294 |
+
$transparent = (imagecolorat($font, $i, 0) >> 24) == 127;
|
295 |
+
|
296 |
+
if(!$reading_symbol && !$transparent){
|
297 |
+
$font_metrics[$alphabet{$symbol}]=array('start'=>$i);
|
298 |
+
$reading_symbol=true;
|
299 |
+
continue;
|
300 |
+
}
|
301 |
+
|
302 |
+
if($reading_symbol && $transparent){
|
303 |
+
$font_metrics[$alphabet{$symbol}]['end']=$i;
|
304 |
+
$reading_symbol=false;
|
305 |
+
$symbol++;
|
306 |
+
continue;
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
$img=imagecreatetruecolor($width, $height);
|
311 |
+
imagealphablending($img, true);
|
312 |
+
$foreground_color = $this->HexToRGB($this->textColor);
|
313 |
+
$white= imagecolorallocate($img,$foreground_color[0],$foreground_color[1],$foreground_color[2]);//imagecolorallocate($img, 255, 255, 255);
|
314 |
+
$black=imagecolorallocate($img,$background_color[0],$background_color[1],$background_color[2]);//imagecolorallocate($img, 0, 0, 0);
|
315 |
+
|
316 |
+
imagefilledrectangle($img, 0, 0, $width-1, $height-1, $white);
|
317 |
+
|
318 |
+
// draw text
|
319 |
+
$x=1;
|
320 |
+
for($i=0;$i<$length;$i++){
|
321 |
+
$m=$font_metrics[$this->keystring{$i}];
|
322 |
+
|
323 |
+
$y=mt_rand(-$fluctuation_amplitude, $fluctuation_amplitude)+($height-$fontfile_height)/2+2;
|
324 |
+
|
325 |
+
if($no_spaces){
|
326 |
+
$shift=0;
|
327 |
+
if($i>0){
|
328 |
+
$shift=10000;
|
329 |
+
for($sy=7;$sy<$fontfile_height-20;$sy+=1){
|
330 |
+
for($sx=$m['start']-1;$sx<$m['end'];$sx+=1){
|
331 |
+
$rgb=imagecolorat($font, $sx, $sy);
|
332 |
+
$opacity=$rgb>>24;
|
333 |
+
if($opacity<127){
|
334 |
+
$left=$sx-$m['start']+$x;
|
335 |
+
$py=$sy+$y;
|
336 |
+
if($py>$height) break;
|
337 |
+
for($px=min($left,$width-1);$px>$left-12 && $px>=0;$px-=1){
|
338 |
+
$color=imagecolorat($img, $px, $py) & 0xff;
|
339 |
+
if($color+$opacity<190){
|
340 |
+
if($shift>$left-$px){
|
341 |
+
$shift=$left-$px;
|
342 |
+
}
|
343 |
+
break;
|
344 |
+
}
|
345 |
+
}
|
346 |
+
break;
|
347 |
+
}
|
348 |
+
}
|
349 |
+
}
|
350 |
+
if($shift==10000){
|
351 |
+
$shift=mt_rand(4,6);
|
352 |
+
}
|
353 |
+
|
354 |
+
}
|
355 |
+
}else{
|
356 |
+
$shift=1;
|
357 |
+
}
|
358 |
+
imagecopy($img, $font, $x-$shift, $y, $m['start'], 1, $m['end']-$m['start'], $fontfile_height);
|
359 |
+
$x+=$m['end']-$m['start']-$shift;
|
360 |
+
}
|
361 |
+
}while($x>=$width-10); // while not fit in canvas
|
362 |
+
|
363 |
+
//noise
|
364 |
+
|
365 |
+
for($i=0;$i<(($height-30)*$x)*$white_noise_density;$i++){
|
366 |
+
imagesetpixel($img, mt_rand(0, $x-1), mt_rand(10, $height-15), $black);
|
367 |
+
}
|
368 |
+
for($i=0;$i<(($height-30)*$x)*$black_noise_density;$i++){
|
369 |
+
imagesetpixel($img, mt_rand(0, $x-1), mt_rand(10, $height-15), $white);
|
370 |
+
}
|
371 |
+
|
372 |
+
|
373 |
+
$center=$x/2;
|
374 |
+
|
375 |
+
|
376 |
+
$img2=imagecreatetruecolor($width, $height);
|
377 |
+
$foreground=imagecolorallocate($img2, $foreground_color[0], $foreground_color[1], $foreground_color[2]);
|
378 |
+
$background=imagecolorallocate($img2, $background_color[0], $background_color[1], $background_color[2]);
|
379 |
+
imagefilledrectangle($img2, 0, 0, $width-1, $height-1, $background);
|
380 |
+
imagefilledrectangle($img2, 0, $height, $width-1, $height+12, $foreground);
|
381 |
+
|
382 |
+
|
383 |
+
// periods
|
384 |
+
$rand1=mt_rand(750000,1200000)/10000000;
|
385 |
+
$rand2=mt_rand(750000,1200000)/10000000;
|
386 |
+
$rand3=mt_rand(750000,1200000)/10000000;
|
387 |
+
$rand4=mt_rand(750000,1200000)/10000000;
|
388 |
+
// phases
|
389 |
+
$rand5=mt_rand(0,31415926)/10000000;
|
390 |
+
$rand6=mt_rand(0,31415926)/10000000;
|
391 |
+
$rand7=mt_rand(0,31415926)/10000000;
|
392 |
+
$rand8=mt_rand(0,31415926)/10000000;
|
393 |
+
// amplitudes
|
394 |
+
$rand9=mt_rand(330,420)/110;
|
395 |
+
$rand10=mt_rand(330,450)/110;
|
396 |
+
|
397 |
+
//wave distortion
|
398 |
+
|
399 |
+
for($x=0;$x<$width;$x++){
|
400 |
+
for($y=0;$y<$height;$y++){
|
401 |
+
$sx=$x+(sin($x*$rand1+$rand5)+sin($y*$rand3+$rand6))*$rand9-$width/2+$center+1;
|
402 |
+
$sy=$y+(sin($x*$rand2+$rand7)+sin($y*$rand4+$rand8))*$rand10;
|
403 |
+
|
404 |
+
if($sx<0 || $sy<0 || $sx>=$width-1 || $sy>=$height-1){
|
405 |
+
continue;
|
406 |
+
}else{
|
407 |
+
$color=imagecolorat($img, $sx, $sy) & 0xFF;
|
408 |
+
$color_x=imagecolorat($img, $sx+1, $sy) & 0xFF;
|
409 |
+
$color_y=imagecolorat($img, $sx, $sy+1) & 0xFF;
|
410 |
+
$color_xy=imagecolorat($img, $sx+1, $sy+1) & 0xFF;
|
411 |
+
}
|
412 |
+
|
413 |
+
if($color==255 && $color_x==255 && $color_y==255 && $color_xy==255){
|
414 |
+
continue;
|
415 |
+
}else if($color==0 && $color_x==0 && $color_y==0 && $color_xy==0){
|
416 |
+
$newred=$foreground_color[0];
|
417 |
+
$newgreen=$foreground_color[1];
|
418 |
+
$newblue=$foreground_color[2];
|
419 |
+
}else{
|
420 |
+
$frsx=$sx-floor($sx);
|
421 |
+
$frsy=$sy-floor($sy);
|
422 |
+
$frsx1=1-$frsx;
|
423 |
+
$frsy1=1-$frsy;
|
424 |
+
|
425 |
+
$newcolor=(
|
426 |
+
$color*$frsx1*$frsy1+
|
427 |
+
$color_x*$frsx*$frsy1+
|
428 |
+
$color_y*$frsx1*$frsy+
|
429 |
+
$color_xy*$frsx*$frsy);
|
430 |
+
|
431 |
+
if($newcolor>255) $newcolor=255;
|
432 |
+
$newcolor=$newcolor/255;
|
433 |
+
$newcolor0=1-$newcolor;
|
434 |
+
|
435 |
+
$newred=$newcolor0*$foreground_color[0]+$newcolor*$background_color[0];
|
436 |
+
$newgreen=$newcolor0*$foreground_color[1]+$newcolor*$background_color[1];
|
437 |
+
$newblue=$newcolor0*$foreground_color[2]+$newcolor*$background_color[2];
|
438 |
+
}
|
439 |
+
|
440 |
+
imagesetpixel($img2, $x, $y, imagecolorallocate($img2, $newred, $newgreen, $newblue));
|
441 |
+
}
|
442 |
+
}
|
443 |
+
//die($this->keystring);
|
444 |
+
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
445 |
+
header('Cache-Control: no-store, no-cache, must-revalidate');
|
446 |
+
header('Cache-Control: post-check=0, pre-check=0', FALSE);
|
447 |
+
header('Pragma: no-cache');
|
448 |
+
|
449 |
+
if(function_exists("imagejpeg")){
|
450 |
+
header("Content-Type: image/jpeg");
|
451 |
+
imagejpeg($img2, null, $jpeg_quality);
|
452 |
+
}else if(function_exists("imagegif")){
|
453 |
+
header("Content-Type: image/gif");
|
454 |
+
imagegif($img2);
|
455 |
+
|
456 |
+
|
457 |
+
|
458 |
+
}else if(function_exists("imagepng")){
|
459 |
+
header("Content-Type: image/x-png");
|
460 |
+
imagepng($img2);
|
461 |
+
}
|
462 |
+
|
463 |
+
|
464 |
+
$this->storeKeyString();
|
465 |
+
|
466 |
+
|
467 |
+
}
|
468 |
+
function storeKeyString()
|
469 |
+
{
|
470 |
+
//$keyStringFile = $this->fontPNGLocation.$this->DS.'keystring.txt';$fp = fopen($keyStringFile,'w');fwrite($fp,$this->keystring);fclose($fp);
|
471 |
+
}
|
472 |
+
// generates plain letters
|
473 |
+
function create_imagePlane()
|
474 |
+
{
|
475 |
+
|
476 |
+
$length = 5;
|
477 |
+
$allowed_symbols = $this->symbolsToUse;
|
478 |
+
// generating random keystring
|
479 |
+
$this->createKeyString();
|
480 |
+
|
481 |
+
|
482 |
+
$width = $this->font_size * 5;
|
483 |
+
$height = $this->font_size * 2.5;
|
484 |
+
|
485 |
+
$image = imagecreate($width, $height);
|
486 |
+
//$this->setColors();
|
487 |
+
$foreground_color = $this->HexToRGB($this->textColor);
|
488 |
+
$background_color = $this->HexToRGB($this->bgColor) ;
|
489 |
+
//We are making three colors, white, black and gray
|
490 |
+
$white = imagecolorallocate ($image, $foreground_color[0],$foreground_color[1],$foreground_color[2]);//255, 255, 255);
|
491 |
+
$black = imagecolorallocate ($image,$background_color[0],$background_color[1],$background_color[2]);//44,127,7);// imagecolorallocate ($image, 0, 0, 0);
|
492 |
+
$grey = imagecolorallocate ($image, 204, 204, 204);
|
493 |
+
|
494 |
+
//Make the background black
|
495 |
+
imagefill($image, 0, 0, $black);
|
496 |
+
|
497 |
+
$size = ceil($this->font_size/2);
|
498 |
+
$this->ly = (int)(4.4 * $size);
|
499 |
+
$x = ceil($size/2);//20;
|
500 |
+
for($i=0;$i<strlen($this->keystring);$i++)
|
501 |
+
{
|
502 |
+
|
503 |
+
$angle = rand(-45,45);
|
504 |
+
$y = intval(rand((int)($size * 1.5), (int)($this->ly - ($size / 7))));
|
505 |
+
|
506 |
+
@imagettftext($image, $size, $angle, $x + (int)($size / 15), $y, $white, $this->font_ttf, $this->keystring[$i]);
|
507 |
+
|
508 |
+
//noise
|
509 |
+
$white_noise_density=$this->white_noise_density;
|
510 |
+
|
511 |
+
$black_noise_density=$this->black_noise_density;
|
512 |
+
//$this->calculateTextBox($this->keystring[$i],$this->font_ttf,$size, $angle);//left,top,widht,height
|
513 |
+
for($i2=0;$i2<(($height-30)*$x)*$white_noise_density/4;$i2++){
|
514 |
+
imagesetpixel($image, mt_rand(0, $width), mt_rand(10, $height-15), $white);
|
515 |
+
}
|
516 |
+
for($i2=0;$i2<(($height-30)*$x)*$black_noise_density/4;$i2++){
|
517 |
+
imagesetpixel($image, mt_rand(0, $width), mt_rand(10, $height-15), $black);
|
518 |
+
}
|
519 |
+
$x += ($size *2);
|
520 |
+
}
|
521 |
+
|
522 |
+
header('Content-type: image/png');
|
523 |
+
imagepng($image);
|
524 |
+
|
525 |
+
$this->storeKeyString();
|
526 |
+
}
|
527 |
+
function HexToRGB($hex) {
|
528 |
+
$hex = preg_replace("/#/", "", $hex);
|
529 |
+
$color = array();
|
530 |
+
|
531 |
+
if(strlen($hex) == 3) {
|
532 |
+
$color['r'] = hexdec(substr($hex, 0, 1) . $r);
|
533 |
+
$color['g'] = hexdec(substr($hex, 1, 1) . $g);
|
534 |
+
$color['b'] = hexdec(substr($hex, 2, 1) . $b);
|
535 |
+
}
|
536 |
+
else if(strlen($hex) == 6) {
|
537 |
+
$color['r'] = hexdec(substr($hex, 0, 2));
|
538 |
+
$color['g'] = hexdec(substr($hex, 2, 2));
|
539 |
+
$color['b'] = hexdec(substr($hex, 4, 2));
|
540 |
+
}
|
541 |
+
|
542 |
+
return array_values($color);
|
543 |
+
}
|
544 |
+
|
545 |
+
function RGBToHex($r, $g, $b) {
|
546 |
+
$hex = "#";
|
547 |
+
$hex.= dechex($r);
|
548 |
+
$hex.= dechex($g);
|
549 |
+
$hex.= dechex($b);
|
550 |
+
|
551 |
+
return $hex;
|
552 |
+
}
|
553 |
+
}
|
554 |
+
?>
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/adlibBT.png
DELETED
Binary file
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ajax-loader-big.gif
ADDED
Binary file
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/font-png.png
ADDED
Binary file
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/fontFileMeta.meta
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
a:3:{s:8:"alphabet";s:51:"A B C D E F G H J K L M N P Q R T W X Y 3 4 6 7 8 9";s:8:"font_ttf";s:19:"BookmanOldStyle.TTF";s:9:"font_size";i:78;}
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/temp.meta
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
a:3:{s:8:"alphabet";s:51:"A B C D E F G H J K L M N P Q R T W X Y 3 4 6 7 8 9";s:8:"font_ttf";s:11:"AdLibBT.TTF";s:9:"font_size";s:2:"36";}
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/temp.png
ADDED
Binary file
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/{adlibBT.TTF → ttfs/AdLibBT.TTF}
RENAMED
File without changes
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ttfs/BookmanOldStyle.TTF
ADDED
Binary file
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ttfs/CooperBlack.TTF
ADDED
Binary file
|
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/ttfs/index.html
ADDED
File without changes
|
app/code/community/OutsourceOnline/Captcha/Model/Source/Captchafonts.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Outsource Online Captcha Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Outsource Online
|
16 |
+
* @package OutsourceOnline_Captcha
|
17 |
+
* @author Sreekanth Dayanand
|
18 |
+
* @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
class OutsourceOnline_Captcha_Model_Source_Captchafonts
|
22 |
+
{
|
23 |
+
public function toOptionArray()
|
24 |
+
{
|
25 |
+
$ttfPath = realpath(dirname(__FILE__)."/../../Helper/osolCaptcha/ttfs")."/";
|
26 |
+
$ttfsAvailable = array();
|
27 |
+
if ($handle = opendir($ttfPath)) {
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
while (false !== ($entry = readdir($handle))) {
|
32 |
+
if(preg_match("@.*\.(ttf|otf)@i",$entry))
|
33 |
+
{
|
34 |
+
|
35 |
+
$ttfsAvailable[] = array('value' => $entry, 'label' => $entry);
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
|
41 |
+
closedir($handle);
|
42 |
+
}
|
43 |
+
return $ttfsAvailable;
|
44 |
+
}
|
45 |
+
}
|
app/code/community/OutsourceOnline/Captcha/Model/Source/Captchafontsize.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Outsource Online Captcha Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Outsource Online
|
16 |
+
* @package OutsourceOnline_Captcha
|
17 |
+
* @author Sreekanth Dayanand
|
18 |
+
* @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
class OutsourceOnline_Captcha_Model_Source_Captchafontsize
|
22 |
+
{
|
23 |
+
public function toOptionArray()
|
24 |
+
{
|
25 |
+
return array(array('value' => '24', 'label' => '24'),
|
26 |
+
array('value' => '36', 'label' => '36'),
|
27 |
+
array('value' => '48', 'label' => '48'),
|
28 |
+
array('value' => '78', 'label' => '72')
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
app/code/community/OutsourceOnline/Captcha/Model/Source/Captchanoise.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Outsource Online Captcha Extension
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* @category Outsource Online
|
16 |
+
* @package OutsourceOnline_Captcha
|
17 |
+
* @author Sreekanth Dayanand
|
18 |
+
* @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
|
19 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
+
*/
|
21 |
+
class OutsourceOnline_Captcha_Model_Source_Captchanoise
|
22 |
+
{
|
23 |
+
public function toOptionArray()
|
24 |
+
{
|
25 |
+
return array(array('value' => '0', 'label' => '0'),
|
26 |
+
array('value' => '.1', 'label' => '.1'),
|
27 |
+
array('value' => '.2', 'label' => '.2'),
|
28 |
+
array('value' => '.3', 'label' => '.3')
|
29 |
+
);
|
30 |
+
}
|
31 |
+
}
|
app/code/community/OutsourceOnline/Captcha/etc/config.xml
CHANGED
@@ -23,7 +23,7 @@
|
|
23 |
<config>
|
24 |
<modules>
|
25 |
<OutsourceOnline_Captcha>
|
26 |
-
<version>2.0.
|
27 |
</OutsourceOnline_Captcha>
|
28 |
</modules>
|
29 |
|
@@ -137,9 +137,14 @@
|
|
137 |
<default>
|
138 |
<OutsourceOnline_Captcha>
|
139 |
<setup>
|
|
|
|
|
|
|
140 |
<background_color>#2C8007</background_color>
|
141 |
<text_color>#FFFFFF</text_color>
|
142 |
-
|
|
|
|
|
143 |
<language>en</language>
|
144 |
|
145 |
</setup>
|
23 |
<config>
|
24 |
<modules>
|
25 |
<OutsourceOnline_Captcha>
|
26 |
+
<version>2.0.1</version>
|
27 |
</OutsourceOnline_Captcha>
|
28 |
</modules>
|
29 |
|
137 |
<default>
|
138 |
<OutsourceOnline_Captcha>
|
139 |
<setup>
|
140 |
+
<image_function>Adv</image_function>
|
141 |
+
<letter_size>24</letter_size>
|
142 |
+
<font_ttf>AdLibBT.TTF</font_ttf>
|
143 |
<background_color>#2C8007</background_color>
|
144 |
<text_color>#FFFFFF</text_color>
|
145 |
+
<characters_allowed>ABCDEFGHJKLMNPQRTWXY346789</characters_allowed>
|
146 |
+
<noise_in_bg>0</noise_in_bg>
|
147 |
+
<noise_in_text>0</noise_in_text>
|
148 |
<language>en</language>
|
149 |
|
150 |
</setup>
|
app/code/community/OutsourceOnline/Captcha/etc/system.xml
CHANGED
@@ -45,43 +45,90 @@
|
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>1</show_in_store>
|
47 |
<fields>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<background_color translate="label">
|
49 |
<label>Background color</label>
|
50 |
<frontend_type>text</frontend_type>
|
51 |
<value>#2C8007</value>
|
52 |
-
<sort_order>
|
53 |
<show_in_default>1</show_in_default>
|
54 |
<show_in_website>1</show_in_website>
|
55 |
<show_in_store>1</show_in_store>
|
56 |
</background_color>
|
57 |
-
|
58 |
<label>Text color</label>
|
59 |
<frontend_type>text</frontend_type>
|
60 |
<value>#FFFFFF</value>
|
61 |
-
<sort_order>
|
62 |
<show_in_default>1</show_in_default>
|
63 |
<show_in_website>1</show_in_website>
|
64 |
<show_in_store>1</show_in_store>
|
65 |
</text_color>
|
66 |
-
|
67 |
-
<label>
|
68 |
<frontend_type>select</frontend_type>
|
69 |
-
<source_model>OutsourceOnline_Captcha/
|
70 |
-
<sort_order>
|
71 |
<show_in_default>1</show_in_default>
|
72 |
<show_in_website>1</show_in_website>
|
73 |
<show_in_store>1</show_in_store>
|
74 |
-
</
|
75 |
-
|
76 |
-
<label>
|
77 |
<frontend_type>select</frontend_type>
|
78 |
-
<source_model>OutsourceOnline_Captcha/
|
79 |
-
<sort_order>
|
80 |
<show_in_default>1</show_in_default>
|
81 |
<show_in_website>1</show_in_website>
|
82 |
<show_in_store>1</show_in_store>
|
83 |
-
</
|
84 |
-
|
85 |
</fields>
|
86 |
</setup>
|
87 |
<captcha translate="label">
|
45 |
<show_in_website>1</show_in_website>
|
46 |
<show_in_store>1</show_in_store>
|
47 |
<fields>
|
48 |
+
|
49 |
+
<image_function translate="label">
|
50 |
+
<label>Image function</label>
|
51 |
+
<frontend_type>select</frontend_type>
|
52 |
+
<source_model>OutsourceOnline_Captcha/source_Captchaimage</source_model>
|
53 |
+
<sort_order>1</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
</image_function>
|
58 |
+
<characters_allowed translate="label">
|
59 |
+
<label>Characters allowed</label>
|
60 |
+
<frontend_type>text</frontend_type>
|
61 |
+
<value>ABCDEFGHJKLMNPQRTWXY346789</value>
|
62 |
+
<sort_order>2</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
</characters_allowed>
|
67 |
+
<letter_size translate="label">
|
68 |
+
<label>Letter Size</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>OutsourceOnline_Captcha/source_Captchafontsize</source_model>
|
71 |
+
<sort_order>3</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
</letter_size>
|
76 |
+
<font_ttf translate="label">
|
77 |
+
<label>Font</label>
|
78 |
+
<frontend_type>select</frontend_type>
|
79 |
+
<source_model>OutsourceOnline_Captcha/source_Captchafonts</source_model>
|
80 |
+
<sort_order>4</sort_order>
|
81 |
+
<show_in_default>1</show_in_default>
|
82 |
+
<show_in_website>1</show_in_website>
|
83 |
+
<show_in_store>1</show_in_store>
|
84 |
+
</font_ttf>
|
85 |
+
|
86 |
+
<!--<language translate="label">
|
87 |
+
<label>Language</label>
|
88 |
+
<frontend_type>select</frontend_type>
|
89 |
+
<source_model>OutsourceOnline_Captcha/source_captchalanguage</source_model>
|
90 |
+
<sort_order>5</sort_order>
|
91 |
+
<show_in_default>1</show_in_default>
|
92 |
+
<show_in_website>1</show_in_website>
|
93 |
+
<show_in_store>1</show_in_store>
|
94 |
+
</language>-->
|
95 |
<background_color translate="label">
|
96 |
<label>Background color</label>
|
97 |
<frontend_type>text</frontend_type>
|
98 |
<value>#2C8007</value>
|
99 |
+
<sort_order>6</sort_order>
|
100 |
<show_in_default>1</show_in_default>
|
101 |
<show_in_website>1</show_in_website>
|
102 |
<show_in_store>1</show_in_store>
|
103 |
</background_color>
|
104 |
+
<text_color translate="label">
|
105 |
<label>Text color</label>
|
106 |
<frontend_type>text</frontend_type>
|
107 |
<value>#FFFFFF</value>
|
108 |
+
<sort_order>7</sort_order>
|
109 |
<show_in_default>1</show_in_default>
|
110 |
<show_in_website>1</show_in_website>
|
111 |
<show_in_store>1</show_in_store>
|
112 |
</text_color>
|
113 |
+
<noise_in_bg translate="label">
|
114 |
+
<label>Noise in BG</label>
|
115 |
<frontend_type>select</frontend_type>
|
116 |
+
<source_model>OutsourceOnline_Captcha/source_Captchanoise</source_model>
|
117 |
+
<sort_order>8</sort_order>
|
118 |
<show_in_default>1</show_in_default>
|
119 |
<show_in_website>1</show_in_website>
|
120 |
<show_in_store>1</show_in_store>
|
121 |
+
</noise_in_bg>
|
122 |
+
<noise_in_text translate="label">
|
123 |
+
<label>Noise in text</label>
|
124 |
<frontend_type>select</frontend_type>
|
125 |
+
<source_model>OutsourceOnline_Captcha/source_Captchanoise</source_model>
|
126 |
+
<sort_order>9</sort_order>
|
127 |
<show_in_default>1</show_in_default>
|
128 |
<show_in_website>1</show_in_website>
|
129 |
<show_in_store>1</show_in_store>
|
130 |
+
</noise_in_text>
|
131 |
+
|
132 |
</fields>
|
133 |
</setup>
|
134 |
<captcha translate="label">
|
app/design/frontend/default/default/template/outsourceOnline/captcha/captcha.phtml
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Outsource Online Captcha Extension
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Outsource Online
|
16 |
-
* @package OutsourceOnline_Captcha
|
17 |
-
* @author Sreekanth Dayanand
|
18 |
-
* @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
|
19 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
20 |
-
*/
|
21 |
-
?>
|
22 |
-
<?php
|
23 |
-
$theme = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/theme");
|
24 |
-
$language = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/language");
|
25 |
-
$publickey = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/public_key");
|
26 |
-
$textbox = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/textbox");
|
27 |
-
?>
|
28 |
-
|
29 |
-
|
30 |
-
<?php if( $theme == 'magento'): ?>
|
31 |
-
|
32 |
-
<?php echo "<script> var RecaptchaOptions = { theme : 'custom', lang : '$language', custom_theme_widget: 'recaptcha_widget' }; </script>"; ?>
|
33 |
-
<div id="recaptcha_widget" class="group-select wide" style="display:none">
|
34 |
-
<h4 class="legend" style="background-image: none;">Recaptcha</h4>
|
35 |
-
<div style="margin-bottom: 10px; margin-top: 5px;"><?php echo $textbox; ?></div>
|
36 |
-
<div class="col2-set">
|
37 |
-
<div class="col-1" style="width: 305px; margin-right: 15px; background: transparent; border: 0px none;">
|
38 |
-
<div id="recaptcha_image" style="border: 1px solid #CCCCCC; margin-bottom: 10px;"></div>
|
39 |
-
<div style="text-align: center;">
|
40 |
-
<span class="recaptcha_only_if_image"><?php echo Mage::getStoreConfig("outsourceonline_captcha/magento/text_captcha") ?></span>
|
41 |
-
<span class="recaptcha_only_if_audio"><?php echo Mage::getStoreConfig("outsourceonline_captcha/magento/audio_captcha") ?></span>
|
42 |
-
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" class="input-text required-entry" />
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
<div class="col-2" style="float: left; width: 25px; background: transparent; border: 0px none;">
|
46 |
-
<div><a href="javascript:Recaptcha.reload()"><img src="<?php echo $this->getSkinUrl('images/fontis/refresh.png');?>" title="Get another CAPTCHA" alt="Get another CAPTCHA"/></a></div>
|
47 |
-
<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')"><img src="<?php echo $this->getSkinUrl('images/fontis/sound.png');?>" title="Get an audio CAPTCHA" alt="Get an audio CAPTCHA"/></a></div>
|
48 |
-
<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')"><img src="<?php echo $this->getSkinUrl('images/fontis/text.png');?>" title="Get an image CAPTCHA" alt="Get an image CAPTCHA"/></a></div>
|
49 |
-
<div><a href="javascript:Recaptcha.showhelp()"><img src="<?php echo $this->getSkinUrl('images/fontis/help.png');?>" title="Help" alt="Help"/></a></div>
|
50 |
-
</div>
|
51 |
-
</div>
|
52 |
-
<?php echo Mage::helper("outsourceonline_captcha")->captcha_get_html($publickey, null, Mage::app()->getRequest()->isSecure()); ?>
|
53 |
-
</div>
|
54 |
-
|
55 |
-
<?php elseif( $theme == 'custom' ): ?>
|
56 |
-
|
57 |
-
<p>To create your custom recaptcha theme copy default/templates/outsourceOnline/captcha.phtml to your_theme/templates/outsourceOnline/captcha.phtml and replace this text with custom theme code.</p>
|
58 |
-
|
59 |
-
<?php else: ?>
|
60 |
-
|
61 |
-
<div style="margin-bottom: 10px;"><?php echo $textbox; ?></div>
|
62 |
-
<?php
|
63 |
-
echo "<script> var RecaptchaOptions = { theme : '$theme', lang : '$language' }; </script>";
|
64 |
-
echo Mage::helper("outsourceonline_captcha")->recaptcha_get_html($publickey, null, Mage::app()->getRequest()->isSecure());
|
65 |
-
?>
|
66 |
-
|
67 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>OutsourceOnline_Captcha</name>
|
4 |
-
<version>2.0.
|
5 |
<stability>stable</stability>
|
6 |
<license>gpl</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Captcha functionality for magento forms for registration,contactus,product review and send a friend .Simply install the module and check the aforementioned forms</description>
|
11 |
<notes>This is a development version.Any valuable suggestions and help will be highly appreciated</notes>
|
12 |
<authors><author><name>Sreekanth Dayanand</name><user>auto-converted</user><email>blogspot@outsource-online.net</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>OutsourceOnline_Captcha</name>
|
4 |
+
<version>2.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>gpl</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Captcha functionality for magento forms for registration,contactus,product review and send a friend .Simply install the module and check the aforementioned forms</description>
|
11 |
<notes>This is a development version.Any valuable suggestions and help will be highly appreciated</notes>
|
12 |
<authors><author><name>Sreekanth Dayanand</name><user>auto-converted</user><email>blogspot@outsource-online.net</email></author></authors>
|
13 |
+
<date>2013-06-13</date>
|
14 |
+
<time>09:31:12</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="OutsourceOnline_Captcha.xml" hash="7b700e1a3656005d4fc1b3f703a4269a"/></dir></target><target name="magecommunity"><dir name="OutsourceOnline"><dir name="Captcha"><dir name="Block"><dir name="Checkout"><dir name="Onepage"><file name="Billing.php" hash="d9610a7617bf208112283751282a5732"/></dir></dir><dir name="Review"><file name="Form.php" hash="d9039bc65bbf00e4e9a42e405b5864a9"/></dir></dir><dir name="Helper"><dir name="osolCaptcha"><dir name="ttfs"><file name="AdLibBT.TTF" hash="4ff833d37c38398cd201b2550bf8ecb5"/><file name="BookmanOldStyle.TTF" hash="4267d8aa8711bb8c72cbefb26066c9e0"/><file name="CooperBlack.TTF" hash="8eb03871e6046162efce5f2cdf5fa849"/><file name="index.html" hash="d41d8cd98f00b204e9800998ecf8427e"/></dir><file name="ajax-loader-big.gif" hash="a51c5608d01acf32df728f299767f82b"/><file name="font-png.png" hash="404b9571f4890235663353734cdb4024"/><file name="fontFileMeta.meta" hash="03cf0f85083974b905553ecb40174de4"/><file name="temp.meta" hash="625e359f6a3bfa64572544d5bf0a073d"/><file name="temp.png" hash="697c73c21eb60c6c237b0bf099428267"/></dir><file name="Data.php" hash="456a11d22a28118e327353af79a2095f"/><file name="OSOLmulticaptcha.php" hash="c4a2e999bb41d1bf4a217ccb2dfc5fea"/></dir><dir name="Model"><dir name="Source"><file name="Captchafonts.php" hash="4ac034345994bdf1eeada4ff0f1b4d22"/><file name="Captchafontsize.php" hash="c6d6c3d7107363f1aa1111663bb14647"/><file name="Captchaimage.php" hash="b49acab3a47cfa798aa16825f6417c82"/><file name="Captchalanguage.php" hash="89d9e8e16788d84c5ce8fcc2a9e07925"/><file name="Captchanoise.php" hash="cf5367e941950ebe7fc5786a550c0f17"/></dir></dir><dir name="controllers"><file name="AccountController.php" hash="7b6a5ed8fbb5fbb4f9f430b36f945c33"/><file name="AjaxController.php" hash="8b923b7ba0ee6736e79a438dbbffade7"/><file name="ContactsController.php" hash="5150818931bd7b3b517f0297af025979"/><file name="OnepageController.php" hash="60026a5dc29fb0f0d0bf09dec20807f7"/><file name="ProductController.php" hash="cc313c03c7bcc966cafa331474f2bd4f"/><file name="ReviewController.php" hash="b188272e196ac3213bc311e75de367d1"/></dir><dir name="etc"><file name="config.xml" hash="e08ba74e30cad47bc9d6c8b72c6bf10d"/><file name="system.xml" hash="504c040bcc5e99e367e3b32aaccc5d32"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="OutsourceOnline_Captcha.xml" hash="1719b1ed76703472b09e550661de4a50"/></dir><dir name="template"><dir name="outsourceOnline"><dir name="captcha"><file name="ajaxInsert.phtml" hash="eb81b88715c0c927e4ef8dd0f4e82c82"/><file name="captchaAjax.phtml" hash="5feefbfb1a1aaad28aaadd572dafbe74"/><file name="contacts.phtml" hash="acc889439f7f2375c3c55bfd55e7e05a"/><file name="form.phtml" hash="c6c74543a1859affe1c5051516e76da4"/><file name="onepage_billing.phtml" hash="2d54f1a6b377e949571762cf3ac5f749"/><file name="register.phtml" hash="9140614281ccfd7b8cbc238a34048d6b"/><file name="send.phtml" hash="81196f45080cdfec3741bcab351b92c8"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="OutsourceOnline_Captcha.csv" hash="46c1c9105a99ef6a3e884381ba060fe9"/></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|