]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/forced_functions.php
Fixed sorting
[mailer.git] / inc / libs / forced_functions.php
index b7ee9a8d81e5a21f447aebc0572f8755948c0997..8309fc0002adbe9fb3c4f073723e9037e34d2ced 100644 (file)
@@ -121,16 +121,16 @@ function translateForcedCostsVisibility ($visibility) {
        return $return;
 }
 
-// "Getter" for an array of data from all Forced-PopUps except user's
+// "Getter" for an array of data from all forced-popups except user's own
 function getForcedPopupDataByEarningArray ($content) {
-       die('content=<pre>' . print_r($content, true) . '</pre>' . debug_get_printable_backtrace());
+       die(__FUNCTION__.':content=<pre>' . print_r($content, TRUE) . '</pre>' . debug_get_printable_backtrace());
 
        // Finally return the content
        return $content;
 }
 
 // Generator (somewhat getter) for forced-ads type options
-function generateForcedAdsTypeOptions ($type =  NULL) {
+function generateForcedAdsTypeOptions ($type = NULL) {
        // Is this cached?
        if (!isset($GLOBALS[__FUNCTION__][$type])) {
                // Generate output and cache it
@@ -154,7 +154,7 @@ function generateForcedAdsTypeOptions ($type =  NULL) {
 }
 
 // Generator (somewhat getter) for forcec-costs visibility options
-function generateForcedCostsVisibilityOptions ($visibility =  NULL) {
+function generateForcedCostsVisibilityOptions ($visibility = NULL) {
        // Is this cached?
        if (!isset($GLOBALS[__FUNCTION__][$visibility])) {
                // Generate output and cache it
@@ -321,24 +321,24 @@ function doForcedAdminActivateCampaigns () {
        // Do some sanity checks
        if (!isAdmin()) {
                // Not allowed to call
-               return false;
+               return FALSE;
        } elseif (countPostSelection('forced_campaign_id') == 0) {
                // No selections made
-               return false;
+               return FALSE;
        }
 
        // Get an array from all pending campaigns
        $forcedCampaigns = getArrayFromForcedCampaignsByArray(array_keys(postRequestElement('forced_campaign_id')), 'PENDING');
 
        // By default all worked (at this point)
-       $activated = true;
+       $activated = TRUE;
 
        // Run through all entries
        foreach ($forcedCampaigns as $campaignId => $campaignData) {
                // Change the status of this campaign
                if (!changeForcedCampaignStatus($campaignId, 'PENDING', 'ACTIVE', $campaignData)) {
                        // One didn't work, but continue with others
-                       $activated = false;
+                       $activated = FALSE;
                } // END - if
        } // END - foreach
 
@@ -353,7 +353,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data
        $newStatus = strtolower($newStatus);
 
        // Prepare array
-       $filterData =  array(
+       $filterData = array(
                'campaign_id' => $campaignId,
                'prev_status' => $prevStatus,
                'new_status'  => $newStatus,
@@ -383,7 +383,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data
        // ---------- Comment out for debugging/developing member actions! ---------
        if (SQL_AFFECTEDROWS() != 1) {
                // No, something went wrong
-               return false;
+               return FALSE;
        } // END - if
        // ---------- Comment out for debugging/developing member actions! ---------
 
@@ -395,7 +395,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data
 
        // All done!
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'campaignId=' . $campaignId . ',prevStatus=' . $prevStatus . ',newStatus=' . $newStatus . ' - EXIT!');
-       return true;
+       return TRUE;
 }
 
 // Notify admin(s) with a selected message and content
@@ -424,9 +424,9 @@ function doForcedNotifyAdmin ($messageType, $content) {
 // Notify the user about the performed action
 function doForcedNotifyMember ($messageType, $content) {
        // Skip notification if userid is NULL
-       if (is_null($content['forced_campaign_userid'])) {
+       if (!isValidId($content['forced_campaign_userid'])) {
                // NULL is silently ignored
-               return true;
+               return TRUE;
        } // END - if
 
        // Prepare template name
@@ -468,7 +468,7 @@ function prepareForcedContentForTemplate ($content) {
 // ----------------------------------------------------------------------------
 
 // Template helper function to create selection box for all forced-ad types
-function doTemplateForcedAdTypeSelectionBox ($templateName, $clear = false, $default = NULL) {
+function doTemplateForcedAdTypeSelectionBox ($templateName, $clear = FALSE, $default = NULL) {
        // Add all types through the filter
        $forcedAdTypes = runFilterChain('add_forced_ads_types', array());
 
@@ -480,7 +480,7 @@ function doTemplateForcedAdTypeSelectionBox ($templateName, $clear = false, $def
 }
 
 // Template helper function to create selection box for costs visibility
-function doTemplateForcedCostsVisiblitySelectionBox ($templateName, $clear = false, $default = NULL) {
+function doTemplateForcedCostsVisiblitySelectionBox ($templateName, $clear = FALSE, $default = NULL) {
        // Init array
        $costsVisibility = array(
                0 => array('visibility' => 'ALL'),
@@ -502,7 +502,7 @@ function doTemplateForcedAdSelectionBox ($templateName, $clear, $default = NULL)
        $forcedAds = getArrayFromForcedAdsByType();
 
        // Handle it over to generateSelectionBoxFromArray()
-       $content = generateSelectionBoxFromArray($forcedAds, 'forced_ads_id', 'forced_ads_id', '', '', '', $default, 'forced_ads_type');
+       $content = generateSelectionBoxFromArray($forcedAds, 'forced_ads_id', 'forced_ads_id', '', '', '', $default, 'forced_ads_type', FALSE, TRUE);
 
        // Return prepared content
        return $content;
@@ -514,7 +514,7 @@ function doTemplateForcedCostsSelectionBox ($templateName, $clear, $default = NU
        $forcedCosts = getArrayFromForcedCostsByVisibility();
 
        // Handle it over to generateSelectionBoxFromArray()
-       $content = generateSelectionBoxFromArray($forcedCosts, 'forced_costs_id', 'forced_costs_id', '', '', '', $default, '', true);
+       $content = generateSelectionBoxFromArray($forcedCosts, 'forced_costs_id', 'forced_costs_id', '', '', '', $default, '', TRUE, TRUE);
 
        // Return prepared content
        return $content;
@@ -523,7 +523,7 @@ function doTemplateForcedCostsSelectionBox ($templateName, $clear, $default = NU
 // Template helper function to create selection box for foreced campaign userid
 function doTemplateForcedCampaignUseridSelectionBox ($templateName, $clear, $default = NULL) {
        // Generate the selection box without all
-       $content = addMemberSelectionBox($default, false, true, true, 'forced_campaign_userid');
+       $content = addMemberSelectionBox($default, FALSE, TRUE, TRUE, 'forced_campaign_userid[]');
 
        // Return prepared content
        return $content;
@@ -537,7 +537,6 @@ function doTemplateForcedCampaignUseridSelectionBox ($templateName, $clear, $def
 function addXmlSpecialAdminAddDoForcedAds () {
        // So set it all here
        $GLOBALS['__COLUMN_INDEX']['doXmlCallbackFunction']  = 'column';
-       $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_values'] = array();
        $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_index'] = 'column';
 }
 
@@ -552,7 +551,6 @@ function addXmlSpecialAdminAddDoForcedCampaigns () {
 function addXmlSpecialAdminAddDoForcedCosts () {
        // So set it all here
        $GLOBALS['__COLUMN_INDEX']['doXmlCallbackFunction']  = 'column';
-       $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['extra_values'] = array();
        $GLOBALS['__XML_ARGUMENTS']['doXmlCallbackFunction']['column_index'] = 'column';
 }