} } // Load language if (!defined('PCPIN_NO_SESSION')) { if (empty($_GET['b_id']) && empty($_GET['external_url'])) { _pcpin_loadClass('language'); $l = new PCPIN_Language($_pcpin_init_session); $_pcpin_set_language = $_pcpin_init_session->_s_language_id; if (!empty($_pcpin_init_session->_conf_all['allow_language_selection']) && !empty($_POST['language_id'])) { $_pcpin_set_language = $_POST['language_id']; } if (true !== $l->setLanguage($_pcpin_set_language)) { PCPIN_Common::dieWithError(-1, '<b>Fatal error</b>: Failed to load language'); } if (!empty($_pcpin_init_session->_s_id) && $l->id != $_pcpin_init_session->_s_language_id) { $_pcpin_init_session->_s_updateSession($_pcpin_init_session->_s_id, true, true, $l->id); } unset($_pcpin_set_language); } } /** * Strip magic quotes from GPC vars and extract them into the global scope. * This software uses own security algorithm to prevent SQL injections. */ if (get_magic_quotes_gpc()) { $_pcpin_magic_quotes_sybase = ini_get('magic_quotes_sybase') == '1'; $_GET = PCPIN_Common::stripSlashesRecursive($_GET, $_pcpin_magic_quotes_sybase); $_POST = PCPIN_Common::stripSlashesRecursive($_POST, $_pcpin_magic_quotes_sybase); $_COOKIE = PCPIN_Common::stripSlashesRecursive($_COOKIE, $_pcpin_magic_quotes_sybase); // $_SESSION=PCPIN_Common::stripSlashesRecursive($_SESSION, $_pcpin_magic_quotes_sybase); // <-- not needed yet unset($_pcpin_magic_quotes_sybase);
/** * Put user into/out of a room * @param int $user_id User ID * @param int $target_room_id ID of room where to put user into * @param boolean $skip_msg If TRUE, then system message 115 will be NOT inserted * @param string $stealth_mode "Stealth" mode flag ("y"/"n") * @return boolean TRUE on success or FALSE on error */ function putUser($user_id = 0, $target_room_id = 0, $skip_msg = false, $stealth_mode = 'n') { $ok = false; _pcpin_loadClass('message'); $message = new PCPIN_Message($this); _pcpin_loadClass('session'); $session = new PCPIN_Session($this, '', true); // Get user's session if (!empty($user_id) && $session->_db_getList('_s_user_id = ' . $user_id, 1)) { // Session exists if ($target_room_id != $session->_db_list[0]['_s_room_id']) { if (!empty($session->_db_list[0]['_s_room_id'])) { // Put user out of a room $ok = true; if ($this->_db_getList('users_count', 'id = ' . $session->_db_list[0]['_s_room_id'], 1)) { $this->updateRoom($session->_db_list[0]['_s_room_id'], false, true, null, null, null, null, $this->_db_list[0]['users_count'] - 1, null, null, null, date('Y-m-d H:i:s')); } if (true !== $skip_msg) { $message->addMessage(115, 'n', 0, '', $session->_db_list[0]['_s_room_id'], 0, $user_id . '/' . $session->_db_list[0]['_s_room_id']); } } if (!empty($target_room_id)) { // Put user into a room if ($this->_db_getList('users_count', 'id = ' . $target_room_id, 1)) { $ok = true; $this->updateRoom($target_room_id, false, true, null, null, null, null, $this->_db_list[0]['users_count'] + 1, null, null, null, date('Y-m-d H:i:s')); } else { // Room does not exists $target_room_id = 0; } if (true !== $skip_msg) { $message->addMessage(111, 'n', 0, '', $target_room_id, 0, $user_id . '/' . $target_room_id); } } // Update session $session->_s_updateSession($session->_db_list[0]['_s_id'], false, true, null, null, $target_room_id, null, null, null, null, !empty($target_room_id) ? date('Y-m-d H:i:s') : '', null, null, null, $stealth_mode, null, null, '0000-00-00 00:00:00', ''); if ($session->_db_list[0]['_s_online_status'] != 1) { $session->_db_setObject($session->_db_list[0]); $session->_s_setOnlineStatus(1); } } else { $ok = true; } // Delete temporary message attachments _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($this); $tmpdata->deleteUserRecords($user_id, 3); } return $ok; }