From: Andreas Unterkircher Date: Sun, 13 Apr 2008 04:59:53 +0000 (+0200) Subject: issue116, don't allow hidden-tags to be added to the selected-tag list X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=8b5da769f4de61b359c5b5aad51d365e2aa55ba5;ds=sidebyside issue116, don't allow hidden-tags to be added to the selected-tag list Signed-off-by: Andreas Unterkircher --- 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 ?>