This commit is contained in:
Marco Antonio Nina Mena
2017-11-27 12:00:58 -04:00
parent 9cff70c5b3
commit 7891836488
2 changed files with 11 additions and 16 deletions

View File

@@ -416,15 +416,13 @@ class G
}
$result = base64_encode($result);
$search = ['/', '='];
$replace = ['°', ''];
$search = ['/' => '°', '=' => ''];
if ($urlSafe) {
$search[] = '+';
$replace[] = '_';
$search['+'] = '-';
}
return str_replace($search, $replace, $result);
return strtr($result, $search);
}
/**
@@ -441,18 +439,15 @@ class G
public static function decrypt($string, $key, $urlSafe = false)
{
$result = '';
$search = ['°'];
$replace = ['/'];
$search = ['°' => '/'];
if ($urlSafe) {
$search[] = '_';
$replace[] = '+';
$search['-'] = '+';
}
$string = str_replace($search, $replace, $string);
$string_jhl = explode("?", $string);
$string = base64_decode($string);
$string = base64_decode($string_jhl[0]);
$string = strtr($string, $search);
$complement = explode('?', $string);
$string = base64_decode($complement[0]);
for ($i = 0; $i < strlen($string); $i++) {
$char = substr($string, $i, 1);
@@ -460,8 +455,8 @@ class G
$char = chr(ord($char) - ord($keychar));
$result .= $char;
}
if (!empty($string_jhl[1])) {
$result .= '?' . $string_jhl[1];
if (!empty($complement[1])) {
$result .= '?' . $complement[1];
}
return $result;
}

View File

@@ -31,7 +31,7 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY, true);
$_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY, true);
$_REQUEST['FIELD'] = G::decrypt(rawurldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY, true);
$_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY, true);
$_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY, true);
$_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY, true);