root/trunk/gui/reseller/hosting_plan.php

Revision 1374, 5.9 kB (checked in by rats, 1 month 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') . '/hosting_plan.tpl');
28 $tpl->define_dynamic('page_message', 'page');
29 $tpl->define_dynamic('logged_from', 'page');
30 // Table with hosting plans
31 $tpl->define_dynamic('hp_table', 'page');
32 $tpl->define_dynamic('hp_entry', 'hp_table');
33 $tpl->define_dynamic('hp_delete', 'page');
34 $tpl->define_dynamic('hp_menu_add', 'page');
35
36 $theme_color = Config::get('USER_INITIAL_THEME');
37
38 $tpl->assign(
39         array(
40             'TR_RESELLER_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Reseller/Main Index'),
41             'THEME_COLOR_PATH' => "../themes/$theme_color",
42             'THEME_CHARSET' => tr('encoding'),
43             'ISP_LOGO' => get_logo($_SESSION['user_id'])
44             )
45         );
46
47 /*
48  *
49  * static page messages.
50  *
51  */
52
53 gen_reseller_mainmenu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/main_menu_hosting_plan.tpl');
54 gen_reseller_menu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/menu_hosting_plan.tpl');
55
56 gen_logged_from($tpl);
57
58 gen_hp_table($tpl, $_SESSION['user_id']);
59
60 $tpl->assign(
61         array(
62             'TR_HOSTING_PLANS' => tr('Hosting plans'),
63             'TR_PAGE_MENU' => tr('Manage hosting plans'),
64             'TR_PURCHASING' => tr('Purchasing'),
65             'TR_ADD_HOSTING_PLAN' => tr('Add hosting plan'),
66             'TR_TITLE_ADD_HOSTING_PLAN' => tr('Add new user hosting plan'),
67             'TR_BACK' => tr('Back'),
68             'TR_TITLE_BACK' => tr('Return to previous menu'),
69             'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s?', true, '%s')
70             )
71         );
72
73 gen_hp_message($tpl);
74 gen_page_message($tpl);
75
76 $tpl->parse('PAGE', 'page');
77 $tpl->prnt();
78
79 // BEGIN FUNCTION DECLARE PATH
80
81 function gen_hp_message (&$tpl) {
82     // global $externel_event, $hp_added, $hp_deleted, $hp_updated;
83     global $external_event;
84
85     if (isset($_SESSION["hp_added"]) && $_SESSION["hp_added"] == '_yes_') {
86         $external_event = '_on_';
87         set_page_message(tr('Hosting plan added!'));
88         unset($_SESSION["hp_added"]);
89         if (isset($GLOBALS['hp_added']))
90             unset($GLOBALS['hp_added']);
91     } else if (isset($_SESSION["hp_deleted"]) && $_SESSION["hp_deleted"] == '_yes_') {
92         $external_event = '_on_';
93         set_page_message(tr('Hosting plan deleted!'));
94         unset($_SESSION["hp_deleted"]);
95         if (isset($GLOBALS['hp_deleted']))
96             unset($GLOBALS['hp_deleted']);
97     } else if (isset($_SESSION["hp_updated"]) && $_SESSION["hp_updated"] == '_yes_') {
98         $external_event = '_on_';
99         set_page_message(tr('Hosting plan updated!'));
100         unset($_SESSION["hp_updated"]);
101         if (isset($GLOBALS['hp_updated']))
102             unset($GLOBALS['hp_updated']);
103     }
104     else if (isset($_SESSION["hp_deleted_ordererror"]) && $_SESSION["hp_deleted_ordererror"] == '_yes_') {
105         //$external_event = '_on_';
106         set_page_message(tr('Hosting plan can\'t be deleted, there are orders!'));
107         unset($_SESSION["hp_deleted_ordererror"]);
108     }
109 } // End of gen_hp_message()
110
111 // Extract and show data for hosting plants
112 function gen_hp_table(&$tpl, $reseller_id) {
113     $sql = Database::getInstance();
114     global $external_event;
115
116     if (Config::exists('HOSTING_PLANS_LEVEL') && Config::get('HOSTING_PLANS_LEVEL') === 'admin') {
117         $query = <<<SQL_QUERY
118             SELECT
119                 t1.id, t1.reseller_id, t1.name, t1.props, t1.status,
120                 t2.admin_id, t2.admin_type
121             FROM
122                 hosting_plans AS t1,
123                 admin AS t2
124             WHERE
125                 t2.admin_type=?
126               AND
127                 t1.reseller_id = t2.admin_id
128               AND
129                 t1.status=1
130             ORDER BY
131                 t1.name
132 SQL_QUERY;
133
134         $rs = exec_query($sql, $query, array('admin'));
135         $tr_edit = tr('View details');
136         $tpl->assign('HP_MENU_ADD', '');
137     } else {
138         $query = <<<SQL_QUERY
139             SELECT
140                 id, name, props, status
141             FROM
142                 hosting_plans
143             WHERE
144                 reseller_id = ?
145             ORDER BY
146                 name
147 SQL_QUERY;
148         $rs = exec_query($sql, $query, array($reseller_id));
149         $tr_edit = tr('Edit');
150     }
151
152     if ($rs->RowCount() == 0) {
153         // if ($external_event == '_off_') {
154         set_page_message(tr('Hosting plans not found!'));
155         // }
156         $tpl->assign('HP_TABLE', '');
157     } else { // There are data for hosting plants :-)
158         if ($external_event == '_off_') {
159             $tpl->assign('HP_MESSAGE', '');
160         }
161
162         $tpl->assign(array('TR_HOSTING_PLANS' => tr('Hosting plans'),
163                 'TR_NOM' => tr('No.'),
164                 'TR_EDIT' => $tr_edit,
165                 'TR_PLAN_NAME' => tr('Name'),
166                 'TR_ACTION' => tr('Action')));
167
168         $i = 1;
169
170         while ($data = $rs->FetchRow()) {
171             if ($i % 2 == 0) {
172                 $tpl->assign(array('CLASS_TYPE_ROW' => 'content'));
173             } else {
174                 $tpl->assign(array('CLASS_TYPE_ROW' => 'content2'));
175             }
176             $status = $data['status'];
177             if ($status == 1) {
178                 $status = tr('Enabled');
179             } else {
180                 $status = tr('Disabled');
181             }
182
183             $tpl->assign(array('PLAN_NOM' => $i++,
184                     'PLAN_NAME' => stripslashes($data['name']),
185                     'PLAN_ACTION' => tr('Delete'),
186                     'PLAN_SHOW' => tr('Show hosting plan'),
187                     'PURCHASING' => $status,
188                     'HP_ID' => $data['id'],
189                     'RESELLER_ID' => $_SESSION['user_id']));
190             $tpl->parse('HP_ENTRY', '.hp_entry');
191         } // End  loop
192         $tpl->parse('HP_TABLE', 'hp_table');
193     }
194 } // End of gen_hp_table()
195
196 // ******************************
197 // END OF FUNCTION DECLARE PATH
198 // *****************************
199 if (Config::get('DUMP_GUI_DEBUG'))
200     dump_gui_debug();
201
202 unset_messages();
203
204 ?>
205
Note: See TracBrowser for help on using the browser.