Ignore:
Timestamp:
Jun 4, 2013, 12:55:59 PM (11 years ago)
Author:
plg
Message:

manage quota (number of photos, disk usage)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/admin_permissions.php

    r10772 r23037  
    7373  check_input_parameter('moderated', $_POST, false, '/^(true|false)$/');
    7474
     75  if (-1 != $_POST['nb_photos'])
     76  {
     77    check_input_parameter('nb_photos', $_POST, false, PATTERN_ID);
     78  }
     79
     80  if (-1 != $_POST['storage'])
     81  {
     82    check_input_parameter('storage', $_POST, false, PATTERN_ID);
     83  }
     84
    7585  // creating the permission
    7686  $insert = array(
     
    8292    'create_subcategories' => isset($_POST['create_subcategories']) ? 'true' : 'false',
    8393    'moderated' => $_POST['moderated'],
     94    'nb_photos' => $_POST['nb_photos'],
     95    'storage' => $_POST['storage'],
    8496    );
    8597
     
    222234        'create_subcategories' => get_boolean($row['create_subcategories']),
    223235        'moderated' => get_boolean($row['moderated']),
     236        'nb_photos' => empty($row['nb_photos']) ? -1 : $row['nb_photos'],
     237        'storage' => empty($row['storage']) ? -1 : $row['storage'],
    224238        )
    225239      );
     
    231245    array(
    232246      'moderated' => true,
     247      'nb_photos' => -1,
     248      'storage' => -1,
    233249      )
    234250    );
     
    445461    $highlight = true;
    446462  }
    447  
     463
     464  $nb_photos = false;
     465  $nb_photos_tooltip = null;
     466  if (!empty($permission['nb_photos']) and $permission['nb_photos'] > 0)
     467  {
     468    $nb_photos = $permission['nb_photos'];
     469    $nb_photos_tooltip = sprintf(
     470      l10n('up to %d photos (for each user)'),
     471      $nb_photos
     472      );
     473  }
     474
     475  $storage = false;
     476  $storage_tooltip = null;
     477  if (!empty($permission['storage']) and $permission['storage'] > 0)
     478  {
     479    $storage = $permission['storage'];
     480    $storage_tooltip = sprintf(
     481      l10n('up to %dMB (for each user)'),
     482      $storage
     483      );
     484  }
     485
    448486 
    449487  $template->append(
     
    456494      'RECURSIVE' => get_boolean($permission['recursive']),
    457495      'RECURSIVE_TOOLTIP' => l10n('Apply to sub-albums'),
     496      'NB_PHOTOS' => $nb_photos,
     497      'NB_PHOTOS_TOOLTIP' => $nb_photos_tooltip,
     498      'STORAGE' => $storage,
     499      'STORAGE_TOOLTIP' => $storage_tooltip,
    458500      'CREATE_SUBCATEGORIES' => get_boolean($permission['create_subcategories']),
    459501      'U_DELETE' => $admin_base_url.'&delete='.$permission['id'],
Note: See TracChangeset for help on using the changeset viewer.