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
15 /** Path for SquirrelMail required files. */
16 define('SM_PATH','../');
18 /* SquirrelMail required files. */
19 require_once(SM_PATH
. 'include/validate.php');
20 require_once(SM_PATH
. 'functions/global.php');
21 require_once(SM_PATH
. 'functions/display_messages.php');
22 require_once(SM_PATH
. 'functions/imap.php');
23 require_once(SM_PATH
. 'functions/plugin.php');
24 require_once(SM_PATH
. 'functions/html.php');
27 sqgetGlobalVar('num', $num, SQ_GET
);
28 sqgetGlobalVar('add', $add, SQ_POST
);
30 sqgetGlobalVar('submit', $submit);
31 sqgetGlobalVar('method', $method);
32 /* end of get globals */
34 displayPageHeader($color, 'None');
37 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
39 html_tag( 'td', '', 'center', $color[0] ) .
40 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
41 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
43 html_tag( 'td', '', 'center', $color[4] );
45 $available[1] = _("Checkbox");
46 $available[2] = _("From");
47 $available[3] = _("Date");
48 $available[4] = _("Subject");
49 $available[5] = _("Flags");
50 $available[6] = _("Size");
52 if (! isset($method)) { $method = ''; }
54 if ($method == 'up' && $num > 1) {
56 $tmp = $index_order[$prev];
57 $index_order[$prev] = $index_order[$num];
58 $index_order[$num] = $tmp;
59 } else if ($method == 'down' && $num < count($index_order)) {
61 $tmp = $index_order[$next];
62 $index_order[$next] = $index_order[$num];
63 $index_order[$num] = $tmp;
64 } else if ($method == 'remove' && $num) {
65 for ($i=1; $i < 8; $i++
) {
66 removePref($data_dir, $username, "order$i");
68 for ($j=1,$i=1; $i <= count($index_order); $i++
) {
70 $new_ary[$j] = $index_order[$i];
74 $index_order = array();
75 $index_order = $new_ary;
76 if (count($index_order) < 1) {
77 include_once('../src/load_prefs.php');
79 } else if ($method == 'add' && $add) {
80 /* User should not be able to insert PHP-code here */
81 $add = str_replace ('<?', '..', $add);
82 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
83 $add = str_replace ('<%', '..', $add);
84 $index_order[count($index_order)+
1] = $add;
88 for ($i=1; $i <= count($index_order); $i++
) {
89 setPref($data_dir, $username, "order$i", $index_order[$i]);
92 echo html_tag( 'table',
95 _("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.")
98 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
100 if (count($index_order))
102 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
103 for ($i=1; $i <= count($index_order); $i++
) {
104 $tmp = $index_order[$i];
105 echo html_tag( 'tr' );
106 echo html_tag( 'td', '<small><a href="options_order.php?method=up&num=' . $i . '">'. _("up") .'</a></small>' );
107 echo html_tag( 'td', '<small> | </small>' );
108 echo html_tag( 'td', '<small><a href="options_order.php?method=down&num=' . $i . '">'. _("down") .'</a></small>' );
109 echo html_tag( 'td', '<small> | </small>' );
110 echo html_tag( 'td' );
111 /* Always show the subject */
113 echo '<small><a href="options_order.php?method=remove&num=' . $i . '">' . _("remove") . '</a></small>';
117 echo html_tag( 'td', '<small> - </small>' );
118 echo html_tag( 'td', $available[$tmp] );
121 echo '</table>' . "\n";
124 if (count($index_order) != count($available)) {
125 echo '<form name="f" method="post" action="options_order.php">';
126 echo '<select name="add">';
127 for ($i=1; $i <= count($available); $i++
) {
129 for ($j=1; $j <= count($index_order); $j++
) {
130 if ($index_order[$j] == $i) {
135 echo "<option value=\"$i\">$available[$i]</option>";
139 echo '<input type="hidden" value="add" name="method">';
140 echo '<input type="submit" value="'._("Add").'" name="submit">';
144 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );