'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_MIN_PAYMENT' => "Mindestvergütung (maximal fünf Stellen hinterm Komma):",
'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_ALLOW_EROTIC' => "Wert für das Zulassen von Erotikkampagnen:",
'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED' => "Werbeart-Handler wurde gespeichert und ist sofort gültig.",
- 'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_SAVED' => "Werbeart-Handler wurde NICHT gespeichert.",
+ 'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_SAVED' => "Werbeart-Handler wurde(n) NICHT gespeichert.",
'ADMIN_NETWORK_HANDLER_TYPE_HANDLER_NOT_CONFIGURED' => "Werart-Handler wurde noch nicht eingerichtet. Bitte verwenden Sie dazu das passende Formular.",
- 'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_CHANGED' => "Werbeart-Handler wurde NICHT geändert.",
+ 'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_CHANGED' => "Werbeart-Handler wurde(n) NICHT geändert.",
+ 'ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL' => "Diese Einstellungen für alle Werbeart-Handler konfigurieren:",
+ 'ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404' => "Es wurde beim Übertragen der Einstellungen keine Werbeart-Handler gefunden.",
+ 'ADMIN_CONFIG_NETWORK_HANDLER_TYPE_ALL_HANDLER_SAVED' => "<strong>%s</strong> Werbeart-Handler wurden gespeichert.",
// SQL export for all network tables
'ADMIN_EXPORT_NETWORK_NOTE' => "Verwenden Sie diesen SQL-Befehl nicht in phpMyAdmin oder anderen SQL-Clients, dieser SQL-Befehl ist zum Einfügen in das Script <strong>ext-network.php</strong> konzipiert.",
'ADMIN_EXPORT_ALL_NETWORK_DATA_LINK' => "Gesamte Tabelle <strong>network_data</strong> zum Einfügen in ext-network.php exportieren",
}
// Only adds network type configuration if not yet present
-function doAdminNetworkProcessAddHandlerTypesConfig () {
+function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = true) {
// Remove the 'ok' part
unsetPostRequestElement('ok');
$content = array();
$id = 'network_max_reload_time_ye';
$skip = false;
+
+ // Get all POST data
$postData = postRequestArray();
// Convert "reload time selections"
return;
} // END - if
- // Get SQL query for new entry
- $SQL = getInsertSqlFromArray(postRequestArray(), 'network_types_config');
+ // Copy 'set all' and remove it from POST data
+ $setAll = (postRequestElement('set_all') === 'Y');
+ unsetPostRequestElement('set_all');
- // Run the query
- SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+ // Shall we set for all?
+ if ($setAll === true) {
+ // Get all handlers
+ $result = SQL_QUERY_ESC('SELECT `network_type_id` FROM `{?_MYSQL_PREFIX?}_network_types` WHERE `network_id`=%s ORDER BY `network_type_id` ASC',
+ array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__);
- // Output message
- if (!SQL_HASZEROAFFECTED()) {
- // Successfully added
- displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED--}');
+ // Do we have entries?
+ if (SQL_HASZERONUMS($result)) {
+ // No, then abort here
+ displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}');
+ return;
+ } // END - if
+
+ // Init number of rows
+ $numRows = 0;
+
+ // Fetch all ids
+ while (list($typeId) = SQL_FETCHROW($result)) {
+ // Set it in GET data
+ setGetRequestElement('network_type_id', $typeId);
+
+ // Call this function again
+ $numRows += doAdminNetworkProcessAddHandlerTypesConfig(false);
+ } // END - while
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Output message
+ if ($numRows > 0) {
+ // Something has been updated
+ displayMessage('{%message,ADMIN_CONFIG_NETWORK_HANDLER_TYPE_ALL_HANDLER_SAVED=' . bigintval($numRows) . '%}');
+ } else {
+ // Nothing has been saved
+ loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_CHANGED--}');
+ }
} else {
- // Not added
- loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_SAVED--}');
+ // Get SQL query for new entry
+ $SQL = getInsertSqlFromArray(postRequestArray(), 'network_types_config');
+
+ // Run the query
+ SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+
+ // Shall we display the message?
+ if ($displayMessage === true) {
+ // Output message
+ if (!SQL_HASZEROAFFECTED()) {
+ // Successfully added
+ displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED--}');
+ } else {
+ // Not added
+ loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_SAVED--}');
+ }
+ } else {
+ // Return amount of affected rows (1 or 2)
+ return SQL_AFFECTEDROWS();
+ }
}
}
// Only changes network type configuration if not yet present
-function doAdminNetworkProcessEditHandlerTypesConfig () {
+function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = true) {
// Remove the 'ok' part
unsetPostRequestElement('ok');
- // Add both ids
- setPostRequestElement('network_id', bigintval(getRequestElement('network_id')));
- setPostRequestElement('network_type_id', bigintval(getRequestElement('network_type_id')));
-
/*
* Some parameters are optional, at least one must be given so check a bunch
* of parameters.
return;
} // END - if
- // Get SQL query for new entry
- $SQL = getUpdateSqlFromArray(postRequestArray(), 'network_types_config', 'network_data_id', postRequestElement('network_data_id'), array('network_data_id'));
+ // Copy 'set all' and remove it from POST data
+ $setAll = (postRequestElement('set_all') === 'Y');
+ unsetPostRequestElement('set_all');
- // Run the query
- SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+ // Shall we set for all?
+ if ($setAll === true) {
+ // Get all data entries
+ $result = SQL_QUERY_ESC('SELECT `network_data_id` FROM `{?_MYSQL_PREFIX?}_network_types_config` WHERE `network_id`=%s ORDER BY `network_type_id` ASC',
+ array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__);
- // Output message
- if (!SQL_HASZEROAFFECTED()) {
- // Successfully added
- displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED--}');
+ // Do we have entries?
+ if (SQL_HASZERONUMS($result)) {
+ // No, then abort here
+ displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}');
+ return;
+ } // END - if
+
+ // Init number of rows
+ $numRows = 0;
+
+ // Fetch all ids
+ while (list($dataId) = SQL_FETCHROW($result)) {
+ // Set it in GET data
+ setPostRequestElement('network_data_id', $dataId);
+
+ // Call this function again
+ $numRows += doAdminNetworkProcessEditHandlerTypesConfig(false);
+ } // END - while
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Output message
+ if ($numRows > 0) {
+ // Something has been updated
+ displayMessage('{%message,ADMIN_CONFIG_NETWORK_HANDLER_TYPE_ALL_HANDLER_SAVED=' . bigintval($numRows) . '%}');
+ } else {
+ // Nothing has been saved
+ loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_CHANGED--}');
+ }
} else {
- // Not added
- loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_CHANGED--}');
+ // Get SQL query for new entry
+ $SQL = getUpdateSqlFromArray(postRequestArray(), 'network_types_config', 'network_data_id', postRequestElement('network_data_id'), array('network_data_id'));
+
+ // Run the query
+ SQL_QUERY($SQL, __FUNCTION__, __LINE__);
+
+ // Shall we display the message?
+ if ($displayMessage === true) {
+ // Output message
+ if (!SQL_HASZEROAFFECTED()) {
+ // Successfully added
+ displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_SAVED--}');
+ } else {
+ // Not added
+ loadTemplate('admin_settings_unsaved', false, '{--ADMIN_CONFIG_NETWORK_HANDLER_TYPE_HANDLER_NOT_CHANGED--}');
+ }
+ } else {
+ // Return amount of affected rows (1 or 2)
+ return SQL_AFFECTEDROWS();
+ }
}
}
if (isGetRequestElementSet('network_type_id')) {
// Load data for given network
$result = SQL_QUERY_ESC('SELECT
- `network_id`,
- `network_type_id`,
- `network_type_handler`,
- `network_type_reload_time_unit`,
- `network_active`,
+ t.`network_id`,
+ t.`network_type_id`,
+ t.`network_type_handler`,
+ t.`network_type_reload_time_unit`,
+ d.`network_active`,
NULL AS `network_data_id`,
NULL AS `network_max_reload_time`,
NULL AS `network_min_waiting_time`,
NULL AS `network_min_payment`,
NULL AS `network_allow_erotic`
FROM
- `{?_MYSQL_PREFIX?}_network_types`
+ `{?_MYSQL_PREFIX?}_network_types` AS t
+INNER JOIN
+ `{?_MYSQL_PREFIX?}_network_data` AS d
+ON
+ d.network_id=t.network_id
WHERE
- `network_id`=%s AND
- `network_type_id`=%s
+ t.`network_id`=%s AND
+ t.`network_type_id`=%s
LIMIT 1',
array(
bigintval(getRequestElement('network_id')),
return;
} else {
// No entry found
- displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_HANDLER_TYPE_404', bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id')));
+ displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_HANDLER_TYPE_404=' . bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id')) . '%}');
} // END - if
// Free result