Release of v6.1.2
Add Joomla 6 build option. Fix the template and layout linker for packages. Add native module builder for Joomla 4/5. Refactor dynamic get methods into dedicated classes. Move Joomla DB handling into compiler injector flow. Fix auto-check(in) method for Joomla 4/5 compatibility. Migrates view HTML classes to use getModel() directly instead of the deprecated magic get() calls to model methods. Refactores event handling (contentPrepare, titlePrepare, contentBeforeDisplay, contentAfterDisplay) to use Joomla 5's native event dispatcher via the model's new getDispatcher() method. Updates table classes to properly support NULL values, both in the store() method and in table variable definitions. #1245. Extractes the setAutoCheckIn() and setCheckInCall() logic into a dedicated CheckInNow class for cleaner design. Replace all direct $app->input property calls with the recommended $app->getInput() method across the entire codebase. Add Joomla 6 build option :). Fix Custom Rule Validation Bug. Unpublish Joomla 6 Backward Compatibility Plugin. Refactors the Compiler Model by dropping deprecated calls and adopting Joomla 5+ conventions. Refactors Compiler Controller to remove deprecated usage and follow Joomla 5+ best practices. Adds check to ensure expert mode subforms in the Demo Component remain set and unchanged when user lacks edit permissions. Improves validation handling of Fields by ensuring field validation rules are properly registered. Replace StringHelper with the correct Super Power key so it loads in the Compiler Controller. Add functionality to add component changelog into the package if configured. Refactor PHP classes for building HTML view files in admin and site views to align with Joomla 5+ standards. Fix issues in the site view HtmlView caused by the refactor, including missing class calls and outdated function references. Fix issue where the DatabaseSchemaCheckAll pulled all Component Builder tables into DB on install. #1253. Fix issue in the Dynamic Get when the value key is 0 it wouldn't add the 'WHERE' statement to the generated code. #1254. Change radio buttons with a empty option to save Datatype CHAR instead of TINYINT as other radio buttons. #1252. Add extra xml details to Modules built with JCB that adds advance options to the module. #1248. Remove setDocumentTitle method from the admin view since it is not being used by Joomla. #1255. Refactor compiler Move file update to classes. Refactor compiler Move plugin and module fields and rules files mover to classes. Fix issue where custom powers was not added to PowerloaderHelper. #1256. Fix normalization issue when compiling on Windows systems. #1219. Fix installer issue on Joomla 6 where components containing multiple plugins failed during installation. Completely refactors the Compiler Dashboard to align with Joomla 5+ architecture and Bootstrap 5 standards. Add a default VARCHAR(36) length to easily create fields intended to store GUID values. Update the file uploader in the Demo Component for more dynamic file display and naming. Update the SQL file dump generator to handle large SQL dumps in batches, ensuring safe and reliable database imports. Update example hints in the field expert mode options.
This commit is contained in:
747 files changed
+57518
-19469
No files matched your search
@@ -105,7 +105,7 @@ class AjaxController extends BaseController
|
||||
// get the user for later use
|
||||
$user = $this->app->getIdentity();
|
||||
// get the input values
|
||||
$jinput = $this->input ?? $this->app->input;
|
||||
$jinput = $this->input ?? (method_exists($this->app, 'getInput') ? $this->app->getInput() : $this->app->input);
|
||||
// check if we should return raw (DEFAULT TRUE SINCE J4)
|
||||
$returnRaw = $jinput->get('raw', true, 'BOOLEAN');
|
||||
// return to a callback function
|
||||
|
||||
@@ -17,14 +17,14 @@ use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
|
||||
use Joomla\CMS\Version;
|
||||
use VDM\Joomla\Componentbuilder\File\Factory as FileFactory;
|
||||
use VDM\Joomla\Componentbuilder\Import\Factory as ImportFactory;
|
||||
use VDM\Joomla\Abstraction\Console\Import;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
|
||||
// No direct access to this file
|
||||
\defined('_JEXEC') or die;
|
||||
@@ -55,7 +55,7 @@ class CompilerController extends AdminController
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getModel($name = '###View###', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
public function getModel($name = 'Compiler', $prefix = 'Administrator', $config = ['ignore_request' => true])
|
||||
{
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
@@ -84,14 +84,15 @@ class CompilerController extends AdminController
|
||||
/**
|
||||
* get all the animations used in the compiler
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool true on success
|
||||
* @since 3.10
|
||||
*/
|
||||
public function getDynamicContent()
|
||||
public function getDynamicContent(): bool
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_DOWNLOAD_THE_COMPILER_ANIMATIONS');
|
||||
@@ -99,7 +100,7 @@ class CompilerController extends AdminController
|
||||
if($user->authorise('compiler.compiler_animations', 'com_componentbuilder'))
|
||||
{
|
||||
// get the model
|
||||
$model = $this->getModel('compiler');
|
||||
$model = $this->getModel('Compiler');
|
||||
if ($model->getDynamicContent($message))
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BALL_THE_COMPILER_ANIMATIONS_WERE_SUCCESSFULLY_DOWNLOADED_TO_THIS_JOOMLA_INSTALLB');
|
||||
@@ -114,234 +115,84 @@ class CompilerController extends AdminController
|
||||
/**
|
||||
* Run the Compiler
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool True on success, false otherwise.
|
||||
* @since 5.1.2
|
||||
*/
|
||||
public function compiler()
|
||||
public function compiler(): bool
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
// currently only those with admin access can compile a component
|
||||
if($user->authorise('core.manage', 'com_componentbuilder'))
|
||||
// Access control (admins only)
|
||||
$user = $this->app->getIdentity();
|
||||
if (!$user->authorise('core.manage', 'com_componentbuilder'))
|
||||
{
|
||||
$model = $this->getModel('compiler');
|
||||
if ($model->builder())
|
||||
{
|
||||
$cache = Factory::getCache('mod_menu');
|
||||
$cache->clean();
|
||||
// TODO: Reset the users acl here as well to kill off any missing bits
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// switch to set multi install button
|
||||
$add_multi_install = false;
|
||||
$add_plugin_install = false;
|
||||
$add_module_install = false;
|
||||
// get application
|
||||
$app = Factory::getApplication();
|
||||
// set redirection URL
|
||||
$redirect_url = $app->getUserState('com_componentbuilder.redirect_url');
|
||||
// get system messages
|
||||
$message = $app->getUserState('com_componentbuilder.message');
|
||||
if (empty($redirect_url) && CFactory::_('Config')->component_id > 0)
|
||||
{
|
||||
// start new message
|
||||
$message = array();
|
||||
// update the redirection URL
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
if (($pos = strpos($model->compiler->filepath['component'], "/tmp/")) !== FALSE)
|
||||
{
|
||||
$url = Uri::root() . substr($model->compiler->filepath['component'], $pos + 1);
|
||||
}
|
||||
// check if we have plugins
|
||||
$add_plugin_install = UtilitiesArrayHelper::check($model->compiler->filepath['plugins'], true);
|
||||
// check if we have modules
|
||||
$add_module_install = UtilitiesArrayHelper::check($model->compiler->filepath['modules'], true);
|
||||
// if a multi install we set another kind of header
|
||||
if ($add_plugin_install || $add_module_install)
|
||||
{
|
||||
// Message of successful builds
|
||||
$message[] = '<h1>The Extensions were Successfully Compiled!</h1>';
|
||||
$message[] = '<h4>You can install any one of the following extensions!</h4>';
|
||||
// set multi install
|
||||
$add_multi_install = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Message of successful build
|
||||
$message[] = '<h1>The (' . $model->compiler->filepath['component-folder'] . ') was Successfully Compiled!</h1>';
|
||||
}
|
||||
|
||||
if (CFactory::_('Config')->joomla_version == Version::MAJOR_VERSION)
|
||||
{
|
||||
$message[] = '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledComponent\')">';
|
||||
$message[] = 'Install ' . $model->compiler->filepath['component-folder'] . ' on this <span class="icon-joomla icon-white"></span>Joomla website. (component)</button></p>';
|
||||
// check if we have modules
|
||||
if ($add_module_install)
|
||||
{
|
||||
foreach ($model->compiler->filepath['modules-folder'] as $module_id => $module_folder)
|
||||
{
|
||||
$message[] = '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledModule\', ' . (int) $module_id . ')">';
|
||||
$message[] = 'Install ' . $module_folder . ' on this <span class="icon-joomla icon-white"></span>Joomla website. (module)</button></p>';
|
||||
}
|
||||
}
|
||||
// check if we have plugins
|
||||
if ($add_plugin_install)
|
||||
{
|
||||
foreach ($model->compiler->filepath['plugins-folder'] as $plugin_id => $plugin_folder)
|
||||
{
|
||||
$message[] = '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledPlugin\', ' . (int) $plugin_id . ')">';
|
||||
$message[] = 'Install ' . $plugin_folder . ' on this <span class="icon-joomla icon-white"></span>Joomla website. (plugin)</button></p>';
|
||||
}
|
||||
}
|
||||
// set multi install button
|
||||
if ($add_multi_install)
|
||||
{
|
||||
$message[] = '<h4>You can install all compiled extensions!</h4>';
|
||||
$message[] = '<p><button class="btn btn-small btn-success" onclick="Joomla.submitbutton(\'compiler.installCompiledExtensions\')">';
|
||||
$message[] = 'Install all above extensions on this <span class="icon-joomla icon-white"></span>Joomla! website.</button></p>';
|
||||
}
|
||||
}
|
||||
$message[] = '<h2>Total time saved</h2>';
|
||||
$message[] = '<ul>';
|
||||
$message[] = '<li>Total folders created: <b>#'.'##FOLDER_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>Total files created: <b>#'.'##FILE_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>Total fields created: <b>#'.'##FIELD_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>Total lines written: <b>#'.'##LINE_COUNT##'.'#</b></li>';
|
||||
$message[] = '<li>A4 Book of: <b>#'.'##PAGE_COUNT##'.'# pages</b></li>';
|
||||
$message[] = '</ul>';
|
||||
$message[] = '<p><b>#'.'##totalHours##'.'# Hours</b> or <b>#'.'##totalDays##'.'# Eight Hour Days</b> <em>(actual time you saved)</em><br />';
|
||||
$message[] = '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, never making one mistake or taking any coffee break.)</small><br />';
|
||||
$message[] = '<b>#'.'##actualHoursSpent##'.'# Hours</b> or <b>#'.'##actualDaysSpent##'.'# Eight Hour Days</b> <em>(the actual time you spent)</em><br />';
|
||||
$message[] = '<small>(with the following break down: <b>debugging @#'.'##debuggingHours##'.'#hours</b> = codingtime / 4; <b>planning @#'.'##planningHours##'.'#hours</b> = codingtime / 7; <b>mapping @#'.'##mappingHours##'.'#hours</b> = codingtime / 10; <b>office @#'.'##officeHours##'.'#hours</b> = codingtime / 6;)</small></p>';
|
||||
$message[] = '<p><b>#'.'##actualTotalHours##'.'# Hours</b> or <b>#'.'##actualTotalDays##'.'# Eight Hour Days</b> <em>(a total of the realistic time frame for this project)</em><br />';
|
||||
$message[] = '<small>(if creating a folder and file took <b>5 seconds</b> and writing one line of code took <b>10 seconds</b>, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)</small></p>';
|
||||
$message[] = '<p>Project duration: <b>'.$model->compiler->projectWeekTime. ' weeks</b> or <b>#'.'##projectMonthTime##'.'# months</b></p>';
|
||||
// check if we have modules or plugins
|
||||
if ($add_multi_install)
|
||||
{
|
||||
$message[] = '<h2>Path to Zip Files</h2>';
|
||||
$message[] = '<p><b>Component Path:</b> <code>' . $model->compiler->filepath['component'] . '</code><br />';
|
||||
$message[] = '<b>Component URL:</b> <code>' . $url . '</code><br /><br />';
|
||||
// load modules if found
|
||||
if ($add_module_install)
|
||||
{
|
||||
$module_urls = array();
|
||||
// load the modules path/url
|
||||
foreach ($model->compiler->filepath['modules'] as $module_id => $module_path)
|
||||
{
|
||||
// set module path
|
||||
$message[] = '<b>Module Path:</b> <code>' . $module_path . '</code><br />';
|
||||
if (($pos = strpos($module_path, "/tmp/")) !== FALSE)
|
||||
{
|
||||
$module_urls[$module_id] = Uri::root() . substr($module_path, $pos + 1);
|
||||
$message[] = '<b>Module URL:</b> <code>' . $module_urls[$module_id] . '</code><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
// load plugins if found
|
||||
if ($add_plugin_install)
|
||||
{
|
||||
$plugin_urls = array();
|
||||
// load the plugins path/url
|
||||
foreach ($model->compiler->filepath['plugins'] as $plugin_id => $plugin_path)
|
||||
{
|
||||
// set plugin path
|
||||
$message[] = '<b>Plugin Path:</b> <code>' . $plugin_path . '</code><br />';
|
||||
if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE)
|
||||
{
|
||||
$plugin_urls[$plugin_id] = Uri::root() . substr($plugin_path, $pos + 1);
|
||||
$message[] = '<b>Plugin URL:</b> <code>' . $plugin_urls[$plugin_id] . '</code><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
$message[] = '<br /><small>Hey! you can also download these zip files right now!</small><br />';
|
||||
$message[] = '<a class="btn btn-success" href="' . $url . '" ><span class="icon-download icon-white"></span>Download Component</a> ';
|
||||
// load the module download URL's
|
||||
if (isset($module_urls) && UtilitiesArrayHelper::check($module_urls))
|
||||
{
|
||||
foreach ($module_urls as $module_id => $module_url)
|
||||
{
|
||||
$message[] = ' <a class="btn btn-success" href="' . $module_url . '" >';
|
||||
$message[] = '<span class="icon-download icon-white"></span>Download ' . $model->compiler->filepath['modules-folder'][$module_id] . '</a> ';
|
||||
}
|
||||
}
|
||||
// load the plugin download URL's
|
||||
if (isset($plugin_urls) && UtilitiesArrayHelper::check($plugin_urls))
|
||||
{
|
||||
foreach ($plugin_urls as $plugin_id => $plugin_url)
|
||||
{
|
||||
$message[] = ' <a class="btn btn-success" href="' . $plugin_url . '" >';
|
||||
$message[] = '<span class="icon-download icon-white"></span>Download ' . $model->compiler->filepath['plugins-folder'][$plugin_id] . '</a> ';
|
||||
}
|
||||
}
|
||||
$message[] = '</p>';
|
||||
$message[] = '<p><small><b>Remember!</b> These zip files are in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small></p>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$message[] = '<h2>Path to Zip File</h2>';
|
||||
$message[] = '<p><b>Path:</b> <code>' . $model->compiler->filepath['component'] . '</code><br />';
|
||||
$message[] = '<b>URL:</b> <code>' . $url . '</code><br /><br />';
|
||||
$message[] = '<small>Hey! you can also download the zip file right now!</small><br />';
|
||||
$message[] = '<a class="btn btn-success" href="' . $url . '" ><span class="icon-download icon-white"></span>Download</a></p>';
|
||||
$message[] = '<p><small><b>Remember!</b> This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!</small> </p>';
|
||||
}
|
||||
$message[] = '<p><small>Compilation took <b>#'.'##COMPILER_TIMER##'.'#</b> seconds to complete.</small> </p>';
|
||||
// pass the message via the user state... wow this is painful
|
||||
$app->setUserState('com_componentbuilder.success_message',
|
||||
CFactory::_('Placeholder')->update(
|
||||
implode(PHP_EOL, $message),
|
||||
CFactory::_('Compiler.Builder.Content.One')->allActive()
|
||||
)
|
||||
);
|
||||
// set redirect
|
||||
$this->setRedirect($redirect_url, '<h2>Successful Build!</h2>', 'message');
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']);
|
||||
// check if we have modules
|
||||
if ($add_module_install)
|
||||
{
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', $model->compiler->filepath['modules-folder']);
|
||||
}
|
||||
// check if we have plugins
|
||||
if ($add_plugin_install)
|
||||
{
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', $model->compiler->filepath['plugins-folder']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// wipe out the user state when we're going to redirect
|
||||
$app->setUserState('com_componentbuilder.redirect_url', '');
|
||||
$app->setUserState('com_componentbuilder.message', '');
|
||||
$app->setUserState('com_componentbuilder.extension_message', '');
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
// set redirect
|
||||
$this->setRedirect($redirect_url, $message);
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
$model = $this->getModel('Compiler');
|
||||
if (!$model->builder())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Clear menu cache (same as before) TODO: remove if not needed, lets see
|
||||
// $cache = Factory::getCache('mod_menu');
|
||||
// $cache->clean();
|
||||
$redirectUrl = (string) $this->app->getUserState('com_componentbuilder.redirect_url');
|
||||
$message = $this->app->getUserState('com_componentbuilder.message');
|
||||
if (empty($redirectUrl) && CompilerFactory::_('Config')->component_id > 0)
|
||||
{
|
||||
$hasPlugins = UtilitiesArrayHelper::check($model->compiler->filepath['plugins'] ?? [], true);
|
||||
$hasModules = UtilitiesArrayHelper::check($model->compiler->filepath['modules'] ?? [], true);
|
||||
$redirect = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
|
||||
// Build the success payload (messages + UI)
|
||||
$success_message = LayoutHelper::render('jcbbuildersuccessmessage', $model);
|
||||
// Persist message to user state (as before) with your placeholder flow
|
||||
$this->app->setUserState(
|
||||
'com_componentbuilder.success_message',
|
||||
CompilerFactory::_('Placeholder')->update(
|
||||
$success_message, CompilerFactory::_('Compiler.Builder.Content.One')->allActive()
|
||||
)
|
||||
);
|
||||
// Set redirect target and flash message
|
||||
$this->setRedirect($redirect, '<h2>' . Text::_('COM_COMPONENTBUILDER_SUCCESSFUL_BUILD') . '</h2>', 'message');
|
||||
// Persist names for follow-up UI (unchanged)
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder'] ?? '');
|
||||
if ($hasModules)
|
||||
{
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', $model->compiler->filepath['modules-folder'] ?? []);
|
||||
}
|
||||
if ($hasPlugins)
|
||||
{
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', $model->compiler->filepath['plugins-folder'] ?? []);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset state on redirect (unchanged behavior)
|
||||
$this->app->setUserState('com_componentbuilder.redirect_url', '');
|
||||
$this->app->setUserState('com_componentbuilder.message', '');
|
||||
$this->app->setUserState('com_componentbuilder.extension_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->setRedirect($redirectUrl, $message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install All Compiled Extensions
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool true on success
|
||||
* @since 3.10
|
||||
*/
|
||||
public function installCompiledExtensions()
|
||||
public function installCompiledExtensions(): bool
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS');
|
||||
@@ -349,21 +200,20 @@ class CompilerController extends AdminController
|
||||
if($user->authorise('core.manage'))
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENSIONS');
|
||||
$_message = array('success' => array(), 'error' => array());
|
||||
$app = Factory::getApplication();
|
||||
$_message = ['success' => [], 'error' => []];
|
||||
// start file name array
|
||||
$fileNames = array();
|
||||
$fileNames[] = $app->getUserState('com_componentbuilder.component_folder_name', null);
|
||||
$fileNames = [];
|
||||
$fileNames[] = $this->app->getUserState('com_componentbuilder.component_folder_name', null);
|
||||
// check if we have modules
|
||||
$fileNames = UtilitiesArrayHelper::merge(array($fileNames, $app->getUserState('com_componentbuilder.modules_folder_name', array()) ));
|
||||
$fileNames = UtilitiesArrayHelper::merge([$fileNames, $this->app->getUserState('com_componentbuilder.modules_folder_name', [])]);
|
||||
// check if we have plugins
|
||||
$fileNames = UtilitiesArrayHelper::merge(array($fileNames, $app->getUserState('com_componentbuilder.plugins_folder_name', array()) ));
|
||||
$fileNames = UtilitiesArrayHelper::merge([$fileNames, $this->app->getUserState('com_componentbuilder.plugins_folder_name', [])]);
|
||||
|
||||
// wipe out the user c-m-p since we are done with them all
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
|
||||
// loop and install all extensions found
|
||||
foreach ($fileNames as $fileName)
|
||||
@@ -377,11 +227,13 @@ class CompilerController extends AdminController
|
||||
$_message['error'][] = Text::sprintf('COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED', $fileName);
|
||||
}
|
||||
}
|
||||
|
||||
// catch errors
|
||||
if (UtilitiesArrayHelper::check($_message['error']))
|
||||
{
|
||||
$app->enqueueMessage(implode('<br />', $_message['error']), 'Error');
|
||||
$this->app->enqueueMessage(implode('<br />', $_message['error']), 'Error');
|
||||
}
|
||||
|
||||
// build success message
|
||||
if (UtilitiesArrayHelper::check($_message['success']))
|
||||
{
|
||||
@@ -396,14 +248,15 @@ class CompilerController extends AdminController
|
||||
/**
|
||||
* Install Compiled Component
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool true on success
|
||||
* @since 3.10
|
||||
*/
|
||||
public function installCompiledComponent()
|
||||
public function installCompiledComponent(): bool
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT');
|
||||
@@ -411,14 +264,13 @@ class CompilerController extends AdminController
|
||||
if($user->authorise('core.manage'))
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT');
|
||||
$app = Factory::getApplication();
|
||||
$fileName = $app->getUserState('com_componentbuilder.component_folder_name');
|
||||
$fileName = $this->app->getUserState('com_componentbuilder.component_folder_name');
|
||||
|
||||
// wipe out the user c-m-p since we are done with them all
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
|
||||
if ($this->installExtension($fileName))
|
||||
{
|
||||
@@ -434,14 +286,15 @@ class CompilerController extends AdminController
|
||||
/**
|
||||
* Install Compiled Module
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool true on success
|
||||
* @since 3.10
|
||||
*/
|
||||
public function installCompiledModule()
|
||||
public function installCompiledModule(): bool
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_MODULE');
|
||||
@@ -449,19 +302,17 @@ class CompilerController extends AdminController
|
||||
if($user->authorise('core.manage'))
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_MODULE');
|
||||
$app = Factory::getApplication();
|
||||
$fileNames = $app->getUserState('com_componentbuilder.modules_folder_name');
|
||||
$fileNames = $this->app->getUserState('com_componentbuilder.modules_folder_name');
|
||||
|
||||
// wipe out the user c-m-p since we are done with them all
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
|
||||
if (UtilitiesArrayHelper::check($fileNames))
|
||||
{
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$moduleId = $jinput->post->get('install_item_id', 0, 'INT');
|
||||
$moduleId = $this->input->post->get('install_item_id', 0, 'INT');
|
||||
if ($moduleId > 0 && isset($fileNames[$moduleId]) && $this->installExtension($fileNames[$moduleId]))
|
||||
{
|
||||
$message = Text::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$moduleId]);
|
||||
@@ -477,14 +328,15 @@ class CompilerController extends AdminController
|
||||
/**
|
||||
* Install Compiled Plugin
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool true on success
|
||||
* @since 3.10
|
||||
*/
|
||||
public function installCompiledPlugin()
|
||||
public function installCompiledPlugin(): bool
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN');
|
||||
@@ -492,19 +344,17 @@ class CompilerController extends AdminController
|
||||
if($user->authorise('core.manage'))
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN');
|
||||
$app = Factory::getApplication();
|
||||
$fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name');
|
||||
$fileNames = $this->app->getUserState('com_componentbuilder.plugins_folder_name');
|
||||
|
||||
// wipe out the user c-m-p since we are done with them all
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
|
||||
if (UtilitiesArrayHelper::check($fileNames))
|
||||
{
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$pluginId = $jinput->post->get('install_item_id', 0, 'INT');
|
||||
$pluginId = $this->input->post->get('install_item_id', 0, 'INT');
|
||||
if ($pluginId > 0 && isset($fileNames[$pluginId]) && $this->installExtension($fileNames[$pluginId]))
|
||||
{
|
||||
$message = Text::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$pluginId]);
|
||||
@@ -520,31 +370,28 @@ class CompilerController extends AdminController
|
||||
/**
|
||||
* Install Extension
|
||||
*
|
||||
* @return true on success
|
||||
* @return bool true on success
|
||||
* @since 3.10
|
||||
*/
|
||||
protected function installExtension($fileName)
|
||||
protected function installExtension($fileName): bool
|
||||
{
|
||||
// check that the model is set
|
||||
if (!isset($this->_compiler_model))
|
||||
{
|
||||
// get the compiler model
|
||||
$this->_compiler_model = $this->getModel('compiler');
|
||||
}
|
||||
$compiler_model = $this->getModel('Compiler');
|
||||
|
||||
// set the language if not set
|
||||
if (!isset($this->_installer_lang))
|
||||
{
|
||||
$this->_installer_lang = Factory::getLanguage();
|
||||
$extension = 'com_installer';
|
||||
$base_dir = JPATH_ADMINISTRATOR;
|
||||
$language_tag = 'en-GB';
|
||||
$reload = true;
|
||||
$this->_installer_lang->load($extension, $base_dir, $language_tag, $reload);
|
||||
}
|
||||
$installer_lang = $this->app->getLanguage();
|
||||
$extension = 'com_installer';
|
||||
$base_dir = JPATH_ADMINISTRATOR;
|
||||
$language_tag = 'en-GB';
|
||||
$reload = true;
|
||||
$installer_lang->load($extension, $base_dir, $language_tag, $reload);
|
||||
|
||||
// make sure we have a string
|
||||
if (StringHelper::check($fileName))
|
||||
{
|
||||
return $this->_compiler_model->install($fileName.'.zip');
|
||||
return $compiler_model->install($fileName.'.zip');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -560,7 +407,7 @@ class CompilerController extends AdminController
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
@@ -576,13 +423,12 @@ class CompilerController extends AdminController
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEARED_SUCCESSFULLYB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
// get application
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// wipe out the user c-m-p since we are done with them all
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ class HelpController extends BaseController
|
||||
|
||||
public function help()
|
||||
{
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
$jinput = Factory::getApplication()->input;
|
||||
$app = Factory::getApplication();
|
||||
$user = $app->getIdentity();
|
||||
$jinput = method_exists($app, 'getInput') ? $app->getInput() : $app->input;
|
||||
// Check Token!
|
||||
$token = Session::getFormToken();
|
||||
$call_token = $jinput->get('token', 0, 'ALNUM');
|
||||
|
||||
@@ -131,7 +131,7 @@ class Joomla_componentsController extends AdminController
|
||||
Session::checkToken() or \jexit(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
$user = $this->app->getIdentity();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
@@ -147,13 +147,12 @@ class Joomla_componentsController extends AdminController
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_TMP_FOLDER_HAS_BEEN_CLEARED_SUCCESSFULLYB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
// get application
|
||||
$app = Factory::getApplication();
|
||||
|
||||
// wipe out the user c-m-p since we are done with them all
|
||||
$app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$app->setUserState('com_componentbuilder.success_message', '');
|
||||
$this->app->setUserState('com_componentbuilder.component_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.modules_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.plugins_folder_name', '');
|
||||
$this->app->setUserState('com_componentbuilder.success_message', '');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user