- md5
- 5e510249326a9ebddf5e01379dcb9a12
- sha1
- 952896f4565448026d1b07f987ade6eae92d6426
- sha256
- 8ef3160e15f776a874500391494f658d1bee419e893f352caa838d61088ae5c6
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Messages\Administrator\Table;
\defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;
use Joomla\CMS\User\User;
use Joomla\Database\DatabaseDriver;
/**
* Message Table class
*
* @since 1.5
*/
class MessageTable extends Table
{
/**
* Constructor
*
* @param DatabaseDriver $db Database connector object
*
* @since 1.5
*/
public function __construct(DatabaseDriver $db)
{
parent::__construct('#__messages', 'message_id', $db);
$this->setColumnAlias('published', 'state');
}
/**
* Validation and filtering.
*
* @return boolean
*
* @since 1.5
*/
public function check()
{
try
{
parent::check();
}
catch (\Exception $e)
{
$this->setError($e->getMessage());
return false;
}
// Check the to and from users.
$user = new User($this->user_id_from);
if (empty($user->id))
{
$this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_FROM_USER'));
return false;
}
$user = new User($this->user_id_to);
if (empty($user->id))
{
$this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_TO_USER'));
return false;
}
if (empty($this->subject))
{
$this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_SUBJECT'));
return false;
}
if (empty($this->message))
{
$this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_MESSAGE'));
return false;
}
return true;
}
}
The same content is in 4 releases, Joomla 4.0.0-beta2 to 4.0.0-beta5. See them all, or every version of this file.