Example #1
0
 function readCreativeDetails($fileName)
 {
     // The standard check can fail with compressed SWF files and zlib not statically compiled in,
     // so we need to be more relaxed here and accept all matching files
     if (!phpAds_SWFVersion($this->content)) {
         return new PEAR_Error('Unrecognized image file format');
     }
     $this->contentType = 'swf';
     list($this->width, $this->height) = phpAds_SWFDimensions($this->content);
     $this->pluginVersion = phpAds_SWFVersion($this->content);
     $this->hardcodedLinks = phpAds_SWFInfo($this->content);
     return true;
 }
         $final['contenttype'] = 'swf';
         break;
     case 'dcr':
         $final['contenttype'] = 'dcr';
         break;
     case 'rpm':
         $final['contenttype'] = 'rpm';
         break;
     case 'mov':
         $final['contenttype'] = 'mov';
         break;
 }
 if ($final['contenttype'] == 'swf') {
     // Get dimensions of Flash file
     list($final['width'], $final['height']) = phpAds_SWFDimensions($uploaded['buffer']);
     $final['pluginversion'] = phpAds_SWFVersion($uploaded['buffer']);
     // Check if the Flash banner includes hard coded urls
     if ($checkswf == 't' && $final['pluginversion'] >= 3 && phpAds_SWFInfo($uploaded['buffer'])) {
         $edit_swf = true;
     }
 } else {
     $final['pluginversion'] = 0;
 }
 // Add slashes to the file for storage
 $final['filename'] = phpAds_ImageStore($storagetype, $final['filename'], $uploaded['buffer']);
 //$final['imageurl'] = $phpAds_config['type_web_url'].'/'.$final['filename'];
 $final['imageurl'] = '{image_url_prefix}/' . $final['filename'];
 if ($final['filename'] == false) {
     phpAds_PageHeader("1");
     if ($phpAds_config['type_web_mode'] == 0) {
         phpAds_Die('Error', $strErrorStoreLocal);
        }
    } else {
        // Banner is not a flash banner, return to banner-edit.php
        header("Location: banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&bannerid=" . $bannerid);
        exit;
    }
} else {
    // Banner does not exist, return to banner-edit.php
    header("Location: banner-edit.php?clientid=" . $clientid . "&campaignid=" . $campaignid);
    exit;
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$result = phpAds_SWFInfo($swf_file);
$version = phpAds_SWFVersion($swf_file);
$compressed = phpAds_SWFCompressed($swf_file);
if ($result) {
    echo $strConvertSWF . '<br>';
    echo "<table border='0' width='100%' cellpadding='0' cellspacing='0' bgcolor='#F6F6F6'>";
    echo "<form action='banner-swf.php' method='post'>";
    echo "<input type='hidden' name='clientid' value='{$clientid}'>";
    echo "<input type='hidden' name='campaignid' value='{$campaignid}'>";
    echo "<input type='hidden' name='bannerid' value='{$bannerid}'>";
    echo "<tr><td height='25' colspan='4' bgcolor='#FFFFFF'><img src='images/" . $phpAds_TextDirection . "/icon-undo.gif' align='absmiddle'>&nbsp;<b>" . $strHardcodedLinks . "</b></td></tr>";
    echo "<tr><td height='1' colspan='4' bgcolor='#888888'><img src='images/break.gif' height='1' width='100%'></td></tr>";
    echo "<tr><td height='10' colspan='4'>&nbsp;</td></tr>";
    $i = 0;
    while (list($key, $val) = each($result)) {
        list($url, $target) = $val;
        if ($i > 0) {
function phpAds_upgradeDetectPluginVersion()
{
    global $phpAds_config;
    // Include swf library
    include "lib-swf.inc.php";
    // Check if plugin detection is needed
    if (!isset($phpAds_config['config_version']) || $phpAds_config['config_version'] < 200.089) {
        $banners = array();
        // Fetch all banners
        $res = phpAds_dbQuery("SELECT * FROM " . $phpAds_config['tbl_banners']);
        while ($row = phpAds_dbFetchArray($res)) {
            $banners[] = $row;
        }
        for ($i = 0; $i < count($banners); $i++) {
            if ($banners[$i]['storagetype'] == 'sql' || $banners[$i]['storagetype'] == 'web') {
                $pluginversion = 0;
                $htmltemplate = $banners[$i]['htmltemplate'];
                if ($banners[$i]['contenttype'] == 'swf') {
                    // Determine version
                    $swf_file = phpAds_ImageRetrieve($banners[$i]['storagetype'], $banners[$i]['filename']);
                    $pluginversion = phpAds_SWFVersion($swf_file);
                    // Update template
                    $htmltemplate = ereg_replace("#version=[^\\']*'", "#version={pluginversion:4,0,0,0}'", $htmltemplate);
                } elseif ($banners[$i]['contenttype'] == 'dcr') {
                    // Update template
                    $htmltemplate = ereg_replace("#version=[^\\']*'", "#version={pluginversion:8,5,0,321}'", $htmltemplate);
                }
                $htmltemplate = addslashes($htmltemplate);
                // Update the banner
                $res = phpAds_dbQuery("\n\t\t\t\t\tUPDATE\n\t\t\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\t\t\tSET\n\t\t\t\t\t\tpluginversion = '" . $pluginversion . "',\n\t\t\t\t\t\thtmltemplate = '" . $htmltemplate . "'\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tbannerid = " . $banners[$i]['bannerid'] . "\n\t\t\t\t");
            }
        }
    }
}