Changeset 1815


Ignore:
Timestamp:
Feb 14, 2007, 2:37:38 AM (17 years ago)
Author:
rvelices
Message:

tags returned by get_all_tags, get_available_tags contain id key instead of tag_id
(as expected by make_index_url, as $pagetags was and as the database model is)

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/element_set_global.php

    r1609 r1815  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
    6 // +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     6// +-----------------------------------------------------------------------+
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    290289{
    291290  $add_tag_selection = get_html_tag_selection(
    292     get_all_tags(),
     291    $all_tags,
    293292    'add_tags'
    294293    );
     
    305304{
    306305  // remove tags
    307   $query = '
    308   SELECT tag_id, name, url_name, count(*) counter
    309     FROM '.IMAGE_TAG_TABLE.'
    310       INNER JOIN '.TAGS_TABLE.' ON tag_id = id
    311     WHERE image_id IN ('.implode(',', $page['cat_elements_id']).')
    312     GROUP BY tag_id
    313   ;';
    314   $result = pwg_query($query);
    315 
    316   $tags = array();
    317   while($row = mysql_fetch_array($result))
    318   {
    319     array_push($tags, $row);
    320   }
    321 
     306  $tags = get_common_tags($page['cat_elements_id'], -1);
    322307  usort($tags, 'name_compare');
    323308
  • trunk/admin/picture_modify.php

    r1609 r1815  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
    6 // +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     6// +-----------------------------------------------------------------------+
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    212211{
    213212  $tag_selection = get_html_tag_selection(
    214     get_all_tags(),
     213    $all_tags,
    215214    'tags',
    216215    $selected_tags
  • trunk/include/functions_html.inc.php

    r1789 r1815  
    559559      .'<label>'
    560560      .'<input type="checkbox" name="'.$fieldname.'[]"'
    561       .' value="'.$tag['tag_id'].'"'
     561      .' value="'.$tag['id'].'"'
    562562      ;
    563563
    564     if (in_array($tag['tag_id'], $selecteds))
     564    if (in_array($tag['id'], $selecteds))
    565565    {
    566566      $output.= ' checked="checked"';
  • trunk/include/functions_tag.inc.php

    • Property svn:keywords set to Author Date Id Revision
    r1678 r1815  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
    6 // +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
    9 // | last update   : $Date: 2006-03-16 23:58:16 +0100 (jeu, 16 mar 2006) $
    10 // | last modifier : $Author: rub $
    11 // | revision      : $Revision: 1085 $
    12 // | revision      : $Revision: 1085 $
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     6// +-----------------------------------------------------------------------+
     7// | file          : $Id$
     8// | last update   : $Date$
     9// | last modifier : $Author$
     10// | revision      : $Revision$
     11// | revision      : $Revision$
    1312// +-----------------------------------------------------------------------+
    1413// | This program is free software; you can redistribute it and/or modify  |
     
    4241  // we can find top fatter tags among reachable images
    4342  $tags_query = '
    44 SELECT tag_id, name, url_name, count(*) counter
     43SELECT id, name, url_name, count(*) counter
    4544  FROM '.IMAGE_TAG_TABLE.'
    4645    INNER JOIN '.TAGS_TABLE.' ON tag_id = id';
     
    5857    );
    5958
    60   if (!is_null($where_tag_img))
     59  if (!empty($where_tag_img))
    6160  {
    6261    // first we need all reachable image ids
     
    102101{
    103102  $query = '
    104 SELECT id AS tag_id,
     103SELECT id,
    105104       name,
    106105       url_name
     
    246245  }
    247246  $query = '
    248 SELECT tag_id, name, url_name, count(*) counter
     247SELECT id, name, url_name, count(*) counter
    249248  FROM '.IMAGE_TAG_TABLE.'
    250249    INNER JOIN '.TAGS_TABLE.' ON tag_id = id
     
    256255  }
    257256  $query .='
    258   GROUP BY tag_id
    259   ORDER BY counter DESC';
     257  GROUP BY tag_id';
    260258  if ($max_tags>0)
    261259  {
  • trunk/include/menubar.inc.php

    r1788 r1815  
    131131        'URL' => make_index_url(
    132132          array(
    133             'tags' => array(
    134               array(
    135                 'id' => $tag['tag_id'],
    136                 'url_name' => $tag['url_name'],
    137                 ),
    138               )
     133            'tags' => array($tag)
    139134            )
    140135          ),
     
    155150            'tags' => array_merge(
    156151              $page['tags'],
    157               array(
    158                 array(
    159                   'id' => $tag['tag_id'],
    160                   'url_name' => $tag['url_name'],
    161                   ),
    162                 )
     152              array($tag)
    163153              )
    164154            )
  • trunk/include/ws_functions.inc.php

    r1781 r1815  
    538538
    539539  //-------------------------------------------------------------- related tags
    540   $query = '
    541 SELECT id, name, url_name
    542   FROM '.IMAGE_TAG_TABLE.'
    543     INNER JOIN '.TAGS_TABLE.' ON tag_id = id
    544   WHERE image_id = '.$image_row['id'].'
    545 ;';
    546   $result = pwg_query($query);
    547   $related_tags = array();
    548   while ($row = mysql_fetch_assoc($result))
    549   {
    550     $row['url'] = make_index_url(
     540  $related_tags = get_common_tags( array($image_row['id']), -1 );
     541  foreach( $related_tags as $i=>$tag)
     542  {
     543    $tag['url'] = make_index_url(
    551544        array(
    552           'tags' => array($row)
     545          'tags' => array($tag)
    553546          )
    554547      );
    555     $row['page_url'] = make_picture_url(
     548    $tag['page_url'] = make_picture_url(
    556549        array(
    557550          'image_id' => $image_row['id'],
    558551          'image_file' => $image_row['file'],
    559           'tags' => array($row),
     552          'tags' => array($tag),
    560553          )
    561554      );
    562     array_push($related_tags, $row);
     555    unset($tag['counter']);
     556    $related_tags[$i]=$tag;
    563557  }
    564558  //---------------------------------------------------------- related comments
     
    675669  for ($i=0; $i<count($tags); $i++)
    676670  {
    677     $tags[$i]['id'] = (int)$tags[$i]['tag_id'];
     671    $tags[$i]['id'] = (int)$tags[$i]['id'];
    678672    $tags[$i]['counter'] = (int)$tags[$i]['counter'];
    679     unset($tags[$i]['tag_id']);
    680673    $tags[$i]['url'] = make_index_url(
    681674        array(
     
    703696  for( $i=0; $i<count($tags); $i++ )
    704697  {
    705     $tags[$i]['tag_id']=(int)$tags[$i]['tag_id'];
    706     $tags[$i]['id']=(int)$tags[$i]['tag_id']; //required by make_xxx_url
     698    $tags[$i]['id']=(int)$tags[$i]['id'];
    707699  }
    708700  foreach( $tags as $tag )
    709701  {
    710     $tags_by_id[ $tag['tag_id'] ] = $tag;
     702    $tags_by_id[ $tag['id'] ] = $tag;
    711703    if (
    712704        in_array($tag['name'], $params['tag_name'])
     
    715707       )
    716708    {
    717       $tag_ids[] = $tag['tag_id'];
     709      $tag_ids[] = $tag['id'];
    718710    }
    719711  }
  • trunk/index.php

    r1800 r1815  
    226226        'URL' => make_index_url(
    227227          array(
    228             'tags' => array(
    229               array(
    230                 'id' => $tag['tag_id'],
    231                 'url_name' => $tag['url_name'],
    232                 ),
    233               )
     228            'tags' => array($tag)
    234229            )
    235230          ),
  • trunk/tags.php

    r1677 r1815  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     8// | file          : $Id$
    99// | last update   : $Date: 2006-03-22 02:01:47 +0100 (mer, 22 mar 2006) $
    1010// | last modifier : $Author: rvelices $
     
    3434  if ($a['counter'] == $b['counter'])
    3535  {
    36     return tag_id_compare($a, $b);
     36    return id_compare($a, $b);
    3737  }
    3838
     
    4040}
    4141
    42 function tag_id_compare($a, $b)
     42function id_compare($a, $b)
    4343{
    44   return ($a['tag_id'] < $b['tag_id']) ? -1 : 1;
     44  return ($a['id'] < $b['id']) ? -1 : 1;
    4545}
    4646
     
    9595      'URL' => make_index_url(
    9696        array(
    97           'tags' => array(
    98             array(
    99               'id' => $tag['tag_id'],
    100               'url_name' => $tag['url_name'],
    101               ),
    102             ),
     97          'tags' => array($tag),
    10398          )
    10499        ),
Note: See TracChangeset for help on using the changeset viewer.