forked from Talishar/Talishar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainMenu.php
More file actions
211 lines (188 loc) · 8.19 KB
/
MainMenu.php
File metadata and controls
211 lines (188 loc) · 8.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?php
include_once 'MenuBar.php';
include "HostFiles/Redirector.php";
include_once "Libraries/PlayerSettings.php";
include_once 'Assets/patreon-php-master/src/PatreonDictionary.php';
include_once "APIKeys/APIKeys.php";
if (isset($_SESSION["useruid"])) {
$useruid = $_SESSION["useruid"];
$banfileHandler = fopen("./HostFiles/bannedPlayers.txt", "r");
while (!feof($banfileHandler)) {
$bannedPlayer = trim(fgets($banfileHandler), "\r\n");
if ($useruid == $bannedPlayer) {
fclose($banfileHandler);
exit;
}
}
fclose($banfileHandler);
}
if (!empty($_SESSION['error'])) {
$error = $_SESSION['error'];
unset($_SESSION['error']);
echo "<script>alert('" . $error . "')</script>";
}
$language = TryGet("language", 1);
$settingArray = [];
$defaultFormat = 0;
$defaultVisibility = (isset($_SESSION["useruid"]) ? 1 : 0);
if (isset($_SESSION["userid"])) {
$savedSettings = LoadSavedSettings($_SESSION["userid"]);
for ($i = 0; $i < count($savedSettings); $i += 2) {
$settingArray[$savedSettings[intval($i)]] = $savedSettings[intval($i) + 1];
}
if (isset($_GET['language'])) {
ChangeSetting("", $SET_Language, $language, $_SESSION["userid"]);
} else if (isset($settingArray[$SET_Language])) $language = $settingArray[$SET_Language];
if (isset($settingArray[$SET_Format])) $defaultFormat = $settingArray[$SET_Format];
if (isset($settingArray[$SET_GameVisibility])) $defaultVisibility = $settingArray[$SET_GameVisibility];
}
$_SESSION['language'] = $language;
if (isset($_SESSION["isPatron"])) $isPatron = $_SESSION["isPatron"];
else $isPatron = false;
$createGameText = ($language == 1 ? "Create Game" : "ゲームを作る");
$languageText = ($language == 1 ? "Language" : "言語");
$createNewGameText = ($language == 1 ? "Create New Game" : "新しいゲームを作成する");
$starterDecksText = ($language == 1 ? "Starter Decks" : "おすすめデッキ");
$canSeeQueue = isset($_SESSION["useruid"]);
?>
<style>
</style>
<div style="text-align: center; padding-top: 45px;">
<div style="display: inline-block; width:400px; height:180px; background-size: contain; background-image: url('Images/TalisharLogo.webp');"></div>
</div>
<div class="ContentWindow" style='width:27%; left:20px; top:60px; bottom:30px; overflow-y:auto;'>
<?php
try {
include "ServerChecker.php";
} catch (\Exception $e) {
}
?>
</div>
<?php
if (IsMobile()) echo ("<div class='ContentWindow' style='top:240px; left:32%; width:60%; bottom: 0px; overflow-y:visible'>");
else echo ("<div class='ContentWindow' style='top:225px; left:32%; width:36%; bottom: 30px; overflow-y:auto'>");
?>
<h5>Talishar is an open-source, fan-made platform not associated with LSS. It may not be a completely accurate representation of the Rules as Written. If you have questions about interactions or rulings, please <a style='text-decoration: underline;' target='_blank' href='https://discord.gg/VFhYB9T7s8'>contact the judge community</a> for clarification.</h5>
<h1><?php echo ($createNewGameText); ?></h1>
<?php
echo ("<form style='width:100%;display:inline-block;' action='" . $redirectPath . "/CreateGame.php'>");
$favoriteDecks = [];
if (isset($_SESSION["userid"])) {
$favoriteDecks = LoadFavoriteDecks($_SESSION["userid"]);
if (count($favoriteDecks) > 0) {
$selIndex = -1;
if (isset($settingArray[$SET_FavoriteDeckIndex])) $selIndex = $settingArray[$SET_FavoriteDeckIndex];
echo ("<div class='SelectDeckInput'>Favorite Decks: ");
echo ("<select style='height:34px; width:60%;' name='favoriteDecks' id='favoriteDecks'>");
for ($i = 0; $i < count($favoriteDecks); $i += 4) {
echo ("<option value='" . $i . "<fav>" . $favoriteDecks[$i] . "'" . ($i == $selIndex ? " selected " : "") . ">" . $favoriteDecks[$i + 1] . "</option>");
}
echo ("</select></div>");
}
}
if (count($favoriteDecks) == 0) {
echo ("<div><label class='SelectDeckInput'>" . $starterDecksText . ": </label>");
echo ("<select name='decksToTry' id='decksToTry'>");
echo ("<option value='1'>Ira Welcome Deck</option>");
echo ("</select></div>");
}
echo ("<br>");
?>
<label for="fabdb" class='SelectDeckInput'>Deck Link:</label>
<input type="text" id="fabdb" name="fabdb">
<?php
if (isset($_SESSION["userid"])) {
echo ("<span style='display:inline;'>");
echo ("<labelfor='favoriteDeck'><input class='inputFavoriteDeck' type='checkbox' id='favoriteDeck' name='favoriteDeck' />");
echo ("Save deck to ❤️ favorites</label>");
echo ("</span>");
}
echo ("<br>");
?>
<br>
<label for="gameDescription" class='SelectDeckInput'>Game Name:</label>
<input type="text" id="gameDescription" name="gameDescription" placeholder="Game #"><br><br>
<?php
echo ("<label for='format' class='SelectDeckInput'>Format: </label>");
echo ("<select name='format' id='format'>");
if ($canSeeQueue) {
echo ("<option value='blitz' " . ($defaultFormat == 2 ? " selected" : "") . ">Blitz</option>");
echo ("<option value='compblitz' " . ($defaultFormat == 3 ? " selected" : "") . ">Competitive Blitz</option>");
echo ("<option value='cc' " . ($defaultFormat == 0 ? " selected" : "") . ">Classic Constructed</option>");
echo ("<option value='compcc'" . ($defaultFormat == 1 ? " selected" : "") . ">Competitive CC</option>");
echo ("<option value='commoner'" . ($defaultFormat == 5 ? " selected" : "") . ">Commoner</option>");
echo ("<option value='clash'" . ($defaultFormat == 6 ? " selected" : "") . ">Clash</option>");
}
echo ("<option value='livinglegendscc'" . ($defaultFormat == 4 ? " selected" : "") . ">Open Format</option>");
echo ("</select>");
?>
<BR>
<BR>
<?php
if ($canSeeQueue) {
echo '<label for="public"><input class="SelectDeckInput" type="radio" id="public" name="visibility" value="public" ' . ($defaultVisibility == 1 ? 'checked="checked"' : "") . '>';
echo (' Public</label>');
}
?>
<label for="private">
<input type="radio" class='SelectDeckInput' id="private" name="visibility" value="private" <?php if ($defaultVisibility == 0) echo 'checked="checked"'; ?> />
Private</label>
<label for="deckTestMode">
<input class='SelectDeckInput' type="checkbox" id="deckTestMode" name="deckTestMode" value="deckTestMode">
Single Player</label>
<div style=' text-align:center;'>
<input type="submit" style="font-size:28px;" value="<?php echo ($createGameText); ?>">
</div>
<BR>
</form>
</div>
</div>
<div class="ContentWindow" style='right:20px; top:60px; bottom:30px; width:27%; <?php if (IsMobile()) echo ("display:none; "); ?>'>
<h1>News</h1>
<div style="position: relative;">
<div style='vertical-align:middle; text-align:center;'>
<div style="vertical-align:middle; position: relative;">
</div>
<BR>
Test Outsiders sealed and draft FREE through our partner site, <a href='https://www.draftfab.com' target='_blank'>DRAFTFAB</a>!
<BR>
<a href='https://www.draftfab.com' target='_blank'><img src='./Images/logos/draftfab.png'></img></a>
<br><BR>
<div class='LanguageSelector'><?php echo ($languageText); ?>:
<select id='languageSelect' onchange='changeLanguage()' name='decksToTry' id='decksToTry'>
<option value='1' <?php if ($language == 1) echo (" selected"); ?>>English</option>
<option value='2' <?php if ($language == 2) echo (" selected"); ?>>Japanese (日本語)</option>
</select>
</div>
</div>
</div>
<?php
/*
if (!$isPatron) {
echo '<div>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8442966023291783"
crossorigin="anonymous"></script>
<!-- MainMenu -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-8442966023291783"
data-ad-slot="5060625180"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>';
}
*/
?>
<BR>
</div>
<script>
function changeLanguage() {
window.location.search = '?language=' + document.getElementById('languageSelect').value;
}
</script>
<?php
include_once 'Disclaimer.php';
?>