<?php
class audioUrlDecode
{
public $strUrl = "";
private $characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN0PQRSTUVWXYZO123456789+/=";
private $charCod = array();
public function __construct()
{
$this->config = include_once('config.php');
}
public function getUrlFile($strUrl = "")
{
if (empty($strUrl))
return false;
$this->strUrl = $strUrl;
return $this->decode();
}
private function decode()
{
if ((bool)mb_strpos($this->strUrl, 'audio_api_unavailable') === true) {
$t = explode('?extra=', $this->strUrl);
$n = "";
if (isset($t[1])) {
array_shift($t);
$t = explode('#', $t[0]);
$n = ($n === $t[1]) ? "" : $this->oDecode($t[1]);
}
$t = $this->oDecode($t[0]);
if (!is_string($n) || !$t) {
return $this->strUrl;
}
$n = (!empty($n)) ? explode(chr(9), $n) : [];
for ($r, $s, $l = count($n); $l--;) {
$s = explode(chr(11), $n[$l]);
$r = array_splice($s, 0, 1, $t)[0];
if (!method_exists($this, $r))
return $this->strUrl;
$t = call_user_func_array([$this, $r], $s);
}
if ($t && "http" === mb_substr($t, 0, 4))
return $t;
}
return $this->strUrl;
}
private function oDecode($e)
{
$count = mb_strlen($e);
if (!$e || $count % 4 == 1)
return false;
for ($t, $i, $a = 0, $r = 0, $o = ""; $i = $e[$r++], $r <= $count;) {
$i = mb_strpos($this->characters, $i);
if (!is_bool($i) && ~$i) {
$t = $a % 4 ? 64 * $t + $i : $i;
if ($a++ % 4)
$o .= chr(255 & $t >> (-2 * $a & 6));
}
if ($r == $count)
break;
}
return $o;
}
private function v($e)
{
if (is_array($e))
$e = implode('', $e);
return strrev($e);
}
private function r($e, $t)
{
for ($i, $a = $this->characters . $this->characters, $o = mb_strlen($e); $o--;) {
$i = mb_strpos($a, $e[$o]);
if (!is_bool($i) && ~$i)
$e[$o] = mb_substr($a, $i - $t, 1);
}
return $e;
}
private function x($e, $t)
{
$n = [];
$t = ord($t);
$this->_each($e, function ($e, $i) use (&$n, $t) {
$n[] = chr(ord($i) ^ $t);
});
return implode("", $n);
}
private function _each($e, $t)
{
if (!$e)
return $e;
for ($i = 0, $a = mb_strlen($e); $a > $i && call_user_func($t, $i, $e[$i], $i) !== !1; $i++) {
}
return $e;
}
private function i($e, $t)
{
return $this->s($e, $t ^ (int)$this->config['id']);
}
private function s($e, $t)
{
$n = mb_strlen($e);
if ($n > 0) {
$i = $this->sNum($e, $t);
$a = 0;
for ($e = str_split($e); ++$a < $n;)
$e[$a] = @array_splice($e, $i[($n - 1 - $a)], 1, $e[$a])[0];
}
if (is_array($e))
return implode('', $e);
return $e;
}
private function sNum($e, $t)
{
$n = mb_strlen($e);
$i = [];
if ($n > 0) {
$a = $n;
for ($t = abs($t); $a--;) {
$t = ($n * ($a + 1) ^ $t + $a) % $n;
if ($t)
$i[$a] = $t;
}
}
return $i;
}
}
?>