minfix + avoid session_guard.child for SATS api call

This commit is contained in:
xdrm-brackets 2017-10-27 18:15:37 +02:00
parent 51f1f6f80c
commit 00f1efb38d
1 changed files with 6 additions and 3 deletions

View File

@ -154,10 +154,13 @@
/* (4) api/module/method -> Api */ /* (4) api/module/method -> Api */
$R->post('api(?:(/.*))/?', function($url){ $R->post('api(?:(/.*))/?', function($url){
if( isset($_SERVER['HTTP_X_TREE_TOKEN']) )
$GLOBALS['page_log']->log('api.call('.$_SERVER['HTTP_X_TREE_TOKEN'].')'); $GLOBALS['page_log']->log('api.call('.$_SERVER['HTTP_X_TREE_TOKEN'].')');
header('Content-Type: application/json; charset=UTF-8'); header('Content-Type: application/json; charset=UTF-8');
// {1} Allow authed SATS not to be checked by session_guard.child //
if( $GLOBALS['auth'] < 3 || !isset($_SERVER['PHP_AUTH_DIGEST']) )
if( !$GLOBALS['session_guard']->init_child() ) if( !$GLOBALS['session_guard']->init_child() )
die(json_encode([ 'error' => 100, 'ErrorDescription' => 'session_guard.child error' ])); die(json_encode([ 'error' => 100, 'ErrorDescription' => 'session_guard.child error' ]));