} elseif (!$cfg->canUploadFileType($_FILES['attachment']['name'][$i])) {
         $errors['attachment'] = _('Invalid file type') . ' [ ' . Format::htmlchars($_FILES['attachment']['name'][$i]) . ' ]';
     } elseif ($_FILES['attachment']['size'][$i] > $cfg->getMaxFileSize()) {
         $errors['attachment'] = _('File is too big') . ': ' . $_FILES['attachment']['size'][$i] . ' bytes';
     }
     $i++;
 }
 //Make sure the email is not banned
 if (!$errors && BanList::isbanned($ticket->getEmail())) {
     $errors['err'] = _('Email is in banlist. Must be removed to reply');
 }
 //If no error...do the do.
 if (!$errors && ($respId = $ticket->postResponse($_POST['response'], $_POST['signature'], $_FILES['attachment']))) {
     $msg = _('Response Posted Successfully');
     //Set status if any.
     $wasOpen = $ticket->isOpen();
     if (isset($_POST['ticket_status']) && $_POST['ticket_status']) {
         if ($ticket->setStatus($_POST['ticket_status']) && $ticket->reload()) {
             $note = sprintf(_('%s %s the ticket on reply'), $thisuser->getName(), $ticket->isOpen() ? _('reopened') : _('closed'));
             $ticket->logActivity(sprintf(_('Ticket status changed to %s'), $ticket->isOpen() ? _('Open') : _('Closed')), $note);
         }
     }
     //Finally upload attachment if any
     if ($_FILES['attachment'] && $_FILES['attachment']['size']) {
         $ticket->uploadAttachment($_FILES['attachment'], $respId, 'R');
     }
     $ticket->reload();
     //Mark the ticket answered if OPEN.
     if ($ticket->isopen()) {
         $ticket->markAnswered();
     } elseif ($wasOpen) {
Example #2
0
     } elseif (!$cfg->canUploadFiles()) {
         //TODO: saved vs emailed attachments...admin config??
         $errors['attachment'] = 'upload dir invalid. Contact admin.';
     } elseif (!$cfg->canUploadFileType($_FILES['attachment']['name'])) {
         $errors['attachment'] = 'Invalid file type';
     }
 }
 //Make sure the email is not banned
 if (!$errors && BanList::isbanned($ticket->getEmail())) {
     $errors['err'] = 'Email is in banlist. Must be removed to reply';
 }
 //If no error...do the do.
 if (!$errors && ($respId = $ticket->postResponse($_POST['msg_id'], $_POST['response'], $_POST['signature'], $_FILES['attachment']))) {
     $msg = 'Response Posted Successfully';
     //Set status if any.
     $wasOpen = $ticket->isOpen();
     if (isset($_POST['ticket_status']) && $_POST['ticket_status']) {
         if ($ticket->setStatus($_POST['ticket_status']) && $ticket->reload()) {
             $note = sprintf('%s %s the ticket on reply', $thisuser->getName(), $ticket->isOpen() ? 'reopened' : 'closed');
             $ticket->logActivity('Ticket status changed to ' . ($ticket->isOpen() ? 'Open' : 'Closed'), $note);
         }
     }
     //Finally upload attachment if any
     if ($_FILES['attachment'] && $_FILES['attachment']['size']) {
         $ticket->uploadAttachment($_FILES['attachment'], $respId, 'R');
     }
     $ticket->reload();
     //Mark the ticket answered if OPEN.
     if ($ticket->isopen()) {
         $ticket->markAnswered();
     } elseif ($wasOpen) {
Example #3
0
         if ($ticket->markOverdue()) {
             $msg = 'Ticket flagged as overdue';
             if ($_POST['ticket_priority']) {
                 $ticket->setPriority($_POST['ticket_priority']);
             }
         } else {
             $errors['err'] = 'Problems marking the the ticket overdue. Try again';
         }
     }
     break;
 case 'banemail':
     if (!$thisuser->isadmin() && !$thisuser->canManageBanList()) {
         $errors['err'] = 'Perm. Denied. You are not allowed to ban emails';
     } elseif (Banlist::add($ticket->getEmail(), $thisuser->getName())) {
         $msg = 'Email added to banlist';
         if ($ticket->isOpen() && $ticket->close()) {
             $msg .= ' & ticket status set to closed';
         }
     } else {
         $errors['err'] = 'Unable to add the email to banlist';
     }
     break;
 case 'unbanemail':
     if (!$thisuser->isadmin() && !$thisuser->canManageBanList()) {
         $errors['err'] = 'Perm. Denied. You are not allowed to remove emails from banlist.';
     } elseif (Banlist::remove($ticket->getEmail())) {
         $msg = 'Email removed from banlist';
     } else {
         $errors['err'] = 'Unable to remove the email from banlist. Try again.';
     }
     break;
     } elseif (!$cfg->canUploadFiles()) {
         //TODO: saved vs emailed attachments...admin config??
         $errors['attachment'] = 'Carregamento inválido. Contacte o administrador.';
     } elseif (!$cfg->canUploadFileType($_FILES['attachment']['name'])) {
         $errors['attachment'] = 'Tipo de arquivo inválido';
     }
 }
 //Make sure the email is not banned
 if (!$errors && BanList::isbanned($ticket->getEmail())) {
     $errors['err'] = 'E-mail está na lista de banidos. Deve ser removido para responder';
 }
 //If no error...do the do.
 if (!$errors && ($respId = $ticket->postResponse($_POST['msg_id'], $_POST['response'], $_POST['signature'], $_FILES['attachment']))) {
     $msg = 'Resposta Postada com Sucesso.';
     //Set status if any.
     $wasOpen = $ticket->isOpen();
     if (isset($_POST['ticket_status']) && $_POST['ticket_status']) {
         if ($ticket->setStatus($_POST['ticket_status']) && $ticket->reload()) {
             $note = sprintf('%s %s o ticket em resposta', $thisuser->getName(), $ticket->isOpen() ? 'reaberto' : 'fechado');
             $ticket->logActivity('Estado alterado para ticket ' . ($ticket->isOpen() ? 'Aberto' : 'Fechado'), $note);
         }
     }
     //Finally upload attachment if any
     if ($_FILES['attachment'] && $_FILES['attachment']['size']) {
         $ticket->uploadAttachment($_FILES['attachment'], $respId, 'R');
     }
     $ticket->reload();
     //Mark the ticket answered if OPEN.
     if ($ticket->isopen()) {
         $ticket->markAnswered();
     } elseif ($wasOpen) {
 function previewTicket($tid)
 {
     global $thisstaff;
     $ticket = new Ticket($tid);
     $resp = sprintf('<div style="width:500px;">
              <strong>Ticket #%d Preview</strong><br>INFO HERE!!', $ticket->getExtId());
     $options[] = array('action' => 'Thread (' . $ticket->getThreadCount() . ')', 'url' => "tickets.php?id={$tid}");
     if ($ticket->getNumNotes()) {
         $options[] = array('action' => 'Notes (' . $ticket->getNumNotes() . ')', 'url' => "tickets.php?id={$tid}#notes");
     }
     if ($ticket->isOpen()) {
         $options[] = array('action' => 'Reply', 'url' => "tickets.php?id={$tid}#reply");
     }
     if ($thisstaff->canAssignTickets()) {
         $options[] = array('action' => $ticket->isAssigned() ? 'Reassign' : 'Assign', 'url' => "tickets.php?id={$tid}#assign");
     }
     if ($thisstaff->canTransferTickets()) {
         $options[] = array('action' => 'Transfer', 'url' => "tickets.php?id={$tid}#transfer");
     }
     $options[] = array('action' => 'Post Note', 'url' => "tickets.php?id={$tid}#note");
     if ($options) {
         $resp .= '<ul class="tip_menu">';
         foreach ($options as $option) {
             $resp .= sprintf('<li><a href="%s">%s</a></li>', $option['url'], $option['action']);
         }
         $resp .= '</ul>';
     }
     $resp .= '</div>';
     return $resp;
 }
     } elseif (!$cfg->canUploadFiles()) {
         //TODO: saved vs emailed attachments...admin config??
         $errors['attachment'] = 'Directorio de adjuntos invalido, contacta al Administrador.';
     } elseif (!$cfg->canUploadFileType($_FILES['attachment']['name'])) {
         $errors['attachment'] = 'Extensi&oacute;n de archivo invalida';
     }
 }
 //Make sure the email is not banned
 if (!$errors && BanList::isbanned($ticket->getEmail())) {
     $errors['err'] = 'La cuenta de correo esta en la lista negra. Quitar de la lista negra antes de responder.';
 }
 //If no error...do the do.
 if (!$errors && ($respId = $ticket->postResponse($_POST['msg_id'], $_POST['response'], $_POST['signature'], $_FILES['attachment']))) {
     $msg = 'Respuesta enviada con &eacute;xito';
     //Set status if any.
     $wasOpen = $ticket->isOpen();
     if (isset($_POST['ticket_status']) && $_POST['ticket_status']) {
         if ($ticket->setStatus($_POST['ticket_status']) && $ticket->reload()) {
             $note = sprintf('%s %s Al enviar ticket de ', $thisuser->getName(), $ticket->isOpen() ? 'reabrir' : 'cerrar');
             $ticket->logActivity('El estado del Ticket a cambiado a ' . ($ticket->isOpen() ? 'Abierto' : 'Cerrado'), $note);
         }
     }
     //Finally upload attachment if any
     if ($_FILES['attachment'] && $_FILES['attachment']['size']) {
         $ticket->uploadAttachment($_FILES['attachment'], $respId, 'R');
     }
     $ticket->reload();
     //Mark the ticket answered if OPEN.
     if ($ticket->isopen()) {
         $ticket->markAnswered();
     } elseif ($wasOpen) {