6 * Copyright (c) 1999-2001 The SquirrelMail Development Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays message highlighting options
14 /*****************************************************************/
15 /*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!! ***/
16 /*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION. ***/
17 /*** + Base level indent should begin at left margin, as ***/
18 /*** the require_once below looks. ***/
19 /*** + All identation should consist of four space blocks ***/
20 /*** + Tab characters are evil. ***/
21 /*** + all comments should use "slash-star ... star-slash" ***/
22 /*** style -- no pound characters, no slash-slash style ***/
23 /*** + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD ***/
24 /*** ALWAYS USE { AND } CHARACTERS!!! ***/
25 /*** + Please use ' instead of ", when possible. Note " ***/
26 /*** should always be used in _( ) function calls. ***/
27 /*** Thank you for your help making the SM code more readable. ***/
28 /*****************************************************************/
30 require_once('../src/validate.php');
31 require_once('../functions/display_messages.php');
32 require_once('../functions/imap.php');
33 require_once('../functions/array.php');
34 require_once('../functions/plugin.php');
37 if (! isset($action)) { $action = ''; }
38 if ($action == 'delete' && isset($theid)) {
39 removePref($data_dir, $username, "highlight$theid");
40 } else if ($action == 'save') {
42 displayPageHeader($color, 'None');
45 <table width
=95% align
=center border
=0 cellpadding
=2 cellspacing
=0>
46 <tr
><td align
="center" bgcolor
="<?php echo $color[0] ?>">
48 <b
><?php
echo _("Options") . " - " . _("Index Order"); ?
></b
>
50 <table width
="100%" border
="0" cellpadding
="1" cellspacing
="1">
51 <tr
><td bgcolor
="<?php echo $color[4] ?>" align
="center"><br
>
53 <table width
=100% cellpadding
=2 cellspacing
=0 border
=0>
56 $available[1] = _("Checkbox");
57 $available[2] = _("From");
58 $available[3] = _("Date");
59 $available[4] = _("Subject");
60 $available[5] = _("Flags");
61 $available[6] = _("Size");
63 if (! isset($method)) { $method = ''; }
65 if ($method == 'up' && $num > 1) {
67 $tmp = $index_order[$prev];
68 $index_order[$prev] = $index_order[$num];
69 $index_order[$num] = $tmp;
70 } else if ($method == 'down' && $num < count($index_order)) {
72 $tmp = $index_order[$next];
73 $index_order[$next] = $index_order[$num];
74 $index_order[$num] = $tmp;
75 } else if ($method == 'remove' && $num) {
76 for ($i=1; $i < 8; $i++
) {
77 removePref($data_dir, $username, "order$i");
79 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
81 $new_ary[$j] = $index_order[$i];
85 $index_order = array();
86 $index_order = $new_ary;
87 if (count($index_order) < 1) {
88 include_once('../src/load_prefs.php');
90 } else if ($method == 'add' && $add) {
91 // User should not be able to insert PHP-code here
92 $add = str_replace ('<?', '..', $add);
93 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
94 $add = str_replace ('<%', '..', $add);
95 $index_order[count($index_order)+
1] = $add;
99 for ($i=1; $i <= count($index_order); $i++
) {
100 setPref($data_dir, $username, "order$i", $index_order[$i]);
103 echo '<table cellspacing="0" cellpadding="0" border="0" width="65%"><tr><td>' . "\n";
104 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.");
105 echo '</td></tr></table><br>';
107 if (count($index_order))
109 echo '<table cellspacing="0" cellpadding="0" border="0">' . "\n";
110 for ($i=1; $i <= count($index_order); $i++
) {
111 $tmp = $index_order[$i];
113 echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n";
114 echo '<td><small> | </small></td>' . "\n";
115 echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n";
116 echo '<td><small> | </small></td>' . "\n";
118 // Always show the subject
120 echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . '</a></small>';
122 echo '<td><small> - </small></td>' . "\n";
123 echo '<td>' . $available[$tmp] . "</td>\n";
129 if (count($index_order) != count($available)) {
130 echo '<form name="f" method="post" action="options_order.php">';
131 echo '<select name="add">';
132 for ($i=1; $i <= count($available); $i++
) {
134 for ($j=1; $j <= count($index_order); $j++
) {
135 if ($index_order[$j] == $i) {
140 echo "<option value=\"$i\">$available[$i]</option>";
144 echo '<input type="hidden" value="add" name="method">';
145 echo '<input type="submit" value="'._("Add").'" name="submit">';
149 echo '<p><a href="../src/options.php">' . _("Return to options page") . '</a></p><br>';