403Webshell
Server IP : 172.67.191.97  /  Your IP : 104.23.243.196
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.4.5
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/sintraunicol/modules/mod_whosonline/src/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/sintraunicol/modules/mod_whosonline/src/Helper/WhosonlineHelper.php
<?php

/**
 * @package     Joomla.Site
 * @subpackage  mod_whosonline
 *
 * @copyright   (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Module\Whosonline\Site\Helper;

use Joomla\CMS\Factory;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Helper for mod_whosonline
 *
 * @since  1.5
 */
class WhosonlineHelper
{
    /**
     * Show online count
     *
     * @return  array  The number of Users and Guests online.
     *
     * @since   1.5
     **/
    public static function getOnlineCount()
    {
        $db = Factory::getDbo();

        // Calculate number of guests and users
        $result      = [];
        $user_array  = 0;
        $guest_array = 0;

        $whereCondition = Factory::getApplication()->get('shared_session', '0') ? 'IS NULL' : '= 0';

        $query = $db->getQuery(true)
            ->select('guest, client_id')
            ->from('#__session')
            ->where('client_id ' . $whereCondition);
        $db->setQuery($query);

        try {
            $sessions = (array) $db->loadObjectList();
        } catch (\RuntimeException $e) {
            $sessions = [];
        }

        if (\count($sessions)) {
            foreach ($sessions as $session) {
                // If guest increase guest count by 1
                if ($session->guest == 1) {
                    $guest_array++;
                }

                // If member increase member count by 1
                if ($session->guest == 0) {
                    $user_array++;
                }
            }
        }

        $result['user']  = $user_array;
        $result['guest'] = $guest_array;

        return $result;
    }

    /**
     * Show online member names
     *
     * @param   mixed  $params  The parameters
     *
     * @return  array   (array) $db->loadObjectList()  The names of the online users.
     *
     * @since   1.5
     **/
    public static function getOnlineUserNames($params)
    {
        $whereCondition = Factory::getApplication()->get('shared_session', '0') ? 'IS NULL' : '= 0';

        $db    = Factory::getDbo();
        $query = $db->getQuery(true)
            ->select($db->quoteName(['a.username', 'a.userid', 'a.client_id']))
            ->from($db->quoteName('#__session', 'a'))
            ->where($db->quoteName('a.userid') . ' != 0')
            ->where($db->quoteName('a.client_id') . ' ' . $whereCondition)
            ->group($db->quoteName(['a.username', 'a.userid', 'a.client_id']));

        $user = Factory::getUser();

        if (!$user->authorise('core.admin') && $params->get('filter_groups', 0) == 1) {
            $groups = $user->getAuthorisedGroups();

            if (empty($groups)) {
                return [];
            }

            $query->leftJoin($db->quoteName('#__user_usergroup_map', 'm'), $db->quoteName('m.user_id') . ' = ' . $db->quoteName('a.userid'))
                ->leftJoin($db->quoteName('#__usergroups', 'ug'), $db->quoteName('ug.id') . ' = ' . $db->quoteName('m.group_id'))
                ->whereIn($db->quoteName('ug.id'), $groups)
                ->where($db->quoteName('ug.id') . ' <> 1');
        }

        $db->setQuery($query);

        try {
            return (array) $db->loadObjectList();
        } catch (\RuntimeException $e) {
            return [];
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit