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,115 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @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;
/**
* Banner controller class.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersControllerBanner extends JControllerForm
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_BANNERS_BANNER';
/**
* Method override to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*
* @since 1.6
*/
protected function allowAdd($data = array())
{
$user = JFactory::getUser();
$filter = $this->input->getInt('filter_category_id');
$categoryId = JArrayHelper::getValue($data, 'catid', $filter, 'int');
$allow = null;
if ($categoryId)
{
// If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.category.' . $categoryId);
}
if ($allow === null)
{
// In the absence of better information, revert to the component permissions.
return parent::allowAdd($data);
}
else
{
return $allow;
}
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
*
* @since 1.6
*/
protected function allowEdit($data = array(), $key = 'id')
{
$user = JFactory::getUser();
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$categoryId = 0;
if ($recordId)
{
$categoryId = (int) $this->getModel()->getItem($recordId)->catid;
}
if ($categoryId)
{
// The category has been set. Check the category permissions.
return $user->authorise('core.edit', $this->option . '.category.' . $categoryId);
}
else
{
// Since there is no asset tracking, revert to the component permissions.
return parent::allowEdit($data, $key);
}
}
/**
* Method to run batch operations.
*
* @param string $model The model
*
* @return boolean True on success.
*
* @since 2.5
*/
public function batch($model = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Set the model
$model = $this->getModel('Banner', '', array());
// Preset the redirect
$this->setRedirect(JRoute::_('index.php?option=com_banners&view=banners' . $this->getRedirectToListAppend(), false));
return parent::batch($model);
}
}

View File

@ -0,0 +1,90 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @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;
/**
* Banners list controller class.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersControllerBanners extends JControllerAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_BANNERS_BANNERS';
/**
* Constructor.
*
* @param array An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
$this->registerTask('sticky_unpublish', 'sticky_publish');
}
/**
* Proxy for getModel.
* @since 1.6
*/
public function getModel($name = 'Banner', $prefix = 'BannersModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
/**
* @since 1.6
*/
public function sticky_publish()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$ids = $this->input->get('cid', array(), 'array');
$values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
$task = $this->getTask();
$value = JArrayHelper::getValue($values, $task, 0, 'int');
if (empty($ids))
{
JError::raiseWarning(500, JText::_('COM_BANNERS_NO_BANNERS_SELECTED'));
}
else
{
// Get the model.
$model = $this->getModel();
// Change the state of the records.
if (!$model->stick($ids, $value))
{
JError::raiseWarning(500, $model->getError());
} else {
if ($value == 1)
{
$ntext = 'COM_BANNERS_N_BANNERS_STUCK';
} else {
$ntext = 'COM_BANNERS_N_BANNERS_UNSTUCK';
}
$this->setMessage(JText::plural($ntext, count($ids)));
}
}
$this->setRedirect('index.php?option=com_banners&view=banners');
}
}

View File

@ -0,0 +1,26 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @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;
/**
* Client controller class.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersControllerClient extends JControllerForm
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_BANNERS_CLIENT';
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @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;
/**
* Clients list controller class.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersControllerClients extends JControllerAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_BANNERS_CLIENTS';
/**
* 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 = 'Client', $prefix = 'BannersModel', $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,92 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @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;
/**
* Tracks list controller class.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersControllerTracks extends JControllerLegacy
{
/**
* @var string The context for persistent state.
* @since 1.6
*/
protected $context = 'com_banners.tracks';
/**
* 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 = 'Tracks', $prefix = 'BannersModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
/**
* Method to remove a record.
*
* @return void
* @since 1.6
*/
public function delete()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Get the model.
$model = $this->getModel();
// Load the filter state.
$app = JFactory::getApplication();
$type = $app->getUserState($this->context.'.filter.type');
$model->setState('filter.type', $type);
$begin = $app->getUserState($this->context.'.filter.begin');
$model->setState('filter.begin', $begin);
$end = $app->getUserState($this->context.'.filter.end');
$model->setState('filter.end', $end);
$categoryId = $app->getUserState($this->context.'.filter.category_id');
$model->setState('filter.category_id', $categoryId);
$clientId = $app->getUserState($this->context.'.filter.client_id');
$model->setState('filter.client_id', $clientId);
$model->setState('list.limit', 0);
$model->setState('list.start', 0);
$count = $model->getTotal();
// Remove the items.
if (!$model->delete())
{
JError::raiseWarning(500, $model->getError());
}
else
{
$this->setMessage(JText::plural('COM_BANNERS_TRACKS_N_ITEMS_DELETED', $count));
}
$this->setRedirect('index.php?option=com_banners&view=tracks');
}
}

View File

@ -0,0 +1,106 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_banners
*
* @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;
/**
* Tracks list controller class.
*
* @package Joomla.Administrator
* @subpackage com_banners
* @since 1.6
*/
class BannersControllerTracks extends JControllerLegacy
{
/**
* @var string The context for persistent state.
* @since 1.6
*/
protected $context = 'com_banners.tracks';
/**
* Proxy for getModel.
*
* @param string $name The name of the model.
* @param string $prefix The prefix for the model class name.
*
* @return JModel
* @since 1.6
*/
public function getModel($name = 'Tracks', $prefix = 'BannersModel', $config = array())
{
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
return $model;
}
/**
* Display method for the raw track data.
*
* @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
* @todo This should be done as a view, not here!
*/
public function display($cachable = false, $urlparams = false)
{
// Get the document object.
$document = JFactory::getDocument();
$vName = 'tracks';
$vFormat = 'raw';
// Get and render the view.
if ($view = $this->getView($vName, $vFormat))
{
// Get the model for the view.
$model = $this->getModel($vName);
// Load the filter state.
$app = JFactory::getApplication();
$type = $app->getUserState($this->context.'.filter.type');
$model->setState('filter.type', $type);
$begin = $app->getUserState($this->context.'.filter.begin');
$model->setState('filter.begin', $begin);
$end = $app->getUserState($this->context.'.filter.end');
$model->setState('filter.end', $end);
$categoryId = $app->getUserState($this->context.'.filter.category_id');
$model->setState('filter.category_id', $categoryId);
$clientId = $app->getUserState($this->context.'.filter.client_id');
$model->setState('filter.client_id', $clientId);
$model->setState('list.limit', 0);
$model->setState('list.start', 0);
$form = JRequest::getVar('jform');
$model->setState('basename', $form['basename']);
$model->setState('compressed', $form['compressed']);
$config = JFactory::getConfig();
$cookie_domain = $config->get('cookie_domain', '');
$cookie_path = $config->get('cookie_path', '/');
setcookie(JApplication::getHash($this->context.'.basename'), $form['basename'], time() + 365 * 86400, $cookie_path, $cookie_domain);
setcookie(JApplication::getHash($this->context.'.compressed'), $form['compressed'], time() + 365 * 86400, $cookie_path, $cookie_domain);
// Push the model into the view (as default).
$view->setModel($model, true);
// Push document object into the view.
$view->document = $document;
$view->display();
}
}
}