From 18d330b0acbb278f481cfcaea7d7cd7d8a0d6bb2 Mon Sep 17 00:00:00 2001 From: scyrma Date: Mon, 7 Jul 2008 03:21:52 +0000 Subject: [PATCH] MDL-12649: Prevent editing a blog from changing the display sort (based on creation date) (Patch by Dan Poltawski) (merge from 1.9) --- blog/lib.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/blog/lib.php b/blog/lib.php index c999054b1c..08822530c1 100755 --- a/blog/lib.php +++ b/blog/lib.php @@ -82,8 +82,8 @@ $morelink = '
  '; - $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'); @@ -149,8 +149,12 @@ $template['title'] .= ''. format_string($blogEntry->subject) .''; $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 @@ -179,7 +183,7 @@ $by = new object(); $by->name = ''.$fullname.''; - $by->date = $template['lastmod']; + $by->date = $template['created']; print_string('bynameondate', 'forum', $by); echo ''; @@ -243,6 +247,12 @@ echo ''; + if( isset($template['lastmod']) ){ + echo '
'; + echo ' [ '.get_string('modified').': '.$template['lastmod'].' ]'; + echo '
'; + } + echo ''."\n\n"; } -- 2.39.5