I have TinyPortal v0.9.8 with SMF 1.1.11 and I'm trying to install the latest version of FCKeditor (2.6.5). Replacing the whole dir works great, except for image upload. As I understand I need to do some modifications to work with TP, but I can't find any explicit info. Here's what I've done so far:
config.php
1. replaced $Config['Enabled'] = false ; with $Config['Enabled'] = true ;
2. replaced $Config['UserFilesPath'] = '/userfiles/' ; with
$abspath = realpath( './' ) ;
$self = substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/'));
$root = substr($abspath, 0, strlen($abspath) - strlen($self));
$relpath = substr($abspath, strlen($root), strpos(strtolower($abspath), 'fckeditor') - strlen($root)).'tp-images/';
$relpath = strtr($relpath, '\\', '/');
$root = strtr($root, '\\', '/');
$Config['UserFilesPath'] = $relpath;
commands.php
3. added this at the beginning
function GetImgPath()
{
// fetch the cookie
if(isset($_COOKIE['tp-imgconfig']))
$img_opts=explode("|",$_COOKIE['tp-imgconfig']);
$tinyMCE_tprefix='';
if(isset($img_opts))
{
if($img_opts[0]=='2')
$tinyMCE_tprefix = 'group_'.$img_opts[1].'_';
elseif($img_opts[0]=='3')
$tinyMCE_tprefix = 'user_'.$img_opts[2].'_';
}
return $tinyMCE_tprefix;
}
4. added $ImagePrefix = GetImgPath(); and if ($ImagePrefix == '' || strpos(strtolower($sFile), strtolower($ImagePrefix)) !== false ) in function GetFoldersAndFiles
function GetFoldersAndFiles( $resourceType, $currentFolder )
{
$ImagePrefix = GetImgPath();
// Map the virtual path to the local server path.
$sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ;
// Arrays that will hold the folders and files names.
$aFolders = array() ;
$aFiles = array() ;
$oCurrentFolder = @opendir( $sServerDir ) ;
if ($oCurrentFolder !== false)
{
while ( $sFile = readdir( $oCurrentFolder ) )
{
if ( $sFile != '.' && $sFile != '..' )
{
if ( is_dir( $sServerDir . $sFile ) )
$aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ;
else
{
if ($ImagePrefix == '' || strpos(strtolower($sFile), strtolower($ImagePrefix)) !== false )
{
$iFileSize = @filesize( $sServerDir . $sFile ) ;
if ( !$iFileSize ) {
$iFileSize = 0 ;
}
if ( $iFileSize > 0 )
{
$iFileSize = round( $iFileSize / 1024 ) ;
if ( $iFileSize < 1 )
$iFileSize = 1 ;
}
$aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ;
}
}
}
}
closedir( $oCurrentFolder ) ;
}
5. added $ImagePrefix = GetImgPath(); in function FileUpload and replaced this
$sFilePath = $sServerDir . $sFileName ;
with this
$sFilePath = $sServerDir . $ImagePrefix . $sFileName ;
It still doesn't work as expected. When I try to browse for images it shows the root instead of tp_images/Image and no images are available.
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fchipicao.fileave.com%2Fbrowse.png&hash=b72fc6c9d6f1f93182b6a0e00542c1b818193f8c)
However, if I upload an image it uses the correct path (tp-images/Image) but it still appears as if it's in the root folder, and no other images are shown.
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fchipicao.fileave.com%2Fuploaded.png&hash=cd36cc15d8802b2da0563720d7dafdbb2370c057)
What am I missing??
GOT IT! (I know, 2 months :D)
You need to modify every $Config['QuickUploadPath'] at the bottom of config.php
Replace $Config['UserFilesPath'] ; with $Config['UserFilesPath'] . 'image/' ;
The same for file, flash and media.
IMPORTANT: You also need to rename the old tp-images/Image folder to tp-images/image (lowercase) in order to browse previously uploaded images.
Good job Chipicao! :up:
Thanks for posting your fix.
My pleasure :)
In my rush, I only posted half of the solution: you must replace both $Config['UserFilesPath'] ; and $Config['UserFilesAbsolutePath'] ;
with $Config['UserFilesPath'] . 'image/' ; and ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ; respectively.
Below is the whole bottom section from config.php:
$Config['AllowedExtensions']['File'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip') ;
$Config['DeniedExtensions']['File'] = array() ;
$Config['FileTypesPath']['File'] = $Config['UserFilesPath'] . 'file/' ;
$Config['FileTypesAbsolutePath']['File']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'file/' ;
$Config['QuickUploadPath']['File'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['File']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Image'] = array('bmp','gif','jpeg','jpg','png') ;
$Config['DeniedExtensions']['Image'] = array() ;
$Config['FileTypesPath']['Image'] = $Config['UserFilesPath'] . 'image/' ;
$Config['FileTypesAbsolutePath']['Image']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'image/' ;
$Config['QuickUploadPath']['Image'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Image']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Flash'] = array('swf','flv') ;
$Config['DeniedExtensions']['Flash'] = array() ;
$Config['FileTypesPath']['Flash'] = $Config['UserFilesPath'] . 'flash/' ;
$Config['FileTypesAbsolutePath']['Flash']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'flash/' ;
$Config['QuickUploadPath']['Flash'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Flash']= $Config['UserFilesAbsolutePath'] ;
$Config['AllowedExtensions']['Media'] = array('aiff', 'asf', 'avi', 'bmp', 'fla', 'flv', 'gif', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'png', 'qt', 'ram', 'rm', 'rmi', 'rmvb', 'swf', 'tif', 'tiff', 'wav', 'wma', 'wmv') ;
$Config['DeniedExtensions']['Media'] = array() ;
$Config['FileTypesPath']['Media'] = $Config['UserFilesPath'] . 'media/' ;
$Config['FileTypesAbsolutePath']['Media']= ($Config['UserFilesAbsolutePath'] == '') ? '' : $Config['UserFilesAbsolutePath'].'media/' ;
$Config['QuickUploadPath']['Media'] = $Config['UserFilesPath'] ;
$Config['QuickUploadAbsolutePath']['Media']= $Config['UserFilesAbsolutePath'] ;
Hello All,
Can anyone upload the working FCKeditor for new Tinyportal please?
Regards,
electrojit
http://www.tinyportal.net/index.php?topic=9841.msg259211;topicseen#new
Bro Ich just posted it here when you asked
electrojit,
Welcome to TinyPortal.
In the future, please try not to cross post the same question in multiple topics. Once is sufficient. ;) I have removed your post from the old topic from 2007. As Ichbin said in another topic you posted in, FCKEditor is no longer supported in TinyPortal.
ZarPrime
First of sorry guys - I was bit impatient to try out the tinyportal.
And thanks to all of you for your kind support.
Regards,
electrojit :up: