Completed
Pull Request — master (#532)
06:37
created
app/admin/nameservers/edit-result.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -25,38 +25,38 @@
 block discarded – undo
25 25
 
26 26
 # Name and primary nameserver must be present!
27 27
 if ($_POST['action']!="delete") {
28
-	if($_POST['name'] == "") 				{ $Result->show("danger", _("Name is mandatory"), true); }
29
-	if(trim($_POST['namesrv-1']) == "") 	{ $Result->show("danger", _("Primary nameserver is mandatory"), true); }
28
+    if($_POST['name'] == "") 				{ $Result->show("danger", _("Name is mandatory"), true); }
29
+    if(trim($_POST['namesrv-1']) == "") 	{ $Result->show("danger", _("Primary nameserver is mandatory"), true); }
30 30
 }
31 31
 
32 32
 // merge nameservers
33 33
 foreach($_POST as $key=>$line) {
34
-	if (strlen(strstr($key,"namesrv-"))>0) {
35
-		if (strlen($line)>0) {
36
-			$all_nameservers[] = trim($line);
37
-		}
38
-	}
34
+    if (strlen(strstr($key,"namesrv-"))>0) {
35
+        if (strlen($line)>0) {
36
+            $all_nameservers[] = trim($line);
37
+        }
38
+    }
39 39
 }
40 40
 $_POST['namesrv1'] = isset($all_nameservers) ? implode(";", $all_nameservers) : "";
41 41
 
42 42
 // set sections
43 43
 foreach($_POST as $key=>$line) {
44
-	if (strlen(strstr($key,"section-"))>0) {
45
-		$key2 = str_replace("section-", "", $key);
46
-		$temp[] = $key2;
47
-		unset($_POST[$key]);
48
-	}
44
+    if (strlen(strstr($key,"section-"))>0) {
45
+        $key2 = str_replace("section-", "", $key);
46
+        $temp[] = $key2;
47
+        unset($_POST[$key]);
48
+    }
49 49
 }
50 50
 # glue sections together
51 51
 $_POST['permissions'] = sizeof($temp)>0 ? implode(";", $temp) : null;
52 52
 
53 53
 # set update array
54 54
 $values = array("id"=>@$_POST['nameserverId'],
55
-				"name"=>$_POST['name'],
56
-				"permissions"=>$_POST['permissions'],
57
-				"namesrv1"=>$_POST['namesrv1'],
58
-				"description"=>$_POST['description']
59
-				);
55
+                "name"=>$_POST['name'],
56
+                "permissions"=>$_POST['permissions'],
57
+                "namesrv1"=>$_POST['namesrv1'],
58
+                "description"=>$_POST['description']
59
+                );
60 60
 # update
61 61
 if(!$Admin->object_modify("nameservers", $_POST['action'], "id", $values))	{ $Result->show("danger",  _("Failed to $_POST[action] nameserver set").'!', true); }
62 62
 else																		{ $Result->show("success", _("Nameserver set $_POST[action] successfull").'!', false); }
Please login to merge, or discard this patch.
app/admin/nameservers/edit.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 # get Nameserver sets
25 25
 if($_POST['action']!="add") {
26
-	$nameservers = $Admin->fetch_object ("nameservers", "id", $_POST['nameserverId']);
27
-	$nameservers!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
28
-	$nameservers = (array) $nameservers;
26
+    $nameservers = $Admin->fetch_object ("nameservers", "id", $_POST['nameserverId']);
27
+    $nameservers!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
28
+    $nameservers = (array) $nameservers;
29 29
 }
30 30
 
31 31
 # disable edit on delete
@@ -59,20 +59,20 @@  discard block
 block discarded – undo
59 59
 	<tbody id="nameservers">
60 60
 	<!-- Nameservers -->
61 61
 	<?php
62
-	//loop
63
-	$m=1;
64
-	foreach ($nameservers['namesrv1'] as $ns) {
65
-		print "<tr id='namesrv-$m'>";
66
-		print "	<td>"._("Nameserver")." $m</td>";
67
-		print "	<td>";
68
-		print "	<input type='text' class='rd form-control input-sm' name='namesrv-$m' value='$ns' $readonly>";
69
-		print "	</td>";
70
-		print "	<td><button class='btn btn-sm btn-default' id='remove_nameserver' data-id='namesrv-".$m."'><i class='fa fa-trash-o'></i></button></td>";
71
-		print "</tr>";
72
-		//next
73
-		$m++;
74
-	}
75
-	?>
62
+    //loop
63
+    $m=1;
64
+    foreach ($nameservers['namesrv1'] as $ns) {
65
+        print "<tr id='namesrv-$m'>";
66
+        print "	<td>"._("Nameserver")." $m</td>";
67
+        print "	<td>";
68
+        print "	<input type='text' class='rd form-control input-sm' name='namesrv-$m' value='$ns' $readonly>";
69
+        print "	</td>";
70
+        print "	<td><button class='btn btn-sm btn-default' id='remove_nameserver' data-id='namesrv-".$m."'><i class='fa fa-trash-o'></i></button></td>";
71
+        print "</tr>";
72
+        //next
73
+        $m++;
74
+    }
75
+    ?>
76 76
 	</tbody>
