221ca7bf |
1 | <?php |
895905c0 |
2 | |
221ca7bf |
3 | /** |
76f9855e |
4 | ** options_order.php |
221ca7bf |
5 | ** |
895905c0 |
6 | ** Copyright (c) 1999-2001 The SquirrelMail development team |
221ca7bf |
7 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | ** |
9 | ** Displays message highlighting options |
10 | ** |
245a6892 |
11 | ** $Id$ |
221ca7bf |
12 | **/ |
13 | |
ff8a98e7 |
14 | require_once('../src/validate.php'); |
15 | require_once('../functions/display_messages.php'); |
16 | require_once('../functions/imap.php'); |
17 | require_once('../functions/array.php'); |
18 | require_once('../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 | displayPageHeader($color, 'None'); |
221ca7bf |
27 | ?> |
28 | <br> |
e7db48af |
29 | <table width=95% align=center border=0 cellpadding=2 cellspacing=0> |
30 | <tr><td align="center" bgcolor="<?php echo $color[0] ?>"> |
221ca7bf |
31 | |
e7db48af |
32 | <b><?php echo _("Options") . " - " . _("Index Order"); ?></b> |
33 | |
34 | <table width="100%" border="0" cellpadding="1" cellspacing="1"> |
35 | <tr><td bgcolor="<?php echo $color[4] ?>" align="center"><br> |
36 | |
37 | <table width=100% cellpadding=2 cellspacing=0 border=0> |
221ca7bf |
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) { |
ff8a98e7 |
72 | include_once('../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 '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n"; |
5c54e435 |
88 | 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."); |
e7db48af |
89 | echo '</td></tr></table><br>'; |
221ca7bf |
90 | |
0fba4d30 |
91 | if (count($index_order)) |
92 | { |
e1db998a |
93 | echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n"; |
0fba4d30 |
94 | for ($i=1; $i <= count($index_order); $i++) { |
95 | $tmp = $index_order[$i]; |
e1db998a |
96 | echo '<tr>'; |
5c54e435 |
97 | echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n"; |
e1db998a |
98 | echo '<td><small> | </small></td>' . "\n"; |
5c54e435 |
99 | echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n"; |
e1db998a |
100 | echo '<td><small> | </small></td>' . "\n"; |
101 | echo '<td>'; |
0fba4d30 |
102 | // Always show the subject |
103 | if ($tmp != 4) |
e1db998a |
104 | echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>'; |
0fba4d30 |
105 | echo "</td>\n"; |
e1db998a |
106 | echo '<td><small> - </small></td>' . "\n"; |
107 | echo '<td>' . $available[$tmp] . "</td>\n"; |
0fba4d30 |
108 | echo "</tr>\n"; |
109 | } |
110 | echo "</table>\n"; |
221ca7bf |
111 | } |
112 | |
113 | if (count($index_order) != count($available)) { |
e7db48af |
114 | echo '<form name="f" method="post" action="options_order.php">'; |
115 | echo '<select name="add">'; |
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) { |
124 | echo "<option value=\"$i\">$available[$i]</option>"; |
221ca7bf |
125 | } |
126 | } |
e7db48af |
127 | echo '</select>'; |
128 | echo '<input type="hidden" value="add" name="method">'; |
129 | echo '<input type="submit" value="'._("Add").'" name="submit">'; |
130 | echo '</form>'; |
221ca7bf |
131 | } |
132 | |
e7db48af |
133 | echo '<p><a href="../src/options.php">' . _("Return to options page") . '</a></p><br>'; |
5c54e435 |
134 | |
221ca7bf |
135 | ?> |
e7db48af |
136 | </td></tr> |
137 | </table> |
138 | |
139 | </td></tr> |
140 | </table> |
141 | |
142 | </td></tr> |
143 | </table> |
ff8a98e7 |
144 | </body></html> |