From 9fad492eb5efe93aa249a9854ab1c7c4cb3d0f00 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Mon, 24 Apr 2006 03:36:02 +0000 Subject: [PATCH] some small fixes, mostly for 5174 --- blocks/blog_menu/block_blog_menu.php | 5 +++-- blog/edit.php | 21 ++++++++++----------- blog/footer.php | 5 +++-- blog/header.php | 8 +++----- blog/index.php | 2 +- blog/lib.php | 4 ++-- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/blocks/blog_menu/block_blog_menu.php b/blocks/blog_menu/block_blog_menu.php index 3c8cc5e80e..fd8d726e7f 100755 --- a/blocks/blog_menu/block_blog_menu.php +++ b/blocks/blog_menu/block_blog_menu.php @@ -19,8 +19,9 @@ class block_blog_menu extends block_base { $this->content->text = ''; return $this->content; } - - if ($CFG->bloglevel < 5 && !isstudent($course->id) && !isteacher($course->id)) { + + // don't display menu block if block is set at site level, and user is not logged in + if ($CFG->bloglevel < 5 && !(isloggedin() && !isguest())) { $this->content->text = ''; return $this->content; } diff --git a/blog/edit.php b/blog/edit.php index fc56e38c4d..751d54fb41 100755 --- a/blog/edit.php +++ b/blog/edit.php @@ -44,8 +44,6 @@ if (isset($act) && ($act == 'del') && (empty($blogEntry))) { } - - $pageNavigation = 'edit'; include($CFG->dirroot .'/blog/header.php'); @@ -290,23 +288,24 @@ function do_update($post) { if ( update_record('post',$blogEntry)) { delete_records('blog_tag_instance', 'entryid', $blogEntry->id); - $otags = optional_param('otags','', PARAM_INT); - $ptags = optional_param('ptags','', PARAM_INT); - $tag = NULL; $tag->entryid = $blogEntry->id; $tag->userid = $USER->id; $tag->timemodified = time(); /// Add tags information - foreach ($otags as $otag) { - $tag->tagid = $otag; - insert_record('blog_tag_instance',$tag); + if ($otags = optional_param('otags','', PARAM_INT)) { + foreach ($otags as $otag) { + $tag->tagid = $otag; + insert_record('blog_tag_instance',$tag); + } } - foreach ($ptags as $ptag) { - $tag->tagid = $ptag; - insert_record('blog_tag_instance',$tag); + if ($ptags = optional_param('ptags','', PARAM_INT)) { + foreach ($ptags as $ptag) { + $tag->tagid = $ptag; + insert_record('blog_tag_instance',$tag); + } } // only do pings if the entry is published to the world diff --git a/blog/footer.php b/blog/footer.php index cd35640d95..8ae25f8d1e 100644 --- a/blog/footer.php +++ b/blog/footer.php @@ -20,9 +20,10 @@ if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) { id)) { print_footer($course); } else { print_footer(); } -?> \ No newline at end of file +?> diff --git a/blog/header.php b/blog/header.php index 14843d3353..518dd107a1 100755 --- a/blog/header.php +++ b/blog/header.php @@ -19,16 +19,14 @@ if (!$site = get_site()) { redirect($CFG->wwwroot.'/index.php'); } -if ($courseid == 0 ) { - $courseid = SITEID; -} - // now check that they are logged in and allowed into the course (if specified) if ($courseid != SITEID) { - if (! $course = get_record('course', 'id', $courseid)) { + if (!$course = get_record('course', 'id', $courseid)) { error('The course number was incorrect ('. $courseid .')'); } require_login($course->id); +} else { + $course = get_site(); } // Bounds for block widths within this page diff --git a/blog/index.php b/blog/index.php index c890565b54..7897f00a16 100755 --- a/blog/index.php +++ b/blog/index.php @@ -19,7 +19,7 @@ $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',0,PARAM_INT); +$courseid = optional_param('courseid',SITEID,PARAM_INT); $tag = s(urldecode(optional_param('tag', '', PARAM_NOTAGS))); $tagid = optional_param('tagid', 0, PARAM_INT); $postid = optional_param('postid',0,PARAM_INT); diff --git a/blog/lib.php b/blog/lib.php index bb854d604e..6589128ff2 100755 --- a/blog/lib.php +++ b/blog/lib.php @@ -182,7 +182,7 @@ /// Start printing of the blog - echo '
'; + echo '
'; echo '
'; print_user_picture($template['userid'], SITEID, $user->picture); @@ -252,7 +252,7 @@ echo ''; - echo '
'."\n\n"; + echo ''."\n\n"; } -- 2.39.5