Topic: [Release] Online Today

Shows today's online users on the forum index.

Download Link: http://punbb.informer.com/unofficial/pu … _today.zip

If you find any bugs or have any tips, please post them here.

Updates

  • 1.0.0: First release

Re: [Release] Online Today

Garciat thank you very much for this long awaited release!!

I'm looking forward to use it too!

3 (edited by KeyDog 2009-02-02 22:37)

Re: [Release] Online Today

installed and working on my site.
added to directory.

thx!

http://keydogbb.info/img/onlinetoday.jpg

Re: [Release] Online Today

thanks alot garcia, you are the best here.

MyFootballCafe.com  is Now Online!

Re: [Release] Online Today

Thank you for this extension, Garciat.

Re: [Release] Online Today

I'm late tongue

Garciat - maybe you will add those options which I was planning to make in my version of "online today":

(radio)
o display users online today
o display users online this week
o display both


o show users online from last midnight/monday
o show users online last 24 hours/7 days


I will need last week one for one of my forums, so anyway I'll do this in future wink
Cheers

YonasH's repository + Extensions Directory = PunBB Extensions Online Library (in progress....)

Away. I will be back soon.

Re: [Release] Online Today

You may use the same extension id to add your changes (same SVN folder), if you want. I don't mind.

Re: [Release] Online Today

For some strange reason I don't see the online today list after installing the plugin. It seems like it will randomly shows up and then sometimes it doesn't show at all.

Re: [Release] Online Today

yes that happens to me too.

MyFootballCafe.com  is Now Online!

Re: [Release] Online Today

It seems like it will randomly shows up and then sometimes it doesn't show at all.

Garciat,

$todays_users_diff = ($forum_user['timezone'] + ($forum_user['dst']-1)) * 3600;
$todays_users_now = time();

$query = array(
    'SELECT'    =>    'id, username',
    'FROM'        =>    'users',
    'WHERE'    =>    'last_visit>"'.strtotime(gmdate('M d Y', $todays_users_now + $todays_users_diff)).'" and group_id>0',
    'ORDER BY'    =>    'username'
);

Re: [Release] Online Today

allineer wrote:

It seems like it will randomly shows up and then sometimes it doesn't show at all.

Garciat,

$todays_users_diff = ($forum_user['timezone'] + ($forum_user['dst']-1)) * 3600;
$todays_users_now = time();

$query = array(
    'SELECT'    =>    'id, username',
    'FROM'        =>    'users',
    'WHERE'    =>    'last_visit>"'.strtotime(gmdate('M d Y', $todays_users_now + $todays_users_diff)).'" and group_id>0',
    'ORDER BY'    =>    'username'
);

It works great! Thanks!

Re: [Release] Online Today

mmm, where do i replace that

MyFootballCafe.com  is Now Online!

Re: [Release] Online Today

SuperMAG wrote:

mmm, where do i replace that

manifest.xml -- under line 51 (past where it says include). Replace the $online_query_today = array(); stuff with this:

$todays_users_diff = ($forum_user['timezone'] + ($forum_user['dst']-1)) * 3600;
$todays_users_now = time();

$query = array(
    'SELECT'    =>    'id, username',
    'FROM'        =>    'users',
    'WHERE'    =>    'last_visit>"'.strtotime(gmdate('M d Y', $todays_users_now + $todays_users_diff)).'" and group_id>0',
    'ORDER BY'    =>    'username'
);

Rename $query to $online_today_query and your done. Reinstall the plugin and it should work perfect.

Re: [Release] Online Today

ok thanks, just to be safe. here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/*
    Copyright (C) 2008 Garciat (Gabriel Garcia T.) <http://garciat.org/>
    Released under GPL license version 3 or any later version <http://www.gnu.org/licenses/gpl.html>
    
    This extension is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This extension is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this extension.  If not, see <http://www.gnu.org/licenses/>.
*/
-->

