diff options
author | flop25 <flop25@piwigo.org> | 2013-10-24 17:48:49 +0000 |
---|---|---|
committer | flop25 <flop25@piwigo.org> | 2013-10-24 17:48:49 +0000 |
commit | 06f89b68e0b55b09feb28d5add4eefaa87a80e57 (patch) | |
tree | 8477750a22a341cd49dfaf964abdf1581f096850 /admin | |
parent | 4445af121701cedb3e9050b43ae2f769ddc0e01d (diff) |
bug:2980 Fatal error when renaming a group
git-svn-id: http://piwigo.org/svn/trunk@25119 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/group_list.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/admin/group_list.php b/admin/group_list.php index 6232c5b00..15a98fa83 100644 --- a/admin/group_list.php +++ b/admin/group_list.php @@ -97,13 +97,23 @@ if (isset($_POST['submit']) and isset($_POST['selectAction']) and isset($_POST[' if ($action=="rename") { + // is the group not already existing ? + $query = ' +SELECT name + FROM '.GROUPS_TABLE.' +;'; + $group_names = array_from_query($query, 'name'); foreach($groups as $group) { - if ( !empty($_POST['rename_'.$group.'']) ) + if ( in_array($_POST['rename_'.$group.''], $group_names)) + { + $page['errors'][] = $_POST['rename_'.$group.''].' | '.l10n('This name is already used by another group.'); + } + elseif ( !empty($_POST['rename_'.$group.''])) { $query = ' UPDATE '.GROUPS_TABLE.' - SET name = \''.$_POST['rename_'.$group.''].'\' + SET name = \''.pwg_db_real_escape_string($_POST['rename_'.$group.'']).'\' WHERE id = '.$group.' ;'; pwg_query($query); |