Minor - updating license

1.10.x
Julio Montoya 12 years ago
parent 7d39d2f142
commit 4f70dfd186
  1. 23
      main/inc/lib/formvalidator/Element/calendar_popup.php
  2. 5
      main/inc/lib/formvalidator/Element/datepickerdate.php
  3. 19
      main/inc/lib/formvalidator/Element/html_editor.php
  4. 27
      main/inc/lib/formvalidator/Element/receivers.php
  5. 7
      main/inc/lib/formvalidator/Element/style_button.php
  6. 28
      main/inc/lib/formvalidator/Element/style_submit_button.php
  7. 1
      main/inc/lib/formvalidator/FormValidator.class.php
  8. 13
      main/inc/lib/formvalidator/Rule/CompareDateTimeText.php
  9. 9
      main/inc/lib/formvalidator/Rule/CompareFields.php
  10. 23
      main/inc/lib/formvalidator/Rule/Date.php
  11. 26
      main/inc/lib/formvalidator/Rule/DateCompare.php
  12. 23
      main/inc/lib/formvalidator/Rule/Filetype.php
  13. 14
      main/inc/lib/formvalidator/Rule/MultipleRequired.php
  14. 3
      main/inc/lib/formvalidator/Rule/Url.php
  15. 24
      main/inc/lib/formvalidator/Rule/Username.php
  16. 26
      main/inc/lib/formvalidator/Rule/UsernameAvailable.php

@ -1,26 +1,5 @@
<?php <?php
// $Id: calendar_popup.php 20456 2009-05-10 17:27:44Z ivantcholakov $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
$language_file = 'agenda'; $language_file = 'agenda';
require_once dirname(__FILE__).'/../../../global.inc.php'; require_once dirname(__FILE__).'/../../../global.inc.php';

