index.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:6k
- <?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: index.php,v $
- // | $Date: 2004/02/10 01:34:28 $
- // | $Revision: 1.17 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Administrator-provided technician interface help system.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_nav('help');
- ############################### DELETE CATEGORY ###############################
- if ($_REQUEST['do'] == "deletecat") {
- $db->query("SELECT id FROM tech_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 tech_help_cat WHERE id = '$_REQUEST[category]'");
- jump('index.php', 'Category Deleted');
- exit();
- }
- }
- ############################### DELETE ENTRY ###############################
- if ($_REQUEST['do'] == "delete") {
- $db->query("DELETE FROM tech_help_entry WHERE id = '$_REQUEST[id]'");
- jump("index.php?category=$_REQUEST[category]", 'Entry Deleted');
- exit();
- }
- ############################### START DISPLAY ###############################
- ?>
- <table><tr><td> <?php echo html_image('pic010.gif')?></td><td> <a href="javascript:onClick=openWindow('deskpro_help.php?mini=1', 650, 550, 'Help')"><b>Lanuch DeskPRO Software Help</b></a></td></tr></table>
- <?php
- echo "<BR>";
- echo "<table width="100%"><tr><td valign="top" width="100">";
- echo "<table>";
- $db->query("SELECT * FROM tech_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="index.php?category=$cat[id]">" . iff($cat['id'] == $_REQUEST['category'], "<B>") . str_replace(' ', ' ', $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', "index.php?do=deletecat&id=$entry[id]&category=$cat[id]", 'x') . "]</td></tr>";
- }
- echo "<tr><td><br /> ></td><td><br /><a href="index.php?do=addcat">Add Category</a></td></tr>";
- echo "<tr><td> ></td><td><a href="index.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 tech_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/bul082.gif"></td><td width="33%">" . iff($entry['id'] == $_REQUEST['entry'], "<B>") . "<a href="index.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', "index.php?do=delete&id=$entry[id]&category=$_REQUEST[category]", 'x') . "]</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 tech_help_entry WHERE id = '$_REQUEST[entry]'");
- echo "<HR>";
- echo $result['entry'];
- }
- ############################### 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', 'index.php', array('do' => 'addentry2'));
- table_content('', $table);
- table_footer('Create');
- }
- }
- ############################### ADD ENTRY (2) ###############################
- if ($_REQUEST['do'] == "addentry2") {
- $checks = xss_check(array(
- $_REQUEST['title'],
- $_REQUEST['new_category'],
- $_REQUEST['new_entry']), 'tech');
- $db->query("INSERT INTO tech_help_entry SET
- title = '" . mysql_escape_string($checks[0]) . "',
- category = '" . mysql_escape_string($checks[1]) . "',
- entry = '" . mysql_escape_string($checks[2]) . "'
- ");
- jump('index.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', 'index.php', array('do' => 'addcat2'));
- table_content('', $table);
- table_footer('Create');
- }
- ############################### ADD CATEGORY (2) ###############################
- if ($_REQUEST['do'] == "addcat2") {
- $db->query("INSERT INTO tech_help_cat SET
- name = '" . mysql_escape_string($_REQUEST['name']) . "'
- ");
- jump('index.php', 'New Category Created');
- }