29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-25 14:53:01 +00:00

[4.0] JS files are full of XSS (#34472)

This commit is contained in:
Dimitris Grammatikogiannis 2021-06-14 00:47:05 +02:00 committed by GitHub
parent 451dd59df8
commit da4ced6b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 488 additions and 508 deletions

View File

@ -61,7 +61,7 @@ class FiltersField extends FormField
while(child.length !== 0) {
if(child.children("option:selected").val() !== "NONE") {
alert(Joomla.JText._("COM_CONFIG_TEXT_FILTERS_NOTE"));
alert(Joomla.Text._("COM_CONFIG_TEXT_FILTERS_NOTE"));
break;
}
@ -75,7 +75,7 @@ class FiltersField extends FormField
while(parent.length !== 0) {
if(parent.children("option:selected").val() === "NONE") {
alert(Joomla.JText._("COM_CONFIG_TEXT_FILTERS_NOTE"));
alert(Joomla.Text._("COM_CONFIG_TEXT_FILTERS_NOTE"));
break;
}

View File

@ -36,7 +36,7 @@ class Notifications {
}
Joomla.renderMessages(
{
[options.type]: [Joomla.JText._(message)],
[options.type]: [Joomla.Text._(message)],
},
undefined,
true,

View File

@ -4,7 +4,7 @@
const Translate = {
// Translate from Joomla text
translate: (key) => Joomla.JText._(key, key),
translate: (key) => Joomla.Text._(key, key),
sprintf: (string, ...args) => {
// eslint-disable-next-line no-param-reassign
string = Translate.translate(string);

View File

@ -5,7 +5,7 @@
Joomla.submitbutton = (pressbutton) => {
if (pressbutton === 'associations.purge') {
// eslint-disable-next-line no-restricted-globals
if (confirm(Joomla.JText._('COM_ASSOCIATIONS_PURGE_CONFIRM_PROMPT'))) {
if (confirm(Joomla.Text._('COM_ASSOCIATIONS_PURGE_CONFIRM_PROMPT'))) {
Joomla.submitform(pressbutton);
} else {
return false;

View File

@ -30,7 +30,7 @@ Joomla = window.Joomla || {};
if (associations) {
const html = document.createElement('joomla-alert');
html.innerHTML = Joomla.JText._('JGLOBAL_ASSOC_NOT_POSSIBLE');
html.innerText = Joomla.Text._('JGLOBAL_ASSOC_NOT_POSSIBLE');
associations.insertAdjacentElement('afterbegin', html);
}
@ -78,7 +78,7 @@ Joomla = window.Joomla || {};
Joomla.renderMessages({ notice: [result.message] });
}
} else {
Joomla.renderMessages({ warning: [(Joomla.JText._('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED'))] });
Joomla.renderMessages({ warning: [(Joomla.Text._('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED'))] });
}
};
@ -134,7 +134,7 @@ Joomla = window.Joomla || {};
Joomla.injectAssociations(JSON.parse(response), callbackFunctionPrefix);
},
onError: () => {
Joomla.renderMessages({ warning: [(Joomla.JText._('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED'))] });
Joomla.renderMessages({ warning: [(Joomla.Text._('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED'))] });
},
});
@ -191,7 +191,7 @@ Joomla = window.Joomla || {};
// If associations existed, send a warning to the user
if (existsAssociations) {
Joomla.renderMessages({ warning: [Joomla.JText._('JGLOBAL_ASSOCIATIONS_RESET_WARNING')] });
Joomla.renderMessages({ warning: [Joomla.Text._('JGLOBAL_ASSOCIATIONS_RESET_WARNING')] });
}
// If the selected language is All hide the fields and add a message

View File

@ -218,13 +218,13 @@ jQuery(document).ready(function($) {
// If we are creating a new association (before save) we need to add the new association.
if (targetLoadedId == '0')
{
document.getElementById('select-change-text').innerHTML = document.getElementById('select-change').getAttribute('data-select');
document.getElementById('select-change-text').innerHTML = Joomla.sanitizeHtml(document.getElementById('select-change').getAttribute('data-select'));
}
// If we are editing an association.
else
{
// Show change language button
document.getElementById('select-change-text').innerHTML = document.getElementById('select-change').getAttribute('data-change');
document.getElementById('select-change-text').innerHTML = Joomla.sanitizeHtml(document.getElementById('select-change').getAttribute('data-change'));
$('#remove-assoc').removeClass("hidden");
$('#toolbar-copy').hide();

View File

@ -8,7 +8,7 @@
// This method is used to decode HTML entities
const decodeHtml = (html) => {
const textarea = document.createElement('textarea');
textarea.innerHTML = html;
textarea.innerHTML = Joomla.sanitizeHtml(html);
return textarea.value;
};

View File

@ -5,7 +5,7 @@
((document, Joomla) => {
'use strict';
if (!Joomla || typeof Joomla.JText._ !== 'function') {
if (!Joomla || typeof Joomla.Text._ !== 'function') {
throw new Error('core.js was not properly initialised');
}
@ -20,7 +20,7 @@
}
} else {
// @todo use the CE Modal here
alert(Joomla.JText._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE'));
alert(Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE'));
}
return false;
});
@ -36,7 +36,7 @@
}
} else {
// @todo use the CE Modal here
alert(Joomla.JText._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE'));
alert(Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_ONE'));
}
return false;
});
@ -46,7 +46,7 @@
const ids = document.querySelectorAll('input[id*="cb"]:checked');
if (ids.length === 0) {
// @todo use the CE Modal here
alert(Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'));
alert(Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST'));
} else if (ids.length === 2) {
// Add version item ids to URL
const url = `${document.getElementById('toolbar-compare').childNodes[1].getAttribute('data-url')}&id1=${ids[0].value}&id2=${ids[1].value}`;
@ -55,7 +55,7 @@
}
} else {
// @todo use the CE Modal here
alert(Joomla.JText._('COM_CONTENTHISTORY_BUTTON_SELECT_TWO'));
alert(Joomla.Text._('COM_CONTENTHISTORY_BUTTON_SELECT_TWO'));
}
return false;
});

View File

@ -31,12 +31,12 @@ const debounce = (callback, time = 250, interval) => (...args) => clearTimeout(i
wrapper.parentNode.removeChild(wrapper);
Joomla.renderMessages({
message: [Joomla.JText._('COM_CPANEL_UNPUBLISH_MODULE_SUCCESS')],
message: [Joomla.Text._('COM_CPANEL_UNPUBLISH_MODULE_SUCCESS')],
});
},
onError: () => {
Joomla.renderMessages({
error: [Joomla.JText._('COM_CPANEL_UNPUBLISH_MODULE_ERROR')],
error: [Joomla.Text._('COM_CPANEL_UNPUBLISH_MODULE_ERROR')],
});
},
});

View File

@ -39,7 +39,7 @@
elem.classList.add('float-end');
elem.classList.add('badge');
elem.classList.add('bg-warning', 'text-dark');
elem.innerHTML = response.data;
elem.innerHTML = Joomla.sanitizeHtml(response.data);
element.parentNode.replaceChild(elem, element);
} else {

View File

@ -11,7 +11,7 @@
const onBoot = () => {
Joomla.submitbutton = (pressbutton) => {
if (pressbutton === 'filters.delete' && !window.confirm(Joomla.JText._('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'))) {
if (pressbutton === 'filters.delete' && !window.confirm(Joomla.Text._('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'))) {
return false;
}
Joomla.submitform(pressbutton);

View File

@ -42,12 +42,12 @@ Joomla = window.Joomla || {};
event.preventDefault();
let elements;
if (event.target.innerText === Joomla.JText._('COM_FINDER_FILTER_SHOW_ALL')) {
event.target.innerText = Joomla.JText._('COM_FINDER_FILTER_HIDE_ALL');
if (event.target.innerText === Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL')) {
event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_HIDE_ALL');
elements = [].slice.call(document.querySelectorAll('.accordion-button.collapsed'));
} else {
event.target.innerText = Joomla.JText._('COM_FINDER_FILTER_SHOW_ALL');
event.target.innerText = Joomla.Text._('COM_FINDER_FILTER_SHOW_ALL');
elements = [].slice.call(document.querySelectorAll('.accordion-button:not(.collapsed)'));
}

View File

@ -11,11 +11,11 @@ Joomla = window.Joomla || {};
document.addEventListener('DOMContentLoaded', () => {
Joomla.submitbutton = (pressbutton) => {
// TODO replace with joomla-alert
if (pressbutton === 'index.purge' && !window.confirm(Joomla.JText._('COM_FINDER_INDEX_CONFIRM_PURGE_PROMPT'))) {
if (pressbutton === 'index.purge' && !window.confirm(Joomla.Text._('COM_FINDER_INDEX_CONFIRM_PURGE_PROMPT'))) {
return false;
}
// TODO replace with joomla-alert
if (pressbutton === 'index.delete' && !window.confirm(Joomla.JText._('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'))) {
if (pressbutton === 'index.delete' && !window.confirm(Joomla.Text._('COM_FINDER_INDEX_CONFIRM_DELETE_PROMPT'))) {
return false;
}
Joomla.submitform(pressbutton);

View File

@ -39,7 +39,7 @@
}
if (progressMessage) {
progressMessage.innerHTML = message;
progressMessage.innerHTML = Joomla.sanitizeHtml(message);
}
if (progressBar) {
@ -90,7 +90,7 @@
updateProgress(json.header, json.message);
if (document.getElementById('finder-debug-data')) {
Object.entries(json.pluginState).forEach((context) => {
document.getElementById(`finder-${context[0].replace(/\s+/g, '-').toLowerCase()}`).innerHTML = `${json.pluginState[context[0]].offset} of ${json.pluginState[context[0]].total}`;
document.getElementById(`finder-${context[0].replace(/\s+/g, '-').toLowerCase()}`).innerHTML = Joomla.sanitizeHtml(`${json.pluginState[context[0]].offset} of ${json.pluginState[context[0]].total}`);
});
}
if (offset < totalItems) {
@ -108,21 +108,21 @@
progressHeader.classList.add('finder-error');
}
if (progressMessage) {
progressMessage.innerHTML = json.message;
progressMessage.innerHTML = Joomla.sanitizeHtml(json.message);
progressMessage.classList.add('finder-error');
}
}
} catch (ignore) {
if (error === '') {
// eslint-disable-next-line no-ex-assign
error = Joomla.JText._('COM_FINDER_NO_ERROR_RETURNED');
error = Joomla.Text._('COM_FINDER_NO_ERROR_RETURNED');
}
if (progressHeader) {
progressHeader.innerText = Joomla.JText._('COM_FINDER_AN_ERROR_HAS_OCCURRED');
progressHeader.innerText = Joomla.Text._('COM_FINDER_AN_ERROR_HAS_OCCURRED');
progressHeader.classList.add('finder-error');
}
if (progressMessage) {
progressMessage.innerHTML = error;
progressMessage.innerHTML = Joomla.sanitizeHtml(error);
progressMessage.classList.add('finder-error');
}
}
@ -139,15 +139,15 @@
removeElement('progress');
const header = data ? data.header : Joomla.JText._('COM_FINDER_AN_ERROR_HAS_OCCURRED');
const message = data ? data.message : `${Joomla.JText._('COM_FINDER_MESSAGE_RETURNED')}<br>${data}`;
const header = data ? data.header : Joomla.Text._('COM_FINDER_AN_ERROR_HAS_OCCURRED');
const message = data ? data.message : `${Joomla.Text._('COM_FINDER_MESSAGE_RETURNED')}<br>${data}`;
if (progressHeader) {
progressHeader.innerText = header;
progressHeader.classList.add('finder-error');
}
if (progressMessage) {
progressMessage.innerHTML = message;
progressMessage.innerHTML = Joomla.sanitizeHtml(message);
progressMessage.classList.add('finder-error');
}
};

View File

@ -11,7 +11,7 @@ Joomla = window.Joomla || {};
document.addEventListener('DOMContentLoaded', () => {
Joomla.submitbutton = (pressbutton) => {
// TODO replace with joomla-alert
if (pressbutton === 'map.delete' && !window.confirm(Joomla.JText._('COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT'))) {
if (pressbutton === 'map.delete' && !window.confirm(Joomla.Text._('COM_FINDER_MAPS_CONFIRM_DELETE_PROMPT'))) {
return false;
}
Joomla.submitform(pressbutton);

View File

@ -45,10 +45,10 @@ Joomla = window.Joomla || {};
} catch (exception) {
message = exception;
}
modal.innerHTML = message;
modal.innerHTML = Joomla.sanitizeHtml(message);
},
onError: function onError(xhr) {
modal.innerHTML = xhr.statusText;
modal.innerHTML = Joomla.sanitizeHtml(xhr.statusText);
},
});
};

View File

@ -13,9 +13,9 @@ Joomla = window.Joomla || {};
// do field validation
if (form.install_package.value === '') {
alert(Joomla.JText._('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE'), true);
alert(Joomla.Text._('COM_INSTALLER_MSG_INSTALL_PLEASE_SELECT_A_PACKAGE'), true);
} else if (form.install_package.files[0].size > form.max_upload_size.value) {
alert(Joomla.JText._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG'), true);
alert(Joomla.Text._('COM_INSTALLER_MSG_WARNINGS_UPLOADFILETOOBIG'), true);
} else {
form.submit();
}
@ -33,7 +33,7 @@ Joomla = window.Joomla || {};
warningElement.classList.add('hidden');
} else if (fileSize) {
fileSizeElement.classList.remove('hidden');
fileSizeElement.innerHTML = Joomla.JText._('JGLOBAL_SELECTED_UPLOAD_FILE_SIZE').replace('%s', `${fileSizeMB.toFixed(2)} MB`);
fileSizeElement.innerHTML = Joomla.sanitizeHtml(Joomla.Text._('JGLOBAL_SELECTED_UPLOAD_FILE_SIZE').replace('%s', `${fileSizeMB.toFixed(2)} MB`));
if (fileSize > form.max_upload_size.value) {
warningElement.classList.remove('hidden');
@ -103,13 +103,13 @@ Joomla = window.Joomla || {};
const settingsfieldset = el.closest('fieldset');
if (toggle.target.dataset.state === 'closed') {
toggle.target.dataset.state = 'open';
toggle.target.innerHTML = Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_LESS_COMPATIBILITY_INFORMATION');
toggle.target.innerHTML = Joomla.sanitizeHtml(Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_LESS_COMPATIBILITY_INFORMATION'));
settingsfieldset.querySelectorAll('.settingsInfo').forEach((fieldset) => {
fieldset.classList.remove('hidden');
});
} else {
toggle.target.dataset.state = 'closed';
toggle.target.innerHTML = Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_MORE_COMPATIBILITY_INFORMATION');
toggle.target.innerHTML = Joomla.sanitizeHtml(Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_MORE_COMPATIBILITY_INFORMATION'));
settingsfieldset.querySelectorAll('.settingsInfo').forEach((fieldset) => {
fieldset.classList.add('hidden');
});
@ -148,7 +148,7 @@ Joomla = window.Joomla || {};
const preUpdateCheckbox = document.getElementById('preupdatecheckbox').checked;
const nonCorePluginCheckbox = document.getElementById('noncoreplugins').checked;
if (preUpdateCheckbox && nonCorePluginCheckbox) {
if (window.confirm(Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE'))) {
if (window.confirm(Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE'))) {
[].slice.call(document.querySelectorAll('button.submitupdate')).forEach((el) => {
el.classList.remove('disabled');
el.removeAttribute('disabled');
@ -198,7 +198,7 @@ Joomla = window.Joomla || {};
if (el.dataset.state === 'closed') {
el.dataset.state = 'open';
el.innerHTML = Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_LESS_COMPATIBILITY_INFORMATION');
el.innerHTML = Joomla.sanitizeHtml(Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_LESS_COMPATIBILITY_INFORMATION'));
[].slice.call(compatibilitytypes.querySelectorAll('.exname')).forEach((extension) => {
extension.classList.remove('col-md-8');
@ -234,7 +234,7 @@ Joomla = window.Joomla || {};
}
} else {
el.dataset.state = 'closed';
el.innerHTML = Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_MORE_COMPATIBILITY_INFORMATION');
el.innerHTML = Joomla.sanitizeHtml(Joomla.getOptions('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_SHOW_MORE_COMPATIBILITY_INFORMATION'));
[].slice.call(compatibilitytypes.querySelectorAll('.exname')).forEach((extension) => {
extension.classList.add('col-md-8');
@ -333,7 +333,7 @@ Joomla = window.Joomla || {};
// Process Target Version Extension Compatibility
if (extensionData.serverError) {
// An error occurred -> show unknown error note
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_SERVER_ERROR');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_SERVER_ERROR');
// Force result into group 4 = Pre update checks failed
extensionData.compatibilityData = {
resultGroup: 4,
@ -349,54 +349,54 @@ Joomla = window.Joomla || {};
} else {
// eslint-disable-next-line max-len
html = extensionData.compatibilityData.upgradeCompatibilityStatus.compatibleVersion === false
? Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION')
? Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION')
: extensionData.compatibilityData.upgradeCompatibilityStatus.compatibleVersion;
}
break;
case PreUpdateChecker.STATE.INCOMPATIBLE:
// No compatible version found -> display error label
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
PreUpdateChecker.showorangewarning = true;
break;
case PreUpdateChecker.STATE.MISSING_COMPATIBILITY_TAG:
// Could not check compatibility state -> display warning
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
PreUpdateChecker.showorangewarning = true;
break;
default:
// An error occurred -> show unknown error note
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN');
}
}
// Insert the generated html
extensionData.element.innerHTML = html;
extensionData.element.innerHTML = Joomla.sanitizeHtml(html);
// Process Current Version Extension Compatibility
html = '';
if (extensionData.serverError) {
// An error occurred -> show unknown error note
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_SERVER_ERROR');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_SERVER_ERROR');
} else {
// Switch the compatibility state
switch (extensionData.compatibilityData.currentCompatibilityStatus.state) {
case PreUpdateChecker.STATE.COMPATIBLE:
// eslint-disable-next-line max-len
html = extensionData.compatibilityData.currentCompatibilityStatus.compatibleVersion === false
? Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION')
? Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION')
: extensionData.compatibilityData.currentCompatibilityStatus.compatibleVersion;
break;
case PreUpdateChecker.STATE.INCOMPATIBLE:
// No compatible version found -> display error label
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
break;
case PreUpdateChecker.STATE.MISSING_COMPATIBILITY_TAG:
// Could not check compatibility state -> display warning
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
break;
default:
// An error occurred -> show unknown error note
html = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN');
html = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN');
}
}
// Insert the generated html
@ -442,19 +442,19 @@ Joomla = window.Joomla || {};
const tableRow = problemPluginRow.closest('tr');
tableRow.classList.add('error');
const pluginTitleTableCell = tableRow.querySelector('td:first-child');
pluginTitleTableCell.innerHTML = `${pluginTitleTableCell.innerHTML}
pluginTitleTableCell.innerHTML = Joomla.sanitizeHtml(`${pluginTitleTableCell.innerHTML}
<span class="label label-warning " >
<span class="icon-warning"></span>
${Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN')}
${Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN')}
</span>
<span class="label label-important hasPopover"
title="${Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN')} "
data-bs-content="${Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_DESC')} "
title="${Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN')} "
data-bs-content="${Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_DESC')} "
>
<span class="icon-help"></span>
${Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_HELP')}
</span>`;
${Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_HELP')}
</span>`);
const popoverElement = pluginTitleTableCell.querySelector('.hasPopover');
if (popoverElement) {
popoverElement.style.cursor = 'pointer';
@ -486,7 +486,7 @@ Joomla = window.Joomla || {};
document.getElementById('preupdateCheckCompleteProblems').classList.remove('hidden');
[].slice.call(document.querySelectorAll('#preupdateconfirmation .preupdateconfirmation_label h3')).forEach((el) => {
el.innerText = Joomla.JText._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_LIST');
el.innerText = Joomla.Text._('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_LIST');
});
[].slice.call(document.querySelectorAll('#preupdateconfirmation .preupdateconfirmation_label')).forEach((el) => {

View File

@ -48,7 +48,7 @@
this.states.refreshing = false;
},
onError: () => {
alert(Joomla.JText._('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'));
alert(Joomla.Text._('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'));
this.refreshStatus.classList.remove('show');
},
});
@ -144,7 +144,7 @@
this.spinner.classList.remove('show');
},
onError: () => {
alert(Joomla.JText._('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'));
alert(Joomla.Text._('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'));
this.moreResultsButton.disabled = true;
this.moreResults.classList.remove('show');
this.resultsContainer.classList.remove('show');
@ -187,12 +187,12 @@
key.setAttribute('id', `override_key${this.states.counter}${index}`);
key.setAttribute('title', item.file);
key.classList.add('result-key');
key.innerHTML = item.constant;
key.innerHTML = Joomla.sanitizeHtml(item.constant);
const string = document.createElement('div');
string.setAttribute('id', `override_string${this.states.counter}${index}`);
string.classList.add('result-string');
string.innerHTML = item.string;
string.innerHTML = Joomla.sanitizeHtml(item.string);
a.appendChild(key);
a.appendChild(string);
@ -202,7 +202,7 @@
// If there aren't any results display an appropriate message
if (!results.length) {
const noresult = document.createElement('div');
noresult.innerHTML = Joomla.JText._('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
noresult.innerText = Joomla.Text._('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
resultsDiv.appendChild(noresult);
}

View File

@ -39,59 +39,59 @@ Joomla = window.Joomla || {};
}
});
if (updMenus === '-') {
tmpMenu.innerHTML = `<span class="badge bg-danger">${Joomla.JText._('JNO')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-danger">${Joomla.Text._('JNO')}</span>`);
if (!tmpRow.classList.contains('no') || tmpRow.classList.length === 0) { tmpRow.classList.add('no'); }
}
if (parseInt(updMenus, 10) === 0) {
tmpMenu.innerHTML = `<span class="badge bg-info">${Joomla.JText._('JALL')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-info">${Joomla.Text._('JALL')}</span>`);
if (tmpRow.classList.contains('no')) { tmpRow.classList.remove('no'); }
}
if (parseInt(updMenus, 10) > 0) {
if (window.parent.inMenus.indexOf(window.parent.menuId) >= 0) {
if (window.parent.numMenus === window.parent.inMenus.length) {
tmpMenu.innerHTML = `<span class="badge bg-info">${Joomla.JText._('JALL')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-info">${Joomla.Text._('JALL')}</span>`);
if (tmpRow.classList.contains('no') || tmpRow.classList.length === 0) { tmpRow.classList.remove('no'); }
} else {
tmpMenu.innerHTML = `<span class="badge bg-success">${Joomla.JText._('JYES')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-success">${Joomla.Text._('JYES')}</span>`);
if (tmpRow.classList.contains('no')) { tmpRow.classList.remove('no'); }
}
}
if (window.parent.inMenus.indexOf(window.parent.menuId) < 0) {
tmpMenu.innerHTML = `<span class="badge bg-danger">${Joomla.JText._('JNO')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-danger">${Joomla.Text._('JNO')}</span>`);
if (!tmpRow.classList.contains('no')) { tmpRow.classList.add('no'); }
}
}
if (parseInt(updMenus, 10) < 0) {
if (window.parent.inMenus.indexOf(window.parent.menuId) >= 0) {
if (window.parent.numMenus === window.parent.inMenus.length) {
tmpMenu.innerHTML = `<span class="badge bg-info">${Joomla.JText._('JALL')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-info">${Joomla.Text._('JALL')}</span>`);
if (tmpRow.classList.contains('no')) { tmpRow.classList.remove('no'); }
} else {
tmpMenu.innerHTML = `<span class="badge bg-success">${Joomla.JText._('JYES')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-success">${Joomla.Text._('JYES')}</span>`);
if (tmpRow.classList.contains('no')) { tmpRow.classList.remove('no'); }
}
}
if (window.parent.inMenus.indexOf(window.parent.menuId) < 0) {
tmpMenu.innerHTML = `<span class="badge bg-danger">${Joomla.JText._('JNO')}</span>`;
tmpMenu.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-danger">${Joomla.Text._('JNO')}</span>`);
if (!tmpRow.classList.contains('no') || tmpRow.classList.length === 0) { tmpRow.classList.add('no'); }
}
}
if (parseInt(updStatus, 10) === 1) {
tmpStatus.innerHTML = `<span class="badge bg-success">${Joomla.JText._('JYES')}</span>`;
tmpStatus.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-success">${Joomla.Text._('JYES')}</span>`);
if (tmpRow.classList.contains('unpublished')) { tmpRow.classList.remove('unpublished'); }
}
if (parseInt(updStatus, 10) === 0) {
tmpStatus.innerHTML = `<span class="badge bg-danger">${Joomla.JText._('JNO')}</span>`;
tmpStatus.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-danger">${Joomla.Text._('JNO')}</span>`);
if (!tmpRow.classList.contains('unpublished') || tmpRow.classList.length === 0) { tmpRow.classList.add('unpublished'); }
}
if (parseInt(updStatus, 10) === -2) {
tmpStatus.innerHTML = `<span class="badge bg-secondary">${Joomla.JText._('JTRASHED')}</span>`;
tmpStatus.innerHTML = Joomla.sanitizeHtml(`<span class="badge bg-secondary">${Joomla.Text._('JTRASHED')}</span>`);
if (!tmpRow.classList.contains('unpublished') || tmpRow.classList.length === 0) { tmpRow.classList.add('unpublished'); }
}
if (document.formvalidator.isValid(document.getElementById('module-form'))) {
window.parent.document.querySelector(`#title-${options.itemId}`).innerText = updTitle;
window.parent.document.querySelector(`#position-${options.itemId}`).innerText = updPosition;
window.parent.document.querySelector(`#access-${options.itemId}`).innerHTML = window.parent.viewLevels[updAccess];
window.parent.document.querySelector(`#access-${options.itemId}`).innerHTML = Joomla.sanitizeHtml(window.parent.viewLevels[updAccess]);
}
}

View File

@ -15,7 +15,7 @@ Joomla = window.Joomla || {};
for (let i = 0; i < cids.length; i += 1) {
if (cids[i].checked && cids[i].parentNode.getAttribute('data-usercount') !== '0') {
// TODO replace with joomla-alert
if (window.confirm(Joomla.JText._('COM_USERS_GROUPS_CONFIRM_DELETE'))) {
if (window.confirm(Joomla.Text._('COM_USERS_GROUPS_CONFIRM_DELETE'))) {
Joomla.submitform(task);
}
return false;

View File

@ -18,13 +18,13 @@
// do field validation
if (form.jform_subject.value === '') {
html.innerText = Joomla.JText._('COM_USERS_MAIL_PLEASE_FILL_IN_THE_SUBJECT');
html.innerText = Joomla.Text._('COM_USERS_MAIL_PLEASE_FILL_IN_THE_SUBJECT');
form.insertAdjacentElement('afterbegin', html);
} else if (form.jform_group.value < 0) {
html.innerText = Joomla.JText._('COM_USERS_MAIL_PLEASE_SELECT_A_GROUP');
html.innerText = Joomla.Text._('COM_USERS_MAIL_PLEASE_SELECT_A_GROUP');
form.insertAdjacentElement('afterbegin', html);
} else if (form.jform_message.value === '') {
html.innerText = Joomla.JText._('COM_USERS_MAIL_PLEASE_FILL_IN_THE_MESSAGE');
html.innerText = Joomla.Text._('COM_USERS_MAIL_PLEASE_FILL_IN_THE_MESSAGE');
form.insertAdjacentElement('afterbegin', html);
} else {
Joomla.submitform(pressbutton);

View File

@ -28,8 +28,8 @@
minTermLength: 3,
afterTypeDelay: 500,
jsonTermKey: "term",
keepTypingMsg: Joomla.JText._('JGLOBAL_KEEP_TYPING'),
lookingForMsg: Joomla.JText._('JGLOBAL_LOOKING_FOR')
keepTypingMsg: Joomla.Text._('JGLOBAL_KEEP_TYPING'),
lookingForMsg: Joomla.Text._('JGLOBAL_LOOKING_FOR')
};
select = this;
chosenXhr = null;
@ -158,4 +158,4 @@ jQuery(document).ready(function ($) {
return results;
});
}
});
});

View File

@ -153,7 +153,7 @@
});
} else {
Joomla.renderMessages({
error: [Joomla.JText._('PLG_TINY_ERR_UNSUPPORTEDBROWSER')]
error: [Joomla.Text._('PLG_TINY_ERR_UNSUPPORTEDBROWSER')]
});
editor.on('drop', function (e) {
e.preventDefault();

View File

@ -219,9 +219,7 @@ Joomla = window.Joomla || {};
const name = `${options.formControl}[${set}][${group}][]`;
const value = element.getAttribute('data-name');
const input = `<input type="hidden" name="${name}" value="${value}">`;
element.innerHTML += input;
element.innerHTML += Joomla.sanitizeHtml(`<input type="hidden" name="${name}" value="${value}">`);
};
/**
@ -284,7 +282,7 @@ Joomla = window.Joomla || {};
if (item) {
$btn = createButton(name, item, type);
box.innerHTML += $btn;
box.innerHTML += Joomla.sanitizeHtml($btn);
const newbutton = box.querySelector('.tox-mbtn:last-child');

View File

@ -125,7 +125,7 @@
});
editor.ui.registry.addMenuButton('jxtdbuttons', {
text: Joomla.JText._('PLG_TINY_CORE_BUTTONS'),
text: Joomla.Text._('PLG_TINY_CORE_BUTTONS'),
icon: 'joomla',
fetch: (callback) => callback(buttonValues),
});

View File

@ -7,433 +7,424 @@ if (!Joomla) {
throw new Error('Joomla API is not properly initialised');
}
((window, document, Joomla) => {
'use strict';
const allowList = {
button: ['type'],
input: ['type', 'name', 'placeholder', 'inputmode'],
select: ['name'],
option: ['value', 'selected'],
};
const webInstallerOptions = {
view: 'dashboard',
id: 0,
ordering: '',
version: 'current',
list: 0,
options: Joomla.getOptions('plg_installer_webinstaller', {}),
};
const webInstallerOptions = {
view: 'dashboard',
id: 0,
ordering: '',
version: 'current',
list: 0,
options: Joomla.getOptions('plg_installer_webinstaller', {}),
};
let instance;
let instance;
class WebInstaller {
initialise() {
webInstallerOptions.loaded = 1;
class WebInstaller {
initialise() {
webInstallerOptions.loaded = 1;
const cancelButton = document.getElementById('uploadform-web-cancel');
cancelButton.addEventListener('click', () => {
document.getElementById('uploadform-web').classList.add('hidden');
const cancelButton = document.getElementById('uploadform-web-cancel');
cancelButton.addEventListener('click', () => {
document.getElementById('uploadform-web').classList.add('hidden');
if (webInstallerOptions.list && document.querySelector('.list-view')) {
document.querySelector('.list-view').click();
}
});
if (webInstallerOptions.list && document.querySelector('.list-view')) {
document.querySelector('.list-view').click();
}
});
const installButton = document.getElementById('uploadform-web-install');
installButton.addEventListener('click', () => {
if (webInstallerOptions.options.installFrom === 4) {
this.submitButtonUrl();
} else {
this.submitButtonWeb();
}
});
const installButton = document.getElementById('uploadform-web-install');
installButton.addEventListener('click', () => {
if (webInstallerOptions.options.installFrom === 4) {
this.submitButtonUrl();
} else {
this.submitButtonWeb();
}
});
this.loadweb(`${webInstallerOptions.options.base_url}index.php?format=json&option=com_apps&view=dashboard`);
this.loadweb(`${webInstallerOptions.options.base_url}index.php?format=json&option=com_apps&view=dashboard`);
this.clickforlinks();
this.clickforlinks();
}
loadweb(url) {
if (!url) {
return false;
}
loadweb(url) {
if (!url) {
return false;
}
const pattern1 = new RegExp(webInstallerOptions.options.base_url);
const pattern2 = new RegExp('^index.php');
const pattern1 = new RegExp(webInstallerOptions.options.base_url);
const pattern2 = new RegExp('^index.php');
if (!(pattern1.test(url) || pattern2.test(url))) {
window.open(url, '_blank');
if (!(pattern1.test(url) || pattern2.test(url))) {
window.open(url, '_blank');
return false;
}
return false;
}
let requestUrl = `${url}&product=${webInstallerOptions.options.product}&release=${webInstallerOptions.options.release}&dev_level=${webInstallerOptions.options.dev_level}&list=${webInstallerOptions.list ? 'list' : 'grid'}&lang=${webInstallerOptions.options.language}`;
let requestUrl = `${url}&product=${webInstallerOptions.options.product}&release=${webInstallerOptions.options.release}&dev_level=${webInstallerOptions.options.dev_level}&list=${webInstallerOptions.list ? 'list' : 'grid'}&lang=${webInstallerOptions.options.language}`;
const orderingSelect = document.getElementById('com-apps-ordering');
const versionSelect = document.getElementById('com-apps-filter-joomla-version');
const orderingSelect = document.getElementById('com-apps-ordering');
const versionSelect = document.getElementById('com-apps-filter-joomla-version');
if (webInstallerOptions.ordering !== '' && orderingSelect && orderingSelect.value) {
webInstallerOptions.ordering = orderingSelect.value;
requestUrl += `&ordering=${webInstallerOptions.ordering}`;
}
if (webInstallerOptions.ordering !== '' && orderingSelect && orderingSelect.value) {
webInstallerOptions.ordering = orderingSelect.value;
requestUrl += `&ordering=${webInstallerOptions.ordering}`;
}
if (webInstallerOptions.version !== '' && versionSelect && versionSelect.value) {
webInstallerOptions.version = versionSelect.value;
requestUrl += `&filter_version=${webInstallerOptions.version}`;
}
if (webInstallerOptions.version !== '' && versionSelect && versionSelect.value) {
webInstallerOptions.version = versionSelect.value;
requestUrl += `&filter_version=${webInstallerOptions.version}`;
}
WebInstaller.showLoadingLayer();
WebInstaller.showLoadingLayer();
new Promise((resolve, reject) => {
Joomla.request({
url: requestUrl,
onSuccess: (resp) => {
let response;
new Promise((resolve, reject) => {
Joomla.request({
url: requestUrl,
onSuccess: (resp) => {
let response;
try {
response = JSON.parse(resp);
} catch (error) {
throw new Error('Failed to parse JSON');
}
try {
response = JSON.parse(resp);
} catch (error) {
throw new Error('Failed to parse JSON');
}
if (document.getElementById('web-loader')) {
document.getElementById('web-loader').classList.add('hidden');
}
if (document.getElementById('web-loader')) {
document.getElementById('web-loader').classList.add('hidden');
}
const jedContainer = document.getElementById('jed-container');
jedContainer.innerHTML = Joomla.sanitizeHtml(response.data.html, allowList);
const jedContainer = document.getElementById('jed-container');
jedContainer.innerHTML = response.data.html;
document.getElementById('com-apps-searchbox').addEventListener('keypress', ({ which }) => {
if (which === 13) {
this.initiateSearch();
}
});
document.getElementById('search-extensions').addEventListener('click', () => {
document.getElementById('com-apps-searchbox').addEventListener('keypress', ({ which }) => {
if (which === 13) {
this.initiateSearch();
}
});
document.getElementById('search-extensions').addEventListener('click', () => {
this.initiateSearch();
});
document.getElementById('search-reset').addEventListener('click', () => {
const searchBox = document.getElementById('com-apps-searchbox');
searchBox.value = '';
this.initiateSearch();
document.getElementById('search-reset').setAttribute('disabled', 'disabled');
});
if (document.getElementById('com-apps-searchbox').value === '') {
document.getElementById('search-reset').setAttribute('disabled', 'disabled');
}
document.getElementById('search-reset').innerHTML = Joomla.sanitizeHtml(Joomla.Text._('JSEARCH_FILTER_CLEAR'));
// eslint-disable-next-line no-shadow
const orderingSelect = document.getElementById('com-apps-ordering');
// eslint-disable-next-line no-shadow
const versionSelect = document.getElementById('com-apps-filter-joomla-version');
if (orderingSelect) {
orderingSelect.addEventListener('change', () => {
const index = orderingSelect.selectedIndex;
webInstallerOptions.ordering = orderingSelect.options[index].value;
this.installfromwebajaxsubmit();
});
}
document.getElementById('search-reset').addEventListener('click', () => {
const searchBox = document.getElementById('com-apps-searchbox');
searchBox.value = '';
this.initiateSearch();
document.getElementById('search-reset').setAttribute('disabled', 'disabled');
if (versionSelect) {
versionSelect.addEventListener('change', () => {
const index = versionSelect.selectedIndex;
webInstallerOptions.version = versionSelect.options[index].value;
this.installfromwebajaxsubmit();
});
}
if (document.getElementById('com-apps-searchbox').value === '') {
document.getElementById('search-reset').setAttribute('disabled', 'disabled');
}
if (webInstallerOptions.options.installfrom_url !== '') {
WebInstaller.installfromweb(webInstallerOptions.options.installfrom_url);
}
document.getElementById('search-reset').innerHTML = Joomla.JText._('JSEARCH_FILTER_CLEAR');
resolve();
},
onError: (request) => {
const errorContainer = document.getElementById('web-loader-error');
const loaderContainer = document.getElementById('web-loader');
// eslint-disable-next-line no-shadow
const orderingSelect = document.getElementById('com-apps-ordering');
// eslint-disable-next-line no-shadow
const versionSelect = document.getElementById('com-apps-filter-joomla-version');
if (request.responseText && errorContainer) {
errorContainer.innerHTML = Joomla.sanitizeHtml(request.responseText);
}
if (orderingSelect) {
orderingSelect.addEventListener('change', () => {
const index = orderingSelect.selectedIndex;
webInstallerOptions.ordering = orderingSelect.options[index].value;
this.installfromwebajaxsubmit();
});
}
if (loaderContainer) {
loaderContainer.classList.add('hidden');
errorContainer.classList.remove('hidden');
}
Joomla.renderMessages({ danger: [Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR')] }, '#web-loader-error');
if (versionSelect) {
versionSelect.addEventListener('change', () => {
const index = versionSelect.selectedIndex;
webInstallerOptions.version = versionSelect.options[index].value;
this.installfromwebajaxsubmit();
});
}
reject();
},
});
}).finally(() => {
// Promise has been settled.
// Run the following whether or not it was a success.
if (webInstallerOptions.options.installfrom_url !== '') {
WebInstaller.installfromweb(webInstallerOptions.options.installfrom_url);
}
const installAtField = document.getElementById('joomlaapsinstallatinput');
resolve();
},
onError: (request) => {
const errorContainer = document.getElementById('web-loader-error');
const loaderContainer = document.getElementById('web-loader');
if (installAtField) {
installAtField.value = webInstallerOptions.options.installat_url;
}
if (request.responseText && errorContainer) {
errorContainer.innerHTML = request.responseText;
}
this.clickforlinks();
WebInstaller.clicker();
if (loaderContainer) {
loaderContainer.classList.add('hidden');
errorContainer.classList.remove('hidden');
}
Joomla.renderMessages({ danger: [Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_INSTALL_WEB_LOADING_ERROR')] }, '#web-loader-error');
if (webInstallerOptions.view !== 'extension') {
[].slice.call(document.querySelectorAll('div.load-extension')).forEach((element) => {
element.addEventListener('click', (event) => {
event.preventDefault();
this.processLinkClick(element.getAttribute('data-url'));
});
reject();
},
element.setAttribute('href', '#');
});
}).finally(() => {
// Promise has been settled.
// Run the following whether or not it was a success.
}
const installAtField = document.getElementById('joomlaapsinstallatinput');
if (webInstallerOptions.view === 'extension') {
const installExtensionButton = document.getElementById('install-extension');
const installExtensionFromExternalButton = document.getElementById('install-extension-from-external');
if (installAtField) {
installAtField.value = webInstallerOptions.options.installat_url;
}
this.clickforlinks();
WebInstaller.clicker();
if (webInstallerOptions.view !== 'extension') {
[].slice.call(document.querySelectorAll('div.load-extension')).forEach((element) => {
element.addEventListener('click', (event) => {
event.preventDefault();
this.processLinkClick(element.getAttribute('data-url'));
});
element.setAttribute('href', '#');
if (installExtensionButton) {
installExtensionButton.addEventListener('click', () => {
WebInstaller.installfromweb(installExtensionButton.getAttribute('data-downloadurl'), installExtensionButton.getAttribute('data-name'));
document.getElementById('uploadform-web-install').scrollIntoView({ behavior: 'smooth', block: 'start' });
});
}
if (webInstallerOptions.view === 'extension') {
const installExtensionButton = document.getElementById('install-extension');
const installExtensionFromExternalButton = document.getElementById('install-extension-from-external');
if (installExtensionFromExternalButton) {
installExtensionFromExternalButton.addEventListener('click', () => {
const redirectUrl = installExtensionFromExternalButton.getAttribute('data-downloadurl');
const redirectConfirm = window.confirm(Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL').replace('[SITEURL]', redirectUrl));
if (installExtensionButton) {
installExtensionButton.addEventListener('click', () => {
WebInstaller.installfromweb(installExtensionButton.getAttribute('data-downloadurl'), installExtensionButton.getAttribute('data-name'));
document.getElementById('uploadform-web-install').scrollIntoView({ behavior: 'smooth', block: 'start' });
});
}
if (redirectConfirm !== true) {
return;
}
if (installExtensionFromExternalButton) {
installExtensionFromExternalButton.addEventListener('click', () => {
const redirectUrl = installExtensionFromExternalButton.getAttribute('data-downloadurl');
const redirectConfirm = window.confirm(Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL').replace('[SITEURL]', redirectUrl));
document.getElementById('adminForm').setAttribute('action', redirectUrl);
document.querySelector('input[name=task]').setAttribute('disabled', true);
document.querySelector('input[name=install_directory]').setAttribute('disabled', true);
document.querySelector('input[name=install_url]').setAttribute('disabled', true);
document.querySelector('input[name=installtype]').setAttribute('disabled', true);
document.querySelector('input[name=filter_search]').setAttribute('disabled', true);
if (redirectConfirm !== true) {
return;
}
document.getElementById('adminForm').setAttribute('action', redirectUrl);
document.querySelector('input[name=task]').setAttribute('disabled', true);
document.querySelector('input[name=install_directory]').setAttribute('disabled', true);
document.querySelector('input[name=install_url]').setAttribute('disabled', true);
document.querySelector('input[name=installtype]').setAttribute('disabled', true);
document.querySelector('input[name=filter_search]').setAttribute('disabled', true);
document.getElementById('adminForm').submit();
});
}
document.getElementById('adminForm').submit();
});
}
}
if (webInstallerOptions.list && document.querySelector('.list-view')) {
document.querySelector('.list-view').click();
}
if (webInstallerOptions.list && document.querySelector('.list-view')) {
document.querySelector('.list-view').click();
}
WebInstaller.hideLoadingLayer();
WebInstaller.hideLoadingLayer();
});
return true;
}
clickforlinks() {
[].slice.call(document.querySelectorAll('a.transcode')).forEach((element) => {
const ajaxurl = element.getAttribute('href');
element.addEventListener('click', (event) => {
event.preventDefault();
this.processLinkClick(ajaxurl);
});
return true;
element.setAttribute('href', '#');
});
}
initiateSearch() {
document.getElementById('search-reset').removeAttribute('disabled');
webInstallerOptions.view = 'dashboard';
this.installfromwebajaxsubmit();
}
installfromwebajaxsubmit() {
let tail = `&view=${webInstallerOptions.view}`;
if (webInstallerOptions.id) {
tail += `&id=${webInstallerOptions.id}`;
}
clickforlinks() {
[].slice.call(document.querySelectorAll('a.transcode')).forEach((element) => {
const ajaxurl = element.getAttribute('href');
element.addEventListener('click', (event) => {
event.preventDefault();
this.processLinkClick(ajaxurl);
});
element.setAttribute('href', '#');
});
if (document.getElementById('com-apps-searchbox').value) {
const value = encodeURI(document.getElementById('com-apps-searchbox').value.toLowerCase().replace(/ +/g, '_').replace(/[^a-z0-9-_]/g, '').trim());
tail += `&filter_search=${value}`;
}
initiateSearch() {
document.getElementById('search-reset').removeAttribute('disabled');
webInstallerOptions.view = 'dashboard';
this.installfromwebajaxsubmit();
const orderingSelect = document.getElementById('com-apps-ordering');
const versionSelect = document.getElementById('com-apps-filter-joomla-version');
if (webInstallerOptions.ordering !== '' && orderingSelect && orderingSelect.value) {
webInstallerOptions.ordering = orderingSelect.value;
}
installfromwebajaxsubmit() {
let tail = `&view=${webInstallerOptions.view}`;
if (webInstallerOptions.id) {
tail += `&id=${webInstallerOptions.id}`;
}
if (document.getElementById('com-apps-searchbox').value) {
const value = encodeURI(document.getElementById('com-apps-searchbox').value.toLowerCase().replace(/ +/g, '_').replace(/[^a-z0-9-_]/g, '').trim());
tail += `&filter_search=${value}`;
}
const orderingSelect = document.getElementById('com-apps-ordering');
const versionSelect = document.getElementById('com-apps-filter-joomla-version');
if (webInstallerOptions.ordering !== '' && orderingSelect && orderingSelect.value) {
webInstallerOptions.ordering = orderingSelect.value;
}
if (webInstallerOptions.ordering) {
tail += `&ordering=${webInstallerOptions.ordering}`;
}
if (webInstallerOptions.version !== '' && versionSelect && versionSelect.value) {
webInstallerOptions.version = versionSelect.value;
}
if (webInstallerOptions.version) {
tail += `&filter_version=${webInstallerOptions.version}`;
}
this.loadweb(`${webInstallerOptions.options.base_url}index.php?format=json&option=com_apps${tail}`);
if (webInstallerOptions.ordering) {
tail += `&ordering=${webInstallerOptions.ordering}`;
}
processLinkClick(url) {
const pattern1 = new RegExp(webInstallerOptions.options.base_url);
const pattern2 = new RegExp('^index.php');
if (pattern1.test(url) || pattern2.test(url)) {
webInstallerOptions.view = url.replace(/^.+[&?]view=(\w+).*$/, '$1');
if (webInstallerOptions.view === 'dashboard') {
webInstallerOptions.id = 0;
} else if (webInstallerOptions.view === 'category') {
webInstallerOptions.id = url.replace(/^.+[&?]id=(\d+).*$/, '$1');
}
this.loadweb(webInstallerOptions.options.base_url + url);
} else {
this.loadweb(url);
}
if (webInstallerOptions.version !== '' && versionSelect && versionSelect.value) {
webInstallerOptions.version = versionSelect.value;
}
static showLoadingLayer() {
document.getElementById('web').appendChild(document.createElement('joomla-core-loader'));
if (webInstallerOptions.version) {
tail += `&filter_version=${webInstallerOptions.version}`;
}
static hideLoadingLayer() {
const spinnerElement = document.querySelector('#web joomla-core-loader');
spinnerElement.parentNode.removeChild(spinnerElement);
}
this.loadweb(`${webInstallerOptions.options.base_url}index.php?format=json&option=com_apps${tail}`);
}
static clicker() {
if (document.querySelector('.grid-view')) {
document.querySelector('.grid-view').addEventListener('click', () => {
webInstallerOptions.list = 0;
document.querySelector('.list-container').classList.add('hidden');
document.querySelector('.grid-container').classList.remove('hidden');
document.getElementById('btn-list-view').classList.remove('active');
document.getElementById('btn-grid-view').classList.remove('active');
});
processLinkClick(url) {
const pattern1 = new RegExp(webInstallerOptions.options.base_url);
const pattern2 = new RegExp('^index.php');
if (pattern1.test(url) || pattern2.test(url)) {
webInstallerOptions.view = url.replace(/^.+[&?]view=(\w+).*$/, '$1');
if (webInstallerOptions.view === 'dashboard') {
webInstallerOptions.id = 0;
} else if (webInstallerOptions.view === 'category') {
webInstallerOptions.id = url.replace(/^.+[&?]id=(\d+).*$/, '$1');
}
if (document.querySelector('.list-view')) {
document.querySelector('.list-view').addEventListener('click', () => {
webInstallerOptions.list = 1;
document.querySelector('.grid-container').classList.add('hidden');
document.querySelector('.list-container').classList.remove('hidden');
document.getElementById('btn-grid-view').classList.remove('active');
document.getElementById('btn-list-view').classList.add('active');
});
}
}
/**
* @param {string} installUrl
* @param {string} name
* @returns {boolean}
*/
static installfromweb(installUrl, name = null) {
if (!installUrl) {
Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN')] });
return false;
}
document.getElementById('install_url').value = installUrl;
document.getElementById('uploadform-web-url').innerText = installUrl;
if (name) {
document.getElementById('uploadform-web-name').innerText = name;
document.getElementById('uploadform-web-name-label').classList.remove('hidden');
} else {
document.getElementById('uploadform-web-name-label').classList.add('hidden');
}
document.getElementById('uploadform-web').classList.remove('hidden');
return true;
}
// eslint-disable-next-line class-methods-use-this
submitButtonUrl() {
const form = document.getElementById('adminForm');
// do field validation
if (form.install_url.value === '' || form.install_url.value === 'http://' || form.install_url.value === 'https://') {
Joomla.renderMessages({ warning: [Joomla.Text._('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL')] });
} else {
const loading = document.getElementById('loading');
if (loading) {
loading.classList.remove('hidden');
}
form.installtype.value = 'url';
form.submit();
}
}
submitButtonWeb() {
const form = document.getElementById('adminForm');
// do field validation
if (form.install_url.value !== '' || form.install_url.value !== 'http://' || form.install_url.value !== 'https://') {
this.submitButtonUrl();
} else if (form.install_url.value === '') {
Joomla.renderMessages({ warning: [Joomla.apps.options.btntxt] });
} else {
document.querySelector('#appsloading').classList.remove('hidden');
form.installtype.value = 'web';
form.submit();
}
this.loadweb(webInstallerOptions.options.base_url + url);
} else {
this.loadweb(url);
}
}
document.addEventListener('DOMContentLoaded', () => {
const initialiser = () => {
const installerTabs = document.getElementById('myTab');
static showLoadingLayer() {
document.getElementById('web').appendChild(document.createElement('joomla-core-loader'));
}
// Need to wait for the CE to have inserted the tabs list
if (installerTabs.firstElementChild.tagName !== 'UL') {
window.setTimeout(initialiser, 50);
static hideLoadingLayer() {
const spinnerElement = document.querySelector('#web joomla-core-loader');
spinnerElement.parentNode.removeChild(spinnerElement);
}
return;
}
const link = installerTabs.querySelector('#tab-web');
// Abort if the IFW tab cannot be found
if (!link) {
return;
}
if (webInstallerOptions.options.installfromon) {
link.click();
}
if (link.hasAttribute('active') && !instance) {
instance = new WebInstaller();
instance.initialise();
}
if (webInstallerOptions.options.installfrom_url !== '') {
link.click();
}
link.addEventListener('joomla.tab.shown', () => {
if (!instance) {
instance = new WebInstaller();
instance.initialise();
}
static clicker() {
if (document.querySelector('.grid-view')) {
document.querySelector('.grid-view').addEventListener('click', () => {
webInstallerOptions.list = 0;
document.querySelector('.list-container').classList.add('hidden');
document.querySelector('.grid-container').classList.remove('hidden');
document.getElementById('btn-list-view').classList.remove('active');
document.getElementById('btn-grid-view').classList.remove('active');
});
};
}
window.setTimeout(initialiser, 50);
if (document.querySelector('.list-view')) {
document.querySelector('.list-view').addEventListener('click', () => {
webInstallerOptions.list = 1;
document.querySelector('.grid-container').classList.add('hidden');
document.querySelector('.list-container').classList.remove('hidden');
document.getElementById('btn-grid-view').classList.remove('active');
document.getElementById('btn-list-view').classList.add('active');
});
}
}
/**
* @param {string} installUrl
* @param {string} name
* @returns {boolean}
*/
static installfromweb(installUrl, name = null) {
if (!installUrl) {
Joomla.renderMessages({ warning: [Joomla.Text._('PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN')] });
return false;
}
document.getElementById('install_url').value = installUrl;
document.getElementById('uploadform-web-url').innerText = installUrl;
if (name) {
document.getElementById('uploadform-web-name').innerText = name;
document.getElementById('uploadform-web-name-label').classList.remove('hidden');
} else {
document.getElementById('uploadform-web-name-label').classList.add('hidden');
}
document.getElementById('uploadform-web').classList.remove('hidden');
return true;
}
// eslint-disable-next-line class-methods-use-this
submitButtonUrl() {
const form = document.getElementById('adminForm');
// do field validation
if (form.install_url.value === '' || form.install_url.value === 'http://' || form.install_url.value === 'https://') {
Joomla.renderMessages({ warning: [Joomla.Text._('COM_INSTALLER_MSG_INSTALL_ENTER_A_URL')] });
} else {
const loading = document.getElementById('loading');
if (loading) {
loading.classList.remove('hidden');
}
form.installtype.value = 'url';
form.submit();
}
}
submitButtonWeb() {
const form = document.getElementById('adminForm');
// do field validation
if (form.install_url.value !== '' || form.install_url.value !== 'http://' || form.install_url.value !== 'https://') {
this.submitButtonUrl();
} else if (form.install_url.value === '') {
Joomla.renderMessages({ warning: [Joomla.apps.options.btntxt] });
} else {
document.querySelector('#appsloading').classList.remove('hidden');
form.installtype.value = 'web';
form.submit();
}
}
}
customElements.whenDefined('joomla-tab').then(() => {
const installerTabs = document.getElementById('myTab');
const link = installerTabs.querySelector('#tab-web');
// Abort if the IFW tab cannot be found
if (!link) {
return;
}
if (webInstallerOptions.options.installfromon) {
link.click();
}
if (link.hasAttribute('active') && !instance) {
instance = new WebInstaller();
instance.initialise();
}
if (webInstallerOptions.options.installfrom_url !== '') {
link.click();
}
link.addEventListener('joomla.tab.shown', () => {
if (!instance) {
instance = new WebInstaller();
instance.initialise();
}
});
})(window, document, Joomla);
});

View File

@ -21,7 +21,7 @@
if (linkSpans.length) {
linkSpans.forEach((span) => {
span.innerHTML = text;
span.innerHTML = Joomla.sanitizeHtml(text);
});
}
};

View File

@ -15,7 +15,7 @@ if (Joomla && Joomla.getOptions('js-extensions-update')) {
if (linkSpans.length) {
linkSpans.forEach((span) => {
span.innerHTML = text;
span.innerHTML = Joomla.sanitizeHtml(text);
});
}
};

View File

@ -24,7 +24,7 @@
if (linkSpans.length) {
linkSpans.forEach((span) => {
span.innerHTML = text;
span.innerHTML = Joomla.sanitizeHtml(text);
});
}
};
@ -46,7 +46,7 @@
// Scroll to page top
window.scrollTo(0, 0);
update('danger', Joomla.JText._('PLG_QUICKICON_OVERRIDECHECK_OVERRIDEFOUND').replace('%s', `<span class="badge text-dark bg-light">${updateInfoList.length}</span>`), '');
update('danger', Joomla.Text._('PLG_QUICKICON_OVERRIDECHECK_OVERRIDEFOUND').replace('%s', `<span class="badge text-dark bg-light">${updateInfoList.length}</span>`), '');
}
} else {
// An error occurred

View File

@ -141,7 +141,7 @@ window.Joomla = window.Joomla || {};
};
if (!publicKey.challenge) {
handleLoginError(Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_INVALID_USERNAME'));
handleLoginError(Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_INVALID_USERNAME'));
return;
}
@ -202,7 +202,7 @@ window.Joomla = window.Joomla || {};
const elReturn = lookForField(elFormContainer, 'input[name=return]');
if (elUsername === null) {
Joomla.renderMessages({ error: [Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_CANNOT_FIND_USERNAME')] });
Joomla.renderMessages({ error: [Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_CANNOT_FIND_USERNAME')] });
return false;
}
@ -212,7 +212,7 @@ window.Joomla = window.Joomla || {};
// No username? We cannot proceed. We need a username to find the acceptable public keys :(
if (username === '') {
Joomla.renderMessages({ error: [Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_EMPTY_USERNAME')] });
Joomla.renderMessages({ error: [Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_EMPTY_USERNAME')] });
return false;
}

View File

@ -71,7 +71,7 @@ window.Joomla = window.Joomla || {};
Joomla.plgSystemWebauthnCreateCredentials = (storeID, interfaceSelector) => {
// Make sure the browser supports Webauthn
if (!('credentials' in navigator)) {
Joomla.renderMessages({ error: [Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_NO_BROWSER_SUPPORT')] });
Joomla.renderMessages({ error: [Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_NO_BROWSER_SUPPORT')] });
return;
}
@ -207,7 +207,7 @@ window.Joomla = window.Joomla || {};
const elSave = document.createElement('button');
elSave.className = 'btn btn-success btn-sm';
elSave.innerText = Joomla.JText._('PLG_SYSTEM_WEBAUTHN_MANAGE_BTN_SAVE_LABEL');
elSave.innerText = Joomla.Text._('PLG_SYSTEM_WEBAUTHN_MANAGE_BTN_SAVE_LABEL');
elSave.addEventListener('click', () => {
const elNewLabel = elInput.value;
@ -238,13 +238,13 @@ window.Joomla = window.Joomla || {};
if (result !== true) {
handleCreationError(
Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_LABEL_NOT_SAVED'),
Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_LABEL_NOT_SAVED'),
);
}
},
onError: (xhr) => {
handleCreationError(
`${Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_LABEL_NOT_SAVED')
`${Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_LABEL_NOT_SAVED')
} -- ${xhr.status} ${xhr.statusText}`,
);
},
@ -260,7 +260,7 @@ window.Joomla = window.Joomla || {};
const elCancel = document.createElement('button');
elCancel.className = 'btn btn-danger btn-sm';
elCancel.innerText = Joomla.JText._('PLG_SYSTEM_WEBAUTHN_MANAGE_BTN_CANCEL_LABEL');
elCancel.innerText = Joomla.Text._('PLG_SYSTEM_WEBAUTHN_MANAGE_BTN_CANCEL_LABEL');
elCancel.addEventListener('click', () => {
elLabelTD.innerText = oldLabel;
elEdit.disabled = false;
@ -335,7 +335,7 @@ window.Joomla = window.Joomla || {};
if (result !== true) {
handleCreationError(
Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_NOT_DELETED'),
Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_NOT_DELETED'),
);
return;
@ -347,7 +347,7 @@ window.Joomla = window.Joomla || {};
elEdit.disabled = false;
elDelete.disabled = false;
handleCreationError(
`${Joomla.JText._('PLG_SYSTEM_WEBAUTHN_ERR_NOT_DELETED')
`${Joomla.Text._('PLG_SYSTEM_WEBAUTHN_ERR_NOT_DELETED')
} -- ${xhr.status} ${xhr.statusText}`,
);
},

View File

@ -13,9 +13,9 @@
try {
const copy = document.execCommand('copy');
if (copy) {
Joomla.renderMessages({ message: [Joomla.JText._('PLG_USER_TOKEN_COPY_SUCCESS')] });
Joomla.renderMessages({ message: [Joomla.Text._('PLG_USER_TOKEN_COPY_SUCCESS')] });
} else {
Joomla.renderMessages({ error: [Joomla.JText._('PLG_USER_TOKEN_COPY_FAIL')] });
Joomla.renderMessages({ error: [Joomla.Text._('PLG_USER_TOKEN_COPY_FAIL')] });
}
} catch (err) {
Joomla.renderMessages({ error: [err] });
@ -34,9 +34,9 @@
}
navigator.clipboard.writeText(input.value).then(() => {
Joomla.renderMessages({ message: [Joomla.JText._('PLG_USER_TOKEN_COPY_SUCCESS')] });
Joomla.renderMessages({ message: [Joomla.Text._('PLG_USER_TOKEN_COPY_SUCCESS')] });
}, () => {
Joomla.renderMessages({ error: [Joomla.JText._('PLG_USER_TOKEN_COPY_FAIL')] });
Joomla.renderMessages({ error: [Joomla.Text._('PLG_USER_TOKEN_COPY_FAIL')] });
});
});
};

View File

@ -590,9 +590,9 @@
cell.calendar = cal;
cell.navtype = navtype;
if (navtype !== 0 && Math.abs(navtype) <= 2) {
cell.innerHTML = "<a " + classes + " style='display:inline;padding:2px 6px;cursor:pointer;text-decoration:none;' unselectable='on'>" + text + "</a>";
cell.innerHTML = Joomla.sanitizeHtml("<a " + classes + " style='display:inline;padding:2px 6px;cursor:pointer;text-decoration:none;' unselectable='on'>" + text + "</a>");
} else {
cell.innerHTML = cs ? "<div unselectable='on'" + classes + ">" + text + "</div>" : text;
cell.innerHTML = cs ? Joomla.sanitizeHtml("<div unselectable='on'" + classes + ">" + text + "</div>") : Joomla.sanitizeHtml(text);
if (!cs && classes) {
cell.className = classes;
}
@ -621,7 +621,7 @@
if (this.params.weekNumbers) {
cell = createElement("td", row);
cell.className = "day-name wn";
cell.innerHTML = JoomlaCalLocale.wk;
cell.innerHTML = Joomla.sanitizeHtml(JoomlaCalLocale.wk);
}
for (var i = 7; i > 0; --i) {
cell = createElement("td", row);
@ -648,7 +648,7 @@
cell.classList.add("weekend");
}
cell.innerHTML = JoomlaCalLocale.shortDays[(i + fdow) % 7];
cell.innerHTML = Joomla.sanitizeHtml(JoomlaCalLocale.shortDays[(i + fdow) % 7]);
cell = cell.nextSibling;
}
@ -878,7 +878,7 @@
var cell = row.firstChild;
if (this.params.weekNumbers) {
cell.className = "day wn";
cell.innerHTML = date.getLocalWeekNumber(this.params.dateType); //date.convertNumbers();
cell.innerHTML = Joomla.sanitizeHtml(date.getLocalWeekNumber(this.params.dateType)); //date.convertNumbers();
cell = cell.nextSibling;
}
@ -911,7 +911,7 @@
cell.style.cursor = "pointer";
}
cell.disabled = false;
cell.innerHTML = this.params.debug ? iday : Date.convertNumbers(iday); // translated day number for each cell
cell.innerHTML = this.params.debug ? Joomla.sanitizeHtml(iday) : Joomla.sanitizeHtml(Date.convertNumbers(iday)); // translated day number for each cell
if (!cell.disabled) {
cell.caldate = new Date(date);
if (current_month && iday === mday) {

View File

@ -175,7 +175,7 @@
const { value } = this.inputElement;
if (!value) {
this.previewElement.innerHTML = '<span class="field-media-preview-icon"></span>';
this.previewElement.innerHTML = Joomla.sanitizeHtml('<span class="field-media-preview-icon"></span>');
} else {
this.previewElement.innerHTML = '';
const imgPreview = new Image();

View File

@ -74,7 +74,7 @@ customElements.define('joomla-field-module-order', class extends HTMLElement {
// eslint-disable-next-line prefer-destructuring
node.value = item[1];
// eslint-disable-next-line prefer-destructuring
node.innerHTML = item[2];
node.innerHTML = Joomla.sanitizeHtml(item[2]);
if ((originalPositionName && originalPositionValue === item[1])
|| (!originalPositionName && i === 0)) {

View File

@ -137,7 +137,7 @@ window.customElements.define('joomla-field-permissions', class extends HTMLEleme
const badgeSpan = target.parentNode.parentNode.nextElementSibling.querySelector('span');
badgeSpan.removeAttribute('class');
badgeSpan.setAttribute('class', response.data.class);
badgeSpan.innerHTML = response.data.text;
badgeSpan.innerHTML = Joomla.sanitizeHtml(response.data.text);
}
// Render messages, if any. There are only message in case of errors.

View File

@ -237,7 +237,7 @@
el.style.backgroundColor = color;
el.setAttribute('type', 'button');
const a11yColor = color === 'transparent' ? this.textTransp : this.getColorName(color);
el.innerHTML = `<span class="visually-hidden">${a11yColor}</span>`;
el.innerHTML = Joomla.sanitizeHtml(`<span class="visually-hidden">${a11yColor}</span>`);
this.buttons.push(el);
});
@ -246,7 +246,7 @@
const close = document.createElement('button');
close.setAttribute('class', 'btn-close');
close.setAttribute('type', 'button');
close.innerHTML = this.textClose;
close.innerHTML = Joomla.sanitizeHtml(this.textClose);
this.buttons.push(close);
@ -268,7 +268,7 @@
this.icon.setAttribute('type', 'button');
this.icon.setAttribute('tabindex', '0');
this.icon.style.backgroundColor = color;
this.icon.innerHTML = `<span class="visually-hidden">${this.textSelect}</span>`;
this.icon.innerHTML = Joomla.sanitizeHtml(`<span class="visually-hidden">${this.textSelect}</span>`);
this.icon.id = uniqueId;
this.select.insertAdjacentElement('beforebegin', this.icon);
this.icon.addEventListener('click', this.show.bind(this));

View File

@ -183,7 +183,7 @@
} else {
tmpEl = document.createElement('div');
}
tmpEl.innerHTML = this.template;
tmpEl.innerHTML = Joomla.sanitizeHtml(this.template);
const row = tmpEl.children[0];
// Add to container

View File

@ -104,9 +104,9 @@ class PasswordStrength {
const label = element.parentNode.parentNode.querySelector(`#password-${i}`);
if (score === 100) {
label.innerText = Joomla.JText._('JFIELD_PASSWORD_INDICATE_COMPLETE');
label.innerText = Joomla.Text._('JFIELD_PASSWORD_INDICATE_COMPLETE');
} else {
label.innerText = Joomla.JText._('JFIELD_PASSWORD_INDICATE_INCOMPLETE');
label.innerText = Joomla.Text._('JFIELD_PASSWORD_INDICATE_INCOMPLETE');
}
meter.value = score;

View File

@ -117,11 +117,11 @@ class JFormValidator {
const elMsg = document.createElement('span');
elMsg.classList.add('form-control-feedback');
if (empty && empty === 'checkbox') {
elMsg.innerHTML = message || Joomla.JText._('JLIB_FORM_FIELD_REQUIRED_CHECK');
elMsg.innerHTML = Joomla.sanitizeHtml(message) || Joomla.sanitizeHtml(Joomla.Text._('JLIB_FORM_FIELD_REQUIRED_CHECK'));
} else if (empty && empty === 'value') {
elMsg.innerHTML = message || Joomla.JText._('JLIB_FORM_FIELD_REQUIRED_VALUE');
elMsg.innerHTML = Joomla.sanitizeHtml(message) || Joomla.sanitizeHtml(Joomla.Text._('JLIB_FORM_FIELD_REQUIRED_VALUE'));
} else {
elMsg.innerHTML = message || Joomla.JText._('JLIB_FORM_FIELD_INVALID_VALUE');
elMsg.innerHTML = Joomla.sanitizeHtml(message) || Joomla.sanitizeHtml(Joomla.Text._('JLIB_FORM_FIELD_INVALID_VALUE'));
}
if (label) {
@ -273,7 +273,7 @@ class JFormValidator {
if (form.getAttribute('data-validation-text')) {
message = form.getAttribute('data-validation-text');
} else {
message = Joomla.JText._('JLIB_FORM_CONTAINS_INVALID_FIELDS');
message = Joomla.Text._('JLIB_FORM_CONTAINS_INVALID_FIELDS');
}
error = { error: [message] };

View File

@ -48,7 +48,7 @@ window.customElements.define('joomla-hidden-mail', class extends HTMLElement {
let innerStr = this.constructor.b64DecodeUnicode(this.getAttribute('text'));
innerStr = innerStr.replace('src="images/', `src="${this.base}images/`).replace('src="media/', `src="${this.base}media/`);
this.newElement.innerHTML = innerStr;
this.newElement.innerHTML = Joomla.sanitizeHtml(innerStr);
} else {
this.newElement.innerText = `${window.atob(this.getAttribute('first'))}@${window.atob(this.getAttribute('last'))}`;
}

View File

@ -467,7 +467,7 @@ Joomla = window.Joomla || {};
}
// Append the option and repopulate the chosen field
this.orderFieldName.innerHTML += $option;
this.orderFieldName.innerHTML += Joomla.sanitizeHtml($option);
}
}
});

View File

@ -38,12 +38,7 @@ Joomla.initialiseTabs = (el, options) => {
link.setAttribute('role', 'tab');
link.setAttribute('aria-controls', element.dataset.id);
link.setAttribute('aria-selected', element.dataset.id);
/**
* As we are re-rendering text already displayed on the page we judge that there isn't
* a risk of XSS attacks
*/
link.innerHTML = element.dataset.title;
link.innerHTML = Joomla.sanitizeHtml(element.dataset.title);
const li = document.createElement('li');
li.classList.add('nav-item');

View File

@ -90,7 +90,7 @@ Joomla.checkDbCredentials = function() {
loaderElement.parentNode.removeChild(loaderElement);
console.error('Error in DB Check Endpoint');
console.error(response);
Joomla.renderMessages({'error': [Joomla.JText._('INSTL_DATABASE_RESPONSE_ERROR')]});
Joomla.renderMessages({'error': [Joomla.Text._('INSTL_DATABASE_RESPONSE_ERROR')]});
return false;
}
@ -111,7 +111,7 @@ Joomla.checkDbCredentials = function() {
}
},
onError: function(xhr){
Joomla.renderMessages([['', Joomla.JText._('JLIB_DATABASE_ERROR_DATABASE_CONNECT', 'A Database error occurred.')]]);
Joomla.renderMessages([['', Joomla.Text._('JLIB_DATABASE_ERROR_DATABASE_CONNECT', 'A Database error occurred.')]]);
//Install.goToPage('summary');
var loaderElement = document.querySelector('joomla-core-loader');
loaderElement.parentNode.removeChild(loaderElement);

View File

@ -180,7 +180,7 @@
spinnerElement.parentNode.removeChild(spinnerElement);
console.error('Error in ' + task + ' Endpoint');
console.error(response);
Joomla.renderMessages({'error': [Joomla.JText._('INSTL_DATABASE_RESPONSE_ERROR')]});
Joomla.renderMessages({'error': [Joomla.Text._('INSTL_DATABASE_RESPONSE_ERROR')]});
return false;
}
@ -204,7 +204,7 @@
Joomla.install(tasks, form);
},
onError: function(xhr){
Joomla.renderMessages([['', Joomla.JText._('JLIB_DATABASE_ERROR_DATABASE_CONNECT', 'A Database error occurred.')]]);
Joomla.renderMessages([['', Joomla.Text._('JLIB_DATABASE_ERROR_DATABASE_CONNECT', 'A Database error occurred.')]]);
Joomla.goToPage('remove');
try {

View File

@ -20,7 +20,7 @@ $id = isset($displayData['id']) ? $displayData['id'] : '';
$title = $displayData['title'];
Text::script('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST');
Text::script('ERROR');
$message = "{'error': [Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
$message = "{'error': [Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
$alert = "Joomla.renderMessages(" . $message . ")";
?>
<button<?php echo $id; ?> type="button" data-bs-toggle="modal" onclick="if (document.adminForm.boxchecked.value==0){<?php echo $alert; ?>}else{document.getElementById('collapseModal').open(); return true;}" class="btn btn-primary">

View File

@ -84,7 +84,7 @@ class ConfirmButton extends StandardButton
if ($this->getListCheck())
{
$message = "{'error': [Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
$message = "{'error': [Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
$alert = 'Joomla.renderMessages(' . $message . ')';
$cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }';
}

View File

@ -134,7 +134,7 @@ class StandardButton extends BasicButton
if ($this->getListCheck())
{
$messages = "{error: [Joomla.JText._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
$messages = "{error: [Joomla.Text._('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST')]}";
$alert = 'Joomla.renderMessages(' . $messages . ')';
$cmd = 'if (document.adminForm.boxchecked.value == 0) { ' . $alert . ' } else { ' . $cmd . ' }';
}

View File

@ -11,7 +11,6 @@ defined('_JEXEC') or die;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Form\Rule\UrlRule;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Plugin\PluginHelper;
@ -78,16 +77,13 @@ class PlgInstallerWebinstaller extends CMSPlugin
Text::script('PLG_INSTALLER_WEBINSTALLER_CANNOT_INSTALL_EXTENSION_IN_PLUGIN');
Text::script('PLG_INSTALLER_WEBINSTALLER_REDIRECT_TO_EXTERNAL_SITE_TO_INSTALL');
// TEMPORARY - Make sure Bootstrap is booted so that our client initialisation scripts can find the tab
HTMLHelper::_('bootstrap.framework');
$doc->getWebAssetManager()
->registerAndUseStyle('plg_installer_webinstaller.client', 'plg_installer_webinstaller/client.min.css')
->registerAndUseScript(
'plg_installer_webinstaller.client',
'plg_installer_webinstaller/client.min.js',
[],
['defer' => true],
['type' => 'module'],
['core']
);