Do not do any logging if it's disabled

This commit is contained in:
Mark Schouten 2016-08-05 12:20:19 +02:00
parent a91d91baa4
commit 3fd525748f
3 changed files with 19 additions and 3 deletions

View file

@ -3,10 +3,10 @@
$apipass = ''; # The PowerDNS API-key
$apiip = ''; # The IP of the PowerDNS API
$apiport = '8081'; # The port of the PowerDNS API
$apisid = 'localhost'; # PowerDNS's :server_id
$apiproto = 'http'; # http | https
$apisslverify = FALSE; # Verify SSL Certificate if using https for apiproto
$allowzoneadd = FALSE; # Allow normal users to add zones
$logging = TRUE;
# If you configure this, nsedit will try to authenticate via WeFact too.
@ -41,8 +41,8 @@ $templates[] = array(
$defaults['soa_edit'] = 'INCEPTION-INCREMENT';
$defaults['soa_edit_api'] = 'INCEPTION-INCREMENT';
$defaults['defaulttype'] = 'Master'; # Choose between 'Native' or 'Master'
$defaults['ns'][0] = 'unconfigured.primaryns'; # The value of the first NS-record
$defaults['ns'][1] = 'unconfigured.secondaryns'; # The value of the second NS-record
$defaults['ns'][0] = 'unconfigured.primaryns.'; # The value of the first NS-record
$defaults['ns'][1] = 'unconfigured.secondaryns.'; # The value of the second NS-record
$defaults['ttl'] = 3600; # Default TTL for records
$defaults['disabled'] = false; # Default disabled state

View file

@ -252,6 +252,10 @@ function user_template_names() {
}
function getlogs() {
global $logging;
if ($logging !== TRUE)
return;
$db = get_db();
$r = $db->query('SELECT * FROM logs ORDER BY timestamp DESC');
$ret = array();
@ -263,6 +267,10 @@ function getlogs() {
}
function clearlogs() {
global $logging;
if ($logging !== TRUE)
return;
$db = get_db();
$q = $db->query('DELETE FROM logs;');
$db->close();
@ -270,6 +278,10 @@ function clearlogs() {
}
function writelog($line) {
global $logging;
if ($logging !== TRUE)
return;
try {
$db = get_db();
$q = $db->prepare('CREATE TABLE IF NOT EXISTS logs (

View file

@ -23,6 +23,10 @@ if (!isset($_GET['action'])) {
switch ($_GET['action']) {
case "list":
global $logging;
if ($logging !== TRUE)
jtable_respond(null, 'error', 'Logging is disabled');
jtable_respond(getlogs());
break;