A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.8 KiB

<?php
/**
* @package Dynamic Script Forum
* @file includes/class_shoutbox.php
* @version 1.0.x, 27-08-2007, 17:02
* @copyright 2008(c) PioDer <[email protected]>
* @link http://pioder.gim2przemysl.int.pl/dsf.html
* @license GNU GPL v3
**/
if ( !defined('IN_uF') )
{
die('Hacking attempt');
}
class ShoutBox
{
function new_message($message,$uid)
{
$time = time();
$sql = "INSERT INTO ".SHOUTBOX_TABLE." VALUES ('', '$uid', '$message','$time')";
DataBase::sql_query($sql,'GENERAL','Could not add shoutbox message.');
}
function read_messages($limit)
{
$sb_content = '';
$rank_mod = ($_SESSION['uid']>0) ? User::UserInformation($_SESSION['uid'],'rank') : 0;
global $user;
global $default_skin;
$sql = "SELECT * FROM ".SHOUTBOX_TABLE." ORDER BY `time` LIMIT $limit";
$query = DataBase::sql_query($sql,'CRITICAL', 'Could not read shoutbox table');
while($sb_msg = @mysql_fetch_array($query))
{
$del_edit_msg = ($rank_mod>0) ? '<a href="shoutbox.php?mode=
delete&amp;id='.$sb_msg.'" class="fsmall">x</a> <a href="
shoutbox.php?mode=edit&amp;id='.$sb_msg.'" class="fsmall">e</a>' : '&nbsp;';
$sb_content .= '<tr><td>'.$del_edit_msg.'<span class="fsmall">
<a href="user.php?id='.$b_msg['u_id'].'" class="fsmall">'
.Topic::UserName($user[$sb_msg['u_id']]['nick'],$user[$sb_msg['u_id']]['rank']).
'</a> <span class="fsmall">['.date('d-m, G:i',$sb_msg['time']).']:
'.$sb_msg['msg_content'].'</span></td></tr>';
}
return $sb_content;
}
function del_old_msgs($limiter)
{
$sql = "DELETE FROM ".SHOUTBOX_TABLE." WHERE `time`+$limiter<'".time()."'";
DataBase::sql_query($sql,'GENERAL','Could not delete old messages in shoutbox');
unset($sql);
}
}
?>