mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
moved obsoleted functions from weblib.php to deprecatedlib.php
This commit is contained in:
parent
e1968a8e11
commit
ed5dd29fc8
@ -879,6 +879,107 @@ function print_simple_box_end($return=false) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* deprecated - use clean_param($string, PARAM_FILE); instead
|
||||
* Check for bad characters ?
|
||||
*
|
||||
* @param string $string ?
|
||||
* @param int $allowdots ?
|
||||
* @todo Finish documenting this function - more detail needed in description as well as details on arguments
|
||||
*/
|
||||
function detect_munged_arguments($string, $allowdots=1) {
|
||||
if (substr_count($string, '..') > $allowdots) { // Sometimes we allow dots in references
|
||||
return true;
|
||||
}
|
||||
if (ereg('[\|\`]', $string)) { // check for other bad characters
|
||||
return true;
|
||||
}
|
||||
if (empty($string) or $string == '/') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
/// Old functions not used anymore - candidates for removal
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Load a template from file - this function dates back to Moodle 1 :-) not used anymore
|
||||
*
|
||||
* Returns a (big) string containing the contents of a template file with all
|
||||
* the variables interpolated. all the variables must be in the $var[] array or
|
||||
* object (whatever you decide to use).
|
||||
*
|
||||
* <b>WARNING: do not use this on big files!!</b>
|
||||
*
|
||||
* @param string $filename Location on the server's filesystem where template can be found.
|
||||
* @param mixed $var Passed in by reference. An array or object which will be loaded with data from the template file.
|
||||
*
|
||||
*/
|
||||
function read_template($filename, &$var) {
|
||||
|
||||
$temp = str_replace("\\", "\\\\", implode(file($filename), ''));
|
||||
$temp = str_replace('"', '\"', $temp);
|
||||
eval("\$template = \"$temp\";");
|
||||
return $template;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deprecated - relies on register globals; use new formslib instead
|
||||
*
|
||||
* Set a variable's value depending on whether or not it already has a value.
|
||||
*
|
||||
* If variable is set, set it to the set_value otherwise set it to the
|
||||
* unset_value. used to handle checkboxes when you are expecting them from
|
||||
* a form
|
||||
*
|
||||
* @param mixed $var Passed in by reference. The variable to check.
|
||||
* @param mixed $set_value The value to set $var to if $var already has a value.
|
||||
* @param mixed $unset_value The value to set $var to if $var does not already have a value.
|
||||
*/
|
||||
function checked(&$var, $set_value = 1, $unset_value = 0) {
|
||||
|
||||
if (empty($var)) {
|
||||
$var = $unset_value;
|
||||
} else {
|
||||
$var = $set_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* deprecated - use new formslib instead
|
||||
*
|
||||
* Prints the word "checked" if a variable is true, otherwise prints nothing,
|
||||
* used for printing the word "checked" in a checkbox form element.
|
||||
*
|
||||
* @param boolean $var Variable to be checked for true value
|
||||
* @param string $true_value Value to be printed if $var is true
|
||||
* @param string $false_value Value to be printed if $var is false
|
||||
*/
|
||||
function frmchecked(&$var, $true_value = 'checked', $false_value = '') {
|
||||
|
||||
if ($var) {
|
||||
echo $true_value;
|
||||
} else {
|
||||
echo $false_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, provided for backward compatability.
|
||||
* This method now simply calls {@link use_html_editor()}
|
||||
*
|
||||
* @deprecated Use {@link use_html_editor()} instead.
|
||||
* @param string $name Form element to replace with HTMl editor by name
|
||||
* @todo Finish documenting this function
|
||||
*/
|
||||
function print_richedit_javascript($form, $name, $source='no') {
|
||||
use_html_editor($name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
@ -427,7 +427,7 @@
|
||||
echo "</td></tr></table>\n";
|
||||
|
||||
if ($usehtmleditor) {
|
||||
print_richedit_javascript("form", "text", "yes");
|
||||
use_html_editor("text");
|
||||
}
|
||||
|
||||
|
||||
|
@ -474,63 +474,6 @@ if (!function_exists('stripos')) { /// Only exists in PHP 5
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a template from file
|
||||
*
|
||||
* Returns a (big) string containing the contents of a template file with all
|
||||
* the variables interpolated. all the variables must be in the $var[] array or
|
||||
* object (whatever you decide to use).
|
||||
*
|
||||
* <b>WARNING: do not use this on big files!!</b>
|
||||
*
|
||||
* @param string $filename Location on the server's filesystem where template can be found.
|
||||
* @param mixed $var Passed in by reference. An array or object which will be loaded with data from the template file.
|
||||
*/
|
||||
function read_template($filename, &$var) {
|
||||
|
||||
$temp = str_replace("\\", "\\\\", implode(file($filename), ''));
|
||||
$temp = str_replace('"', '\"', $temp);
|
||||
eval("\$template = \"$temp\";");
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a variable's value depending on whether or not it already has a value.
|
||||
*
|
||||
* If variable is set, set it to the set_value otherwise set it to the
|
||||
* unset_value. used to handle checkboxes when you are expecting them from
|
||||
* a form
|
||||
*
|
||||
* @param mixed $var Passed in by reference. The variable to check.
|
||||
* @param mixed $set_value The value to set $var to if $var already has a value.
|
||||
* @param mixed $unset_value The value to set $var to if $var does not already have a value.
|
||||
*/
|
||||
function checked(&$var, $set_value = 1, $unset_value = 0) {
|
||||
|
||||
if (empty($var)) {
|
||||
$var = $unset_value;
|
||||
} else {
|
||||
$var = $set_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the word "checked" if a variable is true, otherwise prints nothing,
|
||||
* used for printing the word "checked" in a checkbox form element.
|
||||
*
|
||||
* @param boolean $var Variable to be checked for true value
|
||||
* @param string $true_value Value to be printed if $var is true
|
||||
* @param string $false_value Value to be printed if $var is false
|
||||
*/
|
||||
function frmchecked(&$var, $true_value = 'checked', $false_value = '') {
|
||||
|
||||
if ($var) {
|
||||
echo $true_value;
|
||||
} else {
|
||||
echo $false_value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will create a HTML link that will work on both
|
||||
* Javascript and non-javascript browsers.
|
||||
@ -1137,27 +1080,6 @@ function get_file_argument($scriptname) {
|
||||
return $relativepath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for bad characters ?
|
||||
*
|
||||
* @param string $string ?
|
||||
* @param int $allowdots ?
|
||||
* @todo Finish documenting this function - more detail needed in description as well as details on arguments
|
||||
*/
|
||||
function detect_munged_arguments($string, $allowdots=1) {
|
||||
if (substr_count($string, '..') > $allowdots) { // Sometimes we allow dots in references
|
||||
return true;
|
||||
}
|
||||
if (ereg('[\|\`]', $string)) { // check for other bad characters
|
||||
return true;
|
||||
}
|
||||
if (empty($string) or $string == '/') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches the current environment variables for some slash arguments
|
||||
*
|
||||
@ -3715,18 +3637,6 @@ function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $v
|
||||
echo $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy function, provided for backward compatability.
|
||||
* This method now simply calls {@link use_html_editor()}
|
||||
*
|
||||
* @deprecated Use {@link use_html_editor()} instead.
|
||||
* @param string $name Form element to replace with HTMl editor by name
|
||||
* @todo Finish documenting this function
|
||||
*/
|
||||
function print_richedit_javascript($form, $name, $source='no') {
|
||||
use_html_editor($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets up the HTML editor on textareas in the current page.
|
||||
* If a field name is provided, then it will only be
|
||||
|
Loading…
x
Reference in New Issue
Block a user