Changeset 12400 for extensions


Ignore:
Timestamp:
Oct 10, 2011, 6:16:33 PM (12 years ago)
Author:
patdenice
Message:

[cat] tag is now compatible with 2.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/ExtendedDescription/main.inc.php

    r12260 r12400  
    22/*
    33Plugin Name: Extended Description
    4 Version: auto
     4Version: 2.3.a
    55Description: Add multilinguale descriptions, banner, NMB, category name, etc...
    66Plugin URI: http://piwigo.org/ext/extension_view.php?eid=175
     
    238238function get_cat_thumb($elem_id)
    239239{
    240   global $template;
    241 
    242   $query = 'SELECT cat.id, cat.name, cat.comment, cat.representative_picture_id, cat.permalink,
    243             uc.nb_images, uc.count_images, uc.count_categories,
    244             img.path, img.tn_ext
    245             FROM ' . CATEGORIES_TABLE . ' AS cat
    246             INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' as uc
    247             INNER JOIN ' . IMAGES_TABLE . ' AS img
    248             ON cat.id = uc.cat_id
    249             AND img.id = cat.representative_picture_id
    250             WHERE cat.id = ' . $elem_id . ';';
     240  global $template, $user;
     241
     242  $query = 'SELECT
     243cat.id, cat.name, cat.comment, cat.representative_picture_id, cat.permalink, uc.nb_images, uc.count_images, uc.count_categories, img.path, img.tn_ext
     244FROM ' . CATEGORIES_TABLE . ' AS cat
     245INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.' as uc
     246  ON cat.id = uc.cat_id AND user_id = '.$user['id'].'
     247INNER JOIN ' . IMAGES_TABLE . ' AS img
     248  ON img.id = uc.user_representative_picture_id
     249WHERE cat.id = ' . $elem_id . ';';
    251250  $result = pwg_query($query);
    252251
    253   if($result)
     252  if($result and $category = mysql_fetch_array($result))
    254253  {
    255254    $template->set_filename('extended_description_content', dirname(__FILE__) . '/template/cat.tpl');
    256     while($category=mysql_fetch_array($result))
    257     {
    258       $template->assign(array(
    259           'ID'    => $category['id'],
    260           'TN_SRC'   => get_thumbnail_url($category),
    261           'TN_ALT'   => strip_tags($category['name']),
    262           'URL'   => make_index_url(array('category' => $category)),
    263           'CAPTION_NB_IMAGES' => get_display_images_count
    264                                   (
    265                                     $category['nb_images'],
    266                                     $category['count_images'],
    267                                     $category['count_categories'],
    268                                     true,
    269                                     '<br />'
    270                                   ),
    271           'DESCRIPTION' =>
    272             trigger_event('render_category_literal_description',
    273               trigger_event('render_category_description',
    274                 @$category['comment'],
    275                 'subcatify_category_description')),
    276           'NAME'  => trigger_event(
    277                        'render_category_name',
    278                        $category['name'],
    279                        'subcatify_category_name'
    280                      ),
    281         ));
    282     }
     255
     256    $template->assign(
     257      array(
     258        'ID'    => $category['id'],
     259        'TN_SRC'   => get_thumbnail_url($category),
     260        'TN_ALT'   => strip_tags($category['name']),
     261        'URL'   => make_index_url(array('category' => $category)),
     262        'CAPTION_NB_IMAGES' => get_display_images_count
     263                                (
     264                                  $category['nb_images'],
     265                                  $category['count_images'],
     266                                  $category['count_categories'],
     267                                  true,
     268                                  '<br />'
     269                                ),
     270        'DESCRIPTION' =>
     271          trigger_event('render_category_literal_description',
     272            trigger_event('render_category_description',
     273              @$category['comment'],
     274              'subcatify_category_description')),
     275        'NAME'  => trigger_event(
     276                     'render_category_name',
     277                     $category['name'],
     278                     'subcatify_category_name'
     279                   ),
     280      )
     281    );
     282
    283283    return $template->parse('extended_description_content', true);
    284284  }
Note: See TracChangeset for help on using the changeset viewer.