root/trunk/gui/orderpanel/checkout.php

Revision 1327, 4.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') . '/checkout.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_checkout(&$tpl, &$sql, $user_id, $plan_id) {
34     $date = time();
35     $domain_name = $_SESSION['domainname'];
36     $fname = $_SESSION['fname'];
37     $lname = $_SESSION['lname'];
38
39     if (isset($_SESSION['firm'])) {
40         $firm = $_SESSION['firm'];
41     } else {
42         $firm = '';
43     }
44
45     $zip = $_SESSION['zip'];
46     $city = $_SESSION['city'];
47     $country = $_SESSION['country'];
48     $email = $_SESSION['email'];
49     $phone = $_SESSION['phone'];
50
51     if (isset($_SESSION['fax'])) {
52         $fax = $_SESSION['fax'];
53     } else {
54         $fax = '';
55     }
56
57     $street1 = $_SESSION['street1'];
58
59     if (isset($_SESSION['street2'])) {
60         $street2 = $_SESSION['street2'];
61     } else {
62         $street2 = '';
63     }
64
65     $status = "new";
66
67     $query = <<<SQL_QUERY
68               insert into
69                       orders
70                     (user_id,
71                     plan_id,
72                     date,
73                     domain_name,
74                     fname,
75                     lname,
76                     firm,
77                     zip,
78                     city,
79                     country,
80                     email,
81                     phone,
82                     fax,
83                     street1,
84                     street2,
85                     status)
86               values
87                  (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
88 SQL_QUERY;
89
90     $rs = exec_query($sql, $query, array($user_id, $plan_id, $date, $domain_name, $fname, $lname, $firm, $zip, $city, $country, $email, $phone, $fax, $street1, $street2, $status));
91 //     print $sql->ErrorMsg();
92     $order_id = $sql->Insert_ID();
93     send_order_emails($user_id, $domain_name, $fname, $lname, $email, $order_id);
94
95     if (isset($_SESSION['details']))
96         unset($_SESSION['details']);
97
98     if (isset($_SESSION['domainname']))
99         unset($_SESSION['domainname']);
100
101     if (isset($_SESSION['fname']))
102         unset($_SESSION['fname']);
103
104     if (isset($_SESSION['lname']))
105         unset($_SESSION['lname']);
106
107     if (isset($_SESSION['email']))
108         unset($_SESSION['email']);
109
110     if (isset($_SESSION['firm']))
111         unset($_SESSION['firm']);
112
113     if (isset($_SESSION['zip']))
114         unset($_SESSION['zip']);
115
116     if (isset($_SESSION['city']))
117         unset($_SESSION['city']);
118
119     if (isset($_SESSION['country']))
120         unset($_SESSION['country']);
121
122     if (isset($_SESSION['street1']))
123         unset($_SESSION['street1']);
124
125     if (isset($_SESSION['street2']))
126         unset($_SESSION['street2']);
127
128     if (isset($_SESSION['phone']))
129         unset($_SESSION['phone']);
130
131     if (isset($_SESSION['fax']))
132         unset($_SESSION['fax']);
133
134     if (isset($_SESSION['plan_id']))
135         unset($_SESSION['plan_id']);
136 }
137
138 /*
139 * Functions end
140 */
141
142 /*
143 *
144 * static page messages.
145 *
146 */
147
148 if (isset($_SESSION['user_id']) && $_SESSION['plan_id']) {
149     $user_id = $_SESSION['user_id'];
150     $plan_id = $_SESSION['plan_id'];
151 } else {
152     system_message(tr('You do not have permission to access this interface!'));
153 }
154
155 if (
156     (isset($_SESSION['fname']) && $_SESSION['fname'] != '') and
157         (isset($_SESSION['lname']) && $_SESSION['lname'] != '') and
158         (isset($_SESSION['email']) && $_SESSION['email'] != '') and
159         (isset($_SESSION['zip']) && $_SESSION['zip'] != '') and
160         (isset($_SESSION['city']) && $_SESSION['city'] != '') and
161         (isset($_SESSION['country']) && $_SESSION['country'] != '') and
162         (isset($_SESSION['street1']) && $_SESSION['street1'] != '') and
163         (isset($_SESSION['phone']) && $_SESSION['phone'] != '')
164         ) {
165     gen_checkout($tpl, $sql, $user_id, $plan_id);
166 } else {
167     header("Location: index.php?user_id=$user_id");
168     die();
169 }
170
171 gen_purchase_haf($tpl, $sql, $user_id);
172 gen_page_message($tpl);
173
174 $tpl->assign(
175     array('CHECK_OUT' => tr('Check Out'),
176         'THANK_YOU_MESSAGE' => tr('<b>Thank You for purchasing</b><br>You will receive an email with more details and information'),
177         'THEME_CHARSET' => tr('encoding'),
178         )
179     );
180
181 $tpl->parse('PAGE', 'page');
182 $tpl->prnt();
183
184 if (Config::get('DUMP_GUI_DEBUG'))
185     dump_gui_debug();
186
187 ?>
Note: See TracBrowser for help on using the browser.