]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/network_functions.php
Extension ext-network continued:
[mailer.git] / inc / libs / network_functions.php
index 669e94d4f076d1eb1a56a71dd0a2f7c568294321..8438c972198160a9a9864f91eb632e874f1dfeae 100644 (file)
@@ -108,6 +108,9 @@ function doNetworkHandleForm () {
        } elseif (!isGetRequestElementSet('do')) {
                // Skip any further requests
                return;
+       } elseif ((getHttpRequestMethod() != 'POST') && (getRequestElement('do') != 'export')) {
+               // Do not process non-POST requests that are not 'do=export'
+               return;
        }
 
        // Process the request
@@ -169,11 +172,11 @@ function isNetworkActiveById ($networkId) {
 }
 
 // "Getter" for 'network_activated' column depending on current administrator's expert setting
-function getNetworkActivatedColumn ($whereAnd = 'WHERE', $table = '') {
+function getNetworkActivatedColumn ($whereAnd = 'WHERE', $table = '', $addSql = '') {
        // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$whereAnd][$table])) {
                // Default is exclude deactivated networks
-               $GLOBALS[__FUNCTION__][$whereAnd][$table] = ' ' . $whereAnd . ' ' . $table . "`network_active`='Y'";
+               $GLOBALS[__FUNCTION__][$whereAnd][$table] = ' ' . $whereAnd . ' ' . $table . "`network_active`='Y'" .  $addSql;
 
                // Is the export setting on and debug mode enabled?
                if ((isAdminsExpertSettingEnabled()) && (isDebugModeEnabled())) {
@@ -685,7 +688,7 @@ function doAdminRemoveNetworkEntry ($table, $column, $id, $limit = 1) {
 }
 
 // Generates a list of networks for given script and returns it
-function generateAdminNetworkList ($separated = FALSE, $includeConfigured = TRUE, $includeUnconfigured = TRUE, $extraName = '') {
+function generateAdminNetworkList ($separated = FALSE, $includeConfigured = TRUE, $includeUnconfigured = TRUE, $extraName = '', $addSql = '') {
        // Init output
        $content = '';
 
@@ -701,7 +704,7 @@ function generateAdminNetworkList ($separated = FALSE, $includeConfigured = TRUE
        `network_active`
 FROM
        `{?_MYSQL_PREFIX?}_network_data`
-' . getNetworkActivatedColumn() . '
+' . getNetworkActivatedColumn('WHERE', '', $addSql) . '
 ORDER BY
        `network_short_name` ASC', __FUNCTION__, __LINE__);
 
@@ -744,10 +747,10 @@ ORDER BY
                        $content = generateSelectionBoxFromArray($rows, 'network_id', 'network_id', '', $extraName, 'network');
                } else {
                        // Generate two small, first configured
-                       $content = generateAdminNetworkList(FALSE, TRUE, FALSE, '_configured');
+                       $content = generateAdminNetworkList(FALSE, TRUE, FALSE, '_configured', $addSql);
 
                        // Then add unconfigured
-                       $content .= generateAdminNetworkList(FALSE, FALSE, TRUE, '_unconfigured');
+                       $content .= generateAdminNetworkList(FALSE, FALSE, TRUE, '_unconfigured', $addSql);
                }
        } else {
                // Nothing selected
@@ -1184,6 +1187,12 @@ function handleNetworkPaymentCheckRequest () {
        reportBug(__FUNCTION__, __LINE__, 'Not yet implemented.');
 }
 
+// Handles the network-delete-url request
+function handleNetworkDeleteUrlRequest () {
+       // @TODO Implement this function, don't forget to set HTTP status back to '200 OK' if everything went fine
+       reportBug(__FUNCTION__, __LINE__, 'Not yet implemented.');
+}
+
 // Handle a single request parameter key by given network type handler id and "internal" key
 function handleRequestParameterKey ($networkTypeId, $networkRequestKey) {
        // Construct call-back function name
@@ -1228,7 +1237,7 @@ function logNetworkResponseHeaders ($networkId, $networkTypeId, $headers, $type)
        assert(in_array($type, array('MANUAL', 'CRON')));
 
        // Is debug logging enabled or status code not 200 OK?
-       if ((getConfig('network_logging_debug') == 'Y') || (!isHttpStatusOkay($response[0]))) {
+       if ((getConfig('network_logging_debug') == 'Y') || (!isHttpStatusOkay($headers[0]))) {
                // Add entry
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_network_header_logging` (`network_id`, `network_type_id`, `network_http_status_code`, `network_http_headers`, `network_logging_type`) VALUES(%s, %s, '%s', '%s', '%s')",
                        array(