| 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 | ** |
| 10 | ** $Id$ |
| 11 | **/ |
| 12 | |
| 13 | session_start(); |
| 14 | |
| 15 | if (!isset($strings_php)) |
| 16 | include('../functions/strings.php'); |
| 17 | if (!isset($config_php)) |
| 18 | include('../config/config.php'); |
| 19 | if (!isset($page_header_php)) |
| 20 | include('../functions/page_header.php'); |
| 21 | if (!isset($display_messages_php)) |
| 22 | include('../functions/display_messages.php'); |
| 23 | if (!isset($imap_php)) |
| 24 | include('../functions/imap.php'); |
| 25 | if (!isset($array_php)) |
| 26 | include('../functions/array.php'); |
| 27 | if (!isset($i18n_php)) |
| 28 | include('../functions/i18n.php'); |
| 29 | if (!isset($plugin_php)) |
| 30 | include('../functions/plugin.php'); |
| 31 | |
| 32 | |
| 33 | if (! isset($action)) { $action = ''; } |
| 34 | if ($action == 'delete' && isset($theid)) { |
| 35 | removePref($data_dir, $username, "highlight$theid"); |
| 36 | } else if ($action == 'save') { |
| 37 | } |
| 38 | include('../src/load_prefs.php'); |
| 39 | displayPageHeader($color, 'None'); |
| 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 | |
| 49 | $available[1] = _("Checkbox"); |
| 50 | $available[2] = _("From"); |
| 51 | $available[3] = _("Date"); |
| 52 | $available[4] = _("Subject"); |
| 53 | $available[5] = _("Flags"); |
| 54 | $available[6] = _("Size"); |
| 55 | |
| 56 | if (! isset($method)) { $method = ''; } |
| 57 | |
| 58 | if ($method == 'up' && $num > 1) { |
| 59 | $prev = $num-1; |
| 60 | $tmp = $index_order[$prev]; |
| 61 | $index_order[$prev] = $index_order[$num]; |
| 62 | $index_order[$num] = $tmp; |
| 63 | } else if ($method == 'down' && $num < count($index_order)) { |
| 64 | $next = $num++; |
| 65 | $tmp = $index_order[$next]; |
| 66 | $index_order[$next] = $index_order[$num]; |
| 67 | $index_order[$num] = $tmp; |
| 68 | } else if ($method == 'remove' && $num) { |
| 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) { |
| 81 | include ('../src/load_prefs.php'); |
| 82 | } |
| 83 | } else if ($method == 'add' && $add) { |
| 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); |
| 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 | } |
| 96 | echo '<center>'; |
| 97 | echo '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n"; |
| 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."); |
| 99 | echo '</td></tr></table></center><br>'; |
| 100 | |
| 101 | if (count($index_order)) |
| 102 | { |
| 103 | echo '<center>'; |
| 104 | echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n"; |
| 105 | for ($i=1; $i <= count($index_order); $i++) { |
| 106 | $tmp = $index_order[$i]; |
| 107 | echo '<tr>'; |
| 108 | echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n"; |
| 109 | echo '<td><small> | </small></td>' . "\n"; |
| 110 | echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n"; |
| 111 | echo '<td><small> | </small></td>' . "\n"; |
| 112 | echo '<td>'; |
| 113 | // Always show the subject |
| 114 | if ($tmp != 4) |
| 115 | echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>'; |
| 116 | echo "</td>\n"; |
| 117 | echo '<td><small> - </small></td>' . "\n"; |
| 118 | echo '<td>' . $available[$tmp] . "</td>\n"; |
| 119 | echo "</tr>\n"; |
| 120 | } |
| 121 | echo "</table>\n"; |
| 122 | echo '</center>'; |
| 123 | } |
| 124 | |
| 125 | if (count($index_order) != count($available)) { |
| 126 | echo '<center><form name="f" method="post" action="options_order.php">'; |
| 127 | echo '<select name="add">'; |
| 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) { |
| 136 | echo "<option value=\"$i\">$available[$i]</option>"; |
| 137 | } |
| 138 | } |
| 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>'; |
| 143 | } |
| 144 | |
| 145 | echo '<br><center><a href="../src/options.php">' . _("Return to options page") . '</a></center>'; |
| 146 | |
| 147 | ?> |
| 148 | </td></tr></table> |
| 149 | </body></html> |