* @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) ? 'x e' : ' '; $sb_content .= ''.$del_edit_msg.' ' .Topic::UserName($user[$sb_msg['u_id']]['nick'],$user[$sb_msg['u_id']]['rank']). ' ['.date('d-m, G:i',$sb_msg['time']).']: '.$sb_msg['msg_content'].''; } 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); } } ?>