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/aix/libraries/kunena/src/KunenaPrivate/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/aix/libraries/kunena/src/KunenaPrivate/KunenaPrivateMessage.php
<?php

/**
 * Kunena Component
 *
 * @package       Kunena.Framework
 * @subpackage    Private
 *
 * @Copyright (C) 2008 - @currentyear@ Kunena Team. All rights reserved.
 * @license       http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link          http://www.kunena.org
 **/

namespace Kunena\Forum\Libraries\KunenaPrivate;

\defined('_JEXEC') or die();

use Exception;
use Joomla\Registry\Registry;
use Kunena\Forum\Libraries\Attachment\KunenaAttachment;
use Kunena\Forum\Libraries\Attachment\KunenaAttachmentHelper;
use Kunena\Forum\Libraries\Database\KunenaDatabaseObject;
use Kunena\Forum\Libraries\Html\KunenaParser;
use Kunena\Forum\Libraries\Table\KunenaTableMap;

/**
 * Private message.
 *
 * @property int      $parent_id
 * @property int      $author_id
 * @property int      $created_at
 * @property int      $attachments
 * @property string   $subject
 * @property string   $body
 * @property Registry $params
 *
 * @property int      $id
 * @since   Kunena 6.0
 */
class KunenaPrivateMessage extends KunenaDatabaseObject
{
    /**
     * @var     string
     * @since   Kunena 6.0
     */
    protected $_table = 'KunenaPrivate';

    /**
     * @var     null
     * @since   Kunena 6.0
     */
    protected $_attachments = null;

    /**
     * @var     null
     * @since   Kunena 6.0
     */
    protected $_posts = null;

    /**
     * @var     null
     * @since   Kunena 6.0
     */
    protected $_users = null;
    
    /**
     * @var     string
     * @since   Kunena 6.4
     */
    public $typeAlias;
    
    /**
     * @var     integer
     * @since   Kunena 6.4
     */
    public $parentid;
    
    /**
     * @var     integer
     * @since   Kunena 6.4
     */
    public $author_id;
    
    /**
     * @var     string
     * @since   Kunena 6.4
     */
    public $created_at;
    
    /**
     * @var     string
     * @since   Kunena 6.4
     */
    public $attachments;
    
    /**
     * @var     string
     * @since   Kunena 6.4
     */
    public $subject;
    
    /**
     * @var     string
     * @since   Kunena 6.4
     */
    public $body;
    
    /**
     * @var     string
     * @since   Kunena 6.4
     */
    public $params;
    
    /**
     * @var     integer
     * @since   Kunena 6.4
     */
    public $parent_id;

    /**
     * KunenaPrivateMessage constructor.
     *
     * @param   array|null  $properties  properties
     *
     * @since   Kunena 6.0
     *
     * @throws  Exception
     */
    public function __construct($properties = null)
    {
        if (!empty($this->id)) {
            $this->_exists = true;
        } else {
            parent::__construct($properties);
        }
    }

    /**
     * @param   string  $field  field
     *
     * @return integer|string
     *
     * @since   Kunena 6.0
     *
     * @throws Exception
     */
    public function displayField(string $field)
    {
        switch ($field) {
            case 'id':
                return \intval($this->id);
            case 'subject':
                return KunenaParser::parseText($this->subject);
            case 'body':
                return KunenaParser::parseBBCode($this->body, $this);
        }

        return '';
    }

    /**
     * @return  boolean
     *
     * @since   Kunena 6.0
     */
    public function check(): bool
    {
        $this->params = new Registry($this->params);

        if (!\is_null($this->_attachments)) {
            $attachments       = array_values($this->_attachments->getMapped());
            $this->attachments = \count($attachments);
            $this->params->set('attachments', $attachments);
        }

        if (!\is_null($this->_posts)) {
            $this->params->set('receivers.posts', array_values($this->_posts->getMapped()));
        }

        if (!\is_null($this->_users)) {
            $this->params->set('receivers.users', array_values($this->_users->getMapped()));
        }

        return parent::check();
    }

    /**
     * Delete attachments
     *
     * @see     KunenaDatabaseObject::delete()
     *
     * @return  mixed
     *
     * @since   Kunena 6.0
     *
     * @throws  Exception
     */
    public function delete(): bool
    {
        return parent::delete();
    }

    /**
     * @return \Kunena\Forum\Libraries\Table\KunenaTableMap|null
     *
     * @since   Kunena 6.0
     */
    public function attachments(): ?KunenaTableMap
    {
        if (\is_null($this->_attachments)) {
            $this->_attachments = new KunenaTableMap('#__kunena_private_attachment_map', 'private_id', 'attachment_id');
            $this->_attachments->load($this->id);
        }

        return $this->_attachments;
    }

    /**
     * @return \Kunena\Forum\Libraries\Table\KunenaTableMap|null
     *
     * @since   Kunena 6.0
     */
    public function posts(): ?KunenaTableMap
    {
        if (\is_null($this->_posts)) {
            $this->_posts = new KunenaTableMap('#__kunena_private_post_map', 'private_id', 'message_id');
            $this->_posts->load($this->id);
        }

        return $this->_posts;
    }

    /**
     * @return \Kunena\Forum\Libraries\Table\KunenaTableMap|null
     *
     * @since   Kunena 6.0
     */
    public function users(): ?KunenaTableMap
    {
        if (\is_null($this->_users)) {
            $this->_users = new KunenaTableMap('#__kunena_private_user_map', 'private_id', 'user_id');
            $this->_users->load($this->id);
        }

        return $this->_users;
    }

    /**
     * Save changes in the relations.
     *
     * @return void
     *
     * @since   Kunena 6.0
     *
     * @throws Exception
     */
    protected function saveInternal()
    {
        if (!\is_null($this->_attachments)) {
            $this->_attachments->setKey($this->id)->save();
            $ids         = $this->_attachments->getMapped();
            $attachments = KunenaAttachmentHelper::getById($ids, 'none');

            foreach ($attachments as $attachment) {
                $attachment->protected = KunenaAttachment::PROTECTION_PRIVATE;
                $attachment->save();
            }
        }

        if (!\is_null($this->_posts)) {
            $this->_posts->setKey($this->id)->save();
        }

        if (!\is_null($this->_users)) {
            $this->_users->setKey($this->id)->save();
        }
    }

    /**
     * Get the table relevant properties. Override for your specific Object
     * 
     * @return array    Assocative array with the propertie values of table
     * 
     * @since   Kunena 6.4
     */
    protected function getTableProperties(): array
    {
        $properties = [
            'id'          => $this->id,
            'parent_id'   => $this->parent_id,
            'author_id'   => $this->author_id,
            'created_at'  => $this->created_at,
            'attachments' => $this->attachments,
            'subject'     => $this->subject,
            'body'        => $this->body,
            'params'      => $this->params
        ];

        return $properties;
    }
}

Anon7 - 2022
AnonSec Team