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; }
function ReInfoUrl($start, $classid, $from, $retype, $startday, $endday, $startid, $endid, $tbname, $userid, $username) { global $empire, $public_r, $class_r, $fun_r, $dbtbpre; //验证权限 //CheckLevel($userid,$username,$classid,"changedata"); $start = (int) $start; $tbname = RepPostVar($tbname); if (empty($tbname) || !eCheckTbname($tbname)) { printerror("ErrorUrl", "history.go(-1)"); } $add1 = ''; //按栏目刷新 $classid = (int) $classid; if ($classid) { if (empty($class_r[$classid][islast])) { $where = ReturnClass($class_r[$classid][sonclass]); } else { $where = "classid='{$classid}'"; } $add1 = " and (" . $where . ")"; } //按ID刷新 if ($retype) { $startid = (int) $startid; $endid = (int) $endid; if ($endid) { $add1 .= " and id>={$startid} and id<={$endid}"; } } else { $startday = RepPostVar($startday); $endday = RepPostVar($endday); if ($startday && $endday) { $add1 .= " and truetime>=" . to_time($startday . " 00:00:00") . " and truetime<=" . to_time($endday . " 23:59:59"); } } $b = 0; $sql = $empire->query("select id,classid,checked from {$dbtbpre}ecms_" . $tbname . "_index where id>{$start}" . $add1 . " order by id limit " . $public_r[delnewsnum]); while ($r = $empire->fetch($sql)) { $b = 1; $new_start = $r[id]; //返回表 $infotb = ReturnInfoMainTbname($tbname, $r['checked']); $infor = $empire->fetch1("select newspath,filename,groupid,isurl,titleurl from " . $infotb . " where id='{$r['id']}' limit 1"); $infourl = GotoGetTitleUrl($r['classid'], $r['id'], $infor['newspath'], $infor['filename'], $infor['groupid'], $infor['isurl'], $infor['titleurl']); $empire->query("update " . $infotb . " set titleurl='{$infourl}' where id='{$r['id']}' limit 1"); } if (empty($b)) { insert_dolog(""); //操作日志 printerror("ReInfoUrlSuccess", $from); } echo $fun_r[OneReInfoUrlSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)<script>self.location.href='ReInfoUrl.php?enews=ReInfoUrl&tbname={$tbname}&classid={$classid}&start={$new_start}&from=" . urlencode($from) . "&retype={$retype}&startday={$startday}&endday={$endday}&startid={$startid}&endid={$endid}" . hReturnEcmsHashStrHref(0) . "';</script>"; exit; }
{ $add.=" and cid='$cid'"; $search.='&cid='.$cid; } //系统模型 $mid=(int)$_GET['mid']; if($mid) { $add.=" and mid='$mid'"; $search.='&mid='.$mid; } //栏目 $classid=(int)$_GET['classid']; if($classid) { $add.=' and '.($class_r[$classid][islast]?"classid='$classid'":"(".ReturnClass($class_r[$classid][sonclass]).")"); $search.='&classid='.$classid; } //推荐 $isgood=(int)$_GET['isgood']; if($isgood) { $add.=" and isgood>0"; $search.='&isgood='.$isgood; } //排序 $myorder=(int)$_GET['myorder']; $search.='&myorder='.$myorder; if($myorder==1) { $doorder='zid desc';
} //投票 $voter = $empire->fetch1("select * from {$dbtbpre}enewsinfovote where classid='{$classid}' and id='{$id}' limit 1"); if ($voter['id'] && $voter[votetext]) { $d_record = explode("\r\n", $voter[votetext]); for ($i = 0; $i < count($d_record); $i++) { $j = $i + 1; $d_field = explode("::::::", $d_record[$i]); $allvote .= "<tr><td width='9%'><div align=center>" . $j . "</div></td><td width='65%'><input name=vote_name[] type=text value='" . $d_field[0] . "' size=30></td><td width='26%'><input name=vote_num[] type=text value='" . $d_field[1] . "' size=6><input type=hidden name=vote_id[] value=" . $j . "><input type=checkbox name=delvote_id[] value=" . $j . ">删除</td></tr>"; } $voteeditnum = $j; $allvote = "<table width='100%' border=0 cellspacing=1 cellpadding=3>" . $allvote . "</table>"; } } //取得专题类别 $ztwhere = ReturnClass($class_r[$classid][featherclass]); $z_sql = $empire->query("select ztname,ztid,tbname from {$dbtbpre}enewszt where usezt=0 and (classid=0 or classid='{$classid}' or (" . $ztwhere . ")) order by ztid"); $j = 0; $br = ""; while ($z_r = $empire->fetch($z_sql)) { /* //不同表 if($class_r[$classid][tbname]!=$z_r[tbname]) {continue;} */ $j++; if ($j % 8 == 0) { $br = "<br>"; } else { $br = ""; }
//栏目 $trueclassid = 0; $classid = $_GET['classid']; if ($classid) { $classid = RepPostVar($classid); if (strstr($classid, ',')) { $son_r = sys_ReturnMoreClass($classid, 1); $trueclassid = $son_r[0]; $add .= ' and (' . $son_r[1] . ')'; } else { $trueclassid = intval($classid); if ($class_r[$trueclassid][islast]) { $add .= " and classid='{$trueclassid}'"; $have_class = 0; } else { $add .= ' and ' . ReturnClass($class_r[$trueclassid][sonclass]); } $pageclassid = $trueclassid; $GLOBALS['navclassid'] = $trueclassid; } if (empty($class_r[$trueclassid][tbname])) { printerror('ErrorUrl', '', 1); } $search .= '&classid=' . $classid; } //时间 if ($_GET['endtime']) { $starttime = RepPostVar($_GET['starttime']); if (empty($starttime)) { $starttime = '0000-00-00'; }
$string = DtNewsBq($dttempname, $classtemp, 0); $string = str_replace('[!--newsnav--]', $url, $string); //位置导航 $string = Class_ReplaceSvars($string, $url, $classid, $pagetitle, $pagekey, $pagedes, $classimg, $addr, 0); $string = str_replace('[!--page.stats--]', '', $string); echo stripSlashes($string); exit; } //---列表式--- $add = ''; //栏目 if ($class_r[$classid][islast]) { $add .= "classid='{$classid}'"; $have_class = 0; } else { $add .= ReturnClass($class_r[$classid][sonclass]); $have_class = 1; } //排序 if (empty($class_r[$classid][reorder])) { $addorder = "newstime desc"; } else { $addorder = $class_r[$classid][reorder]; } //列表模板 $tempid = $class_r[$classid]['dtlisttempid'] ? $class_r[$classid]['dtlisttempid'] : $class_r[$classid]['listtempid']; if (empty($tempid)) { printerror('ErrorUrl', '', 1); } $tempr = $empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from " . GetTemptb("enewslisttemp") . " where tempid='{$tempid}'"); if (empty($tempr[tempid])) {
$ids .= $dh . $infoid; $dh = ','; } if ($ids) { if ($pid) { $ids .= ',' . $pid; } } else { $ids = $pid; } //栏目 if ($classid) { if ($class_r[$classid][islast]) { $add .= " and classid='{$classid}'"; } else { $add .= " and (" . ReturnClass($class_r[$classid][sonclass]) . ")"; } } //搜索 if ($keyboard) { $kbr = explode(' ', $keyboard); $kbcount = count($kbr); $kbor = ''; $kbwhere = ''; for ($kbi = 0; $kbi < $kbcount; $kbi++) { if (!$kbr[$kbi]) { continue; } if ($show == 1) { $kbwhere .= $kbor . "title like '%" . $kbr[$kbi] . "%'"; } elseif ($show == 2) {
$searchvarclassid = ''; if ($isinfofile == 1) { $searchclassid = RepPostStr($_GET['searchclassid'], 1); if ($searchclassid == 'all') { $searchclassid = 0; $searchvarclassid = 'all'; } else { $searchclassid = $searchclassid ? $searchclassid : $classid; $searchvarclassid = $searchclassid; } $searchclassid = (int) $searchclassid; if ($searchclassid) { if ($class_r[$searchclassid]['islast']) { $add .= " and classid='{$searchclassid}'"; } else { $add .= " and " . ReturnClass($class_r[$searchclassid]['sonclass']); } } } //时间范围 $filelday = (int) $_GET['filelday']; if (empty($filelday)) { $filelday = $public_r['filelday']; } if ($filelday && $filelday != 1) { $ckfilelday = time() - $filelday; $add .= " and filetime>{$ckfilelday}"; } //当前信息 $sinfo = (int) $_GET['sinfo']; $select_sinfo = '';
function DelClass1($classid) { global $empire, $class_r, $dbtbpre; $r = $empire->fetch1("select * from {$dbtbpre}enewsclass where classid='{$classid}'"); //外部栏目 if ($r[wburl]) { $sql = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$classid}'"); //删除栏目附件 DelFileOtherTable("modtype=1 and id='{$classid}'"); //删除缓存 DelListEnews(); return ""; } //删除终极栏目 if ($r[islast]) { //删除主表信息 $indexsql = $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . "_index where classid='{$classid}'"); $sql = $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . " where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . "_check where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . "_doc where classid='{$classid}'"); //删除副表信息 DelAllDataTbInfo($r['tbname'], "classid='{$classid}'", 1, 1); //删除存文本文件 DelInfoSaveTxtfile($r['modid'], $r['tbname'], "classid='{$classid}'"); //删除信息附加表与附件 DelMoreInfoOtherData($classid, 0, 0); $filepath = "../../data/" . $r[classpath]; $delf = DelPath($filepath); DelFileOtherTable("modtype=1 and id='{$classid}'"); //删除栏目本身 $sql1 = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$classid}'"); $delpath = "../../" . $r[classpath]; $del = DelPath($delpath); //更新大栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($br = $empire->fetch($bsql)) { $newsonclass = str_replace("|" . $classid . "|", "|", $br[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'"); } } else { //删除栏目 $where = ReturnClass($r[sonclass]); if (empty($where)) { $where = "classid=0"; } $delcr = explode("|", $r[sonclass]); $count = count($delcr); for ($i = 1; $i < $count - 1; $i++) { $delcid = $delcr[$i]; //删除主表信息 $indexsql = $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . "_index where classid='{$delcid}'"); $sql = $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . " where classid='{$delcid}'"); $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . "_check where classid='{$delcid}'"); $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . "_doc where classid='{$delcid}'"); //删除副表信息 DelAllDataTbInfo($class_r[$delcid][tbname], "classid='{$delcid}'", 1, 1); //删除存文本文件 DelInfoSaveTxtfile($class_r[$delcid][modid], $class_r[$delcid][tbname], "classid='{$delcid}'"); //删除信息附加表与附件 DelMoreInfoOtherData($delcid, 0, 0); } //删除附件 $filepath = "../../data/" . $r[classpath]; $delf = DelPath($filepath); if ($where != 'classid=0') { DelFileOtherTable("modtype=1 and (" . str_replace('classid', 'id', $where) . ")"); } //删除子栏目副表 $fcsql = $empire->query("select classid from {$dbtbpre}enewsclass where featherclass like '%|" . $classid . "|%'"); while ($fcr = $empire->fetch($fcsql)) { $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$fcr['classid']}'"); $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$fcr['classid']}'"); } //删除子栏目 $sql1 = $empire->query("delete from {$dbtbpre}enewsclass where featherclass like '%|" . $classid . "|%'"); //改变父栏目的子类 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $bbsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where); while ($bbr = $empire->fetch($bbsql)) { $newsonclass = str_replace($r[sonclass], "|", $bbr[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$bbr['classid']}'"); } //删除栏目本身 $sql2 = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclass_stats where classid='{$classid}'"); //删除栏目附件 DelFileOtherTable("modtype=1 and id='{$classid}'"); $delpath = "../../" . $r[classpath]; $del = DelPath($delpath); } //删除缓存 DelListEnews(); }
$sztr = $empire->fetch1("select ztid,restb from {$dbtbpre}enewszt where ztid='{$ztid}'"); if ($sztr['ztid']) { $and = empty($add) ? ' where ' : ' and '; $add .= $and . "pubid='-{$ztid}'"; $restb = $sztr['restb']; } $search .= "&ztid={$ztid}"; } //单个 $classid = (int) $_GET['classid']; if ($classid) { $and = empty($add) ? ' where ' : ' and '; if ($class_r[$classid][islast]) { $add .= $and . "classid='{$classid}'"; } else { $add .= $and . '(' . ReturnClass($class_r[$classid][sonclass]) . ')'; } $search .= "&classid={$classid}"; } //审核 $checked = (int) $_GET['checked']; if ($checked) { $and = empty($add) ? ' where ' : ' and '; $add .= $and . "checked='" . ($checked == 1 ? 0 : 1) . "'"; $search .= "&checked={$checked}"; } //推荐 $isgood = (int) $_GET['isgood']; if ($isgood) { $and = empty($add) ? ' where ' : ' and '; $add .= $and . "isgood=1";
function DelInfoData($start, $classid, $from, $retype, $startday, $endday, $startid, $endid, $tbname, $add, $userid, $username) { global $empire, $public_r, $class_r, $fun_r, $dbtbpre, $emod_r; //验证权限 CheckLevel($userid, $username, $classid, "delinfodata"); $search = ''; $start = (int) $start; $tbname = RepPostVar($tbname); if (empty($tbname)) { printerror("ErrorUrl", "history.go(-1)"); } $search .= "&tbname={$tbname}"; //查询表 $infotb = "{$dbtbpre}ecms_" . $tbname; //按栏目 $classid = (int) $classid; if ($classid) { if (empty($class_r[$classid][islast])) { $where = ReturnClass($class_r[$classid][sonclass]); } else { $where = "classid='{$classid}'"; } $add1 = " and (" . $where . ")"; $search .= "&classid={$classid}"; } //按ID刷新 $search .= "&retype={$retype}"; if ($retype) { $startid = (int) $startid; $endid = (int) $endid; if ($endid) { $add1 .= " and id>={$startid} and id<={$endid}"; } $search .= "&startid={$startid}&endid={$endid}"; } else { $startday = RepPostVar($startday); $endday = RepPostVar($endday); if ($startday && $endday) { $add1 .= " and truetime>=" . to_time($startday . " 00:00:00") . " and truetime<=" . to_time($endday . " 23:59:59"); } $search .= "&startday={$startday}&endday={$endday}"; } //信息类型 $delckinfo = 0; $infost = (int) $add['infost']; if ($infost) { if ($infost == 1) { $delckinfo = 1; } else { $infotb = "{$dbtbpre}ecms_" . $tbname . "_check"; $delckinfo = 2; } $search .= "&infost={$infost}"; } else { $dodelcheck = (int) $add['dodelcheck']; if ($dodelcheck) { $infotb = "{$dbtbpre}ecms_" . $tbname . "_check"; $delckinfo = 2; $search .= "&dodelcheck=1"; } } //用户发布 $ismember = (int) $add['ismember']; if ($ismember) { if ($ismember == 1) { $add1 .= " and userid=0"; } elseif ($ismember == 2) { $add1 .= " and userid>0"; } elseif ($ismember == 3) { $add1 .= " and userid>0 and ismember=1"; } elseif ($ismember == 4) { $add1 .= " and userid>0 and ismember=0"; } $search .= "&ismember={$ismember}"; } //是否外部链接 $isurl = (int) $add['isurl']; if ($isurl) { if ($isurl == 1) { $add1 .= " and isurl=1"; } else { $add1 .= " and isurl=0"; } $search .= "&isurl={$isurl}"; } //评论数 $plnum = (int) $add['plnum']; if ($plnum) { $add1 .= " and plnum<" . $plnum; $search .= "&plnum={$plnum}"; } //点击数 $onclick = (int) $add['onclick']; if ($onclick) { $add1 .= " and onclick<" . $onclick; $search .= "&onclick={$onclick}"; } //下载数 $totaldown = (int) $add['totaldown']; if ($totaldown) { $add1 .= " and totaldown<" . $totaldown; $search .= "&totaldown={$totaldown}"; } //用户ID $userids = RepPostVar($add['userids']); $usertype = (int) $add['usertype']; if ($userids) { $uidsr = explode(',', $userids); $uidscount = count($uidsr); $uids = ''; $udh = ''; for ($ui = 0; $ui < $uidscount; $ui++) { $uids .= $udh . intval($uidsr[$ui]); $udh = ','; } if ($usertype == 1) { $add1 .= " and userid in (" . $uids . ") and ismember=0"; } else { $add1 .= " and userid in (" . $uids . ") and ismember=1"; } $search .= "&userids={$userids}&usertype={$usertype}"; } //标题 $title = RepPostStr($add['title']); if ($title) { $titler = explode('|', $title); $titlecount = count($titler); $titlewhere = ''; $titleor = ''; for ($ti = 0; $ti < $titlecount; $ti++) { $titlewhere .= $titleor . "title like '%" . $titler[$ti] . "%'"; $titleor = ' or '; } $add1 .= " and (" . $titlewhere . ")"; $search .= "&title={$title}"; } $b = 0; $sql = $empire->query("select * from " . $infotb . " where id>{$start}" . $add1 . " order by id limit " . $public_r[delnewsnum]); while ($r = $empire->fetch($sql)) { $b = 1; $new_start = $r[id]; $mid = $emod_r[$r[classid]]['modid']; $pf = $emod_r[$mid]['pagef']; $stf = $emod_r[$mid]['savetxtf']; //未审核表 if ($delckinfo == 2) { $infodatatb = "{$dbtbpre}ecms_" . $tbname . "_check_data"; } else { $infodatatb = "{$dbtbpre}ecms_" . $tbname . "_data_" . $r['stb']; } //分页字段 if ($pf) { if (strstr($emod_r[$mid]['tbdataf'], ',' . $pf . ',')) { $finfor = $empire->fetch1("select " . $pf . " from " . $infodatatb . " where id='{$r['id']}' limit 1"); $r[$pf] = $finfor[$pf]; } } //存文本 if ($stf) { $newstextfile = $r[$stf]; $r[$stf] = GetTxtFieldText($r[$stf]); DelTxtFieldText($newstextfile); //删除文件 } //删除信息文件 if ($add['delhtml'] != 1 && $delckinfo != 2) { DelNewsFile($r[filename], $r[newspath], $r[classid], $r[$pf], $r[groupid]); } //删除表信息 $empire->query("delete from {$dbtbpre}ecms_" . $tbname . "_index where id='{$r['id']}'"); $empire->query("delete from " . $infotb . " where id='{$r['id']}'"); $empire->query("delete from " . $infodatatb . " where id='{$r['id']}'"); //更新栏目信息数 AddClassInfos($r['classid'], '-1', '-1', $delckinfo == 2 ? 0 : 1); //删除其它表记录和附件 DelSingleInfoOtherData($r['classid'], $r['id'], $r, 0, 0); } if (empty($b)) { if ($delckinfo == 0 && !$dodelcheck) { echo $fun_r[DelDataSuccess] . "<script>self.location.href='ecmsinfo.php?enews=DelInfoData&start=0&from=" . urlencode($from) . "&delhtml={$add['delhtml']}&dodelcheck=1" . $search . hReturnEcmsHashStrHref(0) . "';</script>"; exit; } //操作日志 insert_dolog(""); printerror("DelNewsAllSuccess", "db/DelData.php" . hReturnEcmsHashStrHref2(1)); } echo $fun_r[OneDelDataSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)<script>self.location.href='ecmsinfo.php?enews=DelInfoData&start={$new_start}&from=" . urlencode($from) . "&delhtml={$add['delhtml']}" . $search . hReturnEcmsHashStrHref(0) . "';</script>"; exit; }
function ChangeClassListtemp($classid, $listtempid, $userid, $username) { global $empire, $class_r, $dbtbpre; if (empty($listtempid)) { printerror("EmptChangeListtempid", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "template"); $listtempid = (int) $listtempid; $classid = (int) $classid; if (empty($classid)) { $where = "classid<>0"; } else { //中级栏目 if (empty($class_r[$classid][islast])) { $where = ReturnClass($class_r[$classid][sonclass]); } else { $where = "classid='{$classid}'"; } } $sql = $empire->query("update {$dbtbpre}enewsclass set listtempid={$listtempid} where " . $where); GetClass(); if ($sql) { //操作日志 insert_dolog("classid={$classid}&listtempid={$listtempid}"); printerror("ChangeClassListtempSuccess", "history.go(-1)"); } else { printerror("DbError", "history.go(-1)"); } }
function ReturnClassInfoNum($cr, $ecms = 0) { global $empire, $dbtbpre, $class_r; if ($cr['islast']) { $num = $ecms == 0 ? $cr['infos'] : $cr['allinfos']; } else { $f = $ecms == 0 ? 'infos' : 'allinfos'; $num = $empire->gettotal("select sum(" . $f . ") as total from {$dbtbpre}enewsclass where " . ReturnClass($class_r[$cr[classid]][sonclass])); $num = (int) $num; } return $num; }
function DelMorePl($add, $logininid, $loginin) { global $empire, $dbtbpre, $public_r, $class_r; CheckLevel($logininid, $loginin, $classid, "pl"); //验证权限 //变量处理 $restb = (int) $add['restb']; $username = RepPostVar($add['username']); $sayip = RepPostVar($add['sayip']); $saytext = RepPostStr($add['saytext']); $startplid = (int) $add['startplid']; $endplid = (int) $add['endplid']; $startsaytime = RepPostVar($add['startsaytime']); $endsaytime = RepPostVar($add['endsaytime']); $checked = (int) $add['checked']; $ismember = (int) $add['ismember']; $classid = (int) $add['classid']; $id = RepPostVar($add['id']); if (!$restb || !strstr($public_r['pldatatbs'], ',' . $restb . ',')) { printerror("EmptyDelMorePl", "history.go(-1)"); } $where = ''; //栏目 if ($classid) { if (empty($class_r[$classid][islast])) { $cwhere = ReturnClass($class_r[$classid][sonclass]); } else { $cwhere = "classid='{$classid}'"; } $where .= " and " . $cwhere; } //信息ID if ($id) { $idr = explode(',', $id); $ids = ''; $dh = ''; $count = count($idr); for ($i = 0; $i < $count; $i++) { $ids .= $dh . intval($idr[$i]); $dh = ','; } $where .= " and id in (" . $ids . ")"; } //是否会员 if ($ismember) { if ($ismember == 1) { $where .= " and userid=0"; } else { $where .= " and userid>0"; } } //发布者 if ($username) { $where .= " and username like '%{$username}%'"; } //发布IP if ($sayip) { $where .= " and sayip like '%{$sayip}%'"; } //发布内容 if ($saytext) { $twhere = ''; $or = ''; $tr = explode('|', $saytext); $count = count($tr); for ($i = 0; $i < $count; $i++) { $twhere .= $or . "saytext like '%" . $tr[$i] . "%'"; $or = ' or '; } $where .= ' and (' . $twhere . ')'; } //评论ID if ($endplid) { $where .= ' and plid BETWEEN ' . $startplid . ' and ' . $endplid; } //发布时间 if ($startsaytime && $endsaytime) { $startsaytime = to_time($startsaytime . ' 00:00:00'); $endsaytime = to_time($endsaytime . ' 23:59:59'); $where .= " and saytime>='{$startsaytime}' and saytime<='{$endsaytime}'"; } //是否审核 if ($checked) { $checkval = $checked == 1 ? 0 : 1; $where .= " and checked='{$checkval}'"; } if (!$where) { printerror("EmptyDelMorePl", "history.go(-1)"); } $where = substr($where, 5); $sql = $empire->query("select plid,id,classid,pubid from {$dbtbpre}enewspl_" . $restb . " where " . $where); $dh = ''; $b = 0; while ($r = $empire->fetch($sql)) { $b = 1; $startid = $r['plid']; if ($class_r[$r[classid]][tbname] && $r['pubid'] > 0) { $index_r = $empire->fetch1("select checked from {$dbtbpre}ecms_" . $class_r[$r[classid]][tbname] . "_index where id='{$r['id']}' limit 1"); //返回表 $infotb = ReturnInfoMainTbname($class_r[$r[classid]][tbname], $index_r['checked']); $empire->query("update " . $infotb . " set plnum=plnum-1 where id='{$r['id']}'"); } } $sql = $empire->query("delete from {$dbtbpre}enewspl_" . $restb . " where " . $where); insert_dolog("restb={$restb}"); //操作日志 printerror("DelPlSuccess", "DelMorePl.php" . hReturnEcmsHashStrHref2(1)); }
$modr = $empire->fetch1("select enter from {$dbtbpre}enewsmod where mid='{$modid}'"); //栏目 $options = ShowClass_AddClass("", $r[newsclassid], 0, "|-", $class_r[$r[newsclassid]][modid], 4); if ($r[retitlewriter]) { $retitlewriter = " checked"; } if ($r[copyimg]) { $copyimg = " checked"; } if ($r[copyflash]) { $copyflash = " checked"; } //节点 $infoclass = ShowClass_AddInfoClass($r[bclassid], 0, "|-", 0); //专题 $ztwhere = ReturnClass($class_r[$r[newsclassid]][featherclass]); $z_sql = $empire->query("select ztname,ztid,tbname from {$dbtbpre}enewszt where usezt=0 and (classid=0 or classid='{$r['newsclassid']}' or (" . $ztwhere . ")) order by ztid"); $j = 0; $br = ""; while ($z_r = $empire->fetch($z_sql)) { /* //不同表 if($class_r[$r[newsclassid]][tbname]!=$z_r[tbname]) {continue;} */ $j++; if ($j % 6 == 0) { $br = "<br>"; } else { $br = ""; }
if ($endprice) { $addprice = " and (price BETWEEN " . $startprice . " and " . $endprice . ")"; } //搜索栏目及表 $classid = RepPostVar($_POST['classid']); $s_tbname = RepPostVar($_POST['tbname']); $s_tempid = (int) $_POST['tempid']; $trueclassid = 0; if ($classid) { if (strstr($classid, ",")) { $son_r = sys_ReturnMoreClass($classid, 1); $trueclassid = $son_r[0]; $add .= ' and (' . $son_r[1] . ')'; } else { $trueclassid = intval($classid); $add .= $class_r[$trueclassid][islast] ? " and classid='{$trueclassid}'" : " and " . ReturnClass($class_r[$trueclassid][sonclass]); } $tbname = $class_r[$trueclassid][tbname]; $modid = $class_r[$trueclassid][modid]; } elseif ($s_tbname) { $tbnamenum = $empire->gettotal("select count(*) as total from {$dbtbpre}enewstable where tbname='{$s_tbname}' limit 1"); if (!$tbnamenum) { Header("Location:result/?searchid=0" . $dogetvar); exit; } $tbname = $s_tbname; //模型id $thestemp_r = $empire->fetch1("select modid from " . GetTemptb("enewssearchtemp") . " where tempid='{$s_tempid}'"); if (empty($thestemp_r['modid'])) { Header("Location:result/?searchid=0" . $dogetvar); exit;
function sys_ReturnTogQuery($type,$id,$line,$classid='',$mid='',$ewhere='',$eorder='',$selectf=''){ global $empire,$public_r,$class_r,$class_zr,$navclassid,$dbtbpre,$class_tr,$emod_r; if($type=='tags')//TAGS { $idf='tagid'; $orderf='newstime desc'; $table=$dbtbpre.'enewstagsdata'; } elseif($type=='zt')//专题 { $idf='ztid'; $orderf='newstime desc'; $table=$dbtbpre.'enewsztinfo'; } elseif($type=='ztc')//专题子类 { $idf='cid'; $orderf='newstime desc'; $table=$dbtbpre.'enewsztinfo'; } elseif($type=='sql')//SQL查询 { $query_first=substr($id,0,7); if(!($query_first=='select '||$query_first=='SELECT ')) { return ''; } $id=RepSqlTbpre($id); $sql=$empire->query1($id); if(!$sql) { echo'SQL Error: '.ReRepSqlTbpre($id); } return $sql; } else//碎片 { $idf='spid'; $orderf='newstime desc'; $table=$dbtbpre.'enewssp_2'; } $where=strstr($id,',')?"$idf in ($id)":"$idf='$id'"; //栏目 if($classid) { if(strstr($classid,','))//多栏目 { $son_r=sys_ReturnMoreClass($classid,1); $classid=$son_r[0]; $add=$son_r[1]; } else { if($classid=='selfinfo')//显示当前栏目信息 { $classid=$navclassid; } if($class_r[$classid][islast]) { $add="classid='$classid'"; } else { $add=ReturnClass($class_r[$classid][sonclass]); } } $where.=' and ('.$add.')'; } //模型 if($mid) { $where.=strstr($mid,',')?" and mid in ($mid)":" and mid='$mid'"; } //附加sql条件 if(!empty($ewhere)) { $where.=' and ('.$ewhere.')'; } //排序 if(!empty($eorder)) { $orderf=$eorder; } $query='select classid,id'.$selectf.' from '.$table.' where '.$where.' order by '.$orderf.' 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 RepDownLevel($add,$userid,$username){ global $empire,$public_r,$class_r,$fun_r,$dbtbpre; //验证权限 CheckLevel($userid,$username,$classid,"repdownpath"); $tbname=RepPostVar($add['tbname']); if(!$tbname||!($add[downpath]||$add[onlinepath])||!($add[dogroup]||$add[dofen]||$add[doqz]||$add[dopath]||$add[doname])) {printerror("EmptyRepDownLevel","history.go(-1)");} $start=(int)$add['start']; //转换变量 if(empty($add[oldgroupid])) { $add[oldgroupid]=0; } if(empty($add[newgroupid])) { $add[newgroupid]=0; } if(empty($add[oldfen])) { $add[oldfen]=0; } if(empty($add[newfen])) { $add[newfen]=0; } if(empty($add[oldqz])) { $add[oldqz]=0; } if(empty($add[newqz])) { $add[newqz]=0; } //字段 $field=''; $sfield=''; if($add['downpath']) { $field.=",downpath"; $dh=","; $checkf='downpath'; } if($add['onlinepath']) { $field.=",onlinepath"; $checkf='onlinepath'; } $fr=$empire->fetch1("select tid,savetxt,tbdataf from {$dbtbpre}enewsf where tbname='$tbname' and f='$checkf' limit 1"); if($fr['tbdataf'])//副表 { $sfield=$field; $field=''; } $wheresql=""; //栏目 $classid=(int)$add['classid']; if($classid) { if(empty($class_r[$classid][islast]))//中级栏目 { $where=ReturnClass($class_r[$classid][sonclass]); } else//终极栏目 { $where="classid='$classid'"; } $wheresql.=" and (".$where.")"; } //附加sql语句 $query=$add['query']; if($query) { //取除adds $query=ClearAddsData($query); $wheresql.=" and (".$query.")"; } $update=""; $b=0; $sql=$empire->query("select id,stb".$field." from {$dbtbpre}ecms_".$tbname." where id>$start".$wheresql." order by id limit ".$public_r['dorepdlevelnum']); while($r=$empire->fetch($sql)) { $b=1; $newstart=$r[id]; //副表 if($fr['tbdataf']) { $finfor=$empire->fetch1("select id".$sfield." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$r[id]'"); $r['downpath']=$finfor['downpath']; $r['onlinepath']=$finfor['onlinepath']; } $update=''; //下载地址 $newdownpath=""; if($add[downpath]) { $newdownpath=RepDownLevelStrip($r[downpath],$add); $update="downpath='".addslashes($newdownpath)."'"; } //在线地址 $newonlinepath=""; if($add[onlinepath]) { $newonlinepath=RepDownLevelStrip($r[onlinepath],$add); $update.=$dh."onlinepath='".addslashes($newonlinepath)."'"; } //副表 if($fr['tbdataf']) { $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." set ".$update." where id='$r[id]'"); } else { $empire->query("update {$dbtbpre}ecms_".$tbname." set ".$update." where id='$r[id]'"); } } //替换完毕 if(empty($b)) { //未审核 $sql=$empire->query("select id,stb".$field." from {$dbtbpre}ecms_".$tbname."_check".($wheresql?' where '.substr($wheresql,5):'')); while($r=$empire->fetch($sql)) { //副表 if($fr['tbdataf']) { $finfor=$empire->fetch1("select id".$sfield." from {$dbtbpre}ecms_".$tbname."_check_data where id='$r[id]' limit 1"); $r['downpath']=$finfor['downpath']; $r['onlinepath']=$finfor['onlinepath']; } $update=''; //下载地址 $newdownpath=""; if($add[downpath]) { $newdownpath=RepDownLevelStrip($r[downpath],$add); $update="downpath='".addslashes($newdownpath)."'"; } //在线地址 $newonlinepath=""; if($add[onlinepath]) { $newonlinepath=RepDownLevelStrip($r[onlinepath],$add); $update.=$dh."onlinepath='".addslashes($newonlinepath)."'"; } //副表 if($fr['tbdataf']) { $empire->query("update {$dbtbpre}ecms_".$tbname."_check_data set ".$update." where id='$r[id]'"); } else { $empire->query("update {$dbtbpre}ecms_".$tbname."_check set ".$update." where id='$r[id]'"); } } //操作日志 insert_dolog("tbname=$tbname<br>downpath=$add[downpath]<br>onlinepath=$add[onlinepath]"); printerror("RepDownLevelSuccess","DownSys/RepDownLevel.php".hReturnEcmsHashStrHref2(1)); } EchoRepDownLevelForm($add,$newstart); }
function sys_ReturnTogQuery($type, $id, $line, $classid = '', $mid = '') { global $empire, $public_r, $class_r, $class_zr, $navclassid, $dbtbpre, $class_tr, $emod_r; if ($type == 'tags') { $idf = 'tagid'; $orderf = 'newstime'; $table = $dbtbpre . 'enewstagsdata'; } else { $idf = 'spid'; $orderf = 'newstime'; $table = $dbtbpre . 'enewssp_2'; } $where = strstr($id, ',') ? "{$idf} in ({$id})" : "{$idf}='{$id}'"; //栏目 if ($classid) { if (strstr($classid, ',')) { $son_r = sys_ReturnMoreClass($classid, 1); $classid = $son_r[0]; $add = $son_r[1]; } else { if ($classid == 'selfinfo') { $classid = $navclassid; } if ($class_r[$classid][islast]) { $add = "classid='{$classid}'"; } else { $add = ReturnClass($class_r[$classid][sonclass]); } } $where .= ' and (' . $add . ')'; } //模型 if ($mid) { $where .= strstr($mid, ',') ? " and mid in ({$mid})" : " and mid='{$mid}'"; } $query = 'select classid,id from ' . $table . ' where ' . $where . ' order by ' . $orderf . ' desc limit ' . $line; $sql = $empire->query1($query); if (!$sql) { echo "SQL Error: " . ReRepSqlTbpre($query); } return $sql; }
function UpdateAllInfoPlnum($add, $userid, $username) { global $empire, $public_r, $class_r, $fun_r, $dbtbpre; //验证权限 CheckLevel($userid, $username, $classid, "changedata"); $start = (int) $add['start']; $tbname = RepPostVar($add['tbname']); $from = $add['from']; if (empty($tbname) || !eCheckTbname($tbname)) { printerror("ErrorUrl", "history.go(-1)"); } //按栏目刷新 $classid = (int) $add['classid']; if ($classid) { if (empty($class_r[$classid][islast])) { $where = ReturnClass($class_r[$classid][sonclass]); } else { $where = "classid='{$classid}'"; } $add1 = " and (" . $where . ")"; } //按ID刷新 $retype = (int) $add['retype']; if ($retype) { $startid = (int) $add['startid']; $endid = (int) $add['endid']; if ($endid) { $add1 .= " and id>={$startid} and id<={$endid}"; } } else { $startday = RepPostVar($add['startday']); $endday = RepPostVar($add['endday']); if ($startday && $endday) { $add1 .= " and truetime>=" . to_time($startday . " 00:00:00") . " and truetime<=" . to_time($endday . " 23:59:59"); } } //指定ID $doids = trim($add['doids']); $whereid = ''; if ($doids) { $doidr = explode(',', $doids); $doidcount = count($doidr); $wheredh = ''; for ($doi = 0; $doi < $doidcount; $doi++) { $whereid .= $wheredh . intval($doidr[$doi]); $wheredh = ','; } $add1 .= ' and id in (' . $whereid . ')'; } $b = 0; $sql = $empire->query("select id,classid,checked from {$dbtbpre}ecms_" . $tbname . "_index where id>{$start}" . $add1 . " order by id limit " . $public_r[infolinknum]); while ($r = $empire->fetch($sql)) { $b = 1; $new_start = $r['id']; //更信息评论数 UpdateSingleInfoPlnum($r['classid'], $r['id'], $r['checked']); } if (empty($b)) { insert_dolog(""); //操作日志 printerror("UpdateInfoPlnumSuccess", $from); } echo $fun_r[OneUpdateInfoPlnumSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)<script>self.location.href='ecmspl.php?enews=UpdateAllInfoPlnum&tbname={$tbname}&classid={$classid}&start={$new_start}&from=" . urlencode($from) . "&retype={$retype}&startday={$startday}&endday={$endday}&startid={$startid}&endid={$endid}&doids={$whereid}" . hReturnEcmsHashStrHref(0) . "';</script>"; exit; }
$htb = 1; $select = " selected"; } $tbs .= "<option value='" . $tbr[tbname] . "'" . $select . ">" . $tbr[tname] . "</option>"; } if ($htb == 0) { printerror('ErrorUrl', ''); } //栏目 $classid = (int) $_GET['classid']; if ($classid) { $and = $where ? ' and ' : ' where '; if ($class_r[$classid][islast]) { $where .= $and . "classid='{$classid}'"; } else { $where .= $and . "(" . ReturnClass($class_r[$classid][sonclass]) . ")"; } } //标题分类 $ttid = (int) $_GET['ttid']; if ($ttid) { $and = $where ? ' and ' : ' where '; $where .= $and . " ttid='{$ttid}'"; } $ttclass = ""; $tt_sql = $empire->query("select typeid,tname from {$dbtbpre}enewsinfotype order by typeid"); while ($tt_r = $empire->fetch($tt_sql)) { $selected = ''; if ($tt_r[typeid] == $ttid) { $selected = " selected"; }
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); }
$wapstyle = 0; $pr = array(); require "wapfun.php"; //栏目ID $classid = (int) $_GET['classid']; if (!$classid || !$class_r[$classid]['tbname'] || InfoIsInTable($class_r[$classid]['tbname'])) { DoWapShowMsg('您来自的链接不存在', 'index.php?style=' . $wapstyle); } $pagetitle = $class_r[$classid]['classname']; $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']; //每页显示记录数
$search = "&mid={$mid}"; //审核表 $ecmscheck = (int) $_GET['ecmscheck']; $addecmscheck = ''; $indexchecked = 1; if ($ecmscheck) { $search .= '&ecmscheck=' . $ecmscheck; $addecmscheck = '&ecmscheck=' . $ecmscheck; $indexchecked = 0; } $infotb = ReturnInfoMainTbname($mr['tbname'], $indexchecked); //显示方式 if ($public_r['qlistinfomod']) { $modnum = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsmod where tbname='{$mr['tbname']}'"); if ($modnum > 1) { $add .= ' and (' . ReturnClass($mr['sonclass']) . ')'; } } //搜索 $sear = RepPostStr($_GET['sear'], 1); $keyboard = ''; $show = ''; if ($sear) { $keyboard = RepPostVar2($_GET['keyboard']); $show = RepPostStr($_GET['show'], 1); //关键字 if ($keyboard) { $add .= " and (title like '%{$keyboard}%')"; } $search .= "&sear=1&keyboard={$keyboard}&show={$show}"; }
function ReturnSearchAllSql($add) { global $public_r, $class_r; //关闭 if (empty($public_r['openschall'])) { printerror("SchallClose", '', 1); } //关键字 $keyboard = RepPostVar2($add['keyboard']); if (!trim($keyboard)) { printerror('EmptySchallKeyboard', '', 1); } $strlen = strlen($keyboard); if ($strlen < $public_r['schallminlen'] || $strlen > $public_r['schallmaxlen']) { printerror('SchallMinKeyboard', '', 1); } $returnr['keyboard'] = ehtmlspecialchars($keyboard); $returnr['search'] = "&keyboard=" . $keyboard; //字段 $field = (int) $add['field']; if ($field) { $returnr['search'] .= "&field=" . $field; } if ($field == 1) { if ($public_r['schallfield'] != 1) { printerror('SchallNotOpenTitleText', '', 1); } $sf = "title,infotext"; } elseif ($field == 2) { if ($public_r['schallfield'] == 3) { printerror('SchallNotOpenTitle', '', 1); } $sf = "title"; } elseif ($field == 3) { if ($public_r['schallfield'] == 2) { printerror('SchallNotOpenText', '', 1); } $sf = "infotext"; } else { $sf = ReturnSearchAllField(0); } $where = ''; //栏目 $classid = RepPostVar($add['classid']); if ($classid) { $returnr['search'] .= "&classid=" . $classid; if (strstr($classid, ",")) { $son_r = sys_ReturnMoreClass($classid, 1); $where .= '(' . $son_r[1] . ') and '; } else { $classid = (int) $classid; $where .= $class_r[$classid][islast] ? "classid='{$classid}' and " : ReturnClass($class_r[$classid][sonclass]) . ' and '; } } //关键字 if (strstr($keyboard, ' ')) { $andkey = ''; $keyr = explode(' ', $keyboard); $kcount = count($keyr); for ($i = 0; $i < $kcount; $i++) { if (strlen($keyr[$i]) < $public_r['schallminlen']) { continue; } $kb = SearchAllChangeChar($keyr[$i]); //转码 $kb = SearchReturnSaveStr($kb); $kb = RepPostVar2($kb); if (!trim($kb)) { continue; } $where .= $andkey . "MATCH(" . $sf . ") AGAINST('" . $kb . "' IN BOOLEAN MODE)"; $andkey = ' and '; } if (empty($where)) { printerror('SchallMinKeyboard', '', 1); } } else { $keyboard = SearchAllChangeChar($keyboard); //转码 $keyboard = SearchReturnSaveStr($keyboard); $keyboard = RepPostVar2($keyboard); if (!trim($keyboard)) { printerror('EmptySchallKeyboard', '', 1); } $where .= "MATCH(" . $sf . ") AGAINST('" . $keyboard . "' IN BOOLEAN MODE)"; } $returnr['where'] = $where; return $returnr; }
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 DelMorePlByText($add, $logininid, $loginin) { global $empire, $dbtbpre, $class_r; CheckLevel($logininid, $loginin, $classid, "pl"); //验证权限 //变量处理 $saytext = RepPostStr($add['saytext']); if (!$saytext) { printerror("EmptyDelMorePl", "history.go(-1)"); } $classid = (int) $add['classid']; $where = ''; //栏目 if ($classid) { if (empty($class_r[$classid][islast])) { $cwhere = ReturnClass($class_r[$classid][sonclass]); } else { $cwhere = "classid='{$classid}'"; } $where .= $cwhere . ' and '; } //发布内容 $twhere = ''; $or = ''; $tr = explode('|', $saytext); $count = count($tr); for ($i = 0; $i < $count; $i++) { $twhere .= $or . "saytext like '%" . $tr[$i] . "%'"; $or = ' or '; } $where .= '(' . $twhere . ')'; $tbr = $empire->fetch1("select pldatatbs from {$dbtbpre}enewspublic limit 1"); if ($tbr['pldatatbs']) { $dtbr = explode(',', $tbr['pldatatbs']); $tcount = count($dtbr) - 1; for ($ti = 1; $ti < $tcount; $ti++) { $sql = $empire->query("select plid,id,classid from {$dbtbpre}enewspl_data_" . $dtbr[$ti] . " where " . $where); while ($r = $empire->fetch($sql)) { if ($class_r[$r[classid]][tbname]) { $empire->query("update {$dbtbpre}ecms_" . $class_r[$r[classid]][tbname] . " set plnum=plnum-1 where id='{$r['id']}'"); } $empire->query("delete from {$dbtbpre}enewspl where plid='{$r['plid']}'"); $empire->query("delete from {$dbtbpre}enewspl_data_" . $dtbr[$ti] . " where plid='{$r['plid']}'"); } } } insert_dolog(""); //操作日志 printerror("DelPlSuccess", "DelMorePl.php"); }
function DelClass1($classid) { global $empire, $class_r, $dbtbpre; $r = $empire->fetch1("select * from {$dbtbpre}enewsclass where classid='{$classid}'"); //外部栏目 if ($r[wburl]) { $sql = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'"); //删除缓存 DelListEnews(); return ""; } //删除终极栏目 if ($r[islast]) { //删除附件 DelClassTranFile($classid); $filepath = "../../d/file/" . $r[classpath]; $delf = DelPath($filepath); $usql = $empire->query("delete from {$dbtbpre}enewsfile where classid='{$classid}'"); //删除信息 $sql = $empire->query("delete from {$dbtbpre}ecms_" . $r[tbname] . " where classid='{$classid}'"); DelClassTbDataInfo($classid); //删除信息附加表 $delsql = $empire->query("delete from {$dbtbpre}enewswfinfo where classid='{$classid}'"); $delsql = $empire->query("delete from {$dbtbpre}enewswfinfolog where classid='{$classid}'"); $delsql = $empire->query("delete from {$dbtbpre}enewsinfovote where classid='{$classid}'"); $delsql = $empire->query("delete from {$dbtbpre}enewsdiggips where classid='{$classid}'"); //删除栏目本身 $sql1 = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'"); $delpath = "../../" . $r[classpath]; $del = DelPath($delpath); //更新大栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $bsql = $empire->query("select sonclass,classid from {$dbtbpre}enewsclass where " . $where); while ($br = $empire->fetch($bsql)) { $newsonclass = str_replace("|" . $classid . "|", "|", $br[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$br['classid']}'"); } } else { //删除栏目 $where = ReturnClass($r[sonclass]); if (empty($where)) { $where = "classid=0"; } $delcr = explode("|", $r[sonclass]); $count = count($delcr); for ($i = 1; $i < $count - 1; $i++) { $delcid = $delcr[$i]; //删除附件 DelClassTranFile($delcid); $sql = $empire->query("delete from {$dbtbpre}ecms_" . $class_r[$delcid][tbname] . " where classid='{$delcid}'"); DelClassTbDataInfo($delcid); //删除信息附加表 $delsql = $empire->query("delete from {$dbtbpre}enewswfinfo where classid='{$delcid}'"); $delsql = $empire->query("delete from {$dbtbpre}enewswfinfolog where classid='{$delcid}'"); $delsql = $empire->query("delete from {$dbtbpre}enewsinfovote where classid='{$delcid}'"); $delsql = $empire->query("delete from {$dbtbpre}enewsdiggips where classid='{$delcid}'"); } //删除附件 $filepath = "../../d/file/" . $r[classpath]; $delf = DelPath($filepath); if ($where != 'classid=0') { $usql = $empire->query("delete from {$dbtbpre}enewsfile where " . $where); } //删除子栏目副表 $fcsql = $empire->query("select classid from {$dbtbpre}enewsclass where featherclass like '%|" . $classid . "|%'"); while ($fcr = $empire->fetch($fcsql)) { $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$fcr['classid']}'"); } //删除子栏目 $sql1 = $empire->query("delete from {$dbtbpre}enewsclass where featherclass like '%|" . $classid . "|%'"); //改变父栏目的子类 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $bbsql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where); while ($bbr = $empire->fetch($bbsql)) { $newsonclass = str_replace($r[sonclass], "|", $bbr[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid='{$bbr['classid']}'"); } //删除栏目本身 $sql2 = $empire->query("delete from {$dbtbpre}enewsclass where classid='{$classid}'"); $empire->query("delete from {$dbtbpre}enewsclassadd where classid='{$classid}'"); $delpath = "../../" . $r[classpath]; $del = DelPath($delpath); } //删除缓存 DelListEnews(); }