Exemplo n.º 1
0
function ClearSearchAll($start, $line, $userid, $username)
{
    global $empire, $dbtbpre, $class_r, $fun_r;
    $line = (int) $line;
    if (empty($line)) {
        $line = 500;
    }
    $start = (int) $start;
    $b = 0;
    $sql = $empire->query("select id,classid,sid from {$dbtbpre}enewssearchall where sid>{$start} order by sid limit " . $line);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r['sid'];
        if (empty($class_r[$r[classid]]['tbname'])) {
            $empire->query("delete from {$dbtbpre}enewssearchall where sid='" . $r['sid'] . "'");
            continue;
        }
        $num = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[classid]]['tbname'] . "_index where id='{$r['id']}' and classid='{$r['classid']}' limit 1");
        if (!$num) {
            $empire->query("delete from {$dbtbpre}enewssearchall where sid='" . $r['sid'] . "'");
        }
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror('ClearSearchAllSuccess', 'ClearSearchAll.php' . hReturnEcmsHashStrHref2(1));
    }
    echo "<meta http-equiv=\"refresh\" content=\"0;url=ClearSearchAll.php?enews=ClearSearchAll&line={$line}&start={$newstart}" . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneClearSearchAllSuccess] . "(ID:<font color=red><b>" . $newstart . "</b></font>)";
    exit;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
function ClearTags($start, $line, $userid, $username)
{
    global $empire, $dbtbpre, $class_r, $fun_r;
    $line = (int) $line;
    if (empty($line)) {
        $line = 500;
    }
    $start = (int) $start;
    $b = 0;
    $sql = $empire->query("select id,classid,tid,tagid from {$dbtbpre}enewstagsdata where tid>{$start} order by tid limit " . $line);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r['tid'];
        if (empty($class_r[$r[classid]]['tbname'])) {
            $empire->query("delete from {$dbtbpre}enewstagsdata where tid='{$r['tid']}'");
            $empire->query("update {$dbtbpre}enewstags set num=num-1 where tagid='{$r['tagid']}'");
            continue;
        }
        $index_r = $empire->fetch1("select id,classid,checked from {$dbtbpre}ecms_" . $class_r[$r[classid]]['tbname'] . "_index where id='{$r['id']}' limit 1");
        if (!$index_r['id']) {
            $empire->query("delete from {$dbtbpre}enewstagsdata where tid='{$r['tid']}'");
            $empire->query("update {$dbtbpre}enewstags set num=num-1 where tagid='{$r['tagid']}'");
        } else {
            //返回表
            $infotb = ReturnInfoMainTbname($class_r[$r[classid]]['tbname'], $index_r['checked']);
            //主表
            $infor = $empire->fetch1("select stb from " . $infotb . " where id='{$r['id']}' limit 1");
            //返回表信息
            $infodatatb = ReturnInfoDataTbname($class_r[$r[classid]]['tbname'], $index_r['checked'], $infor['stb']);
            //副表
            $finfor = $empire->fetch1("select infotags from " . $infodatatb . " where id='{$r['id']}' limit 1");
            $tagr = $empire->fetch1("select tagname from {$dbtbpre}enewstags where tagid='{$r['tagid']}'");
            if (!stristr(',' . $finfor['infotags'] . ',', ',' . $tagr['tagname'] . ',')) {
                $empire->query("delete from {$dbtbpre}enewstagsdata where tid='{$r['tid']}'");
                $empire->query("update {$dbtbpre}enewstags set num=num-1 where tagid='{$r['tagid']}'");
            } elseif ($index_r['classid'] != $r[classid]) {
                $empire->query("update {$dbtbpre}enewstagsdata set classid='{$index_r['classid']}' where tid='{$r['tid']}'");
            }
        }
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror('ClearTagsSuccess', 'ClearTags.php' . hReturnEcmsHashStrHref2(1));
    }
    echo "<meta http-equiv=\"refresh\" content=\"0;url=ClearTags.php?enews=ClearTags&line={$line}&start={$newstart}" . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneClearTagsSuccess] . "(ID:<font color=red><b>" . $newstart . "</b></font>)";
    exit;
}
Exemplo n.º 4
0
function UpdateClassInfosAll($add)
{
    global $empire, $public_r, $fun_r, $class_r, $dbtbpre;
    $start = (int) $add['start'];
    $from = $add['from'];
    $b = 0;
    //栏目
    $sql = $empire->query("select classid from {$dbtbpre}enewsclass where classid>{$start} and islast=1 order by classid limit " . $public_r[relistnum]);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $end_classid = $r['classid'];
        ResetClassInfos($r['classid']);
    }
    if (empty($b)) {
        insert_dolog('');
        //操作日志
        printerror('UpdateClassInfosAllSuccess', $from);
    }
    echo "<meta http-equiv=\"refresh\" content=\"" . $public_r['realltime'] . ";url=ecmschtml.php?enews=UpdateClassInfosAll&start={$end_classid}&from=" . urlencode($from) . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneUpdateClassInfosSuccess] . "(ID:<font color=red><b>" . $end_classid . "</b></font>)";
    exit;
}
Exemplo n.º 5
0
function ReAdJs_all($start = 0, $from, $userid, $username)
{
    global $empire, $public_r, $fun_r, $dbtbpre;
    $start = (int) $start;
    if (empty($start)) {
        $start = 0;
    }
    $b = 0;
    $sql = $empire->query("select adid from {$dbtbpre}enewsad where adid>{$start} order by adid limit " . $public_r['readjsnum']);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[adid];
        GetAdJs($r[adid]);
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror("ReAdJsSuccess", $from);
    }
    echo $fun_r['OneReAdJsSuccess'] . "(ID:<font color=red><b>" . $newstart . "</b></font>)<script>self.location.href='ListAd.php?enews=ReAdJs_all&start={$newstart}&from=" . urlencode($from) . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Exemplo n.º 6
