Skip to content

Commit c7466d3

Browse files
author
Sebi94nbg
committed
Apply PHP-CS-Fixer code-style to webinterface/
1 parent bc165ab commit c7466d3

26 files changed

+3858
-3116
lines changed

webinterface/_nav.php

Lines changed: 201 additions & 191 deletions
Large diffs are not rendered by default.

webinterface/_preload.php

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
<?PHP
2-
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'other/_functions.php');
3-
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'other/config.php');
4-
5-
$prot = start_session($cfg);
6-
$lang = set_language(get_language());
7-
8-
error_reporting(E_ALL);
9-
ini_set("log_errors", 1);
10-
set_error_handler("php_error_handling");
11-
ini_set("error_log", $GLOBALS['logfile']);
12-
13-
try {
14-
if (isset($_POST['logout'])) {
15-
echo "logout";
16-
rem_session_ts3();
17-
header("Location: $prot://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
18-
exit;
19-
}
20-
if (strtolower(basename($_SERVER['SCRIPT_NAME'])) != "index.php" && basename($_SERVER['SCRIPT_NAME']) != "resetpassword.php" && (!isset($_SESSION[$rspathhex.'username']) || !isset($_SESSION[$rspathhex.'password']) || !isset($_SESSION[$rspathhex.'clientip']) || !isset($cfg['webinterface_user']) || !isset($cfg['webinterface_pass']) || !hash_equals($_SESSION[$rspathhex.'username'], $cfg['webinterface_user']) || !hash_equals($_SESSION[$rspathhex.'password'], $cfg['webinterface_pass']) || !hash_equals($_SESSION[$rspathhex.'clientip'], getclientip()))) {
21-
rem_session_ts3();
22-
header("Location: $prot://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
23-
exit;
24-
}
25-
26-
$csrf_token = bin2hex(openssl_random_pseudo_bytes(32));
27-
} catch(Throwable $ex) { }
28-
?>
1+
<?php
2+
3+
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'other/_functions.php';
4+
require_once dirname(__DIR__).DIRECTORY_SEPARATOR.'other/config.php';
5+
6+
$prot = start_session($cfg);
7+
$lang = set_language(get_language());
8+
9+
error_reporting(E_ALL);
10+
ini_set('log_errors', 1);
11+
set_error_handler('php_error_handling');
12+
ini_set('error_log', $GLOBALS['logfile']);
13+
14+
try {
15+
if (isset($_POST['logout'])) {
16+
echo 'logout';
17+
rem_session_ts3();
18+
header("Location: $prot://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
19+
exit;
20+
}
21+
if (strtolower(basename($_SERVER['SCRIPT_NAME'])) != 'index.php' && basename($_SERVER['SCRIPT_NAME']) != 'resetpassword.php' && (! isset($_SESSION[$rspathhex.'username']) || ! isset($_SESSION[$rspathhex.'password']) || ! isset($_SESSION[$rspathhex.'clientip']) || ! isset($cfg['webinterface_user']) || ! isset($cfg['webinterface_pass']) || ! hash_equals($_SESSION[$rspathhex.'username'], $cfg['webinterface_user']) || ! hash_equals($_SESSION[$rspathhex.'password'], $cfg['webinterface_pass']) || ! hash_equals($_SESSION[$rspathhex.'clientip'], getclientip()))) {
22+
rem_session_ts3();
23+
header("Location: $prot://".$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['PHP_SELF']), '/\\'));
24+
exit;
25+
}
26+
27+
$csrf_token = bin2hex(openssl_random_pseudo_bytes(32));
28+
} catch(Throwable $ex) {
29+
}

webinterface/addon_assign_groups.php

Lines changed: 248 additions & 178 deletions
Large diffs are not rendered by default.

webinterface/addon_channelinfo_toplist.php

Lines changed: 115 additions & 90 deletions
Large diffs are not rendered by default.

webinterface/admin_addtime.php

Lines changed: 108 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,92 @@
1-
<?PHP
2-
require_once('_preload.php');
3-
4-
try {
5-
require_once('_nav.php');
6-
7-
if ($mysqlcon->exec("INSERT INTO `$dbname`.`csrf_token` (`token`,`timestamp`,`sessionid`) VALUES ('$csrf_token','".time()."','".session_id()."')") === false) {
8-
$err_msg = print_r($mysqlcon->errorInfo(), true);
9-
$err_lvl = 3;
10-
}
11-
12-
if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `sessionid`='".session_id()."'")->fetchALL(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC)) === false) {
13-
$err_msg = print_r($mysqlcon->errorInfo(), true);
14-
$err_lvl = 3;
15-
}
16-
17-
if(!isset($_POST['number']) || $_POST['number'] == "yes") {
18-
$_SESSION[$rspathhex.'showexcepted'] = "yes";
19-
$filter = " WHERE `except`='0'";
20-
} else {
21-
$_SESSION[$rspathhex.'showexcepted'] = "no";
22-
$filter = "";
23-
}
24-
25-
if(($user_arr = $mysqlcon->query("SELECT `uuid`,`cldbid`,`name` FROM `$dbname`.`user` $filter ORDER BY `name` ASC")->fetchAll(PDO::FETCH_ASSOC)) === false) {
26-
$err_msg = "DB Error1: ".print_r($mysqlcon->errorInfo(), true); $err_lvl = 3;
27-
}
28-
29-
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
30-
$setontime = 0;
31-
if($_POST['setontime_day']) { $setontime = $setontime + $_POST['setontime_day'] * 86400; }
32-
if($_POST['setontime_hour']) { $setontime = $setontime + $_POST['setontime_hour'] * 3600; }
33-
if($_POST['setontime_min']) { $setontime = $setontime + $_POST['setontime_min'] * 60; }
34-
if($_POST['setontime_sec']) { $setontime = $setontime + $_POST['setontime_sec']; }
35-
if($setontime == 0) {
36-
$err_msg = $lang['errseltime']; $err_lvl = 3;
37-
} elseif($_POST['user'] == NULL) {
38-
$err_msg = $lang['errselusr']; $err_lvl = 3;
39-
} else {
40-
$allinsertdata = '';
41-
$succmsg = '';
42-
$nowtime = time();
43-
foreach($_POST['user'] as $uuid) {
44-
$allinsertdata .= "('".$uuid."', ".$nowtime.", ".$setontime."),";
45-
$succmsg .= sprintf($lang['sccupcount'],$setontime,$uuid)."<br>";
46-
}
47-
$allinsertdata = substr($allinsertdata, 0, -1);
48-
if($mysqlcon->exec("INSERT INTO `$dbname`.`admin_addtime` (`uuid`,`timestamp`,`timecount`) VALUES $allinsertdata;") === false) {
49-
$err_msg = $lang['isntwidbmsg'].print_r($mysqlcon->errorInfo(), true); $err_lvl = 3;
50-
} elseif($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`=1 WHERE `job_name`='reload_trigger'; ") === false) {
51-
$err_msg = $lang['isntwidbmsg'].print_r($mysqlcon->errorInfo(), true); $err_lvl = 3;
52-
} else {
53-
$err_msg = substr($succmsg,0,-4); $err_lvl = NULL;
54-
}
55-
}
56-
} elseif(isset($_POST['update'])) {
57-
echo '<div class="alert alert-danger alert-dismissible">',$lang['errcsrf'],'</div>';
58-
rem_session_ts3();
59-
exit;
60-
}
61-
?>
1+
<?php
2+
require_once '_preload.php';
3+
4+
try {
5+
require_once '_nav.php';
6+
7+
if ($mysqlcon->exec("INSERT INTO `$dbname`.`csrf_token` (`token`,`timestamp`,`sessionid`) VALUES ('$csrf_token','".time()."','".session_id()."')") === false) {
8+
$err_msg = print_r($mysqlcon->errorInfo(), true);
9+
$err_lvl = 3;
10+
}
11+
12+
if (($db_csrf = $mysqlcon->query("SELECT * FROM `$dbname`.`csrf_token` WHERE `sessionid`='".session_id()."'")->fetchALL(PDO::FETCH_UNIQUE | PDO::FETCH_ASSOC)) === false) {
13+
$err_msg = print_r($mysqlcon->errorInfo(), true);
14+
$err_lvl = 3;
15+
}
16+
17+
if (! isset($_POST['number']) || $_POST['number'] == 'yes') {
18+
$_SESSION[$rspathhex.'showexcepted'] = 'yes';
19+
$filter = " WHERE `except`='0'";
20+
} else {
21+
$_SESSION[$rspathhex.'showexcepted'] = 'no';
22+
$filter = '';
23+
}
24+
25+
if (($user_arr = $mysqlcon->query("SELECT `uuid`,`cldbid`,`name` FROM `$dbname`.`user` $filter ORDER BY `name` ASC")->fetchAll(PDO::FETCH_ASSOC)) === false) {
26+
$err_msg = 'DB Error1: '.print_r($mysqlcon->errorInfo(), true);
27+
$err_lvl = 3;
28+
}
29+
30+
if (isset($_POST['update']) && isset($db_csrf[$_POST['csrf_token']])) {
31+
$setontime = 0;
32+
if ($_POST['setontime_day']) {
33+
$setontime = $setontime + $_POST['setontime_day'] * 86400;
34+
}
35+
if ($_POST['setontime_hour']) {
36+
$setontime = $setontime + $_POST['setontime_hour'] * 3600;
37+
}
38+
if ($_POST['setontime_min']) {
39+
$setontime = $setontime + $_POST['setontime_min'] * 60;
40+
}
41+
if ($_POST['setontime_sec']) {
42+
$setontime = $setontime + $_POST['setontime_sec'];
43+
}
44+
if ($setontime == 0) {
45+
$err_msg = $lang['errseltime'];
46+
$err_lvl = 3;
47+
} elseif ($_POST['user'] == null) {
48+
$err_msg = $lang['errselusr'];
49+
$err_lvl = 3;
50+
} else {
51+
$allinsertdata = '';
52+
$succmsg = '';
53+
$nowtime = time();
54+
foreach ($_POST['user'] as $uuid) {
55+
$allinsertdata .= "('".$uuid."', ".$nowtime.', '.$setontime.'),';
56+
$succmsg .= sprintf($lang['sccupcount'], $setontime, $uuid).'<br>';
57+
}
58+
$allinsertdata = substr($allinsertdata, 0, -1);
59+
if ($mysqlcon->exec("INSERT INTO `$dbname`.`admin_addtime` (`uuid`,`timestamp`,`timecount`) VALUES $allinsertdata;") === false) {
60+
$err_msg = $lang['isntwidbmsg'].print_r($mysqlcon->errorInfo(), true);
61+
$err_lvl = 3;
62+
} elseif ($mysqlcon->exec("UPDATE `$dbname`.`job_check` SET `timestamp`=1 WHERE `job_name`='reload_trigger'; ") === false) {
63+
$err_msg = $lang['isntwidbmsg'].print_r($mysqlcon->errorInfo(), true);
64+
$err_lvl = 3;
65+
} else {
66+
$err_msg = substr($succmsg, 0, -4);
67+
$err_lvl = null;
68+
}
69+
}
70+
} elseif (isset($_POST['update'])) {
71+
echo '<div class="alert alert-danger alert-dismissible">',$lang['errcsrf'],'</div>';
72+
rem_session_ts3();
73+
exit;
74+
}
75+
?>
6276
<div id="page-wrapper" class="webinterface_admin_addtime">
63-
<?PHP if(isset($err_msg)) error_handling($err_msg, $err_lvl); ?>
77+
<?php if (isset($err_msg)) {
78+
error_handling($err_msg, $err_lvl);
79+
} ?>
6480
<div class="container-fluid">
6581
<div class="row">
6682
<div class="col-lg-12">
6783
<h1 class="page-header">
68-
<?php echo $lang['wihladm1']; ?>
84+
<?php echo $lang['wihladm1']; ?>
6985
</h1>
7086
</div>
7187
</div>
7288
<form name="post" method="POST">
73-
<input type="hidden" name="csrf_token" value="<?PHP echo $csrf_token; ?>">
89+
<input type="hidden" name="csrf_token" value="<?php echo $csrf_token; ?>">
7490
<div class="form-horizontal">
7591
<div class="row">
7692
<div class="col-md-12">
@@ -89,22 +105,28 @@
89105
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiadmhidedesc"><?php echo $lang['wiadmhide']; ?><i class="help-hover fas fa-question-circle"></i></label>
90106
<div class="col-sm-8 pull-right">
91107
<select class="selectpicker show-tick form-control" id="number" name="number" onchange="this.form.submit();">
92-
<?PHP
93-
echo '<option data-icon="fas fa-eye-slash" value="yes"'; if(!isset($_SESSION[$rspathhex.'showexcepted']) || $_SESSION[$rspathhex.'showexcepted'] == "yes") echo " selected=selected"; echo '><span class="item-margin">hide</span></option>';
94-
echo '<option data-icon="fas fa-eye" value="no"'; if(isset($_SESSION[$rspathhex.'showexcepted']) && $_SESSION[$rspathhex.'showexcepted'] == "no") echo " selected=selected"; echo '><span class="item-margin">show</span></option>';
95-
?>
108+
<?php
109+
echo '<option data-icon="fas fa-eye-slash" value="yes"';
110+
if (! isset($_SESSION[$rspathhex.'showexcepted']) || $_SESSION[$rspathhex.'showexcepted'] == 'yes') {
111+
echo ' selected=selected';
112+
} echo '><span class="item-margin">hide</span></option>';
113+
echo '<option data-icon="fas fa-eye" value="no"';
114+
if (isset($_SESSION[$rspathhex.'showexcepted']) && $_SESSION[$rspathhex.'showexcepted'] == 'no') {
115+
echo ' selected=selected';
116+
} echo '><span class="item-margin">show</span></option>';
117+
?>
96118
</select>
97119
</div>
98120
</div>
99121
<div class="form-group">
100122
<label class="col-sm-4 control-label" data-toggle="modal" data-target="#wiselclddesc"><?php echo $lang['wiselcld']; ?><i class="help-hover fas fa-question-circle"></i></label>
101123
<div class="col-sm-8">
102124
<select class="selectpicker show-tick form-control" data-actions-box="true" data-live-search="true" multiple name="user[]">
103-
<?PHP
104-
foreach ($user_arr as $user) {
105-
echo '<option value="',$user['uuid'],'" data-subtext="UUID:&nbsp;',$user['uuid'],';&nbsp;DBID: ',$user['cldbid'],'">',htmlspecialchars($user['name']),'</option>';
106-
}
107-
?>
125+
<?php
126+
foreach ($user_arr as $user) {
127+
echo '<option value="',$user['uuid'],'" data-subtext="UUID:&nbsp;',$user['uuid'],';&nbsp;DBID: ',$user['cldbid'],'">',htmlspecialchars($user['name']),'</option>';
128+
}
129+
?>
108130
</select>
109131
</div>
110132
</div>
@@ -117,7 +139,7 @@
117139
min: 0,
118140
max: 11574,
119141
verticalbuttons: true,
120-
prefix: '<?PHP echo $lang['time_day']; ?>'
142+
prefix: '<?php echo $lang['time_day']; ?>'
121143
});
122144
</script>
123145
</div>
@@ -131,7 +153,7 @@
131153
min: 0,
132154
max: 277777,
133155
verticalbuttons: true,
134-
prefix: '<?PHP echo $lang['time_hour']; ?>'
156+
prefix: '<?php echo $lang['time_hour']; ?>'
135157
});
136158
</script>
137159
</div>
@@ -145,7 +167,7 @@
145167
min: 0,
146168
max: 16666666,
147169
verticalbuttons: true,
148-
prefix: '<?PHP echo $lang['time_min']; ?>'
170+
prefix: '<?php echo $lang['time_min']; ?>'
149171
});
150172
</script>
151173
</div>
@@ -159,7 +181,7 @@
159181
min: 0,
160182
max: 999999999,
161183
verticalbuttons: true,
162-
prefix: '<?PHP echo $lang['time_sec']; ?>'
184+
prefix: '<?php echo $lang['time_sec']; ?>'
163185
});
164186
</script>
165187
</div>
@@ -189,10 +211,10 @@
189211
<h4 class="modal-title"><?php echo $lang['wiselcld']; ?></h4>
190212
</div>
191213
<div class="modal-body">
192-
<?php echo $lang['wiselclddesc']; ?>
214+
<?php echo $lang['wiselclddesc']; ?>
193215
</div>
194216
<div class="modal-footer">
195-
<button type="button" class="btn btn-default" data-dismiss="modal"><?PHP echo $lang['stnv0002']; ?></button>
217+
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $lang['stnv0002']; ?></button>
196218
</div>
197219
</div>
198220
</div>
@@ -205,10 +227,10 @@
205227
<h4 class="modal-title"><?php echo $lang['setontime']; ?></h4>
206228
</div>
207229
<div class="modal-body">
208-
<?php echo $lang['setontimedesc']; ?>
230+
<?php echo $lang['setontimedesc']; ?>
209231
</div>
210232
<div class="modal-footer">
211-
<button type="button" class="btn btn-default" data-dismiss="modal"><?PHP echo $lang['stnv0002']; ?></button>
233+
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $lang['stnv0002']; ?></button>
212234
</div>
213235
</div>
214236
</div>
@@ -221,16 +243,17 @@
221243
<h4 class="modal-title"><?php echo $lang['wiadmhide']; ?></h4>
222244
</div>
223245
<div class="modal-body">
224-
<?php echo $lang['wiadmhidedesc']; ?>
246+
<?php echo $lang['wiadmhidedesc']; ?>
225247
</div>
226248
<div class="modal-footer">
227-
<button type="button" class="btn btn-default" data-dismiss="modal"><?PHP echo $lang['stnv0002']; ?></button>
249+
<button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $lang['stnv0002']; ?></button>
228250
</div>
229251
</div>
230252
</div>
231253
</div>
232254
</body>
233255
</html>
234-
<?PHP
235-
} catch(Throwable $ex) { }
256+
<?php
257+
} catch(Throwable $ex) {
258+
}
236259
?>

0 commit comments

Comments
 (0)