示例#1
0
     // Setup busy indicator
     phpAds_PageHeader("1");
     echo "<br><br><img src='images/install-busy.gif' align='absmiddle'>&nbsp;";
     echo "<span class='install'>" . $strSystemRebuildingCache . "</span>";
     phpAds_PageFooter();
     // Update banner cache of all banners
     phpAds_upgradeHTMLCache();
     // Update compiled limitation of all banners
     phpAds_compileLimitation();
     // Rebuild cache
     if (!defined('LIBVIEWCACHE_INCLUDED')) {
         include phpAds_path . '/libraries/deliverycache/cache-' . $phpAds_config['delivery_caching'] . '.inc.php';
     }
     phpAds_cacheDelete();
     // Check if priority recalculation is needed
     list($banners, $priority_sum) = phpAds_dbFetchRow(phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tCOUNT(bannerid),\n\t\t\t\tSUM(priority)\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t"));
     if ($banners && !$priority_sum) {
         // Recalculate priority
         include "../libraries/lib-priority.inc.php";
         phpAds_PriorityCalculate();
     }
     // Send the output to the browser
     flush();
     // Go to the next step
     echo "<meta http-equiv='refresh' content='0;URL=upgrade.php?step=6'>";
     exit;
 } elseif ($step == 6) {
     // Update config_version and write settings
     phpAds_SettingsWriteAdd('config_version', $phpAds_version);
     phpAds_SettingsWriteAdd('language', $phpAds_config['language']);
     phpAds_ConfigFileUpdateFlush();
    $result2 = phpAds_dbQuery($query2);
    if (isset($GLOBALS['phpAds_CharSet']) && $GLOBALS['phpAds_CharSet'] != '') {
        $text = array('value1' => 'AdViews', 'value2' => 'AdClicks');
    } else {
        $text = array('value1' => $GLOBALS['strViews'], 'value2' => $GLOBALS['strClicks']);
    }
    $items = array();
    // preset array (not every hour may be occupied)
    for ($i = 0; $i <= 23; $i++) {
        $items[$i] = array();
        $items[$i]['value1'] = 0;
        $items[$i]['value2'] = 0;
        $items[$i]['text'] = '';
    }
    while ($row = phpAds_dbFetchRow($result)) {
        $i = $row[1];
        $items[$i]['value1'] = $row[0];
        $items[$i]['text'] = sprintf("%d", $i);
    }
    while ($row2 = phpAds_dbFetchRow($result2)) {
        $i = $row2[1];
        $items[$i]['value2'] = $row2[0];
        $items[$i]['text'] = sprintf("%d", $i);
    }
    $width = 385;
    // absolute definition due to width/height declaration in stats.inc.php
    $height = 150;
    // adapt this if embedding html-document will change
    // Build the graph
    include "lib-graph.inc.php";
}
function phpAds_checkTableType($type)
{
    // Assume MySQL always supports MyISAM table types
    if ($type == 'MYISAM') {
        return true;
    } else {
        $res = phpAds_dbQuery("SHOW VARIABLES");
        while ($row = phpAds_dbFetchRow($res)) {
            if ($type == 'BDB' && $row[0] == 'have_bdb' && $row[1] == 'YES') {
                return true;
            }
            if ($type == 'GEMINI' && $row[0] == 'have_gemini' && $row[1] == 'YES') {
                return true;
            }
            if ($type == 'INNODB' && $row[0] == 'have_innodb' && $row[1] == 'YES') {
                return true;
            }
        }
    }
    return false;
}