Merge branch 'MDL-29895' of https://github.com/enovation/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 9 Oct 2018 22:29:16 +0000 (00:29 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 9 Oct 2018 22:29:16 +0000 (00:29 +0200)
46 files changed:
admin/filters.php
admin/message.php
admin/mnet/access_control.php
admin/mnet/delete.php
admin/mnet/index.php
admin/mnet/peers.php
admin/mnet/profilefields.php
admin/mnet/services.php
admin/mnet/testclient.php
admin/mnet/trustedhosts.php
admin/portfolio.php
admin/qtypes.php
admin/repository.php
admin/repositoryinstance.php
admin/roles/define.php
admin/roles/manage.php
admin/tool/dbtransfer/dbexport.php
admin/tool/dbtransfer/index.php
admin/tool/health/index.php
admin/tool/httpsreplace/index.php
admin/tool/httpsreplace/tool.php
admin/tool/innodb/index.php
admin/tool/log/store/database/test_settings.php
admin/tool/monitor/managerules.php
admin/tool/spamcleaner/index.php
admin/tool/unsuproles/index.php
admin/tool/uploaduser/index.php
admin/tool/uploaduser/picture.php
admin/tool/xmldb/index.php
admin/user/user_bulk_confirm.php
admin/user/user_bulk_delete.php
admin/user/user_bulk_download.php
admin/user/user_bulk_forcepasswordchange.php
admin/user/user_bulk_message.php
admin/webservice/tokens.php
auth/test_settings.php
comment/index.php
course/pending.php
enrol/test_settings.php
grade/edit/letter/index.php
message/defaultoutputs.php
my/indexsys.php
report/loglive/index.php
report/performance/index.php
report/security/index.php
user/profilesys.php

index 9ae73f3..958fc6e 100644 (file)
@@ -28,10 +28,6 @@ require_once($CFG->libdir . '/adminlib.php');
 $action = optional_param('action', '', PARAM_ALPHA);
 $filterpath = optional_param('filterpath', '', PARAM_PLUGIN);
 
-require_login();
-$systemcontext = context_system::instance();
-require_capability('moodle/site:config', $systemcontext);
-
 admin_externalpage_setup('managefilters');
 
 // Clean up bogus filter states first.
index 6924e61..c10034a 100644 (file)
@@ -28,9 +28,6 @@ require_once($CFG->libdir.'/adminlib.php');
 // This is an admin page
 admin_externalpage_setup('managemessageoutputs');
 
-// Require site configuration capability
-require_capability('moodle/site:config', context_system::instance());
-
 // Get the submitted params
 $disable    = optional_param('disable', 0, PARAM_INT);
 $enable     = optional_param('enable', 0, PARAM_INT);
index 88abd77..a122301 100644 (file)
@@ -12,8 +12,6 @@ $page         = optional_param('page', 0, PARAM_INT);
 $perpage      = optional_param('perpage', 30, PARAM_INT);
 $action       = trim(strtolower(optional_param('action', '', PARAM_ALPHA)));
 
-require_login();
-
 admin_externalpage_setup('ssoaccesscontrol');
 
 if (!extension_loaded('openssl')) {
index 03eac9b..479d559 100644 (file)
@@ -34,10 +34,8 @@ $step   = optional_param('step', 'verify', PARAM_ALPHA);
 $hostid = required_param('hostid', PARAM_INT);
 
 
-require_login();
 
 $context = context_system::instance();
-require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
 
 $mnet = get_mnet_environment();
 
index 879caa8..fff9386 100644 (file)
@@ -6,12 +6,10 @@
     require_once($CFG->libdir.'/adminlib.php');
     include_once($CFG->dirroot.'/mnet/lib.php');
 
-    require_login();
     admin_externalpage_setup('net');
 
     $context = context_system::instance();
 
-    require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
 
     $site = get_site();
     $mnet = get_mnet_environment();
index 559d2f4..49fd346 100644 (file)
@@ -32,10 +32,6 @@ require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->dirroot.'/mnet/lib.php');
 require_once($CFG->dirroot.'/'.$CFG->admin.'/mnet/peer_forms.php');
 
-require_login();
-
-$context = context_system::instance();
-require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
 
 /// Initialize variables.
 $hostid = optional_param('hostid', 0, PARAM_INT);
index a27f162..88e9004 100644 (file)
@@ -29,14 +29,10 @@ require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->dirroot . '/' . $CFG->admin .'/mnet/profilefields_form.php');
 $mnet = get_mnet_environment();
 
-require_login();
 $hostid = required_param('hostid', PARAM_INT);
 $mnet_peer = new mnet_peer();
 $mnet_peer->set_id($hostid);
 
-$context = context_system::instance();
-
-require_capability('moodle/site:config', $context, $USER->id, true, 'nopermissions');
 admin_externalpage_setup('mnetpeers');
 $form = new mnet_profile_form(null, array('hostid' => $hostid));
 
index 79e46e9..d5048eb 100644 (file)
@@ -30,11 +30,8 @@ require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/services_form.php');
 $mnet = get_mnet_environment();
 
-require_login();
 admin_externalpage_setup('mnetpeers');
 
-$context = context_system::instance();
-require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
 
 $hostid = required_param('hostid', PARAM_INT);
 
index 2560e84..a12ebb6 100644 (file)
@@ -21,12 +21,8 @@ if ($CFG->mnet_dispatcher_mode === 'off') {
     print_error('mnetdisabled', 'mnet');
 }
 
-require_login();
 admin_externalpage_setup('mnettestclient');
 
-$context = context_system::instance();
-require_capability('moodle/site:config', $context);
-
 error_reporting(DEBUG_ALL);
 
 echo $OUTPUT->header();
index cbbbfa3..5ad348c 100644 (file)
@@ -5,12 +5,8 @@
     require_once($CFG->libdir.'/adminlib.php');
     include_once($CFG->dirroot.'/mnet/lib.php');
 
-    require_login();
     admin_externalpage_setup('trustedhosts');
 
