| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/nimes/components/com_rsfeedback/controllers/ |
Upload File : |
<?php
/**
* @package RSFeedback!
* @copyright (C) 2010-2018 www.rsjoomla.com
* @license GPL, http://www.gnu.org/licenses/gpl.html
*/
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\MVC\Controller\FormController;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Factory;
class RSFeedbackControllerCategory extends FormController
{
protected function allowAdd($data = array()) {
$permissions = RSFeedbackHelper::getPermissions();
$id = Factory::getApplication()->input->get('id', 0,'int');
$url = Route::_('index.php?option=com_rsfeedback&view=category'.(!empty($id) ? '&id='.$id : ''), false);
$allowed = (empty($id) && $permissions['category_add']);
if (!$allowed) {
// Redirect back to the edit screen.
$this->setMessage(Text::_('COM_RSFEEDBACK_ADD_CATEGORY_PERMISSION_ERROR'), 'error');
$this->setRedirect($url);
return false;
}
return $allowed;
}
protected function allowEdit($data = array(), $key = 'id') {
$permissions = RSFeedbackHelper::getPermissions();
$id = Factory::getApplication()->input->get('id', 0,'int');
$url = Route::_('index.php?option=com_rsfeedback&view=category'.(!empty($id) ? '&id='.$id : ''), false);
$allowed = ($id && $permissions['category_edit']);
if (!$allowed) {
// Redirect back to the edit screen.
$this->setMessage(Text::_('COM_RSFEEDBACK_EDIT_CATEGORY_PERMISSION_ERROR'), 'error');
$this->setRedirect($url);
return false;
}
return $allowed;
}
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') {
$append = parent::getRedirectToItemAppend($recordId, $urlVar);
$itemId = Factory::getApplication()->input->getInt('Itemid');
$return = $this->getReturnPage();
if ($return) {
$append .= '&return='.base64_encode($return);
}
if ($itemId) {
$append .= '&Itemid='.$itemId;
}
return $append;
}
/**
* Get the return URL.
*
* If a "return" variable has been passed in the request
*
* @return string The return URL.
* @since 1.6
*/
protected function getReturnPage() {
$return = Factory::getApplication()->input->getBase64('return', null);
if (empty($return) || !Uri::isInternal(base64_decode($return))) {
$url = Uri::base();
}
else {
$url = base64_decode($return);
}
return $url;
}
/**
* Method to save a record.
*
* @param string $key The name of the primary key of the URL variable.
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
*
* @return Boolean True if successful, false otherwise.
* @since 1.6
*/
public function save($key = null, $urlVar = 'id') {
$permissions = RSFeedbackHelper::getPermissions();
$result = parent::save($key, $urlVar);
$tmpl = Factory::getApplication()->input->get('tmpl', '', 'cmd');
$tmpl = $tmpl ? '&tmpl='.$tmpl : '';
if ($result) {
if ($permissions['category_moderation'])
$this->setMessage(Text::_('COM_RSFEEDBACK_CATEGORY_SUCCESS_MODERATION_ON'));
// Redirect to feedbacks view
$this->setRedirect(Route::_('index.php?option=com_rsfeedback&view=feedbacks'.$tmpl, false));
}
}
public function cancel($key = null) {
$return = $this->getReturnPage();
// Redirect to the return page.
if ($return)
$this->setRedirect($return);
else {
// Redirect to edit feedback view
$return = $return ? '&return='.base64_encode($return) : '';
$this->setRedirect(Route::_('index.php?option=com_rsfeedback&view=feedbacks&cat_id='.Factory::getApplication()->input->getInt('id').$return, false));
}
}
public function delete() {
$model = $this->getModel('category');
$input = Factory::getApplication()->input;
$tmpl = $input->get('tmpl', '', 'cmd');
$result = $model->delete($input->get('id'));
if ($result)
$this->setMessage(Text::_('COM_RSFEEDBACK_CATEGORY_DELETED_SUCCESS'),'success');
else
$this->setMessage(Text::_('COM_RSFEEDBACK_CATEGORY_DELETED_ERROR_NO_PERMISSION'), 'error');
$this->setRedirect(Route::_('index.php?option=com_rsfeedback&view=categories'.(!empty($tmpl) ? '&tmpl=component' : ''), false));
return $result;
}
public function search() {
$input = Factory::getApplication()->input;
$search = $input->get('search', '', 'string');
$tmpl = $input->get('tmpl', '', 'cmd');
$this->setRedirect(Route::_('index.php?option=com_rsfeedback&view=category&search='.$search.'&id='.$input->get('id', 0, 'int').(!empty($tmpl) ? '&tmpl=component' : ''), false));
}
}