index.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:5k
- <?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:30 $
- // | $Revision: 1.25 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Settings index.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL ^ E_NOTICE);
- include "./../global.php";
- tech_nav('settings');
- // default do
- $_REQUEST['do'] = trim($_REQUEST['do']);
- if (!isset($_REQUEST['do']) or $_REQUEST['do'] == "") {
- $_REQUEST['do'] = "view";
- }
- ############################### UPDATE SETTINGS ###############################
- if ($_REQUEST['do'] == "update") {
- // check passwords match
- if ($_REQUEST['new_pass'] != $_REQUEST['new_pass2']) {
- nopermission('edit your password because the two passwords you entered are not the same', '1');
- } else {
- $pass = 1;
- }
-
- // check correct password
- if ($_REQUEST['current_pass']) {
- $db->query("SELECT * FROM tech WHERE password = '" . mysql_escape_string($_REQUEST[current_pass]) . "' AND id = '$user[id]'");
- if ($db->num_rows() < 1) {
- nopermission('edit your password because the password entered was incorrect', '1');
- } else {
- $pass = 1;
- }
- }
- if ($pass) {
- $db->query("
- UPDATE tech
- SET password='" . mysql_escape_string($_REQUEST[new_pass]) . "'
- WHERE id = '$user[id]'
- AND password= '" . mysql_escape_string($_REQUEST[current_pass]) . "'
- ");
- }
-
- $db->query("
- UPDATE tech
- SET weekstart = '".mysql_escape_string($_REQUEST['weekstart'])."',
- signature = '".mysql_escape_string($_REQUEST['signature'])."',
- footer = '".mysql_escape_string($_REQUEST['footer'])."',
- timezone = '".mysql_escape_string($_REQUEST['timezone'])."',
- timezone_dst = '".mysql_escape_string($_REQUEST['timezone_dst'])."',
- copy_to_clipboard = '".mysql_escape_string($_REQUEST['copy_to_clipboard'])."'
- WHERE id = '$user[id]'
- ");
- $user = $db->query_return("SELECT * FROM tech WHERE id = '$user[id]'");
- alert("Settings updated");
- $_REQUEST['do'] = 'view';
- }
- ############################### VIEW SETTINGS ###############################
- if ($_REQUEST['do'] == "view") {
- $mon = 0; $tue = 0; $wed = 0; $thu = 0; $fri = 0; $sat = 0; $sun = 0;
- switch ($user[weekstart]) {
- case 1: $mon = 1; break;
- case 2: $tue = 1; break;
- case 3: $wed = 1; break;
- case 4: $thu = 1; break;
- case 5: $fri = 1; break;
- case 6: $sat = 1; break;
- default: case 7: $sun = 1; break;
- }
- $table[] = array(table_thelp('<b>Current Password</b>', 'Settings', 'Changing Your Password'), form_password('current_pass'));
- $table[] = array(table_thelp('<b>New Password</b>', 'Settings', 'Changing Your Password'), form_password('new_pass'));
- $table[] = array(table_thelp('<b>New Password Again</b>', 'Settings', 'Changing Your Password'), form_password('new_pass2'));
- $table[] = array(table_thelp('<b>Signature</b>', 'Settings', 'Signature'), form_textarea('signature', 60, 7, $user['signature']));
- $table[] = array(table_thelp('<b>Copy Replies to Clipboard?</b>', 'settings', 'Copy Replies to Clipboard'), form_radio_yn('copy_to_clipboard', '', $user['copy_to_clipboard']));
- $table[] = array(table_thelp('<b>Start of Week</b>', 'Settings', 'Start of Week'),
- form_radio_single('weekstart', 1, $mon, '') . " Mon " .
- form_radio_single('weekstart', 2, $tue, '') . " Tue " .
- form_radio_single('weekstart', 3, $wed, '') . " Wed " .
- form_radio_single('weekstart', 4, $thu, '') . " Thu " .
- form_radio_single('weekstart', 5, $fri, '') . " Fri " .
- form_radio_single('weekstart', 6, $sat, '') . " Sat " .
- form_radio_single('weekstart', 7, $sun, '') . " Sun ".
- form_hidden('do', 'update'));
- $table[] = array(table_thelp('<b>Default Footer</b>', 'Setttings', 'Default Footer'),
- form_select('footer', array(
- 1 => 'Ticket Select',
- 2 => 'Ticket Search',
- 3 => 'Ticket Control / Saved Tickets',
- 4 => 'FAQ'), NULL, $user['footer']));
- $table[] = array(table_thelp('<b>Timezone</b>', 'Settings', 'Timezone'),
- make_timezone($user['timezone']));
- $table[] = array(table_thelp('<b>Daylight Savings Time?</b>', 'Settings', 'Timezone'),
- form_checkbox_single('timezone_dst', 1, $user['timezone_dst']));
- table_header('Update settings', 'index.php', array('do', 'update'));
- table_content('', $table);
- table_footer('Update Settings');
- }
- tech_footer();
- ?>