77 77
 
78 78
 	<tbody>
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 		<td><?php print _('Description'); ?></td>
91 91
 		<td>
92 92
 			<?php
93
-			if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="nameserverId" value="'. $_POST['nameserverId'] .'">'. "\n";}
94
-			?>
93
+            if( ($_POST['action'] == "edit") || ($_POST['action'] == "delete") ) { print '<input type="hidden" name="nameserverId" value="'. $_POST['nameserverId'] .'">'. "\n";}
94
+            ?>
95 95
 			<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
96 96
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
97 97
 			<input type="text" class="description form-control input-sm" name="description" placeholder="<?php print _('Description'); ?>" value="<?php print @$nameservers['description']; ?>" <?php print $readonly; ?>>
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 		<td style="vertical-align: top !important"><?php print _('Sections to display nameserver set in'); ?>:</td>
105 105
 		<td>
106 106
 		<?php
107
-		# select sections
108
-		$sections = $Sections->fetch_all_sections();
109
-		# reformat domains sections to array
110
-		$nameservers_sections = explode(";", @$nameservers['permissions']);
111
-		$nameservers_sections = is_array($nameservers_sections) ? $nameservers_sections : array();
112
-		// loop
113
-		if ($sections !== false) {
114
-			foreach($sections as $section) {
115
-				if(in_array($section->id, @$nameservers_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
116
-				else 												{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
117
-			}
118
-		}
119
-		?>
107
+        # select sections
108
+        $sections = $Sections->fetch_all_sections();
109
+        # reformat domains sections to array
110
+        $nameservers_sections = explode(";", @$nameservers['permissions']);
111
+        $nameservers_sections = is_array($nameservers_sections) ? $nameservers_sections : array();
112
+        // loop
113
+        if ($sections !== false) {
114
+            foreach($sections as $section) {
115
+                if(in_array($section->id, @$nameservers_sections)) 	{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on" checked> '. $section->name .'</div>'. "\n"; }
116
+                else 												{ print '<div class="checkbox" style="margin:0px;"><input type="checkbox" name="section-'. $section->id .'" value="on">'. $section->name .'</span></div>'. "\n"; }
117
+            }
118
+        }
119
+        ?>
120 120
 		</td>
121 121
 		<td></td>
122 122
 	</tr>
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	</form>
127 127
 
128 128
 	<?php
129
-	//print delete warning
130
-	if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing nameserver set will also remove all references from belonging subnets!"), false);}
131
-	?>
129
+    //print delete warning
130
+    if($_POST['action'] == "delete")	{ $Result->show("warning", "<strong>"._('Warning').":</strong> "._("removing nameserver set will also remove all references from belonging subnets!"), false);}
131
+    ?>
132 132
 </div>
133 133
 
134 134
 
Please login to merge, or discard this patch.
app/admin/widgets/index.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -27,57 +27,57 @@
 block discarded – undo
27 27
 
28 28
 	<!-- Language list -->
29 29
 	<?php
30
-	/* no results */
31
-	if($widgets===false) { ?>
30
+    /* no results */
31
+    if($widgets===false) { ?>
32 32
 		<tr>
33 33
 			<td colspan="4"><div class="alert alert-info alert-nomargin"><?php print _('No widgets created yet'); ?></div></td>
34 34
 		</tr>
35 35
 	<?php } else {
36
-		# headers
37
-		print "<thead>";
38
-		print "<tr>";
39
-		print "	<th>"._('Title')."</th>";
40
-		print "	<th>"._('Description')."</th>";
41
-		print "	<th>"._('File')."</th>";
42
-		print "	<th>"._('Admin')."</th>";
43
-		print "	<th>"._('Active')."</th>";
44
-		print "	<th>"._('Parameters')."</th>";
45
-		print "	<th>"._('Validity')."</th>";
46
-		print "	<th></th>";
47
-		print "</tr>";
48
-		print "</thead>";
36
+        # headers
37
+        print "<thead>";
38
+        print "<tr>";
39
+        print "	<th>"._('Title')."</th>";
40
+        print "	<th>"._('Description')."</th>";
41
+        print "	<th>"._('File')."</th>";
42
+        print "	<th>"._('Admin')."</th>";
43
+        print "	<th>"._('Active')."</th>";
44
+        print "	<th>"._('Parameters')."</th>";
45
+        print "	<th>"._('Validity')."</th>";
46
+        print "	<th></th>";
47
+        print "</tr>";
48
+        print "</thead>";
49 49
 
50 50
         print "<tbody>";
51
-		# print
52
-		foreach($widgets as $w) {
53
-			# cast
54
-			$w = (array) $w;
51
+        # print
52
+        foreach($widgets as $w) {
53
+            # cast
54
+            $w = (array) $w;
55 55
 
56
-			# verify validity
57
-			$valid = $Tools->verify_widget($w['wfile']);
56
+            # verify validity
57
+            $valid = $Tools->verify_widget($w['wfile']);
58 58
 
59
-			if($valid)  { $vPrint = "<span class='alert alert-success'>"._('Valid')."</span>"; }
60
-			else		{ $vPrint = "<span class='alert alert-danger'>"._('Invalid')."</span>"; }
59
+            if($valid)  { $vPrint = "<span class='alert alert-success'>"._('Valid')."</span>"; }
60
+            else		{ $vPrint = "<span class='alert alert-danger'>"._('Invalid')."</span>"; }
61 61
 
62
-			print "<tr>";
63
-			print "	<td>"._($w['wtitle'])."</td>";
64
-			print "	<td>"._($w['wdescription'])."</td>";
65
-			print "	<td>$w[wfile].php</td>";
66
-			print "	<td>"._($w['wadminonly'])."</td>";
67
-			print "	<td>"._($w['wactive'])."</td>";
68
-			print "	<td>"._($w['wparams'])."</td>";
69
-			print "	<td>$vPrint</td>";
70
-			print "	<td>";
71
-			print "	<div class='btn-group'>";
72
-			print "		<button class='btn btn-xs btn-default wedit' data-action='edit' data-wid='$w[wid]'><i class='fa fa-pencil'></i></button>";
73
-			print "		<button class='btn btn-xs btn-default wedit' data-action='delete' data-wid='$w[wid]'><i class='fa fa-times'></i></button>";
74
-			print "	</div>";
75
-			print "	</td>";
76
-			print "</tr>";
77
-		}
78
-		print "</tbody>";
79
-	}
80
-	?>
62
+            print "<tr>";
63
+            print "	<td>"._($w['wtitle'])."</td>";
64
+            print "	<td>"._($w['wdescription'])."</td>";
65
+            print "	<td>$w[wfile].php</td>";
66
+            print "	<td>"._($w['wadminonly'])."</td>";
67
+            print "	<td>"._($w['wactive'])."</td>";
68
+            print "	<td>"._($w['wparams'])."</td>";
69
+            print "	<td>$vPrint</td>";
70
+            print "	<td>";
71
+            print "	<div class='btn-group'>";
72
+            print "		<button class='btn btn-xs btn-default wedit' data-action='edit' data-wid='$w[wid]'><i class='fa fa-pencil'></i></button>";
73
+            print "		<button class='btn btn-xs btn-default wedit' data-action='delete' data-wid='$w[wid]'><i class='fa fa-times'></i></button>";
74
+            print "	</div>";
75
+            print "	</td>";
76
+            print "</tr>";
77
+        }
78
+        print "</tbody>";
79
+    }
80
+    ?>
81 81
 
82 82
 
83 83
 </table>
Please login to merge, or discard this patch.
app/admin/widgets/edit-result.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 # ID must be numeric */
27 27
 if($_POST['action']!="add") {
28
-	if(!is_numeric($_POST['wid']))								{ $Result->show("danger", _("Invalid ID"), true); }
28
+    if(!is_numeric($_POST['wid']))								{ $Result->show("danger", _("Invalid ID"), true); }
29 29
 }
30 30
 # Title and path must be present!
31 31
 if($_POST['action']!="delete") {
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 
38 38
 # set update values
39 39
 $values = array("wid"=>@$_POST['wid'],
40
-				"wtitle"=>$_POST['wtitle'],
41
-				"wdescription"=>@$_POST['wdescription'],
42
-				"wfile"=>$_POST['wfile'],
43
-				"wadminonly"=>$_POST['wadminonly'],
44
-				"wactive"=>$_POST['wactive'],
45
-				"wparams"=>$_POST['wparams'],
46
-				"whref"=>$_POST['whref'],
47
-				"wsize"=>$_POST['wsize']
48
-				);
40
+                "wtitle"=>$_POST['wtitle'],
41
+                "wdescription"=>@$_POST['wdescription'],
42
+                "wfile"=>$_POST['wfile'],
43
+                "wadminonly"=>$_POST['wadminonly'],
44
+                "wactive"=>$_POST['wactive'],
45
+                "wparams"=>$_POST['wparams'],
46
+                "whref"=>$_POST['whref'],
47
+                "wsize"=>$_POST['wsize']
48
+                );
49 49
 # update
50 50
 if(!$Admin->object_modify("widgets", $_POST['action'], "wid", $values))	{ $Result->show("danger",  _("Widget $_POST[action] error")."!", true); }
51 51
 else																	{ $Result->show("success", _("Widget $_POST[action] success")."!", true); }
Please login to merge, or discard this patch.
app/admin/widgets/edit.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 
23 23
 # fetch widget
24 24
 if($_POST['action']!="add") {
25
-	$w = $Admin->fetch_object ("widgets", "wid", $_POST['wid']);
26
-	$w!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
27
-	$w = (array) $w;
25
+    $w = $Admin->fetch_object ("widgets", "wid", $_POST['wid']);
26
+    $w!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
27
+    $w = (array) $w;
28 28
 }
29 29
 ?>
30 30
 
Please login to merge, or discard this patch.
app/admin/ripe-import/import-subnets.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -24,73 +24,73 @@
 block discarded – undo
24 24
 
25 25
 //get unique keys for subnets because they are not sequential if deleted!!!
26 26
 foreach($_POST as $key=>$line) {
27
-	if (strlen(strstr($key,"subnet"))>0) {
28
-		$allSubnets[] = $key;
29
-	}
27
+    if (strlen(strstr($key,"subnet"))>0) {
28
+        $allSubnets[] = $key;
29
+    }
30 30
 }
31 31
 
32 32
 # format and verify each record
33 33
 foreach($allSubnets as $subnet) {
34
-	//get sequential number
35
-	$m = str_replace("subnet-", "", $subnet);
36
-
37
-	//reformat subnet
38
-	$_temp = explode("/", $_POST['subnet-' . $m]);
39
-
40
-	//set subnet details for importing
41
-	$subnet_import['subnet'] 	   = $Subnets->transform_to_decimal($_temp[0]);
42
-	$subnet_import['mask'] 	   	   = $_temp[1];
43
-	$subnet_import['sectionId']    = $_POST['section-' . $m];
44
-	$subnet_import['description']  = $_POST['description-' . $m];
45
-	$subnet_import['vlanId'] 	   = $_POST['vlan-' . $m];
46
-	$subnet_import['vrfId'] 	   = $_POST['vrf-' . $m];
47
-	$subnet_import['showName']	   = $_POST['showName-' . $m];
48
-
49
-	//cidr
50
-	if(strlen($err=$Subnets->verify_cidr($Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask']))>5) {
51
-		$errors[] = $err;
52
-	}
53
-	//overlapping, only root !
54
-	else if (strlen($err=$Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId']))>5) {
55
-		$errors[] = $err;
56
-	}
57
-	//set insert
58
-	else {
59
-		$subnets_to_insert[] = $subnet_import;
60
-	}
34
+    //get sequential number
35
+    $m = str_replace("subnet-", "", $subnet);
36
+
37
+    //reformat subnet
38
+    $_temp = explode("/", $_POST['subnet-' . $m]);
39
+
40
+    //set subnet details for importing
41
+    $subnet_import['subnet'] 	   = $Subnets->transform_to_decimal($_temp[0]);
42
+    $subnet_import['mask'] 	   	   = $_temp[1];
43
+    $subnet_import['sectionId']    = $_POST['section-' . $m];
44
+    $subnet_import['description']  = $_POST['description-' . $m];
45
+    $subnet_import['vlanId'] 	   = $_POST['vlan-' . $m];
46
+    $subnet_import['vrfId'] 	   = $_POST['vrf-' . $m];
47
+    $subnet_import['showName']	   = $_POST['showName-' . $m];
48
+
49
+    //cidr
50
+    if(strlen($err=$Subnets->verify_cidr($Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask']))>5) {
51
+        $errors[] = $err;
52
+    }
53
+    //overlapping, only root !
54
+    else if (strlen($err=$Subnets->verify_subnet_overlapping ($subnet_import['sectionId'], $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], $subnet_import['vrfId']))>5) {
55
+        $errors[] = $err;
56
+    }
57
+    //set insert
58
+    else {
59
+        $subnets_to_insert[] = $subnet_import;
60
+    }
61 61
 }
62 62
 
63 63
 
64 64
 # print errors if they exist or success
65 65
 if(isset($errors)) {
66
-	print '<div class="alert alert-danger alert-absolute">'._('Please fix the following errors before inserting').':<hr>'. "\n";
67
-	foreach ($errors as $line) {
68
-		print $line.'<br>';
69
-	}
70
-	print '</div>';
66
+    print '<div class="alert alert-danger alert-absolute">'._('Please fix the following errors before inserting').':<hr>'. "\n";
67
+    foreach ($errors as $line) {
68
+        print $line.'<br>';
69
+    }
70
+    print '</div>';
71 71
 }
72 72
 else {
73
-	$errors_import_failed = 0;
74
-
75
-	//insert if all other is ok!
76
-	foreach($subnets_to_insert as $subnet_import) {
77
-		//formulate insert query
78
-		$values = array("sectionId"=>$subnet_import['sectionId'],
79
-						"subnet"=>$subnet_import['subnet'],
80
-						"mask"=>$subnet_import['mask'],
81
-						"description"=>$subnet_import['description'],
82
-						"vlanId"=>$subnet_import['vlanId'],
83
-						"vrfId"=>$subnet_import['vrfId'],
84
-						"masterSubnetId"=>0,
85
-						"showName"=>$subnet_import['showName']
86
-						);
87
-
88
-		if(!$Admin->object_modify("subnets", "add", "id", $values)) {
89
-			$Result->show("danger", _('Failed to import subnet').' '. $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], false);
90
-			$errors_import_failed++;
91
-		}
92
-	}
93
-	//check if all is ok and print it!
94
-	if($errors_import_failed == 0) 	{ $Result->show("success", _("Import successfull")."!", false); }
73
+    $errors_import_failed = 0;
74
+
75
+    //insert if all other is ok!
76
+    foreach($subnets_to_insert as $subnet_import) {
77
+        //formulate insert query
78
+        $values = array("sectionId"=>$subnet_import['sectionId'],
79
+                        "subnet"=>$subnet_import['subnet'],
80
+                        "mask"=>$subnet_import['mask'],
81
+                        "description"=>$subnet_import['description'],
82
+                        "vlanId"=>$subnet_import['vlanId'],
83
+                        "vrfId"=>$subnet_import['vrfId'],
84
+                        "masterSubnetId"=>0,
85
+                        "showName"=>$subnet_import['showName']
86
+                        );
87
+
88
+        if(!$Admin->object_modify("subnets", "add", "id", $values)) {
89
+            $Result->show("danger", _('Failed to import subnet').' '. $Subnets->transform_to_dotted($subnet_import['subnet'])."/".$subnet_import['mask'], false);
90
+            $errors_import_failed++;
91
+        }
92
+    }
93
+    //check if all is ok and print it!
94
+    if($errors_import_failed == 0) 	{ $Result->show("success", _("Import successfull")."!", false); }
95 95
 }
96 96
 ?>
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/ripe-import/ripe-telnet.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 //strip AS if provided, to get just the number
22 22
 if(substr($_POST['as'], 0,2)=="AS" || substr($_POST['as'], 0,2)=="as") {
23
-	$_POST['as'] = substr($_POST['as'], 2);
23
+    $_POST['as'] = substr($_POST['as'], 2);
24 24
 };
25 25
 
26 26
 
@@ -34,100 +34,100 @@  discard block
 block discarded – undo
34 34
 
35 35
 //none found
36 36
 if(sizeof(@$subnet) == 0) {
37
-	print "<hr>";
38
-	$Result->show("danger alert-absolute", _('No subnets found').'!', true);
37
+    print "<hr>";
38
+    $Result->show("danger alert-absolute", _('No subnets found').'!', true);
39 39
 }
40 40
 else {
41
-	//form
42
-	print '<form name="asImport" id="asImport">';
43
-	//table
44
-	print '<table class="asImport table table-striped table-condensed table-top table-auto">';
45
-	//headers
46
-	print '<tr>';
47
-	print '	<th colspan="5">'._('I found the following routes belonging to AS').' '.$_POST['as'].':</th>';
48
-	print '</tr> ';
49
-
50
-	print "<tr>";
51
-	print "	<th></th>";
52
-	print "	<th>"._('Subnet')."</th>";
53
-	print "	<th>"._('select section')."</th>";
54
-	print "	<th>"._('Description')."</th>";
55
-	print "	<th>"._('VLAN')."</th>";
56
-	print "	<th>"._('VRF')."</th>";
57
-	print "	<th>"._('Show name')."</th>";
58
-
59
-	print "</tr>";
60
-
61
-	//print found subnets
62
-	$m = 0;
63
-	foreach ($subnet as $route) {
64
-		# only not empty
65
-		if(strlen($route)>2) {
66
-			print '<tr>'. "\n";
67
-
68
-			//delete
69
-			print '<td class="removeSubnet">'. "\n";
70
-			print '	<button class="btn btn-xs btn-default btn-danger" rel="tooltip" title="'._('Remove this subnet').'"><i class="fa fa-times"></i></button>'. "\n";
71
-			print '</td>'. "\n";
72
-			//subnet
73
-			print '<td>'. "\n";
74
-			print '<input type="text" class="form-control input-sm" name="subnet-'. $m .'" value="'. $route .'">'. "\n";
75
-			print '</td>'. "\n";
76
-			//section
77
-			print '<td>'. "\n";
78
-			print '<select name="section-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
79
-			foreach($sections as $section) {
80
-				print '<option value="'. $section->id .'">'. $section->name .'</option>';
81
-			}
82
-			print '</select>'. "\n";
83
-			print '</td>'. "\n";
84
-			//description
85
-			print '<td>'. "\n";
86
-			print '<input type="text" class="form-control input-sm input-w-250" name="description-'. $m .'">'. "\n";
87
-			print '</td>'. "\n";
88
-			//VLAN
89
-			print '<td>'. "\n";
90
-			print '<select name="vlan-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
91
-			print '<option value="0">No VLAN</option>';
92
-			if(sizeof(@$vlans)>0) {
93
-				foreach($vlans as $vlan) {
94
-					# set description
95
-					$vlan_description = strlen($vlan->description)>0 ? " (".$vlan->description.")" : "";
96
-					print '<option value="'.$vlan->vlanId.'">'.$vlan->number.$vlan_description.'</option>';
97
-				}
98
-			}
99
-			//VRF
100
-			print '<td>'. "\n";
101
-			print '<select name="vrf-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
102
-			print '<option value="0">No VRF</option>';
103
-			if(sizeof(@$vrfs)>0) {
104
-				foreach($vrfs as $vrf) {
105
-					# set description
106
-					$vrf_description = strlen($vrf->description)>0 ? " (".$vrf->description.")" : "";
107
-					print '<option value="'.$vrf->vrfId.'">'.$vrf->name.$vrf_description.'</option>';
108
-				}
109
-			}
110
-			//show name
111
-			print '<td>'. "\n";
112
-			print '<select name="showName-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
113
-			print '<option value="0">'._('No') .'</option>';
114
-			print '<option value="1">'._('Yes').'</option>';
115
-			print '</td>'. "\n";
116
-
117
-			print '</tr>'. "\n";
118
-		}
119
-		$m++;
120
-	}
121
-
122
-	//submit
123
-	print '<tr style="border-top:1px solid white" class="th">'. "\n";
124
-	print '<td colspan="7" style="text-align:right">'. "\n";
125
-	print '	<input type="submit" class="btn btn-sm btn-default" value="'._('Import to database').'">'. "\n";
126
-	print '</td>'. "\n";
127
-	print '</tr>'. "\n";
128
-
129
-	print '</table>'. "\n";
130
-	print '</form>'. "\n";
41
+    //form
42
+    print '<form name="asImport" id="asImport">';
43
+    //table
44
+    print '<table class="asImport table table-striped table-condensed table-top table-auto">';
45
+    //headers
46
+    print '<tr>';
47
+    print '	<th colspan="5">'._('I found the following routes belonging to AS').' '.$_POST['as'].':</th>';
48
+    print '</tr> ';
49
+
50
+    print "<tr>";
51
+    print "	<th></th>";
52
+    print "	<th>"._('Subnet')."</th>";
53
+    print "	<th>"._('select section')."</th>";
54
+    print "	<th>"._('Description')."</th>";
55
+    print "	<th>"._('VLAN')."</th>";
56
+    print "	<th>"._('VRF')."</th>";
57
+    print "	<th>"._('Show name')."</th>";
58
+
59
+    print "</tr>";
60
+
61
+    //print found subnets
62
+    $m = 0;
63
+    foreach ($subnet as $route) {
64
+        # only not empty
65
+        if(strlen($route)>2) {
66
+            print '<tr>'. "\n";
67
+
68
+            //delete
69
+            print '<td class="removeSubnet">'. "\n";
70
+            print '	<button class="btn btn-xs btn-default btn-danger" rel="tooltip" title="'._('Remove this subnet').'"><i class="fa fa-times"></i></button>'. "\n";
71
+            print '</td>'. "\n";
72
+            //subnet
73
+            print '<td>'. "\n";
74
+            print '<input type="text" class="form-control input-sm" name="subnet-'. $m .'" value="'. $route .'">'. "\n";
75
+            print '</td>'. "\n";
76
+            //section
77
+            print '<td>'. "\n";
78
+            print '<select name="section-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
79
+            foreach($sections as $section) {
80
+                print '<option value="'. $section->id .'">'. $section->name .'</option>';
81
+            }
82
+            print '</select>'. "\n";
83
+            print '</td>'. "\n";
84
+            //description
85
+            print '<td>'. "\n";
86
+            print '<input type="text" class="form-control input-sm input-w-250" name="description-'. $m .'">'. "\n";
87
+            print '</td>'. "\n";
88
+            //VLAN
89
+            print '<td>'. "\n";
90
+            print '<select name="vlan-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
91
+            print '<option value="0">No VLAN</option>';
92
+            if(sizeof(@$vlans)>0) {
93
+                foreach($vlans as $vlan) {
94
+                    # set description
95
+                    $vlan_description = strlen($vlan->description)>0 ? " (".$vlan->description.")" : "";
96
+                    print '<option value="'.$vlan->vlanId.'">'.$vlan->number.$vlan_description.'</option>';
97
+                }
98
+            }
99
+            //VRF
100
+            print '<td>'. "\n";
101
+            print '<select name="vrf-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
102
+            print '<option value="0">No VRF</option>';
103
+            if(sizeof(@$vrfs)>0) {
104
+                foreach($vrfs as $vrf) {
105
+                    # set description
106
+                    $vrf_description = strlen($vrf->description)>0 ? " (".$vrf->description.")" : "";
107
+                    print '<option value="'.$vrf->vrfId.'">'.$vrf->name.$vrf_description.'</option>';
108
+                }
109
+            }
110
+            //show name
111
+            print '<td>'. "\n";
112
+            print '<select name="showName-'. $m .'" class="form-control input-sm input-w-auto">'. "\n";
113
+            print '<option value="0">'._('No') .'</option>';
114
+            print '<option value="1">'._('Yes').'</option>';
115
+            print '</td>'. "\n";
116
+
117
+            print '</tr>'. "\n";
118
+        }
119
+        $m++;
120
+    }
121
+
122
+    //submit
123
+    print '<tr style="border-top:1px solid white" class="th">'. "\n";
124
+    print '<td colspan="7" style="text-align:right">'. "\n";
125
+    print '	<input type="submit" class="btn btn-sm btn-default" value="'._('Import to database').'">'. "\n";
126
+    print '</td>'. "\n";
127
+    print '</tr>'. "\n";
128
+
129
+    print '</table>'. "\n";
130
+    print '</form>'. "\n";
131 131
 }
132 132
 ?>
133 133
 <div class="ripeImportResult"></div>
134 134
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/users/ad-search-result-groups-membership.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -29,52 +29,52 @@
 block discarded – undo
29 29
 
30 30
 //open connection
31 31
 try {
32
-	if($server->type == "NetIQ") { $params->account_suffix = ""; }
33
-	//set options
34
-	$options = array(
35
-			'base_dn'=>$params->base_dn,
36
-			'account_suffix'=>$params->account_suffix,
37
-			'domain_controllers'=>explode(";",$params->domain_controllers),
38
-			'use_ssl'=>$params->use_ssl,
39
-			'use_tls'=>$params->use_tls,
40
-			'ad_port'=>$params->ad_port
41
-			);
42
-	//AD
43
-	$adldap = new adLDAP($options);
32
+    if($server->type == "NetIQ") { $params->account_suffix = ""; }
33
+    //set options
34
+    $options = array(
35
+            'base_dn'=>$params->base_dn,
36
+            'account_suffix'=>$params->account_suffix,
37
+            'domain_controllers'=>explode(";",$params->domain_controllers),
38
+            'use_ssl'=>$params->use_ssl,
39
+            'use_tls'=>$params->use_tls,
40
+            'ad_port'=>$params->ad_port
41
+            );
42
+    //AD
43
+    $adldap = new adLDAP($options);
44 44
 
45
-	//try to login with higher credentials for search
46
-	$authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
47
-	if ($authUser == false) {
48
-		$Result->show("danger", _("Invalid credentials"), true);
49
-	}
45
+    //try to login with higher credentials for search
46
+    $authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
47
+    if ($authUser == false) {
48
+        $Result->show("danger", _("Invalid credentials"), true);
49
+    }
50 50
 
51
-	// set OpenLDAP flag
52
-	if($server->type == "LDAP") { $adldap->setUseOpenLDAP(true); }
51
+    // set OpenLDAP flag
52
+    if($server->type == "LDAP") { $adldap->setUseOpenLDAP(true); }
53 53
 
54
-	//fetch all groups
55
-	$all_groups = $Admin->fetch_all_objects ("userGroups", "g_id");
56
-	if($all_groups !== false) {
57
-		foreach($all_groups as $k=>$g) {
58
-			//members
59
-			$domain_group_members = $adldap->group()->members($g->g_name);
60
-			//false
61
-			if($domain_group_members!==false) {
62
-				foreach($domain_group_members as $m) {
63
-					if($m==$_POST['username']) {
64
-						$membership[] = $g->g_id;
65
-					}
66
-				}
67
-			}
68
-		}
69
-	}
54
+    //fetch all groups
55
+    $all_groups = $Admin->fetch_all_objects ("userGroups", "g_id");
56
+    if($all_groups !== false) {
57
+        foreach($all_groups as $k=>$g) {
58
+            //members
59
+            $domain_group_members = $adldap->group()->members($g->g_name);
60
+            //false
61
+            if($domain_group_members!==false) {
62
+                foreach($domain_group_members as $m) {
63
+                    if($m==$_POST['username']) {
64
+                        $membership[] = $g->g_id;
65
+                    }
66
+                }
67
+            }
68
+        }
69
+    }
70 70
 
71
-	# if something set print it
72
-	if (isset($membership)) {
73
-		print trim(implode(";", array_filter($membership)));
74
-	}
71
+    # if something set print it
72
+    if (isset($membership)) {
73
+        print trim(implode(";", array_filter($membership)));
74
+    }
75 75
 
76 76
 }
77 77
 catch (adLDAPException $e) {
78
-	$Result->show("danger", $e->getMessage(), true);
78
+    $Result->show("danger", $e->getMessage(), true);
79 79
 }
80 80
 ?>
81 81
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/users/ad-search-result.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -32,70 +32,70 @@
 block discarded – undo
32 32
 
33 33
 //open connection
34 34
 try {
35
-	if($server->type == "NetIQ") { $params->account_suffix = ""; }
36
-	//set options
37
-	$options = array(
38
-			'base_dn'=>$params->base_dn,
39
-			'account_suffix'=>$params->account_suffix,
40
-			'domain_controllers'=>explode(";",$params->domain_controllers),
41
-			'use_ssl'=>$params->use_ssl,
42
-			'use_tls'=>$params->use_tls,
43
-			'ad_port'=>$params->ad_port
44
-			);
45
-	//AD
46
-	$adldap = new adLDAP($options);
47
-
48
-	//try to login with higher credentials for search
49
-	$authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
50
-	if ($authUser == false) {
51
-		$Result->show("danger", _("Invalid credentials"), true);
52
-	}
53
-
54
-	// set OpenLDAP flag
55
-	if($server->type == "LDAP") { $adldap->setUseOpenLDAP(true); }
56
-
57
-	//search for domain user!
58
-	$userinfo = $adldap->user()->info("$_POST[dname]*", array("*"),false,$server->type);
59
-
60
-	//echo $adldap->getLastError();
35
+    if($server->type == "NetIQ") { $params->account_suffix = ""; }
36
+    //set options
37
+    $options = array(
38
+            'base_dn'=>$params->base_dn,
39
+            'account_suffix'=>$params->account_suffix,
40
+            'domain_controllers'=>explode(";",$params->domain_controllers),
41
+            'use_ssl'=>$params->use_ssl,
42
+            'use_tls'=>$params->use_tls,
43
+            'ad_port'=>$params->ad_port
44
+            );
45
+    //AD
46
+    $adldap = new adLDAP($options);
47
+
48
+    //try to login with higher credentials for search
49
+    $authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
50
+    if ($authUser == false) {
51
+        $Result->show("danger", _("Invalid credentials"), true);
52
+    }
53
+
54
+    // set OpenLDAP flag
55
+    if($server->type == "LDAP") { $adldap->setUseOpenLDAP(true); }
56
+
57
+    //search for domain user!
58
+    $userinfo = $adldap->user()->info("$_POST[dname]*", array("*"),false,$server->type);
59
+
60
+    //echo $adldap->getLastError();
61 61
 }
62 62
 catch (adLDAPException $e) {
63
-	$Result->show("danger", $e->getMessage(), true);
63
+    $Result->show("danger", $e->getMessage(), true);
64 64
 }
65 65
 
66 66
 
67 67
 //check for found
68 68
 if(!isset($userinfo['count'])) {
69
-	print "<div class='alert alert-info'>";
70
-	print _('No users found')."!<hr>";
71
-	print _('Possible reasons').":";
72
-	print "<ul>";
73
-	print "<li>"._('Username not existing')."</li>";
74
-	print "<li>"._('Invalid baseDN setting for AD')."</li>";
75
-	print "<li>"._('AD account does not have enough privileges for search')."</li>";
76
-	print "</div>";
69
+    print "<div class='alert alert-info'>";
70
+    print _('No users found')."!<hr>";
71
+    print _('Possible reasons').":";
72
+    print "<ul>";
73
+    print "<li>"._('Username not existing')."</li>";
74
+    print "<li>"._('Invalid baseDN setting for AD')."</li>";
75
+    print "<li>"._('AD account does not have enough privileges for search')."</li>";
76
+    print "</div>";
77 77
 } else {
78
-	print _(" Following users were found").": ($userinfo[count]):<hr>";
79
-
80
-	print "<table class='table table-striped'>";
81
-
82
-	unset($userinfo['count']);
83
-	if(sizeof(@$userinfo)>0 && isset($userinfo)) {
84
-		// loop
85
-		foreach($userinfo as $u) {
86
-			print "<tr>";
87
-			print "	<td>".$u['displayname'][0];
88
-			print "</td>";
89
-			print "	<td>".$u['samaccountname'][0]."</td>";
90
-			print "	<td>".$u['mail'][0]."</td>";
91
-			//actions
92
-			print " <td style='width:10px;'>";
93
-			print "		<a href='' class='btn btn-sm btn-default btn-success userselect' data-uname='".$u['displayname'][0]."' data-username='".$u['samaccountname'][0]."' data-email='".$u['mail'][0]."' data-server='".$_POST['server']."' data-server-type='".$server->type."'>"._('Select')."</a>";
94
-			print "	</td>";
95
-			print "</tr>";
96
-		}
97
-	}
98
-	print "</table>";
78
+    print _(" Following users were found").": ($userinfo[count]):<hr>";
79
+
80
+    print "<table class='table table-striped'>";
81
+
82
+    unset($userinfo['count']);
83
+    if(sizeof(@$userinfo)>0 && isset($userinfo)) {
84
+        // loop
85
+        foreach($userinfo as $u) {
86
+            print "<tr>";
87
+            print "	<td>".$u['displayname'][0];
88
+            print "</td>";
89
+            print "	<td>".$u['samaccountname'][0]."</td>";
90
+            print "	<td>".$u['mail'][0]."</td>";
91
+            //actions
92
+            print " <td style='width:10px;'>";
93
+            print "		<a href='' class='btn btn-sm btn-default btn-success userselect' data-uname='".$u['displayname'][0]."' data-username='".$u['samaccountname'][0]."' data-email='".$u['mail'][0]."' data-server='".$_POST['server']."' data-server-type='".$server->type."'>"._('Select')."</a>";
94
+            print "	</td>";
95
+            print "</tr>";
96
+        }
97
+    }
98
+    print "</table>";
99 99
 }
100 100
 
101 101
 ?>
102 102
\ No newline at end of file
Please login to merge, or discard this patch.