ソースを参照

v2; complete rework

Has been completely reworked to make much more use out of Javascript.

Features:
-Agents are loaded via Javascript. This is good for users which multiple
agents or when several are offline - faster load times!

-You can send any command to agents now. This is NOT some kind of
web-console - commands and their user access is defined in a config
file. By default, everyone (subusers, users, and admins) have access to
ping. Only admins have access to traceroute. Read the config file to see
how to add more commands. The text input field does NOT accept values
such as arguments ( - ) or command seperators ( ; , & ), etc.

-The Steam Converter page now supports the Steam ID3 ( [U:1:xxxxxxxx] )
format.

-The page doesn't reload for switching between custom sourcemod flags
and root admin.... actually, it doesn't reload at all now.

-HTML5 form elements are used such at pattern, along with checking if
the input is valid via JS and also via PHP. Check the input everywhere!

-The Mani Admin page was removed - it hasn't been supported since 2012
or so.

...It should be relatively simple to add support for other mods besides
Sourcemod via a few simple checks. But for now, this replicates the
basic functionality while being a bit more useful.
Adjokip 9 年 前
コミット
951b95e6a1

+ 198 - 0
modules/util/addadmin_helper.php

@@ -0,0 +1,198 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	include 'util_config.php';
+	
+	session_name($sessionName);
+	session_start();
+	
+	if(!empty($_SESSION['user_id']) === true){
+		// This entire section is nothing but a big, messy, workaround.
+		// Make ogpLang happy.
+		$_REQUEST['m'] = 'util';
+		// We need to change directory to be able to include lib_remote and make a database connection without any errors
+		// This is becasue the following files include other files via their relative path rather than absolute path... could be fixed by editing them... but until then, this is just a hacky workaround.
+		$cwd = getcwd();
+		if(chdir('../../') === true){
+			require_once('includes/config.inc.php');
+			require_once('includes/helpers.php');
+			require_once('includes/lib_remote.php');
+			include_once("includes/lang.php");
+			ogpLang();
+			
+			$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
+		}else{
+			die(get_lang('chdir_failed'));
+		}
+		
+		if(chdir($cwd) === false){
+			die(get_lang('chdir_failed'));
+		}
+		
+		// Get gameservers belonging to each user with matching permissions if they're not an admin.
+		function getUserServers($servers, $flags){
+			global $db, $supportedGames;
+			
+			$info = array();
+			$userInfo = $db->getUserById($_SESSION['user_id']);
+			$userRole = $userInfo['users_role'];
+			
+			if(!empty($servers)){
+				foreach($servers as $server){
+					$gamehome = $db->getUserGameHome($_SESSION['user_id'], $server['home_id']);
+					
+					if(in_array($gamehome['game_name'], $supportedGames) === true){
+						if($userRole !== 'admin'){
+							if(strpbrk($gamehome['access_rights'], $flags) !== false){
+								$info[] = $server;
+							}
+						}else{
+							$info[] = $server;
+						}
+					}
+				}
+			}
+			
+			return $info;
+		}
+		
+		$servers = getUserServers($db->getIpPortsForUser($_SESSION['user_id']), $subuserAdminManagement);
+		
+		// If it's a post request and the user is signed in - process it.
+		// Otherwise, remove some sensitive info (such as encryption_key) from $servers - only keeping what the user needs to see and json_encode it for JS to process.
+		if($_SERVER['REQUEST_METHOD'] === 'POST'){
+			$serverInfo = array();
+			$flags = '';
+			$sourcemodFlags = range('a', 't');
+			$immunityRange = range(1, 99);
+			
+			// Don't use isset here because they're always going to be set if the form is submitted - we only want to process the data if the following isn't empty.
+			if(!empty($_POST['gameserver_id']) && !empty($_POST['remote_server_id']) && !empty($_POST['gameserver_name'])
+			&& !empty($_POST['gameserver_ip']) && !empty($_POST['gameserver_port']) && !empty($_POST['addSteamid']) && !empty($_POST['sourcemod_perms'])){
+					
+				foreach($servers as $server){
+					// Try to check if hidden form values have been manually edited. If not, process.
+					if($server['remote_server_id'] == $_POST['remote_server_id'] && $server['home_id'] == $_POST['gameserver_id']
+					&& $server['game_name'] == $_POST['gameserver_name'] && $server['ip'] == $_POST['gameserver_ip'] && $server['port'] == $_POST['gameserver_port']){	
+						$serverInfo = $server;
+					}
+				}
+				
+				if(!empty($serverInfo)){
+					$remote = new OGPRemoteLibrary($serverInfo['agent_ip'], $serverInfo['agent_port'], $serverInfo['encryption_key'], $serverInfo['timeout']);
+					
+					if($remote->status_chk() === 1){
+						if(preg_match('/^STEAM_[01]:[01]:\d+$/', $_POST['addSteamid'])){
+							$immunity = (!empty($_POST['immunity']) && in_array($_POST['immunity'], $immunityRange)) ? $_POST['immunity'] : '';
+							
+							if($_POST['sourcemod_perms'] == 'root'){
+								$flags = 'z';
+							}elseif($_POST['sourcemod_perms'] == 'custom'){
+								if(!empty($_POST['flags']) && is_array($_POST['flags'])){
+									$x = array_intersect(array_values($_POST['flags']), $sourcemodFlags);
+									$flags = implode('', ($x));
+								}
+							}
+							
+							if(!empty($flags)){
+								$adminFile = $serverInfo['home_path'].'/'.$serverInfo['mod_key'].'/'.$adminFiles['sourcemod'];
+								// Build up what the new line will be.
+								$newLine = "\"{$_POST['addSteamid']}\"\t\"".(!empty($immunity) ? $immunity.':' : '').$flags."\"";
+								
+								// Only process if the $adminFile exists;
+								if($remote->rfile_exists($adminFile) === 1){
+									$remote->remote_readfile($adminFile, $file_content);
+									
+									// Decide if it's replacing an existing line or is a new line.
+									if(preg_match('/'.$_POST['addSteamid'].'/i', $file_content)){
+										$file_content = preg_replace('/.*'.$_POST['addSteamid'].'.*/i', $newLine, $file_content);
+									}else{
+										$file_content .= $newLine."\r\n";
+									}
+									
+									if($remote->remote_writefile($adminFile, $file_content) === 1){
+										if(!empty($serverInfo['control_password'])){
+											$reloadAdmins = $remote->remote_send_rcon_command($serverInfo['home_id'], $serverInfo['ip'], $serverInfo['port'], 'rcon2', $serverInfo['control_password'], '', 'sm_reloadadmins', $return);
+											
+											if($reloadAdmins === -1){
+												echo get_lang('rcon_reload_admins_failed');
+											}elseif($reloadAdmins === 1){
+												if(preg_match('/Admin cache has been refreshed/i', $return)){
+													echo get_lang_f('reload_admins_success', $_POST['addSteamid']);
+												}else{
+													echo get_lang('reload_admins_failed');
+												}
+											}
+										}else{
+											// No rcon password stored - can't reload admins
+											echo get_lang_f('add_success_no_rcon', $_POST['addSteamid']);
+										}
+									}else{
+										// There was a problem writing to the admin file.
+										echo get_lang_f('writefile_error', $adminFile);
+									}
+								}else{
+									// The remote admin file doesn't exist.
+									echo get_lang_f('remotefile_nonexistent', $adminFiles['sourcemod']);
+								}
+							}else{
+								// There wasn't any flags specified.
+								echo get_lang('empty_flag_list');
+							}
+						}else{
+							// invalid steam_id format given.
+							echo get_lang('invalid_steam_format');
+						}
+					}else{
+						// Agent is offline. We can't add any admins here.
+						echo get_lang('selected_server_offline');
+					}
+				}else{
+					// the hidden input values don't exist in our servers array. however, they should exist.
+					// if we're here: 1) the hidden variables have either been manually changed, or 2) the user was removed from accessing the selected server while still on the page.
+					echo get_lang('malformed_form');
+				}
+			}else{
+				// An empty form was submitted.
+				echo get_lang('empty_form_data');
+			}
+		}else{
+			$return = array();
+			for($x = 0; $x < count($servers); ++$x){
+				$return[] = array(
+					'remote_server_id'		=>	$servers[$x]['remote_server_id'],
+					'ip'					=>	$servers[$x]['ip'],
+					'port'					=>	$servers[$x]['port'],
+					'home_id'				=>	$servers[$x]['home_id'],
+					'home_name'				=>	$servers[$x]['home_name'],
+					'game_name'				=>	$servers[$x]['game_name'],
+				);
+			}
+			
+			echo json_encode($return);
+		}
+	}else{
+		header('HTTP/1.0 403 Forbidden');
+		exit;
+	}
+?>

+ 74 - 0
modules/util/agents.php

@@ -0,0 +1,74 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	include 'util_config.php';
+	
+	session_name($sessionName);
+	session_start();
+	
+	if(!empty($_SESSION['user_id'])){
+		// This entire section is nothing but a big, messy, workaround.
+		// Make ogpLang happy.
+		$_REQUEST['m'] = 'util';
+		// We need to change directory to be able to include lib_remote and make a database connection without any errors
+		// This is becasue the following files include other files via their relative path rather than absolute path... could be fixed by editing them... but until then, this is just a hacky workaround.
+		$cwd = getcwd();
+		if(chdir('../../') === true){
+			require_once('includes/config.inc.php');
+			require_once('includes/helpers.php');
+			include_once("includes/lang.php");
+			ogpLang();
+			
+			require_once('includes/lib_remote.php');
+			
+			$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
+		}else{
+			die(get_lang('chdir_failed'));
+		}
+		
+		if(chdir($cwd) === false){
+			die(get_lang('chdir_failed'));
+		}
+		
+		// Actual script functions now.
+		$remoteServers = $db->getRemoteServers();
+		$servers = array();
+		
+		if(is_array($remoteServers)){
+			foreach($remoteServers as $server){
+				$remote = new OGPRemoteLibrary($server['agent_ip'], $server['agent_port'], $server['encryption_key'], 1);
+				$status = (int)$remote->status_chk();
+				
+				$servers[] = array(
+					'id'		=>	$server['remote_server_id'],
+					'name'		=>	$server['remote_server_name'] .' '. (($status) === 0 ? '('.get_lang('offline').')' : '('.get_lang('online').')'),
+					'status'	=>	$status,
+				);
+			}
+		}
+		echo json_encode($servers);
+	}else{
+		header('HTTP/1.0 403 Forbidden');
+		exit;
+	}
+?>

BIN
modules/util/img/uiTabsArrow.png


+ 115 - 0
modules/util/lang/Danish/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/English/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/French/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/German/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/Hungarian/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/Polish/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/Portuguese/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/Russian/modules/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 115 - 0
modules/util/lang/Spanish/util.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	define('module_name', 'Utilities');
+	
+	// Title translations for commands.
+	define('ping', 'Ping');
+	define('traceroute', 'Traceroute');
+	
+	// Tab titles
+	define('network_tools', 'Network Tools');
+	define('sourcemod_admins', 'Sourcemod Admins');
+	define('steam_converter', 'SteamID Converter');
+	
+	// Network Tools Related Translations.
+	define('your_ip', 'Your IP Address:');
+	define('loading_agents', 'Loading Online Agents...');
+	define('loading_failed', 'Loading Agents Failed.');
+	define('agents_offline', 'All agents are offline.');
+	define('no_commands', 'Sorry, your user account has no commands available.');
+	define('remote_target', 'Target Address:');
+	define('command', 'Command:');
+	define('select_agent', 'Select Agent:');
+	
+	// Status messages for networkt_tools.php
+	define('chdir_failed', 'Error: chdir() returned false.');
+	define('agent_invalid', 'Invalid agent specified.');
+	define('networktools_agent_offline', 'Unable to execute your command on the selected agent because it is offline.');
+	define('target_empty', 'No remote target given.');
+	define('command_empty', 'No command selected.');
+	define('command_unavilable', 'The selected command is unavailable on the selected agent.');
+	define('target_invalid', 'Invalid IP/hostname entered.');
+	define('exec_failed', 'Timed out while waiting for a response.');
+	define('command_no_access', 'You do not have access to this command. This incident will be logged.');
+	define('command_hacking_attempt', 'Blacklisted characters entered. This incident will be logged.');
+	
+	// Logging for network_tools.php
+	define('command_bad_characters', 'Attempted to execute a command with malicious characters. Input received: %s %s');
+	define('command_no_permissions', 'Attempted to execute a command with insufficient permissions. Input received: %s %s');
+	define('command_executed', 'Successfully sent the following command: %s %s');
+	
+	// Sourcemod Related Translations.
+	define('no_servers', 'You have no servers assigned to your account.');
+	define('select_server', 'Select Server:');
+	define('select_server_option', 'Select...');
+	define('steamid', 'Steam ID:');
+	define('immunity', 'Immunity:');
+	define('sourcemod_perms', 'Sourcemod Permissions:');
+	define('sourcemod_perm_root', 'Sourcemod Root Flag');
+	define('sourcemod_perm_custom', 'Sourcemod Custom Flags');
+	
+	// https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels
+	define('sourcemod_flag_a', 'Reserved slot access.');
+	define('sourcemod_flag_b', 'Generic admin; required for admins.');
+	define('sourcemod_flag_c', 'Kick other players.');
+	define('sourcemod_flag_d', 'Ban other players.');
+	define('sourcemod_flag_e', 'Remove bans.');
+	define('sourcemod_flag_f', 'Slay/harm other players.');
+	define('sourcemod_flag_g', 'Change the map or major gameplay features.');
+	define('sourcemod_flag_h', 'Change most CVARs.');
+	define('sourcemod_flag_i', 'Execute config files.');
+	define('sourcemod_flag_j', 'Special chat privileges.');
+	define('sourcemod_flag_k', 'Start or create votes.');
+	define('sourcemod_flag_l', 'Set a password on the server.');
+	define('sourcemod_flag_m', 'Use RCON commands.');
+	define('sourcemod_flag_n', 'Change sv_cheats or use cheating commands.');
+	define('sourcemod_flag_o', 'Custom Group 1.');
+	define('sourcemod_flag_p', 'Custom Group 2.');
+	define('sourcemod_flag_q', 'Custom Group 3.');
+	define('sourcemod_flag_r', 'Custom Group 4.');
+	define('sourcemod_flag_s', 'Custom Group 5.');
+	define('sourcemod_flag_t', 'Custom Group 6.');
+	
+	// Status messages for addadmin_helper.php
+	define('rcon_reload_admins_failed', 'Failed to reload the admin cache via RCON; is it online?');
+	define('reload_admins_failed', 'Failed to reload the admin cache; "sm_reloadadmins" is an unknown command.');
+	define('reload_admins_success', 'Successfully added %s to admins_simple.ini and reloaded the admin cache.');
+	define('add_success_no_rcon', 'Successfully added %s to your admins_simple.ini file, but unable to reload the admin cache.');
+	define('writefile_error', 'There was an unknown error writing to: %s');
+	define('remotefile_nonexistent', 'Unable to add a new admin. Admin file: %s doesn\'t exist on this server.');
+	define('empty_flag_list', 'You didn\'t select any admin flags.');
+	define('invalid_steam_format', 'The SteamID you entered doesn\'t match the required pattern.');
+	define('selected_server_offline', 'Unable to add an admin, the agent controlling the selected server is offline.');
+	define('malformed_form', 'You submitted a form with malformed hidden elements - unable to add an admin.');
+	define('empty_form_data', 'Please fill out all elements of the form.');
+	
+	define('server_not_selected', 'You haven\'t selected a server.');
+	define('invalid_steamid', 'You have entered an invalid Steam ID.');
+	define('invalid_immunity', 'You entered an invalid immunity value.');
+	
+	// Generic form translations.
+	define('submit', 'Submit');
+	define('post_failed', 'The POST action failed. Unable to retrieve a response.');
+	
+?>

+ 0 - 108
modules/util/ma_admin.php

