Changeset 25147 for branches


Ignore:
Timestamp:
Oct 25, 2013, 7:38:16 PM (7 years ago)
Author:
flop25
Message:

merge r25119 from trunk to branch 2.5

bug:2980 Fatal error when renaming a group

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.5/admin/group_list.php

    r20740 r25147  
    101101  if ($action=="rename")
    102102  {
     103    // is the group not already existing ?
     104    $query = '
     105SELECT name
     106  FROM '.GROUPS_TABLE.'
     107;';
     108    $group_names = array_from_query($query, 'name');
    103109    foreach($groups as $group)
    104110    {
    105       if ( !empty($_POST['rename_'.$group.'']) )
     111      if (  in_array($_POST['rename_'.$group.''], $group_names))
     112      {
     113        $page['errors'][] = $_POST['rename_'.$group.''].' | '.l10n('This name is already used by another group.');
     114      }
     115      elseif ( !empty($_POST['rename_'.$group.'']))
    106116      {
    107117        $query = '
    108118        UPDATE '.GROUPS_TABLE.'
    109         SET name = \''.$_POST['rename_'.$group.''].'\'
     119        SET name = \''.pwg_db_real_escape_string($_POST['rename_'.$group.'']).'\'
    110120        WHERE id = '.$group.'
    111121      ;';
Note: See TracChangeset for help on using the changeset viewer.