/** * Log the session out and deactivate it * @param boolean $skip_msg If TRUE, then system messages 105 and 115 will be NOT inserted */ function _s_logOut($skip_msg = false) { if ($this->_s_id != '') { if (!empty($this->_s_user_id)) { _pcpin_loadClass('message'); $msg = new PCPIN_Message($this); if (!empty($this->_s_room_id)) { // Session owner was in a room _pcpin_loadClass('room'); $room = new PCPIN_Room($this); $room->putUser($this->_s_user_id, 0, $skip_msg); } // Delete invitations _pcpin_loadClass('invitation'); $invitation = new PCPIN_Invitation($this); $invitation->deleteUserInvitations($this->_s_user_id); // Delete temporary data _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($this); $tmpdata->deleteUserRecords($this->_s_user_id); // Update session owner stats _pcpin_loadClass('user'); $user = new PCPIN_User($this); if ($user->_db_loadObj($this->_s_user_id)) { if ($user->is_guest == 'y') { // User was a guest. Delete record. $user->deleteUser($this->_s_user_id); } else { // Update registered user stats $user->time_online = $user->calculateOnlineTime($user->id); $user->last_message_id = $user->last_message_id < $this->_s_last_message_id ? $this->_s_last_message_id : $user->last_message_id; $user->_db_updateObj($user->id); } } if (true !== $skip_msg) { $msg->addMessage(105, 'n', 0, '', 0, 0, $this->_s_user_id); } } // Delete session from database $this->_db_deleteRow($this->_s_id, '_s_id'); } }
/** * This file is part of "PCPIN Chat 6". * * "PCPIN Chat 6" is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * "PCPIN Chat 6" is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ _pcpin_loadClass('invitation'); $invitation = new PCPIN_Invitation($session); $invitations_xml = array(); if (!empty($current_user->id)) { $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); $invitations = $invitation->getNewInvitations($current_user->id, false); foreach ($invitations as $invitation_data) { if (false === strpos(',' . $current_user->muted_users . ',', ',' . $invitation_data['author_id'] . ',')) { $invitations_xml[] = array('id' => $invitation_data['id'], 'author_id' => $invitation_data['author_id'], 'author_nickname' => $invitation_data['author_nickname'], 'room_id' => $invitation_data['room_id'], 'room_name' => $invitation_data['room_name']); } } } $xmlwriter->setData(array('invitation' => $invitations_xml));
* * "PCPIN Chat 6" is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ if (!isset($user_id)) { $user_id = 0; } _pcpin_loadClass('nickname'); $nickname = new PCPIN_Nickname($session); _pcpin_loadClass('invitation'); $invitation = new PCPIN_Invitation($session); if (!empty($current_user->id)) { $xmlwriter->setHeaderMessage($l->g('error')); $xmlwriter->setHeaderStatus(1); if ($current_user->global_muted_until > date('Y-m-d H:i:s')) { $xmlwriter->setHeaderMessage($l->g('you_are_muted_until')); $xmlwriter->setHeaderMessage(str_replace('[EXPIRATION_DATE]', $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($current_user->global_muted_until)), $message)); } elseif ($current_user->global_muted_permanently == 'y') { $xmlwriter->setHeaderMessage($l->g('you_are_muted_permanently')); } else { if (!empty($session->_s_room_id) && !empty($user_id) && $current_user->_db_getList('id', 'id = ' . $user_id, 1)) { // User exists if ($session->_db_getList('_s_room_id, _s_stealth_mode', '_s_user_id = ' . $user_id, 1)) { // User is online if ($session->_db_list[0]['_s_room_id'] == $session->_s_room_id) { // User is already in desired room