fetch1("select tbname from {$dbtbpre}enewstable where tid='$tid'");
$tbname=$tbr['tbname'];
}
if(!$tbname)
{
printerror('ErrorUrl','');
}
//碎片
$sps='';
$dh='';
for($spi=0;$spi<$spcount;$spi++)
{
$myspid=intval($spid[$spi]);
if(!$myspid)
{
continue;
}
$spr=$empire->fetch1("select spid,sptype,maxnum,groupid,userclass,username,isclose,cladd from {$dbtbpre}enewssp where spid='$myspid'");
if(empty($spr[spid]))
{
continue;
}
if($spr[isclose])
{
continue;
}
if($spr[sptype]!=2)
{
continue;
}
if($spr[cladd]&&!CheckDoLevel($lur,$spr[groupid],$spr[userclass],$spr[username],1))
{
continue;
}
for($i=0;$i<$count;$i++)
{
$myid=intval($id[$i]);
$infor=$empire->fetch1("select classid,newstime from {$dbtbpre}ecms_".$tbname."_index where id='$myid'");
$rer=$empire->fetch1("select sid from {$dbtbpre}enewssp_2 where spid='$myspid' and id='$myid' and classid='$infor[classid]' limit 1");
if($rer['sid'])
{
$empire->query("update {$dbtbpre}enewssp_2 set newstime='$infor[newstime]' where sid='".$rer['sid']."'");
}
else
{
$empire->query("insert into {$dbtbpre}enewssp_2(spid,classid,id,newstime) values('$myspid','$infor[classid]','$myid','$infor[newstime]');");
}
}
$sps.=$dh.$myspid;
$dh=',';
//删除多余碎片信息
DelMoreSpInfo($myspid,$spr);
}
//操作日志
insert_dolog("classid=$classid&tid=$tid
spid=".$sps."
id=".$add[ids]);
echo"";
exit();
}
//删除多余碎片信息
function DelMoreSpInfo($spid,$spr){
global $empire,$dbtbpre;
if(!$spr[maxnum]||$spr[sptype]==3)
{
return '';
}
if($spr[sptype]==1)
{
$num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewssp_1 where spid='$spid'");
if($num>$spr[maxnum])
{
$limitnum=$num-$spr[maxnum];
$ids='';
$dh='';
$sql=$empire->query("select sid from {$dbtbpre}enewssp_1 where spid='$spid' order by sid limit ".$limitnum);
while($r=$empire->fetch($sql))
{
$ids.=$dh.$r['sid'];
$dh=',';
}
$empire->query("delete from {$dbtbpre}enewssp_1 where sid in ($ids)");
}
}
elseif($spr[sptype]==2)
{
$num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewssp_2 where spid='$spid'");
if($num>$spr[maxnum])
{
$limitnum=$num-$spr[maxnum];
$ids='';
$dh='';
$sql=$empire->query("select sid from {$dbtbpre}enewssp_2 where spid='$spid' order by sid limit ".$limitnum);
while($r=$empire->fetch($sql))
{
$ids.=$dh.$r['sid'];
$dh=',';
}
$empire->query("delete from {$dbtbpre}enewssp_2 where sid in ($ids)");
}
}
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
}
if($enews=='PushInfoToSp')//增加碎片
{
PushInfoToSp($_POST,$logininid,$loginin);
}
//审核表
$addecmscheck='';
$ecmscheck=(int)$_GET['ecmscheck'];
$indexchecked=1;
if($ecmscheck)
{
$addecmscheck='&ecmscheck='.$ecmscheck;
$indexchecked=0;
}
$add='';
//分类
$cid=(int)$_GET['cid'];
if($cid)
{
$add.=" and cid='$cid'";
}
//栏目
$classid=(int)$_GET['classid'];
if($classid)
{
$classwhere=ReturnClass($class_r[$classid][featherclass]);
$add.=" and (classid=0 or classid='$classid' or (".$classwhere."))";
}
//表ID
$tid=(int)$_GET['tid'];
//ID
$ids=RepPostStr($_GET['id'],1);
if(!$ids)
{
echo"";
exit();
}
$query="select spid,spname,varname,sppic,spsay from {$dbtbpre}enewssp where sptype=2 and isclose=0 and (cladd=0 or (cladd=1 and (groupid like '%,".$lur[groupid].",%' or userclass like '%,".$lur[classid].",%' or username like '%,".$lur[username].",%')))".$add." order by spid desc";
$sql=$empire->query($query);
//分类
$scstr="";
$scsql=$empire->query("select classid,classname from {$dbtbpre}enewsspclass order by classid");
while($scr=$empire->fetch($scsql))
{
$select="";
if($scr[classid]==$cid)
{
$select=" selected";
}
$scstr.="";
}
?>
位置: 推送信息到碎片
|