]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/network_functions.php
Extension ext-network continued:
[mailer.git] / inc / libs / network_functions.php
index 05c7927de4707b35932ecacd154a8426eee25bba..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())) {
@@ -627,6 +630,7 @@ function getFullNetworkConfigurationByTypeId ($networkTypeId) {
        `nac`.`network_api_referral_link`,
        `nac`.`network_api_referral_button`,
        `nac`.`network_api_remaining_requests`,
+       `nac`.`network_api_visual_pay_check`,
        `nts`.`network_type_reload_time_unit`,
        `ntc`.`network_max_reload_time`,
        `ntc`.`network_min_waiting_time`,
@@ -684,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 = '';
 
@@ -700,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__);
 
@@ -743,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
@@ -813,19 +817,19 @@ function generateAdminDistinctNetworkTypeList () {
 
        // Query all types of this network
        $result = SQL_QUERY('SELECT
-       t.`network_type_id`,
-       t.`network_type_handler`,
-       d.`network_title`
+       `t`.`network_type_id`,
+       `t`.`network_type_handler`,
+       `d`.`network_title`
 FROM
-       `{?_MYSQL_PREFIX?}_network_types` AS t
+       `{?_MYSQL_PREFIX?}_network_types` AS `t`
 LEFT JOIN
-       `{?_MYSQL_PREFIX?}_network_data` AS d
+       `{?_MYSQL_PREFIX?}_network_data` AS `d`
 ON
-       t.`network_id`=d.`network_id`
+       `t`.`network_id`=`d`.`network_id`
 ' . getNetworkActivatedColumn('WHERE', 'd') . '
 ORDER BY
-       d.`network_short_name` ASC,
-       t.`network_type_handler` ASC', __FUNCTION__, __LINE__);
+       `d`.`network_short_name` ASC,
+       `t`.`network_type_handler` ASC', __FUNCTION__, __LINE__);
 
        // Are there entries?
        if (!SQL_HASZERONUMS($result)) {
@@ -1183,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
@@ -1227,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(
@@ -2300,7 +2310,7 @@ function doAdminNetworkProcessChangeRequestParams () {
 }
 
 // Changes given network array translations
-function doAdminNetworkProcessChangeArrayTranslations () {
+function doAdminNetworkProcessChangeArrayTranslation () {
        // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is updated
@@ -2605,11 +2615,14 @@ function doAdminNetworkProcessNetworkApiConfig () {
        // Add id
        setPostRequestElement('network_id', bigintval(getRequestElement('network_id')));
 
-       // Is network_api_referral_button set?
-       if (!isPostRequestElementSet('network_api_referral_button')) {
-               // Remove empty value to get a NULL for an optional entry
-               unsetPostRequestElement('network_api_referral_button');
-       } // END - if
+       // NULL empty values
+       foreach (array('network_api_referral_button', 'network_api_visual_pay_check') as $key) {
+               // Is it set?
+               if (!isPostRequestElementSet($key)) {
+                       // Remove empty value to get a NULL for an optional entry
+                       unsetPostRequestElement($key);
+               } // END - if
+       } // END - foreach
 
        // Is there already an entry?
        if (isNetworkApiConfigured(getRequestElement('network_id'))) {