popupactions.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:8k
- <?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: popupactions.php,v $
- // | $Date: 2004/02/10 01:34:30 $
- // | $Revision: 1.40 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Large edit box, view raw messages, edit messages popup.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- // start file
- require("./../global.php");
- // globalise variables
- $global = array (
- array('id') // ticketid
- );
- rg($global);
- ############################## ADD TICKET NOTE (2) ##############################
- if ($_REQUEST['do'] == 'note2') {
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$id'");
- if (p_ticket('edit')) {
- if ($_REQUEST['note']) {
- $note = xss_check($_REQUEST['note'], 'tech');
- $db->query("
- INSERT INTO ticket_notes SET
- date = '" . mktime() . "',
- techid = '$user[id]',
- ticketid = '$id',
- note = '" . mysql_escape_string($note) . "'
- ");
-
- ticketlog($id, 'note', 0, 0, NULL, mysql_escape_string($_REQUEST['note']), NULL);
- ?>
- <HTML><SCRIPT language="javascript">
- window.opener.location.reload();
- alert('Noted Added');
- window.close();
- </SCRIPT>
- </HTML>
- <?php
- } else {
- alert('You did not enter a note');
- $_REQUEST['do'] = 'note';
- }
-
- } else {
- alert('You do not have permission to add a note');
- ?>
- <HTML><SCRIPT language="javascript">
- window.opener.location.reload();
- alert('Noted Added');
- window.close();
- </SCRIPT>
- </HTML>
- <?php
- }
- }
- ############################## ADD TICKET NOTE ##############################
- if ($_REQUEST['do'] == 'note') {
- tech_mini_header();
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$id'");
- if (p_ticket('edit')) {
- table_header('Add a note to this ticket', 'popupactions.php', array('do' => 'note2', 'id' => $id));
- table_content('', array('<center>' . form_textarea('note', 60, 12) . '</center>'));
- table_footer('Add Note');
- } else {
- nopermission('to edit this ticket');
- }
- }
- ############################## VIEW RAW MESSAGE ##############################
- if ($_REQUEST['do'] == 'raw') {
- header('text/plain');
- $message = $db->query_return("SELECT * FROM ticket_message WHERE id = '$_REQUEST[id]'");
- if ($message['ticketid']) {
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$message[ticketid]'");
- } else {
- mistake("No such ticket.");
- }
- if (p_ticket('view')) {
- print "<PRE>" . htmlspecialchars_uni($message['message']) . "</PRE>";
- }
- }
- ############################### LARGE EDIT BOX ###############################
- if ($_REQUEST['do'] == "largeedit") {
- tech_mini_header();
- echo "<form name="largeedit" action="popupactions.php" method="POST">";
- $table[] = "<center>" . form_textarea('message', 120, 35, '') . "</center><br />";
- $table[] = "<center><input type="button" value="Close and Copy Back to Ticket Page" onclick="javascript:window.opener.document.dpreply.reply.value=document.largeedit.message.value;opener.focus();self.close();">";
- table_header('Large Message Box');
- table_content('', $table);
- table_footer();
- echo "</form>";
- ?>
- <SCRIPT language="javascript">
- document.largeedit.message.value = window.opener.document.dpreply.reply.value;
- </SCRIPT>
- <?php
- }
- ############################### FORM: EDIT MESSAGE ###############################
- if ($_REQUEST['do'] == "editmessage") {
- tech_mini_header();
- $result = $db->query_return("SELECT * FROM ticket_message WHERE id = '$id'");
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$result[ticketid]'");
- if (p_ticket('edit')) {
- $table[] = "<center>" . form_textarea('message', 50, 10, $result[message]) . "</center>";
- table_header('Edit Message', 'popupactions.php', array('do' => 'editmessage2', 'id' => $id));
- table_content('', $table);
- table_footer('Update');
- }
- }
- ############################### EDIT MESSAGE ###############################
- if ($_REQUEST['do'] == "editmessage2") {
- tech_mini_header();
- $data = $db->query_return("SELECT ticketid, message FROM ticket_message WHERE id = '$id'");
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$data[ticketid]'");
- if (p_ticket('edit', $ticket)) {
- $db->query("UPDATE ticket_message SET
- message = '" . mysql_escape_string($_REQUEST['message']) . "'
- WHERE id = '$id'
- ");
- ticketlog($data['ticketid'], 'message_edit', $id, NULL, $data['message'], $_REQUEST['message']);
- ?><HTML><SCRIPT language="javascript">
- window.opener.location.reload();
- alert('Message Updated');
- window.close();
- </SCRIPT>
- <BODY>Message Updated</BODY></HTML>
- <?php
- } else {
- ?><HTML><SCRIPT language="javascript">
- alert('ERROR: You do not have permission to edit this ticket.');
- window.close();
- </SCRIPT>
- <BODY>ERROR: You don't have permission to edit this ticket.</BODY></HTML>
- <?php
- }
- }
- ############################### VIEW MESSAGE SOURCE ###############################
- if ($_REQUEST['do'] == "view_source") {
- global $ticket;
- tech_mini_header();
- $result = $db->query_return("SELECT ticketid, sourceid FROM ticket_message WHERE id = '" . intval($id) . "'");
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$result[ticketid]'");
- if (p_ticket('view')) {
- $source = $db->query_return("SELECT * FROM gateway_source WHERE id = '$result[sourceid]'");
- echo $source['source'];
- } else {
- echo "<B>Error:</B> You don't have permission to view this ticket or its messages.";
- }
- }
- if ($_REQUEST['do'] == 'store') {
- tech_mini_header();
- $cats = $db->query_return("SELECT categories FROM tech_folders WHERE techid = '$user[id]'");
- $cats = unserialize($cats['categories']);
- $cats[0] = "Top Level";
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$id'");
- if (p_ticket('view', $ticket)) {
- $stored = $db->query_return("SELECT * FROM tech_ticket_save WHERE ticketid = '$id'");
- if (!$db->num_rows()) {
- $table[] = "<center>" . form_select('category', $cats) . "</center>";
- table_header('Save Ticket to Folder', 'popupactions.php', array('do' => 'store2', 'id' => $id));
- table_content('', $table);
- table_footer('Save');
- } else {
- echo "<B>Error:</B> This ticket is already saved.";
- }
- } else {
- echo "<B>Error:</B> You don't have permission to view this ticket.";
- }
- }
- if ($_REQUEST['do'] == 'store2') {
- tech_mini_header();
- $ticket = $db->query_return("SELECT * FROM ticket WHERE id = '$id'");
- if (p_ticket('view', $ticket)) {
- $stored = $db->query_return("SELECT * FROM tech_ticket_save WHERE ticketid = '$id'");
- if (!$db->num_rows()) {
- $db->query("INSERT INTO tech_ticket_save SET ticketid = '$id', techid = '$user[id]', message = '', category = '$_REQUEST[category]'");
- ?><HTML><SCRIPT language="javascript">
- window.opener.location.reload();
- alert('Ticket Saved');
- window.close();
- </SCRIPT>
- <BODY>Ticket Saved</BODY></HTML>
- <?php
- } else {
- echo "<B>Error:</B> This ticket is already saved.";
- }
- } else {
- echo "<B>Error:</B> You don't have permission to view this ticket.";
- }
- }