/** * Require that the user is logged in. * * A check is done to see if the user is logged in. * If not, then the user is redirected to the login page. */ function phorum_require_login() { $PHORUM = $GLOBALS['PHORUM']; if (!$PHORUM["user"]["user_id"]) { $url = phorum_get_url(PHORUM_LOGIN_URL, "redir=" . phorum_get_current_url()); phorum_redirect_by_url($url); exit; } }
define("PHORUM_ADMIN", 1); // set a sane error level for our admin. // this will make the coding time faster and // the code run faster. error_reporting(E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR); include_once "./common.php"; include_once "./include/admin_functions.php"; // initialized as empty $PHORUM['admin_token'] = ""; if (!empty($_GET['phorum_admin_token'])) { $PHORUM['admin_token'] = $_GET['phorum_admin_token']; } elseif (!empty($_POST['phorum_admin_token'])) { $PHORUM['admin_token'] = $_POST['phorum_admin_token']; } // determine absolute URI for the admin $PHORUM["admin_http_path"] = phorum_get_current_url(false); // determine http_path (at install time; after that it's in the settings) if (!isset($PHORUM["http_path"])) { $PHORUM["http_path"] = dirname($_SERVER["PHP_SELF"]); } // if we are installing or upgrading, we don't need to check for a session // 2005081000 was the internal version that introduced the installed flag if (!isset($PHORUM['internal_version']) || !isset($PHORUM['installed']) && $PHORUM['internal_version'] >= '2005081000') { // this is an install $module = "install"; } elseif (isset($_REQUEST["module"]) && $_REQUEST["module"] == "upgrade" || $PHORUM['internal_version'] < PHORUM_SCHEMA_VERSION || !isset($PHORUM['internal_patchlevel']) || $PHORUM['internal_patchlevel'] < PHORUM_SCHEMA_PATCHLEVEL) { // this is an upgrade $module = "upgrade"; } else { // Try to restore an admin session. phorum_api_user_session_restore(PHORUM_ADMIN_SESSION);