Support the usage of non-base64-compatible characters by URL encoding "expr"

This commit is contained in:
Bofh 2022-12-18 01:35:13 +01:00
parent 2a1c28e041
commit 7a011ffde0
2 changed files with 7 additions and 6 deletions

View File

@ -157,7 +157,7 @@ if (filedb_exists('cache', $susp_file))
if (isset($_GET['profile']) && trim($_GET['profile']) != '')
{
$q = trim($_GET['profile']);
$q = base64_decode($q);
$q = urldecode(base64_decode($q));
$qt = null;
if ($q === '<empty>') {
$q = '';

View File

@ -186,7 +186,7 @@ window.view.instance = {
profile = '<empty>';
else if (prof_stype === 'expr')
profile = 'expr: '+profile;
data.profile = btoa(profile);
data.profile = btoa(encodeURIComponent(profile));
var instances = E.element('#filters-current textarea[name=instances]').value.trim();
if (instances !== '') {
data.instances = instances;
@ -238,7 +238,7 @@ window.view.instance = {
d.user_filter = 'remote';
E.element('#filters-current input[name=user_filter][value='+d.user_filter+']').click();
if (d.profile === undefined) d.profile = '';
d.profile = atob(d.profile);
d.profile = decodeURIComponent(atob(d.profile));
if (d.profile === '<empty>')
E.element('#filters-current #profile-search-type-empty').click();
else if (d.profile.startsWith('expr:')) {
@ -340,6 +340,7 @@ window.view.instance = {
if (js.error !== undefined) return toast.error(js.error);
const filter = window.view.instance.do.filter_users.get_current_filter();
if (filter === undefined) return;
const filter_profile = decodeURIComponent(atob(filter.profile));
E.template('users-all', function(TPL) {
var html = '';
for (var i = 0; i < js['data'].length; i++) {
@ -367,9 +368,9 @@ window.view.instance = {
for (var j = 0; j < it.fields.length; j++) {
var t = '<tr class="{verified}"><td>{name}</td><td>{value}</td>{verifiedColumn}</tr>';
t = t.replaceAll('{name}', window.view.instance.html_add_search_spans(
html2text(it.fields[j].name), atob(filter.profile)));
html2text(it.fields[j].name), filter_profile));
t = t.replaceAll('{value}', window.view.instance.html_add_search_spans(
html2text(it.fields[j].value), atob(filter.profile)));
html2text(it.fields[j].value), filter_profile));
t = t.replaceAll('{verified}', it.fields[j].verified_at !== undefined ? 'verified' : '');
t = t.replaceAll('{verifiedColumn}', it.fields[j].verified_at !== undefined ?
'<td title="verified"><i class="fa fa-check fa-fw"></i></td>' : '');
@ -382,7 +383,7 @@ window.view.instance = {
tpl = tpl.replaceAll('{accountAdminLink}', 'javascript:void(0)');
tpl = tpl.replaceAll('{note}', it.note.trim() === '' ?
'&lt;empty&gt;' : window.view.instance.html_add_search_spans(
html2text(it.note), atob(filter.profile)));
html2text(it.note), filter_profile));
html += tpl;
}
return html;