2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/26/2009 *
4 * =================== Last change: 11/26/2009 *
6 * -------------------------------------------------------------------- *
7 * File : what-list_network_params.php *
8 * -------------------------------------------------------------------- *
9 * Short description : List/manage network API query parameters *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Verwaltet API-Abfrageparameter *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * For more information visit: http://www.mxchange.org *
23 * This program is free software; you can redistribute it and/or modify *
24 * it under the terms of the GNU General Public License as published by *
25 * the Free Software Foundation; either version 2 of the License, or *
26 * (at your option) any later version. *
28 * This program is distributed in the hope that it will be useful, *
29 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
31 * GNU General Public License for more details. *
33 * You should have received a copy of the GNU General Public License *
34 * along with this program; if not, write to the Free Software *
35 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
37 ************************************************************************/
39 // Some security stuff...
40 if ((!defined('__SECURITY')) || (!isAdmin())) {
44 // Add description as navigation point
45 addMenuDescription('admin', __FILE__);
47 // These are expert settings!
48 if (doVerifyExpertSettings() != 'agreed') {
53 // By default we should display list/add new forms
54 $GLOBALS['network_display'] = true;
57 doNetworkHandleForm();
60 if ($GLOBALS['network_display'] === false) {
65 // Do we have a network selected?
66 if (isGetRequestParameterSet('network')) {
67 // Get its data for template
68 $networkData = getNetworkDataById(getRequestParameter('network'));
71 $networkData['disabled'] = array();
73 // Only show params from given type handler if choosen
75 if (isPostRequestParameterSet('network_type_id')) {
76 // Only show from current type handler
77 $ADD = sprintf(" AND p.`network_type_id`=%s", bigintval(postRequestParameter('network_type_id')));
80 loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_PARAMS_LIST_LIMITED_TO_TYPE'));
83 // Load all advert types for given network
84 $result = SQL_QUERY_ESC("SELECT
85 p.`network_param_id`, t.`network_type_id`, t.`network_type_handle`, p.`request_param_key`, p.`request_param_value`, p.`request_param_default`
87 `{?_MYSQL_PREFIX?}_network_request_params` AS p
89 `{?_MYSQL_PREFIX?}_network_types` AS t
91 p.`network_type_id`=t.`network_type_id`
93 p.`network_id`=%s".$ADD."
95 t.`network_type_handle` ASC,
96 p.`network_param_id` ASC",
97 array(getRequestParameter('network')), __FILE__, __LINE__);
99 // Do we have entries?
100 if (SQL_NUMROWS($result) > 0) {
103 while ($row = SQL_FETCHARRAY($result)) {
104 // Add/translate some data
107 // Add it to network if the type matches selected
108 if ($row['network_type_id'] == postRequestParameter('network_type_id')) {
109 // Matches, then add it for disabling this entry
110 $networkData['disabled'][$row['request_param_key']] = true;
113 // Is default value empty or null?
114 if ((is_null($row['request_param_default'])) || (trim($row['request_param_default']) == '')) {
115 // Fix it to three dashes
116 $row['request_param_default'] = '---';
119 // Add row template and switch color
120 $OUT .= loadTemplate('admin_list_network_params_row', true, $row);
124 // Prepare data for template
127 'network_id' => getRequestParameter('network'),
128 'network_title' => $networkData['network_title'],
129 'network_reflink' => $networkData['network_reflink'],
132 // Load main template
133 loadTemplate('admin_list_network_params', false, $content);
136 loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_PARAMS_404', $networkData['network_title']));
140 SQL_FREERESULT($result);
142 // Add options list for network type
143 $networkData['type_options'] = generateOptionList(
146 'network_type_handle',
147 postRequestParameter('network_type_id'),
149 sprintf("WHERE `network_id`=%s", getRequestParameter('network'))
152 // Add options for parameter keys
153 $networkData['key_options'] = generateOptionList(
171 '{--ADMIN_NETWORK_PARAMS_ID--}',
172 '{--ADMIN_NETWORK_PARAMS_SID--}',
173 '{--ADMIN_NETWORK_PARAMS_PASSWORD--}',
174 '{--ADMIN_NETWORK_PARAMS_RELOAD--}',
175 '{--ADMIN_NETWORK_PARAMS_MAXIMUM_STAY--}',
176 '{--ADMIN_NETWORK_PARAMS_MINIMUM_STAY--}',
177 '{--ADMIN_NETWORK_PARAMS_CURRENCY--}',
178 '{--ADMIN_NETWORK_PARAMS_TYPE--}',
179 '{--ADMIN_NETWORK_PARAMS_REMAIN--}',
180 '{--ADMIN_NETWORK_PARAMS_REWARD--}',
181 '{--ADMIN_NETWORK_PARAMS_SIZE--}',
182 '{--ADMIN_NETWORK_PARAMS_EROTIC--}',
183 '{--ADMIN_NETWORK_PARAMS_EXTRA--}'
186 $networkData['disabled']
189 // Add form for adding new params
190 loadTemplate('admin_add_network_params', false, $networkData);
192 // Generate network list for this script
193 outputHtml(generateAdminNetworkList());