* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
return;
} // END - if
-// Check all networks that doesn't have a configuration entry
-$result = SQL_QUERY("SELECT
- d.`network_id`, d.`network_short_name`, d.`network_title`, d.`network_reflink`,
- c.`network_affiliate_id`, c.`network_api_password`, c.`network_site_id`, c.`network_query_amount`, c.`network_active`
+// Do we have a network selected?
+if (isGetRequestElementSet('network')) {
+ // Check all networks that doesn't have a configuration entry
+ $result = SQL_QUERY_ESC('SELECT
+ `network_id`,
+ `network_short_name`,
+ `network_title`,
+ `network_reflink`,
+ NULL AS `network_affiliate_id`,
+ NULL AS `network_api_password`,
+ NULL AS `network_site_id`,
+ NULL AS `network_query_amount`,
+ NULL AS `network_api_active`
FROM
- `{?_MYSQL_PREFIX?}_network_data` AS `d`
-LEFT JOIN
- `{?_MYSQL_PREFIX?}_network_config` AS `c`
-ON
- d.`network_id`=c.`network_id`
-ORDER BY
- d.`network_short_name` ASC", __FILE__, __LINE__);
+ `{?_MYSQL_PREFIX?}_network_data`
+WHERE
+ `network_id`=%s
+LIMIT 1',
+ array(
+ bigintval(getRequestElement('network'))
+ ), __FILE__, __LINE__);
-// Do we have entries?
-if (!SQL_HASZERONUMS($result)) {
- // We have some networks here
- $OUT = '';
- while ($content = SQL_FETCHARRAY($result)) {
- // Fix empty 'active' to 'yes'
- if (is_null($content['network_active'])) {
- // Fix it for our API function
- $content['network_active'] = 'Y';
+ // Do we have an entry?
+ if (SQL_NUMROWS($result) == 1) {
+ // Load data
+ $content = SQL_FETCHARRAY($result);
+
+ // Query for config table
+ $result_config = SQL_QUERY_ESC('SELECT
+ `network_affiliate_id`,
+ `network_api_password`,
+ `network_site_id`,
+ `network_query_amount`,
+ `network_api_active`
+FROM
+ `{?_MYSQL_PREFIX?}_network_config`
+WHERE
+ `network_id`=%s
+LIMIT 1',
+ array(
+ bigintval(getRequestElement('network'))
+ ), __FUNCTION__, __LINE__);
+
+ // Do we have an entry?
+ if (SQL_NUMROWS($result_config) == 1) {
+ // Load entries
+ $content = merge_array($content, SQL_FETCHARRAY($result_config));
} // END - if
- // Add network row
- $OUT .= loadTemplate('admin_list_network_config_row', true, $content);
- } // END - while
+ // Free result
+ SQL_FREERESULT($result_config);
+
+ // Load main template
+ loadTemplate('admin_config_network', false, $content);
+ } else {
+ // Please setup some networks first
+ displayMessage('{--ADMIN_NETWORK_DATA_MISSING--}');
+ }
- // Load main template
- loadTemplate('admin_list_network_config', false, $OUT);
+ // Free result
+ SQL_FREERESULT($result);
} else {
- // Please setup some networks first
- loadTemplate('admin_settings_saved', false, '{--ADMIN_NETWORK_DATA_MISSING--}');
+ // Generate network list for this script
+ outputHtml(generateAdminNetworkList());
}
-// Free result
-SQL_FREERESULT($result);
// [EOF]
?>