[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_messages 6 * 7 * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Messages\Administrator\Table; 12 13 use Joomla\CMS\Language\Text; 14 use Joomla\CMS\Table\Table; 15 use Joomla\CMS\User\User; 16 use Joomla\Database\DatabaseDriver; 17 18 // phpcs:disable PSR1.Files.SideEffects 19 \defined('_JEXEC') or die; 20 // phpcs:enable PSR1.Files.SideEffects 21 22 /** 23 * Message Table class 24 * 25 * @since 1.5 26 */ 27 class MessageTable extends Table 28 { 29 /** 30 * Constructor 31 * 32 * @param DatabaseDriver $db Database connector object 33 * 34 * @since 1.5 35 */ 36 public function __construct(DatabaseDriver $db) 37 { 38 parent::__construct('#__messages', 'message_id', $db); 39 40 $this->setColumnAlias('published', 'state'); 41 } 42 43 /** 44 * Validation and filtering. 45 * 46 * @return boolean 47 * 48 * @since 1.5 49 */ 50 public function check() 51 { 52 try { 53 parent::check(); 54 } catch (\Exception $e) { 55 $this->setError($e->getMessage()); 56 57 return false; 58 } 59 60 // Check the to and from users. 61 $user = new User($this->user_id_from); 62 63 if (empty($user->id)) { 64 $this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_FROM_USER')); 65 66 return false; 67 } 68 69 $user = new User($this->user_id_to); 70 71 if (empty($user->id)) { 72 $this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_TO_USER')); 73 74 return false; 75 } 76 77 if (empty($this->subject)) { 78 $this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_SUBJECT')); 79 80 return false; 81 } 82 83 if (empty($this->message)) { 84 $this->setError(Text::_('COM_MESSAGES_ERROR_INVALID_MESSAGE')); 85 86 return false; 87 } 88 89 return true; 90 } 91 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |