mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-6805 Fix redirects in blog - edit button now properly redirects to self
This commit is contained in:
parent
db837673df
commit
93caac3a72
3 changed files with 25 additions and 31 deletions
|
@ -170,9 +170,10 @@ class page_blog extends page_base {
|
||||||
} else {
|
} else {
|
||||||
$editingString = get_string('turneditingon');
|
$editingString = get_string('turneditingon');
|
||||||
}
|
}
|
||||||
$editformstring = '<form target="'. $CFG->framename .'" method="get" action="'. $CFG->wwwroot .'/blog/set_session_vars.php">'.
|
$url = $this->url_get_full();
|
||||||
'<input type="hidden" name="referrer" value="'. me() .'" />'.
|
$editval = empty($SESSION->blog_editing_enabled) ? 1 : 0;
|
||||||
'<input type="hidden" name="var" value="showediting" />'.
|
$editformstring = '<form target="'. $CFG->framename .'" method="get" action="'.$url.'/blog/index.php">'.
|
||||||
|
'<input type="hidden" name="edit" value="'.$editval.'" />'.
|
||||||
'<input type="submit" value="'. $editingString .'" /></form>';
|
'<input type="submit" value="'. $editingString .'" /></form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,22 +15,34 @@ require_once('../config.php');
|
||||||
require_once($CFG->dirroot .'/blog/lib.php');
|
require_once($CFG->dirroot .'/blog/lib.php');
|
||||||
require_once($CFG->libdir .'/blocklib.php');
|
require_once($CFG->libdir .'/blocklib.php');
|
||||||
|
|
||||||
$id = optional_param('id', 0, PARAM_INT);
|
$id = optional_param('id', 0, PARAM_INT);
|
||||||
$limit = optional_param('limit', 0, PARAM_INT);
|
$limit = optional_param('limit', 0, PARAM_INT);
|
||||||
$start = optional_param('formstart', 0, PARAM_INT);
|
$start = optional_param('formstart', 0, PARAM_INT);
|
||||||
$userid = optional_param('userid',0,PARAM_INT);
|
$userid = optional_param('userid',0,PARAM_INT);
|
||||||
$courseid = optional_param('courseid',SITEID,PARAM_INT);
|
$courseid = optional_param('courseid',SITEID,PARAM_INT);
|
||||||
$tag = optional_param('tag', '', PARAM_NOTAGS);
|
$tag = optional_param('tag', '', PARAM_NOTAGS);
|
||||||
$tagid = optional_param('tagid', 0, PARAM_INT);
|
$tagid = optional_param('tagid', 0, PARAM_INT);
|
||||||
$postid = optional_param('postid',0,PARAM_INT);
|
$postid = optional_param('postid',0,PARAM_INT);
|
||||||
$filtertype = optional_param('filtertype', '', PARAM_ALPHA);
|
$filtertype = optional_param('filtertype', '', PARAM_ALPHA);
|
||||||
$filterselect = optional_param('filterselect', 0, PARAM_INT);
|
$filterselect = optional_param('filterselect', 0, PARAM_INT);
|
||||||
|
$edit = optional_param('edit', -1, PARAM_BOOL);
|
||||||
|
|
||||||
if (empty($CFG->bloglevel)) {
|
if (empty($CFG->bloglevel)) {
|
||||||
error('Blogging is disabled!');
|
error('Blogging is disabled!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Blogs are only global for now.
|
||||||
|
// 'post' table will have to be changed to use contextid instead of courseid,
|
||||||
|
// modileid, etc. because they are obsolete now.
|
||||||
|
$sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
|
||||||
|
|
||||||
|
|
||||||
|
// change block edit staus if not guest and logged in
|
||||||
|
if (isloggedin() and !isguest() and $edit != -1) {
|
||||||
|
$SESSION->blog_editing_enabled = $edit;
|
||||||
|
}
|
||||||
|
|
||||||
/// overwrite filter code here
|
/// overwrite filter code here
|
||||||
|
|
||||||
if ($filtertype) {
|
if ($filtertype) {
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
/// inspired/taken from moodle calendar module's set.php file
|
|
||||||
|
|
||||||
require_once('../config.php');
|
|
||||||
|
|
||||||
if (empty($CFG->bloglevel)) {
|
|
||||||
error('Blogging is disabled!');
|
|
||||||
}
|
|
||||||
|
|
||||||
$referrer = required_param('referrer', PARAM_URL);
|
|
||||||
|
|
||||||
if (isset($SESSION->blog_editing_enabled)) {
|
|
||||||
$SESSION->blog_editing_enabled = !$SESSION->blog_editing_enabled;
|
|
||||||
} else {
|
|
||||||
$SESSION->blog_editing_enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
redirect($referrer);
|
|
||||||
?>
|
|
Loading…
Add table
Add a link
Reference in a new issue