-
Notifications
You must be signed in to change notification settings - Fork 92
/
Copy pathinternal.min.js
1 lines (1 loc) · 32.7 KB
/
internal.min.js
1
function admin_show_create(){$.ajax({url:ajaxURL,data:"a=admin_create_form",success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function admin_create(){var a=$("#username").val();var b=$("#pass1").val();var c=$("#pass2").val();var d=$("#email").val();var e=$("#fname").val();var f=$("#lname").val();if(a==""||d==""||b==""){alert("The Username,Email and Password fields must be filled.");return false}if(b!=c){alert("Passwords do not match!");return false}var g="&do=create&username="+a+"&password="+b+"&email="+d+"&fname="+e+"&lname="+f;$.ajax({url:ajaxURL,type:"POST",data:"a=admin_actions"+g,success:function(a){if(a=="success"){infobox("s","");setTimeout("$.modal.close();mainpage('admins','')",1e3)}else{infobox("f","Failed: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function admin_edit(a){if(a==""){alert("No User ID provided");return false}$.ajax({url:ajaxURL,data:"a=admin_edit&id="+a,success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function admin_save(a){if(a==""){alert("No User ID given!");return false}var b=$("#username").val();var c=$("#pass1").val();var d=$("#pass2").val();var e=$("#email").val();var f=$("#fname").val();var g=$("#lname").val();if(c!=d){alert("Your passwords do not match! Please try again");$("#pass1").focus();return false}else{var h="&password="+c}var i="&id="+a+"&username="+b+"&email="+e+"&fname="+f+"&lname="+g+h;$.ajax({url:ajaxURL,type:"POST",data:"a=admin_actions&do=save"+i,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function admin_confirm_delete(a){if(a==""){alert("No User ID given");return false}var b=confirm("Are you sure?\n\nDelete this administrator?");if(b)admin_delete(a);else return false}function admin_delete(a){if(a==""){alert("No User ID given");return false}$.ajax({url:ajaxURL,data:"a=admin_actions&do=delete&id="+a,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a);setTimeout("mainpage('admins','')",1e3)}})}function cloud_game_info(a){if(a==""){alert("No Cloud Game ID given");return false}$.ajax({url:ajaxURL,data:"a=cloud_gameinfo&id="+a,success:function(b){$("#modal").html(b+'<br /><br /><div align="center"><input type="button" class="button" value="Click to Install" onClick="javascript:cloud_install_game('+a+');" /></div>').modal({overlayClose:true,onClose:function(a){a.data.fadeOut(function(){a.container.hide(function(){a.overlay.slideUp(function(){$.modal.close()})})})}})},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function cloud_install_game(a){if(a==""){alert("No Cloud Game ID given");return false}$.ajax({url:ajaxURL,data:"a=cloud_gameinstall&id="+a,success:function(a){infobox("s","");$.modal.close()},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function cloud_getall(){$.ajax({url:ajaxURL,data:"a=cloud_actions&do=getall",beforeSend:function(){$("#cloudtbl").append('<tr id="cldld"><td colspan="4" style="font-size:10pt;"><i>Loading cloud data ...</i></td></tr>')},success:function(a){$("#cldld").hide();$("#cloudtbl").append(a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function confirm_delete_file(a,b,c){if(a==""||b==""){alert("No server ID or path given!");return false}var d=confirm("Are you sure?\n\nThis file will be deleted permanently!");if(d)delete_file(a,b,c);else return false}function delete_file(a,b,c){if(a==""||b==""){alert("No server ID or filename given!");return false}$.ajax({url:ajaxURL,data:"a=file_actions&do=delete&id="+a+"&file="+b,success:function(a){if(a=="success"){$("#file_"+c).fadeOut("slow");infobox("s","")}else{infobox("f","Failed to delete the file: ("+a+")")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function confirm_delete_dir(a,b){if(a==""||b==""){alert("No server ID or path given ("+a+", "+b+") !");return false}var c=confirm('Are you sure?\n\nRemove this directory "'+b+'" ?');if(c)delete_dir(a,b);else return false}function delete_dir(a,b){if(a==""||b==""){alert("No server ID or directory given!");return false}$.ajax({url:ajaxURL,data:"a=file_actions&do=delete_dir&id="+a+"&file="+b,success:function(b){if(b=="success"){infobox("s","");setTimeout("load_dir("+a+",'',1,'');",1e3)}else{infobox("f","Failed to delete the directory: ("+b+")")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function load_dir(a,b,c,d){if(a==""){alert("No server ID given!");return false}if(!c&&b==""){alert("No directory given!");return false}if(d=="reset")var e="&browsetpl=1&reset=1";else if(d)var e="&browsetpl=1";else var e="";$.ajax({url:ajaxURL,data:"a=file_load_dir&id="+a+"&dir="+b+"&back="+c+e,success:function(a){if(d){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}else{$("#panel_center").hide().html(a).fadeIn("fast")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function file_savecontent(a,b){if(a==""||b==""){alert("Insufficient info given!");return false}var c=$("#filecontent_cur").val();$.ajax({url:ajaxURL,type:"POST",data:"a=file_actions&do=savecontent&id="+a+"&file="+b+"&content="+c,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed to save the file: ("+a+")")},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function file_show_addfile(a){if(a==""){alert("Insufficient info given!");return false}$.ajax({url:ajaxURL,data:"a=file_actions&do=show_addfile&id="+a,success:function(a){$("#modal").css("height","").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close();$("#modal").css("height","")})}})},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function file_show_add_dir(a){if(a==""){alert("Insufficient info given!");return false}$.ajax({url:ajaxURL,data:"a=file_actions&do=show_add_dir&id="+a,success:function(a){$("#modal").css("height","100").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close();$("#modal").css("height","")})}})},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function file_add_newdir(a){if(a==""){alert("Insufficient info given!");return false}var b=$("#new_dirname").val();if(b==""){alert("You must specify a directory name!");return false}$.ajax({url:ajaxURL,type:"POST",data:"a=file_actions&do=create_newdir&id="+a+"&dir="+b,success:function(c){$.modal.close();if(c=="success"){infobox("s","");var d=$("#files_table tr").length;var e=parseInt(d)+parseInt(1);$("#files_table").append('<tr id="file_'+e+'" style="cursor:default;background:#FFF;" class="filerows"><td><img src="../images/icons/medium/folder.png" border="0" width="28" height="28" style="cursor:pointer;" onClick="javascript:load_dir('+a+",'"+b+'\',0);" /></td><td align="left"><span class="links" style="cursor:pointer;" onClick="javascript:load_dir('+a+",'"+b+"',0);\">"+b+'</span></td><td>Today</td><td>Today</td><td>4096</td><td style="cursor:default;"> </td></tr>')}else{infobox("f","Failed to create the directory: ("+c+")")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function file_savenewfile(a){if(a==""){alert("Insufficient info given!");return false}var b=$("#newfilename").val();var c=$("#filecontent").val();if(b==""){alert("You must specify a filename!");return false}$.ajax({url:ajaxURL,type:"POST",data:"a=file_actions&do=save_newfile&id="+a+"&file="+b+"&content="+c,success:function(c){$.modal.close();if(c=="success"){infobox("s","");var d=$("#files_table tr").length;var e=parseInt(d)+parseInt(1);if(/\.(txt|cfg|rc|log|ini|inf|vdf)$/i.test(b))var f=' class="links" style="cursor:pointer;" onClick="javascript:load_dir('+a+",'"+b+"',0);\" ";else var f=' class="links" style="font-weight:normal;cursor:default;text-decoration:none;" ';$("#files_table").append('<tr id="file_'+e+'" style="cursor:default;background:#FFF;" class="filerows"><td><img src="../images/icons/medium/file.png" border="0" width="28" height="28" '+f+'/></td><td align="left"><span '+f+">"+b+'</span></td><td>Today</td><td>Today</td><td> </td><td style="cursor:default;"><img src="../images/icons/medium/error.png" width="25" height="25" border="0" title="Delete" style="cursor:pointer;" onClick="javascript:confirm_delete_file('+a+",'"+b+"',"+e+');" /></td></tr>')}else{infobox("f","Failed to save the file: ("+c+")")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function game_tab_startup(a){if(a==""){alert("No game ID given");return false}$.ajax({url:ajaxURL,data:"a=games_startup&id="+a,success:function(a){$("#panel_center").hide().html(a).fadeIn("fast")}})}function game_save(a){if(a==""){alert("No game ID given!");return false}var b=encodeURIComponent($("#port").val());var c=encodeURIComponent($("#name").val());var d=encodeURIComponent($("#intname").val());var e=encodeURIComponent($("#working_dir").val());var f=encodeURIComponent($("#pid_file").val());var g=encodeURIComponent($("#desc").val());var h=encodeURIComponent($("#update_cmd").val());var i=encodeURIComponent($("#simplecmd").val());var j="&id="+a+"&do=save&desc="+g+"&port="+b+"&name="+c+"&intname="+d+"&working_dir="+e+"&pid_file="+f+"&update_cmd="+h+"&simplecmd="+i;$.ajax({url:ajaxURL,type:"POST",data:"a=games_actions"+j,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function game_add(){var a=encodeURIComponent($("#port").val());var b=encodeURIComponent($("#name").val());var c=encodeURIComponent($("#intname").val());var d=encodeURIComponent($("#working_dir").val());var e=encodeURIComponent($("#pid_file").val());var f=encodeURIComponent($("#desc").val());var g=encodeURIComponent($("#update_cmd").val());var h=encodeURIComponent($("#simplecmd").val());if(a==""){alert("You must fill out the Port field");return false}else if(b==""){alert("You must fill out the Name field");return false}else if(c==""){alert("You must fill out the Internal Name field");return false}else if(h==""){alert("You must fill out the CMD field");return false}var i="&do=add&desc="+f+"&port="+a+"&name="+b+"&intname="+c+"&working_dir="+d+"&pid_file="+e+"&update_cmd="+g+"&simplecmd="+h;$.ajax({url:ajaxURL,type:"POST",data:"a=games_actions"+i,success:function(a){if(a=="success"){infobox("s","");setTimeout("mainpage('games','')",1e3)}else{infobox("f","Failed: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function game_confirm_del(a){if(a==""){alert("No game ID provided!");return false}var b=confirm("Are you sure?\n\nDelete this game?");if(b)game_del(a);else return false}function game_del(a){if(a==""){alert("No game ID provided!");return false}$.ajax({url:ajaxURL,data:"a=games_actions&do=delete&id="+a,success:function(a){if(a=="success"){infobox("s","");setTimeout("mainpage('games','')",1e3)}else{infobox("f","Failed: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function games_save_startup(a){if(a==""){alert("No game ID provided!");return false}var b="";var c=$("#sort_list").val();if($("#smp").is(":checked"))var d="smp";else var d="str";$("input").each(function(a,c){var d=c.id;var e=encodeURIComponent(c.value);if($("#"+d).is(":checked")){$("#"+d).val("1");e="1"}b+="&"+d+"="+e});$.ajax({url:ajaxURL,data:"a=games_actions&do=startup_save&id="+a+b+"&start_type="+d+"&sort_list="+c,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){alert("Error: "+a+", b: "+b+", c: "+c)}})}function games_del_startup(a,b){if(a==""||b==""){alert("No startup ID or server ID provided!");return false}$.ajax({url:ajaxURL,data:"a=games_actions&do=startup_del_item&id="+a+"&serverid="+b,success:function(b){if(b=="success"){$("#sortitm_"+a).fadeOut("slow")}else{infobox("f","Failed: "+b)}},error:function(a,b,c){alert("Error: "+a+", b: "+b+", c: "+c)}})}function games_confirm_del_startup(a,b){var c=confirm("Are you sure?\n\nDelete this default startup item?");if(c)games_del_startup(a,b);else return false}function game_showcreate(){$.ajax({url:ajaxURL,data:"a=game_actions&do=show_creategame",success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function install_start(){var a=$("#db_host").val();var b=$("#db_name").val();var c=$("#db_user").val();var d=$("#db_pass").val();var e=$("#admin_user").val();var f=$("#admin_email").val();var g=$("#admin_pass").val();var h=$("#admin_pass2").val();if(a==""){infobox("i","You left a field blank!");$("#db_host").focus();return false}else if(b==""){infobox("i","You left a field blank!");$("#db_name").focus();return false}else if(c==""){infobox("i","You left a field blank!");$("#db_user").focus();return false}else if(d==""){infobox("i","You left a field blank!");$("#db_pass").focus();return false}else if(e==""){infobox("i","You left a field blank!");$("#admin_user").focus();return false}else if(f==""){infobox("i","You left a field blank!");$("#admin_email").focus();return false}else if(g==""){infobox("i","You left a field blank!");$("#admin_pass").focus();return false}else if(h==""){infobox("i","You left a field blank!");$("#admin_pass2").focus();return false}if(g!=h){infobox("f","Your passwords do not match!");$("#admin_pass").focus();return false}$.ajax({url:"install_actions.php",type:"POST",data:"a=start"+"&db_host="+a+"&db_name="+b+"&db_user="+c+"&db_pass="+d+"&admin_user="+e+"&admin_email="+f+"&admin_pass="+g,beforeSend:function(){$("#install_btn").hide()},success:function(a){if(a=="success"){infobox("s","");setTimeout("window.location='../admin/'",2e3)}else{$("#install_btn").fadeIn();infobox("f","<b>Error: </b>"+a)}},error:function(a,b,c){$("#install_btn").fadeIn();infobox("f","Error: "+b+", "+c)}})}function login_admin(){var a=$.base64.encode("xxz"+$("#login_user").val()+"yy");var b=$.base64.encode("xyy"+$("#login_pass").val()+"yyx");if(a==""||b=="")return false;$.ajax({url:ajaxURL,type:"POST",data:"a=login_actions&do=adminlogin&user="+a+"&pass="+b,success:function(a){if(a=="success"){infobox("s","Successfully logged in! Redirecting ...");setTimeout("window.location='index.php'",1e3)}else{infobox("f","<b>Login Failed:</b> "+a);$("#login_pass").val("")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function login_user(){var a=$.base64.encode("xxff"+$("#login_user").val()+"yyuuu");var b=$.base64.encode("xyd"+$("#login_pass").val()+"yyd");if(a==""||b=="")return false;$.ajax({url:ajaxURL,type:"POST",data:"a=login_actions&do=userlogin&user="+a+"&pass="+b,success:function(a){if(a=="success"){infobox("s","Successfully logged in! Redirecting ...");setTimeout("window.location='index.php'",1e3)}else{infobox("f","<b>Login Failed:</b> "+a);$("#login_pass").val("")}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function network_show_create(){$.ajax({url:ajaxURL,data:"a=network_create_form",success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function network_show_addip(a){if(a==""){alert("No Network ID provided");return false}$.ajax({url:ajaxURL,data:"a=network_actions&do=show_addip&id="+a,success:function(a){$("#modal").css("height","120").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close();$("#modal").css("height","")})}});setTimeout("$('#new_ip').blur()",200)}})}function network_addip(a){var b=$("#new_ip").val();if(b==""){alert("Please specify an IP Address.");return false}else if(a==""){alert("No Network ID provided!");return false}$.ajax({url:ajaxURL,type:"POST",data:"a=network_actions&do=addip&id="+a+"&ip="+b,success:function(a){if(a=="success"){infobox("s","");$.modal.close();$("#noips_row").hide();$("#netip_table").append('<tr style="background:#FFF;"><td>'+b+"</td><td> </td></tr>")}else{$.modal.close();infobox("f","Failed: "+a)}},error:function(a,b,c){$.modal.close();infobox("f","Error: "+b+", "+c)}})}function network_create(){var a=$("#ip").val();var b=$("#is_local").val();var c=$("#location").val();var d=$("#os").val();var e=$("#datacenter").val();var f=$.base64.encode($("#login_user").val());var g=$.base64.encode($("#login_pass").val());var h=$.base64.encode($("#login_port").val());var i=$.base64.encode($("#homedir").val());var j="&do=create&ip="+a+"&is_local="+b+"&location="+c+"&os="+d+"&datacenter="+e+"&login_user="+f+"&login_pass="+g+"&login_port="+h+"&homedir="+i;$.ajax({url:ajaxURL,type:"POST",data:"a=network_actions"+j,success:function(a){if(a=="success"){infobox("s","");$("#modal").scrollTop(0);setTimeout("$.modal.close();mainpage('network','')",1e3)}else{infobox("f","Failed: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function network_edit(a){if(a==""){alert("No Network ID provided");return false}$.ajax({url:ajaxURL,data:"a=network_edit&id="+a,success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function network_save(a){if(a==""){alert("No Network ID given!");return false}var b=$("#edit_ip").val();var c=$("#edit_is_local").val();var d=$("#edit_location").val();var e=$("#edit_os").val();var f=$("#edit_datacenter").val();var g=$.base64.encode($("#edit_login_user").val());var h=$.base64.encode($("#edit_login_pass").val());var i=$.base64.encode($("#edit_login_port").val());var j=$.base64.encode($("#edit_homedir").val());var k="&id="+a+"&do=save&ip="+b+"&is_local="+c+"&location="+d+"&os="+e+"&datacenter="+f+"&login_user="+g+"&login_pass="+h+"&login_port="+i+"&homedir="+j;$.ajax({url:ajaxURL,type:"POST",data:"a=network_actions"+k,success:function(a){if(a=="success"){infobox("s","");setTimeout("$.modal.close();mainpage('network','')",1e3)}else{infobox("f","Failed: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function network_confirm_delete(a){if(a==""){alert("No Network ID given");return false}var b=confirm("Are you sure?\n\nDelete this network server and ALL IP Addresses with it?");if(b)network_delete(a);else return false}function network_delete(a){if(a==""){alert("No Network ID given");return false}$.ajax({url:ajaxURL,data:"a=network_actions&id="+a+"&do=delete",success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a);$.modal.close();mainpage("network","")}})}function network_confirm_delete_ip(a){if(a==""){alert("No Network ID given");return false}var b=confirm("Are you sure?\n\nDelete this IP Address?");if(b)network_delete_ip(a);else return false}function network_delete_ip(a){if(a==""){alert("No Network ID given");return false}$.ajax({url:ajaxURL,data:"a=network_actions&id="+a+"&do=delete_ip",success:function(b){if(b=="success")infobox("s","");else infobox("f","Failed: "+b);$("#ip_"+a).fadeOut()}})}function server_tab_info(a){if(a==""){alert("No server ID given");return false}$.ajax({url:ajaxURL,data:"a=server_info&id="+a,success:function(a){$("#panel_center").hide().html(a).fadeIn("fast")}})}function server_tab_settings(a){if(a==""){alert("No server ID given");return false}$.ajax({url:ajaxURL,data:"a=server_settings&id="+a,success:function(a){$("#panel_center").hide().html(a).fadeIn("fast")}})}function server_tab_files(a){if(a==""){alert("No server ID given");return false}$.ajax({url:ajaxURL,data:"a=server_files&id="+a,success:function(a){$("#panel_center").hide().html(a).fadeIn("fast")}})}function server_tab_startup(a){if(a==""){alert("No server ID given");return false}$.ajax({url:ajaxURL,data:"a=server_startup&id="+a,success:function(a){$("#panel_center").hide().html(a).fadeIn("fast")}})}function srv_settings_save(a){if(a==""){alert("No server ID given!");return false}var b=encodeURIComponent($("#desc").val());var c=encodeURIComponent($("#userid").val());var d=encodeURIComponent($("#ip").val());var e=encodeURIComponent($("#update_cmd").val());var f=encodeURIComponent($("#cmd").val());var g=encodeURIComponent($("#startup_type").val());var h=encodeURIComponent($("#port").val());var i=encodeURIComponent($("#working_dir").val());var j=encodeURIComponent($("#pid_file").val());var k="&id="+a+"&description="+b+"&userid="+c+"&ip="+d+"&port="+h+"&working_dir="+i+"&pid_file="+j+"&startup="+g+"&update_cmd="+e+"&cmd="+f;$.ajax({url:ajaxURL,type:"POST",data:"a=server_actions&do=settings_save"+k,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function server_save_startup(a){if(a==""){alert("No game ID provided!");return false}var b="";var c=$("#sort_list").val();if($("#smp").is(":checked"))var d="smp";else var d="str";$("input").each(function(a,c){var d=c.id;var e=encodeURIComponent(c.value);if($("#"+d).is(":checked")){$("#"+d).val("1");e="1"}b+="&"+d+"="+e});$.ajax({url:ajaxURL,data:"a=server_actions&do=startup_save&id="+a+b+"&start_type="+d+"&sort_list="+c,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){alert("Error: "+a+", b: "+b+", c: "+c)}})}function server_add_startup(){var a=parseFloat($("#newitemnum").val())+1;$("#newitemnum").val(a);$("#strtbl").append('<tbody id="sortitm_'+a+'" class="sortable"><tr><td width="200"><div class="str_itm_ed"><input type="text" class="inputs" id="additm_'+a+'" value="" /></div></td><td width="200"><div class="str_val_ed"><input type="text" class="inputs" id="addval_'+a+'" value="" /></div></td><td width="120" style="cursor:default;"><input type="checkbox" id="addusred_'+a+'" value="0" /></td></tr></tbody>')}function server_del_startup(a,b){if(a==""||b==""){alert("No startup ID or server ID provided!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=startup_del_item&id="+a+"&serverid="+b,success:function(b){if(b=="success"){$("#sortitm_"+a).fadeOut("slow")}else{infobox("f","Failed: "+b)}},error:function(a,b,c){alert("Error: "+a+", b: "+b+", c: "+c)}})}function server_confirm_del_startup(a,b){var c=confirm("Are you sure?\n\nDelete this startup item?");if(c)server_del_startup(a,b);else return false}function server_restart(a){if(a==""){alert("No server ID given!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=restart&id="+a,beforeSend:function(){infobox("i","Restarting ...")},success:function(b){if(b=="success")infobox("s","");else infobox("f","Failed: "+b);setTimeout("server_tab_info("+a+")",3e3)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function server_stop(a){if(a==""){alert("No server ID given!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=stop&id="+a,beforeSend:function(){infobox("i","Stopping ...")},success:function(b){if(b=="success")infobox("s","");else infobox("f","Failed: "+b);setTimeout("server_tab_info("+a+")",3e3)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function server_update(a){if(a==""){alert("No server ID given!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=update&id="+a,beforeSend:function(){infobox("i","Starting update ...");setTimeout("server_tab_info("+a+")",2e3)},success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function server_show_create(){$.ajax({url:ajaxURL,data:"a=server_create_form",success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function server_create(){var a=$("#create_game").val();var b=$("#create_network").val();var c=$("#create_owner").val();var d=$("#create_port").val();var e=$("#create_desc").val();$.ajax({url:ajaxURL,data:"a=server_actions&do=create&gameid="+a+"&netid="+b+"&ownerid="+c+"&port="+d+"&desc="+e,success:function(a){if(a=="success"){$.modal.close();mainpage("servers","")}else{$("#create_info").hide().html("<b>Failed:</b> "+a).fadeIn()}},error:function(a,b,c){alert("Error: "+b+", "+c)}})}function server_getport(){var a=$("#create_game").val();if(a==""){alert("No game given!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=create_getport&gameid="+a,success:function(a){$("#create_port").val(a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function server_getinfo(a){if(a==""){alert("No server ID given!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=getinfo&id="+a,dataType:"json",beforeSend:function(){$("#gamecpu").html("<i>Connecting ...</i>")},success:function(a){if(a.respid){var b=a.respid;var c=a.ppid;var d=a.cpu;var e=a.mem;if(a.cpid)var f=", Child PID: "+a.cpid;else var f="";$("#gamecpu").hide().html("<b>CPU:</b> "+d+"%, <b>Memory:</b> "+e+"%").fadeIn("fast");$("#gamepids").hide().html("Restart PID: "+b+", Server PID: "+c+f).fadeIn("fast")}else if(a.error){$("#gamecpu").html("Error: ("+a.error+")");$("#gamepids").hide()}else{$("#gamecpu").html("Unable to get system info ("+a+")");$("#gamepids").hide()}},error:function(a,b,c){$("#gamecpu").html("Unable to get system info: "+a+", b: "+b+", c: "+c);$("#gamepids").hide()}})}function confirm_server_delete(a){if(a==""){alert("No server ID given!");return false}var b=confirm("Are you sure?\n\nDelete this server and ALL its files permanently?");if(b)server_delete(a);else return false}function server_delete(a){if(a==""){alert("No server ID given!");return false}$.ajax({url:ajaxURL,data:"a=server_actions&do=delete&id="+a,success:function(a){if(a=="success"){infobox("s","");setTimeout("mainpage('servers','')",1e3)}else{infobox("f","Error: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function settings_save(){var a=encodeURIComponent($("#lang").val());var b=encodeURIComponent($("#email").val());var c=encodeURIComponent($("#company").val());var d=encodeURIComponent($("#theme").val());var e=encodeURIComponent($("#local_dir").val());var f="&lang="+a+"&email="+b+"&company="+c+"&theme="+d+"&local_dir="+e+"&pure=1";$.ajax({url:ajaxURL,type:"POST",data:"a=settings_save"+f,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function template_show_create(a){if(a==""){alert("No template ID given");return false}$.ajax({url:ajaxURL,data:"a=template_create_form&id="+a,success:function(a){$("#panel_center").hide().html(a).fadeIn("fast")}})}function template_edit(a){if(a==""){alert("No template ID given");return false}$.ajax({url:ajaxURL,data:"a=template_edit&id="+a,success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function template_save(a,b){if(a==""||b==""){alert("No Template ID or Network ID given!");return false}var c=encodeURIComponent($("#desc").val());var d=$("#is_default").val();var e="&id="+a+"&netid="+b+"&do=save&desc="+c+"&default="+d;$.ajax({url:ajaxURL,type:"POST",data:"a=template_actions"+e,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a);setTimeout("$.modal.close();",1e3)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function template_confirm_delete(a){if(a==""){alert("No template ID given");return false}var b=confirm("Are you sure?\n\nDelete this template?");if(b)template_delete(a);else return false}function template_delete(a){if(a==""){alert("No template ID given");return false}$.ajax({url:ajaxURL,data:"a=template_actions&id="+a+"&do=delete",success:function(b){if(b=="success")infobox("s","");else infobox("f","Failed: "+b);$.modal.close();$("#tpl_"+a).fadeOut("slow")}})}function template_create(){var a=$("#game").val();var b=$("#network").val();var c=$("#file_path").val();var d=$("#is_default").val();var e=$("#desc").val();if(a==""){alert("Please choose a Game!");return false}else if(b==""){alert("Please choose a Network Server");return false}$.ajax({url:ajaxURL,data:"a=template_actions&do=create&gameid="+a+"&netid="+b+"&file_path="+c+"&default="+d+"&desc="+e,beforeSend:function(){infobox("i","<i>Starting ...</i>")},success:function(b){if(b=="success"){infobox("s","");setTimeout("mainpage('templates',"+a+")",1e3)}else{infobox("f","Failed: "+b)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function template_checkdone(){$.ajax({url:ajaxURL,data:"a=template_actions&do=checkdone",success:function(a){if(a=="success"){$("#results").html("Templates OK")}else if(a=="updated"){$("#results").html("Updated!");var b=$("#tplid").val();setTimeout("mainpage('templates',"+b+")",1e3)}else{infobox("f","Error: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function tpl_check_statuses(){$("#results").append("Checking...<br>");$.ajax({url:ajaxURL,data:"a=template_status",dataType:"JSON",beforeSend:function(){$("#results").html("<b>RT:</b> Updating ...")},success:function(a){$("#results").html("<b>RT:</b> Idle.");$.each(a,function(a,b){thisID=b.id;thisSteamPercent=b.steam_percent;thisStatus=b.status;if(thisStatus=="steam_running")$("#status_"+thisID).html('<font color="blue">Steam Install: '+thisSteamPercent+"%</font>");else if(thisStatus=="running")$("#status_"+thisID).html('<font color="orange">Running</font>');else if(thisStatus=="complete")$("#status_"+thisID).html('<font color="green">Complete</font>');else if(thisStatus=="failed")$("#status_"+thisID).html('<font color="red">Failed</font>');else $("#status_"+thisID).html('<font color="orange">Unknown</font>')})},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function template_browse_dir(){var a=$("#network").val();if(a==""){alert("Please select a Network Server first!");return false}$.ajax({url:ajaxURL,data:"a=file_load_dir&browsetpl=1&reset=1&id="+a,beforeSend:function(){$("#browse_done").hide();$("#modal").html("<i>Loading ...</i>").modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})},success:function(a){$("#modal").html(a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function template_browse_select(a){if(a==""){alert("No directory provided!");return false}$.modal.close();$("#file_path").val(a);$("#browse_done").fadeIn();$("#file_path").focus()}function user_show_create(){$.ajax({url:ajaxURL,data:"a=user_create_form",success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function user_create(){var a=$("#username").val();var b=$("#pass1").val();var c=$("#pass2").val();var d=$("#email").val();var e=$("#fname").val();var f=$("#lname").val();if(a==""||d==""||b==""){alert("The Username,Email and Password fields must be filled.");return false}if(b!=c){alert("Passwords do not match!");return false}var g="&do=create&username="+a+"&password="+b+"&email="+d+"&fname="+e+"&lname="+f;$.ajax({url:ajaxURL,type:"POST",data:"a=user_actions"+g,success:function(a){if(a=="success"){infobox("s","");setTimeout("$.modal.close();mainpage('users','')",1e3)}else{infobox("f","Failed: "+a)}},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function user_edit(a){if(a==""){alert("No User ID provided");return false}$.ajax({url:ajaxURL,data:"a=user_edit&id="+a,success:function(a){$("#modal").html(a).modal({overlayClose:true,opacity:70,overlayCss:{backgroundColor:"#000"},onClose:function(a){a.data.fadeOut("fast",function(){$.modal.close()})}})}})}function user_save(a){if(a==""){alert("No User ID given!");return false}var b=$("#username").val();var c=$("#pass1").val();var d=$("#pass2").val();var e=$("#email").val();var f=$("#fname").val();var g=$("#lname").val();if(c!=d){alert("Your passwords do not match! Please try again");$("#pass1").focus();return false}else{var h="&password="+c}var i="&id="+a+"&username="+b+"&email="+e+"&fname="+f+"&lname="+g+h;$.ajax({url:ajaxURL,type:"POST",data:"a=user_actions&do=save"+i,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}function user_confirm_delete(a){if(a==""){alert("No User ID given");return false}var b=confirm("Are you sure?\n\nDelete this user?");if(b)user_delete(a);else return false}function user_delete(a){if(a==""){alert("No User ID given");return false}$.ajax({url:ajaxURL,data:"a=user_actions&do=delete&id="+a,success:function(a){if(a=="success"){infobox("s","");setTimeout("mainpage('users','')",1e3)}else{infobox("f","<b>Failed: </b>"+a)}}})}function user_perm_save(a){if(a==""){alert("No User ID given!");return false}var b=$("input[name=perm_ftp]:checked").val();var c=$("input[name=perm_fm]:checked").val();var d=$("input[name=perm_str]:checked").val();var e=$("input[name=perm_upd]:checked").val();var f=$("input[name=perm_chpass]:checked").val();var g="&id="+a+"&ftp="+b+"&fm="+c+"&str="+d+"&upd="+e+"&chpass="+f;$.ajax({url:ajaxURL,type:"POST",data:"a=user_actions&do=save_perms"+g,success:function(a){if(a=="success")infobox("s","");else infobox("f","Failed: "+a)},error:function(a,b,c){infobox("f","Error: "+b+", "+c)}})}