Changed line endings

- Also changed return to die
This commit is contained in:
Mcat12
2016-01-17 17:07:49 -05:00
parent 8f150e634e
commit 84d11b570e
6 changed files with 301 additions and 301 deletions
+17 -17
View File
@@ -1,18 +1,18 @@
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Pi-hole Version</b> 2.1
</div>
<i class="fa fa-github"></i> <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=3J2L3Z4DHW9UY">Donate</a></strong> if you found this useful.
</footer>
</div>
<!-- ./wrapper -->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"></script>
<script src="./js/app.min.js" type="text/javascript"></script>
</body>
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<footer class="main-footer">
<div class="pull-right hidden-xs">
<b>Pi-hole Version</b> 2.1
</div>
<i class="fa fa-github"></i> <strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=3J2L3Z4DHW9UY">Donate</a></strong> if you found this useful.
</footer>
</div>
<!-- ./wrapper -->
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"></script>
<script src="./js/app.min.js" type="text/javascript"></script>
</body>
</html>
+134 -134
View File
@@ -1,135 +1,135 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Pi-hole Admin Console</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="./css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="./css/skin-blue.min.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="img/pihole-160x160.jpg" />
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="http://pi-hole.net" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>P</b>H</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>Pi</b>-hole</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="./img/pihole-160x160.jpg" class="user-image" alt="Pi-hole logo" />
<span class="hidden-xs">Pi-hole</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="./img/pihole-160x160.jpg" alt="User Image" />
<p>
Open Source Ad Blocker
<small>Designed For Raspberry Pi</small>
</p>
</li>
<!-- Menu Body -->
<li class="user-body">
<div class="col-xs-4 text-center">
<a href="https://github.com/jacobsalmela/pi-hole">Free</a>
</div>
<div class="col-xs-4 text-center">
<a href="http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0/">Details</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Updates</a>
</div>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="3J2L3Z4DHW9UY">
<input style="display: block; margin: 0 auto;" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
<div style="text-align:center">
<a class="coinbase-button" data-code="c851bab4454421aa35bc789526207381" data-button-style="donation_small" href="https://www.coinbase.com/checkouts/c851bab4454421aa35bc789526207381">Donate Bitcoins</a><script src="https://www.coinbase.com/assets/button.js" type="text/javascript"></script>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="./img/pihole-160x160.jpg" class="img-circle" alt="Pi-hole logo" />
</div>
<div class="pull-left info">
<p>Status</p>
<a href="#"><i class="fa fa-circle text-success"></i> Nominal</a>
</div>
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<!-- Home Page -->
<li>
<a href="index.php">
<i class="fa fa-home"></i> <span>Main Page</span>
</a>
</li>
<!-- Donate -->
<li>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY">
<i class="fa fa-paypal"></i> <span>Donate</span>
</a>
</li>
<!-- Whitelist -->
<li>
<a href="list.php?l=white">
<i class="fa fa-pencil-square-o"></i> <span>Whitelist</span>
</a>
</li>
<!-- Blacklist -->
<li>
<a href="list.php?l=black">
<i class="fa fa-pencil-square-o"></i> <span>Blacklist</span>
</a>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Pi-hole Admin Console</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="./css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="./css/skin-blue.min.css" rel="stylesheet" type="text/css" />
<link rel="icon" type="image/png" href="img/pihole-160x160.jpg" />
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="skin-blue sidebar-mini">
<div class="wrapper">
<header class="main-header">
<!-- Logo -->
<a href="http://pi-hole.net" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>P</b>H</span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>Pi</b>-hole</span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<img src="./img/pihole-160x160.jpg" class="user-image" alt="Pi-hole logo" />
<span class="hidden-xs">Pi-hole</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="./img/pihole-160x160.jpg" alt="User Image" />
<p>
Open Source Ad Blocker
<small>Designed For Raspberry Pi</small>
</p>
</li>
<!-- Menu Body -->
<li class="user-body">
<div class="col-xs-4 text-center">
<a href="https://github.com/jacobsalmela/pi-hole">Free</a>
</div>
<div class="col-xs-4 text-center">
<a href="http://jacobsalmela.com/block-millions-ads-network-wide-with-a-raspberry-pi-hole-2-0/">Details</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Updates</a>
</div>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="3J2L3Z4DHW9UY">
<input style="display: block; margin: 0 auto;" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
<div style="text-align:center">
<a class="coinbase-button" data-code="c851bab4454421aa35bc789526207381" data-button-style="donation_small" href="https://www.coinbase.com/checkouts/c851bab4454421aa35bc789526207381">Donate Bitcoins</a><script src="https://www.coinbase.com/assets/button.js" type="text/javascript"></script>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="./img/pihole-160x160.jpg" class="img-circle" alt="Pi-hole logo" />
</div>
<div class="pull-left info">
<p>Status</p>
<a href="#"><i class="fa fa-circle text-success"></i> Nominal</a>
</div>
</div>
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<!-- Home Page -->
<li>
<a href="index.php">
<i class="fa fa-home"></i> <span>Main Page</span>
</a>
</li>
<!-- Donate -->
<li>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3J2L3Z4DHW9UY">
<i class="fa fa-paypal"></i> <span>Donate</span>
</a>
</li>
<!-- Whitelist -->
<li>
<a href="list.php?l=white">
<i class="fa fa-pencil-square-o"></i> <span>Whitelist</span>
</a>
</li>
<!-- Blacklist -->
<li>
<a href="list.php?l=black">
<i class="fa fa-pencil-square-o"></i> <span>Blacklist</span>
</a>
</li>
</ul>
</section>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<section class="content">
+114 -114
View File
@@ -1,114 +1,114 @@
<?php
require "header.html";
$list = $_GET['l'];
function getFullName() {
global $list;
if($list == "white")
echo "Whitelist";
else
echo "Blacklist";
}
?>
<!-- Title -->
<div class="page-header">
<h1><?php getFullName(); ?></h1>
</div>
<!-- Domain Input -->
<div class="form-group input-group">
<input id="domain" type="text" class="form-control" placeholder="Add a domain (example.com or sub.example.com)">
<span class="input-group-btn">
<button class="btn btn-default" type="button" onclick="add()">Add</button>
<button class="btn btn-default" type="button" onclick="refresh()">Refresh</button>
</span>
</div>
<!-- Alerts -->
<div id="alInfo" class="alert alert-info" role="alert" hidden="true">
Adding to the <?php getFullName(); ?>...
</div>
<div id="alSuccess" class="alert alert-success" role="alert" hidden="true">
Success! It will probably take 2-10 minutes until the changes take effect. The list will refresh.
</div>
<div id="alFailure" class="alert alert-danger" role="alert" hidden="true">
Failure! Something went wrong.
</div>
<!-- Domain List -->
<ul class="list-group" id="list"></ul>
<?php
require "footer.html";
?>
<script>
window.onload = refresh;
function refresh() {
$.ajax({
url: "php/get.php",
method: "get",
data: {"list":"<?php echo $list ?>"},
success: function(response) {
var list = document.getElementById("list");
list.innerHTML = "";
var data = JSON.parse(response);
if(data.length == 0) {
list.innerHTML =
'<div class="alert alert-info" role="alert">Your <?php getFullName(); ?> is empty!</div>';
}
else {
data.forEach(function (entry) {
list.innerHTML +=
'<li id="' + entry + '" class="list-group-item clearfix">' + entry +
'<button class="btn btn-danger btn-xs pull-right" type="button" onclick="sub(\'' + entry + '\')">' +
'<span class="glyphicon glyphicon-trash"></span></button></li>';
})
}
},
error: function(jqXHR, exception) {
document.getElementById("alFailure").hidden = false;
}
});
}
function add() {
var domain = document.getElementById("domain").value;
if(domain == "")
return;
document.getElementById("alInfo").hidden = false;
document.getElementById("alSuccess").hidden = true;
document.getElementById("alFailure").hidden = true;
$.ajax({
url: "php/add.php",
method: "get",
data: {"domain":domain, "list":"<?php echo $list ?>"},
success: function(response) {
document.getElementById("alSuccess").hidden = false;
refresh();
},
error: function(jqXHR, exception) {
document.getElementById("alFailure").hidden = false;
}
});
}
function sub(entry) {
$.ajax({
url: "php/sub.php",
method: "get",
data: {"domain":entry, "list":"<?php echo $list ?>"},
success: function(response) {
document.getElementById("list").removeChild(document.getElementById(entry));
},
error: function(jqXHR, exception) {
alert("Failed to remove the domain!");
}
});
}
</script>
<?php
require "header.html";
$list = $_GET['l'];
function getFullName() {
global $list;
if($list == "white")
echo "Whitelist";
else
echo "Blacklist";
}
?>
<!-- Title -->
<div class="page-header">
<h1><?php getFullName(); ?></h1>
</div>
<!-- Domain Input -->
<div class="form-group input-group">
<input id="domain" type="text" class="form-control" placeholder="Add a domain (example.com or sub.example.com)">
<span class="input-group-btn">
<button class="btn btn-default" type="button" onclick="add()">Add</button>
<button class="btn btn-default" type="button" onclick="refresh()">Refresh</button>
</span>
</div>
<!-- Alerts -->
<div id="alInfo" class="alert alert-info" role="alert" hidden="true">
Adding to the <?php getFullName(); ?>...
</div>
<div id="alSuccess" class="alert alert-success" role="alert" hidden="true">
Success! It will probably take 2-10 minutes until the changes take effect. The list will refresh.
</div>
<div id="alFailure" class="alert alert-danger" role="alert" hidden="true">
Failure! Something went wrong.
</div>
<!-- Domain List -->
<ul class="list-group" id="list"></ul>
<?php
require "footer.html";
?>
<script>
window.onload = refresh;
function refresh() {
$.ajax({
url: "php/get.php",
method: "get",
data: {"list":"<?php echo $list ?>"},
success: function(response) {
var list = document.getElementById("list");
list.innerHTML = "";
var data = JSON.parse(response);
if(data.length == 0) {
list.innerHTML =
'<div class="alert alert-info" role="alert">Your <?php getFullName(); ?> is empty!</div>';
}
else {
data.forEach(function (entry) {
list.innerHTML +=
'<li id="' + entry + '" class="list-group-item clearfix">' + entry +
'<button class="btn btn-danger btn-xs pull-right" type="button" onclick="sub(\'' + entry + '\')">' +
'<span class="glyphicon glyphicon-trash"></span></button></li>';
})
}
},
error: function(jqXHR, exception) {
document.getElementById("alFailure").hidden = false;
}
});
}
function add() {
var domain = document.getElementById("domain").value;
if(domain == "")
return;
document.getElementById("alInfo").hidden = false;
document.getElementById("alSuccess").hidden = true;
document.getElementById("alFailure").hidden = true;
$.ajax({
url: "php/add.php",
method: "get",
data: {"domain":domain, "list":"<?php echo $list ?>"},
success: function(response) {
document.getElementById("alSuccess").hidden = false;
refresh();
},
error: function(jqXHR, exception) {
document.getElementById("alFailure").hidden = false;
}
});
}
function sub(entry) {
$.ajax({
url: "php/sub.php",
method: "get",
data: {"domain":entry, "list":"<?php echo $list ?>"},
success: function(response) {
document.getElementById("list").removeChild(document.getElementById(entry));
},
error: function(jqXHR, exception) {
alert("Failed to remove the domain!");
}
});
}
</script>
+11 -11
View File
@@ -1,12 +1,12 @@
<?php
if(!isset($_GET['domain'], $_GET['list']))
return;
switch($_GET['list']) {
case "white":
exec("/usr/local/bin/whitelist.sh -q ${_GET['domain']}");
break;
case "black":
exec("/usr/local/bin/blacklist.sh -q ${_GET['domain']}");
break;
<?php
if(!isset($_GET['domain'], $_GET['list']))
die();
switch($_GET['list']) {
case "white":
exec("/usr/local/bin/whitelist.sh -q ${_GET['domain']}");
break;
case "black":
exec("/usr/local/bin/blacklist.sh -q ${_GET['domain']}");
break;
}
+14 -14
View File
@@ -1,15 +1,15 @@
<?php
if(!isset($_GET['list']))
die();
$type = $_GET['list'];
$rawList = file_get_contents("/etc/pihole/${type}list.txt");
$list = explode("\n", $rawList);
// Get rid of empty lines
for($i = sizeof($list)-1; $i >= 0; $i--) {
if($list[$i] == "")
unset($list[$i]);
}
<?php
if(!isset($_GET['list']))
die();
$type = $_GET['list'];
$rawList = file_get_contents("/etc/pihole/${type}list.txt");
$list = explode("\n", $rawList);
// Get rid of empty lines
for($i = sizeof($list)-1; $i >= 0; $i--) {
if($list[$i] == "")
unset($list[$i]);
}
echo json_encode(array_values($list));
+11 -11
View File
@@ -1,12 +1,12 @@
<?php
if(!isset($_GET['domain'], $_GET['list']))
return;
switch($_GET['list']) {
case "white":
exec("/usr/local/bin/whitelist.sh -q -d ${_GET['domain']}");
break;
case "black":
exec("/usr/local/bin/blacklist.sh -q -d ${_GET['domain']}");
break;
<?php
if(!isset($_GET['domain'], $_GET['list']))
die();
switch($_GET['list']) {
case "white":
exec("/usr/local/bin/whitelist.sh -q -d ${_GET['domain']}");
break;
case "black":
exec("/usr/local/bin/blacklist.sh -q -d ${_GET['domain']}");
break;
}