<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[17677] trunk/wp-includes/class-pop3.php: Update pop3 class.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/17677">17677</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2011-04-21 20:40:32 +0000 (Thu, 21 Apr 2011)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update pop3 class. Props aaroncampbell. fixes <a href="http://trac.wordpress.org/ticket/17064">#17064</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasspop3php">trunk/wp-includes/class-pop3.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclasspop3php"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-pop3.php (17676 => 17677)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-pop3.php        2011-04-21 20:29:30 UTC (rev 17676)
+++ trunk/wp-includes/class-pop3.php        2011-04-21 20:40:32 UTC (rev 17677)
</span><span class="lines">@@ -2,20 +2,18 @@
</span><span class="cx"> /**
</span><span class="cx"> * mail_fetch/setup.php
</span><span class="cx"> *
</span><del>- * @package SquirrelMail
- *
- * @copyright (c) 1999-2006 The SquirrelMail Project Team
- *
- * @copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved
- * Modified by Philippe Mingo 2001 mingo@rotedic.com
</del><ins>+ * Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved
+ * Modified by Philippe Mingo 2001-2009 mingo@rotedic.com
</ins><span class="cx"> * An RFC 1939 compliant wrapper class for the POP3 protocol.
</span><span class="cx"> *
</span><span class="cx"> * Licensed under the GNU GPL. For full terms see the file COPYING.
</span><del>- * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
</del><span class="cx"> *
</span><del>- * pop3 class
</del><ins>+ * POP3 class
</ins><span class="cx"> *
</span><del>- * $Id$
</del><ins>+ * @copyright 1999-2011 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @package plugins
+ * @subpackage mail_fetch
</ins><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> class POP3 {
</span><span class="lines">@@ -76,7 +74,7 @@
</span><span class="cx">
</span><span class="cx"> // If MAILSERVER is set, override $server with it's value
</span><span class="cx">
</span><del>-        if (!isset($port) || !$port) {$port = 110;}
</del><ins>+ if (!isset($port) || !$port) {$port = 110;}
</ins><span class="cx"> if(!empty($this->MAILSERVER))
</span><span class="cx"> $server = $this->MAILSERVER;
</span><span class="cx">
</span><span class="lines">@@ -253,7 +251,7 @@
</span><span class="cx"> $MsgArray = array();
</span><span class="cx">
</span><span class="cx"> $line = fgets($fp,$buffer);
</span><del>- while ( !ereg("^\.\r\n",$line))
</del><ins>+ while ( !preg_match('/^\.\r\n/',$line))
</ins><span class="cx"> {
</span><span class="cx"> $MsgArray[$count] = $line;
</span><span class="cx"> $count++;
</span><span class="lines">@@ -320,7 +318,7 @@
</span><span class="cx"> if($msgC > $Total) { break; }
</span><span class="cx"> $line = fgets($fp,$this->BUFFER);
</span><span class="cx"> $line = $this->strip_clf($line);
</span><del>- if(ereg("^\.",$line))
</del><ins>+ if(strpos($line, '.') === 0)
</ins><span class="cx"> {
</span><span class="cx"> $this->ERROR = "POP3 pop_list: " . _("Premature end of list");
</span><span class="cx"> return false;
</span><span class="lines">@@ -366,9 +364,9 @@
</span><span class="cx"> $MsgArray = array();
</span><span class="cx">
</span><span class="cx"> $line = fgets($fp,$buffer);
</span><del>- while ( !ereg("^\.\r\n",$line))
</del><ins>+ while ( !preg_match('/^\.\r\n/',$line))
</ins><span class="cx"> {
</span><del>- if ( $line[0] == '.' ) { $line = substr($line,1); }
</del><ins>+ if ( $line{0} == '.' ) { $line = substr($line,1); }
</ins><span class="cx"> $MsgArray[$count] = $line;
</span><span class="cx"> $count++;
</span><span class="cx"> $line = fgets($fp,$buffer);
</span><span class="lines">@@ -554,10 +552,7 @@
</span><span class="cx"> $line = "";
</span><span class="cx"> $count = 1;
</span><span class="cx"> $line = fgets($fp,$buffer);
</span><del>- while ( !ereg("^\.\r\n",$line)) {
- if(ereg("^\.\r\n",$line)) {
- break;
- }
</del><ins>+ while ( !preg_match('/^\.\r\n/',$line)) {
</ins><span class="cx"> list ($msg,$msgUidl) = preg_split('/\s+/',$line);
</span><span class="cx"> $msgUidl = $this->strip_clf($msgUidl);
</span><span class="cx"> if($count == $msg) {
</span><span class="lines">@@ -607,7 +602,7 @@
</span><span class="cx"> if( empty($cmd) )
</span><span class="cx"> return false;
</span><span class="cx"> else
</span><del>- return( ereg ("^\+OK", $cmd ) );
</del><ins>+ return( stripos($cmd, '+OK') !== false );
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function strip_clf ($text = "") {
</span><span class="lines">@@ -616,8 +611,7 @@
</span><span class="cx"> if(empty($text))
</span><span class="cx"> return $text;
</span><span class="cx"> else {
</span><del>- $stripped = str_replace("\r",'',$text);
- $stripped = str_replace("\n",'',$stripped);
</del><ins>+ $stripped = str_replace(array("\r","\n"),'',$text);
</ins><span class="cx"> return $stripped;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -649,4 +643,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // End class
</span><del>-?>
</del><ins>+
+// For php4 compatibility
+if (!function_exists("stripos")) {
+ function stripos($haystack, $needle){
+ return strpos($haystack, stristr( $haystack, $needle ));
+ }
+}
</ins></span></pre>
</div>
</div>
</body>
</html>