configFileList.php 2.9 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. require_once('modules/editconfigfiles/functions.php');
  25. require_once("modules/config_games/server_config_parser.php");
  26. function exec_ogp_module()
  27. {
  28. global $db, $view;
  29. $home_id = (int)$_GET['home_id'];
  30. $isAdmin = $db->isAdmin($_SESSION['user_id']);
  31. if (empty($home_id) || $home_id === 0) {
  32. print_failure(get_lang('no_server_specfied'));
  33. $view->refresh("?m=gamemanager&p=game_monitor");
  34. return;
  35. }
  36. if ($isAdmin) {
  37. $server_home = $db->getGameHome($home_id);
  38. } else {
  39. $server_home = $db->getUserGameHome($_SESSION['user_id'], $home_id);
  40. }
  41. if ($server_home === false) {
  42. print_failure(get_lang('no_home'));
  43. $view->refresh("?m=gamemanager&p=game_monitor");
  44. return;
  45. }
  46. $server_xml = read_server_config(SERVER_CONFIG_LOCATION .'/'. $server_home['home_cfg_file']);
  47. $files = getFilesInXML($server_xml->configuration_files);
  48. if (empty($files)) {
  49. print_failure(get_lang('no_configs_for_game'));
  50. $view->refresh("?m=gamemanager&p=game_monitor");
  51. } else {
  52. echo '<h2>'.get_lang('configuration_files').'</h2>';
  53. echo '<table width="100%">
  54. <tr>
  55. <th>'.get_lang('name').'</th>
  56. <th>'.get_lang('description').'</th>
  57. <th>'.get_lang('actions').'</th>
  58. </tr>';
  59. foreach ($files as $file) {
  60. echo '<tr>
  61. <td>'. $file['name'] .'</td>
  62. <td>'. ($file['description'] ?: '<i>'.get_lang('no_description').'</i>') .'</td>
  63. <td><a href="?m=editconfigfiles&p=modify&home_id='.$server_home['home_id'].'&file='.rawurlencode($file['path']).'">[ '.get_lang('edit').' ]</a></td>
  64. </tr>';
  65. }
  66. echo '</table>';
  67. }
  68. $modKey = key($server_home['mods']);
  69. $IpPorts = $db->getHomeIpPorts($home_id);
  70. echo '<div style="margin-top:12px">
  71. <a href="?m=gamemanager&p=game_monitor&home_id-mod_id-ip-port='. $home_id .'-'. $server_home['mods'][$modKey]['mod_id'] .'-'. $IpPorts[0]['ip'] .'-'. $IpPorts[0]['port'] .'">'.get_lang('go_back').'</a>
  72. </div>';
  73. }