⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addattachments.php

📁 jsp程序开发系统
💻 PHP
字号:
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: addattachments.php,v $
// | $Date: 2004/02/10 01:34:30 $
// | $Revision: 1.17 $
// +-------------------------------------------------------------+
// | File Details:
// | - Ticket attachment handler
// +-------------------------------------------------------------+

error_reporting(E_ALL ^ E_NOTICE);

// start file
require("./../global.php");
tech_mini_header('Add Attachment');

// globalise variables
$global = array	(
			array('ticketid')			// ticketid
);
rg($global);

// default do
$_REQUEST['do'] = trim($_REQUEST['do']);
if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
	$_REQUEST['do'] = "form";
}

// globalise variables
$global = array	(
			array('id')			// ticketid
);
rg($global);

############################### PROCESS ATTACHMENT ###############################

if ($_REQUEST['do'] == "upload") {
	$added = array();
	if (is_array($_FILES)) {
		foreach ($_FILES AS $key => $var) {
			if ($_FILES[$key][name] != '') { // if email later
				 if (validate_attachment($error, $key)) { // add attachment
					$attach = add_attachment($key);

					$db->query("INSERT INTO ticket_attachments SET
						blobid = '$attach[blobid]',
						filename = '" . mysql_escape_string($attach[name]) . "',
						filesize = '" . mysql_escape_string($attach[size]) . "',
						extension = '" . mysql_escape_string($attach[extension]) . "',
						timestamp = '" . mktime() . "',
						toemail = '" . iff($_REQUEST['email'], 1, 0) . "',
						techid = '$user[id]',
						ticketid = '$id'
					");
					$newid = $db->last_id();

					$i++;
					$added[] = array('id' => $newid, 'name' => $attach['name']);
					ticketlog($id, 'add_attach', $newid, NULL, $attach[name]);
				 } else {
					 $errors .= $error;
				}
			}
		}
	}

	if ($message) {
		alert($message);
	}
	
	$_REQUEST['do'] = 'form';
}

############################### ADD ATTACHMENT ###############################

if ($_REQUEST['do'] == "form") { ?>

<SCRIPT LANGUAGE="JavaScript">
	function addDIV(id, data) {
		window.opener.document.getElementById('newattachments').innerHTML += '<DIV ID="' + id + '">' + data + '</DIV>';
	}

	function hideDIV(id) {
		window.opener.document.getElementById(id).style.display = "none";
	}
</SCRIPT>

<?php

	$table[] = "<input type=\"file\" name=\"attachment1\">";
	$table[] = "<input type=\"file\" name=\"attachment2\">";
	$table[] = "<input type=\"file\" name=\"attachment3\">";
	$table[] = "<input type=\"file\" name=\"attachment4\">";
	$table[] = "<input type=\"file\" name=\"attachment5\">";

	$table[] = form_checkbox_single('email', 1, $_REQUEST['form_checkbox_single']) . " Email attachment(s) upon next ticket reply";

	table_header('Add Attachments', 'addattachments.php', array('do' => 'upload', 'id' => $id), '', '', 1);
	table_content('', $table);
	table_footer("Upload");

	if (@count($added)) {

		echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";

		foreach ($added AS $add) {
			$data = "$add[name] (<A HREF=\"javascript:openWindow('attachment.php?id=$add[id]&do=delete&js=1', '', '')\">del</A>)<br />";
			$data = addslashes($data);
			echo "addDIV('att$add[id]', '$data');\n";
		}

		echo "</SCRIPT>\n";

		echo "Added " . count($added) . " attachment(s). These will be shown in the Reply area of the ticket page.";
	}

	echo "<p align=\"right\"><a href=\"javascript:self.close()\">Close attachment page</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -