release 1.3.22

This commit is contained in:
Newcomer1989
2023-02-01 20:44:58 +01:00
parent b96e32b713
commit f7d7aedc5a
100 changed files with 5710 additions and 1435 deletions

View File

@@ -4,7 +4,7 @@ function get_avatars($ts3,$cfg,$dbname,&$db_cache) {
$nowtime = time();
$sqlexec = '';
if($db_cache['job_check']['get_avatars']['timestamp'] < ($nowtime - 32)) {
if(intval($db_cache['job_check']['get_avatars']['timestamp']) < ($nowtime - 32)) {
$db_cache['job_check']['get_avatars']['timestamp'] = $nowtime;
$sqlexec .= "UPDATE `$dbname`.`job_check` SET `timestamp`={$nowtime} WHERE `job_name`='get_avatars';\n";
try {
@@ -12,13 +12,13 @@ function get_avatars($ts3,$cfg,$dbname,&$db_cache) {
$tsfilelist = $ts3->channelFileList($cid="0", $cpw="", $path="/");
} catch (Exception $e) {
if ($e->getCode() != 1281) {
enter_logfile($cfg,2,"get_avatars 1:".$e->getCode().': '."Error while getting avatarlist: ".$e->getMessage());
enter_logfile(2,"get_avatars 1:".$e->getCode().': '."Error while getting avatarlist: ".$e->getMessage());
}
}
$fsfilelist = opendir(substr(__DIR__,0,-4).'avatars/');
$fsfilelist = opendir($GLOBALS['avatarpath']);
while (false !== ($fsfile = readdir($fsfilelist))) {
if ($fsfile != '.' && $fsfile != '..') {
$fsfilelistarray[$fsfile] = filemtime(substr(__DIR__,0,-4).'avatars/'.$fsfile);
$fsfilelistarray[$fsfile] = filemtime($GLOBALS['avatarpath'].$fsfile);
}
}
unset($fsfilelist);
@@ -32,24 +32,24 @@ function get_avatars($ts3,$cfg,$dbname,&$db_cache) {
if (!isset($fsfilelistarray[$uuidasbase16.'.png']) || ($tsfile['datetime'] - $cfg['teamspeak_avatar_download_delay']) > $fsfilelistarray[$uuidasbase16.'.png']) {
if (substr($tsfile['name'],0,7) == 'avatar_') {
try {
check_shutdown($cfg); usleep($cfg['teamspeak_query_command_delay']);
check_shutdown(); usleep($cfg['teamspeak_query_command_delay']);
$avatar = $ts3->transferInitDownload($clientftfid="5",$cid="0",$name=$fullfilename,$cpw="", $seekpos=0);
$transfer = TeamSpeak3::factory("filetransfer://" . $avatar["host"] . ":" . $avatar["port"]);
$tsfile = $transfer->download($avatar["ftkey"], $avatar["size"]);
$avatarfilepath = substr(__DIR__,0,-4).'avatars/'.$uuidasbase16.'.png';
$avatarfilepath = $GLOBALS['avatarpath'].$uuidasbase16.'.png';
$downloadedavatars++;
enter_logfile($cfg,5,"Download avatar: ".$fullfilename);
enter_logfile(5,"Download avatar: ".$fullfilename);
if(file_put_contents($avatarfilepath, $tsfile) === false) {
enter_logfile($cfg,2,"Error while writing out the avatar. Please check the permission for the folder 'avatars'");
enter_logfile(2,"Error while writing out the avatar. Please check the permission for the folder '".$GLOBALS['avatarpath']."'");
}
}
catch (Exception $e) {
enter_logfile($cfg,2,"get_avatars 2:".$e->getCode().': '."Error while downloading avatar: ".$e->getMessage());
enter_logfile(2,"get_avatars 2:".$e->getCode().': '."Error while downloading avatar: ".$e->getMessage());
}
}
}
if((microtime(true) - $starttime) > 5) {
enter_logfile($cfg,6,"get_avatars needs: ".(number_format(round((microtime(true) - $starttime), 5),5)));
enter_logfile(6,"get_avatars needs: ".(number_format(round((microtime(true) - $starttime), 5),5)));
return;
}
}
@@ -57,7 +57,7 @@ function get_avatars($ts3,$cfg,$dbname,&$db_cache) {
}
}
enter_logfile($cfg,6,"get_avatars needs: ".(number_format(round((microtime(true) - $starttime), 5),5)));
enter_logfile(6,"get_avatars needs: ".(number_format(round((microtime(true) - $starttime), 5),5)));
return($sqlexec);
}
?>