Skip to content

Commit 3a33371

Browse files
committed
release 1.3.12
1 parent 3ab2007 commit 3a33371

54 files changed

Lines changed: 842 additions & 1192 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

install.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?PHP
22
require_once('other/config.php');
3-
$rsversion = '1.3.11';
3+
$rsversion = '1.3.12';
44
?>
55
<!DOCTYPE html>
66
<html>
@@ -293,7 +293,7 @@ function install($type, $host, $user, $pass, $dbname, $lang, $mysqlcon, &$err_ms
293293
$nextupinfomsg3 = $mysqlcon->quote("You are excepted from the Ranksystem. If you wish to rank contact an admin on the TS3 server.");
294294
$servernews = $mysqlcon->quote("<strong>Message</strong><br>This is an example Message.<br>Change this Message inside the webinterface.");
295295
$rankupmsg = $mysqlcon->quote('Hey, you reached a higher rank, since you already connected for %1$s days, %2$s hours and %3$s minutes to our TS3 server.[B]Keep it up![/B] ;-) ');
296-
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('default_date_format', $dateformat), ('default_language', 'en'), ('logs_path', '{$logpath}'), ('logs_timezone', 'Europe/Berlin'), ('logs_debug_level', '5'), ('logs_rotation_size', '5'), ('rankup_boost_definition', ''), ('rankup_clean_clients_period', '86400'), ('rankup_clean_clients_switch', '1'), ('rankup_client_database_id_change_switch', '0'), ('rankup_definition', '31536000=>7'), ('rankup_excepted_channel_id_list', ''), ('rankup_excepted_group_id_list', ''), ('rankup_excepted_mode', '0'), ('rankup_excepted_unique_client_id_list', ''), ('rankup_hash_ip_addresses_mode', '2'), ('rankup_ignore_idle_time', '600'), ('rankup_message_to_user', $rankupmsg), ('rankup_message_to_user_switch', '1'), ('rankup_next_message_1', $nextupinfomsg1), ('rankup_next_message_2', $nextupinfomsg2), ('rankup_next_message_3', $nextupinfomsg3), ('rankup_next_message_mode', '1'), ('rankup_time_assess_mode', '0'), ('stats_api_keys', ''), ('stats_column_active_time_switch', '0'), ('stats_column_current_group_since_switch', '1'), ('stats_column_current_server_group_switch', '1'), ('stats_column_client_db_id_switch', '0'), ('stats_column_client_name_switch', '1'), ('stats_column_idle_time_switch', '1'), ('stats_column_last_seen_switch', '1'), ('stats_column_next_rankup_switch', '1'), ('stats_column_next_server_group_switch', '1'), ('stats_column_online_time_switch', '1'), ('stats_column_rank_switch', '1'), ('stats_column_unique_id_switch', '0'), ('stats_column_default_sort', 'rank'), ('stats_column_default_order', 'asc'), ('stats_server_news', $servernews), ('stats_show_clients_in_highest_rank_switch', '1'), ('stats_show_excepted_clients_switch', '1'), ('stats_show_maxclientsline_switch', 0), ('stats_show_site_navigation_switch', '1'), ('stats_time_bronze','50'), ('stats_time_silver','100'), ('stats_time_gold','250'), ('stats_time_legend','500'), ('stats_connects_bronze','50'), ('stats_connects_silver','100'), ('stats_connects_gold','250'), ('stats_connects_legend','500'), ('teamspeak_avatar_download_delay', '0'), ('teamspeak_default_channel_id', '0'), ('teamspeak_host_address', '127.0.0.1'), ('teamspeak_query_command_delay', '0'), ('teamspeak_query_encrypt_switch', '0'), ('teamspeak_query_nickname', 'Ranksystem'), ('teamspeak_query_pass', ''), ('teamspeak_query_port', '10011'), ('teamspeak_query_user', 'serveradmin'), ('teamspeak_verification_channel_id', '0'), ('teamspeak_voice_port', '9987'), ('version_current_using', '{$rsversion}'), ('version_latest_available', '{$rsversion}'), ('version_update_channel', 'stable'), ('webinterface_access_count', '0'), ('webinterface_access_last', '0'), ('webinterface_admin_client_unique_id_list', ''), ('webinterface_advanced_mode', '0'), ('webinterface_fresh_installation', '1'), ('webinterface_pass', '{$pass}'), ('webinterface_user', '{$user}');") === false) {
296+
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('default_date_format', $dateformat), ('default_language', 'en'), ('logs_path', '{$logpath}'), ('logs_timezone', 'Europe/Berlin'), ('logs_debug_level', '5'), ('logs_rotation_size', '5'), ('rankup_boost_definition', ''), ('rankup_clean_clients_period', '86400'), ('rankup_clean_clients_switch', '1'), ('rankup_client_database_id_change_switch', '0'), ('rankup_definition', '31536000=>7'), ('rankup_excepted_channel_id_list', ''), ('rankup_excepted_group_id_list', ''), ('rankup_excepted_mode', '0'), ('rankup_excepted_unique_client_id_list', ''), ('rankup_hash_ip_addresses_mode', '2'), ('rankup_ignore_idle_time', '600'), ('rankup_message_to_user', $rankupmsg), ('rankup_message_to_user_switch', '1'), ('rankup_next_message_1', $nextupinfomsg1), ('rankup_next_message_2', $nextupinfomsg2), ('rankup_next_message_3', $nextupinfomsg3), ('rankup_next_message_mode', '1'), ('rankup_time_assess_mode', '0'), ('stats_api_keys', ''), ('stats_column_active_time_switch', '0'), ('stats_column_current_group_since_switch', '1'), ('stats_column_current_server_group_switch', '1'), ('stats_column_client_db_id_switch', '0'), ('stats_column_client_name_switch', '1'), ('stats_column_idle_time_switch', '1'), ('stats_column_last_seen_switch', '1'), ('stats_column_next_rankup_switch', '1'), ('stats_column_next_server_group_switch', '1'), ('stats_column_online_time_switch', '1'), ('stats_column_rank_switch', '1'), ('stats_column_unique_id_switch', '0'), ('stats_column_default_sort', 'rank'), ('stats_column_default_order', 'asc'), ('stats_imprint_switch', '0'), ('stats_imprint_address', 'Max Mustermann<br>Musterstraße 13<br>05172 Musterhausen<br>Germany'), ('stats_imprint_address_url', 'https://site.url/imprint/'), ('stats_imprint_email', 'info@example.com'), ('stats_imprint_notes', NULL), ('stats_imprint_phone', '+49 171 1234567'), ('stats_imprint_privacypolicy', 'Add your own privacy policy here. (editable in the webinterface)'), ('stats_imprint_privacypolicy_url', 'https://site.url/privacy/'), ('stats_server_news', $servernews), ('stats_show_clients_in_highest_rank_switch', '1'), ('stats_show_excepted_clients_switch', '1'), ('stats_show_maxclientsline_switch', 0), ('stats_show_site_navigation_switch', '1'), ('stats_time_bronze','50'), ('stats_time_silver','100'), ('stats_time_gold','250'), ('stats_time_legend','500'), ('stats_connects_bronze','50'), ('stats_connects_silver','100'), ('stats_connects_gold','250'), ('stats_connects_legend','500'), ('teamspeak_avatar_download_delay', '0'), ('teamspeak_default_channel_id', '0'), ('teamspeak_host_address', '127.0.0.1'), ('teamspeak_query_command_delay', '0'), ('teamspeak_query_encrypt_switch', '0'), ('teamspeak_query_nickname', 'Ranksystem'), ('teamspeak_query_pass', ''), ('teamspeak_query_port', '10011'), ('teamspeak_query_user', 'serveradmin'), ('teamspeak_verification_channel_id', '0'), ('teamspeak_voice_port', '9987'), ('version_current_using', '{$rsversion}'), ('version_latest_available', '{$rsversion}'), ('version_update_channel', 'stable'), ('webinterface_access_count', '0'), ('webinterface_access_last', '0'), ('webinterface_admin_client_unique_id_list', ''), ('webinterface_advanced_mode', '0'), ('webinterface_fresh_installation', '1'), ('webinterface_pass', '{$pass}'), ('webinterface_user', '{$user}');") === false) {
297297
$err_msg = $lang['isntwidbmsg'].$mysqlcon->errorCode()." ".print_r($mysqlcon->errorInfo(), true); $err_lvl = 2;
298298
} else {
299299
$err_msg = $lang['isntwiusr'].'<br><br>';

jobs/bot.php

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -133,32 +133,51 @@ function check_shutdown($cfg) {
133133
}
134134
enter_logfile($cfg,4,"Loading addons [done]");
135135

136-
function sendmessage($ts3, $cfg, $uuid, $msg, $erromsg=NULL, $errcode=NULL, $successmsg=NULL, $nolog=NULL) {
136+
function sendmessage($ts3, $cfg, $uuid, $targetmode, $targetid=NULL, $msg, $erromsg=NULL, $loglevel=NULL, $successmsg=NULL, $nolog=NULL) {
137137
try {
138138
if(strlen($msg) > 1024) {
139139
$fragarr = explode("##*##", wordwrap($msg, 1022, "##*##", TRUE), 1022);
140140
foreach($fragarr as $frag) {
141141
usleep($cfg['teamspeak_query_command_delay']);
142-
$ts3->serverGetSelected()->clientGetByUid($uuid)->message("\n".$frag);
143-
if($nolog==NULL) {
144-
enter_logfile($cfg,6,"sendmessage to uuid $uuid (fragment): ".$frag);
142+
if ($targetmode==2 && $targetid!=NULL) {
143+
$ts3->serverGetSelected()->channelGetById($targetid)->message("\n".$frag);
144+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage fragment to channel (ID: $targetid): ".$frag);
145+
} elseif ($targetmode==3) {
146+
$ts3->serverGetSelected()->message("\n".$frag);
147+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage fragment to server: ".$frag);
148+
} elseif ($targetmode==1 && $targetid!=NULL) {
149+
$ts3->serverGetSelected()->clientGetById($targetid)->message("\n".$frag);
150+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage fragment to connectionID $targetid (uuid $uuid): ".$frag);
151+
} else {
152+
$ts3->serverGetSelected()->clientGetByUid($uuid)->message("\n".$frag);
153+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage fragment to uuid $uuid (connectionID $targetid): ".$frag);
145154
}
146155
}
147156
} else {
148157
usleep($cfg['teamspeak_query_command_delay']);
149-
$ts3->serverGetSelected()->clientGetByUid($uuid)->message($msg);
150-
if($nolog==NULL) {
151-
enter_logfile($cfg,6,"sendmessage to uuid $uuid: ".$msg);
158+
if ($targetmode==2 && $targetid!=NULL) {
159+
$ts3->serverGetSelected()->channelGetById($targetid)->message($msg);
160+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage to channel (ID: $targetid): ".$msg);
161+
} elseif ($targetmode==3) {
162+
$ts3->serverGetSelected()->message($msg);
163+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage to server: ".$msg);
164+
} elseif ($targetmode==1 && $targetid!=NULL) {
165+
$ts3->serverGetSelected()->clientGetById($targetid)->message($msg);
166+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage to connectionID $targetid (uuid $uuid): ".$msg);
167+
} else {
168+
$ts3->serverGetSelected()->clientGetByUid($uuid)->message($msg);
169+
if($nolog==NULL) enter_logfile($cfg,6,"sendmessage to uuid $uuid (connectionID $targetid): ".$msg);
152170
}
171+
153172
}
154173
if($successmsg!=NULL) {
155174
enter_logfile($cfg,5,$successmsg);
156175
}
157176
} catch (Exception $e) {
158-
if($errcode!=NULL) {
159-
enter_logfile($cfg,$errcode,$erromsg." TS3: ".$e->getCode().': '.$e->getMessage());
177+
if($loglevel!=NULL) {
178+
enter_logfile($cfg,$loglevel,$erromsg." TS3: ".$e->getCode().': '.$e->getMessage());
160179
} else {
161-
enter_logfile($cfg,3,"sendmessage: ".$e->getCode().': '.$e->getMessage());
180+
enter_logfile($cfg,3,"sendmessage: ".$e->getCode().': '.$e->getMessage().", targetmode: $targetmode, targetid: $targetid");
162181
}
163182
}
164183
}
@@ -297,7 +316,6 @@ function run_bot() {
297316
enter_logfile($cfg,9," Log Level: ".$loglevel);
298317
enter_logfile($cfg,6," Serverside config 'max_execution_time' (PHP.ini): ".$max_execution_time." sec.");
299318
enter_logfile($cfg,6," Serverside config 'memory_limit' (PHP.ini): ".$memory_limit);
300-
$cfg['rankup_definition_flipped'] = array_flip($cfg['rankup_definition']);
301319
krsort($cfg['rankup_definition']);
302320

303321
if(($groupslist = $mysqlcon->query("SELECT * FROM `$dbname`.`groups`")->fetchAll(PDO::FETCH_UNIQUE|PDO::FETCH_ASSOC)) === false) {
@@ -307,8 +325,8 @@ function run_bot() {
307325
$checkgroups = 0;
308326
if(isset($groupslist) && $groupslist != NULL) {
309327
if(isset($cfg['rankup_definition']) && $cfg['rankup_definition'] != NULL) {
310-
foreach($cfg['rankup_definition'] as $time => $groupid) {
311-
if(!isset($groupslist[$groupid]) && $groupid != NULL) {
328+
foreach($cfg['rankup_definition'] as $rank) {
329+
if(!isset($groupslist[$rank['group']]) && $rank['group'] != NULL) {
312330
$checkgroups++;
313331
}
314332
}
@@ -351,9 +369,9 @@ function run_bot() {
351369

352370
if(isset($groupslist) && $groupslist != NULL) {
353371
if(isset($cfg['rankup_definition']) && $cfg['rankup_definition'] != NULL) {
354-
foreach($cfg['rankup_definition'] as $time => $groupid) {
355-
if(!isset($groupslist[$groupid]) && $groupid != NULL) {
356-
enter_logfile($cfg,1,' '.sprintf($lang['upgrp0001'], $groupid, $lang['wigrptime']));
372+
foreach($cfg['rankup_definition'] as $rank) {
373+
if(!isset($groupslist[$rank['group']]) && $rank['group'] != NULL) {
374+
enter_logfile($cfg,1,' '.sprintf($lang['upgrp0001'], $rank['group'], $lang['wigrptime']));
357375
$errcnf++;
358376
}
359377
}
@@ -385,8 +403,8 @@ function run_bot() {
385403
} else {
386404
if($lastupdate['timestamp'] != 0 && ($lastupdate['timestamp'] + 10) > time()) {
387405
if(isset($cfg['webinterface_admin_client_unique_id_list']) && $cfg['webinterface_admin_client_unique_id_list'] != NULL) {
388-
foreach(array_flip($cfg['webinterface_admin_client_unique_id_list']) as $clientid) {
389-
sendmessage($ts3server, $cfg, $clientid, sprintf($lang['upmsg2'], $cfg['version_current_using'], 'https://ts-ranksystem.com/#changelog'), sprintf($lang['upusrerr'], $clientid), 6, sprintf($lang['upusrinf'], $clientid));
406+
foreach(array_flip($cfg['webinterface_admin_client_unique_id_list']) as $clientuuid) {
407+
sendmessage($ts3server, $cfg, $clientuuid, NULL, sprintf($lang['upmsg2'], $cfg['version_current_using'], 'https://ts-ranksystem.com/#changelog'), sprintf($lang['upusrerr'], $clientuuid), 6, sprintf($lang['upusrinf'], $clientuuid));
390408
}
391409
}
392410
}
@@ -541,8 +559,8 @@ function run_bot() {
541559

542560
if($looptime < 1) {
543561
$loopsleep = (1 - $looptime);
544-
if($cfg['teamspeak_query_encrypt_switch'] == 1) {
545-
// no wait for data to become available on the stream on SSH due issues with non-blocking mode
562+
if($cfg['teamspeak_query_encrypt_switch'] == 1 || version_compare($ts3version['version'],'1.4.0','>=') && version_compare($ts3version['version'],'2.9.9','<=')) {
563+
// no wait for data to become available on the stream on SSH due issues with non-blocking mode or TeaSpeak
546564
usleep(round($loopsleep * 1000000));
547565
} else {
548566
$ts3server->getAdapter()->waittsn($loopsleep, 50000); // 50ms delay for CPU reason

jobs/calc_serverstats.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ function calc_serverstats($ts3,$mysqlcon,&$cfg,$dbname,$dbtype,$serverinfo,&$db_
377377

378378
if ($db_cache['job_check']['get_version']['timestamp'] < ($nowtime - 43199)) {
379379
$db_cache['job_check']['get_version']['timestamp'] = $nowtime;
380+
enter_logfile($cfg,6,"Get the latest Ranksystem Version.");
380381
$ch = curl_init();
381382
curl_setopt($ch, CURLOPT_URL, 'https://ts-n.net/ranksystem/'.$cfg['version_update_channel']);
382383
curl_setopt($ch, CURLOPT_REFERER, 'TSN Ranksystem');

0 commit comments

Comments
 (0)