global.php
[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
35586184 14require_once('../src/validate.php');
15require_once('../functions/display_messages.php');
16require_once('../functions/imap.php');
17require_once('../functions/array.php');
18require_once('../functions/plugin.php');
545238b1 19require_once('../functions/html.php');
221ca7bf 20
32f4e318 21if (! isset($action)) { $action = ''; }
22if ($action == 'delete' && isset($theid)) {
23 removePref($data_dir, $username, "highlight$theid");
24} elseif ($action == 'save') {
25}
26displayPageHeader($color, 'None');
e7db48af 27
545238b1 28 echo '<br>' .
29 html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="2" cellspacing="0"' ) .
30 html_tag( 'tr' ) .
31 html_tag( 'td', '', 'center', $color[0] ) .
32 '<b>' . _("Options") . ' - ' . _("Index Order") . '</b>' .
33 html_tag( 'table', '', '', '', 'width="100%" border="0" cellpadding="1" cellspacing="1"' ) .
34 html_tag( 'tr' ) .
35 html_tag( 'td', '', 'center', $color[4] );
32f4e318 36
37 $available[1] = _("Checkbox");
38 $available[2] = _("From");
39 $available[3] = _("Date");
40 $available[4] = _("Subject");
41 $available[5] = _("Flags");
42 $available[6] = _("Size");
43
44 if (! isset($method)) { $method = ''; }
45
46 if ($method == 'up' && $num > 1) {
47 $prev = $num-1;
48 $tmp = $index_order[$prev];
49 $index_order[$prev] = $index_order[$num];
50 $index_order[$num] = $tmp;
51 } else if ($method == 'down' && $num < count($index_order)) {
52 $next = $num++;
53 $tmp = $index_order[$next];
54 $index_order[$next] = $index_order[$num];
55 $index_order[$num] = $tmp;
56 } else if ($method == 'remove' && $num) {
57 for ($i=1; $i < 8; $i++) {
58 removePref($data_dir, $username, "order$i");
59 }
60 for ($j=1,$i=1; $i <= count($index_order); $i++) {
61 if ($i != $num) {
62 $new_ary[$j] = $index_order[$i];
63 $j++;
64 }
65 }
66 $index_order = array();
67 $index_order = $new_ary;
68 if (count($index_order) < 1) {
69 include_once('../src/load_prefs.php');
70 }
71 } else if ($method == 'add' && $add) {
72 /* User should not be able to insert PHP-code here */
73 $add = str_replace ('<?', '..', $add);
74 $add = ereg_replace ('<.*script.*language.*php.*>', '..', $add);
75 $add = str_replace ('<%', '..', $add);
76 $index_order[count($index_order)+1] = $add;
77 }
78
79 if ($method) {
80 for ($i=1; $i <= count($index_order); $i++) {
81 setPref($data_dir, $username, "order$i", $index_order[$i]);
82 }
83 }
545238b1 84 echo html_tag( 'table',
85 html_tag( 'tr',
86 html_tag( 'td',
87 _("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.")
88 )
89 ) ,
90 '', '', '', 'width="65%" border="0" cellpadding="0" cellspacing="0"' ) . "<br>\n";
32f4e318 91
92 if (count($index_order))
93 {
545238b1 94 echo html_tag( 'table', '', '', '', ' cellspacing="0" cellpadding="0" border="0"' ) . "\n";
32f4e318 95 for ($i=1; $i <= count($index_order); $i++) {
96 $tmp = $index_order[$i];
545238b1 97 echo html_tag( 'tr' );
98 echo html_tag( 'td', '<small><a href="options_order.php?method=up&amp;num=' . $i . '">'. _("up") .'</a></small>' );
99 echo html_tag( 'td', '<small>&nbsp;|&nbsp;</small>' );
100 echo html_tag( 'td', '<small><a href="options_order.php?method=down&amp;num=' . $i . '">'. _("down") .'</a></small>' );
101 echo html_tag( 'td', '<small>&nbsp;|&nbsp;</small>' );
102 echo html_tag( 'td' );
32f4e318 103 /* Always show the subject */
104 if ($tmp != 4)
545238b1 105 echo '<small><a href="options_order.php?method=remove&amp;num=' . $i . '">' . _("remove") . '</a></small>';
106 else
107 echo '&nbsp;';
108 echo '</td>';
109 echo html_tag( 'td', '<small>&nbsp;-&nbsp;</small>' );
110 echo html_tag( 'td', $available[$tmp] );
111 echo '</tr>' . "\n";
32f4e318 112 }
545238b1 113 echo '</table>' . "\n";
32f4e318 114 }
115
116 if (count($index_order) != count($available)) {
117 echo '<form name="f" method="post" action="options_order.php">';
118 echo '<select name="add">';
119 for ($i=1; $i <= count($available); $i++) {
120 $found = false;
121 for ($j=1; $j <= count($index_order); $j++) {
122 if ($index_order[$j] == $i) {
123 $found = true;
124 }
e7db48af 125 }
32f4e318 126 if (!$found) {
127 echo "<option value=\"$i\">$available[$i]</option>";
128 }
129 }
130 echo '</select>';
131 echo '<input type="hidden" value="add" name="method">';
132 echo '<input type="submit" value="'._("Add").'" name="submit">';
133 echo '</form>';
134 }
135
545238b1 136 echo html_tag( 'p', '<a href="../src/options.php">' . _("Return to options page") . '</a></p><br>' );
5c54e435 137
221ca7bf 138?>
e7db48af 139 </td></tr>
140 </table>
141
142</td></tr>
143</table>
5e9e90fd 144</body></html>