* @link http://www.pioder.pl/
* @license see LICENSE.txt
**/
if ( !defined('IN_uF') )
{
die('Hacking attempt');
}
class Topic
{
function LastPostInTopic($topic)
{
global $lng;
global $last_post;
global $forum_config;
global $userdata;
$id = $last_post[0];
$userid = $last_post[1];
$un = $last_post[4];
$rank = $last_post[3];
switch($rank)
{
case '0':
{
$user_color_name = $un;
break;
}
case '1':
{
$user_color_name = ''.$un.'';
break;
}
case '2':
{
$user_color_name = ''.$un.'';
break;
}
}
if ($_SESSION['uid']>0)
{
$limiter = $userdata['limit_tpid'];
}
else
{
$limiter = $forum_config['limit_tpid'];
}
$count = ceil($id / $limiter);
if ($count >1)
{
$page= '&page='.$count;
}
else
{
$page='';
}
return '
'.GenerateTime($last_post[2]).'
Post #'.$id.': '.$user_color_name.'
';
}
function LastPostImg()
{
global $last_post;
global $record;
global $default_skin;
$time = $_SERVER['REQUEST_TIME']-129600;
if ($_SESSION['uid']>0)
{
if ($last_post[2]>$time)
{
return 'folder_new_posts';
}
else
{
return 'folder_no_new_posts';
}
}
else
{
return 'folder_no_new_posts';
}
}
function TopicAuthor($uid)
{
global $record;
global $forum_config;
$rank = $record['rank'];
$nick = $record['nick'];
switch($rank)
{
case '0':
{
$user_color_name = $nick;
break;
}
case '1':
{
$user_color_name = ''.$nick.'';
break;
}
case '2':
{
$user_color_name = ''.$nick.'';
break;
}
}
return ''.$user_color_name.'';
}
function TopicInformation($tid, $mode)
{
$sql = "SELECT * FROM ".TOPICS_TABLE." WHERE t_id='$tid';";
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information');
$result = DataBase::fetch($query);
$result = $result[$mode];
return $result;
}
function PostInformation($pid, $mode)
{
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid';";
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information');
$result = DataBase::fetch($query);
$result = $result[$mode];
return $result;
}
function PostText($text,$postmoderate, $pid)
{
global $forum;
global $lng;
$text = stripslashes($text);
$text = Topic::TagsReplace($text);
if($forum['moderate']==1)
{
if ($postmoderate==1)
{
if ($_SESSION['uid']>0)
{
if (RANK>0)
{
return ''.$lng['moderated_post_text'].':
'.Topic::TagsReplace('[quote]'.$text.'[/quote]').'
'.$lng['visible_of_post'].'';
}
else
{
return ''.$lng['post_moderated'].'';
}
}
else
{
return ''.$lng['post_moderated'].'';
}
}
else
{
return $text;
}
}
else
{
return $text;
}
}
function UserName($nick, $rank)
{
global $forum_config;
switch($rank)
{
case '0':
{
return $nick;
break;
}
case '1':
{
return ''.$nick.'';
break;
}
case '2':
{
return ''.$nick.'';
break;
}
}
}
function TagsReplace($text)
{
global $lng;
//quote
$text = preg_replace("#\[quote\](.*?)\[/quote]#si", "", $text);
//code
$text = preg_replace("#\[code\](.*?)\[/code]#si", "", $text);
return $text;
}
}
?>