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