summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2007-12-15 08:59:44 +0000
committerAndreas Unterkircher <unki@netshadow.at>2007-12-15 08:59:44 +0000
commit5ea211de598c1e02a9f5ccb04b83a81ed9b41117 (patch)
treea2eebbc5dfdc2ff30bd722ed1150e04333537c50
parent422c6753df32dac7eff64e3a04fc8d0553ddc1da (diff)
issue implode() instead of looping around an array, arun
git-svn-id: file:///var/lib/svn/phpfspot/trunk@309 fa6a889d-dae6-447d-9e79-4ba9a3039384
-rw-r--r--phpfspot.class.php37
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()