Empty to Not defined for constants
This commit is contained in:
parent
f562a093f8
commit
2f6aa596fe
11
plugin.php
11
plugin.php
@ -135,11 +135,11 @@ function ldapauth_is_valid_user( $value ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// session is only needed if we don't use usercache
|
// session is only needed if we don't use usercache
|
||||||
if (empty(LDAPAUTH_USERCACHE_TYPE)) {
|
if (!defined(LDAPAUTH_USERCACHE_TYPE)) {
|
||||||
@session_start();
|
@session_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty(LDAPAUTH_USERCACHE_TYPE) && isset( $_SESSION['LDAPAUTH_AUTH_USER'] ) ) {
|
if (!defined(LDAPAUTH_USERCACHE_TYPE) && isset( $_SESSION['LDAPAUTH_AUTH_USER'] ) ) {
|
||||||
// already authenticated...
|
// already authenticated...
|
||||||
$username = $_SESSION['LDAPAUTH_AUTH_USER'];
|
$username = $_SESSION['LDAPAUTH_AUTH_USER'];
|
||||||
// why is this checked here, but not before the cookie is set?
|
// why is this checked here, but not before the cookie is set?
|
||||||
@ -229,7 +229,7 @@ function ldapauth_is_valid_user( $value ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$yourls_user_passwords[$username] = ldapauth_hash_password($_REQUEST['password']);
|
$yourls_user_passwords[$username] = ldapauth_hash_password($_REQUEST['password']);
|
||||||
if (empty(LDAPAUTH_USERCACHE_TYPE)) {
|
if (!defined(LDAPAUTH_USERCACHE_TYPE)) {
|
||||||
$_SESSION['LDAPAUTH_AUTH_USER'] = $username;
|
$_SESSION['LDAPAUTH_AUTH_USER'] = $username;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -261,7 +261,7 @@ function ldapauth_is_authorized_user( $username ) {
|
|||||||
yourls_add_action( 'logout', 'ldapauth_logout_hook' );
|
yourls_add_action( 'logout', 'ldapauth_logout_hook' );
|
||||||
|
|
||||||
function ldapauth_logout_hook( $args ) {
|
function ldapauth_logout_hook( $args ) {
|
||||||
if (empty(LDAPAUTH_USERCACHE_TYPE)) {
|
if (!defined(LDAPAUTH_USERCACHE_TYPE)) {
|
||||||
unset($_SESSION['LDAPAUTH_AUTH_USER']);
|
unset($_SESSION['LDAPAUTH_AUTH_USER']);
|
||||||
setcookie('PHPSESSID', '', 0, '/');
|
setcookie('PHPSESSID', '', 0, '/');
|
||||||
}
|
}
|
||||||
@ -332,3 +332,6 @@ function ldapauth_debug ($msg) {
|
|||||||
error_log("yourls_ldap_auth: " . $msg);
|
error_log("yourls_ldap_auth: " . $msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user