hpdl
|
1850
|
1
|
<?php
|
|
2
|
/*
|
|
3
|
$Id: save.php 1863 2009-03-06 23:53:49Z hpdl $
|
|
4
|
|
|
5
|
osCommerce, Open Source E-Commerce Solutions
|
|
6
|
http://www.oscommerce.com
|
|
7
|
|
|
8
|
Copyright (c) 2009 osCommerce
|
|
9
|
|
|
10
|
This program is free software; you can redistribute it and/or modify
|
|
11
|
it under the terms of the GNU General Public License v2 (1991)
|
|
12
|
as published by the Free Software Foundation.
|
|
13
|
*/
|
|
14
|
|
|
15
|
class osC_Application_Administrators_Actions_save extends osC_Application_Administrators {
|
|
16
|
public function __construct() {
|
|
17
|
global $osC_Language, $osC_MessageStack;
|
|
18
|
|
|
19
|
parent::__construct();
|
|
20
|
|
|
21
|
if ( isset($_GET['aID']) && is_numeric($_GET['aID']) ) {
|
|
22
|
$this->_page_contents = 'edit.php';
|
|
23
|
} else {
|
|
24
|
$this->_page_contents = 'new.php';
|
|
25
|
}
|
|
26
|
|
|
27
|
if ( isset($_POST['subaction']) && ($_POST['subaction'] == 'confirm') ) {
|
|
28
|
$data = array('username' => $_POST['user_name'],
|
|
29
|
'password' => $_POST['user_password']);
|
|
30
|
|
|
31
|
switch ( osC_Administrators_Admin::save((isset($_GET['aID']) && is_numeric($_GET['aID']) ? $_GET['aID'] : null), $data, (isset($_POST['modules']) ? $_POST['modules'] : null)) ) {
|
|
32
|
case 1:
|
|
33
|
if ( isset($_GET['aID']) && is_numeric($_GET['aID']) && ($_GET['aID'] == $_SESSION['admin']['id']) ) {
|
|
34
|
$_SESSION['admin']['access'] = osC_Access::getUserLevels($_GET['aID']);
|
|
35
|
}
|
|
36
|
|
|
37
|
$osC_MessageStack->add($this->_module, $osC_Language->get('ms_success_action_performed'), 'success');
|
|
38
|
|
|
39
|
osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
|
|
40
|
|
|
41
|
break;
|
|
42
|
|
|
43
|
case -1:
|
|
44
|
$osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_action_not_performed'), 'error');
|
|
45
|
|
|
46
|
osc_redirect_admin(osc_href_link_admin(FILENAME_DEFAULT, $this->_module));
|
|
47
|
|
|
48
|
break;
|
|
49
|
|
|
50
|
case -2:
|
|
51
|
$osC_MessageStack->add($this->_module, $osC_Language->get('ms_error_username_already_exists'), 'error');
|
|
52
|
|
|
53
|
break;
|
|
54
|
}
|
|
55
|
}
|
|
56
|
}
|
|
57
|
}
|
|
58
|
?>
|