]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/forced_functions.php
Renamed all SQL-related functions to camel-case notation
[mailer.git] / inc / libs / forced_functions.php
index e596264e3cb0aa44c7cf537c3504d5a2d53d197c..1705959c9353480cd4ec253f261aa63ca961bd2c 100644 (file)
@@ -16,7 +16,7 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -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
@@ -189,11 +189,11 @@ function getArrayFromForcedAdsByType ($forcedType = NULL) {
        // Is forced type not NULL?
        if (!is_null($forcedType)) {
                // Then set proper WHERE
-               $where = sprintf("WHERE `forced_ads_type`='%s'", SQL_ESCAPE($forcedType));
+               $where = sprintf("WHERE `forced_ads_type`='%s'", sqlEscapeString($forcedType));
        } // END - if
 
        // Search all given types
-       $result = SQL_QUERY('SELECT
+       $result = sqlQuery('SELECT
        `forced_ads_id`,
        `forced_ads_ad_url`,
        `forced_ads_click_url`,
@@ -213,16 +213,16 @@ ORDER BY
        `forced_ads_id` ASC', __FUNCTION__, __LINE__);
 
        // Is there at least one entry?
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNums($result)) {
                // Get all elements
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Add it
                        $forcedAds[$content['forced_ads_id']] = $content;
                } // END - while
        } // END - if
 
        // Free result
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Return it
        return $forcedAds;
@@ -237,11 +237,11 @@ function getArrayFromForcedCostsByVisibility ($visibility = NULL) {
        // Is visibility not NULL?
        if (!is_null($visibility)) {
                // Then add WHERE statement
-               $where = sprintf(" WHERE `forced_costs_visibility`='%s'", SQL_ESCAPE($visibility));
+               $where = sprintf(" WHERE `forced_costs_visibility`='%s'", sqlEscapeString($visibility));
        } // END - if
 
        // Search all given types
-       $result = SQL_QUERY("SELECT
+       $result = sqlQuery("SELECT
        `forced_costs_id`,
        `forced_costs_price_click`,
        `forced_costs_payment_click`,
@@ -253,16 +253,16 @@ ORDER BY
        `forced_costs_id` ASC", __FUNCTION__, __LINE__);
 
        // Is there at least one entry?
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNums($result)) {
                // Get all elements
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Add it
                        $forcedCosts[$content['forced_costs_id']] = $content;
                } // END - while
        } // END - if
 
        // Free result
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Return it
        return $forcedCosts;
@@ -274,7 +274,7 @@ function getArrayFromForcedCampaignsByArray ($ids, $status) {
        $forcedCampaigns = array();
 
        // Search all given types
-       $result = SQL_QUERY_ESC("SELECT
+       $result = sqlQueryEscaped("SELECT
        `forced_campaign_id`,
        UNIX_TIMESTAMP(`forced_campaign_created`) AS `forced_campaign_created`,
        `forced_campaign_status`,
@@ -301,16 +301,16 @@ ORDER BY
                ), __FUNCTION__, __LINE__);
 
        // Is there at least one entry?
-       if (!SQL_HASZERONUMS($result)) {
+       if (!ifSqlHasZeroNums($result)) {
                // Get all elements
-               while ($content = SQL_FETCHARRAY($result)) {
+               while ($content = sqlFetchArray($result)) {
                        // Add it
                        $forcedCampaigns[$content['forced_campaign_id']] = $content;
                } // END - while
        } // END - if
 
        // Free result
-       SQL_FREERESULT($result);
+       sqlFreeResult($result);
 
        // Return it
        return $forcedCampaigns;
@@ -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,
@@ -372,7 +372,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data
 
        // Update the status now
        // ---------- Comment out for debugging/developing member actions! ---------
-       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_forced_campaigns` SET `forced_campaign_status`='%s' WHERE `forced_campaign_id`=%s LIMIT 1",
+       sqlQueryEscaped("UPDATE `{?_MYSQL_PREFIX?}_forced_campaigns` SET `forced_campaign_status`='%s' WHERE `forced_campaign_id`=%s LIMIT 1",
                array(
                        $newStatus,
                        bigintval($campaignId)
@@ -381,7 +381,7 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data
 
        // Was that fine?
        // ---------- Comment out for debugging/developing member actions! ---------
-       if (SQL_AFFECTEDROWS() != 1) {
+       if (sqlAffectedRows() != 1) {
                // No, something went wrong
                return FALSE;
        } // END - if
@@ -424,7 +424,7 @@ 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;
        } // END - if
@@ -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';
 }