Release of v3.2.3-alpha2
Fix missing scripts and styles fields and methods in the site admin view model. Update subform field layout across JCB for cleaner look. Remove expansion feature. Fix helper area.
This commit is contained in:
@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Admin_views Admin Controller
|
||||
@ -114,59 +112,4 @@ class ComponentbuilderControllerAdmin_views extends AdminController
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=admin_views', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=admin_views', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('admin_views.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -521,60 +521,6 @@ class ComponentbuilderControllerCompiler extends AdminController
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=compiler', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('compiler.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear tmp folder
|
||||
*
|
||||
|
@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Custom_codes Admin Controller
|
||||
@ -114,59 +112,4 @@ class ComponentbuilderControllerCustom_codes extends AdminController
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=custom_codes', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=custom_codes', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('custom_codes.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Dynamic_gets Admin Controller
|
||||
@ -114,59 +112,4 @@ class ComponentbuilderControllerDynamic_gets extends AdminController
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=dynamic_gets', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('dynamic_gets.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Fields Admin Controller
|
||||
@ -114,59 +112,4 @@ class ComponentbuilderControllerFields extends AdminController
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=fields', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=fields', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('fields.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -22,7 +22,6 @@ use VDM\Joomla\Componentbuilder\Package\Factory as PackageFactory;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Joomla_components Admin Controller
|
||||
@ -117,60 +116,6 @@ class ComponentbuilderControllerJoomla_components extends AdminController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_components', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('joomla_components.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear tmp folder
|
||||
*
|
||||
|
@ -18,8 +18,6 @@ use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Joomla_plugins Admin Controller
|
||||
@ -51,60 +49,6 @@ class ComponentbuilderControllerJoomla_plugins extends AdminController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=joomla_plugins', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('joomla_plugins.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get Boilerplate
|
||||
*
|
||||
|
@ -18,10 +18,8 @@ use Joomla\CMS\MVC\Controller\AdminController;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Powers Admin Controller
|
||||
@ -52,60 +50,6 @@ class ComponentbuilderControllerPowers extends AdminController
|
||||
return parent::getModel($name, $prefix, $config);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=powers', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('powers.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all remote powers and syncs them with the local database.
|
||||
*
|
||||
|
@ -20,8 +20,6 @@ use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
|
||||
use VDM\Joomla\Utilities\ObjectHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* Validation_rules Admin Controller
|
||||
@ -114,59 +112,4 @@ class ComponentbuilderControllerValidation_rules extends AdminController
|
||||
$this->setRedirect(Route::_('index.php?option=com_componentbuilder&view=validation_rules', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It checks whether the current user has the necessary permissions to run the expansion module.
|
||||
* 3. If the user is authorized, it attempts to run the expansion via an API call.
|
||||
* 4. Depending on the result of the expansion operation, it sets the appropriate success or error message.
|
||||
* 5. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful expansion, false on failure.
|
||||
*/
|
||||
public function runExpansion()
|
||||
{
|
||||
// Check for request forgeries
|
||||
Session::checkToken() or die(Text::_('JINVALID_TOKEN'));
|
||||
|
||||
// check if user has the right
|
||||
$user = Factory::getUser();
|
||||
|
||||
// set page redirect
|
||||
$redirect_url = Route::_('index.php?option=com_componentbuilder&view=validation_rules', false);
|
||||
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE');
|
||||
|
||||
// check if this user has the right to run expansion
|
||||
if($user->authorise('validation_rules.run_expansion', 'com_componentbuilder'))
|
||||
{
|
||||
// set massage
|
||||
$message = Text::_('COM_COMPONENTBUILDER_EXPANSION_FAILED_PLEASE_CHECK_YOUR_SETTINGS_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TAB');
|
||||
|
||||
// run expansion via API
|
||||
$result = ComponentbuilderHelper::getFileContents(Uri::root() . 'index.php?option=com_componentbuilder&task=api.expand');
|
||||
|
||||
// is there a message returned
|
||||
if (!is_numeric($result) && StringHelper::check($result))
|
||||
{
|
||||
$this->setRedirect($redirect_url, $result);
|
||||
return true;
|
||||
}
|
||||
elseif (is_numeric($result) && 1 == $result)
|
||||
{
|
||||
$message = Text::_('COM_COMPONENTBUILDER_BTHE_EXPANSION_WAS_SUCCESSFULLYB_TO_SEE_MORE_INFORMATION_CHANGE_THE_BRETURN_OPTIONS_FOR_BUILDB_TO_BDISPLAY_MESSAGEB_IN_THE_GLOBAL_OPTIONS_OF_JCB_UNDER_THE_DEVELOPMENT_METHOD_TABB');
|
||||
$this->setRedirect($redirect_url, $message, 'message');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user