Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F7170382
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
13 KB
Referenced Files
None
Subscribers
None
View Options
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 @@
<?php
/* OOHForms: checkbox
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_checkbox.inc,v 1.1.1.1 2004-04-29 10:18:10 adigeo Exp $
*/
class of_checkbox extends of_element {
var $checked;
// Constructor
- function of_checkbox($a) {
+ function __construct($a) {
$this->setup_element($a);
}
function self_get($val, $which, &$count) {
$str = "";
if ($this->multiple) {
$n = $this->name . "[]";
$str .= "<input type='checkbox' name='$n' value='$val'";
if (is_array($this->value)) {
reset($this->value);
while (list($k,$v) = each($this->value)) {
if ($v==$val) {
$str .= " checked";
break;
}
}
}
} else {
$str .= "<input type='checkbox' name='$this->name'";
$str .= " value='$this->value'";
if ($this->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 .= "<input type='hidden' name='$this->name' value='$v'>\n";
$t =" bgcolor=#333333";
break;
}
}
}
} else {
if ($this->checked) {
$x = 1;
$t = " bgcolor=#333333";
$str .= "<input type='hidden' name='$this->name'";
$str .= " value='$this->value'>";
}
}
$str .= "<table$t border=1><tr><td> </td></tr></table>\n";
$count = $x;
return $str;
}
function self_load_defaults($val) {
if ($this->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 @@
<?php
/* OOHForms: file
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_file.inc,v 1.1.1.1 2004-04-29 10:18:10 adigeo Exp $
*/
class of_file extends of_element {
var $isfile = true;
var $size;
- function of_file($a) {
+ function __construct($a) {
$this->setup_element($a);
}
function self_get($val,$which, &$count) {
$str = "";
$str .= "<input type='hidden' name='MAX_FILE_SIZE' value=$this->size>\n";
$str .= "<input type='file' name='$this->name'";
if ($this->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 @@
<?php
/* OOHForms: radio
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_radio.inc,v 1.1.1.1 2004-04-29 10:18:10 adigeo Exp $
*/
class of_radio extends of_element {
var $valid_e;
// Constructor
- function of_radio($a) {
+ function __construct($a) {
$this->setup_element($a);
}
function self_get($val, $which, &$count) {
$str = "";
$str .= "<input type='radio' name='$this->name' value='$val'";
if ($this->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 .= "<input type='hidden' name='$this->name' value='$val'>\n";
$str .= "<table border=1 bgcolor=#333333>";
} else {
$str .= "<table border=1>";
}
$str .= "<tr><td> </tr></td></table>\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; i<l; i++)\n";
- $str .= " if (f.${n}[i].checked) {\n";
+ $str .= " if (f.$n[i].checked) {\n";
$str .= " radioOK = true;\n";
$str .= " break;\n";
$str .= " }\n";
$str .= "if (!radioOK) {\n";
$str .= " alert(\"$this->valid_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 @@
<?php
/* OOHForms: select
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_select.inc,v 1.3 2004-07-10 09:30:56 adigeo Exp $
*/
class of_select extends of_element {
var $options;
var $size;
var $valid_e;
// Constructor
- function of_select($a) {
+ function __construct($a) {
$this->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 .= "<option";
if (is_array($o))
$str .= " value='" . $o["value"] . "'";
if (!$this->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 .= "</select>";
$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 .= "<input type='hidden' name='$n' value='$tmp'>\n";
$str .= "" . (is_array($v) ? $v["label"] : $v) . "\n";
}
}
}
#$str .= "<br>\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 @@
<?php
/* OOHForms: text
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_text.inc,v 1.1.1.1 2004-04-29 10:18:10 adigeo Exp $
*/
class of_text extends of_element {
var $maxlength;
var $minlength;
var $length_e;
var $valid_regex;
var $valid_icase;
var $valid_e;
var $valid_minlength_error;
var $valid_e2;
var $valid_e2_error;
var $pass;
var $size;
var $class;
// Constructor
- function of_text($a) {
+ function __construct($a) {
$this->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 .= "<input name='$n' value=\"$v\"";
$str .= ($this->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 .= "<input type='hidden' name='$n' value='$v'>\n";
+ $str .= "<input type='hidden' name='$n' value=\"$v\">\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 @@
<?php
/* OOHForms: textarea
*
* Copyright (c) 1998 by Jay Bloodworth
*
* $Id: of_textarea.inc,v 1.1.1.1 2004-04-29 10:18:10 adigeo Exp $
*/
class of_textarea extends of_element {
var $rows;
var $cols;
var $wrap;
// Constructor
- function of_textarea($a) {
+ function __construct($a) {
$this->setup_element($a);
}
function self_get($val,$which, &$count) {
$str = "";
$str .= "<textarea name='$this->name'";
$str .= " rows='$this->rows' cols='$this->cols'";
if ($this->wrap)
$str .= " wrap='$this->wrap'";
if ($this->extrahtml)
$str .= " $this->extrahtml";
- $str .= ">" . htmlspecialchars($this->value) ."</textarea>";
+ $str .= ">" . htmlspecialchars($this->value, ENT_COMPAT,'ISO-8859-1', true) ."</textarea>";
$count = 1;
return $str;
}
function self_get_frozen($val,$which, &$count) {
$str = "";
$str .= "<input type='hidden' name='$this->name'";
$str .= " value='$this->value'>\n";
$str .= "<table border=0><tr><td>\n";
$str .= nl2br($this->value);
$str .= "\n</td></tr></table>\n";
$count = 1;
return $str;
}
} // end TEXTAREA
?>
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Tue, Nov 26, 4:33 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3414130
Default Alt Text
(13 KB)
Attached To
Mode
rCDRT CDRTool
Attached
Detach File
Event Timeline
Log In to Comment