221ca7bf |
1 | <?php |
2 | /** |
3 | ** options_highlight.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 | ** Displays message highlighting options |
9 | ** |
245a6892 |
10 | ** $Id$ |
221ca7bf |
11 | **/ |
12 | |
f740c049 |
13 | include('../src/validate.php'); |
14 | include('../functions/strings.php'); |
15 | include('../config/config.php'); |
16 | include('../functions/page_header.php'); |
17 | include('../functions/display_messages.php'); |
18 | include('../functions/imap.php'); |
19 | include('../functions/array.php'); |
20 | include('../functions/i18n.php'); |
21 | include('../functions/plugin.php'); |
221ca7bf |
22 | |
23 | |
e1db998a |
24 | if (! isset($action)) { $action = ''; } |
25 | if ($action == 'delete' && isset($theid)) { |
221ca7bf |
26 | removePref($data_dir, $username, "highlight$theid"); |
e1db998a |
27 | } else if ($action == 'save') { |
221ca7bf |
28 | } |
e1db998a |
29 | include('../src/load_prefs.php'); |
30 | displayPageHeader($color, 'None'); |
221ca7bf |
31 | ?> |
32 | <br> |
33 | <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>"> |
34 | <center><b><?php echo _("Options") . " - " . _("Index Order"); ?></b></center> |
35 | </td></tr></table> |
36 | |
37 | <table width=95% align=center border=0><tr><td> |
38 | <?php |
39 | |
0fba4d30 |
40 | $available[1] = _("Checkbox"); |
41 | $available[2] = _("From"); |
42 | $available[3] = _("Date"); |
43 | $available[4] = _("Subject"); |
44 | $available[5] = _("Flags"); |
45 | $available[6] = _("Size"); |
221ca7bf |
46 | |
e1db998a |
47 | if (! isset($method)) { $method = ''; } |
61423189 |
48 | |
e1db998a |
49 | if ($method == 'up' && $num > 1) { |
221ca7bf |
50 | $prev = $num-1; |
51 | $tmp = $index_order[$prev]; |
52 | $index_order[$prev] = $index_order[$num]; |
53 | $index_order[$num] = $tmp; |
e1db998a |
54 | } else if ($method == 'down' && $num < count($index_order)) { |
221ca7bf |
55 | $next = $num++; |
56 | $tmp = $index_order[$next]; |
57 | $index_order[$next] = $index_order[$num]; |
58 | $index_order[$num] = $tmp; |
e1db998a |
59 | } else if ($method == 'remove' && $num) { |
221ca7bf |
60 | for ($i=1; $i < 8; $i++) { |
61 | removePref($data_dir, $username, "order$i"); |
62 | } |
63 | for ($j=1,$i=1; $i <= count($index_order); $i++) { |
64 | if ($i != $num) { |
65 | $new_ary[$j] = $index_order[$i]; |
66 | $j++; |
67 | } |
68 | } |
69 | $index_order = array(); |
70 | $index_order = $new_ary; |
71 | if (count($index_order) < 1) { |
e1db998a |
72 | include ('../src/load_prefs.php'); |
221ca7bf |
73 | } |
e1db998a |
74 | } else if ($method == 'add' && $add) { |
6c1feae6 |
75 | // User should not be able to insert PHP-code here |
76 | $add = str_replace ('<?', '..', $add); |
77 | $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add); |
78 | $add = str_replace ('<%', '..', $add); |
221ca7bf |
79 | $index_order[count($index_order)+1] = $add; |
80 | } |
81 | |
82 | if ($method) { |
83 | for ($i=1; $i <= count($index_order); $i++) { |
84 | setPref($data_dir, $username, "order$i", $index_order[$i]); |
85 | } |
86 | } |
e1db998a |
87 | echo '<center>'; |
88 | echo '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n"; |
5c54e435 |
89 | echo _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs."); |
e1db998a |
90 | echo '</td></tr></table></center><br>'; |
221ca7bf |
91 | |
0fba4d30 |
92 | if (count($index_order)) |
93 | { |
e1db998a |
94 | echo '<center>'; |
95 | echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n"; |
0fba4d30 |
96 | for ($i=1; $i <= count($index_order); $i++) { |
97 | $tmp = $index_order[$i]; |
e1db998a |
98 | echo '<tr>'; |
5c54e435 |
99 | echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n"; |
e1db998a |
100 | echo '<td><small> | </small></td>' . "\n"; |
5c54e435 |
101 | echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n"; |
e1db998a |
102 | echo '<td><small> | </small></td>' . "\n"; |
103 | echo '<td>'; |
0fba4d30 |
104 | // Always show the subject |
105 | if ($tmp != 4) |
e1db998a |
106 | echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>'; |
0fba4d30 |
107 | echo "</td>\n"; |
e1db998a |
108 | echo '<td><small> - </small></td>' . "\n"; |
109 | echo '<td>' . $available[$tmp] . "</td>\n"; |
0fba4d30 |
110 | echo "</tr>\n"; |
111 | } |
112 | echo "</table>\n"; |
e1db998a |
113 | echo '</center>'; |
221ca7bf |
114 | } |
115 | |
116 | if (count($index_order) != count($available)) { |
e1db998a |
117 | echo '<center><form name="f" method="post" action="options_order.php">'; |
118 | echo '<select name="add">'; |
221ca7bf |
119 | for ($i=1; $i <= count($available); $i++) { |
120 | $found = false; |
121 | for ($j=1; $j <= count($index_order); $j++) { |
122 | if ($index_order[$j] == $i) { |
123 | $found = true; |
124 | } |
125 | } |
126 | if (!$found) { |
e1db998a |
127 | echo "<option value=\"$i\">$available[$i]</option>"; |
221ca7bf |
128 | } |
129 | } |
e1db998a |
130 | echo '</select>'; |
131 | echo '<input type="hidden" value="add" name="method">'; |
132 | echo '<input type="submit" value="'._("Add").'" name="submit">'; |
133 | echo '</form></center>'; |
221ca7bf |
134 | } |
135 | |
e1db998a |
136 | echo '<br><center><a href="../src/options.php">' . _("Return to options page") . '</a></center>'; |
5c54e435 |
137 | |
221ca7bf |
138 | ?> |
139 | </td></tr></table> |
140 | </body></html> |