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.
 
 
 
 
 
 

121 lines
3.5 KiB

<?php
//smiles cache
$sql = "SELECT * FROM ".SMILES_TABLE."";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.');
$i = 1;
while($result = mysql_fetch_array($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 = mysql_fetch_array($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 = @mysql_fetch_array($query);
$folder = ($_GET['submode']=='author') ? '<a href="pms.php?mode=folder&amp;submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&amp;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&amp;user='.$_GET['submode'].'&amp;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_associative($skin,GenerateHeader($lng['show_message'].': '.$result['name'], '</a> &gt; '.$folder.' &gt;
<a href="pms.php?mode=view&amp;submode='.$_GET['submode'].'&amp;id='.
$result['m_id'].'" class="navigator">'.$lng['show_message']
.': '.$result['name']));
//do it!
include('./skins/'.$default_skin.'/overall_header.tpl');
include('./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);
include('./skins/'.$default_skin.'/overall_footer.tpl');
break;
?>