} // Are there new messages in request? if (!empty($new_messages) && is_array($new_messages)) { // There are some new messages from user // Need to change online status? //if ($session->_s_online_status!=1) { // $session->_s_setOnlineStatus(1, $l->g('online_status_1')); //} if ($session->_s_online_status == 2 || $session->_s_online_status == 3) { $session->_s_setOnlineStatus(1, $l->g('online_status_1')); } foreach ($new_messages as $data) { if (isset($data['body'])) { // Attachments? _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); $tmpdata->_db_getList('user_id = ' . $current_user->id, 'type = 3'); $tmpdata_list = $tmpdata->_db_list; $tmpdata->_db_freeList(); if (!empty($tmpdata_list)) { $tmpdata->deleteUserRecords($current_user->id, 3, 0, true); } $data['body'] = trim($data['body']); if ($data['body'] != '' || !empty($tmpdata_list)) { $type = isset($data['type']) ? $data['type'] : 0; $offline = isset($data['offline']) ? $data['offline'] : 'n'; $target_room_id = isset($data['target_room_id']) ? $data['target_room_id'] : $session->_s_room_id; $target_user_id = isset($data['target_user_id']) ? $data['target_user_id'] : 0; $body = _pcpin_substr($data['body'], 0, $session->_conf_all['message_length_max']); $privacy = isset($data['privacy']) ? $data['privacy'] : 0; $css_properties = isset($data['css_properties']) ? $data['css_properties'] : '';
* (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']; } if (!isset($password_protect) || !pcpin_ctype_digit($password_protect)) { $password_protect = 0; } if (!isset($password) || !is_scalar($password)) {
* 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('smilie'); $smilie = new PCPIN_Smilie($session); _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); $errortext = array(); if (!isset($code)) { $code = ''; } if (!isset($description)) { $description = ''; } if (!empty($current_user->id) && $current_user->is_admin === 'y') { $xmlwriter->setHeaderStatus(1); if ($code == '') { $errortext[] = $l->g('smilie_code_empty_error'); } $tmpdata->_db_getList('id, binaryfile_id', 'user_id = ' . $current_user->id, 'type = 2', 1);
/** * 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'); } }
case PCPIN_IMAGE_CHECK_ERROR_NOT_IMAGE: // File is not an image or has incompatible format $upload_status = array('code' => 200, 'message' => $l->g('image_type_not_allowed')); break; } if ($upload_status['code'] === 0) { // Image OK $width = $img_data['width']; $height = $img_data['height']; _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); if ($binaryfile->newBinaryFile(file_get_contents($f_data['tmp_name']), $img_data['mime'], $width, $height, '')) { $binaryfile_id = $binaryfile->id; if (!empty($binaryfile->id)) { _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); $tmpdata->_db_deleteRowMultiCond(array('user_id' => $current_user->id, 'type' => 2)); $tmpdata->addRecord(2, $current_user->id, $binaryfile_id, $filename); } } } break; } } } _pcpin_loadClass('pcpintpl'); $tpl = new PcpinTpl(); $tpl->setBasedir('./tpl'); $tpl->readTemplatesFromFile('./file_upload.tpl'); // JS files $_js_files[] = './js/file_upload.js';
*/ $_force_buggy_doctype = true; // Do not hide <!DOCTYPE> declaration for IE6 // Load colorbox $_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;
* 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/>. */ /** * Delete temporary message attachment * @param int $binaryfile_id Binaryfile ID of the attachment */ if (!isset($binaryfile_id) || !pcpin_ctype_digit($binaryfile_id)) { $binaryfile_id = 0; } _pcpin_loadClass('tmpdata'); $tmpdata = new PCPIN_TmpData($session); if (!empty($current_user->id)) { $xmlwriter->setHeaderStatus(0); $xmlwriter->setHeaderMessage('OK'); if (!empty($binaryfile_id)) { $tmpdata->deleteUserRecords($current_user->id, 3, $binaryfile_id); } }
/** * 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; }