1
0

del_group.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. $y = isset($_GET['y']) ? $_GET['y'] : "";
  46. $group = $db->getGroupById($group_id);
  47. if ( empty($group) )
  48. {
  49. print_failure(get_lang_f('group_with_id_does_not_exist', $group_id));
  50. return;
  51. }
  52. $groupname = $group['group_name'];
  53. if($y !== 'y')
  54. {
  55. echo "<p>".get_lang_f('are_you_sure_you_want_to_delete_group', $groupname)."</p>";
  56. echo "<p><a href=\"?m=user_admin&amp;p=del_group&amp;group_id=$group_id&amp;y=y\">".
  57. get_lang('yes')."</a> <a href=\"?m=user_admin&amp;p=show_groups\">".
  58. get_lang('no')."</a></p>";
  59. return;
  60. }
  61. if( !$db->delGroup($group_id) )
  62. {
  63. print_failure(get_lang_f('unable_to_delete_group', $groupname));
  64. $view->refresh("?m=user_admin&amp;p=show_groups");
  65. return;
  66. }
  67. print_success(get_lang_f('successfully_deleted_group', $groupname));
  68. $db->logger(get_lang_f('successfully_deleted_group', $groupname));
  69. $view->refresh("?m=user_admin&amp;p=show_groups");
  70. };
  71. ?>