221ca7bf |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * options_order.php |
5 | * |
6 | * Copyright (c) 1999-2001 The SquirrelMail Development Team |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
9 | * Displays message highlighting options |
10 | * |
11 | * $Id$ |
12 | */ |
13 | |
14 | /*****************************************************************/ |
15 | /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/ |
16 | /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/ |
17 | /*** + Base level indent should begin at left margin, as ***/ |
18 | /*** the require_once below looks. ***/ |
19 | /*** + All identation should consist of four space blocks ***/ |
20 | /*** + Tab characters are evil. ***/ |
21 | /*** + all comments should use "slash-star ... star-slash" ***/ |
22 | /*** style -- no pound characters, no slash-slash style ***/ |
23 | /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/ |
24 | /*** ALWAYS USE { AND } CHARACTERS!!! ***/ |
25 | /*** + Please use ' instead of ", when possible. Note " ***/ |
26 | /*** should always be used in _( ) function calls. ***/ |
27 | /*** Thank you for your help making the SM code more readable. ***/ |
28 | /*****************************************************************/ |
29 | |
30 | require_once('../src/validate.php'); |
31 | require_once('../functions/display_messages.php'); |
32 | require_once('../functions/imap.php'); |
33 | require_once('../functions/array.php'); |
34 | require_once('../functions/plugin.php'); |
221ca7bf |
35 | |
36 | |
e1db998a |
37 | if (! isset($action)) { $action = ''; } |
38 | if ($action == 'delete' && isset($theid)) { |
221ca7bf |
39 | removePref($data_dir, $username, "highlight$theid"); |
e1db998a |
40 | } else if ($action == 'save') { |
221ca7bf |
41 | } |
e1db998a |
42 | displayPageHeader($color, 'None'); |
221ca7bf |
43 | ?> |
44 | <br> |
e7db48af |
45 | <table width=95% align=center border=0 cellpadding=2 cellspacing=0> |
46 | <tr><td align="center" bgcolor="<?php echo $color[0] ?>"> |
221ca7bf |
47 | |
e7db48af |
48 | <b><?php echo _("Options") . " - " . _("Index Order"); ?></b> |
49 | |
50 | <table width="100%" border="0" cellpadding="1" cellspacing="1"> |
51 | <tr><td bgcolor="<?php echo $color[4] ?>" align="center"><br> |
52 | |
53 | <table width=100% cellpadding=2 cellspacing=0 border=0> |
221ca7bf |
54 | <?php |
55 | |
0fba4d30 |
56 | $available[1] = _("Checkbox"); |
57 | $available[2] = _("From"); |
58 | $available[3] = _("Date"); |
59 | $available[4] = _("Subject"); |
60 | $available[5] = _("Flags"); |
61 | $available[6] = _("Size"); |
221ca7bf |
62 | |
e1db998a |
63 | if (! isset($method)) { $method = ''; } |
61423189 |
64 | |
e1db998a |
65 | if ($method == 'up' && $num > 1) { |
221ca7bf |
66 | $prev = $num-1; |
67 | $tmp = $index_order[$prev]; |
68 | $index_order[$prev] = $index_order[$num]; |
69 | $index_order[$num] = $tmp; |
e1db998a |
70 | } else if ($method == 'down' && $num < count($index_order)) { |
221ca7bf |
71 | $next = $num++; |
72 | $tmp = $index_order[$next]; |
73 | $index_order[$next] = $index_order[$num]; |
74 | $index_order[$num] = $tmp; |
e1db998a |
75 | } else if ($method == 'remove' && $num) { |
221ca7bf |
76 | for ($i=1; $i < 8; $i++) { |
77 | removePref($data_dir, $username, "order$i"); |
78 | } |
79 | for ($j=1,$i=1; $i <= count($index_order); $i++) { |
80 | if ($i != $num) { |
81 | $new_ary[$j] = $index_order[$i]; |
82 | $j++; |
83 | } |
84 | } |
85 | $index_order = array(); |
86 | $index_order = $new_ary; |
87 | if (count($index_order) < 1) { |
ff8a98e7 |
88 | include_once('../src/load_prefs.php'); |
221ca7bf |
89 | } |
e1db998a |
90 | } else if ($method == 'add' && $add) { |
6c1feae6 |
91 | // User should not be able to insert PHP-code here |
92 | $add = str_replace ('<?', '..', $add); |
93 | $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add); |
94 | $add = str_replace ('<%', '..', $add); |
221ca7bf |
95 | $index_order[count($index_order)+1] = $add; |
96 | } |
97 | |
98 | if ($method) { |
99 | for ($i=1; $i <= count($index_order); $i++) { |
100 | setPref($data_dir, $username, "order$i", $index_order[$i]); |
101 | } |
102 | } |
e1db998a |
103 | echo '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n"; |
5c54e435 |
104 | 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 |
105 | echo '</td></tr></table><br>'; |
221ca7bf |
106 | |
0fba4d30 |
107 | if (count($index_order)) |
108 | { |
e1db998a |
109 | echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n"; |
0fba4d30 |
110 | for ($i=1; $i <= count($index_order); $i++) { |
111 | $tmp = $index_order[$i]; |
e1db998a |
112 | echo '<tr>'; |
5c54e435 |
113 | echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n"; |
e1db998a |
114 | echo '<td><small> | </small></td>' . "\n"; |
5c54e435 |
115 | echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n"; |
e1db998a |
116 | echo '<td><small> | </small></td>' . "\n"; |
117 | echo '<td>'; |
0fba4d30 |
118 | // Always show the subject |
119 | if ($tmp != 4) |
e1db998a |
120 | echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>'; |
0fba4d30 |
121 | echo "</td>\n"; |
e1db998a |
122 | echo '<td><small> - </small></td>' . "\n"; |
123 | echo '<td>' . $available[$tmp] . "</td>\n"; |
0fba4d30 |
124 | echo "</tr>\n"; |
125 | } |
126 | echo "</table>\n"; |
221ca7bf |
127 | } |
128 | |
129 | if (count($index_order) != count($available)) { |
e7db48af |
130 | echo '<form name="f" method="post" action="options_order.php">'; |
131 | echo '<select name="add">'; |
132 | for ($i=1; $i <= count($available); $i++) { |
133 | $found = false; |
134 | for ($j=1; $j <= count($index_order); $j++) { |
135 | if ($index_order[$j] == $i) { |
136 | $found = true; |
137 | } |
138 | } |
139 | if (!$found) { |
140 | echo "<option value=\"$i\">$available[$i]</option>"; |
221ca7bf |
141 | } |
142 | } |
e7db48af |
143 | echo '</select>'; |
144 | echo '<input type="hidden" value="add" name="method">'; |
145 | echo '<input type="submit" value="'._("Add").'" name="submit">'; |
146 | echo '</form>'; |
221ca7bf |
147 | } |
148 | |
e7db48af |
149 | echo '<p><a href="../src/options.php">' . _("Return to options page") . '</a></p><br>'; |
5c54e435 |
150 | |
221ca7bf |
151 | ?> |
e7db48af |
152 | </td></tr> |
153 | </table> |
154 | |
155 | </td></tr> |
156 | </table> |
157 | |
158 | </td></tr> |
159 | </table> |
35586184 |
160 | </body></html> |