OutsourceOnline_Captcha - Version 2.0.1

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.1
Comparing to
See all releases


Code changes from version 2.0.0 to 2.0.1

Files changed (27) hide show
  1. app/code/community/OutsourceOnline/Captcha/Block/Checkout/Onepage/Billing.php +32 -0
  2. app/code/community/OutsourceOnline/Captcha/Block/Review/Form.php +28 -0
  3. app/code/community/OutsourceOnline/Captcha/Helper/Data.php +542 -0
  4. app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/adlibBT.TTF +0 -0
  5. app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/adlibBT.png +0 -0
  6. app/code/community/OutsourceOnline/Captcha/Model/Source/Captchaimage.php +29 -0
  7. app/code/community/OutsourceOnline/Captcha/Model/Source/Captchalanguage.php +36 -0
  8. app/code/community/OutsourceOnline/Captcha/controllers/AccountController.php +55 -0
  9. app/code/community/OutsourceOnline/Captcha/controllers/AjaxController.php +41 -0
  10. app/code/community/OutsourceOnline/Captcha/controllers/ContactsController.php +70 -0
  11. app/code/community/OutsourceOnline/Captcha/controllers/OnepageController.php +74 -0
  12. app/code/community/OutsourceOnline/Captcha/controllers/ProductController.php +64 -0
  13. app/code/community/OutsourceOnline/Captcha/controllers/ReviewController.php +62 -0
  14. app/code/community/OutsourceOnline/Captcha/etc/config.xml +180 -0
  15. app/code/community/OutsourceOnline/Captcha/etc/system.xml +176 -0
  16. app/design/frontend/default/default/layout/OutsourceOnline_Captcha.xml +95 -0
  17. app/design/frontend/default/default/template/outsourceOnline/captcha/ajaxInsert.phtml +101 -0
  18. app/design/frontend/default/default/template/outsourceOnline/captcha/captcha.phtml +67 -0
  19. app/design/frontend/default/default/template/outsourceOnline/captcha/captchaAjax.phtml +6 -0
  20. app/design/frontend/default/default/template/outsourceOnline/captcha/contacts.phtml +78 -0
  21. app/design/frontend/default/default/template/outsourceOnline/captcha/form.phtml +126 -0
  22. app/design/frontend/default/default/template/outsourceOnline/captcha/onepage_billing.phtml +213 -0
  23. app/design/frontend/default/default/template/outsourceOnline/captcha/register.phtml +153 -0
  24. app/design/frontend/default/default/template/outsourceOnline/captcha/send.phtml +142 -0
  25. app/etc/modules/OutsourceOnline_Captcha.xml +30 -0
  26. app/locale/en_US/OutsourceOnline_Captcha.csv +4 -0
  27. package.xml +4 -4
