diff options
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r-- | phpBB/includes/functions_user.php | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 8f9c9198f4..2a38010f2b 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2594,13 +2594,16 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $error[] = $user->lang['GROUP_ERR_TYPE']; } + $group_teampage = !empty($group_attributes['group_teampage']); + unset($group_attributes['group_teampage']); + if (!sizeof($error)) { - $current_legend = phpbb_group_positions::GROUP_DISABLED; - $current_teampage = phpbb_group_positions::GROUP_DISABLED; + $current_legend = phpbb_groupposition_legend::GROUP_DISABLED; + $current_teampage = phpbb_groupposition_teampage::GROUP_DISABLED; - $legend = new phpbb_group_positions($db, 'legend'); - $teampage = new phpbb_group_positions($db, 'teampage'); + $legend = new phpbb_groupposition_legend($db, $user, ''); + $teampage = new phpbb_groupposition_teampage($db, $user, ''); if ($group_id) { $current_legend = $legend->get_group_value($group_id); @@ -2609,7 +2612,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (!empty($group_attributes['group_legend'])) { - if (($group_id && ($current_legend == phpbb_group_positions::GROUP_DISABLED)) || !$group_id) + if (($group_id && ($current_legend == phpbb_groupposition_legend::GROUP_DISABLED)) || !$group_id) { // Old group currently not in the legend or new group, add at the end. $group_attributes['group_legend'] = 1 + $legend->get_group_count(); @@ -2620,44 +2623,19 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $group_attributes['group_legend'] = $current_legend; } } - else if ($group_id && ($current_legend > phpbb_group_positions::GROUP_DISABLED)) + else if ($group_id && ($current_legend > phpbb_groupposition_legend::GROUP_DISABLED)) { // Group is removed from the legend $legend->delete_group($group_id, true); - $group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED; - } - else - { - $group_attributes['group_legend'] = phpbb_group_positions::GROUP_DISABLED; - } - - if (!empty($group_attributes['group_teampage'])) - { - if (($group_id && ($current_teampage == phpbb_group_positions::GROUP_DISABLED)) || !$group_id) - { - // Old group currently not on the teampage or new group, add at the end. - $group_attributes['group_teampage'] = 1 + $teampage->get_group_count(); - } - else - { - // Group stayes on the teampage - $group_attributes['group_teampage'] = $current_teampage; - } - } - else if ($group_id && ($current_teampage > phpbb_group_positions::GROUP_DISABLED)) - { - // Group is removed from the teampage - $teampage->delete_group($group_id, true); - $group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED; + $group_attributes['group_legend'] = phpbb_groupposition_legend::GROUP_DISABLED; } else { - $group_attributes['group_teampage'] = phpbb_group_positions::GROUP_DISABLED; + $group_attributes['group_legend'] = phpbb_groupposition_legend::GROUP_DISABLED; } // Unset the objects, we don't need them anymore. unset($legend); - unset($teampage); $user_ary = array(); $sql_ary = array( @@ -2761,6 +2739,19 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow } } + if ($group_teampage) + { + if ($current_teampage == phpbb_groupposition_teampage::GROUP_DISABLED) + { + $teampage->add_group($group_id); + } + } + else if ($group_id && ($current_teampage > phpbb_groupposition_teampage::GROUP_DISABLED)) + { + $teampage->delete_group($group_id); + } + unset($teampage); + // Set user attributes $sql_ary = array(); if (sizeof($group_attributes)) @@ -2842,7 +2833,7 @@ function avatar_remove_db($avatar_name) */ function group_delete($group_id, $group_name = false) { - global $db, $phpbb_root_path, $phpEx, $phpbb_dispatcher; + global $db, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher; if (!$group_name) { @@ -2884,10 +2875,11 @@ function group_delete($group_id, $group_name = false) while ($start); // Delete group from legend and teampage - $legend = new phpbb_group_positions($db, 'legend'); + $legend = new phpbb_groupposition_legend($db, $user, ''); $legend->delete_group($group_id); unset($legend); - $teampage = new phpbb_group_positions($db, 'teampage'); + + $teampage = new phpbb_groupposition_teampage($db, $user, ''); $teampage->delete_group($group_id); unset($teampage); |