Merge branch 'devel' into restructureFolders

This commit is contained in:
Mcat12
2016-12-30 14:44:26 -05:00
3 changed files with 37 additions and 14 deletions
+4 -7
View File
@@ -1,15 +1,12 @@
<?php
require('auth.php');
if(!isset($_POST['domain'], $_POST['list'], $_POST['token'])) {
log_and_die("Missing POST variables");
}
$type = $_POST['list'];
check_cors();
check_csrf($_POST['token']);
check_domain();
// All of the verification for list editing
list_verify($type);
switch($_POST['list']) {
switch($type) {
case "white":
echo exec("sudo pihole -w -q ${_POST['domain']}");
break;
+29
View File
@@ -105,4 +105,33 @@ function check_domain() {
}
}
}
function list_verify($type) {
if(!isset($_POST['domain']) || !isset($_POST['list']) || !(isset($_POST['pw']) || isset($_POST['token']))) {
log_and_die("Missing POST variables");
}
if(isset($_POST['token']))
{
check_cors();
check_csrf($_POST['token']);
}
elseif(isset($_POST['pw']))
{
require("password.php");
if(strlen($pwhash) == 0)
{
log_and_die("No password set - ${type}listing with password not supported");
}
elseif($wrongpassword)
{
log_and_die("Wrong password - ${type}listing of ${_POST['domain']} not permitted");
}
}
else
{
log_and_die("Not allowed!");
}
check_domain();
}
?>
+4 -7
View File
@@ -1,15 +1,12 @@
<?php
require('auth.php');
if(!isset($_POST['domain'], $_POST['list'], $_POST['token'])) {
log_and_die("Missing POST variables");
}
$type = $_POST['list'];
check_cors();
check_csrf($_POST['token']);
check_domain();
// All of the verification for list editing
list_verify($type);
switch($_POST['list']) {
switch($type) {
case "white":
exec("sudo pihole -w -q -d ${_POST['domain']}");
break;