Merge pull request #455 from mkoch227/attachments-phase-two
Attachments phase twomerge-requests/3/head
commit
1d961132c3
@ -0,0 +1 @@
|
||||
.dropzone,.dropzone *{box-sizing:border-box}.dropzone{position:relative}.dropzone .dz-preview{position:relative;display:inline-block;width:120px;margin:0.5em}.dropzone .dz-preview .dz-progress{display:block;height:15px;border:1px solid #aaa}.dropzone .dz-preview .dz-progress .dz-upload{display:block;height:100%;width:0;background:green}.dropzone .dz-preview .dz-error-message{color:red;display:none}.dropzone .dz-preview.dz-error .dz-error-message,.dropzone .dz-preview.dz-error .dz-error-mark{display:block}.dropzone .dz-preview.dz-success .dz-success-mark{display:block}.dropzone .dz-preview .dz-error-mark,.dropzone .dz-preview .dz-success-mark{position:absolute;display:none;left:30px;top:30px;width:54px;height:58px;left:50%;margin-left:-27px}
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
define('IN_SCRIPT', 1);
|
||||
define('HESK_PATH', '../../../');
|
||||
define('INTERNAL_API_PATH', '../../');
|
||||
require_once(HESK_PATH . 'hesk_settings.inc.php');
|
||||
require_once(HESK_PATH . 'inc/common.inc.php');
|
||||
require_once(HESK_PATH . 'inc/attachments.inc.php');
|
||||
require_once(HESK_PATH . 'inc/posting_functions.inc.php');
|
||||
require_once(INTERNAL_API_PATH . 'core/output.php');
|
||||
require_once(INTERNAL_API_PATH . 'dao/attachment_dao.php');
|
||||
|
||||
hesk_load_internal_api_database_functions();
|
||||
hesk_dbConnect();
|
||||
|
||||
$modsForHesk_settings = mfh_getSettings();
|
||||
|
||||
if (!empty($_FILES)) {
|
||||
// Only 1 files is ever processed through this endpoint at a time.
|
||||
$id = upload_temp_attachment(-1, false);
|
||||
print json_encode($id);
|
||||
return http_response_code(200);
|
||||
}
|
||||
|
||||
return http_response_code(400);
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
function upload_temp_attachment($i, $isTicket) {
|
||||
global $hesk_settings;
|
||||
|
||||
$info = hesk_uploadFile($i, $isTicket);
|
||||
$type = $isTicket ? 1 : 0;
|
||||
|
||||
// `type`: 0: ticket, 1: kb
|
||||
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment` (`file_name`,`size`, `type`, `date_uploaded`, `saved_name`)
|
||||
VALUES ('" . hesk_dbEscape($info['real_name']) . "','" . hesk_dbEscape($info['size']) . "','" . $type . "',
|
||||
NOW(), '" . hesk_dbEscape($info['saved_name']) . "')");
|
||||
|
||||
return hesk_dbInsertID();
|
||||
}
|
||||
|
||||
function delete_temp_attachment($id, $isTicket) {
|
||||
global $hesk_settings;
|
||||
|
||||
$attachment_rs = hesk_dbQuery("SELECT `saved_name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment` WHERE `id` = " . intval($id));
|
||||
$attachment = hesk_dbFetchAssoc($attachment_rs);
|
||||
|
||||
if (hesk_removeAttachments(array($attachment), $isTicket)) {
|
||||
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "temp_attachment` WHERE `id` = " . intval($id));
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
define('IN_SCRIPT', 1);
|
||||
define('HESK_PATH', '../../');
|
||||
define('INTERNAL_API_PATH', '../');
|
||||
require_once(HESK_PATH . 'hesk_settings.inc.php');
|
||||
require_once(HESK_PATH . 'inc/common.inc.php');
|
||||
require_once(HESK_PATH . 'inc/attachments.inc.php');
|
||||
require_once(HESK_PATH . 'inc/posting_functions.inc.php');
|
||||
require_once(INTERNAL_API_PATH . 'core/output.php');
|
||||
require_once(INTERNAL_API_PATH . 'dao/attachment_dao.php');
|
||||
|
||||
hesk_load_internal_api_database_functions();
|
||||
hesk_dbConnect();
|
||||
|
||||
$modsForHesk_settings = mfh_getSettings();
|
||||
|
||||
if (isset($_GET['id'])) {
|
||||
$id = $_GET['id'];
|
||||
|
||||
$id = delete_temp_attachment($id, true);
|
||||
return http_response_code(200);
|
||||
}
|
||||
|
||||
return http_response_code(400);
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
define('IN_SCRIPT', 1);
|
||||
define('HESK_PATH', '../../');
|
||||
define('INTERNAL_API_PATH', '../');
|
||||
require_once(HESK_PATH . 'hesk_settings.inc.php');
|
||||
require_once(HESK_PATH . 'inc/common.inc.php');
|
||||
require_once(HESK_PATH . 'inc/attachments.inc.php');
|
||||
require_once(HESK_PATH . 'inc/posting_functions.inc.php');
|
||||
require_once(INTERNAL_API_PATH . 'core/output.php');
|
||||
require_once(INTERNAL_API_PATH . 'dao/attachment_dao.php');
|
||||
|
||||
hesk_load_internal_api_database_functions();
|
||||
hesk_dbConnect();
|
||||
|
||||
$modsForHesk_settings = mfh_getSettings();
|
||||
|
||||
if (!empty($_FILES)) {
|
||||
// Only 1 files is ever processed through this endpoint at a time.
|
||||
$id = upload_temp_attachment(-1, true);
|
||||
print json_encode($id);
|
||||
return http_response_code(200);
|
||||
}
|
||||
|
||||
return http_response_code(400);
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue