if (isset($_GET['screenwidth'])) { $screenwidth = $_GET['screenwidth']; } else { if (isset($_POST['screenwidth'])) { $screenwidth = $_POST['screenwidth']; } } 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');
require_once 'imscp-lib.php'; require_once LIBRARY_PATH . '/Functions/Tickets.php'; iMSCP_Events_Aggregator::getInstance()->dispatch(iMSCP_Events::onAdminScriptStart); check_login('admin'); /** @var $cfg iMSCP_Config_Handler_File */ $cfg = iMSCP_Registry::get('config'); // 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'); }
$mailto[$performer] = $users[$performer]["email"]; } $c['comment'] = $text; $user_email_body = $twig->render("helpdesk/user_email.twig", $c); email($mailto, "Заявка #{$ticket_id}. \"" . $c["title"] . "\": новый комментарий", $user_email_body); } break; case "rateTicket": $ticket = check_string($_REQUEST['ticket'], 'digits'); $rating = check_string($_REQUEST['rating'], 'digits'); $result = rateTicket($admin_login["uid"], $ticket, $rating); break; case "changeTicketStatus": $ticket = check_string($_REQUEST['ticket'], 'digits'); $status = check_string($_REQUEST['status'], 'digits'); $result = changeTicketStatus($admin_login["uid"], $ticket, $status); break; case 'reloadComments': require_once "../vendor/autoload.php"; Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem("../templates/helpdesk"); $twig = new Twig_Environment($loader, array("cache" => "")); $c['users'] = getUsers(); $c['uid'] = $admin_id; $ticket_id = check_string($_REQUEST['ticket_id'], 'digits'); $hide_autocomments = check_string($_REQUEST['hide_autocomments'], 'text'); $c['ticket']['comments'] = getTicketComments($ticket_id); $template = $hide_autocomments == 0 ? 'ticket_edit_comments.twig' : 'client/ticket_view_comments.twig'; $result['comments_block'] = $twig->render($template, $c); $result['success'] = true; unset($result['msg']);
/** * Open the given ticket (Status 3). * * @author Benedikt Heintel <*****@*****.**> * @since 1.0.7 * @version 1.0.0 * * @param int $ticket_id the ticket ID */ function openTicket($ticket_id) { changeTicketStatus($ticket_id, 3); set_page_message(tr('Ticket was reopened!'), 'info'); }
/** * Reopens the given ticket * * @param int $ticketId Ticket id * @return bool TRUE on success, FALSE otherwise */ function reopenTicket($ticketId) { if (!changeTicketStatus($ticketId, 3)) { set_page_message(tr("Unable to reopen ticket with Id '%s'.", $ticketId), 'error'); write_log(sprintf("Unable to reopen ticket with Id '%s'.", $ticketId), E_USER_ERROR); return false; } set_page_message(tr('Ticket successfully reopened.'), 'success'); return true; }
// 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'); $userId = $_SESSION['user_id']; customerHasFeature('support') or showBadRequestErrorPage(); if (isset($_GET['ticket_id']) && !empty($_GET['ticket_id'])) { $userId = $_SESSION['user_id']; $ticketId = (int) $_GET['ticket_id']; $status = getTicketStatus($ticketId); $ticketLevel = getUserLevel($ticketId); if (getTicketStatus($ticketId) == 2) { changeTicketStatus($ticketId, 3); } 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'], 1, 1); } } redirectTo('ticket_system.php'); } } else { set_page_message(tr('Ticket not found.'), 'error');