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...

77

(1,382 replies, posted in General discussion)

grunge

Thx a bunch!
Hope he can solve it now wink

79

(1,382 replies, posted in General discussion)

spy-ware

Hmmm... I got another idea... why not make the RE: -thingy language dependent? So that it would be SV: in Swedish...
Wouldn't be that hard too I guess...

Hmmm... fixed it anawayz smile :
file: /message_send.php
line: 186

// Add subject
//$subject = "RE: " . $message['subject'];
//modified by Rasmus Anthin:
$subject = $message['subject'];
if(strncmp($subject, "RE: ", 4))
    $subject = "RE: " . $subject;

worx fine too. wink

Chacmool. It is a bit annoying that you eventually get so many RE: substrings in the subject-line when a message bounces back and forth as it usually does yikes). I think it would be better to have a piece of code that checks whether RE: has occured previously. Pseudocode could be something like:

if (strncmp($msg_subject[...], 'RE: ', 4))
   $msg_subject[...] = strcat('RE: ', $msg_subject[...]

however, I'm not sure where the adding of the 'RE: ' occurs (haven't checked it out yet).
But I'm sure such a mod of the mod would be pretty simple and straightforward. Even a checkbox in the admin-properties would be a simple thing to create for this, too.

Looking at the language-files I've located the corresponding english error-msg in en_common.php:

'Bad referer'            =>    'Bad HTTP_REFERER. You were referred to this page from an unauthorized source. Please go back 
and try again. If the problem persists please make sure that \'Base URL\' is correctly set in Admin/Options and 
that you are visiting the forum by navigating to that URL.',

Btw. Another admin in "my" forum has a problem with posting a poll. He gets:

Felaktig HTTP_REFERER. Du refererades till denna sida från en icke-auktoriserad källa. Var god försök igen. Om problemet kvarstår kontrollera så att 'Base URL' i Admin/Options är korrekt och att du besöker forumet genom att navigera till denna URL.

sorry for the suedish yikes)

Does this sound familiar?

Anawayz, I've been trying to make a dummy admin and even that didn't give me a err-msg like this. Funny thing..

I have told him that he might try to delete his cookie (so he can get a new and fresh one next time) since I've made a few mods on the forum so it could be that the cookie he has is obsolete. Other than that, I've run out of options...

Could someone please shed some light on this?

85

(13 replies, posted in Archive)

Jepp, har redan gjort en sån smurf-langpack för Total Commander en  gång i tiden. smile

Problemet är att det lätt uppstår många tvetydigheter. Vissa verb måste man bara låta bli att översätta. Typ: Radera inlägg, Redigera inlägg, ...

Sen är det lite svårt att vara enhetlig vid översättningen ;->

Man kanske skall göra en language-mode för alviska oxå (vad-det-nu-hette)? smile Vore ju perfekt för alla hängivna J.R.R. fans.

Det finns ju dessutom en del kul man kan inspireras av på Googles översättningssida.

86

(1,382 replies, posted in General discussion)

exposing

87

(13 replies, posted in Archive)

Jag satt o fördrev tiden lite med att göra ett språkpaket för smurfar (Smurfiska) smile
nu är det färdigt och kan provas

det var så jag upptäckte felen smile

88

(13 replies, posted in Archive)

I se_profile.php, rad 10 så står det:

angavna

!sic

Edit: förekommer även på fler rader i samma fil.
Edit: på rad 19: aktiveringsnyckeln ändring -> aktiveringsnyckeln för ändring.

89

(4 replies, posted in Archive)

Ja du har rätt smile
Men inte visste jag att det gick att ha HTML där. Intressant. Såg inte att det stod att man kunde göra så tongue

90

(1,382 replies, posted in General discussion)

unix

91

(98 replies, posted in PunBB 1.2 discussion)

Yep I did that! Seems all smilies that are put in front of the smile one are f***ed up. Hmmm..

// Here you can add additional smilies if you like (please note that you must escape singlequote and backslash)
$smiley_text = array('(:)', ':()', ']:)', '>:)', '>:(', '<:(', 'O:)', ':)', '=)', ':(', '=(', ':D', '=D', ';)', 
':x', ':X', ':rolleyes:', ':o)', ':O)', ':-o', ':-O', ';9', 'B)', ':p', ':P', ':/', ':lol:', ':|', ':heart:', 'x(', 
'X(', ':thup:', ':thdn:', ':alien:', '8p', '8P', ':*', ':_(', '&X', '|)'); 

$smiley_img = array('pig.gif', 'talkative.gif', 'evil.png', 'evil.png', 'mad.png', 'worried.gif', 'saint.png', 
'smile.png', 'smile.png', 'sad.png', 'sad.png', 'big_smile.png', 'big_smile.png', 'wink.png', 'shutup.png', 
'shutup.png', 'roll.png', 'cute.png', 'cute.png', 'shocked.png', 'shocked.png', 'slurp.png', 'cool.png', 'blah.png',
 'blah.png', 'doubtful.png', 'lol.png', 'serious.png', 'heart.gif', 'dead.png', 'dead.png', 'thup.gif', 'thdn.gif', 
'alien.gif', 'crazy.gif', 'crazy.gif', 'kisses.gif', 'sad.gif', 'skull.gif', 'tired.gif');
 

// Uncomment the next row if you add smilies that contain any of the characters &"'<>
$smiley_text = array_map('pun_htmlspecialchars', $smiley_text);

sorry for the linebreak.

------------------------------------
Well, I didn't like the original :x -smiley so i replaced it with a one that says something like "my lips are sealed". Thats the version I learned long long ago. For example see:
http://www.gojp.com/smilies/smilies.html

it is supposed to resemble a stitched-together mouth. Not very strange at all that you think it looks something scissor-like wink

92

(4 replies, posted in Archive)

lite OT, men ändå relaterat till detta:

Skulle man inte kunna fixa så att meddelandet man kan visa i Admin->Options stödjer BB-code (och att även administrationsmeddelandet?).
HTML känns lite sekundärt tycker jag.

93

(19 replies, posted in Archive)

Varför inte göra en mod?
Man skulle kunna göra nån slags enkel parsergenerator som matas med syntax-info. (låter kanske skumt, men det beror nog på att min hjärna har slutat jobbet för idag).
Iaf, vad jag tänkt mig är lite som emacs major-mode filer. Man kanske tillochmed kan utnyttja dem och se hur de är uppbyggda och göra nåt liknande?

bara lite brainstorming så att säga. yikes)

94

(1,382 replies, posted in General discussion)

gently crashed process

95

(4 replies, posted in Feature requests)

Well, I think Rickard's idea is really good IMHO.

96

(10 replies, posted in PunBB 1.2 bug reports)

P.S.
OT:
I've made a tongue -smiley based upon the punbb-standard smile -smiley wink

97

(25 replies, posted in Programming)

Maybe a message with a warning would be a good idea. Like "Are you really sure you wish to set the width to 8000? This will generally be too wide" or something similar, and then a confirm-button after that.

98

(1,382 replies, posted in General discussion)

kidney pie

I did some modifications myself, like replacing the redirect-command in language.php with the following:

 redirect('language.php', $lang_common['Language redirect']);

and then added the element

'Language redirect'     => 'Switching to your selected language...', 

into en_common.php and the like...

Another modification i did was to change the location of the Language-link in the menubar to the right of the search-link (by inserting the code for the language link under all different user-cases; Guest, User, Admin).

Thanx for a good mod mindplay and thanx for the help Smartys.