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.
 
 
 
 
 
 

79 lines
2.0 KiB

<?php
/**
* @package uForum
* @file includes/classes/class_pms.php
* @version $Id$
* @copyright 2009(c) PioDer <[email protected]>
* @link http://pioder.gim2przemysl.int.pl/
* @license GNU GPL v3
**/
if ( !defined('IN_uF') )
{
die('Hacking attempt');
}
class Pms
{
function UserName($uid)
{
global $user;
global $forum_config;
$nick = $user[$uid]['nick'];
$rank = $user[$uid]['rank'];
switch($rank)
{
case '0':
{
return $nick;
break;
}
case '1':
{
return '<font color="'.$forum_config['color_mod'].'"><b>'.$nick.'</b></font>';
break;
}
case '2':
{
return '<font color="'.$forum_config['color_admin'].'"><b>'.$nick.'</b></font>';
break;
}
}
}
function SendMessage($text, $name, $nick)
{
//general variables
$u_n_id = $_SESSION['uid'];
$uid = User::UserIdByNick($nick);
//For work!
NewMessage::AddToInbox($text, $name, $u_n_id, $uid);
NewMessage::AddToSentbox($text, $name, $u_n_id, $uid);
}
function DeleteMsgUser($mid)
{
$sql = "DELETE FROM `".PM_INBOX_TABLE."` WHERE `m_id`='$mid'";
DataBase::sql_query($sql,GENERAL,'Could not delete message in inbox');
}
function DeleteMsgAuthor($mid)
{
$sql = "DELETE FROM `".PM_SENTBOX_TABLE."` WHERE `m_id`='$mid'";
DataBase::sql_query($sql,GENERAL,'Could not delete message in sentbox');
}
}
class NewMessage
{
function AddToInbox($text, $name, $unid, $uid)
{
$last = DataBase::new_id(PM_INBOX_TABLE);
$time = time();
$sql = "INSERT INTO `".PM_INBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid','0')";
DataBase::sql_query($sql,GENERAL,'Could not add new message at inbox');
}
function AddToSentbox($text, $name, $unid, $uid)
{
$last=DataBase::new_id(PM_SENTBOX_TABLE);
$time = time();
$sql = "INSERT INTO `".PM_SENTBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid')";
DataBase::sql_query($sql,GENERAL,'Could not add new message at inbox');
}
}
?>