From 2be8b28f3d3fd6f904113d3bf251204720ee04c6 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 25 Oct 2002 02:02:02 +0000 Subject: [PATCH] Changes to improve usability when the admin folder has been renamed, and also a change in checking for the admin user, just in case an old session is hanging around --- admin/config.php | 4 ++-- admin/index.php | 12 +++++++----- admin/site.php | 6 +++--- admin/user.php | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/admin/config.php b/admin/config.php index 665dddcc71..b6673fe27a 100644 --- a/admin/config.php +++ b/admin/config.php @@ -59,7 +59,7 @@ } } } - redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved"), 1); + redirect("index.php", get_string("changessaved"), 1); exit; } else { @@ -80,7 +80,7 @@ if ($site) { print_header("$site->shortname: $strconfigvariables", "$site->fullname", - "wwwroot/admin/\">$stradmin -> $strconfigvariables", "$focus"); + "$stradmin -> $strconfigvariables", "$focus"); print_heading($strconfigvariables); } else { print_header(); diff --git a/admin/index.php b/admin/index.php index dda74bbb97..997bc1bdbb 100644 --- a/admin/index.php +++ b/admin/index.php @@ -212,19 +212,21 @@ /// If any new configurations were found then send to the config page to check if ($configchange) { - redirect("$CFG->wwwroot/admin/config.php"); + redirect("config.php"); } /// Set up the overall site name etc. if (! $site = get_site()) { - redirect("$CFG->wwwroot/admin/site.php"); + redirect("site.php"); } /// Set up the admin user + if (! record_exists_sql("SELECT * FROM user_admins")) { // No admin user yet + redirect("user.php"); + } + +/// Check for valid admin user if (!isadmin()) { - if (! record_exists_sql("SELECT * FROM user_admins")) { // No admin user yet - redirect("$CFG->wwwroot/admin/user.php"); - } error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); } diff --git a/admin/site.php b/admin/site.php index ca8090d2c7..799471cb9b 100644 --- a/admin/site.php +++ b/admin/site.php @@ -23,7 +23,7 @@ if ($form->id) { if (update_record("course", $form)) { - redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved")); + redirect("index.php", get_string("changessaved")); } else { error("Serious Error! Could not update the site record! (id = $form->id)"); } @@ -31,7 +31,7 @@ if ($newid = insert_record("course", $form)) { $cat->name = get_string("miscellaneous"); if (insert_record("course_categories", $cat)) { - redirect("$CFG->wwwroot/admin/index.php", get_string("changessaved"), "1"); + redirect("index.php", get_string("changessaved"), "1"); } else { error("Serious Error! Could not set up a default course category!"); } @@ -62,7 +62,7 @@ $strsitesettings = get_string("sitesettings"); print_header("$site->shortname: $strsitesettings", "$site->fullname", - "wwwroot/admin/\">$stradmin -> $strsitesettings", "$focus"); + "$stradmin -> $strsitesettings", "$focus"); print_heading($strsitesettings); print_simple_box_start("center", "", "$THEME->cellheading"); diff --git a/admin/user.php b/admin/user.php index 5cc8f6d29e..ce30f76e3f 100644 --- a/admin/user.php +++ b/admin/user.php @@ -94,7 +94,7 @@ $strdeletecheck = get_string("deletecheck"); print_header("$site->shortname: $stredituser", $site->fullname, - "wwwroot/admin\">$stradministration -> $stredituser"); + "$stradministration -> $stredituser"); if ($delete) { // Delete a selected user, after confirmation if (!$user = get_record("user", "id", "$delete")) { -- 2.39.5