@@ -1,108 +0,0 @@
-<table style="background-color:white;color:blue; margin-left:auto;margin-right:auto">
-<tr>
-<td>
-<?php 
-global $db;
-
-$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
-
-if ( $isAdmin )
-		$server_homes = $db->getIpPorts();
-	else
-		$server_homes = $db->getIpPortsForUser($_SESSION['user_id']);
-		
-$supported_games = array( "Counter Strike Global Offensive",
-						  "Counter Strike Source",
-						  "Day of Defeat: Source",
-						  "Half-Life 2: Deathmatch",
-						  "Team Fortress 2",
-						  "Team Fortress 2 Beta" );
-
-$i = 0;		
-foreach ($server_homes as $server_home)
-{
-	if ( in_array( $server_home['game_name'], $supported_games ) )
-		$ma_admin_server_homes[$i] = $server_home;
-	$i++;
-}
-
-if( isset( $_GET['sm_admin']) )
-	unset( $_GET['home_id-mod_id-ip-port'] );
-create_home_selector_address("util","",$ma_admin_server_homes);
-?>
-</td>
-</tr>
-<?php
-if ( empty( $_GET['home_id-mod_id-ip-port'] ) )
-	 unset( $_GET['home_id-mod_id-ip-port'] );
-if( isset( $_GET['home_id-mod_id-ip-port']) and !isset( $_GET['sm_admin']) )
-{
-	$pieces = explode( "-", $_GET['home_id-mod_id-ip-port'] );
-	$post_home_id = $pieces[0];
-	$post_mod_id = $pieces[1];
-	$ip = $pieces[2];
-	$port = $pieces[3];
-
-	if (isset($_POST['mani']))
-	{
-		if($_POST['asteamid'] == "" or $_POST['aname'] == "")
-		{
-			if($_POST['steamid'] == "")
-				print_failure('A steam_id is needed!');
-			if($_POST['aname'] == "")
-				print_failure('A nickname is needed!');
-		}
-		else
-		{
-			if($isAdmin) 
-				$server_home = $db->getGameHome($post_home_id);
-			else
-				$server_home = $db->getUserGameHome($_SESSION['user_id'],$post_home_id);
-			
-			$asteamid = '"'.$_POST['asteamid'].'"';
-			$rcommand = 'ma_client addclient '.$_POST['aname'].'; ma_client addsteam '.$_POST['aname'].' '.$asteamid.'; ma_client setaflag '.$_POST['aname'].' +#';
-			require_once('includes/lib_remote.php');
-			$remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
-			
-			$remote_retval = $remote->remote_send_rcon_command( $server_home['home_id'], $ip, $port, 'rcon2', $server_home['control_password'],'',$rcommand,$return);
-			if ( $remote_retval === -1 )
-			{
-				print_failure("Failed adding admin, the server may be down or the agent is offline.");
-			}
-			elseif ( $remote_retval === 1 )
-			{
-				if( preg_match('/Unknown command "ma_client"/i',$return) )
-					print_failure("Mani Admin Plugin is not properly installed in your server, the error was:<br><xmp>Unknown command \"ma_client\"</xmp>");
-				else
-					print_success("Admin added successfully.");
-			}
-			elseif ( $remote_retval === -10 )
-			{
-				print_failure("You must set the control password (rcon password) in order to add admins.");
-			}
-		}
-	}
-?>
-<tr>
-<td>
-<form action="" method="post">
-NickName
-<input type="text" name="aname" value="<?php echo (isset($_POST['aname']) and $_POST['aname'] != "") ? $_POST['aname'] : "";?>"/>
-</td>
-</tr>
-<tr>
-<td>
-Steam_ID
-<input type="text" name="asteamid" value="<?php echo (isset($_POST['asteamid']) and $_POST['asteamid'] != "") ? $_POST['asteamid'] : "";?>"/>
-</td>
-</tr>
-<tr>
-<td>
-<input name="mani" value="ADD ADMIN" type="submit"/>
-</form>
-</td>
-</tr>
-<?php
-}
-?>
-</table>

+ 1 - 1
modules/util/module.php

@@ -24,7 +24,7 @@
 
 // Module general information
 $module_title = "Util";
-$module_version = "1.0";
+$module_version = "2.0";
 $db_version = 0;
 $module_required = TRUE;
 $module_menus = array( array( 'subpage' => '', 'name'=>'Util', 'group'=>'user' ) );

+ 124 - 0
modules/util/network_tools.php

@@ -0,0 +1,124 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	include 'util_config.php';
+	
+	session_name($sessionName);
+	session_start();
+	
+	if(!empty($_SESSION['user_id'])){
+		// This entire section is nothing but a big, messy, workaround.
+		// Make ogpLang happy.
+		$_REQUEST['m'] = 'util';
+		// We need to change directory to be able to include lib_remote and make a database connection without any errors
+		// This is becasue the following files include other files via their relative path rather than absolute path... could be fixed by editing them... but until then, this is just a hacky workaround.
+		$cwd = getcwd();
+		if(chdir('../../') === true){
+			require_once('includes/config.inc.php');
+			require_once('includes/functions.php');
+			require_once('includes/helpers.php');
+			include_once("includes/lang.php");
+			ogpLang();
+			
+			require_once('includes/lib_remote.php');
+			$db = createDatabaseConnection($db_type, $db_host, $db_user, $db_pass, $db_name, $table_prefix);
+		}else{
+			die(get_lang('chdir_failed'));
+		}
+		
+		if(chdir($cwd) === false){
+			die(get_lang('chdir_failed'));
+		}
+		
+		// Actual script functions now.
+		$userInfo = $db->getUserById($_SESSION['user_id']);
+		$userRole = $userInfo['users_role'];
+		
+		$command = trim($_POST['command']);
+		$target = trim($_POST['remote_target']);
+		
+		// Check if the specified agent exists. If it does, assign it to $servers. Otherwise, return that it's an invalid agent.
+		if(($server = $db->getRemoteServerById($_POST['agent'])) === false){
+			die(get_lang('agent_invalid'));
+		}
+		
+		$remote = new OGPRemoteLibrary($server['agent_ip'], $server['agent_port'], $server['encryption_key'], 60);
+		
+		if($remote->status_chk() === 0){
+			echo get_lang('networktools_agent_offline');
+		}elseif(empty($target)){
+			echo get_lang('target_empty');
+		}elseif(empty($command)){
+			echo get_lang('command_empty');
+		}else{
+			$os = preg_match("/CYGWIN/", $remote->what_os()) ? 'windows' : 'linux';
+			
+			// Loop over $availableCommands from util_config.php
+			// Assign a variable, $allowAccess based on the current user's role and if the config file states the user's role is allowed access to this command.
+			for($x = 0; $x < count($availableCommands); ++$x){
+				if($availableCommands[$x]['title'] == $command){
+					$command = $availableCommands[$x][$os];
+					$allowAccess  = $availableCommands[$x][$userRole];
+				}
+			}
+			
+			if(isset($allowAccess) && $allowAccess === true){
+				// Check the command is available to us. If it's not, echo command_unavilable
+				$which = $remote->exec('which '.$command);
+				if(empty($which)){
+					echo get_lang('command_unavilable');
+				}else{
+					// Not completely necessary - gethostbyaddr(gethostbyname()) will return false if it's anything that's not valid.
+					// This is mostly for logging attempted arbitrary commands.
+					if(strpbrk($target, $blockedCharacters)){
+						if($logMaliciousUsage){
+							$db->logger(get_lang_f('command_bad_characters', $command, htmlentities($target)));
+						}
+						echo get_lang('command_hacking_attempt');
+					}else{
+						$target = gethostbyaddr(gethostbyname($target));
+						if(!$target){
+							echo get_lang('target_invalid');
+						}else{
+							$exec = $remote->exec($command.' '.$target);
+							echo ($exec === null) ? get_lang('exec_failed') : htmlentities(trim($exec));
+							if($logAllUsage){
+								$db->logger(get_lang_f('command_executed', $command, htmlentities($target)));
+							}
+						}
+					}
+				}
+			}else{
+				// If the user isn't allowed access but they've somehow got this far then they've changed the value="" attr.
+				// return with command_no_permissions and log the event.
+				echo get_lang('command_no_access');
+				if($logMaliciousUsage){
+					$db->logger(get_lang_f('command_no_permissions', $command, htmlentities($target)));
+				}
+			}	//else allowAccess
+		}	// else status_chk / empty target / empty command
+	}else{//_SESSION check.
+		header('HTTP/1.0 403 Forbidden');
+		exit;
+	}
+?>

