own3mall 8 jaren geleden
bovenliggende
commit
fb6b1578b8

+ 339 - 0
LICENSE

@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    {description}
+    Copyright (C) {year}  {fullname}
+
+    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
+    (at your option) 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.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  {signature of Ty Coon}, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.

+ 17 - 0
lang/English/modules/editConfigurationFiles.php

@@ -0,0 +1,17 @@
+<?php
+
+define('configuration_files', "Configuration Files");
+define('editing_file', "Editing File");
+define('no_server_specfied', "No Server ID specified - can't list any configuration files.");
+define('no_home', "You don't have access to the given Server ID.");
+define('no_configs_for_game', "This has has no configuration files defined.");
+define('name', "Name");
+define('no_description', "No Description");
+define('description', "Description");
+define('invalid_file', "The specified file may not be edited.");
+define('wrote_changes', "Successfully saved the file.");
+define('failed_write', "Failed to save the file.");
+define('file_not_found', "The file was not found.");
+define('failed_read', "Failed to read the file.");
+define('save', "Save");
+define('go_back', "Go Back");

+ 203 - 0
lang/English/modules/gamemanager.php

@@ -0,0 +1,203 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) 2008 - 2017 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('game_manager', "Game Manager");
+define('no_games_to_monitor', "You do not have any games configured to you that can be monitored.");
+define('status', "Status");
+define('fail_no_mods', "No mods enabled for this game! You need to ask your OGP admin to add mod(s) for the game assigned for you.");
+define('no_game_homes_assigned', "No game servers assigned for you. You need to ask your OGP admin to assign games for you.");
+define('select_game_home_to_configure', "Select a game server that you want to configure");
+define('file_manager', "File Manager");
+define('configure_mods', "Configure mods");
+define('install_update_steam', "Install/Update via Steam");
+define('install_update_manual', "Install/Update manually");
+define('assign_game_homes', "Assign game servers");
+define('user', "User");
+define('group', "Group");
+define('start', "Start");
+define('ogp_agent_ip', "OGP Agent IP");
+define('max_players', "Max Players");
+define('max', "Max");
+define('ip_and_port', "IP and Port");
+define('available_maps', "Available Maps");
+define('map_path', "Map Path");
+define('available_parameters', "Available Parameters");
+define('start_server', "Start Server");
+define('start_wait_note', "The server startup might take a while. Please wait without closing your browser.");
+define('game_type', "Game Type");
+define('map', "Map");
+define('starting_server', "Starting server, please wait...");
+define('starting_server_settings', "Starting server with following settings");
+define('startup_params', "Startup parameters");
+define('startup_cpu', "CPU the server is running on");
+define('startup_nice', "Nice value of the server");
+define('game_home', "Home Path");
+define('server_started', "Server started successfully.");
+define('no_parameter_access', "You do not have access to parameters.");
+define('extra_parameters', "Extra Parameters");
+define('no_extra_param_access', "You do not have access to extra parameters.");
+define('extra_parameters_info', "These parameters are put to the end of the command line when the game is started.");
+define('game_exec_not_found', "The game executable %s was not found from the remote server.");
+define('select_params_and_start', "Select the startup parameters for the server and press '%s'.");
+define('no_ip_port_pairs_assigned', "No IP Port pairs assigned for this home. If you do not have access to home editing contact your admin.");
+define('unable_to_get_log', "Unable to get log, retval %s.");
+define('server_binary_not_executable', "Server binary is not executable. Check you have proper permissions in the server home directory.");
+define('server_not_running_log_found', "Server is not running, but log is found. NOTE: This log might not be related to the last server startup.");
+define('ip_port_pair_not_owned', "IP:PORT pair not owned.");
+define('unsuitable_maxplayers_value_maximum_reachable_number_of_slots_has_been_set', "Unsuitable maxplayers value, maximum reachable number of slots has been set.");
+define('server_running_not_responding', "Server is running, but its not responding,<br>there might be a some kind of problem and you might want to ");
+define('update_started', "Update started, please wait...");
+define('failed_to_start_steam_update', "Failed to start Steam update. See agent log.");
+define('failed_to_start_rsync_update', "Failed to start Rsync update. See agent log.");
+define('update_completed', "Update completed successfully.");
+define('update_in_progress', "Update in progress, please wait...");
+define('refresh_steam_status', "Refresh steam status");
+define('refresh_rsync_status', "Refresh rsync status");
+define('server_running_cant_update', "Server running so update is not possible. Stop the server before update.");
+define('xml_steam_error', "Selected server type does not support steam install/update.");
+define('mod_key_not_found_from_xml', "Mod key '%s' not found from the XML file.");
+define('stop_update', "Stop update");
+define('statistics', "Statistics");
+define('servers', "Servers");
+define('players', "Players");
+define('current_map', "Current Map");
+define('stop_server', "Stop Server");
+define('server_ip_port', "Server IP:Port");
+define('server_name', "Server Name");
+define('server_id', "Server ID");
+define('player_name', "Player Name");
+define('score', "Score");
+define('time', "Time");
+define('no_rights_to_stop_server', "You do not have rights to stop this server.");
+define('no_ogp_lgsl_support', "This server (running: %s) does not have LGSL support in OGP and its statistics can not be shown.");
+define('server_status', "Server on %s is %s.");
+define('server_stopped', "Server '%s' has been stopped.");
+define('if_want_to_start_homes', "If you want to start game servers go to %s.");
+define('view_log', "Log Viewer");
+define('if_want_manage', "If you want to manage your games you can do it in the");
+define('columns', "columns");
+define('group_users', "Group users:");
+define('assigned_to', "Assigned to:");
+define('restart_server', "Restart Server");
+define('restarting_server', "Restarting server, please wait...");
+define('server_restarted', "Server '%s' has been restarted.");
+define('server_not_running', "The server is not running.");
+define('address', "Address");
+define('owner', "Owner");
+define('operations', "Operations");
+define('search', "Search");
+define('maps_read_from', "Maps read from ");
+define('file', "file");
+define('folder', "folder");
+define('unable_retrieve_mod_info', "Unable to retrieve mod information from database.");
+define('unexpected_result_libremote', "Unexpected result from libremote, please inform developers.");
+define('unable_get_info', "Unable to get the required information for startup, blocking startup.");
+define('server_already_running', "Server already running. If you do not see the server in the Game Monitor, there might be a somekind of problem and you might want to");
+define('already_running_stop_server', "Stop server.");
+define('error_server_already_running', "ERROR: Server already running on port");
+define('failed_start_server_code', "Failed to start the remote server. Error code: %s");
+define('disabled', "disabled ");
+define('not_found_server', "Could not find the remote server with ID");
+define('rcon_command_title', "RCON Command");
+define('has_sent_to', "has been sent to");
+define('need_set_remote_pass', "You need to set the remote control password on");
+define('before_sending_rcon_com', "before sending rcon commands to it.");
+define('retry', "Retry");
+define('page', "page");
+define('server_cant_start', "server can not start");
+define('server_cant_stop', "server can not stop");
+define('error_occured_remote_host', "Error occurred on the remote host");
+define('follow_server_status', "You can follow the server status from");
+define('addons', "Addons");
+define('hostname', "Hostname");
+define('rsync_install', "[Rsync Install]");
+define('ping', "Ping");
+define('team', "Team");
+define('deaths', "Deaths");
+define('pid', "PID");
+define('skill', "Skill");
+define('AIBot', "AIBot");
+define('steamid', "Steam ID");
+define('player', "Player");
+define('port', "Port");
+define('rcon_presets', "RCON presets");
+define('update_from_local_master_server', "Update from local Master Server");
+define('update_from_selected_rsync_server', "Update from selected Rsync server");
+define('execute_selected_server_operations', "Execute selected server operations");
+define('execute_operations', "Execute operations");
+define('account_expiration', "Account expiration");
+define('mysql_databases', "MySQL Databases");
+define('failed_querying_server', "* Failed querying the server.");
+define('query_protocol_not_supported', "* There is no query protocol in OGP that can support this server.");
+define('queries_disabled_by_setting_disable_queries_after', "Queries disabled by setting: Disable queries after: %s, since you have %s servers.<br>");
+define('presets_for_game_and_mod', "RCON presets for %s and mod %s");
+define('name', "Name");
+define('command', "RCON&nbsp;Command");
+define('add_preset', "Add preset");
+define('edit_presets', "Edit presets");
+define('del_preset', "Delete");
+define('change_preset', "Change");
+define('send_command', "Send command");
+define('starting_copy_with_master_server_named', "Starting copy with master server named '%s'...");
+define('starting_sync_with', "Starting sync with %s...");
+define('refresh_interval', "Log refreshing interval");
+define('finished_manual_update', "Finished manual update.");
+define('failed_to_start_file_download', "Failed to start file download");
+define('game_name', "Game name");
+define('dest_dir', "Destination directory");
+define('remote_server', "Remote Server");
+define('file_url', "File URL");
+define('file_url_info', "The URL of the file that is uploaded and uncompressed to the directory.");
+define('dest_filename', "Destination Filename");
+define('dest_filename_info', "The filename for the destination file.");
+define('update_server', "Update server");
+define('unavailable', "Unavailable");
+define('upload_map_image', "Upload map image");
+define('upload_image', "Upload image");
+define('jpg_gif_png_less_than_1mb', "The image must be jpg, gif or png and less than 1 MB.");
+define('check_dev_console', "Error during uploading file, please check the browser developer console.");
+define('uploaded_successfully', "Uploaded successfully.");
+define('cant_create_folder', "Can't create folder:<br><b>%s</b>");
+define('cant_write_file', "Can't write file:<br><b>%s</b>");
+define('exceeded_php_directive', "Exceeded PHP directive.<br><b>%s</b>.");
+define('unknown_errors', "Unknown errors.");
+define('directory', "Directory");
+define('view_player_commands', "View Player Commands");
+define('hide_player_commands', "Hide Player Commands");
+define('no_online_players', "There are no online players.");
+define('invalid_game_mod_id', "Invalid Game/Mod ID specified.");
+define('auto_update_title_popup', "Steam Auto Update Link");
+define('auto_update_popup_html', "<p>Use the link below to check and automatically update your game server via Steam if needed.&nbsp; You can query it using a cronjob or manually initiate the process.</p>");
+define('auto_update_copy_me', "Copy");
+define('auto_update_copy_me_success', "Copied!");
+define('auto_update_copy_me_fail', "Failed to copy. Please, manually copy the link.");
+define('get_steam_autoupdate_api_link', "Auto Update Link");
+define('update_attempt_from_nonmaster_server', "User %s attempted to update home_id %d from a non-master server. (Home ID: %d)");
+define('attempting_nonmaster_update', "You are attempting to update this server from a non-master server.");
+define('cannot_update_from_own_self', "Local server update may not run on a Master server.");
+define('show_server_id', "Show Server IDs");
+define('hide_server_id', "Hide Server IDs");
+
+define('edit_configuration_files', "Edit Configuration Files");
+?>

