mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 01:29:54 -06:00
Merge pull request #2421 from Squidly271/POC/safeeval
Refactor: Protect GUI from fatal PHP errors
This commit is contained in:
@@ -89,6 +89,7 @@ if (count($pages)) {
|
||||
@unlink($nchan_pid);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?= $display['rtl'] ?>lang="<?= strtok($locale, '_') ?: 'en' ?>" class="<?= $themeHelper->getThemeHtmlClass() ?>">
|
||||
@@ -143,16 +144,23 @@ if (count($pages)) {
|
||||
|
||||
<?php require_once "$docroot/webGui/include/DefaultPageLayout/HeadInlineJS.php"; ?>
|
||||
<?php
|
||||
foreach ($buttonPages as $button) {
|
||||
annotate($button['file']);
|
||||
includePageStylesheets($button);
|
||||
eval('?>' . parse_text($button['text']));
|
||||
}
|
||||
foreach ($buttonPages as $button) {
|
||||
annotate($button['file']);
|
||||
includePageStylesheets($button);
|
||||
$evalContent = '?>' . parse_text($button['text']);
|
||||
$evalFile = $button['file'];
|
||||
if ( filter_var($button['Eval']??false, FILTER_VALIDATE_BOOLEAN) ) {
|
||||
eval($evalContent);
|
||||
} else {
|
||||
include "$docroot/webGui/include/DefaultPageLayout/evalContent.php";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($pages as $page) {
|
||||
annotate($page['file']);
|
||||
includePageStylesheets($page);
|
||||
}
|
||||
foreach ($pages as $page) {
|
||||
annotate($page['file']);
|
||||
includePageStylesheets($page);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php include "$docroot/plugins/dynamix.my.servers/include/myservers1.php" ?>
|
||||
@@ -169,4 +177,4 @@ foreach ($pages as $page) {
|
||||
<?php include "$docroot/webGui/include/DefaultPageLayout/ToastSetup.php"; ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user