php_library_path . "display_library.php";
function login_form($messages, $xerte_toolkits_site)
{
?>
site_title; ?>
welcome_message; ?>
";
foreach ($messages as $message) {
echo "
" . $message . "
";
}
echo "";
}
?>
news_text; ?>
site_text; ?>
copyright; ?>
authentication_method);
if ($_SERVER['REQUEST_METHOD'] !== "POST") {
if ($authmech->needsLogin()) {
login_form($errors, $xerte_toolkits_site);
exit(0);
}
}
if ($authmech->needsLogin()) {
/**
* Username and password left empty
*/
if (empty($_POST["login"]) && empty($_POST["password"])) {
$errors[] = INDEX_USERNAME_AND_PASSWORD_EMPTY;
/*
* Username left empty
*/
} else if (empty($_POST["login"])) {
$errors[] = INDEX_USERNAME_EMPTY;
/*
* Password left empty
*/
} else if (empty($_POST["password"])) {
$errors[] = INDEX_PASSWORD_EMPTY;
}
if (!empty($_POST['login']) && ($_POST["login"] == $xerte_toolkits_site->admin_username) && (!empty($_POST['password']) && $_POST["password"] == $xerte_toolkits_site->admin_password)) {
$errors[] = INDEX_SITE_ADMIN;
}
$success = false;
if (empty($errors)) {
try {
$authmech = Xerte_Authentication_Factory::create($xerte_toolkits_site->authentication_method);
} catch (InvalidArgumentException $e) {
$errors[] = "Invalid authentication choice; check config.php (authentication_method)";
}
if (empty($errors)) {
if ($authmech->check()) {
$success = $authmech->login($_POST['login'], $_POST['password']);
}
$errors = $authmech->getErrors();
}
}
if (!$success || !empty($errors)) {
login_form($errors, $xerte_toolkits_site);
exit(0);
}
}
$_SESSION['toolkits_firstname'] = $authmech->getFirstname();
$_SESSION['toolkits_surname'] = $authmech->getSurname();
$_SESSION['toolkits_logon_username'] = $authmech->getUsername();
include $xerte_toolkits_site->php_library_path . "user_library.php";
/*
* Check to see if this is a users' first time on the site
*/
if (check_if_first_time($_SESSION['toolkits_logon_username'])) {
/*
* create the user a new id
*/
$_SESSION['toolkits_logon_id'] = create_user_id($_SESSION['toolkits_logon_username'], $_SESSION['toolkits_firstname'], $_SESSION['toolkits_surname']);
/*
* create a virtual root folder for this user
*/
create_a_virtual_root_folder();
} else {
/*
* User exists so update the user settings
*/
$_SESSION['toolkits_logon_id'] = get_user_id();
update_user_logon_time();
}
recycle_bin();
/*
* Output the main page, including the user's and blank templates
*/
?>
site_title; ?>
// JAVASCRIPT library for fixed variables\n // management of javascript is set up here\n // SITE SETTINGS
var site_url = \"{$xerte_toolkits_site->site_url}\";
var site_apache = \"{$xerte_toolkits_site->apache}\";
var properties_ajax_php_path = \"website_code/php/properties/\";
var management_ajax_php_path = \"website_code/php/management/\";
var ajax_php_path = \"website_code/php/\";";
?>