]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 towards /blog conversion
authorskodak <skodak>
Sun, 1 Jun 2008 13:48:12 +0000 (13:48 +0000)
committerskodak <skodak>
Sun, 1 Jun 2008 13:48:12 +0000 (13:48 +0000)
blocks/blog_tags/block_blog_tags.php
blog/blogpage.php
blog/edit.php
blog/edit_form.php
blog/header.php
blog/index.php
blog/lib.php
blog/rsslib.php

index 5cbb6f69c773e0caba337b646a41fabdd7f800b5..28c2d1bc28911c2f97281d393c6d31848115104a 100644 (file)
@@ -73,9 +73,10 @@ class block_blog_tags extends block_base {
 
         $timewithin = time() - $this->config->timewithin * 24 * 60 * 60; /// convert to seconds
 
-        // admins should be able to read all tags      
+        // admins should be able to read all tags
+        $type = '';
         if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) {
-            $type .= " AND (p.publishstate = 'site' or p.publishstate='public')";
+            $type = " AND (p.publishstate = 'site' or p.publishstate='public')";
         }
 
         $sql  = "SELECT t.id, t.tagtype, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct
index 7dfb52b9cb239533ae664cd6fd8598a97f273982..e7e9c9b85d41efa69769cf8709d2408bb0939318 100644 (file)
@@ -41,11 +41,15 @@ class page_blog extends page_base {
         }
     }
 
-    // Here you should load up all heavy-duty data for your page. Basically everything that
-    // does not NEED to be loaded for the class to make basic decisions should NOT be loaded
-    // in init_quick() and instead deferred here. Of course this function had better recognize
-    // $this->full_init_done to prevent wasteful multiple-time data retrieval.
+    /**
+     * Here you should load up all heavy-duty data for your page. Basically everything that
+     * does not NEED to be loaded for the class to make basic decisions should NOT be loaded
+     * in init_quick() and instead deferred here. Of course this function had better recognize
+     * $this->full_init_done to prevent wasteful multiple-time data retrieval.
+     */
     function init_full() {
+        global $DB;
+
         if ($this->full_init_done) {
             return;
         }
@@ -56,7 +60,7 @@ class page_blog extends page_base {
             $this->courseid = '';
             $courserecord = NULL;
         } else {
-            if (! ($courserecord = get_record('course', 'id', $this->courseid)) ) {
+            if (! ($courserecord = $DB->get_record('course', array('id'=>$this->courseid))) ) {
                 print_error('invalidcourseid', 'error', '',  $this->courseid);
             }
         }
index 7564deb369ffedb2d08bc5c08a9568596ac29c4c..b92ec96da13c2cae23338e1179a9fc6416098aac 100755 (executable)
@@ -26,7 +26,7 @@ if (!has_capability('moodle/blog:create', $sitecontext) and !has_capability('moo
 
 // Make sure that the person trying to edit have access right
 if ($id) {
-    if (!$existing = get_record('post', 'id', $id)) {
+    if (!$existing = $DB->get_record('post', array('id'=>$id))) {
         print_error('wrongpostid', 'blog');
     }
 
@@ -50,7 +50,7 @@ if (!empty($courseid)) {
 
 $strblogs = get_string('blogs','blog');
 
-if ($action=='delete'){
+if ($action === 'delete'){
     if (!$existing) {
         print_error('wrongpostid', 'blog');
     }
@@ -74,7 +74,7 @@ $blogeditform = new blog_edit_form(null, compact('existing', 'sitecontext'));
 
 if ($blogeditform->is_cancelled()){
     redirect($returnurl);
-} else if ($fromform = $blogeditform->get_data()){
+} else if ($fromform = $blogeditform->get_data(false)){
     //save stuff in db
     switch ($action) {
         case 'add':
@@ -128,7 +128,7 @@ switch ($action) {
 }
 
 // done here in order to allow deleting of posts with wrong user id above
-if (!$user = get_record('user', 'id', $userid)) {
+if (!$user = $DB->get_record('user', array('id'=>$userid))) {
     print_error('invaliduserid');
 }
 $navlinks = array();
@@ -149,13 +149,13 @@ die;
 
 /*****************************   edit.php functions  ***************************/
 
-/*
+/**
 * Delete blog post from database
 */
 function do_delete($post) {
-    global $returnurl;
+    global $returnurl, $DB;
 
-    $status = delete_records('post', 'id', $post->id);
+    $status = $DB->delete_records('post', array('id'=>$post->id));
     //$status = delete_records('blog_tag_instance', 'entryid', $post->id) and $status;
     tag_set('post', $post->id, array());
     
@@ -172,7 +172,7 @@ function do_delete($post) {
  * Write a new blog entry into database
  */
 function do_add($post, $blogeditform) {
-    global $CFG, $USER, $returnurl;
+    global $CFG, $USER, $returnurl, $DB;
 
     $post->module       = 'blog';
     $post->userid       = $USER->id;
@@ -180,12 +180,12 @@ function do_add($post, $blogeditform) {
     $post->created      = time();
 
     // Insert the new blog entry.
-    if ($id = insert_record('post', $post)) {
+    if ($id = $DB->insert_record('post', $post)) {
         $post->id = $id;
         // add blog attachment
         $dir = blog_file_area_name($post);
         if ($blogeditform->save_files($dir) and $newfilename = $blogeditform->get_new_filename()) {
-            set_field("post", "attachment", $newfilename, "id", $post->id);
+            $DB->set_field("post", "attachment", $newfilename, array("id"=>$post->id));
         }
         add_tags_info($post->id);
         add_to_log(SITEID, 'blog', 'add', 'index.php?userid='.$post->userid.'&postid='.$post->id, $post->subject);
@@ -202,9 +202,7 @@ function do_add($post, $blogeditform) {
  * @todo complete documenting this function. enable trackback and pingback between entries on the same server
  */
 function do_edit($post, $blogeditform) {
-
-    global $CFG, $USER, $returnurl;
-
+    global $CFG, $USER, $returnurl, $DB;
 
     $post->lastmodified = time();
 
@@ -214,7 +212,7 @@ function do_edit($post, $blogeditform) {
     }
 
     // update record
-    if (update_record('post', $post)) {
+    if ($DB->update_record('post', $post)) {
         // delete all tags associated with this entry
         
         //delete_records('blog_tag_instance', 'entryid', $post->id);
index 9723a317364c59c972fc9f51096d7d45b49e8247..499f22ea888ef4930d010647ef8ba09d6e4432ad 100644 (file)
@@ -5,8 +5,8 @@ require_once($CFG->libdir.'/formslib.php');
 class blog_edit_form extends moodleform {
 
     function definition() {
-
         global $CFG, $COURSE, $USER;
+
         $mform    =& $this->_form;
 
         $post = $this->_customdata['existing'];
@@ -75,13 +75,14 @@ class blog_edit_form extends moodleform {
      *
      */
     function otags_select_setup(){
-        global $CFG;
+        global $CFG, $DB;
+
         $mform =& $this->_form;
         if ($otagsselect =& $mform->getElement('otags')) {
             $otagsselect->removeOptions();
         }
         $namefield = empty($CFG->keeptagnamecase) ? 'name' : 'rawname';
-        if ($otags = get_records_sql_menu('SELECT id, '.$namefield.' from '.$CFG->prefix.'tag WHERE tagtype=\'official\' ORDER by name ASC')){
+        if ($otags = $DB->get_records_sql_menu("SELECT id, $namefield FROM {tag} WHERE tagtype='official' ORDER by name ASC")){
             $otagsselect->loadArray($otags);
         }
     }
index 63234d0c8a707fafb9d79446900e07a83076bce1..619bd8862fe7122bd12d8ca9d8a7f14c056616a9 100755 (executable)
@@ -16,7 +16,7 @@ $blockid     = optional_param('blockid',    0, PARAM_INT);
 blog_check_and_install_blocks();
 
 
-if (!$course = get_record('course', 'id', $courseid)) {
+if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
     print_error('invalidcourseid', '', '', $courseid);
 }
 
@@ -83,7 +83,7 @@ if ($editing) {
 }
 
 if (!empty($tagid)) {
-    $taginstance = get_record('tag', 'id', $tagid);
+    $taginstance = $DB->get_record('tag', array('id'=>$tagid));
 } elseif (!empty($tag)) {
     $taginstance = tag_id($tag);
 }
@@ -98,7 +98,7 @@ $blogstring = get_string('blogs','blog');
 $tagstring = get_string('tag');
 
 // needed also for user tabs later
-if (!$course = get_record('course', 'id', $courseid)) {
+if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
     print_error('invalidcourseid', '', '', $courseid);
 }
 
@@ -164,7 +164,7 @@ $navlinks = array();
 
         case 'user':
             $participants = get_string('participants');
-            if (!$user = get_record('user', 'id', $filterselect)) {
+            if (!$user = $DB->get_record('user', array('id'=>$filterselect))) {
                print_error('invaliduserid');
             }
 
index 4d54fd7614cdbff2ef14a6d4c9747821e6edefc0..88b66c2d0783a1c1f70f2464b370905d99a1e1bf 100755 (executable)
@@ -42,7 +42,7 @@ if (empty($filtertype)) {
     } else if (has_capability('moodle/blog:view', $sitecontext) and $CFG->bloglevel > BLOG_USER_LEVEL) {
         if ($postid) {
             $filtertype = 'user';
-            if (!$postobject = get_record('post', 'module', 'blog', 'id', $postid)) {
+            if (!$postobject = $DB->get_record('post', array('module'=>'blog', 'id'=>$postid))) {
                 error('No such blog entry');
             }
             $filterselect = $postobject->userid;
@@ -77,7 +77,7 @@ switch ($filtertype) {
         if ($CFG->bloglevel < BLOG_COURSE_LEVEL) {
             print_error('courseblogdisable', 'blog');
         }
-        if (!$course = get_record('course', 'id', $filterselect)) {
+        if (!$course = $DB->get_record('course', array('id'=>$filterselect))) {
             print_error('invalidcourseid');
         }
         $courseid = $course->id;
@@ -97,7 +97,7 @@ switch ($filtertype) {
         if (! $group = groups_get_group($filterselect)) { //TODO:check.
             print_error('invalidgroupid');
         }
-        if (!$course = get_record('course', 'id', $group->courseid)) {
+        if (!$course = $DB->get_record('course', array('id'=>$group->courseid))) {
             print_error('invalidcourseid');
         }
         $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -119,7 +119,7 @@ switch ($filtertype) {
         if ($CFG->bloglevel < BLOG_USER_LEVEL) {
             print_error('blogdisable', 'blog');
         }
-        if (!$user = get_record('user', 'id', $filterselect)) {
+        if (!$user = $DB->get_record('user', array('id'=>$filterselect))) {
             print_error('invaliduserid');
         }
         if ($USER->id == $filterselect) {
index 39b38e4e28f1378b5580d7d219ae749b4efa13e6..026a3a04168ff68f839b4eef7c45f5b0295a3d60 100755 (executable)
      * default blocks (blog_menu and blog_tags).
      */
     function blog_check_and_install_blocks() {
-        global $USER;
+        global $USER, $DB;
+
         if (isloggedin() && !isguest()) {
             // if this user has not visited this page before
             if (!get_user_preferences('blogpagesize')) {
                 // find the correct ids for blog_menu and blog_from blocks
-                $menublock = get_record('block','name','blog_menu');
-                $tagsblock = get_record('block','name','blog_tags');
+                $menublock = $DB->get_record('block', array('name'=>'blog_menu'));
+                $tagsblock = $DB->get_record('block', array('name'=>'blog_tags'));
                 // add those 2 into block_instance page
 
                 // add blog_menu block
                 $newblock->position = 'r';
                 $newblock->weight   = 0;
                 $newblock->visible  = 1;
-                insert_record('block_instance', $newblock);
+                $DB->insert_record('block_instance', $newblock);
 
                 // add blog_tags menu
                 $newblock -> blockid = $tagsblock->id;
                 $newblock -> weight  = 1;
-                insert_record('block_instance', $newblock);
+                $DB->insert_record('block_instance', $newblock);
 
                 // finally we set the page size pref
                 set_user_preference('blogpagesize', 10);
      *     display the entry in its abbreviated format (eg. index page)
      */
     function blog_print_entry($blogEntry, $viewtype='full', $filtertype='', $filterselect='', $mode='loud') {
-
-        global $USER, $CFG, $COURSE, $ME;
+        global $USER, $CFG, $COURSE, $ME, $DB;
 
         $template['body'] = format_text($blogEntry->summary, $blogEntry->format);
         //$template['title'] = '<a name="'. $blogEntry->subject .'"></a>';
         //enclose the title in nolink tags so that moodle formatting doesn't autolink the text
         $template['title'] = '<span class="nolink">'.$blogEntry->subject.'</span>';
         $template['userid'] = $blogEntry->userid;
-        $template['author'] = fullname(get_record('user','id',$blogEntry->userid));
+        $template['author'] = fullname($DB->get_record('user', array('id'=>$blogEntry->userid)));
         $template['lastmod'] = userdate($blogEntry->lastmodified);
         $template['created'] = userdate($blogEntry->created);
         $template['publishstate'] = $blogEntry->publishstate;
         $stredit = get_string('edit');
         $strdelete = get_string('delete');
 
-        $user = get_record('user','id',$template['userid']);
+        $user = $DB->get_record('user', array('id'=>$template['userid']));
 
         /// Start printing of the blog
 
 
     }
 
+    /**
+     * Creates a directory file name, suitable for make_upload_directory()
+     * $CFG->dataroot/blog/attachments/xxxx/file.jpg
+     */
     function blog_file_area_name($blogentry) {
-    //  Creates a directory file name, suitable for make_upload_directory()
-        global $CFG;
-        // $CFG->dataroot/blog/attachments/xxxx/file.jpg
         return "blog/attachments/$blogentry->id";
     }
 
         return make_upload_directory( blog_file_area_name($blogentry) );
     }
 
+    /**
+     * Deletes all the user files in the attachments area for a post
+     * EXCEPT for any file named $exception
+     */
     function blog_delete_old_attachments($post, $exception="") {
-    // Deletes all the user files in the attachments area for a post
-    // EXCEPT for any file named $exception
-
         if ($basedir = blog_file_area($post)) {
             if ($files = get_directory_list($basedir)) {
                 foreach ($files as $file) {
         }
     }
 
+    /**
+     * if return=html, then return a html string.
+     * if return=text, then return a text-only string.
+     * otherwise, print HTML for non-images, and return image HTML
+     */
     function blog_print_attachments($blogentry, $return=NULL) {
-    // if return=html, then return a html string.
-    // if return=text, then return a text-only string.
-    // otherwise, print HTML for non-images, and return image HTML
-
         global $CFG;
 
         $filearea = blog_file_area_name($blogentry);
      *                choose_from_menu function.
      */
     function blog_applicable_publish_states($courseid='') {
-
         global $CFG;
 
         // everyone gets draft access
      * This also applies to deleting of posts.
      */
     function blog_user_can_edit_post($blogEntry) {
-
         global $CFG, $USER;
 
         $sitecontext = get_context_instance(CONTEXT_SYSTEM);
      * in blog/index.php
      */
     function blog_user_can_view_user_post($targetuserid, $blogEntry=null) {
-        global $CFG, $USER;
+        global $CFG, $USER, $DB;
 
         if (empty($CFG->bloglevel)) {
             return false; // blog system disabled
                 $usercourses = array_keys(get_my_courses($targetuserid));
                 $shared = array_intersect($mycourses, $usercourses);
                 foreach ($shared as $courseid) {
-                    $course = get_record('course', 'id', $courseid);
+                    $course = $DB->get_record('course', array('id'=>$courseid));
                     $coursecontext = get_context_instance(CONTEXT_COURSE, $courseid);
                     if (has_capability('moodle/site:accessallgroups', $coursecontext)
                       or groups_get_course_groupmode($course) != SEPARATEGROUPS) {
      * Main filter function.
      */
     function blog_fetch_entries($postid='', $fetchlimit=10, $fetchstart='', $filtertype='', $filterselect='', $tagid='', $tag ='', $sort='lastmodified DESC', $limit=true) {
-
-        global $CFG, $USER;
+        global $CFG, $USER, $DB;
 
         /// the post table will be used for other things too
-        $typesql = " AND p.module = 'blog' ";
+        $typesql = "AND p.module = 'blog'";
 
         /// set the tag id for searching
         if ($tagid) {
             $tag = $tagid;
         } else if ($tag) {
-            if ($tagrec = get_record_sql('SELECT * FROM '.$CFG->prefix.'tag WHERE name LIKE "'.$tag.'"')) {
+            if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE name LIKE ?", array($tag))) {
                 $tag = $tagrec->id;
             } else {
                 $tag = -1;    //no records found
         // Just return 1 entry
 
         if ($postid) {
-
-            if ($post = get_record('post', 'id', $postid)) {
+            if ($post = $DB->get_record('post', array('id'=>$postid))) {
 
                 if (blog_user_can_view_user_post($post->userid, $post)) {
 
-                    if ($user = get_record('user', 'id', $post->userid)) {
+                    if ($user = $DB->get_record('user', array('id'=>$post->userid))) {
                         $post->email = $user->email;
                         $post->firstname = $user->firstname;
                         $post->lastname = $user->lastname;
             }
         }
 
+        $params = array();
+
         if ($tag) {
-            $tagtablesql = $CFG->prefix.'tag_instance ti, ';
-            $tagquerysql = ' AND ti.itemid = p.id AND ti.tagid = '.$tag.' AND ti.itemtype = \'post\' ';
+            $tagtablesql = ", {tag_instance} ti";
+            $tagquerysql = "AND ti.itemid = p.id AND ti.tagid = :tag AND ti.itemtype = 'post'";
+            $params['tag'] = $tag;
         } else {
             $tagtablesql = '';
             $tagquerysql = '';
         }
 
         if (isloggedin() && !has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), $USER->id, false)) {
-            $permissionsql =  'AND (p.publishstate = \'site\' OR p.publishstate = \'public\' OR p.userid = '.$USER->id.')';
+            $permissionsql = "AND (p.publishstate = 'site' OR p.publishstate = 'public' OR p.userid = :userid)";
+            $params['userid'] = $USER->id;
         } else {
-            $permissionsql =  'AND p.publishstate = \'public\'';
+            $permissionsql = "AND p.publishstate = 'public'";
         }
 
         // fix for MDL-9165, use with readuserblogs capability in a user context can read that user's private blogs
          * different possible sqls              *
          ****************************************/
 
-        $requiredfields = 'p.*, u.firstname,u.lastname,u.email';
+        $requiredfields = "p.*, u.firstname,u.lastname,u.email";
 
         if ($filtertype == 'course' && $filterselect == SITEID) {  // Really a site
             $filtertype = 'site';
 
             case 'site':
 
-                $SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
-                        .$CFG->prefix.'user u
-                        WHERE p.userid = u.id '.$tagquerysql.'
-                        AND u.deleted = 0
-                        '.$permissionsql.$typesql;
+                $SQL = "SELECT $requiredfields
+                          FROM {post} p, {user} u $tagtablesql
+                         WHERE p.userid = u.id $tagquerysql
+                               AND u.deleted = 0
+                               $permissionsql $typesql";
 
             break;
 
                 if (has_capability('moodle/role:viewhiddenassigns', $context)) {
                     $hiddensql = '';
                 } else {
-                    $hiddensql = ' AND ra.hidden = 0 ';
+                    $hiddensql = 'AND ra.hidden = 0';
                 }
 
-                $SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
-                        .$CFG->prefix.'role_assignments ra, '.$CFG->prefix.'user u
-                        WHERE p.userid = ra.userid '.$tagquerysql.'
-                        AND ra.contextid '.get_related_contexts_string($context).'
-                        AND u.id = p.userid
-                        AND u.deleted = 0
-                        '.$hiddensql.$permissionsql.$typesql;
+                $SQL = "SELECT $requiredfields
+                          FROM {post} p, {user} u, {role_assignments} ra $tagtablesql
+                         WHERE p.userid = ra.userid $tagquerysql
+                               AND ra.contextid ".get_related_contexts_string($context)."
+                               AND u.id = p.userid
+                               AND u.deleted = 0
+                               $hiddensql $permissionsql $typesql";
 
             break;
 
             case 'group':
 
-                $SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
-                          .$CFG->prefix.'groups_members gm, '.$CFG->prefix.'user u
-                        WHERE p.userid = gm.userid AND u.id = p.userid '.$tagquerysql.'
-                          AND gm.groupid = '.$filterselect.'
-                          AND u.deleted = 0
-                          '.$permissionsql.$typesql;
+                $SQL = "SELECT $requiredfields
+                          FROM {post} p, {user} u, {groups_members} gm $tagtablesql
+                         WHERE p.userid = gm.userid AND u.id = p.userid $tagquerysql
+                               AND gm.groupid = :groupid
+                               AND u.deleted = 0
+                               $permissionsql $typesql";
+                $params['groupid'] = $filterselect;
             break;
 
             case 'user':
 
-                $SQL = 'SELECT '.$requiredfields.' FROM '.$CFG->prefix.'post p, '.$tagtablesql
-                        .$CFG->prefix.'user u
-                        WHERE p.userid = u.id '.$tagquerysql.'
-                        AND u.id = '.$filterselect.'
-                        AND u.deleted = 0
-                        '.$permissionsql.$typesql;
+                $SQL = "SELECT $requiredfields
+                          FROM {post} p, {user} u $tagtablesql
+                         WHERE p.userid = u.id $tagquerysql
+                               AND u.id = :uid
+                               AND u.deleted = 0
+                               $permissionsql $typesql";
+               $params['uid'] = $filterselect;
             break;
         }
 
             $limitnum = $fetchlimit;
         }
 
-        $orderby = ' ORDER BY '. $sort .' ';
+        $orderby = "ORDER BY $sort";
 
-        $records = get_records_sql($SQL . $orderby, $limitfrom, $limitnum);
+        $records = $DB->get_records_sql("$SQL $orderby", $params, $limitfrom, $limitnum);
 
         if (empty($records)) {
             return array();
      * Used in backup of site courses.
      */
     function blog_get_participants() {
+        global $CFG, $DB;
 
-        global $CFG;
-
-        return get_records_sql("SELECT userid as id 
-                                  FROM {$CFG->prefix}post
-                                 WHERE module = 'blog'
-                                   AND courseid = 0");
+        return $DB->get_records_sql("SELECT userid AS id 
+                                       FROM {post}
+                                      WHERE module = 'blog' AND courseid = 0");
     }
 ?>
index 897eb8660dc1f79dce3afe14aa7aa4476d63443a..0b078f3cb01d7d3ffa5ecd215fd0429b3388ce05 100755 (executable)
@@ -50,7 +50,7 @@
 
     // Generate any blog RSS feed via one function (called by ../rss/file.php)
     function blog_generate_rss_feed($type, $id, $tagid=0) {
-        global $CFG, $SITE;
+        global $CFG, $SITE, $DB;
 
         if (empty($CFG->enablerssfeeds)) {
             debugging('Sorry, RSS feeds are disabled on this site');
@@ -74,7 +74,7 @@
             $items = array();
             foreach ($blogposts as $blogpost) {
                 $item = NULL;
-                $item->author = fullname(get_record('user','id',$blogpost->userid));
+                $item->author = fullname($DB->get_record('user', array('id'=>$blogpost->userid))); // TODO: this is slow
                 $item->title = $blogpost->subject;
                 $item->pubdate = $blogpost->lastmodified;
                 $item->link = $CFG->wwwroot.'/blog/index.php?postid='.$blogpost->id;
      
         switch ($type) {
             case 'user':
-                $info = fullname(get_record('user', 'id', $id, '','','','','firstname,lastname'));
+                $info = fullname($DB->get_record('user', array('id'=>$id), 'firstname,lastname'));
                 break;
             case 'course':
-                $info = get_field('course', 'fullname', 'id', $id);
+                $info = $DB->get_field('course', 'fullname', array('id'=>$id));
                 break;
             case 'site':
                 $info = $SITE->fullname;
         }
 
         if ($tagid) {
-            $info .= ': '.get_field('tags', 'text', 'id', $tagid);
+            $info .= ': '.$DB->get_field('tags', 'text', array('id'=>$tagid));
         }
 
         $header = rss_standard_header(get_string($type.'blog','blog', $info),