1<?php 2 /* 3 * $Id: configtest.php 1581 2012-03-07 02:19:19Z dmorton $ 4 * 5 * MAIA MAILGUARD LICENSE v.1.0 6 * 7 * Copyright 2005 by Robert LeBlanc <rjl@renaissoft.com> 8 * David Morton <mortonda@dgrmm.net> 9 * All rights reserved. 10 * 11 * PREAMBLE 12 * 13 * This License is designed for users of Maia Mailguard 14 * ("the Software") who wish to support the Maia Mailguard project by 15 * leaving "Maia Mailguard" branding information in the HTML output 16 * of the pages generated by the Software, and providing links back 17 * to the Maia Mailguard home page. Users who wish to remove this 18 * branding information should contact the copyright owner to obtain 19 * a Rebranding License. 20 * 21 * DEFINITION OF TERMS 22 * 23 * The "Software" refers to Maia Mailguard, including all of the 24 * associated PHP, Perl, and SQL scripts, documentation files, graphic 25 * icons and logo images. 26 * 27 * GRANT OF LICENSE 28 * 29 * Redistribution and use in source and binary forms, with or without 30 * modification, are permitted provided that the following conditions 31 * are met: 32 * 33 * 1. Redistributions of source code must retain the above copyright 34 * notice, this list of conditions and the following disclaimer. 35 * 36 * 2. Redistributions in binary form must reproduce the above copyright 37 * notice, this list of conditions and the following disclaimer in the 38 * documentation and/or other materials provided with the distribution. 39 * 40 * 3. The end-user documentation included with the redistribution, if 41 * any, must include the following acknowledgment: 42 * 43 * "This product includes software developed by Robert LeBlanc 44 * <rjl@renaissoft.com>." 45 * 46 * Alternately, this acknowledgment may appear in the software itself, 47 * if and wherever such third-party acknowledgments normally appear. 48 * 49 * 4. At least one of the following branding conventions must be used: 50 * 51 * a. The Maia Mailguard logo appears in the page-top banner of 52 * all HTML output pages in an unmodified form, and links 53 * directly to the Maia Mailguard home page; or 54 * 55 * b. The "Powered by Maia Mailguard" graphic appears in the HTML 56 * output of all gateway pages that lead to this software, 57 * linking directly to the Maia Mailguard home page; or 58 * 59 * c. A separate Rebranding License is obtained from the copyright 60 * owner, exempting the Licensee from 4(a) and 4(b), subject to 61 * the additional conditions laid out in that license document. 62 * 63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS 64 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 65 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 66 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 67 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 68 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 69 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 70 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 71 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 72 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 73 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 74 * 75 */ 76 77 78 79 80 81 function find_path($path_list, $file) 82 { 83 $match = ""; 84 85 foreach ($path_list as $path) 86 { 87 $test_file = $path . "/" . $file; 88 if (file_exists($test_file)) { 89 $match = $test_file; 90 break; 91 } 92 } 93 94 return $match; 95 } 96 97 98 define('OK', "ok"); 99 define('WARN', "warn"); 100 define('ERROR', "error"); 101 define('UPDATE', "update"); 102 103 function print_row($left, $right, $err = OK) { 104 switch ($err) { 105 case OK: 106 $color = "#00DD00"; 107 $status = "<b>OK</b>"; 108 break; 109 case WARN: 110 $status = "<b>SKIPPED</b>"; 111 case UPDATE: 112 $color = "#DDDD00"; 113 break; 114 case ERROR: 115 $color = "#FE899B"; 116 $status = "<b>FAILED</b>"; 117 break; 118 } 119 if ($right != "") { 120 $status .= ":"; 121 } 122 print("<tr><td bgcolor=\"#CCCCCC\">$left</td>\n"); 123 print("<td bgcolor=\"$color\" width=\"75%\">$status $right </td>"); 124 print("</tr>\n"); 125 } 126 127?> 128<div align="center"> 129<table border="0" cellspacing="2" cellpadding="2" width="100%"> 130<tr><td bgcolor="#CCCCCC" align="center" colspan="2"> 131<h1>Maia Mailguard Configuration Tester</h1><br> 132</td></tr> 133<?php 134 135 if(!@include_once("../config.php")) 136 { 137 print_row('config.php', 'config.php file not setup', ERROR); 138 } 139 140 $status = OK; 141 142 //smarty compile dirs file permissions. 143 $smarty_base = "../themes"; // this assumes configtest.php is located in webroot/admin/ 144 $result = ""; 145 if (is_readable($smarty_base)){ 146 $dir = opendir($smarty_base); #open directory 147 while ($f = readdir($dir)) { #read one file name 148 if (!preg_match("/^..$/",$f) && $f!=='.' && $f!=='..' && is_dir($f)){ 149 if (is_writable($smarty_base . "/" . $f . "/compiled")) { 150 continue; 151 } else { 152 $status = ERROR; 153 $result .= "Cannot write to: " . $smarty_base . "/" . $f . "/compiled <br>\n"; 154 } 155 } 156 } 157 } else { 158 $status = ERROR; 159 $result = "Cannot read $smarty_base\n"; 160 } 161 if ($status == ERROR) { 162 $result .= "Please <a href=\"http://www.maiamailguard.com/maia/wiki/BlankPage\">" . 163 "set your file permissions</a> so that the web server " . 164 "user can write to the above directories. "; 165 } 166 print_row("File Permissions", $result, $status); 167 168 // PHP 169 $php_version = phpversion(); 170 $include_path = ini_get("include_path"); 171 $path_list = explode(":", $include_path); 172 $path_list[] = "../libs/"; 173 174 if ($php_version >= "4.0.2") { 175 if ($php_version == "5.0.3") { 176 $status = WARN; 177 $result = "PHP 5.0.3 has a bug that causes errors with PEAR::DB. It is fixed in the current snapshots."; 178 } else { 179 180 $result = $php_version; 181 $status = OK; 182 } 183 } else { 184 $result = "PHP version 4.0.2 or later is required. See " . 185 "<a href=\"http://pear.php.net/\">this page</a> for " . 186 "information about downloading a more current version of PHP."; 187 $status = ERROR; 188 } 189 print_row("PHP", $result, $status); 190 191 192 // PHP Modules 193 ob_start(); 194 phpinfo(INFO_MODULES); 195 $php_info = ob_get_contents(); 196 ob_end_clean(); 197 198 // register_globals 199 if (ini_get('register_globals')) { 200 $result = "The register_globals ini settings appears to be on, please set it to " . 201 "off in either your php.ini file, or in a .htaccess file. See " . 202 "<a href=\"http://us2.php.net/register_globals\">http://us2.php.net/register_globals</a> " . 203 "for more details."; 204 $status = ERROR; 205 } else { 206 $result = ""; 207 $status = OK; 208 } 209 print_row("register_globals", $result, $status); 210 211 212 // SMARTY 213 if (isset($smarty_path)) { 214 if (!($smarty_dir = find_path(array($smarty_path), "Smarty.class.php"))) { 215 $result = "Can't find Smarty.class.php in location specified in config.php: ( \$smarty_path = \"$smarty_path\";. )" . 216 "The Smarty templating engine is required. " . 217 "See <a href=\"http://www.smarty.net/\">this page</a> " . 218 "for more information about downloading and installing Smarty."; 219 $status = ERROR; 220 } else { 221 $status = OK; 222 $result = "Found Smarty in $smarty_dir"; 223 } 224 225 } else { 226 if (!($smarty_dir = find_path($path_list, "Smarty/Smarty.class.php"))) { 227 $result = "Not installed. The Smarty templating engine is required. " . 228 "See <a href=\"http://www.smarty.net/\">this page</a> " . 229 "for more information about downloading and installing Smarty."; 230 $status = ERROR; 231 } else { 232 $status = OK; 233 $result = "Found Smarty in $smarty_dir"; 234 } 235 } 236 print_row("Smarty Template Engine", $result, $status); 237 238 // wddx support 239 $have_wddx = false; 240 if(function_exists( 'wddx_serialize_value')) { 241 $have_wddx = true; 242 $result = "WDDX support available"; 243 $status = OK; 244 } else { 245 $result = "WDDX support not available. WDDX is needed for error reporting and debugging"; 246 $status = ERROR; 247 } 248 print_row("WDDX Support", $result, $status); 249 250 // multibyte support 251 $have_mb = false; 252 if(function_exists( 'mb_substr')) { 253 $have_mb = true; 254 $result = "Multibyte String support available"; 255 $status = OK; 256 } else { 257 $result = "Multibyte String support not available. <a href=\"http://us2.php.net/manual/en/book.mbstring.php\">Multibyte functions</a> are needed to display messages correctly."; 258 $status = ERROR; 259 } 260 print_row("Multibyte String Support", $result, $status); 261 262 // crypt support 263 if(function_exists( 'scrypt' ) || function_exists( 'crypt') || function_exists( 'password_hash' )) { 264 if (function_exists( 'scrypt' )) { $result = "scrypt() support available"; } 265 elseif (function_exists( 'password_hash' )) { $result = "password_hash() support available"; } 266 elseif (function_exists( 'crypt' )) { $result = "crypt() support available"; } 267 $status = OK; 268 } else { 269 $result = "scrypt() not available. Use \"pecl install scrypt\". "; 270 $result.= "password_hash() not available. Requires PHP5.5+, "; 271 $result.= "crypt() not available. Requires PHP4+"; 272 $status = ERROR; 273 } 274 print_row("scrypt() Support", $result, $status); 275 276 // iconv support 277 $have_iconv = false; 278 if(function_exists( 'iconv')) { 279 $have_iconv = true; 280 $result = "iconv support available"; 281 $status = OK; 282 } else { 283 $result = "iconv support not available. <a href=\"http://php.net/manual/en/book.iconv.php\">iconv</a> is needed to display messages correctly."; 284 $status = ERROR; 285 } 286 print_row("iconv function", $result, $status); 287 288 289 // mysql support 290 $have_mysql = false; 291 if(function_exists( 'mysql_connect' ) || function_exists( 'mysqli_connect')) { 292 $have_mysql = true; 293 $result = "MySQL support available"; 294 $status= OK; 295 } else { 296 $result = "MySQL support not available"; 297 $status = WARN; 298 } 299 print_row("MySQL Support", $result, $status); 300 301 // PostgreSQL support 302 $have_psql = false; 303 if(function_exists( 'pg_connect' )) { 304 $have_psql = true; 305 $result = "PostgreSQL support available"; 306 $status= OK; 307 } else { 308 $result = "PostgreSQL support not available"; 309 $status = WARN; 310 } 311 print_row("PostgreSQL Support", $result, $status); 312 313 // Database support 314 if(!($have_mysql || $have_psql)) { 315 $result = "No supported databases are available!"; 316 $status = ERROR; 317 } else { 318 $result = "Database support is ok"; 319 $status = OK; 320 } 321 print_row("Database Support", $result, $status); 322 323 // PEAR 324 $have_pear = false; 325 if (!($pear_dir = find_path($path_list, "PEAR"))) { 326 $result = "Not installed. The PEAR extension is required by several other " . 327 "PHP extensions that Maia needs. See <a href=\"http://pear.php.net/\">this page</a> " . 328 "for more information about downloading and installing PEAR."; 329 $status = ERROR; 330 } else { 331 // include_once ("PEAR/Remote.php"); // PEAR::Remote 332 include_once ("PEAR/Config.php"); // PEAR::Registry 333 334 $have_pear = true; 335 $pear = new PEAR_Config(); 336 $pear_reg = $pear->getRegistry(); 337 $pear_info = $pear_reg->packageInfo("PEAR"); 338 $pear_list = $pear_reg->listPackages(); 339 $pear_version = is_array($pear_info["version"])?$pear_info["version"]["release"]:$pear_info["version"]; 340 $result = $pear_version; 341 $status = OK; 342 } 343 print_row("PEAR", $result, $status); 344 345 346 // PEAR::Mail_Mime 347 if ($have_pear) { 348 if (!in_array("mail_mime", $pear_list)) { 349 $result = "Not installed. This PHP extension is required to decode " . 350 "MIME-structured e-mail. Use <b>pear install Mail_Mime</b> to " . 351 "install this."; 352 $status = ERROR; 353 } else { 354 $info = $pear_reg->packageInfo("Mail_Mime"); 355 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 356 if (version_compare($result,"1.3.0") < 0) { 357 $version = $result; 358 $result = "Version $version installed. Versions of Mail_Mime below 1.3.0 " . 359 "are known to be buggy. Use <b>pear upgrade Mail_Mime</b> to " . 360 "upgrade to the latest version."; 361 $status = ERROR; 362 } elseif (version_compare($result,"1.5.0") < 0) { 363 $status = OK; 364 $check_mime_decode = false; 365 } else { 366 $check_mime_decode = true; 367 $status = OK; 368 } 369 } 370 } else { 371 $result = "Requires PEAR"; 372 $status = WARN; 373 } 374 print_row("PEAR::Mail_Mime", $result, $status); 375 376 // PEAR::Mail_Mime 377 if ($check_mime_decode) { 378 if (!in_array("mail_mimedecode", $pear_list)) { 379 $result = "Not installed. This PHP extension is required to decode " . 380 "MIME-structured e-mail. Use <b>pear install Mail_mimeDecode</b> to " . 381 "install this. (Mail_mimeDecode was split from Mail_Mime at version 1.5.0)"; 382 $status = ERROR; 383 } else { 384 $info = $pear_reg->packageInfo("Mail_mimeDecode"); 385 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 386 if (version_compare($result,"1.5.0") < 0) { 387 $version = $result; 388 $result = "Version $version installed. Versions of Mail_Mime below 1.3.0 " . 389 "are known to be buggy. Use <b>pear upgrade Mail_Mime</b> to " . 390 "upgrade to the latest version."; 391 $status = ERROR; 392 } else { 393 $status = OK; 394 } 395 } 396 print_row("PEAR::Mail_mimeDecode", $result, $status); 397 } 398 399 function strip_tailing_slash($path) { 400 return rtrim($path, '/'); 401 } 402 403 404 // PEAR::MDB2 405 if ($have_pear) { 406 if (!in_array("mdb2", $pear_list)) { 407 $result = "Not installed. This PHP extension is required in order to provide " . 408 "database abstraction. Use <b>pear install MDB2</b> to install this."; 409 $status = ERROR; 410 } else { 411 $db_info = $pear_reg->packageInfo("MDB2"); 412 $pathArray = explode( PATH_SEPARATOR, get_include_path() ); 413 $pathArray = array_map('strip_tailing_slash', $pathArray); 414 $db_path = dirname($db_info['filelist']['MDB2.php']['installed_as']); 415 if (in_array($db_path, $pathArray)) { 416 include_once ("MDB2.php"); // PEAR::MDB2 417 $test_dbh = MDB2::connect($maia_sql_dsn); 418 if (MDB2::isError($test_dbh)) { 419 $result = "Could not connect to database. Check the $maia_sql_dsn setting in config.php."; 420 $status = ERROR; 421 } else { 422 $result = $db_version = is_array($db_info["version"])?$db_info["version"]["release"]:$db_info["version"]; 423 $result .= " MDB2.php installed as: " . $db_info['filelist']['MDB2.php']['installed_as']; 424 $db_type = $test_dbh->phptype; 425 426 } 427 } else { 428 $result = "MDB2.php installed in: " . $db_path . " but not in include path: " . get_include_path(); 429 $status = ERROR; 430 } 431 } 432 } else { 433 $result = "Requires PEAR"; 434 $status = WARN; 435 } 436 print_row("PEAR::MDB2", $result, $status); 437 438 // PEAR::MDB2:mysqli 439 if ($have_pear) { 440 if (!in_array("mdb2_driver_mysqli", $pear_list)) { 441 $result = "Not installed. This PHP extension is required in order to provide " . 442 "database abstraction. Use <b>pear install MDB2#mysqli</b> to install this."; 443 $status = ERROR; 444 } else { 445 $result = "Pear::MDB2#mysqli installed"; 446 $status = OK; 447 } 448 print_row("PEAR::MDB2#mysqli", $result, $status); 449 } 450 451//Database Version 452 if (isset($maia_sql_dsn)) { 453 if (preg_match('/^mysqli/', $maia_sql_dsn)) { 454 $db_version = mysqli_get_server_info($test_dbh->connection); 455 $status = OK; 456 $result = "No minimum specified yet... Installed: " . $db_version; 457 } elseif (preg_match('/^mysql/', $maia_sql_dsn)) { 458 $db_version = mysql_get_server_info($test_dbh->connection); 459 $status = OK; 460 $result = "No minimum specified yet... Installed: " . $db_version; 461 } elseif (preg_match('/^pgsql/', $maia_sql_dsn)) { 462 if (function_exists("pg_version")) { 463 $pg_version_result = pg_version($test_dbh->connection); 464 $db_version = $pg_version_result['server'] ; 465 if ($db_version >= "8.0" ) { 466 $status = OK; 467 $result = "Database version: " . $db_version; 468 } else { 469 $status = ERROR; 470 $result = "Postgresql >= 8.0 required."; 471 } 472 } else { 473 $status = WARN; 474 $result = "Cannot determine database version. We recommend Postgresql > 8.0; Please verify this before continuing."; 475 } 476 } else { 477 $status = ERROR; 478 $result = "Unsupported database"; 479 } 480 } else { 481 $status = ERROR; 482 $result = "Cannot determine database version. Please check the maia_sql_dsn setting in the config file."; 483 } 484 print_row("Database Version", $result, $status); 485 486 487 // PEAR::Pager 488 if ($have_pear) { 489 if (!in_array("pager", $pear_list)) { 490 $result = "Not installed. This PHP extension is required in order to paginate " . 491 "the list of mail items in the quarantines and the ham cache. Use " . 492 "<b>pear install Pager</b> to install this."; 493 $status = ERROR; 494 } else { 495 $pager_info = $pear_reg->packageInfo("Pager"); 496 $result = is_array($pager_info["version"])?$pager_info["version"]["release"]:$pager_info["version"]; 497 $status = OK; 498 } 499 } else { 500 $result ="Requires PEAR"; 501 $status = WARN; 502 } 503 print_row("PEAR::Pager", $result, $status); 504 505 506 // PEAR::Net_Socket 507 if ($have_pear) { 508 if (!in_array("net_socket", $pear_list)) { 509 $result = "Not installed. This PHP extension is required for Net_SMTP to send mail when rescuing email"; 510 $status = ERROR; 511 } else { 512 $info = $pear_reg->packageInfo("Net_Socket"); 513 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 514 $status = OK; 515 } 516 } else { 517 $result ="Requires PEAR"; 518 $status = WARN; 519 } 520 print_row("PEAR::Net_Socket", $result, $status); 521 522 523 // PEAR::Net_SMTP 524 if ($have_pear) { 525 if (!in_array("net_smtp", $pear_list)) { 526 $result = "Not installed. This PHP extension is required to send mail when rescuing email"; 527 $status = ERROR; 528 } else { 529 $info = $pear_reg->packageInfo("Net_SMTP"); 530 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 531 if (version_compare($result,"1.2.5") < 0) { 532 $version = $result; 533 $result = "Version $version installed. Need at least 1.2.5"; 534 $status = ERROR; 535 } else { 536 $status = OK; 537 } 538 } 539 } else { 540 $result ="Requires PEAR"; 541 $status = WARN; 542 } 543 print_row("PEAR::Net_SMTP", $result, $status); 544 545 // PEAR::Auth_SASL 546 if ($have_pear) { 547 if (!in_array("auth_sasl", $pear_list)) { 548 $result = "Not installed. This module is required by PEAR::Net_SMTP in " . 549 "order to support the DIGEST-MD5 and CRAM-MD5 SMTP authentication methods."; 550 $status = ERROR; 551 } else { 552 $info = $pear_reg->packageInfo("Auth_SASL"); 553 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 554 $status = OK; 555 } 556 } else { 557 $result ="Requires PEAR"; 558 $status = WARN; 559 } 560 print_row("PEAR::Auth_SASL", $result, $status); 561 562 // PEAR::Net_IMAP 563 if ($have_pear) { 564 if (!in_array("net_imap", $pear_list)) { 565 $result = "Not installed. This PHP extension is required to authenticate maia against IMAP."; 566 $status = WARN; 567 } else { 568 $info = $pear_reg->packageInfo("Net_IMAP"); 569 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 570 if ($result == "1.0.3" && $php_version >= "5.0.0") { 571 $result = "A bug exists in Net_IMAP 1.0.3 when run under PHP 5, see <a href=\"http://www.maiamailguard.com/maia/ticket/266\">http://www.maiamailguard.com/maia/ticket/266</a> for more details."; 572 $status = WARN; 573 } elseif ($result == "1.1.1") { 574 $result = "A regression bug exists in Net_IMAP 1.1.1, possibly restricted to ssl on alternate ports; see <a href=\"http://www.maiamailguard.com/maia/ticket/569\">http://www.maiamailguard.com/maia/ticket/569</a> for more details. Reverting to 1.1.0 helps."; 575 $status = WARN; 576 } else { 577 $status = OK; 578 } 579 } 580 } else { 581 $result ="Requires PEAR"; 582 $status = WARN; 583 } 584 print_row("PEAR::Net_IMAP", $result, $status); 585 586 // PEAR::Net_POP3 587 if ($have_pear) { 588 if (!in_array("net_pop3", $pear_list)) { 589 $result = "Not installed. This PHP extension is required to authenticate maia against POP3."; 590 $status = WARN; 591 } else { 592 $info = $pear_reg->packageInfo("Net_POP3"); 593 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 594 $status = OK; 595 } 596 } else { 597 $result ="Requires PEAR"; 598 $status = WARN; 599 } 600 print_row("PEAR::Net_POP3", $result, $status); 601 602 // PEAR::Log 603 if ($have_pear) { 604 if (!in_array("log", $pear_list)) { 605 $result = "Needed for debugging and logging. Use <b>pear install Log</b> to install " . 606 "this PHP extension."; 607 $status = ERROR; 608 } else { 609 $log_info = $pear_reg->packageInfo("Log"); 610 $result = is_array($log_info["version"])?$log_info["version"]["release"]:$log_info["version"]; 611 $status = OK; 612 } 613 } else { 614 $result = "Requires PEAR"; 615 $status = WARN; 616 } 617 print_row("PEAR::Log", $result, $status); 618 619 // PEAR::Image_Color 620 if ($have_pear) { 621 if (!in_array("image_color", $pear_list)) { 622 $result = "Not installed. Optional package, required only if you wish " . 623 "to enable the graphical chart features."; 624 $status = WARN; 625 } else { 626 $info = $pear_reg->packageInfo("Image_Color"); 627 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 628 $status = OK; 629 } 630 } else { 631 $result ="Requires PEAR"; 632 $status = WARN; 633 } 634 print_row("PEAR::Image_Color", $result, $status); 635 636 // PEAR::Image_Canvas 637 if ($have_pear) { 638 if (!in_array("image_canvas", $pear_list)) { 639 $result = "Not installed. Optional package, required only if you wish " . 640 "to enable the graphical chart features."; 641 $status = WARN; 642 } else { 643 $info = $pear_reg->packageInfo("Image_Canvas"); 644 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 645 $status = OK; 646 } 647 } else { 648 $result ="Requires PEAR"; 649 $status = WARN; 650 } 651 print_row("PEAR::Image_Canvas", $result, $status); 652 653 // PEAR::Image_Graph 654 if ($have_pear) { 655 if (!in_array("image_graph", $pear_list)) { 656 $result = "Not installed. Optional package, required only if you wish " . 657 "to enable the graphical chart features."; 658 $status = WARN; 659 } else { 660 $info = $pear_reg->packageInfo("Image_Graph"); 661 $version = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 662 if ( $version <= "0.7.2") { 663 $status = WARN; 664 $result = "Found version: ${version} - Image_Graph >= 0.7.2 recommended, but there is a bug in 0.7.2 that requires a small patch. See <a href=\"http://www.maiamailguard.org/maia/ticket/326\">http://www.maiamailguard.org/maia/ticket/326</a> for more details and the patch."; 665 } else { // $version > "0.7.2") 666 $status = OK; 667 $result = $version; 668 } 669 } 670 } else { 671 $result ="Requires PEAR"; 672 $status = WARN; 673 } 674 print_row("PEAR::Image_Graph", $result, $status); 675 676 // PEAR::Numbers_Roman 677 if ($have_pear) { 678 if (!in_array("numbers_roman", $pear_list)) { 679 $result = "Not installed. Optional package, required only if you wish " . 680 "to enable the graphical chart features."; 681 $status = WARN; 682 } else { 683 $info = $pear_reg->packageInfo("Numbers_Roman"); 684 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 685 $status = OK; 686 } 687 } else { 688 $result ="Requires PEAR"; 689 $status = WARN; 690 } 691 print_row("PEAR::Numbers_Roman", $result, $status); 692 693 // PEAR::Numbers_Words 694 if ($have_pear) { 695 if (!in_array("numbers_words", $pear_list)) { 696 $result = "Not installed. Optional package, required only if you wish " . 697 "to enable the graphical chart features."; 698 $status = WARN; 699 } else { 700 $info = $pear_reg->packageInfo("Numbers_Words"); 701 $result = is_array($info["version"])?$info["version"]["release"]:$info["version"]; 702 $status = OK; 703 } 704 } else { 705 $result ="Requires PEAR"; 706 $status = WARN; 707 } 708 print_row("PEAR::Numbers_Words", $result, $status); 709 710 // html purifier 711 if ( @include_once('HTMLPurifier.auto.php')) { 712 $version = HTMLPurifier::VERSION; 713 if ($version < "4.0.0") { 714 $status = ERROR; 715 $result = "Minimum required version of HTMLPurifier is 4.0.0, found: $version"; 716 } else { 717 $status = OK; 718 $result = $version; 719 } 720 } else { 721 $result = 'Not found in include path. The easiest way to install is to use PEAR as ' . 722 '<a href="http://htmlpurifier.org/download.html#PEAR">described here</a>'; 723 $status = ERROR; 724 } 725 print_row("HTMLPurifier", $result, $status); 726 727 // html_purifier cache permissions 728 if ($purifier_cache) { 729 if (is_writable($purifier_cache)) { 730 $result = "HTML Purifier cache dir: $purifier_cache"; 731 $status = OK; 732 } else { 733 $result = 'purifier_cache directory not writable: ' . $purifier_cache; 734 $status = ERROR; 735 } 736 } else { 737 $result = "(OPTIONAL) purifer_cache is not set in config.php. Maia will work without it, but the " . 738 "message viewer might be a little faster if you set it to a directory that is " . 739 "writable by the web server."; 740 $status = WARN; 741 } 742 print_row("HTMLPurifier cache", $result, $status); 743 744 745 // IMAP 746 if (!function_exists("imap_open")) { 747 $result = "Not installed, but only required if you want to be able to authenticate " . 748 "with IMAP against using the exchange authenticator. See <a href=\"http://www.php.net/imap/\">this page</a> for " . 749 "more information about downloading the IMAP extensions to PHP, and " . 750 "instructions for recompiling PHP with the --with-imap flag."; 751 $status = WARN; 752 } else { 753 if (preg_match("/IMAP c-Client Version.*?>([0-9]+)/si", $php_info, $match)) { 754 $result = $match[1]; 755 } else { 756 $result = "Unknown"; 757 } 758 $status = OK; 759 } 760 print_row("IMAP library", $result, $status); 761 762 // LDAP 763 if (!function_exists("ldap_connect")) { 764 $result = "Not installed, but only required if you want to be able to authenticate " . 765 "with LDAP. See <a href=\"http://www.php.net/ldap/\">this page</a> for " . 766 "more information about downloading the LDAP extensions to PHP, and " . 767 "instructions for recompiling PHP with the --with-ldap flag."; 768 $status = ERROR; 769 } else { 770 $result = ""; 771 $status = OK; 772 } 773 print_row("LDAP library", $result, $status); 774 775 776 // BC 777 if (!function_exists("bcadd")) { 778 $result = "Not installed. This PHP extension is required in order to decode certain " . 779 "types of URLs. See <a href=\"http://www.php.net/bc/\">this page</a> " . 780 "for more information about recompiling PHP with the --enable-bcmath flag."; 781 $status = ERROR; 782 } else { 783 $result = ""; 784 $status = OK; 785 } 786 print_row("BC math library", $result, $status); 787 788 789 // gd 790 if (!function_exists("gd_info")) { 791 $result = "Not installed, but only required if you want to be able to generate charts " . 792 "based on Maia's statistics. See <a href=\"http://www.php.net/gd/\">this page</a> " . 793 "for more information about recompiling PHP with the --with-gd flag."; 794 $status = ERROR; 795 } else { 796 $info = gd_info(); 797 $result = $info["GD Version"]; 798 $status = OK; 799 } 800 print_row("gd graphics library", $result, $status); 801 802 803 print("</table></div>\n"); 804 805?> 806