Update of /cvsroot/php-blog/serendipity/plugins/serendipity_event_statistics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20760/serendipity_event_statistics
Modified Files:
Tag: branch-smarty
serendipity_event_statistics.php
Log Message:
MFH
Index: serendipity_event_statistics.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/plugins/serendipity_event_statistics/serendipity_event_statistics.php,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -d -r1.11.2.1 -r1.11.2.2
--- serendipity_event_statistics.php 13 Oct 2004 09:40:17 -0000 1.11.2.1
+++ serendipity_event_statistics.php 27 Oct 2004 11:04:56 -0000 1.11.2.2
@@ -72,7 +72,7 @@
@define('PLUGIN_EVENT_STATISTICS_OUT_CATEGORIES', 'Categories');
@define('PLUGIN_EVENT_STATISTICS_OUT_CATEGORIES2', 'categories');
@define('PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_CATEGORIES', 'Distribution of entries');
- @define('PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_CATEGORIES2', 'entry');
+ @define('PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_CATEGORIES2', 'entries');
@define('PLUGIN_EVENT_STATISTICS_OUT_UPLOADED_IMAGES', 'Uploaded images');
@define('PLUGIN_EVENT_STATISTICS_OUT_UPLOADED_IMAGES2', 'image(s)');
@define('PLUGIN_EVENT_STATISTICS_OUT_DISTRIBUTION_IMAGES', 'Distribution of image types');
@@ -204,10 +204,10 @@
ORDER BY postings DESC
LIMIT $max_items");
- $commentor_rows = serendipity_db_query("SELECT author, email, url, count(id) as postings
+ $commentor_rows = serendipity_db_query("SELECT author, max(email) as email, max(url) as url, count(id) as postings
FROM {$serendipity['dbPrefix']}comments c
WHERE type = 'NORMAL'
- GROUP BY author, email, url
+ GROUP BY author
ORDER BY postings DESC
LIMIT $max_items");
@@ -220,10 +220,10 @@
ORDER BY postings DESC
LIMIT $max_items");
- $tbr_rows = serendipity_db_query("SELECT author, email, url, count(id) as postings
+ $tbr_rows = serendipity_db_query("SELECT author, max(email) as email, max(url) as url, count(id) as postings
FROM {$serendipity['dbPrefix']}comments c
WHERE type = 'TRACKBACK'
- GROUP BY author, email, url
+ GROUP BY author
ORDER BY postings DESC
LIMIT $max_items");
@@ -324,8 +324,24 @@
<?php
if (is_array($commentor_rows)) {
foreach($commentor_rows AS $comment => $com_stat) {
+ $link_start = '';
+ $link_end = '';
+ $link_url = '';
+
+ if (!empty($com_stat['email'])) {
+ $link_start = '<a href="mailto:' . htmlspecialchars($com_stat['email']) . '">';
+ $link_end = '</a>';
+ }
+
+ if (!empty($com_stat['url'])) {
+ $link_url = ' (<a href="' . htmlspecialchars($com_stat['url']) . '">' . PLUGIN_EVENT_STATISTICS_OUT_LINK . '</a>)';
+ }
+
+ if (empty($com_stat['author'])) {
+ $com_stat['author'] = ANONYMOUS;
+ }
?>
- <dt><strong><a href="mailto:<?php echo $com_stat['email']; ?>"><?php echo $com_stat['author']; ?></a> (<a href="<?php echo $com_stat['url']; ?>"><?php echo PLUGIN_EVENT_STATISTICS_OUT_LINK; ?></a>)</strong></dt>
+ <dt><strong><?php echo $link_start . $com_stat['author'] . $link_end . $link_url; ?> </strong></dt>
<dd><?php echo $com_stat['postings']; ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_COMMENTS2; ?></dd>
<?php
}
@@ -381,8 +397,11 @@
<?php
if (is_array($tbr_rows)) {
foreach($tbr_rows AS $tb => $tb_stat) {
+ if (empty($tb_stat['author'])) {
+ $tb_stat['author'] = ANONYMOUS;
+ }
?>
- <dt><strong><a href="mailto:<?php echo $tb_stat['email']; ?>"><?php echo $tb_stat['author']; ?></a> (<a href="<?php echo $tb_stat['url']; ?>">Link</a>)</strong></dt>
+ <dt><strong><a href="<?php echo htmlspecialchars($tb_stat['url']); ?>"><?php echo htmlspecialchars($tb_stat['author']); ?></a></strong></dt>
<dd><?php echo $tb_stat['postings']; ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_TOPTRACKBACK2; ?></dd>
<?php
}
@@ -423,7 +442,7 @@
<dd><?php echo round($length[0] / $publish_count[0], 2); ?> <?php echo PLUGIN_EVENT_STATISTICS_OUT_CHARS_PER_ARTICLE2; ?></dd>
<br />
- <dt><strong><?php printf(PLUGIN_EVENT_STATISTICS_OUT_LONGEST_ARTICLES, 5); ?></strong></dt>
+ <dt><strong><?php printf(PLUGIN_EVENT_STATISTICS_OUT_LONGEST_ARTICLES, $max_items); ?></strong></dt>
<br />
<dl>
<?php
|