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

📄 techhelp.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: techhelp.php,v $
// | $Date: 2004/02/10 01:34:25 $
// | $Revision: 1.6 $
// +-------------------------------------------------------------+
// | File Details:
// | - Technician FAQ maintenacne (administration page)
// +-------------------------------------------------------------+

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 tech_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 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('techhelp.php', 'Category Deleted');
		exit();
	}
}

############################### DELETE ENTRY ###############################
if ($_REQUEST['do'] == "delete") {
	$db->query("DELETE FROM tech_help_entry WHERE id = '$_REQUEST[id]'");
	jump("techhelp.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 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=\"techhelp.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 category\n\rThe category will need to be empty before it can be deleted', "techhelp.php?do=deletecat&id=$entry[id]&category=$cat[id]", 'del') . "]</td></tr>";
}

echo "<tr><td><br />&nbsp;></td><td><br /><a href=\"techhelp.php?do=addcat\">Add Category</a></td></tr>";
echo "<tr><td>&nbsp;></td><td><a href=\"techhelp.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/bul062.gif\"></td><td width=\"33%\">" 
			. iff($entry['id'] == $_REQUEST['entry'], "<B>") 
			. "<a href=\"techhelp.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', "techhelp.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 tech_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=\"techhelp.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', 'techhelp.php', array('do' => 'addentry2'));
		table_content('', $table);
		table_footer('Create');
	}
}

############################### ADD ENTRY (2) ###############################
if ($_REQUEST['do'] == "addentry2") {
	$db->query("INSERT INTO tech_help_entry SET
		title = '" . mysql_escape_string($_REQUEST['title']) . "',
		category = '" . mysql_escape_string($_REQUEST['new_category']) . "',
		entry = '" . mysql_escape_string($_REQUEST['new_entry']) . "'
	");

	jump('techhelp.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', 'techhelp.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('techhelp.php', 'New Category Created');
}

⌨️ 快捷键说明

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