removing double spaces and html formating fixes
[squirrelmail.git] / src / options_order.php
CommitLineData
221ca7bf 1<?php
895905c0 2
35586184 3/**
4 * options_order.php
5 *
82d304a0 6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
1c159927 9 * Displays messagelist column order options
35586184 10 *
30967a1e 11 * @version $Id$
8f6f9ba5 12 * @package squirrelmail
35586184 13 */
14
30967a1e 15/**
16 * Path for SquirrelMail required files.
17 * @ignore
18 */
86725763 19define('SM_PATH','../');
20
21/* SquirrelMail required files. */
08185f2a 22require_once(SM_PATH . 'include/validate.php');
1e12d1ff 23require_once(SM_PATH . 'functions/global.php');
86725763 24require_once(SM_PATH . 'functions/display_messages.php');
25require_once(SM_PATH . 'functions/imap.php');
86725763 26require_once(SM_PATH . 'functions/plugin.php');
27require_once(SM_PATH . 'functions/html.php');
221ca7bf 28
fe369c70 29/* get globals */
1e12d1ff 30sqgetGlobalVar('num', $num, SQ_GET);
31sqgetGlobalVar('add', $add, SQ_POST);
32
33sqgetGlobalVar('submit', $submit);
34sqgetGlobalVar('method', $method);
fe369c70 35/* end of get globals */
36
32f4e318 37displayPageHeader($color, 'None');
e7db48af 38
6206f6c4 39 echo
40 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
545238b1 41 html_tag( 'tr' ) .
42 html_tag( 'td', '', 'center', $color[0] ) .
43 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
6206f6c4 44 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
545238b1 45 html_tag( 'tr' ) .
46 html_tag( 'td', '', 'center', $color[4] );
32f4e318 47
48 $available[1] = _("Checkbox");
49 $available[2] = _("From");
50 $available[3] = _("Date");
51 $available[4] = _("Subject");
52 $available[5] = _("Flags");
53 $available[6] = _("Size");
54
55 if (! isset($method)) { $method = ''; }
56
57 if ($method == 'up' && $num > 1) {
58 $prev = $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)) {
63 $next = $num++;
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");
70 }
71 for ($j=1,$i=1; $i <= count($index_order); $i++) {
72 if ($i != $num) {
73 $new_ary[$j] = $index_order[$i];
74 $j++;
75 }
76 }
77 $index_order = array();
78 $index_order = $new_ary;
79 if (count($index_order) < 1) {
80 include_once('../src/load_prefs.php');
81 }
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;
88 }
89
90 if ($method) {
91 for ($i=1; $i <= count($index_order); $i++) {
92 setPref($data_dir, $username, "order$i", $index_order[$i]);
93 }
94 }
545238b1 95 echo html_tag( 'table',
96 html_tag( 'tr',
97 html_tag( 'td',
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.")
99 )
100 ) ,
101 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
32f4e318 102
103 if (count($index_order))
104 {
545238b1 105 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
32f4e318 106 for ($i=1; $i <= count($index_order); $i++) {
107 $tmp = $index_order[$i];
545238b1 108 echo html_tag( 'tr' );
109 echo html_tag( 'td', '<small><a href="options_order.php?method=up&amp;num=' . $i . '">'. _("up") .'</a></small>' );
110 echo html_tag( 'td', '<small>&nbsp;|&nbsp;</small>' );
111 echo html_tag( 'td', '<small><a href="options_order.php?method=down&amp;num=' . $i . '">'. _("down") .'</a></small>' );
112 echo html_tag( 'td', '<small>&nbsp;|&nbsp;</small>' );
113 echo html_tag( 'td' );
32f4e318 114 /* Always show the subject */
115 if ($tmp != 4)
545238b1 116 echo '<small><a href="options_order.php?method=remove&amp;num=' . $i . '">' . _("remove") . '</a></small>';
117 else
118 echo '&nbsp;';
119 echo '</td>';
120 echo html_tag( 'td', '<small>&nbsp;-&nbsp;</small>' );
121 echo html_tag( 'td', $available[$tmp] );
122 echo '</tr>' . "\n";
32f4e318 123 }
545238b1 124 echo '</table>' . "\n";
32f4e318 125 }
126
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++) {
131 $found = false;
132 for ($j=1; $j <= count($index_order); $j++) {
133 if ($index_order[$j] == $i) {
134 $found = true;
135 }
e7db48af 136 }
32f4e318 137 if (!$found) {
138 echo "<option value=\"$i\">$available[$i]</option>";
139 }
140 }
141 echo '</select>';
142 echo '<input type="hidden" value="add" name="method">';
143 echo '<input type="submit" value="'._("Add").'" name="submit">';
144 echo '</form>';
145 }
146
545238b1 147 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );
5c54e435 148
221ca7bf 149?>
e7db48af 150 </td></tr>
151 </table>
152
153</td></tr>
154</table>
dcc1cc82 155</body></html>