⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 down.php

📁 phpcms网站管理系统  很不错的 有需要的就下载看看八 
💻 PHP
📖 第 1 页 / 共 2 页
字号:
		if(!ereg('^[0-1]+$',$value))
		{
			showmessage('非法参数,请返回!');
		}
		
		$msg = $value==1 ? '删除到回收站成功!' : '从回收站恢复成功!';
		$db->query("update ".TABLE_DOWN." set recycle='$value' where downid in ($downids) and channelid='$channelid'");
		if($db->affected_rows()>0)
		{
			showmessage($msg,$referer);
		}
		else
		{
			showmessage('操作失败,请返回!');
		}
	break;

	//还原所有
	case 'restoreall':
		$db->query("update ".TABLE_DOWN." set recycle='0' where recycle='1' and channelid='$channelid'");
		if($db->affected_rows()>0)
		{
			showmessage('还原所有信息操作成功!',$referer);
		}
		else
		{
			showmessage('操作失败,请返回!');
		}
	break;
		
	//回收站
	case 'recycle':
		$condtion.=" and recycle='1' and channelid='$channelid' ";
		$headtitle=$_CHA['channelname'].'回收站管理';
		$noinfo="恭喜您,回收站没有任何垃圾信息。";
		
		if(ereg('^[013]+$',$value))
		{
			$condtion.=" and status='$value'";
		}
		@extract($db->get_one("select count(downid) as num_0 from ".TABLE_DOWN." where status=0 ". $condtion));
		@extract($db->get_one("select count(downid) as num_1 from ".TABLE_DOWN." where status=1 ". $condtion));
		@extract($db->get_one("select count(downid) as num_2 from ".TABLE_DOWN." where status=2 ". $condtion));
		@extract($db->get_one("select count(downid) as num_3 from ".TABLE_DOWN." where status=3 ". $condtion));

		//分页
		$pagesize=$_PHPCMS['down_admin_pagesize']>1?$_PHPCMS['down_admin_pagesize']:10;
		if(!$page)
		{
			$page=1;
			$offset=0;
		}
		else
		{
			$offset=($page-1)*$pagesize;
		}
		if($catid)
			$condtion.=" and catid='$catid' ";
	
		$r = $db->get_one("select count(downid) as num from ".TABLE_DOWN." where 1 $condtion ");
		$number=$r["num"];		
		if($number>$pagesize)
			$pages=phppages($number,$page,$pagesize);
		
		//查询条件
		if($catid)
			$condtion.=" and catid='$catid' ";
		if(in_array($field,$fieldtypes) && $keywords)  $condtion.=" and $field like '%$keywords%'";
		
		if(!isset($order))
		{
			$condtion.=" order by addtime desc ";
		}else
		{		
			if($order && in_array($order,$ordertypes) )
				$condtion.=" order by $order ";
		}

		$query = $db->query("select * from  ".TABLE_DOWN." where 1 ".$condtion." limit $offset,$pagesize ");
		$num=$db->num_rows($query);
		if($num)
		{
			$i=0;
			$p->set_type("url");
			while($r=$db->fetch_array($query))
			{
				//生成页面路径对象
				$p->set_catid($r[catid]);
				$r['url']=$p->get_itemurl($r['downid'],$r['addtime']);
				$r['addtime']=date("Y-m-d",$r['addtime']);
				$r['username']=$r['username']	?$r['username']:'[未知]';
				$r['property']=$r['ontop'] ? '<font color="red">顶</font> ':'';
				$r['property'].=$r['elite'] ? '<font color="red">荐</font>':'';
				$r['caturl'] = $p->get_listurl(0);
				$r['catname']=$_CAT[$r['catid']]['catname'];
				$r['atitle']=$r['title'];
				$r['title'] = titleformat($r['title'],$r['titlefontcolor'],$r['titlefonttype'],$r['includepic']);
				if($r['thumb'])	$r['title']='<font color="red">[图]</font> '.$r['title'];
				$i++;
				$downs[]=$r;
			}
		}
		include admintpl('down_recycle');
	
	break;

	//审核下载
	case 'check':

		$condtion.=" and status='1' and recycle='0'";
		$headtitle=$_CHA['channelname']."审核管理";
		$noinfo="恭喜您,全部".$_CHA['channelname']."信息都通过审核了。";

		if($submit)
		{
			$downids=is_array($downid) ? implode(",",$downid) : $downid;
			if(empty($downids))
			{
				showmessage('请选择要审核的项目!');
			}
			$sql="update ".TABLE_DOWN." set status='3',checktime='$timestamp',checker='$_username' where 1 ".$condtion." and downid in ($downids) and channelid='$channelid'";
			$query=$db->query($sql);
			if($query)
			{
				showmessage('审核操作成功!',$referer);
			}
			else
			{
				showmessage('操作失败,请返回!');
			}
		}
		else
		{
			//分页
			$pagesize=$_PHPCMS['down_admin_pagesize']>1?$_PHPCMS['down_admin_pagesize']:10;
			if(!$page)
			{
				$page=1;
				$offset=0;
			}
			else
			{
				$offset=($page-1)*$pagesize;
			}
			$sql="select count(downid) as num from ".TABLE_DOWN." where 1 ".$condtion;
			
			$result=$db->query($sql);
			$r=$db->fetch_array($result);
			$number=$r["num"];		
			if($number>$pagesize)
				$pages=phppages($number,$page,$pagesize);
			
			//查询条件
			if($catid)
				$condtion.=" and catid='$catid' ";
			if(in_array($field,$fieldtypes) && $keywords)  $condtion.=" and $field like '%$keywords%'";
			
			if(!isset($order))
			{
				$condtion.=" order by addtime desc ";
			}else
			{		
				if($order && in_array($order,$ordertypes) )
					$condtion.=" order by $order ";
			}
			$sql="select * from  ".TABLE_DOWN." where 1 ".$condtion." limit $offset,$pagesize ";
			$query=$db->query($sql);
			$num=$db->num_rows($query);
			if($num)
			{
				$p->set_type("url");
				while($r=$db->fetch_array($query))
				{
					//生成页面路径对象
					$p->set_catid($r[catid]);
					$r['url']=$p->get_itemurl($r['downid'],$r['addtime']);
					$r['addtime']=date("Y-m-d",$r['addtime']);
					$r['username']=$r['username'] ? $r['username']:'[未知]';
					$r['property']=$r['ontop'] ? '<font color="red">顶</font> ':'';
					$r['property'].=$r['elite'] ? '<font color="blue">荐</font>':'';
					$r['caturl'] = $p->get_listurl(0);
					$r['catname']=$_CAT[$r['catid']]['catname'];
					$r['atitle']=$r['title'];
					$r['title'] = titleformat($r['title'],$r['titlefontcolor'],$r['titlefonttype'],$r['includepic']);
					if($r['thumb'])	$r['title']='<font color="red">[图]</font> '.$r['title'];
					$downs[]=$r;
				}
			}

			include admintpl('down_check');
		}
	break;

	case 'special':
		$referer = urlencode("?".$PHP_QUERYSTRING);
		//分页
		$pagesize = $_PHPCMS['down_admin_pagesize']>1 ? $_PHPCMS['down_admin_pagesize'] : 20;
		if(!$page)
		{
			$page=1;
			$offset=0;
		}
		else
		{
			$offset=($page-1)*$pagesize;
		}
	    $sql="select count(downid) as num from ".TABLE_DOWN." where status='3' and recycle='0' ".$condtion;
		
		$result=$db->query($sql);
		$r=$db->fetch_array($result);
		$number=$r["num"];		
		if($number>$pagesize)
			$pages=phppages($number,$page,$pagesize);
		
		//查询条件
		if($catid)
			$condtion.=" and catid='$catid' ";
		if(in_array($field,$fieldtypes) && $keywords)  $condtion.=" and $field like '%$keywords%'";
		
		if(!isset($order))
		{
			$condtion.=" order by addtime desc ";
		}else
		{		
			if($order && in_array($order,$ordertypes) )
				$condtion.=" order by $order ";
		}
		$condition .= $specialid ? " AND specialid=$specialid " : "";

		$r = $db->get_one("SELECT COUNT(*) AS num FROM ".TABLE_DOWN." a WHERE status=3 AND recycle=0 AND specialid>0 AND channelid='$channelid' $condition");
		$number=$r["num"];
		$url="?mod=".$mod."&file=".$file."&action=special&channelid=".$channelid."&catid=".$catid."&specialid=".$specialid."&srchtype=".$srchtype."&keyword=".$keyword."&ontop=".$ontop."&elite=".$elite."&ordertype=".$ordertype."&page=".$page;
		$pages=phppages($number,$page,$pagesize,$url);
        //exit("SELECT * FROM ".TABLE_DOWN." WHERE status=3 AND recycle=0 AND specialid>0 AND channelid=$channelid $condition LIMIT $offset,$pagesize");
		$result=$db->query("SELECT * FROM ".TABLE_DOWN." WHERE status=3 AND recycle=0 AND specialid>0 AND channelid=$channelid $condition LIMIT $offset,$pagesize");
		while($r=$db->fetch_array($result))
		{
			$s = $db->get_one("SELECT specialid,specialname,addtime FROM ".TABLE_SPECIAL." a WHERE specialid=$r[specialid]");
			$p->set_catid($r[catid]);
			$r[url] = $p->get_itemurl($r[downid],$r[addtime]);
			$r[specialname] = wordscut($s[specialname],24,1);
			$r[specialurl] = $p->get_specialitemurl($s[specialid],$s[addtime]);
			$r[title] = titleformat($r[title],$r[titlefontcolor],$r[titlefonttype],$r[includepic]);
			$r[adddate]=date("Y-m-d",$r[addtime]);
			$downs[]=$r;
		}
		$special_list = special_select($channelid,'specialid','请选择专题',$specialid);
		$special_select = special_select($channelid,'jump','请选择专题进行管理',$specialid,'onchange="if(this.options[this.selectedIndex].value!=\'\'){location=\'?mod='.$mod.'&file='.$file.'&action=special&channelid='.$channelid.'&specialid=\'+this.options[this.selectedIndex].value;}"');
		include admintpl('down_special');
	break;

	case 'myitem':
		$condtion.=" and username='$_username' and recycle='0' and channelid='$channelid' ";

		$headtitle="我添加的".$_CHA['channelname'];
		$noinfo="您还没有添加任何".$_CHA['channelname']."信息。";

		@extract($db->get_one("select count(downid) as mydown_0 from ".TABLE_DOWN." where status='0' ". $condtion));
		@extract($db->get_one("select count(downid) as mydown_1 from ".TABLE_DOWN." where status='1' ". $condtion));
		@extract($db->get_one("select count(downid) as mydown_2 from ".TABLE_DOWN." where status='2' ". $condtion));
		@extract($db->get_one("select count(downid) as mydown_3 from ".TABLE_DOWN." where status='3' ". $condtion));
		
		if(!isset($value)) $value=3;
		if(ereg('^[0123]+$',$value))
		{
			$condtion.=" and status='$value' ";
		}
		//分页
		$pagesize=$_PHPCMS['down_admin_pagesize']>1?$_PHPCMS['down_admin_pagesize']:10;
		if(!$page)
		{
			$page=1;
			$offset=0;
		}
		else
		{
			$offset=($page-1)*$pagesize;
		}
	    $sql="select count(downid) as num from ".TABLE_DOWN." where 1 ".$condtion;
		
		$result=$db->query($sql);
		$r=$db->fetch_array($result);
		$number=$r["num"];		
		if($number>$pagesize)
			$pages=phppages($number,$page,$pagesize);
		if($catid)
			$condtion.=" and catid='$catid' ";
		if(in_array($field,$fieldtypes) && $keywords)  $condtion.=" and $field like '%$keywords%'";
		
		if(!isset($order))
		{
			$condtion.=" order by addtime desc ";
		}else
		{		
			if($order && in_array($order,$ordertypes) )
				$condtion.=" order by $order ";
		}

		$query=$db->query("select * from  ".TABLE_DOWN." where 1 ".$condtion." limit $offset,$pagesize ");
		$num=$db->num_rows($query);
		if($num)
		{
			$p->set_type("url");
			while($r=$db->fetch_array($query))
			{
				//生成页面路径对象
				$p->set_catid($r[catid]);
				$r['url']=$p->get_itemurl($r['downid'],$r['addtime']);
				$r['addtime']=date("Y-m-d",$r['addtime']);
				$r['username']=$r['username'] ? $r['username']:'[未知]';
				$r['property']=$r['ontop'] ? '<font color="red">顶</font> ':'';
				$r['property'].=$r['elite'] ? '<font color="blue">荐</font>':'';
				$r['caturl'] = $p->get_listurl(0);
				$r['catname']=$_CAT[$r['catid']]['catname'];
				$r['atitle']=$r['title'];
		        $r['title'] = titleformat($r['title'],$r['titlefontcolor'],$r['titlefonttype'],$r['includepic']);
				if($r['thumb'])	$r['title']='<font color="red">[图]</font> '.$r['title'];
				$downs[]=$r;
			}
		}

		include admintpl('down_myitem');

	break;
	
	//管理下载
	case 'manage':
		$headtitle=$_CHA['channelname']."管理";
		$noinfo="没有任何".$_CHA['channelname']."信息。";
		
		//分页
		$pagesize = $_PHPCMS['down_admin_pagesize']>1 ? $_PHPCMS['down_admin_pagesize'] : 20;
		if(!$page)
		{
			$page=1;
			$offset=0;
		}
		else
		{
			$offset=($page-1)*$pagesize;
		}
	    $sql="select count(downid) as num from ".TABLE_DOWN." where status='3' and recycle='0' ".$condtion;
		
		$result=$db->query($sql);
		$r=$db->fetch_array($result);
		$number=$r["num"];		
		if($number>$pagesize)
			$pages=phppages($number,$page,$pagesize);
		
		//查询条件
		if($catid)
			$condtion.=" and catid='$catid' ";
		if(in_array($field,$fieldtypes) && $keywords)  $condtion.=" and $field like '%$keywords%'";
		
		if(!isset($order))
		{
			$condtion.=" order by addtime desc ";
		}else
		{		
			if($order && in_array($order,$ordertypes) )
				$condtion.=" order by $order ";
		}

		$sql="select * from  ".TABLE_DOWN." where status='3' and recycle='0' ".$condtion." limit $offset,$pagesize ";
		$query=$db->query($sql);
		$num=$db->num_rows($query);
		if($num)
		{
			$p->set_type("url");
			while($r=$db->fetch_array($query))
			{
				$r['username']=$r['username'] ? $r['username']:'[未知]';
				$r['property']=$r['ontop'] ? '<font color="red">顶</font> ':'';
				$r['property'].=$r['elite'] ? '<font color="blue">荐</font>':'';
				$p->set_catid($r[catid]);
				$r['caturl'] = $p->get_listurl(0);
				$r['catname']=$_CAT[$r['catid']]['catname'];
				$r['atitle']=$r['title'];
		        $r['title'] = titleformat($r['title'],$r['titlefontcolor'],$r['titlefonttype'],$r['includepic']);
				if($r['thumb'])	$r['title']='<font color="red">[图]</font> '.$r['title'];
				$r['url']=$p->get_itemurl($r['downid'],$r['addtime']);
				$r['addtime']=date("Y-m-d",$r['addtime']);
				$downs[]=$r;
			}
		}
		include admintpl('down_manage');
    break;
	
	//批量移动下载
	case 'move':
		$headtitle="批量移动".$_CHA['channelname'];
		$noinfo="没有任何".$_CHA['channelname']."批量移动信息。";

		if($submit)
		{
			$specialid = intval($specialid);
			$targetcatid = intval($targetcatid);
			if(!$specialid && !$targetcatid) showmessage('非法参数!请返回!');
			if($targetcatid && !$_CAT[$targetcatid]['enableadd']) showmessage('指定栏目不允许添加下载!请返回!');

			if($movetype==1)
			{
				if(empty($downid)) showmessage('非法参数!请返回!');
				$downids=is_array($downid) ? implode(',',$downid) : $downid;
				if($specialid) $db->query("UPDATE ".TABLE_DOWN." SET specialid='$specialid' WHERE downid IN ($downids) AND status=3 AND channelid='$channelid' ");
				if($targetcatid) $db->query("UPDATE ".TABLE_DOWN." SET catid='$targetcatid' WHERE downid IN ($downids) AND status=3 AND channelid='$channelid' ");
			}
			else
			{
				if(empty($batchcatid)) showmessage('非法参数!请返回!');
				$batchcatids=implode(",",$batchcatid);
				if($specialid) $db->query("UPDATE ".TABLE_DOWN." SET specialid='$specialid' WHERE catid IN ($batchcatids) AND status=3 AND channelid='$channelid' ");
				if($targetcatid) $db->query("UPDATE ".TABLE_DOWN." SET catid='$targetcatid' WHERE catid IN ($batchcatids) AND status=3 AND channelid='$channelid' ");
			}
			showmessage('操作成功!',$referer);
		}
		else
		{
			$referer=urlencode('?mod='.$mod.'&file='.$file.'&action=move&channelid='.$channelid);
			$downid=is_array($downid) ? implode(',',$downid) : $downid;
			$special_select = special_select($channelid,'specialid','请选择专题',$specialid);
            $cat_option = cat_option($catid);
			include admintpl('down_move');
		}
    break;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -