The Brown Hats Software Depot: F' Around & Find Out!

Login | Register (Invite Only)

pagetelegram's Profile

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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@@@@@@@-    #@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@=    #@@@@@@@@@@@@@@%    -@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@.   .@@@@@@@@@@@@@@@@.   .@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@    -@@@@%##***#%@@@@+    %@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@*    %@#:..       .:+@%    *@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@=    =.               :    -@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@:                          .@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@.                          .@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@.       .=%@@@@@@@+:       .@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@#      .%@@@@@@@@@@@@@-      -@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@#     .*@@@@@@@@@@@@@@@@%:     -@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@%.    .@@@@@@*%@@@@%#@@@@@@=     *@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@.    :@@@@@@@@:-@@*.%@@@@@@@+     %@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@+    :@@@@@@@@@@---.@@@@@@@@@@=    :@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@.    @@@@@@@@@@@.   @@@@@@@@@@@:    #@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@=    #@@@+--#@@@@    #@@@@%#@@@@@.   .@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@.   :@%-     .%@@-  .@@@*.   .+@@=    #@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@#    *+.       .@@@#*@@@=       .#@    -@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@-   .#          =@@-.@@%.         +=   .@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@.   -@.          @@. %@:          #%    %@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@.   #@-          +%  =%          .@@.   *@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@%    %@%          :+  .+          +@@.   =@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@#    @@@:         .:  .-         .@@@:   -@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@*   .@@@%         #   .#         =@@@:   :@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@*   .@@@@=       -@    @-       .@@@@:   :@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@#    @@@@@.     .@@    @@.      %@@@@:   -@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@%    %@@@@@:   :@@@    @@@.   .*@@@@@.   =@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@.   #@@@@@@#+#@@@@    @@@@=.:%@@@@@@.   *@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@.   :@@@@@@-..:*@@    @@#-..:%@@@@@#    %@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@-   .@@@@@:     .@    @.     .@@@@@-   .@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@#    *@@@%       @.  .@       *@@@@    -@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@.   .@@@+       @-  .@.      -@@@=    #@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@+    +@@%.     .@*  :@-     .*@@%.   .@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@.    %@@@-    *@%  #@%.   :%@@@.    %@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@*    .@@@@%=-+@@@. @@@*--#@@@@-    -@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@:    .@@@@@@@@@@*=@@@@@@@@@@:     @@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@.    .%@@@@@@@@@@@@@@@@@@@-    .#@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@%.     +@@@@@@@@@@@@@@@@#.     +@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@%.     .+@@@@@@@@@@@@%:      +@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@%.       -*%@@@@@#=.      .*@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@:                      .%@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@#.                   +@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@+.              .=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@=.        .-%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%%###%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Repositories

Viewing: functions.php.txt

<?php
session_start();

define('DATA_DIR', __DIR__ . '/data/');
define('USERS_DIR', __DIR__ . '/users/');

if (!file_exists(DATA_DIR)) mkdir(DATA_DIR, 0777, true);
if (!file_exists(USERS_DIR)) mkdir(USERS_DIR, 0777, true);

function getUsers() {
    $file = DATA_DIR . 'users.json';
    if (!file_exists($file)) {
        // Initial user
        $users = [
            'pagetelegram' => [
                'password' => password_hash('Nbc1Abc2!', PASSWORD_DEFAULT),
                'title' => '',
                'description' => '',
                'ascii_art' => ''
            ]
        ];
        file_put_contents($file, json_encode($users));
        return $users;
    }
    return json_decode(file_get_contents($file), true);
}

function saveUsers($users) {
    file_put_contents(DATA_DIR . 'users.json', json_encode($users));
}

function getInvites() {
    $file = DATA_DIR . 'invites.json';
    if (!file_exists($file)) return [];
    return json_decode(file_get_contents($file), true);
}

function saveInvites($invites) {
    file_put_contents(DATA_DIR . 'invites.json', json_encode($invites));
}

function imageToAscii($filePath, $width = 80) {
    $ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
    if ($ext == 'jpg' || $ext == 'jpeg') {
        $im = imagecreatefromjpeg($filePath);
    } elseif ($ext == 'png') {
        $im = imagecreatefrompng($filePath);
    } elseif ($ext == 'gif') {
        $im = imagecreatefromgif($filePath);
    } else {
        return 'Unsupported image format';
    }

    $origWidth = imagesx($im);
    $origHeight = imagesy($im);
    $height = (int) (($origHeight / $origWidth) * $width);
    $im = imagescale($im, $width, $height);

    $chars = '@%#*+=-:. '; // Dark to light
    $ascii = '';
    for ($y = 0; $y < $height; $y++) {
        for ($x = 0; $x < $width; $x++) {
            $rgb = imagecolorat($im, $x, $y);
            $r = ($rgb >> 16) & 0xFF;
            $g = ($rgb >> 8) & 0xFF;
            $b = $rgb & 0xFF;
            $gray = (int) (($r + $g + $b) / 3);
            $index = (int) (9 - ($gray / 28.3)); // 255/9 ≈ 28.3
            $ascii .= $chars[$index];
        }
        $ascii .= "\n";
    }
    imagedestroy($im);
    unlink($filePath); // Delete original image
    return $ascii;
}

function listDirectory($dir, $baseUser, $currentPath = '') {
    $result = '';
    $files = scandir($dir);
    foreach ($files as $file) {
        if ($file != '.' && $file != '..') {
            $ext = pathinfo($file, PATHINFO_EXTENSION);
            if ($ext === 'json') continue; // Skip JSON files
            $relPath = $currentPath . $file;
            if (is_dir($dir . '/' . $file)) {
                $result .= '<li><a href="view_repo.php?user=' . urlencode($baseUser) . '&path=' . urlencode($relPath . '/') . '">' . htmlspecialchars($file) . '/</a>';
                if (isset($_SESSION['user']) && $_SESSION['user'] != $baseUser && $currentPath == '') { // Fork only top-level projects
                    $result .= ' <form method="post" style="display:inline;"><input type="hidden" name="action" value="fork"><input type="hidden" name="project" value="' . htmlspecialchars($file) . '"><input type="text" name="new_name" placeholder="New name" required><button type="submit">Fork</button></form>';
                }
                $result .= '</li>';
            } else {
                $result .= '<li>' . htmlspecialchars($file) . ' <a href="view_repo.php?user=' . urlencode($baseUser) . '&file=' . urlencode($relPath) . '">View</a></li>';
            }
        }
    }
    return '<ul>' . $result . '</ul>';
}

function copyDir($src, $dst) {
    if (!file_exists($dst)) mkdir($dst, 0777, true);
    $dir = opendir($src);
    while (false !== ($file = readdir($dir))) {
        if (($file != '.') && ($file != '..')) {
            if (is_dir($src . '/' . $file)) {
                copyDir($src . '/' . $file, $dst . '/' . $file);
            } else {
                copy($src . '/' . $file, $dst . '/' . $file);
            }
        }
    }
    closedir($dir);
}
?>