[pLog-svn] r4268 -
plugins/branches/lifetype-1.1/unported/toptrackbackposts
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Nov 8 05:17:54 GMT 2006
Author: jondaley
Date: 2006-11-08 05:17:53 +0000 (Wed, 08 Nov 2006)
New Revision: 4268
Modified:
plugins/branches/lifetype-1.1/unported/toptrackbackposts/plugintoptrackbackposts.class.php
plugins/branches/lifetype-1.1/unported/toptrackbackposts/readme.txt
Log:
updated to 1.1
Modified: plugins/branches/lifetype-1.1/unported/toptrackbackposts/plugintoptrackbackposts.class.php
===================================================================
--- plugins/branches/lifetype-1.1/unported/toptrackbackposts/plugintoptrackbackposts.class.php 2006-11-08 04:59:19 UTC (rev 4267)
+++ plugins/branches/lifetype-1.1/unported/toptrackbackposts/plugintoptrackbackposts.class.php 2006-11-08 05:17:53 UTC (rev 4268)
@@ -31,6 +31,7 @@
function init()
{
+ include_once( PLOG_CLASS_PATH."class/template/menu/menu.class.php" );
$this->registerAdminAction( "toptrackbackposts", "PluginTopTrackbackPostsConfigAction" );
$this->registerAdminAction( "updateTopTrackbackPostsConfig", "PluginTopTrackbackPostsUpdateConfigAction" );
@@ -60,19 +61,12 @@
$trackbacks = new Trackbacks();
$blogId = $this->blogInfo->getId();
- if ($based == 'BLOG') {
- $query = "SELECT ".$this->prefix."trackbacks.article_id,count(".$this->prefix."trackbacks.article_id) as trackback_count";
- $query .= " FROM ".$this->prefix."trackbacks, ".$this->prefix."articles";
- $query .= " WHERE ".$this->prefix."trackbacks.article_id = ".$this->prefix."articles.id AND ".$this->prefix."articles.blog_id = ".$blogId." AND ".$this->prefix."articles.status = 1";
- $query .= " GROUP BY ".$this->prefix."trackbacks.article_id ORDER BY trackback_count DESC";
- } elseif ($based == 'SITE') {
- $query = "SELECT ".$this->prefix."trackbacks.article_id,count(".$this->prefix."trackbacks.article_id) as trackback_count";
- $query .= " FROM ".$this->prefix."trackbacks, ".$this->prefix."articles";
- $query .= " WHERE ".$this->prefix."trackbacks.article_id = ".$this->prefix."articles.id AND ".$this->prefix."articles.status = 1";
- $query .= " GROUP BY ".$this->prefix."trackbacks.article_id ORDER BY trackback_count DESC";
- } else {
- return false;
- }
+ $query = "SELECT id, num_nonspam_trackbacks ".
+ "FROM ".$this->prefix."articles WHERE ";
+ if ($based == 'BLOG')
+ $query .= "blog_id='".$blogId."' ";
+ $query .= "AND status=1 AND num_nonspam_trackbacks != 0 ".
+ "ORDER BY num_nonspam_trackbacks DESC";
if( $maxPosts > 0 )
{
@@ -81,15 +75,16 @@
$query .= " LIMIT " . $this->maxPosts;
}
- $result = $trackbacks->_db->Execute( $query );
-
+ $db =& Db::getDb();
+ $result = $db->Execute( $query );
+ print $query;
if( !$result )
return false;
$toptrackbackposts = Array();
while( $row = $result->FetchRow()) {
- $article = $this->getArticle($row["article_id"]);
- array_push( $toptrackbackposts, $article);
+ $article = $this->getArticle($row["id"]);
+ array_push( $toptrackbackposts, $article);
}
return $toptrackbackposts;
@@ -107,7 +102,8 @@
$query .= ";";
// we send the query and then fetch the first array with the result
- $result = $articles->_db->Execute( $query );
+ $db =& Db::getDb();
+ $result = $db->Execute( $query );
if( $result == false )
return false;
@@ -117,7 +113,7 @@
$row = $result->FetchRow( $result );
- $article = $articles->_fillArticleInformation( $row );
+ $article = $articles->mapRow( $row );
return $article;
}
Modified: plugins/branches/lifetype-1.1/unported/toptrackbackposts/readme.txt
===================================================================
--- plugins/branches/lifetype-1.1/unported/toptrackbackposts/readme.txt 2006-11-08 04:59:19 UTC (rev 4267)
+++ plugins/branches/lifetype-1.1/unported/toptrackbackposts/readme.txt 2006-11-08 05:17:53 UTC (rev 4268)
@@ -1,7 +1,7 @@
Plugin: Top Trackback Posts
Author: Mark Wu
-Release Date: 2005/01/23
-Version: 1.0
+Release Date: 2006/11/07
+Version: 1.1
This plugin offers the rank list of articles by number of trackbacks. Usage as follow:
@@ -14,7 +14,7 @@
2. $based is return the site-wide or blog-wide posts. "BLOG" means blog-wide, and "SITE" means site-wide. Default is "BLOG".
Example:
-{if $toptrackbackposts->isEnabled()}
+{if $toptrackbackposts && $toptrackbackposts->isEnabled()}
<h2>Top Trackback Posts</h2>
<ul>
{assign var=trackbackposts value=$toptrackbackposts->getTopTrackbackPosts()}
@@ -22,4 +22,4 @@
<li><a href="{$url->postLink($trackbackpost)}">{$trackbackpost->getTopic()} ({$trackbackpost->getNumTrackbacks()} Trackbacks)</a></li>
{/foreach}
</ul>
-{/if}
\ No newline at end of file
+{/if}
More information about the pLog-svn
mailing list