Changeset 1861 for trunk


Ignore:
Timestamp:
Feb 27, 2007, 2:56:16 AM (18 years ago)
Author:
rvelices
Message:
  • refactoring pagecategory before 1.7 release

pagecategory is not an id anymore, but an associative array of category info
all of pagecat_xxx or pageuppercats merged into one
simplifies calls to make_index_url
give plugins a clean start for page variables for version 1.7

Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_list.php

    r1755 r1861  
    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$
     
    173172  $navigation.= $conf['level_separator'];
    174173
    175   $current_category = get_cat_info($_GET['parent_id']);
    176 
    177   $navigation.= get_cat_display_name(
    178     $current_category['name'],
     174  $navigation.= get_cat_display_name_from_id(
     175    $_GET['parent_id'],
    179176    $base_url.'&parent_id=',
    180177    false
     
    278275      'U_JUMPTO'   => make_index_url(
    279276        array(
    280           'category' => $category['id'],
    281           'cat_name' => $category['name'],
     277          'category' => $category
    282278          )
    283279        ),
  • trunk/admin/cat_modify.php

    r1609 r1861  
    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 |
     5// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    280279    'U_JUMPTO' => make_index_url(
    281280      array(
    282         'category' => $category['id'],
    283         'cat_name' => $category['name'],
     281        'category' => $category
    284282        )
    285283      ),
  • trunk/admin/element_set.php

    r1831 r1861  
    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$
     
    110109if (is_numeric($_GET['cat']))
    111110{
    112   $cat_infos = get_cat_info($_GET['cat']);
    113111  $page['title'] =
    114     get_cat_display_name(
    115       $cat_infos['name'],
     112    get_cat_display_name_from_id(
     113      $_GET['cat'],
    116114      PHPWG_ROOT_PATH.'admin.php?page=cat_modify&cat_id=',
    117115      false
  • trunk/admin/picture_modify.php

    r1815 r1861  
    254254
    255255    'DESCRIPTION' =>
    256       isset($_POST['description']) ?
    257         stripslashes($_POST['description']) : @$row['comment'],
     256      htmlspecialchars( isset($_POST['description']) ?
     257        stripslashes($_POST['description']) : @$row['comment'] ),
    258258
    259259    'F_ACTION' =>
     
    348348      'image_id' => $_GET['image_id'],
    349349      'image_file' => $image_file,
    350       'category' => $_GET['cat_id'],
     350      'category' => $cache['cat_names'][ $_GET['cat_id'] ],
    351351      )
    352352    );
     
    360360        'image_id' => $_GET['image_id'],
    361361        'image_file' => $image_file,
    362         'category' => $category,
     362        'category' => $cache['cat_names'][ $category ],
    363363        )
    364364      );
  • trunk/admin/waiting.php

    r1754 r1861  
    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$
     
    162161      PHPWG_ROOT_PATH.get_complete_dir( $row['storage_category_id'] );
    163162    $cat_names[$row['storage_category_id']]['display_name'] =
    164       get_cat_display_name($cat['name']);
     163      get_cat_display_name($cat['upper_names']);
    165164  }
    166165  $preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file'];
  • trunk/category.php

    r1846 r1861  
    3939  {
    4040    $url_params['section'] = 'categories';
    41     $url_params['category'] = $_GET['cat'];
    42     $result = get_cat_info($url_params['category']);
     41    $result = get_cat_info( $_GET['cat'] );
    4342    if ( !empty($result) )
    44       $url_params['cat_name'] = $result['name'];
     43    {
     44      $url_params['category'] = $result;
     45    }
    4546  }
    4647  elseif ( in_array($_GET['cat'],
  • trunk/comments.php

    r1849 r1861  
    206206
    207207$query = '
    208 SELECT id,name,uppercats,global_rank
     208SELECT id, name, uppercats, global_rank
    209209  FROM '.CATEGORIES_TABLE.'
    210210'.get_sql_condition_FandF
     
    399399    $url = make_picture_url(
    400400            array(
    401               'category' => $comment['category_id'],
    402               'cat_name' => $categories[ $comment['category_id']] ['name'],
     401              'category' => $categories[ $comment['category_id'] ],
    403402              'image_id' => $comment['image_id'],
    404403              'image_file' => $elements[$comment['image_id']]['file'],
  • trunk/include/category_cats.inc.php

    r1851 r1861  
    3636  $query = '
    3737SELECT
    38   id,name, representative_picture_id, comment, nb_images, uppercats,
     38  id, name, representative_picture_id, comment, nb_images, uppercats,
    3939  date_last, max_date_last, count_images, count_categories, global_rank
    4040  FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
     
    5858  $query = '
    5959SELECT
    60   id,name, representative_picture_id, comment, nb_images,
     60  id, name, representative_picture_id, comment, nb_images,
    6161  date_last, max_date_last, count_images, count_categories
    6262  FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
    6363  ON id = cat_id and user_id = '.$user['id'].'
    6464  WHERE id_uppercat '.
    65   (!isset($page['category']) ? 'is NULL' : '= '.$page['category']).'
     65  (!isset($page['category']) ? 'is NULL' : '= '.$page['category']['id']).'
    6666'.get_sql_condition_FandF
    6767  (
     
    207207          'URL'   => make_index_url(
    208208            array(
    209               'category' => $category['id'],
    210               'cat_name' => $category['name'],
     209              'category' => $category
    211210              )
    212211            ),
     
    259258          'U_IMG_LINK'  => make_index_url(
    260259            array(
    261               'category' => $category['id'],
    262               'cat_name' => $category['name'],
     260              'category' => $category
    263261              )
    264262            ),
  • trunk/include/category_default.inc.php

    r1859 r1861  
    158158  if ($user['show_nb_comments']
    159159      and isset($page['category'])
    160       and $page['cat_commentable'])
     160      and $page['category']['commentable'])
    161161  {
    162162    $query = '
  • trunk/include/functions.inc.php

    r1846 r1861  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    87// | file          : $Id$
    98// | last update   : $Date$
     
    483482    \''.$_SERVER['REMOTE_ADDR'].'\',
    484483    '.(isset($page['section']) ? "'".$page['section']."'" : 'NULL').',
    485     '.(isset($page['category']) ? $page['category'] : 'NULL').',
     484    '.(isset($page['category']) ? $page['category']['id'] : 'NULL').',
    486485    '.(isset($image_id) ? $image_id : 'NULL').',
    487486    '.(isset($image_id) ? "'".$image_type."'" : 'NULL').',
  • trunk/include/functions_calendar.inc.php

    r1820 r1861  
    22// +-----------------------------------------------------------------------+
    33// | PhpWebGallery - a PHP based picture gallery                           |
    4 // | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
    5 // +-----------------------------------------------------------------------+
    6 // | branch        : BSF (Best So Far)
    7 // | file          : $RCSfile$
     4// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
     5// +-----------------------------------------------------------------------+
     6// | file          : $Id$
    87// | last update   : $Date$
    98// | last modifier : $Author$
     
    3534  $inner_sql = ' FROM ' . IMAGES_TABLE;
    3635
    37   if ($page['section']=='categories' or
    38       ( isset($page['category']) and is_numeric($page['category']) ) )
     36  if ($page['section']=='categories')
    3937  { // we will regenerate the items by including subcats elements
    4038    $page['items'] = array();
     
    4240INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
    4341
    44     if (isset($page['category']) and is_numeric($page['category']))
     42    if ( isset($page['category']) )
    4543    {
    4644      $sub_ids = array_diff(
    47         get_subcat_ids(array($page['category'])),
     45        get_subcat_ids(array($page['category']['id'])),
    4846        explode(',', $user['forbidden_categories'])
    4947        );
  • trunk/include/functions_category.inc.php

    r1854 r1861  
    7878    if (isset($page['category']))
    7979    {
    80       $query.= ' OR id_uppercat IN ('.$page['uppercats'].')';
     80      $query.= ' OR id_uppercat IN ('.$page['category']['uppercats'].')';
    8181    }
    8282    $query.= ')';
     
    112112  }
    113113
    114   return get_html_menu_category($cats);
     114  return get_html_menu_category($cats, @$page['category'] );
    115115}
    116116
     
    135135function get_cat_info( $id )
    136136{
    137   $infos = array('nb_images','id_uppercat','comment','site_id'
    138                  ,'dir','date_last','uploadable','status','visible'
    139                  ,'representative_picture_id','uppercats','commentable'
    140                  ,'image_order');
    141 
    142137  $query = '
    143 SELECT '.implode(',', $infos).'
     138SELECT *
    144139  FROM '.CATEGORIES_TABLE.'
    145140  WHERE id = '.$id.'
    146141;';
    147   $row = mysql_fetch_array(pwg_query($query));
    148   if (empty($row))
     142  $cat = mysql_fetch_assoc(pwg_query($query));
     143  if (empty($cat))
    149144    return null;
    150145
    151   $cat = array();
    152   foreach ($infos as $info)
    153   {
    154     if (isset($row[$info]))
    155     {
    156       $cat[$info] = $row[$info];
    157     }
    158     else
    159     {
    160       $cat[$info] = '';
    161     }
     146  foreach ($cat as $k => $v)
     147  {
    162148    // If the field is true or false, the variable is transformed into a
    163149    // boolean value.
    164     if ($cat[$info] == 'true' or $cat[$info] == 'false')
    165     {
    166       $cat[$info] = get_boolean( $cat[$info] );
     150    if ($cat[$k] == 'true' or $cat[$k] == 'false')
     151    {
     152      $cat[$k] = get_boolean( $cat[$k] );
    167153    }
    168154  }
     
    171157          preg_match('/<(div|br|img|script).*>/i', $cat['comment']) ) )
    172158  {
    173     $cat['comment'] = nl2br($cat['comment']);
     159    $cat['comment'] = nl2br(@$cat['comment']);
    174160  }
    175161
    176162  $names = array();
    177163  $query = '
    178 SELECT name,id
     164SELECT id, name
    179165  FROM '.CATEGORIES_TABLE.'
    180166  WHERE id IN ('.$cat['uppercats'].')
    181167;';
    182168  $result = pwg_query($query);
    183   while($row = mysql_fetch_array($result))
    184   {
    185     $names[$row['id']] = $row['name'];
     169  while($row = mysql_fetch_assoc($result))
     170  {
     171    $names[$row['id']] = $row;
    186172  }
    187173
    188174  // category names must be in the same order than uppercats list
    189   $cat['name'] = array();
     175  $cat['upper_names'] = array();
    190176  foreach (explode(',', $cat['uppercats']) as $cat_id)
    191177  {
    192     $cat['name'][$cat_id] = $names[$cat_id];
     178    $cat['upper_names'][$cat_id] = $names[$cat_id];
    193179  }
    194180
     
    346332  foreach ($ids as $num => $category_id)
    347333  {
     334    is_numeric($category_id)
     335      or trigger_error(
     336        'get_subcat_ids expecting numeric, not '.gettype($category_id),
     337        E_USER_WARNING
     338      );
    348339    if ($num > 0)
    349340    {
  • trunk/include/functions_html.inc.php

    r1855 r1861  
    236236 * categories string returned contains categories as given in the input
    237237 * array $cat_informations. $cat_informations array must be an association
    238  * of {category_id => category_name}. If url input parameter is null,
     238 * of {category_id => array( id, name) }. If url input parameter is null,
    239239 * returns only the categories name without links.
    240240 *
     
    252252  $output = '';
    253253  $is_first = true;
    254   foreach ($cat_informations as $id => $name)
    255   {
     254  foreach ($cat_informations as $id => $cat)
     255  {
     256    is_array($cat) or trigger_error(
     257        'get_cat_display_name wrong type for cat '.$id, E_USER_WARNING
     258      );
    256259    if ($is_first)
    257260    {
     
    265268    if ( !isset($url) )
    266269    {
    267       $output.= $name;
     270      $output.= $cat['name'];
    268271    }
    269272    elseif ($url == '')
     
    272275            .make_index_url(
    273276                array(
    274                   'category'=>$id,
    275                   'cat_name'=>$name
     277                  'category' => $cat,
    276278                  )
    277279              )
    278280            .'">';
    279       $output.= $name.'</a>';
     281      $output.= $cat['name'].'</a>';
    280282    }
    281283    else
    282284    {
    283285      $output.= '<a href="'.PHPWG_ROOT_PATH.$url.$id.'">';
    284       $output.= $name.'</a>';
     286      $output.= $cat['name'].'</a>';
    285287    }
    286288  }
     
    312314                                    $replace_space = true)
    313315{
    314   global $cat_names, $conf;
    315 
    316   if (!isset($cat_names))
     316  global $cache, $conf;
     317
     318  if (!isset($cache['cat_names']))
    317319  {
    318320    $query = '
    319 SELECT id,name
     321SELECT id, name
    320322  FROM '.CATEGORIES_TABLE.'
    321323;';
    322324    $result = pwg_query($query);
    323     while ($row = mysql_fetch_array($result))
    324     {
    325       $cat_names[$row['id']] = $row['name'];
     325    while ($row = mysql_fetch_assoc($result))
     326    {
     327      $cache['cat_names'][$row['id']] = $row;
    326328    }
    327329  }
     
    331333  foreach (explode(',', $uppercats) as $category_id)
    332334  {
    333     $name = $cat_names[$category_id];
     335    $cat = $cache['cat_names'][$category_id];
    334336
    335337    if ($is_first)
     
    344346    if ( !isset($url) )
    345347    {
    346       $output.= $name;
     348      $output.= $cat['name'];
    347349    }
    348350    elseif ($url == '')
     
    352354      .make_index_url(
    353355          array(
    354             'category'=>$category_id,
    355             'cat_name'=>$name
     356            'category' => $cat,
    356357            )
    357358        )
    358       .'">'.$name.'</a>';
     359      .'">'.$cat['name'].'</a>';
    359360    }
    360361    else
    361362    {
    362363      $output.= '
    363 <a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$name.'</a>';
     364<a href="'.PHPWG_ROOT_PATH.$url.$category_id.'">'.$cat['name'].'</a>';
    364365    }
    365366  }
     
    385386 * @return string
    386387 */
    387 function get_html_menu_category($categories)
    388 {
    389   global $page, $lang;
     388function get_html_menu_category($categories, $selected_category)
     389{
     390  global $lang;
    390391
    391392  $ref_level = 0;
     
    393394  $menu = '';
    394395
    395   // $page_cat value remains 0 for special sections
    396   $page_cat = 0;
    397   if (isset($page['category']))
    398   {
    399     $page_cat = $page['category'];
    400   }
    401 
    402396  foreach ($categories as $category)
    403397  {
     
    420414
    421415    $menu.= "\n\n".'<li';
    422     if ($category['id'] == $page_cat)
     416    if ($category['id'] == @$selected_category['id'])
    423417    {
    424418      $menu.= ' class="selected"';
     
    428422    $url = make_index_url(
    429423            array(
    430               'category'=>$category['id'],
    431               'cat_name'=>$category['name']
     424              'category' => $category
    432425              )
    433426            );
    434427
    435428    $menu.= "\n".'<a href="'.$url.'"';
    436     if ($page_cat != 0
    437         and $category['id'] == $page['cat_id_uppercat'])
     429    if ($selected_category!=null
     430        and $category['id'] == $selected_category['id_uppercat'])
    438431    {
    439432      $menu.= ' rel="up"';
     
    510503{
    511504  $cat_info = get_cat_info($cat_id);
    512   return get_cat_display_name($cat_info['name'], $url, $replace_space);
     505  return get_cat_display_name($cat_info['upper_names'], $url, $replace_space);
    513506}
    514507
  • trunk/include/functions_url.inc.php

    r1800 r1861  
    44// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    55// +-----------------------------------------------------------------------+
    6 // | branch        : BSF (Best So Far)
    76// | file          : $Id$
    87// | last update   : $Date$
     
    134133 * and removes.
    135134 *
    136  * duplicate_index_url(array('category' => 12), array('start')) will create
    137  * an index URL on the current section (categories), but on a redefined
    138  * category and without the start URL parameter.
     135 * duplicate_index_url( array(
     136 *   'category' => array('id'=>12, 'name'=>'toto'),
     137 *   array('start')
     138 * ) will create an index URL on the current section (categories), but on
     139 * a redefined category and without the start URL parameter.
    139140 *
    140141 * @param array redefined keys
     
    326327      else
    327328      {
    328         $section_string.= '/category/'.$params['category'];
    329         if ($conf['category_url_style']=='id-name' and isset($params['cat_name']) )
     329        is_array($params['category']) or trigger_error(
     330            'make_section_in_url wrong type for category', E_USER_WARNING
     331            );
     332        is_numeric($params['category']['id']) or trigger_error(
     333            'make_section_in_url category id not numeric', E_USER_WARNING
     334            );
     335        isset($params['category']['name']) or trigger_error(
     336            'make_section_in_url category name not set', E_USER_WARNING
     337            );
     338
     339        $section_string.= '/category/'.$params['category']['id'];
     340        if ( $conf['category_url_style']=='id-name' )
    330341        {
    331           if ( is_string($params['cat_name']) )
    332           {
    333             $section_string.= '-'.str2url($params['cat_name']);
    334           }
    335           elseif ( is_array( $params['cat_name'] ) and
    336                 isset( $params['cat_name'][$params['category']] ) )
    337           {
    338             $section_string.= '-'
    339                 .str2url($params['cat_name'][$params['category']]);
    340           }
     342          $section_string.= '-'.str2url($params['category']['name']);
    341343        }
    342344      }
  • trunk/include/menubar.inc.php

    r1815 r1861  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    87// | file          : $Id$
    98// | last update   : $Date$
     
    334333  );
    335334
    336 if (isset($page['category']) and $page['cat_uploadable'] )
     335if (isset($page['category']) and $page['category']['uploadable'] )
    337336{ // upload a picture in the category
    338   $url = get_root_url().'upload.php?cat='.$page['category'];
     337  $url = get_root_url().'upload.php?cat='.$page['category']['id'];
    339338  $template->assign_block_vars(
    340339    'upload',
  • trunk/include/section_init.inc.php

    r1852 r1861  
    3535 */
    3636
    37 // "index.php?/category/12-foo/start-24&action=fill_caddie" or
    38 // "index.php/category/12-foo/start-24&action=fill_caddie"
     37// "index.php?/category/12-foo/start-24" or
     38// "index.php/category/12-foo/start-24"
    3939// must return :
    4040//
    4141// array(
    4242//   'section'  => 'categories',
    43 //   'category' => 12,
     43//   'category' => array('id'=>12, ...),
    4444//   'start'    => 24
    45 //   'action'   => 'fill_caddie'
    4645//   );
    4746
     
    8887    $url = make_picture_url( array(
    8988        'section' => 'categories',
    90         'category' => $_GET['cat'],
     89        'category' => get_cat_info($_GET['cat']),
    9190        'image_id' => $_GET['image_id']
    9291      ) );
     
    361360      array(
    362361        'comment'            => $result['comment'],
    363         'cat_dir'            => $result['dir'],
    364         'cat_name'           => $result['name'],
    365         'cat_site_id'        => $result['site_id'],
    366         'cat_uploadable'     => $result['uploadable'],
    367         'cat_commentable'    => $result['commentable'],
    368         'cat_id_uppercat'    => $result['id_uppercat'],
    369         'uppercats'          => $result['uppercats'],
     362        'category'          => $result,
    370363        'title'             =>
    371           get_cat_display_name($result['name'], '', false),
     364          get_cat_display_name($result['upper_names'], '', false),
    372365        )
    373366      );
     
    396389      if ( isset($page['category']) )
    397390      {
    398         $subcat_ids = get_subcat_ids( array($page['category']) );
     391        $subcat_ids = get_subcat_ids( array($page['category']['id']) );
    399392        $where_sql = 'category_id IN ('.implode(',',$subcat_ids).')';
    400393      }
     
    406399    else
    407400    {// Normal mode
    408       $where_sql = 'category_id = '.$page['category'];
     401      $where_sql = 'category_id = '.$page['category']['id'];
    409402    }
    410403
  • trunk/include/ws_functions.inc.php

    r1853 r1861  
    387387        $url = make_index_url(
    388388                array(
    389                   'category' => $cat_id,
    390                   'cat_name' => $cats[$cat_id]['name'],
     389                  'category' => $cats[$cat_id],
    391390                  )
    392391                );
    393392        $page_url = make_picture_url(
    394393                array(
    395                   'category' => $cat_id,
    396                   'cat_name' => $cats[$cat_id]['name'],
     394                  'category' => $cats[$cat_id],
    397395                  'image_id' => $row['id'],
    398396                  'image_file' => $row['file'],
     
    485483    $row['url'] = make_index_url(
    486484        array(
    487           'category' => $row['id'],
    488           'cat_name' => $row['name'],
     485          'category' => $row
    489486          )
    490487      );
     
    600597  //-------------------------------------------------------- related categories
    601598  $query = '
    602 SELECT id,name,uppercats,global_rank,commentable
     599SELECT id, name, uppercats, global_rank, commentable
    603600  FROM '.IMAGE_CATEGORY_TABLE.'
    604601    INNER JOIN '.CATEGORIES_TABLE.' ON category_id = id
     
    618615    $row['url'] = make_index_url(
    619616        array(
    620           'category' => $row['id'],
    621           'cat_name' => $row['name'],
     617          'category' => $row
    622618          )
    623619      );
     
    627623          'image_id' => $image_row['id'],
    628624          'image_file' => $image_row['file'],
    629           'category' => $row['id'],
    630           'cat_name' => $row['name'],
     625          'category' => $row
    631626          )
    632627      );
  • trunk/index.php

    r1820 r1861  
    6666if (isset($page['category']))
    6767{
    68   check_restrictions($page['category']);
     68  check_restrictions($page['category']['id']);
    6969}
    7070
     
    194194      'URL' =>
    195195        get_root_url().'admin.php?page=cat_modify'
    196         .'&amp;cat_id='.$page['category']
     196        .'&amp;cat_id='.$page['category']['id']
    197197      )
    198198    );
  • trunk/picture.php

    r1844 r1861  
    3737if (isset($page['category']))
    3838{
    39   check_restrictions($page['category']);
     39  check_restrictions($page['category']['id']);
    4040}
    4141
     
    200200UPDATE '.CATEGORIES_TABLE.'
    201201  SET representative_picture_id = '.$page['image_id'].'
    202   WHERE id = '.$page['category'].'
     202  WHERE id = '.$page['category']['id'].'
    203203;';
    204204        pwg_query($query);
     
    421421$url_admin =
    422422  get_root_url().'admin.php?page=picture_modify'
    423   .'&amp;cat_id='.(isset($page['category']) ? $page['category'] : '')
     423  .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
    424424  .'&amp;image_id='.$page['image_id']
    425425;
  • trunk/upload.php

    r1850 r1861  
    133133{
    134134  check_restrictions( $page['category'] );
    135   $result = get_cat_info( $page['category'] );
    136   $page['cat_dir']        = get_complete_dir( $page['category'] );
    137   $page['cat_site_id']    = $result['site_id'];
    138   $page['cat_name']       = $result['name'];
    139   $page['cat_uploadable'] = $result['uploadable'];
    140  
    141   if (url_is_remote($page['cat_dir']) or !$page['cat_uploadable'])
     135  $category = get_cat_info( $page['category'] );
     136  $category['cat_dir'] = get_complete_dir( $page['category'] );
     137 
     138  if (url_is_remote($category['cat_dir']) or !$category['uploadable'])
    142139  {
    143140    die('Fatal: you take a wrong way, bye bye');
     
    155152if ( isset( $_POST['submit'] ) and !isset( $_GET['waiting_id'] ) )
    156153{
    157   $path = $page['cat_dir'].$_FILES['picture']['name'];
     154  $path = $category['cat_dir'].$_FILES['picture']['name'];
    158155  if ( @is_file( $path ) )
    159156  {
     
    242239  $extension = get_extension( $_FILES['picture']['name'] );
    243240
    244   if (($path = mkget_thumbnail_dir($page['cat_dir'], $error)) != false)
     241  if (($path = mkget_thumbnail_dir($category['cat_dir'], $error)) != false)
    245242  {
    246243    $path.= '/'.$conf['prefix_thumbnail'].$file.'.'.$extension;
     
    286283{
    287284  $advise_title = l10n('upload_advise');
    288   $advise_title.= get_cat_display_name($page['cat_name']);
     285  $advise_title.= get_cat_display_name($category['upper_names']);
    289286}
    290287
     
    303300    'F_ACTION' => $u_form,
    304301
    305     'U_RETURN' => make_index_url(array('category' => $page['category'])),
     302    'U_RETURN' => make_index_url(array('category' => $category)),
    306303    )
    307304  );
Note: See TracChangeset for help on using the changeset viewer.