+ 0 - 54
modules/util/ping.php

@@ -1,54 +0,0 @@
-<?php
-create_home_selector("util","",$server_homes); 
-if( isset( $_GET['home_id']) )
-{
-	
-	if ( isset($_SERVER["REMOTE_ADDR"]) )
-	{
-		$client_ip = $_SERVER["REMOTE_ADDR"];
-	}
-	elseif ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) )
-	{
-		$client_ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
-	} 
-	elseif( isset($_SERVER["HTTP_CLIENT_IP"]) )
-	{
-		$client_ip = $_SERVER["HTTP_CLIENT_IP"]; 
-	}
-	?>
-	<form method="post" action="">
-	<input name="ping" type="submit" value="PING SERVER" />
-	</form>
-	<?php 
-	if(isset($_POST['ping']))
-	{
-		$ip = $client_ip;
-		
-		if(!empty($ip)) 
-		{
-			$ping = "";
-			$home_info = $db->getGameHomeWithoutMods($server_home['home_id']);
-			require_once('includes/lib_remote.php');
-			$remote = new OGPRemoteLibrary($home_info['agent_ip'],$home_info['agent_port'],$home_info['encryption_key'],$home_info['timeout']);
-			$os = $remote->what_os();
-			if(preg_match("/CYGWIN/",$os)) 
-			{
-				$exec = $remote->exec("ping -n 1 -l 64 ".$ip);
-				$ping = end(explode(" ", $exec ));
-			}
-			else 
-			{
-				$exec = $remote->exec("ping -c 1 -s 64 -t 64 ".$ip);
-				$array = explode("/", end(explode("=", $exec )) );
-				$ping = ceil($array[1]) . 'ms';
-			}
-		}
-		?><p style="color:blue;text-align:center;">Server IP: <?php 
-		echo $server_home['agent_ip'];
-		echo " --> ".$ping." --> ";
-		?>Your IP: <?php 
-		echo $ip;
-		?></p><?php 
-	}
-}
-?>

+ 0 - 195
modules/util/sm_admin.php

@@ -1,195 +0,0 @@
-<table style="background-color:white;color:blue; margin-left:auto;margin-right:auto">
-<tr>
-<td>
-<?php 
-global $db;
-
-$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
-
-if ( $isAdmin )
-		$server_homes = $db->getIpPorts();
-	else
-		$server_homes = $db->getIpPortsForUser($_SESSION['user_id']);
-		
-$supported_games = array( "Counter Strike Global Offensive",
-						  "Counter Strike Source",
-						  "Day of Defeat: Source",
-						  "Dystopia",
-						  "Garrys Mod",
-						  "Half-Life 2: Deathmatch",
-						  "Hidden: Source",
-						  "Pirates, Vikings and Knights II",
-						  "Team Fortress 2",
-						  "Team Fortress 2 Beta",
-						  "Left 4 Dead",
-						  "Left 4 Dead 2" );
-
-
-$admin_flags = array( "a" => "Reserved slot access.",
-					  "b" => "Generic admin; required for admins.",
-					  "c" => "Kick other players.",
-					  "d" => "Ban other players.",
-					  "e" => "Remove bans.",
-					  "f" => "Slay/harm other players.",
-					  "g" => "Change the map or major gameplay features.",
-					  "h" => "Change most cvars.",
-					  "i" => "Execute config files.",
-					  "j" => "Special chat privileges.",
-					  "k" => "Start or create votes.",
-					  "l" => "Set a password on the server.",
-					  "m" => "Use RCON commands.",
-					  "n" => "Change sv_cheats or use cheating commands." );
-
-$i = 0;		
-foreach ($server_homes as $server_home)
-{
-	if ( in_array( $server_home['game_name'], $supported_games ) )
-		$sm_admin_server_homes[$i] = $server_home;
-	$i++;
-}
-if( !isset( $_GET['sm_admin']) )
-{
-	$select = $_GET['home_id-mod_id-ip-port'];
-	unset( $_GET['home_id-mod_id-ip-port'] );
-}
-create_home_selector_address("util","",$sm_admin_server_homes);
-
-?>
-<script type="text/javascript">
-var theForm = document.forms['select'];
-var input = document.createElement('input');
-    input.type = 'hidden';
-    input.name = 'sm_admin';
-    theForm.appendChild(input);
-</script>
-</td>
-</tr>
-<?php
-if ( empty( $_GET['home_id-mod_id-ip-port'] ) )
-	 unset( $_GET['home_id-mod_id-ip-port'] );
-if( isset( $_GET['home_id-mod_id-ip-port'] ) and isset( $_GET['sm_admin'] ) )
-{
-	$pieces = explode( "-", $_GET['home_id-mod_id-ip-port'] );
-	$home_id = $pieces[0];
-	$mod_id = $pieces[1];
-	$ip = $pieces[2];
-	$port = $pieces[3];
-		
-	if($isAdmin) 
-		$server_home = $db->getGameHome($home_id);
-	else
-		$server_home = $db->getUserGameHome($_SESSION['user_id'],$home_id);
-
-	$_SESSION['inmunityLvl'] = $_POST['ainmunity'];
-	if(isset($_POST['sm_admin']))
-	{
-		if($_POST['asteamid'])
-			print_failure('A steam_id is needed!');
-		
-		$flagsStr = "";
-		foreach($_POST as $key => $val)
-		{
-			if(preg_match('/flag_/',$key))
-				$flagsStr .= $val;
-		}
-		$inmunityLvl = $_POST['ainmunity'] != '0' ? $_POST['ainmunity'].':' : "";
-		if($_POST['steamid'] == "" or $flagsStr == "")
-		{
-			if($_POST['steamid'] == "")
-				print_failure('A steam_id is needed!');
-			if($flagsStr == "")
-				print_failure('Must select at least 1 flag!');
-		}
-		else
-		{
-			$admins_simple_location = $server_home['home_path']."/".$server_home['mods'][$mod_id]['mod_key']."/addons/sourcemod/configs/admins_simple.ini";
-			require_once('includes/lib_remote.php');
-			$remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
-			if($remote->rfile_exists($admins_simple_location) != 1)
-				print_failure("SourceMod is not properly installed in your server,<br>/".$server_home['mods'][$mod_id]['mod_key']."/addons/sourcemod/configs/admins_simple.ini does not exist!");
-			else
-			{
-				$remote->remote_readfile($admins_simple_location,$file_content);
-				
-				$replace = FALSE;
-				if(preg_match("/".$_POST['steamid']."/i",$file_content))
-					$replace = TRUE;
-					
-				if($replace)
-					$file_content = preg_replace("/.*".$_POST['steamid'].".*/i","\"".$_POST['steamid']."\"\t\t\"$inmunityLvl$flagsStr\"",$file_content);
-				else
-					$file_content .= "\n\"".$_POST['steamid']."\"\t\t\"$inmunityLvl$flagsStr\"";
-				
-				$remote->remote_writefile($admins_simple_location, $file_content);
-				print_success("Admin added/changed successfully at admins_simple.ini");
-				$remote_retval = $remote->remote_send_rcon_command( $server_home['home_id'], $ip, $port, 'rcon2', $server_home['control_password'],'',"sm_reloadadmins",$return);
-				if ( $remote_retval === -1 )
-				{
-					print_failure("Failed to reload admins, the server may be down or the agent is offline.");
-				}
-				elseif ( $remote_retval === 1 )
-				{
-					if( preg_match('/Admin cache has been refreshed/i',$return) )
-						print_success("Admin cache has been refreshed.");
-					else
-						print_failure("SourceMod is not properly installed in your server, the error was:<br><xmp>".$return."</xmp>");
-				}
-				elseif ( $remote_retval === -10 )
-				{
-					print_failure("You must set the control password (rcon password)<br>in order to reload admins without restarting the server,<br>the new admin will be loaded once the server is restarted.");
-				}
-			}
-		}
-	}
-?>
-<tr>
-<td>
-<form action="" method="post">
-<tr>
-<td>
-Steam_ID
-<input type="text" name="steamid" value="<?php echo (isset($_POST['steamid']) and $_POST['steamid'] != "") ? $_POST['steamid'] : "";?>" />
-</td>
-</tr>
-<tr>
-<td>
-Inmunity level
-<input type="number" name="ainmunity" min="0" max="99" value="<?php echo isset($_SESSION['inmunityLvl']) ? $_SESSION['inmunityLvl'] : "99";?>"/><br>
-<em>Every admin can have an arbitrary immunity value assigned to them.</em>
-<br>
-<em>Whether an admin can target another admin depends on who has a higher immunity value.</em>
-</td>
-</tr>
-<tr>
-<td>
-Admin Flags
-<?php
-$selected = ( isset( $_POST['flags'] ) and $_POST['flags'] == "custom" ) ? "selected='selected'" : "";
-echo "<select name='flags' onchange='this.form.submit();'>\n".
-	 "<option value='z' >Root Admin</option>\n".
-	 "<option value='custom' $selected>Customize Flags</option>\n".
-	 "</select>\n<br>\n";
-if( isset( $_POST['flags'] ) and $_POST['flags'] == "custom" )
-{
-	foreach($admin_flags as $flag => $desc )
-	{
-		echo "<input type='checkbox' name='flag_$flag' value='$flag' />$desc\n<br>\n";
-	}
-}
-else
-	echo "<input type='hidden' name='flag_z' value='z' />";
-?>
-</td>
-</tr>
-<tr>
-<td>
-<input name="sm_admin" value="ADD ADMIN" type="submit"/>
-</form>
-</td>
-</tr>
-<?php
-}
-else
-	$_GET['home_id-mod_id-ip-port'] = $select;
-?>
-</table>

