<?php
|
|
/**
|
|
* @package uForum
|
|
* @file includes/pms/pms_view.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');
|
|
}
|
|
|
|
//smiles cache
|
|
$sql = "SELECT * FROM ".SMILES_TABLE."";
|
|
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain emoticons information.');
|
|
$i = 1;
|
|
while($result = DataBase::fetch($query))
|
|
{
|
|
$smile[$i]['smile'] = $result['smile'];
|
|
$smile[$i]['url'] = $result['url'];
|
|
$i +=1;
|
|
}
|
|
$mid = intval($_GET['id']);
|
|
if (!isset($_GET['submode']))
|
|
{
|
|
message_forum($lng['invalidmode'],'pms.php');
|
|
}
|
|
switch($_GET['submode'])
|
|
{
|
|
case 'author':
|
|
{
|
|
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
|
break;
|
|
}
|
|
case 'user':
|
|
{
|
|
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
message_forum($lng['invalidmode'],'pms.php');
|
|
break;
|
|
}
|
|
}
|
|
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain messages information');
|
|
$result = DataBase::fetch($query);
|
|
//if message exist....
|
|
if ($result['m_id']=='')
|
|
{
|
|
message_forum($lng['no_message'],'pms.php');
|
|
}
|
|
switch($_GET['submode'])
|
|
{
|
|
case 'user':
|
|
{
|
|
//if message user loged....
|
|
if ($result['u_id']!=$_SESSION['uid'])
|
|
{
|
|
message_forum($lng['merror_2'],'index.php');
|
|
}
|
|
break;
|
|
}
|
|
case 'author':
|
|
{
|
|
//if message author loged....
|
|
if ($result['u_n_id']!=$_SESSION['uid'])
|
|
{
|
|
message_forum($lng['merror_2'],'index.php');
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if ($_GET['submode']=='user')
|
|
{
|
|
DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", GENERAL, 'Could not update message.');
|
|
}
|
|
|
|
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'";
|
|
|
|
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information');
|
|
$user = DataBase::fetch($query);
|
|
|
|
$folder = ($_GET['submode']=='author') ? '<a href="pms.php?mode=folder&submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&submode=inbox" class="navigator">'.$lng['inbox'].'</a>';
|
|
|
|
//add skin variables
|
|
$skin = array(
|
|
'lang'=>DefaultLang(),
|
|
'lname'=>$lng['message'],
|
|
'u_id'=>$result['u_n_id'],
|
|
'username'=>Topic::UserName($user['nick'], $user['rank']),
|
|
'userrank'=>User::UserRank($user['rank']),
|
|
'delete'=>'<a href="javascript:confirm_action(\''.$lng['c_delete_pm'].'\',\'pms.php?mode=delete&user='.$_GET['submode'].'&m='.$mid.'\')"><img src="skins/'.$default_skin.'/images/delete_small.gif" alt="del"></a>',
|
|
'avatar'=>($user['avatar']!='') ? '<img src="'.$user['avatar'].'" alt="av">' : '<br><br><br><br>',
|
|
'msgtext'=>Topic::PostText($result['message'],0,0),
|
|
'sig'=> ($user['sig']!='') ? '<br>------------------------<br>'.$user['sig'] : '',
|
|
'posts'=>$user['posts'],
|
|
'regdate'=>date('d-m-Y',$user['regdate']),
|
|
'lastvisit'=>date('d-m-Y',$user['lastvisit']),
|
|
|
|
//labels
|
|
'lrank'=>$lng['lurank2'],
|
|
'llastvisit'=>$lng['lulastvisit'],
|
|
'lregdate'=>$lng['regdate2'],
|
|
'lposts'=>$lng['posts'],
|
|
'lno'=>$lng['no.'],
|
|
'lpinfo'=>$lng['postinfo']
|
|
);
|
|
|
|
$skin = array_push_assoc($skin,GenerateHeader($lng['show_message'].': '.$result['name'], .$folder.' »
|
|
<a href="pms.php?mode=view&submode='.$_GET['submode'].'&id='.
|
|
$result['m_id'].'" class="navigator">'.$lng['show_message']
|
|
.': '.$result['name']));
|
|
|
|
//do it!
|
|
require('./skins/'.$default_skin.'/overall_header.tpl');
|
|
require('./skins/'.$default_skin.'/msgs_msg_body.tpl');
|
|
if(RANK=='2')
|
|
{
|
|
$skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
|
|
}
|
|
else
|
|
{
|
|
$skin['pa_link']='';
|
|
}
|
|
$stop = TimeGeneration();
|
|
$skin['queries'] = ShowQueries($start, $stop);
|
|
require('./skins/'.$default_skin.'/overall_footer.tpl');
|
|
break;
|
|
|
|
?>
|