Applied patch #102205 + some extra code to fix bug #121006.
[squirrelmail.git] / src / options_order.php
CommitLineData
221ca7bf 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 **/
11
12 session_start();
13
14 if (!isset($config_php))
15 include("../config/config.php");
16 if (!isset($strings_php))
17 include("../functions/strings.php");
18 if (!isset($page_header_php))
19 include("../functions/page_header.php");
20 if (!isset($display_messages_php))
21 include("../functions/display_messages.php");
22 if (!isset($imap_php))
23 include("../functions/imap.php");
24 if (!isset($array_php))
25 include("../functions/array.php");
26 if (!isset($i18n_php))
27 include("../functions/i18n.php");
28 if (!isset($plugin_php))
29 include("../functions/plugin.php");
30
31
32 if ($action == "delete" && isset($theid)) {
33 removePref($data_dir, $username, "highlight$theid");
34 } else if ($action == "save") {
35 }
36 include("../src/load_prefs.php");
37 displayPageHeader($color, "None");
38?>
39 <br>
40 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
41 <center><b><?php echo _("Options") . " - " . _("Index Order"); ?></b></center>
42 </td></tr></table>
43
44 <table width=95% align=center border=0><tr><td>
45<?php
46
0fba4d30 47 $available[1] = _("Checkbox");
48 $available[2] = _("From");
49 $available[3] = _("Date");
50 $available[4] = _("Subject");
51 $available[5] = _("Flags");
52 $available[6] = _("Size");
221ca7bf 53
54 if ($method == "up" && $num > 1) {
55 $prev = $num-1;
56 $tmp = $index_order[$prev];
57 $index_order[$prev] = $index_order[$num];
58 $index_order[$num] = $tmp;
59 } else if ($method == "down" && $num < count($index_order)) {
60 $next = $num++;
61 $tmp = $index_order[$next];
62 $index_order[$next] = $index_order[$num];
63 $index_order[$num] = $tmp;
64 } else if ($method == "remove" && $num) {
65 for ($i=1; $i < 8; $i++) {
66 removePref($data_dir, $username, "order$i");
67 }
68 for ($j=1,$i=1; $i <= count($index_order); $i++) {
69 if ($i != $num) {
70 $new_ary[$j] = $index_order[$i];
71 $j++;
72 }
73 }
74 $index_order = array();
75 $index_order = $new_ary;
76 if (count($index_order) < 1) {
77 include "../src/load_prefs.php";
78 }
79 } else if ($method == "add" && $add) {
80 $index_order[count($index_order)+1] = $add;
81 }
82
83 if ($method) {
84 for ($i=1; $i <= count($index_order); $i++) {
85 setPref($data_dir, $username, "order$i", $index_order[$i]);
86 }
87 }
88
0fba4d30 89 if (count($index_order))
90 {
91 echo "<table cellspacing=0 cellpadding=0 border=0>\n";
92 for ($i=1; $i <= count($index_order); $i++) {
93 $tmp = $index_order[$i];
94 echo "<tr>";
95 echo "<td><small><a href=\"options_order.php?method=up&num=$i\">up</a></small></td>\n";
96 echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
97 echo "<td><small><a href=\"options_order.php?method=down&num=$i\">down</a></small></td>\n";
98 echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
99 echo "<td>";
100 // Always show the subject
101 if ($tmp != 4)
102 echo "<small><a href=\"options_order.php?method=remove&num=$i\">remove</a></small>";
103 echo "</td>\n";
104 echo "<td><small>&nbsp;-&nbsp;</small></td>\n";
105 echo "<td>" . $available[$tmp] . "</td>\n";
106 echo "</tr>\n";
107 }
108 echo "</table>\n";
221ca7bf 109 }
110
111 if (count($index_order) != count($available)) {
112 echo "<form name=f method=post action=options_order.php>";
113 echo "<select name=add>";
114 for ($i=1; $i <= count($available); $i++) {
115 $found = false;
116 for ($j=1; $j <= count($index_order); $j++) {
117 if ($index_order[$j] == $i) {
118 $found = true;
119 }
120 }
121 if (!$found) {
122 echo "<option value=$i>$available[$i]</option>";
123 }
124 }
125 echo "</select>";
126 echo "<input type=hidden value=add name=method>";
127 echo "<input type=submit value=\""._("Add")."\" name=submit>";
128 echo "</form>";
129 }
130
131?>
132 </td></tr></table>
133</body></html>