@@ -5,95 +5,95 @@ |
||
5 | 5 | ***************************/ |
6 | 6 | |
7 | 7 | /* functions */ |
8 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
8 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | |
10 | 10 | # initialize user object |
11 | -$Database = new Database_PDO; |
|
12 | -$User = new User ($Database); |
|
11 | +$Database = new Database_PDO; |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Admin = new Admin ($Database); |
14 | 14 | $Result = new Result (); |
15 | -$PowerDNS = new PowerDNS ($Database); |
|
15 | +$PowerDNS = new PowerDNS ($Database); |
|
16 | 16 | |
17 | 17 | # verify that user is logged in |
18 | -$User->check_user_session(); |
|
18 | +$User->check_user_session (); |
|
19 | 19 | |
20 | 20 | # strip input tags |
21 | -$_POST = $Admin->strip_input_tags($_POST); |
|
21 | +$_POST = $Admin->strip_input_tags ($_POST); |
|
22 | 22 | |
23 | 23 | # validate csrf cookie |
24 | -$User->csrf_cookie ("validate", "domain", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
24 | +$User->csrf_cookie ("validate", "domain", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
25 | 25 | |
26 | 26 | |
27 | 27 | # checks / validation |
28 | -if ($_POST['action']!="delete") { |
|
28 | +if ($_POST['action'] != "delete") { |
|
29 | 29 | // fqdn |
30 | - if ($_POST['action']=="add") |
|
31 | - if($Result->validate_hostname($_POST['name'])===false) { $Result->show("danger", "Invalid domain name", true); } |
|
30 | + if ($_POST['action'] == "add") |
|
31 | + if ($Result->validate_hostname ($_POST['name']) === false) { $Result->show ("danger", "Invalid domain name", true); } |
|
32 | 32 | // master |
33 | - if (strlen($_POST['master'])>0) { |
|
33 | + if (strlen ($_POST['master']) > 0) { |
|
34 | 34 | // if multilpe masters |
35 | - if (strpos($_POST['master'], ",")!==false) { |
|
35 | + if (strpos ($_POST['master'], ",") !== false) { |
|
36 | 36 | // to array and trim, check each |
37 | - $masters = array_filter(explode(",", $_POST['master'])); |
|
37 | + $masters = array_filter (explode (",", $_POST['master'])); |
|
38 | 38 | foreach ($masters as $m) { |
39 | - if(!filter_var($m, FILTER_VALIDATE_IP)) { $Result->show("danger", "Master must be an IP address". " - ". $m, true); } |
|
39 | + if (!filter_var ($m, FILTER_VALIDATE_IP)) { $Result->show ("danger", "Master must be an IP address"." - ".$m, true); } |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | else { |
43 | - if(!filter_var($_POST['master'], FILTER_VALIDATE_IP)) { $Result->show("danger", "Master must be an IP address". " - ". $_POST['master'], true); } |
|
43 | + if (!filter_var ($_POST['master'], FILTER_VALIDATE_IP)) { $Result->show ("danger", "Master must be an IP address"." - ".$_POST['master'], true); } |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | // type |
47 | - if(!in_array($_POST['type'], (array )$PowerDNS->domain_types)) { $Result->show("danger", "Invalid domain type", true); } |
|
47 | + if (!in_array ($_POST['type'], (array) $PowerDNS->domain_types)) { $Result->show ("danger", "Invalid domain type", true); } |
|
48 | 48 | |
49 | 49 | # new domain |
50 | - if ($_POST['action']=="add" && !isset($_POST['manual'])) { |
|
50 | + if ($_POST['action'] == "add" && !isset($_POST['manual'])) { |
|
51 | 51 | // admin |
52 | - if ($Result->validate_email($_POST['hostmaster'])===false) { $Result->show("danger", "Invalid domain admin", true); } |
|
52 | + if ($Result->validate_email ($_POST['hostmaster']) === false) { $Result->show ("danger", "Invalid domain admin", true); } |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // if slave master must be present |
56 | - if ($_POST['type']=="SLAVE") { |
|
57 | - if (strlen($_POST['master'])==0) { $Result->show("danger", "Please set master server(s) if domain type is SLAVE", true); } |
|
56 | + if ($_POST['type'] == "SLAVE") { |
|
57 | + if (strlen ($_POST['master']) == 0) { $Result->show ("danger", "Please set master server(s) if domain type is SLAVE", true); } |
|
58 | 58 | else { |
59 | - if (strpos($_POST['master'], ",")!==false) { |
|
59 | + if (strpos ($_POST['master'], ",") !== false) { |
|
60 | 60 | // to array and trim, check each |
61 | - $masters = array_filter(explode(",", $_POST['master'])); |
|
61 | + $masters = array_filter (explode (",", $_POST['master'])); |
|
62 | 62 | foreach ($masters as $m) { |
63 | - if(!filter_var($m, FILTER_VALIDATE_IP)) { $Result->show("danger", "Master must be an IP address". " - ". $m, true); } |
|
63 | + if (!filter_var ($m, FILTER_VALIDATE_IP)) { $Result->show ("danger", "Master must be an IP address"." - ".$m, true); } |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | else { |
67 | - if(!filter_var($_POST['master'], FILTER_VALIDATE_IP)) { $Result->show("danger", "Master must be an IP address". " - ". $_POST['master'], true); } |
|
67 | + if (!filter_var ($_POST['master'], FILTER_VALIDATE_IP)) { $Result->show ("danger", "Master must be an IP address"." - ".$_POST['master'], true); } |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | # if update sve old domain ! |
74 | - if ($_POST['action']=="edit") { |
|
74 | + if ($_POST['action'] == "edit") { |
|
75 | 75 | $old_domain = $PowerDNS->fetch_domain ($_POST['id']); |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | # set update array |
80 | -$values = array("id"=>@$_POST['id'], |
|
80 | +$values = array ("id"=>@$_POST['id'], |
|
81 | 81 | "master"=>@$_POST['master'], |
82 | 82 | "type"=>@$_POST['type'] |
83 | 83 | ); |
84 | 84 | # name only on add |
85 | -if ($_POST['action']=="add") |
|
85 | +if ($_POST['action'] == "add") |
|
86 | 86 | $values['name'] = $_POST['name']; |
87 | 87 | |
88 | 88 | |
89 | 89 | # remove all references if delete |
90 | -if ($_POST['action']=="delete") { $PowerDNS->remove_all_records ($values['id']); } |
|
90 | +if ($_POST['action'] == "delete") { $PowerDNS->remove_all_records ($values['id']); } |
|
91 | 91 | |
92 | 92 | |
93 | 93 | # update |
94 | -if(!$PowerDNS->domain_edit($_POST['action'], $values)) { $Result->show("danger", _("Failed to $_POST[action] domain").'!', true); } |
|
95 | -else { $Result->show("success", _("Domain $_POST[action] successfull").'!', false); } |
|
94 | +if (!$PowerDNS->domain_edit ($_POST['action'], $values)) { $Result->show ("danger", _ ("Failed to $_POST[action] domain").'!', true); } |
|
95 | +else { $Result->show ("success", _ ("Domain $_POST[action] successfull").'!', false); } |
|
96 | 96 | |
97 | 97 | # create default records |
98 | -if ($_POST['action']=="add" && !isset($_POST['manual'])) { $PowerDNS->create_default_records ($_POST); } |
|
98 | +if ($_POST['action'] == "add" && !isset($_POST['manual'])) { $PowerDNS->create_default_records ($_POST); } |
|
99 | 99 | ?> |
100 | 100 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | *************************************************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # fetch domains |
11 | 11 | $type = $_GET['subnetId']; |
@@ -14,22 +14,22 @@ discard block |
||
14 | 14 | switch ($type) { |
15 | 15 | // fetch forward domains |
16 | 16 | case 'domains': |
17 | - $title = _("Domains"); |
|
17 | + $title = _ ("Domains"); |
|
18 | 18 | $domains = $PowerDNS->fetch_all_forward_domains (); |
19 | 19 | break; |
20 | 20 | // fetch v4 reverse domains |
21 | 21 | case 'reverse_v4': |
22 | - $title = _("IPv4 reverse domains"); |
|
22 | + $title = _ ("IPv4 reverse domains"); |
|
23 | 23 | $domains = $PowerDNS->fetch_reverse_v4_domains (); |
24 | 24 | break; |
25 | 25 | // fetch v6 reverse domains |
26 | 26 | case 'reverse_v6': |
27 | - $title = _("IPv6 reverse domains"); |
|
27 | + $title = _ ("IPv6 reverse domains"); |
|
28 | 28 | $domains = $PowerDNS->fetch_reverse_v6_domains (); |
29 | 29 | break; |
30 | 30 | // error |
31 | 31 | default: |
32 | - $Result->show("danger", "Invalid request", true); |
|
32 | + $Result->show ("danger", "Invalid request", true); |
|
33 | 33 | break; |
34 | 34 | } |
35 | 35 | ?> |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | |
40 | 40 | <!-- Back --> |
41 | 41 | <div class="btn-group" style="margin-bottom:10px;margin-top: 10px;"> |
42 | - <button class='btn btn-sm btn-default btn-success editDomain' data-action='add' data-id='0'><i class='fa fa-plus'></i> <?php print _('Create domain'); ?></button> |
|
42 | + <button class='btn btn-sm btn-default btn-success editDomain' data-action='add' data-id='0'><i class='fa fa-plus'></i> <?php print _ ('Create domain'); ?></button> |
|
43 | 43 | </div> |
44 | 44 | <br> |
45 | 45 | |
46 | 46 | |
47 | 47 | <?php |
48 | 48 | // none |
49 | -if($domains===false) { $Result->show("info alert-absolute", _("No domains configured"), false); } |
|
49 | +if ($domains === false) { $Result->show ("info alert-absolute", _ ("No domains configured"), false); } |
|
50 | 50 | else { |
51 | 51 | |
52 | 52 | ?> |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | <thead id="headers"> |
59 | 59 | <tr> |
60 | 60 | <th style="width:80px;"></th> |
61 | - <th><?php print _('Domain'); ?></th> |
|
62 | - <th><?php print _('Type'); ?></th> |
|
63 | - <th><?php print _('Master NS'); ?></th> |
|
64 | - <th><?php print _('Records'); ?></th> |
|
65 | - <th><?php print _('Serial number'); ?></th> |
|
61 | + <th><?php print _ ('Domain'); ?></th> |
|
62 | + <th><?php print _ ('Type'); ?></th> |
|
63 | + <th><?php print _ ('Master NS'); ?></th> |
|
64 | + <th><?php print _ ('Records'); ?></th> |
|
65 | + <th><?php print _ ('Serial number'); ?></th> |
|
66 | 66 | </tr> |
67 | 67 | </thead> |
68 | 68 | |
@@ -72,14 +72,14 @@ discard block |
||
72 | 72 | /* prints domain records */ |
73 | 73 | foreach ($domains as $d) { |
74 | 74 | // nulls |
75 | - foreach($d as $k=>$v) { |
|
76 | - if (strlen($v)==0) $d->$k = "<span class='muted'>/</span>"; |
|
75 | + foreach ($d as $k=>$v) { |
|
76 | + if (strlen ($v) == 0) $d->$k = "<span class='muted'>/</span>"; |
|
77 | 77 | } |
78 | 78 | // cont records |
79 | 79 | $cnt = $PowerDNS->count_domain_records ($d->id); |
80 | 80 | // get SOA record |
81 | 81 | $soa = $PowerDNS->fetch_domain_records_by_type ($d->id, "SOA"); |
82 | - $serial = explode(" ", $soa[0]->content); |
|
82 | + $serial = explode (" ", $soa[0]->content); |
|
83 | 83 | $serial = $serial[2]; |
84 | 84 | |
85 | 85 | print "<tr>"; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | print " </td>"; |
93 | 93 | |
94 | 94 | // content |
95 | - print " <td><a href='".create_link("administration", "powerDNS", $_GET['subnetId'], "records", $d->name)."'>$d->name</a></td>"; |
|
95 | + print " <td><a href='".create_link ("administration", "powerDNS", $_GET['subnetId'], "records", $d->name)."'>$d->name</a></td>"; |
|
96 | 96 | print " <td><span class='badge badge1'>$d->type</span></td>"; |
97 | 97 | print " <td>$d->master</td>"; |
98 | 98 | print " <td><span class='badge'>$cnt</span></td>"; |
@@ -6,29 +6,29 @@ discard block |
||
6 | 6 | *************************************************/ |
7 | 7 | |
8 | 8 | # verify that user is logged in |
9 | -$User->check_user_session(); |
|
9 | +$User->check_user_session (); |
|
10 | 10 | ?> |
11 | 11 | |
12 | 12 | <!-- display existing groups --> |
13 | -<h4><?php print _('PowerDNS management'); ?></h4> |
|
13 | +<h4><?php print _ ('PowerDNS management'); ?></h4> |
|
14 | 14 | <hr><br> |
15 | 15 | |
16 | -<?php if($User->settings->enablePowerDNS==1) { ?> |
|
16 | +<?php if ($User->settings->enablePowerDNS == 1) { ?> |
|
17 | 17 | |
18 | 18 | <?php |
19 | 19 | # powerDNS class |
20 | 20 | $PowerDNS = new PowerDNS ($Database); |
21 | 21 | |
22 | 22 | // check connection |
23 | -$test = $PowerDNS->db_check(); |
|
23 | +$test = $PowerDNS->db_check (); |
|
24 | 24 | // save settings for powerDNS default |
25 | 25 | $pdns = $PowerDNS->db_settings; |
26 | 26 | |
27 | 27 | // check if TTL is set |
28 | -if ($test!==false) { |
|
29 | - $test_ttl = json_decode($User->settings->powerDNS); |
|
30 | - if ($test_ttl->ttl==NULL) { |
|
31 | - $Result->show("warning", "Please set <a href='".create_link("administration", "powerDNS", "defaults")."'>default powerDNS values</a>!", false); |
|
28 | +if ($test !== false) { |
|
29 | + $test_ttl = json_decode ($User->settings->powerDNS); |
|
30 | + if ($test_ttl->ttl == NULL) { |
|
31 | + $Result->show ("warning", "Please set <a href='".create_link ("administration", "powerDNS", "defaults")."'>default powerDNS values</a>!", false); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -37,22 +37,22 @@ discard block |
||
37 | 37 | <ul class="nav nav-tabs"> |
38 | 38 | <?php |
39 | 39 | // tabs |
40 | - $tabs = array("domains", "host_records", "reverse_v4", "reverse_v6", "settings", "defaults"); |
|
40 | + $tabs = array ("domains", "host_records", "reverse_v4", "reverse_v6", "settings", "defaults"); |
|
41 | 41 | |
42 | 42 | // default tab |
43 | - if(!isset($_GET['subnetId'])) { |
|
44 | - if(!$test) { $_GET['subnetId'] = "settings"; } |
|
45 | - else { $_GET['subnetId'] = "domains"; } |
|
43 | + if (!isset($_GET['subnetId'])) { |
|
44 | + if (!$test) { $_GET['subnetId'] = "settings"; } |
|
45 | + else { $_GET['subnetId'] = "domains"; } |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // check |
49 | - if(!in_array($_GET['subnetId'], $tabs)) { $Result->show("danger", "Invalid request", true); } |
|
49 | + if (!in_array ($_GET['subnetId'], $tabs)) { $Result->show ("danger", "Invalid request", true); } |
|
50 | 50 | |
51 | 51 | |
52 | - foreach($tabs as $t) { |
|
53 | - $title = str_replace('_', ' ', $t); |
|
54 | - $class = $_GET['subnetId']==$t ? "class='active'" : ""; |
|
55 | - print "<li role='presentation' $class><a href=".create_link("administration", "powerDNS", "$t").">". _(ucwords($title))."</a></li>"; |
|
52 | + foreach ($tabs as $t) { |
|
53 | + $title = str_replace ('_', ' ', $t); |
|
54 | + $class = $_GET['subnetId'] == $t ? "class='active'" : ""; |
|
55 | + print "<li role='presentation' $class><a href=".create_link ("administration", "powerDNS", "$t").">"._ (ucwords ($title))."</a></li>"; |
|
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </ul> |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | <?php |
62 | 62 | // include content |
63 | 63 | $pdns_section = $_GET['subnetId']; |
64 | -if (preg_match("/reverse_/", $pdns_section)) { |
|
64 | +if (preg_match ("/reverse_/", $pdns_section)) { |
|
65 | 65 | $filename = 'domains.php'; |
66 | 66 | } else { |
67 | 67 | $filename = "$_GET[subnetId].php"; |
68 | 68 | } |
69 | 69 | |
70 | 70 | // include file |
71 | -if(!file_exists(dirname(__FILE__) . '/'.$filename)) { $Result->show("danger", "Invalid request", true); } |
|
72 | -else { include(dirname(__FILE__) . '/'.$filename); } |
|
71 | +if (!file_exists (dirname (__FILE__).'/'.$filename)) { $Result->show ("danger", "Invalid request", true); } |
|
72 | +else { include(dirname (__FILE__).'/'.$filename); } |
|
73 | 73 | ?> |
74 | 74 | </div> |
75 | 75 | |
76 | 76 | <?php |
77 | 77 | } else { |
78 | - $Result->show("info", _('Please enable powerDNS module under server management'), false); |
|
78 | + $Result->show ("info", _ ('Please enable powerDNS module under server management'), false); |
|
79 | 79 | } |
80 | 80 | ?> |
81 | 81 | </div> |
82 | 82 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | *************************************************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # create csrf token |
11 | 11 | $csrf = $User->csrf_cookie ("create", "pdns_settings"); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | |
31 | 31 | <!-- site settings --> |
32 | 32 | <tr class="settings-title"> |
33 | - <th colspan="3"><h4><?php print _('Database settings'); ?></h4><hr></th> |
|
33 | + <th colspan="3"><h4><?php print _ ('Database settings'); ?></h4><hr></th> |
|
34 | 34 | </tr> |
35 | 35 | |
36 | 36 | <!-- host --> |
37 | 37 | <tr> |
38 | - <td><?php print _('Host'); ?></th> |
|
38 | + <td><?php print _ ('Host'); ?></th> |
|
39 | 39 | <td style="width:300px;"> |
40 | 40 | <input type="text" class="form-control input-sm" name="host" value="<?php print $pdns->host; ?>"> |
41 | 41 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
@@ -43,44 +43,44 @@ discard block |
||
43 | 43 | </tr> |
44 | 44 | <!-- db --> |
45 | 45 | <tr> |
46 | - <td><?php print _('Database'); ?></th> |
|
46 | + <td><?php print _ ('Database'); ?></th> |
|
47 | 47 | <td> |
48 | 48 | <input type="text" class="form-control input-sm" name="name" value="<?php print $pdns->name; ?>"> |
49 | 49 | </td> |
50 | 50 | </tr> |
51 | 51 | <!-- user --> |
52 | 52 | <tr> |
53 | - <td><?php print _('Username'); ?></th> |
|
53 | + <td><?php print _ ('Username'); ?></th> |
|
54 | 54 | <td> |
55 | 55 | <input type="text" class="form-control input-sm" name="username" value="<?php print $pdns->username; ?>"> |
56 | 56 | </td> |
57 | 57 | </tr> |
58 | 58 | <!-- pass --> |
59 | 59 | <tr> |
60 | - <td><?php print _('Password'); ?></th> |
|
60 | + <td><?php print _ ('Password'); ?></th> |
|
61 | 61 | <td> |
62 | 62 | <input type="password" class="form-control input-sm" name="password" value="<?php print $pdns->password; ?>"> |
63 | 63 | </td> |
64 | 64 | </tr> |
65 | 65 | <!-- port --> |
66 | 66 | <tr> |
67 | - <td><?php print _('Port'); ?></th> |
|
67 | + <td><?php print _ ('Port'); ?></th> |
|
68 | 68 | <td> |
69 | 69 | <input type="text" class="form-control input-sm" name="port" value="<?php print $pdns->port; ?>"> |
70 | 70 | </td> |
71 | 71 | </tr> |
72 | 72 | <!-- autoserial --> |
73 | 73 | <tr> |
74 | - <td><?php print _('Autoserial'); ?></th> |
|
74 | + <td><?php print _ ('Autoserial'); ?></th> |
|
75 | 75 | <td> |
76 | - <input type="checkbox" class="input-switch" value="Yes" name="autoserial" <?php if(@$pdns->autoserial == "Yes") print 'checked'; ?>> |
|
76 | + <input type="checkbox" class="input-switch" value="Yes" name="autoserial" <?php if (@$pdns->autoserial == "Yes") print 'checked'; ?>> |
|
77 | 77 | </td> |
78 | 78 | </tr> |
79 | 79 | <!-- submit --> |
80 | 80 | <tr> |
81 | 81 | <td></td> |
82 | 82 | <td style="text-align: right"> |
83 | - <input type="submit" class="btn btn-default btn-sm" value="<?php print _("Save"); ?>"> |
|
83 | + <input type="submit" class="btn btn-default btn-sm" value="<?php print _ ("Save"); ?>"> |
|
84 | 84 | </td> |
85 | 85 | </tr> |
86 | 86 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | <!-- check --> |
95 | 95 | <div class="check" style="height:60px;"> |
96 | 96 | <?php |
97 | - if ($test==false) { $Result->show("danger alert-absolute", "Failed to connect to database:<hr> ".$PowerDNS->error); } |
|
98 | - else { $Result->show("success alert-absolute", "Database connection ok"); } |
|
97 | + if ($test == false) { $Result->show ("danger alert-absolute", "Failed to connect to database:<hr> ".$PowerDNS->error); } |
|
98 | + else { $Result->show ("success alert-absolute", "Database connection ok"); } |
|
99 | 99 | ?> |
100 | 100 | </div> |
101 | 101 | \ No newline at end of file |
@@ -5,56 +5,56 @@ |
||
5 | 5 | ***************************/ |
6 | 6 | |
7 | 7 | /* functions */ |
8 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
8 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | |
10 | 10 | # initialize user object |
11 | -$Database = new Database_PDO; |
|
12 | -$User = new User ($Database); |
|
11 | +$Database = new Database_PDO; |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Admin = new Admin ($Database, false); |
14 | 14 | $Result = new Result (); |
15 | -$PowerDNS = new PowerDNS ($Database); |
|
15 | +$PowerDNS = new PowerDNS ($Database); |
|
16 | 16 | |
17 | 17 | # verify that user is logged in |
18 | -$User->check_user_session(); |
|
18 | +$User->check_user_session (); |
|
19 | 19 | |
20 | 20 | # strip input tags |
21 | -$_POST = $Admin->strip_input_tags($_POST); |
|
21 | +$_POST = $Admin->strip_input_tags ($_POST); |
|
22 | 22 | |
23 | 23 | # validate csrf cookie |
24 | -$User->csrf_cookie ("validate", "record", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
24 | +$User->csrf_cookie ("validate", "record", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
25 | 25 | |
26 | 26 | # fetch old record |
27 | -if($_POST['action']!="add") { |
|
27 | +if ($_POST['action'] != "add") { |
|
28 | 28 | $record = $PowerDNS->fetch_record ($_POST['id']); |
29 | - $record!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
29 | + $record !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | # edit and add - check that smth is in name and content! |
33 | -if ($_POST['action']!="delete") { |
|
34 | - if (strlen($_POST['name'])<2) { $Result->show ("danger", _("Invalid name"), true); } |
|
35 | - if (strlen($_POST['content'])<2) { $Result->show ("danger", _("Invalid content"), true); } |
|
33 | +if ($_POST['action'] != "delete") { |
|
34 | + if (strlen ($_POST['name']) < 2) { $Result->show ("danger", _ ("Invalid name"), true); } |
|
35 | + if (strlen ($_POST['content']) < 2) { $Result->show ("danger", _ ("Invalid content"), true); } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
39 | 39 | # validate and set values |
40 | -if($_POST['action']=="edit") { |
|
40 | +if ($_POST['action'] == "edit") { |
|
41 | 41 | $values = $PowerDNS->formulate_update_record ($_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled'], $record->change_date); |
42 | 42 | $values['domain_id'] = $_POST['domain_id']; |
43 | 43 | } |
44 | -elseif($_POST['action']=="add") { |
|
44 | +elseif ($_POST['action'] == "add") { |
|
45 | 45 | $values = $PowerDNS->formulate_new_record ($_POST['domain_id'], $_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled']); |
46 | 46 | } |
47 | -elseif($_POST['action']=="delete") { |
|
47 | +elseif ($_POST['action'] == "delete") { |
|
48 | 48 | $values['domain_id'] = $_POST['domain_id']; |
49 | 49 | } |
50 | 50 | |
51 | 51 | # add id |
52 | -$values['id'] = @$_POST['id']; |
|
52 | +$values['id'] = @$_POST['id']; |
|
53 | 53 | |
54 | 54 | # remove empty records |
55 | 55 | $values = $PowerDNS->remove_empty_array_fields ($values); |
56 | 56 | |
57 | 57 | # update |
58 | -$PowerDNS->record_edit($_POST['action'], $values); |
|
58 | +$PowerDNS->record_edit ($_POST['action'], $values); |
|
59 | 59 | |
60 | 60 | ?> |
61 | 61 | \ No newline at end of file |
@@ -5,24 +5,24 @@ discard block |
||
5 | 5 | **************************/ |
6 | 6 | |
7 | 7 | /* functions */ |
8 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
8 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | |
10 | 10 | # initialize user object |
11 | -$Database = new Database_PDO; |
|
12 | -$User = new User ($Database); |
|
11 | +$Database = new Database_PDO; |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Admin = new Admin ($Database); |
14 | 14 | $Result = new Result (); |
15 | 15 | |
16 | 16 | # verify that user is logged in |
17 | -$User->check_user_session(); |
|
17 | +$User->check_user_session (); |
|
18 | 18 | |
19 | 19 | # validate csrf cookie |
20 | -$User->csrf_cookie ("validate", "pdns_settings", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
20 | +$User->csrf_cookie ("validate", "pdns_settings", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
21 | 21 | |
22 | 22 | // validations |
23 | -if(strlen($_POST['name'])==0) { $Result->show("danger", "Invalid database name", true); } |
|
24 | -if(strlen($_POST['port'])==0) { $_POST['port'] = 3306; } |
|
25 | -elseif (!is_numeric($_POST['port'])) { $Result->show("danger", "Invalid port number", true); } |
|
23 | +if (strlen ($_POST['name']) == 0) { $Result->show ("danger", "Invalid database name", true); } |
|
24 | +if (strlen ($_POST['port']) == 0) { $_POST['port'] = 3306; } |
|
25 | +elseif (!is_numeric ($_POST['port'])) { $Result->show ("danger", "Invalid port number", true); } |
|
26 | 26 | |
27 | 27 | // formulate json |
28 | 28 | $values = new StdClass (); |
@@ -35,30 +35,30 @@ discard block |
||
35 | 35 | $values->autoserial = isset($_POST['autoserial']) ? "Yes" : "No"; |
36 | 36 | |
37 | 37 | // get old settings for defaults |
38 | -$old_values = json_decode($User->settings->powerDNS); |
|
38 | +$old_values = json_decode ($User->settings->powerDNS); |
|
39 | 39 | |
40 | -$values->ns = $old_values->ns; |
|
41 | -$values->hostmaster = $old_values->hostmaster; |
|
42 | -$values->def_ptr_domain = $old_values->def_ptr_domain; |
|
43 | -$values->refresh = $old_values->refresh; |
|
40 | +$values->ns = $old_values->ns; |
|
41 | +$values->hostmaster = $old_values->hostmaster; |
|
42 | +$values->def_ptr_domain = $old_values->def_ptr_domain; |
|
43 | +$values->refresh = $old_values->refresh; |
|
44 | 44 | $values->retry = $old_values->retry; |
45 | 45 | $values->expire = $old_values->expire; |
46 | 46 | $values->nxdomain_ttl = $old_values->nxdomain_ttl; |
47 | -$values->ttl = $old_values->ttl; |
|
47 | +$values->ttl = $old_values->ttl; |
|
48 | 48 | |
49 | 49 | # set update values |
50 | -$values_new = array("id"=>1, |
|
51 | - "powerDNS"=>json_encode($values), |
|
50 | +$values_new = array ("id"=>1, |
|
51 | + "powerDNS"=>json_encode ($values), |
|
52 | 52 | ); |
53 | -if(!$Admin->object_modify("settings", "edit", "id", $values_new)) { $Result->show("danger", _("Cannot update settings"), false); } |
|
54 | -else { $Result->show("success", _("Settings updated successfully"), false); } |
|
53 | +if (!$Admin->object_modify ("settings", "edit", "id", $values_new)) { $Result->show ("danger", _ ("Cannot update settings"), false); } |
|
54 | +else { $Result->show ("success", _ ("Settings updated successfully"), false); } |
|
55 | 55 | |
56 | 56 | # autoserial change - set default SOA for all records ! |
57 | -if ($values->autoserial!==@$old_values->autoserial) { |
|
57 | +if ($values->autoserial !== @$old_values->autoserial) { |
|
58 | 58 | // start class |
59 | - $PowerDNS = new PowerDNS ($Database); |
|
59 | + $PowerDNS = new PowerDNS ($Database); |
|
60 | 60 | // check connection |
61 | - if($PowerDNS->db_check()!==false) { |
|
61 | + if ($PowerDNS->db_check () !== false) { |
|
62 | 62 | // update all serials |
63 | 63 | $PowerDNS->update_all_soa_serials ($values->autoserial); |
64 | 64 | } |
@@ -5,28 +5,28 @@ discard block |
||
5 | 5 | **************************/ |
6 | 6 | |
7 | 7 | /* functions */ |
8 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
8 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | |
10 | 10 | # initialize user object |
11 | -$Database = new Database_PDO; |
|
12 | -$User = new User ($Database); |
|
11 | +$Database = new Database_PDO; |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Admin = new Admin ($Database); |
14 | 14 | $Result = new Result (); |
15 | 15 | |
16 | 16 | # verify that user is logged in |
17 | -$User->check_user_session(); |
|
17 | +$User->check_user_session (); |
|
18 | 18 | |
19 | 19 | # validate csrf cookie |
20 | -$User->csrf_cookie ("validate", "pdns_defaults", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
20 | +$User->csrf_cookie ("validate", "pdns_defaults", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
21 | 21 | |
22 | 22 | // validations |
23 | -if(strlen($_POST['ttl'])==0) { $_POST['ttl'] = $PowerDNS->defaults->ttl; } |
|
23 | +if (strlen ($_POST['ttl']) == 0) { $_POST['ttl'] = $PowerDNS->defaults->ttl; } |
|
24 | 24 | |
25 | 25 | // formulate json |
26 | 26 | $values = new StdClass (); |
27 | 27 | |
28 | 28 | // get old settings for defaults |
29 | -$old_values = json_decode($User->settings->powerDNS); |
|
29 | +$old_values = json_decode ($User->settings->powerDNS); |
|
30 | 30 | |
31 | 31 | $values->host = $old_values->host; |
32 | 32 | $values->name = $old_values->name; |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | $values->autoserial = @$old_values->autoserial; |
37 | 37 | |
38 | 38 | // defaults |
39 | -$values->ns = $_POST['ns']; |
|
39 | +$values->ns = $_POST['ns']; |
|
40 | 40 | $values->hostmaster = $_POST['hostmaster']; |
41 | 41 | $values->def_ptr_domain = $_POST['def_ptr_domain']; |
42 | -$values->refresh = $_POST['refresh']; |
|
42 | +$values->refresh = $_POST['refresh']; |
|
43 | 43 | $values->retry = $_POST['retry']; |
44 | 44 | $values->expire = $_POST['expire']; |
45 | 45 | $values->nxdomain_ttl = $_POST['nxdomain_ttl']; |
46 | -$values->ttl = $_POST['ttl']; |
|
46 | +$values->ttl = $_POST['ttl']; |
|
47 | 47 | |
48 | 48 | # set update values |
49 | -$values = array("id"=>1, |
|
50 | - "powerDNS"=>json_encode($values), |
|
49 | +$values = array ("id"=>1, |
|
50 | + "powerDNS"=>json_encode ($values), |
|
51 | 51 | ); |
52 | -if(!$Admin->object_modify("settings", "edit", "id", $values)) { $Result->show("danger", _("Cannot update settings"), true); } |
|
53 | -else { $Result->show("success", _("Settings updated successfully"), true); } |
|
52 | +if (!$Admin->object_modify ("settings", "edit", "id", $values)) { $Result->show ("danger", _ ("Cannot update settings"), true); } |
|
53 | +else { $Result->show ("success", _ ("Settings updated successfully"), true); } |
|
54 | 54 | ?> |
55 | 55 | \ No newline at end of file |
@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | ************************************************/ |
6 | 6 | |
7 | 7 | /* functions */ |
8 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
8 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | |
10 | 10 | # initialize user object |
11 | -$Database = new Database_PDO; |
|
12 | -$User = new User ($Database); |
|
11 | +$Database = new Database_PDO; |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Admin = new Admin ($Database, false); |
14 | 14 | $Tools = new Tools ($Database); |
15 | 15 | $Result = new Result (); |
16 | -$PowerDNS = new PowerDNS ($Database); |
|
16 | +$PowerDNS = new PowerDNS ($Database); |
|
17 | 17 | |
18 | 18 | # verify that user is logged in |
19 | -$User->check_user_session(); |
|
19 | +$User->check_user_session (); |
|
20 | 20 | |
21 | 21 | # create csrf token |
22 | 22 | $csrf = $User->csrf_cookie ("create", "record"); |
@@ -28,42 +28,42 @@ discard block |
||
28 | 28 | $post = $_POST; |
29 | 29 | |
30 | 30 | # get record |
31 | -if($_POST['action']!="add") { |
|
31 | +if ($_POST['action'] != "add") { |
|
32 | 32 | $record = $PowerDNS->fetch_record ($_POST['id']); |
33 | - $record!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
33 | + $record !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true); |
|
34 | 34 | } |
35 | 35 | # new record |
36 | 36 | else { |
37 | 37 | // from IP table |
38 | 38 | // we provide record hostname and strip domain from it |
39 | - if (!is_numeric($_POST['domain_id']) && !is_numeric($_POST['id'])) { |
|
39 | + if (!is_numeric ($_POST['domain_id']) && !is_numeric ($_POST['id'])) { |
|
40 | 40 | // fetch all domains |
41 | 41 | $all_domains = $PowerDNS->fetch_all_domains (); |
42 | - if ($all_domains!==false) { |
|
43 | - foreach($all_domains as $dk=>$domain_s) { |
|
42 | + if ($all_domains !== false) { |
|
43 | + foreach ($all_domains as $dk=>$domain_s) { |
|
44 | 44 | // loop through and find all matches |
45 | - if (strpos($_POST['domain_id'],$domain_s->name) !== false) { |
|
45 | + if (strpos ($_POST['domain_id'], $domain_s->name) !== false) { |
|
46 | 46 | // check best match to avoid for example a.example.net.nz1 added to example.net.nz |
47 | - if (substr($_POST['domain_id'], -strlen($domain_s->name)) === $domain_s->name) { |
|
47 | + if (substr ($_POST['domain_id'], -strlen ($domain_s->name)) === $domain_s->name) { |
|
48 | 48 | $matches[$dk] = $domain_s; |
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
52 | 52 | // match found ? |
53 | 53 | if (isset($matches)) { |
54 | - foreach($matches as $k=>$m){ |
|
55 | - $length = strlen($m->name); |
|
56 | - if($length > $max){ $max = $length; $element_id = $k; } |
|
54 | + foreach ($matches as $k=>$m) { |
|
55 | + $length = strlen ($m->name); |
|
56 | + if ($length > $max) { $max = $length; $element_id = $k; } |
|
57 | 57 | } |
58 | 58 | // save longest match id |
59 | 59 | $_POST['domain_id'] = $all_domains[$element_id]->id; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | // die if not existing |
63 | - if (!is_numeric($_POST['domain_id'])) { |
|
63 | + if (!is_numeric ($_POST['domain_id'])) { |
|
64 | 64 | # admin? |
65 | - if ($User->is_admin()) { $Result->show("danger", _("Domain")." <strong>".$_POST['domain_id']."</strong><span class='ip_dns_addr hidden'>".$_POST['id']."</span> "._("does not exist")."!"."<hr><button class='btn btn-sm btn-default editDomain2 editDomain' data-action='add' data-id='0'><i class='fa fa-plus'></i> "._('Create domain')."</button>", true, true); } |
|
66 | - else { $Result->show("danger", _("Domain")." <strong>".$_POST['domain_id']."</strong> "._("does not exist")."!", true, true); } |
|
65 | + if ($User->is_admin ()) { $Result->show ("danger", _ ("Domain")." <strong>".$_POST['domain_id']."</strong><span class='ip_dns_addr hidden'>".$_POST['id']."</span> "._ ("does not exist")."!"."<hr><button class='btn btn-sm btn-default editDomain2 editDomain' data-action='add' data-id='0'><i class='fa fa-plus'></i> "._ ('Create domain')."</button>", true, true); } |
|
66 | + else { $Result->show ("danger", _ ("Domain")." <strong>".$_POST['domain_id']."</strong> "._ ("does not exist")."!", true, true); } |
|
67 | 67 | } |
68 | 68 | else { |
69 | 69 | $record = new StdClass (); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | // get domain |
78 | 78 | $domain = $PowerDNS->fetch_domain ($_POST['domain_id']); |
79 | -$domain!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
79 | +$domain !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true); |
|
80 | 80 | |
81 | 81 | // default |
82 | 82 | if (!isset($record)) { |
@@ -86,17 +86,17 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | // if IPv6 automaticall add AAAA record! |
89 | -if ($User->identify_address($record->content)=="IPv6") { |
|
89 | +if ($User->identify_address ($record->content) == "IPv6") { |
|
90 | 90 | $record->type = "AAAA"; |
91 | 91 | } |
92 | 92 | |
93 | 93 | # disable edit on delete |
94 | -$readonly = $_POST['action']=="delete" ? "readonly" : ""; |
|
94 | +$readonly = $_POST['action'] == "delete" ? "readonly" : ""; |
|
95 | 95 | ?> |
96 | 96 | |
97 | 97 | |
98 | 98 | <!-- header --> |
99 | -<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('DNS record'); ?> <?php print _('for domain'); ?> <strong><?php print $domain->name; ?></strong></div> |
|
99 | +<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('DNS record'); ?> <?php print _ ('for domain'); ?> <strong><?php print $domain->name; ?></strong></div> |
|
100 | 100 | |
101 | 101 | <!-- content --> |
102 | 102 | <div class="pContent"> |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | <!-- name --> |
108 | 108 | <tr> |
109 | - <td style="width:150px;"><?php print _('Name'); ?></td> |
|
109 | + <td style="width:150px;"><?php print _ ('Name'); ?></td> |
|
110 | 110 | <td> |
111 | - <input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _('www.example.com'); ?>" value="<?php print $record->name; ?>" <?php print $readonly; ?>> |
|
111 | + <input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _ ('www.example.com'); ?>" value="<?php print $record->name; ?>" <?php print $readonly; ?>> |
|
112 | 112 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
113 | 113 | <input type="hidden" name="id" value="<?php print @$_POST['id']; ?>"> |
114 | 114 | <input type="hidden" name="domain_id" value="<?php print @$_POST['domain_id']; ?>"> |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | |
119 | 119 | <!-- type --> |
120 | 120 | <tr> |
121 | - <td><?php print _('Record type'); ?></td> |
|
121 | + <td><?php print _ ('Record type'); ?></td> |
|
122 | 122 | <td> |
123 | 123 | <select name="type" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
124 | 124 | <?php |
125 | 125 | // loop |
126 | - foreach($PowerDNS->record_types as $type) { |
|
126 | + foreach ($PowerDNS->record_types as $type) { |
|
127 | 127 | // active |
128 | - if ($type == @$record->type) { $selected = "selected"; } |
|
129 | - else { $selected = ""; } |
|
128 | + if ($type == @$record->type) { $selected = "selected"; } |
|
129 | + else { $selected = ""; } |
|
130 | 130 | |
131 | 131 | print "<option value='$type' $selected>$type</option>"; |
132 | 132 | } |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | |
138 | 138 | <!-- Content --> |
139 | 139 | <tr> |
140 | - <td><?php print _('Content'); ?></td> |
|
140 | + <td><?php print _ ('Content'); ?></td> |
|
141 | 141 | <td> |
142 | - <input type="text" class="name form-control input-sm" name="content" placeholder="<?php print _('10.10.10.1'); ?>" value="<?php print $record->content; ?>" <?php print $readonly; ?>> |
|
142 | + <input type="text" class="name form-control input-sm" name="content" placeholder="<?php print _ ('10.10.10.1'); ?>" value="<?php print $record->content; ?>" <?php print $readonly; ?>> |
|
143 | 143 | |
144 | 144 | </td> |
145 | 145 | </tr> |
146 | 146 | |
147 | 147 | <!-- TTL --> |
148 | 148 | <tr> |
149 | - <td><?php print _('TTL'); ?></td> |
|
149 | + <td><?php print _ ('TTL'); ?></td> |
|
150 | 150 | <td> |
151 | 151 | <select name="ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
152 | 152 | <?php |
153 | 153 | // loop |
154 | - foreach($PowerDNS->ttl as $k=>$type) { |
|
154 | + foreach ($PowerDNS->ttl as $k=>$type) { |
|
155 | 155 | // active |
156 | - if ($k == @$record->ttl) { $selected = "selected"; } |
|
157 | - else { $selected = ""; } |
|
156 | + if ($k == @$record->ttl) { $selected = "selected"; } |
|
157 | + else { $selected = ""; } |
|
158 | 158 | |
159 | 159 | print "<option value='$k' $selected>$type</option>"; |
160 | 160 | } |
@@ -165,20 +165,20 @@ discard block |
||
165 | 165 | |
166 | 166 | <!-- Prio --> |
167 | 167 | <tr> |
168 | - <td><?php print _('Priority'); ?></td> |
|
168 | + <td><?php print _ ('Priority'); ?></td> |
|
169 | 169 | <td> |
170 | - <input type="text" class="name form-control input-sm input-w-100" name="prio" placeholder="<?php print _('Priority'); ?>" value="<?php print $record->prio; ?>" <?php print $readonly; ?>> |
|
170 | + <input type="text" class="name form-control input-sm input-w-100" name="prio" placeholder="<?php print _ ('Priority'); ?>" value="<?php print $record->prio; ?>" <?php print $readonly; ?>> |
|
171 | 171 | |
172 | 172 | </td> |
173 | 173 | </tr> |
174 | 174 | |
175 | 175 | <!-- Disabled --> |
176 | 176 | <tr> |
177 | - <td><?php print _('Disabled'); ?></td> |
|
177 | + <td><?php print _ ('Disabled'); ?></td> |
|
178 | 178 | <td> |
179 | 179 | <select name="disabled" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
180 | - <option value="0"><?php print _('No'); ?></option> |
|
181 | - <option value="1" <?php if($record->disabled==1) print "selected='selected'"; ?>><?php print _('Yes'); ?></option> |
|
180 | + <option value="0"><?php print _ ('No'); ?></option> |
|
181 | + <option value="1" <?php if ($record->disabled == 1) print "selected='selected'"; ?>><?php print _ ('Yes'); ?></option> |
|
182 | 182 | </select> |
183 | 183 | </td> |
184 | 184 | </tr> |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | <!-- footer --> |
193 | 193 | <div class="pFooter"> |
194 | 194 | <div class="btn-group"> |
195 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
196 | - <?php if($_POST['action']!=="delete" && isset($record->id)) { ?> |
|
197 | - <button class="btn btn-sm btn-default btn-danger" id="editRecordSubmitDelete"><i class="fa fa-trash-o"></i> <?php print _("Delete"); ?></button> |
|
195 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
196 | + <?php if ($_POST['action'] !== "delete" && isset($record->id)) { ?> |
|
197 | + <button class="btn btn-sm btn-default btn-danger" id="editRecordSubmitDelete"><i class="fa fa-trash-o"></i> <?php print _ ("Delete"); ?></button> |
|
198 | 198 | <?php } ?> |
199 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editRecordSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
199 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editRecordSubmit"><i class="fa <?php if ($_POST['action'] == "add") { print "fa-plus"; } else if ($_POST['action'] == "delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords (_ ($_POST['action'])); ?></button> |
|
200 | 200 | </div> |
201 | 201 | <!-- result --> |
202 | 202 | <div class="record-edit-result"></div> |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | *************************************************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # validate domain |
11 | 11 | $domain = $PowerDNS->fetch_domain ($_GET['ipaddrid']); |
12 | 12 | |
13 | 13 | # validate |
14 | -if ($domain===false) { $Result->show ("danger", _("Invalid domain"), false); } |
|
14 | +if ($domain === false) { $Result->show ("danger", _ ("Invalid domain"), false); } |
|
15 | 15 | else { |
16 | 16 | # set order |
17 | 17 | $PowerDNS->set_query_values (10000, "name,type", " asc"); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if ($records !== false) { |
23 | 23 | foreach ($records as $k=>$r) { |
24 | 24 | // soa, NS |
25 | - if ($r->type=="SOA" || $r->type=="NS") { |
|
25 | + if ($r->type == "SOA" || $r->type == "NS") { |
|
26 | 26 | $records_default[] = $r; |
27 | 27 | unset ($records[$k]); |
28 | 28 | } |
@@ -32,27 +32,27 @@ discard block |
||
32 | 32 | ?> |
33 | 33 | |
34 | 34 | <br> |
35 | -<h4><?php print _('Records for domain'); ?> <strong><?php print $domain->name; ?></strong></h4><hr> |
|
35 | +<h4><?php print _ ('Records for domain'); ?> <strong><?php print $domain->name; ?></strong></h4><hr> |
|
36 | 36 | |
37 | 37 | <!-- domain details --> |
38 | 38 | <blockquote style="margin-left: 30px;margin-top: 10px;"> |
39 | 39 | |
40 | 40 | <table class="table table-pdns-details table-auto table-condensed"> |
41 | 41 | <tr> |
42 | - <td><?php print _("Domain type:"); ?></td> |
|
42 | + <td><?php print _ ("Domain type:"); ?></td> |
|
43 | 43 | <td><span class="badge badge1"><?php print $domain->type; ?></span></td> |
44 | 44 | </tr> |
45 | 45 | <?php |
46 | 46 | # slave check |
47 | - if ($domain->type=="SLAVE") { |
|
47 | + if ($domain->type == "SLAVE") { |
|
48 | 48 | // master servers |
49 | 49 | print "<tr class='text-top'>"; |
50 | - if(strpos($domain->master, ";")!==false) { $master=explode(";", $domain->master); } |
|
51 | - else { $master=array($domain->master); } |
|
52 | - print "<td>"._("Master servers").":</td>"; |
|
50 | + if (strpos ($domain->master, ";") !== false) { $master = explode (";", $domain->master); } |
|
51 | + else { $master = array ($domain->master); } |
|
52 | + print "<td>"._ ("Master servers").":</td>"; |
|
53 | 53 | print "<td>"; |
54 | 54 | foreach ($master as $k=>$m) { |
55 | - if(strlen($m)>0) { |
|
55 | + if (strlen ($m) > 0) { |
|
56 | 56 | print "<span class='badge badge1'>$m</span><br>"; |
57 | 57 | } |
58 | 58 | } |
@@ -60,15 +60,15 @@ discard block |
||
60 | 60 | print "</tr>"; |
61 | 61 | |
62 | 62 | // notified serial |
63 | - $domain->notified_serial = strlen($domain->notified_serial)>0 ? $domain->notified_serial : "/"; |
|
63 | + $domain->notified_serial = strlen ($domain->notified_serial) > 0 ? $domain->notified_serial : "/"; |
|
64 | 64 | print "<tr>"; |
65 | - print " <td>"._("Notified serial:")."</td>"; |
|
65 | + print " <td>"._ ("Notified serial:")."</td>"; |
|
66 | 66 | print " <td>".$domain->notified_serial."</td>"; |
67 | 67 | print "</tr>"; |
68 | 68 | // last check |
69 | - $domain->last_check = strlen($domain->last_check)>0 ? $domain->last_check : "Never"; |
|
69 | + $domain->last_check = strlen ($domain->last_check) > 0 ? $domain->last_check : "Never"; |
|
70 | 70 | print "<tr>"; |
71 | - print " <td>"._("Last check:")."</td>"; |
|
71 | + print " <td>"._ ("Last check:")."</td>"; |
|
72 | 72 | print " <td>".$domain->last_check."</td>"; |
73 | 73 | print "</tr>"; |
74 | 74 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | |
80 | 80 | <!-- Add new --> |
81 | 81 | <div class="btn-group" style="margin-bottom:10px;margin-top:15px;"> |
82 | - <a href="<?php print create_link ("administration", "powerDNS", $_GET['subnetId']); ?>" class='btn btn-sm btn-default'><i class='fa fa-angle-left'></i> <?php print _('Domains'); ?></a> |
|
83 | - <button class='btn btn-sm btn-default btn-success editRecord' data-action='add' data-id='0' data-domain_id='<?php print $domain->id; ?>'><i class='fa fa-plus'></i> <?php print _('New record'); ?></button> |
|
82 | + <a href="<?php print create_link ("administration", "powerDNS", $_GET['subnetId']); ?>" class='btn btn-sm btn-default'><i class='fa fa-angle-left'></i> <?php print _ ('Domains'); ?></a> |
|
83 | + <button class='btn btn-sm btn-default btn-success editRecord' data-action='add' data-id='0' data-domain_id='<?php print $domain->id; ?>'><i class='fa fa-plus'></i> <?php print _ ('New record'); ?></button> |
|
84 | 84 | </div> |
85 | 85 | |
86 | 86 | <?php |
87 | 87 | // none |
88 | -if($records===false) { $Result->show("info", _("Domain has no records"), false); } |
|
88 | +if ($records === false) { $Result->show ("info", _ ("Domain has no records"), false); } |
|
89 | 89 | else { |
90 | 90 | ?> |
91 | 91 | <!-- --> |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | <thead> |
98 | 98 | <tr> |
99 | 99 | <th></th> |
100 | - <th><?php print _('Name'); ?></th> |
|
101 | - <th><?php print _('Type'); ?></th> |
|
102 | - <th><?php print _('Content'); ?></th> |
|
103 | - <th><?php print _('TTL'); ?></th> |
|
104 | - <th><?php print _('Prio'); ?></th> |
|
105 | - <th><?php print _('Last update'); ?></th> |
|
100 | + <th><?php print _ ('Name'); ?></th> |
|
101 | + <th><?php print _ ('Type'); ?></th> |
|
102 | + <th><?php print _ ('Content'); ?></th> |
|
103 | + <th><?php print _ ('TTL'); ?></th> |
|
104 | + <th><?php print _ ('Prio'); ?></th> |
|
105 | + <th><?php print _ ('Last update'); ?></th> |
|
106 | 106 | </tr> |
107 | 107 | </thead> |
108 | 108 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | // function to print record |
113 | 113 | function print_record ($r) { |
114 | 114 | // check if disabled |
115 | - $trclass = $r->disabled=="1" ? 'alert alert-danger':''; |
|
115 | + $trclass = $r->disabled == "1" ? 'alert alert-danger' : ''; |
|
116 | 116 | |
117 | 117 | print "<tr class='$trclass'>"; |
118 | 118 | // actions |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if (isset($records_default)) { |
140 | 140 | |
141 | 141 | print "<tr>"; |
142 | -print " <th colspan='7' style='padding-top:20px;'>"._("SOA, NS records")."</th>"; |
|
142 | +print " <th colspan='7' style='padding-top:20px;'>"._ ("SOA, NS records")."</th>"; |
|
143 | 143 | print "</tr>"; |
144 | 144 | |
145 | 145 | // defaults |
@@ -150,18 +150,18 @@ discard block |
||
150 | 150 | |
151 | 151 | // host records |
152 | 152 | print "<tr>"; |
153 | -print " <th colspan='7' style='padding-top:20px;'>"._("Domain records")."</th>"; |
|
153 | +print " <th colspan='7' style='padding-top:20px;'>"._ ("Domain records")."</th>"; |
|
154 | 154 | print "</tr>"; |
155 | 155 | |
156 | 156 | // defaults |
157 | -if (sizeof($records)>0) { |
|
157 | +if (sizeof ($records) > 0) { |
|
158 | 158 | foreach ($records as $r) { |
159 | 159 | print_record ($r); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | else { |
163 | 163 | print "<tr>"; |
164 | -print " <td colspan='7'><div class='alert alert-info'>"._("No records")."</div></td>"; |
|
164 | +print " <td colspan='7'><div class='alert alert-info'>"._ ("No records")."</div></td>"; |
|
165 | 165 | print "</tr>"; |
166 | 166 | } |
167 | 167 |