From 387da281967a2415804f59c471d5c871baa61e83 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Fri, 6 Jan 2012 01:01:43 +0100 Subject: [PATCH] read mail fix --- wwwroot/inc/eventz/display.inc | 24 ++++++------------------ wwwroot/inc/senate.inc | 1 + 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/wwwroot/inc/eventz/display.inc b/wwwroot/inc/eventz/display.inc index 83fba39..7a7cfc7 100644 --- a/wwwroot/inc/eventz/display.inc +++ b/wwwroot/inc/eventz/display.inc @@ -95,28 +95,16 @@ if (isset($_SESSION['user_id'])&&($user_id=$_SESSION['user_id'])) { $smarty->assign('k_wallet',$k_wallet); $user_id=$_SESSION['user_id']; - //mail node - if ($node['node_name']=='mail') { + //mail node //OMG remove constant + if ($node['node_id']==MAIL_NODE) { //clear new mail message - - if ($new_mail) $db->query("update users set user_mail=0 where user_id='$user_id'"); - - //set messages as delivered to recipient - $set=$db->query("select mail_id,mail_duplicate_id from mail where mail_user='$user_id' and mail_to='$user_id' and mail_read='no'"); - while($set->next()) { - $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_duplicate_id')."'"); - $db->query("update mail set mail_read='yes' where mail_id='".$set->getString('mail_id')."'"); - - $new_messages[$set->getString('mail_id')]=true; + if ($new_mail) { + //set messages as delivered + $db->query("update users set user_mail=0 where user_id='$user_id'"); + $db->query("update mail set mail_read='yes' where mail_to='$user_id' and mail_read='no'"); } -/* - if (count($new_messages)) { - $db->query("update mail set mail_read='yes' where mail_user='$user_id' and mail_user=mail_to and mail_read='no'"); - $smarty->assign('new_messages',$new_messages); - } -*/ } } diff --git a/wwwroot/inc/senate.inc b/wwwroot/inc/senate.inc index c7f104d..de5c4dc 100644 --- a/wwwroot/inc/senate.inc +++ b/wwwroot/inc/senate.inc @@ -6,6 +6,7 @@ define('REGISTRATION_VOTES',2); //too small so far define('LOGOUT_IDLE_SEC', 3600); // An attempt to remove hard-code constants from code +define('MAIL_NODE',24); define('REGISTRATION_TEXT_NODE',791946); define('REGISTRATION_REQUEST_NODE',2091448); define('UNVERIFIED_REGISTRATIONS_NODE',1836516); -- 2.30.2