// Copyright: Copyright (C) 2004-2008 Pristine Communications // Set the include path if (!defined("INCPATH_SET")) { require_once dirname(__FILE__) . "/incpath.inc.php"; } // Referenced subroutines require_once "monica/cgiemu.inc.php"; require_once "monica/formfunc.inc.php"; require_once "monica/http.inc.php"; require_once "monica/login.inc.php"; require_once "monica/requri.inc.php"; require_once "monica/userhome.inc.php"; // unauth: User is not authorized function unauth($msg = null) { // Not logged in yet -- log in if (is_null(get_login_sn())) { $url = userhome(); $args = array(); // Referer not needed for users' home pages if (!in_array(REQUEST_PATH, array(ADMIN_HOME, NONADMIN_HOME))) { $args[] = "referer=" . urlencode(REQUEST_FULLURI); // Referer not recorded -- keep the status message } else { $FORM =& get_or_post(); if (array_key_exists("statid", $FORM)) { $args[] = "statid=" . urlencode($FORM["statid"]); } } if (count($args) > 0) { $url .= "?" . implode("&", $args); } if ($_SERVER["REQUEST_METHOD"] == "POST") { http_303($url); } else { http_307($url); } // Logged in but privilege not enough } else { http_403($msg); } } ?>