issue117, auto-scroll photo-index if thumbnails are out of sight after a page-refresh
[phpfspot.git] / phpfspot.class.php
index ec041bfd122e61329495f5619a0efc377b3833b4..bae4ae74dbc40ce34899bb4270397a3860000abf 100644 (file)
@@ -122,7 +122,7 @@ class PHPFSPOT {
 
       /* set application name and version information */
       $this->cfg->product = "phpfspot";
-      $this->cfg->version = "1.4";
+      $this->cfg->version = "1.5";
 
       $this->sort_orders= array(
          'date_asc' => 'Date ↑',
@@ -2535,11 +2535,26 @@ class PHPFSPOT {
    {
       $all = Array();
 
-      $result = $this->db->db_query("
-         SELECT id
-         FROM photos
-      ");
-      
+      $query_str = "
+         SELECT p.id
+         FROM photos p
+      ";
+
+      /* if show_tags is set, only return details for photos which
+         are specified to be shown
+      */
+      if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
+         $query_str.= "
+            INNER JOIN photo_tags pt
+               ON p.id=pt.photo_id
+            INNER JOIN tags t
+               ON pt.tag_id=t.id
+            WHERE
+               t.name IN ('".implode("','",$this->cfg->show_tags)."')";
+      }
+
+      $result = $this->db->db_query($query_str);
+
       while($row = $this->db->db_fetch_object($result)) {
          array_push($all, $row['id']);
       }