X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fnetwork_functions.php;h=e173bad283bed37d2914c517f99cf0b91bee4d90;hb=5a8c537bc2633402ca515964c9a3a2674f37edc2;hp=e90f6340229a7e983c64b1b92569ef7e399003a6;hpb=4cec044b57773e28423261c71f918f3e22ca8a75;p=mailer.git diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index e90f634022..e173bad283 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -41,6 +41,21 @@ if (!defined('__SECURITY')) { die(); } // END - if +// Handle a (maybe) sent form here +function doNetworkHandleForm () { + // Was the form sent? + if ((isFormSent()) || (isPostRequestElementSet('edit')) || (isPostRequestElementSet('del')) || (isPostRequestElementSet('change')) || (isPostRequestElementSet('remove'))) { + // Do we have a 'do'? + if (isGetRequestElementSet('do')) { + // Process the request + doAdminNetworkProcessForm(); + } else { + // No 'do' found + loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_DO_404')); + } + } // END - if +} + // Processes an admin form function doAdminNetworkProcessForm () { // Form really sent? @@ -60,7 +75,7 @@ function doAdminNetworkProcessForm () { // Is the function valid? if (!function_exists($functionName)) { // Invalid function name - debug_report_bug('Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.'); + debug_report_bug('Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.', false); } // END - if // Call-back the method handling our request @@ -139,6 +154,42 @@ function doAdminRemoveNetworkEntry ($table, $column, $id, $limit = 1) { return SQL_AFFECTEDROWS(); } +// Generates a list of networks for given script and returns it +function generateAdminNetworkList () { + // Init output + $content = ''; + + // Query for all networks + $result = SQL_QUERY("SELECT + `network_id`, `network_title` +FROM + `{?_MYSQL_PREFIX?}_network_data` +ORDER BY + `network_title` ASC", __FILE__, __LINE__); + + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { + // List all entries + $rows = array(); + while ($row = SQL_FETCHARRAY($result)) { + // Is this valid, then add it + if ((is_array($row)) && (isset($row['network_id']))) $rows[] = $row; + } // END - while + + // Generate the selection box + $content = generateSelectionBoxFromArray($rows, 'network', 'network_id', 'network_title'); + } else { + // Nothing selected + $content = loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ENTRIES_404')); + } + + // Free the result + SQL_FREERESULT($result); + + // Return the list + return $content; +} + //------------------------------------------------------------------------------ // Call-back functions //------------------------------------------------------------------------------ @@ -148,7 +199,7 @@ function doAdminNetworkProcessAddnetworkForm () { // We can say here, the form is sent, so check if the network is already added if (isNetworkNameValid(postRequestElement('network_short_name'))) { // Already there - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_ALREADY_ADDED'), postRequestElement('network_short_name'))); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_ALREADY_ADDED', postRequestElement('network_short_name'))); return; } // END - if @@ -173,7 +224,7 @@ function doAdminNetworkProcessAddnetworkForm () { loadTemplate('admin_network_added', false, postRequestArray()); } else { // Not added - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_DATA_NOT_ADDED'), postRequestElement('network_short_name'))); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_DATA_NOT_ADDED', postRequestElement('network_short_name'))); } } @@ -280,7 +331,7 @@ function doAdminNetworkProcessChangenetworkForm () { // Do we have updates? if ($updated > 0) { // Updates done - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_UPDATED'), $updated)); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_UPDATED', $updated)); } else { // Nothing changed loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_NOTHING_CHANGED')); @@ -307,7 +358,7 @@ function doAdminNetworkProcessRemovenetworkForm () { // Do we have removes? if ($removed > 0) { // Removals done - loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_REMOVED'), $removed)); + loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_NETWORK_REMOVED', $removed)); } else { // Nothing removed loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_NOTHING_REMOVED'));