A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
2.1 KiB

  1. <?php
  2. /**
  3. * @package Dynamic Script Forum
  4. * @file includes/cache/cache_index.php
  5. * @version 1.0.x, 10-04-2007, 17:04
  6. * @copyright 2008(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/dsf.html
  8. * @license GNU GPL v3
  9. **/
  10. if(!defined('IN_uF'))
  11. {
  12. die('Hacking attempt');
  13. }
  14. //
  15. //cache forums and posts - version v1.0 Alpha 2---------------------------------
  16. //
  17. //lastpost in forum cache
  18. $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`";
  19. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain last post in topic', true);
  20. $post_count = @mysql_num_rows($query);
  21. while($result = @mysql_fetch_array($query))
  22. {
  23. $last_post[$result['f_id']]['tp_id'] = $result['tp_id'];
  24. $last_post[$result['f_id']]['u_id'] = $result['u_id'];
  25. $last_post[$result['f_id']]['t_id'] = $result['t_id'];
  26. $last_post[$result['f_id']]['time'] = $result['ptime'];
  27. $last_post[$result['f_id']]['user_rank'] = $result['rank'];
  28. $last_post[$result['f_id']]['user_nick'] = $result['nick'];
  29. }
  30. //cache forums --don't modify!!!
  31. $cache_id=1;
  32. $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`";
  33. $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
  34. while($result = @mysql_fetch_array($query))
  35. {
  36. $forum[$cache_id]['f_id'] = $result['f_id'];
  37. $forum[$cache_id]['name'] = $result['name'];
  38. $forum[$cache_id]['desc'] = $result['desc'];
  39. $forum[$cache_id]['c_id'] = $result['c_id'];
  40. $forum[$cache_id]['sort'] = $result['sort'];
  41. $count_forum[$result['f_id']] = $result['amout'];
  42. $cache_id+=1;
  43. }
  44. $sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC";
  45. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information');
  46. $lastuser = @mysql_fetch_array($query);
  47. $count_users = @mysql_num_rows($query) -1;
  48. ?>