Source for file admin.messages.php
Documentation is available at admin.messages.php
* @copyright Refer to copyright.php
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author Mambo Foundation Inc see README.php
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
require_once( $mainframe->getPath( 'admin_html' ) );
require_once( $mainframe->getPath( 'class' ) );
$database->setQuery( "SELECT cfg_name, cfg_value FROM #__messages_cfg WHERE user_id='$my->id'" );
$data =
$database->loadObjectList( 'cfg_name' );
$vars['lock'] =
mosHTML::yesnoSelectList( "vars[lock]", 'class="inputbox" size="1"', @$data['lock']->cfg_value );
$vars['mail_on_new'] =
mosHTML::yesnoSelectList( "vars[mail_on_new]", 'class="inputbox" size="1"', @$data['mail_on_new']->cfg_value );
$database->setQuery( "DELETE FROM #__messages_cfg WHERE user_id='$my->id'" );
foreach ($vars as $k=>
$v) {
$v =
$database->getEscaped( $v );
$database->setQuery( "INSERT INTO #__messages_cfg (user_id,cfg_name,cfg_value)"
.
"\nVALUES ('$my->id','$k','$v')"
global $database, $mainframe, $my, $acl;
// get available backend user groups
$gid =
$acl->get_group_id( 'Public Backend', 'ARO' );
$gids =
$acl->get_group_children( $gid, 'ARO', 'RECURSE' );
$database->setQuery( "SELECT id AS value, username AS text FROM #__users"
.
"\n WHERE gid IN ($gids)"
$recipients =
array_merge( $recipients, $database->loadObjectList() );
'class="inputbox" size="1"',
global $database, $mainframe, $my, $mosConfig_absolute_path;
global $mosConfig_mailfrom, $mosConfig_fromname;
require_once($mosConfig_absolute_path.
"/includes/mambofunc.php");
if (!$row->bind( $_POST )) {
echo
"<script> alert('".
$row->getError().
"'); window.history.go(-1); </script>\n";
require_once(mamboCore::get('mosConfig_absolute_path').
'/includes/phpInputFilter/class.inputfilter.php');
$row->subject =
trim( $iFilter->process( $row->subject ) );
$row->message =
trim( $iFilter->process( $row->message ) );
mosRedirect( "index2.php?option=com_messages&mosmsg=" .
$row->getError() );
$msg =
$row->subject.
' - '.
$row->message;
$sql =
"SELECT a.id, a.name, a.email"
.
"\nWHERE a.sendEmail = '1'"
.
"\nAND a.id = '".
$row->user_id_to.
"'"
$database->setQuery( $sql );
$rows =
$database->loadObjectList();
$recipient =
$row->email;
$subject =
"New private message from ".
$row->name;
mosMail($mosConfig_mailfrom, $mosConfig_fromname, $recipient, $subject, $msg);
global $database, $mainframe, $my, $mosConfig_list_limit;
$limit =
$mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit );
$limitstart =
$mainframe->getUserStateFromRequest( "view{$option}limitstart", 'limitstart', 0 );
$search =
$mainframe->getUserStateFromRequest( "search{$option}", 'search', '' );
$wheres[] =
" a.user_id_to='$my->id'";
if (isset
($search) &&
$search!=
"") {
$wheres[] =
"(u.username LIKE '%$search%' OR email LIKE '%$search%' OR u.name LIKE '%$search%')";
$database->setQuery( "SELECT COUNT(*)"
.
"\nFROM #__messages AS a"
.
"\nINNER JOIN #__users AS u ON u.id = a.user_id_from"
.
($wheres ?
" WHERE " .
implode( " AND ", $wheres ) :
"" )
$total =
$database->loadResult();
require_once( $GLOBALS['mosConfig_absolute_path'] .
'/administrator/includes/pageNavigation.php' );
$pageNav =
new mosPageNav( $total, $limitstart, $limit );
$database->setQuery( "SELECT a.*, u.name AS user_from"
.
"\nFROM #__messages AS a"
.
"\nINNER JOIN #__users AS u ON u.id = a.user_id_from"
.
($wheres ?
" WHERE " .
implode( " AND ", $wheres ) :
"" )
.
"\nORDER BY date_time DESC"
.
"\nLIMIT $pageNav->limitstart, $pageNav->limit"
$rows =
$database->loadObjectList();
if ($database->getErrorNum()) {
echo
$database->stderr();
global $database, $my, $acl;
$database->setQuery( "SELECT a.*, u.name AS user_from"
.
"\nFROM #__messages AS a"
.
"\nINNER JOIN #__users AS u ON u.id = a.user_id_from"
.
"\nWHERE a.message_id='$uid'"
.
"\nORDER BY date_time DESC"
$database->loadObject( $row );
$database->setQuery( "UPDATE #__messages SET state='1' WHERE message_id='$uid'" );
echo
"<script> alert('".
T_('Select an item to delete').
"'); window.history.go(-1);</script>\n";
$database->setQuery( "DELETE FROM #__messages WHERE message_id IN ($cids)" );
if (!$database->query()) {
echo
"<script> alert('".
$database->getErrorMsg().
"'); window.history.go(-1); </script>\n";
mosRedirect( "index2.php?option=$option&limit=$limit&limitstart=$limitstart" );
Documentation generated on Mon, 05 May 2008 16:15:40 +0400 by phpDocumentor 1.4.0