monitor_buttons.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. $module_buttons = array(
  25. "<a class='monitorbutton' href='?m=gamemanager&amp;p=log&amp;home_id-mod_id-ip-port=".$server_home['home_id']."-".$server_home['mod_id']."-".$server_home['ip']."-".$server_home['port']."'>
  26. <img src='" . check_theme_image("images/log.png") . "' title='". get_lang("view_log") ."'>
  27. <span>". get_lang("view_log") ."</span>
  28. </a>",
  29. "<a class='monitorbutton size' data-home_id='".$server_home['home_id']."'>
  30. <img src='" . check_theme_image("images/file_size.png") . "' title='". get_lang("get_size") ."'>
  31. <span>". get_lang("get_size") ."</span>
  32. </a>"
  33. );
  34. if (preg_match("/u/",$server_home['access_rights']))
  35. {
  36. $master_server_home_id = $db->getMasterServer( $server_home['remote_server_id'], $server_home['home_cfg_id'] );
  37. if ( $master_server_home_id != FALSE )
  38. {
  39. if ( !$db->getGameHomeWithoutMods($master_server_home_id) )
  40. {
  41. $db->setMasterServer("remove", $master_server_home_id, $server_home['home_cfg_id'], $server_home['remote_server_id']);
  42. $master_server_home_id = FALSE;
  43. }
  44. }
  45. // In case game is compatible with steam we offer a way to use steam with the updates.
  46. if( $server_xml->installer == "steamcmd" )
  47. {
  48. if( $master_server_home_id != FALSE AND $master_server_home_id != $server_home['home_id'] )
  49. {
  50. $module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;master_server_home_id=".$master_server_home_id."&amp;update=update'>
  51. <img src='" . check_theme_image("images/master.png") . "' title='". get_lang("update_from_local_master_server") ."'>
  52. <span>". get_lang("update_from_local_master_server") ."</span>
  53. </a>";
  54. }
  55. $module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
  56. <img src='" . check_theme_image("images/steam.png") ."' title='". get_lang("install_update_steam") ."'>
  57. <span>". get_lang("install_update_steam") ."</span>
  58. </a>";
  59. $module_buttons[] = "<a class='monitorbutton getAutoUpdateLink' copyfail='" . get_lang("auto_update_copy_me_fail") . "' copysuccess='" . get_lang("auto_update_copy_me_success") . "' autoupdatetext='" . get_lang("auto_update_title_popup") . "' autoupdatehtml='" . htmlentities(get_lang("auto_update_popup_html")) . "' copyme='" . get_lang("auto_update_copy_me") . "' autoupdatelink='" . getOGPSiteURL() . "/ogp_api.php?gamemanager/update&token=".$db->getApiToken($_SESSION['user_id'])."&ip=".$server_home['ip']."&port=".$server_home['port']."&mod_key=".$server_home['mod_key']."&type=steam'>
  60. <img src='" . check_theme_image("images/auto_update.png") . "' title='". get_lang("get_steam_autoupdate_api_link") . "'>
  61. <span>". get_lang("get_steam_autoupdate_api_link") . "</span>
  62. </a>";
  63. }
  64. // In other cases manual update is provided.
  65. else
  66. {
  67. $module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=update_manual&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
  68. <img src='" . check_theme_image("images/install.png") . "' title='". get_lang("install_update_manual") ."'>
  69. <span>". get_lang("install_update_manual") ."</span>
  70. </a>";
  71. $sync_name = get_sync_name($server_xml);
  72. $sync_list = @file("modules/gamemanager/rsync.list", FILE_IGNORE_NEW_LINES);
  73. if ( in_array($sync_name, $sync_list) OR ($master_server_home_id != FALSE and $master_server_home_id != $server_home['home_id']) )
  74. {
  75. $module_buttons[] = "<a class='monitorbutton' href='?m=gamemanager&amp;p=rsync_install&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
  76. <img src='" . check_theme_image("images/rsync.png") . "' title='". rsync_install ."'>
  77. <span>". get_lang("rsync_install") ."</span>
  78. </a>";
  79. }
  80. }
  81. }
  82. if($_SESSION['users_role'] == "admin")
  83. {
  84. if ( ( $server_xml->control_protocol and preg_match("/^(rcon|lcon|rcon2|armabe)$/" ,$server_xml->control_protocol) ) OR
  85. ( $server_xml->gameq_query_name and $server_xml->gameq_query_name == 'minecraft' ) )
  86. {
  87. $module_buttons[] = "<a class='monitorbutton' href='home.php?m=gamemanager&amp;p=rcon_presets&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."'>
  88. <img src='" . check_theme_image("images/rcon_preset.png") . "' title='".get_lang("rcon_presets")."'>
  89. <span>".get_lang("rcon_presets")."</span>
  90. </a>";
  91. }
  92. }
  93. ?>