if (isset($action) && $action == 'toggle') { // Update zonetype $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie(); if ($row = phpAds_dbFetchArray($result)) { if ($row['zonetype'] != $zonetype) { $res = phpAds_dbQuery("\n\t\t\t\t\tUPDATE\n\t\t\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\t\t\tSET\n\t\t\t\t\t\tzonetype = " . $zonetype . ",\n\t\t\t\t\t\twhat = ''\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t\t\t") or phpAds_sqlDie(); } } if ($zonetype == phpAds_ZoneBanners) { if (isset($bannerid) && $bannerid != '') { phpAds_ToggleBannerInZone($bannerid, $zoneid); } } if ($zonetype == phpAds_ZoneCampaign) { if (isset($campaignid) && $campaignid != '') { phpAds_ToggleCampaignInZone($campaignid, $zoneid); } } header("Location: zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&clientid=" . $clientid . "&campaignid=" . $campaignid); exit; } if (isset($action) && $action == 'set') { if (!isset($what)) { $what = ''; } if ($zonetype == phpAds_ZoneBanners) { if (isset($bannerid) && is_array($bannerid)) { for ($i = 0; $i < sizeof($bannerid); $i++) { $bannerid[$i] = 'bannerid:' . $bannerid[$i]; } $what .= implode(',', $bannerid);
} } elseif (phpAds_isUser(phpAds_Agency)) { $agencyid = phpAds_getUserID(); } /*********************************************************/ /* Process submitted form */ /*********************************************************/ if (isset($submit)) { $previouszone = array(); $res = phpAds_dbQuery("SELECT" . " z.zoneid AS zoneid" . ",z.what AS what" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE z.affiliateid=a.affiliateid" . " AND z.zonetype=" . phpAds_ZoneCampaign . " AND a.agencyid=" . $agencyid) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { $previouszone[$row['zoneid']] = phpAds_IsCampaignInZone($campaignid, $row['zoneid'], $row['what']); } for (reset($previouszone); $key = key($previouszone); next($previouszone)) { if ($previouszone[$key] == true && (!isset($includezone[$key]) || $includezone[$key] != 't') || $previouszone[$key] != true && (isset($includezone[$key]) && $includezone[$key] == 't')) { phpAds_ToggleCampaignInZone($campaignid, $key); } } Header("Location: campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $campaignid); exit; } /*********************************************************/ /* Get preferences */ /*********************************************************/ if (!isset($listorder)) { if (isset($Session['prefs']['campaign-zone.php']['listorder'])) { $listorder = $Session['prefs']['campaign-zone.php']['listorder']; } else { $listorder = ''; } }