+ 96 - 97
modules/util/steamid_converter.php

@@ -1,105 +1,104 @@
-<?php /*
-SteamID conversion tool by 8088 & KoST
-For more info, visit AlliedModders @ http://forums.alliedmods.net/showthread.php?t=60899
-*/
-?>
-<form method="get" action="">
-	<div >
-		<fieldset style="color:white;background-color:DarkSlateGray">
-			<legend  style="background-color:DarkSlateGray;color:white">Input</legend>
-			<table>
-				<tbody style="color:white;background-color:DarkSlateGray">
-					<tr>
-						<td>SteamID / FriendID / customURL:<br>
-							<input type="hidden" size="70" name="m" value="<?php echo $_GET['m']; ?>">
-							<input type="text" size="70" name="s" value="<?php echo htmlentities(stripslashes(@$_GET['s']),ENT_QUOTES); ?>">
-						</td>
-					</tr>
-					<tr>
-						<td align="right">
-							<input class="button" type="submit" accesskey="s" value="Submit">
-						</td>
-					</tr>
-				</tbody>
-			</table>
-		</fieldset>
-	</div>
-</form>
-
 <?php
-$ret=get_input_type(@$_GET['s']);
-if ($ret==''){
-
-}else if (is_string($ret)){
-	echo '<div><fieldset style="background-color:DarkSlateGray;color:white"><legend style="background-color:DarkSlateGray;color:white">Output</legend><table><tbody style="background-color:DarkSlateGray;color:white"><tr><td>';
-	echo $ret;
-	echo '</td></tr></tbody></table></fieldset>';
-	if ($_GET['s']!=='') {	echo $notice; }
-	echo '</div>';
-}else if (is_array($ret)){
-	echo '<div><fieldset style="background-color:DarkSlateGray;color:white"><legend style="background-color:DarkSlateGray;color:white">Output</legend><table><tbody style="background-color:DarkSlateGray;color:white"><tr><td>';
-	convert($ret['type'],$ret['data']);
-	echo '</td></tr></tbody></table></fieldset>';
-	if ($_GET['s']!=='') {	echo @$notice;}
-	echo '</div>';
-}
-
-function convert($type,$data){
-	switch($type){
-		case 'steamid':
-		$main='http://steamcommunity.com/profiles/'.bcadd((($data['auth']*2)+$data['server']),'76561197960265728');
-		echo 'FriendID: <a href="'.$main.'" title="Visit Steam Community page" target="blank">'.bcadd((($data['auth']*2)+$data['server']),'76561197960265728').'</a>';
-		break;
-		case 'friendid':
-		if (substr($data,-1)%2==0) $server=0; else $server=1;
-		$auth=bcsub($data,'76561197960265728');
-		if (bccomp($auth,'0')!=1) {echo "Error: invalid FriendID or SteamID";return;}
-		$auth=bcsub($auth,$server);
-		$auth=bcdiv($auth,2);
-		echo "SteamID for VALVe's GoldSrc and Source Orange Box Engine games:<br>".
-			 'STEAM_0:'.$server.':'.$auth;
-		echo "<br><br>SteamID for VALVe's newer games:<br>".
-			 'STEAM_1:'.$server.':'.$auth;
-		break;
-	}
-}
-
-function get_input_type($data){
-	$data=strtolower(trim($data));
-	if ($data!='') {
-		if (strlen($data)>80) return "too long";
-		if (substr($data,0,7)=='steam_0' or substr($data,0,7)=='steam_1') {
-			$tmp=explode(':',$data);
-			if ((count($tmp)==3) && is_numeric($tmp[1]) && is_numeric($tmp[2])){
-				return array('type'=>'steamid','data'=>array('auth'=>$tmp[2],'server'=>$tmp[1]));
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	include 'util_config.php';
+	
+	session_name($sessionName);
+	session_start();
+	
+	if(!empty($_SESSION['user_id']) && $_SERVER['REQUEST_METHOD'] === 'POST'){
+		function toCommunityID($id){
+			if(preg_match('/^STEAM_/', $id)){
+				$parts = explode(':', $id);
+				return bcadd(bcadd(bcmul($parts[2], '2'), '76561197960265728'), $parts[1]);
+			}elseif(is_numeric($id) && strlen($id) < 16){
+				return bcadd($id, '76561197960265728');
 			}else{
-				return "Error: invalid SteamID";
+				return $id;
 			}
-		}else if ($p=strrpos($data,'/')){
-			$tmp=explode('/',$data);
-			foreach ($tmp as $item){
-				if (is_numeric($item)){
-					$a=$item;
-					break;
-				}
+		}
+		
+		function toSteamID($id){
+			if(is_numeric($id) && strlen($id) >= 16){
+				$z = bcdiv(bcsub($id, '76561197960265728'), '2');
+			}elseif(is_numeric($id)){
+				$z = bcdiv($id, '2');
+			}else{
+				return $id;
+			}
+			
+			$y = bcmod($id, '2');
+			return 'STEAM_0:'.$y.':'.floor($z);
+		}
+		
+		function toUserID($id){
+			if(preg_match('/^STEAM_/', $id)){
+				$split = explode(':', $id);
+				return $split[2] * 2 + $split[1];
+			}elseif(preg_match('/^765/', $id) && strlen($id) > 15){
+				return bcsub($id, '76561197960265728');
+			}else{
+				return $id;
 			}
-			if ((is_numeric($a)) && (preg_match('/7656119/', $a))) return array('type'=>'friendid','data'=>$a);
-			else {
-				$xml = @simplexml_load_file($data."?xml=1");
-				$steamid64=$xml->steamID64;
-				if (!preg_match('/7656119/', $steamid64)) return "Error: invalid link";
-				else return array('type'=>'friendid','data'=>$steamid64);
+		}
+		
+		function getSteamId($input){
+			$xml = simplexml_load_file('http://steamcommunity.com/id/'.$input.'?xml=1');
+			$steamId64 = $xml->steamID64;
+			
+			if(preg_match('/^765/', $steamId64) === 0){
+				return false;
+			}else{
+				return (string)$steamId64;	// Cast it to a string, otherwise an SimpleXMLElement Object will be returned.
+			}
+		}
+		
+		function convert($id){
+			if(preg_match('/^\[U:1:[0-9]+\]/', $id)){
+				$id = substr($id, 5, -1);
+			}
+			
+			// Check if the input is in legacyId, communityId, or SteamId3 format.
+			// If it's not, assume it's a custom Id and attempt to get the communityId from what the user entered.
+			if(preg_match('/^STEAM_[01]:[01]:\d+$/', $id) === 0 && preg_match('/^[0-9]/', $id) === 0 && preg_match('/^765/', $id) === 0){
+				if(($steamId = getSteamId($id)) === false){
+					return json_encode(array());
+				}
+				
+				$id = $steamId;
 			}
-		}else if ((is_numeric($data)) && (preg_match('/7656119/', $data))){
-			return array('type'=>'friendid','data'=>$data);
-		}else{
-			$xml = @simplexml_load_file("http://steamcommunity.com/id/".$data."?xml=1");
-			$steamid64=$xml->steamID64;
-			if (!preg_match('/7656119/', $steamid64)) return "Error: invalid input";
-			else return array('type'=>'friendid','data'=>$steamid64);
+			
+			return json_encode(array(
+				'communityId'	=>	toCommunityID($id),
+				'steamId'		=>	toSteamID($id),
+				'steamId3'		=>	'[U:1:'.toUserID($id).']',
+				'steamProfile'	=>	'<a href="http://steamcommunity.com/profiles/'.toCommunityID($id).'">Steam Profile</a>',
+			));
 		}
-	}else{
-		return "";
+		
+		echo convert($_POST['steam_input']);
+	}else{//_SESSION check.
+		header('HTTP/1.0 403 Forbidden');
+		exit;
 	}
-}
 ?>

+ 101 - 0
modules/util/util.css

@@ -0,0 +1,101 @@
+input[type=text], input[type=number], select {
+    width:100%;
+    padding:6px 10px;
+    margin:8px 0;
+    display:inline-block;
+    border:1px solid #ccc;
+    border-radius:4px;
+    box-sizing:border-box;
+}
+
+.main-content{
+	text-align:left;
+}
+
+.show{display:block;}
+.hide{display:none;}
+
+#tabs {
+	background:transparent;
+	border:none;
+}
+
+#tabs .ui-widget-header{
+	background:transparent;
+	border:none;
+	border-bottom:1px solid #c0c0c0;
+	-moz-border-radius:0px;
+	-webkit-border-radius:0px;
+	border-radius:0px;
+}
+
+#tabs .ui-tabs-nav .ui-state-default{
+	background:transparent;
+	border:none;
+}
+
+#tabs .ui-tabs-nav .ui-state-active{
+	background:transparent url('img/uiTabsArrow.png') no-repeat bottom center;
+	border:none;
+}
+
+#tabs .ui-tabs-nav .ui-state-default a{
+	color:#c0c0c0;
+}
+
+#tabs .ui-tabs-nav .ui-state-active a{
+	color:#459e00;
+}
+
+#your-address{
+	cursor:pointer;
+	color:#2780e3;
+	font-weight:bold;
+}
+
+#select_agent{
+	margin-top:10px;
+	margin-bottom:10px;
+}
+
+#loading{
+	border:16px solid #f3f3f3;
+	border-radius:50%;
+	border-top:16px solid #3498db;
+	width:64px;
+	height:64px;
+	-webkit-animation:spin 2s linear infinite;
+	animation:spin 2s linear infinite;
+	margin:auto;
+}
+
+@-webkit-keyframes spin{
+	0%{-webkit-transform: rotate(0deg);}
+	100%{-webkit-transform: rotate(360deg);}
+}
+
+@keyframes spin{
+	0%{transform:rotate(0deg);}
+	100%{transform:rotate(360deg);}
+}
+
+/* IDs for messages. Customize their style output here. */
+#loading_agents{}
+#loading_failed{}
+#no_commands{}
+#agents_offline{}
+
+#no_servers{}
+#invalid_server{}
+#invalid_steamid_admin{}
+#invalid_response_admin{}
+#invalid_immunity{}
+#all_servers_offline{}
+#addadmin_response{}
+
+#invalid_steamid{}
+#invalid_response{}
+
+/* IDs for the command output and network tools tab here. Customize their style here. */
+#options{}
+#output{}

