-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_module.php
More file actions
30 lines (23 loc) · 750 Bytes
/
Copy pathload_module.php
File metadata and controls
30 lines (23 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
header('Content-Type: text/html; charset=utf-8');
require_once("includes/_includes.php");
$module = isset($_GET['module']) ? trim((string) $_GET['module']) : '';
if ($module === '' || !preg_match('/^[a-z0-9_]+$/', $module)) {
http_response_code(400);
echo alert("Invalid module name.", "danger");
exit;
}
$disabledModules = ['encoding'];
if (in_array($module, $disabledModules, true)) {
http_response_code(404);
echo alert("Module is disabled.", "warning");
exit;
}
$modulePath = __DIR__ . "/modules/" . $module . ".php";
if (!is_file($modulePath)) {
http_response_code(404);
echo alert("Module not found: " . htmlspecialchars($module, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'), "warning");
exit;
}
include $modulePath;
?>