1
0
Fork 0
This repository has been archived on 2025-04-14. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
sockchat-docs-renderer/src.php
2025-04-14 02:57:52 +02:00

19 lines
No EOL
513 B
PHP

<?php
$file = !empty($_GET['f']) && is_string($_GET['f']) && ctype_print($_GET['f']) ? trim(str_replace('..', '', (string)$_GET['f']), '/') : '';
$allowedPaths = [
'index.php',
'parsedown.php',
'src.php',
];
$maskStrings = [
];
if(empty($file) || !isset($_GET['f']))
$file = $allowedPaths[0];
if(in_array($file, $allowedPaths, true)) {
$file = file_get_contents($file);
foreach($maskStrings as $string)
$file = str_replace($string, '*****', $file);
highlight_string($file);
}