* 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) || $current_user->is_admin !== 'y') { header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime())); die; } _pcpin_loadClass('version'); $version = new PCPIN_Version($session); // Load version data if ($version->_db_getList(1)) { $current_version = $version->_db_list[0]['version']; $last_check = $version->_db_list[0]['last_version_check'] > '0000-00-00 00:00:00' ? $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($version->_db_list[0]['last_version_check'])) : $l->g('never'); $new_version_available = $version->_db_list[0]['new_version_available']; $new_version_url = $version->_db_list[0]['new_version_url']; } else { $current_version = 6.0; $last_check = $l->g('never'); $new_version_available = $current_version; $new_version_url = ''; } $current_version = number_format($current_version, 2, '.', ''); $new_version_available = number_format($new_version_available, 2, '.', ''); if (!empty($do_check)) { // Check for new version // Generate new security key $key = PCPIN_Common::randomString(36, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-()[].,'); $version->setVersionCheckKey($key);
$current_user->show_message_time = 'y'; $current_user->_db_updateObj($current_user->id); } elseif (empty($pref_timestamp) && $current_user->show_message_time != 'n') { $current_user->show_message_time = 'n'; $current_user->_db_updateObj($current_user->id); } // "Allow sounds" preference if (!empty($pref_allow_sounds) && $current_user->allow_sounds != 'y') { $current_user->allow_sounds = 'y'; $current_user->_db_updateObj($current_user->id); } elseif (empty($pref_allow_sounds) && $current_user->allow_sounds != 'n') { $current_user->allow_sounds = 'n'; $current_user->_db_updateObj($current_user->id); } // "Message color" preference if (!empty($pref_message_color) && $current_user->outgoing_message_color != $pref_message_color) { $current_user->outgoing_message_color = $pref_message_color; $current_user->_db_updateObj($current_user->id); } // Get display positions of displayable banners $banner_display_positions = $banner->checktRoomBanners(); if (!empty($banner_display_positions)) { $xml_data['banner_display_position'] = $banner_display_positions; } unset($banner_display_positions); if ($last_message_id > $session->_s_last_message_id || $last_sent_message_time > 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) { // Update session $session->_s_updateSession($session->_s_id, true, true, null, null, null, null, null, null, $last_message_id > $session->_s_last_message_id ? $last_message_id : null, null, null, null, null, null, null, $last_sent_message_time > PCPIN_Common::datetimeToTimestamp($session->_s_last_sent_message_time) ? date('Y-m-d H:i:s', $last_sent_message_time) : null, $last_sent_message_hash != $session->_s_last_sent_message_hash ? $last_sent_message_hash : null, $last_sent_message_repeats_count != $session->_s_last_sent_message_repeats_count ? $last_sent_message_repeats_count : null); } } $xmlwriter->setData($xml_data);
* 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 (!isset($user_id)) { $user_id = 0; } $client_data = array(); // Get client session if (is_object($session) && !empty($current_user->id) && $session->_s_user_id == $current_user->id && $current_user->is_admin === 'y') { if ($session->_db_getList('_s_user_id = ' . $user_id, 1)) { // Client is online $xmlwriter->setHeaderMessage('OK'); $xmlwriter->setHeaderStatus(0); $sessiondata = $session->_db_list[0]; $session->_db_freeList(); $client_data = array('ip' => $sessiondata['_s_ip'], 'host' => gethostbyaddr($sessiondata['_s_ip']), 'agent' => $sessiondata['_s_client_agent_name'] . ' ' . $sessiondata['_s_client_agent_version'], 'os' => $sessiondata['_s_client_os'], 'session_start' => $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($sessiondata['_s_created']))); // Get language name $l->_db_getList('name, iso_name', 'id = ' . $sessiondata['_s_language_id'], 1); $client_data['language'] = $l->_db_list[0]['name'] . ' (' . $l->_db_list[0]['iso_name'] . ')'; $l->_db_freeList(); } else { // Client is not online $xmlwriter->setHeaderMessage($l->g('client_not_online')); $xmlwriter->setHeaderStatus(1); } } $xmlwriter->setData(array('client_data' => $client_data));
$_js_lng[] = 'ban_canceled_ip_equals'; $_js_lng[] = 'muted_locally'; $_js_lng[] = 'permanently_globalmuted'; $_js_lng[] = 'globalmuted_until'; $_js_lng[] = 'yes'; $_js_lng[] = 'no'; $_js_lng[] = 'create_new_room'; $_js_lng[] = 'room_is_password_protected'; $_js_lng[] = 'active'; $_js_lng[] = 'profile'; $_js_lng[] = 'guest'; $_js_lng[] = 'registered'; $_js_lng[] = 'admin'; // Add global vars to template foreach ($global_tpl_vars as $key => $val) { $tpl->addGlobalVar($key, htmlspecialchars($val)); } // Add language expressions to template foreach ($tpl->tpl_vars_plain as $var) { if (0 === strpos($var, 'LNG_')) { $var = strtolower($var); $tpl->addGlobalVar($var, htmlspecialchars($l->g(substr($var, 4)))); } } // Add other vars $tpl->addVar('main', 'welcome_message', htmlspecialchars(str_replace('[USER]', $current_user->login, $l->g('welcome_user')))); if ($current_user->is_guest == 'n') { $tpl->addVar('last_login', 'last_login', htmlspecialchars($current_user->previous_login > '0000-00-00 00:00:00' ? $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($current_user->previous_login)) : $l->g('never'))); } $template->addVar('moderator_user_options', 'display', $current_user->moderated_rooms != '' || $current_user->is_admin === 'y'); $template->addVar('admin_user_options', 'display', $current_user->is_admin === 'y');
* 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 (!isset($user_id)) { $user_id = 0; } _pcpin_loadClass('nickname'); $nickname = new PCPIN_Nickname($session); _pcpin_loadClass('invitation'); $invitation = new PCPIN_Invitation($session); if (!empty($current_user->id)) { $xmlwriter->setHeaderMessage($l->g('error')); $xmlwriter->setHeaderStatus(1); if ($current_user->global_muted_until > date('Y-m-d H:i:s')) { $xmlwriter->setHeaderMessage($l->g('you_are_muted_until')); $xmlwriter->setHeaderMessage(str_replace('[EXPIRATION_DATE]', $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($current_user->global_muted_until)), $message)); } elseif ($current_user->global_muted_permanently == 'y') { $xmlwriter->setHeaderMessage($l->g('you_are_muted_permanently')); } else { if (!empty($session->_s_room_id) && !empty($user_id) && $current_user->_db_getList('id', 'id = ' . $user_id, 1)) { // User exists if ($session->_db_getList('_s_room_id, _s_stealth_mode', '_s_user_id = ' . $user_id, 1)) { // User is online if ($session->_db_list[0]['_s_room_id'] == $session->_s_room_id) { // User is already in desired room if ($session->_db_list[0]['_s_stealth_mode'] == 'y' && $current_user->is_admin !== 'y') { // Invited user is in stealth mode, produce a dummy message $xmlwriter->setHeaderStatus(0); $xmlwriter->setHeaderMessage(str_replace('[USER]', $nickname->coloredToPlain($nickname->getDefaultNickname($user_id), false), $l->g('invitation_sent'))); } else { $xmlwriter->setHeaderStatus(1);
* 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']); } } $xmlwriter->setData(array('address' => $ip_addresses));
case '1': $abuse_category = $l->g('spam'); break; case '2': $abuse_category = $l->g('insult'); break; case '3': $abuse_category = $l->g('adult_content'); break; case '4': $abuse_category = $l->g('illegal_content'); break; case '5': $abuse_category = $l->g('harassment'); break; case '6': $abuse_category = $l->g('fraud'); break; default: $abuse_category = $l->g('other'); break; } $abuses_xml[] = array('id' => $message_data['id'], 'date' => $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($message_data['date'])), 'author_id' => $message_data['author_id'], 'author_nickname' => $message_data['author_nickname'], 'category' => $abuse_category, 'room_id' => $msg_parts[1], 'room_name' => $room_name, 'abuser_nickname' => $msg_parts[3], 'description' => $msg_parts[4]); } } if ($last_message_id > $session->_s_last_message_id) { // Update session $session->_s_updateSession($session->_s_id, true, true, null, null, null, null, null, null, $last_message_id); } } $xmlwriter->setData(array('abuse' => $abuses_xml));
} elseif (md5($password) == $userdata['password_new']) { // New password OK $new_password_ok = true; } if (true === $password_ok || true === $new_password_ok) { // Login and password are OK $failed_login_class->clearCounter(PCPIN_CLIENT_IP); // Account activated? if (!empty($session->_conf_all['activate_new_accounts']) && $userdata['activated'] != 'y') { // Account is NOT activated $xmlwriter->setHeaderMessage($l->g('login_failed')); } else { // User banned? if ($userdata['banned_until'] > date('Y-m-d H:i:s')) { // User is temporarily banned $banned_until_str = $current_user->makeDate(PCPIN_Common::datetimeToTimestamp($userdata['banned_until'])); if ($userdata['ban_reason'] != '') { $xmlwriter->setHeaderMessage(str_replace('[REASON]', $userdata['ban_reason'], $l->g('you_are_banned_with_reason'))); } else { $xmlwriter->setHeaderMessage($l->g('you_are_banned_without_reason')); } $xmlwriter->setHeaderMessage(str_replace('[DATE]', $banned_until_str, $message)); } elseif ($userdata['banned_permanently'] == 'y') { // User is permanently banned if ($userdata['ban_reason'] != '') { $xmlwriter->setHeaderMessage(str_replace('[REASON]', $userdata['ban_reason'], $l->g('you_are_banned_permanently_with_reason'))); } else { $xmlwriter->setHeaderMessage($l->g('you_are_banned_permanently_without_reason')); } } else { $xmlwriter->setHeaderMessage('OK');
/** * Get banners list * @return array */ function getBanners() { $banners = array(); if ($this->_db_getList('display_position DESC, name ASC')) { foreach ($this->_db_list as $data) { $data['start_date'] = PCPIN_Common::datetimeToTimestamp($data['start_date']); $data['expiration_date'] = $data['expiration_date'] > '0000-00-00 00:00:00' ? PCPIN_Common::datetimeToTimestamp($data['expiration_date']) : 0; $banners[] = $data; } $this->_db_freeList(); } return $banners; }