- <?php
- /**
- * @package uForum
- * @file includes/classes/class_pms.php
- * @version $Id$
- * @copyright 2009(c) PioDer <pioder@wp.pl>
- * @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');
- }
- }
- ?>
|