/** * Increase failed logins counter for specified IP address and ban it if maximum allowed login attempt limit exceeds. * This method must be called on every failed login attempt. * @param string $ip IP address * @param string $ban_reason Reason for ban, if issued */ function increaseCounter($ip, $ban_reason = '') { $ip = trim($ip); if (!empty($ip)) { if ($this->_db_query($this->_db_makeQuery(2090, $ip))) { if (!empty($this->_conf_all['ip_failed_login_limit']) && $this->_db_getList('count', 'ip =# ' . $ip, 1)) { if ($this->_db_list[0]['count'] > $this->_conf_all['ip_failed_login_limit']) { _pcpin_loadClass('ipfilter'); $ban = new PCPIN_IPFilter($this); $ban->addAddress($ip, date('Y-m-d H:i:s', time() + 3600 * $this->_conf_all['ip_failed_login_ban']), $ban_reason, 'd'); $this->clearCounter($ip); } } } } }
/** * Delete attachment * @param int $id Optional. Attachment ID * @param int $message_id Optional. Message ID * @return boolean TRUE on success or FALSE on error */ function deleteAttachment($id = 0, $message_id = 0) { $result = false; _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($this); if (!empty($id) && $this->_db_getList('binaryfile_id', 'id = ' . $id, 1)) { $result = true; $binaryfile->deleteBinaryFile($this->_db_list[0]['binaryfile_id']); $this->_db_deleteRow($id); } elseif (!empty($message_id) && $this->_db_getList('id,binaryfile_id', 'message_id = ' . $message_id)) { $result = true; $ids = $this->_db_list; foreach ($ids as $data) { $binaryfile->deleteBinaryFile($data['binaryfile_id']); $this->_db_deleteRow($data['id']); } } $this->_db_freeList(); return $result; }
/** * Add new userdata record * @param int $user_id User ID * @param array $fields Associative array with field ID as KEY and field value as VAL */ function addNewUserData($user_id, $fields = array()) { // Get available userdata fields _pcpin_loadClass('userdata_field'); $userdata_field = new PCPIN_UserData_Field($this); $userdata_field->_db_getList('id,default_value'); $list = $userdata_field->_db_list; $userdata_field->_db_freeList(); $fields_new = array(); foreach ($list as $data) { if (isset($fields[$data['id']])) { $fields_new[$data['id']] = $fields[$data['id']]; } else { $fields_new[$data['id']] = $data['default_value']; } } // Insert data rows $this->user_id = $user_id; foreach ($fields_new as $key => $val) { $this->field_id = $key; $this->field_value = $val; $this->_db_insertObj(); } }
* 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('badword'); $badword = new PCPIN_Badword($session); $errortext = array(); if (!isset($word)) { $word = ''; } if (!isset($replacement)) { $replacement = ''; } if (!empty($current_user->id) && $current_user->is_admin === 'y') { if ($word == '') { $errortext[] = $l->g('word_empty_error'); } if ($badword->_db_getList('word = ' . $word, 1)) { $errortext[] = str_replace('[WORD]', $word, $l->g('word_already_exists_error')); $badword->_db_freeList();
* 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('nickname'); $nickname = new PCPIN_Nickname($session); if (empty($profile_user_id) || $profile_user_id != $current_user->id && $current_user->is_admin !== 'y') { $profile_user_id = $current_user->id; } if (empty($nickname_id) || !is_scalar($nickname_id)) { $nickname_id = 0; } if (!empty($nickname_id) && $nickname->_db_getList('id,default', 'id = ' . $nickname_id, 'user_id = ' . $profile_user_id, 1)) { // Nickname exists $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); if ($nickname->_db_list[0]['default'] != 'y') { $nickname->setDefault($nickname_id, $profile_user_id); } $nickname->_db_freeList();
/** * 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));
* @param int $sort_by Sort by... Values: see $user->getMemberlist() * @param int $sort_dir Sort direction. Values: see $user->getMemberlist() * @param int $page_nr Page number. * @param boolean $banned_only Optional. If TRUE, then only banned users will be listed * @param boolean $muted_only Optional. If TRUE, then only muted users will be listed * @param boolean $moderators_only Optional. If TRUE, then only moderators will be listed * @param boolean $admins_only Optional. If TRUE, then only admins will be listed * @param boolean $not_activated_only Optional. If TRUE, then only not activated user accounts will be listed * @param string $user_ids Optional. User IDs separated by comma * @param int $load_custom_fields Optional. If not empty, custom profile fields will be loaded */ _pcpin_loadClass('room'); $room = new PCPIN_Room($session); _pcpin_loadClass('category'); $category = new PCPIN_Category($session); _pcpin_loadClass('userdata'); $userdata = new PCPIN_UserData($session); if (!isset($nickname) || !is_scalar($nickname)) { $nickname = ''; } if (!isset($sort_by) || !pcpin_ctype_digit($sort_by)) { $sort_by = 0; } if (!isset($sort_dir) || !pcpin_ctype_digit($sort_dir)) { $sort_dir = 0; } if (!isset($page) || !pcpin_ctype_digit($page)) { $page = 0; } if (!isset($banned_only) || $current_user->is_admin !== 'y') { $banned_only = false;
* 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('disallowed_name'); $disallowed_name = new PCPIN_Disallowed_Name($session); $errortext = array(); if (!isset($name)) { $name = ''; } if (!empty($current_user->id) && $current_user->is_admin === 'y') { if ($name == '') { $errortext[] = $l->g('name_empty_error'); } if ($disallowed_name->_db_getList('name = ' . $name, 1)) { $errortext[] = str_replace('[NAME]', $name, $l->g('name_already_exists_error')); $disallowed_name->_db_freeList(); } if (empty($errortext)) { // Save word
$current_user->globalMuteUnmute($current_user->id, 1, $session->_conf_all['flood_protection_mute_time'] / 60, $l->g('flooding')); $msg->addMessage(10110, 'n', 0, $l->g('server'), $session->_s_room_id, 0, $current_user->id . '/0/' . $session->_conf_all['flood_protection_mute_time'] / 60 . '/' . $l->g('flooding'), date('Y-m-d H:i:s'), 0, ''); $last_sent_message_repeats_count = 0; $last_sent_message_hash = ''; break; // Ignore further messages } else { // Add message to database $last_sent_message_time = time(); $msg->addMessage($type, $offline, $current_user->id, $current_nickname, $target_room_id, $target_user_id, $body, date('Y-m-d H:i:s'), $privacy, $css_properties); // Attachments? _pcpin_loadClass('attachment'); $attachment = new PCPIN_Attachment($session); _pcpin_loadClass('message_log_attachment'); $message_log_attachment = new PCPIN_Message_Log_Attachment($session); _pcpin_loadClass('binaryfile'); $binaryfile = new PCPIN_BinaryFile($session); if (!empty($tmpdata_list)) { foreach ($tmpdata_list as $tmpdata_data) { $attachment->addAttachment($msg->id, $tmpdata_data['binaryfile_id'], $tmpdata_data['filename']); if (!empty($session->_conf_all['logging_period']) && $binaryfile->_db_getList('body,size,mime_type', 'id = ' . $tmpdata_data['binaryfile_id'], 1)) { $message_log_attachment->addLogRecord($msg->id, $tmpdata_data['filename'], $binaryfile->_db_list[0]['body'], $binaryfile->_db_list[0]['size'], $binaryfile->_db_list[0]['mime_type']); $binaryfile->_db_freeList(); } } } } } } } }
* (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'); $xmlwriter->setHeaderStatus(0);
// Get software version if (!defined('PCPIN_NO_SESSION') && empty($_GET['external_url'])) { _pcpin_loadClass('version'); $_pcpin_version = new PCPIN_Version($_pcpin_init_session); if ($_pcpin_version->_db_getList('version', 1)) { define('PCPIN_VERSION', number_format($_pcpin_version->_db_list[0]['version'], 2, '.', '')); $_pcpin_version->_db_freeList(); unset($_pcpin_version); } else { define('PCPIN_VERSION', '0.00'); } } // 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); } } /**
* * "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/>. */ // Initiate XML writer object _pcpin_loadClass('xmlwrite'); $xmlwriter = new PCPIN_XMLWrite($ajax); // Defaults $xmlwriter->setHeaderMessage('ACCESS_DENIED'); $xmlwriter->setHeaderStatus(-1); if (!empty($ajax) && is_scalar($ajax)) { // AJAX request switch ($ajax) { case 'add_avatar_gallery': // Add new avatar into Avatar gallery require_once './inc/ajax/add_avatar_gallery.inc.php'; break; case 'add_banner': // Add new banner require_once './inc/ajax/add_banner.inc.php'; break;
/** * Delete existing field * @param int $field_id Field ID */ function deleteField($field_id) { if (!empty($field_id) && $this->_db_getList('id', 'id =# ' . $field_id, 'custom = y', 1)) { $this->_db_freeList(); if ($this->_db_deleteRow($field_id)) { // Delete field from all userdata records _pcpin_loadClass('userdata'); $userdata = new PCPIN_UserData($this); $userdata->_db_deleteRow($field_id, 'field_id', true); } } }
* (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 addresses listed in IP filter table * @param int $sort_by Sort by (0: Address, 1: Action type, 2: Expiration date, 3: Description, 4: "Added on" date) * @param int $sort_dir Sort direction (0: Ascending, 1: Descending) */ _pcpin_loadClass('ipfilter'); $ipfilter = new PCPIN_IPFilter($session); $ip_addresses = array(); if (!isset($sort_by)) { $sort_by = 0; } if (!isset($sort_dir)) { $sort_dir = 0; } // Get client session if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') { $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); $addresses = $ipfilter->readAddresses($sort_by, $sort_dir); foreach ($addresses as $address_data) { $ip_addresses[] = array('id' => $address_data['id'], 'type' => $address_data['type'], 'mask' => $address_data['address'], 'added_on' => $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($address_data['added_on'])), 'expires' => $address_data['expires'] > '0000-00-00 00:00:00' ? $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($address_data['expires'])) : $l->g('never'), 'action' => $address_data['action'], 'description' => $address_data['description']);
* * "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 smilie * @param int $smilie_id Smilie ID * @param string $code New smilie code * @param string $description New smilie description */ _pcpin_loadClass('smilie'); $smilie = new PCPIN_Smilie($session); if (!isset($smilie_id) || !pcpin_ctype_digit($smilie_id)) { $smilie_id = 0; } if (!isset($code) || !is_scalar($code)) { $code = ''; } if (!isset($description) || !is_scalar($description)) { $description = ''; } // Get client session if (is_object($session) && !empty($current_user->id) && $session->_s_user_id == $current_user->id && $current_user->is_admin === 'y') { $xmlwriter->setHeaderMessage($l->g('changes_saved')); $xmlwriter->setHeaderStatus(0); if (!empty($smilie_id)) {
* 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/>. */ /** * Get available languages list */ _pcpin_loadClass('language_expression'); $language_expression = new PCPIN_Language_Expression($session); $expressions = array(); $total_count = 0; if (!isset($language_id) || !is_scalar($language_id)) { $language_id = 0; } if (!isset($start_from) || !is_scalar($start_from)) { $start_from = 0; } if (!isset($max_results) || !is_scalar($max_results)) { $max_results = 100; } if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') { $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0);
<?php /** * 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/>. */ if (!empty($current_user->id)) { $session->_s_logOut(); // Reinit current user object _pcpin_loadClass('user'); $current_user = new PCPIN_User($session); $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); }
/** * Global mute/unmute user * @param int $user_id User ID * @param int $action Action: (1: mute, 0: unmute) * @param int $mute_time If user will be muted: For how many minutes (0 means permanent mute) * @param string $mute_reason If user will be muted: Mute reason (optional) * @param int $muted_by_user_id If user will be muted: ID of user who muted him * @param int $muted_by_username If user will be muted: Nickname of user who muted him * @return boolean TRUE on success or FALSE on error */ function globalMuteUnmute($user_id, $action = 1, $mute_time = 0, $mute_reason = '', $muted_by_user_id = 0, $muted_by_username = '') { $result = false; _pcpin_loadClass('user'); $user = new PCPIN_User($this); if (!empty($user_id) && $user->_db_getList('id,global_muted_until,global_muted_permanently', 'id = ' . $user_id, 1)) { if ($action == 0) { // Unmute user $result = true; if ($user->_db_list[0]['global_muted_permanently'] == 'y' || $user->_db_list[0]['global_muted_until'] > '0000-00-00 00:00:00') { // User is muted $result = $user->_db_updateRow($user_id, 'id', array('global_muted_until' => '', 'global_muted_permanently' => 'n', 'global_muted_reason' => '')); } } elseif ($action == 1) { // Mute user $mute_reason = trim($mute_reason); $result = $user->_db_updateRow($user_id, 'id', array('global_muted_until' => empty($mute_time) ? '' : date('Y-m-d H:i:s', time() + $mute_time * 60), 'global_muted_permanently' => empty($mute_time) ? 'y' : 'n', 'global_muted_reason' => trim($mute_reason), 'global_muted_by' => trim($muted_by_user_id), 'global_muted_by_username' => trim($muted_by_username))); } } return $result; }
* 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/>. */ if (!is_object($session)) { die('Access denied'); } _pcpin_loadClass('banner'); $banner = new PCPIN_Banner($session); if (empty($banner_id)) { $banner_data = $banner->getRandomBanner($load_banner); } elseif ($banner->_db_getList('id = ' . $banner_id, 1)) { $banner_data = $banner->_db_list[0]; } if (empty($banner_data)) { // No banners loaded header('Location: dummy.html'); } else { switch ($banner_data['source_type']) { case 'u': header('Location: ' . PCPIN_FORMLINK . '?external_url=' . urlencode($banner_data['source'])); die; break;
/** * Create XML string. The <data> element will be filled from $this->xml_data array, format as follows: * $this->xml_data = array ( <KEY> => <VAL>, <KEY> => <VAL>, {...} ) * <KEY> - when integer: repeated parent element, otherwise: name of an element * <VAL> - when scalar or NULL: CDATA, when Array: see $this->xml_data * @return string */ function makeXML() { if (PCPIN_XMLWRITER_BUILT_IN) { // Using built-in XMLWriter functionality return $this->makeXML_XMLWriter(); } else { // Using custom implementation if (function_exists('_pcpin_loadClass')) { _pcpin_loadClass('xmlwriter_custom'); } $xml = new PCPIN_XMLWriter_Custom(); return $xml->makeXML($this); } }
/** * Set user avatar from Avatar Gallery * @param int $user_id User ID * @param int $avatar_id Avatar ID * @return boolean TRUE on success or FALSE on error */ function setAvatarFromGallery($user_id = 0, $avatar_id = 0) { $result = false; if (!empty($user_id) && !empty($avatar_id) && $this->_db_getList('binaryfile_id', 'id = ' . $avatar_id, 'user_id = 0', 1)) { // Avatar exists $binaryfile_id = $this->_db_list[0]['binaryfile_id']; _pcpin_loadClass('user'); $user = new PCPIN_User($this); if ($user->_db_getList('id', 'id = ' . $user_id, 1)) { // User exists $user->_db_freeList(); // Does user has primary avatar if ($this->_db_getList('id', 'user_id = ' . $user_id, 'primary = y', 1)) { // There is already one primary avatar $this->primary = 'n'; $this->_db_freeList(); } else { // This avatar will be primary $this->primary = 'y'; } // Insert avatar $this->id = 0; $this->user_id = $user_id; $this->binaryfile_id = $binaryfile_id; $result = $this->_db_insertObj(); } } return $result; }
/** * Set new online status * @param int $status New online status * @param string $status_msg New online status message * @return boolean TRUE on success or FALSE on error */ function _s_setOnlineStatus($status = 0, $status_msg = '') { if (!empty($this->_s_id) && !empty($status) && is_scalar($status)) { $status_msg = trim($status_msg); // Update session $this->_s_updateSession($this->_s_id, true, true, null, null, null, null, null, null, null, null, null, $status, $status_msg); // Insert new system message (only if user in a room) if (!empty($this->_s_room_id)) { _pcpin_loadClass('message'); $message = new PCPIN_Message($this); $message->addMessage(102, 'n', 0, '', $this->_s_room_id, 0, $this->_s_user_id . '/' . $status . '/' . $status_msg); } } }
* 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('userdata_field'); $userdata_field = new PCPIN_UserData_Field($session); if (!isset($field_id)) { $field_id = 0; } $status = -1; $messages = array(); if (is_object($session) && !empty($current_user->id) && $session->_s_user_id == $current_user->id && $current_user->is_admin === 'y') { $status = 1; if (!empty($field_id)) { if (isset($name)) { $name = trim($name); if ($name == '') { $messages[] = $l->g('name_empty_error'); } }
/** * 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; }
* 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('avatar'); $avatar = new PCPIN_Avatar($session); if (empty($profile_user_id) || $profile_user_id != $current_user->id && $current_user->is_admin !== 'y') { $profile_user_id = $current_user->id; } if (empty($avatar_id) || !is_scalar($avatar_id)) { $avatar_id = 0; } if (!empty($profile_user_id) && !empty($avatar_id) && $avatar->_db_getList('id,binaryfile_id', 'id = ' . $avatar_id, 'user_id = 0', 1)) { $binaryfile_id = $avatar->_db_list[0]['binaryfile_id']; // Check avatars limit $avatar->_db_getList('COUNT', 'user_id = ' . $profile_user_id); if ($avatar->_db_list_count >= $session->_conf_all['avatars_max_count']) { // Limit reached $xmlwriter->setHeaderMessage(str_replace('[NUMBER]', $session->_conf_all['avatars_max_count'], $l->g('avatars_limit_reached'))); $xmlwriter->setHeaderStatus(1);
* 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('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);
} } } if (empty($preselect_language)) { $preselect_language = $session->_conf_all['default_language']; } $l->setLanguage($preselect_language); $message = $l->g('access_denied'); if (!isset($activation_code) || !is_scalar($activation_code)) { $activation_code = ''; } _pcpin_loadClass('user'); $user = new PCPIN_User($session); _pcpin_loadClass('message'); $msg = new PCPIN_Message($session); _pcpin_loadClass('pcpintpl'); $tpl = new PcpinTpl(); $tpl->setBasedir('./tpl'); $tpl->readTemplatesFromFile('./dummy.tpl'); if ($activation_code != '') { if (isset($activate_email)) { // New email address activation if ($user->_db_getList('email_new != ', 'email_new_activation_code = ' . md5($activation_code), 1)) { // Requested email address found and activation code is OK $user->_db_setObject($user->_db_list[0]); $user->email = $user->email_new; $user->email_new = ''; $user->email_new_date = ''; $user->email_new_activation_code = ''; $user->_db_updateObj($user->id); $message = $l->g('new_email_activated');
/** * Get last messages for user * @param int $user_id User ID * @param int $count Messages count to return * @return array */ function getLastMessages($user_id, $count = 0) { $messages = array(); if (!empty($user_id) && !empty($count)) { $query = $this->_db_makeQuery(1300, $user_id, $count * 1, 3001); if ($result = $this->_db_query($query)) { _pcpin_loadClass('attachment'); $attachment = new PCPIN_Attachment($this); while ($data = $this->_db_fetch($result, MYSQL_ASSOC)) { if ($data['has_attachments'] == '1') { // Get attachments $data['attachment'] = $attachment->getAttachments($data['id']); } $messages[] = $data; } $this->_db_freeResult($result); } } return $messages; }
* 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('message'); $msg = new PCPIN_Message($session); if (!isset($target_user_id) || !is_scalar($target_user_id)) { $target_user_id = 0; } if (!empty($current_user->id) && $current_user->is_admin === 'y' && $session->_s_user_id == $current_user->id) { $xmlwriter->setHeaderStatus(1); if (!empty($target_user_id) && $current_user->_db_getList('banned_permanently,banned_until', 'id = ' . $target_user_id, 1)) { // User exists $xmlwriter->setHeaderStatus(0); $xmlwriter->setHeaderMessage('OK'); if ($current_user->_db_list[0]['banned_permanently'] == 'y' || $current_user->_db_list[0]['banned_until'] > date('Y-m-d H:i:s')) { // Add new message $msg->addMessage(10107, 'n', $current_user->id, $current_nickname, 0, 0, $target_user_id . '/' . $current_user->id, date('Y-m-d H:i:s'), 0, ''); // Unban user $current_user->banUnban($target_user_id, 0);
* 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']; } if (!isset($password_protect) || !pcpin_ctype_digit($password_protect)) { $password_protect = 0; }