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.

79 lines
2.0 KiB

  1. <?php
  2. /**
  3. * @package Dynamic Script Forum
  4. * @file includes/classes/class_pms.php
  5. * @version 1.0.x, 22-02-2007, 20:57
  6. * @copyright 2008(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/dsf.html
  8. * @license GNU GPL v3
  9. **/
  10. if ( !defined('IN_uF') )
  11. {
  12. die('Hacking attempt');
  13. }
  14. class Pms
  15. {
  16. function UserName($uid)
  17. {
  18. global $user;
  19. global $forum_config;
  20. $nick = $user[$uid]['nick'];
  21. $rank = $user[$uid]['rank'];
  22. switch($rank)
  23. {
  24. case '0':
  25. {
  26. return $nick;
  27. break;
  28. }
  29. case '1':
  30. {
  31. return '<font color="'.$forum_config['color_mod'].'"><b>'.$nick.'</b></font>';
  32. break;
  33. }
  34. case '2':
  35. {
  36. return '<font color="'.$forum_config['color_admin'].'"><b>'.$nick.'</b></font>';
  37. break;
  38. }
  39. }
  40. }
  41. function SendMessage($text, $name, $nick)
  42. {
  43. //general variables
  44. $u_n_id = $_SESSION['uid'];
  45. $uid = User::UserIdByNick($nick);
  46. //For work!
  47. NewMessage::AddToInbox($text, $name, $u_n_id, $uid);
  48. NewMessage::AddToSentbox($text, $name, $u_n_id, $uid);
  49. }
  50. function DeleteMsgUser($mid)
  51. {
  52. $sql = "DELETE FROM `".PM_INBOX_TABLE."` WHERE `m_id`='$mid'";
  53. DataBase::sql_query($sql,'GENERAL','Could not delete message in inbox');
  54. }
  55. function DeleteMsgAuthor($mid)
  56. {
  57. $sql = "DELETE FROM `".PM_SENTBOX_TABLE."` WHERE `m_id`='$mid'";
  58. DataBase::sql_query($sql,'GENERAL','Could not delete message in sentbox');
  59. }
  60. }
  61. class NewMessage
  62. {
  63. function AddToInbox($text, $name, $unid, $uid)
  64. {
  65. $last = DataBase::new_id(PM_INBOX_TABLE);
  66. $time = time();
  67. $sql = "INSERT INTO `".PM_INBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid','0')";
  68. DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox');
  69. }
  70. function AddToSentbox($text, $name, $unid, $uid)
  71. {
  72. $last=DataBase::new_id(PM_SENTBOX_TABLE);
  73. $time = time();
  74. $sql = "INSERT INTO `".PM_SENTBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid')";
  75. DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox');
  76. }
  77. }
  78. ?>