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.

121 lines
3.5 KiB

  1. <?php
  2. //smiles cache
  3. $sql = "SELECT * FROM ".SMILES_TABLE."";
  4. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.');
  5. $i = 1;
  6. while($result = DataBase::fetch($query))
  7. {
  8. $smile[$i]['smile'] = $result['smile'];
  9. $smile[$i]['url'] = $result['url'];
  10. $i +=1;
  11. }
  12. $mid = intval($_GET['id']);
  13. if (!isset($_GET['submode']))
  14. {
  15. message_forum($lng['invalidmode'],'pms.php');
  16. }
  17. switch($_GET['submode'])
  18. {
  19. case 'author':
  20. {
  21. $sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
  22. break;
  23. }
  24. case 'user':
  25. {
  26. $sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
  27. break;
  28. }
  29. default:
  30. {
  31. message_forum($lng['invalidmode'],'pms.php');
  32. break;
  33. }
  34. }
  35. $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
  36. $result = DataBase::fetch($query);
  37. //if message exist....
  38. if ($result['m_id']=='')
  39. {
  40. message_forum($lng['no_message'],'pms.php');
  41. }
  42. switch($_GET['submode'])
  43. {
  44. case 'user':
  45. {
  46. //if message user loged....
  47. if ($result['u_id']!=$_SESSION['uid'])
  48. {
  49. message_forum($lng['merror_2'],'index.php');
  50. }
  51. break;
  52. }
  53. case 'author':
  54. {
  55. //if message author loged....
  56. if ($result['u_n_id']!=$_SESSION['uid'])
  57. {
  58. message_forum($lng['merror_2'],'index.php');
  59. }
  60. break;
  61. }
  62. }
  63. if ($_GET['submode']=='user')
  64. {
  65. DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", 'GENERAL', 'Could not update message.');
  66. }
  67. $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'";
  68. $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
  69. $user = DataBase::fetch($query);
  70. $folder = ($_GET['submode']=='author') ? '<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>';
  71. //add skin variables
  72. $skin = array(
  73. 'lang'=>DefaultLang(),
  74. 'lname'=>$lng['message'],
  75. 'u_id'=>$result['u_n_id'],
  76. 'username'=>Topic::UserName($user['nick'], $user['rank']),
  77. 'userrank'=>User::UserRank($user['rank']),
  78. 'delete'=>'<a href="javascript:confirm_action(\''.$lng['c_delete_pm'].'\',\'pms.php?mode=delete&amp;user='.$_GET['submode'].'&amp;m='.$mid.'\')"><img src="skins/'.$default_skin.'/images/delete_small.gif" alt="del"></a>',
  79. 'avatar'=>($user['avatar']!='') ? '<img src="'.$user['avatar'].'" alt="av">' : '<br><br><br><br>',
  80. 'msgtext'=>Topic::PostText($result['message'],0,0),
  81. 'sig'=> ($user['sig']!='') ? '<br>------------------------<br>'.$user['sig'] : '',
  82. 'posts'=>$user['posts'],
  83. 'regdate'=>date('d-m-Y',$user['regdate']),
  84. 'lastvisit'=>date('d-m-Y',$user['lastvisit']),
  85. //labels
  86. 'lrank'=>$lng['lurank2'],
  87. 'llastvisit'=>$lng['lulastvisit'],
  88. 'lregdate'=>$lng['regdate2'],
  89. 'lposts'=>$lng['posts'],
  90. 'lno'=>$lng['no.'],
  91. 'lpinfo'=>$lng['postinfo']
  92. );
  93. $skin = array_push_associative($skin,GenerateHeader($lng['show_message'].': '.$result['name'], '</a> &gt; '.$folder.' &gt;
  94. <a href="pms.php?mode=view&amp;submode='.$_GET['submode'].'&amp;id='.
  95. $result['m_id'].'" class="navigator">'.$lng['show_message']
  96. .': '.$result['name']));
  97. //do it!
  98. include('./skins/'.$default_skin.'/overall_header.tpl');
  99. include('./skins/'.$default_skin.'/msgs_msg_body.tpl');
  100. if(RANK=='2')
  101. {
  102. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  103. }
  104. else
  105. {
  106. $skin['pa_link']='';
  107. }
  108. $stop = TimeGeneration();
  109. $skin['queries'] = ShowQueries($start, $stop);
  110. include('./skins/'.$default_skin.'/overall_footer.tpl');
  111. break;
  112. ?>