Problem in patched "components\com_search\controller.php"

4 views
Skip to first unread message

jits_1998

unread,
Jun 9, 2009, 9:26:19 AM6/9/09
to joomlacaptcha
Hi,

The patched code has two problems:
1) It does not work with disabled plugin
2) It does not work with logged-in user.

The following code is from patched components\com_search
\controller.php:

$results = $dispatcher->trigger( 'onCaptchaRequired', array
( 'user.search' ) );
if ( $results[0] ) {
$captchaparams = array( JRequest::getVar( 'captchacode', '',
'post' )
, JRequest::getVar( 'captchasuffix', '', 'post' )
, JRequest::getVar( 'captchasessionid', '', 'post' ));
$results = $dispatcher->trigger( 'onCaptchaVerify',
$captchaparams );
if ( ! $results[0] ) {
JError::raiseWarning( 'CAPTHCA', JText::_
( 'CAPTCHACODE_DO_NOT_MATCH' ) );
}
}

// slashes cause errors, <> get stripped anyway later on. # causes
problems.
$badchars = array('#','>','<','\\');
$searchword = trim(str_replace($badchars, '', JRequest::getString
('searchword', null, 'post')));

// Captcha Controller Patch rev. 4.5.0 Stable
if ( ! $results[0] ) {
$searchword = '';
}

Rather this should be :

$results = $dispatcher->trigger( 'onCaptchaRequired', array
( 'user.search' ) );
if ( $results[0] ) {
$captchaparams = array( JRequest::getVar( 'captchacode', '',
'post' )
, JRequest::getVar( 'captchasuffix', '', 'post' )
, JRequest::getVar( 'captchasessionid', '', 'post' ));
$results = $dispatcher->trigger( 'onCaptchaVerify',
$captchaparams );
if ( ! $results[0] ) {
$searchword = '';
JError::raiseWarning( 'CAPTHCA', JText::_
( 'CAPTCHACODE_DO_NOT_MATCH' ) );
}
}



// slashes cause errors, <> get stripped anyway later on. # causes
problems.
$badchars = array('#','>','<','\\');
$searchword = trim(str_replace($badchars, '', JRequest::getString
('searchword', null, 'post')));

Kupala

unread,
Jun 13, 2009, 1:37:44 AM6/13/09
to joomlacaptcha
Хм, плагин выключен, значит не работает. Так работает любое устройство
или программа. Не вижу в этом проблемы.

Если пользователь вошел в систему, то зачем его проверять с помощью
captcha? Понятно, что он не робот. Или, во всяком случае, он очень
умный робот)))

Что касается вашего кода. То он, действительно, в первом варианте был
почти таков как вами предложено. Но, из-за специфики некоторых
шаблонов не был принят в окончательную версию.

Jitendra Singh

unread,
Jun 13, 2009, 2:55:13 AM6/13/09
to joomla...@googlegroups.com
Hi,

What I meant by not working was that the search itself won't work if we disable the plugin. I will try to get the latest, though I got it only a few days ago. Also it would be useful if after installation, the original is backed up.

I know my code also had some problems. But for now I am not using the plugin.

Thanks,
Jitendra

2009/6/13 Kupala <gru...@gmail.com>



--

Woody Allen  - "Money is better than poverty, if only for financial reasons."
Reply all
Reply to author
Forward
0 new messages