- md5
- c22709373de3ae73e1169acbf9dc58d2
- sha1
- 1403953514888419f4df55d5a373670fd9179350
- sha256
- e0358ee0b4068a7b14c36a8bfab26887d6d9a8f8aeedda8c10e1a343004a0576
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @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\Component\Messages\Administrator\Table;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;
use Joomla\CMS\User\User;
use Joomla\Database\DatabaseDriver;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* 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 74 releases, Joomla 4.2.1 to 5.0.0-alpha4. See them all, or every version of this file.