MDL-9647 simplify dealing with headers/footers in admin sections
authorskodak <skodak>
Mon, 30 Apr 2007 17:08:34 +0000 (17:08 +0000)
committerskodak <skodak>
Mon, 30 Apr 2007 17:08:34 +0000 (17:08 +0000)
67 files changed:
admin/auth.php
admin/auth_config.php
admin/block.php
admin/blocks.php
admin/delete.php
admin/enrol.php
admin/enrol_config.php
admin/environment.php
admin/filter.php
admin/filters.php
admin/health.php
admin/index.php
admin/innodb.php
admin/lang.php
admin/langdoc.php
admin/langimport.php
admin/maintenance.php
admin/mnet/access_control.php
admin/mnet/enr_course_enrol.php
admin/mnet/enr_courses.php
admin/mnet/enr_hosts.php
admin/mnet/index.php
admin/mnet/mnet_review.html
admin/mnet/mnet_review_allhosts.html
admin/mnet/mnet_services.html
admin/mnet/mnet_services.php
admin/mnet/peers.html
admin/mnet/peers.php
admin/mnet/trustedhosts.html
admin/mnet/trustedhosts.php
admin/module.php
admin/modules.php
admin/multilangupgrade.php
admin/oacleanup.php
admin/phpinfo.php
admin/replace.php
admin/report/courseoverview/index.php
admin/report/log/index.php
admin/report/simpletest/index.php
admin/report/stats/index.php
admin/roles/allowassign.php
admin/roles/allowoverride.php
admin/roles/assign.php
admin/roles/manage.php
admin/roles/override.php
admin/search.php
admin/stickyblocks.php
admin/timezoneimport.php
admin/upgradeforumread.php
admin/upgradelogs.php
admin/upgradesettings.php
admin/uploaduser.php
admin/user.php
admin/xmldb/index.php
course/category.php
course/index.php
course/report/log/index.php
course/report/stats/report.php
enrol/mnet/allowed_courses.php
files/index.php
group/db/upgrade.php
lib/adminlib.php
lib/weblib.php
theme/index.php
user/editadvanced.php
user/profile/definelib.php
user/profile/index.php

