其中 data\bbscache文件 ftpserver.php 放在程序对应的文件里面
修改文件列表:(PHP文件6个,HTML文件1个)
job.php,read.php,show.php,setforum.php,postupload.php,template.php,setforum.htm
1. 数据库升级 进入phpMyAdmin -> SQL 下运行下面升级
ALTER TABLE `pw_forums` ADD `remoteftp` INT( 3 ) UNSIGNED DEFAULT '0' NOT NULL ;
ALTER TABLE `pw_attachs` ADD `remoteftp` INT( 3 ) UNSIGNED DEFAULT '0' NOT NULL ;
2. job.php ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到require_once('global.php');
◆下面加入
//远程ftp修改by axing
include_once(D_P.'data/bbscache/ftpserver.php');
//远程ftp修改by axing
◆找到
if(!$attach_url && !is_readable("$attachdir/$attachurl")){
Showmsg('job_attach_error');
}
◆替换成
//远程ftp
if(!$attach_url && !is_readable("$attachdir/$attachurl") && !$remoteftp){
Showmsg('job_attach_error');
}
//远程ftp
◆找到
if($attach_url && !file_exists("$attachdir/$attachurl") && function_exists('file_get_contents')){
$downcontent=file_get_contents($attach_url."/$attachurl");
◆替换成
if(($attach_url && !file_exists("$attachdir/$attachurl") && function_exists('file_get_contents'))||$remoteftp){
//远程ftp by axing
if($remoteftp) {
$downcontent=file_get_contents($ftplist[$remoteftp][url]."/$attachurl");
}else{
$downcontent=file_get_contents($attach_url."/$attachurl");
}
//远程ftp by axing
◆找到
P_unlink("$attachdir/$attachurl");
◆替换成
//远程ftp by axing
if($remoteftp) {
del_ftp_attach($remoteftp,$attachurl);
}else {
P_unlink("$attachdir/$attachurl");
}
//远程ftp by axing
3. read.php ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到
require_once(R_P.'require/bbscode.php');
◆下面加入
//远程ftp修改by axing
include_once(D_P.'data/bbscache/ftpserver.php');
//远程ftp修改by axing
◆找到
if ($groupid != 3 && !$foruminfo['allowvisit'] && (!$foruminfo['forumadmin'] || strpos($foruminfo['forumadmin'],','.$windid.',')===false)){
◆替换成
if ($windid != $manager && $groupid != 3 && !$foruminfo['allowvisit'] && (!$foruminfo['forumadmin'] || strpos($foruminfo['forumadmin'],','.$windid.',')===false)){
◆找到
$db_signwindcode,$fid,$tid,$pid,
◆后面加入
$remoteftp,$ftplist,
◆找到
$a_url=$attachpath.'/'.$at['attachurl'];
◆下面加入
//远程ftp修改 by axing
} elseif($at['remoteftp']){
$a_url=$ftplist[$at['remoteftp']][url].'/'.$at['attachurl'];//远程的图片地址
//远程ftp修改 by axing
4. show.php ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到
include_once(D_P.'data/bbscache/forum_cache.php');
◆下面加入
//远程ftp
include_once(D_P.'data/bbscache/ftpserver.php');
//远程ftp
◆找到
a.descrip,
◆后面加入(有两处都要记得改)
a.remoteftp,
◆找到
} else{
continue;
}
◆上面加入
//远程ftp
} elseif($rt['remoteftp']){
$rt['a_url']=$ftplist[$rt['remoteftp']][url].'/'.$rt['attachurl'];
//远程ftp
◆找到
}
}else{
Showmsg('pic_not_exists');
◆上面加入
//远程ftp
} elseif($rt['remoteftp']){
$rt['a_url']=$ftplist[$rt['remoteftp']][url].'/'.$rt['attachurl'];
//远程ftp
5. admin/setforum.php ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到
include_once(D_P.'data/bbscache/forumcache.php');
◆下面加入
//远程ftp修改 by axing
include_once("./data/bbscache/ftpserver.php");//引入FTP服务器列表
//远程ftp修改 by axing
◆找到
$viewdownload =str_replace("_{$value}_",'checked',$viewdownload);
◆下面加入
//远程ftp修改
$ftpselected[$remoteftp]='selected';
$ftpselect="<option value=0>本地空间</option>";
foreach($ftplist as $ftpinfo){
$ftpid=$ftpinfo[id];
$ftpselect.="<option value=$ftpinfo[id] $ftpselected[$ftpid]>$ftpinfo[name]</option>";
}
//远程ftp修改by axing
◆找到
ifhide='".(int)$ifhide."'
◆后面插入
,remoteftp='$remoteftp'
6. require/postupload.php ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到
!function_exists('readover') && exit('Forbidden');
◆下面加入
//远程ftp上传修改 by axing
include_once(D_P.'data/bbscache/ftpserver.php');
//远程ftp上传修改 by axing
◆找到
$fileuplodeurl= $savedir.'/'.$fileuplodeurl;
}
◆替换成
}
//远程ftp修改 by axing
if($foruminfo['remoteftp']){
$remoteftpid=$foruminfo['remoteftp'];
$result = ftpconnect($ftplist[$remoteftpid]);
ftp_cdup($result);
if($db_attachdir){
if(!@ftp_chdir($result,$savedir)){
ftp_mkdir($result,$savedir);
ftp_chdir($result,$savedir);
}
$attach_fname0=$fileuplodeurl;
$fileuplodeurl= $savedir.'/'.$fileuplodeurl;
}else{
$attach_fname0=$fileuplodeurl;
}
//$db->query("INSERT INTO pw_ftperror (attachment, ftpdate, ftpid) VALUES ('$fileuplodeurl', '$timestamp','$foruminfo[remoteftp]')");
//$attid = $db->insert_id();
if(@ftp_put($result, $attach_fname0, $atc_attachment, FTP_BINARY)){ //上传文件
$size=ceil(ftp_size($result,$attach_fname0)/1024);
ftp_close($result);
// $db->query("delete from pw_ftperror where aid = $attid");
}else{
showmsg('附件远程上传失败!');//远程上传失败
}
}else{
//远程ftp修改 by axing
$fileuplodeurl= $savedir.'/'.$fileuplodeurl;
◆找到
Showmsg('upload_content_error');
}
◆下面加入
//远程 ftp
$size=ceil(filesize("$attachdir/$fileuplodeurl")/1024);
}
//远程 ftp
◆找到
$size=ceil(filesize("$attachdir/$fileuplodeurl")/1024);
$atc_attachment_name=addslashes($atc_attachment_name);
$db->update("INSERT INTO pw_attachs SET fid='$fid',uid='$winduid',hits=0,name='$atc_attachment_name',type='$type',size='$size',attachurl='$fileuplodeurl',needrvrc='$needrvrc',uploadtime='$timestamp',descrip='$descrip'");
◆替换成
$atc_attachment_name=addslashes($atc_attachment_name);
//远程ftp
$db->update("INSERT INTO pw_attachs SET fid='$fid',uid='$winduid',hits=0,name='$atc_attachment_name',type='$type',size='$size',attachurl='$fileuplodeurl',needrvrc='$needrvrc',uploadtime='$timestamp',descrip='$descrip',remoteftp='$foruminfo[remoteftp]'");
//远程ftp
◆找到
'desc' => str_replace('\\','',$descrip)
◆下面加入
'remoteftp' => $foruminfo[remoteftp]
6.2
如果需要用到txt附件上传时,自动切割并依次上传功能,上面第6步不用修改,直接上传压缩包中的postupload_txt.php 到require/目录即可.
并结合这个插件进行使用.https://blog.csdn.net/viqecel/article/details/79440688
7. require/template.php ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到
include_once(D_P."data/bbscache/forumcache.php");
◆下面加入
//远程ftp
include_once(D_P.'data/bbscache/ftpserver.php');
//远程ftp
◆找到
$a_url="$db_bbsurl/$attachpath/$at[attachurl]";
◆下面加入
//远程ftp
}elseif($at['remoteftp']){
$a_url=$ftplist[$at['remoteftp']][url].'/'.$at['attachurl'];
//远程ftp
8. template/admin/setforum.htm ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
◆找到
<tr class=b>
<td><input type="checkbox" name="otherforum[logo]" value="1"></td>
<td>版块图标</td>
<td><input type="text" size="30" name="logo" value="$logo"></td>
</tr>
◆下面加入
<tr class=b>
<td><input type="checkbox" name="otherforum[remoteftp]" value="1"></td>
<td>是否开启远程附件上传</td>
<td><select name="remoteftp">$ftpselect</select></td>
</tr>
(完成...)