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
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.3 extensions → [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
Garciat thank you very much for this long awaited release!!
I'm looking forward to use it too!
installed and working on my site.
added to directory.
thx!
thanks alot garcia, you are the best here.
Thank you for this extension, Garciat.
I'm late
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
Cheers
You may use the same extension id to add your changes (same SVN folder), if you want. I don't mind.
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.
yes that happens to me too.
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 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!
mmm, where do i replace that
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.
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>
^ Exactly. I should have just posted mine xD
great thanks alot all of you good people
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
useforum_htmlencodefor escape username
$online_today[] = '<a href="'.forum_link($forum_url['user'], $ot_id).'">'.forum_htmlencode($ot_username).'</a>';
to remove XSS vulnerability
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
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>
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.
thanks slickplaid and others
I'm late
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 botho show users online from last midnight/monday
o show users online last 24 hours/7 daysI will need last week one for one of my forums, so anyway I'll do this in future
Cheers
FINALLY I did my one
It's working fine with all timezones. I was debugging it with many possible scenarios.
http://punbb.informer.com/forums/topic/ … line-list/
PunBB Forums → PunBB 1.3 extensions → [Release] Online Today
Powered by PunBB, supported by Informer Technologies, Inc.