0
function Moreport_ReIndexfileAll($add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r, $ecms_config, $fun_r;
    $addcs = Moreport_ChangeAddCs($add);
    if (!$add['doreindex']) {
        insert_dolog("");
        //操作日志
        printerror("MoreportChangeAllDataSuccess", "ListMoreport.php" . hReturnEcmsHashStrHref2(1));
    }
    $start = (int) $add['start'];
    $num = 1;
    $b = 0;
    $sql = $empire->query("select * from {$dbtbpre}enewsmoreport where pid>{$start} order by pid limit " . $num);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $new_start = $r['pid'];
        if ($r['pid'] == 1) {
            continue;
        }
        if (!$r['ppath'] || !file_exists($r['ppath'] . 'e/config/config.php')) {
            continue;
        }
        define('ECMS_SELFPATH', $r['ppath']);
        Moreport_ChangeData($r, 4);
    }
    if (empty($b)) {
        insert_dolog("");
        //操作日志
        printerror("MoreportChangeAllDataSuccess", "ListMoreport.php" . hReturnEcmsHashStrHref2(1));
        //echo $fun_r[MoreportReIndexfileSuccess]."<script>self.location.href='ListMoreport.php?enews=MoreportReIndexfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
        exit;
    }
    echo "<meta http-equiv=\"refresh\" content=\"" . $public_r['realltime'] . ";url=ListMoreport.php?enews=MoreportReIndexfileAll&start={$new_start}" . $addcs . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneMoreportReIndexfileSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)";
    exit;
}
Exemplo n.º 7
0
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;
}
Exemplo n.º 8
0
function ChangeInfoOtherLink($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)");
    }
	//按栏目刷新
	$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[infolinknum]);
	while($r=$empire->fetch($sql))
	{
		$b=1;
		$new_start=$r[id];
		//手动相关链接
		$pubid=ReturnInfoPubid($r['classid'],$r['id']);
		$infopr=$empire->fetch1("select diyotherlink from {$dbtbpre}enewsinfovote where pubid='$pubid' limit 1");
		if($infopr['diyotherlink'])
		{
			continue;
		}
		//返回表
		$infotb=ReturnInfoMainTbname($tbname,$r['checked']);
		$infor=$empire->fetch1("select stb,keyboard from ".$infotb." where id='$r[id]' limit 1");
		//返回表信息
		$infodatatb=ReturnInfoDataTbname($tbname,$r['checked'],$infor['stb']);
		$newkeyid=GetKeyid($infor[keyboard],$r[classid],$r[id],$class_r[$r[classid]][link_num]);
		$usql=$empire->query("update ".$infodatatb." set keyid='$newkeyid' where id='$r[id]' limit 1");
	}
	if(empty($b))
	{
	    insert_dolog("");//操作日志
		printerror("ChangeInfoLinkSuccess",$from);
	}
	echo $fun_r[OneChangeInfoLinkSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)<script>self.location.href='ecmscom.php?enews=ChangeInfoOtherLink&tbname=$tbname&classid=$classid&start=$new_start&from=".urlencode($from)."&retype=$retype&startday=$startday&endday=$endday&startid=$startid&endid=$endid".hReturnEcmsHashStrHref(0)."';</script>";
	exit();
}
Exemplo n.º 9
0
}
$btb = explode(",", $b_table);
$tbcount = count($btb);
//最后一个文件
if ($p >= $tb[$btb[$t]]) {
    $t++;
    //恢复完毕
    if ($t >= $tbcount) {
        if ($ecms_config['db']['dbname'] != $mydbname) {
            $use = $empire->usequery("use " . $ecms_config['db']['dbname']);
        }
        $enews = "ReData";
        //操作日志
        insert_dolog("dbname=" . $mydbname . "&path=" . $mypath);
        $varmessage = $fun_r['ReDataSuccess'] . "<br><br>" . $fun_r['TotalUseTime'] . ToChangeUseTime($stime);
        $GLOBALS['varmessage'] = $varmessage;
        printerror('VarMessage', '../../ReData.php' . hReturnEcmsHashStrHref2(1), 0, 1);
    }
    $nfile = $btb[$t] . "_1.php";
    //进入下一个表
    //echo $btb[$t-1].$fun_r['ReOneTableSuccess']."<script>self.location.href='$nfile?t=$t&p=0&mydbname=$mydbname&mypath=$mypath&stime=$stime".hReturnEcmsHashStrHref(0)."';</script>";
    echo "<meta http-equiv=\"refresh\" content=\"" . $waitbaktime . ";url={$nfile}?t={$t}&p=0&mydbname={$mydbname}&mypath={$mypath}&stime={$stime}&waitbaktime={$waitbaktime}" . hReturnEcmsHashStrHref(0) . "\">" . $btb[$t - 1] . $fun_r['ReOneTableSuccess'];
    exit;
}
//进入下一个文件
$p++;
$nfile = $btb[$t] . "_" . $p . ".php";
//echo $fun_r['ReOneDataSuccess'].Ebak_EchoReDataSt($btb[$t],$tbcount,$t,$tb[$btb[$t]],$p)."<script>self.location.href='$nfile?t=$t&p=$p&mydbname=$mydbname&mypath=$mypath&stime=$stime".hReturnEcmsHashStrHref(0)."';</script>";
echo "<meta http-equiv=\"refresh\" content=\"" . $waitbaktime . ";url={$nfile}?t={$t}&p={$p}&mydbname={$mydbname}&mypath={$mypath}&stime={$stime}&waitbaktime={$waitbaktime}" . hReturnEcmsHashStrHref(0) . "\">" . $fun_r['ReOneDataSuccess'] . Ebak_EchoReDataSt($btb[$t], $tbcount, $t, $tb[$btb[$t]], $p);
db_close();
$empire = null;
Exemplo n.º 10
0
function ChangeSonclass($start, $userid, $username)
{
    global $empire, $public_r, $fun_r, $dbtbpre;
    //验证权限
    CheckLevel($userid, $username, $classid, "changedata");
    $start = (int) $start;
    $b = 0;
    $sql = $empire->query("select classid from {$dbtbpre}enewsclass where islast=0 and classid>" . $start . " order by classid limit " . $public_r[relistnum]);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[classid];
        //子栏目
        $sonclass = "|";
        $ssql = $empire->query("select classid from {$dbtbpre}enewsclass where islast=1 and featherclass like '%|" . $r[classid] . "|%' order by classid");
        while ($sr = $empire->fetch($ssql)) {
            $sonclass .= $sr[classid] . "|";
        }
        $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$sonclass}' where classid='{$r['classid']}'");
    }
    //完毕
    if (empty($b)) {
        GetClass();
        printerror("ChangeSonclassSuccess", "ReHtml/ChangeData.php" . hReturnEcmsHashStrHref2(1));
    }
    echo $fun_r['OneChangeSonclassSuccess'] . "(ID:<font color=red><b>" . $newstart . "</b></font>)<script>self.location.href='ecmsclass.php?enews=ChangeSonclass&start={$newstart}" . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Exemplo n.º 11
