Added files - test
git-svn-id: https://svn.pioder.pl/uf-svn/uF@11 72ec579a-5ced-4fa4-82f3-afba5d98df2f
This commit is contained in:
79
includes/classes/class_pms.php
Normal file
79
includes/classes/class_pms.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/classes/class_pms.php
|
||||
* @version 1.0.x, 22-02-2007, 20:57
|
||||
* @copyright 2008(c) PioDer <pioder@wp.pl>
|
||||
* @link http://pioder.gim2przemysl.int.pl/dsf.html
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
193
includes/classes/secure.php
Normal file
193
includes/classes/secure.php
Normal file
@@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Dynamic Script Forum
|
||||
* @file includes/classes/secure.php
|
||||
* @version 1.0.x, 07-04-2008, 20:43
|
||||
* @copyright 2008(c) PioDer <pioder@wp.pl>
|
||||
* @link http://pioder.gim2przemysl.int.pl/dsf.html
|
||||
* @license GNU GPL v3
|
||||
**/
|
||||
if ( !defined('IN_uF') )
|
||||
{
|
||||
die('Hacking attempt');
|
||||
}
|
||||
class Secure
|
||||
{
|
||||
function forum_exists($fid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".FORUMS_TABLE." WHERE f_id='$fid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['f_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_forum'],'index.php');
|
||||
}
|
||||
}
|
||||
function UseCensorList($text)
|
||||
{
|
||||
global $forum_config;
|
||||
if ($forum_config['use_censorlist'])
|
||||
{
|
||||
$sql = "SELECT * FROM ".CENSORLIST_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain censorlist information.');
|
||||
while($word = mysql_fetch_array($query))
|
||||
{
|
||||
$text = str_replace($word['word'],'[censored]', $text);
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
function generate_code()
|
||||
{
|
||||
$number = array(
|
||||
1 => 1,
|
||||
2 => 2,
|
||||
3 => 4,
|
||||
4 => 6,
|
||||
5 => 10,
|
||||
6 => 20,
|
||||
7 => 30,
|
||||
8 => 40,
|
||||
9 => 50,
|
||||
10 => 60,
|
||||
11 => 70,
|
||||
12 => 80,
|
||||
13 => 90,
|
||||
14 => 100
|
||||
);
|
||||
$first_id = rand(1,14);
|
||||
$second_id = rand(1,14);
|
||||
$first_num = $number[$first_id];
|
||||
$second_num = $number[$second_id];
|
||||
return array($first_num, $second_num, ($first_num + $second_num));
|
||||
}
|
||||
|
||||
function message_u_exists($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['m_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_message'],'pms.php');
|
||||
}
|
||||
}
|
||||
function message_author_loged($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['u_n_id'];
|
||||
if ($result!=$_SESSION['uid'])
|
||||
{
|
||||
message_forum($lng['merror_1'],'index.php');
|
||||
}
|
||||
}
|
||||
function message_user_loged($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
if ($result!=$_SESSION['uid'])
|
||||
{
|
||||
message_forum($lng['merror_2'],'index.php');
|
||||
}
|
||||
}
|
||||
function message_a_exists($mid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = $result['m_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_message'],'index.php');
|
||||
}
|
||||
}
|
||||
function topic_exists($tid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['t_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_topic'],'index.php');
|
||||
}
|
||||
}
|
||||
function post_exists($pid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.');
|
||||
$result = mysql_fetch_array($query);
|
||||
$result = $result['p_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_post'],'pms.php');
|
||||
}
|
||||
}
|
||||
function user_exists($uid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
if (($result=='') or ($result=='-1'))
|
||||
{
|
||||
message_forum($lng['no_user'],'index.php');
|
||||
}
|
||||
}
|
||||
function group_exists($gid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `g_id` FROM `".GROUPS_TABLE."` WHERE g_id='$gid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain group information.'));
|
||||
$result = $result['g_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
message_forum($lng['no_group'],'groups.php');
|
||||
}
|
||||
}
|
||||
function TagsReplace($text)
|
||||
{
|
||||
$text = strip_tags($text,ALLOWED_TAGS);
|
||||
$text = str_replace('?>', '?>', $text);
|
||||
$text = str_replace('<?', '<?', $text);
|
||||
$text = str_replace('javascript:', '', $text);
|
||||
$text = Secure::UseCensorlist($text);
|
||||
$text = Post::SmilesReplace($text);
|
||||
return $text;
|
||||
}
|
||||
function TopicLocked($tid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `f_id`,`lock` FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain topic information'));
|
||||
$fid = $result['f_id'];
|
||||
$sql2 = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
|
||||
$result2 = mysql_fetch_array(DataBase::sql_query($sql2,'GENERAL','Could not obtain forum information'));
|
||||
if (($result['lock']=='1') or ($result2['lock']=='1'))
|
||||
{
|
||||
message_forum($lng['no_posting_topic_locked'],'topic.php?t='.$tid);
|
||||
}
|
||||
}
|
||||
function ForumLocked($fid)
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
|
||||
$result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
if ($result['lock']=='1')
|
||||
{
|
||||
message_forum($lng['no_posting_forum_locked'],'forum.php?f='.$fid);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user