Doc:
##
##
## Mod title: Activity Barometer
##
## Mod version: 1.0.1
## Works on PunBB: ?, 1.1.4
## Release date: 2004-06-25
## Author: B. Rasmus (Scratty) Anthin.
##
## Description: Shows the "flux" of posts per hour
## or number of posts during a day or a week.
##
## Affected files: index.php
## <lang>_index.php
##
## Affects DB: No
##
## Comments: Skip parts 8-11 if you don't have the swedish language-
## mode
##
## DISCLAIMER: Please note that "mods" are not officially supported by
## PunBB. Installation of this modification is done at your
## own risk. Backup your forum database and any and all
## applicable files before proceeding.
##
##
#
#---------[ 1. OPEN ]----------------------------------------------------------
#
index.php
#
#---------[ 2. FIND (line: 187) ]----------------------------------------------
#
echo "\t\t\t\t\t\t".'<br>'.$lang_index['Currently serving'].' '.$num_users.' '.(($num_users <> 1) ? $lang_index['registered users'] : $lang_index['registered user']).' '.$lang_index['and'].' '.$num_guests.' '.(($num_guests <> 1) ? $lang_index['guests'] : $lang_index['guest']).'.';
#
#---------[ 3. AFTER ADD ]-----------------------------------------------------
#
// Activity Barometer mod
$result = $db->query("SELECT COUNT(*) FROM ".$db->prefix."posts WHERE posted > ".(time()-7*24*3600)) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
$posts_week = $db->result($result);
$result = $db->query("SELECT COUNT(*) FROM ".$db->prefix."posts WHERE posted > ".(time()-24*3600)) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());
$posts_day = $db->result($result);
$posts_h = $posts_day/24;
if ($posts_h<1)
if ($posts_day<1)
echo "<BR>".$lang_index['total']." $posts_week ".$lang_index['number week'].".";
else
echo "<BR>".$lang_index['total']." $posts_day ".$lang_index['number day'].".";
else
echo "<BR>".$lang_index['average']." ".number_format($posts_h,1)." ".$lang_index['number h'].".";
#
#---------[ 4. OPEN ]----------------------------------------------------------
#
en_index.php
#
#---------[ 5. FIND (line: 27) ]-----------------------------------------------
#
'guests' => 'guests' // plural
#
#---------[ 6. ALTER ]---------------------------------------------------------
#
'guests' => 'guests', // plural
#
#---------[ 7. AFTER ADD ]-----------------------------------------------------
#
// Activity Barometer mod
'total' => 'In total',
'number week' => 'number of posts during this week',
'number day' => 'number of posts during this day',
'average' => 'On average',
'number h' => 'posts per hour'
#
#---------[ 8. OPEN ]----------------------------------------------------------
#
se_index.php
#
#---------[ 9. FIND (line: 27) ]-----------------------------------------------
#
'guests' => 'gäster' // plural
#
#---------[ 10. ALTER ]--------------------------------------------------------
#
'guests' => 'gäster', // plural
#
#---------[ 11. AFTER ADD ]----------------------------------------------------
#
// Activity Barometer mod
'total' => 'Totalt',
'number week' => 'antal inlägg under senaste veckan',
'number day' => 'antal inlägg under senaste dygnet',
'average' => 'I snitt',
'number h' => 'inlägg per timme'
#
#---------[ 12. SAVE/UPLOAD ]--------------------------------------------------
#
/******************************************************/
Hey. Just got an idea... why not make an activity barometer, ie sort of a flux-meter of posts that makes a moving average over a week and normalizes over a day (or hour if there's a lot of visitors). Sort of:
[cite]
flux = sum(posts(t), t=t0-7...t0) / 7 [posts/day]
[/cite]
or
[cite]
flux = sum(posts(t), t=t0-7*24...t0) / (7*24) [posts/h]
[/cite]
with autoranging (I guess it won't be that hard to implement such a feature, just a if-else structure)
and it could be implemented with a graphical "thermometer" in the footer of the forum-page or somewhere discrete. Any thoughts on this?
Edit: Since PunRes.org forum is down, I don't know where else to post this. Sorry if I placed this is in the wrong forum.
Edit: Added install instructions at the top...