1
0

monitor_buttons.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. $hasSteamAutoUpdate = false;
  37. $master_server_home_id = $db->getMasterServer( $server_home['remote_server_id'], $server_home['home_cfg_id'] );
  38. if ( $master_server_home_id != FALSE )
  39. {
  40. if ( !$db->getGameHomeWithoutMods($master_server_home_id) )
  41. {
  42. $db->setMasterServer("remove", $master_server_home_id, $server_home['home_cfg_id'], $server_home['remote_server_id']);
  43. $master_server_home_id = FALSE;
  44. }
  45. }
  46. // In case game is compatible with steam we offer a way to use steam with the updates.
  47. if( $server_xml->installer == "steamcmd" )
  48. {
  49. if( $master_server_home_id != FALSE AND $master_server_home_id != $server_home['home_id'] )
  50. {
  51. $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'>
  52. <img src='" . check_theme_image("images/master.png") . "' title='". get_lang("update_from_local_master_server") ."'>
  53. <span>". get_lang("update_from_local_master_server") ."</span>
  54. </a>";
  55. }
  56. $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'>
  57. <img src='" . check_theme_image("images/steam.png") ."' title='". get_lang("install_update_steam") ."'>
  58. <span>". get_lang("install_update_steam") ."</span>
  59. </a>";
  60. $hasSteamAutoUpdate = true;
  61. }
  62. // In other cases manual update is provided.
  63. else
  64. {
  65. $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'>
  66. <img src='" . check_theme_image("images/install.png") . "' title='". get_lang("install_update_manual") ."'>
  67. <span>". get_lang("install_update_manual") ."</span>
  68. </a>";
  69. $sync_name = get_sync_name($server_xml);
  70. $sync_list = @file("modules/gamemanager/rsync.list", FILE_IGNORE_NEW_LINES);
  71. if ( in_array($sync_name, $sync_list) OR ($master_server_home_id != FALSE and $master_server_home_id != $server_home['home_id']) )
  72. {
  73. $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'>
  74. <img src='" . check_theme_image("images/rsync.png") . "' title='". get_lang("rsync_install") ."'>
  75. <span>". get_lang("rsync_install") ."</span>
  76. </a>";
  77. }
  78. }
  79. $module_buttons[] = "<a class='monitorbutton getAPILinks' hassteam='" . ($hasSteamAutoUpdate ? 'true' : 'false') . "' hasrcon='" . ($server_xml->control_protocol || ($server_xml->lgsl_query_name and $server_xml->lgsl_query_name == "7dtd") || ($server_xml->gameq_query_name and $server_xml->gameq_query_name == "minecraft") ? 'true' : 'false') . "' copyfail='" . get_lang("auto_update_copy_me_fail") . "' copysuccess='" . get_lang("auto_update_copy_me_success") . "' autoupdatetext='" . get_lang("auto_update_title_popup") . "' copyme='" . get_lang("auto_update_copy_me") . "' token='".$db->getApiToken($_SESSION['user_id'])."' ip='".$server_home['ip']."' port='".$server_home['port']."' modkey='".$server_home['mod_key']."' panelurl='" . getOGPSiteURL() . "'>
  80. <img src='" . check_theme_image("images/auto_update.png") . "' title='". get_lang("show_api_actions") . "'>
  81. <span>". get_lang("show_api_actions") . "</span>
  82. </a>";
  83. }
  84. if($_SESSION['users_role'] == "admin")
  85. {
  86. if ( ( $server_xml->control_protocol and preg_match("/^(rcon|lcon|rcon2|armabe|minecraft)$/" ,$server_xml->control_protocol) ) OR
  87. ( $server_xml->gameq_query_name and $server_xml->gameq_query_name == 'minecraft' ) )
  88. {
  89. $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']."'>
  90. <img src='" . check_theme_image("images/rcon_preset.png") . "' title='".get_lang("rcon_presets")."'>
  91. <span>".get_lang("rcon_presets")."</span>
  92. </a>";
  93. }
  94. }
  95. ?>