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