-
Notifications
You must be signed in to change notification settings - Fork 0
/
setting.php
144 lines (143 loc) · 4.49 KB
/
setting.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
<?
$Settings = array(
"Anti-poke" => 3358,
"No Text Messages"=> 60166,
"Anti Announce Messages" => 59642,
"No Whisper" => 60165,
"No Afk Mover" => array(62697,array(12850,12849,12848,12847,12846)),
);
$Allows = array(3358=>true,59642=>true,60165=>true,60166=>true,62448=>true);
$cid = base64_decode(base64_decode(base64_decode($_COOKIE["ClientDatabaseID"])));
$cid = $cid/25;
function isClientMebmerOfServerGroup($client,$sgid){
global $ts3;
foreach($ts3->clientGetServerGroupsByDbid($client) as $key =>$value){
if($key == $sgid){
return true;
}
}
return false;
}
if($cid == 0)echo "<script>location.reload();</script>";
if($_POST == null){
$_POST = array();
}
if(is_array($_POST) && strpos($_SERVER['HTTP_REFERER'],"/page/setting")){
$add = array();
$rem = array();
foreach($_POST as $key=>$value){
if($Allows[base64_decode(base64_decode(base64_decode($value)))/30]){
array_push($add,base64_decode(base64_decode(base64_decode($value)))/30);
}
}
foreach($Settings as $value){
if(is_array($value))$value = $value[0];
if(!in_array($value,$add)){
array_push($rem,$value);
}
}
require_once("/var/www/libraries/TeamSpeak3/TeamSpeak3.php");
include("./config.php");
mysqli_close($mysqli);
$ts3 = TeamSpeak3::factory("serverquery://" . $ts3user . ":" . $ts3pass . "@" . $ts3host . ":10011/?server_port=9987");
$ts3->execute("clientupdate", array("client_nickname" => "Options [".(string)rand()."]"));
foreach($add as $group){
if(!isClientMebmerOfServerGroup($cid,$group)){
$ts3->serverGroupClientAdd($group,$cid);
}
}
foreach($rem as $group){
if(isClientMebmerOfServerGroup($cid,$group)){
$ts3->serverGroupClientDel($group,$cid);
}
}
}
$req = createRequest("getClientServerGroups('".$_SERVER['REMOTE_ADDR']."',".$cid.")");
while(!waitForResult($req)){}
$result = readResult($req);
$info = json_decode(stripslashes($result),true);
$AllowAFk = "disable";
function getName($val){
if($val == "Anti-poke" || $val == "No Text Messages"){
return "Group1";
}
if($val == "No Afk Mover"){
return "NoAFk";
}
return $val;
}
$Checked = $info;
$allow = "disable";
foreach($Settings["No Afk Mover"][1] as $group){
if($Checked[$group]){
$allow = "enable";
break;
}
}
?>
<link href="skins/flat/blue.css" rel="stylesheet">
<script src="skins/icheck.js"></script>
<script>
$(document).ready(function(){
$('input').iCheck({
checkboxClass: 'icheckbox_flat-blue',
radioClass: 'iradio_flat-blue'
});
$(this).find("input[id='NoAFk']").not(":checked").iCheck("<?php echo $allow; ?>");
if ($(this).find("input[id='Group1']").filter(":checked").length >= 1) {
checkboxes = $(this).find("input[id='Group1']");
checkboxes.not(":checked").iCheck('disable');
}
$(document).on("ifToggled", function() {
checkboxes = $(this).find("input[id='Group1']");
if (checkboxes.filter(":checked").length >= 1) {
checkboxes.not(":checked").iCheck('disable');
} else {
checkboxes.not(":checked").iCheck('enable');
}
});
});
</script>
<style>
.col-centered{
float: none;
margin: 0 auto;
}
</style>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">خصائص التيم سبيك</h1>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-centered">
<div class="panel panel-default">
<div class="panel-heading">
<center>
<i class="fa fa-wrench"></i><label> خصائص التيم سبيك </label><i class="fa fa-wrench"></i>
</center>
</div>
<div class="panel-body" dir="ltr">
<form name='form' method='POST' action=''>
<?
foreach($Settings as $name=>$setting){
if(is_array($setting)){
$setting = $setting[0];
}
$txt = $name;
if($txt=="No Afk Mover")$txt .= " ( للعضويات الخاصة )";
$id = base64_encode(base64_encode(base64_encode($setting*30)));
if($Checked[$setting]){
echo '<input type=checkbox name="'.getName($name).'" id="'.getName($name).'" value="'.$id.'" class="icono" checked ><label> '.$txt.'</label><br/>';
} else {
echo '<input type=checkbox name="'.getName($name).'" id="'.getName($name).'" value="'.$id.'" class="icono" ><label> '.$txt.'</label><br/>';
}
}
?>
<center><button type="submit" class="btn btn-danger">تطبيق</button></center></form>
</div>
</div>
</div>
</div>
</div>