| @@ 349-366 (lines=18) @@ | ||
| 346 | $groups = array_diff($groups, $implicitGroups); |
|
| 347 | ||
| 348 | // Don't forget the protected groups. |
|
| 349 | if (!allowedTo('admin_forum') && !$ignoreProtected) |
|
| 350 | { |
|
| 351 | $request = $smcFunc['db_query']('', ' |
|
| 352 | SELECT id_group |
|
| 353 | FROM {db_prefix}membergroups |
|
| 354 | WHERE group_type = {int:is_protected}', |
|
| 355 | array( |
|
| 356 | 'is_protected' => 1, |
|
| 357 | ) |
|
| 358 | ); |
|
| 359 | $protected_groups = array(1); |
|
| 360 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 361 | $protected_groups[] = $row['id_group']; |
|
| 362 | $smcFunc['db_free_result']($request); |
|
| 363 | ||
| 364 | // If you're not an admin yourself, you can't touch protected groups! |
|
| 365 | $groups = array_diff($groups, array_unique($protected_groups)); |
|
| 366 | } |
|
| 367 | ||
| 368 | // Only continue if there are still groups and members left. |
|
| 369 | if (empty($groups) || empty($members)) |
|
| @@ 3060-3076 (lines=17) @@ | ||
| 3057 | global $profile_vars, $old_profile, $context, $smcFunc, $cur_profile; |
|
| 3058 | ||
| 3059 | // Do we need to protect some groups? |
|
| 3060 | if (!allowedTo('admin_forum')) |
|
| 3061 | { |
|
| 3062 | $request = $smcFunc['db_query']('', ' |
|
| 3063 | SELECT id_group |
|
| 3064 | FROM {db_prefix}membergroups |
|
| 3065 | WHERE group_type = {int:is_protected}', |
|
| 3066 | array( |
|
| 3067 | 'is_protected' => 1, |
|
| 3068 | ) |
|
| 3069 | ); |
|
| 3070 | $protected_groups = array(1); |
|
| 3071 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 3072 | $protected_groups[] = $row['id_group']; |
|
| 3073 | $smcFunc['db_free_result']($request); |
|
| 3074 | ||
| 3075 | $protected_groups = array_unique($protected_groups); |
|
| 3076 | } |
|
| 3077 | ||
| 3078 | // The account page allows the change of your id_group - but not to a protected group! |
|
| 3079 | if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) |
|