| @@ 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)) |
|
| @@ 3144-3160 (lines=17) @@ | ||
| 3141 | global $profile_vars, $old_profile, $context, $smcFunc, $cur_profile; |
|
| 3142 | ||
| 3143 | // Do we need to protect some groups? |
|
| 3144 | if (!allowedTo('admin_forum')) |
|
| 3145 | { |
|
| 3146 | $request = $smcFunc['db_query']('', ' |
|
| 3147 | SELECT id_group |
|
| 3148 | FROM {db_prefix}membergroups |
|
| 3149 | WHERE group_type = {int:is_protected}', |
|
| 3150 | array( |
|
| 3151 | 'is_protected' => 1, |
|
| 3152 | ) |
|
| 3153 | ); |
|
| 3154 | $protected_groups = array(1); |
|
| 3155 | while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
| 3156 | $protected_groups[] = $row['id_group']; |
|
| 3157 | $smcFunc['db_free_result']($request); |
|
| 3158 | ||
| 3159 | $protected_groups = array_unique($protected_groups); |
|
| 3160 | } |
|
| 3161 | ||
| 3162 | // The account page allows the change of your id_group - but not to a protected group! |
|
| 3163 | if (empty($protected_groups) || count(array_intersect(array((int) $value, $old_profile['id_group']), $protected_groups)) == 0) |
|