Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 00746 00747 00748 00749 00750 00751 00752 00753 00754 00755 00756 00757 00758 00759 00760 00761 00762 00763 00764 00765 00766 00767 00768 00769 00770 00771 00772 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 00790 00791 00792 00793 00794 00795 00796 00797 00798 00799 00800 00801 00802 00803 00804 00805 00806 00807 00808 00809 00810 00811 00812 00813 00814 00815 00816 00817 00818 00819 00820 00821 00822 00823 00824 00825 00826 00827 00828 00829 00830 00831 00832 00833 00834 00835 00836 00837 00838 00839 00840 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 00863 00864 00865 00866 00867 00868 00869 00870 00871 00872 00873 00874 00875 00876 00877 00878 00879 00880 00881 00882 00883 00884 00885 00886 00887 00888 00889 00890 00891 00892 00893 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 00908 00909 00910 00911 00912 00913 00914 00915 |
class TribesServerAdmin extends UWeb.WebApplication config; var() class<TribesServerAdminSpectator> SpectatorType; var array< class<TribesWebQueryHandler> > QueryHandlerClasses; var config array<TribesWebQueryHandler> QueryHandlers; // Authentication items var TribesServerAdminSpectator Spectator; // Used to get console messages var TribesAdminUser CurAdmin; // Currently logged admin (not thread safe) var PlayInfo GamePI; var array<Gameplay.xUtil.MutatorRecord> AllMutators; var StringArray AGameType; // All available Game Types var StringArray AExcMutators; // All available Mutators (Excluded) var StringArray AIncMutators; // All Mutators currently in play var WebResponse Resp; var config string RootFrame; // This is the master frame divided in 2: Top = Header, bottom = frame page var config string HeaderPage; // This is the header menu var config string MessagePage; // Name of the file containing the message template var config string RestartPage; // This is the page that users will be transferred to when restarting the server var config string DefaultBG; var config string HighlightedBG; var config string AdminRealm; var string htm; event Init() { // TODO: Destroy if not a server Super.Init(); // glenn: i'm worried about not created the spectator for a listen server, it may cause problems // i think parts of the mp admin rely on the spectator to perform functionality that requires // a player controller or something. // david: creating 2 playercontrollers on a listen server is invalidating the value of GetLocalPlayerController, causing // weapons to disappear. Disabling creation of admin spectator on listen server for now. if (Level.NetMode == NM_DedicatedServer) { if (SpectatorType != None) Spectator = Level.Spawn(SpectatorType); else Spectator = Level.Spawn(class'TribesServerAdminSpectator'); } if (Spectator != None) Spectator.Server = self; // won't change as long as the server is up and the map hasnt changed LoadQueryHandlers(); LoadGameTypes(); LoadMutators(); Log(class@"Initialized on Port"@WebServer.ListenPort, 'ServerAdmin'); } function LoadQueryHandlers() { local int i, j, cnt; local TribesWebQueryHandler QH; local class<TribesWebQueryHandler> QHC; cnt = 0; for (i=0; i<QueryHandlerClasses.Length; i++) { QHC = QueryHandlerClasses[i]; // Skip invalid classes; if (QHC != None) { // Make sure we dont have duplicate instance of the same class for (j=0;j<QueryHandlers.Length; j++) { if (QueryHandlers[j].Class == QHC) { QHC = None; break; } } if (QHC != None) { QH = new QHC; if (QH != None) { if (QH.Init(self)) { QueryHandlers.Length = QueryHandlers.Length+1; QueryHandlers[QueryHandlers.Length - 1] = QH; } else { Log("WebQueryHandler:"@QHC@"could not be initialized", 'ServerAdmin'); } } } } } } event bool PreQuery(WebRequest Request, WebResponse Response) { if (Level == None || Level.Game == None || Level.Game.AccessControl == None) { ShowMessage(Response, "Error", "Exception Occured During Authentication!"); return false; } if (Spectator == None) { if (SpectatorType != None) Spectator = Level.Spawn(SpectatorType); else Spectator = Level.Spawn(class'TribesServerAdminSpectator'); if (Spectator != None) Spectator.Server = self; } if (Spectator == None) { ShowMessage(Response, "Error", "Exception Occured During Authentication!"); return false; } // Check authentication: // TODO: Simply use Spectator.WebLogin() or something like that if (!Level.Game.AccessControl.AdminLogin(Spectator, Request.Username, Request.Password)) { Response.FailAuthentication(AdminRealm); return false; } CurAdmin = Level.Game.AccessControl.GetLoggedAdmin(Spectator); if (CurAdmin == None) { ShowMessage(Response, "Error", "Exception Occured During Authentication!"); Level.Game.AccessControl.AdminLogout(Spectator); return false; } Resp = Response; return true; } event PostQuery(WebRequest Request, WebResponse Response) { Resp = None; CurAdmin = None; Level.Game.AccessControl.AdminLogout(Spectator); } //***************************************************************************** // // Begin Query Functions // //***************************************************************************** event Query(WebRequest Request, WebResponse Response) { local int i; //Log("URL:"@Request.URI); Response.Subst("BugAddress", "tvbugs@irrational.com.au"); // Match query function. checks URI and calls appropriate input/output function switch (Mid(Request.URI, 1)) { case "": case RootFrame: QueryRootFrame(Request, Response); return; case HeaderPage: QueryHeaderPage(Request, Response); return; case RestartPage: if (!MapIsChanging()) QuerySubmitRestartPage(Request, Response); return; case "tv.css": Response.SendCachedFile(Path$"/"$Mid(Request.URI, 1), "text/css"); return; } for (i=0; i<QueryHandlers.Length; i++) { if (QueryHandlers[i].Query(Request, Response)) return; } ShowMessage(Response, "Error", "Page not found!"); return; } function QueryRootFrame(WebRequest Request, WebResponse Response) { local String GroupPage; if (QueryHandlers.Length > 0) GroupPage = QueryHandlers[0].DefaultPage; GroupPage = Request.GetVariable("Group", GroupPage); Response.Subst("HeaderURI", HeaderPage$"?Group="$GroupPage); Response.Subst("BottomURI", GroupPage); ShowFrame(Response, RootFrame); } function QueryHeaderPage(WebRequest Request, WebResponse Response) { local int i; local string menu, GroupPage, Dis, CurPageTitle; Response.Subst("AdminName", CurAdmin.UserName); if (QueryHandlers.Length > 0) { GroupPage = Request.GetVariable("Group", QueryHandlers[0].DefaultPage); // We build a multi-column table for each QueryHandler menu = ""; CurPageTitle = ""; for (i=0; i<QueryHandlers.Length; i++) { if (QueryHandlers[i].DefaultPage == GroupPage) CurPageTitle = QueryHandlers[i].Title; Dis = ""; if (QueryHandlers[i].NeededPrivs != "" && !CanPerform(QueryHandlers[i].NeededPrivs)) Dis = "d"; Response.Subst("MenuLink", RootFrame$"?Group="$QueryHandlers[i].DefaultPage); Response.Subst("MenuTitle", QueryHandlers[i].Title); menu = menu$WebInclude(HeaderPage$"_item"$Dis); } Response.Subst("Location", CurPageTitle); Response.Subst("HeaderMenu", menu); } // Set URIs ShowPage(Response, HeaderPage); } function QueryRestartPage(WebRequest Request, WebResponse Response) { ServerChangeMap(Request, Response, Level.GetURLMap(), String(Level.Game.Class)); } function QuerySubmitRestartPage(WebRequest Request, WebResponse Response) { ServerChangeMap(Request, Response, Request.GetVariable("MapName"), Request.GetVariable("GameType")); } function ServerChangeMap(WebRequest Request, WebResponse Response, string MapName, string GameType) { local int i; local bool bConflict; local string Conflicts, Str, ShortName; if (Level.NextURL != "") { ShowMessage(Response, "Please Wait", "The server is now restarting. Please allow 10-15 seconds while the server changes levels."); } if (Request.GetVariable("Save", "") != "") { // All we need to do is override settings as required for (i = 0; i<GamePI.Settings.Length; i++) { ShortName = Level.GetItemName(GamePI.Settings[i].SettingName); if (Request.GetVariable(GamePI.Settings[i].SettingName, "") != "") { Level.UpdateURL(ShortName, GamePI.Settings[i].Value, false); } } } else { bConflict = false; Conflicts = ""; // Make sure we have a GamePI with the right GameType selected GameType = SetGamePI(GameType); // Check each parameter and see if it conflicts with the settings on the command line for (i = 0; i<GamePI.Settings.Length; i++) { // Case sensitive ??? if (HasURLOption(GamePI.Settings[i].SettingName, Str) && !(GamePI.Settings[i].Value ~= Str)) { // We have a conflicting setting, prepare a table row for it. Response.Subst("SettingName", GamePI.Settings[i].SettingName); Response.Subst("SettingText", GamePI.Settings[i].DisplayName); Response.Subst("DefVal", GamePI.Settings[i].Value); Response.Subst("URLVal", Str); Response.Subst("MapName", MapName); Response.Subst("GameType", GameType); Conflicts = Conflicts $ WebInclude(RestartPage$"_row"); bConflict = true; } } if (bConflict) { // Conflicts exist .. show the RestartPage Response.Subst("Conflicts", Conflicts); Response.Subst("PostAction", RestartPage); Response.Subst("Section", "Restart Conflicts"); Response.Subst("SubmitValue", "Accept"); ShowPage(Response, RestartPage); return; } } // TODO: Add more checks for Mutators Level.ServerTravel(MapName$"?game="$GameType$"?mutator="$UsedMutators(), false); ShowMessage(Response, "Please Wait", "The server is now restarting. Please allow 10-15 seconds while the server changes levels."); } function MapTitle(WebResponse Response) { local string str, smap; str = Level.Game.GameReplicationInfo.GameName$" in "; if (Level.Title ~= "untitled") { smap = Level.GetURLMap(); if (Right(smap, 4) ~= ".tvm") str = str $ Left(smap, Len(smap) - 4); else str = str $ smap; } else str = str $ Level.Title; Response.Subst("SubTitle", str); } function bool MapIsChanging() { if (Level.NextURL != "") { ShowMessage(Resp, "Please Wait", "The server is now restarting. Please allow 10-15 seconds while the server changes levels."); return true; } return false; } ////////////////////////////////////////////////////////////////////// // // // BEGIN HELPER FUNCTIONS // // function string WebInclude(string file) { return Resp.LoadParsedUHTM(Path$"/"$file$".inc"); } function LoadGameTypes() { local int i; local array<Gameplay.Utility.GameData> gameTypes; Log("gametypes:", 'ServerAdmin'); AGameType = New(None) class'SortedStringArray'; class'Gameplay.Utility'.static.getGameTypeList(gameTypes); for (i=0; i<gameTypes.length; i++) { log(gameTypes[i].name, 'ServerAdmin'); AGameType.Add(gameTypes[i].className, gameTypes[i].name); } } function LoadMutators() { local int i; local array<string> mutators; log("mutators:", 'ServerAdmin'); // ADMIN TODO - load mutators gets wrong list class'Gameplay.Utility'.static.getMutatorList(Level, mutators); AExcMutators = New(None) class'SortedStringArray'; AIncMutators = New(None) class'StringArray'; AllMutators.length = mutators.length; for (i=0; i<mutators.length; i++) { //AIncMutators.Add(mutators[i], mutators[i]); // todo: tag/item AExcMutators.Add(string(i), mutators[i]); // test // fill in all mutators (sorta) AllMutators[i].ClassName = mutators[i]; AllMutators[i].GroupName = "Group"; AllMutators[i].FriendlyName = mutators[i]; AllMutators[i].Description = mutators[i]; // bleh! log(mutators[i], 'ServerAdmin'); } /* local int NumMutatorClasses; local class<Engine.Mutator> MClass; local Engine.Mutator M; local int i, id; AExcMutators = New(None) class'SortedStringArray'; AIncMutators = New(None) class'StringArray'; // Load All mutators class'xUtil'.static.GetMutatorList(AllMutators); if (Level.IsDemoBuild()) { for (i=AllMutators.Length - 1; i>=0; i--) { if (AllMutators[i].ClassName ~= "xGame.MutZoomInstaGib" || AllMutators[i].ClassName ~= "UnrealGame.MutLowGrav") continue; AllMutators.Remove(i,1); } } for (i = 0; i<AllMutators.Length; i++) { MClass = class<Mutator>(DynamicLoadObject(AllMutators[i].ClassName, class'Class')); if (MClass != None) { AExcMutators.Add(string(i), AllMutators[i].ClassName); NumMutatorClasses++; } } // Check Current Mutators for (M = Level.Game.BaseMutator; M != None; M = M.NextMutator) { if (M.bUserAdded) { id = AExcMutators.FindTagId(String(M.Class)); if (id >= 0) { AIncMutators.Add(AExcMutators.GetItem(id), AExcMutators.GetTag(id)); } else log("Unknown Mutator in use: "@String(M.Class)); } } */ } function String UsedMutators() { local int i; local String OutStr; if(AIncMutators.Count() == 0) return ""; OutStr = AIncMutators.GetItem(i); for (i=1; i<AIncMutators.Count(); i++) { OutStr = OutStr$","$AIncMutators.GetItem(i); } return OutStr; } function String PadLeft(String InStr, int Width, String PadStr) { local String OutStr; if (Len(PadStr) == 0) PadStr = " "; for (OutStr=InStr; Len(OutStr) < Width; OutStr=PadStr$OutStr); return Right(OutStr, Width); // in case PadStr is more than one character } function ApplyMapList(StringArray ExcludeMaps, StringArray IncludeMaps, String GameType, String MapListType) { // not required - but we'll log here just to check where it gets called... log("*** ApplyMapList "$GameType$","$MapListType$" ***", 'ServerAdmin'); /* local Engine.MapList List; local int IncludeCount, i, id; log("ApplyMapList"); List = Level.Game.GetMapList(MapListType); if (List != None) { ExcludeMaps = ReloadExcludeMaps(GameType); IncludeMaps.Reset(); IncludeCount = List.Maps.Length; for(i=0; i<IncludeCount; i++) { if (ExcludeMaps.Count() > 0) { id = ExcludeMaps.FindTagId(List.Maps[i]); if (id >= 0) { IncludeMaps.Add(ExcludeMaps.GetItem(i), ExcludeMaps.GetTag(i)); ExcludeMaps.Remove(i); } else Log("*** Unknown map in Map List: "$List.Maps[i]); } else Log("*** Empty exclude list, i="$i); } List.Destroy(); } else Log("Invalid Map List Type : '"$MapListType$"'"); */ } function StringArray ReloadExcludeMaps(String GameType) { // not required return none; /* local class<GameInfo> GameClass; local string NextMap, Tag; local StringArray AMaps; local array<string> Maps; local int i; log("ReloadExcludeMaps"); GameClass = class<GameInfo>(DynamicLoadObject(GameType, class'Class')); AMaps = New(None) class'SortedStringArray'; if(GameClass.Default.MapPrefix != "") { GameClass.static.LoadMapList(GameClass.Default.MapPrefix, Maps); for (i = 0; i<Maps.Length; i++) { NextMap = Maps[i]; if(!(Left(NextMap, Len(NextMap) - 4) ~= (GameClass.Default.MapPrefix$"-TUT"))) { if(Right(NextMap, 4) ~= ".ut2") Tag = Left(NextMap, Len(NextMap) - 4); else Tag = NextMap; // Add the map. AMaps.Add(NextMap, Tag); } } } return AMaps; */ } function StringArray ReloadIncludeMaps(StringArray ExMaps, String GameClass) { // get maps supporting game type local int i; local StringArray maps; local array<string> array; local string gameType; gameType = class'Gameplay.Utility'.static.getGameTypeFromGameClassName(GameClass); log("query maps supporting: "$gameType, 'ServerAdmin'); maps = New(None) class'StringArray'; class'Gameplay.Utility'.static.smartRefresh(); class'Gameplay.Utility'.static.getLevelListForGameType(GameType, array); for (i=0; i<array.length; i++) { log("map: "$array[i], 'ServerAdmin'); maps.Add(array[i], array[i]); } return maps; } function UpdateDefaultMaps(String GameType, StringArray Maps) { // todo: get list of maps for game type // is this required? - log when its called so i can check log("*** UpdateDefaultMaps "$GameType$"***", 'ServerAdmin'); /* local class<GameInfo> GameClass; local Engine.MapList List; local int i; log("UpdateDefaultMaps"); GameClass = class<GameInfo>(DynamicLoadObject(GameType, class'Class')); if (GameClass != None && GameClass.Default.MapListType != "") { List = Level.Game.GetMapList(GameClass.Default.MapListType); if (List != None) { List.Maps.Length = 0; for (i=0; i<Maps.Count(); i++) List.Maps[i] = Maps.GetItem(i); List.MapNum = 0; List.SaveConfig(); List.Destroy(); } } */ } function String GenerateGameTypeOptions(String CurrentGameType) { local int i; local string SelectedStr, OptionStr; if (CurrentGameType=="") SelectedStr = " selected"; else SelectedStr = ""; OptionStr = "<option value=\"\""$SelectedStr$">(none)</option>"; for (i=0; i<AGameType.Count(); i++) { if (CurrentGameType ~= AGameType.GetItem(i)) SelectedStr = " selected"; else SelectedStr = ""; OptionStr = OptionStr$"<option value=\""$AGameType.GetItem(i)$"\""$SelectedStr$">"$AGameType.GetTag(i)$"</option>"; } return OptionStr; } function String GenerateMapListOptions(String GameType, String MapListType) { local class<GameInfo> GameClass; local String DefaultBaseClass, NextDefault, NextDesc, SelectedStr, OptionStr; local int NumDefaultClasses; GameClass = class<GameInfo>(DynamicLoadObject(GameType, class'Class')); if(GameClass == None) return ""; DefaultBaseClass = GameClass.Default.MapListType; if(DefaultBaseClass == "") return ""; NextDefault = "Custom"; NextDesc = "Custom"; if(DynamicLoadObject(DefaultBaseClass, class'Class') == None) return ""; while( (NextDefault != "") && (NumDefaultClasses < 50) ) { if (MapListType ~= NextDefault) SelectedStr = " selected"; else SelectedStr = ""; OptionStr = OptionStr$"<option value=\""$NextDefault$"\""$SelectedStr$">"$NextDesc$"</option>"; Level.GetNextIntDesc(DefaultBaseClass, NumDefaultClasses++, NextDefault, NextDesc); } return OptionStr; } function String GenerateMapListSelect(StringArray MapList, StringArray MovedMaps) { local int i; local String ResponseStr, SelectedStr; if (MapList.Count() == 0) return "<option value=\"\">*** None ***</option>"; for (i = 0; i<MapList.Count(); i++) { SelectedStr = ""; if (MovedMaps != None && MovedMaps.FindTagId(MapList.GetTag(i)) >= 0) SelectedStr = " selected"; ResponseStr = ResponseStr$"<option value=\""$MapList.GetTag(i)$"\""$SelectedStr$">"$MapList.GetTag(i)$"</option>"; } return ResponseStr; } function string SetGamePI(string GameType) { local class<Engine.GameInfo> GameClass; GameClass = class<Engine.GameInfo>(DynamicLoadObject(GameType, class'Class')); if (GameClass == None) GameClass = Level.Game.Class; if (GamePI == None) { GamePI = new(None) class'PlayInfo'; GameClass.static.FillPlayInfo(GamePI); Level.Game.AccessControl.FillPlayInfo(GamePI); } else if (GamePI.InfoClasses.Length>0 && GameClass != GamePI.InfoClasses[0]) { GamePI.Clear(); GameClass.static.FillPlayInfo(GamePI); Level.Game.AccessControl.FillPlayInfo(GamePI); } return string(GameClass); } function bool HasURLOption(string ParamName, out string Value) { local string Param; local int i; Param = ParamName; while (true) { i = Instr(Param, "."); if (i < 0) break; Param = Mid(Param, i+1); } Value = Level.GetUrlOption(Param); return Value != ""; } // Replaces any occurences of '<' or '>' with '<' and '>' function string HtmlEncode(string src) { local string Encoded; local int p; // First, "<" Encoded = ""; for (p=Instr(src, "<"); p != -1; p=Instr(src, "<")) { Encoded = Left(src, p) $ "<"; src = Mid(src, p + 1); } src = Encoded $ src; // Then, ">" Encoded = ""; for (p=Instr(src, ">"); p != -1; p=Instr(src, ">")) { Encoded = Left(src, p) $ ">"; src = Mid(src, p + 1); } src = Encoded $ src; return src; } /////////////////////////////////////////////////////////////////// // Page Display functions // // function bool ShowFrame(WebResponse Response, string Page) { Response.IncludeUHTM(Path$"/"$Page$htm); return true; } function bool ShowPage(WebResponse Response, string Page) { Response.IncludeUHTM(Path$"/"$Page$htm); Response.ClearSubst(); return true; } function StatusError(WebResponse Response, string Message) { if (Left(Message,1) == "@") Message = Mid(Message,1); Response.Subst("Status", "<font color='Yellow'>"$Message$"</font><br>"); } function StatusOk(WebResponse Response, string Message) { Response.Subst("Status", "<font color='#33cc66'>"$Message$"</font>"); } function bool StatusReport(WebResponse Response, string ErrorMessage, string SuccessMessage) { if (ErrorMessage == "") StatusOk(Response, SuccessMessage); else StatusError(Response, ErrorMessage); return ErrorMessage==""; } function ShowMessage(WebResponse Response, string Title, string Message) { Response.Subst("Section", Title); Response.Subst("Message", Message); Response.IncludeUHTM(Path$"/"$MessagePage$htm); } function AccessDenied(WebResponse Response) { ShowMessage(Response, "Access Denied", "Your privileges disallow you from viewing this page"); } function string HyperLink(string url, string text, bool bEnabled, optional string target) { local string hlink; if (bEnabled) { hlink = "<a href='"$url$"'"; if (target != "") hlink = hlink@"target='"$target$"'"; hlink = hlink$">"$text$"</a>"; return hlink; } return text; } // Admin & Groups Management functions function string StringIf(bool bCond, string iftrue, string iffalse) { if (bCond) return iftrue; return iffalse; } function string Checkbox(string tag, bool bChecked) { local string str; str = "<input type='Checkbox' name='"$tag$"' value='1'"; if (bChecked) str = str@"checked"; return str$">"; } function string NextPriv(out string privs) { local int pos; local string priv; pos = Instr(privs, "|"); if (pos == -1) { priv = privs; privs = ""; } else { priv = Left(privs,pos); privs = Mid(privs,pos+1); } return priv; } function bool CanPerform(string privs) { local string priv; priv = NextPriv(privs); while (priv != "") { if (Level.Game.AccessControl.AllowPriv(priv) && CurAdmin.HasPrivilege(priv)) return true; priv = NextPriv(privs); } return false; } defaultproperties { SpectatorType=Class'TribesServerAdminSpectator' QueryHandlerClasses(0)=class'TribesWebQueryCurrent' QueryHandlerClasses(1)=class'TribesWebQueryDefaults' QueryHandlerClasses(2)=class'TribesWebQueryAdmins' AdminRealm="Tribes Remote Admin Server" RootFrame="rootframe" HeaderPage="mainmenu" MessagePage="message" RestartPage="server_restart" DefaultBG="#aaaaaa" HighlightedBG="#3a7c8c" htm=".htm" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |