]> git.mjollnir.org Git - moodle.git/commitdiff
moved obsoleted functions from weblib.php to deprecatedlib.php
authorskodak <skodak>
Sat, 20 Jan 2007 13:32:15 +0000 (13:32 +0000)
committerskodak <skodak>
Sat, 20 Jan 2007 13:32:15 +0000 (13:32 +0000)
lib/deprecatedlib.php
lib/editor/htmlarea/coursefiles.php
lib/weblib.php

index c084115847597dfc192f4d46e0f6ff83c3916575..d4135882016c04e7a2ca870ae133f84abbf07fe2 100644 (file)
@@ -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);
+}
+
 
 
 ?>
index f714f7dfdea7b759f9d717a0e5fddc51a9687a44..843cfd432f6e6c627be38c819cc6345c6a6a1183 100644 (file)
                 echo "</td></tr></table>\n";
 
                 if ($usehtmleditor) {
-                    print_richedit_javascript("form", "text", "yes");
+                    use_html_editor("text");
                 }
 
 
index 853c34eb3e37b53f94d857f109871dc2c4865f9b..3e9cbb2e6d60c6e76c83b1f91f77b3ef3d777abc 100644 (file)
@@ -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