<?php
							 | 
						|
								/** 
							 | 
						|
								* @package	uForum 
							 | 
						|
								* @file		includes/classes/class_forum.php
							 | 
						|
								* @version	$Id: classes/class_forum.php 15 2009-05-01 17:06:40Z pioder $ 
							 | 
						|
								* @copyright	2009(c) PioDer <[email protected]>
							 | 
						|
								* @link 	http://pioder.gim2przemysl.int.pl/
							 | 
						|
								* @license	GNU GPL v3
							 | 
						|
								**/
							 | 
						|
								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 = @mysql_fetch_array($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 = mysql_fetch_array($query); 
							 | 
						|
								  		return $result['p_id'];
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									function LastPost($posts, $forum)
							 | 
						|
									{
							 | 
						|
										global $lng;
							 | 
						|
										global $user;
							 | 
						|
										global $last_post;
							 | 
						|
										global $userdata;
							 | 
						|
										global $forum_config;
							 | 
						|
								  		if ($posts==0) { return '<p align="center" class="fstandard">'.$lng['nopost'].'</p>';}
							 | 
						|
								  		else
							 | 
						|
								  		{
							 | 
						|
								   			$id = $last_post[$forum]['tp_id'];
							 | 
						|
								   			$topic = $last_post[$forum]['t_id'];
							 | 
						|
								   			$userid = $last_post[$forum]['u_id'];
							 | 
						|
								   			$un = $last_post[$forum]['user_nick'];
							 | 
						|
								  			$rank = $last_post[$forum]['user_rank'];
							 | 
						|
								  			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($last_post[$forum]['time']).'</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 $last_post;
							 | 
						|
										global $i;
							 | 
						|
										global $forum;
							 | 
						|
										global $default_skin;
							 | 
						|
										$time = time()-129600;
							 | 
						|
										if ($_SESSION['uid']>0)
							 | 
						|
										{
							 | 
						|
											if ($postsinforum>0)
							 | 
						|
											{
							 | 
						|
												if ($last_post[$forum[$i]['f_id']]['time']>$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 = mysql_fetch_array($query);
							 | 
						|
										$result = $result[$inf];
							 | 
						|
										return $result;
							 | 
						|
									}
							 | 
						|
								}
							 | 
						|
								?>
							 |