function ftp_logout() { unset($_SESSION['ftp_login']); unset($_SESSION['ftp_pass']); unset($_SESSION['ftp_host']); session_write_close(); extRedirect(make_link(null, null, null, null, null, null, '&file_mode=file')); }
$GLOBALS['ext_File'] = new ext_File(); if (ext_isFTPMode()) { // Try to connect to the FTP server. HOST, PORT, TIMEOUT $ftp_host = extGetParam($_SESSION, 'ftp_host', 'localhost:21'); $url = @parse_url('ftp://' . $ftp_host); $port = empty($url['port']) ? 21 : $url['port']; $ftp = new Net_FTP($url['host'], $port, 20); /** @global Net_FTP $GLOBALS['FTPCONNECTION'] */ $GLOBALS['FTPCONNECTION'] = new Net_FTP($url['host'], $port, 20); $res = $GLOBALS['FTPCONNECTION']->connect(); if (PEAR::isError($res)) { echo $res->getMessage(); $GLOBALS['file_mode'] = $_SESSION['file_mode'] = 'file'; } else { if (empty($_SESSION['ftp_login']) && empty($_SESSION['ftp_pass'])) { extRedirect(make_link('ftp_authentication', null, null, null, null, null, '&file_mode=file')); } $login_res = $GLOBALS['FTPCONNECTION']->login($_SESSION['ftp_login'], $_SESSION['ftp_pass']); if (PEAR::isError($res)) { echo $login_res->getMessage(); $GLOBALS['file_mode'] = $_SESSION['file_mode'] = 'file'; } } } //------------------------------------------------------------------------------ if ($GLOBALS["require_login"]) { // LOGIN require _EXT_PATH . "/include/login.php"; if ($GLOBALS["action"] == "logout") { logout(); } else {
} } // Get Sort $GLOBALS["order"] = extGetParam($_REQUEST, 'order', 'name'); // Get Sortorder $GLOBALS["direction"] = extGetParam($_REQUEST, 'direction', 'ASC'); $GLOBALS["start"] = extGetParam($_REQUEST, 'start', 0); $GLOBALS["limit"] = extGetParam($_REQUEST, 'limit', 50); //------------------------------------------------------------------------------ /** @var $GLOBALS['file_mode'] Can be 'file' or 'ftp' */ if (!isset($_REQUEST['file_mode']) && !empty($_SESSION['file_mode'])) { $GLOBALS['file_mode'] = extGetParam($_SESSION, 'file_mode', $GLOBALS['ext_conf']['authentication_method_default']); } else { if (@$_REQUEST['file_mode'] != @$_SESSION['file_mode'] && in_array($_REQUEST['file_mode'], $GLOBALS['ext_conf']['authentication_methods_allowed'])) { if ($action != 'login' && empty($_SESSION['credentials_' . extGetParam($_REQUEST, 'file_mode')])) { extRedirect(make_link('login', '', null, null, null, null, '&type=' . urlencode(extGetParam($_REQUEST, 'file_mode')))); } else { $GLOBALS['file_mode'] = $_SESSION['file_mode'] = extGetParam($_REQUEST, 'file_mode', $GLOBALS['ext_conf']['authentication_method_default']); } } elseif (isset($_REQUEST['file_mode'])) { $GLOBALS['file_mode'] = $_SESSION['file_mode'] = extGetParam($_REQUEST, 'file_mode', $GLOBALS['ext_conf']['authentication_method_default']); } else { $GLOBALS['file_mode'] = extGetParam($_SESSION, 'file_mode', $GLOBALS['ext_conf']['authentication_method_default']); } } // Necessary files require_once _EXT_PATH . "/languages/english.php"; if (file_exists(_EXT_PATH . "/languages/" . $GLOBALS["language"] . ".php")) { require_once _EXT_PATH . "/languages/" . $GLOBALS["language"] . ".php"; } require_once _EXT_PATH . "/languages/english_mimes.php";
function onLogout() { unset($_SESSION['credentials_ftp']); unset($_SESSION['ftp_host']); unset($_SESSION['ftp_login']); session_write_close(); extRedirect(ext_make_link(null, null, null, null, null, null, '&file_mode=' . $GLOBALS['ext_conf']['authentication_method_default'])); }
function onLogout() { unset($_SESSION['credentials_ssh2']); unset($_SESSION['ssh2_host']); session_write_close(); extRedirect(ext_make_link(null, null, null, null, null, null, '&file_mode=file')); }
function onLogout() { unset($_SESSION['credentials_ftp']); unset($_SESSION['ftp_host']); session_write_close(); extRedirect(make_link(null, null, null, null, null, null, '&file_mode=extplorer')); }
function sendResult($action, $success, $msg, $extra = array()) { // show error-message if (ext_isXHR()) { $success = (bool) $success; if ($success && ext_Result::count_errors() > 0) { $success = false; foreach (@$_SESSION['ext_error'] as $type) { if (is_array($type)) { foreach ($type as $error) { $msg .= '<br >' . $error; } } } } $result = array('action' => $action, 'message' => str_replace("'", "\\'", $msg), 'error' => str_replace("'", "\\'", $msg), 'success' => $success); foreach ($extra as $key => $value) { $result[$key] = $value; } $json = new ext_Json(); $jresult = $json->encode($result); print $jresult; ext_exit(); } if ($extra != NULL) { $msg .= " - " . $extra; } ext_Result::add_error($msg); if (empty($_GET['error'])) { session_write_close(); extRedirect(make_link("show_error", $GLOBALS["dir"], null, null, null, null, '&error=1&extra=' . urlencode($extra))); } else { show_header($GLOBALS["error_msg"]["error"]); echo '<div class="quote">'; echo '<a href="#errors">' . ext_Result::count_errors() . ' ' . $GLOBALS["error_msg"]["error"] . '</a>, '; echo '<a href="#messages">' . ext_Result::count_messages() . ' ' . $GLOBALS["error_msg"]["message"] . '</a><br />'; echo "</div>\n"; if (!empty($_SESSION['ext_message'])) { echo "<a href=\"" . str_replace('&dir=', '&ignore=', make_link("list", '')) . "\">[ " . $GLOBALS["error_msg"]["back"] . " ]</a>"; echo "<div class=\"ext_message\"><a name=\"messages\"></a>\n\t\t\t\t\t\t<h3>" . $GLOBALS["error_msg"]["message"] . ":</strong>" . "</h3>\n"; foreach ($_SESSION['ext_message'] as $msgtype) { foreach ($msgtype as $message) { echo $message . "\n<br/>"; } echo '<br /><hr /><br />'; } ext_Result::empty_messages(); if (!empty($_REQUEST['extra'])) { echo " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES); } echo "</div>\n"; } if (!empty($_SESSION['ext_error'])) { echo "<div class=\"ext_error\"><a name=\"errors\"></a>\n\t\t\t\t\t\t<h3>" . $GLOBALS["error_msg"]["error"] . ":</strong>" . "</h3>\n"; foreach ($_SESSION['ext_error'] as $errortype) { foreach ($errortype as $error) { echo $error . "\n<br/>"; } echo '<br /><hr /><br />'; } ext_Result::empty_errors(); } echo "<a href=\"" . str_replace('&dir=', '&ignore=', make_link("list", '')) . "\">" . $GLOBALS["error_msg"]["back"] . "</a>"; if (!empty($_REQUEST['extra'])) { echo " - " . htmlspecialchars(urldecode($_REQUEST['extra']), ENT_QUOTES); } echo "</div>\n"; defined('EXPLORER_NOEXEC') or define('EXPLORER_NOEXEC', 1); } }