6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
7 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 * Displays messagelist column order options
12 * @package squirrelmail
16 * Path for SquirrelMail required files.
19 define('SM_PATH','../');
21 /* SquirrelMail required files. */
22 require_once(SM_PATH
. 'include/validate.php');
23 require_once(SM_PATH
. 'functions/global.php');
24 require_once(SM_PATH
. 'functions/display_messages.php');
25 require_once(SM_PATH
. 'functions/imap.php');
26 require_once(SM_PATH
. 'functions/plugin.php');
27 require_once(SM_PATH
. 'functions/html.php');
30 sqgetGlobalVar('num', $num, SQ_GET
);
31 sqgetGlobalVar('add', $add, SQ_POST
);
33 sqgetGlobalVar('submit', $submit);
34 sqgetGlobalVar('method', $method);
35 /* end of get globals */
37 displayPageHeader($color, 'None');
40 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
42 html_tag( 'td', '', 'center', $color[0] ) .
43 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
44 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
46 html_tag( 'td', '', 'center', $color[4] );
48 $available[1] = _("Checkbox");
49 $available[2] = _("From");
50 $available[3] = _("Date");
51 $available[4] = _("Subject");
52 $available[5] = _("Flags");
53 $available[6] = _("Size");
55 if (! isset($method)) { $method = ''; }
57 if ($method == 'up' && $num > 1) {
59 $tmp = $index_order[$prev];
60 $index_order[$prev] = $index_order[$num];
61 $index_order[$num] = $tmp;
62 } else if ($method == 'down' && $num < count($index_order)) {
64 $tmp = $index_order[$next];
65 $index_order[$next] = $index_order[$num];
66 $index_order[$num] = $tmp;
67 } else if ($method == 'remove' && $num) {
68 for ($i=1; $i < 8; $i++
) {
69 removePref($data_dir, $username, "order$i");
71 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
73 $new_ary[$j] = $index_order[$i];
77 $index_order = array();
78 $index_order = $new_ary;
79 if (count($index_order) < 1) {
80 include_once('../src/load_prefs.php');
82 } else if ($method == 'add' && $add) {
83 /* User should not be able to insert PHP-code here */
84 $add = str_replace ('<?', '..', $add);
85 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
86 $add = str_replace ('<%', '..', $add);
87 $index_order[count($index_order)+
1] = $add;
91 for ($i=1; $i <= count($index_order); $i++
) {
92 setPref($data_dir, $username, "order$i", $index_order[$i]);
95 echo html_tag( 'table',
98 _("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.")
101 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
103 if (count($index_order))
105 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
106 for ($i=1; $i <= count($index_order); $i++
) {
107 $tmp = $index_order[$i];
108 echo html_tag( 'tr' );
109 echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' );
110 echo html_tag( 'td', '<small> | </small>' );
111 echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' );
112 echo html_tag( 'td', '<small> | </small>' );
113 echo html_tag( 'td' );
114 /* Always show the subject */
116 echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>';
120 echo html_tag( 'td', '<small> - </small>' );
121 echo html_tag( 'td', $available[$tmp] );
124 echo '</table>' . "\n";
127 if (count($index_order) != count($available)) {
128 echo '<form name="f" method="post" action="options_order.php">';
129 echo '<select name="add">';
130 for ($i=1; $i <= count($available); $i++
) {
132 for ($j=1; $j <= count($index_order); $j++
) {
133 if ($index_order[$j] == $i) {
138 echo "<option value=\"$i\">$available[$i]</option>";
142 echo '<input type="hidden" value="add" name="method">';
143 echo '<input type="submit" value="'._("Add").'" name="submit">';
147 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );