diff options
-rw-r--r-- | phpfspot.class.php | 74 |
1 files changed, 58 insertions, 16 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index a5b4a4d..a69cdde 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -505,8 +505,8 @@ class PHPFSPOT { photos p "; } - else { - /* rating value got introduced */ + elseif($this->dbver < 17) { + /* rating value got introduced */ $query_str = " SELECT p.id as id, @@ -518,6 +518,19 @@ class PHPFSPOT { photos p "; } + else { + /* path & filename now splited in base_uri & filename */ + $query_str = " + SELECT + p.id as id, + p.base_uri || p.filename as uri, + p.time as time, + p.description as description, + p.rating as rating + FROM + photos p + "; + } } /* if show_tags is set, only return details of photos which are @@ -556,19 +569,39 @@ class PHPFSPOT { v9. */ if($version_idx > 0 && $this->dbver >= 9) { - /* check for alternative versions */ - if($version = $this->db->db_fetchSingleRow(" - SELECT - version_id, name, uri - FROM - photo_versions - WHERE - photo_id LIKE '". $idx ."' - AND - version_id LIKE '". $version_idx ."'")) { - - $row['name'] = $version['name']; - $row['uri'] = $version['uri']; + if ($this->dbver < 17) { + /* check for alternative versions */ + if($version = $this->db->db_fetchSingleRow(" + SELECT + version_id, name, uri + FROM + photo_versions + WHERE + photo_id LIKE '". $idx ."' + AND + version_id LIKE '". $version_idx ."'")) { + + $row['name'] = $version['name']; + $row['uri'] = $version['uri']; + } + } + else { + /* path & filename now splited in base_uri & filename */ + if($version = $this->db->db_fetchSingleRow(" + SELECT + version_id, + name, + base_uri || filename as uri + FROM + photo_versions + WHERE + photo_id LIKE '". $idx ."' + AND + version_id LIKE '". $version_idx ."'")) { + + $row['name'] = $version['name']; + $row['uri'] = $version['uri']; + } } } @@ -1245,7 +1278,7 @@ class PHPFSPOT { ) "; } - else { + if($this->dbver < 17) { $additional_where_cond.= " ( basename(p.uri) LIKE '%". $_SESSION['searchfor_name'] ."%' @@ -1254,6 +1287,15 @@ class PHPFSPOT { ) "; } + else { + $additional_where_cond.= " + ( + p.filename LIKE '%". $_SESSION['searchfor_name'] ."%' + OR + p.description LIKE '%". $_SESSION['searchfor_name'] ."%' + ) + "; + } } /* limit result based on rate-search */ |