예제 #1
0
function phpAds_DeleteBanner($bannerid)
{
    global $phpAds_config;
    // Cleanup webserver stored image
    $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tstoragetype, filename\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t") or phpAds_sqlDie();
    if ($row = phpAds_dbFetchArray($res)) {
        if (($row['storagetype'] == 'web' || $row['storagetype'] == 'sql') && $row['filename'] != '') {
            phpAds_ImageDelete($row['storagetype'], $row['filename']);
        }
    }
    // Delete banner
    $res = phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t\t") or phpAds_sqlDie();
    // Delete banner ACLs
    $res = phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_acls'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t\t") or phpAds_sqlDie();
    // Delete statistics for this banner
    phpAds_deleteStatsByBannerID($bannerid);
}
function phpAds_DeleteCampaign($campaignid)
{
    global $phpAds_config;
    // Delete Campaign
    $res = phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tclientid = '{$campaignid}'\n\t") or phpAds_sqlDie();
    // Loop through each banner
    $res_banners = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tbannerid,\n\t\t\tstoragetype,\n\t\t\tfilename\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tclientid = '{$campaignid}'\n\t") or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res_banners)) {
        // Cleanup stored images for each banner
        if (($row['storagetype'] == 'web' || $row['storagetype'] == 'sql') && $row['filename'] != '') {
            phpAds_ImageDelete($row['storagetype'], $row['filename']);
        }
        // Delete Banner ACLs
        phpAds_dbQuery("\n\t\t\tDELETE FROM\n\t\t\t\t" . $phpAds_config['tbl_acls'] . "\n\t\t\tWHERE\n\t\t\t\tbannerid = " . $row['bannerid'] . "\n\t\t") or phpAds_sqlDie();
        // Delete stats for each banner
        phpAds_deleteStats($row['bannerid']);
    }
    // Delete Banners
    phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tclientid = '{$campaignid}'\n\t") or phpAds_sqlDie();
}
// Require the initialisation file
require_once '../../init.php';
// Required files
require_once MAX_PATH . '/lib/OA/Dal.php';
require_once MAX_PATH . '/www/admin/config.php';
require_once MAX_PATH . '/www/admin/lib-banner.inc.php';
require_once MAX_PATH . '/www/admin/lib-storage.inc.php';
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN);
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
$doBanners = OA_Dal::factoryDO('banners');
$doBanners->storagetype = 'sql';
$doBanners->find();
while ($doBanners->fetch()) {
    // Get the filename
    $filename = $doBanners->filename;
    // Copy the file
    $buffer = phpAds_ImageRetrieve('sql', $filename);
    $doBanners->filename = phpAds_ImageStore('web', $filename, $buffer);
    // TODO: Would be nice if we gave some indication to the user of success or failure!
    if ($doBanners->filename != false) {
        phpAds_ImageDelete('sql', $filename);
        $doBannersClone = clone $doBanners;
        $doBannersClone->imageurl = '';
        $doBannersClone->storagetype = 'web';
        $doBannersClone->update();
    }
}
Header("Location: maintenance-storage.php");
예제 #4
0
 /**
  * A method to delete the banner file.
  *
  * @param string $storageType The storage type of the banner to delete
  * @param string $fileName    The name of the banner file to be deleted
  */
 function deleteBannerFile($storageType, $fileName)
 {
     if ($storageType == 'web') {
         $doBanner = OA_Dal::factoryDO('banners');
         $doBanner->filename = $fileName;
         $doBanner->find();
         // If there is only a banner using the same file delete the file
         if ($doBanner->getRowCount() == 1) {
             phpAds_ImageDelete($storageType, $fileName);
         }
     } else {
         phpAds_ImageDelete($storageType, $fileName);
     }
 }
예제 #5
0
     						$final['pluginversion'] >= 3 &&
     						phpAds_SWFInfo($uploaded['buffer']))
     					{
     						$edit_swf = true;
     					}
     				}
     				else
     					$final['pluginversion'] = 0;
     */
     // Store the file
     $final['alt_filename'] = phpAds_ImageStore($storagetype, $final['alt_filename'], $uploadedalt['buffer']);
     //$final['alt_imageurl'] = $phpAds_config['type_web_url'].'/'.$final['filename'];
     $final['alt_imageurl'] = '{image_url_prefix}/' . $final['alt_filename'];
     // Cleanup existing image, if it exists
     if (isset($current['alt_filename']) && $current['alt_filename'] != '' && $current['alt_filename'] != $final['alt_filename']) {
         phpAds_ImageDelete($current['storagetype'], $current['alt_filename']);
     }
 }
 if (!isset($bannerid) || $bannerid == '0' || $bannerid == '') {
     // New banner set html template
     $final['htmltemplate'] = phpAds_getBannerTemplate($final['contenttype']);
 } elseif ($final['contenttype'] != $current['contenttype']) {
     // Check if the contenttype has changed, if true change html template
     $final['htmltemplate'] = phpAds_getBannerTemplate($final['contenttype']);
 } else {
     // Use existing html template
     $final['htmltemplate'] = stripslashes($current['htmltemplate']);
 }
 // Set remaining properties
 $final['alt'] = phpAds_htmlQuotes($alt);
 $final['status'] = $status;
