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.
 
 
 
 
 
 

118 lines
3.2 KiB

<?php
/**
* @package uForum
* @file includes/pms/pms_write.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');
}
$msg ='';
if ((isset($_POST['textedit'])) and (isset($_POST['nmsg'])) and (isset($_POST['username'])))
{
if (($_POST['textedit'] != '') and ($_POST['nmsg']!='') and ($_POST['username']!='') and (strlen($_POST['textedit'])>10) and (strlen($_POST['nmsg'])>5))
{
$nick = strip_tags($_POST['username']);
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
$result = DataBase::fetch(DataBase::sql_query($sql, CRITICAL,'Could not obtain user information.'));
if ($result['u_id']!='')
{
$cntu = Pms::PMCnt($result['u_id']);
if ($cntu[0] < $forum_config['pm_inbox_max'])
{
//antiflood lock
if (isset($_COOKIE['antiflood_time']))
{
if ($_COOKIE['antiflood_time']>$_SERVER['REQUEST_TIME'])
{
message_forum($lng['antiflood_enabled'],$_SERVER['REQUEST_URI']);
}
}
else
{
setcookie('antiflood_time',($_SERVER['REQUEST_TIME'] + $forum_config['time_antiflood']));
$_POST['textedit'] = Secure::TagsReplace($_POST['textedit']);
$_POST['nmsg'] = strip_tags($_POST['nmsg']);
Pms::SendMessage($_POST['textedit'],$_POST['nmsg'], $_POST['username']);
message_forum($lng['post_is_saved'],'pms.php');
}
}
else
{
$message = $lng['pm_inbox_full'];
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
}
}
else
{
$message = $lng['no_user'];
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
}
}
else
{
$message = $lng['perror_1'];
$msg = './skins/'.$default_skin.'/post_error_body.tpl';
}
}
else
{
if (isset($_GET['id']))
{
Secure::user_exists(intval($_GET['id']));
$_POST['username'] = User::UserInformation(intval($_GET['id']), 'nick');
}
else
{
$_POST['username'] = '';
}
$_POST['nmsg']='';
$_POST['textedit']='';
}
$cnt = Pms::PMCnt();
//add skin variables
$skin = array(
'smiles'=>Post::SmilesShow(),
//labels
'luser'=>$lng['user'],
'lsmiles'=>$lng['smiles'],
'lmsgname'=>$lng['msgname'],
'lmsg'=>$lng['message'],
'lsave'=>$lng['save'],
'lreset'=>$lng['reset'],
'lwritemsg'=>$lng['write_pm'],
'action'=>$_SERVER['REQUEST_URI'],
'lsentbox_full'=>($cnt[1]==$forum_config['pm_sentbox_max']) ? $lng['pm_sentbox_full'] : ''
);
$skin = array_push_assoc($skin, GenerateHeader($lng['lpm'].': '.$lng['write_pm'], '<a href="pms.php" class="navigator">'.$lng['lpm'].' &raquo; <a href="'.$_SERVER['REQUEST_URI'].'" class="navigator">'.$lng['write_pm']));
if ($msg=='')
{
$msg='./skins/'.$default_skin.'/blank.tpl';
}
//do it!
require('./skins/'.$default_skin.'/overall_header.tpl');
require('./skins/'.$default_skin.'/pms_new_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');
?>