@@ -75,8 +75,7 @@ |
||
75 | 75 | if ($_POST['action']=="delete") { |
76 | 76 | $query = "update `subnets` set `scanAgent`=0, `pingSubnet`=0, `discoverSubnet`=0 where `scanAgent` = ?;"; |
77 | 77 | |
78 | - try { $Database->runQuery($query, array($_POST['id'])); } |
|
79 | - catch (Exception $e) { |
|
78 | + try { $Database->runQuery($query, array($_POST['id'])); } catch (Exception $e) { |
|
80 | 79 | $this->Result->show("danger", _("Error: ").$e->getMessage()); |
81 | 80 | return false; |
82 | 81 | } |
@@ -30,7 +30,8 @@ discard block |
||
30 | 30 | $agent===false ? $Result->show("danger", _("Invalid ID"), true) : null; |
31 | 31 | # title |
32 | 32 | $title = ucwords($_POST['action']) .' '._('agent').' '.$agent->name; |
33 | -} else { |
|
33 | +} |
|
34 | +else { |
|
34 | 35 | # generate new code |
35 | 36 | $agent = new StdClass; |
36 | 37 | $agent->code = str_shuffle(md5(microtime())); |
@@ -58,7 +59,10 @@ discard block |
||
58 | 59 | <tr> |
59 | 60 | <td><?php print _('Name'); ?></td> |
60 | 61 | <td> |
61 | - <input type="text" name="name" class="form-control input-sm" value="<?php print @$agent->name; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>> |
|
62 | + <input type="text" name="name" class="form-control input-sm" value="<?php print @$agent->name; ?>" <?php if($_POST['action'] == "delete") { |
|
63 | + print "readonly"; |
|
64 | +} |
|
65 | +?>> |
|
62 | 66 | <input type="hidden" name="id" value="<?php print $agent->id; ?>"> |
63 | 67 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
64 | 68 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
@@ -69,7 +73,10 @@ discard block |
||
69 | 73 | <!-- description --> |
70 | 74 | <tr> |
71 | 75 | <td><?php print _('Description'); ?></td> |
72 | - <td><input type="text" id="description" name="description" class="form-control input-sm" value="<?php print @$agent->description; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td> |
|
76 | + <td><input type="text" id="description" name="description" class="form-control input-sm" value="<?php print @$agent->description; ?>" <?php if($_POST['action'] == "delete") { |
|
77 | + print "readonly"; |
|
78 | +} |
|
79 | +?>></td> |
|
73 | 80 | <td class="info2"><?php print _('Agent description'); ?></td> |
74 | 81 | </tr> |
75 | 82 | |
@@ -77,7 +84,10 @@ discard block |
||
77 | 84 | <!-- code --> |
78 | 85 | <tr> |
79 | 86 | <td><?php print _('Code'); ?></td> |
80 | - <td><input type="text" id="code" name="code" class="form-control input-sm" value="<?php print @$agent->code; ?>" maxlength='32' <?php if(@$agent->type=="direct"||$_POST['action'] == "delete") print "readonly"; ?>></td> |
|
87 | + <td><input type="text" id="code" name="code" class="form-control input-sm" value="<?php print @$agent->code; ?>" maxlength='32' <?php if(@$agent->type=="direct"||$_POST['action'] == "delete") { |
|
88 | + print "readonly"; |
|
89 | +} |
|
90 | +?>></td> |
|
81 | 91 | <td class="info2"><?php print _('Agent code'); ?><?php if(@$agent->type!="direct") { ?> <button class="btn btn-xs btn-default" id="regAgentKey"><i class="fa fa-random"></i> <?php print _('Regenerate'); ?></button><?php } ?></td> |
82 | 92 | </tr> |
83 | 93 | |
@@ -85,7 +95,10 @@ discard block |
||
85 | 95 | <tr> |
86 | 96 | <td><?php print _('Agent type'); ?></td> |
87 | 97 | <td> |
88 | - <select name="type" class="form-control input-sm input-w-auto" <?php if(@$agent->type=="direct"||$_POST['action'] == "delete") print "readonly"; ?>> |
|
98 | + <select name="type" class="form-control input-sm input-w-auto" <?php if(@$agent->type=="direct"||$_POST['action'] == "delete") { |
|
99 | + print "readonly"; |
|
100 | +} |
|
101 | +?>> |
|
89 | 102 | <?php |
90 | 103 | //$types = array("mysql"=>"MySQL", "api"=>"Api"); |
91 | 104 | $types = array("mysql"=>"MySQL"); |
@@ -110,7 +123,10 @@ discard block |
||
110 | 123 | <div class="pFooter"> |
111 | 124 | <div class="btn-group"> |
112 | 125 | <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
113 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="agentEditSubmit"><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> |
|
126 | + <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } |
|
127 | +else { print "btn-success"; } ?>" id="agentEditSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } |
|
128 | +else if ($_POST['action']=="delete") { print "fa-trash-o"; } |
|
129 | +else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
114 | 130 | </div> |
115 | 131 | <!-- Result --> |
116 | 132 | <div class="agentEditResult"></div> |
@@ -73,7 +73,9 @@ |
||
73 | 73 | foreach ($domains as $d) { |
74 | 74 | // nulls |
75 | 75 | foreach($d as $k=>$v) { |
76 | - if (strlen($v)==0) $d->$k = "<span class='muted'>/</span>"; |
|
76 | + if (strlen($v)==0) { |
|
77 | + $d->$k = "<span class='muted'>/</span>"; |
|
78 | + } |
|
77 | 79 | } |
78 | 80 | // cont records |
79 | 81 | $cnt = $PowerDNS->count_domain_records ($d->id); |
@@ -27,8 +27,10 @@ discard block |
||
27 | 27 | # checks / validation |
28 | 28 | if ($_POST['action']!="delete") { |
29 | 29 | // fqdn |
30 | - if ($_POST['action']=="add") |
|
31 | - if($Result->validate_hostname($_POST['name'])===false) { $Result->show("danger", "Invalid domain name", true); } |
|
30 | + if ($_POST['action']=="add") { |
|
31 | + if($Result->validate_hostname($_POST['name'])===false) { $Result->show("danger", "Invalid domain name", true); |
|
32 | + } |
|
33 | + } |
|
32 | 34 | // master |
33 | 35 | if (strlen($_POST['master'])>0) { |
34 | 36 | // if multilpe masters |
@@ -55,7 +57,7 @@ discard block |
||
55 | 57 | // if slave master must be present |
56 | 58 | if ($_POST['type']=="SLAVE") { |
57 | 59 | if (strlen($_POST['master'])==0) { $Result->show("danger", "Please set master server(s) if domain type is SLAVE", true); } |
58 | - else { |
|
60 | + else { |
|
59 | 61 | if (strpos($_POST['master'], ",")!==false) { |
60 | 62 | // to array and trim, check each |
61 | 63 | $masters = array_filter(explode(",", $_POST['master'])); |
@@ -82,8 +84,9 @@ discard block |
||
82 | 84 | "type"=>@$_POST['type'] |
83 | 85 | ); |
84 | 86 | # name only on add |
85 | -if ($_POST['action']=="add") |
|
86 | -$values['name'] = $_POST['name']; |
|
87 | +if ($_POST['action']=="add") { |
|
88 | + $values['name'] = $_POST['name']; |
|
89 | +} |
|
87 | 90 | |
88 | 91 | |
89 | 92 | # remove all references if delete |
@@ -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> |
@@ -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 | ?> |
@@ -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 --> |
@@ -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> |
@@ -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 | } |