Edit File by line
/home/barbar84/www/wp-inclu...
File: class-pop3.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* mail_fetch/setup.php
[2] Fix | Delete
*
[3] Fix | Delete
* Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved
[4] Fix | Delete
* Modified by Philippe Mingo 2001-2009 mingo@rotedic.com
[5] Fix | Delete
* An RFC 1939 compliant wrapper class for the POP3 protocol.
[6] Fix | Delete
*
[7] Fix | Delete
* Licensed under the GNU GPL. For full terms see the file COPYING.
[8] Fix | Delete
*
[9] Fix | Delete
* POP3 class
[10] Fix | Delete
*
[11] Fix | Delete
* @copyright 1999-2011 The SquirrelMail Project Team
[12] Fix | Delete
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
[13] Fix | Delete
* @package plugins
[14] Fix | Delete
* @subpackage mail_fetch
[15] Fix | Delete
*/
[16] Fix | Delete
[17] Fix | Delete
class POP3 {
[18] Fix | Delete
var $ERROR = ''; // Error string.
[19] Fix | Delete
[20] Fix | Delete
var $TIMEOUT = 60; // Default timeout before giving up on a
[21] Fix | Delete
// network operation.
[22] Fix | Delete
[23] Fix | Delete
var $COUNT = -1; // Mailbox msg count
[24] Fix | Delete
[25] Fix | Delete
var $BUFFER = 512; // Socket buffer for socket fgets() calls.
[26] Fix | Delete
// Per RFC 1939 the returned line a POP3
[27] Fix | Delete
// server can send is 512 bytes.
[28] Fix | Delete
[29] Fix | Delete
var $FP = ''; // The connection to the server's
[30] Fix | Delete
// file descriptor
[31] Fix | Delete
[32] Fix | Delete
var $MAILSERVER = ''; // Set this to hard code the server name
[33] Fix | Delete
[34] Fix | Delete
var $DEBUG = FALSE; // set to true to echo pop3
[35] Fix | Delete
// commands and responses to error_log
[36] Fix | Delete
// this WILL log passwords!
[37] Fix | Delete
[38] Fix | Delete
var $BANNER = ''; // Holds the banner returned by the
[39] Fix | Delete
// pop server - used for apop()
[40] Fix | Delete
[41] Fix | Delete
var $ALLOWAPOP = FALSE; // Allow or disallow apop()
[42] Fix | Delete
// This must be set to true
[43] Fix | Delete
// manually
[44] Fix | Delete
[45] Fix | Delete
/**
[46] Fix | Delete
* PHP5 constructor.
[47] Fix | Delete
*/
[48] Fix | Delete
function __construct ( $server = '', $timeout = '' ) {
[49] Fix | Delete
settype($this->BUFFER,"integer");
[50] Fix | Delete
if( !empty($server) ) {
[51] Fix | Delete
// Do not allow programs to alter MAILSERVER
[52] Fix | Delete
// if it is already specified. They can get around
[53] Fix | Delete
// this if they -really- want to, so don't count on it.
[54] Fix | Delete
if(empty($this->MAILSERVER))
[55] Fix | Delete
$this->MAILSERVER = $server;
[56] Fix | Delete
}
[57] Fix | Delete
if(!empty($timeout)) {
[58] Fix | Delete
settype($timeout,"integer");
[59] Fix | Delete
$this->TIMEOUT = $timeout;
[60] Fix | Delete
set_time_limit($timeout);
[61] Fix | Delete
}
[62] Fix | Delete
return true;
[63] Fix | Delete
}
[64] Fix | Delete
[65] Fix | Delete
/**
[66] Fix | Delete
* PHP4 constructor.
[67] Fix | Delete
*/
[68] Fix | Delete
public function POP3( $server = '', $timeout = '' ) {
[69] Fix | Delete
self::__construct( $server, $timeout );
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
function update_timer () {
[73] Fix | Delete
set_time_limit($this->TIMEOUT);
[74] Fix | Delete
return true;
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
function connect ($server, $port = 110) {
[78] Fix | Delete
// Opens a socket to the specified server. Unless overridden,
[79] Fix | Delete
// port defaults to 110. Returns true on success, false on fail
[80] Fix | Delete
[81] Fix | Delete
// If MAILSERVER is set, override $server with its value.
[82] Fix | Delete
[83] Fix | Delete
if (!isset($port) || !$port) {$port = 110;}
[84] Fix | Delete
if(!empty($this->MAILSERVER))
[85] Fix | Delete
$server = $this->MAILSERVER;
[86] Fix | Delete
[87] Fix | Delete
if(empty($server)){
[88] Fix | Delete
$this->ERROR = "POP3 connect: " . _("No server specified");
[89] Fix | Delete
unset($this->FP);
[90] Fix | Delete
return false;
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
$fp = @fsockopen("$server", $port, $errno, $errstr);
[94] Fix | Delete
[95] Fix | Delete
if(!$fp) {
[96] Fix | Delete
$this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]";
[97] Fix | Delete
unset($this->FP);
[98] Fix | Delete
return false;
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
socket_set_blocking($fp,-1);
[102] Fix | Delete
$this->update_timer();
[103] Fix | Delete
$reply = fgets($fp,$this->BUFFER);
[104] Fix | Delete
$reply = $this->strip_clf($reply);
[105] Fix | Delete
if($this->DEBUG)
[106] Fix | Delete
error_log("POP3 SEND [connect: $server] GOT [$reply]",0);
[107] Fix | Delete
if(!$this->is_ok($reply)) {
[108] Fix | Delete
$this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]";
[109] Fix | Delete
unset($this->FP);
[110] Fix | Delete
return false;
[111] Fix | Delete
}
[112] Fix | Delete
$this->FP = $fp;
[113] Fix | Delete
$this->BANNER = $this->parse_banner($reply);
[114] Fix | Delete
return true;
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
function user ($user = "") {
[118] Fix | Delete
// Sends the USER command, returns true or false
[119] Fix | Delete
[120] Fix | Delete
if( empty($user) ) {
[121] Fix | Delete
$this->ERROR = "POP3 user: " . _("no login ID submitted");
[122] Fix | Delete
return false;
[123] Fix | Delete
} elseif(!isset($this->FP)) {
[124] Fix | Delete
$this->ERROR = "POP3 user: " . _("connection not established");
[125] Fix | Delete
return false;
[126] Fix | Delete
} else {
[127] Fix | Delete
$reply = $this->send_cmd("USER $user");
[128] Fix | Delete
if(!$this->is_ok($reply)) {
[129] Fix | Delete
$this->ERROR = "POP3 user: " . _("Error ") . "[$reply]";
[130] Fix | Delete
return false;
[131] Fix | Delete
} else
[132] Fix | Delete
return true;
[133] Fix | Delete
}
[134] Fix | Delete
}
[135] Fix | Delete
[136] Fix | Delete
function pass ($pass = "") {
[137] Fix | Delete
// Sends the PASS command, returns # of msgs in mailbox,
[138] Fix | Delete
// returns false (undef) on Auth failure
[139] Fix | Delete
[140] Fix | Delete
if(empty($pass)) {
[141] Fix | Delete
$this->ERROR = "POP3 pass: " . _("No password submitted");
[142] Fix | Delete
return false;
[143] Fix | Delete
} elseif(!isset($this->FP)) {
[144] Fix | Delete
$this->ERROR = "POP3 pass: " . _("connection not established");
[145] Fix | Delete
return false;
[146] Fix | Delete
} else {
[147] Fix | Delete
$reply = $this->send_cmd("PASS $pass");
[148] Fix | Delete
if(!$this->is_ok($reply)) {
[149] Fix | Delete
$this->ERROR = "POP3 pass: " . _("Authentication failed") . " [$reply]";
[150] Fix | Delete
$this->quit();
[151] Fix | Delete
return false;
[152] Fix | Delete
} else {
[153] Fix | Delete
// Auth successful.
[154] Fix | Delete
$count = $this->last("count");
[155] Fix | Delete
$this->COUNT = $count;
[156] Fix | Delete
return $count;
[157] Fix | Delete
}
[158] Fix | Delete
}
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
function apop ($login,$pass) {
[162] Fix | Delete
// Attempts an APOP login. If this fails, it'll
[163] Fix | Delete
// try a standard login. YOUR SERVER MUST SUPPORT
[164] Fix | Delete
// THE USE OF THE APOP COMMAND!
[165] Fix | Delete
// (apop is optional per rfc1939)
[166] Fix | Delete
[167] Fix | Delete
if(!isset($this->FP)) {
[168] Fix | Delete
$this->ERROR = "POP3 apop: " . _("No connection to server");
[169] Fix | Delete
return false;
[170] Fix | Delete
} elseif(!$this->ALLOWAPOP) {
[171] Fix | Delete
$retVal = $this->login($login,$pass);
[172] Fix | Delete
return $retVal;
[173] Fix | Delete
} elseif(empty($login)) {
[174] Fix | Delete
$this->ERROR = "POP3 apop: " . _("No login ID submitted");
[175] Fix | Delete
return false;
[176] Fix | Delete
} elseif(empty($pass)) {
[177] Fix | Delete
$this->ERROR = "POP3 apop: " . _("No password submitted");
[178] Fix | Delete
return false;
[179] Fix | Delete
} else {
[180] Fix | Delete
$banner = $this->BANNER;
[181] Fix | Delete
if( (!$banner) or (empty($banner)) ) {
[182] Fix | Delete
$this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort");
[183] Fix | Delete
$retVal = $this->login($login,$pass);
[184] Fix | Delete
return $retVal;
[185] Fix | Delete
} else {
[186] Fix | Delete
$AuthString = $banner;
[187] Fix | Delete
$AuthString .= $pass;
[188] Fix | Delete
$APOPString = md5($AuthString);
[189] Fix | Delete
$cmd = "APOP $login $APOPString";
[190] Fix | Delete
$reply = $this->send_cmd($cmd);
[191] Fix | Delete
if(!$this->is_ok($reply)) {
[192] Fix | Delete
$this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort");
[193] Fix | Delete
$retVal = $this->login($login,$pass);
[194] Fix | Delete
return $retVal;
[195] Fix | Delete
} else {
[196] Fix | Delete
// Auth successful.
[197] Fix | Delete
$count = $this->last("count");
[198] Fix | Delete
$this->COUNT = $count;
[199] Fix | Delete
return $count;
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
}
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
function login ($login = "", $pass = "") {
[206] Fix | Delete
// Sends both user and pass. Returns # of msgs in mailbox or
[207] Fix | Delete
// false on failure (or -1, if the error occurs while getting
[208] Fix | Delete
// the number of messages.)
[209] Fix | Delete
[210] Fix | Delete
if( !isset($this->FP) ) {
[211] Fix | Delete
$this->ERROR = "POP3 login: " . _("No connection to server");
[212] Fix | Delete
return false;
[213] Fix | Delete
} else {
[214] Fix | Delete
$fp = $this->FP;
[215] Fix | Delete
if( !$this->user( $login ) ) {
[216] Fix | Delete
// Preserve the error generated by user()
[217] Fix | Delete
return false;
[218] Fix | Delete
} else {
[219] Fix | Delete
$count = $this->pass($pass);
[220] Fix | Delete
if( (!$count) || ($count == -1) ) {
[221] Fix | Delete
// Preserve the error generated by last() and pass()
[222] Fix | Delete
return false;
[223] Fix | Delete
} else
[224] Fix | Delete
return $count;
[225] Fix | Delete
}
[226] Fix | Delete
}
[227] Fix | Delete
}
[228] Fix | Delete
[229] Fix | Delete
function top ($msgNum, $numLines = "0") {
[230] Fix | Delete
// Gets the header and first $numLines of the msg body
[231] Fix | Delete
// returns data in an array with each returned line being
[232] Fix | Delete
// an array element. If $numLines is empty, returns
[233] Fix | Delete
// only the header information, and none of the body.
[234] Fix | Delete
[235] Fix | Delete
if(!isset($this->FP)) {
[236] Fix | Delete
$this->ERROR = "POP3 top: " . _("No connection to server");
[237] Fix | Delete
return false;
[238] Fix | Delete
}
[239] Fix | Delete
$this->update_timer();
[240] Fix | Delete
[241] Fix | Delete
$fp = $this->FP;
[242] Fix | Delete
$buffer = $this->BUFFER;
[243] Fix | Delete
$cmd = "TOP $msgNum $numLines";
[244] Fix | Delete
fwrite($fp, "TOP $msgNum $numLines\r\n");
[245] Fix | Delete
$reply = fgets($fp, $buffer);
[246] Fix | Delete
$reply = $this->strip_clf($reply);
[247] Fix | Delete
if($this->DEBUG) {
[248] Fix | Delete
@error_log("POP3 SEND [$cmd] GOT [$reply]",0);
[249] Fix | Delete
}
[250] Fix | Delete
if(!$this->is_ok($reply))
[251] Fix | Delete
{
[252] Fix | Delete
$this->ERROR = "POP3 top: " . _("Error ") . "[$reply]";
[253] Fix | Delete
return false;
[254] Fix | Delete
}
[255] Fix | Delete
[256] Fix | Delete
$count = 0;
[257] Fix | Delete
$MsgArray = array();
[258] Fix | Delete
[259] Fix | Delete
$line = fgets($fp,$buffer);
[260] Fix | Delete
while ( !preg_match('/^\.\r\n/',$line))
[261] Fix | Delete
{
[262] Fix | Delete
$MsgArray[$count] = $line;
[263] Fix | Delete
$count++;
[264] Fix | Delete
$line = fgets($fp,$buffer);
[265] Fix | Delete
if(empty($line)) { break; }
[266] Fix | Delete
}
[267] Fix | Delete
[268] Fix | Delete
return $MsgArray;
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
function pop_list ($msgNum = "") {
[272] Fix | Delete
// If called with an argument, returns that msgs' size in octets
[273] Fix | Delete
// No argument returns an associative array of undeleted
[274] Fix | Delete
// msg numbers and their sizes in octets
[275] Fix | Delete
[276] Fix | Delete
if(!isset($this->FP))
[277] Fix | Delete
{
[278] Fix | Delete
$this->ERROR = "POP3 pop_list: " . _("No connection to server");
[279] Fix | Delete
return false;
[280] Fix | Delete
}
[281] Fix | Delete
$fp = $this->FP;
[282] Fix | Delete
$Total = $this->COUNT;
[283] Fix | Delete
if( (!$Total) or ($Total == -1) )
[284] Fix | Delete
{
[285] Fix | Delete
return false;
[286] Fix | Delete
}
[287] Fix | Delete
if($Total == 0)
[288] Fix | Delete
{
[289] Fix | Delete
return array("0","0");
[290] Fix | Delete
// return -1; // mailbox empty
[291] Fix | Delete
}
[292] Fix | Delete
[293] Fix | Delete
$this->update_timer();
[294] Fix | Delete
[295] Fix | Delete
if(!empty($msgNum))
[296] Fix | Delete
{
[297] Fix | Delete
$cmd = "LIST $msgNum";
[298] Fix | Delete
fwrite($fp,"$cmd\r\n");
[299] Fix | Delete
$reply = fgets($fp,$this->BUFFER);
[300] Fix | Delete
$reply = $this->strip_clf($reply);
[301] Fix | Delete
if($this->DEBUG) {
[302] Fix | Delete
@error_log("POP3 SEND [$cmd] GOT [$reply]",0);
[303] Fix | Delete
}
[304] Fix | Delete
if(!$this->is_ok($reply))
[305] Fix | Delete
{
[306] Fix | Delete
$this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]";
[307] Fix | Delete
return false;
[308] Fix | Delete
}
[309] Fix | Delete
list($junk,$num,$size) = preg_split('/\s+/',$reply);
[310] Fix | Delete
return $size;
[311] Fix | Delete
}
[312] Fix | Delete
$cmd = "LIST";
[313] Fix | Delete
$reply = $this->send_cmd($cmd);
[314] Fix | Delete
if(!$this->is_ok($reply))
[315] Fix | Delete
{
[316] Fix | Delete
$reply = $this->strip_clf($reply);
[317] Fix | Delete
$this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]";
[318] Fix | Delete
return false;
[319] Fix | Delete
}
[320] Fix | Delete
$MsgArray = array();
[321] Fix | Delete
$MsgArray[0] = $Total;
[322] Fix | Delete
for($msgC=1;$msgC <= $Total; $msgC++)
[323] Fix | Delete
{
[324] Fix | Delete
if($msgC > $Total) { break; }
[325] Fix | Delete
$line = fgets($fp,$this->BUFFER);
[326] Fix | Delete
$line = $this->strip_clf($line);
[327] Fix | Delete
if(strpos($line, '.') === 0)
[328] Fix | Delete
{
[329] Fix | Delete
$this->ERROR = "POP3 pop_list: " . _("Premature end of list");
[330] Fix | Delete
return false;
[331] Fix | Delete
}
[332] Fix | Delete
list($thisMsg,$msgSize) = preg_split('/\s+/',$line);
[333] Fix | Delete
settype($thisMsg,"integer");
[334] Fix | Delete
if($thisMsg != $msgC)
[335] Fix | Delete
{
[336] Fix | Delete
$MsgArray[$msgC] = "deleted";
[337] Fix | Delete
}
[338] Fix | Delete
else
[339] Fix | Delete
{
[340] Fix | Delete
$MsgArray[$msgC] = $msgSize;
[341] Fix | Delete
}
[342] Fix | Delete
}
[343] Fix | Delete
return $MsgArray;
[344] Fix | Delete
}
[345] Fix | Delete
[346] Fix | Delete
function get ($msgNum) {
[347] Fix | Delete
// Retrieve the specified msg number. Returns an array
[348] Fix | Delete
// where each line of the msg is an array element.
[349] Fix | Delete
[350] Fix | Delete
if(!isset($this->FP))
[351] Fix | Delete
{
[352] Fix | Delete
$this->ERROR = "POP3 get: " . _("No connection to server");
[353] Fix | Delete
return false;
[354] Fix | Delete
}
[355] Fix | Delete
[356] Fix | Delete
$this->update_timer();
[357] Fix | Delete
[358] Fix | Delete
$fp = $this->FP;
[359] Fix | Delete
$buffer = $this->BUFFER;
[360] Fix | Delete
$cmd = "RETR $msgNum";
[361] Fix | Delete
$reply = $this->send_cmd($cmd);
[362] Fix | Delete
[363] Fix | Delete
if(!$this->is_ok($reply))
[364] Fix | Delete
{
[365] Fix | Delete
$this->ERROR = "POP3 get: " . _("Error ") . "[$reply]";
[366] Fix | Delete
return false;
[367] Fix | Delete
}
[368] Fix | Delete
[369] Fix | Delete
$count = 0;
[370] Fix | Delete
$MsgArray = array();
[371] Fix | Delete
[372] Fix | Delete
$line = fgets($fp,$buffer);
[373] Fix | Delete
while ( !preg_match('/^\.\r\n/',$line))
[374] Fix | Delete
{
[375] Fix | Delete
if ( $line[0] == '.' ) { $line = substr($line,1); }
[376] Fix | Delete
$MsgArray[$count] = $line;
[377] Fix | Delete
$count++;
[378] Fix | Delete
$line = fgets($fp,$buffer);
[379] Fix | Delete
if(empty($line)) { break; }
[380] Fix | Delete
}
[381] Fix | Delete
return $MsgArray;
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
function last ( $type = "count" ) {
[385] Fix | Delete
// Returns the highest msg number in the mailbox.
[386] Fix | Delete
// returns -1 on error, 0+ on success, if type != count
[387] Fix | Delete
// results in a popstat() call (2 element array returned)
[388] Fix | Delete
[389] Fix | Delete
$last = -1;
[390] Fix | Delete
if(!isset($this->FP))
[391] Fix | Delete
{
[392] Fix | Delete
$this->ERROR = "POP3 last: " . _("No connection to server");
[393] Fix | Delete
return $last;
[394] Fix | Delete
}
[395] Fix | Delete
[396] Fix | Delete
$reply = $this->send_cmd("STAT");
[397] Fix | Delete
if(!$this->is_ok($reply))
[398] Fix | Delete
{
[399] Fix | Delete
$this->ERROR = "POP3 last: " . _("Error ") . "[$reply]";
[400] Fix | Delete
return $last;
[401] Fix | Delete
}
[402] Fix | Delete
[403] Fix | Delete
$Vars = preg_split('/\s+/',$reply);
[404] Fix | Delete
$count = $Vars[1];
[405] Fix | Delete
$size = $Vars[2];
[406] Fix | Delete
settype($count,"integer");
[407] Fix | Delete
settype($size,"integer");
[408] Fix | Delete
if($type != "count")
[409] Fix | Delete
{
[410] Fix | Delete
return array($count,$size);
[411] Fix | Delete
}
[412] Fix | Delete
return $count;
[413] Fix | Delete
}
[414] Fix | Delete
[415] Fix | Delete
function reset () {
[416] Fix | Delete
// Resets the status of the remote server. This includes
[417] Fix | Delete
// resetting the status of ALL msgs to not be deleted.
[418] Fix | Delete
// This method automatically closes the connection to the server.
[419] Fix | Delete
[420] Fix | Delete
if(!isset($this->FP))
[421] Fix | Delete
{
[422] Fix | Delete
$this->ERROR = "POP3 reset: " . _("No connection to server");
[423] Fix | Delete
return false;
[424] Fix | Delete
}
[425] Fix | Delete
$reply = $this->send_cmd("RSET");
[426] Fix | Delete
if(!$this->is_ok($reply))
[427] Fix | Delete
{
[428] Fix | Delete
// The POP3 RSET command -never- gives a -ERR
[429] Fix | Delete
// response - if it ever does, something truly
[430] Fix | Delete
// wild is going on.
[431] Fix | Delete
[432] Fix | Delete
$this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]";
[433] Fix | Delete
@error_log("POP3 reset: ERROR [$reply]",0);
[434] Fix | Delete
}
[435] Fix | Delete
$this->quit();
[436] Fix | Delete
return true;
[437] Fix | Delete
}
[438] Fix | Delete
[439] Fix | Delete
function send_cmd ( $cmd = "" )
[440] Fix | Delete
{
[441] Fix | Delete
// Sends a user defined command string to the
[442] Fix | Delete
// POP server and returns the results. Useful for
[443] Fix | Delete
// non-compliant or custom POP servers.
[444] Fix | Delete
// Do NOT includ the \r\n as part of your command
[445] Fix | Delete
// string - it will be appended automatically.
[446] Fix | Delete
[447] Fix | Delete
// The return value is a standard fgets() call, which
[448] Fix | Delete
// will read up to $this->BUFFER bytes of data, until it
[449] Fix | Delete
// encounters a new line, or EOF, whichever happens first.
[450] Fix | Delete
[451] Fix | Delete
// This method works best if $cmd responds with only
[452] Fix | Delete
// one line of data.
[453] Fix | Delete
[454] Fix | Delete
if(!isset($this->FP))
[455] Fix | Delete
{
[456] Fix | Delete
$this->ERROR = "POP3 send_cmd: " . _("No connection to server");
[457] Fix | Delete
return false;
[458] Fix | Delete
}
[459] Fix | Delete
[460] Fix | Delete
if(empty($cmd))
[461] Fix | Delete
{
[462] Fix | Delete
$this->ERROR = "POP3 send_cmd: " . _("Empty command string");
[463] Fix | Delete
return "";
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
$fp = $this->FP;
[467] Fix | Delete
$buffer = $this->BUFFER;
[468] Fix | Delete
$this->update_timer();
[469] Fix | Delete
fwrite($fp,"$cmd\r\n");
[470] Fix | Delete
$reply = fgets($fp,$buffer);
[471] Fix | Delete
$reply = $this->strip_clf($reply);
[472] Fix | Delete
if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); }
[473] Fix | Delete
return $reply;
[474] Fix | Delete
}
[475] Fix | Delete
[476] Fix | Delete
function quit() {
[477] Fix | Delete
// Closes the connection to the POP3 server, deleting
[478] Fix | Delete
// any msgs marked as deleted.
[479] Fix | Delete
[480] Fix | Delete
if(!isset($this->FP))
[481] Fix | Delete
{
[482] Fix | Delete
$this->ERROR = "POP3 quit: " . _("connection does not exist");
[483] Fix | Delete
return false;
[484] Fix | Delete
}
[485] Fix | Delete
$fp = $this->FP;
[486] Fix | Delete
$cmd = "QUIT";
[487] Fix | Delete
fwrite($fp,"$cmd\r\n");
[488] Fix | Delete
$reply = fgets($fp,$this->BUFFER);
[489] Fix | Delete
$reply = $this->strip_clf($reply);
[490] Fix | Delete
if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); }
[491] Fix | Delete
fclose($fp);
[492] Fix | Delete
unset($this->FP);
[493] Fix | Delete
return true;
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
function popstat () {
[497] Fix | Delete
// Returns an array of 2 elements. The number of undeleted
[498] Fix | Delete
// msgs in the mailbox, and the size of the mbox in octets.
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function