diff --git a/main/inc/lib/agenda.lib.php b/main/inc/lib/agenda.lib.php index ce383db97a..4267d719a7 100644 --- a/main/inc/lib/agenda.lib.php +++ b/main/inc/lib/agenda.lib.php @@ -2337,10 +2337,9 @@ class Agenda $action = isset($params['action']) ? Security::remove_XSS($params['action']) : null; $id = isset($params['id']) ? (int) $params['id'] : 0; + $url = api_get_self().'?action='.$action.'&id='.$id.'&type='.$this->type; if ($this->type == 'course') { $url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&id='.$id.'&type='.$this->type; - } else { - $url = api_get_self().'?action='.$action.'&id='.$id.'&type='.$this->type; } $form = new FormValidator( diff --git a/main/inc/lib/attendance.lib.php b/main/inc/lib/attendance.lib.php index 719e9d8143..503f51e492 100755 --- a/main/inc/lib/attendance.lib.php +++ b/main/inc/lib/attendance.lib.php @@ -117,9 +117,9 @@ class Attendance $course_id = api_get_course_int_id(); $session_id = api_get_session_id(); $condition_session = api_get_session_condition($session_id); - $column = intval($column); - $from = intval($from); - $number_of_items = intval($number_of_items); + $column = (int) $column; + $from = (int) $from; + $number_of_items = (int) $number_of_items; if (!in_array($direction, ['ASC', 'DESC'])) { $direction = 'ASC'; @@ -163,6 +163,7 @@ class Attendance if (api_get_session_id() == $attendance[6]) { $session_star = api_get_session_image(api_get_session_id(), $user_info['status']); } + if ($attendance[5] == 1) { $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( api_get_user_id(), diff --git a/main/inc/lib/pear/HTML/Common.php b/main/inc/lib/pear/HTML/Common.php index 21cb6f1840..60b16c4cc9 100755 --- a/main/inc/lib/pear/HTML/Common.php +++ b/main/inc/lib/pear/HTML/Common.php @@ -126,7 +126,7 @@ class HTML_Common function _getTabs() { return str_repeat($this->_getTab(), $this->_tabOffset); - } // end func _getTabs + } /** * Returns an HTML formatted attribute string @@ -146,6 +146,7 @@ class HTML_Common $strAttr .= ' ' . $key . '= "' . $value. '"'; } } + return $strAttr; } @@ -155,7 +156,7 @@ class HTML_Common * @access private * @return array */ - function _parseAttributes($attributes) + public function _parseAttributes($attributes) { if (is_array($attributes)) { $ret = array(); @@ -457,17 +458,6 @@ class HTML_Common */ function charset($newCharset = null) { - // Modified by Ivan Tcholakov, 16-MAR-2010 - //static $charset = 'ISO-8859-1'; - static $charset; - if (!isset($charset)) { - $charset = api_get_system_encoding(); - } - // - - if (!is_null($newCharset)) { - $charset = $newCharset; - } - return $charset; - } // end func charset + return 'UTF-8'; + } } diff --git a/main/inc/lib/pear/HTML/QuickForm.php b/main/inc/lib/pear/HTML/QuickForm.php index f99904d26d..43b909c41f 100755 --- a/main/inc/lib/pear/HTML/QuickForm.php +++ b/main/inc/lib/pear/HTML/QuickForm.php @@ -350,19 +350,19 @@ class HTML_QuickForm extends HTML_Common if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) { foreach ($filter as $val) { if (!is_callable($val)) { - throw new \Exception("Callback function does not exist in QuickForm::setDefaults()"); + throw new \Exception('Callback function does not exist in QuickForm::setDefaults()'); } else { $defaultValues = $this->_recursiveFilter($val, $defaultValues); } } } elseif (!is_callable($filter)) { - throw new \Exception("Callback function does not exist in QuickForm::setDefaults()"); + throw new \Exception('Callback function does not exist in QuickForm::setDefaults()'); } else { $defaultValues = $this->_recursiveFilter($filter, $defaultValues); } } - $this->_defaultValues = HTML_QuickForm::arrayMerge($this->_defaultValues, $defaultValues); + $this->_defaultValues = self::arrayMerge($this->_defaultValues, $defaultValues); $this->_constantValues = $this->_defaultValues; foreach (array_keys($this->_elements) as $key) { $this->_elements[$key]->onQuickFormEvent('updateValue', null, $this); diff --git a/main/inc/lib/pear/HTML/QuickForm/Renderer.php b/main/inc/lib/pear/HTML/QuickForm/Renderer.php index 7f6092bbcf..3a81b1e164 100755 --- a/main/inc/lib/pear/HTML/QuickForm/Renderer.php +++ b/main/inc/lib/pear/HTML/QuickForm/Renderer.php @@ -153,6 +153,5 @@ class HTML_QuickForm_Renderer function finishGroup(&$group) { return; - } // end func finishGroup -} // end class HTML_QuickForm_Renderer -?> + } +} diff --git a/main/inc/lib/pear/HTML/QuickForm/element.php b/main/inc/lib/pear/HTML/QuickForm/element.php index ba4c8f2638..6cd62623da 100755 --- a/main/inc/lib/pear/HTML/QuickForm/element.php +++ b/main/inc/lib/pear/HTML/QuickForm/element.php @@ -43,17 +43,15 @@ class HTML_QuickForm_element extends HTML_Common /** * Label of the field * @var string - * @since 1.3 - * @access private */ - var $_label = ''; + public $_label = ''; /** * Label "for" a field... (Chamilo LMS customization) * @var string * @access private */ - var $_label_for = ''; + public $_label_for = ''; /** * Form element type @@ -61,7 +59,7 @@ class HTML_QuickForm_element extends HTML_Common * @since 1.0 * @access private */ - var $_type = ''; + public $_type = ''; /** * Flag to tell if element is frozen @@ -69,7 +67,7 @@ class HTML_QuickForm_element extends HTML_Common * @since 1.0 * @access private */ - var $_flagFrozen = false; + public $_flagFrozen = false; /** * Does the element support persistant data when frozen @@ -77,7 +75,7 @@ class HTML_QuickForm_element extends HTML_Common * @since 1.3 * @access private */ - var $_persistantFreeze = false; + public $_persistantFreeze = false; protected $columnsSize; @@ -177,10 +175,7 @@ class HTML_QuickForm_element extends HTML_Common public function apiVersion() { return 3.2; - } // end func apiVersion - - // }}} - // {{{ getType() + } /** * Returns element type @@ -192,10 +187,7 @@ class HTML_QuickForm_element extends HTML_Common public function getType() { return $this->_type; - } // end func getType - - // }}} - // {{{ setName() + } /** * Sets the input field name @@ -207,11 +199,7 @@ class HTML_QuickForm_element extends HTML_Common */ public function setName($name) { - // interface method - } //end func setName - - // }}} - // {{{ getName() + } /** * Returns the element name @@ -222,11 +210,7 @@ class HTML_QuickForm_element extends HTML_Common */ public function getName() { - // interface method - } //end func getName - - // }}} - // {{{ setValue() + } /** * Sets the value of the form element @@ -238,11 +222,7 @@ class HTML_QuickForm_element extends HTML_Common */ public function setValue($value) { - // interface - } // end func setValue - - // }}} - // {{{ getValue() + } /** * Returns the value of the form element @@ -287,10 +267,7 @@ class HTML_QuickForm_element extends HTML_Common public function freeze() { $this->_flagFrozen = true; - } //end func freeze - - // }}} - // {{{ unfreeze() + } /** * Unfreezes the element so that it becomes editable @@ -304,9 +281,6 @@ class HTML_QuickForm_element extends HTML_Common $this->_flagFrozen = false; } - // }}} - // {{{ getFrozenHtml() - /** * Returns the value of field without HTML tags * @@ -351,9 +325,6 @@ class HTML_QuickForm_element extends HTML_Common } } - // }}} - // {{{ isFrozen() - /** * Returns whether or not the element is frozen * @@ -364,10 +335,7 @@ class HTML_QuickForm_element extends HTML_Common public function isFrozen() { return $this->_flagFrozen; - } // end func isFrozen - - // }}} - // {{{ setPersistantFreeze() + } /** * Sets wether an element value should be kept in an hidden field @@ -381,10 +349,7 @@ class HTML_QuickForm_element extends HTML_Common function setPersistantFreeze($persistant=false) { $this->_persistantFreeze = $persistant; - } //end func setPersistantFreeze - - // }}} - // {{{ setLabel() + } /** * Sets display text for the element @@ -401,10 +366,7 @@ class HTML_QuickForm_element extends HTML_Common if (!empty($labelFor)) { $this->_label_for = $labelFor; } - } //end func setLabel - - // }}} - // {{{ getLabel() + } /** * Returns display text for the element @@ -416,7 +378,7 @@ class HTML_QuickForm_element extends HTML_Common function getLabel() { return $this->_label; - } //end func getLabel + } /** * Returns "for" attribute for the element @@ -427,10 +389,7 @@ class HTML_QuickForm_element extends HTML_Common function getLabelFor() { return $this->_label_for; - } //end func getLabelFor - - // }}} - // {{{ _findValue() + } /** * Tries to find the element value from the values array @@ -471,10 +430,7 @@ class HTML_QuickForm_element extends HTML_Common } else { return null; } - } //end func _findValue - - // }}} - // {{{ onQuickFormEvent() + } /** * Called by HTML_QuickForm whenever form event is made on this element @@ -569,9 +525,6 @@ class HTML_QuickForm_element extends HTML_Common return $this->_prepareValue($value, $assoc); } - // }}} - // {{{ _prepareValue() - /** * Used by exportValue() to prepare the value for returning * @@ -631,8 +584,4 @@ class HTML_QuickForm_element extends HTML_Common return $this; } - - - - } diff --git a/main/inc/lib/pear/HTML/QuickForm/input.php b/main/inc/lib/pear/HTML/QuickForm/input.php index 7e82536189..3505c89684 100755 --- a/main/inc/lib/pear/HTML/QuickForm/input.php +++ b/main/inc/lib/pear/HTML/QuickForm/input.php @@ -1,6 +1,4 @@ form elements * @@ -35,8 +33,6 @@ */ class HTML_QuickForm_input extends HTML_QuickForm_element { - // {{{ constructor - /** * Class constructor * @@ -50,10 +46,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element public function __construct($elementName=null, $elementLabel=null, $attributes=null) { parent::__construct($elementName, $elementLabel, $attributes); - } //end constructor - - // }}} - // {{{ setType() + } /** * Sets the element type @@ -67,10 +60,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element { $this->_type = $type; $this->updateAttributes(array('type'=>$type)); - } // end func setType - - // }}} - // {{{ setName() + } /** * Sets the input field name @@ -83,10 +73,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element function setName($name) { $this->updateAttributes(array('name'=>$name)); - } //end func setName - - // }}} - // {{{ getName() + } /** * Returns the element name @@ -98,10 +85,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element function getName() { return $this->getAttribute('name'); - } //end func getName - - // }}} - // {{{ setValue() + } /** * Sets the value of the form element @@ -113,11 +97,8 @@ class HTML_QuickForm_input extends HTML_QuickForm_element */ public function setValue($value) { - $this->updateAttributes(array('value'=>$value)); - } // end func setValue - - // }}} - // {{{ getValue() + $this->updateAttributes(array('value' => $value)); + } /** * Returns the value of the form element @@ -129,10 +110,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element public function getValue() { return $this->getAttribute('value'); - } // end func getValue - - // }}} - // {{{ toHtml() + } /** * Returns the input field in HTML @@ -148,10 +126,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element } else { return $this->_getTabs() . '_getAttrString($this->_attributes) . ' />'; } - } //end func toHtml - - // }}} - // {{{ onQuickFormEvent() + } /** * Called by HTML_QuickForm whenever form event is made on this element diff --git a/main/inc/lib/pear/HTML/QuickForm/label.php b/main/inc/lib/pear/HTML/QuickForm/label.php index acaa3f46e2..d4e533f949 100755 --- a/main/inc/lib/pear/HTML/QuickForm/label.php +++ b/main/inc/lib/pear/HTML/QuickForm/label.php @@ -19,8 +19,6 @@ */ class HTML_QuickForm_label extends HTML_QuickForm_static { - // {{{ constructor - /** * Class constructor * @@ -36,12 +34,4 @@ class HTML_QuickForm_label extends HTML_QuickForm_static parent::__construct(null, $label, $text, $attributes); $this->_type = 'html'; } - - /** - * @return string - */ - public function toHtml() - { - return parent::toHtml(); - } } diff --git a/main/inc/lib/pear/HTML/QuickForm/link.php b/main/inc/lib/pear/HTML/QuickForm/link.php index ee786a169b..bec5ab4df2 100755 --- a/main/inc/lib/pear/HTML/QuickForm/link.php +++ b/main/inc/lib/pear/HTML/QuickForm/link.php @@ -187,9 +187,5 @@ class HTML_QuickForm_link extends HTML_QuickForm_static function getFrozenHtml() { return; - } //end func getFrozenHtml - - // }}} - -} //end class HTML_QuickForm_textarea -?> + } +} diff --git a/main/inc/lib/pear/HTML/QuickForm/reset.php b/main/inc/lib/pear/HTML/QuickForm/reset.php index 5de49e9653..c7dae46e32 100755 --- a/main/inc/lib/pear/HTML/QuickForm/reset.php +++ b/main/inc/lib/pear/HTML/QuickForm/reset.php @@ -2,8 +2,6 @@ class HTML_QuickForm_reset extends HTML_QuickForm_button { - // {{{ constructor - /** * Class constructor * @@ -20,10 +18,7 @@ class HTML_QuickForm_reset extends HTML_QuickForm_button parent::__construct($elementName, null, $attributes); $this->setValue($value); $this->setType('reset'); - } //end constructor - - // }}} - // {{{ freeze() + } /** * Freeze the element so that only its value is returned @@ -34,8 +29,5 @@ class HTML_QuickForm_reset extends HTML_QuickForm_button function freeze() { return false; - } //end func freeze - - // }}} - + } } diff --git a/main/inc/lib/pear/HTML/QuickForm/static.php b/main/inc/lib/pear/HTML/QuickForm/static.php index 24f3fecc23..9a633aa5f0 100755 --- a/main/inc/lib/pear/HTML/QuickForm/static.php +++ b/main/inc/lib/pear/HTML/QuickForm/static.php @@ -32,9 +32,6 @@ */ class HTML_QuickForm_static extends HTML_QuickForm_element { - - // {{{ properties - /** * Display text * @var string @@ -42,9 +39,6 @@ class HTML_QuickForm_static extends HTML_QuickForm_element */ var $_text = null; - // }}} - // {{{ constructor - /** * Class constructor * @@ -59,10 +53,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element $this->_persistantFreeze = false; $this->_type = 'static'; $this->_text = $text; - } //end constructor - - // }}} - // {{{ setName() + } /** * Sets the element name @@ -74,10 +65,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element function setName($name) { $this->updateAttributes(array('name'=>$name)); - } //end func setName - - // }}} - // {{{ getName() + } /** * Returns the element name @@ -88,10 +76,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element function getName() { return $this->getAttribute('name'); - } //end func getName - - // }}} - // {{{ setText() + } /** * Sets the text @@ -103,10 +88,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element function setText($text) { $this->_text = $text; - } // end func setText - - // }}} - // {{{ setValue() + } /** * Sets the text (uses the standard setValue call to emulate a form element. @@ -118,10 +100,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element function setValue($text) { $this->setText($text); - } // end func setValue - - // }}} - // {{{ toHtml() + } /** * Returns the static text element in HTML @@ -132,10 +111,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element public function toHtml() { return $this->_getTabs() . $this->_text; - } //end func toHtml - - // }}} - // {{{ getFrozenHtml() + } /** * Returns the value of field without HTML tags @@ -146,10 +122,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element function getFrozenHtml() { return $this->toHtml(); - } //end func getFrozenHtml - - // }}} - // {{{ onQuickFormEvent() + } /** * Called by HTML_QuickForm whenever form event is made on this element @@ -179,12 +152,9 @@ class HTML_QuickForm_static extends HTML_QuickForm_element parent::onQuickFormEvent($event, $arg, $caller); } return true; - } // end func onQuickFormEvent - - // }}} - // {{{ exportValue() + } - /** + /** * We override this here because we don't want any values from static elements */ function exportValue(&$submitValues, $assoc = false) diff --git a/main/inc/lib/pear/HTML/QuickForm/submit.php b/main/inc/lib/pear/HTML/QuickForm/submit.php index 801917fae1..415c6c737e 100755 --- a/main/inc/lib/pear/HTML/QuickForm/submit.php +++ b/main/inc/lib/pear/HTML/QuickForm/submit.php @@ -34,8 +34,6 @@ */ class HTML_QuickForm_submit extends HTML_QuickForm_input { - // {{{ constructor - /** * Class constructor * @@ -51,10 +49,7 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input parent::__construct($elementName, null, $attributes); $this->setValue($value); $this->setType('submit'); - } //end constructor - - // }}} - // {{{ freeze() + } /** * Freeze the element so that only its value is returned @@ -65,10 +60,7 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input function freeze() { return false; - } //end func freeze - - // }}} - // {{{ exportValue() + } /** * Only return the value if it is found within $submitValues (i.e. if @@ -79,6 +71,4 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input return $this->_prepareValue($this->_findValue($submitValues), $assoc); } - // }}} -} //end class HTML_QuickForm_submit -?> +} diff --git a/main/inc/lib/pear/HTML/QuickForm/text.php b/main/inc/lib/pear/HTML/QuickForm/text.php index ab972beb8c..4ba0f338d0 100755 --- a/main/inc/lib/pear/HTML/QuickForm/text.php +++ b/main/inc/lib/pear/HTML/QuickForm/text.php @@ -223,7 +223,7 @@ class HTML_QuickForm_text extends HTML_QuickForm_input if ($this->isFrozen()) { return $this->getFrozenHtml(); } else { - return '_getAttrString($this->_attributes) . ' />'; + return '_getAttrString($this->_attributes).' />'; } } } diff --git a/main/inc/lib/pear/HTML/QuickForm/textarea.php b/main/inc/lib/pear/HTML/QuickForm/textarea.php index 78979a547f..3c848d845d 100755 --- a/main/inc/lib/pear/HTML/QuickForm/textarea.php +++ b/main/inc/lib/pear/HTML/QuickForm/textarea.php @@ -40,7 +40,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element * @since 1.0 * @access private */ - public $_value = null; + public $_value; /** * Class constructor @@ -62,6 +62,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element parent::__construct($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'textarea'; + $this->_value = null; } /** @@ -75,10 +76,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function setName($name) { $this->updateAttributes(array('name'=>$name)); - } //end func setName - - // }}} - // {{{ getName() + } /** * Returns the element name @@ -90,10 +88,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function getName() { return $this->getAttribute('name'); - } //end func getName - - // }}} - // {{{ setValue() + } /** * Sets value for textarea element @@ -106,10 +101,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function setValue($value) { $this->_value = $value; - } //end func setValue - - // }}} - // {{{ getValue() + } /** * Returns the value of the form element @@ -121,10 +113,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function getValue() { return $this->_value; - } // end func getValue - - // }}} - // {{{ setWrap() + } /** * Sets wrap type for textarea element @@ -137,10 +126,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function setWrap($wrap) { $this->updateAttributes(array('wrap' => $wrap)); - } //end func setWrap - - // }}} - // {{{ setRows() + } /** * Sets height in rows for textarea element @@ -153,10 +139,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function setRows($rows) { $this->updateAttributes(array('rows' => $rows)); - } //end func setRows - - // }}} - // {{{ setCols() + } /** * Sets width in cols for textarea element @@ -169,10 +152,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element function setCols($cols) { $this->updateAttributes(array('cols' => $cols)); - } //end func setCols - - // }}} - // {{{ toHtml() + } /** * Returns the textarea element in HTML @@ -191,7 +171,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element // because we wrap the form later we don't want the text indented // Modified by Ivan Tcholakov, 16-MAR-2010. //preg_replace("/(\r\n|\n|\r)/", ' ', htmlspecialchars($this->_value)) . - preg_replace("/(\r\n|\n|\r)/", ' ', @htmlspecialchars($this->_value, ENT_COMPAT, HTML_Common::charset())) . + preg_replace("/(\r\n|\n|\r)/", ' ', $this->getCleanValue()) . // ''; } @@ -206,10 +186,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element */ public function getFrozenHtml() { - // Modified by Ivan Tcholakov, 16-MAR-2010. - //$value = htmlspecialchars($this->getValue()); - $value = @htmlspecialchars($this->getValue(), ENT_COMPAT, HTML_Common::charset()); - // + $value = $this->getCleanValue(); if ($this->getAttribute('wrap') == 'off') { $html = $this->_getTabs() . '
' . $value."
\n"; } else { @@ -281,6 +258,4 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element break; } } - - }