1
0
mirror of https://github.com/kremalicious/krtmn.git synced 2024-06-24 10:16:35 +02:00
krtmn/includes/auth.php
2012-02-26 03:28:54 +01:00

28 lines
610 B
PHP

<?php
// No direct call
if( !defined( 'YOURLS_ABSPATH' ) ) die();
$auth = yourls_apply_filter( 'is_valid_user', yourls_is_valid_user() );
if( $auth !== true ) {
// API mode,
if ( yourls_is_API() ) {
$format = ( isset($_REQUEST['format']) ? $_REQUEST['format'] : 'xml' );
$callback = ( isset($_REQUEST['callback']) ? $_REQUEST['callback'] : '' );
yourls_api_output( $format, array(
'simple' => $auth,
'message' => $auth,
'errorCode' => 403,
'callback' => $callback,
) );
// Regular mode
} else {
yourls_login_screen( $auth );
}
die();
}
yourls_do_action( 'auth_successful' );