<?php
							 | 
						|
								/** 
							 | 
						|
								* @package	uForum 
							 | 
						|
								* @file		includes/classes/class_forum.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');
							 | 
						|
								}
							 | 
						|
								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 .=	'<option value="'.$t['f_id'].'" selected="selected">'.$t['name'].'</option>'."\n";
							 | 
						|
											}
							 | 
						|
											else
							 | 
						|
											{
							 | 
						|
												$all .=	'<option value="'.$t['f_id'].'">'.$t['name'].'</option>'."\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 '<p align="center" class="fstandard">'.$lng['nopost'].'</p>';}
							 | 
						|
								  		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 = '<font color="'.$forum_config['color_mod'].'"><b>'.$un.'</b></font>';
							 | 
						|
													break;
							 | 
						|
												}
							 | 
						|
												case '2':
							 | 
						|
												{
							 | 
						|
													$user_color_name = '<font color="'.$forum_config['color_admin'].'"><b>'.$un.'</b></font>';
							 | 
						|
													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 '<p align="center"><span class="fverysmall"><b>'.GenerateTime($lastpost[3]).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>'.$lng['topic'].' #'.$topic.'</b></a><a class="fsmall">: </a><a href="user.php?id='.$userid.'" class="fverysmall">'.$user_color_name.'</a></p>';
							 | 
						|
								 		}
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									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;
							 | 
						|
									}
							 | 
						|
								}
							 | 
						|
								?>
							 |