Browse Source

移除对FTP的支持

tags/6.2.11
tianya 9 months ago
parent
commit
0d7e7887a8
22 changed files with 19 additions and 139 deletions
  1. +0
    -1
      src/admin/api.php
  2. +0
    -1
      src/admin/dialog/select_images_post.php
  3. +0
    -1
      src/admin/dialog/select_soft_post.php
  4. +0
    -2
      src/admin/file_class.php
  5. +0
    -1
      src/admin/friendlink_add.php
  6. +0
    -2
      src/admin/inc/inc_archives_all.php
  7. +0
    -2
      src/admin/inc/inc_archives_functions.php
  8. +0
    -1
      src/admin/media_add.php
  9. +0
    -1
      src/admin/media_edit.php
  10. +0
    -2
      src/admin/swfupload.php
  11. +0
    -1
      src/admin/sys_data_done.php
  12. +0
    -6
      src/install/config.cache.inc.php
  13. +0
    -6
      src/install/sql-dfdata.txt
  14. +8
    -1
      src/install/update.txt
  15. +1
    -9
      src/system/common.inc.php
  16. +0
    -1
      src/system/customfields.func.php
  17. +2
    -2
      src/system/helpers/channelunit.helper.php
  18. +7
    -91
      src/system/helpers/file.helper.php
  19. +0
    -2
      src/system/helpers/upload.helper.php
  20. +1
    -3
      src/system/inc/inc_fun_funAdmin.php
  21. +0
    -1
      src/user/api.php
  22. +0
    -2
      src/user/inc/inc_archives_functions.php

+ 0
- 1
src/admin/api.php View File

