Esempio n. 1
0
function ReNewsHtml($start, $classid, $from, $retype, $startday, $endday, $startid, $endid, $tbname, $havehtml)
{
    global $empire, $public_r, $class_r, $fun_r, $dbtbpre, $etable_r;
    $tbname = RepPostVar($tbname);
    if (empty($tbname)) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    $start = (int) $start;
    //按ID
    if ($retype) {
        $startid = (int) $startid;
        $endid = (int) $endid;
        $add1 = $endid ? ' and id>=' . $startid . ' and id<=' . $endid : '';
    } else {
        $startday = RepPostVar($startday);
        $endday = RepPostVar($endday);
        $add1 = $startday && $endday ? ' and truetime>=' . to_time($startday . ' 00:00:00') . ' and truetime<=' . to_time($endday . ' 23:59:59') : '';
    }
    //按栏目
    $classid = (int) $classid;
    if ($classid) {
        $where = empty($class_r[$classid][islast]) ? ReturnClass($class_r[$classid][sonclass]) : "classid='{$classid}'";
        $add1 .= ' and ' . $where;
    }
    //不生成
    $add1 .= ReturnNreInfoWhere();
    //是否重复生成
    if ($havehtml != 1) {
        $add1 .= ' and havehtml=0';
    }
    //优化
    $yhadd = '';
    $yhid = $etable_r[$tbname][yhid];
    $yhvar = 'rehtml';
    if ($yhid) {
        $yhadd = ReturnYhSql($yhid, $yhvar);
    }
    $b = 0;
    $sql = $empire->query("select * from {$dbtbpre}ecms_" . $tbname . " where " . $yhadd . "id>{$start}" . $add1 . " and checked=1 order by id limit " . $public_r[renewsnum]);
    while ($r = $empire->fetch($sql)) {
        if (!empty($r['titleurl']) || $class_r[$r[classid]][showdt] == 2) {
            continue;
        }
        $b = 1;
        GetHtml($r, '', 1);
        //生成信息文件
        $new_start = $r[id];
    }
    if (empty($b)) {
        echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><center><b>" . $tbname . $fun_r[ReTableIsOK] . "!</b></center>";
        db_close();
        $empire = null;
        exit;
    }
    echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><meta http-equiv=\"refresh\" content=\"" . $public_r['realltime'] . ";url=ecmschtml.php?enews=ReNewsHtml&tbname={$tbname}&classid={$classid}&start={$new_start}&from={$from}&retype={$retype}&startday={$startday}&endday={$endday}&startid={$startid}&endid={$endid}&havehtml={$havehtml}&reallinfotime=" . $_GET['reallinfotime'] . "\">" . $fun_r[OneReNewsHtmlSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)";
    exit;
}
Esempio n. 2
0
function ReNewsHtml($start, $classid, $from, $retype, $startday, $endday, $startid, $endid, $tbname, $havehtml)
{
    global $empire, $public_r, $class_r, $fun_r, $dbtbpre, $etable_r;
    $tbname = RepPostVar($tbname);
    if (empty($tbname) || !eCheckTbname($tbname)) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    $start = (int) $start;
    //按ID
    if ($retype) {
        $startid = (int) $startid;
        $endid = (int) $endid;
        $add1 = $endid ? ' and id>=' . $startid . ' and id<=' . $endid : '';
    } else {
        $startday = RepPostVar($startday);
        $endday = RepPostVar($endday);
        $add1 = $startday && $endday ? ' and truetime>=' . to_time($startday . ' 00:00:00') . ' and truetime<=' . to_time($endday . ' 23:59:59') : '';
    }
    //按栏目
    $classid = (int) $classid;
    if ($classid) {
        $where = empty($class_r[$classid][islast]) ? ReturnClass($class_r[$classid][sonclass]) : "classid='{$classid}'";
        $add1 .= ' and ' . $where;
    }
    //不生成
    $add1 .= ReturnNreInfoWhere();
    //是否重复生成
    $updatehavehtml = 'havehtml=0';
    if ($havehtml != 1) {
        $add1 .= ' and havehtml=0';
        $updatehavehtml = '';
    }
    //优化
    $yhadd = '';
    $yhid = $etable_r[$tbname][yhid];
    $yhvar = 'rehtml';
    if ($yhid) {
        $yhadd = ReturnYhSql($yhid, $yhvar, 1);
    }
    $b = 0;
    $sql = $empire->query("select id,classid from {$dbtbpre}ecms_" . $tbname . "_index where " . $yhadd . "id>{$start}" . $add1 . " and checked=1 order by id limit " . $public_r[renewsnum]);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $new_start = $r[id];
        if ($class_r[$r[classid]][showdt] == 2) {
            continue;
        }
        GetHtml($r['classid'], $r['id'], '', 0, 1);
        //生成信息文件
    }
    if (empty($b)) {
        //更新状态
        if ($yhadd . $add1 == '') {
            $empire->query("update {$dbtbpre}ecms_" . $tbname . "_index set havehtml=1 where havehtml=0 and checked=1");
            $empire->query("update {$dbtbpre}ecms_" . $tbname . " set havehtml=1 where havehtml=0");
        } else {
            if ($updatehavehtml) {
                $updatehavehtml = ' and ' . $updatehavehtml;
            }
            if ($yhadd && $add1) {
                $truewhereindex = $yhadd . substr($add1, 5) . ' and checked=1';
                $truewhere = $yhadd . substr($add1, 5);
            } elseif ($yhadd && !$add1) {
                $truewhereindex = $yhadd . 'checked=1';
                $truewhere = substr($yhadd, 0, -5);
            } else {
                $truewhereindex = substr($add1, 5) . ' and checked=1';
                $truewhere = substr($add1, 5);
            }
            $empire->query("update {$dbtbpre}ecms_" . $tbname . "_index set havehtml=1 where " . $truewhereindex . $updatehavehtml);
            $empire->query("update {$dbtbpre}ecms_" . $tbname . " set havehtml=1 where " . $truewhere . $updatehavehtml);
        }
        echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><center><b>" . $tbname . $fun_r[ReTableIsOK] . "!</b></center>";
        db_close();
        $empire = null;
        exit;
    }
    echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><meta http-equiv=\"refresh\" content=\"" . $public_r['realltime'] . ";url=ecmschtml.php?enews=ReNewsHtml&tbname={$tbname}&classid={$classid}&start={$new_start}&from=" . urlencode($from) . "&retype={$retype}&startday={$startday}&endday={$endday}&startid={$startid}&endid={$endid}&havehtml={$havehtml}&reallinfotime=" . ehtmlspecialchars($_GET['reallinfotime']) . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneReNewsHtmlSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)";
    exit;
}