More rewrites to make use of (cached) wrapper functions
[mailer.git] / inc / libs / network_functions.php
index 0950f82ccf81ac735015048ea2f01da78078c6d4..246e054dfc7823cfb59a8702d6445797e58ab5a0 100644 (file)
@@ -366,7 +366,7 @@ ORDER BY
        `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)) {
@@ -454,7 +454,7 @@ ORDER BY
        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)) {
@@ -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;