$xmlwriter->setHeaderStatus(300); $xmlwriter->setHeaderMessage($l->g('error')); } elseif (!$room->_db_getList('id, category_id, password', 'id = ' . $room_id, 1)) { // Room does not exists $xmlwriter->setHeaderStatus(400); $xmlwriter->setHeaderMessage($l->g('room_not_exists')); } elseif ($current_user->is_admin !== 'y' && $room->_db_list[0]['password'] != '' && $room->_db_list[0]['password'] != md5(base64_decode($password)) && false === strpos(',' . $current_user->moderated_rooms . ',', ',' . $room_id . ',')) { // Invalid password $xmlwriter->setHeaderStatus(600); $xmlwriter->setHeaderMessage($l->g('invalid_password')); } else { $enter_allowed = true; $category_id = $room->_db_list[0]['category_id']; // Check "stealth" mode if ($stealth_mode == 'y') { if ($current_user->is_admin !== 'y' && false === strpos(',' . $current_user->moderated_rooms . ',', ',' . $room_id . ',')) { $stealth_mode = 'n'; } } else { $stealth_mode = 'n'; } // Enter room if ($room->putUser($session->_s_user_id, $room_id, $stealth_mode == 'y', $stealth_mode)) { $xmlwriter->setHeaderStatus(0); $xmlwriter->setHeaderMessage('OK'); } else { $xmlwriter->setHeaderStatus(500); $xmlwriter->setHeaderMessage($l->g('error')); } } }
* 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 (empty($current_user->id) || $session->_s_user_id != $current_user->id) { header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime())); die; } _pcpin_loadClass('room'); $room = new PCPIN_Room($session); if (!empty($session->_conf_all['default_room']) && $room->_db_getList('id', 'id = ' . $session->_conf_all['default_room'], 1)) { // Default room specified and exists $room->_db_freeList(); if ($room->putUser($current_user->id, $session->_conf_all['default_room'])) { header('Location: ' . PCPIN_FORMLINK . '?s_id=' . $session->_s_id . '&inc=chat_room&ts=' . time()); die; } } if (!empty($session->_s_room_id)) { // User was in chat room. Push him out. $room->putUser($current_user->id, 0, $session->_s_stealth_mode == 'y', 'n'); } $_body_onload[1000000] = 'initRoomSelection(' . $session->_conf_all['updater_interval'] . ',' . '\'' . $current_user->room_selection_view . '\',' . (!empty($session->_conf_all['userlist_avatar_thumb']) && 2 == PCPIN_GD_VERSION ? 'true' : 'false') . ',' . (!empty($session->_conf_all['userlist_privileged_flags']) && 2 == PCPIN_GD_VERSION ? 'true' : 'false') . ',' . (!empty($session->_conf_all['userlist_gender_icon']) ? 'true' : 'false') . ')'; $_load_cm_user_options = true; // Init template _pcpin_loadClass('pcpintpl'); $tpl = new PcpinTpl(); $tpl->setBasedir('./tpl'); $tpl->readTemplatesFromFile('./room_selection.tpl');
/** * 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'); } }