From 8b5da769f4de61b359c5b5aad51d365e2aa55ba5 Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sun, 13 Apr 2008 06:59:53 +0200 Subject: [PATCH] issue116, don't allow hidden-tags to be added to the selected-tag list Signed-off-by: Andreas Unterkircher --- phpfspot.class.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/phpfspot.class.php b/phpfspot.class.php index a279eff..ec041bf 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -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() @@ -2927,6 +2932,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 ?> -- 2.25.1