Просмотр файла admin/admin_private_messages.php

Размер файла: 3.92Kb
  1. <?php
  2. /***************************************************************************
  3. * mides.ru
  4. * -------------------
  5. ***************************************************************************/
  6. define('IN_PHPBB', 1);
  7. if( !empty($setmodules) )
  8. {
  9. $filename = basename(__FILE__);
  10. $module['Users']['Private_Messages'] = $filename;
  11. return;
  12. }
  13. $no_page_header = TRUE;
  14. $phpbb_root_path = './../';
  15. require($phpbb_root_path . 'extension.inc');
  16. require('./pagestart.' . $phpEx);
  17. include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
  18. include('./page_header_admin.'.$phpEx);
  19.  
  20. if ( isset($HTTP_POST_VARS['start1']) )
  21. {
  22. $start1 = abs(intval($HTTP_POST_VARS['start1']));
  23. $start = (($start1 - 1) * $board_config['topics_per_page']);
  24. } else {
  25. $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
  26. $start = ($start < 0) ? 0 : $start;
  27. }
  28. $users_per_page = 25;
  29.  
  30. $template->set_filenames(array(
  31. 'body' => 'admin/admin_priv_mess.tpl')
  32. );
  33.  
  34. $sql = "SELECT COUNT(privmsgs_id) as total FROM " . PRIVMSGS_TABLE;
  35. if ( !($result = $db->sql_query($sql)))
  36. {
  37. message_die(GENERAL_ERROR, 'Could not query private message information', '', __LINE__, __FILE__, $sql);
  38. }
  39. $pm_count = $db->sql_fetchrow($result);
  40. $pagination ='';
  41.  
  42. if ($pm_count['total'] > $board_config['posts_per_page'])
  43. {
  44. $pagination = generate_pagination("admin_private_messages.$phpEx?", $pm_count['total'], $board_config['posts_per_page'], $start);
  45. }
  46.  
  47. $template->assign_vars(array(
  48. 'L_PRIVMSG' => $lang['Private_Message'],
  49. 'L_PRIVMSGS' => $lang['Private_Messages'],
  50. 'L_FROM' => $lang['From'],
  51. 'L_TO' => $lang['To'],
  52. 'L_DATE' => $lang['Date'],
  53. 'L_IP' => $lang['IP_Address'],
  54. 'L_SUBJ' => $lang['Subject'],
  55. 'PAGINATION' => $pagination
  56. )
  57. );
  58.  
  59. $sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, pm.privmsgs_type, pm.privmsgs_subject, pm.privmsgs_date, pm.privmsgs_ip, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text
  60. FROM " . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u, " . USERS_TABLE . " u2
  61. WHERE pmt.privmsgs_text_id = pm.privmsgs_id
  62. AND u.user_id = pm.privmsgs_from_userid
  63. AND u2.user_id = pm.privmsgs_to_userid
  64. ORDER BY pm.privmsgs_date DESC
  65. LIMIT " . $start . ", " . $board_config['posts_per_page'];
  66. if ( !($result = $db->sql_query($sql)))
  67. {
  68. message_die(GENERAL_ERROR, 'Could not query private message information', '', __LINE__, __FILE__, $sql);
  69. }
  70. while ($pm_text = $db->sql_fetchrow($result))
  71. {
  72. if ($pm_text['privmsgs_type'] == PRIVMSGS_READ_MAIL)
  73. {
  74. $privmsgs_type = $lang['Read_message'];
  75. }
  76. elseif ($pm_text['privmsgs_type'] == PRIVMSGS_NEW_MAIL)
  77. {
  78. $privmsgs_type = $lang['Unread_message'];
  79. }
  80. elseif ($pm_text['privmsgs_type'] == PRIVMSGS_SENT_MAIL)
  81. {
  82. $privmsgs_type = $lang['Sent'];
  83. }
  84. elseif ($pm_text['privmsgs_type'] == PRIVMSGS_SAVED_IN_MAIL)
  85. {
  86. $privmsgs_type = $lang['Saved'];
  87. }
  88. elseif ($pm_text['privmsgs_type'] == PRIVMSGS_SAVED_OUT_MAIL)
  89. {
  90. $privmsgs_type = $lang['Saved'];
  91. }
  92. elseif ($pm_text['privmsgs_type'] == PRIVMSGS_UNREAD_MAIL)
  93. {
  94. $privmsgs_type = $lang['Unread_message'];
  95. }
  96. else
  97. {
  98. $privmsgs_type = '';
  99. }
  100.  
  101. $template->assign_block_vars('pmrow', array(
  102. 'FROM_URL' => append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $pm_text['user_id_1']),
  103. 'TO_URL' => append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $pm_text['user_id_2']),
  104. 'FROM' => $pm_text['username_1'],
  105. 'TO' => $pm_text['username_2'],
  106. 'DATE' => create_date($board_config['default_dateformat'], $pm_text['privmsgs_date'], $board_config['board_timezone']),
  107. 'IP' => decode_ip($pm_text['privmsgs_ip']),
  108. 'SUBJ' => $pm_text['privmsgs_subject'],
  109. 'TYPE' => $privmsgs_type,
  110. 'MESSAGE' => bbencode_second_pass($pm_text['privmsgs_text'], $pm_text['privmsgs_bbcode_uid']) . '<hr/>'
  111. )
  112. );
  113. }
  114.  
  115. $template->pparse('body');
  116. include('./page_footer_admin.'.$phpEx);
  117. ?>