root/trunk/gui/reseller/orders_detailst.php

Revision 1374, 6.7 kB (checked in by rats, 2 months ago)

* Added Mailsize function
* Fixed #1594: (CentOS) More perl dependencies on CentOS
* Fixed #1595: (CentOS) CentOS perl docs: Advice to autoconfigure first
* Fixed #1483: Misleading information in INSTALL-files
* Fixed #1512: Subdomains for domain-aliases
* Fixed #1509: New subdomain management system
* Fixed Order delete bug
* Fixed #1507: Some errors on around "Execute Query" option on a database
* Fixed #1511: e-mail aliases & autoreply
* Fixed #1151: Update Hosting Package should only visible for a customer if a hosting plan to update is available (thanks Feg)
* Fixed #1556: Special Characters like Umlauts (äüöÄÜÖ) and Ligatures (ß) in Javascript messages are encoded, wrongly.
* PHPmyAdmin 3.0.0

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 // Begin page line
22 require '../include/ispcp-lib.php';
23
24 check_login(__FILE__);
25
26 $tpl = new pTemplate();
27 $tpl->define_dynamic('page', Config::get('RESELLER_TEMPLATE_PATH') . '/orders_detailst.tpl');
28 $tpl->define_dynamic('logged_from', 'page');
29 $tpl->define_dynamic('ip_entry', 'page');
30 $tpl->define_dynamic('page_message', 'page');
31
32 $theme_color = Config::get('USER_INITIAL_THEME');
33
34 $tpl->assign(array('TR_RESELLER_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Reseller/Order details'),
35         'THEME_COLOR_PATH' => "../themes/$theme_color",
36         'THEME_CHARSET' => tr('encoding'),
37         'ISP_LOGO' => get_logo($_SESSION['user_id'])));
38 // Functions
39 // *
40 // *
41 function gen_order_details (&$tpl, &$sql, $user_id, $order_id) {
42     $query = <<<SQL_QUERY
43         select
44             *
45         from
46             orders
47         where
48            id = ?
49         and
50             user_id = ?
51
52 SQL_QUERY;
53     $rs = exec_query($sql, $query, array($order_id, $user_id));
54     if ($rs->RecordCount() == 0) {
55         set_page_message(tr('Permission deny!'));
56         Header("Location: orders.php");
57         die();
58     }
59     $plan_id = $rs->fields['plan_id'];
60
61     $date_formt = Config::get('DATE_FORMAT');
62     $date = date($date_formt, $rs->fields['date']);
63
64     if (isset($_POST['uaction'])) {
65         $domain_name = $_POST['domain'];
66         $customer_id = $_POST['customer_id'];
67         $fname = $_POST['fname'];
68         $lname = $_POST['lname'];
69         $firm = $_POST['firm'];
70         $zip = $_POST['zip'];
71         $city = $_POST['city'];
72         $country = $_POST['country'];
73         $street1 = $_POST['street1'];
74         $street2 = $_POST['street2'];
75         $email = $_POST['email'];
76         $phone = $_POST['phone'];
77         $fax = $_POST['fax'];
78     } else {
79         $domain_name = $rs->fields['domain_name'];
80         $customer_id = $rs->fields['customer_id'];
81         $fname = $rs->fields['fname'];
82         $lname = $rs->fields['lname'];
83         $firm = $rs->fields['firm'];
84         $zip = $rs->fields['zip'];
85         $city = $rs->fields['city'];
86         $country = $rs->fields['country'];
87         $email = $rs->fields['email'];
88         $phone = $rs->fields['phone'];
89         $fax = $rs->fields['fax'];
90         $street1 = $rs->fields['street1'];
91         $street2 = $rs->fields['street2'];
92     }
93     $query = <<<SQL_QUERY
94         select
95             name, description
96         from
97             hosting_plans
98         where
99            id = ?
100
101 SQL_QUERY;
102     $rs = exec_query($sql, $query, array($plan_id));
103     $plan_name = $rs->fields['name'] . "<br>" . $rs->fields['description'];
104
105     generate_ip_list($tpl, $_SESSION['user_id']);
106
107     if ($customer_id === null) $customer_id = '';
108
109     $tpl->assign(array('ID' => $order_id,
110             'DATE' => $date,
111             'HP' => $plan_name,
112             'DOMAINNAME' => $domain_name,
113             'CUSTOMER_ID' => $customer_id,
114             'FNAME' => $fname,
115             'LNAME' => $lname,
116             'FIRM' => $firm,
117             'ZIP' => $zip,
118             'CITY' => $city,
119             'COUNTRY' => $country,
120             'EMAIL' => $email,
121             'PHONE' => $phone,
122             'FAX' => $fax,
123             'STREET1' => $street1,
124             'STREET2' => $street2));
125 }
126
127 function update_order_details(&$tpl, &$sql, $user_id, $order_id) {
128     $domain = strtolower($_POST['domain']);
129     $domain = encode_idna($domain);
130     $customer_id = strip_html($_POST['customer_id']);
131     $fname = strip_html($_POST['fname']);
132     $lname = strip_html($_POST['lname']);
133     $firm = strip_html($_POST['firm']);
134     $zip = strip_html($_POST['zip']);
135     $city = strip_html($_POST['city']);
136     $country = strip_html($_POST['country']);
137     $street1 = strip_html($_POST['street1']);
138     $street2 = strip_html($_POST['street2']);
139     $email = strip_html($_POST['email']);
140     $phone = strip_html($_POST['phone']);
141     $fax = strip_html($_POST['fax']);
142
143     $query = <<<SQL_QUERY
144             update
145                 orders
146             set
147                 domain_name=?,
148                 customer_id=?,
149                 fname=?,
150                 lname=?,
151                 firm=?,
152                 zip=?,
153                 city=?,
154                 country=?,
155                 email=?,
156                 phone=?,
157                 fax=?,
158                 street1=?,
159                 street2=?
160             where
161                 id=?
162             and
163                 user_id=?
164 SQL_QUERY;
165     exec_query($sql, $query, array($domain, $customer_id, $fname, $lname, $firm, $zip, $city, $country, $email, $phone, $fax, $street1, $street2, $order_id, $user_id));
166 }
167
168 // end of functions
169
170 /*
171  *
172  * static page messages.
173  *
174  */
175
176 if (isset($_GET['order_id']) && is_numeric($_GET['order_id'])) {
177     $order_id = $_GET['order_id'];
178 } else {
179     set_page_message(tr('Wrong order ID!'));
180     Header("Location: orders.php");
181     die();
182 }
183
184 if (isset($_POST['uaction'])) {
185     update_order_details($tpl, $sql, $_SESSION['user_id'], $order_id);
186
187     if ($_POST['uaction'] === 'update_data') {
188         set_page_message(tr('Order data updated successfully!'));
189     } else if ($_POST['uaction'] === 'add_user') {
190         $_SESSION['domain_ip'] = @$_POST['domain_ip'];
191         Header("Location: orders_add.php?order_id=" . $order_id);
192         die();
193     }
194 }
195
196 gen_order_details($tpl, $sql, $_SESSION['user_id'], $order_id);
197
198 gen_reseller_mainmenu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/main_menu_orders.tpl');
199 gen_reseller_menu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/menu_orders.tpl');
200
201 gen_logged_from($tpl);
202
203 $tpl->assign(array('TR_MANAGE_ORDERS' => tr('Manage Orders'),
204         'TR_DATE' => tr('Order date'),
205         'TR_HP' => tr('Hosting plan'),
206         'TR_HOSTING_INFO' => tr('Hosting details'),
207         'TR_DOMAIN' => tr('Domain'),
208         'TR_FIRST_NAME' => tr('First name'),
209         'TR_LAST_NAME' => tr('Last name'),
210         'TR_COMPANY' => tr('Company'),
211         'TR_ZIP_POSTAL_CODE' => tr('Zip/Postal code'),
212         'TR_CITY' => tr('City'),
213         'TR_COUNTRY' => tr('Country'),
214         'TR_STREET_1' => tr('Street 1'),
215         'TR_STREET_2' => tr('Street 2'),
216         'TR_EMAIL' => tr('Email'),
217         'TR_PHONE' => tr('Phone'),
218         'TR_FAX' => tr('Fax'),
219         'TR_UPDATE_DATA' => tr('Update data'),
220         'TR_ORDER_DETAILS' => tr('Order details'),
221         'TR_CUSTOMER_DATA' => tr('Customer data'),
222         'TR_DELETE_ORDER' => tr('Delete order'),
223         'TR_DMN_IP' => tr('Domain IP'),
224         'TR_CUSTOMER_ID' => tr('Customer ID'),
225         'TR_MESSAGE_DELETE_ACCOUNT' => tr('Are you sure you want to delete this order?', true),
226         'TR_ADD' => tr('Add to the system')));
227
228 gen_page_message($tpl);
229
230 $tpl->parse('PAGE', 'page');
231 $tpl->prnt();
232
233 if (Config::get('DUMP_GUI_DEBUG'))
234     dump_gui_debug();
235
236 unset_messages();
237
238 ?>
239
Note: See TracBrowser for help on using the browser.