user_addons.php 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2017 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. global $db;
  26. $home_id = $_GET['home_id'];
  27. $mod_id = $_GET['mod_id'];
  28. $ip = $_GET['ip'];
  29. $port = $_GET['port'];
  30. $user_id = $_SESSION['user_id'];
  31. // Check if user has some games.
  32. $isAdmin = $db->isAdmin( $user_id );
  33. if($isAdmin)
  34. $home_info = $db->getGameHome($home_id);
  35. else
  36. $home_info = $db->getUserGameHome($user_id,$home_id);
  37. if ($home_info)
  38. {
  39. $home_cfg_id = $home_info['home_cfg_id'];
  40. echo "<h2>".get_lang('user_addons').": ".htmlentities($home_info['home_name'])."</h2>\n".
  41. "<table class='center' >\n".
  42. "<tr><td>\n";
  43. $plugins = $db->resultQuery("SELECT DISTINCT addon_id, name, game_name ".
  44. "FROM OGP_DB_PREFIXaddons ".
  45. "NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
  46. "WHERE addon_type='plugin' ".
  47. "AND home_cfg_id=".$home_cfg_id);
  48. $plugins_qty = count($plugins);
  49. if($plugins and $plugins_qty >= 1)
  50. echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
  51. "&amp;mod_id=".$mod_id."&amp;addon_type=plugin&amp;ip=".$ip.
  52. "&amp;port=".$port."'>".get_lang('install_plugin')."(".$plugins_qty.")</a>\n";
  53. $mappacks = $db->resultQuery("SELECT DISTINCT addon_id, name, game_name ".
  54. "FROM OGP_DB_PREFIXaddons ".
  55. "NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
  56. "WHERE addon_type='mappack' ".
  57. "AND home_cfg_id=".$home_cfg_id);
  58. $mappacks_qty = count($mappacks);
  59. if($mappacks and $mappacks_qty >= 1){
  60. echo "</td><td>";
  61. echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
  62. "&amp;mod_id=".$mod_id."&amp;addon_type=mappack&amp;ip=".$ip.
  63. "&amp;port=".$port."'>".get_lang('install_mappack')."(".$mappacks_qty.")</a>\n";
  64. }
  65. $configs = $db->resultQuery("SELECT DISTINCT addon_id, name, game_name ".
  66. "FROM OGP_DB_PREFIXaddons ".
  67. "NATURAL JOIN OGP_DB_PREFIXconfig_homes ".
  68. "WHERE addon_type='config' ".
  69. "AND home_cfg_id=".$home_cfg_id);
  70. $configs_qty = count($configs);
  71. if($configs and $configs_qty >= 1){
  72. echo "</td><td>";
  73. echo "<a href='?m=addonsmanager&amp;p=addons&amp;home_id=".$home_id.
  74. "&amp;mod_id=".$mod_id."&amp;addon_type=config&amp;ip=".$ip.
  75. "&amp;port=".$port."'>".get_lang('install_config')."(".$configs_qty.")</a>\n";
  76. }
  77. echo "</td></tr>\n".
  78. "</table>\n".
  79. "<form action='?m=gamemanager&amp;p=game_monitor&amp;home_id-mod_id-ip-port=$home_id-$mod_id-$ip-$port' method='POST'>\n".
  80. "<input type='submit' value='".get_lang('back')."' />\n".
  81. "</form>\n".
  82. "<br>\n";
  83. }
  84. else
  85. print_failure(get_lang('no_games_servers_available'));
  86. }
  87. ?>