Skip to content

Commit

Permalink
bug:2980 Fatal error when renaming a group
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@25119 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
flop25 committed Oct 24, 2013
1 parent 4445af1 commit 06f89b6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions admin/group_list.php
Expand Up @@ -97,13 +97,23 @@

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);
Expand Down

0 comments on commit 06f89b6

Please sign in to comment.