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');
26 if (isset($_GET['action'])) {
27 $action = $_GET['action'];
29 if (isset($_GET['num'])) {
32 if (isset($_GET['method'])) {
33 $method = $_GET['method'];
35 elseif (isset($_POST['method'])) {
36 $method = $_POST['method'];
38 if (isset($_POST['add'])) {
41 if (isset($_GET['submit'])) {
42 $submit = $_GET['submit'];
44 elseif (isset($_POST['submit'])) {
45 $submit = $_POST['submit'];
47 /* end of get globals */
49 if (! isset($action)) { $action = ''; }
50 if ($action == 'delete' && isset($theid)) {
51 removePref($data_dir, $username, "highlight$theid");
52 } elseif ($action == 'save') {
54 displayPageHeader($color, 'None');
57 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
59 html_tag( 'td', '', 'center', $color[0] ) .
60 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
61 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
63 html_tag( 'td', '', 'center', $color[4] );
65 $available[1] = _("Checkbox");
66 $available[2] = _("From");
67 $available[3] = _("Date");
68 $available[4] = _("Subject");
69 $available[5] = _("Flags");
70 $available[6] = _("Size");
72 if (! isset($method)) { $method = ''; }
74 if ($method == 'up' && $num > 1) {
76 $tmp = $index_order[$prev];
77 $index_order[$prev] = $index_order[$num];
78 $index_order[$num] = $tmp;
79 } else if ($method == 'down' && $num < count($index_order)) {
81 $tmp = $index_order[$next];
82 $index_order[$next] = $index_order[$num];
83 $index_order[$num] = $tmp;
84 } else if ($method == 'remove' && $num) {
85 for ($i=1; $i < 8; $i++
) {
86 removePref($data_dir, $username, "order$i");
88 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
90 $new_ary[$j] = $index_order[$i];
94 $index_order = array();
95 $index_order = $new_ary;
96 if (count($index_order) < 1) {
97 include_once('../src/load_prefs.php');
99 } else if ($method == 'add' && $add) {
100 /* User should not be able to insert PHP-code here */
101 $add = str_replace ('<?', '..', $add);
102 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
103 $add = str_replace ('<%', '..', $add);
104 $index_order[count($index_order)+
1] = $add;
108 for ($i=1; $i <= count($index_order); $i++
) {
109 setPref($data_dir, $username, "order$i", $index_order[$i]);
112 echo html_tag( 'table',
115 _("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.")
118 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
120 if (count($index_order))
122 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
123 for ($i=1; $i <= count($index_order); $i++
) {
124 $tmp = $index_order[$i];
125 echo html_tag( 'tr' );
126 echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' );
127 echo html_tag( 'td', '<small> | </small>' );
128 echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' );
129 echo html_tag( 'td', '<small> | </small>' );
130 echo html_tag( 'td' );
131 /* Always show the subject */
133 echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>';
137 echo html_tag( 'td', '<small> - </small>' );
138 echo html_tag( 'td', $available[$tmp] );
141 echo '</table>' . "\n";
144 if (count($index_order) != count($available)) {
145 echo '<form name="f" method="post" action="options_order.php">';
146 echo '<select name="add">';
147 for ($i=1; $i <= count($available); $i++
) {
149 for ($j=1; $j <= count($index_order); $j++
) {
150 if ($index_order[$j] == $i) {
155 echo "<option value=\"$i\">$available[$i]</option>";
159 echo '<input type="hidden" value="add" name="method">';
160 echo '<input type="submit" value="'._("Add").'" name="submit">';
164 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );