del_from_group.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2018 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. function exec_ogp_module()
  25. {
  26. global $db;
  27. global $view;
  28. $group_id = $_GET['group_id'];
  29. if ( !$db->isAdmin($_SESSION['user_id']) )
  30. {
  31. $result = $db->getUserGroupList($_SESSION['user_id']);
  32. foreach ( $result as $row ) #loop through the groups
  33. {
  34. if ( $row['group_id'] == $group_id )
  35. {
  36. $own_group = TRUE;
  37. }
  38. }
  39. }
  40. if(!$db->isAdmin($_SESSION['user_id']) && !isset($own_group))
  41. {
  42. echo "<p class='note'>".get_lang('not_available')."</p>";
  43. return;
  44. }
  45. // Delete user from group.
  46. if( isset($_GET['group_id']) && isset($_GET['user_id']) )
  47. {
  48. $group_id = trim($_GET['group_id']);
  49. $user_id = trim($_GET['user_id']);
  50. if ( !$db->delUserFromGroup($user_id, $group_id))
  51. {
  52. print_failure(get_lang_f('could_not_delete_user_from_group', $user_id, $group_id));
  53. $view->refresh("?m=user_admin");
  54. return;
  55. }
  56. echo "<p class='success'>".get_lang_f('successfully_removed_from_group', $user_id, $group_id)."</p>";
  57. $db->logger(get_lang_f('successfully_removed_from_group', $user_id, $group_id));
  58. $view->refresh("?m=user_admin&amp;p=show_groups");
  59. }
  60. }
  61. ?>