[ Index ] |
|
Code source de IMP H3 (4.1.5) |
1 <?php 2 /** 3 * $Horde: imp/test.php,v 1.33.6.13 2007/01/02 13:54:54 jan Exp $ 4 * 5 * Copyright 2002-2007 Brent J. Nordquist <bjn@horde.org> 6 * Copyright 1999-2007 Charles J. Hagenbuch <chuck@horde.org> 7 * Copyright 1999-2007 Jon Parise <jon@horde.org> 8 * 9 * See the enclosed file COPYING for license information (LGPL). If you 10 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. 11 */ 12 13 /* Include Horde's core.php file. */ 14 include_once '../lib/core.php'; 15 16 /* We should have loaded the String class, from the Horde_Util 17 * package, in core.php. If String:: isn't defined, then we're not 18 * finding some critical libraries. */ 19 if (!class_exists('String')) { 20 echo '<br /><span style="color: red; font-size: 18px; font-weight: bold;">The Horde_Util package was not found. If PHP\'s error_reporting setting is high enough, there should be error messages printed above that may help you in debugging the problem. If you are simply missing these files, then you need to get the <a href="http://cvs.horde.org/cvs.php/framework">framework</a> module from <a href="http://horde.org/source/">Horde CVS</a>, and install the packages in it with the install-packages.php script.</span>'; 21 exit; 22 } 23 24 /* Initialize the Horde_Test:: class. */ 25 if (!(@is_readable('../lib/Test.php'))) { 26 echo 'ERROR: You must install Horde before running this script.'; 27 exit; 28 } 29 require_once '../lib/Test.php'; 30 $horde_test = &new Horde_Test; 31 32 /* IMP version. */ 33 $module = 'IMP'; 34 require_once './lib/version.php'; 35 $module_version = IMP_VERSION; 36 37 require TEST_TEMPLATES . 'header.inc'; 38 require TEST_TEMPLATES . 'version.inc'; 39 40 /* Display versions of other Horde applications. */ 41 $app_list = array( 42 'gollem' => array( 43 'error' => 'Gollem provides access to local VFS filesystems to attach files.', 44 'version' => '1.0' 45 ), 46 'ingo' => array( 47 'error' => 'Ingo provides basic mail filtering capabilities to IMP.', 48 'version' => '1.0' 49 ), 50 'nag' => array( 51 'error' => 'Nag allows tasks to be directly created from e-mail data.', 52 'version' => '2.0' 53 ), 54 'turba' => array( 55 'error' => 'Turba provides addressbook/contacts capabilities to IMP.', 56 'version' => '2.0' 57 ) 58 ); 59 $app_output = $horde_test->requiredAppCheck($app_list); 60 61 ?> 62 <h1>Other Horde Applications</h1> 63 <ul> 64 <?php echo $app_output ?> 65 </ul> 66 <?php 67 68 /* Display PHP Version information. */ 69 $php_info = $horde_test->getPhpVersionInformation(); 70 require TEST_TEMPLATES . 'php_version.inc'; 71 72 /* PHP modules. */ 73 $module_list = array( 74 'imap' => array( 75 'descrip' => 'IMAP Support', 76 'error' => 'IMP requires the imap module to interact with the mail server. It is required even if you only use pop3 access.', 77 'fatal' => true 78 ), 79 'openssl' => array( 80 'descrip' => 'OpenSSL Support', 81 'error' => 'The openssl module is required to use S/MIME in IMP. Compile PHP with <code>--with-openssl</code> to activate.', 82 'fatal' => false 83 ) 84 ); 85 86 /* PHP settings. */ 87 $setting_list = array( 88 'file_uploads' => array( 89 'setting' => true, 90 'error' => 'file_uploads must be enabled to use various features of IMP. See the INSTALL file for more information.' 91 ) 92 ); 93 94 /* IMP configuration files. */ 95 $file_list = array( 96 'config/conf.php' => 'The file <code>./config/conf.php</code> appears to be missing. You must generate this file as an administrator via Horde. See horde/docs/INSTALL.', 97 'config/mime_drivers.php' => null, 98 'config/prefs.php' => null, 99 'config/servers.php' => null 100 ); 101 102 /* PEAR modules. */ 103 $pear_list = array( 104 'HTTP_Request' => array( 105 'path' => 'HTTP/Request.php', 106 'error' => 'The HTML composition mode requires HTTP_Request.' 107 ), 108 'Auth_SASL' => array( 109 'path' => 'Auth/SASL.php', 110 'error' => 'If your IMAP server uses CRAM-MD5 or DIGEST-MD5 authentication, this module is required.' 111 ) 112 ); 113 114 /* Get the status output now. */ 115 $module_output = $horde_test->phpModuleCheck($module_list); 116 $setting_output = $horde_test->phpSettingCheck($setting_list); 117 $file_output = $horde_test->requiredFileCheck($file_list); 118 $pear_output = $horde_test->PEARModuleCheck($pear_list); 119 120 ?> 121 122 <h1>PHP Module Capabilities</h1> 123 <ul> 124 <?php echo $module_output ?> 125 </ul> 126 127 <h1>Miscellaneous PHP Settings</h1> 128 <ul> 129 <?php echo $setting_output ?> 130 </ul> 131 132 <h1>Required IMP Configuration Files</h1> 133 <ul> 134 <?php echo $file_output ?> 135 </ul> 136 137 <h1>PEAR</h1> 138 <ul> 139 <?php echo $pear_output ?> 140 </ul> 141 142 <h1>PHP Mail Server Support Test</h1> 143 <?php 144 145 $server = isset($_POST['server']) ? $_POST['server'] : ''; 146 $port = isset($_POST['port']) ? $_POST['port'] : ''; 147 $user = isset($_POST['user']) ? $_POST['user'] : ''; 148 $passwd = isset($_POST['passwd']) ? $_POST['passwd'] : ''; 149 $type = isset($_POST['server_type']) ? $_POST['server_type'] : ''; 150 151 if (!empty($server) && !empty($user) && !empty($passwd) && !empty($type)) { 152 if ($type == 'pop') { 153 $conn = array( 154 'pop3/notls' => 110, 155 'pop3/ssl' => 995, 156 'pop3/ssl/novalidate-cert' => 995, 157 'pop3/tls/novalidate-cert' => 110 158 ); 159 } else { 160 $conn = array( 161 'imap/notls' => 143, 162 'imap/ssl' => 993, 163 'imap/ssl/novalidate-cert' => 993, 164 'imap/tls/novalidate-cert' => 143 165 ); 166 } 167 168 $success = array(); 169 170 echo "<strong>Attempting to automatically determine the correct connection parameters for your server:</strong>\n"; 171 172 foreach ($conn as $key => $val) { 173 $server_port = !empty($port) ? $port : $val; 174 $mbname = '{' . $server . ':' . $server_port . '/' . $key . '}INBOX'; 175 echo "<ul><li><em>Trying protocol <tt>" . $key . "</tt>, Port <tt>" . $server_port . "</tt>:</em>\n<blockquote>\n"; 176 $mbox = @imap_open($mbname, $user, $passwd); 177 if ($mbox) { 178 $minfo = @imap_mailboxmsginfo($mbox); 179 if ($minfo) { 180 echo '<font color="green">SUCCESS</font> - INBOX has ', $minfo->Nmsgs, ' messages (' . $minfo->Unread, ' new ', $minfo->Recent, ' recent)'; 181 $success[] = array('server' => $server, 'protocol' => $key, 'port' => $server_port); 182 } else { 183 echo '<font color="red">ERROR</font> - The server returned the following error message:' . "\n" . '<pre>'; 184 foreach (imap_errors() as $error) { 185 echo wordwrap($error); 186 } 187 echo '</pre>'; 188 } 189 @imap_close($mbox); 190 } else { 191 echo '<font color="red">ERROR</font> - The server returned the following error message:' . "\n" . '<pre>'; 192 foreach (imap_errors() as $error) { 193 echo wordwrap($error); 194 } 195 echo '</pre>'; 196 } 197 echo "</blockquote>\n</li></ul>\n"; 198 } 199 200 if (!empty($success)) { 201 echo "<strong>The following configurations were successful and may be used in your imp/config/servers.php file:</strong>\n"; 202 $i = 1; 203 foreach ($success as $val) { 204 echo "<blockquote><em>Configuration " . $i++ . "</em><blockquote><pre>"; 205 foreach ($val as $key => $entry) { 206 echo "'" . $key . "' => '" . $entry . "'\n"; 207 } 208 echo "</pre></blockquote></blockquote>\n"; 209 } 210 211 if ($type == 'imap') { 212 echo "<strong>The following IMAP server information was discovered from the remote server:</strong>\n"; 213 $config = reset($success); 214 require_once './lib/IMAP/Client.php'; 215 $imapclient = &new IMP_IMAPClient($config['server'], $config['port'], $config['protocol']); 216 $use_tls = $imapclient->useTLS(); 217 if (!is_a($use_tls, 'PEAR_Error')) { 218 $res = $imapclient->login($user, $passwd); 219 } 220 if (isset($res) && !is_a($res, 'PEAR_Error')) { 221 echo "<blockquote><em>Namespace Information</em><blockquote><pre>"; 222 $namespace = $imapclient->namespace(); 223 if (is_array($namespace)) { 224 foreach ($namespace as $val) { 225 echo "NAMESPACE: \"" . $val['name'] . "\"\n"; 226 echo "DELIMITER: " . $val['delimiter'] . "\n"; 227 echo "TYPE: " . $val['type'] . "\n\n"; 228 } 229 } else { 230 echo "Could not retrieve namespace information from IMAP server.\n"; 231 } 232 echo "</pre></blockquote></blockquote>\n"; 233 234 echo "<blockquote><em>IMAP CHILDREN support:</em><blockquote><pre>"; 235 echo ($imapclient->queryCapability('CHILDREN')) ? 'SUPPORTED' : 'Not supported'; 236 echo "</pre></blockquote></blockquote>\n"; 237 238 echo "<blockquote><em>IMAP Charset Search Support:</em><blockquote><pre>"; 239 $charset = NLS::getCharset(); 240 if ($imapclient->searchCharset($charset)) { 241 echo "Server supports searching with the $charset character set.\n"; 242 } else { 243 echo "Server does not support searching with the $charset character set.\n"; 244 } 245 echo "</pre></blockquote></blockquote>\n"; 246 } else { 247 echo "<blockquote><em>Could not retrieve IMAP information from the remote server.</em></blockquote>"; 248 } 249 } 250 } else { 251 echo "<strong>Could not determine a successful connection protocol. Make sure your mail server is running and you have specified the correct port.</strong>\n"; 252 } 253 } else { 254 ?> 255 <form name="form1" method="post" action="test.php"> 256 <table> 257 <tr><td align="right">Server:</td><td><input type="text" name="server" /></td></tr> 258 <tr><td align="right">Port:</td><td><input type="text" name="port" /></td><td>(If non-standard port; leave blank to auto-detect using standard ports)</td></tr> 259 <tr><td align="right">User:</td><td><input type="text" name="user" /></td></tr> 260 <tr><td align="right">Password:</td><td><input type="password" name="passwd" /></td></tr> 261 <tr><td align="right">Server Type:</td><td><select name="server_type"><option value="imap">IMAP</option><option value="pop">POP</option></select></td></tr> 262 <tr><td></td><td><input type="submit" name="f_submit" value="Submit" /><input type="reset" name="f_reset" value="Reset" /></td></tr> 263 </table> 264 </form> 265 <?php } ?> 266 267 <?php 268 require TEST_TEMPLATES . 'footer.inc';
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:30:07 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |