file.php

来自「帝国CMS,功能全面的CMS源码,下载试用下」· PHP 代码 · 共 550 行 · 第 1/2 页

PHP
550
字号
<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../class/config.php");
include("../../class/functions.php");
include("../../class/class.php");
include "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$logininid=(int)$_GET['userid'];
$loginin=$_GET['username'];
$loginrnd=$_GET['rnd'];
$classid=(int)$_GET['classid'];
$filepass=(int)$_GET['filepass'];
$type=$_GET['type'];
$doing=$_GET['doing'];
$field=$_GET['field'];
if(empty($field))
{$field="ecms";}
$editor=1;
is_login($logininid,$loginin,$loginrnd);
$add="";
//关键字
$keyboard=addslashes(stripSlashes($_GET['keyboard']));
if(!empty($keyboard))
{
	$show=$_GET['show'];
	//搜索全部
	if($show==0)
	{
		$add.=" and (filename like '%$keyboard%' or no like '%$keyboard%' or adduser like '%$keyboard%')";
	}
	//搜索文件名
	elseif($show==1)
	{
		$add.=" and filename like '%$keyboard%'";
	}
	//搜索编号
	elseif($show==2)
	{
		$add.=" and no like '%$keyboard%'";
	}
	//搜索上传者
	else
	{
		$add.=" and adduser like '%$keyboard%'";
	}
}
$search="&userid=$logininid&username=$loginin&rnd=$loginrnd&classid=$classid&filepass=$filepass&type=$type&doing=$doing&field=$field&show=$show&keyboard=$keyboard";
//-------------分页
$page=(int)$_GET['page'];
$start=(int)$_GET['start'];
$line=25;//每页显示条数
if($type==1)//图片
{
	$line=12;
}
$page_line=12;//每页显示链接数
$offset=$start+$page*$line;//总偏移量
$query="select * from {$dbtbpre}enewsfile where type='$type'".$add;
$totalquery="select count(*) as total from {$dbtbpre}enewsfile where type='$type'".$add;
$num=$empire->gettotal($totalquery);//取得总条数
$query=$query." order by fileid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>插入文件</title>
<link href="edit.css" rel="stylesheet" type="text/css">
<link href="../../data/images/css.css" rel="stylesheet" type="text/css">
<script>
function InsertFile(filename,fname,fileid,filesize,filetype,fileno,dotype){
	var vstr="";
	if(dotype!=undefined)
	{
		vstr=showModalDialog("popups/insertfile.php?ecms="+dotype+"&fname="+fname+"&fileid="+fileid+"&filesize="+filesize+"&filetype="+filetype+"&filename="+filename, "", "dialogWidth:45.5em; dialogHeight:27.5em; status:0");
		if(vstr==undefined)
		{
			return false;
		}
	}
	opener.DoFile(vstr);
	window.close();
}
function TInsertFile(vstr){
	opener.DoFile(vstr);
	window.close();
}
function ChangeFile1(obj,str)
{
	if(obj==1)
	{opener.document.add.<?=$field?>.value=str;}
	else
	{opener.document.form1.<?=$field?>.value=str;}
	window.close();
}
</script>
<script src=ebb.js></script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr> 
    <td height="230" colspan="3"> <IFRAME frameBorder=0 id=tran name=tran scrolling=auto src=tran.php<? echo"?userid=$logininid&username=$loginin&rnd=$loginrnd&type=$type&classid=$classid&filepass=$filepass";?> style=HEIGHT:100%;VISIBILITY:inherit;WIDTH:100%;Z-INDEX:1></IFRAME> 
    </td>
  </tr>
  <tr> 
    <td width="41%">&nbsp;</td>
    <td width="21%"><div align="center"> </div></td>
    <td width="38%">&nbsp;</td>
  </tr>
</table>
<table width="99%" border="0" align="center" cellpadding="3" cellspacing="0">
  <form name="searchfile" method="get" action="file.php">
  <input type=hidden name=type value="<?=$type?>">
  <input type=hidden name=classid value="<?=$classid?>">
  <input type=hidden name=filepass value="<?=$filepass?>">
  <input type=hidden name=userid value="<?=$logininid?>">
  <input type=hidden name=username value="<?=$loginin?>">
  <input type=hidden name=rnd value="<?=$loginrnd?>">
  <input type=hidden name=doing value="<?=$doing?>">
  <input type=hidden name=field value="<?=$field?>">
    <tr> 
      <td><div align="center">搜索: 
          <input name="keyboard" type="text" id="keyboard" value="<?=$keyboard?>">
          <input name="show" type="radio" value="0">
          不限 
          <input type="radio" name="show" value="1">
          文件名 
          <input name="show" type="radio" value="2" checked>
          编号 
          <input type="radio" name="show" value="3">
          上传者 
          <input type="submit" name="Submit2" value="搜索">
        </div></td>
    </tr>
  </form>
