JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added tem_prepend(), format_email() trim()s
[wfpl.git] / format.php
index 1586ff0..99a67b7 100644 (file)
@@ -33,8 +33,11 @@ function format_options($str, $name) {
                die("Couldn't find options for \"$name\". Be sure to call pulldown().");
        }
 
-       if(!in_array($str, array_keys($GLOBALS[$name . '_options']['options']))) {
-               return '';
+       foreach($GLOBALS[$name . '_options']['options'] as $keyval) {
+               list($key, $value) = $keyval;
+               if($str == $key) {
+                       return $str;
+               }
        }
 
        return $str;
@@ -42,7 +45,7 @@ function format_options($str, $name) {
 
 function format_int($str) {
        $str = ereg_replace('[^0-9]', '', $str);
-       return ereg_replace('^0*([1-9])', '\1', $str);
+       return ereg_replace('^0*([0-9])', '\1', $str);
 }
 
 function format_decimal($str) {
@@ -109,7 +112,7 @@ function format_yesno($str) {
 
 function format_email($str) {
        # FIXME
-       return format_oneline($str);
+       return trim(format_oneline($str));
 }
 
 function format_url($str) {