root/trunk/gui/reseller/personal_change.php

Revision 1327, 5.3 kB (checked in by rats, 4 months ago)

* Fixed: --scan-knownbad-files and --check-deleted are no longer supported by rkhunter
* Fixed #1471: chkrootkit should be in lenny / hardy
* Updated Chinese (simplified)
* Updated German
* Fixed #1475: typo on installation (ispcp-setup)
* Fixed: default user for rkhunter.log

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21 require '../include/ispcp-lib.php';
22
23 check_login(__FILE__);
24
25 $tpl = new pTemplate();
26 $tpl->define_dynamic('page', Config::get('RESELLER_TEMPLATE_PATH') . '/personal_change.tpl');
27 $tpl->define_dynamic('page_message', 'page');
28 $tpl->define_dynamic('logged_from', 'page');
29
30 $theme_color = Config::get('USER_INITIAL_THEME');
31
32 $tpl->assign(
33         array(
34             'TR_CLIENT_CHANGE_PERSONAL_DATA_PAGE_TITLE' => tr('ispCP - Reseller/Change Personal Data'),
35             'THEME_COLOR_PATH' => "../themes/$theme_color",
36             'THEME_CHARSET' => tr('encoding'),
37
38             'ISP_LOGO' => get_logo($_SESSION['user_id']),
39             )
40         );
41
42 if (isset($_POST['uaction']) && $_POST['uaction'] === 'updt_data') {
43     update_reseller_personal_data($sql, $_SESSION['user_id']);
44 }
45
46 gen_reseller_personal_data($tpl, $sql, $_SESSION['user_id']);
47
48
49 function gen_reseller_personal_data(&$tpl, &$sql, $user_id) {
50     $query = <<<SQL_QUERY
51         select
52             fname,
53             lname,
54             gender,
55             firm,
56             zip,
57             city,
58             country,
59             street1,
60             street2,
61             email,
62             phone,
63             fax
64         from
65             admin
66         where
67             admin_id = ?
68 SQL_QUERY;
69
70     $rs = exec_query($sql, $query, array($user_id));
71
72     $tpl->assign(
73             array(
74             'FIRST_NAME'     => (($rs->fields['fname'] == null)         ? '' : $rs->fields['fname']),
75             'LAST_NAME'     => (($rs->fields['lname'] == null)         ? '' : $rs->fields['lname']),
76             'FIRM'             => (($rs->fields['firm'] == null)         ? '' : $rs->fields['firm']),
77             'ZIP'             => (($rs->fields['zip'] == null)         ? '' : $rs->fields['zip']),
78             'CITY'             => (($rs->fields['city'] == null)         ? '' : $rs->fields['city']),
79             'COUNTRY'         => (($rs->fields['country'] == null)     ? '' : $rs->fields['country']),
80             'STREET_1'         => (($rs->fields['street1'] == null)     ? '' : $rs->fields['street1']),
81             'STREET_2'         => (($rs->fields['street2'] == null)     ? '' : $rs->fields['street2']),
82             'EMAIL'         => (($rs->fields['email'] == null)         ? '' : $rs->fields['email']),
83             'PHONE'         => (($rs->fields['phone'] == null)         ? '' : $rs->fields['phone']),
84             'FAX'             => (($rs->fields['fax'] == null)         ? '' : $rs->fields['fax']),
85             'VL_MALE'         => (($rs->fields['gender'] == 'M')         ? 'selected' : ''),
86             'VL_FEMALE'     => (($rs->fields['gender'] == 'F')         ? 'selected' : ''),
87             'VL_UNKNOWN'     => ((($rs->fields['gender'] == 'U') || (empty($rs->fields['gender']))) ? 'selected' : '')
88             )
89         );
90 }
91
92 function update_reseller_personal_data(&$sql, $user_id) {
93     $fname = clean_input($_POST['fname']);
94     $lname = clean_input($_POST['lname']);
95     $gender = $_POST['gender'];
96     $firm = clean_input($_POST['firm']);
97     $zip = clean_input($_POST['zip']);
98     $city = clean_input($_POST['city']);
99     $country = clean_input($_POST['country']);
100     $street1 = clean_input($_POST['street1']);
101     $street2 = clean_input($_POST['street2']);
102     $email = clean_input($_POST['email']);
103     $phone = clean_input($_POST['phone']);
104     $fax = clean_input($_POST['fax']);
105
106     $query = <<<SQL_QUERY
107         update
108             admin
109         set
110             fname = ?,
111             lname = ?,
112             firm = ?,
113             zip = ?,
114             city = ?,
115             country = ?,
116             email = ?,
117             phone = ?,
118             fax = ?,
119             street1 = ?,
120             street2 = ?,
121             gender = ?
122         where
123             admin_id = ?
124 SQL_QUERY;
125
126     $rs = exec_query($sql, $query, array($fname, $lname, $firm, $zip, $city, $country, $email, $phone, $fax, $street1, $street2, $gender, $user_id));
127
128     set_page_message(tr('Personal data updated successfully!'));
129 }
130
131 /*
132  *
133  * static page messages.
134  *
135  */
136
137 gen_reseller_mainmenu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/main_menu_general_information.tpl');
138 gen_reseller_menu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/menu_general_information.tpl');
139
140 gen_logged_from($tpl);
141
142 $tpl->assign(
143         array(
144             'TR_CHANGE_PERSONAL_DATA' => tr('Change personal data'),
145             'TR_PERSONAL_DATA' => tr('Personal data'),
146             'TR_FIRST_NAME' => tr('First name'),
147             'TR_LAST_NAME' => tr('Last name'),
148             'TR_COMPANY' => tr('Company'),
149             'TR_ZIP_POSTAL_CODE' => tr('Zip/Postal code'),
150             'TR_CITY' => tr('City'),
151             'TR_COUNTRY' => tr('Country'),
152             'TR_STREET_1' => tr('Street 1'),
153             'TR_STREET_2' => tr('Street 2'),
154             'TR_EMAIL' => tr('Email'),
155             'TR_PHONE' => tr('Phone'),
156             'TR_FAX' => tr('Fax'),
157             'TR_GENDER' => tr('Gender'),
158             'TR_MALE' => tr('Male'),
159             'TR_FEMALE' => tr('Female'),
160             'TR_UNKNOWN' => tr('Unknown'),
161             'TR_UPDATE_DATA' => tr('Update data'),
162             )
163         );
164
165 gen_page_message($tpl);
166
167 $tpl->parse('PAGE', 'page');
168 $tpl->prnt();
169
170 if (Config::get('DUMP_GUI_DEBUG'))
171     dump_gui_debug();
172
173 unset_messages();
174
175 ?>
176
Note: See TracBrowser for help on using the browser.