11
hervet
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/1 11:49

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


McDonald,

Even with your version, the problem is still here.
May be I'm wrong but for what I saw, this part of the image manager is made and controlled with javascript. So I doubt that the problem comes from MySQL and/or Php.
What browser are you using ?

Franck, if you read us, please help

Bye,
Hervé

12
McDonald
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/1 12:05

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


At home I use IE7 and at work IE6, and it works with both browser versions.
I actually never use this feature of Tinyeditor. Instead I use the plugin iBrowser and sometimes iManager.

EDIT: I use also the plugin 'advanced image' (green tree with the black cross). This add some extra features to the standard image manager. Maybe it's needed for xrmanager...

13
gcafiero
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/2 9:42

  • gcafiero

  • Just popping in

  • Posts: 5

  • Since: 2007/11/1


I've a problem with TinyEditor mimetypes Management.

I use XRManager plugin. All is ok for gif, jpg and png files: I may upload (from my local pc) a file o these types.
But if I try to upload another file type (es. .rtf) it doesn't.

I've added in TinyEditor mimetypes list "application/rtf" (separated by a blank space from prev mimetype).

What is wrong?

Thanks.

14
frankblack
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/2 11:10

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Did I mention that I gave up support for tinyeditor? Guess not!

@hervet: Please check a few things for me
a) Are the templates within tinyeditor generated? These are needed for making the plugin XOOPS image manager to work

b) Try to insert images with Firefox and have a look if the Javascript-Debug-Console is throwing any errors. If yes, post them please

@gcafiero: Have a look at this page. There are some other mimetypes mentioned for rtf. If this does not work: Make a case sensitive search throughout tinyeditor and replace getMIME with getMime. If this still doesn't work replace this code in tinyeditor / class / XRmanager.php:
function getMime($file) {
            
$mime "text/plain";
            
$mimereader1 '';
            
$mimereader2 '';

            if (
class_exists('finfo'))
                
$mimereader1 1;
            
//If mime magic is installed and working
            
if (function_exists("mime_content_type"))
                
$mimereader2 2;

            if (
$mimereader1 == 1) {
                
$php_version phpversion();
                if (
$php_version >= 5) {
                    
$fi = new finfo(FILEINFO_MIME);
                    
$mime $fi->buffer(file_get_contents($file));
                } else {
                    
$handle finfo_open(FILEINFO_MIME);
                    
$mime finfo_file($handle,$file);                    
                }
            }

            if (
$mimereader1 == '' && $mimereader2 == 2)
                
$mime mime_content_type($file);

            if (
$mimereader1 == '' && $mimereader2 == '')
                
$mime $this->image2MIME($file);

            return 
strtolower($mime);
        }


with this code:
function getMime($file) {
            
$mime "text/plain";

                
$mime $this->image2MIME($file);

            return 
strtolower($mime);
        }


HTH

15
gcafiero
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/2 12:16

  • gcafiero

  • Just popping in

  • Posts: 5

  • Since: 2007/11/1


I'm sorry.

I've tried with your instructions. But it doesn't work.

Now I try to integrate tinyfck filemanager (http://p4a.crealabsfoundation.org/tinyfck) in tinyeditor.

Thanks.

16
hervet
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/2 14:32

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Quote:

frankblack wrote:
Did I mention that I gave up support for tinyeditor? Guess not!

Did you ?
May be I had a problem with my ear this day ...

Quote:

@hervet: Please check a few things for me
a) Are the templates within tinyeditor generated? These are needed for making the plugin XOOPS image manager to work

b) Try to insert images with Firefox and have a look if the Javascript-Debug-Console is throwing any errors. If yes, post them please

Ok Franck, I believe that I have found the problem and the solution. It's not simple.

First, I had to read the class/XRManager.php file to understand where the problem was coming from.

To do it in the order, if the Php class called "finfo" (that comes with the php_fileinfo extension) exists then it is used to see pictures mime type. If this class (which is an excellent extension) does not exists then the module's class try to use the Php "mime_content_type" function (if you don't have it then I'm sorry for you).

In the case that the finfo class is available AND if you are using Php5, then the class tries to get information about each file via the finfo class.

The problem is that this class (like the mime_content_type function) relies on several files, magic.mime, magic, magic.mgc and magic.mime.mgc.

Those files are not always installed by your host and they are not always correctly set in the Php.ini...
Under Windows it's a real mess !

So, I have downloaded the magic.mime files from here :
http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=18878

Then I have added them to TinyEditor (in a new folder called "mime") and I have modified the getMIME() function of the file /modules/tinyeditor/class/XRManager.php so that it uses those files.

As a result, everything is now running for me.

To be short, if, like me, you have problems when you want to insert a picture from this Tiny plugins, that's because your host did not install the fileinfo Php extension and/or because the magic.mime files used by this extension (and by the mime_content_type function) are not available or correctly set in the Php.ini.

If someone is interested, the link to "my" version of TinyEditor is updated.
http://xoops.instant-zero.com/uploads/tinyeditor.zip


Thanks again Franck !

PS: gcafiero, may I can suggest you to create a new topic for your question ?

Bye,
hervé

** EDIT **
I can confirm that it runs for Linux servers AND Windows (Xp Pro and 2003) servers with Apache or IIS.

17
frankblack
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/2 15:41

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Instead of:

if ($mimereader1 == 1) {
$php_version phpversion();
if (
$php_version >= 5) {
include_once 
'../../../mainfile.php';
$pathToMagic XOOPS_ROOT_PATH.'/modules/tinyeditor/mime/magic';
$fi = new finfo(FILEINFO_MIME$pathToMagic);
$mime $fi->buffer(file_get_contents($file));
                } else {
$handle finfo_open(FILEINFO_MIME);
$mime finfo_file($handle,$file);
}
}


evtl. this?

if ($mimereader1 == 1) {
$php_version phpversion();
if (
$php_version >= 5) {
include_once 
'../../../mainfile.php';
$pathToMagic XOOPS_ROOT_PATH.'/modules/tinyeditor/mime/magic';
$fi = new finfo(FILEINFO_MIME$pathToMagic);
$mime $fi->file($file));
$fi->close();
                } else {
$handle finfo_open(FILEINFO_MIME);
$mime finfo_file($handle,$file);
$handle->close();
}
}


Why do you use buffer? And if I get this right, the connection should be closed?

Anyway, we should be brothers in mind! I was thinking about an additional layer of security adding this to the XOOPS uploader.php. To make this more bullet proof I was thinking about to mimic mime_content_type and FILEINFO, because I DO KNOW a hoster where both is not working and there could be others.

It seems to me that mime_content_type and FILEINFO are doing nothing else than reading a few bytes of a file and then "guessing" the mimetype. For worst-case-scenarios (like for the aformentioned hoster) there should be a workaround for this. Currently working on it, but if you have a better solution: let me hear it.

But for the problem with the XOOPS imagemanager plugin for tinyeditor I am a bit puzzled, because this plugin never uses the getMime-function. So the problem should be located elsewhere.

18
hervet
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/2 15:45

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Quote:

frankblack wrote:
Why do you use buffer? And if I get this right, the connection should be closed?


I did not used any buffer, the only lines I have added are :
include_once '../../../mainfile.php';
$pathToMagic XOOPS_ROOT_PATH.'/modules/tinyeditor/mime/magic';


And I have replaced :
$fi = new finfo(FILEINFO_MIME);

with:

$fi = new finfo(FILEINFO_MIME$pathToMagic);

The rest is the original code ...

Quote:

Anyway, we should be brothers in mind! I was thinking about an additional layer of security adding this to the XOOPS uploader.php. To make this more bullet proof I was thinking about to mimic mime_content_type and FILEINFO, because I DO KNOW a hoster where both is not working and there could be others.

It seems to me that mime_content_type and FILEINFO are doing nothing else than reading a few bytes of a file and then "guessing" the mimetype. For worst-case-scenarios (like for the aformentioned hoster) there should be a workaround for this. Currently working on it, but if you have a better solution: let me hear it.

For what I know, fileinfo is a bit more secure.

Quote:

But for the problem with the XOOPS imagemanager plugin for tinyeditor I am a bit puzzled, because this plugin never uses the getMime-function. So the problem should be located elsewhere.

I did not changed this but I can tell you that now, it's running

bye,
Hervé

19
gcafiero
Re: TinyEditor, problem with the Insert/Edit picture
  • 2007/11/15 12:29

  • gcafiero

  • Just popping in

  • Posts: 5

  • Since: 2007/11/1


Ok! I've solved my problem with XRManager integrating fckeditor filemanager (as explained in http://p4a.crealabsfoundation.org/tinyfck) in tinyeditor.

Vs. standard fckfilemanager version from tinyfck I've modified a little bit source code for a full and functional integration with TinyEditor.

Bye

20
Tobias
Re: TinyEditor, problem with the Insert/Edit picture
  • 2008/5/17 20:29

  • Tobias

  • Not too shy to talk

  • Posts: 172

  • Since: 2005/9/13


Quote:
Anyway, we should be brothers in mind! I was thinking about an additional layer of security adding this to the XOOPS uploader.php. To make this more bullet proof I was thinking about to mimic mime_content_type and FILEINFO, because I DO KNOW a hoster where both is not working and there could be others.

My host (a very popular one) doesn't have fileinfo, and mime_content_type doesn't recognize flash correctly. I have found a method using UNIX file which works on my server. This one might also be good for people without mime_content_type.

Login

Who's Online

333 user(s) are online (288 user(s) are browsing Support Forums)


Members: 0


Guests: 333


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits