Ignore:
Timestamp:
Mar 26, 2004, 6:08:09 PM (20 years ago)
Author:
gweltas
Message:
  • Template migration
  • Admin Control Panel migration
  • Category management
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_category.inc.php

    r387 r394  
    112112    $category = array();
    113113    foreach ( $infos as $info ) {
    114       if ( $info == 'uc.date_last' )
    115       {
    116         list($year,$month,$day) = explode( '-', $row['date_last'] );
    117         $category['date_last'] = mktime(0,0,0,$month,$day,$year);
     114      if ( $info == 'uc.date_last')
     115      {
     116            if (empty($row['date_last']))
     117                {
     118                  $category['date_last']= 0;
     119                }
     120                else
     121                {
     122          list($year,$month,$day) = explode( '-', $row['date_last'] );
     123          $category['date_last'] = mktime(0,0,0,$month,$day,$year);
     124                }
    118125      }
    119126      else if ( isset( $row[$info] ) ) $category[$info] = $row[$info];
     
    240247function get_cat_info( $id )
    241248{
    242   global $page;
    243 
    244249  $infos = array( 'nb_images','id_uppercat','comment','site_id','galleries_url'
    245250                  ,'dir','date_last','uploadable','status','visible'
     
    271276  $cat['name'] = array();
    272277
    273   $query = 'SELECT name FROM '.CATEGORIES_TABLE;
     278  $query = 'SELECT name,id FROM '.CATEGORIES_TABLE;
    274279  $query.= ' WHERE id IN ('.$cat['uppercats'].')';
    275280  $query.= ' ORDER BY id ASC';
     
    278283  while( $row = mysql_fetch_array( $result ) )
    279284  {
    280     array_push( $cat['name'], $row['name'] );
     285    $cat['name'][$row['id']] = $row['name'];
    281286  }
    282287 
     
    349354  $row = mysql_fetch_array( mysql_query( $query ) );
    350355  return $row['galleries_url'];
    351 }
    352 
    353 // The function get_cat_display_name returns a string containing the list
    354 // of upper categories to the root category from the lowest category shown
    355 // example : "anniversaires - fete mere 2002 - animaux - erika"
    356 // You can give two parameters :
    357 //   - $separation : the string between each category name " - " for example
    358 //   - $style : the style of the span tag for the lowest category,
    359 //     "font-style:italic;" for example
    360 function get_cat_display_name( $array_cat_names, $separation,
    361                                $style, $replace_space = true )
    362 {
    363   $output = '';
    364   foreach ( $array_cat_names as $i => $name ) {
    365     if ( $i > 0 ) $output.= $separation;
    366     if ( $i < count( $array_cat_names ) - 1 or $style == '')
    367       $output.= $name;
    368     else
    369       $output.= '<span style="'.$style.'">'.$name.'</span>';
    370   }
    371   if ( $replace_space ) return replace_space( $output );
    372   else                  return $output;
    373356}
    374357
     
    634617}
    635618?>
     619
Note: See TracChangeset for help on using the changeset viewer.