global $cfg;
$support_system = $cfg['VHCS_SUPPORT_SYSTEM'];
if ($support_system !== 'yes') {
    header("Location: index.php");
    die;
}
$reseller_id = $_SESSION['user_created_by'];
if (isset($_GET['ticket_id'])) {
    $screenwidth = $_GET['screenwidth'];
    if (!isset($screenwidth) || $screenwidth < 639) {
        $screenwidth = 1024;
    }
    $tpl->assign('SCREENWIDTH', $screenwidth);
    change_ticket_status_view($sql, $_GET['ticket_id']);
    send_user_message($sql, $_SESSION['user_id'], $reseller_id, $_GET['ticket_id']);
    gen_tickets_list($tpl, $sql, $_GET['ticket_id'], $screenwidth);
} else {
    set_page_message(tr('Ticket not found!'));
    Header("Location: support_system.php");
    die;
}
//
// static page messages.
//
gen_reseller_menu($tpl);
gen_logged_from($tpl);
$tpl->assign(array('TR_VIEW_SUPPORT_TICKET' => tr('View support ticket'), 'TR_TICKET_URGENCY' => tr('Priority'), 'TR_TICKET_SUBJECT' => tr('Subject'), 'TR_TICKET_DATE' => tr('Date'), 'TR_DELETE' => tr('Delete'), 'TR_NEW_TICKET_REPLY' => tr('Send message reply'), 'TR_REPLY' => tr('Send reply'), 'TR_TICKET_FROM' => tr('From'), 'TR_OPEN_TICKETS' => tr('Open tickets'), 'TR_CLOSED_TICKETS' => tr('Closed tickets')));
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
$support_system = $cfg['VHCS_SUPPORT_SYSTEM'];
if ($support_system !== 'yes') {
    header("Location: index.php");
    die;
}
global $cfg;
$theme_color = $cfg['USER_INITIAL_THEME'];
$tpl->assign(array('TR_CLIENT_QUESTION_PAGE_TITLE' => tr('VHCS - Client/Questions & Comments'), 'THEME_COLOR_PATH' => "../themes/{$theme_color}", 'THEME_CHARSET' => tr('encoding'), 'VHCS_LICENSE' => $cfg['VHCS_LICENSE'], 'ISP_LOGO' => get_logo($_SESSION['user_id'])));
//
// dynamic page data.
//
//if (isset($_POST['uaction']) && $_POST['uaction'] === 'del_ticket') {
//	set_page_message(tr('Ticket(s) are deleted!'));
//}
//if (isset($_POST['uaction']) && $_POST['uaction'] === 'close_ticket') {
//	set_page_message(tr('Ticket(s) are closed!'));
//}
gen_tickets_list($tpl, $sql, $_SESSION['user_id']);
//
// static page messages.
//
gen_reseller_menu($tpl);
gen_logged_from($tpl);
$tpl->assign(array('TR_SUPPORT_SYSTEM' => tr('Support system'), 'TR_SUPPORT_TICKETS' => tr('Support tickets'), 'TR_NEW' => tr('&nbsp;'), 'TR_ACTION' => tr('Action'), 'TR_URGENCY' => tr('Priority'), 'TR_SUBJECT' => tr('Subject'), 'TR_LAST_DATA' => tr('Last reply'), 'TR_DELETE_ALL' => tr('Delete all'), 'TR_OPEN_TICKETS' => tr('Open tickets'), 'TR_CLOSED_TICKETS' => tr('Closed tickets'), 'TR_DELETE' => tr('Delete'), 'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete')));
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();
}
unset_messages();
if ($support_system !== 'yes') {
    header("Location: index.php");
    die;
}
$reseller_id = $_SESSION['user_created_by'];
$reseller_id = $_SESSION['user_created_by'];
if (isset($_GET['ticket_id'])) {
    $ticket_id = $_GET['ticket_id'];
    $screenwidth = $_GET['screenwidth'];
    if (!isset($screenwidth) || $screenwidth < 639) {
        $screenwidth = 1024;
    }
    $tpl->assign('SCREENWIDTH', $screenwidth);
    send_user_message($sql, $_SESSION['user_id'], $reseller_id, $ticket_id);
    change_ticket_status($sql, $ticket_id);
    gen_tickets_list($tpl, $sql, $ticket_id, $screenwidth);
} else {
    set_page_message(tr('Ticket not found!'));
    Header("Location: support_system.php");
    die;
}
//
// static page messages.
//
gen_admin_menu($tpl);
$tpl->assign(array('TR_SUPPORT_SYSTEM' => tr('VHCS - Admin : Support System: View Tickets'), 'TR_VIEW_SUPPORT_TICKET' => tr('View support ticket'), 'TR_TICKET_URGENCY' => tr('Priority'), 'TR_TICKET_SUBJECT' => tr('Subject'), 'TR_TICKET_DATE' => tr('Date'), 'TR_DELETE' => tr('Delete'), 'TR_NEW_TICKET_REPLY' => tr('Send message reply'), 'TR_REPLY' => tr('Send reply'), 'TR_TICKET_FROM' => tr('From'), 'TR_OPEN_TICKETS' => tr('Open tickets'), 'TR_CLOSED_TICKETS' => tr('Closed tickets')));
gen_page_message($tpl);
$tpl->parse('PAGE', 'page');
$tpl->prnt();
if (isset($cfg['DUMP_GUI_DEBUG'])) {
    dump_gui_debug();