release 1.1.3
This commit is contained in:
@@ -52,6 +52,14 @@ if(version_compare(phpversion(), '5.5.0', '<')) {
|
||||
enter_logfile($logpath,$timezone,1,"Your PHP version (".phpversion().") is below 5.5.0. Update of PHP needed! Shuttin down!\n\n");
|
||||
exit;
|
||||
}
|
||||
if(!function_exists('simplexml_load_file')) {
|
||||
enter_logfile($logpath,$timezone,1,"SimpleXML is missed. Installation of SimpleXML is needed! Shuttin down!\n\n");
|
||||
exit;
|
||||
}
|
||||
if(!in_array('curl', get_loaded_extensions())) {
|
||||
enter_logfile($logpath,$timezone,1,"PHP cURL is missed. Installation of PHP cURL is needed! Shuttin down!\n\n");
|
||||
exit;
|
||||
}
|
||||
|
||||
enter_logfile($logpath,$timezone,5,"Initialize Bot...");
|
||||
require_once(substr(__DIR__,0,-4).'ts3_lib/TeamSpeak3.php');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
function check_db($mysqlcon,$lang,$dbname,$timezone,$currvers,$logpath) {
|
||||
$newversion = '1.1.2';
|
||||
$newversion = '1.1.3';
|
||||
enter_logfile($logpath,$timezone,5,"Check Ranksystem database for updates.");
|
||||
|
||||
function set_new_version($mysqlcon,$dbname,$timezone,$newversion,$logpath) {
|
||||
@@ -15,14 +15,14 @@ function check_db($mysqlcon,$lang,$dbname,$timezone,$currvers,$logpath) {
|
||||
}
|
||||
}
|
||||
|
||||
function check_chmod($timezone) {
|
||||
if (substr(sprintf('%o', fileperms(substr(__DIR__,0,-4).'icons/')), -4)!='0777') {
|
||||
function check_chmod($timezone,$logpath,$lang) {
|
||||
if(substr(sprintf('%o', fileperms(substr(__DIR__,0,-4).'icons/')), -3, 1)!='7') {
|
||||
enter_logfile($logpath,$timezone,2,sprintf($lang['isntwichm'],'icons'));
|
||||
}
|
||||
if (substr(sprintf('%o', fileperms(substr(__DIR__,0,-4).'logs/')), -4)!='0777') {
|
||||
if(substr(sprintf('%o', fileperms($logpath)), -3, 1)!='7') {
|
||||
enter_logfile($logpath,$timezone,2,sprintf($lang['isntwichm'],'logs'));
|
||||
}
|
||||
if (substr(sprintf('%o', fileperms(substr(__DIR__,0,-4).'avatars/')), -4)!='0777') {
|
||||
if(substr(sprintf('%o', fileperms(substr(__DIR__,0,-4).'avatars/')), -3, 1)!='7') {
|
||||
enter_logfile($logpath,$timezone,2,sprintf($lang['isntwichm'],'avatars'));
|
||||
}
|
||||
}
|
||||
@@ -131,7 +131,7 @@ function check_db($mysqlcon,$lang,$dbname,$timezone,$currvers,$logpath) {
|
||||
if($currvers==$newversion) {
|
||||
enter_logfile($logpath,$timezone,5," No newer version detected; Database check finished.");
|
||||
old_files($timezone,$logpath);
|
||||
check_chmod($timezone);
|
||||
check_chmod($timezone,$logpath,$lang);
|
||||
check_config($mysqlcon,$dbname);
|
||||
} elseif($currvers=="0.13-beta") {
|
||||
enter_logfile($logpath,$timezone,4," Update the Ranksystem Database to version 1.0.1");
|
||||
@@ -260,7 +260,7 @@ function check_db($mysqlcon,$lang,$dbname,$timezone,$currvers,$logpath) {
|
||||
|
||||
if ($errcount == 1) {
|
||||
$currvers = set_new_version($mysqlcon,$dbname,$timezone,$newversion,$logpath);
|
||||
old_files($timezone,$logpath);
|
||||
check_chmod($timezone,$logpath,$lang);
|
||||
check_chmod($timezone);
|
||||
} else {
|
||||
enter_logfile($logpath,$timezone,1,"An error happens due updating the Ranksystem Database!");
|
||||
@@ -335,8 +335,6 @@ function check_db($mysqlcon,$lang,$dbname,$timezone,$currvers,$logpath) {
|
||||
enter_logfile($logpath,$timezone,4," [1.1.2] Adjusted table config (part1) successfully.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(version_compare($currvers, '1.1.1', '<=')) {
|
||||
if($mysqlcon->exec("ALTER TABLE $dbname.config ADD (shownav int(1) NOT NULL default '0', showgrpsince int(1) NOT NULL default '0')") === false) { } else {
|
||||
if($mysqlcon->exec("UPDATE $dbname.config set shownav='1', showgrpsince='1'") === false) { } else {
|
||||
enter_logfile($logpath,$timezone,4," [1.1.2] Adjusted table config (part2) successfully.");
|
||||
@@ -346,9 +344,12 @@ function check_db($mysqlcon,$lang,$dbname,$timezone,$currvers,$logpath) {
|
||||
enter_logfile($logpath,$timezone,4," [1.1.2] Adjusted table user successfully.");
|
||||
}
|
||||
}
|
||||
if(version_compare($currvers, '1.1.2', '<=')) {
|
||||
enter_logfile($logpath,$timezone,4," [1.1.3] No database changes needed.");
|
||||
}
|
||||
$currvers = set_new_version($mysqlcon,$dbname,$timezone,$newversion,$logpath);
|
||||
old_files($timezone,$logpath);
|
||||
check_chmod($timezone);
|
||||
check_chmod($timezone,$logpath,$lang);
|
||||
check_config($mysqlcon,$dbname);
|
||||
}
|
||||
return $currvers;
|
||||
|
||||
@@ -5,19 +5,12 @@ function handle_messages(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3
|
||||
$uuid = $event["invokeruid"];
|
||||
|
||||
|
||||
if(strstr($event["msg"], 'nextup') && $nextupinfo == 1) {
|
||||
if(strstr($event["msg"], 'nextup') && $nextupinfo != 0) {
|
||||
//enter_logfile($logpath,$timezone,6,"Client ".$event["invokername"]." (".$event["invokeruid"].") sent textmessage: ".$event["msg"]);
|
||||
if(($dbuserdata = $mysqlcon->query("SELECT count,nextup,idle,except FROM $dbname.user WHERE uuid='$uuid'")) === false) {
|
||||
enter_logfile($logpath,$timezone,2,"handle_messages 1:".print_r($mysqlcon->errorInfo(), true));
|
||||
}
|
||||
$user = $dbuserdata->fetchAll(PDO::FETCH_ASSOC);
|
||||
$nextup = $user[0]['nextup'];
|
||||
$dtF = new DateTime("@0");
|
||||
$dtT = new DateTime("@$nextup");
|
||||
$days = $dtF->diff($dtT)->format('%a');
|
||||
$hours = $dtF->diff($dtT)->format('%h');
|
||||
$mins = $dtF->diff($dtT)->format('%i');
|
||||
$secs = $dtF->diff($dtT)->format('%s');
|
||||
|
||||
if(($dbgroups = $mysqlcon->query("SELECT * FROM $dbname.groups")) === false) {
|
||||
enter_logfile($logpath,$timezone,2,"handle_messages 2:".print_r($mysqlcon->errorInfo(), true));
|
||||
@@ -31,15 +24,21 @@ function handle_messages(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3
|
||||
$countgrp = count($grouptime);
|
||||
$grpcount=0;
|
||||
foreach ($grouptime as $time => $groupid) {
|
||||
$grpcount++;
|
||||
if ($substridle == 1) {
|
||||
$activetime = $user[0]['count'] - $user[0]['idle'];
|
||||
$nextup = $time - $user[0]['count'] - $user[0]['idle'];
|
||||
} else {
|
||||
$activetime = $user[0]['count'];
|
||||
$nextup = $time - $user[0]['count'];
|
||||
}
|
||||
if ($activetime < $time || $grpcount == $countgrp && $nextup <= 0) {
|
||||
$dtF = new DateTime("@0");
|
||||
$dtT = new DateTime("@$nextup");
|
||||
$days = $dtF->diff($dtT)->format('%a');
|
||||
$hours = $dtF->diff($dtT)->format('%h');
|
||||
$mins = $dtF->diff($dtT)->format('%i');
|
||||
$secs = $dtF->diff($dtT)->format('%s');
|
||||
$grpcount++;
|
||||
if ($nextup > 0 && $nextup < $time || $grpcount == $countgrp && $nextup <= 0) {
|
||||
check_shutdown($timezone,$logpath); usleep($slowmode);
|
||||
if ($grpcount == $countgrp && $nextup == 0) {
|
||||
if ($grpcount == $countgrp && $nextup <= 0) {
|
||||
try {
|
||||
$host->serverGetSelected()->clientGetByUid($event["invokeruid"])->message(sprintf($nextupinfomsg2, $days, $hours, $mins, $secs, $sqlhisgroup[$groupid]));
|
||||
} catch (Exception $e) {
|
||||
@@ -58,6 +57,9 @@ function handle_messages(TeamSpeak3_Adapter_ServerQuery_Event $event, TeamSpeak3
|
||||
enter_logfile($logpath,$timezone,2,"handle_messages 5:".$e->getCode().': '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
if($nextupinfo == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user