function sirportly_link_accounts($vars) { if (sirportly_enabled()) { if (!sirportly_contact()) { $client = mysql_fetch_array(select_query('tblclients', '', array('id' => $_SESSION['uid']))); $contact = curl('/api/v2/tickets/spql', array('spql' => "SELECT customers.id, count FROM tickets WHERE customer_contact_methods.method_type = 'email' AND customer_contact_methods.data = '" . $client['email'] . "' LIMIT 1")); if ($contact['results']['results']['0']['1']) { mysql_query("INSERT INTO `sirportly_customers` (`userid`, `customerid`) VALUES ('" . $_SESSION['uid'] . "', '" . $contact['results']['results']['0']['0'] . "');"); } } } }
<?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) {