Ignore:
Timestamp:
Jun 7, 2013, 2:41:14 PM (11 years ago)
Author:
plg
Message:

New feature: user album. Only for registered users, no recursivity. Piwigo
will automatically create an upload album for each user with appropriate
community permissions, at first connection.

Bug fixed: on activation, do not create a new "Community" album if it already
exists.

Bug fixed: remove debug for quota

Bug fixed: round corners for number of pending pictures in admin menu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/admin_permissions.php

    r23037 r23085  
    5151if (isset($_POST['submit_add']))
    5252{
     53  // echo '<pre>'; print_r($_POST); echo '</pre>';
    5354  if (!in_array($_POST['who'], array_keys($who_options)))
    5455  {
     
    8182  {
    8283    check_input_parameter('storage', $_POST, false, PATTERN_ID);
     84  }
     85
     86  // it is already blocked by Javascript, but an extra check is usefull
     87  if ('any_visitor' == $_POST['who'] and -1 == $_POST['category'])
     88  {
     89    die('hacking attempt: invalid "where" option for this user');
     90  }
     91
     92  if (-1 == $_POST['category'])
     93  {
     94    unset($_POST['recursive']);
     95    unset($_POST['create_subcategories']);
    8396  }
    8497
     
    89102    'user_id' => ('user' == $_POST['who']) ? $_POST['who_user'] : null,
    90103    'category_id' => ($_POST['category'] > 0) ? $_POST['category'] : null,
     104    'user_album' => boolean_to_string(-1 == $_POST['category']),
    91105    'recursive' => isset($_POST['recursive']) ? 'true' : 'false',
    92106    'create_subcategories' => isset($_POST['create_subcategories']) ? 'true' : 'false',
     
    107121    AND group_id '.(isset($insert['group_id']) ? '= '.$insert['group_id'] : 'is null').'
    108122    AND category_id '.(isset($insert['category_id']) ? '= '.$insert['category_id'] : 'is null').'
     123    AND user_album = \''.$insert['user_album'].'\'
    109124;';
    110125  $result = pwg_query($query);
     
    231246        'user_options_selected' => $row['user_id'],
    232247        'group_options_selected' => $row['group_id'],
     248        'whole_gallery_selected' => empty($row['category_id']) and !get_boolean($row['user_album']),
     249        'user_album_selected' => get_boolean($row['user_album']),
    233250        'recursive' => get_boolean($row['recursive']),
    234251        'create_subcategories' => get_boolean($row['create_subcategories']),
     
    244261  $template->assign(
    245262    array(
     263      'whole_gallery_selected' => !$conf['community']['user_albums'],
     264      'user_album_selected' => $conf['community']['user_albums'],
    246265      'moderated' => true,
    247266      'nb_photos' => -1,
     
    310329  array(
    311330    'F_ADD_ACTION' => COMMUNITY_BASE_URL.'-'.$page['tab'],
     331    'community_conf' => $conf['community'],
    312332    )
    313333  );
     
    418438foreach ($permissions as $permission)
    419439{
    420   $where = l10n('The whole gallery');
    421   if (isset($permission['category_id']))
    422   {
    423     $where = $name_of_category[ $permission['category_id'] ];
     440  $where = l10n('User album only');
     441  if (!get_boolean($permission['user_album']))
     442  {
     443    $where = l10n('The whole gallery');
     444    if (isset($permission['category_id']))
     445    {
     446      $where = $name_of_category[ $permission['category_id'] ];
     447    }
    424448  }
    425449
Note: See TracChangeset for help on using the changeset viewer.