1
0

util.php 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <?php
  2. /*
  3. *
  4. * OGP - Open Game Panel
  5. * Copyright (C) 2008 - 2018 The OGP Development Team
  6. *
  7. * http://www.opengamepanel.org/
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  22. *
  23. */
  24. echo '<script src="js/modules/util.js"></script>';
  25. function exec_ogp_module()
  26. {
  27. global $db;
  28. include 'util_config.php';
  29. $userInfo = $db->getUserById($_SESSION['user_id']);
  30. $userRole = $userInfo['users_role'];
  31. $commands = array();
  32. foreach($availableCommands as $command){
  33. if($userRole == 'admin' && $command['admin'] === true){
  34. $commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
  35. }
  36. if($userRole == 'user' && $command['user'] === true){
  37. $commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
  38. }
  39. if($userRole == 'subuser' && $command['subuser'] === true){
  40. $commands[] = '<option value="'.$command['title'].'">'.get_lang($command['title']).'</option>';
  41. }
  42. }
  43. ?>
  44. <h2><?php echo get_lang('module_name'); ?></h2>
  45. <div id="tabs">
  46. <ul>
  47. <li><a href="#tabs-1"><?php echo get_lang('network_tools'); ?></a></li>
  48. <li><a href="#tabs-2"><?php echo get_lang('sourcemod_admins'); ?></a></li>
  49. <li><a href="#tabs-3"><?php echo get_lang('amx_mod_admins'); ?></a></li>
  50. <li><a href="#tabs-4"><?php echo get_lang('steam_converter'); ?></a></li>
  51. </ul>
  52. <div id="tabs-1">
  53. <div>
  54. <span id="loading_agents" class="show"><?php echo get_lang('loading_agents'); ?></span>
  55. <span id="loading_failed" class="hide"><?php echo get_lang('loading_failed'); ?></span>
  56. <span id="no_commands" class="hide"><?php echo get_lang('no_commands'); ?></span>
  57. <span id="agents_offline" class="hide"><?php echo get_lang('agents_offline'); ?></span>
  58. </div>
  59. <div id="options" class="hide">
  60. <div><?php echo get_lang('your_ip'); ?> <span id="your-address"><?php echo getClientIPAddress(); ?></span></div>
  61. <form action="" method="POST" id="network_tools">
  62. <div id="select_agent"></div>
  63. <label for="command"><?php echo get_lang('command'); ?></label>
  64. <select id="command" name="command"><?php echo implode('', $commands); ?></select>
  65. <label for="remote_target"><?php echo get_lang('remote_target'); ?></label>
  66. <input type="text" id="remote_target" name="remote_target" required>
  67. <button type="submit"><?php echo get_lang('submit'); ?></button>
  68. </form>
  69. </div>
  70. <div id="loading" class="hide"></div>
  71. <div id="output" class="hide"></div>
  72. </div><!--/#tabs-1-->
  73. <div id="tabs-2">
  74. <div>
  75. <div>
  76. <span id="no_servers" class="hide"><?php echo get_lang('no_servers'); ?></span>
  77. </div>
  78. <div id="add_admin" class="hide">
  79. <form action="" method="POST" id="addadmin_form">
  80. <div id="games"></div>
  81. <label for="addSteamid"><?php echo get_lang('steamid'); ?></label>
  82. <input type="text" id="addSteamid" name="addSteamid" pattern="^STEAM_[01]:[01]:\d+$" required>
  83. <label for="immunity"><?php echo get_lang('immunity'); ?></label>
  84. <input type="number" id="immunity" name="immunity" min="1" max="99">
  85. <label for="sourcemod_perms"><?php echo get_lang('sourcemod_perms'); ?></label>
  86. <select id="sourcemod_perms" name="sourcemod_perms">
  87. <option value="root"><?php echo get_lang('sourcemod_perm_root'); ?></option>
  88. <option value="custom"><?php echo get_lang('sourcemod_perm_custom'); ?></option>
  89. </select>
  90. <div id="sourcemod_flagList" class="hide">
  91. <fieldset>
  92. <?php
  93. foreach(range('a', 't') as $flag){
  94. ?>
  95. <div class="item">
  96. <input type="checkbox" id="flag_<?php echo $flag; ?>" name="flags[]" value="<?php echo $flag; ?>">
  97. <label for="flag_<?php echo $flag; ?>"><?php echo get_lang('sourcemod_flag_'.$flag); ?></label>
  98. </div>
  99. <?php
  100. }
  101. ?>
  102. </fieldset>
  103. </div>
  104. <input type="hidden" name="remote_server_id" id="remote_server_id" value="">
  105. <input type="hidden" name="gameserver_name" id="gameserver_name" value="">
  106. <input type="hidden" name="gameserver_ip" id="gameserver_ip" value="">
  107. <input type="hidden" name="gameserver_port" id="gameserver_port" value="">
  108. <button type="submit"><?php echo get_lang('submit'); ?></button>
  109. </form>
  110. </div>
  111. <div id="invalid_server" class="hide"><?php echo get_lang('server_not_selected'); ?></div>
  112. <div id="invalid_steamid_admin" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
  113. <div id="invalid_response_admin" class="hide"><?php echo get_lang('post_failed'); ?></div>
  114. <div id="invalid_immunity" class="hide"><?php echo get_lang('invalid_immunity'); ?></div>
  115. <div id="all_servers_offline" class="hide"><?php echo get_lang('agents_offline'); ?></div>
  116. <div id="addadmin_response" class="hide"></div>
  117. </div>
  118. </div><!--/#tabs-2-->
  119. <div id="tabs-3">
  120. <div>
  121. <div>
  122. <span id="amx_no_servers" class="hide"><?php echo get_lang('no_servers'); ?></span>
  123. </div>
  124. <div id="amx_add_admin" class="hide">
  125. <form action="" method="POST" id="amx_addadmin_form">
  126. <div id="amx_games"></div>
  127. <label for="amx_login_type"><?php echo get_lang('amx_login_type'); ?></label>
  128. <select id="amx_login_type" name="amx_login_type">
  129. <option value="amx_login_steamid"><?php echo get_lang('amx_login_steamid'); ?></option>
  130. <option value="amx_login_nick_pass"><?php echo get_lang('amx_login_nick_pass'); ?></option>
  131. </select>
  132. <div id="amx_login_steamid">
  133. <label for="amx_Steamid"><?php echo get_lang('steamid'); ?></label>
  134. <input type="text" id="amx_Steamid" name="amx_Steamid" pattern="^STEAM_[01]:[01]:\d+$" required>
  135. </div>
  136. <div id="amx_login_nick_pass" class="hide">
  137. <label for="amx_Nickname"><?php echo get_lang('nickname'); ?></label>
  138. <input type="text" id="amx_Nickname" name="amx_Nickname" pattern="^[^\s][A-zÀ-ÿ0-9 !@)(,}/|\.:?;{#$%&*+=-]{1,28}[^\s]$">
  139. <label for="amx_Password"><?php echo get_lang('password'); ?></label>
  140. <input type="text" id="amx_Password" name="amx_Password" pattern="^[^\s][A-zÀ-ÿ0-9 !@)(,}/|\.:?;{#$%&*+=-]{1,28}[^\s]$">
  141. </div>
  142. <label for="amx_mod_perms"><?php echo get_lang('amx_mod_perms'); ?></label>
  143. <select id="amx_mod_perms" name="amx_mod_perms">
  144. <option value="root"><?php echo get_lang('amx_mod_perm_root'); ?></option>
  145. <option value="custom"><?php echo get_lang('amx_mod_perm_custom'); ?></option>
  146. </select>
  147. <div id="amx_mod_flagList" class="hide">
  148. <fieldset>
  149. <?php
  150. foreach(range('a', 'u') as $flag){
  151. ?>
  152. <div class="amx_item">
  153. <input type="checkbox" id="amx_flag_<?php echo $flag; ?>" name="amx_flags[]" value="<?php echo $flag; ?>">
  154. <label for="amx_flag_<?php echo $flag; ?>"><?php echo get_lang('amx_mod_flag_'.$flag); ?></label>
  155. </div>
  156. <?php
  157. }
  158. ?>
  159. </fieldset>
  160. </div>
  161. <input type="hidden" name="remote_server_id" id="amx_remote_server_id" value="">
  162. <input type="hidden" name="gameserver_name" id="amx_gameserver_name" value="">
  163. <input type="hidden" name="gameserver_ip" id="amx_gameserver_ip" value="">
  164. <input type="hidden" name="gameserver_port" id="amx_gameserver_port" value="">
  165. <button type="submit"><?php echo get_lang('submit'); ?></button>
  166. </form>
  167. </div>
  168. <div id="amx_invalid_server" class="hide"><?php echo get_lang('server_not_selected'); ?></div>
  169. <div id="amx_invalid_steamid_admin" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
  170. <div id="amx_invalid_nickname_admin" class="hide"><?php echo get_lang('invalid_nickname'); ?></div>
  171. <div id="amx_invalid_password_admin" class="hide"><?php echo get_lang('invalid_password'); ?></div>
  172. <div id="amx_invalid_response_admin" class="hide"><?php echo get_lang('post_failed'); ?></div>
  173. <div id="amx_all_servers_offline" class="hide"><?php echo get_lang('agents_offline'); ?></div>
  174. <div id="amx_addadmin_response" class="hide"></div>
  175. </div>
  176. </div><!--/#tabs-3-->
  177. <div id="tabs-4">
  178. <div>
  179. <form action="" method="POST" id="steam_converter">
  180. <label for="steam_input">SteamID / SteamID3 / SteamID64 / CustomID:</label>
  181. <input type="text" name="steam_input" id="steam_input" required>
  182. <button type="submit"><?php echo get_lang('submit'); ?></button>
  183. </form>
  184. </div>
  185. <div id="invalid_steamid" class="hide"><?php echo get_lang('invalid_steamid'); ?></div>
  186. <div id="invalid_response" class="hide"><?php echo get_lang('post_failed'); ?></div>
  187. <div id="steam_info">
  188. <div id="steamLink"></div>
  189. <div id="steamId"></div>
  190. <div id="steamId3"></div>
  191. <div id="steamId64"></div>
  192. </div>
  193. </div><!--/#tabs-4-->
  194. </div> <!--/#tabs-->
  195. <div id="translation"
  196. data-target_empty="<?=get_lang('target_empty')?>"
  197. data-command_empty="<?=get_lang('command_empty')?>"
  198. data-agent_invalid="<?=get_lang('agent_invalid')?>"
  199. data-post_failed="<?=get_lang('post_failed')?>"
  200. data-select_server="<?=get_lang('select_server')?>"
  201. data-select_server_option="<?=get_lang('select_server_option')?>"
  202. data-select_agent="<?=get_lang('select_agent')?>" ></div>
  203. <?php
  204. }
  205. ?>