X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=blobdiff_plain;f=phpfspot.class.php;h=bae4ae74dbc40ce34899bb4270397a3860000abf;hp=0615cff77a5d7742cc29461b42cf2cf4e8c54b13;hb=dee52ad356dbabf693686fee2b0dc9138f265a3f;hpb=e173051918510189344372c75f16a5ded0d7a5ea diff --git a/phpfspot.class.php b/phpfspot.class.php index 0615cff..bae4ae7 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -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 ↑', @@ -767,10 +767,15 @@ class PHPFSPOT { if(isset($_SESSION['searchfor_tag'])) unset($_SESSION['searchfor_tag']); + // has the user requested to hide this tag, and still someone, + // somehow tries to add it, don't allow this. + if(!isset($this->cfg->hide_tags) && + in_array($this->get_tag_name($tag), $this->cfg->hide_tags)) + return "ok"; + if(!in_array($tag, $_SESSION['selected_tags'])) array_push($_SESSION['selected_tags'], $tag); - return "ok"; } // addTag() @@ -1970,8 +1975,11 @@ class PHPFSPOT { $tags = Array(); - while($row = $this->db->db_fetch_object($result)) + while($row = $this->db->db_fetch_object($result)) { + if(isset($this->cfg->hide_tags) && in_array($row['name'], $this->cfg->hide_tags)) + continue; $tags[$row['id']] = $row['name']; + } return $tags; @@ -2527,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']); } @@ -2924,6 +2947,30 @@ class PHPFSPOT { } // get_mime_info() + /** + * return tag-name by tag-idx + * + * this function returns the tag-name for the requested + * tag specified by tag-idx. + * @param integer $idx + * @return string + */ + public function get_tag_name($idx) + { + if($result = $this->db->db_fetchSingleRow(" + SELECT name + FROM tags + WHERE + id LIKE '". $idx ."'")) { + + return $result['name']; + + } + + return 0; + + } // get_tag_name() + } // class PHPFSPOT ?>