pimped welcome.tpl with some random pictures
[phpfspot.git] / phpfspot.class.php
index 9cffc58461d73c09d214e29eb7a1ccaa7e24ce6b..826fafd2d1101b792306590de0cd032731443a7d 100644 (file)
@@ -752,13 +752,13 @@ class PHPFSPOT {
                FROM photo_tags pt1
             INNER JOIN photo_tags pt2
                ON pt1.photo_id=pt2.photo_id
-            INNER JOIN tags t1
-               ON pt1.tag_id=t1.id
+            INNER JOIN tags t
+               ON pt1.tag_id=t.id
             INNER JOIN photos p
                ON pt1.photo_id=p.id
             INNER JOIN tags t2
                ON pt2.tag_id=t2.id
-            WHERE t1.name LIKE '%". $_SESSION['searchfor'] ."%' ";
+            WHERE t.name LIKE '%". $_SESSION['searchfor'] ."%' ";
 
          if(isset($additional_where_cond))
             $query_str.= "AND ". $additional_where_cond ." ";
@@ -874,7 +874,7 @@ class PHPFSPOT {
 
       /* return all available photos */
       $query_str = "
-         SELECT p.id
+         SELECT DISTINCT p.id
          FROM photos p
          LEFT JOIN photo_tags pt
             ON p.id=pt.photo_id
@@ -886,10 +886,10 @@ class PHPFSPOT {
          $query_str.= "WHERE ". $additional_where_cond ." ";
 
       if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
-        if(isset($additional_where_cond))
-           $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')";
-        else
-           $query_str.= "WHERE t.name IN ('".implode("','",$this->cfg->show_tags). "')";
+         if(isset($additional_where_cond))
+            $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')";
+         else
+            $query_str.= "WHERE t.name IN ('".implode("','",$this->cfg->show_tags). "')";
       }
  
       if(isset($order_str))