Exemplo n.º 1
0
 static function updatemsg()
 {
     global $user, $db;
     $lastmsgid = Cache::get('lastmsgid');
     if (!$lastmsgid || self::$last_chatmsg_id >= $lastmsgid) {
         return;
     }
     if ($q = $db->query('SELECT * FROM `chatlog` WHERE `messageid`>' . self::$last_chatmsg_id . ' AND (`channel`=' . $user['channel'] . ' OR `fromuid`=' . $user['uid'] . ' OR `touid`=' . $user['uid'] . ' OR `type` IN (2,3));')) {
         while ($d = mysql_fetch_array($q)) {
             self::$last_chatmsg_id = $d['messageid'];
             SERVER::givemsg($d['time'], $d['type'], $d['message'], $d['fromuid'], $d['fromusername'], $d['tousername']);
         }
         $db->update('online_user', array('lastmsgid' => self::$last_chatmsg_id), '`sid`=\'' . $user['sid'] . '\' AND `uid`=' . $user['uid']);
     }
 }