aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2007-09-11 02:24:51 +0000
committerrvelices <rv-github@modusoptimus.com>2007-09-11 02:24:51 +0000
commit92f80e5d799aa7fef5f00cbf5c27e32f92c4b2ea (patch)
treecbde0a4b03ea5733bf71ce1db3c8ec993825c38e /admin
parent45fde2cc6b34d3acdfd43b487eb4b7dbeede05a8 (diff)
feature 731: permissions at image level
- this is the first version - I wait for feedback before changing help files git-svn-id: http://piwigo.org/svn/trunk@2084 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/element_set_global.php33
-rw-r--r--admin/user_list.php35
2 files changed, 57 insertions, 11 deletions
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index b3f254b10..6cb0aab39 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -136,7 +136,7 @@ DELETE
$datas = array();
$dbfields = array('primary' => array('id'), 'update' => array());
- $formfields = array('author', 'name', 'date_creation');
+ $formfields = array('author', 'name', 'date_creation', 'level');
foreach ($formfields as $formfield)
{
if ($_POST[$formfield.'_action'] != 'leave')
@@ -163,7 +163,6 @@ SELECT id
if ('set' == $_POST['author_action'])
{
$data['author'] = $_POST['author'];
-
if ('' == $data['author'])
{
unset($data['author']);
@@ -173,7 +172,6 @@ SELECT id
if ('set' == $_POST['name_action'])
{
$data['name'] = $_POST['name'];
-
if ('' == $data['name'])
{
unset($data['name']);
@@ -189,6 +187,11 @@ SELECT id
;
}
+ if ('set' == $_POST['level_action'])
+ {
+ $data['level'] = $_POST['level'];
+ }
+
array_push($datas, $data);
}
// echo '<pre>'; print_r($datas); echo '</pre>';
@@ -345,6 +348,18 @@ else
}
$template->assign_vars(array('DATE_CREATION_YEAR_VALUE'=>$year));
+// image level options
+$blockname = 'level_option';
+foreach ($conf['available_permission_levels'] as $level)
+{
+ $template->assign_block_vars(
+ $blockname,
+ array(
+ 'VALUE' => $level,
+ 'CONTENT' => l10n( sprintf('Level %d', $level) ),
+ ));
+}
+
// +-----------------------------------------------------------------------+
// | global mode thumbnails |
// +-----------------------------------------------------------------------+
@@ -377,7 +392,7 @@ if (count($page['cat_elements_id']) > 0)
$template->assign_vars(array('NAV_BAR' => $nav_bar));
$query = '
-SELECT id,path,tn_ext,file,filesize
+SELECT id,path,tn_ext,file,filesize,level
FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $page['cat_elements_id']).')
'.$conf['order_by'].'
@@ -405,6 +420,16 @@ SELECT id,path,tn_ext,file,filesize
'TITLE' => get_thumbnail_title($row)
)
);
+
+ if ( $row['level']>0 )
+ {
+ $template->assign_block_vars('thumbnails.thumbnail.level',
+ array(
+ 'LEVEL' => $row['level'],
+ 'TITLE' => l10n( sprintf('Level %d', $row['level']) ),
+ )
+ );
+ }
}
}
diff --git a/admin/user_list.php b/admin/user_list.php
index 1c7a752d4..8e3e06d65 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -97,7 +97,8 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
u.'.$conf['user_fields']['email'].' AS email,
ui.status,
ui.adviser,
- ui.enabled_high
+ ui.enabled_high,
+ ui.level
FROM '.USERS_TABLE.' AS u
INNER JOIN '.USER_INFOS_TABLE.' AS ui
ON u.'.$conf['user_fields']['id'].' = ui.user_id
@@ -256,7 +257,7 @@ if (isset($_POST['delete']) and count($collection) > 0)
{
array_push($page['errors'], l10n('Guest cannot be deleted'));
}
- if (($conf['guest_id'] != $conf['default_user_id']) and
+ if (($conf['guest_id'] != $conf['default_user_id']) and
in_array($conf['default_user_id'], $collection))
{
array_push($page['errors'], l10n('Default user cannot be deleted'));
@@ -351,9 +352,10 @@ DELETE FROM '.USER_GROUP_TABLE.'
$formfields =
array('nb_image_line', 'nb_line_page', 'template', 'language',
'recent_period', 'maxwidth', 'expand', 'show_nb_comments',
- 'show_nb_hits', 'maxheight', 'status', 'enabled_high');
+ 'show_nb_hits', 'maxheight', 'status', 'enabled_high',
+ 'level');
- $true_false_fields = array('expand', 'show_nb_comments',
+ $true_false_fields = array('expand', 'show_nb_comments',
'show_nb_hits', 'enabled_high');
if ($conf['allow_adviser'])
{
@@ -756,6 +758,19 @@ foreach ($groups as $group_id => $group_name)
));
}
+// user level options
+$blockname = 'level_option';
+foreach ($conf['available_permission_levels'] as $level)
+{
+ $template->assign_block_vars(
+ $blockname,
+ array(
+ 'VALUE' => $level,
+ 'CONTENT' => l10n( sprintf('Level %d', $level) ),
+ 'SELECTED' => $level==$default_user['level'] ? 'selected="selected"' : '',
+ ));
+}
+
// +-----------------------------------------------------------------------+
// | navigation bar |
// +-----------------------------------------------------------------------+
@@ -818,6 +833,13 @@ foreach ($visible_user_list as $num => $local_user)
$checked = '';
}
+ $properties = array();
+ $properties[] =
+ (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
+ ? $lang['is_high_enabled'] : $lang['is_high_disabled'];
+
+ $properties[] = l10n( sprintf('Level %d', $local_user['level']) );
+
$template->assign_block_vars(
'user',
array(
@@ -836,9 +858,8 @@ foreach ($visible_user_list as $num => $local_user)
? '<BR />['.l10n('adviser').']' : ''),
'EMAIL' => get_email_address_as_display_text($local_user['email']),
'GROUPS' => $groups_string,
- 'PROPERTIES' =>
- (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
- ? $lang['is_high_enabled'] : $lang['is_high_disabled']
+ 'PROPERTIES' => implode( ',', $properties),
+
)
);
trigger_action('loc_assign_block_var_local_user_list', $local_user);