Jump to content


Xinha uploaded file permissions problem


  • You cannot reply to this topic
17 replies to this topic

#1 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 24 April 2007 - 10:14 PM

Having a strange issue. I'm running DirectAdmin and switched to SuPHP a few weeks back. Everything seems ok but when I upload files using Xinha image manager the files are created with 600 file permissions. This of course make them not world viewable and they dont display. I have to manually change the permissions to 644. Weird thing is I'm trying out WebsiteBaker also for another client and it also has the same permissions problem with files uploaded by Xhinha but one of the gallery addons in wb uploads images with the correct permissions.

Any one seen this before? I've read up on it and some people have smillar problems but couldnt really find a solution.

#2 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 24 April 2007 - 10:27 PM

Do you get the same results if you upload using the Etomite file manager, by chance...??? This would help in determining whether the problem is related to Xinha, Etomite, or your servers configuration...

#3 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 24 April 2007 - 10:28 PM

I've seen this before.
It's the script not chmodding correct when uploading. The etomite file manager should chmod correct after an upload automatically - try that to make sure.

Try contacting the actual writer of the Plugin.

#4 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 24 April 2007 - 11:23 PM

I tried the Etomite file manager and the permissions are correct (644) So seems Xinha's file manager is at fault here?

#5 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 25 April 2007 - 10:27 AM

View Postfuture assassin, on Apr 25 2007, 12:23 AM, said:

I tried the Etomite file manager and the permissions are correct (644) So seems Xinha's file manager is at fault here?
Yes :)

#6 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 25 April 2007 - 01:27 PM

If you are adventurous you can try the following fix and report back whether or not it works...

Open manager/media/xinha/plugins/ImageManager/Files.php
Find line 68, which should read:
67	//verify that it copied, new file must exists
68	if (is_file($destination_dir.$filename))
69	  Return $filename;
70	else
71	  return FILE_ERROR_COPY_FAILED;
72  }

And insert a new chmod() line between lines 68 and 69 as in the following code...

67	//verify that it copied, new file must exists
68	if (is_file($destination_dir.$filename))
69	  @chmod($destination_dir.$filename, 0644);
70	  Return $filename;
71	else
72	  return FILE_ERROR_COPY_FAILED;
73  }

Save the file, test it, and report back...

#7 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 27 April 2007 - 03:53 AM

View PostRalph, on Apr 25 2007, 01:27 PM, said:

If you are adventurous you can try the following fix and report back whether or not it works...

Open manager/media/xinha/plugins/ImageManager/Files.php
Find line 68, which should read:
67	//verify that it copied, new file must exists
68	if (is_file($destination_dir.$filename))
69	  Return $filename;
70	else
71	  return FILE_ERROR_COPY_FAILED;
72  }

And insert a new chmod() line between lines 68 and 69 as in the following code...

67	//verify that it copied, new file must exists
68	if (is_file($destination_dir.$filename))
69	  @chmod($destination_dir.$filename, 0644);
70	  Return $filename;
71	else
72	  return FILE_ERROR_COPY_FAILED;
73  }

Save the file, test it, and report back...

Hmm I have no such file named files.php in manager/media/xinha/plugins/ImageManager ??

#8 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 27 April 2007 - 04:04 AM

View Postfuture assassin, on Apr 27 2007, 03:53 AM, said:

Hmm I have no such file named files.php in manager/media/xinha/plugins/ImageManager ??

The file was in the Classes folder. I get the following error

Parse error: syntax error, unexpected T_ELSE in /home/iroxyca/domains/iroxy.ca/public_html/manager/media/xinha/plugins/ImageManager/Classes/Files.php on line 71

#9 mikef

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,551 posts

Posted 27 April 2007 - 11:19 AM

View Postfuture assassin, on Apr 27 2007, 05:04 AM, said:

The file was in the Classes folder. I get the following error

Parse error: syntax error, unexpected T_ELSE in /home/iroxyca/domains/iroxy.ca/public_html/manager/media/xinha/plugins/ImageManager/Classes/Files.php on line 71

Replacement code should probably be
67	//verify that it copied, new file must exists
68	if (is_file($destination_dir.$filename)) {
69	  @chmod($destination_dir.$filename, 0644);
70	  Return $filename;
71   } else
72	  return FILE_ERROR_COPY_FAILED;
73  }


#10 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 27 April 2007 - 01:09 PM

Yup... Thanks for catching that one, Mike... I did an edit and my sloppy Cut and Paste can be blamed for the error... Sorry for the inconvenience, future assassin... Actually, a more syntactically correct version would be:

67	//verify that it copied, new file must exists
68	if (is_file($destination_dir.$filename)) {
69	  @chmod($destination_dir.$filename, 0644);
70	  Return $filename;
71   } else {
72	  return FILE_ERROR_COPY_FAILED;
73  }


#11 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 28 April 2007 - 02:09 AM

This is the error I got this time

Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/iroxyca/domains/iroxy.ca/public_html/manager/media/xinha/plugins/ImageManager/Classes/Files.php on line 218


#12 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,524 posts
  • Gender:Male

Posted 28 April 2007 - 03:22 AM

View Postfuture assassin, on Apr 27 2007, 10:09 PM, said:

This is the error I got this time

Parse error: syntax error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/iroxyca/domains/iroxy.ca/public_html/manager/media/xinha/plugins/ImageManager/Classes/Files.php on line 218
It sounds like you made the change in the wrong location based on the line number where the error is showing up... If you can't get this sorted I can post my working copy of this file... I know the code works as this fix was coded and tested on my main development site...

#13 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 28 April 2007 - 05:54 PM

View PostRalph, on Apr 28 2007, 03:22 AM, said:

It sounds like you made the change in the wrong location based on the line number where the error is showing up... If you can't get this sorted I can post my working copy of this file... I know the code works as this fix was coded and tested on my main development site...

Ralph I tired your version and this is the one that was giving me the last error. I tried mikef's and this is the one that worked. Now uploaded images are set to 644 BUT I noticed the thumbnails in the .thumbs directory are still 600 although the dir is set to 777.

Thanks for the work.

Edited by future assassin, 28 April 2007 - 05:59 PM.


#14 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 28 April 2007 - 06:01 PM

have you tried updating the plugin from Xinha's site?

#15 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 28 April 2007 - 06:03 PM

View Postfuture assassin, on Apr 28 2007, 05:54 PM, said:

Ralph I tired your version and this is the one that was giving me the last error. I tried mikef's and this is the one that worked. Now uploaded images are set to 644 BUT I noticed the thumbnails in the .thumbs directory are still 600 although the dir is set to 777.

Thanks for the work.

Ok here's what I found. With Ralph's version you have to replace lines 67-71. I was replacing line 67-72.

#16 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 28 April 2007 - 06:05 PM

View PostDean, on Apr 28 2007, 06:01 PM, said:

have you tried updating the plugin from Xinha's site?

I haven't but will try it right now and see what happens.

Report:

Same thing happens. Images are created with 600 for permissions.

Edited by future assassin, 28 April 2007 - 06:12 PM.


#17 Dean

    Loves Etomite Forums!

  • Admin
  • 4,758 posts
  • Gender:Male

Posted 28 April 2007 - 09:41 PM

Ok, report it on the Xinha Website (their bug tracker).

#18 future assassin

    Etomite Forum Newbie

  • Member
  • 47 posts

Posted 01 May 2007 - 08:52 AM

Well I haven't posted a bug report yet but I just switched to FCKEditor which seems to upload ok although all files uploaded and new directories created were set to 777. Had to go through some files in the upload and browser directories and change instances of 0777 to 0644 for image uploads and 0755 to new directory creation.

So far it'll have to do. One day we'll be able to run mod_php safely on shared servers and wont have to deal with weird things happening with suphp.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users