@@ -384,7 +384,6 @@ if ($action === 'is_need_check_code') {
$mdir = MyDate($cfg_addon_savetype, $nowtme);
if (!is_dir($cfg_basedir.$activepath."/$mdir")) {
MkdirAll($cfg_basedir.$activepath."/$mdir", $cfg_dir_purview);
CloseFtp();
}
$cuserLogin = new userLogin();
$iseditor = isset($iseditor)? intval($iseditor) : 0;


+ 0
- 1
src/admin/dialog/select_images_post.php View File

@@ -42,7 +42,6 @@ if (!in_array($imgfile_type, $sparr)) {
$mdir = MyDate($cfg_addon_savetype, $nowtme);
if (!is_dir($cfg_basedir.$activepath."/$mdir")) {
MkdirAll($cfg_basedir.$activepath."/$mdir", $cfg_dir_purview);
CloseFtp();
}
$iseditor = isset($iseditor)? intval($iseditor) : 0;
$filename_name = $cuserLogin->getUserID().'-'.dd2char(MyDate("ymdHis", $nowtme).mt_rand(100, 999));


+ 0
- 1
src/admin/dialog/select_soft_post.php View File

@@ -37,7 +37,6 @@ if ($activepath == $cfg_soft_dir) {
$activepath = $activepath.'/'.$newdir;
if (!is_dir($cfg_basedir.$activepath)) {
MkdirAll($cfg_basedir.$activepath, $cfg_dir_purview);
CloseFtp();
}
}
//文件名前为手工指定,后者自动处理


+ 0
- 2
src/admin/file_class.php View File

@@ -48,7 +48,6 @@ class FileManagement
$dirname = $this->baseDir.$this->activeDir."/".$dirname;
if (is_writable($this->baseDir.$this->activeDir)) {
MkdirAll($dirname, $GLOBALS['cfg_dir_purview']);
CloseFtp();
ShowMsg("成功创建一个新目录", "file_manage_main.php?activepath=".$this->activeDir."/".$newdir);
return 1;
} else {
@@ -79,7 +78,6 @@ class FileManagement
copy($oldfile, $truepath."/$mfile");
} else {
MkdirAll($truepath, $GLOBALS['cfg_dir_purview']);
CloseFtp();
copy($oldfile, $truepath."/$mfile");
}
unlink($oldfile);


+ 0
- 1
src/admin/friendlink_add.php View File

@@ -23,7 +23,6 @@ if ($dopost == "add") {
$imgurl = $cfg_medias_dir."/flink";
if (!is_dir($cfg_basedir.$imgurl)) {
MkdirAll($cfg_basedir.$imgurl, $cfg_dir_purview);
CloseFtp();
}
$imgurl = $imgurl."/".$filename;
$mime = get_mime_type($logoimg);


+ 0
- 2
src/admin/inc/inc_archives_all.php View File

@@ -152,7 +152,6 @@ function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '')
$fp = fopen($GLOBALS['cfg_basedir'].$addvar, "w");
fwrite($fp, stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $addvar;
} else {
$ipath = $GLOBALS['cfg_cmspath']."/data/textdata";
@@ -168,7 +167,6 @@ function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '')
$fp = fopen($GLOBALS['cfg_basedir'].$filename, "w");
fwrite($fp, stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $filename;
}
} else if ($dtype == "img") {


+ 0
- 2
src/admin/inc/inc_archives_functions.php View File

@@ -41,7 +41,6 @@ function GetCurContentAlbum($body, $rfurl, &$firstdd)
$imgPath = $cfg_basedir.$imgUrl;
if (!is_dir($imgPath.'/')) {
MkdirAll($imgPath, $GLOBALS['cfg_dir_purview']);
CloseFtp();
}
$milliSecond = 'co'.dd2char(MyDate('ymdHis', time()));
foreach ($img_array as $key => $value) {
@@ -104,7 +103,6 @@ function GetCurContent($body)
$imgPath = $cfg_basedir.$imgUrl;
if (!is_dir($imgPath.'/')) {
MkdirAll($imgPath, $GLOBALS['cfg_dir_purview']);
CloseFtp();
}
$milliSecond = MyDate('His', time());
foreach ($img_array as $key => $value) {


+ 0
- 1
src/admin/media_add.php View File

@@ -50,7 +50,6 @@ if ($dopost == "upload") {
$filename = $savePath."/".$filename;
if (!is_dir($cfg_basedir.$savePath)) {
MkdirAll($cfg_basedir.$savePath, 777);
CloseFtp();
}
if (preg_match('#\.(php|pl|cgi|asp|aspx|jsp|php5|php4|php3|shtm|shtml)$#i', trim($newname))) {
ShowMsg("文件扩展名已被系统禁止", "javascript:;");


+ 0
- 1
src/admin/media_edit.php View File

@@ -109,7 +109,6 @@ else if ($dopost == 'save') {
$oldfile_path = preg_replace("#".$oldfiles[count($oldfiles) - 1]."$#", "", $oldfile);
if (!is_dir($cfg_basedir.$oldfile_path)) {
MkdirAll($cfg_basedir.$oldfile_path, 777);
CloseFtp();
}
$mime = get_mime_type($upfile);
if (preg_match("#^unknow#", $mime)) {


+ 0
- 2
src/admin/swfupload.php View File

@@ -21,7 +21,6 @@ if (empty($dopost)) {
$tmpdir = DEDEDATA.'/uploadtmp';
if (!is_dir($tmpdir)) {
MkdirAll($tmpdir, $cfg_dir_purview);
CloseFtp();
if (!is_dir($tmpdir)) {
echo "ERROR: Create {$tmpdir} dir Error! ";
exit(0);
@@ -75,7 +74,6 @@ if (empty($dopost)) {
$filedir = $cfg_image_dir.'/'.MyDate($cfg_addon_savetype, time());
if (!is_dir(DEDEROOT.$filedir)) {
MkdirAll($cfg_basedir.$filedir, $cfg_dir_purview);
CloseFtp();
}
$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis', time()));
if (file_exists($cfg_basedir.$filedir.'/'.$filename.$sname)) {


+ 0
- 1
src/admin/sys_data_done.php View File

@@ -29,7 +29,6 @@ if ($dopost == 'bak') {
}
if (!is_dir($bkdir)) {
MkdirAll($bkdir, $cfg_dir_purview);
CloseFtp();
}
//初始化使用到的变量
$tables = explode(',', $tablearr);


+ 0
- 6
src/install/config.cache.inc.php View File

@@ -31,12 +31,6 @@ $cfg_arcsptitle = 'N';
$cfg_arcautosp = 'N';
$cfg_arcautosp_size = 5;
$cfg_auot_description = 250;
$cfg_ftp_host = '';
$cfg_ftp_port = '';
$cfg_ftp_user = '';
$cfg_ftp_pwd = '';
$cfg_ftp_root = '/';
$cfg_ftp_mkdir = 'N';
$cfg_feedback_ck = 'Y';
$cfg_list_son = 'Y';
$cfg_mb_open = 'N';


+ 0
- 6
src/install/sql-dfdata.txt View File

@@ -3962,12 +3962,6 @@ INSERT INTO `#@__sysconfig` VALUES ('1','cfg_basehost','站点网址','1','strin
('32','cfg_arcautosp','是否开启长文档自动分页','6','bool','N'),
('33','cfg_arcautosp_size','文档自动分页大小','6','number','5'),
('34','cfg_auot_description','自动摘要长度(0-255,0表示不启用)','7','number','255'),
('35','cfg_ftp_host','FTP主机','2','string',''),
('36','cfg_ftp_port','FTP端口','2','number',''),
('37','cfg_ftp_user','FTP用户名','2','string',''),
('38','cfg_ftp_pwd','FTP密码','2','string',''),
('39','cfg_ftp_root','网站根在FTP中的目录','2','string','/'),
('40','cfg_ftp_mkdir','是否强制用FTP创建目录','2','bool','N'),
('41','cfg_list_son','是否包含上级列表子类文档','6','bool','Y'),
('42','cfg_mb_open','是否开启会员功能','4','bool','N'),
('43','cfg_mb_album','是否开启会员图集功能','4','bool','Y'),


+ 8
- 1
src/install/update.txt View File

@@ -128,4 +128,11 @@ ALTER TABLE `#@__arctype` ADD COLUMN `apienabled` tinyint UNSIGNED NULL DEFAULT
ALTER TABLE `#@__member` ADD COLUMN `pmid` INT(8) UNSIGNED NULL DEFAULT 0 AFTER `user_money`;

-- 6.2.11
UPDATE `#@__channeltype` SET `useraddcon` = 'soft_add.php', `usermancon` = 'content_list.php', `usereditcon` = 'soft_edit.php' WHERE `id` = 3
UPDATE `#@__channeltype` SET `useraddcon` = 'soft_add.php', `usermancon` = 'content_list.php', `usereditcon` = 'soft_edit.php' WHERE `id` = 3;
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_mkdir';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_host';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_port';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_user';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_pwd';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_root';
DELETE FROM `#@__sysconfig` WHERE `varname` = 'cfg_ftp_mkdir';

+ 1
- 9
src/system/common.inc.php View File

@@ -106,10 +106,6 @@ if (!isset($needFilter)) {
}
$registerGlobals = @ini_get("register_globals");
$isUrlOpen = @ini_get("allow_url_fopen");
$isSafeMode = @ini_get("safe_mode");
if (preg_match('/windows/i', @getenv('OS'))) {
$isSafeMode = false;
}
//系统配置参数
if (!file_exists(DEDEDATA."/config.cache.inc.php")) {
die('DedeBIZ初始化失败,确保系统正确被安装');
@@ -202,11 +198,7 @@ $cfg_soft_devteam = 'DedeBIZ';
$art_shortname = $cfg_df_ext = '.html';
$cfg_df_namerule = '{typedir}/{aid}'.$cfg_df_ext;
//新建目录的权限,如果您使用别的属性,本程不保证程序能顺利在Linux或Unix系统运行
if (isset($cfg_ftp_mkdir) && $cfg_ftp_mkdir == 'Y') {
$cfg_dir_purview = '0755';
} else {
$cfg_dir_purview = 0755;
}
$cfg_dir_purview = 0755;
//会员是否使用精简模式
$cfg_mb_lit = 'N';
//特殊全局变量


+ 0
- 1
src/system/customfields.func.php View File

@@ -218,7 +218,6 @@ function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '', $a
$fp = fopen($cfg_basedir.$filename, "w");
fwrite($fp, stripslashes($dvalue));
fclose($fp);
CloseFtp();
return $filename;
} else if ($dtype == 'img' || $dtype == 'imgfile') {
return addslashes($dvalue);


+ 2
- 2
src/system/helpers/channelunit.helper.php View File

@@ -395,8 +395,8 @@ function FormatScript($atme)
* 给属性默认值
*
* @param array $atts 属性
* @param array $attlist 属性列表
* @return string
* @param string $attlist 属性列表
* @return void
*/
function FillAttsDefault(&$atts, $attlist)
{


+ 7
- 91
src/system/helpers/file.helper.php View File

@@ -9,81 +9,7 @@ if (!defined('DEDEINC')) exit ('dedebiz');
* @license GNU GPL v2 (https://www.dedebiz.com/license)
* @link https://www.dedebiz.com
*/
$g_ftpLink = false;
/**
* 使用FTP方法创建文件夹目录
*
* @param string $truepath 真实目标地址
* @param string $mmode 创建模式
* @param string $isMkdir 是否创建目录
* @return bool
*/
if (!function_exists('FtpMkdir')) {
function FtpMkdir($truepath, $mmode, $isMkdir = true)
{
global $cfg_basedir, $cfg_ftp_root, $g_ftpLink;
OpenFtp();
$ftproot = preg_replace('/'.$cfg_ftp_root.'$/', '', $cfg_basedir);
$mdir = preg_replace('/^'.$ftproot.'/', '', $truepath);
if ($isMkdir) {
ftp_mkdir($g_ftpLink, $mdir);
}
return ftp_site($g_ftpLink, "chmod $mmode $mdir");
}
}
/**
* 改变目录模式
*
* @param string $truepath 真实地址
* @param string $mmode 模式
* @return bool
*/
if (!function_exists('FtpChmod')) {
function FtpChmod($truepath, $mmode)
{
return FtpMkdir($truepath, $mmode, false);
}
}
/**
* 打开FTP链接,打开之前确保已经设置好了FTP相关的配置信息
*
* @return void
*/
if (!function_exists('OpenFtp')) {
function OpenFtp()
{
global $cfg_basedir, $cfg_ftp_host, $cfg_ftp_port, $cfg_ftp_user, $cfg_ftp_pwd, $cfg_ftp_root, $g_ftpLink;
if (!$g_ftpLink) {
if ($cfg_ftp_host == '') {
echo "由于您的站点的PHP配置存在限制,程序尝试用FTP进行目录操作,您必须在后台指定FTP相关的变量";
exit();
}
$g_ftpLink = ftp_connect($cfg_ftp_host, $cfg_ftp_port);
if (!$g_ftpLink) {
echo "连接FTP失败";
exit();
}
if (!ftp_login($g_ftpLink, $cfg_ftp_user, $cfg_ftp_pwd)) {
echo "登录FTP失败";
exit();
}
}
}
}
/**
* 关闭FTP链接
*
* @return void
*/
if (!function_exists('CloseFtp')) {
function CloseFtp()
{
global $g_ftpLink;
if ($g_ftpLink) {
@ftp_quit($g_ftpLink);
}
}
}
/**
* 创建所有目录
*
@@ -94,17 +20,12 @@ if (!function_exists('CloseFtp')) {
if (!function_exists('MkdirAll')) {
function MkdirAll($truepath, $mmode)
{
global $cfg_ftp_mkdir, $isSafeMode, $cfg_dir_purview;
if ($isSafeMode || $cfg_ftp_mkdir == 'Y') {
return FtpMkdir($truepath, $mmode);
if (!file_exists($truepath)) {
mkdir($truepath, $mmode);
chmod($truepath, $mmode);
return true;
} else {
if (!file_exists($truepath)) {
mkdir($truepath, $cfg_dir_purview);
chmod($truepath, $cfg_dir_purview);
return true;
} else {
return true;
}
return true;
}
}
}
@@ -119,12 +40,7 @@ if (!function_exists('MkdirAll')) {
if (!function_exists('ChmodAll')) {
function ChmodAll($truepath, $mmode)
{
global $cfg_ftp_mkdir, $isSafeMode;
if ($isSafeMode || $cfg_ftp_mkdir == 'Y') {
return FtpChmod($truepath, $mmode);
} else {
return chmod($truepath, '0'.$mmode);
}
return chmod($truepath, '0'.$mmode);
}
}
/**


+ 0
- 2
src/system/helpers/upload.helper.php View File

@@ -59,7 +59,6 @@ if (!function_exists('AdminUpload')) {
}
if (!is_dir(DEDEROOT.$filedir)) {
MkdirAll($cfg_basedir.$filedir, $cfg_dir_purview);
CloseFtp();
}
$filename = $cuserLogin->getUserID().'-'.dd2char(MyDate('ymdHis', time())).$rnddd;
if ($ftype == 'imagelit') $filename .= '-L';
@@ -99,7 +98,6 @@ if (!function_exists('MemberUploads')) {
if (empty($userid)) $userid = 0;
if (!is_dir($cfg_basedir.$cfg_user_dir."/$userid")) {
MkdirAll($cfg_basedir.$cfg_user_dir."/$userid", $cfg_dir_purview);
CloseFtp();
}
//有上传文件
$allAllowType = str_replace('||', '|', $cfg_imgtype.'|'.$cfg_mediatype.'|'.$cfg_mb_addontype);


+ 1
- 3
src/system/inc/inc_fun_funAdmin.php View File

@@ -82,7 +82,7 @@ function SpGetPinyin($str, $ishead = 0, $isclose = 1)
*/
function SpCreateDir($spath)
{
global $cfg_dir_purview, $cfg_basedir, $cfg_ftp_mkdir, $isSafeMode;
global $cfg_dir_purview, $cfg_basedir;
if ($spath == '') {
return true;
}
@@ -105,12 +105,10 @@ function SpCreateDir($spath)
}
if (!$isok) {
echo "创建或修改目录<span class='text-primary'>".$truepath."</span>失败";
CloseFtp();
return false;
}
}
}
CloseFtp();
return true;
}
function jsScript($js)


+ 0
- 1
src/user/api.php View File

@@ -157,7 +157,6 @@ if ($action === 'is_need_check_code') {
}
if (!is_dir($cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}")) {
MkdirAll($cfg_basedir.$cfg_user_dir."/{$cfg_ml->M_ID}", $cfg_dir_purview);
CloseFtp();
}
//头像特殊处理
$fsize = filesize($ff["tmp_name"]);


+ 0
- 2
src/user/inc/inc_archives_functions.php View File

@@ -35,7 +35,6 @@ function GetCurContentAlbum($body, $rfurl, &$firstdd)
$imgPath = $cfg_basedir.$imgUrl;
if (!is_dir($imgPath."/")) {
MkdirAll($imgPath, $GLOBALS['cfg_dir_purview']);
CloseFtp();
}
$milliSecond = MyDate("ymdHis", time());
foreach ($img_array as $key => $value) {
@@ -303,7 +302,6 @@ function GetCurContent(&$body)
$imgPath = $cfg_basedir.$imgUrl;
if (!is_dir($imgPath."/")) {
MkdirAll($imgPath, $GLOBALS['cfg_dir_purview']);
CloseFtp();
}
$milliSecond = MyDate("ymdHis", time());
foreach ($img_array as $key => $value) {


Loading…
Cancel
Save