11<?php
22/*
3- HLstatsX Community Edition - Real-time player and clan rankings and statistics
4- Copyleft (L) 2008-20XX Nicholas Hastings (nshastings@gmail.com)
5- http://www.hlxcommunity.com
6-
7- HLstatsX Community Edition is a continuation of
8- ELstatsNEO - Real-time player and clan rankings and statistics
9- Copyleft (L) 2008-20XX Malte Bayer (steam@neo-soft.org)
10- http://ovrsized.neo-soft.org/
11-
12- ELstatsNEO is an very improved & enhanced - so called Ultra-Humongus Edition of HLstatsX
13- HLstatsX - Real-time player and clan rankings and statistics for Half-Life 2
14- http://www.hlstatsx.com/
15- Copyright (C) 2005-2007 Tobias Oetzel (Tobi@hlstatsx.com)
16-
17- HLstatsX is an enhanced version of HLstats made by Simon Garner
18- HLstats - Real-time player and clan rankings and statistics for Half-Life
19- http://sourceforge.net/projects/hlstats/
20- Copyright (C) 2001 Simon Garner
21-
22- This program is free software; you can redistribute it and/or
23- modify it under the terms of the GNU General Public License
24- as published by the Free Software Foundation; either version 2
25- of the License, or (at your option) any later version.
26-
27- This program is distributed in the hope that it will be useful,
28- but WITHOUT ANY WARRANTY; without even the implied warranty of
29- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30- GNU General Public License for more details.
31-
32- You should have received a copy of the GNU General Public License
33- along with this program; if not, write to the Free Software
34- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35-
36- For support and installation notes visit http://www.hlxcommunity.com
3+ HLstatsX Community Edition - Real-time player and clan rankings and statistics
4+ Copyleft (L) 2008-20XX Nicholas Hastings (nshastings@gmail.com)
5+ http://www.hlxcommunity.com
6+
7+ HLstatsX Community Edition is a continuation of
8+ ELstatsNEO - Real-time player and clan rankings and statistics
9+ Copyleft (L) 2008-20XX Malte Bayer (steam@neo-soft.org)
10+ http://ovrsized.neo-soft.org/
11+
12+ ELstatsNEO is an very improved & enhanced - so called Ultra-Humongus Edition of HLstatsX
13+ HLstatsX - Real-time player and clan rankings and statistics for Half-Life 2
14+ http://www.hlstatsx.com/
15+ Copyright (C) 2005-2007 Tobias Oetzel (Tobi@hlstatsx.com)
16+
17+ HLstatsX is an enhanced version of HLstats made by Simon Garner
18+ HLstats - Real-time player and clan rankings and statistics for Half-Life
19+ http://sourceforge.net/projects/hlstats/
20+ Copyright (C) 2001 Simon Garner
21+
22+ This program is free software; you can redistribute it and/or
23+ modify it under the terms of the GNU General Public License
24+ as published by the Free Software Foundation; either version 2
25+ of the License, or (at your option) any later version.
26+
27+ This program is distributed in the hope that it will be useful,
28+ but WITHOUT ANY WARRANTY; without even the implied warranty of
29+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30+ GNU General Public License for more details.
31+
32+ You should have received a copy of the GNU General Public License
33+ along with this program; if not, write to the Free Software
34+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35+
36+ For support and installation notes visit http://www.hlxcommunity.com
3737*/
3838
39+ // Awards Info Page
3940 if (!defined ('IN_HLSTATS ' )) {
4041 die ('Do not access this file directly. ' );
4142 }
4243
43- // Awards Info Page
44-
45- $ db ->query ("SELECT name FROM hlstats_Games WHERE code=' $ game' " );
46- if ($ db ->num_rows () < 1 ) error ("No such game ' $ game'. " );
47-
48- list ($ gamename ) = $ db ->fetch_row ();
49- $ db ->free_result ();
50-
51- $ type = valid_request ($ _GET ['type ' ] ?? '' );
52- $ tab = valid_request ($ _GET ['tab ' ] ?? '' );
53-
54- if ($ type == 'ajax ' )
55- {
56- $ tabs = explode ('| ' , preg_replace ('[^a-z] ' , '' , $ tab ));
57-
58- foreach ( $ tabs as $ tab )
59- {
60- if ( file_exists (PAGE_PATH . '/awards_ ' . $ tab . '.php ' ) )
61- {
62- @include (PAGE_PATH . '/awards_ ' . $ tab . '.php ' );
63- }
64- }
65- exit ;
66- }
67-
68- pageHeader (
69- array ($ gamename , 'Awards Info ' ),
70- array ($ gamename =>"%s?game= $ game " , 'Awards Info ' =>'' )
71- );
72- ?>
73-
74- <?php if ($ g_options ['playerinfo_tabs ' ]=='1 ' ) { ?>
75-
76- <div id="main">
77- <ul class="subsection_tabs" id="tabs_submenu">
78- <li><a href="#" id="tab_daily">Daily Awards</a></li>
79- <li><a href="#" id="tab_global">Global Awards</a></li>
80- <li><a href="#" id="tab_ranks">Ranks</a></li>
81- <li><a href="#" id="tab_ribbons">Ribbons</a></li>
82- </ul>
83- <br />
84- <div id="main_content"></div>
85- <?php
86- if ($ tab )
87- {
88- $ defaulttab = $ tab ;
89- }
90- else
91- {
92- $ defaulttab = 'daily ' ;
93- }
94- echo "<script type= \"text/javascript \">
95- new Tabs($('main_content'), $$('#main ul.subsection_tabs a'), {
96- 'mode': 'awards',
97- 'game': ' $ game',
98- 'loadingImage': ' " .IMAGE_PATH ."/ajax.gif',
99- 'defaultTab': ' $ defaulttab'
100- }); "
101- ?>
102- </script>
103-
104- </div>
105-
106-
107- <?php } else {
108-
109- echo "\n<div id= \"daily \"> \n" ;
110- include PAGE_PATH .'/awards_daily.php ' ;
111- echo "\n</div> \n" ;
112-
113- echo "\n<div id= \"global \"> \n" ;
114- include PAGE_PATH .'/awards_global.php ' ;
115- echo "\n</div> \n" ;
116-
117- echo "\n<div id= \"ranks \"> \n" ;
118- include PAGE_PATH .'/awards_ranks.php ' ;
119- echo "\n</div> \n" ;
120-
121- echo "\n<div id= \"ribbons \"> \n" ;
122- include PAGE_PATH .'/awards_ribbons.php ' ;
123- echo "\n</div> \n" ;
124-
125- }
126- ?>
44+ $ container = require __DIR__ . '/../bootstrap.php ' ;
45+ $ gameRepo = $ container ->get (\Repository \GameRepository::class);
46+ $ optionService = $ container ->get (\Service \OptionService::class);
47+
48+ $ game = filter_input (INPUT_GET , 'game ' , FILTER_UNSAFE_RAW ) ?? '' ;
49+
50+ $ retError = "" ;
51+ $ allowedGames = $ gameRepo ->getGameCodes ();
52+ if (!checkValidGame ($ game , $ allowedGames , $ retError )) {
53+ error ("{$ retError }" );
54+ }
55+
56+ $ gameName = $ gameRepo ->getGameByCode ($ game , 'name ' );
57+
58+ $ type = filter_input (INPUT_GET , 'type ' , FILTER_UNSAFE_RAW ) ?? '' ;
59+ $ tab = filter_input (INPUT_GET , 'tab ' , FILTER_UNSAFE_RAW ) ?? '' ;
60+
61+ if ($ type == 'ajax ' ) {
62+ $ tabs = explode ('| ' , preg_replace ('/[^a-z]/ ' , '' , $ tab ));
63+
64+ foreach ($ tabs as $ tab ) {
65+ $ awardPath = PAGE_PATH . '/awards_ ' . $ tab . '.php ' ;
66+
67+ if (file_exists ($ awardPath )) {
68+ @include ($ awardPath );
69+ }
70+ }
71+
72+ exit ;
73+ }
74+
75+ pageHeader (
76+ array ($ gameName , 'Awards Info ' ),
77+ array ($ gameName => "%s?game= $ game " , 'Awards Info ' => '' )
78+ );
79+
80+ $ defaultTab = 'daily ' ;
81+ if ($ tab ) {
82+ $ defaultTab = $ tab ;
83+ }
84+
85+ $ options = $ optionService ->getAllOptions ();
86+ ?>
87+
88+ <?php if ($ options ['playerinfo_tabs ' ] == '1 ' ) : ?>
89+ <div id="main">
90+ <ul class="subsection_tabs" id="tabs_submenu">
91+ <li>
92+ <a href="#" id="tab_daily">Daily Awards</a>
93+ </li>
94+ <li>
95+ <a href="#" id="tab_global">Global Awards</a>
96+ </li>
97+ <li>
98+ <a href="#" id="tab_ranks">Ranks</a>
99+ </li>
100+ <li>
101+ <a href="#" id="tab_ribbons">Ribbons</a>
102+ </li>
103+ </ul>
104+ <br>
105+
106+ <div id="main_content"></div>
107+
108+ <script type="text/javascript">
109+ new Tabs($('main_content'), $$('#main ul.subsection_tabs a'), {
110+ 'mode': 'awards',
111+ 'game': '<?= eHtml ($ game );?> ',
112+ 'loadingImage': '<?= IMAGE_PATH ;?> /ajax.gif',
113+ 'defaultTab': '<?= eHtml ($ defaultTab );?> '
114+ });
115+ </script>
116+ </div>
117+ <?php else : ?>
118+ <div id="daily">
119+ <?php include PAGE_PATH . '/awards_daily.php ' ; ?>
120+ </div>
121+
122+ <div id="global">
123+ <?php include PAGE_PATH . '/awards_global.php ' ; ?>
124+ </div>
125+
126+ <div id="ranks">
127+ <?php include PAGE_PATH . '/awards_ranks.php ' ; ?>
128+ </div>
129+
130+ <div id="ribbons">
131+ <?php include PAGE_PATH . '/awards_ribbons.php ' ; ?>
132+ </div>
133+ <?php endif ; ?>
0 commit comments