|
<?php
|
|
/**
|
|
* @package uForum
|
|
* @file includes/cache/cache_index.php
|
|
* @version $Id$
|
|
* @copyright 2009(c) PioDer <[email protected]>
|
|
* @link http://pioder.gim2przemysl.int.pl/
|
|
* @license GNU GPL v3
|
|
**/
|
|
if(!defined('IN_uF'))
|
|
{
|
|
die('Hacking attempt');
|
|
}
|
|
//
|
|
//cache forums and posts - version v1.0 Alpha 2---------------------------------
|
|
//
|
|
//lastpost in forum cache
|
|
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id GROUP BY `f_id`, `ptime` ORDER BY `ptime`";
|
|
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain last post in topic', true);
|
|
$post_count = @mysql_num_rows($query);
|
|
while($result = @mysql_fetch_array($query))
|
|
{
|
|
$last_post[$result['f_id']]['tp_id'] = $result['tp_id'];
|
|
$last_post[$result['f_id']]['u_id'] = $result['u_id'];
|
|
$last_post[$result['f_id']]['t_id'] = $result['t_id'];
|
|
$last_post[$result['f_id']]['time'] = $result['ptime'];
|
|
$last_post[$result['f_id']]['user_rank'] = $result['rank'];
|
|
$last_post[$result['f_id']]['user_nick'] = $result['nick'];
|
|
}
|
|
//cache forums --don't modify!!!
|
|
$cache_id=1;
|
|
$sql = "SELECT ".FORUMS_TABLE.".*, COUNT(".POSTS_TABLE.".p_id) as amout, ".POSTS_TABLE.".f_id AS count FROM ".FORUMS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".FORUMS_TABLE.".f_id= ".POSTS_TABLE.".f_id GROUP BY `f_id` ORDER BY `c_id`, `sort`";
|
|
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
|
|
while($result = @mysql_fetch_array($query))
|
|
{
|
|
$forum[$cache_id]['f_id'] = $result['f_id'];
|
|
$forum[$cache_id]['name'] = $result['name'];
|
|
$forum[$cache_id]['desc'] = $result['desc'];
|
|
$forum[$cache_id]['c_id'] = $result['c_id'];
|
|
$forum[$cache_id]['sort'] = $result['sort'];
|
|
$count_forum[$result['f_id']] = $result['amout'];
|
|
$cache_id+=1;
|
|
}
|
|
$sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC";
|
|
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information');
|
|
$lastuser = @mysql_fetch_array($query);
|
|
$count_users = @mysql_num_rows($query) -1;
|
|
?>
|