+ 361 - 49
modules/util/util.php

@@ -22,58 +22,370 @@
  *
  */
  
- 
 function exec_ogp_module() 
 {
+	global $db;
+	include 'util_config.php';
+	
+	$userInfo = $db->getUserById($_SESSION['user_id']);
+	$userRole = $userInfo['users_role'];
+	$commands = array();
+	
+	foreach($availableCommands as $command){
+		if($userRole == 'admin' && $command['admin'] === true){
+			$commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
+		}
+		
+		if($userRole == 'user' && $command['user'] === true){
+			$commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
+		}
+		
+		if($userRole == 'subuser' && $command['subuser'] === true){
+			$commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
+		}
+	}
 ?>
-<h2>Util</h2>
-	<table style="margin-left:auto;margin-right:auto">
-		<tr style="background-color:black">
-			<td style="background-color:cyan; text-align:center;">
-				<h1>Add an admin on SourceMod</h1>
-			</td>
-		</tr>
-		<tr >	
-			<td style="background-color:cyan; text-align:center;">
-			<?php  require("modules/util/sm_admin.php"); ?>
-			</td>
-		</tr>
-		<tr style="background-color:black">
-			<td style="background-color:orange; text-align:center;">
-				<h1>Add an admin on Mani Admin Plugin</h1>
-			</td>
-		</tr>
-		<tr >	
-			<td style="background-color:orange; text-align:center;">
-			<?php  require("modules/util/ma_admin.php"); ?>
-			</td>
-		</tr>
-		<tr style="background-color:black">
-			<td style="background-color:green; text-align:center;">
-				<h1>Ping Servers</h1>
-			</td>
-		</tr>
-		<tr>
-			<td style="background-color:green; text-align:center;">
-				<?php  require("modules/util/ping.php"); ?>
-			</td>
-		</tr>
-		<tr style="background-color:DarkSlateGray">
-			<td style="background-color:DarkSlateGray;text-align:center;">
-				<h1 style="color:white;" >SteamID Converter</h1>
-			</td>
-		</tr>
-		<tr>
-			<td>
-			<?php  require("modules/util/steamid_converter.php"); ?>
-			</td>
-		</tr>
-		<tr>
-			<td>
-				&nbsp;</b><br><br>
-			</td>
-		</tr>
-	</table>
+<h2><?php echo get_lang('module_name'); ?></h2>
+<div id="tabs">
+	<ul>
+		<li><a href="#tabs-1"><?php echo get_lang('network_tools'); ?></a></li>
+		<li><a href="#tabs-2"><?php echo get_lang('sourcemod_admins'); ?></a></li>
+		<li><a href="#tabs-3"><?php echo get_lang('steam_converter'); ?></a></li>
+	</ul>
+	
+	<div id="tabs-1">
+		<div>
+			<span id="loading_agents" class="show"><?php echo get_lang('loading_agents'); ?></span>
+			<span id="loading_failed" class="hide"><?php echo get_lang('loading_failed'); ?></span>
+			<span id="no_commands" class="hide"><?php echo get_lang('no_commands'); ?></span>
+			<span id="agents_offline" class="hide"><?php echo get_lang('agents_offline'); ?></span>
+		</div>
+		
+		<div id="options" class="hide">
+			<div><?php echo get_lang('your_ip'); ?> <span id="your-address"><?php echo getClientIPAddress(); ?></span></div>
+			<form action="" method="POST" id="network_tools">
+				<div id="select_agent"></div>
+				
+				<label for="command"><?php echo get_lang('command'); ?></label>
+				<select id="command" name="command"><?php echo implode('', $commands); ?></select>
+				
+				<label for="remote_target"><?php echo get_lang('remote_target'); ?></label>
+				<input type="text" id="remote_target" name="remote_target" required>
+				<button type="submit"><?php echo get_lang('submit'); ?></button>
+			</form>
+		</div>
+		
+		<div id="loading" class="hide"></div>
+		<div id="output" class="hide"></div>
+	</div><!--/#tabs-1-->
+	
+	<div id="tabs-2">
+		<div>
+			<div>
+				<span id="no_servers" class="hide"><?php echo get_lang('no_servers'); ?></span>
+			</div>
+			
+			<div id="add_admin" class="hide">
+				<form action="" method="POST" id="addadmin_form">
+					<div id="games"></div>
+					
+					<label for="addSteamid"><?php echo get_lang('steamid'); ?></label>
+					<input type="text" id="addSteamid" name="addSteamid" pattern="^STEAM_[01]:[01]:\d+$" required>
+					
+					
+					<label for="immunity"><?php echo get_lang('immunity'); ?></label>
+					<input type="number" id="immunity" name="immunity" min="1" max="99">
+					
+					<label for="sourcemod_perms"><?php echo get_lang('sourcemod_perms'); ?></label>
+					<select id="sourcemod_perms" name="sourcemod_perms">
+						<option value="root"><?php echo get_lang('sourcemod_perm_root'); ?></option>
+						<option value="custom"><?php echo get_lang('sourcemod_perm_custom'); ?></option>
+					</select>
+					
+					<div id="sourcemod_flagList" class="hide">
+						<fieldset>
+							<?php
+								foreach(range('a', 't') as $flag){
+							?>
+							
+							<div class="item">
+								<input type="checkbox" id="flag_<?php echo $flag; ?>" name="flags[]" value="<?php echo $flag; ?>">
+								<label for="flag_<?php echo $flag; ?>"><?php echo get_lang('sourcemod_flag_'.$flag); ?></label>
+							</div>
+							
+							<?php
+								}
+							?>
+						</fieldset>
+					</div>
+					
+					<input type="hidden" name="remote_server_id" id="remote_server_id" value="">
+					<input type="hidden" name="gameserver_name" id="gameserver_name" value="">
+					<input type="hidden" name="gameserver_ip" id="gameserver_ip" value="">
+					<input type="hidden" name="gameserver_port" id="gameserver_port" value="">
+					
+					<button type="submit"><?php echo get_lang('submit'); ?></button>
+				</form>
+			</div>
+			
+			<div id="invalid_server" class="hide"><?php echo get_lang('server_not_selected'); ?></div>
+			<div id="invalid_steamid_admin" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
+			<div id="invalid_response_admin" class="hide"><?php echo get_lang('post_failed'); ?></div>
+			<div id="invalid_immunity" class="hide"><?php echo get_lang('invalid_immunity'); ?></div>
+			
+			<div id="all_servers_offline" class="hide"><?php echo get_lang('agents_offline'); ?></div>
+			
+			<div id="addadmin_response" class="hide"></div>
+		</div>
+	</div><!--/#tabs-2-->
+	
+	<div id="tabs-3">
+		<div>
+			<form action="" method="POST" id="steam_converter">
+				<label for="steam_input">SteamID / SteamID3 / SteamID64 / CustomID:</label>
+				<input type="text" name="steam_input" id="steam_input" required>
+				
+				<button type="submit"><?php echo get_lang('submit'); ?></button>
+			</form>
+		</div>
+		
+		<div id="invalid_steamid" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
+		<div id="invalid_response" class="hide"><?php echo get_lang('post_failed'); ?></div>
+		
+		<div id="steam_info">
+			<div id="steamLink"></div>
+			<div id="steamId"></div>
+			<div id="steamId3"></div>
+			<div id="steamId64"></div>
+		</div>
+	</div><!--/#tabs-3-->
+</div> <!--/#tabs-->
+
+<script>
+	$(function(){
+		$("#tabs").tabs();
+		$("#loading").removeClass('hide').addClass('show');
+		
+		// Load the agents via an external script so the user isn't waiting an eternity if they have several agents and multiple are offline
+		$.getJSON("/modules/util/agents.php", function(data){
+			var agents = "";
+			var agentsOnline = 0;
+			
+			$("#loading_agents").removeClass('show').addClass('hide');
+			$("#loading").removeClass('show').addClass('hide');
+			$("#options").removeClass('hide').addClass('show');
+			
+			agents += "<label for=\"agent\"><?php echo get_lang('select_agent'); ?></label>\r\n"
+			agents += "<select id=\"agent\" name=\"agent\">\r\n"
+			
+			for(var i = 0; i<data.length; ++i){
+				agents += "\t<option value=\"" + data[i]['id'] + "\"" + (data[i]['status']===0?" disabled":"") + ">" + data[i]['name'] +"</option>\r\n";
+				
+				if(data[i]['status'] == 1){
+					++agentsOnline;
+				}
+			}
+			
+			agents += "</select>";
+			
+			if(agentsOnline == 0){
+				$("#options").removeClass('show').addClass('hide');
+				$("#agents_offline").removeClass('hide').addClass('show');
+				
+				// Hide the sourcemod add admin form if all agents are offline.
+				$("#addadmin_form").addClass('hide');
+				$("#all_servers_offline").removeClass('hide').addClass('show');
+			}else if($("#command option").length == 0){
+				$("#options").removeClass('show').addClass('hide');
+				$("#no_commands").removeClass('hide').addClass('show');
+			}else{
+				$("#select_agent").html(agents);
+			}
+		}).fail(function(){
+			$("#loading_agents").removeClass('show').addClass('hide');
+			$("#loading").removeClass('show').addClass('hide');
+			$("#loading_failed").removeClass('hide').addClass('show');
+		});
+		
+		// Handle the network_tools form.
+		$("#network_tools").on("submit", function(e){
+			var target = $("#remote_target").val();
+			var agent = $("#agent").val();
+			var command = $("#command").val();
+			
+			// Some validation browser-side. Still need to do the same server-side.
+			if(target.length === 0){
+				// target input is empty.
+				$("#output").removeClass('hide').addClass('show').html("<pre><?php echo get_lang('target_empty'); ?></pre>");
+			}else if(agent.length === 0){
+				// We'll only get to this point if there's no agents, or all agents are offline but the form was still submitted.
+				$("#output").removeClass('hide').addClass('show').html("<pre><?php echo get_lang('agent_invalid'); ?></pre>");
+			}else if(command.length === 0){
+				// We'll only get to this point if there's no command specified.
+				$("#output").removeClass('hide').addClass('show').html("<pre><?php echo get_lang('command_empty'); ?></pre>");
+			}else{
+				$("#loading").removeClass('hide').addClass('show');
+				$("#output").removeClass('show').addClass('hide')
+				
+				$("#network_tools button").prop({disabled:true}); // Disable the submit button if we're about to post - preventing stuff being ran several times via spamming the button and/or enter.
+				$.post("/modules/util/network_tools.php", $("#network_tools").serialize(), function(postCommand){
+					$("#loading").removeClass('show').addClass('hide');
+					$("#output").removeClass('hide').addClass('show').html("<pre>" + postCommand + "</pre>");
+					
+					$("#network_tools button").prop({disabled:false});
+				}).fail(function(){
+					$("#loading").removeClass('show').addClass('hide');
+					$("#output").removeClass('hide').addClass('show').html("<pre><?php echo get_lang('post_failed'); ?></pre>");
+					
+					$("#network_tools button").prop({disabled:false});
+				});
+			}
+			e.preventDefault();
+		});// ./end network_tools form handling.
+		
+		// ----- Sourcemod Admins -----
+		$.getJSON("/modules/util/addadmin_helper.php", function(gs){
+			if(gs.length === 0){
+				$("#no_servers").removeClass('hide').addClass('show');
+			}else{
+				var games = "";
+				$("#add_admin").removeClass('hide').addClass('show');
+				
+				games += "<label for=\"gameserver_id\"><?php echo get_lang('select_server'); ?></label>\r\n"
+				games += "<select id=\"gameserver_id\" name=\"gameserver_id\">\r\n"
+				games += "<option value=\"0\" selected><?php echo get_lang('select_server_option'); ?></option>\r\n"
+				
+				for(var i = 0; i<gs.length; ++i){
+					games += "\t<option value=\"" + gs[i]['home_id'] + "\">" + gs[i]['home_name'] +"</option>\r\n";
+				}
+				
+				games += "</select>";
+				$("#games").html(games);
+				
+				$("#gameserver_id").change(function(){
+					var home = $("#gameserver_id").val();
+					var gameserver_id = $("#gameserver_id").val();
+					
+					// although the disabled attribute is put on the option, set all the values to 0 if it's somehow chosen again via the form being edited
+					if(gameserver_id == 0){
+						$("#remote_server_id").val(0);
+						$("#gameserver_name").val(0);
+						$("#gameserver_ip").val(0);
+						$("#gameserver_port").val(0);
+					}else{
+						for(var i = 0; i<gs.length; ++i){
+							if(home === gs[i]['home_id']){
+								$("option[value='0']").attr("disabled", "disabled");
+								$("#remote_server_id").val(gs[i]['remote_server_id']);
+								$("#gameserver_name").val(gs[i]['game_name']);
+								$("#gameserver_ip").val(gs[i]['ip']);
+								$("#gameserver_port").val(gs[i]['port']);
+								break;
+							}
+						}
+					}
+				});
+			}
+		}); // ./end Sourcemod Admins
+		
+		$("#sourcemod_perms").change(function(){
+			var sourcemod_perms = $("#sourcemod_perms").val();
+			
+			if(sourcemod_perms === 'root'){
+				$("#sourcemod_flagList").removeClass('show').addClass('hide');
+				$('.item input[type="checkbox"]').prop('checked', false);
+			}else{
+				$("#sourcemod_flagList").removeClass('hide').addClass('show');
+			}
+		});
+		
+		// Process the sourcemod admin form on submission.
+		$("#addadmin_form").on("submit", function(e){
+			$("#addadmin_form button").prop({disabled:true});
+			
+			var errors = 0;
+			var remoteId = $("#remote_server_id").val();
+			var gameName = $("#gameserver_name").val();
+			var gameIp = $("#gameserver_ip").val();
+			var gamePort = $("#gameserver_port").val();
+			var addSteamid = $("#addSteamid").val();
+			var immunity = $("#immunity").val();
+			var permissionType = $("#sourcemod_perms").val();
+			
+			// Set the message divs back to defaults.
+			$("#invalid_server").removeClass('show').addClass('hide');
+			$("#invalid_steamid_admin").removeClass('show').addClass('hide');
+			$("#invalid_response_admin").removeClass('show').addClass('hide');
+			$("#invalid_immunity").removeClass('show').addClass('hide');
+			$("#addadmin_response").removeClass('show').addClass('hide');
+			
+			if(remoteId.length === 0 || gameName.length === 0 || gameIp.length === 0 || gamePort.length === 0){
+				$("#invalid_server").removeClass('hide').addClass('show');
+				++errors;
+			}
+			
+			if(!(addSteamid.match(/^STEAM_[01]:[01]:\d+$/))){
+				$("#invalid_steamid_admin").removeClass('hide').addClass('show');
+				++errors;
+			}
+			
+			if(immunity.length > 2 || isNaN(immunity)){
+				$("#invalid_immunity").removeClass('hide').addClass('show');
+				++errors;
+			}
+			
+			if(errors === 0){
+				$.post("/modules/util/addadmin_helper.php", $("#addadmin_form").serialize(), function(postCommand){
+					$("#addadmin_response").removeClass('hide').addClass('show').html(postCommand);
+					//$("#addadmin_form button").prop({disabled:false});
+				}).fail(function(){
+					$("#invalid_response_admin").removeClass('hide').addClass('show');
+					$("#addadmin_form button").prop({disabled:false});
+				});
+			}else{
+				$("#addadmin_form button").prop({disabled:false});
+			}
+			
+			e.preventDefault();
+		}); // add_admin form handling
+		
+		// ----- Steam Converter -----
+		$("#steam_converter").on("submit", function(e){
+			$("#steam_converter button").prop({disabled:true});
+			$.post("/modules/util/steamid_converter.php", $("#steam_converter").serialize(), function(steam_data){
+				var json = $.parseJSON(steam_data);
+				
+				if(json.length === 0){
+					$("#steam_info").removeClass('show').addClass('hide');
+					$("#invalid_steamid").removeClass('hide').addClass('show');
+					$("#invalid_response").removeClass('show').addClass('hide');
+					
+					$("#steam_converter button").prop({disabled:false});
+				}else{
+					$("#steam_info").removeClass('hide').addClass('show');
+					$("#invalid_steamid").removeClass('show').addClass('hide');
+					$("#invalid_response").removeClass('show').addClass('hide');
+					
+					$("#steamLink").html('<b>Profile Link:</b> ' + json.steamProfile);
+					$("#steamId").html('<b>Legacy ID:</b> ' + json.steamId);
+					$("#steamId3").html('<b>SteamID3:</b> ' + json.steamId3);
+					$("#steamId64").html('<b>SteamID64:</b> ' + json.communityId);
+					
+					$("#steam_converter button").prop({disabled:false});
+				}
+			}).fail(function(){
+				$("#invalid_steamid").removeClass('show').addClass('hide');
+				$("#steam_info").removeClass('show').addClass('hide');
+				$("#invalid_response").removeClass('hide').addClass('show');
+			});
+			e.preventDefault();
+		}); // ./end steam_converter form handling.
+		
+		$("#your-address").click(function(){
+			$("#remote_target").val($("#your-address").text());
+		});
+	});
+</script>
 <?php
 }
 ?>

