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