diff --git a/admin/auth.php b/admin/auth.php index d6ab820a1ac..dd07f22a68d 100644 --- a/admin/auth.php +++ b/admin/auth.php @@ -11,8 +11,7 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); -$adminroot = admin_get_root(); -admin_externalpage_setup('userauthentication', $adminroot); +admin_externalpage_setup('userauthentication'); $action = optional_param('action', '', PARAM_ACTION); $auth = optional_param('auth', '', PARAM_SAFEDIR); @@ -227,7 +226,7 @@ foreach ($displayauths as $auth => $name) { } // output form -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); //print stus messages if ($status !== '') { @@ -298,6 +297,6 @@ echo ''; echo '
'; echo ''; echo ''; -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); ?> diff --git a/admin/auth_config.php b/admin/auth_config.php index 7a65ba4ea05..a75f4ed20f6 100644 --- a/admin/auth_config.php +++ b/admin/auth_config.php @@ -6,8 +6,7 @@ require_once '../config.php'; require_once $CFG->libdir.'/adminlib.php'; -$adminroot = admin_get_root(); -admin_externalpage_setup('userauthentication', $adminroot); +admin_externalpage_setup('userauthentication'); $auth = required_param('auth', PARAM_SAFEDIR); $authplugin = get_auth_plugin($auth); $err = array(); @@ -59,7 +58,7 @@ foreach ($modules as $module) { asort($options); // output configuration form -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); // choose an authentication method echo "
frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n"; @@ -80,7 +79,7 @@ echo '

\n"; echo "

\n"; -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); exit; /// Functions ///////////////////////////////////////////////////////////////// diff --git a/admin/block.php b/admin/block.php index 2b580ef5a57..49048f3e2d7 100644 --- a/admin/block.php +++ b/admin/block.php @@ -4,10 +4,10 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('manageblocks', $adminroot); require_once($CFG->libdir.'/blocklib.php'); + admin_externalpage_setup('manageblocks'); + $blockid = required_param('block', PARAM_INT); if(($blockrecord = blocks_get_record($blockid)) === false) { @@ -55,7 +55,7 @@ $CFG->pagepath = 'block/' . $block->name() . '/config'; - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strblockname); @@ -70,6 +70,6 @@ echo '

'; $block->config_print(); echo ''; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/blocks.php b/admin/blocks.php index c5eea01e84a..2ceaff3739c 100644 --- a/admin/blocks.php +++ b/admin/blocks.php @@ -8,8 +8,7 @@ require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/ddllib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('manageblocks', $adminroot); + admin_externalpage_setup('manageblocks'); $confirm = optional_param('confirm', 0, PARAM_BOOL); $hide = optional_param('hide', 0, PARAM_INT); @@ -30,7 +29,7 @@ $strmultiple = get_string('blockmultiple', 'admin'); $strshowblockcourse = get_string('showblockcourse'); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strmanageblocks); @@ -76,7 +75,7 @@ notice_yesno(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete='.$block->id.'&confirm=1&sesskey='.$USER->sesskey, 'blocks.php'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } else { @@ -246,6 +245,6 @@ $table->print_html(); } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/delete.php b/admin/delete.php index abf0a71191f..6762cf44196 100644 --- a/admin/delete.php +++ b/admin/delete.php @@ -5,8 +5,8 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('purgemoodledata', $adminroot); + + admin_externalpage_setup('purgemoodledata'); require_login(); @@ -17,14 +17,14 @@ $deletedir = $CFG->dataroot; // The directory to delete! - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading('Purge moodledata'); if (empty($sure)) { $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey()); notice_yesno ('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', 'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } @@ -32,7 +32,7 @@ $optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes'); notice_yesno ('Are you REALLY REALLY completely sure you want to delete everything inside the directory '. $deletedir .' (this includes all user images, and any other course files that have been created) ?', 'delete.php', 'index.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } @@ -46,7 +46,7 @@ echo '

Done!

'; print_continue($CFG->wwwroot); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; diff --git a/admin/enrol.php b/admin/enrol.php index 7a3b4e9ab46..8e0cfdfd6bf 100644 --- a/admin/enrol.php +++ b/admin/enrol.php @@ -8,8 +8,7 @@ $enrol = optional_param('enrol', $CFG->enrol, PARAM_SAFEDIR); $CFG->pagepath = 'enrol'; - $adminroot = admin_get_root(); - admin_externalpage_setup('enrolment', $adminroot); + admin_externalpage_setup('enrolment'); @@ -41,7 +40,7 @@ $str = get_strings(array('enrolmentplugins', 'users', 'administration', 'settings', 'edit')); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $modules = get_list_of_plugins("enrol"); $options = array(); @@ -102,6 +101,6 @@ echo ""; echo ""; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> \ No newline at end of file diff --git a/admin/enrol_config.php b/admin/enrol_config.php index db371b33ddf..6adca6d13c8 100644 --- a/admin/enrol_config.php +++ b/admin/enrol_config.php @@ -5,8 +5,7 @@ require_once("../config.php"); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('enrolment', $adminroot); + admin_externalpage_setup('enrolment'); $enrol = required_param('enrol', PARAM_ALPHA); $CFG->pagepath = 'enrol/' . $enrol; @@ -42,7 +41,7 @@ } asort($options); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); echo "
frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">"; echo "
"; @@ -66,7 +65,7 @@ echo "
"; echo "
"; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; ?> diff --git a/admin/environment.php b/admin/environment.php index 4d2670367a3..64af2195c41 100644 --- a/admin/environment.php +++ b/admin/environment.php @@ -34,8 +34,7 @@ require_once($CFG->libdir.'/environmentlib.php'); require_once($CFG->libdir.'/componentlib.class.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('environment', $adminroot); + admin_externalpage_setup('environment'); /// Parameters $action = optional_param('action', '', PARAM_ACTION); @@ -53,7 +52,7 @@ $strmisc = get_string('miscellaneous'); /// Print the header stuff - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); /// Print the component download link echo ''; @@ -133,5 +132,5 @@ $status = check_moodle_environment($version, $environment_results); /// Print footer - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/filter.php b/admin/filter.php index f65627d30ff..c372dda28a8 100644 --- a/admin/filter.php +++ b/admin/filter.php @@ -6,8 +6,7 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/tablelib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('managefilters', $adminroot); + admin_externalpage_setup('managefilters'); // get parameters $param = new Object; @@ -71,7 +70,7 @@ //============================== $filtername = ucfirst($filtername); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading( $filtername ); print_simple_box(get_string("configwarning", "admin"), "center", "50%"); @@ -94,5 +93,5 @@ diff --git a/admin/filters.php b/admin/filters.php index 4e29e70d300..978fdbebee0 100644 --- a/admin/filters.php +++ b/admin/filters.php @@ -9,8 +9,7 @@ // defines define('FILTER_TABLE','filter_administration_table'); - $adminroot = admin_get_root(); - admin_externalpage_setup('managefilters', $adminroot); + admin_externalpage_setup('managefilters'); // get values from page $params = new object(); @@ -263,7 +262,7 @@ // Display logic //============================== - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading_with_help($txt->managefilters, 'filters'); @@ -272,6 +271,6 @@ // cache control table has been removed - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/health.php b/admin/health.php index 0fb6e89bc51..4ad667da05c 100644 --- a/admin/health.php +++ b/admin/health.php @@ -13,8 +13,8 @@ } require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('healthcenter', $adminroot); + + admin_externalpage_setup('healthcenter'); define('SEVERITY_NOTICE', 'notice'); define('SEVERITY_ANNOYANCE', 'annoyance'); @@ -28,7 +28,7 @@ $site = get_site(); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); echo << @@ -100,7 +100,7 @@ STYLES; } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); function health_find_problems() { diff --git a/admin/index.php b/admin/index.php index 79574ec2542..b746efcaf31 100644 --- a/admin/index.php +++ b/admin/index.php @@ -545,8 +545,8 @@ /// Print default admin page with notifications. - admin_externalpage_setup('adminnotifications', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('adminnotifications'); + admin_externalpage_print_header(); /// Deprecated database! Warning!! if (!empty($CFG->migrated_to_new_db)) { @@ -624,7 +624,7 @@ } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/innodb.php b/admin/innodb.php index 194917536ad..77cbe205141 100644 --- a/admin/innodb.php +++ b/admin/innodb.php @@ -2,8 +2,8 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('toinodb', $adminroot); + + admin_externalpage_setup('toinodb'); $confirm = optional_param('confirm', 0, PARAM_BOOL); @@ -11,7 +11,7 @@ require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading('Convert all MySQL tables from MYISAM to InnoDB'); if ($CFG->dbfamily != 'mysql') { @@ -31,13 +31,13 @@ } notify('... done.', 'notifysuccess'); print_continue('index.php'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey()); notice_yesno('Are you sure you want convert all your tables to the InnoDB format?', 'innodb.php', 'index.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } ?> diff --git a/admin/lang.php b/admin/lang.php index 151d88ed353..7bb9bf97a5e 100644 --- a/admin/lang.php +++ b/admin/lang.php @@ -5,8 +5,8 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('langedit', $adminroot); + + admin_externalpage_setup('langedit'); define('LANG_SUBMIT_REPEAT', 1); // repeat displaying submit button? define('LANG_SUBMIT_REPEAT_EVERY', 20); // if so, after how many lines? @@ -77,7 +77,7 @@ } - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); if (!$mode) { print_box_start(); @@ -88,7 +88,7 @@ print_heading("$streditstrings"); print_heading("$stredithelpdocs"); print_box_end(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } @@ -211,7 +211,7 @@ if (!empty($somethingfound)) { print_continue("lang.php"); } else { - notice(get_string("languagegood"), "lang.php", '', $adminroot); + notice(get_string("languagegood"), "lang.php"); } } else if ($mode == "compare") { @@ -479,7 +479,7 @@ } } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ////////////////////////////////////////////////////////////////////// diff --git a/admin/langdoc.php b/admin/langdoc.php index d6d2ebf59f1..489a17bd479 100755 --- a/admin/langdoc.php +++ b/admin/langdoc.php @@ -11,8 +11,7 @@ */ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('langedit', $adminroot); + admin_externalpage_setup('langedit'); // // Some local configuration @@ -32,7 +31,7 @@ $strthislanguage = get_string("thislanguage"); $stredithelpdocs = get_string('edithelpdocs', 'admin'); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $currentlang = current_language(); $langdir = "$CFG->dataroot/lang/$currentlang"; @@ -40,7 +39,7 @@ if (!file_exists($langdir)) { - error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang','',$adminroot); + error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang'); } // Shall I save POSTed data? @@ -49,7 +48,7 @@ if (langdoc_save_file($langdir, $currentfile, $_POST['filedata'])) { notify(get_string("changessaved")." ($langdir/$currentfile)", "green"); } else { - error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey", $adminroot); + error("Could not save the file '$currentfile'!", "langdoc.php?currentfile=$currentfile&sesskey=$USER->sesskey"); } } } @@ -61,7 +60,7 @@ // Get all files from /docs directory if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) { - error("Could not find English language docs files!",'',$adminroot); + error("Could not find English language docs files!"); } $options = array(); @@ -81,7 +80,7 @@ // Get all files from /help directory if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) { - error("Could not find English language help files!",'',$adminroot); + error("Could not find English language help files!"); } foreach ($files as $filekey => $file) { // check all the help files. @@ -194,7 +193,7 @@ $langdir/$currentfile")."

