squirrelmail-webmail  1.4.22
About: SquirrelMail is a standards-based webmail package with strong MIME support, address books, and folder manipulation (written in PHP4).
  Fossies Dox: squirrelmail-webmail-1.4.22.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

options.php
Go to the documentation of this file.
1 <?php
2 
3 /* options page for IMAP info plugin
4  * Copyright (c) 1999-2011 The SquirrelMail Project Team
5  * Licensed under the GNU GPL. For full terms see the file COPYING.
6  *
7  * This is where it all happens :)
8  *
9  * Written by: Jason Munro
10  * jason@stdbev.com
11  *
12  * $Id: options.php 14084 2011-01-06 02:44:03Z pdontthink $
13  *
14  */
15 
16 define('SM_PATH','../../');
17 
18 /* SquirrelMail required files. */
19 require_once(SM_PATH . 'include/validate.php');
20 require_once(SM_PATH . 'functions/page_header.php');
21 require_once(SM_PATH . 'functions/imap.php');
22 require_once(SM_PATH . 'functions/forms.php');
23 require_once(SM_PATH . 'plugins/info/functions.php');
24 
27 displayPageHeader($color, 'None');
28 $mailbox = 'INBOX';
29 
35 if (! info_is_plugin_enabled('info')) {
36  echo '<p align="center"><big>'.
37  _("Plugin is disabled.").
38  '</big></p></body></html>';
39  exit;
40 }
41 
42 /* GLOBALS */
43 sqgetGlobalVar('username', $username, SQ_SESSION);
44 sqgetGlobalVar('key', $key, SQ_COOKIE);
45 sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
46 
47 sqgetGlobalVar('submit', $submit, SQ_POST);
48 
49 for($i = 0; $i <= 9; $i++){
50  $varc = 'CHECK_TEST_'.$i;
51  sqgetGlobalVar($varc, $$varc, SQ_POST);
52  $vart = 'TEST_'.$i;
53  sqgetGlobalVar($vart, $$vart, SQ_POST);
54 }
55 
56 /* END GLOBALS */
57 
60 $list = array (
61  'TEST_0',
62  'TEST_1',
63  'TEST_2',
64  'TEST_3',
65  'TEST_4',
66  'TEST_5',
67  'TEST_6',
68  'TEST_7',
69  'TEST_8',
70  'TEST_9');
71 
72 print "<br><center><b>IMAP server information</b></center><br>\n";
73 print "<center><table bgcolor=\"".$color[3]."\" width=\"100%\" border=\"1\" cellpadding=\"2\"><tr><td bgcolor=".$color[3]."><br>\n";
74 print "<center><table width=\"95%\" border=\"1\" bgcolor=\"".$color[3]."\">\n";
75 print "<tr><td bgcolor=\"".$color[4]."\"><b>Server Capability response:</b><br>\n";
76 
77 foreach($caps_array[0] as $value) {
78  print htmlspecialchars($value);
79 }
80 
81 print "</td></tr><tr><td>\n";
82 
83 if (!isset($submit) || $submit == 'default') {
84  print "<br><font color=".$color[6]."><small>Select the IMAP commands you would like to run.
85  Most commands require a selected mailbox so the SELECT-command is already setup.
86  You can clear all the commands and test your own IMAP command strings. The
87  commands are executed in order. The default values are simple IMAP commands using
88  your default_charset and folder_prefix from SquirrelMail when needed.<br><br>
89  </small></font><center><font color=".$color[6]."><small><b>NOTE: These commands
90  are live, any changes made will effect your current
91  email account.</b></small></font></center><br>\n";
92  if (!isset($submit)) {
93  $submit = '';
94  }
95 }
96 else {
97  print 'folder_prefix = ' . htmlspecialchars($folder_prefix) . "<br>\n".
98  'default_charset = ' . htmlspecialchars($default_charset) . "\n";
99 }
100 
101 print "<br></td></tr></table></center><br>\n";
102 
103 
104 if ($submit == 'submit') {
105  $type = array();
106  for ($i=0;$i<count($list);$i++) {
107  $type[$list[$i]] = $$list[$i];
108  }
109 }
110 
111 elseif ($submit == 'clear') {
112  for ($i=0;$i<count($list);$i++) {
113  $type[$list[$i]] = '';
114  }
115 }
116 
117 elseif (!$submit || $submit == 'default') {
118  $type = array (
119  'TEST_0' => "SELECT $mailbox",
120  'TEST_1' => "STATUS $mailbox (MESSAGES RECENT)",
121  'TEST_2' => "EXAMINE $mailbox",
122  'TEST_3' => "SEARCH CHARSET \"$default_charset\" ALL *",
123  'TEST_4' => "THREAD REFERENCES $default_charset ALL",
124  'TEST_5' => "SORT (DATE) $default_charset ALL",
125  'TEST_6' => "FETCH 1:* (FLAGS BODY[HEADER.FIELDS (FROM DATE TO)])",
126  'TEST_7' => "LSUB \"$folder_prefix\" \"*%\"",
127  'TEST_8' => "LIST \"$folder_prefix*\" \"*\"",
128  'TEST_9' => "");
129 }
130 
131 print "<form action=\"options.php\" method=\"post\">\n";
132 print "<center><table border=\"1\">\n";
133 print "<tr><th>Select</th><th>Test Name</th><th>IMAP command string</th>\n";
134 print "</tr><tr><td>\n";
135 
136 foreach($type as $index=>$value) {
137  print "</td></tr><tr><td width=\"10%\"><input type=\"checkbox\" value=\"1\" name=\"CHECK_$index\"";
138  if ($index == 'TEST_0' && ($submit == 'default' || $submit == '')) {
139  print " checked";
140  }
141  $check = "CHECK_".$index;
142  if (isset($$check) && $submit != 'clear' && $submit != 'default') {
143  print " checked";
144  }
145  print "></td><td width=\"30%\">$index</td><td width=\"60%\">\n";
146  print addInput($index, $value, 60);
147 }
148 
149 print "</td></tr></table></center><br>\n";
150 print "<center>".
151 addSubmit('submit','submit').
152 addSubmit('clear','submit').
153 addSubmit('default','submit').
154 "</center><br>\n";
155 
156 $tests = array();
157 
158 if ($submit == 'submit') {
159  foreach ($type as $index=>$value) {
160  $check = "CHECK_".$index;
161  if (isset($$check)) {
162  $type[$index] = $$index;
163  array_push($tests, $index);
164  }
165  }
166  for ($i=0;$i<count($tests);$i++) {
167  print "<center><table width=\"95%\" border=\"0\" bgcolor=\"".$color[4]."\">\n";
168  print "<tr><td><b>".$tests[$i]."</b></td></tr>";
169  print "<tr><td><font color=\"".$color[7]."\"><small><b>".
170  "Request:</b></small></font></td></tr>\n";
171  $response = imap_test($imap_stream, $type[$tests[$i]]);
172  print "<tr><td><font color=\"".$color[7]."\"><small><b>".
173  "Response:</b></small></font></td></tr>\n";
174  print "<tr><td>";
175  print_response($response);
176  print "</td></tr></table></center><br>\n";
177  }
178 }
179  print "</form></td></tr></table></center></body></html>";
181  do_hook('info_bottom');
182 ?>
elseif
if(! sqgetGlobalVar('sound', $sound, SQ_GET)) elseif($sound=='(none)')
Definition: testsound.php:25
sqgetGlobalVar
sqgetGlobalVar($name, &$value, $search=SQ_INORDER)
Definition: global.php:344
get_caps
get_caps($imap_stream)
Definition: functions.php:18
$imapServerAddress
$imapServerAddress
Definition: config_default.php:202
SM_PATH
const SM_PATH
Definition: options.php:222
sqimap_login
sqimap_login($username, $password, $imap_server_address, $imap_port, $hide)
Definition: imap_general.php:481
SQ_SESSION
const SQ_SESSION
Definition: global.php:18
displayPageHeader
displayPageHeader($color, $mailbox, $xtra='', $session=false)
Definition: page_header.php:105
$mailbox
$mailbox
Definition: options.php:28
$folder_prefix
global $folder_prefix
Definition: options.php:19
do_hook
do_hook($name)
Definition: plugin.php:42
addInput
addInput($name, $value='', $size=0, $maxlength=0, $extra_attributes='')
Definition: forms.php:65
$imap_stream
for($i=0; $i<=9; $i++) $imap_stream
Definition: options.php:58
$list
$list
Definition: options.php:60
sqimap_logout
sqimap_logout($imap_stream)
Definition: imap_general.php:639
$caps_array
$caps_array
Definition: options.php:59
print_response
print_response($response)
Definition: functions.php:40
$tests
$tests
Definition: options.php:156
SQ_POST
const SQ_POST
Definition: global.php:17
exit
exit
Definition: help.php:128
_
_($str)
Definition: gettext.php:160
imap_test
imap_test($imap_stream, $string)
Definition: functions.php:26
$default_charset
global $default_charset
Definition: options.php:19
$imapPort
$imapPort
Definition: config_default.php:210
SQ_COOKIE
const SQ_COOKIE
Definition: global.php:19
$color
global $color
Definition: options.php:19
$username
global $username
Definition: options.php:225
info_is_plugin_enabled
info_is_plugin_enabled($plugin_name)
Definition: functions.php:56