* @link http://www.pioder.pl/ * @license see LICENSE.txt **/ if ( !defined('IN_uF') ) { die('Hacking attempt'); } class Forum { function AddForums($tid) { global $forum_config; $forum = Topic::TopicInformation($tid,'f_id'); $all=''; $query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",GENERAL,'Could not obtain forum information'); while($t = DataBase::fetch($query)) { if ($t['f_id']==$forum) { $all .= ''."\n"; } else { $all .= ''."\n"; } } return $all; unset($t, $all); } function PostsInForum($forum_name) { $sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE." WHERE f_id='$forum_name'"; $query = DataBase::sql_query($sql,GENERAL,'Could not obtain posts information.'); $result = DataBase::fetch($query); return $result['p_id']; } function LastPost($posts, $forum) { global $lng; global $user; global $lastpost; global $userdata; global $forum_config; if ($posts==0) { return '

'.$lng['nopost'].'

';} else { $id = $lastpost[0]; $userid = $lastpost[1]; $topic = $lastpost[2]; $rank = $lastpost[4]; $un = $lastpost[5]; 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[3]).'
'.$lng['topic'].' #'.$topic.': '.$user_color_name.'

'; } } function LastPostImg($postsinforum) { global $lastpost; global $i; global $forum; global $default_skin; $time = $_SERVER['REQUEST_TIME']-129600; if ($_SESSION['uid']>0) { if ($postsinforum>0) { if ($lastpost[3]>$time) { return 'folder_new_posts'; } else { return 'folder_no_new_posts'; } } else { return 'folder_no_new_posts'; } } else { return 'folder_no_new_posts'; } } function ForumInformation($fid, $inf) { $sql = "SELECT `f_id`, `$inf` FROM ".FORUMS_TABLE." WHERE f_id='$fid';"; $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forum information.'); $result = DataBase::fetch($query); $result = $result[$inf]; return $result; } } ?>