"; error_reporting($CFG->debug); } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ////////////////////////////////////////////////////////////////////// diff --git a/admin/langimport.php b/admin/langimport.php index 94a1b4bb843..194ef2efa97 100755 --- a/admin/langimport.php +++ b/admin/langimport.php @@ -6,8 +6,8 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('langimport', $adminroot); + + admin_externalpage_setup('langimport'); $mode = optional_param('mode', 0, PARAM_INT); //phase $pack = optional_param('pack', '', PARAM_FILE); //pack to install @@ -27,7 +27,7 @@ $strthislanguage = get_string("thislanguage"); $title = $strlang; - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); //reset and diagnose lang cache permissions @unlink($CFG->dataroot.'/cache/languages'); @@ -63,7 +63,7 @@ case INSTALLED: get_list_of_languages(true); //refresh lang cache - redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1, $adminroot); + redirect('langimport.php', get_string('langpackupdated','admin',$pack), -1); break; case UPTODATE: @@ -112,7 +112,7 @@ get_list_of_languages(true); //refresh lang cache //delete the direcotries if ($rm1 or $rm2) { - redirect('langimport.php', get_string('langpackremoved','admin'), 3, $adminroot); + redirect('langimport.php', get_string('langpackremoved','admin'), 3); } else { //nothing deleted, possibly due to permission error error('An error has occurred, language pack is not completely uninstalled, please check file permissions'); } @@ -213,9 +213,9 @@ } if ($updated) { - notice(get_string('langupdatecomplete','admin'), 'langimport.php', NULL, $adminroot); + notice(get_string('langupdatecomplete','admin'), 'langimport.php'); } else { - notice(get_string('nolangupdateneeded','admin'), 'langimport.php', NULL, $adminroot); + notice(get_string('nolangupdateneeded','admin'), 'langimport.php'); } break; @@ -326,7 +326,7 @@ } //close of main switch - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); /* returns a list of available language packs from a * local copy shipped with standard moodle distro diff --git a/admin/maintenance.php b/admin/maintenance.php index d7e20ce2dca..aecd668f836 100644 --- a/admin/maintenance.php +++ b/admin/maintenance.php @@ -6,8 +6,7 @@ $action = optional_param('action', '', PARAM_ALPHA); - $adminroot = admin_get_root(); - admin_externalpage_setup('maintenancemode', $adminroot); + admin_externalpage_setup('maintenancemode'); //Check folder exists if (! make_upload_directory(SITEID)) { // Site folder @@ -32,7 +31,7 @@ /// Print the header stuff - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); /// Print the appropriate form @@ -66,5 +65,5 @@ } } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/mnet/access_control.php b/admin/mnet/access_control.php index 54f0c69c849..e8105939395 100644 --- a/admin/mnet/access_control.php +++ b/admin/mnet/access_control.php @@ -13,12 +13,10 @@ $perpage = optional_param('perpage', 30, PARAM_INT); $action = trim(strtolower(optional_param('action', '', PARAM_ALPHA))); require_login(); -$adminroot = admin_get_root(); +admin_externalpage_setup('ssoaccesscontrol'); -admin_externalpage_setup('ssoaccesscontrol', $adminroot); - -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); if (!extension_loaded('openssl')) { print_error('requiresopenssl', 'mnet', '', NULL, true); @@ -234,6 +232,6 @@ foreach ($formerror as $error) { } print_simple_box_end(); -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); ?> diff --git a/admin/mnet/enr_course_enrol.php b/admin/mnet/enr_course_enrol.php index 94af92e1753..825d06bdd44 100644 --- a/admin/mnet/enr_course_enrol.php +++ b/admin/mnet/enr_course_enrol.php @@ -10,8 +10,7 @@ error(get_string('confirmsesskeybad', 'error')); } - $adminroot = admin_get_root(); - admin_externalpage_setup('mnetenrol', $adminroot); + admin_externalpage_setup('mnetenrol'); $CFG->pagepath = 'admin/mnet'; require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class @@ -255,7 +254,7 @@ $strshowall = get_string('showall'); $strparticipants = get_string('participants'); $strsearchresults = get_string('searchresults'); -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); print_box('' . s($mnet_peer->name) . ' : ' . format_string($course->shortname) .' '. format_string($course->fullname) @@ -276,6 +275,6 @@ if (!empty($errors)) { } -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); ?> diff --git a/admin/mnet/enr_courses.php b/admin/mnet/enr_courses.php index a0af7e86d04..7e09e5fba2e 100644 --- a/admin/mnet/enr_courses.php +++ b/admin/mnet/enr_courses.php @@ -10,8 +10,7 @@ } - $adminroot = admin_get_root(); - admin_externalpage_setup('mnetenrol', $adminroot); + admin_externalpage_setup('mnetenrol'); $CFG->pagepath = 'admin/mnet'; require_once("$CFG->dirroot/enrol/enrol.class.php"); /// Open the factory class @@ -24,7 +23,7 @@ /// Print the page - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_box('' . s($host->name) . '
' . get_string("enrolcourses_desc", "mnet")); @@ -53,6 +52,6 @@ } echo ''; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/mnet/enr_hosts.php b/admin/mnet/enr_hosts.php index 2f78fa556f2..ec82c2cc43a 100644 --- a/admin/mnet/enr_hosts.php +++ b/admin/mnet/enr_hosts.php @@ -5,8 +5,7 @@ require_once(dirname(__FILE__) . "/../../config.php"); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('mnetenrol', $adminroot); + admin_externalpage_setup('mnetenrol'); $CFG->pagepath = 'admin/mnet'; @@ -18,7 +17,7 @@ /// get language strings - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_box(get_string("remoteenrolhosts_desc", "mnet")); @@ -57,6 +56,6 @@ echo '' . ''; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/mnet/index.php b/admin/mnet/index.php index 0e5fab69479..d761acb9d41 100644 --- a/admin/mnet/index.php +++ b/admin/mnet/index.php @@ -7,8 +7,7 @@ include_once($CFG->dirroot.'/mnet/lib.php'); require_login(); - $adminroot = admin_get_root(); - admin_externalpage_setup('net', $adminroot); + admin_externalpage_setup('net'); $context = get_context_instance(CONTEXT_SYSTEM); @@ -16,19 +15,19 @@ if (!extension_loaded('openssl')) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); set_config('mnet_dispatcher_mode', 'off'); print_error('requiresopenssl', 'mnet', '', NULL, true); } if (!$site = get_site()) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); set_config('mnet_dispatcher_mode', 'off'); print_error('nosite', '', '', NULL, true); } if (!function_exists('curl_init') ) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); set_config('mnet_dispatcher_mode', 'off'); print_error('nocurl', 'mnet', '', NULL, true); } @@ -90,7 +89,7 @@ } $hosts = get_records_select('mnet_host', " id != '{$CFG->mnet_localhost_id}' AND deleted = '0' ",'wwwroot ASC' ); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); ?>
@@ -148,5 +147,5 @@
diff --git a/admin/mnet/mnet_review.html b/admin/mnet/mnet_review.html index 52d99f6ddae..88392f3d95d 100644 --- a/admin/mnet/mnet_review.html +++ b/admin/mnet/mnet_review.html @@ -5,7 +5,7 @@ $logurl = $CFG->wwwroot. '&date=0'. '&modid=&modaction=0&logformat=showashtml'; -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); if (isset($mnet_peer->id) && $mnet_peer->id > 0) { $tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false); @@ -131,5 +131,5 @@ if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){ diff --git a/admin/mnet/mnet_review_allhosts.html b/admin/mnet/mnet_review_allhosts.html index b5bb0015f49..81451efa113 100644 --- a/admin/mnet/mnet_review_allhosts.html +++ b/admin/mnet/mnet_review_allhosts.html @@ -1,5 +1,5 @@ id, $strmnetedithost, $strmnetedithost, false); $tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false); @@ -18,5 +18,5 @@ print_simple_box_start("center", ""); diff --git a/admin/mnet/mnet_services.html b/admin/mnet/mnet_services.html index f308cd69609..10c99e69a69 100644 --- a/admin/mnet/mnet_services.html +++ b/admin/mnet/mnet_services.html @@ -1,5 +1,5 @@ wwwroot. '/course/report/log/index.php?chooselog=1&showusers=1&showcourses=1&host_course='.$mnet_peer->id. @@ -96,5 +96,5 @@ print_simple_box_start("center", ""); diff --git a/admin/mnet/mnet_services.php b/admin/mnet/mnet_services.php index bed8c3cdf5d..daf8a557e68 100644 --- a/admin/mnet/mnet_services.php +++ b/admin/mnet/mnet_services.php @@ -6,8 +6,7 @@ include_once($CFG->dirroot.'/mnet/lib.php'); require_login(); - $adminroot = admin_get_root(); - admin_externalpage_setup('mnetpeers', $adminroot); + admin_externalpage_setup('mnetpeers'); $context = get_context_instance(CONTEXT_SYSTEM); diff --git a/admin/mnet/peers.html b/admin/mnet/peers.html index bd6d6aa2090..138be56b187 100644 --- a/admin/mnet/peers.html +++ b/admin/mnet/peers.html @@ -1,5 +1,5 @@ mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict') { print_box(get_string('mnetdisabled','mnet')); @@ -89,5 +89,5 @@ if (empty($CFG->mnet_dispatcher_mode) || $CFG->mnet_dispatcher_mode !== 'strict' diff --git a/admin/mnet/peers.php b/admin/mnet/peers.php index eee628d3150..b6e8cdd213e 100644 --- a/admin/mnet/peers.php +++ b/admin/mnet/peers.php @@ -7,25 +7,24 @@ require_once($CFG->libdir.'/adminlib.php'); include_once($CFG->dirroot.'/mnet/lib.php'); require_login(); -$adminroot = admin_get_root(); -admin_externalpage_setup('mnetpeers', $adminroot); +admin_externalpage_setup('mnetpeers'); $context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions"); if (!extension_loaded('openssl')) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_error('requiresopenssl', 'mnet', '', NULL, true); } if (!$site = get_site()) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_error('nosite', '', '', NULL, true); } if (!function_exists('curl_init') ) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_error('nocurl', 'mnet', '', NULL, true); } diff --git a/admin/mnet/trustedhosts.html b/admin/mnet/trustedhosts.html index 1aa16d38b16..26da1699bdb 100644 --- a/admin/mnet/trustedhosts.html +++ b/admin/mnet/trustedhosts.html @@ -1,5 +1,5 @@
@@ -64,5 +64,5 @@ admin_externalpage_print_header($adminroot);
diff --git a/admin/mnet/trustedhosts.php b/admin/mnet/trustedhosts.php index 06243a917a8..932e84a6a6c 100644 --- a/admin/mnet/trustedhosts.php +++ b/admin/mnet/trustedhosts.php @@ -6,20 +6,19 @@ include_once($CFG->dirroot.'/mnet/lib.php'); require_login(); - $adminroot = admin_get_root(); - admin_externalpage_setup('trustedhosts', $adminroot); + admin_externalpage_setup('trustedhosts'); $context = get_context_instance(CONTEXT_SYSTEM); require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions"); if (!extension_loaded('openssl')) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_error('requiresopenssl', 'mnet', '', NULL, true); } if (!$site = get_site()) { - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_error('nosite', '', '', NULL, true); } diff --git a/admin/module.php b/admin/module.php index 314e57788ae..396cf85479f 100644 --- a/admin/module.php +++ b/admin/module.php @@ -3,8 +3,8 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('managemodules', $adminroot); + + admin_externalpage_setup('managemodules'); /// If data submitted, then process and store. @@ -51,7 +51,7 @@ // of the page. It is also used to generate the link to the Moodle Docs for this view. $CFG->pagepath = 'mod/' . $module . '/config'; - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strmodulename); @@ -62,6 +62,6 @@ include("$CFG->dirroot/mod/$module/config.html"); print_simple_box_end(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/modules.php b/admin/modules.php index b5742a99b9b..1f395374edf 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -9,8 +9,7 @@ // defines define('MODULE_TABLE','module_administration_table'); - $adminroot = admin_get_root(); - admin_externalpage_setup('managemodules', $adminroot); + admin_externalpage_setup('managemodules'); $show = optional_param('show', '', PARAM_SAFEDIR); $hide = optional_param('hide', '', PARAM_SAFEDIR); @@ -30,7 +29,7 @@ $stractivitymodule = get_string("activitymodule"); $strshowmodulecourse = get_string('showmodulecourse'); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($stractivities); @@ -67,7 +66,7 @@ notice_yesno(get_string("moduledeleteconfirm", "", $strmodulename), "modules.php?delete=$delete&confirm=1&sesskey=$USER->sesskey", "modules.php"); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } else { // Delete everything!! @@ -213,6 +212,6 @@ $table->print_html(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/multilangupgrade.php b/admin/multilangupgrade.php index fb88a4d04d7..8083af1c352 100644 --- a/admin/multilangupgrade.php +++ b/admin/multilangupgrade.php @@ -4,17 +4,13 @@ require_once('../config.php'); require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->libdir.'/adminlib.php'); -$adminroot = admin_get_root(); -admin_externalpage_setup('multilangupgrade', $adminroot); + +admin_externalpage_setup('multilangupgrade'); $go = optional_param('go', 0, PARAM_BOOL); -require_login(); - -require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - ################################################################### -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); print_heading(get_string('multilangupgrade', 'admin')); @@ -23,7 +19,7 @@ $strmultilangupgrade = get_String('multilangupgradeinfo', 'admin'); if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form $optionsyes = array('go'=>1, 'sesskey'=>sesskey()); notice_yesno($strmultilangupgrade, 'multilangupgrade.php', 'index.php', $optionsyes, null, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } @@ -96,7 +92,7 @@ notify('...finished', 'notifysuccess'); print_continue('index.php'); -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); die; diff --git a/admin/oacleanup.php b/admin/oacleanup.php index 78ac48f39a3..04d0cd3fd6b 100644 --- a/admin/oacleanup.php +++ b/admin/oacleanup.php @@ -4,16 +4,12 @@ if (!isset($CFG)) { require('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('oacleanup', $adminroot); - require_login(); + admin_externalpage_setup('oacleanup'); - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); online_assignment_cleanup(true); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } diff --git a/admin/phpinfo.php b/admin/phpinfo.php index daf30b2da4e..5c2398b576f 100644 --- a/admin/phpinfo.php +++ b/admin/phpinfo.php @@ -4,14 +4,9 @@ require_once("../config.php"); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('phpinfo', $adminroot); + admin_externalpage_setup('phpinfo'); - require_login(); - - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); echo '
'; @@ -33,6 +28,6 @@ echo '
'; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/replace.php b/admin/replace.php index 561054f1a2c..b47d26a3c72 100644 --- a/admin/replace.php +++ b/admin/replace.php @@ -4,18 +4,14 @@ require_once('../config.php'); require_once($CFG->dirroot.'/course/lib.php'); require_once($CFG->libdir.'/adminlib.php'); -$adminroot = admin_get_root(); -admin_externalpage_setup('replace', $adminroot); + +admin_externalpage_setup('replace'); $search = optional_param('search', '', PARAM_RAW); $replace = optional_param('replace', '', PARAM_RAW); -require_login(); - -require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - ################################################################### -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); print_heading('Search and replace text throughout the whole database'); @@ -32,7 +28,7 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Pr echo ''; echo ''; print_simple_box_end(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } @@ -73,6 +69,6 @@ notify('...finished'); print_continue('index.php'); -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); ?> diff --git a/admin/report/courseoverview/index.php b/admin/report/courseoverview/index.php index 312a6f12aae..06f52c9cd90 100644 --- a/admin/report/courseoverview/index.php +++ b/admin/report/courseoverview/index.php @@ -4,11 +4,9 @@ require_once($CFG->dirroot.'/lib/statslib.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); + admin_externalpage_setup('reportcourseoverview'); - admin_externalpage_setup('reportcourseoverview', $adminroot); - - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $report = optional_param('report', STATS_REPORT_ACTIVE_COURSES, PARAM_INT); $time = optional_param('time', 0, PARAM_INT); @@ -17,7 +15,7 @@ require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_SYSTEM, SITEID)); // needed? if (empty($CFG->enablestats)) { - redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3, $adminroot); + redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3); } @@ -46,7 +44,7 @@ $timeoptions = stats_get_time_options($now,$lastweekend,$lastmonthend,$earliestday,$earliestweek,$earliestmonth); if (empty($timeoptions)) { - error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id, $adminroot); + error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id); } echo '
'."\n"; @@ -115,6 +113,6 @@ print_table($table); } } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/report/log/index.php b/admin/report/log/index.php index d89c533812f..df808f31b57 100644 --- a/admin/report/log/index.php +++ b/admin/report/log/index.php @@ -5,11 +5,9 @@ require_once($CFG->dirroot.'/course/report/log/lib.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); + admin_externalpage_setup('reportlog'); - admin_externalpage_setup('reportlog', $adminroot); - - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $course = get_site(); @@ -28,6 +26,6 @@ print_heading($heading, 'center', 3); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> \ No newline at end of file diff --git a/admin/report/simpletest/index.php b/admin/report/simpletest/index.php index 6646985d633..806b1cecf01 100644 --- a/admin/report/simpletest/index.php +++ b/admin/report/simpletest/index.php @@ -31,10 +31,9 @@ $showsearch = optional_param('showsearch', false, PARAM_BOOL); $thorough = optional_param('thorough', false, PARAM_BOOL); // Print the header. -$adminroot = admin_get_root(); -admin_externalpage_setup('reportsimpletest', $adminroot); +admin_externalpage_setup('reportsimpletest'); $strtitle = get_string('unittests', $langfile); -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); if (!is_null($path)) { // Create the group of tests. @@ -106,6 +105,6 @@ echo '
'; print_simple_box_end(); // Footer. -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); ?> diff --git a/admin/report/stats/index.php b/admin/report/stats/index.php index a96d56ce19a..410e3dae5d7 100644 --- a/admin/report/stats/index.php +++ b/admin/report/stats/index.php @@ -6,11 +6,9 @@ require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); + admin_externalpage_setup('reportstats'); - admin_externalpage_setup('reportstats', $adminroot); - - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $courseid = optional_param('course', SITEID, PARAM_INT); @@ -30,7 +28,7 @@ } if ($mode == STATS_MODE_RANKED) { - redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3, $adminroot); + redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/stats/index.php?time='.$time, '', 3); } if (!$course = get_record("course","id",$courseid)) { @@ -46,7 +44,7 @@ require_login(); if (empty($CFG->enablestats)) { - redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3, $adminroot); + redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3); } require_capability('moodle/site:viewreports', get_context_instance(CONTEXT_COURSE, $course->id)); @@ -72,6 +70,6 @@ require_once($CFG->dirroot.'/course/report/stats/report.php'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/roles/allowassign.php b/admin/roles/allowassign.php index 7354095efa7..a17796c80fb 100755 --- a/admin/roles/allowassign.php +++ b/admin/roles/allowassign.php @@ -8,11 +8,9 @@ * then he can modify the roles_allow_assign table via this interface. */ require_once('../../config.php'); -/// check capabilities here - require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('defineroles', $adminroot); + + admin_externalpage_setup('defineroles'); $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); @@ -50,7 +48,7 @@ } /// displaying form here - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $currenttab='allowassign'; require_once('managetabs.php'); @@ -84,7 +82,7 @@ echo ''; // this is needed otherwise we do not know a form has been submitted echo ''; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); diff --git a/admin/roles/allowoverride.php b/admin/roles/allowoverride.php index cd2615880cb..87a4ec04732 100755 --- a/admin/roles/allowoverride.php +++ b/admin/roles/allowoverride.php @@ -6,11 +6,9 @@ * and be in the roles_allow_override table. */ require_once('../../config.php'); -/// check capabilities here - require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('defineroles', $adminroot); + + admin_externalpage_setup('defineroles'); $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); @@ -48,7 +46,7 @@ } /// displaying form here - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $currenttab='allowoverride'; require_once('managetabs.php'); @@ -82,7 +80,7 @@ echo ''; // this is needed otherwise we do not know a form has been submitted echo ''; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); // returns array function get_box_list($roleid, $arraylist){ diff --git a/admin/roles/assign.php b/admin/roles/assign.php index 5bd81642e1f..3996b349edf 100755 --- a/admin/roles/assign.php +++ b/admin/roles/assign.php @@ -116,13 +116,11 @@ $currenttab = 'assign'; include_once($CFG->dirroot.'/user/tabs.php'); } else if ($context->contextlevel == CONTEXT_SYSTEM) { - $adminroot = admin_get_root(); - admin_externalpage_setup('assignroles', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('assignroles'); + admin_externalpage_print_header(); } else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) { - $adminroot = admin_get_root(); - admin_externalpage_setup('frontpageroles', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('frontpageroles'); + admin_externalpage_print_header(); $currenttab = ''; $tabsmode = 'assign'; include_once('tabs.php'); @@ -289,7 +287,7 @@ } if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer($course); } diff --git a/admin/roles/manage.php b/admin/roles/manage.php index bf20749d875..09f647fef77 100755 --- a/admin/roles/manage.php +++ b/admin/roles/manage.php @@ -3,9 +3,8 @@ require_once('../../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('defineroles', $adminroot); + admin_externalpage_setup('defineroles'); $roleid = optional_param('roleid', 0, PARAM_INT); // if set, we are editing a role $name = optional_param('name', '', PARAM_MULTILANG); // new role name @@ -245,7 +244,7 @@ } else if (confirm_sesskey()){ // show confirmation - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $optionsyes = array('action'=>'delete', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1); $a = new object(); $a->id = $roleid; @@ -253,7 +252,7 @@ $a->shortname = $roles[$roleid]->shortname; $a->count = (int)count_records('role_assignments', 'roleid', $roleid); notice_yesno(get_string('deleterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } @@ -299,7 +298,7 @@ //ok - lets duplicate! } else { // show confirmation - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $optionsyes = array('action'=>'duplicate', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsno = array('action'=>'view', 'roleid'=>$roleid); $a = new object(); @@ -307,7 +306,7 @@ $a->name = $roles[$roleid]->name; $a->shortname = $roles[$roleid]->shortname; notice_yesno(get_string('duplicaterolesure', 'role', $a), 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } @@ -356,7 +355,7 @@ } else { // show confirmation - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $optionsyes = array('action'=>'reset', 'roleid'=>$roleid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsno = array('action'=>'view', 'roleid'=>$roleid); $a = new object(); @@ -370,7 +369,7 @@ $warning = get_string('resetrolesure', 'role', $a); } notice_yesno($warning, 'manage.php', 'manage.php', $optionsyes, $optionsno, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } @@ -382,7 +381,7 @@ /// print UI now - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); $currenttab = 'manage'; include_once('managetabs.php'); @@ -535,7 +534,7 @@ echo ''; } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; diff --git a/admin/roles/override.php b/admin/roles/override.php index b031d785204..4d6d2ece2e7 100755 --- a/admin/roles/override.php +++ b/admin/roles/override.php @@ -155,9 +155,8 @@ include_once($CFG->dirroot.'/user/tabs.php'); } else if ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID) { require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('frontpageroles', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('frontpageroles'); + admin_externalpage_print_header(); $currenttab = ''; $tabsmode = 'override'; include_once('tabs.php'); @@ -225,7 +224,7 @@ } if ($context->contextlevel == CONTEXT_SYSTEM or ($context->contextlevel==CONTEXT_COURSE and $context->instanceid == SITEID)) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer($course); } diff --git a/admin/search.php b/admin/search.php index 4d97a401909..e94f8ef6948 100644 --- a/admin/search.php +++ b/admin/search.php @@ -7,8 +7,7 @@ require_once($CFG->libdir.'/adminlib.php'); $query = trim(stripslashes_safe(required_param('query', PARAM_NOTAGS))); // Search string -$adminroot = admin_get_root(); -admin_externalpage_setup('search', $adminroot); // now hidden page +admin_externalpage_setup('search'); // now hidden page $CFG->adminsearchquery = $query; // So we can reference it in search boxes later in this invocation @@ -50,7 +49,7 @@ if ($data = data_submitted()) { // and finally, if we get here, then there are matching settings and we have to print a form // to modify them -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); if ($statusmsg != '') { notify ($statusmsg); @@ -74,7 +73,7 @@ if ($resultshtml != '') { echo ''; echo ''; -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); /** diff --git a/admin/stickyblocks.php b/admin/stickyblocks.php index 38d999e482b..21d5ea1dfda 100644 --- a/admin/stickyblocks.php +++ b/admin/stickyblocks.php @@ -57,9 +57,8 @@ } else { require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('stickyblocks', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('stickyblocks'); + admin_externalpage_print_header(); } @@ -78,7 +77,7 @@ echo ''; print_footer(); } else { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } ?> diff --git a/admin/timezoneimport.php b/admin/timezoneimport.php index ba9d6b8b860..33400b659c4 100644 --- a/admin/timezoneimport.php +++ b/admin/timezoneimport.php @@ -7,8 +7,7 @@ require_once($CFG->libdir.'/filelib.php'); require_once($CFG->libdir.'/olson.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('timezoneimport', $adminroot); + admin_externalpage_setup('timezoneimport'); $ok = optional_param('ok', 0, PARAM_BOOL); @@ -17,7 +16,7 @@ $strimporttimezones = get_string('importtimezones', 'admin'); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strimporttimezones); @@ -33,7 +32,7 @@ notice_yesno($message, 'timezoneimport.php?ok=1&sesskey='.sesskey(), 'index.php'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } @@ -123,6 +122,6 @@ print_continue('index.php'); } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/upgradeforumread.php b/admin/upgradeforumread.php index 9d620e7afb0..840e04b66ab 100644 --- a/admin/upgradeforumread.php +++ b/admin/upgradeforumread.php @@ -3,15 +3,11 @@ require_once('../config.php'); require_once($CFG->dirroot.'/mod/forum/lib.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('upgradeforumread', $adminroot); + + admin_externalpage_setup('upgradeforumread'); $confirm = optional_param('confirm', 0, PARAM_BOOL); - require_login(); - - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - if ($CFG->version < 2005042300) { error("This script does not work with this old version of Moodle"); } @@ -25,14 +21,14 @@ $strupgradingdata = get_string('upgradingdata', 'admin'); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strupgradingdata); if (!data_submitted() or empty($confirm) or !confirm_sesskey()) { $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey()); notice_yesno(get_string('upgradeforumreadinfo', 'admin'), 'upgradeforumread.php', 'index.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } @@ -108,6 +104,6 @@ print_continue('index.php'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/upgradelogs.php b/admin/upgradelogs.php index a70327a9649..2803e2c2370 100644 --- a/admin/upgradelogs.php +++ b/admin/upgradelogs.php @@ -2,15 +2,11 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('upgradelogs', $adminroot); + + admin_externalpage_setup('upgradelogs'); $confirm = optional_param('confirm', 0, PARAM_BOOL); - require_login(); - - require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)); - if ($CFG->version < 2004013101) { error("This script does not work with this old version of Moodle"); } @@ -29,14 +25,14 @@ /// Print header $strupgradinglogs = get_string("upgradinglogs", "admin"); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strupgradinglogs); if (!data_submitted() or empty($confirm) or !confirm_sesskey()) { $optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey()); notice_yesno(get_string('upgradeforumreadinfo', 'admin'), 'upgradelogs.php', 'index.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } @@ -124,6 +120,6 @@ print_continue('index.php'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/upgradesettings.php b/admin/upgradesettings.php index 3b6482c4202..1c801e26a72 100644 --- a/admin/upgradesettings.php +++ b/admin/upgradesettings.php @@ -6,8 +6,7 @@ require_once('../config.php'); require_once($CFG->libdir.'/adminlib.php'); -$adminroot = admin_get_root(); -admin_externalpage_setup('upgradesettings', $adminroot); // now hidden page +admin_externalpage_setup('upgradesettings'); // now hidden page // a caveat: we're depending on only having one admin access this page at once. why? the following line // (the function call to find_new_settings) must have the EXACT SAME RETURN VALUE both times that this @@ -54,7 +53,7 @@ if ($data = data_submitted()) { // and finally, if we get here, then there are new settings and we have to print a form // to modify them -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); print_simple_box(get_string('upgradesettingsintro','admin'),'','100%','',5,'generalbox',''); @@ -67,7 +66,7 @@ echo ''; echo '
'; echo ''; -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); /** diff --git a/admin/uploaduser.php b/admin/uploaduser.php index 16eaf03256d..73b7b6d818d 100755 --- a/admin/uploaduser.php +++ b/admin/uploaduser.php @@ -6,16 +6,14 @@ require_once('../config.php'); require_once($CFG->libdir.'/uploadlib.php'); require_once($CFG->libdir.'/adminlib.php'); -$adminroot = admin_get_root(); -admin_externalpage_setup('uploadusers', $adminroot); + +admin_externalpage_setup('uploadusers'); $createpassword = optional_param('createpassword', 0, PARAM_BOOL); $updateaccounts = optional_param('updateaccounts', 0, PARAM_BOOL); $allowrenames = optional_param('allowrenames', 0, PARAM_BOOL); -require_login(); - -require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID)); +require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM)); if (! $site = get_site()) { error("Could not find site-level course"); @@ -47,7 +45,7 @@ if (isset($CFG->CSV_DELIMITER)) { /// Print the header -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); /// If a file has been uploaded, then process it @@ -402,7 +400,7 @@ echo ''; echo '
'; echo ''; -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); diff --git a/admin/user.php b/admin/user.php index 8ccbb8e1cce..8b19695ca29 100644 --- a/admin/user.php +++ b/admin/user.php @@ -17,8 +17,8 @@ $lu = optional_param('lu', '2', PARAM_INT); // show local users $acl = optional_param('acl', '0', PARAM_INT); // id of user to tweak mnet ACL (requires $access) - $adminroot = admin_get_root(); - admin_externalpage_setup('editusers', $adminroot); + + admin_externalpage_setup('editusers'); // Let's see if we have *any* mnet users. Just ask for a single record $mnet_users = get_records_select('user', " auth='mnet' AND mnethostid != '{$CFG->mnet_localhost_id}' ", '', '*', '0', '1'); @@ -69,7 +69,7 @@ $securewwwroot = str_replace('http:','https:',$CFG->wwwroot); } - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); if ($confirmuser and confirm_sesskey()) { if (!$user = get_record('user', 'id', $confirmuser)) { @@ -106,7 +106,7 @@ print_heading(get_string('deleteuser', 'admin')); $optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey()); notice_yesno(get_string('deletecheckfull', '', "'$fullname'"), 'user.php', 'user.php', $optionsyes, NULL, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } else if (data_submitted() and !$user->deleted) { //following code is also used in auth sync scripts @@ -421,7 +421,7 @@ } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/admin/xmldb/index.php b/admin/xmldb/index.php index 4353bfab5f4..fd7e46e4143 100644 --- a/admin/xmldb/index.php +++ b/admin/xmldb/index.php @@ -53,8 +53,8 @@ require_once('../../config.php'); require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->libdir.'/ddllib.php'); // Install/upgrade related db functions - $adminroot = admin_get_root(); - admin_externalpage_setup('xmldbeditor', $adminroot); + + admin_externalpage_setup('xmldbeditor'); /// Add other used libraries require_once($CFG->libdir . '/xmlize.php'); @@ -105,10 +105,10 @@ $standard_javascript = $CFG->javascript; // Save original javascript file $CFG->javascript = $CFG->dirroot.'/'.$CFG->admin.'/xmldb/javascript.php'; //Use our custom javascript code /// Go with standard admin header - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($xmldb_action->getTitle()); echo $xmldb_action->getOutput(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); break; case ACTION_GENERATE_XML: header('Content-type: application/xhtml+xml'); diff --git a/course/category.php b/course/category.php index 4a47f4071bd..26a0867762b 100644 --- a/course/category.php +++ b/course/category.php @@ -93,9 +93,8 @@ // modify this to treat this as an admin page require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('coursemgmt', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('coursemgmt'); + admin_externalpage_print_header(); } else { print_header("$site->shortname: $category->name", "$site->fullname: $strcourses", "$strcategories -> $category->name", "", "", true, $navbaritem); @@ -455,7 +454,7 @@ print_course_search(); if ($adminediting) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer(); } diff --git a/course/index.php b/course/index.php index 4487ebe48b5..a39ccee9f46 100644 --- a/course/index.php +++ b/course/index.php @@ -108,9 +108,8 @@ if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { require_once($CFG->libdir.'/adminlib.php'); - $adminroot = admin_get_root(); - admin_externalpage_setup('coursemgmt', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('coursemgmt'); + admin_externalpage_print_header(); } else { print_header("$site->shortname: $strcategories", $strcourses, $strcategories, '', '', true, update_categories_button()); @@ -159,7 +158,7 @@ "index.php?sesskey=$USER->sesskey"); if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer(); } @@ -328,7 +327,7 @@ echo ''; if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer(); } diff --git a/course/report/log/index.php b/course/report/log/index.php index 8d7edcc30cb..cada4d3f963 100644 --- a/course/report/log/index.php +++ b/course/report/log/index.php @@ -75,9 +75,8 @@ switch ($logformat) { case 'showashtml': if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) { - $adminroot = admin_get_root(); - admin_externalpage_setup('reportlog', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('reportlog'); + admin_externalpage_print_header(); } else { print_header($course->shortname .': '. $strlogs, $course->fullname, @@ -123,9 +122,8 @@ } else { if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) { - $adminroot = admin_get_root(); - admin_externalpage_setup('reportlog', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('reportlog'); + admin_externalpage_print_header(); } else { print_header($course->shortname .': '. $strlogs, $course->fullname, "wwwroot/course/view.php?id=$course->id\">$course->shortname -> @@ -147,7 +145,7 @@ } if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer($course); } diff --git a/course/report/stats/report.php b/course/report/stats/report.php index 973e941f829..1f03ace7980 100644 --- a/course/report/stats/report.php +++ b/course/report/stats/report.php @@ -11,17 +11,10 @@ } } - // Ugly hack. This file may be included from admin or course reports. - // For admin reports, $adminroot is set. We basically use it to decide - // what kind of footer we need to print. - if (!isset($adminroot)) { - $adminroot = false; - } - $reportoptions = stats_get_report_options($course->id, $mode); $timeoptions = report_stats_timeoptions($mode); if (empty($timeoptions)) { - error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id, $adminroot); + error(get_string('nostatstodisplay'), $CFG->wwwroot.'/course/view.php?id='.$course->id); } $table->width = '*'; @@ -39,7 +32,7 @@ .' ORDER BY r.sortorder'; if (!$us = get_records_sql($sql)) { - error('Cannot enter detailed view: No users found for this course.', $adminroot); + error('Cannot enter detailed view: No users found for this course.'); } foreach ($us as $u) { @@ -76,7 +69,7 @@ if (!empty($report) && !empty($time)) { if ($report == STATS_REPORT_LOGINS && $course->id != SITEID) { - error('This type of report is only available for the site course', $adminroot); + error('This type of report is only available for the site course'); } $timesql = $param = stats_get_parameters($time,$report,$course->id,$mode); diff --git a/enrol/mnet/allowed_courses.php b/enrol/mnet/allowed_courses.php index 176e596635d..abd797c5413 100644 --- a/enrol/mnet/allowed_courses.php +++ b/enrol/mnet/allowed_courses.php @@ -10,17 +10,16 @@ require_once dirname(dirname(dirname(__FILE__))) . '/config.php'; require_once $CFG->libdir . '/adminlib.php'; include_once $CFG->dirroot . '/mnet/lib.php'; -require_login(); -$adminroot = admin_get_root(); -admin_externalpage_setup('ssoaccesscontrol', $adminroot); -admin_externalpage_print_header($adminroot); + +admin_externalpage_setup('ssoaccesscontrol'); +admin_externalpage_print_header(); $addcategory = optional_param('addcategory', 0, PARAM_BOOL); $removecategory = optional_param('removecategory', 0, PARAM_BOOL); $addcourse = optional_param('addcourse', 0, PARAM_BOOL); $removecourse = optional_param('removecourse', 0, PARAM_BOOL); -$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID); +$sitecontext = get_context_instance(CONTEXT_SYSTEM); $sesskey = sesskey(); $formerror = array(); @@ -250,6 +249,6 @@ if (count($courses) < 1) { diff --git a/files/index.php b/files/index.php index fb2b222acba..264fbdbf742 100644 --- a/files/index.php +++ b/files/index.php @@ -39,12 +39,12 @@ require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id)); function html_footer() { - global $course, $choose, $adminroot; + global $course, $choose; echo ''; if ($course->id == SITEID) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else { print_footer($course); } @@ -117,13 +117,11 @@ if ($course->id == SITEID) { if ($wdir == "/backupdata") { - $adminroot = admin_get_root(); - admin_externalpage_setup('frontpagerestore', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('frontpagerestore'); + admin_externalpage_print_header(); } else { - $adminroot = admin_get_root(); - admin_externalpage_setup('sitefiles', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('sitefiles'); + admin_externalpage_print_header(); print_heading(get_string("publicsitefileswarning"), "center", 2); diff --git a/group/db/upgrade.php b/group/db/upgrade.php index acd0b2dc932..e338c435c74 100644 --- a/group/db/upgrade.php +++ b/group/db/upgrade.php @@ -67,7 +67,6 @@ function upgrade_group_db($continueto) { //initialize default group settings now install_group_db(); - $adminroot = admin_get_root(); print_continue($continueto); print_footer('none'); exit; diff --git a/lib/adminlib.php b/lib/adminlib.php index f346a7c6d7c..49fe2f866e0 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -722,12 +722,11 @@ function is_dataroot_insecure() { /// require_once('.../config.php'); /// require_once($CFG->libdir.'/adminlib.php'); -/// $adminroot = admin_get_root(); -/// admin_externalpage_setup('foo', $adminroot); +/// admin_externalpage_setup('foo'); /// // functionality like processing form submissions goes here -/// admin_externalpage_print_header($adminroot); +/// admin_externalpage_print_header(); /// // your HTML goes here -/// admin_externalpage_print_footer($adminroot); +/// admin_externalpage_print_footer(); /// The admin_externalpage_setup() function call ensures the user is logged in, /// and makes sure that they have the proper role permission to access the page. @@ -2632,10 +2631,12 @@ class admin_setting_special_debugdisplay extends admin_setting_configcheckbox { // Code for a function that helps externalpages print proper headers and footers // N.B.: THIS FUNCTION HANDLES AUTHENTICATION -function admin_externalpage_setup($section, $adminroot) { +function admin_externalpage_setup($section) { global $CFG, $PAGE, $USER; + $adminroot = admin_get_root(); + require_once($CFG->libdir . '/blocklib.php'); require_once($CFG->dirroot . '/'.$CFG->admin.'/pagelib.php'); @@ -2681,10 +2682,12 @@ function admin_externalpage_setup($section, $adminroot) { } -function admin_externalpage_print_header($adminroot) { +function admin_externalpage_print_header() { global $CFG, $PAGE, $SITE, $THEME; + define('ADMIN_EXT_HEADER_PRINTED', 'true'); + if (!empty($SITE->fullname)) { $pageblocks = blocks_setup($PAGE); @@ -2714,10 +2717,12 @@ function admin_externalpage_print_header($adminroot) { } } -function admin_externalpage_print_footer($adminroot) { +function admin_externalpage_print_footer() { global $CFG, $PAGE, $SITE, $THEME; + define('ADMIN_EXT_FOOTER_PRINTED', 'true'); + if (!empty($SITE->fullname)) { $pageblocks = blocks_setup($PAGE); $preferred_width_right = bounded_number(BLOCK_R_MIN_WIDTH, diff --git a/lib/weblib.php b/lib/weblib.php index 5c1285ff4d7..6d58f7ea4ad 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -2421,6 +2421,10 @@ function print_header_simple($title='', $heading='', $navigation='', $focus='', function print_footer($course=NULL, $usercourse=NULL, $return=false) { global $USER, $CFG, $THEME, $COURSE; + if (defined('ADMIN_EXT_HEADER_PRINTED') and !defined('ADMIN_EXT_FOOTER_PRINTED')) { + admin_externalpage_print_footer(); + } + /// Course links if ($course) { if (is_string($course) && $course == 'none') { // Don't print any links etc @@ -4715,7 +4719,7 @@ function print_scale_menu_helpbutton($courseid, $scale, $return=false) { * @param string $message The message to display to the user about the error. * @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page. */ -function error ($message, $link='', $adminroot=false) { +function error ($message, $link='') { global $CFG, $SESSION; $message = clean_text($message); // In case nasties are in here @@ -4749,8 +4753,8 @@ function error ($message, $link='', $adminroot=false) { } } - if ($adminroot) { - admin_externalpage_print_footer($adminroot); + if (defined('ADMIN_EXT_HEADER_PRINTED')) { + admin_externalpage_print_footer(); } else { print_continue($link); print_footer(); @@ -4770,9 +4774,8 @@ function error ($message, $link='', $adminroot=false) { * @param string $errorcode The name of the string from error.php to print * @param string $link The url where the user will be prompted to continue. If no url is provided the user will be directed to the site index page. * @param object $a Extra words and phrases that might be required in the error string - * @param boolean $adminroot Is the page an admin settings page? */ -function print_error ($errorcode, $module='', $link='', $a=NULL, $adminroot=false) { +function print_error ($errorcode, $module='', $link='', $a=NULL) { global $CFG; @@ -4795,7 +4798,7 @@ function print_error ($errorcode, $module='', $link='', $a=NULL, $adminroot=fals '

'. ''. get_string('moreinformation').'

'; - error($message, $link, $adminroot); + error($message, $link); } /** * Returns a string of html with an image of a help icon linked to a help page on a number of help topics. @@ -4980,7 +4983,7 @@ function editorshortcutshelpbutton() { * @param string $link ? * @todo Finish documenting this function */ -function notice ($message, $link='', $course=NULL, $adminroot='') { +function notice ($message, $link='', $course=NULL) { global $CFG, $SITE; $message = clean_text($message); @@ -4989,8 +4992,8 @@ function notice ($message, $link='', $course=NULL, $adminroot='') { print_continue($link); // xhtml strict fix, need to make sure it's the right footer - if ($adminroot) { - admin_externalpage_print_footer($adminroot); + if (defined('ADMIN_EXT_HEADER_PRINTED')) { + admin_externalpage_print_footer(); exit; } @@ -5051,7 +5054,7 @@ if (!function_exists('error_get_last')) { * the correct input) and then encode for where it's needed * echo ""; */ -function redirect($url, $message='', $delay=-1, $adminroot = '') { +function redirect($url, $message='', $delay=-1) { global $CFG; @@ -5138,8 +5141,8 @@ function redirect($url, $message='', $delay=-1, $adminroot = '') { } // fix for MDL-8517, admin pages redirections causes bad xhtml - if ($adminroot) { - admin_externalpage_print_footer($adminroot); + if (defined('ADMIN_EXT_HEADER_PRINTED')) { + admin_externalpage_print_footer(); } else { print_footer('none'); } diff --git a/theme/index.php b/theme/index.php index d8e4846377a..ddc986d9e67 100644 --- a/theme/index.php +++ b/theme/index.php @@ -5,8 +5,7 @@ $choose = optional_param("choose",'',PARAM_FILE); // set this theme as default - $adminroot = admin_get_root(); - admin_externalpage_setup('themeselector', $adminroot); + admin_externalpage_setup('themeselector'); unset($SESSION->theme); @@ -28,7 +27,7 @@ } if (set_config("theme", $choose)) { theme_setup($choose); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading(get_string("themesaved")); print_continue("$CFG->wwwroot/"); @@ -43,7 +42,7 @@ echo format_text(implode('', $file), FORMAT_MOODLE); print_simple_box_end(); } - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); exit; } else { error("Could not set the theme!"); @@ -135,7 +134,7 @@ echo ""; - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); ?> diff --git a/user/editadvanced.php b/user/editadvanced.php index 0f3c291eda2..e7d7f5c66f4 100644 --- a/user/editadvanced.php +++ b/user/editadvanced.php @@ -141,13 +141,12 @@ /// Display page header if ($user->id == -1 or ($user->id != $USER->id)) { - $adminroot = admin_get_root(); if ($user->id == -1) { - admin_externalpage_setup('addnewuser', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('addnewuser'); + admin_externalpage_print_header(); } else { - admin_externalpage_setup('editusers', $adminroot); - admin_externalpage_print_header($adminroot); + admin_externalpage_setup('editusers'); + admin_externalpage_print_header(); $userfullname = fullname($user, true); print_heading($userfullname); } @@ -183,7 +182,7 @@ /// and proper footer if ($user->id == -1 or ($user->id != $USER->id)) { - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); } else if (!empty($USER->newadminuser)) { print_footer('none'); } else { diff --git a/user/profile/definelib.php b/user/profile/definelib.php index a936f276ebd..60ff80baf2c 100644 --- a/user/profile/definelib.php +++ b/user/profile/definelib.php @@ -381,7 +381,7 @@ function profile_list_categories() { /// Are we adding or editing a cateogory? -function profile_edit_category($id, $redirect, $adminroot) { +function profile_edit_category($id, $redirect) { global $CFG; require_once('index_category_form.php'); @@ -418,16 +418,16 @@ function profile_edit_category($id, $redirect, $adminroot) { } /// Print the page - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strheading); $categoryform->display(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } } -function profile_edit_field($id, $datatype, $redirect, $adminroot) { +function profile_edit_field($id, $datatype, $redirect) { global $CFG; if (!$field = get_record('user_info_field', 'id', $id)) { @@ -462,10 +462,10 @@ function profile_edit_field($id, $datatype, $redirect, $adminroot) { } /// Print the page - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading($strheading); $fieldform->display(); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; } } diff --git a/user/profile/index.php b/user/profile/index.php index f2946b5cd17..ce32ecf1566 100644 --- a/user/profile/index.php +++ b/user/profile/index.php @@ -5,8 +5,7 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/user/profile/lib.php'); require_once($CFG->dirroot.'/user/profile/definelib.php'); -$adminroot = admin_get_root(); -admin_externalpage_setup('profilefields', $adminroot); +admin_externalpage_setup('profilefields'); $action = optional_param('action', '', PARAM_ALPHA); @@ -52,10 +51,10 @@ switch ($action) { //ask for confirmation $fieldcount = count_records('user_info_field', 'categoryid', $id); $optionsyes = array ('id'=>$id, 'confirm'=>1, 'action'=>'deletecategory', 'sesskey'=>sesskey()); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading('profiledeletecategory', 'admin'); notice_yesno(get_string('profileconfirmcategorydeletion', 'admin', $fieldcount), $redirect, $redirect, $optionsyes, null, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; break; case 'deletefield': @@ -70,23 +69,23 @@ switch ($action) { //ask for confirmation $datacount = count_records('user_info_data', 'fieldid', $id); $optionsyes = array ('id'=>$id, 'confirm'=>1, 'action'=>'deletefield', 'sesskey'=>sesskey()); - admin_externalpage_print_header($adminroot); + admin_externalpage_print_header(); print_heading('profiledeletefield', 'admin'); notice_yesno(get_string('profileconfirmfielddeletion', 'admin', $datacount), $redirect, $redirect, $optionsyes, null, 'post', 'get'); - admin_externalpage_print_footer($adminroot); + admin_externalpage_print_footer(); die; break; case 'editfield': $id = optional_param('id', 0, PARAM_INT); $datatype = optional_param('datatype', '', PARAM_ALPHA); - profile_edit_field($id, $datatype, $redirect, $adminroot); + profile_edit_field($id, $datatype, $redirect); die; break; case 'editcategory': $id = optional_param('id', 0, PARAM_INT); - profile_edit_category($id, $redirect, $adminroot); + profile_edit_category($id, $redirect); die; break; default: @@ -94,7 +93,7 @@ switch ($action) { } /// Print the header -admin_externalpage_print_header($adminroot); +admin_externalpage_print_header(); print_heading(get_string('profilefields', 'admin')); /// Check that we have at least one category defined @@ -148,7 +147,7 @@ print_single_button('index.php', $options, get_string('profilecreatecategory', ' echo ''; -admin_externalpage_print_footer($adminroot); +admin_externalpage_print_footer(); die;