* (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/>. */ 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 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('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); $type = 'p'; //todo if (!isset($name) || !is_scalar($name)) { $name = ''; } if (!isset($description) || !is_scalar($description)) { $description = ''; } if (!isset($default_message_color) || !is_scalar($default_message_color)) { $default_message_color = $session->_conf_all['default_message_color']; }
/** * Delete category and all contained rooms * @param int $id Category ID * @return boolean TRUE on success or FALSE on error */ function deleteCategory($id = 0) { $result = false; if (!empty($id) && $this->_db_getList('id = ' . $id, 1)) { // Are there rooms in this category? _pcpin_loadClass('room'); $room = new PCPIN_Room($this); if ($room->_db_getList('id', 'category_id = ' . $id)) { // Delete category rooms $rooms = $room->_db_list; $room->_db_freeList(); foreach ($rooms as $room_data) { $room->deleteRoom($room_data['id']); } } // Update "moderated_categories" field by category moderators $moderators = $this->getModerators($id); if (!empty($moderators)) { _pcpin_loadClass('user'); $user = new PCPIN_User($this); foreach ($moderators as $data) { $user->_db_updateRow($data['id'], 'id', array('moderated_categories' => trim(str_replace(',' . $id . ',', ',', ',' . $data['moderated_categories'] . ','), ','))); } } // Delete category $this->_db_deleteRow($id); } return $result; }
* * "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('room'); $room = new PCPIN_Room($session); if (!isset($room_id) || !is_scalar($room_id)) { $room_id = 0; } if (!isset($stealth_mode)) { $stealth_mode = 'n'; } if (!isset($password)) { $password = ''; } if (!empty($current_user->id)) { $enter_allowed = false; if (empty($room_id)) { // No room selected $xmlwriter->setHeaderStatus(300); $xmlwriter->setHeaderMessage($l->g('error'));
* 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/>. */ /** * Get member data */ _pcpin_loadClass('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); if (!isset($profile_user_id)) { $profile_user_id = 0; } $member_xml = array(); $moderated_rooms = array(); $moderated_categories = array(); // Get client session if (is_object($session) && !empty($profile_user_id) && !empty($current_user->id) && $current_user->is_admin === 'y') { if ($current_user->_db_getList('moderated_categories,moderated_rooms', 'id = ' . $profile_user_id, 1)) { $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); $member = $current_user->_db_list[0]; $current_user->_db_freeList();
/** * 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'); } }
* * "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/>. */ $room_id = 0; _pcpin_loadClass('category'); $category = new PCPIN_Category($session); _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); _pcpin_loadClass('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('message'); $msg = new PCPIN_Message($session); _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); $errortext = array(); if (!isset($name)) { $name = ''; } if (!isset($description)) { $description = ''; } if (!isset($password) || !is_scalar($password)) { $password = ''; } if (!empty($current_user->id) && !empty($category_id) && is_scalar($category_id)) {
* * "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('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); if (!isset($room_id) || !pcpin_ctype_digit($room_id)) { $room_id = 0; } if (!isset($action) || !is_scalar($action)) { $action = ''; } if (!isset($dir) || !pcpin_ctype_digit($dir)) { $dir = 0; }
$_load_colorbox = true; // Load smiliebox $_load_smiliebox = true; // Default: Do not context menu user options $_load_cm_user_options = true; if (empty($current_user->id) || $session->_s_user_id != $current_user->id || empty($session->_s_room_id)) { header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime())); die; } // Delete temporary message attachments _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); $tmpdata->deleteUserRecords($current_user->id, 3); // Get room background image _pcpin_loadClass('room'); $room = new PCPIN_Room($session); $room->_db_getList('background_image', 'id = ' . $session->_s_room_id, 1); $background_image = $room->_db_list[0]['background_image']; $room->_db_freeList(); // Get default avatar _pcpin_loadClass('avatar'); $avatar = new PCPIN_Avatar($session); $avatars = $avatar->getAvatars($current_user->id, 1); if (!empty($avatars)) { $avatar_bid = $avatars[0]['binaryfile_id']; } else { $avatar_bid = 0; } unset($avatars); // JS files to load $_js_files[] = './js/user.js';
* 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/>. */ /** * @param string $abuse_nickname * @param string $abuse_category * @param string $abuse_description */ _pcpin_loadClass('message'); $msg = new PCPIN_Message($session); _pcpin_loadClass('room'); $room = new PCPIN_Room($session); if (!isset($abuse_nickname)) { $abuse_nickname = '-'; } if (!isset($abuse_category)) { $abuse_category = 0; } if (!isset($abuse_description)) { $abuse_description = ''; } if (!empty($current_user->id)) { // Get moderators if (empty($session->_s_room_id)) { // User is not in room $xmlwriter->setHeaderMessage($l->g('error')); $xmlwriter->setHeaderStatus(1);
* * "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('room'); $room = new PCPIN_Room($session); if (!isset($room_id) || !pcpin_ctype_digit($room_id)) { $room_id = 0; } if (!empty($current_user->id) && $current_user->is_admin === 'y' && $session->_s_user_id == $current_user->id) { $xmlwriter->setHeaderStatus(1); $xmlwriter->setHeaderMessage($l->g('error')); if (!empty($room_id) && $room->_db_getList('name', 'id = ' . $room_id)) { // Room exists $xmlwriter->setHeaderStatus(0); $room_name = $room->_db_list[0]['name']; $xmlwriter->setHeaderMessage(str_replace('[NAME]', $room_name, $l->g('room_deleted'))); // Delete room $room->deleteRoom($room_id); } }
* "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/>. */ /** * This file returns new messages for the user. * This file can be called from offside of chat room. */ _pcpin_loadClass('message'); $msg = new PCPIN_Message($session); _pcpin_loadClass('room'); $room = new PCPIN_Room($session); $abuses_xml = array(); if (!empty($current_user->id)) { $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); $messages = $msg->getNewMessages($current_user->id); $last_message_id = $session->_s_last_message_id; foreach ($messages as $message_data) { $last_message_id = $last_message_id < $message_data['id'] ? $message_data['id'] : $last_message_id; if ($message_data['type'] == 4001) { $msg_parts = explode('/', $message_data['body'], 5); if ($room->_db_getList('name', 'id = ' . $msg_parts[1], 1)) { $room_name = $room->_db_list[0]['name']; $room->_db_freeList(); } else { $room_name = '-';
* 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 (function_exists('debug_backtrace')) { $_pcpin_dbt = debug_backtrace(); if (is_array($_pcpin_dbt) && empty($_pcpin_dbt[0])) { die('Access denied'); } unset($_pcpin_dbt); } _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); _pcpin_loadClass('avatar'); $avatar = new PCPIN_Avatar($session); _pcpin_loadClass('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); if (PCPIN_SLAVE_MODE && !empty($_pcpin_slave_userdata) && !empty($session) && is_object($session)) { $language_id = $_pcpin_slave_userdata['language']; if ($_pcpin_slave_userdata['is_guest'] !== 'n') { // User is guest $guest_login = 1; } else { // Registered user // Check user if ($current_user->_db_getList('login = '******'login'], 1)) { // User exists $current_user_set = $current_user->_db_list[0]; $current_user->_db_freeList(); // Check wether user already logged in or not
* 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/>. */ /** * Update moderator data */ _pcpin_loadClass('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); if (!isset($moderator_user_id) || !pcpin_ctype_digit($moderator_user_id)) { $moderator_user_id = 0; } if (!isset($categories) || !is_scalar($categories)) { $categories = ''; } if (!isset($rooms) || !is_scalar($rooms)) { $rooms = ''; } // Get client session if (is_object($session) && !empty($moderator_user_id) && !empty($current_user->id) && $current_user->is_admin === 'y') { if ($current_user->_db_getList('id = ' . $moderator_user_id, 1)) { $xmlwriter->setHeaderMessage('OK');
// Current user data $_is_moderator = false; $current_nickname = ''; $current_room_name = ''; if (!empty($session->_s_user_id)) { $current_user->_db_loadObj($session->_s_user_id); if (!empty($session->_s_room_id) && $current_user->moderated_rooms != '') { $_is_moderator = false !== strpos(',' . $current_user->moderated_rooms . ',', ',' . $session->_s_room_id . ','); } _pcpin_loadClass('nickname'); $nickname_ = new PCPIN_Nickname($session); $current_nickname = $nickname_->getDefaultNickname($current_user->id); unset($nickname_); if (!empty($session->_s_room_id)) { _pcpin_loadClass('room'); $room_ = new PCPIN_Room($session); if ($room_->_db_getList('name', 'id = ' . $session->_s_room_id, 1)) { $current_room_name = $room_->_db_list[0]['name']; } } } if (!empty($b_id)) { // Binary file requested require_once './inc/get_binary.inc.php'; die; } elseif (!empty($ajax) && is_scalar($ajax)) { // AJAX request require_once './inc/ajax/_main.inc.php'; die; } elseif (!empty($external_url)) { // Redirect to an external URL
* @param boolean $first_request If TRUE, then full room information and full userlist will be returned, * returned messages count will be limited by 'init_display_messages_count' * @param boolean $full_request If TRUE, then full room information and full userlist will be returned * @param int $get_last_msgs If > 0, then last X messages will be returned (including already delivered messages) * @param boolean $pref_timestamp Optional. Current state of client's "Display message timestamp" preference * @param boolean $pref_allow_sounds Optional. Current state of client's "Allow sounds" preference * @param boolean $pref_message_color Optional. Current message color */ _pcpin_loadClass('message'); $msg = new PCPIN_Message($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); _pcpin_loadClass('nickname'); $nickname = new PCPIN_Nickname($session); _pcpin_loadClass('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('invitation'); $invitation = new PCPIN_Invitation($session); _pcpin_loadClass('avatar'); $avatar = new PCPIN_Avatar($session); _pcpin_loadClass('badword'); $badword = new PCPIN_Badword($session); _pcpin_loadClass('banner'); $banner = new PCPIN_Banner($session); $default_nicknames = array(); // cached nicknames $last_sent_message_time = $session->_s_last_sent_message_time <= '0000-00-00 00:00:00' ? 0 : PCPIN_Common::datetimeToTimestamp($session->_s_last_sent_message_time); $last_sent_message_hash = $session->_s_last_sent_message_hash; $last_sent_message_repeats_count = $session->_s_last_sent_message_repeats_count; $last_message_id = $session->_s_last_message_id; if (!isset($room_id) || !is_scalar($room_id)) {
// Remember current error reporting settings $_pcpin_old_error_reporting = error_reporting(); $_pcpin_old_display_errors = ini_get('display_errors'); // Do not create new session if (!defined('PCPIN_NO_SESSION')) { define('PCPIN_NO_SESSION', true); } // Initialize require './init.inc.php'; // Load required classes _pcpin_loadClass('user'); $_pcpin_user = new PCPIN_User($_pcpin_init_session); _pcpin_loadClass('nickname'); $_pcpin_nickname = new PCPIN_Nickname($_pcpin_init_session); _pcpin_loadClass('room'); $_pcpin_room = new PCPIN_Room($_pcpin_init_session); // Initialize vars $_pcpin_online_users_count = 0; $_pcpin_online_users = array(); $_pcpin_online_users_colored = array(); $_pcpin_registered_users_count = 0; $_pcpin_registered_users = array(); $_pcpin_registered_users_colored = array(); $_pcpin_rooms_count = 0; $_pcpin_rooms = array(); // Get full memberlist $_pcpin_memberlist = $_pcpin_user->getMemberlist(false, 0, 0, 1, 0); foreach ($_pcpin_memberlist as $_pcpin_data) { if ($_pcpin_data['online_status'] > 0) { $_pcpin_online_users_count++; $_pcpin_online_users[] = htmlspecialchars($_pcpin_data['nickname_plain']);