1
tomodea
Re: EXTGALLERY - Suggested fix for problem with image filenames containing dots
  • 2010/9/9 9:26

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Quote:

Peekay wrote:
A nice solution, but users will need to check their hosts config to ensure pathinfo is enabled. Some Windows servers do not support this without a plugin.

Also, Xoops Protector will block uploads of multiple-dot files.

Quote:
Attempt to multiple dot file my.new.file.txt


To be honest, although you can use periods in filenames, I imagine those that do have a very frustrating time uploading anything to the internet.


I agree with your point about the use of periods in filenames but this is not a problem in my case. Just to clarify my point where I said "You can then adjust the rest of the code to use $fname and $ftype as appropriate.". I actually scan the $fname and replace certain special characters that might cause problems. These include the single apostrophe (') which I change to (`). I also change any instances of the period to underscore (_).

The filenames used for storing the image files will no longer be the same as entered by the user but this is not an issue because users get to work with photo titles and the filenames should be transparent to them.
Regards, Tom O'Dea
Melbourne, Australia



2
tomodea
EXTGALLERY - Suggested fix for problem with image filenames containing dots
  • 2010/9/8 9:53

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


There is a logic error in the class called photoHandler.php when the user tries to upload a photo where the filename of the image contains dots.

Look for this statement in the function called _makeFileName in photoHandler.php in the class folder:
$fileName explode(".",$fileName);


This splits the filename into 2 parts when the first “.” Is encountered:
• $fileName[0]
• $fileName[1]

This is OK when we have a filename such as IMG_8517.JPG - $fileName[0] will be IMG_8517 and $fileName[1] will be JPG.

However, if the user has renamed the file to something like: wedding.bill.and.mary.jpg, then $fileName[0] will be wedding and $fileName[1] will be bill. In other words, the files will be stored with the wrong filetype. This causes problems when a user tries to download the original image because it will be saved with a filetype of bill instead of a filetype of jpg.

To address this problem we need to separate the filename from the filetype. Fortunately there is a simple PHP function to help us do this – pathinfo.

My suggested changes are to add these statements at the start of the _makeFileName function:
$path_parts pathinfo($fileName);
        
$fname $path_parts['filename'];
        
$ftype $path_parts['extension'];


You can then adjust the rest of the code to use $fname and $ftype as appropriate.

Regards, Tom O’Dea
Regards, Tom O'Dea
Melbourne, Australia



3
tomodea
EXTGALLERY - Suggested fix for problem when downloading original image
  • 2010/9/8 9:28

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


There is a logic error in public-download.php when you have chosen to use digital watermarks.

When a user uploads a low resolution photo, extgallery will store 3 versions of the image:
1. thumb size.
2. medium size.
3. original.

For higher resolution photos, there will also be a large size version.

If you are using digital watermarks the watermark will be applied to the thumb size, the medium size and the large size images but not the original image.

The relevant statements are:
if($photo->getVar('photo_havelarge')) {
    if(
$permHandler->isAllowed($xoopsUser'public_download_original'$photo->getVar('cat_id')) && $photo->getVar('photo_orig_name') != "") {
        
$photoName "original/".$photo->getVar('photo_orig_name');
    } else {
        
$photoName "large/large_".$photo->getVar('photo_name');
    }
} else {
    
$photoName "medium/".$photo->getVar('photo_name');
}


This means that the original image will only be downloaded if we have a large size version otherwise the user will get the medium size version. If the medium size version does not have a digital watermark, the user will not notice the difference but if we are using digital watermarks then the user will get an “original” with a watermark.

My suggested changes are:
if($permHandler->isAllowed($xoopsUser'public_download_original'$photo->getVar('cat_id')) && $photo->getVar('photo_orig_name') != "") {
        
$photoName "original/".$photo->getVar('photo_orig_name');
    } else {
        if(
$photo->getVar('photo_havelarge')) {
            
$photoName "large/large_".$photo->getVar('photo_name');
        } else {
            
$photoName "medium/".$photo->getVar('photo_name');
        }
    }

Regards, Tom O’Dea
Regards, Tom O'Dea
Melbourne, Australia



4
tomodea
Re: newbb module - Selected module does not exist!
  • 2010/7/8 22:43

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Quote:

ghia wrote:
And could you find out in the logs when the module got deactivated?


I've searched through the logs for the week before I was told there was a problem and didn't find anything. I will have to go back further because I don't know when the module was deactivated - I only know when the problem was reported to me.
Regards, Tom O'Dea
Melbourne, Australia



5
tomodea
Re: newbb module - Selected module does not exist!
  • 2010/7/8 22:38

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Quote:
are you using a rewrite mode in your website?


I have a few URL rewrites in my .htaccess file. For example:

RewriteCond %{HTTP_HOST} ^odeaclan.org$ [OR]
RewriteCond %{HTTP_HOST} ^www.odeaclan.org$
RewriteRule ^office.html"http://odeaclan.org/xoops/modules/smartpartner" [R=301,L]


This is required because I need to re-direct any requests to old html pages to the equivalent xoops page.
Regards, Tom O'Dea
Melbourne, Australia



6
tomodea
Re: newbb module - Selected module does not exist!
  • 2010/7/7 23:22

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Quote:

ghia wrote:
Never heard about this phenomena.
Check that only webmasters can deactivate the module (permissions for module admin, test with link).
Try to inspect the Apache logs for unusual accesses. Try to isolate the moment where the module got deactivated (should be clear from the content length).


Thanks for those tips. I've checked the permissions and I can confirm that only the Webmaster group has module admin rights and I am the only member of that group.

I've checked the apache access logs for the last 8 days and I find that the only access to modules admin (fct=modulesadmin) is my access when I activated the newbb module again.
Regards, Tom O'Dea
Melbourne, Australia



7
tomodea
newbb module - Selected module does not exist!
  • 2010/7/7 4:05

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


I've been using the newbb module for some time and I sometimes get reports from my users about the message: "Selected module does not exist!" when they try to use the module.

The reason for the message is that the module has been deactivated. I simply activate the module again and all is OK. However, a couple of months later the same thing happens again.

Can anyone offer a suggestion on:
1. Why is this happening?
2. What can I do to fix it?

XOOPS version: 2.0.16
PHP version: 4.4.9
MySql version: 5.0.45-log
newbb: 2.02
Regards, Tom O'Dea
Melbourne, Australia



8
tomodea
Re: How to Handle Office 2007 File Attachments?
  • 2010/3/28 5:25

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


As a result of some good advice from Steve, we now have an answer on what to do to get smartsection to work.

In modules/smartsection/class/file.php, you'll find this section

function SmartsectionFile($id null

    
$this->db =& Database::getInstance(); 
    
$this->initVar("fileid"XOBJ_DTYPE_INT0false); 
    
$this->initVar("itemid"XOBJ_DTYPE_INTnulltrue); 
    
$this->initVar("name"XOBJ_DTYPE_TXTBOXnulltrue255); 
    
$this->initVar("description"XOBJ_DTYPE_TXTBOXnullfalse255); 
    
$this->initVar("filename"XOBJ_DTYPE_TXTBOXnulltrue255); 
    
$this->initVar("mimetype"XOBJ_DTYPE_TXTBOXnulltrue64); 
    
$this->initVar("uid"XOBJ_DTYPE_INT0false); 
    
$this->initVar("datesub"XOBJ_DTYPE_INTnullfalse); 
    
$this->initVar("status"XOBJ_DTYPE_INT1false); 
    
$this->initVar("notifypub"XOBJ_DTYPE_INT0false); 
    
$this->initVar("counter"XOBJ_DTYPE_INTnullfalse);


I changed this statement in class/file.php:

$this->initVar("mimetype"XOBJ_DTYPE_TXTBOXnulltrue64);


to this:

$this->initVar("mimetype"XOBJ_DTYPE_TXTBOXnulltrue255);


I also changed the SQL definition for the mimetype column in the smartsection_files table from varchar(64) to varchar(255).

Once I made those changes I was able to upload a docx file and then view it without any problems.



9
tomodea
Re: How to Handle Office 2007 File Attachments?
  • 2010/3/24 10:28

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Yes, but the users would not be happy about having to unzip a file to read it.



10
tomodea
Re: Comments Manager – Immediate logout and “Sorry, you don't have the permission to access this area”
  • 2010/3/17 23:40

  • tomodea

  • Just popping in

  • Posts: 47

  • Since: 2008/2/19


Thank you very much for this advice. This has been an enormous help.

I found that I was getting logged of when using the xhelp module. There's nothing wrong with xhelp itself. I probably missed out on adding the php.ini file to one of my PHP folders or perhaps one of them was out of date.

After including this entry in my .htaccess file, the “Sorry, you don't have the permission to access this area” problem disappeared.

This has solved 2 big problems for me:
1. I no longer have the “Sorry, you don't have the permission to access this area” problem.
2. I no longer have to have 361 copies of php.ini.

Thank you.




TopTop
(1) 2 3 4 5 »



Login

Who's Online

84 user(s) are online (58 user(s) are browsing Support Forums)


Members: 0


Guests: 84


more...

Donat-O-Meter

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

Latest GitHub Commits