X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_network_types.php;h=15d85b9f3588a58abf834e9fa370b30617d9a757;hp=0871c70c18910c3e57aab1aae38207466d3c1da4;hb=486544503c2e517dc5c399308fdf43c8e35ff102;hpb=f8cc979307416fbd9b27908ec461004a3feb9387 diff --git a/inc/modules/admin/what-config_network_types.php b/inc/modules/admin/what-config_network_types.php index 0871c70c18..15d85b9f35 100644 --- a/inc/modules/admin/what-config_network_types.php +++ b/inc/modules/admin/what-config_network_types.php @@ -57,7 +57,152 @@ if ($GLOBALS['network_display'] === false) { // Do we have a network selected? if (isGetRequestElementSet('network_id')) { - // @TODO Do something here + // Is a network type handler selected? + if (isGetRequestElementSet('network_type_id')) { + // Load data for given network + $result = SQL_QUERY_ESC('SELECT + `network_id`, + `network_type_id`, + `network_type_handle`, + `network_type_api_url`, + `network_type_click_url`, + `network_type_banner_url`, + NULL AS `network_data_id`, + NULL AS `network_max_reload_time`, + NULL AS `network_min_waiting_time`, + NULL AS `network_min_remain_clicks`, + NULL AS `network_min_payment`, + NULL AS `network_allow_erotic` +FROM + `{?_MYSQL_PREFIX?}_network_types` +WHERE + `network_id`=%s AND + `network_type_id`=%s +LIMIT 1', + array( + bigintval(getRequestElement('network_id')), + bigintval(getRequestElement('network_type_id')) + ), __FUNCTION__, __LINE__); + + // Do we have a record? + if (SQL_NUMROWS($result) == 1) { + // Load it + $content = SQL_FETCHARRAY($result); + + // Check for network type configuration + $result_config = SQL_QUERY_ESC('SELECT + `network_data_id`, + `network_max_reload_time`, + `network_min_waiting_time` + `network_min_remain_clicks`, + `network_min_payment`, + `network_allow_erotic` +FROM + `{?_MYSQL_PREFIX?}_network_types_config` +WHERE + `network_id`=%s AND + `network_type_id`=%s +LIMIT 1', + array( + bigintval(getRequestElement('network_id')), + bigintval($content['network_type_id']) + ), __FUNCTION__, __LINE__); + + // Do we also have configuration? + if (SQL_NUMROWS($result_config) == 1) { + // Load as well and merge it + $content = merge_array($content, SQL_FETCHARRAY($result_config)); + } // END - if + + // Free result + SQL_FREERESULT($result_config); + + // Load template + loadTemplate('admin_add_config_network_type_form', false, $content); + + // Abort here + return; + } else { + // No entry found + displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_TYPE_404', bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id'))); + } // END - if + + // Free result + SQL_FREERESULT($result); + } // END - if + + // Get all type handlers + $result = SQL_QUERY_ESC('SELECT + `network_id`, + `network_type_id`, + `network_type_handle`, + `network_type_api_url`, + `network_type_click_url`, + `network_type_banner_url` +FROM + `{?_MYSQL_PREFIX?}_network_types` +WHERE + `network_id`=%s +ORDER BY + `network_type_handle` ASC', + array( + bigintval(getRequestElement('network_id')) + ), __FUNCTION__, __LINE__); + + // Do we have entries left? + if (!SQL_HASZERONUMS($result)) { + // Init row output + $OUT = ''; + + // List all entries + while ($content = SQL_FETCHARRAY($result)) { + // Check if config entry is there + $result_config = SQL_QUERY_ESC('SELECT + `network_data_id`, + `network_max_reload_time`, + `network_min_waiting_time`, + `network_min_remain_clicks`, + `network_min_payment`, + `network_allow_erotic` +FROM + `{?_MYSQL_PREFIX?}_network_types_config` +WHERE + `network_id`=%s AND + `network_type_id`=%s +LIMIT 1', + array( + bigintval(getRequestElement('network_id')), + bigintval($content['network_type_id']) + ), __FUNCTION__, __LINE__); + + // Do we have an entry? + if (SQL_NUMROWS($result_config) == 1) { + // Load this data as well + $contentConfig = SQL_FETCHARRAY($result_config); + + // Add it with extra template + $content['network_types_config_content'] = loadTemplate('admin_show_config_network_type', true, $contentConfig); + } else { + // No configuration found, so display form + $content['network_types_config_content'] = loadTemplate('admin_add_config_network_type', true, $content); + } + + // Free result + SQL_FREERESULT($result_config); + + // Load row template + $OUT .= loadTemplate('admin_config_network_types_row', true, $content); + } // END - while + + // Load main template + loadTemplate('admin_config_network_types', false, $OUT); + } else { + // No entries found + displayMessage('{%message,ADMIN_CONFIG_NETWORK_TYPES_404=' . bigintval(getRequestElement('network_id')) . '%}'); + } + + // Free result + SQL_FREERESULT($result); } else { // Generate network list for this script outputHtml(generateAdminNetworkList());