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 | |
86725763 |
14 | /* Path for SquirrelMail required files. */ |
15 | define('SM_PATH','../'); |
16 | |
17 | /* SquirrelMail required files. */ |
08185f2a |
18 | require_once(SM_PATH . 'include/validate.php'); |
86725763 |
19 | require_once(SM_PATH . 'functions/display_messages.php'); |
20 | require_once(SM_PATH . 'functions/imap.php'); |
86725763 |
21 | require_once(SM_PATH . 'functions/plugin.php'); |
22 | require_once(SM_PATH . 'functions/html.php'); |
221ca7bf |
23 | |
fe369c70 |
24 | /* get globals */ |
25 | if (isset($_GET['action'])) { |
26 | $action = $_GET['action']; |
27 | } |
28 | if (isset($_GET['num'])) { |
29 | $num = $_GET['num']; |
30 | } |
31 | if (isset($_GET['method'])) { |
32 | $method = $_GET['method']; |
33 | } |
34 | elseif (isset($_POST['method'])) { |
35 | $method = $_POST['method']; |
36 | } |
37 | if (isset($_POST['add'])) { |
38 | $add = $_POST['add']; |
39 | } |
40 | if (isset($_GET['submit'])) { |
41 | $submit = $_GET['submit']; |
42 | } |
43 | elseif (isset($_POST['submit'])) { |
44 | $submit = $_POST['submit']; |
45 | } |
46 | /* end of get globals */ |
47 | |
32f4e318 |
48 | if (! isset($action)) { $action = ''; } |
49 | if ($action == 'delete' && isset($theid)) { |
50 | removePref($data_dir, $username, "highlight$theid"); |
51 | } elseif ($action == 'save') { |
52 | } |
53 | displayPageHeader($color, 'None'); |
e7db48af |
54 | |
6206f6c4 |
55 | echo |
56 | html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) . |
545238b1 |
57 | html_tag( 'tr' ) . |
58 | html_tag( 'td', '', 'center', $color[0] ) . |
59 | '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' . |
6206f6c4 |
60 | html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) . |
545238b1 |
61 | html_tag( 'tr' ) . |
62 | html_tag( 'td', '', 'center', $color[4] ); |
32f4e318 |
63 | |
64 | $available[1] = _("Checkbox"); |
65 | $available[2] = _("From"); |
66 | $available[3] = _("Date"); |
67 | $available[4] = _("Subject"); |
68 | $available[5] = _("Flags"); |
69 | $available[6] = _("Size"); |
70 | |
71 | if (! isset($method)) { $method = ''; } |
72 | |
73 | if ($method == 'up' && $num > 1) { |
74 | $prev = $num-1; |
75 | $tmp = $index_order[$prev]; |
76 | $index_order[$prev] = $index_order[$num]; |
77 | $index_order[$num] = $tmp; |
78 | } else if ($method == 'down' && $num < count($index_order)) { |
79 | $next = $num++; |
80 | $tmp = $index_order[$next]; |
81 | $index_order[$next] = $index_order[$num]; |
82 | $index_order[$num] = $tmp; |
83 | } else if ($method == 'remove' && $num) { |
84 | for ($i=1; $i < 8; $i++) { |
85 | removePref($data_dir, $username, "order$i"); |
86 | } |
87 | for ($j=1,$i=1; $i <= count($index_order); $i++) { |
88 | if ($i != $num) { |
89 | $new_ary[$j] = $index_order[$i]; |
90 | $j++; |
91 | } |
92 | } |
93 | $index_order = array(); |
94 | $index_order = $new_ary; |
95 | if (count($index_order) < 1) { |
96 | include_once('../src/load_prefs.php'); |
97 | } |
98 | } else if ($method == 'add' && $add) { |
99 | /* User should not be able to insert PHP-code here */ |
100 | $add = str_replace ('<?', '..', $add); |
101 | $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add); |
102 | $add = str_replace ('<%', '..', $add); |
103 | $index_order[count($index_order)+1] = $add; |
104 | } |
105 | |
106 | if ($method) { |
107 | for ($i=1; $i <= count($index_order); $i++) { |
108 | setPref($data_dir, $username, "order$i", $index_order[$i]); |
109 | } |
110 | } |
545238b1 |
111 | echo html_tag( 'table', |
112 | html_tag( 'tr', |
113 | html_tag( 'td', |
114 | _("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.") |
115 | ) |
116 | ) , |
117 | '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n"; |
32f4e318 |
118 | |
119 | if (count($index_order)) |
120 | { |
545238b1 |
121 | echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n"; |
32f4e318 |
122 | for ($i=1; $i <= count($index_order); $i++) { |
123 | $tmp = $index_order[$i]; |
545238b1 |
124 | echo html_tag( 'tr' ); |
125 | echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' ); |
126 | echo html_tag( 'td', '<small> | </small>' ); |
127 | echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' ); |
128 | echo html_tag( 'td', '<small> | </small>' ); |
129 | echo html_tag( 'td' ); |
32f4e318 |
130 | /* Always show the subject */ |
131 | if ($tmp != 4) |
545238b1 |
132 | echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>'; |
133 | else |
134 | echo ' '; |
135 | echo '</td>'; |
136 | echo html_tag( 'td', '<small> - </small>' ); |
137 | echo html_tag( 'td', $available[$tmp] ); |
138 | echo '</tr>' . "\n"; |
32f4e318 |
139 | } |
545238b1 |
140 | echo '</table>' . "\n"; |
32f4e318 |
141 | } |
142 | |
143 | if (count($index_order) != count($available)) { |
144 | echo '<form name="f" method="post" action="options_order.php">'; |
145 | echo '<select name="add">'; |
146 | for ($i=1; $i <= count($available); $i++) { |
147 | $found = false; |
148 | for ($j=1; $j <= count($index_order); $j++) { |
149 | if ($index_order[$j] == $i) { |
150 | $found = true; |
151 | } |
e7db48af |
152 | } |
32f4e318 |
153 | if (!$found) { |
154 | echo "<option value=\"$i\">$available[$i]</option>"; |
155 | } |
156 | } |
157 | echo '</select>'; |
158 | echo '<input type="hidden" value="add" name="method">'; |
159 | echo '<input type="submit" value="'._("Add").'" name="submit">'; |
160 | echo '</form>'; |
161 | } |
162 | |
545238b1 |
163 | echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' ); |
5c54e435 |
164 | |
221ca7bf |
165 | ?> |
e7db48af |
166 | </td></tr> |
167 | </table> |
168 | |
169 | </td></tr> |
170 | </table> |
5e9e90fd |
171 | </body></html> |