diff --git a/phplib/of_checkbox.inc b/phplib/of_checkbox.inc index a20aab9..e04b948 100644 --- a/phplib/of_checkbox.inc +++ b/phplib/of_checkbox.inc @@ -1,90 +1,90 @@ setup_element($a); } function self_get($val, $which, &$count) { $str = ""; if ($this->multiple) { $n = $this->name . "[]"; $str .= "value)) { reset($this->value); while (list($k,$v) = each($this->value)) { if ($v==$val) { $str .= " checked"; break; } } } } else { $str .= "checked) $str .= " checked"; } if ($this->extrahtml) $str .= " $this->extrahtml"; $str .= ">\n"; $count = 1; return $str; } function self_get_frozen($val, $which, &$count) { $str = ""; $x = 0; $t=""; if ($this->multiple) { $n = $this->name . "[]"; if (is_array($this->value)) { reset($this->value); while (list($k,$v) = each($this->value)) { if ($v==$val) { $x = 1; $str .= "\n"; $t =" bgcolor=#333333"; break; } } } } else { if ($this->checked) { $x = 1; $t = " bgcolor=#333333"; $str .= "multiple) $this->value = $val; elseif (isset($val) && (!$this->value || $val==$this->value)) $this->checked=1; else $this->checked=0; } } // end CHECKBOX ?> diff --git a/phplib/of_file.inc b/phplib/of_file.inc index 41dce81..859195d 100644 --- a/phplib/of_file.inc +++ b/phplib/of_file.inc @@ -1,31 +1,31 @@ setup_element($a); } function self_get($val,$which, &$count) { $str = ""; $str .= "size>\n"; $str .= "extrahtml) $str .= " $this->extrahtml"; $str .= ">"; $count = 2; return $str; } } // end FILE diff --git a/phplib/of_radio.inc b/phplib/of_radio.inc index 9fbdb83..45eeaac 100644 --- a/phplib/of_radio.inc +++ b/phplib/of_radio.inc @@ -1,75 +1,75 @@ setup_element($a); } function self_get($val, $which, &$count) { $str = ""; $str .= "extrahtml) $str .= " $this->extrahtml"; if ($this->value==$val) $str .= " checked"; $str .= ">"; $count = 1; return $str; } function self_get_frozen($val,$which, &$count) { $str = ""; $x = 0; if ($this->value==$val) { $x = 1; $str .= "\n"; $str .= ""; } else { $str .= "
"; } $str .= "
 
