diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index 2d245bf8de..0c3f4901d7 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -58,22 +58,6 @@ class FormValidator extends HTML_QuickForm parent::__construct($name, $method, $action, $target, $attributes, $trackSubmit); - // Load some custom elements and rules - $dir = api_get_path(LIBRARY_PATH) . 'formvalidator/'; - - $this->registerRule('date', null, 'HTML_QuickForm_Rule_Date', $dir . 'Rule/Date.php'); - $this->registerRule('datetime', null, 'DateTimeRule', $dir . 'Rule/DateTimeRule.php'); - $this->registerRule('date_compare', null, 'HTML_QuickForm_Rule_DateCompare', $dir . 'Rule/DateCompare.php'); - $this->registerRule('html', null, 'HTML_QuickForm_Rule_HTML', $dir . 'Rule/HTML.php'); - $this->registerRule('username_available', null, 'HTML_QuickForm_Rule_UsernameAvailable', $dir . 'Rule/UsernameAvailable.php'); - $this->registerRule('username', null, 'HTML_QuickForm_Rule_Username', $dir . 'Rule/Username.php'); - $this->registerRule('filetype', null, 'HTML_QuickForm_Rule_Filetype', $dir . 'Rule/Filetype.php'); - $this->registerRule('multiple_required', 'required', 'HTML_QuickForm_Rule_MultipleRequired', $dir . 'Rule/MultipleRequired.php'); - $this->registerRule('url', null, 'HTML_QuickForm_Rule_Url', $dir . 'Rule/Url.php'); - $this->registerRule('mobile_phone_number', null, 'HTML_QuickForm_Rule_Mobile_Phone_Number', $dir . 'Rule/MobilePhoneNumber.php'); - $this->registerRule('compare_fields', null, 'HTML_QuickForm_Compare_Fields', $dir . 'Rule/CompareFields.php'); - $this->registerRule('CAPTCHA', 'rule', 'HTML_QuickForm_Rule_CAPTCHA', 'HTML/QuickForm/Rule/CAPTCHA.php'); - // Modify the default templates $renderer = & $this->defaultRenderer(); diff --git a/main/inc/lib/pear/HTML/QuickForm.php b/main/inc/lib/pear/HTML/QuickForm.php index 2fecedfd85..55aa61e460 100755 --- a/main/inc/lib/pear/HTML/QuickForm.php +++ b/main/inc/lib/pear/HTML/QuickForm.php @@ -30,27 +30,7 @@ * HTML_QuickForm::isRuleRegistered() * @global array $GLOBALS['_HTML_QuickForm_registered_rules'] */ -$GLOBALS['_HTML_QuickForm_registered_rules'] = array( - 'required' => array('html_quickform_rule_required', 'HTML/QuickForm/Rule/Required.php'), - 'maxlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'), - 'minlength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'), - 'rangelength' => array('html_quickform_rule_range', 'HTML/QuickForm/Rule/Range.php'), - 'email' => array('html_quickform_rule_email', 'HTML/QuickForm/Rule/Email.php'), - 'regex' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), - 'lettersonly' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), - 'alphanumeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), - 'numeric' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), - 'nopunctuation' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), - 'nonzero' => array('html_quickform_rule_regex', 'HTML/QuickForm/Rule/Regex.php'), - 'callback' => array('html_quickform_rule_callback', 'HTML/QuickForm/Rule/Callback.php'), - // Added by Chamilo team, 16-MAR-2010 - //'compare' => array('html_quickform_rule_compare', 'HTML/QuickForm/Rule/Compare.php') - 'compare' => array('html_quickform_rule_compare', 'HTML/QuickForm/Rule/Compare.php'), - 'comparedate' => array('html_quickform_rule_comparedate', 'HTML/QuickForm/Rule/CompareDate.php'), - 'errordate' => array('html_quickform_rule_date', 'HTML/QuickForm/Rule/Date.php'), - 'captcha' => array('HTML_QuickForm_Rule_CAPTCHA', 'HTML/QuickForm/Rule/CAPTCHA.php') - // -); + // {{{ error codes @@ -1415,13 +1395,13 @@ class HTML_QuickForm extends HTML_Common */ function isRuleRegistered($name, $autoRegister = false) { + return true; + var_dump($name); if (is_scalar($name) && isset($GLOBALS['_HTML_QuickForm_registered_rules'][$name])) { return true; } elseif (!$autoRegister) { return false; } - // automatically register the rule if requested - include_once 'HTML/QuickForm/RuleRegistry.php'; $ruleName = false; if (is_object($name) && is_a($name, 'html_quickform_rule')) { $ruleName = !empty($name->name)? $name->name: strtolower(get_class($name)); diff --git a/main/inc/lib/pear/HTML/QuickForm/Action/Display.php b/main/inc/lib/pear/HTML/QuickForm/Action/Display.php index cd05ec6529..6651d860cd 100755 --- a/main/inc/lib/pear/HTML/QuickForm/Action/Display.php +++ b/main/inc/lib/pear/HTML/QuickForm/Action/Display.php @@ -1,42 +1,37 @@ - * @copyright 2003-2009 The PHP Group - * @license http://www.php.net/license/3_01.txt PHP License 3.01 - * @version SVN: $Id: Display.php 289084 2009-10-02 06:53:09Z avb $ - * @link http://pear.php.net/package/HTML_QuickForm_Controller - */ - -/** - * Class representing an action to perform on HTTP request. - */ -require_once 'HTML/QuickForm/Action.php'; +/** + * This action handles output of the form. + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm_Controller + * @author Alexey Borzov + * @copyright 2003-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version SVN: $Id: Display.php 289084 2009-10-02 06:53:09Z avb $ + * @link http://pear.php.net/package/HTML_QuickForm_Controller + */ /** - * This action handles output of the form. + * This action handles output of the form. * * If you want to customize the form display, subclass this class and * override the _renderForm() method, you don't need to change the perform() * method itself. * - * @category HTML - * @package HTML_QuickForm_Controller - * @author Alexey Borzov - * @version Release: 1.0.10 + * @category HTML + * @package HTML_QuickForm_Controller + * @author Alexey Borzov + * @version Release: 1.0.10 */ class HTML_QuickForm_Action_Display extends HTML_QuickForm_Action { @@ -67,9 +62,9 @@ class HTML_QuickForm_Action_Display extends HTML_QuickForm_Action $page->isFormBuilt() or $page->buildForm(); // if we had errors we should show them again if (isset($validate) && $validate) { - if (PEAR::isError($err = $page->validate())) { - return $err; - } + if (PEAR::isError($err = $page->validate())) { + return $err; + } } // Modified by Chamilo team, 16-MAR-2010. //$this->_renderForm($page); @@ -84,8 +79,8 @@ class HTML_QuickForm_Action_Display extends HTML_QuickForm_Action * If you want to customize the form's appearance (you most certainly will), * then you should override this method. There is no need to override perform() * - * @access private - * @param HTML_QuickForm_Page the page being processed + * @access private + * @param HTML_QuickForm_Page the page being processed */ function _renderForm(&$page) { diff --git a/main/inc/lib/pear/HTML/QuickForm/Renderer/QuickHtml.php b/main/inc/lib/pear/HTML/QuickForm/Renderer/QuickHtml.php index 275f79b689..7107e89dcc 100755 --- a/main/inc/lib/pear/HTML/QuickForm/Renderer/QuickHtml.php +++ b/main/inc/lib/pear/HTML/QuickForm/Renderer/QuickHtml.php @@ -1,30 +1,25 @@ - * @copyright 2001-2009 The PHP Group - * @license http://www.php.net/license/3_01.txt PHP License 3.01 - * @version CVS: $Id: QuickHtml.php,v 1.3 2009/04/04 21:34:04 avb Exp $ - * @link http://pear.php.net/package/HTML_QuickForm - */ - -/** - * A concrete renderer for HTML_QuickForm, based on QuickForm 2.x built-in one - */ -require_once 'HTML/QuickForm/Renderer/Default.php'; +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * A renderer that makes it quick and easy to create customized forms. + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.01 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_01.txt If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category HTML + * @package HTML_QuickForm + * @author Jason Rust + * @copyright 2001-2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @version CVS: $Id: QuickHtml.php,v 1.3 2009/04/04 21:34:04 avb Exp $ + * @link http://pear.php.net/package/HTML_QuickForm + */ /** * A renderer that makes it quick and easy to create customized forms. @@ -35,11 +30,11 @@ require_once 'HTML/QuickForm/Renderer/Default.php'; * widget-based template systems. See the online docs for more info. * For a usage example see: docs/renderers/QuickHtml_example.php * - * @category HTML - * @package HTML_QuickForm - * @author Jason Rust - * @version Release: 3.2.11 - * @since 3.1.1 + * @category HTML + * @package HTML_QuickForm + * @author Jason Rust + * @version Release: 3.2.11 + * @since 3.1.1 */ class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default { // {{{ properties @@ -105,7 +100,7 @@ class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default * * @access public * @return string The html for the QuickForm element - * @throws HTML_QuickForm_Error + * @throws HTML_QuickForm_Error */ function elementToHtml($elementName, $elementValue = null) { @@ -144,9 +139,9 @@ class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default * Gets the html for an element and adds it to the array by calling * parent::renderElement() * - * @param HTML_QuickForm_element form element being visited - * @param bool Whether an element is required - * @param string An error message associated with an element + * @param HTML_QuickForm_element form element being visited + * @param bool Whether an element is required + * @param string An error message associated with an element * * @access public * @return mixed HTML string of element if $immediateRender is set, else we just add the @@ -172,7 +167,7 @@ class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default /** * Gets the html for a hidden element and adds it to the array. * - * @param HTML_QuickForm_element hidden form element being visited + * @param HTML_QuickForm_element hidden form element being visited * @access public * @return void */ @@ -192,7 +187,7 @@ class HTML_QuickForm_Renderer_QuickHtml extends HTML_QuickForm_Renderer_Default * Gets the html for the group element and adds it to the array by calling * parent::finishGroup() * - * @param HTML_QuickForm_group group being visited + * @param HTML_QuickForm_group group being visited * @access public * @return void */ diff --git a/main/inc/lib/pear/HTML/QuickForm/Rule/CompareDate.php b/main/inc/lib/pear/HTML/QuickForm/Rule/CompareDate.php index c3e7c72b77..d5f015f627 100755 --- a/main/inc/lib/pear/HTML/QuickForm/Rule/CompareDate.php +++ b/main/inc/lib/pear/HTML/QuickForm/Rule/CompareDate.php @@ -20,10 +20,7 @@ /** * @package chamilo.library */ -/** - * Code - */ -require_once 'HTML/QuickForm/Rule.php'; + /** * Rule to compare two form fields * diff --git a/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php b/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php index d9dc75e942..0a691654c6 100755 --- a/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php +++ b/main/inc/lib/pear/HTML/QuickForm/RuleRegistry.php @@ -119,20 +119,53 @@ class HTML_QuickForm_RuleRegistry */ function &getRule($ruleName) { - list($class, $path) = $GLOBALS['_HTML_QuickForm_registered_rules'][$ruleName]; + if (empty($ruleName)) { + return false; + } + + $rules = array( + 'required' => 'HTML_QuickForm_Rule_Required', + 'maxlength' => 'HTML_QuickForm_Rule_Range', + 'minlength' => 'HTML_QuickForm_Rule_Range', + 'rangelength' => 'HTML_QuickForm_Rule_Range', + 'email' => 'HTML_QuickForm_Rule_Email', + 'regex' => 'HTML_QuickForm_Rule_Regex', + 'lettersonly' => 'HTML_QuickForm_Rule_Regex', + 'alphanumeric' => 'HTML_QuickForm_Rule_Regex', + 'numeric' => 'HTML_QuickForm_Rule_Regex', + 'nopunctuation' => 'HTML_QuickForm_Rule_Regex', + 'nonzero' => 'HTML_QuickForm_Rule_Regex', + 'callback' => 'HTML_QuickForm_Rule_Callback', + 'compare' => 'HTML_QuickForm_Rule_Compare', + 'date_compare' => 'HTML_QuickForm_Rule_DateCompare', + 'comparedate' => 'HTML_QuickForm_Rule_CompareDate', + 'errordate' => 'Html_Quickform_Rule_Date', + 'captcha' => 'HTML_QuickForm_Rule_CAPTCHA', + 'filetype' => 'HTML_QuickForm_Rule_Filetype', + 'mobile_phone_number' => 'HTML_QuickForm_Rule_Mobile_Phone_Number', + 'url' => 'HTML_QuickForm_Rule_Url', + 'username' => 'HTML_QuickForm_Rule_Username', + 'multiple_required' => 'HTML_QuickForm_Rule_MultipleRequired', + 'datetime' => 'DateTimeRule', + 'username_available' => 'HTML_QuickForm_Rule_UsernameAvailable', + 'compare_fields' => 'HTML_QuickForm_Compare_Fields', + 'html' => 'HTML_QuickForm_Rule_HTML', + 'CAPTCHA' => 'HTML_QuickForm_Rule_CAPTCHA' + ); + + $class = $rules[$ruleName]; + + if (empty($class)) { + return false; + } if (!isset($this->_rules[$class])) { - if (!empty($path)) { - include_once($path); - } - // Modified by Ivan Tcholakov, 16-MAR-2010. Suppressing a deprecation warning on PHP 5.3 - //$this->_rules[$class] =& new $class(); $this->_rules[$class] = new $class(); - // } $this->_rules[$class]->setName($ruleName); + return $this->_rules[$class]; - } // end func getRule + } /** * Performs validation on the given values diff --git a/main/inc/lib/pear/HTML/Table.php b/main/inc/lib/pear/HTML/Table.php index a2c6343d72..ab05afaec7 100755 --- a/main/inc/lib/pear/HTML/Table.php +++ b/main/inc/lib/pear/HTML/Table.php @@ -59,14 +59,6 @@ * @link http://pear.php.net/package/HTML_Table */ - -/** -* Requires PEAR, HTML_Common and HTML_Table_Storage -*/ -require_once 'PEAR.php'; -require_once 'HTML/Common.php'; -require_once 'HTML/Table/Storage.php'; - /** * PEAR::HTML_Table makes the design of HTML tables easy, flexible, reusable and efficient. * diff --git a/main/inc/lib/pear/OLE/ChainedBlockStream.php b/main/inc/lib/pear/OLE/ChainedBlockStream.php index edde82996c..9c53873edf 100755 --- a/main/inc/lib/pear/OLE/ChainedBlockStream.php +++ b/main/inc/lib/pear/OLE/ChainedBlockStream.php @@ -22,9 +22,6 @@ * @since File available since Release 0.6.0 */ -require_once 'PEAR.php'; -require_once 'OLE.php'; - /** * Stream wrapper for reading data stored in an OLE file. Implements methods * for PHP's stream_wrapper_register(). For creating streams using this diff --git a/main/inc/lib/pear/OLE/OLE.php b/main/inc/lib/pear/OLE/OLE.php index c3df684da6..9314b752c8 100755 --- a/main/inc/lib/pear/OLE/OLE.php +++ b/main/inc/lib/pear/OLE/OLE.php @@ -30,8 +30,6 @@ define('OLE_DATA_SIZE_SMALL', 0x1000); define('OLE_LONG_INT_SIZE', 4); define('OLE_PPS_SIZE', 0x80); -require_once 'PEAR.php'; - /** * Array for storing OLE instances that are accessed from * OLE_ChainedBlockStream::stream_open(). diff --git a/main/inc/lib/pear/OLE/PPS/File.php b/main/inc/lib/pear/OLE/PPS/File.php index 1e6573580c..497f82be21 100755 --- a/main/inc/lib/pear/OLE/PPS/File.php +++ b/main/inc/lib/pear/OLE/PPS/File.php @@ -20,8 +20,6 @@ // $Id: File.php,v 1.11 2007/02/13 21:00:42 schmidt Exp $ -require_once api_get_path(LIBRARY_PATH).'pear/OLE/PPS.php'; - /** * Class for creating File PPS's for OLE containers * diff --git a/main/inc/lib/pear/Pager/Pager_savebc.php b/main/inc/lib/pear/Pager/Pager_savebc.php deleted file mode 100755 index 6e7f9e1d5b..0000000000 --- a/main/inc/lib/pear/Pager/Pager_savebc.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @author Richard Heyes - * @copyright 2003-2007 Lorenzo Alberton, Richard Heyes - * @license http://www.debian.org/misc/bsd.license BSD License (3 Clause) - * @version CVS: $Id: Pager_savebc.php,v 1.3 2007/10/28 22:37:01 quipo Exp $ - * @link http://pear.php.net/package/Pager - */ -/** - * Code - */ -require_once 'Pager.php'; diff --git a/main/inc/lib/pear/Pager/Sliding.php b/main/inc/lib/pear/Pager/Sliding.php index 0594590653..9dbbdbe101 100755 --- a/main/inc/lib/pear/Pager/Sliding.php +++ b/main/inc/lib/pear/Pager/Sliding.php @@ -36,11 +36,6 @@ * @link http://pear.php.net/package/Pager */ -/** - * require PEAR::Pager_Common base class - */ -require_once 'Pager/Common.php'; - /** * Pager_Sliding - Generic data paging class ("sliding window" style) * Usage examples can be found in the PEAR manual @@ -298,4 +293,4 @@ class Pager_Sliding extends Pager_Common // }}} } -?> \ No newline at end of file +?> diff --git a/main/inc/lib/pear/excelreader/reader.php b/main/inc/lib/pear/excelreader/reader.php index 5b2cdd4ad0..79465570db 100755 --- a/main/inc/lib/pear/excelreader/reader.php +++ b/main/inc/lib/pear/excelreader/reader.php @@ -24,12 +24,6 @@ * @link http://pear.php.net/package/Spreadsheet_Excel_Reader * @see OLE, Spreadsheet_Excel_Writer */ -/** - * Code - */ -//require_once 'PEAR.php'; -require_once 'OLERead.inc'; -//require_once 'OLE.php'; define('SPREADSHEET_EXCEL_READER_BIFF8', 0x600); define('SPREADSHEET_EXCEL_READER_BIFF7', 0x500); @@ -112,7 +106,7 @@ class Spreadsheet_Excel_Reader /** * Array of format records found - * + * * @var array * @access public */ @@ -256,7 +250,7 @@ class Spreadsheet_Excel_Reader * Constructor * * Some basic initialisation - */ + */ function Spreadsheet_Excel_Reader() { $this->_ole =& new OLERead(); @@ -466,7 +460,7 @@ class Spreadsheet_Excel_Reader $length = ord($this->data[$pos+2]) | ord($this->data[$pos+3])<<8; while ($code != SPREADSHEET_EXCEL_READER_TYPE_EOF) { - switch ($code) { + switch ($code) { case SPREADSHEET_EXCEL_READER_TYPE_SST: //echo "Type_SST\n"; $spos = $pos + 4; @@ -564,7 +558,7 @@ class Spreadsheet_Excel_Reader } } //We check the string before send it check the _encodeUTF16 - //$retstr = ($asciiEncoding) ? $retstr : $this->_encodeUTF16($retstr); + //$retstr = ($asciiEncoding) ? $retstr : $this->_encodeUTF16($retstr); $retstr = ($asciiEncoding) ? $this->_encodeUTF16($retstr, true) : $this->_encodeUTF16($retstr); // echo "Str $i = $retstr\n"; if ($richString){ @@ -963,13 +957,13 @@ class Spreadsheet_Excel_Reader /** * Convert the raw Excel date into a human readable format * - * Dates in Excel are stored as number of seconds from an epoch. On + * Dates in Excel are stored as number of seconds from an epoch. On * Windows, the epoch is 30/12/1899 and on Mac it's 01/01/1904 * * @access private * @param integer The raw Excel value to convert * @return array First element is the converted date, the second element is number a unix timestamp - */ + */ function createDate($numValue) { if ($numValue > 1) { @@ -1053,16 +1047,16 @@ class Spreadsheet_Excel_Reader } return $value; } - - /* - * Function modified by jmontoya in order to fix a problem with encoding in excels + + /* + * Function modified by jmontoya in order to fix a problem with encoding in excels * */ function _encodeUTF16($string, $check = false) { - //var_dump($this->_defaultEncoding.' '.$this->_encoderFunction.' '.$from); + //var_dump($this->_defaultEncoding.' '.$this->_encoderFunction.' '.$from); if ($check) { $from = api_detect_encoding($string); $string = api_convert_encoding($string, $this->_defaultEncoding, $from); - return $string; + return $string; } $string = api_convert_encoding($string, $this->_defaultEncoding, 'UTF-16LE'); return $string; @@ -1089,14 +1083,14 @@ class Spreadsheet_Excel_Reader } return $value; } - + function _GetInt2d($data, $pos) { return ord($data[$pos]) | (ord($data[$pos + 1]) << 8); } - - + + }