Merge branch 'w29_MDL-40571_m26_adminblocks' of https://github.com/skodak/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2013-07-16 00:26:44 +02:00
commit adbdb9b5c7
2 changed files with 5 additions and 4 deletions

View File

@ -47,10 +47,11 @@ if (!function_exists('iconv')) {
define('NO_OUTPUT_BUFFERING', true);
if (empty($_GET['cache']) and empty($_POST['cache'])) {
if (empty($_GET['cache']) and empty($_POST['cache']) and empty($_GET['sesskey']) and empty($_POST['sesskey'])) {
// Prevent caching at all cost when visiting this page directly,
// we redirect to self once we known no upgrades are necessary.
// Note: $_GET and $_POST are used here intentionally because our param cleaning is not loaded yet.
// Note2: the sesskey is present in all block editing hacks, we can not redirect there, so enable caching.
define('CACHE_DISABLE_ALL', true);
// Force OPcache reset if used, we do not want any stale caches
@ -449,7 +450,7 @@ if (during_initial_install()) {
// Now we can be sure everything was upgraded and caches work fine,
// redirect if necessary to make sure caching is enabled.
if (!$cache) {
if (!$cache and !optional_param('sesskey', '', PARAM_RAW)) {
redirect(new moodle_url($PAGE->url, array('cache' => 1)));
}

View File

@ -6343,10 +6343,10 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
if ($PAGE->user_allowed_editing()) {
if ($PAGE->user_is_editing()) {
$caption = get_string('blockseditoff');
$url = new moodle_url($PAGE->url, array('adminedit'=>'0'));
$url = new moodle_url($PAGE->url, array('adminedit'=>'0', 'sesskey'=>sesskey()));
} else {
$caption = get_string('blocksediton');
$url = new moodle_url($PAGE->url, array('adminedit'=>'1'));
$url = new moodle_url($PAGE->url, array('adminedit'=>'1', 'sesskey'=>sesskey()));
}
$PAGE->set_button($OUTPUT->single_button($url, $caption, 'get'));
}