first commit

This commit is contained in:
alazhar
2020-01-02 22:20:31 +07:00
commit 10eb3340ad
5753 changed files with 631345 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<access component="com_messages">
<section name="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
</section>
</access>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
filter="rules"
validate="rules"
component="com_messages"
section="component" />
</fieldset>
</config>

View File

@ -0,0 +1,54 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Messages master display controller.
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT.'/helpers/messages.php';
$view = $this->input->get('view', 'messages');
$layout = $this->input->get('layout', 'default');
$id = $this->input->getInt('id');
// Check for edit form.
if ($view == 'message' && $layout == 'edit' && !$this->checkEditId('com_messages.edit.message', $id))
{
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_messages&view=messages', false));
return false;
}
// Load the submenu.
MessagesHelper::addSubmenu($this->input->get('view', 'messages'));
parent::display();
}
}

View File

@ -0,0 +1,79 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Messages Component Message Model
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesControllerConfig extends JControllerLegacy
{
/**
* Method to save a record.
*/
public function save()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$model = $this->getModel('Config', 'MessagesModel');
$data = $this->input->post->get('jform', array(), 'array');
// Validate the posted data.
$form = $model->getForm();
if (!$form)
{
JError::raiseError(500, $model->getError());
return false;
}
$data = $model->validate($form, $data);
// Check for validation errors.
if ($data === false)
{
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++)
{
if ($errors[$i] instanceof Exception)
{
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
$app->enqueueMessage($errors[$i], 'warning');
}
}
// Redirect back to the main list.
$this->setRedirect(JRoute::_('index.php?option=com_messages&view=messages', false));
return false;
}
// Attempt to save the data.
if (!$model->save($data))
{
// Redirect back to the main list.
$this->setMessage(JText::sprintf('JERROR_SAVE_FAILED', $model->getError()), 'warning');
$this->setRedirect(JRoute::_('index.php?option=com_messages&view=messages', false));
return false;
}
// Redirect to the list screen.
$this->setMessage(JText::_('COM_MESSAGES_CONFIG_SAVED'));
$this->setRedirect(JRoute::_('index.php?option=com_messages&view=messages', false));
return true;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,53 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Messages Component Message Model
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesControllerMessage extends JControllerForm
{
/**
* Method (override) to check if you can save a new or existing record.
*
* Adjusts for the primary key name and hands off to the parent class.
*
* @param array An array of input data.
* @param string The name of the key for the primary key.
*
* @return boolean
*/
protected function allowSave($data, $key = 'message_id')
{
return parent::allowSave($data, $key);
}
/**
* Reply to an existing message.
*
* This is a simple redirect to the compose form.
*/
public function reply()
{
if ($replyId = $this->input->getInt('reply_id'))
{
$this->setRedirect('index.php?option=com_messages&view=message&layout=edit&reply_id=' . $replyId);
}
else
{
$this->setMessage(JText::_('COM_MESSAGES_INVALID_REPLY_ID'));
$this->setRedirect('index.php?option=com_messages&view=messages');
}
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Messages list controller class.
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesControllerMessages extends JControllerAdmin
{
/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return object The model.
*
* @since 1.6
*/
public function getModel($name = 'Message', $prefix = 'MessagesModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class JHtmlMessages
{
/**
* @param int $value The state value
* @param int $i
*/
public static function state($value = 0, $i, $canChange)
{
// Array of image, task, title, action.
$states = array(
-2 => array('trash.png', 'messages.unpublish', 'JTRASHED', 'COM_MESSAGES_MARK_AS_UNREAD'),
1 => array('tick.png', 'messages.unpublish', 'COM_MESSAGES_OPTION_READ', 'COM_MESSAGES_MARK_AS_UNREAD'),
0 => array('publish_x.png', 'messages.publish', 'COM_MESSAGES_OPTION_UNREAD', 'COM_MESSAGES_MARK_AS_READ')
);
$state = JArrayHelper::getValue($states, (int) $value, $states[0]);
$html = JHtml::_('image', 'admin/'.$state[0], JText::_($state[2]), null, true);
if ($canChange)
{
$html = '<a href="#" onclick="return listItemTask(\'cb'.$i.'\',\''.$state[1].'\')" title="'.JText::_($state[3]).'">'
.$html.'</a>';
}
return $html;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,76 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesHelper
{
/**
* Configure the Linkbar.
*
* @param string The name of the active view.
*
* @return void
* @since 1.6
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('COM_MESSAGES_ADD'),
'index.php?option=com_messages&view=message&layout=edit',
$vName == 'message'
);
JHtmlSidebar::addEntry(
JText::_('COM_MESSAGES_READ'),
'index.php?option=com_messages',
$vName == 'messages'
);
}
/**
* Gets a list of the actions that can be performed.
*
* @return JObject
*/
public static function getActions()
{
$user = JFactory::getUser();
$result = new JObject;
$actions = JAccess::getActions('com_messages');
foreach ($actions as $action)
{
$result->set($action->name, $user->authorise($action->name, 'com_messages'));
}
return $result;
}
/**
* Get a list of filter options for the state of a module.
*
* @return array An array of JHtmlOption elements.
*/
public static function getStateOptions()
{
// Build the filter options.
$options = array();
$options[] = JHtml::_('select.option', '1', JText::_('COM_MESSAGES_OPTION_READ'));
$options[] = JHtml::_('select.option', '0', JText::_('COM_MESSAGES_OPTION_UNREAD'));
$options[] = JHtml::_('select.option', '-2', JText::_('JTRASHED'));
return $options;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,21 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
if (!JFactory::getUser()->authorise('core.manage', 'com_messages'))
{
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
$task = JFactory::getApplication()->input->get('task');
$controller = JControllerLegacy::getInstance('Messages');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.1" method="upgrade">
<name>com_messages</name>
<author>Joomla! Project</author>
<creationDate>April 2006</creationDate>
<copyright>(C) 2005 - 2013 Open Source Matters. All rights reserved. </copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>COM_MESSAGES_XML_DESCRIPTION</description>
<languages folder="site">
<language tag="en-GB">language/en-GB.com_messages.ini</language>
</languages>
<administration>
<files folder="admin">
<filename>config.xml</filename>
<filename>controller.php</filename>
<filename>index.html</filename>
<filename>messages.php</filename>
<folder>controllers</folder>
<folder>helpers</folder>
<folder>models</folder>
<folder>tables</folder>
<folder>views</folder>
</files>
<languages folder="admin">
<language tag="en-GB">language/en-GB.com_messages.ini</language>
<language tag="en-GB">language/en-GB.com_messages.sys.ini</language>
</languages>
</administration>
</extension>

View File

@ -0,0 +1,157 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Message configuration model.
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesModelConfig extends JModelForm
{
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
$user = JFactory::getUser();
$this->setState('user.id', $user->get('id'));
// Load the parameters.
$params = JComponentHelper::getParams('com_messages');
$this->setState('params', $params);
}
/**
* Method to get a single record.
*
* @param integer The id of the primary key.
*
* @return mixed Object on success, false on failure.
*/
public function &getItem()
{
$item = new JObject;
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('cfg_name, cfg_value')
->from('#__messages_cfg')
->where('user_id = '.(int) $this->getState('user.id'));
$db->setQuery($query);
try
{
$rows = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
foreach ($rows as $row)
{
$item->set($row->cfg_name, $row->cfg_value);
}
$this->preprocessData('com_messages.config', $item);
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_messages.config', 'config', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to save the form data.
*
* @param array The form data.
* @return boolean True on success.
*/
public function save($data)
{
$db = $this->getDbo();
if ($userId = (int) $this->getState('user.id'))
{
$db->setQuery(
'DELETE FROM #__messages_cfg'.
' WHERE user_id = '. $userId
);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
$tuples = array();
foreach ($data as $k => $v)
{
$tuples[] = '(' . $userId.', ' . $db->quote($k) . ', ' . $db->quote($v) . ')';
}
if ($tuples)
{
$db->setQuery(
'INSERT INTO #__messages_cfg'.
' (user_id, cfg_name, cfg_value)'.
' VALUES '.implode(',', $tuples)
);
try
{
$db->execute();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
}
return true;
}
else
{
$this->setError('COM_MESSAGES_ERR_INVALID_USER');
return false;
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('user');
/**
* Supports an modal select of user that have access to com_messages
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class JFormFieldUserMessages extends JFormFieldUser
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'UserMessages';
/**
* Method to get the filtering groups (null means no filtering)
*
* @return array|null array of filtering groups or null.
* @since 1.6
*/
protected function getGroups()
{
// Compute usergroups
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('id')
->from('#__usergroups');
$db->setQuery($query);
try
{
$groups = $db->loadColumn();
}
catch (RuntimeException $e)
{
JError::raiseNotice(500, $e->getMessage());
return null;
}
foreach ($groups as $i => $group)
{
if (JAccess::checkGroup($group, 'core.admin'))
{
continue;
}
if (!JAccess::checkGroup($group, 'core.manage', 'com_messages'))
{
unset($groups[$i]);
continue;
}
if (!JAccess::checkGroup($group, 'core.login.admin'))
{
unset($groups[$i]);
continue;
}
}
return array_values($groups);
}
/**
* Method to get the users to exclude from the list of users
*
* @return array|null array of users to exclude or null to to not exclude them
* @since 1.6
*/
protected function getExcluded()
{
return array(JFactory::getUser()->id);
}
}

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="lock"
type="radio"
class="btn-group"
label="COM_MESSAGES_FIELD_LOCK_LABEL"
description="COM_MESSAGES_FIELD_LOCK_DESC"
default="0">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="mail_on_new"
type="radio"
class="btn-group"
label="COM_MESSAGES_FIELD_MAIL_ON_NEW_LABEL"
description="COM_MESSAGES_FIELD_MAIL_ON_NEW_DESC"
default="1">
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="auto_purge"
type="text"
class="inputbox"
size="6"
default="7"
label="COM_MESSAGES_FIELD_AUTO_PURGE_LABEL"
description="COM_MESSAGES_FIELD_AUTO_PURGE_DESC" />
</fieldset>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<form>
<fieldset>
<field
name="user_id_to"
type="usermessages"
label="COM_MESSAGES_FIELD_USER_ID_TO_LABEL"
description="COM_MESSAGES_FIELD_USER_ID_TO_DESC"
default="0"
required="true" />
<field
name="subject"
type="text"
label="COM_MESSAGES_FIELD_SUBJECT_LABEL"
description="COM_MESSAGES_FIELD_SUBJECT_DESC"
required="true" />
<field
name="message"
type="editor"
class="inputbox"
label="COM_MESSAGES_FIELD_MESSAGE_LABEL"
description="COM_MESSAGES_FIELD_MESSAGE_DESC"
required="true"
filter="JComponentHelper::filterText"
buttons="true"
hide="readmore,pagebreak,image,article" />
</fieldset>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,325 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Private Message model.
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesModelMessage extends JModelAdmin
{
/**
* message
*/
protected $item;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState()
{
parent::populateState();
$input = JFactory::getApplication()->input;
$user = JFactory::getUser();
$this->setState('user.id', $user->get('id'));
$messageId = (int) $input->getInt('message_id');
$this->setState('message.id', $messageId);
$replyId = (int) $input->getInt('reply_id');
$this->setState('reply.id', $replyId);
}
/**
* Check that recipient user is the one trying to delete and then call parent delete method
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 3.1
*/
public function delete(&$pks)
{
$pks = (array) $pks;
$table = $this->getTable();
$user = JFactory::getUser();
// Iterate the items to delete each one.
foreach ($pks as $i => $pk)
{
if ($table->load($pk))
{
if ($table->user_id_to !== $user->id)
{
// Prune items that you can't change.
unset($pks[$i]);
JLog::add(JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
return false;
}
}
else
{
$this->setError($table->getError());
return false;
}
}
return parent::delete($pks);
}
/**
* Returns a Table object, always creating it.
*
* @param type The table type to instantiate
* @param string A prefix for the table class name. Optional.
* @param array Configuration array for model. Optional.
* @return JTable A database object
* @since 1.6
*/
public function getTable($type = 'Message', $prefix = 'MessagesTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get a single record.
*
* @param integer The id of the primary key.
* @return mixed Object on success, false on failure.
* @since 1.6
*/
public function getItem($pk = null)
{
if (!isset($this->item))
{
if ($this->item = parent::getItem($pk))
{
// Prime required properties.
if (empty($this->item->message_id))
{
// Prepare data for a new record.
if ($replyId = $this->getState('reply.id'))
{
// If replying to a message, preload some data.
$db = $this->getDbo();
$query = $db->getQuery(true)
->select('subject, user_id_from')
->from('#__messages')
->where('message_id = '.(int) $replyId);
try
{
$message = $db->setQuery($query)->loadObject();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
$this->item->set('user_id_to', $message->user_id_from);
$re = JText::_('COM_MESSAGES_RE');
if (stripos($message->subject, $re) !== 0)
{
$this->item->set('subject', $re.$message->subject);
}
}
}
elseif ($this->item->user_id_to != JFactory::getUser()->id)
{
$this->setError(JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
else {
// Mark message read
$db = $this->getDbo();
$query = $db->getQuery(true)
->update('#__messages')
->set('state = 1')
->where('message_id = '.$this->item->message_id);
$db->setQuery($query)->execute();
}
}
// Get the user name for an existing messasge.
if ($this->item->user_id_from && $fromUser = new JUser($this->item->user_id_from))
{
$this->item->set('from_user_name', $fromUser->name);
}
}
return $this->item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
* @return JForm A JForm object on success, false on failure
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_messages.message', 'message', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
return $form;
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_messages.edit.message.data', array());
if (empty($data))
{
$data = $this->getItem();
}
$this->preprocessData('com_messages.message', $data);
return $data;
}
/**
* Checks that the current user matches the message recipient and calls the parent publish method
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 3.1
*/
public function publish(&$pks, $value = 1)
{
$user = JFactory::getUser();
$table = $this->getTable();
$pks = (array) $pks;
// Check that the recipient matches the current user
foreach ($pks as $i => $pk)
{
$table->reset();
if ($table->load($pk))
{
if ($table->user_id_to !== $user->id)
{
// Prune items that you can't change.
unset($pks[$i]);
JLog::add(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), JLog::WARNING, 'jerror');
return false;
}
}
}
return parent::publish($pks, $value);
}
/**
* Method to save the form data.
*
* @param array The form data.
*
* @return boolean True on success.
*/
public function save($data)
{
$table = $this->getTable();
// Bind the data.
if (!$table->bind($data))
{
$this->setError($table->getError());
return false;
}
// Assign empty values.
if (empty($table->user_id_from))
{
$table->user_id_from = JFactory::getUser()->get('id');
}
if ((int) $table->date_time == 0)
{
$table->date_time = JFactory::getDate()->toSql();
}
// Check the data.
if (!$table->check())
{
$this->setError($table->getError());
return false;
}
// Load the recipient user configuration.
$model = JModelLegacy::getInstance('Config', 'MessagesModel', array('ignore_request' => true));
$model->setState('user.id', $table->user_id_to);
$config = $model->getItem();
if (empty($config))
{
$this->setError($model->getError());
return false;
}
if ($config->get('locked', false))
{
$this->setError(JText::_('COM_MESSAGES_ERR_SEND_FAILED'));
return false;
}
// Store the data.
if (!$table->store())
{
$this->setError($table->getError());
return false;
}
if ($config->get('mail_on_new', true))
{
// Load the user details (already valid from table check).
$fromUser = JUser::getInstance($table->user_id_from);
$toUser = JUser::getInstance($table->user_id_to);
$debug = JFactory::getConfig()->get('debug_lang');
$default_language = JComponentHelper::getParams('com_languages')->get('administrator');
$lang = JLanguage::getInstance($toUser->getParam('admin_language', $default_language), $debug);
$lang->load('com_messages', JPATH_ADMINISTRATOR);
$siteURL = JUri::root() . 'administrator/index.php?option=com_messages&view=message&message_id='.$table->message_id;
$sitename = JFactory::getApplication()->getCfg('sitename');
$subject = sprintf($lang->_('COM_MESSAGES_NEW_MESSAGE_ARRIVED'), $sitename);
$msg = sprintf($lang->_('COM_MESSAGES_PLEASE_LOGIN'), $siteURL);
JFactory::getMailer()->sendMail($fromUser->email, $fromUser->name, $toUser->email, $subject, $msg);
}
return true;
}
}

View File

@ -0,0 +1,138 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Messages Component Messages Model
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesModelMessages extends JModelList
{
/**
* Constructor.
*
* @param array An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'message_id', 'a.id',
'subject', 'a.subject',
'state', 'a.state',
'user_id_from', 'a.user_id_from',
'user_id_to', 'a.user_id_to',
'date_time', 'a.date_time',
'priority', 'a.priority',
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
// Load the filter state.
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
$this->setState('filter.state', $state);
// List state information.
parent::populateState('a.date_time', 'desc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string A prefix for the store id.
*
* @return string A store id.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.state');
return parent::getStoreId($id);
}
/**
* Build an SQL query to load the list data.
*
* @return JDatabaseQuery
*/
protected function getListQuery()
{
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$user = JFactory::getUser();
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*, ' .
'u.name AS user_from'
)
);
$query->from('#__messages AS a');
// Join over the users for message owner.
$query->join('INNER', '#__users AS u ON u.id = a.user_id_from')
->where('a.user_id_to = ' . (int) $user->get('id'));
// Filter by published state.
$state = $this->getState('filter.state');
if (is_numeric($state))
{
$query->where('a.state = ' . (int) $state);
}
elseif ($state === '')
{
$query->where('(a.state IN (0, 1))');
}
// Filter by search in subject or message.
$search = $this->getState('filter.search');
if (!empty($search))
{
$search = $db->quote('%' . $db->escape($search, true) . '%', false);
$query->where('a.subject LIKE ' . $search . ' OR a.message LIKE ' . $search);
}
// Add the list ordering clause.
$query->order($db->escape($this->getState('list.ordering', 'a.date_time')) . ' ' . $db->escape($this->getState('list.direction', 'DESC')));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,131 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Message Table class
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.5
*/
class MessagesTableMessage extends JTable
{
/**
* Constructor
*
* @param database A database connector object
*/
public function __construct(& $db)
{
parent::__construct('#__messages', 'message_id', $db);
}
/**
* Validation and filtering.
*
* @return boolean
*/
public function check()
{
// Check the to and from users.
$user = new JUser($this->user_id_from);
if (empty($user->id))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_FROM_USER'));
return false;
}
$user = new JUser($this->user_id_to);
if (empty($user->id))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_TO_USER'));
return false;
}
if (empty($this->subject))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_SUBJECT'));
return false;
}
if (empty($this->message))
{
$this->setError(JText::_('COM_MESSAGES_ERROR_INVALID_MESSAGE'));
return false;
}
return true;
}
/**
* Method to set the publishing state for a row or list of rows in the database
* table. The method respects checked out rows by other users and will attempt
* to checkin rows that it can after adjustments are made.
*
* @param mixed An optional array of primary key values to update. If not
* set the instance property value is used.
* @param integer The publishing state. eg. [0 = unpublished, 1 = published]
* @param integer The user id of the user performing the operation.
* @return boolean True on success.
* @since 1.6
*/
public function publish($pks = null, $state = 1, $userId = 0)
{
$k = $this->_tbl_key;
// Sanitize input.
JArrayHelper::toInteger($pks);
$state = (int) $state;
// If there are no primary keys set check to see if the instance key is set.
if (empty($pks))
{
if ($this->$k)
{
$pks = array($this->$k);
}
// Nothing to set publishing state on, return false.
else {
$this->setError(JText::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
return false;
}
}
// Build the WHERE clause for the primary keys.
$where = $k.' IN ('.implode(',', $pks).')';
// Update the publishing state for rows with the given primary keys.
$this->_db->setQuery(
'UPDATE '.$this->_db->quoteName($this->_tbl).
' SET '.$this->_db->quoteName('state').' = '.(int) $state .
' WHERE ('.$where.')'
);
try
{
$this->_db->execute();
}
catch (RuntimeException $e)
{
$this->setError($e->getMessage());
return false;
}
// If the JTable instance value is in the list of primary keys that were set, set the instance.
if (in_array($this->$k, $pks))
{
$this->state = $state;
}
$this->setError('');
return true;
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,71 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
JHtml::_('behavior.modal');
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'config.cancel' || document.formvalidator.isValid(document.id('config-form')))
{
Joomla.submitform(task, document.getElementById('config-form'));
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_messages'); ?>" method="post" name="adminForm" id="message-form" class="form-validate form-horizontal">
<fieldset>
<div>
<div class="modal-header">
<h3><?php echo JText::_('COM_MESSAGES_MY_SETTINGS');?></h3>
</div>
<div class="modal-body">
<button class="btn btn-primary" type="submit" onclick="Joomla.submitform('config.save', this.form);window.top.setTimeout('window.parent.SqueezeBox.close()', 700);">
<?php echo JText::_('JSAVE');?></button>
<button class="btn" type="button" onclick="window.parent.SqueezeBox.close();">
<?php echo JText::_('JCANCEL');?></button>
<hr />
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('lock'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('lock'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('mail_on_new'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('mail_on_new'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('auto_purge'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('auto_purge'); ?>
</div>
</div>
</div>
</div>
</fieldset>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* View to edit messages user configuration.
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesViewConfig extends JViewLegacy
{
protected $form;
protected $item;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Bind the record to the form.
$this->form->bind($this->item);
parent::display($tpl);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,52 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.framework');
JHtml::_('formbehavior.chosen', 'select');
?>
<form action="<?php echo JRoute::_('index.php?option=com_messages'); ?>" method="post" name="adminForm" id="adminForm" class="form-horizontal">
<fieldset>
<div class="control-group">
<div class="control-label">
<?php echo JText::_('COM_MESSAGES_FIELD_USER_ID_FROM_LABEL'); ?>
</div>
<div class="controls">
<?php echo $this->item->get('from_user_name');?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo JText::_('COM_MESSAGES_FIELD_DATE_TIME_LABEL'); ?>
</div>
<div class="controls">
<?php echo JHtml::_('date', $this->item->date_time);?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo JText::_('COM_MESSAGES_FIELD_SUBJECT_LABEL'); ?>
</div>
<div class="controls">
<?php echo $this->item->subject;?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo JText::_('COM_MESSAGES_FIELD_MESSAGE_LABEL'); ?>
</div>
<div class="controls">
<?php echo $this->item->message; ?>
</div>
</div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="reply_id" value="<?php echo $this->item->message_id; ?>" />
<?php echo JHtml::_('form.token'); ?>
</fieldset>
</form>

View File

@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
?>
<script type="text/javascript">
Joomla.submitbutton = function(task)
{
if (task == 'message.cancel' || document.formvalidator.isValid(document.id('message-form')))
{
Joomla.submitform(task, document.getElementById('message-form'));
}
}
</script>
<form action="<?php echo JRoute::_('index.php?option=com_messages'); ?>" method="post" name="adminForm" id="message-form" class="form-validate form-horizontal">
<fieldset class="adminform">
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('user_id_to'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('user_id_to'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('subject'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('subject'); ?>
</div>
</div>
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('message'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('message'); ?>
</div>
</div>
</fieldset>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,70 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Messages component
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesViewMessage extends JViewLegacy
{
protected $form;
protected $item;
protected $state;
public function display($tpl = null)
{
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
parent::display($tpl);
$this->addToolbar();
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
if ($this->getLayout() == 'edit')
{
JToolbarHelper::title(JText::_('COM_MESSAGES_WRITE_PRIVATE_MESSAGE'), 'new-privatemessage.png');
JToolbarHelper::save('message.save', 'COM_MESSAGES_TOOLBAR_SEND');
JToolbarHelper::cancel('message.cancel');
JToolbarHelper::help('JHELP_COMPONENTS_MESSAGING_WRITE');
}
else
{
JToolbarHelper::title(JText::_('COM_MESSAGES_VIEW_PRIVATE_MESSAGE'), 'inbox.png');
$sender = JUser::getInstance($this->item->user_id_from);
if ($sender->authorise('core.admin') || $sender->authorise('core.manage', 'com_messages') && $sender->authorise('core.login.admin'))
{
JToolbarHelper::custom('message.reply', 'redo', null, 'COM_MESSAGES_TOOLBAR_REPLY', false);
}
JToolbarHelper::cancel('message.cancel');
JToolbarHelper::help('JHELP_COMPONENTS_MESSAGING_READ');
}
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,110 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');
$user = JFactory::getUser();
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo JRoute::_('index.php?option=com_messages&view=messages'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<div id="filter-bar" class="btn-toolbar">
<div class="filter-search btn-group pull-left">
<input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('JSEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" class="hasTooltip" title="<?php echo JHtml::tooltipText('COM_MESSAGES_SEARCH_IN_SUBJECT'); ?>" />
</div>
<div class="btn-group pull-left">
<button type="submit" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
<button type="button" class="btn hasTooltip" title="<?php echo JHtml::tooltipText('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
</div>
<div class="btn-group pull-left">
<select name="filter_state" class="inputbox" onchange="this.form.submit()">
<option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED');?></option>
<?php echo JHtml::_('select.options', MessagesHelper::getStateOptions(), 'value', 'text', $this->state->get('filter.state'));?>
</select>
</div>
</div>
<div class="clearfix"> </div>
<table class="table table-striped">
<thead>
<tr>
<th width="20">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th class="title">
<?php echo JHtml::_('grid.sort', 'COM_MESSAGES_HEADING_SUBJECT', 'a.subject', $listDirn, $listOrder); ?>
</th>
<th width="5%">
<?php echo JHtml::_('grid.sort', 'COM_MESSAGES_HEADING_READ', 'a.state', $listDirn, $listOrder); ?>
</th>
<th width="15%">
<?php echo JHtml::_('grid.sort', 'COM_MESSAGES_HEADING_FROM', 'a.user_id_from', $listDirn, $listOrder); ?>
</th>
<th width="20%" class="nowrap">
<?php echo JHtml::_('grid.sort', 'JDATE', 'a.date_time', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="6">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$canChange = $user->authorise('core.edit.state', 'com_messages');
?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<?php echo JHtml::_('grid.id', $i, $item->message_id); ?>
</td>
<td>
<a href="<?php echo JRoute::_('index.php?option=com_messages&view=message&message_id='.(int) $item->message_id); ?>">
<?php echo $this->escape($item->subject); ?></a>
</td>
<td class="center">
<?php echo JHtml::_('messages.state', $item->state, $i, $canChange); ?>
</td>
<td>
<?php echo $item->user_from; ?>
</td>
<td>
<?php echo JHtml::_('date', $item->date_time, JText::_('DATE_FORMAT_LC2')); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</div>
</form>

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

View File

@ -0,0 +1,101 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_messages
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('behavior.modal');
/**
* View class for a list of messages.
*
* @package Joomla.Administrator
* @subpackage com_messages
* @since 1.6
*/
class MessagesViewMessages extends JViewLegacy
{
protected $items;
protected $pagination;
protected $state;
/**
* Display the view
*/
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
$canDo = MessagesHelper::getActions();
JToolbarHelper::title(JText::_('COM_MESSAGES_MANAGER_MESSAGES'), 'inbox.png');
if ($canDo->get('core.create'))
{
JToolbarHelper::addNew('message.add');
}
if ($canDo->get('core.edit.state'))
{
JToolbarHelper::divider();
JToolbarHelper::publish('messages.publish', 'COM_MESSAGES_TOOLBAR_MARK_AS_READ');
JToolbarHelper::unpublish('messages.unpublish', 'COM_MESSAGES_TOOLBAR_MARK_AS_UNREAD');
}
if ($state->get('filter.state') == -2 && $canDo->get('core.delete'))
{
JToolbarHelper::divider();
JToolbarHelper::deleteList('', 'messages.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($canDo->get('core.edit.state'))
{
JToolbarHelper::divider();
JToolbarHelper::trash('messages.trash');
}
//JToolbarHelper::addNew('module.add');
JToolbarHelper::divider();
$bar = JToolBar::getInstance('toolbar');
JHtml::_('bootstrap.modal', 'collapseModal');
$title = JText::_('COM_MESSAGES_TOOLBAR_MY_SETTINGS');
$dhtml = "<a class=\"btn modal btn-small\" href=\"index.php?option=com_messages&amp;view=config&amp;tmpl=component\"
rel=\"{handler:'iframe', size:{x:700,y:300}}\">
<i class=\"icon-cog\" title=\"$title\"></i>$title</a>";
$bar->appendButton('Custom', $dhtml, 'config');
if ($canDo->get('core.admin'))
{
JToolbarHelper::preferences('com_messages');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_COMPONENTS_MESSAGING_INBOX');
}
}