<?php define("CLIENTAREA", true); require "init.php"; $ca = new WHMCS_ClientArea(); $settings = sirportly_settings(); $ca->setPageTitle($whmcs->get_lang('supportticketsviewticket')); $ca->initPage(); global $CONFIG; if (!sirportly_enabled()) { die('Sirportly module not enabled.'); } if ($CONFIG['RequireLoginforClientTickets'] == 'on' && !$ca->isLoggedIn()) { header('Location: login.php'); } ## Close ticket if ($settings['close_ticket'] && $_GET['closeticket']) { $close = curl('/api/v2/tickets/update', array('ticket' => $_GET['tid'], 'status' => $settings['closed_status'])); if ($close['status'] != 200) { $ca->assign('errormessage', "Unable to close ticket, please contact support."); } else { header('Location: viewticket.php?tid=' . $_GET['tid'] . '&c=' . $_GET['c']); } } $ticket = curl('/api/v2/tickets/ticket', array('reference' => $_GET['tid'])); if ($ticket['results']['id'] != $_GET['c']) { header('Location: supporttickets.php'); } ## An update has been posted if ($_POST) { foreach ($_POST as $key => $value) {