]> CyberLeo.Net >> Repos - Github/YOURLS.git/blob - includes/auth.php
Prevent full path disclosure in case of direct calls. Fixes issue 646.
[Github/YOURLS.git] / includes / auth.php
1 <?php
2 // No direct call
3 if( !defined( 'YOURLS_ABSPATH' ) ) die();
4
5 $auth = yourls_apply_filter( 'is_valid_user', yourls_is_valid_user() );
6
7 if( $auth !== true ) {
8
9         // API mode, 
10         if ( yourls_is_API() ) {
11                 $format = ( isset($_REQUEST['format']) ? $_REQUEST['format'] : 'xml' );
12                 yourls_api_output( $format, array(
13                         'simple' => $auth,
14                         'message' => $auth,
15                         'errorCode' => 403,
16                         ) );
17
18         // Regular mode
19         } else {
20                 yourls_login_screen( $auth );
21         }
22         
23         die();
24 }