Changeset 25119


Ignore:
Timestamp:
Oct 24, 2013, 7:48:49 PM (7 years ago)
Author:
flop25
Message:

bug:2980 Fatal error when renaming a group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/group_list.php

    r25018 r25119  
    9898  if ($action=="rename")
    9999  {
     100    // is the group not already existing ?
     101    $query = '
     102SELECT name
     103  FROM '.GROUPS_TABLE.'
     104;';
     105    $group_names = array_from_query($query, 'name');
    100106    foreach($groups as $group)
    101107    {
    102       if ( !empty($_POST['rename_'.$group.'']) )
     108      if (  in_array($_POST['rename_'.$group.''], $group_names))
     109      {
     110        $page['errors'][] = $_POST['rename_'.$group.''].' | '.l10n('This name is already used by another group.');
     111      }
     112      elseif ( !empty($_POST['rename_'.$group.'']))
    103113      {
    104114        $query = '
    105115        UPDATE '.GROUPS_TABLE.'
    106         SET name = \''.$_POST['rename_'.$group.''].'\'
     116        SET name = \''.pwg_db_real_escape_string($_POST['rename_'.$group.'']).'\'
    107117        WHERE id = '.$group.'
    108118      ;';
Note: See TracChangeset for help on using the changeset viewer.