Release of v5.1.3

Stability update addressing a post-release field issue. #1262. Fix a security vulnerability in custom code redirect URL validation. Add an alert to the Compiler view when no Components exist. #1263.
This commit is contained in:
Robot committed 2025-10-17 18:55:25 +00:00
1 parent a38cc8c007
commit a2d6e562ba
75 files changed
+2696 -1581

No files matched your search

+120 -47
View File
@@ -36,60 +36,124 @@ $noticeboardOptions = ['vdm', 'pro'];
?>
<?php if ($this->canDo->get('compiler.access')): ?>
<script type="text/javascript">
Joomla.submitbutton = function(task) {
if (task === 'compiler.back') {
parent.history.back();
return false;
} else {
var form = document.getElementById('adminForm');
form.task.value = task;
form.submit();
}
}
</script>
<script type="text/javascript">
Joomla.submitbutton = function(task, key) {
if (task === '') {
/**
* Enhanced Joomla submit button handler for the compiler interface.
*
* Handles form submission tasks safely with DOM validation,
* smooth UI transitions, and contextual loading states.
*
* @param {string} task The Joomla task to perform.
* @param {string} [key] Optional key for install-related tasks.
*
* @return {boolean} Returns true if the form submission proceeds, false otherwise.
* @since 5.1.3
*/
Joomla.submitbutton = function (task, key = '') {
// Abort early if task is not provided
if (!task) {
console.warn('Joomla.submitbutton: No task provided.');
return false;
} else {
var component = document.getElementById('component_id').value;
var isValid = true;
}
if (component === '' && task === 'compiler.compiler') {
isValid = false;
}
if (isValid) {
document.getElementById('form').style.display = 'none';
var form = document.getElementById('adminForm');
if (task === 'compiler.installCompiledModule' || task === 'compiler.installCompiledPlugin') {
form.install_item_id.value = key;
}
form.task.value = task;
setTimeout(function() {
form.submit();
}, 100);
const form = document.getElementById('adminForm');
if (!form) {
console.error('Joomla.submitbutton: #adminForm not found.');
return false;
}
if (task === 'compiler.compiler') {
let component_name = document.querySelector("#component_id option:checked").textContent;
document.querySelectorAll(".component-name").forEach(elem => {
elem.textContent = component_name;
});
setTimeout(function() {
document.getElementById('compiler').style.display = 'block';
document.getElementById('compiling').style.display = 'block';
setTimeout(function() {
document.getElementById('compiler-spinner').style.display = 'block';
document.getElementById('compiler-notice').style.display = 'block';
}, 100);
}, 100);
} else if (task === 'compiler.clearTmp') {
document.getElementById('clear').style.display = 'block';
document.getElementById('loading').style.display = 'block';
} else if (task === 'compiler.getCompilerAnimations') {
document.getElementById('get-compiler-animations').style.display = 'block';
document.getElementById('loading').style.display = 'block';
} else {
document.getElementById('loading').style.display = 'block';
}
return true;
const componentField = document.getElementById('component_id');
const component = componentField ? componentField.value.trim() : '';
const isCompilerTask = task === 'compiler.compiler';
let isValid = true;
// Validate component selection for compilation
if (!component && isCompilerTask) {
isValid = false;
}
if (!isValid) {
document.querySelectorAll('.notice').forEach(elem => {
elem.style.display = 'block';
});
console.warn('Joomla.submitbutton: Component not selected.');
return false;
}
// Hide form while processing
const formContainer = document.getElementById('form');
if (formContainer) {
formContainer.style.display = 'none';
}
// Handle install tasks with key assignment
if (task === 'compiler.installCompiledModule' || task === 'compiler.installCompiledPlugin') {
if (form.install_item_id) {
form.install_item_id.value = key;
} else {
document.querySelectorAll('.notice').forEach(elem => {
elem.style.display = 'block';
});
return false;
console.warn('Joomla.submitbutton: install_item_id field not found.');
}
}
}
// Set the task and safely submit
form.task.value = task;
setTimeout(() => form.submit(), 100);
// UI update helper
const show = (id, delay = 0) => {
setTimeout(() => {
const el = document.getElementById(id);
if (el) el.style.display = 'block';
}, delay);
};
// Manage contextual UI loading animations
switch (task) {
case 'compiler.compiler': {
const selectedOption = document.querySelector('#component_id option:checked');
const componentName = selectedOption ? selectedOption.textContent.trim() : '';
document.querySelectorAll('.component-name').forEach(elem => {
elem.textContent = componentName;
});
show('compiler', 100);
show('compiling', 100);
show('compiler-spinner', 200);
show('compiler-notice', 200);
break;
}
case 'compiler.clearTmp':
show('clear');
show('loading');
break;
case 'compiler.getCompilerAnimations':
show('get-compiler-animations');
show('loading');
break;
default:
show('loading');
break;
}
return true;
};
// Add spindle-wheel for importations:
document.addEventListener('DOMContentLoaded', function() {
@@ -135,6 +199,14 @@ document.addEventListener('DOMContentLoaded', function() {
outerBodyDiv.appendChild(compilingDiv);
});
</script>
<?php if (empty($this->Components)): ?>
<?php echo $this->loadTemplate('nocomponentstocompile'); ?>
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&view=compiler'); ?>"
method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<input type="hidden" name="task" value="" />
<?php echo Html::_('form.token'); ?>
</form>
<?php else: ?>
<div class="main-card p-md-3">
<?php if (StringHelper::check($this->SuccessMessage)): ?>
<div class="alert alert-success">
@@ -258,7 +330,8 @@ function JRouter(link) {
?>
return url+link;
}
</script>
</script>
<?php endif; ?>
<?php else: ?>
<h1><?php echo Text::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
<?php endif; ?>
@@ -0,0 +1,42 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
// No direct access to this file
defined('_JEXEC') or die;
?>
<div class="container my-5">
<div class="p-5 bg-light border rounded-4 shadow-sm text-center position-relative overflow-hidden">
<div class="position-absolute top-0 start-0 w-100 h-100 bg-warning bg-opacity-10"></div>
<div class="position-relative">
<div class="mb-3">
<i class="bi bi-box-seam display-4 text-warning"></i>
</div>
<h3 class="fw-semibold mb-2"><?php echo Text::_('COM_COMPONENTBUILDER_NO_COMPONENTS_TO_COMPILE'); ?></h3>
<p class="lead text-muted mb-4">
<?php echo Text::_('COM_COMPONENTBUILDER_THERE_ARE_CURRENTLY_NO_COMPONENTS_AVAILABLE_FOR_COMPILATION'); ?><br>
<?php echo Text::_('COM_COMPONENTBUILDER_PLEASE_CREATE_ONE_OR_MORE_COMPONENTS_BEFORE_ATTEMPTING_TO_COMPILE'); ?>
</p>
<a href="index.php?option=com_componentbuilder&view=joomla_components" class="btn btn-primary btn-lg px-4">
<i class="bi bi-plus-circle me-2"></i>
<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_COMPONENT'); ?>
</a>
</div>
</div>
<div class="mt-4">
<?php echo LayoutHelper::render('jcbnoticeboard', ['dankie' => $this->dankie]); ?>
</div>
</div>
@@ -11,8 +11,8 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
// No direct access to this file
defined('_JEXEC') or die;
@@ -11,6 +11,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
// No direct access to this file
@@ -11,6 +11,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
// No direct access to this file
+29 -10
View File
@@ -370,19 +370,38 @@ var select_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_SELECT_A_SNIPPE
var create_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_SNIPPET'); ?>';
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
document.addEventListener("DOMContentLoaded", function() {
+29 -10
View File
@@ -308,19 +308,38 @@ jQuery('#adminForm').on('change', '#jform_fieldtype',function (e) {
});
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
<?php
@@ -11,9 +11,9 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Session\Session;
@@ -11,6 +11,7 @@
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
// No direct access to this file
+29 -10
View File
@@ -417,19 +417,38 @@ var select_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_SELECT_A_SNIPPE
var create_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_SNIPPET'); ?>';
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
<?php
+29 -10
View File
@@ -207,19 +207,38 @@ jQuery(document).ready(function() {
var select_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_SELECT_A_SNIPPET'); ?>';
var create_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_SNIPPET'); ?>';
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
<?php
+29 -10
View File
@@ -52,19 +52,38 @@ if ($this->saveOrder)
<script type="text/javascript">
// layouts footer script
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
// get page body
+29 -10
View File
@@ -66,19 +66,38 @@ $wa->useScript('core')
<script type="text/javascript">
// layouts footer script
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
// get page body
+29 -10
View File
@@ -396,19 +396,38 @@ var select_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_SELECT_A_SNIPPE
var create_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_SNIPPET'); ?>';
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
document.addEventListener("DOMContentLoaded", function() {
+29 -10
View File
@@ -212,19 +212,38 @@ jQuery(document).ready(function() {
var select_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_SELECT_A_SNIPPET'); ?>';
var create_a_snippet = '<?php echo Text::_('COM_COMPONENTBUILDER_CREATE_A_SNIPPET'); ?>';
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
<?php
+29 -10
View File
@@ -52,19 +52,38 @@ if ($this->saveOrder)
<script type="text/javascript">
// templates footer script
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
// get page body
+29 -10
View File
@@ -66,19 +66,38 @@ $wa->useScript('core')
<script type="text/javascript">
// templates footer script
HTMLElement.prototype.selText = function() {
var obj = this;
/**
* Select all text content within an HTMLElement.
*
* Adds a convenient `selText()` method to all HTMLElements.
* Works across modern browsers and gracefully handles errors.
*
* @return {HTMLElement} Returns the element itself for chaining.
* @since 5.1.3
*/
HTMLElement.prototype.selText = function () {
try {
const selection = window.getSelection();
if (!selection) {
console.warn('selText: window.getSelection() not supported in this environment.');
return this;
}
// For modern browsers, handle the selection
var selection = window.getSelection();
var range = document.createRange();
const range = document.createRange();
range.selectNodeContents(this);
// Select the content of the element
range.selectNodeContents(obj);
selection.removeAllRanges(); // Clear any previous selections
selection.addRange(range); // Add the new selection range
selection.removeAllRanges(); // clear any prior selections
selection.addRange(range); // select the element's text content
return this;
// Optionally bring the element into view if it's outside viewport
if (typeof this.scrollIntoView === 'function') {
this.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
} catch (error) {
console.error('selText failed:', error);
}
return this;
};
// get page body