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