@@ -2,14 +2,14 @@ discard block |
||
2 | 2 | |
3 | 3 | # required functions |
4 | 4 | if(!is_object(@$User)) { |
5 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
6 | - # classes |
|
7 | - $Database = new Database_PDO; |
|
8 | - $User = new User ($Database); |
|
9 | - $Tools = new Tools ($Database); |
|
10 | - $Sections = new Sections ($Database); |
|
11 | - $Subnets = new Subnets ($Database); |
|
12 | - $Result = new Result (); |
|
5 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
6 | + # classes |
|
7 | + $Database = new Database_PDO; |
|
8 | + $User = new User ($Database); |
|
9 | + $Tools = new Tools ($Database); |
|
10 | + $Sections = new Sections ($Database); |
|
11 | + $Subnets = new Subnets ($Database); |
|
12 | + $Result = new Result (); |
|
13 | 13 | |
14 | 14 | } |
15 | 15 | |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | $subnets_count = 0; |
25 | 25 | if ($sections!==false) { |
26 | 26 | foreach ($sections as $section) { |
27 | - # cast |
|
28 | - $section = (array) $section; |
|
27 | + # cast |
|
28 | + $section = (array) $section; |
|
29 | 29 | |
30 | - # check permission |
|
31 | - $permission = $Sections->check_permission ($User->user, $section['id']); |
|
32 | - if($permission > 0) { |
|
33 | - $subnets = $Subnets->fetch_section_subnets ($section['id']); |
|
34 | - if ($subnets!==false) { |
|
35 | - foreach($subnets as $subnet) { |
|
36 | - # check permission |
|
37 | - $subpermission = $Subnets->check_permission ($User->user, $subnet->id); |
|
38 | - if($subpermission > 0) { |
|
39 | - /* show only subnets that allow IP exporting */ |
|
40 | - if($subnet->allowRequests == 1) { |
|
41 | - $subnets_count ++; |
|
42 | - /* must not have any nested subnets! */ |
|
43 | - if(!$Subnets->has_slaves($subnet->id)) |
|
44 | - { |
|
45 | - $html[] = '<option value="'. $subnet->id .'">' . $Subnets->transform_to_dotted($subnet->subnet) .'/'. $subnet->mask .' ['. $subnet->description .']</option>'; |
|
46 | - } |
|
47 | - } |
|
48 | - } |
|
49 | - } |
|
50 | - } |
|
51 | - } |
|
30 | + # check permission |
|
31 | + $permission = $Sections->check_permission ($User->user, $section['id']); |
|
32 | + if($permission > 0) { |
|
33 | + $subnets = $Subnets->fetch_section_subnets ($section['id']); |
|
34 | + if ($subnets!==false) { |
|
35 | + foreach($subnets as $subnet) { |
|
36 | + # check permission |
|
37 | + $subpermission = $Subnets->check_permission ($User->user, $subnet->id); |
|
38 | + if($subpermission > 0) { |
|
39 | + /* show only subnets that allow IP exporting */ |
|
40 | + if($subnet->allowRequests == 1) { |
|
41 | + $subnets_count ++; |
|
42 | + /* must not have any nested subnets! */ |
|
43 | + if(!$Subnets->has_slaves($subnet->id)) |
|
44 | + { |
|
45 | + $html[] = '<option value="'. $subnet->id .'">' . $Subnets->transform_to_dotted($subnet->subnet) .'/'. $subnet->mask .' ['. $subnet->description .']</option>'; |
|
46 | + } |
|
47 | + } |
|
48 | + } |
|
49 | + } |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | ?> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | foreach ($html as $h) { |
74 | 74 | print $h; |
75 | 75 | } |
76 | - ?> |
|
76 | + ?> |
|
77 | 77 | </select> |
78 | 78 | |
79 | 79 | </td> |
@@ -40,8 +40,7 @@ |
||
40 | 40 | if($subnet->allowRequests == 1) { |
41 | 41 | $subnets_count ++; |
42 | 42 | /* must not have any nested subnets! */ |
43 | - if(!$Subnets->has_slaves($subnet->id)) |
|
44 | - { |
|
43 | + if(!$Subnets->has_slaves($subnet->id)) { |
|
45 | 44 | $html[] = '<option value="'. $subnet->id .'">' . $Subnets->transform_to_dotted($subnet->subnet) .'/'. $subnet->mask .' ['. $subnet->description .']</option>'; |
46 | 45 | } |
47 | 46 | } |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | # required functions |
4 | -if(!is_object(@$User)) { |
|
5 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
4 | +if (!is_object (@$User)) { |
|
5 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
6 | 6 | # classes |
7 | 7 | $Database = new Database_PDO; |
8 | - $User = new User ($Database); |
|
9 | - $Tools = new Tools ($Database); |
|
8 | + $User = new User ($Database); |
|
9 | + $Tools = new Tools ($Database); |
|
10 | 10 | $Sections = new Sections ($Database); |
11 | 11 | $Subnets = new Subnets ($Database); |
12 | - $Result = new Result (); |
|
12 | + $Result = new Result (); |
|
13 | 13 | |
14 | 14 | } |
15 | 15 | |
@@ -19,30 +19,30 @@ discard block |
||
19 | 19 | # prepare list of permitted subnets with requests |
20 | 20 | |
21 | 21 | // get all sections |
22 | -$sections = $Sections->fetch_all_sections(); |
|
22 | +$sections = $Sections->fetch_all_sections (); |
|
23 | 23 | |
24 | 24 | $subnets_count = 0; |
25 | -if ($sections!==false) { |
|
25 | +if ($sections !== false) { |
|
26 | 26 | foreach ($sections as $section) { |
27 | 27 | # cast |
28 | 28 | $section = (array) $section; |
29 | 29 | |
30 | 30 | # check permission |
31 | 31 | $permission = $Sections->check_permission ($User->user, $section['id']); |
32 | - if($permission > 0) { |
|
32 | + if ($permission > 0) { |
|
33 | 33 | $subnets = $Subnets->fetch_section_subnets ($section['id']); |
34 | - if ($subnets!==false) { |
|
35 | - foreach($subnets as $subnet) { |
|
34 | + if ($subnets !== false) { |
|
35 | + foreach ($subnets as $subnet) { |
|
36 | 36 | # check permission |
37 | 37 | $subpermission = $Subnets->check_permission ($User->user, $subnet->id); |
38 | - if($subpermission > 0) { |
|
38 | + if ($subpermission > 0) { |
|
39 | 39 | /* show only subnets that allow IP exporting */ |
40 | - if($subnet->allowRequests == 1) { |
|
41 | - $subnets_count ++; |
|
40 | + if ($subnet->allowRequests == 1) { |
|
41 | + $subnets_count++; |
|
42 | 42 | /* must not have any nested subnets! */ |
43 | - if(!$Subnets->has_slaves($subnet->id)) |
|
43 | + if (!$Subnets->has_slaves ($subnet->id)) |
|
44 | 44 | { |
45 | - $html[] = '<option value="'. $subnet->id .'">' . $Subnets->transform_to_dotted($subnet->subnet) .'/'. $subnet->mask .' ['. $subnet->description .']</option>'; |
|
45 | + $html[] = '<option value="'.$subnet->id.'">'.$Subnets->transform_to_dotted ($subnet->subnet).'/'.$subnet->mask.' ['.$subnet->description.']</option>'; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | <?php |
60 | 60 | // if no subnets exist print it! |
61 | 61 | if (!isset($html)) { |
62 | - $Result->show("info", _("No subnets available"), false); |
|
62 | + $Result->show ("info", _ ("No subnets available"), false); |
|
63 | 63 | } |
64 | 64 | else { |
65 | 65 | ?> |
66 | 66 | |
67 | 67 | <!-- select section --> |
68 | 68 | <tr> |
69 | - <td><?php print _('Select subnet'); ?> *</td> |
|
69 | + <td><?php print _ ('Select subnet'); ?> *</td> |
|
70 | 70 | <td> |
71 | 71 | <select name="subnetId" id="subnetId" class="form-control" class="input-sm input-w-auto"> |
72 | 72 | <?php |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | </td> |
80 | 80 | </tr> |
81 | 81 | <tr> |
82 | - <td><?php print _('First IP Address available'); ?></td> |
|
82 | + <td><?php print _ ('First IP Address available'); ?></td> |
|
83 | 83 | <td> |
84 | - <input type="text" name="ip_addr" id="ip_addr_widget" class="form-control ip_addr" size="30" placeholder="<?php print _('IP Address'); ?>"> |
|
84 | + <input type="text" name="ip_addr" id="ip_addr_widget" class="form-control ip_addr" size="30" placeholder="<?php print _ ('IP Address'); ?>"> |
|
85 | 85 | </td> |
86 | 86 | </tr> |
87 | 87 | <tr> |
88 | 88 | <td colspan='2'> |
89 | - <button class="btn btn-sm btn-default pull-right" id="requestIP_widget"><?php print _('Request IP');?></button> |
|
89 | + <button class="btn btn-sm btn-default pull-right" id="requestIP_widget"><?php print _ ('Request IP'); ?></button> |
|
90 | 90 | </td> |
91 | 91 | </tr> |
92 | 92 | </table> |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | # required functions if requested via AJAX |
8 | 8 | if(!is_object(@$User)) { |
9 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
10 | - # classes |
|
11 | - $Database = new Database_PDO; |
|
12 | - $User = new User ($Database); |
|
13 | - $Tools = new Tools ($Database); |
|
14 | - $Subnets = new Subnets ($Database); |
|
15 | - $Sections = new Sections ($Database); |
|
16 | - $Log = new Logging ($Database); |
|
17 | - $Result = new Result (); |
|
9 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
10 | + # classes |
|
11 | + $Database = new Database_PDO; |
|
12 | + $User = new User ($Database); |
|
13 | + $Tools = new Tools ($Database); |
|
14 | + $Subnets = new Subnets ($Database); |
|
15 | + $Sections = new Sections ($Database); |
|
16 | + $Log = new Logging ($Database); |
|
17 | + $Result = new Result (); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # user must be authenticated |
@@ -22,98 +22,98 @@ discard block |
||
22 | 22 | |
23 | 23 | # if direct request that redirect to tools page |
24 | 24 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
25 | - header("Location: ".create_link("tools","changelog")); |
|
25 | + header("Location: ".create_link("tools","changelog")); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | # changelog to syslog |
29 | 29 | if ($User->settings->log!="syslog") { |
30 | - /* get logs */ |
|
31 | - $clogs = $Log->fetch_all_changelogs (false, "", 50); |
|
30 | + /* get logs */ |
|
31 | + $clogs = $Log->fetch_all_changelogs (false, "", 50); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | # syslog |
35 | 35 | if ($User->settings->log=="syslog") { |
36 | - $Result->show("warning", _("Changelog files are sent to syslog"), false); |
|
36 | + $Result->show("warning", _("Changelog files are sent to syslog"), false); |
|
37 | 37 | } |
38 | 38 | # none |
39 | 39 | elseif(sizeof($clogs)==0) { |
40 | - print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
41 | - print "<p>"._("No changelogs available")."</p>"; |
|
42 | - print "<small>"._("No changelog entries are available")."</small>"; |
|
43 | - print "</blockquote>"; |
|
40 | + print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
41 | + print "<p>"._("No changelogs available")."</p>"; |
|
42 | + print "<small>"._("No changelog entries are available")."</small>"; |
|
43 | + print "</blockquote>"; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | else { |
47 | 47 | |
48 | - # printout |
|
49 | - print "<table class='table changelog table-hover table-top table-condensed'>"; |
|
50 | - |
|
51 | - # headers |
|
52 | - print "<tr>"; |
|
53 | - print " <th>"._('User')."</th>"; |
|
54 | - print " <th>"._('Type')."</th>"; |
|
55 | - print " <th>"._('Object')."</th>"; |
|
56 | - print " <th>"._('Date')."</th>"; |
|
57 | - print " <th>"._('Change')."</th>"; |
|
58 | - print "</tr>"; |
|
59 | - |
|
60 | - # logs |
|
61 | - $pc = 0; //print count |
|
62 | - foreach($clogs as $l) { |
|
63 | - |
|
64 | - # cast |
|
65 | - $l = (array) $l; |
|
66 | - |
|
67 | - if($pc < 5) { |
|
68 | - # permissions |
|
69 | - if($l['ctype']=="subnet") { $permission = $Subnets->check_permission ($User->user, $l['tid']); } |
|
70 | - elseif($l['ctype']=="ip_addr") { $permission = $Subnets->check_permission ($User->user, $l['subnetId']); } |
|
71 | - elseif($l['ctype']=="section") { $permission = $Sections->check_permission ($User->user, $l['sectionId']); } |
|
72 | - else { $permission = 0; } |
|
73 | - |
|
74 | - # if 0 ignore |
|
75 | - if($permission > 0) { |
|
76 | - # format diff |
|
77 | - $l['cdiff'] = str_replace("\n\n", "", trim($l['cdiff'])); |
|
78 | - $l['cdiff'] = str_replace("\n", "; ", $l['cdiff']); |
|
79 | - |
|
80 | - # format type |
|
81 | - switch($l['ctype']) { |
|
82 | - case "ip_addr": { $l['ctype'] = "IP address"; break; } |
|
83 | - case "subnet": if($l['isFolder']==1) { $l['ctype'] = "Folder"; } |
|
84 | - else { $l['ctype'] = "Subnet"; } |
|
85 | - break; |
|
86 | - |
|
87 | - case "section": { $l['ctype'] = "Section"; break; } |
|
88 | - } |
|
89 | - |
|
90 | - print "<tr>"; |
|
91 | - print " <td>$l[real_name]</td>"; |
|
92 | - print " <td>$l[ctype] / $l[caction] $l[cresult]</td>"; |
|
93 | - |
|
94 | - # subnet, section or ip address |
|
95 | - if($l['ctype']=="IP address") { |
|
96 | - print " <td><a href='".create_link("subnets",$l['sectionId'],$l['subnetId'],"address-details",$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."</a></td>"; |
|
97 | - } |
|
98 | - elseif($l['ctype']=="Subnet") { |
|
99 | - print " <td><a href='".create_link("subnets",$l['sectionId'],$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."/$l[mask]</a></td>"; |
|
100 | - } |
|
101 | - elseif($l['ctype']=="Folder") { |
|
102 | - print " <td><a href='".create_link("folder",$l['sectionId'],$l['tid'])."'>$l[sDescription]</a></td>"; |
|
103 | - } |
|
104 | - elseif($l['ctype']=="Section") { |
|
105 | - print " <td><a href='".create_link("subnets",$l['tid'])."'>$l[sDescription]</a></td>"; |
|
106 | - } |
|
107 | - print " <td>$l[cdate]</td>"; |
|
108 | - print " <td>$l[cdiff]</td>"; |
|
109 | - print "</tr>"; |
|
110 | - |
|
111 | - // next item |
|
112 | - $pc++; |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
116 | - |
|
117 | - print "</table>"; |
|
48 | + # printout |
|
49 | + print "<table class='table changelog table-hover table-top table-condensed'>"; |
|
50 | + |
|
51 | + # headers |
|
52 | + print "<tr>"; |
|
53 | + print " <th>"._('User')."</th>"; |
|
54 | + print " <th>"._('Type')."</th>"; |
|
55 | + print " <th>"._('Object')."</th>"; |
|
56 | + print " <th>"._('Date')."</th>"; |
|
57 | + print " <th>"._('Change')."</th>"; |
|
58 | + print "</tr>"; |
|
59 | + |
|
60 | + # logs |
|
61 | + $pc = 0; //print count |
|
62 | + foreach($clogs as $l) { |
|
63 | + |
|
64 | + # cast |
|
65 | + $l = (array) $l; |
|
66 | + |
|
67 | + if($pc < 5) { |
|
68 | + # permissions |
|
69 | + if($l['ctype']=="subnet") { $permission = $Subnets->check_permission ($User->user, $l['tid']); } |
|
70 | + elseif($l['ctype']=="ip_addr") { $permission = $Subnets->check_permission ($User->user, $l['subnetId']); } |
|
71 | + elseif($l['ctype']=="section") { $permission = $Sections->check_permission ($User->user, $l['sectionId']); } |
|
72 | + else { $permission = 0; } |
|
73 | + |
|
74 | + # if 0 ignore |
|
75 | + if($permission > 0) { |
|
76 | + # format diff |
|
77 | + $l['cdiff'] = str_replace("\n\n", "", trim($l['cdiff'])); |
|
78 | + $l['cdiff'] = str_replace("\n", "; ", $l['cdiff']); |
|
79 | + |
|
80 | + # format type |
|
81 | + switch($l['ctype']) { |
|
82 | + case "ip_addr": { $l['ctype'] = "IP address"; break; } |
|
83 | + case "subnet": if($l['isFolder']==1) { $l['ctype'] = "Folder"; } |
|
84 | + else { $l['ctype'] = "Subnet"; } |
|
85 | + break; |
|
86 | + |
|
87 | + case "section": { $l['ctype'] = "Section"; break; } |
|
88 | + } |
|
89 | + |
|
90 | + print "<tr>"; |
|
91 | + print " <td>$l[real_name]</td>"; |
|
92 | + print " <td>$l[ctype] / $l[caction] $l[cresult]</td>"; |
|
93 | + |
|
94 | + # subnet, section or ip address |
|
95 | + if($l['ctype']=="IP address") { |
|
96 | + print " <td><a href='".create_link("subnets",$l['sectionId'],$l['subnetId'],"address-details",$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."</a></td>"; |
|
97 | + } |
|
98 | + elseif($l['ctype']=="Subnet") { |
|
99 | + print " <td><a href='".create_link("subnets",$l['sectionId'],$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."/$l[mask]</a></td>"; |
|
100 | + } |
|
101 | + elseif($l['ctype']=="Folder") { |
|
102 | + print " <td><a href='".create_link("folder",$l['sectionId'],$l['tid'])."'>$l[sDescription]</a></td>"; |
|
103 | + } |
|
104 | + elseif($l['ctype']=="Section") { |
|
105 | + print " <td><a href='".create_link("subnets",$l['tid'])."'>$l[sDescription]</a></td>"; |
|
106 | + } |
|
107 | + print " <td>$l[cdate]</td>"; |
|
108 | + print " <td>$l[cdiff]</td>"; |
|
109 | + print "</tr>"; |
|
110 | + |
|
111 | + // next item |
|
112 | + $pc++; |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | + |
|
117 | + print "</table>"; |
|
118 | 118 | } |
119 | 119 | ?> |
120 | 120 | \ No newline at end of file |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | $User->check_user_session (); |
22 | 22 | |
23 | 23 | # if direct request that redirect to tools page |
24 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
24 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
25 | 25 | header("Location: ".create_link("tools","changelog")); |
26 | 26 | } |
27 | 27 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | else { $permission = 0; } |
73 | 73 | |
74 | 74 | # if 0 ignore |
75 | - if($permission > 0) { |
|
75 | + if($permission > 0) { |
|
76 | 76 | # format diff |
77 | 77 | $l['cdiff'] = str_replace("\n\n", "", trim($l['cdiff'])); |
78 | 78 | $l['cdiff'] = str_replace("\n", "; ", $l['cdiff']); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | switch($l['ctype']) { |
82 | 82 | case "ip_addr": { $l['ctype'] = "IP address"; break; } |
83 | 83 | case "subnet": if($l['isFolder']==1) { $l['ctype'] = "Folder"; } |
84 | - else { $l['ctype'] = "Subnet"; } |
|
84 | + else { $l['ctype'] = "Subnet"; } |
|
85 | 85 | break; |
86 | 86 | |
87 | 87 | case "section": { $l['ctype'] = "Section"; break; } |
@@ -92,16 +92,16 @@ discard block |
||
92 | 92 | print " <td>$l[ctype] / $l[caction] $l[cresult]</td>"; |
93 | 93 | |
94 | 94 | # subnet, section or ip address |
95 | - if($l['ctype']=="IP address") { |
|
95 | + if($l['ctype']=="IP address") { |
|
96 | 96 | print " <td><a href='".create_link("subnets",$l['sectionId'],$l['subnetId'],"address-details",$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."</a></td>"; |
97 | 97 | } |
98 | - elseif($l['ctype']=="Subnet") { |
|
98 | + elseif($l['ctype']=="Subnet") { |
|
99 | 99 | print " <td><a href='".create_link("subnets",$l['sectionId'],$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."/$l[mask]</a></td>"; |
100 | 100 | } |
101 | - elseif($l['ctype']=="Folder") { |
|
101 | + elseif($l['ctype']=="Folder") { |
|
102 | 102 | print " <td><a href='".create_link("folder",$l['sectionId'],$l['tid'])."'>$l[sDescription]</a></td>"; |
103 | 103 | } |
104 | - elseif($l['ctype']=="Section") { |
|
104 | + elseif($l['ctype']=="Section") { |
|
105 | 105 | print " <td><a href='".create_link("subnets",$l['tid'])."'>$l[sDescription]</a></td>"; |
106 | 106 | } |
107 | 107 | print " <td>$l[cdate]</td>"; |
@@ -5,41 +5,41 @@ discard block |
||
5 | 5 | *********************************************/ |
6 | 6 | |
7 | 7 | # required functions if requested via AJAX |
8 | -if(!is_object(@$User)) { |
|
9 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
8 | +if (!is_object (@$User)) { |
|
9 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
10 | 10 | # classes |
11 | 11 | $Database = new Database_PDO; |
12 | - $User = new User ($Database); |
|
13 | - $Tools = new Tools ($Database); |
|
12 | + $User = new User ($Database); |
|
13 | + $Tools = new Tools ($Database); |
|
14 | 14 | $Subnets = new Subnets ($Database); |
15 | - $Sections = new Sections ($Database); |
|
16 | - $Log = new Logging ($Database); |
|
17 | - $Result = new Result (); |
|
15 | + $Sections = new Sections ($Database); |
|
16 | + $Log = new Logging ($Database); |
|
17 | + $Result = new Result (); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # user must be authenticated |
21 | 21 | $User->check_user_session (); |
22 | 22 | |
23 | 23 | # if direct request that redirect to tools page |
24 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
25 | - header("Location: ".create_link("tools","changelog")); |
|
24 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
25 | + header ("Location: ".create_link ("tools", "changelog")); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | # changelog to syslog |
29 | -if ($User->settings->log!="syslog") { |
|
29 | +if ($User->settings->log != "syslog") { |
|
30 | 30 | /* get logs */ |
31 | 31 | $clogs = $Log->fetch_all_changelogs (false, "", 50); |
32 | 32 | } |
33 | 33 | |
34 | 34 | # syslog |
35 | -if ($User->settings->log=="syslog") { |
|
36 | - $Result->show("warning", _("Changelog files are sent to syslog"), false); |
|
35 | +if ($User->settings->log == "syslog") { |
|
36 | + $Result->show ("warning", _ ("Changelog files are sent to syslog"), false); |
|
37 | 37 | } |
38 | 38 | # none |
39 | -elseif(sizeof($clogs)==0) { |
|
39 | +elseif (sizeof ($clogs) == 0) { |
|
40 | 40 | print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
41 | - print "<p>"._("No changelogs available")."</p>"; |
|
42 | - print "<small>"._("No changelog entries are available")."</small>"; |
|
41 | + print "<p>"._ ("No changelogs available")."</p>"; |
|
42 | + print "<small>"._ ("No changelog entries are available")."</small>"; |
|
43 | 43 | print "</blockquote>"; |
44 | 44 | } |
45 | 45 | |
@@ -50,41 +50,41 @@ discard block |
||
50 | 50 | |
51 | 51 | # headers |
52 | 52 | print "<tr>"; |
53 | - print " <th>"._('User')."</th>"; |
|
54 | - print " <th>"._('Type')."</th>"; |
|
55 | - print " <th>"._('Object')."</th>"; |
|
56 | - print " <th>"._('Date')."</th>"; |
|
57 | - print " <th>"._('Change')."</th>"; |
|
53 | + print " <th>"._ ('User')."</th>"; |
|
54 | + print " <th>"._ ('Type')."</th>"; |
|
55 | + print " <th>"._ ('Object')."</th>"; |
|
56 | + print " <th>"._ ('Date')."</th>"; |
|
57 | + print " <th>"._ ('Change')."</th>"; |
|
58 | 58 | print "</tr>"; |
59 | 59 | |
60 | 60 | # logs |
61 | - $pc = 0; //print count |
|
62 | - foreach($clogs as $l) { |
|
61 | + $pc = 0; //print count |
|
62 | + foreach ($clogs as $l) { |
|
63 | 63 | |
64 | 64 | # cast |
65 | 65 | $l = (array) $l; |
66 | 66 | |
67 | - if($pc < 5) { |
|
67 | + if ($pc < 5) { |
|
68 | 68 | # permissions |
69 | - if($l['ctype']=="subnet") { $permission = $Subnets->check_permission ($User->user, $l['tid']); } |
|
70 | - elseif($l['ctype']=="ip_addr") { $permission = $Subnets->check_permission ($User->user, $l['subnetId']); } |
|
71 | - elseif($l['ctype']=="section") { $permission = $Sections->check_permission ($User->user, $l['sectionId']); } |
|
72 | - else { $permission = 0; } |
|
69 | + if ($l['ctype'] == "subnet") { $permission = $Subnets->check_permission ($User->user, $l['tid']); } |
|
70 | + elseif ($l['ctype'] == "ip_addr") { $permission = $Subnets->check_permission ($User->user, $l['subnetId']); } |
|
71 | + elseif ($l['ctype'] == "section") { $permission = $Sections->check_permission ($User->user, $l['sectionId']); } |
|
72 | + else { $permission = 0; } |
|
73 | 73 | |
74 | 74 | # if 0 ignore |
75 | - if($permission > 0) { |
|
75 | + if ($permission > 0) { |
|
76 | 76 | # format diff |
77 | - $l['cdiff'] = str_replace("\n\n", "", trim($l['cdiff'])); |
|
78 | - $l['cdiff'] = str_replace("\n", "; ", $l['cdiff']); |
|
77 | + $l['cdiff'] = str_replace ("\n\n", "", trim ($l['cdiff'])); |
|
78 | + $l['cdiff'] = str_replace ("\n", "; ", $l['cdiff']); |
|
79 | 79 | |
80 | 80 | # format type |
81 | - switch($l['ctype']) { |
|
82 | - case "ip_addr": { $l['ctype'] = "IP address"; break; } |
|
83 | - case "subnet": if($l['isFolder']==1) { $l['ctype'] = "Folder"; } |
|
84 | - else { $l['ctype'] = "Subnet"; } |
|
81 | + switch ($l['ctype']) { |
|
82 | + case "ip_addr": { $l['ctype'] = "IP address"; break; } |
|
83 | + case "subnet": if ($l['isFolder'] == 1) { $l['ctype'] = "Folder"; } |
|
84 | + else { $l['ctype'] = "Subnet"; } |
|
85 | 85 | break; |
86 | 86 | |
87 | - case "section": { $l['ctype'] = "Section"; break; } |
|
87 | + case "section": { $l['ctype'] = "Section"; break; } |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | print "<tr>"; |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | print " <td>$l[ctype] / $l[caction] $l[cresult]</td>"; |
93 | 93 | |
94 | 94 | # subnet, section or ip address |
95 | - if($l['ctype']=="IP address") { |
|
96 | - print " <td><a href='".create_link("subnets",$l['sectionId'],$l['subnetId'],"address-details",$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."</a></td>"; |
|
95 | + if ($l['ctype'] == "IP address") { |
|
96 | + print " <td><a href='".create_link ("subnets", $l['sectionId'], $l['subnetId'], "address-details", $l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."</a></td>"; |
|
97 | 97 | } |
98 | - elseif($l['ctype']=="Subnet") { |
|
99 | - print " <td><a href='".create_link("subnets",$l['sectionId'],$l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."/$l[mask]</a></td>"; |
|
98 | + elseif ($l['ctype'] == "Subnet") { |
|
99 | + print " <td><a href='".create_link ("subnets", $l['sectionId'], $l['tid'])."'>".$Subnets->transform_address ($l['ip_addr'], "dotted")."/$l[mask]</a></td>"; |
|
100 | 100 | } |
101 | - elseif($l['ctype']=="Folder") { |
|
102 | - print " <td><a href='".create_link("folder",$l['sectionId'],$l['tid'])."'>$l[sDescription]</a></td>"; |
|
101 | + elseif ($l['ctype'] == "Folder") { |
|
102 | + print " <td><a href='".create_link ("folder", $l['sectionId'], $l['tid'])."'>$l[sDescription]</a></td>"; |
|
103 | 103 | } |
104 | - elseif($l['ctype']=="Section") { |
|
105 | - print " <td><a href='".create_link("subnets",$l['tid'])."'>$l[sDescription]</a></td>"; |
|
104 | + elseif ($l['ctype'] == "Section") { |
|
105 | + print " <td><a href='".create_link ("subnets", $l['tid'])."'>$l[sDescription]</a></td>"; |
|
106 | 106 | } |
107 | 107 | print " <td>$l[cdate]</td>"; |
108 | 108 | print " <td>$l[cdiff]</td>"; |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # required functions |
3 | 3 | if(!is_object(@$User)) { |
4 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
5 | - # classes |
|
6 | - $Database = new Database_PDO; |
|
7 | - $User = new User ($Database); |
|
8 | - $Tools = new Tools ($Database); |
|
9 | - $Subnets = new Subnets ($Database); |
|
10 | - $Addresses = new Addresses ($Database); |
|
4 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
5 | + # classes |
|
6 | + $Database = new Database_PDO; |
|
7 | + $User = new User ($Database); |
|
8 | + $Tools = new Tools ($Database); |
|
9 | + $Subnets = new Subnets ($Database); |
|
10 | + $Addresses = new Addresses ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | 17 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
18 | - header("Location: ".create_link("tools", "ip-calculator")); |
|
18 | + header("Location: ".create_link("tools", "ip-calculator")); |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $User->check_user_session (); |
16 | 16 | |
17 | 17 | # if direct request that redirect to tools page |
18 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
19 | 19 | header("Location: ".create_link("tools","logs")); |
20 | 20 | } |
21 | 21 |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # required functions |
3 | -if(!is_object(@$User)) { |
|
4 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
3 | +if (!is_object (@$User)) { |
|
4 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
5 | 5 | # classes |
6 | 6 | $Database = new Database_PDO; |
7 | - $User = new User ($Database); |
|
8 | - $Tools = new Tools ($Database); |
|
7 | + $User = new User ($Database); |
|
8 | + $Tools = new Tools ($Database); |
|
9 | 9 | $Subnets = new Subnets ($Database); |
10 | - $Addresses = new Addresses ($Database); |
|
10 | + $Addresses = new Addresses ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
14 | 14 | $User->check_user_session (); |
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | - header("Location: ".create_link("tools", "ip-calculator")); |
|
17 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
18 | + header ("Location: ".create_link ("tools", "ip-calculator")); |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | <div class="form-group"> |
42 | 42 | <div class="col-sm-12"> |
43 | 43 | <div class="input-group"> |
44 | - <input type="text" class="form-control input-md" name="cidr" placeholder="<?php print _('10.11.12.3/24'); ?>"> |
|
44 | + <input type="text" class="form-control input-md" name="cidr" placeholder="<?php print _ ('10.11.12.3/24'); ?>"> |
|
45 | 45 | <span class="input-group-btn"> |
46 | - <button type="submit" class="btn btn-md btn-default"><?php print _('Calculate');?></button> |
|
46 | + <button type="submit" class="btn btn-md btn-default"><?php print _ ('Calculate'); ?></button> |
|
47 | 47 | </span> |
48 | 48 | </div> |
49 | 49 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | |
54 | 54 | <div class="ipCalcResult2"> |
55 | - <span class="text-muted"><?php print _('Please enter IP address and mask in CIDR format'); ?></span> |
|
55 | + <span class="text-muted"><?php print _ ('Please enter IP address and mask in CIDR format'); ?></span> |
|
56 | 56 | </div> |
57 | 57 | |
58 | 58 | </div> |
59 | 59 | \ No newline at end of file |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | # required functions |
10 | 10 | if(!is_object(@$User)) { |
11 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
12 | - # classes |
|
13 | - $Database = new Database_PDO; |
|
14 | - $User = new User ($Database); |
|
15 | - $Tools = new Tools ($Database); |
|
11 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
12 | + # classes |
|
13 | + $Database = new Database_PDO; |
|
14 | + $User = new User ($Database); |
|
15 | + $Tools = new Tools ($Database); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | # user must be authenticated |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | # if direct request that redirect to tools page |
22 | 22 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
23 | - header("Location: ".create_link("administration","logs")); |
|
23 | + header("Location: ".create_link("administration","logs")); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /* You can check who requested this, to adjust parameters */ |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $User->check_user_session (); |
16 | 16 | |
17 | 17 | # if direct request that redirect to tools page |
18 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
19 | 19 | header("Location: ".create_link("tools","logs")); |
20 | 20 | } |
21 | 21 |
@@ -7,25 +7,25 @@ |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | # required functions |
10 | -if(!is_object(@$User)) { |
|
11 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
10 | +if (!is_object (@$User)) { |
|
11 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
12 | 12 | # classes |
13 | - $Database = new Database_PDO; |
|
14 | - $User = new User ($Database); |
|
15 | - $Tools = new Tools ($Database); |
|
13 | + $Database = new Database_PDO; |
|
14 | + $User = new User ($Database); |
|
15 | + $Tools = new Tools ($Database); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | # user must be authenticated |
19 | 19 | $User->check_user_session (); |
20 | 20 | |
21 | 21 | # if direct request that redirect to tools page |
22 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
23 | - header("Location: ".create_link("administration","logs")); |
|
22 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
23 | + header ("Location: ".create_link ("administration", "logs")); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /* You can check who requested this, to adjust parameters */ |
27 | -if($_SERVER['HTTP_X_REQUESTED_WITH']=="XMLHttpRequest") { $dashboard = true; } |
|
28 | -else { $dashboard = false; } |
|
27 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest") { $dashboard = true; } |
|
28 | +else { $dashboard = false; } |
|
29 | 29 | |
30 | 30 | ?> |
31 | 31 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # required functions |
3 | 3 | if(!is_object(@$User)) { |
4 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
5 | - # classes |
|
6 | - $Database = new Database_PDO; |
|
7 | - $User = new User ($Database); |
|
8 | - $Tools = new Tools ($Database); |
|
9 | - $Subnets = new Subnets ($Database); |
|
10 | - $Addresses = new Addresses ($Database); |
|
4 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
5 | + # classes |
|
6 | + $Database = new Database_PDO; |
|
7 | + $User = new User ($Database); |
|
8 | + $Tools = new Tools ($Database); |
|
9 | + $Subnets = new Subnets ($Database); |
|
10 | + $Addresses = new Addresses ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | 17 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
18 | - header("Location: ".create_link("tools")); |
|
18 | + header("Location: ".create_link("tools")); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | # set items |
@@ -80,21 +80,21 @@ discard block |
||
80 | 80 | <?php |
81 | 81 | |
82 | 82 | foreach($tools_menu as $k=>$tool) { |
83 | - # items |
|
84 | - foreach($tool as $t) { |
|
85 | - # remove unneeded |
|
86 | - print " <div class='col-xs-12 col-md-6 col-lg-6 widget-dash1'>"; |
|
87 | - print " <div class='inner thumbnail'>"; |
|
88 | - print " <div class='hContent'>"; |
|
89 | - print " <div class='icon'><a href='".create_link("tools",$t['href'])."'><i class='fa $t[icon]'></i></a></div>"; |
|
90 | - print " <div class='text'><a href='".create_link("tools",$t['href'])."'>"._($t['name'])."</a><hr><span class='text-muted'>"._($t['description'])."</span></div>"; |
|
91 | - print " </div>"; |
|
92 | - print " </div>"; |
|
93 | - print " </div>"; |
|
94 | - } |
|
83 | + # items |
|
84 | + foreach($tool as $t) { |
|
85 | + # remove unneeded |
|
86 | + print " <div class='col-xs-12 col-md-6 col-lg-6 widget-dash1'>"; |
|
87 | + print " <div class='inner thumbnail'>"; |
|
88 | + print " <div class='hContent'>"; |
|
89 | + print " <div class='icon'><a href='".create_link("tools",$t['href'])."'><i class='fa $t[icon]'></i></a></div>"; |
|
90 | + print " <div class='text'><a href='".create_link("tools",$t['href'])."'>"._($t['name'])."</a><hr><span class='text-muted'>"._($t['description'])."</span></div>"; |
|
91 | + print " </div>"; |
|
92 | + print " </div>"; |
|
93 | + print " </div>"; |
|
94 | + } |
|
95 | 95 | |
96 | - # clear and break |
|
97 | - print "<div class='clearfix'></div>"; |
|
96 | + # clear and break |
|
97 | + print "<div class='clearfix'></div>"; |
|
98 | 98 | } |
99 | 99 | ?> |
100 | 100 | </div> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $User->check_user_session (); |
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
17 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | 18 | header("Location: ".create_link("tools")); |
19 | 19 | } |
20 | 20 | |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | # Subnets |
26 | 26 | $tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-sitemap", "name"=>"Subnets", "href"=>"subnets", "description"=>"Show all subnets"); |
27 | 27 | $tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-cloud", "name"=>"VLAN", "href"=>"vlan", "description"=>"Show VLANs and belonging subnets"); |
28 | -if($User->settings->enableVRF == 1) |
|
29 | -$tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-cloud", "name"=>"VRF", "href"=>"vrf", "description"=>"Show VRFs and belonging networks"); |
|
28 | +if($User->settings->enableVRF == 1) { |
|
29 | + $tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-cloud", "name"=>"VRF", "href"=>"vrf", "description"=>"Show VRFs and belonging networks"); |
|
30 | +} |
|
30 | 31 | $tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-desktop", "name"=>"Devices", "href"=>"devices", "description"=>"Show all configured devices"); |
31 | 32 | ?> |
32 | 33 |
@@ -1,33 +1,33 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # required functions |
3 | -if(!is_object(@$User)) { |
|
4 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
3 | +if (!is_object (@$User)) { |
|
4 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
5 | 5 | # classes |
6 | 6 | $Database = new Database_PDO; |
7 | - $User = new User ($Database); |
|
8 | - $Tools = new Tools ($Database); |
|
7 | + $User = new User ($Database); |
|
8 | + $Tools = new Tools ($Database); |
|
9 | 9 | $Subnets = new Subnets ($Database); |
10 | - $Addresses = new Addresses ($Database); |
|
10 | + $Addresses = new Addresses ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
14 | 14 | $User->check_user_session (); |
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | - header("Location: ".create_link("tools")); |
|
17 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
18 | + header ("Location: ".create_link ("tools")); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | # set items |
22 | 22 | # Tools |
23 | -$tools_menu['Tools'][] = array("show"=>true, "icon"=>"fa-search", "name"=>"Search", "href"=>"search", "description"=>"Search database Addresses, subnets and VLANs"); |
|
24 | -$tools_menu['Tools'][] = array("show"=>true, "icon"=>"fa-calculator", "name"=>"IP calculator", "href"=>"ip-calculator","description"=>"IPv4v6 calculator for subnet calculations"); |
|
23 | +$tools_menu['Tools'][] = array ("show"=>true, "icon"=>"fa-search", "name"=>"Search", "href"=>"search", "description"=>"Search database Addresses, subnets and VLANs"); |
|
24 | +$tools_menu['Tools'][] = array ("show"=>true, "icon"=>"fa-calculator", "name"=>"IP calculator", "href"=>"ip-calculator", "description"=>"IPv4v6 calculator for subnet calculations"); |
|
25 | 25 | # Subnets |
26 | -$tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-sitemap", "name"=>"Subnets", "href"=>"subnets", "description"=>"Show all subnets"); |
|
27 | -$tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-cloud", "name"=>"VLAN", "href"=>"vlan", "description"=>"Show VLANs and belonging subnets"); |
|
28 | -if($User->settings->enableVRF == 1) |
|
29 | -$tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-cloud", "name"=>"VRF", "href"=>"vrf", "description"=>"Show VRFs and belonging networks"); |
|
30 | -$tools_menu['Subnets'][] = array("show"=>true, "icon"=>"fa-desktop", "name"=>"Devices", "href"=>"devices", "description"=>"Show all configured devices"); |
|
26 | +$tools_menu['Subnets'][] = array ("show"=>true, "icon"=>"fa-sitemap", "name"=>"Subnets", "href"=>"subnets", "description"=>"Show all subnets"); |
|
27 | +$tools_menu['Subnets'][] = array ("show"=>true, "icon"=>"fa-cloud", "name"=>"VLAN", "href"=>"vlan", "description"=>"Show VLANs and belonging subnets"); |
|
28 | +if ($User->settings->enableVRF == 1) |
|
29 | +$tools_menu['Subnets'][] = array ("show"=>true, "icon"=>"fa-cloud", "name"=>"VRF", "href"=>"vrf", "description"=>"Show VRFs and belonging networks"); |
|
30 | +$tools_menu['Subnets'][] = array ("show"=>true, "icon"=>"fa-desktop", "name"=>"Devices", "href"=>"devices", "description"=>"Show all configured devices"); |
|
31 | 31 | ?> |
32 | 32 | |
33 | 33 | |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | |
80 | 80 | <?php |
81 | 81 | |
82 | -foreach($tools_menu as $k=>$tool) { |
|
82 | +foreach ($tools_menu as $k=>$tool) { |
|
83 | 83 | # items |
84 | - foreach($tool as $t) { |
|
84 | + foreach ($tool as $t) { |
|
85 | 85 | # remove unneeded |
86 | 86 | print " <div class='col-xs-12 col-md-6 col-lg-6 widget-dash1'>"; |
87 | 87 | print " <div class='inner thumbnail'>"; |
88 | 88 | print " <div class='hContent'>"; |
89 | - print " <div class='icon'><a href='".create_link("tools",$t['href'])."'><i class='fa $t[icon]'></i></a></div>"; |
|
90 | - print " <div class='text'><a href='".create_link("tools",$t['href'])."'>"._($t['name'])."</a><hr><span class='text-muted'>"._($t['description'])."</span></div>"; |
|
89 | + print " <div class='icon'><a href='".create_link ("tools", $t['href'])."'><i class='fa $t[icon]'></i></a></div>"; |
|
90 | + print " <div class='text'><a href='".create_link ("tools", $t['href'])."'>"._ ($t['name'])."</a><hr><span class='text-muted'>"._ ($t['description'])."</span></div>"; |
|
91 | 91 | print " </div>"; |
92 | 92 | print " </div>"; |
93 | 93 | print " </div>"; |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | # required functions |
4 | 4 | if(!is_object(@$User)) { |
5 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
6 | - # classes |
|
7 | - $Database = new Database_PDO; |
|
8 | - $User = new User ($Database); |
|
9 | - $Tools = new Tools ($Database); |
|
5 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
6 | + # classes |
|
7 | + $Database = new Database_PDO; |
|
8 | + $User = new User ($Database); |
|
9 | + $Tools = new Tools ($Database); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | # user must be authenticated |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | # required functions |
4 | -if(!is_object(@$User)) { |
|
5 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
4 | +if (!is_object (@$User)) { |
|
5 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
6 | 6 | # classes |
7 | - $Database = new Database_PDO; |
|
8 | - $User = new User ($Database); |
|
9 | - $Tools = new Tools ($Database); |
|
7 | + $Database = new Database_PDO; |
|
8 | + $User = new User ($Database); |
|
9 | + $Tools = new Tools ($Database); |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | # user must be authenticated |
@@ -19,37 +19,37 @@ discard block |
||
19 | 19 | |
20 | 20 | <!-- sections --> |
21 | 21 | <tr> |
22 | - <td class="title"><?php print _('Number of Sections'); ?></td> |
|
22 | + <td class="title"><?php print _ ('Number of Sections'); ?></td> |
|
23 | 23 | <td><?php print $Database->numObjects ("sections"); ?></td> |
24 | 24 | </tr> |
25 | 25 | |
26 | 26 | <!-- subnets --> |
27 | 27 | <tr> |
28 | - <td class="title"><?php print _('Number of Subnets'); ?></td> |
|
29 | - <td><?php print $Database->numObjects ("subnets");; ?></td> |
|
28 | + <td class="title"><?php print _ ('Number of Subnets'); ?></td> |
|
29 | + <td><?php print $Database->numObjects ("subnets"); ; ?></td> |
|
30 | 30 | </tr> |
31 | 31 | |
32 | 32 | <!-- VLAN --> |
33 | 33 | <tr> |
34 | - <td class="title"><?php print _('Number of VLANs'); ?></td> |
|
35 | - <td><?php print $Database->numObjects ("vlans");; ?></td> |
|
34 | + <td class="title"><?php print _ ('Number of VLANs'); ?></td> |
|
35 | + <td><?php print $Database->numObjects ("vlans"); ; ?></td> |
|
36 | 36 | </tr> |
37 | 37 | |
38 | 38 | <!-- IPv4 addresses --> |
39 | 39 | <tr> |
40 | - <td class="title"><?php print _('Number of IPv4 addresses'); ?></td> |
|
40 | + <td class="title"><?php print _ ('Number of IPv4 addresses'); ?></td> |
|
41 | 41 | <td><?php print $Tools->count_subnets ("IPv4"); ?></td> |
42 | 42 | </tr> |
43 | 43 | |
44 | 44 | <!-- IPv6 addresses --> |
45 | 45 | <tr> |
46 | - <td class="title"><?php print _('Number of IPv6 addresses'); ?></td> |
|
46 | + <td class="title"><?php print _ ('Number of IPv6 addresses'); ?></td> |
|
47 | 47 | <td><?php print $Tools->count_subnets ("IPv6"); ?></td> |
48 | 48 | </tr> |
49 | 49 | |
50 | 50 | <!-- All users - only for admin! --> |
51 | 51 | <tr> |
52 | - <td class="title"><?php print _('Number of users'); ?></td> |
|
52 | + <td class="title"><?php print _ ('Number of users'); ?></td> |
|
53 | 53 | <td><?php print $Database->numObjects ("users"); ?></td> |
54 | 54 | </tr> |
55 | 55 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # required functions |
3 | 3 | if(!isset($User)) { |
4 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
5 | - # classes |
|
6 | - $Database = new Database_PDO; |
|
7 | - $User = new User ($Database); |
|
8 | - $Tools = new Tools ($Database); |
|
9 | - $Subnets = new Subnets ($Database); |
|
10 | - $Addresses = new Addresses ($Database); |
|
4 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
5 | + # classes |
|
6 | + $Database = new Database_PDO; |
|
7 | + $User = new User ($Database); |
|
8 | + $Tools = new Tools ($Database); |
|
9 | + $Subnets = new Subnets ($Database); |
|
10 | + $Addresses = new Addresses ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | 17 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
18 | - header("Location: ".create_link("tools","favourites")); |
|
18 | + header("Location: ".create_link("tools","favourites")); |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 | |
@@ -33,76 +33,76 @@ discard block |
||
33 | 33 | |
34 | 34 | # print if none |
35 | 35 | if(!$fsubnets) { |
36 | - print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
37 | - print "<p>"._("No favourite subnets selected")."</p><br>"; |
|
38 | - print "<small>"._("You can add subnets to favourites by clicking star icon in subnet details")."!</small><br>"; |
|
39 | - print "</blockquote>"; |
|
36 | + print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
37 | + print "<p>"._("No favourite subnets selected")."</p><br>"; |
|
38 | + print "<small>"._("You can add subnets to favourites by clicking star icon in subnet details")."!</small><br>"; |
|
39 | + print "</blockquote>"; |
|
40 | 40 | } |
41 | 41 | else { |
42 | - print "<table class='table table-condensed table-hover table-top favs'>"; |
|
42 | + print "<table class='table table-condensed table-hover table-top favs'>"; |
|
43 | 43 | |
44 | - # headers |
|
45 | - print "<tr>"; |
|
46 | - print " <th>"._('Object')."</th>"; |
|
47 | - print " <th>"._('Description')."</th>"; |
|
48 | - print " <th>"._('Section')."</th>"; |
|
49 | - print " <th>"._('VLAN')."</th>"; |
|
50 | - print " <th></th>"; |
|
51 | - print "</tr>"; |
|
44 | + # headers |
|
45 | + print "<tr>"; |
|
46 | + print " <th>"._('Object')."</th>"; |
|
47 | + print " <th>"._('Description')."</th>"; |
|
48 | + print " <th>"._('Section')."</th>"; |
|
49 | + print " <th>"._('VLAN')."</th>"; |
|
50 | + print " <th></th>"; |
|
51 | + print "</tr>"; |
|
52 | 52 | |
53 | - # subnets |
|
54 | - foreach($fsubnets as $f) { |
|
53 | + # subnets |
|
54 | + foreach($fsubnets as $f) { |
|
55 | 55 | |
56 | - # must be either subnet or folder |
|
57 | - if(sizeof($f)>0) { |
|
56 | + # must be either subnet or folder |
|
57 | + if(sizeof($f)>0) { |
|
58 | 58 | |
59 | 59 | # add full information |
60 | 60 | $fullinfo = $f['isFull']==1 ? " <span class='badge badge1 badge2 badge4'>"._("Full")."</span>" : ""; |
61 | 61 | |
62 | - print "<tr class='favSubnet-$f[subnetId]'>"; |
|
63 | - |
|
64 | - if($f['isFolder']==1) { |
|
65 | - $master = true; |
|
66 | - print " <td><a href='".create_link("folder",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-folder'></i> $f[description]</a></td>"; |
|
67 | - } |
|
68 | - else { |
|
69 | - //master? |
|
70 | - if($Subnets->has_slaves ($f['subnetId'])) { $master = true; print " <td><a href='".create_link("subnets",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-folder-o'></i>".$Subnets->transform_to_dotted($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
71 | - else { $master = false; print " <td><a href='".create_link("subnets",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-sitemap' ></i>".$Subnets->transform_to_dotted($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
72 | - } |
|
73 | - print " <td>$f[description]</td>"; |
|
74 | - print " <td><a href='".create_link("subnets",$f['sectionId'])."'>$f[section]</a></td>"; |
|
75 | - |
|
76 | - # get vlan info |
|
77 | - if(strlen($f['vlanId'])>0 && $f['vlanId']!=0) { |
|
78 | - $vlan = $Tools->fetch_object("vlans", "vlanId", $f['vlanId']); |
|
79 | - print " <td>$vlan->number</td>"; |
|
80 | - } else { |
|
81 | - print " <td>/</td>"; |
|
82 | - } |
|
83 | - |
|
84 | - # usage |
|
85 | - if(!$master) { |
|
86 | - $address_count = $Addresses->count_subnet_addresses ($f['subnetId']); |
|
87 | - $subnet_usage = $Subnets->calculate_subnet_usage (gmp_strval($address_count), $f['mask'], $f['subnet'], $f['isFull']); |
|
88 | - } |
|
89 | - |
|
90 | - # add address |
|
91 | - if($master===true || $f['isFolder']==1 || $Subnets->reformat_number($subnet_usage['freehosts'])=="0") { $disabled = "disabled"; } |
|
92 | - else { $disabled = ""; } |
|
93 | - |
|
94 | - # remove |
|
95 | - print " <td class='actions'>"; |
|
96 | - print " <div class='btn-group'>"; |
|
97 | - print " <a class='btn btn-xs btn-default modIPaddr btn-success $disabled' href='' data-container='body' rel='tooltip' title='"._('Add new IP address')."' data-subnetId='$f[subnetId]' data-action='add' data-id=''><i class='fa fa-plus'></i></a>"; |
|
98 | - print " <a class='btn btn-xs btn-default editFavourite' data-subnetId='$f[subnetId]' data-action='remove' data-from='widget'><i class='fa fa-star favourite-$f[subnetId]' rel='tooltip' title='"._('Click to remove from favourites')."'></i></a>"; |
|
99 | - print " </div>"; |
|
100 | - print " </td>"; |
|
101 | - |
|
102 | - print "</tr>"; |
|
103 | - } |
|
104 | - } |
|
105 | - |
|
106 | - print "</table>"; |
|
62 | + print "<tr class='favSubnet-$f[subnetId]'>"; |
|
63 | + |
|
64 | + if($f['isFolder']==1) { |
|
65 | + $master = true; |
|
66 | + print " <td><a href='".create_link("folder",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-folder'></i> $f[description]</a></td>"; |
|
67 | + } |
|
68 | + else { |
|
69 | + //master? |
|
70 | + if($Subnets->has_slaves ($f['subnetId'])) { $master = true; print " <td><a href='".create_link("subnets",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-folder-o'></i>".$Subnets->transform_to_dotted($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
71 | + else { $master = false; print " <td><a href='".create_link("subnets",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-sitemap' ></i>".$Subnets->transform_to_dotted($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
72 | + } |
|
73 | + print " <td>$f[description]</td>"; |
|
74 | + print " <td><a href='".create_link("subnets",$f['sectionId'])."'>$f[section]</a></td>"; |
|
75 | + |
|
76 | + # get vlan info |
|
77 | + if(strlen($f['vlanId'])>0 && $f['vlanId']!=0) { |
|
78 | + $vlan = $Tools->fetch_object("vlans", "vlanId", $f['vlanId']); |
|
79 | + print " <td>$vlan->number</td>"; |
|
80 | + } else { |
|
81 | + print " <td>/</td>"; |
|
82 | + } |
|
83 | + |
|
84 | + # usage |
|
85 | + if(!$master) { |
|
86 | + $address_count = $Addresses->count_subnet_addresses ($f['subnetId']); |
|
87 | + $subnet_usage = $Subnets->calculate_subnet_usage (gmp_strval($address_count), $f['mask'], $f['subnet'], $f['isFull']); |
|
88 | + } |
|
89 | + |
|
90 | + # add address |
|
91 | + if($master===true || $f['isFolder']==1 || $Subnets->reformat_number($subnet_usage['freehosts'])=="0") { $disabled = "disabled"; } |
|
92 | + else { $disabled = ""; } |
|
93 | + |
|
94 | + # remove |
|
95 | + print " <td class='actions'>"; |
|
96 | + print " <div class='btn-group'>"; |
|
97 | + print " <a class='btn btn-xs btn-default modIPaddr btn-success $disabled' href='' data-container='body' rel='tooltip' title='"._('Add new IP address')."' data-subnetId='$f[subnetId]' data-action='add' data-id=''><i class='fa fa-plus'></i></a>"; |
|
98 | + print " <a class='btn btn-xs btn-default editFavourite' data-subnetId='$f[subnetId]' data-action='remove' data-from='widget'><i class='fa fa-star favourite-$f[subnetId]' rel='tooltip' title='"._('Click to remove from favourites')."'></i></a>"; |
|
99 | + print " </div>"; |
|
100 | + print " </td>"; |
|
101 | + |
|
102 | + print "</tr>"; |
|
103 | + } |
|
104 | + } |
|
105 | + |
|
106 | + print "</table>"; |
|
107 | 107 | } |
108 | 108 | ?> |
109 | 109 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $User->check_user_session (); |
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
17 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | 18 | header("Location: ".create_link("tools","favourites")); |
19 | 19 | } |
20 | 20 | ?> |
@@ -77,7 +77,8 @@ discard block |
||
77 | 77 | if(strlen($f['vlanId'])>0 && $f['vlanId']!=0) { |
78 | 78 | $vlan = $Tools->fetch_object("vlans", "vlanId", $f['vlanId']); |
79 | 79 | print " <td>$vlan->number</td>"; |
80 | - } else { |
|
80 | + } |
|
81 | + else { |
|
81 | 82 | print " <td>/</td>"; |
82 | 83 | } |
83 | 84 |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # required functions |
3 | -if(!isset($User)) { |
|
4 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
3 | +if (!isset($User)) { |
|
4 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
5 | 5 | # classes |
6 | 6 | $Database = new Database_PDO; |
7 | - $User = new User ($Database); |
|
8 | - $Tools = new Tools ($Database); |
|
7 | + $User = new User ($Database); |
|
8 | + $Tools = new Tools ($Database); |
|
9 | 9 | $Subnets = new Subnets ($Database); |
10 | - $Addresses = new Addresses ($Database); |
|
10 | + $Addresses = new Addresses ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
14 | 14 | $User->check_user_session (); |
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | - header("Location: ".create_link("tools","favourites")); |
|
17 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
18 | + header ("Location: ".create_link ("tools", "favourites")); |
|
19 | 19 | } |
20 | 20 | ?> |
21 | 21 | |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $fsubnets = $User->fetch_favourite_subnets (); |
33 | 33 | |
34 | 34 | # print if none |
35 | -if(!$fsubnets) { |
|
35 | +if (!$fsubnets) { |
|
36 | 36 | print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
37 | - print "<p>"._("No favourite subnets selected")."</p><br>"; |
|
38 | - print "<small>"._("You can add subnets to favourites by clicking star icon in subnet details")."!</small><br>"; |
|
37 | + print "<p>"._ ("No favourite subnets selected")."</p><br>"; |
|
38 | + print "<small>"._ ("You can add subnets to favourites by clicking star icon in subnet details")."!</small><br>"; |
|
39 | 39 | print "</blockquote>"; |
40 | 40 | } |
41 | 41 | else { |
@@ -43,59 +43,59 @@ discard block |
||
43 | 43 | |
44 | 44 | # headers |
45 | 45 | print "<tr>"; |
46 | - print " <th>"._('Object')."</th>"; |
|
47 | - print " <th>"._('Description')."</th>"; |
|
48 | - print " <th>"._('Section')."</th>"; |
|
49 | - print " <th>"._('VLAN')."</th>"; |
|
46 | + print " <th>"._ ('Object')."</th>"; |
|
47 | + print " <th>"._ ('Description')."</th>"; |
|
48 | + print " <th>"._ ('Section')."</th>"; |
|
49 | + print " <th>"._ ('VLAN')."</th>"; |
|
50 | 50 | print " <th></th>"; |
51 | 51 | print "</tr>"; |
52 | 52 | |
53 | 53 | # subnets |
54 | - foreach($fsubnets as $f) { |
|
54 | + foreach ($fsubnets as $f) { |
|
55 | 55 | |
56 | 56 | # must be either subnet or folder |
57 | - if(sizeof($f)>0) { |
|
57 | + if (sizeof ($f) > 0) { |
|
58 | 58 | |
59 | 59 | # add full information |
60 | - $fullinfo = $f['isFull']==1 ? " <span class='badge badge1 badge2 badge4'>"._("Full")."</span>" : ""; |
|
60 | + $fullinfo = $f['isFull'] == 1 ? " <span class='badge badge1 badge2 badge4'>"._ ("Full")."</span>" : ""; |
|
61 | 61 | |
62 | 62 | print "<tr class='favSubnet-$f[subnetId]'>"; |
63 | 63 | |
64 | - if($f['isFolder']==1) { |
|
64 | + if ($f['isFolder'] == 1) { |
|
65 | 65 | $master = true; |
66 | - print " <td><a href='".create_link("folder",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-folder'></i> $f[description]</a></td>"; |
|
66 | + print " <td><a href='".create_link ("folder", $f['sectionId'], $f['subnetId'])."'><i class='fa fa-sfolder fa-folder'></i> $f[description]</a></td>"; |
|
67 | 67 | } |
68 | 68 | else { |
69 | 69 | //master? |
70 | - if($Subnets->has_slaves ($f['subnetId'])) { $master = true; print " <td><a href='".create_link("subnets",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-folder-o'></i>".$Subnets->transform_to_dotted($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
71 | - else { $master = false; print " <td><a href='".create_link("subnets",$f['sectionId'],$f['subnetId'])."'><i class='fa fa-sfolder fa-sitemap' ></i>".$Subnets->transform_to_dotted($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
70 | + if ($Subnets->has_slaves ($f['subnetId'])) { $master = true; print " <td><a href='".create_link ("subnets", $f['sectionId'], $f['subnetId'])."'><i class='fa fa-sfolder fa-folder-o'></i>".$Subnets->transform_to_dotted ($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
71 | + else { $master = false; print " <td><a href='".create_link ("subnets", $f['sectionId'], $f['subnetId'])."'><i class='fa fa-sfolder fa-sitemap' ></i>".$Subnets->transform_to_dotted ($f['subnet'])."/$f[mask]</a> $fullinfo</td>"; } |
|
72 | 72 | } |
73 | 73 | print " <td>$f[description]</td>"; |
74 | - print " <td><a href='".create_link("subnets",$f['sectionId'])."'>$f[section]</a></td>"; |
|
74 | + print " <td><a href='".create_link ("subnets", $f['sectionId'])."'>$f[section]</a></td>"; |
|
75 | 75 | |
76 | 76 | # get vlan info |
77 | - if(strlen($f['vlanId'])>0 && $f['vlanId']!=0) { |
|
78 | - $vlan = $Tools->fetch_object("vlans", "vlanId", $f['vlanId']); |
|
77 | + if (strlen ($f['vlanId']) > 0 && $f['vlanId'] != 0) { |
|
78 | + $vlan = $Tools->fetch_object ("vlans", "vlanId", $f['vlanId']); |
|
79 | 79 | print " <td>$vlan->number</td>"; |
80 | 80 | } else { |
81 | 81 | print " <td>/</td>"; |
82 | 82 | } |
83 | 83 | |
84 | 84 | # usage |
85 | - if(!$master) { |
|
85 | + if (!$master) { |
|
86 | 86 | $address_count = $Addresses->count_subnet_addresses ($f['subnetId']); |
87 | - $subnet_usage = $Subnets->calculate_subnet_usage (gmp_strval($address_count), $f['mask'], $f['subnet'], $f['isFull']); |
|
87 | + $subnet_usage = $Subnets->calculate_subnet_usage (gmp_strval ($address_count), $f['mask'], $f['subnet'], $f['isFull']); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | # add address |
91 | - if($master===true || $f['isFolder']==1 || $Subnets->reformat_number($subnet_usage['freehosts'])=="0") { $disabled = "disabled"; } |
|
92 | - else { $disabled = ""; } |
|
91 | + if ($master === true || $f['isFolder'] == 1 || $Subnets->reformat_number ($subnet_usage['freehosts']) == "0") { $disabled = "disabled"; } |
|
92 | + else { $disabled = ""; } |
|
93 | 93 | |
94 | 94 | # remove |
95 | 95 | print " <td class='actions'>"; |
96 | 96 | print " <div class='btn-group'>"; |
97 | - print " <a class='btn btn-xs btn-default modIPaddr btn-success $disabled' href='' data-container='body' rel='tooltip' title='"._('Add new IP address')."' data-subnetId='$f[subnetId]' data-action='add' data-id=''><i class='fa fa-plus'></i></a>"; |
|
98 | - print " <a class='btn btn-xs btn-default editFavourite' data-subnetId='$f[subnetId]' data-action='remove' data-from='widget'><i class='fa fa-star favourite-$f[subnetId]' rel='tooltip' title='"._('Click to remove from favourites')."'></i></a>"; |
|
97 | + print " <a class='btn btn-xs btn-default modIPaddr btn-success $disabled' href='' data-container='body' rel='tooltip' title='"._ ('Add new IP address')."' data-subnetId='$f[subnetId]' data-action='add' data-id=''><i class='fa fa-plus'></i></a>"; |
|
98 | + print " <a class='btn btn-xs btn-default editFavourite' data-subnetId='$f[subnetId]' data-action='remove' data-from='widget'><i class='fa fa-star favourite-$f[subnetId]' rel='tooltip' title='"._ ('Click to remove from favourites')."'></i></a>"; |
|
99 | 99 | print " </div>"; |
100 | 100 | print " </td>"; |
101 | 101 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $slimit = 10; |
23 | 23 | |
24 | 24 | # if direct request include plot JS |
25 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
25 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
26 | 26 | # get widget details |
27 | 27 | if(!$widget = $Tools->fetch_widget ("wfile", $_REQUEST['section'])) { $Result->show("danger", _("Invalid widget"), true); } |
28 | 28 | # reset size and limit |
@@ -221,7 +221,8 @@ discard block |
||
221 | 221 | if($m!=0) { |
222 | 222 | ?> |
223 | 223 | $.plot($("#<?php print $type; ?>top10"), [ data ], options); |
224 | - <?php } else { ?> |
|
224 | + <?php } |
|
225 | +else { ?> |
|
225 | 226 | $("#IPv4top10").hide(); |
226 | 227 | <?php } ?> |
227 | 228 | }); |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | |
6 | 6 | # required functions |
7 | 7 | if(!is_object(@$User)) { |
8 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
9 | - # classes |
|
10 | - $Database = new Database_PDO; |
|
11 | - $User = new User ($Database); |
|
12 | - $Tools = new Tools ($Database); |
|
13 | - $Subnets = new Subnets ($Database); |
|
14 | - $Result = new Result (); |
|
8 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
9 | + # classes |
|
10 | + $Database = new Database_PDO; |
|
11 | + $User = new User ($Database); |
|
12 | + $Tools = new Tools ($Database); |
|
13 | + $Subnets = new Subnets ($Database); |
|
14 | + $Result = new Result (); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | # user must be authenticated |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | |
24 | 24 | # if direct request include plot JS |
25 | 25 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
26 | - # get widget details |
|
27 | - if(!$widget = $Tools->fetch_object ("widgets", "wfile", $_REQUEST['section'])) { $Result->show("danger", _("Invalid widget"), true); } |
|
28 | - # reset size and limit |
|
29 | - $height = 350; |
|
30 | - $slimit = 20; |
|
31 | - # include flot JS |
|
32 | - print '<script language="javascript" type="text/javascript" src="js/1.2/flot/jquery.flot.js"></script>'; |
|
33 | - print '<script language="javascript" type="text/javascript" src="js/1.2/flot/jquery.flot.categories.js"></script>'; |
|
34 | - print '<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/1.2/flot/excanvas.min.js"></script><![endif]-->'; |
|
35 | - # and print title |
|
36 | - print "<div class='container'>"; |
|
37 | - print "<h4 style='margin-top:40px;'>$widget->wtitle</h4><hr>"; |
|
38 | - print "</div>"; |
|
26 | + # get widget details |
|
27 | + if(!$widget = $Tools->fetch_object ("widgets", "wfile", $_REQUEST['section'])) { $Result->show("danger", _("Invalid widget"), true); } |
|
28 | + # reset size and limit |
|
29 | + $height = 350; |
|
30 | + $slimit = 20; |
|
31 | + # include flot JS |
|
32 | + print '<script language="javascript" type="text/javascript" src="js/1.2/flot/jquery.flot.js"></script>'; |
|
33 | + print '<script language="javascript" type="text/javascript" src="js/1.2/flot/jquery.flot.categories.js"></script>'; |
|
34 | + print '<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/1.2/flot/excanvas.min.js"></script><![endif]-->'; |
|
35 | + # and print title |
|
36 | + print "<div class='container'>"; |
|
37 | + print "<h4 style='margin-top:40px;'>$widget->wtitle</h4><hr>"; |
|
38 | + print "</div>"; |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $type = "IPv4"; |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | $numbering = array(); |
49 | 49 | $m = 0; |
50 | 50 | foreach($top_subnets as $subnet) { |
51 | - # cast |
|
52 | - $subnet = (array) $subnet; |
|
53 | - # check if already in array |
|
54 | - if(in_array($subnet['description'], $unique)) { |
|
55 | - $numbering[$subnet['description']]++; |
|
56 | - $top_subnets[$m]->description = $subnet['description'].' #'.$numbering[$subnet['description']]; |
|
57 | - } |
|
58 | - $unique[] = $top_subnets[$m]->description; |
|
59 | - $m++; |
|
51 | + # cast |
|
52 | + $subnet = (array) $subnet; |
|
53 | + # check if already in array |
|
54 | + if(in_array($subnet['description'], $unique)) { |
|
55 | + $numbering[$subnet['description']]++; |
|
56 | + $top_subnets[$m]->description = $subnet['description'].' #'.$numbering[$subnet['description']]; |
|
57 | + } |
|
58 | + $unique[] = $top_subnets[$m]->description; |
|
59 | + $m++; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | # set maximum for graph |
@@ -70,34 +70,34 @@ discard block |
||
70 | 70 | |
71 | 71 | var data = [ |
72 | 72 | <?php |
73 | - $m=0; |
|
74 | - foreach ($top_subnets as $subnet) { |
|
75 | - # cast |
|
76 | - $subnet = (array) $subnet; |
|
77 | - if($m < $slimit) { |
|
78 | - # verify user access |
|
79 | - $sp = $Subnets->check_permission($User->user, $subnet['id']); |
|
80 | - if($sp != 0) { |
|
81 | - $subnet['subnet'] = $Subnets->transform_to_dotted($subnet['subnet']); |
|
82 | - $subnet['descriptionLong'] = $subnet['description']; |
|
73 | + $m=0; |
|
74 | + foreach ($top_subnets as $subnet) { |
|
75 | + # cast |
|
76 | + $subnet = (array) $subnet; |
|
77 | + if($m < $slimit) { |
|
78 | + # verify user access |
|
79 | + $sp = $Subnets->check_permission($User->user, $subnet['id']); |
|
80 | + if($sp != 0) { |
|
81 | + $subnet['subnet'] = $Subnets->transform_to_dotted($subnet['subnet']); |
|
82 | + $subnet['descriptionLong'] = $subnet['description']; |
|
83 | 83 | |
84 | - # set percentage because of localisation |
|
85 | - $subnet['percentage'] = str_replace(",", ".", $subnet['percentage']); |
|
86 | - $subnet['percentage'] = $subnet['percentage']; |
|
84 | + # set percentage because of localisation |
|
85 | + $subnet['percentage'] = str_replace(",", ".", $subnet['percentage']); |
|
86 | + $subnet['percentage'] = $subnet['percentage']; |
|
87 | 87 | |
88 | - # odd/even if more than 5 items |
|
89 | - if(sizeof($top_subnets) > 5) { |
|
90 | - if ($m&1) { print "['|<br>" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
91 | - else { print "['" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
92 | - } |
|
93 | - else { |
|
94 | - { print "['" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
95 | - } |
|
96 | - $m++; |
|
97 | - } |
|
98 | - } |
|
99 | - } |
|
100 | - ?> |
|
88 | + # odd/even if more than 5 items |
|
89 | + if(sizeof($top_subnets) > 5) { |
|
90 | + if ($m&1) { print "['|<br>" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
91 | + else { print "['" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
92 | + } |
|
93 | + else { |
|
94 | + { print "['" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
95 | + } |
|
96 | + $m++; |
|
97 | + } |
|
98 | + } |
|
99 | + } |
|
100 | + ?> |
|
101 | 101 | ]; |
102 | 102 | |
103 | 103 | //show tooltips |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | }; |
218 | 218 | |
219 | 219 | <?php |
220 | - if($m!=0) { |
|
221 | - ?> |
|
220 | + if($m!=0) { |
|
221 | + ?> |
|
222 | 222 | $.plot($("#<?php print $type; ?>top10"), [ data ], options); |
223 | 223 | <?php } else { ?> |
224 | 224 | $("#IPv4top10").hide(); |
@@ -228,26 +228,26 @@ discard block |
||
228 | 228 | |
229 | 229 | <?php |
230 | 230 | if($m==0) { |
231 | - print "<hr>"; |
|
231 | + print "<hr>"; |
|
232 | 232 | |
233 | - print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
234 | - print "<p>"._("No $type hosts configured")."</p>"; |
|
235 | - print "<small>"._("Add some hosts to subnets to show graph of used hosts per subnet")."</small>"; |
|
236 | - print "</blockquote>"; |
|
233 | + print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
234 | + print "<p>"._("No $type hosts configured")."</p>"; |
|
235 | + print "<small>"._("Add some hosts to subnets to show graph of used hosts per subnet")."</small>"; |
|
236 | + print "</blockquote>"; |
|
237 | 237 | } |
238 | 238 | ?> |
239 | 239 | |
240 | 240 | <?php |
241 | 241 | } |
242 | 242 | else { |
243 | - print "<hr>"; |
|
244 | - print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
245 | - print "<p>"._("No $type hosts configured")."</p>"; |
|
246 | - print "<small>"._("Add some hosts to subnets to calculate usage percentage")."</small>"; |
|
247 | - print "</blockquote>"; |
|
243 | + print "<hr>"; |
|
244 | + print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
245 | + print "<p>"._("No $type hosts configured")."</p>"; |
|
246 | + print "<small>"._("Add some hosts to subnets to calculate usage percentage")."</small>"; |
|
247 | + print "</blockquote>"; |
|
248 | 248 | |
249 | - #remove loading |
|
250 | - ?> |
|
249 | + #remove loading |
|
250 | + ?> |
|
251 | 251 | <script type="text/javascript"> |
252 | 252 | $(document).ready(function() { |
253 | 253 | $("#IPv4top10").fadeOut('fast'); |
@@ -4,11 +4,11 @@ discard block |
||
4 | 4 | **********************************************/ |
5 | 5 | |
6 | 6 | # required functions |
7 | -if(!is_object(@$User)) { |
|
8 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
7 | +if (!is_object (@$User)) { |
|
8 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | # classes |
10 | 10 | $Database = new Database_PDO; |
11 | - $User = new User ($Database); |
|
11 | + $User = new User ($Database); |
|
12 | 12 | $Tools = new Tools ($Database); |
13 | 13 | $Subnets = new Subnets ($Database); |
14 | 14 | $Result = new Result (); |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | $slimit = 10; |
23 | 23 | |
24 | 24 | # if direct request include plot JS |
25 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
25 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
26 | 26 | # get widget details |
27 | - if(!$widget = $Tools->fetch_object ("widgets", "wfile", $_REQUEST['section'])) { $Result->show("danger", _("Invalid widget"), true); } |
|
27 | + if (!$widget = $Tools->fetch_object ("widgets", "wfile", $_REQUEST['section'])) { $Result->show ("danger", _ ("Invalid widget"), true); } |
|
28 | 28 | # reset size and limit |
29 | 29 | $height = 350; |
30 | 30 | $slimit = 20; |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | $type = "IPv4"; |
42 | 42 | |
43 | 43 | # get subnets statistic |
44 | -$top_subnets = $Tools->fetch_top_subnets($type, 1000000, true); |
|
44 | +$top_subnets = $Tools->fetch_top_subnets ($type, 1000000, true); |
|
45 | 45 | |
46 | 46 | /* detect duplicates */ |
47 | -$unique = array(); |
|
48 | -$numbering = array(); |
|
47 | +$unique = array (); |
|
48 | +$numbering = array (); |
|
49 | 49 | $m = 0; |
50 | -foreach($top_subnets as $subnet) { |
|
50 | +foreach ($top_subnets as $subnet) { |
|
51 | 51 | # cast |
52 | 52 | $subnet = (array) $subnet; |
53 | 53 | # check if already in array |
54 | - if(in_array($subnet['description'], $unique)) { |
|
54 | + if (in_array ($subnet['description'], $unique)) { |
|
55 | 55 | $numbering[$subnet['description']]++; |
56 | 56 | $top_subnets[$m]->description = $subnet['description'].' #'.$numbering[$subnet['description']]; |
57 | 57 | } |
@@ -60,38 +60,38 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | # set maximum for graph |
63 | -$max = str_replace(",", ".", $top_subnets[0]->percentage); |
|
63 | +$max = str_replace (",", ".", $top_subnets[0]->percentage); |
|
64 | 64 | |
65 | 65 | # only print if some hosts exist |
66 | -if(sizeof($top_subnets)>0) { |
|
66 | +if (sizeof ($top_subnets) > 0) { |
|
67 | 67 | ?> |
68 | 68 | <script type="text/javascript"> |
69 | 69 | $(function () { |
70 | 70 | |
71 | 71 | var data = [ |
72 | 72 | <?php |
73 | - $m=0; |
|
73 | + $m = 0; |
|
74 | 74 | foreach ($top_subnets as $subnet) { |
75 | 75 | # cast |
76 | 76 | $subnet = (array) $subnet; |
77 | - if($m < $slimit) { |
|
77 | + if ($m < $slimit) { |
|
78 | 78 | # verify user access |
79 | - $sp = $Subnets->check_permission($User->user, $subnet['id']); |
|
80 | - if($sp != 0) { |
|
81 | - $subnet['subnet'] = $Subnets->transform_to_dotted($subnet['subnet']); |
|
79 | + $sp = $Subnets->check_permission ($User->user, $subnet['id']); |
|
80 | + if ($sp != 0) { |
|
81 | + $subnet['subnet'] = $Subnets->transform_to_dotted ($subnet['subnet']); |
|
82 | 82 | $subnet['descriptionLong'] = $subnet['description']; |
83 | 83 | |
84 | 84 | # set percentage because of localisation |
85 | - $subnet['percentage'] = str_replace(",", ".", $subnet['percentage']); |
|
85 | + $subnet['percentage'] = str_replace (",", ".", $subnet['percentage']); |
|
86 | 86 | $subnet['percentage'] = $subnet['percentage']; |
87 | 87 | |
88 | 88 | # odd/even if more than 5 items |
89 | - if(sizeof($top_subnets) > 5) { |
|
90 | - if ($m&1) { print "['|<br>" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
91 | - else { print "['" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
89 | + if (sizeof ($top_subnets) > 5) { |
|
90 | + if ($m & 1) { print "['|<br>".addslashes ($subnet['description'])."', $subnet[percentage], '".addslashes ($subnet['descriptionLong'])." ($subnet[subnet]/$subnet[mask])'],"; } |
|
91 | + else { print "['".addslashes ($subnet['description'])."', $subnet[percentage], '".addslashes ($subnet['descriptionLong'])." ($subnet[subnet]/$subnet[mask])'],"; } |
|
92 | 92 | } |
93 | 93 | else { |
94 | - { print "['" . addslashes($subnet['description']) . "', $subnet[percentage], '" . addslashes($subnet['descriptionLong']) . " ($subnet[subnet]/$subnet[mask])'],"; } |
|
94 | + { print "['".addslashes ($subnet['description'])."', $subnet[percentage], '".addslashes ($subnet['descriptionLong'])." ($subnet[subnet]/$subnet[mask])'],"; } |
|
95 | 95 | } |
96 | 96 | $m++; |
97 | 97 | } |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | |
119 | 119 | //set JS array for clickable event |
120 | 120 | <?php |
121 | - $allLinks = json_encode($top_subnets); |
|
122 | - echo "var all_links = ". $allLinks. ";\n"; |
|
121 | + $allLinks = json_encode ($top_subnets); |
|
122 | + echo "var all_links = ".$allLinks.";\n"; |
|
123 | 123 | ?> |
124 | 124 | |
125 | 125 | //open link |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | }; |
218 | 218 | |
219 | 219 | <?php |
220 | - if($m!=0) { |
|
220 | + if ($m != 0) { |
|
221 | 221 | ?> |
222 | 222 | $.plot($("#<?php print $type; ?>top10"), [ data ], options); |
223 | 223 | <?php } else { ?> |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | </script> |
228 | 228 | |
229 | 229 | <?php |
230 | -if($m==0) { |
|
230 | +if ($m == 0) { |
|
231 | 231 | print "<hr>"; |
232 | 232 | |
233 | 233 | print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
234 | - print "<p>"._("No $type hosts configured")."</p>"; |
|
235 | - print "<small>"._("Add some hosts to subnets to show graph of used hosts per subnet")."</small>"; |
|
234 | + print "<p>"._ ("No $type hosts configured")."</p>"; |
|
235 | + print "<small>"._ ("Add some hosts to subnets to show graph of used hosts per subnet")."</small>"; |
|
236 | 236 | print "</blockquote>"; |
237 | 237 | } |
238 | 238 | ?> |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | else { |
243 | 243 | print "<hr>"; |
244 | 244 | print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
245 | - print "<p>"._("No $type hosts configured")."</p>"; |
|
246 | - print "<small>"._("Add some hosts to subnets to calculate usage percentage")."</small>"; |
|
245 | + print "<p>"._ ("No $type hosts configured")."</p>"; |
|
246 | + print "<small>"._ ("Add some hosts to subnets to calculate usage percentage")."</small>"; |
|
247 | 247 | print "</blockquote>"; |
248 | 248 | |
249 | 249 | #remove loading |
@@ -259,5 +259,5 @@ discard block |
||
259 | 259 | |
260 | 260 | |
261 | 261 | <div id="IPv4top10" class="top10" style="height:<?php print $height; ?>px;width:95%;margin-left:3%;"> |
262 | - <div style="text-align:center;padding-top:50px;"><strong><?php print _('Loading statistics'); ?></strong><br><i class='fa fa-spinner fa-spin'></i></div> |
|
262 | + <div style="text-align:center;padding-top:50px;"><strong><?php print _ ('Loading statistics'); ?></strong><br><i class='fa fa-spinner fa-spin'></i></div> |
|
263 | 263 | </div> |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | # required functions |
4 | 4 | if(!is_object(@$User)) { |
5 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
6 | - # classes |
|
7 | - $Database = new Database_PDO; |
|
8 | - $User = new User ($Database); |
|
9 | - $Tools = new Tools ($Database); |
|
10 | - $Subnets = new Subnets ($Database); |
|
5 | + require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
6 | + # classes |
|
7 | + $Database = new Database_PDO; |
|
8 | + $User = new User ($Database); |
|
9 | + $Tools = new Tools ($Database); |
|
10 | + $Subnets = new Subnets ($Database); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | # user must be authenticated |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | 17 | if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
18 | - header("Location: ".create_link("administration","requests")); |
|
18 | + header("Location: ".create_link("administration","requests")); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | # fetch all requests |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | if(!$requests) { |
29 | - print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
30 | - print "<small>"._("No IP address requests available")."!</small><br>"; |
|
31 | - print "</blockquote>"; |
|
29 | + print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
|
30 | + print "<small>"._("No IP address requests available")."!</small><br>"; |
|
31 | + print "</blockquote>"; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | else { |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | </tr> |
47 | 47 | |
48 | 48 | <?php |
49 | - # print requests |
|
50 | - foreach($requests as $request) { |
|
51 | - # cast |
|
52 | - $request = (array) $request; |
|
53 | - # get subnet details |
|
54 | - $subnet = $Subnets->fetch_subnet ("id", $request['subnetId']); |
|
49 | + # print requests |
|
50 | + foreach($requests as $request) { |
|
51 | + # cast |
|
52 | + $request = (array) $request; |
|
53 | + # get subnet details |
|
54 | + $subnet = $Subnets->fetch_subnet ("id", $request['subnetId']); |
|
55 | 55 | |
56 | - print '<tr>'. "\n"; |
|
57 | - print " <td><button class='btn btn-xs btn-default' data-requestid='$request[id]'><i class='fa fa-pencil'></i></button></td>"; |
|
58 | - print ' <td>'. $subnet->ip .'/'. $subnet->mask .' ('. $subnet->description .')</td>'. "\n"; |
|
59 | - print ' <td>'. $request['dns_name'] .'</td>'. "\n"; |
|
60 | - print ' <td>'. $request['description'] .'</td>'. "\n"; |
|
61 | - print ' <td>'. $request['requester'] .'</td>'. "\n"; |
|
62 | - print '</tr>'. "\n"; |
|
63 | - } |
|
56 | + print '<tr>'. "\n"; |
|
57 | + print " <td><button class='btn btn-xs btn-default' data-requestid='$request[id]'><i class='fa fa-pencil'></i></button></td>"; |
|
58 | + print ' <td>'. $subnet->ip .'/'. $subnet->mask .' ('. $subnet->description .')</td>'. "\n"; |
|
59 | + print ' <td>'. $request['dns_name'] .'</td>'. "\n"; |
|
60 | + print ' <td>'. $request['description'] .'</td>'. "\n"; |
|
61 | + print ' <td>'. $request['requester'] .'</td>'. "\n"; |
|
62 | + print '</tr>'. "\n"; |
|
63 | + } |
|
64 | 64 | ?> |
65 | 65 | |
66 | 66 | </table> |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $User->check_user_session (); |
16 | 16 | |
17 | 17 | # if direct request that redirect to tools page |
18 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | +if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
19 | 19 | header("Location: ".create_link("tools","logs")); |
20 | 20 | } |
21 | 21 |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | # required functions |
4 | -if(!is_object(@$User)) { |
|
5 | - require( dirname(__FILE__) . '/../../../functions/functions.php' ); |
|
4 | +if (!is_object (@$User)) { |
|
5 | + require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
6 | 6 | # classes |
7 | 7 | $Database = new Database_PDO; |
8 | - $User = new User ($Database); |
|
9 | - $Tools = new Tools ($Database); |
|
8 | + $User = new User ($Database); |
|
9 | + $Tools = new Tools ($Database); |
|
10 | 10 | $Subnets = new Subnets ($Database); |
11 | 11 | } |
12 | 12 | |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | $User->check_user_session (); |
15 | 15 | |
16 | 16 | # if direct request that redirect to tools page |
17 | -if($_SERVER['HTTP_X_REQUESTED_WITH']!="XMLHttpRequest") { |
|
18 | - header("Location: ".create_link("administration","requests")); |
|
17 | +if ($_SERVER['HTTP_X_REQUESTED_WITH'] != "XMLHttpRequest") { |
|
18 | + header ("Location: ".create_link ("administration", "requests")); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | # fetch all requests |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | |
27 | 27 | <?php |
28 | -if(!$requests) { |
|
28 | +if (!$requests) { |
|
29 | 29 | print "<blockquote style='margin-top:20px;margin-left:20px;'>"; |
30 | - print "<small>"._("No IP address requests available")."!</small><br>"; |
|
30 | + print "<small>"._ ("No IP address requests available")."!</small><br>"; |
|
31 | 31 | print "</blockquote>"; |
32 | 32 | } |
33 | 33 | |
@@ -39,27 +39,27 @@ discard block |
||
39 | 39 | <!-- headers --> |
40 | 40 | <tr> |
41 | 41 | <th></th> |
42 | - <th><?php print _('Subnet'); ?></th> |
|
43 | - <th><?php print _('Hostname'); ?></th> |
|
44 | - <th><?php print _('Description'); ?></th> |
|
45 | - <th><?php print _('Requested by'); ?></th> |
|
42 | + <th><?php print _ ('Subnet'); ?></th> |
|
43 | + <th><?php print _ ('Hostname'); ?></th> |
|
44 | + <th><?php print _ ('Description'); ?></th> |
|
45 | + <th><?php print _ ('Requested by'); ?></th> |
|
46 | 46 | </tr> |
47 | 47 | |
48 | 48 | <?php |
49 | 49 | # print requests |
50 | - foreach($requests as $request) { |
|
50 | + foreach ($requests as $request) { |
|
51 | 51 | # cast |
52 | 52 | $request = (array) $request; |
53 | 53 | # get subnet details |
54 | 54 | $subnet = $Subnets->fetch_subnet ("id", $request['subnetId']); |
55 | 55 | |
56 | - print '<tr>'. "\n"; |
|
56 | + print '<tr>'."\n"; |
|
57 | 57 | print " <td><button class='btn btn-xs btn-default' data-requestid='$request[id]'><i class='fa fa-pencil'></i></button></td>"; |
58 | - print ' <td>'. $subnet->ip .'/'. $subnet->mask .' ('. $subnet->description .')</td>'. "\n"; |
|
59 | - print ' <td>'. $request['dns_name'] .'</td>'. "\n"; |
|
60 | - print ' <td>'. $request['description'] .'</td>'. "\n"; |
|
61 | - print ' <td>'. $request['requester'] .'</td>'. "\n"; |
|
62 | - print '</tr>'. "\n"; |
|
58 | + print ' <td>'.$subnet->ip.'/'.$subnet->mask.' ('.$subnet->description.')</td>'."\n"; |
|
59 | + print ' <td>'.$request['dns_name'].'</td>'."\n"; |
|
60 | + print ' <td>'.$request['description'].'</td>'."\n"; |
|
61 | + print ' <td>'.$request['requester'].'</td>'."\n"; |
|
62 | + print '</tr>'."\n"; |
|
63 | 63 | } |
64 | 64 | ?> |
65 | 65 |