33 lines
864 B
PHP
33 lines
864 B
PHP
<?php
|
|
|
|
require __DIR__.'/../src/init.php';
|
|
global $config;
|
|
|
|
\engine\http\RequestHandler::resolveAndDispatch(only_set_project: true);
|
|
|
|
$name = $_REQUEST['name'] ?? '';
|
|
|
|
if (!isDev() || !$name || !is_dir($path = APP_ROOT.'/public/common/js/'.$name)) {
|
|
http_response_code(403);
|
|
exit;
|
|
}
|
|
|
|
header('Content-Type: application/javascript');
|
|
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
header("Pragma: no-cache");
|
|
|
|
$files = scandir($path, SCANDIR_SORT_ASCENDING);
|
|
$first = true;
|
|
foreach ($files as $file) {
|
|
if ($file == '.' || $file == '..')
|
|
continue;
|
|
if (!$first)
|
|
echo "\n";
|
|
else
|
|
$first = false;
|
|
echo "/* $file */\n";
|
|
if (readfile($path.'/'.$file) === false)
|
|
logError(__FILE__.': failed to readfile('.$path.'/'.$file.')');
|
|
}
|