adminhelp.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:7k
- <?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: adminhelp.php,v $
- // | $Date: 2004/02/10 01:34:24 $
- // | $Revision: 1.6 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Technician FAQ maintenance (administration interface)
- // +-------------------------------------------------------------+
- error_reporting(E_ALL & ~E_NOTICE);
- require_once('./global.php');
- //Nullify WTN-WDYL Team
- admin_header('Technicians FAQ', 'Technicians FAQ');
- developer_check();
- ############################## EDIT ENTRY ################################33
- if ($_REQUEST['do'] == 'editentry') {
- if ($_REQUEST['entry']) {
- $db->query("UPDATE admin_help_entry SET entry = '" .
- mysql_escape_string($_REQUEST['text']) . "'
- WHERE id = '$_REQUEST[entry]'");
- if ($db->affected_rows() > 0) {
- $message = 'Entry updated.';
- } else {
- $message = 'No such entry, or no changes made to text in submitted form. No update performed.';
- }
- }
- }
- ############################### DELETE CATEGORY ###############################
- if ($_REQUEST['do'] == "deletecat") {
- $db->query("SELECT id FROM admin_help_entry WHERE category = '$_REQUEST[category]'");
- if ($db->num_rows() > 0) {
- $error = "<b><center>The category could not be deleted.</b><br />It must contain no help entries before deletion is possible</center><br /><br />";
- } else {
- $db->query("DELETE FROM admin_help_cat WHERE id = '$_REQUEST[category]'");
- jump('adminhelp.php', 'Category Deleted');
- exit();
- }
- }
- ############################### DELETE ENTRY ###############################
- if ($_REQUEST['do'] == "delete") {
- $db->query("DELETE FROM admin_help_entry WHERE id = '$_REQUEST[id]'");
- jump("adminhelp.php?category=$_REQUEST[category]", 'Entry Deleted');
- exit();
- }
- ############################### START DISPLAY ###############################
- echo "<BR>";
- echo "<table width="100%"><tr><td valign="top" width="20%">";
- echo "<table>";
- $db->query("SELECT * FROM admin_help_cat ORDER BY displayorder");
- while ($cat = $db->row_array()) {
- $cat_array[$cat['id']] = $cat['name'];
- echo "<tr><td><img src="./../images/bul072.gif"></td><td><a href="adminhelp.php?category=$cat[id]">" . iff($cat['id'] == $_REQUEST['category'], "<B>") . $cat['name'] . iff($category != $_REQUEST['category'], "</B>") .
- '</a> [' .
- jprompt('Are you sure you want to delete this categorynrThe category will need to be empty before it can be deleted', "adminhelp.php?do=deletecat&id=$entry[id]&category=$cat[id]", 'del') . "]</td></tr>";
- }
- echo "<tr><td><br /> ></td><td><br /><a href="adminhelp.php?do=addcat">Add Category</a></td></tr>";
- echo "<tr><td> ></td><td><a href="adminhelp.php?do=addentry">Add Entry</a></td></tr>";
- echo "</table>";
- echo "</td><td valign="top">$error";
- ############################### VIEW CATEGORY ###############################
- if ($_REQUEST['category']) {
- echo "<table width="100%">";
- $db->query("SELECT * FROM admin_help_entry WHERE category = '$_REQUEST[category]' ORDER BY displayorder");
- while ($entry = $db->row_array()) {
- $i++;
- if ($i == "1") {
- echo "<tr>";
- }
- echo "<td width="25"><img src="./../images/bul062.gif"></td><td width="33%">"
- . iff($entry['id'] == $_REQUEST['entry'], "<B>")
- . "<a href="adminhelp.php?category=$_REQUEST[category]&entry=$entry[id]">$entry[title]</a>"
- . iff($entry[id] == $_REQUEST['entry'], "</B>")
- . ' [' . jprompt('Are you sure you want to delete this entry', "adminhelp.php?do=delete&id=$entry[id]&category=$_REQUEST[category]", 'del') . "]</td>";
- if ($i == "3") {
- echo "</tr>";
- unset($i);
- }
- }
- if ($i == 1) {
- echo "<td></td><td></td></tr>";
- } elseif ($i == 2) {
- echo "<td></td></tr>";
- }
- echo "</table>";
- }
- ############################### VIEW ENTRY ###############################
- if ($_REQUEST['entry']) {
- $result = $db->query_return("SELECT * FROM admin_help_entry WHERE id = $_REQUEST[entry]");
- echo '</P><HR><P>';
- echo $result['entry'] . "</P>n";
- if ($message) {
- print "<P><B>$message</B></P>";
- }
- print "<FORM NAME="edit" ACTION="adminhelp.php?do=editentry" METHOD="POST">n";
- print form_hidden('category', $_REQUEST['category']);
- print form_hidden('entry', $_REQUEST['entry']);
- #print form_textarea('text', '40', '8', htmlchars($result['entry']));
- print form_textarea('text', '80', '10', $result['entry']);
- print '</P>' . form_submit('Edit', 'submit');
- }
- ############################### ADD ENTRY ###############################
- if ($_REQUEST['do'] == "addentry") {
- if (!is_array($cat_array)) {
- echo "<B>You must create a category before creating an entry</B><br /><br />";
- $_REQUEST['do'] = "addcat";
- } else {
- $table[] = array('<b>Category</b>', form_select('new_category', $cat_array));
- $table[] = array('<b>Title</b>', form_input('title'));
- $table[] = array('<b>Entry</b>', form_textarea('new_entry', 70, 10));
- table_header('Create a new article', 'adminhelp.php', array('do' => 'addentry2'));
- table_content('', $table);
- table_footer('Create');
- }
- }
- ############################### ADD ENTRY (2) ###############################
- if ($_REQUEST['do'] == "addentry2") {
- $db->query("INSERT INTO admin_help_entry SET
- title = '" . mysql_escape_string($_REQUEST['title']) . "',
- category = '" . mysql_escape_string($_REQUEST['new_category']) . "',
- entry = '" . mysql_escape_string($_REQUEST['new_entry']) . "'
- ");
- jump('adminhelp.php', 'New Entry Created');
- }
- ############################### ADD CATEGORY ###############################
- if ($_REQUEST['do'] == "addcat") {
- $table[] = array('<b>Category Name</b>', form_input('name', '', 25));
- table_header('Create a new category', 'adminhelp.php', array('do' => 'addcat2'));
- table_content('', $table);
- table_footer('Create');
- }
- ############################### ADD CATEGORY (2) ###############################
- if ($_REQUEST['do'] == "addcat2") {
- $db->query("INSERT INTO admin_help_cat SET
- name = '" . mysql_escape_string($_REQUEST['name']) . "'
- ");
- jump('adminhelp.php', 'New Category Created');
- }