forked from snobalfyte/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselectlang.php
322 lines (277 loc) · 8.45 KB
/
selectlang.php
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<?php
/*
Copyright 2020 whatever127
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
$updateId = isset($_GET['id']) ? $_GET['id'] : 0;
require_once 'api/listlangs.php';
require_once 'api/updateinfo.php';
require_once 'shared/style.php';
if(!$updateId) {
fancyError('UNSPECIFIED_UPDATE', 'downloads');
die();
}
if(!checkUpdateIdValidity($updateId)) {
fancyError('INCORRECT_ID', 'downloads');
die();
}
$updateInfo = uupUpdateInfo($updateId);
$updateInfo = isset($updateInfo['info']) ? $updateInfo['info'] : array();
if(!isset($updateInfo['title'])) {
$updateTitle = 'Unknown update: '.$updateId;
} else {
$updateTitle = $updateInfo['title'];
}
if(!isset($updateInfo['arch'])) {
$updateArch = '';
} else {
$updateArch = $updateInfo['arch'];
}
if(!isset($updateInfo['build'])) {
$build = $s['unknown'];
} else {
$build = $updateInfo['build'];
}
if(!isset($updateInfo['ring'])) {
$ring = null;
} else {
$ring = $updateInfo['ring'];
}
if(!isset($updateInfo['flight'])) {
$flight = null;
} else {
$flight = $updateInfo['flight'];
}
if(!isset($updateInfo['created'])) {
$created = null;
} else {
$created = $updateInfo['created'];
}
$updateTitle = $updateTitle.' '.$updateArch;
$langs = uupListLangs($updateId);
$langsTemp = array();
foreach($langs['langList'] as $lang) {
if(isset($s["lang_$lang"])) {
$langsTemp[$lang] = $s["lang_$lang"];
} else {
$langsTemp[$lang] = $langs['fancyLangNames'][$lang];
}
}
$langs = $langsTemp;
unset($langsTemp);
locasort($langs, $s['code']);
if(isset($updateInfo['containsCU']) && $updateInfo['containsCU'] = 1) {
$containsCU = 1;
} else {
$containsCU = 0;
}
if(in_array(strtolower($s['code']), array_keys($langs))) {
$defaultLang = strtolower($s['code']);
} else {
$defaultLang = 'en-us';
}
//Set fancy name for channel and flight of build
if($ring == 'WIF' && $flight == 'Skip') {
$fancyChannelName = 'Skip Ahead';
} elseif($ring == 'WIF' && $flight == 'Active') {
$fancyChannelName = 'Dev Channel';
} elseif($ring == 'WIS' && $flight == 'Active') {
$fancyChannelName = 'Beta Channel';
} elseif($ring == 'RP' && $flight == 'Current') {
$fancyChannelName = 'Release Preview Channel';
} elseif($ring == 'RETAIL') {
$fancyChannelName = 'Retail';
} else {
if($ring && $flight) {
$fancyChannelName = "$ring, $flight";
} elseif($ring) {
$fancyChannelName = "$ring";
} else {
$fancyChannelName = $s['unknown'];
}
}
$findFilesUrl = "./findfiles.php?id=".htmlentities($updateId);
styleUpper('downloads', sprintf($s['selectLangFor'], $updateTitle));
?>
<h3 class="ui centered header">
<div class="content">
<i class="fitted cubes icon"></i>
<?php echo htmlentities($updateTitle); ?>
</div>
</h3>
<?php
if(!file_exists('packs/'.$updateId.'.json.gz')) {
styleNoPackWarn();
}
if($updateArch == 'arm64') {
styleCluelessUserArm64Warn();
}
?>
<div class="ui two columns mobile stackable centered grid">
<div class="column">
<h3 class="ui header">
<i class="globe icon"></i>
<div class="content">
<?php echo $s['chooseLang']; ?>
<div class="sub header"><?php echo $s['chooseLangDesc']; ?></div>
</div>
</h3>
<?php
if(count($langs) > 0) {
echo <<<EOD
<form class="ui form" action="./selectedition.php" method="get" id="langForm">
<input type="hidden" name="id" value="$updateId">
<div class="field">
<label>{$s['lang']}</label>
<select class="ui search dropdown" name="pack">
EOD;
foreach($langs as $key => $val) {
if($key == $defaultLang) {
echo '<option value="'.$key.'" selected>'.$val."</option>\n";
} else {
echo '<option value="'.$key.'">'.$val."</option>\n";
}
}
echo <<<EOD
</select>
</div>
<button class="ui fluid right labeled icon blue button" id="submitForm" type="submit">
<i class="right arrow icon"></i>
{$s['next']}
</button>
</form>
<div class="ui info message">
<i class="info icon"></i>
{$s['selectLangInfoText1']}
</div>
EOD;
} else {
echo <<<EOD
<div class="ui center aligned one column padded relaxed grid">
<div class="row">
<div class="column">
<i class="huge info icon"></i>
</div>
</div>
<div class="row">
<div class="column">
<p>{$s['noLangsAvailable']}</p>
</div>
</div>
</div>
EOD;
}
?>
</div>
<div class="column">
<h3 class="ui header">
<i class="open folder icon"></i>
<div class="content">
<?php echo $s['browseFiles']; ?>
<div class="sub header"><?php echo $s['browseFilesDesc']; ?></div>
</div>
</h3>
<form class="ui form" action="./findfiles.php" method="get">
<div class="field">
<label><?php echo $s['searchFiles']; ?></label>
<div class="ui action input">
<input type="hidden" name="id" value="<?php echo htmlentities($updateId); ?>">
<input type="text" name="q" placeholder="<?php echo $s['searchForFiles']; ?>">
<button class="ui blue icon button" type="submit"><i class="search icon"></i></button>
</div>
</div>
</form>
<a class="ui fluid right labeled icon button"
href="<?php echo $findFilesUrl; ?>" style="margin-top:1rem;">
<i class="open folder icon"></i>
<?php echo $s['allFiles']; ?>
</a>
<div class="ui positive message">
<i class="paper plane icon"></i>
<?php
printf(
$s['toSearchForCUUseQuery'],
"<a href=\"$findFilesUrl&q=Windows10 KB\">Windows10 KB</a>"
);
?>
</div>
</div>
</div>
<div class="ui fluid tiny three steps">
<div class="active step">
<i class="world icon"></i>
<div class="content">
<div class="title"><?php echo $s['chooseLang']; ?></div>
<div class="description"><?php echo $s['chooseLangDesc']; ?></div>
</div>
</div>
<div class="step">
<i class="archive icon"></i>
<div class="content">
<div class="title"><?php echo $s['chooseEdition']; ?></div>
<div class="description"><?php echo $s['chooseEditionDesc']; ?></div>
</div>
</div>
<div class="step">
<i class="briefcase icon"></i>
<div class="content">
<div class="title"><?php echo $s['summary']; ?></div>
<div class="description"><?php echo $s['summaryDesc']; ?></div>
</div>
</div>
</div>
<h4 class="ui horizontal divider">
<?php echo $s['information']; ?>
</h4>
<div class="ui three columns mobile stackable centered grid" style="margin-top: 1em;">
<div class="column">
<h4 class="ui center aligned tiny icon header">
<i class="archive icon"></i>
<div class="content">
<?php echo $s['build']; ?>
<div class="sub header"><?php echo $build; ?></div>
</div>
</h4>
</div>
<div class="column">
<h4 class="ui center aligned tiny icon header">
<i class="cogs icon"></i>
<div class="content">
<?php echo $s['ring']; ?>
<div class="sub header"><?php echo $fancyChannelName; ?></div>
</div>
</h4>
</div>
<div class="column">
<h4 class="ui center aligned tiny icon header">
<i class="calendar icon"></i>
<div class="content">
<?php echo $s['dateAdded']; ?>
<div class="sub header">
<?php
if($created == null) {
echo $s['unknown'];
} else {
echo date("Y-m-d H:i:s T", $created);
}
?>
</div>
</div>
</h4>
</div>
</div>
<script>
$('select.dropdown').dropdown();
$('.ui.radio.checkbox').checkbox();
</script>
<?php
styleLower();
?>