@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $rowSpan = 10 + sizeof($cfields); |
23 | 23 | |
24 | 24 | # verify that is it displayed in proper section, otherwise warn! |
25 | -if($folder['sectionId']!=$_GET['section']) { |
|
25 | +if($folder['sectionId']!=$_GET['section']) { |
|
26 | 26 | $sd = $Sections->fetch_section ("id", $folder['sectionId']); |
27 | 27 | { $Result->show("warning", "Folder is in section <a href='".create_link("folder",$sd->id,$folder['id'])."'>$sd->name</a>!", false); } |
28 | 28 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | print " <th>$key</th>"; |
59 | 59 | print " <td>"; |
60 | 60 | # booleans |
61 | - if($field['type']=="tinyint(1)") { |
|
61 | + if($field['type']=="tinyint(1)") { |
|
62 | 62 | if($folder[$field['name']] == 0) { print _("No"); } |
63 | 63 | elseif($folder[$field['name']] == 1) { print _("Yes"); } |
64 | 64 | } |
@@ -112,26 +112,36 @@ discard block |
||
112 | 112 | print "<div class='btn-group'>"; |
113 | 113 | |
114 | 114 | //warning |
115 | - if($folder_permission == 1) |
|
116 | - print "<button class='btn btn-xs btn-default btn-danger' data-container='body' rel='tooltip' title='"._('You do not have permissions to edit subnet or IP addresses')."'><i class='fa fa-lock'></i></button> "; |
|
115 | + if($folder_permission == 1) { |
|
116 | + print "<button class='btn btn-xs btn-default btn-danger' data-container='body' rel='tooltip' title='"._('You do not have permissions to edit subnet or IP addresses')."'><i class='fa fa-lock'></i></button> "; |
|
117 | + } |
|
117 | 118 | |
118 | 119 | // edit subnet |
119 | - if($sp['editsubnet']) |
|
120 | - print "<a class='add_folder btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._('Edit folder')."' data-action='edit' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]'><i class='fa fa-pencil'></i></a>"; //edit subnet |
|
121 | - else |
|
122 | - print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._('Edit folder')."' > <i class='fa fa-pencil'></i></a>"; //edit subnet |
|
120 | + if($sp['editsubnet']) { |
|
121 | + print "<a class='add_folder btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._('Edit folder')."' data-action='edit' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]'><i class='fa fa-pencil'></i></a>"; |
|
122 | + } |
|
123 | + //edit subnet |
|
124 | + else { |
|
125 | + print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._('Edit folder')."' > <i class='fa fa-pencil'></i></a>"; |
|
126 | + } |
|
127 | + //edit subnet |
|
123 | 128 | |
124 | 129 | //permissions |
125 | - if($sp['editperm']) |
|
126 | - print "<a class='showSubnetPerm btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._('Manage folder permissions')."' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]' data-action='show'> <i class='fa fa-tasks'></i></a>"; //edit subnet |
|
127 | - else |
|
128 | - print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._('Manage folder permissions')."'> <i class='fa fa-tasks'></i></a>"; //edit subnet |
|
130 | + if($sp['editperm']) { |
|
131 | + print "<a class='showSubnetPerm btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._('Manage folder permissions')."' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]' data-action='show'> <i class='fa fa-tasks'></i></a>"; |
|
132 | + } |
|
133 | + //edit subnet |
|
134 | + else { |
|
135 | + print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._('Manage folder permissions')."'> <i class='fa fa-tasks'></i></a>"; |
|
136 | + } |
|
137 | + //edit subnet |
|
129 | 138 | |
130 | 139 | // add nested subnet |
131 | 140 | if($folder_permission_section == 3) { |
132 | 141 | print "<a class='edit_subnet btn btn-xs btn-default ' href='' data-container='body' rel='tooltip' title='"._('Add new nested subnet')."' data-subnetId='$folder[id]' data-action='add' data-id='' data-sectionId='$folder[sectionId]'> <i class='fa fa-plus-circle'></i></a> "; |
133 | 142 | print "<a class='add_folder btn btn-xs btn-default ' href='' rel='tooltip' data-container='body' title='"._('Add new nested folder')."' data-subnetId='$folder[id]' data-action='add' data-id='' data-sectionId='$folder[sectionId]'> <i class='fa fa-folder-close-o'></i></a> "; //add new child subnet |
134 | - } else { |
|
143 | + } |
|
144 | + else { |
|
135 | 145 | print "<a class='btn btn-xs btn-default disabled' href=''> <i class='fa fa-plus-circle'></i></a> "; |
136 | 146 | print "<a class='btn btn-xs btn-default disabled' href=''> <i class='fa fa-folder-close-o'></i></a> "; //add new child subnet |
137 | 147 | } |
@@ -149,10 +159,12 @@ discard block |
||
149 | 159 | # export / import |
150 | 160 | print "<div class='btn-group'>"; |
151 | 161 | //import |
152 | - if($sp['import']) |
|
153 | - print "<a class='csvImport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._('Import IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-download'></i></a>"; |
|
154 | - else |
|
155 | - print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._('Import IP addresses')."'> <i class='fa fa-download'></i></a>"; |
|
162 | + if($sp['import']) { |
|
163 | + print "<a class='csvImport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._('Import IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-download'></i></a>"; |
|
164 | + } |
|
165 | + else { |
|
166 | + print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._('Import IP addresses')."'> <i class='fa fa-download'></i></a>"; |
|
167 | + } |
|
156 | 168 | //export |
157 | 169 | print "<a class='csvExport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._('Export IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-upload'></i></a>"; |
158 | 170 | print "</div>"; |
@@ -160,16 +172,20 @@ discard block |
||
160 | 172 | # favourites / changelog |
161 | 173 | print "<div class='btn-group'>"; |
162 | 174 | #favourite |
163 | - if($User->is_folder_favourite ($folder['id'])) |
|
164 | - print "<a class='btn btn-xs btn-default btn-info editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._('Click to remove from favourites')."' data-subnetId='$folder[id]' data-action='remove'><i class='fa fa-star'></i></a> "; |
|
165 | - else |
|
166 | - print "<a class='btn btn-xs btn-default editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._('Click to add to favourites')."' data-subnetId='$folder[id]' data-action='add'> <i class='fa fa-star fa-star-o' ></i></a> "; |
|
175 | + if($User->is_folder_favourite ($folder['id'])) { |
|
176 | + print "<a class='btn btn-xs btn-default btn-info editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._('Click to remove from favourites')."' data-subnetId='$folder[id]' data-action='remove'><i class='fa fa-star'></i></a> "; |
|
177 | + } |
|
178 | + else { |
|
179 | + print "<a class='btn btn-xs btn-default editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._('Click to add to favourites')."' data-subnetId='$folder[id]' data-action='add'> <i class='fa fa-star fa-star-o' ></i></a> "; |
|
180 | + } |
|
167 | 181 | # changelog |
168 | 182 | if($User->settings->enableChangelog==1) { |
169 | - if($sp['changelog']) |
|
170 | - print "<a class='sChangelog btn btn-xs btn-default' href='".create_link("subnets",$folder['sectionId'],$folder['id'],"changelog")."' data-container='body' rel='tooltip' title='"._('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
171 | - else |
|
172 | - print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
183 | + if($sp['changelog']) { |
|
184 | + print "<a class='sChangelog btn btn-xs btn-default' href='".create_link("subnets",$folder['sectionId'],$folder['id'],"changelog")."' data-container='body' rel='tooltip' title='"._('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
185 | + } |
|
186 | + else { |
|
187 | + print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
188 | + } |
|
173 | 189 | } |
174 | 190 | print "</div>"; |
175 | 191 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | elseif(strlen($search_term)==17 && substr_count($search_term, ":") == 5) { |
36 | 36 | $type = "mac"; //count : -> must be 5 |
37 | 37 | } |
38 | -else if(strlen($search_term) == 12 && (substr_count($search_term, ":") == 0) && (substr_count($search_term, ".") == 0)){ |
|
38 | +else if(strlen($search_term) == 12 && (substr_count($search_term, ":") == 0) && (substr_count($search_term, ".") == 0)) { |
|
39 | 39 | $type = "mac"; //no dots or : -> mac without : |
40 | 40 | } |
41 | 41 | else { |
@@ -167,7 +167,8 @@ discard block |
||
167 | 167 | $vlanText .= ")"; |
168 | 168 | } |
169 | 169 | } |
170 | - } else { |
|
170 | + } |
|
171 | + else { |
|
171 | 172 | $vlanText = ""; |
172 | 173 | } |
173 | 174 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | elseif(strlen($search_term)==17 && substr_count($search_term, ":") == 5) { |
50 | 50 | $type = "mac"; //count : -> must be 5 |
51 | 51 | } |
52 | -else if(strlen($search_term) == 12 && (substr_count($search_term, ":") == 0) && (substr_count($search_term, ".") == 0)){ |
|
52 | +else if(strlen($search_term) == 12 && (substr_count($search_term, ":") == 0) && (substr_count($search_term, ".") == 0)) { |
|
53 | 53 | $type = "mac"; //no dots or : -> mac without : |
54 | 54 | } |
55 | 55 | else { |
@@ -189,7 +189,8 @@ discard block |
||
189 | 189 | //folder? |
190 | 190 | if($line['isFolder']==1) { |
191 | 191 | print ' <td><a href="'.create_link("subnets",$line['sectionId'],$line['id']).'"><i class="fa fa-folder-o fa fa-gray"></i> '.$line['description'].'</a></td>'. "\n"; |
192 | - } else { |
|
192 | + } |
|
193 | + else { |
|
193 | 194 | print ' <td><a href="'.create_link("subnets",$line['sectionId'],$line['id']).'">'. $Subnets->transform_to_dotted($line['subnet']) . '/'.$line['mask'].'</a></td>'. "\n"; |
194 | 195 | } |
195 | 196 | print ' <td><a href="'.create_link("subnets",$line['sectionId'],$line['id']).'">'. $line['description'] .'</a></td>' . "\n"; |
@@ -214,7 +215,8 @@ discard block |
||
214 | 215 | if($subnet_permission > 1) { |
215 | 216 | if(@$master_subnet['isFolder']==1) { |
216 | 217 | print " <td><button class='btn btn-xs btn-default add_folder' data-action='edit' data-subnetId='$line[id]' data-sectionId='$line[sectionId]' href='#' rel='tooltip' data-container='body' title='"._('Edit folder details')."'> <i class='fa fa-gray fa fa-pencil'> </i></a>"; |
217 | - } else { |
|
218 | + } |
|
219 | + else { |
|
218 | 220 | print " <td><button class='btn btn-xs btn-default edit_subnet' data-action='edit' data-subnetId='$line[id]' data-sectionId='$line[sectionId]' href='#' rel='tooltip' data-container='body' title='"._('Edit subnet details')."'> <i class='fa fa-gray fa fa-pencil'> </i></a>"; |
219 | 221 | } |
220 | 222 | } |
@@ -324,7 +326,7 @@ discard block |
||
324 | 326 | print ' </td>'. "\n"; |
325 | 327 | } |
326 | 328 | //device |
327 | - if(in_array('switch', $selected_ip_fields)) { |
|
329 | + if(in_array('switch', $selected_ip_fields)) { |
|
328 | 330 | if(strlen($line['switch'])>0 && $line['switch']!="0") { |
329 | 331 | # get switch |
330 | 332 | $switch = (array) $Tools->fetch_object("devices", "id", $line['switch']); |
@@ -362,7 +364,7 @@ discard block |
||
362 | 364 | //custom fields |
363 | 365 | if(sizeof($custom_address_fields) > 0) { |
364 | 366 | foreach($custom_address_fields as $field) { |
365 | - if(!in_array($field['name'], $hidden_address_fields)){ |
|
367 | + if(!in_array($field['name'], $hidden_address_fields)) { |
|
366 | 368 | $line[$field['name']] = $Result->create_links ($line[$field['name']], $field['type']); |
367 | 369 | print '<td class="customField hidden-sm hidden-xs hidden-md">'. $line[$field['name']] .'</td>'. "\n"; |
368 | 370 | } |
@@ -14,7 +14,16 @@ |
||
14 | 14 | } |
15 | 15 | ?> |
16 | 16 | |
17 | -<table class="<?php if(!$popup) print "subnet-mask-table sorted-left";?> table table-striped <?php if($popup) print 'table-condensed'; ?> table-top <?php if(!$popup) print 'table-auto'; ?>"> |
|
17 | +<table class="<?php if(!$popup) { |
|
18 | + print "subnet-mask-table sorted-left"; |
|
19 | +} |
|
20 | +?> table table-striped <?php if($popup) { |
|
21 | + print 'table-condensed'; |
|
22 | +} |
|
23 | +?> table-top <?php if(!$popup) { |
|
24 | + print 'table-auto'; |
|
25 | +} |
|
26 | +?>"> |
|
18 | 27 | |
19 | 28 | <!-- headers --> |
20 | 29 | <thead> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | else { $permission = 0; } |
65 | 65 | |
66 | 66 | # printout |
67 | - if($permission > 0) { |
|
67 | + if($permission > 0) { |
|
68 | 68 | # format diff |
69 | 69 | $l['cdiff'] = str_replace("\n", "<br>", $l['cdiff']); |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | switch($l['ctype']) { |
73 | 73 | case "ip_addr": $l['ctype'] = "IP address"; break; |
74 | 74 | case "subnet": if($l['isFolder']==1) { $l['ctype'] = "Folder"; } |
75 | - else { $l['ctype'] = "Subnet"; } |
|
75 | + else { $l['ctype'] = "Subnet"; } |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case "section": $l['ctype'] = "Section"; break; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | print " <td>$l[ctype]</td>"; |
84 | 84 | |
85 | 85 | # subnet, section or ip address |
86 | - if($l['ctype']=="IP address") { |
|
86 | + if($l['ctype']=="IP address") { |
|
87 | 87 | print " <td><a href='".create_link("subnets",$l['sectionId'],$l['subnetId'],"address-details",$l['tid'])."'>".$Subnets->transform_address($l['ip_addr'],"dotted")."</a></td>"; |
88 | 88 | } |
89 | - elseif($l['ctype']=="Subnet") { |
|
89 | + elseif($l['ctype']=="Subnet") { |
|
90 | 90 | print " <td><a href='".create_link("subnets",$l['sectionId'],$l['tid'])."'>".$Subnets->transform_address($l['ip_addr'],"dotted")."/$l[mask]</a></td>"; |
91 | 91 | } |
92 | - elseif($l['ctype']=="Folder") { |
|
92 | + elseif($l['ctype']=="Folder") { |
|
93 | 93 | print " <td><a href='".create_link("folder",$l['sectionId'],$l['tid'])."'>$l[sDescription]</a></td>"; |
94 | 94 | } |
95 | - elseif($l['ctype']=="Section") { |
|
95 | + elseif($l['ctype']=="Section") { |
|
96 | 96 | print " <td><a href='".create_link("subnets",$l['tid'])."'>".$l['ip_addr']."</a></td>"; |
97 | 97 | } |
98 | 98 | else { |
@@ -134,7 +134,9 @@ |
||
134 | 134 | foreach ($split as $d) { |
135 | 135 | // nulls |
136 | 136 | foreach($d as $k=>$v) { |
137 | - if (strlen($v)==0) $d->$k = "<span class='muted'>/</span>"; |
|
137 | + if (strlen($v)==0) { |
|
138 | + $d->$k = "<span class='muted'>/</span>"; |
|
139 | + } |
|
138 | 140 | } |
139 | 141 | // cont records |
140 | 142 | $cnt = $PowerDNS->count_domain_records ($d->id); |
@@ -60,7 +60,8 @@ discard block |
||
60 | 60 | $pdns_section = $_GET['subnetId']; |
61 | 61 | if (preg_match("/reverse_/", $pdns_section)) { |
62 | 62 | $filename = 'domains.php'; |
63 | - } else { |
|
63 | + } |
|
64 | + else { |
|
64 | 65 | $filename = "$_GET[subnetId].php"; |
65 | 66 | } |
66 | 67 | |
@@ -71,7 +72,8 @@ discard block |
||
71 | 72 | </div> |
72 | 73 | |
73 | 74 | <?php |
74 | - } else { |
|
75 | + } |
|
76 | + else { |
|
75 | 77 | $Result->show("info", _('Please enable powerDNS module under server management'), false); |
76 | 78 | } |
77 | 79 | ?> |
@@ -102,18 +102,22 @@ discard block |
||
102 | 102 | $subnet_usage = $Subnets->calculate_subnet_usage ($addresses_cnt, $subnet->mask, $subnet->subnet, $subnet->isFull ); //Calculate free/used etc |
103 | 103 | |
104 | 104 | // description |
105 | - if($subnet->isFolder=="1") |
|
106 | - $subnet->description = strlen($subnet->description)>0 ? $subnet->description : ""; |
|
107 | - else |
|
108 | - $subnet->description = strlen($subnet->description)>0 ? "[".$subnet->description."]" : ""; |
|
105 | + if($subnet->isFolder=="1") { |
|
106 | + $subnet->description = strlen($subnet->description)>0 ? $subnet->description : ""; |
|
107 | + } |
|
108 | + else { |
|
109 | + $subnet->description = strlen($subnet->description)>0 ? "[".$subnet->description."]" : ""; |
|
110 | + } |
|
109 | 111 | |
110 | 112 | # section names |
111 | 113 | print " <tr class='subnets-title'>"; |
112 | 114 | print " <td colspan='$colSpan' style='padding-top:20px;'>"; |
113 | - if($subnet->isFolder=="1") |
|
114 | - print " <h4><i class='fa fa-folder-o fa-gray'></i> $subnet->description</h4>"; |
|
115 | - else |
|
116 | - print " <h4>".$Subnets->transform_address($subnet->subnet, "dotted")."/$subnet->mask $subnet->description</h4>"; |
|
115 | + if($subnet->isFolder=="1") { |
|
116 | + print " <h4><i class='fa fa-folder-o fa-gray'></i> $subnet->description</h4>"; |
|
117 | + } |
|
118 | + else { |
|
119 | + print " <h4>".$Subnets->transform_address($subnet->subnet, "dotted")."/$subnet->mask $subnet->description</h4>"; |
|
120 | + } |
|
117 | 121 | |
118 | 122 | print " </td>"; |
119 | 123 | print "</tr>"; |
@@ -164,7 +168,7 @@ discard block |
||
164 | 168 | } |
165 | 169 | // multicast ? |
166 | 170 | if ($User->settings->enableMulticast=="1" && $Subnets->is_multicast ($address->ip_addr)) { print "<td class='$mclass' style='white-space:nowrap;'>".$address->mac." $minfo</td>"; } |
167 | - elseif(!empty($address->mac)) { print "<td class='narrow'><i class='info fa fa-gray fa-sitemap' rel='tooltip' data-container='body' title='"._('MAC').": ".$address->mac."'></i></td>"; } |
|
171 | + elseif(!empty($address->mac)) { print "<td class='narrow'><i class='info fa fa-gray fa-sitemap' rel='tooltip' data-container='body' title='"._('MAC').": ".$address->mac."'></i></td>"; } |
|
168 | 172 | else { print "<td class='narrow'></td>"; } |
169 | 173 | } |
170 | 174 | |
@@ -191,14 +195,14 @@ discard block |
||
191 | 195 | # print custom fields |
192 | 196 | if(sizeof($custom_fields) > 0) { |
193 | 197 | foreach($custom_fields as $myField) { |
194 | - if(!in_array($myField['name'], $hidden_cfields)) { |
|
198 | + if(!in_array($myField['name'], $hidden_cfields)) { |
|
195 | 199 | print "<td class='customField hidden-xs hidden-sm hidden-md'>"; |
196 | 200 | |
197 | 201 | // create html links |
198 | 202 | $address->$myField['name'] = $Result->create_links($address->$myField['name'], $myField['type']); |
199 | 203 | |
200 | 204 | //booleans |
201 | - if($myField['type']=="tinyint(1)") { |
|
205 | + if($myField['type']=="tinyint(1)") { |
|
202 | 206 | if($address->$myField['name'] == "0") { print _("No"); } |
203 | 207 | elseif($address->$myField['name'] == "1") { print _("Yes"); } |
204 | 208 | } |
@@ -246,8 +250,9 @@ discard block |
||
246 | 250 | print "<tr>"; |
247 | 251 | print " <td colspan='$colSpan'>"; |
248 | 252 | // if full prevent new |
249 | - if($subnet_usage['freehosts']>0 && $sp['addip']) |
|
250 | - print " <a class='modIPaddr btn btn-sm btn-default pull-right' href='' data-subnetId='$subnet->id' data-action='add' data-id=''> <i class='fa fa-plus'> "._("Add new address")."</i></a> "; |
|
253 | + if($subnet_usage['freehosts']>0 && $sp['addip']) { |
|
254 | + print " <a class='modIPaddr btn btn-sm btn-default pull-right' href='' data-subnetId='$subnet->id' data-action='add' data-id=''> <i class='fa fa-plus'> "._("Add new address")."</i></a> "; |
|
255 | + } |
|
251 | 256 | print " <span class='clearfix'></span><hr>"; |
252 | 257 | print " </td>"; |
253 | 258 | print "</tr>"; |
@@ -31,9 +31,10 @@ |
||
31 | 31 | <td> |
32 | 32 | <?php |
33 | 33 | require_once('../../../functions/functions.php'); |
34 | - if(isset($_POST['ip_addr'])){ |
|
34 | + if(isset($_POST['ip_addr'])) { |
|
35 | 35 | $first = $_POST['ip_addr']; |
36 | - }else{ |
|
36 | + } |
|
37 | + else { |
|
37 | 38 | # get first IP address |
38 | 39 | $first = $Subnets->transform_to_dotted($Addresses->get_first_available_address ($_POST['subnetId'], $Subnets)); |
39 | 40 | } |