/**
  * Get chat rooms list grouped in categories (tree) and sorted by name, including list of users in each room
  * This method creates an array with categories where element with KEY 0 is a category tree built from references to other elements (categories)
  * @param   int       $current_user_id    Optional. ID of user who calls this method
  * @param   int       $userlist_room_id   Optional. If empty: get userlist for all rooms, if not empty: get userlist for specified room only
  * @param   boolean   $recursion          Optional. Default TRUE. If TRUE, tree will be returned, otherwise: plain array.
  * @return  array
  */
 function getTree($current_user_id = 0, $userlist_room_id = 0, $recursion = true)
 {
     $categories = array();
     $categories[0] = array('id' => 0, 'name' => '[ROOT]', 'description' => '[ROOT]', 'parent_id' => '-1', 'creatable_rooms' => 0, 'creatable_rooms_flag' => 'n', 'category' => array(), 'room' => array());
     if (!pcpin_ctype_digit($current_user_id)) {
         $current_user_id = 0;
     }
     $query = $this->_db_makeQuery(1200, $current_user_id);
     if ($result = $this->_db_query($query)) {
         while ($data = $this->_db_fetch($result, MYSQL_ASSOC)) {
             if (empty($userlist_room_id) || $userlist_room_id == $data['room_id']) {
                 $user_data = array('id' => $data['user_id'], 'nickname' => $data['nickname'], 'nickname_plain' => $data['nickname_plain'], 'avatar_bid' => $data['avatar_bid'], 'online_status' => $data['online_status'], 'online_status_message' => $data['online_status_message'], 'muted_locally' => $data['muted_locally'], 'global_muted' => $data['global_muted'], 'global_muted_by' => $data['global_muted_by'], 'global_muted_by_username' => $data['global_muted_by_username'], 'global_muted_until' => $data['global_muted_until'], 'global_muted_permanently' => $data['global_muted_permanently'], 'global_muted_reason' => $data['global_muted_reason'], 'ip_address' => $data['ip_address'], 'gender' => $data['gender'], 'is_admin' => $data['is_admin'], 'is_moderator' => $data['is_moderator'], 'is_guest' => $data['is_guest']);
             }
             $room_data = array('id' => $data['room_id'], 'name' => $data['room_name'], 'description' => $data['room_description'], 'background_image' => $data['background_image'], 'background_image_width' => $data['background_image_width'], 'background_image_height' => $data['background_image_height'], 'default_message_color' => $data['default_message_color'], 'password_protected' => $data['password_protected'], 'moderated_by_me' => $data['moderated_by_me'], 'users_count' => 0, 'user' => array());
             $category_data = array('id' => $data['category_id'], 'name' => $data['category_name'], 'description' => $data['category_description'], 'parent_id' => $data['category_parent_id'], 'creatable_rooms' => $data['creatable_rooms'], 'creatable_rooms_flag' => $data['creatable_rooms_flag'], 'category' => array(), 'room' => array());
             if (!isset($categories[$data['category_id']])) {
                 $categories[$data['category_id']] = $category_data;
             }
             if (!is_null($data['room_id']) && !isset($categories[$data['category_id']]['room'][$data['room_id']])) {
                 $categories[$data['category_id']]['room'][$data['room_id']] = $room_data;
             }
             if (!empty($data['user_id'])) {
                 $categories[$data['category_id']]['room'][$data['room_id']]['users_count']++;
                 if (!empty($user_data)) {
                     $categories[$data['category_id']]['room'][$data['room_id']]['user'][$data['user_id']] = $user_data;
                 }
             }
         }
         $this->_db_freeResult($result);
     }
     // Make recursion
     if ($recursion) {
         foreach ($categories as $category_id => $category_data) {
             if (isset($categories[$category_data['parent_id']])) {
                 // Category has a parent
                 $categories[$category_data['parent_id']]['category'][$category_id] =& $categories[$category_id];
             }
         }
     } else {
         unset($categories[0]);
         $categories = array(0 => array($categories));
     }
     return $categories;
 }
 *    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 (!isset($reason) || !is_scalar($reason)) {
    $reason = '';
} else {
    $reason = trim($reason);
}
if (!isset($duration) || !is_scalar($duration) || !pcpin_ctype_digit($duration)) {
    $duration = 0;
}
if (!empty($current_user->id)) {
    $xmlwriter->setHeaderStatus(1);
    if (!empty($target_user_id) && $current_user->_db_getList('is_admin', 'id = ' . $target_user_id, 1)) {
        // User exists
        // Check permissions
        $allowed = $current_user->is_admin === 'y' && $current_user->_db_list[0]['is_admin'] != 'y';
        if (true == $allowed) {
            $xmlwriter->setHeaderStatus(0);
            $xmlwriter->setHeaderMessage('OK');
            // Action permitted
            if ($session->_db_getList('_s_room_id', '_s_user_id = ' . $target_user_id, 1)) {
                // Add new message
                if (!empty($action)) {
 *    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('category');
$category = new PCPIN_Category($session);
if (!isset($category_id) || !pcpin_ctype_digit($category_id)) {
    $category_id = 0;
}
if (!isset($action) || !is_scalar($action)) {
    $action = '';
}
if (!isset($dir) || !pcpin_ctype_digit($dir)) {
    $dir = 0;
}
$parent_id = 0;
//todo
if (!isset($name) || !is_scalar($name)) {
    $name = '';
}
if (!isset($description) || !is_scalar($description)) {
    $description = '';
}
if (!isset($creatable_rooms) || !is_scalar($creatable_rooms)) {
    $creatable_rooms = 'n';
}
$errortext = array();
if (!empty($current_user->id) && $current_user->is_admin === 'y' && $session->_s_user_id == $current_user->id) {
 *    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/>.
 */
$_body_onload[] = 'initImageWindow()';
// JS file
$_js_files[] = './js/show_image.js';
$_js_lng[] = 'close_window';
if (empty($img_b_id) || !is_scalar($img_b_id) || !pcpin_ctype_digit($img_b_id)) {
    die;
}
_pcpin_loadClass('pcpintpl');
$tpl = new PcpinTpl();
$tpl->setBasedir('./tpl');
$tpl->readTemplatesFromFile('./show_image.tpl');
// 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))));
 *
 *    "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('category');
$category = new PCPIN_Category($session);
if (!isset($category_id) || !pcpin_ctype_digit($category_id)) {
    $category_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($category_id) && $category->_db_getList('name', 'id = ' . $category_id)) {
        // Category exists
        $xmlwriter->setHeaderStatus(0);
        $category_name = $category->_db_list[0]['name'];
        $xmlwriter->setHeaderMessage(str_replace('[NAME]', $category_name, $l->g('category_deleted')));
        // Delete category
        $category->deleteCategory($category_id);
    }
}
 *    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)) {
        $smilie->updateSmilie($smilie_id, $code, $description);
    }
 *
 *    "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('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 (!empty($current_user->id) && $current_user->is_admin === 'y') {
    // Delete smilie
    if (!empty($smilie_id) && pcpin_ctype_digit($smilie_id) && $smilie->deleteSmilie($smilie_id)) {
        $xmlwriter->setHeaderStatus(0);
        $xmlwriter->setHeaderMessage($l->g('smilie_deleted'));
    } else {
        $xmlwriter->setHeaderStatus(1);
        $xmlwriter->setHeaderMessage($l->g('error'));
    }
}
 foreach ($categories_array as $category_id) {
     $category_id = trim($category_id);
     if (pcpin_ctype_digit($category_id) && $category->_db_getList('id', 'id = ' . $category_id, 1)) {
         // Category exists
         $categories_new[] = $category_id;
         $category->_db_freeList();
     }
 }
 $categories_new = array_unique($categories_new);
 sort($categories_new);
 // Check rooms
 $rooms_new = array();
 $rooms_array = explode(',', $rooms);
 foreach ($rooms_array as $room_id) {
     $room_id = trim($room_id);
     if (pcpin_ctype_digit($room_id) && $room->_db_getList('id', 'id = ' . $room_id, 1)) {
         // Room exists
         $rooms_new[] = $room_id;
         $room->_db_freeList();
     }
 }
 // Get categories' rooms
 if (!empty($categories_new) && $room->_db_getList('id', 'category_id IN ' . implode(',', $categories_new))) {
     foreach ($room->_db_list as $room_data) {
         $rooms_new[] = $room_data['id'];
     }
     $room->_db_freeList();
 }
 $rooms_new = array_unique($rooms_new);
 sort($rooms_new);
 // Save data
 *
 *    "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);
    }
}
                 }
                 break;
         }
     }
 }
 header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $cache_expires) . ' GMT');
 if (PCPIN_CLIENT_AGENT_NAME == 'IE') {
     header('Cache-Control: Public');
     header('Pragma: Public');
 } else {
     header('Pragma: Public');
 }
 $thumb_loaded = false;
 if (true === $session->_conf_all['allow_gd'] && !empty($b_x) && pcpin_ctype_digit($b_x) && !empty($b_y) && pcpin_ctype_digit($b_y)) {
     // Thumbnail
     if (!isset($bg_r) || !pcpin_ctype_digit($bg_r) || $bg_r < 0 || $bg_r > 255 || !isset($bg_g) || !pcpin_ctype_digit($bg_g) || $bg_g < 0 || $bg_g > 255 || !isset($bg_b) || !pcpin_ctype_digit($bg_b) || $bg_b < 0 || $bg_b > 255) {
         $bg_r = hexdec(substr($session->_conf_all['thumb_background'], 0, 2));
         $bg_g = hexdec(substr($session->_conf_all['thumb_background'], 2, 2));
         $bg_b = hexdec(substr($session->_conf_all['thumb_background'], 4, 2));
     }
     $thumb_img = '';
     if (PCPIN_Image::makeThumb($thumb_img, null, null, $binaryfile->_db_list[0]['body'], $b_y, $b_x, 'jpg', $bg_r, $bg_g, $bg_b)) {
         $thumb_loaded = true;
         header('Content-type: image/jpeg');
         $etag = md5($thumb_img);
         header('Etag: ' . $etag);
         if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag) {
             header('HTTP/1.1 304 Not Modified');
         } else {
             echo $thumb_img;
         }
 *    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);
    }
}
if (!isset($user_ids)) {
    $user_ids = '';
}
if (!isset($load_custom_fields)) {
    $load_custom_fields = false;
}
$members_xml = array();
$total_members_count = 0;
if (is_object($session) && !empty($current_user->id)) {
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    $nickname = trim($nickname);
    // Get total members (respective search query)
    $total_members_count = $current_user->getMemberlist(true, 0, 0, 0, 0, $nickname, !empty($banned_only), !empty($muted_only), !empty($moderators_only), !empty($admins_only), $user_ids !== '' ? null : !empty($not_activated_only), $user_ids);
    $total_pages = ceil($total_members_count / $session->_conf_all['memberlist_page_records']);
    if (empty($page) || !pcpin_ctype_digit($page)) {
        $page = 1;
    } elseif ($page > $total_pages && $total_pages > 0) {
        $page = $total_pages;
    }
    // Get memberlist
    $limitstart = $session->_conf_all['memberlist_page_records'] * ($page - 1);
    $limitlength = $total_members_count > $session->_conf_all['memberlist_page_records'] ? $session->_conf_all['memberlist_page_records'] : $total_members_count;
    $members = $current_user->getMemberlist(false, $limitstart, $session->_conf_all['memberlist_page_records'], $sort_by, $sort_dir, $nickname, !empty($banned_only), !empty($muted_only), !empty($moderators_only), !empty($admins_only), $user_ids !== '' ? null : !empty($not_activated_only), $user_ids);
    $members_count = count($members);
    // Create XML
    foreach ($members as $member) {
        $moderated_rooms = array();
        $moderated_categories = array();
        $room_ids = array();
        if (!empty($moderators_only)) {
 /**
  * Check the language for availability
  * @param   mixed     $language_id    Language ID or ISO name
  * @return  int   Language ID, if language is available or 0, if not
  */
 function checkLanguage($id)
 {
     $available_id = 0;
     if (!empty($id)) {
         if (!pcpin_ctype_digit($id) && $this->_db_getList('id', 'iso_name = ' . $id, 'active = y', 1) || pcpin_ctype_digit($id) && $this->_db_getList('id', 'id = ' . $id, 'active = y', 1)) {
             $available_id = $this->_db_list[0]['id'];
             $this->_db_freeList();
         }
     }
     return $available_id;
 }
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)) {
    $password = '';
}
if (!isset($image) || !pcpin_ctype_digit($image)) {
    $image = 0;
}
if (!empty($current_user->id) && $current_user->is_admin === 'y' && $session->_s_user_id == $current_user->id) {
    $errortext = array();
    $name = trim($name);
    $description = trim($description);
    if (empty($category_id) || !$category->_db_getList('id', 'id = ' . $category_id, 1)) {
        $errortext[] = $l->g('select_category');
    } elseif ($name == '') {
        $errortext[] = $l->g('room_name_empty');
    } elseif ($room->_db_getList('category_id = ' . $category_id, 'name LIKE ' . $name, 1)) {
        $errortext[] = str_replace('[NAME]', $name, $l->g('room_already_exists_in_category'));
    } elseif (!empty($password_protect) && !empty($change_password) && _pcpin_strlen($password) < 3) {
        $errortext[] = $l->g('password_too_short');
    }
}
if (!isset($description)) {
    $description = '';
}
if (!isset($action)) {
    $action = 'd';
}
$errortext = array();
if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') {
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    $mask = trim($mask);
    $description = trim($description);
    $action = trim($action);
    // Validate expiration date
    if (empty($expires_never) && (!@checkdate($expires_month, $expires_day, $expires_year) || !pcpin_ctype_digit($expires_hour) || $expires_hour > 60 || $expires_hour < 0 || !pcpin_ctype_digit($expires_minute) || $expires_minute > 60 || $expires_minute < 0)) {
        $errortext[] = $l->g('expiration_date_invalid');
    }
    // Check mask
    if ($type !== 'IPv4' && $type !== 'IPv6') {
        $errortext[] = $l->g('ip_address_type_invalid');
    } elseif (!$ipfilter->checkIPMask($type, $mask)) {
        $errortext[] = $l->g('ip_mask_invalid');
    }
    if (empty($errortext)) {
        if ($ipfilter->addAddress($type, $mask, empty($expires_never) ? "{$expires_year}-{$expires_month}-{$expires_day} {$expires_hour}:{$expires_minute}:00" : '', $description, $action)) {
            $xmlwriter->setHeaderMessage($l->g('ip_address_added'));
            // Ensure, that current user can access the software with new record
            if ($ipfilter->isBlocked(PCPIN_CLIENT_IP)) {
                // Not good
                $ipfilter->deleteAddress($ipfilter->id);
 *    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($count) || !is_scalar($count) || !pcpin_ctype_digit($count)) {
    $count = 1;
}
if (empty($ip) || gettype($ip) != 'string') {
    $ip = '';
}
$ping_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 ($ip != '') {
        $ping_data = PCPIN_Ping::icmp_ping($ip, $count);
        if (empty($ping_data)) {
            // Ping failed
            $xmlwriter->setHeaderMessage($l->g('error'));
            $xmlwriter->setHeaderStatus(1);
        } else {
示例#17
0
 /**
  * Create SQL query using a template
  * @param    int     $nr   Query template number
  * @param    mixed   ...   Unlimited query parameters. WARNING: scalar data types only!!!
  * @return   string  Created query
  */
 function _db_makeQuery($nr)
 {
     $query = '';
     // Get method arguments
     $argv = func_get_args();
     // First argument is query template number (not needed)
     unset($argv[0]);
     // Load requested template
     if (pcpin_ctype_digit($nr)) {
         require './class/dbtpl/' . $nr . '.tpl.php';
         $trans = array();
         foreach ($argv as $key => $arg) {
             $trans['\\_ARG' . $key . '_\\'] = is_scalar($arg) ? $this->_db_escapeStr($arg, false) : '';
             $trans['\\_arg' . $key . '_\\'] = is_scalar($arg) ? $this->_db_escapeStr($arg) : '';
         }
         $query = strtr($query, $trans);
     }
     return $query;
 }
/**
 *    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($avatar_id) || !pcpin_ctype_digit($avatar_id)) {
    $avatar_id = 0;
}
_pcpin_loadClass('avatar');
$avatar = new PCPIN_Avatar($session);
if (!empty($current_user->id) && $current_user->is_admin === 'y' && !empty($avatar_id) && $avatar->_db_getList('primary', 'id = ' . $avatar_id, 'user_id = 0', 1)) {
    // Avatar exists
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    if ($avatar->_db_list[0]['primary'] != 'y') {
        $avatar->setDefaultAvatarGallery($avatar_id);
    }
    $avatar->_db_freeList();
}
 *
 *    "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) . '\'';
        $_body_onload[] = 'moderatorSearchUser(' . (!empty($popup) ? 'true' : 'false') . ')';