diff --git a/main/inc/lib/pear/HTML/QuickForm/CAPTCHA/Image.php b/main/inc/lib/pear/HTML/QuickForm/CAPTCHA/Image.php index e3b3401f63..b6cb1ead99 100755 --- a/main/inc/lib/pear/HTML/QuickForm/CAPTCHA/Image.php +++ b/main/inc/lib/pear/HTML/QuickForm/CAPTCHA/Image.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 ' +
+ + {element} +
'; + break; + case FormValidator::LAYOUT_HORIZONTAL: + return ' +
+ +
+ {icon} + {element} + + +

{label_2}

+ + + + {error} + +
+
+ + {label_3} + +
+
'; + break; + case FormValidator::LAYOUT_BOX_NO_LABEL: + return ' +
+ {icon} + {element} +
'; + break; + } + } + /** * Returns the HTML for the CAPTCHA image * * @return string * @access public */ - function toHtml() + public function toHtml() { + if ($this->_flagFrozen) { return ''; } diff --git a/main/inc/lib/pear/HTML/QuickForm/text.php b/main/inc/lib/pear/HTML/QuickForm/text.php index e47261b827..ffc26925a8 100755 --- a/main/inc/lib/pear/HTML/QuickForm/text.php +++ b/main/inc/lib/pear/HTML/QuickForm/text.php @@ -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); } /** diff --git a/main/inc/lib/pear/Text/CAPTCHA.php b/main/inc/lib/pear/Text/CAPTCHA.php index 3160c6929d..00778dc9c3 100755 --- a/main/inc/lib/pear/Text/CAPTCHA.php +++ b/main/inc/lib/pear/Text/CAPTCHA.php @@ -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; diff --git a/main/inc/lib/pear/Text/CAPTCHA/Driver/Base.php b/main/inc/lib/pear/Text/CAPTCHA/Driver/Base.php index 344356d241..3b9da4508c 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Driver/Base.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Driver/Base.php @@ -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. * @@ -94,4 +94,4 @@ abstract class Text_CAPTCHA_Driver_Base implements Text_CAPTCHA_Driver $this->setPhrase(null); $this->setCaptcha(null); } -} \ No newline at end of file +} diff --git a/main/inc/lib/pear/Text/CAPTCHA/Driver/Equation.php b/main/inc/lib/pear/Text/CAPTCHA/Driver/Equation.php index e965e443eb..efe1756020 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Driver/Equation.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Driver/Equation.php @@ -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" diff --git a/main/inc/lib/pear/Text/CAPTCHA/Driver/Figlet.php b/main/inc/lib/pear/Text/CAPTCHA/Driver/Figlet.php index 081aa1a271..1efb198990 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Driver/Figlet.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Driver/Figlet.php @@ -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 * diff --git a/main/inc/lib/pear/Text/CAPTCHA/Driver/Image.php b/main/inc/lib/pear/Text/CAPTCHA/Driver/Image.php index c2525d308c..e1a67d16b8 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Driver/Image.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Driver/Image.php @@ -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 diff --git a/main/inc/lib/pear/Text/CAPTCHA/Driver/Numeral.php b/main/inc/lib/pear/Text/CAPTCHA/Driver/Numeral.php index 46b9748f06..a543bbd955 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Driver/Numeral.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Driver/Numeral.php @@ -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 * diff --git a/main/inc/lib/pear/Text/CAPTCHA/Driver/Word.php b/main/inc/lib/pear/Text/CAPTCHA/Driver/Word.php index b7bdce7661..d8f04d0b0c 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Driver/Word.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Driver/Word.php @@ -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. * @@ -124,4 +123,4 @@ class Text_CAPTCHA_Driver_Word extends Text_CAPTCHA_Driver_Base } $this->setCaptcha($res); } -} \ No newline at end of file +} diff --git a/main/inc/lib/pear/Text/CAPTCHA/Exception.php b/main/inc/lib/pear/Text/CAPTCHA/Exception.php index bec12a592f..8ef66dd73a 100755 --- a/main/inc/lib/pear/Text/CAPTCHA/Exception.php +++ b/main/inc/lib/pear/Text/CAPTCHA/Exception.php @@ -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 * @@ -26,4 +24,4 @@ require_once $lib_path.'/pear/Exception.php'; class Text_CAPTCHA_Exception extends PEAR_Exception { -} \ No newline at end of file +} diff --git a/main/inc/lib/pear/Text/Diff.php b/main/inc/lib/pear/Text/Diff.php index 6cb50355be..e6dcc0997b 100755 --- a/main/inc/lib/pear/Text/Diff.php +++ b/main/inc/lib/pear/Text/Diff.php @@ -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(); diff --git a/main/inc/lib/pear/Text/Diff/Renderer/context.php b/main/inc/lib/pear/Text/Diff/Renderer/context.php index af538015f8..0b2ab2d87f 100755 --- a/main/inc/lib/pear/Text/Diff/Renderer/context.php +++ b/main/inc/lib/pear/Text/Diff/Renderer/context.php @@ -14,8 +14,6 @@ * @package Text_Diff */ -/** Text_Diff_Renderer */ -require_once 'Text/Diff/Renderer.php'; /** * @package Text_Diff diff --git a/main/inc/lib/pear/Text/Diff/Renderer/inline.php b/main/inc/lib/pear/Text/Diff/Renderer/inline.php index 5dd20d2f3b..27665b600b 100755 --- a/main/inc/lib/pear/Text/Diff/Renderer/inline.php +++ b/main/inc/lib/pear/Text/Diff/Renderer/inline.php @@ -13,9 +13,6 @@ * @package Text_Diff */ -/** Text_Diff_Renderer */ -require_once 'Text/Diff/Renderer.php'; - /** * "Inline" diff renderer. * diff --git a/main/inc/lib/pear/Text/Diff/Renderer/unified.php b/main/inc/lib/pear/Text/Diff/Renderer/unified.php index f990f72951..7ea4aeedd0 100755 --- a/main/inc/lib/pear/Text/Diff/Renderer/unified.php +++ b/main/inc/lib/pear/Text/Diff/Renderer/unified.php @@ -15,8 +15,6 @@ * @package Text_Diff */ -/** Text_Diff_Renderer */ -require_once 'Text/Diff/Renderer.php'; /** * @package Text_Diff diff --git a/main/inc/lib/pear/Text/Diff/ThreeWay.php b/main/inc/lib/pear/Text/Diff/ThreeWay.php index 5b0357c6c2..c080813b1d 100755 --- a/main/inc/lib/pear/Text/Diff/ThreeWay.php +++ b/main/inc/lib/pear/Text/Diff/ThreeWay.php @@ -14,7 +14,6 @@ */ /** Text_Diff */ -require_once 'Text/Diff.php'; /** * A class for computing three way diffs. diff --git a/main/inc/lib/pear/Text/Diff3.php b/main/inc/lib/pear/Text/Diff3.php index e9aea9f887..2846304ff6 100755 --- a/main/inc/lib/pear/Text/Diff3.php +++ b/main/inc/lib/pear/Text/Diff3.php @@ -14,7 +14,6 @@ */ /** Text_Diff */ -require_once 'Text/Diff.php'; /** * A class for computing three way diffs. diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index e96e37ab83..19176a1f5a 100755 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -747,8 +747,6 @@ class IndexManager array('id' => 'password', 'icon' => 'lock') ); - global $_configuration; - // Captcha $captcha = api_get_setting('allow_captcha'); $allowCaptcha = $captcha == 'true'; @@ -758,8 +756,8 @@ class IndexManager if ($useCaptcha) { $ajax = api_get_path(WEB_AJAX_PATH).'form.ajax.php?a=get_captcha'; $options = array( - 'width' => 250, - 'height' => 90, + 'width' => 250, + 'height' => 90, 'callback' => $ajax.'&var='.basename(__FILE__, '.php'), 'sessionVar' => basename(__FILE__, '.php'), 'imageOptions' => array( @@ -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');