Improve HTML escaping
[squirrelmail.git] / plugins / mail_fetch / class.POP3.php
index dec5a0bfc79cf02b25588cfd15d2be073cfce9a6..8b68493914cfa512f035e1a8cc0e694689670e1b 100644 (file)
@@ -1,20 +1,27 @@
-<?
+<?php 
 
    /**
-    **  mail_fetch/setup.php
-    **
-    **  Copyright (c) 1999-2001 The Squirrelmail Development Team
-    **  Licensed under the GNU GPL. For full terms see the file COPYING.
-    **
-    **  Copyright (c) 1999 - CDI (cdi@thewebmasters.net) All Rights Reserved
-    **  Modified by Philippe Mingo 2001 mingo@rotedic.com
-    **  An RFC 1939 compliant wrapper class for the POP3 protocol.
-    **
-    **  pop3 class
-    **
-    **  $Id$
-    **/
-
+    * mail_fetch/setup.php
+    *
+    * Copyright (c) 1999-2004 The SquirrelMail Project Team
+    *
+    * Copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved
+    * Modified by Philippe Mingo 2001 mingo@rotedic.com
+    * An RFC 1939 compliant wrapper class for the POP3 protocol.
+    *
+    * Licensed under the GNU GPL. For full terms see the file COPYING.
+    *
+    * pop3 class
+    *
+    * $Id$
+    * @package plugins
+    * @subpackage mail_fetch
+    */
+
+/**
+ * This is the pop3 class - DOCUMENT ME
+ * @package squirrelmail
+ */
 class POP3 {
     var $ERROR      = '';       //  Error string.
 
@@ -32,17 +39,14 @@ class POP3 {
 
     var $MAILSERVER = '';       // Set this to hard code the server name
 
-    var $DEBUG      = FASLE;    // set to true to echo pop3
+    var $DEBUG      = FALSE;    // set to true to echo pop3
                                 // commands and responses to error_log
                                 // this WILL log passwords!
 
     var $BANNER     = '';       //  Holds the banner returned by the
                                 //  pop server - used for apop()
 
-    var $RFC1939    = TRUE;     //  Set by noop(). See rfc1939.txt
-                                //
-
-    var $ALLOWAPOP  = FASLE;    //  Allow or disallow apop()
+    var $ALLOWAPOP  = FALSE;    //  Allow or disallow apop()
                                 //  This must be set to true
                                 //  manually
 
@@ -58,13 +62,15 @@ class POP3 {
         if(!empty($timeout)) {
             settype($timeout,"integer");
             $this->TIMEOUT = $timeout;
-            set_time_limit($timeout);
+            if (!ini_get('safe_mode'))
+                set_time_limit($timeout);
         }
         return true;
     }
 
     function update_timer () {
-        set_time_limit($this->TIMEOUT);
+        if (!ini_get('safe_mode'))
+            set_time_limit($this->TIMEOUT);
         return true;
     }
 
@@ -73,7 +79,8 @@ class POP3 {
         //  port defaults to 110. Returns true on success, false on fail
 
         // If MAILSERVER is set, override $server with it's value
-
+       
+       if (!isset($port) || !$port) {$port = 110;}
         if(!empty($this->MAILSERVER))
             $server = $this->MAILSERVER;
 
@@ -83,7 +90,7 @@ class POP3 {
             return false;
         }
 
-        $fp = fsockopen("$server", $port, $errno, $errstr);
+        $fp = @fsockopen("$server", $port, $errno, $errstr);
 
         if(!$fp) {
             $this->ERROR = _("POP3 connect:") . ' ' . _("Error ") . "[$errno] [$errstr]";
@@ -104,25 +111,7 @@ class POP3 {
         }
         $this->FP = $fp;
         $this->BANNER = $this->parse_banner($reply);
-        $this->RFC1939 = $this->noop();
-        if($this->RFC1939) {
-            $this->ERROR = _("POP3: premature NOOP OK, NOT an RFC 1939 Compliant server");
-            $this->quit();
-            return false;
-        } else
-            return true;
-    }
-
-    function noop () {
-    
-        if(!isset($this->FP)) {
-            $this->ERROR = _("POP3 noop:") . ' ' . _("No connection to server");
-            return false;
-        } else {
-            $cmd = "NOOP";
-            $reply = $this->send_cmd( $cmd );
-            return( $this->is_ok( $reply ) );
-        }
+        return true;
     }
 
     function user ($user = "") {
@@ -164,13 +153,7 @@ class POP3 {
                 //  Auth successful.
                 $count = $this->last("count");
                 $this->COUNT = $count;
-                $this->RFC1939 = $this->noop();
-                if(!$this->RFC1939) {
-                    $this->ERROR = _("POP3 pass:") . ' ' . _("NOOP failed. Server not RFC 1939 compliant");
-                    $this->quit();
-                    return false;
-                } else
-                    return $count;
+                return $count;
             }
         }
     }
@@ -213,13 +196,7 @@ class POP3 {
                     //  Auth successful.
                     $count = $this->last("count");
                     $this->COUNT = $count;
-                    $this->RFC1939 = $this->noop();
-                    if(!$this->RFC1939) {
-                        $this->ERROR = _("POP3 apop:") . ' ' . _("NOOP failed. Server not RFC 1939 compliant");
-                        $this->quit();
-                        return false;
-                    } else
-                        return $count;
+                    return $count;
                 }
             }
         }