0
function InfoToDoc($add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r, $class_r;
    //操作权限
    CheckLevel($userid, $username, $classid, "infodoc");
    $tbname = RepPostVar($add['tbname']);
    if (empty($tbname)) {
        printerror("EmptyDocTb", "");
    }
    $selecttbname = $tbname;
    if ($add['doing'] == 1) {
        $selecttbname = $tbname . '_doc';
    }
    $search = "&retype={$add['retype']}";
    if ($add['retype'] == 0) {
        if ($add['doing'] == 1) {
            $doctime = (int) $add['doctime1'];
            $dx = ">";
        } else {
            $doctime = (int) $add['doctime'];
            $dx = "<";
        }
        if (!$doctime) {
            printerror("EmptyDoctime", "");
        }
        $chtime = time() - $doctime * 24 * 3600;
        $where = 'truetime' . $dx . $chtime;
        $log = "doctime={$doctime}";
        $search .= "&doctime={$add['doctime']}&doctime1={$add['doctime1']}";
    } elseif ($add['retype'] == 1) {
        $startday = RepPostVar($add['startday']);
        $endday = RepPostVar($add['endday']);
        if (!$endday) {
            printerror("EmptyDocDay", "");
        }
        if ($startday) {
            $where = "truetime>=" . to_time($startday . " 00:00:00") . " and ";
        }
        $where .= "truetime<=" . to_time($endday . " 23:59:59");
        $log = "startday={$startday}&endday={$endday}";
        $search .= "&startday={$add['startday']}&endday={$add['endday']}";
    } else {
        $startid = (int) $add['startid'];
        $endid = (int) $add['endid'];
        if (!$endid) {
            printerror("EmptyDocId", "");
        }
        if ($startid) {
            $where = "id>=" . $startid . " and ";
        }
        $where .= "id<=" . $endid;
        $log = "startid={$startid}&endid={$endid}";
        $search .= "&startid={$add['startid']}&endid={$add['endid']}";
    }
    //栏目
    $classid = $add['classid'];
    $count = count($classid);
    if ($count) {
        for ($i = 0; $i < $count; $i++) {
            $dh = ",";
            if ($i == 0) {
                $dh = "";
            }
            $ids .= $dh . intval($classid[$i]);
            $search .= '&classid[]=' . $classid[$i];
        }
        $where .= " and classid in (" . $ids . ")";
    }
    $log .= "<br>doing={$add['doing']}";
    $start = (int) $add['start'];
    $line = $public_r['docnewsnum'];
    $b = 0;
    $sql = $empire->query("select * from {$dbtbpre}ecms_" . $selecttbname . " where id>{$start} and " . $where . " order by id limit " . $line);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $new_start = $r['id'];
        DoDocInfo($tbname, $r, $add['doing']);
    }
    if (empty($b)) {
        //未审核信息归档
        DoDocCkInfo($tbname, $where, $add['doing']);
        $add['docfrom'] = urldecode($add['docfrom']);
        //操作日志
        insert_dolog("tbname=" . $tbname . $log . "&doing={$add['doing']}&do=2");
        printerror("InfoToDocSuccess", $add['docfrom']);
    }
    echo $fun_r[OneInfoToDocSuccess] . "(ID:<font color=red><b>" . $new_start . "</b></font>)<script>self.location.href='ecmsinfo.php?enews=InfoToDoc&ecmsdoc=2&doing={$add['doing']}&tbname={$tbname}&start={$new_start}&docfrom=" . urlencode($add[docfrom]) . $search . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Exemplo n.º 12
0
function LoadTempInClass($path, $start, $userid, $username)
{
    global $empire, $public_r, $dbtbpre;
    //验证权限
    CheckLevel($userid, $username, $classid, "template");
    $start = (int) $start;
    if (empty($public_r[loadtempnum])) {
        $public_r[loadtempnum] = 50;
    }
    $b = 0;
    $sql = $empire->query("select classid,classtempid,islist from {$dbtbpre}enewsclass where islast=0 and islist<>1 and classid>{$start} order by classid limit " . $public_r[loadtempnum]);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[classid];
        if ($r[islist] == 3) {
            continue;
        }
        $file = "../data/LoadTemp/" . $r[classid] . ".htm";
        if (file_exists($file)) {
            $data = addslashes(addslashes(ReadFiletext($file)));
            $data = RepPhpAspJspcode($data);
            if ($r[islist] == 2) {
                $usql = $empire->query("update {$dbtbpre}enewsclassadd set classtext='" . $data . "' where classid='{$r['classid']}'");
            } else {
                $usql = $empire->query("update {$dbtbpre}enewsclasstemp set temptext='" . $data . "' where tempid='{$r['classtempid']}'");
            }
            NewsBq($r[classid], $data, 0, 0);
        }
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror("LoadClassTempSuccess", "template/LoadTemp.php" . hReturnEcmsHashStrHref2(1));
    }
    echo $fun_r['LoadOneTempSuccess'] . "(ID:<font color=red><b>" . $newstart . "</b></font>)<script>self.location.href='ecmstemp.php?enews=LoadTempInClass&start={$newstart}" . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Exemplo n.º 13