index d6ab820a1ac48aaa55ee7e11f1bad184732192d0..dd07f22a68db0ea897582de47987b0e18d4cc272 100644 (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();
 
 ?>
index 7a65ba4ea0581264fb958e16b08dca598ac4ef57..a75f4ed20f6f824565532aa73b7f23bdb86cf77d 100644 (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 /////////////////////////////////////////////////////////////////
index 2b580ef5a57eba65c588acb1a0f2441c9c5d4e77..49048f3e2d70d73a280639b1a623ad3ecd412582 100644 (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();
 
 ?>
index c5eea01e84afab4afde6af37b00af680e3568ad6..2ceaff3739c3e663aee43fcad48438e461e3eb23 100644 (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 {
         $table->print_html();
     }
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index abf0a71191fb915dda2156a22a65d56d4daf32a5..6762cf44196188d906ecba8b29102aaa1f974794 100644 (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();
 
 
     $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;
 
 
index 7a3b4e9ab46b76cb15725aeaf9cd06a4afa26f30..8e0cfdfd6bf42aa40695160403ea1a8e78e71793 100644 (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();
     echo "</div>";
     echo "</form>";
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
\ No newline at end of file
index db371b33ddf0a105208f5fc48e399c93b313ed2f..6adca6d13c8e292a3ad74173b1b2cd236ea1e0f3 100644 (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;
 ?>
index 4d2670367a38cdcb3c94e9574c49dfbcecf6b1e7..64af2195c411c8c7bd5fc54e05d722e5cdba07f0 100644 (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>';
     $status = check_moodle_environment($version, $environment_results);
 
 /// Print footer
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 ?>
index f65627d30ff162431d1701ca3b326d87c029bebb..c372dda28a8843f2a4af84e91c7fe2fcd609ef1d 100644 (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();
 ?>
index 4e29e70d300aac8ad67d1ca02f4f87e340af5d54..978fdbebee0162928f104763b175a7b3b7b91cc7 100644 (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();
     // Display logic
     //==============================
 
-    admin_externalpage_print_header($adminroot);
+    admin_externalpage_print_header();
 
     print_heading_with_help($txt->managefilters, 'filters');
 
 
     // cache control table has been removed
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index 0fb6e89bc51b5b36e039411300202b68e6a96068..4ad667da05c586957500ae606e9019a4196f6669 100644 (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() {
index 79574ec25423473248fc2dff3c1452a85c700b77..b746efcaf31e3321e0a77426b303d19762b18de1 100644 (file)
 
 /// 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)) {
     }
 
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 
 ?>
index 194917536ade60194d720cd30b965fcd8942366b..77cbe205141c9a7e119d8da054b8f3d0606ad0f2 100644 (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') {
        }
        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();
    }
 
 ?>
index 151d88ed3536b970b7c503a748ac557294e4a79a..7bb9bf97a5e2f11ca3cce648e1396bbc4426918d 100644 (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;
     }
 
         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") {
         }
     }
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 //////////////////////////////////////////////////////////////////////
 
index d6d2ebf59f1fd13261d8642c34c8a68bd2289d0c..489a17bd479e907912b6d1047b7df374ca2372d7 100755 (executable)
@@ -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();
 
 //////////////////////////////////////////////////////////////////////
 
index 94a1b4bb84394ad37365df0dc3f4cb4468eff534..194ef2efa97e21220904288a3519adf547eb58ea 100755 (executable)
@@ -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:
                 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');
                 }
             }
 
             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;
 
     }    //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
index d7e20ce2dca85f07902f1f9fab9473fd20b4bc8f..aecd668f836cc89b6e571d97ef251e40a10d1c9d 100644 (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();
 ?>
index 54f0c69c8499781c99a047579bdda535d4d1cd8f..e8105939395261674c31d732a4aaa297c9c82ecb 100644 (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();
 
 ?>
index 94af92e1753efeae8b5fac24d210658a32dd9fcf..825d06bdd44c860a1e832e40c5fb1dc92f923efa 100644 (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();
 
 ?>
index a0af7e86d0445fabf54dbe325d4804febe6d582b..7e09e5fba2e318fed75057aa57d90e318f283729 100644 (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();
 
 ?>
index 2f78fa556f21a53a53a89065388c4366d8f152cc..ec82c2cc43a7e1dd6f1a3d0a52fe4df15405cbff 100644 (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();
 
 ?>
index 0e5fab69479a67e03d2a6c163aac5ba3a9c559f7..d761acb9d415a860e71efa538e056bade0514c0f 100644 (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);
 
 
 
     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">
 </center>
 
 <?php
-admin_externalpage_print_footer($adminroot);
+admin_externalpage_print_footer();
 ?>
index 52d99f6ddae3cf3b834b84a0d0ac05b8a0d3d4a0..88392f3d95d3bb8f89cc638fb013981d9b7e23a1 100644 (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();
 ?>
index b5bb0015f49d1dffe9f55fe6fc47a4dc0d7dde1e..81451efa113de09d4b4408cf124ff5e324846ef9 100644 (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();
 ?>
index f308cd696093cedb7bee8ce3e1befeb153c9b71b..10c99e69a69423a9b0de21fa83211a4ba4a0ffe8 100644 (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();
 ?>
index bed8c3cdf5d75870038ded28a75ef492f9a46ef4..daf8a557e687b5ba216eb7d3f09dd0e34e857d8d 100644 (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);
 
index bd6d6aa20904d159d784fba3113fe6b28f44c839..138be56b187042ffef7ddf8aed4dd9cc8b90cc50 100644 (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();
 ?>
index eee628d3150c06dbfe9ec13ef478837ec0168dc3..b6e8cdd213e89903a12f9dc1d1141ecd49b4f7ce 100644 (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);
 }
 
index 1aa16d38b1654a70e4161ffa72449a65dce0a471..26da1699bdb04b37bd2a756cc43d68bed3056b67 100644 (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();
 ?>
index 06243a917a86f65ad177a7e6367e3d681c2c9c2b..932e84a6a6c7c739617ccc4a2cfb74b2331f9324 100644 (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);
     }
 
index 314e57788aefa73417c898ae890f0b46d20ac1d5..396cf85479f422fc472d6299b63d7f70620dd32b 100644 (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();
 
 ?>
index b5742a99b9b64a3f1fd7a89ede39b384d36ab699..1f395374edf7dce5e9efa7640398fb8afe517696 100644 (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!!
 
     $table->print_html();
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index fb88a4d04d7e43b9a0ed0561475b678d6450e39f..8083af1c352a2245415f04e29eccdad81159f829 100644 (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);
 
-$go = optional_param('go', 0, PARAM_BOOL);
-
-require_login();
+admin_externalpage_setup('multilangupgrade');
 
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
+$go = optional_param('go', 0, PARAM_BOOL);
 
 ###################################################################
-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;
 
 
index 78ac48f39a3bdb5225e5c7178de922a0c4244e54..04d0cd3fd6bbbe067207c31dbf9bc89a708a47f6 100644 (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();
 
 }
 
index daf30b2da4eb85bf0539d68f9220c2a932bffb86..5c2398b576fec3eb96c238aa8be0443c07e05820 100644 (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();
 
 ?>
index 561054f1a2c16366b5a7e4f0560d0b7ad31f4699..b47d26a3c72d2f4decfdfb7a1766f4756a0d4803 100644 (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();
 
 ?>
index 312a6f12aaecbe39f2708ddab46668ee3fa89102..06f52c9cd9003b0b9fc5b998fa754ab1049356e0 100644 (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";
             print_table($table);
         }
     }
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index d89c533812fd716a3c57999c7fb9d6e2b15a271f..df808f31b572d08d6891ef3feed08ba4eb998973 100644 (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();
 
 ?>
\ No newline at end of file
index 6646985d63393c9d556908434ab29a13bd15ffd6..806b1cecf01cda34fe6e0eb61bd64b72912b5465 100644 (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();
 
 ?>
index a96d56ce19adfa8c3bee98326d71ece9da4f0cde..410e3dae5d7de5b75072fd4b8e02be5d41cc18da 100644 (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();
 
 ?>
index 7354095efa7646ca9f29621a102aa632854c56c1..a17796c80fb1fe4b9733876ad9139174eb376f82 100755 (executable)
@@ -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();
 
 
 
index cd2615880cb12b842aaf9a5a2396ec06e26f30b9..87a4ec04732b4d369f4246adc0107820afe67b93 100755 (executable)
@@ -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){
index 5bd81642e1f7c5052507f6ba46eaa1fcd738b188..3996b349edf470d7e29f3051634e70e5a5665d9b 100755 (executable)
         $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');
     }
 
     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);
     }
index bf20749d875bce0f098ce6949c4d2c154c8c89e0..09f647fef772e174498ffecd2d20c6fc4d50a6a6 100755 (executable)
@@ -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
 
             } 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;
                 $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;
             }
 
                 //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();
                 $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;
             }
 
 
             } 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();
                     $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;
             }
 
 
 /// print UI now
 
-    admin_externalpage_print_header($adminroot);
+    admin_externalpage_print_header();
 
     $currenttab = 'manage';
     include_once('managetabs.php');
         echo '</div>';
     }
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
     die;
 
 
index b031d7852042c9fb68499e21c1b71085d01e410e..4d6d2ece2e7e5bc5ff2e8875b638fd5dde912600 100755 (executable)
         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');
     }
 
     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);
     }
index 4d97a4019093a44cb660993a87d8b926c64f6bea..e94f8ef694805994b08e64b0a18d55cc1b1fea2d 100644 (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();
 
 
 /**
index 38d999e482b31045344cc4b81f93d054c073ce0d..21d5ea1dfda2f4bed1d0341b53d8e2ffad944a0e 100644 (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();
     }
 
 ?>
index ba9d6b8b860a4fa0adc47b05a717fd3779cc6a9c..33400b659c4d4c0b653abe253cb1f30c2d40169d 100644 (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;
     }
 
         print_continue('index.php');
     }
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index 9d620e7afb084fa26b7e5450be8948911c4038b4..840e04b66ab3d313d9f0b497dd4f00660626dbd5 100644 (file)
@@ -3,14 +3,10 @@
     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);
 
-    $confirm = optional_param('confirm', 0, PARAM_BOOL);
-
-    require_login();
+    admin_externalpage_setup('upgradeforumread');
 
-    require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
+    $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
     if ($CFG->version < 2005042300) {
         error("This script does not work with this old version of Moodle");
 
     $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;
     }
 
 
     print_continue('index.php');
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index a70327a964909dd5f3d8952d3a5ba99e3809a928..2803e2c2370ddd2d256da944d31e66a9dd5d11ff 100644 (file)
@@ -2,14 +2,10 @@
 
     require_once('../config.php');
     require_once($CFG->libdir.'/adminlib.php');
-    $adminroot = admin_get_root();
-    admin_externalpage_setup('upgradelogs', $adminroot);
 
-    $confirm = optional_param('confirm', 0, PARAM_BOOL);
-
-    require_login();
+    admin_externalpage_setup('upgradelogs');
 
-    require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
+    $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
     if ($CFG->version < 2004013101) {
         error("This script does not work with this old version of Moodle");
 /// 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;
     }
 
 
     print_continue('index.php');
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 ?>
index 3b6482c4202c651760941fc221de7108bc8a379a..1c801e26a726885ab4dfadc4b0832b34b247e674 100644 (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();
 
 
 /**
index 16eaf03256dc800c70c42926fff58ef5c87066f2..73b7b6d818d0d27d1cbf860bea9a46bcf3bee9b7 100755 (executable)
@@ -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();
 
 
 
index 8ccbb8e1cce13ce4a7ad8258ad827728511991f7..8b19695ca2928a4098192eb785535e15102eccef 100644 (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)) {
             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
     }
 
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 
 ?>
index 4353bfab5f4bcd3407e33f7634afd7ea102b08c5..fd7e46e4143be0b1c7e801050bf7f54b9f788e8c 100644 (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');
                         $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');
index 4a47f4071bdcdc2bfed39a6c9d12db626bd9abfd..26a0867762b6ea01cec5722082723eaea1d8c7b2 100644 (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);
     print_course_search();
     
     if ($adminediting) {
-        admin_externalpage_print_footer($adminroot);
+        admin_externalpage_print_footer();
     } else {
         print_footer();
     }
index 4487ebe48b5d107b7ba195e2c6e389c9de531780..a39ccee9f4638c9966474c2f7bbe4e619f07423c 100644 (file)
     
     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());    
                              "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();  
                 }
     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();
     }
index 8d7edcc30cbf16398d358976e03123fc0addeb97..cada4d3f963bbe43d8fabbb7dddca68a0016c95e 100644 (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, 
 
     } 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> -> 
     }
 
     if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) {
-        admin_externalpage_print_footer($adminroot);
+        admin_externalpage_print_footer();
     } else {
         print_footer($course);
     }
index 973e941f82912882597a14dce23d2a4e511d6f70..1f03ace798075ce056bbe911273341b06d939ce6 100644 (file)
         }
     }
     
-    // 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);
index 176e596635d4f0a770f02e3f95de796ef0b583fd..abd797c54131946a45429a9b002f283cbc5f9d4b 100644 (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();
 
 ?>
index fb2b222acba207208b520baaae87997b25eb6a42..264fbdbf7420d0fa7ef89281e98ab29d46ff7b16 100644 (file)
     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);
         }
             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);
                     
index acd0b2dc9320817662fa221678a2cf461a60bb0f..e338c435c7465569fe6583f6e8159dfba342673d 100644 (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;
index f346a7c6d7cbe03b2c393c0d30a3f58a23bcf60d..49fe2f866e048ea1e44cdda1f972af5d93bb7e16 100644 (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,
index 5c1285ff4d76c93a6285142dbb32c2ed9f584da8..6d58f7ea4ade36b2cad500a80a8223be9b169c74 100644 (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');
     }
index d8e4846377afb9e4317a500adc209c11b518f597..ddc986d9e67b462160feac4c5df4608ff90eabf1 100644 (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!");
     echo "</table>";
 
 
-    admin_externalpage_print_footer($adminroot);
+    admin_externalpage_print_footer();
 
 
 ?>
index 0f3c291eda2a518a271f7c0f277e32e518a8458d..e7d7f5c66f47f2e92b8aeb502c55bccbd9db32f1 100644 (file)
 
 /// 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);
         }
 
 /// 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 {
index a936f276ebd2454a605d94ef9ed9a71a5191b144..60ff80baf2ce4fa824d52ec082b215a7c92c7be2 100644 (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;
     }
 }
index f2946b5cd172f80ae387125f336e9a2345a7e918..ce32ecf15665f6118900ac257f5a56386bb87276 100644 (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;