/** * check_authentication returns a username from http authentication or the session and forces login if not found * @param string $msg_uname unique name of text blurb to show on the login page * @deprecated since reason 4 beta 4 - use reason_check_authentication or reason_require_authentication * @return string $username */ function check_authentication($msg_uname = '') { if($username = get_authentication_from_server()) { return $username; } else { if($username = get_authentication_from_session()) { return $username; } else { force_login($msg_uname); } } }
<?php /** * A script that reports (in XML form) in whether the current user is logged in or not * @package reason * @subpackage js */ include 'reason_header.php'; reason_include_once('function_libraries/user_functions.php'); header('Content-Type: text/xml'); header("Cache-Control", "no-cache"); if (get_authentication_from_session()) { $xml_str = 'true'; } else { $xml_str = 'false'; } echo '<' . '?' . 'xml version="1.0"?>'; echo '<root>'; echo '<status>'; echo $xml_str; echo '</status>'; echo '</root>';