Removed a lot of the warnings generated when PHP has all warnings enabled.
[squirrelmail.git] / src / options_order.php
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($config_php))
16 include("../config/config.php");
17 if (!isset($strings_php))
18 include("../functions/strings.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 ($action == "delete" && isset($theid)) {
34 removePref($data_dir, $username, "highlight$theid");
35 } else if ($action == "save") {
36 }
37 include("../src/load_prefs.php");
38 displayPageHeader($color, "None");
39 ?>
40 <br>
41 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
42 <center><b><?php echo _("Options") . " - " . _("Index Order"); ?></b></center>
43 </td></tr></table>
44
45 <table width=95% align=center border=0><tr><td>
46 <?php
47
48 $available[1] = _("Checkbox");
49 $available[2] = _("From");
50 $available[3] = _("Date");
51 $available[4] = _("Subject");
52 $available[5] = _("Flags");
53 $available[6] = _("Size");
54
55 if ($method == "up" && $num > 1) {
56 $prev = $num-1;
57 $tmp = $index_order[$prev];
58 $index_order[$prev] = $index_order[$num];
59 $index_order[$num] = $tmp;
60 } else if ($method == "down" && $num < count($index_order)) {
61 $next = $num++;
62 $tmp = $index_order[$next];
63 $index_order[$next] = $index_order[$num];
64 $index_order[$num] = $tmp;
65 } else if ($method == "remove" && $num) {
66 for ($i=1; $i < 8; $i++) {
67 removePref($data_dir, $username, "order$i");
68 }
69 for ($j=1,$i=1; $i <= count($index_order); $i++) {
70 if ($i != $num) {
71 $new_ary[$j] = $index_order[$i];
72 $j++;
73 }
74 }
75 $index_order = array();
76 $index_order = $new_ary;
77 if (count($index_order) < 1) {
78 include "../src/load_prefs.php";
79 }
80 } else if ($method == "add" && $add) {
81 $index_order[count($index_order)+1] = $add;
82 }
83
84 if ($method) {
85 for ($i=1; $i <= count($index_order); $i++) {
86 setPref($data_dir, $username, "order$i", $index_order[$i]);
87 }
88 }
89 echo "<center>";
90 echo "<table cellspacing=0 cellpadding=0 border=0 width=65%><tr><td>\n";
91 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.");
92 echo "</td></tr></table></center><br>";
93
94 if (count($index_order))
95 {
96 echo "<center>";
97 echo "<table cellspacing=0 cellpadding=0 border=0>\n";
98 for ($i=1; $i <= count($index_order); $i++) {
99 $tmp = $index_order[$i];
100 echo "<tr>";
101 echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n";
102 echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
103 echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n";
104 echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
105 echo "<td>";
106 // Always show the subject
107 if ($tmp != 4)
108 echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . "</a></small>";
109 echo "</td>\n";
110 echo "<td><small>&nbsp;-&nbsp;</small></td>\n";
111 echo "<td>" . $available[$tmp] . "</td>\n";
112 echo "</tr>\n";
113 }
114 echo "</table>\n";
115 echo "</center>";
116 }
117
118 if (count($index_order) != count($available)) {
119 echo "<center><form name=f method=post action=options_order.php>";
120 echo "<select name=add>";
121 for ($i=1; $i <= count($available); $i++) {
122 $found = false;
123 for ($j=1; $j <= count($index_order); $j++) {
124 if ($index_order[$j] == $i) {
125 $found = true;
126 }
127 }
128 if (!$found) {
129 echo "<option value=$i>$available[$i]</option>";
130 }
131 }
132 echo "</select>";
133 echo "<input type=hidden value=add name=method>";
134 echo "<input type=submit value=\""._("Add")."\" name=submit>";
135 echo "</form></center>";
136 }
137
138 echo "<br><center><a href=\"../src/options.php\">" . _("Return to options page") . "</a></center>";
139
140 ?>
141 </td></tr></table>
142 </body></html>