]> git.mjollnir.org Git - moodle.git/commitdiff
some small fixes, mostly for 5174
authortoyomoyo <toyomoyo>
Mon, 24 Apr 2006 03:36:02 +0000 (03:36 +0000)
committertoyomoyo <toyomoyo>
Mon, 24 Apr 2006 03:36:02 +0000 (03:36 +0000)
blocks/blog_menu/block_blog_menu.php
blog/edit.php
blog/footer.php
blog/header.php
blog/index.php
blog/lib.php

index 3c8cc5e80e82402391053a575421fda24f12577b..fd8d726e7f9e094e1754b1587f20fc7e1954e599 100755 (executable)
@@ -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;
         }
index fc56e38c4dc861a392f3fc40c1c5462b84cef5c8..751d54fb41cafbacd4444ca733f33148dafa27f7 100755 (executable)
@@ -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
index cd35640d95cb6b5a8ac1909b474c6b0b25c70d13..8ae25f8d1e94c67f9d237caba02c8c0071ad6ab9 100644 (file)
@@ -20,9 +20,10 @@ if (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing) {
 </table>
 
 <?php
-if (isset($course)) {
+
+if (isset($course) && ($course->id)) {
     print_footer($course);
 } else {
     print_footer();
 }
-?>
\ No newline at end of file
+?>
index 14843d3353d7dfb118fadee07d6f8484228dc256..518dd107a1a489a910dc1d1d49c3311fa92b3858 100755 (executable)
@@ -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
index c890565b548d7545f4433c21c257e500030a08ac..7897f00a16bc88299e5603986317a3f82e33fb55 100755 (executable)
@@ -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);
index bb854d604edd80ec067279f7c6b259812ca79e19..6589128ff292f0384760cbd1c4b09dda5db04781 100755 (executable)
 
         /// 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);
 
         echo '</div>';
 
-        echo '</td></tr></table></div>'."\n\n";
+        echo '</td></tr></table>'."\n\n";
 
     }