diff options
-rw-r--r-- | phpfspot.class.php | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index 61b01c0..d67c7e3 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -253,13 +253,7 @@ class PHPFSPOT { INNER JOIN tags t ON pt.tag_id=t.id WHERE p.id='". $idx ."' - AND t.name IN ( - "; - foreach($this->cfg->show_tags as $tag) { - $query_str.= "'". $tag ."',"; - } - $query_str = substr($query_str, 0, strlen($query_str)-1); - $query_str.= ")"; + AND t.name IN ('".implode("','",$this->cfg->show_tags)."')"; } else { $query_str.= " @@ -666,11 +660,7 @@ class PHPFSPOT { $query_str.= "AND ". $additional_where_cond ." "; if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) { - $query_str.= "AND t.name IN ("; - foreach($this->cfg->show_tags as $tag) { - $query_str.= "'". $tag ."',"; - } - $query_str = substr($query_str, 0, strlen($query_str)-1) . ")"; + $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags)."')"; } if(isset($order_str)) @@ -704,11 +694,7 @@ class PHPFSPOT { $query_str.= "AND ". $additional_where_cond ." "; if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) { - $query_str.= "AND t.name IN ("; - foreach($this->cfg->show_tags as $tag) { - $query_str.= "'". $tag ."',"; - } - $query_str = substr($query_str, 0, strlen($query_str)-1) . ")"; + $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags)."')"; } if(isset($order_str)) @@ -763,11 +749,7 @@ class PHPFSPOT { $query_str.= "AND ". $additional_where_cond; if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) { - $query_str.= "AND t.name IN ("; - foreach($this->cfg->show_tags as $tag) { - $query_str.= "'". $tag ."',"; - } - $query_str = substr($query_str, 0, strlen($query_str)-1) . ")"; + $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')"; } if(isset($order_str)) @@ -795,11 +777,7 @@ class PHPFSPOT { $query_str.= "WHERE ". $additional_where_cond ." "; if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) { - $query_str.= "AND t.name IN ("; - foreach($this->cfg->show_tags as $tag) { - $query_str.= "'". $tag ."',"; - } - $query_str = substr($query_str, 0, strlen($query_str)-1) . ")"; + $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')"; } if(isset($order_str)) @@ -1997,14 +1975,15 @@ class PHPFSPOT { */ public function get_thumb_path($width, $photo) { - $sub_path = substr($this->getMD5($photo), 0, 2); + $md5 = $this->getMD5($photo); + $sub_path = substr($md5, 0, 2); return $this->cfg->thumb_path . "/" . $sub_path . "/" . $width . "_" - . $this->getMD5($photo); + . $md5; } // get_thumb_path() |