From 465859de0e017d99130df209391fe0742fc24271 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 13 Aug 2011 20:30:35 +0000 Subject: [PATCH] Extension ext-network continued: - Stub script added for network types configuration - GET request parameter 'network' renamed to 'network_id' for clear naming - TODOs.txt updated --- .gitattributes | 1 + DOCS/TODOs.txt | 13 ++-- inc/libs/network_functions.php | 28 ++++---- inc/modules/admin/what-config_network_api.php | 6 +- .../admin/what-config_network_types.php | 67 +++++++++++++++++++ .../what-list_network_api_translation.php | 6 +- .../admin/what-list_network_params.php | 6 +- inc/modules/admin/what-list_network_types.php | 6 +- inc/template-functions.php | 20 ++++-- .../admin_add_network_api_translation.tpl | 2 +- .../html/admin/admin_add_network_params.tpl | 2 +- .../de/html/admin/admin_add_network_type.tpl | 2 +- .../html/admin/admin_config_network_api.tpl | 2 +- .../admin/admin_delete_network_params.tpl | 2 +- .../html/admin/admin_delete_network_types.tpl | 2 +- .../html/admin/admin_edit_network_params.tpl | 2 +- .../html/admin/admin_edit_network_types.tpl | 2 +- .../admin_list_network_api_translation.tpl | 2 +- .../html/admin/admin_list_network_params.tpl | 2 +- .../html/admin/admin_list_network_types.tpl | 2 +- .../de/html/admin/admin_list_networks_row.tpl | 10 +-- .../de/html/admin/admin_network_added.tpl | 2 +- .../admin_network_api_translation_added.tpl | 6 +- .../admin_network_request_param_added.tpl | 2 +- .../html/admin/admin_network_type_added.tpl | 2 +- .../html/select/select_network_type_box.tpl | 2 +- 26 files changed, 142 insertions(+), 57 deletions(-) create mode 100644 inc/modules/admin/what-config_network_types.php diff --git a/.gitattributes b/.gitattributes index 635adebf99..ca79db6e05 100644 --- a/.gitattributes +++ b/.gitattributes @@ -480,6 +480,7 @@ inc/modules/admin/what-config_mediadata.php svneol=native#text/plain inc/modules/admin/what-config_menu.php svneol=native#text/plain inc/modules/admin/what-config_mods.php svneol=native#text/plain inc/modules/admin/what-config_network_api.php svneol=native#text/plain +inc/modules/admin/what-config_network_types.php svneol=native#text/plain inc/modules/admin/what-config_networks.php svneol=native#text/plain inc/modules/admin/what-config_newsletter.php svneol=native#text/plain inc/modules/admin/what-config_nickname.php svneol=native#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 662189be18..ddb63903ad 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -45,13 +45,13 @@ ./inc/filter/bonus_filter.php:56: // @TODO This query isn't right, it will only update if the user was for a longer time away! ./inc/filter/cache_filter.php:92: // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal. ./inc/filter/forced_filter.php:73: // @TODO This part is unfinished -./inc/functions.php:1183: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? -./inc/functions.php:1271: // @TODO Are these convertions still required? -./inc/functions.php:1291:// @TODO Rewrite this function to use readFromFile() and writeToFile() +./inc/functions.php:1185: // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ? +./inc/functions.php:1273: // @TODO Are these convertions still required? +./inc/functions.php:1293:// @TODO Rewrite this function to use readFromFile() and writeToFile() ./inc/functions.php:156:// @TODO Rewrite this to an extension 'smtp' -./inc/functions.php:1901: // @TODO Find a way to cache this -./inc/functions.php:2002: // @TODO This is still very static, rewrite it somehow -./inc/functions.php:2197: // @TODO Rename column data_type to e.g. mail_status +./inc/functions.php:1903: // @TODO Find a way to cache this +./inc/functions.php:2004: // @TODO This is still very static, rewrite it somehow +./inc/functions.php:2199: // @TODO Rename column data_type to e.g. mail_status ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter ./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0); ./inc/language/de.php:1074: // @TODO Rewrite these two constants @@ -110,6 +110,7 @@ ./inc/modules/admin/what-admins_mails.php:58: // @TODO Can this be rewritten to an API function? ./inc/modules/admin/what-bonus.php:46:// @TODO Unused at the moment ./inc/modules/admin/what-config_mods.php:55: // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function +./inc/modules/admin/what-config_network_types.php:60: // @TODO Do something here ./inc/modules/admin/what-config_points.php:110: // @TODO Rewrite this to a filter ./inc/modules/admin/what-config_rallye_prices.php:195: // @TODO Rewrite these two constants ./inc/modules/admin/what-config_rallye_prices.php:227: // @TODO rename: start->start_time, end->end_time diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 57e512bbcb..0c71a5269b 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -404,7 +404,9 @@ function generateAdminNetworkList () { // Query for all networks $result = SQL_QUERY('SELECT - `network_id`,`network_short_name`,`network_title` + `network_id`, + `network_short_name`, + `network_title` FROM `{?_MYSQL_PREFIX?}_network_data` ORDER BY @@ -423,7 +425,7 @@ ORDER BY } // END - while // Generate the selection box - $content = generateSelectionBoxFromArray($rows, 'network', 'network_id'); + $content = generateSelectionBoxFromArray($rows, 'network_id', 'network_id', '', '', 'network'); } else { // Nothing selected $content = loadTemplate('admin_settings_unsaved', false, '{--ADMIN_ENTRIES_404--}'); @@ -543,7 +545,7 @@ function generateNetworkTypeOptions ($networkId) { '', sprintf( "WHERE `network_id`=%s", - bigintval(getRequestElement('network')) + bigintval(getRequestElement('network_id')) ), '', 'translateNetworkTypeHandler' @@ -887,7 +889,7 @@ function doAdminNetworkProcessHandleNetworkType () { // Do we have selections? if (ifPostContainsSelections()) { // Load network data - $networkData = getNetworkDataById(getRequestElement('network')); + $networkData = getNetworkDataById(getRequestElement('network_id')); // Something has been selected, so start displaying one by one $OUT = ''; @@ -942,7 +944,7 @@ function doAdminNetworkProcessHandleRequestParams () { $GLOBALS['network_params_disabled'] = array(); // Load network data - $networkData = getNetworkDataById(getRequestElement('network')); + $networkData = getNetworkDataById(getRequestElement('network_id')); // Something has been selected, so start displaying one by one $OUT = ''; @@ -1069,7 +1071,7 @@ function doAdminNetworkProcessRemoveNetwork () { // Add a network type handler if not yet found function doAdminNetworkProcessAddNetworkType () { // Is the network type handle already used with given network? - if (isNetworkTypeHandleValid(postRequestElement('network_type_handle'), getRequestElement('network'))) { + if (isNetworkTypeHandleValid(postRequestElement('network_type_handle'), getRequestElement('network_id'))) { // Already added loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_NETWORK_TYPES_HANDLE_ALREADY_ADDED=' . postRequestElement('network_type_handle') . '%}'); @@ -1081,7 +1083,7 @@ function doAdminNetworkProcessAddNetworkType () { unsetPostRequestElement('ok'); // Add id - setPostRequestElement('network_id', bigintval(getRequestElement('network'))); + setPostRequestElement('network_id', bigintval(getRequestElement('network_id'))); // Is network_type_banner_url set? if (postRequestElement('network_type_banner_url') == '') { @@ -1265,7 +1267,7 @@ function doAdminNetworkProcessRemoveNetworkParam () { // Adds a request parameter to given network and type function doAdminNetworkProcessAddNetworkParam () { // Is the request parameter already used with given network? - if (isNetworkRequestElementValid(postRequestElement('network_request_param_key'), postRequestElement('network_type_id'), getRequestElement('network'))) { + if (isNetworkRequestElementValid(postRequestElement('network_request_param_key'), postRequestElement('network_type_id'), getRequestElement('network_id'))) { // Already added loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_NETWORK_REQUEST_PARAMETER_ALREADY_ADDED=' . postRequestElement('network_request_param_key') . '%}'); @@ -1277,7 +1279,7 @@ function doAdminNetworkProcessAddNetworkParam () { unsetPostRequestElement('ok'); // Add id - setPostRequestElement('network_id', bigintval(getRequestElement('network'))); + setPostRequestElement('network_id', bigintval(getRequestElement('network_id'))); // Is network_request_param_default set? if (postRequestElement('network_request_param_default') == '') { @@ -1301,7 +1303,7 @@ function doAdminNetworkProcessAddNetworkParam () { // Adds a API response array entry function doAdminNetworkProcessAddNetworkApiTranslation () { // Is the request parameter already used with given network? - if (isNetworkApiTranslationValid(postRequestElement('network_api_index'), postRequestElement('network_type_id'), getRequestElement('network'))) { + if (isNetworkApiTranslationValid(postRequestElement('network_api_index'), postRequestElement('network_type_id'), getRequestElement('network_id'))) { // Already added loadTemplate('admin_settings_unsaved', false, '{%message,ADMIN_NETWORK_API_TRANSLATION_ALREADY_ADDED=' . postRequestElement('network_api_index') . '%}'); @@ -1313,7 +1315,7 @@ function doAdminNetworkProcessAddNetworkApiTranslation () { unsetPostRequestElement('ok'); // Add id - setPostRequestElement('network_id', bigintval(getRequestElement('network'))); + setPostRequestElement('network_id', bigintval(getRequestElement('network_id'))); // Add sorting setPostRequestElement('sort', (countSumTotalData( @@ -1344,7 +1346,7 @@ function doAdminNetworkProcessNetworkApiConfig () { unsetPostRequestElement('ok'); // Add id - setPostRequestElement('network_id', bigintval(getRequestElement('network'))); + setPostRequestElement('network_id', bigintval(getRequestElement('network_id'))); // Is network_api_referral_button set? if (postRequestElement('network_api_referral_button') == '') { @@ -1353,7 +1355,7 @@ function doAdminNetworkProcessNetworkApiConfig () { } // END - if // Is there already an entry? - if (isNetworkApiConfigured(getRequestElement('network'))) { + if (isNetworkApiConfigured(getRequestElement('network_id'))) { // Generate SQL query $SQL = getUpdateSqlFromArray(postRequestArray(), 'network_api_config', 'network_id', postRequestElement('network_id'), array('network_id')); } else { diff --git a/inc/modules/admin/what-config_network_api.php b/inc/modules/admin/what-config_network_api.php index 3711063bbf..2a5ffb8350 100644 --- a/inc/modules/admin/what-config_network_api.php +++ b/inc/modules/admin/what-config_network_api.php @@ -56,7 +56,7 @@ if ($GLOBALS['network_display'] === false) { } // END - if // Do we have a network selected? -if (isGetRequestElementSet('network')) { +if (isGetRequestElementSet('network_id')) { // Check all networks that doesn't have a configuration entry $result = SQL_QUERY_ESC('SELECT `network_id`, @@ -76,7 +76,7 @@ WHERE `network_id`=%s LIMIT 1', array( - bigintval(getRequestElement('network')) + bigintval(getRequestElement('network_id')) ), __FILE__, __LINE__); // Do we have an entry? @@ -98,7 +98,7 @@ WHERE `network_id`=%s LIMIT 1', array( - bigintval(getRequestElement('network')) + bigintval(getRequestElement('network_id')) ), __FUNCTION__, __LINE__); // Do we have an entry? diff --git a/inc/modules/admin/what-config_network_types.php b/inc/modules/admin/what-config_network_types.php new file mode 100644 index 0000000000..0871c70c18 --- /dev/null +++ b/inc/modules/admin/what-config_network_types.php @@ -0,0 +1,67 @@ + diff --git a/inc/modules/admin/what-list_network_api_translation.php b/inc/modules/admin/what-list_network_api_translation.php index 4645fb0f95..aebd427023 100644 --- a/inc/modules/admin/what-list_network_api_translation.php +++ b/inc/modules/admin/what-list_network_api_translation.php @@ -62,9 +62,9 @@ if ($GLOBALS['network_display'] === false) { } // END - if // Do we have a network selected? -if (isGetRequestElementSet('network')) { +if (isGetRequestElementSet('network_id')) { // Get its data for template - $networkData = getNetworkDataById(getRequestElement('network')); + $networkData = getNetworkDataById(getRequestElement('network_id')); // Init type $networkData['network_type_id'] = 0; @@ -101,7 +101,7 @@ ORDER BY t.`network_type_handle` ASC, p.`network_api_id` ASC", array( - bigintval(getRequestElement('network')) + bigintval(getRequestElement('network_id')) ), __FILE__, __LINE__); // Do we have entries? diff --git a/inc/modules/admin/what-list_network_params.php b/inc/modules/admin/what-list_network_params.php index 459ce98193..12fc5b7cff 100644 --- a/inc/modules/admin/what-list_network_params.php +++ b/inc/modules/admin/what-list_network_params.php @@ -62,9 +62,9 @@ if ($GLOBALS['network_display'] === false) { } // END - if // Do we have a network selected? -if (isGetRequestElementSet('network')) { +if (isGetRequestElementSet('network_id')) { // Get its data for template - $networkData = getNetworkDataById(getRequestElement('network')); + $networkData = getNetworkDataById(getRequestElement('network_id')); $networkData['network_type_id'] = 0; // Init disabled list @@ -102,7 +102,7 @@ WHERE ORDER BY t.`network_type_handle` ASC, p.`network_param_id` ASC", - array(getRequestElement('network')), __FILE__, __LINE__); + array(getRequestElement('network_id')), __FILE__, __LINE__); // Do we have entries? if (!SQL_HASZERONUMS($result)) { diff --git a/inc/modules/admin/what-list_network_types.php b/inc/modules/admin/what-list_network_types.php index 4e3cf4297c..93a72bdb3c 100644 --- a/inc/modules/admin/what-list_network_types.php +++ b/inc/modules/admin/what-list_network_types.php @@ -62,9 +62,9 @@ if ($GLOBALS['network_display'] === false) { } // END - if // Do we have a network selected? -if (isGetRequestElementSet('network')) { +if (isGetRequestElementSet('network_id')) { // Get its data for template - $networkData = getNetworkDataById(getRequestElement('network')); + $networkData = getNetworkDataById(getRequestElement('network_id')); // Init disabled list $GLOBALS['network_types_disabled'] = array(); @@ -78,7 +78,7 @@ WHERE `network_id`=%s ORDER BY `network_type_handle` ASC", - array(getRequestElement('network')), __FILE__, __LINE__); + array(getRequestElement('network_id')), __FILE__, __LINE__); // Do we have entries? if (!SQL_HASZERONUMS($result)) { diff --git a/inc/template-functions.php b/inc/template-functions.php index e8bbe8171a..ee0e92585d 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -1638,7 +1638,7 @@ function sendModeMails ($mod, $modes) { } // Generates a 'selection box' from given array -function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent = '', $extraName = '') { +function generateSelectionBoxFromArray ($options, $name, $optionValue, $optionContent = '', $extraName = '', $templateName = '') { // Start the output $OUT = ' - +
-- 2.30.2