if user has not selected tags right now, display all images
authorAndreas Unterkircher <unki@netshadow.at>
Wed, 6 Jun 2007 04:14:30 +0000 (04:14 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Wed, 6 Jun 2007 04:14:30 +0000 (04:14 +0000)
git-svn-id: file:///var/lib/svn/phpfspot/trunk@22 fa6a889d-dae6-447d-9e79-4ba9a3039384

phpfspot.class.php

index 168d08134fc5b3461a24b23d222dc47bca7802de..6a2edc3a76392910a71b82914ff281a1084ecb15 100644 (file)
@@ -188,18 +188,25 @@ class PHPFSPOT {
 
    public function getAllTagPhotos()
    {  
 
    public function getAllTagPhotos()
    {  
-      $selected = "";
-      foreach($_SESSION['selected_tags'] as $tag)
-         $selected.= $tag .",";
-      $selected = substr($selected, 0, strlen($selected)-1);
-
       $tagged_photos = Array();
 
       $tagged_photos = Array();
 
-      $result = $this->db->db_query("
-         SELECT DISTINCT photo_id
-         FROM photo_tags
-         WHERE tag_id IN (". $selected .")
-      ");
+      if(isset($_SESSION['selected_tags'])) {
+         $selected = "";
+         foreach($_SESSION['selected_tags'] as $tag)
+            $selected.= $tag .",";
+         $selected = substr($selected, 0, strlen($selected)-1);
+         $result = $this->db->db_query("
+            SELECT DISTINCT photo_id
+            FROM photo_tags
+            WHERE tag_id IN (". $selected .")
+         ");
+      }
+      else {
+         $result = $this->db->db_query("
+            SELECT DISTINCT photo_id
+            FROM photo_tags
+         ");
+      }
 
       while($row = $this->db->db_fetch_object($result)) {
          array_push($tagged_photos, $row['photo_id']);
 
       while($row = $this->db->db_fetch_object($result)) {
          array_push($tagged_photos, $row['photo_id']);