/
var
/
www
/
vhosts
/
ihelp.ro
/
ajutam.ro
/
wp-includes
/
/var/www/vhosts/ihelp.ro/ajutam.ro/wp-includes
mkdir
upload
Name
Size
Mode
Actions
abilities-api/
-
0755
rm
assets/
-
0755
rm
block-bindings/
-
0755
rm
block-patterns/
-
0755
rm
block-supports/
-
0755
rm
blocks/
-
0755
rm
certificates/
-
0755
rm
css/
-
0755
rm
customize/
-
0755
rm
fonts/
-
0755
rm
html-api/
-
0755
rm
ID3/
-
0755
rm
images/
-
0755
rm
interactivity-api/
-
0755
rm
IXR/
-
0755
rm
js/
-
0755
rm
l10n/
-
0755
rm
php-compat/
-
0755
rm
PHPMailer/
-
0755
rm
pomo/
-
0755
rm
Requests/
-
0755
rm
rest-api/
-
0755
rm
SimplePie/
-
0755
rm
sitemaps/
-
0755
rm
sodium_compat/
-
0755
rm
style-engine/
-
0755
rm
Text/
-
0755
rm
theme-compat/
-
0755
rm
widgets/
-
0755
rm
abilities-api.php
24369
0644
edit
dl
rm
abilities.php
7983
0644
edit
dl
rm
admin-bar.php
36966
0644
edit
dl
rm
atomlib.php
12181
0644
edit
dl
rm
author-template.php
19391
0644
edit
dl
rm
block-bindings.php
7526
0644
edit
dl
rm
block-editor.php
29282
0644
edit
dl
rm
block-i18n.json
316
0644
edit
dl
rm
block-patterns.php
13213
0644
edit
dl
rm
block-template-utils.php
62484
0644
edit
dl
rm
block-template.php
15359
0644
edit
dl
rm
blocks.php
114739
0644
edit
dl
rm
bookmark-template.php
12768
0644
edit
dl
rm
bookmark.php
15427
0644
edit
dl
rm
cache-compat.php
10078
0644
edit
dl
rm
cache.php
13486
0644
edit
dl
rm
canonical.php
34628
0644
edit
dl
rm
capabilities.php
43652
0644
edit
dl
rm
category-template.php
57045
0644
edit
dl
rm
category.php
12829
0644
edit
dl
rm
class-avif-info.php
29615
0644
edit
dl
rm
class-feed.php
539
0644
edit
dl
rm
class-http.php
367
0644
edit
dl
rm
class-IXR.php
2616
0644
edit
dl
rm
class-json.php
43676
0644
edit
dl
rm
class-oembed.php
401
0644
edit
dl
rm
class-phpass.php
6771
0644
edit
dl
rm
class-phpmailer.php
664
0644
edit
dl
rm
class-pop3.php
21121
0644
edit
dl
rm
class-requests.php
2237
0644
edit
dl
rm
class-simplepie.php
453
0644
edit
dl
rm
class-smtp.php
457
0644
edit
dl
rm
class-snoopy.php
37715
0644
edit
dl
rm
class-walker-category-dropdown.php
2469
0644
edit
dl
rm
class-walker-category.php
8477
0644
edit
dl
rm
class-walker-comment.php
14221
0644
edit
dl
rm
class-walker-nav-menu.php
12044
0644
edit
dl
rm
class-walker-page-dropdown.php
2710
0644
edit
dl
rm
class-walker-page.php
7612
0644
edit
dl
rm
class-wp-admin-bar.php
17874
0644
edit
dl
rm
class-wp-ajax-response.php
5266
0644
edit
dl
rm
class-wp-application-passwords.php
17099
0644
edit
dl
rm
class-wp-block-bindings-registry.php
8482
0644
edit
dl
rm
class-wp-block-bindings-source.php
2992
0644
edit
dl
rm
class-wp-block-editor-context.php
1350
0644
edit
dl
rm
class-wp-block-list.php
4713
0644
edit
dl
rm
class-wp-block-metadata-registry.php
11895
0644
edit
dl
rm
class-wp-block-parser-block.php
2555
0644
edit
dl
rm
class-wp-block-parser-frame.php
2017
0644
edit
dl
rm
class-wp-block-parser.php
11516
0644
edit
dl
rm
class-wp-block-pattern-categories-registry.php
5450
0644
edit
dl
rm
class-wp-block-patterns-registry.php
11253
0644
edit
dl
rm
class-wp-block-processor.php
69959
0644
edit
dl
rm
class-wp-block-styles-registry.php
6497
0644
edit
dl
rm
class-wp-block-supports.php
5626
0644
edit
dl
rm
class-wp-block-template.php
2033
0644
edit
dl
rm
class-wp-block-templates-registry.php
7193
0644
edit
dl
rm
class-wp-block-type-registry.php
5030
0644
edit
dl
rm
class-wp-block-type.php
17265
0644
edit
dl
rm
class-wp-block.php
24812
0644
edit
dl
rm
class-wp-classic-to-block-menu-converter.php
4070
0644
edit
dl
rm
class-wp-comment-query.php
48804
0644
edit
dl
rm
class-wp-comment.php
9437
0644
edit
dl
rm
class-wp-customize-control.php
26119
0644
edit
dl
rm
class-wp-customize-manager.php
203139
0644
edit
dl
rm
class-wp-customize-nav-menus.php
58013
0644
edit
dl
rm
class-wp-customize-panel.php
10710
0644
edit
dl
rm
class-wp-customize-section.php
11209
0644
edit
dl
rm
class-wp-customize-setting.php
29962
0644
edit
dl
rm
class-wp-customize-widgets.php
72607
0644
edit
dl
rm
class-wp-date-query.php
36147
0644
edit
dl
rm
class-wp-dependencies.php
17004
0644
edit
dl
rm
class-wp-dependency.php
2633
0644
edit
dl
rm
class-wp-duotone.php
40783
0644
edit
dl
rm
class-wp-editor.php
72335
0644
edit
dl
rm
class-wp-embed.php
15931
0644
edit
dl
rm
class-wp-error.php
7502
0644
edit
dl
rm
class-wp-exception.php
253
0644
edit
dl
rm
class-wp-fatal-error-handler.php
8150
0644
edit
dl
rm
class-wp-feed-cache-transient.php
3304
0644
edit
dl
rm
class-wp-feed-cache.php
969
0644
edit
dl
rm
class-wp-hook.php
16674
0644
edit
dl
rm
class-wp-http-cookie.php
7389
0644
edit
dl
rm
class-wp-http-curl.php
13261
0644
edit
dl
rm
class-wp-http-encoding.php
6689
0644
edit
dl
rm
class-wp-http-ixr-client.php
3506
0644
edit
dl
rm
class-wp-http-proxy.php
5980
0644
edit
dl
rm
class-wp-http-requests-hooks.php
2022
0644
edit
dl
rm
class-wp-http-requests-response.php
4400
0644
edit
dl
rm
class-wp-http-response.php
2977
0644
edit
dl
rm
class-wp-http-streams.php
16859
0644
edit
dl
rm
class-wp-http.php
41570
0644
edit
dl
rm
class-wp-image-editor-gd.php
20705
0644
edit
dl
rm
class-wp-image-editor-imagick.php
43415
0644
edit
dl
rm
class-wp-image-editor.php
17415
0644
edit
dl
rm
class-wp-list-util.php
7443
0644
edit
dl
rm
class-wp-locale-switcher.php
6776
0644
edit
dl
rm
class-wp-locale.php
16883
0644
edit
dl
rm
class-wp-matchesmapregex.php
1828
0644
edit
dl
rm
class-wp-meta-query.php
30533
0644
edit
dl
rm
class-wp-metadata-lazyloader.php
6833
0644
edit
dl
rm
class-wp-navigation-fallback.php
9193
0644
edit
dl
rm
class-wp-network-query.php
19887
0644
edit
dl
rm
class-wp-network.php
12296
0644
edit
dl
rm
class-wp-object-cache.php
17524
0644
edit
dl
rm
class-wp-oembed-controller.php
6905
0644
edit
dl
rm
class-wp-oembed.php
31670
0644
edit
dl
rm
class-wp-paused-extensions-storage.php
5111
0644
edit
dl
rm
class-wp-phpmailer.php
4348
0644
edit
dl
rm
class-wp-plugin-dependencies.php
25315
0644
edit
dl
rm
class-wp-post-type.php
30680
0644
edit
dl
rm
class-wp-post.php
6491
0644
edit
dl
rm
class-wp-query.php
163975
0644
edit
dl
rm
class-wp-recovery-mode-cookie-service.php
6877
0644
edit
dl
rm
class-wp-recovery-mode-email-service.php
11183
0644
edit
dl
rm
class-wp-recovery-mode-key-service.php
4884
0644
edit
dl
rm
class-wp-recovery-mode-link-service.php
3463
0644
edit
dl
rm
class-wp-recovery-mode.php
11453
0644
edit
dl
rm
class-wp-rewrite.php
63687
0644
edit
dl
rm
class-wp-role.php
2523
0644
edit
dl
rm
class-wp-roles.php
9394
0644
edit
dl
rm
class-wp-script-modules.php
32951
0644
edit
dl
rm
class-wp-scripts.php
34864
0644
edit
dl
rm
class-wp-session-tokens.php
7319
0644
edit
dl
rm
class-wp-simplepie-file.php
3552
0644
edit
dl
rm
class-wp-simplepie-sanitize-kses.php
1910
0644
edit
dl
rm
class-wp-site-query.php
31655
0644
edit
dl
rm
class-wp-site.php
7467
0644
edit
dl
rm
class-wp-speculation-rules.php
7527
0644
edit
dl
rm
class-wp-styles.php
12843
0644
edit
dl
rm
class-wp-tax-query.php
19577
0644
edit
dl
rm
class-wp-taxonomy.php
18559
0644
edit
dl
rm
class-wp-term-query.php
40953
0644
edit
dl
rm
class-wp-term.php
5298
0644
edit
dl
rm
class-wp-text-diff-renderer-inline.php
979
0644
edit
dl
rm
class-wp-text-diff-renderer-table.php
18880
0644
edit
dl
rm
class-wp-textdomain-registry.php
10481
0644
edit
dl
rm
class-wp-theme-json-data.php
1809
0644
edit
dl
rm
class-wp-theme-json-resolver.php
35738
0644
edit
dl
rm
class-wp-theme-json-schema.php
7367
0644
edit
dl
rm
class-wp-theme-json.php
164347
0644
edit
dl
rm
class-wp-theme.php
65810
0644
edit
dl
rm
class-wp-token-map.php
28618
0644
edit
dl
rm
class-wp-url-pattern-prefixer.php
4802
0644
edit
dl
rm
class-wp-user-meta-session-tokens.php
3011
0644
edit
dl
rm
class-wp-user-query.php
44166
0644
edit
dl
rm
class-wp-user-request.php
2305
0644
edit
dl
rm
class-wp-user.php
23044
0644
edit
dl
rm
class-wp-walker.php
13322
0644
edit
dl
rm
class-wp-widget-factory.php
3347
0644
edit
dl
rm
class-wp-widget.php
18429
0644
edit
dl
rm
class-wp-xmlrpc-server.php
215447
0644
edit
dl
rm
class-wp.php
26481
0644
edit
dl
rm
class-wpdb.php
118627
0644
edit
dl
rm
class.wp-dependencies.php
373
0644
edit
dl
rm
class.wp-scripts.php
343
0644
edit
dl
rm
class.wp-styles.php
338
0644
edit
dl
rm
comment-template.php
103145
0644
edit
dl
rm
comment.php
134069
0644
edit
dl
rm
compat-utf8.php
19554
0644
edit
dl
rm
compat.php
17830
0644
edit
dl
rm
cron.php
42988
0644
edit
dl
rm
date.php
400
0644
edit
dl
rm
default-constants.php
11365
0644
edit
dl
rm
default-filters.php
37910
0644
edit
dl
rm
default-widgets.php
2295
0644
edit
dl
rm
deprecated.php
192644
0644
edit
dl
rm
embed-template.php
338
0644
edit
dl
rm
embed.php
38911
0644
edit
dl
rm
error-protection.php
4121
0644
edit
dl
rm
feed-atom-comments.php
5504
0644
edit
dl
rm
feed-atom.php
3121
0644
edit
dl
rm
feed-rdf.php
2668
0644
edit
dl
rm
feed-rss.php
1189
0644
edit
dl
rm
feed-rss2-comments.php
4136
0644
edit
dl
rm
feed-rss2.php
3799
0644
edit
dl
rm
feed.php
25189
0644
edit
dl
rm
fonts.php
9790
0644
edit
dl
rm
formatting.php
354741
0644
edit
dl
rm
functions.php
288600
0644
edit
dl
rm
functions.wp-scripts.php
15311
0644
edit
dl
rm
functions.wp-styles.php
8641
0644
edit
dl
rm
general-template.php
173004
0644
edit
dl
rm
global-styles-and-settings.php
21204
0644
edit
dl
rm
http.php
27650
0644
edit
dl
rm
https-detection.php
5857
0644
edit
dl
rm
https-migration.php
4741
0644
edit
dl
rm
kses.php
83849
0644
edit
dl
rm
l10n.php
68797
0644
edit
dl
rm
link-template.php
160117
0644
edit
dl
rm
load.php
56510
0644
edit
dl
rm
locale.php
162
0644
edit
dl
rm
media-template.php
63197
0644
edit
dl
rm
media.php
221247
0644
edit
dl
rm
meta.php
66556
0644
edit
dl
rm
ms-blogs.php
25845
0644
edit
dl
rm
ms-default-constants.php
4921
0644
edit
dl
rm
ms-default-filters.php
6636
0644
edit
dl
rm
ms-deprecated.php
21759
0644
edit
dl
rm
ms-files.php
2857
0644
edit
dl
rm
ms-functions.php
91842
0644
edit
dl
rm
ms-load.php
19887
0644
edit
dl
rm
ms-network.php
3782
0644
edit
dl
rm
ms-settings.php
4204
0644
edit
dl
rm
ms-site.php
41717
0644
edit
dl
rm
nav-menu-template.php
25990
0644
edit
dl
rm
nav-menu.php
44347
0644
edit
dl
rm
option.php
105035
0644
edit
dl
rm
pluggable-deprecated.php
6324
0644
edit
dl
rm
pluggable.php
127457
0644
edit
dl
rm
plugin.php
36501
0644
edit
dl
rm
post-formats.php
7102
0644
edit
dl
rm
post-template.php
68648
0644
edit
dl
rm
post-thumbnail-template.php
10879
0644
edit
dl
rm
post.php
296072
0644
edit
dl
rm
query.php
37095
0644
edit
dl
rm
registration-functions.php
200
0644
edit
dl
rm
registration.php
200
0644
edit
dl
rm
rest-api.php
100984
0644
edit
dl
rm
revision.php
30741
0644
edit
dl
rm
rewrite.php
19490
0644
edit
dl
rm
robots-template.php
5185
0644
edit
dl
rm
rss-functions.php
255
0644
edit
dl
rm
rss.php
23203
0644
edit
dl
rm
script-loader.php
158344
0644
edit
dl
rm
script-modules.php
9911
0644
edit
dl
rm
session.php
258
0644
edit
dl
rm
shortcodes.php
24050
0644
edit
dl
rm
sitemaps.php
3238
0644
edit
dl
rm
speculative-loading.php
8600
0644
edit
dl
rm
spl-autoload-compat.php
441
0644
edit
dl
rm
style-engine.php
7563
0644
edit
dl
rm
taxonomy.php
177058
0644
edit
dl
rm
template-canvas.php
544
0644
edit
dl
rm
template-loader.php
4267
0644
edit
dl
rm
template.php
36834
0644
edit
dl
rm
theme-i18n.json
1730
0644
edit
dl
rm
theme-previews.php
2910
0644
edit
dl
rm
theme-templates.php
6238
0644
edit
dl
rm
theme.json
8921
0644
edit
dl
rm
theme.php
135008
0644
edit
dl
rm
update.php
38353
0644
edit
dl
rm
user.php
178710
0644
edit
dl
rm
utf8.php
7260
0644
edit
dl
rm
vars.php
6562
0644
edit
dl
rm
version.php
1106
0644
edit
dl
rm
widgets.php
71129
0644
edit
dl
rm
wp-db.php
445
0644
edit
dl
rm
wp-diff.php
799
0644
edit
dl
rm
Edit:
/var/www/vhosts/ihelp.ro/ajutam.ro/wp-includes/class-pop3.php
(21121B)
<?php /** * mail_fetch/setup.php * * Copyright (c) 1999-2011 CDI (cdi@thewebmasters.net) All Rights Reserved * Modified by Philippe Mingo 2001-2009 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 * * @copyright 1999-2011 The SquirrelMail Project Team * @license https://opensource.org/licenses/gpl-license.php GNU Public License * @package plugins * @subpackage mail_fetch */ class POP3 { var $ERROR = ''; // Error string. var $TIMEOUT = 60; // Default timeout before giving up on a // network operation. var $COUNT = -1; // Mailbox msg count var $BUFFER = 512; // Socket buffer for socket fgets() calls. // Per RFC 1939 the returned line a POP3 // server can send is 512 bytes. var $FP = ''; // The connection to the server's // file descriptor var $MAILSERVER = ''; // Set this to hard code the server name 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 $ALLOWAPOP = FALSE; // Allow or disallow apop() // This must be set to true // manually /** * PHP5 constructor. */ function __construct ( $server = '', $timeout = '' ) { settype($this->BUFFER,"integer"); if( !empty($server) ) { // Do not allow programs to alter MAILSERVER // if it is already specified. They can get around // this if they -really- want to, so don't count on it. if(empty($this->MAILSERVER)) $this->MAILSERVER = $server; } if(!empty($timeout)) { settype($timeout,"integer"); $this->TIMEOUT = $timeout; // Extend POP3 request timeout to the specified TIMEOUT property. if(function_exists("set_time_limit")){ set_time_limit($timeout); } } return true; } /** * PHP4 constructor. */ public function POP3( $server = '', $timeout = '' ) { self::__construct( $server, $timeout ); } function update_timer () { // Extend POP3 request timeout to the specified TIMEOUT property. if(function_exists("set_time_limit")){ set_time_limit($this->TIMEOUT); } return true; } function connect ($server, $port = 110) { // Opens a socket to the specified server. Unless overridden, // port defaults to 110. Returns true on success, false on fail // If MAILSERVER is set, override $server with its value. if (!isset($port) || !$port) {$port = 110;} if(!empty($this->MAILSERVER)) $server = $this->MAILSERVER; if(empty($server)){ $this->ERROR = "POP3 connect: " . _("No server specified"); unset($this->FP); return false; } $fp = @fsockopen("$server", $port, $errno, $errstr); if(!$fp) { $this->ERROR = "POP3 connect: " . _("Error ") . "[$errno] [$errstr]"; unset($this->FP); return false; } socket_set_blocking($fp,-1); $this->update_timer(); $reply = fgets($fp,$this->BUFFER); $reply = $this->strip_clf($reply); if($this->DEBUG) error_log("POP3 SEND [connect: $server] GOT [$reply]",0); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 connect: " . _("Error ") . "[$reply]"; unset($this->FP); return false; } $this->FP = $fp; $this->BANNER = $this->parse_banner($reply); return true; } function user ($user = "") { // Sends the USER command, returns true or false if( empty($user) ) { $this->ERROR = "POP3 user: " . _("no login ID submitted"); return false; } elseif(!isset($this->FP)) { $this->ERROR = "POP3 user: " . _("connection not established"); return false; } else { $reply = $this->send_cmd("USER $user"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 user: " . _("Error ") . "[$reply]"; return false; } else return true; } } function pass ($pass = "") { // Sends the PASS command, returns # of msgs in mailbox, // returns false (undef) on Auth failure if(empty($pass)) { $this->ERROR = "POP3 pass: " . _("No password submitted"); return false; } elseif(!isset($this->FP)) { $this->ERROR = "POP3 pass: " . _("connection not established"); return false; } else { $reply = $this->send_cmd("PASS $pass"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 pass: " . _("Authentication failed") . " [$reply]"; $this->quit(); return false; } else { // Auth successful. $count = $this->last("count"); $this->COUNT = $count; return $count; } } } function apop ($login,$pass) { // Attempts an APOP login. If this fails, it'll // try a standard login. YOUR SERVER MUST SUPPORT // THE USE OF THE APOP COMMAND! // (apop is optional per rfc1939) if(!isset($this->FP)) { $this->ERROR = "POP3 apop: " . _("No connection to server"); return false; } elseif(!$this->ALLOWAPOP) { $retVal = $this->login($login,$pass); return $retVal; } elseif(empty($login)) { $this->ERROR = "POP3 apop: " . _("No login ID submitted"); return false; } elseif(empty($pass)) { $this->ERROR = "POP3 apop: " . _("No password submitted"); return false; } else { $banner = $this->BANNER; if( (!$banner) or (empty($banner)) ) { $this->ERROR = "POP3 apop: " . _("No server banner") . ' - ' . _("abort"); $retVal = $this->login($login,$pass); return $retVal; } else { $AuthString = $banner; $AuthString .= $pass; $APOPString = md5($AuthString); $cmd = "APOP $login $APOPString"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 apop: " . _("apop authentication failed") . ' - ' . _("abort"); $retVal = $this->login($login,$pass); return $retVal; } else { // Auth successful. $count = $this->last("count"); $this->COUNT = $count; return $count; } } } } function login ($login = "", $pass = "") { // Sends both user and pass. Returns # of msgs in mailbox or // false on failure (or -1, if the error occurs while getting // the number of messages.) if( !isset($this->FP) ) { $this->ERROR = "POP3 login: " . _("No connection to server"); return false; } else { $fp = $this->FP; if( !$this->user( $login ) ) { // Preserve the error generated by user() return false; } else { $count = $this->pass($pass); if( (!$count) || ($count == -1) ) { // Preserve the error generated by last() and pass() return false; } else return $count; } } } function top ($msgNum, $numLines = "0") { // Gets the header and first $numLines of the msg body // returns data in an array with each returned line being // an array element. If $numLines is empty, returns // only the header information, and none of the body. if(!isset($this->FP)) { $this->ERROR = "POP3 top: " . _("No connection to server"); return false; } $this->update_timer(); $fp = $this->FP; $buffer = $this->BUFFER; $cmd = "TOP $msgNum $numLines"; fwrite($fp, "TOP $msgNum $numLines\r\n"); $reply = fgets($fp, $buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 top: " . _("Error ") . "[$reply]"; return false; } $count = 0; $MsgArray = array(); $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { $MsgArray[$count] = $line; $count++; $line = fgets($fp,$buffer); if(empty($line)) { break; } } return $MsgArray; } function pop_list ($msgNum = "") { // If called with an argument, returns that msgs' size in octets // No argument returns an associative array of undeleted // msg numbers and their sizes in octets if(!isset($this->FP)) { $this->ERROR = "POP3 pop_list: " . _("No connection to server"); return false; } $fp = $this->FP; $Total = $this->COUNT; if( (!$Total) or ($Total == -1) ) { return false; } if($Total == 0) { return array("0","0"); // return -1; // mailbox empty } $this->update_timer(); if(!empty($msgNum)) { $cmd = "LIST $msgNum"; fwrite($fp,"$cmd\r\n"); $reply = fgets($fp,$this->BUFFER); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; return false; } list($junk,$num,$size) = preg_split('/\s+/',$reply); return $size; } $cmd = "LIST"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $reply = $this->strip_clf($reply); $this->ERROR = "POP3 pop_list: " . _("Error ") . "[$reply]"; return false; } $MsgArray = array(); $MsgArray[0] = $Total; for($msgC=1;$msgC <= $Total; $msgC++) { if($msgC > $Total) { break; } $line = fgets($fp,$this->BUFFER); $line = $this->strip_clf($line); if(strpos($line, '.') === 0) { $this->ERROR = "POP3 pop_list: " . _("Premature end of list"); return false; } list($thisMsg,$msgSize) = preg_split('/\s+/',$line); settype($thisMsg,"integer"); if($thisMsg != $msgC) { $MsgArray[$msgC] = "deleted"; } else { $MsgArray[$msgC] = $msgSize; } } return $MsgArray; } function get ($msgNum) { // Retrieve the specified msg number. Returns an array // where each line of the msg is an array element. if(!isset($this->FP)) { $this->ERROR = "POP3 get: " . _("No connection to server"); return false; } $this->update_timer(); $fp = $this->FP; $buffer = $this->BUFFER; $cmd = "RETR $msgNum"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 get: " . _("Error ") . "[$reply]"; return false; } $count = 0; $MsgArray = array(); $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { if ( $line[0] == '.' ) { $line = substr($line,1); } $MsgArray[$count] = $line; $count++; $line = fgets($fp,$buffer); if(empty($line)) { break; } } return $MsgArray; } function last ( $type = "count" ) { // Returns the highest msg number in the mailbox. // returns -1 on error, 0+ on success, if type != count // results in a popstat() call (2 element array returned) $last = -1; if(!isset($this->FP)) { $this->ERROR = "POP3 last: " . _("No connection to server"); return $last; } $reply = $this->send_cmd("STAT"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 last: " . _("Error ") . "[$reply]"; return $last; } $Vars = preg_split('/\s+/',$reply); $count = $Vars[1]; $size = $Vars[2]; settype($count,"integer"); settype($size,"integer"); if($type != "count") { return array($count,$size); } return $count; } function reset () { // Resets the status of the remote server. This includes // resetting the status of ALL msgs to not be deleted. // This method automatically closes the connection to the server. if(!isset($this->FP)) { $this->ERROR = "POP3 reset: " . _("No connection to server"); return false; } $reply = $this->send_cmd("RSET"); if(!$this->is_ok($reply)) { // The POP3 RSET command -never- gives a -ERR // response - if it ever does, something truly // wild is going on. $this->ERROR = "POP3 reset: " . _("Error ") . "[$reply]"; @error_log("POP3 reset: ERROR [$reply]",0); } $this->quit(); return true; } function send_cmd ( $cmd = "" ) { // Sends a user defined command string to the // POP server and returns the results. Useful for // non-compliant or custom POP servers. // Do NOT include the \r\n as part of your command // string - it will be appended automatically. // The return value is a standard fgets() call, which // will read up to $this->BUFFER bytes of data, until it // encounters a new line, or EOF, whichever happens first. // This method works best if $cmd responds with only // one line of data. if(!isset($this->FP)) { $this->ERROR = "POP3 send_cmd: " . _("No connection to server"); return false; } if(empty($cmd)) { $this->ERROR = "POP3 send_cmd: " . _("Empty command string"); return ""; } $fp = $this->FP; $buffer = $this->BUFFER; $this->update_timer(); fwrite($fp,"$cmd\r\n"); $reply = fgets($fp,$buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } return $reply; } function quit() { // Closes the connection to the POP3 server, deleting // any msgs marked as deleted. if(!isset($this->FP)) { $this->ERROR = "POP3 quit: " . _("connection does not exist"); return false; } $fp = $this->FP; $cmd = "QUIT"; fwrite($fp,"$cmd\r\n"); $reply = fgets($fp,$this->BUFFER); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } fclose($fp); unset($this->FP); return true; } function popstat () { // Returns an array of 2 elements. The number of undeleted // msgs in the mailbox, and the size of the mbox in octets. $PopArray = $this->last("array"); if($PopArray == -1) { return false; } if( (!$PopArray) or (empty($PopArray)) ) { return false; } return $PopArray; } function uidl ($msgNum = "") { // Returns the UIDL of the msg specified. If called with // no arguments, returns an associative array where each // undeleted msg num is a key, and the msg's uidl is the element // Array element 0 will contain the total number of msgs if(!isset($this->FP)) { $this->ERROR = "POP3 uidl: " . _("No connection to server"); return false; } $fp = $this->FP; $buffer = $this->BUFFER; if(!empty($msgNum)) { $cmd = "UIDL $msgNum"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); return $myUidl; } else { $this->update_timer(); $UIDLArray = array(); $Total = $this->COUNT; $UIDLArray[0] = $Total; if ($Total < 1) { return $UIDLArray; } $cmd = "UIDL"; fwrite($fp, "UIDL\r\n"); $reply = fgets($fp, $buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } $line = ""; $count = 1; $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { list ($msg,$msgUidl) = preg_split('/\s+/',$line); $msgUidl = $this->strip_clf($msgUidl); if($count == $msg) { $UIDLArray[$msg] = $msgUidl; } else { $UIDLArray[$count] = 'deleted'; } $count++; $line = fgets($fp,$buffer); } } return $UIDLArray; } function delete ($msgNum = "") { // Flags a specified msg as deleted. The msg will not // be deleted until a quit() method is called. if(!isset($this->FP)) { $this->ERROR = "POP3 delete: " . _("No connection to server"); return false; } if(empty($msgNum)) { $this->ERROR = "POP3 delete: " . _("No msg number submitted"); return false; } $reply = $this->send_cmd("DELE $msgNum"); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 delete: " . _("Command failed ") . "[$reply]"; return false; } return true; } // ********************************************************* // The following methods are internal to the class. function is_ok ($cmd = "") { // Return true or false on +OK or -ERR if( empty($cmd) ) return false; else return( stripos($cmd, '+OK') !== false ); } function strip_clf ($text = "") { // Strips \r\n from server responses if(empty($text)) return $text; else { $stripped = str_replace(array("\r","\n"),'',$text); return $stripped; } } function parse_banner ( $server_text ) { $outside = true; $banner = ""; $length = strlen($server_text); for($count =0; $count < $length; $count++) { $digit = substr($server_text,$count,1); if(!empty($digit)) { if( (!$outside) && ($digit != '<') && ($digit != '>') ) { $banner .= $digit; } if ($digit == '<') { $outside = false; } if($digit == '>') { $outside = true; } } } $banner = $this->strip_clf($banner); // Just in case return "<$banner>"; } } // End class // For php4 compatibility if (!function_exists("stripos")) { function stripos($haystack, $needle){ return strpos($haystack, stristr( $haystack, $needle )); } }
Save
cmd:
run