0
function Ebak_ReData($add,$mypath,$userid,$username){
	global $empire,$public_r;
	//验证权限
	CheckLevel($userid,$username,$classid,"dbdata");
	$mypath=RepPostStr($mypath,1);
	$add[mydbname]=RepPostStr($add[mydbname],1);
	if(empty($mypath)||empty($add[mydbname]))
	{printerror("EmptyDbnamePath","history.go(-1)");}
	$bakpath=$public_r['bakdbpath'];
	$path=$bakpath."/".$mypath;
	if(!file_exists($path))
	{
		printerror("DbPathNotExist","history.go(-1)");
    }
	@include($path."/config.php");
	if(empty($b_table))
	{
		printerror("BakCsError","history.go(-1)");
	}
	$waitbaktime=(int)$add['waitbaktime'];
	$btb=explode(",",$b_table);
	$nfile=$path."/".$btb[0]."_1.php?t=0&p=0&mydbname=$add[mydbname]&mypath=$mypath&waitbaktime=$waitbaktime".hReturnEcmsHashStrHref(0);
	Header("Location:$nfile");
	exit();
}
Exemplo n.º 14
0
function PostUrlData($start, $rnd, $userid, $username)
{
    global $empire, $fun_r, $dbtbpre, $incftp;
    $rnd = RepPostVar($rnd);
    if (empty($rnd)) {
        printerror("FailCX", "history.go(-1)");
    }
    //操作权限
    CheckLevel($userid, $username, $classid, "postdata");
    //链接FTP
    if (empty($incftp)) {
        @(include ECMS_PATH . DASHBOARD . "/class/ftp.php");
    }
    $pr = ReturnFtpInfo($ftpid);
    $e = new EmpireCMSFTP();
    $e->fconnect($pr[ftphost], $pr[ftpport], $pr[ftpusername], $pr[ftppassword], $pr[ftppath], $pr[ftpssl], $pr[ftppasv], $pr[ftpmode], $pr[ftpouttime]);
    FtpChPath($e, $pr);
    $line = (int) $_GET['line'];
    //每10个为一组
    $start = (int) $start;
    $b = 0;
    $sql = $empire->query("select postid,postdata,ispath from {$dbtbpre}enewspostdata where rnd='{$rnd}' and postid>{$start} order by postid limit " . $line);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[postid];
        //文件
        if ($r[ispath]) {
            $fr = explode(",", $r[postdata]);
            for ($i = 0; $i < count($fr); $i++) {
                $e->fTranFile(FtpRTruePath($pr[ftppath], $fr[$i]), ECMS_PATH . $fr[$i]);
            }
        } else {
            $e->ftp_copy(ECMS_PATH . $r[postdata], FtpRTruePath($pr[ftppath], $r[postdata]));
        }
    }
    $e->fExit();
    if (empty($b)) {
        $sql = $empire->query("delete from {$dbtbpre}enewspostdata where rnd='{$rnd}'");
        //操作日志
        insert_dolog("");
        printerror("PostDataSuccess", "PostUrlData.php" . hReturnEcmsHashStrHref2(1));
    }
    echo $fun_r[OnePostDataSuccess] . "<script>self.location.href='enews.php?enews=PostUrlData&start={$newstart}&line={$line}&rnd={$rnd}" . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}
