Changeset 745 for trunk/picture.php


Ignore:
Timestamp:
Mar 12, 2005, 11:27:43 AM (19 years ago)
Author:
plg
Message:
  • bug fixed : there was no category name displayed in notification mails for new comment in special categories (other than numeric categories). Solution was to search related categories at the beginning of picture.php
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/picture.php

    r738 r745  
    7575  exit();
    7676}
     77//---------------------------------------------------------- related categories
     78$query = '
     79SELECT category_id,uppercats,commentable,global_rank
     80  FROM '.IMAGE_CATEGORY_TABLE.'
     81    INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
     82  WHERE image_id = '.$_GET['image_id'];
     83if ($user['forbidden_categories'] != '')
     84{
     85  $query.= '
     86    AND category_id NOT IN ('.$user['forbidden_categories'].')';
     87}
     88$query.= '
     89;';
     90$result = pwg_query($query);
     91$related_categories = array();
     92while ($row = mysql_fetch_array($result))
     93{
     94  array_push($related_categories, $row);
     95}
     96usort($related_categories, 'global_rank_compare');
    7797//------------------------------------- prev, current & next picture management
    7898$picture = array();
     
    349369      if ( $conf['mail_notification'] )
    350370      {
     371        // find any related category (can be unreachable to this admin)
     372        $category = $related_categories[0];
    351373        // locally, we change the $conf['level_separator']
    352374        $conf_separator = $conf['level_separator'];
    353375        $conf['level_separator'] = ' > ';
    354         $cat_name = get_cat_display_name($page['cat_name'], '');
     376        $cat_name = get_cat_display_name_cache($category['uppercats'],
     377                                               '',
     378                                               false);
    355379        $conf['level_separator'] = $conf_separator;
    356380       
     
    584608    'legend',
    585609    array(
    586         'COMMENT_IMG' => $picture['current']['comment']
     610      'COMMENT_IMG' => nl2br($picture['current']['comment'])
    587611      ));
    588612}
     
    746770}
    747771// related categories
    748 $query = '
    749 SELECT category_id,uppercats,commentable,global_rank
    750   FROM '.IMAGE_CATEGORY_TABLE.'
    751     INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
    752   WHERE image_id = '.$_GET['image_id'];
    753 if ($user['forbidden_categories'] != '')
    754 {
    755   $query.= '
    756     AND category_id NOT IN ('.$user['forbidden_categories'].')';
    757 }
    758 $query.= '
    759 ;';
    760 $result = pwg_query($query);
    761 $cat_array = array();
    762 while ($row = mysql_fetch_array($result))
    763 {
    764   array_push($cat_array, $row);
    765 }
    766 usort($cat_array, 'global_rank_compare');
    767 
    768772$cat_output = '';
    769773$page['show_comments'] = false;
    770 foreach ($cat_array as $category)
     774foreach ($related_categories as $category)
    771775{
    772776  if ($cat_output != '')
     
    775779  }
    776780 
    777   if (count($cat_array) > 3)
     781  if (count($related_categories) > 3)
    778782  {
    779783    $cat_output .= get_cat_display_name_cache($category['uppercats']);
Note: See TracChangeset for help on using the changeset viewer.