\n"; $count = $x; return $str; } function self_get_js($ndx_array) { $str = ""; if ($this->valid_e) { $n = $this->name; - $str .= "var l = f.${n}.length;\n"; + $str .= "var l = f.$n.length;\n"; $str .= "var radioOK = false;\n"; $str .= "for (i=0; ivalid_e\");\n"; $str .= " return(false);\n"; $str .= "}\n"; } } function self_validate($val) { if ($this->valid_e && !isset($val)) return $this->valid_e; return false; } } // end RADIO ?> diff --git a/phplib/of_select.inc b/phplib/of_select.inc index 5756eae..efe7b9f 100644 --- a/phplib/of_select.inc +++ b/phplib/of_select.inc @@ -1,114 +1,110 @@ setup_element($a); if ($a["type"]=="select multiple") $this->multiple=1; } function self_get($val,$which, &$count) { $str = ""; if ($this->multiple) { $n = $this->name . "[]"; $t = "select multiple"; } else { $n = $this->name; $t = "select"; } $str .= "<$t name='$n'"; if ($this->size) $str .= " size='$this->size'"; if ($this->multiple) $str .= "multiple='multiple'"; if ($this->extrahtml) $str .= " $this->extrahtml"; $str .= ">"; - reset($this->options); - while (list($k,$o) = each($this->options)) { + foreach ($this->options as $k=>$o) { $str .= "multiple && ($this->value==$o["value"] || $this->value==$o)) $str .= " selected"; elseif ($this->multiple && is_array($this->value)) { - reset($this->value); - while (list($tk,$v) = each($this->value)) { + foreach ($this->value as $tk=>$v) { if ($v==$o["value"] || $v==$o) { $str .= " selected"; break; } } } $str .= ">" . (is_array($o) ? $o["label"] : $o) . "\n"; } $str .= ""; $count = 1; return $str; } function self_get_frozen($val,$which, &$count) { $str = ""; $x = 0; $n = $this->name . ($this->multiple ? "[]" : ""); $v_array = (is_array($this->value) ? $this->value : array($this->value)); $str .= "\n"; - reset($v_array); - while (list($tk,$tv) = each($v_array)) { - reset($this->options); - while (list($k,$v) = each($this->options)) { + foreach($v_array as $tk=>$tv) { + foreach ($this->options as $k=>$v) { if ((is_array($v) && (($tmp=$v["value"])==$tv || $v["label"]==$tv)) || ($tmp=$v)==$tv) { $x++; $str .= "\n"; $str .= "" . (is_array($v) ? $v["label"] : $v) . "\n"; } } } #$str .= "
\n"; $count = $x; return $str; } function self_get_js($ndx_array) { $str = ""; if (!$this->multiple && $this->valid_e) { $str .= "if (f.$this->name.selectedIndex == 0) {\n"; $str .= " alert(\"$this->valid_e\");\n"; $str .= " f.$this->name.focus();\n"; $str .= " return(false);\n"; $str .= "}\n"; } return $str; } function self_validate($val) { if (!$this->multiple && $this->valid_e) { reset($this->options); $o = current($this->options); if ($val==$o["value"] || $val==$o) return $this->valid_e; } return false; } } // end SELECT ?> diff --git a/phplib/of_text.inc b/phplib/of_text.inc index b4dc238..b9dc5a3 100644 --- a/phplib/of_text.inc +++ b/phplib/of_text.inc @@ -1,124 +1,112 @@ setup_element($a); if ($a["type"]=="password") $this->pass=1; } function self_get($val,$which, &$count) { $str = ""; if (is_array($this->value)) $v = htmlspecialchars($this->value[$which]); else $v = htmlspecialchars($this->value); $n = $this->name . ($this->multiple ? "[]" : ""); $str .= "pass)? " type='password'" : " type='text'"; //$str .= " class=$class"; if ($this->maxlength) $str .= " maxlength='$this->maxlength'"; if ($this->size) $str .= " size='$this->size'"; if ($this->extrahtml) $str .= " $this->extrahtml"; $str .= "autocomplete='off'>"; $count = 1; return $str; } function self_get_frozen($val,$which, &$count) { $str = ""; if (is_array($this->value)) $v = $this->value[$which]; else $v = $this->value; $n = $this->name . ($this->multiple ? "[]" : ""); - $str .= "\n"; + $str .= "\n"; $str .= "$v\n"; $count = 1; return $str; } function self_get_js($ndx_array) { $str = ""; - - reset($ndx_array); - while (list($k,$n) = each($ndx_array)) { - if ($this->length_e) { - $str .= "if (f.elements[${n}].value.length < $this->minlength) {\n"; - $str .= " alert(\"Too short!\");\n"; - $str .= " f.elements[${n}].focus();\n"; + if (is_array($ndx_array)) { //Added by DaveB + foreach($ndx_array as $k=>$n) { + if (!empty($this->length_e)) { + $str .= "if (f.elements[\"$n\"].value.length < $this->minlength) {\n"; + $str .= " alert(\"$this->length_e\");\n"; + $str .= " f.elements[$n].focus();\n"; $str .= " return(false);\n}\n"; } - if ($this->valid_e) { - $flags = ($this->icase ? "gi" : "g"); + if (!empty($this->valid_e)) { + $flags = (!empty($this->icase) ? "gi" : "g"); $str .= "if (window.RegExp) {\n"; $str .= " var reg = new RegExp(\"$this->valid_regex\",\"$flags\");\n"; - $str .= " if (!reg.test(f.elements[${n}].value)) {\n"; + $str .= " if (!reg.test(f.elements[$n].value)) {\n"; $str .= " alert(\"$this->valid_e\");\n"; - $str .= " f.elements[${n}].focus();\n"; + $str .= " f.elements[$n].focus();\n"; $str .= " return(false);\n"; $str .= " }\n}\n"; } } - + } return $str; } function self_validate($val) { if (!is_array($val)) $val = array($val); - reset($val); - while (list($k,$v) = each($val)) { - if ($this->length_e && (strlen($v) < $this->minlength)) - if ($this->valid_minlength_error) { - return $this->valid_minlength_error; - } else { - return $this->valid_e; - } - if ($this->valid_e && (($this->icase && - !preg_match("/$this->valid_regex/i",$v)) || - (!$this->icase && - !preg_match("/$this->valid_regex/",$v)))) + foreach($val as $k=>$v) { + if ($this->length_e && (strlen($v) < $this->minlength)) { return $this->valid_e; // new added by adigeo 2001-05-28 if ($this->valid_e2_error && (($this->icase && !preg_match("/$this->valid_e2/i",$v)) || (!$this->icase && !preg_match("/$this->valid_e2/",$v)))) return $this->valid_e2_error; } - return false; - } + } } // end TEXT ?> diff --git a/phplib/of_textarea.inc b/phplib/of_textarea.inc index a76570f..6883a26 100644 --- a/phplib/of_textarea.inc +++ b/phplib/of_textarea.inc @@ -1,48 +1,48 @@ setup_element($a); } function self_get($val,$which, &$count) { $str = ""; $str .= ""; + $str .= ">" . htmlspecialchars($this->value, ENT_COMPAT,'ISO-8859-1', true) .""; $count = 1; return $str; } function self_get_frozen($val,$which, &$count) { $str = ""; $str .= "value); $str .= "\n\n"; $count = 1; return $str; } } // end TEXTAREA ?>