+ 90 - 0
modules/util/util_config.php

@@ -0,0 +1,90 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) Copyright (C) 2008 - 2012 The OGP Development Team
+ *
+ * http://www.opengamepanel.org/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ */
+	// The session variable that OGP assigns for signed in users.
+	$sessionName = 'opengamepanel_web';
+	
+	// Define commands, user permissions (via *role* => true/false), and what they're referred to on each OS.
+	// Include arguements here. They cannot be passed in the text input field.
+	$availableCommands	=	array(
+		// 'title' also needs to be specified in the translation files with the same values - as this is what shows on the select list. ex:
+		array(
+			'title'		=>	'ping',
+			'linux'		=>	'ping -c 4',	// By default, ping runs indefinitely on Linux - so set the count to 4; same as Windows default.
+			'windows'	=>	'ping',
+			
+			// Default: Ping is available to all user roles.
+			'subuser'	=>	true,
+			'user'		=>	true,
+			'admin'		=>	true,
+		),
+		
+		array(
+			'title'		=>	'traceroute',
+			'linux'		=>	'traceroute',
+			'windows'	=>	'tracert',
+			
+			// Default: Traceroute is only available to admins.
+			'subuser'	=>	false,
+			'user'		=>	false,
+			'admin'		=>	true,
+		),
+	);
+	
+	// An array of characters which should never be passed to exec()
+	$blockedCharacters	= '"#$%^&*()+=[]\';,\\/{}|:<>?~';
+	
+	// Should we log attempted form manipulation (ie, editing the form to execute a command the user doesn't have access to) ...
+	// ... and attempted multi-command input? (ie, ;cd /;ls)
+	$logMaliciousUsage = true;
+	
+	// Should we log successfully executed commands...?
+	// Could spam the logs - so probably set this to false.
+	$logAllUsage = false;
+	
+	// Games which Sourcemod supports.
+	// Needs to be exactly what OGP reports as the game_name.
+	$supportedGames = array(
+		'Counter Strike Global Offensive',
+		'Counter Strike Source',
+		'Day of Defeat Source',
+		'Dystopia',
+		'Garrys Mod',
+		'Half-Life 2: Deathmatch',
+		'Hidden: Source',
+		'Pirates, Vikings and Knights II',
+		'Team Fortress 2',
+		'Team Fortress 2 Beta',
+		'Left 4 Dead',
+		'Left 4 Dead 2',
+	);
+	
+	// Simple array of where admins are stored depending on the admin mod.
+	// mod.name => file.location
+	$adminFiles = array(
+		'sourcemod'	=>	'addons/sourcemod/configs/admins_simple.ini',
+	);
+	
+	// Flags that sub-users need to add admins to owned parent game-servers.
+	// This should just be the same as allow_file_management and allow_ftp - as they'll be able to add admins anyway with those flags.
+	$subuserAdminManagement = 'ft';