+ 303 - 0
modules/config_games/schema_server_config.xml

@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="game_config" type="server_config_type" />
+  <xs:simpleType name="nonEmptyString">
+    <xs:restriction base="xs:string">
+      <xs:minLength value="1" />
+    </xs:restriction>
+  </xs:simpleType>
+  
+  <!-- If game has different query port than the game port
+  with this you can specify the difference to the game port. -->
+  <xs:simpleType name="query_port_type_type">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="add" />
+      <xs:minLength value="1" />
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:complexType name="query_port_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="type" type="query_port_type_type" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+    
+  <xs:simpleType name="cli_param_id_type">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="GAME_TYPE" />
+      <xs:enumeration value="HOSTNAME" />
+      <xs:enumeration value="IP" />
+      <xs:enumeration value="MAP" />
+      <xs:enumeration value="PID_FILE" />
+      <xs:enumeration value="PLAYERS" />
+      <xs:enumeration value="PORT" />
+      <xs:enumeration value="QUERY_PORT" />
+      <xs:enumeration value="BASE_PATH" />
+      <xs:enumeration value="HOME_PATH" />
+      <xs:enumeration value="SAVE_PATH" />
+      <xs:enumeration value="OUTPUT_PATH" />
+      <xs:enumeration value="USER_PATH" />
+      <xs:enumeration value="CONTROL_PASSWORD" />
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:complexType name="cli_param_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="id" type="cli_param_id_type" />
+        <xs:attribute name="cli_string" type="xs:string" />
+        <xs:attribute name="options" type="nonEmptyString" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+  <xs:complexType name="cli_params_type">
+    <xs:sequence>
+      <xs:element name="cli_param" type="cli_param_type" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+
+
+  <!-- Type for server control protocol --> 
+  <xs:simpleType name="control_protocol_type">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="rcon" /><!-- HL, Q1/2/3 -->
+      <xs:enumeration value="rcon2" /><!-- HL2(source) -->
+      <xs:enumeration value="lcon" /><!-- legacy console -->
+      <xs:minLength value="1" />
+    </xs:restriction>
+  </xs:simpleType>
+    <xs:simpleType name="control_protocol_type_type">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="new" /><!-- Half-Life version 1.1.0.6 or newer -->
+      <xs:enumeration value="old" /><!-- Quake 1/2/3 or old Half-Life -->
+      <xs:minLength value="1" />
+    </xs:restriction>
+  </xs:simpleType>
+  
+
+  <!-- Type for mods, each server must have at least one mod called, e.g., Default. -->
+  <xs:complexType name="mod_type">
+    <xs:sequence>
+      <xs:element name="name" type="xs:string" />
+      <!-- Installer name overrides the key attribute if present. -->
+      <xs:element name="installer_name" type="xs:string" minOccurs="0" />
+      <xs:element name="installer_login" type="xs:string" minOccurs="0" />
+      <xs:element name="betaname" type="xs:string" minOccurs="0" />
+      <xs:element name="betapwd" type="xs:string" minOccurs="0" />
+    </xs:sequence>
+    <xs:attribute name="key" type="xs:string" />
+  </xs:complexType>
+  <xs:complexType name="mods_type">
+    <xs:sequence>
+      <xs:element name="mod" type="mod_type" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="simple_key_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="key" type="xs:string" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+  <xs:complexType name="option_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="value" type="xs:string" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+
+
+<!-- Type for server cfg params replace --> 
+  <xs:complexType name="replace_text_type">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="default" type="xs:string" minOccurs="0" />
+      <xs:element name="var" type="xs:string" />
+      <xs:element name="filepath" type="xs:string" />
+      <xs:element name="options" type="xs:string" />
+    </xs:choice>
+    <xs:attribute name="key" type="xs:string" />
+  </xs:complexType>
+
+  <xs:complexType name="alltext_type">
+     <xs:sequence>
+       <xs:element name="text" type="replace_text_type" maxOccurs="unbounded" />
+     </xs:sequence>
+     <xs:attribute name="key" type="xs:string" />
+  </xs:complexType>
+  
+  <xs:complexType name="replace_texts_type">
+   <xs:choice minOccurs="0" maxOccurs="unbounded" >
+      <xs:element name="alltext" type="alltext_type" />
+      <xs:element name="text" type="replace_text_type" />
+    </xs:choice>
+  </xs:complexType>
+
+
+  <!-- Type for server cli params -->
+  <xs:complexType name="server_param_type">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="option" type="option_type" />
+      <xs:element name="attribute" type="simple_key_type" />
+      <xs:element name="default" type="simple_key_type" maxOccurs="1" />
+      <xs:element name="caption" type="xs:string" maxOccurs="1" />
+      <xs:element name="desc" type="xs:string" maxOccurs="1" />
+      <xs:element name="options" type="xs:string" />
+    </xs:choice>
+    <xs:attribute name="id" type="xs:string" />
+    <xs:attribute name="key" type="xs:string" />
+    <xs:attribute name="type" type="xs:string" default="text" />
+  </xs:complexType>
+  
+  <xs:complexType name="group_type">
+     <xs:sequence>
+       <xs:element name="param" type="server_param_type" maxOccurs="unbounded" />
+     </xs:sequence>
+     <xs:attribute name="key" type="xs:string" />
+     <xs:attribute name="name" type="xs:string" />
+  </xs:complexType>
+  
+  <xs:complexType name="server_params_type">
+    <xs:choice minOccurs="0" maxOccurs="unbounded" >
+      <xs:element name="group" type="group_type" />
+      <xs:element name="param" type="server_param_type" />
+    </xs:choice>
+  </xs:complexType>
+
+
+  <!-- Type for reserve ports --> 
+  <xs:simpleType name="port_type_type">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="add" />
+      <xs:enumeration value="subtract" />
+      <xs:minLength value="1" />
+    </xs:restriction>
+  </xs:simpleType>
+  
+  <xs:complexType name="port_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="type" type="port_type_type" />
+        <xs:attribute name="id" type="xs:string" />
+        <xs:attribute name="cli_string" type="xs:string" />
+        <xs:attribute name="options" type="nonEmptyString" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+  
+  <xs:complexType name="reserve_ports_type">
+    <xs:sequence>
+      <xs:element name="port" type="port_type" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+
+
+  <!-- Type for server cfg custom fields --> 
+  <xs:complexType name="custom_field_type">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="option" type="option_type" />
+      <xs:element name="default" type="xs:string" minOccurs="0" />
+      <xs:element name="default_value" type="xs:string" minOccurs="0" />
+      <xs:element name="var" type="xs:string" />
+      <xs:element name="filepath" type="xs:string" />
+      <xs:element name="options" type="xs:string" />
+      <xs:element name="desc" type="xs:string" maxOccurs="1" />
+    </xs:choice>
+    <xs:attribute name="id" type="xs:string" />
+    <xs:attribute name="key" type="xs:string" />
+    <xs:attribute name="type" type="xs:string" default="text" />
+  </xs:complexType>
+    
+  <xs:complexType name="custom_fields_type">
+   <xs:choice minOccurs="0" maxOccurs="unbounded" >
+      <xs:element name="field" type="custom_field_type" />
+    </xs:choice>
+  </xs:complexType>
+  
+  <!-- Type for player_info --> 
+  <xs:complexType name="index_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="key" type="xs:string" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+    
+  <xs:complexType name="player_info_type">
+   <xs:choice minOccurs="0" maxOccurs="unbounded" >
+      <xs:element name="index" type="index_type" />
+    </xs:choice>
+  </xs:complexType>
+  
+  <!-- Type for server player_commands --> 
+  <xs:complexType name="command_type">
+    <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element name="option" type="option_type" />
+      <xs:element name="default" type="xs:string" maxOccurs="1" />
+      <xs:element name="string" type="xs:string" />
+    </xs:choice>
+    <xs:attribute name="key" type="xs:string" />
+    <xs:attribute name="type" type="xs:string" default="text" />
+  </xs:complexType>
+    
+  <xs:complexType name="player_commands_type">
+   <xs:choice minOccurs="0" maxOccurs="unbounded" >
+      <xs:element name="command" type="command_type" />
+    </xs:choice>
+  </xs:complexType>
+
+  <!-- Type for reserve ports --> 
+  <xs:complexType name="files_type">
+    <xs:simpleContent>
+      <xs:extension base="xs:string">
+        <xs:attribute name="description" type="xs:string" />
+        <xs:attribute name="options" type="nonEmptyString" />
+      </xs:extension>
+    </xs:simpleContent>
+  </xs:complexType>
+  
+  <xs:complexType name="configuration_files_type">
+    <xs:sequence>
+      <xs:element name="file" type="files_type" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+  
+  <!-- The main of the template -->
+  <xs:complexType name="server_config_type">
+    <xs:sequence>
+      <xs:element name="game_key" type="nonEmptyString" />
+      <xs:element name="protocol" type="nonEmptyString" minOccurs="0"/>
+      <xs:element name="lgsl_query_name" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="gameq_query_name" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="installer" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="game_name" type="nonEmptyString" />
+      <xs:element name="server_exec_name" type="nonEmptyString" />
+      <xs:element name="query_port" type="query_port_type" minOccurs="0" />
+      <xs:element name="cli_template" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="cli_params" type="cli_params_type" minOccurs="0" />
+      <xs:element name="reserve_ports" type="reserve_ports_type" minOccurs="0" />
+      <xs:element name="cli_allow_chars" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="maps_location" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="map_list" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="console_log" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="exe_location" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="max_user_amount" type="xs:positiveInteger" minOccurs="0" />
+      <xs:element name="control_protocol" type="control_protocol_type" minOccurs="0" />
+      <xs:element name="control_protocol_type" type="control_protocol_type_type" minOccurs="0" />
+      <xs:element name="mods" type="mods_type" />
+      <xs:element name="replace_texts" type="replace_texts_type" minOccurs="0" />
+      <xs:element name="server_params" type="server_params_type" minOccurs="0" />
+      <xs:element name="custom_fields" type="custom_fields_type" minOccurs="0" />
+      <xs:element name="list_players_command" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="player_info_regex" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="player_info" type="player_info_type" minOccurs="0" />
+      <xs:element name="player_commands" type="player_commands_type" minOccurs="0" />
+      <xs:element name="pre_install" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="post_install" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="pre_start" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="environment_variables" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="lock_files" type="nonEmptyString" minOccurs="0" />
+      <xs:element name="configuration_files" type="configuration_files_type" minOccurs="0" />
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>

