6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays message highlighting options
14 /* Path for SquirrelMail required files. */
15 define('SM_PATH','../');
17 /* SquirrelMail required files. */
18 require_once(SM_PATH
. 'include/validate.php');
19 require_once(SM_PATH
. 'functions/display_messages.php');
20 require_once(SM_PATH
. 'functions/imap.php');
21 require_once(SM_PATH
. 'functions/array.php');
22 require_once(SM_PATH
. 'functions/plugin.php');
23 require_once(SM_PATH
. 'functions/html.php');
25 if (! isset($action)) { $action = ''; }
26 if ($action == 'delete' && isset($theid)) {
27 removePref($data_dir, $username, "highlight$theid");
28 } elseif ($action == 'save') {
30 displayPageHeader($color, 'None');
33 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
35 html_tag( 'td', '', 'center', $color[0] ) .
36 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
37 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
39 html_tag( 'td', '', 'center', $color[4] );
41 $available[1] = _("Checkbox");
42 $available[2] = _("From");
43 $available[3] = _("Date");
44 $available[4] = _("Subject");
45 $available[5] = _("Flags");
46 $available[6] = _("Size");
48 if (! isset($method)) { $method = ''; }
50 if ($method == 'up' && $num > 1) {
52 $tmp = $index_order[$prev];
53 $index_order[$prev] = $index_order[$num];
54 $index_order[$num] = $tmp;
55 } else if ($method == 'down' && $num < count($index_order)) {
57 $tmp = $index_order[$next];
58 $index_order[$next] = $index_order[$num];
59 $index_order[$num] = $tmp;
60 } else if ($method == 'remove' && $num) {
61 for ($i=1; $i < 8; $i++
) {
62 removePref($data_dir, $username, "order$i");
64 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
66 $new_ary[$j] = $index_order[$i];
70 $index_order = array();
71 $index_order = $new_ary;
72 if (count($index_order) < 1) {
73 include_once('../src/load_prefs.php');
75 } else if ($method == 'add' && $add) {
76 /* User should not be able to insert PHP-code here */
77 $add = str_replace ('<?', '..', $add);
78 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
79 $add = str_replace ('<%', '..', $add);
80 $index_order[count($index_order)+
1] = $add;
84 for ($i=1; $i <= count($index_order); $i++
) {
85 setPref($data_dir, $username, "order$i", $index_order[$i]);
88 echo html_tag( 'table',
91 _("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.")
94 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
96 if (count($index_order))
98 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
99 for ($i=1; $i <= count($index_order); $i++
) {
100 $tmp = $index_order[$i];
101 echo html_tag( 'tr' );
102 echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' );
103 echo html_tag( 'td', '<small> | </small>' );
104 echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' );
105 echo html_tag( 'td', '<small> | </small>' );
106 echo html_tag( 'td' );
107 /* Always show the subject */
109 echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>';
113 echo html_tag( 'td', '<small> - </small>' );
114 echo html_tag( 'td', $available[$tmp] );
117 echo '</table>' . "\n";
120 if (count($index_order) != count($available)) {
121 echo '<form name="f" method="post" action="options_order.php">';
122 echo '<select name="add">';
123 for ($i=1; $i <= count($available); $i++
) {
125 for ($j=1; $j <= count($index_order); $j++
) {
126 if ($index_order[$j] == $i) {
131 echo "<option value=\"$i\">$available[$i]</option>";
135 echo '<input type="hidden" value="add" name="method">';
136 echo '<input type="submit" value="'._("Add").'" name="submit">';
140 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );