rg=0 fix
[squirrelmail.git] / src / options_order.php
CommitLineData
221ca7bf 1<?php
895905c0 2
35586184 3/**
4 * options_order.php
5 *
15e6162e 6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
35586184 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Displays message highlighting options
10 *
11 * $Id$
12 */
13
86725763 14/* Path for SquirrelMail required files. */
15define('SM_PATH','../');
16
17/* SquirrelMail required files. */
08185f2a 18require_once(SM_PATH . 'include/validate.php');
86725763 19require_once(SM_PATH . 'functions/display_messages.php');
20require_once(SM_PATH . 'functions/imap.php');
21require_once(SM_PATH . 'functions/array.php');
22require_once(SM_PATH . 'functions/plugin.php');
23require_once(SM_PATH . 'functions/html.php');
221ca7bf 24
fe369c70 25/* get globals */
26if (isset($_GET['action'])) {
27 $action = $_GET['action'];
28}
29if (isset($_GET['num'])) {
30 $num = $_GET['num'];
31}
32if (isset($_GET['method'])) {
33 $method = $_GET['method'];
34}
35elseif (isset($_POST['method'])) {
36 $method = $_POST['method'];
37}
38if (isset($_POST['add'])) {
39 $add = $_POST['add'];
40}
41if (isset($_GET['submit'])) {
42 $submit = $_GET['submit'];
43}
44elseif (isset($_POST['submit'])) {
45 $submit = $_POST['submit'];
46}
47/* end of get globals */
48
32f4e318 49if (! isset($action)) { $action = ''; }
50if ($action == 'delete' && isset($theid)) {
51 removePref($data_dir, $username, "highlight$theid");
52} elseif ($action == 'save') {
53}
54displayPageHeader($color, 'None');
e7db48af 55
6206f6c4 56 echo
57 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) .
545238b1 58 html_tag( 'tr' ) .
59 html_tag( 'td', '', 'center', $color[0] ) .
60 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
6206f6c4 61 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="8" cellspacing="0"' ) .
545238b1 62 html_tag( 'tr' ) .
63 html_tag( 'td', '', 'center', $color[4] );
32f4e318 64
65 $available[1] = _("Checkbox");
66 $available[2] = _("From");
67 $available[3] = _("Date");
68 $available[4] = _("Subject");
69 $available[5] = _("Flags");
70 $available[6] = _("Size");
71
72 if (! isset($method)) { $method = ''; }
73
74 if ($method == 'up' && $num > 1) {
75 $prev = $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)) {
80 $next = $num++;
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");
87 }
88 for ($j=1,$i=1; $i <= count($index_order); $i++) {
89 if ($i != $num) {
90 $new_ary[$j] = $index_order[$i];
91 $j++;
92 }
93 }
94 $index_order = array();
95 $index_order = $new_ary;
96 if (count($index_order) < 1) {
97 include_once('../src/load_prefs.php');
98 }
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;
105 }
106
107 if ($method) {
108 for ($i=1; $i <= count($index_order); $i++) {
109 setPref($data_dir, $username, "order$i", $index_order[$i]);
110 }
111 }
545238b1 112 echo html_tag( 'table',
113 html_tag( 'tr',
114 html_tag( 'td',
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.")
116 )
117 ) ,
118 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
32f4e318 119
120 if (count($index_order))
121 {
545238b1 122 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
32f4e318 123 for ($i=1; $i <= count($index_order); $i++) {
124 $tmp = $index_order[$i];
545238b1 125 echo html_tag( 'tr' );
126 echo html_tag( 'td', '<small><a href="options_order.php?method=up&amp;num=' . $i . '">'. _("up") .'</a></small>' );
127 echo html_tag( 'td', '<small>&nbsp;|&nbsp;</small>' );
128 echo html_tag( 'td', '<small><a href="options_order.php?method=down&amp;num=' . $i . '">'. _("down") .'</a></small>' );
129 echo html_tag( 'td', '<small>&nbsp;|&nbsp;</small>' );
130 echo html_tag( 'td' );
32f4e318 131 /* Always show the subject */
132 if ($tmp != 4)
545238b1 133 echo '<small><a href="options_order.php?method=remove&amp;num=' . $i . '">' . _("remove") . '</a></small>';
134 else
135 echo '&nbsp;';
136 echo '</td>';
137 echo html_tag( 'td', '<small>&nbsp;-&nbsp;</small>' );
138 echo html_tag( 'td', $available[$tmp] );
139 echo '</tr>' . "\n";
32f4e318 140 }
545238b1 141 echo '</table>' . "\n";
32f4e318 142 }
143
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++) {
148 $found = false;
149 for ($j=1; $j <= count($index_order); $j++) {
150 if ($index_order[$j] == $i) {
151 $found = true;
152 }
e7db48af 153 }
32f4e318 154 if (!$found) {
155 echo "<option value=\"$i\">$available[$i]</option>";
156 }
157 }
158 echo '</select>';
159 echo '<input type="hidden" value="add" name="method">';
160 echo '<input type="submit" value="'._("Add").'" name="submit">';
161 echo '</form>';
162 }
163
545238b1 164 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );
5c54e435 165
221ca7bf 166?>
e7db48af 167 </td></tr>
168 </table>
169
170</td></tr>
171</table>
5e9e90fd 172</body></html>