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.

111 lines
3.3 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file includes/pms/pms_folder.php
  5. * @version $Id$
  6. * @copyright 2007-2010 (c) PioDer <pioder@wp.pl>
  7. * @link http://www.pioder.pl/
  8. * @license see LICENSE.txt
  9. **/
  10. if ( !defined('IN_uF') )
  11. {
  12. die('Hacking attempt');
  13. }
  14. //
  15. //private messsages cache - v1.0 Alpha 2
  16. //
  17. $cnt = Pms::PMCnt(); // 0 - inbox; 1 - sentbox
  18. $sql = "SELECT `u_id`,`nick`,`rank` FROM `".USERS_TABLE."`";
  19. $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forums information');
  20. $user['count']= DataBase::num_rows($query);
  21. while($result = DataBase::fetch($query))
  22. {
  23. $user[$result['u_id']]['u_id']=$result['u_id'];
  24. $user[$result['u_id']]['nick']=$result['nick'];
  25. $user[$result['u_id']]['rank']=$result['rank'];
  26. }
  27. $folder = ($_GET['submode']=='sentbox') ? '<a href="pms.php?mode=folder&amp;submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&amp;submode=inbox" class="navigator">'.$lng['inbox'].'</a>';
  28. //add skin variables
  29. $skin = array(
  30. 'lang'=>DefaultLang(),
  31. 'lname'=>$lng['message_name'],
  32. 'lauthor'=>$lng['user'],
  33. 'lmdate'=>$lng['date'],
  34. 'lmessages_in_box'=>$lng['messages_in_box'],
  35. 'msg_count'=>($_GET['submode']=='inbox') ? $cnt[0] : $cnt[1],
  36. 'msg_max'=>($_GET['submode']=='inbox') ? $forum_config['pm_inbox_max'] : $forum_config['pm_sentbox_max'],
  37. 'msg_per'=>($_GET['submode']=='inbox') ? round(($cnt[0]/$forum_config['pm_inbox_max'])*100,1) : round(($cnt[1]/$forum_config['pm_sentbox_max'])*100,1)
  38. );
  39. $skin = array_push_assoc($skin,GenerateHeader($lng['lpm'].': '.(($_GET['submode']=='sentbox') ? $lng['sentbox'] : $lng['inbox']), '<a href="pms.php" class="navigator">'.$lng['lpm'].'</a> &raquo; '.$folder));
  40. //do it!
  41. require('./skins/'.$default_skin.'/overall_header.tpl');
  42. require('./skins/'.$default_skin.'/pms_folder_body.tpl');
  43. $uid = $_SESSION['uid'];
  44. if (!isset($_GET['submode']))
  45. {
  46. message_forum($lng['invalidmode'],'pms.php');
  47. }
  48. switch($_GET['submode'])
  49. {
  50. case 'sentbox':
  51. {
  52. $sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE `u_n_id`='$uid'";
  53. break;
  54. }
  55. case 'inbox':
  56. {
  57. $sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE `u_id`='$uid'";
  58. break;
  59. }
  60. default:
  61. {
  62. message_forum($lng['invalidmode'],'pms.php');
  63. break;
  64. }
  65. }
  66. $query = DataBase::sql_query($sql,CRITICAL,'Could not obtain messages information');
  67. $count = DataBase::num_rows($query);
  68. if ($count==0)
  69. {
  70. $skin['nomsgs']='<tr><td width="'.TABLES_WIDTH.'" colspan="4" height="19" class="fitem"><p class="fstandard" align="center">'.$lng['no_elements'].'!</p></td></tr>';
  71. }
  72. else
  73. {
  74. while($item=DataBase::fetch($query))
  75. {
  76. $skin=array(
  77. 'mid'=>$item['m_id'],
  78. 'name'=>$item['name'],
  79. 'author'=>Pms::UserName($item['u_id']),
  80. 'nuid'=>$item['u_n_id'],
  81. 'date'=> date('d-m-Y, G:i',$item['time']),
  82. 'mode'=> ($_GET['submode']=='inbox') ? 'user' : 'author'
  83. );
  84. require('./skins/'.$default_skin.'/pms_folder_item_body.tpl');
  85. }
  86. $skin['nomsgs'] = '';
  87. }
  88. //do it!
  89. require('./skins/'.$default_skin.'/pms_folder_end_body.tpl');
  90. if(RANK=='2')
  91. {
  92. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  93. }
  94. else
  95. {
  96. $skin['pa_link']='';
  97. }
  98. $stop = TimeGeneration();
  99. $skin['queries'] = ShowQueries($start, $stop);
  100. require('./skins/'.$default_skin.'/overall_footer.tpl');
  101. ?>