本文整理汇总了PHP中OA_Dal_Delivery_numRows函数的典型用法代码示例。如果您正苦于以下问题:PHP OA_Dal_Delivery_numRows函数的具体用法?PHP OA_Dal_Delivery_numRows怎么用?PHP OA_Dal_Delivery_numRows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OA_Dal_Delivery_numRows函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OA_Dal_Delivery_getZoneInfo
/**
* This function gets zone properties from the databse
*
* @param int $zoneid The ID of the zone to get information about
* @return array|false An array containing the properties for that zone
* or false on failure
*/
function OA_Dal_Delivery_getZoneInfo($zoneid)
{
$aConf = $GLOBALS['_MAX']['CONF'];
// Sanitise parameteres
$zoneid = (int) $zoneid;
// Get the zone information
$query = "\n SELECT\n z.zoneid AS zone_id,\n z.zonename AS name,\n z.delivery AS type,\n z.description AS description,\n z.width AS width,\n z.height AS height,\n z.chain AS chain,\n z.prepend AS prepend,\n z.append AS append,\n z.appendtype AS appendtype,\n z.forceappend AS forceappend,\n z.inventory_forecast_type AS inventory_forecast_type,\n z.block AS block_zone,\n z.capping AS cap_zone,\n z.session_capping AS session_cap_zone,\n z.show_capped_no_cookie AS show_capped_no_cookie_zone,\n z.ext_adselection AS ext_adselection,\n z.affiliateid AS publisher_id,\n a.agencyid AS agency_id,\n a.account_id AS trafficker_account_id,\n m.account_id AS manager_account_id\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['zones']) . " AS z,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['affiliates']) . " AS a,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['agency']) . " AS m\n WHERE\n z.zoneid = {$zoneid}\n AND\n z.affiliateid = a.affiliateid\n AND\n a.agencyid = m.agencyid";
$rZoneInfo = OA_Dal_Delivery_query($query);
if (!is_resource($rZoneInfo)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false;
}
$aZoneInfo = OA_Dal_Delivery_fetchAssoc($rZoneInfo);
if (empty($aZoneInfo)) {
// The zone does not exist!
return false;
}
// Set the default banner preference information for the zone
$query = "\n SELECT\n p.preference_id AS preference_id,\n p.preference_name AS preference_name\n FROM\n {$aConf['table']['prefix']}{$aConf['table']['preferences']} AS p\n WHERE\n p.preference_name = 'default_banner_image_url'\n OR\n p.preference_name = 'default_banner_destination_url'";
$rPreferenceInfo = OA_Dal_Delivery_query($query);
if (!is_resource($rPreferenceInfo)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false;
}
if (OA_Dal_Delivery_numRows($rPreferenceInfo) != 2) {
// Something went wrong, there should be two preferences, if not,
// cannot get the default banner image and destination URLs
return $aZoneInfo;
}
// Set the IDs of the two preferences for default banner image and
// destination URLs
$aPreferenceInfo = OA_Dal_Delivery_fetchAssoc($rPreferenceInfo);
$variableName = $aPreferenceInfo['preference_name'] . '_id';
${$variableName} = $aPreferenceInfo['preference_id'];
$aPreferenceInfo = OA_Dal_Delivery_fetchAssoc($rPreferenceInfo);
$variableName = $aPreferenceInfo['preference_name'] . '_id';
${$variableName} = $aPreferenceInfo['preference_id'];
// Search for possible default banner preference information for the zone
$query = "\n SELECT\n 'default_banner_destination_url_trafficker' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['trafficker_account_id']}\n AND\n apa.preference_id = {$default_banner_destination_url_id}\n UNION\n SELECT\n 'default_banner_destination_url_manager' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['manager_account_id']}\n AND\n apa.preference_id = {$default_banner_destination_url_id}\n UNION\n SELECT\n 'default_banner_image_url_trafficker' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['trafficker_account_id']}\n AND\n apa.preference_id = {$default_banner_image_url_id}\n UNION\n SELECT\n 'default_banner_image_url_manager' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['manager_account_id']}\n AND\n apa.preference_id = {$default_banner_image_url_id}\n UNION\n SELECT\n 'default_banner_image_url_admin' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['accounts']) . " AS a\n WHERE\n apa.account_id = a.account_id\n AND\n a.account_type = 'ADMIN'\n AND\n apa.preference_id = {$default_banner_image_url_id}\n UNION\n SELECT\n 'default_banner_destination_url_admin' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['accounts']) . " AS a\n WHERE\n apa.account_id = a.account_id\n AND\n a.account_type = 'ADMIN'\n AND\n apa.preference_id = {$default_banner_destination_url_id}";
$rDefaultBannerInfo = OA_Dal_Delivery_query($query);
if (!is_resource($rDefaultBannerInfo)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false;
}
if (OA_Dal_Delivery_numRows($rDefaultBannerInfo) == 0) {
// Set global default image if no preferences sets
if ($aConf['defaultBanner']['imageUrl'] != '') {
$aZoneInfo['default_banner_image_url'] = $aConf['defaultBanner']['imageUrl'];
}
// No default banner image or destination URLs to deal with
return $aZoneInfo;
}
// Deal with the default banner image or destination URLs found
$aDefaultImageURLs = array();
$aDefaultDestinationURLs = array();
while ($aRow = OA_Dal_Delivery_fetchAssoc($rDefaultBannerInfo)) {
if (stristr($aRow['item'], 'default_banner_image_url')) {
$aDefaultImageURLs[$aRow['item']] = $aRow['value'];
} else {
if (stristr($aRow['item'], 'default_banner_destination_url')) {
$aDefaultDestinationURLs[$aRow['item']] = $aRow['value'];
}
}
}
// The three possible preference types, in reverse order of preference (i.e.
// use admin only if no manger, only if no trafficer
$aTypes = array(0 => 'admin', 1 => 'manager', 2 => 'trafficker');
// Iterate over the found default values, setting the admin value(s) (if found)
// first, then overriding with the manager value(s), then the trafficer value(s),
// again, if found
foreach ($aTypes as $type) {
if (isset($aDefaultImageURLs['default_banner_image_url_' . $type])) {
$aZoneInfo['default_banner_image_url'] = $aDefaultImageURLs['default_banner_image_url_' . $type];
}
if (isset($aDefaultDestinationURLs['default_banner_destination_url_' . $type])) {
$aZoneInfo['default_banner_destination_url'] = $aDefaultDestinationURLs['default_banner_destination_url_' . $type];
}
}
// Last try, see if there is a system-wide default banner defined
// if (empty($aZoneInfo['default_banner_image_url']) && !empty($aConf['defaultBanner']['imageUrl'])) {
// $aZoneInfo['default_banner_image_url'] = $aConf['defaultBanner']['imageUrl'];
// }
// Done, at last!
return $aZoneInfo;
}
示例2: OA_Dal_Delivery_getZoneInfo
function OA_Dal_Delivery_getZoneInfo($zoneid)
{
$aConf = $GLOBALS['_MAX']['CONF'];
$zoneid = (int) $zoneid;
$query = "\n SELECT\n z.zoneid AS zone_id,\n z.zonename AS name,\n z.delivery AS type,\n z.description AS description,\n z.width AS width,\n z.height AS height,\n z.chain AS chain,\n z.prepend AS prepend,\n z.append AS append,\n z.appendtype AS appendtype,\n z.forceappend AS forceappend,\n z.inventory_forecast_type AS inventory_forecast_type,\n z.block AS block_zone,\n z.capping AS cap_zone,\n z.session_capping AS session_cap_zone,\n z.show_capped_no_cookie AS show_capped_no_cookie_zone,\n z.ext_adselection AS ext_adselection,\n z.affiliateid AS publisher_id,\n a.agencyid AS agency_id,\n a.account_id AS trafficker_account_id,\n m.account_id AS manager_account_id\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['zones']) . " AS z,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['affiliates']) . " AS a,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['agency']) . " AS m\n WHERE\n z.zoneid = {$zoneid}\n AND\n z.affiliateid = a.affiliateid\n AND\n a.agencyid = m.agencyid";
$rZoneInfo = OA_Dal_Delivery_query($query);
if (!is_resource($rZoneInfo)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false;
}
$aZoneInfo = OA_Dal_Delivery_fetchAssoc($rZoneInfo);
if (empty($aZoneInfo)) {
return false;
}
$query = "\n SELECT\n p.preference_id AS preference_id,\n p.preference_name AS preference_name\n FROM\n {$aConf['table']['prefix']}{$aConf['table']['preferences']} AS p\n WHERE\n p.preference_name = 'default_banner_image_url'\n OR\n p.preference_name = 'default_banner_destination_url'";
$rPreferenceInfo = OA_Dal_Delivery_query($query);
if (!is_resource($rPreferenceInfo)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false;
}
if (OA_Dal_Delivery_numRows($rPreferenceInfo) != 2) {
return $aZoneInfo;
}
$aPreferenceInfo = OA_Dal_Delivery_fetchAssoc($rPreferenceInfo);
$variableName = $aPreferenceInfo['preference_name'] . '_id';
${$variableName} = $aPreferenceInfo['preference_id'];
$aPreferenceInfo = OA_Dal_Delivery_fetchAssoc($rPreferenceInfo);
$variableName = $aPreferenceInfo['preference_name'] . '_id';
${$variableName} = $aPreferenceInfo['preference_id'];
$query = "\n SELECT\n 'default_banner_destination_url_trafficker' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['trafficker_account_id']}\n AND\n apa.preference_id = {$default_banner_destination_url_id}\n UNION\n SELECT\n 'default_banner_destination_url_manager' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['manager_account_id']}\n AND\n apa.preference_id = {$default_banner_destination_url_id}\n UNION\n SELECT\n 'default_banner_image_url_trafficker' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['trafficker_account_id']}\n AND\n apa.preference_id = {$default_banner_image_url_id}\n UNION\n SELECT\n 'default_banner_image_url_manager' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa\n WHERE\n apa.account_id = {$aZoneInfo['manager_account_id']}\n AND\n apa.preference_id = {$default_banner_image_url_id}\n UNION\n SELECT\n 'default_banner_image_url_admin' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['accounts']) . " AS a\n WHERE\n apa.account_id = a.account_id\n AND\n a.account_type = 'ADMIN'\n AND\n apa.preference_id = {$default_banner_image_url_id}\n UNION\n SELECT\n 'default_banner_destination_url_admin' AS item,\n apa.value AS value\n FROM\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['account_preference_assoc']) . " AS apa,\n " . OX_escapeIdentifier($aConf['table']['prefix'] . $aConf['table']['accounts']) . " AS a\n WHERE\n apa.account_id = a.account_id\n AND\n a.account_type = 'ADMIN'\n AND\n apa.preference_id = {$default_banner_destination_url_id}";
$rDefaultBannerInfo = OA_Dal_Delivery_query($query);
if (!is_resource($rDefaultBannerInfo)) {
return defined('OA_DELIVERY_CACHE_FUNCTION_ERROR') ? OA_DELIVERY_CACHE_FUNCTION_ERROR : false;
}
if (OA_Dal_Delivery_numRows($rDefaultBannerInfo) == 0) {
if ($aConf['defaultBanner']['imageUrl'] != '') {
$aZoneInfo['default_banner_image_url'] = $aConf['defaultBanner']['imageUrl'];
}
return $aZoneInfo;
}
$aDefaultImageURLs = array();
$aDefaultDestinationURLs = array();
while ($aRow = OA_Dal_Delivery_fetchAssoc($rDefaultBannerInfo)) {
if (stristr($aRow['item'], 'default_banner_image_url')) {
$aDefaultImageURLs[$aRow['item']] = $aRow['value'];
} else {
if (stristr($aRow['item'], 'default_banner_destination_url')) {
$aDefaultDestinationURLs[$aRow['item']] = $aRow['value'];
}
}
}
$aTypes = array(0 => 'admin', 1 => 'manager', 2 => 'trafficker');
foreach ($aTypes as $type) {
if (isset($aDefaultImageURLs['default_banner_image_url_' . $type])) {
$aZoneInfo['default_banner_image_url'] = $aDefaultImageURLs['default_banner_image_url_' . $type];
}
if (isset($aDefaultDestinationURLs['default_banner_destination_url_' . $type])) {
$aZoneInfo['default_banner_destination_url'] = $aDefaultDestinationURLs['default_banner_destination_url_' . $type];
}
}
return $aZoneInfo;
}