isAdmin($_SESSION['user_id']); $attributesString = ""; foreach ($param->attribute as $attribute) $attributesString .= $attribute['key']. "='$attribute' "; $disabledString = ((($param_access_enabled) && (!property_exists($param, 'access') || $param->access != "admin")) || $isAdmin) ? "" : "disabled "; if (array_key_exists((string)$param['key'], $last_param)) $paramValue = (string)$last_param[(string)$param['key']]; else $paramValue = (string)$param->default; $idString = "id='".clean_id_string($param['key'])."'"; $nameString = "name='params[".$param['key']."]'"; $paramType = $param['type']; if ($paramType == "select") { $inputElementString = ""; }else if($paramType == "other_game_server_path" || $paramType == "other_game_server_path_additional"){ if($isAdmin){ $dbTypeHomesStr = "admin"; }else{ $dbTypeHomesStr = "user_and_group"; } // Get homes $homes = $db->getHomesFor($dbTypeHomesStr, $_SESSION['user_id']); // 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. $homes = customShift($homes, "home_id", $home_id); $inputElementString = ""; if($paramType == "other_game_server_path_additional"){ $inputElementString .=""; } }else{ if ($paramType == "checkbox_key_value") { if ($paramValue) // convert the XML object to string $attributesString .= "checked='checked' "; $paramValue = $param['key']; $paramType = "checkbox"; } else if ($paramType == "checkbox") { if ($paramValue) // convert the XML object to string $attributesString .= "checked='checked' "; } $inputElementString = ""; } echo "$inputElementString\n"; } function get_sync_name($server_xml) { if( $server_xml->lgsl_query_name ) { $sync_name = $server_xml->lgsl_query_name; if($sync_name == "quake3") { if($server_xml->game_name == "Quake 3") $sync_name = "q3"; } } elseif( $server_xml->gameq_query_name ) { $sync_name = $server_xml->gameq_query_name; if($sync_name == "minecraft") { if($server_xml->game_name == "Bukkit") $sync_name = "bukkit"; elseif($server_xml->game_name == "Tekkit") $sync_name = "tekkit"; } } elseif( isset($server_xml->protocol) ) $sync_name = $server_xml->protocol; else $sync_name = $server_xml->mods->mod['key']; return $sync_name; } function exec_ogp_module() { global $db, $settings, $loggedInUserInfo; echo "

". get_lang("game_monitor") ."

"; $refresh = new refreshed(); set_time_limit(0); $stats_servers_online = 0; $stats_servers = 0; $stats_players = 0; $stats_maxplayers = 0; $home_page = (isset($_GET['page']) && (int)$_GET['page'] > 0) ? (int)$_GET['page'] : 1; $home_limit = (isset($_GET['limit']) && (int)$_GET['limit'] > 0) ? (int)$_GET['limit'] : 10; $home_cfg_id = (isset($_GET['home_cfg_id']) && (int)$_GET['home_cfg_id'] > 0) ? (int)$_GET['home_cfg_id'] : false; $search_field = (isset($_GET['search']) && !empty($_GET['search'])) ? $_GET['search'] : false; if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"] && !(isset($_GET['limit']) and !empty($_GET['limit']))){ $home_limit = $loggedInUserInfo["users_page_limit"]; } $isAdmin = $db->isAdmin( $_SESSION['user_id'] ); if ( $isAdmin ) { $show_games_type = $db->getHomesFor('admin', $_SESSION['user_id']); if(isset($_GET['home_id']) OR isset($_GET['home_id-mod_id-ip-port'])) $server_homes = $db->getHomesFor('admin', $_SESSION['user_id']); else $server_homes = $db->getHomesFor_limit('admin', $_SESSION['user_id'],$home_page,$home_limit,$home_cfg_id,$search_field); } else { $show_games_type = $db->getHomesFor('user_and_group', $_SESSION['user_id']); if(isset($_GET['home_id']) OR isset($_GET['home_id-mod_id-ip-port'])) $server_homes = $db->getHomesFor('user_and_group', $_SESSION['user_id']); else $server_homes = $db->getHomesFor_limit('user_and_group', $_SESSION['user_id'],$home_page,$home_limit,$home_cfg_id,$search_field); } if( $server_homes === FALSE ) { // If there are no games, then there can not be any mods either. if (!empty($search_field)) { print_failure(get_lang_f('no_results_found', htmlentities($search_field))); } else { print_failure(get_lang('no_game_homes_assigned')); } if ( $isAdmin ) { echo "

". get_lang("assign_game_homes") ."

"; } return; } ?>
:
$value) { if( preg_match( "/^action/", $key ) ) { list($action,$home_id,$mod_id,$ip,$port) = explode("-", $value); exec_operation( $action, $home_id, $mod_id, $ip, $port ); } } if ( empty( $_GET['home_id-mod_id-ip-port'] ) ) unset( $_GET['home_id-mod_id-ip-port'] ); if ( empty( $_GET['home_id'] ) ) unset( $_GET['home_id'] ); if ( isset($_GET['home_cfg_id']) and $_GET['home_cfg_id'] == get_lang('game_type') ) unset( $_GET['home_cfg_id'] ); create_home_selector_game_type($_GET['m'], $_GET['p'], $show_games_type); if (!isset($_GET['home_id-mod_id-ip-port']) and !isset($_GET['home_id']) and !isset($_GET['home_cfg_id'])) { create_home_selector_address($_GET['m'], $_GET['p'], $server_homes); $show_all = TRUE; } else { create_home_selector_address($_GET['m'], $_GET['p'], $server_homes); create_home_selector($_GET['m'], $_GET['p'], "show_all"); $show_all = FALSE; } require("protocol/lgsl/lgsl_protocol.php"); $info = $db->getUserById($_SESSION['user_id']); if($info['user_expires'] != "X") { ?>
:
" . get_lang('show_server_id') . "

"; } echo "". "". "". "\t". "\t". "\t". "\t". "\t". "\t". "\t". "". "". ""; if( isset( $_GET['home_id-mod_id-ip-port']) ) list( $post_home_id, $post_mod_id, $post_ip, $post_port ) = explode( "-", $_GET['home_id-mod_id-ip-port'] ); $j = 1; foreach( $server_homes as $server_home ) { if( ( $show_all or isset($_GET['home_cfg_id']) ) AND ( !isset($server_home['ip']) or !isset($server_home['mod_id']) ) ){ $j++; continue; } // Count the number of servers. $stats_servers++; if( $show_all OR ( isset( $_GET['home_id'] ) and $_GET['home_id'] == $server_home['home_id'] ) 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'] ) // If the IP has just been changed, post_ip and post_port aren't set... rather than not show this server, it should 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']) ) OR ( isset( $_GET['home_cfg_id'] ) and $_GET['home_cfg_id'] == $server_home['home_cfg_id'] ) ) { //Unset variables. unset($map, $trclass, $first, $second, $onlineT, $ts3opt, $offlineT, $halfT, $ministart, $player_list, $groupsus, $name, $mod_name, $SrvCtrl, $user, $pos, $ctrlChkBoxes, $expiration_dates); if ( $isAdmin ) $server_home['access_rights'] = $db->getFullAccessRightsString(); if ($server_home['mod_name'] == "none" OR $server_home['mod_name'] == "None") $mod_name = ""; elseif($server_home['mod_name'] != $server_home['game_name']) $mod_name = " ( ".$server_home['mod_name']." )"; $expiration_dates = ""; if(isset($server_home['server_expiration_date']) and $server_home['server_expiration_date'] != "X") $expiration_dates .= get_lang("server_expiration_date") . ": " . date('d/m/Y H:i:s', $server_home["server_expiration_date"]) . "
"; if(isset($server_home['user_expiration_date']) and $server_home['user_expiration_date'] != "X") $expiration_dates .= get_lang("assign_expiration_date") . " (" . user . "): " . date('d/m/Y H:i:s', $server_home["user_expiration_date"]) . "
"; if(isset($server_home['user_group_expiration_date']) and $server_home['user_expiration_date'] != "X") $expiration_dates .= get_lang("assign_expiration_date") . " (" . group . "): " . date('d/m/Y H:i:s', $server_home["user_group_expiration_date"]); if( !isset($server_home['mod_id']) ) { $ministart = get_lang("fail_no_mods"); if ( $isAdmin ) { $ministart .= " " . get_lang("configure_mods") . ""; } } $server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']); $mod = $server_home['mod_key']; // If query name does not exist use mod key instead. if ($server_xml->protocol == "gameq") $query_name = $server_xml->gameq_query_name; elseif ($server_xml->protocol == "lgsl") $query_name = $server_xml->lgsl_query_name; elseif ($server_xml->protocol == "teamspeak3") $query_name = 'ts3'; else $query_name = $mod; //----------+ getting the lgsl image icon $icon_paths = array("images/icons/$mod.png", "images/icons/$query_name.png", "protocol/lgsl/other/icon_unknown.gif"); $icon_path = get_first_existing_file($icon_paths); //Properties for all servers if(isset($post_home_id) && $post_home_id == $server_home['home_id'] OR isset($_GET['home_id']) && $_GET['home_id'] == $server_home['home_id'] ) $trclass = " expandme"; $groupusers = $db->getGroupUsersByHomeId($server_home['home_id']); $groupsus = ""; if($groupusers) { foreach($groupusers as $groupu) { if($groupu['user_id'] == $server_home['user_id_main']) continue; $groupsus .= $groupu['users_login']."
"; } } $groupsus = $groupsus != "" ? $groupsus = "". get_lang("group_users") ."
".$groupsus : ""; $owners = $db->getUsersByHomeId($server_home['home_id']); $other_owners = ""; if($owners) { foreach($owners as $owner) { if($owner['user_id'] == $server_home['user_id_main']) continue; $other_owners .= $owner['users_login'].'
'; } } $other_owners = $other_owners != "" ? $other_owners = "". get_lang("assigned_to") ."
".$other_owners : ""; $btns = get_monitor_buttons($server_home, $server_xml); //End $remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']); $host_stat = $remote->status_chk(); if( $host_stat === 1) { $ip = $server_home['ip']; $query_ip = checkDisplayPublicIP($server_home['display_public_ip'], ($server_home['use_nat'] == 1 ? $server_home['agent_ip'] : $ip)); $displayIP = checkDisplayPublicIP($server_home['display_public_ip'], $ip); $address = $displayIP . ":" . $server_home['port']; $screen_running = $remote->is_screen_running(OGP_SCREEN_TYPE_HOME,$server_home['home_id']) === 1; $update_in_progress = $remote->is_screen_running(OGP_SCREEN_TYPE_UPDATE,$server_home['home_id']) === 1; if($screen_running) { // Check if the screen running the server is running. $status = "online"; $order = 1 + $j; if ($server_xml->protocol == "lgsl") { $get_q_and_s = lgsl_port_conversion($query_name, $server_home['port'], "", ""); //Connection port $c_port = $get_q_and_s['0']; //query port $q_port = $get_q_and_s['1']; //software port $s_port = $get_q_and_s['2']; $address = "".$displayIP.":".$server_home['port'].""; } if ($server_xml->protocol == "teamspeak3") $address = "".$displayIP.":".$server_home['port'].""; if($server_xml->protocol == "gameq" and $server_xml->installer == 'steamcmd') $address = "" . $displayIP . ":" . $server_home['port'] . ""; $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']); if ($server_xml->protocol == "teamspeak3") { require('protocol/TeamSpeak3/functions.php'); } $startup_file_exists = $remote->rfile_exists( "startups/".$server_home['ip']."-".$server_home['port'] ) === 1; 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")) ) { $ctrlChkBoxes .= '
'. '
 '. get_lang("stop_server") .'
'. '
 '. get_lang("restart_server") .'
'; } $stats_servers_online++; } else { $status = "offline"; if ($server_home['last_param'] != "" and isset($server_home['ip']) and isset($server_home['mod_id'])) { if($update_in_progress) $ctrlChkBoxes .= '
 '. get_lang("update_in_progress") .'
'; else $ctrlChkBoxes .= '
 '. get_lang("start_server") .'
'; } $order = 1000 + $j; if(isset($server_home['mod_id'])) { ob_start(); require('modules/gamemanager/mini_start.php'); $ministart = ob_get_contents(); ob_end_clean(); } if($update_in_progress) $offlineT = '
 '. get_lang("update_in_progress") .'
'; else $offlineT = $ministart; } } else{ $status = "offline"; $order = 1000 + $j; $address = "Agent Offline"; } $user = $db->getUserById($server_home['user_id_main']); // Template @$first = ""; $first .= ""; $first .= ""; $first .= ""; $first .= ""; $first .= ""; $first .= ""; $first .= ""; $first .= ""; $second = ""; @$second .= ""; $second .= ""; if( $server_xml->protocol != "teamspeak3" OR ($startup_file_exists and $server_xml->protocol == "teamspeak3") OR ($status == "offline" and $server_xml->protocol == "teamspeak3") ) @$second .= ""; else $second .= ""; $second .= ""; //Echo them all echo "$first$second"; } $j++; } echo ""; echo ""; echo "
" . get_lang("server_id") . "" . get_lang("server_name") . "" . get_lang("address") . "" . get_lang("owner") . "". "\t\t" . get_lang("operations") . "". "\t\t". "\t\t". "\t\t". "\t
" . "" . "" . "" . "" . $server_home["home_id"] . "" . htmlentities($server_home['home_name']) . "$mod_name" . $address . "" . $user['users_login'] . "$ctrlChkBoxes
" . $refresh->getdiv($pos,"width:100%;") . "$offlineT$other_owners$groupsus
" . trim($btns) . trim($ts3opt) . "$expiration_dates
$ts3opt
". get_lang("statistics") .": $stats_servers_online/$stats_servers ". get_lang("servers") ."\n
\n
"; if ($isAdmin) { $homes_count = $db->getHomesFor_count('admin', $_SESSION['user_id'], $home_cfg_id,$search_field); } else { $isSubUser = $db->isSubUser($_SESSION['user_id']); if ($isSubUser) { $homes_count = $db->getHomesFor_count('subuser',$_SESSION['user_id'], $home_cfg_id,$search_field); } else { $homes_count = $db->getHomesFor_count('user_and_group',$_SESSION['user_id'], $home_cfg_id,$search_field); } } if(isset($_GET['home_cfg_id']) && !empty($_GET['home_cfg_id'])){ $uri = '?m=gamemanager&p=game_monitor&home_cfg_id='.$_GET['home_cfg_id'].''.($search_field ? "&search=$search_field" : "").'&limit='.$home_limit.'&page='; } else{ $uri = '?m=gamemanager&p=game_monitor'.($search_field ? "&search=$search_field" : "").'&limit='.$home_limit.'&page='; } if(!isset($_GET['home_id-mod_id-ip-port']) && !isset($_GET['home_id'])) {echo paginationPages($homes_count[0]['total'], $home_page, $home_limit, $uri, 3, 'serverMonitor');} echo "
\n"; ?>