@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | # verify php build |
3 | -include('functions/checks/check_php_build.php'); # check for support for PHP modules and database connection |
|
3 | +include('functions/checks/check_php_build.php'); # check for support for PHP modules and database connection |
|
4 | 4 | |
5 | 5 | # fetch settings |
6 | -$settings = $Tools->fetch_object("settings", "id", 1); |
|
6 | +$settings = $Tools->fetch_object ("settings", "id", 1); |
|
7 | 7 | ?> |
8 | 8 | |
9 | 9 | <!DOCTYPE HTML> |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | <div class="wrapper"> |
55 | 55 | |
56 | 56 | <!-- loader --> |
57 | -<div class="loading"><?php print _('Loading');?>...<br><i class="fa fa-spinner fa-spin"></i></div> |
|
57 | +<div class="loading"><?php print _ ('Loading'); ?>...<br><i class="fa fa-spinner fa-spin"></i></div> |
|
58 | 58 | |
59 | 59 | <!-- header --> |
60 | 60 | <div class="row" id="header"> |
61 | 61 | <div class="col-xs-12"> |
62 | 62 | <div class="hero-unit" style="padding:20px;margin-bottom:10px;"> |
63 | - <a href="<?php print create_link($_GET['page'], $_GET['section']); ?>"><?php print $settings->siteTitle;?></a> |
|
63 | + <a href="<?php print create_link ($_GET['page'], $_GET['section']); ?>"><?php print $settings->siteTitle; ?></a> |
|
64 | 64 | </div> |
65 | 65 | </div> |
66 | 66 | </div> |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | <nav class="navbar navbar-default" id="menu-navbar" role="navigation"> |
73 | 73 | <div class="collapse navbar-collapse" id="menu-collapse"> |
74 | 74 | <ul class="nav navbar-nav sections pull-right"> |
75 | - <li><a href="<?php print create_link("login"); ?>"><i class='fa fa-user'></i> Login</a></li> |
|
75 | + <li><a href="<?php print create_link ("login"); ?>"><i class='fa fa-user'></i> Login</a></li> |
|
76 | 76 | </ul> |
77 | 77 | </div> |
78 | 78 | </nav> |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | <?php |
84 | 84 | # decode objects |
85 | -$temp_objects = json_decode($settings->tempAccess); |
|
85 | +$temp_objects = json_decode ($settings->tempAccess); |
|
86 | 86 | # check |
87 | -$temp_objects = sizeof($temp_objects)>0 ? (array) $temp_objects : array(); |
|
87 | +$temp_objects = sizeof ($temp_objects) > 0 ? (array) $temp_objects : array (); |
|
88 | 88 | # set width |
89 | -$max_width = (@$temp_objects[$_GET['section']]->type=="ipaddresses" || isset($_GET['subnetId'])) ? "max-width:700px" : ""; |
|
89 | +$max_width = (@$temp_objects[$_GET['section']]->type == "ipaddresses" || isset($_GET['subnetId'])) ? "max-width:700px" : ""; |
|
90 | 90 | ?> |
91 | 91 | |
92 | 92 | <!-- content --> |
@@ -95,32 +95,32 @@ discard block |
||
95 | 95 | |
96 | 96 | <?php |
97 | 97 | # disbled |
98 | - if($settings->tempShare!=1) { $Result->show("danger", _("Temporary sharing disabled"), false); } |
|
98 | + if ($settings->tempShare != 1) { $Result->show ("danger", _ ("Temporary sharing disabled"), false); } |
|
99 | 99 | # none |
100 | - elseif(sizeof($temp_objects)==0) { $Log->write( "Tempory share access", $_GET['section'], 2); $Result->show("danger", _("Invalid share key")."! <a href='".create_link("login")."' class='btn btn-sm btn-default'>Login</a>", false); } |
|
100 | + elseif (sizeof ($temp_objects) == 0) { $Log->write ("Tempory share access", $_GET['section'], 2); $Result->show ("danger", _ ("Invalid share key")."! <a href='".create_link ("login")."' class='btn btn-sm btn-default'>Login</a>", false); } |
|
101 | 101 | # try to fetch object |
102 | - elseif(!array_key_exists($_GET['section'], $temp_objects)) { $Log->write( "Tempory share access", $_GET['section'], 2); $Result->show("danger", _("Invalid share key")."! <a href='".create_link("login")."' class='btn btn-sm btn-default'>Login</a>", false); } |
|
102 | + elseif (!array_key_exists ($_GET['section'], $temp_objects)) { $Log->write ("Tempory share access", $_GET['section'], 2); $Result->show ("danger", _ ("Invalid share key")."! <a href='".create_link ("login")."' class='btn btn-sm btn-default'>Login</a>", false); } |
|
103 | 103 | # ok, include script |
104 | 104 | else { |
105 | 105 | //check if expired |
106 | - if(time()>$temp_objects[$_GET['section']]->validity) { $Log->write( "Tempory share access", $_GET['section'], 2); $Result->show("danger", _("Share expired")."!", false); } |
|
106 | + if (time () > $temp_objects[$_GET['section']]->validity) { $Log->write ("Tempory share access", $_GET['section'], 2); $Result->show ("danger", _ ("Share expired")."!", false); } |
|
107 | 107 | else { |
108 | 108 | //log |
109 | - $Log->write( "Tempory share access", $_GET['section'], 0); |
|
109 | + $Log->write ("Tempory share access", $_GET['section'], 0); |
|
110 | 110 | |
111 | - if($temp_objects[$_GET['section']]->type=="subnets") { |
|
111 | + if ($temp_objects[$_GET['section']]->type == "subnets") { |
|
112 | 112 | # address? |
113 | - if(isset($_GET['subnetId'])) { include("address.php"); } |
|
114 | - else { include("subnet.php"); } |
|
113 | + if (isset($_GET['subnetId'])) { include("address.php"); } |
|
114 | + else { include("subnet.php"); } |
|
115 | 115 | } |
116 | - else { |
|
116 | + else { |
|
117 | 117 | # set object |
118 | 118 | $object = $temp_objects[$_GET['section']]; |
119 | 119 | |
120 | 120 | // fetch address |
121 | - $address = (array) $Addresses->fetch_address(null, $object->id); |
|
121 | + $address = (array) $Addresses->fetch_address (null, $object->id); |
|
122 | 122 | // fetch subnet |
123 | - $subnet = (array) $Subnets->fetch_subnet(null, $address['subnetId']); |
|
123 | + $subnet = (array) $Subnets->fetch_subnet (null, $address['subnetId']); |
|
124 | 124 | |
125 | 125 | include("address.php"); |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | # write validity |
130 | 130 | print "<hr>"; |
131 | - $Result->show("info", "<strong>Notification</strong><hr>"._("Share expires on ").date("Y-m-d H:i:s", $temp_objects[$_GET['section']]->validity), false); |
|
131 | + $Result->show ("info", "<strong>Notification</strong><hr>"._ ("Share expires on ").date ("Y-m-d H:i:s", $temp_objects[$_GET['section']]->validity), false); |
|
132 | 132 | } |
133 | 133 | ?> |
134 | 134 |
@@ -5,12 +5,12 @@ discard block |
||
5 | 5 | ********************************************/ |
6 | 6 | |
7 | 7 | # get details |
8 | -$details = $Subnets->calculate_subnet_usage_detailed( $subnet['subnet'], $subnet['mask'], $addresses, $subnet['isFull']); |
|
8 | +$details = $Subnets->calculate_subnet_usage_detailed ($subnet['subnet'], $subnet['mask'], $addresses, $subnet['isFull']); |
|
9 | 9 | |
10 | 10 | ?> |
11 | 11 | |
12 | 12 | |
13 | -<h4><?php print _('Usage graph'); ?></h4> |
|
13 | +<h4><?php print _ ('Usage graph'); ?></h4> |
|
14 | 14 | <hr> |
15 | 15 | <div id="pieChart" style="height:220px;width:100%;"></div> |
16 | 16 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | var data = [ |
27 | 27 | <?php |
28 | 28 | # first free hosts |
29 | - if($details['freehosts_percent']>0) { |
|
30 | - $details['freehosts_percent'] = str_replace(",", ".", $details['freehosts_percent']); |
|
31 | - print "{ label: '"._('Free')."', data: $details[freehosts_percent], color: '#ffffff' }, "; # free hosts |
|
29 | + if ($details['freehosts_percent'] > 0) { |
|
30 | + $details['freehosts_percent'] = str_replace (",", ".", $details['freehosts_percent']); |
|
31 | + print "{ label: '"._ ('Free')."', data: $details[freehosts_percent], color: '#ffffff' }, "; # free hosts |
|
32 | 32 | } |
33 | 33 | # than all other percentages |
34 | - foreach($Subnets->address_types as $t) { |
|
35 | - if($details[$t['type']."_percent"]>0) { |
|
36 | - $details[$t['type']."_percent"] = str_replace(",", ".", $details[$t['type']."_percent"]); |
|
37 | - print "{ label: '"._($t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; |
|
34 | + foreach ($Subnets->address_types as $t) { |
|
35 | + if ($details[$t['type']."_percent"] > 0) { |
|
36 | + $details[$t['type']."_percent"] = str_replace (",", ".", $details[$t['type']."_percent"]); |
|
37 | + print "{ label: '"._ ($t['type'])."', data: ".$details[$t["type"]."_percent"].", color: '".$t['bgcolor']."' }, "; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | ?> |
@@ -3,47 +3,47 @@ discard block |
||
3 | 3 | # show squares to display free/used subnet |
4 | 4 | |
5 | 5 | # fetch section |
6 | -$section = (array) $Tools->fetch_object("sections", "id", $subnet['sectionId']); |
|
6 | +$section = (array) $Tools->fetch_object ("sections", "id", $subnet['sectionId']); |
|
7 | 7 | |
8 | -print "<br><h4>"._('Visual subnet display')." <i class='icon-gray icon-info-sign' rel='tooltip' data-html='true' title='"._('Click on IP address box<br>to manage IP address')."!'></i></h4><hr>"; |
|
8 | +print "<br><h4>"._ ('Visual subnet display')." <i class='icon-gray icon-info-sign' rel='tooltip' data-html='true' title='"._ ('Click on IP address box<br>to manage IP address')."!'></i></h4><hr>"; |
|
9 | 9 | print "<div class='ip_vis'>"; |
10 | 10 | |
11 | 11 | # set limits - general |
12 | -$start_visual = gmp_strval(gmp_and("0xffffffff", (int) $Subnets->transform_to_decimal($subnet_detailed['network']))); |
|
13 | -$stop_visual = gmp_strval(gmp_and("0xffffffff", (int) $Subnets->transform_to_decimal($subnet_detailed['broadcast']))); |
|
12 | +$start_visual = gmp_strval (gmp_and ("0xffffffff", (int) $Subnets->transform_to_decimal ($subnet_detailed['network']))); |
|
13 | +$stop_visual = gmp_strval (gmp_and ("0xffffffff", (int) $Subnets->transform_to_decimal ($subnet_detailed['broadcast']))); |
|
14 | 14 | |
15 | 15 | # remove subnet and bcast if mask < 31 |
16 | -if($subnet['mask'] > 30) {} |
|
17 | -elseif ($section['strictMode']==1) { |
|
18 | -$start_visual = gmp_strval(gmp_add($start_visual, 1)); |
|
19 | -$stop_visual = gmp_strval(gmp_sub($stop_visual, 1)); |
|
16 | +if ($subnet['mask'] > 30) {} |
|
17 | +elseif ($section['strictMode'] == 1) { |
|
18 | +$start_visual = gmp_strval (gmp_add ($start_visual, 1)); |
|
19 | +$stop_visual = gmp_strval (gmp_sub ($stop_visual, 1)); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | # we need to reindex addresses to have ip address in decimal as key! |
23 | -$visual_addresses = array(); |
|
24 | -if($addresses_visual) { |
|
25 | -foreach($addresses_visual as $a) { |
|
23 | +$visual_addresses = array (); |
|
24 | +if ($addresses_visual) { |
|
25 | +foreach ($addresses_visual as $a) { |
|
26 | 26 | $visual_addresses[$a->ip_addr] = (array) $a; |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | -for($m=$start_visual; $m<=$stop_visual; $m=gmp_strval(gmp_add($m,1))) { |
|
31 | +for ($m = $start_visual; $m <= $stop_visual; $m = gmp_strval (gmp_add ($m, 1))) { |
|
32 | 32 | |
33 | 33 | # already exists |
34 | - if (array_key_exists((string)$m, $visual_addresses)) { |
|
34 | + if (array_key_exists ((string) $m, $visual_addresses)) { |
|
35 | 35 | |
36 | 36 | # fix for empty states - if state is disabled, set to active |
37 | - if(strlen($visual_addresses[$m]['state'])==0) { $visual_addresses[$m]['state'] = 1; } |
|
37 | + if (strlen ($visual_addresses[$m]['state']) == 0) { $visual_addresses[$m]['state'] = 1; } |
|
38 | 38 | |
39 | 39 | # to edit |
40 | 40 | $class = $visual_addresses[$m]['state']; |
41 | 41 | $id = (int) $visual_addresses[$m]['id']; |
42 | 42 | |
43 | 43 | # tooltip |
44 | - $title = $Subnets->transform_to_dotted($m); |
|
45 | - if(strlen($visual_addresses[$m]['dns_name'])>0) { $title .= "<br>".$visual_addresses[$m]['dns_name']; } |
|
46 | - if(strlen($visual_addresses[$m]['description'])>0) { $title .= "<br>".$visual_addresses[$m]['description']; } |
|
44 | + $title = $Subnets->transform_to_dotted ($m); |
|
45 | + if (strlen ($visual_addresses[$m]['dns_name']) > 0) { $title .= "<br>".$visual_addresses[$m]['dns_name']; } |
|
46 | + if (strlen ($visual_addresses[$m]['description']) > 0) { $title .= "<br>".$visual_addresses[$m]['description']; } |
|
47 | 47 | |
48 | 48 | # set colors |
49 | 49 | $background = $Subnets->address_types[$visual_addresses[$m]['state']]['bgcolor']; |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | # print box |
64 | - print "<span class='ip-$class ' style='background:$background;color:$foreground'>.".substr(strrchr($Subnets->transform_to_dotted($m), "."), 1)."</span>"; |
|
64 | + print "<span class='ip-$class ' style='background:$background;color:$foreground'>.".substr (strrchr ($Subnets->transform_to_dotted ($m), "."), 1)."</span>"; |
|
65 | 65 | } |
66 | 66 | print "</div>"; |
67 | -print "<div class='clearfix' style='padding-bottom:20px;'></div>"; # clear float |
|
67 | +print "<div class='clearfix' style='padding-bottom:20px;'></div>"; # clear float |
|
68 | 68 | ?> |
69 | 69 | \ No newline at end of file |
@@ -5,62 +5,62 @@ 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 | # must be numeric |
11 | -if(!is_numeric($_GET['subnetId'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
12 | -if(!is_numeric($_GET['section'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
11 | +if (!is_numeric ($_GET['subnetId'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
12 | +if (!is_numeric ($_GET['section'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
13 | 13 | |
14 | 14 | # die if empty or not folder |
15 | -if(sizeof($folder) == 0) { $Result->show("danger", _("Folder does not exist"), true); } |
|
16 | -if($folder['isFolder']!=1) { $Result->show("danger", _("Invalid ID"), true); } |
|
15 | +if (sizeof ($folder) == 0) { $Result->show ("danger", _ ("Folder does not exist"), true); } |
|
16 | +if ($folder['isFolder'] != 1) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
17 | 17 | |
18 | 18 | # get vlan |
19 | -$vlan = $Tools->fetch_object("vlans", "vlanId", @$vlanId); |
|
19 | +$vlan = $Tools->fetch_object ("vlans", "vlanId", @$vlanId); |
|
20 | 20 | |
21 | 21 | # set rowspan |
22 | -$rowSpan = 10 + sizeof($cfields); |
|
22 | +$rowSpan = 10 + sizeof ($cfields); |
|
23 | 23 | |
24 | 24 | # verify that is it displayed in proper section, otherwise warn! |
25 | -if($folder['sectionId']!=$_GET['section']) { |
|
25 | +if ($folder['sectionId'] != $_GET['section']) { |
|
26 | 26 | $sd = $Sections->fetch_section ("id", $folder['sectionId']); |
27 | - { $Result->show("warning", "Folder is in section <a href='".create_link("folder",$sd->id,$folder['id'])."'>$sd->name</a>!", false); } |
|
27 | + { $Result->show ("warning", "Folder is in section <a href='".create_link ("folder", $sd->id, $folder['id'])."'>$sd->name</a>!", false); } |
|
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <!-- folder details upper table --> |
32 | -<h4><?php print _('Folder details'); ?></h4> |
|
32 | +<h4><?php print _ ('Folder details'); ?></h4> |
|
33 | 33 | <hr> |
34 | 34 | |
35 | 35 | <table class="ipaddress_subnet table-condensed table-auto"> |
36 | 36 | |
37 | 37 | <tr> |
38 | - <th><?php print _('Hierarchy'); ?></th> |
|
38 | + <th><?php print _ ('Hierarchy'); ?></th> |
|
39 | 39 | <td> |
40 | 40 | <?php $Subnets->print_breadcrumbs ($Sections, $Subnets, $_GET); ?> |
41 | 41 | </td> |
42 | 42 | </tr> |
43 | 43 | <tr> |
44 | - <th><?php print _('Folder name'); ?></th> |
|
44 | + <th><?php print _ ('Folder name'); ?></th> |
|
45 | 45 | <td><?php print $folder['description']; ?></td> |
46 | 46 | </tr> |
47 | 47 | <tr> |
48 | - <th><?php print _('Permission'); ?></th> |
|
49 | - <td><?php print $Subnets->parse_permissions($folder_permission); ?></td> |
|
48 | + <th><?php print _ ('Permission'); ?></th> |
|
49 | + <td><?php print $Subnets->parse_permissions ($folder_permission); ?></td> |
|
50 | 50 | </tr> |
51 | 51 | |
52 | 52 | <?php |
53 | 53 | # print custom subnet fields if any |
54 | - if(sizeof(sizeof($cfields)) > 0) { |
|
55 | - foreach($cfields as $key=>$field) { |
|
56 | - if(strlen($folder[$key]) > 0) { |
|
54 | + if (sizeof (sizeof ($cfields)) > 0) { |
|
55 | + foreach ($cfields as $key=>$field) { |
|
56 | + if (strlen ($folder[$key]) > 0) { |
|
57 | 57 | print "<tr>"; |
58 | 58 | print " <th>$key</th>"; |
59 | 59 | print " <td>"; |
60 | 60 | # booleans |
61 | - if($field['type']=="tinyint(1)") { |
|
62 | - if($folder[$field['name']] == 0) { print _("No"); } |
|
63 | - elseif($folder[$field['name']] == 1) { print _("Yes"); } |
|
61 | + if ($field['type'] == "tinyint(1)") { |
|
62 | + if ($folder[$field['name']] == 0) { print _ ("No"); } |
|
63 | + elseif ($folder[$field['name']] == 1) { print _ ("Yes"); } |
|
64 | 64 | } |
65 | 65 | else { |
66 | 66 | print $folder[$field['name']]; |
@@ -79,32 +79,32 @@ discard block |
||
79 | 79 | |
80 | 80 | # action button groups |
81 | 81 | print "<tr>"; |
82 | - print " <th>"._('Actions')."</th>"; |
|
82 | + print " <th>"._ ('Actions')."</th>"; |
|
83 | 83 | print " <td class='actions'>"; |
84 | 84 | |
85 | 85 | print " <div class='btn-toolbar'>"; |
86 | 86 | |
87 | 87 | /* set values for permissions */ |
88 | - if($folder_permission == 1) { |
|
89 | - $sp['editsubnet']= false; //edit subnet |
|
90 | - $sp['editperm'] = false; //edit permissions |
|
91 | - $sp['changelog'] = false; //changelog view |
|
92 | - $sp['addip'] = false; //add ip address |
|
93 | - $sp['import'] = false; //import |
|
88 | + if ($folder_permission == 1) { |
|
89 | + $sp['editsubnet'] = false; //edit subnet |
|
90 | + $sp['editperm'] = false; //edit permissions |
|
91 | + $sp['changelog'] = false; //changelog view |
|
92 | + $sp['addip'] = false; //add ip address |
|
93 | + $sp['import'] = false; //import |
|
94 | 94 | } |
95 | 95 | else if ($folder_permission == 2) { |
96 | - $sp['editsubnet']= false; //edit subnet |
|
97 | - $sp['editperm'] = false; //edit permissions |
|
98 | - $sp['changelog'] = true; //changelog view |
|
99 | - $sp['addip'] = true; //add ip address |
|
100 | - $sp['import'] = true; //import |
|
96 | + $sp['editsubnet'] = false; //edit subnet |
|
97 | + $sp['editperm'] = false; //edit permissions |
|
98 | + $sp['changelog'] = true; //changelog view |
|
99 | + $sp['addip'] = true; //add ip address |
|
100 | + $sp['import'] = true; //import |
|
101 | 101 | } |
102 | 102 | else if ($folder_permission == 3) { |
103 | - $sp['editsubnet']= true; //edit subnet |
|
104 | - $sp['editperm'] = true; //edit permissions |
|
105 | - $sp['changelog'] = true; //changelog view |
|
106 | - $sp['addip'] = true; //add ip address |
|
107 | - $sp['import'] = true; //import |
|
103 | + $sp['editsubnet'] = true; //edit subnet |
|
104 | + $sp['editperm'] = true; //edit permissions |
|
105 | + $sp['changelog'] = true; //changelog view |
|
106 | + $sp['addip'] = true; //add ip address |
|
107 | + $sp['import'] = true; //import |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -112,64 +112,64 @@ discard block |
||
112 | 112 | print "<div class='btn-group'>"; |
113 | 113 | |
114 | 114 | //warning |
115 | - if($folder_permission == 1) |
|
116 | - print "<button class='btn btn-xs btn-default btn-danger' data-container='body' rel='tooltip' title='"._('You do not have permissions to edit subnet or IP addresses')."'><i class='fa fa-lock'></i></button> "; |
|
115 | + if ($folder_permission == 1) |
|
116 | + print "<button class='btn btn-xs btn-default btn-danger' data-container='body' rel='tooltip' title='"._ ('You do not have permissions to edit subnet or IP addresses')."'><i class='fa fa-lock'></i></button> "; |
|
117 | 117 | |
118 | 118 | // edit subnet |
119 | - if($sp['editsubnet']) |
|
120 | - print "<a class='add_folder btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._('Edit folder')."' data-action='edit' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]'><i class='fa fa-pencil'></i></a>"; //edit subnet |
|
119 | + if ($sp['editsubnet']) |
|
120 | + print "<a class='add_folder btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._ ('Edit folder')."' data-action='edit' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]'><i class='fa fa-pencil'></i></a>"; //edit subnet |
|
121 | 121 | else |
122 | - print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._('Edit folder')."' > <i class='fa fa-pencil'></i></a>"; //edit subnet |
|
122 | + print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._ ('Edit folder')."' > <i class='fa fa-pencil'></i></a>"; //edit subnet |
|
123 | 123 | |
124 | 124 | //permissions |
125 | - if($sp['editperm']) |
|
126 | - print "<a class='showSubnetPerm btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._('Manage folder permissions')."' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]' data-action='show'> <i class='fa fa-tasks'></i></a>"; //edit subnet |
|
125 | + if ($sp['editperm']) |
|
126 | + print "<a class='showSubnetPerm btn btn-xs btn-default' href='' rel='tooltip' data-container='body' title='"._ ('Manage folder permissions')."' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]' data-action='show'> <i class='fa fa-tasks'></i></a>"; //edit subnet |
|
127 | 127 | else |
128 | - print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._('Manage folder permissions')."'> <i class='fa fa-tasks'></i></a>"; //edit subnet |
|
128 | + print "<a class='btn btn-xs btn-default disabled' href='' rel='tooltip' data-container='body' title='"._ ('Manage folder permissions')."'> <i class='fa fa-tasks'></i></a>"; //edit subnet |
|
129 | 129 | |
130 | 130 | // add nested subnet |
131 | - if($folder_permission_section == 3) { |
|
132 | - print "<a class='edit_subnet btn btn-xs btn-default ' href='' data-container='body' rel='tooltip' title='"._('Add new nested subnet')."' data-subnetId='$folder[id]' data-action='add' data-id='' data-sectionId='$folder[sectionId]'> <i class='fa fa-plus-circle'></i></a> "; |
|
133 | - print "<a class='add_folder btn btn-xs btn-default ' href='' rel='tooltip' data-container='body' title='"._('Add new nested folder')."' data-subnetId='$folder[id]' data-action='add' data-id='' data-sectionId='$folder[sectionId]'> <i class='fa fa-folder-close-o'></i></a> "; //add new child subnet |
|
131 | + if ($folder_permission_section == 3) { |
|
132 | + print "<a class='edit_subnet btn btn-xs btn-default ' href='' data-container='body' rel='tooltip' title='"._ ('Add new nested subnet')."' data-subnetId='$folder[id]' data-action='add' data-id='' data-sectionId='$folder[sectionId]'> <i class='fa fa-plus-circle'></i></a> "; |
|
133 | + print "<a class='add_folder btn btn-xs btn-default ' href='' rel='tooltip' data-container='body' title='"._ ('Add new nested folder')."' data-subnetId='$folder[id]' data-action='add' data-id='' data-sectionId='$folder[sectionId]'> <i class='fa fa-folder-close-o'></i></a> "; //add new child subnet |
|
134 | 134 | } else { |
135 | 135 | print "<a class='btn btn-xs btn-default disabled' href=''> <i class='fa fa-plus-circle'></i></a> "; |
136 | - print "<a class='btn btn-xs btn-default disabled' href=''> <i class='fa fa-folder-close-o'></i></a> "; //add new child subnet |
|
136 | + print "<a class='btn btn-xs btn-default disabled' href=''> <i class='fa fa-folder-close-o'></i></a> "; //add new child subnet |
|
137 | 137 | } |
138 | 138 | print "</div>"; |
139 | 139 | |
140 | 140 | # add new address |
141 | 141 | print "<div class='btn-group'>"; |
142 | - print "<a class='modIPaddr btn btn-xs btn-default btn-success' href='' data-container='body' rel='tooltip' title='"._('Add new IP address')."' data-subnetId='$folder[id]' data-action='add' data-id=''> <i class='fa fa-plus'></i></a> "; |
|
143 | - if($folder_permission>1 && $User->settings->enableSNMP=="1") { |
|
144 | - print "<button class='btn btn-xs btn-success' id='snmp-routing-section' rel='tooltip' data-container='body' title='"._('Search for subnets through SNMP')."' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]'><i class='fa fa-cogs'></i></button>"; |
|
145 | - print "<button class='btn btn-xs btn-default' id='truncate' rel='tooltip' data-container='body' title='"._('Truncate subnet')."' data-subnetId='$folder[id]'><i class='fa fa-gray fa-trash-o'></i></button>"; |
|
142 | + print "<a class='modIPaddr btn btn-xs btn-default btn-success' href='' data-container='body' rel='tooltip' title='"._ ('Add new IP address')."' data-subnetId='$folder[id]' data-action='add' data-id=''> <i class='fa fa-plus'></i></a> "; |
|
143 | + if ($folder_permission > 1 && $User->settings->enableSNMP == "1") { |
|
144 | + print "<button class='btn btn-xs btn-success' id='snmp-routing-section' rel='tooltip' data-container='body' title='"._ ('Search for subnets through SNMP')."' data-subnetId='$folder[id]' data-sectionId='$folder[sectionId]'><i class='fa fa-cogs'></i></button>"; |
|
145 | + print "<button class='btn btn-xs btn-default' id='truncate' rel='tooltip' data-container='body' title='"._ ('Truncate subnet')."' data-subnetId='$folder[id]'><i class='fa fa-gray fa-trash-o'></i></button>"; |
|
146 | 146 | } |
147 | 147 | print "</div>"; |
148 | 148 | |
149 | 149 | # export / import |
150 | 150 | print "<div class='btn-group'>"; |
151 | 151 | //import |
152 | - if($sp['import']) |
|
153 | - print "<a class='csvImport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._('Import IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-download'></i></a>"; |
|
152 | + if ($sp['import']) |
|
153 | + print "<a class='csvImport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._ ('Import IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-download'></i></a>"; |
|
154 | 154 | else |
155 | - print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._('Import IP addresses')."'> <i class='fa fa-download'></i></a>"; |
|
155 | + print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._ ('Import IP addresses')."'> <i class='fa fa-download'></i></a>"; |
|
156 | 156 | //export |
157 | - print "<a class='csvExport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._('Export IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-upload'></i></a>"; |
|
157 | + print "<a class='csvExport btn btn-xs btn-default' href='' data-container='body' rel='tooltip' title='"._ ('Export IP addresses')."' data-subnetId='$folder[id]'> <i class='fa fa-upload'></i></a>"; |
|
158 | 158 | print "</div>"; |
159 | 159 | |
160 | 160 | # favourites / changelog |
161 | 161 | print "<div class='btn-group'>"; |
162 | 162 | #favourite |
163 | - if($User->is_folder_favourite ($folder['id'])) |
|
164 | - print "<a class='btn btn-xs btn-default btn-info editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._('Click to remove from favourites')."' data-subnetId='$folder[id]' data-action='remove'><i class='fa fa-star'></i></a> "; |
|
163 | + if ($User->is_folder_favourite ($folder['id'])) |
|
164 | + print "<a class='btn btn-xs btn-default btn-info editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._ ('Click to remove from favourites')."' data-subnetId='$folder[id]' data-action='remove'><i class='fa fa-star'></i></a> "; |
|
165 | 165 | else |
166 | - print "<a class='btn btn-xs btn-default editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._('Click to add to favourites')."' data-subnetId='$folder[id]' data-action='add'> <i class='fa fa-star fa-star-o' ></i></a> "; |
|
166 | + print "<a class='btn btn-xs btn-default editFavourite favourite-$folder[id]' href='' data-container='body' rel='tooltip' title='"._ ('Click to add to favourites')."' data-subnetId='$folder[id]' data-action='add'> <i class='fa fa-star fa-star-o' ></i></a> "; |
|
167 | 167 | # changelog |
168 | - if($User->settings->enableChangelog==1) { |
|
169 | - if($sp['changelog']) |
|
170 | - print "<a class='sChangelog btn btn-xs btn-default' href='".create_link("subnets",$folder['sectionId'],$folder['id'],"changelog")."' data-container='body' rel='tooltip' title='"._('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
168 | + if ($User->settings->enableChangelog == 1) { |
|
169 | + if ($sp['changelog']) |
|
170 | + print "<a class='sChangelog btn btn-xs btn-default' href='".create_link ("subnets", $folder['sectionId'], $folder['id'], "changelog")."' data-container='body' rel='tooltip' title='"._ ('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
171 | 171 | else |
172 | - print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
172 | + print "<a class='btn btn-xs btn-default disabled' href='' data-container='body' rel='tooltip' title='"._ ('Changelog')."'><i class='fa fa-clock-o'></i></a>"; |
|
173 | 173 | } |
174 | 174 | print "</div>"; |
175 | 175 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | # verify that user is logged in |
4 | -$User->check_user_session(); |
|
4 | +$User->check_user_session (); |
|
5 | 5 | |
6 | 6 | # must be numeric |
7 | -if(!is_numeric($_GET['subnetId'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
8 | -if(!is_numeric($_GET['section'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
7 | +if (!is_numeric ($_GET['subnetId'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
8 | +if (!is_numeric ($_GET['section'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
9 | 9 | |
10 | 10 | # save folder ID |
11 | 11 | $folderId = $_GET['subnetId']; |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | $cfields = $Tools->fetch_custom_fields ('subnets'); |
15 | 15 | |
16 | 16 | # fetch subnet details! |
17 | -$folder = (array) $Subnets->fetch_subnet ("id", $folderId); |
|
18 | -if(sizeof($folder)==0) { header("Location: ".create_link("subnets", $_GET['section'])); die(); } //redirect if false |
|
17 | +$folder = (array) $Subnets->fetch_subnet ("id", $folderId); |
|
18 | +if (sizeof ($folder) == 0) { header ("Location: ".create_link ("subnets", $_GET['section'])); die(); } //redirect if false |
|
19 | 19 | |
20 | 20 | # permissions |
21 | -$folder_permission = $Subnets->check_permission($User->user, $folder['id']); //subnet permission |
|
22 | -$folder_permission_section = $Sections->check_permission($User->user, $folder['sectionId']); //section permission |
|
23 | -if($folder_permission == 0) { $Result->show("danger", _('You do not have permission to access this network'), true); } |
|
21 | +$folder_permission = $Subnets->check_permission ($User->user, $folder['id']); //subnet permission |
|
22 | +$folder_permission_section = $Sections->check_permission ($User->user, $folder['sectionId']); //section permission |
|
23 | +if ($folder_permission == 0) { $Result->show ("danger", _ ('You do not have permission to access this network'), true); } |
|
24 | 24 | |
25 | 25 | # get all slaves and addresses |
26 | 26 | $slaves = $Subnets->fetch_subnet_slaves ($folderId); |
@@ -32,30 +32,30 @@ discard block |
||
32 | 32 | print "</div>"; |
33 | 33 | |
34 | 34 | # Subnets in Folder |
35 | -if ($slaves!==false) { |
|
35 | +if ($slaves !== false) { |
|
36 | 36 | print '<div class="ipaddresses_overlay">'; |
37 | 37 | include_once('folder-subnets.php'); |
38 | 38 | print '</div>'; |
39 | 39 | } |
40 | 40 | |
41 | 41 | # search for IP addresses in Folder |
42 | -if (sizeof($addresses)>0) { |
|
42 | +if (sizeof ($addresses) > 0) { |
|
43 | 43 | // set subnet |
44 | 44 | $subnet = $folder; |
45 | 45 | $subnet_permission = $folder_permission; |
46 | 46 | $location = "folder"; |
47 | - $User->user->hideFreeRange=1; |
|
47 | + $User->user->hideFreeRange = 1; |
|
48 | 48 | $slaves = false; |
49 | 49 | |
50 | 50 | print '<div class="ipaddresses_overlay">'; |
51 | - include_once(dirname(__FILE__).'/../subnets/addresses/print-address-table.php'); |
|
51 | + include_once(dirname (__FILE__).'/../subnets/addresses/print-address-table.php'); |
|
52 | 52 | print '</div>'; |
53 | 53 | } |
54 | 54 | |
55 | 55 | # empty |
56 | -if (sizeof($addresses)==0 && !$slaves) { |
|
56 | +if (sizeof ($addresses) == 0 && !$slaves) { |
|
57 | 57 | print "<hr>"; |
58 | - $Result->show("info alert-absolute", _("Subnet is empty"), false); |
|
58 | + $Result->show ("info alert-absolute", _ ("Subnet is empty"), false); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | ?> |
62 | 62 | \ No newline at end of file |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | /* Script to display all slave subnets in content div of subnets table! */ |
8 | 8 | |
9 | 9 | # verify that user is logged in |
10 | -$User->check_user_session(); |
|
10 | +$User->check_user_session (); |
|
11 | 11 | |
12 | 12 | # must be numeric |
13 | -if(!is_numeric($_GET['subnetId'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
14 | -if(!is_numeric($_GET['section'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
13 | +if (!is_numeric ($_GET['subnetId'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
14 | +if (!is_numeric ($_GET['section'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
15 | 15 | |
16 | 16 | # set master folder ID to check for slaves |
17 | 17 | $folderId = $_GET['subnetId']; |
@@ -19,45 +19,45 @@ discard block |
||
19 | 19 | # get section details |
20 | 20 | $section = $Sections->fetch_section ("id", $folder['sectionId']); |
21 | 21 | |
22 | -if($slaves) { |
|
22 | +if ($slaves) { |
|
23 | 23 | # sort slaves by folder / subnet |
24 | - foreach($slaves as $s) { |
|
25 | - if($s->isFolder==1) { $folders[] = $s; } |
|
26 | - else { $subnets[] = $s; } |
|
24 | + foreach ($slaves as $s) { |
|
25 | + if ($s->isFolder == 1) { $folders[] = $s; } |
|
26 | + else { $subnets[] = $s; } |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | # first print belonging folders |
30 | - if(sizeof(@$folders)>0) { |
|
30 | + if (sizeof (@$folders) > 0) { |
|
31 | 31 | # print title |
32 | - print "<h4>"._("Folder")." $folder[description] "._('has')." ". sizeof($folders)." "._('directly nested folders').":</h4><hr>"; |
|
32 | + print "<h4>"._ ("Folder")." $folder[description] "._ ('has')." ".sizeof ($folders)." "._ ('directly nested folders').":</h4><hr>"; |
|
33 | 33 | |
34 | 34 | # table |
35 | - print '<table class="slaves table table-striped table-condensed table-hover table-full table-top" style="margin-bottom:50px;">'. "\n"; |
|
35 | + print '<table class="slaves table table-striped table-condensed table-hover table-full table-top" style="margin-bottom:50px;">'."\n"; |
|
36 | 36 | # headers |
37 | 37 | print "<tr>"; |
38 | 38 | print " <th class='small' style='width:55px;'></th>"; |
39 | - print " <th class='description'>"._('Folder')."</th>"; |
|
39 | + print " <th class='description'>"._ ('Folder')."</th>"; |
|
40 | 40 | print "</tr>"; |
41 | 41 | |
42 | 42 | # folders |
43 | - $m=0; |
|
44 | - foreach($folders as $f) { |
|
43 | + $m = 0; |
|
44 | + foreach ($folders as $f) { |
|
45 | 45 | $f = (array) $f; |
46 | 46 | # check permission |
47 | 47 | $permission = $Subnets->check_permission ($User->user, $f['id']); |
48 | - if($permission > 0) { |
|
48 | + if ($permission > 0) { |
|
49 | 49 | print "<tr>"; |
50 | 50 | print " <td class='small'><i class='fa fa-folder fa-sfolder'></i></td>"; |
51 | - print " <td class='description'><a href='".create_link("folder",$section->id,$f['id'])."'> $f[description]</a></td>"; |
|
51 | + print " <td class='description'><a href='".create_link ("folder", $section->id, $f['id'])."'> $f[description]</a></td>"; |
|
52 | 52 | print "</tr>"; |
53 | 53 | $m++; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | # no because of permissions |
57 | - if($m==0) { |
|
57 | + if ($m == 0) { |
|
58 | 58 | print "<tr>"; |
59 | 59 | print "<td colspan='2'>"; |
60 | - $Result->show("info", _("Folder has no subfolders")."!", false); |
|
60 | + $Result->show ("info", _ ("Folder has no subfolders")."!", false); |
|
61 | 61 | print "</td>"; |
62 | 62 | print "</tr>"; |
63 | 63 | } |
@@ -65,69 +65,69 @@ discard block |
||
65 | 65 | print "</table>"; |
66 | 66 | } |
67 | 67 | # print subnets |
68 | - if(sizeof(@$subnets)>0) { |
|
68 | + if (sizeof (@$subnets) > 0) { |
|
69 | 69 | # title |
70 | - print "<h4>"._("Folder")." $folder[description] "._('has')." ".sizeof($subnets)." "._('directly nested subnets').":</h4><hr><br>"; |
|
70 | + print "<h4>"._ ("Folder")." $folder[description] "._ ('has')." ".sizeof ($subnets)." "._ ('directly nested subnets').":</h4><hr><br>"; |
|
71 | 71 | |
72 | 72 | # print table |
73 | - print '<table class="slaves table table-striped table-condensed table-hover table-full table-top">'. "\n"; |
|
73 | + print '<table class="slaves table table-striped table-condensed table-hover table-full table-top">'."\n"; |
|
74 | 74 | |
75 | 75 | # headers |
76 | 76 | print "<tr>"; |
77 | - print " <th class='small'>"._('VLAN')."</th>"; |
|
78 | - print " <th class='small description'>"._('Subnet description')."</th>"; |
|
79 | - print " <th>"._('Subnet')."</th>"; |
|
80 | - print " <th class='small hidden-xs hidden-sm'>"._('Used')."</th>"; |
|
81 | - print " <th class='small hidden-xs hidden-sm'>% "._('Free')."</th>"; |
|
82 | - print " <th class='small hidden-xs hidden-sm'>"._('Requests')."</th>"; |
|
77 | + print " <th class='small'>"._ ('VLAN')."</th>"; |
|
78 | + print " <th class='small description'>"._ ('Subnet description')."</th>"; |
|
79 | + print " <th>"._ ('Subnet')."</th>"; |
|
80 | + print " <th class='small hidden-xs hidden-sm'>"._ ('Used')."</th>"; |
|
81 | + print " <th class='small hidden-xs hidden-sm'>% "._ ('Free')."</th>"; |
|
82 | + print " <th class='small hidden-xs hidden-sm'>"._ ('Requests')."</th>"; |
|
83 | 83 | print " <th class='actions'></th>"; |
84 | 84 | print "</tr>"; |
85 | 85 | |
86 | 86 | # print slave subnets |
87 | - $m=0; |
|
87 | + $m = 0; |
|
88 | 88 | foreach ($subnets as $slave) { |
89 | 89 | # cast |
90 | 90 | $slave = (array) $slave; |
91 | 91 | # check permission |
92 | 92 | $permission = $Subnets->check_permission ($User->user, $slave['id']); |
93 | 93 | # allowed |
94 | - if($permission > 0) { |
|
94 | + if ($permission > 0) { |
|
95 | 95 | # get VLAN details |
96 | - $vlan = $Tools->fetch_object("vlans", "vlanId",$slave['vlanId']); |
|
96 | + $vlan = $Tools->fetch_object ("vlans", "vlanId", $slave['vlanId']); |
|
97 | 97 | $vlan = (array) $vlan; |
98 | 98 | # reformat empty VLAN |
99 | - if(sizeof($vlan)==1) { $vlan['number'] = "/"; } |
|
99 | + if (sizeof ($vlan) == 1) { $vlan['number'] = "/"; } |
|
100 | 100 | |
101 | 101 | # calculate free / used / percentage |
102 | - if(!$Subnets->has_slaves ($slave['id'])) { |
|
102 | + if (!$Subnets->has_slaves ($slave['id'])) { |
|
103 | 103 | $ipCount = $Addresses->count_subnet_addresses ($slave['id']); |
104 | - $calculate = $Subnets->calculate_subnet_usage ( (int) $ipCount, $slave['mask'], $slave['subnet'], $slave['isFull'] ); |
|
104 | + $calculate = $Subnets->calculate_subnet_usage ((int) $ipCount, $slave['mask'], $slave['subnet'], $slave['isFull']); |
|
105 | 105 | } else { |
106 | - $calculate = $Subnets->calculate_subnet_usage_recursive( $slave['id'], $slave['subnet'], $slave['mask'], $Addresses, $slave['isFull']); |
|
106 | + $calculate = $Subnets->calculate_subnet_usage_recursive ($slave['id'], $slave['subnet'], $slave['mask'], $Addresses, $slave['isFull']); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | # add full information |
110 | - $fullinfo = $slave['isFull']==1 ? " <span class='badge badge1 badge2 badge4'>"._("Full")."</span>" : ""; |
|
111 | - if ($slave['isFull']!==1) { |
|
110 | + $fullinfo = $slave['isFull'] == 1 ? " <span class='badge badge1 badge2 badge4'>"._ ("Full")."</span>" : ""; |
|
111 | + if ($slave['isFull'] !== 1) { |
|
112 | 112 | # if usage is 100%, fake usFull to true! |
113 | - if ($calculate['freehosts']==0) { $fullinfo = "<span class='badge badge1 badge2 badge4'>"._("Full")."</span>"; } |
|
113 | + if ($calculate['freehosts'] == 0) { $fullinfo = "<span class='badge badge1 badge2 badge4'>"._ ("Full")."</span>"; } |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | print "<tr>"; |
117 | 117 | print " <td class='small'>".$vlan['number']."</td>"; |
118 | - print " <td class='small description'><a href='".create_link("subnets",$section->id,$slave['id'])."'>$slave[description]</a></td>"; |
|
119 | - print " <td><a href='".create_link("subnets",$section->id,$slave['id'])."'>$slave[ip]/$slave[mask] $fullinfo</a></td>"; |
|
118 | + print " <td class='small description'><a href='".create_link ("subnets", $section->id, $slave['id'])."'>$slave[description]</a></td>"; |
|
119 | + print " <td><a href='".create_link ("subnets", $section->id, $slave['id'])."'>$slave[ip]/$slave[mask] $fullinfo</a></td>"; |
|
120 | 120 | |
121 | 121 | # print usage |
122 | - print ' <td class="small hidden-xs hidden-sm">'. $calculate['used'] .'/'. $calculate['maxhosts'] .'</td>'. "\n"; |
|
123 | - print ' <td class="small hidden-xs hidden-sm">'. $calculate['freehosts_percent'] .'</td>'; |
|
122 | + print ' <td class="small hidden-xs hidden-sm">'.$calculate['used'].'/'.$calculate['maxhosts'].'</td>'."\n"; |
|
123 | + print ' <td class="small hidden-xs hidden-sm">'.$calculate['freehosts_percent'].'</td>'; |
|
124 | 124 | |
125 | 125 | # allow requests |
126 | - if($slave['allowRequests'] == 1) { print '<td class="allowRequests small hidden-xs hidden-sm"><i class="fa fa-gray fa-check"></i></td>'; } |
|
127 | - else { print '<td class="allowRequests small hidden-xs hidden-sm"></td>'; } |
|
126 | + if ($slave['allowRequests'] == 1) { print '<td class="allowRequests small hidden-xs hidden-sm"><i class="fa fa-gray fa-check"></i></td>'; } |
|
127 | + else { print '<td class="allowRequests small hidden-xs hidden-sm"></td>'; } |
|
128 | 128 | |
129 | 129 | # edit buttons |
130 | - if($permission == 3) { |
|
130 | + if ($permission == 3) { |
|
131 | 131 | print " <td class='actions'>"; |
132 | 132 | print " <div class='btn-group'>"; |
133 | 133 | print " <button class='btn btn-xs btn-default editSubnet' data-action='edit' data-subnetid='".$slave['id']."' data-sectionid='".$slave['sectionId']."'><i class='fa fa-gray fa fa-pencil'></i></button>"; |
@@ -145,26 +145,26 @@ discard block |
||
145 | 145 | print " </div>"; |
146 | 146 | print " </td>"; |
147 | 147 | } |
148 | - print '</tr>' . "\n"; |
|
148 | + print '</tr>'."\n"; |
|
149 | 149 | |
150 | - $m++; //for count |
|
150 | + $m++; //for count |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | # no because of permissions |
154 | - if($m==0) { |
|
154 | + if ($m == 0) { |
|
155 | 155 | print "<tr>"; |
156 | 156 | print "<td colspan='7' class='visible-md visible-lg'>"; |
157 | 157 | print "<td colspan='4' class='visible-xs visible-sm'>"; |
158 | - $Result->show("info", _("Folder has no belonging subnets")."!", false); |
|
158 | + $Result->show ("info", _ ("Folder has no belonging subnets")."!", false); |
|
159 | 159 | print "</td>"; |
160 | 160 | print "</tr>"; |
161 | 161 | } |
162 | 162 | |
163 | - print '</table>'. "\n"; |
|
163 | + print '</table>'."\n"; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | else { |
167 | 167 | print "<hr>"; |
168 | - $Result->show("info", _("Folder has no subfolders or belonging subnets")."!", false); |
|
168 | + $Result->show ("info", _ ("Folder has no subfolders or belonging subnets")."!", false); |
|
169 | 169 | } |
170 | 170 | ?> |
@@ -5,37 +5,37 @@ |
||
5 | 5 | ****************************************/ |
6 | 6 | |
7 | 7 | /* functions */ |
8 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
8 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
9 | 9 | |
10 | 10 | # initialize user object |
11 | -$Database = new Database_PDO; |
|
12 | -$User = new User ($Database); |
|
11 | +$Database = new Database_PDO; |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Tools = new Tools ($Database); |
14 | 14 | $Result = new Result (); |
15 | 15 | |
16 | 16 | # verify that user is logged in |
17 | -$User->check_user_session(); |
|
17 | +$User->check_user_session (); |
|
18 | 18 | |
19 | 19 | # admin user is required |
20 | -$User->is_admin(true); |
|
20 | +$User->is_admin (true); |
|
21 | 21 | |
22 | 22 | /* verifications */ |
23 | -if(!isset($_POST['tableid']) || strlen(@$_POST['tableid'])<1 ) { |
|
24 | - $Result->show("danger", _("Wrong parameters"), true); |
|
23 | +if (!isset($_POST['tableid']) || strlen (@$_POST['tableid']) < 1) { |
|
24 | + $Result->show ("danger", _ ("Wrong parameters"), true); |
|
25 | 25 | } |
26 | 26 | else { |
27 | 27 | //fix table |
28 | - if($_POST['type'] == "table") { |
|
29 | - $Tools->fix_table($_POST['tableid']); |
|
30 | - $Result->show("success", _('Table fixed')); |
|
28 | + if ($_POST['type'] == "table") { |
|
29 | + $Tools->fix_table ($_POST['tableid']); |
|
30 | + $Result->show ("success", _ ('Table fixed')); |
|
31 | 31 | } |
32 | 32 | //fix field |
33 | - elseif($_POST['type'] == "field") { |
|
34 | - $Tools->fix_field($_POST['tableid'], $_POST['fieldid']); |
|
35 | - $Result->show("success", _('Field fixed')); |
|
33 | + elseif ($_POST['type'] == "field") { |
|
34 | + $Tools->fix_field ($_POST['tableid'], $_POST['fieldid']); |
|
35 | + $Result->show ("success", _ ('Field fixed')); |
|
36 | 36 | } |
37 | 37 | else { |
38 | - $Result->show("danger", _("Wrong parameters"), true); |
|
38 | + $Result->show ("danger", _ ("Wrong parameters"), true); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | ?> |
42 | 42 | \ No newline at end of file |
@@ -5,60 +5,60 @@ discard block |
||
5 | 5 | ****************************************/ |
6 | 6 | |
7 | 7 | # admin user is required |
8 | -$User->is_admin(true); |
|
8 | +$User->is_admin (true); |
|
9 | 9 | |
10 | 10 | # title |
11 | -print "<h4>"._('Database structure verification').'</h4><hr>'; |
|
11 | +print "<h4>"._ ('Database structure verification').'</h4><hr>'; |
|
12 | 12 | |
13 | 13 | # check for possible errors |
14 | -if(sizeof($errors = $Tools->verify_database())>0) { |
|
14 | +if (sizeof ($errors = $Tools->verify_database ()) > 0) { |
|
15 | 15 | |
16 | 16 | //tables |
17 | 17 | if (isset($errors['tableError'])) { |
18 | - print '<div class="alert alert-danger alert-absolute" style="text-align:left;">'. "\n"; |
|
19 | - print '<b>'._('Missing table').'s:</b>'. "\n"; |
|
20 | - print '<ul class="fix-table">'. "\n"; |
|
18 | + print '<div class="alert alert-danger alert-absolute" style="text-align:left;">'."\n"; |
|
19 | + print '<b>'._ ('Missing table').'s:</b>'."\n"; |
|
20 | + print '<ul class="fix-table">'."\n"; |
|
21 | 21 | |
22 | 22 | foreach ($errors['tableError'] as $table) { |
23 | 23 | print '<li>'; |
24 | 24 | print $table." "; |
25 | 25 | //get fix |
26 | - if(!$fix = $Tools->get_table_fix($table)) { |
|
27 | - $Result->show("danger", _("Cannot get fix for table")." $table!", true); |
|
26 | + if (!$fix = $Tools->get_table_fix ($table)) { |
|
27 | + $Result->show ("danger", _ ("Cannot get fix for table")." $table!", true); |
|
28 | 28 | } else { |
29 | - print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='$table' data-fieldid='' data-type='table'><i class='fa fa-magic fa-pad-right'></i>"._("Fix table")."</a>"; |
|
29 | + print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='$table' data-fieldid='' data-type='table'><i class='fa fa-magic fa-pad-right'></i>"._ ("Fix table")."</a>"; |
|
30 | 30 | print "<div id='fix-result-$table' style='display:none'></div>"; |
31 | 31 | } |
32 | - print '</li>'. "\n"; |
|
32 | + print '</li>'."\n"; |
|
33 | 33 | } |
34 | 34 | |
35 | - print '</ul>'. "\n"; |
|
36 | - print '</div>'. "\n"; |
|
35 | + print '</ul>'."\n"; |
|
36 | + print '</div>'."\n"; |
|
37 | 37 | // clearfix |
38 | 38 | print "<div class='clearfix'></div>"; |
39 | 39 | } |
40 | 40 | |
41 | 41 | //fields |
42 | 42 | if (isset($errors['fieldError'])) { |
43 | - print '<div class="alert alert-danger alert-absolute" style="text-align:left;">'. "\n"; |
|
44 | - print '<b>'._('Missing fields').':</b>'. "\n"; |
|
45 | - print '<ul class="fix-field">'. "\n"; |
|
43 | + print '<div class="alert alert-danger alert-absolute" style="text-align:left;">'."\n"; |
|
44 | + print '<b>'._ ('Missing fields').':</b>'."\n"; |
|
45 | + print '<ul class="fix-field">'."\n"; |
|
46 | 46 | |
47 | 47 | foreach ($errors['fieldError'] as $table=>$field) { |
48 | 48 | print '<li>'; |
49 | - print 'Table `'. $table .'`: missing field `'. $field .'`;'; |
|
49 | + print 'Table `'.$table.'`: missing field `'.$field.'`;'; |
|
50 | 50 | //get fix |
51 | - if(!$fix = $Tools->get_field_fix($table, $field)) { |
|
52 | - $Result->show("danger", _("Cannot get fix for table field ")." `$table` `$field`!", true); |
|
51 | + if (!$fix = $Tools->get_field_fix ($table, $field)) { |
|
52 | + $Result->show ("danger", _ ("Cannot get fix for table field ")." `$table` `$field`!", true); |
|
53 | 53 | } else { |
54 | - print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='$table' data-fieldid='$field' data-type='field'><i class='fa fa-magic fa-pad-right'></i>"._("Fix field")."</a>"; |
|
54 | + print "<a class='btn btn-xs btn-default btn-tablefix' style='margin-left:8px;' href='' data-tableid='$table' data-fieldid='$field' data-type='field'><i class='fa fa-magic fa-pad-right'></i>"._ ("Fix field")."</a>"; |
|
55 | 55 | print "<div id='fix-result-$table$field' style='display:none'></div>"; |
56 | 56 | } |
57 | - print '</li>'. "\n"; |
|
57 | + print '</li>'."\n"; |
|
58 | 58 | } |
59 | 59 | |
60 | - print '</ul>'. "\n"; |
|
61 | - print '</div>'. "\n"; |
|
60 | + print '</ul>'."\n"; |
|
61 | + print '</div>'."\n"; |
|
62 | 62 | // clearfix |
63 | 63 | print "<div class='clearfix'></div>"; |
64 | 64 | } |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | |
67 | 67 | } |
68 | 68 | else { |
69 | - $Result->show("success", _('All tables and fields are installed properly'), false); |
|
69 | + $Result->show ("success", _ ('All tables and fields are installed properly'), false); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
73 | 73 | # we will also check for invalid subnets and addresses |
74 | -print "<h4>"._('Invalid subnets').'</h4><hr>'; |
|
74 | +print "<h4>"._ ('Invalid subnets').'</h4><hr>'; |
|
75 | 75 | |
76 | -$invalid_subnets = $Subnets->find_invalid_subnets(); |
|
77 | -if ($invalid_subnets===false) { |
|
78 | - $Result->show ("success", _("No invalid subnets detected"), false); |
|
76 | +$invalid_subnets = $Subnets->find_invalid_subnets (); |
|
77 | +if ($invalid_subnets === false) { |
|
78 | + $Result->show ("success", _ ("No invalid subnets detected"), false); |
|
79 | 79 | } |
80 | 80 | else { |
81 | 81 | print "Found following invalid subnets (with unexisting parent subnet):<hr>"; |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | foreach ($invalid_subnets as $subnet) { |
84 | 84 | // print each subnet |
85 | 85 | foreach ($subnet as $s) { |
86 | - print " - <a href='".create_link("subnets", $s->sectionId, $s->id)."'>$s->ip/$s->mask</a> ($s->description)"."<br>"; |
|
86 | + print " - <a href='".create_link ("subnets", $s->sectionId, $s->id)."'>$s->ip/$s->mask</a> ($s->description)"."<br>"; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | -print "<h4>"._('Invalid addresses').'</h4><hr>'; |
|
92 | +print "<h4>"._ ('Invalid addresses').'</h4><hr>'; |
|
93 | 93 | |
94 | -$invalid_subnets = $Addresses->find_invalid_addresses(); |
|
95 | -if ($invalid_subnets===false) { |
|
96 | - $Result->show ("success", _("No invalid addresses detected"), false); |
|
94 | +$invalid_subnets = $Addresses->find_invalid_addresses (); |
|
95 | +if ($invalid_subnets === false) { |
|
96 | + $Result->show ("success", _ ("No invalid addresses detected"), false); |
|
97 | 97 | } |
98 | 98 | else { |
99 | 99 | print "Found following invalid addresses (with unexisting subnet):<hr>"; |
@@ -4,23 +4,23 @@ discard block |
||
4 | 4 | *************************************************/ |
5 | 5 | |
6 | 6 | # verify that user is logged in |
7 | -$User->check_user_session(); |
|
7 | +$User->check_user_session (); |
|
8 | 8 | |
9 | 9 | print "<h4>phpIPAM version check</h4><hr>"; |
10 | 10 | |
11 | 11 | # get latest version */ |
12 | -if(!$version = $Tools->check_latest_phpipam_version()) { $Result->show("danger", _("Version check failed").'!', false); } |
|
12 | +if (!$version = $Tools->check_latest_phpipam_version ()) { $Result->show ("danger", _ ("Version check failed").'!', false); } |
|
13 | 13 | else { |
14 | 14 | //print result |
15 | - if($User->settings->version == $version) { $Result->show("success", _('Latest version').' ('. $User->settings->version .') '._('already installed').'!', false); } |
|
16 | - else if ($User->settings->version > $version) { $Result->show("success", _('Development version').' ('. $User->settings->version .') '._('installed! Latest production version is').' '. $version, false);} |
|
17 | - else { $Result->show("danger", _('New version of phpipam available').':</b><hr>'._('Installed version').': '.$User->settings->version."<br>"._('Available version').': '. $version."<br><br>"._('You can download new version').' <a href="https://sourceforge.net/projects/phpipam/files/current/phpipam-'. $version .'.tar/download">'._('here').'</a>.', false); } |
|
15 | + if ($User->settings->version == $version) { $Result->show ("success", _ ('Latest version').' ('.$User->settings->version.') '._ ('already installed').'!', false); } |
|
16 | + else if ($User->settings->version > $version) { $Result->show ("success", _ ('Development version').' ('.$User->settings->version.') '._ ('installed! Latest production version is').' '.$version, false); } |
|
17 | + else { $Result->show ("danger", _ ('New version of phpipam available').':</b><hr>'._ ('Installed version').': '.$User->settings->version."<br>"._ ('Available version').': '.$version."<br><br>"._ ('You can download new version').' <a href="https://sourceforge.net/projects/phpipam/files/current/phpipam-'.$version.'.tar/download">'._ ('here').'</a>.', false); } |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | # release and commit logs |
21 | 21 | print "<ul class='nav nav-tabs log-tabs'>"; |
22 | 22 | print "<li role='presentation' class='active'><a href='' data-target='changelog'>Change log</a></li>"; |
23 | -if(!is_null($Tools->phpipam_releases)) |
|
23 | +if (!is_null ($Tools->phpipam_releases)) |
|
24 | 24 | print "<li role='presentation'> <a href='' data-target='releaselog'>Release log</a></li>"; |
25 | 25 | if ($User->settings->version > $version) |
26 | 26 | print "<li role='presentation'> <a href='' data-target='gitlog'>Commit log (local)</a></li>"; |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | // title |
33 | 33 | print "<h4 style='margin-top:40px;'>Changelog</h4><hr>"; |
34 | 34 | print " <pre>"; |
35 | -$handle = fopen( dirname(__FILE__) . "/../../../misc/CHANGELOG", "r" ); |
|
36 | -print fread($handle, 102400); |
|
35 | +$handle = fopen (dirname (__FILE__)."/../../../misc/CHANGELOG", "r"); |
|
36 | +print fread ($handle, 102400); |
|
37 | 37 | print " </pre>"; |
38 | 38 | print "</div>"; |
39 | 39 | |
40 | 40 | |
41 | 41 | # release log |
42 | -if(!is_null($Tools->phpipam_releases)) { |
|
42 | +if (!is_null ($Tools->phpipam_releases)) { |
|
43 | 43 | print "<div class='log-print releaselog' style='display:none'>"; |
44 | 44 | print "<h4 style='margin-top:40px;'>Release log</h4><hr>"; |
45 | 45 | foreach ($Tools->phpipam_releases as $r) { |
46 | 46 | // pre-release ? |
47 | - $prerelease = !is_numeric(str_replace("Version", "", $r->title)) ? "<span class='label label-danger'>Prerelease</span>" : ""; |
|
47 | + $prerelease = !is_numeric (str_replace ("Version", "", $r->title)) ? "<span class='label label-danger'>Prerelease</span>" : ""; |
|
48 | 48 | |
49 | 49 | // title |
50 | 50 | print "<h5><i class='fa fa-angle-double-right'></i> $r->title $prerelease</h5>"; |
51 | 51 | // date |
52 | 52 | print "<div style='padding-left:20px;margin-bottom:20px;'>"; |
53 | - print "<span class='text-muted'>Released on ".date("Y-M-d", strtotime($r->updated))."</span> "; |
|
53 | + print "<span class='text-muted'>Released on ".date ("Y-M-d", strtotime ($r->updated))."</span> "; |
|
54 | 54 | print "<div style='padding-top:10px;'>$r->content</div>"; |
55 | 55 | // tag |
56 | 56 | print "<a class='btn btn-xs btn-default' href='http://github.com".$r->link->{'@attributes'}->href."'>Download (GitHub)</a>"; |
@@ -65,34 +65,34 @@ discard block |
||
65 | 65 | print "<div class='log-print gitlog' style='display:none'>"; |
66 | 66 | |
67 | 67 | # check |
68 | - $commit_log = shell_exec("git log"); |
|
68 | + $commit_log = shell_exec ("git log"); |
|
69 | 69 | |
70 | - if ($commit_log=="NULL") { |
|
71 | - $Result->show("info", "Git not available", false); |
|
70 | + if ($commit_log == "NULL") { |
|
71 | + $Result->show ("info", "Git not available", false); |
|
72 | 72 | } |
73 | 73 | else { |
74 | 74 | // title |
75 | 75 | print "<h4 style='margin-top:40px;'>Commit log (local)</h4><hr>"; |
76 | 76 | // split commits |
77 | - $commit_log = array_filter(explode("commit ", $commit_log)); |
|
77 | + $commit_log = array_filter (explode ("commit ", $commit_log)); |
|
78 | 78 | |
79 | 79 | // loop |
80 | 80 | foreach ($commit_log as $commit) { |
81 | 81 | // lines to array |
82 | - $lines = explode("\n", $commit); |
|
82 | + $lines = explode ("\n", $commit); |
|
83 | 83 | // commit |
84 | 84 | unset($out); |
85 | 85 | $out['commit'] = $lines[0]; |
86 | 86 | // remove unneeded |
87 | 87 | foreach ($lines as $k=>$l) { |
88 | - if (strpos($l, "Author")!==false) { $out['author'] = substr($l, 7); unset($lines[$k]); } |
|
89 | - elseif (strpos($l, "Date")!==false) { $out['date'] = substr($l, 7); unset($lines[$k]); } |
|
90 | - elseif (strpos($l, "Merge:")!==false) { $out['pr'] = $l; unset($lines[$k]); } |
|
91 | - elseif (strlen(trim($l))==0) { unset($lines[$k]); } |
|
88 | + if (strpos ($l, "Author") !== false) { $out['author'] = substr ($l, 7); unset($lines[$k]); } |
|
89 | + elseif (strpos ($l, "Date") !== false) { $out['date'] = substr ($l, 7); unset($lines[$k]); } |
|
90 | + elseif (strpos ($l, "Merge:") !== false) { $out['pr'] = $l; unset($lines[$k]); } |
|
91 | + elseif (strlen (trim ($l)) == 0) { unset($lines[$k]); } |
|
92 | 92 | unset($lines[0]); |
93 | 93 | } |
94 | 94 | // merge |
95 | - $lines = implode("<br>", array_filter($lines)); |
|
95 | + $lines = implode ("<br>", array_filter ($lines)); |
|
96 | 96 | |
97 | 97 | // title |
98 | 98 | print "<h5><i class='fa fa-angle-double-right'></i> $out[commit]</h5>"; |