Skip to content

Commit

Permalink
remove multiple warnings (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coutadeur committed Nov 4, 2024
1 parent c1ffc73 commit c7f563a
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions htdocs/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@

# Get password policy configuration
$pwdPolicyConfiguration = $directory->getPwdPolicyConfiguration($ldap, $dn, $ldap_default_ppolicy);
if ($ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_durantion; }
if ($ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }
if (isset($ldap_lockout_duration) and $ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_duration; }
if (isset($ldap_password_max_age) and $ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }

if ($display_edit_link) {
# Replace {dn} in URL
Expand Down
6 changes: 6 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
$smarty->setCompileDir($compile_dir);
$smarty->setCacheDir($cache_dir);
$smarty->debugging = $smarty_debug;
function sha256($string)
{
return hash("sha256",$string);
}
$smarty->registerPlugin("modifier","sha256", "sha256");
$smarty->registerPlugin("modifier","is_array", "is_array");

if(isset($smarty_debug) && $smarty_debug == true )
{
Expand Down
2 changes: 1 addition & 1 deletion htdocs/lockaccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
{
# Get password policy configuration
$pwdPolicyConfiguration = $directory->getPwdPolicyConfiguration($ldap, $dn, $ldap_default_ppolicy);
if ($ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_durantion; }
if ($ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_duration; }
if ($ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }

# Apply the modification only the password can be locked
Expand Down
4 changes: 2 additions & 2 deletions htdocs/searchexpired.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

# Get password policy configuration
$pwdPolicyConfiguration = $directory->getPwdPolicyConfiguration($ldap, $entry["dn"], $ldap_default_ppolicy);
if ($ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_durantion; }
if ($ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }
if (isset($ldap_lockout_duration) and $ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_duration; }
if (isset($ldap_password_max_age) and $ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }

$isExpired = $directory->isPasswordExpired($ldap, $entry["dn"], $pwdPolicyConfiguration);

Expand Down
4 changes: 2 additions & 2 deletions htdocs/searchlocked.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

# Get password policy configuration
$pwdPolicyConfiguration = $directory->getPwdPolicyConfiguration($ldap, $entry["dn"], $ldap_default_ppolicy);
if ($ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_durantion; }
if ($ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }
if (isset($ldap_lockout_duration) and $ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_duration; }
if (isset($ldap_password_max_age) and $ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }

$isLocked = $directory->isLocked($ldap, $entry['dn'], $pwdPolicyConfiguration);

Expand Down
4 changes: 2 additions & 2 deletions htdocs/searchwillexpire.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

# Get password policy configuration
$pwdPolicyConfiguration = $directory->getPwdPolicyConfiguration($ldap, $entry["dn"], $ldap_default_ppolicy);
if ($ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_durantion; }
if ($ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }
if (isset($ldap_lockout_duration) and $ldap_lockout_duration) { $pwdPolicyConfiguration['lockout_duration'] = $ldap_lockout_duration; }
if (isset($ldap_password_max_age) and $ldap_password_max_age) { $pwdPolicyConfiguration['password_max_age'] = $ldap_password_max_age; }

$isWillExpire = false;
$expirationDate = $directory->getPasswordExpirationDate($ldap, $entry["dn"], $pwdPolicyConfiguration);
Expand Down
4 changes: 2 additions & 2 deletions lib/audit.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function displayauditlog($audit_log_file, $audit_log_days, $audit_log_sortby, $a
}

function dateSort(array &$events, $sortkey, $audit_log_reverse) {
$reverse_order = fn($a, $b) => strtotime($a[$sortkey]) < strtotime($b[$sortkey]);
$normal_order = fn($a, $b) => strtotime($a[$sortkey]) > strtotime($b[$sortkey]);
$reverse_order = fn($a, $b) => strtotime($b[$sortkey]) <=> strtotime($a[$sortkey]);
$normal_order = fn($a, $b) => strtotime($a[$sortkey]) <=> strtotime($b[$sortkey]);

if ($audit_log_reverse) {
usort($events, $reverse_order);
Expand Down
2 changes: 1 addition & 1 deletion templates/comment.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<form id={$method} method="post" action="index.php?page={$page}">
<input type="hidden" name="dn" value="{$dn}" />
<input type="hidden" name="returnto" value="{$returnto}" />
<div class="modal fade" id="commentModal{$method}{$dn|sha1}" tabindex="-1" aria-labelledby="CommentModal{$method}{$dn|sha1}" aria-hidden="true">
<div class="modal fade" id="commentModal{$method}{$dn|sha256}" tabindex="-1" aria-labelledby="CommentModal{$method}{$dn|sha256}" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Expand Down
8 changes: 4 additions & 4 deletions templates/display.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotunlocked}</div>
{/if}
{if $use_unlockcomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModalunlock{$dn|sha1}">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModalunlock{$dn|sha256}">
<i class="fa fa-fw fa-unlock me-2"></i>{$msg_unlockaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down Expand Up @@ -277,7 +277,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotlocked}</div>
{/if}
{if $use_lockcomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModallock{$dn|sha1}">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModallock{$dn|sha256}">
<i class="fa fa-fw fa-lock me-2"></i>{$msg_lockaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down Expand Up @@ -326,7 +326,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotdisabled}</div>
{/if}
{if $use_disablecomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModaldisable{$dn|sha1}">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModaldisable{$dn|sha256}">
<i class="fa fa-fw fa-user-slash me-2"></i>{$msg_disableaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down Expand Up @@ -358,7 +358,7 @@
<div class="alert alert-danger"><i class="fa fa-fw fa-exclamation-triangle"></i> {$msg_accountnotenabled}</div>
{/if}
{if $use_enablecomment}
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModalenable{$dn|sha1}">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#commentModalenable{$dn|sha256}">
<i class="fa fa-fw fa-user-check me-2"></i>{$msg_enableaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary ms-2" title="{$msg_comment_needed}"></i>
</button>
Expand Down
4 changes: 2 additions & 2 deletions templates/listing_table.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</a>
{if $display_unlock_button}
{if $use_unlockcomment}
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#commentModalunlock{$entry.dn|sha1}">
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#commentModalunlock{$entry.dn|sha256}">
<i class="fa fa-fw fa-unlock"></i>{$msg_unlockaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary" title="{$msg_comment_needed}"></i>
</button>
Expand All @@ -32,7 +32,7 @@
{/if}
{if $display_enable_button}
{if $use_enablecomment}
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#commentModalenable{$entry.dn|sha1}">
<button type="button" class="btn btn-success btn-sm" data-bs-toggle="modal" data-bs-target="#commentModalenable{$entry.dn|sha256}">
<i class="fa fa-fw fa-user-check"></i>{$msg_enableaccount}
<i class="fa fa-fw fa-info-circle text-body-tertiary" title="{$msg_comment_needed}"></i>
</button>
Expand Down

0 comments on commit c7f563a

Please sign in to comment.