added file for sanitizing plugins w.r.t. the foo_once issue
[squirrelmail.git] / functions / options.php
1 <?php
2 /**
3 ** options.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Functions needed to display the options pages.
9 **
10 ** $Id$
11 **/
12
13 function OptionSelect( $title, $name, $data, $default, $show = '', $store = '' ) {
14
15 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
16 "<select name=\"$name\">";
17 foreach( $data as $key => $opt ) {
18 if ( $store == '' ) {
19 $vl = $key;
20 } else{
21 $vl = $opt[$store];
22 }
23 if ( $show == '' ) {
24 $nm = $opt;
25 } else{
26 $nm = $opt[$show];
27 }
28 if ( $nm <> '') {
29 echo "<option value=\"$vl\"";
30 if( $vl == $default ) {
31 echo ' selected';
32 }
33 echo ">$nm</option>\n";
34 }
35 }
36 echo "</select></td></tr>\n";
37
38 }
39
40 function OptionRadio( $title, $name, $data, $default, $show = '', $store = '', $sep = '&nbsp; &nbsp;' ) {
41
42 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>";
43 foreach( $data as $key => $opt ) {
44 if ( $store == '' ) {
45 $vl = $key;
46 } else{
47 $vl = $opt[$store];
48 }
49 if ( $show == '' ) {
50 $nm = $opt;
51 } else{
52 $nm = $opt[$show];
53 }
54 if ( $nm <> '') {
55 echo "<input type=\"radio\" name=\"$name\" value=\"$vl\"";
56 if( $vl == $default ) {
57 echo ' checked';
58 }
59 echo ">$nm $sep\n";
60 }
61 }
62 echo "</td></tr>\n";
63
64 }
65
66 function OptionText( $title, $name, $value, $size ) {
67 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
68 "<input name=\"$name\" value=\"$value\" size=\"$size\">" .
69 "</td></tr>\n";
70 }
71
72 function OptionHidden( $name, $value ) {
73 echo "<INPUT TYPE=HIDDEN NAME=\"$name\" VALUE=\"$value\">\n";
74 }
75
76 function OptionCheck( $title, $name, $value, $comment ) {
77
78 if ( $value )
79 $chk = 'checked';
80 echo "<tr><td align=right valign=middle nowrap>$title: </td><td>" .
81 "<input type=\"checkbox\" name=\"$name\" $chk> $comment" .
82 "</td></tr>\n";
83
84 }
85
86 function OptionTitle( $title ) {
87
88 echo "<tr><td colspan=2 align=left valign=middle nowrap><b>$title</b></td></tr>\n";
89
90 }
91
92 function OptionSubmit( $name ) {
93
94 echo '<tr><td>&nbsp;</td><td><input type="submit" value="' . _("Submit") . '" name="' . $name . '">' .
95 '</td></tr>';
96
97 }
98
99 ?>