@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | # print all domains or show records |
3 | -if (@$_GET['sPage']=="page") { include("domains-print.php"); } |
|
4 | -elseif (@$_GET['sPage']=="search") { include("domains-print.php"); } |
|
5 | -elseif (isset($_GET['sPage'])) { include("domain-records.php"); } |
|
6 | -else { include("domains-print.php"); } |
|
3 | +if (@$_GET['sPage'] == "page") { include("domains-print.php"); } |
|
4 | +elseif (@$_GET['sPage'] == "search") { include("domains-print.php"); } |
|
5 | +elseif (isset($_GET['sPage'])) { include("domain-records.php"); } |
|
6 | +else { include("domains-print.php"); } |
|
7 | 7 | ?> |
8 | 8 | \ No newline at end of file |
@@ -5,21 +5,21 @@ |
||
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 custom fields |
11 | -$custom = $Tools->fetch_custom_fields('racks'); |
|
11 | +$custom = $Tools->fetch_custom_fields ('racks'); |
|
12 | 12 | |
13 | 13 | # get hidden fields |
14 | -$hidden_custom_fields = json_decode($User->settings->hiddenCustomFields, true); |
|
15 | -$hidden_custom_fields = is_array(@$hidden_custom_fields['racks']) ? $hidden_custom_fields['racks'] : array(); |
|
14 | +$hidden_custom_fields = json_decode ($User->settings->hiddenCustomFields, true); |
|
15 | +$hidden_custom_fields = is_array (@$hidden_custom_fields['racks']) ? $hidden_custom_fields['racks'] : array (); |
|
16 | 16 | |
17 | 17 | # create csrf token |
18 | 18 | $csrf = $User->create_csrf_cookie (); |
19 | 19 | |
20 | 20 | |
21 | 21 | # all racks or one ? |
22 | -if (isset($_GET['subnetId'])) { include("print-single-rack.php"); } |
|
23 | -else { include("print-racks.php"); } |
|
22 | +if (isset($_GET['subnetId'])) { include("print-single-rack.php"); } |
|
23 | +else { include("print-racks.php"); } |
|
24 | 24 | |
25 | 25 | ?> |
26 | 26 | \ No newline at end of file |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | *************************************************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # create csrf token |
11 | 11 | $csrf = $User->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 |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * @param Database_PDO $Database |
55 | 55 | * @param mixed $settings (default: null) |
56 | 56 | */ |
57 | - public function __construct (Database_PDO $Database, $settings=null) { |
|
57 | + public function __construct (Database_PDO $Database, $settings = null) { |
|
58 | 58 | # initialize Result |
59 | 59 | $this->Result = new Result (); |
60 | 60 | # initialize object |
61 | 61 | $this->Database = $Database; |
62 | 62 | // settings |
63 | - $this->settings = !is_null($settings) ? (object) $settings : $this->get_settings (); |
|
63 | + $this->settings = !is_null ($settings) ? (object) $settings : $this->get_settings (); |
|
64 | 64 | // initialize resolver |
65 | 65 | $this->initialize_pear_net_DNS2 (); |
66 | 66 | } |
@@ -75,20 +75,20 @@ discard block |
||
75 | 75 | */ |
76 | 76 | private function set_nameservers ($nsid = null) { |
77 | 77 | // null ? |
78 | - if (is_null($nsid)) { return false; } |
|
78 | + if (is_null ($nsid)) { return false; } |
|
79 | 79 | // not numeric |
80 | - elseif (!is_numeric($nsid)) { return false; } |
|
80 | + elseif (!is_numeric ($nsid)) { return false; } |
|
81 | 81 | // ok |
82 | 82 | else { |
83 | 83 | // fetch nameservers |
84 | - $nameservers = $this->fetch_object ("nameservers", "id", $nsid); |
|
84 | + $nameservers = $this->fetch_object ("nameservers", "id", $nsid); |
|
85 | 85 | // error |
86 | - if ($nameservers===false) { return false; } |
|
86 | + if ($nameservers === false) { return false; } |
|
87 | 87 | // ok |
88 | 88 | else { |
89 | - if (strlen($nameservers->namesrv1)==0) { return false; } |
|
89 | + if (strlen ($nameservers->namesrv1) == 0) { return false; } |
|
90 | 90 | else { |
91 | - $this->ns = explode(";", $nameservers->namesrv1); |
|
91 | + $this->ns = explode (";", $nameservers->namesrv1); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | } |
@@ -112,36 +112,36 @@ discard block |
||
112 | 112 | $address = $this->transform_address ($address, "dotted"); |
113 | 113 | |
114 | 114 | // if both are set ignore |
115 | - if (strlen($hostname)>1 && strlen($address)>0) { |
|
116 | - { return array("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
115 | + if (strlen ($hostname) > 1 && strlen ($address) > 0) { |
|
116 | + { return array ("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
117 | 117 | } |
118 | 118 | // if settings permits to check or override is set |
119 | - elseif($this->settings->enableDNSresolving == 1 || $override===true) { |
|
119 | + elseif ($this->settings->enableDNSresolving == 1 || $override === true) { |
|
120 | 120 | // if address is set fetch A record |
121 | - if ($address!==false && strlen($address)>0) { |
|
121 | + if ($address !== false && strlen ($address) > 0) { |
|
122 | 122 | // set resolve type |
123 | 123 | $this->type = "PTR"; |
124 | 124 | |
125 | 125 | // resolve |
126 | 126 | $resolved = $this->resolve_address_net_dns ($address); |
127 | 127 | // false ? |
128 | - if ($resolved===false) { return array("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
129 | - else { return array("class"=>"resolved", "address"=>$address, "name"=>$resolved); } |
|
128 | + if ($resolved === false) { return array ("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
129 | + else { return array ("class"=>"resolved", "address"=>$address, "name"=>$resolved); } |
|
130 | 130 | } |
131 | 131 | // if hostname is set fetch PTR record |
132 | - elseif($hostname!==false && strlen($hostname)>0) { |
|
132 | + elseif ($hostname !== false && strlen ($hostname) > 0) { |
|
133 | 133 | // set resolve type |
134 | 134 | $this->type = "A"; |
135 | 135 | |
136 | 136 | // resolve |
137 | 137 | $resolved = $this->resolve_address_net_dns ($hostname); |
138 | 138 | // false ? |
139 | - if ($resolved===false) { return array("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
140 | - else { return array("class"=>"resolved", "address"=>$resolved, "name"=>$hostname); } |
|
139 | + if ($resolved === false) { return array ("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
140 | + else { return array ("class"=>"resolved", "address"=>$resolved, "name"=>$hostname); } |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | // dont check |
144 | - else { return array("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
144 | + else { return array ("class"=>"", "address"=>$address, "name"=>$hostname); } |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -158,19 +158,19 @@ discard block |
||
158 | 158 | |
159 | 159 | // try to get record |
160 | 160 | try { |
161 | - $result = $this->DNS2->query($address, $this->type); |
|
162 | - } catch(Net_DNS2_Exception $e) { |
|
161 | + $result = $this->DNS2->query ($address, $this->type); |
|
162 | + } catch (Net_DNS2_Exception $e) { |
|
163 | 163 | // log error |
164 | - $this->resolve_error = $e->getMessage(); |
|
164 | + $this->resolve_error = $e->getMessage (); |
|
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // return response |
169 | 169 | if (isset($result->answer)) { |
170 | 170 | // set what to search |
171 | - $search = $this->type=="PTR" ? "ptrdname" : "address"; |
|
171 | + $search = $this->type == "PTR" ? "ptrdname" : "address"; |
|
172 | 172 | |
173 | - foreach($result->answer as $mxrr) { |
|
173 | + foreach ($result->answer as $mxrr) { |
|
174 | 174 | if ($mxrr->$search) { |
175 | 175 | return $mxrr->$search; |
176 | 176 | } |
@@ -5,19 +5,19 @@ |
||
5 | 5 | **********************************************/ |
6 | 6 | |
7 | 7 | /* fetch instructions and print them in instructions div */ |
8 | -$instructions = $Tools->fetch_object("instructions", "id", 1); |
|
8 | +$instructions = $Tools->fetch_object ("instructions", "id", 1); |
|
9 | 9 | $instructions = $instructions->instructions; |
10 | 10 | |
11 | 11 | /* format line breaks */ |
12 | -$instructions = stripslashes($instructions); //show html |
|
12 | +$instructions = stripslashes ($instructions); //show html |
|
13 | 13 | |
14 | 14 | /* prevent <script> */ |
15 | -$instructions = str_replace("<script", "<div class='error'><xmp><script", $instructions); |
|
16 | -$instructions = str_replace("</script>", "</script></xmp></div>", $instructions); |
|
15 | +$instructions = str_replace ("<script", "<div class='error'><xmp><script", $instructions); |
|
16 | +$instructions = str_replace ("</script>", "</script></xmp></div>", $instructions); |
|
17 | 17 | |
18 | 18 | ?> |
19 | 19 | |
20 | -<h4><?php print _('Instructions for managing IP addresses');?></h4> |
|
20 | +<h4><?php print _ ('Instructions for managing IP addresses'); ?></h4> |
|
21 | 21 | <hr> |
22 | 22 | |
23 | 23 | <div class="instructions well"> |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | |
19 | 19 | php 5.3.7 required |
20 | 20 | */ |
21 | -$db['ssl'] = false; # true/false, enable or disable SSL as a whole |
|
22 | -$db['ssl_key'] = "/path/to/cert.key"; # path to an SSL key file. Only makes sense combined with ssl_cert |
|
23 | -$db['ssl_cert'] = "/path/to/cert.crt"; # path to an SSL certificate file. Only makes sense combined with ssl_key |
|
24 | -$db['ssl_ca'] = "/path/to/ca.crt"; # path to a file containing SSL CA certs |
|
25 | -$db['ssl_capath'] = "/path/to/ca_certs"; # path to a directory containing CA certs |
|
21 | +$db['ssl'] = false; # true/false, enable or disable SSL as a whole |
|
22 | +$db['ssl_key'] = "/path/to/cert.key"; # path to an SSL key file. Only makes sense combined with ssl_cert |
|
23 | +$db['ssl_cert'] = "/path/to/cert.crt"; # path to an SSL certificate file. Only makes sense combined with ssl_key |
|
24 | +$db['ssl_ca'] = "/path/to/ca.crt"; # path to a file containing SSL CA certs |
|
25 | +$db['ssl_capath'] = "/path/to/ca_certs"; # path to a directory containing CA certs |
|
26 | 26 | $db['ssl_cipher'] = "DHE-RSA-AES256-SHA:AES128-SHA"; # one or more SSL Ciphers |
27 | 27 | |
28 | 28 | /** |
@@ -47,36 +47,36 @@ discard block |
||
47 | 47 | * Also change |
48 | 48 | * RewriteBase / in .htaccess |
49 | 49 | ******************************/ |
50 | -if(!defined('BASE')) |
|
51 | -define('BASE', "/"); |
|
50 | +if (!defined ('BASE')) |
|
51 | +define ('BASE', "/"); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Multicast unique mac requirement - section or vlan |
55 | 55 | */ |
56 | -if(!defined('MCUNIQUE')) |
|
57 | -define('MCUNIQUE', "section"); |
|
56 | +if (!defined ('MCUNIQUE')) |
|
57 | +define ('MCUNIQUE', "section"); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /* proxy connection details |
61 | 61 | ******************************/ |
62 | -$proxy_enabled = false; # Enable/Disable usage of the Proxy server |
|
63 | -$proxy_server = "myproxy.something.com"; # Proxy server FQDN or IP |
|
64 | -$proxy_port = "8080"; # Proxy server port |
|
65 | -$proxy_user = "USERNAME"; # Proxy Username |
|
66 | -$proxy_pass = "PASSWORD"; # Proxy Password |
|
67 | -$proxy_use_auth = false; # Enable/Disable Proxy authentication |
|
62 | +$proxy_enabled = false; # Enable/Disable usage of the Proxy server |
|
63 | +$proxy_server = "myproxy.something.com"; # Proxy server FQDN or IP |
|
64 | +$proxy_port = "8080"; # Proxy server port |
|
65 | +$proxy_user = "USERNAME"; # Proxy Username |
|
66 | +$proxy_pass = "PASSWORD"; # Proxy Password |
|
67 | +$proxy_use_auth = false; # Enable/Disable Proxy authentication |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * proxy to use for every internet access like update check |
71 | 71 | */ |
72 | -$proxy_auth = base64_encode("$proxy_user:$proxy_pass"); |
|
72 | +$proxy_auth = base64_encode ("$proxy_user:$proxy_pass"); |
|
73 | 73 | |
74 | 74 | if ($proxy_enabled == true && $proxy_use_auth == false) { |
75 | - stream_context_set_default(array('http' => array('proxy'=>'tcp://'.$proxy_server.':'.$proxy_port))); |
|
75 | + stream_context_set_default (array ('http' => array ('proxy'=>'tcp://'.$proxy_server.':'.$proxy_port))); |
|
76 | 76 | } |
77 | 77 | elseif ($proxy_enabled == true && $proxy_use_auth == true) { |
78 | - stream_context_set_default( |
|
79 | - array('http' => array( |
|
78 | + stream_context_set_default ( |
|
79 | + array ('http' => array ( |
|
80 | 80 | 'proxy' => "tcp://$proxy_server:$proxy_port", |
81 | 81 | 'request_fulluri' => true, |
82 | 82 | 'header' => "Proxy-Authorization: Basic $proxy_auth" |
@@ -5,22 +5,22 @@ |
||
5 | 5 | <td> |
6 | 6 | <?php |
7 | 7 | // set href |
8 | - $href = REVISION=="000" ? "http://phpipam.net" : "http://phpipam.net"; |
|
8 | + $href = REVISION == "000" ? "http://phpipam.net" : "http://phpipam.net"; |
|
9 | 9 | ?> |
10 | - <a href="<?php print $href; ?>">phpIPAM IP address management <?php print '[v'. VERSION. ']'; ?><?php if(REVISION > 0) { print " rev".REVISION; } ?></a> |
|
10 | + <a href="<?php print $href; ?>">phpIPAM IP address management <?php print '[v'.VERSION.']'; ?><?php if (REVISION > 0) { print " rev".REVISION; } ?></a> |
|
11 | 11 | </td> |
12 | 12 | |
13 | 13 | <?php |
14 | 14 | # exclude install |
15 | - if($_GET['page']!="install") { ?> |
|
15 | + if ($_GET['page'] != "install") { ?> |
|
16 | 16 | <td> |
17 | - <?php print _('In case of problems please contact').' <a href="mailto:'. $User->settings->siteAdminMail .'">'. $User->settings->siteAdminName .'</a>'; ?> |
|
17 | + <?php print _ ('In case of problems please contact').' <a href="mailto:'.$User->settings->siteAdminMail.'">'.$User->settings->siteAdminName.'</a>'; ?> |
|
18 | 18 | </td> |
19 | 19 | <?php |
20 | 20 | /* hide donations button */ |
21 | - if($User->settings->donate == 0) { |
|
21 | + if ($User->settings->donate == 0) { |
|
22 | 22 | |
23 | -print ' <td id="donate" class="hidden-xs hidden-sm" rel="tooltip" data-html="true" title="'._('phpIPAM is free, open-source project').'.<br>'._('If you like the software you can donate by clicking this button to support further development').'."> |
|
23 | +print ' <td id="donate" class="hidden-xs hidden-sm" rel="tooltip" data-html="true" title="'._ ('phpIPAM is free, open-source project').'.<br>'._ ('If you like the software you can donate by clicking this button to support further development').'."> |
|
24 | 24 | <input type="hidden" name="cmd" value="_s-xclick"> |
25 | 25 | <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----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-----END PKCS7----- |
26 | 26 | "> |
@@ -1,78 +1,78 @@ discard block |
||
1 | 1 | <!-- subnet details upper table --> |
2 | -<h4><?php print _('Subnet details'); ?></h4> |
|
2 | +<h4><?php print _ ('Subnet details'); ?></h4> |
|
3 | 3 | <hr> |
4 | 4 | |
5 | 5 | <table class="ipaddress_subnet table-condensed table-full"> |
6 | 6 | <tr> |
7 | - <th><?php print _('Subnet details'); ?></th> |
|
7 | + <th><?php print _ ('Subnet details'); ?></th> |
|
8 | 8 | <td><?php print "<b>$subnet[ip]/$subnet[mask]</b> ($subnet_detailed[netmask])"; ?></td> |
9 | 9 | </tr> |
10 | 10 | <tr> |
11 | - <th><?php print _('Hierarchy'); ?></th> |
|
11 | + <th><?php print _ ('Hierarchy'); ?></th> |
|
12 | 12 | <td> |
13 | - <?php $Subnets->print_breadcrumbs($Sections, $Subnets, array("page"=>"subnets", "section"=>$subnet['sectionId'], "subnetId"=>$subnet['id'])); ?> |
|
13 | + <?php $Subnets->print_breadcrumbs ($Sections, $Subnets, array ("page"=>"subnets", "section"=>$subnet['sectionId'], "subnetId"=>$subnet['id'])); ?> |
|
14 | 14 | </td> |
15 | 15 | </tr> |
16 | 16 | <tr> |
17 | - <th><?php print _('Subnet description'); ?></th> |
|
18 | - <td><?php print html_entity_decode($subnet['description']); ?></td> |
|
17 | + <th><?php print _ ('Subnet description'); ?></th> |
|
18 | + <td><?php print html_entity_decode ($subnet['description']); ?></td> |
|
19 | 19 | </tr> |
20 | 20 | <tr> |
21 | - <th><?php print _('Permission'); ?></th> |
|
22 | - <td><?php print $Subnets->parse_permissions($subnet_permission); ?></td> |
|
21 | + <th><?php print _ ('Permission'); ?></th> |
|
22 | + <td><?php print $Subnets->parse_permissions ($subnet_permission); ?></td> |
|
23 | 23 | </tr> |
24 | - <?php if(!$slaves) { ?> |
|
24 | + <?php if (!$slaves) { ?> |
|
25 | 25 | <tr> |
26 | - <th><?php print _('Subnet Usage'); ?></th> |
|
26 | + <th><?php print _ ('Subnet Usage'); ?></th> |
|
27 | 27 | <td> |
28 | 28 | <?php |
29 | - print ''._('Used').': '. $Subnets->reformat_number ($subnet_usage['used']) .' | |
|
30 | - '._('Free').': '. $Subnets->reformat_number ($subnet_usage['freehosts']) .' ('. $subnet_usage['freehosts_percent'] .'%) | |
|
31 | - '._('Total').': '. $Subnets->reformat_number ($subnet_usage['maxhosts']); |
|
29 | + print ''._ ('Used').': '.$Subnets->reformat_number ($subnet_usage['used']).' | |
|
30 | + '._ ('Free').': '.$Subnets->reformat_number ($subnet_usage['freehosts']).' ('.$subnet_usage['freehosts_percent'].'%) | |
|
31 | + '._ ('Total').': '.$Subnets->reformat_number ($subnet_usage['maxhosts']); |
|
32 | 32 | ?> |
33 | 33 | </td> |
34 | 34 | </tr> |
35 | 35 | |
36 | 36 | <!-- gateway --> |
37 | 37 | <?php |
38 | - $gateway = $Subnets->find_gateway($subnet['id']); |
|
39 | - if($gateway !==false) { ?> |
|
38 | + $gateway = $Subnets->find_gateway ($subnet['id']); |
|
39 | + if ($gateway !== false) { ?> |
|
40 | 40 | <tr> |
41 | - <th><?php print _('Gateway'); ?></th> |
|
42 | - <td><strong><?php print $Subnets->transform_to_dotted($gateway->ip_addr);?></strong></td> |
|
41 | + <th><?php print _ ('Gateway'); ?></th> |
|
42 | + <td><strong><?php print $Subnets->transform_to_dotted ($gateway->ip_addr); ?></strong></td> |
|
43 | 43 | </tr> |
44 | 44 | <?php } ?> |
45 | 45 | |
46 | 46 | <?php } ?> |
47 | 47 | <tr> |
48 | - <th><?php print _('VLAN'); ?></th> |
|
48 | + <th><?php print _ ('VLAN'); ?></th> |
|
49 | 49 | <td> |
50 | 50 | <?php |
51 | - if(empty($vlan['number']) || $vlan['number'] == 0) { $vlan['number'] = "<span class='text-muted'>/</span>"; } //Display fix for emprt VLAN |
|
51 | + if (empty($vlan['number']) || $vlan['number'] == 0) { $vlan['number'] = "<span class='text-muted'>/</span>"; } //Display fix for emprt VLAN |
|
52 | 52 | print $vlan['number']; |
53 | 53 | |
54 | - if(!empty($vlan['name'])) { print ' - '.$vlan['name']; } //Print name if provided |
|
55 | - if(!empty($vlan['description'])) { print ' ['. $vlan['description'] .']'; } //Print description if provided |
|
54 | + if (!empty($vlan['name'])) { print ' - '.$vlan['name']; } //Print name if provided |
|
55 | + if (!empty($vlan['description'])) { print ' ['.$vlan['description'].']'; } //Print description if provided |
|
56 | 56 | ?> |
57 | 57 | </td> |
58 | 58 | </tr> |
59 | 59 | |
60 | 60 | <?php |
61 | 61 | # VRF |
62 | - if(!empty($subnet['vrfId']) && $settings->enableVRF==1) { |
|
62 | + if (!empty($subnet['vrfId']) && $settings->enableVRF == 1) { |
|
63 | 63 | # get vrf details |
64 | - $vrf = (array) $Tools->fetch_object ("vrf", "vrfId" ,$subnet['vrfId']); |
|
64 | + $vrf = (array) $Tools->fetch_object ("vrf", "vrfId", $subnet['vrfId']); |
|
65 | 65 | # set text |
66 | 66 | $vrfText = $vrf['name']; |
67 | - if(!empty($vrf['description'])) { $vrfText .= " [$vrf[description]]";} |
|
67 | + if (!empty($vrf['description'])) { $vrfText .= " [$vrf[description]]"; } |
|
68 | 68 | |
69 | 69 | print "<tr>"; |
70 | - print " <th>"._('VRF')."</th>"; |
|
70 | + print " <th>"._ ('VRF')."</th>"; |
|
71 | 71 | print " <td>$vrfText</td>"; |
72 | 72 | print "</tr>"; |
73 | 73 | } |
74 | 74 | |
75 | - if(!$slaves) { |
|
75 | + if (!$slaves) { |
|
76 | 76 | # divider |
77 | 77 | print "<tr>"; |
78 | 78 | print " <th><hr></th>"; |
@@ -80,41 +80,41 @@ discard block |
||
80 | 80 | print "</tr>"; |
81 | 81 | |
82 | 82 | # Are IP requests allowed? |
83 | - if ($settings->enableIPrequests==1) { |
|
83 | + if ($settings->enableIPrequests == 1) { |
|
84 | 84 | print "<tr>"; |
85 | - print " <th>"._('IP requests')."</th>"; |
|
86 | - if($subnet['allowRequests'] == 1) { print " <td>"._('enabled')."</td>"; } # yes |
|
87 | - else { print " <td class='info2'>"._('disabled')."</td>";} # no |
|
85 | + print " <th>"._ ('IP requests')."</th>"; |
|
86 | + if ($subnet['allowRequests'] == 1) { print " <td>"._ ('enabled')."</td>"; } # yes |
|
87 | + else { print " <td class='info2'>"._ ('disabled')."</td>"; } # no |
|
88 | 88 | print "</tr>"; |
89 | 89 | } |
90 | 90 | # ping-check hosts inside subnet |
91 | 91 | print "<tr>"; |
92 | - print " <th>"._('Hosts check')."</th>"; |
|
93 | - if($subnet['pingSubnet'] == 1) { print " <td>"._('enabled')."</td>"; } # yes |
|
94 | - else { print " <td class='info2'>"._('disabled')."</td>";} # no |
|
92 | + print " <th>"._ ('Hosts check')."</th>"; |
|
93 | + if ($subnet['pingSubnet'] == 1) { print " <td>"._ ('enabled')."</td>"; } # yes |
|
94 | + else { print " <td class='info2'>"._ ('disabled')."</td>"; } # no |
|
95 | 95 | print "</tr>"; |
96 | 96 | # scan subnet for new hosts * |
97 | 97 | print "<tr>"; |
98 | - print " <th>"._('Discover new hosts')."</th>"; |
|
99 | - if($subnet['discoverSubnet'] == 1) { print " <td>"._('enabled')."</td>"; } # yes |
|
100 | - else { print " <td class='info2'>"._('disabled')."</td>";} # no |
|
98 | + print " <th>"._ ('Discover new hosts')."</th>"; |
|
99 | + if ($subnet['discoverSubnet'] == 1) { print " <td>"._ ('enabled')."</td>"; } # yes |
|
100 | + else { print " <td class='info2'>"._ ('disabled')."</td>"; } # no |
|
101 | 101 | print "</tr>"; |
102 | 102 | } |
103 | 103 | ?> |
104 | 104 | |
105 | 105 | <?php |
106 | 106 | # custom subnet fields |
107 | - if(sizeof($custom_fields) > 0) { |
|
108 | - foreach($custom_fields as $key=>$field) { |
|
109 | - if(strlen($subnet[$key])>0) { |
|
110 | - $subnet[$key] = str_replace(array("\n", "\r\n"), "<br>",$subnet[$key]); |
|
107 | + if (sizeof ($custom_fields) > 0) { |
|
108 | + foreach ($custom_fields as $key=>$field) { |
|
109 | + if (strlen ($subnet[$key]) > 0) { |
|
110 | + $subnet[$key] = str_replace (array ("\n", "\r\n"), "<br>", $subnet[$key]); |
|
111 | 111 | $html_custom[] = "<tr>"; |
112 | 112 | $html_custom[] = " <th>$key</th>"; |
113 | 113 | $html_custom[] = " <td>"; |
114 | 114 | #booleans |
115 | - if($field['type']=="tinyint(1)") { |
|
116 | - if($subnet[$key] == "0") { $html_custom[] = _("No"); } |
|
117 | - elseif($subnet[$key] == "1") { $html_custom[] = _("Yes"); } |
|
115 | + if ($field['type'] == "tinyint(1)") { |
|
116 | + if ($subnet[$key] == "0") { $html_custom[] = _ ("No"); } |
|
117 | + elseif ($subnet[$key] == "1") { $html_custom[] = _ ("Yes"); } |
|
118 | 118 | } |
119 | 119 | else { |
120 | 120 | $html_custom[] = $subnet[$key]; |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | # any? |
128 | - if(isset($html_custom)) { |
|
128 | + if (isset($html_custom)) { |
|
129 | 129 | # divider |
130 | 130 | print "<tr>"; |
131 | 131 | print " <th><hr></th>"; |
132 | 132 | print " <td></td>"; |
133 | 133 | print "</tr>"; |
134 | 134 | |
135 | - print implode("\n", $html_custom); |
|
135 | + print implode ("\n", $html_custom); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | print "<tr>"; |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | # reset custom fields to ip addresses |
15 | 15 | $custom_fields = $Tools->fetch_custom_fields ('ipaddresses'); |
16 | 16 | # set hidden custom fields |
17 | -$hidden_cfields = json_decode($settings->hiddenCustomFields, true); |
|
18 | -$hidden_cfields = is_array($hidden_cfields['ipaddresses']) ? $hidden_cfields['ipaddresses'] : array(); |
|
17 | +$hidden_cfields = json_decode ($settings->hiddenCustomFields, true); |
|
18 | +$hidden_cfields = is_array ($hidden_cfields['ipaddresses']) ? $hidden_cfields['ipaddresses'] : array (); |
|
19 | 19 | |
20 | 20 | # set selected address fields array |
21 | 21 | $selected_ip_fields = $settings->IPfilter; |
22 | -$selected_ip_fields = explode(";", $selected_ip_fields); //format to array |
|
23 | -$selected_ip_fields_size = in_array('state', $selected_ip_fields) ? (sizeof($selected_ip_fields)-1) : sizeof($selected_ip_fields); //set size of selected fields |
|
24 | -if($selected_ip_fields_size==1 && strlen($selected_ip_fields[0])==0) { $selected_ip_fields_size = 0; } //fix for 0 |
|
22 | +$selected_ip_fields = explode (";", $selected_ip_fields); //format to array |
|
23 | +$selected_ip_fields_size = in_array ('state', $selected_ip_fields) ? (sizeof ($selected_ip_fields) - 1) : sizeof ($selected_ip_fields); //set size of selected fields |
|
24 | +if ($selected_ip_fields_size == 1 && strlen ($selected_ip_fields[0]) == 0) { $selected_ip_fields_size = 0; } //fix for 0 |
|
25 | 25 | |
26 | 26 | |
27 | 27 | /* Addresses and fields manupulations */ |
@@ -30,28 +30,28 @@ discard block |
||
30 | 30 | $addresses_visual = $addresses; |
31 | 31 | |
32 | 32 | # set colspan for output |
33 | -$colspan['empty'] = $selected_ip_fields_size + sizeof($custom_fields) +4; //empty colspan |
|
34 | -$colspan['unused'] = $selected_ip_fields_size + sizeof($custom_fields) +3; //unused colspan |
|
35 | -$colspan['dhcp'] = $selected_ip_fields_size + sizeof($custom_fields); //dhcp colspan |
|
33 | +$colspan['empty'] = $selected_ip_fields_size + sizeof ($custom_fields) + 4; //empty colspan |
|
34 | +$colspan['unused'] = $selected_ip_fields_size + sizeof ($custom_fields) + 3; //unused colspan |
|
35 | +$colspan['dhcp'] = $selected_ip_fields_size + sizeof ($custom_fields); //dhcp colspan |
|
36 | 36 | |
37 | 37 | # remove custom fields if all are empty! |
38 | -foreach($custom_fields as $field) { |
|
39 | - $sizeMyFields[$field['name']] = 0; // default value |
|
38 | +foreach ($custom_fields as $field) { |
|
39 | + $sizeMyFields[$field['name']] = 0; // default value |
|
40 | 40 | # check against each IP address |
41 | - if($addresses!==false) { |
|
42 | - foreach($addresses as $ip) { |
|
41 | + if ($addresses !== false) { |
|
42 | + foreach ($addresses as $ip) { |
|
43 | 43 | $ip = (array) $ip; |
44 | - if(strlen($ip[$field['name']]) > 0) { |
|
45 | - $sizeMyFields[$field['name']]++; // +1 |
|
44 | + if (strlen ($ip[$field['name']]) > 0) { |
|
45 | + $sizeMyFields[$field['name']]++; // +1 |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | # unset if value == 0 |
49 | - if($sizeMyFields[$field['name']] == 0) { |
|
49 | + if ($sizeMyFields[$field['name']] == 0) { |
|
50 | 50 | unset($custom_fields[$field['name']]); |
51 | 51 | |
52 | 52 | $colspan['empty']--; |
53 | - $colspan['unused']--; //unused span -1 |
|
54 | - $colspan['dhcp']--; //dhcp span -1 |
|
53 | + $colspan['unused']--; //unused span -1 |
|
54 | + $colspan['dhcp']--; //dhcp span -1 |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | # set page limit for pagination |
62 | 62 | $page_limit = 100000000; |
63 | 63 | # set ping statuses for warning and offline |
64 | -$statuses = explode(";", $settings->pingStatus); |
|
64 | +$statuses = explode (";", $settings->pingStatus); |
|
65 | 65 | ?> |
66 | 66 | |
67 | 67 | <!-- print title and pagenum --> |
68 | 68 | <h4 style="margin-top:40px;"> |
69 | 69 | <?php |
70 | -if(!$slaves) { print _("IP addresses in subnet "); } |
|
71 | -else { print _("IP addresses belonging to ALL nested subnets"); } |
|
70 | +if (!$slaves) { print _ ("IP addresses in subnet "); } |
|
71 | +else { print _ ("IP addresses belonging to ALL nested subnets"); } |
|
72 | 72 | ?> |
73 | 73 | </h4> |
74 | 74 | |
@@ -83,26 +83,26 @@ discard block |
||
83 | 83 | <?php |
84 | 84 | |
85 | 85 | # IP address - mandatory |
86 | - print "<th class='s_ipaddr'>"._('IP address')."</th>"; |
|
86 | + print "<th class='s_ipaddr'>"._ ('IP address')."</th>"; |
|
87 | 87 | # hostname - mandatory |
88 | - print "<th>"._('Hostname')."</th>"; |
|
88 | + print "<th>"._ ('Hostname')."</th>"; |
|
89 | 89 | # Description - mandatory |
90 | - print "<th>"._('Description')."</th>"; |
|
90 | + print "<th>"._ ('Description')."</th>"; |
|
91 | 91 | # MAC address |
92 | - if(in_array('mac', $selected_ip_fields)) { print "<th></th>"; } |
|
92 | + if (in_array ('mac', $selected_ip_fields)) { print "<th></th>"; } |
|
93 | 93 | # note |
94 | - if(in_array('note', $selected_ip_fields)) { print "<th></th>"; } |
|
94 | + if (in_array ('note', $selected_ip_fields)) { print "<th></th>"; } |
|
95 | 95 | # switch |
96 | - if(in_array('switch', $selected_ip_fields)) { print "<th class='hidden-xs hidden-sm hidden-md'>"._('Device')."</th>"; } |
|
96 | + if (in_array ('switch', $selected_ip_fields)) { print "<th class='hidden-xs hidden-sm hidden-md'>"._ ('Device')."</th>"; } |
|
97 | 97 | # port |
98 | - if(in_array('port', $selected_ip_fields)) { print "<th class='hidden-xs hidden-sm hidden-md'>"._('Port')."</th>"; } |
|
98 | + if (in_array ('port', $selected_ip_fields)) { print "<th class='hidden-xs hidden-sm hidden-md'>"._ ('Port')."</th>"; } |
|
99 | 99 | # owner |
100 | - if(in_array('owner', $selected_ip_fields)) { print "<th class='hidden-xs hidden-sm hidden-md'>"._('Owner')."</th>"; } |
|
100 | + if (in_array ('owner', $selected_ip_fields)) { print "<th class='hidden-xs hidden-sm hidden-md'>"._ ('Owner')."</th>"; } |
|
101 | 101 | |
102 | 102 | # custom fields |
103 | - if(sizeof($custom_fields) > 0) { |
|
104 | - foreach($custom_fields as $myField) { |
|
105 | - if(!in_array($myField['name'], $hidden_cfields)) { |
|
103 | + if (sizeof ($custom_fields) > 0) { |
|
104 | + foreach ($custom_fields as $myField) { |
|
105 | + if (!in_array ($myField['name'], $hidden_cfields)) { |
|
106 | 106 | print "<th class='hidden-xs hidden-sm hidden-md'>$myField[name]</th>"; |
107 | 107 | } |
108 | 108 | } |
@@ -114,28 +114,28 @@ discard block |
||
114 | 114 | |
115 | 115 | <?php |
116 | 116 | /* Addresses content print */ |
117 | -$n = 0; //addresses index |
|
118 | -$m = sizeof($addresses) -1; //last address index |
|
117 | +$n = 0; //addresses index |
|
118 | +$m = sizeof ($addresses) - 1; //last address index |
|
119 | 119 | |
120 | 120 | # if no IP is configured only display free subnet! |
121 | -if ($addresses===false || sizeof($addresses)==0) { |
|
122 | - $unused = $Addresses->find_unused_addresses($Subnets->transform_to_decimal($subnet_detailed['network']), $Subnets->transform_to_decimal($subnet_detailed['broadcast']), $subnet['mask'], $empty=true ); |
|
123 | - print '<tr class="th"><td colspan="'.$colspan['empty'].'" class="unused">'.$unused['ip'].' (' .$Subnets->reformat_number($unused['hosts']).')</td></tr>'. "\n"; |
|
121 | +if ($addresses === false || sizeof ($addresses) == 0) { |
|
122 | + $unused = $Addresses->find_unused_addresses ($Subnets->transform_to_decimal ($subnet_detailed['network']), $Subnets->transform_to_decimal ($subnet_detailed['broadcast']), $subnet['mask'], $empty = true); |
|
123 | + print '<tr class="th"><td colspan="'.$colspan['empty'].'" class="unused">'.$unused['ip'].' ('.$Subnets->reformat_number ($unused['hosts']).')</td></tr>'."\n"; |
|
124 | 124 | } |
125 | 125 | # print IP address |
126 | 126 | else { |
127 | - foreach($addresses as $dummy) { |
|
127 | + foreach ($addresses as $dummy) { |
|
128 | 128 | # |
129 | 129 | # first check for gaps from network to first host |
130 | 130 | # |
131 | 131 | |
132 | 132 | # check gap between network address and first IP address |
133 | - if ( $n == 0 ) { $unused = $Addresses->find_unused_addresses ( $Subnets->transform_to_decimal($subnet_detailed['network']), $addresses[$n]->ip_addr, $subnet['mask']); } |
|
133 | + if ($n == 0) { $unused = $Addresses->find_unused_addresses ($Subnets->transform_to_decimal ($subnet_detailed['network']), $addresses[$n]->ip_addr, $subnet['mask']); } |
|
134 | 134 | # check unused space between IP addresses |
135 | - else { $unused = $Addresses->find_unused_addresses ( $addresses[$n-1]->ip_addr, $addresses[$n]->ip_addr, $subnet['mask'] ); } |
|
135 | + else { $unused = $Addresses->find_unused_addresses ($addresses[$n - 1]->ip_addr, $addresses[$n]->ip_addr, $subnet['mask']); } |
|
136 | 136 | |
137 | 137 | # if there is some result for unused print it - if sort == ip_addr |
138 | - if ( $unused ) { |
|
138 | + if ($unused) { |
|
139 | 139 | print "<tr class='th'>"; |
140 | 140 | print " <td></td>"; |
141 | 141 | print " <td colspan='$colspan[unused]' class='unused'>$unused[ip] ($unused[hosts])</td>"; |
@@ -147,20 +147,20 @@ discard block |
||
147 | 147 | # |
148 | 148 | |
149 | 149 | # ip - range |
150 | - if($addresses[$n]->class=="range-dhcp") |
|
150 | + if ($addresses[$n]->class == "range-dhcp") |
|
151 | 151 | { |
152 | 152 | print "<tr class='dhcp'>"; |
153 | 153 | print " <td>"; |
154 | 154 | # status icon |
155 | - if($subnet['pingSubnet']=="1") { |
|
155 | + if ($subnet['pingSubnet'] == "1") { |
|
156 | 156 | print " <span class='status status-padded'></span>"; |
157 | 157 | } |
158 | - print $Subnets->transform_to_dotted( $addresses[$n]->ip_addr).' - '.$Subnets->transform_to_dotted( $addresses[$n]->stopIP)." (".$addresses[$n]->numHosts.")"; |
|
159 | - print $Addresses->address_type_format_tag($addresses[$n]->state); |
|
158 | + print $Subnets->transform_to_dotted ($addresses[$n]->ip_addr).' - '.$Subnets->transform_to_dotted ($addresses[$n]->stopIP)." (".$addresses[$n]->numHosts.")"; |
|
159 | + print $Addresses->address_type_format_tag ($addresses[$n]->state); |
|
160 | 160 | print " </td>"; |
161 | - print " <td>"._("DHCP range")."</td>"; |
|
161 | + print " <td>"._ ("DHCP range")."</td>"; |
|
162 | 162 | print " <td>".$addresses[$n]->description."</td>"; |
163 | - if($colspan['dhcp']!=0) |
|
163 | + if ($colspan['dhcp'] != 0) |
|
164 | 164 | print " <td colspan='$colspan[dhcp]' class='unused'></td>"; |
165 | 165 | // tr ends after! |
166 | 166 | |
@@ -170,69 +170,69 @@ discard block |
||
170 | 170 | { |
171 | 171 | /* set class for reserved and offline - if set! */ |
172 | 172 | $stateClass = ""; |
173 | - if(in_array('state', $selected_ip_fields)) { |
|
174 | - if ($addresses[$n]->state == 0) { $stateClass = _("Offline"); } |
|
175 | - else if ($addresses[$n]->state == 2) { $stateClass = _("Reserved"); } |
|
176 | - else if ($addresses[$n]->state == 3) { $stateClass = _("DHCP"); } |
|
173 | + if (in_array ('state', $selected_ip_fields)) { |
|
174 | + if ($addresses[$n]->state == 0) { $stateClass = _ ("Offline"); } |
|
175 | + else if ($addresses[$n]->state == 2) { $stateClass = _ ("Reserved"); } |
|
176 | + else if ($addresses[$n]->state == 3) { $stateClass = _ ("DHCP"); } |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | print "<tr class='$stateClass'>"; |
180 | 180 | |
181 | 181 | // gateway |
182 | - $gw = $addresses[$n]->is_gateway==1 ? "gateway" : ""; |
|
182 | + $gw = $addresses[$n]->is_gateway == 1 ? "gateway" : ""; |
|
183 | 183 | |
184 | - print " <td class='ipaddress $gw'><a href='".create_link("temp_share",$_GET['section'],$addresses[$n]->id)."'>".$Subnets->transform_to_dotted( $addresses[$n]->ip_addr)."</a>"; |
|
185 | - if($addresses[$n]->is_gateway==1) { print " <i class='fa fa-info-circle fa-gateway' rel='tooltip' title='"._('Address is marked as gateway')."'></i>"; } |
|
186 | - if(in_array('state', $selected_ip_fields)) { print $Addresses->address_type_format_tag($addresses[$n]->state); } |
|
184 | + print " <td class='ipaddress $gw'><a href='".create_link ("temp_share", $_GET['section'], $addresses[$n]->id)."'>".$Subnets->transform_to_dotted ($addresses[$n]->ip_addr)."</a>"; |
|
185 | + if ($addresses[$n]->is_gateway == 1) { print " <i class='fa fa-info-circle fa-gateway' rel='tooltip' title='"._ ('Address is marked as gateway')."'></i>"; } |
|
186 | + if (in_array ('state', $selected_ip_fields)) { print $Addresses->address_type_format_tag ($addresses[$n]->state); } |
|
187 | 187 | print "</td>"; |
188 | 188 | |
189 | 189 | # resolve dns name |
190 | - $resolve = $DNS->resolve_address($addresses[$n]->ip_addr, $addresses[$n]->dns_name, false, $subnet['nameserverId']); |
|
190 | + $resolve = $DNS->resolve_address ($addresses[$n]->ip_addr, $addresses[$n]->dns_name, false, $subnet['nameserverId']); |
|
191 | 191 | { print "<td class='$resolve[class] hostname'>$resolve[name]</td>"; } |
192 | 192 | |
193 | 193 | # print description - mandatory |
194 | 194 | print "<td class='description'>".$addresses[$n]->description."</td>"; |
195 | 195 | # Print mac address icon! |
196 | - if(in_array('mac', $selected_ip_fields)) { |
|
197 | - if(!empty($addresses[$n]->mac)) { print "<td class='narrow'><i class='info fa fa-gray fa-sitemap' rel='tooltip' data-container='body' title='"._('MAC').": ".$addresses[$n]->mac."'></i></td>"; } |
|
198 | - else { print "<td class='narrow'></td>"; } |
|
196 | + if (in_array ('mac', $selected_ip_fields)) { |
|
197 | + if (!empty($addresses[$n]->mac)) { print "<td class='narrow'><i class='info fa fa-gray fa-sitemap' rel='tooltip' data-container='body' title='"._ ('MAC').": ".$addresses[$n]->mac."'></i></td>"; } |
|
198 | + else { print "<td class='narrow'></td>"; } |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | 202 | # print info button for hover |
203 | - if(in_array('note', $selected_ip_fields)) { |
|
204 | - if(!empty($addresses[$n]->note)) { print "<td class='narrow'><i class='fa fa-gray fa-comment-o' rel='tooltip' data-container='body' data-html='true' title='".str_replace("\n", "<br>",$addresses[$n]->note)."'></td>"; } |
|
205 | - else { print "<td class='narrow'></td>"; } |
|
203 | + if (in_array ('note', $selected_ip_fields)) { |
|
204 | + if (!empty($addresses[$n]->note)) { print "<td class='narrow'><i class='fa fa-gray fa-comment-o' rel='tooltip' data-container='body' data-html='true' title='".str_replace ("\n", "<br>", $addresses[$n]->note)."'></td>"; } |
|
205 | + else { print "<td class='narrow'></td>"; } |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | # print device |
209 | - if(in_array('switch', $selected_ip_fields)) { |
|
209 | + if (in_array ('switch', $selected_ip_fields)) { |
|
210 | 210 | # get device details |
211 | - $device = (array) $Tools->fetch_object("devices", "id", $addresses[$n]->switch); |
|
211 | + $device = (array) $Tools->fetch_object ("devices", "id", $addresses[$n]->switch); |
|
212 | 212 | print "<td class='hidden-xs hidden-sm hidden-md'>".@$device['hostname']."</td>"; |
213 | 213 | } |
214 | 214 | |
215 | 215 | # print port |
216 | - if(in_array('port', $selected_ip_fields)) { print "<td class='hidden-xs hidden-sm hidden-md'>".$addresses[$n]->port."</td>"; } |
|
216 | + if (in_array ('port', $selected_ip_fields)) { print "<td class='hidden-xs hidden-sm hidden-md'>".$addresses[$n]->port."</td>"; } |
|
217 | 217 | |
218 | 218 | # print owner |
219 | - if(in_array('owner', $selected_ip_fields)) { print "<td class='hidden-xs hidden-sm'>".$addresses[$n]->owner."</td>"; } |
|
219 | + if (in_array ('owner', $selected_ip_fields)) { print "<td class='hidden-xs hidden-sm'>".$addresses[$n]->owner."</td>"; } |
|
220 | 220 | |
221 | 221 | # print custom fields |
222 | - if(sizeof($custom_fields) > 0) { |
|
223 | - foreach($custom_fields as $myField) { |
|
224 | - if(!in_array($myField['name'], $hidden_cfields)) { |
|
222 | + if (sizeof ($custom_fields) > 0) { |
|
223 | + foreach ($custom_fields as $myField) { |
|
224 | + if (!in_array ($myField['name'], $hidden_cfields)) { |
|
225 | 225 | print "<td class='customField hidden-xs hidden-sm hidden-md'>"; |
226 | 226 | |
227 | 227 | //booleans |
228 | - if($myField['type']=="tinyint(1)") { |
|
229 | - if($addresses[$n]->$myField['name'] == "0") { print _("No"); } |
|
230 | - elseif($addresses[$n]->$myField['name'] == "1") { print _("Yes"); } |
|
228 | + if ($myField['type'] == "tinyint(1)") { |
|
229 | + if ($addresses[$n]->$myField['name'] == "0") { print _ ("No"); } |
|
230 | + elseif ($addresses[$n]->$myField['name'] == "1") { print _ ("Yes"); } |
|
231 | 231 | } |
232 | 232 | //text |
233 | - elseif($myField['type']=="text") { |
|
234 | - if(strlen($addresses[$n]->$myField['name'])>0) { print "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='".str_replace("\n", "<br>", $addresses[$n][$myField['name']])."'>"; } |
|
235 | - else { print ""; } |
|
233 | + elseif ($myField['type'] == "text") { |
|
234 | + if (strlen ($addresses[$n]->$myField['name']) > 0) { print "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='".str_replace ("\n", "<br>", $addresses[$n][$myField['name']])."'>"; } |
|
235 | + else { print ""; } |
|
236 | 236 | } |
237 | 237 | else { |
238 | 238 | print $addresses[$n]->$myField['name']; |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | } |
244 | 244 | } |
245 | 245 | } |
246 | - print '</tr>'. "\n"; |
|
246 | + print '</tr>'."\n"; |
|
247 | 247 | |
248 | 248 | /* if last one return ip address and broadcast IP |
249 | 249 | ****************************************************/ |
250 | - if ( $n == $m ) |
|
250 | + if ($n == $m) |
|
251 | 251 | { |
252 | 252 | # compressed? |
253 | - if(isset($addresses[$n]->stopIP)) { $unused = $Addresses->find_unused_addresses ( $addresses[$n]->stopIP, $Subnets->transform_to_decimal($subnet_detailed['broadcast']), $subnet['mask'] ); } |
|
254 | - else { $unused = $Addresses->find_unused_addresses ( $addresses[$n]->ip_addr, $Subnets->transform_to_decimal($subnet_detailed['broadcast']), $subnet['mask'] ); } |
|
253 | + if (isset($addresses[$n]->stopIP)) { $unused = $Addresses->find_unused_addresses ($addresses[$n]->stopIP, $Subnets->transform_to_decimal ($subnet_detailed['broadcast']), $subnet['mask']); } |
|
254 | + else { $unused = $Addresses->find_unused_addresses ($addresses[$n]->ip_addr, $Subnets->transform_to_decimal ($subnet_detailed['broadcast']), $subnet['mask']); } |
|
255 | 255 | |
256 | - if ( $unused ) { |
|
256 | + if ($unused) { |
|
257 | 257 | print "<tr class='th'>"; |
258 | 258 | print " <td></td>"; |
259 | 259 | print " <td colspan='$colspan[unused]' class='unused'>$unused[ip] ($unused[hosts])</td>"; |