Пример #1
0
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'] . "');");
            }
        }
    }
}
Пример #2
0
    } 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) {
        $ca->assign($key, $value);
    }
    if (!$_POST['replymessage']) {
        $ca->assign('errormessage', $whmcs->get_lang('supportticketserrornomessage'));
    } elseif ($contact = sirportly_contact()) {
        $update = curl('/api/v2/tickets/post_update', array('ticket' => $ticket['results']['reference'], 'contact' => $contact, 'message' => $_POST['replymessage']));
        if ($update['status'] != 201) {
            $ca->assign('errormessage', $update['results']['errors']['base']['0']);
        } else {
            header('Location: viewticket.php?tid=' . $ticket['results']['reference'] . '&c=' . $ticket['results']['id']);
        }
    } elseif (!$_POST['replyname']) {
        $ca->assign('errormessage', $whmcs->get_lang('supportticketserrornoname'));
    } elseif (!$_POST['replyemail']) {
        $ca->assign('errormessage', $whmcs->get_lang('supportticketserrornoemail'));
    } else {
        $update = curl('/api/v2/tickets/post_update', array('author_name' => $_POST['replyname'], 'author_email' => $_POST['replyemail'], 'ticket' => $ticket['results']['reference'], 'message' => $_POST['replymessage']));
        if ($update['status'] != 201) {
            $ca->assign('errormessage', $update['results']['errors']['base']['0']);
        } else {