| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Messages 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 /** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 class mosMessage extends mosDBTable { 21 /** @var int Primary key */ 22 var $message_id=null; 23 /** @var int */ 24 var $user_id_from=null; 25 /** @var int */ 26 var $user_id_to=null; 27 /** @var int */ 28 var $folder_id=null; 29 /** @var datetime */ 30 var $date_time=null; 31 /** @var int */ 32 var $state=null; 33 /** @var int */ 34 var $priority=null; 35 /** @var string */ 36 var $subject=null; 37 /** @var text */ 38 var $message=null; 39 40 /** 41 * @param database A database connector object 42 */ 43 function mosMessage( &$db ) { 44 $this->mosDBTable( '#__messages', 'message_id', $db ); 45 } 46 47 function send( $from_id=null, $to_id=null, $subject=null, $message=null ) { 48 global $database; 49 global $mosConfig_site_name; 50 51 if (is_object( $this )) { 52 $from_id = $from_id ? $from_id : $this->user_id_from; 53 $to_id = $to_id ? $to_id : $this->user_id_to; 54 $subject = $subject ? $subject : $this->subject; 55 $message = $message ? $message : $this->message; 56 } 57 58 $database->setQuery( "SELECT cfg_name, cfg_value" 59 . "\nFROM #__messages_cfg" 60 . "\nWHERE user_id='$to_id'" 61 ); 62 $config = $database->loadObjectList( 'cfg_name' ); 63 $locked = @$config['lock']->cfg_value; 64 $domail = @$config['mail_on_new']->cfg_value; 65 66 if (!$locked) { 67 68 $this->user_id_from = $from_id; 69 $this->user_id_to = $to_id; 70 $this->subject = $subject; 71 $this->message = $message; 72 $this->date_time = date( "Y-m-d H:i:s" ); 73 74 if ($this->store()) { 75 if ($domail) { 76 $database->setQuery( "SELECT email FROM #__users WHERE id='$to_id'" ); 77 $recipient = $database->loadResult(); 78 $subject = T_('A new private message has arrived'); 79 $msg = T_('A new private message has arrived'); 80 mosMail($mosConfig_mailfrom, $mosConfig_fromname, $recipient, $subject, $msg); 81 } 82 return true; 83 } 84 } else { 85 if (is_object( $this )) { 86 $this->_error = T_('The user has locked their mailbox. Message failed.'); 87 } 88 } 89 return false; 90 } 91 } 92 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |