phpDoc fixes
[squirrelmail.git] / plugins / mail_fetch / class.POP3.php
index e4b78946b9a22e6b9f3aa285c804820ab56a2c48..81ba34d8c496f636679a355acbbefbf0c143094d 100644 (file)
@@ -1,21 +1,27 @@
-<?php 
-
-   /**
-    * mail_fetch/setup.php
-    *
-    * Copyright (c) 1999-2002 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$
-    */
-
+<?php
+
+/**
+ * mail_fetch/class.POP3.php
+ *
+ * Copyright (c) 1999-2005 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
+ *
+ * @version $Id$
+ * @package plugins
+ * @subpackage mail_fetch
+ */
+
+/**
+ * This is the POP3 class - DOCUMENT ME
+ * @package squirrelmail
+ */
 class POP3 {
     var $ERROR      = '';       //  Error string.
 
@@ -56,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;
     }
 
@@ -72,6 +80,7 @@ class POP3 {
 
         // If MAILSERVER is set, override $server with it's value
 
+        if (!isset($port) || !$port) {$port = 110;}
         if(!empty($this->MAILSERVER))
             $server = $this->MAILSERVER;
 
@@ -81,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]";
@@ -105,18 +114,6 @@ class POP3 {
         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 ) );
-        }
-    }
-
     function user ($user = "") {
         // Sends the USER command, returns true or false
 
@@ -309,7 +306,7 @@ class POP3 {
                 $this->ERROR = _("POP3 pop_list:") . ' ' . _("Error ") . "[$reply]";
                 return false;
             }
-            list($junk,$num,$size) = explode(" ",$reply);
+            list($junk,$num,$size) = preg_split('/\s+/',$reply);
             return $size;
         }
         $cmd = "LIST";
@@ -332,7 +329,7 @@ class POP3 {
                 $this->ERROR = _("POP3 pop_list:") . ' ' . _("Premature end of list");
                 return false;
             }
-            list($thisMsg,$msgSize) = explode(" ",$line);
+            list($thisMsg,$msgSize) = preg_split('/\s+/',$line);
             settype($thisMsg,"integer");
             if($thisMsg != $msgC)
             {
@@ -402,7 +399,7 @@ class POP3 {
             return $last;
         }
 
-        $Vars = explode(" ",$reply);
+        $Vars = preg_split('/\s+/',$reply);
         $count = $Vars[1];
         $size = $Vars[2];
         settype($count,"integer");
@@ -533,7 +530,7 @@ class POP3 {
                 $this->ERROR = _("POP3 uidl:") . ' ' . _("Error ") . "[$reply]";
                 return false;
             }
-            list ($ok,$num,$myUidl) = explode(" ",$reply);
+            list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply);
             return $myUidl;
         } else {
             $this->update_timer();
@@ -564,7 +561,7 @@ class POP3 {
                 if(ereg("^\.\r\n",$line)) {
                     break;
                 }
-                list ($msg,$msgUidl) = explode(" ",$line);
+                list ($msg,$msgUidl) = preg_split('/\s+/',$line);
                 $msgUidl = $this->strip_clf($msgUidl);
                 if($count == $msg) {
                     $UIDLArray[$msg] = $msgUidl;
@@ -656,4 +653,4 @@ class POP3 {
 
 }   // End class
 
-?>
+?>
\ No newline at end of file