MDL-9647 simplify dealing with headers/footers in admin sections

This commit is contained in:
skodak 2007-04-30 17:08:34 +00:00
parent 3f7353c5d8
commit 1ae083e424
67 changed files with 286 additions and 362 deletions

View File

@ -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 '</fieldset>';
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges', 'admin').'" /></div>';
echo '</div>';
echo '</form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 "<form $CFG->frametarget id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
@ -80,7 +79,7 @@ echo '<p style="text-align: center"><input type="submit" value="' . get_string("
echo "</div>\n";
echo "</form>\n";
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////

View File

@ -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 '</p>';
$block->config_print();
echo '</form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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.'&amp;confirm=1&amp;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();
?>

View File

@ -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 '<h1 align="center">Done!</h1>';
print_continue($CFG->wwwroot);
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;

View File

@ -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 "</div>";
echo "</form>";
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol_config.php\">";
echo "<div>";
@ -66,7 +65,7 @@
echo "</div>";
echo "</form>";
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
exit;
?>

View File

@ -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 '<div class="reportlink"><a href="environment.php?action=updatecomponent&amp;sesskey='.$USER->sesskey.'">'.$strupdate.'</a></div>';
@ -133,5 +132,5 @@
$status = check_moodle_environment($version, $environment_results);
/// Print footer
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 @@
<?php
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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();
?>

View File

@ -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 <<<STYLES
<style type="text/css">
@ -100,7 +100,7 @@ STYLES;
}
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
function health_find_problems() {

View File

@ -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();
?>

View File

@ -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();
}
?>

View File

@ -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("<a href=\"lang.php?mode=compare\">$streditstrings</a>");
print_heading("<a href=\"langdoc.php\">$stredithelpdocs</a>");
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();
//////////////////////////////////////////////////////////////////////

View File

@ -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")."</font></p>";
error_reporting($CFG->debug);
}
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
//////////////////////////////////////////////////////////////////////

View File

@ -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

View File

@ -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();
?>

View File

@ -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();
?>

View File

@ -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('<strong>' . 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();
?>

View File

@ -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('<strong>' . s($host->name) . ' </strong><br />'
. get_string("enrolcourses_desc", "mnet"));
@ -53,6 +52,6 @@
}
echo '</table></div>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 '</table>'
. '</div>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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();
?>
<center>
<form method="post" action="index.php">
@ -148,5 +147,5 @@
</center>
<?php
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -5,7 +5,7 @@ $logurl = $CFG->wwwroot.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;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&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
@ -131,5 +131,5 @@ if (isset($mnet_peer->ip_address) && '' != $mnet_peer->ip_address){
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -1,5 +1,5 @@
<?php
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'mnet_services.php?step=list&amp;hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
@ -18,5 +18,5 @@ print_simple_box_start("center", "");
</table>
<?php
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -1,5 +1,5 @@
<?php
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
$logurl = $CFG->wwwroot.
'/course/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
@ -96,5 +96,5 @@ print_simple_box_start("center", "");
</form>
<?php
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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);

View File

@ -1,5 +1,5 @@
<?php
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
if (empty($CFG->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'
</form>
</div>
<?php
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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);
}

View File

@ -1,5 +1,5 @@
<?php
admin_externalpage_print_header($adminroot);
admin_externalpage_print_header();
?>
<div id="trustedhosts"><!-- See theme/standard/styles_layout.css #trustedhosts .generaltable for rules -->
<table cellspacing="0" cellpadding="5" class="generaltable generalbox" >
@ -64,5 +64,5 @@ admin_externalpage_print_header($adminroot);
</table>
</div>
<?php
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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);
}

View File

@ -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();
?>

View File

@ -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&amp;confirm=1&amp;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();
?>

View File

@ -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;

View File

@ -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();
}

View File

@ -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 '<div class="phpinfo">';
@ -33,6 +28,6 @@
echo '</div>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 '</form>';
echo '</div>';
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();
?>

View File

@ -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 '<form action="index.php" method="post">'."\n";
@ -115,6 +113,6 @@
print_table($table);
}
}
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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();
?>

View File

@ -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 '</form>';
print_simple_box_end();
// Footer.
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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();
?>

View File

@ -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 '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
echo '</div></form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

View File

@ -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 '<input type="hidden" name="dummy" value="1" />'; // this is needed otherwise we do not know a form has been submitted
echo '</div></form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
// returns array
function get_box_list($roleid, $arraylist){

View File

@ -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);
}

View File

@ -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 '</div>';
}
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
die;

View File

@ -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);
}

View File

@ -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 '</fieldset>';
echo '</form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
/**

View File

@ -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 '</tr></table>';
print_footer();
} else {
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
}
?>

View File

@ -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&amp;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();
?>

View File

@ -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();
?>

View File

@ -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();
?>

View File

@ -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 '</fieldset>';
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges','admin') . '" /></div>';
echo '</form>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
/**

View File

@ -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 '<input type="submit" value="'.$struploadusers.'" />';
echo '</div></form><br />';
echo '</div>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();

View File

@ -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();
?>

View File

@ -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');

View File

@ -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",
"<a href=\"index.php\">$strcategories</a> -> $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();
}

View File

@ -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 '</div></div>';
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
} else {
print_footer();
}

View File

@ -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,
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
@ -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);
}

View File

@ -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);

View File

@ -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) {
<?php
print_simple_box_end();
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 '</td></tr></table>';
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);

View File

@ -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;

View File

@ -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,

View File

@ -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
'<p class="errorcode">'.
'<a href="'.$errordocroot.'/en/error/'.$modulelink.'/'.$errorcode.'">'.
get_string('moreinformation').'</a></p>';
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 "<script type='text/javascript'>alert('Redirect $url');</script>";
*/
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');
}

View File

@ -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 "</table>";
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
?>

View File

@ -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 {

View File

@ -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;
}
}

View File

@ -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 '</div>';
admin_externalpage_print_footer($adminroot);
admin_externalpage_print_footer();
die;