@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | # get VRF |
28 | 28 | if($_POST['action']!="add") { |
29 | - $domain = $PowerDNS->fetch_domain ($_POST['id']); |
|
30 | - $domain!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
29 | + $domain = $PowerDNS->fetch_domain ($_POST['id']); |
|
30 | + $domain!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | # disable edit on delete |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | <td> |
70 | 70 | <select name="type" class="form-control input-w-auto" <?php print $readonly; ?>> |
71 | 71 | <?php |
72 | - // loop |
|
73 | - foreach($PowerDNS->domain_types as $type) { |
|
74 | - // active |
|
75 | - if ($type == @$domain->type) { $selected = "selected"; } |
|
76 | - else { $selected = ""; } |
|
77 | ||
78 | - print "<option value='$type' $selected>$type</option>"; |
|
79 | - } |
|
80 | - ?> |
|
72 | + // loop |
|
73 | + foreach($PowerDNS->domain_types as $type) { |
|
74 | + // active |
|
75 | + if ($type == @$domain->type) { $selected = "selected"; } |
|
76 | + else { $selected = ""; } |
|
77 | ||
78 | + print "<option value='$type' $selected>$type</option>"; |
|
79 | + } |
|
80 | + ?> |
|
81 | 81 | </select> |
82 | 82 | </td> |
83 | 83 | </tr> |
84 | 84 | |
85 | 85 | <?php |
86 | - // we need default parameters only if we create new domain ! |
|
87 | - if($_POST['action']=="add") { |
|
88 | - ?> |
|
86 | + // we need default parameters only if we create new domain ! |
|
87 | + if($_POST['action']=="add") { |
|
88 | + ?> |
|
89 | 89 | |
90 | 90 | <tbody class="defaults"> |
91 | 91 | |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | <td> |
117 | 117 | <select name="ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
118 | 118 | <?php |
119 | - // loop |
|
120 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
121 | - // active |
|
122 | - if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
123 | - else { $selected = ""; } |
|
124 | ||
125 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
126 | - } |
|
127 | - ?> |
|
119 | + // loop |
|
120 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
121 | + // active |
|
122 | + if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
123 | + else { $selected = ""; } |
|
124 | ||
125 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
126 | + } |
|
127 | + ?> |
|
128 | 128 | </select> |
129 | 129 | </td> |
130 | 130 | </tr> |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | <td> |
135 | 135 | <select name="refresh" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
136 | 136 | <?php |
137 | - // loop |
|
138 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
139 | - // active |
|
140 | - if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
141 | - else { $selected = ""; } |
|
142 | ||
143 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
144 | - } |
|
145 | - ?> |
|
137 | + // loop |
|
138 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
139 | + // active |
|
140 | + if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
141 | + else { $selected = ""; } |
|
142 | ||
143 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
144 | + } |
|
145 | + ?> |
|
146 | 146 | </select> |
147 | 147 | </td> |
148 | 148 | </tr> |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | <td> |
153 | 153 | <select name="retry" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
154 | 154 | <?php |
155 | - // loop |
|
156 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
157 | - // active |
|
158 | - if ($k == @$pdns->retry) { $selected = "selected"; } |
|
159 | - else { $selected = ""; } |
|
160 | ||
161 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
162 | - } |
|
163 | - ?> |
|
155 | + // loop |
|
156 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
157 | + // active |
|
158 | + if ($k == @$pdns->retry) { $selected = "selected"; } |
|
159 | + else { $selected = ""; } |
|
160 | ||
161 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
162 | + } |
|
163 | + ?> |
|
164 | 164 | </select> </td> |
165 | 165 | </tr> |
166 | 166 | <!-- ttl --> |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | <td> |
170 | 170 | <select name="nxdomain_ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
171 | 171 | <?php |
172 | - // loop |
|
173 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
174 | - // active |
|
175 | - if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
176 | - else { $selected = ""; } |
|
177 | ||
178 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
179 | - } |
|
180 | - ?> |
|
172 | + // loop |
|
173 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
174 | + // active |
|
175 | + if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
176 | + else { $selected = ""; } |
|
177 | ||
178 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
179 | + } |
|
180 | + ?> |
|
181 | 181 | </select> |
182 | 182 | </td> |
183 | 183 | </tr> |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | </form> |
196 | 196 | |
197 | 197 | <?php |
198 | - //print delete warning |
|
199 | - if($_POST['action'] == "delete") { $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing Domain will also remove all referenced entries!"), false);} |
|
200 | - ?> |
|
198 | + //print delete warning |
|
199 | + if($_POST['action'] == "delete") { $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing Domain will also remove all referenced entries!"), false);} |
|
200 | + ?> |
|
201 | 201 | </div> |
202 | 202 | |
203 | 203 |
@@ -204,8 +204,12 @@ |
||
204 | 204 | <!-- footer --> |
205 | 205 | <div class="pFooter"> |
206 | 206 | <div class="btn-group"> |
207 | - <button class="btn btn-sm btn-default <?php if(@$_POST['secondary']=="true") { print "hidePopup2"; } else { print "hidePopups"; } ?>"><?php print _('Cancel'); ?></button> |
|
208 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?> <?php if(@$_POST['secondary']=="true") { print "editDomainSubmit2"; } ?>" id="editDomainSubmit"><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> |
|
207 | + <button class="btn btn-sm btn-default <?php if(@$_POST['secondary']=="true") { print "hidePopup2"; } |
|
208 | +else { print "hidePopups"; } ?>"><?php print _('Cancel'); ?></button> |
|
209 | + <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } |
|
210 | +else { print "btn-success"; } ?> <?php if(@$_POST['secondary']=="true") { print "editDomainSubmit2"; } ?>" id="editDomainSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } |
|
211 | +else if ($_POST['action']=="delete") { print "fa-trash-o"; } |
|
212 | +else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
209 | 213 | </div> |
210 | 214 | <!-- result --> |
211 | 215 | <div class="domain-edit-result"></div> |
@@ -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); |
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", "domain"); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | $pdns = $PowerDNS->db_settings; |
26 | 26 | |
27 | 27 | # get VRF |
28 | -if($_POST['action']!="add") { |
|
28 | +if ($_POST['action'] != "add") { |
|
29 | 29 | $domain = $PowerDNS->fetch_domain ($_POST['id']); |
30 | - $domain!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
30 | + $domain !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | # disable edit on delete |
34 | -$readonly = $_POST['action']=="delete" ? "readonly" : ""; |
|
34 | +$readonly = $_POST['action'] == "delete" ? "readonly" : ""; |
|
35 | 35 | ?> |
36 | 36 | |
37 | 37 | |
38 | 38 | <!-- header --> |
39 | -<div class="pHeader"><?php print ucwords(_("$_POST[action]")); ?> <?php print _('domain'); ?></div> |
|
39 | +<div class="pHeader"><?php print ucwords (_ ("$_POST[action]")); ?> <?php print _ ('domain'); ?></div> |
|
40 | 40 | |
41 | 41 | <!-- content --> |
42 | 42 | <div class="pContent"> |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | <!-- name --> |
48 | 48 | <tr> |
49 | - <td style="width:150px;"><?php print _('Name'); ?></td> |
|
49 | + <td style="width:150px;"><?php print _ ('Name'); ?></td> |
|
50 | 50 | <td> |
51 | - <input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _('FQDN domain name'); ?>" value="<?php print $domain->name; ?>" <?php print $readonly; ?> <?php if($_POST['action']!="add") { print "disabled='disabled'"; } ?>> |
|
51 | + <input type="text" class="name form-control input-sm" name="name" placeholder="<?php print _ ('FQDN domain name'); ?>" value="<?php print $domain->name; ?>" <?php print $readonly; ?> <?php if ($_POST['action'] != "add") { print "disabled='disabled'"; } ?>> |
|
52 | 52 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
53 | 53 | <input type="hidden" name="id" value="<?php print @$_POST['id']; ?>"> |
54 | 54 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
@@ -57,23 +57,23 @@ discard block |
||
57 | 57 | |
58 | 58 | <!-- master --> |
59 | 59 | <tr> |
60 | - <td><?php print _('Master NS'); ?></td> |
|
60 | + <td><?php print _ ('Master NS'); ?></td> |
|
61 | 61 | <td> |
62 | - <input type="text" class="name form-control input-sm" name="master" placeholder="<?php print _('NULL'); ?>" value="<?php print $domain->master; ?>" <?php print $readonly; ?>> |
|
62 | + <input type="text" class="name form-control input-sm" name="master" placeholder="<?php print _ ('NULL'); ?>" value="<?php print $domain->master; ?>" <?php print $readonly; ?>> |
|
63 | 63 | </td> |
64 | 64 | </tr> |
65 | 65 | |
66 | 66 | <!-- type --> |
67 | 67 | <tr> |
68 | - <td><?php print _('Domain type'); ?></td> |
|
68 | + <td><?php print _ ('Domain type'); ?></td> |
|
69 | 69 | <td> |
70 | 70 | <select name="type" class="form-control input-w-auto" <?php print $readonly; ?>> |
71 | 71 | <?php |
72 | 72 | // loop |
73 | - foreach($PowerDNS->domain_types as $type) { |
|
73 | + foreach ($PowerDNS->domain_types as $type) { |
|
74 | 74 | // active |
75 | - if ($type == @$domain->type) { $selected = "selected"; } |
|
76 | - else { $selected = ""; } |
|
75 | + if ($type == @$domain->type) { $selected = "selected"; } |
|
76 | + else { $selected = ""; } |
|
77 | 77 | |
78 | 78 | print "<option value='$type' $selected>$type</option>"; |
79 | 79 | } |
@@ -84,43 +84,43 @@ discard block |
||
84 | 84 | |
85 | 85 | <?php |
86 | 86 | // we need default parameters only if we create new domain ! |
87 | - if($_POST['action']=="add") { |
|
87 | + if ($_POST['action'] == "add") { |
|
88 | 88 | ?> |
89 | 89 | |
90 | 90 | <tbody class="defaults"> |
91 | 91 | |
92 | 92 | <!-- hr --> |
93 | 93 | <tr> |
94 | - <td colspan="2"><hr><strong><?php print _("Default record values (SOA, NS)"); ?></strong><br><br></td> |
|
94 | + <td colspan="2"><hr><strong><?php print _ ("Default record values (SOA, NS)"); ?></strong><br><br></td> |
|
95 | 95 | </tr> |
96 | 96 | |
97 | 97 | <!-- defualt values for SOA and NS records --> |
98 | 98 | |
99 | 99 | <!-- ns --> |
100 | 100 | <tr> |
101 | - <td><?php print _('Name servers'); ?></th> |
|
101 | + <td><?php print _ ('Name servers'); ?></th> |
|
102 | 102 | <td> |
103 | 103 | <input type="text" class="form-control input-sm" name="ns" value="<?php print $pdns->ns; ?>"> |
104 | 104 | </td> |
105 | 105 | </tr> |
106 | 106 | <!-- mail --> |
107 | 107 | <tr> |
108 | - <td><?php print _('Hostmaster'); ?></th> |
|
108 | + <td><?php print _ ('Hostmaster'); ?></th> |
|
109 | 109 | <td> |
110 | 110 | <input type="text" class="form-control input-sm" name="hostmaster" value="<?php print $pdns->hostmaster; ?>"> |
111 | 111 | </td> |
112 | 112 | </tr> |
113 | 113 | <!-- ttl --> |
114 | 114 | <tr> |
115 | - <td><?php print _('TTL'); ?></th> |
|
115 | + <td><?php print _ ('TTL'); ?></th> |
|
116 | 116 | <td> |
117 | 117 | <select name="ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
118 | 118 | <?php |
119 | 119 | // loop |
120 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
120 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
121 | 121 | // active |
122 | - if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
123 | - else { $selected = ""; } |
|
122 | + if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
123 | + else { $selected = ""; } |
|
124 | 124 | |
125 | 125 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
126 | 126 | } |
@@ -130,15 +130,15 @@ discard block |
||
130 | 130 | </tr> |
131 | 131 | <!-- refresh --> |
132 | 132 | <tr> |
133 | - <td><?php print _('Refresh'); ?></th> |
|
133 | + <td><?php print _ ('Refresh'); ?></th> |
|
134 | 134 | <td> |
135 | 135 | <select name="refresh" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
136 | 136 | <?php |
137 | 137 | // loop |
138 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
138 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
139 | 139 | // active |
140 | - if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
141 | - else { $selected = ""; } |
|
140 | + if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
141 | + else { $selected = ""; } |
|
142 | 142 | |
143 | 143 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
144 | 144 | } |
@@ -148,15 +148,15 @@ discard block |
||
148 | 148 | </tr> |
149 | 149 | <!-- ttl --> |
150 | 150 | <tr> |
151 | - <td><?php print _('Retry'); ?></th> |
|
151 | + <td><?php print _ ('Retry'); ?></th> |
|
152 | 152 | <td> |
153 | 153 | <select name="retry" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
154 | 154 | <?php |
155 | 155 | // loop |
156 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
156 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
157 | 157 | // active |
158 | - if ($k == @$pdns->retry) { $selected = "selected"; } |
|
159 | - else { $selected = ""; } |
|
158 | + if ($k == @$pdns->retry) { $selected = "selected"; } |
|
159 | + else { $selected = ""; } |
|
160 | 160 | |
161 | 161 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
162 | 162 | } |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | </tr> |
166 | 166 | <!-- ttl --> |
167 | 167 | <tr> |
168 | - <td><?php print _('NXDOMAIN ttl'); ?></th> |
|
168 | + <td><?php print _ ('NXDOMAIN ttl'); ?></th> |
|
169 | 169 | <td> |
170 | 170 | <select name="nxdomain_ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
171 | 171 | <?php |
172 | 172 | // loop |
173 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
173 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
174 | 174 | // active |
175 | - if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
176 | - else { $selected = ""; } |
|
175 | + if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
176 | + else { $selected = ""; } |
|
177 | 177 | |
178 | 178 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
179 | 179 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | <tr> |
187 | 187 | <td></td> |
188 | 188 | <td> |
189 | - <input type="checkbox" class="hideDefaults" value="1" name="manual"> <?php print _("Dont create default records (SOA, NS)"); ?> |
|
189 | + <input type="checkbox" class="hideDefaults" value="1" name="manual"> <?php print _ ("Dont create default records (SOA, NS)"); ?> |
|
190 | 190 | </td> |
191 | 191 | </tr> |
192 | 192 | <?php } ?> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | <?php |
198 | 198 | //print delete warning |
199 | - if($_POST['action'] == "delete") { $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing Domain will also remove all referenced entries!"), false);} |
|
199 | + if ($_POST['action'] == "delete") { $Result->show ("warning", "<strong>"._ ('Warning').":</strong> "._ ("removing Domain will also remove all referenced entries!"), false); } |
|
200 | 200 | ?> |
201 | 201 | </div> |
202 | 202 | |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | <!-- footer --> |
205 | 205 | <div class="pFooter"> |
206 | 206 | <div class="btn-group"> |
207 | - <button class="btn btn-sm btn-default <?php if(@$_POST['secondary']=="true") { print "hidePopup2"; } else { print "hidePopups"; } ?>"><?php print _('Cancel'); ?></button> |
|
208 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?> <?php if(@$_POST['secondary']=="true") { print "editDomainSubmit2"; } ?>" id="editDomainSubmit"><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> |
|
207 | + <button class="btn btn-sm btn-default <?php if (@$_POST['secondary'] == "true") { print "hidePopup2"; } else { print "hidePopups"; } ?>"><?php print _ ('Cancel'); ?></button> |
|
208 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?> <?php if (@$_POST['secondary'] == "true") { print "editDomainSubmit2"; } ?>" id="editDomainSubmit"><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> |
|
209 | 209 | </div> |
210 | 210 | <!-- result --> |
211 | 211 | <div class="domain-edit-result"></div> |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | <td> |
50 | 50 | <select name="refresh" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
51 | 51 | <?php |
52 | - // loop |
|
53 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
54 | - // active |
|
55 | - if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
56 | - else { $selected = ""; } |
|
57 | ||
58 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
59 | - } |
|
60 | - ?> |
|
52 | + // loop |
|
53 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
54 | + // active |
|
55 | + if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
56 | + else { $selected = ""; } |
|
57 | ||
58 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
59 | + } |
|
60 | + ?> |
|
61 | 61 | </select> |
62 | 62 | </td> |
63 | 63 | <td> |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | <td> |
71 | 71 | <select name="retry" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
72 | 72 | <?php |
73 | - // loop |
|
74 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
75 | - // active |
|
76 | - if ($k == @$pdns->retry) { $selected = "selected"; } |
|
77 | - else { $selected = ""; } |
|
78 | ||
79 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
80 | - } |
|
81 | - ?> |
|
73 | + // loop |
|
74 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
75 | + // active |
|
76 | + if ($k == @$pdns->retry) { $selected = "selected"; } |
|
77 | + else { $selected = ""; } |
|
78 | ||
79 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
80 | + } |
|
81 | + ?> |
|
82 | 82 | </select> |
83 | 83 | </td> |
84 | 84 | <td> |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | <td> |
92 | 92 | <select name="expire" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
93 | 93 | <?php |
94 | - // loop |
|
95 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
96 | - // active |
|
97 | - if ($k == @$pdns->expire) { $selected = "selected"; } |
|
98 | - else { $selected = ""; } |
|
99 | ||
100 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
101 | - } |
|
102 | - ?> |
|
94 | + // loop |
|
95 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
96 | + // active |
|
97 | + if ($k == @$pdns->expire) { $selected = "selected"; } |
|
98 | + else { $selected = ""; } |
|
99 | ||
100 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
101 | + } |
|
102 | + ?> |
|
103 | 103 | </select> |
104 | 104 | </td> |
105 | 105 | <td> |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | <td> |
113 | 113 | <select name="nxdomain_ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
114 | 114 | <?php |
115 | - // loop |
|
116 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
117 | - // active |
|
118 | - if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
119 | - else { $selected = ""; } |
|
120 | ||
121 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
122 | - } |
|
123 | - ?> |
|
115 | + // loop |
|
116 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
117 | + // active |
|
118 | + if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
119 | + else { $selected = ""; } |
|
120 | ||
121 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
122 | + } |
|
123 | + ?> |
|
124 | 124 | </select> |
125 | 125 | </td> |
126 | 126 | <td> |
@@ -133,15 +133,15 @@ discard block |
||
133 | 133 | <td> |
134 | 134 | <select name="ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
135 | 135 | <?php |
136 | - // loop |
|
137 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
138 | - // active |
|
139 | - if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
140 | - else { $selected = ""; } |
|
141 | ||
142 | - print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
143 | - } |
|
144 | - ?> |
|
136 | + // loop |
|
137 | + foreach($PowerDNS->ttl as $k=>$ttl) { |
|
138 | + // active |
|
139 | + if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
140 | + else { $selected = ""; } |
|
141 | ||
142 | + print "<option value='$k' $selected>$ttl ($k)</option>"; |
|
143 | + } |
|
144 | + ?> |
|
145 | 145 | </select> </td> |
146 | 146 | <td> |
147 | 147 | <span class="text-muted"><?php print _("Default TTL for domain records"); ?></span> |
@@ -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->create_csrf_cookie (); |
@@ -17,55 +17,55 @@ discard block |
||
17 | 17 | |
18 | 18 | <!-- site settings --> |
19 | 19 | <tr class="settings-title"> |
20 | - <th colspan="3"><h4><?php print _('Default value settings'); ?></h4><hr></th> |
|
20 | + <th colspan="3"><h4><?php print _ ('Default value settings'); ?></h4><hr></th> |
|
21 | 21 | </tr> |
22 | 22 | |
23 | 23 | <!-- ns --> |
24 | 24 | <tr> |
25 | - <td><?php print _('Name servers'); ?></th> |
|
25 | + <td><?php print _ ('Name servers'); ?></th> |
|
26 | 26 | <td style="width:300px;"> |
27 | 27 | <input type="text" class="form-control input-sm" name="ns" value="<?php print $pdns->ns; ?>"> |
28 | 28 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
29 | 29 | </td> |
30 | 30 | <td> |
31 | - <span class="text-muted"><?php print _("Enter name servers, separate multiple with ;"); ?></span> |
|
31 | + <span class="text-muted"><?php print _ ("Enter name servers, separate multiple with ;"); ?></span> |
|
32 | 32 | </td> |
33 | 33 | </tr> |
34 | 34 | </tr> |
35 | 35 | |
36 | 36 | <!-- mail --> |
37 | 37 | <tr> |
38 | - <td><?php print _('Hostmaster'); ?></th> |
|
38 | + <td><?php print _ ('Hostmaster'); ?></th> |
|
39 | 39 | <td> |
40 | 40 | <input type="text" class="form-control input-sm" name="hostmaster" value="<?php print $pdns->hostmaster; ?>"> |
41 | 41 | </td> |
42 | 42 | <td> |
43 | - <span class="text-muted"><?php print _("Enter default hostmaster for domain"); ?></span> |
|
43 | + <span class="text-muted"><?php print _ ("Enter default hostmaster for domain"); ?></span> |
|
44 | 44 | </td> |
45 | 45 | </tr> |
46 | 46 | |
47 | 47 | <!-- default PTR domain --> |
48 | 48 | <tr> |
49 | - <td><?php print _('Default PTR domain'); ?></th> |
|
49 | + <td><?php print _ ('Default PTR domain'); ?></th> |
|
50 | 50 | <td> |
51 | 51 | <input type="text" class="form-control input-sm" name="def_ptr_domain" placeholder="Not used" value="<?php print $pdns->def_ptr_domain; ?>"> |
52 | 52 | </td> |
53 | 53 | <td> |
54 | - <span class="text-muted"><?php print _("Default PTR domain if no valid hostname for PTR is provided"); ?></span> |
|
54 | + <span class="text-muted"><?php print _ ("Default PTR domain if no valid hostname for PTR is provided"); ?></span> |
|
55 | 55 | </td> |
56 | 56 | </tr> |
57 | 57 | |
58 | 58 | <!-- refresh --> |
59 | 59 | <tr> |
60 | - <td><?php print _('Refresh'); ?></th> |
|
60 | + <td><?php print _ ('Refresh'); ?></th> |
|
61 | 61 | <td> |
62 | 62 | <select name="refresh" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
63 | 63 | <?php |
64 | 64 | // loop |
65 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
65 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
66 | 66 | // active |
67 | - if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
68 | - else { $selected = ""; } |
|
67 | + if ($k == @$pdns->refresh) { $selected = "selected"; } |
|
68 | + else { $selected = ""; } |
|
69 | 69 | |
70 | 70 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
71 | 71 | } |
@@ -73,20 +73,20 @@ discard block |
||
73 | 73 | </select> |
74 | 74 | </td> |
75 | 75 | <td> |
76 | - <span class="text-muted"><?php print _("How often a secondary will poll the primary server to see if the serial number for the zone has increased."); ?></span> |
|
76 | + <span class="text-muted"><?php print _ ("How often a secondary will poll the primary server to see if the serial number for the zone has increased."); ?></span> |
|
77 | 77 | </td> |
78 | 78 | </tr> |
79 | 79 | <!-- retry --> |
80 | 80 | <tr> |
81 | - <td><?php print _('Retry'); ?></th> |
|
81 | + <td><?php print _ ('Retry'); ?></th> |
|
82 | 82 | <td> |
83 | 83 | <select name="retry" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
84 | 84 | <?php |
85 | 85 | // loop |
86 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
86 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
87 | 87 | // active |
88 | - if ($k == @$pdns->retry) { $selected = "selected"; } |
|
89 | - else { $selected = ""; } |
|
88 | + if ($k == @$pdns->retry) { $selected = "selected"; } |
|
89 | + else { $selected = ""; } |
|
90 | 90 | |
91 | 91 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
92 | 92 | } |
@@ -94,20 +94,20 @@ discard block |
||
94 | 94 | </select> |
95 | 95 | </td> |
96 | 96 | <td> |
97 | - <span class="text-muted"><?php print _("If a secondary was unable to contact the primary at the last refresh, wait the retry value before trying again."); ?></span> |
|
97 | + <span class="text-muted"><?php print _ ("If a secondary was unable to contact the primary at the last refresh, wait the retry value before trying again."); ?></span> |
|
98 | 98 | </td> |
99 | 99 | </tr> |
100 | 100 | <!-- expire --> |
101 | 101 | <tr> |
102 | - <td><?php print _('Expire'); ?></th> |
|
102 | + <td><?php print _ ('Expire'); ?></th> |
|
103 | 103 | <td> |
104 | 104 | <select name="expire" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
105 | 105 | <?php |
106 | 106 | // loop |
107 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
107 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
108 | 108 | // active |
109 | - if ($k == @$pdns->expire) { $selected = "selected"; } |
|
110 | - else { $selected = ""; } |
|
109 | + if ($k == @$pdns->expire) { $selected = "selected"; } |
|
110 | + else { $selected = ""; } |
|
111 | 111 | |
112 | 112 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
113 | 113 | } |
@@ -115,20 +115,20 @@ discard block |
||
115 | 115 | </select> |
116 | 116 | </td> |
117 | 117 | <td> |
118 | - <span class="text-muted"><?php print _("How long a secondary will still treat its copy of the zone data as valid if it can't contact the primary."); ?></span> |
|
118 | + <span class="text-muted"><?php print _ ("How long a secondary will still treat its copy of the zone data as valid if it can't contact the primary."); ?></span> |
|
119 | 119 | </td> |
120 | 120 | </tr> |
121 | 121 | <!-- NXDOMAIN --> |
122 | 122 | <tr> |
123 | - <td><?php print _('NXDOMAIN TTL'); ?></th> |
|
123 | + <td><?php print _ ('NXDOMAIN TTL'); ?></th> |
|
124 | 124 | <td> |
125 | 125 | <select name="nxdomain_ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
126 | 126 | <?php |
127 | 127 | // loop |
128 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
128 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
129 | 129 | // active |
130 | - if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
131 | - else { $selected = ""; } |
|
130 | + if ($k == @$pdns->nxdomain_ttl) { $selected = "selected"; } |
|
131 | + else { $selected = ""; } |
|
132 | 132 | |
133 | 133 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
134 | 134 | } |
@@ -136,34 +136,34 @@ discard block |
||
136 | 136 | </select> |
137 | 137 | </td> |
138 | 138 | <td> |
139 | - <span class="text-muted"><?php print _("negative caching time - the time a NAME ERROR = NXDOMAIN result may be cached by any resolver"); ?></span> |
|
139 | + <span class="text-muted"><?php print _ ("negative caching time - the time a NAME ERROR = NXDOMAIN result may be cached by any resolver"); ?></span> |
|
140 | 140 | </td> |
141 | 141 | </tr> |
142 | 142 | <!-- TTL --> |
143 | 143 | <tr> |
144 | - <td><?php print _('Default TTL'); ?></th> |
|
144 | + <td><?php print _ ('Default TTL'); ?></th> |
|
145 | 145 | <td> |
146 | 146 | <select name="ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
147 | 147 | <?php |
148 | 148 | // loop |
149 | - foreach($PowerDNS->ttl as $k=>$ttl) { |
|
149 | + foreach ($PowerDNS->ttl as $k=>$ttl) { |
|
150 | 150 | // active |
151 | - if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
152 | - else { $selected = ""; } |
|
151 | + if ($k == @$pdns->ttl) { $selected = "selected"; } |
|
152 | + else { $selected = ""; } |
|
153 | 153 | |
154 | 154 | print "<option value='$k' $selected>$ttl ($k)</option>"; |
155 | 155 | } |
156 | 156 | ?> |
157 | 157 | </select> </td> |
158 | 158 | <td> |
159 | - <span class="text-muted"><?php print _("Default TTL for domain records"); ?></span> |
|
159 | + <span class="text-muted"><?php print _ ("Default TTL for domain records"); ?></span> |
|
160 | 160 | </td> |
161 | 161 | </tr> |
162 | 162 | <!-- submit --> |
163 | 163 | <tr> |
164 | 164 | <td></td> |
165 | 165 | <td style="text-align: right"> |
166 | - <input type="submit" class="btn btn-success btn-sm" value="<?php print _("Save"); ?>"> |
|
166 | + <input type="submit" class="btn btn-success btn-sm" value="<?php print _ ("Save"); ?>"> |
|
167 | 167 | </td> |
168 | 168 | </tr> |
169 | 169 |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | <!-- tabs --> |
37 | 37 | <ul class="nav nav-tabs"> |
38 | 38 | <?php |
39 | - // tabs |
|
40 | - $tabs = array("domains", "host_records", "reverse_v4", "reverse_v6", "settings", "defaults"); |
|
39 | + // tabs |
|
40 | + $tabs = array("domains", "host_records", "reverse_v4", "reverse_v6", "settings", "defaults"); |
|
41 | 41 | |
42 | - // default tab |
|
43 | - if(!isset($_GET['subnetId'])) { |
|
44 | - if(!$test) { $_GET['subnetId'] = "settings"; } |
|
45 | - else { $_GET['subnetId'] = "domains"; } |
|
46 | - } |
|
42 | + // default tab |
|
43 | + if(!isset($_GET['subnetId'])) { |
|
44 | + if(!$test) { $_GET['subnetId'] = "settings"; } |
|
45 | + else { $_GET['subnetId'] = "domains"; } |
|
46 | + } |
|
47 | 47 | |
48 | - // check |
|
49 | - if(!in_array($_GET['subnetId'], $tabs)) { $Result->show("danger", "Invalid request", true); } |
|
48 | + // check |
|
49 | + if(!in_array($_GET['subnetId'], $tabs)) { $Result->show("danger", "Invalid request", true); } |
|
50 | 50 | |
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>"; |
|
56 | - } |
|
57 | - ?> |
|
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>"; |
|
56 | + } |
|
57 | + ?> |
|
58 | 58 | </ul> |
59 | 59 | |
60 | 60 | <div> |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | // include content |
63 | 63 | $pdns_section = $_GET['subnetId']; |
64 | 64 | if (preg_match("/reverse_/", $pdns_section)) { |
65 | - $filename = 'domains.php'; |
|
65 | + $filename = 'domains.php'; |
|
66 | 66 | } else { |
67 | - $filename = "$_GET[subnetId].php"; |
|
67 | + $filename = "$_GET[subnetId].php"; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // include file |
@@ -75,7 +75,7 @@ discard block |
||
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 |
@@ -63,7 +63,8 @@ discard block |
||
63 | 63 | $pdns_section = $_GET['subnetId']; |
64 | 64 | if (preg_match("/reverse_/", $pdns_section)) { |
65 | 65 | $filename = 'domains.php'; |
66 | -} else { |
|
66 | +} |
|
67 | +else { |
|
67 | 68 | $filename = "$_GET[subnetId].php"; |
68 | 69 | } |
69 | 70 | |
@@ -74,7 +75,8 @@ discard block |
||
74 | 75 | </div> |
75 | 76 | |
76 | 77 | <?php |
77 | -} else { |
|
78 | +} |
|
79 | +else { |
|
78 | 80 | $Result->show("info", _('Please enable powerDNS module under server management'), false); |
79 | 81 | } |
80 | 82 | ?> |
@@ -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 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | <!-- check --> |
91 | 91 | <div class="check" style="height:60px;"> |
92 | 92 | <?php |
93 | - if ($test==false) { $Result->show("danger alert-absolute", "Failed to connect to database:<hr> ".$PowerDNS->error); } |
|
94 | - else { $Result->show("success alert-absolute", "Database connection ok"); } |
|
95 | - ?> |
|
93 | + if ($test==false) { $Result->show("danger alert-absolute", "Failed to connect to database:<hr> ".$PowerDNS->error); } |
|
94 | + else { $Result->show("success alert-absolute", "Database connection ok"); } |
|
95 | + ?> |
|
96 | 96 | </div> |
97 | 97 | \ No newline at end of file |
@@ -69,7 +69,10 @@ |
||
69 | 69 | <tr> |
70 | 70 | <td><?php print _('Autoserial'); ?></th> |
71 | 71 | <td> |
72 | - <input type="checkbox" class="input-switch" value="Yes" name="autoserial" <?php if(@$pdns->autoserial == "Yes") print 'checked'; ?>> |
|
72 | + <input type="checkbox" class="input-switch" value="Yes" name="autoserial" <?php if(@$pdns->autoserial == "Yes") { |
|
73 | + print 'checked'; |
|
74 | +} |
|
75 | +?>> |
|
73 | 76 | </td> |
74 | 77 | </tr> |
75 | 78 | <!-- submit --> |
@@ -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 |
@@ -46,8 +46,8 @@ |
||
46 | 46 | |
47 | 47 | # set update values |
48 | 48 | $values = array("id"=>1, |
49 | - "powerDNS"=>json_encode($values), |
|
50 | - ); |
|
49 | + "powerDNS"=>json_encode($values), |
|
50 | + ); |
|
51 | 51 | if(!$Admin->object_modify("settings", "edit", "id", $values)) { $Result->show("danger", _("Cannot update settings"), true); } |
52 | 52 | else { $Result->show("success", _("Settings updated successfully"), true); } |
53 | 53 | ?> |
54 | 54 | \ No newline at end of file |
@@ -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 |
@@ -29,49 +29,49 @@ discard block |
||
29 | 29 | |
30 | 30 | # get record |
31 | 31 | if($_POST['action']!="add") { |
32 | - $record = $PowerDNS->fetch_record ($_POST['id']); |
|
33 | - $record!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
32 | + $record = $PowerDNS->fetch_record ($_POST['id']); |
|
33 | + $record!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
34 | 34 | } |
35 | 35 | # new record |
36 | 36 | else { |
37 | - // from IP table |
|
38 | - // we provide record hostname and strip domain from it |
|
39 | - if (!is_numeric($_POST['domain_id']) && !is_numeric($_POST['id'])) { |
|
40 | - // fetch all domains |
|
41 | - $all_domains = $PowerDNS->fetch_all_domains (); |
|
42 | - if ($all_domains!==false) { |
|
43 | - foreach($all_domains as $dk=>$domain_s) { |
|
44 | - // loop through and find all matches |
|
45 | - if (strpos($_POST['domain_id'],$domain_s->name) !== false) { |
|
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) { |
|
48 | - $matches[$dk] = $domain_s; |
|
49 | - } |
|
50 | - } |
|
51 | - } |
|
52 | - // match found ? |
|
53 | - if (isset($matches)) { |
|
54 | - foreach($matches as $k=>$m){ |
|
55 | - $length = strlen($m->name); |
|
56 | - if($length > $max){ $max = $length; $element_id = $k; } |
|
57 | - } |
|
58 | - // save longest match id |
|
59 | - $_POST['domain_id'] = $all_domains[$element_id]->id; |
|
60 | - } |
|
61 | - } |
|
62 | - // die if not existing |
|
63 | - if (!is_numeric($_POST['domain_id'])) { |
|
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); } |
|
67 | - } |
|
68 | - else { |
|
69 | - $record = new StdClass (); |
|
70 | - $record->ttl = 3600; |
|
71 | - $record->name = $post['domain_id']; |
|
72 | - $record->content = $_POST['id']; |
|
73 | - } |
|
74 | - } |
|
37 | + // from IP table |
|
38 | + // we provide record hostname and strip domain from it |
|
39 | + if (!is_numeric($_POST['domain_id']) && !is_numeric($_POST['id'])) { |
|
40 | + // fetch all domains |
|
41 | + $all_domains = $PowerDNS->fetch_all_domains (); |
|
42 | + if ($all_domains!==false) { |
|
43 | + foreach($all_domains as $dk=>$domain_s) { |
|
44 | + // loop through and find all matches |
|
45 | + if (strpos($_POST['domain_id'],$domain_s->name) !== false) { |
|
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) { |
|
48 | + $matches[$dk] = $domain_s; |
|
49 | + } |
|
50 | + } |
|
51 | + } |
|
52 | + // match found ? |
|
53 | + if (isset($matches)) { |
|
54 | + foreach($matches as $k=>$m){ |
|
55 | + $length = strlen($m->name); |
|
56 | + if($length > $max){ $max = $length; $element_id = $k; } |
|
57 | + } |
|
58 | + // save longest match id |
|
59 | + $_POST['domain_id'] = $all_domains[$element_id]->id; |
|
60 | + } |
|
61 | + } |
|
62 | + // die if not existing |
|
63 | + if (!is_numeric($_POST['domain_id'])) { |
|
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); } |
|
67 | + } |
|
68 | + else { |
|
69 | + $record = new StdClass (); |
|
70 | + $record->ttl = 3600; |
|
71 | + $record->name = $post['domain_id']; |
|
72 | + $record->content = $_POST['id']; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // get domain |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | |
81 | 81 | // default |
82 | 82 | if (!isset($record)) { |
83 | - $record = new StdClass (); |
|
84 | - $record->ttl = 3600; |
|
85 | - $record->name = $domain->name; |
|
83 | + $record = new StdClass (); |
|
84 | + $record->ttl = 3600; |
|
85 | + $record->name = $domain->name; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | // if IPv6 automaticall add AAAA record! |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | <td> |
123 | 123 | <select name="type" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
124 | 124 | <?php |
125 | - // loop |
|
126 | - foreach($PowerDNS->record_types as $type) { |
|
127 | - // active |
|
128 | - if ($type == @$record->type) { $selected = "selected"; } |
|
129 | - else { $selected = ""; } |
|
130 | ||
131 | - print "<option value='$type' $selected>$type</option>"; |
|
132 | - } |
|
133 | - ?> |
|
125 | + // loop |
|
126 | + foreach($PowerDNS->record_types as $type) { |
|
127 | + // active |
|
128 | + if ($type == @$record->type) { $selected = "selected"; } |
|
129 | + else { $selected = ""; } |
|
130 | ||
131 | + print "<option value='$type' $selected>$type</option>"; |
|
132 | + } |
|
133 | + ?> |
|
134 | 134 | </select> |
135 | 135 | </td> |
136 | 136 | </tr> |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | <td> |
151 | 151 | <select name="ttl" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
152 | 152 | <?php |
153 | - // loop |
|
154 | - foreach($PowerDNS->ttl as $k=>$type) { |
|
155 | - // active |
|
156 | - if ($k == @$record->ttl) { $selected = "selected"; } |
|
157 | - else { $selected = ""; } |
|
158 | ||
159 | - print "<option value='$k' $selected>$type</option>"; |
|
160 | - } |
|
161 | - ?> |
|
153 | + // loop |
|
154 | + foreach($PowerDNS->ttl as $k=>$type) { |
|
155 | + // active |
|
156 | + if ($k == @$record->ttl) { $selected = "selected"; } |
|
157 | + else { $selected = ""; } |
|
158 | ||
159 | + print "<option value='$k' $selected>$type</option>"; |
|
160 | + } |
|
161 | + ?> |
|
162 | 162 | </select> |
163 | 163 | </td> |
164 | 164 | </tr> |
@@ -178,7 +178,10 @@ discard block |
||
178 | 178 | <td> |
179 | 179 | <select name="disabled" class="form-control input-w-auto input-sm" <?php print $readonly; ?>> |
180 | 180 | <option value="0"><?php print _('No'); ?></option> |
181 | - <option value="1" <?php if($record->disabled==1) print "selected='selected'"; ?>><?php print _('Yes'); ?></option> |
|
181 | + <option value="1" <?php if($record->disabled==1) { |
|
182 | + print "selected='selected'"; |
|
183 | +} |
|
184 | +?>><?php print _('Yes'); ?></option> |
|
182 | 185 | </select> |
183 | 186 | </td> |
184 | 187 | </tr> |
@@ -196,7 +199,10 @@ discard block |
||
196 | 199 | <?php if($_POST['action']!=="delete" && isset($record->id)) { ?> |
197 | 200 | <button class="btn btn-sm btn-default btn-danger" id="editRecordSubmitDelete"><i class="fa fa-trash-o"></i> <?php print _("Delete"); ?></button> |
198 | 201 | <?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> |
|
202 | + <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } |
|
203 | +else { print "btn-success"; } ?>" id="editRecordSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } |
|
204 | +else if ($_POST['action']=="delete") { print "fa-trash-o"; } |
|
205 | +else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
200 | 206 | </div> |
201 | 207 | <!-- result --> |
202 | 208 | <div class="record-edit-result"></div> |
@@ -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> |
@@ -25,27 +25,27 @@ |
||
25 | 25 | |
26 | 26 | # fetch old record |
27 | 27 | if($_POST['action']!="add") { |
28 | - $record = $PowerDNS->fetch_record ($_POST['id']); |
|
29 | - $record!==false ? : $Result->show("danger", _("Invalid ID"), true, true); |
|
28 | + $record = $PowerDNS->fetch_record ($_POST['id']); |
|
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 | 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); } |
|
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 | 40 | if($_POST['action']=="edit") { |
41 | - $values = $PowerDNS->formulate_update_record ($_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled'], $record->change_date); |
|
42 | - $values['domain_id'] = $_POST['domain_id']; |
|
41 | + $values = $PowerDNS->formulate_update_record ($_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled'], $record->change_date); |
|
42 | + $values['domain_id'] = $_POST['domain_id']; |
|
43 | 43 | } |
44 | 44 | elseif($_POST['action']=="add") { |
45 | - $values = $PowerDNS->formulate_new_record ($_POST['domain_id'], $_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled']); |
|
45 | + $values = $PowerDNS->formulate_new_record ($_POST['domain_id'], $_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled']); |
|
46 | 46 | } |
47 | 47 | elseif($_POST['action']=="delete") { |
48 | - $values['domain_id'] = $_POST['domain_id']; |
|
48 | + $values['domain_id'] = $_POST['domain_id']; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | # add id |
@@ -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 |
@@ -34,43 +34,43 @@ |
||
34 | 34 | |
35 | 35 | # ok, lets get results form post array! |
36 | 36 | foreach($_POST as $key=>$line) { |
37 | - // IP address |
|
38 | - if(substr($key, 0,2)=="rd") { $res[substr($key, 2)]['rd'] = $line; } |
|
39 | - // mac |
|
40 | - elseif(substr($key, 0,4)=="name") { $res[substr($key, 4)]['name'] = $line; } |
|
41 | - // description |
|
42 | - elseif(substr($key, 0,11)=="description") { $res[substr($key, 11)]['description'] = $line; } |
|
43 | - // custom fields |
|
44 | - elseif (isset($required_fields)) { |
|
45 | - foreach ($required_fields as $k=>$f) { |
|
46 | - if((strpos($key, $f['name'])) !== false) { |
|
37 | + // IP address |
|
38 | + if(substr($key, 0,2)=="rd") { $res[substr($key, 2)]['rd'] = $line; } |
|
39 | + // mac |
|
40 | + elseif(substr($key, 0,4)=="name") { $res[substr($key, 4)]['name'] = $line; } |
|
41 | + // description |
|
42 | + elseif(substr($key, 0,11)=="description") { $res[substr($key, 11)]['description'] = $line; } |
|
43 | + // custom fields |
|
44 | + elseif (isset($required_fields)) { |
|
45 | + foreach ($required_fields as $k=>$f) { |
|
46 | + if((strpos($key, $f['name'])) !== false) { |
|
47 | 47 | { $res[substr($key, strlen($f['name']))][$f['name']] = $line; } |
48 | - } |
|
49 | - } |
|
50 | - } |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | # insert entries |
54 | 54 | if(sizeof($res)>0) { |
55 | - $errors = 0; |
|
56 | - foreach($res as $r) { |
|
57 | - # set insert values |
|
58 | - $values = array("rd"=>$r['rd'], |
|
59 | - "name"=>$r['name'], |
|
60 | - "description"=>$r['description'] |
|
61 | - ); |
|
55 | + $errors = 0; |
|
56 | + foreach($res as $r) { |
|
57 | + # set insert values |
|
58 | + $values = array("rd"=>$r['rd'], |
|
59 | + "name"=>$r['name'], |
|
60 | + "description"=>$r['description'] |
|
61 | + ); |
|
62 | 62 | # custom fields |
63 | - if (isset($required_fields)) { |
|
64 | - foreach ($required_fields as $k=>$f) { |
|
65 | - $values[$f['name']] = $r[$f['name']]; |
|
66 | - } |
|
67 | - } |
|
63 | + if (isset($required_fields)) { |
|
64 | + foreach ($required_fields as $k=>$f) { |
|
65 | + $values[$f['name']] = $r[$f['name']]; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | # insert vrfs |
69 | 69 | if(!$Admin->object_modify("vrf", "add", "vrfId", $values)) { $Result->show("danger", _("Failed to import entry")." ".$r['number']." ".$r['name'], false); $errors++; } |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - # success if no errors |
|
73 | - if($errors==0) { $Result->show("success", _("Scan results added to database")."!", true); } |
|
72 | + # success if no errors |
|
73 | + if($errors==0) { $Result->show("success", _("Scan results added to database")."!", true); } |
|
74 | 74 | } |
75 | 75 | # error |
76 | 76 | else { $Result->show("danger", _("No entries available"), true); } |
@@ -4,58 +4,58 @@ discard block |
||
4 | 4 | *******************************/ |
5 | 5 | |
6 | 6 | /* functions */ |
7 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
7 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
8 | 8 | |
9 | 9 | # initialize user object |
10 | -$Database = new Database_PDO; |
|
11 | -$User = new User ($Database); |
|
10 | +$Database = new Database_PDO; |
|
11 | +$User = new User ($Database); |
|
12 | 12 | $Admin = new Admin ($Database); |
13 | 13 | $Subnets = new Subnets ($Database); |
14 | -$Addresses = new Addresses ($Database); |
|
15 | -$Tools = new Tools ($Database); |
|
14 | +$Addresses = new Addresses ($Database); |
|
15 | +$Tools = new Tools ($Database); |
|
16 | 16 | $Result = new Result (); |
17 | 17 | |
18 | 18 | # verify that user is logged in |
19 | -$User->check_user_session(); |
|
19 | +$User->check_user_session (); |
|
20 | 20 | |
21 | 21 | # check for number of input values |
22 | -$max = ini_get("max_input_vars"); |
|
23 | -if(sizeof($_POST)>=ini_get("max_input_vars")) { $Result->show("danger", _("Number of discovered hosts exceed maximum possible defined by php.ini - set to ")." $max <hr>"._("Please adjust your php.ini settings for value `max_input_vars`"), true); } |
|
22 | +$max = ini_get ("max_input_vars"); |
|
23 | +if (sizeof ($_POST) >= ini_get ("max_input_vars")) { $Result->show ("danger", _ ("Number of discovered hosts exceed maximum possible defined by php.ini - set to ")." $max <hr>"._ ("Please adjust your php.ini settings for value `max_input_vars`"), true); } |
|
24 | 24 | |
25 | 25 | // fetch custom fields and check for required |
26 | 26 | $required_fields = $Tools->fetch_custom_fields ('vrf'); |
27 | -if($required_fields!==false) { |
|
27 | +if ($required_fields !== false) { |
|
28 | 28 | foreach ($required_fields as $k=>$f) { |
29 | - if ($f['Null']!="NO") { |
|
29 | + if ($f['Null'] != "NO") { |
|
30 | 30 | unset($required_fields[$k]); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | 35 | # ok, lets get results form post array! |
36 | -foreach($_POST as $key=>$line) { |
|
36 | +foreach ($_POST as $key=>$line) { |
|
37 | 37 | // IP address |
38 | - if(substr($key, 0,2)=="rd") { $res[substr($key, 2)]['rd'] = $line; } |
|
38 | + if (substr ($key, 0, 2) == "rd") { $res[substr ($key, 2)]['rd'] = $line; } |
|
39 | 39 | // mac |
40 | - elseif(substr($key, 0,4)=="name") { $res[substr($key, 4)]['name'] = $line; } |
|
40 | + elseif (substr ($key, 0, 4) == "name") { $res[substr ($key, 4)]['name'] = $line; } |
|
41 | 41 | // description |
42 | - elseif(substr($key, 0,11)=="description") { $res[substr($key, 11)]['description'] = $line; } |
|
42 | + elseif (substr ($key, 0, 11) == "description") { $res[substr ($key, 11)]['description'] = $line; } |
|
43 | 43 | // custom fields |
44 | 44 | elseif (isset($required_fields)) { |
45 | 45 | foreach ($required_fields as $k=>$f) { |
46 | - if((strpos($key, $f['name'])) !== false) { |
|
47 | - { $res[substr($key, strlen($f['name']))][$f['name']] = $line; } |
|
46 | + if ((strpos ($key, $f['name'])) !== false) { |
|
47 | + { $res[substr ($key, strlen ($f['name']))][$f['name']] = $line; } |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | # insert entries |
54 | -if(sizeof($res)>0) { |
|
54 | +if (sizeof ($res) > 0) { |
|
55 | 55 | $errors = 0; |
56 | - foreach($res as $r) { |
|
56 | + foreach ($res as $r) { |
|
57 | 57 | # set insert values |
58 | - $values = array("rd"=>$r['rd'], |
|
58 | + $values = array ("rd"=>$r['rd'], |
|
59 | 59 | "name"=>$r['name'], |
60 | 60 | "description"=>$r['description'] |
61 | 61 | ); |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | } |
67 | 67 | } |
68 | 68 | # insert vrfs |
69 | - if(!$Admin->object_modify("vrf", "add", "vrfId", $values)) { $Result->show("danger", _("Failed to import entry")." ".$r['number']." ".$r['name'], false); $errors++; } |
|
69 | + if (!$Admin->object_modify ("vrf", "add", "vrfId", $values)) { $Result->show ("danger", _ ("Failed to import entry")." ".$r['number']." ".$r['name'], false); $errors++; } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | # success if no errors |
73 | - if($errors==0) { $Result->show("success", _("Scan results added to database")."!", true); } |
|
73 | + if ($errors == 0) { $Result->show ("success", _ ("Scan results added to database")."!", true); } |
|
74 | 74 | } |
75 | 75 | # error |
76 | -else { $Result->show("danger", _("No entries available"), true); } |
|
76 | +else { $Result->show ("danger", _ ("No entries available"), true); } |
|
77 | 77 | ?> |
78 | 78 | \ No newline at end of file |
@@ -40,95 +40,95 @@ |
||
40 | 40 | # first check if they exist! |
41 | 41 | if($all_vrfs===false) { $Result->show("info", _("No VRFs configured")."!", false);} |
42 | 42 | else { |
43 | - print '<table id="vrfManagement" class="table sorted table-striped table-top table-hover">'. "\n"; |
|
44 | - |
|
45 | - # headers |
|
46 | - print "<thead>"; |
|
47 | - print '<tr>'. "\n"; |
|
48 | - print ' <th>'._('Name').'</th>'. "\n"; |
|
49 | - print ' <th>'._('RD').'</th>'. "\n"; |
|
50 | - print ' <th>'._('Sections').'</th>'. "\n"; |
|
51 | - print ' <th>'._('Description').'</th>'. "\n"; |
|
52 | - if(sizeof($custom) > 0) { |
|
53 | - foreach($custom as $field) { |
|
54 | - if(!in_array($field['name'], $hidden_fields)) { |
|
55 | - print "<th class='customField hidden-xs hidden-sm'>$field[name]</th>"; |
|
56 | - } |
|
57 | - } |
|
58 | - } |
|
59 | - print ' <th></th>'. "\n"; |
|
60 | - print '</tr>'. "\n"; |
|
61 | - print "</thead>"; |
|
43 | + print '<table id="vrfManagement" class="table sorted table-striped table-top table-hover">'. "\n"; |
|
44 | + |
|
45 | + # headers |
|
46 | + print "<thead>"; |
|
47 | + print '<tr>'. "\n"; |
|
48 | + print ' <th>'._('Name').'</th>'. "\n"; |
|
49 | + print ' <th>'._('RD').'</th>'. "\n"; |
|
50 | + print ' <th>'._('Sections').'</th>'. "\n"; |
|
51 | + print ' <th>'._('Description').'</th>'. "\n"; |
|
52 | + if(sizeof($custom) > 0) { |
|
53 | + foreach($custom as $field) { |
|
54 | + if(!in_array($field['name'], $hidden_fields)) { |
|
55 | + print "<th class='customField hidden-xs hidden-sm'>$field[name]</th>"; |
|
56 | + } |
|
57 | + } |
|
58 | + } |
|
59 | + print ' <th></th>'. "\n"; |
|
60 | + print '</tr>'. "\n"; |
|
61 | + print "</thead>"; |
|
62 | 62 | |
63 | 63 | print "<tbody>"; |
64 | - # loop |
|
65 | - foreach ($all_vrfs as $vrf) { |
|
66 | - //cast |
|
67 | - $vrf = (array) $vrf; |
|
68 | - |
|
69 | - // format sections |
|
70 | - if(strlen($vrf['sections'])==0) { |
|
71 | - $sections = "All sections"; |
|
72 | - } |
|
73 | - else { |
|
74 | - //explode |
|
75 | - unset($sec); |
|
76 | - $sections_tmp = explode(";", $vrf['sections']); |
|
77 | - foreach($sections_tmp as $t) { |
|
78 | - //fetch section |
|
79 | - $tmp_section = $Sections->fetch_section(null, $t); |
|
80 | - $sec[] = " · ".$tmp_section->name; |
|
81 | - } |
|
82 | - //implode |
|
83 | - $sections = implode("<br>", $sec); |
|
84 | - } |
|
85 | - |
|
86 | - //print details |
|
87 | - print '<tr class="text-top">'. "\n"; |
|
88 | - print ' <td class="name">'. $vrf['name'] .'</td>'. "\n"; |
|
89 | - print ' <td class="rd">'. $vrf['rd'] .'</td>'. "\n"; |
|
90 | - print " <td><span class='text-muted'>$sections</span></td>"; |
|
91 | - print ' <td class="description">'. $vrf['description'] .'</td>'. "\n"; |
|
92 | - |
|
93 | - // custom fields |
|
94 | - if(sizeof($custom) > 0) { |
|
95 | - foreach($custom as $field) { |
|
96 | - if(!in_array($field['name'], $hidden_fields)) { |
|
97 | - |
|
98 | - print "<td class='customField hidden-xs hidden-sm'>"; |
|
99 | - |
|
100 | - // create links |
|
101 | - $vrf[$field['name']] = $Result->create_links ($vrf[$field['name']], $field['type']); |
|
102 | - |
|
103 | - //booleans |
|
104 | - if($field['type']=="tinyint(1)") { |
|
105 | - if($vrf[$field['name']] == "0") { print _("No"); } |
|
106 | - elseif($vrf[$field['name']] == "1") { print _("Yes"); } |
|
107 | - } |
|
108 | - //text |
|
109 | - elseif($field['type']=="text") { |
|
110 | - if(strlen($vrf[$field['name']])>0) { print "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='".str_replace("\n", "<br>", $vrf[$field['name']])."'>"; } |
|
111 | - else { print ""; } |
|
112 | - } |
|
113 | - else { |
|
114 | - print $vrf[$field['name']]; |
|
115 | - |
|
116 | - } |
|
117 | - print "</td>"; |
|
118 | - } |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - print " <td class='actions'>"; |
|
123 | - print " <div class='btn-group'>"; |
|
124 | - print " <button class='btn btn-xs btn-default vrfManagement' data-action='edit' data-vrfid='$vrf[vrfId]'><i class='fa fa-pencil'></i></button>"; |
|
125 | - print " <button class='btn btn-xs btn-default vrfManagement' data-action='delete' data-vrfid='$vrf[vrfId]'><i class='fa fa-times'></i></button>"; |
|
126 | - print " </div>"; |
|
127 | - print " </td>"; |
|
128 | - print '</tr>'. "\n"; |
|
129 | - } |
|
130 | - print "</tbody>"; |
|
131 | - print '</table>'. "\n"; |
|
64 | + # loop |
|
65 | + foreach ($all_vrfs as $vrf) { |
|
66 | + //cast |
|
67 | + $vrf = (array) $vrf; |
|
68 | + |
|
69 | + // format sections |
|
70 | + if(strlen($vrf['sections'])==0) { |
|
71 | + $sections = "All sections"; |
|
72 | + } |
|
73 | + else { |
|
74 | + //explode |
|
75 | + unset($sec); |
|
76 | + $sections_tmp = explode(";", $vrf['sections']); |
|
77 | + foreach($sections_tmp as $t) { |
|
78 | + //fetch section |
|
79 | + $tmp_section = $Sections->fetch_section(null, $t); |
|
80 | + $sec[] = " · ".$tmp_section->name; |
|
81 | + } |
|
82 | + //implode |
|
83 | + $sections = implode("<br>", $sec); |
|
84 | + } |
|
85 | + |
|
86 | + //print details |
|
87 | + print '<tr class="text-top">'. "\n"; |
|
88 | + print ' <td class="name">'. $vrf['name'] .'</td>'. "\n"; |
|
89 | + print ' <td class="rd">'. $vrf['rd'] .'</td>'. "\n"; |
|
90 | + print " <td><span class='text-muted'>$sections</span></td>"; |
|
91 | + print ' <td class="description">'. $vrf['description'] .'</td>'. "\n"; |
|
92 | + |
|
93 | + // custom fields |
|
94 | + if(sizeof($custom) > 0) { |
|
95 | + foreach($custom as $field) { |
|
96 | + if(!in_array($field['name'], $hidden_fields)) { |
|
97 | + |
|
98 | + print "<td class='customField hidden-xs hidden-sm'>"; |
|
99 | + |
|
100 | + // create links |
|
101 | + $vrf[$field['name']] = $Result->create_links ($vrf[$field['name']], $field['type']); |
|
102 | + |
|
103 | + //booleans |
|
104 | + if($field['type']=="tinyint(1)") { |
|
105 | + if($vrf[$field['name']] == "0") { print _("No"); } |
|
106 | + elseif($vrf[$field['name']] == "1") { print _("Yes"); } |
|
107 | + } |
|
108 | + //text |
|
109 | + elseif($field['type']=="text") { |
|
110 | + if(strlen($vrf[$field['name']])>0) { print "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='".str_replace("\n", "<br>", $vrf[$field['name']])."'>"; } |
|
111 | + else { print ""; } |
|
112 | + } |
|
113 | + else { |
|
114 | + print $vrf[$field['name']]; |
|
115 | + |
|
116 | + } |
|
117 | + print "</td>"; |
|
118 | + } |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + print " <td class='actions'>"; |
|
123 | + print " <div class='btn-group'>"; |
|
124 | + print " <button class='btn btn-xs btn-default vrfManagement' data-action='edit' data-vrfid='$vrf[vrfId]'><i class='fa fa-pencil'></i></button>"; |
|
125 | + print " <button class='btn btn-xs btn-default vrfManagement' data-action='delete' data-vrfid='$vrf[vrfId]'><i class='fa fa-times'></i></button>"; |
|
126 | + print " </div>"; |
|
127 | + print " </td>"; |
|
128 | + print '</tr>'. "\n"; |
|
129 | + } |
|
130 | + print "</tbody>"; |
|
131 | + print '</table>'. "\n"; |
|
132 | 132 | } |
133 | 133 | ?> |
134 | 134 |
@@ -101,7 +101,7 @@ |
||
101 | 101 | $vrf[$field['name']] = $Result->create_links ($vrf[$field['name']], $field['type']); |
102 | 102 | |
103 | 103 | //booleans |
104 | - if($field['type']=="tinyint(1)") { |
|
104 | + if($field['type']=="tinyint(1)") { |
|
105 | 105 | if($vrf[$field['name']] == "0") { print _("No"); } |
106 | 106 | elseif($vrf[$field['name']] == "1") { print _("Yes"); } |
107 | 107 | } |
@@ -5,31 +5,31 @@ 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 all vrfs |
11 | -$all_vrfs = $Admin->fetch_all_objects("vrf", "name"); |
|
11 | +$all_vrfs = $Admin->fetch_all_objects ("vrf", "name"); |
|
12 | 12 | |
13 | 13 | # fetch custom fields |
14 | -$custom = $Tools->fetch_custom_fields('vrf'); |
|
14 | +$custom = $Tools->fetch_custom_fields ('vrf'); |
|
15 | 15 | |
16 | 16 | # set hidden fields |
17 | -$hidden_fields = json_decode($User->settings->hiddenCustomFields, true); |
|
18 | -$hidden_fields = is_array(@$hidden_fields['vrf']) ? $hidden_fields['vrf'] : array(); |
|
17 | +$hidden_fields = json_decode ($User->settings->hiddenCustomFields, true); |
|
18 | +$hidden_fields = is_array (@$hidden_fields['vrf']) ? $hidden_fields['vrf'] : array (); |
|
19 | 19 | |
20 | 20 | # set size of custom fields |
21 | -$custom_size = sizeof($custom) - sizeof($hidden_fields); |
|
21 | +$custom_size = sizeof ($custom) - sizeof ($hidden_fields); |
|
22 | 22 | ?> |
23 | 23 | |
24 | -<h4><?php print _('Manage VRF'); ?></h4> |
|
24 | +<h4><?php print _ ('Manage VRF'); ?></h4> |
|
25 | 25 | <hr><br> |
26 | 26 | |
27 | 27 | <div class="btn-group"> |
28 | - <button class='btn btn-sm btn-default vrfManagement' data-action='add' data-vrfid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _('Add VRF'); ?></button> |
|
28 | + <button class='btn btn-sm btn-default vrfManagement' data-action='add' data-vrfid='' style='margin-bottom:10px;'><i class='fa fa-plus'></i> <?php print _ ('Add VRF'); ?></button> |
|
29 | 29 | <?php |
30 | 30 | // snmp |
31 | - if($User->is_admin()===true && $User->settings->enableSNMP==1) { ?> |
|
32 | - <button class="btn btn-sm btn-default" id="snmp-vrf" data-action="add"><i class="fa fa-cogs"></i> <?php print _('Scan for VRFs'); ?></button> |
|
31 | + if ($User->is_admin () === true && $User->settings->enableSNMP == 1) { ?> |
|
32 | + <button class="btn btn-sm btn-default" id="snmp-vrf" data-action="add"><i class="fa fa-cogs"></i> <?php print _ ('Scan for VRFs'); ?></button> |
|
33 | 33 | <?php } ?> |
34 | 34 | |
35 | 35 | </div> |
@@ -38,26 +38,26 @@ discard block |
||
38 | 38 | <?php |
39 | 39 | |
40 | 40 | # first check if they exist! |
41 | -if($all_vrfs===false) { $Result->show("info", _("No VRFs configured")."!", false);} |
|
41 | +if ($all_vrfs === false) { $Result->show ("info", _ ("No VRFs configured")."!", false); } |
|
42 | 42 | else { |
43 | - print '<table id="vrfManagement" class="table sorted table-striped table-top table-hover">'. "\n"; |
|
43 | + print '<table id="vrfManagement" class="table sorted table-striped table-top table-hover">'."\n"; |
|
44 | 44 | |
45 | 45 | # headers |
46 | 46 | print "<thead>"; |
47 | - print '<tr>'. "\n"; |
|
48 | - print ' <th>'._('Name').'</th>'. "\n"; |
|
49 | - print ' <th>'._('RD').'</th>'. "\n"; |
|
50 | - print ' <th>'._('Sections').'</th>'. "\n"; |
|
51 | - print ' <th>'._('Description').'</th>'. "\n"; |
|
52 | - if(sizeof($custom) > 0) { |
|
53 | - foreach($custom as $field) { |
|
54 | - if(!in_array($field['name'], $hidden_fields)) { |
|
47 | + print '<tr>'."\n"; |
|
48 | + print ' <th>'._ ('Name').'</th>'."\n"; |
|
49 | + print ' <th>'._ ('RD').'</th>'."\n"; |
|
50 | + print ' <th>'._ ('Sections').'</th>'."\n"; |
|
51 | + print ' <th>'._ ('Description').'</th>'."\n"; |
|
52 | + if (sizeof ($custom) > 0) { |
|
53 | + foreach ($custom as $field) { |
|
54 | + if (!in_array ($field['name'], $hidden_fields)) { |
|
55 | 55 | print "<th class='customField hidden-xs hidden-sm'>$field[name]</th>"; |
56 | 56 | } |
57 | 57 | } |
58 | 58 | } |
59 | - print ' <th></th>'. "\n"; |
|
60 | - print '</tr>'. "\n"; |
|
59 | + print ' <th></th>'."\n"; |
|
60 | + print '</tr>'."\n"; |
|
61 | 61 | print "</thead>"; |
62 | 62 | |
63 | 63 | print "<tbody>"; |
@@ -67,33 +67,33 @@ discard block |
||
67 | 67 | $vrf = (array) $vrf; |
68 | 68 | |
69 | 69 | // format sections |
70 | - if(strlen($vrf['sections'])==0) { |
|
70 | + if (strlen ($vrf['sections']) == 0) { |
|
71 | 71 | $sections = "All sections"; |
72 | 72 | } |
73 | 73 | else { |
74 | 74 | //explode |
75 | 75 | unset($sec); |
76 | - $sections_tmp = explode(";", $vrf['sections']); |
|
77 | - foreach($sections_tmp as $t) { |
|
76 | + $sections_tmp = explode (";", $vrf['sections']); |
|
77 | + foreach ($sections_tmp as $t) { |
|
78 | 78 | //fetch section |
79 | - $tmp_section = $Sections->fetch_section(null, $t); |
|
79 | + $tmp_section = $Sections->fetch_section (null, $t); |
|
80 | 80 | $sec[] = " · ".$tmp_section->name; |
81 | 81 | } |
82 | 82 | //implode |
83 | - $sections = implode("<br>", $sec); |
|
83 | + $sections = implode ("<br>", $sec); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | //print details |
87 | - print '<tr class="text-top">'. "\n"; |
|
88 | - print ' <td class="name">'. $vrf['name'] .'</td>'. "\n"; |
|
89 | - print ' <td class="rd">'. $vrf['rd'] .'</td>'. "\n"; |
|
87 | + print '<tr class="text-top">'."\n"; |
|
88 | + print ' <td class="name">'.$vrf['name'].'</td>'."\n"; |
|
89 | + print ' <td class="rd">'.$vrf['rd'].'</td>'."\n"; |
|
90 | 90 | print " <td><span class='text-muted'>$sections</span></td>"; |
91 | - print ' <td class="description">'. $vrf['description'] .'</td>'. "\n"; |
|
91 | + print ' <td class="description">'.$vrf['description'].'</td>'."\n"; |
|
92 | 92 | |
93 | 93 | // custom fields |
94 | - if(sizeof($custom) > 0) { |
|
95 | - foreach($custom as $field) { |
|
96 | - if(!in_array($field['name'], $hidden_fields)) { |
|
94 | + if (sizeof ($custom) > 0) { |
|
95 | + foreach ($custom as $field) { |
|
96 | + if (!in_array ($field['name'], $hidden_fields)) { |
|
97 | 97 | |
98 | 98 | print "<td class='customField hidden-xs hidden-sm'>"; |
99 | 99 | |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | $vrf[$field['name']] = $Result->create_links ($vrf[$field['name']], $field['type']); |
102 | 102 | |
103 | 103 | //booleans |
104 | - if($field['type']=="tinyint(1)") { |
|
105 | - if($vrf[$field['name']] == "0") { print _("No"); } |
|
106 | - elseif($vrf[$field['name']] == "1") { print _("Yes"); } |
|
104 | + if ($field['type'] == "tinyint(1)") { |
|
105 | + if ($vrf[$field['name']] == "0") { print _ ("No"); } |
|
106 | + elseif ($vrf[$field['name']] == "1") { print _ ("Yes"); } |
|
107 | 107 | } |
108 | 108 | //text |
109 | - elseif($field['type']=="text") { |
|
110 | - if(strlen($vrf[$field['name']])>0) { print "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='".str_replace("\n", "<br>", $vrf[$field['name']])."'>"; } |
|
111 | - else { print ""; } |
|
109 | + elseif ($field['type'] == "text") { |
|
110 | + if (strlen ($vrf[$field['name']]) > 0) { print "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='".str_replace ("\n", "<br>", $vrf[$field['name']])."'>"; } |
|
111 | + else { print ""; } |
|
112 | 112 | } |
113 | 113 | else { |
114 | 114 | print $vrf[$field['name']]; |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | print " <button class='btn btn-xs btn-default vrfManagement' data-action='delete' data-vrfid='$vrf[vrfId]'><i class='fa fa-times'></i></button>"; |
126 | 126 | print " </div>"; |
127 | 127 | print " </td>"; |
128 | - print '</tr>'. "\n"; |
|
128 | + print '</tr>'."\n"; |
|
129 | 129 | } |
130 | 130 | print "</tbody>"; |
131 | - print '</table>'. "\n"; |
|
131 | + print '</table>'."\n"; |
|
132 | 132 | } |
133 | 133 | ?> |
134 | 134 |