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.

94 lines
2.6 KiB

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