/**
  * Post a message to the user
  *
  * @return bool
  */
 public function postReply()
 {
     require_once 'modules/mod_kayako/includes/kayako-php-api/kyIncludes.php';
     $confObject = JFactory::getApplication();
     $tmp_path = $confObject->getCfg('tmp_path');
     JTickets::init();
     //Fetch Post data
     $input = JFactory::getApplication()->input;
     $form_value = $input->getArray(array('content' => null, 'id' => null, 'replyattachments' => null));
     $img = $_FILES['replyattachments']['name'];
     //Fetch the email of login User
     $email = JFactory::getUser()->email;
     $user = kyUser::search($email)->getRawArray();
     $ticket_object = kyTicket::get($form_value['id']);
     $user_reply_post = $ticket_object->newPost($user[0], $form_value['content'])->create();
     foreach ($img as $key => $value) {
         $name = time() . $_FILES["replyattachments"]["name"][$key];
         $temp_name = $_FILES["replyattachments"]["tmp_name"][$key];
         $size = $_FILES["replyattachments"]["size"][$key];
         if ($size < 1024 * 1024) {
             move_uploaded_file($temp_name, $tmp_path . "/" . $name);
             $user_reply_post->newAttachmentFromFile(JURI::Root() . "tmp/" . $name)->create();
         }
     }
     return true;
 }
Esempio n. 2
0
 /**
  * Returns User from email
  *
  * @param string $userEmail
  */
 public function getUser($userEmail)
 {
     $_user = kyUser::search($userEmail);
     return $_user[0];
 }
Esempio n. 3
0
    $_ticketPriority['priorityid'] = $_ticketPriorityObject->getId();
    $_ticketPriority['title'] = $_ticketPriorityObject->getTitle();
    $_ticketPriority['displayorder'] = $_ticketPriorityObject->getDisplayOrder();
    $_ticketPriority['type'] = $_ticketPriorityObject->getType();
    $_ticketPriority['frcolorcode'] = $_ticketPriorityObject->getForegroundColor();
    $_ticketPriority['bgcolorcode'] = $_ticketPriorityObject->getBackgroundColor();
    $_ticketPriority['displayicon'] = $_ticketPriorityObject->getDisplayIcon();
    $_ticketPriority['uservisibilitycustom'] = $_ticketPriorityObject->getUserVisibilityCustom();
    $_ticketPriorityContainer[$_ticketPriorityObject->getId()] = $_ticketPriority;
}
if (isset($_GET['aid'])) {
    $_ticketAttachment = kyTicketAttachment::get($_GET['tid'], $_GET['aid']);
    Download($_ticketAttachment->getFileName(), $_ticketAttachment->getContents());
} else {
    if ($_GET['action'] == 'reply') {
        $_user = kyUser::search($clientsdetails['email']);
        $_user = $_user[0];
        $_ticketObject = kyTicket::get($_GET['ticketid']);
        $_ticketPost = kyTicketPost::createNew($_ticketObject, $_user, $_POST['replycontents'])->create();
        //Save ticket post attachments
        foreach ($_FILES['ticketattachments']['tmp_name'] as $_key => $_ticketAttachment) {
            kyTicketAttachment::createNewFromFile($_ticketPost, $_ticketAttachment, $_FILES['ticketattachments']['name'][$_key])->create();
        }
        header('Location: ' . WHMCS_URL . 'viewticket.php?ticketid=' . $_GET['ticketid']);
    } else {
        if ($_REQUEST['action'] == 'update') {
            require_once 'updateticket.php';
            header('Location: ' . WHMCS_URL . 'viewticket.php?ticketid=' . $_GET['ticketid']);
        } else {
            require_once 'ticketview.php';
        }