Fix captcha see #7688

1.10.x
Julio Montoya 11 years ago
parent f81f9aa5f9
commit 0a68d4952f
  1. 60
      main/inc/lib/pear/HTML/QuickForm/CAPTCHA/Image.php
  2. 3
      main/inc/lib/pear/HTML/QuickForm/text.php
  3. 8
      main/inc/lib/pear/Text/CAPTCHA.php
  4. 2
      main/inc/lib/pear/Text/CAPTCHA/Driver/Base.php
  5. 2
      main/inc/lib/pear/Text/CAPTCHA/Driver/Equation.php
  6. 2
      main/inc/lib/pear/Text/CAPTCHA/Driver/Figlet.php
  7. 5
      main/inc/lib/pear/Text/CAPTCHA/Driver/Image.php
  8. 2
      main/inc/lib/pear/Text/CAPTCHA/Driver/Numeral.php
  9. 3
      main/inc/lib/pear/Text/CAPTCHA/Driver/Word.php
  10. 2
      main/inc/lib/pear/Text/CAPTCHA/Exception.php
  11. 2
      main/inc/lib/pear/Text/Diff.php
  12. 2
      main/inc/lib/pear/Text/Diff/Renderer/context.php
  13. 3
      main/inc/lib/pear/Text/Diff/Renderer/inline.php
  14. 2
      main/inc/lib/pear/Text/Diff/Renderer/unified.php
  15. 1
      main/inc/lib/pear/Text/Diff/ThreeWay.php
  16. 1
      main/inc/lib/pear/Text/Diff3.php
  17. 4
      main/inc/lib/userportal.lib.php

@ -83,14 +83,72 @@ class HTML_QuickForm_CAPTCHA_Image extends HTML_QuickForm_CAPTCHA
*/
var $_CAPTCHA_driver = 'Image';
/**
* Code based in HTML_QuickForm_text::getTemplate()
* In order to render correctly the captcha in different layouts
* @param string $layout
*
* @return string
*/
public static function getTemplate($layout)
{
$size = 8;
switch ($layout) {
case FormValidator::LAYOUT_INLINE:
return '
<div class="form-group {error_class}">
<label {label-for} >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
{label}
</label>
{element}
</div>';
break;
case FormValidator::LAYOUT_HORIZONTAL:
return '
<div class="form-group {error_class}">
<label {label-for} class="col-sm-2 control-label" >
<!-- BEGIN required --><span class="form_required">*</span><!-- END required -->
{label}
</label>
<div class="col-sm-'.$size.'">
{icon}
{element}
<!-- BEGIN label_2 -->
<p class="help-block">{label_2}</p>
<!-- END label_2 -->
<!-- BEGIN error -->
<span class="help-inline">{error}</span>
<!-- END error -->
</div>
<div class="col-sm-2">
<!-- BEGIN label_3 -->
{label_3}
<!-- END label_3 -->
</div>
</div>';
break;
case FormValidator::LAYOUT_BOX_NO_LABEL:
return '
<div class="input-group">
{icon}
{element}
</div>';
break;
}
}
/**
* Returns the HTML for the CAPTCHA image
*
* @return string
* @access public
*/
function toHtml()
public function toHtml()
{
if ($this->_flagFrozen) {
return '';
}

@ -71,9 +71,6 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
$this->_persistantFreeze = true;
$this->setType('text');
$renderer = FormValidator::getDefaultRenderer();
//$renderer->setElementTemplate($this->getTemplate(), $elementName);
}
/**

@ -14,11 +14,11 @@
/**
* Require Exception class for error handling.
*/
require_once 'Text/CAPTCHA/Exception.php';
//require_once 'Text/CAPTCHA/Exception.php';
/**
* Require Text_Password class for generating the phrase.
*/
require_once 'Text/Password.php';
//require_once 'Text/Password.php';
/**
* Text_CAPTCHA - creates a CAPTCHA for Turing tests.
@ -77,7 +77,7 @@ class Text_CAPTCHA
{
$driver = basename($driver);
$class = 'Text_CAPTCHA_Driver_' . $driver;
$file = str_replace('_', '/', $class) . '.php';
/*$file = str_replace('_', '/', $class) . '.php';
//check if it exists and can be loaded
if (!@fclose(@fopen($file, 'r', true))) {
throw new Text_CAPTCHA_Exception(
@ -85,7 +85,7 @@ class Text_CAPTCHA
);
}
//continue with including the driver
include_once $file;
include_once $file;*/
$driver = new $class;

