Skip to content

Commit 32697c0

Browse files
committed
release 1.3.24
1 parent 25d375a commit 32697c0

387 files changed

Lines changed: 27319 additions & 31010 deletions

File tree

Some content is hidden

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

jobs/addon_channelinfo_toplist.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function addon_channelinfo_toplist(&$addons_config,$ts3,$mysqlcon,$cfg,$dbname,$
33
$sqlexec = '';
44
$nowtime = time();
55

6-
$smarty = new Smarty();
6+
$smarty = new Smarty\Smarty;
77

88
$smarty->setTemplateDir($GLOBALS['logpath'].'smarty/templates');
99
$smarty->setCompileDir($GLOBALS['logpath'].'smarty/templates_c');

jobs/bot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'jobs/update_rs.php');
6464
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'jobs/reset_rs.php');
6565
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'jobs/db_ex_imp.php');
66-
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'libs/smarty/Smarty.class.php');
66+
require_once(dirname(__DIR__).DIRECTORY_SEPARATOR.'libs/smarty/libs/Smarty.class.php');
6767

6868
enter_logfile(9,"Running on OS: ".php_uname("s")." ".php_uname("r"));
6969
enter_logfile(9,"Installation Path: ".__DIR__);

jobs/calc_serverstats.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ function calc_serverstats($ts3,$mysqlcon,&$cfg,$dbname,$dbtype,$serverinfo,&$db_
414414
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
415415
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
416416
$cfg['version_latest_available'] = curl_exec($ch);
417-
curl_close($ch); unset($ch);
417+
unset($ch);
418418

419419
if(!isset($cfg['stats_news_html']) || $cfg['stats_news_html'] != '') {
420420
$sqlexec .= "UPDATE `$dbname`.`job_check` SET `timestamp`='0' WHERE `job_name`='news_html';\nUPDATE `$dbname`.`cfg_params` SET `value`='' WHERE `param`='stats_news_html';\n";
@@ -427,7 +427,7 @@ function calc_serverstats($ts3,$mysqlcon,&$cfg,$dbname,$dbtype,$serverinfo,&$db_
427427
curl_setopt($newh, CURLOPT_FOLLOWLOCATION, 1);
428428
curl_setopt($newh, CURLOPT_CONNECTTIMEOUT, 5);
429429
$cfg['stats_news_html'] = curl_exec($newh);
430-
curl_close($newh); unset($newh);
430+
unset($newh);
431431
if($cfg['stats_news_html'] != '') {
432432
$sqlexec .= "UPDATE `$dbname`.`job_check` SET `timestamp`=$nowtime WHERE `job_name`='news_html';\nUPDATE `$dbname`.`cfg_params` SET `value`='{$cfg['stats_news_html']}' WHERE `param`='stats_news_html';\n";
433433
}
@@ -443,7 +443,7 @@ function calc_serverstats($ts3,$mysqlcon,&$cfg,$dbname,$dbtype,$serverinfo,&$db_
443443
curl_setopt($newb, CURLOPT_FOLLOWLOCATION, 1);
444444
curl_setopt($newb, CURLOPT_CONNECTTIMEOUT, 5);
445445
$cfg['teamspeak_news_bb'] = curl_exec($newb);
446-
curl_close($newb); unset($newb);
446+
unset($newb);
447447
if($cfg['teamspeak_news_bb'] != '') {
448448
$sqlexec .= "UPDATE `$dbname`.`job_check` SET `timestamp`=$nowtime WHERE `job_name`='news_bb';\nUPDATE `$dbname`.`cfg_params` SET `value`='{$cfg['teamspeak_news_bb']}' WHERE `param`='teamspeak_news_bb';\n";
449449
}

jobs/calc_user.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function calc_user($ts3,$mysqlcon,$lang,$cfg,$dbname,$allclients,$phpcommand,&$d
8585
$sqlexec .= "UPDATE `$dbname`.`user_snapshot` SET `count`='{$target_usersnap[$id]['count']}', `idle`='{$target_usersnap[$id]['idle']}' WHERE `cldbid`='{$target_cldbid}' AND `id`='{$id}';\n";
8686
$sqlexec .= "UPDATE `$dbname`.`user_snapshot` SET `count`='0', `idle`='0' WHERE `cldbid`='{$source_cldbid}' AND `id`='{$id}';\n";
8787
} else {
88-
$sqlexec .= "INSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES ('{$id}','{$target_cldbid}','{$source_snap['count']}','{$source_snap['idle']}');\n";
88+
$sqlexec .= "INSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES ('{$id}','{$target_cldbid}','{$source_snap['count']}','{$source_snap['idle']}') ON DUPLICATE KEY UPDATE `count`=VALUES(`count`),`idle`=VALUES(`idle`);\n";
8989
$sqlexec .= "UPDATE `$dbname`.`user_snapshot` SET `count`='0', `idle`='0' WHERE `cldbid`='{$source_cldbid}' AND `id`='{$id}';\n";
9090
}
9191
}

jobs/calc_user_snapshot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function calc_user_snapshot($cfg,$dbname,&$db_cache) {
1919
}
2020
$allinsertsnap = substr($allinsertsnap, 0, -1);
2121
if ($allinsertsnap != '') {
22-
$sqlexec .= "DELETE FROM `$dbname`.`user_snapshot` WHERE `id`={$nextid};\nINSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES $allinsertsnap;\nUPDATE `$dbname`.`job_check` SET `timestamp`={$nextid} WHERE `job_name`='last_snapshot_id';\nUPDATE `$dbname`.`job_check` SET `timestamp`={$nowtime} WHERE `job_name`='last_snapshot_time';\n";
22+
$sqlexec .= "DELETE FROM `$dbname`.`user_snapshot` WHERE `id`={$nextid};\nINSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES $allinsertsnap ON DUPLICATE KEY UPDATE `count`=VALUES(`count`),`idle`=VALUES(`idle`);\nUPDATE `$dbname`.`job_check` SET `timestamp`={$nextid} WHERE `job_name`='last_snapshot_id';\nUPDATE `$dbname`.`job_check` SET `timestamp`={$nowtime} WHERE `job_name`='last_snapshot_time';\n";
2323
}
2424
unset($allinsertsnap);
2525
}

jobs/calc_userstats.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,29 @@ function calc_userstats($ts3,$mysqlcon,$cfg,$dbname,&$db_cache) {
5353
$count_day = $userdata[$userstats['cldbid']][$keybase]['count'] - $userdata[$userstats['cldbid']][$keyday]['count'];
5454
$idle_day = $userdata[$userstats['cldbid']][$keybase]['idle'] - $userdata[$userstats['cldbid']][$keyday]['idle'];
5555
$active_day = $count_day - $idle_day;
56-
if($count_day < 0 || $count_day < $idle_day) $count_day = 0;
57-
if($idle_day < 0 || $count_day < $idle_day) $idle_day = 0;
58-
if($active_day < 0 || $count_day < $idle_day) $active_day = 0;
56+
if($count_day < 0 || $count_day < $idle_day || $count_day > 16777215) $count_day = 0;
57+
if($idle_day < 0 || $count_day < $idle_day || $idle_day > 16777215) $idle_day = 0;
58+
if($active_day < 0 || $count_day < $idle_day || $active_day > 16777215) $active_day = 0;
5959
} else {
6060
$count_day = $idle_day = $active_day = 0;
6161
}
6262
if(isset($userdata[$userstats['cldbid']]) && isset($userdata[$userstats['cldbid']][$keyweek]) && $userdata[$userstats['cldbid']][$keyweek]['id'] == $weekago) {
6363
$count_week = $userdata[$userstats['cldbid']][$keybase]['count'] - $userdata[$userstats['cldbid']][$keyweek]['count'];
6464
$idle_week = $userdata[$userstats['cldbid']][$keybase]['idle'] - $userdata[$userstats['cldbid']][$keyweek]['idle'];
6565
$active_week = $count_week - $idle_week;
66-
if($count_week < 0 || $count_week < $idle_week) $count_week = 0;
67-
if($idle_week < 0 || $count_week < $idle_week) $idle_week = 0;
68-
if($active_week < 0 || $count_week < $idle_week) $active_week = 0;
66+
if($count_week < 0 || $count_week < $idle_week || $count_week > 16777215) $count_week = 0;
67+
if($idle_week < 0 || $count_week < $idle_week || $idle_week > 16777215) $idle_week = 0;
68+
if($active_week < 0 || $count_week < $idle_week || $active_week > 16777215) $active_week = 0;
6969
} else {
7070
$count_week = $idle_week = $active_week = 0;
7171
}
7272
if(isset($userdata[$userstats['cldbid']]) && isset($userdata[$userstats['cldbid']][$keymonth]) && $userdata[$userstats['cldbid']][$keymonth]['id'] == $monthago) {
7373
$count_month = $userdata[$userstats['cldbid']][$keybase]['count'] - $userdata[$userstats['cldbid']][$keymonth]['count'];
7474
$idle_month = $userdata[$userstats['cldbid']][$keybase]['idle'] - $userdata[$userstats['cldbid']][$keymonth]['idle'];
7575
$active_month = $count_month - $idle_month;
76-
if($idle_month < 0 || $count_month < $idle_month) $idle_month = 0;
77-
if($count_month < 0 || $count_month < $idle_month) $count_month = 0;
78-
if($active_month < 0 || $count_month < $idle_month) $active_month = 0;
76+
if($idle_month < 0 || $count_month < $idle_month || $idle_month > 16777215) $idle_month = 0;
77+
if($count_month < 0 || $count_month < $idle_month || $count_month > 16777215) $count_month = 0;
78+
if($active_month < 0 || $count_month < $idle_month || $active_month > 16777215) $active_month = 0;
7979
} else {
8080
$count_month = $idle_month = $active_month = 0;
8181
}
@@ -93,14 +93,21 @@ function calc_userstats($ts3,$mysqlcon,$cfg,$dbname,&$db_cache) {
9393
if($clientinfo['client_totalconnections'] > 16777215) $clientinfo['client_totalconnections'] = 16777215;
9494
} catch (Exception $e) {
9595
if($e->getCode() == 512 || $e->getCode() == 1281) {
96-
enter_logfile(6,"Client (uuid: ".$uuid." cldbid: ".$userstats['cldbid'].") known by Ranksystem is missing in TS database, perhaps its already deleted or cldbid changed. Try to search for client by uuid.");
96+
enter_logfile(6,"Client (uuid: ".$uuid." cldbid: ".$userstats['cldbid'].") known by Ranksystem is missing in TS database, perhaps its already deleted or cldbid changed. Searching for client by uuid.");
9797
try {
9898
$getcldbid = $ts3->clientFindDb($uuid, TRUE);
9999
if($getcldbid[0] != $userstats['cldbid']) {
100100
enter_logfile(4," Client (uuid: ".$uuid." cldbid: ".$userstats['cldbid'].") known by the Ranksystem changed its cldbid. New cldbid is ".$getcldbid[0].".");
101101
$db_cache['all_user'][$uuid]['cldbid'] = $getcldbid[0];
102+
$sqlexec .= "DELETE FROM `$dbname`.`user_snapshot` WHERE `cldbid` IN ('{$userstats['cldbid']}','{$getcldbid[0]}');\n";
103+
try {
104+
$clientinfo = $ts3->clientInfoDb($getcldbid[0]);
105+
} catch (Exception $e) {
106+
enter_logfile(2,$lang['errorts3'].$e->getCode().': '.$e->getMessage()."; Error due command clientdbinfo for client-database-ID {$getcldbid[0]} (permission: b_virtualserver_client_dbinfo needed).");
107+
}
102108
if($cfg['rankup_client_database_id_change_switch'] == 1) {
103-
$sqlexec .= "UPDATE `$dbname`.`user` SET `count`=0,`idle`=0 WHERE `uuid`='$uuid';\nUPDATE `$dbname`.`stats_user` SET `count_day`=0,`count_week`=0,`count_month`=0,`idle_day`=0,`idle_week`=0,`idle_month`=0,`active_day`=0,`active_week`=0,`active_month`=0 WHERE `uuid`='$uuid';\nDELETE FROM `$dbname`.`user_snapshot` WHERE `cldbid`='{$userstats['cldbid']}';\n";
109+
$sqlexec .= "UPDATE `$dbname`.`user` SET `count`=0,`idle`=0 WHERE `uuid`='$uuid';\n";
110+
$sqlexec .= "UPDATE `$dbname`.`stats_user` SET `count_day`=0,`count_week`=0,`count_month`=0,`idle_day`=0,`idle_week`=0,`idle_month`=0,`active_day`=0,`active_week`=0,`active_month`=0 WHERE `uuid`='$uuid';\n";
104111
enter_logfile(4," ".sprintf($lang['changedbid'], $userstats['name'], $uuid, $userstats['cldbid'], $getcldbid[0]));
105112
} else {
106113
$sqlexec .= "UPDATE `$dbname`.`user` SET `cldbid`={$getcldbid[0]} WHERE `uuid`='$uuid';\n";
@@ -112,7 +119,7 @@ function calc_userstats($ts3,$mysqlcon,$cfg,$dbname,&$db_cache) {
112119
}
113120
if ($allinsert != '') {
114121
$allinsert = substr($allinsert, 0, -1);
115-
$sqlexec .= "INSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES $allinsert ON DUPLICATE KEY UPDATE `count`=VALUES(`count`),`idle`=VALUES(`idle`);\nDELETE FROM `$dbname`.`user_snapshot` WHERE `cldbid`='{$userstats['cldbid']}';\n";
122+
$sqlexec .= "INSERT INTO `$dbname`.`user_snapshot` (`id`,`cldbid`,`count`,`idle`) VALUES $allinsert ON DUPLICATE KEY UPDATE `count`=VALUES(`count`),`idle`=VALUES(`idle`);\n";
116123
}
117124
unset($allinsert);
118125
}

jobs/check_db.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?PHP
22
function check_db($mysqlcon,$lang,&$cfg,$dbname) {
3-
$cfg['version_latest_available'] = '1.3.23';
3+
$cfg['version_latest_available'] = '1.3.24';
44
enter_logfile(5,"Check Ranksystem database for updates...");
55

66
function check_double_cldbid($mysqlcon,$cfg,$dbname) {
@@ -531,18 +531,18 @@ function check_writable($cfg,$mysqlcon) {
531531
$cfg['teamspeak_news_bb'] = 'New Feature [URL=https://ts-ranksystem.com#voting]VOTING![/URL] for the Ranksystem';
532532
}
533533
}
534-
535-
if(version_compare($cfg['version_current_using'], '1.3.23', '<')) {
534+
535+
if(version_compare($cfg['version_current_using'], '1.3.24', '<')) {
536536
if($mysqlcon->exec("CREATE TABLE IF NOT EXISTS `$dbname`.`admin_mrgclient` (
537537
`uuid_source` char(28) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
538538
`uuid_target` char(28) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
539539
`timestamp` int(10) UNSIGNED NOT NULL default '0',
540540
PRIMARY KEY (`uuid_source`)
541541
);") === false) {
542542
$err_msg .= $lang['isntwidbmsg'].$mysqlcon->errorCode()." ".print_r($mysqlcon->errorInfo(), true).'<br>'; $err_lvl = 2;
543-
enter_logfile(2," [1.3.23] Created new table admin_mrgclient failed. SQL error: ".$mysqlcon->errorCode()." ".print_r($mysqlcon->errorInfo(), true));
543+
enter_logfile(2," [1.3.24] Created new table admin_mrgclient failed. SQL error: ".$mysqlcon->errorCode()." ".print_r($mysqlcon->errorInfo(), true));
544544
} else {
545-
enter_logfile(4," [1.3.23] Created new table admin_mrgclient successfully.");
545+
enter_logfile(4," [1.3.24] Created new table admin_mrgclient successfully.");
546546
}
547547

548548
if($mysqlcon->exec("DELETE FROM `$dbname`.`admin_addtime`;") === false) { }

0 commit comments

Comments
 (0)