[ Index ] |
|
Code source de Horde 3.1.3 |
1 <?php 2 /** 3 * $Horde: horde/test.php,v 1.122.6.17 2006/06/10 23:16:51 chuck Exp $ 4 * 5 * Copyright 2002-2006 Brent J. Nordquist <bjn@horde.org> 6 * Copyright 1999-2006 Charles J. Hagenbuch <chuck@horde.org> 7 * Copyright 1999-2006 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 /* Register a session. */ 14 session_start(); 15 if (!isset($_SESSION['horde_test_count'])) { 16 $_SESSION['horde_test_count'] = 0; 17 } 18 19 /* Include Horde's core.php file. */ 20 include_once 'lib/core.php'; 21 22 /* We should have loaded the String class, from the Horde_Util package, in 23 * core.php. If String:: isn't defined, then we're not finding some critical 24 * libraries. */ 25 if (!class_exists('String')) { 26 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 AND are installing a CVS checkout, 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>'; 27 exit; 28 } 29 30 /* Initialize the Horde_Test:: class. */ 31 if (!include_once 'lib/Test.php') { 32 /* Try and provide enough information to debug the missing file. */ 33 echo '<br /><span style="color: red; font-size: 18px; font-weight: bold;">Unable to find horde/lib/Test.php. Your Horde installation may be missing critical files, or PHP may not have sufficient permissions to include files. There may be error messages printed above this message that will help you in debugging the problem.</span>'; 34 exit; 35 } 36 37 /* If we've gotten this far, we should have found enough of Horde to run 38 * tests. Create the testing object. */ 39 $horde_test = &new Horde_Test(); 40 41 /* Horde definitions. */ 42 $module = 'Horde'; 43 require_once './lib/version.php'; 44 $module_version = HORDE_VERSION; 45 46 /* PHP module capabilities. */ 47 $module_list = array( 48 'ctype' => 'Ctype Support', 49 (version_compare(phpversion(), '5') < 0 ? 'domxml' : 'dom') => 'DOM XML Support', 50 'ftp' => 'FTP Support', 51 'gd' => 'GD Support', 52 'gettext' => array( 53 'descrip' => 'Gettext Support', 54 'error' => 'Horde will not run without gettext support. Compile PHP with <code>--with-gettext</code> before continuing.', 55 'fatal' => true 56 ), 57 'iconv' => array( 58 'descrip' => 'Iconv Support', 59 'error' => 'If you want to take full advantage of Horde\'s localization features and character set support, you will need the iconv extension.' 60 ), 61 'imap' => 'IMAP Support', 62 'ldap' => 'LDAP Support', 63 'mbstring' => array( 64 'descrip' => 'Mbstring Support', 65 'error' => 'If you want to take full advantage of Horde\'s localization features and character set support, you will need the mbstring extension.' 66 ), 67 'mcrypt' => array( 68 'descrip' => 'Mcrypt Support', 69 'error' => 'Mcrypt is a general-purpose cryptography library which is broader and significantly more efficient (FASTER!) than PHP\'s own cryptographic code and will provider faster logins.' 70 ), 71 'fileinfo' => array( 72 'descrip' => 'MIME Magic Support (fileinfo)', 73 'error' => 'The fileinfo PECL module or the mime_magic PHP extension (see below) will most likely provide faster MIME Magic lookups than the built-in Horde PHP magic code. See horde/docs/INSTALL for information on how to install PECL/PHP extensions.' 74 ), 75 'memcache' => array( 76 'descrip' => 'memcached Support (memcache)', 77 'error' => 'The memcache PECL module is needed only if you are using the memcached SessionHandler. See horde/docs/INSTALL for information on how to install PECL/PHP extensions.' 78 ), 79 'mime_magic' => array( 80 'descrip' => 'MIME Magic Support (mime_magic)', 81 'error' => 'The fileinfo PECL module (see above) or the mime_magic PHP extension will most likely provide faster MIME Magic lookups than the built-in Horde PHP magic code. See horde/docs/INSTALL for information on how to install PECL/PHP extensions.' 82 ), 83 'mysql' => 'MySQL Support', 84 'openssl' => 'OpenSSL Support', 85 'pgsql' => 'PostgreSQL Support', 86 'session' => array( 87 'descrip' => 'Session Support', 88 'fatal' => true), 89 'xml' => 'XML Support', 90 'zlib' => array( 91 'descrip' => 'Zlib Support', 92 'error' => 'The zlib module is highly recommended for use with Horde. It allows page compression and handling of ZIP and GZ data. Compile PHP with <code>--with-zlib</code> to activate.', 93 'fatal' => false 94 ), 95 ); 96 97 98 /* PHP Settings. */ 99 $setting_list = array( 100 'magic_quotes_runtime' => array( 101 'setting' => false, 102 'error' => 'magic_quotes_runtime may cause problems with database inserts, etc. Turn it off.' 103 ), 104 'memory_limit' => array( 105 'setting' => false, 106 'error' => 'If PHP\'s internal memory limit is turned on and if not set high enough Horde will not be able to handle large data items (e.g. large mail attachments in IMP). If possible, you should disable the PHP memory limit by recompiling PHP <em>without</em> the "--enable-memory-limit" flag. If this is not possible, then you should set the value of memory_limit in php.ini to a sufficiently high value (Current value of memory_limit: ' . ini_get('memory_limit') . ').' 107 ), 108 'safe_mode' => array( 109 'setting' => false, 110 'error' => 'If safe_mode is enabled, Horde cannot set enviroment variables, which means Horde will be unable to translate the user interface into different languages.' 111 ), 112 'session.use_trans_sid' => array( 113 'setting' => false, 114 'error' => 'Horde will work with session.use_trans_sid turned on, but you may see double session-ids in your URLs, and if the session name in php.ini differs from the session name configured in Horde, you may get two session ids and see other odd behavior. The URL-rewriting that use_trans_sid does also tends to break XHTML compliance. In short, you should really disable this.' 115 ), 116 'session.auto_start' => array( 117 'setting' => false, 118 'error' => 'Horde won\'t work with automatically started sessions, because it explicitly creates new session when necessary to protect against session fixations.' 119 ) 120 ); 121 122 123 /* PEAR */ 124 $pear_list = array( 125 'Mail' => array( 126 'path' => 'Mail/RFC822.php', 127 'error' => 'You do not have the Mail package installed on your system. See the INSTALL file for instructions on how to install the package.' 128 ), 129 'Mail_Mime' => array( 130 'path' => 'Mail/mimeDecode.php', 131 'error' => 'You do not have the Mail_Mime package installed on your system. See the INSTALL file for instructions on how to install the package.', 132 'required' => true 133 ), 134 'Log' => array( 135 'path' => 'Log.php', 136 'error' => 'Make sure you are using a version of PEAR which includes the Log classes, or that you have installed the Log package seperately. See the INSTALL file for instructions on installing Log.', 137 'required' => true, 138 'function' => '_check_pear_log_version' 139 ), 140 'DB' => array( 141 'path' => 'DB.php', 142 'error' => 'You will need DB if you are using SQL drivers for preferences, contacts (Turba), etc.', 143 'function' => '_check_pear_db_version' 144 ), 145 'Net_Socket' => array( 146 'path' => 'Net/Socket.php', 147 'error' => 'Make sure you are using a version of PEAR which includes the Net_Socket class, or that you have installed the Net_Socket package seperately. See the INSTALL file for instructions on installing Net_Socket.' 148 ), 149 'Date' => array( 150 'path' => 'Date/Calc.php', 151 'error' => 'Horde requires the Date_Calc class for Kronolith to calculate dates.' 152 ), 153 'Auth_SASL' => array( 154 'path' => 'Auth/SASL.php', 155 'error' => 'Horde will work without the Auth_SASL class, but if you use Access Control Lists in IMP you should be aware that without this class passwords will be sent to the IMAP server in plain text when retrieving ACLs.' 156 ), 157 'HTTP_Request' => array( 158 'path' => 'HTTP/Request.php', 159 'error' => 'Parts of Horde (HTML composition in IMP, Jonah, the XML-RPC client/server) use the HTTP_Request library to retrieve URLs and do other HTTP requests.' 160 ), 161 'File' => array( 162 'path' => 'File.php', 163 'error' => 'Horde will require the File class when importing CSV files.' 164 ), 165 'Net_SMTP' => array( 166 'path' => 'Net/SMTP.php', 167 'error' => 'Make sure you are using the Net_SMTP module if you want "smtp" to work as a mailer option.' 168 ), 169 'Services_Weather' => array( 170 'path' => 'Services/Weather.php', 171 'error' => 'Services_Weather is used by the weather applet/block on the portal page.' 172 ), 173 'Cache' => array( 174 'path' => 'Cache.php', 175 'error' => 'Cache is used by the Services_Weather module on the weather applet/block on the portal page.' 176 ), 177 'XML_Serializer' => array( 178 'path' => 'XML/Serializer.php', 179 'error' => 'XML_Serializer is used by the Services_Weather module on the weather applet/block on the portal page.' 180 ) 181 ); 182 183 /* Additional check for PEAR Log module for its version. */ 184 function _check_pear_log_version() 185 { 186 if (!defined('PEAR_LOG_INFO')) { 187 return 'Your version of Log is not recent enough.'; 188 } 189 } 190 191 /* Additional check for PEAR DB module for its version. */ 192 function _check_pear_db_version() 193 { 194 if (!defined('DB_PORTABILITY_LOWERCASE')) { 195 return 'Your version of DB is not recent enough.'; 196 } 197 } 198 199 /* There is a version of the File.php that wants a PEAR::registerShutdownFunc 200 * which is what newpear tests for. This function seems to only have existed 201 * for a little while, but the PEAR group hasn't fixed this yet, so some 202 * people get an error if they have a certain (release) version of PEAR. We 203 * test for it here. If it's a safe version, test as normal, otherwise try a 204 * less effective but non-erroring test for File::CSV. */ 205 if (!$horde_test->isRecentPEAR()) { 206 $path = ini_get('include_path'); 207 if (empty($path)) { 208 $path = '.'; 209 } 210 $pear_list['File_CSV']['path'] = 'XXXXXX.php'; 211 foreach (explode(':', $path) as $dir) { 212 if (substr($dir, -1) != '/') { 213 $dir .= '/'; 214 } 215 $file1 = $dir . 'File/CSV.php'; 216 $file2 = $dir . 'File.php'; 217 $file3 = $dir . 'PEAR.php'; 218 if (file_exists($file1) && file_exists($file2) && file_exists($file3)) { 219 /* Change the filename to something we know will be found. */ 220 $pear_list['File_CSV']['path'] = 'PEAR.php'; 221 break; 222 } 223 } 224 } 225 226 /* Required configuration files. */ 227 $file_list = array( 228 'config/conf.php' => null, 229 'config/mime_drivers.php' => null, 230 'config/nls.php' => null, 231 'config/prefs.php' => null, 232 'config/registry.php' => null 233 ); 234 235 236 /* Get the status output now. */ 237 $module_output = $horde_test->phpModuleCheck($module_list); 238 $setting_output = $horde_test->phpSettingCheck($setting_list); 239 $pear_output = $horde_test->PEARModuleCheck($pear_list); 240 $config_output = $horde_test->requiredFileCheck($file_list); 241 242 243 /* Handle special modes. */ 244 if (!empty($_GET['mode'])) { 245 $url = !empty($_GET['url']) ? $_GET['url'] : 'test.php'; 246 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">'; 247 switch ($_GET['mode']) { 248 case 'extensions': 249 require TEST_TEMPLATES . 'extensions.inc'; 250 exit; 251 252 case 'phpinfo': 253 echo '<a href="' . htmlspecialchars($url) . '?mode=test"><< Back to test.php</a>'; 254 phpinfo(); 255 exit; 256 257 case 'filetest': 258 echo '<a href="' . htmlspecialchars($url) . '?mode=test"><< Back to test.php</a>'; 259 ?> 260 <html> 261 <body bgcolor="white" text="black"> 262 <p><font face="Helvetica, Arial, sans-serif" size="2"> 263 There are some versions of PEAR that were released at times that 264 did not contain a function that File.php expects. This does not 265 seem to have caused problems for anyone except when running our 266 test script, but you need to be aware of it. If you see a fatal 267 error in File.php listed below this text, you have one of the 268 combinations of problem files. Make sure you have the latest 269 PEAR and File packages available (<a href="http://pear.php.net/"> 270 see http://pear.php.net</a>). If you do not get the error, you are 271 in fine shape.</p> 272 <?php include_once 'File/CSV.php'; 273 exit; 274 275 case 'unregister': 276 unset($_SESSION['horde_test_count']); 277 ?> 278 <html> 279 <body bgcolor="white" text="black"> 280 <font face="Helvetica, Arial, sans-serif" size="2"> 281 The test session has been unregistered.<br> 282 <a href="test.php">Go back</a> to the test.php page.<br> 283 <?php 284 exit; 285 } 286 } 287 288 require TEST_TEMPLATES . 'header.inc'; 289 require TEST_TEMPLATES . 'version.inc'; 290 291 ?> 292 293 <h1>Horde Applications</h1> 294 <ul> 295 <?php 296 297 /* Get Horde module version information. */ 298 $modules = $horde_test->applicationList(); 299 foreach ($modules as $app => $val) { 300 $app = ucfirst($app); 301 echo '<li>' . $app . ': ' . $val->version; 302 if (isset($val->test)) { 303 echo ' (<a href="' . $val->test . '">run ' . $app . ' tests</a>)'; 304 } 305 echo "</li>\n"; 306 } 307 308 ?> 309 </ul> 310 311 <?php 312 313 /* Display PHP Version information. */ 314 $php_info = $horde_test->getPhpVersionInformation(); 315 require TEST_TEMPLATES . 'php_version.inc'; 316 317 ?> 318 319 <h1>PHP Module Capabilities</h1> 320 <ul> 321 <?php echo $module_output ?> 322 </ul> 323 324 <h1>Miscellaneous PHP Settings</h1> 325 <ul> 326 <?php echo $setting_output ?> 327 </ul> 328 329 <h1>File Uploads</h1> 330 <ul> 331 <?php echo $horde_test->phpSettingCheck(array('file_uploads' => array('setting' => true, 'error' => 'file_uploads must be enabled for some features like sending emails with IMP.' ))) ?> 332 <?php if ($dir = ini_get('upload_tmp_dir')): ?> 333 <li>upload_tmp_dir: <font color="<?php echo is_writable($dir) ? 'green' : 'red' ?>"><strong><?php echo $dir ?></strong></font></li> 334 <?php endif; ?> 335 <li>upload_max_filesize: <?php echo ini_get('upload_max_filesize') ?></li> 336 <li>post_max_size: <?php echo ini_get('post_max_size') ?></li> 337 </ul> 338 339 <h1>Required Horde Configuration Files</h1> 340 <ul> 341 <?php echo $config_output ?> 342 </ul> 343 344 <h1>PHP Sessions</h1> 345 <?php $_SESSION['horde_test_count']++; ?> 346 <ul> 347 <li>Session counter: <?php echo $_SESSION['horde_test_count']; ?></li> 348 <li>To unregister the session: <a href="test.php?mode=unregister">click here</a></li> 349 </ul> 350 351 <h1>PEAR</h1> 352 <ul> 353 <?php echo $pear_output ?> 354 </ul> 355 356 <?php 357 require TEST_TEMPLATES . 'footer.inc';
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 18:01:28 2007 | par Balluche grâce à PHPXref 0.7 |