TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,990
  • Total Topics: 21,323
  • Online today: 1,050
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 629
  • Total: 629

Updating FCKeditor

Started by Chipicao, December 05, 2009, 08:59:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Chipicao

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.


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.


What am I missing??

Chipicao

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.

Ken.

Good job Chipicao!  :up:

Thanks for posting your fix.
" If everything seems under control, you're not going fast enough." - Mario Andretti
Yesterday When I was Young.

Chipicao

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'] ;

electrojit

Hello All,

Can anyone upload the working FCKeditor for new Tinyportal please?

Regards,
electrojit

stormlrd


ZarPrime

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

electrojit

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:

This website is proudly hosted on Crocweb Cloud Website Hosting.