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

Merge branch 'feature/multifile' into feature/mailfetch-revisited

parents 1290d4a5 caefac39
Branches
Tags
No related merge requests found
...@@ -21,7 +21,7 @@ function clientLoginPage($msg='Unauthorized') { ...@@ -21,7 +21,7 @@ function clientLoginPage($msg='Unauthorized') {
require('client.inc.php'); require('client.inc.php');
if(!defined('INCLUDE_DIR')) Http::response(500,'config error'); if(!defined('INCLUDE_DIR')) Http::response(500, 'Server configuration error');
require_once INCLUDE_DIR.'/class.dispatcher.php'; require_once INCLUDE_DIR.'/class.dispatcher.php';
require_once INCLUDE_DIR.'/class.ajax.php'; require_once INCLUDE_DIR.'/class.ajax.php';
......
...@@ -115,7 +115,7 @@ if(!$ticket) { //New tickets... ...@@ -115,7 +115,7 @@ if(!$ticket) { //New tickets...
} }
//Ticket created...save attachments if enabled. //Ticket created...save attachments if enabled.
if($cfg->allowEmailAttachments() && ($attachments=$parser->getAttachments())) { if($cfg->allowEmailAttachments() && ($attachments=$parser->getAttachments())) {
foreach($attachments as $k=>$attachment) { foreach($attachments as $attachment) {
if($attachment['filename'] && $ost->isFileTypeAllowed($attachment['filename'])) if($attachment['filename'] && $ost->isFileTypeAllowed($attachment['filename']))
$ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']), $msgid, 'M'); $ticket->saveAttachment(array('name' => $attachment['filename'], 'data' => $attachment['body']), $msgid, 'M');
} }
......
...@@ -135,7 +135,7 @@ class FAQ { ...@@ -135,7 +135,7 @@ class FAQ {
if($ids) { if($ids) {
$topics = $this->getHelpTopicsIds(); $topics = $this->getHelpTopicsIds();
foreach($ids as $k=>$id) { foreach($ids as $id) {
if($topics && in_array($id,$topics)) continue; if($topics && in_array($id,$topics)) continue;
$sql='INSERT IGNORE INTO '.FAQ_TOPIC_TABLE $sql='INSERT IGNORE INTO '.FAQ_TOPIC_TABLE
.' SET faq_id='.db_input($this->getId()) .' SET faq_id='.db_input($this->getId())
...@@ -163,7 +163,7 @@ class FAQ { ...@@ -163,7 +163,7 @@ class FAQ {
//Delete removed attachments. //Delete removed attachments.
$keepers = $vars['files']?$vars['files']:array(); $keepers = $vars['files']?$vars['files']:array();
if(($attachments = $this->getAttachments())) { if(($attachments = $this->getAttachments())) {
foreach($attachments as $k=>$file) { foreach($attachments as $file) {
if($file['id'] && !in_array($file['id'], $keepers)) if($file['id'] && !in_array($file['id'], $keepers))
$this->deleteAttachment($file['id']); $this->deleteAttachment($file['id']);
} }
......
...@@ -138,8 +138,8 @@ class osTicket { ...@@ -138,8 +138,8 @@ class osTicket {
if(!$this->isFileTypeAllowed($file)) if(!$this->isFileTypeAllowed($file))
$file['error']='Invalid file type for '.$file['name']; $file['error']='Invalid file type for '.$file['name'];
elseif($file['size']>$this->getConfig()->getMaxFileSize()) elseif($file['size']>$this->getConfig()->getMaxFileSize())
$file['error']=sprintf('File (%s) is too big. Maximum of %s bytes allowed', $file['error']=sprintf('File (%s) is too big. Maximum of %s allowed',
$file['name'], $this->getConfig()->getMaxFileSize()); $file['name'], Format::file_size($this->getConfig()->getMaxFileSize()));
elseif(!$file['error'] && !is_uploaded_file($file['tmp_name'])) elseif(!$file['error'] && !is_uploaded_file($file['tmp_name']))
$file['error']='Invalid or bad upload POST'; $file['error']='Invalid or bad upload POST';
......
...@@ -1412,11 +1412,11 @@ class Ticket{ ...@@ -1412,11 +1412,11 @@ class Ticket{
$attachments = array(); $attachments = array();
//Web based upload.. note that we're not "validating" attachments on response. //Web based upload.. note that we're not "validating" attachments on response.
if($_FILES['attachments'] && ($files=Format::files($_FILES['attachments']))) if($_FILES['attachments'] && ($files=Format::files($_FILES['attachments'])))
$attachments=array_merge($attachments, $this->uploadAttachments($files, $respId,'R')); $attachments=$this->uploadAttachments($files, $respId, 'R');
//Canned attachments... //Canned attachments...
if($vars['cannedattachments'] && is_array($vars['cannedattachments'])) { if($vars['cannedattachments'] && is_array($vars['cannedattachments'])) {
foreach($vars['cannedattachments'] as $k =>$fileId) foreach($vars['cannedattachments'] as $fileId)
if($fileId && $this->saveAttachment($fileId, $respId, 'R')) if($fileId && $this->saveAttachment($fileId, $respId, 'R'))
$attachments[] = $fileId; $attachments[] = $fileId;
} }
......
...@@ -28,7 +28,7 @@ ini_set('display_errors','0'); //Disable error display ...@@ -28,7 +28,7 @@ ini_set('display_errors','0'); //Disable error display
ini_set('display_startup_errors','0'); ini_set('display_startup_errors','0');
//TODO: disable direct access via the browser? i,e All request must have REFER? //TODO: disable direct access via the browser? i,e All request must have REFER?
if(!defined('INCLUDE_DIR')) Http::response(500,'config error'); if(!defined('INCLUDE_DIR')) Http::response(500, 'Server configuration error');
require_once INCLUDE_DIR.'/class.dispatcher.php'; require_once INCLUDE_DIR.'/class.dispatcher.php';
require_once INCLUDE_DIR.'/class.ajax.php'; require_once INCLUDE_DIR.'/class.ajax.php';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment