From: toyomoyo Date: Thu, 16 Mar 2006 04:21:13 +0000 (+0000) Subject: more cleaning X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=91366ca7dd634e4c998415616eebedd5c1553205;p=moodle.git more cleaning --- diff --git a/blog/class.BlogEntry.php b/blog/class.BlogEntry.php index aced56596d..9aba078bb7 100755 --- a/blog/class.BlogEntry.php +++ b/blog/class.BlogEntry.php @@ -72,24 +72,6 @@ class BlogEntry { $this->entryId = $entrydetails->id; - if (!empty($entrydetails->categoryid)) { - if (is_array($entrydetails->categoryid)) { - $this->entryCategoryIds = $entrydetails->categoryid; - } else { - $this->entryCategoryIds = array($entrydetails->categoryid); - } - } else { - // load up all categories that this entry is associated with - // cannot use moodle's get_records() here because this table does not conform well enough - $sql = 'SELECT * FROM '. $CFG->prefix .'blog_categories_entries WHERE entryid='. $this->entryId; - if($rs = $db->Execute($sql)) { - while (!$rs->EOF) { - $this->entryCategoryIds[] = $rs->fields['categoryid']; - $rs->MoveNext(); - } - } - } - $this->entryCategoryIds = array_unique($this->entryCategoryIds); // print "Debug: entryId: $this->entryId"; //debug // print_object($this->entryCategoryIds); //debug @@ -103,10 +85,8 @@ class BlogEntry { $this->entryuserid = $entrydetails->userid; - //added stripslashes_safe here for rss feeds. Will this conflict anywhere? - $this->entryTitle = ereg_replace('', "'", stripslashes_safe($entrydetails->subject)); //subject, not title! $this->entryFormat = $entrydetails->format; @@ -126,17 +106,6 @@ class BlogEntry { //need to make sure that email is actually just a link to our email sending page. $this->entryAuthorEmail = $rs->email; - // then each category - if (!empty($this->entryCategoryIds)) { - foreach ($this->entryCategoryIds as $categoryid) { - if (! $currcat = get_record('blog_categories', 'id', $categoryid)) { - print 'Could not find category id '. $categoryid ."\n"; - $this->entryCategories[$categoryid] = ''; - } else { - $this->entryCategories[$categoryid] = $currcat->catname; - } - } - } } /** @@ -375,16 +344,6 @@ class BlogEntry { $dataobject->userid = intval($this->entryuserid); $dataobject->publishstate = $this->entryPublishState; - if ($this->entryCourseId) { - $dataobject->courseid = $this->entryCourseId; - } else { - $dataobject->courseid = SITEID; //yu: in case change to all course - } - if ($this->entryGroupId) { - $dataobject->groupid = $this->entryGroupId; - } else { - $dataobject->groupid = 0; //yu: in case we change to all groups - } $dataobject->lastmodified = $timenow; $dataobject->summary = ereg_replace("'", '', $dataobject->summary); @@ -403,18 +362,6 @@ class BlogEntry { $sql = 'DELETE FROM '. $CFG->prefix .'blog_categories_entries WHERE entryid='. $this->entryId; $rs = $db->Execute($sql); - if (!empty($this->entryCategoryIds)) { - if (!is_array($this->entryCategoryIds)) { - $this->entryCategoryIds = array($this->entryCategoryIds); - } - $this->entryCategoryIds = array_unique($this->entryCategoryIds); - foreach ($this->entryCategoryIds as $categoryid) { - $cat->entryid = $this->entryId; - $cat->categoryid = $categoryid; - insert_record('blog_categories_entries', $cat); - } - } - // next update the entry itself if (update_record('post', $dataobject)) { return true; diff --git a/blog/class.BlogFilter.php b/blog/class.BlogFilter.php index bafdcc3d30..cd5b6e8b81 100755 --- a/blog/class.BlogFilter.php +++ b/blog/class.BlogFilter.php @@ -100,7 +100,6 @@ class BlogFilter { $this->fetchlimit = $fetchlimit; } - $this->postid = $postid; $this->sort = $sort; diff --git a/blog/edit.php b/blog/edit.php index 56f9173a01..f561dfe8e1 100755 --- a/blog/edit.php +++ b/blog/edit.php @@ -310,7 +310,6 @@ function do_update(&$post, &$bloginfo) { echo "id id ".$post->postid; // print_object($blogentry); //debug - $blogentry->set_title($post->etitle); $blogentry->set_body($post->body); $blogentry->set_format($post->format); $blogentry->set_publishstate($post->publishstate); //we don't care about the return value here diff --git a/blog/header.php b/blog/header.php index 45e8fc2d61..f5f84c12e2 100755 --- a/blog/header.php +++ b/blog/header.php @@ -59,11 +59,11 @@ else { $PAGE->courseid = $courseid; $PAGE->init_full(); //init the BlogInfo object and the courserecord object -if (isset($tagid) && $tagid) { +if (!empty($tagid)) { $taginstance = get_record('tags', 'id', $tagid); } else { $tagid = ''; - if (isset($tag) && $tag) { + if (!empty($tag)) { $tagrec = get_record('tags', 'text', $tag); $tagid = $tagrec->id; $taginstance = get_record('tags', 'id', $tagid); @@ -84,7 +84,7 @@ $tagstring = get_string('tag'); switch ($filtertype) { case 'site': - if ($tagid || (isset($tag) && $tag)) { + if ($tagid || !empty($tag)) { print_header("$site->shortname: $blogstring", "$site->fullname", ''. "$blogstring -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string()); } else { @@ -94,7 +94,7 @@ switch ($filtertype) { break; case 'course': - if ($tagid || (isset($tag) && $tag)) { + if ($tagid || !empty($tag)) { print_header("$course->shortname: $blogstring", "$course->fullname", ''.$course->shortname.' -> '. "$blogstring -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string()); @@ -109,7 +109,7 @@ switch ($filtertype) { $thisgroup = get_record('groups', 'id', $filterselect); - if ($tagid || (isset($tag) && $tag)) { + if ($tagid || !empty($tag)) { print_header("$course->shortname: $blogstring", "$course->fullname", ''.$course->shortname.' -> '.$thisgroup->name.' -> @@ -129,7 +129,7 @@ switch ($filtertype) { $participants = get_string('participants'); if (isset($course->id) && $course->id && $course->id != SITEID) { - if ($tagid || (isset($tag) && $tag)) { + if ($tagid || !empty($tag)) { print_header("$course->shortname: $blogstring", "$course->fullname", ''.$course->shortname.' -> '.$participants.' -> @@ -149,7 +149,7 @@ switch ($filtertype) { //in top view else { - if ($tagid || (isset($tag) && $tag)) { + if ($tagid || !empty($tag)) { print_header("$site->shortname: $blogstring", "$site->fullname", ''.fullname($user).' -> '. "$blogstring -> $tagstring: $taginstance->text",'','',true,$PAGE->get_extra_header_string());