-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.php
335 lines (325 loc) · 20 KB
/
profile.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
323
324
325
326
327
328
329
330
331
332
333
334
335
<?php
include("components/head.php");
if (isset($_SESSION["steamid"])){
$_GET["page"]="profile";
$sid=$_SESSION["steamid"];
$userdata=$GLOBALS["database"]->query("SELECT * FROM users WHERE steamid='$sid';")->fetch_assoc();
unset($sid);
}else{
$_GET["page"]="profile";
$_GET["error"]="Требуется вход!";
}
function plural($n,$a,$b,$c){
switch($n%10==1&&$n%100!=11?0:($n%10>=2&&$n%10<=4&&($n%100<10or$n%100>=20)?1:2)){
case 0:default:return $a;
case 1:return $b;
case 2:return $c;
}
}
function elapsed($when)
{
$rtime=time()-$when;
if ($rtime<=1){return "только что";}
$a=array(365*24*60*60=>"год",30*24*60*60=>"месяц",24*60*60=>"день",60*60=>"час",60 =>"минута",1=>"секунда");
$a_da=array("год"=>["год","года","лет"],"месяц"=>["месяц","месяца","месяцев"],"день"=>["день","дня","дней"],"час"=>["час","часа","часов"],"минута"=>["минута","минуты","минут"],"секунда"=>["секунда","секунды","секунд"]);
foreach ($a as $si=>$str)
{
$d=$rtime/$si;
if ($d>1)
{
$r=round($d);
return $r." ".plural($r,$a_da[$str][0],$a_da[$str][1],$a_da[$str][2])." назад";
}
}
}
?>
<?php include("components/header.php") ?>
<?php if (!isset($_GET["error"])){ ?>
<?php if (isset($settings["access"][$_SESSION["steamid"]]["notes"])){ ?>
<script src="https://cdn.tiny.cloud/1/<?=$settings["tinymce_apikey"]?>/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
<script>tinymce.init({selector:'textarea',image_advtab:true,plugins:'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap emoticons',resize:false,branding:false});</script>
<div class="modal fade text-black" id="write_modal" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="staticBackdropLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-header text-center">
<h1 class="modal-title w-100 fs-5" id="modallbl">meg4typ3r 3000</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" >
<div class="input-group mb-3" id="iittl">
<span class="input-group-text"><i class="bi bi-fonts"></i></span>
<input type="text" id="iinpttl" class="shadow-none form-control" placeholder="title" aria-describedby="inpttl">
</div>
<div class="input-group mb-3" id="iiimg">
<span class="input-group-text"><i class="bi bi-card-image"></i></span>
<input type="text" id="iinpimg" class="shadow-none form-control" placeholder="headimg" aria-describedby="inpimg">
</div>
<textarea id="tiny"></textarea>
</div>
<div class="modal-footer">
<button type="button" id="nremove" class="btn btn-danger me-auto" data-bs-dismiss="modal">Удалить</button>
<button type="button" id="cancel" class="btn btn-dark" data-bs-dismiss="modal">Отмена</button>
<button type="button" id="publish" class="btn btn-success">Опубликовать</button>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if (isset($settings["access"][$_SESSION["steamid"]]["storagemoderate"])){ ?>
<div class="modal fade text-black" id="filemanager_modal" data-bs-backdrop="static" data-bs-keyboard="false" aria-labelledby="staticBackdropLabel2" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl">
<div class="modal-content">
<div class="modal-header text-center">
<h1 class="modal-title w-100 fs-5" id="fm_lbl">file manager</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body d-flex flex-wrap justify-content-around column-gap-3" id="filemb">
</div>
</div>
</div>
</div>
<?php } ?>
<div class="card mb-4 text-black" style="border-radius:25px; margin-top: 5%;" data-aos="fade-down" data-aos-delay="100">
<div class="card-body">
<div class="row p-2 text-center justify-content-center d-flex align-items-center mb-2" style="margin: -10%;">
<div class="col-auto">
<img class=" col-auto rounded-circle mb-3" style="border: 4px solid #000;"src="<?php echo $_SESSION["avatarfull"] ?>">
</div>
<div class="col-auto">
<h1 class="title my-0"><?=htmlspecialchars($_SESSION["name"],ENT_QUOTES,"UTF-8")?></h1>
<h6 class="title" style="color: rgb(94, 197, 130);"><i class=" mr-1"></i><?=$settings["ranks"][$_SESSION["steamid"]]??"User";?></h6>
</div> <div class="col-auto">
<div class="row justify-content-center mt-3">
<div class="col-auto"><div class="input-group mb-3">
<div class="input-group-prepend">
<a target="_blank" href="https://steamcommunity.com/profiles/<?=$_SESSION["steamid"]?>" class="btn btn-secondary fw-bold bg-white"><i class="bi bi-steam"></i> Профиль</a></div> <input onclick="this.select()" value="<?=$_SESSION["steamid"]?>" readonly="readonly" class="form-control border-custom shadow-none" style="text-align: center;">
</div>
<a class="btn w-100 btn-danger fw-bold btn-success btn-sm col-2" href="?logout">Разлогиниться</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card mb-4" data-aos="flip-left" data-aos-delay="100">
<div class="card-header text-black fw-bold">
Ваше Хранилище
</div>
<div class="card-body">
<form class="mb-3 input-group" action="core/db.php" method="post" enctype="multipart/form-data" id="fileform">
<input class="form-control shadow-none" type="file" name="file" id="file" required>
<button class="btn btn-outline-secondary" name="file_submit" type="submit"><i class="bi bi-cloud-arrow-up"></i> Загрузить</button>
</form>
<div class="d-none d-flex align-items-center column-gap-2 mb-1" id="uploadinf">
<span class="text-black" id="filesize"></span>
<span class="text-black" id="aviable"></span>
<div class="col">
<div class="progress" role="progressbar">
<div class="progress-bar progress-bar-striped progress-bar-animated" id="progress" style="width: 0%"></div>
</div>
</div>
</div>
<div id="alertplace"></div>
<div class="accordion accordion-flush" id="accordionFlushExample">
<div class="accordion-item">
<h2 class="accordion-header" id="flush-headingOne">
<button class="accordion-button collapsed rounded shadow" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne" id="fldrop">
Список файлов
</button>
</h2>
<div id="flush-collapseOne" class="accordion-collapse collapse" aria-labelledby="flush-headingOne" data-bs-parent="#accordionFlushExample">
<div class="accordion-body d-flex flex-wrap justify-content-around column-gap-2" id="filemanager">
</div>
</div>
</div>
</div>
<script>document.addEventListener("DOMContentLoaded",function(){get_file_list()})</script>
</div>
</div>
<?php if (isset($settings["access"][$_SESSION["steamid"]])){ ?>
<div class="accordion" id="accordionDada" data-aos="zoom-in" data-aos-delay="100">
<?php if (isset($settings["access"][$_SESSION["steamid"]]["global"])){ ?>
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button fw-bold collapsed shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne"><i class="bi bi-globe-europe-africa"></i> Глобальные Настройки</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#accordionDada">
<div class="accordion-body shadow border-light d-flex flex-wrap justify-content-around column-gap-3">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="enable_news" onclick="toggleswitch(this)" <?php echo getSetting("enable_news",true)?"checked":"";?>>
<label class="form-check-label" for="enable_news">Раздел новостей</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="enable_help" onclick="toggleswitch(this)" <?php echo getSetting("enable_help",true)?"checked":"";?>>
<label class="form-check-label" for="enable_help">Раздел помощи</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="enable_banlist" onclick="toggleswitch(this)" <?php echo getSetting("enable_banlist",true)?"checked":"";?>>
<label class="form-check-label" for="enable_banlist">Раздел банов</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="enable_serverlist" onclick="toggleswitch(this)" <?php echo getSetting("enable_serverlist",true)?"checked":"";?>>
<label class="form-check-label" for="enable_serverlist">Отображать сервера</label>
</div>
<div class="mt-3 input-group input-group-sm">
<span class="input-group-text">Задний Фон</span>
<input type="color" class="form-control form-control-color shadow-none" id="BGColorInput" value="#1e3a3d" title="Gradient #1">
<input type="color" class="form-control form-control-color shadow-none" id="BGColorInput2" value="#752443" title="Gradient #2">
<input type="color" class="form-control form-control-color shadow-none" id="BGColorInput3" value="#122d36" title="Gradient #3">
<input type="color" class="form-control form-control-color shadow-none" id="BGColorInput4" value="#682727" title="Gradient #4">
<button class="btn btn-outline-secondary" id="savebg" type="button"><i class="bi bi-palette"></i> Применить</button>
</div>
<div class="input-group mt-3">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" id="optionDrop">Настройка</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" id="project_name" onclick="toggledrop(this)">Имя проекта</a></li>
<li><a class="dropdown-item" id="favicon" onclick="toggledrop(this)">Путь к favicon</a></li>
<li><a class="dropdown-item" id="donate_goal" onclick="toggledrop(this)">Месячная цель пожертвования</a></li>
<li><a class="dropdown-item" id="goal_text" onclick="toggledrop(this)">Текст месячной цели</a></li>
<li><a class="dropdown-item" id="donate_currency" onclick="toggledrop(this)">Валюта пожертвования</a></li>
<li><a class="dropdown-item" id="tos" onclick="toggledrop(this)">Ссылка на TOS</a></li>
</ul>
<input type="text" class="form-control shadow-none outline-dark" id="dropInput" aria-label="text input">
<button class="btn btn-outline-secondary" id="saveDrop" type="button"><i class="bi bi-database-fill-up"></i> Сохранить</button>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if (isset($settings["access"][$_SESSION["steamid"]]["servers"])){ ?>
<script>document.addEventListener("DOMContentLoaded",function(){get_servers()})</script>
<div class="accordion-item">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed fw-bold shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"><i class="bi bi-hdd-rack-fill"></i> Управление Серверами</button>
</h2>
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionDada">
<div class="accordion-body table-responsive shadow border-light">
<table class="table table-sm">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Имя</th>
<th scope="col">IP</th>
<th scope="col">Port</th>
<th scope="col">Действие</th>
</tr>
</thead>
<tbody id="servertable">
</tbody>
</table>
<form class="input-group input-group-sm mb-2" id="srv_form">
<input type="text" class="form-control shadow-none" placeholder="Имя" name="name" required>
<input type="text" class="form-control shadow-none" placeholder="IP" name="ip" required>
<input type="number" class="form-control shadow-none" placeholder="Port" name="port" required>
<button class="btn border-success fw-bold btn-success btn-sm col-2" type="submit" id="button-addon2"><i class="bi bi-database-fill-up"></i> Добавить</button>
</frorm>
</div>
</div>
</div>
<?php } ?>
<?php if (isset($settings["access"][$_SESSION["steamid"]]["notes"])){ ?>
<script>window.addEventListener("DOMContentLoaded",function(){get_notes()})</script>
<div class="accordion-item">
<h2 class="accordion-header" id="headingThree">
<button class="accordion-button collapsed fw-bold shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"><i class="bi bi-newspaper"></i> Редактирование Записей</button>
</h2>
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionDada">
<div class="accordion-body table-responsive shadow border-light pb-1">
<div class="btn-group d-flex mb-2" role="group">
<button type="button" class="btn btn-success" id="news" onclick="toggleWritedrop(this)">Написать Новость</button>
<button type="button" class="btn btn-success" id="help" onclick="toggleWritedrop(this)">Написать Помощь</button>
</div>
<div id="notes_list" class="d-grid flex-wrap column-gap-3"></div>
<ul class="pagination justify-content-right mt-2 mb-2 d-none" id="notes_pag"></ul>
</div>
</div>
</div>
<?php } ?>
<?php if (isset($settings["access"][$_SESSION["steamid"]]["rcon"])){ ?>
<div class="accordion-item">
<h2 class="accordion-header" id="headingFour">
<button class="accordion-button collapsed fw-bold shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#collapseFour" aria-expanded="false" aria-controls="collapseFour"><i class="bi bi-terminal-fill"></i> RCON</button>
</h2>
<div id="collapseFour" class="accordion-collapse collapse" aria-labelledby="headingFour" data-bs-parent="#accordionDada">
<div class="accordion-body shadow border-light">
<div class="mt-1 input-group " id="rconform" action="core/rcon.php" method="post">
<span class="input-group-text" id="inpttl"><i class="bi bi-terminal"></i></span>
<input type="text" class="form-control shadow-none" id="rcon_string" name="command" placeholder="command">
<select name="server" class="form-select shadow-none" id="rcon_servs" style="width: 20px">
</select>
<button class="btn btn-outline-secondary" id="rcon_submit" type="button">Run</button>
</div>
<div class="rcon_r d-none mt-4" id="typer">
<div class="c2"><div class="text-lowercase typed-out" id="rcon_response_place"></div>
</div>
</div>
</div>
</div>
</div>
<?php } ?>
<?php if (isset($settings["access"][$_SESSION["steamid"]]["storagemoderate"])){ ?>
<div class="accordion-item">
<h2 class="accordion-header" id="headingFive">
<button class="accordion-button collapsed fw-bold shadow-none" type="button" data-bs-toggle="collapse" data-bs-target="#collapseFive" aria-expanded="false" aria-controls="collapseFive"><i class="bi bi-folder-check"></i></i> Модерация Хранилища</button>
</h2>
<div id="collapseFive" class="accordion-collapse collapse" aria-labelledby="headingFive" data-bs-parent="#accordionDada">
<div class="accordion-body shadow border-light d-flex flex-wrap justify-content-around column-gap-3">
<?php
function format_size($size) {
$mod=1024;
$units=explode(" ","B KB MB GB TB PB");
for ($i=0;$size>$mod;$i++) {
$size/=$mod;
}
return round($size,2)." ".$units[$i];
}
$dirs=glob("storage".DIRECTORY_SEPARATOR."*",GLOB_ONLYDIR+GLOB_NOSORT);
foreach($dirs as $dir){
$actualsid=basename($dir);
if ($actualsid==$_SESSION["steamid"]){continue;}
$size=0;
$cnt=0;
foreach(new FilesystemIterator($dir) as $file){
$size+=$file->getSize();
$cnt++;
}
$badchrs=['"',"'"];
$fm_userdata=$GLOBALS["database"]->query("SELECT * FROM users WHERE steamid='$actualsid';")->fetch_assoc();?>
<div class="card mb-4 text-black hoverscale stuser" style="border-radius:25px; width:200px; cursor: pointer;" onclick="get_file_list('<?php echo $actualsid; ?>','<?php echo str_replace($badchrs,'',$fm_userdata['name']); ?>')">
<div class="card-body">
<div class="row p-1 mb-1">
<div class="col">
<img class="col-auto rounded-circle mb-3" style="width: 80px;border: 4px solid #000;" src="<?=$fm_userdata["avatarfull"] ?>">
<h4 class="title my-0"><?=htmlspecialchars($fm_userdata["name"],ENT_QUOTES,"UTF-8")?></h1>
<h6 class="title" style="color:#5ec582;"><?=$settings["ranks"][$actualsid]??"User";?></h6>
<small class="title" style="color:#46B7AA; font-weight: bold;"><?=format_size($size);?> | Файлов: <?=$cnt;?></small>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="card mt-4" data-aos-offset="0" data-aos="flip-left" data-aos-delay="100">
<div class="card-header text-black fw-bold">
Дополнительная Информация
</div>
<div class="card-body shadow border-light d-flex flex-wrap justify-content-around column-gap-3">
<p id="stinf" class="fw-bold text-uppercase"></p>
<p class="fw-bold text-uppercase">АКТИВ НА СЕРВЕРЕ: <span id="servertime"><?=$userdata["last_played"]?elapsed($userdata["last_played"]):"НИКОГДА";?></span></p>
</div>
</div>
<script src="js/pip.min.js"></script>
<?php }else{ ?>
<h1 class="text-danger" data-aos="zoom-in" data-aos-delay="100">ОШИБКА</h1>
<p class="lead" data-aos="fade-down" data-aos-delay="400"><?=$_GET["error"];?></p>
<p class="lead">
<a class="btn mt-3 position-relative fixed-bottom btn-sm btn-secondary fw-bold border-white bg-white" data-aos="zoom-in-up" data-aos-delay="500" data-aos-offset="0" href="?login">Войдите через
<i class="bi bi-steam"></i>
</a>
<?php }?>
<?php include("components/footer.php") ?>