]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/network_functions.php
Naming convention applied, ext-network menu resorted:
[mailer.git] / inc / libs / network_functions.php
index 8f4e0a59f44f0879046326b953326d9b18766e3d..d7d9946c235e677c4e5324ef0caa702009854e6c 100644 (file)
@@ -358,15 +358,15 @@ function generateAdminNetworkList () {
        $content = '';
 
        // Query for all networks
-       $result = SQL_QUERY("SELECT
+       $result = SQL_QUERY('SELECT
        `network_id`, `network_short_name`, `network_title`
 FROM
        `{?_MYSQL_PREFIX?}_network_data`
 ORDER BY
-       `network_short_name` ASC", __FUNCTION__, __LINE__);
+       `network_short_name` ASC', __FUNCTION__, __LINE__);
 
        // Do we have entries?
-       if (SQL_NUMROWS($result) > 0) {
+       if (!SQL_HASZERONUMS($result)) {
                // List all entries
                $rows = array();
                while ($row = SQL_FETCHARRAY($result)) {
@@ -410,7 +410,7 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Do we have entries?
-       if (SQL_NUMROWS($result) > 0) {
+       if (!SQL_HASZERONUMS($result)) {
                // List all entries
                $rows = array();
                while ($row = SQL_FETCHARRAY($result)) {
@@ -441,7 +441,7 @@ function generateAdminDistinctNetworkTypeList () {
        $content = '';
 
        // Query all types of this network
-       $result = SQL_QUERY("SELECT
+       $result = SQL_QUERY('SELECT
        t.`network_type_id`, t.`network_type_handle`, d.`network_title`
 FROM
        `{?_MYSQL_PREFIX?}_network_types` AS t
@@ -451,10 +451,10 @@ ON
        t.`network_id`=d.`network_id`
 ORDER BY
        d.`network_short_name` ASC,
-       t.`network_type_handle` ASC", __FUNCTION__, __LINE__);
+       t.`network_type_handle` ASC', __FUNCTION__, __LINE__);
 
        // Do we have entries?
-       if (SQL_NUMROWS($result) > 0) {
+       if (!SQL_HASZERONUMS($result)) {
                // List all entries
                $rows = array();
                while ($row = SQL_FETCHARRAY($result)) {
@@ -474,7 +474,7 @@ ORDER BY
 
        // Free the result
        SQL_FREERESULT($result);
-       //* DEBUG: */ die('<pre>'.htmlentities($content).'</pre>');
+       //* DEBUG: */ die('<pre>'.encodeEntities($content).'</pre>');
 
        // Return content
        return $content;
@@ -555,11 +555,11 @@ function generateNetworkRequestKeyOptions ($key) {
 }
 
 // Generator (somewhat getter) for (return) array translation
-function generateNetworkArrayTranslationOptions ($default) {
+function generateNetworkTranslationOptions ($default = '') {
        // Is it cached?
-       if (!isset($GLOBALS['network_array_translation'][$default])) {
+       if (!isset($GLOBALS['network_translation'][$default])) {
                // Generate and cache it
-               $GLOBALS['network_array_translation'][$default] = generateOptionList(
+               $GLOBALS['network_translation'][$default] = generateOptionList(
                        'network_translations',
                        'network_translation',
                        'network_translation',
@@ -568,13 +568,13 @@ function generateNetworkArrayTranslationOptions ($default) {
                        sprintf("WHERE `network_type_id`=%s",
                                bigintval(getRequestParameter('network_type'))
                        ),
-                       $GLOBALS['network_array_translation_disabled'],
+                       $GLOBALS['network_translation_disabled'],
                        'ADMIN_NETWORK_ARRAY_TRANSLATION_'
                );
        } // END - if
 
        // Return content
-       return $GLOBALS['network_array_translation'][$default];
+       return $GLOBALS['network_translation'][$default];
 }
 
 //------------------------------------------------------------------------------
@@ -594,10 +594,10 @@ function doAdminNetworkProcessAddnetworkForm () {
        unsetPostRequestParameter('ok');
 
        // Add the whole request to database
-       SQL_QUERY("INSERT INTO
+       SQL_QUERY('INSERT INTO
        `{?_MYSQL_PREFIX?}_network_data`
 (
-       `" . implode('`,`', array_keys(postRequestArray())) . "`
+       `' . implode('`,`', array_keys(postRequestArray())) . "`
 ) VALUES (
        '" . implode("','", array_values(postRequestArray())) . "'
 )", __FUNCTION__, __LINE__);
@@ -618,9 +618,9 @@ function doAdminNetworkProcessAddnetworkForm () {
 // Displays selected networks for editing
 function doAdminNetworkProcessHandlenetworkForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // Something has been selected, so start displaying one by one
-               $SW = 2; $OUT = '';
+               $OUT = '';
                foreach (postRequestParameter('sel') as $id => $sel) {
                        // Is this selected?
                        if ($sel == 1) {
@@ -629,9 +629,6 @@ function doAdminNetworkProcessHandlenetworkForm () {
 
                                // Do we have found the network?
                                if (count($networkData) > 0) {
-                                       // Add color
-                                       $networkData['sw'] = $SW;
-
                                        if (isFormSent('edit')) {
                                                // Make selection box for network_request_type
                                                $networkData['network_request_type'] = generateOptionList(
@@ -641,8 +638,8 @@ function doAdminNetworkProcessHandlenetworkForm () {
                                                                'POST'
                                                        ),
                                                        array(
-                                                               getMessage('ADMIN_NETWORK_REQUEST_TYPE_GET'),
-                                                               getMessage('ADMIN_NETWORK_REQUEST_TYPE_POST')
+                                                               '{--ADMIN_NETWORK_REQUEST_TYPE_GET--}',
+                                                               '{--ADMIN_NETWORK_REQUEST_TYPE_POST--}'
                                                        ),
                                                        $networkData['network_request_type']
                                                );
@@ -659,9 +656,6 @@ function doAdminNetworkProcessHandlenetworkForm () {
                                                // Problem!
                                                debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                                        }
-
-                                       // Switch colors
-                                       $SW = 3 - $SW;
                                } // END - if
                        } // END - if
                } // END - foreach
@@ -690,12 +684,12 @@ function doAdminNetworkProcessHandlenetworkForm () {
 // Handle network type form
 function doAdminNetworkProcessHandlenetworktypeForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // Load network data
                $networkData = getNetworkDataById(getRequestParameter('network'));
 
                // Something has been selected, so start displaying one by one
-               $SW = 2; $OUT = '';
+               $OUT = '';
                foreach (postRequestParameter('sel') as $id => $sel) {
                        // Is this selected?
                        if ($sel == 1) {
@@ -704,25 +698,16 @@ function doAdminNetworkProcessHandlenetworktypeForm () {
 
                                // Do we have found the network?
                                if (count($networkTypeData) > 0) {
-                                       // Add color
-                                       $networkTypeData['sw'] = $SW;
-
                                        if (isFormSent('edit')) {
                                                // Add row template for deleting
                                                $OUT .= loadTemplate('admin_edit_network_types_row', true, $networkTypeData);
                                        } elseif (isFormSent('del')) {
-                                               // Fix empty banner URL
-                                               if (trim($networkTypeData['network_type_banner_url']) == '') $networkTypeData['network_type_banner_url'] = '---';
-
                                                // Add row template for deleting
                                                $OUT .= loadTemplate('admin_del_network_types_row', true, $networkTypeData);
                                        } else {
                                                // Problem!
                                                debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                                        }
-
-                                       // Switch colors
-                                       $SW = 3 - $SW;
                                } // END - if
                        } // END - if
                } // END - foreach
@@ -757,7 +742,7 @@ function doAdminNetworkProcessHandlenetworktypeForm () {
 // Handle network request parameter form
 function doAdminNetworkProcessHandlerequestparamsForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // Init cache array
                $GLOBALS['network_params_disabled'] = array();
 
@@ -765,7 +750,7 @@ function doAdminNetworkProcessHandlerequestparamsForm () {
                $networkData = getNetworkDataById(getRequestParameter('network'));
 
                // Something has been selected, so start displaying one by one
-               $SW = 2; $OUT = '';
+               $OUT = '';
                foreach (postRequestParameter('sel') as $id => $sel) {
                        // Is this selected?
                        if ($sel == 1) {
@@ -774,9 +759,6 @@ function doAdminNetworkProcessHandlerequestparamsForm () {
 
                                // Do we have found the network?
                                if (count($networkRequestData) > 0) {
-                                       // Add color
-                                       $networkRequestData['sw'] = $SW;
-
                                        if (isFormSent('edit')) {
                                                // Add options list for network type
                                                $networkRequestData['type_options'] = generateNetworkTypeOptions($networkRequestData['network_type_id']);
@@ -787,9 +769,6 @@ function doAdminNetworkProcessHandlerequestparamsForm () {
                                                // Add row template for deleting
                                                $OUT .= loadTemplate('admin_edit_network_params_row', true, $networkRequestData);
                                        } elseif (isFormSent('del')) {
-                                               // Fix empty banner URL
-                                               if (trim($networkRequestData['request_param_default']) == '') $networkRequestData['request_param_default'] = '---';
-
                                                // Get type data
                                                $networkRequestData['network_type_data'] = getNetworkTypeDataById($networkRequestData['network_type_id']);
 
@@ -799,9 +778,6 @@ function doAdminNetworkProcessHandlerequestparamsForm () {
                                                // Problem!
                                                debug_report_bug(__FUNCTION__, __LINE__, 'Cannot detect edit/del.');
                                        }
-
-                                       // Switch colors
-                                       $SW = 3 - $SW;
                                } // END - if
                        } // END - if
                } // END - foreach
@@ -836,7 +812,7 @@ function doAdminNetworkProcessHandlerequestparamsForm () {
 // Changes given networks
 function doAdminNetworkProcessChangenetworkForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // By default nothing is updated
                $updated = 0;
 
@@ -881,7 +857,7 @@ function doAdminNetworkProcessChangenetworkForm () {
 // Removes given networks
 function doAdminNetworkProcessRemovenetworkForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // By default nothing is removed
                $removed = 0;
 
@@ -950,7 +926,7 @@ function doAdminNetworkProcessAddnetworktypeForm () {
 // Changes given network type handlers
 function doAdminNetworkProcessChangenetworktypeForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // By default nothing is updated
                $updated = 0;
 
@@ -1001,7 +977,7 @@ function doAdminNetworkProcessChangenetworktypeForm () {
 // Changes given network request parameters
 function doAdminNetworkProcessChangenetworkparamForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // By default nothing is updated
                $updated = 0;
 
@@ -1052,7 +1028,7 @@ function doAdminNetworkProcessChangenetworkparamForm () {
 // Removes given network type handlers
 function doAdminNetworkProcessRemovenetworktypeForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // By default nothing is removed
                $removed = 0;
 
@@ -1079,7 +1055,7 @@ function doAdminNetworkProcessRemovenetworktypeForm () {
 // Removes given network request parameters
 function doAdminNetworkProcessRemovenetworkparamForm () {
        // Do we have selections?
-       if (countPostSelection() > 0) {
+       if (ifPostContainsSelections()) {
                // By default nothing is removed
                $removed = 0;
 
@@ -1127,10 +1103,10 @@ function doAdminNetworkProcessAddnetworkparamForm () {
        } // END - if
 
        // Add the whole request to database
-       SQL_QUERY("INSERT INTO
+       SQL_QUERY('INSERT INTO
        `{?_MYSQL_PREFIX?}_network_request_params`
 (
-       `" . implode('`,`', array_keys(postRequestArray())) . "`
+       `' . implode('`,`', array_keys(postRequestArray())) . "`
 ) VALUES (
        '" . implode("','", array_values(postRequestArray())) . "'
 )", __FUNCTION__, __LINE__);