-    $context = context_system::instance();
-
-    require_capability('moodle/site:config', $context, $USER->id, true, "nopermissions");
 
     if (!extension_loaded('openssl')) {
         echo $OUTPUT->header();
index 6a33fc0..66ff3a7 100644 (file)
@@ -35,8 +35,6 @@ if ($action == 'newon') {
 
 admin_externalpage_setup($pagename);
 
-require_capability('moodle/site:config', context_system::instance());
-
 $baseurl    = "$CFG->wwwroot/$CFG->admin/portfolio.php";
 $sesskeyurl = "$CFG->wwwroot/$CFG->admin/portfolio.php?sesskey=" . sesskey();
 $configstr  = get_string('manageportfolios', 'portfolio');
index b13baf0..f9dfc2e 100644 (file)
@@ -31,7 +31,6 @@ require_once($CFG->libdir . '/adminlib.php');
 require_once($CFG->libdir . '/tablelib.php');
 
 // Check permissions.
-require_login();
 $systemcontext = context_system::instance();
 require_capability('moodle/question:config', $systemcontext);
 $canviewreports = has_capability('report/questioninstances:view', $systemcontext);
index 6984da6..0c79987 100644 (file)
@@ -47,7 +47,6 @@ if ($action == 'newon') {
     $visible = false;
 }
 
-require_capability('moodle/site:config', context_system::instance());
 admin_externalpage_setup($pagename);
 
 $sesskeyurl = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php?sesskey=' . sesskey();
index 960d0ff..7020224 100644 (file)
@@ -42,7 +42,6 @@ if ($edit){
 }
 
 admin_externalpage_setup($pagename, '', null, new moodle_url('/admin/repositoryinstance.php'));
-require_capability('moodle/site:config', $context);
 
 $baseurl = new moodle_url("/$CFG->admin/repositoryinstance.php", array('sesskey'=>sesskey()));
 
index de3eac1..a298052 100644 (file)
@@ -54,7 +54,6 @@ if ($return === 'manage') {
 
 // Check access permissions.
 $systemcontext = context_system::instance();
-require_login();
 require_capability('moodle/role:manage', $systemcontext);
 admin_externalpage_setup('defineroles', '', array('action' => $action, 'roleid' => $roleid), new moodle_url('/admin/roles/define.php'));
 
index d2e703f..9da57eb 100644 (file)
@@ -48,7 +48,6 @@ $defineurl = $CFG->wwwroot . '/' . $CFG->admin . '/roles/define.php';
 
 // Check access permissions.
 $systemcontext = context_system::instance();
-require_login();
 require_capability('moodle/role:manage', $systemcontext);
 admin_externalpage_setup('defineroles');
 
index f55b29d..2bc5e61 100644 (file)
@@ -28,7 +28,6 @@ require('../../../config.php');
 require_once('locallib.php');
 require_once('database_export_form.php');
 
-require_login();
 admin_externalpage_setup('tooldbexport');
 
 // Create form.
index aa8b5b3..4423a0a 100644 (file)
@@ -28,7 +28,6 @@ require('../../../config.php');
 require_once('locallib.php');
 require_once('database_transfer_form.php');
 
-require_login();
 admin_externalpage_setup('tooldbtransfer');
 
 // Create the form.
index 1e5b147..5422739 100644 (file)
@@ -39,9 +39,6 @@
 
     $solution = optional_param('solution', 0, PARAM_PLUGIN);
 
-    require_login();
-    require_capability('moodle/site:config', context_system::instance());
-
     $site = get_site();
 
     echo $OUTPUT->header();
index a3cec32..c304d9b 100644 (file)
@@ -29,9 +29,6 @@ admin_externalpage_setup('toolhttpsreplace');
 
 $context = context_system::instance();
 
-require_login();
-require_capability('moodle/site:config', $context);
-
 $PAGE->set_context($context);
 $PAGE->set_url(new moodle_url('/admin/tool/httpsreplace/index.php'));
 $PAGE->set_title(get_string('pageheader', 'tool_httpsreplace'));
index 12d5acb..6d2d963 100644 (file)
@@ -32,9 +32,6 @@ admin_externalpage_setup('toolhttpsreplace');
 
 $context = context_system::instance();
 
-require_login();
-require_capability('moodle/site:config', $context);
-
 $PAGE->set_context($context);
 $PAGE->set_url(new moodle_url('/admin/tool/httpsreplace/index.php'));
 $PAGE->set_title(get_string('pageheader', 'tool_httpsreplace'));
index 6e99834..d17c476 100644 (file)
@@ -32,8 +32,6 @@ admin_externalpage_setup('toolinnodb');
 
 $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
-require_login();
-require_capability('moodle/site:config', context_system::instance());
 
 echo $OUTPUT->header();
 echo $OUTPUT->heading('Convert all MySQL tables from MYISAM to InnoDB');
index 21a470e..5b5d8fb 100644 (file)
@@ -25,9 +25,6 @@
 require_once('../../../../../config.php');
 require_once($CFG->dirroot . '/lib/adminlib.php');
 
-require_login();
-$context = context_system::instance();
-require_capability('moodle/site:config', $context);
 require_sesskey();
 
 navigation_node::override_active_url(new moodle_url('/admin/settings.php', array('section' => 'logsettingdatabase')));
index e914cef..13f21a9 100644 (file)
@@ -33,7 +33,6 @@ $status = optional_param('status', 0, PARAM_BOOL);
 
 // Validate course id.
 if (empty($courseid)) {
-    require_login();
     $context = context_system::instance();
     $coursename = format_string($SITE->fullname, true, array('context' => $context));
     $PAGE->set_context($context);
index 2f98bf4..ce017f6 100644 (file)
@@ -41,7 +41,6 @@ $ignore = optional_param('ignore', '', PARAM_RAW);
 $reset = optional_param('reset', '', PARAM_RAW);
 $id = optional_param('id', '', PARAM_INT);
 
-require_login();
 admin_externalpage_setup('toolspamcleaner');
 
 // Delete one user
index 93e3bbd..e2522ba 100644 (file)
@@ -29,9 +29,7 @@ require_once($CFG->libdir.'/adminlib.php');
 
 $action = optional_param('action', '', PARAM_ALPHANUMEXT);
 
-$syscontext = context_system::instance();
 
-require_login();
 admin_externalpage_setup('toolunsuproles'); // checks permissions specified in settings.php
 
 if ($action === 'delete') {
index 496b52d..9a60af3 100644 (file)
@@ -39,7 +39,6 @@ $previewrows = optional_param('previewrows', 10, PARAM_INT);
 core_php_time_limit::raise(60*60); // 1 hour should be enough
 raise_memory_limit(MEMORY_HUGE);
 
-require_login();
 admin_externalpage_setup('tooluploaduser');
 require_capability('moodle/site:uploadusers', context_system::instance());
 
index 03091aa..a1d0d3d 100644 (file)
@@ -36,8 +36,6 @@ define ('PIX_FILE_SKIPPED', 2);
 
 admin_externalpage_setup('tooluploaduserpictures');
 
-require_login();
-
 require_capability('tool/uploaduser:uploaduserpictures', context_system::instance());
 
 $site = get_site();
index 8feef19..4dd9210 100644 (file)
@@ -50,8 +50,6 @@ if (!isset($SESSION->xmldb)) {
 // Some previous checks
 $site = get_site();
 
-require_login();
-require_capability('moodle/site:config', context_system::instance());
 
 // Body of the script, based on action, we delegate the work
 $action = optional_param ('action', 'main_view', PARAM_ALPHAEXT);
index 9bfc65b..91dd0c4 100644 (file)
@@ -8,7 +8,6 @@ require_once($CFG->libdir.'/adminlib.php');
 
 $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
-require_login();
 admin_externalpage_setup('userbulk');
 require_capability('moodle/user:update', context_system::instance());
 
index 474903a..1b8b8ea 100644 (file)
@@ -8,7 +8,6 @@ require_once($CFG->libdir.'/adminlib.php');
 
 $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
-require_login();
 admin_externalpage_setup('userbulk');
 require_capability('moodle/user:delete', context_system::instance());
 
index 08f5b32..babede0 100644 (file)
@@ -30,7 +30,6 @@ require_once($CFG->dirroot.'/user/profile/lib.php');
 
 $dataformat = optional_param('dataformat', '', PARAM_ALPHA);
 
-require_login();
 admin_externalpage_setup('userbulk');
 require_capability('moodle/user:update', context_system::instance());
 
index 203f69c..a8e522a 100644 (file)
@@ -9,7 +9,6 @@ require_once($CFG->libdir.'/adminlib.php');
 
 $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
-require_login();
 admin_externalpage_setup('userbulk');
 require_capability('moodle/user:update', context_system::instance());
 
index 008367b..adf90ff 100644 (file)
@@ -7,7 +7,6 @@ require_once('user_message_form.php');
 $msg     = optional_param('msg', '', PARAM_CLEANHTML);
 $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
-require_login();
 admin_externalpage_setup('userbulk');
 require_capability('moodle/site:manageallmessaging', context_system::instance());
 
index f15f7c2..b4d246a 100644 (file)
@@ -42,7 +42,6 @@ if ($node && $newnode) {
     $newnode->make_active();
 }
 
-require_capability('moodle/site:config', context_system::instance());
 
 $tokenlisturl = new moodle_url("/" . $CFG->admin . "/settings.php", array('section' => 'webservicetokens'));
 
index c0eef4b..8d7a0fa 100644 (file)
@@ -32,9 +32,6 @@ if (!core_component::is_valid_plugin_name('auth', $auth)) {
     $auth = '';
 }
 
-require_login();
-require_capability('moodle/site:config', context_system::instance());
-
 navigation_node::override_active_url(new moodle_url('/admin/settings.php', array('section'=>'manageauths')));
 admin_externalpage_setup('authtestsettings');
 
index 470d3a5..390b9de 100644 (file)
@@ -26,7 +26,6 @@ require_once('../config.php');
 require_once($CFG->libdir.'/adminlib.php');
 require_once($CFG->dirroot.'/comment/locallib.php');
 
-require_login();
 admin_externalpage_setup('comments', '', null, '', array('pagelayout'=>'report'));
 
 $context = context_system::instance();
index cfea738..710ca55 100644 (file)
@@ -35,9 +35,6 @@ require_once($CFG->libdir . '/adminlib.php');
 require_once($CFG->dirroot . '/course/lib.php');
 require_once($CFG->dirroot . '/course/request_form.php');
 
-require_login();
-require_capability('moodle/site:approvecourse', context_system::instance());
-
 $approve = optional_param('approve', 0, PARAM_INT);
 $reject = optional_param('reject', 0, PARAM_INT);
 
index 30efd91..3053c82 100644 (file)
@@ -32,9 +32,6 @@ if (!core_component::is_valid_plugin_name('enrol', $enrol)) {
     $enrol = '';
 }
 
-require_login();
-require_capability('moodle/site:config', context_system::instance());
-
 navigation_node::override_active_url(new moodle_url('/admin/settings.php', array('section'=>'manageenrols')));
 admin_externalpage_setup('enroltestsettings');
 
index dedd4bf..9f4e075 100644 (file)
@@ -48,7 +48,6 @@ $returnurl = null;
 $editparam = null;
 if ($context->contextlevel == CONTEXT_SYSTEM or $context->contextlevel == CONTEXT_COURSECAT) {
     require_once $CFG->libdir.'/adminlib.php';
-    require_login();
 
     admin_externalpage_setup('letters');
 
index 398fe25..994d6eb 100644 (file)
@@ -28,9 +28,6 @@ require_once($CFG->libdir.'/adminlib.php');
 // This is an admin page
 admin_externalpage_setup('defaultmessageoutputs');
 
-// Require site configuration capability
-require_capability('moodle/site:config', context_system::instance());
-
 // Fetch processors
 $processors = get_message_processors(true);
 // Fetch message providers
index ad16f44..a7bcdc2 100644 (file)
@@ -41,8 +41,6 @@ require_once($CFG->libdir.'/adminlib.php');
 
 $resetall = optional_param('resetall', null, PARAM_BOOL);
 
-require_login();
-
 $header = "$SITE->shortname: ".get_string('myhome')." (".get_string('mypage', 'admin').")";
 
 $PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
index e3e1740..ec091fa 100644 (file)
@@ -33,7 +33,7 @@ $page = optional_param('page', 0, PARAM_INT);
 $logreader = optional_param('logreader', '', PARAM_COMPONENT); // Reader which will be used for displaying logs.
 
 if (empty($id)) {
-    require_login();
+    admin_externalpage_setup('reportloglive', '', null, '', array('pagelayout' => 'report'));
     $context = context_system::instance();
     $coursename = format_string($SITE->fullname, true, array('context' => $context));
 } else {
@@ -75,9 +75,7 @@ if ($page == 0 && !empty($logreader)) {
 $strlivelogs = get_string('livelogs', 'report_loglive');
 $strupdatesevery = get_string('updatesevery', 'moodle', $refresh);
 
-if (empty($id)) {
-    admin_externalpage_setup('reportloglive', '', null, '', array('pagelayout' => 'report'));
-}
+
 $PAGE->set_url($url);
 $PAGE->set_context($context);
 $PAGE->set_title("$coursename: $strlivelogs ($strupdatesevery)");
index 0955111..d3f12fd 100644 (file)
@@ -28,7 +28,6 @@ require('../../config.php');
 require_once($CFG->dirroot.'/report/performance/locallib.php');
 require_once($CFG->libdir.'/adminlib.php');
 
-require_login();
 
 // Show detailed info about one issue only.
 $issue = optional_param('issue', '', PARAM_ALPHANUMEXT);
index 7385211..29fb038 100644 (file)
@@ -29,7 +29,6 @@ require('../../config.php');
 require_once($CFG->dirroot.'/report/security/locallib.php');
 require_once($CFG->libdir.'/adminlib.php');
 
-require_login();
 
 $issue = optional_param('issue', '', PARAM_ALPHANUMEXT); // show detailed info about one issue only
 
index a6a0072..8ff17d1 100644 (file)
@@ -33,7 +33,6 @@ require_once($CFG->libdir.'/adminlib.php');
 
 $resetall = optional_param('resetall', null, PARAM_BOOL);
 
-require_login();
 
 $header = "$SITE->shortname: ".get_string('publicprofile')." (".get_string('myprofile', 'admin').")";