Skip to content

Commit

Permalink
MDL-12649: Prevent editing a blog from changing the display sort (bas…
Browse files Browse the repository at this point in the history
…ed on creation date) (Patch by Dan Poltawski) (merge from 1.9)
  • Loading branch information
scyrma committed Jul 7, 2008
1 parent a4b3092 commit 18d330b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions blog/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ function blog_print_html_formatted_entries($postid, $filtertype, $filterselect,

$morelink = '<br />&nbsp;&nbsp;';

$totalentries = get_viewable_entry_count($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC');
$blogEntries = blog_fetch_entries($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC', true);
$totalentries = get_viewable_entry_count($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='created DESC');
$blogEntries = blog_fetch_entries($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='created DESC', true);

print_paging_bar($totalentries, $blogpage, $bloglimit, get_baseurl($filtertype, $filterselect), 'blogpage');

Expand Down Expand Up @@ -149,8 +149,12 @@ function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filters
$template['title'] .= '<span class="nolink">'. format_string($blogEntry->subject) .'</span>';
$template['userid'] = $blogEntry->userid;
$template['author'] = fullname($DB->get_record('user', array('id'=>$blogEntry->userid)));
$template['lastmod'] = userdate($blogEntry->lastmodified);
$template['created'] = userdate($blogEntry->created);

if($blogEntry->created != $blogEntry->lastmodified){
$template['lastmod'] = userdate($blogEntry->lastmodified);
}

$template['publishstate'] = $blogEntry->publishstate;

/// preventing user to browse blogs that they aren't supposed to see
Expand Down Expand Up @@ -179,7 +183,7 @@ function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filters
$by = new object();
$by->name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.
$user->id.'&amp;course='.$COURSE->id.'">'.$fullname.'</a>';
$by->date = $template['lastmod'];
$by->date = $template['created'];
print_string('bynameondate', 'forum', $by);
echo '</div></td></tr>';

Expand Down Expand Up @@ -243,6 +247,12 @@ function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filters

echo '</div>';

if( isset($template['lastmod']) ){
echo '<div style="font-size: 55%;">';
echo ' [ '.get_string('modified').': '.$template['lastmod'].' ]';
echo '</div>';
}

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

}
Expand Down

0 comments on commit 18d330b

Please sign in to comment.