2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 08/13/2011 *
4 * =================== Last change: 08/13/2011 *
6 * -------------------------------------------------------------------- *
7 * File : what-config_network_types.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Handler types configuration *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Werbe-Handler-Konfiguration *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2011 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isAdmin())) {
43 // Add description as navigation point
44 addYouAreHereLink('admin', __FILE__);
46 // By default we should display list/add new forms
47 $GLOBALS['network_display'] = true;
50 doNetworkHandleForm();
53 if ($GLOBALS['network_display'] === false) {
58 // Do we have a network selected?
59 if (isGetRequestElementSet('network_id')) {
60 // Set current network id
61 setCurrentNetworkId(getRequestElement('network_id'));
63 // Is a network type handler selected?
64 if (isGetRequestElementSet('network_type_id')) {
65 // Load data for given network
66 $result = SQL_QUERY_ESC('SELECT
69 `network_type_handler`,
70 `network_type_reload_time_unit`,
71 NULL AS `network_data_id`,
72 NULL AS `network_max_reload_time`,
73 NULL AS `network_min_waiting_time`,
74 NULL AS `network_min_remain_clicks`,
75 NULL AS `network_min_payment`,
76 NULL AS `network_allow_erotic`
78 `{?_MYSQL_PREFIX?}_network_types`
84 bigintval(getRequestElement('network_id')),
85 bigintval(getRequestElement('network_type_id'))
86 ), __FUNCTION__, __LINE__);
88 // Do we have a record?
89 if (SQL_NUMROWS($result) == 1) {
91 $content = SQL_FETCHARRAY($result);
93 // Check for network type configuration
94 $result_config = SQL_QUERY_ESC('SELECT
96 `network_max_reload_time`,
97 `network_min_waiting_time`,
98 `network_min_remain_clicks`,
99 `network_min_payment`,
100 `network_allow_erotic`
102 `{?_MYSQL_PREFIX?}_network_types_config`
108 bigintval(getRequestElement('network_id')),
109 bigintval($content['network_type_id'])
110 ), __FUNCTION__, __LINE__);
112 // Use template for adding
113 $templateName = 'admin_add_config_network_type_form';
115 // Do we also have configuration?
116 if (SQL_NUMROWS($result_config) == 1) {
117 // Load as well and merge it
118 $content = merge_array($content, SQL_FETCHARRAY($result_config));
120 // Use template for editing
121 $templateName = 'admin_edit_config_network_type_form';
125 SQL_FREERESULT($result_config);
127 // "Translate" some values
128 $content['network_max_reload_time'] = createTimeSelections($content['network_max_reload_time'], 'network_max_reload_time', 'WDhms');
131 loadTemplate($templateName, false, $content);
137 displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_HANDLER_TYPE_404', bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id')));
141 SQL_FREERESULT($result);
144 // Get all type handlers
145 $result = SQL_QUERY_ESC('SELECT
148 `network_type_handler`,
149 `network_type_reload_time_unit`
151 `{?_MYSQL_PREFIX?}_network_types`
155 `network_type_handler` ASC',
157 bigintval(getRequestElement('network_id'))
158 ), __FUNCTION__, __LINE__);
160 // Do we have entries left?
161 if (!SQL_HASZERONUMS($result)) {
166 while ($content = SQL_FETCHARRAY($result)) {
167 // Check if config entry is there
168 $result_config = SQL_QUERY_ESC('SELECT
170 `network_max_reload_time`,
171 `network_min_waiting_time`,
172 `network_min_remain_clicks`,
173 `network_min_payment`,
174 `network_allow_erotic`
176 `{?_MYSQL_PREFIX?}_network_types_config`
182 bigintval(getRequestElement('network_id')),
183 bigintval($content['network_type_id'])
184 ), __FUNCTION__, __LINE__);
186 // Do we have an entry?
187 if (SQL_NUMROWS($result_config) == 1) {
188 // Load this data as well
189 $content = merge_array($content, SQL_FETCHARRAY($result_config));
191 // Add it with extra template
192 $content['network_type_config_content'] = loadTemplate('admin_show_config_network_type', true, $content);
194 // No configuration found, so display form
195 $content['network_type_config_content'] = loadTemplate('admin_add_config_network_type', true, $content);
199 SQL_FREERESULT($result_config);
202 $OUT .= loadTemplate('admin_config_network_types_row', true, $content);
205 // Prepare array for main template
207 'network_id' => bigintval(getRequestElement('network_id')),
211 // Load main template
212 loadTemplate('admin_config_network_types', false, $content);
215 displayMessage('{%message,ADMIN_CONFIG_NETWORK_HANDLER_TYPES_404=' . bigintval(getRequestElement('network_id')) . '%}');
219 SQL_FREERESULT($result);
221 // Generate network list for this script
222 outputHtml(generateAdminNetworkList());