*    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 avatars owned by specified user
 * @param   int   $user_id    Optional. User ID. If empty, then $current_user->id will be assumed.
 */
_pcpin_loadClass('avatar');
$avatar = new PCPIN_Avatar($session);
if (empty($profile_user_id)) {
    $profile_user_id = $current_user->id;
}
$avatars_xml = array();
if (!empty($profile_user_id)) {
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    $avatars = $avatar->getAvatars($profile_user_id);
    foreach ($avatars as $avatar_data) {
        $avatars_xml[] = array('id' => $avatar_data['id'], 'primary' => $avatar_data['primary'], 'binaryfile_id' => $avatar_data['binaryfile_id'], 'width' => $avatar_data['width'], 'height' => $avatar_data['height']);
    }
}
$xmlwriter->setData(array('avatar' => $avatars_xml));
    die;
}
// Delete temporary message attachments
_pcpin_loadClass('tmpdata');
$tmpdata = new PCPIN_TmpData($session);
$tmpdata->deleteUserRecords($current_user->id, 3);
// Get room background image
_pcpin_loadClass('room');
$room = new PCPIN_Room($session);
$room->_db_getList('background_image', 'id = ' . $session->_s_room_id, 1);
$background_image = $room->_db_list[0]['background_image'];
$room->_db_freeList();
// Get default avatar
_pcpin_loadClass('avatar');
$avatar = new PCPIN_Avatar($session);
$avatars = $avatar->getAvatars($current_user->id, 1);
if (!empty($avatars)) {
    $avatar_bid = $avatars[0]['binaryfile_id'];
} else {
    $avatar_bid = 0;
}
unset($avatars);
// JS files to load
$_js_files[] = './js/user.js';
$_js_files[] = './js/message_queue.js';
$_js_files[] = './js/chat_room.js';
$_js_files[] = './js/commands.js';
$_js_lng[] = 'user_entered_this_room';
$_js_lng[] = 'user_left_this_room';
$_js_lng[] = 'nickname_matches_multiple';
$_js_lng[] = 'nickname_matches_empty';