mirror of
https://github.com/misterunknown/ifm.git
synced 2025-08-11 18:43:58 +02:00
Allow authentication via header for scripting purposes
This commit is contained in:
@@ -3985,6 +3985,12 @@ function IFM( params ) {
|
|||||||
if( $this->config['auth'] == 0 )
|
if( $this->config['auth'] == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if( isset( $_SERVER['HTTP_X_IFM_AUTH'] ) && ! empty( $_SERVER['HTTP_X_IFM_AUTH'] ) ) {
|
||||||
|
$cred = split( ":", base64_decode( $_SERVER['HTTP_X_IFM_AUTH'] ) );
|
||||||
|
if( count( $cred ) == 2 && $this->checkCredentials( $cred[0], $cred[1] ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if( session_status() !== PHP_SESSION_ACTIVE ) {
|
if( session_status() !== PHP_SESSION_ACTIVE ) {
|
||||||
if( isset( $this->config['session_lifetime'] ) )
|
if( isset( $this->config['session_lifetime'] ) )
|
||||||
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );
|
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );
|
||||||
|
6
ifm.php
6
ifm.php
@@ -3985,6 +3985,12 @@ function IFM( params ) {
|
|||||||
if( $this->config['auth'] == 0 )
|
if( $this->config['auth'] == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if( isset( $_SERVER['HTTP_X_IFM_AUTH'] ) && ! empty( $_SERVER['HTTP_X_IFM_AUTH'] ) ) {
|
||||||
|
$cred = split( ":", base64_decode( $_SERVER['HTTP_X_IFM_AUTH'] ) );
|
||||||
|
if( count( $cred ) == 2 && $this->checkCredentials( $cred[0], $cred[1] ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if( session_status() !== PHP_SESSION_ACTIVE ) {
|
if( session_status() !== PHP_SESSION_ACTIVE ) {
|
||||||
if( isset( $this->config['session_lifetime'] ) )
|
if( isset( $this->config['session_lifetime'] ) )
|
||||||
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );
|
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );
|
||||||
|
@@ -965,6 +965,12 @@ f00bar;
|
|||||||
if( $this->config['auth'] == 0 )
|
if( $this->config['auth'] == 0 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if( isset( $_SERVER['HTTP_X_IFM_AUTH'] ) && ! empty( $_SERVER['HTTP_X_IFM_AUTH'] ) ) {
|
||||||
|
$cred = split( ":", base64_decode( $_SERVER['HTTP_X_IFM_AUTH'] ) );
|
||||||
|
if( count( $cred ) == 2 && $this->checkCredentials( $cred[0], $cred[1] ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if( session_status() !== PHP_SESSION_ACTIVE ) {
|
if( session_status() !== PHP_SESSION_ACTIVE ) {
|
||||||
if( isset( $this->config['session_lifetime'] ) )
|
if( isset( $this->config['session_lifetime'] ) )
|
||||||
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );
|
ini_set( 'session.gc_maxlifetime', $this->config['session_lifetime'] );
|
||||||
|
Reference in New Issue
Block a user