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,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;
}
}