+ 82 - 0
modules/editConfigurationFiles/configFileList.php

@@ -0,0 +1,82 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) 2008 - 2017 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.
+ *
+ */
+
+require_once('modules/editConfigurationFiles/functions.php');
+require_once("modules/config_games/server_config_parser.php");
+
+function exec_ogp_module()
+{
+    global $db, $view;
+    
+    $home_id = (int)$_GET['home_id'];
+    $isAdmin = $db->isAdmin($_SESSION['user_id']);
+
+    if (empty($home_id) || $home_id === 0) {
+        print_failure(get_lang('no_server_specfied'));
+        $view->refresh("?m=gamemanager&p=game_monitor");
+
+        return;
+    }
+    
+    if ($isAdmin) {
+        $server_home = $db->getGameHome($home_id);
+    } else {
+        $server_home = $db->getUserGameHome($_SESSION['user_id'], $home_id);
+    }
+    
+    if ($server_home === false) {
+        print_failure(get_lang('no_home'));
+        $view->refresh("?m=gamemanager&p=game_monitor");
+        
+        return;
+    }
+    
+    $server_xml = read_server_config(SERVER_CONFIG_LOCATION .'/'. $server_home['home_cfg_file']);
+
+    $files = getFilesInXML($server_xml->configuration_files);
+    
+    if (empty($files)) {
+        print_failure(get_lang('no_configs_for_game'));
+        $view->refresh("?m=gamemanager&p=game_monitor");
+    } else {
+        echo '<h2>'.get_lang('configuration_files').'</h2>';
+        
+        echo '<table width="100%">
+				<tr>
+					<th>'.get_lang('name').'</th>
+					<th>'.get_lang('description').'</th>
+					<th>'.get_lang('actions').'</th>
+				</tr>';
+        
+        foreach ($files as $file) {
+            echo '<tr>
+					<td>'. $file['name'] .'</td>
+					<td>'. ($file['description'] ?: '<i>'.get_lang('no_description').'</i>') .'</td>
+					<td><a href="?m=editConfigurationFiles&p=modify&home_id='.$server_home['home_id'].'&file='.rawurlencode($file['path']).'">[ '.get_lang('edit').' ]</a></td>
+				</tr>';
+        }
+        
+        echo '</table>';
+    }
+}

