* @copyright Copyright (c) 2009-2011 Moc 10 Media, LLC. (http://www.moc10media.com) * @license https://phirecms.org/LICENSE.TXT New BSD License * @version 1.1 */ require_once 'bootstrap.php'; // Check if the path constants is defined or not. if (!defined('BASE_PATH') || !defined('SYS_PATH') || !defined('CONTENT_PATH')) { print("You must set up the 'config.php' file correctly. Please refer to the INSTALL.TXT for help."); // Else, check the BASE_PATH. } else if (defined('BASE_PATH') && !file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH)) { print("The BASE_PATH you defined does not exist. Please check the settings in the 'config.php' file and refer to the INSTALL.TXT for help."); // Else, check the SYS_PATH. } else if (defined('SYS_PATH') && !file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . SYS_PATH)) { print("The SYS_PATH you defined does not exist. Please check the settings in the 'config.php' file and refer to the INSTALL.TXT for help."); // Else, check the CONTENT_PATH. } else if (defined('CONTENT_PATH') && !file_exists($_SERVER['DOCUMENT_ROOT'] . BASE_PATH . CONTENT_PATH)) { print("The CONTENT_PATH you defined does not exist. Please check the settings in the 'config.php' file and refer to the INSTALL.TXT for help."); // Else, if the system is not properly configured or installed. } else { require_once 'core/process/system.check.php'; include_once 'core/process/init.php'; // If the system is not properly configured or installed. if ($sys_check == false) { include_once 'core/includes/failed.php'; // Else, process the login page. } else { require_once 'core/process/session.login.check.php'; try { // Declare the login form. $form = new Phire_Form_Login($_SERVER['PHP_SELF'], 'post', ' '); // If the login form has been submitted, validate the form. if ($_POST) { $form->init($_POST); // If the login form is valid, the validate the login attempt. if ($form->isValid()) { // Authenticate the login attempt. $form->auth(); // If there is a login authentication error, return to the login form. if (!is_null($form->error)) { include_once 'core/includes/header.php'; print($form->error); $form->render(); include_once 'core/includes/footer.php'; // Else, complete the user log in, storing user and session information. } else { $form->saveData(); // Perform a server and version check. require_once 'core/process/server.check.php'; require_once 'core/process/version.check.php'; // If the previous session expired, re-route the new session to the last url. if (isset($sess->expire_last_url)) { $last_url = $sess->expire_last_url; unset($sess->expire_last_url); header('Location: ' . $last_url); // Else, if a previous page attempt occured, re-route to the attempted url. } else if (isset($sess->attempted_url)) { $attempted_url = $sess->attempted_url; unset($sess->attempted_url); header('Location: ' . $attempted_url); // Else, go the index page. } else { header('Location: ' . BASE_PATH . SYS_PATH . '/'); } } // Else, re-render the invalid login form with errors. } else { include_once 'core/includes/header.php'; if (isset($sess->expire_msg)) { print($sess->expire_msg); } $form->render(); include_once 'core/includes/footer.php'; } // Else, render the new login form. } else { include_once 'core/includes/header.php'; if (isset($_GET['logout'])) { if ($_GET['logout'] == 'closed') { print("
" . $e->getMessage() . " " . $lang->__('Please check your server and make sure the system has been installed and configured properly.') . "
\n"); include_once 'core/includes/footer.php'; } } } ?>