Execute pihole through wrapper

All different exec() calls basically just calls sudo pihole,
with various different syntaxes. Using a wrapper function
allows sanitization of arguments for better safety.

Signed-off-by: Samu Voutilainen <smar@smar.fi>
This commit is contained in:
Samu Voutilainen
2020-01-25 11:19:23 +02:00
parent ae13014565
commit 39ec67829b
8 changed files with 99 additions and 47 deletions

View File

@@ -86,7 +86,8 @@ switch($list) {
// Reload lists in pihole-FTL after having added something
if ($reload) {
echo shell_exec("sudo pihole restartdns reload-lists");
$output = pihole_execute("restartdns reload-lists");
echo implode("\n", $output);
}
?>