function sys_ReturnBqQuery($classid, $line, $enews = 0, $do = 0, $ewhere = '', $eorder = '')
{
    global $empire, $public_r, $class_r, $class_zr, $navclassid, $do_openbqquery, $dbtbpre, $fun_r, $class_tr, $emod_r, $etable_r, $eyh_r;
    if ($enews == 24 && $do_openbqquery == 1) {
        $query_first = substr($classid, 0, 7);
        if (!($query_first == 'select ' || $query_first == 'SELECT ')) {
            return "";
        }
        $classid = RepSqlTbpre($classid);
        $sql = $empire->query1($classid);
        if (!$sql) {
            echo "SQL Error: " . ReRepSqlTbpre($classid);
        }
        return $sql;
    }
    if ($enews == 0 || $enews == 1 || $enews == 2 || $enews == 9 || $enews == 12 || $enews == 15) {
        if (strstr($classid, ',')) {
            $son_r = sys_ReturnMoreClass($classid, 1);
            $classid = $son_r[0];
            $where = $son_r[1];
        } else {
            if ($classid == 'selfinfo') {
                $classid = $navclassid;
            }
            if ($class_r[$classid][islast]) {
                $where = "classid='{$classid}'";
            } else {
                $where = ReturnClass($class_r[$classid][sonclass]);
            }
        }
        $tbname = $class_r[$classid][tbname];
        $mid = $class_r[$classid][modid];
        $yhid = $class_r[$classid][yhid];
    } elseif ($enews == 6 || $enews == 7 || $enews == 8 || $enews == 11 || $enews == 14 || $enews == 17) {
        if (strstr($classid, ',')) {
            $son_r = sys_ReturnMoreZt($classid);
            $classid = $son_r[0];
            $where = $son_r[1];
        } else {
            if ($classid == 'selfinfo') {
                $classid = $navclassid;
            }
            $where = "ztid like '%|" . $classid . "|%'";
        }
        $tbname = $class_zr[$classid][tbname];
        $mid = $etable_r[$tbname][mid];
        $yhid = $class_zr[$classid][yhid];
    } elseif ($enews == 25 || $enews == 26 || $enews == 27 || $enews == 28 || $enews == 29 || $enews == 30) {
        if (strstr($classid, ',')) {
            $son_r = sys_ReturnMoreTT($classid);
            $classid = $son_r[0];
            $where = $son_r[1];
        } else {
            $where = "ttid='{$classid}'";
        }
        $mid = $class_tr[$classid][mid];
        $tbname = $emod_r[$mid][tbname];
        $yhid = $class_tr[$classid][yhid];
    }
    if ($enews == 0) {
        $query = '(' . $where . ') and checked=1';
        $order = 'newstime';
        $yhvar = 'bqnew';
    } elseif ($enews == 1) {
        $query = '(' . $where . ') and checked=1';
        $order = 'onclick';
        $yhvar = 'bqhot';
    } elseif ($enews == 2) {
        $query = '(' . $where . ') and isgood>0 and checked=1';
        $order = 'newstime';
        $yhvar = 'bqgood';
    } elseif ($enews == 9) {
        $query = '(' . $where . ') and checked=1';
        $order = 'plnum';
        $yhvar = 'bqpl';
    } elseif ($enews == 12) {
        $query = '(' . $where . ') and firsttitle>0 and checked=1';
        $order = 'newstime';
        $yhvar = 'bqfirst';
    } elseif ($enews == 15) {
        $query = '(' . $where . ') and checked=1';
        $order = 'totaldown';
        $yhvar = 'bqdown';
    } elseif ($enews == 3) {
        $query = 'checked=1';
        $order = 'newstime';
        $tbname = $public_r[tbname];
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqnew';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 4) {
        $query = 'checked=1';
        $order = 'onclick';
        $tbname = $public_r[tbname];
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqhot';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 5) {
        $query = 'isgood>0 and checked=1';
        $order = 'newstime';
        $tbname = $public_r[tbname];
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqgood';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 10) {
        $query = 'checked=1';
        $order = 'plnum';
        $tbname = $public_r[tbname];
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqpl';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 13) {
        $query = 'firsttitle>0 and checked=1';
        $order = 'newstime';
        $tbname = $public_r[tbname];
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqfirst';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 16) {
        $query = 'checked=1';
        $order = 'totaldown';
        $tbname = $public_r[tbname];
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqdown';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 6) {
        $query = '(' . $where . ') and checked=1';
        $order = 'newstime';
        $yhvar = 'bqnew';
    } elseif ($enews == 7) {
        $query = '(' . $where . ') and checked=1';
        $order = 'onclick';
        $yhvar = 'bqhot';
    } elseif ($enews == 8) {
        $query = '(' . $where . ') and isgood>0 and checked=1';
        $order = 'newstime';
        $yhvar = 'bqgood';
    } elseif ($enews == 11) {
        $query = '(' . $where . ') and checked=1';
        $order = 'plnum';
        $yhvar = 'bqpl';
    } elseif ($enews == 14) {
        $query = '(' . $where . ') and firsttitle>0 and checked=1';
        $order = 'newstime';
        $yhvar = 'bqfirst';
    } elseif ($enews == 17) {
        $query = '(' . $where . ') and checked=1';
        $order = 'totaldown';
        $yhvar = 'bqdown';
    } elseif ($enews == 18) {
        $query = 'checked=1';
        $order = 'newstime';
        $tbname = $classid;
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqnew';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 19) {
        $query = 'checked=1';
        $order = 'onclick';
        $tbname = $classid;
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqhot';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 20) {
        $query = 'isgood>0 and checked=1';
        $order = 'newstime';
        $tbname = $classid;
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqgood';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 21) {
        $query = 'checked=1';
        $order = 'plnum';
        $tbname = $classid;
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqpl';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 22) {
        $query = 'firsttitle>0 and checked=1';
        $order = "newstime";
        $tbname = $classid;
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqfirst';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 23) {
        $query = 'checked=1';
        $order = 'totaldown';
        $tbname = $classid;
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqdown';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 25) {
        $query = '(' . $where . ') and checked=1';
        $order = 'newstime';
        $yhvar = 'bqnew';
    } elseif ($enews == 26) {
        $query = '(' . $where . ') and checked=1';
        $order = 'onclick';
        $yhvar = 'bqhot';
    } elseif ($enews == 27) {
        $query = '(' . $where . ') and isgood>0 and checked=1';
        $order = 'newstime';
        $yhvar = 'bqgood';
    } elseif ($enews == 28) {
        $query = '(' . $where . ') and checked=1';
        $order = 'plnum';
        $yhvar = 'bqpl';
    } elseif ($enews == 29) {
        $query = '(' . $where . ') and firsttitle>0 and checked=1';
        $order = 'newstime';
        $yhvar = 'bqfirst';
    } elseif ($enews == 30) {
        $query = '(' . $where . ') and checked=1';
        $order = 'totaldown';
        $yhvar = 'bqdown';
    }
    //不调用
    if (!strstr($public_r['nottobq'], ',' . $classid . ',')) {
        $query .= ReturnNottoBqWhere();
    }
    //附加条件
    if (!empty($ewhere)) {
        $query .= ' and (' . $ewhere . ')';
    }
    //图片信息
    if (!empty($do)) {
        $query .= ' and ispic=1';
    }
    //中止
    if (empty($tbname)) {
        echo $fun_r['BqErrorCid'] . "=<b>" . $classid . "</b>" . $fun_r['BqErrorNtb'] . "(" . $fun_r['BqErrorDo'] . "=" . $enews . ")";
        return false;
    }
    //排序
    $addorder = empty($eorder) ? $order . ' desc' : $eorder;
    //优化
    $yhadd = '';
    if (!empty($eyh_r[$yhid]['dobq'])) {
        $yhadd = ReturnYhSql($yhid, $yhvar);
    }
    $query = 'select ' . ReturnSqlListF($mid) . ' from ' . $dbtbpre . 'ecms_' . $tbname . ' where ' . $yhadd . $query . ' order by ' . ReturnSetTopSql('bq') . $addorder . ' limit ' . $line;
    $sql = $empire->query1($query);
    if (!$sql) {
        echo "SQL Error: " . ReRepSqlTbpre($query);
    }
    return $sql;
}
Beispiel #2
0
$query = "select " . ReturnSqlListF($modid) . " from {$dbtbpre}ecms_" . $class_r[$classid]['tbname'] . " where " . $yhadd . $add;
$totalnum = intval($_GET['totalnum']);
if ($totalnum < 1) {
    $totalquery = "select count(*) as total from {$dbtbpre}ecms_" . $class_r[$classid]['tbname'] . " where " . $yhadd . $add;
    $num = $empire->gettotal($totalquery);
    //取得总条数
} else {
    $num = $totalnum;
}
$search .= "&totalnum={$num}";
//排序
if (empty($class_r[$classid][reorder])) {
    $addorder = "newstime desc";
} else {
    $addorder = $class_r[$classid][reorder];
}
$query .= " order by " . ReturnSetTopSql('list') . $addorder . " limit {$offset},{$line}";
$sql = $empire->query($query);
$returnpage = DoWapListPage($num, $line, $page, $search);
//系统模型
$ret_r = ReturnAddF($modid, 2);
//参数
$ecmsvar_mbr = array();
$ecmsvar_mbr['wapstyle'] = $wapstyle;
$ecmsvar_mbr['fbclassid'] = $bclassid;
$ecmsvar_mbr['fclassid'] = $classid;
$ecmsvar_mbr['fcpage'] = $page;
$ecmsvar_mbr['urladdcs'] = ewap_UrlAddCs();
require 'template/' . $usewapstyle . '/list.temp.php';
db_close();
$empire = null;
function GetNewsJs($classid, $line, $sub, $showdate, $enews = 0, $tempr)
{
    global $empire, $public_r, $class_r, $class_zr, $emod_r, $etable_r, $dbtbpre, $eyh_r;
    if (empty($line)) {
        $line = 10;
    }
    if (empty($sub)) {
        $sub = 26;
    }
    //栏目
    if ($enews == 0 || $enews == 1 || $enews == 2 || $enews == 9 || $enews == 12 || $enews == 15) {
        $where = $class_r[$classid][islast] ? "classid='{$classid}'" : ReturnClass($class_r[$classid][sonclass]);
    }
    $allpath = ECMS_PATH . 'd/js/js/';
    $ztpath = ECMS_PATH . 'd/js/class/zt' . $classid . '_';
    $classpath = ECMS_PATH . 'd/js/class/class' . $classid . '_';
    if ($enews == 0) {
        $tbname = $class_r[$classid][tbname];
        $query = $where . ' and checked=1';
        $order = 'newstime';
        $newsjs = $classpath . 'newnews.js';
        $mid = $class_r[$classid][modid];
        $yhid = $class_r[$classid][yhid];
        $yhvar = 'bqnew';
    } elseif ($enews == 1) {
        $tbname = $class_r[$classid][tbname];
        $query = $where . ' and checked=1';
        $order = "onclick";
        $newsjs = $classpath . 'hotnews.js';
        $mid = $class_r[$classid][modid];
        $yhid = $class_r[$classid][yhid];
        $yhvar = 'bqhot';
    } elseif ($enews == 2) {
        $tbname = $class_r[$classid][tbname];
        $query = $where . ' and isgood>0 and checked=1';
        $order = 'newstime';
        $newsjs = $classpath . 'goodnews.js';
        $mid = $class_r[$classid][modid];
        $yhid = $class_r[$classid][yhid];
        $yhvar = 'bqgood';
    } elseif ($enews == 9) {
        $tbname = $class_r[$classid][tbname];
        $query = $where . ' and checked=1';
        $order = 'plnum';
        $newsjs = $classpath . 'hotplnews.js';
        $mid = $class_r[$classid][modid];
        $yhid = $class_r[$classid][yhid];
        $yhvar = 'bqpl';
    } elseif ($enews == 12) {
        $tbname = $class_r[$classid][tbname];
        $query = $where . ' and firsttitle>0 and checked=1';
        $order = 'newstime';
        $newsjs = $classpath . 'firstnews.js';
        $mid = $class_r[$classid][modid];
        $yhid = $class_r[$classid][yhid];
        $yhvar = 'bqfirst';
    } elseif ($enews == 3) {
        $tbname = $public_r['tbname'];
        $query = 'checked=1';
        $order = 'newstime';
        $newsjs = $allpath . 'newnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqnew';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 4) {
        $tbname = $public_r['tbname'];
        $query = 'checked=1';
        $order = 'onclick';
        $newsjs = $allpath . 'hotnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqhot';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 5) {
        $tbname = $public_r['tbname'];
        $query = 'isgood>0 and checked=1';
        $order = 'newstime';
        $newsjs = $allpath . 'goodnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqgood';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 10) {
        $tbname = $public_r['tbname'];
        $query = 'checked=1';
        $order = 'plnum';
        $newsjs = $allpath . 'hotplnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqpl';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 13) {
        $tbname = $public_r['tbname'];
        $query = 'firsttitle>0 and checked=1';
        $order = 'newstime';
        $newsjs = $allpath . 'firstnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhvar = 'bqfirst';
        $yhid = $etable_r[$tbname][yhid];
    } elseif ($enews == 6) {
        $tbname = $class_zr[$classid][tbname];
        $query = "ztid like '%|" . $classid . "|%' and checked=1";
        $order = 'newstime';
        $newsjs = $ztpath . 'newnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhid = $class_zr[$classid][yhid];
        $yhvar = 'bqnew';
    } elseif ($enews == 7) {
        $tbname = $class_zr[$classid][tbname];
        $query = "ztid like '%|" . $classid . "|%' and checked=1";
        $order = 'onclick';
        $newsjs = $ztpath . 'hotnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhid = $class_zr[$classid][yhid];
        $yhvar = 'bqhot';
    } elseif ($enews == 8) {
        $tbname = $class_zr[$classid][tbname];
        $query = "ztid like '%|" . $classid . "|%' and isgood>0 and checked=1";
        $order = 'newstime';
        $newsjs = $ztpath . 'goodnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhid = $class_zr[$classid][yhid];
        $yhvar = 'bqgood';
    } elseif ($enews == 11) {
        $tbname = $class_zr[$classid][tbname];
        $query = "ztid like '%|" . $classid . "|%' and checked=1";
        $order = 'plnum';
        $newsjs = $ztpath . 'hotplnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhid = $class_zr[$classid][yhid];
        $yhvar = 'bqpl';
    } elseif ($enews == 14) {
        $tbname = $class_zr[$classid][tbname];
        $query = "ztid like '%|" . $classid . "|%' and firsttitle>0 and checked=1";
        $order = 'newstime';
        $newsjs = $ztpath . 'firstnews.js';
        $mid = $etable_r[$tbname][mid];
        $yhid = $class_zr[$classid][yhid];
        $yhvar = 'bqfirst';
    }
    $ret_r = ReturnReplaceListF($tempr[modid]);
    //字段
    //优化
    $yhadd = '';
    if (!empty($eyh_r[$yhid]['dojs'])) {
        $yhadd = ReturnYhSql($yhid, $yhvar);
    }
    $query = 'select ' . ReturnSqlListF($mid) . ' from ' . $dbtbpre . 'ecms_' . $tbname . ' where ' . $yhadd . $query . ' order by ' . ReturnSetTopSql('js') . $order . ' desc limit ' . $line;
    $sql = $empire->query($query);
    //取得js模板
    $tempr[temptext] = str_replace('[!--news.url--]', $public_r[newsurl], $tempr[temptext]);
    $temp_r = explode("[!--empirenews.listtemp--]", $tempr[temptext]);
    $no = 1;
    while ($r = $empire->fetch($sql)) {
        $r[oldtitle] = $r[title];
        //替换列表变量
        $repvar = ReplaceListVars($no, $temp_r[1], $tempr[subnews], $tempr[subtitle], $tempr[showdate], $url, 0, $r, $ret_r);
        $allnew .= $repvar;
        $no++;
    }
    $allnew = "document.write(\"" . addslashes(stripSlashes(str_replace("\r\n", "", $temp_r[0] . $allnew . $temp_r[2]))) . "\");";
    WriteFiletext_n($newsjs, $allnew);
}