$user = false; } if (plx_gu_session_authenticate($name, $username, $password, $remember, $user)) { // Redirect to page that referred here - or to the home page $redirect = is_get_var('ref') ? urldecode(get_get_var('ref')) . (is_get_var('token') ? '?token=' . get_get_var('token') : '') : absolute_url('index.php'); header('Location: ' . $redirect); exit; } else { $name = ''; gu_error(t('Incorrect username or password')); } } elseif (is_get_var('action') && get_get_var('action') == 'login') { $username = is_post_var('u') ? get_post_var('u') : ''; $password = is_post_var('p') ? get_post_var('p') : ''; $remember = is_post_var('login_remember'); if (gu_session_authenticate($username, $password, $remember)) { // Redirect to page that referred here - or to the home page $redirect = is_get_var('ref') ? urldecode(get_get_var('ref')) : absolute_url('index.php'); header('Location: ' . $redirect); exit; } else { gu_error(t('Incorrect username or password')); } } elseif (is_get_var('action') && get_get_var('action') == 'logout') { // Invalidate session flag gu_session_set_valid(FALSE); } gu_theme_start(); ?> <script type="text/javascript">
/** * Initializes the Gutuma application * @param bool $validate_session TRUE if session should be checked for a valid login, else FALSE * @param bool $install_redirect TRUE if we should redirect when install/update required */ function gu_init($validate_session = TRUE, $install_redirect = TRUE) { // If settings couldn't be loaded we need to run the install script or if settings could be // loaded but version number is less than the built version number, we need to update if (!gu_config::load() || gu_config::get_version() < GUTUMA_VERSION_NUM) { if ($install_redirect) { header('Location: ' . absolute_url('install.php')); exit; } } if ($validate_session) { if (!gu_session_authenticate()) { // If we don't have a stored valid session, redirect to the login page header('Location: ' . absolute_url('login.php') . '?ref=' . urlencode(absolute_url())); exit; } } }