techhelp.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:7k
源码类别:

电子政务应用

开发平台:

Java

  1. <?php
  2. // +-------------------------------------------------------------+
  3. // | DeskPRO v [2.0.1 Production]
  4. // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
  5. // | Supplied by WTN-WDYL
  6. // | Nullified by WTN-WDYL
  7. // | Distribution via WebForum, ForumRU and associated file dumps
  8. // +-------------------------------------------------------------+
  9. // | DESKPRO IS NOT FREE SOFTWARE
  10. // +-------------------------------------------------------------+
  11. // | License ID : Full Enterprise License =) ...
  12. // | License Owner : WTN-WDYL Team
  13. // +-------------------------------------------------------------+
  14. // | $RCSfile: techhelp.php,v $
  15. // | $Date: 2004/02/10 01:34:25 $
  16. // | $Revision: 1.6 $
  17. // +-------------------------------------------------------------+
  18. // | File Details:
  19. // | - Technician FAQ maintenacne (administration page)
  20. // +-------------------------------------------------------------+
  21. error_reporting(E_ALL & ~E_NOTICE);
  22. require_once('./global.php');
  23. //Nullify WTN-WDYL Team
  24. admin_header('Technicians FAQ', 'Technicians FAQ');
  25. developer_check();
  26. ############################## EDIT ENTRY ################################33
  27. if ($_REQUEST['do'] == 'editentry') {
  28. if ($_REQUEST['entry']) {
  29. $db->query("UPDATE tech_help_entry SET entry = '" . 
  30. mysql_escape_string($_REQUEST['text']) . "'
  31. WHERE id = '$_REQUEST[entry]'");
  32. if ($db->affected_rows() > 0) {
  33. $message = 'Entry updated.';
  34. } else {
  35. $message = 'No such entry, or no changes made to text in submitted form. No update performed.';
  36. }
  37. }
  38. }
  39. ############################### DELETE CATEGORY ###############################
  40. if ($_REQUEST['do'] == "deletecat") {
  41. $db->query("SELECT id FROM tech_help_entry WHERE category = '$_REQUEST[category]'");
  42. if ($db->num_rows() > 0) {
  43. $error = "<b><center>The category could not be deleted.</b><br />It must contain no help entries before deletion is possible</center><br /><br />";
  44. } else {
  45. $db->query("DELETE FROM tech_help_cat WHERE id = '$_REQUEST[category]'");
  46. jump('techhelp.php', 'Category Deleted');
  47. exit();
  48. }
  49. }
  50. ############################### DELETE ENTRY ###############################
  51. if ($_REQUEST['do'] == "delete") {
  52. $db->query("DELETE FROM tech_help_entry WHERE id = '$_REQUEST[id]'");
  53. jump("techhelp.php?category=$_REQUEST[category]", 'Entry Deleted');
  54. exit();
  55. }
  56. ############################### START DISPLAY ###############################
  57. echo "<BR>";
  58. echo "<table width="100%"><tr><td valign="top" width="20%">";
  59. echo "<table>";
  60. $db->query("SELECT * FROM tech_help_cat ORDER BY displayorder");
  61. while ($cat = $db->row_array()) {
  62. $cat_array[$cat['id']] = $cat['name'];
  63. 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>") .
  64. '</a> [' .
  65. jprompt('Are you sure you want to delete this categorynrThe category will need to be empty before it can be deleted', "techhelp.php?do=deletecat&id=$entry[id]&category=$cat[id]", 'del') . "]</td></tr>";
  66. }
  67. echo "<tr><td><br />&nbsp;></td><td><br /><a href="techhelp.php?do=addcat">Add Category</a></td></tr>";
  68. echo "<tr><td>&nbsp;></td><td><a href="techhelp.php?do=addentry">Add Entry</a></td></tr>";
  69. echo "</table>";
  70. echo "</td><td valign="top">$error";
  71. ############################### VIEW CATEGORY ###############################
  72. if ($_REQUEST['category']) {
  73. echo "<table width="100%">";
  74. $db->query("SELECT * FROM tech_help_entry WHERE category = '$_REQUEST[category]' ORDER BY displayorder");
  75. while ($entry = $db->row_array()) {
  76. $i++;
  77. if ($i == "1") {
  78. echo "<tr>";
  79. }
  80. echo "<td width="25"><img src="./../images/bul062.gif"></td><td width="33%">" 
  81. . iff($entry['id'] == $_REQUEST['entry'], "<B>") 
  82. . "<a href="techhelp.php?category=$_REQUEST[category]&entry=$entry[id]">$entry[title]</a>" 
  83. . iff($entry[id] == $_REQUEST['entry'], "</B>") 
  84. . ' [' . jprompt('Are you sure you want to delete this entry', "techhelp.php?do=delete&id=$entry[id]&category=$_REQUEST[category]", 'del') . "]</td>";
  85. if ($i == "3") {
  86. echo "</tr>";
  87. unset($i);
  88. }
  89. }
  90. if ($i == 1) {
  91. echo "<td></td><td></td></tr>";
  92. } elseif ($i == 2) {
  93. echo "<td></td></tr>";
  94. }
  95. echo "</table>";
  96. }
  97. ############################### VIEW ENTRY ###############################
  98. if ($_REQUEST['entry']) {
  99. $result = $db->query_return("SELECT * FROM tech_help_entry WHERE id = $_REQUEST[entry]");
  100. echo '</P><HR><P>';
  101. echo $result['entry'] . "</P>n";
  102. if ($message) {
  103. print "<P><B>$message</B></P>";
  104. }
  105. print "<FORM NAME="edit" ACTION="techhelp.php?do=editentry" METHOD="POST">n";
  106. print form_hidden('category', $_REQUEST['category']);
  107. print form_hidden('entry', $_REQUEST['entry']);
  108. #print form_textarea('text', '40', '8', htmlchars($result['entry']));
  109. print form_textarea('text', '80', '10', $result['entry']);
  110. print '</P>' . form_submit('Edit', 'submit');
  111. }
  112. ############################### ADD ENTRY ###############################
  113. if ($_REQUEST['do'] == "addentry") {
  114. if (!is_array($cat_array)) {
  115. echo "<B>You must create a category before creating an entry</B><br /><br />";
  116. $_REQUEST['do'] = "addcat";
  117. } else {
  118. $table[] = array('<b>Category</b>', form_select('new_category', $cat_array));
  119. $table[] = array('<b>Title</b>', form_input('title'));
  120. $table[] = array('<b>Entry</b>', form_textarea('new_entry', 70, 10));
  121. table_header('Create a new article', 'techhelp.php', array('do' => 'addentry2'));
  122. table_content('', $table);
  123. table_footer('Create');
  124. }
  125. }
  126. ############################### ADD ENTRY (2) ###############################
  127. if ($_REQUEST['do'] == "addentry2") {
  128. $db->query("INSERT INTO tech_help_entry SET
  129. title = '" . mysql_escape_string($_REQUEST['title']) . "',
  130. category = '" . mysql_escape_string($_REQUEST['new_category']) . "',
  131. entry = '" . mysql_escape_string($_REQUEST['new_entry']) . "'
  132. ");
  133. jump('techhelp.php', 'New Entry Created');
  134. }
  135. ############################### ADD CATEGORY ###############################
  136. if ($_REQUEST['do'] == "addcat") {
  137. $table[] = array('<b>Category Name</b>', form_input('name', '', 25));
  138. table_header('Create a new category', 'techhelp.php', array('do' => 'addcat2'));
  139. table_content('', $table);
  140. table_footer('Create');
  141. }
  142. ############################### ADD CATEGORY (2) ###############################
  143. if ($_REQUEST['do'] == "addcat2") {
  144. $db->query("INSERT INTO tech_help_cat SET
  145. name = '" . mysql_escape_string($_REQUEST['name']) . "'
  146. ");
  147. jump('techhelp.php', 'New Category Created');
  148. }