bug:2980 Fatal error when renaming a group
git-svn-id: http://piwigo.org/svn/trunk@25119 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
4445af1217
commit
06f89b68e0
1 changed files with 12 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue