-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathloading.php
More file actions
299 lines (266 loc) · 9.86 KB
/
loading.php
File metadata and controls
299 lines (266 loc) · 9.86 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
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
<?php include("components/head.php") ?>
<?php
function getRandomScreenshot($ids){
$appid=4000;
$profiles=array_filter(array_map("trim",explode(";",$ids)));
$cacheFile=__DIR__."/cache/screens.json";
$cacheTime=14400; // cache in sec
if (file_exists($cacheFile)&&(time()-filemtime($cacheFile)<$cacheTime)){
$screens=json_decode(file_get_contents($cacheFile),true);
} else {
$profile=$profiles[array_rand($profiles)];
$url="https://steamcommunity.com/profiles/$profile/screenshots/?appid=$appid&sort=newestfirst&browsefilter=myfiles&view=grid";
$html=@file_get_contents($url);
$maxPage=1;
if ($html){
if (preg_match_all('/<a class="pagingPageLink" href="[^"]*p=(\d+)/i',$html,$matches)){
$numbers=array_map("intval",$matches[1]);
if (!empty($numbers)){
$maxPage=max($numbers);
}
}
}
$randomPage=rand(1,max(1,$maxPage));
$url="https://steamcommunity.com/profiles/$profile/screenshots/?appid=$appid&sort=newestfirst&browsefilter=myfiles&view=grid&p=$randomPage";
$html=@file_get_contents($url);
$screens=[];
if ($html){
preg_match_all('/filedetails\/\?id=(\d+)/',$html,$matches);
$ids=array_unique($matches[1]);
if (!empty($ids)) {
$postdata=http_build_query([
"itemcount"=>count($ids),
]);
foreach ($ids as $i=>$id){
$postdata.="&publishedfileids[".$i."]=".urlencode($id);
}
$opts=[
"http"=>[
"method"=>"POST",
"header"=>"Content-Type: application/x-www-form-urlencoded\r\n",
"content"=>$postdata
]
];
$context=stream_context_create($opts);
$result=file_get_contents("https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/",false,$context);
if ($result){
$json=json_decode($result,true);
if (isset($json["response"]["publishedfiledetails"])) {
foreach ($json["response"]["publishedfiledetails"] as $detail){
if (!empty($detail["file_url"])) {
$screens[]=$detail["file_url"];
}
}
}
}
}
}
file_put_contents($cacheFile,json_encode($screens));
}
if (empty($screens)){
return "https://i.imgur.com/ppIOe5T.gif";
}
return $screens[array_rand($screens)];
}
$stbg=getSetting("loadscr_img",false);
$isVideo=false;
if ($stbg) {
$ext=strtolower(pathinfo($stbg,PATHINFO_EXTENSION));
if (in_array($ext,["webm","mp4","ogg"])) {
$isVideo=true;
}
}
$bg=(!$isVideo&&filter_var($stbg,FILTER_VALIDATE_URL))?$stbg:(!$isVideo?getRandomScreenshot($stbg):$stbg);
?>
<?php if ($isVideo): ?>
<style>
body {
margin: 0;
overflow: hidden;
}
#bgvideo {
position: fixed;
inset: 0;
width: 100vw;
height: 100vh;
object-fit: cover;
filter: blur(4px);
z-index: -2;
}
body::after {
content: "";
position: fixed;
inset: 0;
background: rgba(0,0,0,0.3);
z-index: -1;
}
</style>
<video id="bgvideo" autoplay muted loop playsinline>
<source src="<?=$bg?>" type="video/<?=pathinfo($bg,PATHINFO_EXTENSION)?>">
</video>
<?php else: ?>
<style>
body {
margin: 0;
position: relative;
z-index: 0;
}
body::before {
content: "";
position: fixed;
inset: 0;
background-image: url("<?=$bg?>"), url("https://i.imgur.com/ppIOe5T.gif");
background-size: cover;
background-position: center;
filter: blur(4px);
z-index: -2;
}
body::after {
content: "";
position: fixed;
inset: 0;
background: rgba(0,0,0,0.3);
z-index: -1;
}
</style>
<?php endif; ?>
<h3 class="mb-3 font_big" id="project_name"><?php echo getSetting("project_name",false)??"pBase"?></h3>
<div data-aos="zoom-in" data-aos-delay="100" class="card mt-auto mb-auto border-0 bggrad text-white" style="border-radius:20px; overflow: hidden; height: auto;">
<div class="d-flex mt-1 p-2" style="overflow: hidden;height:15vw;">
<img id="gm_img" class="rounded-4 mb-1" style="height:100%;aspect-ratio:1/1;" src="https://i.imgur.com/HKIws2U.png">
<div class="d-flex fw-bold mt-1 flex-column" style="justify-content: center;width: 100%;">
<h1 id="gameinf">err</h1>
<h5 id="mapinf">err</h5>
<h5 id="playercnt">err</h5>
</div>
</div>
</div>
<h6 id="words" class="fw-bold mb-auto" style="opacity: 0;transition: opacity 1s ease;"></h6>
<?php $result=$database->query("SELECT * FROM notes WHERE type='news' ORDER BY id DESC LIMIT 3")??NULL;?>
<?php $counter = 0;?>
<div class="mt-2" data-aos="flip-right" data-aos-delay="100">
<div id="carousel" class="carousel slide hoverscale" data-bs-ride="carousel" style="border-radius:25px; overflow: hidden;" >
<div class="carousel-indicators">
<button type="button" data-bs-target="#carousel" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carousel" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#carousel" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
<div class="carousel-inner">
<?php while ($row=$result->fetch_assoc()):?>
<?php $counter++; ?>
<div class="carousel-item <?php echo $counter==1?"active":"eba";?>">
<div class="image-box">
<a href="/news.php?id=<?=$row['id'];?>"><img src="<?=$row["headimg"];?>" class="d-block w-100" alt="..." style="object-fit: cover; height: 22vh;">
<h1 class="text-white font_smol position-absolute top-50 start-50 translate-middle" style="width:100%; background-color:rgba(0,0,0,.5);cursor:pointer;"><?=$row["title"];?></h1>
</a>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
<p id="curm" class="fw-bold mt-3" style="text-align: right;">Играет: </p>
</div>
<script>
var songs=<?php echo json_encode($settings["loading_music"]); ?>;
var words=<?php echo json_encode($settings["loading_words"]); ?>;
var volume = <?php echo $settings["loading_volume"];?>;
function isAprilFools() {
const now=new Date();
return (now.getMonth()===3&&now.getDate()===1);
}
function playRandomSong() {
if (isAprilFools()) {
var audio = new Audio("loadscreen/music/xd/2.ogg");
audio.volume = .5;
audio.loop = true;
audio.play();
document.getElementById("curm").innerHTML = "Играет: ??? 🤡";
return;
}
// обычный режим
var randomIndex = Math.floor(Math.random() * songs.length);
var song = songs[randomIndex];
document.getElementById("curm").innerHTML = "Играет: " + song.title;
var audio = new Audio(song.file);
audio.volume = volume / 100;
audio.play();
audio.addEventListener("ended", function(){
playRandomSong();
});
}
playRandomSong();
document.getElementById("gm_img").src="img/unknwn.jpg"//imgs["unknwn"];
function GameDetails(servername,serverurl,mapname,maxplayers,steamid,gamemode) {
document.getElementById("gameinf").innerHTML=gamemode
document.getElementById("mapinf").innerHTML="Карта: "+mapname
document.getElementById("playercnt").innerHTML="Игровых слотов: "+maxplayers
document.getElementById("gm_img").src="img/maps_logos/"+mapname+".png"
//var gmlw=gamemode.toLowerCase()
//if (imgs.hasOwnProperty(gmlw)) {
// var value=imgs[gmlw];
// document.getElementById("gm_img").src=value
//}
}
var textContainer=document.getElementById("words");
var fadeIn=function() {textContainer.style.opacity="1";};
var fadeOut=function() {textContainer.style.opacity="0";};
function updateText() {
fadeOut();
setTimeout(function(){
textContainer.textContent=words[Math.floor(Math.random() * words.length)];
fadeIn();
},1000);
}
setInterval(updateText,8000);
updateText();
//FOOOOOOOOOOOOOOOOLS
if (isAprilFools()) {
document.body.classList.add("april-fools");
// создаём стиль динамически (чтобы точно применился)
const style = document.createElement("style");
style.innerHTML = `
body.april-fools * {
animation: chaos 2s infinite linear !important;
}
@keyframes chaos {
0% { transform: rotate(0deg) scale(1); filter: hue-rotate(0deg); }
25% { transform: rotate(5deg) scale(1.05) translate(5px,-5px); }
50% { transform: rotate(-5deg) scale(0.95) translate(-5px,5px); filter: hue-rotate(180deg); }
75% { transform: rotate(3deg) scale(1.1); }
100% { transform: rotate(0deg) scale(1); filter: hue-rotate(360deg); }
}
body.april-fools::before,
body.april-fools #bgvideo {
animation: spinbg 10s infinite linear !important;
}
@keyframes spinbg {
from { transform: scale(1.2) rotate(0deg); }
to { transform: scale(1.2) rotate(360deg); }
}
`;
document.head.appendChild(style);
// ЖЁСТКИЙ ХАОС
setInterval(() => {
document.querySelectorAll("*").forEach(el => {
el.style.transform = `
rotate(${Math.random()*20-10}deg)
translate(${Math.random()*30-15}px, ${Math.random()*30-15}px)
scale(${1 + Math.random()*0.3})
`;
});
}, 400);
// смена цветов
setInterval(() => {
document.body.style.filter = `hue-rotate(${Math.random()*360}deg)`;
}, 500);
// дергаем заголовок отдельно
setInterval(() => {
const title = document.getElementById("project_name");
if (title) {
title.style.transform = `rotate(${Math.random()*40-20}deg) scale(${1+Math.random()*0.5})`;
}
}, 200);
}
</script>
<script src="<?=asset_version("/js/aos.js")?>"></script>
<?php include("components/footer.php") ?>