NexusLeads Webshell
NexusLeads


Server : LiteSpeed
System : Linux server 3.10.0-1160.90.1.el7.x86_64 #1 SMP Thu May 4 15:21:22 UTC 2023 x86_64
User : alsaif ( 1057)
PHP Version : 7.4.33
Disable Function : show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/alsaif/domains/alsaif.group/public_html/libraries/regularlabs/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/alsaif/domains/alsaif.group/public_html/libraries/regularlabs/src/Log.php
<?php
/**
 * @package         Regular Labs Library
 * @version         23.9.3039
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            https://regularlabs.com
 * @copyright       Copyright © 2023 Regular Labs All Rights Reserved
 * @license         GNU General Public License version 2 or later
 */

namespace RegularLabs\Library;

defined('_JEXEC') or die;

use ActionlogsModelActionlog;
use JLoader;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel as JModel;

/**
 * Class Log
 *
 * @package RegularLabs\Library
 */
class Log
{
    public static function add($message, $languageKey, $context)
    {
        $user = JFactory::getApplication()->getIdentity() ?: JFactory::getUser();

        $message['userid']      = $user->id;
        $message['username']    = $user->username;
        $message['accountlink'] = 'index.php?option=com_users&task=user.edit&id=' . $user->id;

        JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');
        JLoader::register('ActionlogsModelActionlog', JPATH_ADMINISTRATOR . '/components/com_actionlogs/models/actionlog.php');

        /* @var ActionlogsModelActionlog $model */
        $model = JModel::getInstance('Actionlog', 'ActionlogsModel');
        $model->addLog([$message], $languageKey, $context, $user->id);
    }

    public static function changeState($message, $context, $value)
    {
        switch ($value)
        {
            case 0:
                $languageKey       = 'PLG_SYSTEM_ACTIONLOGS_CONTENT_UNPUBLISHED';
                $message['action'] = 'unpublish';
                break;
            case 1:
                $languageKey       = 'PLG_SYSTEM_ACTIONLOGS_CONTENT_PUBLISHED';
                $message['action'] = 'publish';
                break;
            case 2:
                $languageKey       = 'PLG_SYSTEM_ACTIONLOGS_CONTENT_ARCHIVED';
                $message['action'] = 'archive';
                break;
            case -2:
                $languageKey       = 'PLG_SYSTEM_ACTIONLOGS_CONTENT_TRASHED';
                $message['action'] = 'trash';
                break;
            default:
                return;
        }

        self::add($message, $languageKey, $context);
    }

    public static function delete($message, $context)
    {
        $languageKey       = 'PLG_SYSTEM_ACTIONLOGS_CONTENT_DELETED';
        $message['action'] = 'deleted';

        self::add($message, $languageKey, $context);
    }

    public static function install($message, $context, $type = 'component')
    {
        $languageKey = 'PLG_ACTIONLOG_JOOMLA_' . strtoupper($type) . '_INSTALLED';

        if ( ! JFactory::getApplication()->getLanguage()->hasKey($languageKey))
        {
            $languageKey = 'PLG_ACTIONLOG_JOOMLA_EXTENSION_INSTALLED';
        }

        $message['action'] = 'install';
        $message['type']   = 'PLG_ACTIONLOG_JOOMLA_TYPE_' . strtoupper($type);

        self::add($message, $languageKey, $context);
    }

    public static function save($message, $context, $isNew)
    {
        $languageKey       = $isNew ? 'PLG_SYSTEM_ACTIONLOGS_CONTENT_ADDED' : 'PLG_SYSTEM_ACTIONLOGS_CONTENT_UPDATED';
        $message['action'] = $isNew ? 'add' : 'update';

        self::add($message, $languageKey, $context);
    }

    public static function uninstall($message, $context, $type = 'component')
    {
        $languageKey = 'PLG_ACTIONLOG_JOOMLA_EXTENSION_UNINSTALLED';

        $message['action'] = 'uninstall';
        $message['type']   = 'PLG_ACTIONLOG_JOOMLA_TYPE_' . strtoupper($type);

        self::add($message, $languageKey, $context);
    }
}

NexusLeads