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; }
$bclassid = (int) $_GET['bclassid']; $search = ''; $add = ''; if ($class_r[$classid]['islast']) { $add .= "classid='{$classid}'"; } else { $where = ReturnClass($class_r[$classid][sonclass]); $add .= "(" . $where . ")"; } $modid = $class_r[$classid][modid]; //优化 $yhid = $class_r[$classid][yhid]; $yhvar = 'qlist'; $yhadd = ''; if ($yhid) { $yhadd = ReturnYhSql($yhid, $yhvar, 1); } $search .= "&classid={$classid}&style={$wapstyle}&bclassid={$bclassid}"; $page = intval($_GET['page']); $page = RepPIntvar($page); $line = $pr['waplistnum']; //每页显示记录数 $offset = $page * $line; $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;
function sys_OtherLinkQuery($classid, $line, $enews, $doing) { global $empire, $public_r, $class_r, $class_zr, $navinfor, $dbtbpre, $eyh_r, $etable_r; if ($enews == 1) { $tbname = $classid; } elseif ($enews == 2) { if ($classid == 'selfinfo') { $classid = $navinfor['classid']; } $tbname = $class_r[$classid]['tbname']; if ($class_r[$classid][islast]) { $and = "classid='{$classid}'"; } else { $and = ReturnClass($class_r[$classid][sonclass]); } } elseif ($enews == 3) { $tbname = $class_zr[$classid]['tbname']; $and = "ztid like '%|" . $classid . "|%'"; } else { $tbname = $class_r[$navinfor[classid]]['tbname']; } //关键字 $keys = ''; if (!empty($enews)) { $repadd = ''; $keyr = explode(',', $navinfor['keyboard']); $count = count($keyr); for ($i = 0; $i < $count; $i++) { if ($i == 0) { $or = ''; } else { $or = ' or '; } $repadd .= $or . "[!--f--!] like '%" . $keyr[$i] . "%'"; } //搜索范围 if ($public_r['newslink'] == 1) { $keys = '(' . str_replace('[!--f--!]', 'keyboard', $repadd) . ')'; } elseif ($public_r['newslink'] == 2) { $keys = '(' . str_replace('[!--f--!]', 'keyboard', $repadd) . ' or ' . str_replace('[!--f--!]', 'title', $repadd) . ')'; } else { $keys = '(' . str_replace('[!--f--!]', 'title', $repadd) . ')'; } } else { $keys = 'id in (' . $navinfor['keyid'] . ')'; } //当前信息 if ($tbname == $class_r[$navinfor[classid]][tbname]) { $and .= empty($and) ? "id<>'{$navinfor['id']}'" : " and id<>'{$navinfor['id']}'"; } //图片信息 if ($doing) { $and .= empty($and) ? "ispic=1" : " and ispic=1"; } if ($and) { $and .= ' and '; } if (empty($line)) { $line = $class_r[$navinfor[classid]]['link_num']; } //优化 $yhvar = 'otherlink'; $yhid = $etable_r[$tbname][yhid]; $yhadd = ''; if ($yhid) { $yhadd = ReturnYhSql($yhid, $yhvar); } $query = "select * from {$dbtbpre}ecms_" . $tbname . " where " . $yhadd . $and . $keys . " and checked=1 order by newstime desc limit {$line}"; $sql = $empire->query1($query); if (!$sql) { echo "SQL Error: " . ReRepSqlTbpre($query); } return $sql; }
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; }
function espace_ReturnBqQuery($classid, $line, $enews = 0, $do = 0, $ewhere = '', $eorder = '') { global $empire, $dbtbpre, $public_r, $class_r, $class_zr, $fun_r, $class_tr, $emod_r, $etable_r, $userid, $eyh_r; $userid = (int) $userid; if ($enews == 24) { $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 ($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) { echo "Error:Change to use e:indexloop"; return false; } 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]; } $query = " where userid='{$userid}' and ismember=1"; if ($enews == 0) { $query .= ' and (' . $where . ')'; $order = 'newstime'; $yhvar = 'bqnew'; } elseif ($enews == 1) { $query .= ' and (' . $where . ')'; $order = 'onclick'; $yhvar = 'bqhot'; } elseif ($enews == 2) { $query .= ' and (' . $where . ') and isgood>0'; $order = 'newstime'; $yhvar = 'bqgood'; } elseif ($enews == 9) { $query .= ' and (' . $where . ')'; $order = 'plnum'; $yhvar = 'bqpl'; } elseif ($enews == 12) { $query .= ' and (' . $where . ') and firsttitle>0'; $order = 'newstime'; $yhvar = 'bqfirst'; } elseif ($enews == 15) { $query .= ' and (' . $where . ')'; $order = 'totaldown'; $yhvar = 'bqdown'; } elseif ($enews == 3) { $order = 'newstime'; $tbname = $public_r[tbname]; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqnew'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 4) { $order = 'onclick'; $tbname = $public_r[tbname]; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqhot'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 5) { $query .= ' and isgood>0'; $order = 'newstime'; $tbname = $public_r[tbname]; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqgood'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 10) { $order = 'plnum'; $tbname = $public_r[tbname]; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqpl'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 13) { $query .= ' and firsttitle>0'; $order = 'newstime'; $tbname = $public_r[tbname]; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqfirst'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 16) { $order = 'totaldown'; $tbname = $public_r[tbname]; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqdown'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 18) { $order = 'newstime'; $tbname = $classid; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqnew'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 19) { $order = 'onclick'; $tbname = $classid; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqhot'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 20) { $query .= ' and isgood>0'; $order = 'newstime'; $tbname = $classid; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqgood'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 21) { $order = 'plnum'; $tbname = $classid; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqpl'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 22) { $query .= ' and firsttitle>0'; $order = "newstime"; $tbname = $classid; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqfirst'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 23) { $order = 'totaldown'; $tbname = $classid; $mid = $etable_r[$tbname][mid]; $yhvar = 'bqdown'; $yhid = $etable_r[$tbname][yhid]; } elseif ($enews == 25) { $query .= ' and (' . $where . ')'; $order = 'newstime'; $yhvar = 'bqnew'; } elseif ($enews == 26) { $query .= ' and (' . $where . ')'; $order = 'onclick'; $yhvar = 'bqhot'; } elseif ($enews == 27) { $query .= ' and (' . $where . ') and isgood>0'; $order = 'newstime'; $yhvar = 'bqgood'; } elseif ($enews == 28) { $query .= ' and (' . $where . ')'; $order = 'plnum'; $yhvar = 'bqpl'; } elseif ($enews == 29) { $query .= ' and (' . $where . ') and firsttitle>0'; $order = 'newstime'; $yhvar = 'bqfirst'; } elseif ($enews == 30) { $query .= ' and (' . $where . ')'; $order = 'totaldown'; $yhvar = 'bqdown'; } //优化 $yhadd = ''; if (!empty($eyh_r[$yhid]['dosbq'])) { $yhadd = ReturnYhSql($yhid, $yhvar); if (!empty($yhadd)) { $query .= ' and ' . $yhadd; } } //不调用 if (!strstr($public_r['nottobq'], ',' . $classid . ',')) { $notbqwhere = ReturnNottoBqWhere(); if (!empty($notbqwhere)) { $query .= ' and ' . $notbqwhere; } } //图片信息 if (!empty($do)) { $query .= " and ispic=1"; } //附加条件 if (!empty($ewhere)) { $query .= ' and (' . $ewhere . ')'; } //中止 if (empty($tbname)) { echo "ClassID=<b>" . $classid . "</b> Table not exists.(DoType=" . $enews . ")"; return false; } //排序 $addorder = empty($eorder) ? $order . ' desc' : $eorder; $query = 'select ' . ReturnSqlListF($mid) . ' from ' . $dbtbpre . 'ecms_' . $tbname . $query . ' order by ' . $addorder . ' limit ' . $line; $sql = $empire->query1($query); if (!$sql) { echo "SQL Error: " . ReRepSqlTbpre($query); } return $sql; }
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); }