aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflop25 <flop25@piwigo.org>2013-10-25 17:38:16 +0000
committerflop25 <flop25@piwigo.org>2013-10-25 17:38:16 +0000
commit177dd74115df11cb4f197175e41c817a271929c7 (patch)
tree282d739fd24b5a6386e7062e2f1956be3ea9254b
parentde7b731f3edc8083e7f180d2a18dd100bd6b1168 (diff)
merge r25119 from trunk to branch 2.5
bug:2980 Fatal error when renaming a group git-svn-id: http://piwigo.org/svn/branches/2.5@25147 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--admin/group_list.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/admin/group_list.php b/admin/group_list.php
index 390107613..827b48816 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -100,13 +100,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);