Files
FHC-Core/application/controllers/system/extensions/Manager.php
T
Paolo 81e4f2968e Merge branch 'master' into permissions
- Added new core controller called Auth_Controller that extends FHC_Controller and manage the authentication
- All the controllers that were extending the CI_Controller now they extend the FHC_Controller
- All the controllers that were extending the FHC_Controller now they extend the Auth_Controller
- Added the method isAllowed to the FiltersLib to check if the authenticated user has the required permissions
- FilterWidget and controller Filters are using the method isAllowed from the FiltersLib
2018-06-08 17:53:12 +02:00

91 lines
1.6 KiB
PHP

<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Manager extends Auth_Controller
{
/**
*
*/
public function __construct()
{
parent::__construct(
array(
'index' => 'system/extensions:r',
'toggleExtension' => 'system/extensions:rw',
'delExtension' => 'system/extensions:rw',
'uploadExtension' => 'system/extensions:rw'
)
);
// Load helpers to upload files
$this->load->helper(array('form', 'url'));
// Loads the extensions library
$this->load->library('ExtensionsLib');
}
/**
*
*/
public function index()
{
$viewData = array(
'extensions' => $this->extensionslib->getInstalledExtensions()
);
$this->load->view('system/extensions/manager.php', $viewData);
}
/**
*
*/
public function toggleExtension()
{
$toggleExtension = false;
$extension_id = $this->input->post('extension_id');
$enabled = $this->input->post('enabled');
if ($enabled === 'true')
{
$toggleExtension = $this->extensionslib->enableExtension($extension_id);
}
else
{
$toggleExtension = $this->extensionslib->disableExtension($extension_id);
}
$this->output
->set_content_type('application/json')
->set_output(json_encode($toggleExtension));
}
/**
*
*/
public function delExtension()
{
$delExtension = false;
$extension_id = $this->input->post('extension_id');
$delExtension = $this->extensionslib->delExtension($extension_id);
$this->output
->set_content_type('application/json')
->set_output(json_encode($delExtension));
}
/**
*
*/
public function uploadExtension()
{
$this->extensionslib->installExtension();
}
}