@ -1,6 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
require_once ('HTML/QuickForm/date.php'); require_once 'HTML/QuickForm/date.php';
/** /**
* Form element to select a date and hour (with popup datepicker) * Form element to select a date and hour (with popup datepicker)
*/ */
@ -9,7 +9,8 @@ class HTML_QuickForm_datepickerdate extends HTML_QuickForm_date
/** /**
* Constructor * Constructor
*/ */
function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null) { function HTML_QuickForm_datepickerdate($elementName = null, $elementLabel = null, $attributes = null)
{
global $myMinYear, $myMaxYear; global $myMinYear, $myMaxYear;
$js_form_name = $attributes['form_name']; $js_form_name = $attributes['form_name'];
unset($attributes['form_name']); unset($attributes['form_name']);

@ -20,11 +20,17 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
*/ */
public $richEditorStatus = true; public $richEditorStatus = true;
/**
* @return bool
*/
public function getRichEditorStatus() public function getRichEditorStatus()
{ {
return $this->richEditorStatus; return $this->richEditorStatus;
} }
/**
* @param $status
*/
public function setRichEditorStatus($status) public function setRichEditorStatus($status)
{ {
$this->richEditorStatus = (bool)$status; $this->richEditorStatus = (bool)$status;
@ -37,7 +43,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
* @param string Attributes for the textarea * @param string Attributes for the textarea
* @param array $editor_config Optional configuration settings for the online editor. * @param array $editor_config Optional configuration settings for the online editor.
*/ */
function HTML_QuickForm_html_editor($elementName = null, $elementLabel = null, $attributes = null, $config = null) public function HTML_QuickForm_html_editor($elementName = null, $elementLabel = null, $attributes = null, $config = null)
{ {
if (empty($elementName)) { if (empty($elementName)) {
return false; return false;
@ -50,11 +56,9 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
$this->_persistantFreeze = true; $this->_persistantFreeze = true;
$this->_type = 'html_editor'; $this->_type = 'html_editor';
$this->fullPage = false; $this->fullPage = false;
$name = $this->getAttribute('name'); $name = $this->getAttribute('name');
global $app; global $app;
//$this->fck_editor = new FCKeditor($name);
$this->fck_editor = new ChamiloLMS\Component\Editor\Editor($name, $app['translator']); $this->fck_editor = new ChamiloLMS\Component\Editor\Editor($name, $app['translator']);
$this->fck_editor->ToolbarSet = $fck_attribute['ToolbarSet']; $this->fck_editor->ToolbarSet = $fck_attribute['ToolbarSet'];
@ -89,7 +93,8 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
* @access public * @access public
* @return boolean * @return boolean
*/ */
function browserSupported() { function browserSupported()
{
return FCKeditor :: IsCompatible(); return FCKeditor :: IsCompatible();
} }
@ -97,7 +102,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
* Return the HTML editor in HTML * Return the HTML editor in HTML
* @return string * @return string
*/ */
function toHtml() public function toHtml()
{ {
if ($this->getRichEditorStatus() == false) { if ($this->getRichEditorStatus() == false) {
//Fix rows and cols //Fix rows and cols
@ -125,7 +130,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
* Returns the htmlarea content in HTML * Returns the htmlarea content in HTML
* @return string * @return string
*/ */
function getFrozenHtml() public function getFrozenHtml()
{ {
return $this->getValue(); return $this->getValue();
} }
@ -133,7 +138,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
/** /**
* Build this element using FCKeditor * Build this element using FCKeditor
*/ */
function build_FCKeditor() public function build_FCKeditor()
{ {
if (!FCKeditor :: IsCompatible()) { if (!FCKeditor :: IsCompatible()) {
return parent::toHTML(); return parent::toHTML();

@ -1,26 +1,6 @@
<?php <?php
// $Id: receivers.php 7727 2006-02-09 13:37:04Z turboke $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
require_once 'HTML/QuickForm/group.php'; require_once 'HTML/QuickForm/group.php';
require_once 'HTML/QuickForm/radio.php'; require_once 'HTML/QuickForm/radio.php';
require_once 'HTML/QuickForm/advmultiselect.php'; require_once 'HTML/QuickForm/advmultiselect.php';
@ -59,6 +39,7 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
$this->_appendName = true; $this->_appendName = true;
$this->_type = 'receivers'; $this->_type = 'receivers';
} }
/** /**
* Create the form elements to build this element group * Create the form elements to build this element group
*/ */
@ -70,6 +51,7 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
$this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers); $this->_elements[] = new HTML_QuickForm_advmultiselect('to', '', $this->receivers);
$this->_elements[2]->setSelected($this->receivers_selected); $this->_elements[2]->setSelected($this->receivers_selected);
} }
/** /**
* HTML representation * HTML representation
*/ */
@ -85,6 +67,7 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
$js = $this->getElementJS(); $js = $this->getElementJS();
return $renderer->toHtml().$js; return $renderer->toHtml().$js;
} }
/** /**
* Get the necessary javascript * Get the necessary javascript
*/ */
@ -105,6 +88,7 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
</script>\n"; </script>\n";
return $js; return $js;
} }
/** /**
* accept renderer * accept renderer
*/ */
@ -113,4 +97,3 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
$renderer->renderElement($this, $required, $error); $renderer->renderElement($this, $required, $error);
} }
} }
?>

@ -1,4 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */
/** /**
* Base class for <input /> form elements * Base class for <input /> form elements
* *
@ -59,8 +61,9 @@ class HTML_QuickForm_stylebutton extends HTML_QuickForm_element
$strAttr = ''; $strAttr = '';
if (is_array($attributes)) { if (is_array($attributes)) {
foreach ($attributes as $key => $value) { foreach ($attributes as $key => $value) {
if ($key != 'value') if ($key != 'value') {
$strAttr .= ' ' . $key . '="' . htmlspecialchars($value) . '"'; $strAttr .= ' ' . $key . '="' . htmlspecialchars($value) . '"';
}
} }
} }
return $strAttr; return $strAttr;
@ -199,4 +202,4 @@ class HTML_QuickForm_stylebutton extends HTML_QuickForm_element
return parent::exportValue($submitValues, $assoc); return parent::exportValue($submitValues, $assoc);
} }
} }
} }

@ -1,10 +1,7 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/** /**
* HTML class for a submit type element * HTML class for a submit type element
* *
* PHP versions 4 and 5
* *
* LICENSE: This source file is subject to version 3.01 of the PHP license * 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: * that is available through the world-wide-web at the following URI:
@ -39,8 +36,6 @@ require_once 'style_button.php';
*/ */
class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
{ {
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -51,20 +46,21 @@ class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
* @access public * @access public
* @return void * @return void
*/ */
function HTML_QuickForm_stylesubmitbutton($elementName = null, $value = null, $attributes = null, $img = null) { public function HTML_QuickForm_stylesubmitbutton($elementName = null, $value = null, $attributes = null, $img = null)
{
if (empty($attributes)) { if (empty($attributes)) {
$attributes = array(); $attributes = array();
} }
if (!isset($attributes['class'])) { if (!isset($attributes['class'])) {
if (is_array($attributes)) { if (is_array($attributes)) {
$attributes['class'] = 'btn btn-primary'; $attributes['class'] = 'btn btn-primary';
} }
} }
HTML_QuickForm_stylebutton::HTML_QuickForm_stylebutton($elementName, null, $attributes, $value, $img); HTML_QuickForm_stylebutton::HTML_QuickForm_stylebutton($elementName, null, $attributes, $value, $img);
$this->setValue($value); $this->setValue($value);
$this->setType('submit'); $this->setType('submit');
} //end constructor }
/** /**
* Freeze the element so that only its value is returned * Freeze the element so that only its value is returned
@ -72,19 +68,17 @@ class HTML_QuickForm_stylesubmitbutton extends HTML_QuickForm_stylebutton
* @access public * @access public
* @return void * @return void
*/ */
function freeze() { public function freeze()
{
return false; return false;
} //end func freeze }
// }}}
// {{{ exportValue()
/** /**
* Only return the value if it is found within $submitValues (i.e. if * Only return the value if it is found within $submitValues (i.e. if
* this particular submit button was clicked) * this particular submit button was clicked)
*/ */
function exportValue(&$submitValues, $assoc = false) { public function exportValue(&$submitValues, $assoc = false)
{
return $this->_prepareValue($this->_findValue($submitValues), $assoc); return $this->_prepareValue($this->_findValue($submitValues), $assoc);
} }
// }}} }
} //end class HTML_QuickForm_submit

@ -1,5 +1,4 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
require_once 'HTML/QuickForm/Rule/Compare.php'; require_once 'HTML/QuickForm/Rule/Compare.php';
/** /**
@ -7,21 +8,21 @@ require_once 'HTML/QuickForm/Rule/Compare.php';
class HTML_QuickForm_Rule_CompareDateTimeText extends HTML_QuickForm_Rule_Compare class HTML_QuickForm_Rule_CompareDateTimeText extends HTML_QuickForm_Rule_Compare
{ {
/** /**
* Validate 2 dates * Validate 2 dates
* @param string $operator The operator to use (default '==') * @param string $operator The operator to use (default '==')
* @return boolean True if the 2 given dates match the operator * @return boolean True if the 2 given dates match the operator
*/ */
function validate($values, $operator = null) { function validate($values, $operator = null) {
$datetime1 = api_strtotime($values[0]); $datetime1 = api_strtotime($values[0]);
$datetime2 = api_strtotime($values[1]); $datetime2 = api_strtotime($values[1]);
if (strpos($operator, 'allow_empty') !== false) { if (strpos($operator, 'allow_empty') !== false) {
$operator = str_replace('allow_empty', '', $operator); $operator = str_replace('allow_empty', '', $operator);
if (!$datetime2 || empty($datetime2)) { if (!$datetime2 || empty($datetime2)) {
return true; return true;
} }
} }
$result = parent::validate(array($datetime1, $datetime2), $operator); $result = parent::validate(array($datetime1, $datetime2), $operator);
return $result; return $result;
} }
} }

@ -1,12 +1,13 @@
<?php <?php
/* For licensing terms, see /license.txt */
require_once 'HTML/QuickForm/Rule.php'; require_once 'HTML/QuickForm/Rule.php';
/** /**
* QuickForm rule to check a date * QuickForm rule to check a date
*/ */
class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare
{ {
/** /**
* Function to check an array of fields * Function to check an array of fields
* @param array of field names * @param array of field names
* @param string operator ==, >=, etc * @param string operator ==, >=, etc
* @param string the value to compare * @param string the value to compare
@ -20,9 +21,9 @@ class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare
} }
$params = explode('@', $operator_and_max_value); $params = explode('@', $operator_and_max_value);
$operator = $params[0]; $operator = $params[0];
$max_value = $params[1]; $max_value = $params[1];
return parent::validate(array($final_value, $max_value), $operator); return parent::validate(array($final_value, $max_value), $operator);
} }
return false; return false;
} }
} }

@ -1,26 +1,5 @@
<?php <?php
// $Id: Date.php 6187 2005-09-07 10:23:57Z bmol $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
require_once ('HTML/QuickForm/Rule.php'); require_once ('HTML/QuickForm/Rule.php');
/** /**
* QuickForm rule to check a date * QuickForm rule to check a date

@ -1,26 +1,5 @@
<?php <?php
// $Id: DateCompare.php 6187 2005-09-07 10:23:57Z bmol $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
require_once 'HTML/QuickForm/Rule/Compare.php'; require_once 'HTML/QuickForm/Rule/Compare.php';
/** /**
* QuickForm rule to compare 2 dates * QuickForm rule to compare 2 dates
@ -42,5 +21,4 @@ class HTML_QuickForm_Rule_DateCompare extends HTML_QuickForm_Rule_Compare
$time2 = mktime($date2['H'],$date2['i'],0,$date2['F'],$date2['d'],$date2['Y']); $time2 = mktime($date2['H'],$date2['i'],0,$date2['F'],$date2['d'],$date2['Y']);
return parent::validate(array($time1,$time2),$operator); return parent::validate(array($time1,$time2),$operator);
} }
} }
?>

@ -1,26 +1,6 @@
<?php <?php
// $Id: Filetype.php 20456 2009-05-10 17:27:44Z ivantcholakov $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
require_once ('HTML/QuickForm/Rule.php'); require_once ('HTML/QuickForm/Rule.php');
/** /**
* QuickForm rule to check if a filetype * QuickForm rule to check if a filetype
@ -45,4 +25,3 @@ class HTML_QuickForm_Rule_Filetype extends HTML_QuickForm_Rule
return api_in_array_nocase($ext, $extensions); return api_in_array_nocase($ext, $extensions);
} }
} }
?>

@ -1,15 +1,6 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+ /* For licensing terms, see /license.txt */
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | Copy of the existing rule "required" to check if at least one element|
// | has been filled. Then $value can be an array |
// +----------------------------------------------------------------------+
// | Authors: Eric Marguin <e.marguin@elixir-interactive.com> |
// +----------------------------------------------------------------------+
require_once('HTML/QuickForm/Rule.php'); require_once('HTML/QuickForm/Rule.php');
@ -46,4 +37,3 @@ class HTML_QuickForm_Rule_MultipleRequired extends HTML_QuickForm_Rule
} // end func getValidationScript } // end func getValidationScript
} // end class HTML_QuickForm_Rule_MultipleRequired } // end class HTML_QuickForm_Rule_MultipleRequired
?>

@ -1,4 +1,5 @@
<?php <?php
/* For licensing terms, see /license.txt */
/** /**
* Abstract base class for QuickForm validation rules * Abstract base class for QuickForm validation rules
@ -15,7 +16,7 @@ class HTML_QuickForm_Rule_Url extends HTML_QuickForm_Rule
/** /**
* Validates url * Validates url
* *
* @param string $url * @param string $url
* @return boolean Returns true if valid, false otherwise. * @return boolean Returns true if valid, false otherwise.
*/ */
function validate($url) function validate($url)

@ -1,25 +1,5 @@
<?php <?php
/* /* For licensing terms, see /license.txt */
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
require_once 'HTML/QuickForm/Rule.php'; require_once 'HTML/QuickForm/Rule.php';
@ -34,7 +14,7 @@ class HTML_QuickForm_Rule_Username extends HTML_QuickForm_Rule {
* @return boolean True if username is of the correct format * @return boolean True if username is of the correct format
* @author Modified by Ivan Tcholakov, 15-SEP-2009. The validation rule is served by the UserManager class as of this moment. * @author Modified by Ivan Tcholakov, 15-SEP-2009. The validation rule is served by the UserManager class as of this moment.
*/ */
function validate($username, $options) { function validate($username, $options) {
return UserManager::is_username_valid($username); return UserManager::is_username_valid($username);
} }
} }

@ -1,26 +1,6 @@
<?php <?php
// $Id: UsernameAvailable.php 10190 2006-11-24 00:23:20Z pcool $ /* For licensing terms, see /license.txt */
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2005 Dokeos S.A.
Copyright (c) Bart Mollet, Hogeschool Gent
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
require_once 'HTML/QuickForm/Rule.php'; require_once 'HTML/QuickForm/Rule.php';
/** /**
* QuickForm rule to check if a username is available * QuickForm rule to check if a username is available
@ -36,9 +16,9 @@ class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule
*/ */
function validate($username, $current_username = null) { function validate($username, $current_username = null) {
$user_table = Database::get_main_table(TABLE_MAIN_USER); $user_table = Database::get_main_table(TABLE_MAIN_USER);
$username = Database::escape_string($username); $username = Database::escape_string($username);
$current_username = Database::escape_string($current_username); $current_username = Database::escape_string($current_username);
$sql = "SELECT * FROM $user_table WHERE username = '$username'"; $sql = "SELECT * FROM $user_table WHERE username = '$username'";
if (!is_null($current_username)) { if (!is_null($current_username)) {
$sql .= " AND username != '$current_username'"; $sql .= " AND username != '$current_username'";

Loading…
Cancel
Save