| New Plugin sfCaptchaGD [message #54790] |
Wed, 25 June 2008 13:46  |
GliNT Messages: 30 Registered: June 2008 |
Member |
|
|
Hi!
http://trac.symfony-project.com/wiki/sfCaptchaGDPlugin
I created this plugin because of sfCaptcha required JpGraph library, that is not free as GD.
Please write me comments about my work!
|
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #57686 is a reply to message #54790 ] |
Sun, 03 August 2008 04:16   |
dhobson Messages: 85 Registered: February 2007 Location: Houston, Texas |
Member |
|
|
Please correct your documentation in the plugin Readme
Some of the instructions don't make sense.
hasError('captcha')) echo form_error('captcha') ?>
get('captcha')) ?><br>
<img src='<?php echo url_for('/captcha').'?'.time(); ?>'>
all:
.settings:
enabled_modules: [sfCaptchaGD](default,)
Don Hobson
http://www.myonlinetown.com/index.php
http://www.stinkybathrooms.com/
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58422 is a reply to message #54790 ] |
Mon, 11 August 2008 13:11   |
GliNT Messages: 30 Registered: June 2008 |
Member |
|
|
Hi, all!
I upgraded plugin for sf 1.1 + some minor fixes.
Please note!
Wiki Readme Markdown in http://www.symfony-project.org/plugins/sfCaptchaGDPlugin are bad, please see right Readme file in the archive http://plugins.symfony-project.com/sfCaptchaGDPlugin or below.
Waiting for your opinions 
Install instruction:
Enable one or more modules in your `settings.yml`
* sfCaptchaGD
all:
.settings:
enabled_modules: [default, sfCaptchaGD]
Clear your cache
== Secure your form ==
To secure a symfony form:
Put the following lines inside of your form
<?php if ($sf_request->hasError('captcha')) echo form_error('captcha') ?>
<?php echo input_tag('captcha', $sf_params->get('captcha')) ?><br>
<a href='' onClick='return false' title='Reload image'><img src='/captcha?<?php echo time(); ?>' onClick='this.src="/captcha?r=" + Math.random() + "&reload=1"'></a>
Put the following code into your form's validator yml file:
fields:
captcha:
required:
msg: Enter characters from image
sfCaptchaGDValidator:
captcha_error: Entered characters are wrong, try again
== Configuration options ==
These options are default for captcha, you can change any of them, putting in settings.yml
all:
sf_captchagd:
image_width: 100 # image width in pixels
image_height: 30 # image height in pixels
chars: "123456789" # possible chars in captcha
length: 4 # length of captcha
font_size: 18 # font size
# possible chars colors
font_color: ["252525", "8b8787", "550707", "3526E6", "88531E"]
# chars fonts
fonts: ["akbar/akbar.ttf", "brushcut/BRUSHCUT.TTF", "molten/molten.ttf", "planet_benson/Planetbe.ttf", "whoobub/WHOOBUB_.TTF"]
background_color: DDDDDD # image background color
border_color: 000000 # image border color
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58524 is a reply to message #54790 ] |
Tue, 12 August 2008 16:07   |
gregoire_m Messages: 50 Registered: May 2008 Location: France |
Member |
|
|
I've got the same error than dohfr with sf 1.1.0:
Warning: call_user_func(sfCaptchaGDRouting::listenToRoutingLoadConfigurationEvent) [function.call-user-func]:
First argument is expected to be a valid callback in /.../sfEventDispatcher.class.php on line 77
But my conf looks good
all:
.settings:
compat_10: on
enabled_modules: [default, sfCaptchaGD]
[Updated on: Tue, 12 August 2008 16:37]
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58630 is a reply to message #54790 ] |
Thu, 14 August 2008 02:08   |
danpowered Messages: 8 Registered: May 2008 |
Junior Member |
|
|
I'd like to add something that might help some people here...
If you have the captcha image generated but WITHOUT characters or anything, try adding arial.ttf in the plugin data/fonts directory.
I guess this has to do with the default font used by gd if none is provided.
Thanks for the plugin.
Edit: forgot to say that it happened on a development pc with xampp on windows. So maybe that GD will check out for another font.
[Updated on: Thu, 14 August 2008 02:09]
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58650 is a reply to message #58644 ] |
Thu, 14 August 2008 10:08   |
gregoire_m Messages: 50 Registered: May 2008 Location: France |
Member |
|
|
| GliNT wrote on Thu, 14 August 2008 09:46 |
2 gregoire_m: what versions of plugin and sf do you use?
|
sfCaptchaGD v1.0.4
symfony v1.1.0
edit: same error with symfony 1.1.1
[Updated on: Thu, 14 August 2008 10:24]
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58692 is a reply to message #58651 ] |
Thu, 14 August 2008 16:07   |
GliNT Messages: 30 Registered: June 2008 |
Member |
|
|
Hi all again!
I've forgot to include one class
dohfr, gregoire_m, danpowered and others, please upgrade to latest version!
Also I adapted for sf 1.1, see README for details:
== Secure your form in symfony 1.1 ==
Here is an example form class:
class ContactForm extends sfForm
{
public function configure()
{
$this->setWidgets(array(
'name' => new sfWidgetFormInput(),
'email' => new sfWidgetFormInput(),
'message' => new sfWidgetFormTextarea(),
'captcha' => new sfWidgetFormInput(),
));
$this->widgetSchema->setLabels(array(
'name' => 'Your name',
'email' => 'Your email address',
'message' => 'Your message',
'captcha' => 'Enter captcha code',
));
$this->setValidators(array(
'name' => new sfValidatorString(array('required' => true)),
'email' => new sfValidatorEmail(),
'message' => new sfValidatorString(array('min_length' => 4, 'required' => true)),
// Options:
// length(optional) - length of code
'captcha' => new sfValidatorCaptchaGD(array('length' => 4, 'required' => true), array('length' => 'Code length must be %length% characters', 'captcha' => 'Entered code is wrong')),
));
}
}
Here is an example template:
<form action="<?php echo url_for('contact/index') ?>" method="POST">
<table>
<?php echo $form['name']->renderRow() ?>
<?php echo $form['email']->renderRow() ?>
<?php echo $form['message']->renderRow() ?>
<?php echo $form['captcha']->renderRow() ?>
<tr>
<td></td>
<td><a href='' onClick='return false' title='Reload image'><img src='/captcha?<?php echo time(); ?>' onClick='this.src="/captcha?r=" + Math.random() + "&reload=1"' border='0'></a></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" />
</td>
</tr>
</table>
</form>
|
|
|
|
|
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58936 is a reply to message #58931 ] |
Mon, 18 August 2008 14:20   |
dohfr Messages: 53 Registered: July 2008 Location: FRANCE |
Member |
|
|
in my action.class.php?
in the plugin or in mine?
i'm try to download the pear package then?
well i re downloaded the plugin
it passed at 1.0.7 ?
[Updated on: Mon, 18 August 2008 14:24]
|
|
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #58993 is a reply to message #58990 ] |
Tue, 19 August 2008 11:43   |
dohfr Messages: 53 Registered: July 2008 Location: FRANCE |
Member |
|
|
it said default wasnt enabled
well i, set back my setting.yml
as:
enabled_modules: [default, sfCaptchaGD]
it was at
enabled_modules: [sfCaptchaGD]
well but i cant display the things :/
here the following log
Aug 19 11:46:11 symfony [info] {sfPatternRouting} Connect "/"
Aug 19 11:46:11 symfony [info] {sfPatternRouting} Connect "/symfony/:action/*"
Aug 19 11:46:11 symfony [info] {sfPatternRouting} Connect "/:module"
Aug 19 11:46:11 symfony [info] {sfPatternRouting} Connect "/:module/:action/*"
Aug 19 11:46:11 symfony [info] {sfPatternRouting} Connect "/captcha"
Aug 19 11:46:11 symfony [info] {sfFrontWebController} Initialization
Aug 19 11:46:11 symfony [info] {sfPatternRouting} Match route [default] for "/:module/:action/*"
Aug 19 11:46:11 symfony [info] {sfWebRequest} Request parameters array ( 'module' => 'contact', 'action' => 'create',)
Aug 19 11:46:11 symfony [info] {sfContext} Initialization
Aug 19 11:46:11 symfony [info] {sfFrontWebController} Dispatch request
Aug 19 11:46:11 symfony [info] {sfFilterChain} Executing filter "sfRenderingFilter"
Aug 19 11:46:11 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
Aug 19 11:46:11 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
Aug 19 11:46:11 symfony [info] {contactActions} Call "contactActions->executeCreate()"
Aug 19 11:46:11 symfony [info] {contactActions} Change template to "CURRENT/edit"
Aug 19 11:46:11 symfony [info] {sfPHPView} Initialize view for "contact/create"
Aug 19 11:46:11 symfony [info] {sfPHPView} Render "C:\wamp\www\pop\apps\frontend\modules/contact/templates/editSuccess.php"
Aug 19 11:46:11 symfony [info] {sfPHPView} Decorate content with "C:\wamp\www\pop\apps\frontend\templates/layout.php"
Aug 19 11:46:11 symfony [info] {sfPHPView} Render "C:\wamp\www\pop\apps\frontend\templates/layout.php"
Aug 19 11:46:11 symfony [info] {sfRenderingFilter} Render to the client
Aug 19 11:46:11 symfony [info] {sfWebResponse} Send status "HTTP/1.1 200 OK"
Aug 19 11:46:11 symfony [info] {sfWebResponse} Send header "Content-Type": "text/html; charset=utf-8"
Aug 19 11:46:11 symfony [info] {sfWebDebugLogger} Configuration 63.59 ms (9)
Aug 19 11:46:11 symfony [info] {sfWebDebugLogger} Action "contact/create" 103.27 ms (1)
Aug 19 11:46:11 symfony [info] {sfWebDebugLogger} View "Success" for "contact/create" 61.39 ms (1)
Aug 19 11:46:11 symfony [info] {sfWebResponse} Send content (23237 o)
Attachment: blank.jpg
(Size: 12.38KB, Downloaded 123 time(s))
[Updated on: Tue, 19 August 2008 11:48]
|
|
|
|
|
|
|
|
| Re: New Plugin sfCaptchaGD [message #59006 is a reply to message #59002 ] |
Tue, 19 August 2008 12:54   |
GliNT Messages: 30 Registered: June 2008 |
Member |
|
|
Try to put this in form:
<img src='/pop/web/index.php/captcha?<?php echo time(); ?>' onClick='this.src="/pop/web/index.php/captcha?r=" + Math.random() + "&reload=1"' border='0'>
[Updated on: Tue, 19 August 2008 12:57]
|
|
|
|
|
|