Skip to content

Commit

Permalink
release 1.3.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Newcomer1989 committed Dec 14, 2020
1 parent e474b3f commit 5961fb9
Show file tree
Hide file tree
Showing 295 changed files with 16,454 additions and 15,328 deletions.
6 changes: 3 additions & 3 deletions install.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?PHP
$rsversion = '1.3.13';
$rsversion = '1.3.14';

require_once('other/_functions.php');
require_once('other/config.php');
Expand Down Expand Up @@ -198,7 +198,7 @@ function install($type, $host, $user, $pass, $dbname, $lang, $mysqlcon, &$err_ms
$count++;
}

if($mysqlcon->exec("INSERT INTO `$dbname`.`addons_config` (`param`,`value`) VALUES ('assign_groups_active','0'),('assign_groups_excepted_groupids',''),('assign_groups_groupids',''),('assign_groups_limit','')") === false) {
if($mysqlcon->exec("INSERT INTO `$dbname`.`addons_config` (`param`,`value`) VALUES ('assign_groups_active','0'),('assign_groups_name',''),('assign_groups_excepted_groupids',''),('assign_groups_groupids',''),('assign_groups_limit','')") === false) {
$err_msg .= $lang['isntwidbmsg'].$mysqlcon->errorCode()." ".print_r($mysqlcon->errorInfo(), true).'<br>'; $err_lvl = 2;
$count++;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ function install($type, $host, $user, $pass, $dbname, $lang, $mysqlcon, &$err_ms
$nextupinfomsg3 = $mysqlcon->quote("You are excepted from the Ranksystem. If you wish to rank contact an admin on the TS3 server.");
$servernews = $mysqlcon->quote("<strong>Message</strong><br>This is an example Message.<br>Change this Message inside the webinterface.");
$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] ;-) ');
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('default_date_format', $dateformat), ('default_language', 'en'), ('default_session_sametime', 'Strict'), ('default_header_origin', ''), ('default_header_xss', '1; mode=block'), ('default_header_contenttyp', '1'), ('default_header_frame', 'SAMEORIGIN'), ('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=>0'), ('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_nation_switch', '0'), ('stats_column_next_rankup_switch', '1'), ('stats_column_next_server_group_switch', '1'), ('stats_column_online_time_switch', '1'), ('stats_column_platform_switch', '0'), ('stats_column_rank_switch', '1'), ('stats_column_unique_id_switch', '0'), ('stats_column_default_sort', 'rank'), ('stats_column_default_order', 'asc'), ('stats_column_version_switch', '0'), ('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', '[email protected]'), ('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) {
if($mysqlcon->exec("INSERT INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('default_date_format', $dateformat), ('default_language', 'en'), ('default_session_sametime', 'Strict'), ('default_header_origin', ''), ('default_header_xss', '1; mode=block'), ('default_header_contenttyp', '1'), ('default_header_frame', 'SAMEORIGIN'), ('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=>0'), ('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_nation_switch', '0'), ('stats_column_next_rankup_switch', '1'), ('stats_column_next_server_group_switch', '1'), ('stats_column_online_time_switch', '1'), ('stats_column_platform_switch', '0'), ('stats_column_rank_switch', '1'), ('stats_column_unique_id_switch', '0'), ('stats_column_default_sort', 'lastseen'), ('stats_column_default_sort_2', 'rank'), ('stats_column_default_order', 'desc'), ('stats_column_default_order_2', 'asc'), ('stats_column_version_switch', '0'), ('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', '[email protected]'), ('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) {
$err_msg = $lang['isntwidbmsg'].$mysqlcon->errorCode()." ".print_r($mysqlcon->errorInfo(), true); $err_lvl = 2;
} else {
$err_msg = $lang['isntwiusr'].'<br><br>';
Expand Down
22 changes: 9 additions & 13 deletions jobs/bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ function run_bot(&$cfg) {
global $mysqlcon, $db, $dbname, $dbtype, $lang, $phpcommand, $addons_config, $max_execution_time, $memory_limit, $ts3server;

enter_logfile($cfg,9,"Connect to TS3 Server (Address: \"".$cfg['teamspeak_host_address']."\" Voice-Port: \"".$cfg['teamspeak_voice_port']."\" Query-Port: \"".$cfg['teamspeak_query_port']."\" SSH: \"".$cfg['teamspeak_query_encrypt_switch']."\" Query-Slowmode: \"".number_format(($cfg['teamspeak_query_command_delay']/1000000),1)."\").");

try {
if($mysqlcon->exec("DROP INDEX `snapshot_id` ON `$dbname`.`user_snapshot` (`id`)") === false) { } else {
enter_logfile($cfg,4," [1.3.13] Dropped unneeded Index snapshot_id on table user_snapshot.");
}
if($mysqlcon->exec("DROP INDEX `snapshot_cldbid` ON `$dbname`.`user_snapshot` (`cldbid`)") === false) { } else {
enter_logfile($cfg,4," [1.3.13] Dropped unneeded Index snapshot_cldbid on table user_snapshot.");
}
} catch (Exception $e) { }

try {
if($cfg['temp_ts_no_reconnection'] != 1) {
Expand Down Expand Up @@ -253,7 +244,7 @@ function run_bot(&$cfg) {
$serverinfo = $ts3server->serverInfo();
$select_arr = array();
$db_cache = array();
$sqlexec2 .= update_groups($ts3server,$mysqlcon,$lang,$cfg,$dbname,$serverinfo,$db_cache,1);
$sqlexec2 = update_groups($ts3server,$mysqlcon,$lang,$cfg,$dbname,$serverinfo,$db_cache,1);
if($mysqlcon->exec($sqlexec2) === false) {
enter_logfile($cfg,2,"Executing SQL commands failed: ".print_r($mysqlcon->errorInfo(), true));
}
Expand Down Expand Up @@ -316,6 +307,8 @@ function run_bot(&$cfg) {

unset($groupslist,$errcnf,$checkgroups,$lastupdate,$updcld,$loglevel,$whoami,$ts3host,$max_execution_time,$memory_limit,$memory_limit);
enter_logfile($cfg,9,"Config check [done]");
} else {
enter_logfile($cfg,9," Try to use the restored TS3 connection");
}

enter_logfile($cfg,9,"Bot starts now his work!");
Expand Down Expand Up @@ -445,7 +438,7 @@ function run_bot(&$cfg) {
}
enter_logfile($cfg,6,"SQL executions needs: ".(number_format(round((microtime(true) - $startsql), 5),5)));

reset_rs($ts3server,$mysqlcon,$lang,$cfg,$dbname,$db_cache);
reset_rs($ts3server,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,$db_cache);
db_ex_imp($ts3server,$mysqlcon,$lang,$cfg,$dbname,$db_cache);

unset($sqlexec,$select_arr,$sqldump);
Expand Down Expand Up @@ -497,17 +490,20 @@ function run_bot(&$cfg) {
check_shutdown($cfg);
}

if(in_array($e->getCode(), array('HY000','10054','70100','8'))) {
$check_db_arr = array_flip(array('HY000',10054,70100));
if(isset($check_db_arr[$e->getCode()])) {
$cfg['temp_ts_no_reconnection'] = 1;
try {
$mysqlcon = db_connect($db['type'], $db['host'], $db['dbname'], $db['user'], $db['pass'], "no_exit");
enter_logfile($cfg,9,"Connection to database restored");
} catch (Exception $e) {
enter_logfile($cfg,2,$lang['error'].print_r($mysqlcon->errorInfo(), true));
}
} else {
$cfg['temp_ts_no_reconnection'] = 0;
}

$cfg['temp_reconnect_attempts'] = $cfg['temp_reconnect_attempts'] + 1;
$cfg['temp_reconnect_attempts']++;
return $ts3server;
} else {
shutdown($mysqlcon,$cfg,1,"Critical TS3 error on core function!");
Expand Down
2 changes: 1 addition & 1 deletion jobs/calc_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function calc_user($ts3,$mysqlcon,$lang,$cfg,$dbname,$allclients,$phpcommand,&$d
$db_cache['all_user'][$uid]['nextup'] = 0;
}
$db_cache['all_user'][$uid]['grpid'] = $rank['group'];
break;
if($rank['keep'] != 1) break;
} else {
$db_cache['all_user'][$uid]['nextup'] = $rank['time'] - $activetime;
}
Expand Down
20 changes: 16 additions & 4 deletions jobs/check_db.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?PHP
function check_db($mysqlcon,$lang,&$cfg,$dbname) {
$cfg['version_latest_available'] = '1.3.13';
$cfg['version_latest_available'] = '1.3.14';
enter_logfile($cfg,5,"Check Ranksystem database for updates...");

function check_double_cldbid($mysqlcon,$cfg,$dbname) {
Expand Down Expand Up @@ -364,9 +364,6 @@ function check_writable($cfg,$mysqlcon) {
}

if(version_compare($cfg['version_current_using'], '1.3.13', '<')) {
if($mysqlcon->exec("DELETE FROM `$dbname`.`admin_addtime`;") === false) { }
if($mysqlcon->exec("DELETE FROM `$dbname`.`addon_assign_groups`;") === false) { }

if($mysqlcon->exec("UPDATE `$dbname`.`user` SET `idle`=0 WHERE `idle`<0; UPDATE `$dbname`.`user` SET `count`=`idle` WHERE `count`<0; UPDATE `$dbname`.`user` SET `count`=`idle` WHERE `count`<`idle`;") === false) { }
if($mysqlcon->exec("UPDATE `$dbname`.`user_snapshot` SET `idle`=0 WHERE `idle`<0; UPDATE `$dbname`.`user_snapshot` SET `count`=`idle` WHERE `count`<0; UPDATE `$dbname`.`user_snapshot` SET `count`=`idle` WHERE `count`<`idle`;") === false) { }

Expand All @@ -393,7 +390,22 @@ function check_writable($cfg,$mysqlcon) {
if($mysqlcon->exec("DROP INDEX `snapshot_cldbid` ON `$dbname`.`user_snapshot` (`cldbid`)") === false) { } else {
enter_logfile($cfg,4," [1.3.13] Dropped unneeded Index snapshot_cldbid on table user_snapshot.");
}
} catch (Exception $e) { }
}

if(version_compare($cfg['version_current_using'], '1.3.14', '<')) {
if($mysqlcon->exec("DELETE FROM `$dbname`.`admin_addtime`;") === false) { }
if($mysqlcon->exec("DELETE FROM `$dbname`.`addon_assign_groups`;") === false) { }

if($mysqlcon->exec("INSERT IGNORE INTO `$dbname`.`cfg_params` (`param`,`value`) VALUES ('stats_column_default_sort_2', 'rank'),('stats_column_default_order_2', 'asc') ON DUPLICATE KEY UPDATE `value`=VALUES(`value`);") === false) { } else {
enter_logfile($cfg,4," [1.3.14] Added new cfg_params values.");
}

if($mysqlcon->exec("INSERT IGNORE INTO `$dbname`.`addons_config` (`param`,`value`) VALUES ('assign_groups_name','');") === false) { } else {
enter_logfile($cfg,4," [1.3.14] Added new addons_config values.");
}

try {
if($mysqlcon->exec("CREATE INDEX `serverusage_timestamp` ON `$dbname`.`server_usage` (`timestamp`)") === false) { }
if($mysqlcon->exec("CREATE INDEX `user_version` ON `$dbname`.`user` (`version`)") === false) { }
if($mysqlcon->exec("CREATE INDEX `user_cldbid` ON `$dbname`.`user` (`cldbid` ASC,`uuid`,`rank`)") === false) { }
Expand Down
8 changes: 4 additions & 4 deletions jobs/reset_rs.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?PHP
function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,&$db_cache) {
function reset_rs($ts3,$mysqlcon,$lang,$cfg,$dbname,$phpcommand,&$db_cache) {
$starttime = microtime(true);

if (in_array($db_cache['job_check']['reset_user_time']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_user_delete']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_group_withdraw']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_webspace_cache']['timestamp'], ["1","2"], true) || in_array($db_cache['job_check']['reset_usage_graph']['timestamp'], ["1","2"], true)) {
Expand Down Expand Up @@ -280,11 +280,11 @@ function rm_file_reset($folder,$cfg) {
if($db_cache['job_check']['reset_stop_after']['timestamp'] == "1") {
$path = substr(__DIR__, 0, -4);
if (substr(php_uname(), 0, 7) == "Windows") {
exec("start ".$phpcommand." ".$path."worker.php stop");
file_put_contents(substr(__DIR__,0,-4).'logs\autostart_deactivated',"");
pclose(popen("start /B cmd /C ".$phpcommand." ".$path."worker.php stop >NUL 2>NUL", "r"));
file_put_contents($path.'logs\autostart_deactivated',"");
} else {
exec($phpcommand." ".$path."worker.php stop > /dev/null &");
file_put_contents(substr(__DIR__,0,-4).'logs/autostart_deactivated',"");
file_put_contents($path.'logs/autostart_deactivated',"");
}
shutdown($mysqlcon,$cfg,4,"Stop requested after Reset job. Wait for manually start.");
}
Expand Down
6 changes: 6 additions & 0 deletions languages/core_ar_العربية_arab.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
$lang['stag0017'] = "verificate here..";
$lang['stag0018'] = "A list of excepted servergroups. If a user owns one of this servergroups, he will not be able to use the Add-on.";
$lang['stag0019'] = "You are excepted from this function because you own the servergroup: %s (ID: %s).";
$lang['stag0020'] = "Title";
$lang['stag0021'] = "Enter a title for this group. The title will be shown also on the statistics page.";
$lang['stix0001'] = "حالة الخادم";
$lang['stix0002'] = "مجموع المستخدمين";
$lang['stix0003'] = "عرض التفاصيل";
Expand Down Expand Up @@ -573,6 +575,8 @@
$lang['wishcolhadesc'] = "The TeamSpeak 3 server stores the IP address of each client. This we need for the Ranksystem to bind the website user of the statistics page with the related TeamSpeak user.<br><br>With this function you can active an encrypting / hashing of the IP addresses of TeamSpeak users. When enabled, only the hashed value will be stored in the database, instead of storing it in plain text. This is needed in some cases of your privacy legal; especially required due the EU-GDPR.<br><br><b>fast hashing (default):</b> IP addresses will be hashed. The salt is different for each ranksystem instance, but same for all users on the server. This makes it faster, but also weaker as the 'secure hashing'.<br><br><b>secure hashing:</b> IP addresses will be hashed. Each user will get his own salt, which makes it hard to decrypt the IP (=secure). This parameter is conform with the EU-GDPR. Contra: This variation affects the performance, especially on bigger TeamSpeak servers, it will slow down the statistics page on first site load very much. Also it inceases the needed resources.<br><br><b>disable hashing:</b> If this function is disabled the IP address of a user will be stored in plain text. This is the fastest option that requires the least resources.<br><br><br>In all variants the IP addresses of users will only be stored as long as the user is connected to the TS3 server (less data collection - EU-GDPR).<br><br>The IP addresses of users will only be stored once a user connected to the TS3 server. On changing this function the user needs to reconnect to the TS3 server to be able to get verified with the Ranksystem webpage.";
$lang['wishcolot'] = "online time";
$lang['wishdef'] = "default column sort";
$lang['wishdef2'] = "2nd column sort";
$lang['wishdef2desc'] = "Define the second sorting level for the List Rankup page.";
$lang['wishdefdesc'] = "Define the default sorting column for the List Rankup page.";
$lang['wishexcld'] = "excepted client";
$lang['wishexclddesc'] = "Show clients in list_rankup.php,<br>which are excluded and therefore not participate in the Ranksystem.";
Expand All @@ -589,6 +593,8 @@
$lang['wishnav'] = "show site-navigation";
$lang['wishnavdesc'] = "Show the site navigation on 'stats/' page.<br><br>If this option is deactivated on the stats page the site navigation will be hidden.<br>You can then take each site i.e. 'stats/list_rankup.php' and embed this as frame in your existing website or bulletin board.";
$lang['wishsort'] = "default sorting order";
$lang['wishsort2'] = "2nd sorting order";
$lang['wishsort2desc'] = "This will define the order for the second level sorting.";
$lang['wishsortdesc'] = "Define the default sorting order for the List Rankup page.";
$lang['wistcodesc'] = "Specify a required count of server-connects to meet the achievement.";
$lang['wisttidesc'] = "Specify a required time (in hours) to meet the achievement.";
Expand Down
Loading

0 comments on commit 5961fb9

Please sign in to comment.