view.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:8k
- <?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: view.php,v $
- // | $Date: 2004/02/10 01:34:32 $
- // | $Revision: 1.53 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - User details viewer.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- // start file
- require("./../global.php");
- // globalise variables
- $global = array (
- array('id')
- );
- rg($global);
- tech_nav('users');
- if (!$id) {
- mistake('No user specified', 1);
- exit();
- }
- $user_details = $db->query_return("SELECT * FROM user WHERE id = '$id'");
- if (!$db->num_rows()) {
- mistake('The specified user could not be found.', 1);
- exit;
- }
- ############################### USER FIELDS ###############################
- // standard fields
- if ($user_details[expire_date]) {
- $formdate = iff($user['p_user_expire'], form_date('expire_date', '', $user_details['expire_date'], '', 1), date('Y-m-d', $user_details['expire_date']));
- } else {
- $formdate = iff($user['p_user_expire'], form_date('expire_date', '', 0, 0, 1), 'None');
- }
- if (!$user_details['expire_tickets'] AND !$user['p_user_expire']) {
- $user_details['expire_tickets'] = 0;
- }
- $edit_userfields[] = array(table_thelp('<b>Name</b>', 'Users', 'Add/Edit: Username'), iff($user['p_edit_users'], form_input('name', $user_details['name']), $user_details['name']));
- $edit_userfields[] = array(table_thelp('<b>Username</b>', 'Users', 'Add/Edit: Username'), iff($user['p_edit_users'], form_input('username', $user_details['username']), $user_details['username']));
- $edit_userfields[] = array(table_thelp('<b>Password</b>', 'Users', 'Add/Edit: Password'), iff($user['p_edit_users'],
- jprompt("This will change the user's password to a new random one.",
- "actions.php?id=$id&do=newpass",
- 'Generate New Password'), 'No permission to reset password.'));
- if (banned_email($user_details['email'])) {
- $banned = "<I>This e-mail address is banned.</I>";
- }
- $edit_userfields[] = array(table_thelp('<B>Email Address</b>', 'Users', 'Add/Edit: E-mail Address'), iff($user['p_edit_users'], form_input('email', $user_details['email']), $user_details['email']) . " $banned");
- $edit_userfields[] = array(table_thelp('<B>User Expires</B> ', 'Users', 'Edit: User Expires'),
- '# Tickets: ' . iff(($user['p_user_expire'] AND $user['p_edit_users']), form_input('expire_tickets', $user_details['expire_tickets'], 5), $user_details['expire_tickets']) . ' On Date: ' . $formdate);
- $edit_userfields[] = array(table_thelp('<B>Has Autoresponder?</B> ', 'Users', 'Edit: Has Autoresponder?'),
- iff($user['p_edit_users'], form_radio_yn('autoresponds', NULL, $user_details['autoresponds']), iff($user_details['autoresponds'], 'Yes', 'No')));
- $edit_userfields[] = array(table_thelp('<b>Timezone</b>', 'Users', 'Edit: Timezone'), iff($user['p_edit_users'], make_timezone($user_details['timezone'])));
- $edit_userfields[] = array(table_thelp('<b>Daylight Savings Time</b>', 'Users', 'Edit: Timezone'), iff($user['p_edit_users'], form_checkbox_single('timezone_dst', 1, $user_details['timezone_dst'])));
- $edit_userfields[] = array(table_thelp('<b>User Disabled<b>', 'Users', 'Edit: Disabled'), iff($user['p_edit_users'], form_radio_yn('disabled', NULL, $user_details[disabled]), iff($user_details['disabled'], 'Yes', 'No')));
- if ($user['p_delete_users']) {
- $edit_userfields[] = array('<B>Delete User</B>', jprompt('This will delete the user and all tickets created by the user', "actions.php?do=delete&id=$user_details[id]", 'Delete User'));
- }
- if ($user_details['awaiting_manual_validation']) {
- $bit = "<A HREF="index.php?do=approve&id=$user_details[id]">Approve</A> | ". jprompt('This will *delete* the user from the system!', "index.php?do=delete&id=$user_details[id]", "Delete");
- $edit_userfields[] = array(table_thelp('<b>Manual Validation Required<b>', 'Users', 'Edit: Manual Validation Required'), iff($user['p_edit_users'], $bit, "Yes"));
- }
- // custom fields
- $db->query("SELECT * FROM user_def WHERE tech_viewable ORDER by displayorder");
- while ($result = $db->row_array()) {
-
- $result[display_name] = unserialize($result[display_name]);
- $result[display_name] = $result[display_name][$settings[default_language]];
- $result[description] = unserialize($result[description]);
- $result[description] = $result[description][$settings[default_language]];
- $edit_userfields[] =
- array("<b>$result[display_name]</b><br />$result[description]",
- field_def(
- $result,
- $type='edit',
- '',
- '',
- $user_details[$result[name]])
- );
- }
- if ($user['p_edit_users']) {
- table_header('Edit User Details', 'actions.php', array('do' => 'update_fields', 'id' => $id));
- } else {
- table_header('User Details');
- }
- table_content('', $edit_userfields);
- table_footer('Update User');
- ############################### USER NOTES ###############################
- unset($table);
- $db->query("SELECT user_notes.*, tech.username AS username
- FROM user_notes
- LEFT JOIN tech ON (tech.id = user_notes.techid)
- WHERE userid = '$id' AND
- (global OR techid = '$user[id]')
- ORDER BY timestamp
- ");
- $cols = array('Date', 'Tech', 'Global', 'Edit', 'Delete');
- while ($notes = $db->row_array()) {
- $table[] = array(
- our_date($notes[timestamp], 'full'),
- $notes[username],
- ifynb($notes['global']),
- "<a href="notes.php?do=edit&id=$notes[id]">edit</a>",
- jprompt('Are you sure you want to delete this note?', "notes.php?do=delete&id=$notes[id]", 'delete')
- );
- $line[] = $notes[note];
- }
- $table[] = array("<B><A HREF="notes.php?do=add&user=$id">Add note</A></B>");
- table_header('Notes');
- table_content($cols, $table, '', '', '', $line, array('5', '30%', '25%', '15%', '15%', '15%'));
- table_footer();
- ############################### E-MAILS ###############################
- $emails = $db->query_return_array("SELECT email, validated FROM user_email WHERE userid = '$id'");
- if ($db->num_rows()) {
- foreach($emails AS $val) {
- if (banned_email($val['email'])) {
- $banned = "<I>(banned)</I>";
- } else {
- $banned = "";
- }
- $mails[] = array($val['email'] . " $banned", iff($val['validated'], 'Yes', 'No'));
- }
- table_header('Other E-mail Addresses');
- table_content(array('E-mail', 'Validated'), $mails);
- table_footer();
- }
- ############################### TICKETS ###############################
- unset($table);
- $db->query("SELECT ticket.*,
- ticket_cat.name AS catname,
- ticket_pri.name AS priname,
- tech.username AS techname,
- tech.id AS techid,
- is_open,
- awaiting_tech
- FROM ticket
- LEFT JOIN ticket_cat ON (ticket_cat.id=ticket.category)
- LEFT JOIN ticket_pri ON (ticket_pri.id=ticket.priority)
- LEFT JOIN tech ON (tech.id=ticket.tech)
- WHERE ticket.userid = '$id'
- ");
- $cols = array('ID', 'Subject', 'Category', 'Priority', 'Tech Owner', 'Resolved?', 'Awaiting Response From');
- while ($ticket = $db->row_array()) {
- if ($ticket[category] == 0) {
- $ticket[category] = '<I>uncategorised</I>';
- }
- if ($ticket[priority] == 0) {
- $ticket[priority] = '<I>unprioritised</I>';
- }
- if ($ticket[tech] == 0) {
- $ticket[tech] = '<I>unassigned</I>';
- }
- $table[] = array(
- $ticket[id],
- "<a href="../tickets/ticketview.php?id=$ticket[id]">$ticket[subject]</a>",
- $ticket['catname'],
- $ticket['priname'],
- $ticket['techname'],
- iff($ticket['is_open'], 'No', 'Yes'),
- iff($ticket['awaiting_tech'], 'Tech', 'User')
- );
- }
- if (!is_array($table)) {
- $table[] = '<b>This user does not currently have any tickets.</b>';
- }
- $table[] = array("<A HREF="../tickets/newticket.php?oldusername=$user_details[username]">Create a New Ticket</A>");
- table_header("Tickets by $user_details[username]");
- table_content($cols, $table);
- table_footer();
- tech_footer();
- ?>