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 - 2012 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 // Is there 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 t.`network_type_handler`,
70 t.`network_type_reload_time_unit`,
72 NULL AS `network_data_id`,
73 NULL AS `network_max_reload_time`,
74 NULL AS `network_min_waiting_time`,
75 NULL AS `network_min_remain_clicks`,
76 NULL AS `network_min_payment`,
77 NULL AS `network_allow_erotic`
79 `{?_MYSQL_PREFIX?}_network_types` AS t
81 `{?_MYSQL_PREFIX?}_network_data` AS d
83 d.network_id=t.network_id
86 t.`network_type_id`=%s
89 bigintval(getRequestElement('network_id')),
90 bigintval(getRequestElement('network_type_id'))
91 ), __FUNCTION__, __LINE__);
94 if (SQL_NUMROWS($result) == 1) {
96 $content = SQL_FETCHARRAY($result);
98 // Is the network active?
99 if ($content['network_active'] == 'N') {
101 displayMessage('{--ADMIN_NETWORK_NOT_ACTIVE--}');
105 // Check for network type configuration
106 $result_config = SQL_QUERY_ESC('SELECT
108 `network_max_reload_time`,
109 `network_min_waiting_time`,
110 `network_min_remain_clicks`,
111 `network_min_payment`,
112 `network_allow_erotic`
114 `{?_MYSQL_PREFIX?}_network_types_config`
120 bigintval(getRequestElement('network_id')),
121 bigintval($content['network_type_id'])
122 ), __FUNCTION__, __LINE__);
124 // Use template for adding
125 $templateName = 'admin_add_config_network_type_form';
127 // Do we also have configuration?
128 if (SQL_NUMROWS($result_config) == 1) {
129 // Load as well and merge it
130 $content = merge_array($content, SQL_FETCHARRAY($result_config));
132 // Use template for editing
133 $templateName = 'admin_edit_config_network_type_form';
137 SQL_FREERESULT($result_config);
139 // "Translate" some values
140 $content['network_max_reload_time'] = createTimeSelections($content['network_max_reload_time'], 'network_max_reload_time', 'WDhms');
143 loadTemplate($templateName, FALSE, $content);
149 displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_HANDLER_TYPE_404=' . bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id')) . '%}');
153 SQL_FREERESULT($result);
156 // Get all type handlers
157 $result = SQL_QUERY_ESC('SELECT
160 `network_type_handler`,
161 `network_type_reload_time_unit`
163 `{?_MYSQL_PREFIX?}_network_types`
167 `network_type_handler` ASC',
169 bigintval(getRequestElement('network_id'))
170 ), __FUNCTION__, __LINE__);
172 // Are there entries left?
173 if (!SQL_HASZERONUMS($result)) {
178 while ($content = SQL_FETCHARRAY($result)) {
179 // Check if config entry is there
180 $result_config = SQL_QUERY_ESC('SELECT
182 `network_max_reload_time`,
183 `network_min_waiting_time`,
184 `network_min_remain_clicks`,
185 `network_min_payment`,
186 `network_allow_erotic`
188 `{?_MYSQL_PREFIX?}_network_types_config`
194 bigintval(getRequestElement('network_id')),
195 bigintval($content['network_type_id'])
196 ), __FUNCTION__, __LINE__);
198 // Is there an entry?
199 if (SQL_NUMROWS($result_config) == 1) {
200 // Load this data as well
201 $content = merge_array($content, SQL_FETCHARRAY($result_config));
203 // Add it with extra template
204 $content['network_type_config_content'] = loadTemplate('admin_show_config_network_type', TRUE, $content);
206 // No configuration found, so display form
207 $content['network_type_config_content'] = loadTemplate('admin_add_config_network_type', TRUE, $content);
211 SQL_FREERESULT($result_config);
214 $OUT .= loadTemplate('admin_config_network_types_row', TRUE, $content);
217 // Prepare array for main template
219 'network_id' => bigintval(getRequestElement('network_id')),
223 // Load main template
224 loadTemplate('admin_config_network_types', FALSE, $content);
227 displayMessage('{%message,ADMIN_CONFIG_NETWORK_HANDLER_TYPES_404=' . bigintval(getRequestElement('network_id')) . '%}');
231 SQL_FREERESULT($result);
233 // Generate network list for this script
234 outputHtml(generateAdminNetworkList());