X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fforced_functions.php;h=73c271bc560d608505f50a0343d50e7c2f4c26f3;hb=ab5ff5126ef56b08f5130a9e110b53c00d0a2761;hp=21a7327a31b94b939ccf91502d38b03e34b9a30b;hpb=e88e30c24737cf641f2e93f6a311e641ccbf5960;p=mailer.git diff --git a/inc/libs/forced_functions.php b/inc/libs/forced_functions.php index 21a7327a31..73c271bc56 100644 --- a/inc/libs/forced_functions.php +++ b/inc/libs/forced_functions.php @@ -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 * @@ -130,7 +130,7 @@ function getForcedPopupDataByEarningArray ($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,12 +353,12 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data $newStatus = strtolower($newStatus); // Prepare array - $filterData = array( + $filterData = array( 'campaign_id' => $campaignId, 'prev_status' => $prevStatus, 'new_status' => $newStatus, 'data' => $data, - 'abort' => NULL + 'abort' => NULL, ); // Run pre filter chain @@ -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 @@ -401,12 +401,16 @@ function changeForcedCampaignStatus ($campaignId, $prevStatus, $newStatus, $data // Notify admin(s) with a selected message and content function doForcedNotifyAdmin ($messageType, $content) { // Prepare template name - $templateName = sprintf("admin_forced_%s", $messageType); + $templateName = sprintf('admin_forced_%s', $messageType); + + // Is the user id valid? + if (!isValidId($content['forced_campaign_userid'])) { + // No, then use admin-only template + $templateName = sprintf('admin_only_forced_%s', $messageType); + } // END - if // Prepare subject - $subject = sprintf("{--ADMIN_FORCED_NOTIFY_%s_SUBJECT--}", - strtoupper($messageType) - ); + $subject = sprintf('{--ADMIN_FORCED_NOTIFY_%s_SUBJECT--}', strtoupper($messageType)); // Is the subject line there? if ((substr($subject, 0, 1) == '!') && (substr($subject, -1, 1) == '!')) { @@ -424,18 +428,16 @@ 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 // Prepare template name - $templateName = sprintf("member_forced_%s", $messageType); + $templateName = sprintf('member_forced_%s', $messageType); // Prepare subject - $subject = sprintf("{--MEMBER_FORCED_NOTIFY_%s_SUBJECT--}", - strtoupper($messageType) - ); + $subject = sprintf('{--MEMBER_FORCED_NOTIFY_%s_SUBJECT--}', strtoupper($messageType)); // Is the subject line there? if ((substr($subject, 0, 1) == '!') && (substr($subject, -1, 1) == '!')) {