Release of v5.0.1-alpha7
Add push options to Joomla Power. Complete the Joomla Power Init and Reset features. Fix Gitea Contents class functions. Last Alpha release (feature block).
This commit is contained in:
@ -58,27 +58,40 @@ class PowersController extends AdminController
|
||||
|
||||
|
||||
/**
|
||||
* Run the Expansion
|
||||
* Runs the expansion module.
|
||||
*
|
||||
* @return void
|
||||
* 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 \jexit(Text::_('JINVALID_TOKEN'));
|
||||
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))
|
||||
{
|
||||
@ -92,10 +105,23 @@ class PowersController extends AdminController
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setRedirect($redirect_url, $message, 'error');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all remote powers and syncs them with the local database.
|
||||
*
|
||||
* 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 initialize the powers.
|
||||
* 3. If the user is authorized, it attempts to initialize the remote powers.
|
||||
* 4. Depending on the result of the initialization 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 initialization, false on failure.
|
||||
*/
|
||||
public function initPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
@ -135,6 +161,21 @@ class PowersController extends AdminController
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selected powers.
|
||||
*
|
||||
* This function performs several checks and operations:
|
||||
* 1. It verifies the authenticity of the request to prevent request forgery.
|
||||
* 2. It retrieves the IDs of the selected powers from the user input.
|
||||
* 3. It sanitizes the input by converting the IDs to integers.
|
||||
* 4. It checks whether any powers have been selected.
|
||||
* 5. It checks whether the current user has the necessary permissions to reset the selected powers.
|
||||
* 6. If the user is authorized and powers are selected, it attempts to reset the selected powers.
|
||||
* 7. Depending on the result of the reset operation, it sets the appropriate success or error message.
|
||||
* 8. It redirects the user to a specified URL with the result message and status.
|
||||
*
|
||||
* @return bool True on successful reset, false on failure.
|
||||
*/
|
||||
public function resetPowers()
|
||||
{
|
||||
// Check for request forgeries
|
||||
|
Reference in New Issue
Block a user