Example #1
0
function EditInfoType($add,$userid,$username){
	global $empire,$dbtbpre;
	$typeid=(int)$add['typeid'];
	if(!$typeid||!$add[mid]||!$add[tname]||!$add[listtempid]||!$add[tpath])
	{
		printerror("EmptyInfoTypeName","history.go(-1)");
    }
	$add=DoPostInfoTypeVar($add);
	CheckLevel($userid,$username,$classid,"infotype");
	//改变目录
	if($add[oldtpath]<>$add[tpath])
	{
		$createpath=ECMS_PATH.$add[tpath];
		if(file_exists($createpath))
		{
			printerror("ReInfoTypePath","");
		}
		if($add['oldpripath']==$add['pripath'])
		{
			$new=ECMS_PATH;
			@rename($new.$add[oldtpath],$new.$add[tpath]);//改变目录名
		}
		else
		{
			CreateInfoTypePath($add[tpath]);//建立目录
		}
    }
	//取得表名
	$tabler=GetModTable($add[mid]);
	$tabler[tid]=(int)$tabler[tid];
	//修改
	$sql=$empire->query("update {$dbtbpre}enewsinfotype set tname='$add[tname]',mid='$add[mid]',myorder='$add[myorder]',yhid='$add[yhid]',tnum='$add[tnum]',listtempid='$add[listtempid]',tpath='$add[tpath]',ttype='$add[ttype]',maxnum='$add[maxnum]',reorder='$add[reorder]',tid='$tabler[tid]',tbname='$tabler[tbname]',timg='$add[timg]',intro='$add[intro]',pagekey='$add[pagekey]',newline='$add[newline]',hotline='$add[hotline]',goodline='$add[goodline]',hotplline='$add[hotplline]',firstline='$add[firstline]',jstempid='$add[jstempid]',nrejs='$add[nrejs]',listdt='$add[listdt]',repagenum='$add[repagenum]' where typeid='$typeid'");
	GetClass();//更新缓存
	//生成页面
	if($add[listdt]==0)
	{
		ListHtml($typeid,$ret_r,5);
	}
	if($sql)
	{
		insert_dolog("typeid=".$typeid."<br>tname=".$add[tname]);//操作日志
		printerror("EditInfoTypeSuccess","InfoType.php?mid=$add[fmid]".hReturnEcmsHashStrHref2(0));
	}
	else
	{
		printerror("DbError","");
	}
}
Example #2
0
function ReClassPath($start = 0)
{
    global $empire, $public_r, $dbtbpre;
    $start = (int) $start;
    $sql = $empire->query("select classid,classpath,islast from {$dbtbpre}enewsclass where wburl='' and classid>{$start} order by classid limit " . $public_r[relistnum]);
    $b = 0;
    while ($r = $empire->fetch($sql)) {
        $b = 1;
        $newstart = $r[classid];
        $returnpath = FormatClassPath($r[classpath], $r[islast]);
        echo "Create Path:" . $returnpath . " success!<br>";
    }
    //恢复专题目录
    if (empty($b)) {
        $zsql = $empire->query("select ztid,ztpath from {$dbtbpre}enewszt order by ztid");
        while ($zr = $empire->fetch($zsql)) {
            CreateZtPath($zr[ztpath]);
        }
        //恢复标题分类目录
        $tsql = $empire->query("select typeid,tpath from {$dbtbpre}enewsinfotype order by typeid");
        while ($tr = $empire->fetch($tsql)) {
            CreateInfoTypePath($tr['tpath']);
        }
    }
    if (empty($b)) {
        //操作日志
        insert_dolog("");
        printerror("ReClassPathSuccess", "ReHtml/ChangeData.php" . hReturnEcmsHashStrHref2(1));
    }
    echo "(ID:<font color=red><b>" . $newstart . "</b></font>)<script>self.location.href='ecmschtml.php?enews=ReClassPath&start={$newstart}" . hReturnEcmsHashStrHref(0) . "';</script>";
    exit;
}