-
Notifications
You must be signed in to change notification settings - Fork 0
/
sets.php
129 lines (125 loc) · 4.07 KB
/
sets.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
<?php
$lang = 'ru';
$autoupd = 1;
$dynupd = 1;
$updint = 10;
$theme = 0;
$chats = 15;
$reverse = 0;
$autoscroll = 0;
$limit = 20;
$set = isset($_GET['set']);
include 'mp.php';
if($set) {
$autoupd = isset($_GET['autoupd']) ? 1 : 0;
$reverse = isset($_GET['reverse']) ? 1 : 0;
$autoscroll = isset($_GET['autoscroll']) ? 1 : 0;
$idf = $dynupd == 1 ? 10 : 25;
if(isset($_GET['lang'])) {
$lang = $_GET['lang'];
}
if(isset($_GET['updint'])) {
$updint = $_GET['updint'];
if(!is_numeric($updint)) {
$updint = $idf;
} else {
$updint = (int) $updint;
}
if($updint < 3 || $updint > 60) {
$updint = $idf;
}
}
if(isset($_GET['theme'])) {
$theme = (int) $_GET['theme'];
}
if(isset($_GET['chats'])) {
$chats = (int) $_GET['chats'];
if($chats < 10) {
$chats = 10;
} else if($chats > 100) {
$chats = 100;
}
}
if(isset($_GET['limit'])) {
$limit = (int) $_GET['limit'];
if($limit < 5) {
$limit = 5;
} else if($chats > 50) {
$limit = 50;
}
}
MP::cookie('lang', $lang, time() + (86400 * 365));
MP::cookie('autoupd', $autoupd, time() + (86400 * 365));
MP::cookie('updint', $updint, time() + (86400 * 365));
MP::cookie('theme', $theme, time() + (86400 * 365));
MP::cookie('chats', $chats, time() + (86400 * 365));
MP::cookie('reverse', $reverse, time() + (86400 * 365));
MP::cookie('autoscroll', $autoscroll, time() + (86400 * 365));
MP::cookie('limit', $limit, time() + (86400 * 365));
} else {
if(isset($_COOKIE['lang'])) {
$lang = $_COOKIE['lang'];
}
if(isset($_COOKIE['autoupd'])) {
$autoupd = (int)$_COOKIE['autoupd'];
}
if(isset($_COOKIE['updint'])) {
$updint = (int)$_COOKIE['updint'];
}
if(isset($_COOKIE['theme'])) {
$theme = (int)$_COOKIE['theme'];
}
if(isset($_COOKIE['chats'])) {
$chats = (int)$_COOKIE['chats'];
}
if(isset($_COOKIE['reverse'])) {
$reverse = (int)$_COOKIE['reverse'];
}
if(isset($_COOKIE['autoscroll'])) {
$autoscroll = (int)$_COOKIE['autoscroll'];
}
if(isset($_COOKIE['limit'])) {
$limit = (int)$_COOKIE['limit'];
}
}
$lng = MP::initLocale1();
header('Content-Type: text/html; charset=utf-8');
header('Cache-Control: private, no-cache, no-store');
include 'themes.php';
Themes::setTheme($theme);
echo '<head><title>'.MP::x($lng['settings']).'</title>';
echo Themes::head();
echo '</head>';
echo Themes::bodyStart();
echo '<div><a href="login.php">'.MP::x($lng['back']).'</a></div>';
echo '<form action="sets.php">';
echo '<input type="hidden" name="set" value="1">';
$langs = json_decode(file_get_contents('./locale/list.json'), true);
echo '<p><b>'.MP::x($lng['set_language']).'</b></p>';
foreach($langs as $k=>$v) {
echo '<input type="radio" name="lang"'.($lang==$k ? ' checked' : '').' value="'.$k.'">'.MP::x($v).'<br>';
}
echo '<p><b>'.MP::x($lng['set_chat']).'</b></p>';
echo '<p><input type="checkbox" id="autoupd" name="autoupd"'.($autoupd ? ' checked' : '').'>';
echo '<label for="autoupd">'.MP::x($lng['set_chat_autoupdate']).'</label>';
echo '<br><input type="checkbox" id="reverse" name="reverse"'.($reverse ? ' checked' : '').'>';
echo '<label for="reverse">'.MP::x($lng['set_chat_reverse_mode']).'</label>';
echo '<br><input type="checkbox" id="autoscroll" name="autoscroll"'.($autoscroll ? ' checked' : '').'>';
echo '<label for="autoscroll">'.MP::x($lng['set_chat_autoscroll']).'</label>';
echo '<p><label for="updint">'.MP::x($lng['set_chat_autoupdate_interval']).'</label>:<br>';
echo '<input type="text" size="3" id="updint" name="updint" value="'.$updint.'"><br>';
echo '<label for="limit">'.MP::x($lng['set_msgs_limit']).'</label>:<br>';
echo '<input type="text" size="3" id="limit" name="limit" value="'.$limit.'"><br>';
echo '<label for="chats">'.MP::x($lng['set_chats_count']).'</label>:<br>';
echo '<input type="text" size="3" id="chats" name="chats" value="'.$chats.'"></p>';
echo '<p><b>'.MP::x($lng['set_theme']).'</b></p>';
$themes = array(
0 => $lng['set_theme_dark'],
1 => $lng['set_theme_light'],
);
foreach($themes as $k=>$v) {
echo '<input type="radio" name="theme"'.($theme==$k ? ' checked' : '').' value="'.$k.'">'.MP::x($v).'<br>';
}
echo '<p><input type="submit"></p>';
echo '</form>';
echo Themes::bodyEnd();