JFIF $ d d 7 * Z qn )ZP 0 !1 A "#a$2Qr D8 a Ri [f \m I ykI w0 c u F c Rı?lO7 к _f˓ [C $殷WF< _W ԣ s Kc ëI zyQy /_LK ℂ ;C",p F A : /] =H ~ , l s / 9 ć: [=/#f ; ) x { ٛE Q )~ = 𘙲r*2~ a _V = ' ku m F D } KYYC )( { * g& f `툪 r y ` = ^ c J. I ]( * `wq 1dđ #̩ ͑ 0 ; H ] u 搂 @:~ ו K L N s h } O I R* 8 :2 ! lD JV o ( 3 = M ( z Ȱ+i *N A r6K n S l ) ! J J Ӂ* % ݉?|D } d5: eP0 R; {$X' x F @ .ÊB {,WJ uQ ɲRI ;9 Q E琯 6 2fT .DU J ;*c P A\IL Nj! J ۱+ O\ ͔ ] ޒ S J ȧ c%A N ol ՎprU L Zԛe r E2= X D Xg VQeӓ k y P7 U* o m Q I s ,K `) 6\G3t?pgjr m ۛجw luGt f h 9uyP 0D;Uڽ"OXl i f $ ) &|ML 0 Z rm1 [ H XP l P R0 'G=i 2N +0 e 2 ]] 9 VT P O 7 h(F * 癈 ' = Q VZD F,d ߬ ~ T X G[ `le 69C R(!S2! P < 0 x < !1AQ "Raq 02Br #S CTb ? Ζ "]mH5WR 7 k.ۛ ! } Q~ + yԏ z |@ T20 S~ K e k *zF f^2X *( @ 8 r ? C I uI|֓>^Ex LgNU Y+{.R Ѫ τV YT D I 6 2 '8Y2 7'\T P.6 d &˦ @V q i |8 -O Ε ] ʔ U= T L 8= ;6c | !qfF3 a ů& ~$ l} 'NW U s$U k^S V : U#6w + +s &r+n ڐ { @ 29gL u " T Ù M=6 (^ "7 r}=6Yݾ lC u hquymp Ǧ G jhs ǜNl ɻ} o 7 #S6 a w 4 ! OS r D 5 7 % | ?x> L | / nD 6?/8 w # [ ) L 7 +6〼T A T g ! %5 Mm Z /c -{1_Je "| ^$ 'O & ޱմ < H vNqϡQ$ < 6 &Nݛ ֨tǻN (9 n ru~'όN sMG& ,uH Kw *Ī 5@ u6 BԒ i YN * f 0 _ GhKW u lT <nj- 0{ M L~ | /a v\ E = ?1 \ɟuq Ђ Y O a K ޡP q $ H8o Q˼EV ~ k 0 h' L Pp M -M" m^ !6l nմ 쮝C U T . ! :vMǨb h ډ Vc r @~p # !1QAa q ? AL0L x LU 4 d ; x " 16ad0 7.\ߋ 0 = P l v/ " c A Ay A|2pO8"d MV #1] = \ " ˡ ] k v I9 d ۓ & q ) ǐq E ꞅ v "P )q X &Q З non]я u ג./ ; gZ$ M QР 2M ]h ni 0 P $ێ 3CɏGjώy : m c # S_ l@ '_ \m|C 2`K _ 1 cIvGc $? PCQ S+D ? K aײ k Fr b 8 ύ NEدg ĝ U 3 6 #Ik+ v { v i ( ވ ? a e) X xy/*@Q Ǽ Ծ ) $ IWO l c G; !i k{ gOŀ L ('x T rb $ w) R $ & N1E td U3Uȉ1p M"N* (DNy d96.(jQ) X 5 c QɎMy W ? Q *!R > 6=7)Xj 5`J ] e 8%t ! + ' ! 1Q 5 !1 AQaq ё #2 "0BRb ? G t^ ## .l lQ T $ v , ,m 㵜5u bV =sY+ @d { N ! dn O < .- B; _w J t 6;Q Jd. Q c%p{ 1 ,sND dF H I0 Гo X ш e黅X ۢ F :)[ F G X ƹ / w _c MeD ,ʡc c . W D tA $ j@ : ) - #u c1< @ۗ9F ) KJ- hpP] _ x [ q B lb p ʖ w q " LFGd ƶ * s +ډ_Zc " ? % t[I P 6 J ]# =ɺ V v v CGs Gh1 > )6 |e y ? L ӣ m,4 G W Ui ` ] uJVo VDG< SB 6ϏQ @ TiU l y O U 0 kfV ~ ~}S Z @ *WU Ui ## ; s /[ = ! 7}" W N ] ' (L ! ~ y5 g9T̅J kbM' +s :S +B) v @ M j e C f j E 0 Y\Qn z G 1 д~ W o{T 9?` Rm yhsy3 !HAD ] m c1 ~ 2 L S u7x T ;j$ `} 4-> L# vzŏ I L S ֭ T { r jGK C ; b pU= - ` Bs K. S F w4 M q] Z dH S 0 ) tLg
<?php
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_operations_fopen -- Using the default PHP fopen() function instead of the WP Filesystem API.
// phpcs:disable WordPress.WP.AlternativeFunctions.file_system_operations_fclose -- using the native PHP fclose() function instead of the WP Filesystem API.
if (!defined('ABSPATH')) die('No direct access allowed.');
/**
* Adapted from http://www.solutionbot.com/2009/01/02/php-ftp-class/
*/
class UpdraftPlus_ftp_wrapper {
private $conn_id;
private $host;
private $username;
private $password;
private $port;
public $timeout = 60;
public $passive = true;
public $system_type = '';
public $ssl = false;
public $use_server_certs = false;
public $disable_verify = true;
public $login_type = 'non-encrypted';
public function __construct($host, $username, $password, $port = 21) {
$this->host = $host;
$this->username = $username;
$this->password = $password;
$this->port = $port;
}
public function connect() {
$time_start = time();
$this->conn_id = ftp_connect($this->host, $this->port, 20);
if ($this->conn_id) $result = ftp_login($this->conn_id, $this->username, $this->password);
if (!empty($result)) {
ftp_set_option($this->conn_id, FTP_TIMEOUT_SEC, $this->timeout);
ftp_pasv($this->conn_id, $this->passive);
$this->system_type = ftp_systype($this->conn_id);
return true;
}
if (time() - $time_start > 19) {
global $updraftplus_admin;
if (isset($updraftplus_admin->logged) && is_array($updraftplus_admin->logged)) {
/* translators: %s: Connection type (e.g., FTP) */
$updraftplus_admin->logged[] = sprintf(__('The %s connection timed out; if you entered the server correctly, then this is usually caused by a firewall blocking the connection - you should check with your web hosting company.', 'updraftplus'), 'FTP');
} else {
global $updraftplus;
/* translators: %s: Connection type (e.g., FTP) */
$updraftplus->log(sprintf(__('The %s connection timed out; if you entered the server correctly, then this is usually caused by a firewall blocking the connection - you should check with your web hosting company.', 'updraftplus'), 'FTP'), 'error');
}
}
return false;
}
public function put($local_file_path, $remote_file_path, $mode = FTP_BINARY, $resume = false, $updraftplus = false) {
$file_size = filesize($local_file_path);
$existing_size = 0;
if ($resume) {
$existing_size = ftp_size($this->conn_id, $remote_file_path);
if ($existing_size <=0) {
$resume = false;
$existing_size = 0;
} else {
if (is_a($updraftplus, 'UpdraftPlus')) $updraftplus->log("File already exists at remote site: size $existing_size. Will attempt resumption.");
if ($existing_size >= $file_size) {
if (is_a($updraftplus, 'UpdraftPlus')) $updraftplus->log("File is apparently already completely uploaded");
return true;
}
}
}
// From here on, $file_size is only used for logging calculations. We want to avoid division by zero.
$file_size = max($file_size, 1);
if (!$fh = fopen($local_file_path, 'rb')) return false;
if ($existing_size) fseek($fh, $existing_size);
$ret = ftp_nb_fput($this->conn_id, $remote_file_path, $fh, $mode, $existing_size);
// $existing_size can now be re-purposed
while (FTP_MOREDATA == $ret) {
if (is_a($updraftplus, 'UpdraftPlus')) {
$new_size = ftell($fh);
$record_after = 524288;
if ($existing_size > 2097152) {
$record_after = ($existing_size > 4194304) ? 2097152 : 1048576;
}
if ($new_size - $existing_size > $record_after) {
$existing_size = $new_size;
$percent = round(100*$new_size/$file_size, 1);
$updraftplus->record_uploaded_chunk($percent, '', $local_file_path);
}
}
// Continue upload
$ret = ftp_nb_continue($this->conn_id);
}
fclose($fh);
if (FTP_FINISHED != $ret) {
if (is_a($updraftplus, 'UpdraftPlus')) $updraftplus->log("FTP upload: error ($ret)");
return false;
}
return true;
}
public function get($local_file_path, $remote_file_path, $mode = FTP_BINARY, $resume = false, $updraftplus = false) {
$file_last_size = 0;
if ($resume) {
if (!$fh = fopen($local_file_path, 'ab')) return false;
clearstatcache($local_file_path);// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.clearstatcache_clear_realpath_cacheFound -- The function clearstatcache() does not have a parameter "clear_realpath_cache" in PHP version 5.2 or earlier
$file_last_size = filesize($local_file_path);
} else {
if (!$fh = fopen($local_file_path, 'wb')) return false;
}
$ret = ftp_nb_fget($this->conn_id, $fh, $remote_file_path, $mode, $file_last_size);
if (false == $ret) return false;
while (FTP_MOREDATA == $ret) {
if ($updraftplus) {
$file_now_size = filesize($local_file_path);
if ($file_now_size - $file_last_size > 524288) {
$updraftplus->log("FTP fetch: file size is now: ".sprintf("%0.2f", filesize($local_file_path)/1048576)." Mb");
$file_last_size = $file_now_size;
}
clearstatcache($local_file_path);// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.clearstatcache_clear_realpath_cacheFound -- The function clearstatcache() does not have a parameter "clear_realpath_cache" in PHP version 5.2 or earlier
}
$ret = ftp_nb_continue($this->conn_id);
}
fclose($fh);
if (FTP_FINISHED == $ret) {
if ($updraftplus) $updraftplus->log("FTP fetch: fetch complete");
return true;
} else {
if ($updraftplus) $updraftplus->log("FTP fetch: fetch failed");
return false;
}
}
public function chmod($permissions, $remote_filename) {
if ($this->is_octal($permissions)) {
$result = ftp_chmod($this->conn_id, $permissions, $remote_filename);
if ($result) {
return true;
} else {
return false;
}
} else {
throw new Exception('$permissions must be an octal number');
}
}
public function chdir($directory) {
ftp_chdir($this->conn_id, $directory);
}
public function delete($remote_file_path) {
if (ftp_delete($this->conn_id, $remote_file_path)) {
return true;
} else {
return false;
}
}
public function make_dir($directory) {
if (ftp_mkdir($this->conn_id, $directory)) {
return true;
} else {
return false;
}
}
public function rename($old_name, $new_name) {
if (ftp_rename($this->conn_id, $old_name, $new_name)) {
return true;
} else {
return false;
}
}
public function remove_dir($directory) {
if (ftp_rmdir($this->conn_id, $directory)) {
return true;
} else {
return false;
}
}
public function dir_list($directory) {
return ftp_nlist($this->conn_id, $directory);
}
public function cdup() {
ftp_cdup($this->conn_id);
}
public function size($f) {
return ftp_size($this->conn_id, $f);
}
public function current_dir() {
return ftp_pwd($this->conn_id);
}
private function is_octal($i) {
return decoct(octdec($i)) == $i;
}
public function __destruct() {
if ($this->conn_id) ftp_close($this->conn_id);
}
}