Exemplo n.º 15
0
function DoTimeRepage($time)
{
    global $empire, $dbtbpre;
    if (empty($time)) {
        $time = 120;
    }
    echo "<meta http-equiv=\"refresh\" content=\"" . $time . ";url=DoTimeRepage.php" . hReturnEcmsHashStrHref(1) . "\">";
    DoAutoUpAndDownInfo();
    //自动上/下线
    $todaytime = time();
    $b = 0;
    $sql = $empire->query("select doing,classid,doid from {$dbtbpre}enewsdo where isopen=1 and lasttime+dotime*60<{$todaytime}");
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        if ($r[doing] == 1) {
            $cr = explode(',', $r[classid]);
            $count = count($cr) - 1;
            for ($i = 1; $i < $count; $i++) {
                if (empty($cr[$i])) {
                    continue;
                }
                $cr[$i] = (int) $cr[$i];
                ReListHtml($cr[$i], 1);
            }
        } elseif ($r[doing] == 2) {
            $cr = explode(',', $r[classid]);
            $count = count($cr) - 1;
            for ($i = 1; $i < $count; $i++) {
                if (empty($cr[$i])) {
                    continue;
                }
                $cr[$i] = (int) $cr[$i];
                ListHtmlIndex($cr[$i], $ret_r[0], 0);
            }
        } elseif ($r[doing] == 3) {
            $cr = explode(',', $r[classid]);
            $count = count($cr) - 1;
            for ($i = 1; $i < $count; $i++) {
                if (empty($cr[$i])) {
                    continue;
                }
                $cr[$i] = (int) $cr[$i];
                $ur = $empire->fetch1("select listid,pagetitle,filepath,filetype,totalsql,listsql,maxnum,lencord,listtempid,pagekeywords,pagedescription from {$dbtbpre}enewsuserlist where listid='" . $cr[$i] . "'");
                ReUserlist($ur, "");
            }
        } elseif ($r[doing] == 4) {
            $cr = explode(',', $r[classid]);
            $count = count($cr) - 1;
            for ($i = 1; $i < $count; $i++) {
                if (empty($cr[$i])) {
                    continue;
                }
                $cr[$i] = (int) $cr[$i];
                $ur = $empire->fetch1("select id,path,pagetext,title,pagetitle,pagekeywords,pagedescription,tempid from {$dbtbpre}enewspage where id='" . $cr[$i] . "'");
                ReUserpage($ur[id], $ur[pagetext], $ur[path], $ur[title], $ur[pagetitle], $ur[pagekeywords], $ur[pagedescription], $ur[tempid]);
            }
        } elseif ($r[doing] == 5) {
            $cr = explode(',', $r[classid]);
            $count = count($cr) - 1;
            for ($i = 1; $i < $count; $i++) {
                if (empty($cr[$i])) {
                    continue;
                }
                $cr[$i] = (int) $cr[$i];
                $ur = $empire->fetch1("select jsid,jsname,jssql,jstempid,jsfilename from {$dbtbpre}enewsuserjs where jsid='" . $cr[$i] . "'");
                ReUserjs($ur, '');
            }
        } elseif ($r[doing] == 6) {
            $cr = explode(',', $r[classid]);
            $count = count($cr) - 1;
            for ($i = 1; $i < $count; $i++) {
                if (empty($cr[$i])) {
                    continue;
                }
                $cr[$i] = (int) $cr[$i];
                ListHtml($cr[$i], $ret_r, 5);
            }
        } else {
            $indextemp = GetIndextemp();
            NewsBq($classid, $indextemp, 1, 0);
        }
        $empire->query("update {$dbtbpre}enewsdo set lasttime={$todaytime} where doid='{$r['doid']}'");
    }
    if ($b) {
        echo "最后执行时间:" . date("Y-m-d H:i:s", $todaytime) . "<br><br>";
    }
}
Exemplo n.º 16
0
function GetNewsInfo($classid, $checkrnd, $start, $userid, $username)
{
    global $empire, $class_r, $fun_r, $dbtbpre;
    $userid = (int) $userid;
    $classid = (int) $classid;
    $start = (int) $start;
    $checkrnd = RepPostVar($checkrnd);
    if (empty($classid) || empty($checkrnd)) {
        printerror("FailCX", "ListInfoClass.php" . hReturnEcmsHashStrHref2(1));
    }
    //验证权限
    CheckLevel($userid, $username, $classid, "cj");
    $r = $empire->fetch1("select * from {$dbtbpre}enewsinfoclass where classid='{$classid}'");
    //副表
    $ra = $empire->fetch1("select * from {$dbtbpre}ecms_infoclass_" . $r[tbname] . " where classid='{$classid}'");
    //组合两数组
    $r = TogTwoArray($r, $ra);
    //导入编码文件
    if ($r['enpagecode']) {
        @(include_once ECMS_PATH . DASHBOARD . "/class/doiconv.php");
    }
    //取得模型
    $record = "<!--record-->";
    $field = "<!--field--->";
    $mr = $empire->fetch1("select cj,tid,tbname from {$dbtbpre}enewsmod where mid='" . $class_r[$r[newsclassid]][modid] . "'");
    $cjr = explode($record, $mr[cj]);
    $count = count($cjr);
    if (empty($start)) {
        $start = 0;
    }
    $b = 0;
    $sql = $empire->query("select linkid,newsurl,titlepic from {$dbtbpre}enewslinktmp where checkrnd='{$checkrnd}' and linkid>" . $start . " order by linkid limit " . $r[renum]);
    //采集时间
    $newstime = date("Y-m-d H:i:s");
    $truetime = time();
    $tmptime = $newstime;
    while ($nr = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $nr[linkid];
        if (!eCheckCjUrl($nr[newsurl], 1)) {
            continue;
        }
        //入库数据库是否有记录
        if (empty($r[recjtheurl])) {
            $tmpnum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_" . $r[tbname] . " where oldurl='{$nr['newsurl']}' limit 1");
            if ($tmpnum) {
                continue;
            }
        }
        //取得远程页面,三次取不到值的将不取值
        for ($i = 1; $i <= 3; $i++) {
            $info = ReadFiletext($nr[newsurl]);
            if (!empty($info)) {
                break;
            }
        }
        if (empty($info)) {
            continue;
        }
        //替换网页变量
        $info = RepCjPagetextStr($info, $r);
        //替换回车
        $info = ReplaceFc($info);
        //-----------------
        $ifield = "";
        $ivalue = "";
        $next = 0;
        for ($c = 0; $c < $count - 1; $c++) {
            $zzvalue = "";
            $cjr1 = explode($field, $cjr[$c]);
            $dofield = $cjr1[1];
            $var = "zz_" . $dofield;
            $var1 = "z_" . $dofield;
            $var2 = "qz_" . $dofield;
            $var3 = "save_" . $dofield;
            //标题图片
            if ($dofield == "titlepic") {
                if ($nr[titlepic]) {
                    $zzvalue = $nr[titlepic];
                    $ifield .= "," . $dofield;
                    $ivalue .= ",'" . addslashes($zzvalue) . "'";
                    continue;
                }
            }
            //图片集
            if ($dofield == "morepic" && $r[$var]) {
                //替换下载链接
                $text = $r[$var];
                //替换回车
                $text = ReplaceFc($text);
                $down = explode("[!empirecms!]", $text);
                //小图
                $zztext = RepInfoZZ($down[0], "ecmsspicurl", 0);
                $strtext = GetInfoStr($down[0], "ecmsspicurl", 1);
                $text1 = stripSlashes(preg_replace($zztext, $strtext, $info));
                //大图
                if ($down[1]) {
                    $zztext = RepInfoZZ($down[1], "ecmsbpicurl", 0);
                    $strtext = GetInfoStr($down[1], "ecmsbpicurl", 1);
                    $text2 = stripSlashes(preg_replace($zztext, $strtext, $info));
                }
                //名称
                if ($down[2]) {
                    $zztext = RepInfoZZ($down[2], "ecmspicname", 0);
                    $strtext = GetInfoStr($down[2], "ecmspicname", 1);
                    $text3 = stripSlashes(preg_replace($zztext, $strtext, $info));
                }
                $zzvalue = GetCjMorepicpath($text1, $text2, $text3, "ecmsspicurl", "ecmsbpicurl", "ecmspicname", $r[$var2]);
                $ifield .= "," . $dofield;
                $ivalue .= ",'" . addslashes($zzvalue) . "'";
                continue;
            }
            //下载地址
            if ($dofield == "downpath" && $r[$var]) {
                //替换下载链接
                $text = $r[$var];
                //替换回车
                $text = ReplaceFc($text);
                $down = explode("[!empirecms!]", $text);
                //地址
                $zztext = RepInfoZZ($down[0], "ecmsdownpathurl", 0);
                $strtext = GetInfoStr($down[0], "ecmsdownpathurl", 1);
                $text1 = stripSlashes(preg_replace($zztext, $strtext, $info));
                //名称
                if ($down[1]) {
                    $zztext = RepInfoZZ($down[1], "ecmsdownpathname", 0);
                    $strtext = GetInfoStr($down[1], "ecmsdownpathname", 1);
                    $text2 = stripSlashes(preg_replace($zztext, $strtext, $info));
                }
                $zzvalue = GetCjDownpath($text1, $text2, "ecmsdownpathurl", "ecmsdownpathname", $r[$var2], 0);
                $ifield .= "," . $dofield;
                $ivalue .= ",'" . addslashes($zzvalue) . "'";
                continue;
            }
            //在线地址
            if ($dofield == "onlinepath" && $r[$var]) {
                //替换下载链接
                $text = $r[$var];
                //替换回车
                $text = ReplaceFc($text);
                $down = explode("[!empirecms!]", $text);
                //地址
                $zztext = RepInfoZZ($down[0], "ecmsonlinepathurl", 0);
                $strtext = GetInfoStr($down[0], "ecmsonlinepathurl", 1);
                $text1 = stripSlashes(preg_replace($zztext, $strtext, $info));
                //名称
                if ($down[1]) {
                    $zztext = RepInfoZZ($down[1], "ecmsonlinepathname", 0);
                    $strtext = GetInfoStr($down[1], "ecmsonlinepathname", 1);
                    $text2 = stripSlashes(preg_replace($zztext, $strtext, $info));
                }
                $zzvalue = GetCjDownpath($text1, $text2, "ecmsonlinepathurl", "ecmsonlinepathname", $r[$var2], 1);
                $ifield .= "," . $dofield;
                $ivalue .= ",'" . addslashes($zzvalue) . "'";
                continue;
            }
            if (empty($r[$var1])) {
                if ($r[$var]) {
                    $zzvalue = ReturnCJ_str($r[$var], $dofield, $info);
                    if ($zzvalue) {
                        $zzvalue = $r[$var2] . $zzvalue;
                    }
                }
            } else {
                $zzvalue = $r[$var1];
            }
            //------------------------------信息时间
            if ($dofield == "newstime") {
                $newstime = $zzvalue;
                if (empty($newstime)) {
                    $newstime = $tmptime;
                } else {
                    $newstime = CjFormatNewstime($newstime);
                    //时间转换
                }
                continue;
            }
            //------------------------------信息来源
            if ($dofield == "befrom" || $dofield == "writer") {
                //标题去除html代码
                $zzvalue = strip_tags(str_replace("\r\n", "", $zzvalue));
            }
            //------------------------------标题
            if ($dofield == "title") {
                //标题去除html代码
                $zzvalue = ehtmlspecialchars(strip_tags(str_replace("\r\n", "", $zzvalue)));
                if (empty($zzvalue)) {
                    $next = 1;
                    break;
                }
                $keyboard = sub($zzvalue, 0, $r[keynum], false);
                //标题是否包含关键字
                if ($r[keyboard]) {
                    $t = HaveKeyboard($zzvalue, $r[keyboard]);
                    if (empty($t)) {
                        $next = 1;
                        break;
                    }
                }
                if ($r[retitlewriter]) {
                    //入库比较
                    $onum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[newsclassid]][tbname] . " where title='" . addslashes($zzvalue) . "' and classid='{$r['newsclassid']}' limit 1");
                    if ($onum) {
                        $next = 1;
                        break;
                    }
                    /*采集库比较
                    		$onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title='".addslashes($zzvalue)."' limit 1");
                    		if($onum)
                    		{
                    			$next=1;
                    			break;
                    		}
                    		*/
                }
                if ($r[titlelen]) {
                    //入库比较
                    $c_title = addslashes(sub($zzvalue, 0, $r[titlelen], false));
                    $onum = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $class_r[$r[newsclassid]][tbname] . " where title like '%{$c_title}%' and classid='{$r['newsclassid']}' limit 1");
                    if ($onum) {
                        $next = 1;
                        break;
                    }
                    /*采集比较
                    		$onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title like '%$c_title%' limit 1");
                    		if($onum)
                    		{
                    			$next=1;
                    			break;
                    		}
                    		*/
                }
            }
            //新闻内容分页
            if ($dofield == "newstext") {
                //是否有分页
                if ($r[pagezz] || $r[pageallzz]) {
                    //上下页式
                    if (empty($r[pagetype])) {
                        $zzvalue .= GetMoreCjPagetext($nr[newsurl], $r[$var], $r[smallpagezz], $r[pagezz], $r[pagetype], $info, $r);
                    } else {
                        $zzvalue .= GetMoreCjPagetextall($nr[newsurl], $r[$var], $r[smallpageallzz], $r[pageallzz], $r[pagetype], $info, $r);
                    }
                }
            }
            //替换关键字
            if ($dofield == "title" || $dofield == "newstext") {
                $zzvalue = RepInfoWord($zzvalue, $r[oldword], $r[newword]);
            }
            //新闻内容
            if ($dofield == "newstext") {
                $zzvalue = RepAd($r[repad], $zzvalue);
                if ($r['newstextisnull'] == 1 && empty($zzvalue)) {
                    $next = 1;
                    break;
                }
            }
            $ifield .= "," . $dofield;
            $ivalue .= ",'" . addslashes($zzvalue) . "'";
        }
        if ($next) {
            continue;
        }
        //入临时库
        $isql = $empire->query("insert into {$dbtbpre}ecms_infotmp_" . $r[tbname] . "(classid,oldurl,checked,keyboard,newstime,truetime,tmptime,userid,username" . $ifield . ") values({$classid},'{$nr['newsurl']}',0,'" . addslashes($keyboard) . "','{$newstime}',{$truetime},'{$tmptime}',{$userid},'" . addslashes($username) . "'" . $ivalue . ");");
    }
    //采集结束
    if (empty($b)) {
        //删除记录
        $del = $empire->query("delete from {$dbtbpre}enewslinktmp where checkrnd='{$checkrnd}'");
        //更新最后时间
        $ucjsql = $empire->query("update {$dbtbpre}enewsinfoclass set lasttime='" . time() . "' where classid='{$classid}'");
        //自动入库
        if ($r['justloadin']) {
            echo $fun_r['cjLoadInInfos'] . "<script>self.location.href='ecmscj.php?enews=CjNewsIn_all&classid={$classid}&checked={$r['justloadcheck']}&fm=1" . hReturnEcmsHashStrHref(0) . "';</script>";
            exit;
        }
        //单个节点
        if (getcvar('recjnum', 1) == 1) {
            echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><font color=red>" . $fun_r['CjSuccess'] . "</font><script>parent.location.href='CheckCj.php?classid={$classid}" . hReturnEcmsHashStrHref2(0) . "';</script>";
        } else {
            echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><body topmargin=0><font color=red>" . $r[classname] . "  " . $fun_r['CjSuccess'] . "</font>,  <input type=button name=button value='" . $fun_r['OnlickLoadInCj'] . "' onclick=\"window.open('CheckCj.php?classid={$classid}" . hReturnEcmsHashStrHref2(0) . "');\">";
            echo "<script>parent.checkrecj.location.href='CheckReCj.php" . hReturnEcmsHashStrHref2(1) . "';</script></body>";
        }
        exit;
    }
    //echo"(ID:<font color=red><b>".$newstart."</b></font>)<script>self.location.href='ecmscj.php?enews=GetNewsInfo&checkrnd=$checkrnd&classid=$classid&start=$newstart".hReturnEcmsHashStrHref(0)."';</script>";
    echo "<meta http-equiv=\"refresh\" content=\"" . $r['keeptime'] . ";url=ecmscj.php?enews=GetNewsInfo&checkrnd={$checkrnd}&classid={$classid}&start={$newstart}" . hReturnEcmsHashStrHref(0) . "\">" . $r[classname] . " (ID:<font color=red><b>" . $newstart . "</b></font>)";
    exit;
}
Exemplo n.º 17
0
function LoadSearchAll($lid, $start, $userid, $username)
{
    global $empire, $dbtbpre, $class_r, $fun_r, $public_r, $emod_r;
    $lid = (int) $lid;
    if (empty($lid)) {
        printerror('ErrorUrl', '');
    }
    $lr = $empire->fetch1("select tbname,titlefield,infotextfield,loadnum,lastid from {$dbtbpre}enewssearchall_load where lid='{$lid}'");
    if (empty($lr['tbname'])) {
        printerror('ErrorUrl', '');
    }
    //不导入栏目
    $pr = $empire->fetch1("select schallnotcid from {$dbtbpre}enewspublic limit 1");
    $line = $lr['loadnum'];
    if (empty($line)) {
        $line = 300;
    }
    $start = (int) $start;
    if ($start < $lr['lastid']) {
        $start = $lr['lastid'];
    }
    //字段
    $selectdtf = '';
    $selectf = '';
    $savetxtf = '';
    $fsql = $empire->query("select tid,f,savetxt,tbdataf from {$dbtbpre}enewsf where (f='{$lr['titlefield']}' or f='{$lr['infotextfield']}') and tbname='{$lr['tbname']}' limit 2");
    while ($fr = $empire->fetch($fsql)) {
        if ($fr['tbdataf']) {
            $selectdtf .= ',' . $fr[f];
        } else {
            $selectf .= ',' . $fr[f];
        }
        if ($fr['savetxt']) {
            $savetxtf = $fr[f];
        }
    }
    $b = 0;
    $sql = $empire->query("select id,stb,classid,isurl,newstime" . $selectf . " from {$dbtbpre}ecms_" . $lr['tbname'] . " where id>{$start} order by id limit " . $line);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r['id'];
        if ($r['isurl']) {
            continue;
        }
        if (empty($class_r[$r[classid]]['tbname'])) {
            continue;
        }
        if (strstr($pr['schallnotcid'], ',' . $r[classid] . ',')) {
            continue;
        }
        //重复
        $havenum = $empire->gettotal("select count(*) as total from {$dbtbpre}enewssearchall where id='{$r['id']}' and classid='{$r['classid']}' limit 1");
        if ($havenum) {
            continue;
        }
        //副表
        if ($selectdtf) {
            $finfor = $empire->fetch1("select id" . $selectdtf . " from {$dbtbpre}ecms_" . $lr['tbname'] . "_data_" . $r[stb] . " where id='{$r['id']}'");
            $r = array_merge($r, $finfor);
        }
        //存文本
        if ($savetxtf) {
            $r[$savetxtf] = GetTxtFieldText($r[$savetxtf]);
        }
        $infotext = $r[$lr[infotextfield]];
        $title = $r[$lr[titlefield]];
        $infotime = $r[newstime];
        $title = SearchReturnSaveStr(ClearSearchAllHtml(stripSlashes($title)));
        $infotext = SearchReturnSaveStr(ClearSearchAllHtml(stripSlashes($infotext)));
        $empire->query("insert into {$dbtbpre}enewssearchall(sid,id,classid,title,infotime,infotext) values(NULL,'{$r['id']}','{$r['classid']}','" . addslashes($title) . "','{$infotime}','" . addslashes($infotext) . "');");
    }
    if (empty($b)) {
        $lasttime = time();
        if (empty($newstart)) {
            $newstart = $start;
        }
        $empire->query("update {$dbtbpre}enewssearchall_load set lasttime='{$lasttime}',lastid='{$newstart}' where lid='{$lid}'");
        echo "<link rel=\"stylesheet\" href=\"../../data/images/css.css\" type=\"text/css\"><center><b>" . $lr['tbname'] . $fun_r[LoadSearchAllIsOK] . "</b></center>";
        db_close();
        $empire = null;
        exit;
    }
    echo "<link rel=\"stylesheet\" href=\"../../data/images/css.css\" type=\"text/css\"><meta http-equiv=\"refresh\" content=\"0;url=LoadSearchAll.php?enews=LoadSearchAll&lid={$lid}&start={$newstart}" . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneLoadSearchAllSuccess] . "(ID:<font color=red><b>" . $newstart . "</b></font>)";
    exit;
}
Exemplo n.º 18
0
function ChangeDocDataTableF($add, $userid, $username)
{
    global $empire, $dbtbpre, $public_r, $fun_r;
    //验证权限
    CheckLevel($userid, $username, $classid, "f");
    $fid = (int) $add[fid];
    $tid = (int) $add[tid];
    $tbname = RepPostVar($add[tbname]);
    $line = (int) $add[line];
    $start = (int) $add[start];
    if (!$fid || !$tid || !$tbname) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    if (empty($line)) {
        $line = 200;
    }
    $fr = $empire->fetch1("select * from {$dbtbpre}enewsf where fid='{$fid}'");
    if (!$fr[fid]) {
        printerror("ErrorUrl", "history.go(-1)");
    }
    if (empty($fr[isadd])) {
        printerror("NotIsAdd", "history.go(-1)");
    }
    $tid = $fr[tid];
    $tbname = $fr[tbname];
    $f = $fr[f];
    $selectf = '';
    if (empty($fr[tbdataf])) {
        $selectf = ',' . $fr[f];
    }
    $b = 0;
    $sql = $empire->query("select id,stb" . $selectf . " from {$dbtbpre}ecms_" . $tbname . "_doc where id>{$start} order by id limit " . $line);
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r['id'];
        if ($fr[tbdataf]) {
            $finfor = $empire->fetch1("select " . $f . " from {$dbtbpre}ecms_" . $tbname . "_doc_data where id='{$r['id']}'");
            $value = $finfor[$f];
            $empire->query("update {$dbtbpre}ecms_" . $tbname . "_doc set " . $f . "='" . StripAddsData($value) . "' where id='{$r['id']}'");
        } else {
            $value = $r[$f];
            $empire->query("update {$dbtbpre}ecms_" . $tbname . "_doc_data set " . $f . "='" . StripAddsData($value) . "' where id='{$r['id']}'");
        }
    }
    if (empty($b)) {
        //删除字段
        if ($fr[tbdataf]) {
            $tbr = $empire->fetch1("select datatbs from {$dbtbpre}enewstable where tid='{$tid}'");
            if ($tbr['datatbs']) {
                $dtbr = explode(',', $tbr['datatbs']);
                $count = count($dtbr);
                for ($i = 1; $i < $count - 1; $i++) {
                    $empire->query("alter table {$dbtbpre}ecms_" . $tbname . "_data_" . $dtbr[$i] . " drop COLUMN " . $fr[f]);
                }
            }
            //归档副表
            $empire->query("alter table {$dbtbpre}ecms_" . $tbname . "_doc_data drop COLUMN " . $fr[f]);
            //审核副表
            $empire->query("alter table {$dbtbpre}ecms_" . $tbname . "_check_data drop COLUMN " . $fr[f]);
        } else {
            $empire->query("alter table {$dbtbpre}ecms_" . $tbname . " drop COLUMN " . $fr[f]);
            $empire->query("alter table {$dbtbpre}ecms_" . $tbname . "_doc drop COLUMN " . $fr[f]);
            $empire->query("alter table {$dbtbpre}ecms_" . $tbname . "_check drop COLUMN " . $fr[f]);
        }
        $newtbdataf = $fr[tbdataf] ? 0 : 1;
        $empire->query("update {$dbtbpre}enewsf set tbdataf='{$newtbdataf}' where fid='{$fid}'");
        //删除模型中字段项
        if (empty($tbr['datatbs'])) {
            $record = "<!--record-->";
            $field = "<!--field--->";
            $like = $field . $fr[f] . $record;
            $slike = "," . $fr[f] . ",";
            $dsql = $empire->query("select mid,searchvar,listandf,listtempvar,orderf from {$dbtbpre}enewsmod where tid='{$tid}' and (searchvar like '%" . $slike . "%' or listtempvar like '%" . $like . "%' or listandf like '%" . $slike . "%' or orderf like '%" . $slike . "%')");
            while ($r = $empire->fetch($dsql)) {
                $listtempvar = "";
                $searchvar = "";
                $listandf = "";
                $orderf = "";
                $re = "";
                $re1 = "";
                $and = "";
                $dh = "";
                //列表模板变量
                if (strstr($r[listtempvar], $like)) {
                    $re1 = explode($record, $r[listtempvar]);
                    for ($i = 0; $i < count($re1) - 1; $i++) {
                        if (strstr($re1[$i] . $record, $like)) {
                            continue;
                        }
                        $listtempvar .= $re1[$i] . $record;
                    }
                    $and .= $dh . "listtempvar='{$listtempvar}'";
                }
                $dh = "";
                //搜索变量
                if (strstr($r[searchvar], $slike)) {
                    if (!empty($and)) {
                        $dh = ",";
                    }
                    $searchvar = str_replace($slike, ",", $r[searchvar]);
                    $and .= $dh . "searchvar='{$searchvar}'";
                }
                //结合项
                $dh = "";
                if (strstr($r[listandf], $slike)) {
                    if (!empty($and)) {
                        $dh = ",";
                    }
                    $listandf = str_replace($slike, ",", $r[listandf]);
                    $and .= $dh . "listandf='{$listandf}'";
                }
                //排序项
                $dh = "";
                if (strstr($r[orderf], $slike)) {
                    if (!empty($and)) {
                        $dh = ",";
                    }
                    $orderf = str_replace($slike, ",", $r[orderf]);
                    $and .= $dh . "orderf='{$orderf}'";
                }
                if ($and) {
                    $empire->query("update {$dbtbpre}enewsmod set " . $and . " where mid='{$r['mid']}'");
                }
            }
        }
        GetConfig(1);
        //更新缓存
        insert_dolog("tid={$tid}&tbname={$tbname}<br>fid={$fid}&field={$f}&tbdataf=" . $newtbdataf);
        //操作日志
        printerror("ChangeDataTableFSuccess", "db/ListF.php?tid={$tid}&tbname={$tbname}" . hReturnEcmsHashStrHref2(0));
    }
    echo "<link rel=\"stylesheet\" href=\"../data/images/css.css\" type=\"text/css\"><meta http-equiv=\"refresh\" content=\"" . $public_r['realltime'] . ";url=ecmsmod.php?enews=ChangeDocDataTableF&tid={$tid}&tbname={$tbname}&fid={$fid}&line={$line}&start={$newstart}" . hReturnEcmsHashStrHref(0) . "\">" . $fun_r[OneChangeDocDataTableFSuccess] . "(ID:<font color=red><b>" . $newstart . "</b></font>)";
    exit;
}