Initial commit.

This commit is contained in:
2026-03-10 21:25:26 +08:00
commit 78739bf725
3089 changed files with 472990 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
// File name: unauth.inc.php
// Description: PHP subroutines to handle authentication failures
// Date: 2004-03-24
// Author: imacat <imacat@pristine.com.tw>
// 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);
}
}
?>