<extension engine="1.0">
    <id>online_today</id>
    <title>Online Today</title>
    <version>1.0.0</version>
    <description>Shows today's online users on the forum index.</description>
    <author>Garciat</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.3.2</maxtestedon>
    
    <install>
        <![CDATA[

        ]]>
    </install>
    
    <uninstall>
        <![CDATA[

        ]]>
    </uninstall>
    
    <hooks>
        <hook id="in_new_online_data">
            <![CDATA[
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';

$todays_users_diff = ($forum_user['timezone'] + ($forum_user['dst']-1)) * 3600;
$todays_users_now = time();

$online_today_query = array(
    'SELECT'    =>    'id, username',
    'FROM'        =>    'users',
    'WHERE'    =>    'last_visit>"'.strtotime(gmdate('M d Y', $todays_users_now + $todays_users_diff)).'" and group_id>0',
    'ORDER BY'    =>    'username'
);

$online_today_result = $forum_db->query_build($online_today_query);

$online_today = array();
while(list($ot_id, $ot_username) = $forum_db->fetch_row($online_today_result))
    $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.$ot_username.'</a>';

if(!empty($online_today))
    echo '<h3 class="hn"><span>'.$lang_online_today['Online today'].': '.implode(', ', $online_today).'</span></h3>';
            ]]>
        </hook>
    </hooks>
</extension>
MyFootballCafe.com  is Now Online!

Re: [Release] Online Today

^ Exactly. I should have just posted mine xD

Re: [Release] Online Today

great thanks alot all of you good people

MyFootballCafe.com  is Now Online!

17

Re: [Release] Online Today

use forum_htmlencode for escape username:

$online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

to remove XSS vulnerability

Re: [Release] Online Today

hcs wrote:

useforum_htmlencodefor escape username

$online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

to remove XSS vulnerability

hcs wrote:

useforum_htmlencodefor escape username

$online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

to remove XSS vulnerability

what to replace

MyFootballCafe.com  is Now Online!

Re: [Release] Online Today

I think he's means you need to replace that with what's on line 67.

Before:

    $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.$ot_username.'</a>';

After:

   $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

Here's the whole thing:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/*
    Copyright (C) 2008 Garciat (Gabriel Garcia T.) <http://garciat.org/>
    Released under GPL license version 3 or any later version <http://www.gnu.org/licenses/gpl.html>
    
    This extension is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This extension is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this extension.  If not, see <http://www.gnu.org/licenses/>.
*/
-->

<extension engine="1.0">
    <id>online_today</id>
    <title>Online Today</title>
    <version>1.0.0</version>
    <description>Shows today's online users on the forum index.</description>
    <author>Garciat</author>
    <minversion>1.3</minversion>
    <maxtestedon>1.3.2</maxtestedon>
    
    <install>
        <![CDATA[

        ]]>
    </install>
    
    <uninstall>
        <![CDATA[

        ]]>
    </uninstall>
    
    <hooks>
        <hook id="in_new_online_data">
            <![CDATA[
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
else
    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';

$todays_users_diff = ($forum_user['timezone'] + ($forum_user['dst']-1)) * 3600;
$todays_users_now = time();

$online_today_query = array(
    'SELECT'    =>    'id, username',
    'FROM'        =>    'users',
    'WHERE'    =>    'last_visit>"'.strtotime(gmdate('M d Y', $todays_users_now + $todays_users_diff)).'" and group_id>0',
    'ORDER BY'    =>    'username'
);

$online_today_result = $forum_db->query_build($online_today_query);

$online_today = array();
while(list($ot_id, $ot_username) = $forum_db->fetch_row($online_today_result))
    $online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';

if(!empty($online_today))
    echo '<h3 class="hn"><span>'.$lang_online_today['Online today'].': '.implode(', ', $online_today).'</span></h3>';
            ]]>
        </hook>
    </hooks>
</extension>

20 (edited by slickplaid 2009-02-07 10:10)

Re: [Release] Online Today

I am still having the extension disappear. It's 4am CST and it's currently MIA.

Edit: Even after the timezone and XSS vulnerability fix.

Re: [Release] Online Today

Thanks Garciat, it propably works fine for me wink.

Re: [Release] Online Today

thanks slickplaid and others

MyFootballCafe.com  is Now Online!

23

Re: [Release] Online Today

YonasH wrote:

I'm late tongue

Garciat - maybe you will add those options which I was planning to make in my version of "online today"

(radio)
o display users online today
o display users online this week
o display both

o show users online from last midnight/monday
o show users online last 24 hours/7 days

I will need last week one for one of my forums, so anyway I'll do this in future wink
Cheers


FINALLY I did my one smile
It's working fine with all timezones. I was debugging it with many possible scenarios.
http://punbb.informer.com/forums/topic/ … line-list/

YonasH's repository + Extensions Directory = PunBB Extensions Online Library (in progress....)

Away. I will be back soon.