/* Main code                                             */
/*********************************************************/
if (isset($clientid) && $clientid != '') {
    // Delete Client
    $res = phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tclientid = '{$clientid}'\n\t\t") or phpAds_sqlDie();
    // Loop thourgh each campaign
    $res_campaign = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tclientid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tparent = {$clientid}\n\t\t") or phpAds_sqlDie();
    while ($row_campaign = phpAds_dbFetchArray($res_campaign)) {
        // Delete Campaign
        $res = phpAds_dbQuery("\n\t\t\tDELETE FROM\n\t\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\t\tWHERE\n\t\t\t\tclientid = " . $row_campaign['clientid'] . "\n\t\t\t") or phpAds_sqlDie();
        // Loop through each banner
        $res_banners = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tbannerid,\n\t\t\t\tstoragetype,\n\t\t\t\tfilename\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\tWHERE\n\t\t\t\tclientid = " . $row_campaign['clientid'] . "\n\t\t\t") or phpAds_sqlDie();
        while ($row = phpAds_dbFetchArray($res_banners)) {
            // Cleanup stored images for each banner
            if (($row['storagetype'] == 'web' || $row['storagetype'] == 'sql') && $row['filename'] != '') {
                phpAds_ImageDelete($row['storagetype'], $row['filename']);
            }
            // Delete Banner ACLs
            phpAds_dbQuery("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t" . $phpAds_config['tbl_acls'] . "\n\t\t\t\tWHERE\n\t\t\t\t\tbannerid = " . $row['bannerid'] . "\n\t\t\t\t") or phpAds_sqlDie();
            // Delete stats for each banner
            phpAds_deleteStats($row['bannerid']);
        }
        // Delete Banners
        phpAds_dbQuery("\n\t\t\tDELETE FROM\n\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\tWHERE\n\t\t\t\tclientid = " . $row_campaign['clientid'] . "\n\t\t\t") or phpAds_sqlDie();
    }
}
// Rebuild priorities
phpAds_PriorityCalculate();
// Rebuild cache
if (!defined('LIBVIEWCACHE_INCLUDED')) {
    include phpAds_path . '/libraries/deliverycache/cache-' . $phpAds_config['delivery_caching'] . '.inc.php';
if (isset($clientid) && $clientid != '') {
    // Loop through each campaign
    $res_campaign = phpAds_dbQuery("SELECT campaignid" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid) or phpAds_sqlDie();
    while ($row_campaign = phpAds_dbFetchArray($res_campaign)) {
        $campaignid = $row_campaign['campaignid'];
        // Delete Campaign/Tracker links
        $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie();
        // Delete Conversions Logged to this Campaign
        $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_conversionlog'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie();
        // Loop through each banner
        $res_banners = phpAds_dbQuery("SELECT" . " bannerid" . ",storagetype" . ",filename" . " FROM " . $phpAds_config['tbl_banners'] . " WHERE campaignid=" . $row_campaign['campaignid'] . "\n\t\t\t") or phpAds_sqlDie();
        while ($row_banners = phpAds_dbFetchArray($res_banners)) {
            $bannerid = $row_banners['bannerid'];
            // Cleanup stored images for each banner
            if (($row_banners['storagetype'] == 'web' || $row_banners['storagetype'] == 'sql') && $row_banners['filename'] != '') {
                phpAds_ImageDelete($row_banners['storagetype'], $row_banners['filename']);
            }
            // Delete Banner ACLs
            phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_acls'] . " WHERE bannerid=" . $bannerid) or phpAds_sqlDie();
            // Delete stats for each banner
            phpAds_deleteStatsByBannerID($bannerid);
        }
        // Delete Banners
        phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_banners'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie();
    }
    // Loop through each tracker
    $res_tracker = phpAds_dbQuery("SELECT trackerid" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE clientid=" . $clientid) or phpAds_sqlDie();
    while ($row_tracker = phpAds_dbFetchArray($res_tracker)) {
        $trackerid = $row_tracker['trackerid'];
        // Delete Campaign/Tracker links
        $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();