Esempio n. 1
0
            $hasUrl = false;
        }
        $aLastTickets[] = array('id' => $ticket->getVar('id'), 'subject' => $ticket->getVar('subject'), 'status' => xhelpGetStatus($ticket->getVar('status')), 'department' => $dept, 'dept_url' => $hasUrl ? XOOPS_URL . '/modules/xhelp/index.php?op=staffViewAll&dept=' . $ticket->getVar('department') : '', 'url' => XOOPS_URL . '/modules/xhelp/ticket.php?id=' . $ticket->getVar('id'));
    }
    $has_lastTickets = count($lastTickets);
    unset($lastTickets);
}
switch ($op) {
    case "addEmail":
        if ($_POST['newEmail'] == '') {
            $message = _XHELP_MESSAGE_NO_EMAIL;
            redirect_header(XHELP_BASE_URL . "/ticket.php?id={$xhelp_id}", 3, $message);
        }
        //Check if email is valid
        $validator = new ValidateEmail($_POST['newEmail']);
        if (!$validator->isValid()) {
            redirect_header(xhelpMakeURI('ticket.php', array('id' => $xhelp_id), false), 3, _XHELP_MESSAGE_NO_EMAIL);
        }
        if (!($newUser = xhelpEmailIsXoopsUser($_POST['newEmail']))) {
            // If a user doesn't exist with this email
            $user_id = 0;
        } else {
            $user_id = $newUser->getVar('uid');
        }
        // Check that the email doesn't already exist for this ticket
        $hTicketEmails =& xhelpGetHandler('ticketEmails');
        $crit = new CriteriaCompo(new Criteria('ticketid', $xhelp_id));
        $crit->add(new Criteria('email', $_POST['newEmail']));
        $existingUsers =& $hTicketEmails->getObjects($crit);
        if (count($existingUsers) > 0) {
            $message = _XHELP_MESSAGE_EMAIL_USED;