comments.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:4k
- <?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: comments.php,v $
- // | $Date: 2004/02/10 01:34:26 $
- // | $Revision: 1.10 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - View new comments
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_nav('faq');
- // default do
- $_REQUEST['do'] = trim($_REQUEST['do']);
- if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
- $_REQUEST['do'] = "view";
- }
- // globalise variables
- $global = array (
- array('id')
- );
- rg($global);
- include ("./faq_include.php");
- ############################### DELETE COMMMENT ###############################
- if ($_REQUEST['do'] == 'delcomment') {
-
- if ($user['p_delete_c_k']) {
- $db->query("DELETE FROM faq_comments WHERE id = '$_REQUEST[comment]'");
- alert("Comment deleted.");
- } else {
- alert("You don't have permission to delete comments.");
- }
- $_REQUEST['do'] = 'view';
- }
- ############################### MARK READ ###############################
- if ($_REQUEST['do'] == 'not_new') {
- if ($id) {
- $db->query("UPDATE faq_comments SET new = 0 WHERE id = '$id'");
- alert('Comment marked not new');
- }
- $_REQUEST['do'] = 'view';
- }
- ############################### SEND GENERIC RESPONSE ###############################
- if ($_REQUEST['do'] == 'standard_email') {
- // need to get email address
- $comment = $db->query_return("SELECT * FROM faq_comments WHERE id = '$id' AND new");
- if (is_array($comment)) {
- if ($comment[useremail]) {
- $user_details['email'] = $comment[useremail];
- } else {
- $user_details = $db->query_return("SELECT email FROM user WHERE id = '$comment[userid]'");
- }
- // get article
- $article = $db->query_return("SELECT * FROM faq_articles WHERE id = '$comment[articleid]'");
- // now send the standard email address
- if (validate_email($user_details['email'])) {
- $user_details = update_user_details($user_details);
- eval(makeemaileval('message', 'BODY_comment_standard', $subject));
- dp_mail($user_details['email'], $subject, $message);
- }
- if ($id) {
- $db->query("UPDATE faq_comments SET new = 0 WHERE id = '$id'");
- alert("Acknowledgement email sent ($user_details[email]) and comment updated to not new");
- }
- }
- $_REQUEST['do'] = 'view';
- }
- ############################### VIEW NEW COMMENTS ###############################
- if ($_REQUEST['do'] == "view") {
- $db->query("
- SELECT faq_comments.*, faq_articles.answer, user.username, user.email, faq_articles.question, faq_articles.title
- FROM faq_comments
- LEFT JOIN faq_articles ON (faq_articles.id = faq_comments.articleid)
- LEFT JOIN user ON (user.id = faq_comments.userid)
- WHERE new
- ");
- while ($result = $db->row_array()) {
- if ($result[userid]) {
- $show_name = "<a href="./../users/view.php?id=$result[userid]">$result[username]</a>";
- } else {
- $show_name = $result[useremail];
- }
- $table[] = array(
- "<a href="./view.php?articleid=$result[articleid]">$result[title]</a>",
- $result[comments],
- $show_name,
- "<a href="./comments.php?do=standard_email&id=$result[id]">Acknowledge</a> | <a href="./../tickets/newticket.php?commentid=$result[id]">Start Ticket</a> | <a href="./comments.php?do=not_new&id=$result[id]">No Response</a>"
- );
- }
- if (!is_array($table)) {
- $table[] = 'There are currently no new FAQ comments';
- }
- $cols = array('Title', 'User Comments', 'Submitter', 'Mark Read & Respond');
- table_header('View and respond to FAQ comments');
- table_content($cols, $table);
- table_footer();
- }
- tech_footer();
- ?>