Merged changes form main trunk up to 2.2.4
[fa-stable.git] / includes / ui / ui_input.inc
index 298b964401aa7cda0aa880961ec0c6a887596c3f..b27f5fde11ae787a486fc4fa73ecce2556dca591 100644 (file)
@@ -75,7 +75,7 @@ function simple_page_mode($numeric_id = true)
 //
 //     Read numeric value from user formatted input
 //
-function input_num($postname=null, $dflt=null)
+function input_num($postname=null, $dflt=0)
 {
        if (!isset($_POST[$postname]) || $_POST[$postname] == "")
                return $dflt;
@@ -154,9 +154,9 @@ function submit($name, $value, $echo=true, $title=false, $atype=false, $icon=fal
 
 function submit_center($name, $value, $echo=true, $title=false, $async=false, $icon=false)
 {
-       echo "<center>";
+       if ($echo) echo "<center>";
        submit($name, $value, $echo, $title, $async, $icon);
-       echo "</center>";
+       if ($echo) echo "</center>";
 }
 
 function submit_center_first($name, $value, $title=false, $async=false, $icon=false)
@@ -241,7 +241,8 @@ function submit_return($name, $value, $title=false)
 
 function submit_js_confirm($name, $msg) {
        add_js_source(
-               "_validate.$name=function(){ return confirm('$msg');};");
+               "_validate.$name=function(){ return confirm('"
+                       . strtr($msg, array("\n"=>'\\n')) . "');};");
 };
 //-----------------------------------------------------------------------------------