From: skodak Date: Tue, 3 Oct 2006 21:07:13 +0000 (+0000) Subject: MDL-6805 Fix redirects in blog - edit button now properly redirects to self X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=93caac3a721b8b0f593c6d2805df7f5b3322ef33;p=moodle.git MDL-6805 Fix redirects in blog - edit button now properly redirects to self --- diff --git a/blog/blogpage.php b/blog/blogpage.php index 78013076f2..f6db6db603 100644 --- a/blog/blogpage.php +++ b/blog/blogpage.php @@ -170,9 +170,10 @@ class page_blog extends page_base { } else { $editingString = get_string('turneditingon'); } - $editformstring = '
'. - ''. - ''. + $url = $this->url_get_full(); + $editval = empty($SESSION->blog_editing_enabled) ? 1 : 0; + $editformstring = ''. + ''. '
'; } diff --git a/blog/index.php b/blog/index.php index e27f05d967..ec3dec710d 100755 --- a/blog/index.php +++ b/blog/index.php @@ -15,22 +15,34 @@ require_once('../config.php'); require_once($CFG->dirroot .'/blog/lib.php'); require_once($CFG->libdir .'/blocklib.php'); -$id = optional_param('id', 0, PARAM_INT); -$limit = optional_param('limit', 0, PARAM_INT); -$start = optional_param('formstart', 0, PARAM_INT); -$userid = optional_param('userid',0,PARAM_INT); -$courseid = optional_param('courseid',SITEID,PARAM_INT); -$tag = optional_param('tag', '', PARAM_NOTAGS); -$tagid = optional_param('tagid', 0, PARAM_INT); -$postid = optional_param('postid',0,PARAM_INT); -$filtertype = optional_param('filtertype', '', PARAM_ALPHA); +$id = optional_param('id', 0, PARAM_INT); +$limit = optional_param('limit', 0, PARAM_INT); +$start = optional_param('formstart', 0, PARAM_INT); +$userid = optional_param('userid',0,PARAM_INT); +$courseid = optional_param('courseid',SITEID,PARAM_INT); +$tag = optional_param('tag', '', PARAM_NOTAGS); +$tagid = optional_param('tagid', 0, PARAM_INT); +$postid = optional_param('postid',0,PARAM_INT); +$filtertype = optional_param('filtertype', '', PARAM_ALPHA); $filterselect = optional_param('filterselect', 0, PARAM_INT); +$edit = optional_param('edit', -1, PARAM_BOOL); if (empty($CFG->bloglevel)) { 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 if ($filtertype) { diff --git a/blog/set_session_vars.php b/blog/set_session_vars.php deleted file mode 100644 index 1cad1ef41c..0000000000 --- a/blog/set_session_vars.php +++ /dev/null @@ -1,19 +0,0 @@ -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); -?>