tinCaptcha - just another

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

tinCaptcha - just another

Post by Replika » Sat May 10, 2008 10:37 am

There are many extenions for captcha, but all I know are bloated. I just want a simple one.
Please have a look at http://joomlacode.org/gf/project/tincaptcha

I found no way to install language with my plugin, so I put it in the component. The plugin file is 120KB, but the most is font files (all fonts are grabbed from dafont.com, and they are copyrighted by their authors).

Here is the Contact page I have intergrated:
Image

And I did:
1. Install both com_tincaptcha and plg_tincaptcha (remember active plugin, we can change some settings in the plugin)
2. In File components\com_contact\controller.php, find and add like this:

Code: Select all

	function submit()
	{
		global $mainframe;

		// Check for request forgeries
		JRequest::checkToken() or jexit( 'Invalid Token' );

		// tincaptcha-
		$captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
		if ($captchk !== true)
		{
			JError::raiseWarning(0, $captchk);
			return false;
		}
		// -tincaptcha
3. In File components\com_contact\views\contact\tmpl\default_form.php, find and add:

Code: Select all

			<label id="contact_textmsg" for="contact_text">
				&nbsp;<?php echo JText::_( 'Enter your message' );?>:
			</label>
			<br />
			<textarea cols="50" rows="10" name="text" id="contact_text" class="inputbox required"></textarea>
			<!-- tincaptcha- -->
			<br />
			<label for="captcha">
				&nbsp;<?php echo JText::_( 'TIN_CAPTCHA' );?>:
			</label>
			<br />
			<input type="text" name="captcha" id="captcha" size="10" class="inputbox required" value="" />
			<br />
            <img src="index.php?option=com_tincaptcha&task=captcha_display" />
			<!-- -tincaptcha -->
That's all.

I do not put $this->display(); after JError::raiseWarning because it just display an empty form.
You might want raiseError instead, it will display only error message

Code: Select all

JError::raiseError(500, $captchk);
What my concern is in J1.5.3, when we typed wrong captcha and go back, all form data are cleared. They can be remembered in J1.5.1 because the code in libraries\joomla\environment\response.php

Code: Select all

//JResponse::setHeader( 'Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false ); // <-- browsers can not remember form
JResponse::setHeader( 'Cache-Control', 'post-check=0, pre-check=0', false ); // <--browsers can with this
I also hack Virtuemart registration form: http://forum.virtuemart.net/index.php?topic=40043.0
For Joomla registration will be available soon. I still want the captcha warning and the form display together with what we've typed in form.

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Fri May 16, 2008 2:32 pm

For the refresh image button, change the captcha image tag to this:

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime()" alt="Click to refresh image"/>
or

Code: Select all

<img name="captchaimg" src="index.php?option=com_tincaptcha&task=captcha_display" /><a href="javascript:void(0);" onclick="document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;">Refresh Image</a>

mylearningspace
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Sat Mar 10, 2007 3:41 pm
Contact:

Re: tinCaptcha - just another

Post by mylearningspace » Sun May 18, 2008 1:16 pm

can you pls be more specific how, where to edit 'img src' tag for virtuemart to achieve refresh button. im supposing you're referring to ps_userfield.php but i can't get syntax correct.

User avatar
adam_nz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 157
Joined: Thu Nov 03, 2005 7:21 am
Location: Auckland - New Zealand
Contact:

Re: tinCaptcha - just another

Post by adam_nz » Thu Jun 05, 2008 11:56 am

Installation in my 1.5.3 was easy (thanks). All works well - except I get no error message of any kind when the input doesn't match - just a blank page.

That part of the function *is* triggering, as when I add

Code: Select all

$this->display();
to controller.php I get a new form. I've tried different values in the line

Code: Select all

JError::raiseWarning(500, $captchk);
but nothing works.

Any ideas?

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Thu Jun 05, 2008 4:40 pm

Did you try with default template or not?

Code: Select all

   function submit()
   {
      global $mainframe;

      // Check for request forgeries
      JRequest::checkToken() or jexit( 'Invalid Token' );

      // tincaptcha-
      $captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
      if ($captchk !== true)
      {
         JError::raiseWarning(0, $captchk);
         $this->display();  // <-- display form
         return false;
      }
      // -tincaptcha

mikejk67
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sun Jun 22, 2008 1:13 pm

Re: tinCaptcha - just another

Post by mikejk67 » Tue Jun 24, 2008 11:08 pm

Thanks for the componet/plugin. Works great for me. :D

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Fri Jun 27, 2008 12:51 pm

So what should we do? If I use another template?

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Fri Jun 27, 2008 2:12 pm

korb wrote:So what should we do? If I use another template?
till works. It only affects the core files (in the first post)

Sunlust
Joomla! Apprentice
Joomla! Apprentice
Posts: 49
Joined: Wed Jul 02, 2008 3:19 pm
Location: Eastbourne, East Sussex
Contact:

Re: tinCaptcha - just another

Post by Sunlust » Wed Jul 02, 2008 3:41 pm

Oh my god, easy to use? are you [removed by mod] kidding me?

There's editing and you don't explain which parts of code I should edit, what's the problem with simply attacking ready to replace files and just telling where to put them into ????
Seriously, and even after I edited it and it seemed to work, it only returns a blank page when an error occurs and when I submit the captcha successfully, then it just shows the blank form without any information whether I successfuly sent the message or not.

It's bloody useless, also, the captcha images are way too hard to read, you can't tell whether a "b" is a "6" or when "1" is "l" or "I" just [removed by mod] silly, what's the point of releasing a product with 100 bugs????
http://smewebsolutions.co.uk
http://eastbournewebdesign.net
Web Design Services in Eastbourne, East Sussex

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Thu Jul 03, 2008 2:51 pm

:eek: Yep, this is not for a newbie but also not a brain teaser.
it only returns a blank page when an error occurs
Did you read the whole post?
the captcha images are way too hard to read
Just replace the fonts. You should know the principle of the source first or just ask a question.
what's the point of releasing a product with 100 bugs????
Maybe the extension is not enough for you but it's good for some people I know and of course, myself.
Have you ever worked as a volunteer, time wasting and no money? Do you have any contribution for open source world? Just do it.

pimpag
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Jul 08, 2008 5:30 pm
Location: London
Contact:

Re: tinCaptcha - just another

Post by pimpag » Tue Jul 08, 2008 5:57 pm

Cheers, i've been desperate for something alike.

rapidhelp
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Aug 01, 2008 12:43 am

Re: tinCaptcha - just another

Post by rapidhelp » Fri Aug 01, 2008 12:50 am

still problem with my website

tarkin789
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Mon Aug 14, 2006 6:54 am

Re: tinCaptcha - just another

Post by tarkin789 » Sat Aug 09, 2008 5:30 pm

hi, thanks for your work on this extension. I am using joomla 1.5.3 and have a custom template. I followed the instructions and have enabled the plugin and have inserted the lines of code as you instruct, but when i test my contact form I do not see anything new on it - just the normal form.

Any suggestions? thanks!

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Thu Aug 28, 2008 11:38 am

Hello,
I very much want to know how to make the font to be shown exactly how it is and not dublicated or other effects like rotated characters and so on.

I also want to know if we can integrate it with Jom Comment.
Thank you

User avatar
yellowtoot
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Mar 08, 2007 3:57 pm
Location: Šid

Re: tinCaptcha - just another

Post by yellowtoot » Mon Sep 01, 2008 6:55 pm

Thx, Replika
work for me like charm :p

here is:
com_contact pach
com_tincaptcha_0.1.1
plg_tincaptcha_0.1.1
You do not have the required permissions to view the files attached to this post.

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Fri Sep 12, 2008 1:27 am

We need this plugin to work only for guests. Is it possible?

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Sat Sep 13, 2008 1:36 pm

korb wrote:We need this plugin to work only for guests. Is it possible?
I should change a bit the code to first check user logged in or not, for example:

Code: Select all

$user =& JFactory::getUser();
if (JPluginHelper::isEnabled('system', 'tincaptcha') && $user->get('guest'))
{
      $captchk = plgSystemTincaptcha::check(JRequest::getVar('captcha', '', 'post'));
      if ($captchk !== true)
      {
         JError::raiseWarning(0, $captchk);
         return false;
      }
}

Code: Select all

<?php
$user =& JFactory::getUser();
if (JPluginHelper::isEnabled('system', 'tincaptcha') && $user->get('guest')) :
?>
         <!-- tincaptcha- -->
         <br />
         <label for="captcha">
            &nbsp;<?php echo JText::_( 'TIN_CAPTCHA' );?>:
         </label>
         <br />
         <input type="text" name="captcha" id="captcha" size="10" class="inputbox required" value="" />
         <br />
            <img src="index.php?option=com_tincaptcha&task=captcha_display" />
         <!-- -tincaptcha -->
<?php endif; ?>

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Sat Sep 13, 2008 1:54 pm

Thanks for input Replika

The thing here...where does the code go? and wich code? you have a lot of codes that you don't mention where it supose to go into....I mean what files, what lines?


Same thing for refresh image capability: where that code supose to go?

Danny

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Sat Sep 13, 2008 8:30 pm

Both refresh image codes not working, and registered users still can see captcha.
Sory for bad news

vrakas
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Sep 14, 2008 9:40 am

Re: tinCaptcha - just another

Post by vrakas » Sun Sep 14, 2008 9:48 am

First things first, THANK YOU for the time, effort and making this happen as i tried so many with no success and yours worked immediately with Version 1.5.6 :)

Only one small question if i may,

In which file can refresh the image be found so i can add / change the code?

Thanks again 8)

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Sun Sep 14, 2008 2:30 pm

