221ca7bf |
1 | <?php |
895905c0 |
2 | |
35586184 |
3 | /** |
4 | * options_order.php |
5 | * |
15e6162e |
6 | * Copyright (c) 1999-2002 The SquirrelMail Project Team |
35586184 |
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> |
bd9bbfef |
45 | <table width="95%" align=center border=0 cellpadding=2 cellspacing=0> |
e7db48af |
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> |
221ca7bf |
52 | <?php |
53 | |
0fba4d30 |
54 | $available[1] = _("Checkbox"); |
55 | $available[2] = _("From"); |
56 | $available[3] = _("Date"); |
57 | $available[4] = _("Subject"); |
58 | $available[5] = _("Flags"); |
59 | $available[6] = _("Size"); |
221ca7bf |
60 | |
e1db998a |
61 | if (! isset($method)) { $method = ''; } |
61423189 |
62 | |
e1db998a |
63 | if ($method == 'up' && $num > 1) { |
221ca7bf |
64 | $prev = $num-1; |
65 | $tmp = $index_order[$prev]; |
66 | $index_order[$prev] = $index_order[$num]; |
67 | $index_order[$num] = $tmp; |
e1db998a |
68 | } else if ($method == 'down' && $num < count($index_order)) { |
221ca7bf |
69 | $next = $num++; |
70 | $tmp = $index_order[$next]; |
71 | $index_order[$next] = $index_order[$num]; |
72 | $index_order[$num] = $tmp; |
e1db998a |
73 | } else if ($method == 'remove' && $num) { |
221ca7bf |
74 | for ($i=1; $i < 8; $i++) { |
75 | removePref($data_dir, $username, "order$i"); |
76 | } |
77 | for ($j=1,$i=1; $i <= count($index_order); $i++) { |
78 | if ($i != $num) { |
79 | $new_ary[$j] = $index_order[$i]; |
80 | $j++; |
81 | } |
82 | } |
83 | $index_order = array(); |
84 | $index_order = $new_ary; |
85 | if (count($index_order) < 1) { |
ff8a98e7 |
86 | include_once('../src/load_prefs.php'); |
221ca7bf |
87 | } |
e1db998a |
88 | } else if ($method == 'add' && $add) { |
6c1feae6 |
89 | // User should not be able to insert PHP-code here |
90 | $add = str_replace ('<?', '..', $add); |
91 | $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add); |
92 | $add = str_replace ('<%', '..', $add); |
221ca7bf |
93 | $index_order[count($index_order)+1] = $add; |
94 | } |
95 | |
96 | if ($method) { |
97 | for ($i=1; $i <= count($index_order); $i++) { |
98 | setPref($data_dir, $username, "order$i", $index_order[$i]); |
99 | } |
100 | } |
e1db998a |
101 | echo '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n"; |
5c54e435 |
102 | 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 |
103 | echo '</td></tr></table><br>'; |
221ca7bf |
104 | |
0fba4d30 |
105 | if (count($index_order)) |
106 | { |
e1db998a |
107 | echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n"; |
0fba4d30 |
108 | for ($i=1; $i <= count($index_order); $i++) { |
109 | $tmp = $index_order[$i]; |
e1db998a |
110 | echo '<tr>'; |
5c54e435 |
111 | echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n"; |
e1db998a |
112 | echo '<td><small> | </small></td>' . "\n"; |
5c54e435 |
113 | echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n"; |
e1db998a |
114 | echo '<td><small> | </small></td>' . "\n"; |
115 | echo '<td>'; |
0fba4d30 |
116 | // Always show the subject |
117 | if ($tmp != 4) |
e1db998a |
118 | echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>'; |
0fba4d30 |
119 | echo "</td>\n"; |
e1db998a |
120 | echo '<td><small> - </small></td>' . "\n"; |
121 | echo '<td>' . $available[$tmp] . "</td>\n"; |
0fba4d30 |
122 | echo "</tr>\n"; |
123 | } |
124 | echo "</table>\n"; |
221ca7bf |
125 | } |
126 | |
127 | if (count($index_order) != count($available)) { |
e7db48af |
128 | echo '<form name="f" method="post" action="options_order.php">'; |
129 | echo '<select name="add">'; |
130 | for ($i=1; $i <= count($available); $i++) { |
131 | $found = false; |
132 | for ($j=1; $j <= count($index_order); $j++) { |
133 | if ($index_order[$j] == $i) { |
134 | $found = true; |
135 | } |
136 | } |
137 | if (!$found) { |
138 | echo "<option value=\"$i\">$available[$i]</option>"; |
221ca7bf |
139 | } |
140 | } |
e7db48af |
141 | echo '</select>'; |
142 | echo '<input type="hidden" value="add" name="method">'; |
143 | echo '<input type="submit" value="'._("Add").'" name="submit">'; |
144 | echo '</form>'; |
221ca7bf |
145 | } |
146 | |
e7db48af |
147 | echo '<p><a href="../src/options.php">' . _("Return to options page") . '</a></p><br>'; |
5c54e435 |
148 | |
221ca7bf |
149 | ?> |
e7db48af |
150 | </td></tr> |
151 | </table> |
152 | |
153 | </td></tr> |
154 | </table> |
35586184 |
155 | </body></html> |