folders.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:4k
- <?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: folders.php,v $
- // | $Date: 2004/02/10 01:34:30 $
- // | $Revision: 1.12 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Folders 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";
- }
- echo table_border('<table width="95%" border="0" align="center"><tr>
- <td align="center"><a href="folders.php?type=bookmarks">Bookmarks Folders</a></td>
- <td align="center"><a href="folders.php?type=attachments">Attachments Folders</a></td>
- <td align="center"><a href="folders.php?type=notes">Notes Folders</a></td>
- <td align="center"><a href="folders.php?type=savedtickets">Saved Tickets Folders</a></td>
- </tr><tr><td colspan="4"><br /><center>' . thelp('Settings', 'Folders') . '</center></td></tr></table>');
- echo "<br />";
- if ($_REQUEST['type'] == 'bookmarks') {
- $type = 'bookmarks';
- $title = 'Bookmark';
- } elseif ($_REQUEST['type'] == 'attachments') {
- $type = 'attachments';
- $title = 'Attachment';
- } elseif ($_REQUEST['type'] == 'notes') {
- $type = 'notes';
- $title = 'Note';
- } elseif ($_REQUEST['type'] == 'savedtickets') {
- $type = 'savedtickets';
- $title = 'Saved Ticket';
- } else {
- exit();
- }
- ############################### UPDATE FOLDERS ###############################
- if ($_REQUEST['do'] == "update") {
- $result = $db->query_return("
- SELECT categories
- FROM tech_folders
- WHERE techid = '$user[id]'
- AND type = '$type'
- ");
- $categories = unserialize($result[categories]);
- if (is_array($categories)) {
- foreach ($categories AS $key => $var) {
- $current_id[] = $key;
- }
- }
- foreach ($_REQUEST['name'] AS $key => $var) {
- // for categories deleting
- if (trim($var) == '') {
- if (@in_array($key, $current_id)) {
- $delete_id[] = $key;
- }
- } else {
- $names[$key] = $var;
- }
- }
- if (is_array($delete_id)) {
- $db->query("UPDATE tech_$type SET category = '0' WHERE category IN " . array2sql($delete_id) . "");
- }
- $db->query("DELETE FROM tech_folders WHERE techid = '$user[id]' AND type = '$type'");
- $db->query("REPLACE INTO tech_folders
- SET categories = '" . mysql_escape_string(serialize($names)) . "',
- techid = '$user[id]',
- type = '$type'
- ");
- alert('Categories Updated');
- $_REQUEST['do'] = 'view';
- }
- ############################### ADD A FOLDER ###############################
- if ($_REQUEST['do'] == "view") {
- $result = $db->query_return("
- SELECT categories
- FROM tech_folders
- WHERE techid = '$user[id]'
- AND type = '$type'
- ");
- $categories = unserialize($result[categories]);
- if (is_array($categories)) {
- foreach ($categories AS $key => $var) {
- $table[] = form_input($key, $var, 40, 'name');
- $max = iff($key > $max, $key, $max);
- }
- }
- $max++;
- $table[] = form_input($max, '', 40, 'name');
- $max++;
- $table[] = form_input($max, '', 40, 'name');
- $max++;
- $table[] = form_input($max, '', 40, 'name');
- $max++;
- $table[] = form_input($max, '', 40, 'name');
- $max++;
- $table[] = form_input($max, '', 40, 'name');
- $max++;
- $table[] = form_input($max, '', 40, 'name');
- table_header($title . " Categories", 'folders.php', array('do' => 'update', 'type' => $_REQUEST['type']));
- table_content($cols, $table);
- table_footer('Update');
- }
- tech_footer();
- ?>