Completed
Pull Request — master (#532)
06:37
created
app/admin/groups/remove-users-result.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,38 +22,38 @@
 block discarded – undo
22 22
 
23 23
 # parse result
24 24
 foreach($_POST as $k=>$p) {
25
-	if(substr($k, 0,4) == "user") {
26
-		$users[substr($k, 4)] = substr($k, 4);
27
-	}
25
+    if(substr($k, 0,4) == "user") {
26
+        $users[substr($k, 4)] = substr($k, 4);
27
+    }
28 28
 }
29 29
 
30 30
 # remove each user from group
31 31
 if(sizeof($users)>0) {
32
-	foreach($users as $key=>$u) {
33
-		if(!$Admin->remove_group_from_user($_POST['gid'], $u)) {
34
-			# get user details
35
-			$user = $Admin->fetch_object("users", "id", $u);
36
-			$errors[] = $user->real_name;
37
-		}
38
-	}
32
+    foreach($users as $key=>$u) {
33
+        if(!$Admin->remove_group_from_user($_POST['gid'], $u)) {
34
+            # get user details
35
+            $user = $Admin->fetch_object("users", "id", $u);
36
+            $errors[] = $user->real_name;
37
+        }
38
+    }
39 39
 }
40 40
 else {
41
-	$errors[] = _("Please select user(s) to remove from group!");
41
+    $errors[] = _("Please select user(s) to remove from group!");
42 42
 }
43 43
 
44 44
 # print result
45 45
 if(isset($errors)) {
46
-	print "<div class='alert alert alert-danger'>";
47
-	print _("Failed to remove users").":<hr>";
48
-	print "<ul>";
49
-	foreach($errors as $e) {
50
-		print "<li>$e</li>";
51
-	}
52
-	print "</ul>";
53
-	print "</div>";
46
+    print "<div class='alert alert alert-danger'>";
47
+    print _("Failed to remove users").":<hr>";
48
+    print "<ul>";
49
+    foreach($errors as $e) {
50
+        print "<li>$e</li>";
51
+    }
52
+    print "</ul>";
53
+    print "</div>";
54 54
 }
55 55
 else {
56
-	$Result->show("success", _('Users removed from group'), true);
56
+    $Result->show("success", _('Users removed from group'), true);
57 57
 }
58 58
 
59 59
 ?>
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,55 +5,55 @@
 block discarded – undo
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 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 
20 20
 # id must be numeric
21
-if(!is_numeric($_POST['gid']))		{ $Result->show("danger", _("Invalid ID"), true); }
21
+if (!is_numeric ($_POST['gid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
22 22
 
23 23
 # parse result
24
-foreach($_POST as $k=>$p) {
25
-	if(substr($k, 0,4) == "user") {
26
-		$users[substr($k, 4)] = substr($k, 4);
24
+foreach ($_POST as $k=>$p) {
25
+	if (substr ($k, 0, 4) == "user") {
26
+		$users[substr ($k, 4)] = substr ($k, 4);
27 27
 	}
28 28
 }
29 29
 
30 30
 # remove each user from group
31
-if(sizeof($users)>0) {
32
-	foreach($users as $key=>$u) {
33
-		if(!$Admin->remove_group_from_user($_POST['gid'], $u)) {
31
+if (sizeof ($users) > 0) {
32
+	foreach ($users as $key=>$u) {
33
+		if (!$Admin->remove_group_from_user ($_POST['gid'], $u)) {
34 34
 			# get user details
35
-			$user = $Admin->fetch_object("users", "id", $u);
35
+			$user = $Admin->fetch_object ("users", "id", $u);
36 36
 			$errors[] = $user->real_name;
37 37
 		}
38 38
 	}
39 39
 }
40 40
 else {
41
-	$errors[] = _("Please select user(s) to remove from group!");
41
+	$errors[] = _ ("Please select user(s) to remove from group!");
42 42
 }
43 43
 
44 44
 # print result
45
-if(isset($errors)) {
45
+if (isset($errors)) {
46 46
 	print "<div class='alert alert alert-danger'>";
47
-	print _("Failed to remove users").":<hr>";
47
+	print _ ("Failed to remove users").":<hr>";
48 48
 	print "<ul>";
49
-	foreach($errors as $e) {
49
+	foreach ($errors as $e) {
50 50
 		print "<li>$e</li>";
51 51
 	}
52 52
 	print "</ul>";
53 53
 	print "</div>";
54 54
 }
55 55
 else {
56
-	$Result->show("success", _('Users removed from group'), true);
56
+	$Result->show ("success", _ ('Users removed from group'), true);
57 57
 }
58 58
 
59 59
 ?>
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/groups/remove-users.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -49,24 +49,24 @@
 block discarded – undo
49 49
 	</tr>
50 50
 
51 51
 	<?php
52
-	# show existing
53
-	foreach($existing as $m) {
54
-		# get user details
55
-		$u = (array) $Admin->fetch_object("users", "id", $m);
52
+    # show existing
53
+    foreach($existing as $m) {
54
+        # get user details
55
+        $u = (array) $Admin->fetch_object("users", "id", $m);
56 56
 
57
-		print "<tr>";
57
+        print "<tr>";
58 58
 
59
-		print "	<td>";
60
-		print "	<input type='checkbox' name='user$u[id]'>";
61
-		print "	</td>";
59
+        print "	<td>";
60
+        print "	<input type='checkbox' name='user$u[id]'>";
61
+        print "	</td>";
62 62
 
63
-		print "	<td>$u[real_name]</td>";
64
-		print "	<td>$u[username]</td>";
65
-		print "	<td>$u[email]</td>";
63
+        print "	<td>$u[real_name]</td>";
64
+        print "	<td>$u[username]</td>";
65
+        print "	<td>$u[email]</td>";
66 66
 
67
-		print "</tr>";
68
-	}
69
-	?>
67
+        print "</tr>";
68
+    }
69
+    ?>
70 70
 
71 71
     </table>
72 72
     </form>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
     </table>
72 72
     </form>
73 73
 
74
-    <?php } else { $Result->show("info", _('No users in this group'), false);  } ?>
74
+    <?php }
75
+else { $Result->show("info", _('No users in this group'), false);  } ?>
75 76
 </div>
76 77
 
77 78
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@  discard block
 block discarded – undo
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 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 
20 20
 # id must be numeric
21
-if(!is_numeric($_POST['g_id']))		{ $Result->show("danger", _("Invalid ID"), true, true); }
21
+if (!is_numeric ($_POST['g_id'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
22 22
 
23 23
 # get group details
24
-$group   = $Admin->fetch_object("userGroups", "g_id", $_POST['g_id']);
24
+$group = $Admin->fetch_object ("userGroups", "g_id", $_POST['g_id']);
25 25
 # users in group - array of ids
26 26
 $existing = $Admin->group_fetch_users ($_POST['g_id']);
27 27
 ?>
28 28
 
29 29
 
30 30
 <!-- header -->
31
-<div class="pHeader"><?php print _('Remove users from group'); ?> <?php print $group->g_name; ?></div>
31
+<div class="pHeader"><?php print _ ('Remove users from group'); ?> <?php print $group->g_name; ?></div>
32 32
 
33 33
 
34 34
 <!-- content -->
35 35
 <div class="pContent">
36 36
 
37
-	<?php if(sizeof($existing) > 0) { ?>
37
+	<?php if (sizeof ($existing) > 0) { ?>
38 38
 
39 39
 	<form id="groupRemoveUsers" name="groupRemoveUsers">
40 40
 	<table class="groupEdit table table-condensed table-top">
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		<th>
44 44
 			<input type="hidden" name="gid" value="<?php print $_POST['g_id']; ?>">
45 45
 		</th>
46
-		<th><?php print _('Name'); ?></th>
47
-		<th><?php print _('Username'); ?></th>
48
-		<th><?php print _('Email'); ?></th>
46
+		<th><?php print _ ('Name'); ?></th>
47
+		<th><?php print _ ('Username'); ?></th>
48
+		<th><?php print _ ('Email'); ?></th>
49 49
 	</tr>
50 50
 
51 51
 	<?php
52 52
 	# show existing
53
-	foreach($existing as $m) {
53
+	foreach ($existing as $m) {
54 54
 		# get user details
55
-		$u = (array) $Admin->fetch_object("users", "id", $m);
55
+		$u = (array) $Admin->fetch_object ("users", "id", $m);
56 56
 
57 57
 		print "<tr>";
58 58
 
@@ -71,16 +71,16 @@  discard block
 block discarded – undo
71 71
     </table>
72 72
     </form>
73 73
 
74
-    <?php } else { $Result->show("info", _('No users in this group'), false);  } ?>
74
+    <?php } else { $Result->show ("info", _ ('No users in this group'), false); } ?>
75 75
 </div>
76 76
 
77 77
 
78 78
 <!-- footer -->
79 79
 <div class="pFooter">
80 80
 	<div class="btn-group">
81
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
82
-		<?php if(sizeof($existing) > 0) { ?>
83
-		<button class="btn btn-sm btn-default btn-success" id="groupRemoveUsersSubmit"><i class="fa fa-minus"></i> <?php print _('Remove selected users'); ?></button>
81
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
82
+		<?php if (sizeof ($existing) > 0) { ?>
83
+		<button class="btn btn-sm btn-default btn-success" id="groupRemoveUsersSubmit"><i class="fa fa-minus"></i> <?php print _ ('Remove selected users'); ?></button>
84 84
 		<?php } ?>
85 85
 	</div>
86 86
 
Please login to merge, or discard this patch.
app/admin/groups/edit-group-result.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
 # remove users from this group if delete and remove group from sections
28 28
 if($_POST['action'] == "delete") {
29
-	$Admin->remove_group_from_users($_POST['g_id']);
30
-	$Admin->remove_group_from_sections($_POST['g_id']);
29
+    $Admin->remove_group_from_users($_POST['g_id']);
30
+    $Admin->remove_group_from_sections($_POST['g_id']);
31 31
 }
32 32
 else {
33
-	if(strlen($_POST['g_name']) < 2)										{ $Result->show("danger", _('Name must be at least 2 characters long')."!", true); }
33
+    if(strlen($_POST['g_name']) < 2)										{ $Result->show("danger", _('Name must be at least 2 characters long')."!", true); }
34 34
 }
35 35
 
36 36
 # unique name
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
 # create array of values for modification
42 42
 $values = array("g_id"=>@$_POST['g_id'],
43
-				"g_name"=>$_POST['g_name'],
44
-				"g_desc"=>@$_POST['g_desc']);
43
+                "g_name"=>$_POST['g_name'],
44
+                "g_desc"=>@$_POST['g_desc']);
45 45
 
46 46
 /* try to execute */
47 47
 if(!$Admin->object_modify("userGroups", $_POST['action'], "g_id", $values)) { $Result->show("danger",  _("Group $_POST[action] error")."!", false); }
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 
50 50
 # from list of usernames provided from AD result if some user matches add him to group
51 51
 if (strlen($_POST['gmembers'])>0) {
52
-	// save id
53
-	$gid = $Admin->lastId;
54
-	// to array
55
-	$gmembers = explode(";", $_POST['gmembers']);
56
-	// check
57
-	foreach ($gmembers as $gm) {
58
-		// check if user exists
59
-		$user=$Admin->fetch_object("users","username",$gm);
60
-		if ($user!==false) {
61
-			// add to group
62
-			$Admin->add_group_to_user ($gid, $user->id);
63
-		}
64
-	}
52
+    // save id
53
+    $gid = $Admin->lastId;
54
+    // to array
55
+    $gmembers = explode(";", $_POST['gmembers']);
56
+    // check
57
+    foreach ($gmembers as $gm) {
58
+        // check if user exists
59
+        $user=$Admin->fetch_object("users","username",$gm);
60
+        if ($user!==false) {
61
+            // add to group
62
+            $Admin->add_group_to_user ($gid, $user->id);
63
+        }
64
+    }
65 65
 }
66 66
 
67 67
 ?>
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,58 +6,58 @@
 block discarded – undo
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 user object
12
-$Database 	= new Database_PDO;
13
-$User 		= new User ($Database);
12
+$Database = new Database_PDO;
13
+$User = new User ($Database);
14 14
 $Admin	 	= new Admin ($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
 # strip input tags
21
-$_POST = $Admin->strip_input_tags($_POST);
21
+$_POST = $Admin->strip_input_tags ($_POST);
22 22
 
23 23
 # validate csrf cookie
24
-$User->csrf_cookie ("validate", "group", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : "";
24
+$User->csrf_cookie ("validate", "group", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : "";
25 25
 
26 26
 
27 27
 # remove users from this group if delete and remove group from sections
28
-if($_POST['action'] == "delete") {
29
-	$Admin->remove_group_from_users($_POST['g_id']);
30
-	$Admin->remove_group_from_sections($_POST['g_id']);
28
+if ($_POST['action'] == "delete") {
29
+	$Admin->remove_group_from_users ($_POST['g_id']);
30
+	$Admin->remove_group_from_sections ($_POST['g_id']);
31 31
 }
32 32
 else {
33
-	if(strlen($_POST['g_name']) < 2)										{ $Result->show("danger", _('Name must be at least 2 characters long')."!", true); }
33
+	if (strlen ($_POST['g_name']) < 2) { $Result->show ("danger", _ ('Name must be at least 2 characters long')."!", true); }
34 34
 }
35 35
 
36 36
 # unique name
37
-if($_POST['action']=="add") {
38
-if($Admin->fetch_object("userGroups", "g_name", $_POST['g_name'])!==false)	{ $Result->show("danger", _('Group already exists')."!", true); }
37
+if ($_POST['action'] == "add") {
38
+if ($Admin->fetch_object ("userGroups", "g_name", $_POST['g_name']) !== false) { $Result->show ("danger", _ ('Group already exists')."!", true); }
39 39
 }
40 40
 
41 41
 # create array of values for modification
42
-$values = array("g_id"=>@$_POST['g_id'],
42
+$values = array ("g_id"=>@$_POST['g_id'],
43 43
 				"g_name"=>$_POST['g_name'],
44 44
 				"g_desc"=>@$_POST['g_desc']);
45 45
 
46 46
 /* try to execute */
47
-if(!$Admin->object_modify("userGroups", $_POST['action'], "g_id", $values)) { $Result->show("danger",  _("Group $_POST[action] error")."!", false); }
48
-else 					 													{ $Result->show("success", _("Group $_POST[action] success")."!", false); }
47
+if (!$Admin->object_modify ("userGroups", $_POST['action'], "g_id", $values)) { $Result->show ("danger", _ ("Group $_POST[action] error")."!", false); }
48
+else { $Result->show ("success", _ ("Group $_POST[action] success")."!", false); }
49 49
 
50 50
 # from list of usernames provided from AD result if some user matches add him to group
51
-if (strlen($_POST['gmembers'])>0) {
51
+if (strlen ($_POST['gmembers']) > 0) {
52 52
 	// save id
53 53
 	$gid = $Admin->lastId;
54 54
 	// to array
55
-	$gmembers = explode(";", $_POST['gmembers']);
55
+	$gmembers = explode (";", $_POST['gmembers']);
56 56
 	// check
57 57
 	foreach ($gmembers as $gm) {
58 58
 		// check if user exists
59
-		$user=$Admin->fetch_object("users","username",$gm);
60
-		if ($user!==false) {
59
+		$user = $Admin->fetch_object ("users", "username", $gm);
60
+		if ($user !== false) {
61 61
 			// add to group
62 62
 			$Admin->add_group_to_user ($gid, $user->id);
63 63
 		}
Please login to merge, or discard this patch.
app/admin/groups/edit-group.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@
 block discarded – undo
21 21
 
22 22
 # fetch group and set title
23 23
 if($_POST['action']=="add") {
24
-	$title = _('Add new group');
24
+    $title = _('Add new group');
25 25
 } else {
26
-	//fetch all group details
26
+    //fetch all group details
27 27
     $group = (array) $Admin->fetch_object("userGroups", "g_id", $_POST['id']);
28 28
     //false die
29 29
     $group!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
30 30
 
31
-	$title = ucwords($_POST['action']) .' '._('group').' '.$group['g_name'];
31
+    $title = ucwords($_POST['action']) .' '._('group').' '.$group['g_name'];
32 32
 }
33 33
 ?>
34 34
 
Please login to merge, or discard this patch.
Braces   +14 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
 # fetch group and set title
23 23
 if($_POST['action']=="add") {
24 24
 	$title = _('Add new group');
25
-} else {
25
+}
26
+else {
26 27
 	//fetch all group details
27 28
     $group = (array) $Admin->fetch_object("userGroups", "g_id", $_POST['id']);
28 29
     //false die
@@ -44,7 +45,10 @@  discard block
 block discarded – undo
44 45
 	<!-- name -->
45 46
 	<tr>
46 47
 	    <td><?php print _('Group name'); ?></td>
47
-	    <td><input type="text" name="g_name" class="form-control input-sm" value="<?php print @$group['g_name']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
48
+	    <td><input type="text" name="g_name" class="form-control input-sm" value="<?php print @$group['g_name']; ?>" <?php if($_POST['action'] == "delete") {
49
+    print "readonly";
50
+}
51
+?>></td>
48 52
        	<td class="info2">
49 53
 	   		<?php print _('Enter group name'); ?>
50 54
        	</td>
@@ -54,7 +58,10 @@  discard block
 block discarded – undo
54 58
     <tr>
55 59
     	<td><?php print _('Description'); ?></td>
56 60
     	<td>
57
-    		<input type="text" name="g_desc" class="form-control input-sm" value="<?php print @$group['g_desc']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>>
61
+    		<input type="text" name="g_desc" class="form-control input-sm" value="<?php print @$group['g_desc']; ?>" <?php if($_POST['action'] == "delete") {
62
+    print "readonly";
63
+}
64
+?>>
58 65
 
59 66
     		<input type="hidden" name="g_id" value="<?php print $_POST['id']; ?>">
60 67
     		<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
@@ -73,7 +80,10 @@  discard block
 block discarded – undo
73 80
 <div class="pFooter">
74 81
 	<div class="btn-group">
75 82
 		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
76
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editGroupSubmit"><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>
83
+		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; }
84
+else { print "btn-success"; } ?>" id="editGroupSubmit"><i class="fa <?php if($_POST['action']=="add") { print "fa-plus"; }
85
+else if ($_POST['action']=="delete") { print "fa-trash-o"; }
86
+else { print "fa-check"; } ?>"></i> <?php print ucwords(_($_POST['action'])); ?></button>
77 87
 	</div>
78 88
 
79 89
 	<!-- Result -->
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,30 +5,30 @@  discard block
 block discarded – undo
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 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 # create csrf token
20 20
 $csrf = $User->csrf_cookie ("create", "group");
21 21
 
22 22
 # fetch group and set title
23
-if($_POST['action']=="add") {
24
-	$title = _('Add new group');
23
+if ($_POST['action'] == "add") {
24
+	$title = _ ('Add new group');
25 25
 } else {
26 26
 	//fetch all group details
27
-    $group = (array) $Admin->fetch_object("userGroups", "g_id", $_POST['id']);
27
+    $group = (array) $Admin->fetch_object ("userGroups", "g_id", $_POST['id']);
28 28
     //false die
29
-    $group!==false ? : $Result->show("danger", _("Invalid ID"), true, true);
29
+    $group !== false ? : $Result->show ("danger", _ ("Invalid ID"), true, true);
30 30
 
31
-	$title = ucwords($_POST['action']) .' '._('group').' '.$group['g_name'];
31
+	$title = ucwords ($_POST['action']).' '._ ('group').' '.$group['g_name'];
32 32
 }
33 33
 ?>
34 34
 
@@ -43,24 +43,24 @@  discard block
 block discarded – undo
43 43
 
44 44
 	<!-- name -->
45 45
 	<tr>
46
-	    <td><?php print _('Group name'); ?></td>
47
-	    <td><input type="text" name="g_name" class="form-control input-sm" value="<?php print @$group['g_name']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>></td>
46
+	    <td><?php print _ ('Group name'); ?></td>
47
+	    <td><input type="text" name="g_name" class="form-control input-sm" value="<?php print @$group['g_name']; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>></td>
48 48
        	<td class="info2">
49
-	   		<?php print _('Enter group name'); ?>
49
+	   		<?php print _ ('Enter group name'); ?>
50 50
        	</td>
51 51
     </tr>
52 52
 
53 53
     <!-- description -->
54 54
     <tr>
55
-    	<td><?php print _('Description'); ?></td>
55
+    	<td><?php print _ ('Description'); ?></td>
56 56
     	<td>
57
-    		<input type="text" name="g_desc" class="form-control input-sm" value="<?php print @$group['g_desc']; ?>" <?php if($_POST['action'] == "delete") print "readonly"; ?>>
57
+    		<input type="text" name="g_desc" class="form-control input-sm" value="<?php print @$group['g_desc']; ?>" <?php if ($_POST['action'] == "delete") print "readonly"; ?>>
58 58
 
59 59
     		<input type="hidden" name="g_id" value="<?php print $_POST['id']; ?>">
60 60
     		<input type="hidden" name="action" value="<?php print $_POST['action']; ?>">
61 61
     		<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
62 62
     	</td>
63
-    	<td class="info2"><?php print _('Enter description'); ?></td>
63
+    	<td class="info2"><?php print _ ('Enter description'); ?></td>
64 64
     </tr>
65 65
 
66 66
 </table>
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 <!-- footer -->
73 73
 <div class="pFooter">
74 74
 	<div class="btn-group">
75
-		<button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button>
76
-		<button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editGroupSubmit"><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>
75
+		<button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button>
76
+		<button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editGroupSubmit"><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>
77 77
 	</div>
78 78
 
79 79
 	<!-- Result -->
Please login to merge, or discard this patch.
app/admin/groups/ad-search-group-result.php 3 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 if ($server->type == "LDAP") {
32 32
 
33
-	// Just discovered that adLDAP flat out won't work for normal ldap groups. Stop LDAP here.
34
-	$Result->show("danger", _("Only AD group search is supported right now. Sorry."), true);
35
-	return;
33
+    // Just discovered that adLDAP flat out won't work for normal ldap groups. Stop LDAP here.
34
+    $Result->show("danger", _("Only AD group search is supported right now. Sorry."), true);
35
+    return;
36 36
 
37 37
 }
38 38
 
@@ -44,87 +44,87 @@  discard block
 block discarded – undo
44 44
 
45 45
 //open connection
46 46
 try {
47
-	if($server->type == "NetIQ" || $server->type == "LDAP") { $params->account_suffix = ""; }
48
-	//set options
49
-	$options = array(
50
-			'base_dn'=>$params->base_dn,
51
-			'account_suffix'=>$params->account_suffix,
52
-			'domain_controllers'=>explode(";",$params->domain_controllers),
53
-			'use_ssl'=>$params->use_ssl,
54
-			'use_tls'=>$params->use_tls,
55
-			'ad_port'=>$params->ad_port
56
-			);
57
-	//AD
58
-	$adldap = new adLDAP($options);
59
-
60
-	// Use credentials if they've been provided
61
-	if (isset($params->adminUsername) && isset($params->adminPassword)) {
62
-		$authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
63
-		if ($authUser == false) {
64
-			$Result->show("danger", _("Invalid credentials"), true);
65
-		}
66
-	}
67
-
68
-	//search groups
69
-	$groups = $adldap->group()->search(adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP,true,"*$_POST[dfilter]*");
70
-
71
-	//echo $adldap->getLastError();
47
+    if($server->type == "NetIQ" || $server->type == "LDAP") { $params->account_suffix = ""; }
48
+    //set options
49
+    $options = array(
50
+            'base_dn'=>$params->base_dn,
51
+            'account_suffix'=>$params->account_suffix,
52
+            'domain_controllers'=>explode(";",$params->domain_controllers),
53
+            'use_ssl'=>$params->use_ssl,
54
+            'use_tls'=>$params->use_tls,
55
+            'ad_port'=>$params->ad_port
56
+            );
57
+    //AD
58
+    $adldap = new adLDAP($options);
59
+
60
+    // Use credentials if they've been provided
61
+    if (isset($params->adminUsername) && isset($params->adminPassword)) {
62
+        $authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
63
+        if ($authUser == false) {
64
+            $Result->show("danger", _("Invalid credentials"), true);
65
+        }
66
+    }
67
+
68
+    //search groups
69
+    $groups = $adldap->group()->search(adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP,true,"*$_POST[dfilter]*");
70
+
71
+    //echo $adldap->getLastError();
72 72
 }
73 73
 catch (adLDAPException $e) {
74
-	$Result->show("danger", $adldap->getLastError(), false);
75
-	$Result->show("danger", $e->getMessage(), true);
74
+    $Result->show("danger", $adldap->getLastError(), false);
75
+    $Result->show("danger", $e->getMessage(), true);
76 76
 }
77 77
 
78 78
 
79 79
 //check for found
80 80
 if(sizeof($groups)==0) {
81
-	print "<div class='alert alert-info'>";
82
-	print _('No groups found')."!<hr>";
83
-	print _('Possible reasons').":";
84
-	print "<ul>";
85
-	print "<li>"._('Invalid baseDN setting for ' . $server->type)."</li>";
86
-	print "<li>"._($server->type . ' account does not have enough privileges for search')."</li>";
87
-	print "</div>";
81
+    print "<div class='alert alert-info'>";
82
+    print _('No groups found')."!<hr>";
83
+    print _('Possible reasons').":";
84
+    print "<ul>";
85
+    print "<li>"._('Invalid baseDN setting for ' . $server->type)."</li>";
86
+    print "<li>"._($server->type . ' account does not have enough privileges for search')."</li>";
87
+    print "</div>";
88 88
 } else {
89
-	print _(" Following groups were found").": (".sizeof($groups)."):<hr>";
90
-
91
-	print "<table class='table table-top table-td-top  table-striped'>";
92
-
93
-	// loop
94
- 	foreach($groups as $k=>$g) {
95
-		print "<tr>";
96
-		print "	<td>$k</td>";
97
-		print "	<td>$g</td>";
98
-		//actions
99
-		print " <td style='width:10px;'>";
100
-		print "		<a href='' class='btn btn-sm btn-default btn-success groupselect' data-gname='$k' data-gdescription='$g' data-members='$members' data-gid='$k' data-csrf_cookie='$csrf'>"._('Add group')."</a>";
101
-		print "	</td>";
102
-		print "</tr>";
103
-
104
-		print "<tr>";
105
-		print "	<td>"._("Members:")."</td>";
106
-		print "<td colspan='2'>";
107
-		print "	<div class='adgroup-$k'></div>";
108
-		// search members
109
-		$groupMembers = $adldap->group()->members($k);
110
-		unset($members);
111
-		if($groupMembers!==false) {
112
-			foreach($groupMembers as $m) {
113
-				print "<span class='muted'>$m</span><br>";
114
-				$members[] = $m;
115
-			}
116
-			if(isset($members))
117
-			$members = implode(";", $members);
118
-		}
119
-		else {
120
-			$members = "";
121
-			print "<span class='muted'>"._("No members")."</span>";
122
-		}
123
-		print "	</td>";
124
-		print "	</tr>";
125
-
126
-	}
127
-	print "</table>";
89
+    print _(" Following groups were found").": (".sizeof($groups)."):<hr>";
90
+
91
+    print "<table class='table table-top table-td-top  table-striped'>";
92
+
93
+    // loop
94
+        foreach($groups as $k=>$g) {
95
+        print "<tr>";
96
+        print "	<td>$k</td>";
97
+        print "	<td>$g</td>";
98
+        //actions
99
+        print " <td style='width:10px;'>";
100
+        print "		<a href='' class='btn btn-sm btn-default btn-success groupselect' data-gname='$k' data-gdescription='$g' data-members='$members' data-gid='$k' data-csrf_cookie='$csrf'>"._('Add group')."</a>";
101
+        print "	</td>";
102
+        print "</tr>";
103
+
104
+        print "<tr>";
105
+        print "	<td>"._("Members:")."</td>";
106
+        print "<td colspan='2'>";
107
+        print "	<div class='adgroup-$k'></div>";
108
+        // search members
109
+        $groupMembers = $adldap->group()->members($k);
110
+        unset($members);
111
+        if($groupMembers!==false) {
112
+            foreach($groupMembers as $m) {
113
+                print "<span class='muted'>$m</span><br>";
114
+                $members[] = $m;
115
+            }
116
+            if(isset($members))
117
+            $members = implode(";", $members);
118
+        }
119
+        else {
120
+            $members = "";
121
+            print "<span class='muted'>"._("No members")."</span>";
122
+        }
123
+        print "	</td>";
124
+        print "	</tr>";
125
+
126
+    }
127
+    print "</table>";
128 128
 }
129 129
 
130 130
 ?>
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,8 +69,7 @@  discard block
 block discarded – undo
69 69
 	$groups = $adldap->group()->search(adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP,true,"*$_POST[dfilter]*");
70 70
 
71 71
 	//echo $adldap->getLastError();
72
-}
73
-catch (adLDAPException $e) {
72
+} catch (adLDAPException $e) {
74 73
 	$Result->show("danger", $adldap->getLastError(), false);
75 74
 	$Result->show("danger", $e->getMessage(), true);
76 75
 }
@@ -85,7 +84,8 @@  discard block
 block discarded – undo
85 84
 	print "<li>"._('Invalid baseDN setting for ' . $server->type)."</li>";
86 85
 	print "<li>"._($server->type . ' account does not have enough privileges for search')."</li>";
87 86
 	print "</div>";
88
-} else {
87
+}
88
+else {
89 89
 	print _(" Following groups were found").": (".sizeof($groups)."):<hr>";
90 90
 
91 91
 	print "<table class='table table-top table-td-top  table-striped'>";
@@ -113,8 +113,9 @@  discard block
 block discarded – undo
113 113
 				print "<span class='muted'>$m</span><br>";
114 114
 				$members[] = $m;
115 115
 			}
116
-			if(isset($members))
117
-			$members = implode(";", $members);
116
+			if(isset($members)) {
117
+						$members = implode(";", $members);
118
+			}
118 119
 		}
119 120
 		else {
120 121
 			$members = "";
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -5,119 +5,119 @@
 block discarded – undo
5 5
  *************************************/
6 6
 
7 7
 /* functions */
8
-require( dirname(__FILE__) . '/../../../functions/functions.php');
9
-require( dirname(__FILE__) . "/../../../functions/adLDAP/src/adLDAP.php");
8
+require(dirname (__FILE__).'/../../../functions/functions.php');
9
+require(dirname (__FILE__)."/../../../functions/adLDAP/src/adLDAP.php");
10 10
 
11 11
 # initialize user object
12
-$Database 	= new Database_PDO;
13
-$User 		= new User ($Database);
12
+$Database = new Database_PDO;
13
+$User = new User ($Database);
14 14
 $Admin	 	= new Admin ($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
 # fetch server
21
-$server = $Admin->fetch_object("usersAuthMethod", "id", $_POST['server']);
22
-$server!==false ? : $Result->show("danger", _("Invalid server ID"), true);
21
+$server = $Admin->fetch_object ("usersAuthMethod", "id", $_POST['server']);
22
+$server !== false ? : $Result->show ("danger", _ ("Invalid server ID"), true);
23 23
 
24 24
 # create csrf token
25 25
 $csrf = $User->csrf_cookie ("create", "group");
26 26
 
27 27
 //parse parameters
28
-$params = json_decode($server->params);
28
+$params = json_decode ($server->params);
29 29
 
30 30
 if ($server->type == "LDAP") {
31 31
 
32 32
 	// Just discovered that adLDAP flat out won't work for normal ldap groups. Stop LDAP here.
33
-	$Result->show("danger", _("Only AD group search is supported right now. Sorry."), true);
33
+	$Result->show ("danger", _ ("Only AD group search is supported right now. Sorry."), true);
34 34
 	return;
35 35
 
36 36
 }
37 37
 
38 38
 //no login parameters
39
-if(strlen(@$params->adminUsername)==0 || strlen(@$params->adminPassword)==0)	{ $Result->show("danger", _("Missing credentials"), true); }
39
+if (strlen (@$params->adminUsername) == 0 || strlen (@$params->adminPassword) == 0) { $Result->show ("danger", _ ("Missing credentials"), true); }
40 40
 //at least 2 chars
41
-if(strlen($_POST['dfilter'])<2) 												{ $Result->show("danger", _('Please enter at least 2 characters'), true); }
41
+if (strlen ($_POST['dfilter']) < 2) { $Result->show ("danger", _ ('Please enter at least 2 characters'), true); }
42 42
 
43 43
 
44 44
 //open connection
45 45
 try {
46
-	if($server->type == "NetIQ" || $server->type == "LDAP") { $params->account_suffix = ""; }
46
+	if ($server->type == "NetIQ" || $server->type == "LDAP") { $params->account_suffix = ""; }
47 47
 	//set options
48
-	$options = array(
48
+	$options = array (
49 49
 			'base_dn'=>$params->base_dn,
50 50
 			'account_suffix'=>$params->account_suffix,
51
-			'domain_controllers'=>explode(";",$params->domain_controllers),
51
+			'domain_controllers'=>explode (";", $params->domain_controllers),
52 52
 			'use_ssl'=>$params->use_ssl,
53 53
 			'use_tls'=>$params->use_tls,
54 54
 			'ad_port'=>$params->ad_port
55 55
 			);
56 56
 	//AD
57
-	$adldap = new adLDAP($options);
57
+	$adldap = new adLDAP ($options);
58 58
 
59 59
 	// Use credentials if they've been provided
60 60
 	if (isset($params->adminUsername) && isset($params->adminPassword)) {
61
-		$authUser = $adldap->authenticate($params->adminUsername, $params->adminPassword);
61
+		$authUser = $adldap->authenticate ($params->adminUsername, $params->adminPassword);
62 62
 		if ($authUser == false) {
63
-			$Result->show("danger", _("Invalid credentials"), true);
63
+			$Result->show ("danger", _ ("Invalid credentials"), true);
64 64
 		}
65 65
 	}
66 66
 
67 67
 	//search groups
68
-	$groups = $adldap->group()->search(adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP,true,"*$_POST[dfilter]*");
68
+	$groups = $adldap->group ()->search (adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP, true, "*$_POST[dfilter]*");
69 69
 
70 70
 	//echo $adldap->getLastError();
71 71
 }
72 72
 catch (adLDAPException $e) {
73
-	$Result->show("danger", $adldap->getLastError(), false);
74
-	$Result->show("danger", $e->getMessage(), true);
73
+	$Result->show ("danger", $adldap->getLastError (), false);
74
+	$Result->show ("danger", $e->getMessage (), true);
75 75
 }
76 76
 
77 77
 
78 78
 //check for found
79
-if(sizeof($groups)==0) {
79
+if (sizeof ($groups) == 0) {
80 80
 	print "<div class='alert alert-info'>";
81
-	print _('No groups found')."!<hr>";
82
-	print _('Possible reasons').":";
81
+	print _ ('No groups found')."!<hr>";
82
+	print _ ('Possible reasons').":";
83 83
 	print "<ul>";
84
-	print "<li>"._('Invalid baseDN setting for ' . $server->type)."</li>";
85
-	print "<li>"._($server->type . ' account does not have enough privileges for search')."</li>";
84
+	print "<li>"._ ('Invalid baseDN setting for '.$server->type)."</li>";
85
+	print "<li>"._ ($server->type.' account does not have enough privileges for search')."</li>";
86 86
 	print "</div>";
87 87
 } else {
88
-	print _(" Following groups were found").": (".sizeof($groups)."):<hr>";
88
+	print _ (" Following groups were found").": (".sizeof ($groups)."):<hr>";
89 89
 
90 90
 	print "<table class='table table-top table-td-top  table-striped'>";
91 91
 
92 92
 	// loop
93
- 	foreach($groups as $k=>$g) {
93
+ 	foreach ($groups as $k=>$g) {
94 94
 		print "<tr>";
95 95
 		print "	<td>$k</td>";
96 96
 		print "	<td>$g</td>";
97 97
 		//actions
98 98
 		print " <td style='width:10px;'>";
99
-		print "		<a href='' class='btn btn-sm btn-default btn-success groupselect' data-gname='$k' data-gdescription='$g' data-members='$members' data-gid='$k' data-csrf_cookie='$csrf'>"._('Add group')."</a>";
99
+		print "		<a href='' class='btn btn-sm btn-default btn-success groupselect' data-gname='$k' data-gdescription='$g' data-members='$members' data-gid='$k' data-csrf_cookie='$csrf'>"._ ('Add group')."</a>";
100 100
 		print "	</td>";
101 101
 		print "</tr>";
102 102
 
103 103
 		print "<tr>";
104
-		print "	<td>"._("Members:")."</td>";
104
+		print "	<td>"._ ("Members:")."</td>";
105 105
 		print "<td colspan='2'>";
106 106
 		print "	<div class='adgroup-$k'></div>";
107 107
 		// search members
108
-		$groupMembers = $adldap->group()->members($k);
108
+		$groupMembers = $adldap->group ()->members ($k);
109 109
 		unset($members);
110
-		if($groupMembers!==false) {
111
-			foreach($groupMembers as $m) {
110
+		if ($groupMembers !== false) {
111
+			foreach ($groupMembers as $m) {
112 112
 				print "<span class='muted'>$m</span><br>";
113 113
 				$members[] = $m;
114 114
 			}
115
-			if(isset($members))
116
-			$members = implode(";", $members);
115
+			if (isset($members))
116
+			$members = implode (";", $members);
117 117
 		}
118 118
 		else {
119 119
 			$members = "";
120
-			print "<span class='muted'>"._("No members")."</span>";
120
+			print "<span class='muted'>"._ ("No members")."</span>";
121 121
 		}
122 122
 		print "	</td>";
123 123
 		print "	</tr>";
Please login to merge, or discard this patch.
app/admin/groups/index.php 3 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
 # fetch all auth methods
17 17
 $auth_methods = $Admin->fetch_all_objects ("usersAuthMethod");
18 18
 if ($auth_methods!==false) {
19
-	foreach ($auth_methods as $k=>$m) {
20
-		if (!($m->type=="AD" || $m->type=="LDAP")) {
21
-			unset($auth_methods[$k]);
22
-		}
23
-	}
24
-	// none
25
-	if (sizeof($auth_methods)==0) {
26
-		$auth_methods = false;
27
-	}
19
+    foreach ($auth_methods as $k=>$m) {
20
+        if (!($m->type=="AD" || $m->type=="LDAP")) {
21
+            unset($auth_methods[$k]);
22
+        }
23
+    }
24
+    // none
25
+    if (sizeof($auth_methods)==0) {
26
+        $auth_methods = false;
27
+    }
28 28
 }
29 29
 ?>
30 30
 
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 	<td><?php print _('Administrator level users'); ?></td>
63 63
 	<td>
64 64
 	<?php
65
-	foreach($admins as $a) {
66
-		print $a->real_name."<br>";
67
-	}
68
-	?>
65
+    foreach($admins as $a) {
66
+        print $a->real_name."<br>";
67
+    }
68
+    ?>
69 69
 	</td>
70 70
 	<td><?php print _('All sections :'); ?> <span class="badge badge1 badge5">Read / Write</span></td>
71 71
 	<td colspan="2"></td>
@@ -74,58 +74,58 @@  discard block
 block discarded – undo
74 74
 <?php
75 75
 /* print existing sections */
76 76
 if($groups) {
77
-	foreach ($groups as $g) {
78
-		//cast
79
-		$g = (array) $g;
80
-
81
-		print '<tr>' . "\n";
82
-		print '	<td><strong>' . $g['g_name'] . '</strong></td>'. "\n";
83
-		print '	<td>' . $g['g_desc'] . '</td>'. "\n";
84
-		# users in group
85
-		print "	<td>";
86
-		$u = $Admin->group_fetch_users($g['g_id']);
87
-		if(sizeof($u)>0) {
88
-			foreach($u as $name) {
89
-				# get details
90
-				$user = $Admin->fetch_object("users", "id", $name);
91
-				print $user->real_name."<br>";
92
-			}
93
-		} else {
94
-			print "<span class='text-muted'>"._("No users")."</span>";
95
-		}
96
-		print "</td>";
97
-
98
-		# section permissions
99
-		print "	<td>";
100
-		$permissions = $Sections->get_group_section_permissions ($g['g_id']);
101
-		if(sizeof($permissions)>0) {
102
-			foreach($permissions as $sec=>$perm) {
103
-				# reformat permissions
104
-				$perm = $Subnets->parse_permissions($perm);
105
-				print $sec." : <span class='badge badge1 badge5'>".$perm."</span><br>";
106
-			}
107
-		}
108
-		print "</td>";
109
-
110
-
111
-		# add/remove users
112
-		print "	<td class='actions'>";
113
-		print "	<div class='btn-group'>";
114
-		print "		<button class='btn btn-xs btn-default addToGroup' 		data-groupid='$g[g_id]' data-action='add'    rel='tooltip' data-container='body'  title='"._('add users to this group')."'>   	<i class='fa fa-plus'></i></button>";
115
-		print "		<button class='btn btn-xs btn-default removeFromGroup' 	data-groupid='$g[g_id]' data-action='remove' rel='tooltip' data-container='body'  title='"._('remove users from this group')."'><i class='fa fa-minus'></i></button>";
116
-		print "	</div>";
117
-		print "</td>";
118
-
119
-		# edit, delete
120
-		print "<td class='actions'>";
121
-		print "	<div class='btn-group'>";
122
-		print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='edit'   rel='tooltip' data-container='body'  title='"._('edit group details')."'>	<i class='fa fa-pencil'></i></button>";
123
-		print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='delete' rel='tooltip' data-container='body'  title='"._('remove group')."'>		<i class='fa fa-times'></i></button>";
124
-		print "	</div>";
125
-		print "</td>";
126
-
127
-		print '</tr>' . "\n";
128
-	}
77
+    foreach ($groups as $g) {
78
+        //cast
79
+        $g = (array) $g;
80
+
81
+        print '<tr>' . "\n";
82
+        print '	<td><strong>' . $g['g_name'] . '</strong></td>'. "\n";
83
+        print '	<td>' . $g['g_desc'] . '</td>'. "\n";
84
+        # users in group
85
+        print "	<td>";
86
+        $u = $Admin->group_fetch_users($g['g_id']);
87
+        if(sizeof($u)>0) {
88
+            foreach($u as $name) {
89
+                # get details
90
+                $user = $Admin->fetch_object("users", "id", $name);
91
+                print $user->real_name."<br>";
92
+            }
93
+        } else {
94
+            print "<span class='text-muted'>"._("No users")."</span>";
95
+        }
96
+        print "</td>";
97
+
98
+        # section permissions
99
+        print "	<td>";
100
+        $permissions = $Sections->get_group_section_permissions ($g['g_id']);
101
+        if(sizeof($permissions)>0) {
102
+            foreach($permissions as $sec=>$perm) {
103
+                # reformat permissions
104
+                $perm = $Subnets->parse_permissions($perm);
105
+                print $sec." : <span class='badge badge1 badge5'>".$perm."</span><br>";
106
+            }
107
+        }
108
+        print "</td>";
109
+
110
+
111
+        # add/remove users
112
+        print "	<td class='actions'>";
113
+        print "	<div class='btn-group'>";
114
+        print "		<button class='btn btn-xs btn-default addToGroup' 		data-groupid='$g[g_id]' data-action='add'    rel='tooltip' data-container='body'  title='"._('add users to this group')."'>   	<i class='fa fa-plus'></i></button>";
115
+        print "		<button class='btn btn-xs btn-default removeFromGroup' 	data-groupid='$g[g_id]' data-action='remove' rel='tooltip' data-container='body'  title='"._('remove users from this group')."'><i class='fa fa-minus'></i></button>";
116
+        print "	</div>";
117
+        print "</td>";
118
+
119
+        # edit, delete
120
+        print "<td class='actions'>";
121
+        print "	<div class='btn-group'>";
122
+        print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='edit'   rel='tooltip' data-container='body'  title='"._('edit group details')."'>	<i class='fa fa-pencil'></i></button>";
123
+        print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='delete' rel='tooltip' data-container='body'  title='"._('remove group')."'>		<i class='fa fa-times'></i></button>";
124
+        print "	</div>";
125
+        print "</td>";
126
+
127
+        print '</tr>' . "\n";
128
+    }
129 129
 }
130 130
 
131 131
 ?>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,8 @@
 block discarded – undo
57 57
 			if ($action == "skip") {
58 58
 				$msg.= "Duplicate, will skip.";
59 59
 			}
60
-		} else {
60
+		}
61
+		else {
61 62
 			$msg.="New entry, will be added."; $action = "add";
62 63
 		}
63 64
 	}
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -5,24 +5,24 @@  discard block
 block discarded – undo
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 APIs
11
-$groups = $Admin->fetch_all_objects("userGroups", "g_name");
11
+$groups = $Admin->fetch_all_objects ("userGroups", "g_name");
12 12
 
13 13
 # fetch all admin users
14
-$admins = $Admin->fetch_multiple_objects("users", "role", "Administrator");
14
+$admins = $Admin->fetch_multiple_objects ("users", "role", "Administrator");
15 15
 
16 16
 # fetch all auth methods
17 17
 $auth_methods = $Admin->fetch_all_objects ("usersAuthMethod");
18
-if ($auth_methods!==false) {
18
+if ($auth_methods !== false) {
19 19
 	foreach ($auth_methods as $k=>$m) {
20
-		if (!($m->type=="AD" || $m->type=="LDAP")) {
20
+		if (!($m->type == "AD" || $m->type == "LDAP")) {
21 21
 			unset($auth_methods[$k]);
22 22
 		}
23 23
 	}
24 24
 	// none
25
-	if (sizeof($auth_methods)==0) {
25
+	if (sizeof ($auth_methods) == 0) {
26 26
 		$auth_methods = false;
27 27
 	}
28 28
 }
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
 <!-- display existing groups -->
33
-<h4><?php print _('Group management'); ?></h4>
33
+<h4><?php print _ ('Group management'); ?></h4>
34 34
 <hr><br>
35 35
 
36 36
 <!-- Add new -->
37 37
 <div class="btn-group">
38
-	<button class='btn btn-sm btn-default editGroup' style="margin-bottom:10px;" data-action='add'><i class='fa fa-plus'></i> <?php print _('Create group'); ?></button>
39
-	<?php if($auth_methods!==false) { ?>
40
-	<button class='btn btn-sm btn-default adLookup'><i class='fa fa-search'> <?php print _('Search domain groups'); ?></i></button>
38
+	<button class='btn btn-sm btn-default editGroup' style="margin-bottom:10px;" data-action='add'><i class='fa fa-plus'></i> <?php print _ ('Create group'); ?></button>
39
+	<?php if ($auth_methods !== false) { ?>
40
+	<button class='btn btn-sm btn-default adLookup'><i class='fa fa-search'> <?php print _ ('Search domain groups'); ?></i></button>
41 41
 	<?php } ?>
42 42
 </div>
43 43
 
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
 <!-- Headers -->
48 48
 <thead>
49 49
 <tr>
50
-    <th><?php print _('Group name'); ?></th>
51
-    <th><?php print _('Group description'); ?></th>
52
-    <th><?php print _('Belonging users'); ?></th>
53
-    <th><?php print _('Section permissions'); ?></th>
50
+    <th><?php print _ ('Group name'); ?></th>
51
+    <th><?php print _ ('Group description'); ?></th>
52
+    <th><?php print _ ('Belonging users'); ?></th>
53
+    <th><?php print _ ('Section permissions'); ?></th>
54 54
     <th colspan="2"></th>
55 55
 </tr>
56 56
 </thead>
@@ -58,50 +58,50 @@  discard block
 block discarded – undo
58 58
 <tbody>
59 59
 <!-- admins -->
60 60
 <tr>
61
-	<td><strong><?php print _('Administrators'); ?></strong></td>
62
-	<td><?php print _('Administrator level users'); ?></td>
61
+	<td><strong><?php print _ ('Administrators'); ?></strong></td>
62
+	<td><?php print _ ('Administrator level users'); ?></td>
63 63
 	<td>
64 64
 	<?php
65
-	foreach($admins as $a) {
65
+	foreach ($admins as $a) {
66 66
 		print $a->real_name."<br>";
67 67
 	}
68 68
 	?>
69 69
 	</td>
70
-	<td><?php print _('All sections :'); ?> <span class="badge badge1 badge5">Read / Write</span></td>
70
+	<td><?php print _ ('All sections :'); ?> <span class="badge badge1 badge5">Read / Write</span></td>
71 71
 	<td colspan="2"></td>
72 72
 </tr>
73 73
 
74 74
 <?php
75 75
 /* print existing sections */
76
-if($groups) {
76
+if ($groups) {
77 77
 	foreach ($groups as $g) {
78 78
 		//cast
79 79
 		$g = (array) $g;
80 80
 
81
-		print '<tr>' . "\n";
82
-		print '	<td><strong>' . $g['g_name'] . '</strong></td>'. "\n";
83
-		print '	<td>' . $g['g_desc'] . '</td>'. "\n";
81
+		print '<tr>'."\n";
82
+		print '	<td><strong>'.$g['g_name'].'</strong></td>'."\n";
83
+		print '	<td>'.$g['g_desc'].'</td>'."\n";
84 84
 		# users in group
85 85
 		print "	<td>";
86
-		$u = $Admin->group_fetch_users($g['g_id']);
87
-		if(sizeof($u)>0) {
88
-			foreach($u as $name) {
86
+		$u = $Admin->group_fetch_users ($g['g_id']);
87
+		if (sizeof ($u) > 0) {
88
+			foreach ($u as $name) {
89 89
 				# get details
90
-				$user = $Admin->fetch_object("users", "id", $name);
90
+				$user = $Admin->fetch_object ("users", "id", $name);
91 91
 				print $user->real_name."<br>";
92 92
 			}
93 93
 		} else {
94
-			print "<span class='text-muted'>"._("No users")."</span>";
94
+			print "<span class='text-muted'>"._ ("No users")."</span>";
95 95
 		}
96 96
 		print "</td>";
97 97
 
98 98
 		# section permissions
99 99
 		print "	<td>";
100 100
 		$permissions = $Sections->get_group_section_permissions ($g['g_id']);
101
-		if(sizeof($permissions)>0) {
102
-			foreach($permissions as $sec=>$perm) {
101
+		if (sizeof ($permissions) > 0) {
102
+			foreach ($permissions as $sec=>$perm) {
103 103
 				# reformat permissions
104
-				$perm = $Subnets->parse_permissions($perm);
104
+				$perm = $Subnets->parse_permissions ($perm);
105 105
 				print $sec." : <span class='badge badge1 badge5'>".$perm."</span><br>";
106 106
 			}
107 107
 		}
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
 		# add/remove users
112 112
 		print "	<td class='actions'>";
113 113
 		print "	<div class='btn-group'>";
114
-		print "		<button class='btn btn-xs btn-default addToGroup' 		data-groupid='$g[g_id]' data-action='add'    rel='tooltip' data-container='body'  title='"._('add users to this group')."'>   	<i class='fa fa-plus'></i></button>";
115
-		print "		<button class='btn btn-xs btn-default removeFromGroup' 	data-groupid='$g[g_id]' data-action='remove' rel='tooltip' data-container='body'  title='"._('remove users from this group')."'><i class='fa fa-minus'></i></button>";
114
+		print "		<button class='btn btn-xs btn-default addToGroup' 		data-groupid='$g[g_id]' data-action='add'    rel='tooltip' data-container='body'  title='"._ ('add users to this group')."'>   	<i class='fa fa-plus'></i></button>";
115
+		print "		<button class='btn btn-xs btn-default removeFromGroup' 	data-groupid='$g[g_id]' data-action='remove' rel='tooltip' data-container='body'  title='"._ ('remove users from this group')."'><i class='fa fa-minus'></i></button>";
116 116
 		print "	</div>";
117 117
 		print "</td>";
118 118
 
119 119
 		# edit, delete
120 120
 		print "<td class='actions'>";
121 121
 		print "	<div class='btn-group'>";
122
-		print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='edit'   rel='tooltip' data-container='body'  title='"._('edit group details')."'>	<i class='fa fa-pencil'></i></button>";
123
-		print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='delete' rel='tooltip' data-container='body'  title='"._('remove group')."'>		<i class='fa fa-times'></i></button>";
122
+		print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='edit'   rel='tooltip' data-container='body'  title='"._ ('edit group details')."'>	<i class='fa fa-pencil'></i></button>";
123
+		print "		<button class='btn btn-xs btn-default editGroup'  		data-groupid='$g[g_id]' data-action='delete' rel='tooltip' data-container='body'  title='"._ ('remove group')."'>		<i class='fa fa-times'></i></button>";
124 124
 		print "	</div>";
125 125
 		print "</td>";
126 126
 
127
-		print '</tr>' . "\n";
127
+		print '</tr>'."\n";
128 128
 	}
129 129
 }
130 130
 
Please login to merge, or discard this patch.
app/admin/groups/add-users-result.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 
23 23
 # parse result
24 24
 foreach($_POST as $k=>$p) {
25
-	if(substr($k, 0,4) == "user") {
26
-		$users[substr($k, 4)] = substr($k, 4);
27
-	}
25
+    if(substr($k, 0,4) == "user") {
26
+        $users[substr($k, 4)] = substr($k, 4);
27
+    }
28 28
 }
29 29
 
30 30
 
@@ -33,31 +33,31 @@  discard block
 block discarded – undo
33 33
 
34 34
 # add each user to group
35 35
 if(sizeof($users)>0) {
36
-	foreach($users as $key=>$u) {
37
-		if(!$Admin->add_group_to_user($_POST['gid'], $u)) {
38
-			# get user details
39
-			$user = $Admin->fetch_object("users", "id", $u);
40
-			$errors[] = $user->real_name;
41
-		}
42
-	}
36
+    foreach($users as $key=>$u) {
37
+        if(!$Admin->add_group_to_user($_POST['gid'], $u)) {
38
+            # get user details
39
+            $user = $Admin->fetch_object("users", "id", $u);
40
+            $errors[] = $user->real_name;
41
+        }
42
+    }
43 43
 }
44 44
 else {
45
-	$errors[] = _("Please select user(s) to add to selected group!");
45
+    $errors[] = _("Please select user(s) to add to selected group!");
46 46
 }
47 47
 
48 48
 # print result
49 49
 if(isset($errors)) {
50
-	print "<div class='alert alert alert-danger'>";
51
-	print _("Failed to add users").":<hr>";
52
-	print "<ul>";
53
-	foreach($errors as $e) {
54
-		print "<li>$e</li>";
55
-	}
56
-	print "</ul>";
57
-	print "</div>";
50
+    print "<div class='alert alert alert-danger'>";
51
+    print _("Failed to add users").":<hr>";
52
+    print "<ul>";
53
+    foreach($errors as $e) {
54
+        print "<li>$e</li>";
55
+    }
56
+    print "</ul>";
57
+    print "</div>";
58 58
 }
59 59
 else {
60
-	$Result->show("success", _('Users added to group'), true);
60
+    $Result->show("success", _('Users added to group'), true);
61 61
 }
62 62
 
63 63
 ?>
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,59 +5,59 @@
 block discarded – undo
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 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 
20 20
 # id must be numeric
21
-if(!is_numeric($_POST['gid']))		{ $Result->show("danger", _("Invalid ID"), true); }
21
+if (!is_numeric ($_POST['gid'])) { $Result->show ("danger", _ ("Invalid ID"), true); }
22 22
 
23 23
 # parse result
24
-foreach($_POST as $k=>$p) {
25
-	if(substr($k, 0,4) == "user") {
26
-		$users[substr($k, 4)] = substr($k, 4);
24
+foreach ($_POST as $k=>$p) {
25
+	if (substr ($k, 0, 4) == "user") {
26
+		$users[substr ($k, 4)] = substr ($k, 4);
27 27
 	}
28 28
 }
29 29
 
30 30
 
31 31
 # verify that description is present if action != delete
32
-if(strlen($_POST['gid']==0))		{ $Result->show("danger", _('Error - no group ID'), true); }
32
+if (strlen ($_POST['gid'] == 0)) { $Result->show ("danger", _ ('Error - no group ID'), true); }
33 33
 
34 34
 # add each user to group
35
-if(sizeof($users)>0) {
36
-	foreach($users as $key=>$u) {
37
-		if(!$Admin->add_group_to_user($_POST['gid'], $u)) {
35
+if (sizeof ($users) > 0) {
36
+	foreach ($users as $key=>$u) {
37
+		if (!$Admin->add_group_to_user ($_POST['gid'], $u)) {
38 38
 			# get user details
39
-			$user = $Admin->fetch_object("users", "id", $u);
39
+			$user = $Admin->fetch_object ("users", "id", $u);
40 40
 			$errors[] = $user->real_name;
41 41
 		}
42 42
 	}
43 43
 }
44 44
 else {
45
-	$errors[] = _("Please select user(s) to add to selected group!");
45
+	$errors[] = _ ("Please select user(s) to add to selected group!");
46 46
 }
47 47
 
48 48
 # print result
49
-if(isset($errors)) {
49
+if (isset($errors)) {
50 50
 	print "<div class='alert alert alert-danger'>";
51
-	print _("Failed to add users").":<hr>";
51
+	print _ ("Failed to add users").":<hr>";
52 52
 	print "<ul>";
53
-	foreach($errors as $e) {
53
+	foreach ($errors as $e) {
54 54
 		print "<li>$e</li>";
55 55
 	}
56 56
 	print "</ul>";
57 57
 	print "</div>";
58 58
 }
59 59
 else {
60
-	$Result->show("success", _('Users added to group'), true);
60
+	$Result->show ("success", _ ('Users added to group'), true);
61 61
 }
62 62
 
63 63
 ?>
64 64
\ No newline at end of file
Please login to merge, or discard this patch.
app/admin/groups/add-users.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -49,24 +49,24 @@
 block discarded – undo
49 49
 	</tr>
50 50
 
51 51
 	<?php
52
-	# show missing
53
-	foreach($missing as $k=>$m) {
54
-		# get user details
55
-		$u = (array) $Admin->fetch_object("users", "id", $m);
52
+    # show missing
53
+    foreach($missing as $k=>$m) {
54
+        # get user details
55
+        $u = (array) $Admin->fetch_object("users", "id", $m);
56 56
 
57
-		print "<tr>";
57
+        print "<tr>";
58 58
 
59
-		print "	<td>";
60
-		print "	<input type='checkbox' name='user$u[id]'>";
61
-		print "	</td>";
59
+        print "	<td>";
60
+        print "	<input type='checkbox' name='user$u[id]'>";
61
+        print "	</td>";
62 62
 
63
-		print "	<td>$u[real_name]</td>";
64
-		print "	<td>$u[username]</td>";
65
-		print "	<td>$u[email]</td>";
63
+        print "	<td>$u[real_name]</td>";
64
+        print "	<td>$u[username]</td>";
65
+        print "	<td>$u[email]</td>";
66 66
 
67
-		print "</tr>";
68
-	}
69
-	?>
67
+        print "</tr>";
68
+    }
69
+    ?>
70 70
 
71 71
     </table>
72 72
     </form>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
     </table>
72 72
     </form>
73 73
 
74
-    <?php } else { $Result->show("info", _('No available users to add to group'), false); } ?>
74
+    <?php }
75
+else { $Result->show("info", _('No available users to add to group'), false); } ?>
75 76
 </div>
76 77
 
77 78
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -5,36 +5,36 @@  discard block
 block discarded – undo
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 14
 $Result 	= new Result ();
15 15
 
16 16
 # verify that user is logged in
17
-$User->check_user_session();
17
+$User->check_user_session ();
18 18
 
19 19
 
20 20
 # id must be numeric
21
-if(!is_numeric($_POST['g_id']))		{ $Result->show("danger", _("Invalid ID"), true, true); }
21
+if (!is_numeric ($_POST['g_id'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); }
22 22
 
23 23
 # get group details
24
-$group   = $Admin->fetch_object("userGroups", "g_id", $_POST['g_id']);
24
+$group   = $Admin->fetch_object ("userGroups", "g_id", $_POST['g_id']);
25 25
 # not in group - array of ids
26 26
 $missing = $Admin->group_fetch_missing_users ($_POST['g_id']);
27 27
 ?>
28 28
 
29 29
 
30 30
 <!-- header -->
31
-<div class="pHeader"><?php print _('Add users to group'); ?> <?php print $group->g_name; ?></div>
31
+<div class="pHeader"><?php print _ ('Add users to group'); ?> <?php print $group->g_name; ?></div>
32 32
 
33 33
 
34 34
 <!-- content -->
35 35
 <div class="pContent">
36 36
 
37
-	<?php if(sizeof($missing) > 0) { ?>
37
+	<?php if (sizeof ($missing) > 0) { ?>
38 38
 
39 39
 	<form id="groupAddUsers" name="groupAddUsers">
40 40
 	<table class="groupEdit table table-condensed table-hover table-top">
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		<th>
44 44
 			<input type="hidden" name="gid" value="<?php print $_POST['g_id']; ?>">
45 45
 		</th>
46
-		<th><?php print _('Name'); ?></th>
47
-		<th><?php print _('Username'); ?></th>
48
-		<th><?php print _('Email'); ?></th>
46
+		<th><?php print _ ('Name'); ?></th>
47
+		<th><?php print _ ('Username'); ?></th>
48
+		<th><?php print _ ('Email'); ?></th>
49 49
 	</tr>
50 50
 
51 51
 	<?php
52 52
 	# show missing
53
-	foreach($missing as $k=>$m) {
53
+	foreach ($missing as $k=>$m) {
54 54
 		# get user details
55
-		$u = (array) $Admin->fetch_object("users", "id", $m);
55
+		$u = (array) $Admin->fetch_object ("users", "id", $m);
56 56
 
57 57
 		print "<tr>";
58 58
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     </table>
72 72
     </form>
73 73
 
74
-    <?php } else { $Result->show("info", _('No available users to add to group'), false); } ?>
74
+    <?php } else { $Result->show ("info", _ ('No available users to add to group'), false); } ?>
75 75
 </div>
76 76
 
77 77
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 <div class="pFooter">
80 80
 	<div class="btn-group">
81 81
 		<button class="btn btn-sm btn-default hidePopups">Cancel</button>
82
-		<?php if(sizeof($missing) > 0) { ?>
82
+		<?php if (sizeof ($missing) > 0) { ?>
83 83
 		<button class="btn btn-sm btn-default btn-success" id="groupAddUsersSubmit"><i class="fa fa-plus"></i> Add selected users</button>
84 84
 		<?php } ?>
85 85
 	</div>
Please login to merge, or discard this patch.
app/admin/replace-fields/index.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@
 block discarded – undo
28 28
 			<option value="switch"><?php print _('Device'); ?></option>
29 29
 			<option value="port"><?php print _('Port'); ?></option>
30 30
 			<?php
31
-			# fetch custom fields
32
-			$custom = $Tools->fetch_custom_fields('ipaddresses');
31
+            # fetch custom fields
32
+            $custom = $Tools->fetch_custom_fields('ipaddresses');
33 33
 
34
-			if(sizeof($custom) > 0) {
35
-				foreach($custom as $myField) {
36
-					print '<option value="'. $myField['name'] .'"> '. $myField['name'] .'</option>';
37
-				}
38
-			}
39
-			?>
34
+            if(sizeof($custom) > 0) {
35
+                foreach($custom as $myField) {
36
+                    print '<option value="'. $myField['name'] .'"> '. $myField['name'] .'</option>';
37
+                }
38
+            }
39
+            ?>
40 40
 		</select>
41 41
 		</td>
42 42
 	</tr>
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,35 +5,35 @@  discard block
 block discarded – undo
5 5
  ***********************************************/
6 6
 
7 7
 # verify that user is logged in
8
-$User->check_user_session();
8
+$User->check_user_session ();
9 9
 
10 10
 # create csrf token
11 11
 $csrf = $User->csrf_cookie ("create", "replace_fields");
12 12
 ?>
13 13
 
14
-<h4><?php print _('Search and replace fields in IP address list'); ?></h4>
14
+<h4><?php print _ ('Search and replace fields in IP address list'); ?></h4>
15 15
 <hr><br>
16 16
 
17 17
 <form id="searchReplace">
18 18
 <table class="table" style="width:auto">
19 19
 
20 20
 	<tr>
21
-		<td><?php print _('Select field to replace'); ?>:</td>
21
+		<td><?php print _ ('Select field to replace'); ?>:</td>
22 22
 		<td>
23 23
 		<select name="field" class="form-control input-sm input-w-auto">
24
-			<option value="description"><?php print _('Description'); ?></option>
25
-			<option value="dns_name"><?php print _('Hostname'); ?></option>
26
-			<option value="owner"><?php print _('Owner'); ?></option>
27
-			<option value="mac"><?php print _('MAC address'); ?></option>
28
-			<option value="switch"><?php print _('Device'); ?></option>
29
-			<option value="port"><?php print _('Port'); ?></option>
24
+			<option value="description"><?php print _ ('Description'); ?></option>
25
+			<option value="dns_name"><?php print _ ('Hostname'); ?></option>
26
+			<option value="owner"><?php print _ ('Owner'); ?></option>
27
+			<option value="mac"><?php print _ ('MAC address'); ?></option>
28
+			<option value="switch"><?php print _ ('Device'); ?></option>
29
+			<option value="port"><?php print _ ('Port'); ?></option>
30 30
 			<?php
31 31
 			# fetch custom fields
32
-			$custom = $Tools->fetch_custom_fields('ipaddresses');
32
+			$custom = $Tools->fetch_custom_fields ('ipaddresses');
33 33
 
34
-			if(sizeof($custom) > 0) {
35
-				foreach($custom as $myField) {
36
-					print '<option value="'. $myField['name'] .'"> '. $myField['name'] .'</option>';
34
+			if (sizeof ($custom) > 0) {
35
+				foreach ($custom as $myField) {
36
+					print '<option value="'.$myField['name'].'"> '.$myField['name'].'</option>';
37 37
 				}
38 38
 			}
39 39
 			?>
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 	</tr>
43 43
 
44 44
 	<tr>
45
-		<td><?php print _('Select search string'); ?></td>
45
+		<td><?php print _ ('Select search string'); ?></td>
46 46
 		<td>
47
-			<input type="text" name="search" class="form-control input-sm" placeholder="<?php print _('search string'); ?>">
47
+			<input type="text" name="search" class="form-control input-sm" placeholder="<?php print _ ('search string'); ?>">
48 48
 			<input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>">
49 49
 		</td>
50 50
 	</tr>
51 51
 
52 52
 	<tr>
53
-		<td><?php print _('Select replace string'); ?></td>
53
+		<td><?php print _ ('Select replace string'); ?></td>
54 54
 		<td>
55
-			<input type="text" name="replace" class="form-control input-sm" placeholder="<?php print _('replace string'); ?>">
55
+			<input type="text" name="replace" class="form-control input-sm" placeholder="<?php print _ ('replace string'); ?>">
56 56
 		</td>
57 57
 	</tr>
58 58
 
59 59
 	<tr class="th">
60 60
 		<td></td>
61 61
 		<td>
62
-			<button class="btn btn-sm btn-default" id="searchReplaceSave"><i class="fa fa-check"></i> <?php print _('Replace'); ?></button>
62
+			<button class="btn btn-sm btn-default" id="searchReplaceSave"><i class="fa fa-check"></i> <?php print _ ('Replace'); ?></button>
63 63
 		</td>
64 64
 	</tr>
65 65
 
Please login to merge, or discard this patch.