Login | Register (Invite Only)
Title: Page Telegram of Amfile.org
Description: Brown Hats Collective F' Around and Find Out user of the Interwebs and Project Developer for a Cause Toward Insuring a Future of Liberty without Illusion.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@=:---#@@@#%@@@*=+#@%====@@@@..:--@#====@-==#@@@+===#@%=-+@... -@@@@*@@@=+@%-*@ @@@.*@-.@@@.:@@==@:=@+ -..*@@@:# @:@=.=. #%.#@@@@ ::..@.%#.@@ %+ %@@% #@@-.@+ #@ @@@.*@+.@@@:.@@.#@%*@*.@.-*@@%@#.@.@=.%..#% *@@@@ %:+:+:@@=@@ #+ %@@+..@@= %: @@ @@@..-.=@@:* %@.%#=+@+..:@@@@@@*.@@@=..:@@@ %@%%% :.@@+-@:=#@ ...@@@:+ @@+ :- @@ @@@.+@@@@@.- =@.#@.-@*.@:=@@@@@+ @@@+:@-:@% @@*=@ @=%#+-@-.#@ @*.%@@.- #@=. + @@ @@@.+@@@@+.@..@:*%.*@*.@%.@@@@%- +@@=:@%.@@.%@:=@ @@=*#:@::@@ *# =@--% -@:- * @@ @@-::#@@%::+::*@-:=%@::.::@@@@+-::@*:.:::@::...%:::::#@*:==@#==@+:*.:=::%:-=::=@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@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*@% #@%. :%@@@. %@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@* .@@@@%=-+@@@. @@@*--#@@@@- -@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@: .@@@@@@@@@@*=@@@@@@@@@@: @@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@. .%@@@@@@@@@@@@@@@@@@@- .#@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@%. +@@@@@@@@@@@@@@@@#. +@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@%. .+@@@@@@@@@@@@%: +@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@%. -*%@@@@@#=. .*@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@: .%@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@#. +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+. .=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=. .-%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%###%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<?php include 'functions.php'; ?>
<?php include 'header.php'; ?>
<?php
$user = $_GET['user'] ?? '';
$path = $_GET['path'] ?? '';
if (!$user || !array_key_exists($user, getUsers())) {
echo '<p>Invalid user.</p>';
} else {
$users = getUsers();
echo '<h2>' . htmlspecialchars($user) . '\'s Profile</h2>';
echo '<p>Title: ' . htmlspecialchars($users[$user]['title']) . '</p>';
echo '<p>Description: ' . htmlspecialchars($users[$user]['description']) . '</p>';
echo '<pre class="ascii-art">' . htmlspecialchars($users[$user]['ascii_art']) . '</pre>';
echo '<h2>Repositories</h2>';
$userDir = USERS_DIR . $user . '/' . $path;
if (file_exists($userDir)) {
// If path is a top-level project (ends with / and no further /), show download button
if (substr_count($path, '/') == 1 && substr($path, -1) == '/') {
$project = trim($path, '/');
echo '<a href="download_project.php?user=' . urlencode($user) . '&project=' . urlencode($project) . '"><button>Download Project as ZIP</button></a><br><br>';
}
echo listDirectory($userDir, $user, $path);
} else {
echo '<p>No repositories.</p>';
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']) && $_POST['action'] == 'fork' && isset($_SESSION['user']) && $_SESSION['user'] != $user) {
$project = $_POST['project'];
$new_name = $_POST['new_name'];
$srcDir = USERS_DIR . $user . '/' . $project;
$dstDir = USERS_DIR . $_SESSION['user'] . '/' . $new_name;
if (file_exists($srcDir) && !file_exists($dstDir)) {
copyDir($srcDir, $dstDir);
echo '<p>Project forked successfully as ' . htmlspecialchars($new_name) . '.</p>';
} else {
echo '<p>Error forking project: Destination exists or source missing.</p>';
}
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']) && $_POST['action'] == 'edit' && isset($_SESSION['user']) && $_SESSION['user'] == $user) {
$file = USERS_DIR . $user . '/' . $_POST['file'];
if (strpos(realpath($file), realpath(USERS_DIR . $user)) === 0 && pathinfo($file, PATHINFO_EXTENSION) == 'txt') {
$content = $_POST['content'];
$language = $_POST['language'] ?? '';
file_put_contents($file, $content);
$jsonFile = pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.json';
if ($language) {
file_put_contents($jsonFile, json_encode(['language' => $language]));
} else if (file_exists($jsonFile)) {
unlink($jsonFile); // Remove metadata if language is empty
}
echo '<p>File updated successfully.</p>';
} else {
echo '<p>Invalid file or permission denied.</p>';
}
}
if (isset($_GET['file'])) {
$file = USERS_DIR . $user . '/' . $_GET['file'];
if (strpos(realpath($file), realpath(USERS_DIR . $user)) === 0) { // Security check
$content = file_get_contents($file);
$ext = pathinfo($file, PATHINFO_EXTENSION);
if ($ext == 'txt' || $ext == 'json') {
echo '<h3>Viewing: ' . htmlspecialchars(basename($file)) . '</h3>';
if ($ext == 'txt') {
$fileId = 'source-' . md5($file); // Unique ID for JavaScript
echo '<button onclick="copyToClipboard(\'' . $fileId . '\')">Copy to Clipboard</button> ';
echo '<a href="download.php?user=' . urlencode($user) . '&file=' . urlencode($_GET['file']) . '"><button>Download</button></a>';
if (isset($_SESSION['user']) && $_SESSION['user'] == $user) {
// Load current language metadata
$jsonFile = pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.json';
$language = '';
if (file_exists($jsonFile)) {
$meta = json_decode(file_get_contents($jsonFile), true);
$language = $meta['language'] ?? '';
}
// Edit form
echo '<form method="post">';
echo '<input type="hidden" name="action" value="edit">';
echo '<input type="hidden" name="file" value="' . htmlspecialchars($_GET['file']) . '">';
echo '<label>Content: <textarea name="content" rows="10" style="width:100%">' . htmlspecialchars($content) . '</textarea></label><br>';
echo '<label>Language: <input type="text" name="language" value="' . htmlspecialchars($language) . '"></label><br>';
echo '<button type="submit">Save Changes</button>';
echo '</form>';
}
echo '<pre id="' . $fileId . '">' . htmlspecialchars($content) . '</pre>';
echo '<button onclick="copyToClipboard(\'' . $fileId . '\')">Copy to Clipboard</button> ';
echo '<a href="download.php?user=' . urlencode($user) . '&file=' . urlencode($_GET['file']) . '"><button>Download</button></a>';
// Check for language metadata
$jsonFile = pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.json';
if (file_exists($jsonFile)) {
$meta = json_decode(file_get_contents($jsonFile), true);
echo '<p>Language: ' . htmlspecialchars($meta['language'] ?? 'None') . '</p>';
}
} else {
echo '<pre>' . htmlspecialchars($content) . '</pre>';
}
}
}
}
}
?>
<script>
function copyToClipboard(elementId) {
const el = document.getElementById(elementId);
const text = el.textContent || el.innerText;
navigator.clipboard.writeText(text).then(() => {
alert('Copied to clipboard!');
}).catch(err => {
alert('Failed to copy: ' + err);
});
}
</script>
<?php include 'footer.php'; ?>