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.

106 lines
2.9 KiB

  1. <?php
  2. $msg ='';
  3. if ((isset($_POST['textedit'])) and (isset($_POST['nmsg'])) and (isset($_POST['username'])))
  4. {
  5. if (($_POST['textedit'] != '') and ($_POST['nmsg']!='') and ($_POST['username']!='') and (strlen($_POST['textedit'])>10) and (strlen($_POST['nmsg'])>5))
  6. {
  7. $nick = strip_tags($_POST['username']);
  8. $sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
  9. $result = DataBase::fetch(DataBase::sql_query($sql, CRITICAL,'Could not obtain user information.'));
  10. if ($result['u_id']!='')
  11. {
  12. $cntu = Pms::PMCnt($result['u_id']);
  13. if ($cntu[0] < $forum_config['pm_inbox_max'])
  14. {
  15. //antiflood lock
  16. if (isset($_COOKIE['antiflood_time']))
  17. {
  18. if ($_COOKIE['antiflood_time']>time())
  19. {
  20. message_forum($lng['antiflood_enabled'],$_SERVER['REQUEST_URI']);
  21. }
  22. }
  23. else
  24. {
  25. setcookie('antiflood_time',(time() + $forum_config['time_antiflood']));
  26. $_POST['textedit'] = Secure::TagsReplace($_POST['textedit']);
  27. $_POST['nmsg'] = strip_tags($_POST['nmsg']);
  28. Pms::SendMessage($_POST['textedit'],$_POST['nmsg'], $_POST['username']);
  29. message_forum($lng['post_is_saved'],'pms.php');
  30. }
  31. }
  32. else
  33. {
  34. $message = $lng['pm_inbox_full'];
  35. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  36. }
  37. }
  38. else
  39. {
  40. $message = $lng['no_user'];
  41. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  42. }
  43. }
  44. else
  45. {
  46. $message = $lng['perror_1'];
  47. $msg = './skins/'.$default_skin.'/post_error_body.tpl';
  48. }
  49. }
  50. else
  51. {
  52. if (isset($_GET['id']))
  53. {
  54. Secure::user_exists(intval($_GET['id']));
  55. $_POST['username'] = User::UserInformation(intval($_GET['id']), 'nick');
  56. }
  57. else
  58. {
  59. $_POST['username'] = '';
  60. }
  61. $_POST['nmsg']='';
  62. $_POST['textedit']='';
  63. }
  64. $cnt = Pms::PMCnt();
  65. //add skin variables
  66. $skin = array(
  67. 'smiles'=>Post::SmilesShow(),
  68. //labels
  69. 'luser'=>$lng['user'],
  70. 'lsmiles'=>$lng['smiles'],
  71. 'lmsgname'=>$lng['msgname'],
  72. 'lmsg'=>$lng['message'],
  73. 'lsave'=>$lng['save'],
  74. 'lreset'=>$lng['reset'],
  75. 'lwritemsg'=>$lng['write_pm'],
  76. 'action'=>$_SERVER['REQUEST_URI'],
  77. 'lsentbox_full'=>($cnt[1]==$forum_config['pm_sentbox_max']) ? $lng['pm_sentbox_full'] : ''
  78. );
  79. $skin = array_push_assoc($skin, GenerateHeader($lng['lpm'].': '.$lng['write_pm'], '</a>&gt;<a href="pms.php" class="navigator">'.$lng['lpm'].'</a> &gt; <a href="'.$_SERVER['REQUEST_URI'].'" class="navigator">'.$lng['write_pm']));
  80. if ($msg=='')
  81. {
  82. $msg='./skins/'.$default_skin.'/blank.tpl';
  83. }
  84. //do it!
  85. include('./skins/'.$default_skin.'/overall_header.tpl');
  86. include('./skins/'.$default_skin.'/pms_new_body.tpl');
  87. if(RANK=='2')
  88. {
  89. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  90. }
  91. else
  92. {
  93. $skin['pa_link']='';
  94. }
  95. $stop = TimeGeneration();
  96. $skin['queries'] = ShowQueries($start, $stop);
  97. include('./skins/'.$default_skin.'/overall_footer.tpl');
  98. ?>