@@ -6,21 +6,21 @@ discard block |
||
6 | 6 | ***************************************/ |
7 | 7 | |
8 | 8 | # initialize classes |
9 | -$Database = new Database_PDO; |
|
10 | -$Subnets = new Subnets ($Database); |
|
9 | +$Database = new Database_PDO; |
|
10 | +$Subnets = new Subnets ($Database); |
|
11 | 11 | $Result = new Result (); |
12 | -$Zones = new FirewallZones($Database); |
|
12 | +$Zones = new FirewallZones ($Database); |
|
13 | 13 | |
14 | 14 | # validate session parameters |
15 | -$User->check_user_session(); |
|
15 | +$User->check_user_session (); |
|
16 | 16 | |
17 | 17 | # fetch all zone mappings |
18 | -$firewallZoneMapping = $Zones->get_zone_mappings(); |
|
18 | +$firewallZoneMapping = $Zones->get_zone_mappings (); |
|
19 | 19 | |
20 | 20 | # reorder by device |
21 | -if ($firewallZoneMapping!==false) { |
|
21 | +if ($firewallZoneMapping !== false) { |
|
22 | 22 | # devices |
23 | - $devices = array(); |
|
23 | + $devices = array (); |
|
24 | 24 | # add |
25 | 25 | foreach ($firewallZoneMapping as $m) { |
26 | 26 | $devices[$m->deviceId][] = $m; |
@@ -28,23 +28,23 @@ discard block |
||
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | <!-- Add new firewall zone mapping --> |
31 | -<button class="btn btn-sm btn-default btn-success editMapping" style="margin-bottom:10px;margin-top: 25px;" data-action="add" data-id="0"><i style="padding-right:5px;" class="fa fa-plus"></i><?php print _('Create Firewall zone mapping') ?></button> |
|
31 | +<button class="btn btn-sm btn-default btn-success editMapping" style="margin-bottom:10px;margin-top: 25px;" data-action="add" data-id="0"><i style="padding-right:5px;" class="fa fa-plus"></i><?php print _ ('Create Firewall zone mapping') ?></button> |
|
32 | 32 | |
33 | 33 | <?php |
34 | -if($firewallZoneMapping) { |
|
34 | +if ($firewallZoneMapping) { |
|
35 | 35 | ?> |
36 | 36 | <!-- table --> |
37 | 37 | <table id="mappingsPrint" class="table table-td-top table-top table-condensed"> |
38 | 38 | |
39 | 39 | <!-- header --> |
40 | 40 | <tr> |
41 | - <th><?php print _('Type'); ?></th> |
|
42 | - <th><?php print _('Zone'); ?></th> |
|
43 | - <th><?php print _('Alias'); ?></th> |
|
44 | - <th><?php print _('Description'); ?></th> |
|
45 | - <th><?php print _('Interface'); ?></th> |
|
46 | - <th><?php print _('Subnets'); ?></th> |
|
47 | - <th><?php print _('VLAN'); ?></th> |
|
41 | + <th><?php print _ ('Type'); ?></th> |
|
42 | + <th><?php print _ ('Zone'); ?></th> |
|
43 | + <th><?php print _ ('Alias'); ?></th> |
|
44 | + <th><?php print _ ('Description'); ?></th> |
|
45 | + <th><?php print _ ('Interface'); ?></th> |
|
46 | + <th><?php print _ ('Subnets'); ?></th> |
|
47 | + <th><?php print _ ('VLAN'); ?></th> |
|
48 | 48 | <th style="width:60px"></th> |
49 | 49 | </tr> |
50 | 50 | |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | <!-- header --> |
56 | 56 | <tr> |
57 | 57 | <?php |
58 | - $devices[$k][0]->deviceDescription = strlen($devices[$k][0]->deviceDescription)<1 ? "" : "(".$devices[$k][0]->deviceDescription.")"; |
|
59 | - print '<th colspan="8" style="background:white"><h4>'.$devices[$k][0]->deviceName.$devices[$k][0]->deviceDescription .'</h4></th>'; |
|
58 | + $devices[$k][0]->deviceDescription = strlen ($devices[$k][0]->deviceDescription) < 1 ? "" : "(".$devices[$k][0]->deviceDescription.")"; |
|
59 | + print '<th colspan="8" style="background:white"><h4>'.$devices[$k][0]->deviceName.$devices[$k][0]->deviceDescription.'</h4></th>'; |
|
60 | 60 | ?> |
61 | 61 | </tr> |
62 | 62 | <?php |
63 | 63 | |
64 | 64 | # mappings |
65 | - foreach ($firewallZoneMapping as $mapping ) { |
|
65 | + foreach ($firewallZoneMapping as $mapping) { |
|
66 | 66 | # set rowspan in case if there are more than one networks bound to the zone |
67 | - $counter = count($mapping->network); |
|
67 | + $counter = count ($mapping->network); |
|
68 | 68 | if ($counter === 0) { |
69 | 69 | $counter = 1; |
70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | if ($i === 1) { |
77 | 77 | $title = $mapping->indicator == 0 ? 'Own Zone' : 'Customer Zone'; |
78 | 78 | |
79 | - print '<td rowspan="'.$counter.'"><span class="fa '.($mapping->indicator == 0 ? 'fa-home':'fa-group').'" title="'._($title).'"></span></td>'; |
|
79 | + print '<td rowspan="'.$counter.'"><span class="fa '.($mapping->indicator == 0 ? 'fa-home' : 'fa-group').'" title="'._ ($title).'"></span></td>'; |
|
80 | 80 | print '<td rowspan="'.$counter.'">'.$mapping->zone.'</td>'; |
81 | 81 | print '<td rowspan="'.$counter.'">'.$mapping->alias.'</td>'; |
82 | 82 | print '<td rowspan="'.$counter.'">'.$mapping->description.'</td>'; |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | # display subnet informations |
86 | 86 | if ($network->subnetId) { |
87 | 87 | // description fix |
88 | - $network->subnetDescription = strlen($network->subnetDescription)>0 ? " (".$network->subnetDescription.")" : ""; |
|
88 | + $network->subnetDescription = strlen ($network->subnetDescription) > 0 ? " (".$network->subnetDescription.")" : ""; |
|
89 | 89 | // subnet |
90 | 90 | if (!$network->subnetIsFolder) { |
91 | - print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">'.$Subnets->transform_to_dotted($network->subnet).'/'.$network->subnetMask.$network->subnetDescription.'</a></td>'; |
|
91 | + print '<td><a href="'.create_link ("subnets", $network->sectionId, $network->subnetId).'">'.$Subnets->transform_to_dotted ($network->subnet).'/'.$network->subnetMask.$network->subnetDescription.'</a></td>'; |
|
92 | 92 | } |
93 | 93 | else { |
94 | - print '<td><a href="'.create_link("subnets",$network->sectionId,$network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>'; |
|
94 | + print '<td><a href="'.create_link ("subnets", $network->sectionId, $network->subnetId).'">Folder'.$network->subnetDescription.'</a></td>'; |
|
95 | 95 | } |
96 | 96 | } else { |
97 | 97 | print '<td>/</td>'; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | # display vlan informations |
100 | 100 | if ($network->vlanId) { |
101 | 101 | // name fix |
102 | - $network->vlanName = strlen($network->vlanName)>0 ? " (".$network->vlanName.")" : ""; |
|
103 | - print '<td><a href="'.create_link('tools','vlan',$network->domainId,$network->vlanId).'">Vlan '.$network->vlan.''.$network->vlanName.'</a></td>'; |
|
102 | + $network->vlanName = strlen ($network->vlanName) > 0 ? " (".$network->vlanName.")" : ""; |
|
103 | + print '<td><a href="'.create_link ('tools', 'vlan', $network->domainId, $network->vlanId).'">Vlan '.$network->vlan.''.$network->vlanName.'</a></td>'; |
|
104 | 104 | } else { |
105 | 105 | print '<td>/</td>'; |
106 | 106 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | # display only the zone mapping data if there is no network data available |
123 | 123 | $title = $mapping->indicator == 0 ? 'Own Zone' : 'Customer Zone'; |
124 | 124 | |
125 | - print '<td rowspan="'.$counter.'"><span class="fa fa-home" title="'._($title).'"></span></td>'; |
|
125 | + print '<td rowspan="'.$counter.'"><span class="fa fa-home" title="'._ ($title).'"></span></td>'; |
|
126 | 126 | print '<td rowspan="'.$counter.'">'.$mapping->zone.'</td>'; |
127 | 127 | print '<td rowspan="'.$counter.'">'.$mapping->alias.'</td>'; |
128 | 128 | print '<td rowspan="'.$counter.'">'.$mapping->description.'</td>'; |
@@ -143,6 +143,6 @@ discard block |
||
143 | 143 | } |
144 | 144 | else { |
145 | 145 | # print an info if there are no zones in the database |
146 | - $Result->show("info", _("No firewall zones configured"), false); |
|
146 | + $Result->show ("info", _ ("No firewall zones configured"), false); |
|
147 | 147 | } |
148 | 148 | ?> |
149 | 149 | \ No newline at end of file |
@@ -6,31 +6,31 @@ discard block |
||
6 | 6 | ******************************************/ |
7 | 7 | |
8 | 8 | # functions |
9 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
9 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
10 | 10 | |
11 | 11 | # initialize classes |
12 | 12 | $Database = new Database_PDO; |
13 | -$User = new User ($Database); |
|
14 | -$Admin = new Admin($Database); |
|
13 | +$User = new User ($Database); |
|
14 | +$Admin = new Admin ($Database); |
|
15 | 15 | $Subnets = new Subnets ($Database); |
16 | 16 | $Sections = new Sections ($Database); |
17 | 17 | $Result = new Result (); |
18 | -$Zones = new FirewallZones($Database); |
|
18 | +$Zones = new FirewallZones ($Database); |
|
19 | 19 | |
20 | 20 | # validate session parameters |
21 | -$User->check_user_session(); |
|
21 | +$User->check_user_session (); |
|
22 | 22 | |
23 | 23 | # validate $_POST['action'] values |
24 | -if ($_POST['action'] != 'add' && $_POST['action'] != 'delete') { $Result->show("danger", _("Invalid action. Do not manipulate the POST values!").'<button class="btn btn-sm btn-default hidePopup2">'._('Cancel').'</button>', true); } |
|
24 | +if ($_POST['action'] != 'add' && $_POST['action'] != 'delete') { $Result->show ("danger", _ ("Invalid action. Do not manipulate the POST values!").'<button class="btn btn-sm btn-default hidePopup2">'._ ('Cancel').'</button>', true); } |
|
25 | 25 | # validate $_POST['id'] values |
26 | -if ($_POST['id'] && !preg_match('/^[0-9]+$/i', $_POST['id'])) { $Result->show("danger", _("Invalid ID. Do not manipulate the POST values!").'<button style="margin-left:50px;" class="btn btn-sm btn-default hidePopup2">'._('Cancel').'</button>', true); } |
|
26 | +if ($_POST['id'] && !preg_match ('/^[0-9]+$/i', $_POST['id'])) { $Result->show ("danger", _ ("Invalid ID. Do not manipulate the POST values!").'<button style="margin-left:50px;" class="btn btn-sm btn-default hidePopup2">'._ ('Cancel').'</button>', true); } |
|
27 | 27 | # validate $_POST['sectionId'] values |
28 | 28 | if ($_POST['id'] && $_POST['subnetId'] != '') { |
29 | - if (!preg_match('/^[0-9]+$/i', $_POST['subnetId'])) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!").'<button class="btn btn-sm btn-default hidePopup2">'._('Cancel').'</button>', true); } |
|
29 | + if (!preg_match ('/^[0-9]+$/i', $_POST['subnetId'])) { $Result->show ("danger", _ ("Invalid subnet ID. Do not manipulate the POST values!").'<button class="btn btn-sm btn-default hidePopup2">'._ ('Cancel').'</button>', true); } |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | # fetch all sections |
33 | -$sections = $Sections->fetch_all_sections(); |
|
33 | +$sections = $Sections->fetch_all_sections (); |
|
34 | 34 | |
35 | 35 | ?> |
36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | </script> |
48 | 48 | |
49 | 49 | <!-- header --> |
50 | -<div class="pHeader"><?php print _(ucwords($_POST['action']).' network mapping'); ?></div> |
|
50 | +<div class="pHeader"><?php print _ (ucwords ($_POST['action']).' network mapping'); ?></div> |
|
51 | 51 | <!-- content --> |
52 | 52 | <div class="pContent"> |
53 | 53 | <!-- form --> |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | <tr> |
61 | 61 | <td style="width:150px;"> |
62 | 62 | <?php |
63 | - $subnet = $Subnets->fetch_subnet('id',$_POST['subnetId']); |
|
63 | + $subnet = $Subnets->fetch_subnet ('id', $_POST['subnetId']); |
|
64 | 64 | # display network information with or without description |
65 | - if ($subnet->description) { $network = $Subnets->transform_to_dotted($subnet->subnet).'/'.$subnet->mask.' ('.$subnet->description.')'; } |
|
66 | - else { $network = $Subnets->transform_to_dotted($subnet->subnet).'/'.$subnet->mask; } |
|
67 | - $Result->show("warning", "<strong>"._('Warning').":</strong><br>"._("You are about to remove the following Network from the firewall zone:<br>".$network), false); ?> |
|
65 | + if ($subnet->description) { $network = $Subnets->transform_to_dotted ($subnet->subnet).'/'.$subnet->mask.' ('.$subnet->description.')'; } |
|
66 | + else { $network = $Subnets->transform_to_dotted ($subnet->subnet).'/'.$subnet->mask; } |
|
67 | + $Result->show ("warning", "<strong>"._ ('Warning').":</strong><br>"._ ("You are about to remove the following Network from the firewall zone:<br>".$network), false); ?> |
|
68 | 68 | <input type="hidden" name="masterSubnetId" value="<?php print $_POST['subnetId']; ?>"> |
69 | 69 | </td> |
70 | 70 | <?php } else { |
@@ -72,23 +72,23 @@ discard block |
||
72 | 72 | ?> |
73 | 73 | <tr> |
74 | 74 | <td colspan="2"> |
75 | - <?php print _('First select a section to choose a subnet afterwards.'); ?> |
|
75 | + <?php print _ ('First select a section to choose a subnet afterwards.'); ?> |
|
76 | 76 | </td> |
77 | 77 | </tr> |
78 | 78 | <tr> |
79 | 79 | <!-- section --> |
80 | 80 | <td style="width:150px;"> |
81 | - <?php print _('Section'); ?> |
|
81 | + <?php print _ ('Section'); ?> |
|
82 | 82 | </td> |
83 | 83 | <td> |
84 | 84 | <select name="sectionId" class="firewallZoneSection form-control input-sm input-w-auto input-max-200"> |
85 | 85 | <?php |
86 | - if(sizeof($sections)>1){ |
|
87 | - print '<option value="0">'._('No section selected').'</option>'; |
|
86 | + if (sizeof ($sections) > 1) { |
|
87 | + print '<option value="0">'._ ('No section selected').'</option>'; |
|
88 | 88 | } |
89 | 89 | foreach ($sections as $section) { |
90 | - if($section->description) { print '<option value="'.$section->id.'">'. $section->name.' ('.$section->description.')</option>'; } |
|
91 | - else { print '<option value="'.$section->id.'">'. $section->name.'</option>'; }} |
|
90 | + if ($section->description) { print '<option value="'.$section->id.'">'.$section->name.' ('.$section->description.')</option>'; } |
|
91 | + else { print '<option value="'.$section->id.'">'.$section->name.'</option>'; }} |
|
92 | 92 | ?> |
93 | 93 | </select> |
94 | 94 | </td> |
@@ -96,19 +96,19 @@ discard block |
||
96 | 96 | <tr> |
97 | 97 | <!-- subnet --> |
98 | 98 | <td> |
99 | - <?php print _('Subnet'); ?> |
|
99 | + <?php print _ ('Subnet'); ?> |
|
100 | 100 | </td> |
101 | 101 | <?php |
102 | 102 | # display the subnet if already configured |
103 | 103 | if ($firewallZone->sectionId) { |
104 | 104 | print '<td><div class="sectionSubnets">'; |
105 | - print $Subnets->print_mastersubnet_dropdown_menu($firewallZone->sectionId,$firewallZone->subnetId); |
|
105 | + print $Subnets->print_mastersubnet_dropdown_menu ($firewallZone->sectionId, $firewallZone->subnetId); |
|
106 | 106 | print '</div></td>'; |
107 | 107 | } else { |
108 | 108 | # if there is only one section, fetch the subnets of that section |
109 | - if(sizeof($sections)<=1){ |
|
109 | + if (sizeof ($sections) <= 1) { |
|
110 | 110 | print '<td>'; |
111 | - print $Subnets->print_mastersubnet_dropdown_menu($sections[0]->id,$firewallZone->subnetId); |
|
111 | + print $Subnets->print_mastersubnet_dropdown_menu ($sections[0]->id, $firewallZone->subnetId); |
|
112 | 112 | print '</td>'; |
113 | 113 | } else { |
114 | 114 | # if there are more than one section, use ajax to fetch the subnets of the selected section |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | </table> |
123 | 123 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
124 | 124 | <?php |
125 | -if ($_POST['id']) { print '<input type="hidden" name="netZoneId" value="'.$_POST['id'].'">'; } |
|
126 | -else { print '<input type="hidden" name="noZone" value="1">'; |
|
125 | +if ($_POST['id']) { print '<input type="hidden" name="netZoneId" value="'.$_POST['id'].'">'; } |
|
126 | +else { print '<input type="hidden" name="noZone" value="1">'; |
|
127 | 127 | if ($_POST['network']) { |
128 | 128 | foreach ($_POST['network'] as $key => $network) { |
129 | 129 | print '<input type="hidden" name="network['.$key.']" value="'.$network.'">'; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | <!-- footer --> |
139 | 139 | <div class="pFooter"> |
140 | 140 | <div class="btn-group"> |
141 | - <button class="btn btn-sm btn-default hidePopup2"><?php print _('Cancel'); ?></button> |
|
142 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editNetworkSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
141 | + <button class="btn btn-sm btn-default hidePopup2"><?php print _ ('Cancel'); ?></button> |
|
142 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editNetworkSubmit"><i class="fa <?php if ($_POST['action'] == "add") { print "fa-plus"; } else if ($_POST['action'] == "delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords (_ ($_POST['action'])); ?></button> |
|
143 | 143 | </div> |
144 | 144 | <!-- result --> |
145 | 145 | <div class="zones-edit-network-result"></div> |
@@ -5,55 +5,55 @@ |
||
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 classes |
11 | 11 | $Database = new Database_PDO; |
12 | -$User = new User ($Database); |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Result = new Result (); |
14 | -$Zones = new FirewallZones($Database); |
|
14 | +$Zones = new FirewallZones ($Database); |
|
15 | 15 | |
16 | 16 | # validate session parameters |
17 | -$User->check_user_session(); |
|
17 | +$User->check_user_session (); |
|
18 | 18 | |
19 | 19 | # validate the action type |
20 | -if($_POST['action'] != 'add' && $_POST['action'] != 'delete'){ |
|
21 | - $Result->show("danger", _("Invalid action."), true); |
|
20 | +if ($_POST['action'] != 'add' && $_POST['action'] != 'delete') { |
|
21 | + $Result->show ("danger", _ ("Invalid action."), true); |
|
22 | 22 | } |
23 | 23 | # check the mastersubnet ID. valid value: integer |
24 | -if($_POST['masterSubnetId'] && !preg_match('/^[0-9]+$/i',$_POST['masterSubnetId'])) { |
|
25 | - $Result->show("danger", _("Invalid subnet ID."), true); |
|
24 | +if ($_POST['masterSubnetId'] && !preg_match ('/^[0-9]+$/i', $_POST['masterSubnetId'])) { |
|
25 | + $Result->show ("danger", _ ("Invalid subnet ID."), true); |
|
26 | 26 | } elseif (!$_POST['masterSubnetId']) { |
27 | - $Result->show("danger", _("Please choose a appropriate network to bind to the firewall zone."), true); |
|
27 | + $Result->show ("danger", _ ("Please choose a appropriate network to bind to the firewall zone."), true); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | # validate network ID informations |
31 | -if($_POST['network']) { |
|
31 | +if ($_POST['network']) { |
|
32 | 32 | foreach ($_POST['network'] as $network) { |
33 | - if(!preg_match('/^[0-9]+$/i',$network)) { |
|
34 | - $Result->show("danger", _("Invalid network ID."), true); |
|
33 | + if (!preg_match ('/^[0-9]+$/i', $network)) { |
|
34 | + $Result->show ("danger", _ ("Invalid network ID."), true); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | # check if the network information should be delivered as form data |
40 | -if($_POST['noZone'] == 1) { |
|
40 | +if ($_POST['noZone'] == 1) { |
|
41 | 41 | # update |
42 | - if(!$Zones->check_zone_network($_POST['masterSubnetId'])) { $Result->show("danger", _("Cannot add the network to the zone."), true); } |
|
43 | - else { $Result->show("success", _("Network successfully added."), true); } |
|
42 | + if (!$Zones->check_zone_network ($_POST['masterSubnetId'])) { $Result->show ("danger", _ ("Cannot add the network to the zone."), true); } |
|
43 | + else { $Result->show ("success", _ ("Network successfully added."), true); } |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | # check the zone ID. valid value: integer |
47 | -if($_POST['netZoneId'] && !preg_match('/^[0-9]+$/i',$_POST['netZoneId'])) { |
|
48 | - $Result->show("danger", _("Invalid zone ID."), true); |
|
47 | +if ($_POST['netZoneId'] && !preg_match ('/^[0-9]+$/i', $_POST['netZoneId'])) { |
|
48 | + $Result->show ("danger", _ ("Invalid zone ID."), true); |
|
49 | 49 | } else { |
50 | 50 | # update |
51 | 51 | if ($_POST['action'] == 'add') { |
52 | - if(!$Zones->add_zone_network($_POST['netZoneId'],$_POST['masterSubnetId'])) { $Result->show("danger", _("Cannot add the network to the zone."), true); } |
|
53 | - else { $Result->show("success", _("Network successfully added."), true); } |
|
52 | + if (!$Zones->add_zone_network ($_POST['netZoneId'], $_POST['masterSubnetId'])) { $Result->show ("danger", _ ("Cannot add the network to the zone."), true); } |
|
53 | + else { $Result->show ("success", _ ("Network successfully added."), true); } |
|
54 | 54 | } elseif ($_POST['action'] == 'delete') { |
55 | - if(!$Zones->delete_zone_network($_POST['netZoneId'],$_POST['masterSubnetId'])) { $Result->show("danger", _("Cannot delete the network mapping."), true); } |
|
56 | - else { $Result->show("success", _("Successfully deleted the networt mapping."), true); } |
|
55 | + if (!$Zones->delete_zone_network ($_POST['netZoneId'], $_POST['masterSubnetId'])) { $Result->show ("danger", _ ("Cannot delete the network mapping."), true); } |
|
56 | + else { $Result->show ("success", _ ("Successfully deleted the networt mapping."), true); } |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | ?> |
60 | 60 | \ No newline at end of file |
@@ -5,28 +5,28 @@ discard block |
||
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 | 11 | $Database = new Database_PDO; |
12 | -$User = new User ($Database); |
|
12 | +$User = new User ($Database); |
|
13 | 13 | $Admin = new Admin ($Database); |
14 | 14 | $Subnets = new Subnets ($Database); |
15 | 15 | $Result = new Result (); |
16 | -$Zones = new FirewallZones($Database); |
|
17 | -$Tools = new Tools($Database); |
|
16 | +$Zones = new FirewallZones ($Database); |
|
17 | +$Tools = new Tools ($Database); |
|
18 | 18 | |
19 | 19 | # verify that user is logged in |
20 | -$User->check_user_session(); |
|
20 | +$User->check_user_session (); |
|
21 | 21 | |
22 | 22 | # generate a dropdown list for all subnets within a section |
23 | 23 | if ($_POST['operation'] == 'fetchSectionSubnets') { |
24 | - if($_POST['sectionId']) { |
|
25 | - if(preg_match('/^[0-9]+$/i',$_POST['sectionId'])) { |
|
24 | + if ($_POST['sectionId']) { |
|
25 | + if (preg_match ('/^[0-9]+$/i', $_POST['sectionId'])) { |
|
26 | 26 | $sectionId = $_POST['sectionId']; |
27 | - print $Subnets->print_mastersubnet_dropdown_menu($sectionId); |
|
27 | + print $Subnets->print_mastersubnet_dropdown_menu ($sectionId); |
|
28 | 28 | } else { |
29 | - $Result->show('danger', _('Invalid ID.'), true); |
|
29 | + $Result->show ('danger', _ ('Invalid ID.'), true); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | } |
@@ -34,49 +34,49 @@ discard block |
||
34 | 34 | # deliver zone details |
35 | 35 | if ($_POST['operation'] == 'deliverZoneDetail') { |
36 | 36 | if ($_POST['zoneId']) { |
37 | - if(preg_match('/^[0-9]+$/i',$_POST['zoneId'])) { |
|
37 | + if (preg_match ('/^[0-9]+$/i', $_POST['zoneId'])) { |
|
38 | 38 | # return the zone details |
39 | - $Zones->get_zone_detail($_POST['zoneId']); |
|
39 | + $Zones->get_zone_detail ($_POST['zoneId']); |
|
40 | 40 | |
41 | 41 | } else { |
42 | - $Result->show('danger', _('Invalid zone ID.'), true); |
|
42 | + $Result->show ('danger', _ ('Invalid zone ID.'), true); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | 47 | # deliver networkinformations about a specific zone |
48 | 48 | if ($_POST['netZoneId']) { |
49 | - if(preg_match('/^[0-9]+$/i',$_POST['netZoneId'])) { |
|
49 | + if (preg_match ('/^[0-9]+$/i', $_POST['netZoneId'])) { |
|
50 | 50 | # return the zone details |
51 | - $Zones->get_zone_network($_POST['netZoneId']); |
|
51 | + $Zones->get_zone_network ($_POST['netZoneId']); |
|
52 | 52 | } else { |
53 | - $Result->show('danger', _('Invalid netZone ID.'), true); |
|
53 | + $Result->show ('danger', _ ('Invalid netZone ID.'), true); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | 57 | # deliver networkinformations about a specific zone |
58 | 58 | if ($_POST['noZone'] == 1) { |
59 | - if($_POST['masterSubnetId']) { |
|
59 | + if ($_POST['masterSubnetId']) { |
|
60 | 60 | $_POST['network'][] = $_POST['masterSubnetId']; |
61 | 61 | } |
62 | 62 | if ($_POST['network']) { |
63 | - $rowspan = count($_POST['network']); |
|
63 | + $rowspan = count ($_POST['network']); |
|
64 | 64 | $i = 1; |
65 | 65 | print '<table class="table table-noborder table-condensed" style="padding-bottom:20px;">'; |
66 | 66 | foreach ($_POST['network'] as $key => $network) { |
67 | - $network = $Subnets->fetch_subnet(null,$network); |
|
67 | + $network = $Subnets->fetch_subnet (null, $network); |
|
68 | 68 | print '<tr>'; |
69 | 69 | if ($i === 1) { |
70 | 70 | print '<td rowspan="'.$rowspan.'" style="width:150px;">Network</td>'; |
71 | 71 | } |
72 | 72 | print '<td>'; |
73 | - print '<span alt="'._('Delete Network').'" title="'._('Delete Network').'" class="deleteTempNetwork" style="color:red;margin-bottom:10px;margin-top: 10px;margin-right:15px;" data-action="delete" data-subnetArrayKey="'.$key.'"><i class="fa fa-close"></i></span>'; |
|
73 | + print '<span alt="'._ ('Delete Network').'" title="'._ ('Delete Network').'" class="deleteTempNetwork" style="color:red;margin-bottom:10px;margin-top: 10px;margin-right:15px;" data-action="delete" data-subnetArrayKey="'.$key.'"><i class="fa fa-close"></i></span>'; |
|
74 | 74 | if ($network->isFolder == 1) { |
75 | 75 | print 'Folder: '.$network->description.'</td>'; |
76 | 76 | } else { |
77 | 77 | # display network information with or without description |
78 | - if ($network->description) { print $Subnets->transform_to_dotted($network->subnet).'/'.$network->mask.' ('.$network->description.')</td>'; } |
|
79 | - else { print $Subnets->transform_to_dotted($network->subnet).'/'.$network->mask.'</td>'; } |
|
78 | + if ($network->description) { print $Subnets->transform_to_dotted ($network->subnet).'/'.$network->mask.' ('.$network->description.')</td>'; } |
|
79 | + else { print $Subnets->transform_to_dotted ($network->subnet).'/'.$network->mask.'</td>'; } |
|
80 | 80 | } |
81 | 81 | print '<input type="hidden" name="network['.$key.']" value="'.$network->id.'">'; |
82 | 82 | print '</tr>'; |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | # generate a new firewall address object on request |
91 | 91 | if ($_POST['operation'] == 'autogen') { |
92 | 92 | if ($_POST['action'] == 'net') { |
93 | - if (preg_match('/^[0-9]+$/i',$_POST['subnetId'])){ |
|
94 | - $Zones->update_address_objects($_POST['subnetId']); |
|
93 | + if (preg_match ('/^[0-9]+$/i', $_POST['subnetId'])) { |
|
94 | + $Zones->update_address_objects ($_POST['subnetId']); |
|
95 | 95 | } |
96 | 96 | } elseif ($_POST['action'] == 'adr') { |
97 | - if (preg_match('/^[0-9]+$/i',$_POST['subnetId']) && preg_match('/^[0-9a-zA-Z-.]+$/i',$_POST['dnsName']) && preg_match('/^[0-9]+$/i',$_POST['IPId'])) { |
|
98 | - $Zones->update_address_object($_POST['subnetId'],$_POST['IPId'],$_POST['dnsName']); |
|
97 | + if (preg_match ('/^[0-9]+$/i', $_POST['subnetId']) && preg_match ('/^[0-9a-zA-Z-.]+$/i', $_POST['dnsName']) && preg_match ('/^[0-9]+$/i', $_POST['IPId'])) { |
|
98 | + $Zones->update_address_object ($_POST['subnetId'], $_POST['IPId'], $_POST['dnsName']); |
|
99 | 99 | } |
100 | 100 | } elseif ($_POST['action'] == 'subnet') { |
101 | - if (preg_match('/^[0-9]+$/i',$_POST['subnetId'])) { |
|
101 | + if (preg_match ('/^[0-9]+$/i', $_POST['subnetId'])) { |
|
102 | 102 | $Zones->generate_subnet_object ($_POST['subnetId']); |
103 | 103 | } |
104 | 104 | } |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | # check if there is any mapping for a specific zone, if not, display inputs |
108 | 108 | if ($_POST['operation'] == 'checkMapping') { |
109 | 109 | |
110 | - if (!$Zones->check_zone_mapping($_POST['zoneId']) && $_POST['zoneId'] != 0) { |
|
110 | + if (!$Zones->check_zone_mapping ($_POST['zoneId']) && $_POST['zoneId'] != 0) { |
|
111 | 111 | # fetch all firewall zones |
112 | - $firewallZones = $Zones->get_zones(); |
|
112 | + $firewallZones = $Zones->get_zones (); |
|
113 | 113 | |
114 | 114 | # fetch settings |
115 | - $firewallZoneSettings = json_decode($User->settings->firewallZoneSettings,true); |
|
115 | + $firewallZoneSettings = json_decode ($User->settings->firewallZoneSettings, true); |
|
116 | 116 | |
117 | 117 | # fetch all devices |
118 | 118 | $devices = $Tools->fetch_multiple_objects ("devices", "type", $firewallZoneSettings['deviceType']); |
@@ -121,26 +121,26 @@ discard block |
||
121 | 121 | <table class="table table-noborder table-condensed"> |
122 | 122 | <tr> |
123 | 123 | <td colspan="2"> |
124 | - <?php print _('In order to map this network to a zone without an existing device mapping you have to specify the following values.'); ?> |
|
124 | + <?php print _ ('In order to map this network to a zone without an existing device mapping you have to specify the following values.'); ?> |
|
125 | 125 | </td> |
126 | 126 | </tr> |
127 | 127 | <tr> |
128 | 128 | <!-- zone indicator --> |
129 | 129 | <td> |
130 | - <?php print _('Firewall to map'); ?> |
|
130 | + <?php print _ ('Firewall to map'); ?> |
|
131 | 131 | </td> |
132 | 132 | <td> |
133 | 133 | <select name="deviceId" class="form-control input-sm input-w-auto input-max-200" <?php print $readonly; ?>> |
134 | - <option value="0"><?php print _('Select firewall'); ?></option> |
|
134 | + <option value="0"><?php print _ ('Select firewall'); ?></option> |
|
135 | 135 | <?php |
136 | - if ($devices!==false) { |
|
136 | + if ($devices !== false) { |
|
137 | 137 | foreach ($devices as $device) { |
138 | - if ($device->id == $mapping->deviceId) { |
|
139 | - if($device->description) { print '<option value="'.$device->id.'" selected>'. $device->hostname.' ('.$device->description.')</option>'; } |
|
140 | - else { print '<option value="'.$device->id.'" selected>'. $device->hostname.'</option>'; }} |
|
138 | + if ($device->id == $mapping->deviceId) { |
|
139 | + if ($device->description) { print '<option value="'.$device->id.'" selected>'.$device->hostname.' ('.$device->description.')</option>'; } |
|
140 | + else { print '<option value="'.$device->id.'" selected>'.$device->hostname.'</option>'; }} |
|
141 | 141 | else { |
142 | - if($device->description) { print '<option value="'.$device->id.'">'. $device->hostname.' ('.$device->description.')</option>'; } |
|
143 | - else { print '<option value="'.$device->id.'">'. $device->hostname.'</option>'; }} |
|
142 | + if ($device->description) { print '<option value="'.$device->id.'">'.$device->hostname.' ('.$device->description.')</option>'; } |
|
143 | + else { print '<option value="'.$device->id.'">'.$device->hostname.'</option>'; }} |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | ?> |
@@ -149,26 +149,26 @@ discard block |
||
149 | 149 | </tr> |
150 | 150 | <tr> |
151 | 151 | <td> |
152 | - <?php print _('Interface'); ?> |
|
152 | + <?php print _ ('Interface'); ?> |
|
153 | 153 | </td> |
154 | 154 | <td> |
155 | - <input type="text" class="form-control input-sm" name="interface" placeholder="<?php print _('Firewall interface'); ?>" value="<?php print $mapping->interface; ?>" <?php print $readonly; ?>> |
|
155 | + <input type="text" class="form-control input-sm" name="interface" placeholder="<?php print _ ('Firewall interface'); ?>" value="<?php print $mapping->interface; ?>" <?php print $readonly; ?>> |
|
156 | 156 | </td> |
157 | 157 | </tr> |
158 | 158 | <tr> |
159 | 159 | <!-- description --> |
160 | 160 | <td> |
161 | - <?php print _('Zone alias'); ?> |
|
161 | + <?php print _ ('Zone alias'); ?> |
|
162 | 162 | </td> |
163 | 163 | <td> |
164 | - <input type="text" class="form-control input-sm" name="alias" placeholder="<?php print _('Local zone alias'); ?>" value="<?php print $mapping->alias; ?>" <?php print $readonly; ?>> |
|
164 | + <input type="text" class="form-control input-sm" name="alias" placeholder="<?php print _ ('Local zone alias'); ?>" value="<?php print $mapping->alias; ?>" <?php print $readonly; ?>> |
|
165 | 165 | </td> |
166 | 166 | </tr> |
167 | 167 | </table> |
168 | 168 | <?php |
169 | 169 | } elseif ($_POST['zoneId'] != 0) { |
170 | 170 | # return the zone details |
171 | - $Zones->get_zone_detail($_POST['zoneId']); |
|
171 | + $Zones->get_zone_detail ($_POST['zoneId']); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 |
@@ -6,31 +6,31 @@ discard block |
||
6 | 6 | *************************************************************/ |
7 | 7 | |
8 | 8 | # functions |
9 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
9 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
10 | 10 | |
11 | 11 | # initialize classes |
12 | 12 | $Database = new Database_PDO; |
13 | -$User = new User ($Database); |
|
13 | +$User = new User ($Database); |
|
14 | 14 | $Result = new Result (); |
15 | -$Zones = new FirewallZones($Database); |
|
15 | +$Zones = new FirewallZones ($Database); |
|
16 | 16 | |
17 | 17 | # validate session parameters |
18 | -$User->check_user_session(); |
|
18 | +$User->check_user_session (); |
|
19 | 19 | |
20 | 20 | # validate $_POST['operation'] values |
21 | -if ($_POST['operation'] != 'subnet2zone') { $Result->show("danger", _("Invalid operation. Do not manipulate the POST values!"), true); } |
|
21 | +if ($_POST['operation'] != 'subnet2zone') { $Result->show ("danger", _ ("Invalid operation. Do not manipulate the POST values!"), true); } |
|
22 | 22 | |
23 | 23 | # validate $_POST['subnetId'] values |
24 | -if (!preg_match('/^[0-9]+$/i', $_POST['subnetId'])) { $Result->show("danger", _("Invalid subnet ID. Do not manipulate the POST values!"), true); } |
|
24 | +if (!preg_match ('/^[0-9]+$/i', $_POST['subnetId'])) { $Result->show ("danger", _ ("Invalid subnet ID. Do not manipulate the POST values!"), true); } |
|
25 | 25 | |
26 | -$firewallZones = $Zones->get_zones(); |
|
26 | +$firewallZones = $Zones->get_zones (); |
|
27 | 27 | |
28 | 28 | # no zones |
29 | -if($firewallZones===false) { $Result->show("danger", _("No zones available"), true, true); } |
|
29 | +if ($firewallZones === false) { $Result->show ("danger", _ ("No zones available"), true, true); } |
|
30 | 30 | ?> |
31 | 31 | |
32 | 32 | <!-- header --> |
33 | -<div class="pHeader"><?php print _('Add this subnet to a firewall zone'); ?></div> |
|
33 | +<div class="pHeader"><?php print _ ('Add this subnet to a firewall zone'); ?></div> |
|
34 | 34 | <!-- content --> |
35 | 35 | <div class="pContent"> |
36 | 36 | <!-- form --> |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | <!-- zone --> |
42 | 42 | <tr> |
43 | 43 | <td style="width:150px;"> |
44 | - <?php print _('Zone name'); ?> |
|
44 | + <?php print _ ('Zone name'); ?> |
|
45 | 45 | </td> |
46 | 46 | <td> |
47 | 47 | <select name="zoneId" class="form-control input-sm input-w-auto input-max-200 checkMapping"> |
48 | - <option value="0"><?php print _('Select a Zone'); ?></option> |
|
48 | + <option value="0"><?php print _ ('Select a Zone'); ?></option> |
|
49 | 49 | <?php |
50 | 50 | foreach ($firewallZones as $firewallZone) { |
51 | - print '<option value="'.$firewallZone->id.'">'.$firewallZone->zone.' '.(($firewallZone->description) ? ' ('.$firewallZone->description.')' : '' ).'</option>'; |
|
51 | + print '<option value="'.$firewallZone->id.'">'.$firewallZone->zone.' '.(($firewallZone->description) ? ' ('.$firewallZone->description.')' : '').'</option>'; |
|
52 | 52 | } |
53 | 53 | ?> |
54 | 54 | </select> |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | <!-- footer --> |
63 | 63 | <div class="pFooter"> |
64 | 64 | <div class="btn-group"> |
65 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
66 | - <button class="btn btn-sm btn-default btn-success" id="subnet-to-zone-submit"><i class="fa fa-plus"></i> <?php print _('Add this subnet to a firewall zone'); ?></button> |
|
65 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
66 | + <button class="btn btn-sm btn-default btn-success" id="subnet-to-zone-submit"><i class="fa fa-plus"></i> <?php print _ ('Add this subnet to a firewall zone'); ?></button> |
|
67 | 67 | </div> |
68 | 68 | <!-- result --> |
69 | 69 | <div class="subnet-to-zone-result"></div> |
@@ -5,17 +5,17 @@ discard block |
||
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 | $Admin = new Admin ($Database); |
14 | -$Sections = new Sections ($Database); |
|
14 | +$Sections = new Sections ($Database); |
|
15 | 15 | $Result = new Result (); |
16 | 16 | |
17 | 17 | # verify that user is logged in |
18 | -$User->check_user_session(); |
|
18 | +$User->check_user_session (); |
|
19 | 19 | |
20 | 20 | # create csrf token |
21 | 21 | $csrf = $User->csrf_cookie ("create", "section"); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | # fetch all sections for master section |
24 | 24 | $sections = $Sections->fetch_all_sections (); |
25 | 25 | # fetch groups |
26 | -$groups = $Admin->fetch_all_objects("userGroups", "g_id"); |
|
26 | +$groups = $Admin->fetch_all_objects ("userGroups", "g_id"); |
|
27 | 27 | # fetch section |
28 | 28 | $section = (array) $Sections->fetch_section (null, @$_POST['sectionId']); |
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <!-- header --> |
32 | -<div class="pHeader"><?php print ucwords(_($_POST['action'])); ?> <?php print _('Section'); ?></div> |
|
32 | +<div class="pHeader"><?php print ucwords (_ ($_POST['action'])); ?> <?php print _ ('Section'); ?></div> |
|
33 | 33 | |
34 | 34 | |
35 | 35 | <!-- content --> |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | |
44 | 44 | <!-- section name --> |
45 | 45 | <tr> |
46 | - <td><?php print _('Name'); ?></td> |
|
46 | + <td><?php print _ ('Name'); ?></td> |
|
47 | 47 | <td colspan="2"> |
48 | - <input type="text" class='input-xlarge form-control input-sm input-w-250' name="name" value="<?php print @$section['name']; ?>" size="30" <?php if ($_POST['action'] == "delete" ) { print ' readonly '; } ?> placeholder="<?php print _('Section name'); ?>"> |
|
48 | + <input type="text" class='input-xlarge form-control input-sm input-w-250' name="name" value="<?php print @$section['name']; ?>" size="30" <?php if ($_POST['action'] == "delete") { print ' readonly '; } ?> placeholder="<?php print _ ('Section name'); ?>"> |
|
49 | 49 | <!-- hidden --> |
50 | 50 | <input type="hidden" name="action" value="<?php print $_POST['action']; ?>"> |
51 | 51 | <input type="hidden" name="id" value="<?php print $_POST['sectionId']; ?>"> |
@@ -54,91 +54,91 @@ discard block |
||
54 | 54 | </tr> |
55 | 55 | <!-- description --> |
56 | 56 | <tr> |
57 | - <td><?php print _('Description'); ?></td> |
|
57 | + <td><?php print _ ('Description'); ?></td> |
|
58 | 58 | <td colspan="2"> |
59 | - <input type="text" class='input-xlarge form-control input-sm input-w-250' name="description" value="<?php print @$section['description']; ?>" size="30" <?php if ($_POST['action'] == "delete") { print " readonly ";}?> placeholder="<?php print _('Section description'); ?>"> |
|
59 | + <input type="text" class='input-xlarge form-control input-sm input-w-250' name="description" value="<?php print @$section['description']; ?>" size="30" <?php if ($_POST['action'] == "delete") { print " readonly "; }?> placeholder="<?php print _ ('Section description'); ?>"> |
|
60 | 60 | </td> |
61 | 61 | </tr> |
62 | 62 | <!-- Master Subnet --> |
63 | 63 | <tr> |
64 | - <td><?php print _('Parent'); ?></td> |
|
64 | + <td><?php print _ ('Parent'); ?></td> |
|
65 | 65 | <td colspan="2"> |
66 | - <select name="masterSection" class="form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
66 | + <select name="masterSection" class="form-control input-sm input-w-auto pull-left" <?php if ($_POST['action'] == "delete") print 'disabled="disabled"'; ?>> |
|
67 | 67 | <option value="0">Root</option> |
68 | 68 | <?php |
69 | - if($sections!==false) { |
|
70 | - foreach($sections as $s) { |
|
69 | + if ($sections !== false) { |
|
70 | + foreach ($sections as $s) { |
|
71 | 71 | # show only roots and ignore self |
72 | - if($s->masterSection==0 && $s->id!=$_POST['sectionId']) { |
|
73 | - if($s->id==$section['masterSection']) { print "<option value='$s->id' selected='selected'>$s->name</option>"; } |
|
74 | - else { print "<option value='$s->id'>$s->name</option>"; } |
|
72 | + if ($s->masterSection == 0 && $s->id != $_POST['sectionId']) { |
|
73 | + if ($s->id == $section['masterSection']) { print "<option value='$s->id' selected='selected'>$s->name</option>"; } |
|
74 | + else { print "<option value='$s->id'>$s->name</option>"; } |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | 78 | ?> |
79 | 79 | </select> |
80 | - <span class="help-inline info2"><?php print _('Select parent section to create subsection'); ?></span> |
|
80 | + <span class="help-inline info2"><?php print _ ('Select parent section to create subsection'); ?></span> |
|
81 | 81 | </td> |
82 | 82 | </tr> |
83 | 83 | |
84 | 84 | <!-- Strict Mode --> |
85 | 85 | <tr> |
86 | - <td><?php print _('Strict Mode'); ?></td> |
|
86 | + <td><?php print _ ('Strict Mode'); ?></td> |
|
87 | 87 | <td colspan="2"> |
88 | - <select name="strictMode" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
89 | - <option value="1"><?php print _('Yes'); ?></option> |
|
90 | - <option value="0" <?php if(@$section['strictMode'] == "0") print "selected='selected'"; ?>><?php print _('No'); ?></option> |
|
88 | + <select name="strictMode" class="input-small form-control input-sm input-w-auto pull-left" <?php if ($_POST['action'] == "delete") print 'disabled="disabled"'; ?>> |
|
89 | + <option value="1"><?php print _ ('Yes'); ?></option> |
|
90 | + <option value="0" <?php if (@$section['strictMode'] == "0") print "selected='selected'"; ?>><?php print _ ('No'); ?></option> |
|
91 | 91 | </select> |
92 | - <span class="help-inline info2"><?php print _('No disables overlapping subnet checks. Subnets can be nested/created randomly. Anarchy.'); ?></span> |
|
92 | + <span class="help-inline info2"><?php print _ ('No disables overlapping subnet checks. Subnets can be nested/created randomly. Anarchy.'); ?></span> |
|
93 | 93 | </td> |
94 | 94 | </tr> |
95 | 95 | |
96 | 96 | <!-- Show VLANs --> |
97 | 97 | <tr> |
98 | - <td><?php print _('Show VLANs'); ?></td> |
|
98 | + <td><?php print _ ('Show VLANs'); ?></td> |
|
99 | 99 | <td colspan="2"> |
100 | - <select name="showVLAN" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
101 | - <option value="1"><?php print _('Yes'); ?></option> |
|
102 | - <option value="0" <?php if(@$section['showVLAN'] == "0") print "selected='selected'"; ?>><?php print _('No'); ?></option> |
|
100 | + <select name="showVLAN" class="input-small form-control input-sm input-w-auto pull-left" <?php if ($_POST['action'] == "delete") print 'disabled="disabled"'; ?>> |
|
101 | + <option value="1"><?php print _ ('Yes'); ?></option> |
|
102 | + <option value="0" <?php if (@$section['showVLAN'] == "0") print "selected='selected'"; ?>><?php print _ ('No'); ?></option> |
|
103 | 103 | </select> |
104 | - <span class="help-inline info2"><?php print _('Show list of VLANs and belonging subnets in subnet list'); ?></span> |
|
104 | + <span class="help-inline info2"><?php print _ ('Show list of VLANs and belonging subnets in subnet list'); ?></span> |
|
105 | 105 | </td> |
106 | 106 | </tr> |
107 | 107 | |
108 | 108 | <!-- Show VRFs --> |
109 | 109 | <tr> |
110 | - <td><?php print _('Show VRFs'); ?></td> |
|
110 | + <td><?php print _ ('Show VRFs'); ?></td> |
|
111 | 111 | <td colspan="2"> |
112 | - <select name="showVRF" class="input-small form-control input-sm input-w-auto pull-left" <?php if($_POST['action']=="delete") print 'disabled="disabled"'; ?>> |
|
113 | - <option value="1"><?php print _('Yes'); ?></option> |
|
114 | - <option value="0" <?php if(@$section['showVRF'] == "0") print "selected='selected'"; ?>><?php print _('No'); ?></option> |
|
112 | + <select name="showVRF" class="input-small form-control input-sm input-w-auto pull-left" <?php if ($_POST['action'] == "delete") print 'disabled="disabled"'; ?>> |
|
113 | + <option value="1"><?php print _ ('Yes'); ?></option> |
|
114 | + <option value="0" <?php if (@$section['showVRF'] == "0") print "selected='selected'"; ?>><?php print _ ('No'); ?></option> |
|
115 | 115 | </select> |
116 | - <span class="help-inline info2"><?php print _('Show list of VRFs and belonging subnets in subnet list'); ?></span> |
|
116 | + <span class="help-inline info2"><?php print _ ('Show list of VRFs and belonging subnets in subnet list'); ?></span> |
|
117 | 117 | </td> |
118 | 118 | </tr> |
119 | 119 | |
120 | 120 | <!-- Subnet ordering --> |
121 | 121 | <tr> |
122 | - <td class="title"><?php print _('Subnet ordering'); ?></td> |
|
122 | + <td class="title"><?php print _ ('Subnet ordering'); ?></td> |
|
123 | 123 | <td colspan="2"> |
124 | 124 | <select name="subnetOrdering" class="form-control input-sm input-w-auto pull-left"> |
125 | 125 | <?php |
126 | - $opts = array( |
|
127 | - "default" => _("Default"), |
|
128 | - "subnet,asc" => _("Subnet, ascending"), |
|
129 | - "subnet,desc" => _("Subnet, descending"), |
|
130 | - "description,asc" => _("Description, ascending"), |
|
131 | - "description,desc" => _("Description, descending"), |
|
126 | + $opts = array ( |
|
127 | + "default" => _ ("Default"), |
|
128 | + "subnet,asc" => _ ("Subnet, ascending"), |
|
129 | + "subnet,desc" => _ ("Subnet, descending"), |
|
130 | + "description,asc" => _ ("Description, ascending"), |
|
131 | + "description,desc" => _ ("Description, descending"), |
|
132 | 132 | ); |
133 | 133 | |
134 | - foreach($opts as $key=>$line) { |
|
135 | - if($section['subnetOrdering'] == $key) { print "<option value='$key' selected>$line</option>"; } |
|
136 | - else { print "<option value='$key'>$line</option>"; } |
|
134 | + foreach ($opts as $key=>$line) { |
|
135 | + if ($section['subnetOrdering'] == $key) { print "<option value='$key' selected>$line</option>"; } |
|
136 | + else { print "<option value='$key'>$line</option>"; } |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | ?> |
140 | 140 | </select> |
141 | - <span class="info2"><?php print _('How to order display of subnets'); ?></span> |
|
141 | + <span class="info2"><?php print _ ('How to order display of subnets'); ?></span> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | 144 | |
@@ -149,20 +149,20 @@ discard block |
||
149 | 149 | </tr> |
150 | 150 | <!-- permissions --> |
151 | 151 | <?php |
152 | - $permissions = strlen(@$section['permissions'])>1 ? $Sections->parse_section_permissions($section['permissions']) : ""; |
|
152 | + $permissions = strlen (@$section['permissions']) > 1 ? $Sections->parse_section_permissions ($section['permissions']) : ""; |
|
153 | 153 | |
154 | 154 | # print for each group |
155 | - $m=0; |
|
155 | + $m = 0; |
|
156 | 156 | |
157 | - if($groups) { |
|
158 | - foreach($groups as $g) { |
|
157 | + if ($groups) { |
|
158 | + foreach ($groups as $g) { |
|
159 | 159 | //cast |
160 | 160 | $g = (array) $g; |
161 | 161 | # structure |
162 | 162 | print "<tr>"; |
163 | 163 | # title |
164 | - if($m == 0) { print "<td>"._('Permissions')."</td>"; } |
|
165 | - else { print "<td></td>"; } |
|
164 | + if ($m == 0) { print "<td>"._ ('Permissions')."</td>"; } |
|
165 | + else { print "<td></td>"; } |
|
166 | 166 | |
167 | 167 | # name |
168 | 168 | print "<td>$g[g_name]</td>"; |
@@ -172,12 +172,12 @@ discard block |
||
172 | 172 | print "<span class='checkbox inline noborder'>"; |
173 | 173 | |
174 | 174 | print " <input type='radio' name='group$g[g_id]' value='0' checked> na"; |
175 | - if(@$permissions[$g['g_id']]==1) { print " <input type='radio' name='group$g[g_id]' value='1' checked> ro"; } |
|
176 | - else { print " <input type='radio' name='group$g[g_id]' value='1'> ro"; } |
|
177 | - if(@$permissions[$g['g_id']]==2) { print " <input type='radio' name='group$g[g_id]' value='2' checked> rw"; } |
|
178 | - else { print " <input type='radio' name='group$g[g_id]' value='2'> rw"; } |
|
179 | - if(@$permissions[$g['g_id']]==3) { print " <input type='radio' name='group$g[g_id]' value='3' checked> rwa"; } |
|
180 | - else { print " <input type='radio' name='group$g[g_id]' value='3'> rwa"; } |
|
175 | + if (@$permissions[$g['g_id']] == 1) { print " <input type='radio' name='group$g[g_id]' value='1' checked> ro"; } |
|
176 | + else { print " <input type='radio' name='group$g[g_id]' value='1'> ro"; } |
|
177 | + if (@$permissions[$g['g_id']] == 2) { print " <input type='radio' name='group$g[g_id]' value='2' checked> rw"; } |
|
178 | + else { print " <input type='radio' name='group$g[g_id]' value='2'> rw"; } |
|
179 | + if (@$permissions[$g['g_id']] == 3) { print " <input type='radio' name='group$g[g_id]' value='3' checked> rwa"; } |
|
180 | + else { print " <input type='radio' name='group$g[g_id]' value='3'> rwa"; } |
|
181 | 181 | print "</span>"; |
182 | 182 | print "</td>"; |
183 | 183 | |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | } |
189 | 189 | else { |
190 | 190 | print "<tr>"; |
191 | - print "<td>"._('Permissions')."</td>"; |
|
192 | - print "<td><div class='alert alert-info'>"._('No groups available')."</div></td>"; |
|
191 | + print "<td>"._ ('Permissions')."</td>"; |
|
192 | + print "<td><div class='alert alert-info'>"._ ('No groups available')."</div></td>"; |
|
193 | 193 | print "</tr>"; |
194 | 194 | } |
195 | 195 | ?> |
196 | 196 | |
197 | 197 | <?php |
198 | - if($_POST['action'] == "edit") { ?> |
|
198 | + if ($_POST['action'] == "edit") { ?> |
|
199 | 199 | <!-- Apply to subnets --> |
200 | 200 | <tr> |
201 | 201 | <td colspan="3"> |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | </td> |
204 | 204 | </tr> |
205 | 205 | <tr> |
206 | - <td><?php print _('Delegate'); ?></td> |
|
206 | + <td><?php print _ ('Delegate'); ?></td> |
|
207 | 207 | <td colspan="2"> |
208 | 208 | <div class="checkbox"> |
209 | 209 | <input type="checkbox" name="delegate" value="1"> |
210 | - <span class="info2 help-inline"><?php print _('Check to delegate permissions to all subnets in section'); ?></span> |
|
210 | + <span class="info2 help-inline"><?php print _ ('Check to delegate permissions to all subnets in section'); ?></span> |
|
211 | 211 | </div> |
212 | 212 | </td> |
213 | 213 | </tr> |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | <!-- footer --> |
229 | 229 | <div class="pFooter"> |
230 | 230 | <div class="btn-group"> |
231 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
232 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger";} else { print "btn-success"; } ?>" id="editSectionSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; } else if ($_POST['action']=="delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button> |
|
231 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
232 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editSectionSubmit"><i class="fa <?php if ($_POST['action'] == "add") { print "fa-plus"; } else if ($_POST['action'] == "delete") { print "fa-trash-o"; } else { print "fa-check"; } ?>"></i> <?php print ucwords (_ ($_POST['action'])); ?></button> |
|
233 | 233 | </div> |
234 | 234 | <!-- result holder --> |
235 | 235 | <div class="sectionEditResult"></div> |
@@ -5,30 +5,30 @@ discard block |
||
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 | $Admin = new Admin ($Database); |
14 | -$Sections = new Sections ($Database); |
|
14 | +$Sections = new Sections ($Database); |
|
15 | 15 | $Subnets = new Subnets ($Database); |
16 | -$Addresses = new Addresses ($Database); |
|
16 | +$Addresses = new Addresses ($Database); |
|
17 | 17 | $Result = new Result (); |
18 | 18 | |
19 | 19 | # verify that user is logged in |
20 | -$User->check_user_session(); |
|
20 | +$User->check_user_session (); |
|
21 | 21 | |
22 | 22 | # strip input tags |
23 | -$_POST = $Admin->strip_input_tags($_POST); |
|
23 | +$_POST = $Admin->strip_input_tags ($_POST); |
|
24 | 24 | |
25 | 25 | # validate csrf cookie |
26 | -$User->csrf_cookie ("validate", "section", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
26 | +$User->csrf_cookie ("validate", "section", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | 30 | # If confirm is not set print delete warning |
31 | -if ($_POST['action']=="delete" && !isset($_POST['deleteconfirm'])) { |
|
31 | +if ($_POST['action'] == "delete" && !isset($_POST['deleteconfirm'])) { |
|
32 | 32 | //for ajax to prevent reload |
33 | 33 | print "<div style='display:none'>alert alert-danger</div>"; |
34 | 34 | //result |
@@ -38,46 +38,46 @@ discard block |
||
38 | 38 | $subsections = $Sections->fetch_subsections ($_POST['id']); |
39 | 39 | |
40 | 40 | //print what will be deleted |
41 | - if(sizeof($subsections)>0) { |
|
42 | - $subnets = $Subnets->fetch_section_subnets($_POST['id']); //fetch all subnets in section |
|
43 | - $num_subnets = sizeof($subnets); //number of subnets to be deleted |
|
44 | - if(sizeof($subnets)>0) { |
|
45 | - foreach($subnets as $s) { |
|
41 | + if (sizeof ($subsections) > 0) { |
|
42 | + $subnets = $Subnets->fetch_section_subnets ($_POST['id']); //fetch all subnets in section |
|
43 | + $num_subnets = sizeof ($subnets); //number of subnets to be deleted |
|
44 | + if (sizeof ($subnets) > 0) { |
|
45 | + foreach ($subnets as $s) { |
|
46 | 46 | $out[] = $s; |
47 | 47 | } |
48 | 48 | } |
49 | 49 | //fetch subsection subnets |
50 | - foreach($subsections as $ss) { |
|
51 | - $subsection_subnets = $Subnets->fetch_section_subnets($ss->id); //fetch all subnets in subsection |
|
52 | - if(sizeof($subsection_subnets)>0) { |
|
53 | - foreach($subsection_subnets as $sss) { |
|
50 | + foreach ($subsections as $ss) { |
|
51 | + $subsection_subnets = $Subnets->fetch_section_subnets ($ss->id); //fetch all subnets in subsection |
|
52 | + if (sizeof ($subsection_subnets) > 0) { |
|
53 | + foreach ($subsection_subnets as $sss) { |
|
54 | 54 | $out[] = $sss; |
55 | 55 | } |
56 | 56 | } |
57 | - $num_subnets = $num_subnets + sizeof($subsection_subnets); |
|
57 | + $num_subnets = $num_subnets + sizeof ($subsection_subnets); |
|
58 | 58 | //count all addresses that will be deleted! |
59 | - $ipcnt = $Addresses->count_addresses_in_multiple_subnets($out); |
|
59 | + $ipcnt = $Addresses->count_addresses_in_multiple_subnets ($out); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | # no subsections |
63 | 63 | else { |
64 | - $subnets = $Subnets->fetch_section_subnets ($_POST['id']); //fetch all subnets in section |
|
65 | - $num_subnets = sizeof($subnets); |
|
66 | - $ipcnt = $Addresses->count_addresses_in_multiple_subnets($subnets); |
|
64 | + $subnets = $Subnets->fetch_section_subnets ($_POST['id']); //fetch all subnets in section |
|
65 | + $num_subnets = sizeof ($subnets); |
|
66 | + $ipcnt = $Addresses->count_addresses_in_multiple_subnets ($subnets); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | # printout |
70 | - print "<strong>"._("Warning")."</strong>: "._("I will delete").":<ul>"; |
|
71 | - print " <li>$num_subnets "._("subnets")."</li>"; |
|
72 | - if($ipcnt>0) { |
|
73 | - print " <li>$ipcnt "._("IP addresses")."</li>"; |
|
70 | + print "<strong>"._ ("Warning")."</strong>: "._ ("I will delete").":<ul>"; |
|
71 | + print " <li>$num_subnets "._ ("subnets")."</li>"; |
|
72 | + if ($ipcnt > 0) { |
|
73 | + print " <li>$ipcnt "._ ("IP addresses")."</li>"; |
|
74 | 74 | } |
75 | 75 | print "</ul>"; |
76 | 76 | |
77 | 77 | print "<hr><div style='text-align:right'>"; |
78 | - print _("Are you sure you want to delete above items?")." "; |
|
78 | + print _ ("Are you sure you want to delete above items?")." "; |
|
79 | 79 | print "<div class='btn-group'>"; |
80 | - print " <a class='btn btn-sm btn-danger editSectionSubmitDelete' id='editSectionSubmitDelete'>"._("Confirm")."</a>"; |
|
80 | + print " <a class='btn btn-sm btn-danger editSectionSubmitDelete' id='editSectionSubmitDelete'>"._ ("Confirm")."</a>"; |
|
81 | 81 | print "</div>"; |
82 | 82 | print "</div>"; |
83 | 83 | print "</div>"; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | # ok, update section |
86 | 86 | else { |
87 | 87 | # set variables for update |
88 | - $values = array("id"=>@$_POST['id'], |
|
88 | + $values = array ("id"=>@$_POST['id'], |
|
89 | 89 | "name"=>@$_POST['name'], |
90 | 90 | "description"=>@$_POST['description'], |
91 | 91 | "strictMode"=>@$_POST['strictMode'], |
@@ -96,23 +96,23 @@ discard block |
||
96 | 96 | ); |
97 | 97 | |
98 | 98 | # set permissions |
99 | - foreach($_POST as $key=>$val) { |
|
100 | - if(substr($key, 0,5) == "group") { |
|
101 | - if($val != "0") { |
|
102 | - $perm[substr($key,5)] = $val; |
|
99 | + foreach ($_POST as $key=>$val) { |
|
100 | + if (substr ($key, 0, 5) == "group") { |
|
101 | + if ($val != "0") { |
|
102 | + $perm[substr ($key, 5)] = $val; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | } |
106 | - $values['permissions'] = isset($perm) ? json_encode($perm) : ""; |
|
106 | + $values['permissions'] = isset($perm) ? json_encode ($perm) : ""; |
|
107 | 107 | |
108 | 108 | # delegate to all subnets? |
109 | - if(isset($_POST['delegate'])) { |
|
110 | - if($_POST['delegate']==1) { $values['delegate']=1; } |
|
111 | - else { $values['delegate']=0; } |
|
109 | + if (isset($_POST['delegate'])) { |
|
110 | + if ($_POST['delegate'] == 1) { $values['delegate'] = 1; } |
|
111 | + else { $values['delegate'] = 0; } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | # execute update |
115 | - if(!$Sections->modify_section ($_POST['action'], $values, @$_POST['id'])) { $Result->show("danger", _("Section $_POST[action] failed"), true); } |
|
116 | - else { $Result->show("success", _("Section $_POST[action] successful"), true); } |
|
115 | + if (!$Sections->modify_section ($_POST['action'], $values, @$_POST['id'])) { $Result->show ("danger", _ ("Section $_POST[action] failed"), true); } |
|
116 | + else { $Result->show ("success", _ ("Section $_POST[action] successful"), true); } |
|
117 | 117 | } |
118 | 118 | ?> |
119 | 119 | \ No newline at end of file |
@@ -5,21 +5,21 @@ 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 | # fetch all sections |
11 | -$sections = $Sections->fetch_all_sections(); |
|
11 | +$sections = $Sections->fetch_all_sections (); |
|
12 | 12 | |
13 | 13 | # Lets do some reordering to show slaves! |
14 | 14 | if ($sections !== false) { |
15 | - foreach($sections as $s) { |
|
16 | - if($s->masterSection=="0") { |
|
15 | + foreach ($sections as $s) { |
|
16 | + if ($s->masterSection == "0") { |
|
17 | 17 | # it is master |
18 | 18 | $s->class = "master"; |
19 | 19 | $sectionssorted[] = $s; |
20 | 20 | # check for slaves |
21 | - foreach($sections as $ss) { |
|
22 | - if($ss->masterSection==$s->id) { |
|
21 | + foreach ($sections as $ss) { |
|
22 | + if ($ss->masterSection == $s->id) { |
|
23 | 23 | $ss->class = "slave"; |
24 | 24 | $sectionssorted[] = $ss; |
25 | 25 | } |
@@ -31,28 +31,28 @@ discard block |
||
31 | 31 | } |
32 | 32 | ?> |
33 | 33 | |
34 | -<h4><?php print _('Section management'); ?></h4> |
|
34 | +<h4><?php print _ ('Section management'); ?></h4> |
|
35 | 35 | <hr> |
36 | 36 | |
37 | 37 | <!-- Add new section --> |
38 | 38 | <div class="btn-group" style='margin-bottom:20px;margin-top:10px;'> |
39 | - <button class='btn btn-sm btn-default editSection' data-action='add'><i class='fa fa-plus'></i> <?php print _('Add section'); ?></button> |
|
40 | - <button class='btn btn-sm btn-default sectionOrder' ><i class='fa fa-tasks'></i> <?php print _('Section order'); ?></button> |
|
39 | + <button class='btn btn-sm btn-default editSection' data-action='add'><i class='fa fa-plus'></i> <?php print _ ('Add section'); ?></button> |
|
40 | + <button class='btn btn-sm btn-default sectionOrder' ><i class='fa fa-tasks'></i> <?php print _ ('Section order'); ?></button> |
|
41 | 41 | </div> |
42 | 42 | |
43 | 43 | <!-- show sections --> |
44 | -<?php if($sections!==false) { ?> |
|
44 | +<?php if ($sections !== false) { ?> |
|
45 | 45 | <table class="table sorted table-striped table-condensed table-top"> |
46 | 46 | <!-- headers --> |
47 | 47 | <thead> |
48 | 48 | <tr> |
49 | - <th><?php print _('Name'); ?></th> |
|
50 | - <th><?php print _('Description'); ?></th> |
|
51 | - <th><?php print _('Parent'); ?></th> |
|
52 | - <th><?php print _('Strict mode'); ?></th> |
|
53 | - <th><?php print _('Show VLANs'); ?></th> |
|
54 | - <th><?php print _('Show VRFs'); ?></th> |
|
55 | - <th><?php print _('Group Permissions'); ?></th> |
|
49 | + <th><?php print _ ('Name'); ?></th> |
|
50 | + <th><?php print _ ('Description'); ?></th> |
|
51 | + <th><?php print _ ('Parent'); ?></th> |
|
52 | + <th><?php print _ ('Strict mode'); ?></th> |
|
53 | + <th><?php print _ ('Show VLANs'); ?></th> |
|
54 | + <th><?php print _ ('Show VRFs'); ?></th> |
|
55 | + <th><?php print _ ('Group Permissions'); ?></th> |
|
56 | 56 | <th></th> |
57 | 57 | </tr> |
58 | 58 | </thead> |
@@ -60,66 +60,66 @@ discard block |
||
60 | 60 | <tbody> |
61 | 61 | <!-- existing sections --> |
62 | 62 | <?php |
63 | -if(isset($sections_sorted)) { |
|
63 | +if (isset($sections_sorted)) { |
|
64 | 64 | foreach ($sections_sorted as $section) { |
65 | 65 | //cast |
66 | 66 | $section = (array) $section; |
67 | 67 | |
68 | - print '<tr class="'.$section['class'].'">'. "\n"; |
|
68 | + print '<tr class="'.$section['class'].'">'."\n"; |
|
69 | 69 | |
70 | - print ' <td>'. str_replace("_", " ", $section['name']).'</td>'. "\n"; |
|
71 | - print ' <td>'. $section['description'] .'</td>'. "\n"; |
|
70 | + print ' <td>'.str_replace ("_", " ", $section['name']).'</td>'."\n"; |
|
71 | + print ' <td>'.$section['description'].'</td>'."\n"; |
|
72 | 72 | //master Section |
73 | - if($section['masterSection']!=0) { |
|
73 | + if ($section['masterSection'] != 0) { |
|
74 | 74 | # get section details |
75 | - $ssec = $Admin->fetch_object("sections", "id", $section['masterSection']); |
|
75 | + $ssec = $Admin->fetch_object ("sections", "id", $section['masterSection']); |
|
76 | 76 | print " <td>$ssec->name</td>"; |
77 | 77 | } else { |
78 | 78 | print " <td>/</td>"; |
79 | 79 | } |
80 | 80 | //strictMode |
81 | - $mode = $section['strictMode']==0 ? _("No") : _("Yes"); |
|
82 | - print ' <td>'. $mode .'</td>'. "\n"; |
|
81 | + $mode = $section['strictMode'] == 0 ? _ ("No") : _ ("Yes"); |
|
82 | + print ' <td>'.$mode.'</td>'."\n"; |
|
83 | 83 | //Show VLANs |
84 | 84 | print " <td>"; |
85 | - print @$section['showVLAN']==1 ? _("Yes") : _("No"); |
|
85 | + print @$section['showVLAN'] == 1 ? _ ("Yes") : _ ("No"); |
|
86 | 86 | print " </td>"; |
87 | 87 | //Show VRFs |
88 | 88 | print " <td>"; |
89 | - print @$section['showVRF']==1 ? _("Yes") : _("No"); |
|
89 | + print @$section['showVRF'] == 1 ? _ ("Yes") : _ ("No"); |
|
90 | 90 | print " </td>"; |
91 | 91 | //permissions |
92 | 92 | print "<td>"; |
93 | - if(strlen($section['permissions'])>1 && !is_null($section['permissions'])) { |
|
94 | - $permissions = $Sections->parse_section_permissions($section['permissions']); |
|
93 | + if (strlen ($section['permissions']) > 1 && !is_null ($section['permissions'])) { |
|
94 | + $permissions = $Sections->parse_section_permissions ($section['permissions']); |
|
95 | 95 | # print for each if they exist |
96 | - if(sizeof($permissions) > 0) { |
|
97 | - foreach($permissions as $key=>$p) { |
|
96 | + if (sizeof ($permissions) > 0) { |
|
97 | + foreach ($permissions as $key=>$p) { |
|
98 | 98 | # get subnet name |
99 | - $group = $Tools->fetch_object("userGroups", "g_id", $key); |
|
99 | + $group = $Tools->fetch_object ("userGroups", "g_id", $key); |
|
100 | 100 | # parse permissions |
101 | - $perm = $Subnets->parse_permissions($p); |
|
101 | + $perm = $Subnets->parse_permissions ($p); |
|
102 | 102 | print $group->g_name." : ".$perm."<br>"; |
103 | 103 | } |
104 | 104 | } |
105 | 105 | else { |
106 | - print _("All groups: No access"); |
|
106 | + print _ ("All groups: No access"); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | else { |
110 | - print _("All groups: No access"); |
|
110 | + print _ ("All groups: No access"); |
|
111 | 111 | } |
112 | 112 | print "</td>"; |
113 | 113 | |
114 | - print ' <td class="actions">'. "\n"; |
|
114 | + print ' <td class="actions">'."\n"; |
|
115 | 115 | print " <div class='btn-group btn-group-xs'>"; |
116 | 116 | print " <button class='btn btn-default editSection' data-action='edit' data-sectionid='$section[id]'><i class='fa fa-pencil'></i></button>"; |
117 | - print " <a class='btn btn-default' href='".create_link("administration","sections","section-changelog",$section['id'])."'><i class='fa fa-clock-o'></i></a>"; |
|
117 | + print " <a class='btn btn-default' href='".create_link ("administration", "sections", "section-changelog", $section['id'])."'><i class='fa fa-clock-o'></i></a>"; |
|
118 | 118 | print " <button class='btn btn-default editSection' data-action='delete' data-sectionid='$section[id]'><i class='fa fa-times'></i></button>"; |
119 | 119 | print " </div>"; |
120 | - print ' </td>'. "\n"; |
|
120 | + print ' </td>'."\n"; |
|
121 | 121 | |
122 | - print '</tr>'. "\n";; |
|
122 | + print '</tr>'."\n"; ; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | ?> |
@@ -128,18 +128,18 @@ discard block |
||
128 | 128 | |
129 | 129 | <!-- show no configured --> |
130 | 130 | <?php } else { ?> |
131 | -<div class="alert alert-warn alert-absolute"><?php print _('No sections configured'); ?>!</div> |
|
131 | +<div class="alert alert-warn alert-absolute"><?php print _ ('No sections configured'); ?>!</div> |
|
132 | 132 | <?php } ?> |
133 | 133 | |
134 | 134 | |
135 | 135 | <!-- permissions info --> |
136 | 136 | <div class="alert alert-info alert-absolute" style="margin-top:15px;"> |
137 | -<?php print _('Permissions info'); ?><hr> |
|
137 | +<?php print _ ('Permissions info'); ?><hr> |
|
138 | 138 | <ul> |
139 | - <li><?php print _('If group is not set in permissions then it will not have access to subnet'); ?></li> |
|
140 | - <li><?php print _('Groups with RO permissions will not be able to create new subnets'); ?></li> |
|
141 | - <li><?php print _('Subnet permissions must be set separately. By default if group has access to section<br>it will have same permission on subnets'); ?></li> |
|
142 | - <li><?php print _('You can choose to delegate section permissions to all underlying subnets'); ?></li> |
|
143 | - <li><?php print _('If group does not have access to section it will not be able to access subnet, even if<br>subnet permissions are set'); ?></li> |
|
139 | + <li><?php print _ ('If group is not set in permissions then it will not have access to subnet'); ?></li> |
|
140 | + <li><?php print _ ('Groups with RO permissions will not be able to create new subnets'); ?></li> |
|
141 | + <li><?php print _ ('Subnet permissions must be set separately. By default if group has access to section<br>it will have same permission on subnets'); ?></li> |
|
142 | + <li><?php print _ ('You can choose to delegate section permissions to all underlying subnets'); ?></li> |
|
143 | + <li><?php print _ ('If group does not have access to section it will not be able to access subnet, even if<br>subnet permissions are set'); ?></li> |
|
144 | 144 | </ul> |
145 | 145 | </div> |
146 | 146 | \ No newline at end of file |
@@ -5,27 +5,27 @@ |
||
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 | $Admin = new Admin ($Database); |
14 | -$Sections = new Sections ($Database); |
|
14 | +$Sections = new Sections ($Database); |
|
15 | 15 | $Result = new Result (); |
16 | 16 | |
17 | 17 | # verify that user is logged in |
18 | -$User->check_user_session(); |
|
18 | +$User->check_user_session (); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | # create array of ordering |
22 | -$otmp = explode(";", $_POST['position']); |
|
23 | -foreach($otmp as $ot) { |
|
24 | - $ptmp = explode(":", $ot); |
|
22 | +$otmp = explode (";", $_POST['position']); |
|
23 | +foreach ($otmp as $ot) { |
|
24 | + $ptmp = explode (":", $ot); |
|
25 | 25 | $order[$ptmp[0]] = $ptmp[1]; |
26 | 26 | } |
27 | 27 | |
28 | 28 | #update |
29 | -if(!$Sections->modify_section ("reorder", $order)) { $Result->show("danger", _("Section reordering failed"), true); } |
|
30 | -else { $Result->show("success", _("Section reordering successful"), true); } |
|
29 | +if (!$Sections->modify_section ("reorder", $order)) { $Result->show ("danger", _ ("Section reordering failed"), true); } |
|
30 | +else { $Result->show ("success", _ ("Section reordering successful"), true); } |
|
31 | 31 | ?> |
32 | 32 | \ No newline at end of file |