]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-config_network_types.php
Extension ext-network continued:
[mailer.git] / inc / modules / admin / what-config_network_types.php
index 9fdb6e7ca8b72660dde3438c83c4aaf9a5132c90..a18ae387c745456a99a51515b0c19067eedf0e04 100644 (file)
@@ -66,10 +66,9 @@ if (isGetRequestElementSet('network_id')) {
                $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`,
+       `network_type_handler`,
+       `network_type_reload_time_unit`,
+       `network_active`,
        NULL AS `network_data_id`,
        NULL AS `network_max_reload_time`,
        NULL AS `network_min_waiting_time`,
@@ -92,11 +91,18 @@ LIMIT 1',
                        // Load it
                        $content = SQL_FETCHARRAY($result);
 
+                       // Is the network active?
+                       if ($content['network_active'] == 'N') {
+                               // Not active
+                               displayMessage('{--ADMIN_NETWORK_NOT_ACTIVE--}');
+                               return;
+                       } // END - if
+
                        // Check for network type configuration
                        $result_config = SQL_QUERY_ESC('SELECT
        `network_data_id`,
        `network_max_reload_time`,
-       `network_min_waiting_time`
+       `network_min_waiting_time`,
        `network_min_remain_clicks`,
        `network_min_payment`,
        `network_allow_erotic`
@@ -111,23 +117,32 @@ LIMIT 1',
                                        bigintval($content['network_type_id'])
                                ), __FUNCTION__, __LINE__);
 
+                       // Use template for adding
+                       $templateName = 'admin_add_config_network_type_form';
+
                        // 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));
+
+                               // Use template for editing
+                               $templateName = 'admin_edit_config_network_type_form';
                        } // END - if
 
                        // Free result
                        SQL_FREERESULT($result_config);
 
+                       // "Translate" some values
+                       $content['network_max_reload_time']  = createTimeSelections($content['network_max_reload_time'], 'network_max_reload_time', 'WDhms');
+
                        // Load template
-                       loadTemplate('admin_add_config_network_type_form', false, $content);
+                       loadTemplate($templateName, 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')));
+                       displayMessage('{%message,ADMIN_ADD_CONFIG_NETWORK_HANDLER_TYPE_404', bigintval(getRequestElement('network_id')) . '/' . bigintval(getRequestElement('network_type_id')));
                } // END - if
 
                // Free result
@@ -138,16 +153,14 @@ LIMIT 1',
        $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`
+       `network_type_handler`,
+       `network_type_reload_time_unit`
 FROM
        `{?_MYSQL_PREFIX?}_network_types`
 WHERE
        `network_id`=%s
 ORDER BY
-       `network_type_handle` ASC',
+       `network_type_handler` ASC',
                array(
                        bigintval(getRequestElement('network_id'))
                ), __FUNCTION__, __LINE__);
@@ -181,10 +194,10 @@ LIMIT 1',
                        // Do we have an entry?
                        if (SQL_NUMROWS($result_config) == 1) {
                                // Load this data as well
-                               $contentConfig = SQL_FETCHARRAY($result_config);
+                               $content = merge_array($content, SQL_FETCHARRAY($result_config));
 
                                // Add it with extra template
-                               $content['network_type_config_content'] = loadTemplate('admin_show_config_network_type', true, $contentConfig);
+                               $content['network_type_config_content'] = loadTemplate('admin_show_config_network_type', true, $content);
                        } else {
                                // No configuration found, so display form
                                $content['network_type_config_content'] = loadTemplate('admin_add_config_network_type', true, $content);
@@ -207,7 +220,7 @@ LIMIT 1',
                loadTemplate('admin_config_network_types', false, $content);
        } else {
                // No entries found
-               displayMessage('{%message,ADMIN_CONFIG_NETWORK_TYPES_404=' . bigintval(getRequestElement('network_id')) . '%}');
+               displayMessage('{%message,ADMIN_CONFIG_NETWORK_HANDLER_TYPES_404=' . bigintval(getRequestElement('network_id')) . '%}');
        }
 
        // Free result