📄 notes.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: notes.php,v $
// | $Date: 2004/02/10 01:34:30 $
// | $Revision: 1.15 $
// +-------------------------------------------------------------+
// | File Details:
// | - Technician notes maintenance.
// +-------------------------------------------------------------+
error_reporting(E_ALL ^ E_NOTICE);
include "./../global.php";
tech_nav('resources');
// default do
$_REQUEST['do'] = trim($_REQUEST['do']);
if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
$_REQUEST['do'] = "view";
}
$result = $db->query_return("SELECT categories FROM tech_folders WHERE type = 'notes' AND techid = '$user[id]'");
$categories = unserialize($result[categories]);
$cat_jump[0] = 'Top Category';
if (is_array($categories)) {
foreach ($categories AS $key => $var) {
$cat_jump[$key] = $var;
}
}
if ($_REQUEST['go'] == 'Go') {
$_REQUEST['do'] = 'view';
}
############################### ADD A NOTE (2) ###############################
if ($_REQUEST['do'] == "add2") {
if (($_REQUEST[title]) AND ($_REQUEST[note])) {
$checks = xss_check(array(
$_REQUEST['title'],
$_REQUEST['note']), 'tech');
$db->query("INSERT INTO tech_notes SET
title = '" . mysql_escape_string($checks[0]) . "',
note = '" . mysql_escape_string($checks[1]) . "',
techid = $user[id],
category = '$_REQUEST[category]',
timestamp = " . mktime() . "
");
jump('notes.php?do=view', 'Your note has been added');
} else {
$_REQUEST['do'] = "add";
}
}
############################### ADD A NOTE ###############################
if ($_REQUEST['do'] == "add") {
$table[] = array('<b>Title</b>', form_input('title', $_REQUEST[title]));
$table[] = array('<b>Category</b>', form_select('category', $cat_jump));
$table[] = array('<b>Note</b>', form_textarea('note', 100, 15, $_REQUEST[note]));
table_header('Add a new note', 'notes.php', array('do' => 'add2'));
table_content($cols, $table);
table_footer('Add Note');
}
############################### NOTE ACTIONS ###############################
if ($_REQUEST['do'] == "doactions") {
// ids of what we are changing (check they don't press submit with no ids!)
if (is_array($_REQUEST['ids'])) {
foreach ($_REQUEST['ids'] AS $key => $var) {
if ($var = 1) {
$id_array[] = $key;
}
}
}
if (is_array($id_array)) {
if ($_REQUEST['actiontype'] == 'delete') {
$db->query("DELETE FROM tech_notes
WHERE techid = '$user[id]'
AND id IN " . array2sql($id_array) . "
");
} elseif ($_REQUEST['actiontype'] == 'move') {
$db->query("UPDATE tech_notes
SET category = '$_REQUEST[B]'
WHERE techid = '$user[id]'
AND id IN " . array2sql($id_array) . "
");
}
}
$_REQUEST['do'] = 'view';
}
############################### VIEW NOTES ###############################
if ($_REQUEST['do'] == "view") {
// for category javascript
foreach($cat_jump AS $key => $var) {
$js .= "\"$var\",\"$key\",";
}
$js = substr($js, 0, -1);
echo get_javascript('DynamicOptionList.js');
echo "
<SCRIPT LANGUAGE=\"JavaScript\">
var listB = new DynamicOptionList(\"B\",\"actiontype\");
listB.addOptions(\"move\",$js);
listB.setDefaultOption(\"move\",\"0\");
function init() {
var theform = document.forms[0];
listB.init(theform);
}
</SCRIPT>
";
$form =
"<select name=\"actiontype\" onChange=\"listB.populate();\">
<option value=\"delete\">Delete</option>
<option value=\"move\">Move</option>
</select>
<select name=\"B\" id=\"B\">
<script language=\"JavaScript\">listB.printOptions()</script>
</select>
<input type=\"submit\" name=\"Process\" value=\"Process\">
<script language=\"JavaScript\">
init()
</script>
";
$db->query("SELECT * FROM tech_notes
WHERE techid = '$user[id]'
AND category = '$_REQUEST[category]'
");
while ($notes = $db->row_array()) {
$table[] = array(
form_checkbox_single($notes[id], 1, '', 'ids'),
$notes[title],
our_date($note[timestamp])
);
$note[] = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" class=\"table_midheader\"><tr><td><table cellspacing=\"1\" cellpadding=\"3\" width=\"100%\"><tr><td bgcolor=\"FFFFFF\">$notes[note]</td></tr></table></td></tr></table>";
}
$toprow = "<p align=\"right\"><b>Category Jump:</b> " . form_select('category', $cat_jump, '', $_REQUEST[category]) . " <input type=\"submit\" name=\"go\" value=\"Go\"> " . thelp('Resources', 'Notes');
$width = array('5', '5', '55%', '45%');
$cols = array("<input type=\"checkbox\" name=\"allbox\" onclick=\"checkall(this.form);\" />", 'Name', 'Date Added');
table_header('Your Notes', 'notes.php', array('do' => 'doactions'), '', 'dpform');
table_content($cols, $table, '', '', $toprow, $note, $width);
table_footer('', 'Left', $form);
echo "<br /><br /><center><a href=\"notes.php?do=add\"><b>Add Notes</b></a> <a href=\"folders.php?type=notes\"><b>Edit Folders</b></a></center>";
}
tech_footer();
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -