Пример #1
0
 public function get($from, $to)
 {
     return $this->ftp->get($from, $to);
 }
Пример #2
0
function getftpurl($host, $port, $url, $saveToFile = 0)
{
    global $nn, $lastError, $PHP_SELF, $FtpBytesTotal, $FtpBytesReceived, $FtpTimeStart, $FtpChunkSize, $options;
    $ftp = new ftp(FALSE, FALSE);
    $server = "{$host}:{$port}";
    if (empty($host) || empty($port) || !$ftp->SetServer($host, (int) $port)) {
        $ftp->quit();
        $lastError = sprintf(lang(79), $server);
        return FALSE;
    } else {
        if (!$ftp->connect()) {
            $ftp->quit();
            $lastError = sprintf(lang(79), $server);
            return FALSE;
        } else {
            if (!$ftp->login()) {
                $ftp->quit();
                $lastError = lang(80);
                return FALSE;
            } else {
                echo '<p>';
                printf(lang(81), $server);
                echo '<br />';
                //$ftp->Passive(FALSE);
                $tmp = explode("/", $url);
                $ftp_file = array_pop($tmp);
                $ftp_dir = implode('/', $tmp);
                $ftp->chdir($ftp_dir);
                $fileSize = $FtpBytesTotal = $ftp->filesize($ftp_file);
                $FtpChunkSize = round($fileSize / 333);
                if (strpos($saveToFile, '?') !== false) {
                    $saveToFile = substr($saveToFile, 0, strpos($saveToFile, '?'));
                }
                if ($options['file_size_limit'] > 0) {
                    if ($fileSize > $options['file_size_limit'] * 1024 * 1024) {
                        $lastError = lang(336) . bytesToKbOrMbOrGb($options['file_size_limit'] * 1024 * 1024) . ".";
                        return false;
                    }
                }
                if (!empty($options['rename_prefix'])) {
                    $File_Name = $options['rename_prefix'] . '_' . basename($saveToFile);
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                if (!empty($options['rename_suffix'])) {
                    $ext = strrchr(basename($saveToFile), '.');
                    $before_ext = explode($ext, basename($saveToFile));
                    $File_Name = $before_ext[0] . '_' . $options['rename_suffix'] . $ext;
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                if ($options['rename_underscore']) {
                    $File_Name = str_replace(array(' ', '%20'), '_', basename($saveToFile));
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                $filetype = strrchr($saveToFile, '.');
                if (is_array($options['forbidden_filetypes']) && in_array(strtolower($filetype), $options['forbidden_filetypes'])) {
                    if ($options['forbidden_filetypes_block']) {
                        html_error(sprintf(lang(82), $filetype));
                    }
                    $saveToFile = str_replace($filetype, $options['rename_these_filetypes_to'], $saveToFile);
                }
                if (@file_exists($saveToFile) && $options['bw_save']) {
                    // Skip in audl.
                    if (isset($_GET['audl'])) {
                        echo '<script type="text/javascript">parent.nextlink();</script>';
                    }
                    html_error(lang(99) . ': ' . link_for_file($saveToFile));
                } elseif (@file_exists($saveToFile)) {
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . time() . '_' . basename($saveToFile);
                }
                printf(lang(83), basename($saveToFile), bytesToKbOrMbOrGb($fileSize));
                echo "<br />";
                require_once TEMPLATE_DIR . '/transloadui.php';
                $FtpTimeStart = getmicrotime();
                if ($ftp->get($ftp_file, $saveToFile)) {
                    $ftp->quit();
                    $time = getmicrotime() - $FtpTimeStart;
                    return array('time' => sec2time(round($time)), 'speed' => @round($FtpBytesTotal / 1024 / $time, 2), 'received' => TRUE, 'size' => bytesToKbOrMbOrGb($fileSize), 'bytesReceived' => $FtpBytesReceived, 'bytesTotal' => $FtpBytesTotal, 'file' => $saveToFile);
                }
                $ftp->quit();
                return FALSE;
            }
        }
    }
}
Пример #3
0
function getftpurl($host, $port, $url, $saveToFile = 0)
{
    global $nn, $lastError, $PHP_SELF, $FtpBytesTotal, $FtpBytesReceived, $FtpTimeStart, $FtpChunkSize, $options, $L;
    $ftp = new ftp(FALSE, FALSE);
    $server = "{$host}:{$port}";
    if (empty($host) || empty($port) || !$ftp->SetServer($host, (int) $port)) {
        $ftp->quit();
        $lastError = $L->sprintf($L->say['couldnt_establish_con'], $server) . "<br />" . '<a href="javascript:history.back(-1);">' . $L->say['_back'] . '</a><br /><br />';
        return FALSE;
    } else {
        if (!$ftp->connect()) {
            $ftp->quit();
            $lastError = $L->sprintf($L->say['couldnt_establish_con'], $server) . "<br />" . '<a href="javascript:history.back(-1);">' . $L->say['_back'] . '</a><br /><br />';
            return FALSE;
        } else {
            if (!$ftp->login()) {
                $ftp->quit();
                $lastError = $L->say['incorrect_userpass'] . "<br />" . '<a href="javascript:history.back(-1);">' . $L->say['_back'] . '</a><br /><br />';
                return FALSE;
            } else {
                echo '<p>';
                $L->sprintf($L->say['_con'], $host);
                echo '<br />';
                //$ftp->Passive(FALSE);
                $tmp = explode("/", $url);
                $ftp_file = array_pop($tmp);
                $ftp_dir = implode("/", $tmp);
                $ftp->chdir($ftp_dir);
                $fileSize = $FtpBytesTotal = $ftp->filesize($ftp_file);
                $FtpChunkSize = round($fileSize / 333);
                if (strpos($saveToFile, '?') !== false) {
                    $saveToFile = substr($saveToFile, 0, strpos($saveToFile, '?'));
                }
                if ($options['maxlimitsize'] > 0) {
                    if ($fileSize > $options['maxlimitsize'] * 1024 * 1024) {
                        $lastError = $L->sprintf($L->say['_sorry_tobig'], bytesToKbOrMbOrGb($fileSize), $options["maxlimitsize"]);
                        return false;
                    }
                }
                if ($options['minlimitsize'] > 0) {
                    if ($fileSize < $options['minlimitsize'] * 1024 * 1024) {
                        $lastError = $L->sprintf($L->say['_sorry_tosmall'], bytesToKbOrMbOrGb($fileSize), $options["minlimitsize"]);
                        return false;
                    }
                }
                if (!empty($options["add_ext_5city"]) || !empty($options['rename_suffix']) || !empty($options['rename_prefix']) || $options['rename_underscore']) {
                    if (!empty($options["add_ext_5city"])) {
                        $ext = str_replace(".", "", $options["add_ext_5city"]);
                        $File_Name = basename($saveToFile) . "." . $options["add_ext_5city"];
                    }
                    if (!empty($options['rename_prefix'])) {
                        $File_Name = $options['rename_prefix'] . '_' . basename($saveToFile);
                    }
                    if (!empty($options['rename_suffix'])) {
                        $ext = strrchr(basename($saveToFile), ".");
                        $before_ext = explode($ext, basename($saveToFile));
                        $File_Name = $before_ext[0] . '_' . $options['rename_suffix'] . $ext;
                    }
                    if ($options['rename_underscore']) {
                        $File_Name = str_replace(array(' ', '%20'), '_', basename($saveToFile));
                    }
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                $filetype = strrchr($saveToFile, ".");
                if (is_array($options['forbidden_filetypes']) && in_array(strtolower($filetype), $options['forbidden_filetypes'])) {
                    if ($options['forbidden_filetypes_block']) {
                        html_error($L->sprintf($L->say['_forbid_filetype'], $filetype));
                    } else {
                        $saveToFile = str_replace($filetype, $options['rename_these_filetypes_to'], $saveToFile);
                    }
                }
                if (file_exists($saveToFile)) {
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . time() . "_" . basename($saveToFile);
                }
                if (!empty($options["add_ext_5city"])) {
                    $ext = "." . get_extension(basename($saveToFile));
                    $File_Name = str_replace($ext, "", basename($saveToFile));
                }
                echo $L->sprintf($L->say['_saveprogres'], $saveToFile, $ext, bytesToKbOrMbOrGb($fileSize)) . "<br />";
                require_once TEMPLATE_DIR . 'transloadui.php';
                $FtpTimeStart = getmicrotime();
                if ($ftp->get($ftp_file, $saveToFile)) {
                    $ftp->quit();
                    $time = getmicrotime() - $FtpTimeStart;
                    return array('time' => sec2time(round($time)), 'speed' => @round($FtpBytesTotal / 1024 / $time, 2), 'received' => TRUE, 'size' => bytesToKbOrMbOrGb($fileSize), 'bytesReceived' => $FtpBytesReceived, 'bytesTotal' => $FtpBytesTotal, 'file' => $saveToFile);
                }
                $ftp->quit();
                return FALSE;
            }
        }
    }
}
Пример #4
0
function getftpurl($host, $port, $url, $saveToFile = 0)
{
    global $nn, $lastError, $PHP_SELF, $AUTH, $IS_FTP, $FtpBytesTotal, $FtpBytesReceived, $FtpTimeStart, $FtpChunkSize, $options;
    $ftp = new ftp(FALSE, FALSE);
    if (!$ftp->SetServer($host, (int) $port)) {
        $ftp->quit();
        $server = $host . ':' . $port;
        $lastError = sprintf(lang(79), $server) . "<br />" . '<a href="javascript:history.back(-1);">' . lang(78) . '</a><br /><br />';
        return FALSE;
    } else {
        if (!$ftp->connect()) {
            $ftp->quit();
            $lastError = sprintf(lang(79), $server) . "<br />" . '<a href="javascript:history.back(-1);">' . lang(78) . '</a><br /><br />';
            return FALSE;
        } else {
            if (!$ftp->login($AUTH["ftp"]["login"], $AUTH["ftp"]["password"])) {
                $ftp->quit();
                $lastError = lang(80) . "<br />" . '<a href="javascript:history.back(-1);">' . lang(78) . '</a><br /><br />';
                return FALSE;
            } else {
                echo '<p>';
                printf(lang(81), $host);
                echo '<br />';
                //$ftp->Passive(FALSE);
                $tmp = explode("/", $url);
                $ftp_file = array_pop($tmp);
                $ftp_dir = implode("/", $tmp);
                $ftp->chdir($ftp_dir);
                $fileSize = $FtpBytesTotal = $ftp->filesize($ftp_file);
                $FtpChunkSize = round($fileSize / 333);
                list($saveToFile, $tmp) = explode('?', $saveToFile);
                if (!empty($options['rename_prefix'])) {
                    $File_Name = $options['rename_prefix'] . '_' . basename($saveToFile);
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                if (!empty($options['rename_suffix'])) {
                    $ext = strrchr(basename($saveToFile), ".");
                    $before_ext = explode($ext, basename($saveToFile));
                    $File_Name = $before_ext[0] . '_' . $options['rename_suffix'] . $ext;
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                if ($options['rename_underscore']) {
                    $File_Name = str_replace(array(' ', '%20'), '_', basename($saveToFile));
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . $File_Name;
                }
                $filetype = strrchr($saveToFile, ".");
                if (is_array($options['forbidden_filetypes']) && in_array(strtolower($filetype), $options['forbidden_filetypes'])) {
                    if ($options['forbidden_filetypes_block']) {
                        html_error(sprintf(lang(82), $filetype));
                    } else {
                        $saveToFile = str_replace($filetype, $options['rename_these_filetypes_to'], $saveToFile);
                    }
                }
                if (file_exists($saveToFile)) {
                    $saveToFile = dirname($saveToFile) . PATH_SPLITTER . time() . "_" . basename($saveToFile);
                }
                printf(lang(83), $saveToFile, bytesToKbOrMbOrGb($fileSize));
                echo "<br />";
                ?>
<br />
<table cellspacing="0" cellpadding="0" style="FONT-FAMILY: Tahoma; FONT-SIZE: 11px;">
<tr>
<td></td>
<td>
<div class="progressouter">
<div id="progress" class="ftpprogress">
</div>
</div>
</td>
<td></td>
<tr>
<tr>
<td align="left" id="received">0 KB</td>
<td align="center" id="percent">0%</td>
<td align="right" id="speed">0 KB/s</td>
</tr>
</table>
<br />
<div id="resume" align="center" style="FONT-FAMILY: Tahoma; FONT-SIZE: 11px;"></div>
<script type="text/javascript">
/* <![CDATA[ */
function pr(percent, received, speed){
	document.getElementById("received").innerHTML = '<b>' + received + '</b>';
	document.getElementById("percent").innerHTML = '<b>' + percent + '%</b>';
	document.getElementById("progress").style.width = percent + '%';
	document.getElementById("speed").innerHTML = '<b>' + speed + ' KB/s</b>';
	document.title = 'Downloaded ' + percent + '%';
	return true;
	}

	function mail(str, field) {
	document.getElementById("mailPart." + field).innerHTML = str;
	return true;
	}
/* ]]> */
</script>
<br />
<?php 
                $FtpTimeStart = getmicrotime();
                if ($ftp->get($ftp_file, $saveToFile)) {
                    return array("time" => sec2time(round($time)), "speed" => @round($FtpBytesTotal / 1024 / (getmicrotime() - $FtpTimeStart), 2), "received" => TRUE, "size" => bytesToKbOrMbOrGb($fileSize), "bytesReceived" => $FtpBytesReceived, "bytesTotal" => $FtpBytesTotal, "file" => $saveToFile);
                } else {
                    return FALSE;
                }
                $ftp->quit();
            }
        }
    }
}
Пример #5
0
            echo z7i(z7l($o, '19', '2') . z7e(@is_numeric($list_f[$i][1]) ? z7c($list_f[$i][1]) : $list_f[$i][1], '10') . z7l($disp == '..' ? z0q($list_f[$i][0]) : z0r($list_f[$i][0]) . z4n($list_f[$i][0], 'idftp', ($i % 2 ? 'tra' : 'trb') . $jsid), '10'), $i % 2 ? '0' : '1', ($i % 2 ? 'tra' : 'trb') . $jsid);
            $jsid++;
        }
        echo z10w() . z5j() . z7g() . z7u() . z10w();
        echo z9m('2') . z7p() . z7k('', '4') . z0p('idloc', 'ltall', z9b('act') . z9b('flsort') . z9b('ffsort') . z9b('d') . z9b('ftpmloc', '1'), array('' => z9s("66"), 'upload' => z9s("197"), 'delete' => z9s("199"))) . z7g() . z7k('', '4') . z0p('idftp', 'rtall', z9b('act') . z9b('flsort') . z9b('ffsort') . z9b('d') . z9b('ftpmrem', '1'), array('' => z9s("66"), 'download' => z9s("198"), 'delete' => z9s("199"))) . z7g() . z7u() . z10w();
    } else {
        echo z2b(z9s("185") . z9c() . ($hmsg != '' ? ' : ' . $hmsg : ''));
        echo z6d() . z10e(z7i(z5c(array("act" => "ftp", "d"), z6x(z8e(z9s("186")) . z6i("ftp_server", $ftp_server, '5') . z6i("ftp_port", $ftp_port, '6')) . z6x(z8e(z9s("187")) . z6i("ftp_username", $ftp_username, '5')) . z6x(z8e(z9s("188")) . z6i("ftp_password", $ftp_password, '5') . z8v(z9s("189"), '7') . ' ' . z5y("ftp_passive1", z9s("190"), "ftp_passive")))), '2') . z6d();
        $dmsg = $umsg = '';
        if (!@empty($ftp_server) && !@empty($ftp_port) && !@empty($ftp_username) && !@empty($ftp_password) && @isset($ftp_quickaction)) {
            $ftp = new ftp($ftp_server, $ftp_port, $ftp_username, $ftp_password, $ftp_passive);
            if ($ftp->loggedOn) {
                if ($ftp_quickaction == "upload") {
                    $umsg = $ftp->put($ftp_remotefile, $ftp_localfile) ? z9s("208") : z9s("209");
                } elseif ($ftp_quickaction == "download") {
                    $dmsg = $ftp->get($ftp_remotefile, $ftp_localfile, 1) ? z9s("210") : z9s("211");
                }
            } else {
                if ($ftp_quickaction == "upload") {
                    $umsg = z9s("191");
                } else {
                    $dmsg = z9s("191");
                }
            }
        }
        echo z2b(array(z9s("200") . z9c() . ($dmsg != '' ? " : " . $dmsg : ''), z9s("201") . z9c() . ($umsg != '' ? " : " . $umsg : '')), '46');
        echo z10e(z9f(z9j(z5c(array('act' => 'ftp', 'ftp_quickaction' => 'download', 'd'), z10e(z5n() . z7i(z5t(z9s("202")) . z9j(z6i('ftp_server', $ftp_server, '2') . z6i('ftp_port', $ftp_port, '6'))) . z7i(z5t(z9s("203")) . z9j(z6i('ftp_username', $ftp_username, '4') . z6i('ftp_password', $ftp_password, '5'))) . z7i(z5t(z9s("204")) . z9j(z6i('ftp_remotefile', $ftp_remotefile, '0'))) . z7i(z5t(z9s("205")) . z9j(z6i('ftp_localfile', $ftp_localfile, '0'))) . z7i(z5t('') . z9j(z8v(z9s("207"), '7') . z5y("ftp_passive2", z9s("190"), "ftp_passive"))) . z5n())), '', '4') . z9j(z5c(array('act' => 'ftp', 'ftp_quickaction' => 'upload', 'd'), z10e(z5n() . z7i(z5t(z9s("202")) . z9j(z6i('ftp_server', $ftp_server, '2') . z6i('ftp_port', $ftp_port, '6'))) . z7i(z5t(z9s("203")) . z9j(z6i('ftp_username', $ftp_username, '4') . z6i('ftp_password', $ftp_password, '5'))) . z7i(z5t(z9s("205")) . z9j(z6i('ftp_localfile', $ftp_localfile, '0'))) . z7i(z5t(z9s("204")) . z9j(z6i('ftp_remotefile', $ftp_remotefile, '0'))) . z7i(z5t('') . z9j(z8v(z9s("206"), '7') . z5y("ftp_passive3", z9s("190"), "ftp_passive"))) . z5n())), '', '46')), '2');
    }
}
if ($act == 'ls') {
    if (!@isset($sort)) {