forked from osTicket/osTicket-1.7
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor attachments upload for the new model.
Change file to unix file format
- Loading branch information
Showing
1 changed file
with
59 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
<?php | ||
/********************************************************************* | ||
open.php | ||
New tickets handle. | ||
Peter Rotich <[email protected]> | ||
Copyright (c) 2006-2013 osTicket | ||
http://www.osticket.com | ||
Released under the GNU General Public License WITHOUT ANY WARRANTY. | ||
See LICENSE.TXT for details. | ||
vim: expandtab sw=4 ts=4 sts=4: | ||
**********************************************************************/ | ||
require('client.inc.php'); | ||
define('SOURCE','Web'); //Ticket source. | ||
$inc='open.inc.php'; //default include. | ||
$errors=array(); | ||
if($_POST): | ||
$_POST['deptId']=$_POST['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected. | ||
if($thisclient) { | ||
$_POST['name']=$thisclient->getName(); | ||
$_POST['email']=$thisclient->getEmail(); | ||
} elseif($cfg->isCaptchaEnabled()) { | ||
if(!$_POST['captcha']) | ||
$errors['captcha']='Enter text shown on the image'; | ||
elseif(strcmp($_SESSION['captcha'],md5($_POST['captcha']))) | ||
$errors['captcha']='Invalid - try again!'; | ||
} | ||
|
||
//Ticket::create...checks for errors.. | ||
if(($ticket=Ticket::create($_POST,$errors,SOURCE))){ | ||
$msg='Support ticket request created'; | ||
//Upload attachments... | ||
if($cfg->allowOnlineAttachments() && $_FILES['attachments']) | ||
$ticket->uploadFiles($_FILES['attachments'], $ticket->getLastMsgId(), 'M'); | ||
|
||
//Logged in...simply view the newly created ticket. | ||
if($thisclient && $thisclient->isValid()) { | ||
if(!$cfg->showRelatedTickets()) | ||
$_SESSION['_client']['key']= $ticket->getExtId(); //Resetting login Key to the current ticket! | ||
session_write_close(); | ||
session_regenerate_id(); | ||
@header('Location: tickets.php?id='.$ticket->getExtId()); | ||
} | ||
//Thank the user and promise speedy resolution! | ||
$inc='thankyou.inc.php'; | ||
}else{ | ||
$errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!'; | ||
} | ||
endif; | ||
|
||
//page | ||
$nav->setActiveNav('new'); | ||
require(CLIENTINC_DIR.'header.inc.php'); | ||
require(CLIENTINC_DIR.$inc); | ||
require(CLIENTINC_DIR.'footer.inc.php'); | ||
?> | ||
<?php | ||
/********************************************************************* | ||
open.php | ||
New tickets handle. | ||
Peter Rotich <[email protected]> | ||
Copyright (c) 2006-2013 osTicket | ||
http://www.osticket.com | ||
Released under the GNU General Public License WITHOUT ANY WARRANTY. | ||
See LICENSE.TXT for details. | ||
vim: expandtab sw=4 ts=4 sts=4: | ||
**********************************************************************/ | ||
require('client.inc.php'); | ||
define('SOURCE','Web'); //Ticket source. | ||
$inc='open.inc.php'; //default include. | ||
$errors=array(); | ||
if($_POST): | ||
$vars = $_POST; | ||
$vars['deptId']=$vars['emailId']=0; //Just Making sure we don't accept crap...only topicId is expected. | ||
if($thisclient) { | ||
$vars['name']=$thisclient->getName(); | ||
$vars['email']=$thisclient->getEmail(); | ||
} elseif($cfg->isCaptchaEnabled()) { | ||
if(!$_POST['captcha']) | ||
$errors['captcha']='Enter text shown on the image'; | ||
elseif(strcmp($_SESSION['captcha'],md5($_POST['captcha']))) | ||
$errors['captcha']='Invalid - try again!'; | ||
} | ||
|
||
if(!$errors && $cfg->allowOnlineAttachments() && $_FILES['attachments']) | ||
$vars['files'] = AttachmentFile::format($_FILES['attachments'], true); | ||
|
||
//Ticket::create...checks for errors.. | ||
if(($ticket=Ticket::create($vars, $errors, SOURCE))){ | ||
$msg='Support ticket request created'; | ||
//Logged in...simply view the newly created ticket. | ||
if($thisclient && $thisclient->isValid()) { | ||
if(!$cfg->showRelatedTickets()) | ||
$_SESSION['_client']['key']= $ticket->getExtId(); //Resetting login Key to the current ticket! | ||
session_write_close(); | ||
session_regenerate_id(); | ||
@header('Location: tickets.php?id='.$ticket->getExtId()); | ||
} | ||
//Thank the user and promise speedy resolution! | ||
$inc='thankyou.inc.php'; | ||
}else{ | ||
$errors['err']=$errors['err']?$errors['err']:'Unable to create a ticket. Please correct errors below and try again!'; | ||
} | ||
endif; | ||
|
||
//page | ||
$nav->setActiveNav('new'); | ||
require(CLIENTINC_DIR.'header.inc.php'); | ||
require(CLIENTINC_DIR.$inc); | ||
require(CLIENTINC_DIR.'footer.inc.php'); | ||
?> |