"fixed" library

This commit is contained in:
Ulf Gebhardt 2023-11-01 23:35:21 +01:00
parent 1c73d65b31
commit d335ccaf80
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
7 changed files with 57 additions and 55 deletions

View File

@ -182,7 +182,7 @@ class TeamSpeak3_Helper_Char
*/
public function toUnicode()
{
$h = ord($this->char{0});
$h = ord($this->char[0]);
if($h <= 0x7F)
{
@ -194,15 +194,15 @@ class TeamSpeak3_Helper_Char
}
else if($h <= 0xDF)
{
return ($h & 0x1F) << 6 | (ord($this->char{1}) & 0x3F);
return ($h & 0x1F) << 6 | (ord($this->char[1]) & 0x3F);
}
else if($h <= 0xEF)
{
return ($h & 0x0F) << 12 | (ord($this->char{1}) & 0x3F) << 6 | (ord($this->char{2}) & 0x3F);
return ($h & 0x0F) << 12 | (ord($this->char[1]) & 0x3F) << 6 | (ord($this->char[2]) & 0x3F);
}
else if($h <= 0xF4)
{
return ($h & 0x0F) << 18 | (ord($this->char{1}) & 0x3F) << 12 | (ord($this->char{2}) & 0x3F) << 6 | (ord($this->char{3}) & 0x3F);
return ($h & 0x0F) << 18 | (ord($this->char[1]) & 0x3F) << 12 | (ord($this->char[2]) & 0x3F) << 6 | (ord($this->char[3]) & 0x3F);
}
else
{

View File

@ -175,7 +175,7 @@ class TeamSpeak3_Helper_Crypt
$data = 0;
for($j = 4; $j > 0; $j--)
{
$data = $data << 8 | ord($passphrase{$k});
$data = $data << 8 | ord($passphrase[$k]);
$k = ($k+1) % $length;
}
$this->p[$i] ^= $data;

View File

@ -472,7 +472,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
{
if(!$this->isUtf8())
{
$this->string = utf8_encode($this->string);
$this->string = mb_convert_encoding($this->string, 'UTF-8', 'ISO-8859-1'); //utf8_encode($this->string);
}
return $this;
@ -550,7 +550,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
$utf8_accents = array(
"à" => "a",
"ô" => "o",
"Ä?" => "d",
"<EFBFBD>?" => "d",
"" => "f",
"ë" => "e",
"š" => "s",
@ -560,9 +560,9 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"ř" => "r",
"ț" => "t",
"ň" => "n",
"Ä?" => "a",
"<EFBFBD>?" => "a",
"ķ" => "k",
"Å?" => "s",
"<EFBFBD>?" => "s",
"" => "y",
"ņ" => "n",
"ĺ" => "l",
@ -573,7 +573,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"ě" => "e",
"é" => "e",
"ç" => "c",
"�" => "w",
"<EFBFBD>?" => "w",
"ċ" => "c",
"õ" => "o",
"" => "s",
@ -591,7 +591,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"ŵ" => "w",
"" => "t",
"ū" => "u",
"Ä?" => "c",
"<EFBFBD>?" => "c",
"ö" => "oe",
"è" => "e",
"ŷ" => "y",
@ -622,7 +622,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"ñ" => "n",
"ń" => "n",
"ĥ" => "h",
"Ä?" => "g",
"<EFBFBD>?" => "g",
"đ" => "d",
"ĵ" => "j",
"ÿ" => "y",
@ -639,8 +639,8 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"ī" => "i",
"ã" => "a",
"ġ" => "g",
"á¹?" => "m",
"Å?" => "o",
"<EFBFBD>?" => "m",
"<EFBFBD>?" => "o",
"ĩ" => "i",
"ù" => "u",
"į" => "i",
@ -700,7 +700,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"È" => "E",
"Ŷ" => "Y",
"Ą" => "A",
"Å?" => "L",
"<EFBFBD>?" => "L",
"Ų" => "U",
"Ů" => "U",
"Ş" => "S",
@ -712,12 +712,12 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"" => "B",
"Å" => "A",
"Ì" => "I",
"Ã?" => "I",
"<EFBFBD>?" => "I",
"" => "D",
"Ť" => "T",
"Ŗ" => "R",
"Ä" => "Ae",
"Ã?" => "I",
"<EFBFBD>?" => "I",
"Ŕ" => "R",
"Ê" => "E",
"Ü" => "Ue",
@ -727,15 +727,15 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"Ń" => "N",
"Ĥ" => "H",
"Ĝ" => "G",
"Ä?" => "D",
"<EFBFBD>?" => "D",
"Ĵ" => "J",
"Ÿ" => "Y",
"Ũ" => "U",
"Ŭ" => "U",
"Ư" => "U",
"Ţ" => "T",
"Ã?" => "Y",
"Å?" => "O",
"<EFBFBD>?" => "Y",
"<EFBFBD>?" => "O",
"Â" => "A",
"Ľ" => "L",
"" => "W",
@ -749,10 +749,10 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
"Ù" => "U",
"Į" => "I",
"Ź" => "Z",
"Ã?" => "A",
"<EFBFBD>?" => "A",
"Û" => "U",
"Þ" => "Th",
"Ã?" => "Dh",
"<EFBFBD>?" => "Dh",
"Æ" => "Ae",
"Ĕ" => "E",
"Œ" => "Oe",
@ -856,7 +856,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function count()
public function count(): int
{
return strlen($this->string);
}
@ -864,7 +864,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function rewind()
public function rewind(): void
{
$this->position = 0;
}
@ -872,7 +872,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function valid()
public function valid(): bool
{
return $this->position < $this->count();
}
@ -880,7 +880,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function key()
public function key(): mixed
{
return $this->position;
}
@ -888,15 +888,15 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function current()
public function current(): mixed
{
return new TeamSpeak3_Helper_Char($this->string{$this->position});
return new TeamSpeak3_Helper_Char($this->string[$this->position]);
}
/**
* @ignore
*/
public function next()
public function next(): void
{
$this->position++;
}
@ -904,7 +904,7 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function offsetExists($offset)
public function offsetExists(mixed $offset) : bool
{
return ($offset < strlen($this->string)) ? TRUE : FALSE;
}
@ -912,25 +912,25 @@ class TeamSpeak3_Helper_String implements ArrayAccess, Iterator, Countable
/**
* @ignore
*/
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
return ($this->offsetExists($offset)) ? new TeamSpeak3_Helper_Char($this->string{$offset}) : null;
return ($this->offsetExists($offset)) ? new TeamSpeak3_Helper_Char($this->string[$offset]) : null;
}
/**
* @ignore
*/
public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
if(!$this->offsetExists($offset)) return;
$this->string{$offset} = strval($value);
$this->string[$offset] = strval($value);
}
/**
* @ignore
*/
public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
if(!$this->offsetExists($offset)) return;

View File

@ -473,7 +473,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function count()
public function count(): int
{
$this->verifyNodeList();
@ -483,7 +483,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function current()
public function current(): mixed
{
$this->verifyNodeList();
@ -493,7 +493,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function getChildren()
public function getChildren(): ?RecursiveIterator
{
$this->verifyNodeList();
@ -503,7 +503,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function hasChildren()
public function hasChildren(): bool
{
$this->verifyNodeList();
@ -523,7 +523,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function key()
public function key(): mixed
{
$this->verifyNodeList();
@ -533,7 +533,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function valid()
public function valid(): bool
{
$this->verifyNodeList();
@ -543,27 +543,29 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function next()
public function next(): void
{
$this->verifyNodeList();
return next($this->nodeList);
//return next($this->nodeList);
next($this->nodeList);
}
/**
* @ignore
*/
public function rewind()
public function rewind(): void
{
$this->verifyNodeList();
return reset($this->nodeList);
//return reset($this->nodeList);
reset($this->nodeList);
}
/**
* @ignore
*/
public function offsetExists($offset)
public function offsetExists(mixed $offset): bool
{
return array_key_exists((string) $offset, $this->nodeInfo) ? TRUE : FALSE;
}
@ -571,7 +573,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function offsetGet($offset)
public function offsetGet(mixed $offset): mixed
{
if(!$this->offsetExists($offset))
{
@ -589,11 +591,12 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function offsetSet($offset, $value)
public function offsetSet(mixed $offset, mixed $value): void
{
if(method_exists($this, "modify"))
{
return $this->modify(array((string) $offset => $value));
//return $this->modify(array((string) $offset => $value));
$this->modify(array((string) $offset => $value));
}
throw new TeamSpeak3_Node_Exception("node '" . get_class($this) . "' is read only");
@ -602,7 +605,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/**
* @ignore
*/
public function offsetUnset($offset)
public function offsetUnset(mixed $offset): void
{
unset($this->nodeInfo[(string) $offset]);
}

View File

@ -554,7 +554,7 @@ class TeamSpeak3_Node_Host extends TeamSpeak3_Node_Abstract
$permtree[$val]["permcatid"] = $val;
$permtree[$val]["permcathex"] = "0x" . dechex($val);
$permtree[$val]["permcatname"] = TeamSpeak3_Helper_String::factory(TeamSpeak3_Helper_Convert::permissionCategory($val));
$permtree[$val]["permcatparent"] = $permtree[$val]["permcathex"]{3} == 0 ? 0 : hexdec($permtree[$val]["permcathex"]{2} . 0);
$permtree[$val]["permcatparent"] = $permtree[$val]["permcathex"][3] == 0 ? 0 : hexdec($permtree[$val]["permcathex"][2] . 0);
$permtree[$val]["permcatchilren"] = 0;
$permtree[$val]["permcatcount"] = 0;

View File

@ -1976,7 +1976,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
*
* @deprecated
*/
public function tokenCreate($type = TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2 = 0, $description = null, $customset = null)
public function tokenCreate($type = TeamSpeak3::TOKEN_SERVERGROUP, $id1 = 0, $id2 = 0, $description = null, $customset = null)
{
return $this->privilegeKeyCreate($type, $id1, $id2, $description, $customset);
}
@ -1991,7 +1991,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
* @param string $customset
* @return TeamSpeak3_Helper_String
*/
public function privilegeKeyCreate($type = TeamSpeak3::TOKEN_SERVERGROUP, $id1, $id2 = 0, $description = null, $customset = null)
public function privilegeKeyCreate($type = TeamSpeak3::TOKEN_SERVERGROUP, $id1 = 0, $id2 = 0, $description = null, $customset = null)
{
$token = $this->execute("privilegekeyadd", array("tokentype" => $type, "tokenid1" => $id1, "tokenid2" => $id2, "tokendescription" => $description, "tokencustomset" => $customset))->toList();
@ -2269,7 +2269,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
{
$this->getParent()->serverDelete($this->getId());
unset($this);
// unset($this);
}
/**

View File

@ -5,7 +5,6 @@ class lib_ts3 extends \LIB\lib_php{
return self::class;}
public static function php_autoload(){
require_once dirname(__FILE__).'/lib/libraries/TeamSpeak3/TeamSpeak3.php';
//\TeamSpeak3::autoload('abc');
\SYSTEM\autoload::registerFunc('TeamSpeak3::autoload');
return true;}
public static function version(){