pligg9.7beta搭起后HTML编辑器插件的安装(-fckeditor的配置与修改变相支持中文文件名:默认上传后不能正常调用-)就像csdn的这个编辑器
来源:互联网 发布:免费国际交友软件 编辑:程序博客网 时间:2024/05/16 09:00
pligg9.7beta搭起后HTML编辑器插件的安装(fckeditor的配置与修改变相支持中文文件名:默认上传后不能正常调用)就像csdn的这个编辑器
类似文章:pligg9.7beta的后HTML编辑器插件的安装(tinymce_2_1_1_1)(以及使用中遇到的点滴问题解决办法)
地址:http://blog.csdn.net/clin003/archive/2007/08/18/1749260.aspx
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
由于tinymce的双引号(其实后来发现不是tinymce的问题)和 pligg9.7beta的“添加到”的标题截取有点冲突:在页面源代码出现双引号导致,收藏到digg连接显示混乱现象。目前还没去看怎么解决。
效果图:
-------------by clin003 at 20070830---------------------------------------
首先去下载fckeditor这个不用说啦。
解压——>上传fckeditor文件夹到——>/pligg所在目录/plugins/这里。(可以假定谣传到这里,建议如果想自定义fckeditor的话等配置完成后再上传)。
接着打开/pligg所在目录/templates/yget/下边的submit_step_2.tpl模板,在
{config_load file="/libs/lang.conf"}
后(大概在第一行)添加:
{literal}<script type="text/javascript" src="/beta/plugins/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
//oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ; // '/fckeditor/' is the default value.
var oFCKeditor = new FCKeditor( 'bodytext' ) ;
oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ;
oFCKeditor.Value = 'This hello.' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '500' ;
oFCKeditor.ReplaceTextarea() ;
}
</script> {/literal}
这里的basepath就是你的fckeditor目录,width定义编辑器宽度,height为高度,replacetextarea替换原编辑框(这里牵涉到fckeditor是用的不同方法我不举例啦,这个方法虽然不推荐,但是很适合pligg)。
更多的参数:
参考fckeditor.js然后google中文意思。
这一步完成几乎就可以正常使用啦。
如果以前装过tinymce,你可能修改过pligg.pl建议修改回原文件(或直接用原文件覆盖)。
---------------------
以下修改的部分,如果觉得麻烦,可以直接下载我打包的fckeditor:http://clin003.com/bbeta/fckeditor2.4.3.rar
下载后直接参考上边的步骤就可以支持(pligg9.7beta)php中可视化编辑器,包括可上传带中文名字的图片,视频,以及其他自定义类型的文件到服务器
下面说说fckeditor的修改(可解决上边安装完成后使用中遇到的部分问题):
我使用php的,所以要修改一些地方
1.fckconfig.js中找到
var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php
参看我的修改为php。
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
2.添加字体
FCKConfig.FontNames = '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
修改这里。
3.修改默认编辑器功能按钮
FCKConfig.ToolbarSets["Default"] = [
['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
['TextColor','BGColor'],
'/',
['Style','FontFormat','FontName','FontSize']
] ;
这里做相应修改。我的已经做过部分修改,请根据自己情况自行修改。
4.找到config.php文件在目录--fckeditor-editor-filemanager-browser-default-connectors-php下
$Config['Enabled'] = true ;//edit by clin003 for use php lang
$date_time_arrayss = getdate (time());
$dddfiles= $date_time_arrayss[ "mon"].$date_time_arrayss[ "year"];
// Path to user files relative to the document root.
$Config['UserFilesPath'] = '/beta/userfiles/'.$dddfiles.'/' ;//edit by clin003 use time for subdir
参照我的修改,//号后为我做的说明。请参照
主要目的是使用时间来命名上传文件(避免中文名字浏览器认不出来)
5.找到config.php文件在目录--fckeditor-editor-filemanager-upload-php-下
$Config['Enabled'] = true ;
// Set if the file type must be considere in the target path.
// Ex: /userfiles/image/ or /userfiles/file/
$Config['UseFileType'] = true ;
//add by clin003 for submunu for files
$date_time_arrayss = getdate (time());
$dddfiles= $date_time_arrayss[ "mon"].$date_time_arrayss[ "year"];
//add by clin003 for submunu for files useing time number.
// Path to uploaded files relative to the document root.
$Config['UserFilesPath'] = '/beta/userfiles/'.$dddfiles.'/' ;//edit by clin003 for submunu for files useing time number.
修改办法雷同上步。
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
6.找到commands.php文件在目录--fckeditor-editor-filemanager-browser-default-connectors-php-下
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) )
{
global $Config ;
$oFile = $_FILES['NewFile'] ;
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '///.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
//$sOriginalFileName = $sFileName ;
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) )
{
$iCounter = 0 ;
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
$sFilePath = $sServerDir . $sFileName ;
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
// $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
break ;
}
}
}
else
$sErrorNumber = '202' ;
}
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
修改请参考我给出的多余代码定位位置
7.找到upload.php文件在目录--fckeditor-editor-filemanager-upload-php-下
找到
// Check if this uploader has been enabled.
if ( !$Config['Enabled'] )
SendResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/upload/php/config.php" file' ) ;
// Check if the file has been correctly uploaded.
if ( !isset( $_FILES['NewFile'] ) || is_null( $_FILES['NewFile']['tmp_name'] ) || $_FILES['NewFile']['name'] == '' )
SendResults( '202' ) ;
// Get the posted file.
$oFile = $_FILES['NewFile'] ;
// Get the uploaded file name extension.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '///.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
// The the file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
// Check if it is an allowed type.
if ( !in_array( $sType, array('File','Image','Flash','Media') ) )
SendResults( 1, '', '', 'Invalid type specified' ) ;
// Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$sType] ;
$arDenied = $Config['DeniedExtensions'][$sType] ;
// Check if it is an allowed extension.
if ( ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) || ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) )
SendResults( '202' ) ;
$sErrorNumber = '0' ;
$sFileUrl = '' ;
// Initializes the counter used to rename the file, if another one with the same name already exists.
$iCounter = 0 ;
// Get the target directory.
if ( isset( $Config['UserFilesAbsolutePath'] ) && strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
$sServerDir = $Config['UserFilesAbsolutePath'] ;
else
$sServerDir = GetRootPath() . $Config["UserFilesPath"] ;
if ( $Config['UseFileType'] )
$sServerDir .= strtolower($sType) . '/' ;
//check for the directory before uploading the file
if(!is_dir($sServerDir))
{
mkdir($sServerDir, 0711);
}
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
// Compose the file path.
$sFilePath = $sServerDir . $sFileName ;
// If a file with that name already exists.
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
if ( $Config['UseFileType'] )
$sFileUrl = $Config["UserFilesPath"] . strtolower($sType) . '/' . $sFileName ;
else
$sFileUrl = $Config["UserFilesPath"] . $sFileName ;
break ;
}
}
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
修改,第6步是参照这里改的。
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
-------------------
-------------by clin003 at 20070830---------------------------------------
-------下边的修改没有打包,如果需要请自行修改----参考自:http: //blog.csdn.net/tearzhao/archive/2007/08/21/1752414.aspx----------------------------------
在editor文件夹中修改dialog目录下的fck_image/fck_image.js文件内容
把tab,link和upload,advanced三个标签注释掉,弹出窗口的时候不再显示链接,上传和高级标签
if ( !bImageButton && !FCKConfig.ImageDlgHideLink )
//window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ;
类似文章:pligg9.7beta的后HTML编辑器插件的安装(tinymce_2_1_1_1)(以及使用中遇到的点滴问题解决办法)
地址:http://blog.csdn.net/clin003/archive/2007/08/18/1749260.aspx
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
由于tinymce的双引号(其实后来发现不是tinymce的问题)和 pligg9.7beta的“添加到”的标题截取有点冲突:在页面源代码出现双引号导致,收藏到digg连接显示混乱现象。目前还没去看怎么解决。
效果图:
-------------by clin003 at 20070830---------------------------------------
首先去下载fckeditor这个不用说啦。
解压——>上传fckeditor文件夹到——>/pligg所在目录/plugins/这里。(可以假定谣传到这里,建议如果想自定义fckeditor的话等配置完成后再上传)。
接着打开/pligg所在目录/templates/yget/下边的submit_step_2.tpl模板,在
{config_load file="/libs/lang.conf"}
{config_load file="/libs/lang.conf"}
{literal}<script type="text/javascript" src="/beta/plugins/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
//oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ; // '/fckeditor/' is the default value.
var oFCKeditor = new FCKeditor( 'bodytext' ) ;
oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ;
oFCKeditor.Value = 'This hello.' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '500' ;
oFCKeditor.ReplaceTextarea() ;
}
</script> {/literal}
{literal}<script type="text/javascript" src="/beta/plugins/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
//oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ; // '/fckeditor/' is the default value.
var oFCKeditor = new FCKeditor( 'bodytext' ) ;
oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ;
oFCKeditor.Value = 'This hello.' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '500' ;
oFCKeditor.ReplaceTextarea() ;
}
</script> {/literal}
<script type="text/javascript">
window.onload = function()
{
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
//oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ; // '/fckeditor/' is the default value.
var oFCKeditor = new FCKeditor( 'bodytext' ) ;
oFCKeditor.BasePath = '/beta/plugins/fckeditor/' ;
oFCKeditor.Value = 'This hello.' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '500' ;
oFCKeditor.ReplaceTextarea() ;
}
</script> {/literal}
更多的参数:
参考fckeditor.js然后google中文意思。
这一步完成几乎就可以正常使用啦。
如果以前装过tinymce,你可能修改过pligg.pl建议修改回原文件(或直接用原文件覆盖)。
---------------------
以下修改的部分,如果觉得麻烦,可以直接下载我打包的fckeditor:http://clin003.com/bbeta/fckeditor2.4.3.rar
下载后直接参考上边的步骤就可以支持(pligg9.7beta)php中可视化编辑器,包括可上传带中文名字的图片,视频,以及其他自定义类型的文件到服务器
下面说说fckeditor的修改(可解决上边安装完成后使用中遇到的部分问题):
我使用php的,所以要修改一些地方
1.fckconfig.js中找到
var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php
参看我的修改为php。
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
2.添加字体
FCKConfig.FontNames = '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
修改这里。
3.修改默认编辑器功能按钮
FCKConfig.ToolbarSets["Default"] = [
['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
['TextColor','BGColor'],
'/',
['Style','FontFormat','FontName','FontSize']
] ;
这里做相应修改。我的已经做过部分修改,请根据自己情况自行修改。
4.找到config.php文件在目录--fckeditor-editor-filemanager-browser-default-connectors-php下
$Config['Enabled'] = true ;//edit by clin003 for use php lang
$date_time_arrayss = getdate (time());
$dddfiles= $date_time_arrayss[ "mon"].$date_time_arrayss[ "year"];
// Path to user files relative to the document root.
$Config['UserFilesPath'] = '/beta/userfiles/'.$dddfiles.'/' ;//edit by clin003 use time for subdir
参照我的修改,//号后为我做的说明。请参照
主要目的是使用时间来命名上传文件(避免中文名字浏览器认不出来)
5.找到config.php文件在目录--fckeditor-editor-filemanager-upload-php-下
$Config['Enabled'] = true ;
// Set if the file type must be considere in the target path.
// Ex: /userfiles/image/ or /userfiles/file/
$Config['UseFileType'] = true ;
//add by clin003 for submunu for files
$date_time_arrayss = getdate (time());
$dddfiles= $date_time_arrayss[ "mon"].$date_time_arrayss[ "year"];
//add by clin003 for submunu for files useing time number.
// Path to uploaded files relative to the document root.
$Config['UserFilesPath'] = '/beta/userfiles/'.$dddfiles.'/' ;//edit by clin003 for submunu for files useing time number.
修改办法雷同上步。
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
6.找到commands.php文件在目录--fckeditor-editor-filemanager-browser-default-connectors-php-下
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) )
{
global $Config ;
$oFile = $_FILES['NewFile'] ;
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '///.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
//$sOriginalFileName = $sFileName ;
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) )
{
$iCounter = 0 ;
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
$sFilePath = $sServerDir . $sFileName ;
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
// $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
break ;
}
}
}
else
$sErrorNumber = '202' ;
}
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) )
{
global $Config ;
$oFile = $_FILES['NewFile'] ;
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '//.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
//$sOriginalFileName = $sFileName ;
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) )
{
$iCounter = 0 ;
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
$sFilePath = $sServerDir . $sFileName ;
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
// $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
break ;
}
}
}
else
$sErrorNumber = '202' ;
}
{
global $Config ;
$oFile = $_FILES['NewFile'] ;
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder ) ;
// Get the uploaded file name.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '//.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
//$sOriginalFileName = $sFileName ;
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
if ( ( count($arAllowed) == 0 || in_array( $sExtension, $arAllowed ) ) && ( count($arDenied) == 0 || !in_array( $sExtension, $arDenied ) ) )
{
$iCounter = 0 ;
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
$sFilePath = $sServerDir . $sFileName ;
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
// $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ;
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
break ;
}
}
}
else
$sErrorNumber = '202' ;
}
修改请参考我给出的多余代码定位位置
7.找到upload.php文件在目录--fckeditor-editor-filemanager-upload-php-下
找到
// Check if this uploader has been enabled.
if ( !$Config['Enabled'] )
SendResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/upload/php/config.php" file' ) ;
// Check if the file has been correctly uploaded.
if ( !isset( $_FILES['NewFile'] ) || is_null( $_FILES['NewFile']['tmp_name'] ) || $_FILES['NewFile']['name'] == '' )
SendResults( '202' ) ;
// Get the posted file.
$oFile = $_FILES['NewFile'] ;
// Get the uploaded file name extension.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '///.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
// The the file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
// Check if it is an allowed type.
if ( !in_array( $sType, array('File','Image','Flash','Media') ) )
SendResults( 1, '', '', 'Invalid type specified' ) ;
// Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$sType] ;
$arDenied = $Config['DeniedExtensions'][$sType] ;
// Check if it is an allowed extension.
if ( ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) || ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) )
SendResults( '202' ) ;
$sErrorNumber = '0' ;
$sFileUrl = '' ;
// Initializes the counter used to rename the file, if another one with the same name already exists.
$iCounter = 0 ;
// Get the target directory.
if ( isset( $Config['UserFilesAbsolutePath'] ) && strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
$sServerDir = $Config['UserFilesAbsolutePath'] ;
else
$sServerDir = GetRootPath() . $Config["UserFilesPath"] ;
if ( $Config['UseFileType'] )
$sServerDir .= strtolower($sType) . '/' ;
//check for the directory before uploading the file
if(!is_dir($sServerDir))
{
mkdir($sServerDir, 0711);
}
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
// Compose the file path.
$sFilePath = $sServerDir . $sFileName ;
// If a file with that name already exists.
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
if ( $Config['UseFileType'] )
$sFileUrl = $Config["UserFilesPath"] . strtolower($sType) . '/' . $sFileName ;
else
$sFileUrl = $Config["UserFilesPath"] . $sFileName ;
break ;
}
}
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
// Check if this uploader has been enabled.
if ( !$Config['Enabled'] )
SendResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/upload/php/config.php" file' ) ;
// Check if the file has been correctly uploaded.
if ( !isset( $_FILES['NewFile'] ) || is_null( $_FILES['NewFile']['tmp_name'] ) || $_FILES['NewFile']['name'] == '' )
SendResults( '202' ) ;
// Get the posted file.
$oFile = $_FILES['NewFile'] ;
// Get the uploaded file name extension.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '//.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
// The the file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
// Check if it is an allowed type.
if ( !in_array( $sType, array('File','Image','Flash','Media') ) )
SendResults( 1, '', '', 'Invalid type specified' ) ;
// Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$sType] ;
$arDenied = $Config['DeniedExtensions'][$sType] ;
// Check if it is an allowed extension.
if ( ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) || ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) )
SendResults( '202' ) ;
$sErrorNumber = '0' ;
$sFileUrl = '' ;
// Initializes the counter used to rename the file, if another one with the same name already exists.
$iCounter = 0 ;
// Get the target directory.
if ( isset( $Config['UserFilesAbsolutePath'] ) && strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
$sServerDir = $Config['UserFilesAbsolutePath'] ;
else
$sServerDir = GetRootPath() . $Config["UserFilesPath"] ;
if ( $Config['UseFileType'] )
$sServerDir .= strtolower($sType) . '/' ;
//check for the directory before uploading the file
if(!is_dir($sServerDir))
{
mkdir($sServerDir, 0711);
}
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
// Compose the file path.
$sFilePath = $sServerDir . $sFileName ;
// If a file with that name already exists.
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
if ( $Config['UseFileType'] )
$sFileUrl = $Config["UserFilesPath"] . strtolower($sType) . '/' . $sFileName ;
else
$sFileUrl = $Config["UserFilesPath"] . $sFileName ;
break ;
}
}
if ( !$Config['Enabled'] )
SendResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/upload/php/config.php" file' ) ;
// Check if the file has been correctly uploaded.
if ( !isset( $_FILES['NewFile'] ) || is_null( $_FILES['NewFile']['tmp_name'] ) || $_FILES['NewFile']['name'] == '' )
SendResults( '202' ) ;
// Get the posted file.
$oFile = $_FILES['NewFile'] ;
// Get the uploaded file name extension.
$sFileName = $oFile['name'] ;
// Replace dots in the name with underscores (only one dot can be there... security issue).
if ( $Config['ForceSingleExtension'] )
$sFileName = preg_replace( '//.(?![^.]*$)/', '_', $sFileName ) ;
//add by clin003 at 20070830 for chinese file name can be get.!
$date_time_array_files = getdate (time());
$ddd_chinese_file_names= $date_time_array_files[ "seconds"].$date_time_array_files[ "minutes"].$date_time_array_files[ "hours"].$date_time_array_files[ "mday"].$date_time_array_files[ "mon"].$date_time_arrayss[ "year"];
//$sOriginalFileName = $sFileName ;
$sOriginalFileName =$ddd_chinese_file_names;//edit by clin003 at 20070830 for chinese names
// Get the extension.
$sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ;
$sExtension = strtolower( $sExtension ) ;
// The the file type (from the QueryString, by default 'File').
$sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ;
// Check if it is an allowed type.
if ( !in_array( $sType, array('File','Image','Flash','Media') ) )
SendResults( 1, '', '', 'Invalid type specified' ) ;
// Get the allowed and denied extensions arrays.
$arAllowed = $Config['AllowedExtensions'][$sType] ;
$arDenied = $Config['DeniedExtensions'][$sType] ;
// Check if it is an allowed extension.
if ( ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) || ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) )
SendResults( '202' ) ;
$sErrorNumber = '0' ;
$sFileUrl = '' ;
// Initializes the counter used to rename the file, if another one with the same name already exists.
$iCounter = 0 ;
// Get the target directory.
if ( isset( $Config['UserFilesAbsolutePath'] ) && strlen( $Config['UserFilesAbsolutePath'] ) > 0 )
$sServerDir = $Config['UserFilesAbsolutePath'] ;
else
$sServerDir = GetRootPath() . $Config["UserFilesPath"] ;
if ( $Config['UseFileType'] )
$sServerDir .= strtolower($sType) . '/' ;
//check for the directory before uploading the file
if(!is_dir($sServerDir))
{
mkdir($sServerDir, 0711);
}
$sFileName= $sOriginalFileName . '_' .'0'. '.' . $sExtension ;//add by clin003 at 20070830 for chinese names
while ( true )
{
// Compose the file path.
$sFilePath = $sServerDir . $sFileName ;
// If a file with that name already exists.
if ( is_file( $sFilePath ) )
{
$iCounter++ ;
$sFileName = $sOriginalFileName . '_' . $iCounter . '.' . $sExtension ;//edit by clin003 at 20070830 for chinese names
$sErrorNumber = '201' ;
}
else
{
move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ;
if ( is_file( $sFilePath ) )
{
$oldumask = umask(0) ;
chmod( $sFilePath, 0744 ) ;
umask( $oldumask ) ;
}
if ( $Config['UseFileType'] )
$sFileUrl = $Config["UserFilesPath"] . strtolower($sType) . '/' . $sFileName ;
else
$sFileUrl = $Config["UserFilesPath"] . $sFileName ;
break ;
}
}
修改,第6步是参照这里改的。
by clin003 from http://clin003.com或http://blog.csdn.net/clin003/
-------------------
-------------by clin003 at 20070830---------------------------------------
-------下边的修改没有打包,如果需要请自行修改----参考自:http: //blog.csdn.net/tearzhao/archive/2007/08/21/1752414.aspx----------------------------------
在editor文件夹中修改dialog目录下的fck_image/fck_image.js文件内容
把tab,link和upload,advanced三个标签注释掉,弹出窗口的时候不再显示链接,上传和高级标签
if ( !bImageButton && !FCKConfig.ImageDlgHideLink )
//window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ;
if ( FCKConfig.ImageUpload )
//window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
if ( !FCKConfig.ImageDlgHideAdvanced )
//window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
function OnDialogTabChange( tabCode )
{
ShowE('divInfo' , ( tabCode == 'Info' ) ) ;
//ShowE('divLink' , ( tabCode == 'Link' ) ) ;
//ShowE('divUpload' , ( tabCode == 'Upload' ) ) ;
//ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ;
}
同样,flash修改方式和image相同.
在editor文件夹中修改dialog目录下的fck_imageck_image.js文件内容
把tab,link和upload,advanced三个标签注释掉,弹出窗口的时候不再显示链接,上传和高级标签
if ( !bImageButton && !FCKConfig.ImageDlgHideLink )
//window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ;
if ( FCKConfig.ImageUpload )
//window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
if ( !FCKConfig.ImageDlgHideAdvanced )
//window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
function OnDialogTabChange( tabCode )
{
ShowE('divInfo' , ( tabCode == 'Info' ) ) ;
//ShowE('divLink' , ( tabCode == 'Link' ) ) ;
//ShowE('divUpload' , ( tabCode == 'Upload' ) ) ;
//ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ;
}
同样,flash修改方式和image相同.
把tab,link和upload,advanced三个标签注释掉,弹出窗口的时候不再显示链接,上传和高级标签
if ( !bImageButton && !FCKConfig.ImageDlgHideLink )
//window.parent.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ;
if ( FCKConfig.ImageUpload )
//window.parent.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ;
if ( !FCKConfig.ImageDlgHideAdvanced )
//window.parent.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ;
function OnDialogTabChange( tabCode )
{
ShowE('divInfo' , ( tabCode == 'Info' ) ) ;
//ShowE('divLink' , ( tabCode == 'Link' ) ) ;
//ShowE('divUpload' , ( tabCode == 'Upload' ) ) ;
//ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ;
}
同样,flash修改方式和image相同.
------------------------------------------
- pligg9.7beta搭起后HTML编辑器插件的安装(-fckeditor的配置与修改变相支持中文文件名:默认上传后不能正常调用-)就像csdn的这个编辑器
- pligg9.7beta搭起后HTML编辑器插件的安装——fckeditor的配置与修改变相支持中文文件名:默认上传后不能正常调用
- pligg9.7beta搭起后HTML编辑器插件的安装(fckeditor的配置与修改变相支持中文文件名)
- pligg9.7beta搭起后HTML编辑器插件的安装——fckeditor的配置与修改变相支持中文文件名
- pligg9.7beta的后HTML编辑器插件的安装(tinymce_2_1_1_1)(以及使用中遇到的点滴问题解决办法)
- Html在线编辑器FCKeditor的修改与设置-文件上传部分管理部分
- FCKeditor html 文本编辑器的配置应用
- FCKEditor使用说明(Csdn博客就是用的这个编辑器)
- FCKEditor使用说明(Csdn博客就是用的这个编辑器)
- 关于ueditor编辑器插件的使用记录 --- 解决"后端配置项没有正常加载,上传插件不能正常使用"上传图片处的问题
- html编辑器fckeditor的使用
- pligg9.7beta的子分类添加
- FCKEditor 在线编辑器 的配置
- FCKeditor是使用非常广泛的HTML编辑器,本文从 ASP.NET 的使用场景对 FCKeditor 与 FCKeditor.NET 的配置、功能扩展(如自定义文件上传子目录、自定义文件名、上传图片的后期处理等)、以及安全性进行初步的阐述。
- FCKeditor HTML在线编辑器的使用以及配置
- HTML编辑器FCKeditor在J2EE项目的使用配置
- 非正常关闭vi编辑器后提示错误的解决方法
- CSDN的blog文本编辑器-FCKeditor
- Prolog教程 2
- 关于数论中的互质数的最大不能组合数
- 结构在优化编译中的对齐问题 pragma(push, N) pragma(pop)
- Stop-Transcript 帮助信息
- Prolog教程 3
- pligg9.7beta搭起后HTML编辑器插件的安装(-fckeditor的配置与修改变相支持中文文件名:默认上传后不能正常调用-)就像csdn的这个编辑器
- 姑娘的心啊,已经飞了
- C/C++语言面试题目
- SQL语句导入导出大全
- 一道清华上机题目(求n! 高精度)
- 歡迎來坐坐!
- tomcat多域名绑定
- 泰国决定处罚华为 最高罚款50亿元
- AOP技术研究——AOP技术基础