@@ -5,61 +5,61 @@ |
||
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 | $Tools = new Tools ($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", "vlan_domain", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
24 | +$User->csrf_cookie ("validate", "vlan_domain", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
25 | 25 | |
26 | 26 | # we cannot delete default domain |
27 | -if(@$_POST['id']==1 && $_POST['action']=="delete") { $Result->show("danger", _("Default domain cannot be deleted"), true); } |
|
27 | +if (@$_POST['id'] == 1 && $_POST['action'] == "delete") { $Result->show ("danger", _ ("Default domain cannot be deleted"), true); } |
|
28 | 28 | // ID must be numeric |
29 | -if($_POST['action']!="add" && !is_numeric($_POST['id'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
29 | +if ($_POST['action'] != "add" && !is_numeric ($_POST['id'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
30 | 30 | // Hostname must be present |
31 | -if(@$_POST['name'] == "") { $Result->show("danger", _('Name is mandatory').'!', true); } |
|
31 | +if (@$_POST['name'] == "") { $Result->show ("danger", _ ('Name is mandatory').'!', true); } |
|
32 | 32 | |
33 | 33 | |
34 | 34 | // set sections |
35 | -if(@$_POST['id']!=1) { |
|
36 | - foreach($_POST as $key=>$line) { |
|
37 | - if (strlen(strstr($key,"section-"))>0) { |
|
38 | - $key2 = str_replace("section-", "", $key); |
|
35 | +if (@$_POST['id'] != 1) { |
|
36 | + foreach ($_POST as $key=>$line) { |
|
37 | + if (strlen (strstr ($key, "section-")) > 0) { |
|
38 | + $key2 = str_replace ("section-", "", $key); |
|
39 | 39 | $temp[] = $key2; |
40 | 40 | unset($_POST[$key]); |
41 | 41 | } |
42 | 42 | } |
43 | 43 | # glue sections together |
44 | - $_POST['permissions'] = sizeof($temp)>0 ? implode(";", $temp) : null; |
|
44 | + $_POST['permissions'] = sizeof ($temp) > 0 ? implode (";", $temp) : null; |
|
45 | 45 | } |
46 | 46 | else { |
47 | 47 | $_POST['permissions'] = ""; |
48 | 48 | } |
49 | 49 | |
50 | 50 | # set update values |
51 | -$values = array("id"=>@$_POST['id'], |
|
51 | +$values = array ("id"=>@$_POST['id'], |
|
52 | 52 | "name"=>@$_POST['name'], |
53 | 53 | "description"=>@$_POST['description'], |
54 | 54 | "permissions"=>@$_POST['permissions'] |
55 | 55 | ); |
56 | 56 | |
57 | 57 | # update domain |
58 | -if(!$Admin->object_modify("vlanDomains", $_POST['action'], "id", $values)) {} |
|
59 | -else { $Result->show("success", _("Domain $_POST[action] successfull").'!', false); } |
|
58 | +if (!$Admin->object_modify ("vlanDomains", $_POST['action'], "id", $values)) {} |
|
59 | +else { $Result->show ("success", _ ("Domain $_POST[action] successfull").'!', false); } |
|
60 | 60 | |
61 | 61 | # if delete move all vlans to default domain! |
62 | -if($_POST['action']=="delete") { |
|
62 | +if ($_POST['action'] == "delete") { |
|
63 | 63 | $Admin->update_object_references ("vlans", "domainId", $_POST['id'], 1); |
64 | 64 | } |
65 | 65 |
@@ -4,49 +4,49 @@ discard block |
||
4 | 4 | *******************************/ |
5 | 5 | |
6 | 6 | /* functions */ |
7 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
7 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
8 | 8 | |
9 | 9 | # initialize user object |
10 | -$Database = new Database_PDO; |
|
11 | -$User = new User ($Database); |
|
10 | +$Database = new Database_PDO; |
|
11 | +$User = new User ($Database); |
|
12 | 12 | $Admin = new Admin ($Database); |
13 | 13 | $Subnets = new Subnets ($Database); |
14 | -$Addresses = new Addresses ($Database); |
|
15 | -$Tools = new Tools ($Database); |
|
14 | +$Addresses = new Addresses ($Database); |
|
15 | +$Tools = new Tools ($Database); |
|
16 | 16 | $Result = new Result (); |
17 | 17 | |
18 | 18 | # verify that user is logged in |
19 | -$User->check_user_session(); |
|
19 | +$User->check_user_session (); |
|
20 | 20 | |
21 | 21 | # check for number of input values |
22 | -$max = ini_get("max_input_vars"); |
|
23 | -if(sizeof($_POST)>=ini_get("max_input_vars")) { $Result->show("danger", _("Number of discovered hosts exceed maximum possible defined by php.ini - set to ")." $max <hr>"._("Please adjust your php.ini settings for value `max_input_vars`"), true); } |
|
22 | +$max = ini_get ("max_input_vars"); |
|
23 | +if (sizeof ($_POST) >= ini_get ("max_input_vars")) { $Result->show ("danger", _ ("Number of discovered hosts exceed maximum possible defined by php.ini - set to ")." $max <hr>"._ ("Please adjust your php.ini settings for value `max_input_vars`"), true); } |
|
24 | 24 | |
25 | 25 | // fetch custom fields and check for required |
26 | 26 | $required_fields = $Tools->fetch_custom_fields ('vlans'); |
27 | -if($required_fields!==false) { |
|
27 | +if ($required_fields !== false) { |
|
28 | 28 | foreach ($required_fields as $k=>$f) { |
29 | - if ($f['Null']!="NO") { |
|
29 | + if ($f['Null'] != "NO") { |
|
30 | 30 | unset($required_fields[$k]); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | 35 | # ok, lets get results form post array! |
36 | -foreach($_POST as $key=>$line) { |
|
36 | +foreach ($_POST as $key=>$line) { |
|
37 | 37 | // IP address |
38 | - if(substr($key, 0,4)=="name") { $res[substr($key, 4)]['name'] = $line; } |
|
38 | + if (substr ($key, 0, 4) == "name") { $res[substr ($key, 4)]['name'] = $line; } |
|
39 | 39 | // mac |
40 | - elseif(substr($key, 0,6)=="number") { $res[substr($key, 6)]['number'] = $line; } |
|
40 | + elseif (substr ($key, 0, 6) == "number") { $res[substr ($key, 6)]['number'] = $line; } |
|
41 | 41 | // device |
42 | - elseif(substr($key, 0,8)=="domainId") { $res[substr($key, 8)]['domainId'] = $line; } |
|
42 | + elseif (substr ($key, 0, 8) == "domainId") { $res[substr ($key, 8)]['domainId'] = $line; } |
|
43 | 43 | // description |
44 | - elseif(substr($key, 0,11)=="description") { $res[substr($key, 11)]['description'] = $line; } |
|
44 | + elseif (substr ($key, 0, 11) == "description") { $res[substr ($key, 11)]['description'] = $line; } |
|
45 | 45 | // custom fields |
46 | 46 | elseif (isset($required_fields)) { |
47 | 47 | foreach ($required_fields as $k=>$f) { |
48 | - if((strpos($key, $f['name'])) !== false) { |
|
49 | - { $res[substr($key, strlen($f['name']))][$f['name']] = $line; } |
|
48 | + if ((strpos ($key, $f['name'])) !== false) { |
|
49 | + { $res[substr ($key, strlen ($f['name']))][$f['name']] = $line; } |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | */ |
60 | 60 | |
61 | 61 | # insert entries |
62 | -if(sizeof($res)>0) { |
|
62 | +if (sizeof ($res) > 0) { |
|
63 | 63 | $errors = 0; |
64 | - foreach($res as $r) { |
|
64 | + foreach ($res as $r) { |
|
65 | 65 | # set insert values |
66 | - $values = array("number"=>$r['number'], |
|
66 | + $values = array ("number"=>$r['number'], |
|
67 | 67 | "name"=>$r['name'], |
68 | 68 | "domainId"=>$r['domainId'], |
69 | 69 | "description"=>$r['description'] |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | } |
76 | 76 | } |
77 | 77 | # insert vlans |
78 | - if(!$Admin->object_modify("vlans", "add", "vlanId", $values)) { $Result->show("danger", _("Failed to import entry")." ".$r['number']." ".$r['name'], false); $errors++; } |
|
78 | + if (!$Admin->object_modify ("vlans", "add", "vlanId", $values)) { $Result->show ("danger", _ ("Failed to import entry")." ".$r['number']." ".$r['name'], false); $errors++; } |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | # success if no errors |
82 | - if($errors==0) { $Result->show("success", _("Scan results added to database")."!", true); } |
|
82 | + if ($errors == 0) { $Result->show ("success", _ ("Scan results added to database")."!", true); } |
|
83 | 83 | } |
84 | 84 | # error |
85 | -else { $Result->show("danger", _("No entries available"), true); } |
|
85 | +else { $Result->show ("danger", _ ("No entries available"), true); } |
|
86 | 86 | ?> |
87 | 87 | \ No newline at end of file |
@@ -1,28 +1,28 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /* functions */ |
4 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
4 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
5 | 5 | |
6 | 6 | # initialize user object |
7 | -$Database = new Database_PDO; |
|
8 | -$User = new User ($Database); |
|
7 | +$Database = new Database_PDO; |
|
8 | +$User = new User ($Database); |
|
9 | 9 | $Admin = new Admin ($Database); |
10 | 10 | $Result = new Result (); |
11 | -$Log = new Logging ($Database, $User->settings); |
|
11 | +$Log = new Logging ($Database, $User->settings); |
|
12 | 12 | |
13 | 13 | # verify that user is logged in |
14 | -$User->check_user_session(); |
|
14 | +$User->check_user_session (); |
|
15 | 15 | |
16 | 16 | # create csrf token |
17 | 17 | $csrf = $User->csrf_cookie ("create", "authmethods"); |
18 | 18 | |
19 | 19 | # if edit check if protected? |
20 | -if($_POST['action']!="add") { |
|
21 | - $auth_method = $Admin->fetch_object("usersAuthMethod", "id", $_POST['id']); |
|
22 | - if($auth_method->protected=="Yes") { $Result->show("danger", _("Method cannot be change as it is protected"), true, true); } |
|
20 | +if ($_POST['action'] != "add") { |
|
21 | + $auth_method = $Admin->fetch_object ("usersAuthMethod", "id", $_POST['id']); |
|
22 | + if ($auth_method->protected == "Yes") { $Result->show ("danger", _ ("Method cannot be change as it is protected"), true, true); } |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | # route to proper auth method editing |
26 | -if(!file_exists(dirname(__FILE__)."/edit-$_POST[type].php")) { $Result->show("danger", _("Invalid method type"), true, true); } |
|
27 | -else { include("edit-$_POST[type].php"); } |
|
26 | +if (!file_exists (dirname (__FILE__)."/edit-$_POST[type].php")) { $Result->show ("danger", _ ("Invalid method type"), true, true); } |
|
27 | +else { include("edit-$_POST[type].php"); } |
|
28 | 28 | ?> |
29 | 29 | \ No newline at end of file |
@@ -6,55 +6,55 @@ |
||
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", "authmethods", $_POST['csrf_cookie']) === false ? $Result->show("danger", _("Invalid CSRF cookie"), true) : ""; |
|
24 | +$User->csrf_cookie ("validate", "authmethods", $_POST['csrf_cookie']) === false ? $Result->show ("danger", _ ("Invalid CSRF cookie"), true) : ""; |
|
25 | 25 | |
26 | 26 | # get action |
27 | 27 | $action = $_POST['action']; |
28 | 28 | |
29 | 29 | //for adding remove id |
30 | -if($action=="add") { |
|
30 | +if ($action == "add") { |
|
31 | 31 | unset($_POST['id']); |
32 | 32 | } |
33 | 33 | else { |
34 | 34 | //check id |
35 | - if(!is_numeric($_POST['id'])) { $Result->show("danger", _("Invalid ID"), true); } |
|
35 | + if (!is_numeric ($_POST['id'])) { $Result->show ("danger", _ ("Invalid ID"), true); } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | # set update query |
39 | -$values = array("id"=>@$_POST['id'], |
|
39 | +$values = array ("id"=>@$_POST['id'], |
|
40 | 40 | "type"=>$_POST['type'], |
41 | 41 | "description"=>@$_POST['description'], |
42 | 42 | ); |
43 | 43 | # add params |
44 | 44 | unset($_POST['id'], $_POST['type'], $_POST['description'], $_POST['action']); |
45 | -$values["params"]=json_encode($_POST); |
|
45 | +$values["params"] = json_encode ($_POST); |
|
46 | 46 | |
47 | 47 | # add - set protected |
48 | -if($action=="add") { |
|
48 | +if ($action == "add") { |
|
49 | 49 | $values['protected'] = "No"; |
50 | 50 | } |
51 | 51 | |
52 | 52 | # update |
53 | -if(!$Admin->object_modify("usersAuthMethod", $action, "id", $values)) { $Result->show("danger", _("Failed to edit authentication method"), false); } |
|
54 | -else { $Result->show("success", _("Authentication method updated"), false); } |
|
53 | +if (!$Admin->object_modify ("usersAuthMethod", $action, "id", $values)) { $Result->show ("danger", _ ("Failed to edit authentication method"), false); } |
|
54 | +else { $Result->show ("success", _ ("Authentication method updated"), false); } |
|
55 | 55 | |
56 | 56 | # if delete also reset all users that have thos auth method |
57 | -if($action=="delete") { |
|
58 | - $Database->runQuery("update `users` set `authMethod`=1 where `authMethod`= ?;", array($values['id'])); |
|
57 | +if ($action == "delete") { |
|
58 | + $Database->runQuery ("update `users` set `authMethod`=1 where `authMethod`= ?;", array ($values['id'])); |
|
59 | 59 | } |
60 | 60 | ?> |
61 | 61 | \ No newline at end of file |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | *****************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # ID must be numeric */ |
11 | -if($_POST['action']!="add") { |
|
12 | - if(!is_numeric($_POST['id'])) { $Result->show("danger", _("Invalid ID"), true, true); } |
|
11 | +if ($_POST['action'] != "add") { |
|
12 | + if (!is_numeric ($_POST['id'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); } |
|
13 | 13 | |
14 | 14 | # feth method settings |
15 | 15 | $method_settings = $Admin->fetch_object ("usersAuthMethod", "id", $_POST['id']); |
16 | - $method_settings->params = json_decode($method_settings->params); |
|
16 | + $method_settings->params = json_decode ($method_settings->params); |
|
17 | 17 | } |
18 | 18 | else { |
19 | 19 | $method_settings = new StdClass (); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | # set delete flag |
28 | -$delete = $_POST['action']=="delete" ? "disabled" : ""; |
|
28 | +$delete = $_POST['action'] == "delete" ? "disabled" : ""; |
|
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <!-- header --> |
32 | -<div class="pHeader"><?php print _('NetIQ connection settings'); ?></div> |
|
32 | +<div class="pHeader"><?php print _ ('NetIQ connection settings'); ?></div> |
|
33 | 33 | |
34 | 34 | <!-- content --> |
35 | 35 | <div class="pContent"> |
36 | 36 | |
37 | 37 | <?php |
38 | 38 | # make sure LDAP is supported ! |
39 | - if (!in_array("ldap", get_loaded_extensions())) { $Result->show("danger", _("ldap extension not enabled in php")."!<hr>", false); } |
|
39 | + if (!in_array ("ldap", get_loaded_extensions ())) { $Result->show ("danger", _ ("ldap extension not enabled in php")."!<hr>", false); } |
|
40 | 40 | ?> |
41 | 41 | |
42 | 42 | <form id="editAuthMethod" name="editAuthMethod"> |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | |
45 | 45 | <!-- description --> |
46 | 46 | <tr> |
47 | - <td><?php print _('Description'); ?></td> |
|
47 | + <td><?php print _ ('Description'); ?></td> |
|
48 | 48 | <td> |
49 | 49 | <input type="text" name="description" class="form-control input-sm" value="<?php print @$method_settings->description; ?>" <?php print $delete; ?>> |
50 | 50 | </td> |
51 | 51 | <td class="base_dn info2"> |
52 | - <?php print _('Set name for authentication method'); ?> |
|
52 | + <?php print _ ('Set name for authentication method'); ?> |
|
53 | 53 | </td> |
54 | 54 | </tr> |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | <!-- DC --> |
61 | 61 | <tr> |
62 | - <td style="width:130px;"><?php print _('Domain controllers'); ?></td> |
|
62 | + <td style="width:130px;"><?php print _ ('Domain controllers'); ?></td> |
|
63 | 63 | <td style="width:250px;"> |
64 | 64 | <input type="text" name="domain_controllers" class="form-control input-sm" value="<?php print @$method_settings->params->domain_controllers; ?>" <?php print $delete; ?>> |
65 | 65 | <input type="hidden" name="type" value="NetIQ"> |
@@ -67,70 +67,70 @@ discard block |
||
67 | 67 | <input type="hidden" name="action" value="<?php print @$_POST['action']; ?>"> |
68 | 68 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
69 | 69 | </td> |
70 | - <td class="info2"><?php print _('Enter domain controllers, separated by ;'); ?> |
|
70 | + <td class="info2"><?php print _ ('Enter domain controllers, separated by ;'); ?> |
|
71 | 71 | </td> |
72 | 72 | </tr> |
73 | 73 | |
74 | 74 | <!-- BasedN --> |
75 | 75 | <tr> |
76 | - <td><?php print _('Base DN'); ?></td> |
|
76 | + <td><?php print _ ('Base DN'); ?></td> |
|
77 | 77 | <td> |
78 | 78 | <input type="text" name="base_dn" class="form-control input-sm" value="<?php print @$method_settings->params->base_dn; ?>" <?php print $delete; ?>> |
79 | 79 | </td> |
80 | 80 | <td class="base_dn info2"> |
81 | - <?php print _('Enter base DN for LDAP'); ?> |
|
81 | + <?php print _ ('Enter base DN for LDAP'); ?> |
|
82 | 82 | </td> |
83 | 83 | </tr> |
84 | 84 | |
85 | 85 | <!-- Account suffix --> |
86 | 86 | <tr> |
87 | - <td><?php print _('Account suffix'); ?></td> |
|
87 | + <td><?php print _ ('Account suffix'); ?></td> |
|
88 | 88 | <td> |
89 | 89 | <input type="text" name="account_suffix" class="form-control input-sm" value="<?php print @$method_settings->params->account_suffix; ?>" <?php print $delete; ?>> |
90 | 90 | </td> |
91 | 91 | <td class="info2"> |
92 | - <?php print _('The account suffix for your domain'); ?> |
|
92 | + <?php print _ ('The account suffix for your domain'); ?> |
|
93 | 93 | </td> |
94 | 94 | </tr> |
95 | 95 | |
96 | 96 | |
97 | 97 | <!-- SSL --> |
98 | 98 | <tr> |
99 | - <td><?php print _('Use SSL'); ?></td> |
|
99 | + <td><?php print _ ('Use SSL'); ?></td> |
|
100 | 100 | <td> |
101 | 101 | <select name="use_ssl" class="form-control input-sm input-w-auto" <?php print $delete; ?>> |
102 | - <option value="0" <?php if(@$method_settings->params->use_ssl == 0) { print 'selected'; } ?>><?php print _('false'); ?></option> |
|
103 | - <option value="1" <?php if(@$method_settings->params->use_ssl == 1) { print 'selected'; } ?>><?php print _('true'); ?></option> |
|
102 | + <option value="0" <?php if (@$method_settings->params->use_ssl == 0) { print 'selected'; } ?>><?php print _ ('false'); ?></option> |
|
103 | + <option value="1" <?php if (@$method_settings->params->use_ssl == 1) { print 'selected'; } ?>><?php print _ ('true'); ?></option> |
|
104 | 104 | </select> |
105 | 105 | </td> |
106 | 106 | <td class="info2"> |
107 | - <?php print _('Use SSL (LDAPS), your server needs to be setup (default: false)'); ?><br> |
|
107 | + <?php print _ ('Use SSL (LDAPS), your server needs to be setup (default: false)'); ?><br> |
|
108 | 108 | </td> |
109 | 109 | </tr> |
110 | 110 | |
111 | 111 | <!-- TLS --> |
112 | 112 | <tr> |
113 | - <td><?php print _('Use TLS'); ?></td> |
|
113 | + <td><?php print _ ('Use TLS'); ?></td> |
|
114 | 114 | <td> |
115 | 115 | <select name="use_tls" class="form-control input-sm input-w-auto" <?php print $delete; ?>> |
116 | - <option value="0" <?php if(@$method_settings->params->use_tls == 0) { print 'selected'; } ?>><?php print _('false'); ?></option> |
|
117 | - <option value="1" <?php if(@$method_settings->params->use_tls == 1) { print 'selected'; } ?>><?php print _('true'); ?></option> |
|
116 | + <option value="0" <?php if (@$method_settings->params->use_tls == 0) { print 'selected'; } ?>><?php print _ ('false'); ?></option> |
|
117 | + <option value="1" <?php if (@$method_settings->params->use_tls == 1) { print 'selected'; } ?>><?php print _ ('true'); ?></option> |
|
118 | 118 | </select> |
119 | 119 | </td> |
120 | 120 | <td class="info2"> |
121 | - <?php print _('If you wish to use TLS you should ensure that useSSL is set to false and vice-versa (default: false)'); ?> |
|
121 | + <?php print _ ('If you wish to use TLS you should ensure that useSSL is set to false and vice-versa (default: false)'); ?> |
|
122 | 122 | </td> |
123 | 123 | </tr> |
124 | 124 | |
125 | 125 | |
126 | 126 | <!-- AD port --> |
127 | 127 | <tr> |
128 | - <td><?php print _('AD port'); ?></td> |
|
128 | + <td><?php print _ ('AD port'); ?></td> |
|
129 | 129 | <td> |
130 | 130 | <input type="text" name="ad_port" class="form-control input-sm input-w-100" value="<?php print @$method_settings->params->ad_port; ?>" <?php print $delete; ?>> |
131 | 131 | </td> |
132 | 132 | <td class="port info2"> |
133 | - <?php print _('The default port for LDAP non-SSL connections'); ?> |
|
133 | + <?php print _ ('The default port for LDAP non-SSL connections'); ?> |
|
134 | 134 | </td> |
135 | 135 | </tr> |
136 | 136 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | </tr> |
141 | 141 | <!-- Username --> |
142 | 142 | <tr> |
143 | - <td><?php print _('Domain account'); ?></td> |
|
143 | + <td><?php print _ ('Domain account'); ?></td> |
|
144 | 144 | <td> |
145 | - <input type="text" name="adminUsername" class="form-control input-sm" style="margin-bottom:5px;" placeholder="<?php print _('Username'); ?>" value="<?php print @$method_settings->params->adminUsername; ?>" <?php print $delete; ?>> |
|
146 | - <input type="password" name="adminPassword" class="form-control input-sm" placeholder="<?php print _('Password'); ?>" value="<?php print @$method_settings->params->adminPassword; ?>" <?php print $delete; ?>> |
|
145 | + <input type="text" name="adminUsername" class="form-control input-sm" style="margin-bottom:5px;" placeholder="<?php print _ ('Username'); ?>" value="<?php print @$method_settings->params->adminUsername; ?>" <?php print $delete; ?>> |
|
146 | + <input type="password" name="adminPassword" class="form-control input-sm" placeholder="<?php print _ ('Password'); ?>" value="<?php print @$method_settings->params->adminPassword; ?>" <?php print $delete; ?>> |
|
147 | 147 | </td> |
148 | 148 | <td class="info2"> |
149 | - <?php print _('Domain account for search operations (optional)'); ?> |
|
149 | + <?php print _ ('Domain account for search operations (optional)'); ?> |
|
150 | 150 | </td> |
151 | 151 | </tr> |
152 | 152 | |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | <!-- footer --> |
159 | 159 | <div class="pFooter"> |
160 | 160 | <div class="btn-group"> |
161 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
162 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editAuthMethodSubmit"><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> |
|
161 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
162 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editAuthMethodSubmit"><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> |
|
163 | 163 | </div> |
164 | 164 | |
165 | 165 | <?php |
166 | - if($_POST['action']=="delete") { |
|
166 | + if ($_POST['action'] == "delete") { |
|
167 | 167 | # check for mathing users |
168 | 168 | $users = $Admin->fetch_multiple_objects ("users", "authMethod", @$method_settings->id); |
169 | - if($users!==false) { |
|
170 | - $Result->show("warning", sizeof($users)._(" users have this method for logging in. They will be reset to local auth!"), false); |
|
169 | + if ($users !== false) { |
|
170 | + $Result->show ("warning", sizeof ($users)._ (" users have this method for logging in. They will be reset to local auth!"), false); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | ?> |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | *****************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # ID must be numeric */ |
11 | -if($_POST['action']!="add") { |
|
12 | - if(!is_numeric($_POST['id'])) { $Result->show("danger", _("Invalid ID"), true, true); } |
|
11 | +if ($_POST['action'] != "add") { |
|
12 | + if (!is_numeric ($_POST['id'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); } |
|
13 | 13 | |
14 | 14 | # feth method settings |
15 | 15 | $method_settings = $Admin->fetch_object ("usersAuthMethod", "id", $_POST['id']); |
16 | - $method_settings->params = json_decode($method_settings->params); |
|
16 | + $method_settings->params = json_decode ($method_settings->params); |
|
17 | 17 | } |
18 | 18 | else { |
19 | 19 | $method_settings = new StdClass (); |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | # set delete flag |
28 | -$delete = $_POST['action']=="delete" ? "disabled" : ""; |
|
28 | +$delete = $_POST['action'] == "delete" ? "disabled" : ""; |
|
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <!-- header --> |
32 | -<div class="pHeader"><?php print _('Active Directory connection settings'); ?></div> |
|
32 | +<div class="pHeader"><?php print _ ('Active Directory connection settings'); ?></div> |
|
33 | 33 | |
34 | 34 | <!-- content --> |
35 | 35 | <div class="pContent"> |
36 | 36 | |
37 | 37 | <?php |
38 | 38 | # make sure LDAP is supported ! |
39 | - if (!in_array("ldap", get_loaded_extensions())) { $Result->show("danger", _("ldap extension not enabled in php")."!<hr>", false); } |
|
39 | + if (!in_array ("ldap", get_loaded_extensions ())) { $Result->show ("danger", _ ("ldap extension not enabled in php")."!<hr>", false); } |
|
40 | 40 | ?> |
41 | 41 | |
42 | 42 | <form id="editAuthMethod" name="editAuthMethod"> |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | |
45 | 45 | <!-- description --> |
46 | 46 | <tr> |
47 | - <td><?php print _('Description'); ?></td> |
|
47 | + <td><?php print _ ('Description'); ?></td> |
|
48 | 48 | <td> |
49 | 49 | <input type="text" name="description" class="form-control input-sm" value="<?php print @$method_settings->description; ?>" <?php print $delete; ?>> |
50 | 50 | </td> |
51 | 51 | <td class="base_dn info2"> |
52 | - <?php print _('Set name for authentication method'); ?> |
|
52 | + <?php print _ ('Set name for authentication method'); ?> |
|
53 | 53 | </td> |
54 | 54 | </tr> |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | <!-- DC --> |
61 | 61 | <tr> |
62 | - <td style="width:130px;"><?php print _('Domain controllers'); ?></td> |
|
62 | + <td style="width:130px;"><?php print _ ('Domain controllers'); ?></td> |
|
63 | 63 | <td style="width:250px;"> |
64 | 64 | <input type="text" name="domain_controllers" class="form-control input-sm" value="<?php print @$method_settings->params->domain_controllers; ?>" <?php print $delete; ?>> |
65 | 65 | <input type="hidden" name="type" value="AD"> |
@@ -67,70 +67,70 @@ discard block |
||
67 | 67 | <input type="hidden" name="action" value="<?php print @$_POST['action']; ?>"> |
68 | 68 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
69 | 69 | </td> |
70 | - <td class="info2"><?php print _('Enter domain controllers, separated by ;'); ?> |
|
70 | + <td class="info2"><?php print _ ('Enter domain controllers, separated by ;'); ?> |
|
71 | 71 | </td> |
72 | 72 | </tr> |
73 | 73 | |
74 | 74 | <!-- BasedN --> |
75 | 75 | <tr> |
76 | - <td><?php print _('Base DN'); ?></td> |
|
76 | + <td><?php print _ ('Base DN'); ?></td> |
|
77 | 77 | <td> |
78 | 78 | <input type="text" name="base_dn" class="form-control input-sm" value="<?php print @$method_settings->params->base_dn; ?>" <?php print $delete; ?>> |
79 | 79 | </td> |
80 | 80 | <td class="base_dn info2"> |
81 | - <?php print _('Enter base DN for LDAP'); ?> |
|
81 | + <?php print _ ('Enter base DN for LDAP'); ?> |
|
82 | 82 | </td> |
83 | 83 | </tr> |
84 | 84 | |
85 | 85 | <!-- Account suffix --> |
86 | 86 | <tr> |
87 | - <td><?php print _('Account suffix'); ?></td> |
|
87 | + <td><?php print _ ('Account suffix'); ?></td> |
|
88 | 88 | <td> |
89 | 89 | <input type="text" name="account_suffix" class="form-control input-sm" value="<?php print @$method_settings->params->account_suffix; ?>" <?php print $delete; ?>> |
90 | 90 | </td> |
91 | 91 | <td class="info2"> |
92 | - <?php print _('The account suffix for your domain'); ?> |
|
92 | + <?php print _ ('The account suffix for your domain'); ?> |
|
93 | 93 | </td> |
94 | 94 | </tr> |
95 | 95 | |
96 | 96 | |
97 | 97 | <!-- SSL --> |
98 | 98 | <tr> |
99 | - <td><?php print _('Use SSL'); ?></td> |
|
99 | + <td><?php print _ ('Use SSL'); ?></td> |
|
100 | 100 | <td> |
101 | 101 | <select name="use_ssl" class="form-control input-sm input-w-auto" <?php print $delete; ?>> |
102 | - <option value="0" <?php if(@$method_settings->params->use_ssl == 0) { print 'selected'; } ?>><?php print _('false'); ?></option> |
|
103 | - <option value="1" <?php if(@$method_settings->params->use_ssl == 1) { print 'selected'; } ?>><?php print _('true'); ?></option> |
|
102 | + <option value="0" <?php if (@$method_settings->params->use_ssl == 0) { print 'selected'; } ?>><?php print _ ('false'); ?></option> |
|
103 | + <option value="1" <?php if (@$method_settings->params->use_ssl == 1) { print 'selected'; } ?>><?php print _ ('true'); ?></option> |
|
104 | 104 | </select> |
105 | 105 | </td> |
106 | 106 | <td class="info2"> |
107 | - <?php print _('Use SSL (LDAPS), your server needs to be setup (default: false)'); ?><br> |
|
107 | + <?php print _ ('Use SSL (LDAPS), your server needs to be setup (default: false)'); ?><br> |
|
108 | 108 | </td> |
109 | 109 | </tr> |
110 | 110 | |
111 | 111 | <!-- TLS --> |
112 | 112 | <tr> |
113 | - <td><?php print _('Use TLS'); ?></td> |
|
113 | + <td><?php print _ ('Use TLS'); ?></td> |
|
114 | 114 | <td> |
115 | 115 | <select name="use_tls" class="form-control input-sm input-w-auto" <?php print $delete; ?>> |
116 | - <option value="0" <?php if(@$method_settings->params->use_tls == 0) { print 'selected'; } ?>><?php print _('false'); ?></option> |
|
117 | - <option value="1" <?php if(@$method_settings->params->use_tls == 1) { print 'selected'; } ?>><?php print _('true'); ?></option> |
|
116 | + <option value="0" <?php if (@$method_settings->params->use_tls == 0) { print 'selected'; } ?>><?php print _ ('false'); ?></option> |
|
117 | + <option value="1" <?php if (@$method_settings->params->use_tls == 1) { print 'selected'; } ?>><?php print _ ('true'); ?></option> |
|
118 | 118 | </select> |
119 | 119 | </td> |
120 | 120 | <td class="info2"> |
121 | - <?php print _('If you wish to use TLS you should ensure that useSSL is set to false and vice-versa (default: false)'); ?> |
|
121 | + <?php print _ ('If you wish to use TLS you should ensure that useSSL is set to false and vice-versa (default: false)'); ?> |
|
122 | 122 | </td> |
123 | 123 | </tr> |
124 | 124 | |
125 | 125 | |
126 | 126 | <!-- AD port --> |
127 | 127 | <tr> |
128 | - <td><?php print _('AD port'); ?></td> |
|
128 | + <td><?php print _ ('AD port'); ?></td> |
|
129 | 129 | <td> |
130 | 130 | <input type="text" name="ad_port" class="form-control input-sm input-w-100" value="<?php print @$method_settings->params->ad_port; ?>" <?php print $delete; ?>> |
131 | 131 | </td> |
132 | 132 | <td class="port info2"> |
133 | - <?php print _('The default port for LDAP non-SSL connections'); ?> |
|
133 | + <?php print _ ('The default port for LDAP non-SSL connections'); ?> |
|
134 | 134 | </td> |
135 | 135 | </tr> |
136 | 136 | |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | </tr> |
141 | 141 | <!-- Username --> |
142 | 142 | <tr> |
143 | - <td><?php print _('Domain account'); ?></td> |
|
143 | + <td><?php print _ ('Domain account'); ?></td> |
|
144 | 144 | <td> |
145 | - <input type="text" name="adminUsername" class="form-control input-sm" style="margin-bottom:5px;" placeholder="<?php print _('Username'); ?>" value="<?php print @$method_settings->params->adminUsername; ?>" <?php print $delete; ?>> |
|
146 | - <input type="password" name="adminPassword" class="form-control input-sm" placeholder="<?php print _('Password'); ?>" value="<?php print @$method_settings->params->adminPassword; ?>" <?php print $delete; ?>> |
|
145 | + <input type="text" name="adminUsername" class="form-control input-sm" style="margin-bottom:5px;" placeholder="<?php print _ ('Username'); ?>" value="<?php print @$method_settings->params->adminUsername; ?>" <?php print $delete; ?>> |
|
146 | + <input type="password" name="adminPassword" class="form-control input-sm" placeholder="<?php print _ ('Password'); ?>" value="<?php print @$method_settings->params->adminPassword; ?>" <?php print $delete; ?>> |
|
147 | 147 | </td> |
148 | 148 | <td class="info2"> |
149 | - <?php print _('Domain account for search operations (optional)'); ?> |
|
149 | + <?php print _ ('Domain account for search operations (optional)'); ?> |
|
150 | 150 | </td> |
151 | 151 | </tr> |
152 | 152 | |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | <!-- footer --> |
159 | 159 | <div class="pFooter"> |
160 | 160 | <div class="btn-group"> |
161 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
162 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editAuthMethodSubmit"><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> |
|
161 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
162 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editAuthMethodSubmit"><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> |
|
163 | 163 | </div> |
164 | 164 | |
165 | 165 | <?php |
166 | - if($_POST['action']=="delete") { |
|
166 | + if ($_POST['action'] == "delete") { |
|
167 | 167 | # check for mathing users |
168 | 168 | $users = $Admin->fetch_multiple_objects ("users", "authMethod", @$method_settings->id); |
169 | - if($users!==false) { |
|
170 | - $Result->show("warning", sizeof($users)._(" users have this method for logging in. They will be reset to local auth!"), false); |
|
169 | + if ($users !== false) { |
|
170 | + $Result->show ("warning", sizeof ($users)._ (" users have this method for logging in. They will be reset to local auth!"), false); |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | ?> |
@@ -1,23 +1,23 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | # verify that user is logged in |
4 | -$User->check_user_session(); |
|
4 | +$User->check_user_session (); |
|
5 | 5 | |
6 | 6 | # fetch all auth methods |
7 | -$all_methods = $Admin->fetch_all_objects("usersAuthMethod"); |
|
7 | +$all_methods = $Admin->fetch_all_objects ("usersAuthMethod"); |
|
8 | 8 | # fetch all parameters for each method |
9 | -$all_method_types = $User->fetch_available_auth_method_types(); |
|
9 | +$all_method_types = $User->fetch_available_auth_method_types (); |
|
10 | 10 | ?> |
11 | 11 | |
12 | 12 | |
13 | -<h4><?php print _("Authentication methods"); ?></h4> |
|
13 | +<h4><?php print _ ("Authentication methods"); ?></h4> |
|
14 | 14 | <hr> |
15 | 15 | |
16 | 16 | <!-- Add new --> |
17 | 17 | <div class="btn-group" style="margin-bottom: 20px;"> |
18 | 18 | <?php |
19 | -foreach($all_method_types as $type) { |
|
20 | - print "<button class='btn btn-sm btn-default editAuthMethod' style='margin-bottom:10px;' data-action='add' data-type='$type'><i class='fa fa-plus'></i> "._("Create new $type authentication")."</button>"; |
|
19 | +foreach ($all_method_types as $type) { |
|
20 | + print "<button class='btn btn-sm btn-default editAuthMethod' style='margin-bottom:10px;' data-action='add' data-type='$type'><i class='fa fa-plus'></i> "._ ("Create new $type authentication")."</button>"; |
|
21 | 21 | } |
22 | 22 | ?> |
23 | 23 | </div> |
@@ -27,23 +27,23 @@ discard block |
||
27 | 27 | |
28 | 28 | <!-- Headers --> |
29 | 29 | <tr> |
30 | - <th><?php print _('Type'); ?></th> |
|
31 | - <th><?php print _('Description'); ?></th> |
|
32 | - <th><?php print _('Parameters'); ?></th> |
|
33 | - <th><?php print _('Users'); ?></th> |
|
34 | - <th><?php print _('Protected'); ?></th> |
|
30 | + <th><?php print _ ('Type'); ?></th> |
|
31 | + <th><?php print _ ('Description'); ?></th> |
|
32 | + <th><?php print _ ('Parameters'); ?></th> |
|
33 | + <th><?php print _ ('Users'); ?></th> |
|
34 | + <th><?php print _ ('Protected'); ?></th> |
|
35 | 35 | <th></th> |
36 | 36 | </tr> |
37 | 37 | |
38 | 38 | <!-- data --> |
39 | 39 | <?php |
40 | 40 | //loop |
41 | -foreach($all_methods as $method) { |
|
41 | +foreach ($all_methods as $method) { |
|
42 | 42 | //set protected |
43 | - $protected_class = $method->protected=="yes" ? "danger" : ""; |
|
43 | + $protected_class = $method->protected == "yes" ? "danger" : ""; |
|
44 | 44 | |
45 | 45 | //number of users |
46 | - $user_num = $Database->numObjectsFilter("users", "authMethod", $method->id); |
|
46 | + $user_num = $Database->numObjectsFilter ("users", "authMethod", $method->id); |
|
47 | 47 | |
48 | 48 | print "<tr>"; |
49 | 49 | print " <td>$method->type</td>"; |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | //parameters |
52 | 52 | print " <td>"; |
53 | 53 | print " <span class='text-muted'>"; |
54 | - if(strlen($method->params)>0) { |
|
55 | - $params = json_decode($method->params); |
|
56 | - foreach($params as $key=>$parameter) { |
|
54 | + if (strlen ($method->params) > 0) { |
|
55 | + $params = json_decode ($method->params); |
|
56 | + foreach ($params as $key=>$parameter) { |
|
57 | 57 | // mask user/pass |
58 | - if($key=="adminPassword") { $parameter = "********"; } |
|
58 | + if ($key == "adminPassword") { $parameter = "********"; } |
|
59 | 59 | |
60 | 60 | print $key." => ".$parameter."<br>"; |
61 | 61 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | print " <td class='$protected_class'>$user_num</td>"; |
69 | 69 | print " <td class='$protected_class'>$method->protected</td>"; |
70 | 70 | //actions |
71 | - $disabled = $method->type=="local" ? "disabled" : ""; |
|
71 | + $disabled = $method->type == "local" ? "disabled" : ""; |
|
72 | 72 | print " <td class='actions'>"; |
73 | 73 | print " <div class='btn-group'>"; |
74 | 74 | print " <button class='btn btn-xs btn-default editAuthMethod' data-id='$method->id' data-action='edit' data-type='$method->type' rel='tooltip' title='Edit'><i class='fa fa-pencil'></i></button>"; |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | |
85 | 85 | <hr> |
86 | 86 | <div class="alert alert-info alert-absolute" style="margin-top:30px;"> |
87 | - <?php print _("Here you can set different authentication methods for your users."); ?> |
|
87 | + <?php print _ ("Here you can set different authentication methods for your users."); ?> |
|
88 | 88 | <hr> |
89 | - <?php print _("phpIPAM currently supports 6 methods for authentication:"); ?> |
|
89 | + <?php print _ ("phpIPAM currently supports 6 methods for authentication:"); ?> |
|
90 | 90 | <ul> |
91 | - <li><?php print _("Local authentication"); ?></li> |
|
92 | - <li><?php print _("Apache authentication"); ?></li> |
|
93 | - <li><?php print _("AD (Active Directory) authentication"); ?></li> |
|
94 | - <li><?php print _("LDAP authentication"); ?></li> |
|
95 | - <li><?php print _("NetIQ authentication"); ?></li> |
|
96 | - <li><?php print _("Radius authentication"); ?></li> |
|
91 | + <li><?php print _ ("Local authentication"); ?></li> |
|
92 | + <li><?php print _ ("Apache authentication"); ?></li> |
|
93 | + <li><?php print _ ("AD (Active Directory) authentication"); ?></li> |
|
94 | + <li><?php print _ ("LDAP authentication"); ?></li> |
|
95 | + <li><?php print _ ("NetIQ authentication"); ?></li> |
|
96 | + <li><?php print _ ("Radius authentication"); ?></li> |
|
97 | 97 | </ul> |
98 | 98 | <br> |
99 | - <?php print _("For AD/LDAP/NetIQ connection phpipam is using adLDAP, for documentation please check ")."<a href='http://adldap.sourceforge.net/'>adLDAP</a><br><br>"; ?> |
|
100 | - <?php print _('First create new user under user management with <u>same username as on AD</u> and set authention type to one of available methods.')."<br>"._('Also set proper permissions - group membership for new user'); ?> |
|
99 | + <?php print _ ("For AD/LDAP/NetIQ connection phpipam is using adLDAP, for documentation please check ")."<a href='http://adldap.sourceforge.net/'>adLDAP</a><br><br>"; ?> |
|
100 | + <?php print _ ('First create new user under user management with <u>same username as on AD</u> and set authention type to one of available methods.')."<br>"._ ('Also set proper permissions - group membership for new user'); ?> |
|
101 | 101 | </div> |
@@ -7,50 +7,50 @@ |
||
7 | 7 | |
8 | 8 | |
9 | 9 | /* functions */ |
10 | -require( dirname(__FILE__) . '/../../../functions/functions.php'); |
|
10 | +require(dirname (__FILE__).'/../../../functions/functions.php'); |
|
11 | 11 | |
12 | 12 | # initialize user object |
13 | -$Database = new Database_PDO; |
|
14 | -$User = new User ($Database); |
|
13 | +$Database = new Database_PDO; |
|
14 | +$User = new User ($Database); |
|
15 | 15 | $Admin = new Admin ($Database); |
16 | 16 | $Result = new Result (); |
17 | 17 | |
18 | 18 | # verify that user is logged in |
19 | -$User->check_user_session(); |
|
19 | +$User->check_user_session (); |
|
20 | 20 | |
21 | 21 | # feth settings |
22 | 22 | $auth_settings = $Admin->fetch_object ("usersAuthMethod", "id", $_POST['id']); |
23 | -if($auth_settings===false) { $Result->show("danger", _("Invalid ID"), true, true); } |
|
23 | +if ($auth_settings === false) { $Result->show ("danger", _ ("Invalid ID"), true, true); } |
|
24 | 24 | //set params |
25 | -$parameters = json_decode($auth_settings->params); |
|
25 | +$parameters = json_decode ($auth_settings->params); |
|
26 | 26 | |
27 | 27 | # AD? |
28 | -if($auth_settings->type=="AD" || $auth_settings->type=="LDAP" || $auth_settings->type=="NetIQ") { |
|
28 | +if ($auth_settings->type == "AD" || $auth_settings->type == "LDAP" || $auth_settings->type == "NetIQ") { |
|
29 | 29 | # adLDAP function |
30 | - include (dirname(__FILE__) . "/../../../functions/adLDAP/src/adLDAP.php"); |
|
30 | + include (dirname (__FILE__)."/../../../functions/adLDAP/src/adLDAP.php"); |
|
31 | 31 | # set controllers |
32 | - $controllers = explode(";", str_replace(" ", "", $parameters->domain_controllers)); |
|
32 | + $controllers = explode (";", str_replace (" ", "", $parameters->domain_controllers)); |
|
33 | 33 | |
34 | 34 | //open connection |
35 | 35 | try { |
36 | - $adldap = new adLDAP(array( 'base_dn'=>$parameters->base_dn, 'account_suffix'=>@$parameters->account_suffix, |
|
36 | + $adldap = new adLDAP (array ('base_dn'=>$parameters->base_dn, 'account_suffix'=>@$parameters->account_suffix, |
|
37 | 37 | 'domain_controllers'=>$controllers, 'use_ssl'=>$parameters->use_ssl, |
38 | 38 | 'use_tls'=> $parameters->use_tls, 'ad_port'=> $parameters->ad_port |
39 | 39 | )); |
40 | 40 | //LDAP? |
41 | - if($auth_settings->type=="LDAP") $adldap->setUseOpenLDAP(true); |
|
41 | + if ($auth_settings->type == "LDAP") $adldap->setUseOpenLDAP (true); |
|
42 | 42 | |
43 | 43 | } catch (adLDAPException $e) { |
44 | 44 | //catch AD error |
45 | - $Result->show("danger", $e, true, true); |
|
45 | + $Result->show ("danger", $e, true, true); |
|
46 | 46 | } |
47 | 47 | //result |
48 | - foreach($controllers as $c) { |
|
49 | - if($fp = @fsockopen($c, $parameters->ad_port, $errno, $errstr, 3)==false) { $Result->show("danger", "$c: $errstr ($errno)", false, true); } |
|
50 | - else { $Result->show("success", "$c: "._('AD network connection ok')."!", false, true); } |
|
48 | + foreach ($controllers as $c) { |
|
49 | + if ($fp = @fsockopen ($c, $parameters->ad_port, $errno, $errstr, 3) == false) { $Result->show ("danger", "$c: $errstr ($errno)", false, true); } |
|
50 | + else { $Result->show ("success", "$c: "._ ('AD network connection ok')."!", false, true); } |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | else { |
54 | - $Result->show("danger", _("Check for not implemented"), true, true); |
|
54 | + $Result->show ("danger", _ ("Check for not implemented"), true, true); |
|
55 | 55 | } |
56 | 56 | ?> |
57 | 57 | \ No newline at end of file |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | *****************/ |
6 | 6 | |
7 | 7 | # verify that user is logged in |
8 | -$User->check_user_session(); |
|
8 | +$User->check_user_session (); |
|
9 | 9 | |
10 | 10 | # ID must be numeric */ |
11 | -if($_POST['action']!="add") { |
|
12 | - if(!is_numeric($_POST['id'])) { $Result->show("danger", _("Invalid ID"), true, true); } |
|
11 | +if ($_POST['action'] != "add") { |
|
12 | + if (!is_numeric ($_POST['id'])) { $Result->show ("danger", _ ("Invalid ID"), true, true); } |
|
13 | 13 | |
14 | 14 | # feth method settings |
15 | 15 | $method_settings = $Admin->fetch_object ("usersAuthMethod", "id", $_POST['id']); |
16 | - $method_settings->params = json_decode($method_settings->params); |
|
16 | + $method_settings->params = json_decode ($method_settings->params); |
|
17 | 17 | } |
18 | 18 | else { |
19 | 19 | $method_settings = new StdClass (); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | # set delete flag |
28 | -$delete = $_POST['action']=="delete" ? "disabled" : ""; |
|
28 | +$delete = $_POST['action'] == "delete" ? "disabled" : ""; |
|
29 | 29 | ?> |
30 | 30 | |
31 | 31 | <!-- header --> |
32 | -<div class="pHeader"><?php print _('LDAP connection settings'); ?></div> |
|
32 | +<div class="pHeader"><?php print _ ('LDAP connection settings'); ?></div> |
|
33 | 33 | |
34 | 34 | <script> |
35 | 35 | $( "select#ldap_security" ).change(function () { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | <?php |
48 | 48 | # make sure LDAP is supported ! |
49 | - if (!in_array("ldap", get_loaded_extensions())) { $Result->show("danger", _("ldap extension not enabled in php")."!<hr>", false); } |
|
49 | + if (!in_array ("ldap", get_loaded_extensions ())) { $Result->show ("danger", _ ("ldap extension not enabled in php")."!<hr>", false); } |
|
50 | 50 | ?> |
51 | 51 | |
52 | 52 | <form id="editAuthMethod" name="editAuthMethod"> |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | |
55 | 55 | <!-- description --> |
56 | 56 | <tr> |
57 | - <td><?php print _('Description'); ?></td> |
|
57 | + <td><?php print _ ('Description'); ?></td> |
|
58 | 58 | <td> |
59 | 59 | <input type="text" name="description" class="form-control input-sm" value="<?php print @$method_settings->description; ?>" <?php print $delete; ?>> |
60 | 60 | </td> |
61 | 61 | <td class="base_dn info2"> |
62 | - <?php print _('Set name for authentication method'); ?> |
|
62 | + <?php print _ ('Set name for authentication method'); ?> |
|
63 | 63 | </td> |
64 | 64 | </tr> |
65 | 65 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | <!-- DC --> |
71 | 71 | <tr> |
72 | - <td style="width:130px;"><?php print _('LDAP servers'); ?></td> |
|
72 | + <td style="width:130px;"><?php print _ ('LDAP servers'); ?></td> |
|
73 | 73 | <td style="width:250px;"> |
74 | 74 | <input type="text" name="domain_controllers" class="form-control input-sm" value="<?php print @$method_settings->params->domain_controllers; ?>" <?php print $delete; ?>> |
75 | 75 | <input type="hidden" name="type" value="LDAP"> |
@@ -77,66 +77,66 @@ discard block |
||
77 | 77 | <input type="hidden" name="action" value="<?php print @$_POST['action']; ?>"> |
78 | 78 | <input type="hidden" name="csrf_cookie" value="<?php print $csrf; ?>"> |
79 | 79 | </td> |
80 | - <td class="info2"><?php print _('LDAP hosts, separated by a semicolon (;)'); ?> |
|
80 | + <td class="info2"><?php print _ ('LDAP hosts, separated by a semicolon (;)'); ?> |
|
81 | 81 | </td> |
82 | 82 | </tr> |
83 | 83 | |
84 | 84 | <!-- BaseDN --> |
85 | 85 | <tr> |
86 | - <td><?php print _('Base DN'); ?></td> |
|
86 | + <td><?php print _ ('Base DN'); ?></td> |
|
87 | 87 | <td> |
88 | 88 | <input type="text" name="base_dn" class="form-control input-sm" value="<?php print @$method_settings->params->base_dn; ?>" <?php print $delete; ?>> |
89 | 89 | </td> |
90 | 90 | <td class="base_dn info2"> |
91 | - <?php print _('Base DN for your directory'); ?> |
|
91 | + <?php print _ ('Base DN for your directory'); ?> |
|
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | |
95 | 95 | <!-- UsersDN --> |
96 | 96 | <tr> |
97 | - <td><?php print _('Users DN'); ?></td> |
|
97 | + <td><?php print _ ('Users DN'); ?></td> |
|
98 | 98 | <td> |
99 | 99 | <input type="text" name="users_base_dn" class="form-control input-sm" value="<?php print @$method_settings->params->users_base_dn; ?>" <?php print $delete; ?>> |
100 | 100 | </td> |
101 | 101 | <td class="users_base_dn info2"> |
102 | - <?php print _('Base DN for your users, if different from the base DN above.'); ?> |
|
102 | + <?php print _ ('Base DN for your users, if different from the base DN above.'); ?> |
|
103 | 103 | </td> |
104 | 104 | </tr> |
105 | 105 | |
106 | 106 | <!-- UIDAttr --> |
107 | 107 | <tr> |
108 | - <td><?php print _('UID Attribute'); ?></td> |
|
108 | + <td><?php print _ ('UID Attribute'); ?></td> |
|
109 | 109 | <td> |
110 | 110 | <input type="text" name="uid_attr" class="form-control input-sm" value="<?php print @$method_settings->params->uid_attr; ?>" <?php print $delete; ?>> |
111 | 111 | </td> |
112 | 112 | <td class="uid_attr_dn info2"> |
113 | - <?php print _('LDAP uid naming attribute for users, e.g. "uid" or "cn"'); ?> |
|
113 | + <?php print _ ('LDAP uid naming attribute for users, e.g. "uid" or "cn"'); ?> |
|
114 | 114 | </td> |
115 | 115 | </tr> |
116 | 116 | |
117 | 117 | <!-- TLS --> |
118 | 118 | <tr> |
119 | - <td><?php print _('LDAP Security Type'); ?></td> |
|
119 | + <td><?php print _ ('LDAP Security Type'); ?></td> |
|
120 | 120 | <td> |
121 | 121 | <select id='ldap_security' name="ldap_security" class="form-control input-sm input-w-auto" <?php print $delete; ?>> |
122 | - <option name="ldap_security" class="form-control input-sm input-w-auto" value="tls" <?php if(@$method_settings->params->ldap_security == 'tls') { print 'selected'; } ?>>TLS</option> |
|
123 | - <option name="ldap_security" class="form-control input-sm input-w-auto" value="ssl" <?php if(@$method_settings->params->ldap_security == 'ssl') { print 'selected'; } ?>>SSL</option> |
|
124 | - <option name="ldap_security" class="form-control input-sm input-w-auto" value="none" <?php if(@$method_settings->params->ldap_security == 'none') { print 'selected'; } ?>>None</option> |
|
122 | + <option name="ldap_security" class="form-control input-sm input-w-auto" value="tls" <?php if (@$method_settings->params->ldap_security == 'tls') { print 'selected'; } ?>>TLS</option> |
|
123 | + <option name="ldap_security" class="form-control input-sm input-w-auto" value="ssl" <?php if (@$method_settings->params->ldap_security == 'ssl') { print 'selected'; } ?>>SSL</option> |
|
124 | + <option name="ldap_security" class="form-control input-sm input-w-auto" value="none" <?php if (@$method_settings->params->ldap_security == 'none') { print 'selected'; } ?>>None</option> |
|
125 | 125 | </select> |
126 | 126 | </td> |
127 | 127 | <td class="info2"> |
128 | - <?php print _('SSL, TLS, or None (default: TLS)'); ?> |
|
128 | + <?php print _ ('SSL, TLS, or None (default: TLS)'); ?> |
|
129 | 129 | </td> |
130 | 130 | </tr> |
131 | 131 | |
132 | 132 | <!-- LDAP port --> |
133 | 133 | <tr> |
134 | - <td><?php print _('LDAP port'); ?></td> |
|
134 | + <td><?php print _ ('LDAP port'); ?></td> |
|
135 | 135 | <td> |
136 | 136 | <input type="text" id="ad_port" name="ad_port" class="form-control input-sm input-w-100" value="<?php print @$method_settings->params->ad_port; ?>" <?php print $delete; ?>> |
137 | 137 | </td> |
138 | 138 | <td class="port info2"> |
139 | - <?php print _('Listening port for your LDAP service. TLS/unencrypted Default: 389 <br /> SSL Default: 636'); ?> |
|
139 | + <?php print _ ('Listening port for your LDAP service. TLS/unencrypted Default: 389 <br /> SSL Default: 636'); ?> |
|
140 | 140 | </td> |
141 | 141 | </tr> |
142 | 142 | |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | </tr> |
146 | 146 | <!-- Username --> |
147 | 147 | <tr> |
148 | - <td><?php print _('Bind user'); ?></td> |
|
148 | + <td><?php print _ ('Bind user'); ?></td> |
|
149 | 149 | <td> |
150 | - <input type="text" name="adminUsername" class="form-control input-sm" style="margin-bottom:5px;" placeholder="<?php print _('Username'); ?>" value="<?php print @$method_settings->params->adminUsername; ?>" <?php print $delete; ?>> |
|
150 | + <input type="text" name="adminUsername" class="form-control input-sm" style="margin-bottom:5px;" placeholder="<?php print _ ('Username'); ?>" value="<?php print @$method_settings->params->adminUsername; ?>" <?php print $delete; ?>> |
|
151 | 151 | </td> |
152 | 152 | <td class="info2"> |
153 | - <?php print _('User DN to bind as for search operations (optional). '); ?> |
|
153 | + <?php print _ ('User DN to bind as for search operations (optional). '); ?> |
|
154 | 154 | </td> |
155 | 155 | </tr> |
156 | 156 | |
157 | 157 | <!-- Username --> |
158 | 158 | <tr> |
159 | - <td><?php print _('Bind password'); ?></td> |
|
159 | + <td><?php print _ ('Bind password'); ?></td> |
|
160 | 160 | <td> |
161 | - <input type="password" name="adminPassword" class="form-control input-sm" placeholder="<?php print _('Password'); ?>" value="<?php print @$method_settings->params->adminPassword; ?>" <?php print $delete; ?>> |
|
161 | + <input type="password" name="adminPassword" class="form-control input-sm" placeholder="<?php print _ ('Password'); ?>" value="<?php print @$method_settings->params->adminPassword; ?>" <?php print $delete; ?>> |
|
162 | 162 | </td> |
163 | 163 | <td class="info2"> |
164 | - <?php print _('Password for the bind account (only required if bind user is set).'); ?> |
|
164 | + <?php print _ ('Password for the bind account (only required if bind user is set).'); ?> |
|
165 | 165 | </td> |
166 | 166 | </tr> |
167 | 167 | |
@@ -173,16 +173,16 @@ discard block |
||
173 | 173 | <!-- footer --> |
174 | 174 | <div class="pFooter"> |
175 | 175 | <div class="btn-group"> |
176 | - <button class="btn btn-sm btn-default hidePopups"><?php print _('Cancel'); ?></button> |
|
177 | - <button class="btn btn-sm btn-default <?php if($_POST['action']=="delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editAuthMethodSubmit"><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> |
|
176 | + <button class="btn btn-sm btn-default hidePopups"><?php print _ ('Cancel'); ?></button> |
|
177 | + <button class="btn btn-sm btn-default <?php if ($_POST['action'] == "delete") { print "btn-danger"; } else { print "btn-success"; } ?>" id="editAuthMethodSubmit"><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> |
|
178 | 178 | </div> |
179 | 179 | |
180 | 180 | <?php |
181 | - if($_POST['action']=="delete") { |
|
181 | + if ($_POST['action'] == "delete") { |
|
182 | 182 | # check for mathing users |
183 | 183 | $users = $Admin->fetch_multiple_objects ("users", "authMethod", @$method_settings->id); |
184 | - if($users!==false) { |
|
185 | - $Result->show("warning", sizeof($users)._(" users have this method for logging in. They will be reset to local auth!"), false); |
|
184 | + if ($users !== false) { |
|
185 | + $Result->show ("warning", sizeof ($users)._ (" users have this method for logging in. They will be reset to local auth!"), false); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | ?> |