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.
 
 
 
 
 
 

73 lines
2.3 KiB

<?php
/**
* @package uForum
* @file shoutbox.php
* @version $Id$
* @copyright 2007-2010 (c) PioDer <[email protected]>
* @link http://www.pioder.pl/
* @license see LICENSE.txt
**/
if (!defined('IN_uF'))
{
die('Hacking attempt');
}
if (isset($_GET['mode']))
{
switch($_GET['mode'])
{
case 'shoutbox_add':
{
if (isset($_POST['shoutbox_message']))
{
$content = strip_tags($_POST['shoutbox_message']);
$content = Post::SmilesReplace($content);
if ((strlen($content)>3) and (strlen($content)<300))
{
$sql = "DELETE FROM ".SHOUTBOX_TABLE." WHERE `mtime`<'".($_SERVER['REQUEST_TIME']-$forum_config['shoutbox_max_time'])."'";
DataBase::sql_query($sql,GENERAL,'Could not delete old messages');
$sql = "INSERT INTO ".SHOUTBOX_TABLE." VALUES('','".$_SESSION['uid']."','".$content."','".$_SERVER['REQUEST_TIME']."')";
DataBase::sql_query($sql,GENERAL,'Could not add shoutbox message');
}
}
echo '<meta http-equiv="refresh" content="0; url=index.php">';
break;
}
case 'shoutbox_delete':
{
if (isset($_GET['id']) && (RANK>0))
{
DataBase::sql_query("DELETE FROM ".SHOUTBOX_TABLE." WHERE `m_id`='".intval($_GET['id'])."'",GENERAL,'Could not delete shoutbox message');
}
break;
}
case 'shoutbox_desc':
{
$desc = '';
break;
}
}
}
if(!isset($desc))
{
$desc = 'DESC';
}
else
{
$desc = '';
}
$shoutbox_content = '';
$sql = "SELECT ".SHOUTBOX_TABLE.".*, ".USERS_TABLE.".* FROM ".SHOUTBOX_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SHOUTBOX_TABLE.".u_id = ".USERS_TABLE.".u_id ORDER BY `mtime` $desc LIMIT ".$forum_config['shoutbox_max'];
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain shoutbox information');
while($sb_msg = DataBase::fetch($query))
{
$allow_del = (RANK>0) ? '<a href="index.php?mode=shoutbox_delete&amp;id='.$sb_msg['m_id'].'" class="fsmall">X</a><span class="small">&nbsp;</span>' : '';
$shoutbox_content .= '
<tr>
<td class="fitem" height="7">
'.$allow_del.'<a href="user.php?id='.$sb_msg['u_id'].'" class="fsmall">'.Topic::UserName($sb_msg['nick'], $sb_msg['rank']).'</a><span class="fsmall"><b> ['.GenerateTime($sb_msg['mtime']).']</b>: '.$sb_msg['message'].'</span>
</td>
</tr>';
}
require('./skins/'.$default_skin.'/shoutbox_body.tpl');
?>