Skip to content
Snippets Groups Projects
Commit 0f28cae4 authored by Peter Rotich's avatar Peter Rotich
Browse files

Refactor attachments upload for the new model.

Change file to unix file format
parent 731baca1
Branches
Tags
No related merge requests found
<?php <?php
/********************************************************************* /*********************************************************************
open.php open.php
New tickets handle. New tickets handle.
Peter Rotich <peter@osticket.com> Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2013 osTicket Copyright (c) 2006-2013 osTicket
http://www.osticket.com http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY. Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details. See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4: vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/ **********************************************************************/
require('client.inc.php'); require('client.inc.php');
define('SOURCE','Web'); //Ticket source. define('SOURCE','Web'); //Ticket source.
$inc='open.inc.php'; //default include. $inc='open.inc.php'; //default include.
$errors=array(); $errors=array();
if($_POST): if($_POST):
$_POST['deptId']=$_POST['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected. $vars = $_POST;
if($thisclient) { $vars['deptId']=$vars['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected.
$_POST['name']=$thisclient->getName(); if($thisclient) {
$_POST['email']=$thisclient->getEmail(); $vars['name']=$thisclient->getName();
} elseif($cfg->isCaptchaEnabled()) { $vars['email']=$thisclient->getEmail();
if(!$_POST['captcha']) } elseif($cfg->isCaptchaEnabled()) {
$errors['captcha']='Enter text shown on the image'; if(!$_POST['captcha'])
elseif(strcmp($_SESSION['captcha'],md5($_POST['captcha']))) $errors['captcha']='Enter text shown on the image';
$errors['captcha']='Invalid - try again!'; elseif(strcmp($_SESSION['captcha'],md5($_POST['captcha'])))
} $errors['captcha']='Invalid - try again!';
}
//Ticket::create...checks for errors..
if(($ticket=Ticket::create($_POST,$errors,SOURCE))){ if(!$errors && $cfg->allowOnlineAttachments() && $_FILES['attachments'])
$msg='Support ticket request created'; $vars['files'] = AttachmentFile::format($_FILES['attachments'], true);
//Upload attachments...
if($cfg->allowOnlineAttachments() && $_FILES['attachments']) //Ticket::create...checks for errors..
$ticket->uploadFiles($_FILES['attachments'], $ticket->getLastMsgId(), 'M'); if(($ticket=Ticket::create($vars, $errors, SOURCE))){
$msg='Support ticket request created';
//Logged in...simply view the newly created ticket. //Logged in...simply view the newly created ticket.
if($thisclient && $thisclient->isValid()) { if($thisclient && $thisclient->isValid()) {
if(!$cfg->showRelatedTickets()) if(!$cfg->showRelatedTickets())
$_SESSION['_client']['key']= $ticket->getExtId(); //Resetting login Key to the current ticket! $_SESSION['_client']['key']= $ticket->getExtId(); //Resetting login Key to the current ticket!
session_write_close(); session_write_close();
session_regenerate_id(); session_regenerate_id();
@header('Location: tickets.php?id='.$ticket->getExtId()); @header('Location: tickets.php?id='.$ticket->getExtId());
} }
//Thank the user and promise speedy resolution! //Thank the user and promise speedy resolution!
$inc='thankyou.inc.php'; $inc='thankyou.inc.php';
}else{ }else{
$errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!'; $errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!';
} }
endif; endif;
//page //page
$nav->setActiveNav('new'); $nav->setActiveNav('new');
require(CLIENTINC_DIR.'header.inc.php'); require(CLIENTINC_DIR.'header.inc.php');
require(CLIENTINC_DIR.$inc); require(CLIENTINC_DIR.$inc);
require(CLIENTINC_DIR.'footer.inc.php'); require(CLIENTINC_DIR.'footer.inc.php');
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment