Mercurial > hg > fapweb
diff msite.inc.php @ 26:7be3f8cf1f7a
Lots of cleanups, preparing for adding entry submission support.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 08 Dec 2012 04:57:32 +0200 |
parents | 5bc8bd5c7ecc |
children | 36392d1d6b5f |
line wrap: on
line diff
--- a/msite.inc.php Fri Dec 07 23:31:23 2012 +0200 +++ b/msite.inc.php Sat Dec 08 04:57:32 2012 +0200 @@ -14,7 +14,6 @@ define("VT_TEXT", 4); - function stError($msg) { global $errorSet, $errorMsg; @@ -106,7 +105,7 @@ } -function stVoteSessionAuth() +function stUserSessionAuth() { if (@session_start() === TRUE && isset($_SESSION["key"]) && isset($_SESSION["votes"])) return stSessionExpire("voteTimeout"); @@ -115,7 +114,7 @@ } -function stVoteSessionStart() +function stUserSessionStart() { if (@session_start() === TRUE) { @@ -128,7 +127,7 @@ } -function stSetVoteStatus($st) +function stSetSessionStatus($st) { $_SESSION["status"] = $st; } @@ -219,11 +218,20 @@ } +function stGetFormRadioButtonInput($name, $id, $prefix, $value, $checked, $label, $extra = "") +{ + return + "<input ".$extra." type=\"radio\" ".stGetIDName($name, $id, $prefix). + ($checked ? "checked=\"checked\" " : "")." value=\"".$value."\" />". + ($label != "" ? "<label for=\"".$name."\">".$label."</label>" : ""); +} + + function stGetFormButtonInput($name, $id, $prefix, $label, $onclick = "") { return "<input type=\"button\" ".stGetIDName($name, $id, $prefix). - "value=\"".$label."\" ". + "value=\" ".chentities($label)." \" ". ($onclick != "" ? "onClick=\"".$onclick."\"" : "")." />"; } @@ -255,6 +263,15 @@ } +function stGetFormSubmitInput($name, $label, $onclick = "") +{ + return + "<input type=\"submit\" name=\"".$name. + "\" value=\" ".chentities($label)." \" ". + ($onclick != "" ? "onClick=\"".$onclick."\"" : "")." />"; +} + + function stGetFormHiddenInput($name, $value) { return @@ -263,6 +280,15 @@ } +function stGetFormStart($name, $action = "", $method = "post") +{ + return + "<form name=\"".$name."\" action=\"". + ($action != "" ? $action : $name). + "\" method=\"".$method."\">\n"; +} + + function stGetTDEditTextItem($edit, $size, $len, $name, $id, $prefix, $value, $extra = "") { return @@ -348,6 +374,12 @@ } +function stGetSessionItem($name, $default = "") +{ + return isset($_SESSION[$name]) ? trim($_SESSION[$name]) : $default; +} + + function stLogSQLError($sql) { global $db;