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.

67 lines
1.5 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file includes/cache/cache_forums.php
  5. * @version $Id$
  6. * @copyright 2009(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/
  8. * @license GNU GPL v3
  9. **/
  10. if(!defined('IN_uF'))
  11. {
  12. die('Hacking attempt');
  13. }
  14. //cache forums and posts - version v1.0 Alpha 2---------------------------------
  15. $default_skin = ViewSkinName();
  16. $sql = "SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1";
  17. $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information'));
  18. if ($result['name']=='')
  19. {
  20. message_forum($lng['no_forum'],'index.php');
  21. }
  22. $forum = array(
  23. 'name'=>$result['name'],
  24. 'lock'=>$result['lock']
  25. );
  26. //
  27. //generate output pages
  28. //
  29. if ($_SESSION['uid']>0)
  30. {
  31. $limiter = $userdata['limit_ftid'];
  32. }
  33. else
  34. {
  35. $limiter = $forum_config['limit_ftid'];
  36. }
  37. if (isset($_GET['page'])&&($_GET['page']!=1))
  38. {
  39. if (!is_numeric($_GET['page']))
  40. {
  41. die('Hacking attempt');
  42. }
  43. $value = ($_GET['page']-1)*$limiter;
  44. $limit = 'LIMIT '.$value . ', '.$limiter;
  45. $page = $_GET['page'];
  46. }
  47. else
  48. {
  49. $limit = 'LIMIT 0, '.$limiter;
  50. $page=1;
  51. }
  52. $count = DataBase::fetch(DataBase::sql_query("SELECT COUNT(`t_id`) as `t_id`
  53. FROM ".TOPICS_TABLE." WHERE `f_id`='$fid'",GENERAL,'Could not obtain count amout of topics'));
  54. $count = $count['t_id'];
  55. $count = ceil($count / $limiter);
  56. if ($count==0)
  57. {
  58. $count +=1;
  59. }
  60. if(isset($_GET['page']) && ($_GET['page']>$count))
  61. {
  62. message_forum($lng['invalidpage'],'index.php');
  63. }
  64. //
  65. //end generating pages
  66. //
  67. ?>