Skip to content

Commit

Permalink
some small fixes, mostly for 5174
Browse files Browse the repository at this point in the history
  • Loading branch information
toyomoyo committed Apr 24, 2006
1 parent ea21c1f commit 9fad492
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
5 changes: 3 additions & 2 deletions blocks/blog_menu/block_blog_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ function get_content() {
$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;
}
Expand Down
21 changes: 10 additions & 11 deletions blog/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
}




$pageNavigation = 'edit';
include($CFG->dirroot .'/blog/header.php');

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions blog/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
</table>

<?php
if (isset($course)) {

if (isset($course) && ($course->id)) {
print_footer($course);
} else {
print_footer();
}
?>
?>
8 changes: 3 additions & 5 deletions blog/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
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
Expand Down
2 changes: 1 addition & 1 deletion blog/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
$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);
Expand Down
4 changes: 2 additions & 2 deletions blog/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filters

/// Start printing of the blog

echo '<div align="center"><table cellspacing="0" class="forumpost blogpost blog'.$template['publishstate'].'" width="100%">';
echo '<table cellspacing="0" class="forumpost blogpost blog'.$template['publishstate'].'" width="100%">';

echo '<tr class="header"><td class="picture left">';
print_user_picture($template['userid'], SITEID, $user->picture);
Expand Down Expand Up @@ -252,7 +252,7 @@ function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filters

echo '</div>';

echo '</td></tr></table></div>'."\n\n";
echo '</td></tr></table>'."\n\n";

}

Expand Down

0 comments on commit 9fad492

Please sign in to comment.