Changeset 642


Ignore:
Timestamp:
Dec 12, 2004, 10:06:39 PM (19 years ago)
Author:
plg
Message:
  • in admin menu, status option for categories is not "permissions" but "private or public" choice = different language item
  • get_cat_display_name changed : use $conflevel_separator to unify presentation
  • default values for category properties commentable, uploadable, status and visible (set in include/config.inc.php) used for category creation (admin/update, admin/remote_site, admin/cat_list)
  • use mass_inserts in admin/update for inserting new categories
  • only one query for counting the number of sub categories in admin/cat_list
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r631 r642  
    3131include_once( PHPWG_ROOT_PATH.'include/common.inc.php' );
    3232include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
    33 
    3433//--------------------------------------- validating page and creation of title
    3534$page_valide = false;
     
    8685     {
    8786       $result = get_cat_info( $page['cat'] );
    88        $name = get_cat_display_name( $result['name'],' > ', '' );
     87       $name = get_cat_display_name($result['name'], '');
    8988       $title.= ' "'.$name.'"';
    9089     }
     
    203202  'L_CAT_COMMENTS'=>$lang['comments'],
    204203  'L_CAT_VISIBLE'=>$lang['lock'],
    205   'L_CAT_STATUS'=>$lang['permissions'],
     204  'L_CAT_STATUS'=>$lang['admin_menu_cat_status'],
    206205
    207206  'U_CONFIG_GENERAL'=>add_session_id($conf_link.'general' ),
  • trunk/admin/cat_list.php

    r635 r642  
    6060  if (!count($errors))
    6161  {
    62     $parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
    63     // As we don't create a virtual category every day, let's do (far) too
    64     // much queries
     62    $parent_id = !empty($_GET['parent_id'])?$_GET['parent_id']:'NULL';
     63   
     64    if ($parent_id != 'NULL')
     65    {
     66      $query = '
     67SELECT id,uppercats,global_rank,visible,status
     68  FROM '.CATEGORIES_TABLE.'
     69  WHERE id = '.$parent_id.'
     70;';
     71      $row = mysql_fetch_array(pwg_query($query));
     72      $parent = array('id' => $row['id'],
     73                      'uppercats' => $row['uppercats'],
     74                      'visible' => $row['visible'],
     75                      'status' => $row['status'],
     76                      'global_rank' => $row['global_rank']);
     77    }
     78
     79    $insert = array();
     80    $insert{'name'} = $_POST['virtual_name'];
     81    $insert{'rank'} = $_POST['rank'];
     82    $insert{'commentable'} = $conf['newcat_default_commentable'];
     83    $insert{'uploadable'} = $conf['newcat_default_uploadable'];
     84   
     85    if (isset($parent))
     86    {
     87      $insert{'id_uppercat'} = $parent{'id'};
     88      // at creation, must a category be visible or not ? Warning : if
     89      // the parent category is invisible, the category is automatically
     90      // create invisible. (invisible = locked)
     91      if ('false' == $parent['visible'])
     92      {
     93        $insert{'visible'} = 'false';
     94      }
     95      else
     96      {
     97        $insert{'visible'} = $conf['newcat_default_visible'];
     98      }
     99      // at creation, must a category be public or private ? Warning :
     100      // if the parent category is private, the category is
     101      // automatically create private.
     102      if ('private' == $parent['status'])
     103      {
     104        $insert{'status'} = 'private';
     105      }
     106      else
     107      {
     108        $insert{'status'} = $conf['newcat_default_status'];
     109      }
     110    }
     111    else
     112    {
     113      $insert{'visible'} = $conf['newcat_default_visible'];
     114      $insert{'status'} = $conf['newcat_default_status'];
     115    }
     116
     117    $inserts = array($insert);
    65118   
    66119    // we have then to add the virtual category
    67     $query = '
    68 INSERT INTO '.CATEGORIES_TABLE.'
    69   (name,id_uppercat,rank,site_id)
    70   VALUES
    71   (\''.$_POST['virtual_name'].'\','.$parent_id.','.$_POST['rank'].',NULL)
    72 ;';
    73     pwg_query($query);
    74        
     120    $dbfields = array('site_id','name','id_uppercat','rank','commentable',
     121                      'uploadable','visible','status');
     122    mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
     123   
    75124    // And last we update the uppercats
    76125    $query = '
     
    79128;';
    80129    $my_id = array_pop(mysql_fetch_array(pwg_query($query)));
    81    
    82     if ($parent_id != 'NULL')
    83     {
    84       $query = '
    85 SELECT uppercats, global_rank
    86   FROM '.CATEGORIES_TABLE.'
    87   WHERE id = '.$parent_id.'
    88 ;';
    89       $result = pwg_query($query);
    90       $row = mysql_fetch_array($result);
    91      
    92       $parent_uppercats = $row['uppercats'];
    93       $parent_global_rank = $row['global_rank'];
    94     }
    95 
    96     $query = '
    97 UPDATE '.CATEGORIES_TABLE.'
    98 ';
    99     if (!empty($parent_uppercats))
    100     {
    101       $query.= "  SET uppercats = CONCAT('".$parent_uppercats."',',',id)";
     130
     131    $query = '
     132UPDATE '.CATEGORIES_TABLE;
     133    if (isset($parent))
     134    {
     135      $query.= "
     136  SET uppercats = CONCAT('".$parent['uppercats']."',',',id)
     137    , global_rank = CONCAT('".$parent['global_rank']."','.',rank)";
    102138    }
    103139    else
    104140    {
    105       $query.= '  SET uppercats = id';
    106     }
    107     if (!empty($parent_global_rank))
    108     {
    109       $query.= "  , global_rank = CONCAT('".$parent_global_rank."','.',rank)";
    110     }
    111     else
    112     {
    113       $query.= '  , uppercats = id';
     141      $query.= '
     142  SET uppercats = id
     143    , global_rank = id';
    114144    }
    115145    $query.= '
     
    143173{
    144174  $categories[$row['rank']] = $row;
     175  $categories[$row['rank']]['nb_subcats'] = 0;
    145176}
    146177// +-----------------------------------------------------------------------+
     
    149180if (isset($_GET['parent_id']))
    150181{
    151   $separator = ' <span style="font-size:15px">&rarr;</span> ';
    152182  $base_url = PHPWG_ROOT_PATH.'admin.php?page=cat_list';
    153183 
     
    155185  $navigation.= $lang['home'];
    156186  $navigation.= '</a>';
    157   $navigation.= $separator;
     187  $navigation.= $conf['level_separator'];
    158188
    159189  $current_category = get_cat_info($_GET['parent_id']);
    160190  $navigation.= get_cat_display_name($current_category['name'],
    161                                      $separator,
    162191                                     $base_url.'&amp;parent_id=',
    163192                                     false);
     
    338367// |                          Categories display                           |
    339368// +-----------------------------------------------------------------------+
    340 while (list($id,$category) = each($categories))
     369$ranks = array();
     370foreach ($categories as $category)
     371{
     372  $ranks[$category['id']] = $category['rank'];
     373}
     374
     375$query = '
     376SELECT id_uppercat, COUNT(*) AS nb_subcats
     377  FROM '. CATEGORIES_TABLE.'
     378  WHERE id_uppercat IN ('.implode(',', array_keys($ranks)).')
     379  GROUP BY id_uppercat
     380;';
     381$result = pwg_query($query);
     382while ($row = mysql_fetch_array($result))
     383{
     384  $categories[$ranks[$row['id_uppercat']]]['nb_subcats'] = $row['nb_subcats'];
     385}
     386
     387foreach ($categories as $category)
    341388{
    342389  $images_folder = PHPWG_ROOT_PATH.'template/';
     
    357404  else
    358405  {
    359     // (Gweltas) May be should we have to introduce a computed field in the
    360     // table to avoid this query -> (z0rglub) no because the number of
    361     // sub-categories depends on permissions
    362     $query = '
    363 SELECT COUNT(id) AS nb_sub_cats
    364   FROM '. CATEGORIES_TABLE.'
    365   WHERE id_uppercat = '.$category['id'].'
    366 ;';
    367     $row = mysql_fetch_array(pwg_query($query));
    368 
    369     if ($row['nb_sub_cats'] > 0)
     406    if ($category['nb_subcats'] > 0)
    370407    {
    371408      $image_src = $images_folder.'/icon_subfolder.gif';
  • trunk/admin/cat_modify.php

    r635 r642  
    104104$url = PHPWG_ROOT_PATH.'admin.php?page=cat_list&amp;parent_id=';
    105105$navigation = '<a class="" href="'.add_session_id(PHPWG_ROOT_PATH.'admin.php?page=cat_list').'">';
    106 $navigation.= $lang['home'].'</a> <span style="font-size:15px">&rarr;</span>';
     106$navigation.= $lang['home'].'</a>'.$conf['level_separator'];
    107107
    108108$navigation.= get_cat_display_name_cache(
    109109  $category['uppercats'],
    110   ' <span style="font-size:15px">&rarr;</span>',
    111110  $url);
    112111
  • trunk/admin/group_perm.php

    r593 r642  
    105105  // category name
    106106  $cat_infos = get_cat_info( $row['id'] );
    107   $name = get_cat_display_name( $cat_infos['name'],' &gt; ',
    108                                 'font-weight:bold;' );
     107  $name = get_cat_display_name($cat_infos['name']);
    109108  $vtp->setVar( $sub, 'category.name', $name );
    110109  // any subcat forbidden for this group ?
  • trunk/admin/include/functions.php

    r638 r642  
    789789{
    790790  $sub_dirs = array();
    791 
     791 
    792792  if ( $opendir = opendir( $basedir ) )
    793793  {
  • trunk/admin/infos_images.php

    r606 r642  
    249249  $current_category = get_cat_info($_GET['cat_id']);
    250250  $url = PHPWG_ROOT_PATH.'admin.php?page=infos_images&amp;cat_id=';
    251   $category_path = get_cat_display_name($current_category['name'],
    252                                         '-&gt;',
    253                                         $url);
     251  $category_path = get_cat_display_name($current_category['name'], $url);
    254252 
    255253  $form_action = PHPWG_ROOT_PATH.'admin.php';
  • trunk/admin/picture_modify.php

    r640 r642  
    163163$date = isset($_POST['date_creation']) && empty($errors)
    164164?$_POST['date_creation']:date_convert_back(@$row['date_creation']);
    165          
     165
     166$url = PHPWG_ROOT_PATH.'admin.php?page=cat_modify&amp;cat_id=';
    166167$storage_category = get_cat_display_name_cache($row['uppercats'],
    167                                                ' &rarr; ',
    168                                                '',
     168                                               $url,
    169169                                               false);
    170170//----------------------------------------------------- template initialization
  • trunk/admin/remote_site.php

    r638 r642  
    177177function insert_remote_category($xml_content, $site_id, $id_uppercat, $level)
    178178{
    179   global $counts, $removes;
     179  global $counts, $removes, $conf;
    180180 
    181181  $uppercats = '';
     
    185185  {
    186186    $query = '
    187 SELECT name,uppercats,dir
     187SELECT id,name,uppercats,dir,status,visible
    188188  FROM '.CATEGORIES_TABLE.'
    189189  WHERE id = '.$id_uppercat.'
    190190;';
    191191    $row = mysql_fetch_array(pwg_query($query));
     192    $parent = array('id' => $row['id'],
     193                    'name' => $row['name'],
     194                    'dir' => $row['dir'],
     195                    'uppercats' => $row['uppercats'],
     196                    'visible' => $row['visible'],
     197                    'status' => $row['status']);
    192198   
    193     $uppercats = $row['uppercats'];
    194     $name = $row['name'];
    195 
    196199    insert_remote_element($xml_content, $id_uppercat);
    197200  }
     
    225228  $inserts = array();
    226229 
     230  // calculate default value at category creation
     231  $create_values = array();
     232  if (isset($parent))
     233  {
     234    // at creation, must a category be visible or not ? Warning : if
     235    // the parent category is invisible, the category is automatically
     236    // create invisible. (invisible = locked)
     237    if ('false' == $parent['visible'])
     238    {
     239      $create_values{'visible'} = 'false';
     240    }
     241    else
     242    {
     243      $create_values{'visible'} = $conf['newcat_default_visible'];
     244    }
     245    // at creation, must a category be public or private ? Warning :
     246    // if the parent category is private, the category is
     247    // automatically create private.
     248    if ('private' == $parent['status'])
     249    {
     250      $create_values{'status'} = 'private';
     251    }
     252    else
     253    {
     254      $create_values{'status'} = $conf['newcat_default_status'];
     255    }
     256  }
     257  else
     258  {
     259    $create_values{'visible'} = $conf['newcat_default_visible'];
     260    $create_values{'status'} = $conf['newcat_default_status'];
     261  }
     262
    227263  foreach ($xml_dirs as $xml_dir)
    228264  {
     
    240276      $insert{'site_id'} = $site_id;
    241277      $insert{'uppercats'} = 'undef';
    242       if (is_numeric($id_uppercat))
     278      $insert{'commentable'} = $conf['newcat_default_commentable'];
     279      $insert{'uploadable'} = 'false';
     280      $insert{'status'} = $create_values{'status'};
     281      $insert{'visible'} = $create_values{'visible'};
     282      if (isset($parent))
    243283      {
    244         $insert{'id_uppercat'} = $id_uppercat;
     284        $insert{'id_uppercat'} = $parent['id'];
    245285      }
    246286      array_push($inserts, $insert);
     
    252292  {
    253293    // inserts all found categories
    254     $dbfields = array('dir','name','site_id','uppercats','id_uppercat');
     294    $dbfields = array('dir','name','site_id','uppercats','id_uppercat',
     295                      'commentable','uploadable','status','visible');
    255296    mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
    256297    $counts{'new_categories'}+= count($inserts);
     
    258299    // updating uppercats field
    259300    $query = '
    260 UPDATE '.CATEGORIES_TABLE.'
    261   SET uppercats = ';
    262     if ($uppercats != '')
    263     {
    264       $query.= "CONCAT('".$uppercats."',',',id)";
     301UPDATE '.CATEGORIES_TABLE;
     302    if (isset($parent))
     303    {
     304      $query.= "
     305  SET uppercats = CONCAT('".$parent['uppercats']."',',',id)
     306  WHERE id_uppercat = ".$id_uppercat;
    265307    }
    266308    else
    267309    {
    268       $query.= 'id';
    269     }
    270     $query.= '
    271   WHERE id_uppercat ';
    272     if (!is_numeric($id_uppercat))
    273     {
    274       $query.= 'IS NULL';
    275     }
    276     else
    277     {
    278       $query.= '= '.$id_uppercat;
     310      $query.= '
     311  SET uppercats = id
     312  WHERE id_uppercat IS NULL';
    279313    }
    280314    $query.= '
  • trunk/admin/update.php

    r638 r642  
    4848  if (is_numeric($id_uppercat))
    4949  {
    50     $query = 'SELECT name,uppercats,dir FROM '.CATEGORIES_TABLE;
    51     $query.= ' WHERE id = '.$id_uppercat;
    52     $query.= ';';
    53     $row = mysql_fetch_array( pwg_query( $query));
    54     $uppercats = $row['uppercats'];
    55     $name      = $row['name'];
    56     $dir       = $row['dir'];
    57 
    58     $upper_array = explode( ',', $uppercats);
     50    $query = '
     51SELECT id,name,uppercats,dir,visible,status
     52  FROM '.CATEGORIES_TABLE.'
     53  WHERE id = '.$id_uppercat.'
     54;';
     55    $row = mysql_fetch_array(pwg_query($query));
     56    $parent = array('id' => $row['id'],
     57                    'name' => $row['name'],
     58                    'dir' => $row['dir'],
     59                    'uppercats' => $row['uppercats'],
     60                    'visible' => $row['visible'],
     61                    'status' => $row['status']);
     62
     63    $upper_array = explode( ',', $parent['uppercats']);
    5964
    6065    $local_dir = '';
     
    6267    $database_dirs = array();
    6368    $query = '
    64 SELECT id,dir FROM '.CATEGORIES_TABLE.'
    65   WHERE id IN ('.$uppercats.')
    66 ;';
    67     $result = pwg_query( $query);
     69SELECT id,dir
     70  FROM '.CATEGORIES_TABLE.'
     71  WHERE id IN ('.$parent['uppercats'].')
     72;';
     73    $result = pwg_query($query);
    6874    while ($row = mysql_fetch_array($result))
    6975    {
     
    7985    // 1. display the category name to update
    8086    $output = '<ul class="menu">';
    81     $output.= '<li><strong>'.$name.'</strong>';
    82     $output.= ' [ '.$dir.' ]';
     87    $output.= '<li><strong>'.$parent['name'].'</strong>';
     88    $output.= ' [ '.$parent['dir'].' ]';
    8389    $output.= '</li>';
    8490
     
    95101  $sub_category_dirs = array();
    96102  $query = '
    97 SELECT id,dir FROM '.CATEGORIES_TABLE.'
     103SELECT id,dir
     104  FROM '.CATEGORIES_TABLE.'
    98105  WHERE site_id = 1
    99106';
     
    132139  // array of new categories to insert
    133140  $inserts = array();
     141
     142  // calculate default value at category creation
     143  $create_values = array();
     144  if (isset($parent))
     145  {
     146    // at creation, must a category be visible or not ? Warning : if
     147    // the parent category is invisible, the category is automatically
     148    // create invisible. (invisible = locked)
     149    if ('false' == $parent['visible'])
     150    {
     151      $create_values{'visible'} = 'false';
     152    }
     153    else
     154    {
     155      $create_values{'visible'} = $conf['newcat_default_visible'];
     156    }
     157    // at creation, must a category be public or private ? Warning :
     158    // if the parent category is private, the category is
     159    // automatically create private.
     160    if ('private' == $parent['status'])
     161    {
     162      $create_values{'status'} = 'private';
     163    }
     164    else
     165    {
     166      $create_values{'status'} = $conf['newcat_default_status'];
     167    }
     168  }
     169  else
     170  {
     171    $create_values{'visible'} = $conf['newcat_default_visible'];
     172    $create_values{'status'} = $conf['newcat_default_status'];
     173  }
    134174 
    135175  foreach ($fs_subdirs as $fs_subdir)
     
    140180    if (!is_numeric($category_id))
    141181    {
     182      $insert = array();
     183     
    142184      if (preg_match('/^[a-zA-Z0-9-_.]+$/', $fs_subdir))
    143185      {
    144186        $name = str_replace('_', ' ', $fs_subdir);
    145187
    146         $value = "('".$fs_subdir."','".$name."',1";
    147         if (!is_numeric($id_uppercat))
    148         {
    149           $value.= ',NULL';
    150         }
    151         else
    152         {
    153           $value.= ','.$id_uppercat;
    154         }
    155         $value.= ",'undef'";
    156         $value.= ')';
    157         array_push($inserts, $value);
     188        $insert{'dir'} = $fs_subdir;
     189        $insert{'name'} = $name;
     190        $insert{'site_id'} = 1;
     191        $insert{'uppercats'} = 'undef';
     192        $insert{'commentable'} = $conf['newcat_default_commentable'];
     193        $insert{'uploadable'} = $conf['newcat_default_uploadable'];
     194        $insert{'status'} = $create_values{'status'};
     195        $insert{'visible'} = $create_values{'visible'};
     196
     197        if (isset($parent))
     198        {
     199          $insert{'id_uppercat'} = $parent['id'];
     200        }
     201       
     202        array_push($inserts, $insert);
    158203      }
    159204      else
     
    168213  if (count($inserts) > 0)
    169214  {
    170     $query = '
    171 INSERT INTO '.CATEGORIES_TABLE.'
    172   (dir,name,site_id,id_uppercat,uppercats) VALUES
    173 ';
    174     $query.= implode(',', $inserts);
    175     $query.= '
    176 ;';
    177     pwg_query($query);
    178 
     215    $dbfields = array(
     216      'dir','name','site_id','id_uppercat','uppercats','commentable',
     217      'uploadable','visible','status'
     218      );
     219    mass_inserts(CATEGORIES_TABLE, $dbfields, $inserts);
     220   
    179221    $counts['new_categories']+= count($inserts);
    180222    // updating uppercats field
    181223    $query = '
    182 UPDATE '.CATEGORIES_TABLE.'
    183   SET uppercats = ';
    184     if ($uppercats != '')
    185     {
    186       $query.= "CONCAT('".$uppercats."',',',id)";
     224UPDATE '.CATEGORIES_TABLE;
     225    if (isset($parent))
     226    {
     227      $query.= "
     228  SET uppercats = CONCAT('".$parent['uppercats']."',',',id)
     229  WHERE id_uppercat = ".$parent['id'];
    187230    }
    188231    else
    189232    {
    190       $query.= 'id';
    191     }
    192     $query.= '
    193   WHERE id_uppercat ';
    194     if (!is_numeric($id_uppercat))
    195     {
    196       $query.= 'IS NULL';
    197     }
    198     else
    199     {
    200       $query.= '= '.$id_uppercat;
     233      $query.= '
     234  SET uppercats = id
     235  WHERE id_uppercat IS NULL';
    201236    }
    202237    $query.= '
  • trunk/admin/user_perm.php

    r629 r642  
    221221  // category name
    222222  $cat_infos = get_cat_info( $row['id'] );
    223   $name = get_cat_display_name( $cat_infos['name'],' &gt; ',
    224                                 'font-weight:bold;' );
     223  $name = get_cat_display_name($cat_infos['name']);
    225224  $vtp->setVar( $sub, 'category.name', $name );
    226225  // usergroups
  • trunk/admin/user_search.php

    r631 r642  
    103103    $url = PHPWG_ROOT_PATH.'admin.php?page=cat_perm&amp;cat_id='.$row['id'];
    104104    $cat_infos = get_cat_info( $row['id'] );
    105     $template->assign_block_vars('permission.category',array(
    106       'CAT_NAME'=> get_cat_display_name($cat_infos['name'],' &gt; ', 'font-weight:bold;' ),
    107           'CAT_ID'=>$row['id'],
    108           'AUTH_YES'=>!$is_user_allowed?'checked="checked"':'',
    109           'AUTH_NO' =>$is_user_allowed?'checked="checked"':'',
    110           'CAT_URL'=>add_session_id($url)
    111         ));
    112 
     105    $template->assign_block_vars(
     106      'permission.category',
     107      array(
     108        'CAT_NAME'=> get_cat_display_name($cat_infos['name']),
     109        'CAT_ID'=>$row['id'],
     110        'AUTH_YES'=>!$is_user_allowed?'checked="checked"':'',
     111        'AUTH_NO' =>$is_user_allowed?'checked="checked"':'',
     112        'CAT_URL'=>add_session_id($url)
     113        ));
     114   
    113115    // any subcat forbidden for this user ?
    114116    if ( $is_user_allowed == 2 )
  • trunk/admin/waiting.php

    r593 r642  
    114114      PHPWG_ROOT_PATH.get_complete_dir( $row['storage_category_id'] );
    115115    $cat_names[$row['storage_category_id']]['display_name'] =
    116       get_cat_display_name( $cat['name'], ' &gt; ', 'font-weight:bold;' );
     116      get_cat_display_name($cat['name']);
    117117  }
    118118  $preview_url = PHPWG_ROOT_PATH.$cat_names[$row['storage_category_id']]['dir'].$row['file'];
  • trunk/comments.php

    r607 r642  
    153153    $cat_result = get_cat_info($subrow['cat_id']);
    154154    $array_cat_names[$subrow['cat_id']] =
    155       get_cat_display_name($cat_result['name'], ' &gt; ', '');
     155      get_cat_display_name($cat_result['name'], '');
    156156  }
    157157 
  • trunk/include/category_calendar.inc.php

    r612 r642  
    364364elseif (isset($page['calendar_day']))
    365365{
     366  $old_level_separator = $conf['level_separator'];
     367  $conf['level_separator'] = '<br />';
    366368  // for each category of this day, display a random picture
    367369  foreach ($calendar_categories as $calendar_category => $nb_pics)
     
    374376    {
    375377      $cat_infos = get_cat_info( $calendar_category );
    376       $name = get_cat_display_name($cat_infos['name'],'<br />','',false);
     378     
     379      $name = get_cat_display_name($cat_infos['name'],'',false);
    377380      $name = '['.$name.']';
    378381    }
     
    427430    }
    428431  }
     432  $conf['level_separator'] = $old_level_separator;
    429433}
    430434?>
  • trunk/include/category_recent_cats.inc.php

    r610 r642  
    6060}
    6161
     62$old_level_separator = $conf['level_separator'];
     63$conf['level_separator'] = '<br />';
    6264// for each category, we have to search a recent picture to display and
    6365// the name to display
     
    9193  }
    9294}
     95$conf['level_separator'] = $old_level_separator;
    9396?>
  • trunk/include/config.inc.php

    r602 r642  
    7777// top_number : number of element to display for "best rated" and "most
    7878// visited" categories
    79 $conf['top_number'] = 10;
     79$conf['top_number'] = 15;
    8080
    8181// anti-flood_time : number of seconds between 2 comments : 0 to disable
     
    169169$conf['show_gt'] = true;
    170170
    171 // Default options for new categories.
    172 //
    173 // Some options for categories (commentable, uploadable, status, visible)
    174 // must be set directly in the database by changing the corresponding
    175 // default values of the column. Examples :
    176 //
    177 // ALTER TABLE phpwebgallery_categories ALTER visible SET DEFAULT 'true';
    178 // ALTER TABLE phpwebgallery_categories ALTER status SET DEFAULT 'private';
    179 // ALTER TABLE phpwebgallery_categories ALTER uploadable SET DEFAULT 'true';
    180 // ALTER TABLE phpwebgallery_categories ALTER commentable SET DEFAULT 'false';
    181 //
    182 // MySQL default values are used when inserting a row and that no value is
    183 // given for the column. In PhpWebGallery, the above columns are not valued
    184 // during categories insertion, so default values are important.
     171// newcat_default_commentable : at creation, must a category be commentable
     172// or not ?
     173$conf['newcat_default_commentable'] = 'true';
     174
     175// newcat_default_uploadable : at creation, must a category be uploadable or
     176// not ?
     177$conf['newcat_default_uploadable'] = 'true';
     178
     179// newcat_default_visible : at creation, must a category be visible or not ?
     180// Warning : if the parent category is invisible, the category is
     181// automatically create invisible. (invisible = locked)
     182$conf['newcat_default_visible'] = 'true';
     183
     184// newcat_default_status : at creation, must a category be public or private
     185// ? Warning : if the parent category is private, the category is
     186// automatically create private.
     187$conf['newcat_default_status'] = 'public';
     188
     189// level_separator : character string used for separating a category level
     190// to the sub level
     191$conf['level_separator'] = ' / ';
    185192?>
  • trunk/include/functions_category.inc.php

    r641 r642  
    349349      $page['title'] =
    350350        get_cat_display_name($page['cat_name'],
    351                              ' &gt; ',
    352351                             'category.php?cat=',
    353352                             false);
     
    759758    {
    760759      $option = get_cat_display_name_cache($category['uppercats'],
    761                                            ' &rarr; ',
    762760                                           '',
    763761                                           false);
  • trunk/include/functions_html.inc.php

    r614 r642  
    160160 */
    161161function get_cat_display_name($cat_informations,
    162                               $separator,
    163162                              $url = 'category.php?cat=',
    164163                              $replace_space = true)
    165164{
     165  global $conf;
     166 
    166167  $output = '';
    167168  $is_first = true;
     
    174175    else
    175176    {
    176       $output.= $separator;
     177      $output.= $conf['level_separator'];
    177178    }
    178179
     
    206207 *
    207208 * @param string uppercats
    208  * @param string separator
    209209 * @param string url
    210210 * @param boolean replace_space
     
    212212 */
    213213function get_cat_display_name_cache($uppercats,
    214                                     $separator,
    215214                                    $url = 'category.php?cat=',
    216215                                    $replace_space = true)
    217216{
    218   global $cat_names;
     217  global $cat_names, $conf;
    219218
    220219  if (!isset($cat_names))
     
    243242    else
    244243    {
    245       $output.= $separator;
     244      $output.= $conf['level_separator'];
    246245    }
    247246
  • trunk/include/functions_xml.inc.php

    r593 r642  
    5252function getAttribute( $element, $attribute )
    5353{
     54//  echo htmlentities($element).'<br /><br />';
    5455  $regex = '/^<\w+[^>]*'.$attribute.'\s*=\s*"('.VAL_REG.')"/i';
    5556  if ( preg_match( $regex, $element, $out ) ) return $out[1];
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r640 r642  
    352352$lang['represents'] = 'represents';
    353353$lang['doesnt_represent'] = 'doesn\'t represent';
     354$lang['admin_menu_cat_status'] = 'Public / Private';
    354355?>
  • trunk/picture.php

    r639 r642  
    349349      if ( $conf['mail_notification'] )
    350350      {
    351         $cat_name = get_cat_display_name( $page['cat_name'], ' > ', '' );
     351        // locally, we change the $conf['level_separator']
     352        $conf_separator = $conf['level_separator'];
     353        $conf['level_separator'] = ' > ';
     354        $cat_name = get_cat_display_name($page['cat_name'], '');
     355        $conf['level_separator'] = $conf_separator;
     356       
    352357        $cat_name = strip_tags( $cat_name );
    353358        notify( 'comment', $cat_name.' > '.$picture['current']['name']);
     
    390395if (is_numeric( $page['cat'] ))
    391396{
    392   $title_img = replace_space(get_cat_display_name($page['cat_name'],' &gt; '));
     397  $title_img = replace_space(get_cat_display_name($page['cat_name']));
    393398  $n = $page['num'] + 1;
    394399  $title_nb = $n.'/'.$page['cat_nb_images'];
     
    443448  'WIDTH_IMG' => $picture_size[0],
    444449  'HEIGHT_IMG' => $picture_size[1],
     450
     451  'LEVEL_SEPARATOR' => $conf['level_separator'],
    445452
    446453  'L_HOME' => $lang['home'],
     
    769776  if (count($cat_array) > 3)
    770777  {
    771     $cat_output .= get_cat_display_name_cache($category['uppercats'],
    772                                               ' &rarr; ');
     778    $cat_output .= get_cat_display_name_cache($category['uppercats']);
    773779  }
    774780  else
    775781  {
    776782    $cat_info = get_cat_info($category['category_id']);
    777     $cat_output .= get_cat_display_name($cat_info['name'], ' &rarr; ');
     783    $cat_output .= get_cat_display_name($cat_info['name']);
    778784  }
    779785  // the picture is commentable if it belongs at least to one category which
  • trunk/template/default/picture.tpl

    r588 r642  
    33<!-- END information -->
    44<div class="titrePage">
    5   <div id="gauche"><a href="{U_HOME}">{L_HOME}</a> &gt; {CATEGORY}</div>
     5  <div id="gauche"><a href="{U_HOME}">{L_HOME}</a>{LEVEL_SEPARATOR}{CATEGORY}</div>
    66  <div id="centre" class="nameImage">{TITLE}</div>
    77  <div id="droite">{PHOTO}</div>
  • trunk/tools/create_listing_file.php

    r619 r642  
    133133  $value = str_replace(chr(0x00), ' ', $value);
    134134 
    135   return $value;
     135  return htmlentities($value);
    136136}
    137137
  • trunk/upload.php

    r607 r642  
    275275{
    276276  $advise_title = $lang['upload_advise'];
    277   $advise_title.= get_cat_display_name( $page['cat_name'], ' - ' );
     277  $advise_title.= get_cat_display_name($page['cat_name']);
    278278}
    279279
Note: See TracChangeset for help on using the changeset viewer.