cleaned tabs
[squirrelmail.git] / src / configtest.php
index 964da9181e254c84e073bb979bbffc7622d01a77..f60b67abba99b4a5ddafa6a3061767672fcb002d 100644 (file)
@@ -1,11 +1,13 @@
 <?php
-/*
+/**
  * SquirrelMail configtest script
  *
  * Copyright (c) 2003-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
- * $Id$
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage config
  */
 
 /************************************************************
@@ -25,6 +27,7 @@ function do_err($str, $exit = TRUE) {
 $IND = str_repeat('&nbsp;',4);
 
 ob_implicit_flush();
+/** @ignore */
 define('SM_PATH', '../');
 
 /*
@@ -177,31 +180,33 @@ if($useSendmail) {
                         $errorNumber, $errorString);
     if(!$stream) {
         do_err("Error connecting to SMTP server \"$smtpServerAddress:$smtpPort\".".
-            "Server error: ($errorNumber) $errorString");
+            "Server error: ($errorNumber) ".htmlspecialchars($errorString));
     }
 
     // check for SMTP code; should be 2xx to allow us access
     $smtpline = fgets($stream, 1024);
     if(((int) $smtpline{0}) > 3) {
-        do_err("Error connecting to SMTP server. Server error: ".$smtpline);
+        do_err("Error connecting to SMTP server. Server error: ".
+           htmlspecialchars($smtpline));
     }
 
     fputs($stream, 'QUIT');
     fclose($stream);
-    echo $IND . 'SMTP server OK (<tt><small>'.trim($smtpline)."</small></tt>)<br />\n";
+    echo $IND . 'SMTP server OK (<tt><small>'.
+        trim(htmlspecialchars($smtpline))."</small></tt>)<br />\n";
 
     /* POP before SMTP */
     if($pop_before_smtp) {
         $stream = fsockopen($smtpServerAddress, 110, $err_no, $err_str);
         if (!$stream) {
-            do_err("Error connecting to POP Server ($smtpServerAddress:110)"
-                  . " $err_no : $err_str");
+            do_err("Error connecting to POP Server ($smtpServerAddress:110) "
+                  . $err_no . ' : ' . htmlspecialchars($err_str));
         }
 
         $tmp = fgets($stream, 1024);
         if (substr($tmp, 0, 3) != '+OK') {
             do_err("Error connecting to POP Server ($smtpServerAddress:110)"
-                  . ' '.$tmp);
+                  . ' '.htmlspecialchars($tmp));
         }
         fputs($stream, 'QUIT');
         fclose($stream);
@@ -215,18 +220,21 @@ $stream = fsockopen( ($use_imap_tls?'tls://':'').$imapServerAddress, $imapPort,
                        $errorNumber, $errorString);
 if(!$stream) {
     do_err("Error connecting to IMAP server \"$imapServerAddress:$imapPort\".".
-        "Server error: ($errorNumber) $errorString");
+        "Server error: ($errorNumber) ".
+       htmlspecialchars($errorString));
 }
 
 $imapline = fgets($stream, 1024);
 if(substr($imapline, 0,4) != '* OK') {
-   do_err('Error connecting to IMAP server. Server error: '.$imapline);
+   do_err('Error connecting to IMAP server. Server error: '.
+       htmlspecialchars($imapline));
 }
 
 fputs($stream, '001 LOGOUT');
 fclose($stream);
 
-echo $IND . 'IMAP server OK (<tt><small>'.trim($imapline)."</small></tt>)<br />\n";
+echo $IND . 'IMAP server OK (<tt><small>'.
+    htmlspecialchars(trim($imapline))."</small></tt>)<br />\n";
 
 echo "Checking internationalization (i18n) settings:<br />\n";
 echo "$IND gettext - ";
@@ -306,7 +314,8 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) {
 
                    $dbh = DB::connect($dsn, true);
                     if (DB::isError($dbh)) {
-                        do_err('Database error: '. DB::errorMessage($dbh) . ' in ' .$type .' DSN.');
+                        do_err('Database error: '. htmlspecialchars(DB::errorMessage($dbh)) .
+                           ' in ' .$type .' DSN.');
                     }
                    $dbh->disconnect();
                    echo "$IND$type database connect successful.<br />\n";