|
From: Paul S. O. <ps...@us...> - 2001-11-19 01:05:02
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv26508
Modified Files:
privmsg.php
Log Message:
Altered storage of private message info
Index: privmsg.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/privmsg.php,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** privmsg.php 2001/11/18 18:11:42 1.50
--- privmsg.php 2001/11/19 01:04:58 1.51
***************
*** 76,79 ****
--- 76,82 ----
//
+ //
+ // Var definitions
+ //
if( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) )
{
***************
*** 219,222 ****
--- 222,233 ----
}
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_unread_privmsg = user_unread_privmsg - 1
+ WHERE user_id = " . $userdata['user_id'];
+ if( !$user_upd_status = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Could not update private message read status for user.", "", __LINE__, __FILE__, $sql);
+ }
+
//
// Check to see if the poster has a 'full' sent box
***************
*** 767,771 ****
// This 'will' handle a simple user search
// performed from within the private message post
! // form
//
--- 778,783 ----
// This 'will' handle a simple user search
// performed from within the private message post
! // form ... for 2.2 now, too late for 2.0 ... if we
! // decide to do it all, I'm sooo lazy!
//
***************
*** 986,989 ****
--- 998,1013 ----
else if( $mode != "edit" )
{
+
+ //
+ // Add to the users new pm counter
+ //
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . time() . "
+ WHERE user_id = " . $to_userdata['user_id'];
+ if( !$status = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Could not update private message new/read status for user.", "", __LINE__, __FILE__, $sql);
+ }
+
if( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) )
{
***************
*** 1513,1521 ****
// Default page
//
! if(!$userdata['session_logged_in'])
{
header("Location: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
}
$page_title = $lang['Private_Messaging'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
--- 1537,1565 ----
// Default page
//
! if( !$userdata['session_logged_in'] )
{
header("Location: " . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
}
+ //
+ // Update unread status
+ //
+ $sql = "UPDATE " . USERS_TABLE . "
+ SET user_unread_privmsg = " . ( $userdata['user_new_privmsg'] + $userdata['user_unread_privmsg'] ) . ", user_new_privmsg = 0, user_last_privmsg = " . $userdata['session_start'] . "
+ WHERE user_id = " . $userdata['user_id'];
+ if( !$status = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Could not update private message new/read status for user.", "", __LINE__, __FILE__, $sql);
+ }
+
+ //
+ // Reset PM counters
+ //
+ $userdata['user_new_privmsg'] = 0;
+ $userdata['user_unread_privmsg'] = ( $userdata['user_new_privmsg'] + $userdata['user_unread_privmsg'] );
+
+ //
+ // Generate page
+ //
$page_title = $lang['Private_Messaging'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
|