@ -10,7 +10,7 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
require_once 'Text/CAPTCHA/Driver.php';
/**
* Base class file for all Text_CAPTCHA drivers.
*

@ -13,7 +13,7 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
require_once 'Text/CAPTCHA/Driver/Base.php';
/**
* Equation driver for Text_CAPTCHA.
* Returns simple equations as string, e.g. "9 - 2"

@ -12,8 +12,6 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
require_once 'Text/CAPTCHA/Driver/Base.php';
require_once 'Text/Figlet.php';
/**
* Text_CAPTCHA_Driver_Figlet - Text_CAPTCHA driver Figlet based CAPTCHAs
*

@ -11,8 +11,6 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
require_once 'Text/CAPTCHA/Driver/Base.php';
require_once 'Image/Text.php';
/**
* Text_CAPTCHA_Driver_Image - Text_CAPTCHA driver graphical CAPTCHAs
@ -69,7 +67,8 @@ class Text_CAPTCHA_Driver_Image extends Text_CAPTCHA_Driver_Base
'text_color' => '#000000',
'lines_color' => '#CACACA',
'background_color' => '#555555',
'antialias' => false);
'antialias' => false
);
/**
* Init function

@ -12,7 +12,7 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
require_once 'Text/CAPTCHA/Driver/Base.php';
/**
* Class used for numeral captchas
*

@ -13,8 +13,7 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
require_once 'Text/CAPTCHA/Driver/Base.php';
require_once 'Numbers/Words.php';
/**
* Require Numbers_Words class for generating the text.
*

@ -12,8 +12,6 @@
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @link http://pear.php.net/package/Text_CAPTCHA
*/
$lib_path = api_get_path(LIBRARY_PATH);
require_once $lib_path.'/pear/Exception.php';
/**
* Exception for Text_CAPTCHA
*

@ -50,7 +50,7 @@ class Text_Diff
$engine = basename($engine);
}
require_once 'Text/Diff/Engine/' . $engine . '.php';
//require_once 'Text/Diff/Engine/' . $engine . '.php';
$class = 'Text_Diff_Engine_' . $engine;
$diff_engine = new $class();

@ -14,8 +14,6 @@
* @package Text_Diff
*/
/** Text_Diff_Renderer */
require_once 'Text/Diff/Renderer.php';
/**
* @package Text_Diff

@ -13,9 +13,6 @@
* @package Text_Diff
*/
/** Text_Diff_Renderer */
require_once 'Text/Diff/Renderer.php';
/**
* "Inline" diff renderer.
*

@ -15,8 +15,6 @@
* @package Text_Diff
*/
/** Text_Diff_Renderer */
require_once 'Text/Diff/Renderer.php';
/**
* @package Text_Diff

@ -14,7 +14,6 @@
*/
/** Text_Diff */
require_once 'Text/Diff.php';
/**
* A class for computing three way diffs.

@ -14,7 +14,6 @@
*/
/** Text_Diff */
require_once 'Text/Diff.php';
/**
* A class for computing three way diffs.

@ -747,8 +747,6 @@ class IndexManager
array('id' => 'password', 'icon' => 'lock')
);
global $_configuration;
// Captcha
$captcha = api_get_setting('allow_captcha');
$allowCaptcha = $captcha == 'true';
@ -774,7 +772,7 @@ class IndexManager
//$options = array('callback' => 'qfcaptcha_image.php');
$captcha_question = $form->addElement('CAPTCHA_Image', 'captcha_question', '', $options);
$form->addElement('static', null, null, get_lang('ClickOnTheImageForANewOne'));
$form->addHtml(get_lang('ClickOnTheImageForANewOne'));
$form->addElement('text', 'captcha', get_lang('EnterTheLettersYouSee'));
$form->addRule('captcha', get_lang('EnterTheCharactersYouReadInTheImage'), 'required', null, 'client');

Loading…
Cancel
Save