Example #1
0
function closeInactiveTickets()
{
    global $whmcs;
    global $cron;
    if (0 < $whmcs->get_config("CloseInactiveTickets")) {
        $departmentresponders = array();
        $result = select_query("tblticketdepartments", "id,noautoresponder", "");
        while ($data = mysql_fetch_array($result)) {
            $id = $data['id'];
            $noautoresponder = $data['noautoresponder'];
            $departmentresponders[$id] = $noautoresponder;
        }
        $closetitles = array();
        $result = select_query("tblticketstatuses", "title", array("autoclose" => "1"));
        while ($data = mysql_fetch_array($result)) {
            $closetitles[] = $data[0];
        }
        $ticketclosedate = date("Y-m-d H:i:s", mktime(date("H") - $whmcs->get_config("CloseInactiveTickets"), date("i"), date("s"), date("m"), date("d"), date("Y")));
        $i = 0;
        $query = "SELECT id,did,title FROM tbltickets WHERE status IN (" . db_build_in_array($closetitles) . (") AND lastreply<='" . $ticketclosedate . "'");
        $result = full_query($query);
        while ($data = mysql_fetch_array($result)) {
            $id = $data['id'];
            $did = $data['did'];
            $subject = $data['title'];
            closeTicket($id);
            if (!$departmentresponders[$did] && !$whmcs->get_config("TicketFeedback")) {
                sendMessage("Support Ticket Auto Close Notification", $id);
            }
            if (is_object($cron)) {
                $cron->logActivityDebug("Closed Ticket '" . $subject . "'");
            }
            ++$i;
        }
        if (is_object($cron)) {
            $cron->logActivity("Processed " . $i . " Ticket Closures", true);
            $cron->emailLog($i . " Tickets Closed for Inactivity");
        }
    }
}
Example #2
0
        }
    }
    if ($screenwidth < 639) {
        $screenwidth = 1024;
    }
    $tpl->assign('SCREENWIDTH', $screenwidth);
    // if status "new" or "Answer by client" set to "read"
    $status = getTicketStatus($ticket_id);
    $ticketLevel = getUserLevel($ticket_id);
    if ($ticketLevel == 1 && ($status == 1 || $status == 4) || $ticketLevel == 2 && $status == 2) {
        changeTicketStatus($ticket_id, 3);
    }
    if (isset($_POST['uaction'])) {
        if ($_POST['uaction'] == "close") {
            // close ticket
            closeTicket($ticket_id);
        } elseif ($_POST['uaction'] == "open") {
            // open ticket
            openTicket($ticket_id);
        } elseif (empty($_POST['user_message'])) {
            // no message check->error
            set_page_message(tr('Please type your message!'), 'warning');
        } else {
            $userLevel = getUserLevel($_GET['ticket_id']);
            updateTicket($ticket_id, $user_id, $_POST['urgency'], $_POST['subject'], $_POST['user_message'], $userLevel, 2);
            user_goto('ticket_system.php');
        }
    }
    showTicketContent($tpl, $ticket_id, $user_id, $screenwidth);
} else {
    set_page_message(tr('Ticket not found!'), 'error');
Example #3
0
         $smartyvalues['errormessage'] = $errormessage;
         if (!$errormessage) {
             foreach ($staffinvolved as $staffid => $staffname) {
                 insert_query("tblticketfeedback", array("ticketid" => $id, "adminid" => $staffid, "rating" => $whmcs->get_req_var("rate", $staffid), "comments" => $whmcs->get_req_var("comments", $staffid), "datetime" => "now()", "ip" => $whmcs->get_user_ip()));
             }
             if (trim($whmcs->get_req_var("comments", "generic"))) {
                 insert_query("tblticketfeedback", array("ticketid" => $id, "adminid" => "0", "rating" => "0", "comments" => $whmcs->get_req_var("comments", "generic"), "datetime" => "now()", "ip" => $whmcs->get_user_ip()));
             }
             $smartyvalues['success'] = true;
         }
     }
     outputClientArea($templatefile);
     exit;
 }
 if ($closeticket) {
     closeTicket($id);
     redir("tid=" . $tid . "&c=" . $c);
 }
 if ($rating) {
     $rating = explode("_", $rating);
     $replyid = $rating[0];
     $ratingscore = $rating[1];
     $replyid = substr($replyid, 4);
     update_query("tblticketreplies", array("rating" => $ratingscore), array("id" => $replyid));
     redir("tid=" . $tid . "&c=" . $c);
 }
 $errormessage = "";
 if ($postreply) {
     check_token();
     if (!$_SESSION['uid']) {
         if (!$replyname) {
Example #4
0
    removeAllNotifications();
}
if (isset($_GET['getFailedLogins']) && isset($_SESSION['superadmin'])) {
    die(getFailedLoginsDataTable());
}
if (isset($_GET['getPanelLogs']) && isset($_SESSION['superadmin'])) {
    die(getPanelLogsDataTable());
}
if (isset($_GET['getServerLogs']) && isset($_SESSION['loggedin'])) {
    die(getServerLogsDataTable());
}
if (isset($_POST['newTicketMessage']) && isset($_POST['newMessage'])) {
    newTicketMessage();
}
if (isset($_POST['closeTicket']) && (isset($_SESSION['admin']) || isset($_SESSION['superadmin']))) {
    closeTicket();
}
if (isset($_GET['getTickets'])) {
    echo getTicketsDataTable();
    die;
}
if (isset($_SESSION['loggedin']) && (isset($_POST['sendSrvTicket']) || isset($_POST['sendTicket'])) && isset($_POST['title']) && isset($_POST['message'])) {
    die(sendTicket());
}
if (isset($_GET['getServers'])) {
    die(getServersDataTable());
}
if (isset($_POST['ipsDisable']) && isset($_SESSION['superadmin'])) {
    writeToPanelPreferences("IPB4", 0);
    deleteIpsUsers();
}
Example #5
0
// Checks if support ticket system is activated
if (!hasTicketSystem()) {
    redirectTo('index.php');
}
if (isset($_GET['ticket_id']) && !empty($_GET['ticket_id'])) {
    $userId = $_SESSION['user_id'];
    $ticketId = (int) $_GET['ticket_id'];
    $status = getTicketStatus($ticketId);
    if ($status == 1 || $status == 4) {
        if (!changeTicketStatus($ticketId, 3)) {
            redirectTo('ticket_system.php');
        }
    }
    if (isset($_POST['uaction'])) {
        if ($_POST['uaction'] == 'close') {
            closeTicket($ticketId);
        } elseif (isset($_POST['user_message'])) {
            if (empty($_POST['user_message'])) {
                set_page_message(tr('Please type your message.'), 'error');
            } else {
                updateTicket($ticketId, $userId, $_POST['urgency'], $_POST['subject'], $_POST['user_message'], 2, 3);
            }
        }
        redirectTo('ticket_system.php');
    }
} else {
    set_page_message(tr('Ticket not found.'), 'error');
    redirectTo('ticket_system.php');
    exit;
}
$tpl = new iMSCP_pTemplate();
Example #6
0
 */
/************************************************************************************
 * Main script
 */
// Include core library
require_once 'imscp-lib.php';
require_once LIBRARY_PATH . '/Functions/Tickets.php';
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptStart);
check_login('user');
/** @var $cfg iMSCP_Config_Handler_File */
$cfg = iMSCP_Registry::get('config');
// If the feature is disabled, redirects in silent way
if (!customerHasFeature('support')) {
    showBadRequestErrorPage();
} elseif (isset($_GET['ticket_id']) && !empty($_GET['ticket_id'])) {
    closeTicket((int) $_GET['ticket_id']);
}
if (isset($_GET['psi'])) {
    $start = $_GET['psi'];
} else {
    $start = 0;
}
$tpl = new iMSCP_pTemplate();
$tpl->define_dynamic('layout', 'shared/layouts/ui.tpl');
$tpl->define_dynamic(array('page' => 'client/ticket_system.tpl', 'page_message' => 'layout', 'tickets_list' => 'page', 'tickets_item' => 'tickets_list', 'scroll_prev_gray' => 'page', 'scroll_prev' => 'page', 'scroll_next_gray' => 'page', 'scroll_next' => 'page'));
$tpl->assign(array('TR_PAGE_TITLE' => tr('Client / Support / Open Tickets'), 'TR_TICKET_STATUS' => tr('Status'), 'TR_TICKET_FROM' => tr('From'), 'TR_TICKET_SUBJECT' => tr('Subject'), 'TR_TICKET_URGENCY' => tr('Priority'), 'TR_TICKET_LAST_ANSWER_DATE' => tr('Last reply date'), 'TR_TICKET_ACTIONS' => tr('Actions'), 'TR_TICKET_DELETE' => tr('Delete'), 'TR_TICKET_CLOSE' => tr('Close'), 'TR_TICKET_READ_LINK' => tr('Read ticket'), 'TR_TICKET_DELETE_LINK' => tr('Delete ticket'), 'TR_TICKET_CLOSE_LINK' => tr('Close ticket'), 'TR_TICKET_DELETE_ALL' => tr('Delete all tickets'), 'TR_TICKETS_DELETE_MESSAGE' => tr("Are you sure you want to delete the '%s' ticket?", '%s'), 'TR_TICKETS_DELETE_ALL_MESSAGE' => tr('Are you sure you want to delete all tickets?'), 'TR_PREVIOUS' => tr('Previous'), 'TR_NEXT' => tr('Next')));
generateNavigation($tpl);
generateTicketList($tpl, $_SESSION['user_id'], $start, $cfg->DOMAIN_ROWS_PER_PAGE, 'client', 'open');
generatePageMessage($tpl);
$tpl->parse('LAYOUT_CONTENT', 'page');
iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onClientScriptEnd, array('templateEngine' => $tpl));
Example #7
0
    $updateqry['did'] = $deptid;
}
if ($userid) {
    $updateqry['userid'] = $userid;
}
if ($name) {
    $updateqry['name'] = $name;
}
if ($email) {
    $updateqry['email'] = $email;
}
if ($cc) {
    $updateqry['cc'] = $cc;
}
if ($subject) {
    $updateqry['title'] = $subject;
}
if ($priority) {
    $updateqry['urgency'] = $priority;
}
if ($status && $status != "Closed") {
    $updateqry['status'] = $status;
}
if ($status == "Closed") {
    closeTicket($ticketid);
}
if ($flag) {
    $updateqry['flag'] = $flag;
}
update_query("tbltickets", $updateqry, array("id" => $ticketid));
$apiresults = array("result" => "success", "ticketid" => $ticketid);