app/code/community/OutsourceOnline/Captcha/Block/Checkout/Onepage/Billing.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Checkout_Onepage_Billing extends Mage_Checkout_Block_Onepage_Billing
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+
27
+ //$this->setTemplate('outsourceOnline/captcha/onepage_billing.phtml');
28
+ //die( $this->toHtml());//$this->getTemplate()
29
+
30
+ }
31
+
32
+ }
app/code/community/OutsourceOnline/Captcha/Block/Review/Form.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Block_Review_Form extends Mage_Review_Block_Form
22
+ {
23
+ public function __construct()
24
+ {
25
+ parent::__construct();
26
+ $this->setTemplate('outsourceOnline/captcha/form.phtml');
27
+ }
28
+ }
app/code/community/OutsourceOnline/Captcha/Helper/Data.php ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+
24
+
25
+ var $bgColor = "#2C8007";
26
+ var $textColor = "#FFFFFF";
27
+
28
+ //var $params;
29
+ var $botScoutProtection = '';
30
+ var $botscoutAPIKey = '';
31
+ var $redirectURLforSuspectedIPs = '';
32
+ var $reportBotscoutNegativeMail='';
33
+ function display()
34
+ {
35
+ /*$plugin =& JPluginHelper::getPlugin('system', 'osolcaptcha');
36
+ $this->params = new JParameter($plugin->params);
37
+ $imageFunction = 'create_image'.$this->params->get('imageFunction');//JRequest::getVar('imageFunction','');
38
+ $imageFunction = ((!method_exists($this,$imageFunction)))?'create_imageAdv':$imageFunction;*/
39
+ //echo $this->params->get('imageFunction');exit;
40
+ $imageFunction = 'create_image'.Mage::getStoreConfig("OutsourceOnline_Captcha/setup/image_function");
41
+ $imageFunction = ((!method_exists($this,$imageFunction)))?'create_imageAdv':$imageFunction;
42
+ // $imageFunction = 'create_imageAdv';
43
+ $this->$imageFunction();
44
+ exit;
45
+
46
+
47
+ return true;
48
+ }
49
+
50
+ function validate()
51
+ {
52
+ $sessionSecurity_code= Mage::getSingleton('core/session')->getSecuriyCode();//die($sessionSecurity_code);
53
+ $postedSecurityCode =Mage::getSingleton('core/app')->getRequest()->getParam('osolCatchaTxt');
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");
357
+ if(trim($this->botscoutAPIKey) !='')
358
+ {
359
+ $this->botscoutCheck($XNAME);
360
+
361
+ }
362
+
363
+ }
364
+ function botscoutCheck($XNAME)
365
+ {
366
+ /////////////////////////////////////////////////////
367
+ // sample API code for use with the BotScout.com API
368
+ // code by MrMike / version 2.0 / LDM 2-2009
369
+ /////////////////////////////////////////////////////
370
+
371
+ /////////////////// START CONFIGURATION ////////////////////////
372
+ // use diagnostic output? ('1' to use, '0' to suppress)
373
+ // (normally set to '0')
374
+
375
+
376
+
377
+
378
+ $diag = '0';
379
+
380
+ /////////////////// END CONFIGURATION ////////////////////////
381
+
382
+
383
+ ////////////////////////
384
+ // test values
385
+ // an email value...a bot, perhaps?
386
+ // these would normally come from your
387
+ // web form or registration form code
388
+
389
+ //$XNAME = Mage::getSingleton('core/app')->getRequest()->getParam('email'); //contacts,signup
390
+ // $_REQUEST['sender']['email']//send a friend
391
+ //$_REQUEST['nickname'];//review
392
+
393
+ // an IP address
394
+ $XIP = $_SERVER['REMOTE_ADDR'];
395
+
396
+ // a name, maybe a bot?
397
+ $XNAME = urlencode($XNAME);
398
+
399
+ ////////////////////////
400
+ // your optional API key (don't have one? get one here: http://botscout.com/
401
+ $APIKEY=$this->botscoutAPIKey;
402
+
403
+ $USEXML = 0;
404
+
405
+ ////////////////////////
406
+
407
+ // sample query strings - you'd dynamically construct this
408
+ // string and use it as in the example below - these examples use the optional API 'key' field
409
+ // for more information on using the API key, please visit http://botscout.com
410
+
411
+ // in most cases the BEST test is to use the "MULTI" query and test for the IP and email
412
+ //$multi_test = "http://botscout.com/test/?multi&mail=$XMAIL&ip=$XIP&key=$APIKEY";
413
+
414
+ /* you can use these but they're much less efficient and (possibly) not as reliable
415
+ $test_string = "http://botscout.com/test/?mail=$XMAIL&key=$APIKEY"; // test email - reliable
416
+ $test_string = "http://botscout.com/test/?ip=$XIP&key=$APIKEY"; // test IP - reliable
417
+ $test_string = "http://botscout.com/test/?name=$XNAME&key=$APIKEY"; // test name (unreliable!)
418
+ $test_string = "http://botscout.com/test/?all=$XNAME&key=$APIKEY"; // test all (see docs)
419
+ */
420
+
421
+ // make the url compliant with urlencode()
422
+ //$XMAIL = urlencode($XMAIL);
423
+
424
+ // for this example we'll use the MULTI test
425
+ //$test_string = "http://botscout.com/test/?multi&mail=$XMAIL&ip=$XIP";
426
+ $test_string = "http://botscout.com/test/?multi&all=$XNAME&ip=$XIP";
427
+
428
+ // are using an API key? If so, append it.
429
+ if($APIKEY != ''){
430
+ $test_string = "$test_string&key=$APIKEY";
431
+ }
432
+
433
+ // are using XML responses? If so, append the XML format key.
434
+ if($USEXML == '1'){
435
+ $test_string = "$test_string&format=xml";
436
+ }
437
+
438
+ ////////////////////////
439
+ if($diag=='1'){print "Test String: $test_string";}
440
+ ////////////////////////
441
+
442
+
443
+ ////////////////////////
444
+ // use file_get_contents() or cURL?
445
+ // we'll user file_get_contents() unless it's not available
446
+
447
+ if(function_exists('file_get_contents')&& (ini_get('allow_url_fopen')=='On')){
448
+ // Use file_get_contents
449
+ $data = file_get_contents($test_string);
450
+ }else{
451
+ $ch = curl_init($test_string);
452
+ curl_setopt($ch, CURLOPT_HEADER, 0);
453
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
454
+ $returned_data = curl_exec($ch);
455
+ curl_close($ch);
456
+ }
457
+
458
+ // diagnostic output
459
+ if($diag=='1'){
460
+ print "RETURNED DATA: $returned_data";
461
+ // sanity check
462
+ if($returned_data==''){ print 'Error: No return data from API query.'; exit; }
463
+ }
464
+ //die($test_string."<br />".$returned_data);
465
+
466
+ // take the returned value and parse it (standard API, not XML)
467
+ $botdata = explode('|', $returned_data);
468
+
469
+ // sample 'MULTI' return string
470
+ // Y|MULTI|IP|4|MAIL|26|NAME|30
471
+
472
+ // $botdata[0] - 'Y' if found in database, 'N' if not found, '!' if an error occurred
473
+ // $botdata[1] - type of test (will be 'MAIL', 'IP', 'NAME', or 'MULTI')
474
+ // $botdata[2] - descriptor field for item (IP)
475
+ // $botdata[3] - how many times the IP was found in the database
476
+ // $botdata[4] - descriptor field for item (MAIL)
477
+ // $botdata[5] - how many times the EMAIL was found in the database
478
+ // $botdata[6] - descriptor field for item (NAME)
479
+ // $botdata[7] - how many times the NAME was found in the database
480
+ //$mainframe->redirect($this->redirectURLforSuspectedIPs);
481
+ if($botdata[0] == 'Y'){
482
+
483
+ //$this->botScoutProtection = $this->params->get('botScoutProtection',$this->botScoutProtection);//Disable,Redirect,Stop
484
+ //$this->redirectURLforSuspectedIPs = $this->params->get('redirectURLforSuspectedIPs',$this->redirectURLforSuspectedIPs);
485
+ if($this->reportBotscoutNegativeMail !='')
486
+ {
487
+ $this->mailBotScoutResult();
488
+ }
489
+
490
+ echo "Sorry your IP : $XIP and sender name/email : $XNAME was reported spam by http://www.botscout.com/.<br />So we cannot process your submission";
491
+ exit;
492
+
493
+ }
494
+
495
+ if(($diag=='1') && substr($returned_data, 0,1) == '!'){
496
+ // if the first character is an exclamation mark, an error has occurred
497
+ print "Error: $returned_data";
498
+ exit;
499
+ }
500
+
501
+
502
+ // this example tests the email address and IP to see if either of them appear
503
+ // in the database at all. Either one is a fairly good indicator of bot identity.
504
+ if($botdata[3] > 0 || $botdata[5] > 0){
505
+ if($diag=='1')print $data;
506
+
507
+ if($diag=='1'){
508
+ print "Bot signature found.";
509
+ print "Type of test was: $botdata[1]";
510
+ print "The {$botdata[2]} was found {$botdata[3]} times, the {$botdata[4]} was found {$botdata[5]} times";
511
+ }
512
+
513
+ // your 'rejection' code would go here....
514
+ // for example, print a fake error message and exit the process.
515
+ $errnum = round(rand(1100, 25000));
516
+ if($diag=='1')print "Confabulation Error #$errnum, Halting.";
517
+ exit;
518
+
519
+ }
520
+ ////////////////////////
521
+ }
522
+ function mailBotScoutResult($isSecondLevel = false)
523
+ {
524
+ $mailBody = "Following request from IP:{$_SERVER['REMOTE_ADDR']} returned a -ve result on $verificationType verification in ".Mage::helper('core/url')->getCurrentUrl()."\r\n Get vars =".var_export($_GET,true)."\r\n POST vars =".var_export($_POST,true)."\r\n REQUEST vars =".var_export($_REQUEST,true);
525
+ $mail = new Zend_Mail();
526
+ $mail->setBodyText($mailBody);
527
+
528
+ $mail->setFrom( Mage::getStoreConfig('contacts/email/recipient_email'), Mage::getStoreConfig('design/head/default_title'));
529
+ $mail->addTo($this->reportBotscoutNegativeMail, 'Some Recipient');
530
+ $mail->setSubject(Mage::getStoreConfig('design/head/default_title').'" : Suspected spam attack from '.$_SERVER['REMOTE_ADDR'] .' botscout.com api -ve result');
531
+ try {
532
+ $mail->send();
533
+ }
534
+ catch(Exception $ex) {
535
+ // Mage::getSingleton('core/session')->addError('Unable to send email. ');
536
+ echo 'Unable to send email.Please try again after some time'; return;
537
+ }
538
+ }
539
+
540
+
541
+ }
542
+ ?>
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/adlibBT.TTF ADDED
Binary file
app/code/community/OutsourceOnline/Captcha/Helper/osolCaptcha/adlibBT.png ADDED
Binary file
app/code/community/OutsourceOnline/Captcha/Model/Source/Captchaimage.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Captchaimage
22
+ {
23
+ public function toOptionArray()
24
+ {
25
+ return array(array('value' => 'Adv', 'label' => 'Distorted Image'),
26
+ array('value' => 'Plane', 'label' => 'Plain Image')
27
+ );
28
+ }
29
+ }
app/code/community/OutsourceOnline/Captcha/Model/Source/Captchalanguage.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class OutsourceOnline_Captcha_Model_Source_Captchalanguage
23
+ {
24
+ public function toOptionArray()
25
+ {
26
+ return array(array('value' => 'en', 'label' => 'English'),
27
+ array('value' => 'fr', 'label' => 'French'),
28
+ array('value' => 'de', 'label' => 'German'),
29
+ array('value' => 'nl', 'label' => 'Dutch'),
30
+ array('value' => 'pt', 'label' => 'Portuguese'),
31
+ array('value' => 'ru', 'label' => 'Russian'),
32
+ array('value' => 'es', 'label' => 'Spanish'),
33
+ array('value' => 'dk', 'label' => 'Danish'),
34
+ );
35
+ }
36
+ }
app/code/community/OutsourceOnline/Captcha/controllers/AccountController.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ include_once "Mage/Customer/controllers/AccountController.php";
22
+
23
+ class OutsourceOnline_Captcha_AccountController extends Mage_Customer_AccountController
24
+ {
25
+ public function createPostAction()
26
+ {
27
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/customer"))
28
+ { // check that captcha is actually enabled
29
+
30
+ $privatekey = Mage::getStoreConfig("OutsourceOnline_Captcha/setup/private_key");
31
+ // check response
32
+ $resp = Mage::helper("outsourceonline_captcha")->validate();
33
+
34
+
35
+ //validate botscout
36
+ Mage::helper("outsourceonline_captcha")->validateBotScout(Mage::getSingleton('core/app')->getRequest()->getParam('email'));
37
+ if ($resp == true)
38
+ { // if captcha response is correct, use core functionality
39
+ parent::createPostAction();
40
+ }
41
+ else
42
+ {
43
+ $this->_getSession()->addError($this->__('Your CAPTCHA entry is incorrect. Please try again.'));
44
+ $this->_getSession()->setCustomerFormData($this->getRequest()->getPost());
45
+ $this->_redirectReferer();
46
+ return;
47
+ }
48
+ }
49
+ else
50
+ { // if captcha is not enabled, use core function
51
+ parent::createPostAction();
52
+ }
53
+ }
54
+ }
55
+ ?>
app/code/community/OutsourceOnline/Captcha/controllers/AjaxController.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class OutsourceOnline_Captcha_AjaxController extends Mage_Core_Controller_Front_Action
23
+ {
24
+ public function indexAction(){
25
+ /*
26
+ echo "Controller:".Mage::getSingleton('core/app')->getRequest()->getParam('form_key');
27
+ echo "Controller:".$this->getRequest()->getParam('form_key');
28
+ echo "< pre >";print_r($this->getRequest()); echo "< /pre >";*/
29
+ $this->loadLayout()->renderLayout();
30
+ }
31
+ public function freshcaptchaAction()
32
+ {
33
+ Mage::helper("outsourceonline_captcha")->display();
34
+ }
35
+ public function validateCaptchaAction()
36
+ {
37
+
38
+
39
+ echo Mage::helper("outsourceonline_captcha")->validate()?'correct':'wrong';
40
+ }
41
+ }
app/code/community/OutsourceOnline/Captcha/controllers/ContactsController.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ */include_once "Mage/Contacts/controllers/IndexController.php";
21
+
22
+ class OutsourceOnline_Captcha_ContactsController extends Mage_Contacts_IndexController
23
+ {
24
+
25
+
26
+ public function postAction()
27
+ {
28
+
29
+
30
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
31
+ {
32
+
33
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/contacts"))
34
+ {
35
+
36
+ //echo "<pre>";print_r($_POST);echo "</pre>";
37
+ // check response
38
+ $resp = Mage::helper("outsourceonline_captcha")->validate();
39
+ //validate botscout
40
+ Mage::helper("outsourceonline_captcha")->validateBotScout(Mage::getSingleton('core/app')->getRequest()->getParam('email'));
41
+ if ($resp == true)
42
+ { // if captcha response is correct, use core functionality
43
+ parent::postAction();
44
+ }
45
+ else
46
+ { // if captcha response is incorrect, reload the page
47
+
48
+ Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Your CAPTCHA entry is incorrect. Please try again.'));
49
+
50
+ $_SESSION['contact_comment'] = $_POST['comment'];
51
+ $_SESSION['contact_name'] = $_POST['name'];
52
+ $_SESSION['contact_email'] = $_POST['email'];
53
+ $_SESSION['contact_telephone'] = $_POST['telephone'];
54
+
55
+ $this->_redirect('contacts/');
56
+ return;
57
+ }
58
+ }
59
+ else
60
+ { // if captcha is not enabled, use core function alone
61
+ parent::postAction();
62
+ }
63
+ }
64
+ else
65
+ { // if captcha is not enabled, use core function alone
66
+ parent::postAction();
67
+ }
68
+ }
69
+ }
70
+ ?>
app/code/community/OutsourceOnline/Captcha/controllers/OnepageController.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ include_once "Mage/Checkout/controllers/OnepageController.php";
22
+
23
+ class OutsourceOnline_Captcha_OnepageController extends Mage_Checkout_OnepageController
24
+ {
25
+ /**
26
+ * save checkout billing address
27
+ */
28
+ public function saveBillingAction()
29
+ {
30
+ //die(Mage::getSingleton('core/session')->getSecuriyCode());
31
+ if ($this->_expireAjax()) {
32
+ return;
33
+ }
34
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
35
+ {
36
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/customer"))
37
+ {
38
+
39
+ // check response
40
+ $resp = Mage::helper("outsourceonline_captcha")->validate();
41
+
42
+ $data = $this->getRequest()->getPost();
43
+
44
+ //validate botscout
45
+ Mage::helper("outsourceonline_captcha")->validateBotScout(Mage::getSingleton('core/app')->getRequest()->getParam('nickname'));
46
+
47
+
48
+ if ($resp == true)
49
+ { // if captcha response is correct, use core functionality
50
+ parent::saveBillingAction();
51
+ }
52
+ else
53
+ { // if captcha response is incorrect, reload the page
54
+ Mage::getSingleton('core/session')->addError($this->__('Your CAPTCHA entry is incorrect. Please try again.'));
55
+ Mage::getSingleton('review/session')->setFormData($data);
56
+ $this->_redirectReferer();
57
+ return;
58
+ }
59
+ }
60
+ /*else
61
+ { // if captcha is not enabled, use core function alone
62
+ parent::postAction();
63
+ }*/
64
+ }
65
+ else
66
+ { // if captcha is not enabled, use core function alone
67
+ parent::saveBillingAction();
68
+ }
69
+ }
70
+
71
+ }
72
+ ?>
73
+
74
+
app/code/community/OutsourceOnline/Captcha/controllers/ProductController.php ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ include_once "Mage/Sendfriend/controllers/ProductController.php";
22
+
23
+ class OutsourceOnline_Captcha_ProductController extends Mage_Sendfriend_ProductController
24
+ {
25
+ public function sendmailAction()
26
+ {
27
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
28
+ {
29
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/sendfriend"))
30
+ {
31
+
32
+ // check response
33
+ $resp = Mage::helper("outsourceonline_captcha")->validate();
34
+
35
+ $data = $this->getRequest()->getPost();
36
+ //validate botscout
37
+ $sender = Mage::helper("outsourceonline_captcha")->validateBotScout(Mage::getSingleton('core/app')->getRequest()->getParam('sender'));
38
+ $XNAME = $sender['email'];
39
+ Mage::helper("outsourceonline_captcha")->validateBotScout($XNAME);
40
+
41
+ if ($resp == true)
42
+ { // if captcha response is correct, use core functionality
43
+ parent::sendmailAction();
44
+ }
45
+ else
46
+ { // if captcha response is incorrect, reload the page
47
+ Mage::getSingleton('catalog/session')->addError($this->__('Your CAPTCHA entry is incorrect. Please try again.'));
48
+ Mage::getSingleton('catalog/session')->setFormData($data);
49
+ $this->_redirectReferer();
50
+ return;
51
+ }
52
+ }
53
+ else
54
+ { // if captcha is not enabled, use core function alone
55
+ parent::sendmailAction();
56
+ }
57
+ }
58
+ else
59
+ { // if captcha is not enabled, use core function alone
60
+ parent::sendmailAction();
61
+ }
62
+ }
63
+ }
64
+ ?>
app/code/community/OutsourceOnline/Captcha/controllers/ReviewController.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ */include_once "Mage/Review/controllers/ProductController.php";
21
+
22
+ class OutsourceOnline_Captcha_ReviewController extends Mage_Review_ProductController
23
+ {
24
+ public function postAction()
25
+ {
26
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
27
+ {
28
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/review"))
29
+ {
30
+
31
+ // check response
32
+ $resp = Mage::helper("outsourceonline_captcha")->validate();
33
+
34
+ $data = $this->getRequest()->getPost();
35
+
36
+ //validate botscout
37
+ Mage::helper("outsourceonline_captcha")->validateBotScout(Mage::getSingleton('core/app')->getRequest()->getParam('nickname'));
38
+
39
+
40
+ if ($resp == true)
41
+ { // if captcha response is correct, use core functionality
42
+ parent::postAction();
43
+ }
44
+ else
45
+ { // if captcha response is incorrect, reload the page
46
+ Mage::getSingleton('core/session')->addError($this->__('Your CAPTCHA entry is incorrect. Please try again.'));
47
+ Mage::getSingleton('review/session')->setFormData($data);
48
+ $this->_redirectReferer();
49
+ return;
50
+ }
51
+ }
52
+ else
53
+ { // if captcha is not enabled, use core function alone
54
+ parent::postAction();
55
+ }
56
+ }
57
+ else
58
+ { // if captcha is not enabled, use core function alone
59
+ parent::postAction();
60
+ }
61
+ }
62
+ }
app/code/community/OutsourceOnline/Captcha/etc/config.xml ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Outsource Online Captcha Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Outsource Online
17
+ * @package OutsourceOnline_Captcha
18
+ * @author Sreekanth Dayanand
19
+ * @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <OutsourceOnline_Captcha>
26
+ <version>2.0.0</version>
27
+ </OutsourceOnline_Captcha>
28
+ </modules>
29
+
30
+
31
+
32
+ <global>
33
+ <routers>
34
+ <contacts>
35
+ <rewrite>
36
+ <index>
37
+ <to>captcha/contacts</to>
38
+ </index>
39
+ </rewrite>
40
+ </contacts>
41
+
42
+
43
+ </routers>
44
+ <!--<rewrite>
45
+ <OutsourceOnline_Captcha>
46
+ <from><![CDATA[#^/checkout/onepage/saveBilling/#]]></from>
47
+ <to>/captcha/onepage/saveBilling/</to>
48
+ </OutsourceOnline_Captcha>
49
+ </rewrite>-->
50
+ <rewrite>
51
+ <OutsourceOnline_Captcha>
52
+ <from><![CDATA[#^/customer/account/createpost/#]]></from>
53
+ <to>/captcha/account/createpost/</to>
54
+ </OutsourceOnline_Captcha>
55
+ </rewrite>
56
+ <rewrite>
57
+ <OutsourceOnline_Captcha2>
58
+ <from><![CDATA[#^/sendfriend/product/sendmail/#]]></from>
59
+ <to>/captcha/product/sendmail/</to>
60
+ </OutsourceOnline_Captcha2>
61
+ </rewrite>
62
+ <rewrite>
63
+ <OutsourceOnline_Captcha3>
64
+ <from><![CDATA[#^/review/product/post/#]]></from>
65
+ <to>/captcha/review/post/</to>
66
+ </OutsourceOnline_Captcha3>
67
+ </rewrite>
68
+ <models>
69
+ <OutsourceOnline_Captcha>
70
+ <class>OutsourceOnline_Captcha_Model</class>
71
+ </OutsourceOnline_Captcha>
72
+ </models>
73
+ <blocks>
74
+ <review>
75
+ <rewrite>
76
+ <form>OutsourceOnline_Captcha_Block_Review_Form</form>
77
+ </rewrite>
78
+ </review>
79
+ </blocks>
80
+
81
+ <blocks>
82
+ <checkout>
83
+ <rewrite>
84
+ <onepage_billing>OutsourceOnline_Captcha_Block_Checkout_Onepage_Billing</onepage_billing>
85
+ </rewrite>
86
+ </checkout>
87
+ </blocks>
88
+ <controllers>
89
+ <checkout>
90
+ <rewrite>
91
+ <onepage>OutsourceOnline_Captcha_OnepageController</onepage>
92
+ </rewrite>
93
+ </checkout>
94
+ </controllers>
95
+ <helpers>
96
+ <outsourceonline_captcha>
97
+ <class>OutsourceOnline_Captcha_Helper</class>
98
+ </outsourceonline_captcha>
99
+ </helpers>
100
+ </global>
101
+ <frontend>
102
+ <routers>
103
+ <OutsourceOnline_Captcha>
104
+ <use>standard</use>
105
+ <args>
106
+ <module>OutsourceOnline_Captcha</module>
107
+ <frontName>captcha</frontName>
108
+ </args>
109
+ </OutsourceOnline_Captcha>
110
+ <!-- new additional tag for one page checkout -->
111
+ <checkout>
112
+ <args>
113
+ <modules>
114
+ <OutsourceOnline_Captcha before="Mage_Checkout">OutsourceOnline_Captcha</OutsourceOnline_Captcha>
115
+ </modules>
116
+ </args>
117
+ </checkout>
118
+ <!-- new additional tag for one page checkout ends here -->
119
+ </routers>
120
+ <translate>
121
+ <modules>
122
+ <OutsourceOnline_Captcha>
123
+ <files>
124
+ <default>OutsourceOnline_Captcha.csv</default>
125
+ </files>
126
+ </OutsourceOnline_Captcha>
127
+ </modules>
128
+ </translate>
129
+ <layout>
130
+ <updates>
131
+ <OutsourceOnline_Captcha module="OutsourceOnline_Captcha">
132
+ <file>OutsourceOnline_Captcha.xml</file>
133
+ </OutsourceOnline_Captcha>
134
+ </updates>
135
+ </layout>
136
+ </frontend>
137
+ <default>
138
+ <OutsourceOnline_Captcha>
139
+ <setup>
140
+ <background_color>#2C8007</background_color>
141
+ <text_color>#FFFFFF</text_color>
142
+ <image_function>distorted</image_function>
143
+ <language>en</language>
144
+
145
+ </setup>
146
+ <captcha>
147
+ <when_loggedin>1</when_loggedin>
148
+ <sendfriend>1</sendfriend>
149
+ <contacts>1</contacts>
150
+ <customer>1</customer>
151
+ <review>1</review>
152
+ </captcha>
153
+
154
+ </OutsourceOnline_Captcha>
155
+ </default>
156
+ <adminhtml>
157
+ <acl>
158
+ <resources>
159
+ <all>
160
+ <title>Allow Everything</title>
161
+ </all>
162
+ <admin>
163
+ <children>
164
+ <system>
165
+ <children>
166
+ <config>
167
+ <children>
168
+ <OutsourceOnline_Captcha>
169
+ <title>Captcha</title>
170
+ </OutsourceOnline_Captcha>
171
+ </children>
172
+ </config>
173
+ </children>
174
+ </system>
175
+ </children>
176
+ </admin>
177
+ </resources>
178
+ </acl>
179
+ </adminhtml>
180
+ </config>
app/code/community/OutsourceOnline/Captcha/etc/system.xml ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Outsource Online Captcha Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category OutsourceOnline
17
+ * @package OutsourceOnline_Captcha
18
+ * @author Sreekanth Dayanand
19
+ * @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <tabs>
25
+ <outsourceOnline_extensions translate="label" module="outsourceonline_captcha">
26
+ <label>Outsource Online Extensions</label>
27
+ <sort_order>1000000</sort_order>
28
+ </outsourceOnline_extensions>
29
+ </tabs>
30
+ <sections>
31
+ <OutsourceOnline_Captcha>
32
+ <label>Captcha</label>
33
+ <tab>outsourceOnline_extensions</tab>
34
+ <frontend_type>text</frontend_type>
35
+ <sort_order>999999</sort_order>
36
+ <show_in_default>1</show_in_default>
37
+ <show_in_website>1</show_in_website>
38
+ <show_in_store>1</show_in_store>
39
+ <groups>
40
+ <setup translate="label">
41
+ <label>Captcha Setup</label>
42
+ <frontend_type>text</frontend_type>
43
+ <sort_order>2</sort_order>
44
+ <show_in_default>1</show_in_default>
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>10</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
+ <text_color translate="label">
58
+ <label>Text color</label>
59
+ <frontend_type>text</frontend_type>
60
+ <value>#FFFFFF</value>
61
+ <sort_order>11</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
+ <image_function translate="label">
67
+ <label>Image function</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>OutsourceOnline_Captcha/source_Captchaimage</source_model>
70
+ <sort_order>1</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
+ </image_function>
75
+ <language translate="label">
76
+ <label>Language</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>OutsourceOnline_Captcha/source_captchalanguage</source_model>
79
+ <sort_order>2</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
+ </language>
84
+
85
+ </fields>
86
+ </setup>
87
+ <captcha translate="label">
88
+ <label>Captcha Controls</label>
89
+ <frontend_type>text</frontend_type>
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
+ <fields>
95
+ <when_loggedin translate="label">
96
+ <label>Hide for Logged-in Customers</label>
97
+ <frontend_type>select</frontend_type>
98
+ <source_model>adminhtml/system_config_source_yesno</source_model>
99
+ <sort_order>1</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
+ </when_loggedin>
104
+ <sendfriend translate="label">
105
+ <label>Email to a Friend Form</label>
106
+ <frontend_type>select</frontend_type>
107
+ <source_model>adminhtml/system_config_source_yesno</source_model>
108
+ <sort_order>2</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
+ </sendfriend>
113
+ <contacts translate="label">
114
+ <label>Contact Us Form</label>
115
+ <frontend_type>select</frontend_type>
116
+ <source_model>adminhtml/system_config_source_yesno</source_model>
117
+ <sort_order>2</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
+ </contacts>
122
+ <customer translate="label">
123
+ <label>Account Creation Form</label>
124
+ <frontend_type>select</frontend_type>
125
+ <source_model>adminhtml/system_config_source_yesno</source_model>
126
+ <sort_order>2</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
+ </customer>
131
+ <review translate="label">
132
+ <label>Product Review Form</label>
133
+ <frontend_type>select</frontend_type>
134
+ <source_model>adminhtml/system_config_source_yesno</source_model>
135
+ <sort_order>2</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ </review>
140
+ </fields>
141
+ </captcha>
142
+ <botscout translate="label">
143
+ <label>Botscout.com options</label>
144
+ <frontend_type>text</frontend_type>
145
+ <sort_order>6</sort_order>
146
+ <show_in_default>1</show_in_default>
147
+ <show_in_website>1</show_in_website>
148
+ <show_in_store>1</show_in_store>
149
+ <fields>
150
+ <botscout_api_key translate="label">
151
+ <label>Botscout API key</label>
152
+ <frontend_type>text</frontend_type>
153
+ <value></value>
154
+ <sort_order>10</sort_order>
155
+ <show_in_default>1</show_in_default>
156
+ <show_in_website>1</show_in_website>
157
+ <show_in_store>1</show_in_store>
158
+ </botscout_api_key>
159
+ <botscout_report_email translate="label">
160
+ <label>Report -ve results from botsout ip verification</label>
161
+ <frontend_type>text</frontend_type>
162
+ <value></value>
163
+ <sort_order>11</sort_order>
164
+ <show_in_default>1</show_in_default>
165
+ <show_in_website>1</show_in_website>
166
+ <show_in_store>1</show_in_store>
167
+ </botscout_report_email>
168
+
169
+
170
+ </fields>
171
+ </botscout>
172
+
173
+ </groups>
174
+ </OutsourceOnline_Captcha>
175
+ </sections>
176
+ </config>
app/design/frontend/default/default/layout/OutsourceOnline_Captcha.xml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Outsource Online Captcha Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Outsource Online
17
+ * @package OutsourceOnline_Captcha
18
+ * @author Sreekanth Dayanand
19
+ * @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <layout version="0.1.0">
24
+ <sendfriend_product_send>
25
+ <remove name="sendfriend.send"/>
26
+
27
+ <reference name="content">
28
+ <block type="sendfriend/send" name="captcha_sendfriend_send" template="outsourceOnline/captcha/send.phtml">
29
+ <block type="core/template" name="captcha_ajax_part" as="captcha_ajax_part" template="outsourceOnline/captcha/ajaxInsert.phtml" />
30
+ </block>
31
+ </reference>
32
+ </sendfriend_product_send>
33
+
34
+ <outsourceonline_captcha_contacts_index>
35
+ <reference name="root">
36
+ <!--<action method="setTemplate">
37
+ <template>page/2columns-right.phtml</template>
38
+ </action>
39
+ -->
40
+ <action method="setHeaderTitle" translate="title" module="contacts">
41
+ <title>Contact Us</title>
42
+ </action>
43
+
44
+ </reference>
45
+
46
+ <reference name="content">
47
+
48
+ <block type="core/template" name="contactForm" template="outsourceOnline/captcha/contacts.phtml">
49
+ <block type="core/template" name="captcha_ajax_part" as="captcha_ajax_part" template="outsourceOnline/captcha/ajaxInsert.phtml" />
50
+ </block>
51
+ </reference>
52
+ </outsourceonline_captcha_contacts_index>
53
+
54
+ <!-- -->
55
+ <checkout_onepage_index>
56
+
57
+ <!-- <remove name="checkout.onepage.billing"/>-->
58
+
59
+ <!--<block type="checkout/onepage_billing" name="captcha.onepage.billing" as="billing" template="outsourceOnline/captcha/onepage_billing.phtml">-->
60
+ <reference name="checkout.onepage.billing">
61
+ <block type="core/template" name="captcha_ajax_part" as="captcha_ajax_part" template="outsourceOnline/captcha/ajaxInsert.phtml" />
62
+ </reference>
63
+
64
+ </checkout_onepage_index>
65
+ <!-- -->
66
+
67
+ <customer_account_create>
68
+ <remove name="customer_form_register"/>
69
+
70
+ <reference name="content">
71
+ <block type="customer/form_register" name="captcha_form_register" template="outsourceOnline/captcha/register.phtml">
72
+ <block type="core/template" name="captcha_ajax_part" as="captcha_ajax_part" template="outsourceOnline/captcha/ajaxInsert.phtml" />
73
+ </block>
74
+ </reference>
75
+ </customer_account_create>
76
+
77
+ <review_product_list>
78
+ <reference name="product.review.form" >
79
+ <block type="core/template" name="captcha_ajax_part" as="captcha_ajax_part" template="outsourceOnline/captcha/ajaxInsert.phtml" />
80
+ </reference>
81
+ </review_product_list>
82
+
83
+ <outsourceonline_captcha_ajax_index>
84
+ <reference name="root">
85
+ <action method="setTemplate"><template>outsourceOnline/captcha/captchaAjax.phtml</template></action>
86
+ <!--<block type="module/block" name="root" output="toHtml" template="outsourceOnline/captcha/captchaAjax.phtml" />-->
87
+ </reference>
88
+ </outsourceonline_captcha_ajax_index>
89
+ <checkout_onepage_index>
90
+ <reference name="checkout.onepage.billing">
91
+ <action method="setTemplate"><template>outsourceOnline/captcha/onepage_billing.phtml</template></action>
92
+ <!--<block type="module/block" name="root" output="toHtml" template="outsourceOnline/captcha/captchaAjax.phtml" />-->
93
+ </reference>
94
+ </checkout_onepage_index>
95
+ </layout>
app/design/frontend/default/default/template/outsourceOnline/captcha/ajaxInsert.phtml ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ $osolCaptchaLoadFromSSL = $_SERVER['SERVER_PORT']==443?true:false;
22
+ ?>
23
+ <script src="<?php echo $this->getJsUrl() ?>mage/adminhtml/loader.js" type="text/javascript"></script>
24
+ <div id="loadingmask" style="display: none;">
25
+ <div class="loader" id="loading-mask-loader"><img src="<?php echo str_replace("index.php/","",$this->getUrl('', array('_secure'=>$osolCaptchaLoadFromSSL))) ?>skin/adminhtml/default/default/images/ajax-loader-tr.gif" alt="<?php echo $this->__('Loading...') ?>"/><?php echo $this->__('Loading...') ?></div>
26
+ <div id="loading-mask"></div>
27
+ </div>
28
+ <script language="javascript" type="text/javascript">
29
+
30
+ /*Please note that the URL is created in reloadurl. Also see that the response text will be echoed in div with id=output-div*/
31
+ function checkOSOLCaptcha(varienForm)
32
+ {
33
+ //alert('checkOSOLCaptcha');
34
+ formInst = varienForm.form
35
+ if(!(varienForm.validator && varienForm.validator.validate()))return;
36
+
37
+ var reloadurl = '<?php echo $this->getUrl('captcha/ajax/validateCaptcha/firstParam/sreekanth', array('_secure'=>$osolCaptchaLoadFromSSL)) ?>';
38
+ Element.show('loadingmask');
39
+ new Ajax.Request(reloadurl, {
40
+ method: 'post',
41
+ parameters: 'osolCatchaTxt='+formInst.osolCatchaTxt.value+'&form_key=<?php echo Mage::getSingleton('core/session')->getFormKey();?>',//form_key is a mandatory field,without which the ajax post wont work
42
+ onComplete: function(transport) {
43
+ Element.hide('loadingmask');
44
+
45
+ //alert(transport.responseText);alert(document.getElementById("co-billing-form"));
46
+ if( transport.responseText == 'correct')
47
+ {
48
+ //alert(typeof billing);
49
+ if(typeof billing !='object')//!document.getElementById("co-billing-form"))//(!billing)
50
+ {
51
+
52
+ formInst.submit();
53
+
54
+ }
55
+ else
56
+ {
57
+ billing.save()
58
+ }
59
+ }
60
+ else
61
+ {
62
+ alert('<?php echo Mage::helper("outsourceonline_captcha")->__('Your CAPTCHA entry is incorrect. Please try again.') ?>');
63
+ }
64
+ //formInst.submit();
65
+ }
66
+ });
67
+ return false;
68
+ }
69
+ </script>
70
+ <?php /*<a href="#" onclick="checkOSOLCaptcha(contactForm);return false;">123</a>
71
+ <!--<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey();?>" />-->*/ ?>
72
+ <div class="osolCaptchaBlock">
73
+ <label for="osolCatchaTxt1"><span class="required"><?php echo Mage::helper("outsourceonline_captcha")->__('Enter security code') ?></span></label> <br />
74
+
75
+
76
+
77
+
78
+ <a href="http://www.outsource-online.net/custom-magento-ajax-captcha-module-from-outsource-online.html" target="blank" style="font-size:10px" >
79
+ <img id="captchaCode1" src="<?php echo $this->getUrl('captcha/ajax/freshcaptcha?instanceNo=1', array('_secure'=>$osolCaptchaLoadFromSSL));?>&time=<?php echo time();?>" alt="Custom magento captcha module from Outsource Online" />
80
+ </a><br/>
81
+ <script language="javascript" type="text/javascript">
82
+ if(!FORM_KEY)
83
+ {
84
+ var FORM_KEY='test';
85
+ }
86
+ function reloadCapthcha(instanceNo)
87
+ {
88
+ var captchaSrc = "<?php echo $this->getUrl('captcha/ajax/freshcaptcha?instanceNo=1', array('_secure'=>$osolCaptchaLoadFromSSL));?>"+"&amp;time="+ new Date().getTime();
89
+ //alert(captachaSrc);
90
+ //alert(document.getElementById('captchaCode'+instanceNo));
91
+ document.getElementById('captchaCode'+instanceNo).src = captchaSrc ;
92
+ //alert(document.getElementById('captchaCode'+instanceNo).src);
93
+ }
94
+ </script>
95
+ <label>
96
+ <a href="#" onclick="reloadCapthcha(1);return false;" ><?php echo Mage::helper("outsourceonline_captcha")->__('Refresh captcha') ?></a>
97
+ </label><br />
98
+ <input type="text" name="osolCatchaTxt" id="osolCatchaTxt1" class="required-entry input-text" />&nbsp;
99
+ <input type="hidden" name="osolCatchaTxtInst" id="osolCatchaTxtInst" value="1" /><br/>
100
+ </div>
101
+
app/design/frontend/default/default/template/outsourceOnline/captcha/captcha.phtml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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; ?>
app/design/frontend/default/default/template/outsourceOnline/captcha/captchaAjax.phtml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ echo $this->getChildHtml('content');
3
+
4
+ //echo "Controller:".Mage::getSingleton('core/app')->getRequest()->getParam('form_key');
5
+ //echo "Controller:".$this->getRequest()->getParam('form_key');
6
+ //echo "< pre >";print_r($this->getRequest()->getParams()); echo "< /pre >";
app/design/frontend/default/default/template/outsourceOnline/captcha/contacts.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
23
+ <div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
24
+ <div class="page-head">
25
+ <h3><?php echo Mage::helper('contacts')->__('Contact Us') ?></h3>
26
+ </div>
27
+ <form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post" onSubmit="return checkOSOLCaptcha(contactForm);">
28
+ <fieldset class="group-select">
29
+ <h4 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h4>
30
+ <ul>
31
+ <li>
32
+ <div class="input-box">
33
+ <label for="name"><?php echo Mage::helper('contacts')->__('Name') ?> <span class="required">*</span></label><br />
34
+ <input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php if($this->helper('contacts')->getUserName() == "") { if(isset($_SESSION["contact_name"])){ echo ($_SESSION["contact_name"]); unset($_SESSION["contact_name"]);}}else{ echo $this->htmlEscape($this->helper('contacts')->getUserName()); } ?>" class="required-entry input-text" type="text" />
35
+ </div>
36
+
37
+ <div class="input-box">
38
+ <label for="email"><?php echo Mage::helper('contacts')->__('Email') ?> <span class="required">*</span></label><br />
39
+ <input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php if($this->helper('contacts')->getUserEmail() == "") { if(isset($_SESSION["contact_email"])){ echo ($_SESSION["contact_email"]); unset($_SESSION["contact_email"]);}}else{ echo $this->htmlEscape($this->helper('contacts')->getUserEmail()); } ?>" class="required-entry input-text validate-email" type="text" />
40
+ </div>
41
+
42
+ <div class="clear"></div>
43
+
44
+ <div class="input-box">
45
+ <label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label><br />
46
+ <input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="<?php if(isset($_SESSION["contact_telephone"])){ echo ($_SESSION["contact_telephone"]); unset($_SESSION["contact_telephone"]);} ?>" class="input-text" type="text" />
47
+ </div>
48
+
49
+ <div class="clear"></div>
50
+
51
+ <div class="input-box">
52
+ <label for="comment"><?php echo Mage::helper('contacts')->__('Comment') ?></label><br />
53
+ <textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" style="height:150px;width:auto;" cols="50" rows="5"><?php if(isset($_SESSION["contact_comment"])){ echo ($_SESSION["contact_comment"]); unset($_SESSION["contact_comment"]);} ?></textarea>
54
+ </div>
55
+ </li>
56
+ </ul>
57
+ </fieldset>
58
+
59
+ <?php // Captcha
60
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
61
+ {
62
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/contacts"))
63
+
64
+ echo $this->getChildHtml('captcha_ajax_part');
65
+ }
66
+ ?>
67
+
68
+ <div class="button-set">
69
+ <p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
70
+ <button class="form-button" type="submit"><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></button>
71
+ </div>
72
+ </form>
73
+ <script type="text/javascript">
74
+
75
+ var contactForm = new VarienForm('contactForm', true);
76
+
77
+
78
+ </script>
app/design/frontend/default/default/template/outsourceOnline/captcha/form.phtml ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ <div class="page-head">
23
+ <h3><?php echo $this->__('Write Your Own Review') ?></h3>
24
+ </div>
25
+ <h4><?php echo $this->__("You're reviewing: %s", $this->htmlEscape($this->getProductInfo()->getName())) ?></h4>
26
+ <form action="<?php echo $this->getAction() ?>" method="post" id="review-form" onSubmit="return checkOSOLCaptcha(dataForm);">
27
+ <fieldset>
28
+ <?php if( $this->getRatings() && $this->getRatings()->getSize()): ?>
29
+ <div class="product-review-box">
30
+ <strong><?php echo $this->__('How do you rate this product?') ?><span class="required">*</span></strong><br />
31
+ <span id="input-message-box"></span>
32
+ <table class="data-table" id="product-review-table" cellspacing="0">
33
+ <thead>
34
+ <tr>
35
+ <th>&nbsp;</th>
36
+ <th><?php echo $this->__('1 star') ?></th>
37
+ <th><?php echo $this->__('2 stars') ?></th>
38
+ <th><?php echo $this->__('3 stars') ?></th>
39
+ <th><?php echo $this->__('4 stars') ?></th>
40
+ <th><?php echo $this->__('5 stars') ?></th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <?php $_oddIterator = 1; ?>
45
+ <?php foreach ($this->getRatings() as $_rating): ?>
46
+ <tr class="odd<?php if($_oddIterator == $this->getRatings()->getSize()): $_oddIterator = 0; ?> last<?php endif; ?>">
47
+ <td class="label"><?php echo $_rating->getRatingCode() ?></td>
48
+ <?php $_iterator = 1; ?>
49
+ <?php foreach ($_rating->getOptions() as $_option): ?>
50
+ <!--<td <?php if($_iterator == 5): ?>class="last"<?php endif; ?> style="width:60px;"><input type="radio" <?php if($_iterator == 5): $_iterator=0; ?>class="validate-one-required-by-name"<?php endif; ?> name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $_rating->getRatingCode() ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>"/></td>-->
51
+ <td<?php if($_iterator == 5): ?> class="last"<?php endif; ?> style="width:60px;"><input type="radio" name="ratings[<?php echo $_rating->getId() ?>]" id="<?php echo $_rating->getRatingCode() ?>_<?php echo $_option->getValue() ?>" value="<?php echo $_option->getId() ?>" /></td>
52
+ <?php $_iterator++ ?>
53
+ <?php endforeach; ?>
54
+ </tr>
55
+ <?php $_oddIterator ++; ?>
56
+ <?php endforeach; ?>
57
+ </tbody>
58
+ </table>
59
+ <input type="hidden" name="validate_rating" class="validate-rating" value="" />
60
+ <script type="text/javascript">decorateTable('product-review-table')</script>
61
+ </div>
62
+ <?php endif; ?>
63
+ <?php // do not remove div - some problem whith validator in IE ?>
64
+ <div>
65
+ <label for="nickname_field"><?php echo $this->__('Nickname') ?><span class="required">*</span></label><br />
66
+ <input class="input-text required-entry" name="nickname" id="nickname_field" style="width: 450px;" type="text" value="<?php echo $this->htmlEscape($data->getNickname()) ?>" />
67
+ </div>
68
+
69
+ <div>
70
+ <label for="summary_field"><?php echo $this->__('Summary of Your Review') ?><span class="required">*</span></label><br />
71
+ <input name="title" class="input-text required-entry" id="summary_field" style="width: 450px;" type="text" value="<?php echo $this->htmlEscape($data->getTitle()) ?>" />
72
+ </div>
73
+
74
+ <div>
75
+ <label for="review_field"><?php echo $this->__('Review') ?><span class="required">*</span></label><br />
76
+ <textarea class="required-entry" name="detail" id="review_field" cols="53" rows="10" style="width: 450px;"><?php echo $this->htmlEscape($data->getDetail()) ?></textarea>
77
+ </div>
78
+
79
+ <?php // captcha
80
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
81
+ {
82
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/review"))
83
+ echo $this->getChildHtml('captcha_ajax_part');
84
+ }
85
+ ?>
86
+
87
+ <div class="button-set">
88
+ <button class="form-button right" type="submit"><span><?php echo $this->__('Submit Review') ?></span></button>
89
+ </div>
90
+ </fieldset>
91
+ </form>
92
+ <script type="text/javascript">
93
+ //<![CDATA[
94
+ var dataForm = new VarienForm('review-form');
95
+
96
+ Validation.addAllThese(
97
+ [
98
+ ['validate-rating', '<?php echo $this->__('Please select one of each of the ratings above') ?>', function(v) {
99
+ var trs = $('product-review-table').getElementsBySelector('tr');
100
+ var inputs;
101
+ var error = 1;
102
+
103
+ for( var j=0; j < trs.length; j++ ) {
104
+ var tr = trs[j];
105
+ if( j > 0 ) {
106
+ inputs = tr.getElementsBySelector('input');
107
+
108
+ for( i in inputs ) {
109
+ if( inputs[i].checked == true ) {
110
+ error = 0;
111
+ }
112
+ }
113
+
114
+ if( error == 1 ) {
115
+ return false;
116
+ } else {
117
+ error = 1;
118
+ }
119
+ }
120
+ }
121
+ return true;
122
+ }]
123
+ ]
124
+ );
125
+ //]]>
126
+ </script>
app/design/frontend/default/default/template/outsourceOnline/captcha/onepage_billing.phtml ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ ?>
23
+ <form id="co-billing-form" action="" >
24
+ <fieldset>
25
+ <ul class="form-list">
26
+ <?php if ($this->customerHasAddresses()): ?>
27
+ <li class="wide">
28
+ <label for="billing-address-select"><?php echo $this->__('Select a billing address from your address book or enter a new address.') ?></label>
29
+ <div class="input-box">
30
+ <?php echo $this->getAddressesHtmlSelect('billing') ?>
31
+ </div>
32
+ </li>
33
+ <?php endif; ?>
34
+ <li id="billing-new-address-form"<?php if ($this->customerHasAddresses()): ?> style="display:none;"<?php endif; ?>>
35
+ <fieldset>
36
+ <input type="hidden" name="billing[address_id]" value="<?php echo $this->getAddress()->getId() ?>" id="billing:address_id" />
37
+ <ul>
38
+ <li class="fields"><?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getAddress())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?></li>
39
+ <li class="fields">
40
+ <div class="field">
41
+ <label for="billing:company"><?php echo $this->__('Company') ?></label>
42
+ <div class="input-box">
43
+ <input type="text" id="billing:company" name="billing[company]" value="<?php echo $this->htmlEscape($this->getAddress()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
44
+ </div>
45
+ </div>
46
+ <?php if(!$this->isCustomerLoggedIn()): ?>
47
+ <div class="field">
48
+ <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
49
+ <div class="input-box">
50
+ <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
51
+ </div>
52
+ </div>
53
+ <?php endif ?>
54
+ </li>
55
+ <li class="wide">
56
+ <label for="billing:street1" class="required"><em>*</em><?php echo $this->__('Address') ?></label>
57
+ <div class="input-box">
58
+ <input type="text" title="<?php echo $this->__('Street Address') ?>" name="billing[street][]" id="billing:street1" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet(1)) ?>" class="input-text required-entry" />
59
+ </div>
60
+ </li>
61
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
62
+ <li class="wide">
63
+ <div class="input-box">
64
+ <input type="text" title="<?php echo $this->__('Street Address '.$_i) ?>" name="billing[street][]" id="billing:street<?php echo $_i?>" value="<?php echo $this->htmlEscape($this->getAddress()->getStreet($_i)) ?>" class="input-text" />
65
+ </div>
66
+ </li>
67
+ <?php endfor ?>
68
+ <li class="fields">
69
+ <div class="field">
70
+ <label for="billing:city" class="required"><em>*</em><?php echo $this->__('City') ?></label>
71
+ <div class="input-box">
72
+ <input type="text" title="<?php echo $this->__('City') ?>" name="billing[city]" value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>" class="input-text required-entry" id="billing:city" />
73
+ </div>
74
+ </div>
75
+ <div class="field">
76
+ <label for="billing:region_id" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
77
+ <div class="input-box">
78
+ <select id="billing:region_id" name="billing[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
79
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
80
+ </select>
81
+ <script type="text/javascript">
82
+ //<![CDATA[
83
+ $('billing:region_id').setAttribute('defaultValue', "<?php echo $this->getAddress()->getRegionId() ?>");
84
+ //]]>
85
+ </script>
86
+ <input type="text" id="billing:region" name="billing[region]" value="<?php echo $this->htmlEscape($this->getAddress()->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none;" />
87
+ </div>
88
+ </div>
89
+ </li>
90
+ <li class="fields">
91
+ <div class="field">
92
+ <label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
93
+ <div class="input-box">
94
+ <input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->htmlEscape($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international required-entry" />
95
+ </div>
96
+ </div>
97
+ <div class="field">
98
+ <label for="billing:country_id" class="required"><em>*</em><?php echo $this->__('Country') ?></label>
99
+ <div class="input-box">
100
+ <?php echo $this->getCountryHtmlSelect('billing') ?>
101
+ </div>
102
+ </div>
103
+ </li>
104
+ <li lang="fields">
105
+ <div class="field">
106
+ <label for="billing:telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
107
+ <div class="input-box">
108
+ <input type="text" name="billing[telephone]" value="<?php echo $this->htmlEscape($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text required-entry" id="billing:telephone" />
109
+ </div>
110
+ </div>
111
+ <div class="field">
112
+ <label for="billing:fax"><?php echo $this->__('Fax') ?></label>
113
+ <div class="input-box">
114
+ <input type="text" name="billing[fax]" value="<?php echo $this->htmlEscape($this->getAddress()->getFax()) ?>" title="<?php echo $this->__('Fax') ?>" class="input-text" id="billing:fax" />
115
+ </div>
116
+ </div>
117
+ </li>
118
+ <?php if(!$this->isCustomerLoggedIn()): ?>
119
+
120
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
121
+ <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
122
+ <?php if (isset($dob) && isset($gender) && ($_dob->isEnabled() || $_gender->isEnabled())): ?>
123
+ <li class="fields">
124
+ <?php if ($_dob->isEnabled()): ?>
125
+ <div class="field">
126
+ <?php echo $_dob->setDate($this->getQuote()->getCustomerDob())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
127
+ </div>
128
+ <?php endif; ?>
129
+ <?php if ($_gender->isEnabled()): ?>
130
+ <div class="field">
131
+ <?php echo $_gender->setGender($this->getQuote()->getCustomerGender())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
132
+ </div>
133
+ <?php endif ?>
134
+ </li>
135
+ <?php endif ?>
136
+
137
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
138
+ <?php if ($_taxvat->isEnabled()): ?>
139
+ <li>
140
+ <?php echo $_taxvat->setTaxvat($this->getQuote()->getCustomerTaxvat())->setFieldIdFormat('billing:%s')->setFieldNameFormat('billing[%s]')->toHtml() ?>
141
+ </li>
142
+ <?php endif ?>
143
+
144
+ <li class="fields" id="register-customer-password">
145
+ <div class="field">
146
+ <label for="billing:customer_password" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
147
+ <div class="input-box">
148
+ <input type="password" name="billing[customer_password]" id="billing:customer_password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" />
149
+ </div>
150
+ </div>
151
+ <div class="field">
152
+ <label for="billing:confirm_password" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label>
153
+ <div class="input-box">
154
+ <input type="password" name="billing[confirm_password]" title="<?php echo $this->__('Confirm Password') ?>" id="billing:confirm_password" class="input-text required-entry validate-cpassword" />
155
+ </div>
156
+ </div>
157
+ </li>
158
+ <?php endif; ?>
159
+
160
+
161
+ <?php
162
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
163
+ {
164
+
165
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/customer")): ?>
166
+ <?php echo $this->getChildHtml('captcha_ajax_part'); ?>
167
+ <?php endif;
168
+ }
169
+ ?>
170
+
171
+
172
+
173
+ <?php if ($this->isCustomerLoggedIn() && $this->customerHasAddresses()):?>
174
+ <li class="control">
175
+ <input type="checkbox" name="billing[save_in_address_book]" value="1" title="<?php echo $this->__('Save in address book') ?>" id="billing:save_in_address_book" onchange="shipping.setSameAsBilling(false);"<?php if ($this->getAddress()->getSaveInAddressBook()):?> checked="checked"<?php endif;?> class="checkbox" /><label for="billing:save_in_address_book"><?php echo $this->__('Save in address book') ?></label>
176
+ </li>
177
+ <?php else:?>
178
+ <li class="no-display"><input type="hidden" name="billing[save_in_address_book]" value="1" /></li>
179
+ <?php endif; ?>
180
+ </ul>
181
+ </fieldset>
182
+ </li>
183
+ <?php if ($this->canShip()): ?>
184
+ <li class="control">
185
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_yes" value="1"<?php if ($this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to this address') ?>" onclick="$('shipping:same_as_billing').checked = true;" class="radio" /><label for="billing:use_for_shipping_yes"><?php echo $this->__('Ship to this address') ?></label></li>
186
+ <li class="control">
187
+ <input type="radio" name="billing[use_for_shipping]" id="billing:use_for_shipping_no" value="0"<?php if (!$this->isUseBillingAddressForShipping()) {?> checked="checked"<?php }?> title="<?php echo $this->__('Ship to different address') ?>" onclick="$('shipping:same_as_billing').checked = false;" class="radio" /><label for="billing:use_for_shipping_no"><?php echo $this->__('Ship to different address') ?></label>
188
+ </li>
189
+ <?php endif; ?>
190
+ </ul>
191
+ <?php if (!$this->canShip()): ?>
192
+ <input type="hidden" name="billing[use_for_shipping]" value="1" />
193
+ <?php endif; ?>
194
+ <div class="buttons-set" id="billing-buttons-container">
195
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
196
+ <button type="button" title="<?php echo $this->__('Continue') ?>" class="button" onclick="(typeof checkOSOLCaptcha == 'function')?checkOSOLCaptcha(billingForm):billing.save();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
197
+ <span class="please-wait" id="billing-please-wait" style="display:none;">
198
+ <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" alt="<?php echo $this->__('Loading next step...') ?>" title="<?php echo $this->__('Loading next step...') ?>" class="v-middle" /> <?php echo $this->__('Loading next step...') ?>
199
+ </span>
200
+ </div>
201
+ </fieldset>
202
+ </form>
203
+ <script type="text/javascript">
204
+ //<![CDATA[
205
+ var billing = new Billing('co-billing-form', '<?php echo $this->getUrl('checkout/onepage/getAddress') ?>address/', '<?php echo $this->getUrl('checkout/onepage/saveBilling') ?>');
206
+ var billingForm = new VarienForm('co-billing-form',true);
207
+
208
+ //billingForm.setElementsRelation('billing:country_id', 'billing:region', '<?php echo $this->getUrl('directory/json/childRegion') ?>', '<?php echo $this->__('Select State/Province...') ?>');
209
+ $('billing-address-select') && billing.newAddress(!$('billing-address-select').value);
210
+
211
+ var billingRegionUpdater = new RegionUpdater('billing:country_id', 'billing:region', 'billing:region_id', countryRegions, undefined, 'billing:postcode');
212
+ //]]>
213
+ </script>
app/design/frontend/default/default/template/outsourceOnline/captcha/register.phtml ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
24
+ * Create account form template
25
+ *
26
+ * @see Mage_Customer_Block_Form_Register
27
+ */
28
+ ?>
29
+ <div class="page-head">
30
+ <h3><?php echo $this->__('Create an Account') ?></h3>
31
+ </div>
32
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
33
+ <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate" onSubmit="return checkOSOLCaptcha(dataForm);">
34
+ <fieldset class="group-select wide">
35
+ <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
36
+ <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
37
+ <h4 class="legend"><?php echo $this->__('Personal Information') ?></h4>
38
+ <ul>
39
+ <li>
40
+ <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->toHtml() ?>
41
+ </li>
42
+ <li>
43
+ <div class="input-box">
44
+ <label for="email_address"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br/>
45
+ <input type="text" name="email" id="email_address" value="<?php echo $this->htmlEscape($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="validate-email required-entry input-text" />
46
+ </div>
47
+ </li>
48
+ <?php if ($this->isNewsletterEnabled()): ?>
49
+ <li>
50
+ <input type="checkbox" name="is_subscribed" title="<?php echo $this->__('Sign Up for Newsletter') ?>" value="1" id="is_subscribed" <?php if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php endif ?> />
51
+ <label for="is_subscribed"><?php echo $this->__('Sign Up for Newsletter') ?></label>
52
+ </li>
53
+ <?php endif ?>
54
+ <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
55
+ <?php if ($_dob->isEnabled()): ?>
56
+ <li><?php echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>
57
+ <?php endif ?>
58
+ <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
59
+ <?php if ($_taxvat->isEnabled()): ?>
60
+ <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
61
+ <?php endif ?>
62
+ </ul>
63
+ </fieldset>
64
+ <?php if($this->getShowAddressFields()): ?>
65
+ <input type="hidden" name="create_address" value="1" />
66
+ <fieldset class="group-select wide">
67
+ <h4 class="legend"><?php echo $this->__('Address Information') ?></h4>
68
+ <ul>
69
+ <li>
70
+ <div class="input-box">
71
+ <label for="company"><?php echo $this->__('Company') ?></label><br />
72
+ <input type="text" name="company" id="company" value="<?php echo $this->htmlEscape($this->getFormData()->getCompany()) ?>" title="<?php echo $this->__('Company') ?>" class="input-text" />
73
+ </div>
74
+ <div class="input-box">
75
+ <label for="lastname"><?php echo $this->__('Telephone') ?> <span class="required">*</span></label><br />
76
+ <input type="text" name="telephone" id="telephone" value="<?php echo $this->htmlEscape($this->getFormData()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="required-entry input-text" />
77
+ </div>
78
+ </li>
79
+ <li>
80
+ <label for="street_1"><?php echo $this->__('Street Address') ?> <span class="required">*</span></label><br />
81
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet(1)) ?>" title="<?php echo $this->__('Street Address') ?>" id="street_1" class="required-entry input-text" />
82
+ </li>
83
+ <?php for ($_i=2, $_n=$this->helper('customer/address')->getStreetLines(); $_i<=$_n; $_i++): ?>
84
+ <li>
85
+ <input type="text" name="street[]" value="<?php echo $this->htmlEscape($this->getFormData()->getStreet($_i)) ?>" title="<?php echo $this->__('Street Address '.$_i) ?>" id="street_<?php echo $_i?>" class="input-text" />
86
+ <?php endfor ?>
87
+ </li>
88
+ <li>
89
+ <div class="input-box">
90
+ <label for="city"><?php echo $this->__('City') ?> <span class="required">*</span></label><br />
91
+ <input type="text" name="city" value="<?php echo $this->htmlEscape($this->getFormData()->getCity()) ?>" title="<?php echo $this->__('City') ?>" class="required-entry input-text" id="city" />
92
+ </div>
93
+ <div class="input-box">
94
+ <label for="region_id"><?php echo $this->__('State/Province') ?> <span class="required">*</span></label><br />
95
+ <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none">
96
+ <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
97
+ </select>
98
+ <script type="text/javascript">
99
+ $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
100
+ </script>
101
+ <input type="text" id="region" name="region" value="<?php echo $this->htmlEscape($this->getRegion()) ?>" title="<?php echo $this->__('State/Province') ?>" class="input-text" style="display:none" />
102
+ </div>
103
+ </li>
104
+ <li>
105
+ <div class="input-box">
106
+ <label for="zip"><?php echo $this->__('Zip/Postal Code') ?> <span class="required">*</span></label><br/>
107
+ <input type="text" name="postcode" value="<?php echo $this->htmlEscape($this->getFormData()->getPostcode()) ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="validate-zip-international required-entry input-text" />
108
+ </div>
109
+ <div class="input-box">
110
+ <label for="country"><?php echo $this->__('Country') ?> <span class="required">*</span></label><br/>
111
+ <?php echo $this->getCountryHtmlSelect() ?>
112
+ </div>
113
+ </li>
114
+ </ul>
115
+ </fieldset>
116
+ <input type="hidden" name="default_billing" value="1" />
117
+ <input type="hidden" name="default_shipping" value="1" />
118
+ <?php endif; ?>
119
+ <fieldset class="group-select wide">
120
+ <h4 class="legend"><?php echo $this->__('Login Information') ?></h4>
121
+ <ul>
122
+ <li>
123
+ <div class="input-box">
124
+ <label for="password"><?php echo $this->__('Password') ?> <span class="required">*</span></label><br/>
125
+ <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="required-entry validate-password input-text" />
126
+ </div>
127
+ <div class="input-box">
128
+ <label for="confirmation"><?php echo $this->__('Confirm Password') ?> <span class="required">*</span></label><br />
129
+ <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="required-entry validate-cpassword input-text" />
130
+ </div>
131
+ </li>
132
+ </ul>
133
+ </fieldset>
134
+
135
+ <?php
136
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/customer")): ?>
137
+ <?php echo $this->getChildHtml('captcha_ajax_part'); ?>
138
+ <?php endif; ?>
139
+
140
+ <div class="button-set">
141
+ <p class="required"><?php echo $this->__('* Required Fields') ?></p>
142
+ <a href="<?php echo $this->getBackUrl() ?>" class="left">&laquo; <?php echo $this->__('Back') ?></a>
143
+ <button class="form-button" type="submit"><span><?php echo $this->__('Submit') ?></span></button>
144
+ </div>
145
+ </form>
146
+ <script type="text/javascript">
147
+ //<![CDATA[
148
+ var dataForm = new VarienForm('form-validate', true);
149
+ <?php if($this->getShowAddressFields()): ?>
150
+ new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>);
151
+ <?php endif; ?>
152
+ //]]>
153
+ </script>
app/design/frontend/default/default/template/outsourceOnline/captcha/send.phtml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ /**
23
+ * Send to friend form
24
+ *
25
+ * @see Mage_Sendfriend_Block_Index
26
+ */
27
+ ?>
28
+
29
+ <script type="text/javascript">
30
+ //<![CDATA[
31
+ i=0;
32
+ var recipCount = 1;
33
+ var maxRecip = <?php echo $this->getMaxRecipients() ?>;
34
+ function remove_recipient(i){
35
+ $('recipients_name'+i).up(2).remove();
36
+ recipCount--;
37
+ if(recipCount<maxRecip && maxRecip != 0) {
38
+ $('add_recipient_button').show();
39
+ $('max_recipient_message').hide();
40
+ }
41
+ return false;
42
+ }
43
+
44
+ function add_recipient(){
45
+ ul = $('recipients_options');
46
+ var li_mail = Element.extend(document.createElement("LI"));
47
+ li_mail.addClassName('addElement');
48
+ li_mail.innerHTML = '<div align="right"><a href="delete_email" onclick="remove_recipient('+i+');return false"><img src="<?php echo $this->getSkinUrl('images/list_remove_btn.gif') ?>" alt="<?php echo $this->__('Remove Email') ?>"/><\/a><\/div>'
49
+ li_mail.innerHTML += '<div class="left"><label for="recipients_name"><?php echo $this->__('Name:') ?> <span class="required">*<\/span><\/label><br /><div style="width:250px"><input name="recipients[name][]" type="text" class="input-text required-entry" id="recipients_name'+i+'" style="width:250px;" /><\/div><br /><br /><\/div>';
50
+ li_mail.innerHTML += '<div class="right"><label for="recipients_email"><?php echo $this->__('Email Address:') ?><span class="required">*<\/span><\/label><br /><div style="width:250px"><input name="recipients[email][]" value="" title="<?php echo $this->__('Email Address') ?>" id="recipients_email'+i+'" type="text" class="input-text required-entry validate-email" style="width:250px;" /><\/div><\/div>';
51
+ i++;
52
+ recipCount++;
53
+ if(recipCount>=maxRecip && maxRecip != 0) {
54
+ $('add_recipient_button').hide();
55
+ $('max_recipient_message').show();
56
+ }
57
+
58
+ ul.appendChild(li_mail);
59
+ }
60
+ //]]>
61
+ </script>
62
+
63
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
64
+ <div class="page-head">
65
+ <h3><?php echo $this->__('Email to a Friend') ?></h3>
66
+ </div>
67
+ <form action="<?php echo $this->getUrl('*/*/sendmail', array('id'=>$this->getProductId(), 'cat_id'=>$this->getCategoryId())) ?>" method="post" id="product_sendtofriend_form" onSubmit="return checkOSOLCaptcha(productSendtofriendForm);">
68
+ <div class="col-1 login-box">
69
+ <div class="col-1 registered-users">
70
+ <div class="content ">
71
+ <div>
72
+ <h4><?php echo $this->__('Sender:') ?></h4>
73
+ <ul class="form-list" id="sender_options">
74
+ <li>
75
+ <div class="left">
76
+ <label for="sender_name"><?php echo $this->__('Name:') ?> <span class="required">*</span></label><br/>
77
+ <div style="width:250px"><input name="sender[name]" value="<?php echo $this->htmlEscape($this->getUserName()) ?>" title="<?php echo $this->__('Name') ?>" id="sender_name" type="text" class="input-text required-entry" style="width:250px;" /></div>
78
+ </div>
79
+ <div class="right">
80
+ <label for="sender_email"><?php echo $this->__('Email:') ?> <span class="required">*</span></label><br/>
81
+ <div style="width:250px"><input name="sender[email]" value="<?php echo $this->htmlEscape($this->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" id="sender_email" type="text" class="input-text required-entry validate-email" style="width:250px;" /></div>
82
+ </div>
83
+ </li>
84
+ <li>
85
+ <label for="sender_message"><?php echo $this->__('Message:') ?> <span class="required">*</span></label><br/>
86
+ <textarea name="sender[message]" class="input-text required-entry" id="sender_message" cols="3" rows="3" style="width:100%;height:100px"><?php echo $this->htmlEscape($this->getFormData()->getData('sender/message'))?></textarea>
87
+ </li>
88
+ </ul>
89
+ </div>
90
+ <div>
91
+ <div>
92
+ <br />
93
+ <h4><?php echo $this->__('Recipient:') ?></h4>
94
+ <ul class="form-list" id="recipients_options">
95
+ <li>
96
+ <div class="left">
97
+ <label for="recipients_name"><?php echo $this->__('Name:') ?> <span class="required">*</span></label><br/>
98
+ <div style="width:250px"><input name="recipients[name][]" type="text" class="input-text required-entry" id="recipients_name" style="width:250px;" /></div><br /><br />
99
+ </div>
100
+ <div class="right">
101
+ <label for="recipients_email"><?php echo $this->__('Email Address:') ?> <span class="required">*</span></label><br/>
102
+ <div style="width:250px"><input name="recipients[email][]" value="" title="<?php echo $this->__('Email Address') ?>" id="recipients_email" type="text" class="input-text required-entry validate-email" style="width:250px;" /></div>
103
+ </div>
104
+ </li>
105
+ </ul>
106
+ <div id="max_recipient_message" style="display:none">
107
+ <?php if ($this->getMaxRecipients()): ?>
108
+ <?php echo $this->__('Maximum %d email addresses allowed.', $this->getMaxRecipients()) ?>
109
+ <?php endif; ?>
110
+ </div>
111
+ <?php if (1 < $this->getMaxRecipients()): ?>
112
+ <div id="add_recipient_button">
113
+ <button class="form-button" onclick="add_recipient();" type="button"><span><?php echo $this->__('Add Recipient') ?></span></button>
114
+ </div>
115
+ <?php endif; ?>
116
+ </div>
117
+ </div>
118
+ <div style="clear:both"></div>
119
+ </div>
120
+
121
+ <?php // recaptcha
122
+ if( !(Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/when_loggedin") && (Mage::getSingleton('customer/session')->isLoggedIn())) )
123
+ {
124
+ if (Mage::getStoreConfig("OutsourceOnline_Captcha/captcha/sendfriend"))
125
+ echo $this->getChildHtml('captcha_ajax_part');
126
+ }
127
+ ?>
128
+
129
+ <div class="button-set">
130
+ <button class="form-button right" type="submit"><span><?php echo $this->__('Send email') ?></span></button>
131
+ </div>
132
+ </div>
133
+ </div>
134
+ </form>
135
+ <script type="text/javascript">
136
+ var productSendtofriendForm = new VarienForm('product_sendtofriend_form');
137
+ productSendtofriendForm.submit = function() {
138
+ if(this.validator.validate()) {
139
+ this.form.submit();
140
+ }
141
+ }.bind(productSendtofriendForm);
142
+ </script>
app/etc/modules/OutsourceOnline_Captcha.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Outsource Online Captcha Extension
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to license@magentocommerce.com so we can send you a copy immediately.
15
+ *
16
+ * @category Outsource Online
17
+ * @package OutsourceOnline_Captcha
18
+ * @author Sreekanth Dayanand
19
+ * @copyright Copyright (c) 2010 Outsource Online. (http://www.outsource-online.net)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <OutsourceOnline_Captcha>
26
+ <active>true</active>
27
+ <codePool>community</codePool>
28
+ </OutsourceOnline_Captcha>
29
+ </modules>
30
+ </config>
app/locale/en_US/OutsourceOnline_Captcha.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ Enter security code,Enter the security code below
2
+ Refresh captcha, letters not clear ? click here for a new security code
3
+ Loading...,Please wait while the form is processed
4
+ Your CAPTCHA entry is incorrect. Please try again.,The security code you entered does not match with the one in the form.\nPlease try again
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>OutsourceOnline_Captcha</name>
4
- <version>2.0.0</version>
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>2012-04-04</date>
14
- <time>08:27:52</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="OutsourceOnline_Captcha.xml" hash=""/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="OutsourceOnline_Captcha.xml" hash=""/></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="OutsourceOnline_Captcha.csv" hash=""/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>OutsourceOnline_Captcha</name>
4
+ <version>2.0.1</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>2012-04-18</date>
14
+ <time>12:30:55</time>
15
+ <contents><target name="magelocale"><dir name="en_US"><file name="OutsourceOnline_Captcha.csv" hash="46c1c9105a99ef6a3e884381ba060fe9"/></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="captcha.phtml" hash="383e4f75cf0cd00cc49f5ea0c3635ee7"/><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="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="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="f0b13abb2dd1159aaddc908cff08ccce"/><file name="system.xml" hash="fb6311facb6411a522d885ffbb6cfd5f"/></dir><dir name="Helper"><dir name="osolCaptcha"><file name="adlibBT.png" hash="6a4ddf589628a9a16657532bd2f75a5c"/><file name="adlibBT.TTF" hash="4ff833d37c38398cd201b2550bf8ecb5"/></dir><file name="Data.php" hash="59b23c26640f4975f400322db9577cab"/></dir><dir name="Model"><dir name="Source"><file name="Captchaimage.php" hash="b49acab3a47cfa798aa16825f6417c82"/><file name="Captchalanguage.php" hash="89d9e8e16788d84c5ce8fcc2a9e07925"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>