+ 18 - 0
modules/editConfigurationFiles/functions.php

@@ -0,0 +1,18 @@
+<?php
+
+function getFilesInXML($files)
+{
+    $values = array();
+
+    if (isset($files->file)) {
+        foreach ($files->file as $file) {
+            $values[] = array(
+                'name'            =>    (string)$file,
+                'description'    =>    $file['description'],
+                'path'            =>    (string)$file
+            );
+        }
+    }
+    
+    return $values;
+}

+ 115 - 0
modules/editConfigurationFiles/modify.php

@@ -0,0 +1,115 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) 2008 - 2017 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.
+ *
+ */
+
+require_once('modules/editConfigurationFiles/functions.php');
+require_once("modules/config_games/server_config_parser.php");
+require_once('includes/lib_remote.php');
+
+function exec_ogp_module()
+{
+    global $db, $view;
+    
+    $home_id = (int)$_GET['home_id'];
+    $isAdmin = $db->isAdmin($_SESSION['user_id']);
+    
+    if ($isAdmin) {
+        $server_home = $db->getGameHome($home_id);
+    } else {
+        $server_home = $db->getUserGameHome($_SESSION['user_id'], $home_id);
+    }
+    
+    if ($server_home === false) {
+        print_failure(get_lang('no_home'));
+        $view->refresh("?m=gamemanager&p=game_monitor");
+        
+        return;
+    }
+    
+    $server_xml = read_server_config(SERVER_CONFIG_LOCATION .'/'. $server_home['home_cfg_file']);
+    $files = getFilesInXML($server_xml->configuration_files);
+    
+    $file = ($_SERVER['REQUEST_METHOD'] === 'POST' ? rawurldecode($_POST['file']) : rawurldecode($_GET['file']));
+    
+    if (array_search($file, array_column($files, 'path')) === false) {
+        print_failure(get_lang('invalid_file'));
+        $view->refresh("?m=editConfigurationFiles&home_id=". (int)$server_home['home_id']);
+        
+        return;
+    }
+    
+    $remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
+    
+    if ($remote->status_chk() === 0) {
+        print_failure(get_lang('agent_offline'));
+        $view->refresh("?m=gamemanager&p=game_monitor");
+        
+        return;
+    }
+    
+    if ($remote->rfile_exists($server_home['home_path'] . '/' . $file) == 1) {
+        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+            $file_info = $remote->remote_writefile($server_home['home_path'] . '/' . $file, strip_real_escape_string($_POST['file_content']));
+            
+            if ($file_info === 1) {
+                print_success(get_lang('wrote_changes'));
+                $view->refresh("?m=editConfigurationFiles&home_id=". (int)$server_home['home_id']);
+                
+                return;
+            } else {
+                print_failure(get_lang('failed_write'));
+                $view->refresh("?m=editConfigurationFiles&home_id=". (int)$server_home['home_id']);
+                
+                return;
+            }
+        } else {
+            $file_info = $remote->remote_readfile($server_home['home_path'] . '/' . $file, $data);
+        
+            if ($file_info === 0) {
+                print_failure(get_lang('file_not_found'));
+                $view->refresh("?m=editConfigurationFiles");
+                
+                return;
+            } elseif ($file_info === -2) {
+                print_failure(get_lang('failed_read'));
+                $view->refresh("?m=editConfigurationFiles");
+                
+                return;
+            }
+            
+            echo '<h2>'.get_lang('editing_file').'</h2><p><b>'.htmlentities($file).'</b></p>';
+            echo '<form action="?m=editConfigurationFiles&p=modify&home_id='.$server_home['home_id'].'" method="POST">';
+            echo '<input type="hidden" name="file" value="'.rawurlencode($_GET['file']).'">';
+            echo '<input type="hidden" name="action" value="save">';
+            echo '<textarea name="file_content" style="width:98%;" rows="40">'. $data .'</textarea>';
+            echo '<p><input type="submit" name="write" value="'. get_lang('save') . '" /></p>';
+            echo '</form>';
+            echo '<table class="center" style="width:100%;""><a href="?m=editConfigurationFiles&home_id='. (int)$server_home['home_id'].'">'.get_lang('go_back').'</a></table>';
+        }
+    } else {
+        print_failure(get_lang('file_not_found'));
+        $view->refresh("?m=gamemanager&p=game_monitor");
+
+        return;
+    }
+}

+ 29 - 0
modules/editConfigurationFiles/module.php

@@ -0,0 +1,29 @@
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) 2008 - 2017 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.
+ *
+ */
+// Module general information
+
+$module_title = "Edit Config Files";
+$module_version = "0.1";
+$db_version = 0;
+$module_required = false;

+ 4 - 0
modules/editConfigurationFiles/navigation.xml

@@ -0,0 +1,4 @@
+<navigation>
+	<page key="modify" file="modify.php" access="user,admin,subuser" />
+	<page key="default" file="configFileList.php" access="user,admin,subuser" />
+</navigation>

+ 683 - 0
modules/gamemanager/server_monitor.php

