Changeset 528

Show
Ignore:
Timestamp:
04/22/08 12:48:00 (7 months ago)
Author:
sidtheduck
Message:

Fix for ticket #96 - Removing filename extensions from cruft-free URLs using RLIKE (regular expressions) in the MySQL query. Hopefully this fixes the image hotlink issues people have been having.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/plog-functions.php

    r527 r528  
    991991                        $sql = "SELECT * 
    992992                                FROM `".TABLE_PREFIX."pictures` 
    993                                 WHERE `path`='" . mysql_real_escape_string($filepath)."' 
     993                                WHERE `path` RLIKE '^" . mysql_real_escape_string($filepath)."\..{3}$' 
    994994                                        AND `parent_album`=".intval($album["id"]); 
    995995                        $result = run_query($sql); 
     
    10901090                        $pic = get_picture_by_id($id); 
    10911091                        $album = $pic["parent_album"]; 
    1092                         $rv = $config["baseurl"].$pic["path"]; 
     1092                        $rv = $config["baseurl"].substr($pic['path'], 0, -4); 
    10931093                } 
    10941094        } else { 
     
    20462046function plogger_get_source_picture_url() { 
    20472047        global $config; 
    2048         return (!empty($config['allow_fullpic'])) ? $config['galleryurl'].'images/'.SmartStripSlashes($GLOBALS["current_picture"]["path"]) : "#"; 
     2048        return (!empty($config['allow_fullpic'])) ? $config['gallery_url'].'images/'.SmartStripSlashes($GLOBALS["current_picture"]["path"]) : "#"; 
    20492049} 
    20502050