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