aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-02-14 01:37:38 +0000
committerrvelices <rv-github@modusoptimus.com>2007-02-14 01:37:38 +0000
commitdf3b43d35601551c3344bf051cdef4ab67de505a (patch)
treef6b9efcb3fb2ba3c2df375fd15e4a2b116b6adce /include/ws_functions.inc.php
parent711ebcbf2c1906b6496711eb6973954ecb113d72 (diff)
tags returned by get_all_tags, get_available_tags contain id key instead of tag_id
(as expected by make_index_url, as $page['tags'] was and as the database model is) git-svn-id: http://piwigo.org/svn/trunk@1815 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/ws_functions.inc.php32
1 files changed, 12 insertions, 20 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 61b17dc78..5c0221e7e 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -537,29 +537,23 @@ SELECT c.id,c.name,c.uppercats,c.global_rank
}
//-------------------------------------------------------------- related tags
- $query = '
-SELECT id, name, url_name
- FROM '.IMAGE_TAG_TABLE.'
- INNER JOIN '.TAGS_TABLE.' ON tag_id = id
- WHERE image_id = '.$image_row['id'].'
-;';
- $result = pwg_query($query);
- $related_tags = array();
- while ($row = mysql_fetch_assoc($result))
+ $related_tags = get_common_tags( array($image_row['id']), -1 );
+ foreach( $related_tags as $i=>$tag)
{
- $row['url'] = make_index_url(
+ $tag['url'] = make_index_url(
array(
- 'tags' => array($row)
+ 'tags' => array($tag)
)
);
- $row['page_url'] = make_picture_url(
+ $tag['page_url'] = make_picture_url(
array(
'image_id' => $image_row['id'],
'image_file' => $image_row['file'],
- 'tags' => array($row),
+ 'tags' => array($tag),
)
);
- array_push($related_tags, $row);
+ unset($tag['counter']);
+ $related_tags[$i]=$tag;
}
//---------------------------------------------------------- related comments
$query = '
@@ -674,9 +668,8 @@ function ws_tags_getList($params, &$service)
}
for ($i=0; $i<count($tags); $i++)
{
- $tags[$i]['id'] = (int)$tags[$i]['tag_id'];
+ $tags[$i]['id'] = (int)$tags[$i]['id'];
$tags[$i]['counter'] = (int)$tags[$i]['counter'];
- unset($tags[$i]['tag_id']);
$tags[$i]['url'] = make_index_url(
array(
'section'=>'tags',
@@ -702,19 +695,18 @@ function ws_tags_getImages($params, &$service)
$tags_by_id = array();
for( $i=0; $i<count($tags); $i++ )
{
- $tags[$i]['tag_id']=(int)$tags[$i]['tag_id'];
- $tags[$i]['id']=(int)$tags[$i]['tag_id']; //required by make_xxx_url
+ $tags[$i]['id']=(int)$tags[$i]['id'];
}
foreach( $tags as $tag )
{
- $tags_by_id[ $tag['tag_id'] ] = $tag;
+ $tags_by_id[ $tag['id'] ] = $tag;
if (
in_array($tag['name'], $params['tag_name'])
or
in_array($tag['url_name'], $params['tag_url_name'])
)
{
- $tag_ids[] = $tag['tag_id'];
+ $tag_ids[] = $tag['id'];
}
}
unset($tags);