* @link http://pioder.gim2przemysl.int.pl/ * @license GNU GPL v3 **/ if ( !defined('IN_uF') ) { die('Hacking attempt'); } class Topic { function LastPostInTopic($topic) { global $lng; global $lastpost; global $forum_config; global $userdata; $id = $lastpost[$topic]['tp_id']; $userid = $lastpost[$topic]['u_id']; $un = $lastpost[$topic]['user_nick']; $rank = $lastpost[$topic]['user_rank']; 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($lastpost[$topic]['time']).'
Post #'.$id.': '.$user_color_name.'

'; } function LastPostImg() { global $lastpost; global $record; global $default_skin; $time = time()-129600; if ($_SESSION['uid']>0) { if ($lastpost[$record['t_id']]['time']>$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", "
".$lng['quote2'].":
\\1
", $text); //code $text = preg_replace("#\[code\](.*?)\[/code]#si", "
Code:
\\1
", $text); return $text; } } ?>