]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/network_functions.php
Mailer project continued:
[mailer.git] / inc / libs / network_functions.php
index d90c329cae84e79d3be7237aaa22a45c677d5ccc..8312c16ea9f066878400b96ae1dcd27c2f505124 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -55,7 +55,7 @@ function detectNetworkProcessForm () {
        // 'do' must be provided in URL
        if (!isGetRequestElementSet('do')) {
                // Not provided!
-               debug_report_bug(__FUNCTION__, __LINE__, 'No "do" has been provided. Please fix your templates.');
+               reportBug(__FUNCTION__, __LINE__, 'No "do" has been provided. Please fix your templates.');
        } // END - if
 
        // Default is invalid
@@ -76,13 +76,13 @@ function detectNetworkProcessForm () {
        // Has the form being detected?
        if ($GLOBALS['network_form_name'] == 'invalid') {
                // Not supported
-               debug_report_bug(__FUNCTION__, __LINE__, 'POST form could not be detected.');
+               reportBug(__FUNCTION__, __LINE__, 'POST form could not be detected.');
        } // END - if
 }
 
 // Handle a (maybe) sent form here
 function doNetworkHandleForm () {
-       // Do we have a form sent?
+       // Is there a form sent?
        if (countRequestPost() > 0) {
                // Detect sent POST form
                detectNetworkProcessForm();
@@ -103,7 +103,7 @@ function doAdminNetworkProcessForm () {
        // Is the function valid?
        if (!function_exists($functionName)) {
                // Invalid function name
-               debug_report_bug(__FUNCTION__, __LINE__, 'Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.', false);
+               reportBug(__FUNCTION__, __LINE__, 'Invalid do ' . getRequestElement('do') . ', function ' . $functionName .' does not exist.', false);
        } // END - if
 
        // Init global arrays
@@ -113,7 +113,7 @@ function doAdminNetworkProcessForm () {
        call_user_func($functionName);
 }
 
-// Checks wether the (short) network name is already used (valid)
+// Checks whether the (short) network name is already used (valid)
 function isNetworkNameValid ($name) {
        // Query for it
        $result = SQL_QUERY_ESC("SELECT `network_id` FROM `{?_MYSQL_PREFIX?}_network_data` WHERE `network_short_name`='%s' LIMIT 1",
@@ -129,7 +129,7 @@ function isNetworkNameValid ($name) {
        return $isValid;
 }
 
-// Checks wether the given network type is already used (valid)
+// Checks whether the given network type is already used (valid)
 function isNetworkTypeHandleValid ($type, $networkId) {
        // Query for it
        $result = SQL_QUERY_ESC("SELECT `network_type_id` FROM `{?_MYSQL_PREFIX?}_network_types` WHERE `network_id`=%s AND `network_type_handler`='%s' LIMIT 1",
@@ -148,7 +148,7 @@ function isNetworkTypeHandleValid ($type, $networkId) {
        return $isValid;
 }
 
-// Checks wether the given network request parameter is already used (valid)
+// Checks whether the given network request parameter is already used (valid)
 function isNetworkRequestElementValid ($key, $type, $networkId) {
        // Query for it
        $result = SQL_QUERY_ESC("SELECT `network_request_param_id` FROM `{?_MYSQL_PREFIX?}_network_request_params` WHERE `network_id`=%s AND `network_type_id`=%s AND `network_request_param_key`='%s' LIMIT 1",
@@ -168,7 +168,7 @@ function isNetworkRequestElementValid ($key, $type, $networkId) {
        return $isValid;
 }
 
-// Checks wether the given vcheck request parameter is already used (valid)
+// Checks whether the given vcheck request parameter is already used (valid)
 function isNetworkVcheckElementValid ($key, $networkId) {
        // Query for it
        $result = SQL_QUERY_ESC("SELECT `network_vcheck_param_id` FROM `{?_MYSQL_PREFIX?}_network_vcheck_params` WHERE `network_id`=%s AND `network_vcheck_param_key`='%s' LIMIT 1",
@@ -187,7 +187,7 @@ function isNetworkVcheckElementValid ($key, $networkId) {
        return $isValid;
 }
 
-// Checks wether the given network API array translation
+// Checks whether the given network API array translation
 function isNetworkArrayTranslationValid ($key, $type, $networkId) {
        // Query for it
        $result = SQL_QUERY_ESC("SELECT `network_array_id` FROM `{?_MYSQL_PREFIX?}_network_array_translation` WHERE `network_id`=%s AND `network_type_id`=%s AND `network_array_index`='%s' LIMIT 1",
@@ -212,7 +212,7 @@ function getNetworkDataById ($networkId, $column = '') {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // Set current network id
@@ -242,7 +242,7 @@ WHERE
 LIMIT 1",
                        array(bigintval($networkId)), __FUNCTION__, __LINE__);
 
-               // Do we have an entry?
+               // Is there an entry?
                if (SQL_NUMROWS($result) == 1) {
                        // Then get it
                        $GLOBALS['network_data'][$networkId] = SQL_FETCHARRAY($result);
@@ -267,7 +267,7 @@ function getNetworkDataByTypeId ($networkId, $column = '') {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network type id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network type id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // Set current network id
@@ -293,7 +293,8 @@ function getNetworkDataByTypeId ($networkId, $column = '') {
        t.`network_type_handler`,
        t.`network_type_api_url`,
        t.`network_type_click_url`,
-       t.`network_type_banner_url`
+       t.`network_type_banner_url`,
+       t.`network_text_encoding`
 FROM
        `{?_MYSQL_PREFIX?}_network_data` AS d
 LEFT JOIN
@@ -305,7 +306,7 @@ WHERE
 LIMIT 1",
                        array(bigintval($networkId)), __FUNCTION__, __LINE__);
 
-               // Do we have an entry?
+               // Is there an entry?
                if (SQL_NUMROWS($result) == 1) {
                        // Then get it
                        $GLOBALS['network_data'][$networkId] = SQL_FETCHARRAY($result);
@@ -330,7 +331,7 @@ function getNetworkTypeDataById ($networkId) {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network type id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network type id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // By default we have no data
@@ -351,7 +352,7 @@ WHERE
 LIMIT 1',
                array(bigintval($networkId)), __FUNCTION__, __LINE__);
 
-       // Do we have an entry?
+       // Is there an entry?
        if (SQL_NUMROWS($result) == 1) {
                // Then get it
                $GLOBALS['network_type_data'][$networkId] = SQL_FETCHARRAY($result);
@@ -369,7 +370,7 @@ function getNetworkRequestParamsDataById ($networkId) {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network request parameter id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network request parameter id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // By default we have no data
@@ -390,7 +391,7 @@ WHERE
 LIMIT 1',
                array(bigintval($networkId)), __FUNCTION__, __LINE__);
 
-       // Do we have an entry?
+       // Is there an entry?
        if (SQL_NUMROWS($result) == 1) {
                // Then get it
                $networkRequestData = SQL_FETCHARRAY($result);
@@ -408,7 +409,7 @@ function doNetworkUpdateDataByArray ($networkId, $networkData) {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // Just call our inner method
@@ -420,7 +421,7 @@ function doNetworkUpdateTypeByArray ($networkId, $networkTypeData) {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network type handler id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network type handler id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // Just call our inner method
@@ -432,7 +433,7 @@ function doNetworkUpdateParamsByArray ($networkId, $networkParamData) {
        // Ids lower one are not accepted
        if ($networkId < 1) {
                // Not good, should be fixed
-               debug_report_bug(__FUNCTION__, __LINE__, 'Network request parameter id ' . $networkId . ' is smaller than 1.');
+               reportBug(__FUNCTION__, __LINE__, 'Network request parameter id ' . $networkId . ' is smaller than 1.');
        } // END - if
 
        // Just call our inner method
@@ -471,7 +472,7 @@ WHERE
 ORDER BY
        `network_short_name` ASC", __FUNCTION__, __LINE__);
 
-       // Do we have entries?
+       // Are there entries?
        if (!SQL_HASZERONUMS($result)) {
                // List all entries
                $rows = array();
@@ -516,7 +517,7 @@ ORDER BY
                        bigintval($networkId)
                ), __FUNCTION__, __LINE__);
 
-       // Do we have entries?
+       // Are there entries?
        if (!SQL_HASZERONUMS($result)) {
                // List all entries
                $rows = array();
@@ -564,7 +565,7 @@ ORDER BY
        d.`network_short_name` ASC,
        t.`network_type_handler` ASC", __FUNCTION__, __LINE__);
 
-       // Do we have entries?
+       // Are there entries?
        if (!SQL_HASZERONUMS($result)) {
                // List all entries
                $rows = array();
@@ -601,7 +602,7 @@ function generateNetworkTypeOptions ($networkId) {
        // Is this cached?
        if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
                // Generate output and cache it
-               $GLOBALS[__FUNCTION__][$networkId] = generateOptionList(
+               $GLOBALS[__FUNCTION__][$networkId] = generateOptions(
                        'network_types',
                        'network_type_id',
                        'network_type_handler',
@@ -625,7 +626,7 @@ function generateNetworkTypesAvailableOptions ($defaultType = NULL) {
        // Is it cached?
        if (!isset($GLOBALS[__FUNCTION__][$defaultType])) {
                // Generate list
-               $GLOBALS[__FUNCTION__][$defaultType] = generateOptionList(
+               $GLOBALS[__FUNCTION__][$defaultType] = generateOptions(
                        '/ARRAY/',
                        array(
                                'banner',
@@ -670,15 +671,38 @@ function generateNetworkTypesAvailableOptions ($defaultType = NULL) {
        return $GLOBALS[__FUNCTION__][$defaultType];
 }
 
+// Generates an options list of all available (hard-coded) text encoders
+function generateNetworkTextEncodingAvailableOptions ($defaultEncoding = NULL) {
+       // Is it cached?
+       if (!isset($GLOBALS[__FUNCTION__][$defaultEncoding])) {
+               // Generate list
+               $GLOBALS[__FUNCTION__][$defaultEncoding] = generateOptions(
+                       '/ARRAY/',
+                       array(
+                               'NONE',
+                               'BASE64',
+                       ),
+                       array(),
+                       $defaultEncoding,
+                       '', '',
+                       array(),
+                       'translateNetworkTextEncoding'
+               );
+       } // END - if
+
+       // Return content
+       return $GLOBALS[__FUNCTION__][$defaultEncoding];
+}
+
 // Generates an options list (somewhat getter) for request keys
 function generateNetworkRequestKeyOptions () {
        // Is it cached?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Generate and cache it
-               $GLOBALS[__FUNCTION__] = generateOptionList(
+               $GLOBALS[__FUNCTION__] = generateOptions(
                        '/ARRAY/',
                        array(
-                               'id',
+                               'affiliate_id',
                                'sid',
                                'hash',
                                'password',
@@ -711,7 +735,7 @@ function generateNetworkVcheckKeyOptions () {
        // Is it cached?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Generate and cache it
-               $GLOBALS[__FUNCTION__] = generateOptionList(
+               $GLOBALS[__FUNCTION__] = generateOptions(
                        '/ARRAY/',
                        array(
                                'network_key',
@@ -745,7 +769,7 @@ function generateNetworkTranslationOptions ($default = '') {
        // Is it cached?
        if (!isset($GLOBALS[__FUNCTION__][$default])) {
                // Generate and cache it
-               $GLOBALS[__FUNCTION__][$default] = generateOptionList(
+               $GLOBALS[__FUNCTION__][$default] = generateOptions(
                        'network_translations',
                        'network_translation_id',
                        'network_translation_name',
@@ -763,10 +787,10 @@ function generateNetworkTranslationOptions ($default = '') {
 
 // Generates an option list of request types
 function generateNetworkRequestTypeOptions ($default = '') {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$default])) {
                // Generate the list
-               $GLOBALS[__FUNCTION__][$default] = generateOptionList(
+               $GLOBALS[__FUNCTION__][$default] = generateOptions(
                        '/ARRAY/',
                        array(
                                'GET',
@@ -786,10 +810,10 @@ function generateNetworkRequestTypeOptions ($default = '') {
 
 // Generates an option list of network_api_active
 function generateNetworkApiActiveOptions ($default = '') {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$default])) {
                // Generate the list
-               $GLOBALS[__FUNCTION__][$default] = generateYesNoOptionList($default);
+               $GLOBALS[__FUNCTION__][$default] = generateYesNoOptions($default);
        } // END - if
 
        // Return cache
@@ -803,8 +827,8 @@ function translateNetworkTranslationName ($name) {
 
        // Is the message id there?
        if (!isMessageIdValid($messageId)) {
-               // Not valid type
-               debug_report_bug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+               // Not valid name
+               reportBug(__FUNCTION__, __LINE__, 'name=' . $name . ' is invalid.');
        } // END - if
 
        // Return message id
@@ -819,7 +843,7 @@ function translateNetworkTypeHandler ($type) {
        // Is the message id there?
        if (!isMessageIdValid($messageId)) {
                // Not valid type
-               debug_report_bug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+               reportBug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
        } // END - if
 
        // Return message id
@@ -834,7 +858,7 @@ function translateNetworkRequestType ($type) {
        // Is the message id there?
        if (!isMessageIdValid($messageId)) {
                // Not valid type
-               debug_report_bug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
+               reportBug(__FUNCTION__, __LINE__, 'type=' . $type . ' is invalid.');
        } // END - if
 
        // Return message id
@@ -849,7 +873,7 @@ function translateNetworkRequestParameterKey ($param) {
        // Is the message id there?
        if (!isMessageIdValid($messageId)) {
                // Not valid param
-               debug_report_bug(__FUNCTION__, __LINE__, 'param=' . $param . ' is invalid.');
+               reportBug(__FUNCTION__, __LINE__, 'param=' . $param . ' is invalid.');
        } // END - if
 
        // Return message id
@@ -864,7 +888,22 @@ function translateNetworkVcheckParameterKey ($param) {
        // Is the message id there?
        if (!isMessageIdValid($messageId)) {
                // Not valid param
-               debug_report_bug(__FUNCTION__, __LINE__, 'param=' . $param . ' is invalid.');
+               reportBug(__FUNCTION__, __LINE__, 'param=' . $param . ' is invalid.');
+       } // END - if
+
+       // Return message id
+       return '{--' . $messageId . '--}';
+}
+
+// Translate text-encoding
+function translateNetworkTextEncoding ($encoding) {
+       // Generate id
+       $messageId = 'ADMIN_NETWORK_TYPE_TEXT_ENCODING_' . strtoupper($encoding) . '';
+
+       // Is the message id there?
+       if (!isMessageIdValid($messageId)) {
+               // Not valid encoding
+               reportBug(__FUNCTION__, __LINE__, 'encoding=' . $encoding . ' is invalid.');
        } // END - if
 
        // Return message id
@@ -873,7 +912,7 @@ function translateNetworkVcheckParameterKey ($param) {
 
 // Translates API index
 function translateNetworkApiIndex ($index) {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS['network_array_index'])) {
                // Get an array of all API array indexes
                $GLOBALS['network_array_index'] = array();
@@ -892,7 +931,7 @@ ON
 ORDER BY
        `sort` ASC', __FUNCTION__, __LINE__);
 
-               // Do we have entries?
+               // Are there entries?
                if (!SQL_HASZERONUMS($result)) {
                        // Get all entries
                        while ($row = SQL_FETCHARRAY($result)) {
@@ -920,7 +959,7 @@ ORDER BY
 
 // Translates network API configuration status (see function isNetworkApiConfigured()) by given id
 function translateNetworkApiConfiguredStatusById ($networkId) {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
                // By default it is not configured
                $GLOBALS[__FUNCTION__][$networkId] = '{--ADMIN_NETWORK_API_NOT_CONFIGURED--}';
@@ -938,7 +977,7 @@ function translateNetworkApiConfiguredStatusById ($networkId) {
 
 // Checks if the given network is configured by looking its API configuration entry up
 function isNetworkApiConfigured ($networkId) {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$networkId])) {
                // Check for an entry in network_api_config
                $GLOBALS[__FUNCTION__][$networkId] = (countSumTotalData(
@@ -954,9 +993,9 @@ function isNetworkApiConfigured ($networkId) {
        return $GLOBALS[__FUNCTION__][$networkId];
 }
 
-// Checks wether the given network type handler is configured
+// Checks whether the given network type handler is configured
 function isNetworkTypeHandlerConfigured ($networkId, $networkTypeId) {
-       // Do we have cache?
+       // Is there cache?
        if (!isset($GLOBALS[__FUNCTION__][$networkId][$networkTypeId])) {
                // Determine it
                $GLOBALS[__FUNCTION__][$networkId][$networkTypeId] = (countSumTotalData(
@@ -975,8 +1014,8 @@ function isNetworkTypeHandlerConfigured ($networkId, $networkTypeId) {
 
 // Handles the network-payment-check request
 function handleNetworkPaymentCheckRequest () {
-       // @TODO Implement this function
-       debug_report_bug(__FUNCTION__, __LINE__, 'Not yet implemented.');
+       // @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.');
 }
 
 //------------------------------------------------------------------------------
@@ -1013,7 +1052,7 @@ function doAdminNetworkProcessAddNetwork () {
 
 // Displays selected networks for editing
 function doAdminNetworkProcessHandleNetworks () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // Something has been selected, so start displaying one by one
                $OUT = '';
@@ -1023,7 +1062,7 @@ function doAdminNetworkProcessHandleNetworks () {
                                // Load this network's data
                                $networkData = getNetworkDataById($networkId);
 
-                               // Do we have found the network?
+                               // Is there found the network?
                                if (count($networkData) > 0) {
                                        // Add row template with given form name
                                        $OUT .= loadTemplate('admin_' . $GLOBALS['network_form_name'] . '_networks_row', true, $networkData);
@@ -1047,7 +1086,7 @@ function doAdminNetworkProcessHandleNetworks () {
 
 // Handle network type form
 function doAdminNetworkProcessHandleNetworkTypes () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // Load network data
                $networkData = getNetworkDataById(getRequestElement('network_id'));
@@ -1060,7 +1099,7 @@ function doAdminNetworkProcessHandleNetworkTypes () {
                                // Load this network's data
                                $networkTypeData = getNetworkTypeDataById($networkId);
 
-                               // Do we have found the network?
+                               // Is there found the network?
                                if (count($networkTypeData) > 0) {
                                        if (isFormSent('edit')) {
                                                // Add row template for deleting
@@ -1070,7 +1109,7 @@ function doAdminNetworkProcessHandleNetworkTypes () {
                                                $OUT .= loadTemplate('admin_delete_network_types_row', true, $networkTypeData);
                                        } else {
                                                // Problem!
-                                               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
+                                               reportBug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                                        }
                                } // END - if
                        } // END - if
@@ -1085,7 +1124,7 @@ function doAdminNetworkProcessHandleNetworkTypes () {
                                loadTemplate('admin_delete_network_types', false, $OUT);
                        } else {
                                // Problem!
-                               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
+                               reportBug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                        }
 
                        // Don't display the list/add new form
@@ -1099,7 +1138,7 @@ function doAdminNetworkProcessHandleNetworkTypes () {
 
 // Handle network request parameter form
 function doAdminNetworkProcessHandleRequestParams () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // Init cache array
                $GLOBALS['network_request_params_disabled'] = array();
@@ -1115,7 +1154,7 @@ function doAdminNetworkProcessHandleRequestParams () {
                                // Load this network's data
                                $networkRequestData = getNetworkRequestParamsDataById($networkId);
 
-                               // Do we have found the network?
+                               // Is there found the network?
                                if (count($networkRequestData) > 0) {
                                        if (isFormSent('edit')) {
                                                // Add row template for deleting
@@ -1128,7 +1167,7 @@ function doAdminNetworkProcessHandleRequestParams () {
                                                $OUT .= loadTemplate('admin_delete_network_request_params_row', true, $networkRequestData);
                                        } else {
                                                // Problem!
-                                               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
+                                               reportBug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                                        }
                                } // END - if
                        } // END - if
@@ -1143,7 +1182,7 @@ function doAdminNetworkProcessHandleRequestParams () {
                                loadTemplate('admin_delete_network_request_params', false, $OUT);
                        } else {
                                // Problem!
-                               debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
+                               reportBug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                        }
 
                        // Don't display the list/add new form
@@ -1157,7 +1196,7 @@ function doAdminNetworkProcessHandleRequestParams () {
 
 // Changes given networks
 function doAdminNetworkProcessChangeNetworks () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is updated
                $updated = 0;
@@ -1176,10 +1215,10 @@ function doAdminNetworkProcessChangeNetworks () {
                                                continue;
                                        } // END - if
 
-                                       // Do we have this enty?
+                                       // Is there this enty?
                                        if (!isset($entry[$networkId])) {
                                                // Not found, needs fixing
-                                               debug_report_bug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
+                                               reportBug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
                                        } // END - if
 
                                        // Add this entry
@@ -1191,7 +1230,7 @@ function doAdminNetworkProcessChangeNetworks () {
                        } // END - if
                } // END - foreach
 
-               // Do we have updates?
+               // Is there updates?
                if ($updated > 0) {
                        // Updates done
                        displayMessage('{%message,ADMIN_NETWORK_UPDATED=' . $updated . '%}');
@@ -1204,7 +1243,7 @@ function doAdminNetworkProcessChangeNetworks () {
 
 // Removes given networks
 function doAdminNetworkProcessRemoveNetworks () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is removed
                $removed = 0;
@@ -1218,7 +1257,7 @@ function doAdminNetworkProcessRemoveNetworks () {
                        } // END - if
                } // END - foreach
 
-               // Do we have removes?
+               // Is there removes?
                if ($removed > 0) {
                        // Removals done
                        displayMessage('{%message,ADMIN_NETWORK_REMOVED=' . $removed . '%}');
@@ -1267,7 +1306,7 @@ function doAdminNetworkProcessAddNetworkType () {
 
 // Changes given network type handlers
 function doAdminNetworkProcessChangeHandlerTypes () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is updated
                $updated = 0;
@@ -1286,10 +1325,10 @@ function doAdminNetworkProcessChangeHandlerTypes () {
                                                continue;
                                        } // END - if
 
-                                       // Do we have this enty?
+                                       // Is there this enty?
                                        if (!isset($entry[$networkId])) {
                                                // Not found, needs fixing
-                                               debug_report_bug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
+                                               reportBug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
                                        } // END - if
 
                                        // Fix empty network_type_banner_url to NULL
@@ -1307,7 +1346,7 @@ function doAdminNetworkProcessChangeHandlerTypes () {
                        } // END - if
                } // END - foreach
 
-               // Do we have updates?
+               // Is there updates?
                if ($updated > 0) {
                        // Updates done
                        displayMessage('{%message,ADMIN_NETWORK_TYPE_HANDLER_UPDATED=' . $updated . '%}');
@@ -1320,7 +1359,7 @@ function doAdminNetworkProcessChangeHandlerTypes () {
 
 // Changes given network request parameters
 function doAdminNetworkProcessChangeRequestParams () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is updated
                $updated = 0;
@@ -1339,10 +1378,10 @@ function doAdminNetworkProcessChangeRequestParams () {
                                                continue;
                                        } // END - if
 
-                                       // Do we have this enty?
+                                       // Is there this enty?
                                        if (!isset($entry[$networkId])) {
                                                // Not found, needs fixing
-                                               debug_report_bug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
+                                               reportBug(__FUNCTION__, __LINE__, 'No entry in key=' . $key . ', id=' . $networkId . ' found.');
                                        } // END - if
 
                                        // Fix empty network_request_param_default to NULL
@@ -1360,7 +1399,7 @@ function doAdminNetworkProcessChangeRequestParams () {
                        } // END - if
                } // END - foreach
 
-               // Do we have updates?
+               // Is there updates?
                if ($updated > 0) {
                        // Updates done
                        displayMessage('{%message,ADMIN_NETWORK_REQUEST_PARAMETER_UPDATED=' . $updated . '%}');
@@ -1373,7 +1412,7 @@ function doAdminNetworkProcessChangeRequestParams () {
 
 // Removes given network type handlers
 function doAdminNetworkProcessRemoveNetworkTypes () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is removed
                $removed = 0;
@@ -1387,7 +1426,7 @@ function doAdminNetworkProcessRemoveNetworkTypes () {
                        } // END - if
                } // END - foreach
 
-               // Do we have removes?
+               // Is there removes?
                if ($removed > 0) {
                        // Removals done
                        displayMessage('{%message,ADMIN_NETWORK_TYPE_HANDLER_REMOVED=' . $removed . '%}');
@@ -1400,7 +1439,7 @@ function doAdminNetworkProcessRemoveNetworkTypes () {
 
 // Removes given network request parameters
 function doAdminNetworkProcessRemoveNetworkRequestParams () {
-       // Do we have selections?
+       // Is there selections?
        if (ifPostContainsSelections()) {
                // By default nothing is removed
                $removed = 0;
@@ -1414,7 +1453,7 @@ function doAdminNetworkProcessRemoveNetworkRequestParams () {
                        } // END - if
                } // END - foreach
 
-               // Do we have removes?
+               // Is there removes?
                if ($removed > 0) {
                        // Removals done
                        displayMessage('{%message,ADMIN_NETWORK_REQUEST_PARAMETER_REMOVED=' . $removed . '%}');
@@ -1594,19 +1633,8 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = true) {
                } // END - if
        } // END - foreach
 
-       // Initialize variables
-       $content = array();
-       $id = 'network_max_reload_time_ye';
-       $skip = false;
-
-       // Get all POST data
-       $postData = postRequestArray();
-
-       // Convert "reload time selections"
-       convertSelectionsToEpocheTime($postData, $content, $id, $skip);
-
-       // Set the POST array back
-       setPostRequestArray($postData);
+       // Convert data in POST array
+       convertSelectionsToEpocheTimeInPostData($content, 'network_max_reload_time_ye', $skip);
 
        // Is there already an entry?
        if (isNetworkTypeHandlerConfigured(getRequestElement('network_id'), getRequestElement('network_type_id'))) {
@@ -1625,7 +1653,7 @@ function doAdminNetworkProcessAddHandlerTypesConfig ($displayMessage = true) {
                $result = SQL_QUERY_ESC('SELECT `network_type_id` FROM `{?_MYSQL_PREFIX?}_network_types` WHERE `network_id`=%s ORDER BY `network_type_id` ASC',
                        array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__);
 
-               // Do we have entries?
+               // Are there entries?
                if (SQL_HASZERONUMS($result)) {
                        // No, then abort here
                        displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}');
@@ -1696,17 +1724,8 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = true) {
                } // END - if
        } // END - foreach
 
-       // Initialize variables
-       $content = array();
-       $id = 'network_max_reload_time_ye';
-       $skip = false;
-       $postData = postRequestArray();
-
-       // Convert "reload time selections"
-       convertSelectionsToEpocheTime($postData, $content, $id, $skip);
-
-       // Set the POST array back
-       setPostRequestArray($postData);
+       // Convert time selections in POST data
+       convertSelectionsToEpocheTimeInPostArray('network_max_reload_time_ye');
 
        // Is there already an entry?
        if (!isNetworkTypeHandlerConfigured(getRequestElement('network_id'), getRequestElement('network_type_id'))) {
@@ -1725,7 +1744,7 @@ function doAdminNetworkProcessEditHandlerTypesConfig ($displayMessage = true) {
                $result = SQL_QUERY_ESC('SELECT `network_data_id` FROM `{?_MYSQL_PREFIX?}_network_types_config` WHERE `network_id`=%s ORDER BY `network_type_id` ASC',
                        array(bigintval(getRequestElement('network_id'))), __FUNCTION__, __LINE__);
 
-               // Do we have entries?
+               // Are there entries?
                if (SQL_HASZERONUMS($result)) {
                        // No, then abort here
                        displayMessage('{--ADMIN_CONFIG_NETWORK_HANDLER_SET_ALL_404--}');
@@ -1808,7 +1827,7 @@ function doAdminNetworkProcessExport () {
        // Init table with all valid what->table entries
        $validExports = array(
                // General network data
-               'list_networks'                  => 'data',
+               'list_network_data'              => 'data',
                // Network type handler
                'list_network_types'             => 'types',
                // Network request parameter
@@ -1822,7 +1841,7 @@ function doAdminNetworkProcessExport () {
        // Is the 'what' key valid?
        if (!isset($validExports[getWhat()])) {
                // Not valid
-               debug_report_bug(__FUNCTION__, __LINE__, 'what=' . getWhat() . ' - not supported');
+               reportBug(__FUNCTION__, __LINE__, 'what=' . getWhat() . ' - not supported');
        } // END - if
 
        // Generate call-back, some tables require to export not all columns
@@ -1831,10 +1850,10 @@ function doAdminNetworkProcessExport () {
        // Is the call-back function there?
        if (!function_exists($callbackName)) {
                // No, this is really bad
-               debug_report_bug(__FUNCTION__, __LINE__, 'Invalid call-back function ' . $callbackName . ' detected.');
+               reportBug(__FUNCTION__, __LINE__, 'Invalid call-back function ' . $callbackName . ' detected.');
        } elseif (isset($GLOBALS[__FUNCTION__][$callbackName])) {
                // Already called!
-               debug_report_bug(__FUNCTION__, __LINE__, 'Double-call of export function ' . $callbackName . ' detected.');
+               reportBug(__FUNCTION__, __LINE__, 'Double-call of export function ' . $callbackName . ' detected.');
        }
 
        // Call the function
@@ -1868,7 +1887,7 @@ ORDER BY
                __FUNCTION__, __LINE__);
 
        // Start an empty SQL query
-       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_data` (`network_short_name`,`network_title`,`network_reflink`,`network_data_separator`,`network_row_separator`,`network_request_type`,`network_charset`,`network_require_id_card`,`network_query_amount`,`network_active`) VALUES\n";
+       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_data` (`network_short_name`, `network_title`, `network_reflink`, `network_data_separator`, `network_row_separator`, `network_request_type`, `network_charset`, `network_require_id_card`, `network_query_amount`, `network_active`) VALUES\n";
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
@@ -1901,7 +1920,7 @@ function doAdminNetworkExportTypes () {
        // 'network_id' must be set
        if (!isGetRequestElementSet('network_id')) {
                // Only network handlers of one network will be exported per time
-               debug_report_bug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
+               reportBug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
        } // END - if
 
        // Get all network types of given network
@@ -1912,7 +1931,8 @@ function doAdminNetworkExportTypes () {
        `network_type_api_url`,
        `network_type_click_url`,
        `network_type_banner_url`,
-       `network_type_reload_time_unit`
+       `network_type_reload_time_unit`,
+       `network_text_encoding`
 FROM
        `{?_MYSQL_PREFIX?}_network_types`
 WHERE
@@ -1924,7 +1944,7 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Start an empty SQL query
-       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_types` (`network_type_id`,`network_id`,`network_type_handler`,`network_type_api_url`,`network_type_click_url`,`network_type_banner_url`,`network_type_reload_time_unit`) VALUES\n";
+       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_types` (`network_type_id`, `network_id`, `network_type_handler`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url`, `network_type_reload_time_unit`, `network_text_encoding`) VALUES\n";
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
@@ -1942,11 +1962,11 @@ ORDER BY
                        $SQL .= 'NULL';
                } else {
                        // Column is set
-                       $SQL .= "'" . $content['network_type_banner_url'] . "'";
+                       $SQL .= chr(39) . $content['network_type_banner_url'] . chr(39);
                }
 
                // Add more
-               $SQL .= ",'" . $content['network_type_reload_time_unit'] . "'),\n";
+               $SQL .= ",'" . $content['network_type_reload_time_unit'] . "','" . $content['network_text_encoding'] . "'),\n";
        } // END - while
 
        // Remove last commata and close braces
@@ -1964,7 +1984,7 @@ function doAdminNetworkExportRequestParams () {
        // 'network_id' must be set
        if (!isGetRequestElementSet('network_id')) {
                // Only network request parameters of one network will be exported per time
-               debug_report_bug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
+               reportBug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
        } // END - if
 
        // Get all network types of given network
@@ -1986,7 +2006,7 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Start an empty SQL query
-       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_request_params` (`network_id`,`network_type_id`,`network_request_param_key`,`network_request_param_value`,`network_request_param_default`) VALUES\n";
+       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_request_params` (`network_id`, `network_type_id`, `network_request_param_key`, `network_request_param_value`, `network_request_param_default`) VALUES\n";
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
@@ -2003,7 +2023,7 @@ ORDER BY
                        $SQL .= "NULL),\n";
                } else {
                        // Column is set
-                       $SQL .= "'" . $content['network_request_param_default'] . "'),\n";
+                       $SQL .= chr(39) . $content['network_request_param_default'] . "'),\n";
                }
        } // END - while
 
@@ -2022,7 +2042,7 @@ function doAdminNetworkExportVcheckParams () {
        // 'network_id' must be set
        if (!isGetRequestElementSet('network_id')) {
                // Only network vcheck parameters of one network will be exported per time
-               debug_report_bug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
+               reportBug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
        } // END - if
 
        // Get all network types of given network
@@ -2042,7 +2062,7 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Start an empty SQL query
-       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_vcheck_params` (`network_id`,`network_vcheck_param_key`,`network_vcheck_param_value`,`network_vcheck_param_default`) VALUES\n";
+       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_vcheck_params` (`network_id`, `network_vcheck_param_key`, `network_vcheck_param_value`, `network_vcheck_param_default`) VALUES\n";
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
@@ -2058,7 +2078,7 @@ ORDER BY
                        $SQL .= "NULL),\n";
                } else {
                        // Column is set
-                       $SQL .= "'" . $content['network_vcheck_param_default'] . "'),\n";
+                       $SQL .= chr(39) . $content['network_vcheck_param_default'] . "'),\n";
                }
        } // END - while
 
@@ -2077,7 +2097,7 @@ function doAdminNetworkExportArrayTranslation () {
        // 'network_id' must be set
        if (!isGetRequestElementSet('network_id')) {
                // Only network API array index translations of one network will be exported per time
-               debug_report_bug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
+               reportBug(__FUNCTION__, __LINE__, 'network_id not provided, please fix your links.');
        } // END - if
 
        // Get all network types of given network
@@ -2098,7 +2118,7 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Start an empty SQL query
-       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_array_translation` (`network_id`,`network_type_id`,`network_array_index`,`sort`) VALUES\n";
+       $SQL = "INSERT INTO `&#123;&#63;_MYSQL_PREFIX&#63;&#125;_network_array_translation` (`network_id`, `network_type_id`, `network_array_index`, `sort`) VALUES\n";
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {