14a366cae5c9b0d04a84e60db1b44f1b9658dd89
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/plugin.php');
22 require_once(SM_PATH
. 'functions/html.php');
25 if (isset($_GET['action'])) {
26 $action = $_GET['action'];
28 if (isset($_GET['num'])) {
31 if (isset($_GET['method'])) {
32 $method = $_GET['method'];
34 elseif (isset($_POST['method'])) {
35 $method = $_POST['method'];
37 if (isset($_POST['add'])) {
40 if (isset($_GET['submit'])) {
41 $submit = $_GET['submit'];
43 elseif (isset($_POST['submit'])) {
44 $submit = $_POST['submit'];
46 /* end of get globals */
48 if (! isset($action)) { $action = ''; }
49 if ($action == 'delete' && isset($theid)) {
50 removePref($data_dir, $username, "highlight$theid");
51 } elseif ($action == 'save') {
53 displayPageHeader($color, 'None');
56 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
58 html_tag( 'td', '', 'center', $color[0] ) .
59 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
60 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
62 html_tag( 'td', '', 'center', $color[4] );
64 $available[1] = _("Checkbox");
65 $available[2] = _("From");
66 $available[3] = _("Date");
67 $available[4] = _("Subject");
68 $available[5] = _("Flags");
69 $available[6] = _("Size");
71 if (! isset($method)) { $method = ''; }
73 if ($method == 'up' && $num > 1) {
75 $tmp = $index_order[$prev];
76 $index_order[$prev] = $index_order[$num];
77 $index_order[$num] = $tmp;
78 } else if ($method == 'down' && $num < count($index_order)) {
80 $tmp = $index_order[$next];
81 $index_order[$next] = $index_order[$num];
82 $index_order[$num] = $tmp;
83 } else if ($method == 'remove' && $num) {
84 for ($i=1; $i < 8; $i++
) {
85 removePref($data_dir, $username, "order$i");
87 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
89 $new_ary[$j] = $index_order[$i];
93 $index_order = array();
94 $index_order = $new_ary;
95 if (count($index_order) < 1) {
96 include_once('../src/load_prefs.php');
98 } else if ($method == 'add' && $add) {
99 /* User should not be able to insert PHP-code here */
100 $add = str_replace ('<?', '..', $add);
101 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
102 $add = str_replace ('<%', '..', $add);
103 $index_order[count($index_order)+
1] = $add;
107 for ($i=1; $i <= count($index_order); $i++
) {
108 setPref($data_dir, $username, "order$i", $index_order[$i]);
111 echo html_tag( 'table',
114 _("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.")
117 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
119 if (count($index_order))
121 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
122 for ($i=1; $i <= count($index_order); $i++
) {
123 $tmp = $index_order[$i];
124 echo html_tag( 'tr' );
125 echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' );
126 echo html_tag( 'td', '<small> | </small>' );
127 echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' );
128 echo html_tag( 'td', '<small> | </small>' );
129 echo html_tag( 'td' );
130 /* Always show the subject */
132 echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>';
136 echo html_tag( 'td', '<small> - </small>' );
137 echo html_tag( 'td', $available[$tmp] );
140 echo '</table>' . "\n";
143 if (count($index_order) != count($available)) {
144 echo '<form name="f" method="post" action="options_order.php">';
145 echo '<select name="add">';
146 for ($i=1; $i <= count($available); $i++
) {
148 for ($j=1; $j <= count($index_order); $j++
) {
149 if ($index_order[$j] == $i) {
154 echo "<option value=\"$i\">$available[$i]</option>";
158 echo '<input type="hidden" value="add" name="method">';
159 echo '<input type="submit" value="'._("Add").'" name="submit">';
163 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );