Skip to content

Commit 62ffb8e

Browse files
authored
Create a dedicated error page, and display some errors on current page (ltb-project#325)
1 parent b67ab82 commit 62ffb8e

13 files changed

Lines changed: 29 additions & 10 deletions

File tree

‎htdocs/create.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
$dn = "";
88
$entry = "";
99
$action = "displayform";
10-
$result = "";
1110
$branch_list = "";
1211

1312
if (isset($_POST["action"]) and $_POST["action"]) {
@@ -91,9 +90,9 @@ function ($matches) use ($item, $create_attributes, $attributes_map) {
9190
if (!empty($missing_attributes)) {
9291
error_log("LDAP - create rejected for missing mandatory attributes: " . implode(", ", $missing_attributes));
9392
$result = "mandatoryattributerequired";
94-
$action = "displayform";
95-
} else {
96-
# Create entry
93+
$action = "displayform";
94+
} else {
95+
# Create entry
9796
if (!ldap_add($ldap, $dn, $create_attributes)) {
9897
error_log("LDAP - create failed for $dn");
9998
$result = "createfailed";

‎htdocs/delete.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
isset($hook_config['deleteAccount']['before']['displayError']) and
8686
$hook_config['deleteAccount']['before']['displayError'] and
8787
$prehook_return > 0 ) {
88-
$location .= '&prehookdeleteresult='.$prehook_message;
88+
$location .= '&prehookdeleteresult='.$prehook_message;
8989
}
9090
if ( isset($posthook_return) and
9191
isset($hook_config['deleteAccount']['after']['displayError']) and

‎htdocs/display.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
$dn = $entry_dn;
5050
} else {
5151
$result = "dnrequired";
52+
$page = "error";
5253
}
5354

5455
if (isset($_GET["checkpasswordresult"]) and $_GET["checkpasswordresult"]) {
@@ -184,6 +185,7 @@
184185
# DN match
185186
if ( !$ldapInstance->matchDn($dn, $dnAttribute, $ldap_user_filter, $ldap_user_base, $ldap_scope) ) {
186187
$result = "noentriesfound";
188+
$page = "error";
187189
error_log("LDAP - $dn not found using the configured search settings, reject request");
188190
} else {
189191

@@ -208,6 +210,7 @@
208210

209211
if ( $errno ) {
210212
$result = "ldaperror";
213+
$page = "error";
211214
error_log("LDAP - Search error $errno (".ldap_error($ldap).")");
212215
} else {
213216

‎htdocs/groups.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
$dn = $entry_dn;
1818
} else {
1919
$result = "dnrequired";
20+
$page = "error";
2021
}
2122

2223
if ($result === "") {
@@ -35,6 +36,7 @@
3536
# DN match
3637
if ( !$ldapInstance->matchDn($dn, $dnAttribute, $ldap_user_filter, $ldap_user_base, $ldap_scope) ) {
3738
$result = "noentriesfound";
39+
$page = "error";
3840
error_log("LDAP - $dn not found using the configured search settings, reject request");
3941
}
4042
}

‎htdocs/rename.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
$dn = $entry_dn;
1919
} else {
2020
$result = "dnrequired";
21+
$page = "error";
2122
}
2223

2324
if ($result === "") {
@@ -38,6 +39,7 @@
3839
# DN match
3940
if ( !$ldapInstance->matchDn($dn, $dnAttribute, $ldap_user_filter, $ldap_user_base, $ldap_scope) ) {
4041
$result = "noentriesfound";
42+
$page = "error";
4143
error_log("LDAP - $dn not found using the configured search settings, reject request");
4244
} else {
4345

‎htdocs/update.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
$dn = $entry_dn;
1919
} else {
2020
$result = "dnrequired";
21+
$page = "error";
2122
}
2223

2324
if ($result === "") {
@@ -38,6 +39,7 @@
3839
# DN match
3940
if ( !$ldapInstance->matchDn($dn, $dnAttribute, $ldap_user_filter, $ldap_user_base, $ldap_scope) ) {
4041
$result = "noentriesfound";
42+
$page = "error";
4143
error_log("LDAP - $dn not found using the configured search settings, reject request");
4244
} else {
4345

‎lang/en.inc.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
$messages['groups'] = "groups";
6969
$messages['groupupdateerror'] = "Group not updated";
7070
$messages['groupupdatesuccess'] = "Group updated";
71+
$messages["home"] = "Home";
7172
$messages['hookerror'] = "An error occured in the hook";
7273
$messages['idleaccounts'] = "Idle accounts";
7374
$messages['idleaccountstitle'] = "Accounts idle for more than $idledays days";

‎lang/fr.inc.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
$messages['groups'] = "groupes";
6969
$messages['groupupdateerror'] = "Groupe non modifié";
7070
$messages['groupupdatesuccess'] = "Groupe modifié";
71+
$messages["home"] = "Accueil";
7172
$messages['hookerror'] = "Une erreur s'est produite dans le hook";
7273
$messages['idleaccounts'] = "Comptes inactifs";
7374
$messages['idleaccountstitle'] = "Comptes inactifs depuis plus de $idledays jours";

‎lang/ja.inc.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
$messages['groups'] = "groups";
6969
$messages['groupupdateerror'] = "Group not updated";
7070
$messages['groupupdatesuccess'] = "Group updated";
71+
$messages["home"] = "Home";
7172
$messages['hookerror'] = "このフックでエラーが発生";
7273
$messages['idleaccounts'] = "アイドル状態のアカウント";
7374
$messages['idleaccountstitle'] = "$idledays 日以上、アイドル状態のアカウント";

‎lang/no.inc.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
$messages['groups'] = "groups";
6969
$messages['groupupdateerror'] = "Group not updated";
7070
$messages['groupupdatesuccess'] = "Group updated";
71+
$messages["home"] = "Home";
7172
$messages['hookerror'] = "En feil oppstod i hooken";
7273
$messages['idleaccounts'] = "Inaktive kontoer";
7374
$messages['idleaccountstitle'] = "Kontoer inaktive i mer enn $idledays dager";

0 commit comments

Comments
 (0)