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.

99 lines
3.0 KiB

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