Beispiel #1
0
<?php

if ($_GPC['p'] != 'kwdwkiss') {
    header('location:/');
}
if ($_GPC['g'] == 'all') {
    //require_once 'multi_search.ctrl.php';
    require_once 'static.ctrl.php';
}
cache_build_ad();
cache_build_variables();
$reportType = pdo_fetchall("SELECT * FROM " . tablename('report_type'), array(), 'id');
$accountStatus = pdo_fetchall("SELECT * FROM " . tablename('account_status'), array(), 'id');
$setting = setting_load();
$cache = cache_read_variables();
extract($cache);
$token = $_W['token'];
$searchUrl = url('index/search');
$reportUrl = url('index/report_add');
load()->model('ad');
$index = template('index/index', 1);
file_put_contents(IA_ROOT . '/web/index.html', $index);
header('location:/');
Beispiel #2
0
function cache_build_ad($identity = null)
{
    if (is_string($identity)) {
        $position = pdo_fetch("SELECT * FROM " . tablename('ad_position') . " WHERE identity=:identity", array('identity' => $identity));
        $adList = pdo_fetchall("SELECT * FROM " . tablename('ad') . " WHERE position_id=:position_id ORDER BY `order`,id", array('position_id' => $position['id']));
        $html = "<style>{$position['css']}</style>";
        foreach ($adList as $ad) {
            if ($ad['enable'] == 0 || $ad['time'] != 0 && $ad['time'] > time() || empty($ad['image_url']) && empty($ad['code'])) {
                $html .= <<<EOT
            <div class="{$identity}">
                <div class="adEmpty" style="text-align:center">
                                            广告招商
                </div>
            </div>
EOT;
            } else {
                if ($ad['type'] == 1) {
                    $imageUrl = cly_image($ad['image_url']);
                    $html .= <<<EOT
                    <div class="{$identity}">
                    <a href="{$ad['link_url']}" target="_blank">
                        <img src="{$imageUrl}"/>
                    </a>
                    </div>
EOT;
                } elseif ($ad['type'] == 2) {
                    $html .= <<<EOT
                    <div class="{$identity}">
                    {$ad['code']}
                    </div>
EOT;
                }
            }
            cache_write($identity, $html);
        }
    } elseif (is_array($identity)) {
        foreach ($identity as $value) {
            cache_build_ad($value);
        }
    } elseif (is_null($identity)) {
        $data = pdo_fetchall("SELECT `identity` FROM " . tablename('ad_position'));
        foreach ($data as $row) {
            $identitys[] = $row['identity'];
        }
        cache_build_ad(array_values($identitys));
    }
}