@@ -0,0 +1,683 @@
+<script type="text/javascript" src="js/modules/gamemanager.js"></script>
+<?php
+/*
+ *
+ * OGP - Open Game Panel
+ * Copyright (C) 2008 - 2017 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.
+ *
+ */
+
+require_once('modules/gamemanager/home_handling_functions.php');
+require_once("modules/config_games/server_config_parser.php");
+
+require_once("includes/refreshed.php");
+require_once('includes/lib_remote.php');
+
+function renderParam($param, $last_param, $param_access_enabled, $home_id)
+{
+	global $db;
+	$attributesString = "";
+	foreach ($param->attribute as $attribute)
+		$attributesString .= $attribute['key']. "='$attribute' ";
+
+	$disabledString = ($param_access_enabled) ? "" : "disabled ";
+	
+	if (array_key_exists((string)$param['key'], $last_param))
+		$paramValue = (string)$last_param[(string)$param['key']];
+	else
+		$paramValue = (string)$param->default;
+
+	$idString = "id='".clean_id_string($param['key'])."'";
+	$nameString = "name='params[".$param['key']."]'";
+	$paramType = $param['type'];
+	if ($paramType == "select")
+	{
+		$inputElementString = "<select $idString $nameString $disabledString>";
+		foreach ($param->option as $option)
+		{
+			$optionValue = (string)($option['value']);
+			$selectedString = ($optionValue == $paramValue) ? "selected='selected'" : "";
+			$valueString = "value=\"".str_replace('"', "&quot;", strip_real_escape_string($optionValue))."\"";
+			$inputElementString .= "<option $selectedString $valueString>$option</option>";
+		}
+		$inputElementString .="</select>";
+	} else
+		{
+			if ($paramType == "checkbox_key_value") {
+				if ($paramValue) // convert the XML object to string
+					$attributesString .= "checked='checked' ";
+				$paramValue = $param['key'];
+				$paramType = "checkbox";
+			} 
+			else if ($paramType == "checkbox")
+			{
+				if ($paramValue) // convert the XML object to string
+					$attributesString .= "checked='checked' ";
+			}
+			$inputElementString = "<input $idString $nameString ".
+				"type='$paramType' value=\"".str_replace('"', "&quot;", strip_real_escape_string($paramValue))."\" ".
+				"$disabledString $attributesString/>";
+		}
+
+	echo "<tr><td class='right'><label for='".clean_id_string($param['key'])."'>".$param['key'].
+		":</label></td><td class='left'>$inputElementString<label for='".clean_id_string($param['key'])."'>";
+
+	if ( !empty($param->caption) )
+		echo $param->caption;
+	if ( !empty($param->desc) )
+		echo "<br/><span class='info'>(".$param->desc.")</span>";
+
+	echo "</label></td></tr>\n";
+}
+
+function get_sync_name($server_xml)
+{
+	if( $server_xml->lgsl_query_name )
+	{
+		$sync_name = $server_xml->lgsl_query_name;
+		if($sync_name == "quake3")
+		{
+			if($server_xml->game_name == "Quake 3")
+				$sync_name = "q3";
+		}
+	}
+	elseif( $server_xml->gameq_query_name )
+	{
+		$sync_name = $server_xml->gameq_query_name;
+		if($sync_name == "minecraft")
+		{
+			if($server_xml->game_name == "Bukkit")
+				$sync_name = "bukkit";
+			elseif($server_xml->game_name == "Tekkit")
+				$sync_name = "tekkit";
+		}
+	}
+	elseif( isset($server_xml->protocol) )
+		$sync_name = $server_xml->protocol;
+	else
+		$sync_name = $server_xml->mods->mod['key'];
+	return $sync_name;
+}
+
+function exec_ogp_module() {
+	global $db, $settings, $loggedInUserInfo;
+	echo "<h2>". game_monitor ."</h2>";
+	$refresh = new refreshed();
+	set_time_limit(0);
+	$stats_servers_online = 0;
+	$stats_servers = 0;
+	$stats_players = 0;
+	$stats_maxplayers = 0;
+	
+	$home_page = (isset($_GET['page']) && (int)$_GET['page'] > 0) ? (int)$_GET['page'] : 1;
+	$home_limit = (isset($_GET['limit']) && (int)$_GET['limit'] > 0) ? (int)$_GET['limit'] : 10;
+	$home_cfg_id = (isset($_GET['home_cfg_id']) && (int)$_GET['home_cfg_id'] > 0) ? (int)$_GET['home_cfg_id'] : false;
+	
+	$search_field = (isset($_GET['search']) && !empty($_GET['search'])) ? $_GET['search'] : false;
+	
+	
+	if(hasValue($loggedInUserInfo) && is_array($loggedInUserInfo) && $loggedInUserInfo["users_page_limit"] && !hasValue($_GET['limit'])){
+		$home_limit = $loggedInUserInfo["users_page_limit"];
+	}
+	
+	$isAdmin = $db->isAdmin( $_SESSION['user_id'] );
+	
+	if ( $isAdmin )
+		{
+			$show_games_type = $db->getHomesFor('admin', $_SESSION['user_id']);
+			if(isset($_GET['home_id']) OR isset($_GET['home_id-mod_id-ip-port']))          
+				$server_homes = $db->getHomesFor('admin', $_SESSION['user_id']);
+			else
+				$server_homes = $db->getHomesFor_limit('admin', $_SESSION['user_id'],$home_page,$home_limit,$home_cfg_id,$search_field);
+	
+		}
+		else
+		{
+			$show_games_type = $db->getHomesFor('user_and_group', $_SESSION['user_id']);
+			if(isset($_GET['home_id']) OR isset($_GET['home_id-mod_id-ip-port']))          
+				$server_homes = $db->getHomesFor('user_and_group', $_SESSION['user_id']);
+			else			
+				$server_homes = $db->getHomesFor_limit('user_and_group', $_SESSION['user_id'],$home_page,$home_limit,$home_cfg_id,$search_field);
+		}
+
+	if( $server_homes === FALSE )
+	{
+		// If there are no games, then there can not be any mods either.
+
+		if (!empty($search_field)) {
+			print_failure(get_lang_f('no_results_found', htmlentities($search_field)));
+		} else {
+			print_failure(get_lang('no_game_homes_assigned'));
+		}
+
+		if ( $isAdmin )
+		{
+			echo "<p><a href='?m=user_games&amp;p=assign&amp;user_id=$_SESSION[user_id]'>".
+				 assign_game_homes ."</a></p>";
+		}
+		return;
+	}
+	?>
+		<form action="home.php" style="float:right;">
+			<b><?php print_lang('search'); ?>:</b>
+			<input type ="hidden" name="m" value="gamemanager" />
+			<input type ="hidden" name="p" value="game_monitor" />
+			<input name="search" type="text" id="search" value="<?php if(hasValue($search_field)){ echo $search_field; } ?>" />
+			<input type="submit" value="<?php echo get_lang('search'); ?>" />
+		</form>
+	<?php
+	foreach($_POST as $key => $value)
+	{
+		if( preg_match( "/^action/", $key ) )
+		{
+			list($action,$home_id,$mod_id,$ip,$port) = explode("-", $value);
+			exec_operation( $action, $home_id, $mod_id, $ip, $port );
+		}
+	}
+	
+	if ( empty( $_GET['home_id-mod_id-ip-port'] ) )
+		unset( $_GET['home_id-mod_id-ip-port'] );
+	if ( empty( $_GET['home_id'] ) )
+		unset( $_GET['home_id'] );
+	if ( isset($_GET['home_cfg_id']) and $_GET['home_cfg_id'] ==  game_type  )
+		unset( $_GET['home_cfg_id'] );
+
+	create_home_selector_game_type($_GET['m'], $_GET['p'], $show_games_type);
+
+	if (!isset($_GET['home_id-mod_id-ip-port']) and !isset($_GET['home_id']) and !isset($_GET['home_cfg_id'])) 
+	{
+		create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
+		$show_all = TRUE;
+	}
+	else
+	{
+		create_home_selector_address($_GET['m'], $_GET['p'], $server_homes);
+		create_home_selector($_GET['m'], $_GET['p'], "show_all");
+		$show_all = FALSE;
+	}
+
+	require("protocol/lgsl/lgsl_protocol.php");
+
+	$info = $db->getUserById($_SESSION['user_id']);
+	if($info['user_expires'] != "X")
+	{
+	?>
+		<span style="color:black;font-weight:bold;">
+			<center>
+			<?php echo print_lang('account_expiration'); ?>: <span style="color:green;"><?php echo date( "l, F jS, Y, H:i:s", $info['user_expires'] ).
+			" ( ".str_replace('hr', 'hours', read_expire($info['user_expires'])).")"; ?></span>
+			</center>
+		</span>
+	<?php
+	}
+	
+	if($settings["show_server_id_game_monitor"]){
+		echo "<p class='serverIdToggle' showtext='" . get_lang('show_server_id') . "' hidetext='" . get_lang('hide_server_id') . "'>" . get_lang('show_server_id') . "</p>";
+	}
+	
+	echo "<table id='servermonitor' class='tablesorter' data-sortlist='[[0,0],[3,1]]'>".
+		 "<thead>".
+		 "<tr>".
+		 "\t<th style='width:16px;background-position: center;'></th>".
+		 "\t<th style='width:16px;background-position: center;'></th>".
+		 "\t<th class=\"hide serverId\">" . server_id . "</th>".
+		 "\t<th>" . server_name . "</th>".
+		 "\t<th>" . address . "</th>".
+		 "\t<th>" . owner . "</th>".
+		 "\t<th class='sorter-false'>".
+		 "\t\t" . operations . "".
+		 "\t\t<img style='border:0;height:15px;' id='action-stop' src='" . check_theme_image("images/stop.png") . "'/>".
+		 "\t\t<img style='border:0;height:15px;' id='action-restart' src='" . check_theme_image("images/restart.png") . "'/>".
+		 "\t\t<img style='border:0;height:15px;' id='action-start' src='" . check_theme_image("images/start.png") . "'/>".
+		 "\t</th>".
+		 "</tr>".
+		 "</thead>".
+		 "<tbody>";
+
+	$litefm_installed = $db->isModuleInstalled('litefm');
+	$ftp_installed = $db->isModuleInstalled('ftp');
+	$addonsmanager_installed = $db->isModuleInstalled('addonsmanager');
+	$mysql_installed = $db->isModuleInstalled('mysql');
+	if( isset( $_GET['home_id-mod_id-ip-port']) )
+		list( $post_home_id,
+			  $post_mod_id, 
+			  $post_ip, 
+			  $post_port ) = explode( "-", $_GET['home_id-mod_id-ip-port'] );
+	foreach( $server_homes as $server_home )
+	{
+		if( ( $show_all or isset($_GET['home_cfg_id']) ) AND ( !isset($server_home['ip']) or !isset($server_home['mod_id']) ) )
+			continue;
+		// Count the number of servers.
+		$stats_servers++;
+		
+		if( $show_all 
+			OR ( isset( $_GET['home_id'] ) and $_GET['home_id'] == $server_home['home_id'] ) 
+			OR ( isset( $_GET['home_id-mod_id-ip-port'] ) and $server_home['home_id'] == $post_home_id and $server_home['mod_id'] == $post_mod_id and $post_ip == $server_home['ip'] and $post_port == $server_home['port'] ) 
+			OR ( isset( $_GET['home_cfg_id'] ) and $_GET['home_cfg_id'] == $server_home['home_cfg_id'] ) 
+		  )
+		{
+			//Unset variables.
+			unset($map,
+				  $trclass, 
+				  $first, 
+				  $second, 
+				  $onlineT, 
+				  $ts3opt, 
+				  $offlineT, 
+				  $halfT, 
+				  $ministart, 
+				  $player_list, 
+				  $groupsus, 
+				  $name,
+				  $mod_name,
+				  $SrvCtrl,
+				  $lite_fm,
+				  $manager,
+				  $user,
+				  $pos,
+				  $ftp,
+				  $addonsmanager,
+				  $ctrlChkBoxes,
+				  $expiration_dates);
+			
+			if ( $isAdmin )
+			{
+				$server_home['access_rights'] = "ufpetc";
+			}
+			if ($server_home['mod_name'] == "none" OR $server_home['mod_name'] == "None")
+				$mod_name = "";
+			elseif($server_home['mod_name'] != $server_home['game_name'])
+				$mod_name = " ( ".$server_home['mod_name']." )";
+				
+			$expiration_dates = "";
+			if(isset($server_home['server_expiration_date']) and $server_home['server_expiration_date'] != "X")
+				$expiration_dates .= server_expiration_date . ": " . date('d/m/Y H:i:s', $server_home["server_expiration_date"]) . "<br>";
+			if(isset($server_home['user_expiration_date']) and $server_home['user_expiration_date'] != "X")
+				$expiration_dates .= assign_expiration_date . " (" . user . "): " . date('d/m/Y H:i:s', $server_home["user_expiration_date"]) . "<br>";
+			if(isset($server_home['user_group_expiration_date']) and $server_home['user_expiration_date'] != "X")
+				$expiration_dates .= assign_expiration_date . " (" . group . "): " . date('d/m/Y H:i:s', $server_home["user_group_expiration_date"]);
+			
+			$get_size = "<a class='monitorbutton size' data-home_id='".$server_home["home_id"]."'>
+				<img src='" . check_theme_image("images/file_size.png") . "' title='". get_size ."'>
+				<span>". get_size ."</span>
+			</a>";
+
+			$manager = "<a class='monitorbutton' href='?m=user_games&amp;p=edit&amp;home_id=".$server_home['home_id']."'>
+				<img src='" . check_theme_image("images/edit.png") . "' title='". edit ."'>
+				<span>". edit ."</span>
+			</a>";
+
+			// Only show the filemanager link when the litefm is installed.
+			if ( preg_match("/f/",$server_home['access_rights']) > 0 && $litefm_installed )
+			{
+				$lite_fm = "<a class='monitorbutton' href='?m=litefm&amp;home_id=".$server_home['home_id']."'>
+					<img src='" . check_theme_image("images/txt.png") . "' title='". file_manager ."'>
+					<span>". file_manager ."</span>
+				</a>";
+			}
+			
+			if ( preg_match("/t/",$server_home['access_rights']) > 0 && $ftp_installed )
+			{
+				$ftp = "<a class='monitorbutton' href='?m=ftp&amp;home_id=".$server_home['home_id']."'>
+                            <img src='" . check_theme_image("images/ftp.png") . "' title='". ftp ."'>
+							<span>". ftp ."</span>
+						</a>";
+			}
+			if ( $addonsmanager_installed )
+			{
+				$addons = $db->resultQuery("SELECT DISTINCT addon_id FROM OGP_DB_PREFIXaddons NATURAL JOIN OGP_DB_PREFIXconfig_homes WHERE home_cfg_id=".$server_home['home_cfg_id']);
+				$addons_qty = count($addons);
+				if($addons and $addons_qty >= 1){
+					$addonsmanager = "<a class='monitorbutton' href='?m=addonsmanager&amp;p=user_addons&amp;home_id=".
+                                                                         $server_home['home_id']."&amp;mod_id=".$server_home['mod_id'].
+                                                                         "&amp;ip=".$server_home['ip']."&amp;port=".$server_home['port']."'>
+                	                        <img src='" . check_theme_image("modules/administration/images/addons_manager.png") . "' title='". addons ."'>
+        	                                <span>". addons ." (".$addons_qty.")</span>
+	                                </a>";
+				}
+			}
+			
+			if ( $mysql_installed )
+			{
+				$mysql_dbs = $db->resultQuery("SELECT db_id FROM OGP_DB_PREFIXmysql_databases WHERE enabled=1 AND home_id=".$server_home['home_id']);
+
+				if(!empty($mysql_dbs))
+					$mysql = "<a class='monitorbutton' href='?m=mysql&p=user_db&home_id=".$server_home['home_id']."'>
+                	                        <img src='" . check_theme_image("modules/administration/images/mysql_admin.png") . "' title='". mysql_databases ."'>
+        	                                <span>". mysql_databases ."</span>
+	                                </a>";
+			}
+
+			if( !isset($server_home['mod_id']) )
+			{
+				$ministart = fail_no_mods;
+
+				if ( $isAdmin )
+				{
+					$ministart .= "<a class='monitorbutton' href='?m=user_games&amp;p=edit&amp;home_id=".$server_home['home_id']."'>
+        	                                <span>" . configure_mods . "</span>
+	                                </a>";
+				}
+			}
+
+			$server_xml = read_server_config(SERVER_CONFIG_LOCATION."/".$server_home['home_cfg_file']);
+			
+			if ( $server_xml )
+			{
+				if (preg_match("/u/",$server_home['access_rights']))
+				{
+					$master_server_home_id = $db->getMasterServer( $server_home['remote_server_id'], $server_home['home_cfg_id'] );
+					if ( $master_server_home_id != FALSE )
+					{
+						if ( !$db->getGameHomeWithoutMods($master_server_home_id) )
+						{
+							$db->setMasterServer("remove", $master_server_home_id, $server_home['home_cfg_id'], $server_home['remote_server_id']);
+							$master_server_home_id = FALSE;
+						}
+					}
+					// In case game is compatible with steam we offer a way to use steam with the updates.
+					if( $server_xml->installer == "steamcmd" )
+					{						
+						if( $master_server_home_id != FALSE AND $master_server_home_id != $server_home['home_id']  )
+						{
+							$manager .= "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;master_server_home_id=".$master_server_home_id."&amp;update=update'>
+								<img src='" . check_theme_image("images/master.png") . "' title='". update_from_local_master_server ."'>
+								<span>". update_from_local_master_server ."</span>
+							</a>";
+						}
+
+						$manager .= "<a class='monitorbutton' href='?m=gamemanager&amp;p=update&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
+							<img src='" . check_theme_image("images/steam.png") ."' title='". install_update_steam ."'>
+							<span>". install_update_steam ."</span>
+						</a>";
+						$manager .= "<a class='monitorbutton getAutoUpdateLink' copyfail='" . auto_update_copy_me_fail . "' copysuccess='" . auto_update_copy_me_success . "' autoupdatetext='" . auto_update_title_popup . "' autoupdatehtml='" . htmlentities(auto_update_popup_html) . "' copyme='" . auto_update_copy_me . "' autoupdatelink='" . getOGPSiteURL() . "/ogp_api.php?action=autoUpdateSteamHome&homeid=" . $server_home['home_id'] . "&controlpass=" . $server_home['control_password'] . "'>
+							<img src='" . check_theme_image("images/auto_update.png") . "' title='". get_steam_autoupdate_api_link . "'>
+							<span>". get_steam_autoupdate_api_link . "</span>
+						</a>";
+					}
+					// In other cases manual update is provided.
+					else
+					{
+						$manager .= "<a class='monitorbutton' href='?m=gamemanager&amp;p=update_manual&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
+							<img src='" . check_theme_image("images/install.png") . "' title='". install_update_manual ."'>
+							<span>". install_update_manual ."</span>
+						</a>";
+
+
+						$sync_name = get_sync_name($server_xml);
+						$sync_list = @file("modules/gamemanager/rsync.list", FILE_IGNORE_NEW_LINES);
+						if ( in_array($sync_name, $sync_list) OR ($master_server_home_id != FALSE and $master_server_home_id != $server_home['home_id']) )
+						{
+							$manager .= "<a class='monitorbutton' href='?m=gamemanager&amp;p=rsync_install&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."&amp;update=update'>
+								<img src='" . check_theme_image("images/rsync.png") . "' title='". rsync_install ."'>
+								<span>". rsync_install ."</span>
+							</a>";
+
+						}
+					}
+				}
+
+				if ($db->isModuleInstalled("editConfigurationFiles") && !empty($server_xml->configuration_files)) {
+					$manager .= "<a href=\"?m=editConfigurationFiles&home_id=".(int)$server_home['home_id']."\" class=\"monitorbutton\">
+									<img src='" . check_theme_image("images/txt.png") . "' title='". edit_configuration_files ."'>
+									<span>". edit_configuration_files ."</span>
+					</a>";
+				}
+			}
+
+			if( $isAdmin )
+			{
+				if ( ( $server_xml->control_protocol and preg_match("/^(rcon|lcon|rcon2)$/" ,$server_xml->control_protocol) ) OR 
+					 ( $server_xml->gameq_query_name and $server_xml->gameq_query_name == 'minecraft' ) )
+				{
+					$manager .= "<a class='monitorbutton' href='home.php?m=gamemanager&amp;p=rcon_presets&amp;home_id=".$server_home['home_id']."&amp;mod_id=".$server_home['mod_id']."'>
+						<img src='" . check_theme_image("images/rcon_preset.png") . "' title='".rcon_presets."'>
+						<span>".rcon_presets."</span>
+					</a>";
+
+				}
+			}
+			
+			$mod = $server_home['mod_key'];
+			// If query name does not exist use mod key instead.
+			if ($server_xml->protocol == "gameq")
+				$query_name = $server_xml->gameq_query_name;
+			elseif ($server_xml->protocol == "lgsl")
+				$query_name = $server_xml->lgsl_query_name;
+			elseif ($server_xml->protocol == "teamspeak3")
+				$query_name = 'ts3';
+			else
+				$query_name = $mod;
+			
+			//----------+ getting the lgsl image icon
+			$icon_paths = array("images/icons/$mod.png",
+								"images/icons/$query_name.png",
+								"protocol/lgsl/other/icon_unknown.gif");
+
+			$icon_path = get_first_existing_file($icon_paths);
+
+			//Properties for all servers
+			if(isset($post_home_id) && $post_home_id == $server_home['home_id'] OR isset($_GET['home_id']) && $_GET['home_id'] == $server_home['home_id'] )
+				$trclass = " expandme";
+
+			$groupusers = $db->getGroupUsersByHomeId($server_home['home_id']);
+			$groupsus = "";
+			if($groupusers)
+			{
+				foreach($groupusers as $groupu)
+				{
+					if($groupu['user_id'] == $server_home['user_id_main'])
+						continue;
+					$groupsus .= $groupu['users_login']."<br>";
+				}
+			}
+			$groupsus = $groupsus != "" ? $groupsus = "<b>". group_users ."</b><br>".$groupsus : "";
+
+			$owners = $db->getUsersByHomeId($server_home['home_id']);
+			$other_owners = "";
+			if($owners)
+			{
+				foreach($owners as $owner)
+				{
+					if($owner['user_id'] == $server_home['user_id_main'])
+						continue;
+					$other_owners .= $owner['users_login'].'<br>';
+				}
+			}
+			$other_owners = $other_owners != "" ? $other_owners = "<b>". assigned_to ."</b><br>".$other_owners : "";
+
+			$view_log = "<a class='monitorbutton' href='?m=gamemanager&amp;p=log&amp;home_id-mod_id-ip-port=".$server_home['home_id']."-".$server_home['mod_id']."-".$server_home['ip']."-".$server_home['port']."'>
+				<img src='" . check_theme_image("images/log.png") . "' title='". view_log ."'>
+				<span>". view_log ."</span>
+			</a>";
+
+
+			$btns = $view_log.
+					@$ftp.
+					@$lite_fm.
+					@$addonsmanager;
+			//End
+
+			$remote = new OGPRemoteLibrary($server_home['agent_ip'], $server_home['agent_port'], $server_home['encryption_key'], $server_home['timeout']);
+			$host_stat = $remote->status_chk();
+
+			if( $host_stat === 1)
+			{
+				if ( $server_home['use_nat'] == 1 ){
+					$query_ip = $server_home['agent_ip'];
+				}else{
+					$query_ip = $server_home['ip'];
+				}
+
+				$query_ip = checkDisplayPublicIP($server_home['display_public_ip'],$query_ip);
+				$address = $query_ip . ":" . $server_home['port'];
+
+				$screen_running = $remote->is_screen_running(OGP_SCREEN_TYPE_HOME,$server_home['home_id']) === 1;
+				$update_in_progress = $remote->is_screen_running(OGP_SCREEN_TYPE_UPDATE,$server_home['home_id']) === 1;
+				if($screen_running)
+				{
+					// Check if the screen running the server is running.
+					$status = "online";
+					$order=1;
+					if ($server_xml->protocol == "lgsl")
+					{
+						$get_q_and_s = lgsl_port_conversion($query_name, $server_home['port'], "", "");
+						//Connection port
+						$c_port = $get_q_and_s['0'];
+						//query port
+						$q_port = $get_q_and_s['1'];
+						//software port
+						$s_port = $get_q_and_s['2'];
+						$address = "<a href='" . lgsl_software_link($query_name, $query_ip, $c_port, $q_port, $s_port) . "'>".$query_ip.":".$server_home['port']."</a>";
+					}
+					if ($server_xml->protocol == "teamspeak3")
+						$address = "<a href='ts3server://" . $query_ip . ":" . $server_home['port'] . "'>".$query_ip.":".$server_home['port']."</a>";
+					if($server_xml->protocol == "gameq" and $server_xml->installer == 'steamcmd')
+						$address = "<a href='steam://connect/" . $query_ip . ":" . $server_home['port'] . "'>" . $query_ip . ":" . $server_home['port'] . "</a>";
+					$pos = $refresh->add("home.php?m=gamemanager&p=ref_servermonitor&type=cleared&home_id=". $server_home['home_id'] . "&mod_id=". $server_home['mod_id'] . "&ip=" . $server_home['ip'] . "&port=" . $server_home['port']);
+					if ($server_xml->protocol == "teamspeak3")
+					{
+						require('protocol/TeamSpeak3/functions.php');
+					}
+					$startup_file_exists = $remote->rfile_exists( "startups/".$server_home['ip']."-".$server_home['port'] ) === 1;
+					if( isset($server_home['ip']) and isset($server_home['mod_id']) and ($server_xml->protocol != "teamspeak3" or ($startup_file_exists and $server_xml->protocol == "teamspeak3")) )
+					{
+						$ctrlChkBoxes .= '<div id="server_icon" class="action-stop'.$server_home['home_id'].'" ><div>'.
+										 '<input id="action-stop" class="action-stop'.$server_home['home_id'].'" name="action-'.$server_home['home_id'].'" value="stop-'.
+										 $server_home['home_id'].'-'.$server_home['mod_id'].'-'.$server_home['ip'].'-'.$server_home['port'].
+										 '" type="radio"><img style="border:0;height:15px;" src="'  . check_theme_image("images/stop.png") . '"/></div><div>&nbsp;'.
+										  stop_server .'</div></div><div id="server_icon" class="action-restart'.$server_home['home_id'].'" ><div>'.
+										 '<input id="action-restart" class="action-restart'.$server_home['home_id'].'" name="action-'.$server_home['home_id'].'" value="restart-'.
+										 $server_home['home_id'].'-'.$server_home['mod_id'].'-'.$server_home['ip'].'-'.$server_home['port'].
+										 '" type="radio"><img style="border:0;height:15px;" src="' . check_theme_image("images/restart.png") . '"/></div><div>&nbsp;'.
+										  restart_server .'</div></div>';
+					}
+					$stats_servers_online++;
+				}
+				else
+				{
+					$status = "offline";
+					if ($server_home['last_param'] != "" and isset($server_home['ip']) and isset($server_home['mod_id']))
+					{
+						if($update_in_progress)
+							$ctrlChkBoxes .= '<div id="server_icon" class="action-start'.$server_home['home_id'].'" >&nbsp;'. update_in_progress .'</div>';
+						else
+							$ctrlChkBoxes .= '<div id="server_icon" class="action-start'.$server_home['home_id'].'" >
+											 <div>
+											 <input id="action-start" class="action-start'.$server_home['home_id'].'" name="action-'.$server_home['home_id'].'" value="start-'.
+											 $server_home['home_id'].'-'.$server_home['mod_id'].'-'.$server_home['ip'].'-'.$server_home['port'].
+											 '" type="radio"><img style="border:0;height:15px;" src="' . check_theme_image("images/start.png") . '"/></div><div>&nbsp;'.
+											  start_server .'</div></div>';
+					}
+					$order = 3;
+					if(isset($server_home['mod_id']))
+					{
+						ob_start();
+						require('modules/gamemanager/mini_start.php');
+						$ministart = ob_get_contents();
+						ob_end_clean();
+					}
+					if($update_in_progress)
+						$offlineT = '<div id="server_icon" class="action-start'.$server_home['home_id'].'" >&nbsp;'. update_in_progress .'</div>';
+					else
+						$offlineT = $ministart;
+				}
+			}
+			else{
+				$status = "offline";
+				$order = 3;
+				$address = "<span style='color:darkred;font-weight:bold;'>Agent Offline</span>";
+			}
+			$user = $db->getUserById($server_home['user_id_main']);
+
+			// Template
+			@$first = "<tr class='maintr$trclass'>";
+				$first .= "<td class='collapsible' data-status='$status' data-pos='$pos'><span class='hidden'>$order</span>" . "<img src='" . check_theme_image("images/$status.png") . "' />" . "</td>";
+				$first .= "<td class='collapsible'>" . "<span class='hidden'>$mod</span><img src='$icon_path' />" . "</td>";
+				$first .= "<td class='collapsible serverId hide'>" . $server_home["home_id"] . "</td>";
+				$first .= "<td class='collapsible' data-status='$status' data-pos='$pos'><b>" . htmlentities($server_home['home_name']) . "</b>$mod_name</td>";
+				$first .= "<td class='collapsible'>" . $address . "</td>";
+				$first .= "<td class='owner collapsible'>" . $user['users_login'] . "</td>";
+				$first .= "<td style='width:328px;padding:0px;'>$ctrlChkBoxes</td>";
+			$first .= "</tr>";
+
+			$second = "<tr class='expand-child'>";
+				@$second .= "<td colspan='4'>" . $refresh->getdiv($pos,"width:100%;") . "$offlineT</td>";
+				$second .= "<td class='owner' >$other_owners$groupsus</td>";
+				if( $server_xml->protocol != "teamspeak3" OR ($startup_file_exists and $server_xml->protocol == "teamspeak3") OR ($status == "offline" and $server_xml->protocol == "teamspeak3") )
+					@$second .= "<td class='operations'><div class='inline-block monitorButtonContainer'>" . trim($btns) . trim($manager) . trim($mysql) . trim($get_size) . trim($ts3opt) . "<b class='failure' style='float:left;' >$expiration_dates</b></div></td>";
+				else
+					$second .= "<td class='operations' >$ts3opt</td>";
+			$second .= "</tr>";
+			//Echo them all
+			echo "$first$second";
+		}
+	}
+	echo "</tbody>";
+
+	echo "<tfoot style='border:1px solid grey;'>
+			<tr>
+			  <td colspan='7' >
+				<div class='bloc' >
+				<img src='" . check_theme_image("images/magnifglass.png") . "' /> ". statistics .": $stats_servers_online/$stats_servers ". servers ."\n</div>
+				<div class='right bloc' >
+				  <label>". execute_selected_server_operations ."</label>
+				  <input id='execute_operations' type='submit' value='". execute_operations ."' >\n
+				</div>
+			  </td>
+			</tr>
+		  </tfoot>";
+
+	echo "</table>";
+
+	if ($isAdmin) {	
+		$homes_count = $db->getHomesFor_count('admin', $_SESSION['user_id'], $home_cfg_id,$search_field);
+	} else {
+		$isSubUser = $db->isSubUser($_SESSION['user_id']);
+
+		if ($isSubUser) {
+			$homes_count = $db->getHomesFor_count('subuser',$_SESSION['user_id'], $home_cfg_id,$search_field);
+		} else {
+			$homes_count = $db->getHomesFor_count('user_and_group',$_SESSION['user_id'], $home_cfg_id,$search_field);
+		}	
+	}
+
+
+	if(isset($_GET['home_cfg_id']) && !empty($_GET['home_cfg_id'])){
+	$uri = '?m=gamemanager&p=game_monitor&home_cfg_id='.$_GET['home_cfg_id'].''.($search_field ? "&search=$search_field" : "").'&limit='.$home_limit.'&page=';
+	}
+	else{
+	$uri = '?m=gamemanager&p=game_monitor'.($search_field ? "&search=$search_field" : "").'&limit='.$home_limit.'&page=';	
+	}
+	
+	if(!isset($_GET['home_id-mod_id-ip-port']) && !isset($_GET['home_id']))
+	{echo paginationPages($homes_count[0]['total'], $home_page, $home_limit, $uri, 3, 'serverMonitor');}
+
+	echo "<div id=translation data-title='". upload_map_image .
+		 "' data-upload_button='". upload_image .
+		 "' data-bad_file='". jpg_gif_png_less_than_1mb .
+		 "' data-upload_failure='". check_dev_console .
+		 "' ></div>\n";
+	?>
+	<script type="text/javascript">
+	<?php echo $refresh->build(isset($settings['query_cache_life']) ? $settings['query_cache_life'] * 2000 : 60000); ?>
+	</script>
+	<?php
+}
+?>