"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() public function toUnicode()
{ {
$h = ord($this->char{0}); $h = ord($this->char[0]);
if($h <= 0x7F) if($h <= 0x7F)
{ {
@ -194,15 +194,15 @@ class TeamSpeak3_Helper_Char
} }
else if($h <= 0xDF) 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) 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) 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 else
{ {

View File

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

View File

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

View File

@ -473,7 +473,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function count() public function count(): int
{ {
$this->verifyNodeList(); $this->verifyNodeList();
@ -483,7 +483,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function current() public function current(): mixed
{ {
$this->verifyNodeList(); $this->verifyNodeList();
@ -493,7 +493,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function getChildren() public function getChildren(): ?RecursiveIterator
{ {
$this->verifyNodeList(); $this->verifyNodeList();
@ -503,7 +503,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function hasChildren() public function hasChildren(): bool
{ {
$this->verifyNodeList(); $this->verifyNodeList();
@ -523,7 +523,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function key() public function key(): mixed
{ {
$this->verifyNodeList(); $this->verifyNodeList();
@ -533,7 +533,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function valid() public function valid(): bool
{ {
$this->verifyNodeList(); $this->verifyNodeList();
@ -543,27 +543,29 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function next() public function next(): void
{ {
$this->verifyNodeList(); $this->verifyNodeList();
return next($this->nodeList); //return next($this->nodeList);
next($this->nodeList);
} }
/** /**
* @ignore * @ignore
*/ */
public function rewind() public function rewind(): void
{ {
$this->verifyNodeList(); $this->verifyNodeList();
return reset($this->nodeList); //return reset($this->nodeList);
reset($this->nodeList);
} }
/** /**
* @ignore * @ignore
*/ */
public function offsetExists($offset) public function offsetExists(mixed $offset): bool
{ {
return array_key_exists((string) $offset, $this->nodeInfo) ? TRUE : FALSE; return array_key_exists((string) $offset, $this->nodeInfo) ? TRUE : FALSE;
} }
@ -571,7 +573,7 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function offsetGet($offset) public function offsetGet(mixed $offset): mixed
{ {
if(!$this->offsetExists($offset)) if(!$this->offsetExists($offset))
{ {
@ -589,11 +591,12 @@ abstract class TeamSpeak3_Node_Abstract implements RecursiveIterator, ArrayAcces
/** /**
* @ignore * @ignore
*/ */
public function offsetSet($offset, $value) public function offsetSet(mixed $offset, mixed $value): void
{ {
if(method_exists($this, "modify")) 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"); 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 * @ignore
*/ */
public function offsetUnset($offset) public function offsetUnset(mixed $offset): void
{ {
unset($this->nodeInfo[(string) $offset]); 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]["permcatid"] = $val;
$permtree[$val]["permcathex"] = "0x" . dechex($val); $permtree[$val]["permcathex"] = "0x" . dechex($val);
$permtree[$val]["permcatname"] = TeamSpeak3_Helper_String::factory(TeamSpeak3_Helper_Convert::permissionCategory($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]["permcatchilren"] = 0;
$permtree[$val]["permcatcount"] = 0; $permtree[$val]["permcatcount"] = 0;

View File

@ -1976,7 +1976,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
* *
* @deprecated * @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); return $this->privilegeKeyCreate($type, $id1, $id2, $description, $customset);
} }
@ -1991,7 +1991,7 @@ class TeamSpeak3_Node_Server extends TeamSpeak3_Node_Abstract
* @param string $customset * @param string $customset
* @return TeamSpeak3_Helper_String * @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(); $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()); $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;} return self::class;}
public static function php_autoload(){ public static function php_autoload(){
require_once dirname(__FILE__).'/lib/libraries/TeamSpeak3/TeamSpeak3.php'; require_once dirname(__FILE__).'/lib/libraries/TeamSpeak3/TeamSpeak3.php';
//\TeamSpeak3::autoload('abc');
\SYSTEM\autoload::registerFunc('TeamSpeak3::autoload'); \SYSTEM\autoload::registerFunc('TeamSpeak3::autoload');
return true;} return true;}
public static function version(){ public static function version(){