index.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: index.php,v $
- // | $Date: 2004/02/10 01:34:32 $
- // | $Revision: 1.25 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - User lookup index.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_nav('users');
- ############################################# APPROVE NEW USERS #############################################
- if ($_REQUEST['do'] == 'approve') {
- if ($user['p_approve_new_registrations'] OR $user['is_admin']) {
-
- $user_details = $db->query_return("
- SELECT *
- FROM user
- WHERE awaiting_manual_validation
- AND id = '$_REQUEST[id]'
- ");
- if ($db->num_rows() > 0) {
- $user_details = update_user_details($user_details);
- eval(makeemaileval('message', 'BODY_register_manually_validated', $subject));
- dp_mail($user_details[email], $subject, trim($message));
- $db->query("
- UPDATE user SET
- awaiting_manual_validation = 0
- WHERE id = '$_REQUEST[id]'
- ");
- // we need to now process the user's tickets if they are not having to validate themselves as well
- if ($user['awaiting_validation'] != 1) {
- new_db_class(2);
- $db->query("
- SELECT ticket.*, ticket_message.message, ticket_cat.name AS category_name, ticket_pri.name AS priority_name
- FROM ticket
- LEFT JOIN ticket_message ON (ticket.id = ticket_message.ticketid)
- LEFT JOIN ticket_cat ON (ticket_cat.id = ticket.category)
- LEFT JOIN ticket_pri ON (ticket_pri.id = ticket.priority)
- WHERE ticket.userid = '$_REQUEST[id]'
- AND nodisplay
- ");
-
- while ($ticket = $db->row_array()) {
-
- // update ticket's display propery
- $db2->query("UPDATE ticket SET nodisplay = 0 WHERE id = '$ticket[id]'");
- // notify techs
- notify_technicians('new', $ticket, $user, $ticket[message]);
- }
- }
- alert('User Validated');
- }
-
- } else {
- mistake("You don't have permission to validate users.");
- }
- }
- ############################################# DELETE NEW USERS #############################################
- if ($_REQUEST['do'] == 'delete') {
- if ($user[p_delete_users]) {
-
- // We're only going to delete users actually awaiting validation here.
- $db->query("DELETE FROM user WHERE id = $_REQUEST[id] AND awaiting_manual_validation");
-
- if ($db->affected_rows()) {
- alert('User Deleted');
- }
- } else {
- mistake("You don't have permission to delete users.");
- }
- }
- ############################################# SHOW NEW USERS #############################################
- if ($user[p_approve_new_registrations] or ($user[is_admin])) {
- $db->query("SELECT id, username, email, date_registered FROM user WHERE awaiting_manual_validation AND NOT awaiting_validation ORDER BY date_registered");
-
- if ($db->num_rows()) {
- $table[] = array('<B>Username</B>', '<B>E-mail</B>', '<B>Date Registered</B>', '<B>Actions</B>');
- while ($res = $db->row_array()) {
- $count++;
- $table[] = array("<A HREF="view.php?id=$res[id]">$res[username]", $res[email], our_date($res[date_registered], 'full'),
- "<A HREF="index.php?do=approve&id=$res[id]">Approve</A> | ".
- jprompt('This will *delete* the user from the system!', "index.php?do=delete&id=$res[id]", "Delete"));
- }
- }
- table_header('New Users Needing Approval');
- if ($count) {
- table_content('', $table);
- } else {
- table_content('', array('No new users require approval.'));
- }
- table_footer();
- // show something to users with no permssion
- } else {
- table_header('New Users Needing Approval');
- table_content('', array('No new users require approval.'));
- table_footer();
- }
- tech_footer();
- ?>