コード例 #1
0
 *
 *    "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);
_pcpin_loadClass('message');
$msg = new PCPIN_Message($session);
_pcpin_loadClass('badword');
$badword = new PCPIN_Badword($session);
_pcpin_loadClass('disallowed_name');
$disallowed_name = new PCPIN_Disallowed_Name($session);
$nicknames_xml = array();
$new_nickname_id = 0;
if (empty($profile_user_id) || $profile_user_id != $current_user->id && $current_user->is_admin !== 'y') {
    $profile_user_id = $current_user->id;
}
if (!isset($nickname_id) || !is_scalar($nickname_id)) {
    $nickname_id = 0;
}
if (!isset($new_nickname) || !is_scalar($new_nickname)) {
コード例 #2
0
 * Get current chat state
 * @param   int       $room_id              ID of the room where the request was sent from
 * @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;
コード例 #3
0
 *    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)) {
    header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime()));
    die;
}
$_js_files[] = './js/call_moderator.js';
$_js_lng[] = 'abuser_nickname_empty';
$_js_lng[] = 'violation_category_not_selected';
_pcpin_loadClass('nickname');
$nickname = new PCPIN_Nickname($session);
_pcpin_loadClass('pcpintpl');
$tpl = new PcpinTpl();
$tpl->setBasedir('./tpl');
$tpl->readTemplatesFromFile('./call_moderator.tpl');
$_body_onload[] = 'initCMBox()';
$_window_title .= ' ' . PCPIN_WINDOW_TITLE_SEPARATOR . ' SOS ' . PCPIN_WINDOW_TITLE_SEPARATOR . ' ' . $l->g('call_moderator');
// 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))));
コード例 #4
0
 *    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) || empty($current_user->id) || empty($invitation_id)) {
    header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime()));
    die;
}
$_js_files[] = './js/invitation.js';
_pcpin_loadClass('invitation');
$invitation = new PCPIN_Invitation($session);
_pcpin_loadClass('nickname');
$nickname = new PCPIN_Nickname($session);
$invitations = $invitation->getNewInvitations($current_user->id, false, $invitation_id);
if (empty($invitations)) {
    $_body_onload[] = 'window.close()';
    $_body_onload[] = 'return false';
} else {
    $invitation_data = reset($invitations);
    // Init template
    _pcpin_loadClass('pcpintpl');
    $tpl = new PcpinTpl();
    $tpl->setBasedir('./tpl');
    $tpl->readTemplatesFromFile('./invitation.tpl');
    // Add language expressions to template
    foreach ($tpl->tpl_vars_plain as $var) {
        if (0 === strpos($var, 'LNG_')) {
            $var = strtolower($var);
コード例 #5
0
// Slave mode: need login?
if (PCPIN_SLAVE_MODE && empty($session->_s_user_id) && empty($b_id) && empty($external_url) && empty($load_banner) && !defined('PCPIN_NO_SESSION')) {
    // User is not logged in yet
    require './mods/slave_mode.inc.php';
}
// 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)) {
コード例 #6
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/>.
 */
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
コード例 #7
0
 *
 *    "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);
_pcpin_loadClass('message');
$msg = new PCPIN_Message($session);
if (empty($profile_user_id) || $profile_user_id != $current_user->id && $current_user->is_admin !== 'y') {
    $profile_user_id = $current_user->id;
}
$nicknames_xml = array();
if (!empty($profile_user_id) && !empty($nickname_id)) {
    // Delete nickname
    $nickname->deleteNickname($profile_user_id, $nickname_id);
    $xmlwriter->setHeaderMessage($l->g('nickname_deleted'));
    $xmlwriter->setHeaderStatus(0);
    // Get nicknames list
    $nicknames = $nickname->getNicknames($profile_user_id);
    foreach ($nicknames as $nickname_data) {
        $nicknames_xml[] = array('id' => $nickname_data['id'], 'nickname' => $nickname_data['nickname'], 'nickname_plain' => $nickname_data['nickname_plain'], 'default' => $nickname_data['default']);
コード例 #8
0
 *
 *    "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();
}
コード例 #9
0
 *
 *    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)) {
    header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime()));
    die;
}
// Load colorbox
$_load_colorbox = true;
// Load smiliebox
$_load_smiliebox = true;
// Default: Do not context menu user options
$_load_cm_user_options = true;
_pcpin_loadClass('nickname');
$nickname = new PCPIN_Nickname($session);
$_js_files[] = './js/user.js';
$_js_files[] = './js/pm_box.js';
$_js_lng[] = 'private_message';
_pcpin_loadClass('pcpintpl');
$tpl = new PcpinTpl();
$tpl->setBasedir('./tpl');
$tpl->readTemplatesFromFile('./pm_box.tpl');
if (empty($target_user_id) || $target_user_id == $current_user->id || !$current_user->_db_getList('id', 'id = ' . $target_user_id, 1)) {
    $_body_onload[] = 'window.close()';
} else {
    $_body_onload[] = 'initSmilieList()';
    $current_user->_db_freeList();
    $target_user_nickname = $nickname->getDefaultNickname($target_user_id);
    $_body_onload[] = 'initPMBox(' . $target_user_id . ', 60)';
    $_window_title = $nickname->coloredToPlain($target_user_nickname, false) . '::' . $l->g('private_message') . ' (' . $session->_conf_all['chat_name'] . ')';
コード例 #10
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/>.
 */
_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;
}
$nicknames_xml = array();
if (!empty($current_user->id)) {
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    $nicknames = $nickname->getNicknames($profile_user_id);
    foreach ($nicknames as $nickname_data) {
        $nicknames_xml[] = array('id' => $nickname_data['id'], 'nickname' => $nickname_data['nickname'], 'nickname_plain' => $nickname_data['nickname_plain'], 'default' => $nickname_data['default']);
    }
}
$xmlwriter->setData(array('nickname' => $nicknames_xml));
コード例 #11
0
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);
    } else {
        $xmlwriter->setHeaderMessage($l->g('abuse_report_sent'));
        $xmlwriter->setHeaderStatus(0);
        $moderators = $room->getModerators($session->_s_room_id);
        if (empty($moderators)) {
            // Room has no moderators. Admin(s) will receive an abuse then.
            $moderators = $current_user->getAdmins();
        }
        _pcpin_loadClass('nickname');
        $nickname = new PCPIN_Nickname($session);
        $old_language_id = $l->id;
        // Create message body
        $body = $current_user->id . '/' . $session->_s_room_id . '/' . $abuse_category * 1 . '/' . trim(str_replace('/', ' ', $abuse_nickname)) . '/' . trim($abuse_description);
        foreach ($moderators as $data) {
            _pcpin_loadClass('user');
            $tmp_user = new PCPIN_User($session);
            $tmp_user->_db_loadObj($data['id']);
            if (!empty($data['is_online'])) {
                // User is online
                $msg->addMessage(4001, 'n', $session->_s_user_id, $current_nickname, 0, $data['id'], $body, date('Y-m-d H:i:s'), 2);
            } else {
                // Add offline message
                //      $msg->addMessage(4001, 'y', $session->_s_user_id, $current_nickname, 0, $data['id'], $body, date('Y-m-d H:i:s'), 2);
            }
            // Load language
コード例 #12
0
 /**
  * Delete user
  * @param   int   $user_id    User ID
  * @return  boolean   TRUE on success or FALSE on error
  */
 function deleteUser($user_id)
 {
     $result = false;
     if (!empty($user_id) && $this->_db_getList('id', 'id = ' . $user_id, 1)) {
         // Delete user
         if ($result = $this->_db_deleteRow($user_id)) {
             // Delete all avatars owned by user
             _pcpin_loadClass('avatar');
             $avatar = new PCPIN_Avatar($this);
             $avatar->deleteAvatar($user_id);
             // Delete all nicknames owned by user
             _pcpin_loadClass('nickname');
             $nickname = new PCPIN_Nickname($this);
             $nickname->deleteAllNickname($user_id);
             // Delete all messages sent TO this user
             _pcpin_loadClass('message');
             $message = new PCPIN_Message($this);
             if ($message->_db_getList('id', 'target_user_id = ' . $user_id)) {
                 $message_ids = array();
                 foreach ($message->_db_list as $data) {
                     $message_ids[] = $data['id'];
                 }
                 $message->_db_freeList();
                 $message->deleteMessages($message_ids);
             }
             // Delete userdata
             _pcpin_loadClass('userdata');
             $userdata = new PCPIN_UserData($this);
             $userdata->deleteUserData($user_id);
             // Update all users who ignored deleted user
             if ($res = $this->_db_query($this->_db_makeQuery(2050, $user_id))) {
                 $this->_db_freeResult($res);
             }
         }
     }
     return $result;
 }
コード例 #13
0
 *
 *    "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);
_pcpin_loadClass('message');
$msg = new PCPIN_Message($session);
_pcpin_loadClass('badword');
$badword = new PCPIN_Badword($session);
_pcpin_loadClass('disallowed_name');
$disallowed_name = new PCPIN_Disallowed_Name($session);
$nicknames_xml = array();
$new_nickname_id = 0;
if (empty($profile_user_id) || $profile_user_id != $current_user->id && $current_user->is_admin !== 'y') {
    $profile_user_id = $current_user->id;
}
if (!empty($profile_user_id)) {
    if (!isset($new_nickname) || !is_scalar($new_nickname)) {
        $new_nickname = '';
    }
コード例 #14
0
 *    (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) || $current_user->is_admin !== 'y') {
    header('Location: ' . PCPIN_FORMLINK . '?' . md5(microtime()));
    die;
}
_pcpin_loadClass('nickname');
$nickname = new PCPIN_Nickname($session);
if (!isset($moderator_user_id) || !pcpin_ctype_digit($moderator_user_id)) {
    $moderator_user_id = 0;
}
$name = '';
if (!empty($moderator_user_id)) {
    if ('' == ($name = $nickname->getDefaultNickname($moderator_user_id))) {
        if ($current_user->_db_getList('login', 'id = ' . $moderator_user_id, 1)) {
            $name = $current_user->_db_list[0]['login'];
            $current_user->_db_freeList();
        }
    } else {
        $name = $nickname->coloredToPlain($name, true);
    }
    if ($name != '') {
        $_body_onload[] = '$(\'nickname_search\').value=\'' . addslashes($name) . '\'';
コード例 #15
0
// Switch to new working directory
chdir(dirname(__FILE__));
// 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) {