root/trunk/gui/orderpanel/address.php

Revision 1327, 7.8 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 $tpl = new pTemplate();
24 $tpl->define_dynamic('page', Config::get('PURCHASE_TEMPLATE_PATH') . '/address.tpl');
25 $tpl->define_dynamic('page_message', 'page');
26 $tpl->define_dynamic('purchase_header', 'page');
27 $tpl->define_dynamic('purchase_footer', 'page');
28
29 /*
30 * Functions start
31 */
32
33 function gen_address(&$tpl, &$sql, $user_id, $plan_id) {
34     if (isset($_POST['fname'])) {
35         $first_name = $_POST['fname'];
36     } else if (isset($_SESSION['fname'])) {
37         $first_name = $_SESSION['fname'];
38     } else {
39         $first_name = '';
40     }
41
42     if (isset($_POST['lname'])) {
43         $last_name = $_POST['lname'];
44     } else if (isset($_SESSION['lname'])) {
45         $last_name = $_SESSION['lname'];
46     } else {
47         $last_name = '';
48     }
49
50     if (isset($_POST['email'])) {
51         $email = $_POST['email'];
52     } else if (isset($_SESSION['email'])) {
53         $email = $_SESSION['email'];
54     } else {
55         $email = '';
56     }
57
58     if (isset($_POST['gender'])) {
59         $gender = $_POST['gender'];
60     } else if (isset($_SESSION['gender'])) {
61         $gender = $_SESSION['gender'];
62     } else {
63         $gender = 'U';
64     }
65
66     if (isset($_POST['firm'])) {
67         $company = $_POST['firm'];
68     } else if (isset($_SESSION['firm'])) {
69         $company = $_SESSION['firm'];
70     } else {
71         $company = '';
72     }
73
74     if (isset($_POST['zip'])) {
75         $postal_code = $_POST['zip'];
76     } else if (isset($_SESSION['zip'])) {
77         $postal_code = $_SESSION['zip'];
78     } else {
79         $postal_code = '';
80     }
81
82     if (isset($_POST['city'])) {
83         $city = $_POST['city'];
84     } else if (isset($_SESSION['city'])) {
85         $city = $_SESSION['city'];
86     } else {
87         $city = '';
88     }
89
90     if (isset($_POST['country'])) {
91         $country = $_POST['country'];
92     } else if (isset($_SESSION['country'])) {
93         $country = $_SESSION['country'];
94     } else {
95         $country = '';
96     }
97
98     if (isset($_POST['street1'])) {
99         $street1 = $_POST['street1'];
100     } else if (isset($_SESSION['street1'])) {
101         $street1 = $_SESSION['street1'];
102     } else {
103         $street1 = '';
104     }
105
106     if (isset($_POST['street2'])) {
107         $street2 = $_POST['street2'];
108     } else if (isset($_SESSION['street2'])) {
109         $street2 = $_SESSION['street2'];
110     } else {
111         $street2 = '';
112     }
113
114     if (isset($_POST['phone'])) {
115         $phone = $_POST['phone'];
116     } else if (isset($_SESSION['phone'])) {
117         $phone = $_SESSION['phone'];
118     } else {
119         $phone = '';
120     }
121
122     if (isset($_POST['fax'])) {
123         $fax = $_POST['fax'];
124     } else if (isset($_SESSION['fax'])) {
125         $fax = $_SESSION['fax'];
126     } else {
127         $fax = '';
128     }
129
130     $tpl->assign(
131         array('VL_USR_NAME' => $first_name,
132             'VL_LAST_USRNAME' => $last_name,
133             'VL_EMAIL' => $email,
134             'VL_USR_FIRM' => $company,
135             'VL_USR_POSTCODE' => $postal_code,
136             'VL_USRCITY' => $city,
137             'VL_COUNTRY' => $country,
138             'VL_STREET1' => $street1,
139             'VL_STREET2' => $street2,
140             'VL_PHONE' => $phone,
141             'VL_FAX' => $fax,
142             'VL_MALE' => (($gender === 'M') ? 'checked' : ''),
143             'VL_FEMALE' => (($gender === 'F') ? 'checked' : ''),
144             'VL_UNKNOWN' => (($gender == 'U') ? 'checked' : '')
145             )
146         );
147 }
148
149 function check_address_data(&$tpl) {
150     if (isset($_GET['edit']))
151         unset($_GET['edit']);
152     if (
153         (isset($_POST['fname']) && $_POST['fname'] != '') and
154             (isset($_POST['email']) && $_POST['email'] != '') and
155             chk_email($_POST['email']) and
156             (isset($_POST['lname']) && $_POST['lname'] != '') and
157             (isset($_POST['zip']) && $_POST['zip'] != '') and
158             (isset($_POST['city']) && $_POST['city'] != '') and
159             (isset($_POST['country']) && $_POST['country'] != '') and
160             (isset($_POST['street1']) && $_POST['street1'] != '') and
161             (isset($_POST['phone']) && $_POST['phone'] != '')
162             ) {
163         $_SESSION['fname'] = $_POST['fname'];
164         $_SESSION['lname'] = $_POST['lname'];
165         $_SESSION['email'] = $_POST['email'];
166         $_SESSION['zip'] = $_POST['zip'];
167         $_SESSION['city'] = $_POST['city'];
168         $_SESSION['country'] = $_POST['country'];
169         $_SESSION['street1'] = $_POST['street1'];
170         $_SESSION['phone'] = $_POST['phone'];
171
172         if (isset($_POST['firm']) && $_POST['firm'] != '') {
173             $_SESSION['firm'] = $_POST['firm'];
174         }
175
176         if (isset($_POST['gender']) && get_gender_by_code($_POST['gender'], true) !== null) {
177             $_SESSION['gender'] = $_POST['gender'];
178         } else {
179             $_SESSION['gender'] = '';
180         }
181
182         if (isset($_POST['street2']) && $_POST['street2'] != '') {
183             $_SESSION['street2'] = $_POST['street2'];
184         }
185
186         if (isset($_POST['fax']) && $_POST['fax'] != '') {
187             $_SESSION['fax'] = $_POST['fax'];
188         }
189
190         header("Location: chart.php");
191         die();
192     } else {
193         set_page_message(tr('Please fill out all needed fields!'));
194         $_GET['edit'] = "yes";
195     }
196 }
197
198 /*
199 * Functions end
200 */
201
202 /*
203 *
204 * static page messages.
205 *
206 */
207
208 if (isset($_SESSION['user_id']) && $_SESSION['plan_id']) {
209     $user_id = $_SESSION['user_id'];
210     $plan_id = $_SESSION['plan_id'];
211 } else {
212     system_message(tr('You do not have permission to access this interface!'));
213 }
214
215 if (isset($_POST['uaction']) && $_POST['uaction'] == 'address')
216     check_address_data($tpl);
217
218 if (
219     (isset($_SESSION['fname']) && $_SESSION['fname'] != '') and
220         (isset($_SESSION['email']) && $_SESSION['email'] != '') and
221         (isset($_SESSION['lname']) && $_SESSION['lname'] != '') and
222         (isset($_SESSION['zip']) && $_SESSION['zip'] != '') and
223         (isset($_SESSION['city']) && $_SESSION['city'] != '') and
224         (isset($_SESSION['country']) && $_SESSION['country'] != '') and
225         (isset($_SESSION['street1']) && $_SESSION['street1'] != '') and
226         (isset($_SESSION['phone']) && $_SESSION['phone'] != '') and
227         !isset($_GET['edit'])
228         ) {
229     header("Location: chart.php");
230     die();
231 }
232
233 gen_purchase_haf($tpl, $sql, $user_id);
234 gen_address($tpl, $sql, $user_id, $plan_id);
235
236 gen_page_message($tpl);
237
238 $tpl->assign(
239     array('TR_ADRESS' => tr('Enter Address'),
240         'TR_FIRSTNAME' => tr('First name'),
241         'TR_LASTNAME' => tr('Last name'),
242         'TR_COMPANY' => tr('Company'),
243         'TR_POST_CODE' => tr('Zip/Postal code'),
244         'TR_CITY' => tr('City'),
245         'TR_COUNTRY' => tr('Country'),
246         'TR_STREET1' => tr('Street 1'),
247         'TR_STREET2' => tr('Street 2'),
248         'TR_EMAIL' => tr('Email'),
249         'TR_PHONE' => tr('Phone'),
250         'TR_GENDER' => tr('Gender'),
251         'TR_MALE' => tr('Male'),
252         'TR_FEMALE' => tr('Female'),
253         'TR_UNKNOWN' => tr('Unknown'),
254         'TR_FAX' => tr('Fax'),
255         'TR_CONTINUE' => tr('Continue'),
256         'NEED_FILLED' => tr('* denotes mandatory field.'),
257         'THEME_CHARSET' => tr('encoding')
258         )
259     );
260
261 $tpl->parse('PAGE', 'page');
262 $tpl->prnt();
263
264 if (Config::get('DUMP_GUI_DEBUG'))
265     dump_gui_debug();
266
267 unset_messages();
268
269 ?>
Note: See TracBrowser for help on using the browser.