Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_statistics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23021/plugins/serendipity_event_statistics
Modified Files:
serendipity_event_statistics.php
Log Message:
Great patch by Evan nemerson: Subcategories, post to multiple categories, threaded comments.
My basic tests left no problems or issues with it, but make sure you update your databases when testing!
Index: serendipity_event_statistics.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_statistics/serendipity_event_statistics.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- serendipity_event_statistics.php 6 May 2004 11:03:41 -0000 1.7
+++ serendipity_event_statistics.php 7 Jun 2004 14:22:48 -0000 1.8
@@ -51,7 +51,7 @@
@define('PLUGIN_EVENT_STATISTICS_MAX_ITEMS', 'Anzahl Einträge');
@define('PLUGIN_EVENT_STATISTICS_MAX_ITEMS_DESC', 'Wieviele Einträge sollen pro Wert dargestellt werden? (Standard: 20)');
break;
-
+
case 'en':
case 'es':
default:
@@ -111,14 +111,14 @@
function introspect(&$propbag)
{
global $serendipity;
-
+
$propbag->add('name', PLUGIN_EVENT_STATISTICS_NAME);
$propbag->add('description', PLUGIN_EVENT_STATISTICS_DESC);
$propbag->add('event_hooks', array(
'backend_sidebar_entries' => true,
'backend_sidebar_entries_event_display_statistics' => true
));
-
+
$propbag->add('configuration', array('max_items'));
}
@@ -131,7 +131,7 @@
$propbag->add('description', PLUGIN_EVENT_STATISTICS_MAX_ITEMS_DESC);
break;
}
-
+
return true;
}
@@ -141,7 +141,7 @@
function event_hook($event, &$bag, &$eventData) {
global $serendipity;
-
+
$hooks = &$bag->get('event_hooks');
if (isset($hooks[$event])) {
@@ -152,12 +152,12 @@
• <a href="?serendipity[adminModule]=event_display&serendipity[adminAction]=statistics"><?php echo PLUGIN_EVENT_STATISTICS_NAME; ?></a><br />
<?php
// }
-
+
break;
-
+
case 'backend_sidebar_entries_event_display_statistics':
$max_items = $this->get_config('max_items');
-
+
if (!$max_items || !is_numeric($max_items) || $max_items < 1) {
$max_items = 20;
}
@@ -168,16 +168,18 @@
$draft_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}entries WHERE isdraft = 'true'", true);
$publish_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}entries WHERE isdraft = 'false'", true);
$category_count = serendipity_db_query("SELECT count(categoryid) FROM {$serendipity['dbPrefix']}category", true);
- $category_rows = serendipity_db_query("SELECT c.category_name, count(e.id) as postings
- FROM {$serendipity['dbPrefix']}category c,
+ $cat_sql = "SELECT c.category_name, count(e.id) as postings
+ FROM {$serendipity['dbPrefix']}entrycat ec,
+ {$serendipity['dbPrefix']}category c,
{$serendipity['dbPrefix']}entries e
- WHERE e.categoryid = c.categoryid
- GROUP BY e.categoryid
- ORDER BY postings DESC");
+ WHERE ec.categoryid = c.categoryid AND ec.entryid = e.id
+ GROUP BY ec.categoryid
+ ORDER BY postings DESC";
+ $category_rows = serendipity_db_query($cat_sql);
$image_count = serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}images", true);
$image_rows = serendipity_db_query("SELECT extension, count(id) AS images FROM {$serendipity['dbPrefix']}images GROUP BY extension ORDER BY images DESC");
-
+
$subscriber_count = count(serendipity_db_query("SELECT count(id) FROM {$serendipity['dbPrefix']}comments WHERE type = 'NORMAL' AND subscribed = 'true' GROUP BY email"));
$subscriber_rows = serendipity_db_query("SELECT e.id, e.title, count(c.id) as postings
FROM {$serendipity['dbPrefix']}comments c,
@@ -224,7 +226,7 @@
?>
<h3><?php echo PLUGIN_EVENT_STATISTICS_OUT_STATISTICS; ?></h3>
-
+
<div style="margin: 5px; padding: 5px">
<dl>
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_FIRST_ENTRY; ?></strong></dt>
@@ -236,7 +238,7 @@
<br />
<hr />
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_TOTAL_ENTRIES; ?></strong></dt>
<dd><?php echo $total_count[0]; ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_ENTRIES; ?></dd>
<br />
@@ -249,11 +251,11 @@
<br />
<hr />
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_CATEGORIES; ?></strong></dt>
<dd><?php echo $category_count[0]; ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_CATEGORIES2; ?></dd>
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_CATEGORIES; ?></strong></dt>
<dl>
<?php
@@ -270,11 +272,11 @@
<br />
<hr />
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_UPLOADED_IMAGES; ?></strong></dt>
<dd><?php echo $image_count[0]; ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_UPLOADED_IMAGES2; ?></dd>
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_IMAGES; ?></strong></dt>
<dl>
<?php
@@ -388,11 +390,11 @@
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE; ?></strong></dt>
<dd><?php echo round($comment_count[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS_PER_ARTICLE;2 ?></dd>
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE; ?></strong></dt>
<dd><?php echo round($tb_count[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_TRACKBACKS_PER_ARTICLE2; ?></dd>
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_DAY; ?></strong></dt>
<dd><?php echo round($publish_count[0] / ((time() - $first_entry[0]) / (60*60*24)), 2);?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_ARTICLES_PER_DAY2; ?></dd>
<br />
@@ -410,7 +412,7 @@
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS; ?></strong></dt>
<dd><?php echo $length[0]; ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS2; ?></dd>
<br />
-
+
<dt><strong><?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE; ?></strong></dt>
<dd><?php echo round($length[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE2; ?></dd>
<br />
@@ -434,7 +436,7 @@
<?php
return true;
break;
-
+
default:
return false;
break;
|