*    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;
        case 'c':
_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;
$last_message_id = $session->_s_last_message_id;
if (!isset($room_id) || !is_scalar($room_id)) {
    $room_id = 0;
}
if (!empty($first_request)) {
    $full_request = 1;
}
$xml_data = array();
if (!empty($room_id) && !empty($current_user->id)) {
    if (empty($session->_s_room_id)) {
<?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/>.
 */
/**
 * Get banners list (Admin area)
 */
_pcpin_loadClass('banner');
$banner = new PCPIN_Banner($session);
$banners = array();
// Get client session
if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') {
    $xmlwriter->setHeaderMessage('OK');
    $xmlwriter->setHeaderStatus(0);
    $banners = $banner->getBanners();
}
$xmlwriter->setData(array('banner' => $banners));
 * @param   int       $start_year         Start date: year
 * @param   int       $start_month        Start date: month
 * @param   int       $start_day          Start date: day
 * @param   int       $start_hour         Start date: hour
 * @param   int       $start_minute       Start date: minute
 * @param   int       $expires_year       Expiration date: year
 * @param   int       $expires_month      Expiration date: month
 * @param   int       $expires_day        Expiration date: day
 * @param   int       $expires_hour       Expiration date: hour
 * @param   int       $expires_minute     Expiration date: minute
 * @param   int       $expires_never      If not empty, then banner will never expire
 * @param   int       $width              Banner width
 * @param   int       $height             Banner height
 */
_pcpin_loadClass('banner');
$banner = new PCPIN_Banner($session);
if (!isset($name)) {
    $name = '';
}
if (!isset($active)) {
    $active = '';
}
if (!isset($source_type)) {
    $source_type = '';
}
if (!isset($source)) {
    $source = '';
}
if (!isset($display_position)) {
    $display_position = '';
}
/**
 *    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 banner
 */
_pcpin_loadClass('banner');
$banner = new PCPIN_Banner($session);
if (!isset($banner_id)) {
    $banner_id = 0;
}
// Get client session
if (is_object($session) && !empty($current_user->id) && $current_user->is_admin === 'y') {
    $xmlwriter->setHeaderMessage($l->g('banner_deleted'));
    $xmlwriter->setHeaderStatus(0);
    $banner->deleteBanner($banner_id * 1);
}
 * @param   int       $start_year         Start date: year
 * @param   int       $start_month        Start date: month
 * @param   int       $start_day          Start date: day
 * @param   int       $start_hour         Start date: hour
 * @param   int       $start_minute       Start date: minute
 * @param   int       $expires_year       Expiration date: year
 * @param   int       $expires_month      Expiration date: month
 * @param   int       $expires_day        Expiration date: day
 * @param   int       $expires_hour       Expiration date: hour
 * @param   int       $expires_minute     Expiration date: minute
 * @param   int       $expires_never      If not empty, then banner will never expire
 * @param   int       $width              Banner width
 * @param   int       $height             Banner height
 */
_pcpin_loadClass('banner');
$banner = new PCPIN_Banner($session);
if (!isset($banner_id)) {
    $banner_id = 0;
}
if (!isset($name)) {
    $name = '';
}
if (!isset($active)) {
    $active = '';
}
if (!isset($source_type)) {
    $source_type = '';
}
if (!isset($source)) {
    $source = '';
}
 *    (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($display_position)) {
    $display_position = '';
}
$banner_data_xml = array();
_pcpin_loadClass('banner');
$banner = new PCPIN_Banner($session);
if (!empty($current_user->id)) {
    $xmlwriter->setHeaderMessage($l->g('error'));
    $xmlwriter->setHeaderStatus(1);
    if ($session->_s_room_id > 0) {
        if ($banner_data = $banner->getRandomBanner($display_position)) {
            $xmlwriter->setHeaderMessage('OK');
            $xmlwriter->setHeaderStatus(0);
            foreach ($banner_data as $key => $val) {
                if ($key == 'display_position' || $key == 'width' || $key == 'height' || $key == 'id') {
                    $banner_data_xml[$key] = $val;
                }
            }
        }
    }
}