</table>
<form name="dofile" method="post" action="../enews.php?<? echo"userid=$logininid&username=$loginin&rnd=$loginrnd";?>" onsubmit="return confirm('确认要操作?');">
<input type=hidden name=enews value="DoMarkSmallPic">
  <input type=hidden name=type value="<?=$type?>">
  <input type=hidden name=classid value="<?=$classid?>">
  <input type=hidden name=filepass value="<?=$filepass?>">
  <input type=hidden name=doing value="<?=$doing?>">
  <input type=hidden name=field value="<?=$field?>">
<?
//图片
if($type==1)
{
	$i=0;
	$line=3;//每行显示图片数
	$width=100;
	$height=80;
	$sub=23;//编号截取数
	while($r=$empire->fetch($sql))
	{
		$ono=$r[no];
		$r[no]=sub($r[no],0,$sub,false);
		$filesize=ChTheFilesize($r[filesize]);
		//取得文件扩展名
		$filetype=GetFiletype($r[filename]);
		$i++;
		if(($i-1)%$line==0||$i==1)
		{$class_text.="<tr bgcolor=#DBEAF5>";}
		//是否按类别分
		if($r[classid])
		{
			$file=$public_r[fileurl].$class_r[$r[classid]][classpath]."/".$r[path]."/".$r[filename];
        }
		else
		{
			$file=$public_r[fileurl]."p/".$r[path]."/".$r[filename];
        }
		$pic=$file;
		//返回地址
		if($doing==1)
		{
			$returnstr=$pic;
			$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(1,'".$pic."');\">";
		}
		elseif($doing==2)
		{
			$returnstr=$pic;
			$button="<input type=button name=button value='选择' onclick=\"javascript:ChangeFile1(2,'".$pic."');\">";
		}
		else
		{
			$button="<input type=button name=button value='插入' onclick=\"javascript:InsertFile('$file','$r[filename]','$r[fileid]','$filesize','$filetype','','pic');\">";
		}
		$viewstr="预览";
		$class_text.="<td><table width=100% border=0 cellspacing=1 cellpadding=2>
			<tr> 
                <td width=28% valign=top>图片:<br><input type=checkbox name=fileid[] value='$r[fileid]'></td>
                <td width=72%><a href='../../ViewImg/index.html?url=".$file."' target='_blank' title='预览:".$r[filename]."'><img src='".$pic."' width='".$width."' height='".$height."' border=0></a></td>
            </tr>
            <tr> 
                <td>编号:</td>
                <td><a title='".$ono."'>".$r[no]."</a></td>
			</tr> 
            <tr> 
				<td>文件大小:</td>
				<td>".$filesize."</td>
            </tr>
            <tr> 
				<td>所属栏目:</td>
                <td>".$class_r[$r[classid]][classname]."</td>
             </tr>
             <tr> 
                <td colspan=2><div align=center>".$button."</div></td>
             </tr>
            </table></td>";
		//分割
		if($i%$line==0)
		{$class_text.="</tr>";}
	}
	if($i<>0)
	{
		$table="<table width=100% border=0 cellpadding=3 cellspacing=1 bgcolor=#698CC3>
				<tr>
					<td><strong><font color=#FFFFFF>插入/选择图片</font></strong></td>
				</tr>
				<tr>
					<td bgcolor=#FFFFFF><table width=100% border=1 align=center cellpadding=2 cellspacing=1 bordercolor=#FFFFFF bgcolor=#FFFFFF>";
		$table1="</table></td>
				</tr>
				<tr>
					<td bgcolor=#FFFFFF>
					&nbsp;&nbsp;".$returnpage."
					</td>
				</tr></table>";
		$ys=$line-$i%$line;
		$p=0;
		for($j=0;$j<$ys&&$ys!=$line;$j++)
		{
			$p=1;
			$class_text.="<td>&nbsp;</td>";
		}
		if($p==1)
		{
			$class_text.="</tr>";
		}
	}
	$text=$table.$class_text.$table1;
	echo"$text";
?>
  <table width="100%" border="0" cellspacing="1" cellpadding="3">
    <tr>
      <td height="25">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="getmark" type="checkbox" id="getmark" value="1">
        <a href="../SetEnews.php" target="_blank">加水印</a>,
        <input name="getsmall" type="checkbox" id="getsmall" value="1">
        生成缩略图:缩图宽度: 
        <input name="width" type="text" id="width" value="105" size="6">
        * 高度: 
        <input name="height" type="text" id="height" value="118" size="6">
        <input type="submit" name="Submit" value="操作选中图片">
        &nbsp;&nbsp;<input type="submit" name="Submit3" value="删除选中" onclick="document.dofile.enews.value='TDelFile_all';"> </td>
    </tr>
  </table>
<?
}
//flash
elseif($type==2)
{
?>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <td height="25">插入FLASH:</td>
  </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#698CC3">
  <tr> 
    <td width="7%"><div align="center"><font color="#FFFFFF">ID</font></div></td>

⌨️ 快捷键说明

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