vrakas wrote:In which file can refresh the image be found so i can add / change the code?
file: components\com_contact\views\contact\tmpl\default_form.php

Compare steps in the first post, You can see this line in the hack:

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" />
replace to

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime()" alt="<?php echo JText::_('TIN_REFRESH_ALT');?>"/>
or

Code: Select all

<img name="captchaimg" src="index.php?option=com_tincaptcha&task=captcha_display" /><a href="javascript:void(0);" onclick="document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;"><?php echo JText::_('TIN_REFRESH');?></a>
@korb:
What have you done?

@Moderators:
How do I edit the first post

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Sun Sep 14, 2008 2:43 pm

ok, just tried both codes now, and it does not work. When I click "Refresh image" link the image disapears.


And registered users are still required to input captcha security images.

Danny

vrakas
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Sep 14, 2008 9:40 am

Re: tinCaptcha - just another

Post by vrakas » Sun Sep 14, 2008 4:04 pm

Replika wrote:
vrakas wrote:In which file can refresh the image be found so i can add / change the code?
file: components\com_contact\views\contact\tmpl\default_form.php

Compare steps in the first post, You can see this line in the hack:

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" />
replace to

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime()" alt="<?php echo JText::_('TIN_REFRESH_ALT');?>"/>
or

Code: Select all

<img name="captchaimg" src="index.php?option=com_tincaptcha&task=captcha_display" /><a href="javascript:void(0);" onclick="document.images['captchaimg'].src='index.php?option=com_tincaptcha&task=captcha_display&t='+(new Date()).getTime();return false;"><?php echo JText::_('TIN_REFRESH');?></a>
Worked like a charm in both cases and just for others to know, the first changes the code by clicking ON the image and the other by clicking on the text.

Thanks again and keep up the good job 8)

Varsys
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Thu Sep 18, 2008 3:31 pm
Location: Chicago, IL
Contact:

Re: tinCaptcha - just another

Post by Varsys » Thu Sep 18, 2008 5:24 pm

Well done! Thanks for sharing.

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Thu Sep 18, 2008 6:16 pm

For contact component is not working, as I posted above. I canţt figure it out, but it seems that I have a problem with captcha images in Jom Comment: images are not rendered first visit of an article...

It works for VM registration!
BUT if I use

Code: Select all

alt="<?php echo JText::_('TIN_REFRESH_ALT'); ?>"
instead of alt="Click to refresh image", it does not work.
Any idea?

Thanks

mic
Joomla! Guru
Joomla! Guru
Posts: 692
Joined: Thu Aug 18, 2005 10:51 pm
Location: Austria
Contact:

Re: tinCaptcha - just another

Post by mic » Thu Sep 18, 2008 7:40 pm

@Korb: just 1 question: which Joomla version do you use?
http://www.joomx.com - custom extensions and development
http://www.joomlasupportdesk.com - support, migration, training and consulting
Member of the German Joomla Translation Team

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Thu Sep 18, 2008 10:22 pm

J1.5.7, I will add installation info in my signature.

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

Re: tinCaptcha - just another

Post by korb » Fri Sep 19, 2008 1:56 am

FOr me the trick to show captcha only to guest is working, but refresh image works only for Virtuemart registration process, using this code

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src=\'index.php?option=com_tincaptcha&task=captcha_display&t=\'+(new Date()).getTime()" alt="Click pentru reincarcare imagine" title="Click to refresh" />
I admit I might have some issues with VM template, but with Joomla? :pop

korb
Joomla! Intern
Joomla! Intern
Posts: 88
Joined: Thu Apr 03, 2008 3:58 pm
Contact:

FRQ: tinCaptcha

Post by korb » Sun Sep 21, 2008 8:28 pm

Replace very ugly Jom Comment captcha.

User avatar
Replika
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Fri Apr 14, 2006 4:06 pm

Re: tinCaptcha - just another

Post by Replika » Mon Sep 22, 2008 11:06 am

korb wrote:FOr me the trick to show captcha only to guest is working, but refresh image works only for Virtuemart registration process, using this code

Code: Select all

<img src="index.php?option=com_tincaptcha&task=captcha_display" onclick="this.src=\'index.php?option=com_tincaptcha&task=captcha_display&t=\'+(new Date()).getTime()" alt="Click pentru reincarcare imagine" title="Click to refresh" />
I admit I might have some issues with VM template, but with Joomla? :pop
please send me files you have edited.
In VM, html code put in variable, so ' characters become \'


Locked

Return to “Extensions for Joomla! 2.5”