Changeset 657


Ignore:
Timestamp:
Dec 25, 2004, 8:33:36 PM (19 years ago)
Author:
plg
Message:
  • user permissions ask update at each admin page generation. Table user_forbidden must be updated only if current user is not in administrative section
  • bug fixed : category.php, error on page title when non category selected
  • admin/search : bug on variable $PHP_SELF, replaced by $_SERVERPHP_SELF
  • admin/user_perm : inheritence management. When a category become authorized, all parent categories become authorized, when a category become forbidden, all child category become forbidden
  • no more recursivity in delete_categories function
  • new function get_fs_directories for future new method of synchronization
  • new function get_uppercat_ids replacing several pieces of code doing the same
  • new function get_fulldirs used for metadata function get_filelist and future new method of synchronization
  • new function get_fs for future new method of synchronization
  • typo correction on lang item "about_message"
  • no link to category privacy status management on user permission anymore (giving the menu item instead)
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin.php

    r655 r657  
    247247$template->pparse('admin');
    248248include(PHPWG_ROOT_PATH.'include/page_tail.php');
     249// +-----------------------------------------------------------------------+
     250// |                     order permission refreshment                      |
     251// +-----------------------------------------------------------------------+
     252$query = '
     253UPDATE '.USER_FORBIDDEN_TABLE.'
     254  SET need_update = \'true\'
     255;';
     256pwg_query($query);
    249257?>
  • trunk/admin/include/functions.php

    r650 r657  
    200200    return;
    201201  }
     202
     203  // add sub-category ids to the given ids : if a category is deleted, all
     204  // sub-categories must be so
     205  $ids = get_subcat_ids($ids);
    202206 
    203207  // destruction of all the related elements
     
    205209SELECT id
    206210  FROM '.IMAGES_TABLE.'
    207   WHERE storage_category_id IN ('.implode(',', $ids).')
     211  WHERE storage_category_id IN (
     212'.wordwrap(implode(', ', $ids), 80, "\n").')
    208213;';
    209214  $result = pwg_query($query);
     
    218223  $query = '
    219224DELETE FROM '.IMAGE_CATEGORY_TABLE.'
    220   WHERE category_id IN ('.implode(',', $ids).')
     225  WHERE category_id IN (
     226'.wordwrap(implode(', ', $ids), 80, "\n").')
    221227;';
    222228  pwg_query($query);
     
    225231  $query = '
    226232DELETE FROM '.USER_ACCESS_TABLE.'
    227   WHERE cat_id IN ('.implode(',', $ids).')
     233  WHERE cat_id IN (
     234'.wordwrap(implode(', ', $ids), 80, "\n").')
    228235;';
    229236  pwg_query($query);
    230237  $query = '
    231238DELETE FROM '.GROUP_ACCESS_TABLE.'
    232   WHERE cat_id IN ('.implode(',', $ids).')
    233 ;';
    234   pwg_query($query);
    235 
    236   // destruction of the sub-categories
    237   $query = '
    238 SELECT id
    239   FROM '.CATEGORIES_TABLE.'
    240   WHERE id_uppercat IN ('.implode(',', $ids).')
    241 ;';
    242   $result = pwg_query($query);
    243   $subcat_ids = array();
    244   while($row = mysql_fetch_array($result))
    245   {
    246     array_push($subcat_ids, $row['id']);
    247   }
    248   if (count($subcat_ids) > 0)
    249   {
    250     delete_categories($subcat_ids);
    251   }
     239  WHERE cat_id IN (
     240'.wordwrap(implode(', ', $ids), 80, "\n").')
     241;';
     242  pwg_query($query);
    252243
    253244  // destruction of the category
    254245  $query = '
    255246DELETE FROM '.CATEGORIES_TABLE.'
    256   WHERE id IN ('.implode(',', $ids).')
     247  WHERE id IN (
     248'.wordwrap(implode(', ', $ids), 80, "\n").')
    257249;';
    258250  pwg_query($query);
     
    762754  }
    763755  return $sub_dirs;
     756}
     757
     758/**
     759 * returns an array containing sub-directories which can be a category,
     760 * recursive by default
     761 *
     762 * directories nammed "thumbnail", "pwg_high" or "pwg_representative" are
     763 * omitted
     764 *
     765 * @param string $basedir
     766 * @return array
     767 */
     768function get_fs_directories($path, $recursive = true)
     769{
     770  $dirs = array();
     771 
     772  if (is_dir($path))
     773  {
     774    if ($contents = opendir($path))
     775    {
     776      while (($node = readdir($contents)) !== false)
     777      {
     778        if (is_dir($path.'/'.$node)
     779            and $node != '.'
     780            and $node != '..'
     781            and $node != 'thumbnail'
     782            and $node != 'pwg_high'
     783            and $node != 'pwg_representative')
     784        {
     785          array_push($dirs, $path.'/'.$node);
     786          if ($recursive)
     787          {
     788            $dirs = array_merge($dirs, get_fs_directories($path.'/'.$node));
     789          }
     790        }
     791      }
     792    }
     793  }
     794
     795  return $dirs;
    764796}
    765797
     
    10091041  if ($value == 'true')
    10101042  {
    1011     $uppercats = array();
    1012     $query = '
    1013 SELECT uppercats
    1014   FROM '.CATEGORIES_TABLE.'
    1015   WHERE id IN ('.implode(',', $categories).')
    1016 ;';
    1017     $result = pwg_query($query);
    1018     while ($row = mysql_fetch_array($result))
    1019     {
    1020       $uppercats = array_merge($uppercats,
    1021                                explode(',', $row['uppercats']));
    1022     }
    1023     $uppercats = array_unique($uppercats);
    1024      
     1043    $uppercats = get_uppercat_ids($categories);
    10251044    $query = '
    10261045UPDATE '.CATEGORIES_TABLE.'
     
    10601079  if ($value == 'public')
    10611080  {
    1062     $uppercats = array();
    1063     $query = '
    1064 SELECT uppercats
    1065   FROM '.CATEGORIES_TABLE.'
    1066   WHERE id IN ('.implode(',', $categories).')
    1067 ;';
    1068     $result = pwg_query($query);
    1069     while ($row = mysql_fetch_array($result))
    1070     {
    1071       $uppercats = array_merge($uppercats,
    1072                                explode(',', $row['uppercats']));
    1073     }
    1074     $uppercats = array_unique($uppercats);
    1075      
     1081    $uppercats = get_uppercat_ids($categories);
    10761082    $query = '
    10771083UPDATE '.CATEGORIES_TABLE.'
     
    10921098    pwg_query($query);
    10931099  }
     1100}
     1101
     1102/**
     1103 * returns all uppercats category ids of the given category ids
     1104 *
     1105 * @param array cat_ids
     1106 * @return array
     1107 */
     1108function get_uppercat_ids($cat_ids)
     1109{
     1110  if (!is_array($cat_ids) or count($cat_ids) < 1)
     1111  {
     1112    return array();
     1113  }
     1114 
     1115  $uppercats = array();
     1116
     1117  $query = '
     1118SELECT uppercats
     1119  FROM '.CATEGORIES_TABLE.'
     1120  WHERE id IN ('.implode(',', $cat_ids).')
     1121;';
     1122  $result = pwg_query($query);
     1123  while ($row = mysql_fetch_array($result))
     1124  {
     1125    $uppercats = array_merge($uppercats,
     1126                             explode(',', $row['uppercats']));
     1127  }
     1128  $uppercats = array_unique($uppercats);
     1129
     1130  return $uppercats;
    10941131}
    10951132
     
    11581195  mass_updates(CATEGORIES_TABLE, $fields, $datas);
    11591196}
     1197
     1198/**
     1199 * returns the fulldir for each given category id
     1200 *
     1201 * @param array cat_ids
     1202 * @return array
     1203 */
     1204function get_fulldirs($cat_ids)
     1205{
     1206  if (count($cat_ids) == 0)
     1207  {
     1208    return array();
     1209  }
     1210 
     1211  // caching directories of existing categories
     1212  $query = '
     1213SELECT id, dir
     1214  FROM '.CATEGORIES_TABLE.'
     1215  WHERE dir IS NOT NULL
     1216;';
     1217  $result = pwg_query($query);
     1218  $cat_dirs = array();
     1219  while ($row = mysql_fetch_array($result))
     1220  {
     1221    $cat_dirs[$row['id']] = $row['dir'];
     1222  }
     1223
     1224  // filling $uppercats_array : to each category id the uppercats list is
     1225  // associated
     1226  $uppercats_array = array();
     1227 
     1228  $query = '
     1229SELECT id, uppercats
     1230  FROM '.CATEGORIES_TABLE.'
     1231  WHERE id IN (
     1232'.wordwrap(implode(', ', $cat_ids), 80, "\n").')
     1233;';
     1234  $result = pwg_query($query);
     1235  while ($row = mysql_fetch_array($result))
     1236  {
     1237    $uppercats_array[$row['id']] = $row['uppercats'];
     1238  }
     1239 
     1240  $query = '
     1241SELECT galleries_url
     1242  FROM '.SITES_TABLE.'
     1243  WHERE id = 1
     1244';
     1245  $row = mysql_fetch_array(pwg_query($query));
     1246  $basedir = $row['galleries_url'];
     1247 
     1248  // filling $cat_fulldirs
     1249  $cat_fulldirs = array();
     1250  foreach ($uppercats_array as $cat_id => $uppercats)
     1251  {
     1252    $uppercats = str_replace(',', '/', $uppercats);
     1253    $cat_fulldirs[$cat_id] = $basedir.preg_replace('/(\d+)/e',
     1254                                                   "\$cat_dirs['$1']",
     1255                                                   $uppercats);
     1256  }
     1257
     1258  return $cat_fulldirs;
     1259}
     1260
     1261/**
     1262 * returns an array with all file system files according to
     1263 * $conf['file_ext']
     1264 *
     1265 * @param string $path
     1266 * @param bool recursive
     1267 * @return array
     1268 */
     1269function get_fs($path, $recursive = true)
     1270{
     1271  global $conf;
     1272
     1273  // because isset is faster than in_array...
     1274  if (!isset($conf['flip_picture_ext']))
     1275  {
     1276    $conf['flip_picture_ext'] = array_flip($conf['picture_ext']);
     1277  }
     1278  if (!isset($conf['flip_file_ext']))
     1279  {
     1280    $conf['flip_file_ext'] = array_flip($conf['file_ext']);
     1281  }
     1282
     1283  $fs['elements'] = array();
     1284  $fs['thumbnails'] = array();
     1285  $fs['representatives'] = array();
     1286  $subdirs = array();
     1287
     1288  if (is_dir($path))
     1289  {
     1290    if ($contents = opendir($path))
     1291    {
     1292      while (($node = readdir($contents)) !== false)
     1293      {
     1294        if (is_file($path.'/'.$node))
     1295        {
     1296          $extension = get_extension($node);
     1297         
     1298//          if (in_array($extension, $conf['picture_ext']))
     1299          if (isset($conf['flip_picture_ext'][$extension]))
     1300          {
     1301            if (basename($path) == 'thumbnail')
     1302            {
     1303              array_push($fs['thumbnails'], $path.'/'.$node);
     1304            }
     1305            else if (basename($path) == 'pwg_representative')
     1306            {
     1307              array_push($fs['representatives'], $path.'/'.$node);
     1308            }
     1309            else
     1310            {
     1311              array_push($fs['elements'], $path.'/'.$node);
     1312            }
     1313          }
     1314//          else if (in_array($extension, $conf['file_ext']))
     1315          else if (isset($conf['flip_file_ext'][$extension]))
     1316          {
     1317            array_push($fs['elements'], $path.'/'.$node);
     1318          }
     1319        }
     1320        else if (is_dir($path.'/'.$node)
     1321                 and $node != '.'
     1322                 and $node != '..'
     1323                 and $node != 'pwg_high'
     1324                 and $recursive)
     1325        {
     1326          array_push($subdirs, $node);
     1327        }
     1328      }
     1329    }
     1330    closedir($contents);
     1331
     1332    foreach ($subdirs as $subdir)
     1333    {
     1334      $tmp_fs = get_fs($path.'/'.$subdir);
     1335
     1336      $fs['elements']        = array_merge($fs['elements'],
     1337                                           $tmp_fs['elements']);
     1338     
     1339      $fs['thumbnails']      = array_merge($fs['thumbnails'],
     1340                                           $tmp_fs['thumbnails']);
     1341     
     1342      $fs['representatives'] = array_merge($fs['representatives'],
     1343                                           $tmp_fs['representatives']);
     1344    }
     1345  }
     1346  return $fs;
     1347}
    11601348?>
  • trunk/admin/include/functions_metadata.php

    r625 r657  
    133133function get_filelist($category_id = '', $recursive = false, $only_new = false)
    134134{
    135   $files = array();
    136 
    137   $query = '
    138 SELECT id, dir
    139   FROM '.CATEGORIES_TABLE.'
    140   WHERE dir IS NOT NULL
    141 ;';
    142   $result = pwg_query($query);
    143   $cat_dirs = array();
    144   while ($row = mysql_fetch_array($result))
    145   {
    146     $cat_dirs[$row['id']] = $row['dir'];
    147   }
    148 
    149   // filling $uppercats_array : to each category id the uppercats list is
    150   // associated
    151   $uppercats_array = array();
     135  // filling $cat_ids : all categories required
     136  $cat_ids = array();
    152137 
    153138  $query = '
    154 SELECT id, uppercats
     139SELECT id
    155140  FROM '.CATEGORIES_TABLE.'
    156141  WHERE site_id = 1
     
    176161  while ($row = mysql_fetch_array($result))
    177162  {
    178     $uppercats_array[$row['id']] =  $row['uppercats'];
     163    array_push($cat_ids, $row['id']);
    179164  }
    180165
    181   if (count($uppercats_array) == 0)
     166  if (count($cat_ids) == 0)
    182167  {
    183168    return array();
    184169  }
    185170
    186   $query = '
    187 SELECT galleries_url
    188   FROM '.SITES_TABLE.'
    189   WHERE id = 1
    190 ';
    191   $row = mysql_fetch_array(pwg_query($query));
    192   $basedir = $row['galleries_url'];
    193  
    194   // filling $cat_fulldirs
    195   $cat_fulldirs = array();
    196   foreach ($uppercats_array as $cat_id => $uppercats)
    197   {
    198     $uppercats = str_replace(',', '/', $uppercats);
    199     $cat_fulldirs[$cat_id] = $basedir.preg_replace('/(\d+)/e',
    200                                                    "\$cat_dirs['$1']",
    201                                                    $uppercats);
    202   }
     171  $files = array();
    203172
    204173  $query = '
    205 SELECT id, file, storage_category_id
     174SELECT id, path
    206175  FROM '.IMAGES_TABLE.'
    207   WHERE storage_category_id IN ('.implode(','
    208                                           ,array_keys($uppercats_array)).')';
     176  WHERE storage_category_id IN ('.implode(',', $cat_ids).')';
    209177  if ($only_new)
    210178  {
     
    218186  while ($row = mysql_fetch_array($result))
    219187  {
    220     $files[$row['id']]
    221       = $cat_fulldirs[$row['storage_category_id']].'/'.$row['file'];
     188    $files[$row['id']] = $row['path'];
    222189  }
    223190 
  • trunk/admin/search.php

    r631 r657  
    4545  'L_CLOSE_WINDOW'=>$lang['Close'],
    4646
    47   'F_SEARCH_ACTION' => add_session_id($PHP_SELF),
     47  'F_SEARCH_ACTION' => add_session_id($_SERVER['PHP_SELF']),
    4848  ));
    4949
  • trunk/admin/user_perm.php

    r655 r657  
    2626// +-----------------------------------------------------------------------+
    2727
    28 if( !defined("IN_ADMIN") )
     28if (!defined('IN_ADMIN'))
    2929{
    30   die ("Hacking attempt!");
     30  die('Hacking attempt!');
    3131}
    32 include_once( PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php' );
     32include_once(PHPWG_ROOT_PATH.'admin/include/isadmin.inc.php');
    3333
    3434$userdata = array();
    35 if ( isset( $_POST['submituser'] ) )
     35if (isset($_POST['submituser']))
    3636{
    3737  $userdata = getuserdata($_POST['username']);
    3838}
    39 elseif (isset($_POST['falsify']) || isset($_POST['trueify']))
     39else if (isset($_POST['falsify'])
     40         and isset($_POST['cat_true'])
     41         and count($_POST['cat_true']) > 0)
    4042{
    4143  $userdata = getuserdata(intval($_POST['userid']));
    42   // cleaning the user_access table for this user
    43   if (isset($_POST['cat_true']) && count($_POST['cat_true']) > 0)
     44  // if you forbid access to a category, all sub-categories become
     45  // automatically forbidden
     46  $subcats = get_subcat_ids($_POST['cat_true']);
     47  $query = '
     48DELETE FROM '.USER_ACCESS_TABLE.'
     49  WHERE user_id = '.$userdata['id'].'
     50    AND cat_id IN ('.implode(',', $subcats).')
     51;';
     52  pwg_query($query);
     53}
     54else if (isset($_POST['trueify'])
     55         and isset($_POST['cat_false'])
     56         and count($_POST['cat_false']) > 0)
     57{
     58  $userdata = getuserdata(intval($_POST['userid']));
     59   
     60  $uppercats = get_uppercat_ids($_POST['cat_false']);
     61  $private_uppercats = array();
     62
     63  $query = '
     64SELECT id
     65  FROM '.CATEGORIES_TABLE.'
     66  WHERE id IN ('.implode(',', $uppercats).')
     67    AND status = \'private\'
     68;';
     69  $result = pwg_query($query);
     70  while ($row = mysql_fetch_array($result))
    4471  {
    45     foreach ($_POST['cat_true'] as $auth_cat)
    46         {
    47           $query = 'DELETE FROM '.USER_ACCESS_TABLE;
    48       $query.= ' WHERE user_id = '.$userdata['id'];
    49       $query.= ' AND cat_id='.$auth_cat.';';
    50       pwg_query ( $query );
    51         }
     72    array_push($private_uppercats, $row['id']);
     73  }
     74
     75  // retrying to authorize a category which is already authorized may cause
     76  // an error (in SQL statement), so we need to know which categories are
     77  // accesible
     78  $authorized_ids = array();
     79   
     80  $query = '
     81SELECT cat_id
     82  FROM '.USER_ACCESS_TABLE.'
     83  WHERE user_id = '.$userdata['id'].'
     84;';
     85  $result = pwg_query($query);
     86 
     87  while ($row = mysql_fetch_array($result))
     88  {
     89    array_push($authorized_ids, $row['cat_id']);
    5290  }
    5391 
    54   if (isset($_POST['cat_false']) && count($_POST['cat_false']) > 0)
     92  $inserts = array();
     93  $to_autorize_ids = array_diff($private_uppercats, $authorized_ids);
     94  foreach ($to_autorize_ids as $to_autorize_id)
    5595  {
    56     foreach ($_POST['cat_false'] as $auth_cat)
    57         {
    58           $query = 'INSERT INTO '.USER_ACCESS_TABLE;
    59       $query.= ' (user_id,cat_id) VALUES';
    60       $query.= ' ('.$userdata['id'].','.$auth_cat.')';
    61       $query.= ';';
    62       pwg_query ( $query );
    63         }
     96    array_push($inserts, array('user_id' => $userdata['id'],
     97                               'cat_id' => $to_autorize_id));
    6498  }
     99
     100  mass_inserts(USER_ACCESS_TABLE, array('user_id','cat_id'), $inserts);
    65101}
     102//----------------------------------------------------- template initialization
     103if (empty($userdata))
     104{
     105  $template->set_filenames(array('user' => 'admin/user_perm.tpl'));
    66106
    67 //----------------------------------------------------- template initialization
    68 
    69 if ( empty($userdata))
    70 {
    71   $template->set_filenames( array('user'=>'admin/user_perm.tpl') );
     107  $base_url = PHPWG_ROOT_PATH.'admin.php?page=';
     108 
    72109  $template->assign_vars(array(
    73110    'L_SELECT_USERNAME'=>$lang['Select_username'],
     
    77114    'L_SUBMIT'=>$lang['submit'],
    78115
    79     'F_SEARCH_USER_ACTION' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_perm'),
     116    'F_SEARCH_USER_ACTION' => add_session_id($base_url.'user_perm'),
    80117    'U_SEARCH_USER' => add_session_id(PHPWG_ROOT_PATH.'admin/search.php')
    81118    ));
     
    83120else
    84121{
    85   $cat_url = '<a href="'.add_session_id(PHPWG_ROOT_PATH.'admin.php?page=cat_options&section=status');
    86   $cat_url .= '">'.$lang['permuser_info_link'].'</a>';
    87   $template->set_filenames( array('user'=>'admin/cat_options.tpl') );
    88   $template->assign_vars(array(
    89     'L_RESET'=>$lang['reset'],
    90     'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
    91     'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
    92     'L_CAT_OPTIONS_INFO'=>$lang['permuser_info'].'&nbsp;'.$cat_url,
    93        
    94         'HIDDEN_NAME'=> 'userid',
    95         'HIDDEN_VALUE'=>$userdata['id'],
    96     'F_ACTION' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_perm'),
    97     ));
    98 
     122  $template->set_filenames(array('user'=>'admin/cat_options.tpl'));
     123  $template->assign_vars(
     124    array(
     125      'L_RESET'=>$lang['reset'],
     126      'L_CAT_OPTIONS_TRUE'=>$lang['authorized'],
     127      'L_CAT_OPTIONS_FALSE'=>$lang['forbidden'],
     128      'L_CAT_OPTIONS_INFO'=>$lang['permuser_info'],
     129     
     130      'HIDDEN_NAME'=> 'userid',
     131      'HIDDEN_VALUE'=>$userdata['id'],
     132      'F_ACTION' => add_session_id(PHPWG_ROOT_PATH.'admin.php?page=user_perm'),
     133      ));
    99134
    100135  // only private categories are listed
    101   $query_true = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE;
    102   $query_true.= ' LEFT JOIN '.USER_ACCESS_TABLE.' as u';
    103   $query_true.= ' ON u.cat_id=id';
    104   $query_true.= ' WHERE status = \'private\' AND u.user_id='.$userdata['id'].';';
     136  $query_true = '
     137SELECT id,name,uppercats,global_rank
     138  FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_ACCESS_TABLE.' ON cat_id = id
     139  WHERE status = \'private\'
     140    AND user_id = '.$userdata['id'].'
     141;';
     142  display_select_cat_wrapper($query_true,array(),'category_option_true');
     143 
    105144  $result = pwg_query($query_true);
    106   $categorie_true = array();
    107   while (!empty($result) && $row = mysql_fetch_array($result))
     145  $authorized_ids = array();
     146  while ($row = mysql_fetch_array($result))
    108147  {
    109     array_push($categorie_true, $row);
     148    array_push($authorized_ids, $row['id']);
    110149  }
    111150 
    112   $query = 'SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE;
    113   $query.= ' WHERE status = \'private\'';
    114   $result = pwg_query($query);
    115   $categorie_false = array();
    116   while ($row = mysql_fetch_array($result))
     151  $query_false = '
     152SELECT id,name,uppercats,global_rank
     153  FROM '.CATEGORIES_TABLE.'
     154  WHERE status = \'private\'';
     155  if (count($authorized_ids) > 0)
    117156  {
    118     if (!in_array($row,$categorie_true))
    119           array_push($categorie_false, $row);
     157    $query_false.= '
     158    AND id NOT IN ('.implode(',', $authorized_ids).')';
    120159  }
    121   usort($categorie_true, 'global_rank_compare');
    122   usort($categorie_false, 'global_rank_compare');
    123   display_select_categories($categorie_true, array(), 'category_option_true', true);
    124   display_select_categories($categorie_false, array(), 'category_option_false', true);
     160  $query_false.= '
     161;';
     162  display_select_cat_wrapper($query_false,array(),'category_option_false');
    125163}
    126 
    127164//----------------------------------------------------------- sending html code
    128165$template->assign_var_from_handle('ADMIN_CONTENT', 'user');
  • trunk/category.php

    r654 r657  
    103103$template->set_filenames( array('category'=>'category.tpl') );
    104104//-------------------------------------------------------------- category title
    105 if ( !isset( $page['title'] ) )
    106 {
    107   $page['title'] = $lang['no_category'];
    108 }
    109 $template_title = get_cat_display_name($page['cat_name'],
    110                              'category.php?cat=',
    111                              false);;
     105if (!isset($page['cat']))
     106{
     107  $template_title = $lang['no_category'];
     108}
     109else
     110{
     111  $template_title = get_cat_display_name($page['cat_name'],
     112                                         'category.php?cat=',
     113                                         false);
     114}
     115
    112116if ( isset( $page['cat_nb_images'] ) and $page['cat_nb_images'] > 0 )
    113117{
  • trunk/include/functions_category.inc.php

    r655 r657  
    715715  else
    716716  {
    717     $page['title'] = $lang['diapo_default_page_title'];
     717    $page['title'] = $lang['no_category'];
    718718  }
    719719  pwg_debug( 'end initialize_category' );
     
    764764  if (!empty($result))
    765765  {
    766   while ($row = mysql_fetch_array($result))
    767   {
    768     array_push($categories, $row);
    769   }
     766    while ($row = mysql_fetch_array($result))
     767    {
     768      array_push($categories, $row);
     769    }
    770770  }
    771771  usort($categories, 'global_rank_compare');
  • trunk/include/user.inc.php

    r653 r657  
    121121
    122122// if no information were found about user in user_forbidden table OR the
    123 // forbidden categories must be updated
    124 if (!isset($user['need_update'])
    125     or !is_bool($user['need_update'])
    126     or $user['need_update'] == true)
     123// forbidden categories must be updated : only if current user is in public
     124// part
     125if (!defined('IN_ADMIN') or !IN_ADMIN)
    127126{
    128   $user['forbidden_categories'] = calculate_permissions($user['id']);
     127  if (!isset($user['need_update'])
     128      or !is_bool($user['need_update'])
     129      or $user['need_update'] == true)
     130  {
     131    $user['forbidden_categories'] = calculate_permissions($user['id']);
     132  }
    129133}
    130134
  • trunk/language/en_UK.iso-8859-1/admin.lang.php

    r655 r657  
    303303$lang['user_delete_hint'] = 'Click here to delete this user. Warning! This operation cannot be undone!';
    304304$lang['permuser_only_private'] = 'Only private categories are shown';
     305$lang['permuser_info'] = 'Only private categories are listed. Private/Public category status can be set in screen "Categories &gt; Public / Private"';
    305306
    306307// Groups
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r653 r657  
    223223$lang['about_message'] = '<div style="text-align:center;font-weigh:bold;">Information about PhpWebGallery</div>
    224224<ul>
    225   <li>This website uses the version '.PHPWG_VERSION.' of "<a href="htt://www.phpwebgallery.net" style="text-decoration:underline">PhpWebGallery</a>. PhpWebGallery is a web application giving you the possibility to create an online images gallery easily.</li>
     225  <li>This website uses the version '.PHPWG_VERSION.' of <a href="htt://www.phpwebgallery.net" style="text-decoration:underline">PhpWebGallery</a>. PhpWebGallery is a web application giving you the possibility to create an online images gallery easily.</li>
    226226  <li>Technicaly, PhpWebGallery is fully developped with PHP (the elePHPant) with a MySQL database (the SQuirreL).</li>
    227227  <li>If you have any suggestions or comments, please visit <a href="http://www.phpwebgallery.net" style="text-decoration:underline">PhpWebGallery</a> official site, and its dedicated <a href="http://forum.phpwebgallery.net" style="text-decoration:underline">forum</a>.</li>
  • trunk/language/fr_FR.iso-8859-1/admin.lang.php

    r655 r657  
    307307$lang['user_delete'] = 'Supprimer l\'utilisateur';
    308308$lang['user_delete_hint'] = 'Cliquez ici pour supprimer définitivement l\'utilisateur. Attention cette opération ne pourra être rétablie.';
    309 $lang['permuser_info'] = 'Seules les catégories déclarées en privée sont affichées. Cliquez ici pour y accéder : ';
    310 $lang['permuser_info_link'] = 'Sécurité des catégories';
     309$lang['permuser_info'] = 'Seules les catégories déclarées en privée sont affichées. Le status privé/public des catégories est configurable dans l\'écran "Catégories &gt; Sécurité" de l\'administration.';
    311310$lang['permuser_only_private'] = 'Seules les catégories privées sont représentées';
    312311
Note: See TracChangeset for help on using the changeset viewer.