server_monitor.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <script type="text/javascript" src="js/modules/gamemanager.js"></script>
  2. <?php
  3. /*
  4. *
  5. * OGP - Open Game Panel
  6. * Copyright (C) 2008 - 2018 The OGP Development Team
  7. *
  8. * http://www.opengamepanel.org/
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * as published by the Free Software Foundation; either version 2
  13. * of the License, or any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23. *
  24. */
  25. require_once('modules/gamemanager/home_handling_functions.php');
  26. require_once("modules/config_games/server_config_parser.php");
  27. require_once("includes/refreshed.php");
  28. require_once('includes/lib_remote.php');
  29. function renderParam($param, $last_param, $param_access_enabled, $home_id)
  30. {
  31. global $db;
  32. $isAdmin = $db->isAdmin($_SESSION['user_id']);
  33. $attributesString = "";
  34. foreach ($param->attribute as $attribute)
  35. $attributesString .= $attribute['key']. "='$attribute' ";
  36. $disabledString = ((($param_access_enabled) && (!property_exists($param, 'access') || $param->access != "admin")) || $isAdmin) ? "" : "disabled ";
  37. if (array_key_exists((string)$param['key'], $last_param))
  38. $paramValue = (string)$last_param[(string)$param['key']];
  39. else
  40. $paramValue = (string)$param->default;
  41. $idString = "id='".clean_id_string($param['key'])."'";
  42. $nameString = "name='params[".$param['key']."]'";
  43. $paramType = $param['type'];
  44. if ($paramType == "select")
  45. {
  46. $inputElementString = "<select $idString $nameString $disabledString>";
  47. foreach ($param->option as $option)
  48. {
  49. $optionValue = (string)($option['value']);
  50. $selectedString = ($optionValue == $paramValue) ? "selected='selected'" : "";
  51. $valueString = "value=\"".str_replace('"', "&quot;", strip_real_escape_string($optionValue))."\"";
  52. $inputElementString .= "<option $selectedString $valueString>$option</option>";
  53. }
  54. $inputElementString .="</select>";
  55. }else if($paramType == "other_game_server_path" || $paramType == "other_game_server_path_additional"){
  56. if($isAdmin){
  57. $dbTypeHomesStr = "admin";
  58. }else{
  59. $dbTypeHomesStr = "user_and_group";
  60. }
  61. // Get homes
  62. $homes = $db->getHomesFor($dbTypeHomesStr, $_SESSION['user_id']);
  63. // Move current home_id home_path to the front of the array so that it is selected by default if no other option has been selected.
  64. $homes = customShift($homes, "home_id", $home_id);
  65. $inputElementString = "<select $idString name='params[" . $param['key'] . "{DEPENDS:$paramType}]'" . $disabledString . ">";
  66. foreach($homes as $home){
  67. if($home["home_path"][strlen($home["home_path"])-1] != "/"){
  68. $home["home_path"] = $home["home_path"] . "/";
  69. }
  70. if(stripos($paramValue, $home["home_path"]) !== false){
  71. $selectedString = "selected='selected'";
  72. $selectedHome = $home["home_path"];
  73. }else{
  74. $selectedString = "";
  75. }
  76. $inputElementString .= '<option value="' . $home["home_path"] . '" ' . $selectedString . '>' . $home["home_path"] . '</option>';
  77. }
  78. $inputElementString .="</select>";
  79. if($paramType == "other_game_server_path_additional"){
  80. $inputElementString .="<input type='text' value='" . (stripos($paramValue, $selectedHome) !== false ? substr($paramValue, strlen($selectedHome)) : (hasValue((string)$param->default) ? (string)$param->default : "")) . "' name='params[other_game_server_path_additional]' " . $disabledString .">";
  81. }
  82. }else{
  83. if ($paramType == "checkbox_key_value") {
  84. if ($paramValue) // convert the XML object to string
  85. $attributesString .= "checked='checked' ";
  86. $paramValue = $param['key'];
  87. $paramType = "checkbox";
  88. }
  89. else if ($paramType == "checkbox")
  90. {
  91. if ($paramValue) // convert the XML object to string
  92. $attributesString .= "checked='checked' ";
  93. }
  94. $inputElementString = "<input $idString $nameString ".
  95. "type='$paramType' value=\"".str_replace('"', "&quot;", strip_real_escape_string($paramValue))."\" ".
  96. "$disabledString $attributesString/>";
  97. }
  98. echo "<tr><td class='right'><label for='".clean_id_string($param['key'])."'>".$param['key'].
  99. ":</label></td><td class='left'>$inputElementString<label for='".clean_id_string($param['key'])."'>";
  100. if ( !empty($param->caption) )
  101. echo $param->caption;
  102. if ( !empty($param->desc) )
  103. echo "<br/><span class='info'>(".$param->desc.")</span>";
  104. echo "</label></td></tr>\n";
  105. }
  106. function get_sync_name($server_xml)
  107. {
  108. if( $server_xml->lgsl_query_name )
  109. {
  110. $sync_name = $server_xml->lgsl_query_name;
  111. if($sync_name == "quake3")
  112. {
  113. if($server_xml->game_name == "Quake 3")
  114. $sync_name = "q3";
  115. }
  116. }
  117. elseif( $server_xml->gameq_query_name )
  118. {
  119. $sync_name = $server_xml->gameq_query_name;
  120. if($sync_name == "minecraft")
  121. {
  122. if($server_xml->game_name == "Bukkit")
  123. $sync_name = "bukkit";
  124. elseif($server_xml->game_name == "Tekkit")
  125. $sync_name = "tekkit";
  126. }
  127. }
  128. elseif( isset($server_xml->protocol) )
  129. $sync_name = $server_xml->protocol;
  130. else
  131. $sync_name = $server_xml->mods->mod['key'];
  132. return $sync_name;
  133. }
  134. function exec_ogp_module() {
  135. global $db, $settings, $loggedInUserInfo;
  136. echo "<h2 class='gameMonitor " . ($db->isAdmin( $_SESSION['user_id'] ) ? "isAdminUser" : "") . "'>". get_lang("game_monitor") ."</h2>";
  137. $refresh = new refreshed();
  138. set_time_limit(0);
  139. $stats_servers_online = 0;
  140. $stats_servers = 0;
  141. $stats_players = 0;
  142. $stats_maxplayers = 0;
  143. $home_page = (isset($_GET['page']) && (int)$_GET['page'] > 0) ? (int)$_GET['page'] : 1;
  144. $home_limit = (isset($_GET['limit']) && (int)$_GET['limit'] > 0) ? (int)$_GET['limit'] : 10;
  145. $home_cfg_id = (isset($_GET['home_cfg_id']) && (int)$_GET['home_cfg_id'] > 0) ? (int)$_GET['home_cfg_id'] : false;
  146. $search_field = (isset($_GET['search']) && !empty($_GET['search'])) ? $_GET['search'] : false;
  147. if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"] && !(isset($_GET['limit']) and !empty($_GET['limit']))){
  148. $home_limit = $loggedInUserInfo["users_page_limit"];
  149. }
  150. $isAdmin = $db->isAdmin( $_SESSION['user_id'] );
  151. if ( $isAdmin )
  152. {
  153. $show_games_type = $db->getHomesFor('admin', $_SESSION['user_id']);
  154. if(isset($_GET['home_id']) OR isset($_GET['home_id-mod_id-ip-port']))
  155. $server_homes = $db->getHomesFor('admin', $_SESSION['user_id']);
  156. else
  157. $server_homes = $db->getHomesFor_limit('admin', $_SESSION['user_id'],$home_page,$home_limit,$home_cfg_id,$search_field);
  158. }
  159. else
  160. {
  161. $show_games_type = $db->getHomesFor('user_and_group', $_SESSION['user_id']);
  162. if(isset($_GET['home_id']) OR isset($_GET['home_id-mod_id-ip-port']))
  163. $server_homes = $db->getHomesFor('user_and_group', $_SESSION['user_id']);
  164. else
  165. $server_homes = $db->getHomesFor_limit('user_and_group', $_SESSION['user_id'],$home_page,$home_limit,$home_cfg_id,$search_field);
  166. }
  167. if( $server_homes === FALSE )
  168. {
  169. // If there are no games, then there can not be any mods either.
  170. if (!empty($search_field)) {
  171. print_failure(get_lang_f('no_results_found', htmlentities($search_field)));
  172. } else {
  173. print_failure(get_lang('no_game_homes_assigned'));
  174. }
  175. if ( $isAdmin )
  176. {
  177. echo "<p><a href='?m=user_games&amp;p=assign&amp;user_id=" . $_SESSION['user_id'] . "'>".
  178. get_lang("assign_game_homes") ."</a></p>";
  179. }
  180. return;
  181. }
  182. ?>
  183. <form action="home.php" style="float:right;">
  184. <b><?php print_lang('search'); ?>:</b>
  185. <input type ="hidden" name="m" value="gamemanager" />
  186. <input type ="hidden" name="p" value="game_monitor" />
  187. <input name="search" type="text" id="search" value="<?php if(hasValue($search_field)){ echo $search_field; } ?>" />
  188. <input type="submit" value="<?php echo get_lang('search'); ?>" />
  189. </form>
  190. <?php
  191. foreach($_POST as $key => $value)
  192. {
  193. if( preg_match( "/^action/", $key ) )
  194. {
  195. list($action,$home_id,$mod_id,$ip,$port) = explode("-", $value);
  196. exec_operation( $action, $home_id, $mod_id, $ip, $port );
  197. }
  198. }
  199. if ( empty( $_GET['home_id-mod_id-ip-port'] ) )
  200. unset( $_GET['home_id-mod_id-ip-port'] );
  201. if ( empty( $_GET['home_id'] ) )
  202. unset( $_GET['home_id'] );
  203. if ( isset($_GET['home_cfg_id']) and $_GET['home_cfg_id'] == get_lang('game_type') )
  204. unset( $_GET['home_cfg_id'] );
  205. create_home_selector_game_type($_GET['m'], $_GET['p'], $show_games_type);
  206. if (!isset($_GET['home_id-mod_id-ip-port']) and !isset($_GET['home_id']) and !isset($_GET['home_cfg_id']))
  207. {
  208. create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
  209. $show_all = TRUE;
  210. }
  211. else
  212. {
  213. create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
  214. create_home_selector($_GET['m'], $_GET['p'], "show_all");
  215. $show_all = FALSE;
  216. }
  217. require("protocol/lgsl/lgsl_protocol.php");
  218. $info = $db->getUserById($_SESSION['user_id']);
  219. if($info['user_expires'] != "X")
  220. {
  221. ?>
  222. <span style="color:black;font-weight:bold;">
  223. <center>
  224. <?php echo print_lang('account_expiration'); ?>: <span style="color:green;"><?php echo date( "l, F jS, Y, H:i:s", $info['user_expires'] ).
  225. " ( ".str_replace('hr', 'hours', read_expire($info['user_expires'])).")"; ?></span>
  226. </center>
  227. </span>
  228. <?php
  229. }
  230. if($settings["show_server_id_game_monitor"]){
  231. echo "<p class='serverIdToggle' showtext='" . get_lang('show_server_id') . "' hidetext='" . get_lang('hide_server_id') . "'>" . get_lang('show_server_id') . "</p>";
  232. }
  233. echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]'>".
  234. "<thead>".
  235. "<tr>".
  236. "\t<th style='width:16px;background-position: center;'></th>".
  237. "\t<th style='width:16px;background-position: center;'></th>".
  238. "\t<th class=\"hide serverId\">" . get_lang("server_id") . "</th>".
  239. "\t<th>" . get_lang("server_name") . "</th>".
  240. "\t<th>" . get_lang("address") . "</th>".
  241. "\t<th>" . get_lang("owner") . "</th>".
  242. "\t<th class='sorter-false'>".
  243. "\t\t" . get_lang("operations") . "".
  244. "\t\t<img style='border:0;height:15px;' id='action-stop' src='" . check_theme_image("images/stop.png") . "'/>".
  245. "\t\t<img style='border:0;height:15px;' id='action-restart' src='" . check_theme_image("images/restart.png") . "'/>".
  246. "\t\t<img style='border:0;height:15px;' id='action-start' src='" . check_theme_image("images/start.png") . "'/>".
  247. "\t</th>".
  248. "</tr>".
  249. "</thead>".
  250. "<tbody>";
  251. if( isset( $_GET['home_id-mod_id-ip-port']) )
  252. list( $post_home_id,
  253. $post_mod_id,
  254. $post_ip,
  255. $post_port ) = explode( "-", $_GET['home_id-mod_id-ip-port'] );
  256. $j = 1;
  257. foreach( $server_homes as $server_home )
  258. {
  259. if( ( $show_all or isset($_GET['home_cfg_id']) ) AND ( !isset($server_home['ip']) or !isset($server_home['mod_id']) ) ){
  260. $j++;
  261. continue;
  262. }
  263. // Count the number of servers.
  264. $stats_servers++;
  265. if( $show_all
  266. OR ( isset( $_GET['home_id'] ) and $_GET['home_id'] == $server_home['home_id'] )
  267. OR ( isset( $_GET['home_id-mod_id-ip-port'] ) and $server_home['home_id'] == $post_home_id and $server_home['mod_id'] == $post_mod_id and $post_ip == $server_home['ip'] and $post_port == $server_home['port'] )
  268. // If the IP has just been changed, post_ip and post_port aren't set... rather than not show this server, it should
  269. OR ( isset( $_GET['home_id-mod_id-ip-port'] ) and $server_home['home_id'] == $post_home_id and $server_home['mod_id'] == $post_mod_id and !empty($server_home['ip']) and !empty($server_home['port']) )
  270. OR ( isset( $_GET['home_cfg_id'] ) and $_GET['home_cfg_id'] == $server_home['home_cfg_id'] )
  271. )
  272. {
  273. //Unset variables.
  274. unset($map,
  275. $trclass,
  276. $first,
  277. $second,
  278. $onlineT,
  279. $ts3opt,
  280. $offlineT,
  281. $halfT,
  282. $ministart,
  283. $player_list,
  284. $groupsus,
  285. $name,
  286. $mod_name,
  287. $SrvCtrl,
  288. $user,
  289. $pos,
  290. $ctrlChkBoxes,
  291. $expiration_dates);
  292. if ( $isAdmin )
  293. $server_home['access_rights'] = $db->getFullAccessRightsString();
  294. if ($server_home['mod_name'] == "none" OR $server_home['mod_name'] == "None")
  295. $mod_name = "";
  296. elseif($server_home['mod_name'] != $server_home['game_name'])
  297. $mod_name = " ( ".$server_home['mod_name']." )";
  298. $expiration_dates = "";
  299. if(isset($server_home['server_expiration_date']) and $server_home['server_expiration_date'] != "X")
  300. $expiration_dates .= get_lang("server_expiration_date") . ": " . date('d/m/Y H:i:s', $server_home["server_expiration_date"]) . "<br>";
  301. if(isset($server_home['user_expiration_date']) and $server_home['user_expiration_date'] != "X")
  302. $expiration_dates .= get_lang("assign_expiration_date") . " (" . user . "): " . date('d/m/Y H:i:s', $server_home["user_expiration_date"]) . "<br>";
  303. if(isset($server_home['user_group_expiration_date']) and $server_home['user_expiration_date'] != "X")
  304. $expiration_dates .= get_lang("assign_expiration_date") . " (" . group . "): " . date('d/m/Y H:i:s', $server_home["user_group_expiration_date"]);
  305. if( !isset($server_home['mod_id']) )
  306. {
  307. $ministart = get_lang("fail_no_mods");
  308. if ( $isAdmin )
  309. {
  310. $ministart .= " <a href='?m=user_games&amp;p=edit&amp;home_id=".$server_home['home_id']."'>" . get_lang("configure_mods") . "</a>";
  311. }
  312. }
  313. $server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
  314. $mod = $server_home['mod_key'];
  315. // If query name does not exist use mod key instead.
  316. if ($server_xml->protocol == "gameq")
  317. $query_name = $server_xml->gameq_query_name;
  318. elseif ($server_xml->protocol == "lgsl")
  319. $query_name = $server_xml->lgsl_query_name;
  320. elseif ($server_xml->protocol == "teamspeak3")
  321. $query_name = 'ts3';
  322. else
  323. $query_name = $mod;
  324. //----------+ getting the lgsl image icon
  325. $icon_paths = array("images/icons/$mod.png",
  326. "images/icons/$query_name.png",
  327. "protocol/lgsl/other/icon_unknown.gif");
  328. $icon_path = get_first_existing_file($icon_paths);
  329. //Properties for all servers
  330. if(isset($post_home_id) && $post_home_id == $server_home['home_id'] OR isset($_GET['home_id']) && $_GET['home_id'] == $server_home['home_id'] )
  331. $trclass = " expandme";
  332. $groupusers = $db->getGroupUsersByHomeId($server_home['home_id']);
  333. $groupsus = "";
  334. if($groupusers)
  335. {
  336. foreach($groupusers as $groupu)
  337. {
  338. if($groupu['user_id'] == $server_home['user_id_main'])
  339. continue;
  340. $groupsus .= $groupu['users_login']."<br>";
  341. }
  342. }
  343. $groupsus = $groupsus != "" ? $groupsus = "<b>". get_lang("group_users") ."</b><br>".$groupsus : "";
  344. $owners = $db->getUsersByHomeId($server_home['home_id']);
  345. $other_owners = "";
  346. if($owners)
  347. {
  348. foreach($owners as $owner)
  349. {
  350. if($owner['user_id'] == $server_home['user_id_main'])
  351. continue;
  352. $other_owners .= $owner['users_login'].'<br>';
  353. }
  354. }
  355. $other_owners = $other_owners != "" ? $other_owners = "<b>". get_lang("assigned_to") ."</b><br>".$other_owners : "";
  356. $btns = get_monitor_buttons($server_home, $server_xml);
  357. //End
  358. $remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
  359. $host_stat = $remote->status_chk();
  360. if( $host_stat === 1)
  361. {
  362. $ip = $server_home['ip'];
  363. $query_ip = checkDisplayPublicIP($server_home['display_public_ip'], ($server_home['use_nat'] == 1 ? $server_home['agent_ip'] : $ip));
  364. $displayIP = checkDisplayPublicIP($server_home['display_public_ip'], $ip);
  365. $address = $displayIP . ":" . $server_home['port'];
  366. $screen_running = $remote->is_screen_running(OGP_SCREEN_TYPE_HOME,$server_home['home_id']) === 1;
  367. $update_in_progress = $remote->is_screen_running(OGP_SCREEN_TYPE_UPDATE,$server_home['home_id']) === 1;
  368. if($screen_running)
  369. {
  370. // Check if the screen running the server is running.
  371. $status = "online";
  372. $order = 1 + $j;
  373. if ($server_xml->protocol == "lgsl")
  374. {
  375. $get_q_and_s = lgsl_port_conversion($query_name, $server_home['port'], "", "");
  376. //Connection port
  377. $c_port = $get_q_and_s['0'];
  378. //query port
  379. $q_port = $get_q_and_s['1'];
  380. //software port
  381. $s_port = $get_q_and_s['2'];
  382. $address = "<a href='" . lgsl_software_link($query_name, $query_ip, $c_port, $q_port, $s_port) . "'>".$displayIP.":".$server_home['port']."</a>";
  383. }
  384. if ($server_xml->protocol == "teamspeak3")
  385. $address = "<a href='ts3server://" . $query_ip . ":" . $server_home['port'] . "'>".$displayIP.":".$server_home['port']."</a>";
  386. if($server_xml->protocol == "gameq" and $server_xml->installer == 'steamcmd')
  387. $address = "<a href='steam://connect/" . $query_ip . ":" . $server_home['port'] . "'>" . $displayIP . ":" . $server_home['port'] . "</a>";
  388. $pos = $refresh->add("home.php?m=gamemanager&p=ref_servermonitor&type=cleared&home_id=". $server_home['home_id'] . "&mod_id=". $server_home['mod_id'] . "&ip=" . $server_home['ip'] . "&port=" . $server_home['port']);
  389. if ($server_xml->protocol == "teamspeak3")
  390. {
  391. require('protocol/TeamSpeak3/functions.php');
  392. }
  393. $startup_file_exists = $remote->rfile_exists( "startups/".$server_home['ip']."-".$server_home['port'] ) === 1;
  394. if( isset($server_home['ip']) and isset($server_home['mod_id']) and ($server_xml->protocol != "teamspeak3" or ($startup_file_exists and $server_xml->protocol == "teamspeak3")) )
  395. {
  396. $ctrlChkBoxes .= '<div id="server_icon" class="action-stop'.$server_home['home_id'].'" ><div>'.
  397. '<input id="action-stop" class="action-stop'.$server_home['home_id'].'" name="action-'.$server_home['home_id'].'" value="stop-'.
  398. $server_home['home_id'].'-'.$server_home['mod_id'].'-'.$server_home['ip'].'-'.$server_home['port'].
  399. '" type="radio"><img style="border:0;height:15px;" src="' . check_theme_image("images/stop.png") . '"/></div><div>&nbsp;'.
  400. get_lang("stop_server") .'</div></div><div id="server_icon" class="action-restart'.$server_home['home_id'].'" ><div>'.
  401. '<input id="action-restart" class="action-restart'.$server_home['home_id'].'" name="action-'.$server_home['home_id'].'" value="restart-'.
  402. $server_home['home_id'].'-'.$server_home['mod_id'].'-'.$server_home['ip'].'-'.$server_home['port'].
  403. '" type="radio"><img style="border:0;height:15px;" src="' . check_theme_image("images/restart.png") . '"/></div><div>&nbsp;'.
  404. get_lang("restart_server") .'</div></div>';
  405. }
  406. $stats_servers_online++;
  407. }
  408. else
  409. {
  410. $status = "offline";
  411. if ($server_home['last_param'] != "" and isset($server_home['ip']) and isset($server_home['mod_id']))
  412. {
  413. if($update_in_progress)
  414. $ctrlChkBoxes .= '<div id="server_icon" class="action-start'.$server_home['home_id'].'" >&nbsp;'. get_lang("update_in_progress") .'</div>';
  415. else
  416. $ctrlChkBoxes .= '<div id="server_icon" class="action-start'.$server_home['home_id'].'" >
  417. <div>
  418. <input id="action-start" class="action-start'.$server_home['home_id'].'" name="action-'.$server_home['home_id'].'" value="start-'.
  419. $server_home['home_id'].'-'.$server_home['mod_id'].'-'.$server_home['ip'].'-'.$server_home['port'].
  420. '" type="radio"><img style="border:0;height:15px;" src="' . check_theme_image("images/start.png") . '"/></div><div>&nbsp;'.
  421. get_lang("start_server") .'</div></div>';
  422. }
  423. $order = 1000 + $j;
  424. if(isset($server_home['mod_id']))
  425. {
  426. ob_start();
  427. require('modules/gamemanager/mini_start.php');
  428. $ministart = ob_get_contents();
  429. ob_end_clean();
  430. }
  431. if($update_in_progress)
  432. $offlineT = '<div id="server_icon" class="action-start'.$server_home['home_id'].'" >&nbsp;'. get_lang("update_in_progress") .'</div>';
  433. else
  434. $offlineT = $ministart;
  435. }
  436. }
  437. else{
  438. $status = "offline";
  439. $order = 1000 + $j;
  440. $address = "<span style='color:darkred;font-weight:bold;'>Agent Offline</span>";
  441. }
  442. $user = $db->getUserById($server_home['user_id_main']);
  443. // Template
  444. @$first = "<tr class='maintr$trclass'>";
  445. $first .= "<td class='collapsible sortHandle' data-status='$status' data-pos='$pos'><span class='hidden'>$order</span>" . "<img src='" . check_theme_image("images/$status.png") . "' />" . "</td>";
  446. $first .= "<td class='collapsible sortHandle' data-status='$status' data-pos='$pos'>" . "<span class='hidden'>$mod</span><img src='$icon_path' />" . "</td>";
  447. $first .= "<td class='collapsible serverId hide sortHandle'>" . $server_home["home_id"] . "</td>";
  448. $first .= "<td class='collapsible serverName ignoreSortable' data-status='$status' data-pos='$pos'><b>" . htmlentities($server_home['home_name']) . "</b>$mod_name</td>";
  449. $first .= "<td class='collapsible serverIPAddress ignoreSortable' data-status='$status' data-pos='$pos'>" . $address . "</td>";
  450. $first .= "<td class='owner collapsible serverOwner ignoreSortable' data-status='$status' data-pos='$pos'>" . $user['users_login'] . "</td>";
  451. $first .= "<td style='width:328px;padding:0px;'>$ctrlChkBoxes</td>";
  452. $first .= "</tr>";
  453. $second = "<tr class='expand-child'>";
  454. @$second .= "<td colspan='4'>" . $refresh->getdiv($pos,"width:100%;") . "$offlineT</td>";
  455. $second .= "<td class='owner' >$other_owners$groupsus</td>";
  456. if( $server_xml->protocol != "teamspeak3" OR ($startup_file_exists and $server_xml->protocol == "teamspeak3") OR ($status == "offline" and $server_xml->protocol == "teamspeak3") )
  457. @$second .= "<td class='operations'><div class='inline-block monitorButtonContainer'>" . trim($btns) . trim($ts3opt) . "<b class='failure' style='float:left;' >$expiration_dates</b></div></td>";
  458. else
  459. $second .= "<td class='operations' >$ts3opt</td>";
  460. $second .= "</tr>";
  461. //Echo them all
  462. echo "$first$second";
  463. }
  464. $j++;
  465. }
  466. echo "</tbody>";
  467. echo "<tfoot style='border:1px solid grey;'>
  468. <tr>
  469. <td colspan='7' >
  470. <div class='bloc' >
  471. <img src='" . check_theme_image("images/magnifglass.png") . "' /> ". get_lang("statistics") .": $stats_servers_online/$stats_servers ". get_lang("servers") ."\n</div>
  472. <div class='right bloc' >
  473. <label>". get_lang("execute_selected_server_operations") ."</label>
  474. <input id='execute_operations' type='submit' value='". get_lang("execute_operations") ."' >\n
  475. </div>
  476. </td>
  477. </tr>
  478. </tfoot>";
  479. echo "</table>";
  480. if ($isAdmin) {
  481. $homes_count = $db->getHomesFor_count('admin', $_SESSION['user_id'], $home_cfg_id,$search_field);
  482. } else {
  483. $isSubUser = $db->isSubUser($_SESSION['user_id']);
  484. if ($isSubUser) {
  485. $homes_count = $db->getHomesFor_count('subuser',$_SESSION['user_id'], $home_cfg_id,$search_field);
  486. } else {
  487. $homes_count = $db->getHomesFor_count('user_and_group',$_SESSION['user_id'], $home_cfg_id,$search_field);
  488. }
  489. }
  490. if(isset($_GET['home_cfg_id']) && !empty($_GET['home_cfg_id'])){
  491. $uri = '?m=gamemanager&p=game_monitor&home_cfg_id='.$_GET['home_cfg_id'].''.($search_field ? "&search=$search_field" : "").'&limit='.$home_limit.'&page=';
  492. }
  493. else{
  494. $uri = '?m=gamemanager&p=game_monitor'.($search_field ? "&search=$search_field" : "").'&limit='.$home_limit.'&page=';
  495. }
  496. if(!isset($_GET['home_id-mod_id-ip-port']) && !isset($_GET['home_id']))
  497. {echo paginationPages($homes_count[0]['total'], $home_page, $home_limit, $uri, 3, 'serverMonitor');}
  498. echo "<div id=translation data-title='". get_lang("upload_map_image") .
  499. "' data-upload_button='". get_lang("upload_image") .
  500. "' data-bad_file='". get_lang("jpg_gif_png_less_than_1mb") .
  501. "' data-upload_failure='". get_lang("check_dev_console") .
  502. "' ></div>\n";
  503. ?>
  504. <script type="text/javascript">
  505. <?php echo $refresh->build(isset($settings['query_cache_life']) ? $settings['query_cache_life'] * 2000 : 60000); ?>
  506. </script>
  507. <?php
  508. }
  509. ?>